@staff0rd/assist 0.908.4 → 0.909.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/README.md +4 -1
- package/allowed.cli-reads +1 -1
- package/claude/skills/review-ci/scripts/review.mjs +1 -1
- package/dist/allowed.cli-reads +1 -1
- package/dist/commands/sessions/web/bundle.js +396 -396
- package/dist/index.js +734 -593
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.909.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -1287,7 +1287,8 @@ var assistConfigShape = {
|
|
|
1287
1287
|
extracts: z5.record(z5.string(), miroExtractSchema).optional()
|
|
1288
1288
|
}).optional(),
|
|
1289
1289
|
news: z5.strictObject({
|
|
1290
|
-
showInNav: z5.boolean().default(false)
|
|
1290
|
+
showInNav: z5.boolean().default(false),
|
|
1291
|
+
feeds: z5.array(z5.string()).optional()
|
|
1291
1292
|
}).optional(),
|
|
1292
1293
|
next: z5.strictObject({
|
|
1293
1294
|
peers: z5.array(z5.string()).optional(),
|
|
@@ -4770,12 +4771,12 @@ async function untrackedFileDiff(cwd, path108) {
|
|
|
4770
4771
|
});
|
|
4771
4772
|
}
|
|
4772
4773
|
async function untrackedDiff(cwd) {
|
|
4773
|
-
const
|
|
4774
|
+
const list6 = await execGit(cwd, [
|
|
4774
4775
|
"ls-files",
|
|
4775
4776
|
"--others",
|
|
4776
4777
|
"--exclude-standard"
|
|
4777
4778
|
]);
|
|
4778
|
-
const paths =
|
|
4779
|
+
const paths = list6.split("\n").filter(Boolean);
|
|
4779
4780
|
const diffs = await Promise.all(
|
|
4780
4781
|
paths.map((path108) => untrackedFileDiff(cwd, path108))
|
|
4781
4782
|
);
|
|
@@ -5968,6 +5969,11 @@ var newsConfigHelp = [
|
|
|
5968
5969
|
key: "news.showInNav",
|
|
5969
5970
|
setter: "assist config set news.showInNav true",
|
|
5970
5971
|
note: "show the News tab in the web UI top nav (default false); /news stays reachable by URL either way"
|
|
5972
|
+
},
|
|
5973
|
+
{
|
|
5974
|
+
key: "news.feeds",
|
|
5975
|
+
setter: "assist config set news.feeds <url1>,<url2>",
|
|
5976
|
+
note: "RSS feed URLs shown on the News page; stored in the database so every machine shares them (assist news add/list/remove edit the same list)"
|
|
5971
5977
|
}
|
|
5972
5978
|
];
|
|
5973
5979
|
|
|
@@ -6985,12 +6991,12 @@ function parseDiffNameStatus(output) {
|
|
|
6985
6991
|
|
|
6986
6992
|
// src/commands/sessions/web/groupedCounts.ts
|
|
6987
6993
|
async function untrackedPaths(cwd) {
|
|
6988
|
-
const
|
|
6994
|
+
const list6 = await execGit(cwd, [
|
|
6989
6995
|
"ls-files",
|
|
6990
6996
|
"--others",
|
|
6991
6997
|
"--exclude-standard"
|
|
6992
6998
|
]);
|
|
6993
|
-
return
|
|
6999
|
+
return list6.split("\n").filter(Boolean);
|
|
6994
7000
|
}
|
|
6995
7001
|
async function groupedCounts(cwd, groups) {
|
|
6996
7002
|
const outputs = await Promise.all(
|
|
@@ -19890,9 +19896,9 @@ function parsePerms(entries) {
|
|
|
19890
19896
|
const tool = m[1];
|
|
19891
19897
|
const command = normCmd(m[2]);
|
|
19892
19898
|
const wildcard = m[3] !== void 0;
|
|
19893
|
-
const
|
|
19894
|
-
|
|
19895
|
-
map.set(tool,
|
|
19899
|
+
const list6 = map.get(tool) ?? [];
|
|
19900
|
+
list6.push({ command, wildcard });
|
|
19901
|
+
map.set(tool, list6);
|
|
19896
19902
|
}
|
|
19897
19903
|
}
|
|
19898
19904
|
return map;
|
|
@@ -22058,9 +22064,63 @@ function registerComplexity(program) {
|
|
|
22058
22064
|
// src/commands/configList.ts
|
|
22059
22065
|
import chalk126 from "chalk";
|
|
22060
22066
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
22061
|
-
|
|
22067
|
+
|
|
22068
|
+
// src/commands/backlog/replaceFeeds.ts
|
|
22069
|
+
async function replaceFeeds(db, urls) {
|
|
22070
|
+
const unique = [...new Set(urls)];
|
|
22071
|
+
await db.transaction(async (tx) => {
|
|
22072
|
+
await tx.delete(feeds);
|
|
22073
|
+
if (unique.length > 0)
|
|
22074
|
+
await tx.insert(feeds).values(unique.map((url) => ({ url })));
|
|
22075
|
+
});
|
|
22076
|
+
}
|
|
22077
|
+
|
|
22078
|
+
// src/commands/config/dbBackedConfigKeys.ts
|
|
22079
|
+
var newsFeeds = {
|
|
22080
|
+
read: async (db) => {
|
|
22081
|
+
const urls = await listFeeds(db);
|
|
22082
|
+
return urls.length > 0 ? urls : void 0;
|
|
22083
|
+
},
|
|
22084
|
+
write: (db, value) => replaceFeeds(db, value),
|
|
22085
|
+
unset: async (db) => {
|
|
22086
|
+
const had = (await listFeeds(db)).length > 0;
|
|
22087
|
+
await replaceFeeds(db, []);
|
|
22088
|
+
return had;
|
|
22089
|
+
}
|
|
22090
|
+
};
|
|
22091
|
+
var dbBackedConfigKeys = {
|
|
22092
|
+
"news.feeds": newsFeeds
|
|
22093
|
+
};
|
|
22094
|
+
function isDbBackedConfigKey(key) {
|
|
22095
|
+
return Object.hasOwn(dbBackedConfigKeys, key);
|
|
22096
|
+
}
|
|
22097
|
+
function dbBackedRepoError(key) {
|
|
22098
|
+
return `"${key}" is stored in the database and shared by every repo; drop --repo`;
|
|
22099
|
+
}
|
|
22100
|
+
|
|
22101
|
+
// src/commands/config/withDbBackedConfigValues.ts
|
|
22102
|
+
function covers(scope, key) {
|
|
22103
|
+
return scope === void 0 || scope === key || key.startsWith(`${scope}.`) || scope.startsWith(`${key}.`);
|
|
22104
|
+
}
|
|
22105
|
+
function dbBackedKeysIn(scope) {
|
|
22106
|
+
if (!process.env.ASSIST_DATABASE_URL && !loadConfig().database.url) return [];
|
|
22107
|
+
return Object.keys(dbBackedConfigKeys).filter((key) => covers(scope, key));
|
|
22108
|
+
}
|
|
22109
|
+
async function withDbBackedConfigValues(config, keys) {
|
|
22110
|
+
if (keys.length === 0) return config;
|
|
22111
|
+
const db = await getDb();
|
|
22112
|
+
let merged = config;
|
|
22113
|
+
for (const key of keys) {
|
|
22114
|
+
const value = await dbBackedConfigKeys[key].read(db);
|
|
22115
|
+
if (value !== void 0) merged = setNestedValue(merged, key, value);
|
|
22116
|
+
}
|
|
22117
|
+
return merged;
|
|
22118
|
+
}
|
|
22119
|
+
|
|
22120
|
+
// src/commands/configList.ts
|
|
22121
|
+
async function configList() {
|
|
22062
22122
|
const config = maskConfigSecrets(
|
|
22063
|
-
loadConfig(),
|
|
22123
|
+
await withDbBackedConfigValues(loadConfig(), dbBackedKeysIn()),
|
|
22064
22124
|
describeConfigNode(assistConfigSchema)
|
|
22065
22125
|
);
|
|
22066
22126
|
console.log(
|
|
@@ -22088,10 +22148,15 @@ function maskConfigKeySecrets(key, value) {
|
|
|
22088
22148
|
|
|
22089
22149
|
// src/commands/config/configGet.ts
|
|
22090
22150
|
function configGet(key, options2 = {}) {
|
|
22091
|
-
const
|
|
22092
|
-
|
|
22093
|
-
|
|
22151
|
+
const config = loadConfig();
|
|
22152
|
+
const dbKeys = dbBackedKeysIn(key);
|
|
22153
|
+
if (dbKeys.length === 0) return printValue(config, key, options2);
|
|
22154
|
+
return withDbBackedConfigValues(config, dbKeys).then(
|
|
22155
|
+
(merged) => printValue(merged, key, options2)
|
|
22094
22156
|
);
|
|
22157
|
+
}
|
|
22158
|
+
function printValue(config, key, options2) {
|
|
22159
|
+
const value = requireNestedValue(config, key);
|
|
22095
22160
|
console.log(
|
|
22096
22161
|
formatOutput(options2.reveal ? value : maskConfigKeySecrets(key, value))
|
|
22097
22162
|
);
|
|
@@ -22286,7 +22351,7 @@ function typeText(leaf) {
|
|
|
22286
22351
|
}
|
|
22287
22352
|
|
|
22288
22353
|
// src/commands/config/configSet.ts
|
|
22289
|
-
import
|
|
22354
|
+
import chalk134 from "chalk";
|
|
22290
22355
|
|
|
22291
22356
|
// src/commands/config/coerceCliConfigValue.ts
|
|
22292
22357
|
function coerceCliConfigValue(key, raw) {
|
|
@@ -22317,39 +22382,57 @@ function resolveRepoTarget(key, value, repo) {
|
|
|
22317
22382
|
return { key, value, useRepo: repo === true, repoName: void 0 };
|
|
22318
22383
|
}
|
|
22319
22384
|
|
|
22385
|
+
// src/commands/config/setDbBackedConfigKey.ts
|
|
22386
|
+
import chalk132 from "chalk";
|
|
22387
|
+
async function setDbBackedConfigKey(key, value, useRepo) {
|
|
22388
|
+
if (useRepo) exitWithConfigErrors([dbBackedRepoError(key)]);
|
|
22389
|
+
await dbBackedConfigKeys[key].write(await getDb(), value);
|
|
22390
|
+
console.log(chalk132.green(`Set ${key} = ${JSON.stringify(value)} (database)`));
|
|
22391
|
+
}
|
|
22392
|
+
|
|
22393
|
+
// src/commands/config/setFileConfigKey.ts
|
|
22394
|
+
import chalk133 from "chalk";
|
|
22395
|
+
async function setFileConfigKey({ key, useRepo, repoName, global }, coerced) {
|
|
22396
|
+
const target = useRepo ? `repo: ${await applyRepoOrExit(key, coerced, repoName)}` : applyOrExit(key, coerced, global);
|
|
22397
|
+
const shown = JSON.stringify(maskConfigKeySecrets(key, coerced));
|
|
22398
|
+
console.log(chalk133.green(`Set ${key} = ${shown} (${target})`));
|
|
22399
|
+
}
|
|
22400
|
+
function applyOrExit(key, coerced, global) {
|
|
22401
|
+
const result = applyConfigSet(key, coerced, global);
|
|
22402
|
+
if (!result.ok) exitWithConfigErrors(result.errors);
|
|
22403
|
+
return result.target;
|
|
22404
|
+
}
|
|
22405
|
+
async function applyRepoOrExit(key, coerced, repoName) {
|
|
22406
|
+
const result = await applySharedRepoConfigSet(key, coerced, repoName);
|
|
22407
|
+
if (!result.ok) exitWithConfigErrors(result.errors);
|
|
22408
|
+
return result.label;
|
|
22409
|
+
}
|
|
22410
|
+
|
|
22320
22411
|
// src/commands/config/configSet.ts
|
|
22321
22412
|
async function configSet(key, value, options2 = {}) {
|
|
22322
22413
|
if (options2.repo !== void 0 && !options2.global) {
|
|
22323
22414
|
console.error(
|
|
22324
|
-
|
|
22415
|
+
chalk134.red("--repo writes to the global config; add -g (e.g. -g --repo)")
|
|
22325
22416
|
);
|
|
22326
22417
|
process.exit(1);
|
|
22327
22418
|
}
|
|
22328
22419
|
const resolved = resolveRepoTarget(key, value, options2.repo);
|
|
22329
22420
|
if (resolved.value === void 0) {
|
|
22330
|
-
console.error(
|
|
22421
|
+
console.error(chalk134.red(`Missing required argument for '${resolved.key}'`));
|
|
22331
22422
|
process.exit(1);
|
|
22332
22423
|
}
|
|
22333
22424
|
const coercion = coerceCliConfigValue(resolved.key, resolved.value);
|
|
22334
22425
|
if (!coercion.ok) exitWithConfigErrors([coercion.error]);
|
|
22335
|
-
|
|
22336
|
-
|
|
22337
|
-
|
|
22338
|
-
|
|
22339
|
-
|
|
22340
|
-
|
|
22341
|
-
const result = applyConfigSet(key, coerced, global);
|
|
22342
|
-
if (!result.ok) exitWithConfigErrors(result.errors);
|
|
22343
|
-
return result.target;
|
|
22344
|
-
}
|
|
22345
|
-
async function applyRepoOrExit(key, coerced, repoName) {
|
|
22346
|
-
const result = await applySharedRepoConfigSet(key, coerced, repoName);
|
|
22347
|
-
if (!result.ok) exitWithConfigErrors(result.errors);
|
|
22348
|
-
return result.label;
|
|
22426
|
+
if (isDbBackedConfigKey(resolved.key))
|
|
22427
|
+
return setDbBackedConfigKey(resolved.key, coercion.value, resolved.useRepo);
|
|
22428
|
+
await setFileConfigKey(
|
|
22429
|
+
{ ...resolved, global: options2.global ?? false },
|
|
22430
|
+
coercion.value
|
|
22431
|
+
);
|
|
22349
22432
|
}
|
|
22350
22433
|
|
|
22351
22434
|
// src/commands/config/configUnset.ts
|
|
22352
|
-
import
|
|
22435
|
+
import chalk137 from "chalk";
|
|
22353
22436
|
|
|
22354
22437
|
// src/commands/config/resolveRepoUnsetTarget.ts
|
|
22355
22438
|
function resolveRepoUnsetTarget(key, repo) {
|
|
@@ -22361,11 +22444,44 @@ function resolveRepoUnsetTarget(key, repo) {
|
|
|
22361
22444
|
return { key, useRepo: repo === true, repoName: void 0 };
|
|
22362
22445
|
}
|
|
22363
22446
|
|
|
22447
|
+
// src/commands/config/unsetDbBackedConfigKey.ts
|
|
22448
|
+
import chalk135 from "chalk";
|
|
22449
|
+
async function unsetDbBackedConfigKey(key, useRepo) {
|
|
22450
|
+
if (useRepo) exitWithConfigErrors([dbBackedRepoError(key)]);
|
|
22451
|
+
const removed = await dbBackedConfigKeys[key].unset(await getDb());
|
|
22452
|
+
console.log(
|
|
22453
|
+
removed ? chalk135.green(`Unset ${key} (database)`) : chalk135.yellow(`${key} is not set in the database`)
|
|
22454
|
+
);
|
|
22455
|
+
}
|
|
22456
|
+
|
|
22457
|
+
// src/commands/config/unsetFileConfigKey.ts
|
|
22458
|
+
import chalk136 from "chalk";
|
|
22459
|
+
async function unsetFileConfigKey({
|
|
22460
|
+
key,
|
|
22461
|
+
useRepo,
|
|
22462
|
+
repoName,
|
|
22463
|
+
global
|
|
22464
|
+
}) {
|
|
22465
|
+
const result = useRepo ? await applySharedRepoConfigUnset(key, repoName) : applyConfigUnset(key, global);
|
|
22466
|
+
if (!result.ok) exitWithConfigErrors(result.errors);
|
|
22467
|
+
if (!result.removed) {
|
|
22468
|
+
console.log(chalk136.yellow(`${key} is not set in ${whereLabel(result)}`));
|
|
22469
|
+
return;
|
|
22470
|
+
}
|
|
22471
|
+
console.log(chalk136.green(`Unset ${key} (${targetLabel(result)})`));
|
|
22472
|
+
}
|
|
22473
|
+
function whereLabel(result) {
|
|
22474
|
+
return result.target === "repo" ? `repos.${result.label}` : `the ${result.target} config`;
|
|
22475
|
+
}
|
|
22476
|
+
function targetLabel(result) {
|
|
22477
|
+
return result.target === "repo" ? `repo: ${result.label}` : result.target;
|
|
22478
|
+
}
|
|
22479
|
+
|
|
22364
22480
|
// src/commands/config/configUnset.ts
|
|
22365
22481
|
async function configUnset(key, options2 = {}) {
|
|
22366
22482
|
if (options2.repo !== void 0 && !options2.global) {
|
|
22367
22483
|
console.error(
|
|
22368
|
-
|
|
22484
|
+
chalk137.red(
|
|
22369
22485
|
"--repo removes from the global config; add -g (e.g. -g --repo)"
|
|
22370
22486
|
)
|
|
22371
22487
|
);
|
|
@@ -22373,25 +22489,18 @@ async function configUnset(key, options2 = {}) {
|
|
|
22373
22489
|
}
|
|
22374
22490
|
const resolved = resolveRepoUnsetTarget(key, options2.repo);
|
|
22375
22491
|
if (resolved.key === void 0) {
|
|
22376
|
-
console.error(
|
|
22492
|
+
console.error(chalk137.red("Missing required argument 'key'"));
|
|
22377
22493
|
process.exit(1);
|
|
22378
22494
|
return;
|
|
22379
22495
|
}
|
|
22380
|
-
|
|
22381
|
-
|
|
22382
|
-
|
|
22383
|
-
|
|
22384
|
-
|
|
22385
|
-
|
|
22386
|
-
|
|
22387
|
-
}
|
|
22388
|
-
console.log(chalk133.green(`Unset ${resolved.key} (${targetLabel(result)})`));
|
|
22389
|
-
}
|
|
22390
|
-
function whereLabel(result) {
|
|
22391
|
-
return result.target === "repo" ? `repos.${result.label}` : `the ${result.target} config`;
|
|
22392
|
-
}
|
|
22393
|
-
function targetLabel(result) {
|
|
22394
|
-
return result.target === "repo" ? `repo: ${result.label}` : result.target;
|
|
22496
|
+
if (isDbBackedConfigKey(resolved.key))
|
|
22497
|
+
return unsetDbBackedConfigKey(resolved.key, resolved.useRepo);
|
|
22498
|
+
await unsetFileConfigKey({
|
|
22499
|
+
key: resolved.key,
|
|
22500
|
+
useRepo: resolved.useRepo,
|
|
22501
|
+
repoName: resolved.repoName,
|
|
22502
|
+
global: options2.global ?? false
|
|
22503
|
+
});
|
|
22395
22504
|
}
|
|
22396
22505
|
|
|
22397
22506
|
// src/commands/registerConfig.ts
|
|
@@ -22423,7 +22532,7 @@ function registerConfig(program) {
|
|
|
22423
22532
|
|
|
22424
22533
|
// src/commands/extension/extension.ts
|
|
22425
22534
|
import { cp } from "fs/promises";
|
|
22426
|
-
import
|
|
22535
|
+
import chalk138 from "chalk";
|
|
22427
22536
|
|
|
22428
22537
|
// src/commands/extension/extensionDir.ts
|
|
22429
22538
|
import { existsSync as existsSync48 } from "fs";
|
|
@@ -22446,21 +22555,21 @@ async function loadPath(source) {
|
|
|
22446
22555
|
return WSL_WINDOWS_PATH;
|
|
22447
22556
|
} catch {
|
|
22448
22557
|
console.log(
|
|
22449
|
-
|
|
22558
|
+
chalk138.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
22450
22559
|
);
|
|
22451
22560
|
return source;
|
|
22452
22561
|
}
|
|
22453
22562
|
}
|
|
22454
22563
|
async function extension() {
|
|
22455
22564
|
const path108 = await loadPath(extensionDir());
|
|
22456
|
-
console.log(
|
|
22457
|
-
console.log(
|
|
22565
|
+
console.log(chalk138.bold("assist \u2014 GitHub browser extension"));
|
|
22566
|
+
console.log(chalk138.dim(`load the unpacked extension from ${path108}`));
|
|
22458
22567
|
}
|
|
22459
22568
|
|
|
22460
22569
|
// src/commands/extension/printExtensionUrl.ts
|
|
22461
22570
|
import { readFile as readFile4 } from "fs/promises";
|
|
22462
22571
|
import { join as join54 } from "path";
|
|
22463
|
-
import
|
|
22572
|
+
import chalk139 from "chalk";
|
|
22464
22573
|
|
|
22465
22574
|
// src/commands/extension/latestUpdate.ts
|
|
22466
22575
|
function latestUpdate(manifest, updates2) {
|
|
@@ -22483,7 +22592,7 @@ async function printExtensionUrl() {
|
|
|
22483
22592
|
const response = await fetch(update_url);
|
|
22484
22593
|
const link3 = response.ok ? latestUpdateLink(manifest, await response.text()) : void 0;
|
|
22485
22594
|
if (!link3) {
|
|
22486
|
-
console.log(
|
|
22595
|
+
console.log(chalk139.red(`no signed build found in ${update_url}`));
|
|
22487
22596
|
process.exitCode = 1;
|
|
22488
22597
|
return;
|
|
22489
22598
|
}
|
|
@@ -22494,7 +22603,7 @@ async function printExtensionUrl() {
|
|
|
22494
22603
|
import { rm as rm2 } from "fs/promises";
|
|
22495
22604
|
import { homedir as homedir21, tmpdir as tmpdir3 } from "os";
|
|
22496
22605
|
import { join as join60 } from "path";
|
|
22497
|
-
import
|
|
22606
|
+
import chalk141 from "chalk";
|
|
22498
22607
|
|
|
22499
22608
|
// src/commands/extension/copySignedXpi.ts
|
|
22500
22609
|
import { copyFile } from "fs/promises";
|
|
@@ -22519,7 +22628,7 @@ async function findSignedXpi(dir) {
|
|
|
22519
22628
|
|
|
22520
22629
|
// src/commands/extension/signedAddonInstallPath.ts
|
|
22521
22630
|
import { cp as cp2 } from "fs/promises";
|
|
22522
|
-
import
|
|
22631
|
+
import chalk140 from "chalk";
|
|
22523
22632
|
var WSL_WINDOWS_XPI = "/mnt/c/tools/assist-extension.xpi";
|
|
22524
22633
|
var WSL_WINDOWS_PATH2 = String.raw`C:\tools\assist-extension.xpi`;
|
|
22525
22634
|
async function signedAddonInstallPath(xpi) {
|
|
@@ -22529,7 +22638,7 @@ async function signedAddonInstallPath(xpi) {
|
|
|
22529
22638
|
return WSL_WINDOWS_PATH2;
|
|
22530
22639
|
} catch {
|
|
22531
22640
|
console.log(
|
|
22532
|
-
|
|
22641
|
+
chalk140.yellow(`could not copy the add-on to ${WSL_WINDOWS_PATH2}`)
|
|
22533
22642
|
);
|
|
22534
22643
|
return xpi;
|
|
22535
22644
|
}
|
|
@@ -22622,15 +22731,15 @@ async function signExtension() {
|
|
|
22622
22731
|
const source = extensionDir();
|
|
22623
22732
|
const problem = signPreflightProblem(source);
|
|
22624
22733
|
if (problem) {
|
|
22625
|
-
console.log(
|
|
22626
|
-
console.log(
|
|
22734
|
+
console.log(chalk141.red(problem.message));
|
|
22735
|
+
console.log(chalk141.dim(problem.hint));
|
|
22627
22736
|
process.exitCode = 1;
|
|
22628
22737
|
return;
|
|
22629
22738
|
}
|
|
22630
22739
|
const { version: version2 } = package_default;
|
|
22631
22740
|
await stageExtension(source, STAGING_DIR, version2);
|
|
22632
22741
|
await rm2(ARTIFACTS_DIR, { recursive: true, force: true });
|
|
22633
|
-
console.log(
|
|
22742
|
+
console.log(chalk141.bold(`signing version ${version2} for self-distribution`));
|
|
22634
22743
|
const { done: done2 } = spawnInherit("npx", [
|
|
22635
22744
|
"--yes",
|
|
22636
22745
|
"web-ext",
|
|
@@ -22640,13 +22749,13 @@ async function signExtension() {
|
|
|
22640
22749
|
"--channel=unlisted"
|
|
22641
22750
|
]);
|
|
22642
22751
|
if (await done2 !== 0) {
|
|
22643
|
-
console.log(
|
|
22752
|
+
console.log(chalk141.red("web-ext sign failed"));
|
|
22644
22753
|
process.exitCode = 1;
|
|
22645
22754
|
return;
|
|
22646
22755
|
}
|
|
22647
22756
|
const xpi = await findSignedXpi(ARTIFACTS_DIR);
|
|
22648
22757
|
if (!xpi) {
|
|
22649
|
-
console.log(
|
|
22758
|
+
console.log(chalk141.red(`web-ext wrote no .xpi into ${ARTIFACTS_DIR}`));
|
|
22650
22759
|
process.exitCode = 1;
|
|
22651
22760
|
return;
|
|
22652
22761
|
}
|
|
@@ -22654,7 +22763,7 @@ async function signExtension() {
|
|
|
22654
22763
|
const path108 = await signedAddonInstallPath(
|
|
22655
22764
|
await copySignedXpi(xpi, ARTIFACTS_DIR)
|
|
22656
22765
|
);
|
|
22657
|
-
console.log(
|
|
22766
|
+
console.log(chalk141.dim(`install the signed add-on from ${path108}`));
|
|
22658
22767
|
}
|
|
22659
22768
|
|
|
22660
22769
|
// src/commands/registerExtension.ts
|
|
@@ -22715,11 +22824,11 @@ async function dropRetiredTables(exec3) {
|
|
|
22715
22824
|
}
|
|
22716
22825
|
|
|
22717
22826
|
// src/commands/db/reportRetiredTables.ts
|
|
22718
|
-
import
|
|
22827
|
+
import chalk142 from "chalk";
|
|
22719
22828
|
function reportRetiredTables(tables) {
|
|
22720
22829
|
for (const table of tables) {
|
|
22721
22830
|
console.error(
|
|
22722
|
-
|
|
22831
|
+
chalk142.yellow(
|
|
22723
22832
|
`Retired table ${table.name} still exists (${table.rows} rows). Run \`assist db drop-retired\` to drop it.`
|
|
22724
22833
|
)
|
|
22725
22834
|
);
|
|
@@ -22727,40 +22836,40 @@ function reportRetiredTables(tables) {
|
|
|
22727
22836
|
}
|
|
22728
22837
|
|
|
22729
22838
|
// src/commands/db/reportMigrationStatus.ts
|
|
22730
|
-
import
|
|
22839
|
+
import chalk143 from "chalk";
|
|
22731
22840
|
function reportApplied(applied) {
|
|
22732
22841
|
if (applied.length === 0) {
|
|
22733
|
-
console.error(
|
|
22842
|
+
console.error(chalk143.green("Database is up to date; nothing to apply."));
|
|
22734
22843
|
return;
|
|
22735
22844
|
}
|
|
22736
22845
|
for (const migration of applied) {
|
|
22737
22846
|
console.error(
|
|
22738
|
-
|
|
22847
|
+
chalk143.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
22739
22848
|
);
|
|
22740
22849
|
}
|
|
22741
22850
|
}
|
|
22742
22851
|
function reportMigrationStatus(status2) {
|
|
22743
22852
|
if (status2.state === "in-sync") {
|
|
22744
22853
|
console.error(
|
|
22745
|
-
|
|
22854
|
+
chalk143.green(`In sync at migration ${status2.version} (latest).`)
|
|
22746
22855
|
);
|
|
22747
22856
|
return;
|
|
22748
22857
|
}
|
|
22749
22858
|
if (status2.state === "behind") {
|
|
22750
22859
|
console.error(
|
|
22751
|
-
|
|
22860
|
+
chalk143.yellow(
|
|
22752
22861
|
`Behind: applied ${status2.applied}, build expects ${status2.expected}.`
|
|
22753
22862
|
)
|
|
22754
22863
|
);
|
|
22755
22864
|
console.error(
|
|
22756
|
-
|
|
22865
|
+
chalk143.yellow(
|
|
22757
22866
|
`Pending: ${status2.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
22758
22867
|
)
|
|
22759
22868
|
);
|
|
22760
22869
|
return;
|
|
22761
22870
|
}
|
|
22762
22871
|
console.error(
|
|
22763
|
-
|
|
22872
|
+
chalk143.red(
|
|
22764
22873
|
`Ahead: applied ${status2.applied}, build knows ${status2.expected}. Update assist.`
|
|
22765
22874
|
)
|
|
22766
22875
|
);
|
|
@@ -22802,7 +22911,7 @@ function registerDb(program) {
|
|
|
22802
22911
|
|
|
22803
22912
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
22804
22913
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync27 } from "fs";
|
|
22805
|
-
import
|
|
22914
|
+
import chalk144 from "chalk";
|
|
22806
22915
|
|
|
22807
22916
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
22808
22917
|
import { join as join61 } from "path";
|
|
@@ -22833,7 +22942,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
22833
22942
|
sweepRestrictedDir();
|
|
22834
22943
|
const state = readMigrationPinState(pin2);
|
|
22835
22944
|
if (!state) {
|
|
22836
|
-
console.error(
|
|
22945
|
+
console.error(chalk144.red(`No pending migration unlock for pin: ${pin2}`));
|
|
22837
22946
|
process.exitCode = 1;
|
|
22838
22947
|
return;
|
|
22839
22948
|
}
|
|
@@ -22843,7 +22952,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
22843
22952
|
);
|
|
22844
22953
|
unlinkSync9(getMigrationPinPath(pin2));
|
|
22845
22954
|
console.log(
|
|
22846
|
-
|
|
22955
|
+
chalk144.green(
|
|
22847
22956
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
22848
22957
|
)
|
|
22849
22958
|
);
|
|
@@ -22852,7 +22961,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
22852
22961
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
22853
22962
|
import { mkdirSync as mkdirSync17, writeFileSync as writeFileSync28 } from "fs";
|
|
22854
22963
|
import { randomInt as randomInt2 } from "crypto";
|
|
22855
|
-
import
|
|
22964
|
+
import chalk145 from "chalk";
|
|
22856
22965
|
|
|
22857
22966
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
22858
22967
|
function nextMigrationId() {
|
|
@@ -22867,7 +22976,7 @@ function dbMigrationUnlock() {
|
|
|
22867
22976
|
sweepRestrictedDir();
|
|
22868
22977
|
writeFileSync28(getMigrationPinPath(pin2), JSON.stringify({ pin: pin2, migrationId }));
|
|
22869
22978
|
console.error(
|
|
22870
|
-
|
|
22979
|
+
chalk145.yellow.bold(
|
|
22871
22980
|
"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."
|
|
22872
22981
|
)
|
|
22873
22982
|
);
|
|
@@ -22877,7 +22986,7 @@ function dbMigrationUnlock() {
|
|
|
22877
22986
|
});
|
|
22878
22987
|
if (!delivered) {
|
|
22879
22988
|
console.error(
|
|
22880
|
-
|
|
22989
|
+
chalk145.red(
|
|
22881
22990
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
22882
22991
|
)
|
|
22883
22992
|
);
|
|
@@ -22887,7 +22996,7 @@ function dbMigrationUnlock() {
|
|
|
22887
22996
|
console.log(
|
|
22888
22997
|
`A confirmation pin was sent to your desktop notifications.
|
|
22889
22998
|
To approve creating migration ${migrationId}, run:
|
|
22890
|
-
${
|
|
22999
|
+
${chalk145.cyan(" assist db-migration confirm <PIN>")}
|
|
22891
23000
|
using the pin from that notification.`
|
|
22892
23001
|
);
|
|
22893
23002
|
}
|
|
@@ -22907,7 +23016,7 @@ function registerDbMigration(parent) {
|
|
|
22907
23016
|
|
|
22908
23017
|
// src/commands/deploy/redirect.ts
|
|
22909
23018
|
import { existsSync as existsSync52, readFileSync as readFileSync34, writeFileSync as writeFileSync29 } from "fs";
|
|
22910
|
-
import
|
|
23019
|
+
import chalk146 from "chalk";
|
|
22911
23020
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
22912
23021
|
if (!window.location.pathname.endsWith('/')) {
|
|
22913
23022
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -22916,23 +23025,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
22916
23025
|
function redirect() {
|
|
22917
23026
|
const indexPath = "index.html";
|
|
22918
23027
|
if (!existsSync52(indexPath)) {
|
|
22919
|
-
console.log(
|
|
23028
|
+
console.log(chalk146.yellow("No index.html found"));
|
|
22920
23029
|
return;
|
|
22921
23030
|
}
|
|
22922
23031
|
const content = readFileSync34(indexPath, "utf8");
|
|
22923
23032
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
22924
|
-
console.log(
|
|
23033
|
+
console.log(chalk146.dim("Trailing slash script already present"));
|
|
22925
23034
|
return;
|
|
22926
23035
|
}
|
|
22927
23036
|
const headCloseIndex = content.indexOf("</head>");
|
|
22928
23037
|
if (headCloseIndex === -1) {
|
|
22929
|
-
console.log(
|
|
23038
|
+
console.log(chalk146.red("Could not find </head> tag in index.html"));
|
|
22930
23039
|
return;
|
|
22931
23040
|
}
|
|
22932
23041
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
22933
23042
|
${content.slice(headCloseIndex)}`;
|
|
22934
23043
|
writeFileSync29(indexPath, newContent);
|
|
22935
|
-
console.log(
|
|
23044
|
+
console.log(chalk146.green("Added trailing slash redirect to index.html"));
|
|
22936
23045
|
}
|
|
22937
23046
|
|
|
22938
23047
|
// src/commands/registerDeploy.ts
|
|
@@ -22959,7 +23068,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
22959
23068
|
|
|
22960
23069
|
// src/commands/devlog/shared.ts
|
|
22961
23070
|
import { execSync as execSync31 } from "child_process";
|
|
22962
|
-
import
|
|
23071
|
+
import chalk147 from "chalk";
|
|
22963
23072
|
|
|
22964
23073
|
// src/shared/getRepoName.ts
|
|
22965
23074
|
import { existsSync as existsSync53, readFileSync as readFileSync35 } from "fs";
|
|
@@ -23068,13 +23177,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
23068
23177
|
}
|
|
23069
23178
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
23070
23179
|
for (const commit2 of commits2) {
|
|
23071
|
-
console.log(` ${
|
|
23180
|
+
console.log(` ${chalk147.yellow(commit2.hash)} ${commit2.message}`);
|
|
23072
23181
|
if (verbose) {
|
|
23073
23182
|
const visibleFiles = commit2.files.filter(
|
|
23074
23183
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
23075
23184
|
);
|
|
23076
23185
|
for (const file of visibleFiles) {
|
|
23077
|
-
console.log(` ${
|
|
23186
|
+
console.log(` ${chalk147.dim(file)}`);
|
|
23078
23187
|
}
|
|
23079
23188
|
}
|
|
23080
23189
|
}
|
|
@@ -23099,15 +23208,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
23099
23208
|
}
|
|
23100
23209
|
|
|
23101
23210
|
// src/commands/devlog/list/printDateHeader.ts
|
|
23102
|
-
import
|
|
23211
|
+
import chalk148 from "chalk";
|
|
23103
23212
|
function printDateHeader(date, isSkipped, entries) {
|
|
23104
23213
|
if (isSkipped) {
|
|
23105
|
-
console.log(`${
|
|
23214
|
+
console.log(`${chalk148.bold.blue(date)} ${chalk148.dim("skipped")}`);
|
|
23106
23215
|
} else if (entries && entries.length > 0) {
|
|
23107
|
-
const entryInfo = entries.map((e) => `${
|
|
23108
|
-
console.log(`${
|
|
23216
|
+
const entryInfo = entries.map((e) => `${chalk148.green(e.version)} ${e.title}`).join(" | ");
|
|
23217
|
+
console.log(`${chalk148.bold.blue(date)} ${entryInfo}`);
|
|
23109
23218
|
} else {
|
|
23110
|
-
console.log(`${
|
|
23219
|
+
console.log(`${chalk148.bold.blue(date)} ${chalk148.red("\u26A0 devlog missing")}`);
|
|
23111
23220
|
}
|
|
23112
23221
|
}
|
|
23113
23222
|
|
|
@@ -23211,24 +23320,24 @@ function bumpVersion(version2, type) {
|
|
|
23211
23320
|
|
|
23212
23321
|
// src/commands/devlog/next/displayNextEntry.ts
|
|
23213
23322
|
import { execFileSync as execFileSync9 } from "child_process";
|
|
23214
|
-
import
|
|
23323
|
+
import chalk150 from "chalk";
|
|
23215
23324
|
|
|
23216
23325
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
23217
|
-
import
|
|
23326
|
+
import chalk149 from "chalk";
|
|
23218
23327
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
23219
23328
|
if (conventional && firstHash) {
|
|
23220
23329
|
const version2 = getVersionAtCommit(firstHash);
|
|
23221
23330
|
if (version2) {
|
|
23222
|
-
console.log(`${
|
|
23331
|
+
console.log(`${chalk149.bold("version:")} ${stripToMinor(version2)}`);
|
|
23223
23332
|
} else {
|
|
23224
|
-
console.log(`${
|
|
23333
|
+
console.log(`${chalk149.bold("version:")} ${chalk149.red("unknown")}`);
|
|
23225
23334
|
}
|
|
23226
23335
|
} else if (patchVersion && minorVersion) {
|
|
23227
23336
|
console.log(
|
|
23228
|
-
`${
|
|
23337
|
+
`${chalk149.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
23229
23338
|
);
|
|
23230
23339
|
} else {
|
|
23231
|
-
console.log(`${
|
|
23340
|
+
console.log(`${chalk149.bold("version:")} v0.1 (initial)`);
|
|
23232
23341
|
}
|
|
23233
23342
|
}
|
|
23234
23343
|
|
|
@@ -23276,16 +23385,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
23276
23385
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
23277
23386
|
}
|
|
23278
23387
|
function logName(repoName) {
|
|
23279
|
-
console.log(`${
|
|
23388
|
+
console.log(`${chalk150.bold("name:")} ${repoName}`);
|
|
23280
23389
|
}
|
|
23281
23390
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
23282
23391
|
logName(ctx.repoName);
|
|
23283
23392
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
23284
|
-
console.log(
|
|
23393
|
+
console.log(chalk150.bold.blue(targetDate));
|
|
23285
23394
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
23286
23395
|
}
|
|
23287
23396
|
function logNoCommits(lastInfo) {
|
|
23288
|
-
console.log(
|
|
23397
|
+
console.log(chalk150.dim(noCommitsMessage(!!lastInfo)));
|
|
23289
23398
|
}
|
|
23290
23399
|
|
|
23291
23400
|
// src/commands/devlog/next.ts
|
|
@@ -23326,11 +23435,11 @@ function next2(options2) {
|
|
|
23326
23435
|
import { execSync as execSync33 } from "child_process";
|
|
23327
23436
|
|
|
23328
23437
|
// src/commands/devlog/repos/printReposTable.ts
|
|
23329
|
-
import
|
|
23438
|
+
import chalk151 from "chalk";
|
|
23330
23439
|
function colorStatus(status2) {
|
|
23331
|
-
if (status2 === "missing") return
|
|
23332
|
-
if (status2 === "outdated") return
|
|
23333
|
-
return
|
|
23440
|
+
if (status2 === "missing") return chalk151.red(status2);
|
|
23441
|
+
if (status2 === "outdated") return chalk151.yellow(status2);
|
|
23442
|
+
return chalk151.green(status2);
|
|
23334
23443
|
}
|
|
23335
23444
|
function formatRow(row3, nameWidth) {
|
|
23336
23445
|
const devlog = (row3.lastDevlog ?? "-").padEnd(11);
|
|
@@ -23344,8 +23453,8 @@ function printReposTable(rows) {
|
|
|
23344
23453
|
"Last Devlog".padEnd(11),
|
|
23345
23454
|
"Status"
|
|
23346
23455
|
].join(" ");
|
|
23347
|
-
console.log(
|
|
23348
|
-
console.log(
|
|
23456
|
+
console.log(chalk151.dim(header));
|
|
23457
|
+
console.log(chalk151.dim("-".repeat(header.length)));
|
|
23349
23458
|
for (const row3 of rows) {
|
|
23350
23459
|
console.log(formatRow(row3, nameWidth));
|
|
23351
23460
|
}
|
|
@@ -23403,14 +23512,14 @@ function repos(options2) {
|
|
|
23403
23512
|
// src/commands/devlog/skip.ts
|
|
23404
23513
|
import { writeFileSync as writeFileSync30 } from "fs";
|
|
23405
23514
|
import { join as join65 } from "path";
|
|
23406
|
-
import
|
|
23515
|
+
import chalk152 from "chalk";
|
|
23407
23516
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
23408
23517
|
function getBlogConfigPath() {
|
|
23409
23518
|
return join65(BLOG_REPO_ROOT, "assist.yml");
|
|
23410
23519
|
}
|
|
23411
23520
|
function skip2(date) {
|
|
23412
23521
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
23413
|
-
console.log(
|
|
23522
|
+
console.log(chalk152.red("Invalid date format. Use YYYY-MM-DD"));
|
|
23414
23523
|
process.exit(1);
|
|
23415
23524
|
}
|
|
23416
23525
|
const repoName = getRepoName();
|
|
@@ -23421,7 +23530,7 @@ function skip2(date) {
|
|
|
23421
23530
|
const skipDays = skip3[repoName] ?? [];
|
|
23422
23531
|
if (skipDays.includes(date)) {
|
|
23423
23532
|
console.log(
|
|
23424
|
-
|
|
23533
|
+
chalk152.yellow(`${date} is already in skip list for ${repoName}`)
|
|
23425
23534
|
);
|
|
23426
23535
|
return;
|
|
23427
23536
|
}
|
|
@@ -23431,20 +23540,20 @@ function skip2(date) {
|
|
|
23431
23540
|
devlog.skip = skip3;
|
|
23432
23541
|
config.devlog = devlog;
|
|
23433
23542
|
writeFileSync30(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
23434
|
-
console.log(
|
|
23543
|
+
console.log(chalk152.green(`Added ${date} to skip list for ${repoName}`));
|
|
23435
23544
|
}
|
|
23436
23545
|
|
|
23437
23546
|
// src/commands/devlog/version.ts
|
|
23438
|
-
import
|
|
23547
|
+
import chalk153 from "chalk";
|
|
23439
23548
|
function version() {
|
|
23440
23549
|
const config = loadConfig();
|
|
23441
23550
|
const name = getRepoName();
|
|
23442
23551
|
const lastInfo = getLastVersionInfo(name, config);
|
|
23443
23552
|
const lastVersion = lastInfo?.version ?? null;
|
|
23444
23553
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
23445
|
-
console.log(`${
|
|
23446
|
-
console.log(`${
|
|
23447
|
-
console.log(`${
|
|
23554
|
+
console.log(`${chalk153.bold("name:")} ${name}`);
|
|
23555
|
+
console.log(`${chalk153.bold("last:")} ${lastVersion ?? chalk153.dim("none")}`);
|
|
23556
|
+
console.log(`${chalk153.bold("next:")} ${nextVersion ?? chalk153.dim("none")}`);
|
|
23448
23557
|
}
|
|
23449
23558
|
|
|
23450
23559
|
// src/commands/registerDevlog.ts
|
|
@@ -23469,7 +23578,7 @@ function registerDevlog(program) {
|
|
|
23469
23578
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
23470
23579
|
import { closeSync as closeSync4, openSync as openSync5, readdirSync as readdirSync8 } from "fs";
|
|
23471
23580
|
import { join as join66 } from "path";
|
|
23472
|
-
import
|
|
23581
|
+
import chalk154 from "chalk";
|
|
23473
23582
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
23474
23583
|
function isLockedDll(debugDir) {
|
|
23475
23584
|
let files;
|
|
@@ -23516,14 +23625,14 @@ function checkBuildLocks(startDir) {
|
|
|
23516
23625
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
23517
23626
|
if (locked) {
|
|
23518
23627
|
console.error(
|
|
23519
|
-
|
|
23628
|
+
chalk154.red("Build output locked (is VS debugging?): ") + locked
|
|
23520
23629
|
);
|
|
23521
23630
|
process.exit(1);
|
|
23522
23631
|
}
|
|
23523
23632
|
}
|
|
23524
23633
|
async function checkBuildLocksCommand() {
|
|
23525
23634
|
checkBuildLocks();
|
|
23526
|
-
console.log(
|
|
23635
|
+
console.log(chalk154.green("No build locks detected"));
|
|
23527
23636
|
}
|
|
23528
23637
|
|
|
23529
23638
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -23622,30 +23731,30 @@ function escapeRegex(s) {
|
|
|
23622
23731
|
}
|
|
23623
23732
|
|
|
23624
23733
|
// src/commands/dotnet/printTree.ts
|
|
23625
|
-
import
|
|
23734
|
+
import chalk155 from "chalk";
|
|
23626
23735
|
function printNodes(nodes, prefix2) {
|
|
23627
23736
|
for (let i = 0; i < nodes.length; i++) {
|
|
23628
23737
|
const isLast = i === nodes.length - 1;
|
|
23629
23738
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
23630
23739
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
23631
23740
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
23632
|
-
const label2 = isMissing ?
|
|
23741
|
+
const label2 = isMissing ? chalk155.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
23633
23742
|
console.log(`${prefix2}${connector}${label2}`);
|
|
23634
23743
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
23635
23744
|
}
|
|
23636
23745
|
}
|
|
23637
23746
|
function printTree(tree, totalCount, solutions) {
|
|
23638
|
-
console.log(
|
|
23639
|
-
console.log(
|
|
23747
|
+
console.log(chalk155.bold("\nProject Dependency Tree"));
|
|
23748
|
+
console.log(chalk155.cyan(tree.relativePath));
|
|
23640
23749
|
printNodes(tree.children, "");
|
|
23641
|
-
console.log(
|
|
23750
|
+
console.log(chalk155.dim(`
|
|
23642
23751
|
${totalCount} projects total (including root)`));
|
|
23643
|
-
console.log(
|
|
23752
|
+
console.log(chalk155.bold("\nSolution Membership"));
|
|
23644
23753
|
if (solutions.length === 0) {
|
|
23645
|
-
console.log(
|
|
23754
|
+
console.log(chalk155.yellow(" Not found in any .sln"));
|
|
23646
23755
|
} else {
|
|
23647
23756
|
for (const sln of solutions) {
|
|
23648
|
-
console.log(` ${
|
|
23757
|
+
console.log(` ${chalk155.green(sln)}`);
|
|
23649
23758
|
}
|
|
23650
23759
|
}
|
|
23651
23760
|
console.log();
|
|
@@ -23674,16 +23783,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
23674
23783
|
// src/commands/dotnet/resolveCsproj.ts
|
|
23675
23784
|
import { existsSync as existsSync54 } from "fs";
|
|
23676
23785
|
import path37 from "path";
|
|
23677
|
-
import
|
|
23786
|
+
import chalk156 from "chalk";
|
|
23678
23787
|
function resolveCsproj(csprojPath) {
|
|
23679
23788
|
const resolved = path37.resolve(csprojPath);
|
|
23680
23789
|
if (!existsSync54(resolved)) {
|
|
23681
|
-
console.error(
|
|
23790
|
+
console.error(chalk156.red(`File not found: ${resolved}`));
|
|
23682
23791
|
process.exit(1);
|
|
23683
23792
|
}
|
|
23684
23793
|
const repoRoot2 = findRepoRoot(path37.dirname(resolved));
|
|
23685
23794
|
if (!repoRoot2) {
|
|
23686
|
-
console.error(
|
|
23795
|
+
console.error(chalk156.red("Could not find git repository root"));
|
|
23687
23796
|
process.exit(1);
|
|
23688
23797
|
}
|
|
23689
23798
|
return { resolved, repoRoot: repoRoot2 };
|
|
@@ -23733,12 +23842,12 @@ function getChangedCsFiles(scope) {
|
|
|
23733
23842
|
}
|
|
23734
23843
|
|
|
23735
23844
|
// src/commands/dotnet/inSln.ts
|
|
23736
|
-
import
|
|
23845
|
+
import chalk157 from "chalk";
|
|
23737
23846
|
async function inSln(csprojPath) {
|
|
23738
23847
|
const { resolved, repoRoot: repoRoot2 } = resolveCsproj(csprojPath);
|
|
23739
23848
|
const solutions = findContainingSolutions(resolved, repoRoot2);
|
|
23740
23849
|
if (solutions.length === 0) {
|
|
23741
|
-
console.log(
|
|
23850
|
+
console.log(chalk157.yellow("Not found in any .sln file"));
|
|
23742
23851
|
process.exit(1);
|
|
23743
23852
|
}
|
|
23744
23853
|
for (const sln of solutions) {
|
|
@@ -23747,7 +23856,7 @@ async function inSln(csprojPath) {
|
|
|
23747
23856
|
}
|
|
23748
23857
|
|
|
23749
23858
|
// src/commands/dotnet/inspect.ts
|
|
23750
|
-
import
|
|
23859
|
+
import chalk163 from "chalk";
|
|
23751
23860
|
|
|
23752
23861
|
// src/shared/formatElapsed.ts
|
|
23753
23862
|
function formatElapsed(ms) {
|
|
@@ -23759,12 +23868,12 @@ function formatElapsed(ms) {
|
|
|
23759
23868
|
}
|
|
23760
23869
|
|
|
23761
23870
|
// src/commands/dotnet/displayIssues.ts
|
|
23762
|
-
import
|
|
23871
|
+
import chalk158 from "chalk";
|
|
23763
23872
|
var SEVERITY_COLOR = {
|
|
23764
|
-
ERROR:
|
|
23765
|
-
WARNING:
|
|
23766
|
-
SUGGESTION:
|
|
23767
|
-
HINT:
|
|
23873
|
+
ERROR: chalk158.red,
|
|
23874
|
+
WARNING: chalk158.yellow,
|
|
23875
|
+
SUGGESTION: chalk158.cyan,
|
|
23876
|
+
HINT: chalk158.dim
|
|
23768
23877
|
};
|
|
23769
23878
|
function groupByFile(issues) {
|
|
23770
23879
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -23780,15 +23889,15 @@ function groupByFile(issues) {
|
|
|
23780
23889
|
}
|
|
23781
23890
|
function displayIssues(issues) {
|
|
23782
23891
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
23783
|
-
console.log(
|
|
23892
|
+
console.log(chalk158.bold(file));
|
|
23784
23893
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
23785
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
23894
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk158.white;
|
|
23786
23895
|
console.log(
|
|
23787
|
-
` ${
|
|
23896
|
+
` ${chalk158.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
23788
23897
|
);
|
|
23789
23898
|
}
|
|
23790
23899
|
}
|
|
23791
|
-
console.log(
|
|
23900
|
+
console.log(chalk158.dim(`
|
|
23792
23901
|
${issues.length} issue(s) found`));
|
|
23793
23902
|
}
|
|
23794
23903
|
|
|
@@ -23847,12 +23956,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
23847
23956
|
// src/commands/dotnet/resolveSolution.ts
|
|
23848
23957
|
import { existsSync as existsSync55 } from "fs";
|
|
23849
23958
|
import path38 from "path";
|
|
23850
|
-
import
|
|
23959
|
+
import chalk160 from "chalk";
|
|
23851
23960
|
|
|
23852
23961
|
// src/commands/dotnet/findSolution.ts
|
|
23853
23962
|
import { readdirSync as readdirSync10 } from "fs";
|
|
23854
23963
|
import { dirname as dirname29, join as join67 } from "path";
|
|
23855
|
-
import
|
|
23964
|
+
import chalk159 from "chalk";
|
|
23856
23965
|
function findSlnInDir(dir) {
|
|
23857
23966
|
try {
|
|
23858
23967
|
return readdirSync10(dir).filter((f) => f.endsWith(".sln")).map((f) => join67(dir, f));
|
|
@@ -23868,17 +23977,17 @@ function findSolution() {
|
|
|
23868
23977
|
const slnFiles = findSlnInDir(current);
|
|
23869
23978
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
23870
23979
|
if (slnFiles.length > 1) {
|
|
23871
|
-
console.error(
|
|
23980
|
+
console.error(chalk159.red(`Multiple .sln files found in ${current}:`));
|
|
23872
23981
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
23873
23982
|
console.error(
|
|
23874
|
-
|
|
23983
|
+
chalk159.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
23875
23984
|
);
|
|
23876
23985
|
process.exit(1);
|
|
23877
23986
|
}
|
|
23878
23987
|
if (current === ceiling) break;
|
|
23879
23988
|
current = dirname29(current);
|
|
23880
23989
|
}
|
|
23881
|
-
console.error(
|
|
23990
|
+
console.error(chalk159.red("No .sln file found between cwd and repo root"));
|
|
23882
23991
|
process.exit(1);
|
|
23883
23992
|
}
|
|
23884
23993
|
|
|
@@ -23887,7 +23996,7 @@ function resolveSolution(sln) {
|
|
|
23887
23996
|
if (sln) {
|
|
23888
23997
|
const resolved = path38.resolve(sln);
|
|
23889
23998
|
if (!existsSync55(resolved)) {
|
|
23890
|
-
console.error(
|
|
23999
|
+
console.error(chalk160.red(`Solution file not found: ${resolved}`));
|
|
23891
24000
|
process.exit(1);
|
|
23892
24001
|
}
|
|
23893
24002
|
return resolved;
|
|
@@ -23929,14 +24038,14 @@ import { execSync as execSync35 } from "child_process";
|
|
|
23929
24038
|
import { existsSync as existsSync56, readFileSync as readFileSync39, unlinkSync as unlinkSync10 } from "fs";
|
|
23930
24039
|
import { tmpdir as tmpdir4 } from "os";
|
|
23931
24040
|
import path39 from "path";
|
|
23932
|
-
import
|
|
24041
|
+
import chalk161 from "chalk";
|
|
23933
24042
|
function assertJbInstalled() {
|
|
23934
24043
|
try {
|
|
23935
24044
|
execSync35("jb inspectcode --version", { stdio: "pipe" });
|
|
23936
24045
|
} catch {
|
|
23937
|
-
console.error(
|
|
24046
|
+
console.error(chalk161.red("jb is not installed. Install with:"));
|
|
23938
24047
|
console.error(
|
|
23939
|
-
|
|
24048
|
+
chalk161.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
23940
24049
|
);
|
|
23941
24050
|
process.exit(1);
|
|
23942
24051
|
}
|
|
@@ -23954,11 +24063,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
23954
24063
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
23955
24064
|
process.stderr.write(error.stderr);
|
|
23956
24065
|
}
|
|
23957
|
-
console.error(
|
|
24066
|
+
console.error(chalk161.red("jb inspectcode failed"));
|
|
23958
24067
|
process.exit(1);
|
|
23959
24068
|
}
|
|
23960
24069
|
if (!existsSync56(reportPath)) {
|
|
23961
|
-
console.error(
|
|
24070
|
+
console.error(chalk161.red("Report file not generated"));
|
|
23962
24071
|
process.exit(1);
|
|
23963
24072
|
}
|
|
23964
24073
|
const xml = readFileSync39(reportPath, "utf8");
|
|
@@ -23968,7 +24077,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
23968
24077
|
|
|
23969
24078
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
23970
24079
|
import { execSync as execSync36 } from "child_process";
|
|
23971
|
-
import
|
|
24080
|
+
import chalk162 from "chalk";
|
|
23972
24081
|
function resolveMsbuildPath() {
|
|
23973
24082
|
const { run: run4 } = loadConfig();
|
|
23974
24083
|
const configs = resolveRunConfigs(run4, runConfigBaseDir());
|
|
@@ -23980,9 +24089,9 @@ function assertMsbuildInstalled() {
|
|
|
23980
24089
|
try {
|
|
23981
24090
|
execSync36(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
23982
24091
|
} catch {
|
|
23983
|
-
console.error(
|
|
24092
|
+
console.error(chalk162.red(`msbuild not found at: ${msbuild}`));
|
|
23984
24093
|
console.error(
|
|
23985
|
-
|
|
24094
|
+
chalk162.yellow(
|
|
23986
24095
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
23987
24096
|
)
|
|
23988
24097
|
);
|
|
@@ -24029,17 +24138,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
24029
24138
|
// src/commands/dotnet/inspect.ts
|
|
24030
24139
|
function logScope(changedFiles2) {
|
|
24031
24140
|
if (changedFiles2 === null) {
|
|
24032
|
-
console.log(
|
|
24141
|
+
console.log(chalk163.dim("Inspecting full solution..."));
|
|
24033
24142
|
} else {
|
|
24034
24143
|
console.log(
|
|
24035
|
-
|
|
24144
|
+
chalk163.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
24036
24145
|
);
|
|
24037
24146
|
}
|
|
24038
24147
|
}
|
|
24039
24148
|
function reportResults(issues, elapsed) {
|
|
24040
24149
|
if (issues.length > 0) displayIssues(issues);
|
|
24041
|
-
else console.log(
|
|
24042
|
-
console.log(
|
|
24150
|
+
else console.log(chalk163.green("No issues found"));
|
|
24151
|
+
console.log(chalk163.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
24043
24152
|
if (issues.length > 0) process.exit(1);
|
|
24044
24153
|
}
|
|
24045
24154
|
async function inspect(sln, options2) {
|
|
@@ -24050,7 +24159,7 @@ async function inspect(sln, options2) {
|
|
|
24050
24159
|
const scope = parseScope(options2.scope);
|
|
24051
24160
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
24052
24161
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
24053
|
-
console.log(
|
|
24162
|
+
console.log(chalk163.green("No changed .cs files found"));
|
|
24054
24163
|
return;
|
|
24055
24164
|
}
|
|
24056
24165
|
logScope(changedFiles2);
|
|
@@ -24925,25 +25034,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
24925
25034
|
}
|
|
24926
25035
|
|
|
24927
25036
|
// src/commands/github/printCountTable.ts
|
|
24928
|
-
import
|
|
25037
|
+
import chalk164 from "chalk";
|
|
24929
25038
|
function printCountTable(labelHeader, rows) {
|
|
24930
25039
|
const labelWidth = Math.max(
|
|
24931
25040
|
labelHeader.length,
|
|
24932
25041
|
...rows.map((row3) => row3.label.length)
|
|
24933
25042
|
);
|
|
24934
25043
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
24935
|
-
console.log(
|
|
24936
|
-
console.log(
|
|
25044
|
+
console.log(chalk164.dim(header));
|
|
25045
|
+
console.log(chalk164.dim("-".repeat(header.length)));
|
|
24937
25046
|
for (const row3 of rows) {
|
|
24938
25047
|
console.log(`${row3.label.padEnd(labelWidth)} ${row3.count}`);
|
|
24939
25048
|
}
|
|
24940
25049
|
}
|
|
24941
25050
|
|
|
24942
25051
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
24943
|
-
import
|
|
25052
|
+
import chalk165 from "chalk";
|
|
24944
25053
|
function printRepoAuthorBreakdown(repos2) {
|
|
24945
25054
|
for (const repo of repos2) {
|
|
24946
|
-
console.log(
|
|
25055
|
+
console.log(chalk165.bold(repo.name));
|
|
24947
25056
|
const authorWidth = Math.max(
|
|
24948
25057
|
0,
|
|
24949
25058
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -25026,10 +25135,10 @@ function parseTopCount(value) {
|
|
|
25026
25135
|
}
|
|
25027
25136
|
|
|
25028
25137
|
// src/commands/github/issue/fixStructure/applyAndVerifySubtree.ts
|
|
25029
|
-
import
|
|
25138
|
+
import chalk167 from "chalk";
|
|
25030
25139
|
|
|
25031
25140
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
25032
|
-
import
|
|
25141
|
+
import chalk166 from "chalk";
|
|
25033
25142
|
|
|
25034
25143
|
// src/commands/github/issue/fixStructure/removeIssueLabels.ts
|
|
25035
25144
|
var MUTATION2 = `mutation($labelableId: ID!, $labelIds: [ID!]!) {
|
|
@@ -25066,7 +25175,7 @@ function writeLineNow(line) {
|
|
|
25066
25175
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
25067
25176
|
function applyFixStructurePlan(plan2) {
|
|
25068
25177
|
for (const entry of plan2.entries) {
|
|
25069
|
-
const where =
|
|
25178
|
+
const where = chalk166.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
25070
25179
|
const { typeChange, labelRemovals } = entry;
|
|
25071
25180
|
if (typeChange) {
|
|
25072
25181
|
writeLineNow(
|
|
@@ -25336,12 +25445,12 @@ function planSubtree(root2, context) {
|
|
|
25336
25445
|
function applyAndVerifySubtree(target, plan2, context) {
|
|
25337
25446
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) return;
|
|
25338
25447
|
applyFixStructurePlan(plan2);
|
|
25339
|
-
writeLineNow(
|
|
25448
|
+
writeLineNow(chalk167.dim("Re-walking the subtree to confirm"));
|
|
25340
25449
|
assertNoResidualDrift(
|
|
25341
25450
|
planSubtree(fetchRootIssue(target), context),
|
|
25342
25451
|
context.chain
|
|
25343
25452
|
);
|
|
25344
|
-
writeLineNow(
|
|
25453
|
+
writeLineNow(chalk167.green("Subtree normalised"));
|
|
25345
25454
|
}
|
|
25346
25455
|
|
|
25347
25456
|
// src/commands/github/issue/fixStructure/assertChainTypesExist.ts
|
|
@@ -25377,22 +25486,22 @@ function parseTypeChain(value) {
|
|
|
25377
25486
|
}
|
|
25378
25487
|
|
|
25379
25488
|
// src/commands/github/issue/fixStructure/printFixStructurePlan.ts
|
|
25380
|
-
import
|
|
25489
|
+
import chalk168 from "chalk";
|
|
25381
25490
|
function annotate(entry) {
|
|
25382
25491
|
const notes = [];
|
|
25383
25492
|
if (entry.level === null) {
|
|
25384
|
-
notes.push(
|
|
25493
|
+
notes.push(chalk168.red("deeper than the leaf level"));
|
|
25385
25494
|
} else if (entry.typeChange) {
|
|
25386
25495
|
notes.push(
|
|
25387
|
-
|
|
25496
|
+
chalk168.yellow(
|
|
25388
25497
|
`${entry.typeChange.from ?? "no type"} -> ${entry.typeChange.to}`
|
|
25389
25498
|
)
|
|
25390
25499
|
);
|
|
25391
25500
|
} else {
|
|
25392
|
-
notes.push(
|
|
25501
|
+
notes.push(chalk168.dim(entry.issue.typeName ?? "no type"));
|
|
25393
25502
|
}
|
|
25394
25503
|
for (const label2 of entry.labelRemovals) {
|
|
25395
|
-
notes.push(
|
|
25504
|
+
notes.push(chalk168.yellow(`-${label2.name}`));
|
|
25396
25505
|
}
|
|
25397
25506
|
return notes;
|
|
25398
25507
|
}
|
|
@@ -25400,22 +25509,22 @@ function formatCount(count10, noun) {
|
|
|
25400
25509
|
return `${count10} ${noun}${count10 === 1 ? "" : "s"}`;
|
|
25401
25510
|
}
|
|
25402
25511
|
function printFixStructurePlan(plan2, chain2, apply) {
|
|
25403
|
-
writeLineNow(
|
|
25512
|
+
writeLineNow(chalk168.dim(`chain: ${chain2.join(" > ")}`));
|
|
25404
25513
|
for (const entry of plan2.entries) {
|
|
25405
25514
|
const indent3 = " ".repeat(entry.issue.depth);
|
|
25406
|
-
const name =
|
|
25515
|
+
const name = chalk168.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
25407
25516
|
writeLineNow(
|
|
25408
25517
|
`${indent3}${name} ${entry.issue.title} [${annotate(entry).join(", ")}]`
|
|
25409
25518
|
);
|
|
25410
25519
|
}
|
|
25411
25520
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) {
|
|
25412
|
-
writeLineNow(
|
|
25521
|
+
writeLineNow(chalk168.green("Nothing to change"));
|
|
25413
25522
|
return;
|
|
25414
25523
|
}
|
|
25415
25524
|
writeLineNow(
|
|
25416
25525
|
`${formatCount(plan2.typeChangeCount, "type change")}, ${formatCount(plan2.labelRemovalCount, "label removal")} planned`
|
|
25417
25526
|
);
|
|
25418
|
-
if (!apply) writeLineNow(
|
|
25527
|
+
if (!apply) writeLineNow(chalk168.dim("Dry run \u2014 nothing written"));
|
|
25419
25528
|
}
|
|
25420
25529
|
|
|
25421
25530
|
// src/commands/github/issue/parseRepoSlug.ts
|
|
@@ -26772,7 +26881,7 @@ function registerGithub(program) {
|
|
|
26772
26881
|
}
|
|
26773
26882
|
|
|
26774
26883
|
// src/commands/jira/acceptanceCriteria.ts
|
|
26775
|
-
import
|
|
26884
|
+
import chalk169 from "chalk";
|
|
26776
26885
|
|
|
26777
26886
|
// src/commands/jira/adfToText.ts
|
|
26778
26887
|
function renderInline(node) {
|
|
@@ -26839,7 +26948,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
26839
26948
|
const parsed = fetchIssue(issueKey, field);
|
|
26840
26949
|
const acValue = parsed?.fields?.[field];
|
|
26841
26950
|
if (!acValue) {
|
|
26842
|
-
console.log(
|
|
26951
|
+
console.log(chalk169.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
26843
26952
|
return;
|
|
26844
26953
|
}
|
|
26845
26954
|
if (typeof acValue === "string") {
|
|
@@ -26905,14 +27014,14 @@ async function jiraAuth() {
|
|
|
26905
27014
|
}
|
|
26906
27015
|
|
|
26907
27016
|
// src/commands/jira/viewIssue.ts
|
|
26908
|
-
import
|
|
27017
|
+
import chalk170 from "chalk";
|
|
26909
27018
|
function viewIssue2(issueKey) {
|
|
26910
27019
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
26911
27020
|
const fields = parsed?.fields;
|
|
26912
27021
|
const summary = fields?.summary;
|
|
26913
27022
|
const description = fields?.description;
|
|
26914
27023
|
if (summary) {
|
|
26915
|
-
console.log(
|
|
27024
|
+
console.log(chalk170.bold(summary));
|
|
26916
27025
|
}
|
|
26917
27026
|
if (description) {
|
|
26918
27027
|
if (summary) console.log();
|
|
@@ -26926,7 +27035,7 @@ function viewIssue2(issueKey) {
|
|
|
26926
27035
|
}
|
|
26927
27036
|
if (!summary && !description) {
|
|
26928
27037
|
console.log(
|
|
26929
|
-
|
|
27038
|
+
chalk170.yellow(`No summary or description found on ${issueKey}.`)
|
|
26930
27039
|
);
|
|
26931
27040
|
}
|
|
26932
27041
|
}
|
|
@@ -26961,7 +27070,7 @@ import { randomUUID as randomUUID11 } from "crypto";
|
|
|
26961
27070
|
|
|
26962
27071
|
// src/commands/review/checkoutPr.ts
|
|
26963
27072
|
import { execFileSync as execFileSync18 } from "child_process";
|
|
26964
|
-
import
|
|
27073
|
+
import chalk171 from "chalk";
|
|
26965
27074
|
|
|
26966
27075
|
// src/commands/review/clearStalePrBranch.ts
|
|
26967
27076
|
var tipSetFromRemote = /^branch: (Created from|Reset to)|^fetch\b|: Fast-forward$/;
|
|
@@ -27699,11 +27808,11 @@ function failCheckout(number, headRef, stale, from) {
|
|
|
27699
27808
|
gitSyncOrNull(process.cwd(), ["checkout", "--quiet", from]);
|
|
27700
27809
|
if (headRef && stale === "local-work")
|
|
27701
27810
|
console.error(
|
|
27702
|
-
|
|
27811
|
+
chalk171.red(
|
|
27703
27812
|
`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.`
|
|
27704
27813
|
)
|
|
27705
27814
|
);
|
|
27706
|
-
console.error(
|
|
27815
|
+
console.error(chalk171.red(`gh pr checkout ${number} failed; aborting.`));
|
|
27707
27816
|
process.exit(1);
|
|
27708
27817
|
}
|
|
27709
27818
|
async function checkoutPr(number) {
|
|
@@ -27850,18 +27959,18 @@ function registerList(program) {
|
|
|
27850
27959
|
}
|
|
27851
27960
|
|
|
27852
27961
|
// src/commands/litellm/listModels.ts
|
|
27853
|
-
import
|
|
27962
|
+
import chalk173 from "chalk";
|
|
27854
27963
|
|
|
27855
27964
|
// src/commands/litellm/resolveLitellmConfig.ts
|
|
27856
|
-
import
|
|
27965
|
+
import chalk172 from "chalk";
|
|
27857
27966
|
function resolveLitellmConfig() {
|
|
27858
27967
|
const { config, missing } = readLitellmConfig();
|
|
27859
27968
|
if (!config) {
|
|
27860
|
-
console.error(
|
|
27969
|
+
console.error(chalk172.red("LiteLLM is not configured"));
|
|
27861
27970
|
for (const key of missing) {
|
|
27862
27971
|
const entry = litellmConfigHelp.find((help) => help.key === key);
|
|
27863
27972
|
console.error(
|
|
27864
|
-
|
|
27973
|
+
chalk172.red(` ${key} is not set. Set it with: ${entry?.setter}`)
|
|
27865
27974
|
);
|
|
27866
27975
|
}
|
|
27867
27976
|
process.exit(1);
|
|
@@ -27887,13 +27996,13 @@ async function listModels(options2) {
|
|
|
27887
27996
|
} catch (error) {
|
|
27888
27997
|
const reason4 = error instanceof Error ? error.message : String(error);
|
|
27889
27998
|
console.error(
|
|
27890
|
-
|
|
27999
|
+
chalk173.red(`Failed to reach LiteLLM at ${baseUrl}: ${reason4}`)
|
|
27891
28000
|
);
|
|
27892
28001
|
process.exit(1);
|
|
27893
28002
|
}
|
|
27894
28003
|
const body = await response.text();
|
|
27895
28004
|
if (!response.ok) {
|
|
27896
|
-
console.error(
|
|
28005
|
+
console.error(chalk173.red(`LiteLLM returned ${response.status}: ${body}`));
|
|
27897
28006
|
process.exit(1);
|
|
27898
28007
|
}
|
|
27899
28008
|
if (options2.json) {
|
|
@@ -27913,15 +28022,15 @@ function registerLitellm(program) {
|
|
|
27913
28022
|
// src/commands/mermaidExport.ts
|
|
27914
28023
|
import { mkdirSync as mkdirSync20, readdirSync as readdirSync11 } from "fs";
|
|
27915
28024
|
import { resolve as resolve20 } from "path";
|
|
27916
|
-
import
|
|
28025
|
+
import chalk176 from "chalk";
|
|
27917
28026
|
|
|
27918
28027
|
// src/commands/mermaid/exportFile.ts
|
|
27919
28028
|
import { readFileSync as readFileSync41, writeFileSync as writeFileSync33 } from "fs";
|
|
27920
28029
|
import { basename as basename20, extname as extname4, resolve as resolve19 } from "path";
|
|
27921
|
-
import
|
|
28030
|
+
import chalk175 from "chalk";
|
|
27922
28031
|
|
|
27923
28032
|
// src/commands/mermaid/renderBlock.ts
|
|
27924
|
-
import
|
|
28033
|
+
import chalk174 from "chalk";
|
|
27925
28034
|
async function renderBlock(krokiUrl, source) {
|
|
27926
28035
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
27927
28036
|
method: "POST",
|
|
@@ -27930,7 +28039,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
27930
28039
|
});
|
|
27931
28040
|
if (!response.ok) {
|
|
27932
28041
|
console.error(
|
|
27933
|
-
|
|
28042
|
+
chalk174.red(
|
|
27934
28043
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
27935
28044
|
)
|
|
27936
28045
|
);
|
|
@@ -27948,19 +28057,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
27948
28057
|
if (onlyIndex !== void 0) {
|
|
27949
28058
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
27950
28059
|
console.error(
|
|
27951
|
-
|
|
28060
|
+
chalk175.red(
|
|
27952
28061
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
27953
28062
|
)
|
|
27954
28063
|
);
|
|
27955
28064
|
process.exit(1);
|
|
27956
28065
|
}
|
|
27957
28066
|
console.log(
|
|
27958
|
-
|
|
28067
|
+
chalk175.gray(
|
|
27959
28068
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
27960
28069
|
)
|
|
27961
28070
|
);
|
|
27962
28071
|
} else {
|
|
27963
|
-
console.log(
|
|
28072
|
+
console.log(chalk175.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
27964
28073
|
}
|
|
27965
28074
|
for (const [i, source] of blocks.entries()) {
|
|
27966
28075
|
const idx = i + 1;
|
|
@@ -27968,7 +28077,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
27968
28077
|
const outPath = resolve19(outDir, `${stem}-${idx}.svg`);
|
|
27969
28078
|
const svg = await renderBlock(krokiUrl, source);
|
|
27970
28079
|
writeFileSync33(outPath, svg, "utf8");
|
|
27971
|
-
console.log(
|
|
28080
|
+
console.log(chalk175.green(` \u2192 ${outPath}`));
|
|
27972
28081
|
}
|
|
27973
28082
|
}
|
|
27974
28083
|
function extractMermaidBlocks(markdown) {
|
|
@@ -27984,18 +28093,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
27984
28093
|
if (options2.index !== void 0) {
|
|
27985
28094
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
27986
28095
|
console.error(
|
|
27987
|
-
|
|
28096
|
+
chalk176.red(`--index must be a positive integer (got ${options2.index})`)
|
|
27988
28097
|
);
|
|
27989
28098
|
process.exit(1);
|
|
27990
28099
|
}
|
|
27991
28100
|
if (!file) {
|
|
27992
|
-
console.error(
|
|
28101
|
+
console.error(chalk176.red("--index requires a file argument"));
|
|
27993
28102
|
process.exit(1);
|
|
27994
28103
|
}
|
|
27995
28104
|
}
|
|
27996
28105
|
const files = file ? [file] : readdirSync11(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
27997
28106
|
if (files.length === 0) {
|
|
27998
|
-
console.log(
|
|
28107
|
+
console.log(chalk176.gray("No markdown files found in current directory."));
|
|
27999
28108
|
return;
|
|
28000
28109
|
}
|
|
28001
28110
|
for (const f of files) {
|
|
@@ -28141,7 +28250,7 @@ function extractToSave(details, cwd = process.cwd()) {
|
|
|
28141
28250
|
}
|
|
28142
28251
|
|
|
28143
28252
|
// src/commands/miro/keptTexts.ts
|
|
28144
|
-
import
|
|
28253
|
+
import chalk177 from "chalk";
|
|
28145
28254
|
|
|
28146
28255
|
// src/commands/miro/applyIgnore.ts
|
|
28147
28256
|
function applyIgnore(texts, ignore3) {
|
|
@@ -28180,7 +28289,7 @@ function warnUnmatched(file, unmatched) {
|
|
|
28180
28289
|
if (unmatched.length === 0) return;
|
|
28181
28290
|
const entries = unmatched.map((entry) => ` - ${entry}`).join("\n");
|
|
28182
28291
|
console.error(
|
|
28183
|
-
|
|
28292
|
+
chalk177.yellow(
|
|
28184
28293
|
`${unmatched.length} ${unmatched.length === 1 ? "entry" : "entries"} in ${file} matched no box text:
|
|
28185
28294
|
${entries}`
|
|
28186
28295
|
)
|
|
@@ -28381,7 +28490,7 @@ function readMiroItems(file) {
|
|
|
28381
28490
|
}
|
|
28382
28491
|
|
|
28383
28492
|
// src/commands/miro/resolveExtractOptions.ts
|
|
28384
|
-
import
|
|
28493
|
+
import chalk178 from "chalk";
|
|
28385
28494
|
|
|
28386
28495
|
// src/commands/miro/extractLayers.ts
|
|
28387
28496
|
function extractsIn(layer) {
|
|
@@ -28459,7 +28568,7 @@ function resolveExtractOptions(name, options2, paths) {
|
|
|
28459
28568
|
paths.cwd,
|
|
28460
28569
|
paths.globalConfigPath
|
|
28461
28570
|
);
|
|
28462
|
-
console.error(
|
|
28571
|
+
console.error(chalk178.dim(`Extract "${name}" from ${resolved.from}`));
|
|
28463
28572
|
return resolved.options;
|
|
28464
28573
|
}
|
|
28465
28574
|
|
|
@@ -28561,7 +28670,7 @@ function registerMiro(program) {
|
|
|
28561
28670
|
import { mkdir as mkdir6 } from "fs/promises";
|
|
28562
28671
|
import { createServer as createServer2 } from "http";
|
|
28563
28672
|
import { dirname as dirname35 } from "path";
|
|
28564
|
-
import
|
|
28673
|
+
import chalk180 from "chalk";
|
|
28565
28674
|
|
|
28566
28675
|
// src/commands/netcap/corsHeaders.ts
|
|
28567
28676
|
var corsHeaders = {
|
|
@@ -28640,7 +28749,7 @@ function createNetcapHandler(options2) {
|
|
|
28640
28749
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
28641
28750
|
import { networkInterfaces } from "os";
|
|
28642
28751
|
import { join as join74 } from "path";
|
|
28643
|
-
import
|
|
28752
|
+
import chalk179 from "chalk";
|
|
28644
28753
|
|
|
28645
28754
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
28646
28755
|
import { dirname as dirname34, join as join73 } from "path";
|
|
@@ -28684,7 +28793,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
28684
28793
|
const host = lanIPv4();
|
|
28685
28794
|
if (!host) {
|
|
28686
28795
|
console.log(
|
|
28687
|
-
|
|
28796
|
+
chalk179.yellow("could not determine the WSL IP for the extension")
|
|
28688
28797
|
);
|
|
28689
28798
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
28690
28799
|
return source;
|
|
@@ -28695,7 +28804,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
28695
28804
|
return WSL_WINDOWS_PATH3;
|
|
28696
28805
|
} catch {
|
|
28697
28806
|
console.log(
|
|
28698
|
-
|
|
28807
|
+
chalk179.yellow(`could not copy extension to ${WSL_WINDOWS_PATH3}`)
|
|
28699
28808
|
);
|
|
28700
28809
|
return source;
|
|
28701
28810
|
}
|
|
@@ -28728,30 +28837,30 @@ async function netcap(options2) {
|
|
|
28728
28837
|
let count10 = 0;
|
|
28729
28838
|
const handler = createNetcapHandler({
|
|
28730
28839
|
outPath,
|
|
28731
|
-
onPing: () => console.log(
|
|
28840
|
+
onPing: () => console.log(chalk180.dim("ping from extension")),
|
|
28732
28841
|
onCapture: (entry) => {
|
|
28733
28842
|
count10 += 1;
|
|
28734
28843
|
console.log(
|
|
28735
|
-
|
|
28736
|
-
|
|
28844
|
+
chalk180.green(`captured #${count10}`),
|
|
28845
|
+
chalk180.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
28737
28846
|
);
|
|
28738
28847
|
}
|
|
28739
28848
|
});
|
|
28740
28849
|
const server = createServer2(handler);
|
|
28741
28850
|
server.listen(port, () => {
|
|
28742
28851
|
console.log(
|
|
28743
|
-
|
|
28852
|
+
chalk180.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
28744
28853
|
);
|
|
28745
|
-
console.log(
|
|
28854
|
+
console.log(chalk180.dim(`appending captures to ${outPath}`));
|
|
28746
28855
|
if (filter)
|
|
28747
|
-
console.log(
|
|
28748
|
-
console.log(
|
|
28749
|
-
console.log(
|
|
28856
|
+
console.log(chalk180.dim(`forwarding only URLs matching "${filter}"`));
|
|
28857
|
+
console.log(chalk180.dim(`load the unpacked extension from ${extensionPath}`));
|
|
28858
|
+
console.log(chalk180.dim("press Ctrl-C to stop"));
|
|
28750
28859
|
});
|
|
28751
28860
|
process.on("SIGINT", () => {
|
|
28752
28861
|
server.close();
|
|
28753
28862
|
console.log(
|
|
28754
|
-
|
|
28863
|
+
chalk180.bold(
|
|
28755
28864
|
`
|
|
28756
28865
|
netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
28757
28866
|
)
|
|
@@ -28763,7 +28872,7 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
28763
28872
|
// src/commands/netcap/netcapExtract.ts
|
|
28764
28873
|
import { writeFileSync as writeFileSync35 } from "fs";
|
|
28765
28874
|
import { join as join77 } from "path";
|
|
28766
|
-
import
|
|
28875
|
+
import chalk181 from "chalk";
|
|
28767
28876
|
|
|
28768
28877
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
28769
28878
|
import { readFileSync as readFileSync44 } from "fs";
|
|
@@ -29211,8 +29320,8 @@ function netcapExtract(file) {
|
|
|
29211
29320
|
writeFileSync35(outFile, `${JSON.stringify(posts, null, 2)}
|
|
29212
29321
|
`);
|
|
29213
29322
|
console.log(
|
|
29214
|
-
|
|
29215
|
-
|
|
29323
|
+
chalk181.green(`extracted ${posts.length} posts`),
|
|
29324
|
+
chalk181.dim(`-> ${outFile}`)
|
|
29216
29325
|
);
|
|
29217
29326
|
}
|
|
29218
29327
|
|
|
@@ -29233,7 +29342,7 @@ function registerNetcap(program) {
|
|
|
29233
29342
|
}
|
|
29234
29343
|
|
|
29235
29344
|
// src/commands/news/add.ts
|
|
29236
|
-
import
|
|
29345
|
+
import chalk182 from "chalk";
|
|
29237
29346
|
import enquirer8 from "enquirer";
|
|
29238
29347
|
async function add2(url) {
|
|
29239
29348
|
if (!url) {
|
|
@@ -29252,19 +29361,51 @@ async function add2(url) {
|
|
|
29252
29361
|
});
|
|
29253
29362
|
url = response.url;
|
|
29254
29363
|
}
|
|
29255
|
-
const
|
|
29256
|
-
const added = await addFeed(orm, url);
|
|
29364
|
+
const added = await addFeed(await getDb(), url);
|
|
29257
29365
|
if (!added) {
|
|
29258
|
-
console.log(
|
|
29366
|
+
console.log(chalk182.yellow("Feed already exists"));
|
|
29367
|
+
return;
|
|
29368
|
+
}
|
|
29369
|
+
console.log(chalk182.green(`Added feed: ${url}`));
|
|
29370
|
+
}
|
|
29371
|
+
|
|
29372
|
+
// src/commands/news/list.ts
|
|
29373
|
+
import chalk183 from "chalk";
|
|
29374
|
+
async function list3() {
|
|
29375
|
+
const urls = await listFeeds(await getDb());
|
|
29376
|
+
if (urls.length === 0) {
|
|
29377
|
+
console.log(chalk183.dim("No feeds; add one with assist news add <url>"));
|
|
29259
29378
|
return;
|
|
29260
29379
|
}
|
|
29261
|
-
console.log(
|
|
29380
|
+
for (const url of urls) console.log(url);
|
|
29381
|
+
}
|
|
29382
|
+
|
|
29383
|
+
// src/commands/news/remove.ts
|
|
29384
|
+
import chalk184 from "chalk";
|
|
29385
|
+
|
|
29386
|
+
// src/commands/backlog/removeFeed.ts
|
|
29387
|
+
import { eq as eq43 } from "drizzle-orm";
|
|
29388
|
+
async function removeFeed(db, url) {
|
|
29389
|
+
const deleted = await db.delete(feeds).where(eq43(feeds.url, url)).returning({ id: feeds.id });
|
|
29390
|
+
return deleted.length > 0;
|
|
29391
|
+
}
|
|
29392
|
+
|
|
29393
|
+
// src/commands/news/remove.ts
|
|
29394
|
+
async function remove(url) {
|
|
29395
|
+
const removed = await removeFeed(await getDb(), url);
|
|
29396
|
+
if (!removed) {
|
|
29397
|
+
console.log(chalk184.yellow(`No feed matches ${url}`));
|
|
29398
|
+
return;
|
|
29399
|
+
}
|
|
29400
|
+
console.log(chalk184.green(`Removed feed: ${url}`));
|
|
29262
29401
|
}
|
|
29263
29402
|
|
|
29264
29403
|
// src/commands/registerNews.ts
|
|
29265
29404
|
function registerNews(program) {
|
|
29266
29405
|
const newsCommand = program.command("news").description("Manage RSS news feeds");
|
|
29267
|
-
newsCommand.command("add").description("Add an RSS feed URL").argument("<url>", "RSS feed URL").action(add2);
|
|
29406
|
+
newsCommand.command("add").description("Add an RSS feed URL to news.feeds").argument("<url>", "RSS feed URL").action(add2);
|
|
29407
|
+
newsCommand.command("list").description("List the RSS feed URLs in news.feeds").action(list3);
|
|
29408
|
+
newsCommand.command("remove").description("Remove an RSS feed URL from news.feeds").argument("<url>", "RSS feed URL").action(remove);
|
|
29268
29409
|
configHelp(newsCommand, newsConfigHelp);
|
|
29269
29410
|
}
|
|
29270
29411
|
|
|
@@ -29306,7 +29447,7 @@ function registerPiHook(program) {
|
|
|
29306
29447
|
}
|
|
29307
29448
|
|
|
29308
29449
|
// src/commands/prompts/printPromptsTable.ts
|
|
29309
|
-
import
|
|
29450
|
+
import chalk185 from "chalk";
|
|
29310
29451
|
function truncate(str, max) {
|
|
29311
29452
|
if (str.length <= max) return str;
|
|
29312
29453
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -29324,14 +29465,14 @@ function printPromptsTable(rows) {
|
|
|
29324
29465
|
"Command".padEnd(commandWidth),
|
|
29325
29466
|
"Repos"
|
|
29326
29467
|
].join(" ");
|
|
29327
|
-
console.log(
|
|
29328
|
-
console.log(
|
|
29468
|
+
console.log(chalk185.dim(header));
|
|
29469
|
+
console.log(chalk185.dim("-".repeat(header.length)));
|
|
29329
29470
|
for (const row3 of rows) {
|
|
29330
29471
|
const count10 = String(row3.count).padStart(countWidth);
|
|
29331
29472
|
const tool = row3.tool.padEnd(toolWidth);
|
|
29332
29473
|
const command = truncate(row3.command, 60).padEnd(commandWidth);
|
|
29333
29474
|
console.log(
|
|
29334
|
-
`${
|
|
29475
|
+
`${chalk185.yellow(count10)} ${tool} ${command} ${chalk185.dim(row3.repos)}`
|
|
29335
29476
|
);
|
|
29336
29477
|
}
|
|
29337
29478
|
}
|
|
@@ -29366,13 +29507,13 @@ import { execSync as execSync39 } from "child_process";
|
|
|
29366
29507
|
import enquirer9 from "enquirer";
|
|
29367
29508
|
|
|
29368
29509
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
29369
|
-
import
|
|
29510
|
+
import chalk186 from "chalk";
|
|
29370
29511
|
var STATUS_MAP = {
|
|
29371
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
29372
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
29512
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk186.magenta("merged"), date: pr.mergedAt } : null,
|
|
29513
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk186.red("closed"), date: pr.closedAt } : null
|
|
29373
29514
|
};
|
|
29374
29515
|
function defaultStatus(pr) {
|
|
29375
|
-
return { label:
|
|
29516
|
+
return { label: chalk186.green("opened"), date: pr.createdAt };
|
|
29376
29517
|
}
|
|
29377
29518
|
function getStatus2(pr) {
|
|
29378
29519
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -29381,11 +29522,11 @@ function formatDate(dateStr) {
|
|
|
29381
29522
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
29382
29523
|
}
|
|
29383
29524
|
function formatPrHeader(pr, status2) {
|
|
29384
|
-
return `${
|
|
29525
|
+
return `${chalk186.cyan(`#${pr.number}`)} ${pr.title} ${chalk186.dim(`(${pr.author.login},`)} ${status2.label} ${chalk186.dim(`${formatDate(status2.date)})`)}`;
|
|
29385
29526
|
}
|
|
29386
29527
|
function logPrDetails(pr) {
|
|
29387
29528
|
console.log(
|
|
29388
|
-
|
|
29529
|
+
chalk186.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
29389
29530
|
);
|
|
29390
29531
|
console.log();
|
|
29391
29532
|
}
|
|
@@ -29870,13 +30011,13 @@ function agentFooter(unresolvedCount) {
|
|
|
29870
30011
|
}
|
|
29871
30012
|
|
|
29872
30013
|
// src/commands/prs/listComments/commentStyle.ts
|
|
29873
|
-
import
|
|
30014
|
+
import chalk187 from "chalk";
|
|
29874
30015
|
var plain = (text17) => text17;
|
|
29875
30016
|
function colouredState(state) {
|
|
29876
30017
|
const label2 = `[${state}]`;
|
|
29877
|
-
if (state === "APPROVED") return
|
|
29878
|
-
if (state === "CHANGES_REQUESTED") return
|
|
29879
|
-
return
|
|
30018
|
+
if (state === "APPROVED") return chalk187.green(label2);
|
|
30019
|
+
if (state === "CHANGES_REQUESTED") return chalk187.red(label2);
|
|
30020
|
+
return chalk187.yellow(label2);
|
|
29880
30021
|
}
|
|
29881
30022
|
function commentStyle() {
|
|
29882
30023
|
if (isClaudeCode()) {
|
|
@@ -29890,9 +30031,9 @@ function commentStyle() {
|
|
|
29890
30031
|
};
|
|
29891
30032
|
}
|
|
29892
30033
|
return {
|
|
29893
|
-
cyan:
|
|
29894
|
-
bold:
|
|
29895
|
-
dim:
|
|
30034
|
+
cyan: chalk187.cyan,
|
|
30035
|
+
bold: chalk187.bold,
|
|
30036
|
+
dim: chalk187.dim,
|
|
29896
30037
|
state: colouredState,
|
|
29897
30038
|
diffHunk: true,
|
|
29898
30039
|
agent: false
|
|
@@ -31176,16 +31317,16 @@ function buildPrsStatusReport(repoArguments, now = Date.now()) {
|
|
|
31176
31317
|
}
|
|
31177
31318
|
|
|
31178
31319
|
// src/commands/prs/status/printPrsStatus.ts
|
|
31179
|
-
import
|
|
31320
|
+
import chalk189 from "chalk";
|
|
31180
31321
|
|
|
31181
31322
|
// src/commands/prs/status/printPrStatus.ts
|
|
31182
|
-
import
|
|
31323
|
+
import chalk188 from "chalk";
|
|
31183
31324
|
function flags(pr) {
|
|
31184
31325
|
const markers = [];
|
|
31185
31326
|
if (pr.isDraft) markers.push("draft");
|
|
31186
31327
|
if (pr.isDoNotMerge) markers.push("do not merge");
|
|
31187
31328
|
if (pr.isBot) markers.push("bot");
|
|
31188
|
-
return markers.length ? ` ${
|
|
31329
|
+
return markers.length ? ` ${chalk188.yellow(`[${markers.join(", ")}]`)}` : "";
|
|
31189
31330
|
}
|
|
31190
31331
|
function updated(pr) {
|
|
31191
31332
|
return pr.ageHours === null ? "updated unknown" : `updated ${pr.age} ago`;
|
|
@@ -31199,35 +31340,35 @@ function reviewLine(pr) {
|
|
|
31199
31340
|
function checkLines(pr) {
|
|
31200
31341
|
const lines2 = [];
|
|
31201
31342
|
if (pr.checks.failing.length) {
|
|
31202
|
-
lines2.push(
|
|
31343
|
+
lines2.push(chalk188.red(`failing: ${pr.checks.failing.join(", ")}`));
|
|
31203
31344
|
}
|
|
31204
31345
|
if (pr.checks.pending.length) {
|
|
31205
|
-
lines2.push(
|
|
31346
|
+
lines2.push(chalk188.yellow(`pending: ${pr.checks.pending.join(", ")}`));
|
|
31206
31347
|
}
|
|
31207
31348
|
return lines2;
|
|
31208
31349
|
}
|
|
31209
31350
|
function threadsLine(pr) {
|
|
31210
31351
|
if (pr.unresolvedThreads === null) {
|
|
31211
|
-
return
|
|
31352
|
+
return chalk188.dim("unresolved comments: unknown");
|
|
31212
31353
|
}
|
|
31213
31354
|
if (pr.unresolvedThreads === 0) return null;
|
|
31214
|
-
return
|
|
31355
|
+
return chalk188.yellow(`unresolved comments: ${pr.unresolvedThreads}`);
|
|
31215
31356
|
}
|
|
31216
31357
|
function mergeableLine(pr) {
|
|
31217
|
-
if (pr.mergeable === "CONFLICTING") return
|
|
31358
|
+
if (pr.mergeable === "CONFLICTING") return chalk188.red("conflicting");
|
|
31218
31359
|
if (pr.mergeable === "MERGEABLE") return null;
|
|
31219
|
-
return
|
|
31360
|
+
return chalk188.dim(`mergeable: ${pr.mergeable.toLowerCase()}`);
|
|
31220
31361
|
}
|
|
31221
31362
|
function printPrStatus(pr) {
|
|
31222
31363
|
console.log(
|
|
31223
|
-
` ${
|
|
31364
|
+
` ${chalk188.cyan(`#${pr.number}`)} ${pr.title} ${chalk188.dim(`(${pr.author}, ${updated(pr)})`)}${flags(pr)}`
|
|
31224
31365
|
);
|
|
31225
31366
|
const details = [
|
|
31226
31367
|
reviewLine(pr),
|
|
31227
31368
|
...checkLines(pr),
|
|
31228
31369
|
threadsLine(pr),
|
|
31229
31370
|
mergeableLine(pr),
|
|
31230
|
-
|
|
31371
|
+
chalk188.dim(pr.url)
|
|
31231
31372
|
];
|
|
31232
31373
|
for (const detail of details) {
|
|
31233
31374
|
if (detail) console.log(` ${detail}`);
|
|
@@ -31238,17 +31379,17 @@ function printPrStatus(pr) {
|
|
|
31238
31379
|
function printPrsStatus(report) {
|
|
31239
31380
|
for (const repo of report.repos) {
|
|
31240
31381
|
const count10 = repo.pullRequests.length;
|
|
31241
|
-
console.log(`${
|
|
31382
|
+
console.log(`${chalk189.bold(repo.repo)} ${chalk189.dim(`(${count10} open)`)}`);
|
|
31242
31383
|
for (const pr of repo.pullRequests) {
|
|
31243
31384
|
printPrStatus(pr);
|
|
31244
31385
|
}
|
|
31245
|
-
if (count10 === 0) console.log(
|
|
31386
|
+
if (count10 === 0) console.log(chalk189.dim(" no open pull requests"));
|
|
31246
31387
|
console.log();
|
|
31247
31388
|
}
|
|
31248
31389
|
if (report.errors.length === 0) return;
|
|
31249
|
-
console.log(
|
|
31390
|
+
console.log(chalk189.bold("Errors"));
|
|
31250
31391
|
for (const failure of report.errors) {
|
|
31251
|
-
console.log(` ${
|
|
31392
|
+
console.log(` ${chalk189.red(failure.repo)}: ${failure.error}`);
|
|
31252
31393
|
}
|
|
31253
31394
|
console.log();
|
|
31254
31395
|
}
|
|
@@ -31470,10 +31611,10 @@ function registerPrs(program) {
|
|
|
31470
31611
|
}
|
|
31471
31612
|
|
|
31472
31613
|
// src/commands/ravendb/ravendbAuth.ts
|
|
31473
|
-
import
|
|
31614
|
+
import chalk195 from "chalk";
|
|
31474
31615
|
|
|
31475
31616
|
// src/shared/createConnectionAuth.ts
|
|
31476
|
-
import
|
|
31617
|
+
import chalk190 from "chalk";
|
|
31477
31618
|
function listConnections(connections, format3) {
|
|
31478
31619
|
if (connections.length === 0) {
|
|
31479
31620
|
console.log("No connections configured.");
|
|
@@ -31486,7 +31627,7 @@ function listConnections(connections, format3) {
|
|
|
31486
31627
|
function removeConnection(connections, name, save) {
|
|
31487
31628
|
const filtered = connections.filter((c) => c.name !== name);
|
|
31488
31629
|
if (filtered.length === connections.length) {
|
|
31489
|
-
console.error(
|
|
31630
|
+
console.error(chalk190.red(`Connection "${name}" not found.`));
|
|
31490
31631
|
process.exit(1);
|
|
31491
31632
|
}
|
|
31492
31633
|
save(filtered);
|
|
@@ -31532,15 +31673,15 @@ function saveConnections(connections) {
|
|
|
31532
31673
|
}
|
|
31533
31674
|
|
|
31534
31675
|
// src/commands/ravendb/promptConnection.ts
|
|
31535
|
-
import
|
|
31676
|
+
import chalk193 from "chalk";
|
|
31536
31677
|
|
|
31537
31678
|
// src/commands/ravendb/selectOpSecret.ts
|
|
31538
|
-
import
|
|
31679
|
+
import chalk192 from "chalk";
|
|
31539
31680
|
import Enquirer2 from "enquirer";
|
|
31540
31681
|
|
|
31541
31682
|
// src/commands/ravendb/searchItems.ts
|
|
31542
31683
|
import { execSync as execSync46 } from "child_process";
|
|
31543
|
-
import
|
|
31684
|
+
import chalk191 from "chalk";
|
|
31544
31685
|
function opExec(args) {
|
|
31545
31686
|
return execSync46(`op ${args}`, {
|
|
31546
31687
|
encoding: "utf8",
|
|
@@ -31553,7 +31694,7 @@ function searchItems(search2) {
|
|
|
31553
31694
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
31554
31695
|
} catch {
|
|
31555
31696
|
console.error(
|
|
31556
|
-
|
|
31697
|
+
chalk191.red(
|
|
31557
31698
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
31558
31699
|
)
|
|
31559
31700
|
);
|
|
@@ -31567,7 +31708,7 @@ function getItemFields(itemId2) {
|
|
|
31567
31708
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
31568
31709
|
return item.fields.filter((f) => f.reference && f.label);
|
|
31569
31710
|
} catch {
|
|
31570
|
-
console.error(
|
|
31711
|
+
console.error(chalk191.red("Failed to get item details from 1Password."));
|
|
31571
31712
|
process.exit(1);
|
|
31572
31713
|
}
|
|
31573
31714
|
}
|
|
@@ -31586,7 +31727,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
31586
31727
|
}).run();
|
|
31587
31728
|
const items2 = searchItems(search2);
|
|
31588
31729
|
if (items2.length === 0) {
|
|
31589
|
-
console.error(
|
|
31730
|
+
console.error(chalk192.red(`No items found matching "${search2}".`));
|
|
31590
31731
|
process.exit(1);
|
|
31591
31732
|
}
|
|
31592
31733
|
const itemId2 = await selectOne(
|
|
@@ -31595,7 +31736,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
31595
31736
|
);
|
|
31596
31737
|
const fields = getItemFields(itemId2);
|
|
31597
31738
|
if (fields.length === 0) {
|
|
31598
|
-
console.error(
|
|
31739
|
+
console.error(chalk192.red("No fields with references found on this item."));
|
|
31599
31740
|
process.exit(1);
|
|
31600
31741
|
}
|
|
31601
31742
|
const ref = await selectOne(
|
|
@@ -31609,7 +31750,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
31609
31750
|
async function promptConnection(existingNames) {
|
|
31610
31751
|
const name = await promptInput("name", "Connection name:");
|
|
31611
31752
|
if (existingNames.includes(name)) {
|
|
31612
|
-
console.error(
|
|
31753
|
+
console.error(chalk193.red(`Connection "${name}" already exists.`));
|
|
31613
31754
|
process.exit(1);
|
|
31614
31755
|
}
|
|
31615
31756
|
const url = await promptInput(
|
|
@@ -31618,22 +31759,22 @@ async function promptConnection(existingNames) {
|
|
|
31618
31759
|
);
|
|
31619
31760
|
const database = await promptInput("database", "Database name:");
|
|
31620
31761
|
if (!name || !url || !database) {
|
|
31621
|
-
console.error(
|
|
31762
|
+
console.error(chalk193.red("All fields are required."));
|
|
31622
31763
|
process.exit(1);
|
|
31623
31764
|
}
|
|
31624
31765
|
const apiKeyRef = await selectOpSecret();
|
|
31625
|
-
console.log(
|
|
31766
|
+
console.log(chalk193.dim(`Using: ${apiKeyRef}`));
|
|
31626
31767
|
return { name, url, database, apiKeyRef };
|
|
31627
31768
|
}
|
|
31628
31769
|
|
|
31629
31770
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
31630
|
-
import
|
|
31771
|
+
import chalk194 from "chalk";
|
|
31631
31772
|
function ravendbSetConnection(name) {
|
|
31632
31773
|
const raw = loadGlobalConfigRaw();
|
|
31633
31774
|
const ravendb = raw.ravendb ?? {};
|
|
31634
31775
|
const connections = ravendb.connections ?? [];
|
|
31635
31776
|
if (!connections.some((c) => c.name === name)) {
|
|
31636
|
-
console.error(
|
|
31777
|
+
console.error(chalk194.red(`Connection "${name}" not found.`));
|
|
31637
31778
|
console.error(
|
|
31638
31779
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
31639
31780
|
);
|
|
@@ -31649,16 +31790,16 @@ function ravendbSetConnection(name) {
|
|
|
31649
31790
|
var ravendbAuth = createConnectionAuth({
|
|
31650
31791
|
load: loadConnections,
|
|
31651
31792
|
save: saveConnections,
|
|
31652
|
-
format: (c) => `${
|
|
31793
|
+
format: (c) => `${chalk195.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
31653
31794
|
promptNew: promptConnection,
|
|
31654
31795
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
31655
31796
|
});
|
|
31656
31797
|
|
|
31657
31798
|
// src/commands/ravendb/ravendbCollections.ts
|
|
31658
|
-
import
|
|
31799
|
+
import chalk199 from "chalk";
|
|
31659
31800
|
|
|
31660
31801
|
// src/commands/ravendb/ravenFetch.ts
|
|
31661
|
-
import
|
|
31802
|
+
import chalk197 from "chalk";
|
|
31662
31803
|
|
|
31663
31804
|
// src/commands/ravendb/getAccessToken.ts
|
|
31664
31805
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -31695,10 +31836,10 @@ ${errorText}`
|
|
|
31695
31836
|
|
|
31696
31837
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
31697
31838
|
import { execSync as execSync47 } from "child_process";
|
|
31698
|
-
import
|
|
31839
|
+
import chalk196 from "chalk";
|
|
31699
31840
|
function resolveOpSecret(reference) {
|
|
31700
31841
|
if (!reference.startsWith("op://")) {
|
|
31701
|
-
console.error(
|
|
31842
|
+
console.error(chalk196.red(`Invalid secret reference: must start with op://`));
|
|
31702
31843
|
process.exit(1);
|
|
31703
31844
|
}
|
|
31704
31845
|
try {
|
|
@@ -31708,7 +31849,7 @@ function resolveOpSecret(reference) {
|
|
|
31708
31849
|
}).trim();
|
|
31709
31850
|
} catch {
|
|
31710
31851
|
console.error(
|
|
31711
|
-
|
|
31852
|
+
chalk196.red(
|
|
31712
31853
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
31713
31854
|
)
|
|
31714
31855
|
);
|
|
@@ -31735,7 +31876,7 @@ async function ravenFetch(connection, path108) {
|
|
|
31735
31876
|
if (!response.ok) {
|
|
31736
31877
|
const body = await response.text();
|
|
31737
31878
|
console.error(
|
|
31738
|
-
|
|
31879
|
+
chalk197.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
31739
31880
|
);
|
|
31740
31881
|
console.error(body.substring(0, 500));
|
|
31741
31882
|
process.exit(1);
|
|
@@ -31744,7 +31885,7 @@ async function ravenFetch(connection, path108) {
|
|
|
31744
31885
|
}
|
|
31745
31886
|
|
|
31746
31887
|
// src/commands/ravendb/resolveConnection.ts
|
|
31747
|
-
import
|
|
31888
|
+
import chalk198 from "chalk";
|
|
31748
31889
|
function loadRavendb() {
|
|
31749
31890
|
const raw = loadGlobalConfigRaw();
|
|
31750
31891
|
const ravendb = raw.ravendb;
|
|
@@ -31758,7 +31899,7 @@ function resolveConnection(name) {
|
|
|
31758
31899
|
const connectionName = name ?? defaultConnection;
|
|
31759
31900
|
if (!connectionName) {
|
|
31760
31901
|
console.error(
|
|
31761
|
-
|
|
31902
|
+
chalk198.red(
|
|
31762
31903
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
31763
31904
|
)
|
|
31764
31905
|
);
|
|
@@ -31766,7 +31907,7 @@ function resolveConnection(name) {
|
|
|
31766
31907
|
}
|
|
31767
31908
|
const connection = connections.find((c) => c.name === connectionName);
|
|
31768
31909
|
if (!connection) {
|
|
31769
|
-
console.error(
|
|
31910
|
+
console.error(chalk198.red(`Connection "${connectionName}" not found.`));
|
|
31770
31911
|
console.error(
|
|
31771
31912
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
31772
31913
|
);
|
|
@@ -31797,15 +31938,15 @@ async function ravendbCollections(connectionName) {
|
|
|
31797
31938
|
return;
|
|
31798
31939
|
}
|
|
31799
31940
|
for (const c of collections) {
|
|
31800
|
-
console.log(`${
|
|
31941
|
+
console.log(`${chalk199.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
31801
31942
|
}
|
|
31802
31943
|
}
|
|
31803
31944
|
|
|
31804
31945
|
// src/commands/ravendb/ravendbQuery.ts
|
|
31805
|
-
import
|
|
31946
|
+
import chalk201 from "chalk";
|
|
31806
31947
|
|
|
31807
31948
|
// src/commands/ravendb/fetchAllPages.ts
|
|
31808
|
-
import
|
|
31949
|
+
import chalk200 from "chalk";
|
|
31809
31950
|
|
|
31810
31951
|
// src/commands/ravendb/buildQueryPath.ts
|
|
31811
31952
|
function buildQueryPath(opts) {
|
|
@@ -31843,7 +31984,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
31843
31984
|
allResults.push(...results);
|
|
31844
31985
|
start2 += results.length;
|
|
31845
31986
|
process.stderr.write(
|
|
31846
|
-
`\r${
|
|
31987
|
+
`\r${chalk200.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
31847
31988
|
);
|
|
31848
31989
|
if (start2 >= totalResults) break;
|
|
31849
31990
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -31858,7 +31999,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
31858
31999
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
31859
32000
|
const resolved = resolveArgs(connectionName, collection);
|
|
31860
32001
|
if (!resolved.collection && !options2.query) {
|
|
31861
|
-
console.error(
|
|
32002
|
+
console.error(chalk201.red("Provide a collection name or --query filter."));
|
|
31862
32003
|
process.exit(1);
|
|
31863
32004
|
}
|
|
31864
32005
|
const { collection: col } = resolved;
|
|
@@ -31893,7 +32034,7 @@ function registerRavendb(program) {
|
|
|
31893
32034
|
}
|
|
31894
32035
|
|
|
31895
32036
|
// src/commands/releases/releasesConfigure.ts
|
|
31896
|
-
import
|
|
32037
|
+
import chalk203 from "chalk";
|
|
31897
32038
|
|
|
31898
32039
|
// src/commands/releases/checkStreamGraph.ts
|
|
31899
32040
|
function nodeIds(stream) {
|
|
@@ -31955,26 +32096,26 @@ function readStreamsInput(source) {
|
|
|
31955
32096
|
}
|
|
31956
32097
|
|
|
31957
32098
|
// src/commands/releases/reportDerivedStreams.ts
|
|
31958
|
-
import
|
|
32099
|
+
import chalk202 from "chalk";
|
|
31959
32100
|
function printDerived(stream) {
|
|
31960
32101
|
const environments = stream.nodes.flatMap((n) => n.environment ?? []);
|
|
31961
32102
|
const steps = stream.nodes.filter((n) => !n.environment);
|
|
31962
32103
|
console.log(
|
|
31963
|
-
`${
|
|
32104
|
+
`${chalk202.bold(stream.name)} ${chalk202.dim(`${stream.repo} \xB7 ${stream.workflow}`)}`
|
|
31964
32105
|
);
|
|
31965
32106
|
console.log(
|
|
31966
|
-
` environments: ${environments.join(", ") ||
|
|
32107
|
+
` environments: ${environments.join(", ") || chalk202.dim("none")}`
|
|
31967
32108
|
);
|
|
31968
32109
|
if (steps.length > 0)
|
|
31969
32110
|
console.log(
|
|
31970
32111
|
` steps: ${steps.map((n) => `${n.id} [${n.kind ?? "step"}]`).join(", ")}`
|
|
31971
32112
|
);
|
|
31972
32113
|
const edges = stream.edges.map(([from, to]) => `${from} \u2192 ${to}`);
|
|
31973
|
-
console.log(` edges: ${edges.join(", ") ||
|
|
32114
|
+
console.log(` edges: ${edges.join(", ") || chalk202.dim("none")}`);
|
|
31974
32115
|
}
|
|
31975
32116
|
function reportDerivedStreams(streams, target) {
|
|
31976
32117
|
for (const stream of streams) printDerived(stream);
|
|
31977
|
-
console.log(
|
|
32118
|
+
console.log(chalk202.dim(`Written to ${target}`));
|
|
31978
32119
|
}
|
|
31979
32120
|
|
|
31980
32121
|
// src/commands/releases/withCurrentRepo.ts
|
|
@@ -32062,8 +32203,8 @@ async function writeReleaseStreams(incoming, scope) {
|
|
|
32062
32203
|
|
|
32063
32204
|
// src/commands/releases/releasesConfigure.ts
|
|
32064
32205
|
function fail6(message3, details = []) {
|
|
32065
|
-
console.error(
|
|
32066
|
-
for (const detail of details) console.error(
|
|
32206
|
+
console.error(chalk203.red(message3));
|
|
32207
|
+
for (const detail of details) console.error(chalk203.red(` ${detail}`));
|
|
32067
32208
|
process.exitCode = 1;
|
|
32068
32209
|
}
|
|
32069
32210
|
function reportWritten(incoming, target) {
|
|
@@ -32095,23 +32236,23 @@ async function releasesConfigure(options2 = {}) {
|
|
|
32095
32236
|
}
|
|
32096
32237
|
|
|
32097
32238
|
// src/commands/releases/releasesList.ts
|
|
32098
|
-
import
|
|
32239
|
+
import chalk204 from "chalk";
|
|
32099
32240
|
function describeNode(node) {
|
|
32100
32241
|
if (node.environment) return `${node.id} \u2192 ${node.environment}`;
|
|
32101
32242
|
return `${node.id} (${node.kind ?? "step"})`;
|
|
32102
32243
|
}
|
|
32103
32244
|
function printStream(stream) {
|
|
32104
|
-
console.log(`${
|
|
32105
|
-
console.log(
|
|
32245
|
+
console.log(`${chalk204.bold(stream.name)} ${chalk204.dim(stream.repo)}`);
|
|
32246
|
+
console.log(chalk204.dim(` workflow: ${stream.workflow}`));
|
|
32106
32247
|
for (const node of stream.nodes) console.log(` ${describeNode(node)}`);
|
|
32107
32248
|
for (const [from, to] of stream.edges)
|
|
32108
|
-
console.log(
|
|
32249
|
+
console.log(chalk204.dim(` ${from} \u2192 ${to}`));
|
|
32109
32250
|
}
|
|
32110
32251
|
function releasesList() {
|
|
32111
32252
|
const streams = loadConfig().releases?.streams ?? [];
|
|
32112
32253
|
if (streams.length === 0) {
|
|
32113
32254
|
console.log(
|
|
32114
|
-
|
|
32255
|
+
chalk204.dim("No release streams configured under releases.streams.")
|
|
32115
32256
|
);
|
|
32116
32257
|
return;
|
|
32117
32258
|
}
|
|
@@ -32159,7 +32300,7 @@ function coverage() {
|
|
|
32159
32300
|
|
|
32160
32301
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
32161
32302
|
import path45 from "path";
|
|
32162
|
-
import
|
|
32303
|
+
import chalk206 from "chalk";
|
|
32163
32304
|
|
|
32164
32305
|
// src/commands/lint/lint/checkFileNames.ts
|
|
32165
32306
|
import fs23 from "fs";
|
|
@@ -32239,7 +32380,7 @@ function checkFileNames() {
|
|
|
32239
32380
|
}
|
|
32240
32381
|
|
|
32241
32382
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
32242
|
-
import
|
|
32383
|
+
import chalk205 from "chalk";
|
|
32243
32384
|
|
|
32244
32385
|
// src/commands/lint/lint/applyMoves.ts
|
|
32245
32386
|
import fs24 from "fs";
|
|
@@ -32324,25 +32465,25 @@ function fixFileNameViolations(moves) {
|
|
|
32324
32465
|
const start2 = performance.now();
|
|
32325
32466
|
const project = createLintProject();
|
|
32326
32467
|
const cwd = process.cwd();
|
|
32327
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
32468
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk205.green(line)));
|
|
32328
32469
|
const ms = (performance.now() - start2).toFixed(0);
|
|
32329
|
-
console.log(
|
|
32470
|
+
console.log(chalk205.dim(` Done in ${ms}ms`));
|
|
32330
32471
|
}
|
|
32331
32472
|
|
|
32332
32473
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
32333
32474
|
function reportViolations(violations) {
|
|
32334
|
-
console.error(
|
|
32475
|
+
console.error(chalk206.red("\nFile name check failed:\n"));
|
|
32335
32476
|
console.error(
|
|
32336
|
-
|
|
32477
|
+
chalk206.red(
|
|
32337
32478
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
32338
32479
|
)
|
|
32339
32480
|
);
|
|
32340
32481
|
for (const violation of violations) {
|
|
32341
|
-
console.error(
|
|
32342
|
-
console.error(
|
|
32482
|
+
console.error(chalk206.red(` ${violation.filePath}`));
|
|
32483
|
+
console.error(chalk206.gray(` Rename to: ${violation.suggestedName}
|
|
32343
32484
|
`));
|
|
32344
32485
|
}
|
|
32345
|
-
console.error(
|
|
32486
|
+
console.error(chalk206.dim(" Run with -f to auto-fix.\n"));
|
|
32346
32487
|
}
|
|
32347
32488
|
function runFileNameCheck(fix = false) {
|
|
32348
32489
|
const violations = checkFileNames();
|
|
@@ -32371,17 +32512,17 @@ function runFileNameCheck(fix = false) {
|
|
|
32371
32512
|
import fs26 from "fs";
|
|
32372
32513
|
|
|
32373
32514
|
// src/commands/lint/shared.ts
|
|
32374
|
-
import
|
|
32515
|
+
import chalk207 from "chalk";
|
|
32375
32516
|
function reportViolations2(violations, checkName2, errorMessage3, successMessage) {
|
|
32376
32517
|
if (violations.length > 0) {
|
|
32377
|
-
console.error(
|
|
32518
|
+
console.error(chalk207.red(`
|
|
32378
32519
|
${checkName2} failed:
|
|
32379
32520
|
`));
|
|
32380
|
-
console.error(
|
|
32521
|
+
console.error(chalk207.red(` ${errorMessage3}
|
|
32381
32522
|
`));
|
|
32382
32523
|
for (const violation of violations) {
|
|
32383
|
-
console.error(
|
|
32384
|
-
console.error(
|
|
32524
|
+
console.error(chalk207.red(` ${violation.filePath}:${violation.line}`));
|
|
32525
|
+
console.error(chalk207.gray(` ${violation.content}
|
|
32385
32526
|
`));
|
|
32386
32527
|
}
|
|
32387
32528
|
return false;
|
|
@@ -32512,7 +32653,7 @@ import { execSync as execSync49 } from "child_process";
|
|
|
32512
32653
|
import { existsSync as existsSync65, mkdirSync as mkdirSync23, unlinkSync as unlinkSync15, writeFileSync as writeFileSync37 } from "fs";
|
|
32513
32654
|
import { tmpdir as tmpdir6 } from "os";
|
|
32514
32655
|
import { join as join80, resolve as resolve24 } from "path";
|
|
32515
|
-
import
|
|
32656
|
+
import chalk208 from "chalk";
|
|
32516
32657
|
|
|
32517
32658
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
32518
32659
|
var captureWindowPs1 = `
|
|
@@ -32663,19 +32804,19 @@ function screenshot(processName) {
|
|
|
32663
32804
|
const config = loadConfig();
|
|
32664
32805
|
const outputDir = resolve24(config.screenshot.outputDir);
|
|
32665
32806
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
32666
|
-
console.log(
|
|
32807
|
+
console.log(chalk208.gray(`Capturing window for process "${processName}" ...`));
|
|
32667
32808
|
try {
|
|
32668
32809
|
runPowerShellScript(processName, outputPath);
|
|
32669
|
-
console.log(
|
|
32810
|
+
console.log(chalk208.green(`Screenshot saved: ${outputPath}`));
|
|
32670
32811
|
} catch (error) {
|
|
32671
32812
|
const msg = error instanceof Error ? error.message : String(error);
|
|
32672
|
-
console.error(
|
|
32813
|
+
console.error(chalk208.red(`Failed to capture screenshot: ${msg}`));
|
|
32673
32814
|
process.exit(1);
|
|
32674
32815
|
}
|
|
32675
32816
|
}
|
|
32676
32817
|
|
|
32677
32818
|
// src/commands/statusLine.ts
|
|
32678
|
-
import
|
|
32819
|
+
import chalk210 from "chalk";
|
|
32679
32820
|
|
|
32680
32821
|
// src/shared/contextLevel.ts
|
|
32681
32822
|
var THRESHOLDS = {
|
|
@@ -32691,7 +32832,7 @@ function contextLevel(pct, harness) {
|
|
|
32691
32832
|
}
|
|
32692
32833
|
|
|
32693
32834
|
// src/commands/buildLimitsSegment.ts
|
|
32694
|
-
import
|
|
32835
|
+
import chalk209 from "chalk";
|
|
32695
32836
|
|
|
32696
32837
|
// src/shared/rateLimitLevel.ts
|
|
32697
32838
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -32729,9 +32870,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
32729
32870
|
|
|
32730
32871
|
// src/commands/buildLimitsSegment.ts
|
|
32731
32872
|
var LEVEL_COLOR = {
|
|
32732
|
-
ok:
|
|
32733
|
-
warn:
|
|
32734
|
-
over:
|
|
32873
|
+
ok: chalk209.green,
|
|
32874
|
+
warn: chalk209.yellow,
|
|
32875
|
+
over: chalk209.red
|
|
32735
32876
|
};
|
|
32736
32877
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
32737
32878
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -32827,7 +32968,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
32827
32968
|
}
|
|
32828
32969
|
|
|
32829
32970
|
// src/commands/statusLine.ts
|
|
32830
|
-
|
|
32971
|
+
chalk210.level = 3;
|
|
32831
32972
|
function formatNumber(num) {
|
|
32832
32973
|
return num.toLocaleString("en-US");
|
|
32833
32974
|
}
|
|
@@ -32835,9 +32976,9 @@ function colorizePercent(pct) {
|
|
|
32835
32976
|
const label2 = `${Math.round(pct)}%`;
|
|
32836
32977
|
switch (contextLevel(pct)) {
|
|
32837
32978
|
case "red":
|
|
32838
|
-
return
|
|
32979
|
+
return chalk210.red(label2);
|
|
32839
32980
|
case "yellow":
|
|
32840
|
-
return
|
|
32981
|
+
return chalk210.yellow(label2);
|
|
32841
32982
|
default:
|
|
32842
32983
|
return label2;
|
|
32843
32984
|
}
|
|
@@ -32850,7 +32991,7 @@ async function statusLine() {
|
|
|
32850
32991
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
32851
32992
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
32852
32993
|
const branch2 = dir ? readGitBranch(dir) : null;
|
|
32853
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
32994
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk210.cyan(branch2)} | ` : "";
|
|
32854
32995
|
console.log(
|
|
32855
32996
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
32856
32997
|
);
|
|
@@ -32953,7 +33094,7 @@ import { spawn as spawn7 } from "child_process";
|
|
|
32953
33094
|
import * as path47 from "path";
|
|
32954
33095
|
|
|
32955
33096
|
// src/commands/refactor/logViolations.ts
|
|
32956
|
-
import
|
|
33097
|
+
import chalk211 from "chalk";
|
|
32957
33098
|
var DEFAULT_MAX_LINES2 = 100;
|
|
32958
33099
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
32959
33100
|
if (violations.length === 0) {
|
|
@@ -32962,43 +33103,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
32962
33103
|
}
|
|
32963
33104
|
return;
|
|
32964
33105
|
}
|
|
32965
|
-
console.error(
|
|
33106
|
+
console.error(chalk211.red(`
|
|
32966
33107
|
Refactor check failed:
|
|
32967
33108
|
`));
|
|
32968
|
-
console.error(
|
|
33109
|
+
console.error(chalk211.red(` The following files exceed ${maxLines} lines:
|
|
32969
33110
|
`));
|
|
32970
33111
|
for (const violation of violations) {
|
|
32971
|
-
console.error(
|
|
33112
|
+
console.error(chalk211.red(` ${violation.file} (${violation.lines} lines)`));
|
|
32972
33113
|
}
|
|
32973
33114
|
console.error(
|
|
32974
|
-
|
|
33115
|
+
chalk211.yellow(
|
|
32975
33116
|
`
|
|
32976
33117
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
32977
33118
|
way to refactor it, ignore it with:
|
|
32978
33119
|
`
|
|
32979
33120
|
)
|
|
32980
33121
|
);
|
|
32981
|
-
console.error(
|
|
33122
|
+
console.error(chalk211.gray(` assist refactor ignore <file>
|
|
32982
33123
|
`));
|
|
32983
33124
|
if (process.env.CLAUDECODE) {
|
|
32984
|
-
console.error(
|
|
33125
|
+
console.error(chalk211.cyan(`
|
|
32985
33126
|
## Extracting Code to New Files
|
|
32986
33127
|
`));
|
|
32987
33128
|
console.error(
|
|
32988
|
-
|
|
33129
|
+
chalk211.cyan(
|
|
32989
33130
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
32990
33131
|
`
|
|
32991
33132
|
)
|
|
32992
33133
|
);
|
|
32993
33134
|
console.error(
|
|
32994
|
-
|
|
33135
|
+
chalk211.cyan(
|
|
32995
33136
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
32996
33137
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
32997
33138
|
`
|
|
32998
33139
|
)
|
|
32999
33140
|
);
|
|
33000
33141
|
console.error(
|
|
33001
|
-
|
|
33142
|
+
chalk211.cyan(
|
|
33002
33143
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
33003
33144
|
domains, move it to a common/shared folder.
|
|
33004
33145
|
`
|
|
@@ -33154,7 +33295,7 @@ async function check(pattern2, options2) {
|
|
|
33154
33295
|
|
|
33155
33296
|
// src/commands/refactor/extract.ts
|
|
33156
33297
|
import path55 from "path";
|
|
33157
|
-
import
|
|
33298
|
+
import chalk214 from "chalk";
|
|
33158
33299
|
|
|
33159
33300
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
33160
33301
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -33762,23 +33903,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
33762
33903
|
|
|
33763
33904
|
// src/commands/refactor/extract/displayPlan.ts
|
|
33764
33905
|
import path51 from "path";
|
|
33765
|
-
import
|
|
33906
|
+
import chalk212 from "chalk";
|
|
33766
33907
|
function section(title) {
|
|
33767
33908
|
return `
|
|
33768
|
-
${
|
|
33909
|
+
${chalk212.cyan(title)}`;
|
|
33769
33910
|
}
|
|
33770
33911
|
function displayImporters(plan2, cwd) {
|
|
33771
33912
|
if (plan2.importersToUpdate.length === 0) return;
|
|
33772
33913
|
console.log(section("Update importers:"));
|
|
33773
33914
|
for (const imp of plan2.importersToUpdate) {
|
|
33774
33915
|
const rel = path51.relative(cwd, imp.file.getFilePath());
|
|
33775
|
-
console.log(` ${
|
|
33916
|
+
console.log(` ${chalk212.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
33776
33917
|
}
|
|
33777
33918
|
}
|
|
33778
33919
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
33779
|
-
console.log(
|
|
33920
|
+
console.log(chalk212.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
33780
33921
|
`));
|
|
33781
|
-
console.log(` ${
|
|
33922
|
+
console.log(` ${chalk212.cyan("Functions to move:")}`);
|
|
33782
33923
|
for (const name of plan2.extractedNames) {
|
|
33783
33924
|
console.log(` ${name}`);
|
|
33784
33925
|
}
|
|
@@ -33812,7 +33953,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
33812
33953
|
|
|
33813
33954
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
33814
33955
|
import path54 from "path";
|
|
33815
|
-
import
|
|
33956
|
+
import chalk213 from "chalk";
|
|
33816
33957
|
import { Project as Project3 } from "ts-morph";
|
|
33817
33958
|
|
|
33818
33959
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -33904,7 +34045,7 @@ function loadProjectFile(file) {
|
|
|
33904
34045
|
});
|
|
33905
34046
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
33906
34047
|
if (!sourceFile) {
|
|
33907
|
-
console.log(
|
|
34048
|
+
console.log(chalk213.red(`File not found in project: ${file}`));
|
|
33908
34049
|
process.exit(1);
|
|
33909
34050
|
}
|
|
33910
34051
|
return { project, sourceFile };
|
|
@@ -33927,19 +34068,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
33927
34068
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
33928
34069
|
if (options2.apply) {
|
|
33929
34070
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
33930
|
-
console.log(
|
|
34071
|
+
console.log(chalk214.green("\nExtraction complete"));
|
|
33931
34072
|
} else {
|
|
33932
|
-
console.log(
|
|
34073
|
+
console.log(chalk214.dim("\nDry run. Use --apply to execute."));
|
|
33933
34074
|
}
|
|
33934
34075
|
}
|
|
33935
34076
|
|
|
33936
34077
|
// src/commands/refactor/ignore.ts
|
|
33937
34078
|
import fs32 from "fs";
|
|
33938
|
-
import
|
|
34079
|
+
import chalk215 from "chalk";
|
|
33939
34080
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
33940
34081
|
function ignore2(file) {
|
|
33941
34082
|
if (!fs32.existsSync(file)) {
|
|
33942
|
-
console.error(
|
|
34083
|
+
console.error(chalk215.red(`Error: File does not exist: ${file}`));
|
|
33943
34084
|
process.exit(1);
|
|
33944
34085
|
}
|
|
33945
34086
|
const content = fs32.readFileSync(file, "utf8");
|
|
@@ -33955,7 +34096,7 @@ function ignore2(file) {
|
|
|
33955
34096
|
fs32.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
33956
34097
|
}
|
|
33957
34098
|
console.log(
|
|
33958
|
-
|
|
34099
|
+
chalk215.green(
|
|
33959
34100
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
33960
34101
|
)
|
|
33961
34102
|
);
|
|
@@ -33964,12 +34105,12 @@ function ignore2(file) {
|
|
|
33964
34105
|
// src/commands/refactor/rename.ts
|
|
33965
34106
|
import fs35 from "fs";
|
|
33966
34107
|
import path61 from "path";
|
|
33967
|
-
import
|
|
34108
|
+
import chalk218 from "chalk";
|
|
33968
34109
|
|
|
33969
34110
|
// src/commands/refactor/rename/applyRename.ts
|
|
33970
34111
|
import fs34 from "fs";
|
|
33971
34112
|
import path57 from "path";
|
|
33972
|
-
import
|
|
34113
|
+
import chalk216 from "chalk";
|
|
33973
34114
|
|
|
33974
34115
|
// src/commands/refactor/restructure/computeRewrites.ts
|
|
33975
34116
|
import path56 from "path";
|
|
@@ -33977,9 +34118,9 @@ import path56 from "path";
|
|
|
33977
34118
|
// src/commands/refactor/restructure/computeRewrites/applyRewrites.ts
|
|
33978
34119
|
import fs33 from "fs";
|
|
33979
34120
|
function getOrCreateList(map, key) {
|
|
33980
|
-
const
|
|
33981
|
-
if (!map.has(key)) map.set(key,
|
|
33982
|
-
return
|
|
34121
|
+
const list6 = map.get(key) ?? [];
|
|
34122
|
+
if (!map.has(key)) map.set(key, list6);
|
|
34123
|
+
return list6;
|
|
33983
34124
|
}
|
|
33984
34125
|
function groupByFile2(rewrites) {
|
|
33985
34126
|
const grouped = /* @__PURE__ */ new Map();
|
|
@@ -34075,13 +34216,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
34075
34216
|
const updatedContents = applyRewrites(rewrites);
|
|
34076
34217
|
for (const [file, content] of updatedContents) {
|
|
34077
34218
|
fs34.writeFileSync(file, content, "utf8");
|
|
34078
|
-
console.log(
|
|
34219
|
+
console.log(chalk216.cyan(` Updated imports in ${path57.relative(cwd, file)}`));
|
|
34079
34220
|
}
|
|
34080
34221
|
const destDir = path57.dirname(destPath);
|
|
34081
34222
|
if (!fs34.existsSync(destDir)) fs34.mkdirSync(destDir, { recursive: true });
|
|
34082
34223
|
fs34.renameSync(sourcePath, destPath);
|
|
34083
34224
|
console.log(
|
|
34084
|
-
|
|
34225
|
+
chalk216.white(
|
|
34085
34226
|
` Moved ${path57.relative(cwd, sourcePath)} \u2192 ${path57.relative(cwd, destPath)}`
|
|
34086
34227
|
)
|
|
34087
34228
|
);
|
|
@@ -34231,16 +34372,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
34231
34372
|
|
|
34232
34373
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
34233
34374
|
import path60 from "path";
|
|
34234
|
-
import
|
|
34375
|
+
import chalk217 from "chalk";
|
|
34235
34376
|
function printRenamePreview(rewrites, cwd) {
|
|
34236
34377
|
for (const rewrite of rewrites) {
|
|
34237
34378
|
console.log(
|
|
34238
|
-
|
|
34379
|
+
chalk217.dim(
|
|
34239
34380
|
` ${path60.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
34240
34381
|
)
|
|
34241
34382
|
);
|
|
34242
34383
|
}
|
|
34243
|
-
console.log(
|
|
34384
|
+
console.log(chalk217.dim("Dry run. Use --apply to execute."));
|
|
34244
34385
|
}
|
|
34245
34386
|
|
|
34246
34387
|
// src/commands/refactor/rename.ts
|
|
@@ -34251,20 +34392,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
34251
34392
|
const relSource = path61.relative(cwd, sourcePath);
|
|
34252
34393
|
const relDest = path61.relative(cwd, destPath);
|
|
34253
34394
|
if (!fs35.existsSync(sourcePath)) {
|
|
34254
|
-
console.log(
|
|
34395
|
+
console.log(chalk218.red(`File not found: ${source}`));
|
|
34255
34396
|
process.exit(1);
|
|
34256
34397
|
}
|
|
34257
34398
|
if (destPath !== sourcePath && fs35.existsSync(destPath)) {
|
|
34258
|
-
console.log(
|
|
34399
|
+
console.log(chalk218.red(`Destination already exists: ${destination}`));
|
|
34259
34400
|
process.exit(1);
|
|
34260
34401
|
}
|
|
34261
|
-
console.log(
|
|
34262
|
-
console.log(
|
|
34263
|
-
console.log(
|
|
34402
|
+
console.log(chalk218.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
34403
|
+
console.log(chalk218.dim("Loading project..."));
|
|
34404
|
+
console.log(chalk218.dim("Scanning imports across the project..."));
|
|
34264
34405
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
34265
34406
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
34266
34407
|
console.log(
|
|
34267
|
-
|
|
34408
|
+
chalk218.dim(
|
|
34268
34409
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
34269
34410
|
)
|
|
34270
34411
|
);
|
|
@@ -34273,11 +34414,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
34273
34414
|
return;
|
|
34274
34415
|
}
|
|
34275
34416
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
34276
|
-
console.log(
|
|
34417
|
+
console.log(chalk218.green("Done"));
|
|
34277
34418
|
}
|
|
34278
34419
|
|
|
34279
34420
|
// src/commands/refactor/renameSymbol.ts
|
|
34280
|
-
import
|
|
34421
|
+
import chalk219 from "chalk";
|
|
34281
34422
|
|
|
34282
34423
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
34283
34424
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -34323,34 +34464,34 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
34323
34464
|
const { project, sourceFile } = loadProjectFile(file);
|
|
34324
34465
|
const symbol = findSymbol(sourceFile, oldName);
|
|
34325
34466
|
if (!symbol) {
|
|
34326
|
-
console.log(
|
|
34467
|
+
console.log(chalk219.red(`Symbol "${oldName}" not found in ${file}`));
|
|
34327
34468
|
process.exit(1);
|
|
34328
34469
|
}
|
|
34329
34470
|
const grouped = groupReferences(symbol, cwd);
|
|
34330
34471
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
34331
34472
|
console.log(
|
|
34332
|
-
|
|
34473
|
+
chalk219.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
34333
34474
|
`)
|
|
34334
34475
|
);
|
|
34335
34476
|
for (const [refFile, lines2] of grouped) {
|
|
34336
34477
|
console.log(
|
|
34337
|
-
` ${
|
|
34478
|
+
` ${chalk219.dim(refFile)}: lines ${chalk219.cyan(lines2.join(", "))}`
|
|
34338
34479
|
);
|
|
34339
34480
|
}
|
|
34340
34481
|
if (options2.apply) {
|
|
34341
34482
|
symbol.rename(newName);
|
|
34342
34483
|
await project.save();
|
|
34343
|
-
console.log(
|
|
34484
|
+
console.log(chalk219.green(`
|
|
34344
34485
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
34345
34486
|
} else {
|
|
34346
|
-
console.log(
|
|
34487
|
+
console.log(chalk219.dim("\nDry run. Use --apply to execute."));
|
|
34347
34488
|
}
|
|
34348
34489
|
}
|
|
34349
34490
|
|
|
34350
34491
|
// src/commands/refactor/restructure.ts
|
|
34351
34492
|
import fs37 from "fs";
|
|
34352
34493
|
import path82 from "path";
|
|
34353
|
-
import
|
|
34494
|
+
import chalk229 from "chalk";
|
|
34354
34495
|
|
|
34355
34496
|
// src/commands/refactor/restructure/buildPlan.ts
|
|
34356
34497
|
import path72 from "path";
|
|
@@ -34687,7 +34828,7 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
|
|
|
34687
34828
|
}
|
|
34688
34829
|
|
|
34689
34830
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
34690
|
-
import
|
|
34831
|
+
import chalk224 from "chalk";
|
|
34691
34832
|
|
|
34692
34833
|
// src/commands/refactor/restructure/applyCommand.ts
|
|
34693
34834
|
import path73 from "path";
|
|
@@ -34698,13 +34839,13 @@ function applyCommand(scopeRoot) {
|
|
|
34698
34839
|
|
|
34699
34840
|
// src/commands/refactor/restructure/displayDrift.ts
|
|
34700
34841
|
import path74 from "path";
|
|
34701
|
-
import
|
|
34842
|
+
import chalk220 from "chalk";
|
|
34702
34843
|
var shownMoves = 20;
|
|
34703
34844
|
function displayDrift(plan2, listMoves) {
|
|
34704
34845
|
const rel = (file) => path74.relative(process.cwd(), file);
|
|
34705
34846
|
if (plan2.moves.length > 0) {
|
|
34706
34847
|
console.log(
|
|
34707
|
-
|
|
34848
|
+
chalk220.red(
|
|
34708
34849
|
`${plan2.moves.length} file(s) drift from the plan${listMoves ? ":" : "."}`
|
|
34709
34850
|
)
|
|
34710
34851
|
);
|
|
@@ -34712,17 +34853,17 @@ function displayDrift(plan2, listMoves) {
|
|
|
34712
34853
|
for (const move2 of plan2.moves.slice(0, shownMoves))
|
|
34713
34854
|
console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
|
|
34714
34855
|
if (plan2.moves.length > shownMoves)
|
|
34715
|
-
console.log(
|
|
34856
|
+
console.log(chalk220.dim(` \u2026and ${plan2.moves.length - shownMoves} more`));
|
|
34716
34857
|
}
|
|
34717
34858
|
}
|
|
34718
|
-
for (const error of plan2.errors) console.log(
|
|
34859
|
+
for (const error of plan2.errors) console.log(chalk220.red(error));
|
|
34719
34860
|
}
|
|
34720
34861
|
|
|
34721
34862
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
34722
|
-
import
|
|
34863
|
+
import chalk223 from "chalk";
|
|
34723
34864
|
|
|
34724
34865
|
// src/commands/refactor/restructure/displayDeepChains.ts
|
|
34725
|
-
import
|
|
34866
|
+
import chalk221 from "chalk";
|
|
34726
34867
|
var shownChains = 10;
|
|
34727
34868
|
function formatChain(chain2) {
|
|
34728
34869
|
const folders = chain2.folders.map((f) => `${f.name} (${f.files})`).join(" > ");
|
|
@@ -34732,28 +34873,28 @@ function displayDeepChains(chains, maxDepth) {
|
|
|
34732
34873
|
if (chains.length === 0) return;
|
|
34733
34874
|
const tooDeep = chains.reduce((sum3, c) => sum3 + c.tooDeep, 0);
|
|
34734
34875
|
console.log(
|
|
34735
|
-
|
|
34876
|
+
chalk221.red(
|
|
34736
34877
|
`
|
|
34737
34878
|
Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
|
|
34738
34879
|
)
|
|
34739
34880
|
);
|
|
34740
34881
|
console.log(
|
|
34741
|
-
|
|
34882
|
+
chalk221.bold(
|
|
34742
34883
|
"Deep chains, as folder (files beneath), most files too deep first:"
|
|
34743
34884
|
)
|
|
34744
34885
|
);
|
|
34745
34886
|
for (const chain2 of chains.slice(0, shownChains))
|
|
34746
34887
|
console.log(formatChain(chain2));
|
|
34747
34888
|
if (chains.length > shownChains)
|
|
34748
|
-
console.log(
|
|
34889
|
+
console.log(chalk221.dim(` \u2026and ${chains.length - shownChains} more`));
|
|
34749
34890
|
}
|
|
34750
34891
|
|
|
34751
34892
|
// src/commands/refactor/restructure/displayLongPaths.ts
|
|
34752
|
-
import
|
|
34893
|
+
import chalk222 from "chalk";
|
|
34753
34894
|
function displayLongPaths(longPaths, maxPathLength) {
|
|
34754
34895
|
if (longPaths.length === 0) return;
|
|
34755
34896
|
console.log(
|
|
34756
|
-
|
|
34897
|
+
chalk222.red(
|
|
34757
34898
|
`
|
|
34758
34899
|
Plan exceeds restructure.maxPathLength ${maxPathLength}: ${longPaths.length} repo-relative path(s) longer.`
|
|
34759
34900
|
)
|
|
@@ -34781,7 +34922,7 @@ function displayLayoutLimits(limits, apply) {
|
|
|
34781
34922
|
displayDeepChains(limits.chains, limits.maxDepth);
|
|
34782
34923
|
displayLongPaths(limits.longPaths, limits.maxPathLength);
|
|
34783
34924
|
console.log("");
|
|
34784
|
-
for (const line of pinSteps(apply)) console.log(
|
|
34925
|
+
for (const line of pinSteps(apply)) console.log(chalk223.yellow(line));
|
|
34785
34926
|
}
|
|
34786
34927
|
|
|
34787
34928
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
@@ -34793,14 +34934,14 @@ function checkPlan(plan2, limits) {
|
|
|
34793
34934
|
if (exceeds || plan2.errors.length > 0) process.exit(1);
|
|
34794
34935
|
if (plan2.moves.length > 0) {
|
|
34795
34936
|
console.log(
|
|
34796
|
-
|
|
34937
|
+
chalk224.yellow(
|
|
34797
34938
|
`
|
|
34798
34939
|
Run \`${apply}\` to move the files and rewrite their imports.`
|
|
34799
34940
|
)
|
|
34800
34941
|
);
|
|
34801
34942
|
process.exit(1);
|
|
34802
34943
|
}
|
|
34803
|
-
console.log(
|
|
34944
|
+
console.log(chalk224.green("Layout matches the restructure plan"));
|
|
34804
34945
|
}
|
|
34805
34946
|
|
|
34806
34947
|
// src/commands/refactor/restructure/findDeepChains.ts
|
|
@@ -34870,15 +35011,15 @@ function partitionIgnored(files) {
|
|
|
34870
35011
|
}
|
|
34871
35012
|
|
|
34872
35013
|
// src/commands/refactor/restructure/runPlan.ts
|
|
34873
|
-
import
|
|
35014
|
+
import chalk228 from "chalk";
|
|
34874
35015
|
|
|
34875
35016
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
34876
|
-
import
|
|
35017
|
+
import chalk226 from "chalk";
|
|
34877
35018
|
|
|
34878
35019
|
// src/commands/refactor/restructure/executePlan.ts
|
|
34879
35020
|
import fs36 from "fs";
|
|
34880
35021
|
import path78 from "path";
|
|
34881
|
-
import
|
|
35022
|
+
import chalk225 from "chalk";
|
|
34882
35023
|
function relPath(file) {
|
|
34883
35024
|
return path78.relative(process.cwd(), file);
|
|
34884
35025
|
}
|
|
@@ -34895,14 +35036,14 @@ function moveFiles(moves) {
|
|
|
34895
35036
|
fs36.mkdirSync(path78.dirname(move2.to), { recursive: true });
|
|
34896
35037
|
fs36.renameSync(staging, move2.to);
|
|
34897
35038
|
console.log(
|
|
34898
|
-
|
|
35039
|
+
chalk225.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
|
|
34899
35040
|
);
|
|
34900
35041
|
}
|
|
34901
35042
|
}
|
|
34902
35043
|
function removeIfEmpty(dir) {
|
|
34903
35044
|
if (!fs36.existsSync(dir) || fs36.readdirSync(dir).length > 0) return false;
|
|
34904
35045
|
fs36.rmdirSync(dir);
|
|
34905
|
-
console.log(
|
|
35046
|
+
console.log(chalk225.dim(` Removed empty directory ${relPath(dir)}`));
|
|
34906
35047
|
return true;
|
|
34907
35048
|
}
|
|
34908
35049
|
function removeEmptyDirectories(dirs, scopeRoot) {
|
|
@@ -34915,7 +35056,7 @@ function removeEmptyDirectories(dirs, scopeRoot) {
|
|
|
34915
35056
|
function executePlan(plan2) {
|
|
34916
35057
|
for (const [file, content] of applyRewrites(plan2.rewrites)) {
|
|
34917
35058
|
fs36.writeFileSync(file, content, "utf8");
|
|
34918
|
-
console.log(
|
|
35059
|
+
console.log(chalk225.cyan(` Rewrote imports in ${relPath(file)}`));
|
|
34919
35060
|
}
|
|
34920
35061
|
moveFiles(plan2.moves);
|
|
34921
35062
|
removeEmptyDirectories(
|
|
@@ -34927,17 +35068,17 @@ function executePlan(plan2) {
|
|
|
34927
35068
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
34928
35069
|
function applyPlan(plan2) {
|
|
34929
35070
|
if (plan2.errors.length > 0) {
|
|
34930
|
-
console.log(
|
|
35071
|
+
console.log(chalk226.red("\nResolve the errors above before applying."));
|
|
34931
35072
|
process.exit(1);
|
|
34932
35073
|
}
|
|
34933
|
-
console.log(
|
|
35074
|
+
console.log(chalk226.bold("\nApplying changes..."));
|
|
34934
35075
|
executePlan(plan2);
|
|
34935
|
-
console.log(
|
|
35076
|
+
console.log(chalk226.green("\nRestructuring complete"));
|
|
34936
35077
|
}
|
|
34937
35078
|
|
|
34938
35079
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
34939
35080
|
import path81 from "path";
|
|
34940
|
-
import
|
|
35081
|
+
import chalk227 from "chalk";
|
|
34941
35082
|
|
|
34942
35083
|
// src/commands/refactor/restructure/computeDepthStats.ts
|
|
34943
35084
|
import path79 from "path";
|
|
@@ -34988,17 +35129,17 @@ function relPath2(filePath) {
|
|
|
34988
35129
|
}
|
|
34989
35130
|
function displayMoves(plan2) {
|
|
34990
35131
|
if (plan2.moves.length === 0) return;
|
|
34991
|
-
console.log(
|
|
35132
|
+
console.log(chalk227.bold("\nFile moves:"));
|
|
34992
35133
|
for (const move2 of plan2.moves) {
|
|
34993
35134
|
console.log(
|
|
34994
|
-
` ${
|
|
35135
|
+
` ${chalk227.red(relPath2(move2.from))} \u2192 ${chalk227.green(relPath2(move2.to))}`
|
|
34995
35136
|
);
|
|
34996
|
-
console.log(
|
|
35137
|
+
console.log(chalk227.dim(` ${move2.reason}`));
|
|
34997
35138
|
}
|
|
34998
35139
|
}
|
|
34999
35140
|
function displayTree(plan2) {
|
|
35000
35141
|
console.log(
|
|
35001
|
-
|
|
35142
|
+
chalk227.bold(`
|
|
35002
35143
|
Resulting tree (${relPath2(plan2.scopeRoot) || "."}/):`)
|
|
35003
35144
|
);
|
|
35004
35145
|
for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
|
|
@@ -35009,15 +35150,15 @@ function displayDepthStats(plan2) {
|
|
|
35009
35150
|
plan2.targets.values(),
|
|
35010
35151
|
plan2.scopeRoot
|
|
35011
35152
|
);
|
|
35012
|
-
console.log(
|
|
35153
|
+
console.log(chalk227.bold(`
|
|
35013
35154
|
Depth (max ${max}):`));
|
|
35014
35155
|
for (const depth of [...distribution.keys()].sort((a, b) => a - b))
|
|
35015
35156
|
console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
|
|
35016
35157
|
}
|
|
35017
35158
|
function displayErrors(errors) {
|
|
35018
35159
|
if (errors.length === 0) return;
|
|
35019
|
-
console.log(
|
|
35020
|
-
for (const error of errors) console.log(
|
|
35160
|
+
console.log(chalk227.red("\nErrors:"));
|
|
35161
|
+
for (const error of errors) console.log(chalk227.red(` ${error}`));
|
|
35021
35162
|
}
|
|
35022
35163
|
function displayPlan2(plan2) {
|
|
35023
35164
|
displayMoves(plan2);
|
|
@@ -35026,7 +35167,7 @@ function displayPlan2(plan2) {
|
|
|
35026
35167
|
displayErrors(plan2.errors);
|
|
35027
35168
|
const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
|
|
35028
35169
|
console.log(
|
|
35029
|
-
|
|
35170
|
+
chalk227.dim(
|
|
35030
35171
|
`
|
|
35031
35172
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
|
|
35032
35173
|
)
|
|
@@ -35038,11 +35179,11 @@ function runPlan(plan2, limits, apply) {
|
|
|
35038
35179
|
displayPlan2(plan2);
|
|
35039
35180
|
displayLayoutLimits(limits, applyCommand(plan2.scopeRoot));
|
|
35040
35181
|
if (plan2.moves.length === 0 && plan2.errors.length === 0) {
|
|
35041
|
-
console.log(
|
|
35182
|
+
console.log(chalk228.green("No restructuring needed"));
|
|
35042
35183
|
return;
|
|
35043
35184
|
}
|
|
35044
35185
|
if (!apply) {
|
|
35045
|
-
console.log(
|
|
35186
|
+
console.log(chalk228.dim("\nDry run. Use --apply to execute."));
|
|
35046
35187
|
return;
|
|
35047
35188
|
}
|
|
35048
35189
|
applyPlan(plan2);
|
|
@@ -35052,14 +35193,14 @@ function runPlan(plan2, limits, apply) {
|
|
|
35052
35193
|
async function restructure(root2, options2 = {}) {
|
|
35053
35194
|
const scopeRoot = path82.resolve(root2 ?? "src");
|
|
35054
35195
|
if (!fs37.existsSync(scopeRoot) || !fs37.statSync(scopeRoot).isDirectory()) {
|
|
35055
|
-
console.log(
|
|
35196
|
+
console.log(chalk229.red(`Not a directory: ${root2 ?? "src"}`));
|
|
35056
35197
|
process.exit(1);
|
|
35057
35198
|
}
|
|
35058
35199
|
const found = [];
|
|
35059
35200
|
walkSourceFiles(scopeRoot, found);
|
|
35060
35201
|
const { scoped, ignored } = partitionIgnored(found);
|
|
35061
35202
|
if (scoped.length === 0) {
|
|
35062
|
-
console.log(
|
|
35203
|
+
console.log(chalk229.yellow("No files found under root"));
|
|
35063
35204
|
return;
|
|
35064
35205
|
}
|
|
35065
35206
|
const {
|
|
@@ -35130,7 +35271,7 @@ async function checkoutPrSession(number, prompt = "") {
|
|
|
35130
35271
|
}
|
|
35131
35272
|
|
|
35132
35273
|
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
35133
|
-
import
|
|
35274
|
+
import chalk233 from "chalk";
|
|
35134
35275
|
|
|
35135
35276
|
// src/commands/config/promptConfigScope.ts
|
|
35136
35277
|
import Enquirer3 from "enquirer";
|
|
@@ -35156,7 +35297,7 @@ async function promptConfigScope() {
|
|
|
35156
35297
|
}
|
|
35157
35298
|
|
|
35158
35299
|
// src/commands/config/resolveConfigKeyAnswer.ts
|
|
35159
|
-
import
|
|
35300
|
+
import chalk230 from "chalk";
|
|
35160
35301
|
async function resolveConfigKeyAnswer(question, supplied) {
|
|
35161
35302
|
if (supplied !== void 0) return coerceSupplied(question.key, supplied);
|
|
35162
35303
|
for (; ; ) {
|
|
@@ -35164,7 +35305,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
|
|
|
35164
35305
|
if (answer === "") return void 0;
|
|
35165
35306
|
const coercion = coerceCliConfigValue(question.key, answer);
|
|
35166
35307
|
if (coercion.ok) return coercion.value;
|
|
35167
|
-
console.error(
|
|
35308
|
+
console.error(chalk230.red(coercion.error));
|
|
35168
35309
|
}
|
|
35169
35310
|
}
|
|
35170
35311
|
function coerceSupplied(key, supplied) {
|
|
@@ -35244,7 +35385,7 @@ function suggestGlobs(current, proposed) {
|
|
|
35244
35385
|
}
|
|
35245
35386
|
|
|
35246
35387
|
// src/commands/review/highLevel/parseConfigureAnswers.ts
|
|
35247
|
-
import
|
|
35388
|
+
import chalk231 from "chalk";
|
|
35248
35389
|
function parseConfigureAnswers(answers) {
|
|
35249
35390
|
const known = Object.values(highLevelConfigKeys);
|
|
35250
35391
|
const parsed = {};
|
|
@@ -35262,13 +35403,13 @@ function answersCoverEveryKey(answers) {
|
|
|
35262
35403
|
return Object.values(highLevelConfigKeys).every((key) => key in answers);
|
|
35263
35404
|
}
|
|
35264
35405
|
function exitWith(message3) {
|
|
35265
|
-
console.error(
|
|
35406
|
+
console.error(chalk231.red(`Error: ${message3}.`));
|
|
35266
35407
|
process.exit(1);
|
|
35267
35408
|
}
|
|
35268
35409
|
|
|
35269
35410
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
35270
35411
|
import { execFileSync as execFileSync25 } from "child_process";
|
|
35271
|
-
import
|
|
35412
|
+
import chalk232 from "chalk";
|
|
35272
35413
|
|
|
35273
35414
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
35274
35415
|
function buildGlobProposalPrompt(tree) {
|
|
@@ -35362,12 +35503,12 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
35362
35503
|
const tree = summariseRepoTree(cwd);
|
|
35363
35504
|
if (tree === "") return NOTHING_PROPOSED;
|
|
35364
35505
|
console.log(
|
|
35365
|
-
|
|
35506
|
+
chalk232.dim("Asking Claude to propose globs from the repo's own tree...")
|
|
35366
35507
|
);
|
|
35367
35508
|
const output = askClaude(buildGlobProposalPrompt(tree), cwd);
|
|
35368
35509
|
if (output === void 0) {
|
|
35369
35510
|
console.log(
|
|
35370
|
-
|
|
35511
|
+
chalk232.yellow(
|
|
35371
35512
|
"Claude proposed nothing; answer each key from its current value."
|
|
35372
35513
|
)
|
|
35373
35514
|
);
|
|
@@ -35431,14 +35572,14 @@ function asConfigKeyScope(value) {
|
|
|
35431
35572
|
function reportConfigured(result) {
|
|
35432
35573
|
for (const write of result.written)
|
|
35433
35574
|
console.log(
|
|
35434
|
-
|
|
35575
|
+
chalk233.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
|
|
35435
35576
|
);
|
|
35436
|
-
for (const key of result.skipped) console.log(
|
|
35437
|
-
console.log(
|
|
35577
|
+
for (const key of result.skipped) console.log(chalk233.dim(`Left ${key} unset`));
|
|
35578
|
+
console.log(chalk233.dim(`Written to ${result.target}`));
|
|
35438
35579
|
}
|
|
35439
35580
|
|
|
35440
35581
|
// src/commands/review/highLevel/announceSavedReview.ts
|
|
35441
|
-
import
|
|
35582
|
+
import chalk234 from "chalk";
|
|
35442
35583
|
function savedMessage(subject) {
|
|
35443
35584
|
const head = subject.headSha.slice(0, 7);
|
|
35444
35585
|
if (subject.draft)
|
|
@@ -35449,10 +35590,10 @@ function savedMessage(subject) {
|
|
|
35449
35590
|
}
|
|
35450
35591
|
function announceSavedReview(subject, force) {
|
|
35451
35592
|
const message3 = savedMessage(subject);
|
|
35452
|
-
if (message3) console.log(
|
|
35593
|
+
if (message3) console.log(chalk234.dim(message3));
|
|
35453
35594
|
else if (force)
|
|
35454
35595
|
console.log(
|
|
35455
|
-
|
|
35596
|
+
chalk234.dim(
|
|
35456
35597
|
`Discarding any review saved for ${subject.headSha.slice(0, 7)} and starting fresh (--force).`
|
|
35457
35598
|
)
|
|
35458
35599
|
);
|
|
@@ -36547,55 +36688,55 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
36547
36688
|
}
|
|
36548
36689
|
|
|
36549
36690
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
36550
|
-
import
|
|
36691
|
+
import chalk239 from "chalk";
|
|
36551
36692
|
|
|
36552
36693
|
// src/commands/review/highLevel/formatCriticalDiffs.ts
|
|
36553
|
-
import
|
|
36694
|
+
import chalk235 from "chalk";
|
|
36554
36695
|
var PATCH_LINE_COLOURS = {
|
|
36555
|
-
"+":
|
|
36556
|
-
"-":
|
|
36557
|
-
"@":
|
|
36696
|
+
"+": chalk235.green,
|
|
36697
|
+
"-": chalk235.red,
|
|
36698
|
+
"@": chalk235.cyan
|
|
36558
36699
|
};
|
|
36559
36700
|
function formatPatch(patch2) {
|
|
36560
36701
|
return patch2.split("\n").map(
|
|
36561
|
-
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ??
|
|
36702
|
+
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk235.dim)(line)}`
|
|
36562
36703
|
);
|
|
36563
36704
|
}
|
|
36564
36705
|
function formatDiff(diff3) {
|
|
36565
36706
|
return [
|
|
36566
36707
|
"",
|
|
36567
|
-
` ${
|
|
36568
|
-
...diff3.patch === null ? [` ${
|
|
36708
|
+
` ${chalk235.bold(diff3.path)} ${chalk235.dim(`(${diff3.status})`)} ${chalk235.green(`+${diff3.additions}`)} ${chalk235.red(`-${diff3.deletions}`)}`,
|
|
36709
|
+
...diff3.patch === null ? [` ${chalk235.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
|
|
36569
36710
|
];
|
|
36570
36711
|
}
|
|
36571
36712
|
function formatCriticalDiffs(diffs, criticalPaths) {
|
|
36572
36713
|
if (criticalPaths.length === 0)
|
|
36573
|
-
return `${
|
|
36574
|
-
${
|
|
36714
|
+
return `${chalk235.bold.underline("Critical diffs")}
|
|
36715
|
+
${chalk235.dim("review.highLevel.criticalPaths is empty, so no diffs are shown")}`;
|
|
36575
36716
|
if (diffs.length === 0)
|
|
36576
|
-
return `${
|
|
36577
|
-
${
|
|
36717
|
+
return `${chalk235.bold.underline("Critical diffs")}
|
|
36718
|
+
${chalk235.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
|
|
36578
36719
|
return [
|
|
36579
|
-
|
|
36720
|
+
chalk235.bold.underline("Critical diffs"),
|
|
36580
36721
|
...diffs.flatMap(formatDiff)
|
|
36581
36722
|
].join("\n");
|
|
36582
36723
|
}
|
|
36583
36724
|
|
|
36584
36725
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
36585
|
-
import
|
|
36726
|
+
import chalk236 from "chalk";
|
|
36586
36727
|
var MARKERS = {
|
|
36587
|
-
pass: () =>
|
|
36588
|
-
fail: () =>
|
|
36589
|
-
manual: () =>
|
|
36728
|
+
pass: () => chalk236.green("\u2714"),
|
|
36729
|
+
fail: () => chalk236.red("\u2718"),
|
|
36730
|
+
manual: () => chalk236.yellow("\u25A1")
|
|
36590
36731
|
};
|
|
36591
36732
|
function formatCheck(check2) {
|
|
36592
|
-
const title = check2.status === "fail" ?
|
|
36733
|
+
const title = check2.status === "fail" ? chalk236.red(check2.title) : chalk236.bold(check2.title);
|
|
36593
36734
|
return ` ${MARKERS[check2.status]()} ${title}
|
|
36594
|
-
${
|
|
36735
|
+
${chalk236.dim(check2.reason)}`;
|
|
36595
36736
|
}
|
|
36596
36737
|
function formatGroup(heading2, checks2) {
|
|
36597
36738
|
if (checks2.length === 0) return [];
|
|
36598
|
-
return ["",
|
|
36739
|
+
return ["", chalk236.bold.underline(heading2), ...checks2.map(formatCheck)];
|
|
36599
36740
|
}
|
|
36600
36741
|
function formatHighLevelChecklist(checks2) {
|
|
36601
36742
|
const deterministic = checks2.filter(
|
|
@@ -36604,7 +36745,7 @@ function formatHighLevelChecklist(checks2) {
|
|
|
36604
36745
|
const failed3 = deterministic.filter(
|
|
36605
36746
|
(check2) => check2.status === "fail"
|
|
36606
36747
|
).length;
|
|
36607
|
-
const summary = failed3 === 0 ?
|
|
36748
|
+
const summary = failed3 === 0 ? chalk236.green(`All ${deterministic.length} deterministic checks pass`) : chalk236.red(
|
|
36608
36749
|
`${failed3} of ${deterministic.length} deterministic checks fail`
|
|
36609
36750
|
);
|
|
36610
36751
|
return [
|
|
@@ -36619,37 +36760,37 @@ function formatHighLevelChecklist(checks2) {
|
|
|
36619
36760
|
}
|
|
36620
36761
|
|
|
36621
36762
|
// src/commands/review/highLevel/formatHighLevelStructure.ts
|
|
36622
|
-
import
|
|
36763
|
+
import chalk237 from "chalk";
|
|
36623
36764
|
var STATUS_MARKERS = {
|
|
36624
|
-
added: () =>
|
|
36625
|
-
removed: () =>
|
|
36626
|
-
modified: () =>
|
|
36765
|
+
added: () => chalk237.green("A"),
|
|
36766
|
+
removed: () => chalk237.red("D"),
|
|
36767
|
+
modified: () => chalk237.yellow("M")
|
|
36627
36768
|
};
|
|
36628
36769
|
function counts(additions, deletions) {
|
|
36629
|
-
return `${
|
|
36770
|
+
return `${chalk237.green(`+${additions}`)} ${chalk237.red(`-${deletions}`)}`;
|
|
36630
36771
|
}
|
|
36631
36772
|
function formatNode(node, indent3) {
|
|
36632
36773
|
if (node.kind === "file")
|
|
36633
36774
|
return [
|
|
36634
|
-
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${
|
|
36775
|
+
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk237.dim(counts(node.additions, node.deletions))}`
|
|
36635
36776
|
];
|
|
36636
36777
|
const dir = node;
|
|
36637
36778
|
return [
|
|
36638
|
-
`${indent3}${
|
|
36779
|
+
`${indent3}${chalk237.bold(`${dir.name}/`)} ${chalk237.dim(counts(dir.additions, dir.deletions))}`,
|
|
36639
36780
|
...dir.children.flatMap((child) => formatNode(child, `${indent3} `))
|
|
36640
36781
|
];
|
|
36641
36782
|
}
|
|
36642
36783
|
function formatHighLevelStructure(structure) {
|
|
36643
36784
|
const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
|
|
36644
36785
|
return [
|
|
36645
|
-
|
|
36786
|
+
chalk237.bold.underline("Structure"),
|
|
36646
36787
|
` ${summary}`,
|
|
36647
36788
|
...structure.tree.flatMap((node) => formatNode(node, " "))
|
|
36648
36789
|
].join("\n");
|
|
36649
36790
|
}
|
|
36650
36791
|
|
|
36651
36792
|
// src/commands/review/highLevel/formatHighLevelTests.ts
|
|
36652
|
-
import
|
|
36793
|
+
import chalk238 from "chalk";
|
|
36653
36794
|
function changeMarker(change) {
|
|
36654
36795
|
if (change === "added") return "A";
|
|
36655
36796
|
if (change === "modified") return "M";
|
|
@@ -36658,22 +36799,22 @@ function changeMarker(change) {
|
|
|
36658
36799
|
function formatNode2(node, depth) {
|
|
36659
36800
|
const indent3 = " ".repeat(depth + 2);
|
|
36660
36801
|
if (node.kind === "it")
|
|
36661
|
-
return [`${indent3}${
|
|
36802
|
+
return [`${indent3}${chalk238.dim(changeMarker(node.change))} ${node.name}`];
|
|
36662
36803
|
return [
|
|
36663
|
-
`${indent3}${
|
|
36804
|
+
`${indent3}${chalk238.bold(node.name)}`,
|
|
36664
36805
|
...node.children.flatMap((child) => formatNode2(child, depth + 1))
|
|
36665
36806
|
];
|
|
36666
36807
|
}
|
|
36667
36808
|
function formatHighLevelTests(files, testPaths) {
|
|
36668
|
-
const heading2 =
|
|
36809
|
+
const heading2 = chalk238.bold.underline("Changed tests");
|
|
36669
36810
|
if (files.length === 0)
|
|
36670
36811
|
return `${heading2}
|
|
36671
|
-
${
|
|
36812
|
+
${chalk238.dim(`no changed test in files matching ${testPaths.join(", ")}`)}`;
|
|
36672
36813
|
return [
|
|
36673
36814
|
heading2,
|
|
36674
36815
|
...files.flatMap((file) => [
|
|
36675
36816
|
"",
|
|
36676
|
-
` ${
|
|
36817
|
+
` ${chalk238.bold(file.path)} ${chalk238.dim(`(${file.status})`)}`,
|
|
36677
36818
|
...file.tests.flatMap((node) => formatNode2(node, 0))
|
|
36678
36819
|
])
|
|
36679
36820
|
].join("\n");
|
|
@@ -36687,10 +36828,10 @@ function highLevelChangedFileCount(structure) {
|
|
|
36687
36828
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
36688
36829
|
function printHighLevelChecklist(subject) {
|
|
36689
36830
|
console.log(
|
|
36690
|
-
|
|
36831
|
+
chalk239.bold(
|
|
36691
36832
|
`High-level review of ${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`
|
|
36692
36833
|
),
|
|
36693
|
-
|
|
36834
|
+
chalk239.dim(
|
|
36694
36835
|
`\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
|
|
36695
36836
|
)
|
|
36696
36837
|
);
|
|
@@ -36704,12 +36845,12 @@ function printHighLevelChecklist(subject) {
|
|
|
36704
36845
|
console.log("");
|
|
36705
36846
|
console.log(formatHighLevelTests(subject.tests, subject.testPaths));
|
|
36706
36847
|
console.log(
|
|
36707
|
-
|
|
36848
|
+
chalk239.dim(
|
|
36708
36849
|
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
36709
36850
|
)
|
|
36710
36851
|
);
|
|
36711
36852
|
console.log(
|
|
36712
|
-
|
|
36853
|
+
chalk239.dim(
|
|
36713
36854
|
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
36714
36855
|
)
|
|
36715
36856
|
);
|
|
@@ -36995,18 +37136,18 @@ function partitionFindingsByDiff(findings, index2) {
|
|
|
36995
37136
|
}
|
|
36996
37137
|
|
|
36997
37138
|
// src/commands/review/warnOutOfDiff.ts
|
|
36998
|
-
import
|
|
37139
|
+
import chalk240 from "chalk";
|
|
36999
37140
|
function warnOutOfDiff(outOfDiff) {
|
|
37000
37141
|
if (outOfDiff.length === 0) return;
|
|
37001
37142
|
console.warn(
|
|
37002
|
-
|
|
37143
|
+
chalk240.yellow(
|
|
37003
37144
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
37004
37145
|
)
|
|
37005
37146
|
);
|
|
37006
37147
|
for (const finding of outOfDiff) {
|
|
37007
37148
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
37008
37149
|
console.warn(
|
|
37009
|
-
` ${
|
|
37150
|
+
` ${chalk240.yellow("\xB7")} ${finding.title} ${chalk240.dim(
|
|
37010
37151
|
`(${finding.file}:${range})`
|
|
37011
37152
|
)}`
|
|
37012
37153
|
);
|
|
@@ -37030,18 +37171,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
37030
37171
|
}
|
|
37031
37172
|
|
|
37032
37173
|
// src/commands/review/warnUnlocated.ts
|
|
37033
|
-
import
|
|
37174
|
+
import chalk241 from "chalk";
|
|
37034
37175
|
function warnUnlocated(unlocated) {
|
|
37035
37176
|
if (unlocated.length === 0) return;
|
|
37036
37177
|
console.warn(
|
|
37037
|
-
|
|
37178
|
+
chalk241.yellow(
|
|
37038
37179
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
37039
37180
|
)
|
|
37040
37181
|
);
|
|
37041
37182
|
for (const finding of unlocated) {
|
|
37042
|
-
const where = finding.location ||
|
|
37183
|
+
const where = finding.location || chalk241.dim("missing");
|
|
37043
37184
|
console.warn(
|
|
37044
|
-
` ${
|
|
37185
|
+
` ${chalk241.yellow("\xB7")} ${finding.title} ${chalk241.dim(`(${where})`)}`
|
|
37045
37186
|
);
|
|
37046
37187
|
}
|
|
37047
37188
|
}
|
|
@@ -39184,7 +39325,7 @@ function registerReview(program) {
|
|
|
39184
39325
|
// src/commands/rules/addRule.ts
|
|
39185
39326
|
import { existsSync as existsSync72, readFileSync as readFileSync56, writeFileSync as writeFileSync42 } from "fs";
|
|
39186
39327
|
import path87 from "path";
|
|
39187
|
-
import
|
|
39328
|
+
import chalk242 from "chalk";
|
|
39188
39329
|
|
|
39189
39330
|
// src/commands/rules/insertRuleBullet.ts
|
|
39190
39331
|
function ruleBullet({ code, title, text: text17 }) {
|
|
@@ -39320,7 +39461,7 @@ function read2(file) {
|
|
|
39320
39461
|
function addRule(text17, options2) {
|
|
39321
39462
|
const rule = text17.trim();
|
|
39322
39463
|
if (rule === "") {
|
|
39323
|
-
console.error(
|
|
39464
|
+
console.error(chalk242.red("Rule text is required"));
|
|
39324
39465
|
process.exitCode = 1;
|
|
39325
39466
|
return;
|
|
39326
39467
|
}
|
|
@@ -39338,13 +39479,13 @@ function addRule(text17, options2) {
|
|
|
39338
39479
|
);
|
|
39339
39480
|
updateScopedRulesIndex(root2);
|
|
39340
39481
|
console.log(
|
|
39341
|
-
`Added ${
|
|
39482
|
+
`Added ${chalk242.cyan(code)} to ${path87.relative(process.cwd(), target) || target}`
|
|
39342
39483
|
);
|
|
39343
39484
|
}
|
|
39344
39485
|
|
|
39345
39486
|
// src/commands/rules/indexRules.ts
|
|
39346
39487
|
import path88 from "path";
|
|
39347
|
-
import
|
|
39488
|
+
import chalk243 from "chalk";
|
|
39348
39489
|
function indexRules() {
|
|
39349
39490
|
const startDir = scopeDirectory(process.cwd());
|
|
39350
39491
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
@@ -39352,24 +39493,24 @@ function indexRules() {
|
|
|
39352
39493
|
const rootFile = path88.relative(process.cwd(), path88.join(root2, "CLAUDE.md"));
|
|
39353
39494
|
if (directories.length === 0) {
|
|
39354
39495
|
console.log(
|
|
39355
|
-
|
|
39496
|
+
chalk243.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
39356
39497
|
);
|
|
39357
39498
|
return;
|
|
39358
39499
|
}
|
|
39359
39500
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
39360
39501
|
for (const directory of directories)
|
|
39361
|
-
console.log(` ${
|
|
39502
|
+
console.log(` ${chalk243.cyan(directory)}`);
|
|
39362
39503
|
}
|
|
39363
39504
|
|
|
39364
39505
|
// src/commands/rules/listRules.ts
|
|
39365
39506
|
import path89 from "path";
|
|
39366
|
-
import
|
|
39507
|
+
import chalk244 from "chalk";
|
|
39367
39508
|
function listRules(target, options2 = {}) {
|
|
39368
39509
|
const resolved = path89.resolve(target ?? process.cwd());
|
|
39369
39510
|
const rules2 = readScopedRules(resolved);
|
|
39370
39511
|
if (rules2.length === 0) {
|
|
39371
39512
|
const label2 = path89.relative(process.cwd(), resolved) || ".";
|
|
39372
|
-
console.log(
|
|
39513
|
+
console.log(chalk244.gray(`No rules in scope for ${label2}`));
|
|
39373
39514
|
return;
|
|
39374
39515
|
}
|
|
39375
39516
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -39379,14 +39520,14 @@ function listRules(target, options2 = {}) {
|
|
|
39379
39520
|
if (rule.source !== shown) {
|
|
39380
39521
|
shown = rule.source;
|
|
39381
39522
|
console.log(
|
|
39382
|
-
|
|
39523
|
+
chalk244.dim(base ? path89.relative(base, rule.source) : rule.source)
|
|
39383
39524
|
);
|
|
39384
39525
|
}
|
|
39385
39526
|
console.log(
|
|
39386
|
-
` ${
|
|
39527
|
+
` ${chalk244.cyan(rule.code.padEnd(width2))} ${rule.title ?? rule.text}`
|
|
39387
39528
|
);
|
|
39388
39529
|
if (options2.full && rule.title)
|
|
39389
|
-
console.log(` ${" ".repeat(width2)} ${
|
|
39530
|
+
console.log(` ${" ".repeat(width2)} ${chalk244.dim(rule.text)}`);
|
|
39390
39531
|
}
|
|
39391
39532
|
}
|
|
39392
39533
|
|
|
@@ -39415,7 +39556,7 @@ function registerRules(program) {
|
|
|
39415
39556
|
}
|
|
39416
39557
|
|
|
39417
39558
|
// src/commands/seq/seqAuth.ts
|
|
39418
|
-
import
|
|
39559
|
+
import chalk246 from "chalk";
|
|
39419
39560
|
|
|
39420
39561
|
// src/commands/seq/loadConnections.ts
|
|
39421
39562
|
function loadConnections2() {
|
|
@@ -39444,10 +39585,10 @@ function setDefaultConnection(name) {
|
|
|
39444
39585
|
}
|
|
39445
39586
|
|
|
39446
39587
|
// src/shared/assertUniqueName.ts
|
|
39447
|
-
import
|
|
39588
|
+
import chalk245 from "chalk";
|
|
39448
39589
|
function assertUniqueName(existingNames, name) {
|
|
39449
39590
|
if (existingNames.includes(name)) {
|
|
39450
|
-
console.error(
|
|
39591
|
+
console.error(chalk245.red(`Connection "${name}" already exists.`));
|
|
39451
39592
|
process.exit(1);
|
|
39452
39593
|
}
|
|
39453
39594
|
}
|
|
@@ -39465,16 +39606,16 @@ async function promptConnection2(existingNames) {
|
|
|
39465
39606
|
var seqAuth = createConnectionAuth({
|
|
39466
39607
|
load: loadConnections2,
|
|
39467
39608
|
save: saveConnections2,
|
|
39468
|
-
format: (c) => `${
|
|
39609
|
+
format: (c) => `${chalk246.bold(c.name)} ${c.url}`,
|
|
39469
39610
|
promptNew: promptConnection2,
|
|
39470
39611
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
39471
39612
|
});
|
|
39472
39613
|
|
|
39473
39614
|
// src/commands/seq/seqQuery.ts
|
|
39474
|
-
import
|
|
39615
|
+
import chalk250 from "chalk";
|
|
39475
39616
|
|
|
39476
39617
|
// src/commands/seq/fetchSeq.ts
|
|
39477
|
-
import
|
|
39618
|
+
import chalk247 from "chalk";
|
|
39478
39619
|
async function fetchSeq(conn, path108, params) {
|
|
39479
39620
|
const url = `${conn.url}${path108}?${params}`;
|
|
39480
39621
|
const response = await fetch(url, {
|
|
@@ -39485,7 +39626,7 @@ async function fetchSeq(conn, path108, params) {
|
|
|
39485
39626
|
});
|
|
39486
39627
|
if (!response.ok) {
|
|
39487
39628
|
const body = await response.text();
|
|
39488
|
-
console.error(
|
|
39629
|
+
console.error(chalk247.red(`Seq returned ${response.status}: ${body}`));
|
|
39489
39630
|
process.exit(1);
|
|
39490
39631
|
}
|
|
39491
39632
|
return response;
|
|
@@ -39544,23 +39685,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
39544
39685
|
}
|
|
39545
39686
|
|
|
39546
39687
|
// src/commands/seq/formatEvent.ts
|
|
39547
|
-
import
|
|
39688
|
+
import chalk248 from "chalk";
|
|
39548
39689
|
function levelColor(level) {
|
|
39549
39690
|
switch (level) {
|
|
39550
39691
|
case "Fatal":
|
|
39551
|
-
return
|
|
39692
|
+
return chalk248.bgRed.white;
|
|
39552
39693
|
case "Error":
|
|
39553
|
-
return
|
|
39694
|
+
return chalk248.red;
|
|
39554
39695
|
case "Warning":
|
|
39555
|
-
return
|
|
39696
|
+
return chalk248.yellow;
|
|
39556
39697
|
case "Information":
|
|
39557
|
-
return
|
|
39698
|
+
return chalk248.cyan;
|
|
39558
39699
|
case "Debug":
|
|
39559
|
-
return
|
|
39700
|
+
return chalk248.gray;
|
|
39560
39701
|
case "Verbose":
|
|
39561
|
-
return
|
|
39702
|
+
return chalk248.dim;
|
|
39562
39703
|
default:
|
|
39563
|
-
return
|
|
39704
|
+
return chalk248.white;
|
|
39564
39705
|
}
|
|
39565
39706
|
}
|
|
39566
39707
|
function levelAbbrev(level) {
|
|
@@ -39601,12 +39742,12 @@ function formatTimestamp(iso) {
|
|
|
39601
39742
|
function formatEvent(event) {
|
|
39602
39743
|
const color = levelColor(event.Level);
|
|
39603
39744
|
const abbrev = levelAbbrev(event.Level);
|
|
39604
|
-
const ts10 =
|
|
39745
|
+
const ts10 = chalk248.dim(formatTimestamp(event.Timestamp));
|
|
39605
39746
|
const msg = renderMessage(event);
|
|
39606
39747
|
const lines2 = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
|
|
39607
39748
|
if (event.Exception) {
|
|
39608
39749
|
for (const line of event.Exception.split("\n")) {
|
|
39609
|
-
lines2.push(
|
|
39750
|
+
lines2.push(chalk248.red(` ${line}`));
|
|
39610
39751
|
}
|
|
39611
39752
|
}
|
|
39612
39753
|
return lines2.join("\n");
|
|
@@ -39639,11 +39780,11 @@ function rejectTimestampFilter(filter) {
|
|
|
39639
39780
|
}
|
|
39640
39781
|
|
|
39641
39782
|
// src/shared/resolveNamedConnection.ts
|
|
39642
|
-
import
|
|
39783
|
+
import chalk249 from "chalk";
|
|
39643
39784
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
39644
39785
|
if (connections.length === 0) {
|
|
39645
39786
|
console.error(
|
|
39646
|
-
|
|
39787
|
+
chalk249.red(
|
|
39647
39788
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
39648
39789
|
)
|
|
39649
39790
|
);
|
|
@@ -39652,7 +39793,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
39652
39793
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
39653
39794
|
const connection = connections.find((c) => c.name === target);
|
|
39654
39795
|
if (!connection) {
|
|
39655
|
-
console.error(
|
|
39796
|
+
console.error(chalk249.red(`${kind} connection "${target}" not found.`));
|
|
39656
39797
|
process.exit(1);
|
|
39657
39798
|
}
|
|
39658
39799
|
return connection;
|
|
@@ -39681,7 +39822,7 @@ async function seqQuery(filter, options2) {
|
|
|
39681
39822
|
new URLSearchParams({ filter, count: String(count10) })
|
|
39682
39823
|
);
|
|
39683
39824
|
if (events.length === 0) {
|
|
39684
|
-
console.log(
|
|
39825
|
+
console.log(chalk250.yellow("No events found."));
|
|
39685
39826
|
return;
|
|
39686
39827
|
}
|
|
39687
39828
|
if (options2.json) {
|
|
@@ -39692,11 +39833,11 @@ async function seqQuery(filter, options2) {
|
|
|
39692
39833
|
for (const event of chronological) {
|
|
39693
39834
|
console.log(formatEvent(event));
|
|
39694
39835
|
}
|
|
39695
|
-
console.log(
|
|
39836
|
+
console.log(chalk250.dim(`
|
|
39696
39837
|
${events.length} events`));
|
|
39697
39838
|
if (events.length >= count10) {
|
|
39698
39839
|
console.log(
|
|
39699
|
-
|
|
39840
|
+
chalk250.yellow(
|
|
39700
39841
|
`Results limited to ${count10}. Use --count to retrieve more.`
|
|
39701
39842
|
)
|
|
39702
39843
|
);
|
|
@@ -39704,10 +39845,10 @@ ${events.length} events`));
|
|
|
39704
39845
|
}
|
|
39705
39846
|
|
|
39706
39847
|
// src/shared/setNamedDefaultConnection.ts
|
|
39707
|
-
import
|
|
39848
|
+
import chalk251 from "chalk";
|
|
39708
39849
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
39709
39850
|
if (!connections.find((c) => c.name === name)) {
|
|
39710
|
-
console.error(
|
|
39851
|
+
console.error(chalk251.red(`Connection "${name}" not found.`));
|
|
39711
39852
|
process.exit(1);
|
|
39712
39853
|
}
|
|
39713
39854
|
setDefault(name);
|
|
@@ -40008,7 +40149,7 @@ function registerSlack(program) {
|
|
|
40008
40149
|
}
|
|
40009
40150
|
|
|
40010
40151
|
// src/commands/sql/sqlAuth.ts
|
|
40011
|
-
import
|
|
40152
|
+
import chalk253 from "chalk";
|
|
40012
40153
|
|
|
40013
40154
|
// src/commands/sql/loadConnections.ts
|
|
40014
40155
|
function loadConnections3() {
|
|
@@ -40037,7 +40178,7 @@ function setDefaultConnection2(name) {
|
|
|
40037
40178
|
}
|
|
40038
40179
|
|
|
40039
40180
|
// src/commands/sql/promptConnection.ts
|
|
40040
|
-
import
|
|
40181
|
+
import chalk252 from "chalk";
|
|
40041
40182
|
async function promptConnection3(existingNames) {
|
|
40042
40183
|
const name = await promptInput("name", "Connection name:", "default");
|
|
40043
40184
|
assertUniqueName(existingNames, name);
|
|
@@ -40045,7 +40186,7 @@ async function promptConnection3(existingNames) {
|
|
|
40045
40186
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
40046
40187
|
const port = Number.parseInt(portStr, 10);
|
|
40047
40188
|
if (!Number.isFinite(port)) {
|
|
40048
|
-
console.error(
|
|
40189
|
+
console.error(chalk252.red(`Invalid port "${portStr}".`));
|
|
40049
40190
|
process.exit(1);
|
|
40050
40191
|
}
|
|
40051
40192
|
const user = await promptInput("user", "User:");
|
|
@@ -40058,13 +40199,13 @@ async function promptConnection3(existingNames) {
|
|
|
40058
40199
|
var sqlAuth = createConnectionAuth({
|
|
40059
40200
|
load: loadConnections3,
|
|
40060
40201
|
save: saveConnections3,
|
|
40061
|
-
format: (c) => `${
|
|
40202
|
+
format: (c) => `${chalk253.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
40062
40203
|
promptNew: promptConnection3,
|
|
40063
40204
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
40064
40205
|
});
|
|
40065
40206
|
|
|
40066
40207
|
// src/commands/sql/printTable.ts
|
|
40067
|
-
import
|
|
40208
|
+
import chalk254 from "chalk";
|
|
40068
40209
|
function formatCell(value) {
|
|
40069
40210
|
if (value === null || value === void 0) return "";
|
|
40070
40211
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -40073,7 +40214,7 @@ function formatCell(value) {
|
|
|
40073
40214
|
}
|
|
40074
40215
|
function printTable(rows) {
|
|
40075
40216
|
if (rows.length === 0) {
|
|
40076
|
-
console.log(
|
|
40217
|
+
console.log(chalk254.yellow("(no rows)"));
|
|
40077
40218
|
return;
|
|
40078
40219
|
}
|
|
40079
40220
|
const columns = Object.keys(rows[0]);
|
|
@@ -40081,13 +40222,13 @@ function printTable(rows) {
|
|
|
40081
40222
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
40082
40223
|
);
|
|
40083
40224
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
40084
|
-
console.log(
|
|
40085
|
-
console.log(
|
|
40225
|
+
console.log(chalk254.dim(header));
|
|
40226
|
+
console.log(chalk254.dim("-".repeat(header.length)));
|
|
40086
40227
|
for (const row3 of rows) {
|
|
40087
40228
|
const line = columns.map((c, i) => formatCell(row3[c]).padEnd(widths[i])).join(" ");
|
|
40088
40229
|
console.log(line);
|
|
40089
40230
|
}
|
|
40090
|
-
console.log(
|
|
40231
|
+
console.log(chalk254.dim(`
|
|
40091
40232
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
40092
40233
|
}
|
|
40093
40234
|
|
|
@@ -40147,7 +40288,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
40147
40288
|
}
|
|
40148
40289
|
|
|
40149
40290
|
// src/commands/sql/sqlMutate.ts
|
|
40150
|
-
import
|
|
40291
|
+
import chalk255 from "chalk";
|
|
40151
40292
|
|
|
40152
40293
|
// src/commands/sql/isMutation.ts
|
|
40153
40294
|
var MUTATION_KEYWORDS = [
|
|
@@ -40181,7 +40322,7 @@ function isMutation(sql27) {
|
|
|
40181
40322
|
async function sqlMutate(query, connectionName) {
|
|
40182
40323
|
if (!isMutation(query)) {
|
|
40183
40324
|
console.error(
|
|
40184
|
-
|
|
40325
|
+
chalk255.red(
|
|
40185
40326
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
40186
40327
|
)
|
|
40187
40328
|
);
|
|
@@ -40191,18 +40332,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
40191
40332
|
const pool = await sqlConnect(conn);
|
|
40192
40333
|
try {
|
|
40193
40334
|
const result = await pool.request().query(query);
|
|
40194
|
-
console.log(
|
|
40335
|
+
console.log(chalk255.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
40195
40336
|
} finally {
|
|
40196
40337
|
await pool.close();
|
|
40197
40338
|
}
|
|
40198
40339
|
}
|
|
40199
40340
|
|
|
40200
40341
|
// src/commands/sql/sqlQuery.ts
|
|
40201
|
-
import
|
|
40342
|
+
import chalk256 from "chalk";
|
|
40202
40343
|
async function sqlQuery(query, connectionName) {
|
|
40203
40344
|
if (isMutation(query)) {
|
|
40204
40345
|
console.error(
|
|
40205
|
-
|
|
40346
|
+
chalk256.red(
|
|
40206
40347
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
40207
40348
|
)
|
|
40208
40349
|
);
|
|
@@ -40217,7 +40358,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
40217
40358
|
printTable(rows);
|
|
40218
40359
|
} else {
|
|
40219
40360
|
console.log(
|
|
40220
|
-
|
|
40361
|
+
chalk256.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
40221
40362
|
);
|
|
40222
40363
|
}
|
|
40223
40364
|
} finally {
|
|
@@ -40632,7 +40773,7 @@ function syncPi(claudeDir, options2) {
|
|
|
40632
40773
|
// src/commands/sync/syncSettings.ts
|
|
40633
40774
|
import * as fs46 from "fs";
|
|
40634
40775
|
import * as path100 from "path";
|
|
40635
|
-
import
|
|
40776
|
+
import chalk257 from "chalk";
|
|
40636
40777
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
40637
40778
|
const source = path100.join(claudeDir, "settings.json");
|
|
40638
40779
|
const target = path100.join(targetBase, "settings.json");
|
|
@@ -40651,7 +40792,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
40651
40792
|
if (mergedContent !== normalizedTarget) {
|
|
40652
40793
|
if (!options2?.yes) {
|
|
40653
40794
|
console.log(
|
|
40654
|
-
|
|
40795
|
+
chalk257.yellow(
|
|
40655
40796
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
40656
40797
|
)
|
|
40657
40798
|
);
|
|
@@ -40659,7 +40800,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
40659
40800
|
printDiff(targetContent, mergedContent);
|
|
40660
40801
|
printAutoConfirmHint();
|
|
40661
40802
|
const confirm = await promptConfirm(
|
|
40662
|
-
|
|
40803
|
+
chalk257.red("Overwrite existing settings.json?"),
|
|
40663
40804
|
false
|
|
40664
40805
|
);
|
|
40665
40806
|
if (!confirm) {
|
|
@@ -41090,7 +41231,7 @@ async function configure() {
|
|
|
41090
41231
|
// src/commands/transcript/list.ts
|
|
41091
41232
|
import { existsSync as existsSync78, readdirSync as readdirSync20, statSync as statSync12 } from "fs";
|
|
41092
41233
|
import { join as join97 } from "path";
|
|
41093
|
-
function
|
|
41234
|
+
function list4() {
|
|
41094
41235
|
const { vttDir } = getTranscriptConfig();
|
|
41095
41236
|
if (!existsSync78(vttDir)) return;
|
|
41096
41237
|
for (const entry of readdirSync20(vttDir)) {
|
|
@@ -41373,7 +41514,7 @@ function registerTranscript(program) {
|
|
|
41373
41514
|
const transcriptCommand = program.command("transcript").description("Meeting transcript utilities").addHelpText("after", () => transcriptWorkflowHelp());
|
|
41374
41515
|
configHelp(transcriptCommand, transcriptConfigHelp);
|
|
41375
41516
|
transcriptCommand.command("configure").description("Configure transcript directories").action(configure);
|
|
41376
|
-
transcriptCommand.command("list").description("List raw .vtt filenames waiting in the pick-up directory").action(
|
|
41517
|
+
transcriptCommand.command("list").description("List raw .vtt filenames waiting in the pick-up directory").action(list4);
|
|
41377
41518
|
transcriptCommand.command("clean <path>").description("Clean any .vtt file and write the result to stdout").option("--format <md|vtt>", "output format", "md").option(
|
|
41378
41519
|
"--timestamps",
|
|
41379
41520
|
"prefix each speaker turn with its start time (--format md only)"
|
|
@@ -41387,9 +41528,9 @@ function registerTranscript(program) {
|
|
|
41387
41528
|
// src/commands/verify/reportVerifyProblems.ts
|
|
41388
41529
|
function verifySection(label2, entries) {
|
|
41389
41530
|
if (entries.length === 0) return void 0;
|
|
41390
|
-
const
|
|
41531
|
+
const list6 = entries.sort().map((entry) => ` ${entry}`).join("\n");
|
|
41391
41532
|
return `${label2}:
|
|
41392
|
-
${
|
|
41533
|
+
${list6}`;
|
|
41393
41534
|
}
|
|
41394
41535
|
function reportVerifyProblems(problems, success) {
|
|
41395
41536
|
const found = problems.filter(
|
|
@@ -42136,7 +42277,7 @@ function registerVerifyChecks(verifyCommand) {
|
|
|
42136
42277
|
}
|
|
42137
42278
|
|
|
42138
42279
|
// src/commands/verify/list.ts
|
|
42139
|
-
function
|
|
42280
|
+
function list5() {
|
|
42140
42281
|
const entries = resolveEntries();
|
|
42141
42282
|
if (entries.length === 0) {
|
|
42142
42283
|
console.error("No verify commands found");
|
|
@@ -42163,7 +42304,7 @@ function registerVerify(program) {
|
|
|
42163
42304
|
"--measure",
|
|
42164
42305
|
"Print a summary table of each command's status and duration after the run"
|
|
42165
42306
|
).option("--verbose", "Show all output (bypass CLAUDECODE suppression)").action(runScope);
|
|
42166
|
-
verifyCommand.command("list").description("List configured verify commands").action(
|
|
42307
|
+
verifyCommand.command("list").description("List configured verify commands").action(list5);
|
|
42167
42308
|
verifyCommand.command("init").description("Add verify scripts to a project").option(
|
|
42168
42309
|
"--package-json",
|
|
42169
42310
|
"Write scripts to package.json instead of assist.yml"
|
|
@@ -42909,7 +43050,7 @@ function registerWatch(program) {
|
|
|
42909
43050
|
|
|
42910
43051
|
// src/commands/roam/auth.ts
|
|
42911
43052
|
import { randomBytes } from "crypto";
|
|
42912
|
-
import
|
|
43053
|
+
import chalk258 from "chalk";
|
|
42913
43054
|
|
|
42914
43055
|
// src/commands/roam/waitForCallback.ts
|
|
42915
43056
|
import { createServer as createServer3 } from "http";
|
|
@@ -43040,13 +43181,13 @@ async function auth() {
|
|
|
43040
43181
|
saveGlobalConfig(config);
|
|
43041
43182
|
const state = randomBytes(16).toString("hex");
|
|
43042
43183
|
console.log(
|
|
43043
|
-
|
|
43184
|
+
chalk258.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
43044
43185
|
);
|
|
43045
|
-
console.log(
|
|
43046
|
-
console.log(
|
|
43047
|
-
console.log(
|
|
43186
|
+
console.log(chalk258.white("http://localhost:14523/callback\n"));
|
|
43187
|
+
console.log(chalk258.blue("Opening browser for authorization..."));
|
|
43188
|
+
console.log(chalk258.dim("Waiting for authorization callback..."));
|
|
43048
43189
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
43049
|
-
console.log(
|
|
43190
|
+
console.log(chalk258.dim("Exchanging code for tokens..."));
|
|
43050
43191
|
const tokens = await exchangeToken({
|
|
43051
43192
|
code,
|
|
43052
43193
|
clientId,
|
|
@@ -43062,7 +43203,7 @@ async function auth() {
|
|
|
43062
43203
|
};
|
|
43063
43204
|
saveGlobalConfig(config);
|
|
43064
43205
|
console.log(
|
|
43065
|
-
|
|
43206
|
+
chalk258.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
43066
43207
|
);
|
|
43067
43208
|
}
|
|
43068
43209
|
|
|
@@ -43351,12 +43492,12 @@ function parseEnvPairs(pairs) {
|
|
|
43351
43492
|
if (pairs.length === 0) return void 0;
|
|
43352
43493
|
const env = {};
|
|
43353
43494
|
for (const pair of pairs) {
|
|
43354
|
-
const
|
|
43355
|
-
if (
|
|
43495
|
+
const eq46 = pair.indexOf("=");
|
|
43496
|
+
if (eq46 <= 0) {
|
|
43356
43497
|
console.error(`--env must be KEY=VALUE, got "${pair}"`);
|
|
43357
43498
|
process.exit(1);
|
|
43358
43499
|
}
|
|
43359
|
-
env[pair.slice(0,
|
|
43500
|
+
env[pair.slice(0, eq46)] = pair.slice(eq46 + 1);
|
|
43360
43501
|
}
|
|
43361
43502
|
return env;
|
|
43362
43503
|
}
|
|
@@ -43369,11 +43510,11 @@ function fail7(spec) {
|
|
|
43369
43510
|
process.exit(1);
|
|
43370
43511
|
}
|
|
43371
43512
|
function parseParamSpec(spec) {
|
|
43372
|
-
const
|
|
43373
|
-
const name =
|
|
43374
|
-
if (
|
|
43375
|
-
if (
|
|
43376
|
-
return { name, default: spec.slice(
|
|
43513
|
+
const eq46 = spec.indexOf("=");
|
|
43514
|
+
const name = eq46 === -1 ? spec : spec.slice(0, eq46);
|
|
43515
|
+
if (eq46 !== -1) {
|
|
43516
|
+
if (eq46 === 0 || name.endsWith("!")) fail7(spec);
|
|
43517
|
+
return { name, default: spec.slice(eq46 + 1) };
|
|
43377
43518
|
}
|
|
43378
43519
|
if (name.endsWith("!")) {
|
|
43379
43520
|
if (name.length === 1) fail7(spec);
|
|
@@ -43601,7 +43742,7 @@ function removeProjectRunConfig(name) {
|
|
|
43601
43742
|
saveConfig(config);
|
|
43602
43743
|
deleteCommandFile(name);
|
|
43603
43744
|
}
|
|
43604
|
-
async function
|
|
43745
|
+
async function remove2(name, options2 = {}) {
|
|
43605
43746
|
if (options2.repo !== void 0) {
|
|
43606
43747
|
const label2 = await removeRepoRunConfig(
|
|
43607
43748
|
name,
|
|
@@ -43624,7 +43765,7 @@ function registerRunSubcommands(runCommand) {
|
|
|
43624
43765
|
).argument("<name>", "Name of the run configuration to remove").option(
|
|
43625
43766
|
"--repo [name]",
|
|
43626
43767
|
"Remove from a repo's override in the shared db instead of assist.yml (defaults to the current repo)"
|
|
43627
|
-
).action((name, opts) =>
|
|
43768
|
+
).action((name, opts) => remove2(name, opts));
|
|
43628
43769
|
}
|
|
43629
43770
|
|
|
43630
43771
|
// src/commands/run/registerRun.ts
|
|
@@ -43638,18 +43779,18 @@ function registerRun(program) {
|
|
|
43638
43779
|
}
|
|
43639
43780
|
|
|
43640
43781
|
// src/commands/sessions/nodes/formatLink.ts
|
|
43641
|
-
import
|
|
43782
|
+
import chalk259 from "chalk";
|
|
43642
43783
|
var STATE_COLOURS = {
|
|
43643
|
-
connected:
|
|
43644
|
-
connecting:
|
|
43645
|
-
disconnected:
|
|
43646
|
-
"version-blocked":
|
|
43784
|
+
connected: chalk259.green,
|
|
43785
|
+
connecting: chalk259.yellow,
|
|
43786
|
+
disconnected: chalk259.red,
|
|
43787
|
+
"version-blocked": chalk259.red
|
|
43647
43788
|
};
|
|
43648
43789
|
function formatLink(link3) {
|
|
43649
|
-
const colour = STATE_COLOURS[link3.state] ??
|
|
43790
|
+
const colour = STATE_COLOURS[link3.state] ?? chalk259.white;
|
|
43650
43791
|
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
43651
43792
|
const error = link3.error ? `
|
|
43652
|
-
${
|
|
43793
|
+
${chalk259.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
43653
43794
|
return ` ${link3.name} ${colour(link3.state)} ${link3.url}${peer}${error}`;
|
|
43654
43795
|
}
|
|
43655
43796
|
|
|
@@ -45531,14 +45672,14 @@ function reason2(error) {
|
|
|
45531
45672
|
|
|
45532
45673
|
// src/commands/sessions/daemon/worktree/removeTree.ts
|
|
45533
45674
|
async function removeTree(clone, worktreePath, force) {
|
|
45534
|
-
const
|
|
45675
|
+
const remove3 = (forced) => git2(clone, [
|
|
45535
45676
|
"worktree",
|
|
45536
45677
|
"remove",
|
|
45537
45678
|
...forced ? ["--force"] : [],
|
|
45538
45679
|
worktreePath
|
|
45539
45680
|
]);
|
|
45540
45681
|
try {
|
|
45541
|
-
await
|
|
45682
|
+
await remove3(force);
|
|
45542
45683
|
return { removed: true };
|
|
45543
45684
|
} catch (error) {
|
|
45544
45685
|
daemonLog(`worktree ${worktreePath} removal failed: ${reason3(error)}`);
|
|
@@ -45549,11 +45690,11 @@ async function removeTree(clone, worktreePath, force) {
|
|
|
45549
45690
|
`its work was discarded and git could not remove it: ${reason3(error)}`
|
|
45550
45691
|
);
|
|
45551
45692
|
}
|
|
45552
|
-
return await removeIgnoringLeftovers(clone,
|
|
45693
|
+
return await removeIgnoringLeftovers(clone, remove3, worktreePath);
|
|
45553
45694
|
}
|
|
45554
|
-
async function removeIgnoringLeftovers(clone,
|
|
45695
|
+
async function removeIgnoringLeftovers(clone, remove3, worktreePath) {
|
|
45555
45696
|
try {
|
|
45556
|
-
await
|
|
45697
|
+
await remove3(true);
|
|
45557
45698
|
daemonLog(
|
|
45558
45699
|
`worktree ${worktreePath} removed on retry; only ignored files remained, its work is landed`
|
|
45559
45700
|
);
|
|
@@ -46566,10 +46707,10 @@ function applyReviewPause(session, activity2) {
|
|
|
46566
46707
|
}
|
|
46567
46708
|
|
|
46568
46709
|
// src/shared/db/getPhaseActiveMs.ts
|
|
46569
|
-
import { and as and17, eq as
|
|
46710
|
+
import { and as and17, eq as eq44 } from "drizzle-orm";
|
|
46570
46711
|
async function getPhaseActiveMs(db, itemId2, phaseIdx) {
|
|
46571
46712
|
const [row3] = await db.select({ activeMs: phaseUsage.activeMs }).from(phaseUsage).where(
|
|
46572
|
-
and17(
|
|
46713
|
+
and17(eq44(phaseUsage.itemId, itemId2), eq44(phaseUsage.phaseIdx, phaseIdx))
|
|
46573
46714
|
);
|
|
46574
46715
|
return row3?.activeMs ?? 0;
|
|
46575
46716
|
}
|
|
@@ -47411,7 +47552,7 @@ async function recordPhaseTranscriptUsage(db, itemId2, phaseIdx, responses) {
|
|
|
47411
47552
|
}
|
|
47412
47553
|
|
|
47413
47554
|
// src/shared/db/recordWindowTokens.ts
|
|
47414
|
-
import { and as and18, eq as
|
|
47555
|
+
import { and as and18, eq as eq45, sql as sql26 } from "drizzle-orm";
|
|
47415
47556
|
async function recordWindowTokens(db, window, resetsAt, tokensUp, tokensDown) {
|
|
47416
47557
|
if (tokensUp <= 0 && tokensDown <= 0) return;
|
|
47417
47558
|
await db.update(usagePeaks).set({
|
|
@@ -47419,9 +47560,9 @@ async function recordWindowTokens(db, window, resetsAt, tokensUp, tokensDown) {
|
|
|
47419
47560
|
tokensDown: sql26`${usagePeaks.tokensDown} + ${tokensDown}`
|
|
47420
47561
|
}).where(
|
|
47421
47562
|
and18(
|
|
47422
|
-
|
|
47423
|
-
|
|
47424
|
-
|
|
47563
|
+
eq45(usagePeaks.window, window),
|
|
47564
|
+
eq45(usagePeaks.resetsAt, resetsAt),
|
|
47565
|
+
eq45(usagePeaks.segment, 0)
|
|
47425
47566
|
)
|
|
47426
47567
|
);
|
|
47427
47568
|
}
|
|
@@ -51331,7 +51472,7 @@ async function closeSession() {
|
|
|
51331
51472
|
}
|
|
51332
51473
|
|
|
51333
51474
|
// src/commands/sessions/nodes/listNodes.ts
|
|
51334
|
-
import
|
|
51475
|
+
import chalk260 from "chalk";
|
|
51335
51476
|
async function nodesReport() {
|
|
51336
51477
|
const live = await queryNodes();
|
|
51337
51478
|
if (live)
|
|
@@ -51348,10 +51489,10 @@ async function listNodes(options2) {
|
|
|
51348
51489
|
console.log(JSON.stringify(report, null, 2));
|
|
51349
51490
|
return;
|
|
51350
51491
|
}
|
|
51351
|
-
console.log(`${report.local} ${
|
|
51492
|
+
console.log(`${report.local} ${chalk260.dim("(this node)")}`);
|
|
51352
51493
|
if (!report.daemonRunning)
|
|
51353
|
-
console.log(
|
|
51354
|
-
if (report.links.length === 0) console.log(
|
|
51494
|
+
console.log(chalk260.dim(" daemon not running; showing configured links"));
|
|
51495
|
+
if (report.links.length === 0) console.log(chalk260.dim(" no links"));
|
|
51355
51496
|
for (const link3 of report.links) console.log(formatLink(link3));
|
|
51356
51497
|
}
|
|
51357
51498
|
|
|
@@ -51373,7 +51514,7 @@ async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
|
51373
51514
|
}
|
|
51374
51515
|
|
|
51375
51516
|
// src/commands/sessions/nodes/printReport.ts
|
|
51376
|
-
import
|
|
51517
|
+
import chalk261 from "chalk";
|
|
51377
51518
|
function printReport(report) {
|
|
51378
51519
|
if (report.links.length === 0) {
|
|
51379
51520
|
console.log(`${report.local} has no links`);
|
|
@@ -51387,11 +51528,11 @@ function printReport(report) {
|
|
|
51387
51528
|
for (const diagnosis of report.links) printDiagnosis(diagnosis);
|
|
51388
51529
|
}
|
|
51389
51530
|
function printDiagnosis(diagnosis) {
|
|
51390
|
-
console.log(`${
|
|
51531
|
+
console.log(`${chalk261.bold(diagnosis.name)} ${chalk261.dim(diagnosis.url)}`);
|
|
51391
51532
|
for (const hop of diagnosis.hops) {
|
|
51392
|
-
const mark = hop.ok ?
|
|
51533
|
+
const mark = hop.ok ? chalk261.green("\u2713") : chalk261.red("\u2717");
|
|
51393
51534
|
console.log(` ${mark} ${hop.hop.padEnd(9)} ${hop.detail ?? hop.error}`);
|
|
51394
|
-
if (hop.remediation) console.log(` ${
|
|
51535
|
+
if (hop.remediation) console.log(` ${chalk261.yellow(hop.remediation)}`);
|
|
51395
51536
|
}
|
|
51396
51537
|
}
|
|
51397
51538
|
|
|
@@ -51463,14 +51604,14 @@ function registerDiagnoseCommands(nodes, calledBy2) {
|
|
|
51463
51604
|
}
|
|
51464
51605
|
|
|
51465
51606
|
// src/commands/sessions/nodes/linkNode.ts
|
|
51466
|
-
import
|
|
51607
|
+
import chalk264 from "chalk";
|
|
51467
51608
|
|
|
51468
51609
|
// src/commands/sessions/nodes/notifyDaemonLinks.ts
|
|
51469
|
-
import
|
|
51610
|
+
import chalk262 from "chalk";
|
|
51470
51611
|
async function notifyDaemonLinks() {
|
|
51471
51612
|
if (!await isDaemonRunning()) {
|
|
51472
51613
|
console.log(
|
|
51473
|
-
|
|
51614
|
+
chalk262.yellow(
|
|
51474
51615
|
"The sessions daemon is not running; it loads the links when it starts."
|
|
51475
51616
|
)
|
|
51476
51617
|
);
|
|
@@ -51478,11 +51619,11 @@ async function notifyDaemonLinks() {
|
|
|
51478
51619
|
}
|
|
51479
51620
|
try {
|
|
51480
51621
|
await sendToDaemonAwaitAck({ type: "reload-links" });
|
|
51481
|
-
console.log(
|
|
51622
|
+
console.log(chalk262.dim("The sessions daemon reloaded its links."));
|
|
51482
51623
|
} catch (error) {
|
|
51483
51624
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
51484
51625
|
console.log(
|
|
51485
|
-
|
|
51626
|
+
chalk262.yellow(
|
|
51486
51627
|
`Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
|
|
51487
51628
|
)
|
|
51488
51629
|
);
|
|
@@ -51490,7 +51631,7 @@ async function notifyDaemonLinks() {
|
|
|
51490
51631
|
}
|
|
51491
51632
|
|
|
51492
51633
|
// src/commands/sessions/nodes/readLinks.ts
|
|
51493
|
-
import
|
|
51634
|
+
import chalk263 from "chalk";
|
|
51494
51635
|
|
|
51495
51636
|
// src/commands/sessions/nodes/writeLinks.ts
|
|
51496
51637
|
async function writeLinks(links2) {
|
|
@@ -51513,7 +51654,7 @@ async function readLinks() {
|
|
|
51513
51654
|
await writeLinks(links2);
|
|
51514
51655
|
const dropped = stored.filter((link3) => !link3.url).map((link3) => link3.name);
|
|
51515
51656
|
console.log(
|
|
51516
|
-
|
|
51657
|
+
chalk263.yellow(`Removed ${dropped.join(", ")}: ${SSH_LINK_RETIRED}`)
|
|
51517
51658
|
);
|
|
51518
51659
|
return links2;
|
|
51519
51660
|
}
|
|
@@ -51569,7 +51710,7 @@ async function linkNode(name, url, options2) {
|
|
|
51569
51710
|
throw new Error(`${name} is this node; link to a different node`);
|
|
51570
51711
|
const link3 = await buildLink(name, url, options2);
|
|
51571
51712
|
await writeLinks([...others, link3]);
|
|
51572
|
-
console.log(
|
|
51713
|
+
console.log(chalk264.green(`Linked ${name} (${link3.url})`));
|
|
51573
51714
|
await notifyDaemonLinks();
|
|
51574
51715
|
}
|
|
51575
51716
|
|
|
@@ -51752,16 +51893,16 @@ function registerPeerActionCommands(nodes, calledBy2) {
|
|
|
51752
51893
|
}
|
|
51753
51894
|
|
|
51754
51895
|
// src/commands/sessions/nodes/unlinkNode.ts
|
|
51755
|
-
import
|
|
51896
|
+
import chalk265 from "chalk";
|
|
51756
51897
|
async function unlinkNode(name) {
|
|
51757
51898
|
const links2 = await readLinks();
|
|
51758
51899
|
const remaining = links2.filter((link3) => link3.name !== name);
|
|
51759
51900
|
if (remaining.length === links2.length) {
|
|
51760
|
-
console.log(
|
|
51901
|
+
console.log(chalk265.yellow(`No link named ${name}`));
|
|
51761
51902
|
return;
|
|
51762
51903
|
}
|
|
51763
51904
|
await writeLinks(remaining);
|
|
51764
|
-
console.log(
|
|
51905
|
+
console.log(chalk265.green(`Unlinked ${name}`));
|
|
51765
51906
|
await notifyDaemonLinks();
|
|
51766
51907
|
}
|
|
51767
51908
|
|
|
@@ -51995,10 +52136,10 @@ function createProgram() {
|
|
|
51995
52136
|
}
|
|
51996
52137
|
|
|
51997
52138
|
// src/reportCliError.ts
|
|
51998
|
-
import
|
|
52139
|
+
import chalk266 from "chalk";
|
|
51999
52140
|
function reportCliError(error) {
|
|
52000
52141
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
52001
|
-
console.error(
|
|
52142
|
+
console.error(chalk266.red(error.message));
|
|
52002
52143
|
} else {
|
|
52003
52144
|
console.error(error);
|
|
52004
52145
|
}
|