@staff0rd/assist 0.768.3 → 0.769.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 +3 -2
- package/claude/commands/extension.md +19 -0
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +672 -630
- 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.769.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -15748,9 +15748,14 @@ function linkedRequester(req) {
|
|
|
15748
15748
|
|
|
15749
15749
|
// src/commands/sessions/web/restartMenu/reExecWebServer.ts
|
|
15750
15750
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
15751
|
-
|
|
15752
|
-
|
|
15751
|
+
|
|
15752
|
+
// src/commands/sessions/web/restartMenu/resolveExecve.ts
|
|
15753
|
+
function resolveExecve(platform = process.platform, execve = process.execve?.bind(process)) {
|
|
15754
|
+
if (platform === "win32") return null;
|
|
15755
|
+
return execve ?? null;
|
|
15753
15756
|
}
|
|
15757
|
+
|
|
15758
|
+
// src/commands/sessions/web/restartMenu/reExecWebServer.ts
|
|
15754
15759
|
function withNoOpen(args) {
|
|
15755
15760
|
return args.includes("--no-open") ? args : [...args, "--no-open"];
|
|
15756
15761
|
}
|
|
@@ -15789,7 +15794,12 @@ async function restartWeb(req, res, deps2 = {}) {
|
|
|
15789
15794
|
res.once("finish", resolve28);
|
|
15790
15795
|
respondJson(res, 200, { ok: true });
|
|
15791
15796
|
});
|
|
15792
|
-
|
|
15797
|
+
try {
|
|
15798
|
+
await performRestart(target, deps2);
|
|
15799
|
+
} catch (error) {
|
|
15800
|
+
const message3 = error instanceof Error ? error.message : String(error);
|
|
15801
|
+
console.log(`restart ${target} failed: ${message3}`);
|
|
15802
|
+
}
|
|
15793
15803
|
}
|
|
15794
15804
|
async function performRestart(target, deps2 = {}) {
|
|
15795
15805
|
const { restartDaemonFn = restartDaemon, reExecFn = reExecWebServer } = deps2;
|
|
@@ -21098,18 +21108,46 @@ async function criteriaExtension() {
|
|
|
21098
21108
|
console.log(chalk137.dim(`load the unpacked extension from ${path106}`));
|
|
21099
21109
|
}
|
|
21100
21110
|
|
|
21111
|
+
// src/commands/criteriaExtension/printCriteriaExtensionUrl.ts
|
|
21112
|
+
import { readFile as readFile4 } from "fs/promises";
|
|
21113
|
+
import { join as join49 } from "path";
|
|
21114
|
+
import chalk138 from "chalk";
|
|
21115
|
+
|
|
21116
|
+
// src/commands/criteriaExtension/latestUpdateLink.ts
|
|
21117
|
+
function latestUpdateLink(manifest, updates) {
|
|
21118
|
+
const { id } = JSON.parse(manifest).browser_specific_settings.gecko;
|
|
21119
|
+
return JSON.parse(updates).addons[id]?.updates.at(-1)?.update_link;
|
|
21120
|
+
}
|
|
21121
|
+
|
|
21122
|
+
// src/commands/criteriaExtension/printCriteriaExtensionUrl.ts
|
|
21123
|
+
async function printCriteriaExtensionUrl() {
|
|
21124
|
+
const manifest = await readFile4(
|
|
21125
|
+
join49(criteriaExtensionDir(), "manifest.json"),
|
|
21126
|
+
"utf8"
|
|
21127
|
+
);
|
|
21128
|
+
const { update_url } = JSON.parse(manifest).browser_specific_settings.gecko;
|
|
21129
|
+
const response = await fetch(update_url);
|
|
21130
|
+
const link3 = response.ok ? latestUpdateLink(manifest, await response.text()) : void 0;
|
|
21131
|
+
if (!link3) {
|
|
21132
|
+
console.log(chalk138.red(`no signed build found in ${update_url}`));
|
|
21133
|
+
process.exitCode = 1;
|
|
21134
|
+
return;
|
|
21135
|
+
}
|
|
21136
|
+
console.log(link3);
|
|
21137
|
+
}
|
|
21138
|
+
|
|
21101
21139
|
// src/commands/criteriaExtension/signCriteriaExtension.ts
|
|
21102
21140
|
import { rm as rm2 } from "fs/promises";
|
|
21103
21141
|
import { homedir as homedir20, tmpdir as tmpdir3 } from "os";
|
|
21104
|
-
import { join as
|
|
21105
|
-
import
|
|
21142
|
+
import { join as join55 } from "path";
|
|
21143
|
+
import chalk140 from "chalk";
|
|
21106
21144
|
|
|
21107
21145
|
// src/commands/criteriaExtension/copySignedXpi.ts
|
|
21108
21146
|
import { copyFile } from "fs/promises";
|
|
21109
|
-
import { join as
|
|
21147
|
+
import { join as join50 } from "path";
|
|
21110
21148
|
var SIGNED_XPI_NAME = "criteria-extension.xpi";
|
|
21111
21149
|
async function copySignedXpi(xpi, dir) {
|
|
21112
|
-
const fixed2 =
|
|
21150
|
+
const fixed2 = join50(dir, SIGNED_XPI_NAME);
|
|
21113
21151
|
if (fixed2 === xpi) return fixed2;
|
|
21114
21152
|
await copyFile(xpi, fixed2);
|
|
21115
21153
|
return fixed2;
|
|
@@ -21118,16 +21156,16 @@ async function copySignedXpi(xpi, dir) {
|
|
|
21118
21156
|
// src/commands/criteriaExtension/findSignedXpi.ts
|
|
21119
21157
|
import { existsSync as existsSync47 } from "fs";
|
|
21120
21158
|
import { readdir } from "fs/promises";
|
|
21121
|
-
import { join as
|
|
21159
|
+
import { join as join51 } from "path";
|
|
21122
21160
|
async function findSignedXpi(dir) {
|
|
21123
21161
|
if (!existsSync47(dir)) return null;
|
|
21124
21162
|
const name = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
|
|
21125
|
-
return name ?
|
|
21163
|
+
return name ? join51(dir, name) : null;
|
|
21126
21164
|
}
|
|
21127
21165
|
|
|
21128
21166
|
// src/commands/criteriaExtension/signedAddonInstallPath.ts
|
|
21129
21167
|
import { cp as cp2 } from "fs/promises";
|
|
21130
|
-
import
|
|
21168
|
+
import chalk139 from "chalk";
|
|
21131
21169
|
var WSL_WINDOWS_XPI = "/mnt/c/tools/criteria-extension.xpi";
|
|
21132
21170
|
var WSL_WINDOWS_PATH2 = String.raw`C:\tools\criteria-extension.xpi`;
|
|
21133
21171
|
async function signedAddonInstallPath(xpi) {
|
|
@@ -21137,7 +21175,7 @@ async function signedAddonInstallPath(xpi) {
|
|
|
21137
21175
|
return WSL_WINDOWS_PATH2;
|
|
21138
21176
|
} catch {
|
|
21139
21177
|
console.log(
|
|
21140
|
-
|
|
21178
|
+
chalk139.yellow(`could not copy the add-on to ${WSL_WINDOWS_PATH2}`)
|
|
21141
21179
|
);
|
|
21142
21180
|
return xpi;
|
|
21143
21181
|
}
|
|
@@ -21145,10 +21183,10 @@ async function signedAddonInstallPath(xpi) {
|
|
|
21145
21183
|
|
|
21146
21184
|
// src/commands/criteriaExtension/signPreflightProblem.ts
|
|
21147
21185
|
import { existsSync as existsSync48 } from "fs";
|
|
21148
|
-
import { join as
|
|
21186
|
+
import { join as join52 } from "path";
|
|
21149
21187
|
var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
|
|
21150
21188
|
function signPreflightProblem(source) {
|
|
21151
|
-
if (!existsSync48(
|
|
21189
|
+
if (!existsSync48(join52(source, "content.js")))
|
|
21152
21190
|
return {
|
|
21153
21191
|
message: `no content.js in ${source}`,
|
|
21154
21192
|
hint: "run npm run build to bundle the content script"
|
|
@@ -21162,8 +21200,8 @@ function signPreflightProblem(source) {
|
|
|
21162
21200
|
}
|
|
21163
21201
|
|
|
21164
21202
|
// src/commands/criteriaExtension/stageCriteriaExtension.ts
|
|
21165
|
-
import { cp as cp3, mkdir as mkdir5, readFile as
|
|
21166
|
-
import { basename as basename13, join as
|
|
21203
|
+
import { cp as cp3, mkdir as mkdir5, readFile as readFile5, rm, writeFile as writeFile4 } from "fs/promises";
|
|
21204
|
+
import { basename as basename13, join as join53 } from "path";
|
|
21167
21205
|
|
|
21168
21206
|
// src/commands/criteriaExtension/stampManifestVersion.ts
|
|
21169
21207
|
function stampManifestVersion(manifest, version2) {
|
|
@@ -21180,17 +21218,17 @@ async function stageCriteriaExtension(source, staging, version2) {
|
|
|
21180
21218
|
recursive: true,
|
|
21181
21219
|
filter: (path106) => basename13(path106) !== "updates.json"
|
|
21182
21220
|
});
|
|
21183
|
-
const manifest =
|
|
21221
|
+
const manifest = join53(staging, "manifest.json");
|
|
21184
21222
|
const stamped = stampManifestVersion(
|
|
21185
|
-
await
|
|
21223
|
+
await readFile5(manifest, "utf8"),
|
|
21186
21224
|
version2
|
|
21187
21225
|
);
|
|
21188
21226
|
await writeFile4(manifest, stamped);
|
|
21189
21227
|
}
|
|
21190
21228
|
|
|
21191
21229
|
// src/commands/criteriaExtension/writeUpdateManifest.ts
|
|
21192
|
-
import { readFile as
|
|
21193
|
-
import { join as
|
|
21230
|
+
import { readFile as readFile6, writeFile as writeFile5 } from "fs/promises";
|
|
21231
|
+
import { join as join54 } from "path";
|
|
21194
21232
|
|
|
21195
21233
|
// src/commands/criteriaExtension/buildUpdateManifest.ts
|
|
21196
21234
|
var RELEASE_DOWNLOAD_URL = "https://github.com/staff0rd/assist/releases/download";
|
|
@@ -21215,30 +21253,30 @@ function buildUpdateManifest(manifest, version2) {
|
|
|
21215
21253
|
// src/commands/criteriaExtension/writeUpdateManifest.ts
|
|
21216
21254
|
async function writeUpdateManifest(source, dir, version2) {
|
|
21217
21255
|
await writeFile5(
|
|
21218
|
-
|
|
21256
|
+
join54(dir, "updates.json"),
|
|
21219
21257
|
buildUpdateManifest(
|
|
21220
|
-
await
|
|
21258
|
+
await readFile6(join54(source, "manifest.json"), "utf8"),
|
|
21221
21259
|
version2
|
|
21222
21260
|
)
|
|
21223
21261
|
);
|
|
21224
21262
|
}
|
|
21225
21263
|
|
|
21226
21264
|
// src/commands/criteriaExtension/signCriteriaExtension.ts
|
|
21227
|
-
var ARTIFACTS_DIR =
|
|
21228
|
-
var STAGING_DIR =
|
|
21265
|
+
var ARTIFACTS_DIR = join55(homedir20(), ".assist", "criteria-extension");
|
|
21266
|
+
var STAGING_DIR = join55(tmpdir3(), "assist-criteria-extension");
|
|
21229
21267
|
async function signCriteriaExtension() {
|
|
21230
21268
|
const source = criteriaExtensionDir();
|
|
21231
21269
|
const problem = signPreflightProblem(source);
|
|
21232
21270
|
if (problem) {
|
|
21233
|
-
console.log(
|
|
21234
|
-
console.log(
|
|
21271
|
+
console.log(chalk140.red(problem.message));
|
|
21272
|
+
console.log(chalk140.dim(problem.hint));
|
|
21235
21273
|
process.exitCode = 1;
|
|
21236
21274
|
return;
|
|
21237
21275
|
}
|
|
21238
21276
|
const { version: version2 } = package_default;
|
|
21239
21277
|
await stageCriteriaExtension(source, STAGING_DIR, version2);
|
|
21240
21278
|
await rm2(ARTIFACTS_DIR, { recursive: true, force: true });
|
|
21241
|
-
console.log(
|
|
21279
|
+
console.log(chalk140.bold(`signing version ${version2} for self-distribution`));
|
|
21242
21280
|
const { done: done2 } = spawnInherit("npx", [
|
|
21243
21281
|
"--yes",
|
|
21244
21282
|
"web-ext",
|
|
@@ -21248,13 +21286,13 @@ async function signCriteriaExtension() {
|
|
|
21248
21286
|
"--channel=unlisted"
|
|
21249
21287
|
]);
|
|
21250
21288
|
if (await done2 !== 0) {
|
|
21251
|
-
console.log(
|
|
21289
|
+
console.log(chalk140.red("web-ext sign failed"));
|
|
21252
21290
|
process.exitCode = 1;
|
|
21253
21291
|
return;
|
|
21254
21292
|
}
|
|
21255
21293
|
const xpi = await findSignedXpi(ARTIFACTS_DIR);
|
|
21256
21294
|
if (!xpi) {
|
|
21257
|
-
console.log(
|
|
21295
|
+
console.log(chalk140.red(`web-ext wrote no .xpi into ${ARTIFACTS_DIR}`));
|
|
21258
21296
|
process.exitCode = 1;
|
|
21259
21297
|
return;
|
|
21260
21298
|
}
|
|
@@ -21262,7 +21300,7 @@ async function signCriteriaExtension() {
|
|
|
21262
21300
|
const path106 = await signedAddonInstallPath(
|
|
21263
21301
|
await copySignedXpi(xpi, ARTIFACTS_DIR)
|
|
21264
21302
|
);
|
|
21265
|
-
console.log(
|
|
21303
|
+
console.log(chalk140.dim(`install the signed add-on from ${path106}`));
|
|
21266
21304
|
}
|
|
21267
21305
|
|
|
21268
21306
|
// src/commands/registerCriteriaExtension.ts
|
|
@@ -21272,9 +21310,13 @@ function registerCriteriaExtension(program2) {
|
|
|
21272
21310
|
).option(
|
|
21273
21311
|
"--sign",
|
|
21274
21312
|
"Sign the extension on AMO's unlisted channel and print the .xpi to install permanently in Firefox (needs WEB_EXT_API_KEY and WEB_EXT_API_SECRET)"
|
|
21275
|
-
).
|
|
21276
|
-
|
|
21277
|
-
|
|
21313
|
+
).option(
|
|
21314
|
+
"--url",
|
|
21315
|
+
"Print the download URL of the latest signed Firefox build, read from the update manifest on main"
|
|
21316
|
+
).action((options2) => {
|
|
21317
|
+
if (options2.url) return printCriteriaExtensionUrl();
|
|
21318
|
+
return options2.sign ? signCriteriaExtension() : criteriaExtension();
|
|
21319
|
+
});
|
|
21278
21320
|
}
|
|
21279
21321
|
|
|
21280
21322
|
// src/shared/db/retired/findRetiredTables.ts
|
|
@@ -21319,11 +21361,11 @@ async function dropRetiredTables(exec3) {
|
|
|
21319
21361
|
}
|
|
21320
21362
|
|
|
21321
21363
|
// src/commands/db/reportRetiredTables.ts
|
|
21322
|
-
import
|
|
21364
|
+
import chalk141 from "chalk";
|
|
21323
21365
|
function reportRetiredTables(tables) {
|
|
21324
21366
|
for (const table of tables) {
|
|
21325
21367
|
console.error(
|
|
21326
|
-
|
|
21368
|
+
chalk141.yellow(
|
|
21327
21369
|
`Retired table ${table.name} still exists (${table.rows} rows). Run \`assist db drop-retired\` to drop it.`
|
|
21328
21370
|
)
|
|
21329
21371
|
);
|
|
@@ -21331,40 +21373,40 @@ function reportRetiredTables(tables) {
|
|
|
21331
21373
|
}
|
|
21332
21374
|
|
|
21333
21375
|
// src/commands/db/reportMigrationStatus.ts
|
|
21334
|
-
import
|
|
21376
|
+
import chalk142 from "chalk";
|
|
21335
21377
|
function reportApplied(applied) {
|
|
21336
21378
|
if (applied.length === 0) {
|
|
21337
|
-
console.error(
|
|
21379
|
+
console.error(chalk142.green("Database is up to date; nothing to apply."));
|
|
21338
21380
|
return;
|
|
21339
21381
|
}
|
|
21340
21382
|
for (const migration of applied) {
|
|
21341
21383
|
console.error(
|
|
21342
|
-
|
|
21384
|
+
chalk142.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
21343
21385
|
);
|
|
21344
21386
|
}
|
|
21345
21387
|
}
|
|
21346
21388
|
function reportMigrationStatus(status2) {
|
|
21347
21389
|
if (status2.state === "in-sync") {
|
|
21348
21390
|
console.error(
|
|
21349
|
-
|
|
21391
|
+
chalk142.green(`In sync at migration ${status2.version} (latest).`)
|
|
21350
21392
|
);
|
|
21351
21393
|
return;
|
|
21352
21394
|
}
|
|
21353
21395
|
if (status2.state === "behind") {
|
|
21354
21396
|
console.error(
|
|
21355
|
-
|
|
21397
|
+
chalk142.yellow(
|
|
21356
21398
|
`Behind: applied ${status2.applied}, build expects ${status2.expected}.`
|
|
21357
21399
|
)
|
|
21358
21400
|
);
|
|
21359
21401
|
console.error(
|
|
21360
|
-
|
|
21402
|
+
chalk142.yellow(
|
|
21361
21403
|
`Pending: ${status2.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
21362
21404
|
)
|
|
21363
21405
|
);
|
|
21364
21406
|
return;
|
|
21365
21407
|
}
|
|
21366
21408
|
console.error(
|
|
21367
|
-
|
|
21409
|
+
chalk142.red(
|
|
21368
21410
|
`Ahead: applied ${status2.applied}, build knows ${status2.expected}. Update assist.`
|
|
21369
21411
|
)
|
|
21370
21412
|
);
|
|
@@ -21406,15 +21448,15 @@ function registerDb(program2) {
|
|
|
21406
21448
|
|
|
21407
21449
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
21408
21450
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs";
|
|
21409
|
-
import
|
|
21451
|
+
import chalk143 from "chalk";
|
|
21410
21452
|
|
|
21411
21453
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
21412
|
-
import { join as
|
|
21454
|
+
import { join as join56 } from "path";
|
|
21413
21455
|
function getMigrationPinPath(pin2) {
|
|
21414
|
-
return
|
|
21456
|
+
return join56(getRestrictedDir(), `db-migration-pin-${pin2}.json`);
|
|
21415
21457
|
}
|
|
21416
21458
|
function getMigrationApprovalPath(migrationId) {
|
|
21417
|
-
return
|
|
21459
|
+
return join56(getRestrictedDir(), `db-migration-approval-${migrationId}.json`);
|
|
21418
21460
|
}
|
|
21419
21461
|
|
|
21420
21462
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
@@ -21437,7 +21479,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
21437
21479
|
sweepRestrictedDir();
|
|
21438
21480
|
const state = readMigrationPinState(pin2);
|
|
21439
21481
|
if (!state) {
|
|
21440
|
-
console.error(
|
|
21482
|
+
console.error(chalk143.red(`No pending migration unlock for pin: ${pin2}`));
|
|
21441
21483
|
process.exitCode = 1;
|
|
21442
21484
|
return;
|
|
21443
21485
|
}
|
|
@@ -21447,7 +21489,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
21447
21489
|
);
|
|
21448
21490
|
unlinkSync9(getMigrationPinPath(pin2));
|
|
21449
21491
|
console.log(
|
|
21450
|
-
|
|
21492
|
+
chalk143.green(
|
|
21451
21493
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
21452
21494
|
)
|
|
21453
21495
|
);
|
|
@@ -21456,7 +21498,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
21456
21498
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
21457
21499
|
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync27 } from "fs";
|
|
21458
21500
|
import { randomInt as randomInt2 } from "crypto";
|
|
21459
|
-
import
|
|
21501
|
+
import chalk144 from "chalk";
|
|
21460
21502
|
|
|
21461
21503
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
21462
21504
|
function nextMigrationId() {
|
|
@@ -21471,7 +21513,7 @@ function dbMigrationUnlock() {
|
|
|
21471
21513
|
sweepRestrictedDir();
|
|
21472
21514
|
writeFileSync27(getMigrationPinPath(pin2), JSON.stringify({ pin: pin2, migrationId }));
|
|
21473
21515
|
console.error(
|
|
21474
|
-
|
|
21516
|
+
chalk144.yellow.bold(
|
|
21475
21517
|
"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."
|
|
21476
21518
|
)
|
|
21477
21519
|
);
|
|
@@ -21481,7 +21523,7 @@ function dbMigrationUnlock() {
|
|
|
21481
21523
|
});
|
|
21482
21524
|
if (!delivered) {
|
|
21483
21525
|
console.error(
|
|
21484
|
-
|
|
21526
|
+
chalk144.red(
|
|
21485
21527
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
21486
21528
|
)
|
|
21487
21529
|
);
|
|
@@ -21491,7 +21533,7 @@ function dbMigrationUnlock() {
|
|
|
21491
21533
|
console.log(
|
|
21492
21534
|
`A confirmation pin was sent to your desktop notifications.
|
|
21493
21535
|
To approve creating migration ${migrationId}, run:
|
|
21494
|
-
${
|
|
21536
|
+
${chalk144.cyan(" assist db-migration confirm <PIN>")}
|
|
21495
21537
|
using the pin from that notification.`
|
|
21496
21538
|
);
|
|
21497
21539
|
}
|
|
@@ -21511,7 +21553,7 @@ function registerDbMigration(parent) {
|
|
|
21511
21553
|
|
|
21512
21554
|
// src/commands/deploy/redirect.ts
|
|
21513
21555
|
import { existsSync as existsSync50, readFileSync as readFileSync32, writeFileSync as writeFileSync28 } from "fs";
|
|
21514
|
-
import
|
|
21556
|
+
import chalk145 from "chalk";
|
|
21515
21557
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
21516
21558
|
if (!window.location.pathname.endsWith('/')) {
|
|
21517
21559
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -21520,23 +21562,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
21520
21562
|
function redirect() {
|
|
21521
21563
|
const indexPath = "index.html";
|
|
21522
21564
|
if (!existsSync50(indexPath)) {
|
|
21523
|
-
console.log(
|
|
21565
|
+
console.log(chalk145.yellow("No index.html found"));
|
|
21524
21566
|
return;
|
|
21525
21567
|
}
|
|
21526
21568
|
const content = readFileSync32(indexPath, "utf8");
|
|
21527
21569
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
21528
|
-
console.log(
|
|
21570
|
+
console.log(chalk145.dim("Trailing slash script already present"));
|
|
21529
21571
|
return;
|
|
21530
21572
|
}
|
|
21531
21573
|
const headCloseIndex = content.indexOf("</head>");
|
|
21532
21574
|
if (headCloseIndex === -1) {
|
|
21533
|
-
console.log(
|
|
21575
|
+
console.log(chalk145.red("Could not find </head> tag in index.html"));
|
|
21534
21576
|
return;
|
|
21535
21577
|
}
|
|
21536
21578
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
21537
21579
|
${content.slice(headCloseIndex)}`;
|
|
21538
21580
|
writeFileSync28(indexPath, newContent);
|
|
21539
|
-
console.log(
|
|
21581
|
+
console.log(chalk145.green("Added trailing slash redirect to index.html"));
|
|
21540
21582
|
}
|
|
21541
21583
|
|
|
21542
21584
|
// src/commands/registerDeploy.ts
|
|
@@ -21552,10 +21594,10 @@ import { basename as basename15 } from "path";
|
|
|
21552
21594
|
|
|
21553
21595
|
// src/commands/devlog/loadBlogSkipDays.ts
|
|
21554
21596
|
import { homedir as homedir21 } from "os";
|
|
21555
|
-
import { join as
|
|
21556
|
-
var BLOG_REPO_ROOT =
|
|
21597
|
+
import { join as join57 } from "path";
|
|
21598
|
+
var BLOG_REPO_ROOT = join57(homedir21(), "git/blog");
|
|
21557
21599
|
function loadBlogSkipDays(repoName) {
|
|
21558
|
-
const config = loadRawYaml(
|
|
21600
|
+
const config = loadRawYaml(join57(BLOG_REPO_ROOT, "assist.yml"));
|
|
21559
21601
|
const devlog = config.devlog;
|
|
21560
21602
|
const skip2 = devlog?.skip;
|
|
21561
21603
|
return new Set(skip2?.[repoName]);
|
|
@@ -21563,17 +21605,17 @@ function loadBlogSkipDays(repoName) {
|
|
|
21563
21605
|
|
|
21564
21606
|
// src/commands/devlog/shared.ts
|
|
21565
21607
|
import { execSync as execSync31 } from "child_process";
|
|
21566
|
-
import
|
|
21608
|
+
import chalk146 from "chalk";
|
|
21567
21609
|
|
|
21568
21610
|
// src/shared/getRepoName.ts
|
|
21569
21611
|
import { existsSync as existsSync51, readFileSync as readFileSync33 } from "fs";
|
|
21570
|
-
import { basename as basename14, join as
|
|
21612
|
+
import { basename as basename14, join as join58 } from "path";
|
|
21571
21613
|
function getRepoName() {
|
|
21572
21614
|
const config = loadConfig();
|
|
21573
21615
|
if (config.devlog?.name) {
|
|
21574
21616
|
return config.devlog.name;
|
|
21575
21617
|
}
|
|
21576
|
-
const packageJsonPath =
|
|
21618
|
+
const packageJsonPath = join58(process.cwd(), "package.json");
|
|
21577
21619
|
if (existsSync51(packageJsonPath)) {
|
|
21578
21620
|
try {
|
|
21579
21621
|
const content = readFileSync33(packageJsonPath, "utf8");
|
|
@@ -21589,8 +21631,8 @@ function getRepoName() {
|
|
|
21589
21631
|
|
|
21590
21632
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
21591
21633
|
import { readdirSync as readdirSync7, readFileSync as readFileSync34 } from "fs";
|
|
21592
|
-
import { join as
|
|
21593
|
-
var DEVLOG_DIR =
|
|
21634
|
+
import { join as join59 } from "path";
|
|
21635
|
+
var DEVLOG_DIR = join59(BLOG_REPO_ROOT, "src/content/devlog");
|
|
21594
21636
|
function extractFrontmatter(content) {
|
|
21595
21637
|
const fm = content.match(/^---\n([\s\S]*?)\n---/);
|
|
21596
21638
|
return fm?.[1] ?? null;
|
|
@@ -21618,7 +21660,7 @@ function readDevlogFiles(callback) {
|
|
|
21618
21660
|
try {
|
|
21619
21661
|
const files = readdirSync7(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
21620
21662
|
for (const file of files) {
|
|
21621
|
-
const content = readFileSync34(
|
|
21663
|
+
const content = readFileSync34(join59(DEVLOG_DIR, file), "utf8");
|
|
21622
21664
|
const parsed = parseFrontmatter(content, file);
|
|
21623
21665
|
if (parsed) callback(parsed);
|
|
21624
21666
|
}
|
|
@@ -21672,13 +21714,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
21672
21714
|
}
|
|
21673
21715
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
21674
21716
|
for (const commit2 of commits2) {
|
|
21675
|
-
console.log(` ${
|
|
21717
|
+
console.log(` ${chalk146.yellow(commit2.hash)} ${commit2.message}`);
|
|
21676
21718
|
if (verbose) {
|
|
21677
21719
|
const visibleFiles = commit2.files.filter(
|
|
21678
21720
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
21679
21721
|
);
|
|
21680
21722
|
for (const file of visibleFiles) {
|
|
21681
|
-
console.log(` ${
|
|
21723
|
+
console.log(` ${chalk146.dim(file)}`);
|
|
21682
21724
|
}
|
|
21683
21725
|
}
|
|
21684
21726
|
}
|
|
@@ -21703,15 +21745,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
21703
21745
|
}
|
|
21704
21746
|
|
|
21705
21747
|
// src/commands/devlog/list/printDateHeader.ts
|
|
21706
|
-
import
|
|
21748
|
+
import chalk147 from "chalk";
|
|
21707
21749
|
function printDateHeader(date, isSkipped, entries) {
|
|
21708
21750
|
if (isSkipped) {
|
|
21709
|
-
console.log(`${
|
|
21751
|
+
console.log(`${chalk147.bold.blue(date)} ${chalk147.dim("skipped")}`);
|
|
21710
21752
|
} else if (entries && entries.length > 0) {
|
|
21711
|
-
const entryInfo = entries.map((e) => `${
|
|
21712
|
-
console.log(`${
|
|
21753
|
+
const entryInfo = entries.map((e) => `${chalk147.green(e.version)} ${e.title}`).join(" | ");
|
|
21754
|
+
console.log(`${chalk147.bold.blue(date)} ${entryInfo}`);
|
|
21713
21755
|
} else {
|
|
21714
|
-
console.log(`${
|
|
21756
|
+
console.log(`${chalk147.bold.blue(date)} ${chalk147.red("\u26A0 devlog missing")}`);
|
|
21715
21757
|
}
|
|
21716
21758
|
}
|
|
21717
21759
|
|
|
@@ -21815,24 +21857,24 @@ function bumpVersion(version2, type) {
|
|
|
21815
21857
|
|
|
21816
21858
|
// src/commands/devlog/next/displayNextEntry.ts
|
|
21817
21859
|
import { execFileSync as execFileSync7 } from "child_process";
|
|
21818
|
-
import
|
|
21860
|
+
import chalk149 from "chalk";
|
|
21819
21861
|
|
|
21820
21862
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
21821
|
-
import
|
|
21863
|
+
import chalk148 from "chalk";
|
|
21822
21864
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
21823
21865
|
if (conventional && firstHash) {
|
|
21824
21866
|
const version2 = getVersionAtCommit(firstHash);
|
|
21825
21867
|
if (version2) {
|
|
21826
|
-
console.log(`${
|
|
21868
|
+
console.log(`${chalk148.bold("version:")} ${stripToMinor(version2)}`);
|
|
21827
21869
|
} else {
|
|
21828
|
-
console.log(`${
|
|
21870
|
+
console.log(`${chalk148.bold("version:")} ${chalk148.red("unknown")}`);
|
|
21829
21871
|
}
|
|
21830
21872
|
} else if (patchVersion && minorVersion) {
|
|
21831
21873
|
console.log(
|
|
21832
|
-
`${
|
|
21874
|
+
`${chalk148.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
21833
21875
|
);
|
|
21834
21876
|
} else {
|
|
21835
|
-
console.log(`${
|
|
21877
|
+
console.log(`${chalk148.bold("version:")} v0.1 (initial)`);
|
|
21836
21878
|
}
|
|
21837
21879
|
}
|
|
21838
21880
|
|
|
@@ -21880,16 +21922,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
21880
21922
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
21881
21923
|
}
|
|
21882
21924
|
function logName(repoName) {
|
|
21883
|
-
console.log(`${
|
|
21925
|
+
console.log(`${chalk149.bold("name:")} ${repoName}`);
|
|
21884
21926
|
}
|
|
21885
21927
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
21886
21928
|
logName(ctx.repoName);
|
|
21887
21929
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
21888
|
-
console.log(
|
|
21930
|
+
console.log(chalk149.bold.blue(targetDate));
|
|
21889
21931
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
21890
21932
|
}
|
|
21891
21933
|
function logNoCommits(lastInfo) {
|
|
21892
|
-
console.log(
|
|
21934
|
+
console.log(chalk149.dim(noCommitsMessage(!!lastInfo)));
|
|
21893
21935
|
}
|
|
21894
21936
|
|
|
21895
21937
|
// src/commands/devlog/next.ts
|
|
@@ -21930,11 +21972,11 @@ function next2(options2) {
|
|
|
21930
21972
|
import { execSync as execSync33 } from "child_process";
|
|
21931
21973
|
|
|
21932
21974
|
// src/commands/devlog/repos/printReposTable.ts
|
|
21933
|
-
import
|
|
21975
|
+
import chalk150 from "chalk";
|
|
21934
21976
|
function colorStatus(status2) {
|
|
21935
|
-
if (status2 === "missing") return
|
|
21936
|
-
if (status2 === "outdated") return
|
|
21937
|
-
return
|
|
21977
|
+
if (status2 === "missing") return chalk150.red(status2);
|
|
21978
|
+
if (status2 === "outdated") return chalk150.yellow(status2);
|
|
21979
|
+
return chalk150.green(status2);
|
|
21938
21980
|
}
|
|
21939
21981
|
function formatRow(row, nameWidth) {
|
|
21940
21982
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -21948,8 +21990,8 @@ function printReposTable(rows) {
|
|
|
21948
21990
|
"Last Devlog".padEnd(11),
|
|
21949
21991
|
"Status"
|
|
21950
21992
|
].join(" ");
|
|
21951
|
-
console.log(
|
|
21952
|
-
console.log(
|
|
21993
|
+
console.log(chalk150.dim(header));
|
|
21994
|
+
console.log(chalk150.dim("-".repeat(header.length)));
|
|
21953
21995
|
for (const row of rows) {
|
|
21954
21996
|
console.log(formatRow(row, nameWidth));
|
|
21955
21997
|
}
|
|
@@ -22006,15 +22048,15 @@ function repos(options2) {
|
|
|
22006
22048
|
|
|
22007
22049
|
// src/commands/devlog/skip.ts
|
|
22008
22050
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
22009
|
-
import { join as
|
|
22010
|
-
import
|
|
22051
|
+
import { join as join60 } from "path";
|
|
22052
|
+
import chalk151 from "chalk";
|
|
22011
22053
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
22012
22054
|
function getBlogConfigPath() {
|
|
22013
|
-
return
|
|
22055
|
+
return join60(BLOG_REPO_ROOT, "assist.yml");
|
|
22014
22056
|
}
|
|
22015
22057
|
function skip(date) {
|
|
22016
22058
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
22017
|
-
console.log(
|
|
22059
|
+
console.log(chalk151.red("Invalid date format. Use YYYY-MM-DD"));
|
|
22018
22060
|
process.exit(1);
|
|
22019
22061
|
}
|
|
22020
22062
|
const repoName = getRepoName();
|
|
@@ -22025,7 +22067,7 @@ function skip(date) {
|
|
|
22025
22067
|
const skipDays = skip2[repoName] ?? [];
|
|
22026
22068
|
if (skipDays.includes(date)) {
|
|
22027
22069
|
console.log(
|
|
22028
|
-
|
|
22070
|
+
chalk151.yellow(`${date} is already in skip list for ${repoName}`)
|
|
22029
22071
|
);
|
|
22030
22072
|
return;
|
|
22031
22073
|
}
|
|
@@ -22035,20 +22077,20 @@ function skip(date) {
|
|
|
22035
22077
|
devlog.skip = skip2;
|
|
22036
22078
|
config.devlog = devlog;
|
|
22037
22079
|
writeFileSync29(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
22038
|
-
console.log(
|
|
22080
|
+
console.log(chalk151.green(`Added ${date} to skip list for ${repoName}`));
|
|
22039
22081
|
}
|
|
22040
22082
|
|
|
22041
22083
|
// src/commands/devlog/version.ts
|
|
22042
|
-
import
|
|
22084
|
+
import chalk152 from "chalk";
|
|
22043
22085
|
function version() {
|
|
22044
22086
|
const config = loadConfig();
|
|
22045
22087
|
const name = getRepoName();
|
|
22046
22088
|
const lastInfo = getLastVersionInfo(name, config);
|
|
22047
22089
|
const lastVersion = lastInfo?.version ?? null;
|
|
22048
22090
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
22049
|
-
console.log(`${
|
|
22050
|
-
console.log(`${
|
|
22051
|
-
console.log(`${
|
|
22091
|
+
console.log(`${chalk152.bold("name:")} ${name}`);
|
|
22092
|
+
console.log(`${chalk152.bold("last:")} ${lastVersion ?? chalk152.dim("none")}`);
|
|
22093
|
+
console.log(`${chalk152.bold("next:")} ${nextVersion ?? chalk152.dim("none")}`);
|
|
22052
22094
|
}
|
|
22053
22095
|
|
|
22054
22096
|
// src/commands/registerDevlog.ts
|
|
@@ -22072,8 +22114,8 @@ function registerDevlog(program2) {
|
|
|
22072
22114
|
|
|
22073
22115
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
22074
22116
|
import { closeSync as closeSync4, openSync as openSync5, readdirSync as readdirSync8 } from "fs";
|
|
22075
|
-
import { join as
|
|
22076
|
-
import
|
|
22117
|
+
import { join as join61 } from "path";
|
|
22118
|
+
import chalk153 from "chalk";
|
|
22077
22119
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
22078
22120
|
function isLockedDll(debugDir) {
|
|
22079
22121
|
let files;
|
|
@@ -22084,7 +22126,7 @@ function isLockedDll(debugDir) {
|
|
|
22084
22126
|
}
|
|
22085
22127
|
for (const file of files) {
|
|
22086
22128
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
22087
|
-
const dllPath =
|
|
22129
|
+
const dllPath = join61(debugDir, file);
|
|
22088
22130
|
try {
|
|
22089
22131
|
const fd = openSync5(dllPath, "r+");
|
|
22090
22132
|
closeSync4(fd);
|
|
@@ -22102,13 +22144,13 @@ function findFirstLockedDll(dir) {
|
|
|
22102
22144
|
return null;
|
|
22103
22145
|
}
|
|
22104
22146
|
if (entries.includes("bin")) {
|
|
22105
|
-
const locked = isLockedDll(
|
|
22147
|
+
const locked = isLockedDll(join61(dir, "bin", "Debug"));
|
|
22106
22148
|
if (locked) return locked;
|
|
22107
22149
|
}
|
|
22108
22150
|
for (const entry of entries) {
|
|
22109
22151
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
22110
22152
|
continue;
|
|
22111
|
-
const found = findFirstLockedDll(
|
|
22153
|
+
const found = findFirstLockedDll(join61(dir, entry));
|
|
22112
22154
|
if (found) return found;
|
|
22113
22155
|
}
|
|
22114
22156
|
return null;
|
|
@@ -22120,14 +22162,14 @@ function checkBuildLocks(startDir) {
|
|
|
22120
22162
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
22121
22163
|
if (locked) {
|
|
22122
22164
|
console.error(
|
|
22123
|
-
|
|
22165
|
+
chalk153.red("Build output locked (is VS debugging?): ") + locked
|
|
22124
22166
|
);
|
|
22125
22167
|
process.exit(1);
|
|
22126
22168
|
}
|
|
22127
22169
|
}
|
|
22128
22170
|
async function checkBuildLocksCommand() {
|
|
22129
22171
|
checkBuildLocks();
|
|
22130
|
-
console.log(
|
|
22172
|
+
console.log(chalk153.green("No build locks detected"));
|
|
22131
22173
|
}
|
|
22132
22174
|
|
|
22133
22175
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -22226,30 +22268,30 @@ function escapeRegex(s) {
|
|
|
22226
22268
|
}
|
|
22227
22269
|
|
|
22228
22270
|
// src/commands/dotnet/printTree.ts
|
|
22229
|
-
import
|
|
22271
|
+
import chalk154 from "chalk";
|
|
22230
22272
|
function printNodes(nodes, prefix2) {
|
|
22231
22273
|
for (let i = 0; i < nodes.length; i++) {
|
|
22232
22274
|
const isLast = i === nodes.length - 1;
|
|
22233
22275
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
22234
22276
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
22235
22277
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
22236
|
-
const label2 = isMissing ?
|
|
22278
|
+
const label2 = isMissing ? chalk154.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
22237
22279
|
console.log(`${prefix2}${connector}${label2}`);
|
|
22238
22280
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
22239
22281
|
}
|
|
22240
22282
|
}
|
|
22241
22283
|
function printTree(tree, totalCount, solutions) {
|
|
22242
|
-
console.log(
|
|
22243
|
-
console.log(
|
|
22284
|
+
console.log(chalk154.bold("\nProject Dependency Tree"));
|
|
22285
|
+
console.log(chalk154.cyan(tree.relativePath));
|
|
22244
22286
|
printNodes(tree.children, "");
|
|
22245
|
-
console.log(
|
|
22287
|
+
console.log(chalk154.dim(`
|
|
22246
22288
|
${totalCount} projects total (including root)`));
|
|
22247
|
-
console.log(
|
|
22289
|
+
console.log(chalk154.bold("\nSolution Membership"));
|
|
22248
22290
|
if (solutions.length === 0) {
|
|
22249
|
-
console.log(
|
|
22291
|
+
console.log(chalk154.yellow(" Not found in any .sln"));
|
|
22250
22292
|
} else {
|
|
22251
22293
|
for (const sln of solutions) {
|
|
22252
|
-
console.log(` ${
|
|
22294
|
+
console.log(` ${chalk154.green(sln)}`);
|
|
22253
22295
|
}
|
|
22254
22296
|
}
|
|
22255
22297
|
console.log();
|
|
@@ -22278,16 +22320,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
22278
22320
|
// src/commands/dotnet/resolveCsproj.ts
|
|
22279
22321
|
import { existsSync as existsSync52 } from "fs";
|
|
22280
22322
|
import path36 from "path";
|
|
22281
|
-
import
|
|
22323
|
+
import chalk155 from "chalk";
|
|
22282
22324
|
function resolveCsproj(csprojPath) {
|
|
22283
22325
|
const resolved = path36.resolve(csprojPath);
|
|
22284
22326
|
if (!existsSync52(resolved)) {
|
|
22285
|
-
console.error(
|
|
22327
|
+
console.error(chalk155.red(`File not found: ${resolved}`));
|
|
22286
22328
|
process.exit(1);
|
|
22287
22329
|
}
|
|
22288
22330
|
const repoRoot2 = findRepoRoot(path36.dirname(resolved));
|
|
22289
22331
|
if (!repoRoot2) {
|
|
22290
|
-
console.error(
|
|
22332
|
+
console.error(chalk155.red("Could not find git repository root"));
|
|
22291
22333
|
process.exit(1);
|
|
22292
22334
|
}
|
|
22293
22335
|
return { resolved, repoRoot: repoRoot2 };
|
|
@@ -22337,12 +22379,12 @@ function getChangedCsFiles(scope) {
|
|
|
22337
22379
|
}
|
|
22338
22380
|
|
|
22339
22381
|
// src/commands/dotnet/inSln.ts
|
|
22340
|
-
import
|
|
22382
|
+
import chalk156 from "chalk";
|
|
22341
22383
|
async function inSln(csprojPath) {
|
|
22342
22384
|
const { resolved, repoRoot: repoRoot2 } = resolveCsproj(csprojPath);
|
|
22343
22385
|
const solutions = findContainingSolutions(resolved, repoRoot2);
|
|
22344
22386
|
if (solutions.length === 0) {
|
|
22345
|
-
console.log(
|
|
22387
|
+
console.log(chalk156.yellow("Not found in any .sln file"));
|
|
22346
22388
|
process.exit(1);
|
|
22347
22389
|
}
|
|
22348
22390
|
for (const sln of solutions) {
|
|
@@ -22351,7 +22393,7 @@ async function inSln(csprojPath) {
|
|
|
22351
22393
|
}
|
|
22352
22394
|
|
|
22353
22395
|
// src/commands/dotnet/inspect.ts
|
|
22354
|
-
import
|
|
22396
|
+
import chalk162 from "chalk";
|
|
22355
22397
|
|
|
22356
22398
|
// src/shared/formatElapsed.ts
|
|
22357
22399
|
function formatElapsed(ms) {
|
|
@@ -22363,12 +22405,12 @@ function formatElapsed(ms) {
|
|
|
22363
22405
|
}
|
|
22364
22406
|
|
|
22365
22407
|
// src/commands/dotnet/displayIssues.ts
|
|
22366
|
-
import
|
|
22408
|
+
import chalk157 from "chalk";
|
|
22367
22409
|
var SEVERITY_COLOR = {
|
|
22368
|
-
ERROR:
|
|
22369
|
-
WARNING:
|
|
22370
|
-
SUGGESTION:
|
|
22371
|
-
HINT:
|
|
22410
|
+
ERROR: chalk157.red,
|
|
22411
|
+
WARNING: chalk157.yellow,
|
|
22412
|
+
SUGGESTION: chalk157.cyan,
|
|
22413
|
+
HINT: chalk157.dim
|
|
22372
22414
|
};
|
|
22373
22415
|
function groupByFile(issues) {
|
|
22374
22416
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -22384,15 +22426,15 @@ function groupByFile(issues) {
|
|
|
22384
22426
|
}
|
|
22385
22427
|
function displayIssues(issues) {
|
|
22386
22428
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
22387
|
-
console.log(
|
|
22429
|
+
console.log(chalk157.bold(file));
|
|
22388
22430
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
22389
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
22431
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk157.white;
|
|
22390
22432
|
console.log(
|
|
22391
|
-
` ${
|
|
22433
|
+
` ${chalk157.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
22392
22434
|
);
|
|
22393
22435
|
}
|
|
22394
22436
|
}
|
|
22395
|
-
console.log(
|
|
22437
|
+
console.log(chalk157.dim(`
|
|
22396
22438
|
${issues.length} issue(s) found`));
|
|
22397
22439
|
}
|
|
22398
22440
|
|
|
@@ -22451,15 +22493,15 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
22451
22493
|
// src/commands/dotnet/resolveSolution.ts
|
|
22452
22494
|
import { existsSync as existsSync53 } from "fs";
|
|
22453
22495
|
import path37 from "path";
|
|
22454
|
-
import
|
|
22496
|
+
import chalk159 from "chalk";
|
|
22455
22497
|
|
|
22456
22498
|
// src/commands/dotnet/findSolution.ts
|
|
22457
22499
|
import { readdirSync as readdirSync10 } from "fs";
|
|
22458
|
-
import { dirname as dirname27, join as
|
|
22459
|
-
import
|
|
22500
|
+
import { dirname as dirname27, join as join62 } from "path";
|
|
22501
|
+
import chalk158 from "chalk";
|
|
22460
22502
|
function findSlnInDir(dir) {
|
|
22461
22503
|
try {
|
|
22462
|
-
return readdirSync10(dir).filter((f) => f.endsWith(".sln")).map((f) =>
|
|
22504
|
+
return readdirSync10(dir).filter((f) => f.endsWith(".sln")).map((f) => join62(dir, f));
|
|
22463
22505
|
} catch {
|
|
22464
22506
|
return [];
|
|
22465
22507
|
}
|
|
@@ -22472,17 +22514,17 @@ function findSolution() {
|
|
|
22472
22514
|
const slnFiles = findSlnInDir(current);
|
|
22473
22515
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
22474
22516
|
if (slnFiles.length > 1) {
|
|
22475
|
-
console.error(
|
|
22517
|
+
console.error(chalk158.red(`Multiple .sln files found in ${current}:`));
|
|
22476
22518
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
22477
22519
|
console.error(
|
|
22478
|
-
|
|
22520
|
+
chalk158.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
22479
22521
|
);
|
|
22480
22522
|
process.exit(1);
|
|
22481
22523
|
}
|
|
22482
22524
|
if (current === ceiling) break;
|
|
22483
22525
|
current = dirname27(current);
|
|
22484
22526
|
}
|
|
22485
|
-
console.error(
|
|
22527
|
+
console.error(chalk158.red("No .sln file found between cwd and repo root"));
|
|
22486
22528
|
process.exit(1);
|
|
22487
22529
|
}
|
|
22488
22530
|
|
|
@@ -22491,7 +22533,7 @@ function resolveSolution(sln) {
|
|
|
22491
22533
|
if (sln) {
|
|
22492
22534
|
const resolved = path37.resolve(sln);
|
|
22493
22535
|
if (!existsSync53(resolved)) {
|
|
22494
|
-
console.error(
|
|
22536
|
+
console.error(chalk159.red(`Solution file not found: ${resolved}`));
|
|
22495
22537
|
process.exit(1);
|
|
22496
22538
|
}
|
|
22497
22539
|
return resolved;
|
|
@@ -22533,14 +22575,14 @@ import { execSync as execSync35 } from "child_process";
|
|
|
22533
22575
|
import { existsSync as existsSync54, readFileSync as readFileSync37, unlinkSync as unlinkSync10 } from "fs";
|
|
22534
22576
|
import { tmpdir as tmpdir4 } from "os";
|
|
22535
22577
|
import path38 from "path";
|
|
22536
|
-
import
|
|
22578
|
+
import chalk160 from "chalk";
|
|
22537
22579
|
function assertJbInstalled() {
|
|
22538
22580
|
try {
|
|
22539
22581
|
execSync35("jb inspectcode --version", { stdio: "pipe" });
|
|
22540
22582
|
} catch {
|
|
22541
|
-
console.error(
|
|
22583
|
+
console.error(chalk160.red("jb is not installed. Install with:"));
|
|
22542
22584
|
console.error(
|
|
22543
|
-
|
|
22585
|
+
chalk160.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
22544
22586
|
);
|
|
22545
22587
|
process.exit(1);
|
|
22546
22588
|
}
|
|
@@ -22558,11 +22600,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
22558
22600
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
22559
22601
|
process.stderr.write(error.stderr);
|
|
22560
22602
|
}
|
|
22561
|
-
console.error(
|
|
22603
|
+
console.error(chalk160.red("jb inspectcode failed"));
|
|
22562
22604
|
process.exit(1);
|
|
22563
22605
|
}
|
|
22564
22606
|
if (!existsSync54(reportPath)) {
|
|
22565
|
-
console.error(
|
|
22607
|
+
console.error(chalk160.red("Report file not generated"));
|
|
22566
22608
|
process.exit(1);
|
|
22567
22609
|
}
|
|
22568
22610
|
const xml = readFileSync37(reportPath, "utf8");
|
|
@@ -22572,7 +22614,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
22572
22614
|
|
|
22573
22615
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
22574
22616
|
import { execSync as execSync36 } from "child_process";
|
|
22575
|
-
import
|
|
22617
|
+
import chalk161 from "chalk";
|
|
22576
22618
|
function resolveMsbuildPath() {
|
|
22577
22619
|
const { run: run4 } = loadConfig();
|
|
22578
22620
|
const configs = resolveRunConfigs(run4, runConfigBaseDir());
|
|
@@ -22584,9 +22626,9 @@ function assertMsbuildInstalled() {
|
|
|
22584
22626
|
try {
|
|
22585
22627
|
execSync36(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
22586
22628
|
} catch {
|
|
22587
|
-
console.error(
|
|
22629
|
+
console.error(chalk161.red(`msbuild not found at: ${msbuild}`));
|
|
22588
22630
|
console.error(
|
|
22589
|
-
|
|
22631
|
+
chalk161.yellow(
|
|
22590
22632
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
22591
22633
|
)
|
|
22592
22634
|
);
|
|
@@ -22633,17 +22675,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
22633
22675
|
// src/commands/dotnet/inspect.ts
|
|
22634
22676
|
function logScope(changedFiles2) {
|
|
22635
22677
|
if (changedFiles2 === null) {
|
|
22636
|
-
console.log(
|
|
22678
|
+
console.log(chalk162.dim("Inspecting full solution..."));
|
|
22637
22679
|
} else {
|
|
22638
22680
|
console.log(
|
|
22639
|
-
|
|
22681
|
+
chalk162.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
22640
22682
|
);
|
|
22641
22683
|
}
|
|
22642
22684
|
}
|
|
22643
22685
|
function reportResults(issues, elapsed) {
|
|
22644
22686
|
if (issues.length > 0) displayIssues(issues);
|
|
22645
|
-
else console.log(
|
|
22646
|
-
console.log(
|
|
22687
|
+
else console.log(chalk162.green("No issues found"));
|
|
22688
|
+
console.log(chalk162.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
22647
22689
|
if (issues.length > 0) process.exit(1);
|
|
22648
22690
|
}
|
|
22649
22691
|
async function inspect(sln, options2) {
|
|
@@ -22654,7 +22696,7 @@ async function inspect(sln, options2) {
|
|
|
22654
22696
|
const scope = parseScope(options2.scope);
|
|
22655
22697
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
22656
22698
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
22657
|
-
console.log(
|
|
22699
|
+
console.log(chalk162.green("No changed .cs files found"));
|
|
22658
22700
|
return;
|
|
22659
22701
|
}
|
|
22660
22702
|
logScope(changedFiles2);
|
|
@@ -23454,7 +23496,7 @@ function aggregateCommitters(authorLists) {
|
|
|
23454
23496
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
23455
23497
|
import { unlinkSync as unlinkSync12, writeFileSync as writeFileSync30 } from "fs";
|
|
23456
23498
|
import { tmpdir as tmpdir5 } from "os";
|
|
23457
|
-
import { join as
|
|
23499
|
+
import { join as join63 } from "path";
|
|
23458
23500
|
function buildArgs2(queryFile, vars) {
|
|
23459
23501
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
23460
23502
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -23464,7 +23506,7 @@ function buildArgs2(queryFile, vars) {
|
|
|
23464
23506
|
return args;
|
|
23465
23507
|
}
|
|
23466
23508
|
function runGhGraphql(mutation, vars) {
|
|
23467
|
-
const queryFile =
|
|
23509
|
+
const queryFile = join63(tmpdir5(), `gh-query-${Date.now()}.graphql`);
|
|
23468
23510
|
writeFileSync30(queryFile, mutation);
|
|
23469
23511
|
try {
|
|
23470
23512
|
const result = spawnSync6("gh", buildArgs2(queryFile, vars), {
|
|
@@ -23529,25 +23571,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
23529
23571
|
}
|
|
23530
23572
|
|
|
23531
23573
|
// src/commands/github/printCountTable.ts
|
|
23532
|
-
import
|
|
23574
|
+
import chalk163 from "chalk";
|
|
23533
23575
|
function printCountTable(labelHeader, rows) {
|
|
23534
23576
|
const labelWidth = Math.max(
|
|
23535
23577
|
labelHeader.length,
|
|
23536
23578
|
...rows.map((row) => row.label.length)
|
|
23537
23579
|
);
|
|
23538
23580
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
23539
|
-
console.log(
|
|
23540
|
-
console.log(
|
|
23581
|
+
console.log(chalk163.dim(header));
|
|
23582
|
+
console.log(chalk163.dim("-".repeat(header.length)));
|
|
23541
23583
|
for (const row of rows) {
|
|
23542
23584
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
23543
23585
|
}
|
|
23544
23586
|
}
|
|
23545
23587
|
|
|
23546
23588
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
23547
|
-
import
|
|
23589
|
+
import chalk164 from "chalk";
|
|
23548
23590
|
function printRepoAuthorBreakdown(repos2) {
|
|
23549
23591
|
for (const repo of repos2) {
|
|
23550
|
-
console.log(
|
|
23592
|
+
console.log(chalk164.bold(repo.name));
|
|
23551
23593
|
const authorWidth = Math.max(
|
|
23552
23594
|
0,
|
|
23553
23595
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -23630,10 +23672,10 @@ function parseTopCount(value) {
|
|
|
23630
23672
|
}
|
|
23631
23673
|
|
|
23632
23674
|
// src/commands/github/issue/fixStructure/applyAndVerifySubtree.ts
|
|
23633
|
-
import
|
|
23675
|
+
import chalk166 from "chalk";
|
|
23634
23676
|
|
|
23635
23677
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
23636
|
-
import
|
|
23678
|
+
import chalk165 from "chalk";
|
|
23637
23679
|
|
|
23638
23680
|
// src/commands/github/issue/fixStructure/removeIssueLabels.ts
|
|
23639
23681
|
var MUTATION2 = `mutation($labelableId: ID!, $labelIds: [ID!]!) {
|
|
@@ -23670,7 +23712,7 @@ function writeLineNow(line) {
|
|
|
23670
23712
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
23671
23713
|
function applyFixStructurePlan(plan2) {
|
|
23672
23714
|
for (const entry of plan2.entries) {
|
|
23673
|
-
const where =
|
|
23715
|
+
const where = chalk165.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
23674
23716
|
const { typeChange, labelRemovals } = entry;
|
|
23675
23717
|
if (typeChange) {
|
|
23676
23718
|
writeLineNow(
|
|
@@ -23940,12 +23982,12 @@ function planSubtree(root2, context) {
|
|
|
23940
23982
|
function applyAndVerifySubtree(target, plan2, context) {
|
|
23941
23983
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) return;
|
|
23942
23984
|
applyFixStructurePlan(plan2);
|
|
23943
|
-
writeLineNow(
|
|
23985
|
+
writeLineNow(chalk166.dim("Re-walking the subtree to confirm"));
|
|
23944
23986
|
assertNoResidualDrift(
|
|
23945
23987
|
planSubtree(fetchRootIssue(target), context),
|
|
23946
23988
|
context.chain
|
|
23947
23989
|
);
|
|
23948
|
-
writeLineNow(
|
|
23990
|
+
writeLineNow(chalk166.green("Subtree normalised"));
|
|
23949
23991
|
}
|
|
23950
23992
|
|
|
23951
23993
|
// src/commands/github/issue/fixStructure/assertChainTypesExist.ts
|
|
@@ -23981,22 +24023,22 @@ function parseTypeChain(value) {
|
|
|
23981
24023
|
}
|
|
23982
24024
|
|
|
23983
24025
|
// src/commands/github/issue/fixStructure/printFixStructurePlan.ts
|
|
23984
|
-
import
|
|
24026
|
+
import chalk167 from "chalk";
|
|
23985
24027
|
function annotate(entry) {
|
|
23986
24028
|
const notes = [];
|
|
23987
24029
|
if (entry.level === null) {
|
|
23988
|
-
notes.push(
|
|
24030
|
+
notes.push(chalk167.red("deeper than the leaf level"));
|
|
23989
24031
|
} else if (entry.typeChange) {
|
|
23990
24032
|
notes.push(
|
|
23991
|
-
|
|
24033
|
+
chalk167.yellow(
|
|
23992
24034
|
`${entry.typeChange.from ?? "no type"} -> ${entry.typeChange.to}`
|
|
23993
24035
|
)
|
|
23994
24036
|
);
|
|
23995
24037
|
} else {
|
|
23996
|
-
notes.push(
|
|
24038
|
+
notes.push(chalk167.dim(entry.issue.typeName ?? "no type"));
|
|
23997
24039
|
}
|
|
23998
24040
|
for (const label2 of entry.labelRemovals) {
|
|
23999
|
-
notes.push(
|
|
24041
|
+
notes.push(chalk167.yellow(`-${label2.name}`));
|
|
24000
24042
|
}
|
|
24001
24043
|
return notes;
|
|
24002
24044
|
}
|
|
@@ -24004,22 +24046,22 @@ function formatCount(count8, noun) {
|
|
|
24004
24046
|
return `${count8} ${noun}${count8 === 1 ? "" : "s"}`;
|
|
24005
24047
|
}
|
|
24006
24048
|
function printFixStructurePlan(plan2, chain2, apply) {
|
|
24007
|
-
writeLineNow(
|
|
24049
|
+
writeLineNow(chalk167.dim(`chain: ${chain2.join(" > ")}`));
|
|
24008
24050
|
for (const entry of plan2.entries) {
|
|
24009
24051
|
const indent3 = " ".repeat(entry.issue.depth);
|
|
24010
|
-
const name =
|
|
24052
|
+
const name = chalk167.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
24011
24053
|
writeLineNow(
|
|
24012
24054
|
`${indent3}${name} ${entry.issue.title} [${annotate(entry).join(", ")}]`
|
|
24013
24055
|
);
|
|
24014
24056
|
}
|
|
24015
24057
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) {
|
|
24016
|
-
writeLineNow(
|
|
24058
|
+
writeLineNow(chalk167.green("Nothing to change"));
|
|
24017
24059
|
return;
|
|
24018
24060
|
}
|
|
24019
24061
|
writeLineNow(
|
|
24020
24062
|
`${formatCount(plan2.typeChangeCount, "type change")}, ${formatCount(plan2.labelRemovalCount, "label removal")} planned`
|
|
24021
24063
|
);
|
|
24022
|
-
if (!apply) writeLineNow(
|
|
24064
|
+
if (!apply) writeLineNow(chalk167.dim("Dry run \u2014 nothing written"));
|
|
24023
24065
|
}
|
|
24024
24066
|
|
|
24025
24067
|
// src/commands/github/issue/parseRepoSlug.ts
|
|
@@ -24809,14 +24851,14 @@ function fetchIssue2(number, repo) {
|
|
|
24809
24851
|
import { existsSync as existsSync56, readFileSync as readFileSync38 } from "fs";
|
|
24810
24852
|
|
|
24811
24853
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
24812
|
-
import { join as
|
|
24854
|
+
import { join as join64 } from "path";
|
|
24813
24855
|
function issueWorkingFile(slug2, number) {
|
|
24814
24856
|
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
24815
|
-
const dir =
|
|
24857
|
+
const dir = join64(getStoreDir(), "github-issues", owner, repo);
|
|
24816
24858
|
return {
|
|
24817
24859
|
dir,
|
|
24818
|
-
bodyPath:
|
|
24819
|
-
metaPath:
|
|
24860
|
+
bodyPath: join64(dir, `${number}.md`),
|
|
24861
|
+
metaPath: join64(dir, `${number}.json`)
|
|
24820
24862
|
};
|
|
24821
24863
|
}
|
|
24822
24864
|
|
|
@@ -25229,7 +25271,7 @@ function registerGithub(program2) {
|
|
|
25229
25271
|
}
|
|
25230
25272
|
|
|
25231
25273
|
// src/commands/jira/acceptanceCriteria.ts
|
|
25232
|
-
import
|
|
25274
|
+
import chalk168 from "chalk";
|
|
25233
25275
|
|
|
25234
25276
|
// src/commands/jira/adfToText.ts
|
|
25235
25277
|
function renderInline(node) {
|
|
@@ -25296,7 +25338,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
25296
25338
|
const parsed = fetchIssue(issueKey, field);
|
|
25297
25339
|
const acValue = parsed?.fields?.[field];
|
|
25298
25340
|
if (!acValue) {
|
|
25299
|
-
console.log(
|
|
25341
|
+
console.log(chalk168.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
25300
25342
|
return;
|
|
25301
25343
|
}
|
|
25302
25344
|
if (typeof acValue === "string") {
|
|
@@ -25362,14 +25404,14 @@ async function jiraAuth() {
|
|
|
25362
25404
|
}
|
|
25363
25405
|
|
|
25364
25406
|
// src/commands/jira/viewIssue.ts
|
|
25365
|
-
import
|
|
25407
|
+
import chalk169 from "chalk";
|
|
25366
25408
|
function viewIssue2(issueKey) {
|
|
25367
25409
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
25368
25410
|
const fields = parsed?.fields;
|
|
25369
25411
|
const summary = fields?.summary;
|
|
25370
25412
|
const description = fields?.description;
|
|
25371
25413
|
if (summary) {
|
|
25372
|
-
console.log(
|
|
25414
|
+
console.log(chalk169.bold(summary));
|
|
25373
25415
|
}
|
|
25374
25416
|
if (description) {
|
|
25375
25417
|
if (summary) console.log();
|
|
@@ -25383,7 +25425,7 @@ function viewIssue2(issueKey) {
|
|
|
25383
25425
|
}
|
|
25384
25426
|
if (!summary && !description) {
|
|
25385
25427
|
console.log(
|
|
25386
|
-
|
|
25428
|
+
chalk169.yellow(`No summary or description found on ${issueKey}.`)
|
|
25387
25429
|
);
|
|
25388
25430
|
}
|
|
25389
25431
|
}
|
|
@@ -25418,7 +25460,7 @@ import { randomUUID as randomUUID12 } from "crypto";
|
|
|
25418
25460
|
|
|
25419
25461
|
// src/commands/review/checkoutPr.ts
|
|
25420
25462
|
import { execFileSync as execFileSync15 } from "child_process";
|
|
25421
|
-
import
|
|
25463
|
+
import chalk170 from "chalk";
|
|
25422
25464
|
|
|
25423
25465
|
// src/commands/sessions/daemon/daemonLog.ts
|
|
25424
25466
|
var RING_CAPACITY = 1e3;
|
|
@@ -25459,14 +25501,14 @@ import { existsSync as existsSync57 } from "fs";
|
|
|
25459
25501
|
import { basename as basename18, dirname as dirname29 } from "path";
|
|
25460
25502
|
|
|
25461
25503
|
// src/commands/sessions/daemon/worktree/planAllocation.ts
|
|
25462
|
-
import { basename as basename17, join as
|
|
25504
|
+
import { basename as basename17, join as join65 } from "path";
|
|
25463
25505
|
function planAllocation(clone, boundTreeRoots2) {
|
|
25464
25506
|
return boundTreeRoots2.has(clone) ? "spill" : "primary";
|
|
25465
25507
|
}
|
|
25466
25508
|
function nextWorktreePath(clone, base, isTaken) {
|
|
25467
25509
|
const name = basename17(clone);
|
|
25468
25510
|
for (let n = 2; n < 1e3; n++) {
|
|
25469
|
-
const candidate =
|
|
25511
|
+
const candidate = join65(base, `${name}-${n}`);
|
|
25470
25512
|
if (!isTaken(candidate)) return candidate;
|
|
25471
25513
|
}
|
|
25472
25514
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -25820,19 +25862,19 @@ function persistedTreeRoots() {
|
|
|
25820
25862
|
|
|
25821
25863
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
25822
25864
|
import { copyFileSync, existsSync as existsSync60, mkdirSync as mkdirSync17 } from "fs";
|
|
25823
|
-
import { dirname as dirname30, join as
|
|
25865
|
+
import { dirname as dirname30, join as join67 } from "path";
|
|
25824
25866
|
|
|
25825
25867
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
25826
25868
|
import { resolve as resolve17 } from "path";
|
|
25827
25869
|
|
|
25828
25870
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
25829
25871
|
import { existsSync as existsSync59 } from "fs";
|
|
25830
|
-
import { join as
|
|
25872
|
+
import { join as join66 } from "path";
|
|
25831
25873
|
function detectInstallCommand(dir) {
|
|
25832
|
-
if (!existsSync59(
|
|
25833
|
-
if (existsSync59(
|
|
25834
|
-
if (existsSync59(
|
|
25835
|
-
if (existsSync59(
|
|
25874
|
+
if (!existsSync59(join66(dir, "package.json"))) return null;
|
|
25875
|
+
if (existsSync59(join66(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
25876
|
+
if (existsSync59(join66(dir, "yarn.lock"))) return "yarn install";
|
|
25877
|
+
if (existsSync59(join66(dir, "bun.lockb"))) return "bun install";
|
|
25836
25878
|
return "npm install";
|
|
25837
25879
|
}
|
|
25838
25880
|
|
|
@@ -25994,9 +26036,9 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
25994
26036
|
}
|
|
25995
26037
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
25996
26038
|
for (const rel of copy) {
|
|
25997
|
-
const src =
|
|
26039
|
+
const src = join67(clone, rel);
|
|
25998
26040
|
if (!existsSync60(src)) continue;
|
|
25999
|
-
const dest =
|
|
26041
|
+
const dest = join67(worktreePath, rel);
|
|
26000
26042
|
try {
|
|
26001
26043
|
mkdirSync17(dirname30(dest), { recursive: true });
|
|
26002
26044
|
copyFileSync(src, dest);
|
|
@@ -26104,7 +26146,7 @@ async function checkoutPr(number) {
|
|
|
26104
26146
|
try {
|
|
26105
26147
|
execFileSync15("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
26106
26148
|
} catch {
|
|
26107
|
-
console.error(
|
|
26149
|
+
console.error(chalk170.red(`gh pr checkout ${number} failed; aborting.`));
|
|
26108
26150
|
process.exit(1);
|
|
26109
26151
|
}
|
|
26110
26152
|
}
|
|
@@ -26239,18 +26281,18 @@ function registerList(program2) {
|
|
|
26239
26281
|
}
|
|
26240
26282
|
|
|
26241
26283
|
// src/commands/litellm/listModels.ts
|
|
26242
|
-
import
|
|
26284
|
+
import chalk172 from "chalk";
|
|
26243
26285
|
|
|
26244
26286
|
// src/commands/litellm/resolveLitellmConfig.ts
|
|
26245
|
-
import
|
|
26287
|
+
import chalk171 from "chalk";
|
|
26246
26288
|
function resolveLitellmConfig() {
|
|
26247
26289
|
const { config, missing } = readLitellmConfig();
|
|
26248
26290
|
if (!config) {
|
|
26249
|
-
console.error(
|
|
26291
|
+
console.error(chalk171.red("LiteLLM is not configured"));
|
|
26250
26292
|
for (const key of missing) {
|
|
26251
26293
|
const entry = litellmConfigHelp.find((help) => help.key === key);
|
|
26252
26294
|
console.error(
|
|
26253
|
-
|
|
26295
|
+
chalk171.red(` ${key} is not set. Set it with: ${entry?.setter}`)
|
|
26254
26296
|
);
|
|
26255
26297
|
}
|
|
26256
26298
|
process.exit(1);
|
|
@@ -26276,13 +26318,13 @@ async function listModels(options2) {
|
|
|
26276
26318
|
} catch (error) {
|
|
26277
26319
|
const reason4 = error instanceof Error ? error.message : String(error);
|
|
26278
26320
|
console.error(
|
|
26279
|
-
|
|
26321
|
+
chalk172.red(`Failed to reach LiteLLM at ${baseUrl}: ${reason4}`)
|
|
26280
26322
|
);
|
|
26281
26323
|
process.exit(1);
|
|
26282
26324
|
}
|
|
26283
26325
|
const body = await response.text();
|
|
26284
26326
|
if (!response.ok) {
|
|
26285
|
-
console.error(
|
|
26327
|
+
console.error(chalk172.red(`LiteLLM returned ${response.status}: ${body}`));
|
|
26286
26328
|
process.exit(1);
|
|
26287
26329
|
}
|
|
26288
26330
|
if (options2.json) {
|
|
@@ -26302,15 +26344,15 @@ function registerLitellm(program2) {
|
|
|
26302
26344
|
// src/commands/mermaidExport.ts
|
|
26303
26345
|
import { mkdirSync as mkdirSync18, readdirSync as readdirSync11 } from "fs";
|
|
26304
26346
|
import { resolve as resolve19 } from "path";
|
|
26305
|
-
import
|
|
26347
|
+
import chalk175 from "chalk";
|
|
26306
26348
|
|
|
26307
26349
|
// src/commands/mermaid/exportFile.ts
|
|
26308
26350
|
import { readFileSync as readFileSync39, writeFileSync as writeFileSync32 } from "fs";
|
|
26309
26351
|
import { basename as basename19, extname as extname3, resolve as resolve18 } from "path";
|
|
26310
|
-
import
|
|
26352
|
+
import chalk174 from "chalk";
|
|
26311
26353
|
|
|
26312
26354
|
// src/commands/mermaid/renderBlock.ts
|
|
26313
|
-
import
|
|
26355
|
+
import chalk173 from "chalk";
|
|
26314
26356
|
async function renderBlock(krokiUrl, source) {
|
|
26315
26357
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
26316
26358
|
method: "POST",
|
|
@@ -26319,7 +26361,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
26319
26361
|
});
|
|
26320
26362
|
if (!response.ok) {
|
|
26321
26363
|
console.error(
|
|
26322
|
-
|
|
26364
|
+
chalk173.red(
|
|
26323
26365
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
26324
26366
|
)
|
|
26325
26367
|
);
|
|
@@ -26337,19 +26379,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
26337
26379
|
if (onlyIndex !== void 0) {
|
|
26338
26380
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
26339
26381
|
console.error(
|
|
26340
|
-
|
|
26382
|
+
chalk174.red(
|
|
26341
26383
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
26342
26384
|
)
|
|
26343
26385
|
);
|
|
26344
26386
|
process.exit(1);
|
|
26345
26387
|
}
|
|
26346
26388
|
console.log(
|
|
26347
|
-
|
|
26389
|
+
chalk174.gray(
|
|
26348
26390
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
26349
26391
|
)
|
|
26350
26392
|
);
|
|
26351
26393
|
} else {
|
|
26352
|
-
console.log(
|
|
26394
|
+
console.log(chalk174.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
26353
26395
|
}
|
|
26354
26396
|
for (const [i, source] of blocks.entries()) {
|
|
26355
26397
|
const idx = i + 1;
|
|
@@ -26357,7 +26399,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
26357
26399
|
const outPath = resolve18(outDir, `${stem}-${idx}.svg`);
|
|
26358
26400
|
const svg = await renderBlock(krokiUrl, source);
|
|
26359
26401
|
writeFileSync32(outPath, svg, "utf8");
|
|
26360
|
-
console.log(
|
|
26402
|
+
console.log(chalk174.green(` \u2192 ${outPath}`));
|
|
26361
26403
|
}
|
|
26362
26404
|
}
|
|
26363
26405
|
function extractMermaidBlocks(markdown) {
|
|
@@ -26373,18 +26415,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
26373
26415
|
if (options2.index !== void 0) {
|
|
26374
26416
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
26375
26417
|
console.error(
|
|
26376
|
-
|
|
26418
|
+
chalk175.red(`--index must be a positive integer (got ${options2.index})`)
|
|
26377
26419
|
);
|
|
26378
26420
|
process.exit(1);
|
|
26379
26421
|
}
|
|
26380
26422
|
if (!file) {
|
|
26381
|
-
console.error(
|
|
26423
|
+
console.error(chalk175.red("--index requires a file argument"));
|
|
26382
26424
|
process.exit(1);
|
|
26383
26425
|
}
|
|
26384
26426
|
}
|
|
26385
26427
|
const files = file ? [file] : readdirSync11(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
26386
26428
|
if (files.length === 0) {
|
|
26387
|
-
console.log(
|
|
26429
|
+
console.log(chalk175.gray("No markdown files found in current directory."));
|
|
26388
26430
|
return;
|
|
26389
26431
|
}
|
|
26390
26432
|
for (const f of files) {
|
|
@@ -26530,7 +26572,7 @@ function extractToSave(details, cwd = process.cwd()) {
|
|
|
26530
26572
|
}
|
|
26531
26573
|
|
|
26532
26574
|
// src/commands/miro/keptTexts.ts
|
|
26533
|
-
import
|
|
26575
|
+
import chalk176 from "chalk";
|
|
26534
26576
|
|
|
26535
26577
|
// src/commands/miro/applyIgnore.ts
|
|
26536
26578
|
function applyIgnore(texts, ignore3) {
|
|
@@ -26569,7 +26611,7 @@ function warnUnmatched(file, unmatched) {
|
|
|
26569
26611
|
if (unmatched.length === 0) return;
|
|
26570
26612
|
const entries = unmatched.map((entry) => ` - ${entry}`).join("\n");
|
|
26571
26613
|
console.error(
|
|
26572
|
-
|
|
26614
|
+
chalk176.yellow(
|
|
26573
26615
|
`${unmatched.length} ${unmatched.length === 1 ? "entry" : "entries"} in ${file} matched no box text:
|
|
26574
26616
|
${entries}`
|
|
26575
26617
|
)
|
|
@@ -26772,7 +26814,7 @@ function readMiroItems(file) {
|
|
|
26772
26814
|
}
|
|
26773
26815
|
|
|
26774
26816
|
// src/commands/miro/resolveExtractOptions.ts
|
|
26775
|
-
import
|
|
26817
|
+
import chalk177 from "chalk";
|
|
26776
26818
|
|
|
26777
26819
|
// src/commands/miro/extractLayers.ts
|
|
26778
26820
|
function extractsIn(layer) {
|
|
@@ -26850,7 +26892,7 @@ function resolveExtractOptions(name, options2, paths) {
|
|
|
26850
26892
|
paths.cwd,
|
|
26851
26893
|
paths.globalConfigPath
|
|
26852
26894
|
);
|
|
26853
|
-
console.error(
|
|
26895
|
+
console.error(chalk177.dim(`Extract "${name}" from ${resolved.from}`));
|
|
26854
26896
|
return resolved.options;
|
|
26855
26897
|
}
|
|
26856
26898
|
|
|
@@ -26952,7 +26994,7 @@ function registerMiro(program2) {
|
|
|
26952
26994
|
import { mkdir as mkdir6 } from "fs/promises";
|
|
26953
26995
|
import { createServer as createServer2 } from "http";
|
|
26954
26996
|
import { dirname as dirname33 } from "path";
|
|
26955
|
-
import
|
|
26997
|
+
import chalk179 from "chalk";
|
|
26956
26998
|
|
|
26957
26999
|
// src/commands/netcap/corsHeaders.ts
|
|
26958
27000
|
var corsHeaders = {
|
|
@@ -27028,17 +27070,17 @@ function createNetcapHandler(options2) {
|
|
|
27028
27070
|
}
|
|
27029
27071
|
|
|
27030
27072
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
27031
|
-
import { cp as cp4, readFile as
|
|
27073
|
+
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
27032
27074
|
import { networkInterfaces } from "os";
|
|
27033
|
-
import { join as
|
|
27034
|
-
import
|
|
27075
|
+
import { join as join69 } from "path";
|
|
27076
|
+
import chalk178 from "chalk";
|
|
27035
27077
|
|
|
27036
27078
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
27037
|
-
import { dirname as dirname32, join as
|
|
27079
|
+
import { dirname as dirname32, join as join68 } from "path";
|
|
27038
27080
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
27039
27081
|
var moduleDir2 = dirname32(fileURLToPath7(import.meta.url));
|
|
27040
27082
|
function netcapExtensionDir() {
|
|
27041
|
-
return
|
|
27083
|
+
return join68(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
27042
27084
|
}
|
|
27043
27085
|
|
|
27044
27086
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -27053,8 +27095,8 @@ function lanIPv4() {
|
|
|
27053
27095
|
return void 0;
|
|
27054
27096
|
}
|
|
27055
27097
|
async function configureBackground(dir, host, port, filter) {
|
|
27056
|
-
const file =
|
|
27057
|
-
const source = await
|
|
27098
|
+
const file = join69(dir, "background.js");
|
|
27099
|
+
const source = await readFile7(file, "utf8");
|
|
27058
27100
|
await writeFile6(
|
|
27059
27101
|
file,
|
|
27060
27102
|
source.replace(
|
|
@@ -27075,7 +27117,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
27075
27117
|
const host = lanIPv4();
|
|
27076
27118
|
if (!host) {
|
|
27077
27119
|
console.log(
|
|
27078
|
-
|
|
27120
|
+
chalk178.yellow("could not determine the WSL IP for the extension")
|
|
27079
27121
|
);
|
|
27080
27122
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
27081
27123
|
return source;
|
|
@@ -27086,27 +27128,27 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
27086
27128
|
return WSL_WINDOWS_PATH3;
|
|
27087
27129
|
} catch {
|
|
27088
27130
|
console.log(
|
|
27089
|
-
|
|
27131
|
+
chalk178.yellow(`could not copy extension to ${WSL_WINDOWS_PATH3}`)
|
|
27090
27132
|
);
|
|
27091
27133
|
return source;
|
|
27092
27134
|
}
|
|
27093
27135
|
}
|
|
27094
27136
|
|
|
27095
27137
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
27096
|
-
import { isAbsolute as isAbsolute5, join as
|
|
27138
|
+
import { isAbsolute as isAbsolute5, join as join71, resolve as resolve21 } from "path";
|
|
27097
27139
|
|
|
27098
27140
|
// src/commands/netcap/defaultCapturePath.ts
|
|
27099
27141
|
import { homedir as homedir22 } from "os";
|
|
27100
|
-
import { join as
|
|
27142
|
+
import { join as join70 } from "path";
|
|
27101
27143
|
function defaultCapturePath() {
|
|
27102
|
-
return
|
|
27144
|
+
return join70(homedir22(), ".assist", "netcap", "capture.jsonl");
|
|
27103
27145
|
}
|
|
27104
27146
|
|
|
27105
27147
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
27106
27148
|
function resolveNetcapOutPath(out) {
|
|
27107
27149
|
if (!out) return defaultCapturePath();
|
|
27108
27150
|
const dir = isAbsolute5(out) ? out : resolve21(process.cwd(), out);
|
|
27109
|
-
return
|
|
27151
|
+
return join71(dir, "capture.jsonl");
|
|
27110
27152
|
}
|
|
27111
27153
|
|
|
27112
27154
|
// src/commands/netcap/netcap.ts
|
|
@@ -27119,30 +27161,30 @@ async function netcap(options2) {
|
|
|
27119
27161
|
let count8 = 0;
|
|
27120
27162
|
const handler = createNetcapHandler({
|
|
27121
27163
|
outPath,
|
|
27122
|
-
onPing: () => console.log(
|
|
27164
|
+
onPing: () => console.log(chalk179.dim("ping from extension")),
|
|
27123
27165
|
onCapture: (entry) => {
|
|
27124
27166
|
count8 += 1;
|
|
27125
27167
|
console.log(
|
|
27126
|
-
|
|
27127
|
-
|
|
27168
|
+
chalk179.green(`captured #${count8}`),
|
|
27169
|
+
chalk179.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
27128
27170
|
);
|
|
27129
27171
|
}
|
|
27130
27172
|
});
|
|
27131
27173
|
const server = createServer2(handler);
|
|
27132
27174
|
server.listen(port, () => {
|
|
27133
27175
|
console.log(
|
|
27134
|
-
|
|
27176
|
+
chalk179.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
27135
27177
|
);
|
|
27136
|
-
console.log(
|
|
27178
|
+
console.log(chalk179.dim(`appending captures to ${outPath}`));
|
|
27137
27179
|
if (filter)
|
|
27138
|
-
console.log(
|
|
27139
|
-
console.log(
|
|
27140
|
-
console.log(
|
|
27180
|
+
console.log(chalk179.dim(`forwarding only URLs matching "${filter}"`));
|
|
27181
|
+
console.log(chalk179.dim(`load the unpacked extension from ${extensionPath}`));
|
|
27182
|
+
console.log(chalk179.dim("press Ctrl-C to stop"));
|
|
27141
27183
|
});
|
|
27142
27184
|
process.on("SIGINT", () => {
|
|
27143
27185
|
server.close();
|
|
27144
27186
|
console.log(
|
|
27145
|
-
|
|
27187
|
+
chalk179.bold(
|
|
27146
27188
|
`
|
|
27147
27189
|
netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
27148
27190
|
)
|
|
@@ -27153,8 +27195,8 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
27153
27195
|
|
|
27154
27196
|
// src/commands/netcap/netcapExtract.ts
|
|
27155
27197
|
import { writeFileSync as writeFileSync34 } from "fs";
|
|
27156
|
-
import { join as
|
|
27157
|
-
import
|
|
27198
|
+
import { join as join72 } from "path";
|
|
27199
|
+
import chalk180 from "chalk";
|
|
27158
27200
|
|
|
27159
27201
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
27160
27202
|
import { readFileSync as readFileSync42 } from "fs";
|
|
@@ -27598,12 +27640,12 @@ function extractPostsFromCapture(captureFile) {
|
|
|
27598
27640
|
function netcapExtract(file) {
|
|
27599
27641
|
const captureFile = file ?? defaultCapturePath();
|
|
27600
27642
|
const posts = extractPostsFromCapture(captureFile);
|
|
27601
|
-
const outFile =
|
|
27643
|
+
const outFile = join72(captureFile, "..", "posts.json");
|
|
27602
27644
|
writeFileSync34(outFile, `${JSON.stringify(posts, null, 2)}
|
|
27603
27645
|
`);
|
|
27604
27646
|
console.log(
|
|
27605
|
-
|
|
27606
|
-
|
|
27647
|
+
chalk180.green(`extracted ${posts.length} posts`),
|
|
27648
|
+
chalk180.dim(`-> ${outFile}`)
|
|
27607
27649
|
);
|
|
27608
27650
|
}
|
|
27609
27651
|
|
|
@@ -27624,7 +27666,7 @@ function registerNetcap(program2) {
|
|
|
27624
27666
|
}
|
|
27625
27667
|
|
|
27626
27668
|
// src/commands/news/add.ts
|
|
27627
|
-
import
|
|
27669
|
+
import chalk181 from "chalk";
|
|
27628
27670
|
import enquirer8 from "enquirer";
|
|
27629
27671
|
async function add2(url) {
|
|
27630
27672
|
if (!url) {
|
|
@@ -27646,10 +27688,10 @@ async function add2(url) {
|
|
|
27646
27688
|
const { orm } = await getReady();
|
|
27647
27689
|
const added = await addFeed(orm, url);
|
|
27648
27690
|
if (!added) {
|
|
27649
|
-
console.log(
|
|
27691
|
+
console.log(chalk181.yellow("Feed already exists"));
|
|
27650
27692
|
return;
|
|
27651
27693
|
}
|
|
27652
|
-
console.log(
|
|
27694
|
+
console.log(chalk181.green(`Added feed: ${url}`));
|
|
27653
27695
|
}
|
|
27654
27696
|
|
|
27655
27697
|
// src/commands/registerNews.ts
|
|
@@ -27697,7 +27739,7 @@ function registerPiHook(program2) {
|
|
|
27697
27739
|
}
|
|
27698
27740
|
|
|
27699
27741
|
// src/commands/prompts/printPromptsTable.ts
|
|
27700
|
-
import
|
|
27742
|
+
import chalk182 from "chalk";
|
|
27701
27743
|
function truncate(str, max) {
|
|
27702
27744
|
if (str.length <= max) return str;
|
|
27703
27745
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -27715,14 +27757,14 @@ function printPromptsTable(rows) {
|
|
|
27715
27757
|
"Command".padEnd(commandWidth),
|
|
27716
27758
|
"Repos"
|
|
27717
27759
|
].join(" ");
|
|
27718
|
-
console.log(
|
|
27719
|
-
console.log(
|
|
27760
|
+
console.log(chalk182.dim(header));
|
|
27761
|
+
console.log(chalk182.dim("-".repeat(header.length)));
|
|
27720
27762
|
for (const row of rows) {
|
|
27721
27763
|
const count8 = String(row.count).padStart(countWidth);
|
|
27722
27764
|
const tool = row.tool.padEnd(toolWidth);
|
|
27723
27765
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
27724
27766
|
console.log(
|
|
27725
|
-
`${
|
|
27767
|
+
`${chalk182.yellow(count8)} ${tool} ${command} ${chalk182.dim(row.repos)}`
|
|
27726
27768
|
);
|
|
27727
27769
|
}
|
|
27728
27770
|
}
|
|
@@ -27757,13 +27799,13 @@ import { execSync as execSync39 } from "child_process";
|
|
|
27757
27799
|
import enquirer9 from "enquirer";
|
|
27758
27800
|
|
|
27759
27801
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
27760
|
-
import
|
|
27802
|
+
import chalk183 from "chalk";
|
|
27761
27803
|
var STATUS_MAP = {
|
|
27762
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
27763
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
27804
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk183.magenta("merged"), date: pr.mergedAt } : null,
|
|
27805
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk183.red("closed"), date: pr.closedAt } : null
|
|
27764
27806
|
};
|
|
27765
27807
|
function defaultStatus(pr) {
|
|
27766
|
-
return { label:
|
|
27808
|
+
return { label: chalk183.green("opened"), date: pr.createdAt };
|
|
27767
27809
|
}
|
|
27768
27810
|
function getStatus2(pr) {
|
|
27769
27811
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -27772,11 +27814,11 @@ function formatDate(dateStr) {
|
|
|
27772
27814
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
27773
27815
|
}
|
|
27774
27816
|
function formatPrHeader(pr, status2) {
|
|
27775
|
-
return `${
|
|
27817
|
+
return `${chalk183.cyan(`#${pr.number}`)} ${pr.title} ${chalk183.dim(`(${pr.author.login},`)} ${status2.label} ${chalk183.dim(`${formatDate(status2.date)})`)}`;
|
|
27776
27818
|
}
|
|
27777
27819
|
function logPrDetails(pr) {
|
|
27778
27820
|
console.log(
|
|
27779
|
-
|
|
27821
|
+
chalk183.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
27780
27822
|
);
|
|
27781
27823
|
console.log();
|
|
27782
27824
|
}
|
|
@@ -27961,7 +28003,7 @@ import { execSync as execSync41 } from "child_process";
|
|
|
27961
28003
|
import { execSync as execSync40 } from "child_process";
|
|
27962
28004
|
import { unlinkSync as unlinkSync14, writeFileSync as writeFileSync35 } from "fs";
|
|
27963
28005
|
import { tmpdir as tmpdir6 } from "os";
|
|
27964
|
-
import { join as
|
|
28006
|
+
import { join as join74 } from "path";
|
|
27965
28007
|
|
|
27966
28008
|
// src/commands/prs/loadCommentsCache.ts
|
|
27967
28009
|
import { existsSync as existsSync62, readFileSync as readFileSync43, unlinkSync as unlinkSync13 } from "fs";
|
|
@@ -27969,9 +28011,9 @@ import { parse as parse3 } from "yaml";
|
|
|
27969
28011
|
|
|
27970
28012
|
// src/commands/prs/commentsCachePath.ts
|
|
27971
28013
|
import { homedir as homedir23 } from "os";
|
|
27972
|
-
import { join as
|
|
28014
|
+
import { join as join73 } from "path";
|
|
27973
28015
|
function commentsCachePath(org, repo, prNumber) {
|
|
27974
|
-
return
|
|
28016
|
+
return join73(
|
|
27975
28017
|
homedir23(),
|
|
27976
28018
|
".assist",
|
|
27977
28019
|
"pr-comments",
|
|
@@ -28020,7 +28062,7 @@ function replyToComment(org, repo, prNumber, commentId, message3) {
|
|
|
28020
28062
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
28021
28063
|
function resolveThread(threadId) {
|
|
28022
28064
|
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
28023
|
-
const queryFile =
|
|
28065
|
+
const queryFile = join74(tmpdir6(), `gh-mutation-${Date.now()}.graphql`);
|
|
28024
28066
|
writeFileSync35(queryFile, mutation);
|
|
28025
28067
|
try {
|
|
28026
28068
|
execSync40(
|
|
@@ -28105,10 +28147,10 @@ function fixed(commentId, sha) {
|
|
|
28105
28147
|
import { execSync as execSync42 } from "child_process";
|
|
28106
28148
|
import { unlinkSync as unlinkSync15, writeFileSync as writeFileSync36 } from "fs";
|
|
28107
28149
|
import { tmpdir as tmpdir7 } from "os";
|
|
28108
|
-
import { join as
|
|
28150
|
+
import { join as join75 } from "path";
|
|
28109
28151
|
var THREAD_QUERY = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { id isResolved comments(first: 100) { nodes { databaseId } } } } } } }`;
|
|
28110
28152
|
function fetchThreadIds(org, repo, prNumber) {
|
|
28111
|
-
const queryFile =
|
|
28153
|
+
const queryFile = join75(tmpdir7(), `gh-query-${Date.now()}.graphql`);
|
|
28112
28154
|
writeFileSync36(queryFile, THREAD_QUERY);
|
|
28113
28155
|
try {
|
|
28114
28156
|
const result = execSync42(
|
|
@@ -28183,10 +28225,10 @@ import { stringify as stringify3 } from "yaml";
|
|
|
28183
28225
|
|
|
28184
28226
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
28185
28227
|
import { readdirSync as readdirSync12, unlinkSync as unlinkSync16 } from "fs";
|
|
28186
|
-
import { join as
|
|
28228
|
+
import { join as join76 } from "path";
|
|
28187
28229
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
28188
28230
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
28189
|
-
const dir =
|
|
28231
|
+
const dir = join76(cwd, ".assist");
|
|
28190
28232
|
let entries;
|
|
28191
28233
|
try {
|
|
28192
28234
|
entries = readdirSync12(dir);
|
|
@@ -28194,7 +28236,7 @@ function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
|
28194
28236
|
return;
|
|
28195
28237
|
}
|
|
28196
28238
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
28197
|
-
unlinkSync16(
|
|
28239
|
+
unlinkSync16(join76(dir, entry));
|
|
28198
28240
|
}
|
|
28199
28241
|
}
|
|
28200
28242
|
|
|
@@ -28266,13 +28308,13 @@ function agentFooter(unresolvedCount) {
|
|
|
28266
28308
|
}
|
|
28267
28309
|
|
|
28268
28310
|
// src/commands/prs/listComments/commentStyle.ts
|
|
28269
|
-
import
|
|
28311
|
+
import chalk184 from "chalk";
|
|
28270
28312
|
var plain = (text17) => text17;
|
|
28271
28313
|
function colouredState(state) {
|
|
28272
28314
|
const label2 = `[${state}]`;
|
|
28273
|
-
if (state === "APPROVED") return
|
|
28274
|
-
if (state === "CHANGES_REQUESTED") return
|
|
28275
|
-
return
|
|
28315
|
+
if (state === "APPROVED") return chalk184.green(label2);
|
|
28316
|
+
if (state === "CHANGES_REQUESTED") return chalk184.red(label2);
|
|
28317
|
+
return chalk184.yellow(label2);
|
|
28276
28318
|
}
|
|
28277
28319
|
function commentStyle() {
|
|
28278
28320
|
if (isClaudeCode()) {
|
|
@@ -28286,9 +28328,9 @@ function commentStyle() {
|
|
|
28286
28328
|
};
|
|
28287
28329
|
}
|
|
28288
28330
|
return {
|
|
28289
|
-
cyan:
|
|
28290
|
-
bold:
|
|
28291
|
-
dim:
|
|
28331
|
+
cyan: chalk184.cyan,
|
|
28332
|
+
bold: chalk184.bold,
|
|
28333
|
+
dim: chalk184.dim,
|
|
28292
28334
|
state: colouredState,
|
|
28293
28335
|
diffHunk: true,
|
|
28294
28336
|
agent: false
|
|
@@ -29500,16 +29542,16 @@ function buildPrsStatusReport(repoArguments, now = Date.now()) {
|
|
|
29500
29542
|
}
|
|
29501
29543
|
|
|
29502
29544
|
// src/commands/prs/status/printPrsStatus.ts
|
|
29503
|
-
import
|
|
29545
|
+
import chalk186 from "chalk";
|
|
29504
29546
|
|
|
29505
29547
|
// src/commands/prs/status/printPrStatus.ts
|
|
29506
|
-
import
|
|
29548
|
+
import chalk185 from "chalk";
|
|
29507
29549
|
function flags(pr) {
|
|
29508
29550
|
const markers = [];
|
|
29509
29551
|
if (pr.isDraft) markers.push("draft");
|
|
29510
29552
|
if (pr.isDoNotMerge) markers.push("do not merge");
|
|
29511
29553
|
if (pr.isBot) markers.push("bot");
|
|
29512
|
-
return markers.length ? ` ${
|
|
29554
|
+
return markers.length ? ` ${chalk185.yellow(`[${markers.join(", ")}]`)}` : "";
|
|
29513
29555
|
}
|
|
29514
29556
|
function updated(pr) {
|
|
29515
29557
|
return pr.ageHours === null ? "updated unknown" : `updated ${pr.age} ago`;
|
|
@@ -29523,35 +29565,35 @@ function reviewLine(pr) {
|
|
|
29523
29565
|
function checkLines(pr) {
|
|
29524
29566
|
const lines2 = [];
|
|
29525
29567
|
if (pr.checks.failing.length) {
|
|
29526
|
-
lines2.push(
|
|
29568
|
+
lines2.push(chalk185.red(`failing: ${pr.checks.failing.join(", ")}`));
|
|
29527
29569
|
}
|
|
29528
29570
|
if (pr.checks.pending.length) {
|
|
29529
|
-
lines2.push(
|
|
29571
|
+
lines2.push(chalk185.yellow(`pending: ${pr.checks.pending.join(", ")}`));
|
|
29530
29572
|
}
|
|
29531
29573
|
return lines2;
|
|
29532
29574
|
}
|
|
29533
29575
|
function threadsLine(pr) {
|
|
29534
29576
|
if (pr.unresolvedThreads === null) {
|
|
29535
|
-
return
|
|
29577
|
+
return chalk185.dim("unresolved comments: unknown");
|
|
29536
29578
|
}
|
|
29537
29579
|
if (pr.unresolvedThreads === 0) return null;
|
|
29538
|
-
return
|
|
29580
|
+
return chalk185.yellow(`unresolved comments: ${pr.unresolvedThreads}`);
|
|
29539
29581
|
}
|
|
29540
29582
|
function mergeableLine(pr) {
|
|
29541
|
-
if (pr.mergeable === "CONFLICTING") return
|
|
29583
|
+
if (pr.mergeable === "CONFLICTING") return chalk185.red("conflicting");
|
|
29542
29584
|
if (pr.mergeable === "MERGEABLE") return null;
|
|
29543
|
-
return
|
|
29585
|
+
return chalk185.dim(`mergeable: ${pr.mergeable.toLowerCase()}`);
|
|
29544
29586
|
}
|
|
29545
29587
|
function printPrStatus(pr) {
|
|
29546
29588
|
console.log(
|
|
29547
|
-
` ${
|
|
29589
|
+
` ${chalk185.cyan(`#${pr.number}`)} ${pr.title} ${chalk185.dim(`(${pr.author}, ${updated(pr)})`)}${flags(pr)}`
|
|
29548
29590
|
);
|
|
29549
29591
|
const details = [
|
|
29550
29592
|
reviewLine(pr),
|
|
29551
29593
|
...checkLines(pr),
|
|
29552
29594
|
threadsLine(pr),
|
|
29553
29595
|
mergeableLine(pr),
|
|
29554
|
-
|
|
29596
|
+
chalk185.dim(pr.url)
|
|
29555
29597
|
];
|
|
29556
29598
|
for (const detail of details) {
|
|
29557
29599
|
if (detail) console.log(` ${detail}`);
|
|
@@ -29562,17 +29604,17 @@ function printPrStatus(pr) {
|
|
|
29562
29604
|
function printPrsStatus(report) {
|
|
29563
29605
|
for (const repo of report.repos) {
|
|
29564
29606
|
const count8 = repo.pullRequests.length;
|
|
29565
|
-
console.log(`${
|
|
29607
|
+
console.log(`${chalk186.bold(repo.repo)} ${chalk186.dim(`(${count8} open)`)}`);
|
|
29566
29608
|
for (const pr of repo.pullRequests) {
|
|
29567
29609
|
printPrStatus(pr);
|
|
29568
29610
|
}
|
|
29569
|
-
if (count8 === 0) console.log(
|
|
29611
|
+
if (count8 === 0) console.log(chalk186.dim(" no open pull requests"));
|
|
29570
29612
|
console.log();
|
|
29571
29613
|
}
|
|
29572
29614
|
if (report.errors.length === 0) return;
|
|
29573
|
-
console.log(
|
|
29615
|
+
console.log(chalk186.bold("Errors"));
|
|
29574
29616
|
for (const failure of report.errors) {
|
|
29575
|
-
console.log(` ${
|
|
29617
|
+
console.log(` ${chalk186.red(failure.repo)}: ${failure.error}`);
|
|
29576
29618
|
}
|
|
29577
29619
|
console.log();
|
|
29578
29620
|
}
|
|
@@ -29791,10 +29833,10 @@ function registerPrs(program2) {
|
|
|
29791
29833
|
}
|
|
29792
29834
|
|
|
29793
29835
|
// src/commands/ravendb/ravendbAuth.ts
|
|
29794
|
-
import
|
|
29836
|
+
import chalk192 from "chalk";
|
|
29795
29837
|
|
|
29796
29838
|
// src/shared/createConnectionAuth.ts
|
|
29797
|
-
import
|
|
29839
|
+
import chalk187 from "chalk";
|
|
29798
29840
|
function listConnections(connections, format2) {
|
|
29799
29841
|
if (connections.length === 0) {
|
|
29800
29842
|
console.log("No connections configured.");
|
|
@@ -29807,7 +29849,7 @@ function listConnections(connections, format2) {
|
|
|
29807
29849
|
function removeConnection(connections, name, save) {
|
|
29808
29850
|
const filtered = connections.filter((c) => c.name !== name);
|
|
29809
29851
|
if (filtered.length === connections.length) {
|
|
29810
|
-
console.error(
|
|
29852
|
+
console.error(chalk187.red(`Connection "${name}" not found.`));
|
|
29811
29853
|
process.exit(1);
|
|
29812
29854
|
}
|
|
29813
29855
|
save(filtered);
|
|
@@ -29853,15 +29895,15 @@ function saveConnections(connections) {
|
|
|
29853
29895
|
}
|
|
29854
29896
|
|
|
29855
29897
|
// src/commands/ravendb/promptConnection.ts
|
|
29856
|
-
import
|
|
29898
|
+
import chalk190 from "chalk";
|
|
29857
29899
|
|
|
29858
29900
|
// src/commands/ravendb/selectOpSecret.ts
|
|
29859
|
-
import
|
|
29901
|
+
import chalk189 from "chalk";
|
|
29860
29902
|
import Enquirer2 from "enquirer";
|
|
29861
29903
|
|
|
29862
29904
|
// src/commands/ravendb/searchItems.ts
|
|
29863
29905
|
import { execSync as execSync49 } from "child_process";
|
|
29864
|
-
import
|
|
29906
|
+
import chalk188 from "chalk";
|
|
29865
29907
|
function opExec(args) {
|
|
29866
29908
|
return execSync49(`op ${args}`, {
|
|
29867
29909
|
encoding: "utf8",
|
|
@@ -29874,7 +29916,7 @@ function searchItems(search2) {
|
|
|
29874
29916
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
29875
29917
|
} catch {
|
|
29876
29918
|
console.error(
|
|
29877
|
-
|
|
29919
|
+
chalk188.red(
|
|
29878
29920
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
29879
29921
|
)
|
|
29880
29922
|
);
|
|
@@ -29888,7 +29930,7 @@ function getItemFields(itemId2) {
|
|
|
29888
29930
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
29889
29931
|
return item.fields.filter((f) => f.reference && f.label);
|
|
29890
29932
|
} catch {
|
|
29891
|
-
console.error(
|
|
29933
|
+
console.error(chalk188.red("Failed to get item details from 1Password."));
|
|
29892
29934
|
process.exit(1);
|
|
29893
29935
|
}
|
|
29894
29936
|
}
|
|
@@ -29907,7 +29949,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
29907
29949
|
}).run();
|
|
29908
29950
|
const items2 = searchItems(search2);
|
|
29909
29951
|
if (items2.length === 0) {
|
|
29910
|
-
console.error(
|
|
29952
|
+
console.error(chalk189.red(`No items found matching "${search2}".`));
|
|
29911
29953
|
process.exit(1);
|
|
29912
29954
|
}
|
|
29913
29955
|
const itemId2 = await selectOne(
|
|
@@ -29916,7 +29958,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
29916
29958
|
);
|
|
29917
29959
|
const fields = getItemFields(itemId2);
|
|
29918
29960
|
if (fields.length === 0) {
|
|
29919
|
-
console.error(
|
|
29961
|
+
console.error(chalk189.red("No fields with references found on this item."));
|
|
29920
29962
|
process.exit(1);
|
|
29921
29963
|
}
|
|
29922
29964
|
const ref = await selectOne(
|
|
@@ -29930,7 +29972,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
29930
29972
|
async function promptConnection(existingNames) {
|
|
29931
29973
|
const name = await promptInput("name", "Connection name:");
|
|
29932
29974
|
if (existingNames.includes(name)) {
|
|
29933
|
-
console.error(
|
|
29975
|
+
console.error(chalk190.red(`Connection "${name}" already exists.`));
|
|
29934
29976
|
process.exit(1);
|
|
29935
29977
|
}
|
|
29936
29978
|
const url = await promptInput(
|
|
@@ -29939,22 +29981,22 @@ async function promptConnection(existingNames) {
|
|
|
29939
29981
|
);
|
|
29940
29982
|
const database = await promptInput("database", "Database name:");
|
|
29941
29983
|
if (!name || !url || !database) {
|
|
29942
|
-
console.error(
|
|
29984
|
+
console.error(chalk190.red("All fields are required."));
|
|
29943
29985
|
process.exit(1);
|
|
29944
29986
|
}
|
|
29945
29987
|
const apiKeyRef = await selectOpSecret();
|
|
29946
|
-
console.log(
|
|
29988
|
+
console.log(chalk190.dim(`Using: ${apiKeyRef}`));
|
|
29947
29989
|
return { name, url, database, apiKeyRef };
|
|
29948
29990
|
}
|
|
29949
29991
|
|
|
29950
29992
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
29951
|
-
import
|
|
29993
|
+
import chalk191 from "chalk";
|
|
29952
29994
|
function ravendbSetConnection(name) {
|
|
29953
29995
|
const raw = loadGlobalConfigRaw();
|
|
29954
29996
|
const ravendb = raw.ravendb ?? {};
|
|
29955
29997
|
const connections = ravendb.connections ?? [];
|
|
29956
29998
|
if (!connections.some((c) => c.name === name)) {
|
|
29957
|
-
console.error(
|
|
29999
|
+
console.error(chalk191.red(`Connection "${name}" not found.`));
|
|
29958
30000
|
console.error(
|
|
29959
30001
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
29960
30002
|
);
|
|
@@ -29970,16 +30012,16 @@ function ravendbSetConnection(name) {
|
|
|
29970
30012
|
var ravendbAuth = createConnectionAuth({
|
|
29971
30013
|
load: loadConnections,
|
|
29972
30014
|
save: saveConnections,
|
|
29973
|
-
format: (c) => `${
|
|
30015
|
+
format: (c) => `${chalk192.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
29974
30016
|
promptNew: promptConnection,
|
|
29975
30017
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
29976
30018
|
});
|
|
29977
30019
|
|
|
29978
30020
|
// src/commands/ravendb/ravendbCollections.ts
|
|
29979
|
-
import
|
|
30021
|
+
import chalk196 from "chalk";
|
|
29980
30022
|
|
|
29981
30023
|
// src/commands/ravendb/ravenFetch.ts
|
|
29982
|
-
import
|
|
30024
|
+
import chalk194 from "chalk";
|
|
29983
30025
|
|
|
29984
30026
|
// src/commands/ravendb/getAccessToken.ts
|
|
29985
30027
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -30016,10 +30058,10 @@ ${errorText}`
|
|
|
30016
30058
|
|
|
30017
30059
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
30018
30060
|
import { execSync as execSync50 } from "child_process";
|
|
30019
|
-
import
|
|
30061
|
+
import chalk193 from "chalk";
|
|
30020
30062
|
function resolveOpSecret(reference2) {
|
|
30021
30063
|
if (!reference2.startsWith("op://")) {
|
|
30022
|
-
console.error(
|
|
30064
|
+
console.error(chalk193.red(`Invalid secret reference: must start with op://`));
|
|
30023
30065
|
process.exit(1);
|
|
30024
30066
|
}
|
|
30025
30067
|
try {
|
|
@@ -30029,7 +30071,7 @@ function resolveOpSecret(reference2) {
|
|
|
30029
30071
|
}).trim();
|
|
30030
30072
|
} catch {
|
|
30031
30073
|
console.error(
|
|
30032
|
-
|
|
30074
|
+
chalk193.red(
|
|
30033
30075
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
30034
30076
|
)
|
|
30035
30077
|
);
|
|
@@ -30056,7 +30098,7 @@ async function ravenFetch(connection, path106) {
|
|
|
30056
30098
|
if (!response.ok) {
|
|
30057
30099
|
const body = await response.text();
|
|
30058
30100
|
console.error(
|
|
30059
|
-
|
|
30101
|
+
chalk194.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
30060
30102
|
);
|
|
30061
30103
|
console.error(body.substring(0, 500));
|
|
30062
30104
|
process.exit(1);
|
|
@@ -30065,7 +30107,7 @@ async function ravenFetch(connection, path106) {
|
|
|
30065
30107
|
}
|
|
30066
30108
|
|
|
30067
30109
|
// src/commands/ravendb/resolveConnection.ts
|
|
30068
|
-
import
|
|
30110
|
+
import chalk195 from "chalk";
|
|
30069
30111
|
function loadRavendb() {
|
|
30070
30112
|
const raw = loadGlobalConfigRaw();
|
|
30071
30113
|
const ravendb = raw.ravendb;
|
|
@@ -30079,7 +30121,7 @@ function resolveConnection(name) {
|
|
|
30079
30121
|
const connectionName = name ?? defaultConnection;
|
|
30080
30122
|
if (!connectionName) {
|
|
30081
30123
|
console.error(
|
|
30082
|
-
|
|
30124
|
+
chalk195.red(
|
|
30083
30125
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
30084
30126
|
)
|
|
30085
30127
|
);
|
|
@@ -30087,7 +30129,7 @@ function resolveConnection(name) {
|
|
|
30087
30129
|
}
|
|
30088
30130
|
const connection = connections.find((c) => c.name === connectionName);
|
|
30089
30131
|
if (!connection) {
|
|
30090
|
-
console.error(
|
|
30132
|
+
console.error(chalk195.red(`Connection "${connectionName}" not found.`));
|
|
30091
30133
|
console.error(
|
|
30092
30134
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
30093
30135
|
);
|
|
@@ -30118,15 +30160,15 @@ async function ravendbCollections(connectionName) {
|
|
|
30118
30160
|
return;
|
|
30119
30161
|
}
|
|
30120
30162
|
for (const c of collections) {
|
|
30121
|
-
console.log(`${
|
|
30163
|
+
console.log(`${chalk196.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
30122
30164
|
}
|
|
30123
30165
|
}
|
|
30124
30166
|
|
|
30125
30167
|
// src/commands/ravendb/ravendbQuery.ts
|
|
30126
|
-
import
|
|
30168
|
+
import chalk198 from "chalk";
|
|
30127
30169
|
|
|
30128
30170
|
// src/commands/ravendb/fetchAllPages.ts
|
|
30129
|
-
import
|
|
30171
|
+
import chalk197 from "chalk";
|
|
30130
30172
|
|
|
30131
30173
|
// src/commands/ravendb/buildQueryPath.ts
|
|
30132
30174
|
function buildQueryPath(opts) {
|
|
@@ -30164,7 +30206,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
30164
30206
|
allResults.push(...results);
|
|
30165
30207
|
start2 += results.length;
|
|
30166
30208
|
process.stderr.write(
|
|
30167
|
-
`\r${
|
|
30209
|
+
`\r${chalk197.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
30168
30210
|
);
|
|
30169
30211
|
if (start2 >= totalResults) break;
|
|
30170
30212
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -30179,7 +30221,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
30179
30221
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
30180
30222
|
const resolved = resolveArgs(connectionName, collection);
|
|
30181
30223
|
if (!resolved.collection && !options2.query) {
|
|
30182
|
-
console.error(
|
|
30224
|
+
console.error(chalk198.red("Provide a collection name or --query filter."));
|
|
30183
30225
|
process.exit(1);
|
|
30184
30226
|
}
|
|
30185
30227
|
const { collection: col } = resolved;
|
|
@@ -30214,7 +30256,7 @@ function registerRavendb(program2) {
|
|
|
30214
30256
|
}
|
|
30215
30257
|
|
|
30216
30258
|
// src/commands/releases/releasesConfigure.ts
|
|
30217
|
-
import
|
|
30259
|
+
import chalk200 from "chalk";
|
|
30218
30260
|
|
|
30219
30261
|
// src/commands/releases/checkStreamGraph.ts
|
|
30220
30262
|
function nodeIds(stream) {
|
|
@@ -30276,26 +30318,26 @@ function readStreamsInput(source) {
|
|
|
30276
30318
|
}
|
|
30277
30319
|
|
|
30278
30320
|
// src/commands/releases/reportDerivedStreams.ts
|
|
30279
|
-
import
|
|
30321
|
+
import chalk199 from "chalk";
|
|
30280
30322
|
function printDerived(stream) {
|
|
30281
30323
|
const environments = stream.nodes.flatMap((n) => n.environment ?? []);
|
|
30282
30324
|
const steps = stream.nodes.filter((n) => !n.environment);
|
|
30283
30325
|
console.log(
|
|
30284
|
-
`${
|
|
30326
|
+
`${chalk199.bold(stream.name)} ${chalk199.dim(`${stream.repo} \xB7 ${stream.workflow}`)}`
|
|
30285
30327
|
);
|
|
30286
30328
|
console.log(
|
|
30287
|
-
` environments: ${environments.join(", ") ||
|
|
30329
|
+
` environments: ${environments.join(", ") || chalk199.dim("none")}`
|
|
30288
30330
|
);
|
|
30289
30331
|
if (steps.length > 0)
|
|
30290
30332
|
console.log(
|
|
30291
30333
|
` steps: ${steps.map((n) => `${n.id} [${n.kind ?? "step"}]`).join(", ")}`
|
|
30292
30334
|
);
|
|
30293
30335
|
const edges = stream.edges.map(([from, to]) => `${from} \u2192 ${to}`);
|
|
30294
|
-
console.log(` edges: ${edges.join(", ") ||
|
|
30336
|
+
console.log(` edges: ${edges.join(", ") || chalk199.dim("none")}`);
|
|
30295
30337
|
}
|
|
30296
30338
|
function reportDerivedStreams(streams, target) {
|
|
30297
30339
|
for (const stream of streams) printDerived(stream);
|
|
30298
|
-
console.log(
|
|
30340
|
+
console.log(chalk199.dim(`Written to ${target}`));
|
|
30299
30341
|
}
|
|
30300
30342
|
|
|
30301
30343
|
// src/commands/releases/withCurrentRepo.ts
|
|
@@ -30387,8 +30429,8 @@ function writeReleaseStreams(incoming, scope) {
|
|
|
30387
30429
|
|
|
30388
30430
|
// src/commands/releases/releasesConfigure.ts
|
|
30389
30431
|
function fail6(message3, details = []) {
|
|
30390
|
-
console.error(
|
|
30391
|
-
for (const detail of details) console.error(
|
|
30432
|
+
console.error(chalk200.red(message3));
|
|
30433
|
+
for (const detail of details) console.error(chalk200.red(` ${detail}`));
|
|
30392
30434
|
process.exitCode = 1;
|
|
30393
30435
|
}
|
|
30394
30436
|
function reportWritten(incoming, target) {
|
|
@@ -30420,23 +30462,23 @@ function releasesConfigure(options2 = {}) {
|
|
|
30420
30462
|
}
|
|
30421
30463
|
|
|
30422
30464
|
// src/commands/releases/releasesList.ts
|
|
30423
|
-
import
|
|
30465
|
+
import chalk201 from "chalk";
|
|
30424
30466
|
function describeNode(node) {
|
|
30425
30467
|
if (node.environment) return `${node.id} \u2192 ${node.environment}`;
|
|
30426
30468
|
return `${node.id} (${node.kind ?? "step"})`;
|
|
30427
30469
|
}
|
|
30428
30470
|
function printStream(stream) {
|
|
30429
|
-
console.log(`${
|
|
30430
|
-
console.log(
|
|
30471
|
+
console.log(`${chalk201.bold(stream.name)} ${chalk201.dim(stream.repo)}`);
|
|
30472
|
+
console.log(chalk201.dim(` workflow: ${stream.workflow}`));
|
|
30431
30473
|
for (const node of stream.nodes) console.log(` ${describeNode(node)}`);
|
|
30432
30474
|
for (const [from, to] of stream.edges)
|
|
30433
|
-
console.log(
|
|
30475
|
+
console.log(chalk201.dim(` ${from} \u2192 ${to}`));
|
|
30434
30476
|
}
|
|
30435
30477
|
function releasesList() {
|
|
30436
30478
|
const streams = loadConfig().releases?.streams ?? [];
|
|
30437
30479
|
if (streams.length === 0) {
|
|
30438
30480
|
console.log(
|
|
30439
|
-
|
|
30481
|
+
chalk201.dim("No release streams configured under releases.streams.")
|
|
30440
30482
|
);
|
|
30441
30483
|
return;
|
|
30442
30484
|
}
|
|
@@ -30481,7 +30523,7 @@ function coverage() {
|
|
|
30481
30523
|
|
|
30482
30524
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
30483
30525
|
import path44 from "path";
|
|
30484
|
-
import
|
|
30526
|
+
import chalk203 from "chalk";
|
|
30485
30527
|
|
|
30486
30528
|
// src/commands/lint/lint/checkFileNames.ts
|
|
30487
30529
|
import fs24 from "fs";
|
|
@@ -30561,7 +30603,7 @@ function checkFileNames() {
|
|
|
30561
30603
|
}
|
|
30562
30604
|
|
|
30563
30605
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
30564
|
-
import
|
|
30606
|
+
import chalk202 from "chalk";
|
|
30565
30607
|
|
|
30566
30608
|
// src/commands/lint/lint/applyMoves.ts
|
|
30567
30609
|
import fs25 from "fs";
|
|
@@ -30646,25 +30688,25 @@ function fixFileNameViolations(moves) {
|
|
|
30646
30688
|
const start2 = performance.now();
|
|
30647
30689
|
const project = createLintProject();
|
|
30648
30690
|
const cwd = process.cwd();
|
|
30649
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
30691
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk202.green(line)));
|
|
30650
30692
|
const ms = (performance.now() - start2).toFixed(0);
|
|
30651
|
-
console.log(
|
|
30693
|
+
console.log(chalk202.dim(` Done in ${ms}ms`));
|
|
30652
30694
|
}
|
|
30653
30695
|
|
|
30654
30696
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
30655
30697
|
function reportViolations(violations) {
|
|
30656
|
-
console.error(
|
|
30698
|
+
console.error(chalk203.red("\nFile name check failed:\n"));
|
|
30657
30699
|
console.error(
|
|
30658
|
-
|
|
30700
|
+
chalk203.red(
|
|
30659
30701
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
30660
30702
|
)
|
|
30661
30703
|
);
|
|
30662
30704
|
for (const violation of violations) {
|
|
30663
|
-
console.error(
|
|
30664
|
-
console.error(
|
|
30705
|
+
console.error(chalk203.red(` ${violation.filePath}`));
|
|
30706
|
+
console.error(chalk203.gray(` Rename to: ${violation.suggestedName}
|
|
30665
30707
|
`));
|
|
30666
30708
|
}
|
|
30667
|
-
console.error(
|
|
30709
|
+
console.error(chalk203.dim(" Run with -f to auto-fix.\n"));
|
|
30668
30710
|
}
|
|
30669
30711
|
function runFileNameCheck(fix = false) {
|
|
30670
30712
|
const violations = checkFileNames();
|
|
@@ -30693,17 +30735,17 @@ function runFileNameCheck(fix = false) {
|
|
|
30693
30735
|
import fs27 from "fs";
|
|
30694
30736
|
|
|
30695
30737
|
// src/commands/lint/shared.ts
|
|
30696
|
-
import
|
|
30738
|
+
import chalk204 from "chalk";
|
|
30697
30739
|
function reportViolations2(violations, checkName2, errorMessage2, successMessage) {
|
|
30698
30740
|
if (violations.length > 0) {
|
|
30699
|
-
console.error(
|
|
30741
|
+
console.error(chalk204.red(`
|
|
30700
30742
|
${checkName2} failed:
|
|
30701
30743
|
`));
|
|
30702
|
-
console.error(
|
|
30744
|
+
console.error(chalk204.red(` ${errorMessage2}
|
|
30703
30745
|
`));
|
|
30704
30746
|
for (const violation of violations) {
|
|
30705
|
-
console.error(
|
|
30706
|
-
console.error(
|
|
30747
|
+
console.error(chalk204.red(` ${violation.filePath}:${violation.line}`));
|
|
30748
|
+
console.error(chalk204.gray(` ${violation.content}
|
|
30707
30749
|
`));
|
|
30708
30750
|
}
|
|
30709
30751
|
return false;
|
|
@@ -30833,8 +30875,8 @@ async function notify() {
|
|
|
30833
30875
|
import { execSync as execSync52 } from "child_process";
|
|
30834
30876
|
import { existsSync as existsSync63, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync38 } from "fs";
|
|
30835
30877
|
import { tmpdir as tmpdir8 } from "os";
|
|
30836
|
-
import { join as
|
|
30837
|
-
import
|
|
30878
|
+
import { join as join77, resolve as resolve22 } from "path";
|
|
30879
|
+
import chalk205 from "chalk";
|
|
30838
30880
|
|
|
30839
30881
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
30840
30882
|
var captureWindowPs1 = `
|
|
@@ -30970,7 +31012,7 @@ function buildOutputPath(outputDir, processName) {
|
|
|
30970
31012
|
return resolve22(outputDir, `${processName}-${timestamp5}.png`);
|
|
30971
31013
|
}
|
|
30972
31014
|
function runPowerShellScript(processName, outputPath) {
|
|
30973
|
-
const scriptPath =
|
|
31015
|
+
const scriptPath = join77(tmpdir8(), `assist-screenshot-${Date.now()}.ps1`);
|
|
30974
31016
|
writeFileSync38(scriptPath, captureWindowPs1, "utf8");
|
|
30975
31017
|
try {
|
|
30976
31018
|
execSync52(
|
|
@@ -30985,19 +31027,19 @@ function screenshot(processName) {
|
|
|
30985
31027
|
const config = loadConfig();
|
|
30986
31028
|
const outputDir = resolve22(config.screenshot.outputDir);
|
|
30987
31029
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
30988
|
-
console.log(
|
|
31030
|
+
console.log(chalk205.gray(`Capturing window for process "${processName}" ...`));
|
|
30989
31031
|
try {
|
|
30990
31032
|
runPowerShellScript(processName, outputPath);
|
|
30991
|
-
console.log(
|
|
31033
|
+
console.log(chalk205.green(`Screenshot saved: ${outputPath}`));
|
|
30992
31034
|
} catch (error) {
|
|
30993
31035
|
const msg = error instanceof Error ? error.message : String(error);
|
|
30994
|
-
console.error(
|
|
31036
|
+
console.error(chalk205.red(`Failed to capture screenshot: ${msg}`));
|
|
30995
31037
|
process.exit(1);
|
|
30996
31038
|
}
|
|
30997
31039
|
}
|
|
30998
31040
|
|
|
30999
31041
|
// src/commands/statusLine.ts
|
|
31000
|
-
import
|
|
31042
|
+
import chalk207 from "chalk";
|
|
31001
31043
|
|
|
31002
31044
|
// src/shared/contextLevel.ts
|
|
31003
31045
|
var THRESHOLDS = {
|
|
@@ -31013,7 +31055,7 @@ function contextLevel(pct, harness) {
|
|
|
31013
31055
|
}
|
|
31014
31056
|
|
|
31015
31057
|
// src/commands/buildLimitsSegment.ts
|
|
31016
|
-
import
|
|
31058
|
+
import chalk206 from "chalk";
|
|
31017
31059
|
|
|
31018
31060
|
// src/shared/rateLimitLevel.ts
|
|
31019
31061
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -31051,9 +31093,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
31051
31093
|
|
|
31052
31094
|
// src/commands/buildLimitsSegment.ts
|
|
31053
31095
|
var LEVEL_COLOR = {
|
|
31054
|
-
ok:
|
|
31055
|
-
warn:
|
|
31056
|
-
over:
|
|
31096
|
+
ok: chalk206.green,
|
|
31097
|
+
warn: chalk206.yellow,
|
|
31098
|
+
over: chalk206.red
|
|
31057
31099
|
};
|
|
31058
31100
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
31059
31101
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -31085,9 +31127,9 @@ function buildLimitsSegment(rateLimits) {
|
|
|
31085
31127
|
|
|
31086
31128
|
// src/commands/readGitBranch.ts
|
|
31087
31129
|
import { readFileSync as readFileSync46, statSync as statSync10 } from "fs";
|
|
31088
|
-
import { isAbsolute as isAbsolute6, join as
|
|
31130
|
+
import { isAbsolute as isAbsolute6, join as join78, resolve as resolve23 } from "path";
|
|
31089
31131
|
function resolveGitDir(cwd) {
|
|
31090
|
-
const dotGit =
|
|
31132
|
+
const dotGit = join78(cwd, ".git");
|
|
31091
31133
|
let stat5;
|
|
31092
31134
|
try {
|
|
31093
31135
|
stat5 = statSync10(dotGit);
|
|
@@ -31117,7 +31159,7 @@ function readGitBranch(cwd) {
|
|
|
31117
31159
|
}
|
|
31118
31160
|
let head;
|
|
31119
31161
|
try {
|
|
31120
|
-
head = readFileSync46(
|
|
31162
|
+
head = readFileSync46(join78(gitDir, "HEAD"), "utf8");
|
|
31121
31163
|
} catch {
|
|
31122
31164
|
return null;
|
|
31123
31165
|
}
|
|
@@ -31149,7 +31191,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
31149
31191
|
}
|
|
31150
31192
|
|
|
31151
31193
|
// src/commands/statusLine.ts
|
|
31152
|
-
|
|
31194
|
+
chalk207.level = 3;
|
|
31153
31195
|
function formatNumber(num) {
|
|
31154
31196
|
return num.toLocaleString("en-US");
|
|
31155
31197
|
}
|
|
@@ -31157,9 +31199,9 @@ function colorizePercent(pct) {
|
|
|
31157
31199
|
const label2 = `${Math.round(pct)}%`;
|
|
31158
31200
|
switch (contextLevel(pct)) {
|
|
31159
31201
|
case "red":
|
|
31160
|
-
return
|
|
31202
|
+
return chalk207.red(label2);
|
|
31161
31203
|
case "yellow":
|
|
31162
|
-
return
|
|
31204
|
+
return chalk207.yellow(label2);
|
|
31163
31205
|
default:
|
|
31164
31206
|
return label2;
|
|
31165
31207
|
}
|
|
@@ -31172,7 +31214,7 @@ async function statusLine() {
|
|
|
31172
31214
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
31173
31215
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
31174
31216
|
const branch2 = dir ? readGitBranch(dir) : null;
|
|
31175
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
31217
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk207.cyan(branch2)} | ` : "";
|
|
31176
31218
|
console.log(
|
|
31177
31219
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
31178
31220
|
);
|
|
@@ -31275,7 +31317,7 @@ import { spawn as spawn7 } from "child_process";
|
|
|
31275
31317
|
import * as path46 from "path";
|
|
31276
31318
|
|
|
31277
31319
|
// src/commands/refactor/logViolations.ts
|
|
31278
|
-
import
|
|
31320
|
+
import chalk208 from "chalk";
|
|
31279
31321
|
var DEFAULT_MAX_LINES2 = 100;
|
|
31280
31322
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
31281
31323
|
if (violations.length === 0) {
|
|
@@ -31284,43 +31326,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
31284
31326
|
}
|
|
31285
31327
|
return;
|
|
31286
31328
|
}
|
|
31287
|
-
console.error(
|
|
31329
|
+
console.error(chalk208.red(`
|
|
31288
31330
|
Refactor check failed:
|
|
31289
31331
|
`));
|
|
31290
|
-
console.error(
|
|
31332
|
+
console.error(chalk208.red(` The following files exceed ${maxLines} lines:
|
|
31291
31333
|
`));
|
|
31292
31334
|
for (const violation of violations) {
|
|
31293
|
-
console.error(
|
|
31335
|
+
console.error(chalk208.red(` ${violation.file} (${violation.lines} lines)`));
|
|
31294
31336
|
}
|
|
31295
31337
|
console.error(
|
|
31296
|
-
|
|
31338
|
+
chalk208.yellow(
|
|
31297
31339
|
`
|
|
31298
31340
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
31299
31341
|
way to refactor it, ignore it with:
|
|
31300
31342
|
`
|
|
31301
31343
|
)
|
|
31302
31344
|
);
|
|
31303
|
-
console.error(
|
|
31345
|
+
console.error(chalk208.gray(` assist refactor ignore <file>
|
|
31304
31346
|
`));
|
|
31305
31347
|
if (process.env.CLAUDECODE) {
|
|
31306
|
-
console.error(
|
|
31348
|
+
console.error(chalk208.cyan(`
|
|
31307
31349
|
## Extracting Code to New Files
|
|
31308
31350
|
`));
|
|
31309
31351
|
console.error(
|
|
31310
|
-
|
|
31352
|
+
chalk208.cyan(
|
|
31311
31353
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
31312
31354
|
`
|
|
31313
31355
|
)
|
|
31314
31356
|
);
|
|
31315
31357
|
console.error(
|
|
31316
|
-
|
|
31358
|
+
chalk208.cyan(
|
|
31317
31359
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
31318
31360
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
31319
31361
|
`
|
|
31320
31362
|
)
|
|
31321
31363
|
);
|
|
31322
31364
|
console.error(
|
|
31323
|
-
|
|
31365
|
+
chalk208.cyan(
|
|
31324
31366
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
31325
31367
|
domains, move it to a common/shared folder.
|
|
31326
31368
|
`
|
|
@@ -31476,7 +31518,7 @@ async function check(pattern2, options2) {
|
|
|
31476
31518
|
|
|
31477
31519
|
// src/commands/refactor/extract.ts
|
|
31478
31520
|
import path54 from "path";
|
|
31479
|
-
import
|
|
31521
|
+
import chalk211 from "chalk";
|
|
31480
31522
|
|
|
31481
31523
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
31482
31524
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -32084,23 +32126,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
32084
32126
|
|
|
32085
32127
|
// src/commands/refactor/extract/displayPlan.ts
|
|
32086
32128
|
import path50 from "path";
|
|
32087
|
-
import
|
|
32129
|
+
import chalk209 from "chalk";
|
|
32088
32130
|
function section(title) {
|
|
32089
32131
|
return `
|
|
32090
|
-
${
|
|
32132
|
+
${chalk209.cyan(title)}`;
|
|
32091
32133
|
}
|
|
32092
32134
|
function displayImporters(plan2, cwd) {
|
|
32093
32135
|
if (plan2.importersToUpdate.length === 0) return;
|
|
32094
32136
|
console.log(section("Update importers:"));
|
|
32095
32137
|
for (const imp of plan2.importersToUpdate) {
|
|
32096
32138
|
const rel = path50.relative(cwd, imp.file.getFilePath());
|
|
32097
|
-
console.log(` ${
|
|
32139
|
+
console.log(` ${chalk209.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
32098
32140
|
}
|
|
32099
32141
|
}
|
|
32100
32142
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
32101
|
-
console.log(
|
|
32143
|
+
console.log(chalk209.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
32102
32144
|
`));
|
|
32103
|
-
console.log(` ${
|
|
32145
|
+
console.log(` ${chalk209.cyan("Functions to move:")}`);
|
|
32104
32146
|
for (const name of plan2.extractedNames) {
|
|
32105
32147
|
console.log(` ${name}`);
|
|
32106
32148
|
}
|
|
@@ -32134,7 +32176,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
32134
32176
|
|
|
32135
32177
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
32136
32178
|
import path53 from "path";
|
|
32137
|
-
import
|
|
32179
|
+
import chalk210 from "chalk";
|
|
32138
32180
|
import { Project as Project3 } from "ts-morph";
|
|
32139
32181
|
|
|
32140
32182
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -32226,7 +32268,7 @@ function loadProjectFile(file) {
|
|
|
32226
32268
|
});
|
|
32227
32269
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
32228
32270
|
if (!sourceFile) {
|
|
32229
|
-
console.log(
|
|
32271
|
+
console.log(chalk210.red(`File not found in project: ${file}`));
|
|
32230
32272
|
process.exit(1);
|
|
32231
32273
|
}
|
|
32232
32274
|
return { project, sourceFile };
|
|
@@ -32249,19 +32291,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
32249
32291
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
32250
32292
|
if (options2.apply) {
|
|
32251
32293
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
32252
|
-
console.log(
|
|
32294
|
+
console.log(chalk211.green("\nExtraction complete"));
|
|
32253
32295
|
} else {
|
|
32254
|
-
console.log(
|
|
32296
|
+
console.log(chalk211.dim("\nDry run. Use --apply to execute."));
|
|
32255
32297
|
}
|
|
32256
32298
|
}
|
|
32257
32299
|
|
|
32258
32300
|
// src/commands/refactor/ignore.ts
|
|
32259
32301
|
import fs33 from "fs";
|
|
32260
|
-
import
|
|
32302
|
+
import chalk212 from "chalk";
|
|
32261
32303
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
32262
32304
|
function ignore2(file) {
|
|
32263
32305
|
if (!fs33.existsSync(file)) {
|
|
32264
|
-
console.error(
|
|
32306
|
+
console.error(chalk212.red(`Error: File does not exist: ${file}`));
|
|
32265
32307
|
process.exit(1);
|
|
32266
32308
|
}
|
|
32267
32309
|
const content = fs33.readFileSync(file, "utf8");
|
|
@@ -32277,7 +32319,7 @@ function ignore2(file) {
|
|
|
32277
32319
|
fs33.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
32278
32320
|
}
|
|
32279
32321
|
console.log(
|
|
32280
|
-
|
|
32322
|
+
chalk212.green(
|
|
32281
32323
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
32282
32324
|
)
|
|
32283
32325
|
);
|
|
@@ -32286,12 +32328,12 @@ function ignore2(file) {
|
|
|
32286
32328
|
// src/commands/refactor/rename.ts
|
|
32287
32329
|
import fs36 from "fs";
|
|
32288
32330
|
import path60 from "path";
|
|
32289
|
-
import
|
|
32331
|
+
import chalk215 from "chalk";
|
|
32290
32332
|
|
|
32291
32333
|
// src/commands/refactor/rename/applyRename.ts
|
|
32292
32334
|
import fs35 from "fs";
|
|
32293
32335
|
import path56 from "path";
|
|
32294
|
-
import
|
|
32336
|
+
import chalk213 from "chalk";
|
|
32295
32337
|
|
|
32296
32338
|
// src/commands/refactor/restructure/computeRewrites.ts
|
|
32297
32339
|
import path55 from "path";
|
|
@@ -32397,13 +32439,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
32397
32439
|
const updatedContents = applyRewrites(rewrites);
|
|
32398
32440
|
for (const [file, content] of updatedContents) {
|
|
32399
32441
|
fs35.writeFileSync(file, content, "utf8");
|
|
32400
|
-
console.log(
|
|
32442
|
+
console.log(chalk213.cyan(` Updated imports in ${path56.relative(cwd, file)}`));
|
|
32401
32443
|
}
|
|
32402
32444
|
const destDir = path56.dirname(destPath);
|
|
32403
32445
|
if (!fs35.existsSync(destDir)) fs35.mkdirSync(destDir, { recursive: true });
|
|
32404
32446
|
fs35.renameSync(sourcePath, destPath);
|
|
32405
32447
|
console.log(
|
|
32406
|
-
|
|
32448
|
+
chalk213.white(
|
|
32407
32449
|
` Moved ${path56.relative(cwd, sourcePath)} \u2192 ${path56.relative(cwd, destPath)}`
|
|
32408
32450
|
)
|
|
32409
32451
|
);
|
|
@@ -32553,16 +32595,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
32553
32595
|
|
|
32554
32596
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
32555
32597
|
import path59 from "path";
|
|
32556
|
-
import
|
|
32598
|
+
import chalk214 from "chalk";
|
|
32557
32599
|
function printRenamePreview(rewrites, cwd) {
|
|
32558
32600
|
for (const rewrite of rewrites) {
|
|
32559
32601
|
console.log(
|
|
32560
|
-
|
|
32602
|
+
chalk214.dim(
|
|
32561
32603
|
` ${path59.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
32562
32604
|
)
|
|
32563
32605
|
);
|
|
32564
32606
|
}
|
|
32565
|
-
console.log(
|
|
32607
|
+
console.log(chalk214.dim("Dry run. Use --apply to execute."));
|
|
32566
32608
|
}
|
|
32567
32609
|
|
|
32568
32610
|
// src/commands/refactor/rename.ts
|
|
@@ -32573,20 +32615,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
32573
32615
|
const relSource = path60.relative(cwd, sourcePath);
|
|
32574
32616
|
const relDest = path60.relative(cwd, destPath);
|
|
32575
32617
|
if (!fs36.existsSync(sourcePath)) {
|
|
32576
|
-
console.log(
|
|
32618
|
+
console.log(chalk215.red(`File not found: ${source}`));
|
|
32577
32619
|
process.exit(1);
|
|
32578
32620
|
}
|
|
32579
32621
|
if (destPath !== sourcePath && fs36.existsSync(destPath)) {
|
|
32580
|
-
console.log(
|
|
32622
|
+
console.log(chalk215.red(`Destination already exists: ${destination}`));
|
|
32581
32623
|
process.exit(1);
|
|
32582
32624
|
}
|
|
32583
|
-
console.log(
|
|
32584
|
-
console.log(
|
|
32585
|
-
console.log(
|
|
32625
|
+
console.log(chalk215.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
32626
|
+
console.log(chalk215.dim("Loading project..."));
|
|
32627
|
+
console.log(chalk215.dim("Scanning imports across the project..."));
|
|
32586
32628
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
32587
32629
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
32588
32630
|
console.log(
|
|
32589
|
-
|
|
32631
|
+
chalk215.dim(
|
|
32590
32632
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
32591
32633
|
)
|
|
32592
32634
|
);
|
|
@@ -32595,11 +32637,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
32595
32637
|
return;
|
|
32596
32638
|
}
|
|
32597
32639
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
32598
|
-
console.log(
|
|
32640
|
+
console.log(chalk215.green("Done"));
|
|
32599
32641
|
}
|
|
32600
32642
|
|
|
32601
32643
|
// src/commands/refactor/renameSymbol.ts
|
|
32602
|
-
import
|
|
32644
|
+
import chalk216 from "chalk";
|
|
32603
32645
|
|
|
32604
32646
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
32605
32647
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -32645,34 +32687,34 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
32645
32687
|
const { project, sourceFile } = loadProjectFile(file);
|
|
32646
32688
|
const symbol = findSymbol(sourceFile, oldName);
|
|
32647
32689
|
if (!symbol) {
|
|
32648
|
-
console.log(
|
|
32690
|
+
console.log(chalk216.red(`Symbol "${oldName}" not found in ${file}`));
|
|
32649
32691
|
process.exit(1);
|
|
32650
32692
|
}
|
|
32651
32693
|
const grouped = groupReferences(symbol, cwd);
|
|
32652
32694
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
32653
32695
|
console.log(
|
|
32654
|
-
|
|
32696
|
+
chalk216.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
32655
32697
|
`)
|
|
32656
32698
|
);
|
|
32657
32699
|
for (const [refFile, lines2] of grouped) {
|
|
32658
32700
|
console.log(
|
|
32659
|
-
` ${
|
|
32701
|
+
` ${chalk216.dim(refFile)}: lines ${chalk216.cyan(lines2.join(", "))}`
|
|
32660
32702
|
);
|
|
32661
32703
|
}
|
|
32662
32704
|
if (options2.apply) {
|
|
32663
32705
|
symbol.rename(newName);
|
|
32664
32706
|
await project.save();
|
|
32665
|
-
console.log(
|
|
32707
|
+
console.log(chalk216.green(`
|
|
32666
32708
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
32667
32709
|
} else {
|
|
32668
|
-
console.log(
|
|
32710
|
+
console.log(chalk216.dim("\nDry run. Use --apply to execute."));
|
|
32669
32711
|
}
|
|
32670
32712
|
}
|
|
32671
32713
|
|
|
32672
32714
|
// src/commands/refactor/restructure.ts
|
|
32673
32715
|
import fs38 from "fs";
|
|
32674
32716
|
import path80 from "path";
|
|
32675
|
-
import
|
|
32717
|
+
import chalk225 from "chalk";
|
|
32676
32718
|
|
|
32677
32719
|
// src/commands/refactor/restructure/buildPlan.ts
|
|
32678
32720
|
import path71 from "path";
|
|
@@ -33009,7 +33051,7 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
|
|
|
33009
33051
|
}
|
|
33010
33052
|
|
|
33011
33053
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
33012
|
-
import
|
|
33054
|
+
import chalk220 from "chalk";
|
|
33013
33055
|
|
|
33014
33056
|
// src/commands/refactor/restructure/applyCommand.ts
|
|
33015
33057
|
import path72 from "path";
|
|
@@ -33020,13 +33062,13 @@ function applyCommand(scopeRoot) {
|
|
|
33020
33062
|
|
|
33021
33063
|
// src/commands/refactor/restructure/displayDrift.ts
|
|
33022
33064
|
import path73 from "path";
|
|
33023
|
-
import
|
|
33065
|
+
import chalk217 from "chalk";
|
|
33024
33066
|
var shownMoves = 20;
|
|
33025
33067
|
function displayDrift(plan2, listMoves) {
|
|
33026
33068
|
const rel = (file) => path73.relative(process.cwd(), file);
|
|
33027
33069
|
if (plan2.moves.length > 0) {
|
|
33028
33070
|
console.log(
|
|
33029
|
-
|
|
33071
|
+
chalk217.red(
|
|
33030
33072
|
`${plan2.moves.length} file(s) drift from the plan${listMoves ? ":" : "."}`
|
|
33031
33073
|
)
|
|
33032
33074
|
);
|
|
@@ -33034,17 +33076,17 @@ function displayDrift(plan2, listMoves) {
|
|
|
33034
33076
|
for (const move2 of plan2.moves.slice(0, shownMoves))
|
|
33035
33077
|
console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
|
|
33036
33078
|
if (plan2.moves.length > shownMoves)
|
|
33037
|
-
console.log(
|
|
33079
|
+
console.log(chalk217.dim(` \u2026and ${plan2.moves.length - shownMoves} more`));
|
|
33038
33080
|
}
|
|
33039
33081
|
}
|
|
33040
|
-
for (const error of plan2.errors) console.log(
|
|
33082
|
+
for (const error of plan2.errors) console.log(chalk217.red(error));
|
|
33041
33083
|
}
|
|
33042
33084
|
|
|
33043
33085
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
33044
|
-
import
|
|
33086
|
+
import chalk219 from "chalk";
|
|
33045
33087
|
|
|
33046
33088
|
// src/commands/refactor/restructure/displayDeepChains.ts
|
|
33047
|
-
import
|
|
33089
|
+
import chalk218 from "chalk";
|
|
33048
33090
|
var shownChains = 10;
|
|
33049
33091
|
function formatChain(chain2) {
|
|
33050
33092
|
const folders = chain2.folders.map((f) => `${f.name} (${f.files})`).join(" > ");
|
|
@@ -33054,20 +33096,20 @@ function displayDeepChains(chains, maxDepth) {
|
|
|
33054
33096
|
if (chains.length === 0) return;
|
|
33055
33097
|
const tooDeep = chains.reduce((sum3, c) => sum3 + c.tooDeep, 0);
|
|
33056
33098
|
console.log(
|
|
33057
|
-
|
|
33099
|
+
chalk218.red(
|
|
33058
33100
|
`
|
|
33059
33101
|
Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
|
|
33060
33102
|
)
|
|
33061
33103
|
);
|
|
33062
33104
|
console.log(
|
|
33063
|
-
|
|
33105
|
+
chalk218.bold(
|
|
33064
33106
|
"Deep chains, as folder (files beneath), most files too deep first:"
|
|
33065
33107
|
)
|
|
33066
33108
|
);
|
|
33067
33109
|
for (const chain2 of chains.slice(0, shownChains))
|
|
33068
33110
|
console.log(formatChain(chain2));
|
|
33069
33111
|
if (chains.length > shownChains)
|
|
33070
|
-
console.log(
|
|
33112
|
+
console.log(chalk218.dim(` \u2026and ${chains.length - shownChains} more`));
|
|
33071
33113
|
}
|
|
33072
33114
|
|
|
33073
33115
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
@@ -33088,7 +33130,7 @@ function displayLayoutLimits(limits, apply) {
|
|
|
33088
33130
|
if (!exceedsLayoutLimits(limits)) return;
|
|
33089
33131
|
displayDeepChains(limits.chains, limits.maxDepth);
|
|
33090
33132
|
console.log("");
|
|
33091
|
-
for (const line of pinSteps(apply)) console.log(
|
|
33133
|
+
for (const line of pinSteps(apply)) console.log(chalk219.yellow(line));
|
|
33092
33134
|
}
|
|
33093
33135
|
|
|
33094
33136
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
@@ -33100,14 +33142,14 @@ function checkPlan(plan2, limits) {
|
|
|
33100
33142
|
if (exceeds || plan2.errors.length > 0) process.exit(1);
|
|
33101
33143
|
if (plan2.moves.length > 0) {
|
|
33102
33144
|
console.log(
|
|
33103
|
-
|
|
33145
|
+
chalk220.yellow(
|
|
33104
33146
|
`
|
|
33105
33147
|
Run \`${apply}\` to move the files and rewrite their imports.`
|
|
33106
33148
|
)
|
|
33107
33149
|
);
|
|
33108
33150
|
process.exit(1);
|
|
33109
33151
|
}
|
|
33110
|
-
console.log(
|
|
33152
|
+
console.log(chalk220.green("Layout matches the restructure plan"));
|
|
33111
33153
|
}
|
|
33112
33154
|
|
|
33113
33155
|
// src/commands/refactor/restructure/findDeepChains.ts
|
|
@@ -33169,15 +33211,15 @@ function partitionIgnored(files) {
|
|
|
33169
33211
|
}
|
|
33170
33212
|
|
|
33171
33213
|
// src/commands/refactor/restructure/runPlan.ts
|
|
33172
|
-
import
|
|
33214
|
+
import chalk224 from "chalk";
|
|
33173
33215
|
|
|
33174
33216
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
33175
|
-
import
|
|
33217
|
+
import chalk222 from "chalk";
|
|
33176
33218
|
|
|
33177
33219
|
// src/commands/refactor/restructure/executePlan.ts
|
|
33178
33220
|
import fs37 from "fs";
|
|
33179
33221
|
import path76 from "path";
|
|
33180
|
-
import
|
|
33222
|
+
import chalk221 from "chalk";
|
|
33181
33223
|
function relPath(file) {
|
|
33182
33224
|
return path76.relative(process.cwd(), file);
|
|
33183
33225
|
}
|
|
@@ -33194,14 +33236,14 @@ function moveFiles(moves) {
|
|
|
33194
33236
|
fs37.mkdirSync(path76.dirname(move2.to), { recursive: true });
|
|
33195
33237
|
fs37.renameSync(staging, move2.to);
|
|
33196
33238
|
console.log(
|
|
33197
|
-
|
|
33239
|
+
chalk221.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
|
|
33198
33240
|
);
|
|
33199
33241
|
}
|
|
33200
33242
|
}
|
|
33201
33243
|
function removeIfEmpty(dir) {
|
|
33202
33244
|
if (!fs37.existsSync(dir) || fs37.readdirSync(dir).length > 0) return false;
|
|
33203
33245
|
fs37.rmdirSync(dir);
|
|
33204
|
-
console.log(
|
|
33246
|
+
console.log(chalk221.dim(` Removed empty directory ${relPath(dir)}`));
|
|
33205
33247
|
return true;
|
|
33206
33248
|
}
|
|
33207
33249
|
function removeEmptyDirectories(dirs, scopeRoot) {
|
|
@@ -33214,7 +33256,7 @@ function removeEmptyDirectories(dirs, scopeRoot) {
|
|
|
33214
33256
|
function executePlan(plan2) {
|
|
33215
33257
|
for (const [file, content] of applyRewrites(plan2.rewrites)) {
|
|
33216
33258
|
fs37.writeFileSync(file, content, "utf8");
|
|
33217
|
-
console.log(
|
|
33259
|
+
console.log(chalk221.cyan(` Rewrote imports in ${relPath(file)}`));
|
|
33218
33260
|
}
|
|
33219
33261
|
moveFiles(plan2.moves);
|
|
33220
33262
|
removeEmptyDirectories(
|
|
@@ -33226,17 +33268,17 @@ function executePlan(plan2) {
|
|
|
33226
33268
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
33227
33269
|
function applyPlan(plan2) {
|
|
33228
33270
|
if (plan2.errors.length > 0) {
|
|
33229
|
-
console.log(
|
|
33271
|
+
console.log(chalk222.red("\nResolve the errors above before applying."));
|
|
33230
33272
|
process.exit(1);
|
|
33231
33273
|
}
|
|
33232
|
-
console.log(
|
|
33274
|
+
console.log(chalk222.bold("\nApplying changes..."));
|
|
33233
33275
|
executePlan(plan2);
|
|
33234
|
-
console.log(
|
|
33276
|
+
console.log(chalk222.green("\nRestructuring complete"));
|
|
33235
33277
|
}
|
|
33236
33278
|
|
|
33237
33279
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
33238
33280
|
import path79 from "path";
|
|
33239
|
-
import
|
|
33281
|
+
import chalk223 from "chalk";
|
|
33240
33282
|
|
|
33241
33283
|
// src/commands/refactor/restructure/computeDepthStats.ts
|
|
33242
33284
|
import path77 from "path";
|
|
@@ -33287,17 +33329,17 @@ function relPath2(filePath) {
|
|
|
33287
33329
|
}
|
|
33288
33330
|
function displayMoves(plan2) {
|
|
33289
33331
|
if (plan2.moves.length === 0) return;
|
|
33290
|
-
console.log(
|
|
33332
|
+
console.log(chalk223.bold("\nFile moves:"));
|
|
33291
33333
|
for (const move2 of plan2.moves) {
|
|
33292
33334
|
console.log(
|
|
33293
|
-
` ${
|
|
33335
|
+
` ${chalk223.red(relPath2(move2.from))} \u2192 ${chalk223.green(relPath2(move2.to))}`
|
|
33294
33336
|
);
|
|
33295
|
-
console.log(
|
|
33337
|
+
console.log(chalk223.dim(` ${move2.reason}`));
|
|
33296
33338
|
}
|
|
33297
33339
|
}
|
|
33298
33340
|
function displayTree(plan2) {
|
|
33299
33341
|
console.log(
|
|
33300
|
-
|
|
33342
|
+
chalk223.bold(`
|
|
33301
33343
|
Resulting tree (${relPath2(plan2.scopeRoot) || "."}/):`)
|
|
33302
33344
|
);
|
|
33303
33345
|
for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
|
|
@@ -33308,15 +33350,15 @@ function displayDepthStats(plan2) {
|
|
|
33308
33350
|
plan2.targets.values(),
|
|
33309
33351
|
plan2.scopeRoot
|
|
33310
33352
|
);
|
|
33311
|
-
console.log(
|
|
33353
|
+
console.log(chalk223.bold(`
|
|
33312
33354
|
Depth (max ${max}):`));
|
|
33313
33355
|
for (const depth of [...distribution.keys()].sort((a, b) => a - b))
|
|
33314
33356
|
console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
|
|
33315
33357
|
}
|
|
33316
33358
|
function displayErrors(errors) {
|
|
33317
33359
|
if (errors.length === 0) return;
|
|
33318
|
-
console.log(
|
|
33319
|
-
for (const error of errors) console.log(
|
|
33360
|
+
console.log(chalk223.red("\nErrors:"));
|
|
33361
|
+
for (const error of errors) console.log(chalk223.red(` ${error}`));
|
|
33320
33362
|
}
|
|
33321
33363
|
function displayPlan2(plan2) {
|
|
33322
33364
|
displayMoves(plan2);
|
|
@@ -33325,7 +33367,7 @@ function displayPlan2(plan2) {
|
|
|
33325
33367
|
displayErrors(plan2.errors);
|
|
33326
33368
|
const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
|
|
33327
33369
|
console.log(
|
|
33328
|
-
|
|
33370
|
+
chalk223.dim(
|
|
33329
33371
|
`
|
|
33330
33372
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
|
|
33331
33373
|
)
|
|
@@ -33337,11 +33379,11 @@ function runPlan(plan2, limits, apply) {
|
|
|
33337
33379
|
displayPlan2(plan2);
|
|
33338
33380
|
displayLayoutLimits(limits, applyCommand(plan2.scopeRoot));
|
|
33339
33381
|
if (plan2.moves.length === 0 && plan2.errors.length === 0) {
|
|
33340
|
-
console.log(
|
|
33382
|
+
console.log(chalk224.green("No restructuring needed"));
|
|
33341
33383
|
return;
|
|
33342
33384
|
}
|
|
33343
33385
|
if (!apply) {
|
|
33344
|
-
console.log(
|
|
33386
|
+
console.log(chalk224.dim("\nDry run. Use --apply to execute."));
|
|
33345
33387
|
return;
|
|
33346
33388
|
}
|
|
33347
33389
|
applyPlan(plan2);
|
|
@@ -33351,14 +33393,14 @@ function runPlan(plan2, limits, apply) {
|
|
|
33351
33393
|
async function restructure(root2, options2 = {}) {
|
|
33352
33394
|
const scopeRoot = path80.resolve(root2 ?? "src");
|
|
33353
33395
|
if (!fs38.existsSync(scopeRoot) || !fs38.statSync(scopeRoot).isDirectory()) {
|
|
33354
|
-
console.log(
|
|
33396
|
+
console.log(chalk225.red(`Not a directory: ${root2 ?? "src"}`));
|
|
33355
33397
|
process.exit(1);
|
|
33356
33398
|
}
|
|
33357
33399
|
const found = [];
|
|
33358
33400
|
walkSourceFiles(scopeRoot, found);
|
|
33359
33401
|
const { scoped, ignored } = partitionIgnored(found);
|
|
33360
33402
|
if (scoped.length === 0) {
|
|
33361
|
-
console.log(
|
|
33403
|
+
console.log(chalk225.yellow("No files found under root"));
|
|
33362
33404
|
return;
|
|
33363
33405
|
}
|
|
33364
33406
|
const { pin: pin2 = [], maxDepth = 10 } = loadConfig().restructure ?? {};
|
|
@@ -33420,7 +33462,7 @@ async function checkoutOnlySession(number) {
|
|
|
33420
33462
|
}
|
|
33421
33463
|
|
|
33422
33464
|
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
33423
|
-
import
|
|
33465
|
+
import chalk229 from "chalk";
|
|
33424
33466
|
|
|
33425
33467
|
// src/commands/config/promptConfigScope.ts
|
|
33426
33468
|
import Enquirer3 from "enquirer";
|
|
@@ -33446,7 +33488,7 @@ async function promptConfigScope() {
|
|
|
33446
33488
|
}
|
|
33447
33489
|
|
|
33448
33490
|
// src/commands/config/resolveConfigKeyAnswer.ts
|
|
33449
|
-
import
|
|
33491
|
+
import chalk226 from "chalk";
|
|
33450
33492
|
async function resolveConfigKeyAnswer(question, supplied) {
|
|
33451
33493
|
if (supplied !== void 0) return coerceSupplied(question.key, supplied);
|
|
33452
33494
|
for (; ; ) {
|
|
@@ -33454,7 +33496,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
|
|
|
33454
33496
|
if (answer === "") return void 0;
|
|
33455
33497
|
const coercion = coerceCliConfigValue(question.key, answer);
|
|
33456
33498
|
if (coercion.ok) return coercion.value;
|
|
33457
|
-
console.error(
|
|
33499
|
+
console.error(chalk226.red(coercion.error));
|
|
33458
33500
|
}
|
|
33459
33501
|
}
|
|
33460
33502
|
function coerceSupplied(key, supplied) {
|
|
@@ -33515,7 +33557,7 @@ function suggestGlobs(current, proposed) {
|
|
|
33515
33557
|
}
|
|
33516
33558
|
|
|
33517
33559
|
// src/commands/review/highLevel/parseConfigureAnswers.ts
|
|
33518
|
-
import
|
|
33560
|
+
import chalk227 from "chalk";
|
|
33519
33561
|
function parseConfigureAnswers(answers) {
|
|
33520
33562
|
const known = Object.values(highLevelConfigKeys);
|
|
33521
33563
|
const parsed = {};
|
|
@@ -33533,13 +33575,13 @@ function answersCoverEveryKey(answers) {
|
|
|
33533
33575
|
return Object.values(highLevelConfigKeys).every((key) => key in answers);
|
|
33534
33576
|
}
|
|
33535
33577
|
function exitWith(message3) {
|
|
33536
|
-
console.error(
|
|
33578
|
+
console.error(chalk227.red(`Error: ${message3}.`));
|
|
33537
33579
|
process.exit(1);
|
|
33538
33580
|
}
|
|
33539
33581
|
|
|
33540
33582
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
33541
33583
|
import { execFileSync as execFileSync19 } from "child_process";
|
|
33542
|
-
import
|
|
33584
|
+
import chalk228 from "chalk";
|
|
33543
33585
|
|
|
33544
33586
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
33545
33587
|
function buildGlobProposalPrompt(tree) {
|
|
@@ -33632,12 +33674,12 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
33632
33674
|
const tree = summariseRepoTree(cwd);
|
|
33633
33675
|
if (tree === "") return NOTHING_PROPOSED;
|
|
33634
33676
|
console.log(
|
|
33635
|
-
|
|
33677
|
+
chalk228.dim("Asking Claude to propose globs from the repo's own tree...")
|
|
33636
33678
|
);
|
|
33637
33679
|
const output = askClaude(buildGlobProposalPrompt(tree), cwd);
|
|
33638
33680
|
if (output === void 0) {
|
|
33639
33681
|
console.log(
|
|
33640
|
-
|
|
33682
|
+
chalk228.yellow(
|
|
33641
33683
|
"Claude proposed nothing; answer each key from its current value."
|
|
33642
33684
|
)
|
|
33643
33685
|
);
|
|
@@ -33693,25 +33735,25 @@ function asConfigKeyScope(value) {
|
|
|
33693
33735
|
function reportConfigured(result) {
|
|
33694
33736
|
for (const write of result.written)
|
|
33695
33737
|
console.log(
|
|
33696
|
-
|
|
33738
|
+
chalk229.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
|
|
33697
33739
|
);
|
|
33698
|
-
for (const key of result.skipped) console.log(
|
|
33699
|
-
console.log(
|
|
33740
|
+
for (const key of result.skipped) console.log(chalk229.dim(`Left ${key} unset`));
|
|
33741
|
+
console.log(chalk229.dim(`Written to ${result.target}`));
|
|
33700
33742
|
}
|
|
33701
33743
|
|
|
33702
33744
|
// src/commands/review/highLevel/announceSavedReview.ts
|
|
33703
|
-
import
|
|
33745
|
+
import chalk230 from "chalk";
|
|
33704
33746
|
function announceSavedReview(subject, force) {
|
|
33705
33747
|
const head = subject.headSha.slice(0, 7);
|
|
33706
33748
|
if (subject.saved)
|
|
33707
33749
|
console.log(
|
|
33708
|
-
|
|
33750
|
+
chalk230.dim(
|
|
33709
33751
|
`Reopening the review saved for ${head} at ${subject.saved.reviewedAt} (${subject.saved.verdict}); pass --force to start fresh.`
|
|
33710
33752
|
)
|
|
33711
33753
|
);
|
|
33712
33754
|
else if (force)
|
|
33713
33755
|
console.log(
|
|
33714
|
-
|
|
33756
|
+
chalk230.dim(
|
|
33715
33757
|
`Discarding any review saved for ${head} and starting fresh (--force).`
|
|
33716
33758
|
)
|
|
33717
33759
|
);
|
|
@@ -34076,12 +34118,12 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
34076
34118
|
import { existsSync as existsSync64, readFileSync as readFileSync47 } from "fs";
|
|
34077
34119
|
|
|
34078
34120
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
34079
|
-
import { join as
|
|
34121
|
+
import { join as join79 } from "path";
|
|
34080
34122
|
function slug(value) {
|
|
34081
34123
|
return value.replace(/[^\w.-]+/g, "-");
|
|
34082
34124
|
}
|
|
34083
34125
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
34084
|
-
return
|
|
34126
|
+
return join79(
|
|
34085
34127
|
getStoreDir(),
|
|
34086
34128
|
"high-level-reviews",
|
|
34087
34129
|
slug(repo),
|
|
@@ -34252,55 +34294,55 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
34252
34294
|
}
|
|
34253
34295
|
|
|
34254
34296
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
34255
|
-
import
|
|
34297
|
+
import chalk234 from "chalk";
|
|
34256
34298
|
|
|
34257
34299
|
// src/commands/review/highLevel/formatCriticalDiffs.ts
|
|
34258
|
-
import
|
|
34300
|
+
import chalk231 from "chalk";
|
|
34259
34301
|
var PATCH_LINE_COLOURS = {
|
|
34260
|
-
"+":
|
|
34261
|
-
"-":
|
|
34262
|
-
"@":
|
|
34302
|
+
"+": chalk231.green,
|
|
34303
|
+
"-": chalk231.red,
|
|
34304
|
+
"@": chalk231.cyan
|
|
34263
34305
|
};
|
|
34264
34306
|
function formatPatch(patch2) {
|
|
34265
34307
|
return patch2.split("\n").map(
|
|
34266
|
-
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ??
|
|
34308
|
+
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk231.dim)(line)}`
|
|
34267
34309
|
);
|
|
34268
34310
|
}
|
|
34269
34311
|
function formatDiff(diff3) {
|
|
34270
34312
|
return [
|
|
34271
34313
|
"",
|
|
34272
|
-
` ${
|
|
34273
|
-
...diff3.patch === null ? [` ${
|
|
34314
|
+
` ${chalk231.bold(diff3.path)} ${chalk231.dim(`(${diff3.status})`)} ${chalk231.green(`+${diff3.additions}`)} ${chalk231.red(`-${diff3.deletions}`)}`,
|
|
34315
|
+
...diff3.patch === null ? [` ${chalk231.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
|
|
34274
34316
|
];
|
|
34275
34317
|
}
|
|
34276
34318
|
function formatCriticalDiffs(diffs, criticalPaths) {
|
|
34277
34319
|
if (criticalPaths.length === 0)
|
|
34278
|
-
return `${
|
|
34279
|
-
${
|
|
34320
|
+
return `${chalk231.bold.underline("Critical diffs")}
|
|
34321
|
+
${chalk231.dim("review.highLevel.criticalPaths is unset, so no diffs are shown")}`;
|
|
34280
34322
|
if (diffs.length === 0)
|
|
34281
|
-
return `${
|
|
34282
|
-
${
|
|
34323
|
+
return `${chalk231.bold.underline("Critical diffs")}
|
|
34324
|
+
${chalk231.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
|
|
34283
34325
|
return [
|
|
34284
|
-
|
|
34326
|
+
chalk231.bold.underline("Critical diffs"),
|
|
34285
34327
|
...diffs.flatMap(formatDiff)
|
|
34286
34328
|
].join("\n");
|
|
34287
34329
|
}
|
|
34288
34330
|
|
|
34289
34331
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
34290
|
-
import
|
|
34332
|
+
import chalk232 from "chalk";
|
|
34291
34333
|
var MARKERS = {
|
|
34292
|
-
pass: () =>
|
|
34293
|
-
fail: () =>
|
|
34294
|
-
manual: () =>
|
|
34334
|
+
pass: () => chalk232.green("\u2714"),
|
|
34335
|
+
fail: () => chalk232.red("\u2718"),
|
|
34336
|
+
manual: () => chalk232.yellow("\u25A1")
|
|
34295
34337
|
};
|
|
34296
34338
|
function formatCheck(check2) {
|
|
34297
|
-
const title = check2.status === "fail" ?
|
|
34339
|
+
const title = check2.status === "fail" ? chalk232.red(check2.title) : chalk232.bold(check2.title);
|
|
34298
34340
|
return ` ${MARKERS[check2.status]()} ${title}
|
|
34299
|
-
${
|
|
34341
|
+
${chalk232.dim(check2.reason)}`;
|
|
34300
34342
|
}
|
|
34301
34343
|
function formatGroup(heading2, checks2) {
|
|
34302
34344
|
if (checks2.length === 0) return [];
|
|
34303
|
-
return ["",
|
|
34345
|
+
return ["", chalk232.bold.underline(heading2), ...checks2.map(formatCheck)];
|
|
34304
34346
|
}
|
|
34305
34347
|
function formatHighLevelChecklist(checks2) {
|
|
34306
34348
|
const deterministic = checks2.filter(
|
|
@@ -34309,7 +34351,7 @@ function formatHighLevelChecklist(checks2) {
|
|
|
34309
34351
|
const failed3 = deterministic.filter(
|
|
34310
34352
|
(check2) => check2.status === "fail"
|
|
34311
34353
|
).length;
|
|
34312
|
-
const summary = failed3 === 0 ?
|
|
34354
|
+
const summary = failed3 === 0 ? chalk232.green(`All ${deterministic.length} deterministic checks pass`) : chalk232.red(
|
|
34313
34355
|
`${failed3} of ${deterministic.length} deterministic checks fail`
|
|
34314
34356
|
);
|
|
34315
34357
|
return [
|
|
@@ -34324,30 +34366,30 @@ function formatHighLevelChecklist(checks2) {
|
|
|
34324
34366
|
}
|
|
34325
34367
|
|
|
34326
34368
|
// src/commands/review/highLevel/formatHighLevelStructure.ts
|
|
34327
|
-
import
|
|
34369
|
+
import chalk233 from "chalk";
|
|
34328
34370
|
var STATUS_MARKERS = {
|
|
34329
|
-
added: () =>
|
|
34330
|
-
removed: () =>
|
|
34331
|
-
modified: () =>
|
|
34371
|
+
added: () => chalk233.green("A"),
|
|
34372
|
+
removed: () => chalk233.red("D"),
|
|
34373
|
+
modified: () => chalk233.yellow("M")
|
|
34332
34374
|
};
|
|
34333
34375
|
function counts(additions, deletions) {
|
|
34334
|
-
return `${
|
|
34376
|
+
return `${chalk233.green(`+${additions}`)} ${chalk233.red(`-${deletions}`)}`;
|
|
34335
34377
|
}
|
|
34336
34378
|
function formatNode(node, indent3) {
|
|
34337
34379
|
if (node.kind === "file")
|
|
34338
34380
|
return [
|
|
34339
|
-
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${
|
|
34381
|
+
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk233.dim(counts(node.additions, node.deletions))}`
|
|
34340
34382
|
];
|
|
34341
34383
|
const dir = node;
|
|
34342
34384
|
return [
|
|
34343
|
-
`${indent3}${
|
|
34385
|
+
`${indent3}${chalk233.bold(`${dir.name}/`)} ${chalk233.dim(counts(dir.additions, dir.deletions))}`,
|
|
34344
34386
|
...dir.children.flatMap((child) => formatNode(child, `${indent3} `))
|
|
34345
34387
|
];
|
|
34346
34388
|
}
|
|
34347
34389
|
function formatHighLevelStructure(structure) {
|
|
34348
34390
|
const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
|
|
34349
34391
|
return [
|
|
34350
|
-
|
|
34392
|
+
chalk233.bold.underline("Structure"),
|
|
34351
34393
|
` ${summary}`,
|
|
34352
34394
|
...structure.tree.flatMap((node) => formatNode(node, " "))
|
|
34353
34395
|
].join("\n");
|
|
@@ -34356,10 +34398,10 @@ function formatHighLevelStructure(structure) {
|
|
|
34356
34398
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
34357
34399
|
function printHighLevelChecklist(subject) {
|
|
34358
34400
|
console.log(
|
|
34359
|
-
|
|
34401
|
+
chalk234.bold(
|
|
34360
34402
|
`High-level review of ${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`
|
|
34361
34403
|
),
|
|
34362
|
-
|
|
34404
|
+
chalk234.dim(
|
|
34363
34405
|
`\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
|
|
34364
34406
|
)
|
|
34365
34407
|
);
|
|
@@ -34371,12 +34413,12 @@ function printHighLevelChecklist(subject) {
|
|
|
34371
34413
|
formatCriticalDiffs(subject.criticalDiffs, subject.criticalPaths)
|
|
34372
34414
|
);
|
|
34373
34415
|
console.log(
|
|
34374
|
-
|
|
34416
|
+
chalk234.dim(
|
|
34375
34417
|
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
34376
34418
|
)
|
|
34377
34419
|
);
|
|
34378
34420
|
console.log(
|
|
34379
|
-
|
|
34421
|
+
chalk234.dim(
|
|
34380
34422
|
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
34381
34423
|
)
|
|
34382
34424
|
);
|
|
@@ -34856,18 +34898,18 @@ function partitionFindingsByDiff(findings, index2) {
|
|
|
34856
34898
|
}
|
|
34857
34899
|
|
|
34858
34900
|
// src/commands/review/warnOutOfDiff.ts
|
|
34859
|
-
import
|
|
34901
|
+
import chalk235 from "chalk";
|
|
34860
34902
|
function warnOutOfDiff(outOfDiff) {
|
|
34861
34903
|
if (outOfDiff.length === 0) return;
|
|
34862
34904
|
console.warn(
|
|
34863
|
-
|
|
34905
|
+
chalk235.yellow(
|
|
34864
34906
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
34865
34907
|
)
|
|
34866
34908
|
);
|
|
34867
34909
|
for (const finding of outOfDiff) {
|
|
34868
34910
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
34869
34911
|
console.warn(
|
|
34870
|
-
` ${
|
|
34912
|
+
` ${chalk235.yellow("\xB7")} ${finding.title} ${chalk235.dim(
|
|
34871
34913
|
`(${finding.file}:${range})`
|
|
34872
34914
|
)}`
|
|
34873
34915
|
);
|
|
@@ -34891,18 +34933,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
34891
34933
|
}
|
|
34892
34934
|
|
|
34893
34935
|
// src/commands/review/warnUnlocated.ts
|
|
34894
|
-
import
|
|
34936
|
+
import chalk236 from "chalk";
|
|
34895
34937
|
function warnUnlocated(unlocated) {
|
|
34896
34938
|
if (unlocated.length === 0) return;
|
|
34897
34939
|
console.warn(
|
|
34898
|
-
|
|
34940
|
+
chalk236.yellow(
|
|
34899
34941
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
34900
34942
|
)
|
|
34901
34943
|
);
|
|
34902
34944
|
for (const finding of unlocated) {
|
|
34903
|
-
const where = finding.location ||
|
|
34945
|
+
const where = finding.location || chalk236.dim("missing");
|
|
34904
34946
|
console.warn(
|
|
34905
|
-
` ${
|
|
34947
|
+
` ${chalk236.yellow("\xB7")} ${finding.title} ${chalk236.dim(`(${where})`)}`
|
|
34906
34948
|
);
|
|
34907
34949
|
}
|
|
34908
34950
|
}
|
|
@@ -35157,7 +35199,7 @@ import { format } from "util";
|
|
|
35157
35199
|
|
|
35158
35200
|
// src/commands/review/createReviewLogSink.ts
|
|
35159
35201
|
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync23 } from "fs";
|
|
35160
|
-
import { join as
|
|
35202
|
+
import { join as join80 } from "path";
|
|
35161
35203
|
|
|
35162
35204
|
// src/shared/stripAnsi.ts
|
|
35163
35205
|
var ANSI = new RegExp(
|
|
@@ -35185,7 +35227,7 @@ function createReviewLogSink() {
|
|
|
35185
35227
|
},
|
|
35186
35228
|
attach(reviewDir) {
|
|
35187
35229
|
mkdirSync23(reviewDir, { recursive: true });
|
|
35188
|
-
logPath2 =
|
|
35230
|
+
logPath2 = join80(reviewDir, LOG_FILE);
|
|
35189
35231
|
const lines2 = [
|
|
35190
35232
|
"",
|
|
35191
35233
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -36267,9 +36309,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
36267
36309
|
|
|
36268
36310
|
// src/commands/review/buildReviewPaths.ts
|
|
36269
36311
|
import { homedir as homedir24 } from "os";
|
|
36270
|
-
import { basename as basename21, join as
|
|
36312
|
+
import { basename as basename21, join as join81 } from "path";
|
|
36271
36313
|
function buildReviewPaths(repoRoot2, key) {
|
|
36272
|
-
const reviewDir =
|
|
36314
|
+
const reviewDir = join81(
|
|
36273
36315
|
homedir24(),
|
|
36274
36316
|
".assist",
|
|
36275
36317
|
"reviews",
|
|
@@ -36278,10 +36320,10 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
36278
36320
|
);
|
|
36279
36321
|
return {
|
|
36280
36322
|
reviewDir,
|
|
36281
|
-
requestPath:
|
|
36282
|
-
claudePath:
|
|
36283
|
-
codexPath:
|
|
36284
|
-
synthesisPath:
|
|
36323
|
+
requestPath: join81(reviewDir, "request.md"),
|
|
36324
|
+
claudePath: join81(reviewDir, "claude.md"),
|
|
36325
|
+
codexPath: join81(reviewDir, "codex.md"),
|
|
36326
|
+
synthesisPath: join81(reviewDir, "synthesis.md")
|
|
36285
36327
|
};
|
|
36286
36328
|
}
|
|
36287
36329
|
|
|
@@ -36553,7 +36595,7 @@ function registerReview(program2) {
|
|
|
36553
36595
|
// src/commands/rules/addRule.ts
|
|
36554
36596
|
import { existsSync as existsSync70, readFileSync as readFileSync53, writeFileSync as writeFileSync43 } from "fs";
|
|
36555
36597
|
import path85 from "path";
|
|
36556
|
-
import
|
|
36598
|
+
import chalk237 from "chalk";
|
|
36557
36599
|
|
|
36558
36600
|
// src/commands/rules/insertRuleBullet.ts
|
|
36559
36601
|
function ruleBullet({ code, title, text: text17 }) {
|
|
@@ -36689,7 +36731,7 @@ function read2(file) {
|
|
|
36689
36731
|
function addRule(text17, options2) {
|
|
36690
36732
|
const rule = text17.trim();
|
|
36691
36733
|
if (rule === "") {
|
|
36692
|
-
console.error(
|
|
36734
|
+
console.error(chalk237.red("Rule text is required"));
|
|
36693
36735
|
process.exitCode = 1;
|
|
36694
36736
|
return;
|
|
36695
36737
|
}
|
|
@@ -36707,13 +36749,13 @@ function addRule(text17, options2) {
|
|
|
36707
36749
|
);
|
|
36708
36750
|
updateScopedRulesIndex(root2);
|
|
36709
36751
|
console.log(
|
|
36710
|
-
`Added ${
|
|
36752
|
+
`Added ${chalk237.cyan(code)} to ${path85.relative(process.cwd(), target) || target}`
|
|
36711
36753
|
);
|
|
36712
36754
|
}
|
|
36713
36755
|
|
|
36714
36756
|
// src/commands/rules/indexRules.ts
|
|
36715
36757
|
import path86 from "path";
|
|
36716
|
-
import
|
|
36758
|
+
import chalk238 from "chalk";
|
|
36717
36759
|
function indexRules() {
|
|
36718
36760
|
const startDir = scopeDirectory(process.cwd());
|
|
36719
36761
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
@@ -36721,24 +36763,24 @@ function indexRules() {
|
|
|
36721
36763
|
const rootFile = path86.relative(process.cwd(), path86.join(root2, "CLAUDE.md"));
|
|
36722
36764
|
if (directories.length === 0) {
|
|
36723
36765
|
console.log(
|
|
36724
|
-
|
|
36766
|
+
chalk238.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
36725
36767
|
);
|
|
36726
36768
|
return;
|
|
36727
36769
|
}
|
|
36728
36770
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
36729
36771
|
for (const directory of directories)
|
|
36730
|
-
console.log(` ${
|
|
36772
|
+
console.log(` ${chalk238.cyan(directory)}`);
|
|
36731
36773
|
}
|
|
36732
36774
|
|
|
36733
36775
|
// src/commands/rules/listRules.ts
|
|
36734
36776
|
import path87 from "path";
|
|
36735
|
-
import
|
|
36777
|
+
import chalk239 from "chalk";
|
|
36736
36778
|
function listRules(target, options2 = {}) {
|
|
36737
36779
|
const resolved = path87.resolve(target ?? process.cwd());
|
|
36738
36780
|
const rules3 = readScopedRules(resolved);
|
|
36739
36781
|
if (rules3.length === 0) {
|
|
36740
36782
|
const label2 = path87.relative(process.cwd(), resolved) || ".";
|
|
36741
|
-
console.log(
|
|
36783
|
+
console.log(chalk239.gray(`No rules in scope for ${label2}`));
|
|
36742
36784
|
return;
|
|
36743
36785
|
}
|
|
36744
36786
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -36748,14 +36790,14 @@ function listRules(target, options2 = {}) {
|
|
|
36748
36790
|
if (rule.source !== shown) {
|
|
36749
36791
|
shown = rule.source;
|
|
36750
36792
|
console.log(
|
|
36751
|
-
|
|
36793
|
+
chalk239.dim(base ? path87.relative(base, rule.source) : rule.source)
|
|
36752
36794
|
);
|
|
36753
36795
|
}
|
|
36754
36796
|
console.log(
|
|
36755
|
-
` ${
|
|
36797
|
+
` ${chalk239.cyan(rule.code.padEnd(width))} ${rule.title ?? rule.text}`
|
|
36756
36798
|
);
|
|
36757
36799
|
if (options2.full && rule.title)
|
|
36758
|
-
console.log(` ${" ".repeat(width)} ${
|
|
36800
|
+
console.log(` ${" ".repeat(width)} ${chalk239.dim(rule.text)}`);
|
|
36759
36801
|
}
|
|
36760
36802
|
}
|
|
36761
36803
|
|
|
@@ -36784,7 +36826,7 @@ function registerRules(program2) {
|
|
|
36784
36826
|
}
|
|
36785
36827
|
|
|
36786
36828
|
// src/commands/seq/seqAuth.ts
|
|
36787
|
-
import
|
|
36829
|
+
import chalk241 from "chalk";
|
|
36788
36830
|
|
|
36789
36831
|
// src/commands/seq/loadConnections.ts
|
|
36790
36832
|
function loadConnections2() {
|
|
@@ -36813,10 +36855,10 @@ function setDefaultConnection(name) {
|
|
|
36813
36855
|
}
|
|
36814
36856
|
|
|
36815
36857
|
// src/shared/assertUniqueName.ts
|
|
36816
|
-
import
|
|
36858
|
+
import chalk240 from "chalk";
|
|
36817
36859
|
function assertUniqueName(existingNames, name) {
|
|
36818
36860
|
if (existingNames.includes(name)) {
|
|
36819
|
-
console.error(
|
|
36861
|
+
console.error(chalk240.red(`Connection "${name}" already exists.`));
|
|
36820
36862
|
process.exit(1);
|
|
36821
36863
|
}
|
|
36822
36864
|
}
|
|
@@ -36834,16 +36876,16 @@ async function promptConnection2(existingNames) {
|
|
|
36834
36876
|
var seqAuth = createConnectionAuth({
|
|
36835
36877
|
load: loadConnections2,
|
|
36836
36878
|
save: saveConnections2,
|
|
36837
|
-
format: (c) => `${
|
|
36879
|
+
format: (c) => `${chalk241.bold(c.name)} ${c.url}`,
|
|
36838
36880
|
promptNew: promptConnection2,
|
|
36839
36881
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
36840
36882
|
});
|
|
36841
36883
|
|
|
36842
36884
|
// src/commands/seq/seqQuery.ts
|
|
36843
|
-
import
|
|
36885
|
+
import chalk245 from "chalk";
|
|
36844
36886
|
|
|
36845
36887
|
// src/commands/seq/fetchSeq.ts
|
|
36846
|
-
import
|
|
36888
|
+
import chalk242 from "chalk";
|
|
36847
36889
|
async function fetchSeq(conn, path106, params) {
|
|
36848
36890
|
const url = `${conn.url}${path106}?${params}`;
|
|
36849
36891
|
const response = await fetch(url, {
|
|
@@ -36854,7 +36896,7 @@ async function fetchSeq(conn, path106, params) {
|
|
|
36854
36896
|
});
|
|
36855
36897
|
if (!response.ok) {
|
|
36856
36898
|
const body = await response.text();
|
|
36857
|
-
console.error(
|
|
36899
|
+
console.error(chalk242.red(`Seq returned ${response.status}: ${body}`));
|
|
36858
36900
|
process.exit(1);
|
|
36859
36901
|
}
|
|
36860
36902
|
return response;
|
|
@@ -36913,23 +36955,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
36913
36955
|
}
|
|
36914
36956
|
|
|
36915
36957
|
// src/commands/seq/formatEvent.ts
|
|
36916
|
-
import
|
|
36958
|
+
import chalk243 from "chalk";
|
|
36917
36959
|
function levelColor(level) {
|
|
36918
36960
|
switch (level) {
|
|
36919
36961
|
case "Fatal":
|
|
36920
|
-
return
|
|
36962
|
+
return chalk243.bgRed.white;
|
|
36921
36963
|
case "Error":
|
|
36922
|
-
return
|
|
36964
|
+
return chalk243.red;
|
|
36923
36965
|
case "Warning":
|
|
36924
|
-
return
|
|
36966
|
+
return chalk243.yellow;
|
|
36925
36967
|
case "Information":
|
|
36926
|
-
return
|
|
36968
|
+
return chalk243.cyan;
|
|
36927
36969
|
case "Debug":
|
|
36928
|
-
return
|
|
36970
|
+
return chalk243.gray;
|
|
36929
36971
|
case "Verbose":
|
|
36930
|
-
return
|
|
36972
|
+
return chalk243.dim;
|
|
36931
36973
|
default:
|
|
36932
|
-
return
|
|
36974
|
+
return chalk243.white;
|
|
36933
36975
|
}
|
|
36934
36976
|
}
|
|
36935
36977
|
function levelAbbrev(level) {
|
|
@@ -36970,12 +37012,12 @@ function formatTimestamp(iso) {
|
|
|
36970
37012
|
function formatEvent(event) {
|
|
36971
37013
|
const color = levelColor(event.Level);
|
|
36972
37014
|
const abbrev = levelAbbrev(event.Level);
|
|
36973
|
-
const ts10 =
|
|
37015
|
+
const ts10 = chalk243.dim(formatTimestamp(event.Timestamp));
|
|
36974
37016
|
const msg = renderMessage(event);
|
|
36975
37017
|
const lines2 = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
|
|
36976
37018
|
if (event.Exception) {
|
|
36977
37019
|
for (const line of event.Exception.split("\n")) {
|
|
36978
|
-
lines2.push(
|
|
37020
|
+
lines2.push(chalk243.red(` ${line}`));
|
|
36979
37021
|
}
|
|
36980
37022
|
}
|
|
36981
37023
|
return lines2.join("\n");
|
|
@@ -37008,11 +37050,11 @@ function rejectTimestampFilter(filter) {
|
|
|
37008
37050
|
}
|
|
37009
37051
|
|
|
37010
37052
|
// src/shared/resolveNamedConnection.ts
|
|
37011
|
-
import
|
|
37053
|
+
import chalk244 from "chalk";
|
|
37012
37054
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
37013
37055
|
if (connections.length === 0) {
|
|
37014
37056
|
console.error(
|
|
37015
|
-
|
|
37057
|
+
chalk244.red(
|
|
37016
37058
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
37017
37059
|
)
|
|
37018
37060
|
);
|
|
@@ -37021,7 +37063,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
37021
37063
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
37022
37064
|
const connection = connections.find((c) => c.name === target);
|
|
37023
37065
|
if (!connection) {
|
|
37024
|
-
console.error(
|
|
37066
|
+
console.error(chalk244.red(`${kind} connection "${target}" not found.`));
|
|
37025
37067
|
process.exit(1);
|
|
37026
37068
|
}
|
|
37027
37069
|
return connection;
|
|
@@ -37050,7 +37092,7 @@ async function seqQuery(filter, options2) {
|
|
|
37050
37092
|
new URLSearchParams({ filter, count: String(count8) })
|
|
37051
37093
|
);
|
|
37052
37094
|
if (events.length === 0) {
|
|
37053
|
-
console.log(
|
|
37095
|
+
console.log(chalk245.yellow("No events found."));
|
|
37054
37096
|
return;
|
|
37055
37097
|
}
|
|
37056
37098
|
if (options2.json) {
|
|
@@ -37061,11 +37103,11 @@ async function seqQuery(filter, options2) {
|
|
|
37061
37103
|
for (const event of chronological) {
|
|
37062
37104
|
console.log(formatEvent(event));
|
|
37063
37105
|
}
|
|
37064
|
-
console.log(
|
|
37106
|
+
console.log(chalk245.dim(`
|
|
37065
37107
|
${events.length} events`));
|
|
37066
37108
|
if (events.length >= count8) {
|
|
37067
37109
|
console.log(
|
|
37068
|
-
|
|
37110
|
+
chalk245.yellow(
|
|
37069
37111
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
37070
37112
|
)
|
|
37071
37113
|
);
|
|
@@ -37073,10 +37115,10 @@ ${events.length} events`));
|
|
|
37073
37115
|
}
|
|
37074
37116
|
|
|
37075
37117
|
// src/shared/setNamedDefaultConnection.ts
|
|
37076
|
-
import
|
|
37118
|
+
import chalk246 from "chalk";
|
|
37077
37119
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
37078
37120
|
if (!connections.find((c) => c.name === name)) {
|
|
37079
|
-
console.error(
|
|
37121
|
+
console.error(chalk246.red(`Connection "${name}" not found.`));
|
|
37080
37122
|
process.exit(1);
|
|
37081
37123
|
}
|
|
37082
37124
|
setDefault(name);
|
|
@@ -37262,12 +37304,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
37262
37304
|
}
|
|
37263
37305
|
|
|
37264
37306
|
// src/commands/slack/slackWorkingFile.ts
|
|
37265
|
-
import { join as
|
|
37307
|
+
import { join as join82 } from "path";
|
|
37266
37308
|
function slackWorkingFile(channel, partIndex) {
|
|
37267
37309
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
37268
|
-
const dir =
|
|
37310
|
+
const dir = join82(getStoreDir(), "slack");
|
|
37269
37311
|
const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
37270
|
-
return { dir, bodyPath:
|
|
37312
|
+
return { dir, bodyPath: join82(dir, `${name}.md`) };
|
|
37271
37313
|
}
|
|
37272
37314
|
|
|
37273
37315
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -37368,7 +37410,7 @@ function registerSlack(program2) {
|
|
|
37368
37410
|
}
|
|
37369
37411
|
|
|
37370
37412
|
// src/commands/sql/sqlAuth.ts
|
|
37371
|
-
import
|
|
37413
|
+
import chalk248 from "chalk";
|
|
37372
37414
|
|
|
37373
37415
|
// src/commands/sql/loadConnections.ts
|
|
37374
37416
|
function loadConnections3() {
|
|
@@ -37397,7 +37439,7 @@ function setDefaultConnection2(name) {
|
|
|
37397
37439
|
}
|
|
37398
37440
|
|
|
37399
37441
|
// src/commands/sql/promptConnection.ts
|
|
37400
|
-
import
|
|
37442
|
+
import chalk247 from "chalk";
|
|
37401
37443
|
async function promptConnection3(existingNames) {
|
|
37402
37444
|
const name = await promptInput("name", "Connection name:", "default");
|
|
37403
37445
|
assertUniqueName(existingNames, name);
|
|
@@ -37405,7 +37447,7 @@ async function promptConnection3(existingNames) {
|
|
|
37405
37447
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
37406
37448
|
const port = Number.parseInt(portStr, 10);
|
|
37407
37449
|
if (!Number.isFinite(port)) {
|
|
37408
|
-
console.error(
|
|
37450
|
+
console.error(chalk247.red(`Invalid port "${portStr}".`));
|
|
37409
37451
|
process.exit(1);
|
|
37410
37452
|
}
|
|
37411
37453
|
const user = await promptInput("user", "User:");
|
|
@@ -37418,13 +37460,13 @@ async function promptConnection3(existingNames) {
|
|
|
37418
37460
|
var sqlAuth = createConnectionAuth({
|
|
37419
37461
|
load: loadConnections3,
|
|
37420
37462
|
save: saveConnections3,
|
|
37421
|
-
format: (c) => `${
|
|
37463
|
+
format: (c) => `${chalk248.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
37422
37464
|
promptNew: promptConnection3,
|
|
37423
37465
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
37424
37466
|
});
|
|
37425
37467
|
|
|
37426
37468
|
// src/commands/sql/printTable.ts
|
|
37427
|
-
import
|
|
37469
|
+
import chalk249 from "chalk";
|
|
37428
37470
|
function formatCell(value) {
|
|
37429
37471
|
if (value === null || value === void 0) return "";
|
|
37430
37472
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -37433,7 +37475,7 @@ function formatCell(value) {
|
|
|
37433
37475
|
}
|
|
37434
37476
|
function printTable(rows) {
|
|
37435
37477
|
if (rows.length === 0) {
|
|
37436
|
-
console.log(
|
|
37478
|
+
console.log(chalk249.yellow("(no rows)"));
|
|
37437
37479
|
return;
|
|
37438
37480
|
}
|
|
37439
37481
|
const columns = Object.keys(rows[0]);
|
|
@@ -37441,13 +37483,13 @@ function printTable(rows) {
|
|
|
37441
37483
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
37442
37484
|
);
|
|
37443
37485
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
37444
|
-
console.log(
|
|
37445
|
-
console.log(
|
|
37486
|
+
console.log(chalk249.dim(header));
|
|
37487
|
+
console.log(chalk249.dim("-".repeat(header.length)));
|
|
37446
37488
|
for (const row of rows) {
|
|
37447
37489
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
37448
37490
|
console.log(line);
|
|
37449
37491
|
}
|
|
37450
|
-
console.log(
|
|
37492
|
+
console.log(chalk249.dim(`
|
|
37451
37493
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
37452
37494
|
}
|
|
37453
37495
|
|
|
@@ -37507,7 +37549,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
37507
37549
|
}
|
|
37508
37550
|
|
|
37509
37551
|
// src/commands/sql/sqlMutate.ts
|
|
37510
|
-
import
|
|
37552
|
+
import chalk250 from "chalk";
|
|
37511
37553
|
|
|
37512
37554
|
// src/commands/sql/isMutation.ts
|
|
37513
37555
|
var MUTATION_KEYWORDS = [
|
|
@@ -37541,7 +37583,7 @@ function isMutation(sql28) {
|
|
|
37541
37583
|
async function sqlMutate(query, connectionName) {
|
|
37542
37584
|
if (!isMutation(query)) {
|
|
37543
37585
|
console.error(
|
|
37544
|
-
|
|
37586
|
+
chalk250.red(
|
|
37545
37587
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
37546
37588
|
)
|
|
37547
37589
|
);
|
|
@@ -37551,18 +37593,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
37551
37593
|
const pool = await sqlConnect(conn);
|
|
37552
37594
|
try {
|
|
37553
37595
|
const result = await pool.request().query(query);
|
|
37554
|
-
console.log(
|
|
37596
|
+
console.log(chalk250.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
37555
37597
|
} finally {
|
|
37556
37598
|
await pool.close();
|
|
37557
37599
|
}
|
|
37558
37600
|
}
|
|
37559
37601
|
|
|
37560
37602
|
// src/commands/sql/sqlQuery.ts
|
|
37561
|
-
import
|
|
37603
|
+
import chalk251 from "chalk";
|
|
37562
37604
|
async function sqlQuery(query, connectionName) {
|
|
37563
37605
|
if (isMutation(query)) {
|
|
37564
37606
|
console.error(
|
|
37565
|
-
|
|
37607
|
+
chalk251.red(
|
|
37566
37608
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
37567
37609
|
)
|
|
37568
37610
|
);
|
|
@@ -37577,7 +37619,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
37577
37619
|
printTable(rows);
|
|
37578
37620
|
} else {
|
|
37579
37621
|
console.log(
|
|
37580
|
-
|
|
37622
|
+
chalk251.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
37581
37623
|
);
|
|
37582
37624
|
}
|
|
37583
37625
|
} finally {
|
|
@@ -37998,7 +38040,7 @@ function syncPi(claudeDir, options2) {
|
|
|
37998
38040
|
// src/commands/sync/syncSettings.ts
|
|
37999
38041
|
import * as fs47 from "fs";
|
|
38000
38042
|
import * as path98 from "path";
|
|
38001
|
-
import
|
|
38043
|
+
import chalk252 from "chalk";
|
|
38002
38044
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
38003
38045
|
const source = path98.join(claudeDir, "settings.json");
|
|
38004
38046
|
const target = path98.join(targetBase, "settings.json");
|
|
@@ -38017,7 +38059,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
38017
38059
|
if (mergedContent !== normalizedTarget) {
|
|
38018
38060
|
if (!options2?.yes) {
|
|
38019
38061
|
console.log(
|
|
38020
|
-
|
|
38062
|
+
chalk252.yellow(
|
|
38021
38063
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
38022
38064
|
)
|
|
38023
38065
|
);
|
|
@@ -38025,7 +38067,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
38025
38067
|
printDiff(targetContent, mergedContent);
|
|
38026
38068
|
printAutoConfirmHint();
|
|
38027
38069
|
const confirm = await promptConfirm(
|
|
38028
|
-
|
|
38070
|
+
chalk252.red("Overwrite existing settings.json?"),
|
|
38029
38071
|
false
|
|
38030
38072
|
);
|
|
38031
38073
|
if (!confirm) {
|
|
@@ -38447,20 +38489,20 @@ async function configure() {
|
|
|
38447
38489
|
|
|
38448
38490
|
// src/commands/transcript/list.ts
|
|
38449
38491
|
import { existsSync as existsSync76, readdirSync as readdirSync20, statSync as statSync12 } from "fs";
|
|
38450
|
-
import { join as
|
|
38492
|
+
import { join as join94 } from "path";
|
|
38451
38493
|
function list3() {
|
|
38452
38494
|
const { vttDir } = getTranscriptConfig();
|
|
38453
38495
|
if (!existsSync76(vttDir)) return;
|
|
38454
38496
|
for (const entry of readdirSync20(vttDir)) {
|
|
38455
38497
|
if (!entry.endsWith(".vtt")) continue;
|
|
38456
|
-
if (statSync12(
|
|
38498
|
+
if (statSync12(join94(vttDir, entry)).isDirectory()) continue;
|
|
38457
38499
|
console.log(entry);
|
|
38458
38500
|
}
|
|
38459
38501
|
}
|
|
38460
38502
|
|
|
38461
38503
|
// src/commands/transcript/move.ts
|
|
38462
38504
|
import { existsSync as existsSync77, mkdirSync as mkdirSync32, renameSync as renameSync2, writeFileSync as writeFileSync50 } from "fs";
|
|
38463
|
-
import { basename as basename25, join as
|
|
38505
|
+
import { basename as basename25, join as join95 } from "path";
|
|
38464
38506
|
|
|
38465
38507
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
38466
38508
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -38470,9 +38512,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
38470
38512
|
// src/commands/transcript/move.ts
|
|
38471
38513
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
38472
38514
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
38473
|
-
const processedDir =
|
|
38515
|
+
const processedDir = join95(vttDir, "processed");
|
|
38474
38516
|
mkdirSync32(processedDir, { recursive: true });
|
|
38475
|
-
renameSync2(sourcePath,
|
|
38517
|
+
renameSync2(sourcePath, join95(processedDir, filename));
|
|
38476
38518
|
}
|
|
38477
38519
|
function move(file, options2) {
|
|
38478
38520
|
const { date, client } = options2;
|
|
@@ -38482,19 +38524,19 @@ function move(file, options2) {
|
|
|
38482
38524
|
}
|
|
38483
38525
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
38484
38526
|
const filename = basename25(file);
|
|
38485
|
-
const sourcePath =
|
|
38527
|
+
const sourcePath = join95(vttDir, filename);
|
|
38486
38528
|
if (!existsSync77(sourcePath)) {
|
|
38487
38529
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
38488
38530
|
process.exit(1);
|
|
38489
38531
|
}
|
|
38490
38532
|
const base = basename25(filename, ".vtt").replace(/ Transcription$/, "");
|
|
38491
38533
|
const outputName = `${date} ${base}.md`;
|
|
38492
|
-
const formattedDir =
|
|
38534
|
+
const formattedDir = join95(transcriptsDir, client);
|
|
38493
38535
|
mkdirSync32(formattedDir, { recursive: true });
|
|
38494
|
-
const formattedPath =
|
|
38536
|
+
const formattedPath = join95(formattedDir, outputName);
|
|
38495
38537
|
writeFileSync50(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
38496
38538
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
38497
|
-
const summaryPath =
|
|
38539
|
+
const summaryPath = join95(summaryDir, client, outputName);
|
|
38498
38540
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
38499
38541
|
console.log(`Summary target: ${summaryPath}`);
|
|
38500
38542
|
}
|
|
@@ -39655,11 +39697,11 @@ function changedPaths(from, cwd) {
|
|
|
39655
39697
|
}
|
|
39656
39698
|
|
|
39657
39699
|
// src/commands/watch/readBuiltVersion.ts
|
|
39658
|
-
import { join as
|
|
39700
|
+
import { join as join96 } from "path";
|
|
39659
39701
|
function readBuiltVersion(cwd) {
|
|
39660
39702
|
try {
|
|
39661
39703
|
const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
39662
|
-
return readPackageJson(
|
|
39704
|
+
return readPackageJson(join96(root2, "package.json")).version ?? "unknown";
|
|
39663
39705
|
} catch {
|
|
39664
39706
|
return "unknown";
|
|
39665
39707
|
}
|
|
@@ -40282,7 +40324,7 @@ function registerWatch(program2) {
|
|
|
40282
40324
|
|
|
40283
40325
|
// src/commands/roam/auth.ts
|
|
40284
40326
|
import { randomBytes } from "crypto";
|
|
40285
|
-
import
|
|
40327
|
+
import chalk253 from "chalk";
|
|
40286
40328
|
|
|
40287
40329
|
// src/commands/roam/waitForCallback.ts
|
|
40288
40330
|
import { createServer as createServer3 } from "http";
|
|
@@ -40413,13 +40455,13 @@ async function auth() {
|
|
|
40413
40455
|
saveGlobalConfig(config);
|
|
40414
40456
|
const state = randomBytes(16).toString("hex");
|
|
40415
40457
|
console.log(
|
|
40416
|
-
|
|
40458
|
+
chalk253.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
40417
40459
|
);
|
|
40418
|
-
console.log(
|
|
40419
|
-
console.log(
|
|
40420
|
-
console.log(
|
|
40460
|
+
console.log(chalk253.white("http://localhost:14523/callback\n"));
|
|
40461
|
+
console.log(chalk253.blue("Opening browser for authorization..."));
|
|
40462
|
+
console.log(chalk253.dim("Waiting for authorization callback..."));
|
|
40421
40463
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
40422
|
-
console.log(
|
|
40464
|
+
console.log(chalk253.dim("Exchanging code for tokens..."));
|
|
40423
40465
|
const tokens = await exchangeToken({
|
|
40424
40466
|
code,
|
|
40425
40467
|
clientId,
|
|
@@ -40435,14 +40477,14 @@ async function auth() {
|
|
|
40435
40477
|
};
|
|
40436
40478
|
saveGlobalConfig(config);
|
|
40437
40479
|
console.log(
|
|
40438
|
-
|
|
40480
|
+
chalk253.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
40439
40481
|
);
|
|
40440
40482
|
}
|
|
40441
40483
|
|
|
40442
40484
|
// src/commands/roam/postRoamActivity.ts
|
|
40443
40485
|
import { execFileSync as execFileSync22 } from "child_process";
|
|
40444
40486
|
import { readdirSync as readdirSync22, readFileSync as readFileSync62, statSync as statSync13 } from "fs";
|
|
40445
|
-
import { join as
|
|
40487
|
+
import { join as join97 } from "path";
|
|
40446
40488
|
function findPortFile(roamDir) {
|
|
40447
40489
|
let entries;
|
|
40448
40490
|
try {
|
|
@@ -40451,7 +40493,7 @@ function findPortFile(roamDir) {
|
|
|
40451
40493
|
return void 0;
|
|
40452
40494
|
}
|
|
40453
40495
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
40454
|
-
const path106 =
|
|
40496
|
+
const path106 = join97(roamDir, name);
|
|
40455
40497
|
try {
|
|
40456
40498
|
return { path: path106, mtimeMs: statSync13(path106).mtimeMs };
|
|
40457
40499
|
} catch {
|
|
@@ -40468,7 +40510,7 @@ var PID_BY_APP = {
|
|
|
40468
40510
|
function postRoamActivity(app, event) {
|
|
40469
40511
|
const appData = process.env.APPDATA;
|
|
40470
40512
|
if (!appData) return;
|
|
40471
|
-
const portFile = findPortFile(
|
|
40513
|
+
const portFile = findPortFile(join97(appData, "Roam"));
|
|
40472
40514
|
if (!portFile) return;
|
|
40473
40515
|
let port;
|
|
40474
40516
|
try {
|
|
@@ -40604,7 +40646,7 @@ async function run3(name, args) {
|
|
|
40604
40646
|
|
|
40605
40647
|
// src/commands/run/add.ts
|
|
40606
40648
|
import { mkdirSync as mkdirSync33, writeFileSync as writeFileSync53 } from "fs";
|
|
40607
|
-
import { join as
|
|
40649
|
+
import { join as join98 } from "path";
|
|
40608
40650
|
|
|
40609
40651
|
// src/commands/run/extractOption.ts
|
|
40610
40652
|
function extractOption(args, flag) {
|
|
@@ -40665,7 +40707,7 @@ function saveNewRunConfig(name, command, args, cwd) {
|
|
|
40665
40707
|
saveConfig(config);
|
|
40666
40708
|
}
|
|
40667
40709
|
function createCommandFile(name) {
|
|
40668
|
-
const dir =
|
|
40710
|
+
const dir = join98(".claude", "commands");
|
|
40669
40711
|
mkdirSync33(dir, { recursive: true });
|
|
40670
40712
|
const content = `---
|
|
40671
40713
|
description: Run ${name}
|
|
@@ -40673,7 +40715,7 @@ description: Run ${name}
|
|
|
40673
40715
|
|
|
40674
40716
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
40675
40717
|
`;
|
|
40676
|
-
const filePath =
|
|
40718
|
+
const filePath = join98(dir, `${name}.md`);
|
|
40677
40719
|
writeFileSync53(filePath, content);
|
|
40678
40720
|
console.log(`Created command file: ${filePath}`);
|
|
40679
40721
|
}
|
|
@@ -40730,7 +40772,7 @@ function link2() {
|
|
|
40730
40772
|
|
|
40731
40773
|
// src/commands/run/remove.ts
|
|
40732
40774
|
import { existsSync as existsSync82, unlinkSync as unlinkSync21 } from "fs";
|
|
40733
|
-
import { join as
|
|
40775
|
+
import { join as join99 } from "path";
|
|
40734
40776
|
function findRemoveIndex() {
|
|
40735
40777
|
const idx = process.argv.indexOf("remove");
|
|
40736
40778
|
if (idx === -1 || idx + 1 >= process.argv.length) return -1;
|
|
@@ -40745,7 +40787,7 @@ function parseRemoveName() {
|
|
|
40745
40787
|
return process.argv[idx + 1];
|
|
40746
40788
|
}
|
|
40747
40789
|
function deleteCommandFile(name) {
|
|
40748
|
-
const filePath =
|
|
40790
|
+
const filePath = join99(".claude", "commands", `${name}.md`);
|
|
40749
40791
|
if (existsSync82(filePath)) {
|
|
40750
40792
|
unlinkSync21(filePath);
|
|
40751
40793
|
console.log(`Deleted command file: ${filePath}`);
|
|
@@ -40790,18 +40832,18 @@ function registerRun(program2) {
|
|
|
40790
40832
|
}
|
|
40791
40833
|
|
|
40792
40834
|
// src/commands/sessions/nodes/formatLink.ts
|
|
40793
|
-
import
|
|
40835
|
+
import chalk254 from "chalk";
|
|
40794
40836
|
var STATE_COLOURS = {
|
|
40795
|
-
connected:
|
|
40796
|
-
connecting:
|
|
40797
|
-
disconnected:
|
|
40798
|
-
"version-blocked":
|
|
40837
|
+
connected: chalk254.green,
|
|
40838
|
+
connecting: chalk254.yellow,
|
|
40839
|
+
disconnected: chalk254.red,
|
|
40840
|
+
"version-blocked": chalk254.red
|
|
40799
40841
|
};
|
|
40800
40842
|
function formatLink(link3) {
|
|
40801
|
-
const colour = STATE_COLOURS[link3.state] ??
|
|
40843
|
+
const colour = STATE_COLOURS[link3.state] ?? chalk254.white;
|
|
40802
40844
|
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
40803
40845
|
const error = link3.error ? `
|
|
40804
|
-
${
|
|
40846
|
+
${chalk254.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
40805
40847
|
return ` ${link3.name} ${colour(link3.state)} ${link3.url}${peer}${error}`;
|
|
40806
40848
|
}
|
|
40807
40849
|
|
|
@@ -41764,12 +41806,12 @@ import { basename as basename28 } from "path";
|
|
|
41764
41806
|
|
|
41765
41807
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
41766
41808
|
import { existsSync as existsSync86 } from "fs";
|
|
41767
|
-
import { join as
|
|
41809
|
+
import { join as join102 } from "path";
|
|
41768
41810
|
|
|
41769
41811
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
41770
41812
|
import { statSync as statSync15 } from "fs";
|
|
41771
41813
|
import { rm as rm3 } from "fs/promises";
|
|
41772
|
-
import { join as
|
|
41814
|
+
import { join as join101 } from "path";
|
|
41773
41815
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
41774
41816
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
41775
41817
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -41797,7 +41839,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
41797
41839
|
return { removed: true };
|
|
41798
41840
|
}
|
|
41799
41841
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
41800
|
-
return statSync15(
|
|
41842
|
+
return statSync15(join101(worktreePath, ".git"), {
|
|
41801
41843
|
throwIfNoEntry: false
|
|
41802
41844
|
})?.isDirectory() === true;
|
|
41803
41845
|
}
|
|
@@ -41833,7 +41875,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
41833
41875
|
);
|
|
41834
41876
|
}
|
|
41835
41877
|
function strandedReason(worktreePath, cause) {
|
|
41836
|
-
if (!existsSync86(
|
|
41878
|
+
if (!existsSync86(join102(worktreePath, ".git")))
|
|
41837
41879
|
return "its .git link is already gone";
|
|
41838
41880
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
41839
41881
|
return "git no longer recognises it as a working tree";
|
|
@@ -42733,12 +42775,12 @@ import { dirname as dirname42 } from "path";
|
|
|
42733
42775
|
// src/commands/sessions/daemon/worktree/watcherLogPath.ts
|
|
42734
42776
|
import { createHash as createHash4 } from "crypto";
|
|
42735
42777
|
import { homedir as homedir26 } from "os";
|
|
42736
|
-
import { basename as basename29, join as
|
|
42778
|
+
import { basename as basename29, join as join103 } from "path";
|
|
42737
42779
|
function watcherLogPath(cwd) {
|
|
42738
42780
|
const clone = canonicalTreePath(cwd);
|
|
42739
42781
|
const key = createHash4("sha1").update(clone).digest("hex").slice(0, 8);
|
|
42740
|
-
const dir = process.env.ASSIST_WATCHER_LOG_DIR ??
|
|
42741
|
-
return
|
|
42782
|
+
const dir = process.env.ASSIST_WATCHER_LOG_DIR ?? join103(homedir26(), ".assist", "watchers");
|
|
42783
|
+
return join103(dir, `${basename29(clone) || "root"}-${key}.log`);
|
|
42742
42784
|
}
|
|
42743
42785
|
|
|
42744
42786
|
// src/commands/sessions/daemon/worktree/appendWatcherLog.ts
|
|
@@ -46527,7 +46569,7 @@ import { existsSync as existsSync95 } from "fs";
|
|
|
46527
46569
|
|
|
46528
46570
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
46529
46571
|
import { copyFileSync as copyFileSync5, existsSync as existsSync94, mkdirSync as mkdirSync37 } from "fs";
|
|
46530
|
-
import { join as
|
|
46572
|
+
import { join as join105 } from "path";
|
|
46531
46573
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
46532
46574
|
const dir = projectDirForCwd(toCwd);
|
|
46533
46575
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -46536,7 +46578,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
46536
46578
|
);
|
|
46537
46579
|
return;
|
|
46538
46580
|
}
|
|
46539
|
-
const dest =
|
|
46581
|
+
const dest = join105(dir, `${claudeSessionId}.jsonl`);
|
|
46540
46582
|
if (existsSync94(dest)) {
|
|
46541
46583
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
46542
46584
|
return;
|
|
@@ -47606,7 +47648,7 @@ async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
|
47606
47648
|
}
|
|
47607
47649
|
|
|
47608
47650
|
// src/commands/sessions/nodes/printReport.ts
|
|
47609
|
-
import
|
|
47651
|
+
import chalk255 from "chalk";
|
|
47610
47652
|
function printReport(report) {
|
|
47611
47653
|
if (report.links.length === 0) {
|
|
47612
47654
|
console.log(`${report.local} has no links`);
|
|
@@ -47620,11 +47662,11 @@ function printReport(report) {
|
|
|
47620
47662
|
for (const diagnosis of report.links) printDiagnosis(diagnosis);
|
|
47621
47663
|
}
|
|
47622
47664
|
function printDiagnosis(diagnosis) {
|
|
47623
|
-
console.log(`${
|
|
47665
|
+
console.log(`${chalk255.bold(diagnosis.name)} ${chalk255.dim(diagnosis.url)}`);
|
|
47624
47666
|
for (const hop of diagnosis.hops) {
|
|
47625
|
-
const mark = hop.ok ?
|
|
47667
|
+
const mark = hop.ok ? chalk255.green("\u2713") : chalk255.red("\u2717");
|
|
47626
47668
|
console.log(` ${mark} ${hop.hop.padEnd(9)} ${hop.detail ?? hop.error}`);
|
|
47627
|
-
if (hop.remediation) console.log(` ${
|
|
47669
|
+
if (hop.remediation) console.log(` ${chalk255.yellow(hop.remediation)}`);
|
|
47628
47670
|
}
|
|
47629
47671
|
}
|
|
47630
47672
|
|
|
@@ -47644,7 +47686,7 @@ async function doctorNodes(name, options2) {
|
|
|
47644
47686
|
}
|
|
47645
47687
|
|
|
47646
47688
|
// src/commands/sessions/nodes/listNodes.ts
|
|
47647
|
-
import
|
|
47689
|
+
import chalk256 from "chalk";
|
|
47648
47690
|
async function nodesReport() {
|
|
47649
47691
|
const live = await queryNodes();
|
|
47650
47692
|
if (live)
|
|
@@ -47661,10 +47703,10 @@ async function listNodes(options2) {
|
|
|
47661
47703
|
console.log(JSON.stringify(report, null, 2));
|
|
47662
47704
|
return;
|
|
47663
47705
|
}
|
|
47664
|
-
console.log(`${report.local} ${
|
|
47706
|
+
console.log(`${report.local} ${chalk256.dim("(this node)")}`);
|
|
47665
47707
|
if (!report.daemonRunning)
|
|
47666
|
-
console.log(
|
|
47667
|
-
if (report.links.length === 0) console.log(
|
|
47708
|
+
console.log(chalk256.dim(" daemon not running; showing configured links"));
|
|
47709
|
+
if (report.links.length === 0) console.log(chalk256.dim(" no links"));
|
|
47668
47710
|
for (const link3 of report.links) console.log(formatLink(link3));
|
|
47669
47711
|
}
|
|
47670
47712
|
|
|
@@ -47703,14 +47745,14 @@ async function nodeLogs(name, options2) {
|
|
|
47703
47745
|
}
|
|
47704
47746
|
|
|
47705
47747
|
// src/commands/sessions/nodes/linkNode.ts
|
|
47706
|
-
import
|
|
47748
|
+
import chalk259 from "chalk";
|
|
47707
47749
|
|
|
47708
47750
|
// src/commands/sessions/nodes/notifyDaemonLinks.ts
|
|
47709
|
-
import
|
|
47751
|
+
import chalk257 from "chalk";
|
|
47710
47752
|
async function notifyDaemonLinks() {
|
|
47711
47753
|
if (!await isDaemonRunning()) {
|
|
47712
47754
|
console.log(
|
|
47713
|
-
|
|
47755
|
+
chalk257.yellow(
|
|
47714
47756
|
"The sessions daemon is not running; it loads the links when it starts."
|
|
47715
47757
|
)
|
|
47716
47758
|
);
|
|
@@ -47718,11 +47760,11 @@ async function notifyDaemonLinks() {
|
|
|
47718
47760
|
}
|
|
47719
47761
|
try {
|
|
47720
47762
|
await sendToDaemonAwaitAck({ type: "reload-links" });
|
|
47721
|
-
console.log(
|
|
47763
|
+
console.log(chalk257.dim("The sessions daemon reloaded its links."));
|
|
47722
47764
|
} catch (error) {
|
|
47723
47765
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
47724
47766
|
console.log(
|
|
47725
|
-
|
|
47767
|
+
chalk257.yellow(
|
|
47726
47768
|
`Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
|
|
47727
47769
|
)
|
|
47728
47770
|
);
|
|
@@ -47730,7 +47772,7 @@ async function notifyDaemonLinks() {
|
|
|
47730
47772
|
}
|
|
47731
47773
|
|
|
47732
47774
|
// src/commands/sessions/nodes/readLinks.ts
|
|
47733
|
-
import
|
|
47775
|
+
import chalk258 from "chalk";
|
|
47734
47776
|
|
|
47735
47777
|
// src/commands/sessions/nodes/writeLinks.ts
|
|
47736
47778
|
async function writeLinks(links2) {
|
|
@@ -47753,7 +47795,7 @@ async function readLinks() {
|
|
|
47753
47795
|
await writeLinks(links2);
|
|
47754
47796
|
const dropped = stored.filter((link3) => !link3.url).map((link3) => link3.name);
|
|
47755
47797
|
console.log(
|
|
47756
|
-
|
|
47798
|
+
chalk258.yellow(`Removed ${dropped.join(", ")}: ${SSH_LINK_RETIRED}`)
|
|
47757
47799
|
);
|
|
47758
47800
|
return links2;
|
|
47759
47801
|
}
|
|
@@ -47809,7 +47851,7 @@ async function linkNode(name, url, options2) {
|
|
|
47809
47851
|
throw new Error(`${name} is this node; link to a different node`);
|
|
47810
47852
|
const link3 = await buildLink(name, url, options2);
|
|
47811
47853
|
await writeLinks([...others, link3]);
|
|
47812
|
-
console.log(
|
|
47854
|
+
console.log(chalk259.green(`Linked ${name} (${link3.url})`));
|
|
47813
47855
|
await notifyDaemonLinks();
|
|
47814
47856
|
}
|
|
47815
47857
|
|
|
@@ -47824,16 +47866,16 @@ function registerLinkCommand(nodes) {
|
|
|
47824
47866
|
}
|
|
47825
47867
|
|
|
47826
47868
|
// src/commands/sessions/nodes/unlinkNode.ts
|
|
47827
|
-
import
|
|
47869
|
+
import chalk260 from "chalk";
|
|
47828
47870
|
async function unlinkNode(name) {
|
|
47829
47871
|
const links2 = await readLinks();
|
|
47830
47872
|
const remaining = links2.filter((link3) => link3.name !== name);
|
|
47831
47873
|
if (remaining.length === links2.length) {
|
|
47832
|
-
console.log(
|
|
47874
|
+
console.log(chalk260.yellow(`No link named ${name}`));
|
|
47833
47875
|
return;
|
|
47834
47876
|
}
|
|
47835
47877
|
await writeLinks(remaining);
|
|
47836
|
-
console.log(
|
|
47878
|
+
console.log(chalk260.green(`Unlinked ${name}`));
|
|
47837
47879
|
await notifyDaemonLinks();
|
|
47838
47880
|
}
|
|
47839
47881
|
|
|
@@ -47964,7 +48006,7 @@ async function renameSession(title) {
|
|
|
47964
48006
|
|
|
47965
48007
|
// src/commands/sessions/summarise.ts
|
|
47966
48008
|
import * as fs58 from "fs";
|
|
47967
|
-
import
|
|
48009
|
+
import chalk261 from "chalk";
|
|
47968
48010
|
|
|
47969
48011
|
// src/commands/sessions/summarise/shared.ts
|
|
47970
48012
|
import * as fs57 from "fs";
|
|
@@ -48023,22 +48065,22 @@ ${firstMessage}`);
|
|
|
48023
48065
|
async function summarise2(options2) {
|
|
48024
48066
|
const files = await discoverSessionFiles();
|
|
48025
48067
|
if (files.length === 0) {
|
|
48026
|
-
console.log(
|
|
48068
|
+
console.log(chalk261.yellow("No sessions found."));
|
|
48027
48069
|
return;
|
|
48028
48070
|
}
|
|
48029
48071
|
const toProcess = selectCandidates(files, options2);
|
|
48030
48072
|
if (toProcess.length === 0) {
|
|
48031
|
-
console.log(
|
|
48073
|
+
console.log(chalk261.green("All sessions already summarised."));
|
|
48032
48074
|
return;
|
|
48033
48075
|
}
|
|
48034
48076
|
console.log(
|
|
48035
|
-
|
|
48077
|
+
chalk261.cyan(
|
|
48036
48078
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
48037
48079
|
)
|
|
48038
48080
|
);
|
|
48039
48081
|
const { succeeded, failed: failed3 } = processSessions(toProcess);
|
|
48040
48082
|
console.log(
|
|
48041
|
-
|
|
48083
|
+
chalk261.green(`Done: ${succeeded} summarised`) + (failed3 > 0 ? chalk261.yellow(`, ${failed3} skipped`) : "")
|
|
48042
48084
|
);
|
|
48043
48085
|
}
|
|
48044
48086
|
function selectCandidates(files, options2) {
|
|
@@ -48058,16 +48100,16 @@ function processSessions(files) {
|
|
|
48058
48100
|
let failed3 = 0;
|
|
48059
48101
|
for (let i = 0; i < files.length; i++) {
|
|
48060
48102
|
const file = files[i];
|
|
48061
|
-
process.stdout.write(
|
|
48103
|
+
process.stdout.write(chalk261.dim(` [${i + 1}/${files.length}] `));
|
|
48062
48104
|
const summary = summariseSession(file);
|
|
48063
48105
|
if (summary) {
|
|
48064
48106
|
writeSummary(file, summary);
|
|
48065
48107
|
succeeded++;
|
|
48066
|
-
process.stdout.write(`${
|
|
48108
|
+
process.stdout.write(`${chalk261.green("\u2713")} ${summary}
|
|
48067
48109
|
`);
|
|
48068
48110
|
} else {
|
|
48069
48111
|
failed3++;
|
|
48070
|
-
process.stdout.write(` ${
|
|
48112
|
+
process.stdout.write(` ${chalk261.yellow("skip")}
|
|
48071
48113
|
`);
|
|
48072
48114
|
}
|
|
48073
48115
|
}
|
|
@@ -48097,10 +48139,10 @@ function registerSessions(program2) {
|
|
|
48097
48139
|
}
|
|
48098
48140
|
|
|
48099
48141
|
// src/reportCliError.ts
|
|
48100
|
-
import
|
|
48142
|
+
import chalk262 from "chalk";
|
|
48101
48143
|
function reportCliError(error) {
|
|
48102
48144
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
48103
|
-
console.error(
|
|
48145
|
+
console.error(chalk262.red(error.message));
|
|
48104
48146
|
} else {
|
|
48105
48147
|
console.error(error);
|
|
48106
48148
|
}
|