@staff0rd/assist 0.985.0 → 0.987.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.987.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -764,8 +764,8 @@ function getCurrentOrigin(cwd) {
|
|
|
764
764
|
// src/commands/backlog/getCachedOrigin.ts
|
|
765
765
|
var stableOrigins = /* @__PURE__ */ new Map();
|
|
766
766
|
function getCachedOrigin(cwd) {
|
|
767
|
-
const
|
|
768
|
-
if (
|
|
767
|
+
const cached2 = stableOrigins.get(cwd);
|
|
768
|
+
if (cached2 !== void 0) return cached2;
|
|
769
769
|
const { origin, stable } = resolveCurrentOrigin(cwd);
|
|
770
770
|
if (stable) stableOrigins.set(cwd, origin);
|
|
771
771
|
return origin;
|
|
@@ -821,14 +821,14 @@ function resolveRepoOverride(globalRaw, origin, source) {
|
|
|
821
821
|
var SHARED_REPO_CONFIG_SOURCE = "the shared db";
|
|
822
822
|
var warnedYmlKeys = /* @__PURE__ */ new Set();
|
|
823
823
|
function resolveRepoLayer(globalRaw, cwd) {
|
|
824
|
-
const
|
|
825
|
-
if (Object.keys(
|
|
824
|
+
const cached2 = { repos: readRepoConfigCache() };
|
|
825
|
+
if (Object.keys(cached2.repos).length === 0 && !globalRaw.repos)
|
|
826
826
|
return { override: {} };
|
|
827
827
|
const origin = getCachedOrigin(cwd);
|
|
828
|
-
const dbKey = matchRepoConfigKey(
|
|
828
|
+
const dbKey = matchRepoConfigKey(cached2, origin, SHARED_REPO_CONFIG_SOURCE);
|
|
829
829
|
if (dbKey !== void 0)
|
|
830
830
|
return {
|
|
831
|
-
override: resolveRepoOverride(
|
|
831
|
+
override: resolveRepoOverride(cached2, origin, SHARED_REPO_CONFIG_SOURCE),
|
|
832
832
|
key: dbKey,
|
|
833
833
|
source: "db"
|
|
834
834
|
};
|
|
@@ -1635,7 +1635,7 @@ var defaultDeps = {
|
|
|
1635
1635
|
httpsPort: tailnetHttpsPort
|
|
1636
1636
|
};
|
|
1637
1637
|
async function ensureTailscaleServe(port, deps2 = {}) {
|
|
1638
|
-
const { enabled, status: status2, serveStatus, serve, sleep:
|
|
1638
|
+
const { enabled, status: status2, serveStatus, serve, sleep: sleep2, httpsPort } = {
|
|
1639
1639
|
...defaultDeps,
|
|
1640
1640
|
...deps2
|
|
1641
1641
|
};
|
|
@@ -1650,7 +1650,7 @@ async function ensureTailscaleServe(port, deps2 = {}) {
|
|
|
1650
1650
|
return `serving ${plan2.target} at ${plan2.url}`;
|
|
1651
1651
|
} catch (error) {
|
|
1652
1652
|
if (attempt2 >= SERVE_WRITE_ATTEMPTS) throw error;
|
|
1653
|
-
await
|
|
1653
|
+
await sleep2(attempt2 * 500 + Math.random() * 500);
|
|
1654
1654
|
}
|
|
1655
1655
|
}
|
|
1656
1656
|
}
|
|
@@ -1712,6 +1712,9 @@ function createLinkState({
|
|
|
1712
1712
|
link3 = void 0;
|
|
1713
1713
|
lastSeen = now();
|
|
1714
1714
|
},
|
|
1715
|
+
version() {
|
|
1716
|
+
return link3?.version;
|
|
1717
|
+
},
|
|
1715
1718
|
connected() {
|
|
1716
1719
|
if (link3) return Promise.resolve(link3);
|
|
1717
1720
|
if (now() - lastSeen > recentLinkMs) return Promise.reject(noExtension());
|
|
@@ -1792,6 +1795,7 @@ function createBrowserLink(options2 = {}) {
|
|
|
1792
1795
|
replies.dropSocket(ws);
|
|
1793
1796
|
});
|
|
1794
1797
|
},
|
|
1798
|
+
connectedVersion: () => state.version(),
|
|
1795
1799
|
async request(request, timeoutMs) {
|
|
1796
1800
|
const current = await state.connected();
|
|
1797
1801
|
const reply2 = await replies.send(
|
|
@@ -4205,7 +4209,6 @@ async function readJsonBody(req) {
|
|
|
4205
4209
|
function parseBrowserRequest(body) {
|
|
4206
4210
|
const fields = body ?? {};
|
|
4207
4211
|
const { op, url, selector, text: text18, code } = fields;
|
|
4208
|
-
if (op === "update") return { op };
|
|
4209
4212
|
if (!optionalString(url)) return void 0;
|
|
4210
4213
|
if (op === "status" || op === "snapshot") return { op, url };
|
|
4211
4214
|
if (op === "console") return parseConsoleRequest(url, fields);
|
|
@@ -4564,8 +4567,8 @@ var inFlight = /* @__PURE__ */ new Map();
|
|
|
4564
4567
|
var CACHE_TTL_MS = 1e4;
|
|
4565
4568
|
async function committedPaths(cwd, sessionId) {
|
|
4566
4569
|
const key = `${cwd} ${sessionId}`;
|
|
4567
|
-
const
|
|
4568
|
-
if (
|
|
4570
|
+
const cached2 = cache.get(key);
|
|
4571
|
+
if (cached2 && cached2.expiresAt > Date.now()) return cached2.value;
|
|
4569
4572
|
const pending = inFlight.get(key);
|
|
4570
4573
|
if (pending) return pending;
|
|
4571
4574
|
const lookup = loadCommittedPaths(cwd, sessionId).then((value) => {
|
|
@@ -7132,8 +7135,8 @@ async function resolve8(cwd) {
|
|
|
7132
7135
|
}
|
|
7133
7136
|
async function gitBranchInfo(cwd) {
|
|
7134
7137
|
const now = Date.now();
|
|
7135
|
-
const
|
|
7136
|
-
if (
|
|
7138
|
+
const cached2 = cache2.get(cwd);
|
|
7139
|
+
if (cached2 && cached2.expires > now) return cached2.value;
|
|
7137
7140
|
let value = EMPTY;
|
|
7138
7141
|
try {
|
|
7139
7142
|
value = await resolve8(cwd);
|
|
@@ -8601,8 +8604,8 @@ var CACHE_TTL_MS3 = 5e3;
|
|
|
8601
8604
|
var LS_FILES_MAX_BUFFER = 32 * 1024 * 1024;
|
|
8602
8605
|
var fileListCache = /* @__PURE__ */ new Map();
|
|
8603
8606
|
async function repoFiles(cwd) {
|
|
8604
|
-
const
|
|
8605
|
-
if (
|
|
8607
|
+
const cached2 = fileListCache.get(cwd);
|
|
8608
|
+
if (cached2 && cached2.expires > Date.now()) return cached2.files;
|
|
8606
8609
|
const output = await execGit(
|
|
8607
8610
|
cwd,
|
|
8608
8611
|
["ls-files", "--cached", "--others", "--exclude-standard"],
|
|
@@ -9930,8 +9933,8 @@ function createCachedGhJson(args, parse5, fallback, options2 = {}) {
|
|
|
9930
9933
|
return async (cwd, extraArgs = []) => {
|
|
9931
9934
|
const key = extraArgs.length ? `${cwd}\0${extraArgs.join("\0")}` : cwd;
|
|
9932
9935
|
const now = Date.now();
|
|
9933
|
-
const
|
|
9934
|
-
if (
|
|
9936
|
+
const cached2 = cache7.get(key);
|
|
9937
|
+
if (cached2 && cached2.expires > now) return cached2.value;
|
|
9935
9938
|
let value = fallback;
|
|
9936
9939
|
try {
|
|
9937
9940
|
const { stdout } = await execFileAsync7("gh", [...args, ...extraArgs], {
|
|
@@ -12143,6 +12146,70 @@ function readBuiltVersion(cwd) {
|
|
|
12143
12146
|
}
|
|
12144
12147
|
}
|
|
12145
12148
|
|
|
12149
|
+
// src/commands/extension/extensionUpdateStatus.ts
|
|
12150
|
+
import semver from "semver";
|
|
12151
|
+
function extensionUpdateStatus(connected, latest2) {
|
|
12152
|
+
const behind = Boolean(
|
|
12153
|
+
connected && latest2 && semver.valid(connected) && semver.valid(latest2.version) && semver.gt(latest2.version, connected)
|
|
12154
|
+
);
|
|
12155
|
+
return {
|
|
12156
|
+
connected,
|
|
12157
|
+
latest: latest2?.version,
|
|
12158
|
+
updateLink: behind ? latest2?.update_link : void 0,
|
|
12159
|
+
behind
|
|
12160
|
+
};
|
|
12161
|
+
}
|
|
12162
|
+
|
|
12163
|
+
// src/commands/extension/fetchLatestSignedExtension.ts
|
|
12164
|
+
import { readFile as readFile2 } from "fs/promises";
|
|
12165
|
+
import { join as join27 } from "path";
|
|
12166
|
+
|
|
12167
|
+
// src/commands/extension/extensionDir.ts
|
|
12168
|
+
import { existsSync as existsSync23 } from "fs";
|
|
12169
|
+
import { dirname as dirname14, join as join26 } from "path";
|
|
12170
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
12171
|
+
var moduleDir = dirname14(fileURLToPath2(import.meta.url));
|
|
12172
|
+
function extensionDir() {
|
|
12173
|
+
const bundled = join26(moduleDir, "commands", "extension", "extension");
|
|
12174
|
+
if (existsSync23(bundled)) return bundled;
|
|
12175
|
+
return join26(moduleDir, "..", "..", "..", "extension");
|
|
12176
|
+
}
|
|
12177
|
+
|
|
12178
|
+
// src/commands/extension/latestUpdate.ts
|
|
12179
|
+
function latestUpdate(manifest, updates2) {
|
|
12180
|
+
const { id } = JSON.parse(manifest).browser_specific_settings.gecko;
|
|
12181
|
+
return JSON.parse(updates2).addons[id]?.updates.at(-1);
|
|
12182
|
+
}
|
|
12183
|
+
|
|
12184
|
+
// src/commands/extension/fetchLatestSignedExtension.ts
|
|
12185
|
+
async function fetchLatestSignedExtension() {
|
|
12186
|
+
const manifest = await readFile2(
|
|
12187
|
+
join27(extensionDir(), "manifest.json"),
|
|
12188
|
+
"utf8"
|
|
12189
|
+
);
|
|
12190
|
+
const updateUrl = JSON.parse(manifest).browser_specific_settings.gecko.update_url;
|
|
12191
|
+
const response = await fetch(updateUrl, {
|
|
12192
|
+
signal: AbortSignal.timeout(1e4)
|
|
12193
|
+
});
|
|
12194
|
+
if (!response.ok) return { updateUrl };
|
|
12195
|
+
return { updateUrl, latest: latestUpdate(manifest, await response.text()) };
|
|
12196
|
+
}
|
|
12197
|
+
|
|
12198
|
+
// src/commands/sessions/web/updates/latestSignedExtension.ts
|
|
12199
|
+
var CACHE_MS = 6e4;
|
|
12200
|
+
var cached = {
|
|
12201
|
+
at: Number.NEGATIVE_INFINITY,
|
|
12202
|
+
value: Promise.resolve(void 0)
|
|
12203
|
+
};
|
|
12204
|
+
function latestSignedExtension(now = Date.now()) {
|
|
12205
|
+
if (now - cached.at < CACHE_MS) return cached.value;
|
|
12206
|
+
cached = {
|
|
12207
|
+
at: now,
|
|
12208
|
+
value: fetchLatestSignedExtension().then(({ latest: latest2 }) => latest2).catch(() => void 0)
|
|
12209
|
+
};
|
|
12210
|
+
return cached.value;
|
|
12211
|
+
}
|
|
12212
|
+
|
|
12146
12213
|
// src/commands/watch/restartRules.ts
|
|
12147
12214
|
var webUiPrefix = "src/commands/sessions/web/ui/";
|
|
12148
12215
|
var sessionsPrefix = "src/commands/sessions/";
|
|
@@ -12190,7 +12257,7 @@ function stripAnsi(text18) {
|
|
|
12190
12257
|
// src/commands/sessions/daemon/worktree/watcherLogPath.ts
|
|
12191
12258
|
import { createHash } from "crypto";
|
|
12192
12259
|
import { homedir as homedir12 } from "os";
|
|
12193
|
-
import { basename as basename10, join as
|
|
12260
|
+
import { basename as basename10, join as join28 } from "path";
|
|
12194
12261
|
|
|
12195
12262
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
12196
12263
|
import { realpathSync } from "fs";
|
|
@@ -12207,8 +12274,8 @@ function canonicalTreePath(path109) {
|
|
|
12207
12274
|
function watcherLogPath(cwd) {
|
|
12208
12275
|
const clone = canonicalTreePath(cwd);
|
|
12209
12276
|
const key = createHash("sha1").update(clone).digest("hex").slice(0, 8);
|
|
12210
|
-
const dir = process.env.ASSIST_WATCHER_LOG_DIR ??
|
|
12211
|
-
return
|
|
12277
|
+
const dir = process.env.ASSIST_WATCHER_LOG_DIR ?? join28(homedir12(), ".assist", "watchers");
|
|
12278
|
+
return join28(dir, `${basename10(clone) || "root"}-${key}.log`);
|
|
12212
12279
|
}
|
|
12213
12280
|
|
|
12214
12281
|
// src/commands/sessions/web/updates/readUpdateHistory.ts
|
|
@@ -12270,7 +12337,11 @@ async function updates(_req, res) {
|
|
|
12270
12337
|
since: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12271
12338
|
reason: "daemon not reachable"
|
|
12272
12339
|
},
|
|
12273
|
-
history: readUpdateHistory(installDir)
|
|
12340
|
+
history: readUpdateHistory(installDir),
|
|
12341
|
+
extension: extensionUpdateStatus(
|
|
12342
|
+
browserLink.connectedVersion(),
|
|
12343
|
+
await latestSignedExtension()
|
|
12344
|
+
)
|
|
12274
12345
|
};
|
|
12275
12346
|
respondJson(res, 200, status2);
|
|
12276
12347
|
}
|
|
@@ -12323,7 +12394,7 @@ async function readRequestBuffer(req, limit) {
|
|
|
12323
12394
|
|
|
12324
12395
|
// src/commands/sessions/web/stageAttachment.ts
|
|
12325
12396
|
import { mkdir, mkdtemp, writeFile } from "fs/promises";
|
|
12326
|
-
import { extname as extname2, join as
|
|
12397
|
+
import { extname as extname2, join as join29 } from "path";
|
|
12327
12398
|
|
|
12328
12399
|
// src/commands/sessions/web/ghAttachableExtensions.ts
|
|
12329
12400
|
var ghAttachableExtensions = /* @__PURE__ */ new Set([
|
|
@@ -12355,9 +12426,9 @@ function safeBaseName(name) {
|
|
|
12355
12426
|
async function stageAttachment(name, contentType, body) {
|
|
12356
12427
|
const ext = pickExtension(name, contentType);
|
|
12357
12428
|
await mkdir(stagedAttachmentsDir, { recursive: true });
|
|
12358
|
-
const dir = await mkdtemp(
|
|
12429
|
+
const dir = await mkdtemp(join29(stagedAttachmentsDir, "upload-"));
|
|
12359
12430
|
const alt = safeBaseName(name);
|
|
12360
|
-
const filePath =
|
|
12431
|
+
const filePath = join29(dir, `${alt}.${ext}`);
|
|
12361
12432
|
await writeFile(filePath, body);
|
|
12362
12433
|
return { dir, filePath, alt };
|
|
12363
12434
|
}
|
|
@@ -12402,21 +12473,21 @@ async function uploadPrImage(req, res) {
|
|
|
12402
12473
|
}
|
|
12403
12474
|
|
|
12404
12475
|
// src/commands/sessions/web/writeFileContent.ts
|
|
12405
|
-
import { readFile as
|
|
12476
|
+
import { readFile as readFile3, stat as stat3, writeFile as writeFile2 } from "fs/promises";
|
|
12406
12477
|
|
|
12407
12478
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
12408
12479
|
import { execFile as execFile9 } from "child_process";
|
|
12409
|
-
import { existsSync as
|
|
12410
|
-
import { dirname as
|
|
12480
|
+
import { existsSync as existsSync24 } from "fs";
|
|
12481
|
+
import { dirname as dirname15, join as join30 } from "path";
|
|
12411
12482
|
import { promisify as promisify10 } from "util";
|
|
12412
12483
|
var execFileAsync9 = promisify10(execFile9);
|
|
12413
12484
|
var TIMEOUT_MS = 15e3;
|
|
12414
12485
|
function findOxfmtScript(root2) {
|
|
12415
12486
|
let dir = root2;
|
|
12416
12487
|
for (; ; ) {
|
|
12417
|
-
const candidate =
|
|
12418
|
-
if (
|
|
12419
|
-
const parent =
|
|
12488
|
+
const candidate = join30(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
12489
|
+
if (existsSync24(candidate)) return candidate;
|
|
12490
|
+
const parent = dirname15(dir);
|
|
12420
12491
|
if (parent === dir) return void 0;
|
|
12421
12492
|
dir = parent;
|
|
12422
12493
|
}
|
|
@@ -12474,7 +12545,7 @@ async function writeFileContent(req, res) {
|
|
|
12474
12545
|
await writeFile2(resolved.target, body.content, "utf8");
|
|
12475
12546
|
await formatWithOxfmt(resolved.target, repoRoot(resolved.cwd));
|
|
12476
12547
|
respondJson(res, 200, {
|
|
12477
|
-
content: await
|
|
12548
|
+
content: await readFile3(resolved.target, "utf8"),
|
|
12478
12549
|
mtimeMs: await currentMtimeMs(resolved.target)
|
|
12479
12550
|
});
|
|
12480
12551
|
} catch (error) {
|
|
@@ -12487,10 +12558,10 @@ async function writeFileContent(req, res) {
|
|
|
12487
12558
|
// src/shared/createBundleHandler.ts
|
|
12488
12559
|
import { createHash as createHash2 } from "crypto";
|
|
12489
12560
|
import { readFileSync as readFileSync10, statSync as statSync6 } from "fs";
|
|
12490
|
-
import { dirname as
|
|
12491
|
-
import { fileURLToPath as
|
|
12561
|
+
import { dirname as dirname16, join as join31 } from "path";
|
|
12562
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
12492
12563
|
function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
|
|
12493
|
-
const file =
|
|
12564
|
+
const file = join31(dirname16(fileURLToPath3(importMetaUrl)), bundlePath);
|
|
12494
12565
|
let cache7;
|
|
12495
12566
|
return (req, res) => {
|
|
12496
12567
|
const mtimeMs = statSync6(file).mtimeMs;
|
|
@@ -12916,8 +12987,8 @@ function scheduleReconnect() {
|
|
|
12916
12987
|
var cache5 = /* @__PURE__ */ new Map();
|
|
12917
12988
|
function originResolutionForCwd(cwd) {
|
|
12918
12989
|
if (!cwd) return void 0;
|
|
12919
|
-
const
|
|
12920
|
-
if (
|
|
12990
|
+
const cached2 = cache5.get(cwd);
|
|
12991
|
+
if (cached2 !== void 0) return { origin: cached2, stable: true };
|
|
12921
12992
|
const resolved = resolveCurrentOrigin(cwd);
|
|
12922
12993
|
if (resolved.stable) cache5.set(cwd, resolved.origin);
|
|
12923
12994
|
return resolved;
|
|
@@ -12927,9 +12998,9 @@ function originForCwd(cwd) {
|
|
|
12927
12998
|
}
|
|
12928
12999
|
|
|
12929
13000
|
// src/commands/sessions/daemon/repoDirExists.ts
|
|
12930
|
-
import { existsSync as
|
|
13001
|
+
import { existsSync as existsSync25 } from "fs";
|
|
12931
13002
|
function repoDirExists(cwd) {
|
|
12932
|
-
return
|
|
13003
|
+
return existsSync25(cwd);
|
|
12933
13004
|
}
|
|
12934
13005
|
|
|
12935
13006
|
// src/commands/sessions/daemon/worktree/git.ts
|
|
@@ -13431,17 +13502,17 @@ import * as path14 from "path";
|
|
|
13431
13502
|
import chalk21 from "chalk";
|
|
13432
13503
|
|
|
13433
13504
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
13434
|
-
import { existsSync as
|
|
13435
|
-
import { join as
|
|
13505
|
+
import { existsSync as existsSync26, readFileSync as readFileSync12, writeFileSync as writeFileSync7 } from "fs";
|
|
13506
|
+
import { join as join32 } from "path";
|
|
13436
13507
|
import chalk20 from "chalk";
|
|
13437
13508
|
function loadKnipConfig(knipJsonPath) {
|
|
13438
|
-
if (
|
|
13509
|
+
if (existsSync26(knipJsonPath)) {
|
|
13439
13510
|
return JSON.parse(readFileSync12(knipJsonPath, "utf8"));
|
|
13440
13511
|
}
|
|
13441
13512
|
return { $schema: "https://unpkg.com/knip@5/schema.json" };
|
|
13442
13513
|
}
|
|
13443
13514
|
function addToKnipIgnoreBinaries(cwd, binary) {
|
|
13444
|
-
const knipJsonPath =
|
|
13515
|
+
const knipJsonPath = join32(cwd, "knip.json");
|
|
13445
13516
|
try {
|
|
13446
13517
|
const knipConfig = loadKnipConfig(knipJsonPath);
|
|
13447
13518
|
const ignoreBinaries = knipConfig.ignoreBinaries ?? [];
|
|
@@ -13488,7 +13559,7 @@ import * as path16 from "path";
|
|
|
13488
13559
|
import chalk26 from "chalk";
|
|
13489
13560
|
|
|
13490
13561
|
// src/commands/format/init.ts
|
|
13491
|
-
import { existsSync as
|
|
13562
|
+
import { existsSync as existsSync27, readFileSync as readFileSync13, writeFileSync as writeFileSync8 } from "fs";
|
|
13492
13563
|
import chalk24 from "chalk";
|
|
13493
13564
|
|
|
13494
13565
|
// src/shared/promptConfirm.ts
|
|
@@ -13550,7 +13621,7 @@ async function init() {
|
|
|
13550
13621
|
const newContent = `${JSON.stringify(oxfmtrc_template_default, null, " ")}
|
|
13551
13622
|
`;
|
|
13552
13623
|
const configPath = ".oxfmtrc.json";
|
|
13553
|
-
const oldContent =
|
|
13624
|
+
const oldContent = existsSync27(configPath) ? readFileSync13(configPath, "utf8") : "";
|
|
13554
13625
|
if (oldContent === newContent) {
|
|
13555
13626
|
console.log(".oxfmtrc.json already has the baseline formatter config");
|
|
13556
13627
|
return;
|
|
@@ -13573,15 +13644,15 @@ async function init() {
|
|
|
13573
13644
|
}
|
|
13574
13645
|
|
|
13575
13646
|
// src/commands/lint/init.ts
|
|
13576
|
-
import { existsSync as
|
|
13647
|
+
import { existsSync as existsSync30, readFileSync as readFileSync15, writeFileSync as writeFileSync10 } from "fs";
|
|
13577
13648
|
import chalk25 from "chalk";
|
|
13578
13649
|
|
|
13579
13650
|
// src/shared/removeEslint.ts
|
|
13580
13651
|
import { execSync as execSync7 } from "child_process";
|
|
13581
|
-
import { existsSync as
|
|
13652
|
+
import { existsSync as existsSync29, readFileSync as readFileSync14, writeFileSync as writeFileSync9 } from "fs";
|
|
13582
13653
|
|
|
13583
13654
|
// src/shared/removeEslint/removeEslintConfigFiles.ts
|
|
13584
|
-
import { existsSync as
|
|
13655
|
+
import { existsSync as existsSync28, unlinkSync as unlinkSync2 } from "fs";
|
|
13585
13656
|
var ESLINT_CONFIG_FILES = [
|
|
13586
13657
|
"eslint.config.js",
|
|
13587
13658
|
"eslint.config.mjs",
|
|
@@ -13597,7 +13668,7 @@ var ESLINT_CONFIG_FILES = [
|
|
|
13597
13668
|
function removeEslintConfigFiles() {
|
|
13598
13669
|
let removed = false;
|
|
13599
13670
|
for (const configFile of ESLINT_CONFIG_FILES) {
|
|
13600
|
-
if (
|
|
13671
|
+
if (existsSync28(configFile)) {
|
|
13601
13672
|
unlinkSync2(configFile);
|
|
13602
13673
|
console.log(`Removed ${configFile}`);
|
|
13603
13674
|
removed = true;
|
|
@@ -13619,7 +13690,7 @@ function removeEslint(options2 = {}) {
|
|
|
13619
13690
|
}
|
|
13620
13691
|
function removeEslintFromPackageJson(options2) {
|
|
13621
13692
|
const packageJsonPath = "package.json";
|
|
13622
|
-
if (!
|
|
13693
|
+
if (!existsSync29(packageJsonPath)) {
|
|
13623
13694
|
return false;
|
|
13624
13695
|
}
|
|
13625
13696
|
const packageJson = JSON.parse(readFileSync14(packageJsonPath, "utf8"));
|
|
@@ -13686,7 +13757,7 @@ async function writeOxlintConfig() {
|
|
|
13686
13757
|
const newContent = `${JSON.stringify(oxlintrc_template_default, null, " ")}
|
|
13687
13758
|
`;
|
|
13688
13759
|
const configPath = ".oxlintrc.json";
|
|
13689
|
-
const oldContent =
|
|
13760
|
+
const oldContent = existsSync30(configPath) ? readFileSync15(configPath, "utf8") : "";
|
|
13690
13761
|
if (oldContent === newContent) {
|
|
13691
13762
|
console.log(".oxlintrc.json already has the baseline linter config");
|
|
13692
13763
|
return;
|
|
@@ -14467,7 +14538,7 @@ async function newCli() {
|
|
|
14467
14538
|
|
|
14468
14539
|
// src/commands/new/registerNew/newProject.ts
|
|
14469
14540
|
import { execSync as execSync14 } from "child_process";
|
|
14470
|
-
import { existsSync as
|
|
14541
|
+
import { existsSync as existsSync35, readFileSync as readFileSync19, writeFileSync as writeFileSync17 } from "fs";
|
|
14471
14542
|
|
|
14472
14543
|
// src/commands/deploy/init.ts
|
|
14473
14544
|
import { execSync as execSync13 } from "child_process";
|
|
@@ -14475,14 +14546,14 @@ import chalk36 from "chalk";
|
|
|
14475
14546
|
import enquirer3 from "enquirer";
|
|
14476
14547
|
|
|
14477
14548
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
14478
|
-
import { existsSync as
|
|
14479
|
-
import { dirname as
|
|
14480
|
-
import { fileURLToPath as
|
|
14549
|
+
import { existsSync as existsSync34, mkdirSync as mkdirSync9, readFileSync as readFileSync18, writeFileSync as writeFileSync16 } from "fs";
|
|
14550
|
+
import { dirname as dirname24, join as join39 } from "path";
|
|
14551
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
14481
14552
|
import chalk35 from "chalk";
|
|
14482
14553
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
14483
|
-
var __dirname3 =
|
|
14554
|
+
var __dirname3 = dirname24(fileURLToPath4(import.meta.url));
|
|
14484
14555
|
function getExistingSiteId() {
|
|
14485
|
-
if (!
|
|
14556
|
+
if (!existsSync34(WORKFLOW_PATH)) {
|
|
14486
14557
|
return null;
|
|
14487
14558
|
}
|
|
14488
14559
|
const content = readFileSync18(WORKFLOW_PATH, "utf8");
|
|
@@ -14490,17 +14561,17 @@ function getExistingSiteId() {
|
|
|
14490
14561
|
return match ? match[1] : null;
|
|
14491
14562
|
}
|
|
14492
14563
|
function getTemplateContent(siteId) {
|
|
14493
|
-
const templatePath =
|
|
14564
|
+
const templatePath = join39(__dirname3, "commands/deploy/build.yml");
|
|
14494
14565
|
const template = readFileSync18(templatePath, "utf8");
|
|
14495
14566
|
return template.replace("{{NETLIFY_SITE_ID}}", siteId);
|
|
14496
14567
|
}
|
|
14497
14568
|
async function updateWorkflow(siteId) {
|
|
14498
14569
|
const newContent = getTemplateContent(siteId);
|
|
14499
14570
|
const workflowDir = ".github/workflows";
|
|
14500
|
-
if (!
|
|
14571
|
+
if (!existsSync34(workflowDir)) {
|
|
14501
14572
|
mkdirSync9(workflowDir, { recursive: true });
|
|
14502
14573
|
}
|
|
14503
|
-
if (
|
|
14574
|
+
if (existsSync34(WORKFLOW_PATH)) {
|
|
14504
14575
|
const oldContent = readFileSync18(WORKFLOW_PATH, "utf8");
|
|
14505
14576
|
if (oldContent === newContent) {
|
|
14506
14577
|
console.log(chalk35.green("build.yml is already up to date"));
|
|
@@ -14595,7 +14666,7 @@ async function newProject() {
|
|
|
14595
14666
|
}
|
|
14596
14667
|
function addViteBaseConfig() {
|
|
14597
14668
|
const viteConfigPath = "vite.config.ts";
|
|
14598
|
-
if (!
|
|
14669
|
+
if (!existsSync35(viteConfigPath)) {
|
|
14599
14670
|
console.log("No vite.config.ts found, skipping base config");
|
|
14600
14671
|
return;
|
|
14601
14672
|
}
|
|
@@ -14797,18 +14868,18 @@ function adviceContextFor(cwd) {
|
|
|
14797
14868
|
|
|
14798
14869
|
// src/commands/advise/loadAdviceFragments.ts
|
|
14799
14870
|
import { readdirSync as readdirSync5, readFileSync as readFileSync20 } from "fs";
|
|
14800
|
-
import { basename as basename12, join as
|
|
14871
|
+
import { basename as basename12, join as join41 } from "path";
|
|
14801
14872
|
|
|
14802
14873
|
// src/commands/advise/adviceDir.ts
|
|
14803
|
-
import { existsSync as
|
|
14804
|
-
import { dirname as
|
|
14805
|
-
import { fileURLToPath as
|
|
14874
|
+
import { existsSync as existsSync36 } from "fs";
|
|
14875
|
+
import { dirname as dirname25, join as join40 } from "path";
|
|
14876
|
+
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
14806
14877
|
function adviceDir() {
|
|
14807
|
-
let current =
|
|
14808
|
-
while (current !==
|
|
14809
|
-
const candidate =
|
|
14810
|
-
if (
|
|
14811
|
-
current =
|
|
14878
|
+
let current = dirname25(fileURLToPath5(import.meta.url));
|
|
14879
|
+
while (current !== dirname25(current)) {
|
|
14880
|
+
const candidate = join40(current, "claude", "advice");
|
|
14881
|
+
if (existsSync36(candidate)) return candidate;
|
|
14882
|
+
current = dirname25(current);
|
|
14812
14883
|
}
|
|
14813
14884
|
throw new Error("Could not locate the shipped claude/advice directory");
|
|
14814
14885
|
}
|
|
@@ -14839,7 +14910,7 @@ function loadAdviceFragments(dir = adviceDir()) {
|
|
|
14839
14910
|
return readdirSync5(dir).filter((file) => file.endsWith(".md")).sort().map(
|
|
14840
14911
|
(file) => parseAdviceFragment(
|
|
14841
14912
|
basename12(file, ".md"),
|
|
14842
|
-
readFileSync20(
|
|
14913
|
+
readFileSync20(join41(dir, file), "utf8")
|
|
14843
14914
|
)
|
|
14844
14915
|
);
|
|
14845
14916
|
}
|
|
@@ -14873,13 +14944,13 @@ function renderAdviceBody(fragment, context) {
|
|
|
14873
14944
|
}
|
|
14874
14945
|
|
|
14875
14946
|
// src/commands/advise/adviceConditions.ts
|
|
14876
|
-
import { existsSync as
|
|
14877
|
-
import { join as
|
|
14947
|
+
import { existsSync as existsSync37 } from "fs";
|
|
14948
|
+
import { join as join42 } from "path";
|
|
14878
14949
|
function repoFile(file, label) {
|
|
14879
14950
|
return {
|
|
14880
14951
|
whenMet: `the repo has ${label}`,
|
|
14881
14952
|
whenUnmet: `the repo has no ${label}`,
|
|
14882
|
-
matches: ({ rootDir }) =>
|
|
14953
|
+
matches: ({ rootDir }) => existsSync37(join42(rootDir, file))
|
|
14883
14954
|
};
|
|
14884
14955
|
}
|
|
14885
14956
|
var adviceConditions = {
|
|
@@ -14900,11 +14971,11 @@ var adviceConditions = {
|
|
|
14900
14971
|
},
|
|
14901
14972
|
typescript: repoFile("tsconfig.json", "a tsconfig.json"),
|
|
14902
14973
|
filenameConvention: repoFile(
|
|
14903
|
-
|
|
14974
|
+
join42("oxlint-rules", "filenameConvention.ts"),
|
|
14904
14975
|
"oxlint-rules/filenameConvention.ts"
|
|
14905
14976
|
),
|
|
14906
14977
|
claudeSettings: repoFile(
|
|
14907
|
-
|
|
14978
|
+
join42("claude", "settings.json"),
|
|
14908
14979
|
"claude/settings.json"
|
|
14909
14980
|
),
|
|
14910
14981
|
verify: {
|
|
@@ -15455,7 +15526,7 @@ function registerAskQuestion(program) {
|
|
|
15455
15526
|
|
|
15456
15527
|
// src/commands/registerBackup.ts
|
|
15457
15528
|
import { mkdir as mkdir3, stat as stat4 } from "fs/promises";
|
|
15458
|
-
import { join as
|
|
15529
|
+
import { join as join44, resolve as resolve15 } from "path";
|
|
15459
15530
|
import chalk41 from "chalk";
|
|
15460
15531
|
|
|
15461
15532
|
// src/shared/db/recordBackup.ts
|
|
@@ -15469,7 +15540,7 @@ async function recordBackup(db, {
|
|
|
15469
15540
|
|
|
15470
15541
|
// src/commands/backup/scheduleBackup.ts
|
|
15471
15542
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
15472
|
-
import { join as
|
|
15543
|
+
import { join as join43 } from "path";
|
|
15473
15544
|
import chalk39 from "chalk";
|
|
15474
15545
|
|
|
15475
15546
|
// src/commands/backup/readCrontab.ts
|
|
@@ -15611,7 +15682,7 @@ async function scheduleBackup({
|
|
|
15611
15682
|
const cronExpr = durationToCron(every);
|
|
15612
15683
|
const dir = expandTilde(loadConfig().backup.dir);
|
|
15613
15684
|
await mkdir2(dir, { recursive: true });
|
|
15614
|
-
const logPath2 =
|
|
15685
|
+
const logPath2 = join43(dir, "cron.log");
|
|
15615
15686
|
const cronLine = `${cronExpr} ${resolveAssistCommand()} backup >> ${logPath2} 2>&1`;
|
|
15616
15687
|
writeCrontab(upsertScheduleBlock(readCrontab(), every, cronLine));
|
|
15617
15688
|
console.error(
|
|
@@ -15790,7 +15861,7 @@ async function backup({ out }) {
|
|
|
15790
15861
|
await mkdir3(dir, { recursive: true });
|
|
15791
15862
|
const start2 = Date.now();
|
|
15792
15863
|
const timestamp8 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
15793
|
-
const filePath = resolve15(
|
|
15864
|
+
const filePath = resolve15(join44(dir, `backup-${timestamp8}.dump`));
|
|
15794
15865
|
await exportBacklog(filePath);
|
|
15795
15866
|
const { size } = await stat4(filePath);
|
|
15796
15867
|
const durationMs = Date.now() - start2;
|
|
@@ -16316,7 +16387,7 @@ function registerAssociateJiraCommand(cmd) {
|
|
|
16316
16387
|
|
|
16317
16388
|
// src/commands/backlog/cloneRepo.ts
|
|
16318
16389
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
16319
|
-
import { existsSync as
|
|
16390
|
+
import { existsSync as existsSync39 } from "fs";
|
|
16320
16391
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
16321
16392
|
import chalk48 from "chalk";
|
|
16322
16393
|
|
|
@@ -16352,7 +16423,7 @@ async function cloneRepo(originRaw) {
|
|
|
16352
16423
|
if (!target) {
|
|
16353
16424
|
return fail3(`Could not derive a repository name from "${origin}".`);
|
|
16354
16425
|
}
|
|
16355
|
-
if (
|
|
16426
|
+
if (existsSync39(target)) {
|
|
16356
16427
|
return fail3(`Clone target already exists: ${target}`);
|
|
16357
16428
|
}
|
|
16358
16429
|
await mkdir4(baseDir, { recursive: true });
|
|
@@ -16479,7 +16550,7 @@ function registerExportCommand(cmd) {
|
|
|
16479
16550
|
}
|
|
16480
16551
|
|
|
16481
16552
|
// src/commands/backlog/importBacklog.ts
|
|
16482
|
-
import { readFile as
|
|
16553
|
+
import { readFile as readFile4 } from "fs/promises";
|
|
16483
16554
|
import chalk54 from "chalk";
|
|
16484
16555
|
|
|
16485
16556
|
// src/commands/backlog/dump/countCopyRows.ts
|
|
@@ -16647,7 +16718,7 @@ async function restore(client, parsed) {
|
|
|
16647
16718
|
|
|
16648
16719
|
// src/commands/backlog/importBacklog.ts
|
|
16649
16720
|
async function importBacklog(file, options2 = {}) {
|
|
16650
|
-
const raw = file ? await
|
|
16721
|
+
const raw = file ? await readFile4(file) : await readStdinBuffer();
|
|
16651
16722
|
const parsed = parseDump(raw);
|
|
16652
16723
|
validateDump(parsed);
|
|
16653
16724
|
const { tables } = parsed.header;
|
|
@@ -16737,7 +16808,7 @@ function ensureRemoteOrigin() {
|
|
|
16737
16808
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
16738
16809
|
import { mkdtempSync, readFileSync as readFileSync22, unlinkSync as unlinkSync3, writeFileSync as writeFileSync18 } from "fs";
|
|
16739
16810
|
import { tmpdir } from "os";
|
|
16740
|
-
import { join as
|
|
16811
|
+
import { join as join47 } from "path";
|
|
16741
16812
|
import enquirer4 from "enquirer";
|
|
16742
16813
|
async function promptType() {
|
|
16743
16814
|
const { type } = await enquirer4.prompt({
|
|
@@ -16777,8 +16848,8 @@ async function promptDescription() {
|
|
|
16777
16848
|
}
|
|
16778
16849
|
function openEditor() {
|
|
16779
16850
|
const editor = process.env.EDITOR || process.env.VISUAL || "vi";
|
|
16780
|
-
const dir = mkdtempSync(
|
|
16781
|
-
const filePath =
|
|
16851
|
+
const dir = mkdtempSync(join47(tmpdir(), "assist-"));
|
|
16852
|
+
const filePath = join47(dir, "description.md");
|
|
16782
16853
|
writeFileSync18(filePath, "");
|
|
16783
16854
|
const result = spawnSync5(editor, [filePath], { stdio: "inherit" });
|
|
16784
16855
|
if (result.status !== 0) {
|
|
@@ -17523,14 +17594,14 @@ function hasLocalChanges() {
|
|
|
17523
17594
|
|
|
17524
17595
|
// src/commands/backlog/acquireLock.ts
|
|
17525
17596
|
import {
|
|
17526
|
-
existsSync as
|
|
17597
|
+
existsSync as existsSync40,
|
|
17527
17598
|
mkdirSync as mkdirSync10,
|
|
17528
17599
|
readFileSync as readFileSync24,
|
|
17529
17600
|
unlinkSync as unlinkSync4,
|
|
17530
17601
|
writeFileSync as writeFileSync19
|
|
17531
17602
|
} from "fs";
|
|
17532
17603
|
import { homedir as homedir14 } from "os";
|
|
17533
|
-
import { join as
|
|
17604
|
+
import { join as join48 } from "path";
|
|
17534
17605
|
|
|
17535
17606
|
// src/commands/backlog/bootedAt.ts
|
|
17536
17607
|
import { uptime } from "os";
|
|
@@ -17566,10 +17637,10 @@ function isStaleLock(pid, timestamp8) {
|
|
|
17566
17637
|
|
|
17567
17638
|
// src/commands/backlog/acquireLock.ts
|
|
17568
17639
|
function getLocksDir() {
|
|
17569
|
-
return
|
|
17640
|
+
return join48(homedir14(), ".assist", "locks");
|
|
17570
17641
|
}
|
|
17571
17642
|
function getLockPath(itemId2) {
|
|
17572
|
-
return
|
|
17643
|
+
return join48(getLocksDir(), `lock-${itemId2}.json`);
|
|
17573
17644
|
}
|
|
17574
17645
|
function isProcessAlive(pid) {
|
|
17575
17646
|
try {
|
|
@@ -17581,7 +17652,7 @@ function isProcessAlive(pid) {
|
|
|
17581
17652
|
}
|
|
17582
17653
|
function foreignLockHolder(itemId2) {
|
|
17583
17654
|
const lockPath = getLockPath(itemId2);
|
|
17584
|
-
if (!
|
|
17655
|
+
if (!existsSync40(lockPath)) return null;
|
|
17585
17656
|
try {
|
|
17586
17657
|
const lock2 = JSON.parse(readFileSync24(lockPath, "utf8"));
|
|
17587
17658
|
if (typeof lock2.pid !== "number" || lock2.pid === process.pid) return null;
|
|
@@ -17967,7 +18038,7 @@ Failed to launch Claude for ${context}: ${message3}`)
|
|
|
17967
18038
|
|
|
17968
18039
|
// src/commands/sessions/daemon/ensureHooksSettings.ts
|
|
17969
18040
|
import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync20 } from "fs";
|
|
17970
|
-
import { dirname as
|
|
18041
|
+
import { dirname as dirname26 } from "path";
|
|
17971
18042
|
var SET_STATUS = "assist sessions set-status";
|
|
17972
18043
|
function running(source) {
|
|
17973
18044
|
return `${SET_STATUS} running --source ${source}`;
|
|
@@ -18000,7 +18071,7 @@ var hooksSettings = {
|
|
|
18000
18071
|
};
|
|
18001
18072
|
function ensureHooksSettings() {
|
|
18002
18073
|
const path109 = daemonPaths.hooksSettings;
|
|
18003
|
-
mkdirSync11(
|
|
18074
|
+
mkdirSync11(dirname26(path109), { recursive: true });
|
|
18004
18075
|
writeFileSync20(path109, JSON.stringify(hooksSettings, null, 2));
|
|
18005
18076
|
return path109;
|
|
18006
18077
|
}
|
|
@@ -18066,14 +18137,14 @@ async function resumeDoneConversation({ item, resumeSessionId }, spawnOptions) {
|
|
|
18066
18137
|
}
|
|
18067
18138
|
|
|
18068
18139
|
// src/commands/backlog/consumePause.ts
|
|
18069
|
-
import { existsSync as
|
|
18140
|
+
import { existsSync as existsSync41, mkdirSync as mkdirSync12, unlinkSync as unlinkSync5, writeFileSync as writeFileSync21 } from "fs";
|
|
18070
18141
|
import { homedir as homedir15 } from "os";
|
|
18071
|
-
import { join as
|
|
18142
|
+
import { join as join49 } from "path";
|
|
18072
18143
|
function getControlsDir() {
|
|
18073
|
-
return
|
|
18144
|
+
return join49(homedir15(), ".assist", "controls");
|
|
18074
18145
|
}
|
|
18075
18146
|
function getPausePath(itemId2) {
|
|
18076
|
-
return
|
|
18147
|
+
return join49(getControlsDir(), `pause-${itemId2}.json`);
|
|
18077
18148
|
}
|
|
18078
18149
|
function requestPause(itemId2) {
|
|
18079
18150
|
mkdirSync12(getControlsDir(), { recursive: true });
|
|
@@ -18083,7 +18154,7 @@ function requestPause(itemId2) {
|
|
|
18083
18154
|
);
|
|
18084
18155
|
}
|
|
18085
18156
|
function isPausePending(itemId2) {
|
|
18086
|
-
return
|
|
18157
|
+
return existsSync41(getPausePath(itemId2));
|
|
18087
18158
|
}
|
|
18088
18159
|
function clearPause(itemId2) {
|
|
18089
18160
|
try {
|
|
@@ -18093,7 +18164,7 @@ function clearPause(itemId2) {
|
|
|
18093
18164
|
}
|
|
18094
18165
|
function consumePause(itemId2) {
|
|
18095
18166
|
const pausePath = getPausePath(itemId2);
|
|
18096
|
-
if (!
|
|
18167
|
+
if (!existsSync41(pausePath)) return false;
|
|
18097
18168
|
try {
|
|
18098
18169
|
unlinkSync5(pausePath);
|
|
18099
18170
|
} catch {
|
|
@@ -18345,13 +18416,13 @@ function spawnHarness(harness, prompt, options2 = {}) {
|
|
|
18345
18416
|
}
|
|
18346
18417
|
|
|
18347
18418
|
// src/commands/backlog/watchForMarker.ts
|
|
18348
|
-
import { existsSync as
|
|
18419
|
+
import { existsSync as existsSync43, unwatchFile, watchFile } from "fs";
|
|
18349
18420
|
|
|
18350
18421
|
// src/commands/backlog/readSignal.ts
|
|
18351
|
-
import { existsSync as
|
|
18422
|
+
import { existsSync as existsSync42, readFileSync as readFileSync25 } from "fs";
|
|
18352
18423
|
function readSignal() {
|
|
18353
18424
|
const path109 = getSignalPath();
|
|
18354
|
-
if (!path109 || !
|
|
18425
|
+
if (!path109 || !existsSync42(path109)) return void 0;
|
|
18355
18426
|
try {
|
|
18356
18427
|
return JSON.parse(readFileSync25(path109, "utf8"));
|
|
18357
18428
|
} catch {
|
|
@@ -18365,7 +18436,7 @@ function watchForMarker(child, options2) {
|
|
|
18365
18436
|
const statusPath = getSignalPath();
|
|
18366
18437
|
if (!statusPath) return { killedOnMarker: () => killed };
|
|
18367
18438
|
watchFile(statusPath, { interval: 1e3 }, () => {
|
|
18368
|
-
if (!
|
|
18439
|
+
if (!existsSync43(statusPath)) return;
|
|
18369
18440
|
const signal = readSignal();
|
|
18370
18441
|
if (!signal) return;
|
|
18371
18442
|
if (signal.event === "done" && !options2?.actOnDone) return;
|
|
@@ -18417,7 +18488,7 @@ function launchPhaseSession(item, phaseNumber, phase, phaseLabel2, claudeSession
|
|
|
18417
18488
|
}
|
|
18418
18489
|
|
|
18419
18490
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
18420
|
-
import { existsSync as
|
|
18491
|
+
import { existsSync as existsSync44, unlinkSync as unlinkSync6 } from "fs";
|
|
18421
18492
|
import chalk75 from "chalk";
|
|
18422
18493
|
|
|
18423
18494
|
// src/commands/backlog/handleIncompletePhase.ts
|
|
@@ -18439,7 +18510,7 @@ async function handleIncompletePhase() {
|
|
|
18439
18510
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
18440
18511
|
function cleanupSignal() {
|
|
18441
18512
|
const statusPath = getSignalPath();
|
|
18442
|
-
if (statusPath &&
|
|
18513
|
+
if (statusPath && existsSync44(statusPath)) {
|
|
18443
18514
|
unlinkSync6(statusPath);
|
|
18444
18515
|
}
|
|
18445
18516
|
}
|
|
@@ -18450,7 +18521,7 @@ async function isTerminalStatus(itemId2) {
|
|
|
18450
18521
|
}
|
|
18451
18522
|
async function resolvePhaseResult(phaseIndex, itemId2) {
|
|
18452
18523
|
const signalPath = getSignalPath();
|
|
18453
|
-
if (!signalPath || !
|
|
18524
|
+
if (!signalPath || !existsSync44(signalPath)) {
|
|
18454
18525
|
if (await isTerminalStatus(itemId2)) return { kind: "abort" };
|
|
18455
18526
|
const action = await handleIncompletePhase();
|
|
18456
18527
|
if (action === "abort") return { kind: "abort" };
|
|
@@ -18531,7 +18602,7 @@ async function persistPhaseSessionId(itemId2, phaseIdx, claudeSessionId) {
|
|
|
18531
18602
|
// src/shared/emitActivity.ts
|
|
18532
18603
|
import { mkdirSync as mkdirSync13, readFileSync as readFileSync26, rmSync as rmSync4, writeFileSync as writeFileSync22 } from "fs";
|
|
18533
18604
|
import { homedir as homedir16 } from "os";
|
|
18534
|
-
import { dirname as
|
|
18605
|
+
import { dirname as dirname27, join as join50 } from "path";
|
|
18535
18606
|
import { z as z12 } from "zod";
|
|
18536
18607
|
var activitySchema = z12.object({
|
|
18537
18608
|
kind: z12.enum(["command", "backlog"]),
|
|
@@ -18547,13 +18618,13 @@ var activitySchema = z12.object({
|
|
|
18547
18618
|
startedAt: z12.number()
|
|
18548
18619
|
});
|
|
18549
18620
|
function activityPath(sessionId) {
|
|
18550
|
-
return
|
|
18621
|
+
return join50(homedir16(), ".assist", "activity", `activity-${sessionId}.json`);
|
|
18551
18622
|
}
|
|
18552
18623
|
function emitActivity(activity2) {
|
|
18553
18624
|
const sessionId = process.env.ASSIST_ACTIVITY_ID;
|
|
18554
18625
|
if (!sessionId) return;
|
|
18555
18626
|
const path109 = activityPath(sessionId);
|
|
18556
|
-
mkdirSync13(
|
|
18627
|
+
mkdirSync13(dirname27(path109), { recursive: true });
|
|
18557
18628
|
writeFileSync22(path109, JSON.stringify({ ...activity2, startedAt: Date.now() }));
|
|
18558
18629
|
}
|
|
18559
18630
|
function readActivity(path109) {
|
|
@@ -18569,7 +18640,7 @@ function reconcileActivity(sessionId, activity2) {
|
|
|
18569
18640
|
return;
|
|
18570
18641
|
}
|
|
18571
18642
|
const path109 = activityPath(sessionId);
|
|
18572
|
-
mkdirSync13(
|
|
18643
|
+
mkdirSync13(dirname27(path109), { recursive: true });
|
|
18573
18644
|
writeFileSync22(path109, JSON.stringify(activity2));
|
|
18574
18645
|
}
|
|
18575
18646
|
function removeActivity(sessionId) {
|
|
@@ -21118,16 +21189,16 @@ function extractGraphqlQuery(args) {
|
|
|
21118
21189
|
}
|
|
21119
21190
|
|
|
21120
21191
|
// src/shared/loadCliReads.ts
|
|
21121
|
-
import { existsSync as
|
|
21122
|
-
import { dirname as
|
|
21123
|
-
import { fileURLToPath as
|
|
21124
|
-
var __filename3 =
|
|
21125
|
-
var __dirname4 =
|
|
21192
|
+
import { existsSync as existsSync45, readFileSync as readFileSync28, writeFileSync as writeFileSync23 } from "fs";
|
|
21193
|
+
import { dirname as dirname28, resolve as resolve16 } from "path";
|
|
21194
|
+
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
21195
|
+
var __filename3 = fileURLToPath6(import.meta.url);
|
|
21196
|
+
var __dirname4 = dirname28(__filename3);
|
|
21126
21197
|
function packageRoot() {
|
|
21127
21198
|
return __dirname4;
|
|
21128
21199
|
}
|
|
21129
21200
|
function readLines(path109) {
|
|
21130
|
-
if (!
|
|
21201
|
+
if (!existsSync45(path109)) return [];
|
|
21131
21202
|
return readFileSync28(path109, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
21132
21203
|
}
|
|
21133
21204
|
var cachedReads;
|
|
@@ -21174,14 +21245,14 @@ function findCliWrite(command) {
|
|
|
21174
21245
|
}
|
|
21175
21246
|
|
|
21176
21247
|
// src/shared/readSettingsPerms.ts
|
|
21177
|
-
import { existsSync as
|
|
21248
|
+
import { existsSync as existsSync46, readFileSync as readFileSync29 } from "fs";
|
|
21178
21249
|
import { homedir as homedir17 } from "os";
|
|
21179
|
-
import { join as
|
|
21250
|
+
import { join as join51 } from "path";
|
|
21180
21251
|
function readSettingsPerms(key) {
|
|
21181
21252
|
const paths = [
|
|
21182
|
-
|
|
21183
|
-
|
|
21184
|
-
|
|
21253
|
+
join51(homedir17(), ".claude", "settings.json"),
|
|
21254
|
+
join51(process.cwd(), ".claude", "settings.json"),
|
|
21255
|
+
join51(process.cwd(), ".claude", "settings.local.json")
|
|
21185
21256
|
];
|
|
21186
21257
|
const entries = [];
|
|
21187
21258
|
for (const p of paths) {
|
|
@@ -21190,7 +21261,7 @@ function readSettingsPerms(key) {
|
|
|
21190
21261
|
return entries;
|
|
21191
21262
|
}
|
|
21192
21263
|
function readPermissionArray(filePath, key) {
|
|
21193
|
-
if (!
|
|
21264
|
+
if (!existsSync46(filePath)) return [];
|
|
21194
21265
|
try {
|
|
21195
21266
|
const data = JSON.parse(readFileSync29(filePath, "utf8"));
|
|
21196
21267
|
const arr = data?.permissions?.[key];
|
|
@@ -21464,11 +21535,11 @@ function findDocsPathDeny(toolName, rawCommand, root2) {
|
|
|
21464
21535
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
21465
21536
|
import { mkdirSync as mkdirSync14 } from "fs";
|
|
21466
21537
|
import { homedir as homedir18 } from "os";
|
|
21467
|
-
import { join as
|
|
21538
|
+
import { join as join52 } from "path";
|
|
21468
21539
|
import Database from "better-sqlite3";
|
|
21469
21540
|
var _db;
|
|
21470
21541
|
function getDbDir() {
|
|
21471
|
-
return
|
|
21542
|
+
return join52(homedir18(), ".assist");
|
|
21472
21543
|
}
|
|
21473
21544
|
function initSchema(db) {
|
|
21474
21545
|
db.exec(`
|
|
@@ -21487,7 +21558,7 @@ function openPromptsDb(dir) {
|
|
|
21487
21558
|
if (_db) return _db;
|
|
21488
21559
|
const dbDir = dir ?? getDbDir();
|
|
21489
21560
|
mkdirSync14(dbDir, { recursive: true });
|
|
21490
|
-
const db = new Database(
|
|
21561
|
+
const db = new Database(join52(dbDir, "assist.db"));
|
|
21491
21562
|
db.pragma("journal_mode = WAL");
|
|
21492
21563
|
initSchema(db);
|
|
21493
21564
|
_db = db;
|
|
@@ -21621,9 +21692,9 @@ ${reasons.join("\n")}`);
|
|
|
21621
21692
|
}
|
|
21622
21693
|
|
|
21623
21694
|
// src/commands/permitCliReads.ts
|
|
21624
|
-
import { existsSync as
|
|
21695
|
+
import { existsSync as existsSync47, mkdirSync as mkdirSync15, readFileSync as readFileSync30, writeFileSync as writeFileSync24 } from "fs";
|
|
21625
21696
|
import { homedir as homedir19 } from "os";
|
|
21626
|
-
import { join as
|
|
21697
|
+
import { join as join53 } from "path";
|
|
21627
21698
|
|
|
21628
21699
|
// src/commands/permitCliReads/assertCliExists.ts
|
|
21629
21700
|
function assertCliExists(cli) {
|
|
@@ -21858,10 +21929,10 @@ function formatHuman(cli, commands) {
|
|
|
21858
21929
|
}
|
|
21859
21930
|
|
|
21860
21931
|
// src/commands/permitCliReads/parseCached.ts
|
|
21861
|
-
function parseCached(cli,
|
|
21932
|
+
function parseCached(cli, cached2) {
|
|
21862
21933
|
const prefix2 = `${cli} `;
|
|
21863
21934
|
const commands = [];
|
|
21864
|
-
for (const line of
|
|
21935
|
+
for (const line of cached2.split("\n")) {
|
|
21865
21936
|
const trimmed = line.replace(/^ [RW?] {2}/, "").trim();
|
|
21866
21937
|
if (!trimmed.startsWith(prefix2)) continue;
|
|
21867
21938
|
const rest = trimmed.slice(prefix2.length);
|
|
@@ -21886,15 +21957,15 @@ function updateSettings(cli, commands) {
|
|
|
21886
21957
|
// src/commands/permitCliReads.ts
|
|
21887
21958
|
function logPath(cli) {
|
|
21888
21959
|
const safeName = cli.replace(/\s+/g, "-");
|
|
21889
|
-
return
|
|
21960
|
+
return join53(homedir19(), ".assist", `cli-discover-${safeName}.log`);
|
|
21890
21961
|
}
|
|
21891
21962
|
function readCache(cli) {
|
|
21892
21963
|
const path109 = logPath(cli);
|
|
21893
|
-
if (!
|
|
21964
|
+
if (!existsSync47(path109)) return void 0;
|
|
21894
21965
|
return readFileSync30(path109, "utf8");
|
|
21895
21966
|
}
|
|
21896
21967
|
function writeCache(cli, output) {
|
|
21897
|
-
const dir =
|
|
21968
|
+
const dir = join53(homedir19(), ".assist");
|
|
21898
21969
|
mkdirSync15(dir, { recursive: true });
|
|
21899
21970
|
writeFileSync24(logPath(cli), output);
|
|
21900
21971
|
}
|
|
@@ -21914,10 +21985,10 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
21914
21985
|
const binary = parts[0];
|
|
21915
21986
|
const prefixPath = parts.slice(1);
|
|
21916
21987
|
if (!options2.noCache) {
|
|
21917
|
-
const
|
|
21918
|
-
if (
|
|
21919
|
-
console.log(colorize(
|
|
21920
|
-
updateSettings(binary, parseCached(binary,
|
|
21988
|
+
const cached2 = readCache(cli);
|
|
21989
|
+
if (cached2) {
|
|
21990
|
+
console.log(colorize(cached2));
|
|
21991
|
+
updateSettings(binary, parseCached(binary, cached2));
|
|
21921
21992
|
return;
|
|
21922
21993
|
}
|
|
21923
21994
|
}
|
|
@@ -22026,7 +22097,7 @@ function registerCliHook(program) {
|
|
|
22026
22097
|
}
|
|
22027
22098
|
|
|
22028
22099
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
22029
|
-
import { existsSync as
|
|
22100
|
+
import { existsSync as existsSync49, readFileSync as readFileSync32, unlinkSync as unlinkSync8, writeFileSync as writeFileSync25 } from "fs";
|
|
22030
22101
|
import chalk117 from "chalk";
|
|
22031
22102
|
|
|
22032
22103
|
// src/shared/isHashCommentFile.ts
|
|
@@ -22060,17 +22131,17 @@ function isHashCommentFile(filePath) {
|
|
|
22060
22131
|
|
|
22061
22132
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
22062
22133
|
import { homedir as homedir20 } from "os";
|
|
22063
|
-
import { join as
|
|
22134
|
+
import { join as join54 } from "path";
|
|
22064
22135
|
function getRestrictedDir() {
|
|
22065
|
-
return
|
|
22136
|
+
return join54(homedir20(), ".assist", "restricted");
|
|
22066
22137
|
}
|
|
22067
22138
|
function getPinStatePath(pin2) {
|
|
22068
|
-
return
|
|
22139
|
+
return join54(getRestrictedDir(), `code-comment-${pin2}.json`);
|
|
22069
22140
|
}
|
|
22070
22141
|
|
|
22071
22142
|
// src/commands/codeComment/sweepRestrictedDir.ts
|
|
22072
22143
|
import { readdirSync as readdirSync7, statSync as statSync7, unlinkSync as unlinkSync7 } from "fs";
|
|
22073
|
-
import { join as
|
|
22144
|
+
import { join as join55 } from "path";
|
|
22074
22145
|
var STALE_AFTER_MS = 30 * 60 * 1e3;
|
|
22075
22146
|
function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
22076
22147
|
let entries;
|
|
@@ -22081,7 +22152,7 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
22081
22152
|
}
|
|
22082
22153
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
22083
22154
|
for (const entry of entries) {
|
|
22084
|
-
const path109 =
|
|
22155
|
+
const path109 = join55(dir, entry);
|
|
22085
22156
|
try {
|
|
22086
22157
|
if (statSync7(path109).mtimeMs < cutoff) unlinkSync7(path109);
|
|
22087
22158
|
} catch {
|
|
@@ -22091,10 +22162,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
22091
22162
|
}
|
|
22092
22163
|
|
|
22093
22164
|
// src/commands/codeComment/readPinState.ts
|
|
22094
|
-
import { existsSync as
|
|
22165
|
+
import { existsSync as existsSync48, readFileSync as readFileSync31 } from "fs";
|
|
22095
22166
|
function readPinState(pin2) {
|
|
22096
22167
|
const path109 = getPinStatePath(pin2);
|
|
22097
|
-
if (!
|
|
22168
|
+
if (!existsSync48(path109)) return void 0;
|
|
22098
22169
|
try {
|
|
22099
22170
|
const state = JSON.parse(readFileSync31(path109, "utf8"));
|
|
22100
22171
|
if (state.pin !== pin2) return void 0;
|
|
@@ -22113,7 +22184,7 @@ function codeCommentConfirm(pin2) {
|
|
|
22113
22184
|
process.exitCode = 1;
|
|
22114
22185
|
return;
|
|
22115
22186
|
}
|
|
22116
|
-
if (!
|
|
22187
|
+
if (!existsSync49(state.file)) {
|
|
22117
22188
|
console.error(chalk117.red(`Target file no longer exists: ${state.file}`));
|
|
22118
22189
|
process.exitCode = 1;
|
|
22119
22190
|
return;
|
|
@@ -24155,9 +24226,8 @@ async function requestTab(server, request) {
|
|
|
24155
24226
|
if (reply2.tabUrl) console.log(`tab: ${reply2.tabUrl}`);
|
|
24156
24227
|
fail6(reply2.error);
|
|
24157
24228
|
}
|
|
24158
|
-
|
|
24159
|
-
|
|
24160
|
-
return { ...result, version: reply2.version };
|
|
24229
|
+
if (reply2.result.tabUrl) console.log(`tab: ${reply2.result.tabUrl}`);
|
|
24230
|
+
return { ...reply2.result, version: reply2.version };
|
|
24161
24231
|
}
|
|
24162
24232
|
|
|
24163
24233
|
// src/commands/browser/browserInspect.ts
|
|
@@ -24225,15 +24295,15 @@ async function browserRun(options2) {
|
|
|
24225
24295
|
|
|
24226
24296
|
// src/commands/browser/browserSnapshot.ts
|
|
24227
24297
|
import { mkdirSync as mkdirSync17, writeFileSync as writeFileSync27 } from "fs";
|
|
24228
|
-
import { dirname as
|
|
24298
|
+
import { dirname as dirname29 } from "path";
|
|
24229
24299
|
|
|
24230
24300
|
// src/commands/browser/snapshotPath.ts
|
|
24231
24301
|
import { homedir as homedir21 } from "os";
|
|
24232
|
-
import { join as
|
|
24302
|
+
import { join as join56 } from "path";
|
|
24233
24303
|
function snapshotPath(tabUrl, now) {
|
|
24234
24304
|
const host = new URL(tabUrl).host.replace(/[^\w.-]/g, "-");
|
|
24235
24305
|
const timestamp8 = now.toISOString().replace(/[:.]/g, "-");
|
|
24236
|
-
return
|
|
24306
|
+
return join56(homedir21(), ".assist", "browser", `${host}-${timestamp8}.html`);
|
|
24237
24307
|
}
|
|
24238
24308
|
|
|
24239
24309
|
// src/commands/browser/browserSnapshot.ts
|
|
@@ -24243,85 +24313,33 @@ async function browserSnapshot(options2) {
|
|
|
24243
24313
|
url: options2.url
|
|
24244
24314
|
});
|
|
24245
24315
|
const path109 = snapshotPath(result.tabUrl, /* @__PURE__ */ new Date());
|
|
24246
|
-
mkdirSync17(
|
|
24316
|
+
mkdirSync17(dirname29(path109), { recursive: true });
|
|
24247
24317
|
writeFileSync27(path109, result.html);
|
|
24248
24318
|
console.log(`snapshot: ${path109}`);
|
|
24249
24319
|
}
|
|
24250
24320
|
|
|
24321
|
+
// src/commands/browser/formatExtensionUpdate.ts
|
|
24322
|
+
function formatExtensionUpdate(status2) {
|
|
24323
|
+
if (!status2.latest)
|
|
24324
|
+
return "latest signed: unknown (updates.json unreachable)";
|
|
24325
|
+
if (!status2.behind) return `latest signed: v${status2.latest} (up to date)`;
|
|
24326
|
+
return `latest signed: v${status2.latest} (behind; the assist web UI offers the install link)`;
|
|
24327
|
+
}
|
|
24328
|
+
|
|
24251
24329
|
// src/commands/browser/browserStatus.ts
|
|
24252
24330
|
async function browserStatus(options2) {
|
|
24331
|
+
const latest2 = fetchLatestSignedExtension().then((signed) => signed.latest).catch(() => void 0);
|
|
24253
24332
|
const result = await requestTab(options2.server, {
|
|
24254
24333
|
op: "status",
|
|
24255
24334
|
url: options2.url
|
|
24256
24335
|
});
|
|
24257
24336
|
console.log(`extension: connected (v${result.version})`);
|
|
24258
24337
|
console.log(
|
|
24259
|
-
|
|
24338
|
+
formatExtensionUpdate(extensionUpdateStatus(result.version, await latest2))
|
|
24260
24339
|
);
|
|
24261
|
-
|
|
24262
|
-
|
|
24263
|
-
// src/commands/browser/browserUpdate.ts
|
|
24264
|
-
import chalk147 from "chalk";
|
|
24265
|
-
|
|
24266
|
-
// src/commands/browser/describeUpdateCheck.ts
|
|
24267
|
-
function describeUpdateCheck(reply2) {
|
|
24268
|
-
const installed = `v${reply2.version}`;
|
|
24269
|
-
if (!reply2.ok) return { outcome: "failed", message: reply2.error };
|
|
24270
|
-
const { status: status2, available } = reply2.result;
|
|
24271
|
-
if (status2 === "update_available")
|
|
24272
|
-
return {
|
|
24273
|
-
outcome: "updating",
|
|
24274
|
-
message: `updating ${installed} \u2192 ${available ? `v${available}` : "a newer version"}\u2026`
|
|
24275
|
-
};
|
|
24276
|
-
if (status2 === "no_update")
|
|
24277
|
-
return {
|
|
24278
|
-
outcome: "current",
|
|
24279
|
-
message: `already up to date (${installed})`
|
|
24280
|
-
};
|
|
24281
|
-
return {
|
|
24282
|
-
outcome: "failed",
|
|
24283
|
-
message: `Firefox did not check for an update (status: ${status2}); still ${installed}`
|
|
24284
|
-
};
|
|
24285
|
-
}
|
|
24286
|
-
|
|
24287
|
-
// src/commands/browser/waitForNewVersion.ts
|
|
24288
|
-
import { setTimeout as sleep2 } from "timers/promises";
|
|
24289
|
-
var connectedVersion = (server) => requestBrowser(server, { op: "status" }).then((reply2) => reply2.version).catch(() => void 0);
|
|
24290
|
-
async function waitForNewVersion(server, oldVersion, {
|
|
24291
|
-
timeoutMs = 9e4,
|
|
24292
|
-
pollMs = 2e3,
|
|
24293
|
-
now = Date.now,
|
|
24294
|
-
connectedVersion: probe2 = connectedVersion,
|
|
24295
|
-
wait: wait2 = sleep2
|
|
24296
|
-
} = {}) {
|
|
24297
|
-
const deadline = now() + timeoutMs;
|
|
24298
|
-
while (now() < deadline) {
|
|
24299
|
-
await wait2(pollMs);
|
|
24300
|
-
const version2 = await probe2(server);
|
|
24301
|
-
if (version2 && version2 !== oldVersion) return version2;
|
|
24302
|
-
}
|
|
24303
|
-
return void 0;
|
|
24304
|
-
}
|
|
24305
|
-
|
|
24306
|
-
// src/commands/browser/browserUpdate.ts
|
|
24307
|
-
function fail7(message3) {
|
|
24308
|
-
console.error(chalk147.red(`Error: ${message3}`));
|
|
24309
|
-
process.exit(1);
|
|
24310
|
-
}
|
|
24311
|
-
async function browserUpdate(options2) {
|
|
24312
|
-
const reply2 = await requestBrowser(options2.server, { op: "update" }).catch(
|
|
24313
|
-
(error) => fail7(error.message)
|
|
24340
|
+
console.log(
|
|
24341
|
+
`content script: ${result.contentScript ? "running" : "not running (reload the tab, or update the extension)"}`
|
|
24314
24342
|
);
|
|
24315
|
-
const { outcome, message: message3 } = describeUpdateCheck(reply2);
|
|
24316
|
-
if (outcome === "failed") fail7(message3);
|
|
24317
|
-
console.log(message3);
|
|
24318
|
-
if (outcome === "current") return;
|
|
24319
|
-
const installed = await waitForNewVersion(options2.server, reply2.version);
|
|
24320
|
-
if (!installed)
|
|
24321
|
-
fail7(
|
|
24322
|
-
`the extension did not reconnect at a new version (still v${reply2.version})`
|
|
24323
|
-
);
|
|
24324
|
-
console.log(`updated v${reply2.version} \u2192 v${installed}`);
|
|
24325
24343
|
}
|
|
24326
24344
|
|
|
24327
24345
|
// src/commands/extension/consoleCapture/types.ts
|
|
@@ -24338,7 +24356,7 @@ function parseTopCount(value) {
|
|
|
24338
24356
|
}
|
|
24339
24357
|
|
|
24340
24358
|
// src/commands/browser/browserConsole.ts
|
|
24341
|
-
import
|
|
24359
|
+
import chalk147 from "chalk";
|
|
24342
24360
|
|
|
24343
24361
|
// src/commands/browser/formatConsoleEntries.ts
|
|
24344
24362
|
var pad = (value, width2 = 2) => String(value).padStart(width2, "0");
|
|
@@ -24366,7 +24384,7 @@ function formatConsoleEntries({
|
|
|
24366
24384
|
// src/commands/browser/browserConsole.ts
|
|
24367
24385
|
async function browserConsole(options2) {
|
|
24368
24386
|
if (options2.all && options2.url) {
|
|
24369
|
-
console.error(
|
|
24387
|
+
console.error(chalk147.red("Error: pass either --url or --all, not both"));
|
|
24370
24388
|
process.exit(1);
|
|
24371
24389
|
}
|
|
24372
24390
|
const result = await requestTab(options2.server, {
|
|
@@ -24452,31 +24470,11 @@ function registerBrowser(program) {
|
|
|
24452
24470
|
).requiredOption("--file <script>", "JavaScript file to run")
|
|
24453
24471
|
).action(browserRun);
|
|
24454
24472
|
registerBrowserConsole(browser);
|
|
24455
|
-
browser.command("update").description(
|
|
24456
|
-
"Make the connected extension check for an update and install it now, then print the old and new versions"
|
|
24457
|
-
).option(
|
|
24458
|
-
"--server <url>",
|
|
24459
|
-
"assist web server the extension connects to",
|
|
24460
|
-
"http://localhost:3100"
|
|
24461
|
-
).action(browserUpdate);
|
|
24462
24473
|
}
|
|
24463
24474
|
|
|
24464
24475
|
// src/commands/extension/extension.ts
|
|
24465
24476
|
import { cp } from "fs/promises";
|
|
24466
|
-
import
|
|
24467
|
-
|
|
24468
|
-
// src/commands/extension/extensionDir.ts
|
|
24469
|
-
import { existsSync as existsSync49 } from "fs";
|
|
24470
|
-
import { dirname as dirname29, join as join55 } from "path";
|
|
24471
|
-
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
24472
|
-
var moduleDir = dirname29(fileURLToPath6(import.meta.url));
|
|
24473
|
-
function extensionDir() {
|
|
24474
|
-
const bundled = join55(moduleDir, "commands", "extension", "extension");
|
|
24475
|
-
if (existsSync49(bundled)) return bundled;
|
|
24476
|
-
return join55(moduleDir, "..", "..", "..", "extension");
|
|
24477
|
-
}
|
|
24478
|
-
|
|
24479
|
-
// src/commands/extension/extension.ts
|
|
24477
|
+
import chalk148 from "chalk";
|
|
24480
24478
|
var WSL_WINDOWS_DIR = "/mnt/c/tools/extension";
|
|
24481
24479
|
var WSL_WINDOWS_PATH = String.raw`C:\tools\extension`;
|
|
24482
24480
|
async function loadPath(source) {
|
|
@@ -24486,55 +24484,34 @@ async function loadPath(source) {
|
|
|
24486
24484
|
return WSL_WINDOWS_PATH;
|
|
24487
24485
|
} catch {
|
|
24488
24486
|
console.log(
|
|
24489
|
-
|
|
24487
|
+
chalk148.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
24490
24488
|
);
|
|
24491
24489
|
return source;
|
|
24492
24490
|
}
|
|
24493
24491
|
}
|
|
24494
24492
|
async function extension() {
|
|
24495
24493
|
const path109 = await loadPath(extensionDir());
|
|
24496
|
-
console.log(
|
|
24497
|
-
console.log(
|
|
24498
|
-
}
|
|
24499
|
-
|
|
24500
|
-
// src/commands/extension/printExtensionUrl.ts
|
|
24501
|
-
import { readFile as readFile4 } from "fs/promises";
|
|
24502
|
-
import { join as join56 } from "path";
|
|
24503
|
-
import chalk150 from "chalk";
|
|
24504
|
-
|
|
24505
|
-
// src/commands/extension/latestUpdate.ts
|
|
24506
|
-
function latestUpdate(manifest, updates2) {
|
|
24507
|
-
const { id } = JSON.parse(manifest).browser_specific_settings.gecko;
|
|
24508
|
-
return JSON.parse(updates2).addons[id]?.updates.at(-1);
|
|
24509
|
-
}
|
|
24510
|
-
|
|
24511
|
-
// src/commands/extension/latestUpdateLink.ts
|
|
24512
|
-
function latestUpdateLink(manifest, updates2) {
|
|
24513
|
-
return latestUpdate(manifest, updates2)?.update_link;
|
|
24494
|
+
console.log(chalk148.bold("assist \u2014 GitHub browser extension"));
|
|
24495
|
+
console.log(chalk148.dim(`load the unpacked extension from ${path109}`));
|
|
24514
24496
|
}
|
|
24515
24497
|
|
|
24516
24498
|
// src/commands/extension/printExtensionUrl.ts
|
|
24499
|
+
import chalk149 from "chalk";
|
|
24517
24500
|
async function printExtensionUrl() {
|
|
24518
|
-
const
|
|
24519
|
-
|
|
24520
|
-
|
|
24521
|
-
);
|
|
24522
|
-
const { update_url } = JSON.parse(manifest).browser_specific_settings.gecko;
|
|
24523
|
-
const response = await fetch(update_url);
|
|
24524
|
-
const link3 = response.ok ? latestUpdateLink(manifest, await response.text()) : void 0;
|
|
24525
|
-
if (!link3) {
|
|
24526
|
-
console.log(chalk150.red(`no signed build found in ${update_url}`));
|
|
24501
|
+
const { updateUrl, latest: latest2 } = await fetchLatestSignedExtension();
|
|
24502
|
+
if (!latest2) {
|
|
24503
|
+
console.log(chalk149.red(`no signed build found in ${updateUrl}`));
|
|
24527
24504
|
process.exitCode = 1;
|
|
24528
24505
|
return;
|
|
24529
24506
|
}
|
|
24530
|
-
console.log(
|
|
24507
|
+
console.log(latest2.update_link);
|
|
24531
24508
|
}
|
|
24532
24509
|
|
|
24533
24510
|
// src/commands/extension/signExtension.ts
|
|
24534
24511
|
import { rm as rm2 } from "fs/promises";
|
|
24535
24512
|
import { homedir as homedir22, tmpdir as tmpdir3 } from "os";
|
|
24536
24513
|
import { join as join62 } from "path";
|
|
24537
|
-
import
|
|
24514
|
+
import chalk151 from "chalk";
|
|
24538
24515
|
|
|
24539
24516
|
// src/commands/extension/copySignedXpi.ts
|
|
24540
24517
|
import { copyFile } from "fs/promises";
|
|
@@ -24559,7 +24536,7 @@ async function findSignedXpi(dir) {
|
|
|
24559
24536
|
|
|
24560
24537
|
// src/commands/extension/signedAddonInstallPath.ts
|
|
24561
24538
|
import { cp as cp2 } from "fs/promises";
|
|
24562
|
-
import
|
|
24539
|
+
import chalk150 from "chalk";
|
|
24563
24540
|
var WSL_WINDOWS_XPI = "/mnt/c/tools/assist-extension.xpi";
|
|
24564
24541
|
var WSL_WINDOWS_PATH2 = String.raw`C:\tools\assist-extension.xpi`;
|
|
24565
24542
|
async function signedAddonInstallPath(xpi) {
|
|
@@ -24569,7 +24546,7 @@ async function signedAddonInstallPath(xpi) {
|
|
|
24569
24546
|
return WSL_WINDOWS_PATH2;
|
|
24570
24547
|
} catch {
|
|
24571
24548
|
console.log(
|
|
24572
|
-
|
|
24549
|
+
chalk150.yellow(`could not copy the add-on to ${WSL_WINDOWS_PATH2}`)
|
|
24573
24550
|
);
|
|
24574
24551
|
return xpi;
|
|
24575
24552
|
}
|
|
@@ -24662,15 +24639,15 @@ async function signExtension() {
|
|
|
24662
24639
|
const source = extensionDir();
|
|
24663
24640
|
const problem = signPreflightProblem(source);
|
|
24664
24641
|
if (problem) {
|
|
24665
|
-
console.log(
|
|
24666
|
-
console.log(
|
|
24642
|
+
console.log(chalk151.red(problem.message));
|
|
24643
|
+
console.log(chalk151.dim(problem.hint));
|
|
24667
24644
|
process.exitCode = 1;
|
|
24668
24645
|
return;
|
|
24669
24646
|
}
|
|
24670
24647
|
const { version: version2 } = package_default;
|
|
24671
24648
|
await stageExtension(source, STAGING_DIR, version2);
|
|
24672
24649
|
await rm2(ARTIFACTS_DIR, { recursive: true, force: true });
|
|
24673
|
-
console.log(
|
|
24650
|
+
console.log(chalk151.bold(`signing version ${version2} for self-distribution`));
|
|
24674
24651
|
const { done: done2 } = spawnInherit("npx", [
|
|
24675
24652
|
"--yes",
|
|
24676
24653
|
"web-ext",
|
|
@@ -24680,13 +24657,13 @@ async function signExtension() {
|
|
|
24680
24657
|
"--channel=unlisted"
|
|
24681
24658
|
]);
|
|
24682
24659
|
if (await done2 !== 0) {
|
|
24683
|
-
console.log(
|
|
24660
|
+
console.log(chalk151.red("web-ext sign failed"));
|
|
24684
24661
|
process.exitCode = 1;
|
|
24685
24662
|
return;
|
|
24686
24663
|
}
|
|
24687
24664
|
const xpi = await findSignedXpi(ARTIFACTS_DIR);
|
|
24688
24665
|
if (!xpi) {
|
|
24689
|
-
console.log(
|
|
24666
|
+
console.log(chalk151.red(`web-ext wrote no .xpi into ${ARTIFACTS_DIR}`));
|
|
24690
24667
|
process.exitCode = 1;
|
|
24691
24668
|
return;
|
|
24692
24669
|
}
|
|
@@ -24694,7 +24671,7 @@ async function signExtension() {
|
|
|
24694
24671
|
const path109 = await signedAddonInstallPath(
|
|
24695
24672
|
await copySignedXpi(xpi, ARTIFACTS_DIR)
|
|
24696
24673
|
);
|
|
24697
|
-
console.log(
|
|
24674
|
+
console.log(chalk151.dim(`install the signed add-on from ${path109}`));
|
|
24698
24675
|
}
|
|
24699
24676
|
|
|
24700
24677
|
// src/commands/registerExtension.ts
|
|
@@ -24755,11 +24732,11 @@ async function dropRetiredTables(exec3) {
|
|
|
24755
24732
|
}
|
|
24756
24733
|
|
|
24757
24734
|
// src/commands/db/reportRetiredTables.ts
|
|
24758
|
-
import
|
|
24735
|
+
import chalk152 from "chalk";
|
|
24759
24736
|
function reportRetiredTables(tables) {
|
|
24760
24737
|
for (const table of tables) {
|
|
24761
24738
|
console.error(
|
|
24762
|
-
|
|
24739
|
+
chalk152.yellow(
|
|
24763
24740
|
`Retired table ${table.name} still exists (${table.rows} rows). Run \`assist db drop-retired\` to drop it.`
|
|
24764
24741
|
)
|
|
24765
24742
|
);
|
|
@@ -24767,40 +24744,40 @@ function reportRetiredTables(tables) {
|
|
|
24767
24744
|
}
|
|
24768
24745
|
|
|
24769
24746
|
// src/commands/db/reportMigrationStatus.ts
|
|
24770
|
-
import
|
|
24747
|
+
import chalk153 from "chalk";
|
|
24771
24748
|
function reportApplied(applied) {
|
|
24772
24749
|
if (applied.length === 0) {
|
|
24773
|
-
console.error(
|
|
24750
|
+
console.error(chalk153.green("Database is up to date; nothing to apply."));
|
|
24774
24751
|
return;
|
|
24775
24752
|
}
|
|
24776
24753
|
for (const migration of applied) {
|
|
24777
24754
|
console.error(
|
|
24778
|
-
|
|
24755
|
+
chalk153.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
24779
24756
|
);
|
|
24780
24757
|
}
|
|
24781
24758
|
}
|
|
24782
24759
|
function reportMigrationStatus(status2) {
|
|
24783
24760
|
if (status2.state === "in-sync") {
|
|
24784
24761
|
console.error(
|
|
24785
|
-
|
|
24762
|
+
chalk153.green(`In sync at migration ${status2.version} (latest).`)
|
|
24786
24763
|
);
|
|
24787
24764
|
return;
|
|
24788
24765
|
}
|
|
24789
24766
|
if (status2.state === "behind") {
|
|
24790
24767
|
console.error(
|
|
24791
|
-
|
|
24768
|
+
chalk153.yellow(
|
|
24792
24769
|
`Behind: applied ${status2.applied}, build expects ${status2.expected}.`
|
|
24793
24770
|
)
|
|
24794
24771
|
);
|
|
24795
24772
|
console.error(
|
|
24796
|
-
|
|
24773
|
+
chalk153.yellow(
|
|
24797
24774
|
`Pending: ${status2.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
24798
24775
|
)
|
|
24799
24776
|
);
|
|
24800
24777
|
return;
|
|
24801
24778
|
}
|
|
24802
24779
|
console.error(
|
|
24803
|
-
|
|
24780
|
+
chalk153.red(
|
|
24804
24781
|
`Ahead: applied ${status2.applied}, build knows ${status2.expected}. Update assist.`
|
|
24805
24782
|
)
|
|
24806
24783
|
);
|
|
@@ -24842,7 +24819,7 @@ function registerDb(program) {
|
|
|
24842
24819
|
|
|
24843
24820
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
24844
24821
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync28 } from "fs";
|
|
24845
|
-
import
|
|
24822
|
+
import chalk154 from "chalk";
|
|
24846
24823
|
|
|
24847
24824
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
24848
24825
|
import { join as join63 } from "path";
|
|
@@ -24873,7 +24850,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
24873
24850
|
sweepRestrictedDir();
|
|
24874
24851
|
const state = readMigrationPinState(pin2);
|
|
24875
24852
|
if (!state) {
|
|
24876
|
-
console.error(
|
|
24853
|
+
console.error(chalk154.red(`No pending migration unlock for pin: ${pin2}`));
|
|
24877
24854
|
process.exitCode = 1;
|
|
24878
24855
|
return;
|
|
24879
24856
|
}
|
|
@@ -24883,7 +24860,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
24883
24860
|
);
|
|
24884
24861
|
unlinkSync9(getMigrationPinPath(pin2));
|
|
24885
24862
|
console.log(
|
|
24886
|
-
|
|
24863
|
+
chalk154.green(
|
|
24887
24864
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
24888
24865
|
)
|
|
24889
24866
|
);
|
|
@@ -24892,7 +24869,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
24892
24869
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
24893
24870
|
import { mkdirSync as mkdirSync18, writeFileSync as writeFileSync29 } from "fs";
|
|
24894
24871
|
import { randomInt as randomInt2 } from "crypto";
|
|
24895
|
-
import
|
|
24872
|
+
import chalk155 from "chalk";
|
|
24896
24873
|
|
|
24897
24874
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
24898
24875
|
function nextMigrationId() {
|
|
@@ -24907,7 +24884,7 @@ function dbMigrationUnlock() {
|
|
|
24907
24884
|
sweepRestrictedDir();
|
|
24908
24885
|
writeFileSync29(getMigrationPinPath(pin2), JSON.stringify({ pin: pin2, migrationId }));
|
|
24909
24886
|
console.error(
|
|
24910
|
-
|
|
24887
|
+
chalk155.yellow.bold(
|
|
24911
24888
|
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a new database migration.\nA schema change is hard to reverse once shipped. You had BETTER have confirmed\nthe change with the user and be certain this migration is genuinely necessary."
|
|
24912
24889
|
)
|
|
24913
24890
|
);
|
|
@@ -24917,7 +24894,7 @@ function dbMigrationUnlock() {
|
|
|
24917
24894
|
});
|
|
24918
24895
|
if (!delivered) {
|
|
24919
24896
|
console.error(
|
|
24920
|
-
|
|
24897
|
+
chalk155.red(
|
|
24921
24898
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
24922
24899
|
)
|
|
24923
24900
|
);
|
|
@@ -24927,7 +24904,7 @@ function dbMigrationUnlock() {
|
|
|
24927
24904
|
console.log(
|
|
24928
24905
|
`A confirmation pin was sent to your desktop notifications.
|
|
24929
24906
|
To approve creating migration ${migrationId}, run:
|
|
24930
|
-
${
|
|
24907
|
+
${chalk155.cyan(" assist db-migration confirm <PIN>")}
|
|
24931
24908
|
using the pin from that notification.`
|
|
24932
24909
|
);
|
|
24933
24910
|
}
|
|
@@ -24954,7 +24931,7 @@ function registerDbMigration(parent) {
|
|
|
24954
24931
|
|
|
24955
24932
|
// src/commands/deploy/redirect.ts
|
|
24956
24933
|
import { existsSync as existsSync53, readFileSync as readFileSync35, writeFileSync as writeFileSync30 } from "fs";
|
|
24957
|
-
import
|
|
24934
|
+
import chalk156 from "chalk";
|
|
24958
24935
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
24959
24936
|
if (!window.location.pathname.endsWith('/')) {
|
|
24960
24937
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -24963,23 +24940,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
24963
24940
|
function redirect() {
|
|
24964
24941
|
const indexPath = "index.html";
|
|
24965
24942
|
if (!existsSync53(indexPath)) {
|
|
24966
|
-
console.log(
|
|
24943
|
+
console.log(chalk156.yellow("No index.html found"));
|
|
24967
24944
|
return;
|
|
24968
24945
|
}
|
|
24969
24946
|
const content = readFileSync35(indexPath, "utf8");
|
|
24970
24947
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
24971
|
-
console.log(
|
|
24948
|
+
console.log(chalk156.dim("Trailing slash script already present"));
|
|
24972
24949
|
return;
|
|
24973
24950
|
}
|
|
24974
24951
|
const headCloseIndex = content.indexOf("</head>");
|
|
24975
24952
|
if (headCloseIndex === -1) {
|
|
24976
|
-
console.log(
|
|
24953
|
+
console.log(chalk156.red("Could not find </head> tag in index.html"));
|
|
24977
24954
|
return;
|
|
24978
24955
|
}
|
|
24979
24956
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
24980
24957
|
${content.slice(headCloseIndex)}`;
|
|
24981
24958
|
writeFileSync30(indexPath, newContent);
|
|
24982
|
-
console.log(
|
|
24959
|
+
console.log(chalk156.green("Added trailing slash redirect to index.html"));
|
|
24983
24960
|
}
|
|
24984
24961
|
|
|
24985
24962
|
// src/commands/registerDeploy.ts
|
|
@@ -25006,7 +24983,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
25006
24983
|
|
|
25007
24984
|
// src/commands/devlog/shared.ts
|
|
25008
24985
|
import { execSync as execSync33 } from "child_process";
|
|
25009
|
-
import
|
|
24986
|
+
import chalk157 from "chalk";
|
|
25010
24987
|
|
|
25011
24988
|
// src/shared/getRepoName.ts
|
|
25012
24989
|
import { existsSync as existsSync54, readFileSync as readFileSync36 } from "fs";
|
|
@@ -25115,13 +25092,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
25115
25092
|
}
|
|
25116
25093
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
25117
25094
|
for (const commit2 of commits2) {
|
|
25118
|
-
console.log(` ${
|
|
25095
|
+
console.log(` ${chalk157.yellow(commit2.hash)} ${commit2.message}`);
|
|
25119
25096
|
if (verbose) {
|
|
25120
25097
|
const visibleFiles = commit2.files.filter(
|
|
25121
25098
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
25122
25099
|
);
|
|
25123
25100
|
for (const file of visibleFiles) {
|
|
25124
|
-
console.log(` ${
|
|
25101
|
+
console.log(` ${chalk157.dim(file)}`);
|
|
25125
25102
|
}
|
|
25126
25103
|
}
|
|
25127
25104
|
}
|
|
@@ -25146,15 +25123,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
25146
25123
|
}
|
|
25147
25124
|
|
|
25148
25125
|
// src/commands/devlog/list/printDateHeader.ts
|
|
25149
|
-
import
|
|
25126
|
+
import chalk158 from "chalk";
|
|
25150
25127
|
function printDateHeader(date, isSkipped, entries) {
|
|
25151
25128
|
if (isSkipped) {
|
|
25152
|
-
console.log(`${
|
|
25129
|
+
console.log(`${chalk158.bold.blue(date)} ${chalk158.dim("skipped")}`);
|
|
25153
25130
|
} else if (entries && entries.length > 0) {
|
|
25154
|
-
const entryInfo = entries.map((e) => `${
|
|
25155
|
-
console.log(`${
|
|
25131
|
+
const entryInfo = entries.map((e) => `${chalk158.green(e.version)} ${e.title}`).join(" | ");
|
|
25132
|
+
console.log(`${chalk158.bold.blue(date)} ${entryInfo}`);
|
|
25156
25133
|
} else {
|
|
25157
|
-
console.log(`${
|
|
25134
|
+
console.log(`${chalk158.bold.blue(date)} ${chalk158.red("\u26A0 devlog missing")}`);
|
|
25158
25135
|
}
|
|
25159
25136
|
}
|
|
25160
25137
|
|
|
@@ -25194,7 +25171,7 @@ function list2(options2) {
|
|
|
25194
25171
|
|
|
25195
25172
|
// src/commands/devlog/getLastVersionInfo.ts
|
|
25196
25173
|
import { execFileSync as execFileSync8, execSync as execSync34 } from "child_process";
|
|
25197
|
-
import
|
|
25174
|
+
import semver2 from "semver";
|
|
25198
25175
|
function getVersionAtCommit(hash) {
|
|
25199
25176
|
try {
|
|
25200
25177
|
const content = execSync34(`git show ${hash}:package.json`, {
|
|
@@ -25207,7 +25184,7 @@ function getVersionAtCommit(hash) {
|
|
|
25207
25184
|
}
|
|
25208
25185
|
}
|
|
25209
25186
|
function stripToMinor(version2) {
|
|
25210
|
-
const parsed =
|
|
25187
|
+
const parsed = semver2.parse(semver2.coerce(version2));
|
|
25211
25188
|
return parsed ? `v${parsed.major}.${parsed.minor}` : `v${version2}`;
|
|
25212
25189
|
}
|
|
25213
25190
|
function getLastVersionInfoFromGit() {
|
|
@@ -25245,12 +25222,12 @@ function getLastVersionInfo(repoName, config) {
|
|
|
25245
25222
|
return lastVersion ? { date: lastDate, version: lastVersion } : null;
|
|
25246
25223
|
}
|
|
25247
25224
|
function cleanVersion(version2) {
|
|
25248
|
-
return
|
|
25225
|
+
return semver2.clean(version2) ?? semver2.coerce(version2)?.version ?? null;
|
|
25249
25226
|
}
|
|
25250
25227
|
function bumpVersion(version2, type) {
|
|
25251
25228
|
const cleaned = cleanVersion(version2);
|
|
25252
25229
|
if (!cleaned) return version2;
|
|
25253
|
-
const bumped =
|
|
25230
|
+
const bumped = semver2.inc(cleaned, type);
|
|
25254
25231
|
if (!bumped) return version2;
|
|
25255
25232
|
if (type === "minor") return stripToMinor(bumped);
|
|
25256
25233
|
return `v${bumped}`;
|
|
@@ -25258,24 +25235,24 @@ function bumpVersion(version2, type) {
|
|
|
25258
25235
|
|
|
25259
25236
|
// src/commands/devlog/next/displayNextEntry.ts
|
|
25260
25237
|
import { execFileSync as execFileSync9 } from "child_process";
|
|
25261
|
-
import
|
|
25238
|
+
import chalk160 from "chalk";
|
|
25262
25239
|
|
|
25263
25240
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
25264
|
-
import
|
|
25241
|
+
import chalk159 from "chalk";
|
|
25265
25242
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
25266
25243
|
if (conventional && firstHash) {
|
|
25267
25244
|
const version2 = getVersionAtCommit(firstHash);
|
|
25268
25245
|
if (version2) {
|
|
25269
|
-
console.log(`${
|
|
25246
|
+
console.log(`${chalk159.bold("version:")} ${stripToMinor(version2)}`);
|
|
25270
25247
|
} else {
|
|
25271
|
-
console.log(`${
|
|
25248
|
+
console.log(`${chalk159.bold("version:")} ${chalk159.red("unknown")}`);
|
|
25272
25249
|
}
|
|
25273
25250
|
} else if (patchVersion && minorVersion) {
|
|
25274
25251
|
console.log(
|
|
25275
|
-
`${
|
|
25252
|
+
`${chalk159.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
25276
25253
|
);
|
|
25277
25254
|
} else {
|
|
25278
|
-
console.log(`${
|
|
25255
|
+
console.log(`${chalk159.bold("version:")} v0.1 (initial)`);
|
|
25279
25256
|
}
|
|
25280
25257
|
}
|
|
25281
25258
|
|
|
@@ -25323,16 +25300,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
25323
25300
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
25324
25301
|
}
|
|
25325
25302
|
function logName(repoName) {
|
|
25326
|
-
console.log(`${
|
|
25303
|
+
console.log(`${chalk160.bold("name:")} ${repoName}`);
|
|
25327
25304
|
}
|
|
25328
25305
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
25329
25306
|
logName(ctx.repoName);
|
|
25330
25307
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
25331
|
-
console.log(
|
|
25308
|
+
console.log(chalk160.bold.blue(targetDate));
|
|
25332
25309
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
25333
25310
|
}
|
|
25334
25311
|
function logNoCommits(lastInfo) {
|
|
25335
|
-
console.log(
|
|
25312
|
+
console.log(chalk160.dim(noCommitsMessage(!!lastInfo)));
|
|
25336
25313
|
}
|
|
25337
25314
|
|
|
25338
25315
|
// src/commands/devlog/next.ts
|
|
@@ -25373,11 +25350,11 @@ function next2(options2) {
|
|
|
25373
25350
|
import { execSync as execSync35 } from "child_process";
|
|
25374
25351
|
|
|
25375
25352
|
// src/commands/devlog/repos/printReposTable.ts
|
|
25376
|
-
import
|
|
25353
|
+
import chalk161 from "chalk";
|
|
25377
25354
|
function colorStatus(status2) {
|
|
25378
|
-
if (status2 === "missing") return
|
|
25379
|
-
if (status2 === "outdated") return
|
|
25380
|
-
return
|
|
25355
|
+
if (status2 === "missing") return chalk161.red(status2);
|
|
25356
|
+
if (status2 === "outdated") return chalk161.yellow(status2);
|
|
25357
|
+
return chalk161.green(status2);
|
|
25381
25358
|
}
|
|
25382
25359
|
function formatRow(row3, nameWidth) {
|
|
25383
25360
|
const devlog = (row3.lastDevlog ?? "-").padEnd(11);
|
|
@@ -25391,8 +25368,8 @@ function printReposTable(rows) {
|
|
|
25391
25368
|
"Last Devlog".padEnd(11),
|
|
25392
25369
|
"Status"
|
|
25393
25370
|
].join(" ");
|
|
25394
|
-
console.log(
|
|
25395
|
-
console.log(
|
|
25371
|
+
console.log(chalk161.dim(header));
|
|
25372
|
+
console.log(chalk161.dim("-".repeat(header.length)));
|
|
25396
25373
|
for (const row3 of rows) {
|
|
25397
25374
|
console.log(formatRow(row3, nameWidth));
|
|
25398
25375
|
}
|
|
@@ -25450,14 +25427,14 @@ function repos(options2) {
|
|
|
25450
25427
|
// src/commands/devlog/skip.ts
|
|
25451
25428
|
import { writeFileSync as writeFileSync31 } from "fs";
|
|
25452
25429
|
import { join as join67 } from "path";
|
|
25453
|
-
import
|
|
25430
|
+
import chalk162 from "chalk";
|
|
25454
25431
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
25455
25432
|
function getBlogConfigPath() {
|
|
25456
25433
|
return join67(BLOG_REPO_ROOT, "assist.yml");
|
|
25457
25434
|
}
|
|
25458
25435
|
function skip2(date) {
|
|
25459
25436
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
25460
|
-
console.log(
|
|
25437
|
+
console.log(chalk162.red("Invalid date format. Use YYYY-MM-DD"));
|
|
25461
25438
|
process.exit(1);
|
|
25462
25439
|
}
|
|
25463
25440
|
const repoName = getRepoName();
|
|
@@ -25468,7 +25445,7 @@ function skip2(date) {
|
|
|
25468
25445
|
const skipDays = skip3[repoName] ?? [];
|
|
25469
25446
|
if (skipDays.includes(date)) {
|
|
25470
25447
|
console.log(
|
|
25471
|
-
|
|
25448
|
+
chalk162.yellow(`${date} is already in skip list for ${repoName}`)
|
|
25472
25449
|
);
|
|
25473
25450
|
return;
|
|
25474
25451
|
}
|
|
@@ -25478,20 +25455,20 @@ function skip2(date) {
|
|
|
25478
25455
|
devlog.skip = skip3;
|
|
25479
25456
|
config.devlog = devlog;
|
|
25480
25457
|
writeFileSync31(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
25481
|
-
console.log(
|
|
25458
|
+
console.log(chalk162.green(`Added ${date} to skip list for ${repoName}`));
|
|
25482
25459
|
}
|
|
25483
25460
|
|
|
25484
25461
|
// src/commands/devlog/version.ts
|
|
25485
|
-
import
|
|
25462
|
+
import chalk163 from "chalk";
|
|
25486
25463
|
function version() {
|
|
25487
25464
|
const config = loadConfig();
|
|
25488
25465
|
const name = getRepoName();
|
|
25489
25466
|
const lastInfo = getLastVersionInfo(name, config);
|
|
25490
25467
|
const lastVersion = lastInfo?.version ?? null;
|
|
25491
25468
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
25492
|
-
console.log(`${
|
|
25493
|
-
console.log(`${
|
|
25494
|
-
console.log(`${
|
|
25469
|
+
console.log(`${chalk163.bold("name:")} ${name}`);
|
|
25470
|
+
console.log(`${chalk163.bold("last:")} ${lastVersion ?? chalk163.dim("none")}`);
|
|
25471
|
+
console.log(`${chalk163.bold("next:")} ${nextVersion ?? chalk163.dim("none")}`);
|
|
25495
25472
|
}
|
|
25496
25473
|
|
|
25497
25474
|
// src/commands/registerDevlog.ts
|
|
@@ -25516,7 +25493,7 @@ function registerDevlog(program) {
|
|
|
25516
25493
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
25517
25494
|
import { closeSync as closeSync4, openSync as openSync5, readdirSync as readdirSync9 } from "fs";
|
|
25518
25495
|
import { join as join68 } from "path";
|
|
25519
|
-
import
|
|
25496
|
+
import chalk164 from "chalk";
|
|
25520
25497
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
25521
25498
|
function isLockedDll(debugDir) {
|
|
25522
25499
|
let files;
|
|
@@ -25563,14 +25540,14 @@ function checkBuildLocks(startDir) {
|
|
|
25563
25540
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
25564
25541
|
if (locked) {
|
|
25565
25542
|
console.error(
|
|
25566
|
-
|
|
25543
|
+
chalk164.red("Build output locked (is VS debugging?): ") + locked
|
|
25567
25544
|
);
|
|
25568
25545
|
process.exit(1);
|
|
25569
25546
|
}
|
|
25570
25547
|
}
|
|
25571
25548
|
async function checkBuildLocksCommand() {
|
|
25572
25549
|
checkBuildLocks();
|
|
25573
|
-
console.log(
|
|
25550
|
+
console.log(chalk164.green("No build locks detected"));
|
|
25574
25551
|
}
|
|
25575
25552
|
|
|
25576
25553
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -25669,30 +25646,30 @@ function escapeRegex(s) {
|
|
|
25669
25646
|
}
|
|
25670
25647
|
|
|
25671
25648
|
// src/commands/dotnet/printTree.ts
|
|
25672
|
-
import
|
|
25649
|
+
import chalk165 from "chalk";
|
|
25673
25650
|
function printNodes(nodes, prefix2) {
|
|
25674
25651
|
for (let i = 0; i < nodes.length; i++) {
|
|
25675
25652
|
const isLast = i === nodes.length - 1;
|
|
25676
25653
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
25677
25654
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
25678
25655
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
25679
|
-
const label = isMissing ?
|
|
25656
|
+
const label = isMissing ? chalk165.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
25680
25657
|
console.log(`${prefix2}${connector}${label}`);
|
|
25681
25658
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
25682
25659
|
}
|
|
25683
25660
|
}
|
|
25684
25661
|
function printTree(tree, totalCount, solutions) {
|
|
25685
|
-
console.log(
|
|
25686
|
-
console.log(
|
|
25662
|
+
console.log(chalk165.bold("\nProject Dependency Tree"));
|
|
25663
|
+
console.log(chalk165.cyan(tree.relativePath));
|
|
25687
25664
|
printNodes(tree.children, "");
|
|
25688
|
-
console.log(
|
|
25665
|
+
console.log(chalk165.dim(`
|
|
25689
25666
|
${totalCount} projects total (including root)`));
|
|
25690
|
-
console.log(
|
|
25667
|
+
console.log(chalk165.bold("\nSolution Membership"));
|
|
25691
25668
|
if (solutions.length === 0) {
|
|
25692
|
-
console.log(
|
|
25669
|
+
console.log(chalk165.yellow(" Not found in any .sln"));
|
|
25693
25670
|
} else {
|
|
25694
25671
|
for (const sln of solutions) {
|
|
25695
|
-
console.log(` ${
|
|
25672
|
+
console.log(` ${chalk165.green(sln)}`);
|
|
25696
25673
|
}
|
|
25697
25674
|
}
|
|
25698
25675
|
console.log();
|
|
@@ -25721,16 +25698,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
25721
25698
|
// src/commands/dotnet/resolveCsproj.ts
|
|
25722
25699
|
import { existsSync as existsSync55 } from "fs";
|
|
25723
25700
|
import path37 from "path";
|
|
25724
|
-
import
|
|
25701
|
+
import chalk166 from "chalk";
|
|
25725
25702
|
function resolveCsproj(csprojPath) {
|
|
25726
25703
|
const resolved = path37.resolve(csprojPath);
|
|
25727
25704
|
if (!existsSync55(resolved)) {
|
|
25728
|
-
console.error(
|
|
25705
|
+
console.error(chalk166.red(`File not found: ${resolved}`));
|
|
25729
25706
|
process.exit(1);
|
|
25730
25707
|
}
|
|
25731
25708
|
const repoRoot2 = findRepoRoot(path37.dirname(resolved));
|
|
25732
25709
|
if (!repoRoot2) {
|
|
25733
|
-
console.error(
|
|
25710
|
+
console.error(chalk166.red("Could not find git repository root"));
|
|
25734
25711
|
process.exit(1);
|
|
25735
25712
|
}
|
|
25736
25713
|
return { resolved, repoRoot: repoRoot2 };
|
|
@@ -25780,12 +25757,12 @@ function getChangedCsFiles(scope) {
|
|
|
25780
25757
|
}
|
|
25781
25758
|
|
|
25782
25759
|
// src/commands/dotnet/inSln.ts
|
|
25783
|
-
import
|
|
25760
|
+
import chalk167 from "chalk";
|
|
25784
25761
|
async function inSln(csprojPath) {
|
|
25785
25762
|
const { resolved, repoRoot: repoRoot2 } = resolveCsproj(csprojPath);
|
|
25786
25763
|
const solutions = findContainingSolutions(resolved, repoRoot2);
|
|
25787
25764
|
if (solutions.length === 0) {
|
|
25788
|
-
console.log(
|
|
25765
|
+
console.log(chalk167.yellow("Not found in any .sln file"));
|
|
25789
25766
|
process.exit(1);
|
|
25790
25767
|
}
|
|
25791
25768
|
for (const sln of solutions) {
|
|
@@ -25794,7 +25771,7 @@ async function inSln(csprojPath) {
|
|
|
25794
25771
|
}
|
|
25795
25772
|
|
|
25796
25773
|
// src/commands/dotnet/inspect.ts
|
|
25797
|
-
import
|
|
25774
|
+
import chalk173 from "chalk";
|
|
25798
25775
|
|
|
25799
25776
|
// src/shared/formatElapsed.ts
|
|
25800
25777
|
function formatElapsed(ms) {
|
|
@@ -25806,12 +25783,12 @@ function formatElapsed(ms) {
|
|
|
25806
25783
|
}
|
|
25807
25784
|
|
|
25808
25785
|
// src/commands/dotnet/displayIssues.ts
|
|
25809
|
-
import
|
|
25786
|
+
import chalk168 from "chalk";
|
|
25810
25787
|
var SEVERITY_COLOR = {
|
|
25811
|
-
ERROR:
|
|
25812
|
-
WARNING:
|
|
25813
|
-
SUGGESTION:
|
|
25814
|
-
HINT:
|
|
25788
|
+
ERROR: chalk168.red,
|
|
25789
|
+
WARNING: chalk168.yellow,
|
|
25790
|
+
SUGGESTION: chalk168.cyan,
|
|
25791
|
+
HINT: chalk168.dim
|
|
25815
25792
|
};
|
|
25816
25793
|
function groupByFile(issues) {
|
|
25817
25794
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -25827,15 +25804,15 @@ function groupByFile(issues) {
|
|
|
25827
25804
|
}
|
|
25828
25805
|
function displayIssues(issues) {
|
|
25829
25806
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
25830
|
-
console.log(
|
|
25807
|
+
console.log(chalk168.bold(file));
|
|
25831
25808
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
25832
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
25809
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk168.white;
|
|
25833
25810
|
console.log(
|
|
25834
|
-
` ${
|
|
25811
|
+
` ${chalk168.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
25835
25812
|
);
|
|
25836
25813
|
}
|
|
25837
25814
|
}
|
|
25838
|
-
console.log(
|
|
25815
|
+
console.log(chalk168.dim(`
|
|
25839
25816
|
${issues.length} issue(s) found`));
|
|
25840
25817
|
}
|
|
25841
25818
|
|
|
@@ -25894,12 +25871,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
25894
25871
|
// src/commands/dotnet/resolveSolution.ts
|
|
25895
25872
|
import { existsSync as existsSync56 } from "fs";
|
|
25896
25873
|
import path38 from "path";
|
|
25897
|
-
import
|
|
25874
|
+
import chalk170 from "chalk";
|
|
25898
25875
|
|
|
25899
25876
|
// src/commands/dotnet/findSolution.ts
|
|
25900
25877
|
import { readdirSync as readdirSync11 } from "fs";
|
|
25901
25878
|
import { dirname as dirname30, join as join69 } from "path";
|
|
25902
|
-
import
|
|
25879
|
+
import chalk169 from "chalk";
|
|
25903
25880
|
function findSlnInDir(dir) {
|
|
25904
25881
|
try {
|
|
25905
25882
|
return readdirSync11(dir).filter((f) => f.endsWith(".sln")).map((f) => join69(dir, f));
|
|
@@ -25915,17 +25892,17 @@ function findSolution() {
|
|
|
25915
25892
|
const slnFiles = findSlnInDir(current);
|
|
25916
25893
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
25917
25894
|
if (slnFiles.length > 1) {
|
|
25918
|
-
console.error(
|
|
25895
|
+
console.error(chalk169.red(`Multiple .sln files found in ${current}:`));
|
|
25919
25896
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
25920
25897
|
console.error(
|
|
25921
|
-
|
|
25898
|
+
chalk169.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
25922
25899
|
);
|
|
25923
25900
|
process.exit(1);
|
|
25924
25901
|
}
|
|
25925
25902
|
if (current === ceiling) break;
|
|
25926
25903
|
current = dirname30(current);
|
|
25927
25904
|
}
|
|
25928
|
-
console.error(
|
|
25905
|
+
console.error(chalk169.red("No .sln file found between cwd and repo root"));
|
|
25929
25906
|
process.exit(1);
|
|
25930
25907
|
}
|
|
25931
25908
|
|
|
@@ -25934,7 +25911,7 @@ function resolveSolution(sln) {
|
|
|
25934
25911
|
if (sln) {
|
|
25935
25912
|
const resolved = path38.resolve(sln);
|
|
25936
25913
|
if (!existsSync56(resolved)) {
|
|
25937
|
-
console.error(
|
|
25914
|
+
console.error(chalk170.red(`Solution file not found: ${resolved}`));
|
|
25938
25915
|
process.exit(1);
|
|
25939
25916
|
}
|
|
25940
25917
|
return resolved;
|
|
@@ -25976,14 +25953,14 @@ import { execSync as execSync37 } from "child_process";
|
|
|
25976
25953
|
import { existsSync as existsSync57, readFileSync as readFileSync40, unlinkSync as unlinkSync10 } from "fs";
|
|
25977
25954
|
import { tmpdir as tmpdir4 } from "os";
|
|
25978
25955
|
import path39 from "path";
|
|
25979
|
-
import
|
|
25956
|
+
import chalk171 from "chalk";
|
|
25980
25957
|
function assertJbInstalled() {
|
|
25981
25958
|
try {
|
|
25982
25959
|
execSync37("jb inspectcode --version", { stdio: "pipe" });
|
|
25983
25960
|
} catch {
|
|
25984
|
-
console.error(
|
|
25961
|
+
console.error(chalk171.red("jb is not installed. Install with:"));
|
|
25985
25962
|
console.error(
|
|
25986
|
-
|
|
25963
|
+
chalk171.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
25987
25964
|
);
|
|
25988
25965
|
process.exit(1);
|
|
25989
25966
|
}
|
|
@@ -26001,11 +25978,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
26001
25978
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
26002
25979
|
process.stderr.write(error.stderr);
|
|
26003
25980
|
}
|
|
26004
|
-
console.error(
|
|
25981
|
+
console.error(chalk171.red("jb inspectcode failed"));
|
|
26005
25982
|
process.exit(1);
|
|
26006
25983
|
}
|
|
26007
25984
|
if (!existsSync57(reportPath)) {
|
|
26008
|
-
console.error(
|
|
25985
|
+
console.error(chalk171.red("Report file not generated"));
|
|
26009
25986
|
process.exit(1);
|
|
26010
25987
|
}
|
|
26011
25988
|
const xml = readFileSync40(reportPath, "utf8");
|
|
@@ -26015,7 +25992,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
26015
25992
|
|
|
26016
25993
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
26017
25994
|
import { execSync as execSync38 } from "child_process";
|
|
26018
|
-
import
|
|
25995
|
+
import chalk172 from "chalk";
|
|
26019
25996
|
function resolveMsbuildPath() {
|
|
26020
25997
|
const { run: run4 } = loadConfig();
|
|
26021
25998
|
const configs = resolveRunConfigs(run4, runConfigBaseDir());
|
|
@@ -26027,9 +26004,9 @@ function assertMsbuildInstalled() {
|
|
|
26027
26004
|
try {
|
|
26028
26005
|
execSync38(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
26029
26006
|
} catch {
|
|
26030
|
-
console.error(
|
|
26007
|
+
console.error(chalk172.red(`msbuild not found at: ${msbuild}`));
|
|
26031
26008
|
console.error(
|
|
26032
|
-
|
|
26009
|
+
chalk172.yellow(
|
|
26033
26010
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
26034
26011
|
)
|
|
26035
26012
|
);
|
|
@@ -26076,17 +26053,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
26076
26053
|
// src/commands/dotnet/inspect.ts
|
|
26077
26054
|
function logScope(changedFiles2) {
|
|
26078
26055
|
if (changedFiles2 === null) {
|
|
26079
|
-
console.log(
|
|
26056
|
+
console.log(chalk173.dim("Inspecting full solution..."));
|
|
26080
26057
|
} else {
|
|
26081
26058
|
console.log(
|
|
26082
|
-
|
|
26059
|
+
chalk173.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
26083
26060
|
);
|
|
26084
26061
|
}
|
|
26085
26062
|
}
|
|
26086
26063
|
function reportResults(issues, elapsed) {
|
|
26087
26064
|
if (issues.length > 0) displayIssues(issues);
|
|
26088
|
-
else console.log(
|
|
26089
|
-
console.log(
|
|
26065
|
+
else console.log(chalk173.green("No issues found"));
|
|
26066
|
+
console.log(chalk173.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
26090
26067
|
if (issues.length > 0) process.exit(1);
|
|
26091
26068
|
}
|
|
26092
26069
|
async function inspect(sln, options2) {
|
|
@@ -26097,7 +26074,7 @@ async function inspect(sln, options2) {
|
|
|
26097
26074
|
const scope = parseScope(options2.scope);
|
|
26098
26075
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
26099
26076
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
26100
|
-
console.log(
|
|
26077
|
+
console.log(chalk173.green("No changed .cs files found"));
|
|
26101
26078
|
return;
|
|
26102
26079
|
}
|
|
26103
26080
|
logScope(changedFiles2);
|
|
@@ -26985,25 +26962,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
26985
26962
|
}
|
|
26986
26963
|
|
|
26987
26964
|
// src/commands/github/printCountTable.ts
|
|
26988
|
-
import
|
|
26965
|
+
import chalk174 from "chalk";
|
|
26989
26966
|
function printCountTable(labelHeader, rows) {
|
|
26990
26967
|
const labelWidth = Math.max(
|
|
26991
26968
|
labelHeader.length,
|
|
26992
26969
|
...rows.map((row3) => row3.label.length)
|
|
26993
26970
|
);
|
|
26994
26971
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
26995
|
-
console.log(
|
|
26996
|
-
console.log(
|
|
26972
|
+
console.log(chalk174.dim(header));
|
|
26973
|
+
console.log(chalk174.dim("-".repeat(header.length)));
|
|
26997
26974
|
for (const row3 of rows) {
|
|
26998
26975
|
console.log(`${row3.label.padEnd(labelWidth)} ${row3.count}`);
|
|
26999
26976
|
}
|
|
27000
26977
|
}
|
|
27001
26978
|
|
|
27002
26979
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
27003
|
-
import
|
|
26980
|
+
import chalk175 from "chalk";
|
|
27004
26981
|
function printRepoAuthorBreakdown(repos2) {
|
|
27005
26982
|
for (const repo of repos2) {
|
|
27006
|
-
console.log(
|
|
26983
|
+
console.log(chalk175.bold(repo.name));
|
|
27007
26984
|
const authorWidth = Math.max(
|
|
27008
26985
|
0,
|
|
27009
26986
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -27077,10 +27054,10 @@ function parseSinceDate(value) {
|
|
|
27077
27054
|
}
|
|
27078
27055
|
|
|
27079
27056
|
// src/commands/github/issue/fixStructure/applyAndVerifySubtree.ts
|
|
27080
|
-
import
|
|
27057
|
+
import chalk177 from "chalk";
|
|
27081
27058
|
|
|
27082
27059
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
27083
|
-
import
|
|
27060
|
+
import chalk176 from "chalk";
|
|
27084
27061
|
|
|
27085
27062
|
// src/commands/github/issue/fixStructure/removeIssueLabels.ts
|
|
27086
27063
|
var MUTATION2 = `mutation($labelableId: ID!, $labelIds: [ID!]!) {
|
|
@@ -27117,7 +27094,7 @@ function writeLineNow(line) {
|
|
|
27117
27094
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
27118
27095
|
function applyFixStructurePlan(plan2) {
|
|
27119
27096
|
for (const entry of plan2.entries) {
|
|
27120
|
-
const where =
|
|
27097
|
+
const where = chalk176.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
27121
27098
|
const { typeChange, labelRemovals } = entry;
|
|
27122
27099
|
if (typeChange) {
|
|
27123
27100
|
writeLineNow(
|
|
@@ -27387,12 +27364,12 @@ function planSubtree(root2, context) {
|
|
|
27387
27364
|
function applyAndVerifySubtree(target, plan2, context) {
|
|
27388
27365
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) return;
|
|
27389
27366
|
applyFixStructurePlan(plan2);
|
|
27390
|
-
writeLineNow(
|
|
27367
|
+
writeLineNow(chalk177.dim("Re-walking the subtree to confirm"));
|
|
27391
27368
|
assertNoResidualDrift(
|
|
27392
27369
|
planSubtree(fetchRootIssue(target), context),
|
|
27393
27370
|
context.chain
|
|
27394
27371
|
);
|
|
27395
|
-
writeLineNow(
|
|
27372
|
+
writeLineNow(chalk177.green("Subtree normalised"));
|
|
27396
27373
|
}
|
|
27397
27374
|
|
|
27398
27375
|
// src/commands/github/issue/fixStructure/assertChainTypesExist.ts
|
|
@@ -27428,22 +27405,22 @@ function parseTypeChain(value) {
|
|
|
27428
27405
|
}
|
|
27429
27406
|
|
|
27430
27407
|
// src/commands/github/issue/fixStructure/printFixStructurePlan.ts
|
|
27431
|
-
import
|
|
27408
|
+
import chalk178 from "chalk";
|
|
27432
27409
|
function annotate(entry) {
|
|
27433
27410
|
const notes = [];
|
|
27434
27411
|
if (entry.level === null) {
|
|
27435
|
-
notes.push(
|
|
27412
|
+
notes.push(chalk178.red("deeper than the leaf level"));
|
|
27436
27413
|
} else if (entry.typeChange) {
|
|
27437
27414
|
notes.push(
|
|
27438
|
-
|
|
27415
|
+
chalk178.yellow(
|
|
27439
27416
|
`${entry.typeChange.from ?? "no type"} -> ${entry.typeChange.to}`
|
|
27440
27417
|
)
|
|
27441
27418
|
);
|
|
27442
27419
|
} else {
|
|
27443
|
-
notes.push(
|
|
27420
|
+
notes.push(chalk178.dim(entry.issue.typeName ?? "no type"));
|
|
27444
27421
|
}
|
|
27445
27422
|
for (const label of entry.labelRemovals) {
|
|
27446
|
-
notes.push(
|
|
27423
|
+
notes.push(chalk178.yellow(`-${label.name}`));
|
|
27447
27424
|
}
|
|
27448
27425
|
return notes;
|
|
27449
27426
|
}
|
|
@@ -27451,22 +27428,22 @@ function formatCount(count10, noun) {
|
|
|
27451
27428
|
return `${count10} ${noun}${count10 === 1 ? "" : "s"}`;
|
|
27452
27429
|
}
|
|
27453
27430
|
function printFixStructurePlan(plan2, chain2, apply) {
|
|
27454
|
-
writeLineNow(
|
|
27431
|
+
writeLineNow(chalk178.dim(`chain: ${chain2.join(" > ")}`));
|
|
27455
27432
|
for (const entry of plan2.entries) {
|
|
27456
27433
|
const indent4 = " ".repeat(entry.issue.depth);
|
|
27457
|
-
const name =
|
|
27434
|
+
const name = chalk178.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
27458
27435
|
writeLineNow(
|
|
27459
27436
|
`${indent4}${name} ${entry.issue.title} [${annotate(entry).join(", ")}]`
|
|
27460
27437
|
);
|
|
27461
27438
|
}
|
|
27462
27439
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) {
|
|
27463
|
-
writeLineNow(
|
|
27440
|
+
writeLineNow(chalk178.green("Nothing to change"));
|
|
27464
27441
|
return;
|
|
27465
27442
|
}
|
|
27466
27443
|
writeLineNow(
|
|
27467
27444
|
`${formatCount(plan2.typeChangeCount, "type change")}, ${formatCount(plan2.labelRemovalCount, "label removal")} planned`
|
|
27468
27445
|
);
|
|
27469
|
-
if (!apply) writeLineNow(
|
|
27446
|
+
if (!apply) writeLineNow(chalk178.dim("Dry run \u2014 nothing written"));
|
|
27470
27447
|
}
|
|
27471
27448
|
|
|
27472
27449
|
// src/commands/github/issue/parseRepoSlug.ts
|
|
@@ -28873,25 +28850,25 @@ function registerGithub(program) {
|
|
|
28873
28850
|
}
|
|
28874
28851
|
|
|
28875
28852
|
// src/commands/inbox/list.ts
|
|
28876
|
-
import
|
|
28853
|
+
import chalk179 from "chalk";
|
|
28877
28854
|
async function list3() {
|
|
28878
28855
|
const messages = await listInboxMessages(await getDb());
|
|
28879
28856
|
if (messages.length === 0) {
|
|
28880
|
-
console.log(
|
|
28857
|
+
console.log(chalk179.dim("No flagged messages; run assist inbox scan"));
|
|
28881
28858
|
return;
|
|
28882
28859
|
}
|
|
28883
28860
|
for (const message3 of messages) {
|
|
28884
28861
|
const when = (message3.receivedAt ?? message3.flaggedAt).toISOString();
|
|
28885
28862
|
console.log(
|
|
28886
|
-
`${
|
|
28863
|
+
`${chalk179.dim(when)} ${chalk179.cyan(message3.source)} ${chalk179.bold(message3.sender)}`
|
|
28887
28864
|
);
|
|
28888
28865
|
console.log(` ${message3.summary}`);
|
|
28889
|
-
console.log(` ${
|
|
28866
|
+
console.log(` ${chalk179.dim(message3.link)}`);
|
|
28890
28867
|
}
|
|
28891
28868
|
}
|
|
28892
28869
|
|
|
28893
28870
|
// src/commands/inbox/scan.ts
|
|
28894
|
-
import
|
|
28871
|
+
import chalk180 from "chalk";
|
|
28895
28872
|
|
|
28896
28873
|
// src/shared/db/upsertInboxMessages.ts
|
|
28897
28874
|
async function upsertInboxMessages(orm, messages) {
|
|
@@ -29081,7 +29058,7 @@ async function scan() {
|
|
|
29081
29058
|
)
|
|
29082
29059
|
);
|
|
29083
29060
|
console.log(
|
|
29084
|
-
`Flagged ${flagged} message(s) needing a reply, ${
|
|
29061
|
+
`Flagged ${flagged} message(s) needing a reply, ${chalk180.bold(added)} new.`
|
|
29085
29062
|
);
|
|
29086
29063
|
}
|
|
29087
29064
|
|
|
@@ -29096,7 +29073,7 @@ function registerInbox(program) {
|
|
|
29096
29073
|
}
|
|
29097
29074
|
|
|
29098
29075
|
// src/commands/jira/acceptanceCriteria.ts
|
|
29099
|
-
import
|
|
29076
|
+
import chalk181 from "chalk";
|
|
29100
29077
|
|
|
29101
29078
|
// src/commands/jira/adfToText.ts
|
|
29102
29079
|
function renderInline(node) {
|
|
@@ -29163,7 +29140,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
29163
29140
|
const parsed = fetchIssue(issueKey, field);
|
|
29164
29141
|
const acValue = parsed?.fields?.[field];
|
|
29165
29142
|
if (!acValue) {
|
|
29166
|
-
console.log(
|
|
29143
|
+
console.log(chalk181.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
29167
29144
|
return;
|
|
29168
29145
|
}
|
|
29169
29146
|
if (typeof acValue === "string") {
|
|
@@ -29229,14 +29206,14 @@ async function jiraAuth() {
|
|
|
29229
29206
|
}
|
|
29230
29207
|
|
|
29231
29208
|
// src/commands/jira/viewIssue.ts
|
|
29232
|
-
import
|
|
29209
|
+
import chalk182 from "chalk";
|
|
29233
29210
|
function viewIssue2(issueKey) {
|
|
29234
29211
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
29235
29212
|
const fields = parsed?.fields;
|
|
29236
29213
|
const summary = fields?.summary;
|
|
29237
29214
|
const description = fields?.description;
|
|
29238
29215
|
if (summary) {
|
|
29239
|
-
console.log(
|
|
29216
|
+
console.log(chalk182.bold(summary));
|
|
29240
29217
|
}
|
|
29241
29218
|
if (description) {
|
|
29242
29219
|
if (summary) console.log();
|
|
@@ -29250,7 +29227,7 @@ function viewIssue2(issueKey) {
|
|
|
29250
29227
|
}
|
|
29251
29228
|
if (!summary && !description) {
|
|
29252
29229
|
console.log(
|
|
29253
|
-
|
|
29230
|
+
chalk182.yellow(`No summary or description found on ${issueKey}.`)
|
|
29254
29231
|
);
|
|
29255
29232
|
}
|
|
29256
29233
|
}
|
|
@@ -29957,7 +29934,7 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
29957
29934
|
}
|
|
29958
29935
|
|
|
29959
29936
|
// src/commands/review/failCheckout.ts
|
|
29960
|
-
import
|
|
29937
|
+
import chalk183 from "chalk";
|
|
29961
29938
|
|
|
29962
29939
|
// src/commands/review/azCliProblem.ts
|
|
29963
29940
|
import { execFileSync as execFileSync17 } from "child_process";
|
|
@@ -30010,14 +29987,14 @@ function failCheckout(number, headRef, stale, from, checkout) {
|
|
|
30010
29987
|
gitSyncOrNull(process.cwd(), ["checkout", "--quiet", from]);
|
|
30011
29988
|
if (headRef && stale === "local-work")
|
|
30012
29989
|
console.error(
|
|
30013
|
-
|
|
29990
|
+
chalk183.red(
|
|
30014
29991
|
`Local branch ${headRef} has commits that are not on the remote and cannot fast-forward to PR #${number}'s head; push or reset ${headRef}, then retry.`
|
|
30015
29992
|
)
|
|
30016
29993
|
);
|
|
30017
29994
|
const problem = checkout.file === "az" ? azCliProblem() : null;
|
|
30018
|
-
if (problem) console.error(
|
|
29995
|
+
if (problem) console.error(chalk183.red(problem));
|
|
30019
29996
|
console.error(
|
|
30020
|
-
|
|
29997
|
+
chalk183.red(`${checkout.file} ${checkout.args.join(" ")} failed; aborting.`)
|
|
30021
29998
|
);
|
|
30022
29999
|
process.exit(1);
|
|
30023
30000
|
}
|
|
@@ -30210,18 +30187,18 @@ function registerList(program) {
|
|
|
30210
30187
|
}
|
|
30211
30188
|
|
|
30212
30189
|
// src/commands/litellm/listModels.ts
|
|
30213
|
-
import
|
|
30190
|
+
import chalk185 from "chalk";
|
|
30214
30191
|
|
|
30215
30192
|
// src/commands/litellm/resolveLitellmConfig.ts
|
|
30216
|
-
import
|
|
30193
|
+
import chalk184 from "chalk";
|
|
30217
30194
|
function resolveLitellmConfig() {
|
|
30218
30195
|
const { config, missing } = readLitellmConfig();
|
|
30219
30196
|
if (!config) {
|
|
30220
|
-
console.error(
|
|
30197
|
+
console.error(chalk184.red("LiteLLM is not configured"));
|
|
30221
30198
|
for (const key of missing) {
|
|
30222
30199
|
const entry = litellmConfigHelp.find((help) => help.key === key);
|
|
30223
30200
|
console.error(
|
|
30224
|
-
|
|
30201
|
+
chalk184.red(` ${key} is not set. Set it with: ${entry?.setter}`)
|
|
30225
30202
|
);
|
|
30226
30203
|
}
|
|
30227
30204
|
process.exit(1);
|
|
@@ -30247,13 +30224,13 @@ async function listModels(options2) {
|
|
|
30247
30224
|
} catch (error) {
|
|
30248
30225
|
const reason4 = error instanceof Error ? error.message : String(error);
|
|
30249
30226
|
console.error(
|
|
30250
|
-
|
|
30227
|
+
chalk185.red(`Failed to reach LiteLLM at ${baseUrl}: ${reason4}`)
|
|
30251
30228
|
);
|
|
30252
30229
|
process.exit(1);
|
|
30253
30230
|
}
|
|
30254
30231
|
const body = await response.text();
|
|
30255
30232
|
if (!response.ok) {
|
|
30256
|
-
console.error(
|
|
30233
|
+
console.error(chalk185.red(`LiteLLM returned ${response.status}: ${body}`));
|
|
30257
30234
|
process.exit(1);
|
|
30258
30235
|
}
|
|
30259
30236
|
if (options2.json) {
|
|
@@ -30273,15 +30250,15 @@ function registerLitellm(program) {
|
|
|
30273
30250
|
// src/commands/mermaidExport.ts
|
|
30274
30251
|
import { mkdirSync as mkdirSync21, readdirSync as readdirSync12 } from "fs";
|
|
30275
30252
|
import { resolve as resolve21 } from "path";
|
|
30276
|
-
import
|
|
30253
|
+
import chalk188 from "chalk";
|
|
30277
30254
|
|
|
30278
30255
|
// src/commands/mermaid/exportFile.ts
|
|
30279
30256
|
import { readFileSync as readFileSync42, writeFileSync as writeFileSync34 } from "fs";
|
|
30280
30257
|
import { basename as basename22, extname as extname4, resolve as resolve20 } from "path";
|
|
30281
|
-
import
|
|
30258
|
+
import chalk187 from "chalk";
|
|
30282
30259
|
|
|
30283
30260
|
// src/commands/mermaid/renderBlock.ts
|
|
30284
|
-
import
|
|
30261
|
+
import chalk186 from "chalk";
|
|
30285
30262
|
async function renderBlock(krokiUrl, source) {
|
|
30286
30263
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
30287
30264
|
method: "POST",
|
|
@@ -30290,7 +30267,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
30290
30267
|
});
|
|
30291
30268
|
if (!response.ok) {
|
|
30292
30269
|
console.error(
|
|
30293
|
-
|
|
30270
|
+
chalk186.red(
|
|
30294
30271
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
30295
30272
|
)
|
|
30296
30273
|
);
|
|
@@ -30308,19 +30285,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
30308
30285
|
if (onlyIndex !== void 0) {
|
|
30309
30286
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
30310
30287
|
console.error(
|
|
30311
|
-
|
|
30288
|
+
chalk187.red(
|
|
30312
30289
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
30313
30290
|
)
|
|
30314
30291
|
);
|
|
30315
30292
|
process.exit(1);
|
|
30316
30293
|
}
|
|
30317
30294
|
console.log(
|
|
30318
|
-
|
|
30295
|
+
chalk187.gray(
|
|
30319
30296
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
30320
30297
|
)
|
|
30321
30298
|
);
|
|
30322
30299
|
} else {
|
|
30323
|
-
console.log(
|
|
30300
|
+
console.log(chalk187.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
30324
30301
|
}
|
|
30325
30302
|
for (const [i, source] of blocks.entries()) {
|
|
30326
30303
|
const idx = i + 1;
|
|
@@ -30328,7 +30305,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
30328
30305
|
const outPath = resolve20(outDir, `${stem}-${idx}.svg`);
|
|
30329
30306
|
const svg = await renderBlock(krokiUrl, source);
|
|
30330
30307
|
writeFileSync34(outPath, svg, "utf8");
|
|
30331
|
-
console.log(
|
|
30308
|
+
console.log(chalk187.green(` \u2192 ${outPath}`));
|
|
30332
30309
|
}
|
|
30333
30310
|
}
|
|
30334
30311
|
function extractMermaidBlocks(markdown) {
|
|
@@ -30344,18 +30321,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
30344
30321
|
if (options2.index !== void 0) {
|
|
30345
30322
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
30346
30323
|
console.error(
|
|
30347
|
-
|
|
30324
|
+
chalk188.red(`--index must be a positive integer (got ${options2.index})`)
|
|
30348
30325
|
);
|
|
30349
30326
|
process.exit(1);
|
|
30350
30327
|
}
|
|
30351
30328
|
if (!file) {
|
|
30352
|
-
console.error(
|
|
30329
|
+
console.error(chalk188.red("--index requires a file argument"));
|
|
30353
30330
|
process.exit(1);
|
|
30354
30331
|
}
|
|
30355
30332
|
}
|
|
30356
30333
|
const files = file ? [file] : readdirSync12(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
30357
30334
|
if (files.length === 0) {
|
|
30358
|
-
console.log(
|
|
30335
|
+
console.log(chalk188.gray("No markdown files found in current directory."));
|
|
30359
30336
|
return;
|
|
30360
30337
|
}
|
|
30361
30338
|
for (const f of files) {
|
|
@@ -30501,7 +30478,7 @@ function extractToSave(details, cwd = process.cwd()) {
|
|
|
30501
30478
|
}
|
|
30502
30479
|
|
|
30503
30480
|
// src/commands/miro/keptTexts.ts
|
|
30504
|
-
import
|
|
30481
|
+
import chalk189 from "chalk";
|
|
30505
30482
|
|
|
30506
30483
|
// src/commands/miro/applyIgnore.ts
|
|
30507
30484
|
function applyIgnore(texts, ignore3) {
|
|
@@ -30540,7 +30517,7 @@ function warnUnmatched(file, unmatched) {
|
|
|
30540
30517
|
if (unmatched.length === 0) return;
|
|
30541
30518
|
const entries = unmatched.map((entry) => ` - ${entry}`).join("\n");
|
|
30542
30519
|
console.error(
|
|
30543
|
-
|
|
30520
|
+
chalk189.yellow(
|
|
30544
30521
|
`${unmatched.length} ${unmatched.length === 1 ? "entry" : "entries"} in ${file} matched no box text:
|
|
30545
30522
|
${entries}`
|
|
30546
30523
|
)
|
|
@@ -30741,7 +30718,7 @@ function readMiroItems(file) {
|
|
|
30741
30718
|
}
|
|
30742
30719
|
|
|
30743
30720
|
// src/commands/miro/resolveExtractOptions.ts
|
|
30744
|
-
import
|
|
30721
|
+
import chalk190 from "chalk";
|
|
30745
30722
|
|
|
30746
30723
|
// src/commands/miro/extractLayers.ts
|
|
30747
30724
|
function extractsIn(layer) {
|
|
@@ -30819,7 +30796,7 @@ function resolveExtractOptions(name, options2, paths) {
|
|
|
30819
30796
|
paths.cwd,
|
|
30820
30797
|
paths.globalConfigPath
|
|
30821
30798
|
);
|
|
30822
|
-
console.error(
|
|
30799
|
+
console.error(chalk190.dim(`Extract "${name}" from ${resolved.from}`));
|
|
30823
30800
|
return resolved.options;
|
|
30824
30801
|
}
|
|
30825
30802
|
|
|
@@ -30924,7 +30901,7 @@ function registerMiro(program) {
|
|
|
30924
30901
|
import { mkdir as mkdir6 } from "fs/promises";
|
|
30925
30902
|
import { createServer as createServer2 } from "http";
|
|
30926
30903
|
import { dirname as dirname36 } from "path";
|
|
30927
|
-
import
|
|
30904
|
+
import chalk192 from "chalk";
|
|
30928
30905
|
|
|
30929
30906
|
// src/commands/netcap/corsHeaders.ts
|
|
30930
30907
|
var corsHeaders = {
|
|
@@ -31003,7 +30980,7 @@ function createNetcapHandler(options2) {
|
|
|
31003
30980
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
31004
30981
|
import { networkInterfaces } from "os";
|
|
31005
30982
|
import { join as join76 } from "path";
|
|
31006
|
-
import
|
|
30983
|
+
import chalk191 from "chalk";
|
|
31007
30984
|
|
|
31008
30985
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
31009
30986
|
import { dirname as dirname35, join as join75 } from "path";
|
|
@@ -31047,7 +31024,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
31047
31024
|
const host = lanIPv4();
|
|
31048
31025
|
if (!host) {
|
|
31049
31026
|
console.log(
|
|
31050
|
-
|
|
31027
|
+
chalk191.yellow("could not determine the WSL IP for the extension")
|
|
31051
31028
|
);
|
|
31052
31029
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
31053
31030
|
return source;
|
|
@@ -31058,7 +31035,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
31058
31035
|
return WSL_WINDOWS_PATH3;
|
|
31059
31036
|
} catch {
|
|
31060
31037
|
console.log(
|
|
31061
|
-
|
|
31038
|
+
chalk191.yellow(`could not copy extension to ${WSL_WINDOWS_PATH3}`)
|
|
31062
31039
|
);
|
|
31063
31040
|
return source;
|
|
31064
31041
|
}
|
|
@@ -31091,30 +31068,30 @@ async function netcap(options2) {
|
|
|
31091
31068
|
let count10 = 0;
|
|
31092
31069
|
const handler = createNetcapHandler({
|
|
31093
31070
|
outPath,
|
|
31094
|
-
onPing: () => console.log(
|
|
31071
|
+
onPing: () => console.log(chalk192.dim("ping from extension")),
|
|
31095
31072
|
onCapture: (entry) => {
|
|
31096
31073
|
count10 += 1;
|
|
31097
31074
|
console.log(
|
|
31098
|
-
|
|
31099
|
-
|
|
31075
|
+
chalk192.green(`captured #${count10}`),
|
|
31076
|
+
chalk192.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
31100
31077
|
);
|
|
31101
31078
|
}
|
|
31102
31079
|
});
|
|
31103
31080
|
const server = createServer2(handler);
|
|
31104
31081
|
server.listen(port, () => {
|
|
31105
31082
|
console.log(
|
|
31106
|
-
|
|
31083
|
+
chalk192.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
31107
31084
|
);
|
|
31108
|
-
console.log(
|
|
31085
|
+
console.log(chalk192.dim(`appending captures to ${outPath}`));
|
|
31109
31086
|
if (filter)
|
|
31110
|
-
console.log(
|
|
31111
|
-
console.log(
|
|
31112
|
-
console.log(
|
|
31087
|
+
console.log(chalk192.dim(`forwarding only URLs matching "${filter}"`));
|
|
31088
|
+
console.log(chalk192.dim(`load the unpacked extension from ${extensionPath}`));
|
|
31089
|
+
console.log(chalk192.dim("press Ctrl-C to stop"));
|
|
31113
31090
|
});
|
|
31114
31091
|
process.on("SIGINT", () => {
|
|
31115
31092
|
server.close();
|
|
31116
31093
|
console.log(
|
|
31117
|
-
|
|
31094
|
+
chalk192.bold(
|
|
31118
31095
|
`
|
|
31119
31096
|
netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
31120
31097
|
)
|
|
@@ -31126,7 +31103,7 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
31126
31103
|
// src/commands/netcap/netcapExtract.ts
|
|
31127
31104
|
import { writeFileSync as writeFileSync36 } from "fs";
|
|
31128
31105
|
import { join as join79 } from "path";
|
|
31129
|
-
import
|
|
31106
|
+
import chalk193 from "chalk";
|
|
31130
31107
|
|
|
31131
31108
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
31132
31109
|
import { readFileSync as readFileSync45 } from "fs";
|
|
@@ -31574,8 +31551,8 @@ function netcapExtract(file) {
|
|
|
31574
31551
|
writeFileSync36(outFile, `${JSON.stringify(posts, null, 2)}
|
|
31575
31552
|
`);
|
|
31576
31553
|
console.log(
|
|
31577
|
-
|
|
31578
|
-
|
|
31554
|
+
chalk193.green(`extracted ${posts.length} posts`),
|
|
31555
|
+
chalk193.dim(`-> ${outFile}`)
|
|
31579
31556
|
);
|
|
31580
31557
|
}
|
|
31581
31558
|
|
|
@@ -31596,7 +31573,7 @@ function registerNetcap(program) {
|
|
|
31596
31573
|
}
|
|
31597
31574
|
|
|
31598
31575
|
// src/commands/news/add.ts
|
|
31599
|
-
import
|
|
31576
|
+
import chalk194 from "chalk";
|
|
31600
31577
|
import enquirer8 from "enquirer";
|
|
31601
31578
|
async function add2(url) {
|
|
31602
31579
|
if (!url) {
|
|
@@ -31617,25 +31594,25 @@ async function add2(url) {
|
|
|
31617
31594
|
}
|
|
31618
31595
|
const added = await addFeed(await getDb(), url);
|
|
31619
31596
|
if (!added) {
|
|
31620
|
-
console.log(
|
|
31597
|
+
console.log(chalk194.yellow("Feed already exists"));
|
|
31621
31598
|
return;
|
|
31622
31599
|
}
|
|
31623
|
-
console.log(
|
|
31600
|
+
console.log(chalk194.green(`Added feed: ${url}`));
|
|
31624
31601
|
}
|
|
31625
31602
|
|
|
31626
31603
|
// src/commands/news/list.ts
|
|
31627
|
-
import
|
|
31604
|
+
import chalk195 from "chalk";
|
|
31628
31605
|
async function list4() {
|
|
31629
31606
|
const urls = await listFeeds(await getDb());
|
|
31630
31607
|
if (urls.length === 0) {
|
|
31631
|
-
console.log(
|
|
31608
|
+
console.log(chalk195.dim("No feeds; add one with assist news add <url>"));
|
|
31632
31609
|
return;
|
|
31633
31610
|
}
|
|
31634
31611
|
for (const url of urls) console.log(url);
|
|
31635
31612
|
}
|
|
31636
31613
|
|
|
31637
31614
|
// src/commands/news/remove.ts
|
|
31638
|
-
import
|
|
31615
|
+
import chalk196 from "chalk";
|
|
31639
31616
|
|
|
31640
31617
|
// src/commands/backlog/removeFeed.ts
|
|
31641
31618
|
import { eq as eq49 } from "drizzle-orm";
|
|
@@ -31648,10 +31625,10 @@ async function removeFeed(db, url) {
|
|
|
31648
31625
|
async function remove(url) {
|
|
31649
31626
|
const removed = await removeFeed(await getDb(), url);
|
|
31650
31627
|
if (!removed) {
|
|
31651
|
-
console.log(
|
|
31628
|
+
console.log(chalk196.yellow(`No feed matches ${url}`));
|
|
31652
31629
|
return;
|
|
31653
31630
|
}
|
|
31654
|
-
console.log(
|
|
31631
|
+
console.log(chalk196.green(`Removed feed: ${url}`));
|
|
31655
31632
|
}
|
|
31656
31633
|
|
|
31657
31634
|
// src/commands/registerNews.ts
|
|
@@ -31704,7 +31681,7 @@ function registerPiHook(program) {
|
|
|
31704
31681
|
}
|
|
31705
31682
|
|
|
31706
31683
|
// src/commands/prompts/printPromptsTable.ts
|
|
31707
|
-
import
|
|
31684
|
+
import chalk197 from "chalk";
|
|
31708
31685
|
function truncate(str, max) {
|
|
31709
31686
|
if (str.length <= max) return str;
|
|
31710
31687
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -31722,14 +31699,14 @@ function printPromptsTable(rows) {
|
|
|
31722
31699
|
"Command".padEnd(commandWidth),
|
|
31723
31700
|
"Repos"
|
|
31724
31701
|
].join(" ");
|
|
31725
|
-
console.log(
|
|
31726
|
-
console.log(
|
|
31702
|
+
console.log(chalk197.dim(header));
|
|
31703
|
+
console.log(chalk197.dim("-".repeat(header.length)));
|
|
31727
31704
|
for (const row3 of rows) {
|
|
31728
31705
|
const count10 = String(row3.count).padStart(countWidth);
|
|
31729
31706
|
const tool = row3.tool.padEnd(toolWidth);
|
|
31730
31707
|
const command = truncate(row3.command, 60).padEnd(commandWidth);
|
|
31731
31708
|
console.log(
|
|
31732
|
-
`${
|
|
31709
|
+
`${chalk197.yellow(count10)} ${tool} ${command} ${chalk197.dim(row3.repos)}`
|
|
31733
31710
|
);
|
|
31734
31711
|
}
|
|
31735
31712
|
}
|
|
@@ -31767,13 +31744,13 @@ import { execSync as execSync41 } from "child_process";
|
|
|
31767
31744
|
import enquirer9 from "enquirer";
|
|
31768
31745
|
|
|
31769
31746
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
31770
|
-
import
|
|
31747
|
+
import chalk198 from "chalk";
|
|
31771
31748
|
var STATUS_MAP = {
|
|
31772
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
31773
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
31749
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk198.magenta("merged"), date: pr.mergedAt } : null,
|
|
31750
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk198.red("closed"), date: pr.closedAt } : null
|
|
31774
31751
|
};
|
|
31775
31752
|
function defaultStatus(pr) {
|
|
31776
|
-
return { label:
|
|
31753
|
+
return { label: chalk198.green("opened"), date: pr.createdAt };
|
|
31777
31754
|
}
|
|
31778
31755
|
function getStatus2(pr) {
|
|
31779
31756
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -31782,11 +31759,11 @@ function formatDate(dateStr) {
|
|
|
31782
31759
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
31783
31760
|
}
|
|
31784
31761
|
function formatPrHeader(pr, status2) {
|
|
31785
|
-
return `${
|
|
31762
|
+
return `${chalk198.cyan(`#${pr.number}`)} ${pr.title} ${chalk198.dim(`(${pr.author.login},`)} ${status2.label} ${chalk198.dim(`${formatDate(status2.date)})`)}`;
|
|
31786
31763
|
}
|
|
31787
31764
|
function logPrDetails(pr) {
|
|
31788
31765
|
console.log(
|
|
31789
|
-
|
|
31766
|
+
chalk198.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
31790
31767
|
);
|
|
31791
31768
|
console.log();
|
|
31792
31769
|
}
|
|
@@ -32355,13 +32332,13 @@ function agentFooter(unresolvedCount) {
|
|
|
32355
32332
|
}
|
|
32356
32333
|
|
|
32357
32334
|
// src/commands/prs/listComments/commentStyle.ts
|
|
32358
|
-
import
|
|
32335
|
+
import chalk199 from "chalk";
|
|
32359
32336
|
var plain = (text18) => text18;
|
|
32360
32337
|
function colouredState(state) {
|
|
32361
32338
|
const label = `[${state}]`;
|
|
32362
|
-
if (state === "APPROVED") return
|
|
32363
|
-
if (state === "CHANGES_REQUESTED") return
|
|
32364
|
-
return
|
|
32339
|
+
if (state === "APPROVED") return chalk199.green(label);
|
|
32340
|
+
if (state === "CHANGES_REQUESTED") return chalk199.red(label);
|
|
32341
|
+
return chalk199.yellow(label);
|
|
32365
32342
|
}
|
|
32366
32343
|
function commentStyle() {
|
|
32367
32344
|
if (isClaudeCode()) {
|
|
@@ -32375,9 +32352,9 @@ function commentStyle() {
|
|
|
32375
32352
|
};
|
|
32376
32353
|
}
|
|
32377
32354
|
return {
|
|
32378
|
-
cyan:
|
|
32379
|
-
bold:
|
|
32380
|
-
dim:
|
|
32355
|
+
cyan: chalk199.cyan,
|
|
32356
|
+
bold: chalk199.bold,
|
|
32357
|
+
dim: chalk199.dim,
|
|
32381
32358
|
state: colouredState,
|
|
32382
32359
|
diffHunk: true,
|
|
32383
32360
|
agent: false
|
|
@@ -33851,16 +33828,16 @@ function buildPrsStatusReport(repoArguments, now = Date.now()) {
|
|
|
33851
33828
|
}
|
|
33852
33829
|
|
|
33853
33830
|
// src/commands/prs/status/printPrsStatus.ts
|
|
33854
|
-
import
|
|
33831
|
+
import chalk201 from "chalk";
|
|
33855
33832
|
|
|
33856
33833
|
// src/commands/prs/status/printPrStatus.ts
|
|
33857
|
-
import
|
|
33834
|
+
import chalk200 from "chalk";
|
|
33858
33835
|
function flags(pr) {
|
|
33859
33836
|
const markers = [];
|
|
33860
33837
|
if (pr.isDraft) markers.push("draft");
|
|
33861
33838
|
if (pr.isDoNotMerge) markers.push("do not merge");
|
|
33862
33839
|
if (pr.isBot) markers.push("bot");
|
|
33863
|
-
return markers.length ? ` ${
|
|
33840
|
+
return markers.length ? ` ${chalk200.yellow(`[${markers.join(", ")}]`)}` : "";
|
|
33864
33841
|
}
|
|
33865
33842
|
function updated(pr) {
|
|
33866
33843
|
return pr.ageHours === null ? "updated unknown" : `updated ${pr.age} ago`;
|
|
@@ -33874,35 +33851,35 @@ function reviewLine(pr) {
|
|
|
33874
33851
|
function checkLines(pr) {
|
|
33875
33852
|
const lines2 = [];
|
|
33876
33853
|
if (pr.checks.failing.length) {
|
|
33877
|
-
lines2.push(
|
|
33854
|
+
lines2.push(chalk200.red(`failing: ${pr.checks.failing.join(", ")}`));
|
|
33878
33855
|
}
|
|
33879
33856
|
if (pr.checks.pending.length) {
|
|
33880
|
-
lines2.push(
|
|
33857
|
+
lines2.push(chalk200.yellow(`pending: ${pr.checks.pending.join(", ")}`));
|
|
33881
33858
|
}
|
|
33882
33859
|
return lines2;
|
|
33883
33860
|
}
|
|
33884
33861
|
function threadsLine(pr) {
|
|
33885
33862
|
if (pr.unresolvedThreads === null) {
|
|
33886
|
-
return
|
|
33863
|
+
return chalk200.dim("unresolved comments: unknown");
|
|
33887
33864
|
}
|
|
33888
33865
|
if (pr.unresolvedThreads === 0) return null;
|
|
33889
|
-
return
|
|
33866
|
+
return chalk200.yellow(`unresolved comments: ${pr.unresolvedThreads}`);
|
|
33890
33867
|
}
|
|
33891
33868
|
function mergeableLine(pr) {
|
|
33892
|
-
if (pr.mergeable === "CONFLICTING") return
|
|
33869
|
+
if (pr.mergeable === "CONFLICTING") return chalk200.red("conflicting");
|
|
33893
33870
|
if (pr.mergeable === "MERGEABLE") return null;
|
|
33894
|
-
return
|
|
33871
|
+
return chalk200.dim(`mergeable: ${pr.mergeable.toLowerCase()}`);
|
|
33895
33872
|
}
|
|
33896
33873
|
function printPrStatus(pr) {
|
|
33897
33874
|
console.log(
|
|
33898
|
-
` ${
|
|
33875
|
+
` ${chalk200.cyan(`#${pr.number}`)} ${pr.title} ${chalk200.dim(`(${pr.author}, ${updated(pr)})`)}${flags(pr)}`
|
|
33899
33876
|
);
|
|
33900
33877
|
const details = [
|
|
33901
33878
|
reviewLine(pr),
|
|
33902
33879
|
...checkLines(pr),
|
|
33903
33880
|
threadsLine(pr),
|
|
33904
33881
|
mergeableLine(pr),
|
|
33905
|
-
|
|
33882
|
+
chalk200.dim(pr.url)
|
|
33906
33883
|
];
|
|
33907
33884
|
for (const detail of details) {
|
|
33908
33885
|
if (detail) console.log(` ${detail}`);
|
|
@@ -33913,17 +33890,17 @@ function printPrStatus(pr) {
|
|
|
33913
33890
|
function printPrsStatus(report) {
|
|
33914
33891
|
for (const repo of report.repos) {
|
|
33915
33892
|
const count10 = repo.pullRequests.length;
|
|
33916
|
-
console.log(`${
|
|
33893
|
+
console.log(`${chalk201.bold(repo.repo)} ${chalk201.dim(`(${count10} open)`)}`);
|
|
33917
33894
|
for (const pr of repo.pullRequests) {
|
|
33918
33895
|
printPrStatus(pr);
|
|
33919
33896
|
}
|
|
33920
|
-
if (count10 === 0) console.log(
|
|
33897
|
+
if (count10 === 0) console.log(chalk201.dim(" no open pull requests"));
|
|
33921
33898
|
console.log();
|
|
33922
33899
|
}
|
|
33923
33900
|
if (report.errors.length === 0) return;
|
|
33924
|
-
console.log(
|
|
33901
|
+
console.log(chalk201.bold("Errors"));
|
|
33925
33902
|
for (const failure of report.errors) {
|
|
33926
|
-
console.log(` ${
|
|
33903
|
+
console.log(` ${chalk201.red(failure.repo)}: ${failure.error}`);
|
|
33927
33904
|
}
|
|
33928
33905
|
console.log();
|
|
33929
33906
|
}
|
|
@@ -34151,10 +34128,10 @@ function registerPrs(program) {
|
|
|
34151
34128
|
}
|
|
34152
34129
|
|
|
34153
34130
|
// src/commands/ravendb/ravendbAuth.ts
|
|
34154
|
-
import
|
|
34131
|
+
import chalk207 from "chalk";
|
|
34155
34132
|
|
|
34156
34133
|
// src/shared/createConnectionAuth.ts
|
|
34157
|
-
import
|
|
34134
|
+
import chalk202 from "chalk";
|
|
34158
34135
|
function listConnections(connections, format3) {
|
|
34159
34136
|
if (connections.length === 0) {
|
|
34160
34137
|
console.log("No connections configured.");
|
|
@@ -34167,7 +34144,7 @@ function listConnections(connections, format3) {
|
|
|
34167
34144
|
function removeConnection(connections, name, save) {
|
|
34168
34145
|
const filtered = connections.filter((c) => c.name !== name);
|
|
34169
34146
|
if (filtered.length === connections.length) {
|
|
34170
|
-
console.error(
|
|
34147
|
+
console.error(chalk202.red(`Connection "${name}" not found.`));
|
|
34171
34148
|
process.exit(1);
|
|
34172
34149
|
}
|
|
34173
34150
|
save(filtered);
|
|
@@ -34213,15 +34190,15 @@ function saveConnections(connections) {
|
|
|
34213
34190
|
}
|
|
34214
34191
|
|
|
34215
34192
|
// src/commands/ravendb/promptConnection.ts
|
|
34216
|
-
import
|
|
34193
|
+
import chalk205 from "chalk";
|
|
34217
34194
|
|
|
34218
34195
|
// src/commands/ravendb/selectOpSecret.ts
|
|
34219
|
-
import
|
|
34196
|
+
import chalk204 from "chalk";
|
|
34220
34197
|
import Enquirer2 from "enquirer";
|
|
34221
34198
|
|
|
34222
34199
|
// src/commands/ravendb/searchItems.ts
|
|
34223
34200
|
import { execSync as execSync48 } from "child_process";
|
|
34224
|
-
import
|
|
34201
|
+
import chalk203 from "chalk";
|
|
34225
34202
|
function opExec(args) {
|
|
34226
34203
|
return execSync48(`op ${args}`, {
|
|
34227
34204
|
encoding: "utf8",
|
|
@@ -34234,7 +34211,7 @@ function searchItems(search2) {
|
|
|
34234
34211
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
34235
34212
|
} catch {
|
|
34236
34213
|
console.error(
|
|
34237
|
-
|
|
34214
|
+
chalk203.red(
|
|
34238
34215
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
34239
34216
|
)
|
|
34240
34217
|
);
|
|
@@ -34248,7 +34225,7 @@ function getItemFields(itemId2) {
|
|
|
34248
34225
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
34249
34226
|
return item.fields.filter((f) => f.reference && f.label);
|
|
34250
34227
|
} catch {
|
|
34251
|
-
console.error(
|
|
34228
|
+
console.error(chalk203.red("Failed to get item details from 1Password."));
|
|
34252
34229
|
process.exit(1);
|
|
34253
34230
|
}
|
|
34254
34231
|
}
|
|
@@ -34267,7 +34244,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
34267
34244
|
}).run();
|
|
34268
34245
|
const items2 = searchItems(search2);
|
|
34269
34246
|
if (items2.length === 0) {
|
|
34270
|
-
console.error(
|
|
34247
|
+
console.error(chalk204.red(`No items found matching "${search2}".`));
|
|
34271
34248
|
process.exit(1);
|
|
34272
34249
|
}
|
|
34273
34250
|
const itemId2 = await selectOne(
|
|
@@ -34276,7 +34253,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
34276
34253
|
);
|
|
34277
34254
|
const fields = getItemFields(itemId2);
|
|
34278
34255
|
if (fields.length === 0) {
|
|
34279
|
-
console.error(
|
|
34256
|
+
console.error(chalk204.red("No fields with references found on this item."));
|
|
34280
34257
|
process.exit(1);
|
|
34281
34258
|
}
|
|
34282
34259
|
const ref = await selectOne(
|
|
@@ -34290,7 +34267,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
34290
34267
|
async function promptConnection(existingNames) {
|
|
34291
34268
|
const name = await promptInput("name", "Connection name:");
|
|
34292
34269
|
if (existingNames.includes(name)) {
|
|
34293
|
-
console.error(
|
|
34270
|
+
console.error(chalk205.red(`Connection "${name}" already exists.`));
|
|
34294
34271
|
process.exit(1);
|
|
34295
34272
|
}
|
|
34296
34273
|
const url = await promptInput(
|
|
@@ -34299,22 +34276,22 @@ async function promptConnection(existingNames) {
|
|
|
34299
34276
|
);
|
|
34300
34277
|
const database = await promptInput("database", "Database name:");
|
|
34301
34278
|
if (!name || !url || !database) {
|
|
34302
|
-
console.error(
|
|
34279
|
+
console.error(chalk205.red("All fields are required."));
|
|
34303
34280
|
process.exit(1);
|
|
34304
34281
|
}
|
|
34305
34282
|
const apiKeyRef = await selectOpSecret();
|
|
34306
|
-
console.log(
|
|
34283
|
+
console.log(chalk205.dim(`Using: ${apiKeyRef}`));
|
|
34307
34284
|
return { name, url, database, apiKeyRef };
|
|
34308
34285
|
}
|
|
34309
34286
|
|
|
34310
34287
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
34311
|
-
import
|
|
34288
|
+
import chalk206 from "chalk";
|
|
34312
34289
|
function ravendbSetConnection(name) {
|
|
34313
34290
|
const raw = loadGlobalConfigRaw();
|
|
34314
34291
|
const ravendb = raw.ravendb ?? {};
|
|
34315
34292
|
const connections = ravendb.connections ?? [];
|
|
34316
34293
|
if (!connections.some((c) => c.name === name)) {
|
|
34317
|
-
console.error(
|
|
34294
|
+
console.error(chalk206.red(`Connection "${name}" not found.`));
|
|
34318
34295
|
console.error(
|
|
34319
34296
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
34320
34297
|
);
|
|
@@ -34330,16 +34307,16 @@ function ravendbSetConnection(name) {
|
|
|
34330
34307
|
var ravendbAuth = createConnectionAuth({
|
|
34331
34308
|
load: loadConnections,
|
|
34332
34309
|
save: saveConnections,
|
|
34333
|
-
format: (c) => `${
|
|
34310
|
+
format: (c) => `${chalk207.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
34334
34311
|
promptNew: promptConnection,
|
|
34335
34312
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
34336
34313
|
});
|
|
34337
34314
|
|
|
34338
34315
|
// src/commands/ravendb/ravendbCollections.ts
|
|
34339
|
-
import
|
|
34316
|
+
import chalk211 from "chalk";
|
|
34340
34317
|
|
|
34341
34318
|
// src/commands/ravendb/ravenFetch.ts
|
|
34342
|
-
import
|
|
34319
|
+
import chalk209 from "chalk";
|
|
34343
34320
|
|
|
34344
34321
|
// src/commands/ravendb/getAccessToken.ts
|
|
34345
34322
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -34350,9 +34327,9 @@ function clearCachedToken(apiKey) {
|
|
|
34350
34327
|
}
|
|
34351
34328
|
async function getAccessToken(apiKey) {
|
|
34352
34329
|
const now = Date.now();
|
|
34353
|
-
const
|
|
34354
|
-
if (
|
|
34355
|
-
return
|
|
34330
|
+
const cached2 = tokenCache.get(apiKey);
|
|
34331
|
+
if (cached2 && now < cached2.expiry) {
|
|
34332
|
+
return cached2.token;
|
|
34356
34333
|
}
|
|
34357
34334
|
const response = await fetch(OAUTH_URL, {
|
|
34358
34335
|
method: "GET",
|
|
@@ -34376,10 +34353,10 @@ ${errorText}`
|
|
|
34376
34353
|
|
|
34377
34354
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
34378
34355
|
import { execSync as execSync49 } from "child_process";
|
|
34379
|
-
import
|
|
34356
|
+
import chalk208 from "chalk";
|
|
34380
34357
|
function resolveOpSecret(reference) {
|
|
34381
34358
|
if (!reference.startsWith("op://")) {
|
|
34382
|
-
console.error(
|
|
34359
|
+
console.error(chalk208.red(`Invalid secret reference: must start with op://`));
|
|
34383
34360
|
process.exit(1);
|
|
34384
34361
|
}
|
|
34385
34362
|
try {
|
|
@@ -34389,7 +34366,7 @@ function resolveOpSecret(reference) {
|
|
|
34389
34366
|
}).trim();
|
|
34390
34367
|
} catch {
|
|
34391
34368
|
console.error(
|
|
34392
|
-
|
|
34369
|
+
chalk208.red(
|
|
34393
34370
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
34394
34371
|
)
|
|
34395
34372
|
);
|
|
@@ -34416,7 +34393,7 @@ async function ravenFetch(connection, path109) {
|
|
|
34416
34393
|
if (!response.ok) {
|
|
34417
34394
|
const body = await response.text();
|
|
34418
34395
|
console.error(
|
|
34419
|
-
|
|
34396
|
+
chalk209.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
34420
34397
|
);
|
|
34421
34398
|
console.error(body.substring(0, 500));
|
|
34422
34399
|
process.exit(1);
|
|
@@ -34425,7 +34402,7 @@ async function ravenFetch(connection, path109) {
|
|
|
34425
34402
|
}
|
|
34426
34403
|
|
|
34427
34404
|
// src/commands/ravendb/resolveConnection.ts
|
|
34428
|
-
import
|
|
34405
|
+
import chalk210 from "chalk";
|
|
34429
34406
|
function loadRavendb() {
|
|
34430
34407
|
const raw = loadGlobalConfigRaw();
|
|
34431
34408
|
const ravendb = raw.ravendb;
|
|
@@ -34439,7 +34416,7 @@ function resolveConnection(name) {
|
|
|
34439
34416
|
const connectionName = name ?? defaultConnection;
|
|
34440
34417
|
if (!connectionName) {
|
|
34441
34418
|
console.error(
|
|
34442
|
-
|
|
34419
|
+
chalk210.red(
|
|
34443
34420
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
34444
34421
|
)
|
|
34445
34422
|
);
|
|
@@ -34447,7 +34424,7 @@ function resolveConnection(name) {
|
|
|
34447
34424
|
}
|
|
34448
34425
|
const connection = connections.find((c) => c.name === connectionName);
|
|
34449
34426
|
if (!connection) {
|
|
34450
|
-
console.error(
|
|
34427
|
+
console.error(chalk210.red(`Connection "${connectionName}" not found.`));
|
|
34451
34428
|
console.error(
|
|
34452
34429
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
34453
34430
|
);
|
|
@@ -34478,15 +34455,15 @@ async function ravendbCollections(connectionName) {
|
|
|
34478
34455
|
return;
|
|
34479
34456
|
}
|
|
34480
34457
|
for (const c of collections) {
|
|
34481
|
-
console.log(`${
|
|
34458
|
+
console.log(`${chalk211.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
34482
34459
|
}
|
|
34483
34460
|
}
|
|
34484
34461
|
|
|
34485
34462
|
// src/commands/ravendb/ravendbQuery.ts
|
|
34486
|
-
import
|
|
34463
|
+
import chalk213 from "chalk";
|
|
34487
34464
|
|
|
34488
34465
|
// src/commands/ravendb/fetchAllPages.ts
|
|
34489
|
-
import
|
|
34466
|
+
import chalk212 from "chalk";
|
|
34490
34467
|
|
|
34491
34468
|
// src/commands/ravendb/buildQueryPath.ts
|
|
34492
34469
|
function buildQueryPath(opts) {
|
|
@@ -34524,7 +34501,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
34524
34501
|
allResults.push(...results);
|
|
34525
34502
|
start2 += results.length;
|
|
34526
34503
|
process.stderr.write(
|
|
34527
|
-
`\r${
|
|
34504
|
+
`\r${chalk212.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
34528
34505
|
);
|
|
34529
34506
|
if (start2 >= totalResults) break;
|
|
34530
34507
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -34539,7 +34516,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
34539
34516
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
34540
34517
|
const resolved = resolveArgs(connectionName, collection);
|
|
34541
34518
|
if (!resolved.collection && !options2.query) {
|
|
34542
|
-
console.error(
|
|
34519
|
+
console.error(chalk213.red("Provide a collection name or --query filter."));
|
|
34543
34520
|
process.exit(1);
|
|
34544
34521
|
}
|
|
34545
34522
|
const { collection: col } = resolved;
|
|
@@ -34574,7 +34551,7 @@ function registerRavendb(program) {
|
|
|
34574
34551
|
}
|
|
34575
34552
|
|
|
34576
34553
|
// src/commands/releases/releasesConfigure.ts
|
|
34577
|
-
import
|
|
34554
|
+
import chalk215 from "chalk";
|
|
34578
34555
|
|
|
34579
34556
|
// src/commands/config/parseRepoScopeFlag.ts
|
|
34580
34557
|
var REPO_SCOPE_FLAGS = {
|
|
@@ -34645,26 +34622,26 @@ function readStreamsInput(source) {
|
|
|
34645
34622
|
}
|
|
34646
34623
|
|
|
34647
34624
|
// src/commands/releases/reportDerivedStreams.ts
|
|
34648
|
-
import
|
|
34625
|
+
import chalk214 from "chalk";
|
|
34649
34626
|
function printDerived(stream) {
|
|
34650
34627
|
const environments = stream.nodes.flatMap((n) => n.environment ?? []);
|
|
34651
34628
|
const steps = stream.nodes.filter((n) => !n.environment);
|
|
34652
34629
|
console.log(
|
|
34653
|
-
`${
|
|
34630
|
+
`${chalk214.bold(stream.name)} ${chalk214.dim(`${stream.repo} \xB7 ${stream.workflow}`)}`
|
|
34654
34631
|
);
|
|
34655
34632
|
console.log(
|
|
34656
|
-
` environments: ${environments.join(", ") ||
|
|
34633
|
+
` environments: ${environments.join(", ") || chalk214.dim("none")}`
|
|
34657
34634
|
);
|
|
34658
34635
|
if (steps.length > 0)
|
|
34659
34636
|
console.log(
|
|
34660
34637
|
` steps: ${steps.map((n) => `${n.id} [${n.kind ?? "step"}]`).join(", ")}`
|
|
34661
34638
|
);
|
|
34662
34639
|
const edges = stream.edges.map(([from, to]) => `${from} \u2192 ${to}`);
|
|
34663
|
-
console.log(` edges: ${edges.join(", ") ||
|
|
34640
|
+
console.log(` edges: ${edges.join(", ") || chalk214.dim("none")}`);
|
|
34664
34641
|
}
|
|
34665
34642
|
function reportDerivedStreams(streams, target) {
|
|
34666
34643
|
for (const stream of streams) printDerived(stream);
|
|
34667
|
-
console.log(
|
|
34644
|
+
console.log(chalk214.dim(`Written to ${target}`));
|
|
34668
34645
|
}
|
|
34669
34646
|
|
|
34670
34647
|
// src/commands/releases/withCurrentRepo.ts
|
|
@@ -34754,9 +34731,9 @@ async function writeReleaseStreams(incoming, scope) {
|
|
|
34754
34731
|
}
|
|
34755
34732
|
|
|
34756
34733
|
// src/commands/releases/releasesConfigure.ts
|
|
34757
|
-
function
|
|
34758
|
-
console.error(
|
|
34759
|
-
for (const detail of details) console.error(
|
|
34734
|
+
function fail7(message3, details = []) {
|
|
34735
|
+
console.error(chalk215.red(message3));
|
|
34736
|
+
for (const detail of details) console.error(chalk215.red(` ${detail}`));
|
|
34760
34737
|
process.exitCode = 1;
|
|
34761
34738
|
}
|
|
34762
34739
|
function reportWritten(incoming, target) {
|
|
@@ -34769,19 +34746,19 @@ function reportWritten(incoming, target) {
|
|
|
34769
34746
|
}
|
|
34770
34747
|
async function releasesConfigure(options2 = {}) {
|
|
34771
34748
|
const scope = parseRepoScopeFlag(options2.scope ?? "git");
|
|
34772
|
-
if (!scope) return
|
|
34749
|
+
if (!scope) return fail7("--scope must be 'git' or 'db'");
|
|
34773
34750
|
const input = readStreamsInput(options2.streams ?? "-");
|
|
34774
|
-
if ("error" in input) return
|
|
34751
|
+
if ("error" in input) return fail7(`Could not read --streams: ${input.error}`);
|
|
34775
34752
|
const incoming = withCurrentRepo(input.streams);
|
|
34776
34753
|
const broken = checkStreamGraph(incoming);
|
|
34777
34754
|
if (broken.length > 0)
|
|
34778
|
-
return
|
|
34755
|
+
return fail7(
|
|
34779
34756
|
"The graph does not hold together, so nothing was written:",
|
|
34780
34757
|
broken
|
|
34781
34758
|
);
|
|
34782
34759
|
const written = await writeReleaseStreams(incoming, scope);
|
|
34783
34760
|
if (!written.ok)
|
|
34784
|
-
return
|
|
34761
|
+
return fail7(
|
|
34785
34762
|
"releases.streams does not validate, so nothing was written:",
|
|
34786
34763
|
written.errors
|
|
34787
34764
|
);
|
|
@@ -34789,23 +34766,23 @@ async function releasesConfigure(options2 = {}) {
|
|
|
34789
34766
|
}
|
|
34790
34767
|
|
|
34791
34768
|
// src/commands/releases/releasesList.ts
|
|
34792
|
-
import
|
|
34769
|
+
import chalk216 from "chalk";
|
|
34793
34770
|
function describeNode(node) {
|
|
34794
34771
|
if (node.environment) return `${node.id} \u2192 ${node.environment}`;
|
|
34795
34772
|
return `${node.id} (${node.kind ?? "step"})`;
|
|
34796
34773
|
}
|
|
34797
34774
|
function printStream(stream) {
|
|
34798
|
-
console.log(`${
|
|
34799
|
-
console.log(
|
|
34775
|
+
console.log(`${chalk216.bold(stream.name)} ${chalk216.dim(stream.repo)}`);
|
|
34776
|
+
console.log(chalk216.dim(` workflow: ${stream.workflow}`));
|
|
34800
34777
|
for (const node of stream.nodes) console.log(` ${describeNode(node)}`);
|
|
34801
34778
|
for (const [from, to] of stream.edges)
|
|
34802
|
-
console.log(
|
|
34779
|
+
console.log(chalk216.dim(` ${from} \u2192 ${to}`));
|
|
34803
34780
|
}
|
|
34804
34781
|
function releasesList() {
|
|
34805
34782
|
const streams = loadConfig().releases?.streams ?? [];
|
|
34806
34783
|
if (streams.length === 0) {
|
|
34807
34784
|
console.log(
|
|
34808
|
-
|
|
34785
|
+
chalk216.dim("No release streams configured under releases.streams.")
|
|
34809
34786
|
);
|
|
34810
34787
|
return;
|
|
34811
34788
|
}
|
|
@@ -34853,7 +34830,7 @@ function coverage() {
|
|
|
34853
34830
|
|
|
34854
34831
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
34855
34832
|
import path45 from "path";
|
|
34856
|
-
import
|
|
34833
|
+
import chalk218 from "chalk";
|
|
34857
34834
|
|
|
34858
34835
|
// src/commands/lint/lint/checkFileNames.ts
|
|
34859
34836
|
import fs23 from "fs";
|
|
@@ -34933,7 +34910,7 @@ function checkFileNames() {
|
|
|
34933
34910
|
}
|
|
34934
34911
|
|
|
34935
34912
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
34936
|
-
import
|
|
34913
|
+
import chalk217 from "chalk";
|
|
34937
34914
|
|
|
34938
34915
|
// src/commands/lint/lint/applyMoves.ts
|
|
34939
34916
|
import fs24 from "fs";
|
|
@@ -35018,25 +34995,25 @@ function fixFileNameViolations(moves) {
|
|
|
35018
34995
|
const start2 = performance.now();
|
|
35019
34996
|
const project = createLintProject();
|
|
35020
34997
|
const cwd = process.cwd();
|
|
35021
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
34998
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk217.green(line)));
|
|
35022
34999
|
const ms = (performance.now() - start2).toFixed(0);
|
|
35023
|
-
console.log(
|
|
35000
|
+
console.log(chalk217.dim(` Done in ${ms}ms`));
|
|
35024
35001
|
}
|
|
35025
35002
|
|
|
35026
35003
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
35027
35004
|
function reportViolations(violations) {
|
|
35028
|
-
console.error(
|
|
35005
|
+
console.error(chalk218.red("\nFile name check failed:\n"));
|
|
35029
35006
|
console.error(
|
|
35030
|
-
|
|
35007
|
+
chalk218.red(
|
|
35031
35008
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
35032
35009
|
)
|
|
35033
35010
|
);
|
|
35034
35011
|
for (const violation of violations) {
|
|
35035
|
-
console.error(
|
|
35036
|
-
console.error(
|
|
35012
|
+
console.error(chalk218.red(` ${violation.filePath}`));
|
|
35013
|
+
console.error(chalk218.gray(` Rename to: ${violation.suggestedName}
|
|
35037
35014
|
`));
|
|
35038
35015
|
}
|
|
35039
|
-
console.error(
|
|
35016
|
+
console.error(chalk218.dim(" Run with -f to auto-fix.\n"));
|
|
35040
35017
|
}
|
|
35041
35018
|
function runFileNameCheck(fix = false) {
|
|
35042
35019
|
const violations = checkFileNames();
|
|
@@ -35065,17 +35042,17 @@ function runFileNameCheck(fix = false) {
|
|
|
35065
35042
|
import fs26 from "fs";
|
|
35066
35043
|
|
|
35067
35044
|
// src/commands/lint/shared.ts
|
|
35068
|
-
import
|
|
35045
|
+
import chalk219 from "chalk";
|
|
35069
35046
|
function reportViolations2(violations, checkName2, errorMessage3, successMessage) {
|
|
35070
35047
|
if (violations.length > 0) {
|
|
35071
|
-
console.error(
|
|
35048
|
+
console.error(chalk219.red(`
|
|
35072
35049
|
${checkName2} failed:
|
|
35073
35050
|
`));
|
|
35074
|
-
console.error(
|
|
35051
|
+
console.error(chalk219.red(` ${errorMessage3}
|
|
35075
35052
|
`));
|
|
35076
35053
|
for (const violation of violations) {
|
|
35077
|
-
console.error(
|
|
35078
|
-
console.error(
|
|
35054
|
+
console.error(chalk219.red(` ${violation.filePath}:${violation.line}`));
|
|
35055
|
+
console.error(chalk219.gray(` ${violation.content}
|
|
35079
35056
|
`));
|
|
35080
35057
|
}
|
|
35081
35058
|
return false;
|
|
@@ -35300,7 +35277,7 @@ import { execSync as execSync51 } from "child_process";
|
|
|
35300
35277
|
import { existsSync as existsSync65, mkdirSync as mkdirSync24, unlinkSync as unlinkSync15, writeFileSync as writeFileSync39 } from "fs";
|
|
35301
35278
|
import { tmpdir as tmpdir7 } from "os";
|
|
35302
35279
|
import { join as join83, resolve as resolve25 } from "path";
|
|
35303
|
-
import
|
|
35280
|
+
import chalk220 from "chalk";
|
|
35304
35281
|
|
|
35305
35282
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
35306
35283
|
var captureWindowPs1 = `
|
|
@@ -35451,22 +35428,22 @@ function screenshot(processName) {
|
|
|
35451
35428
|
const config = loadConfig();
|
|
35452
35429
|
const outputDir = resolve25(config.screenshot.outputDir);
|
|
35453
35430
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
35454
|
-
console.log(
|
|
35431
|
+
console.log(chalk220.gray(`Capturing window for process "${processName}" ...`));
|
|
35455
35432
|
try {
|
|
35456
35433
|
runPowerShellScript(processName, outputPath);
|
|
35457
|
-
console.log(
|
|
35434
|
+
console.log(chalk220.green(`Screenshot saved: ${outputPath}`));
|
|
35458
35435
|
} catch (error) {
|
|
35459
35436
|
const msg = error instanceof Error ? error.message : String(error);
|
|
35460
|
-
console.error(
|
|
35437
|
+
console.error(chalk220.red(`Failed to capture screenshot: ${msg}`));
|
|
35461
35438
|
process.exit(1);
|
|
35462
35439
|
}
|
|
35463
35440
|
}
|
|
35464
35441
|
|
|
35465
35442
|
// src/commands/statusLine.ts
|
|
35466
|
-
import
|
|
35443
|
+
import chalk223 from "chalk";
|
|
35467
35444
|
|
|
35468
35445
|
// src/commands/buildLimitsSegment.ts
|
|
35469
|
-
import
|
|
35446
|
+
import chalk221 from "chalk";
|
|
35470
35447
|
|
|
35471
35448
|
// src/shared/rateLimitLevel.ts
|
|
35472
35449
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -35504,9 +35481,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
35504
35481
|
|
|
35505
35482
|
// src/commands/buildLimitsSegment.ts
|
|
35506
35483
|
var LEVEL_COLOR = {
|
|
35507
|
-
ok:
|
|
35508
|
-
warn:
|
|
35509
|
-
over:
|
|
35484
|
+
ok: chalk221.green,
|
|
35485
|
+
warn: chalk221.yellow,
|
|
35486
|
+
over: chalk221.red
|
|
35510
35487
|
};
|
|
35511
35488
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
35512
35489
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -35602,7 +35579,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
35602
35579
|
}
|
|
35603
35580
|
|
|
35604
35581
|
// src/commands/colorizePercent.ts
|
|
35605
|
-
import
|
|
35582
|
+
import chalk222 from "chalk";
|
|
35606
35583
|
|
|
35607
35584
|
// src/shared/contextLevel.ts
|
|
35608
35585
|
var THRESHOLDS = {
|
|
@@ -35622,16 +35599,16 @@ function colorizePercent(pct) {
|
|
|
35622
35599
|
const label = `${Math.round(pct)}%`;
|
|
35623
35600
|
switch (contextLevel(pct)) {
|
|
35624
35601
|
case "red":
|
|
35625
|
-
return
|
|
35602
|
+
return chalk222.red(label);
|
|
35626
35603
|
case "yellow":
|
|
35627
|
-
return
|
|
35604
|
+
return chalk222.yellow(label);
|
|
35628
35605
|
default:
|
|
35629
35606
|
return label;
|
|
35630
35607
|
}
|
|
35631
35608
|
}
|
|
35632
35609
|
|
|
35633
35610
|
// src/commands/statusLine.ts
|
|
35634
|
-
|
|
35611
|
+
chalk223.level = 3;
|
|
35635
35612
|
function formatNumber(num) {
|
|
35636
35613
|
return num.toLocaleString("en-US");
|
|
35637
35614
|
}
|
|
@@ -35643,7 +35620,7 @@ async function statusLine() {
|
|
|
35643
35620
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
35644
35621
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
35645
35622
|
const branch2 = dir ? readGitBranch(dir) : null;
|
|
35646
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
35623
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk223.cyan(branch2)} | ` : "";
|
|
35647
35624
|
const limitsSegment = process.env.ASSIST_SESSION === "1" ? "" : buildLimitsSegment(data.rate_limits);
|
|
35648
35625
|
console.log(
|
|
35649
35626
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${limitsSegment}`
|
|
@@ -35751,7 +35728,7 @@ import { spawn as spawn7 } from "child_process";
|
|
|
35751
35728
|
import * as path48 from "path";
|
|
35752
35729
|
|
|
35753
35730
|
// src/commands/refactor/logViolations.ts
|
|
35754
|
-
import
|
|
35731
|
+
import chalk224 from "chalk";
|
|
35755
35732
|
var DEFAULT_MAX_LINES2 = 100;
|
|
35756
35733
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
35757
35734
|
if (violations.length === 0) {
|
|
@@ -35760,43 +35737,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
35760
35737
|
}
|
|
35761
35738
|
return;
|
|
35762
35739
|
}
|
|
35763
|
-
console.error(
|
|
35740
|
+
console.error(chalk224.red(`
|
|
35764
35741
|
Refactor check failed:
|
|
35765
35742
|
`));
|
|
35766
|
-
console.error(
|
|
35743
|
+
console.error(chalk224.red(` The following files exceed ${maxLines} lines:
|
|
35767
35744
|
`));
|
|
35768
35745
|
for (const violation of violations) {
|
|
35769
|
-
console.error(
|
|
35746
|
+
console.error(chalk224.red(` ${violation.file} (${violation.lines} lines)`));
|
|
35770
35747
|
}
|
|
35771
35748
|
console.error(
|
|
35772
|
-
|
|
35749
|
+
chalk224.yellow(
|
|
35773
35750
|
`
|
|
35774
35751
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
35775
35752
|
way to refactor it, ignore it with:
|
|
35776
35753
|
`
|
|
35777
35754
|
)
|
|
35778
35755
|
);
|
|
35779
|
-
console.error(
|
|
35756
|
+
console.error(chalk224.gray(` assist refactor ignore <file>
|
|
35780
35757
|
`));
|
|
35781
35758
|
if (process.env.CLAUDECODE) {
|
|
35782
|
-
console.error(
|
|
35759
|
+
console.error(chalk224.cyan(`
|
|
35783
35760
|
## Extracting Code to New Files
|
|
35784
35761
|
`));
|
|
35785
35762
|
console.error(
|
|
35786
|
-
|
|
35763
|
+
chalk224.cyan(
|
|
35787
35764
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
35788
35765
|
`
|
|
35789
35766
|
)
|
|
35790
35767
|
);
|
|
35791
35768
|
console.error(
|
|
35792
|
-
|
|
35769
|
+
chalk224.cyan(
|
|
35793
35770
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
35794
35771
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
35795
35772
|
`
|
|
35796
35773
|
)
|
|
35797
35774
|
);
|
|
35798
35775
|
console.error(
|
|
35799
|
-
|
|
35776
|
+
chalk224.cyan(
|
|
35800
35777
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
35801
35778
|
domains, move it to a common/shared folder.
|
|
35802
35779
|
`
|
|
@@ -35952,7 +35929,7 @@ async function check(pattern2, options2) {
|
|
|
35952
35929
|
|
|
35953
35930
|
// src/commands/refactor/extract.ts
|
|
35954
35931
|
import path56 from "path";
|
|
35955
|
-
import
|
|
35932
|
+
import chalk227 from "chalk";
|
|
35956
35933
|
|
|
35957
35934
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
35958
35935
|
import { SyntaxKind as SyntaxKind8 } from "ts-morph";
|
|
@@ -36560,23 +36537,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
36560
36537
|
|
|
36561
36538
|
// src/commands/refactor/extract/displayPlan.ts
|
|
36562
36539
|
import path52 from "path";
|
|
36563
|
-
import
|
|
36540
|
+
import chalk225 from "chalk";
|
|
36564
36541
|
function section(title) {
|
|
36565
36542
|
return `
|
|
36566
|
-
${
|
|
36543
|
+
${chalk225.cyan(title)}`;
|
|
36567
36544
|
}
|
|
36568
36545
|
function displayImporters(plan2, cwd) {
|
|
36569
36546
|
if (plan2.importersToUpdate.length === 0) return;
|
|
36570
36547
|
console.log(section("Update importers:"));
|
|
36571
36548
|
for (const imp of plan2.importersToUpdate) {
|
|
36572
36549
|
const rel = path52.relative(cwd, imp.file.getFilePath());
|
|
36573
|
-
console.log(` ${
|
|
36550
|
+
console.log(` ${chalk225.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
36574
36551
|
}
|
|
36575
36552
|
}
|
|
36576
36553
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
36577
|
-
console.log(
|
|
36554
|
+
console.log(chalk225.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
36578
36555
|
`));
|
|
36579
|
-
console.log(` ${
|
|
36556
|
+
console.log(` ${chalk225.cyan("Functions to move:")}`);
|
|
36580
36557
|
for (const name of plan2.extractedNames) {
|
|
36581
36558
|
console.log(` ${name}`);
|
|
36582
36559
|
}
|
|
@@ -36610,7 +36587,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
36610
36587
|
|
|
36611
36588
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
36612
36589
|
import path55 from "path";
|
|
36613
|
-
import
|
|
36590
|
+
import chalk226 from "chalk";
|
|
36614
36591
|
import { Project as Project4 } from "ts-morph";
|
|
36615
36592
|
|
|
36616
36593
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -36702,7 +36679,7 @@ function loadProjectFile(file) {
|
|
|
36702
36679
|
});
|
|
36703
36680
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
36704
36681
|
if (!sourceFile) {
|
|
36705
|
-
console.log(
|
|
36682
|
+
console.log(chalk226.red(`File not found in project: ${file}`));
|
|
36706
36683
|
process.exit(1);
|
|
36707
36684
|
}
|
|
36708
36685
|
return { project, sourceFile };
|
|
@@ -36725,19 +36702,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
36725
36702
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
36726
36703
|
if (options2.apply) {
|
|
36727
36704
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
36728
|
-
console.log(
|
|
36705
|
+
console.log(chalk227.green("\nExtraction complete"));
|
|
36729
36706
|
} else {
|
|
36730
|
-
console.log(
|
|
36707
|
+
console.log(chalk227.dim("\nDry run. Use --apply to execute."));
|
|
36731
36708
|
}
|
|
36732
36709
|
}
|
|
36733
36710
|
|
|
36734
36711
|
// src/commands/refactor/ignore.ts
|
|
36735
36712
|
import fs33 from "fs";
|
|
36736
|
-
import
|
|
36713
|
+
import chalk228 from "chalk";
|
|
36737
36714
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
36738
36715
|
function ignore2(file) {
|
|
36739
36716
|
if (!fs33.existsSync(file)) {
|
|
36740
|
-
console.error(
|
|
36717
|
+
console.error(chalk228.red(`Error: File does not exist: ${file}`));
|
|
36741
36718
|
process.exit(1);
|
|
36742
36719
|
}
|
|
36743
36720
|
const content = fs33.readFileSync(file, "utf8");
|
|
@@ -36753,7 +36730,7 @@ function ignore2(file) {
|
|
|
36753
36730
|
fs33.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
36754
36731
|
}
|
|
36755
36732
|
console.log(
|
|
36756
|
-
|
|
36733
|
+
chalk228.green(
|
|
36757
36734
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
36758
36735
|
)
|
|
36759
36736
|
);
|
|
@@ -36762,12 +36739,12 @@ function ignore2(file) {
|
|
|
36762
36739
|
// src/commands/refactor/rename.ts
|
|
36763
36740
|
import fs36 from "fs";
|
|
36764
36741
|
import path62 from "path";
|
|
36765
|
-
import
|
|
36742
|
+
import chalk231 from "chalk";
|
|
36766
36743
|
|
|
36767
36744
|
// src/commands/refactor/rename/applyRename.ts
|
|
36768
36745
|
import fs35 from "fs";
|
|
36769
36746
|
import path58 from "path";
|
|
36770
|
-
import
|
|
36747
|
+
import chalk229 from "chalk";
|
|
36771
36748
|
|
|
36772
36749
|
// src/commands/refactor/restructure/computeRewrites.ts
|
|
36773
36750
|
import path57 from "path";
|
|
@@ -36873,13 +36850,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
36873
36850
|
const updatedContents = applyRewrites(rewrites);
|
|
36874
36851
|
for (const [file, content] of updatedContents) {
|
|
36875
36852
|
fs35.writeFileSync(file, content, "utf8");
|
|
36876
|
-
console.log(
|
|
36853
|
+
console.log(chalk229.cyan(` Updated imports in ${path58.relative(cwd, file)}`));
|
|
36877
36854
|
}
|
|
36878
36855
|
const destDir = path58.dirname(destPath);
|
|
36879
36856
|
if (!fs35.existsSync(destDir)) fs35.mkdirSync(destDir, { recursive: true });
|
|
36880
36857
|
fs35.renameSync(sourcePath, destPath);
|
|
36881
36858
|
console.log(
|
|
36882
|
-
|
|
36859
|
+
chalk229.white(
|
|
36883
36860
|
` Moved ${path58.relative(cwd, sourcePath)} \u2192 ${path58.relative(cwd, destPath)}`
|
|
36884
36861
|
)
|
|
36885
36862
|
);
|
|
@@ -37029,16 +37006,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
37029
37006
|
|
|
37030
37007
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
37031
37008
|
import path61 from "path";
|
|
37032
|
-
import
|
|
37009
|
+
import chalk230 from "chalk";
|
|
37033
37010
|
function printRenamePreview(rewrites, cwd) {
|
|
37034
37011
|
for (const rewrite of rewrites) {
|
|
37035
37012
|
console.log(
|
|
37036
|
-
|
|
37013
|
+
chalk230.dim(
|
|
37037
37014
|
` ${path61.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
37038
37015
|
)
|
|
37039
37016
|
);
|
|
37040
37017
|
}
|
|
37041
|
-
console.log(
|
|
37018
|
+
console.log(chalk230.dim("Dry run. Use --apply to execute."));
|
|
37042
37019
|
}
|
|
37043
37020
|
|
|
37044
37021
|
// src/commands/refactor/rename.ts
|
|
@@ -37049,20 +37026,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
37049
37026
|
const relSource = path62.relative(cwd, sourcePath);
|
|
37050
37027
|
const relDest = path62.relative(cwd, destPath);
|
|
37051
37028
|
if (!fs36.existsSync(sourcePath)) {
|
|
37052
|
-
console.log(
|
|
37029
|
+
console.log(chalk231.red(`File not found: ${source}`));
|
|
37053
37030
|
process.exit(1);
|
|
37054
37031
|
}
|
|
37055
37032
|
if (destPath !== sourcePath && fs36.existsSync(destPath)) {
|
|
37056
|
-
console.log(
|
|
37033
|
+
console.log(chalk231.red(`Destination already exists: ${destination}`));
|
|
37057
37034
|
process.exit(1);
|
|
37058
37035
|
}
|
|
37059
|
-
console.log(
|
|
37060
|
-
console.log(
|
|
37061
|
-
console.log(
|
|
37036
|
+
console.log(chalk231.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
37037
|
+
console.log(chalk231.dim("Loading project..."));
|
|
37038
|
+
console.log(chalk231.dim("Scanning imports across the project..."));
|
|
37062
37039
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
37063
37040
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
37064
37041
|
console.log(
|
|
37065
|
-
|
|
37042
|
+
chalk231.dim(
|
|
37066
37043
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
37067
37044
|
)
|
|
37068
37045
|
);
|
|
@@ -37071,11 +37048,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
37071
37048
|
return;
|
|
37072
37049
|
}
|
|
37073
37050
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
37074
|
-
console.log(
|
|
37051
|
+
console.log(chalk231.green("Done"));
|
|
37075
37052
|
}
|
|
37076
37053
|
|
|
37077
37054
|
// src/commands/refactor/renameSymbol.ts
|
|
37078
|
-
import
|
|
37055
|
+
import chalk232 from "chalk";
|
|
37079
37056
|
|
|
37080
37057
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
37081
37058
|
import { SyntaxKind as SyntaxKind19 } from "ts-morph";
|
|
@@ -37121,34 +37098,34 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
37121
37098
|
const { project, sourceFile } = loadProjectFile(file);
|
|
37122
37099
|
const symbol = findSymbol(sourceFile, oldName);
|
|
37123
37100
|
if (!symbol) {
|
|
37124
|
-
console.log(
|
|
37101
|
+
console.log(chalk232.red(`Symbol "${oldName}" not found in ${file}`));
|
|
37125
37102
|
process.exit(1);
|
|
37126
37103
|
}
|
|
37127
37104
|
const grouped = groupReferences(symbol, cwd);
|
|
37128
37105
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
37129
37106
|
console.log(
|
|
37130
|
-
|
|
37107
|
+
chalk232.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
37131
37108
|
`)
|
|
37132
37109
|
);
|
|
37133
37110
|
for (const [refFile, lines2] of grouped) {
|
|
37134
37111
|
console.log(
|
|
37135
|
-
` ${
|
|
37112
|
+
` ${chalk232.dim(refFile)}: lines ${chalk232.cyan(lines2.join(", "))}`
|
|
37136
37113
|
);
|
|
37137
37114
|
}
|
|
37138
37115
|
if (options2.apply) {
|
|
37139
37116
|
symbol.rename(newName);
|
|
37140
37117
|
await project.save();
|
|
37141
|
-
console.log(
|
|
37118
|
+
console.log(chalk232.green(`
|
|
37142
37119
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
37143
37120
|
} else {
|
|
37144
|
-
console.log(
|
|
37121
|
+
console.log(chalk232.dim("\nDry run. Use --apply to execute."));
|
|
37145
37122
|
}
|
|
37146
37123
|
}
|
|
37147
37124
|
|
|
37148
37125
|
// src/commands/refactor/restructure.ts
|
|
37149
37126
|
import fs38 from "fs";
|
|
37150
37127
|
import path83 from "path";
|
|
37151
|
-
import
|
|
37128
|
+
import chalk242 from "chalk";
|
|
37152
37129
|
|
|
37153
37130
|
// src/commands/refactor/restructure/buildPlan.ts
|
|
37154
37131
|
import path73 from "path";
|
|
@@ -37485,7 +37462,7 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
|
|
|
37485
37462
|
}
|
|
37486
37463
|
|
|
37487
37464
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
37488
|
-
import
|
|
37465
|
+
import chalk237 from "chalk";
|
|
37489
37466
|
|
|
37490
37467
|
// src/commands/refactor/restructure/applyCommand.ts
|
|
37491
37468
|
import path74 from "path";
|
|
@@ -37496,13 +37473,13 @@ function applyCommand(scopeRoot) {
|
|
|
37496
37473
|
|
|
37497
37474
|
// src/commands/refactor/restructure/displayDrift.ts
|
|
37498
37475
|
import path75 from "path";
|
|
37499
|
-
import
|
|
37476
|
+
import chalk233 from "chalk";
|
|
37500
37477
|
var shownMoves = 20;
|
|
37501
37478
|
function displayDrift(plan2, listMoves) {
|
|
37502
37479
|
const rel = (file) => path75.relative(process.cwd(), file);
|
|
37503
37480
|
if (plan2.moves.length > 0) {
|
|
37504
37481
|
console.log(
|
|
37505
|
-
|
|
37482
|
+
chalk233.red(
|
|
37506
37483
|
`${plan2.moves.length} file(s) drift from the plan${listMoves ? ":" : "."}`
|
|
37507
37484
|
)
|
|
37508
37485
|
);
|
|
@@ -37510,17 +37487,17 @@ function displayDrift(plan2, listMoves) {
|
|
|
37510
37487
|
for (const move2 of plan2.moves.slice(0, shownMoves))
|
|
37511
37488
|
console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
|
|
37512
37489
|
if (plan2.moves.length > shownMoves)
|
|
37513
|
-
console.log(
|
|
37490
|
+
console.log(chalk233.dim(` \u2026and ${plan2.moves.length - shownMoves} more`));
|
|
37514
37491
|
}
|
|
37515
37492
|
}
|
|
37516
|
-
for (const error of plan2.errors) console.log(
|
|
37493
|
+
for (const error of plan2.errors) console.log(chalk233.red(error));
|
|
37517
37494
|
}
|
|
37518
37495
|
|
|
37519
37496
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
37520
|
-
import
|
|
37497
|
+
import chalk236 from "chalk";
|
|
37521
37498
|
|
|
37522
37499
|
// src/commands/refactor/restructure/displayDeepChains.ts
|
|
37523
|
-
import
|
|
37500
|
+
import chalk234 from "chalk";
|
|
37524
37501
|
var shownChains = 10;
|
|
37525
37502
|
function formatChain(chain2) {
|
|
37526
37503
|
const folders = chain2.folders.map((f) => `${f.name} (${f.files})`).join(" > ");
|
|
@@ -37530,28 +37507,28 @@ function displayDeepChains(chains, maxDepth) {
|
|
|
37530
37507
|
if (chains.length === 0) return;
|
|
37531
37508
|
const tooDeep = chains.reduce((sum3, c) => sum3 + c.tooDeep, 0);
|
|
37532
37509
|
console.log(
|
|
37533
|
-
|
|
37510
|
+
chalk234.red(
|
|
37534
37511
|
`
|
|
37535
37512
|
Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
|
|
37536
37513
|
)
|
|
37537
37514
|
);
|
|
37538
37515
|
console.log(
|
|
37539
|
-
|
|
37516
|
+
chalk234.bold(
|
|
37540
37517
|
"Deep chains, as folder (files beneath), most files too deep first:"
|
|
37541
37518
|
)
|
|
37542
37519
|
);
|
|
37543
37520
|
for (const chain2 of chains.slice(0, shownChains))
|
|
37544
37521
|
console.log(formatChain(chain2));
|
|
37545
37522
|
if (chains.length > shownChains)
|
|
37546
|
-
console.log(
|
|
37523
|
+
console.log(chalk234.dim(` \u2026and ${chains.length - shownChains} more`));
|
|
37547
37524
|
}
|
|
37548
37525
|
|
|
37549
37526
|
// src/commands/refactor/restructure/displayLongPaths.ts
|
|
37550
|
-
import
|
|
37527
|
+
import chalk235 from "chalk";
|
|
37551
37528
|
function displayLongPaths(longPaths, maxPathLength) {
|
|
37552
37529
|
if (longPaths.length === 0) return;
|
|
37553
37530
|
console.log(
|
|
37554
|
-
|
|
37531
|
+
chalk235.red(
|
|
37555
37532
|
`
|
|
37556
37533
|
Plan exceeds restructure.maxPathLength ${maxPathLength}: ${longPaths.length} repo-relative path(s) longer.`
|
|
37557
37534
|
)
|
|
@@ -37579,7 +37556,7 @@ function displayLayoutLimits(limits, apply) {
|
|
|
37579
37556
|
displayDeepChains(limits.chains, limits.maxDepth);
|
|
37580
37557
|
displayLongPaths(limits.longPaths, limits.maxPathLength);
|
|
37581
37558
|
console.log("");
|
|
37582
|
-
for (const line of pinSteps(apply)) console.log(
|
|
37559
|
+
for (const line of pinSteps(apply)) console.log(chalk236.yellow(line));
|
|
37583
37560
|
}
|
|
37584
37561
|
|
|
37585
37562
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
@@ -37591,14 +37568,14 @@ function checkPlan(plan2, limits) {
|
|
|
37591
37568
|
if (exceeds || plan2.errors.length > 0) process.exit(1);
|
|
37592
37569
|
if (plan2.moves.length > 0) {
|
|
37593
37570
|
console.log(
|
|
37594
|
-
|
|
37571
|
+
chalk237.yellow(
|
|
37595
37572
|
`
|
|
37596
37573
|
Run \`${apply}\` to move the files and rewrite their imports.`
|
|
37597
37574
|
)
|
|
37598
37575
|
);
|
|
37599
37576
|
process.exit(1);
|
|
37600
37577
|
}
|
|
37601
|
-
console.log(
|
|
37578
|
+
console.log(chalk237.green("Layout matches the restructure plan"));
|
|
37602
37579
|
}
|
|
37603
37580
|
|
|
37604
37581
|
// src/commands/refactor/restructure/findDeepChains.ts
|
|
@@ -37668,15 +37645,15 @@ function partitionIgnored(files) {
|
|
|
37668
37645
|
}
|
|
37669
37646
|
|
|
37670
37647
|
// src/commands/refactor/restructure/runPlan.ts
|
|
37671
|
-
import
|
|
37648
|
+
import chalk241 from "chalk";
|
|
37672
37649
|
|
|
37673
37650
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
37674
|
-
import
|
|
37651
|
+
import chalk239 from "chalk";
|
|
37675
37652
|
|
|
37676
37653
|
// src/commands/refactor/restructure/executePlan.ts
|
|
37677
37654
|
import fs37 from "fs";
|
|
37678
37655
|
import path79 from "path";
|
|
37679
|
-
import
|
|
37656
|
+
import chalk238 from "chalk";
|
|
37680
37657
|
function relPath(file) {
|
|
37681
37658
|
return path79.relative(process.cwd(), file);
|
|
37682
37659
|
}
|
|
@@ -37693,14 +37670,14 @@ function moveFiles(moves) {
|
|
|
37693
37670
|
fs37.mkdirSync(path79.dirname(move2.to), { recursive: true });
|
|
37694
37671
|
fs37.renameSync(staging, move2.to);
|
|
37695
37672
|
console.log(
|
|
37696
|
-
|
|
37673
|
+
chalk238.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
|
|
37697
37674
|
);
|
|
37698
37675
|
}
|
|
37699
37676
|
}
|
|
37700
37677
|
function removeIfEmpty(dir) {
|
|
37701
37678
|
if (!fs37.existsSync(dir) || fs37.readdirSync(dir).length > 0) return false;
|
|
37702
37679
|
fs37.rmdirSync(dir);
|
|
37703
|
-
console.log(
|
|
37680
|
+
console.log(chalk238.dim(` Removed empty directory ${relPath(dir)}`));
|
|
37704
37681
|
return true;
|
|
37705
37682
|
}
|
|
37706
37683
|
function removeEmptyDirectories(dirs, scopeRoot) {
|
|
@@ -37713,7 +37690,7 @@ function removeEmptyDirectories(dirs, scopeRoot) {
|
|
|
37713
37690
|
function executePlan(plan2) {
|
|
37714
37691
|
for (const [file, content] of applyRewrites(plan2.rewrites)) {
|
|
37715
37692
|
fs37.writeFileSync(file, content, "utf8");
|
|
37716
|
-
console.log(
|
|
37693
|
+
console.log(chalk238.cyan(` Rewrote imports in ${relPath(file)}`));
|
|
37717
37694
|
}
|
|
37718
37695
|
moveFiles(plan2.moves);
|
|
37719
37696
|
removeEmptyDirectories(
|
|
@@ -37725,17 +37702,17 @@ function executePlan(plan2) {
|
|
|
37725
37702
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
37726
37703
|
function applyPlan(plan2) {
|
|
37727
37704
|
if (plan2.errors.length > 0) {
|
|
37728
|
-
console.log(
|
|
37705
|
+
console.log(chalk239.red("\nResolve the errors above before applying."));
|
|
37729
37706
|
process.exit(1);
|
|
37730
37707
|
}
|
|
37731
|
-
console.log(
|
|
37708
|
+
console.log(chalk239.bold("\nApplying changes..."));
|
|
37732
37709
|
executePlan(plan2);
|
|
37733
|
-
console.log(
|
|
37710
|
+
console.log(chalk239.green("\nRestructuring complete"));
|
|
37734
37711
|
}
|
|
37735
37712
|
|
|
37736
37713
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
37737
37714
|
import path82 from "path";
|
|
37738
|
-
import
|
|
37715
|
+
import chalk240 from "chalk";
|
|
37739
37716
|
|
|
37740
37717
|
// src/commands/refactor/restructure/computeDepthStats.ts
|
|
37741
37718
|
import path80 from "path";
|
|
@@ -37786,17 +37763,17 @@ function relPath2(filePath) {
|
|
|
37786
37763
|
}
|
|
37787
37764
|
function displayMoves(plan2) {
|
|
37788
37765
|
if (plan2.moves.length === 0) return;
|
|
37789
|
-
console.log(
|
|
37766
|
+
console.log(chalk240.bold("\nFile moves:"));
|
|
37790
37767
|
for (const move2 of plan2.moves) {
|
|
37791
37768
|
console.log(
|
|
37792
|
-
` ${
|
|
37769
|
+
` ${chalk240.red(relPath2(move2.from))} \u2192 ${chalk240.green(relPath2(move2.to))}`
|
|
37793
37770
|
);
|
|
37794
|
-
console.log(
|
|
37771
|
+
console.log(chalk240.dim(` ${move2.reason}`));
|
|
37795
37772
|
}
|
|
37796
37773
|
}
|
|
37797
37774
|
function displayTree(plan2) {
|
|
37798
37775
|
console.log(
|
|
37799
|
-
|
|
37776
|
+
chalk240.bold(`
|
|
37800
37777
|
Resulting tree (${relPath2(plan2.scopeRoot) || "."}/):`)
|
|
37801
37778
|
);
|
|
37802
37779
|
for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
|
|
@@ -37807,15 +37784,15 @@ function displayDepthStats(plan2) {
|
|
|
37807
37784
|
plan2.targets.values(),
|
|
37808
37785
|
plan2.scopeRoot
|
|
37809
37786
|
);
|
|
37810
|
-
console.log(
|
|
37787
|
+
console.log(chalk240.bold(`
|
|
37811
37788
|
Depth (max ${max}):`));
|
|
37812
37789
|
for (const depth of [...distribution.keys()].sort((a, b) => a - b))
|
|
37813
37790
|
console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
|
|
37814
37791
|
}
|
|
37815
37792
|
function displayErrors(errors) {
|
|
37816
37793
|
if (errors.length === 0) return;
|
|
37817
|
-
console.log(
|
|
37818
|
-
for (const error of errors) console.log(
|
|
37794
|
+
console.log(chalk240.red("\nErrors:"));
|
|
37795
|
+
for (const error of errors) console.log(chalk240.red(` ${error}`));
|
|
37819
37796
|
}
|
|
37820
37797
|
function displayPlan2(plan2) {
|
|
37821
37798
|
displayMoves(plan2);
|
|
@@ -37824,7 +37801,7 @@ function displayPlan2(plan2) {
|
|
|
37824
37801
|
displayErrors(plan2.errors);
|
|
37825
37802
|
const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
|
|
37826
37803
|
console.log(
|
|
37827
|
-
|
|
37804
|
+
chalk240.dim(
|
|
37828
37805
|
`
|
|
37829
37806
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
|
|
37830
37807
|
)
|
|
@@ -37836,11 +37813,11 @@ function runPlan(plan2, limits, apply) {
|
|
|
37836
37813
|
displayPlan2(plan2);
|
|
37837
37814
|
displayLayoutLimits(limits, applyCommand(plan2.scopeRoot));
|
|
37838
37815
|
if (plan2.moves.length === 0 && plan2.errors.length === 0) {
|
|
37839
|
-
console.log(
|
|
37816
|
+
console.log(chalk241.green("No restructuring needed"));
|
|
37840
37817
|
return;
|
|
37841
37818
|
}
|
|
37842
37819
|
if (!apply) {
|
|
37843
|
-
console.log(
|
|
37820
|
+
console.log(chalk241.dim("\nDry run. Use --apply to execute."));
|
|
37844
37821
|
return;
|
|
37845
37822
|
}
|
|
37846
37823
|
applyPlan(plan2);
|
|
@@ -37850,14 +37827,14 @@ function runPlan(plan2, limits, apply) {
|
|
|
37850
37827
|
async function restructure(root2, options2 = {}) {
|
|
37851
37828
|
const scopeRoot = path83.resolve(root2 ?? "src");
|
|
37852
37829
|
if (!fs38.existsSync(scopeRoot) || !fs38.statSync(scopeRoot).isDirectory()) {
|
|
37853
|
-
console.log(
|
|
37830
|
+
console.log(chalk242.red(`Not a directory: ${root2 ?? "src"}`));
|
|
37854
37831
|
process.exit(1);
|
|
37855
37832
|
}
|
|
37856
37833
|
const found = [];
|
|
37857
37834
|
walkSourceFiles(scopeRoot, found);
|
|
37858
37835
|
const { scoped, ignored } = partitionIgnored(found);
|
|
37859
37836
|
if (scoped.length === 0) {
|
|
37860
|
-
console.log(
|
|
37837
|
+
console.log(chalk242.yellow("No files found under root"));
|
|
37861
37838
|
return;
|
|
37862
37839
|
}
|
|
37863
37840
|
const {
|
|
@@ -37928,7 +37905,7 @@ async function checkoutPrSession(number, prompt = "") {
|
|
|
37928
37905
|
}
|
|
37929
37906
|
|
|
37930
37907
|
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
37931
|
-
import
|
|
37908
|
+
import chalk246 from "chalk";
|
|
37932
37909
|
|
|
37933
37910
|
// src/commands/config/promptConfigScope.ts
|
|
37934
37911
|
import Enquirer3 from "enquirer";
|
|
@@ -37954,7 +37931,7 @@ async function promptConfigScope() {
|
|
|
37954
37931
|
}
|
|
37955
37932
|
|
|
37956
37933
|
// src/commands/config/resolveConfigKeyAnswer.ts
|
|
37957
|
-
import
|
|
37934
|
+
import chalk243 from "chalk";
|
|
37958
37935
|
async function resolveConfigKeyAnswer(question, supplied) {
|
|
37959
37936
|
if (supplied !== void 0) return coerceSupplied(question.key, supplied);
|
|
37960
37937
|
for (; ; ) {
|
|
@@ -37962,7 +37939,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
|
|
|
37962
37939
|
if (answer === "") return void 0;
|
|
37963
37940
|
const coercion = coerceCliConfigValue(question.key, answer);
|
|
37964
37941
|
if (coercion.ok) return coercion.value;
|
|
37965
|
-
console.error(
|
|
37942
|
+
console.error(chalk243.red(coercion.error));
|
|
37966
37943
|
}
|
|
37967
37944
|
}
|
|
37968
37945
|
function coerceSupplied(key, supplied) {
|
|
@@ -38042,7 +38019,7 @@ function suggestGlobs(current, proposed) {
|
|
|
38042
38019
|
}
|
|
38043
38020
|
|
|
38044
38021
|
// src/commands/review/highLevel/parseConfigureAnswers.ts
|
|
38045
|
-
import
|
|
38022
|
+
import chalk244 from "chalk";
|
|
38046
38023
|
function parseConfigureAnswers(answers) {
|
|
38047
38024
|
const known = Object.values(highLevelConfigKeys);
|
|
38048
38025
|
const parsed = {};
|
|
@@ -38060,13 +38037,13 @@ function answersCoverEveryKey(answers) {
|
|
|
38060
38037
|
return Object.values(highLevelConfigKeys).every((key) => key in answers);
|
|
38061
38038
|
}
|
|
38062
38039
|
function exitWith(message3) {
|
|
38063
|
-
console.error(
|
|
38040
|
+
console.error(chalk244.red(`Error: ${message3}.`));
|
|
38064
38041
|
process.exit(1);
|
|
38065
38042
|
}
|
|
38066
38043
|
|
|
38067
38044
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
38068
38045
|
import { execFileSync as execFileSync27 } from "child_process";
|
|
38069
|
-
import
|
|
38046
|
+
import chalk245 from "chalk";
|
|
38070
38047
|
|
|
38071
38048
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
38072
38049
|
function buildGlobProposalPrompt(tree) {
|
|
@@ -38160,12 +38137,12 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
38160
38137
|
const tree = summariseRepoTree(cwd);
|
|
38161
38138
|
if (tree === "") return NOTHING_PROPOSED;
|
|
38162
38139
|
console.log(
|
|
38163
|
-
|
|
38140
|
+
chalk245.dim("Asking Claude to propose globs from the repo's own tree...")
|
|
38164
38141
|
);
|
|
38165
38142
|
const output = askClaude(buildGlobProposalPrompt(tree), cwd);
|
|
38166
38143
|
if (output === void 0) {
|
|
38167
38144
|
console.log(
|
|
38168
|
-
|
|
38145
|
+
chalk245.yellow(
|
|
38169
38146
|
"Claude proposed nothing; answer each key from its current value."
|
|
38170
38147
|
)
|
|
38171
38148
|
);
|
|
@@ -38225,14 +38202,14 @@ async function configureHighLevelReview(options2 = {}) {
|
|
|
38225
38202
|
function reportConfigured(result) {
|
|
38226
38203
|
for (const write of result.written)
|
|
38227
38204
|
console.log(
|
|
38228
|
-
|
|
38205
|
+
chalk246.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
|
|
38229
38206
|
);
|
|
38230
|
-
for (const key of result.skipped) console.log(
|
|
38231
|
-
console.log(
|
|
38207
|
+
for (const key of result.skipped) console.log(chalk246.dim(`Left ${key} unset`));
|
|
38208
|
+
console.log(chalk246.dim(`Written to ${result.target}`));
|
|
38232
38209
|
}
|
|
38233
38210
|
|
|
38234
38211
|
// src/commands/review/highLevel/announceSavedReview.ts
|
|
38235
|
-
import
|
|
38212
|
+
import chalk247 from "chalk";
|
|
38236
38213
|
function savedMessage(subject) {
|
|
38237
38214
|
const head = subject.headSha.slice(0, 7);
|
|
38238
38215
|
if (subject.draft)
|
|
@@ -38243,10 +38220,10 @@ function savedMessage(subject) {
|
|
|
38243
38220
|
}
|
|
38244
38221
|
function announceSavedReview(subject, force) {
|
|
38245
38222
|
const message3 = savedMessage(subject);
|
|
38246
|
-
if (message3) console.log(
|
|
38223
|
+
if (message3) console.log(chalk247.dim(message3));
|
|
38247
38224
|
else if (force)
|
|
38248
38225
|
console.log(
|
|
38249
|
-
|
|
38226
|
+
chalk247.dim(
|
|
38250
38227
|
`Discarding any review saved for ${subject.headSha.slice(0, 7)} and starting fresh (--force).`
|
|
38251
38228
|
)
|
|
38252
38229
|
);
|
|
@@ -39387,55 +39364,55 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
39387
39364
|
}
|
|
39388
39365
|
|
|
39389
39366
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
39390
|
-
import
|
|
39367
|
+
import chalk252 from "chalk";
|
|
39391
39368
|
|
|
39392
39369
|
// src/commands/review/highLevel/formatCriticalDiffs.ts
|
|
39393
|
-
import
|
|
39370
|
+
import chalk248 from "chalk";
|
|
39394
39371
|
var PATCH_LINE_COLOURS = {
|
|
39395
|
-
"+":
|
|
39396
|
-
"-":
|
|
39397
|
-
"@":
|
|
39372
|
+
"+": chalk248.green,
|
|
39373
|
+
"-": chalk248.red,
|
|
39374
|
+
"@": chalk248.cyan
|
|
39398
39375
|
};
|
|
39399
39376
|
function formatPatch(patch2) {
|
|
39400
39377
|
return patch2.split("\n").map(
|
|
39401
|
-
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ??
|
|
39378
|
+
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk248.dim)(line)}`
|
|
39402
39379
|
);
|
|
39403
39380
|
}
|
|
39404
39381
|
function formatDiff(diff3) {
|
|
39405
39382
|
return [
|
|
39406
39383
|
"",
|
|
39407
|
-
` ${
|
|
39408
|
-
...diff3.patch === null ? [` ${
|
|
39384
|
+
` ${chalk248.bold(diff3.path)} ${chalk248.dim(`(${diff3.status})`)} ${chalk248.green(`+${diff3.additions}`)} ${chalk248.red(`-${diff3.deletions}`)}`,
|
|
39385
|
+
...diff3.patch === null ? [` ${chalk248.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
|
|
39409
39386
|
];
|
|
39410
39387
|
}
|
|
39411
39388
|
function formatCriticalDiffs(diffs, criticalPaths) {
|
|
39412
39389
|
if (criticalPaths.length === 0)
|
|
39413
|
-
return `${
|
|
39414
|
-
${
|
|
39390
|
+
return `${chalk248.bold.underline("Critical diffs")}
|
|
39391
|
+
${chalk248.dim("review.highLevel.criticalPaths is empty, so no diffs are shown")}`;
|
|
39415
39392
|
if (diffs.length === 0)
|
|
39416
|
-
return `${
|
|
39417
|
-
${
|
|
39393
|
+
return `${chalk248.bold.underline("Critical diffs")}
|
|
39394
|
+
${chalk248.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
|
|
39418
39395
|
return [
|
|
39419
|
-
|
|
39396
|
+
chalk248.bold.underline("Critical diffs"),
|
|
39420
39397
|
...diffs.flatMap(formatDiff)
|
|
39421
39398
|
].join("\n");
|
|
39422
39399
|
}
|
|
39423
39400
|
|
|
39424
39401
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
39425
|
-
import
|
|
39402
|
+
import chalk249 from "chalk";
|
|
39426
39403
|
var MARKERS = {
|
|
39427
|
-
pass: () =>
|
|
39428
|
-
fail: () =>
|
|
39429
|
-
manual: () =>
|
|
39404
|
+
pass: () => chalk249.green("\u2714"),
|
|
39405
|
+
fail: () => chalk249.red("\u2718"),
|
|
39406
|
+
manual: () => chalk249.yellow("\u25A1")
|
|
39430
39407
|
};
|
|
39431
39408
|
function formatCheck(check2) {
|
|
39432
|
-
const title = check2.status === "fail" ?
|
|
39409
|
+
const title = check2.status === "fail" ? chalk249.red(check2.title) : chalk249.bold(check2.title);
|
|
39433
39410
|
return ` ${MARKERS[check2.status]()} ${title}
|
|
39434
|
-
${
|
|
39411
|
+
${chalk249.dim(check2.reason)}`;
|
|
39435
39412
|
}
|
|
39436
39413
|
function formatGroup(heading2, checks2) {
|
|
39437
39414
|
if (checks2.length === 0) return [];
|
|
39438
|
-
return ["",
|
|
39415
|
+
return ["", chalk249.bold.underline(heading2), ...checks2.map(formatCheck)];
|
|
39439
39416
|
}
|
|
39440
39417
|
function formatHighLevelChecklist(checks2) {
|
|
39441
39418
|
const deterministic = checks2.filter(
|
|
@@ -39444,7 +39421,7 @@ function formatHighLevelChecklist(checks2) {
|
|
|
39444
39421
|
const failed3 = deterministic.filter(
|
|
39445
39422
|
(check2) => check2.status === "fail"
|
|
39446
39423
|
).length;
|
|
39447
|
-
const summary = failed3 === 0 ?
|
|
39424
|
+
const summary = failed3 === 0 ? chalk249.green(`All ${deterministic.length} deterministic checks pass`) : chalk249.red(
|
|
39448
39425
|
`${failed3} of ${deterministic.length} deterministic checks fail`
|
|
39449
39426
|
);
|
|
39450
39427
|
return [
|
|
@@ -39459,37 +39436,37 @@ function formatHighLevelChecklist(checks2) {
|
|
|
39459
39436
|
}
|
|
39460
39437
|
|
|
39461
39438
|
// src/commands/review/highLevel/formatHighLevelStructure.ts
|
|
39462
|
-
import
|
|
39439
|
+
import chalk250 from "chalk";
|
|
39463
39440
|
var STATUS_MARKERS = {
|
|
39464
|
-
added: () =>
|
|
39465
|
-
removed: () =>
|
|
39466
|
-
modified: () =>
|
|
39441
|
+
added: () => chalk250.green("A"),
|
|
39442
|
+
removed: () => chalk250.red("D"),
|
|
39443
|
+
modified: () => chalk250.yellow("M")
|
|
39467
39444
|
};
|
|
39468
39445
|
function counts(additions, deletions) {
|
|
39469
|
-
return `${
|
|
39446
|
+
return `${chalk250.green(`+${additions}`)} ${chalk250.red(`-${deletions}`)}`;
|
|
39470
39447
|
}
|
|
39471
39448
|
function formatNode(node, indent4) {
|
|
39472
39449
|
if (node.kind === "file")
|
|
39473
39450
|
return [
|
|
39474
|
-
`${indent4}${STATUS_MARKERS[node.status]()} ${node.name} ${
|
|
39451
|
+
`${indent4}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk250.dim(counts(node.additions, node.deletions))}`
|
|
39475
39452
|
];
|
|
39476
39453
|
const dir = node;
|
|
39477
39454
|
return [
|
|
39478
|
-
`${indent4}${
|
|
39455
|
+
`${indent4}${chalk250.bold(`${dir.name}/`)} ${chalk250.dim(counts(dir.additions, dir.deletions))}`,
|
|
39479
39456
|
...dir.children.flatMap((child) => formatNode(child, `${indent4} `))
|
|
39480
39457
|
];
|
|
39481
39458
|
}
|
|
39482
39459
|
function formatHighLevelStructure(structure) {
|
|
39483
39460
|
const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
|
|
39484
39461
|
return [
|
|
39485
|
-
|
|
39462
|
+
chalk250.bold.underline("Structure"),
|
|
39486
39463
|
` ${summary}`,
|
|
39487
39464
|
...structure.tree.flatMap((node) => formatNode(node, " "))
|
|
39488
39465
|
].join("\n");
|
|
39489
39466
|
}
|
|
39490
39467
|
|
|
39491
39468
|
// src/commands/review/highLevel/formatHighLevelTests.ts
|
|
39492
|
-
import
|
|
39469
|
+
import chalk251 from "chalk";
|
|
39493
39470
|
function changeMarker(change) {
|
|
39494
39471
|
if (change === "added") return "A";
|
|
39495
39472
|
if (change === "modified") return "M";
|
|
@@ -39498,22 +39475,22 @@ function changeMarker(change) {
|
|
|
39498
39475
|
function formatNode2(node, depth) {
|
|
39499
39476
|
const indent4 = " ".repeat(depth + 2);
|
|
39500
39477
|
if (node.kind === "it")
|
|
39501
|
-
return [`${indent4}${
|
|
39478
|
+
return [`${indent4}${chalk251.dim(changeMarker(node.change))} ${node.name}`];
|
|
39502
39479
|
return [
|
|
39503
|
-
`${indent4}${
|
|
39480
|
+
`${indent4}${chalk251.bold(node.name)}`,
|
|
39504
39481
|
...node.children.flatMap((child) => formatNode2(child, depth + 1))
|
|
39505
39482
|
];
|
|
39506
39483
|
}
|
|
39507
39484
|
function formatHighLevelTests(files, testPaths) {
|
|
39508
|
-
const heading2 =
|
|
39485
|
+
const heading2 = chalk251.bold.underline("Changed tests");
|
|
39509
39486
|
if (files.length === 0)
|
|
39510
39487
|
return `${heading2}
|
|
39511
|
-
${
|
|
39488
|
+
${chalk251.dim(`no changed test in files matching ${testPaths.join(", ")}`)}`;
|
|
39512
39489
|
return [
|
|
39513
39490
|
heading2,
|
|
39514
39491
|
...files.flatMap((file) => [
|
|
39515
39492
|
"",
|
|
39516
|
-
` ${
|
|
39493
|
+
` ${chalk251.bold(file.path)} ${chalk251.dim(`(${file.status})`)}`,
|
|
39517
39494
|
...file.tests.flatMap((node) => formatNode2(node, 0))
|
|
39518
39495
|
])
|
|
39519
39496
|
].join("\n");
|
|
@@ -39527,10 +39504,10 @@ function highLevelChangedFileCount(structure) {
|
|
|
39527
39504
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
39528
39505
|
function printHighLevelChecklist(subject) {
|
|
39529
39506
|
console.log(
|
|
39530
|
-
|
|
39507
|
+
chalk252.bold(
|
|
39531
39508
|
`High-level review of ${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`
|
|
39532
39509
|
),
|
|
39533
|
-
|
|
39510
|
+
chalk252.dim(
|
|
39534
39511
|
`\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
|
|
39535
39512
|
)
|
|
39536
39513
|
);
|
|
@@ -39544,12 +39521,12 @@ function printHighLevelChecklist(subject) {
|
|
|
39544
39521
|
console.log("");
|
|
39545
39522
|
console.log(formatHighLevelTests(subject.tests, subject.testPaths));
|
|
39546
39523
|
console.log(
|
|
39547
|
-
|
|
39524
|
+
chalk252.dim(
|
|
39548
39525
|
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
39549
39526
|
)
|
|
39550
39527
|
);
|
|
39551
39528
|
console.log(
|
|
39552
|
-
|
|
39529
|
+
chalk252.dim(
|
|
39553
39530
|
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
39554
39531
|
)
|
|
39555
39532
|
);
|
|
@@ -39835,18 +39812,18 @@ function partitionFindingsByDiff(findings, index2) {
|
|
|
39835
39812
|
}
|
|
39836
39813
|
|
|
39837
39814
|
// src/commands/review/warnOutOfDiff.ts
|
|
39838
|
-
import
|
|
39815
|
+
import chalk253 from "chalk";
|
|
39839
39816
|
function warnOutOfDiff(outOfDiff) {
|
|
39840
39817
|
if (outOfDiff.length === 0) return;
|
|
39841
39818
|
console.warn(
|
|
39842
|
-
|
|
39819
|
+
chalk253.yellow(
|
|
39843
39820
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
39844
39821
|
)
|
|
39845
39822
|
);
|
|
39846
39823
|
for (const finding of outOfDiff) {
|
|
39847
39824
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
39848
39825
|
console.warn(
|
|
39849
|
-
` ${
|
|
39826
|
+
` ${chalk253.yellow("\xB7")} ${finding.title} ${chalk253.dim(
|
|
39850
39827
|
`(${finding.file}:${range})`
|
|
39851
39828
|
)}`
|
|
39852
39829
|
);
|
|
@@ -39873,18 +39850,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
39873
39850
|
}
|
|
39874
39851
|
|
|
39875
39852
|
// src/commands/review/warnUnlocated.ts
|
|
39876
|
-
import
|
|
39853
|
+
import chalk254 from "chalk";
|
|
39877
39854
|
function warnUnlocated(unlocated) {
|
|
39878
39855
|
if (unlocated.length === 0) return;
|
|
39879
39856
|
console.warn(
|
|
39880
|
-
|
|
39857
|
+
chalk254.yellow(
|
|
39881
39858
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
39882
39859
|
)
|
|
39883
39860
|
);
|
|
39884
39861
|
for (const finding of unlocated) {
|
|
39885
|
-
const where = finding.location ||
|
|
39862
|
+
const where = finding.location || chalk254.dim("missing");
|
|
39886
39863
|
console.warn(
|
|
39887
|
-
` ${
|
|
39864
|
+
` ${chalk254.yellow("\xB7")} ${finding.title} ${chalk254.dim(`(${where})`)}`
|
|
39888
39865
|
);
|
|
39889
39866
|
}
|
|
39890
39867
|
}
|
|
@@ -40247,8 +40224,8 @@ async function ensureCodexAvailable() {
|
|
|
40247
40224
|
|
|
40248
40225
|
// src/commands/review/planCodexReviewer.ts
|
|
40249
40226
|
async function planCodexReviewer(codexPath, slotAssigned) {
|
|
40250
|
-
const
|
|
40251
|
-
if (
|
|
40227
|
+
const cached2 = cachedReviewerResult("codex", codexPath);
|
|
40228
|
+
if (cached2) return { kind: "cached", cached: cached2 };
|
|
40252
40229
|
if (slotAssigned) return { kind: "run" };
|
|
40253
40230
|
const status2 = await ensureCodexAvailable();
|
|
40254
40231
|
if (status2 === "available") return { kind: "run" };
|
|
@@ -41061,10 +41038,10 @@ function printSummary2(synthesisPath) {
|
|
|
41061
41038
|
console.log("");
|
|
41062
41039
|
}
|
|
41063
41040
|
async function synthesise(paths, options2) {
|
|
41064
|
-
const
|
|
41065
|
-
if (
|
|
41041
|
+
const cached2 = cachedReviewerResult("synthesis", paths.synthesisPath);
|
|
41042
|
+
if (cached2) {
|
|
41066
41043
|
printSummary2(paths.synthesisPath);
|
|
41067
|
-
return
|
|
41044
|
+
return cached2;
|
|
41068
41045
|
}
|
|
41069
41046
|
const { multi, slot } = options2;
|
|
41070
41047
|
const override = slot?.override;
|
|
@@ -42029,7 +42006,7 @@ function registerReview(program) {
|
|
|
42029
42006
|
|
|
42030
42007
|
// src/commands/rules/indexRules.ts
|
|
42031
42008
|
import path87 from "path";
|
|
42032
|
-
import
|
|
42009
|
+
import chalk255 from "chalk";
|
|
42033
42010
|
|
|
42034
42011
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
42035
42012
|
import { existsSync as existsSync70, readFileSync as readFileSync55, writeFileSync as writeFileSync43 } from "fs";
|
|
@@ -42116,24 +42093,24 @@ function indexRules() {
|
|
|
42116
42093
|
const rootFile = path87.relative(process.cwd(), path87.join(root2, "CLAUDE.md"));
|
|
42117
42094
|
if (directories.length === 0) {
|
|
42118
42095
|
console.log(
|
|
42119
|
-
|
|
42096
|
+
chalk255.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
42120
42097
|
);
|
|
42121
42098
|
return;
|
|
42122
42099
|
}
|
|
42123
42100
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
42124
42101
|
for (const directory of directories)
|
|
42125
|
-
console.log(` ${
|
|
42102
|
+
console.log(` ${chalk255.cyan(directory)}`);
|
|
42126
42103
|
}
|
|
42127
42104
|
|
|
42128
42105
|
// src/commands/rules/listRules.ts
|
|
42129
42106
|
import path88 from "path";
|
|
42130
|
-
import
|
|
42107
|
+
import chalk256 from "chalk";
|
|
42131
42108
|
function listRules(target, options2 = {}) {
|
|
42132
42109
|
const resolved = path88.resolve(target ?? process.cwd());
|
|
42133
42110
|
const rules2 = readScopedRules(resolved);
|
|
42134
42111
|
if (rules2.length === 0) {
|
|
42135
42112
|
const label = path88.relative(process.cwd(), resolved) || ".";
|
|
42136
|
-
console.log(
|
|
42113
|
+
console.log(chalk256.gray(`No rules in scope for ${label}`));
|
|
42137
42114
|
return;
|
|
42138
42115
|
}
|
|
42139
42116
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -42143,21 +42120,21 @@ function listRules(target, options2 = {}) {
|
|
|
42143
42120
|
if (rule.source !== shown) {
|
|
42144
42121
|
shown = rule.source;
|
|
42145
42122
|
console.log(
|
|
42146
|
-
|
|
42123
|
+
chalk256.dim(base ? path88.relative(base, rule.source) : rule.source)
|
|
42147
42124
|
);
|
|
42148
42125
|
}
|
|
42149
42126
|
console.log(
|
|
42150
|
-
` ${
|
|
42127
|
+
` ${chalk256.cyan(rule.code.padEnd(width2))} ${rule.title ?? rule.text}`
|
|
42151
42128
|
);
|
|
42152
42129
|
if (options2.full && rule.title)
|
|
42153
|
-
console.log(` ${" ".repeat(width2)} ${
|
|
42130
|
+
console.log(` ${" ".repeat(width2)} ${chalk256.dim(rule.text)}`);
|
|
42154
42131
|
}
|
|
42155
42132
|
}
|
|
42156
42133
|
|
|
42157
42134
|
// src/commands/rules/addRule.ts
|
|
42158
42135
|
import { existsSync as existsSync72, readFileSync as readFileSync57, writeFileSync as writeFileSync44 } from "fs";
|
|
42159
42136
|
import path90 from "path";
|
|
42160
|
-
import
|
|
42137
|
+
import chalk257 from "chalk";
|
|
42161
42138
|
|
|
42162
42139
|
// src/commands/rules/insertRuleBullet.ts
|
|
42163
42140
|
function ruleBullet({ code, title, text: text18 }) {
|
|
@@ -42216,7 +42193,7 @@ function read2(file) {
|
|
|
42216
42193
|
function addRule(text18, options2) {
|
|
42217
42194
|
const rule = text18.trim();
|
|
42218
42195
|
if (rule === "") {
|
|
42219
|
-
console.error(
|
|
42196
|
+
console.error(chalk257.red("Rule text is required"));
|
|
42220
42197
|
process.exitCode = 1;
|
|
42221
42198
|
return;
|
|
42222
42199
|
}
|
|
@@ -42234,14 +42211,14 @@ function addRule(text18, options2) {
|
|
|
42234
42211
|
);
|
|
42235
42212
|
updateScopedRulesIndex(root2);
|
|
42236
42213
|
console.log(
|
|
42237
|
-
`Added ${
|
|
42214
|
+
`Added ${chalk257.cyan(code)} to ${path90.relative(process.cwd(), target) || target}`
|
|
42238
42215
|
);
|
|
42239
42216
|
}
|
|
42240
42217
|
|
|
42241
42218
|
// src/commands/rules/addUserRule.ts
|
|
42242
|
-
import
|
|
42243
|
-
function
|
|
42244
|
-
console.error(
|
|
42219
|
+
import chalk258 from "chalk";
|
|
42220
|
+
function fail8(message3) {
|
|
42221
|
+
console.error(chalk258.red(message3));
|
|
42245
42222
|
process.exitCode = 1;
|
|
42246
42223
|
}
|
|
42247
42224
|
function asRules(value) {
|
|
@@ -42259,8 +42236,8 @@ async function addToUserDb(rule) {
|
|
|
42259
42236
|
...asRules(current),
|
|
42260
42237
|
rule
|
|
42261
42238
|
]);
|
|
42262
|
-
if (!result.ok) return
|
|
42263
|
-
console.log(`Added ${
|
|
42239
|
+
if (!result.ok) return fail8(result.errors.join("\n"));
|
|
42240
|
+
console.log(`Added ${chalk258.cyan(rule.title)} to advice.rules in user (db)`);
|
|
42264
42241
|
}
|
|
42265
42242
|
function addToUserNode(rule, globalConfigPath) {
|
|
42266
42243
|
const advice = loadGlobalConfigRaw(globalConfigPath).advice;
|
|
@@ -42271,17 +42248,17 @@ function addToUserNode(rule, globalConfigPath) {
|
|
|
42271
42248
|
process.cwd(),
|
|
42272
42249
|
globalConfigPath
|
|
42273
42250
|
);
|
|
42274
|
-
if (!result.ok) return
|
|
42251
|
+
if (!result.ok) return fail8(result.errors.join("\n"));
|
|
42275
42252
|
console.log(
|
|
42276
|
-
`Added ${
|
|
42253
|
+
`Added ${chalk258.cyan(rule.title)} to advice.rules in user (node) (${globalConfigFileLabel(globalConfigPath)})`
|
|
42277
42254
|
);
|
|
42278
42255
|
}
|
|
42279
42256
|
async function addUserRule(text18, options2, globalConfigPath = getGlobalConfigPath()) {
|
|
42280
42257
|
const error = optionsError(options2);
|
|
42281
|
-
if (error) return
|
|
42258
|
+
if (error) return fail8(error);
|
|
42282
42259
|
const rule = { title: options2.title?.trim() ?? "", text: text18.trim() };
|
|
42283
42260
|
if (rule.text === "" || rule.title === "")
|
|
42284
|
-
return
|
|
42261
|
+
return fail8("User rules need both rule text and --title");
|
|
42285
42262
|
if (options2.user) return addToUserDb(rule);
|
|
42286
42263
|
addToUserNode(rule, globalConfigPath);
|
|
42287
42264
|
}
|
|
@@ -42328,7 +42305,7 @@ function registerRules(program) {
|
|
|
42328
42305
|
}
|
|
42329
42306
|
|
|
42330
42307
|
// src/commands/seq/seqAuth.ts
|
|
42331
|
-
import
|
|
42308
|
+
import chalk260 from "chalk";
|
|
42332
42309
|
|
|
42333
42310
|
// src/commands/seq/loadConnections.ts
|
|
42334
42311
|
function loadConnections2() {
|
|
@@ -42357,10 +42334,10 @@ function setDefaultConnection(name) {
|
|
|
42357
42334
|
}
|
|
42358
42335
|
|
|
42359
42336
|
// src/shared/assertUniqueName.ts
|
|
42360
|
-
import
|
|
42337
|
+
import chalk259 from "chalk";
|
|
42361
42338
|
function assertUniqueName(existingNames, name) {
|
|
42362
42339
|
if (existingNames.includes(name)) {
|
|
42363
|
-
console.error(
|
|
42340
|
+
console.error(chalk259.red(`Connection "${name}" already exists.`));
|
|
42364
42341
|
process.exit(1);
|
|
42365
42342
|
}
|
|
42366
42343
|
}
|
|
@@ -42378,16 +42355,16 @@ async function promptConnection2(existingNames) {
|
|
|
42378
42355
|
var seqAuth = createConnectionAuth({
|
|
42379
42356
|
load: loadConnections2,
|
|
42380
42357
|
save: saveConnections2,
|
|
42381
|
-
format: (c) => `${
|
|
42358
|
+
format: (c) => `${chalk260.bold(c.name)} ${c.url}`,
|
|
42382
42359
|
promptNew: promptConnection2,
|
|
42383
42360
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
42384
42361
|
});
|
|
42385
42362
|
|
|
42386
42363
|
// src/commands/seq/seqQuery.ts
|
|
42387
|
-
import
|
|
42364
|
+
import chalk264 from "chalk";
|
|
42388
42365
|
|
|
42389
42366
|
// src/commands/seq/fetchSeq.ts
|
|
42390
|
-
import
|
|
42367
|
+
import chalk261 from "chalk";
|
|
42391
42368
|
async function fetchSeq(conn, path109, params) {
|
|
42392
42369
|
const url = `${conn.url}${path109}?${params}`;
|
|
42393
42370
|
const response = await fetch(url, {
|
|
@@ -42398,7 +42375,7 @@ async function fetchSeq(conn, path109, params) {
|
|
|
42398
42375
|
});
|
|
42399
42376
|
if (!response.ok) {
|
|
42400
42377
|
const body = await response.text();
|
|
42401
|
-
console.error(
|
|
42378
|
+
console.error(chalk261.red(`Seq returned ${response.status}: ${body}`));
|
|
42402
42379
|
process.exit(1);
|
|
42403
42380
|
}
|
|
42404
42381
|
return response;
|
|
@@ -42457,23 +42434,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
42457
42434
|
}
|
|
42458
42435
|
|
|
42459
42436
|
// src/commands/seq/formatEvent.ts
|
|
42460
|
-
import
|
|
42437
|
+
import chalk262 from "chalk";
|
|
42461
42438
|
function levelColor(level) {
|
|
42462
42439
|
switch (level) {
|
|
42463
42440
|
case "Fatal":
|
|
42464
|
-
return
|
|
42441
|
+
return chalk262.bgRed.white;
|
|
42465
42442
|
case "Error":
|
|
42466
|
-
return
|
|
42443
|
+
return chalk262.red;
|
|
42467
42444
|
case "Warning":
|
|
42468
|
-
return
|
|
42445
|
+
return chalk262.yellow;
|
|
42469
42446
|
case "Information":
|
|
42470
|
-
return
|
|
42447
|
+
return chalk262.cyan;
|
|
42471
42448
|
case "Debug":
|
|
42472
|
-
return
|
|
42449
|
+
return chalk262.gray;
|
|
42473
42450
|
case "Verbose":
|
|
42474
|
-
return
|
|
42451
|
+
return chalk262.dim;
|
|
42475
42452
|
default:
|
|
42476
|
-
return
|
|
42453
|
+
return chalk262.white;
|
|
42477
42454
|
}
|
|
42478
42455
|
}
|
|
42479
42456
|
function levelAbbrev(level) {
|
|
@@ -42514,12 +42491,12 @@ function formatTimestamp(iso) {
|
|
|
42514
42491
|
function formatEvent(event) {
|
|
42515
42492
|
const color = levelColor(event.Level);
|
|
42516
42493
|
const abbrev = levelAbbrev(event.Level);
|
|
42517
|
-
const ts10 =
|
|
42494
|
+
const ts10 = chalk262.dim(formatTimestamp(event.Timestamp));
|
|
42518
42495
|
const msg = renderMessage(event);
|
|
42519
42496
|
const lines2 = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
|
|
42520
42497
|
if (event.Exception) {
|
|
42521
42498
|
for (const line of event.Exception.split("\n")) {
|
|
42522
|
-
lines2.push(
|
|
42499
|
+
lines2.push(chalk262.red(` ${line}`));
|
|
42523
42500
|
}
|
|
42524
42501
|
}
|
|
42525
42502
|
return lines2.join("\n");
|
|
@@ -42552,11 +42529,11 @@ function rejectTimestampFilter(filter) {
|
|
|
42552
42529
|
}
|
|
42553
42530
|
|
|
42554
42531
|
// src/shared/resolveNamedConnection.ts
|
|
42555
|
-
import
|
|
42532
|
+
import chalk263 from "chalk";
|
|
42556
42533
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
42557
42534
|
if (connections.length === 0) {
|
|
42558
42535
|
console.error(
|
|
42559
|
-
|
|
42536
|
+
chalk263.red(
|
|
42560
42537
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
42561
42538
|
)
|
|
42562
42539
|
);
|
|
@@ -42565,7 +42542,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
42565
42542
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
42566
42543
|
const connection = connections.find((c) => c.name === target);
|
|
42567
42544
|
if (!connection) {
|
|
42568
|
-
console.error(
|
|
42545
|
+
console.error(chalk263.red(`${kind} connection "${target}" not found.`));
|
|
42569
42546
|
process.exit(1);
|
|
42570
42547
|
}
|
|
42571
42548
|
return connection;
|
|
@@ -42594,7 +42571,7 @@ async function seqQuery(filter, options2) {
|
|
|
42594
42571
|
new URLSearchParams({ filter, count: String(count10) })
|
|
42595
42572
|
);
|
|
42596
42573
|
if (events.length === 0) {
|
|
42597
|
-
console.log(
|
|
42574
|
+
console.log(chalk264.yellow("No events found."));
|
|
42598
42575
|
return;
|
|
42599
42576
|
}
|
|
42600
42577
|
if (options2.json) {
|
|
@@ -42605,11 +42582,11 @@ async function seqQuery(filter, options2) {
|
|
|
42605
42582
|
for (const event of chronological) {
|
|
42606
42583
|
console.log(formatEvent(event));
|
|
42607
42584
|
}
|
|
42608
|
-
console.log(
|
|
42585
|
+
console.log(chalk264.dim(`
|
|
42609
42586
|
${events.length} events`));
|
|
42610
42587
|
if (events.length >= count10) {
|
|
42611
42588
|
console.log(
|
|
42612
|
-
|
|
42589
|
+
chalk264.yellow(
|
|
42613
42590
|
`Results limited to ${count10}. Use --count to retrieve more.`
|
|
42614
42591
|
)
|
|
42615
42592
|
);
|
|
@@ -42617,10 +42594,10 @@ ${events.length} events`));
|
|
|
42617
42594
|
}
|
|
42618
42595
|
|
|
42619
42596
|
// src/shared/setNamedDefaultConnection.ts
|
|
42620
|
-
import
|
|
42597
|
+
import chalk265 from "chalk";
|
|
42621
42598
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
42622
42599
|
if (!connections.find((c) => c.name === name)) {
|
|
42623
|
-
console.error(
|
|
42600
|
+
console.error(chalk265.red(`Connection "${name}" not found.`));
|
|
42624
42601
|
process.exit(1);
|
|
42625
42602
|
}
|
|
42626
42603
|
setDefault(name);
|
|
@@ -42922,7 +42899,7 @@ function registerSlack(program) {
|
|
|
42922
42899
|
}
|
|
42923
42900
|
|
|
42924
42901
|
// src/commands/sql/sqlAuth.ts
|
|
42925
|
-
import
|
|
42902
|
+
import chalk267 from "chalk";
|
|
42926
42903
|
|
|
42927
42904
|
// src/commands/sql/loadConnections.ts
|
|
42928
42905
|
function loadConnections3() {
|
|
@@ -42951,7 +42928,7 @@ function setDefaultConnection2(name) {
|
|
|
42951
42928
|
}
|
|
42952
42929
|
|
|
42953
42930
|
// src/commands/sql/promptConnection.ts
|
|
42954
|
-
import
|
|
42931
|
+
import chalk266 from "chalk";
|
|
42955
42932
|
async function promptConnection3(existingNames) {
|
|
42956
42933
|
const name = await promptInput("name", "Connection name:", "default");
|
|
42957
42934
|
assertUniqueName(existingNames, name);
|
|
@@ -42959,7 +42936,7 @@ async function promptConnection3(existingNames) {
|
|
|
42959
42936
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
42960
42937
|
const port = Number.parseInt(portStr, 10);
|
|
42961
42938
|
if (!Number.isFinite(port)) {
|
|
42962
|
-
console.error(
|
|
42939
|
+
console.error(chalk266.red(`Invalid port "${portStr}".`));
|
|
42963
42940
|
process.exit(1);
|
|
42964
42941
|
}
|
|
42965
42942
|
const user = await promptInput("user", "User:");
|
|
@@ -42972,13 +42949,13 @@ async function promptConnection3(existingNames) {
|
|
|
42972
42949
|
var sqlAuth = createConnectionAuth({
|
|
42973
42950
|
load: loadConnections3,
|
|
42974
42951
|
save: saveConnections3,
|
|
42975
|
-
format: (c) => `${
|
|
42952
|
+
format: (c) => `${chalk267.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
42976
42953
|
promptNew: promptConnection3,
|
|
42977
42954
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
42978
42955
|
});
|
|
42979
42956
|
|
|
42980
42957
|
// src/commands/sql/printTable.ts
|
|
42981
|
-
import
|
|
42958
|
+
import chalk268 from "chalk";
|
|
42982
42959
|
function formatCell(value) {
|
|
42983
42960
|
if (value === null || value === void 0) return "";
|
|
42984
42961
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -42987,7 +42964,7 @@ function formatCell(value) {
|
|
|
42987
42964
|
}
|
|
42988
42965
|
function printTable(rows) {
|
|
42989
42966
|
if (rows.length === 0) {
|
|
42990
|
-
console.log(
|
|
42967
|
+
console.log(chalk268.yellow("(no rows)"));
|
|
42991
42968
|
return;
|
|
42992
42969
|
}
|
|
42993
42970
|
const columns = Object.keys(rows[0]);
|
|
@@ -42995,13 +42972,13 @@ function printTable(rows) {
|
|
|
42995
42972
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
42996
42973
|
);
|
|
42997
42974
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
42998
|
-
console.log(
|
|
42999
|
-
console.log(
|
|
42975
|
+
console.log(chalk268.dim(header));
|
|
42976
|
+
console.log(chalk268.dim("-".repeat(header.length)));
|
|
43000
42977
|
for (const row3 of rows) {
|
|
43001
42978
|
const line = columns.map((c, i) => formatCell(row3[c]).padEnd(widths[i])).join(" ");
|
|
43002
42979
|
console.log(line);
|
|
43003
42980
|
}
|
|
43004
|
-
console.log(
|
|
42981
|
+
console.log(chalk268.dim(`
|
|
43005
42982
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
43006
42983
|
}
|
|
43007
42984
|
|
|
@@ -43061,7 +43038,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
43061
43038
|
}
|
|
43062
43039
|
|
|
43063
43040
|
// src/commands/sql/sqlMutate.ts
|
|
43064
|
-
import
|
|
43041
|
+
import chalk269 from "chalk";
|
|
43065
43042
|
|
|
43066
43043
|
// src/commands/sql/isMutation.ts
|
|
43067
43044
|
var MUTATION_KEYWORDS = [
|
|
@@ -43095,7 +43072,7 @@ function isMutation(sql30) {
|
|
|
43095
43072
|
async function sqlMutate(query, connectionName) {
|
|
43096
43073
|
if (!isMutation(query)) {
|
|
43097
43074
|
console.error(
|
|
43098
|
-
|
|
43075
|
+
chalk269.red(
|
|
43099
43076
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
43100
43077
|
)
|
|
43101
43078
|
);
|
|
@@ -43105,18 +43082,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
43105
43082
|
const pool = await sqlConnect(conn);
|
|
43106
43083
|
try {
|
|
43107
43084
|
const result = await pool.request().query(query);
|
|
43108
|
-
console.log(
|
|
43085
|
+
console.log(chalk269.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
43109
43086
|
} finally {
|
|
43110
43087
|
await pool.close();
|
|
43111
43088
|
}
|
|
43112
43089
|
}
|
|
43113
43090
|
|
|
43114
43091
|
// src/commands/sql/sqlQuery.ts
|
|
43115
|
-
import
|
|
43092
|
+
import chalk270 from "chalk";
|
|
43116
43093
|
async function sqlQuery(query, connectionName) {
|
|
43117
43094
|
if (isMutation(query)) {
|
|
43118
43095
|
console.error(
|
|
43119
|
-
|
|
43096
|
+
chalk270.red(
|
|
43120
43097
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
43121
43098
|
)
|
|
43122
43099
|
);
|
|
@@ -43131,7 +43108,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
43131
43108
|
printTable(rows);
|
|
43132
43109
|
} else {
|
|
43133
43110
|
console.log(
|
|
43134
|
-
|
|
43111
|
+
chalk270.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
43135
43112
|
);
|
|
43136
43113
|
}
|
|
43137
43114
|
} finally {
|
|
@@ -43546,7 +43523,7 @@ function syncPi(claudeDir, options2) {
|
|
|
43546
43523
|
// src/commands/sync/syncSettings.ts
|
|
43547
43524
|
import * as fs47 from "fs";
|
|
43548
43525
|
import * as path101 from "path";
|
|
43549
|
-
import
|
|
43526
|
+
import chalk271 from "chalk";
|
|
43550
43527
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
43551
43528
|
const source = path101.join(claudeDir, "settings.json");
|
|
43552
43529
|
const target = path101.join(targetBase, "settings.json");
|
|
@@ -43565,7 +43542,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
43565
43542
|
if (mergedContent !== normalizedTarget) {
|
|
43566
43543
|
if (!options2?.yes) {
|
|
43567
43544
|
console.log(
|
|
43568
|
-
|
|
43545
|
+
chalk271.yellow(
|
|
43569
43546
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
43570
43547
|
)
|
|
43571
43548
|
);
|
|
@@ -43573,7 +43550,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
43573
43550
|
printDiff(targetContent, mergedContent);
|
|
43574
43551
|
printAutoConfirmHint();
|
|
43575
43552
|
const confirm = await promptConfirm(
|
|
43576
|
-
|
|
43553
|
+
chalk271.red("Overwrite existing settings.json?"),
|
|
43577
43554
|
false
|
|
43578
43555
|
);
|
|
43579
43556
|
if (!confirm) {
|
|
@@ -46121,7 +46098,7 @@ function parseEnvPairs(pairs) {
|
|
|
46121
46098
|
}
|
|
46122
46099
|
|
|
46123
46100
|
// src/commands/run/parseParamSpecs.ts
|
|
46124
|
-
function
|
|
46101
|
+
function fail9(spec) {
|
|
46125
46102
|
console.error(
|
|
46126
46103
|
`--param must be <name>, <name>! or <name>=<default>, got "${spec}"`
|
|
46127
46104
|
);
|
|
@@ -46131,14 +46108,14 @@ function parseParamSpec(spec) {
|
|
|
46131
46108
|
const eq52 = spec.indexOf("=");
|
|
46132
46109
|
const name = eq52 === -1 ? spec : spec.slice(0, eq52);
|
|
46133
46110
|
if (eq52 !== -1) {
|
|
46134
|
-
if (eq52 === 0 || name.endsWith("!"))
|
|
46111
|
+
if (eq52 === 0 || name.endsWith("!")) fail9(spec);
|
|
46135
46112
|
return { name, default: spec.slice(eq52 + 1) };
|
|
46136
46113
|
}
|
|
46137
46114
|
if (name.endsWith("!")) {
|
|
46138
|
-
if (name.length === 1)
|
|
46115
|
+
if (name.length === 1) fail9(spec);
|
|
46139
46116
|
return { name: name.slice(0, -1), required: true };
|
|
46140
46117
|
}
|
|
46141
|
-
if (name.length === 0)
|
|
46118
|
+
if (name.length === 0) fail9(spec);
|
|
46142
46119
|
return { name };
|
|
46143
46120
|
}
|
|
46144
46121
|
function parseParamSpecs(specs) {
|
|
@@ -46415,18 +46392,18 @@ function registerRun(program) {
|
|
|
46415
46392
|
}
|
|
46416
46393
|
|
|
46417
46394
|
// src/commands/sessions/nodes/formatLink.ts
|
|
46418
|
-
import
|
|
46395
|
+
import chalk272 from "chalk";
|
|
46419
46396
|
var STATE_COLOURS = {
|
|
46420
|
-
connected:
|
|
46421
|
-
connecting:
|
|
46422
|
-
disconnected:
|
|
46423
|
-
"version-blocked":
|
|
46397
|
+
connected: chalk272.green,
|
|
46398
|
+
connecting: chalk272.yellow,
|
|
46399
|
+
disconnected: chalk272.red,
|
|
46400
|
+
"version-blocked": chalk272.red
|
|
46424
46401
|
};
|
|
46425
46402
|
function formatLink(link3) {
|
|
46426
|
-
const colour = STATE_COLOURS[link3.state] ??
|
|
46403
|
+
const colour = STATE_COLOURS[link3.state] ?? chalk272.white;
|
|
46427
46404
|
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
46428
46405
|
const error = link3.error ? `
|
|
46429
|
-
${
|
|
46406
|
+
${chalk272.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
46430
46407
|
return ` ${link3.name} ${colour(link3.state)} ${link3.url}${peer}${error}`;
|
|
46431
46408
|
}
|
|
46432
46409
|
|
|
@@ -52185,8 +52162,8 @@ async function discoverSessions() {
|
|
|
52185
52162
|
function withRepoGroups(sessions) {
|
|
52186
52163
|
const existence = /* @__PURE__ */ new Map();
|
|
52187
52164
|
const exists = (dir) => {
|
|
52188
|
-
const
|
|
52189
|
-
if (
|
|
52165
|
+
const cached2 = existence.get(dir);
|
|
52166
|
+
if (cached2 !== void 0) return cached2;
|
|
52190
52167
|
const result = repoDirExists(dir);
|
|
52191
52168
|
existence.set(dir, result);
|
|
52192
52169
|
return result;
|
|
@@ -54434,7 +54411,7 @@ async function closeSession() {
|
|
|
54434
54411
|
}
|
|
54435
54412
|
|
|
54436
54413
|
// src/commands/sessions/nodes/listNodes.ts
|
|
54437
|
-
import
|
|
54414
|
+
import chalk273 from "chalk";
|
|
54438
54415
|
async function nodesReport() {
|
|
54439
54416
|
const live = await queryNodes();
|
|
54440
54417
|
if (live)
|
|
@@ -54451,10 +54428,10 @@ async function listNodes(options2) {
|
|
|
54451
54428
|
console.log(JSON.stringify(report, null, 2));
|
|
54452
54429
|
return;
|
|
54453
54430
|
}
|
|
54454
|
-
console.log(`${report.local} ${
|
|
54431
|
+
console.log(`${report.local} ${chalk273.dim("(this node)")}`);
|
|
54455
54432
|
if (!report.daemonRunning)
|
|
54456
|
-
console.log(
|
|
54457
|
-
if (report.links.length === 0) console.log(
|
|
54433
|
+
console.log(chalk273.dim(" daemon not running; showing configured links"));
|
|
54434
|
+
if (report.links.length === 0) console.log(chalk273.dim(" no links"));
|
|
54458
54435
|
for (const link3 of report.links) console.log(formatLink(link3));
|
|
54459
54436
|
}
|
|
54460
54437
|
|
|
@@ -54476,7 +54453,7 @@ async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
|
54476
54453
|
}
|
|
54477
54454
|
|
|
54478
54455
|
// src/commands/sessions/nodes/printReport.ts
|
|
54479
|
-
import
|
|
54456
|
+
import chalk274 from "chalk";
|
|
54480
54457
|
function printReport(report) {
|
|
54481
54458
|
if (report.links.length === 0) {
|
|
54482
54459
|
console.log(`${report.local} has no links`);
|
|
@@ -54490,11 +54467,11 @@ function printReport(report) {
|
|
|
54490
54467
|
for (const diagnosis of report.links) printDiagnosis(diagnosis);
|
|
54491
54468
|
}
|
|
54492
54469
|
function printDiagnosis(diagnosis) {
|
|
54493
|
-
console.log(`${
|
|
54470
|
+
console.log(`${chalk274.bold(diagnosis.name)} ${chalk274.dim(diagnosis.url)}`);
|
|
54494
54471
|
for (const hop of diagnosis.hops) {
|
|
54495
|
-
const mark = hop.ok ?
|
|
54472
|
+
const mark = hop.ok ? chalk274.green("\u2713") : chalk274.red("\u2717");
|
|
54496
54473
|
console.log(` ${mark} ${hop.hop.padEnd(9)} ${hop.detail ?? hop.error}`);
|
|
54497
|
-
if (hop.remediation) console.log(` ${
|
|
54474
|
+
if (hop.remediation) console.log(` ${chalk274.yellow(hop.remediation)}`);
|
|
54498
54475
|
}
|
|
54499
54476
|
}
|
|
54500
54477
|
|
|
@@ -54566,14 +54543,14 @@ function registerDiagnoseCommands(nodes, calledBy4) {
|
|
|
54566
54543
|
}
|
|
54567
54544
|
|
|
54568
54545
|
// src/commands/sessions/nodes/linkNode.ts
|
|
54569
|
-
import
|
|
54546
|
+
import chalk277 from "chalk";
|
|
54570
54547
|
|
|
54571
54548
|
// src/commands/sessions/nodes/notifyDaemonLinks.ts
|
|
54572
|
-
import
|
|
54549
|
+
import chalk275 from "chalk";
|
|
54573
54550
|
async function notifyDaemonLinks() {
|
|
54574
54551
|
if (!await isDaemonRunning()) {
|
|
54575
54552
|
console.log(
|
|
54576
|
-
|
|
54553
|
+
chalk275.yellow(
|
|
54577
54554
|
"The sessions daemon is not running; it loads the links when it starts."
|
|
54578
54555
|
)
|
|
54579
54556
|
);
|
|
@@ -54581,11 +54558,11 @@ async function notifyDaemonLinks() {
|
|
|
54581
54558
|
}
|
|
54582
54559
|
try {
|
|
54583
54560
|
await sendToDaemonAwaitAck({ type: "reload-links" });
|
|
54584
|
-
console.log(
|
|
54561
|
+
console.log(chalk275.dim("The sessions daemon reloaded its links."));
|
|
54585
54562
|
} catch (error) {
|
|
54586
54563
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
54587
54564
|
console.log(
|
|
54588
|
-
|
|
54565
|
+
chalk275.yellow(
|
|
54589
54566
|
`Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
|
|
54590
54567
|
)
|
|
54591
54568
|
);
|
|
@@ -54593,7 +54570,7 @@ async function notifyDaemonLinks() {
|
|
|
54593
54570
|
}
|
|
54594
54571
|
|
|
54595
54572
|
// src/commands/sessions/nodes/readLinks.ts
|
|
54596
|
-
import
|
|
54573
|
+
import chalk276 from "chalk";
|
|
54597
54574
|
|
|
54598
54575
|
// src/commands/sessions/nodes/writeLinks.ts
|
|
54599
54576
|
async function writeLinks(links2) {
|
|
@@ -54616,7 +54593,7 @@ async function readLinks() {
|
|
|
54616
54593
|
await writeLinks(links2);
|
|
54617
54594
|
const dropped = stored.filter((link3) => !link3.url).map((link3) => link3.name);
|
|
54618
54595
|
console.log(
|
|
54619
|
-
|
|
54596
|
+
chalk276.yellow(`Removed ${dropped.join(", ")}: ${SSH_LINK_RETIRED}`)
|
|
54620
54597
|
);
|
|
54621
54598
|
return links2;
|
|
54622
54599
|
}
|
|
@@ -54672,7 +54649,7 @@ async function linkNode(name, url, options2) {
|
|
|
54672
54649
|
throw new Error(`${name} is this node; link to a different node`);
|
|
54673
54650
|
const link3 = await buildLink(name, url, options2);
|
|
54674
54651
|
await writeLinks([...others, link3]);
|
|
54675
|
-
console.log(
|
|
54652
|
+
console.log(chalk277.green(`Linked ${name} (${link3.url})`));
|
|
54676
54653
|
await notifyDaemonLinks();
|
|
54677
54654
|
}
|
|
54678
54655
|
|
|
@@ -54693,14 +54670,14 @@ async function linkStatus(name, query = queryNodes) {
|
|
|
54693
54670
|
return (await query())?.links.find((l) => l.name === name);
|
|
54694
54671
|
}
|
|
54695
54672
|
async function awaitLinkReturn(name, options2, deps2 = {}) {
|
|
54696
|
-
const { query = queryNodes, sleep:
|
|
54673
|
+
const { query = queryNodes, sleep: sleep2 = wait, now = Date.now } = deps2;
|
|
54697
54674
|
const deadline = now() + options2.timeoutMs;
|
|
54698
54675
|
let sawDown = options2.sawDown;
|
|
54699
54676
|
while (now() < deadline) {
|
|
54700
54677
|
const link3 = await linkStatus(name, query);
|
|
54701
54678
|
if (link3?.state !== "connected") sawDown = true;
|
|
54702
54679
|
else if (sawDown) return link3;
|
|
54703
|
-
await
|
|
54680
|
+
await sleep2(POLL_MS5);
|
|
54704
54681
|
}
|
|
54705
54682
|
return void 0;
|
|
54706
54683
|
}
|
|
@@ -54737,14 +54714,14 @@ function startPeerAction(name, action) {
|
|
|
54737
54714
|
const line = `nodes ${action} ${name} trace=${traceId}`;
|
|
54738
54715
|
console.log(line);
|
|
54739
54716
|
appendDaemonLog(line);
|
|
54740
|
-
const
|
|
54717
|
+
const fail11 = async (summary, error) => new Error(await describeFailure(name, summary, error));
|
|
54741
54718
|
return {
|
|
54742
54719
|
spec,
|
|
54743
54720
|
traceId,
|
|
54744
|
-
fail:
|
|
54721
|
+
fail: fail11,
|
|
54745
54722
|
async awaitReturn(sawDown, timeoutMs = RETURN_TIMEOUT_MS) {
|
|
54746
54723
|
const link3 = await awaitLinkReturn(name, { sawDown, timeoutMs });
|
|
54747
|
-
if (!link3) throw await
|
|
54724
|
+
if (!link3) throw await fail11(`${name} did not come back`);
|
|
54748
54725
|
return link3;
|
|
54749
54726
|
}
|
|
54750
54727
|
};
|
|
@@ -54855,16 +54832,16 @@ function registerPeerActionCommands(nodes, calledBy4) {
|
|
|
54855
54832
|
}
|
|
54856
54833
|
|
|
54857
54834
|
// src/commands/sessions/nodes/unlinkNode.ts
|
|
54858
|
-
import
|
|
54835
|
+
import chalk278 from "chalk";
|
|
54859
54836
|
async function unlinkNode(name) {
|
|
54860
54837
|
const links2 = await readLinks();
|
|
54861
54838
|
const remaining = links2.filter((link3) => link3.name !== name);
|
|
54862
54839
|
if (remaining.length === links2.length) {
|
|
54863
|
-
console.log(
|
|
54840
|
+
console.log(chalk278.yellow(`No link named ${name}`));
|
|
54864
54841
|
return;
|
|
54865
54842
|
}
|
|
54866
54843
|
await writeLinks(remaining);
|
|
54867
|
-
console.log(
|
|
54844
|
+
console.log(chalk278.green(`Unlinked ${name}`));
|
|
54868
54845
|
await notifyDaemonLinks();
|
|
54869
54846
|
}
|
|
54870
54847
|
|
|
@@ -54938,17 +54915,17 @@ function resolveTarget3(sessionId, server) {
|
|
|
54938
54915
|
async function sessionOutput(sessionId, options2) {
|
|
54939
54916
|
const count10 = Number.parseInt(options2.lines, 10);
|
|
54940
54917
|
if (!Number.isInteger(count10) || count10 < 1)
|
|
54941
|
-
return
|
|
54918
|
+
return fail10(`-n must be a positive integer, got ${options2.lines}`);
|
|
54942
54919
|
const target = resolveTarget3(sessionId, options2.server);
|
|
54943
|
-
if (typeof target === "string") return
|
|
54920
|
+
if (typeof target === "string") return fail10(target);
|
|
54944
54921
|
try {
|
|
54945
54922
|
const scrollback = await requestSessionOutput(target);
|
|
54946
54923
|
for (const line of lastLines(scrollback, count10)) console.log(line);
|
|
54947
54924
|
} catch (error) {
|
|
54948
|
-
|
|
54925
|
+
fail10(error instanceof Error ? error.message : String(error));
|
|
54949
54926
|
}
|
|
54950
54927
|
}
|
|
54951
|
-
function
|
|
54928
|
+
function fail10(message3) {
|
|
54952
54929
|
console.error(message3);
|
|
54953
54930
|
process.exitCode = 1;
|
|
54954
54931
|
}
|
|
@@ -55101,10 +55078,10 @@ function createProgram() {
|
|
|
55101
55078
|
}
|
|
55102
55079
|
|
|
55103
55080
|
// src/reportCliError.ts
|
|
55104
|
-
import
|
|
55081
|
+
import chalk279 from "chalk";
|
|
55105
55082
|
function reportCliError(error) {
|
|
55106
55083
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError || error instanceof MissingDatabaseUrlError) {
|
|
55107
|
-
console.error(
|
|
55084
|
+
console.error(chalk279.red(error.message));
|
|
55108
55085
|
} else {
|
|
55109
55086
|
console.error(error);
|
|
55110
55087
|
}
|