@staff0rd/assist 0.768.4 → 0.770.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 +12 -3
- package/claude/commands/extension.md +19 -0
- package/dist/commands/sessions/web/bundle.js +444 -444
- package/dist/index.js +659 -627
- 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.770.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -21108,18 +21108,46 @@ async function criteriaExtension() {
|
|
|
21108
21108
|
console.log(chalk137.dim(`load the unpacked extension from ${path106}`));
|
|
21109
21109
|
}
|
|
21110
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
|
+
|
|
21111
21139
|
// src/commands/criteriaExtension/signCriteriaExtension.ts
|
|
21112
21140
|
import { rm as rm2 } from "fs/promises";
|
|
21113
21141
|
import { homedir as homedir20, tmpdir as tmpdir3 } from "os";
|
|
21114
|
-
import { join as
|
|
21115
|
-
import
|
|
21142
|
+
import { join as join55 } from "path";
|
|
21143
|
+
import chalk140 from "chalk";
|
|
21116
21144
|
|
|
21117
21145
|
// src/commands/criteriaExtension/copySignedXpi.ts
|
|
21118
21146
|
import { copyFile } from "fs/promises";
|
|
21119
|
-
import { join as
|
|
21147
|
+
import { join as join50 } from "path";
|
|
21120
21148
|
var SIGNED_XPI_NAME = "criteria-extension.xpi";
|
|
21121
21149
|
async function copySignedXpi(xpi, dir) {
|
|
21122
|
-
const fixed2 =
|
|
21150
|
+
const fixed2 = join50(dir, SIGNED_XPI_NAME);
|
|
21123
21151
|
if (fixed2 === xpi) return fixed2;
|
|
21124
21152
|
await copyFile(xpi, fixed2);
|
|
21125
21153
|
return fixed2;
|
|
@@ -21128,16 +21156,16 @@ async function copySignedXpi(xpi, dir) {
|
|
|
21128
21156
|
// src/commands/criteriaExtension/findSignedXpi.ts
|
|
21129
21157
|
import { existsSync as existsSync47 } from "fs";
|
|
21130
21158
|
import { readdir } from "fs/promises";
|
|
21131
|
-
import { join as
|
|
21159
|
+
import { join as join51 } from "path";
|
|
21132
21160
|
async function findSignedXpi(dir) {
|
|
21133
21161
|
if (!existsSync47(dir)) return null;
|
|
21134
21162
|
const name = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
|
|
21135
|
-
return name ?
|
|
21163
|
+
return name ? join51(dir, name) : null;
|
|
21136
21164
|
}
|
|
21137
21165
|
|
|
21138
21166
|
// src/commands/criteriaExtension/signedAddonInstallPath.ts
|
|
21139
21167
|
import { cp as cp2 } from "fs/promises";
|
|
21140
|
-
import
|
|
21168
|
+
import chalk139 from "chalk";
|
|
21141
21169
|
var WSL_WINDOWS_XPI = "/mnt/c/tools/criteria-extension.xpi";
|
|
21142
21170
|
var WSL_WINDOWS_PATH2 = String.raw`C:\tools\criteria-extension.xpi`;
|
|
21143
21171
|
async function signedAddonInstallPath(xpi) {
|
|
@@ -21147,7 +21175,7 @@ async function signedAddonInstallPath(xpi) {
|
|
|
21147
21175
|
return WSL_WINDOWS_PATH2;
|
|
21148
21176
|
} catch {
|
|
21149
21177
|
console.log(
|
|
21150
|
-
|
|
21178
|
+
chalk139.yellow(`could not copy the add-on to ${WSL_WINDOWS_PATH2}`)
|
|
21151
21179
|
);
|
|
21152
21180
|
return xpi;
|
|
21153
21181
|
}
|
|
@@ -21155,10 +21183,10 @@ async function signedAddonInstallPath(xpi) {
|
|
|
21155
21183
|
|
|
21156
21184
|
// src/commands/criteriaExtension/signPreflightProblem.ts
|
|
21157
21185
|
import { existsSync as existsSync48 } from "fs";
|
|
21158
|
-
import { join as
|
|
21186
|
+
import { join as join52 } from "path";
|
|
21159
21187
|
var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
|
|
21160
21188
|
function signPreflightProblem(source) {
|
|
21161
|
-
if (!existsSync48(
|
|
21189
|
+
if (!existsSync48(join52(source, "content.js")))
|
|
21162
21190
|
return {
|
|
21163
21191
|
message: `no content.js in ${source}`,
|
|
21164
21192
|
hint: "run npm run build to bundle the content script"
|
|
@@ -21172,8 +21200,8 @@ function signPreflightProblem(source) {
|
|
|
21172
21200
|
}
|
|
21173
21201
|
|
|
21174
21202
|
// src/commands/criteriaExtension/stageCriteriaExtension.ts
|
|
21175
|
-
import { cp as cp3, mkdir as mkdir5, readFile as
|
|
21176
|
-
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";
|
|
21177
21205
|
|
|
21178
21206
|
// src/commands/criteriaExtension/stampManifestVersion.ts
|
|
21179
21207
|
function stampManifestVersion(manifest, version2) {
|
|
@@ -21190,17 +21218,17 @@ async function stageCriteriaExtension(source, staging, version2) {
|
|
|
21190
21218
|
recursive: true,
|
|
21191
21219
|
filter: (path106) => basename13(path106) !== "updates.json"
|
|
21192
21220
|
});
|
|
21193
|
-
const manifest =
|
|
21221
|
+
const manifest = join53(staging, "manifest.json");
|
|
21194
21222
|
const stamped = stampManifestVersion(
|
|
21195
|
-
await
|
|
21223
|
+
await readFile5(manifest, "utf8"),
|
|
21196
21224
|
version2
|
|
21197
21225
|
);
|
|
21198
21226
|
await writeFile4(manifest, stamped);
|
|
21199
21227
|
}
|
|
21200
21228
|
|
|
21201
21229
|
// src/commands/criteriaExtension/writeUpdateManifest.ts
|
|
21202
|
-
import { readFile as
|
|
21203
|
-
import { join as
|
|
21230
|
+
import { readFile as readFile6, writeFile as writeFile5 } from "fs/promises";
|
|
21231
|
+
import { join as join54 } from "path";
|
|
21204
21232
|
|
|
21205
21233
|
// src/commands/criteriaExtension/buildUpdateManifest.ts
|
|
21206
21234
|
var RELEASE_DOWNLOAD_URL = "https://github.com/staff0rd/assist/releases/download";
|
|
@@ -21225,30 +21253,30 @@ function buildUpdateManifest(manifest, version2) {
|
|
|
21225
21253
|
// src/commands/criteriaExtension/writeUpdateManifest.ts
|
|
21226
21254
|
async function writeUpdateManifest(source, dir, version2) {
|
|
21227
21255
|
await writeFile5(
|
|
21228
|
-
|
|
21256
|
+
join54(dir, "updates.json"),
|
|
21229
21257
|
buildUpdateManifest(
|
|
21230
|
-
await
|
|
21258
|
+
await readFile6(join54(source, "manifest.json"), "utf8"),
|
|
21231
21259
|
version2
|
|
21232
21260
|
)
|
|
21233
21261
|
);
|
|
21234
21262
|
}
|
|
21235
21263
|
|
|
21236
21264
|
// src/commands/criteriaExtension/signCriteriaExtension.ts
|
|
21237
|
-
var ARTIFACTS_DIR =
|
|
21238
|
-
var STAGING_DIR =
|
|
21265
|
+
var ARTIFACTS_DIR = join55(homedir20(), ".assist", "criteria-extension");
|
|
21266
|
+
var STAGING_DIR = join55(tmpdir3(), "assist-criteria-extension");
|
|
21239
21267
|
async function signCriteriaExtension() {
|
|
21240
21268
|
const source = criteriaExtensionDir();
|
|
21241
21269
|
const problem = signPreflightProblem(source);
|
|
21242
21270
|
if (problem) {
|
|
21243
|
-
console.log(
|
|
21244
|
-
console.log(
|
|
21271
|
+
console.log(chalk140.red(problem.message));
|
|
21272
|
+
console.log(chalk140.dim(problem.hint));
|
|
21245
21273
|
process.exitCode = 1;
|
|
21246
21274
|
return;
|
|
21247
21275
|
}
|
|
21248
21276
|
const { version: version2 } = package_default;
|
|
21249
21277
|
await stageCriteriaExtension(source, STAGING_DIR, version2);
|
|
21250
21278
|
await rm2(ARTIFACTS_DIR, { recursive: true, force: true });
|
|
21251
|
-
console.log(
|
|
21279
|
+
console.log(chalk140.bold(`signing version ${version2} for self-distribution`));
|
|
21252
21280
|
const { done: done2 } = spawnInherit("npx", [
|
|
21253
21281
|
"--yes",
|
|
21254
21282
|
"web-ext",
|
|
@@ -21258,13 +21286,13 @@ async function signCriteriaExtension() {
|
|
|
21258
21286
|
"--channel=unlisted"
|
|
21259
21287
|
]);
|
|
21260
21288
|
if (await done2 !== 0) {
|
|
21261
|
-
console.log(
|
|
21289
|
+
console.log(chalk140.red("web-ext sign failed"));
|
|
21262
21290
|
process.exitCode = 1;
|
|
21263
21291
|
return;
|
|
21264
21292
|
}
|
|
21265
21293
|
const xpi = await findSignedXpi(ARTIFACTS_DIR);
|
|
21266
21294
|
if (!xpi) {
|
|
21267
|
-
console.log(
|
|
21295
|
+
console.log(chalk140.red(`web-ext wrote no .xpi into ${ARTIFACTS_DIR}`));
|
|
21268
21296
|
process.exitCode = 1;
|
|
21269
21297
|
return;
|
|
21270
21298
|
}
|
|
@@ -21272,7 +21300,7 @@ async function signCriteriaExtension() {
|
|
|
21272
21300
|
const path106 = await signedAddonInstallPath(
|
|
21273
21301
|
await copySignedXpi(xpi, ARTIFACTS_DIR)
|
|
21274
21302
|
);
|
|
21275
|
-
console.log(
|
|
21303
|
+
console.log(chalk140.dim(`install the signed add-on from ${path106}`));
|
|
21276
21304
|
}
|
|
21277
21305
|
|
|
21278
21306
|
// src/commands/registerCriteriaExtension.ts
|
|
@@ -21282,9 +21310,13 @@ function registerCriteriaExtension(program2) {
|
|
|
21282
21310
|
).option(
|
|
21283
21311
|
"--sign",
|
|
21284
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)"
|
|
21285
|
-
).
|
|
21286
|
-
|
|
21287
|
-
|
|
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
|
+
});
|
|
21288
21320
|
}
|
|
21289
21321
|
|
|
21290
21322
|
// src/shared/db/retired/findRetiredTables.ts
|
|
@@ -21329,11 +21361,11 @@ async function dropRetiredTables(exec3) {
|
|
|
21329
21361
|
}
|
|
21330
21362
|
|
|
21331
21363
|
// src/commands/db/reportRetiredTables.ts
|
|
21332
|
-
import
|
|
21364
|
+
import chalk141 from "chalk";
|
|
21333
21365
|
function reportRetiredTables(tables) {
|
|
21334
21366
|
for (const table of tables) {
|
|
21335
21367
|
console.error(
|
|
21336
|
-
|
|
21368
|
+
chalk141.yellow(
|
|
21337
21369
|
`Retired table ${table.name} still exists (${table.rows} rows). Run \`assist db drop-retired\` to drop it.`
|
|
21338
21370
|
)
|
|
21339
21371
|
);
|
|
@@ -21341,40 +21373,40 @@ function reportRetiredTables(tables) {
|
|
|
21341
21373
|
}
|
|
21342
21374
|
|
|
21343
21375
|
// src/commands/db/reportMigrationStatus.ts
|
|
21344
|
-
import
|
|
21376
|
+
import chalk142 from "chalk";
|
|
21345
21377
|
function reportApplied(applied) {
|
|
21346
21378
|
if (applied.length === 0) {
|
|
21347
|
-
console.error(
|
|
21379
|
+
console.error(chalk142.green("Database is up to date; nothing to apply."));
|
|
21348
21380
|
return;
|
|
21349
21381
|
}
|
|
21350
21382
|
for (const migration of applied) {
|
|
21351
21383
|
console.error(
|
|
21352
|
-
|
|
21384
|
+
chalk142.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
21353
21385
|
);
|
|
21354
21386
|
}
|
|
21355
21387
|
}
|
|
21356
21388
|
function reportMigrationStatus(status2) {
|
|
21357
21389
|
if (status2.state === "in-sync") {
|
|
21358
21390
|
console.error(
|
|
21359
|
-
|
|
21391
|
+
chalk142.green(`In sync at migration ${status2.version} (latest).`)
|
|
21360
21392
|
);
|
|
21361
21393
|
return;
|
|
21362
21394
|
}
|
|
21363
21395
|
if (status2.state === "behind") {
|
|
21364
21396
|
console.error(
|
|
21365
|
-
|
|
21397
|
+
chalk142.yellow(
|
|
21366
21398
|
`Behind: applied ${status2.applied}, build expects ${status2.expected}.`
|
|
21367
21399
|
)
|
|
21368
21400
|
);
|
|
21369
21401
|
console.error(
|
|
21370
|
-
|
|
21402
|
+
chalk142.yellow(
|
|
21371
21403
|
`Pending: ${status2.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
21372
21404
|
)
|
|
21373
21405
|
);
|
|
21374
21406
|
return;
|
|
21375
21407
|
}
|
|
21376
21408
|
console.error(
|
|
21377
|
-
|
|
21409
|
+
chalk142.red(
|
|
21378
21410
|
`Ahead: applied ${status2.applied}, build knows ${status2.expected}. Update assist.`
|
|
21379
21411
|
)
|
|
21380
21412
|
);
|
|
@@ -21416,15 +21448,15 @@ function registerDb(program2) {
|
|
|
21416
21448
|
|
|
21417
21449
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
21418
21450
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs";
|
|
21419
|
-
import
|
|
21451
|
+
import chalk143 from "chalk";
|
|
21420
21452
|
|
|
21421
21453
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
21422
|
-
import { join as
|
|
21454
|
+
import { join as join56 } from "path";
|
|
21423
21455
|
function getMigrationPinPath(pin2) {
|
|
21424
|
-
return
|
|
21456
|
+
return join56(getRestrictedDir(), `db-migration-pin-${pin2}.json`);
|
|
21425
21457
|
}
|
|
21426
21458
|
function getMigrationApprovalPath(migrationId) {
|
|
21427
|
-
return
|
|
21459
|
+
return join56(getRestrictedDir(), `db-migration-approval-${migrationId}.json`);
|
|
21428
21460
|
}
|
|
21429
21461
|
|
|
21430
21462
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
@@ -21447,7 +21479,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
21447
21479
|
sweepRestrictedDir();
|
|
21448
21480
|
const state = readMigrationPinState(pin2);
|
|
21449
21481
|
if (!state) {
|
|
21450
|
-
console.error(
|
|
21482
|
+
console.error(chalk143.red(`No pending migration unlock for pin: ${pin2}`));
|
|
21451
21483
|
process.exitCode = 1;
|
|
21452
21484
|
return;
|
|
21453
21485
|
}
|
|
@@ -21457,7 +21489,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
21457
21489
|
);
|
|
21458
21490
|
unlinkSync9(getMigrationPinPath(pin2));
|
|
21459
21491
|
console.log(
|
|
21460
|
-
|
|
21492
|
+
chalk143.green(
|
|
21461
21493
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
21462
21494
|
)
|
|
21463
21495
|
);
|
|
@@ -21466,7 +21498,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
21466
21498
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
21467
21499
|
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync27 } from "fs";
|
|
21468
21500
|
import { randomInt as randomInt2 } from "crypto";
|
|
21469
|
-
import
|
|
21501
|
+
import chalk144 from "chalk";
|
|
21470
21502
|
|
|
21471
21503
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
21472
21504
|
function nextMigrationId() {
|
|
@@ -21481,7 +21513,7 @@ function dbMigrationUnlock() {
|
|
|
21481
21513
|
sweepRestrictedDir();
|
|
21482
21514
|
writeFileSync27(getMigrationPinPath(pin2), JSON.stringify({ pin: pin2, migrationId }));
|
|
21483
21515
|
console.error(
|
|
21484
|
-
|
|
21516
|
+
chalk144.yellow.bold(
|
|
21485
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."
|
|
21486
21518
|
)
|
|
21487
21519
|
);
|
|
@@ -21491,7 +21523,7 @@ function dbMigrationUnlock() {
|
|
|
21491
21523
|
});
|
|
21492
21524
|
if (!delivered) {
|
|
21493
21525
|
console.error(
|
|
21494
|
-
|
|
21526
|
+
chalk144.red(
|
|
21495
21527
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
21496
21528
|
)
|
|
21497
21529
|
);
|
|
@@ -21501,7 +21533,7 @@ function dbMigrationUnlock() {
|
|
|
21501
21533
|
console.log(
|
|
21502
21534
|
`A confirmation pin was sent to your desktop notifications.
|
|
21503
21535
|
To approve creating migration ${migrationId}, run:
|
|
21504
|
-
${
|
|
21536
|
+
${chalk144.cyan(" assist db-migration confirm <PIN>")}
|
|
21505
21537
|
using the pin from that notification.`
|
|
21506
21538
|
);
|
|
21507
21539
|
}
|
|
@@ -21521,7 +21553,7 @@ function registerDbMigration(parent) {
|
|
|
21521
21553
|
|
|
21522
21554
|
// src/commands/deploy/redirect.ts
|
|
21523
21555
|
import { existsSync as existsSync50, readFileSync as readFileSync32, writeFileSync as writeFileSync28 } from "fs";
|
|
21524
|
-
import
|
|
21556
|
+
import chalk145 from "chalk";
|
|
21525
21557
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
21526
21558
|
if (!window.location.pathname.endsWith('/')) {
|
|
21527
21559
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -21530,23 +21562,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
21530
21562
|
function redirect() {
|
|
21531
21563
|
const indexPath = "index.html";
|
|
21532
21564
|
if (!existsSync50(indexPath)) {
|
|
21533
|
-
console.log(
|
|
21565
|
+
console.log(chalk145.yellow("No index.html found"));
|
|
21534
21566
|
return;
|
|
21535
21567
|
}
|
|
21536
21568
|
const content = readFileSync32(indexPath, "utf8");
|
|
21537
21569
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
21538
|
-
console.log(
|
|
21570
|
+
console.log(chalk145.dim("Trailing slash script already present"));
|
|
21539
21571
|
return;
|
|
21540
21572
|
}
|
|
21541
21573
|
const headCloseIndex = content.indexOf("</head>");
|
|
21542
21574
|
if (headCloseIndex === -1) {
|
|
21543
|
-
console.log(
|
|
21575
|
+
console.log(chalk145.red("Could not find </head> tag in index.html"));
|
|
21544
21576
|
return;
|
|
21545
21577
|
}
|
|
21546
21578
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
21547
21579
|
${content.slice(headCloseIndex)}`;
|
|
21548
21580
|
writeFileSync28(indexPath, newContent);
|
|
21549
|
-
console.log(
|
|
21581
|
+
console.log(chalk145.green("Added trailing slash redirect to index.html"));
|
|
21550
21582
|
}
|
|
21551
21583
|
|
|
21552
21584
|
// src/commands/registerDeploy.ts
|
|
@@ -21562,10 +21594,10 @@ import { basename as basename15 } from "path";
|
|
|
21562
21594
|
|
|
21563
21595
|
// src/commands/devlog/loadBlogSkipDays.ts
|
|
21564
21596
|
import { homedir as homedir21 } from "os";
|
|
21565
|
-
import { join as
|
|
21566
|
-
var BLOG_REPO_ROOT =
|
|
21597
|
+
import { join as join57 } from "path";
|
|
21598
|
+
var BLOG_REPO_ROOT = join57(homedir21(), "git/blog");
|
|
21567
21599
|
function loadBlogSkipDays(repoName) {
|
|
21568
|
-
const config = loadRawYaml(
|
|
21600
|
+
const config = loadRawYaml(join57(BLOG_REPO_ROOT, "assist.yml"));
|
|
21569
21601
|
const devlog = config.devlog;
|
|
21570
21602
|
const skip2 = devlog?.skip;
|
|
21571
21603
|
return new Set(skip2?.[repoName]);
|
|
@@ -21573,17 +21605,17 @@ function loadBlogSkipDays(repoName) {
|
|
|
21573
21605
|
|
|
21574
21606
|
// src/commands/devlog/shared.ts
|
|
21575
21607
|
import { execSync as execSync31 } from "child_process";
|
|
21576
|
-
import
|
|
21608
|
+
import chalk146 from "chalk";
|
|
21577
21609
|
|
|
21578
21610
|
// src/shared/getRepoName.ts
|
|
21579
21611
|
import { existsSync as existsSync51, readFileSync as readFileSync33 } from "fs";
|
|
21580
|
-
import { basename as basename14, join as
|
|
21612
|
+
import { basename as basename14, join as join58 } from "path";
|
|
21581
21613
|
function getRepoName() {
|
|
21582
21614
|
const config = loadConfig();
|
|
21583
21615
|
if (config.devlog?.name) {
|
|
21584
21616
|
return config.devlog.name;
|
|
21585
21617
|
}
|
|
21586
|
-
const packageJsonPath =
|
|
21618
|
+
const packageJsonPath = join58(process.cwd(), "package.json");
|
|
21587
21619
|
if (existsSync51(packageJsonPath)) {
|
|
21588
21620
|
try {
|
|
21589
21621
|
const content = readFileSync33(packageJsonPath, "utf8");
|
|
@@ -21599,8 +21631,8 @@ function getRepoName() {
|
|
|
21599
21631
|
|
|
21600
21632
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
21601
21633
|
import { readdirSync as readdirSync7, readFileSync as readFileSync34 } from "fs";
|
|
21602
|
-
import { join as
|
|
21603
|
-
var DEVLOG_DIR =
|
|
21634
|
+
import { join as join59 } from "path";
|
|
21635
|
+
var DEVLOG_DIR = join59(BLOG_REPO_ROOT, "src/content/devlog");
|
|
21604
21636
|
function extractFrontmatter(content) {
|
|
21605
21637
|
const fm = content.match(/^---\n([\s\S]*?)\n---/);
|
|
21606
21638
|
return fm?.[1] ?? null;
|
|
@@ -21628,7 +21660,7 @@ function readDevlogFiles(callback) {
|
|
|
21628
21660
|
try {
|
|
21629
21661
|
const files = readdirSync7(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
21630
21662
|
for (const file of files) {
|
|
21631
|
-
const content = readFileSync34(
|
|
21663
|
+
const content = readFileSync34(join59(DEVLOG_DIR, file), "utf8");
|
|
21632
21664
|
const parsed = parseFrontmatter(content, file);
|
|
21633
21665
|
if (parsed) callback(parsed);
|
|
21634
21666
|
}
|
|
@@ -21682,13 +21714,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
21682
21714
|
}
|
|
21683
21715
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
21684
21716
|
for (const commit2 of commits2) {
|
|
21685
|
-
console.log(` ${
|
|
21717
|
+
console.log(` ${chalk146.yellow(commit2.hash)} ${commit2.message}`);
|
|
21686
21718
|
if (verbose) {
|
|
21687
21719
|
const visibleFiles = commit2.files.filter(
|
|
21688
21720
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
21689
21721
|
);
|
|
21690
21722
|
for (const file of visibleFiles) {
|
|
21691
|
-
console.log(` ${
|
|
21723
|
+
console.log(` ${chalk146.dim(file)}`);
|
|
21692
21724
|
}
|
|
21693
21725
|
}
|
|
21694
21726
|
}
|
|
@@ -21713,15 +21745,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
21713
21745
|
}
|
|
21714
21746
|
|
|
21715
21747
|
// src/commands/devlog/list/printDateHeader.ts
|
|
21716
|
-
import
|
|
21748
|
+
import chalk147 from "chalk";
|
|
21717
21749
|
function printDateHeader(date, isSkipped, entries) {
|
|
21718
21750
|
if (isSkipped) {
|
|
21719
|
-
console.log(`${
|
|
21751
|
+
console.log(`${chalk147.bold.blue(date)} ${chalk147.dim("skipped")}`);
|
|
21720
21752
|
} else if (entries && entries.length > 0) {
|
|
21721
|
-
const entryInfo = entries.map((e) => `${
|
|
21722
|
-
console.log(`${
|
|
21753
|
+
const entryInfo = entries.map((e) => `${chalk147.green(e.version)} ${e.title}`).join(" | ");
|
|
21754
|
+
console.log(`${chalk147.bold.blue(date)} ${entryInfo}`);
|
|
21723
21755
|
} else {
|
|
21724
|
-
console.log(`${
|
|
21756
|
+
console.log(`${chalk147.bold.blue(date)} ${chalk147.red("\u26A0 devlog missing")}`);
|
|
21725
21757
|
}
|
|
21726
21758
|
}
|
|
21727
21759
|
|
|
@@ -21825,24 +21857,24 @@ function bumpVersion(version2, type) {
|
|
|
21825
21857
|
|
|
21826
21858
|
// src/commands/devlog/next/displayNextEntry.ts
|
|
21827
21859
|
import { execFileSync as execFileSync7 } from "child_process";
|
|
21828
|
-
import
|
|
21860
|
+
import chalk149 from "chalk";
|
|
21829
21861
|
|
|
21830
21862
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
21831
|
-
import
|
|
21863
|
+
import chalk148 from "chalk";
|
|
21832
21864
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
21833
21865
|
if (conventional && firstHash) {
|
|
21834
21866
|
const version2 = getVersionAtCommit(firstHash);
|
|
21835
21867
|
if (version2) {
|
|
21836
|
-
console.log(`${
|
|
21868
|
+
console.log(`${chalk148.bold("version:")} ${stripToMinor(version2)}`);
|
|
21837
21869
|
} else {
|
|
21838
|
-
console.log(`${
|
|
21870
|
+
console.log(`${chalk148.bold("version:")} ${chalk148.red("unknown")}`);
|
|
21839
21871
|
}
|
|
21840
21872
|
} else if (patchVersion && minorVersion) {
|
|
21841
21873
|
console.log(
|
|
21842
|
-
`${
|
|
21874
|
+
`${chalk148.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
21843
21875
|
);
|
|
21844
21876
|
} else {
|
|
21845
|
-
console.log(`${
|
|
21877
|
+
console.log(`${chalk148.bold("version:")} v0.1 (initial)`);
|
|
21846
21878
|
}
|
|
21847
21879
|
}
|
|
21848
21880
|
|
|
@@ -21890,16 +21922,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
21890
21922
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
21891
21923
|
}
|
|
21892
21924
|
function logName(repoName) {
|
|
21893
|
-
console.log(`${
|
|
21925
|
+
console.log(`${chalk149.bold("name:")} ${repoName}`);
|
|
21894
21926
|
}
|
|
21895
21927
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
21896
21928
|
logName(ctx.repoName);
|
|
21897
21929
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
21898
|
-
console.log(
|
|
21930
|
+
console.log(chalk149.bold.blue(targetDate));
|
|
21899
21931
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
21900
21932
|
}
|
|
21901
21933
|
function logNoCommits(lastInfo) {
|
|
21902
|
-
console.log(
|
|
21934
|
+
console.log(chalk149.dim(noCommitsMessage(!!lastInfo)));
|
|
21903
21935
|
}
|
|
21904
21936
|
|
|
21905
21937
|
// src/commands/devlog/next.ts
|
|
@@ -21940,11 +21972,11 @@ function next2(options2) {
|
|
|
21940
21972
|
import { execSync as execSync33 } from "child_process";
|
|
21941
21973
|
|
|
21942
21974
|
// src/commands/devlog/repos/printReposTable.ts
|
|
21943
|
-
import
|
|
21975
|
+
import chalk150 from "chalk";
|
|
21944
21976
|
function colorStatus(status2) {
|
|
21945
|
-
if (status2 === "missing") return
|
|
21946
|
-
if (status2 === "outdated") return
|
|
21947
|
-
return
|
|
21977
|
+
if (status2 === "missing") return chalk150.red(status2);
|
|
21978
|
+
if (status2 === "outdated") return chalk150.yellow(status2);
|
|
21979
|
+
return chalk150.green(status2);
|
|
21948
21980
|
}
|
|
21949
21981
|
function formatRow(row, nameWidth) {
|
|
21950
21982
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -21958,8 +21990,8 @@ function printReposTable(rows) {
|
|
|
21958
21990
|
"Last Devlog".padEnd(11),
|
|
21959
21991
|
"Status"
|
|
21960
21992
|
].join(" ");
|
|
21961
|
-
console.log(
|
|
21962
|
-
console.log(
|
|
21993
|
+
console.log(chalk150.dim(header));
|
|
21994
|
+
console.log(chalk150.dim("-".repeat(header.length)));
|
|
21963
21995
|
for (const row of rows) {
|
|
21964
21996
|
console.log(formatRow(row, nameWidth));
|
|
21965
21997
|
}
|
|
@@ -22016,15 +22048,15 @@ function repos(options2) {
|
|
|
22016
22048
|
|
|
22017
22049
|
// src/commands/devlog/skip.ts
|
|
22018
22050
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
22019
|
-
import { join as
|
|
22020
|
-
import
|
|
22051
|
+
import { join as join60 } from "path";
|
|
22052
|
+
import chalk151 from "chalk";
|
|
22021
22053
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
22022
22054
|
function getBlogConfigPath() {
|
|
22023
|
-
return
|
|
22055
|
+
return join60(BLOG_REPO_ROOT, "assist.yml");
|
|
22024
22056
|
}
|
|
22025
22057
|
function skip(date) {
|
|
22026
22058
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
22027
|
-
console.log(
|
|
22059
|
+
console.log(chalk151.red("Invalid date format. Use YYYY-MM-DD"));
|
|
22028
22060
|
process.exit(1);
|
|
22029
22061
|
}
|
|
22030
22062
|
const repoName = getRepoName();
|
|
@@ -22035,7 +22067,7 @@ function skip(date) {
|
|
|
22035
22067
|
const skipDays = skip2[repoName] ?? [];
|
|
22036
22068
|
if (skipDays.includes(date)) {
|
|
22037
22069
|
console.log(
|
|
22038
|
-
|
|
22070
|
+
chalk151.yellow(`${date} is already in skip list for ${repoName}`)
|
|
22039
22071
|
);
|
|
22040
22072
|
return;
|
|
22041
22073
|
}
|
|
@@ -22045,20 +22077,20 @@ function skip(date) {
|
|
|
22045
22077
|
devlog.skip = skip2;
|
|
22046
22078
|
config.devlog = devlog;
|
|
22047
22079
|
writeFileSync29(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
22048
|
-
console.log(
|
|
22080
|
+
console.log(chalk151.green(`Added ${date} to skip list for ${repoName}`));
|
|
22049
22081
|
}
|
|
22050
22082
|
|
|
22051
22083
|
// src/commands/devlog/version.ts
|
|
22052
|
-
import
|
|
22084
|
+
import chalk152 from "chalk";
|
|
22053
22085
|
function version() {
|
|
22054
22086
|
const config = loadConfig();
|
|
22055
22087
|
const name = getRepoName();
|
|
22056
22088
|
const lastInfo = getLastVersionInfo(name, config);
|
|
22057
22089
|
const lastVersion = lastInfo?.version ?? null;
|
|
22058
22090
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
22059
|
-
console.log(`${
|
|
22060
|
-
console.log(`${
|
|
22061
|
-
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")}`);
|
|
22062
22094
|
}
|
|
22063
22095
|
|
|
22064
22096
|
// src/commands/registerDevlog.ts
|
|
@@ -22082,8 +22114,8 @@ function registerDevlog(program2) {
|
|
|
22082
22114
|
|
|
22083
22115
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
22084
22116
|
import { closeSync as closeSync4, openSync as openSync5, readdirSync as readdirSync8 } from "fs";
|
|
22085
|
-
import { join as
|
|
22086
|
-
import
|
|
22117
|
+
import { join as join61 } from "path";
|
|
22118
|
+
import chalk153 from "chalk";
|
|
22087
22119
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
22088
22120
|
function isLockedDll(debugDir) {
|
|
22089
22121
|
let files;
|
|
@@ -22094,7 +22126,7 @@ function isLockedDll(debugDir) {
|
|
|
22094
22126
|
}
|
|
22095
22127
|
for (const file of files) {
|
|
22096
22128
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
22097
|
-
const dllPath =
|
|
22129
|
+
const dllPath = join61(debugDir, file);
|
|
22098
22130
|
try {
|
|
22099
22131
|
const fd = openSync5(dllPath, "r+");
|
|
22100
22132
|
closeSync4(fd);
|
|
@@ -22112,13 +22144,13 @@ function findFirstLockedDll(dir) {
|
|
|
22112
22144
|
return null;
|
|
22113
22145
|
}
|
|
22114
22146
|
if (entries.includes("bin")) {
|
|
22115
|
-
const locked = isLockedDll(
|
|
22147
|
+
const locked = isLockedDll(join61(dir, "bin", "Debug"));
|
|
22116
22148
|
if (locked) return locked;
|
|
22117
22149
|
}
|
|
22118
22150
|
for (const entry of entries) {
|
|
22119
22151
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
22120
22152
|
continue;
|
|
22121
|
-
const found = findFirstLockedDll(
|
|
22153
|
+
const found = findFirstLockedDll(join61(dir, entry));
|
|
22122
22154
|
if (found) return found;
|
|
22123
22155
|
}
|
|
22124
22156
|
return null;
|
|
@@ -22130,14 +22162,14 @@ function checkBuildLocks(startDir) {
|
|
|
22130
22162
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
22131
22163
|
if (locked) {
|
|
22132
22164
|
console.error(
|
|
22133
|
-
|
|
22165
|
+
chalk153.red("Build output locked (is VS debugging?): ") + locked
|
|
22134
22166
|
);
|
|
22135
22167
|
process.exit(1);
|
|
22136
22168
|
}
|
|
22137
22169
|
}
|
|
22138
22170
|
async function checkBuildLocksCommand() {
|
|
22139
22171
|
checkBuildLocks();
|
|
22140
|
-
console.log(
|
|
22172
|
+
console.log(chalk153.green("No build locks detected"));
|
|
22141
22173
|
}
|
|
22142
22174
|
|
|
22143
22175
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -22236,30 +22268,30 @@ function escapeRegex(s) {
|
|
|
22236
22268
|
}
|
|
22237
22269
|
|
|
22238
22270
|
// src/commands/dotnet/printTree.ts
|
|
22239
|
-
import
|
|
22271
|
+
import chalk154 from "chalk";
|
|
22240
22272
|
function printNodes(nodes, prefix2) {
|
|
22241
22273
|
for (let i = 0; i < nodes.length; i++) {
|
|
22242
22274
|
const isLast = i === nodes.length - 1;
|
|
22243
22275
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
22244
22276
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
22245
22277
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
22246
|
-
const label2 = isMissing ?
|
|
22278
|
+
const label2 = isMissing ? chalk154.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
22247
22279
|
console.log(`${prefix2}${connector}${label2}`);
|
|
22248
22280
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
22249
22281
|
}
|
|
22250
22282
|
}
|
|
22251
22283
|
function printTree(tree, totalCount, solutions) {
|
|
22252
|
-
console.log(
|
|
22253
|
-
console.log(
|
|
22284
|
+
console.log(chalk154.bold("\nProject Dependency Tree"));
|
|
22285
|
+
console.log(chalk154.cyan(tree.relativePath));
|
|
22254
22286
|
printNodes(tree.children, "");
|
|
22255
|
-
console.log(
|
|
22287
|
+
console.log(chalk154.dim(`
|
|
22256
22288
|
${totalCount} projects total (including root)`));
|
|
22257
|
-
console.log(
|
|
22289
|
+
console.log(chalk154.bold("\nSolution Membership"));
|
|
22258
22290
|
if (solutions.length === 0) {
|
|
22259
|
-
console.log(
|
|
22291
|
+
console.log(chalk154.yellow(" Not found in any .sln"));
|
|
22260
22292
|
} else {
|
|
22261
22293
|
for (const sln of solutions) {
|
|
22262
|
-
console.log(` ${
|
|
22294
|
+
console.log(` ${chalk154.green(sln)}`);
|
|
22263
22295
|
}
|
|
22264
22296
|
}
|
|
22265
22297
|
console.log();
|
|
@@ -22288,16 +22320,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
22288
22320
|
// src/commands/dotnet/resolveCsproj.ts
|
|
22289
22321
|
import { existsSync as existsSync52 } from "fs";
|
|
22290
22322
|
import path36 from "path";
|
|
22291
|
-
import
|
|
22323
|
+
import chalk155 from "chalk";
|
|
22292
22324
|
function resolveCsproj(csprojPath) {
|
|
22293
22325
|
const resolved = path36.resolve(csprojPath);
|
|
22294
22326
|
if (!existsSync52(resolved)) {
|
|
22295
|
-
console.error(
|
|
22327
|
+
console.error(chalk155.red(`File not found: ${resolved}`));
|
|
22296
22328
|
process.exit(1);
|
|
22297
22329
|
}
|
|
22298
22330
|
const repoRoot2 = findRepoRoot(path36.dirname(resolved));
|
|
22299
22331
|
if (!repoRoot2) {
|
|
22300
|
-
console.error(
|
|
22332
|
+
console.error(chalk155.red("Could not find git repository root"));
|
|
22301
22333
|
process.exit(1);
|
|
22302
22334
|
}
|
|
22303
22335
|
return { resolved, repoRoot: repoRoot2 };
|
|
@@ -22347,12 +22379,12 @@ function getChangedCsFiles(scope) {
|
|
|
22347
22379
|
}
|
|
22348
22380
|
|
|
22349
22381
|
// src/commands/dotnet/inSln.ts
|
|
22350
|
-
import
|
|
22382
|
+
import chalk156 from "chalk";
|
|
22351
22383
|
async function inSln(csprojPath) {
|
|
22352
22384
|
const { resolved, repoRoot: repoRoot2 } = resolveCsproj(csprojPath);
|
|
22353
22385
|
const solutions = findContainingSolutions(resolved, repoRoot2);
|
|
22354
22386
|
if (solutions.length === 0) {
|
|
22355
|
-
console.log(
|
|
22387
|
+
console.log(chalk156.yellow("Not found in any .sln file"));
|
|
22356
22388
|
process.exit(1);
|
|
22357
22389
|
}
|
|
22358
22390
|
for (const sln of solutions) {
|
|
@@ -22361,7 +22393,7 @@ async function inSln(csprojPath) {
|
|
|
22361
22393
|
}
|
|
22362
22394
|
|
|
22363
22395
|
// src/commands/dotnet/inspect.ts
|
|
22364
|
-
import
|
|
22396
|
+
import chalk162 from "chalk";
|
|
22365
22397
|
|
|
22366
22398
|
// src/shared/formatElapsed.ts
|
|
22367
22399
|
function formatElapsed(ms) {
|
|
@@ -22373,12 +22405,12 @@ function formatElapsed(ms) {
|
|
|
22373
22405
|
}
|
|
22374
22406
|
|
|
22375
22407
|
// src/commands/dotnet/displayIssues.ts
|
|
22376
|
-
import
|
|
22408
|
+
import chalk157 from "chalk";
|
|
22377
22409
|
var SEVERITY_COLOR = {
|
|
22378
|
-
ERROR:
|
|
22379
|
-
WARNING:
|
|
22380
|
-
SUGGESTION:
|
|
22381
|
-
HINT:
|
|
22410
|
+
ERROR: chalk157.red,
|
|
22411
|
+
WARNING: chalk157.yellow,
|
|
22412
|
+
SUGGESTION: chalk157.cyan,
|
|
22413
|
+
HINT: chalk157.dim
|
|
22382
22414
|
};
|
|
22383
22415
|
function groupByFile(issues) {
|
|
22384
22416
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -22394,15 +22426,15 @@ function groupByFile(issues) {
|
|
|
22394
22426
|
}
|
|
22395
22427
|
function displayIssues(issues) {
|
|
22396
22428
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
22397
|
-
console.log(
|
|
22429
|
+
console.log(chalk157.bold(file));
|
|
22398
22430
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
22399
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
22431
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk157.white;
|
|
22400
22432
|
console.log(
|
|
22401
|
-
` ${
|
|
22433
|
+
` ${chalk157.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
22402
22434
|
);
|
|
22403
22435
|
}
|
|
22404
22436
|
}
|
|
22405
|
-
console.log(
|
|
22437
|
+
console.log(chalk157.dim(`
|
|
22406
22438
|
${issues.length} issue(s) found`));
|
|
22407
22439
|
}
|
|
22408
22440
|
|
|
@@ -22461,15 +22493,15 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
22461
22493
|
// src/commands/dotnet/resolveSolution.ts
|
|
22462
22494
|
import { existsSync as existsSync53 } from "fs";
|
|
22463
22495
|
import path37 from "path";
|
|
22464
|
-
import
|
|
22496
|
+
import chalk159 from "chalk";
|
|
22465
22497
|
|
|
22466
22498
|
// src/commands/dotnet/findSolution.ts
|
|
22467
22499
|
import { readdirSync as readdirSync10 } from "fs";
|
|
22468
|
-
import { dirname as dirname27, join as
|
|
22469
|
-
import
|
|
22500
|
+
import { dirname as dirname27, join as join62 } from "path";
|
|
22501
|
+
import chalk158 from "chalk";
|
|
22470
22502
|
function findSlnInDir(dir) {
|
|
22471
22503
|
try {
|
|
22472
|
-
return readdirSync10(dir).filter((f) => f.endsWith(".sln")).map((f) =>
|
|
22504
|
+
return readdirSync10(dir).filter((f) => f.endsWith(".sln")).map((f) => join62(dir, f));
|
|
22473
22505
|
} catch {
|
|
22474
22506
|
return [];
|
|
22475
22507
|
}
|
|
@@ -22482,17 +22514,17 @@ function findSolution() {
|
|
|
22482
22514
|
const slnFiles = findSlnInDir(current);
|
|
22483
22515
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
22484
22516
|
if (slnFiles.length > 1) {
|
|
22485
|
-
console.error(
|
|
22517
|
+
console.error(chalk158.red(`Multiple .sln files found in ${current}:`));
|
|
22486
22518
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
22487
22519
|
console.error(
|
|
22488
|
-
|
|
22520
|
+
chalk158.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
22489
22521
|
);
|
|
22490
22522
|
process.exit(1);
|
|
22491
22523
|
}
|
|
22492
22524
|
if (current === ceiling) break;
|
|
22493
22525
|
current = dirname27(current);
|
|
22494
22526
|
}
|
|
22495
|
-
console.error(
|
|
22527
|
+
console.error(chalk158.red("No .sln file found between cwd and repo root"));
|
|
22496
22528
|
process.exit(1);
|
|
22497
22529
|
}
|
|
22498
22530
|
|
|
@@ -22501,7 +22533,7 @@ function resolveSolution(sln) {
|
|
|
22501
22533
|
if (sln) {
|
|
22502
22534
|
const resolved = path37.resolve(sln);
|
|
22503
22535
|
if (!existsSync53(resolved)) {
|
|
22504
|
-
console.error(
|
|
22536
|
+
console.error(chalk159.red(`Solution file not found: ${resolved}`));
|
|
22505
22537
|
process.exit(1);
|
|
22506
22538
|
}
|
|
22507
22539
|
return resolved;
|
|
@@ -22543,14 +22575,14 @@ import { execSync as execSync35 } from "child_process";
|
|
|
22543
22575
|
import { existsSync as existsSync54, readFileSync as readFileSync37, unlinkSync as unlinkSync10 } from "fs";
|
|
22544
22576
|
import { tmpdir as tmpdir4 } from "os";
|
|
22545
22577
|
import path38 from "path";
|
|
22546
|
-
import
|
|
22578
|
+
import chalk160 from "chalk";
|
|
22547
22579
|
function assertJbInstalled() {
|
|
22548
22580
|
try {
|
|
22549
22581
|
execSync35("jb inspectcode --version", { stdio: "pipe" });
|
|
22550
22582
|
} catch {
|
|
22551
|
-
console.error(
|
|
22583
|
+
console.error(chalk160.red("jb is not installed. Install with:"));
|
|
22552
22584
|
console.error(
|
|
22553
|
-
|
|
22585
|
+
chalk160.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
22554
22586
|
);
|
|
22555
22587
|
process.exit(1);
|
|
22556
22588
|
}
|
|
@@ -22568,11 +22600,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
22568
22600
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
22569
22601
|
process.stderr.write(error.stderr);
|
|
22570
22602
|
}
|
|
22571
|
-
console.error(
|
|
22603
|
+
console.error(chalk160.red("jb inspectcode failed"));
|
|
22572
22604
|
process.exit(1);
|
|
22573
22605
|
}
|
|
22574
22606
|
if (!existsSync54(reportPath)) {
|
|
22575
|
-
console.error(
|
|
22607
|
+
console.error(chalk160.red("Report file not generated"));
|
|
22576
22608
|
process.exit(1);
|
|
22577
22609
|
}
|
|
22578
22610
|
const xml = readFileSync37(reportPath, "utf8");
|
|
@@ -22582,7 +22614,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
22582
22614
|
|
|
22583
22615
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
22584
22616
|
import { execSync as execSync36 } from "child_process";
|
|
22585
|
-
import
|
|
22617
|
+
import chalk161 from "chalk";
|
|
22586
22618
|
function resolveMsbuildPath() {
|
|
22587
22619
|
const { run: run4 } = loadConfig();
|
|
22588
22620
|
const configs = resolveRunConfigs(run4, runConfigBaseDir());
|
|
@@ -22594,9 +22626,9 @@ function assertMsbuildInstalled() {
|
|
|
22594
22626
|
try {
|
|
22595
22627
|
execSync36(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
22596
22628
|
} catch {
|
|
22597
|
-
console.error(
|
|
22629
|
+
console.error(chalk161.red(`msbuild not found at: ${msbuild}`));
|
|
22598
22630
|
console.error(
|
|
22599
|
-
|
|
22631
|
+
chalk161.yellow(
|
|
22600
22632
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
22601
22633
|
)
|
|
22602
22634
|
);
|
|
@@ -22643,17 +22675,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
22643
22675
|
// src/commands/dotnet/inspect.ts
|
|
22644
22676
|
function logScope(changedFiles2) {
|
|
22645
22677
|
if (changedFiles2 === null) {
|
|
22646
|
-
console.log(
|
|
22678
|
+
console.log(chalk162.dim("Inspecting full solution..."));
|
|
22647
22679
|
} else {
|
|
22648
22680
|
console.log(
|
|
22649
|
-
|
|
22681
|
+
chalk162.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
22650
22682
|
);
|
|
22651
22683
|
}
|
|
22652
22684
|
}
|
|
22653
22685
|
function reportResults(issues, elapsed) {
|
|
22654
22686
|
if (issues.length > 0) displayIssues(issues);
|
|
22655
|
-
else console.log(
|
|
22656
|
-
console.log(
|
|
22687
|
+
else console.log(chalk162.green("No issues found"));
|
|
22688
|
+
console.log(chalk162.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
22657
22689
|
if (issues.length > 0) process.exit(1);
|
|
22658
22690
|
}
|
|
22659
22691
|
async function inspect(sln, options2) {
|
|
@@ -22664,7 +22696,7 @@ async function inspect(sln, options2) {
|
|
|
22664
22696
|
const scope = parseScope(options2.scope);
|
|
22665
22697
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
22666
22698
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
22667
|
-
console.log(
|
|
22699
|
+
console.log(chalk162.green("No changed .cs files found"));
|
|
22668
22700
|
return;
|
|
22669
22701
|
}
|
|
22670
22702
|
logScope(changedFiles2);
|
|
@@ -23464,7 +23496,7 @@ function aggregateCommitters(authorLists) {
|
|
|
23464
23496
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
23465
23497
|
import { unlinkSync as unlinkSync12, writeFileSync as writeFileSync30 } from "fs";
|
|
23466
23498
|
import { tmpdir as tmpdir5 } from "os";
|
|
23467
|
-
import { join as
|
|
23499
|
+
import { join as join63 } from "path";
|
|
23468
23500
|
function buildArgs2(queryFile, vars) {
|
|
23469
23501
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
23470
23502
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -23474,7 +23506,7 @@ function buildArgs2(queryFile, vars) {
|
|
|
23474
23506
|
return args;
|
|
23475
23507
|
}
|
|
23476
23508
|
function runGhGraphql(mutation, vars) {
|
|
23477
|
-
const queryFile =
|
|
23509
|
+
const queryFile = join63(tmpdir5(), `gh-query-${Date.now()}.graphql`);
|
|
23478
23510
|
writeFileSync30(queryFile, mutation);
|
|
23479
23511
|
try {
|
|
23480
23512
|
const result = spawnSync6("gh", buildArgs2(queryFile, vars), {
|
|
@@ -23539,25 +23571,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
23539
23571
|
}
|
|
23540
23572
|
|
|
23541
23573
|
// src/commands/github/printCountTable.ts
|
|
23542
|
-
import
|
|
23574
|
+
import chalk163 from "chalk";
|
|
23543
23575
|
function printCountTable(labelHeader, rows) {
|
|
23544
23576
|
const labelWidth = Math.max(
|
|
23545
23577
|
labelHeader.length,
|
|
23546
23578
|
...rows.map((row) => row.label.length)
|
|
23547
23579
|
);
|
|
23548
23580
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
23549
|
-
console.log(
|
|
23550
|
-
console.log(
|
|
23581
|
+
console.log(chalk163.dim(header));
|
|
23582
|
+
console.log(chalk163.dim("-".repeat(header.length)));
|
|
23551
23583
|
for (const row of rows) {
|
|
23552
23584
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
23553
23585
|
}
|
|
23554
23586
|
}
|
|
23555
23587
|
|
|
23556
23588
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
23557
|
-
import
|
|
23589
|
+
import chalk164 from "chalk";
|
|
23558
23590
|
function printRepoAuthorBreakdown(repos2) {
|
|
23559
23591
|
for (const repo of repos2) {
|
|
23560
|
-
console.log(
|
|
23592
|
+
console.log(chalk164.bold(repo.name));
|
|
23561
23593
|
const authorWidth = Math.max(
|
|
23562
23594
|
0,
|
|
23563
23595
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -23640,10 +23672,10 @@ function parseTopCount(value) {
|
|
|
23640
23672
|
}
|
|
23641
23673
|
|
|
23642
23674
|
// src/commands/github/issue/fixStructure/applyAndVerifySubtree.ts
|
|
23643
|
-
import
|
|
23675
|
+
import chalk166 from "chalk";
|
|
23644
23676
|
|
|
23645
23677
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
23646
|
-
import
|
|
23678
|
+
import chalk165 from "chalk";
|
|
23647
23679
|
|
|
23648
23680
|
// src/commands/github/issue/fixStructure/removeIssueLabels.ts
|
|
23649
23681
|
var MUTATION2 = `mutation($labelableId: ID!, $labelIds: [ID!]!) {
|
|
@@ -23680,7 +23712,7 @@ function writeLineNow(line) {
|
|
|
23680
23712
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
23681
23713
|
function applyFixStructurePlan(plan2) {
|
|
23682
23714
|
for (const entry of plan2.entries) {
|
|
23683
|
-
const where =
|
|
23715
|
+
const where = chalk165.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
23684
23716
|
const { typeChange, labelRemovals } = entry;
|
|
23685
23717
|
if (typeChange) {
|
|
23686
23718
|
writeLineNow(
|
|
@@ -23950,12 +23982,12 @@ function planSubtree(root2, context) {
|
|
|
23950
23982
|
function applyAndVerifySubtree(target, plan2, context) {
|
|
23951
23983
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) return;
|
|
23952
23984
|
applyFixStructurePlan(plan2);
|
|
23953
|
-
writeLineNow(
|
|
23985
|
+
writeLineNow(chalk166.dim("Re-walking the subtree to confirm"));
|
|
23954
23986
|
assertNoResidualDrift(
|
|
23955
23987
|
planSubtree(fetchRootIssue(target), context),
|
|
23956
23988
|
context.chain
|
|
23957
23989
|
);
|
|
23958
|
-
writeLineNow(
|
|
23990
|
+
writeLineNow(chalk166.green("Subtree normalised"));
|
|
23959
23991
|
}
|
|
23960
23992
|
|
|
23961
23993
|
// src/commands/github/issue/fixStructure/assertChainTypesExist.ts
|
|
@@ -23991,22 +24023,22 @@ function parseTypeChain(value) {
|
|
|
23991
24023
|
}
|
|
23992
24024
|
|
|
23993
24025
|
// src/commands/github/issue/fixStructure/printFixStructurePlan.ts
|
|
23994
|
-
import
|
|
24026
|
+
import chalk167 from "chalk";
|
|
23995
24027
|
function annotate(entry) {
|
|
23996
24028
|
const notes = [];
|
|
23997
24029
|
if (entry.level === null) {
|
|
23998
|
-
notes.push(
|
|
24030
|
+
notes.push(chalk167.red("deeper than the leaf level"));
|
|
23999
24031
|
} else if (entry.typeChange) {
|
|
24000
24032
|
notes.push(
|
|
24001
|
-
|
|
24033
|
+
chalk167.yellow(
|
|
24002
24034
|
`${entry.typeChange.from ?? "no type"} -> ${entry.typeChange.to}`
|
|
24003
24035
|
)
|
|
24004
24036
|
);
|
|
24005
24037
|
} else {
|
|
24006
|
-
notes.push(
|
|
24038
|
+
notes.push(chalk167.dim(entry.issue.typeName ?? "no type"));
|
|
24007
24039
|
}
|
|
24008
24040
|
for (const label2 of entry.labelRemovals) {
|
|
24009
|
-
notes.push(
|
|
24041
|
+
notes.push(chalk167.yellow(`-${label2.name}`));
|
|
24010
24042
|
}
|
|
24011
24043
|
return notes;
|
|
24012
24044
|
}
|
|
@@ -24014,22 +24046,22 @@ function formatCount(count8, noun) {
|
|
|
24014
24046
|
return `${count8} ${noun}${count8 === 1 ? "" : "s"}`;
|
|
24015
24047
|
}
|
|
24016
24048
|
function printFixStructurePlan(plan2, chain2, apply) {
|
|
24017
|
-
writeLineNow(
|
|
24049
|
+
writeLineNow(chalk167.dim(`chain: ${chain2.join(" > ")}`));
|
|
24018
24050
|
for (const entry of plan2.entries) {
|
|
24019
24051
|
const indent3 = " ".repeat(entry.issue.depth);
|
|
24020
|
-
const name =
|
|
24052
|
+
const name = chalk167.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
24021
24053
|
writeLineNow(
|
|
24022
24054
|
`${indent3}${name} ${entry.issue.title} [${annotate(entry).join(", ")}]`
|
|
24023
24055
|
);
|
|
24024
24056
|
}
|
|
24025
24057
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) {
|
|
24026
|
-
writeLineNow(
|
|
24058
|
+
writeLineNow(chalk167.green("Nothing to change"));
|
|
24027
24059
|
return;
|
|
24028
24060
|
}
|
|
24029
24061
|
writeLineNow(
|
|
24030
24062
|
`${formatCount(plan2.typeChangeCount, "type change")}, ${formatCount(plan2.labelRemovalCount, "label removal")} planned`
|
|
24031
24063
|
);
|
|
24032
|
-
if (!apply) writeLineNow(
|
|
24064
|
+
if (!apply) writeLineNow(chalk167.dim("Dry run \u2014 nothing written"));
|
|
24033
24065
|
}
|
|
24034
24066
|
|
|
24035
24067
|
// src/commands/github/issue/parseRepoSlug.ts
|
|
@@ -24819,14 +24851,14 @@ function fetchIssue2(number, repo) {
|
|
|
24819
24851
|
import { existsSync as existsSync56, readFileSync as readFileSync38 } from "fs";
|
|
24820
24852
|
|
|
24821
24853
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
24822
|
-
import { join as
|
|
24854
|
+
import { join as join64 } from "path";
|
|
24823
24855
|
function issueWorkingFile(slug2, number) {
|
|
24824
24856
|
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
24825
|
-
const dir =
|
|
24857
|
+
const dir = join64(getStoreDir(), "github-issues", owner, repo);
|
|
24826
24858
|
return {
|
|
24827
24859
|
dir,
|
|
24828
|
-
bodyPath:
|
|
24829
|
-
metaPath:
|
|
24860
|
+
bodyPath: join64(dir, `${number}.md`),
|
|
24861
|
+
metaPath: join64(dir, `${number}.json`)
|
|
24830
24862
|
};
|
|
24831
24863
|
}
|
|
24832
24864
|
|
|
@@ -25239,7 +25271,7 @@ function registerGithub(program2) {
|
|
|
25239
25271
|
}
|
|
25240
25272
|
|
|
25241
25273
|
// src/commands/jira/acceptanceCriteria.ts
|
|
25242
|
-
import
|
|
25274
|
+
import chalk168 from "chalk";
|
|
25243
25275
|
|
|
25244
25276
|
// src/commands/jira/adfToText.ts
|
|
25245
25277
|
function renderInline(node) {
|
|
@@ -25306,7 +25338,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
25306
25338
|
const parsed = fetchIssue(issueKey, field);
|
|
25307
25339
|
const acValue = parsed?.fields?.[field];
|
|
25308
25340
|
if (!acValue) {
|
|
25309
|
-
console.log(
|
|
25341
|
+
console.log(chalk168.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
25310
25342
|
return;
|
|
25311
25343
|
}
|
|
25312
25344
|
if (typeof acValue === "string") {
|
|
@@ -25372,14 +25404,14 @@ async function jiraAuth() {
|
|
|
25372
25404
|
}
|
|
25373
25405
|
|
|
25374
25406
|
// src/commands/jira/viewIssue.ts
|
|
25375
|
-
import
|
|
25407
|
+
import chalk169 from "chalk";
|
|
25376
25408
|
function viewIssue2(issueKey) {
|
|
25377
25409
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
25378
25410
|
const fields = parsed?.fields;
|
|
25379
25411
|
const summary = fields?.summary;
|
|
25380
25412
|
const description = fields?.description;
|
|
25381
25413
|
if (summary) {
|
|
25382
|
-
console.log(
|
|
25414
|
+
console.log(chalk169.bold(summary));
|
|
25383
25415
|
}
|
|
25384
25416
|
if (description) {
|
|
25385
25417
|
if (summary) console.log();
|
|
@@ -25393,7 +25425,7 @@ function viewIssue2(issueKey) {
|
|
|
25393
25425
|
}
|
|
25394
25426
|
if (!summary && !description) {
|
|
25395
25427
|
console.log(
|
|
25396
|
-
|
|
25428
|
+
chalk169.yellow(`No summary or description found on ${issueKey}.`)
|
|
25397
25429
|
);
|
|
25398
25430
|
}
|
|
25399
25431
|
}
|
|
@@ -25428,7 +25460,7 @@ import { randomUUID as randomUUID12 } from "crypto";
|
|
|
25428
25460
|
|
|
25429
25461
|
// src/commands/review/checkoutPr.ts
|
|
25430
25462
|
import { execFileSync as execFileSync15 } from "child_process";
|
|
25431
|
-
import
|
|
25463
|
+
import chalk170 from "chalk";
|
|
25432
25464
|
|
|
25433
25465
|
// src/commands/sessions/daemon/daemonLog.ts
|
|
25434
25466
|
var RING_CAPACITY = 1e3;
|
|
@@ -25469,14 +25501,14 @@ import { existsSync as existsSync57 } from "fs";
|
|
|
25469
25501
|
import { basename as basename18, dirname as dirname29 } from "path";
|
|
25470
25502
|
|
|
25471
25503
|
// src/commands/sessions/daemon/worktree/planAllocation.ts
|
|
25472
|
-
import { basename as basename17, join as
|
|
25504
|
+
import { basename as basename17, join as join65 } from "path";
|
|
25473
25505
|
function planAllocation(clone, boundTreeRoots2) {
|
|
25474
25506
|
return boundTreeRoots2.has(clone) ? "spill" : "primary";
|
|
25475
25507
|
}
|
|
25476
25508
|
function nextWorktreePath(clone, base, isTaken) {
|
|
25477
25509
|
const name = basename17(clone);
|
|
25478
25510
|
for (let n = 2; n < 1e3; n++) {
|
|
25479
|
-
const candidate =
|
|
25511
|
+
const candidate = join65(base, `${name}-${n}`);
|
|
25480
25512
|
if (!isTaken(candidate)) return candidate;
|
|
25481
25513
|
}
|
|
25482
25514
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -25830,19 +25862,19 @@ function persistedTreeRoots() {
|
|
|
25830
25862
|
|
|
25831
25863
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
25832
25864
|
import { copyFileSync, existsSync as existsSync60, mkdirSync as mkdirSync17 } from "fs";
|
|
25833
|
-
import { dirname as dirname30, join as
|
|
25865
|
+
import { dirname as dirname30, join as join67 } from "path";
|
|
25834
25866
|
|
|
25835
25867
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
25836
25868
|
import { resolve as resolve17 } from "path";
|
|
25837
25869
|
|
|
25838
25870
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
25839
25871
|
import { existsSync as existsSync59 } from "fs";
|
|
25840
|
-
import { join as
|
|
25872
|
+
import { join as join66 } from "path";
|
|
25841
25873
|
function detectInstallCommand(dir) {
|
|
25842
|
-
if (!existsSync59(
|
|
25843
|
-
if (existsSync59(
|
|
25844
|
-
if (existsSync59(
|
|
25845
|
-
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";
|
|
25846
25878
|
return "npm install";
|
|
25847
25879
|
}
|
|
25848
25880
|
|
|
@@ -26004,9 +26036,9 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
26004
26036
|
}
|
|
26005
26037
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
26006
26038
|
for (const rel of copy) {
|
|
26007
|
-
const src =
|
|
26039
|
+
const src = join67(clone, rel);
|
|
26008
26040
|
if (!existsSync60(src)) continue;
|
|
26009
|
-
const dest =
|
|
26041
|
+
const dest = join67(worktreePath, rel);
|
|
26010
26042
|
try {
|
|
26011
26043
|
mkdirSync17(dirname30(dest), { recursive: true });
|
|
26012
26044
|
copyFileSync(src, dest);
|
|
@@ -26114,7 +26146,7 @@ async function checkoutPr(number) {
|
|
|
26114
26146
|
try {
|
|
26115
26147
|
execFileSync15("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
26116
26148
|
} catch {
|
|
26117
|
-
console.error(
|
|
26149
|
+
console.error(chalk170.red(`gh pr checkout ${number} failed; aborting.`));
|
|
26118
26150
|
process.exit(1);
|
|
26119
26151
|
}
|
|
26120
26152
|
}
|
|
@@ -26249,18 +26281,18 @@ function registerList(program2) {
|
|
|
26249
26281
|
}
|
|
26250
26282
|
|
|
26251
26283
|
// src/commands/litellm/listModels.ts
|
|
26252
|
-
import
|
|
26284
|
+
import chalk172 from "chalk";
|
|
26253
26285
|
|
|
26254
26286
|
// src/commands/litellm/resolveLitellmConfig.ts
|
|
26255
|
-
import
|
|
26287
|
+
import chalk171 from "chalk";
|
|
26256
26288
|
function resolveLitellmConfig() {
|
|
26257
26289
|
const { config, missing } = readLitellmConfig();
|
|
26258
26290
|
if (!config) {
|
|
26259
|
-
console.error(
|
|
26291
|
+
console.error(chalk171.red("LiteLLM is not configured"));
|
|
26260
26292
|
for (const key of missing) {
|
|
26261
26293
|
const entry = litellmConfigHelp.find((help) => help.key === key);
|
|
26262
26294
|
console.error(
|
|
26263
|
-
|
|
26295
|
+
chalk171.red(` ${key} is not set. Set it with: ${entry?.setter}`)
|
|
26264
26296
|
);
|
|
26265
26297
|
}
|
|
26266
26298
|
process.exit(1);
|
|
@@ -26286,13 +26318,13 @@ async function listModels(options2) {
|
|
|
26286
26318
|
} catch (error) {
|
|
26287
26319
|
const reason4 = error instanceof Error ? error.message : String(error);
|
|
26288
26320
|
console.error(
|
|
26289
|
-
|
|
26321
|
+
chalk172.red(`Failed to reach LiteLLM at ${baseUrl}: ${reason4}`)
|
|
26290
26322
|
);
|
|
26291
26323
|
process.exit(1);
|
|
26292
26324
|
}
|
|
26293
26325
|
const body = await response.text();
|
|
26294
26326
|
if (!response.ok) {
|
|
26295
|
-
console.error(
|
|
26327
|
+
console.error(chalk172.red(`LiteLLM returned ${response.status}: ${body}`));
|
|
26296
26328
|
process.exit(1);
|
|
26297
26329
|
}
|
|
26298
26330
|
if (options2.json) {
|
|
@@ -26312,15 +26344,15 @@ function registerLitellm(program2) {
|
|
|
26312
26344
|
// src/commands/mermaidExport.ts
|
|
26313
26345
|
import { mkdirSync as mkdirSync18, readdirSync as readdirSync11 } from "fs";
|
|
26314
26346
|
import { resolve as resolve19 } from "path";
|
|
26315
|
-
import
|
|
26347
|
+
import chalk175 from "chalk";
|
|
26316
26348
|
|
|
26317
26349
|
// src/commands/mermaid/exportFile.ts
|
|
26318
26350
|
import { readFileSync as readFileSync39, writeFileSync as writeFileSync32 } from "fs";
|
|
26319
26351
|
import { basename as basename19, extname as extname3, resolve as resolve18 } from "path";
|
|
26320
|
-
import
|
|
26352
|
+
import chalk174 from "chalk";
|
|
26321
26353
|
|
|
26322
26354
|
// src/commands/mermaid/renderBlock.ts
|
|
26323
|
-
import
|
|
26355
|
+
import chalk173 from "chalk";
|
|
26324
26356
|
async function renderBlock(krokiUrl, source) {
|
|
26325
26357
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
26326
26358
|
method: "POST",
|
|
@@ -26329,7 +26361,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
26329
26361
|
});
|
|
26330
26362
|
if (!response.ok) {
|
|
26331
26363
|
console.error(
|
|
26332
|
-
|
|
26364
|
+
chalk173.red(
|
|
26333
26365
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
26334
26366
|
)
|
|
26335
26367
|
);
|
|
@@ -26347,19 +26379,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
26347
26379
|
if (onlyIndex !== void 0) {
|
|
26348
26380
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
26349
26381
|
console.error(
|
|
26350
|
-
|
|
26382
|
+
chalk174.red(
|
|
26351
26383
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
26352
26384
|
)
|
|
26353
26385
|
);
|
|
26354
26386
|
process.exit(1);
|
|
26355
26387
|
}
|
|
26356
26388
|
console.log(
|
|
26357
|
-
|
|
26389
|
+
chalk174.gray(
|
|
26358
26390
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
26359
26391
|
)
|
|
26360
26392
|
);
|
|
26361
26393
|
} else {
|
|
26362
|
-
console.log(
|
|
26394
|
+
console.log(chalk174.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
26363
26395
|
}
|
|
26364
26396
|
for (const [i, source] of blocks.entries()) {
|
|
26365
26397
|
const idx = i + 1;
|
|
@@ -26367,7 +26399,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
26367
26399
|
const outPath = resolve18(outDir, `${stem}-${idx}.svg`);
|
|
26368
26400
|
const svg = await renderBlock(krokiUrl, source);
|
|
26369
26401
|
writeFileSync32(outPath, svg, "utf8");
|
|
26370
|
-
console.log(
|
|
26402
|
+
console.log(chalk174.green(` \u2192 ${outPath}`));
|
|
26371
26403
|
}
|
|
26372
26404
|
}
|
|
26373
26405
|
function extractMermaidBlocks(markdown) {
|
|
@@ -26383,18 +26415,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
26383
26415
|
if (options2.index !== void 0) {
|
|
26384
26416
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
26385
26417
|
console.error(
|
|
26386
|
-
|
|
26418
|
+
chalk175.red(`--index must be a positive integer (got ${options2.index})`)
|
|
26387
26419
|
);
|
|
26388
26420
|
process.exit(1);
|
|
26389
26421
|
}
|
|
26390
26422
|
if (!file) {
|
|
26391
|
-
console.error(
|
|
26423
|
+
console.error(chalk175.red("--index requires a file argument"));
|
|
26392
26424
|
process.exit(1);
|
|
26393
26425
|
}
|
|
26394
26426
|
}
|
|
26395
26427
|
const files = file ? [file] : readdirSync11(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
26396
26428
|
if (files.length === 0) {
|
|
26397
|
-
console.log(
|
|
26429
|
+
console.log(chalk175.gray("No markdown files found in current directory."));
|
|
26398
26430
|
return;
|
|
26399
26431
|
}
|
|
26400
26432
|
for (const f of files) {
|
|
@@ -26540,7 +26572,7 @@ function extractToSave(details, cwd = process.cwd()) {
|
|
|
26540
26572
|
}
|
|
26541
26573
|
|
|
26542
26574
|
// src/commands/miro/keptTexts.ts
|
|
26543
|
-
import
|
|
26575
|
+
import chalk176 from "chalk";
|
|
26544
26576
|
|
|
26545
26577
|
// src/commands/miro/applyIgnore.ts
|
|
26546
26578
|
function applyIgnore(texts, ignore3) {
|
|
@@ -26579,7 +26611,7 @@ function warnUnmatched(file, unmatched) {
|
|
|
26579
26611
|
if (unmatched.length === 0) return;
|
|
26580
26612
|
const entries = unmatched.map((entry) => ` - ${entry}`).join("\n");
|
|
26581
26613
|
console.error(
|
|
26582
|
-
|
|
26614
|
+
chalk176.yellow(
|
|
26583
26615
|
`${unmatched.length} ${unmatched.length === 1 ? "entry" : "entries"} in ${file} matched no box text:
|
|
26584
26616
|
${entries}`
|
|
26585
26617
|
)
|
|
@@ -26782,7 +26814,7 @@ function readMiroItems(file) {
|
|
|
26782
26814
|
}
|
|
26783
26815
|
|
|
26784
26816
|
// src/commands/miro/resolveExtractOptions.ts
|
|
26785
|
-
import
|
|
26817
|
+
import chalk177 from "chalk";
|
|
26786
26818
|
|
|
26787
26819
|
// src/commands/miro/extractLayers.ts
|
|
26788
26820
|
function extractsIn(layer) {
|
|
@@ -26860,7 +26892,7 @@ function resolveExtractOptions(name, options2, paths) {
|
|
|
26860
26892
|
paths.cwd,
|
|
26861
26893
|
paths.globalConfigPath
|
|
26862
26894
|
);
|
|
26863
|
-
console.error(
|
|
26895
|
+
console.error(chalk177.dim(`Extract "${name}" from ${resolved.from}`));
|
|
26864
26896
|
return resolved.options;
|
|
26865
26897
|
}
|
|
26866
26898
|
|
|
@@ -26962,7 +26994,7 @@ function registerMiro(program2) {
|
|
|
26962
26994
|
import { mkdir as mkdir6 } from "fs/promises";
|
|
26963
26995
|
import { createServer as createServer2 } from "http";
|
|
26964
26996
|
import { dirname as dirname33 } from "path";
|
|
26965
|
-
import
|
|
26997
|
+
import chalk179 from "chalk";
|
|
26966
26998
|
|
|
26967
26999
|
// src/commands/netcap/corsHeaders.ts
|
|
26968
27000
|
var corsHeaders = {
|
|
@@ -27038,17 +27070,17 @@ function createNetcapHandler(options2) {
|
|
|
27038
27070
|
}
|
|
27039
27071
|
|
|
27040
27072
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
27041
|
-
import { cp as cp4, readFile as
|
|
27073
|
+
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
27042
27074
|
import { networkInterfaces } from "os";
|
|
27043
|
-
import { join as
|
|
27044
|
-
import
|
|
27075
|
+
import { join as join69 } from "path";
|
|
27076
|
+
import chalk178 from "chalk";
|
|
27045
27077
|
|
|
27046
27078
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
27047
|
-
import { dirname as dirname32, join as
|
|
27079
|
+
import { dirname as dirname32, join as join68 } from "path";
|
|
27048
27080
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
27049
27081
|
var moduleDir2 = dirname32(fileURLToPath7(import.meta.url));
|
|
27050
27082
|
function netcapExtensionDir() {
|
|
27051
|
-
return
|
|
27083
|
+
return join68(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
27052
27084
|
}
|
|
27053
27085
|
|
|
27054
27086
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -27063,8 +27095,8 @@ function lanIPv4() {
|
|
|
27063
27095
|
return void 0;
|
|
27064
27096
|
}
|
|
27065
27097
|
async function configureBackground(dir, host, port, filter) {
|
|
27066
|
-
const file =
|
|
27067
|
-
const source = await
|
|
27098
|
+
const file = join69(dir, "background.js");
|
|
27099
|
+
const source = await readFile7(file, "utf8");
|
|
27068
27100
|
await writeFile6(
|
|
27069
27101
|
file,
|
|
27070
27102
|
source.replace(
|
|
@@ -27085,7 +27117,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
27085
27117
|
const host = lanIPv4();
|
|
27086
27118
|
if (!host) {
|
|
27087
27119
|
console.log(
|
|
27088
|
-
|
|
27120
|
+
chalk178.yellow("could not determine the WSL IP for the extension")
|
|
27089
27121
|
);
|
|
27090
27122
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
27091
27123
|
return source;
|
|
@@ -27096,27 +27128,27 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
27096
27128
|
return WSL_WINDOWS_PATH3;
|
|
27097
27129
|
} catch {
|
|
27098
27130
|
console.log(
|
|
27099
|
-
|
|
27131
|
+
chalk178.yellow(`could not copy extension to ${WSL_WINDOWS_PATH3}`)
|
|
27100
27132
|
);
|
|
27101
27133
|
return source;
|
|
27102
27134
|
}
|
|
27103
27135
|
}
|
|
27104
27136
|
|
|
27105
27137
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
27106
|
-
import { isAbsolute as isAbsolute5, join as
|
|
27138
|
+
import { isAbsolute as isAbsolute5, join as join71, resolve as resolve21 } from "path";
|
|
27107
27139
|
|
|
27108
27140
|
// src/commands/netcap/defaultCapturePath.ts
|
|
27109
27141
|
import { homedir as homedir22 } from "os";
|
|
27110
|
-
import { join as
|
|
27142
|
+
import { join as join70 } from "path";
|
|
27111
27143
|
function defaultCapturePath() {
|
|
27112
|
-
return
|
|
27144
|
+
return join70(homedir22(), ".assist", "netcap", "capture.jsonl");
|
|
27113
27145
|
}
|
|
27114
27146
|
|
|
27115
27147
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
27116
27148
|
function resolveNetcapOutPath(out) {
|
|
27117
27149
|
if (!out) return defaultCapturePath();
|
|
27118
27150
|
const dir = isAbsolute5(out) ? out : resolve21(process.cwd(), out);
|
|
27119
|
-
return
|
|
27151
|
+
return join71(dir, "capture.jsonl");
|
|
27120
27152
|
}
|
|
27121
27153
|
|
|
27122
27154
|
// src/commands/netcap/netcap.ts
|
|
@@ -27129,30 +27161,30 @@ async function netcap(options2) {
|
|
|
27129
27161
|
let count8 = 0;
|
|
27130
27162
|
const handler = createNetcapHandler({
|
|
27131
27163
|
outPath,
|
|
27132
|
-
onPing: () => console.log(
|
|
27164
|
+
onPing: () => console.log(chalk179.dim("ping from extension")),
|
|
27133
27165
|
onCapture: (entry) => {
|
|
27134
27166
|
count8 += 1;
|
|
27135
27167
|
console.log(
|
|
27136
|
-
|
|
27137
|
-
|
|
27168
|
+
chalk179.green(`captured #${count8}`),
|
|
27169
|
+
chalk179.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
27138
27170
|
);
|
|
27139
27171
|
}
|
|
27140
27172
|
});
|
|
27141
27173
|
const server = createServer2(handler);
|
|
27142
27174
|
server.listen(port, () => {
|
|
27143
27175
|
console.log(
|
|
27144
|
-
|
|
27176
|
+
chalk179.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
27145
27177
|
);
|
|
27146
|
-
console.log(
|
|
27178
|
+
console.log(chalk179.dim(`appending captures to ${outPath}`));
|
|
27147
27179
|
if (filter)
|
|
27148
|
-
console.log(
|
|
27149
|
-
console.log(
|
|
27150
|
-
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"));
|
|
27151
27183
|
});
|
|
27152
27184
|
process.on("SIGINT", () => {
|
|
27153
27185
|
server.close();
|
|
27154
27186
|
console.log(
|
|
27155
|
-
|
|
27187
|
+
chalk179.bold(
|
|
27156
27188
|
`
|
|
27157
27189
|
netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
27158
27190
|
)
|
|
@@ -27163,8 +27195,8 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
27163
27195
|
|
|
27164
27196
|
// src/commands/netcap/netcapExtract.ts
|
|
27165
27197
|
import { writeFileSync as writeFileSync34 } from "fs";
|
|
27166
|
-
import { join as
|
|
27167
|
-
import
|
|
27198
|
+
import { join as join72 } from "path";
|
|
27199
|
+
import chalk180 from "chalk";
|
|
27168
27200
|
|
|
27169
27201
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
27170
27202
|
import { readFileSync as readFileSync42 } from "fs";
|
|
@@ -27608,12 +27640,12 @@ function extractPostsFromCapture(captureFile) {
|
|
|
27608
27640
|
function netcapExtract(file) {
|
|
27609
27641
|
const captureFile = file ?? defaultCapturePath();
|
|
27610
27642
|
const posts = extractPostsFromCapture(captureFile);
|
|
27611
|
-
const outFile =
|
|
27643
|
+
const outFile = join72(captureFile, "..", "posts.json");
|
|
27612
27644
|
writeFileSync34(outFile, `${JSON.stringify(posts, null, 2)}
|
|
27613
27645
|
`);
|
|
27614
27646
|
console.log(
|
|
27615
|
-
|
|
27616
|
-
|
|
27647
|
+
chalk180.green(`extracted ${posts.length} posts`),
|
|
27648
|
+
chalk180.dim(`-> ${outFile}`)
|
|
27617
27649
|
);
|
|
27618
27650
|
}
|
|
27619
27651
|
|
|
@@ -27634,7 +27666,7 @@ function registerNetcap(program2) {
|
|
|
27634
27666
|
}
|
|
27635
27667
|
|
|
27636
27668
|
// src/commands/news/add.ts
|
|
27637
|
-
import
|
|
27669
|
+
import chalk181 from "chalk";
|
|
27638
27670
|
import enquirer8 from "enquirer";
|
|
27639
27671
|
async function add2(url) {
|
|
27640
27672
|
if (!url) {
|
|
@@ -27656,10 +27688,10 @@ async function add2(url) {
|
|
|
27656
27688
|
const { orm } = await getReady();
|
|
27657
27689
|
const added = await addFeed(orm, url);
|
|
27658
27690
|
if (!added) {
|
|
27659
|
-
console.log(
|
|
27691
|
+
console.log(chalk181.yellow("Feed already exists"));
|
|
27660
27692
|
return;
|
|
27661
27693
|
}
|
|
27662
|
-
console.log(
|
|
27694
|
+
console.log(chalk181.green(`Added feed: ${url}`));
|
|
27663
27695
|
}
|
|
27664
27696
|
|
|
27665
27697
|
// src/commands/registerNews.ts
|
|
@@ -27707,7 +27739,7 @@ function registerPiHook(program2) {
|
|
|
27707
27739
|
}
|
|
27708
27740
|
|
|
27709
27741
|
// src/commands/prompts/printPromptsTable.ts
|
|
27710
|
-
import
|
|
27742
|
+
import chalk182 from "chalk";
|
|
27711
27743
|
function truncate(str, max) {
|
|
27712
27744
|
if (str.length <= max) return str;
|
|
27713
27745
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -27725,14 +27757,14 @@ function printPromptsTable(rows) {
|
|
|
27725
27757
|
"Command".padEnd(commandWidth),
|
|
27726
27758
|
"Repos"
|
|
27727
27759
|
].join(" ");
|
|
27728
|
-
console.log(
|
|
27729
|
-
console.log(
|
|
27760
|
+
console.log(chalk182.dim(header));
|
|
27761
|
+
console.log(chalk182.dim("-".repeat(header.length)));
|
|
27730
27762
|
for (const row of rows) {
|
|
27731
27763
|
const count8 = String(row.count).padStart(countWidth);
|
|
27732
27764
|
const tool = row.tool.padEnd(toolWidth);
|
|
27733
27765
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
27734
27766
|
console.log(
|
|
27735
|
-
`${
|
|
27767
|
+
`${chalk182.yellow(count8)} ${tool} ${command} ${chalk182.dim(row.repos)}`
|
|
27736
27768
|
);
|
|
27737
27769
|
}
|
|
27738
27770
|
}
|
|
@@ -27767,13 +27799,13 @@ import { execSync as execSync39 } from "child_process";
|
|
|
27767
27799
|
import enquirer9 from "enquirer";
|
|
27768
27800
|
|
|
27769
27801
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
27770
|
-
import
|
|
27802
|
+
import chalk183 from "chalk";
|
|
27771
27803
|
var STATUS_MAP = {
|
|
27772
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
27773
|
-
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
|
|
27774
27806
|
};
|
|
27775
27807
|
function defaultStatus(pr) {
|
|
27776
|
-
return { label:
|
|
27808
|
+
return { label: chalk183.green("opened"), date: pr.createdAt };
|
|
27777
27809
|
}
|
|
27778
27810
|
function getStatus2(pr) {
|
|
27779
27811
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -27782,11 +27814,11 @@ function formatDate(dateStr) {
|
|
|
27782
27814
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
27783
27815
|
}
|
|
27784
27816
|
function formatPrHeader(pr, status2) {
|
|
27785
|
-
return `${
|
|
27817
|
+
return `${chalk183.cyan(`#${pr.number}`)} ${pr.title} ${chalk183.dim(`(${pr.author.login},`)} ${status2.label} ${chalk183.dim(`${formatDate(status2.date)})`)}`;
|
|
27786
27818
|
}
|
|
27787
27819
|
function logPrDetails(pr) {
|
|
27788
27820
|
console.log(
|
|
27789
|
-
|
|
27821
|
+
chalk183.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
27790
27822
|
);
|
|
27791
27823
|
console.log();
|
|
27792
27824
|
}
|
|
@@ -27971,7 +28003,7 @@ import { execSync as execSync41 } from "child_process";
|
|
|
27971
28003
|
import { execSync as execSync40 } from "child_process";
|
|
27972
28004
|
import { unlinkSync as unlinkSync14, writeFileSync as writeFileSync35 } from "fs";
|
|
27973
28005
|
import { tmpdir as tmpdir6 } from "os";
|
|
27974
|
-
import { join as
|
|
28006
|
+
import { join as join74 } from "path";
|
|
27975
28007
|
|
|
27976
28008
|
// src/commands/prs/loadCommentsCache.ts
|
|
27977
28009
|
import { existsSync as existsSync62, readFileSync as readFileSync43, unlinkSync as unlinkSync13 } from "fs";
|
|
@@ -27979,9 +28011,9 @@ import { parse as parse3 } from "yaml";
|
|
|
27979
28011
|
|
|
27980
28012
|
// src/commands/prs/commentsCachePath.ts
|
|
27981
28013
|
import { homedir as homedir23 } from "os";
|
|
27982
|
-
import { join as
|
|
28014
|
+
import { join as join73 } from "path";
|
|
27983
28015
|
function commentsCachePath(org, repo, prNumber) {
|
|
27984
|
-
return
|
|
28016
|
+
return join73(
|
|
27985
28017
|
homedir23(),
|
|
27986
28018
|
".assist",
|
|
27987
28019
|
"pr-comments",
|
|
@@ -28030,7 +28062,7 @@ function replyToComment(org, repo, prNumber, commentId, message3) {
|
|
|
28030
28062
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
28031
28063
|
function resolveThread(threadId) {
|
|
28032
28064
|
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
28033
|
-
const queryFile =
|
|
28065
|
+
const queryFile = join74(tmpdir6(), `gh-mutation-${Date.now()}.graphql`);
|
|
28034
28066
|
writeFileSync35(queryFile, mutation);
|
|
28035
28067
|
try {
|
|
28036
28068
|
execSync40(
|
|
@@ -28115,10 +28147,10 @@ function fixed(commentId, sha) {
|
|
|
28115
28147
|
import { execSync as execSync42 } from "child_process";
|
|
28116
28148
|
import { unlinkSync as unlinkSync15, writeFileSync as writeFileSync36 } from "fs";
|
|
28117
28149
|
import { tmpdir as tmpdir7 } from "os";
|
|
28118
|
-
import { join as
|
|
28150
|
+
import { join as join75 } from "path";
|
|
28119
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 } } } } } } }`;
|
|
28120
28152
|
function fetchThreadIds(org, repo, prNumber) {
|
|
28121
|
-
const queryFile =
|
|
28153
|
+
const queryFile = join75(tmpdir7(), `gh-query-${Date.now()}.graphql`);
|
|
28122
28154
|
writeFileSync36(queryFile, THREAD_QUERY);
|
|
28123
28155
|
try {
|
|
28124
28156
|
const result = execSync42(
|
|
@@ -28193,10 +28225,10 @@ import { stringify as stringify3 } from "yaml";
|
|
|
28193
28225
|
|
|
28194
28226
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
28195
28227
|
import { readdirSync as readdirSync12, unlinkSync as unlinkSync16 } from "fs";
|
|
28196
|
-
import { join as
|
|
28228
|
+
import { join as join76 } from "path";
|
|
28197
28229
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
28198
28230
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
28199
|
-
const dir =
|
|
28231
|
+
const dir = join76(cwd, ".assist");
|
|
28200
28232
|
let entries;
|
|
28201
28233
|
try {
|
|
28202
28234
|
entries = readdirSync12(dir);
|
|
@@ -28204,7 +28236,7 @@ function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
|
28204
28236
|
return;
|
|
28205
28237
|
}
|
|
28206
28238
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
28207
|
-
unlinkSync16(
|
|
28239
|
+
unlinkSync16(join76(dir, entry));
|
|
28208
28240
|
}
|
|
28209
28241
|
}
|
|
28210
28242
|
|
|
@@ -28276,13 +28308,13 @@ function agentFooter(unresolvedCount) {
|
|
|
28276
28308
|
}
|
|
28277
28309
|
|
|
28278
28310
|
// src/commands/prs/listComments/commentStyle.ts
|
|
28279
|
-
import
|
|
28311
|
+
import chalk184 from "chalk";
|
|
28280
28312
|
var plain = (text17) => text17;
|
|
28281
28313
|
function colouredState(state) {
|
|
28282
28314
|
const label2 = `[${state}]`;
|
|
28283
|
-
if (state === "APPROVED") return
|
|
28284
|
-
if (state === "CHANGES_REQUESTED") return
|
|
28285
|
-
return
|
|
28315
|
+
if (state === "APPROVED") return chalk184.green(label2);
|
|
28316
|
+
if (state === "CHANGES_REQUESTED") return chalk184.red(label2);
|
|
28317
|
+
return chalk184.yellow(label2);
|
|
28286
28318
|
}
|
|
28287
28319
|
function commentStyle() {
|
|
28288
28320
|
if (isClaudeCode()) {
|
|
@@ -28296,9 +28328,9 @@ function commentStyle() {
|
|
|
28296
28328
|
};
|
|
28297
28329
|
}
|
|
28298
28330
|
return {
|
|
28299
|
-
cyan:
|
|
28300
|
-
bold:
|
|
28301
|
-
dim:
|
|
28331
|
+
cyan: chalk184.cyan,
|
|
28332
|
+
bold: chalk184.bold,
|
|
28333
|
+
dim: chalk184.dim,
|
|
28302
28334
|
state: colouredState,
|
|
28303
28335
|
diffHunk: true,
|
|
28304
28336
|
agent: false
|
|
@@ -29510,16 +29542,16 @@ function buildPrsStatusReport(repoArguments, now = Date.now()) {
|
|
|
29510
29542
|
}
|
|
29511
29543
|
|
|
29512
29544
|
// src/commands/prs/status/printPrsStatus.ts
|
|
29513
|
-
import
|
|
29545
|
+
import chalk186 from "chalk";
|
|
29514
29546
|
|
|
29515
29547
|
// src/commands/prs/status/printPrStatus.ts
|
|
29516
|
-
import
|
|
29548
|
+
import chalk185 from "chalk";
|
|
29517
29549
|
function flags(pr) {
|
|
29518
29550
|
const markers = [];
|
|
29519
29551
|
if (pr.isDraft) markers.push("draft");
|
|
29520
29552
|
if (pr.isDoNotMerge) markers.push("do not merge");
|
|
29521
29553
|
if (pr.isBot) markers.push("bot");
|
|
29522
|
-
return markers.length ? ` ${
|
|
29554
|
+
return markers.length ? ` ${chalk185.yellow(`[${markers.join(", ")}]`)}` : "";
|
|
29523
29555
|
}
|
|
29524
29556
|
function updated(pr) {
|
|
29525
29557
|
return pr.ageHours === null ? "updated unknown" : `updated ${pr.age} ago`;
|
|
@@ -29533,35 +29565,35 @@ function reviewLine(pr) {
|
|
|
29533
29565
|
function checkLines(pr) {
|
|
29534
29566
|
const lines2 = [];
|
|
29535
29567
|
if (pr.checks.failing.length) {
|
|
29536
|
-
lines2.push(
|
|
29568
|
+
lines2.push(chalk185.red(`failing: ${pr.checks.failing.join(", ")}`));
|
|
29537
29569
|
}
|
|
29538
29570
|
if (pr.checks.pending.length) {
|
|
29539
|
-
lines2.push(
|
|
29571
|
+
lines2.push(chalk185.yellow(`pending: ${pr.checks.pending.join(", ")}`));
|
|
29540
29572
|
}
|
|
29541
29573
|
return lines2;
|
|
29542
29574
|
}
|
|
29543
29575
|
function threadsLine(pr) {
|
|
29544
29576
|
if (pr.unresolvedThreads === null) {
|
|
29545
|
-
return
|
|
29577
|
+
return chalk185.dim("unresolved comments: unknown");
|
|
29546
29578
|
}
|
|
29547
29579
|
if (pr.unresolvedThreads === 0) return null;
|
|
29548
|
-
return
|
|
29580
|
+
return chalk185.yellow(`unresolved comments: ${pr.unresolvedThreads}`);
|
|
29549
29581
|
}
|
|
29550
29582
|
function mergeableLine(pr) {
|
|
29551
|
-
if (pr.mergeable === "CONFLICTING") return
|
|
29583
|
+
if (pr.mergeable === "CONFLICTING") return chalk185.red("conflicting");
|
|
29552
29584
|
if (pr.mergeable === "MERGEABLE") return null;
|
|
29553
|
-
return
|
|
29585
|
+
return chalk185.dim(`mergeable: ${pr.mergeable.toLowerCase()}`);
|
|
29554
29586
|
}
|
|
29555
29587
|
function printPrStatus(pr) {
|
|
29556
29588
|
console.log(
|
|
29557
|
-
` ${
|
|
29589
|
+
` ${chalk185.cyan(`#${pr.number}`)} ${pr.title} ${chalk185.dim(`(${pr.author}, ${updated(pr)})`)}${flags(pr)}`
|
|
29558
29590
|
);
|
|
29559
29591
|
const details = [
|
|
29560
29592
|
reviewLine(pr),
|
|
29561
29593
|
...checkLines(pr),
|
|
29562
29594
|
threadsLine(pr),
|
|
29563
29595
|
mergeableLine(pr),
|
|
29564
|
-
|
|
29596
|
+
chalk185.dim(pr.url)
|
|
29565
29597
|
];
|
|
29566
29598
|
for (const detail of details) {
|
|
29567
29599
|
if (detail) console.log(` ${detail}`);
|
|
@@ -29572,17 +29604,17 @@ function printPrStatus(pr) {
|
|
|
29572
29604
|
function printPrsStatus(report) {
|
|
29573
29605
|
for (const repo of report.repos) {
|
|
29574
29606
|
const count8 = repo.pullRequests.length;
|
|
29575
|
-
console.log(`${
|
|
29607
|
+
console.log(`${chalk186.bold(repo.repo)} ${chalk186.dim(`(${count8} open)`)}`);
|
|
29576
29608
|
for (const pr of repo.pullRequests) {
|
|
29577
29609
|
printPrStatus(pr);
|
|
29578
29610
|
}
|
|
29579
|
-
if (count8 === 0) console.log(
|
|
29611
|
+
if (count8 === 0) console.log(chalk186.dim(" no open pull requests"));
|
|
29580
29612
|
console.log();
|
|
29581
29613
|
}
|
|
29582
29614
|
if (report.errors.length === 0) return;
|
|
29583
|
-
console.log(
|
|
29615
|
+
console.log(chalk186.bold("Errors"));
|
|
29584
29616
|
for (const failure of report.errors) {
|
|
29585
|
-
console.log(` ${
|
|
29617
|
+
console.log(` ${chalk186.red(failure.repo)}: ${failure.error}`);
|
|
29586
29618
|
}
|
|
29587
29619
|
console.log();
|
|
29588
29620
|
}
|
|
@@ -29801,10 +29833,10 @@ function registerPrs(program2) {
|
|
|
29801
29833
|
}
|
|
29802
29834
|
|
|
29803
29835
|
// src/commands/ravendb/ravendbAuth.ts
|
|
29804
|
-
import
|
|
29836
|
+
import chalk192 from "chalk";
|
|
29805
29837
|
|
|
29806
29838
|
// src/shared/createConnectionAuth.ts
|
|
29807
|
-
import
|
|
29839
|
+
import chalk187 from "chalk";
|
|
29808
29840
|
function listConnections(connections, format2) {
|
|
29809
29841
|
if (connections.length === 0) {
|
|
29810
29842
|
console.log("No connections configured.");
|
|
@@ -29817,7 +29849,7 @@ function listConnections(connections, format2) {
|
|
|
29817
29849
|
function removeConnection(connections, name, save) {
|
|
29818
29850
|
const filtered = connections.filter((c) => c.name !== name);
|
|
29819
29851
|
if (filtered.length === connections.length) {
|
|
29820
|
-
console.error(
|
|
29852
|
+
console.error(chalk187.red(`Connection "${name}" not found.`));
|
|
29821
29853
|
process.exit(1);
|
|
29822
29854
|
}
|
|
29823
29855
|
save(filtered);
|
|
@@ -29863,15 +29895,15 @@ function saveConnections(connections) {
|
|
|
29863
29895
|
}
|
|
29864
29896
|
|
|
29865
29897
|
// src/commands/ravendb/promptConnection.ts
|
|
29866
|
-
import
|
|
29898
|
+
import chalk190 from "chalk";
|
|
29867
29899
|
|
|
29868
29900
|
// src/commands/ravendb/selectOpSecret.ts
|
|
29869
|
-
import
|
|
29901
|
+
import chalk189 from "chalk";
|
|
29870
29902
|
import Enquirer2 from "enquirer";
|
|
29871
29903
|
|
|
29872
29904
|
// src/commands/ravendb/searchItems.ts
|
|
29873
29905
|
import { execSync as execSync49 } from "child_process";
|
|
29874
|
-
import
|
|
29906
|
+
import chalk188 from "chalk";
|
|
29875
29907
|
function opExec(args) {
|
|
29876
29908
|
return execSync49(`op ${args}`, {
|
|
29877
29909
|
encoding: "utf8",
|
|
@@ -29884,7 +29916,7 @@ function searchItems(search2) {
|
|
|
29884
29916
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
29885
29917
|
} catch {
|
|
29886
29918
|
console.error(
|
|
29887
|
-
|
|
29919
|
+
chalk188.red(
|
|
29888
29920
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
29889
29921
|
)
|
|
29890
29922
|
);
|
|
@@ -29898,7 +29930,7 @@ function getItemFields(itemId2) {
|
|
|
29898
29930
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
29899
29931
|
return item.fields.filter((f) => f.reference && f.label);
|
|
29900
29932
|
} catch {
|
|
29901
|
-
console.error(
|
|
29933
|
+
console.error(chalk188.red("Failed to get item details from 1Password."));
|
|
29902
29934
|
process.exit(1);
|
|
29903
29935
|
}
|
|
29904
29936
|
}
|
|
@@ -29917,7 +29949,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
29917
29949
|
}).run();
|
|
29918
29950
|
const items2 = searchItems(search2);
|
|
29919
29951
|
if (items2.length === 0) {
|
|
29920
|
-
console.error(
|
|
29952
|
+
console.error(chalk189.red(`No items found matching "${search2}".`));
|
|
29921
29953
|
process.exit(1);
|
|
29922
29954
|
}
|
|
29923
29955
|
const itemId2 = await selectOne(
|
|
@@ -29926,7 +29958,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
29926
29958
|
);
|
|
29927
29959
|
const fields = getItemFields(itemId2);
|
|
29928
29960
|
if (fields.length === 0) {
|
|
29929
|
-
console.error(
|
|
29961
|
+
console.error(chalk189.red("No fields with references found on this item."));
|
|
29930
29962
|
process.exit(1);
|
|
29931
29963
|
}
|
|
29932
29964
|
const ref = await selectOne(
|
|
@@ -29940,7 +29972,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
29940
29972
|
async function promptConnection(existingNames) {
|
|
29941
29973
|
const name = await promptInput("name", "Connection name:");
|
|
29942
29974
|
if (existingNames.includes(name)) {
|
|
29943
|
-
console.error(
|
|
29975
|
+
console.error(chalk190.red(`Connection "${name}" already exists.`));
|
|
29944
29976
|
process.exit(1);
|
|
29945
29977
|
}
|
|
29946
29978
|
const url = await promptInput(
|
|
@@ -29949,22 +29981,22 @@ async function promptConnection(existingNames) {
|
|
|
29949
29981
|
);
|
|
29950
29982
|
const database = await promptInput("database", "Database name:");
|
|
29951
29983
|
if (!name || !url || !database) {
|
|
29952
|
-
console.error(
|
|
29984
|
+
console.error(chalk190.red("All fields are required."));
|
|
29953
29985
|
process.exit(1);
|
|
29954
29986
|
}
|
|
29955
29987
|
const apiKeyRef = await selectOpSecret();
|
|
29956
|
-
console.log(
|
|
29988
|
+
console.log(chalk190.dim(`Using: ${apiKeyRef}`));
|
|
29957
29989
|
return { name, url, database, apiKeyRef };
|
|
29958
29990
|
}
|
|
29959
29991
|
|
|
29960
29992
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
29961
|
-
import
|
|
29993
|
+
import chalk191 from "chalk";
|
|
29962
29994
|
function ravendbSetConnection(name) {
|
|
29963
29995
|
const raw = loadGlobalConfigRaw();
|
|
29964
29996
|
const ravendb = raw.ravendb ?? {};
|
|
29965
29997
|
const connections = ravendb.connections ?? [];
|
|
29966
29998
|
if (!connections.some((c) => c.name === name)) {
|
|
29967
|
-
console.error(
|
|
29999
|
+
console.error(chalk191.red(`Connection "${name}" not found.`));
|
|
29968
30000
|
console.error(
|
|
29969
30001
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
29970
30002
|
);
|
|
@@ -29980,16 +30012,16 @@ function ravendbSetConnection(name) {
|
|
|
29980
30012
|
var ravendbAuth = createConnectionAuth({
|
|
29981
30013
|
load: loadConnections,
|
|
29982
30014
|
save: saveConnections,
|
|
29983
|
-
format: (c) => `${
|
|
30015
|
+
format: (c) => `${chalk192.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
29984
30016
|
promptNew: promptConnection,
|
|
29985
30017
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
29986
30018
|
});
|
|
29987
30019
|
|
|
29988
30020
|
// src/commands/ravendb/ravendbCollections.ts
|
|
29989
|
-
import
|
|
30021
|
+
import chalk196 from "chalk";
|
|
29990
30022
|
|
|
29991
30023
|
// src/commands/ravendb/ravenFetch.ts
|
|
29992
|
-
import
|
|
30024
|
+
import chalk194 from "chalk";
|
|
29993
30025
|
|
|
29994
30026
|
// src/commands/ravendb/getAccessToken.ts
|
|
29995
30027
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -30026,10 +30058,10 @@ ${errorText}`
|
|
|
30026
30058
|
|
|
30027
30059
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
30028
30060
|
import { execSync as execSync50 } from "child_process";
|
|
30029
|
-
import
|
|
30061
|
+
import chalk193 from "chalk";
|
|
30030
30062
|
function resolveOpSecret(reference2) {
|
|
30031
30063
|
if (!reference2.startsWith("op://")) {
|
|
30032
|
-
console.error(
|
|
30064
|
+
console.error(chalk193.red(`Invalid secret reference: must start with op://`));
|
|
30033
30065
|
process.exit(1);
|
|
30034
30066
|
}
|
|
30035
30067
|
try {
|
|
@@ -30039,7 +30071,7 @@ function resolveOpSecret(reference2) {
|
|
|
30039
30071
|
}).trim();
|
|
30040
30072
|
} catch {
|
|
30041
30073
|
console.error(
|
|
30042
|
-
|
|
30074
|
+
chalk193.red(
|
|
30043
30075
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
30044
30076
|
)
|
|
30045
30077
|
);
|
|
@@ -30066,7 +30098,7 @@ async function ravenFetch(connection, path106) {
|
|
|
30066
30098
|
if (!response.ok) {
|
|
30067
30099
|
const body = await response.text();
|
|
30068
30100
|
console.error(
|
|
30069
|
-
|
|
30101
|
+
chalk194.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
30070
30102
|
);
|
|
30071
30103
|
console.error(body.substring(0, 500));
|
|
30072
30104
|
process.exit(1);
|
|
@@ -30075,7 +30107,7 @@ async function ravenFetch(connection, path106) {
|
|
|
30075
30107
|
}
|
|
30076
30108
|
|
|
30077
30109
|
// src/commands/ravendb/resolveConnection.ts
|
|
30078
|
-
import
|
|
30110
|
+
import chalk195 from "chalk";
|
|
30079
30111
|
function loadRavendb() {
|
|
30080
30112
|
const raw = loadGlobalConfigRaw();
|
|
30081
30113
|
const ravendb = raw.ravendb;
|
|
@@ -30089,7 +30121,7 @@ function resolveConnection(name) {
|
|
|
30089
30121
|
const connectionName = name ?? defaultConnection;
|
|
30090
30122
|
if (!connectionName) {
|
|
30091
30123
|
console.error(
|
|
30092
|
-
|
|
30124
|
+
chalk195.red(
|
|
30093
30125
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
30094
30126
|
)
|
|
30095
30127
|
);
|
|
@@ -30097,7 +30129,7 @@ function resolveConnection(name) {
|
|
|
30097
30129
|
}
|
|
30098
30130
|
const connection = connections.find((c) => c.name === connectionName);
|
|
30099
30131
|
if (!connection) {
|
|
30100
|
-
console.error(
|
|
30132
|
+
console.error(chalk195.red(`Connection "${connectionName}" not found.`));
|
|
30101
30133
|
console.error(
|
|
30102
30134
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
30103
30135
|
);
|
|
@@ -30128,15 +30160,15 @@ async function ravendbCollections(connectionName) {
|
|
|
30128
30160
|
return;
|
|
30129
30161
|
}
|
|
30130
30162
|
for (const c of collections) {
|
|
30131
|
-
console.log(`${
|
|
30163
|
+
console.log(`${chalk196.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
30132
30164
|
}
|
|
30133
30165
|
}
|
|
30134
30166
|
|
|
30135
30167
|
// src/commands/ravendb/ravendbQuery.ts
|
|
30136
|
-
import
|
|
30168
|
+
import chalk198 from "chalk";
|
|
30137
30169
|
|
|
30138
30170
|
// src/commands/ravendb/fetchAllPages.ts
|
|
30139
|
-
import
|
|
30171
|
+
import chalk197 from "chalk";
|
|
30140
30172
|
|
|
30141
30173
|
// src/commands/ravendb/buildQueryPath.ts
|
|
30142
30174
|
function buildQueryPath(opts) {
|
|
@@ -30174,7 +30206,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
30174
30206
|
allResults.push(...results);
|
|
30175
30207
|
start2 += results.length;
|
|
30176
30208
|
process.stderr.write(
|
|
30177
|
-
`\r${
|
|
30209
|
+
`\r${chalk197.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
30178
30210
|
);
|
|
30179
30211
|
if (start2 >= totalResults) break;
|
|
30180
30212
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -30189,7 +30221,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
30189
30221
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
30190
30222
|
const resolved = resolveArgs(connectionName, collection);
|
|
30191
30223
|
if (!resolved.collection && !options2.query) {
|
|
30192
|
-
console.error(
|
|
30224
|
+
console.error(chalk198.red("Provide a collection name or --query filter."));
|
|
30193
30225
|
process.exit(1);
|
|
30194
30226
|
}
|
|
30195
30227
|
const { collection: col } = resolved;
|
|
@@ -30224,7 +30256,7 @@ function registerRavendb(program2) {
|
|
|
30224
30256
|
}
|
|
30225
30257
|
|
|
30226
30258
|
// src/commands/releases/releasesConfigure.ts
|
|
30227
|
-
import
|
|
30259
|
+
import chalk200 from "chalk";
|
|
30228
30260
|
|
|
30229
30261
|
// src/commands/releases/checkStreamGraph.ts
|
|
30230
30262
|
function nodeIds(stream) {
|
|
@@ -30286,26 +30318,26 @@ function readStreamsInput(source) {
|
|
|
30286
30318
|
}
|
|
30287
30319
|
|
|
30288
30320
|
// src/commands/releases/reportDerivedStreams.ts
|
|
30289
|
-
import
|
|
30321
|
+
import chalk199 from "chalk";
|
|
30290
30322
|
function printDerived(stream) {
|
|
30291
30323
|
const environments = stream.nodes.flatMap((n) => n.environment ?? []);
|
|
30292
30324
|
const steps = stream.nodes.filter((n) => !n.environment);
|
|
30293
30325
|
console.log(
|
|
30294
|
-
`${
|
|
30326
|
+
`${chalk199.bold(stream.name)} ${chalk199.dim(`${stream.repo} \xB7 ${stream.workflow}`)}`
|
|
30295
30327
|
);
|
|
30296
30328
|
console.log(
|
|
30297
|
-
` environments: ${environments.join(", ") ||
|
|
30329
|
+
` environments: ${environments.join(", ") || chalk199.dim("none")}`
|
|
30298
30330
|
);
|
|
30299
30331
|
if (steps.length > 0)
|
|
30300
30332
|
console.log(
|
|
30301
30333
|
` steps: ${steps.map((n) => `${n.id} [${n.kind ?? "step"}]`).join(", ")}`
|
|
30302
30334
|
);
|
|
30303
30335
|
const edges = stream.edges.map(([from, to]) => `${from} \u2192 ${to}`);
|
|
30304
|
-
console.log(` edges: ${edges.join(", ") ||
|
|
30336
|
+
console.log(` edges: ${edges.join(", ") || chalk199.dim("none")}`);
|
|
30305
30337
|
}
|
|
30306
30338
|
function reportDerivedStreams(streams, target) {
|
|
30307
30339
|
for (const stream of streams) printDerived(stream);
|
|
30308
|
-
console.log(
|
|
30340
|
+
console.log(chalk199.dim(`Written to ${target}`));
|
|
30309
30341
|
}
|
|
30310
30342
|
|
|
30311
30343
|
// src/commands/releases/withCurrentRepo.ts
|
|
@@ -30397,8 +30429,8 @@ function writeReleaseStreams(incoming, scope) {
|
|
|
30397
30429
|
|
|
30398
30430
|
// src/commands/releases/releasesConfigure.ts
|
|
30399
30431
|
function fail6(message3, details = []) {
|
|
30400
|
-
console.error(
|
|
30401
|
-
for (const detail of details) console.error(
|
|
30432
|
+
console.error(chalk200.red(message3));
|
|
30433
|
+
for (const detail of details) console.error(chalk200.red(` ${detail}`));
|
|
30402
30434
|
process.exitCode = 1;
|
|
30403
30435
|
}
|
|
30404
30436
|
function reportWritten(incoming, target) {
|
|
@@ -30430,23 +30462,23 @@ function releasesConfigure(options2 = {}) {
|
|
|
30430
30462
|
}
|
|
30431
30463
|
|
|
30432
30464
|
// src/commands/releases/releasesList.ts
|
|
30433
|
-
import
|
|
30465
|
+
import chalk201 from "chalk";
|
|
30434
30466
|
function describeNode(node) {
|
|
30435
30467
|
if (node.environment) return `${node.id} \u2192 ${node.environment}`;
|
|
30436
30468
|
return `${node.id} (${node.kind ?? "step"})`;
|
|
30437
30469
|
}
|
|
30438
30470
|
function printStream(stream) {
|
|
30439
|
-
console.log(`${
|
|
30440
|
-
console.log(
|
|
30471
|
+
console.log(`${chalk201.bold(stream.name)} ${chalk201.dim(stream.repo)}`);
|
|
30472
|
+
console.log(chalk201.dim(` workflow: ${stream.workflow}`));
|
|
30441
30473
|
for (const node of stream.nodes) console.log(` ${describeNode(node)}`);
|
|
30442
30474
|
for (const [from, to] of stream.edges)
|
|
30443
|
-
console.log(
|
|
30475
|
+
console.log(chalk201.dim(` ${from} \u2192 ${to}`));
|
|
30444
30476
|
}
|
|
30445
30477
|
function releasesList() {
|
|
30446
30478
|
const streams = loadConfig().releases?.streams ?? [];
|
|
30447
30479
|
if (streams.length === 0) {
|
|
30448
30480
|
console.log(
|
|
30449
|
-
|
|
30481
|
+
chalk201.dim("No release streams configured under releases.streams.")
|
|
30450
30482
|
);
|
|
30451
30483
|
return;
|
|
30452
30484
|
}
|
|
@@ -30491,7 +30523,7 @@ function coverage() {
|
|
|
30491
30523
|
|
|
30492
30524
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
30493
30525
|
import path44 from "path";
|
|
30494
|
-
import
|
|
30526
|
+
import chalk203 from "chalk";
|
|
30495
30527
|
|
|
30496
30528
|
// src/commands/lint/lint/checkFileNames.ts
|
|
30497
30529
|
import fs24 from "fs";
|
|
@@ -30571,7 +30603,7 @@ function checkFileNames() {
|
|
|
30571
30603
|
}
|
|
30572
30604
|
|
|
30573
30605
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
30574
|
-
import
|
|
30606
|
+
import chalk202 from "chalk";
|
|
30575
30607
|
|
|
30576
30608
|
// src/commands/lint/lint/applyMoves.ts
|
|
30577
30609
|
import fs25 from "fs";
|
|
@@ -30656,25 +30688,25 @@ function fixFileNameViolations(moves) {
|
|
|
30656
30688
|
const start2 = performance.now();
|
|
30657
30689
|
const project = createLintProject();
|
|
30658
30690
|
const cwd = process.cwd();
|
|
30659
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
30691
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk202.green(line)));
|
|
30660
30692
|
const ms = (performance.now() - start2).toFixed(0);
|
|
30661
|
-
console.log(
|
|
30693
|
+
console.log(chalk202.dim(` Done in ${ms}ms`));
|
|
30662
30694
|
}
|
|
30663
30695
|
|
|
30664
30696
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
30665
30697
|
function reportViolations(violations) {
|
|
30666
|
-
console.error(
|
|
30698
|
+
console.error(chalk203.red("\nFile name check failed:\n"));
|
|
30667
30699
|
console.error(
|
|
30668
|
-
|
|
30700
|
+
chalk203.red(
|
|
30669
30701
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
30670
30702
|
)
|
|
30671
30703
|
);
|
|
30672
30704
|
for (const violation of violations) {
|
|
30673
|
-
console.error(
|
|
30674
|
-
console.error(
|
|
30705
|
+
console.error(chalk203.red(` ${violation.filePath}`));
|
|
30706
|
+
console.error(chalk203.gray(` Rename to: ${violation.suggestedName}
|
|
30675
30707
|
`));
|
|
30676
30708
|
}
|
|
30677
|
-
console.error(
|
|
30709
|
+
console.error(chalk203.dim(" Run with -f to auto-fix.\n"));
|
|
30678
30710
|
}
|
|
30679
30711
|
function runFileNameCheck(fix = false) {
|
|
30680
30712
|
const violations = checkFileNames();
|
|
@@ -30703,17 +30735,17 @@ function runFileNameCheck(fix = false) {
|
|
|
30703
30735
|
import fs27 from "fs";
|
|
30704
30736
|
|
|
30705
30737
|
// src/commands/lint/shared.ts
|
|
30706
|
-
import
|
|
30738
|
+
import chalk204 from "chalk";
|
|
30707
30739
|
function reportViolations2(violations, checkName2, errorMessage2, successMessage) {
|
|
30708
30740
|
if (violations.length > 0) {
|
|
30709
|
-
console.error(
|
|
30741
|
+
console.error(chalk204.red(`
|
|
30710
30742
|
${checkName2} failed:
|
|
30711
30743
|
`));
|
|
30712
|
-
console.error(
|
|
30744
|
+
console.error(chalk204.red(` ${errorMessage2}
|
|
30713
30745
|
`));
|
|
30714
30746
|
for (const violation of violations) {
|
|
30715
|
-
console.error(
|
|
30716
|
-
console.error(
|
|
30747
|
+
console.error(chalk204.red(` ${violation.filePath}:${violation.line}`));
|
|
30748
|
+
console.error(chalk204.gray(` ${violation.content}
|
|
30717
30749
|
`));
|
|
30718
30750
|
}
|
|
30719
30751
|
return false;
|
|
@@ -30843,8 +30875,8 @@ async function notify() {
|
|
|
30843
30875
|
import { execSync as execSync52 } from "child_process";
|
|
30844
30876
|
import { existsSync as existsSync63, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync38 } from "fs";
|
|
30845
30877
|
import { tmpdir as tmpdir8 } from "os";
|
|
30846
|
-
import { join as
|
|
30847
|
-
import
|
|
30878
|
+
import { join as join77, resolve as resolve22 } from "path";
|
|
30879
|
+
import chalk205 from "chalk";
|
|
30848
30880
|
|
|
30849
30881
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
30850
30882
|
var captureWindowPs1 = `
|
|
@@ -30980,7 +31012,7 @@ function buildOutputPath(outputDir, processName) {
|
|
|
30980
31012
|
return resolve22(outputDir, `${processName}-${timestamp5}.png`);
|
|
30981
31013
|
}
|
|
30982
31014
|
function runPowerShellScript(processName, outputPath) {
|
|
30983
|
-
const scriptPath =
|
|
31015
|
+
const scriptPath = join77(tmpdir8(), `assist-screenshot-${Date.now()}.ps1`);
|
|
30984
31016
|
writeFileSync38(scriptPath, captureWindowPs1, "utf8");
|
|
30985
31017
|
try {
|
|
30986
31018
|
execSync52(
|
|
@@ -30995,19 +31027,19 @@ function screenshot(processName) {
|
|
|
30995
31027
|
const config = loadConfig();
|
|
30996
31028
|
const outputDir = resolve22(config.screenshot.outputDir);
|
|
30997
31029
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
30998
|
-
console.log(
|
|
31030
|
+
console.log(chalk205.gray(`Capturing window for process "${processName}" ...`));
|
|
30999
31031
|
try {
|
|
31000
31032
|
runPowerShellScript(processName, outputPath);
|
|
31001
|
-
console.log(
|
|
31033
|
+
console.log(chalk205.green(`Screenshot saved: ${outputPath}`));
|
|
31002
31034
|
} catch (error) {
|
|
31003
31035
|
const msg = error instanceof Error ? error.message : String(error);
|
|
31004
|
-
console.error(
|
|
31036
|
+
console.error(chalk205.red(`Failed to capture screenshot: ${msg}`));
|
|
31005
31037
|
process.exit(1);
|
|
31006
31038
|
}
|
|
31007
31039
|
}
|
|
31008
31040
|
|
|
31009
31041
|
// src/commands/statusLine.ts
|
|
31010
|
-
import
|
|
31042
|
+
import chalk207 from "chalk";
|
|
31011
31043
|
|
|
31012
31044
|
// src/shared/contextLevel.ts
|
|
31013
31045
|
var THRESHOLDS = {
|
|
@@ -31023,7 +31055,7 @@ function contextLevel(pct, harness) {
|
|
|
31023
31055
|
}
|
|
31024
31056
|
|
|
31025
31057
|
// src/commands/buildLimitsSegment.ts
|
|
31026
|
-
import
|
|
31058
|
+
import chalk206 from "chalk";
|
|
31027
31059
|
|
|
31028
31060
|
// src/shared/rateLimitLevel.ts
|
|
31029
31061
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -31061,9 +31093,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
31061
31093
|
|
|
31062
31094
|
// src/commands/buildLimitsSegment.ts
|
|
31063
31095
|
var LEVEL_COLOR = {
|
|
31064
|
-
ok:
|
|
31065
|
-
warn:
|
|
31066
|
-
over:
|
|
31096
|
+
ok: chalk206.green,
|
|
31097
|
+
warn: chalk206.yellow,
|
|
31098
|
+
over: chalk206.red
|
|
31067
31099
|
};
|
|
31068
31100
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
31069
31101
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -31095,9 +31127,9 @@ function buildLimitsSegment(rateLimits) {
|
|
|
31095
31127
|
|
|
31096
31128
|
// src/commands/readGitBranch.ts
|
|
31097
31129
|
import { readFileSync as readFileSync46, statSync as statSync10 } from "fs";
|
|
31098
|
-
import { isAbsolute as isAbsolute6, join as
|
|
31130
|
+
import { isAbsolute as isAbsolute6, join as join78, resolve as resolve23 } from "path";
|
|
31099
31131
|
function resolveGitDir(cwd) {
|
|
31100
|
-
const dotGit =
|
|
31132
|
+
const dotGit = join78(cwd, ".git");
|
|
31101
31133
|
let stat5;
|
|
31102
31134
|
try {
|
|
31103
31135
|
stat5 = statSync10(dotGit);
|
|
@@ -31127,7 +31159,7 @@ function readGitBranch(cwd) {
|
|
|
31127
31159
|
}
|
|
31128
31160
|
let head;
|
|
31129
31161
|
try {
|
|
31130
|
-
head = readFileSync46(
|
|
31162
|
+
head = readFileSync46(join78(gitDir, "HEAD"), "utf8");
|
|
31131
31163
|
} catch {
|
|
31132
31164
|
return null;
|
|
31133
31165
|
}
|
|
@@ -31159,7 +31191,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
31159
31191
|
}
|
|
31160
31192
|
|
|
31161
31193
|
// src/commands/statusLine.ts
|
|
31162
|
-
|
|
31194
|
+
chalk207.level = 3;
|
|
31163
31195
|
function formatNumber(num) {
|
|
31164
31196
|
return num.toLocaleString("en-US");
|
|
31165
31197
|
}
|
|
@@ -31167,9 +31199,9 @@ function colorizePercent(pct) {
|
|
|
31167
31199
|
const label2 = `${Math.round(pct)}%`;
|
|
31168
31200
|
switch (contextLevel(pct)) {
|
|
31169
31201
|
case "red":
|
|
31170
|
-
return
|
|
31202
|
+
return chalk207.red(label2);
|
|
31171
31203
|
case "yellow":
|
|
31172
|
-
return
|
|
31204
|
+
return chalk207.yellow(label2);
|
|
31173
31205
|
default:
|
|
31174
31206
|
return label2;
|
|
31175
31207
|
}
|
|
@@ -31182,7 +31214,7 @@ async function statusLine() {
|
|
|
31182
31214
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
31183
31215
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
31184
31216
|
const branch2 = dir ? readGitBranch(dir) : null;
|
|
31185
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
31217
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk207.cyan(branch2)} | ` : "";
|
|
31186
31218
|
console.log(
|
|
31187
31219
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
31188
31220
|
);
|
|
@@ -31285,7 +31317,7 @@ import { spawn as spawn7 } from "child_process";
|
|
|
31285
31317
|
import * as path46 from "path";
|
|
31286
31318
|
|
|
31287
31319
|
// src/commands/refactor/logViolations.ts
|
|
31288
|
-
import
|
|
31320
|
+
import chalk208 from "chalk";
|
|
31289
31321
|
var DEFAULT_MAX_LINES2 = 100;
|
|
31290
31322
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
31291
31323
|
if (violations.length === 0) {
|
|
@@ -31294,43 +31326,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
31294
31326
|
}
|
|
31295
31327
|
return;
|
|
31296
31328
|
}
|
|
31297
|
-
console.error(
|
|
31329
|
+
console.error(chalk208.red(`
|
|
31298
31330
|
Refactor check failed:
|
|
31299
31331
|
`));
|
|
31300
|
-
console.error(
|
|
31332
|
+
console.error(chalk208.red(` The following files exceed ${maxLines} lines:
|
|
31301
31333
|
`));
|
|
31302
31334
|
for (const violation of violations) {
|
|
31303
|
-
console.error(
|
|
31335
|
+
console.error(chalk208.red(` ${violation.file} (${violation.lines} lines)`));
|
|
31304
31336
|
}
|
|
31305
31337
|
console.error(
|
|
31306
|
-
|
|
31338
|
+
chalk208.yellow(
|
|
31307
31339
|
`
|
|
31308
31340
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
31309
31341
|
way to refactor it, ignore it with:
|
|
31310
31342
|
`
|
|
31311
31343
|
)
|
|
31312
31344
|
);
|
|
31313
|
-
console.error(
|
|
31345
|
+
console.error(chalk208.gray(` assist refactor ignore <file>
|
|
31314
31346
|
`));
|
|
31315
31347
|
if (process.env.CLAUDECODE) {
|
|
31316
|
-
console.error(
|
|
31348
|
+
console.error(chalk208.cyan(`
|
|
31317
31349
|
## Extracting Code to New Files
|
|
31318
31350
|
`));
|
|
31319
31351
|
console.error(
|
|
31320
|
-
|
|
31352
|
+
chalk208.cyan(
|
|
31321
31353
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
31322
31354
|
`
|
|
31323
31355
|
)
|
|
31324
31356
|
);
|
|
31325
31357
|
console.error(
|
|
31326
|
-
|
|
31358
|
+
chalk208.cyan(
|
|
31327
31359
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
31328
31360
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
31329
31361
|
`
|
|
31330
31362
|
)
|
|
31331
31363
|
);
|
|
31332
31364
|
console.error(
|
|
31333
|
-
|
|
31365
|
+
chalk208.cyan(
|
|
31334
31366
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
31335
31367
|
domains, move it to a common/shared folder.
|
|
31336
31368
|
`
|
|
@@ -31486,7 +31518,7 @@ async function check(pattern2, options2) {
|
|
|
31486
31518
|
|
|
31487
31519
|
// src/commands/refactor/extract.ts
|
|
31488
31520
|
import path54 from "path";
|
|
31489
|
-
import
|
|
31521
|
+
import chalk211 from "chalk";
|
|
31490
31522
|
|
|
31491
31523
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
31492
31524
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -32094,23 +32126,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
32094
32126
|
|
|
32095
32127
|
// src/commands/refactor/extract/displayPlan.ts
|
|
32096
32128
|
import path50 from "path";
|
|
32097
|
-
import
|
|
32129
|
+
import chalk209 from "chalk";
|
|
32098
32130
|
function section(title) {
|
|
32099
32131
|
return `
|
|
32100
|
-
${
|
|
32132
|
+
${chalk209.cyan(title)}`;
|
|
32101
32133
|
}
|
|
32102
32134
|
function displayImporters(plan2, cwd) {
|
|
32103
32135
|
if (plan2.importersToUpdate.length === 0) return;
|
|
32104
32136
|
console.log(section("Update importers:"));
|
|
32105
32137
|
for (const imp of plan2.importersToUpdate) {
|
|
32106
32138
|
const rel = path50.relative(cwd, imp.file.getFilePath());
|
|
32107
|
-
console.log(` ${
|
|
32139
|
+
console.log(` ${chalk209.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
32108
32140
|
}
|
|
32109
32141
|
}
|
|
32110
32142
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
32111
|
-
console.log(
|
|
32143
|
+
console.log(chalk209.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
32112
32144
|
`));
|
|
32113
|
-
console.log(` ${
|
|
32145
|
+
console.log(` ${chalk209.cyan("Functions to move:")}`);
|
|
32114
32146
|
for (const name of plan2.extractedNames) {
|
|
32115
32147
|
console.log(` ${name}`);
|
|
32116
32148
|
}
|
|
@@ -32144,7 +32176,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
32144
32176
|
|
|
32145
32177
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
32146
32178
|
import path53 from "path";
|
|
32147
|
-
import
|
|
32179
|
+
import chalk210 from "chalk";
|
|
32148
32180
|
import { Project as Project3 } from "ts-morph";
|
|
32149
32181
|
|
|
32150
32182
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -32236,7 +32268,7 @@ function loadProjectFile(file) {
|
|
|
32236
32268
|
});
|
|
32237
32269
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
32238
32270
|
if (!sourceFile) {
|
|
32239
|
-
console.log(
|
|
32271
|
+
console.log(chalk210.red(`File not found in project: ${file}`));
|
|
32240
32272
|
process.exit(1);
|
|
32241
32273
|
}
|
|
32242
32274
|
return { project, sourceFile };
|
|
@@ -32259,19 +32291,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
32259
32291
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
32260
32292
|
if (options2.apply) {
|
|
32261
32293
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
32262
|
-
console.log(
|
|
32294
|
+
console.log(chalk211.green("\nExtraction complete"));
|
|
32263
32295
|
} else {
|
|
32264
|
-
console.log(
|
|
32296
|
+
console.log(chalk211.dim("\nDry run. Use --apply to execute."));
|
|
32265
32297
|
}
|
|
32266
32298
|
}
|
|
32267
32299
|
|
|
32268
32300
|
// src/commands/refactor/ignore.ts
|
|
32269
32301
|
import fs33 from "fs";
|
|
32270
|
-
import
|
|
32302
|
+
import chalk212 from "chalk";
|
|
32271
32303
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
32272
32304
|
function ignore2(file) {
|
|
32273
32305
|
if (!fs33.existsSync(file)) {
|
|
32274
|
-
console.error(
|
|
32306
|
+
console.error(chalk212.red(`Error: File does not exist: ${file}`));
|
|
32275
32307
|
process.exit(1);
|
|
32276
32308
|
}
|
|
32277
32309
|
const content = fs33.readFileSync(file, "utf8");
|
|
@@ -32287,7 +32319,7 @@ function ignore2(file) {
|
|
|
32287
32319
|
fs33.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
32288
32320
|
}
|
|
32289
32321
|
console.log(
|
|
32290
|
-
|
|
32322
|
+
chalk212.green(
|
|
32291
32323
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
32292
32324
|
)
|
|
32293
32325
|
);
|
|
@@ -32296,12 +32328,12 @@ function ignore2(file) {
|
|
|
32296
32328
|
// src/commands/refactor/rename.ts
|
|
32297
32329
|
import fs36 from "fs";
|
|
32298
32330
|
import path60 from "path";
|
|
32299
|
-
import
|
|
32331
|
+
import chalk215 from "chalk";
|
|
32300
32332
|
|
|
32301
32333
|
// src/commands/refactor/rename/applyRename.ts
|
|
32302
32334
|
import fs35 from "fs";
|
|
32303
32335
|
import path56 from "path";
|
|
32304
|
-
import
|
|
32336
|
+
import chalk213 from "chalk";
|
|
32305
32337
|
|
|
32306
32338
|
// src/commands/refactor/restructure/computeRewrites.ts
|
|
32307
32339
|
import path55 from "path";
|
|
@@ -32407,13 +32439,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
32407
32439
|
const updatedContents = applyRewrites(rewrites);
|
|
32408
32440
|
for (const [file, content] of updatedContents) {
|
|
32409
32441
|
fs35.writeFileSync(file, content, "utf8");
|
|
32410
|
-
console.log(
|
|
32442
|
+
console.log(chalk213.cyan(` Updated imports in ${path56.relative(cwd, file)}`));
|
|
32411
32443
|
}
|
|
32412
32444
|
const destDir = path56.dirname(destPath);
|
|
32413
32445
|
if (!fs35.existsSync(destDir)) fs35.mkdirSync(destDir, { recursive: true });
|
|
32414
32446
|
fs35.renameSync(sourcePath, destPath);
|
|
32415
32447
|
console.log(
|
|
32416
|
-
|
|
32448
|
+
chalk213.white(
|
|
32417
32449
|
` Moved ${path56.relative(cwd, sourcePath)} \u2192 ${path56.relative(cwd, destPath)}`
|
|
32418
32450
|
)
|
|
32419
32451
|
);
|
|
@@ -32563,16 +32595,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
32563
32595
|
|
|
32564
32596
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
32565
32597
|
import path59 from "path";
|
|
32566
|
-
import
|
|
32598
|
+
import chalk214 from "chalk";
|
|
32567
32599
|
function printRenamePreview(rewrites, cwd) {
|
|
32568
32600
|
for (const rewrite of rewrites) {
|
|
32569
32601
|
console.log(
|
|
32570
|
-
|
|
32602
|
+
chalk214.dim(
|
|
32571
32603
|
` ${path59.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
32572
32604
|
)
|
|
32573
32605
|
);
|
|
32574
32606
|
}
|
|
32575
|
-
console.log(
|
|
32607
|
+
console.log(chalk214.dim("Dry run. Use --apply to execute."));
|
|
32576
32608
|
}
|
|
32577
32609
|
|
|
32578
32610
|
// src/commands/refactor/rename.ts
|
|
@@ -32583,20 +32615,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
32583
32615
|
const relSource = path60.relative(cwd, sourcePath);
|
|
32584
32616
|
const relDest = path60.relative(cwd, destPath);
|
|
32585
32617
|
if (!fs36.existsSync(sourcePath)) {
|
|
32586
|
-
console.log(
|
|
32618
|
+
console.log(chalk215.red(`File not found: ${source}`));
|
|
32587
32619
|
process.exit(1);
|
|
32588
32620
|
}
|
|
32589
32621
|
if (destPath !== sourcePath && fs36.existsSync(destPath)) {
|
|
32590
|
-
console.log(
|
|
32622
|
+
console.log(chalk215.red(`Destination already exists: ${destination}`));
|
|
32591
32623
|
process.exit(1);
|
|
32592
32624
|
}
|
|
32593
|
-
console.log(
|
|
32594
|
-
console.log(
|
|
32595
|
-
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..."));
|
|
32596
32628
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
32597
32629
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
32598
32630
|
console.log(
|
|
32599
|
-
|
|
32631
|
+
chalk215.dim(
|
|
32600
32632
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
32601
32633
|
)
|
|
32602
32634
|
);
|
|
@@ -32605,11 +32637,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
32605
32637
|
return;
|
|
32606
32638
|
}
|
|
32607
32639
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
32608
|
-
console.log(
|
|
32640
|
+
console.log(chalk215.green("Done"));
|
|
32609
32641
|
}
|
|
32610
32642
|
|
|
32611
32643
|
// src/commands/refactor/renameSymbol.ts
|
|
32612
|
-
import
|
|
32644
|
+
import chalk216 from "chalk";
|
|
32613
32645
|
|
|
32614
32646
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
32615
32647
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -32655,34 +32687,34 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
32655
32687
|
const { project, sourceFile } = loadProjectFile(file);
|
|
32656
32688
|
const symbol = findSymbol(sourceFile, oldName);
|
|
32657
32689
|
if (!symbol) {
|
|
32658
|
-
console.log(
|
|
32690
|
+
console.log(chalk216.red(`Symbol "${oldName}" not found in ${file}`));
|
|
32659
32691
|
process.exit(1);
|
|
32660
32692
|
}
|
|
32661
32693
|
const grouped = groupReferences(symbol, cwd);
|
|
32662
32694
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
32663
32695
|
console.log(
|
|
32664
|
-
|
|
32696
|
+
chalk216.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
32665
32697
|
`)
|
|
32666
32698
|
);
|
|
32667
32699
|
for (const [refFile, lines2] of grouped) {
|
|
32668
32700
|
console.log(
|
|
32669
|
-
` ${
|
|
32701
|
+
` ${chalk216.dim(refFile)}: lines ${chalk216.cyan(lines2.join(", "))}`
|
|
32670
32702
|
);
|
|
32671
32703
|
}
|
|
32672
32704
|
if (options2.apply) {
|
|
32673
32705
|
symbol.rename(newName);
|
|
32674
32706
|
await project.save();
|
|
32675
|
-
console.log(
|
|
32707
|
+
console.log(chalk216.green(`
|
|
32676
32708
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
32677
32709
|
} else {
|
|
32678
|
-
console.log(
|
|
32710
|
+
console.log(chalk216.dim("\nDry run. Use --apply to execute."));
|
|
32679
32711
|
}
|
|
32680
32712
|
}
|
|
32681
32713
|
|
|
32682
32714
|
// src/commands/refactor/restructure.ts
|
|
32683
32715
|
import fs38 from "fs";
|
|
32684
32716
|
import path80 from "path";
|
|
32685
|
-
import
|
|
32717
|
+
import chalk225 from "chalk";
|
|
32686
32718
|
|
|
32687
32719
|
// src/commands/refactor/restructure/buildPlan.ts
|
|
32688
32720
|
import path71 from "path";
|
|
@@ -33019,7 +33051,7 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
|
|
|
33019
33051
|
}
|
|
33020
33052
|
|
|
33021
33053
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
33022
|
-
import
|
|
33054
|
+
import chalk220 from "chalk";
|
|
33023
33055
|
|
|
33024
33056
|
// src/commands/refactor/restructure/applyCommand.ts
|
|
33025
33057
|
import path72 from "path";
|
|
@@ -33030,13 +33062,13 @@ function applyCommand(scopeRoot) {
|
|
|
33030
33062
|
|
|
33031
33063
|
// src/commands/refactor/restructure/displayDrift.ts
|
|
33032
33064
|
import path73 from "path";
|
|
33033
|
-
import
|
|
33065
|
+
import chalk217 from "chalk";
|
|
33034
33066
|
var shownMoves = 20;
|
|
33035
33067
|
function displayDrift(plan2, listMoves) {
|
|
33036
33068
|
const rel = (file) => path73.relative(process.cwd(), file);
|
|
33037
33069
|
if (plan2.moves.length > 0) {
|
|
33038
33070
|
console.log(
|
|
33039
|
-
|
|
33071
|
+
chalk217.red(
|
|
33040
33072
|
`${plan2.moves.length} file(s) drift from the plan${listMoves ? ":" : "."}`
|
|
33041
33073
|
)
|
|
33042
33074
|
);
|
|
@@ -33044,17 +33076,17 @@ function displayDrift(plan2, listMoves) {
|
|
|
33044
33076
|
for (const move2 of plan2.moves.slice(0, shownMoves))
|
|
33045
33077
|
console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
|
|
33046
33078
|
if (plan2.moves.length > shownMoves)
|
|
33047
|
-
console.log(
|
|
33079
|
+
console.log(chalk217.dim(` \u2026and ${plan2.moves.length - shownMoves} more`));
|
|
33048
33080
|
}
|
|
33049
33081
|
}
|
|
33050
|
-
for (const error of plan2.errors) console.log(
|
|
33082
|
+
for (const error of plan2.errors) console.log(chalk217.red(error));
|
|
33051
33083
|
}
|
|
33052
33084
|
|
|
33053
33085
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
33054
|
-
import
|
|
33086
|
+
import chalk219 from "chalk";
|
|
33055
33087
|
|
|
33056
33088
|
// src/commands/refactor/restructure/displayDeepChains.ts
|
|
33057
|
-
import
|
|
33089
|
+
import chalk218 from "chalk";
|
|
33058
33090
|
var shownChains = 10;
|
|
33059
33091
|
function formatChain(chain2) {
|
|
33060
33092
|
const folders = chain2.folders.map((f) => `${f.name} (${f.files})`).join(" > ");
|
|
@@ -33064,20 +33096,20 @@ function displayDeepChains(chains, maxDepth) {
|
|
|
33064
33096
|
if (chains.length === 0) return;
|
|
33065
33097
|
const tooDeep = chains.reduce((sum3, c) => sum3 + c.tooDeep, 0);
|
|
33066
33098
|
console.log(
|
|
33067
|
-
|
|
33099
|
+
chalk218.red(
|
|
33068
33100
|
`
|
|
33069
33101
|
Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
|
|
33070
33102
|
)
|
|
33071
33103
|
);
|
|
33072
33104
|
console.log(
|
|
33073
|
-
|
|
33105
|
+
chalk218.bold(
|
|
33074
33106
|
"Deep chains, as folder (files beneath), most files too deep first:"
|
|
33075
33107
|
)
|
|
33076
33108
|
);
|
|
33077
33109
|
for (const chain2 of chains.slice(0, shownChains))
|
|
33078
33110
|
console.log(formatChain(chain2));
|
|
33079
33111
|
if (chains.length > shownChains)
|
|
33080
|
-
console.log(
|
|
33112
|
+
console.log(chalk218.dim(` \u2026and ${chains.length - shownChains} more`));
|
|
33081
33113
|
}
|
|
33082
33114
|
|
|
33083
33115
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
@@ -33098,7 +33130,7 @@ function displayLayoutLimits(limits, apply) {
|
|
|
33098
33130
|
if (!exceedsLayoutLimits(limits)) return;
|
|
33099
33131
|
displayDeepChains(limits.chains, limits.maxDepth);
|
|
33100
33132
|
console.log("");
|
|
33101
|
-
for (const line of pinSteps(apply)) console.log(
|
|
33133
|
+
for (const line of pinSteps(apply)) console.log(chalk219.yellow(line));
|
|
33102
33134
|
}
|
|
33103
33135
|
|
|
33104
33136
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
@@ -33110,14 +33142,14 @@ function checkPlan(plan2, limits) {
|
|
|
33110
33142
|
if (exceeds || plan2.errors.length > 0) process.exit(1);
|
|
33111
33143
|
if (plan2.moves.length > 0) {
|
|
33112
33144
|
console.log(
|
|
33113
|
-
|
|
33145
|
+
chalk220.yellow(
|
|
33114
33146
|
`
|
|
33115
33147
|
Run \`${apply}\` to move the files and rewrite their imports.`
|
|
33116
33148
|
)
|
|
33117
33149
|
);
|
|
33118
33150
|
process.exit(1);
|
|
33119
33151
|
}
|
|
33120
|
-
console.log(
|
|
33152
|
+
console.log(chalk220.green("Layout matches the restructure plan"));
|
|
33121
33153
|
}
|
|
33122
33154
|
|
|
33123
33155
|
// src/commands/refactor/restructure/findDeepChains.ts
|
|
@@ -33179,15 +33211,15 @@ function partitionIgnored(files) {
|
|
|
33179
33211
|
}
|
|
33180
33212
|
|
|
33181
33213
|
// src/commands/refactor/restructure/runPlan.ts
|
|
33182
|
-
import
|
|
33214
|
+
import chalk224 from "chalk";
|
|
33183
33215
|
|
|
33184
33216
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
33185
|
-
import
|
|
33217
|
+
import chalk222 from "chalk";
|
|
33186
33218
|
|
|
33187
33219
|
// src/commands/refactor/restructure/executePlan.ts
|
|
33188
33220
|
import fs37 from "fs";
|
|
33189
33221
|
import path76 from "path";
|
|
33190
|
-
import
|
|
33222
|
+
import chalk221 from "chalk";
|
|
33191
33223
|
function relPath(file) {
|
|
33192
33224
|
return path76.relative(process.cwd(), file);
|
|
33193
33225
|
}
|
|
@@ -33204,14 +33236,14 @@ function moveFiles(moves) {
|
|
|
33204
33236
|
fs37.mkdirSync(path76.dirname(move2.to), { recursive: true });
|
|
33205
33237
|
fs37.renameSync(staging, move2.to);
|
|
33206
33238
|
console.log(
|
|
33207
|
-
|
|
33239
|
+
chalk221.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
|
|
33208
33240
|
);
|
|
33209
33241
|
}
|
|
33210
33242
|
}
|
|
33211
33243
|
function removeIfEmpty(dir) {
|
|
33212
33244
|
if (!fs37.existsSync(dir) || fs37.readdirSync(dir).length > 0) return false;
|
|
33213
33245
|
fs37.rmdirSync(dir);
|
|
33214
|
-
console.log(
|
|
33246
|
+
console.log(chalk221.dim(` Removed empty directory ${relPath(dir)}`));
|
|
33215
33247
|
return true;
|
|
33216
33248
|
}
|
|
33217
33249
|
function removeEmptyDirectories(dirs, scopeRoot) {
|
|
@@ -33224,7 +33256,7 @@ function removeEmptyDirectories(dirs, scopeRoot) {
|
|
|
33224
33256
|
function executePlan(plan2) {
|
|
33225
33257
|
for (const [file, content] of applyRewrites(plan2.rewrites)) {
|
|
33226
33258
|
fs37.writeFileSync(file, content, "utf8");
|
|
33227
|
-
console.log(
|
|
33259
|
+
console.log(chalk221.cyan(` Rewrote imports in ${relPath(file)}`));
|
|
33228
33260
|
}
|
|
33229
33261
|
moveFiles(plan2.moves);
|
|
33230
33262
|
removeEmptyDirectories(
|
|
@@ -33236,17 +33268,17 @@ function executePlan(plan2) {
|
|
|
33236
33268
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
33237
33269
|
function applyPlan(plan2) {
|
|
33238
33270
|
if (plan2.errors.length > 0) {
|
|
33239
|
-
console.log(
|
|
33271
|
+
console.log(chalk222.red("\nResolve the errors above before applying."));
|
|
33240
33272
|
process.exit(1);
|
|
33241
33273
|
}
|
|
33242
|
-
console.log(
|
|
33274
|
+
console.log(chalk222.bold("\nApplying changes..."));
|
|
33243
33275
|
executePlan(plan2);
|
|
33244
|
-
console.log(
|
|
33276
|
+
console.log(chalk222.green("\nRestructuring complete"));
|
|
33245
33277
|
}
|
|
33246
33278
|
|
|
33247
33279
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
33248
33280
|
import path79 from "path";
|
|
33249
|
-
import
|
|
33281
|
+
import chalk223 from "chalk";
|
|
33250
33282
|
|
|
33251
33283
|
// src/commands/refactor/restructure/computeDepthStats.ts
|
|
33252
33284
|
import path77 from "path";
|
|
@@ -33297,17 +33329,17 @@ function relPath2(filePath) {
|
|
|
33297
33329
|
}
|
|
33298
33330
|
function displayMoves(plan2) {
|
|
33299
33331
|
if (plan2.moves.length === 0) return;
|
|
33300
|
-
console.log(
|
|
33332
|
+
console.log(chalk223.bold("\nFile moves:"));
|
|
33301
33333
|
for (const move2 of plan2.moves) {
|
|
33302
33334
|
console.log(
|
|
33303
|
-
` ${
|
|
33335
|
+
` ${chalk223.red(relPath2(move2.from))} \u2192 ${chalk223.green(relPath2(move2.to))}`
|
|
33304
33336
|
);
|
|
33305
|
-
console.log(
|
|
33337
|
+
console.log(chalk223.dim(` ${move2.reason}`));
|
|
33306
33338
|
}
|
|
33307
33339
|
}
|
|
33308
33340
|
function displayTree(plan2) {
|
|
33309
33341
|
console.log(
|
|
33310
|
-
|
|
33342
|
+
chalk223.bold(`
|
|
33311
33343
|
Resulting tree (${relPath2(plan2.scopeRoot) || "."}/):`)
|
|
33312
33344
|
);
|
|
33313
33345
|
for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
|
|
@@ -33318,15 +33350,15 @@ function displayDepthStats(plan2) {
|
|
|
33318
33350
|
plan2.targets.values(),
|
|
33319
33351
|
plan2.scopeRoot
|
|
33320
33352
|
);
|
|
33321
|
-
console.log(
|
|
33353
|
+
console.log(chalk223.bold(`
|
|
33322
33354
|
Depth (max ${max}):`));
|
|
33323
33355
|
for (const depth of [...distribution.keys()].sort((a, b) => a - b))
|
|
33324
33356
|
console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
|
|
33325
33357
|
}
|
|
33326
33358
|
function displayErrors(errors) {
|
|
33327
33359
|
if (errors.length === 0) return;
|
|
33328
|
-
console.log(
|
|
33329
|
-
for (const error of errors) console.log(
|
|
33360
|
+
console.log(chalk223.red("\nErrors:"));
|
|
33361
|
+
for (const error of errors) console.log(chalk223.red(` ${error}`));
|
|
33330
33362
|
}
|
|
33331
33363
|
function displayPlan2(plan2) {
|
|
33332
33364
|
displayMoves(plan2);
|
|
@@ -33335,7 +33367,7 @@ function displayPlan2(plan2) {
|
|
|
33335
33367
|
displayErrors(plan2.errors);
|
|
33336
33368
|
const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
|
|
33337
33369
|
console.log(
|
|
33338
|
-
|
|
33370
|
+
chalk223.dim(
|
|
33339
33371
|
`
|
|
33340
33372
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
|
|
33341
33373
|
)
|
|
@@ -33347,11 +33379,11 @@ function runPlan(plan2, limits, apply) {
|
|
|
33347
33379
|
displayPlan2(plan2);
|
|
33348
33380
|
displayLayoutLimits(limits, applyCommand(plan2.scopeRoot));
|
|
33349
33381
|
if (plan2.moves.length === 0 && plan2.errors.length === 0) {
|
|
33350
|
-
console.log(
|
|
33382
|
+
console.log(chalk224.green("No restructuring needed"));
|
|
33351
33383
|
return;
|
|
33352
33384
|
}
|
|
33353
33385
|
if (!apply) {
|
|
33354
|
-
console.log(
|
|
33386
|
+
console.log(chalk224.dim("\nDry run. Use --apply to execute."));
|
|
33355
33387
|
return;
|
|
33356
33388
|
}
|
|
33357
33389
|
applyPlan(plan2);
|
|
@@ -33361,14 +33393,14 @@ function runPlan(plan2, limits, apply) {
|
|
|
33361
33393
|
async function restructure(root2, options2 = {}) {
|
|
33362
33394
|
const scopeRoot = path80.resolve(root2 ?? "src");
|
|
33363
33395
|
if (!fs38.existsSync(scopeRoot) || !fs38.statSync(scopeRoot).isDirectory()) {
|
|
33364
|
-
console.log(
|
|
33396
|
+
console.log(chalk225.red(`Not a directory: ${root2 ?? "src"}`));
|
|
33365
33397
|
process.exit(1);
|
|
33366
33398
|
}
|
|
33367
33399
|
const found = [];
|
|
33368
33400
|
walkSourceFiles(scopeRoot, found);
|
|
33369
33401
|
const { scoped, ignored } = partitionIgnored(found);
|
|
33370
33402
|
if (scoped.length === 0) {
|
|
33371
|
-
console.log(
|
|
33403
|
+
console.log(chalk225.yellow("No files found under root"));
|
|
33372
33404
|
return;
|
|
33373
33405
|
}
|
|
33374
33406
|
const { pin: pin2 = [], maxDepth = 10 } = loadConfig().restructure ?? {};
|
|
@@ -33430,7 +33462,7 @@ async function checkoutOnlySession(number) {
|
|
|
33430
33462
|
}
|
|
33431
33463
|
|
|
33432
33464
|
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
33433
|
-
import
|
|
33465
|
+
import chalk229 from "chalk";
|
|
33434
33466
|
|
|
33435
33467
|
// src/commands/config/promptConfigScope.ts
|
|
33436
33468
|
import Enquirer3 from "enquirer";
|
|
@@ -33456,7 +33488,7 @@ async function promptConfigScope() {
|
|
|
33456
33488
|
}
|
|
33457
33489
|
|
|
33458
33490
|
// src/commands/config/resolveConfigKeyAnswer.ts
|
|
33459
|
-
import
|
|
33491
|
+
import chalk226 from "chalk";
|
|
33460
33492
|
async function resolveConfigKeyAnswer(question, supplied) {
|
|
33461
33493
|
if (supplied !== void 0) return coerceSupplied(question.key, supplied);
|
|
33462
33494
|
for (; ; ) {
|
|
@@ -33464,7 +33496,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
|
|
|
33464
33496
|
if (answer === "") return void 0;
|
|
33465
33497
|
const coercion = coerceCliConfigValue(question.key, answer);
|
|
33466
33498
|
if (coercion.ok) return coercion.value;
|
|
33467
|
-
console.error(
|
|
33499
|
+
console.error(chalk226.red(coercion.error));
|
|
33468
33500
|
}
|
|
33469
33501
|
}
|
|
33470
33502
|
function coerceSupplied(key, supplied) {
|
|
@@ -33525,7 +33557,7 @@ function suggestGlobs(current, proposed) {
|
|
|
33525
33557
|
}
|
|
33526
33558
|
|
|
33527
33559
|
// src/commands/review/highLevel/parseConfigureAnswers.ts
|
|
33528
|
-
import
|
|
33560
|
+
import chalk227 from "chalk";
|
|
33529
33561
|
function parseConfigureAnswers(answers) {
|
|
33530
33562
|
const known = Object.values(highLevelConfigKeys);
|
|
33531
33563
|
const parsed = {};
|
|
@@ -33543,13 +33575,13 @@ function answersCoverEveryKey(answers) {
|
|
|
33543
33575
|
return Object.values(highLevelConfigKeys).every((key) => key in answers);
|
|
33544
33576
|
}
|
|
33545
33577
|
function exitWith(message3) {
|
|
33546
|
-
console.error(
|
|
33578
|
+
console.error(chalk227.red(`Error: ${message3}.`));
|
|
33547
33579
|
process.exit(1);
|
|
33548
33580
|
}
|
|
33549
33581
|
|
|
33550
33582
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
33551
33583
|
import { execFileSync as execFileSync19 } from "child_process";
|
|
33552
|
-
import
|
|
33584
|
+
import chalk228 from "chalk";
|
|
33553
33585
|
|
|
33554
33586
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
33555
33587
|
function buildGlobProposalPrompt(tree) {
|
|
@@ -33642,12 +33674,12 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
33642
33674
|
const tree = summariseRepoTree(cwd);
|
|
33643
33675
|
if (tree === "") return NOTHING_PROPOSED;
|
|
33644
33676
|
console.log(
|
|
33645
|
-
|
|
33677
|
+
chalk228.dim("Asking Claude to propose globs from the repo's own tree...")
|
|
33646
33678
|
);
|
|
33647
33679
|
const output = askClaude(buildGlobProposalPrompt(tree), cwd);
|
|
33648
33680
|
if (output === void 0) {
|
|
33649
33681
|
console.log(
|
|
33650
|
-
|
|
33682
|
+
chalk228.yellow(
|
|
33651
33683
|
"Claude proposed nothing; answer each key from its current value."
|
|
33652
33684
|
)
|
|
33653
33685
|
);
|
|
@@ -33703,25 +33735,25 @@ function asConfigKeyScope(value) {
|
|
|
33703
33735
|
function reportConfigured(result) {
|
|
33704
33736
|
for (const write of result.written)
|
|
33705
33737
|
console.log(
|
|
33706
|
-
|
|
33738
|
+
chalk229.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
|
|
33707
33739
|
);
|
|
33708
|
-
for (const key of result.skipped) console.log(
|
|
33709
|
-
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}`));
|
|
33710
33742
|
}
|
|
33711
33743
|
|
|
33712
33744
|
// src/commands/review/highLevel/announceSavedReview.ts
|
|
33713
|
-
import
|
|
33745
|
+
import chalk230 from "chalk";
|
|
33714
33746
|
function announceSavedReview(subject, force) {
|
|
33715
33747
|
const head = subject.headSha.slice(0, 7);
|
|
33716
33748
|
if (subject.saved)
|
|
33717
33749
|
console.log(
|
|
33718
|
-
|
|
33750
|
+
chalk230.dim(
|
|
33719
33751
|
`Reopening the review saved for ${head} at ${subject.saved.reviewedAt} (${subject.saved.verdict}); pass --force to start fresh.`
|
|
33720
33752
|
)
|
|
33721
33753
|
);
|
|
33722
33754
|
else if (force)
|
|
33723
33755
|
console.log(
|
|
33724
|
-
|
|
33756
|
+
chalk230.dim(
|
|
33725
33757
|
`Discarding any review saved for ${head} and starting fresh (--force).`
|
|
33726
33758
|
)
|
|
33727
33759
|
);
|
|
@@ -34086,12 +34118,12 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
34086
34118
|
import { existsSync as existsSync64, readFileSync as readFileSync47 } from "fs";
|
|
34087
34119
|
|
|
34088
34120
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
34089
|
-
import { join as
|
|
34121
|
+
import { join as join79 } from "path";
|
|
34090
34122
|
function slug(value) {
|
|
34091
34123
|
return value.replace(/[^\w.-]+/g, "-");
|
|
34092
34124
|
}
|
|
34093
34125
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
34094
|
-
return
|
|
34126
|
+
return join79(
|
|
34095
34127
|
getStoreDir(),
|
|
34096
34128
|
"high-level-reviews",
|
|
34097
34129
|
slug(repo),
|
|
@@ -34262,55 +34294,55 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
34262
34294
|
}
|
|
34263
34295
|
|
|
34264
34296
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
34265
|
-
import
|
|
34297
|
+
import chalk234 from "chalk";
|
|
34266
34298
|
|
|
34267
34299
|
// src/commands/review/highLevel/formatCriticalDiffs.ts
|
|
34268
|
-
import
|
|
34300
|
+
import chalk231 from "chalk";
|
|
34269
34301
|
var PATCH_LINE_COLOURS = {
|
|
34270
|
-
"+":
|
|
34271
|
-
"-":
|
|
34272
|
-
"@":
|
|
34302
|
+
"+": chalk231.green,
|
|
34303
|
+
"-": chalk231.red,
|
|
34304
|
+
"@": chalk231.cyan
|
|
34273
34305
|
};
|
|
34274
34306
|
function formatPatch(patch2) {
|
|
34275
34307
|
return patch2.split("\n").map(
|
|
34276
|
-
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ??
|
|
34308
|
+
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk231.dim)(line)}`
|
|
34277
34309
|
);
|
|
34278
34310
|
}
|
|
34279
34311
|
function formatDiff(diff3) {
|
|
34280
34312
|
return [
|
|
34281
34313
|
"",
|
|
34282
|
-
` ${
|
|
34283
|
-
...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)
|
|
34284
34316
|
];
|
|
34285
34317
|
}
|
|
34286
34318
|
function formatCriticalDiffs(diffs, criticalPaths) {
|
|
34287
34319
|
if (criticalPaths.length === 0)
|
|
34288
|
-
return `${
|
|
34289
|
-
${
|
|
34320
|
+
return `${chalk231.bold.underline("Critical diffs")}
|
|
34321
|
+
${chalk231.dim("review.highLevel.criticalPaths is unset, so no diffs are shown")}`;
|
|
34290
34322
|
if (diffs.length === 0)
|
|
34291
|
-
return `${
|
|
34292
|
-
${
|
|
34323
|
+
return `${chalk231.bold.underline("Critical diffs")}
|
|
34324
|
+
${chalk231.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
|
|
34293
34325
|
return [
|
|
34294
|
-
|
|
34326
|
+
chalk231.bold.underline("Critical diffs"),
|
|
34295
34327
|
...diffs.flatMap(formatDiff)
|
|
34296
34328
|
].join("\n");
|
|
34297
34329
|
}
|
|
34298
34330
|
|
|
34299
34331
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
34300
|
-
import
|
|
34332
|
+
import chalk232 from "chalk";
|
|
34301
34333
|
var MARKERS = {
|
|
34302
|
-
pass: () =>
|
|
34303
|
-
fail: () =>
|
|
34304
|
-
manual: () =>
|
|
34334
|
+
pass: () => chalk232.green("\u2714"),
|
|
34335
|
+
fail: () => chalk232.red("\u2718"),
|
|
34336
|
+
manual: () => chalk232.yellow("\u25A1")
|
|
34305
34337
|
};
|
|
34306
34338
|
function formatCheck(check2) {
|
|
34307
|
-
const title = check2.status === "fail" ?
|
|
34339
|
+
const title = check2.status === "fail" ? chalk232.red(check2.title) : chalk232.bold(check2.title);
|
|
34308
34340
|
return ` ${MARKERS[check2.status]()} ${title}
|
|
34309
|
-
${
|
|
34341
|
+
${chalk232.dim(check2.reason)}`;
|
|
34310
34342
|
}
|
|
34311
34343
|
function formatGroup(heading2, checks2) {
|
|
34312
34344
|
if (checks2.length === 0) return [];
|
|
34313
|
-
return ["",
|
|
34345
|
+
return ["", chalk232.bold.underline(heading2), ...checks2.map(formatCheck)];
|
|
34314
34346
|
}
|
|
34315
34347
|
function formatHighLevelChecklist(checks2) {
|
|
34316
34348
|
const deterministic = checks2.filter(
|
|
@@ -34319,7 +34351,7 @@ function formatHighLevelChecklist(checks2) {
|
|
|
34319
34351
|
const failed3 = deterministic.filter(
|
|
34320
34352
|
(check2) => check2.status === "fail"
|
|
34321
34353
|
).length;
|
|
34322
|
-
const summary = failed3 === 0 ?
|
|
34354
|
+
const summary = failed3 === 0 ? chalk232.green(`All ${deterministic.length} deterministic checks pass`) : chalk232.red(
|
|
34323
34355
|
`${failed3} of ${deterministic.length} deterministic checks fail`
|
|
34324
34356
|
);
|
|
34325
34357
|
return [
|
|
@@ -34334,30 +34366,30 @@ function formatHighLevelChecklist(checks2) {
|
|
|
34334
34366
|
}
|
|
34335
34367
|
|
|
34336
34368
|
// src/commands/review/highLevel/formatHighLevelStructure.ts
|
|
34337
|
-
import
|
|
34369
|
+
import chalk233 from "chalk";
|
|
34338
34370
|
var STATUS_MARKERS = {
|
|
34339
|
-
added: () =>
|
|
34340
|
-
removed: () =>
|
|
34341
|
-
modified: () =>
|
|
34371
|
+
added: () => chalk233.green("A"),
|
|
34372
|
+
removed: () => chalk233.red("D"),
|
|
34373
|
+
modified: () => chalk233.yellow("M")
|
|
34342
34374
|
};
|
|
34343
34375
|
function counts(additions, deletions) {
|
|
34344
|
-
return `${
|
|
34376
|
+
return `${chalk233.green(`+${additions}`)} ${chalk233.red(`-${deletions}`)}`;
|
|
34345
34377
|
}
|
|
34346
34378
|
function formatNode(node, indent3) {
|
|
34347
34379
|
if (node.kind === "file")
|
|
34348
34380
|
return [
|
|
34349
|
-
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${
|
|
34381
|
+
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk233.dim(counts(node.additions, node.deletions))}`
|
|
34350
34382
|
];
|
|
34351
34383
|
const dir = node;
|
|
34352
34384
|
return [
|
|
34353
|
-
`${indent3}${
|
|
34385
|
+
`${indent3}${chalk233.bold(`${dir.name}/`)} ${chalk233.dim(counts(dir.additions, dir.deletions))}`,
|
|
34354
34386
|
...dir.children.flatMap((child) => formatNode(child, `${indent3} `))
|
|
34355
34387
|
];
|
|
34356
34388
|
}
|
|
34357
34389
|
function formatHighLevelStructure(structure) {
|
|
34358
34390
|
const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
|
|
34359
34391
|
return [
|
|
34360
|
-
|
|
34392
|
+
chalk233.bold.underline("Structure"),
|
|
34361
34393
|
` ${summary}`,
|
|
34362
34394
|
...structure.tree.flatMap((node) => formatNode(node, " "))
|
|
34363
34395
|
].join("\n");
|
|
@@ -34366,10 +34398,10 @@ function formatHighLevelStructure(structure) {
|
|
|
34366
34398
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
34367
34399
|
function printHighLevelChecklist(subject) {
|
|
34368
34400
|
console.log(
|
|
34369
|
-
|
|
34401
|
+
chalk234.bold(
|
|
34370
34402
|
`High-level review of ${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`
|
|
34371
34403
|
),
|
|
34372
|
-
|
|
34404
|
+
chalk234.dim(
|
|
34373
34405
|
`\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
|
|
34374
34406
|
)
|
|
34375
34407
|
);
|
|
@@ -34381,12 +34413,12 @@ function printHighLevelChecklist(subject) {
|
|
|
34381
34413
|
formatCriticalDiffs(subject.criticalDiffs, subject.criticalPaths)
|
|
34382
34414
|
);
|
|
34383
34415
|
console.log(
|
|
34384
|
-
|
|
34416
|
+
chalk234.dim(
|
|
34385
34417
|
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
34386
34418
|
)
|
|
34387
34419
|
);
|
|
34388
34420
|
console.log(
|
|
34389
|
-
|
|
34421
|
+
chalk234.dim(
|
|
34390
34422
|
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
34391
34423
|
)
|
|
34392
34424
|
);
|
|
@@ -34866,18 +34898,18 @@ function partitionFindingsByDiff(findings, index2) {
|
|
|
34866
34898
|
}
|
|
34867
34899
|
|
|
34868
34900
|
// src/commands/review/warnOutOfDiff.ts
|
|
34869
|
-
import
|
|
34901
|
+
import chalk235 from "chalk";
|
|
34870
34902
|
function warnOutOfDiff(outOfDiff) {
|
|
34871
34903
|
if (outOfDiff.length === 0) return;
|
|
34872
34904
|
console.warn(
|
|
34873
|
-
|
|
34905
|
+
chalk235.yellow(
|
|
34874
34906
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
34875
34907
|
)
|
|
34876
34908
|
);
|
|
34877
34909
|
for (const finding of outOfDiff) {
|
|
34878
34910
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
34879
34911
|
console.warn(
|
|
34880
|
-
` ${
|
|
34912
|
+
` ${chalk235.yellow("\xB7")} ${finding.title} ${chalk235.dim(
|
|
34881
34913
|
`(${finding.file}:${range})`
|
|
34882
34914
|
)}`
|
|
34883
34915
|
);
|
|
@@ -34901,18 +34933,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
34901
34933
|
}
|
|
34902
34934
|
|
|
34903
34935
|
// src/commands/review/warnUnlocated.ts
|
|
34904
|
-
import
|
|
34936
|
+
import chalk236 from "chalk";
|
|
34905
34937
|
function warnUnlocated(unlocated) {
|
|
34906
34938
|
if (unlocated.length === 0) return;
|
|
34907
34939
|
console.warn(
|
|
34908
|
-
|
|
34940
|
+
chalk236.yellow(
|
|
34909
34941
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
34910
34942
|
)
|
|
34911
34943
|
);
|
|
34912
34944
|
for (const finding of unlocated) {
|
|
34913
|
-
const where = finding.location ||
|
|
34945
|
+
const where = finding.location || chalk236.dim("missing");
|
|
34914
34946
|
console.warn(
|
|
34915
|
-
` ${
|
|
34947
|
+
` ${chalk236.yellow("\xB7")} ${finding.title} ${chalk236.dim(`(${where})`)}`
|
|
34916
34948
|
);
|
|
34917
34949
|
}
|
|
34918
34950
|
}
|
|
@@ -35167,7 +35199,7 @@ import { format } from "util";
|
|
|
35167
35199
|
|
|
35168
35200
|
// src/commands/review/createReviewLogSink.ts
|
|
35169
35201
|
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync23 } from "fs";
|
|
35170
|
-
import { join as
|
|
35202
|
+
import { join as join80 } from "path";
|
|
35171
35203
|
|
|
35172
35204
|
// src/shared/stripAnsi.ts
|
|
35173
35205
|
var ANSI = new RegExp(
|
|
@@ -35195,7 +35227,7 @@ function createReviewLogSink() {
|
|
|
35195
35227
|
},
|
|
35196
35228
|
attach(reviewDir) {
|
|
35197
35229
|
mkdirSync23(reviewDir, { recursive: true });
|
|
35198
|
-
logPath2 =
|
|
35230
|
+
logPath2 = join80(reviewDir, LOG_FILE);
|
|
35199
35231
|
const lines2 = [
|
|
35200
35232
|
"",
|
|
35201
35233
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -36277,9 +36309,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
36277
36309
|
|
|
36278
36310
|
// src/commands/review/buildReviewPaths.ts
|
|
36279
36311
|
import { homedir as homedir24 } from "os";
|
|
36280
|
-
import { basename as basename21, join as
|
|
36312
|
+
import { basename as basename21, join as join81 } from "path";
|
|
36281
36313
|
function buildReviewPaths(repoRoot2, key) {
|
|
36282
|
-
const reviewDir =
|
|
36314
|
+
const reviewDir = join81(
|
|
36283
36315
|
homedir24(),
|
|
36284
36316
|
".assist",
|
|
36285
36317
|
"reviews",
|
|
@@ -36288,10 +36320,10 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
36288
36320
|
);
|
|
36289
36321
|
return {
|
|
36290
36322
|
reviewDir,
|
|
36291
|
-
requestPath:
|
|
36292
|
-
claudePath:
|
|
36293
|
-
codexPath:
|
|
36294
|
-
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")
|
|
36295
36327
|
};
|
|
36296
36328
|
}
|
|
36297
36329
|
|
|
@@ -36563,7 +36595,7 @@ function registerReview(program2) {
|
|
|
36563
36595
|
// src/commands/rules/addRule.ts
|
|
36564
36596
|
import { existsSync as existsSync70, readFileSync as readFileSync53, writeFileSync as writeFileSync43 } from "fs";
|
|
36565
36597
|
import path85 from "path";
|
|
36566
|
-
import
|
|
36598
|
+
import chalk237 from "chalk";
|
|
36567
36599
|
|
|
36568
36600
|
// src/commands/rules/insertRuleBullet.ts
|
|
36569
36601
|
function ruleBullet({ code, title, text: text17 }) {
|
|
@@ -36699,7 +36731,7 @@ function read2(file) {
|
|
|
36699
36731
|
function addRule(text17, options2) {
|
|
36700
36732
|
const rule = text17.trim();
|
|
36701
36733
|
if (rule === "") {
|
|
36702
|
-
console.error(
|
|
36734
|
+
console.error(chalk237.red("Rule text is required"));
|
|
36703
36735
|
process.exitCode = 1;
|
|
36704
36736
|
return;
|
|
36705
36737
|
}
|
|
@@ -36717,13 +36749,13 @@ function addRule(text17, options2) {
|
|
|
36717
36749
|
);
|
|
36718
36750
|
updateScopedRulesIndex(root2);
|
|
36719
36751
|
console.log(
|
|
36720
|
-
`Added ${
|
|
36752
|
+
`Added ${chalk237.cyan(code)} to ${path85.relative(process.cwd(), target) || target}`
|
|
36721
36753
|
);
|
|
36722
36754
|
}
|
|
36723
36755
|
|
|
36724
36756
|
// src/commands/rules/indexRules.ts
|
|
36725
36757
|
import path86 from "path";
|
|
36726
|
-
import
|
|
36758
|
+
import chalk238 from "chalk";
|
|
36727
36759
|
function indexRules() {
|
|
36728
36760
|
const startDir = scopeDirectory(process.cwd());
|
|
36729
36761
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
@@ -36731,24 +36763,24 @@ function indexRules() {
|
|
|
36731
36763
|
const rootFile = path86.relative(process.cwd(), path86.join(root2, "CLAUDE.md"));
|
|
36732
36764
|
if (directories.length === 0) {
|
|
36733
36765
|
console.log(
|
|
36734
|
-
|
|
36766
|
+
chalk238.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
36735
36767
|
);
|
|
36736
36768
|
return;
|
|
36737
36769
|
}
|
|
36738
36770
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
36739
36771
|
for (const directory of directories)
|
|
36740
|
-
console.log(` ${
|
|
36772
|
+
console.log(` ${chalk238.cyan(directory)}`);
|
|
36741
36773
|
}
|
|
36742
36774
|
|
|
36743
36775
|
// src/commands/rules/listRules.ts
|
|
36744
36776
|
import path87 from "path";
|
|
36745
|
-
import
|
|
36777
|
+
import chalk239 from "chalk";
|
|
36746
36778
|
function listRules(target, options2 = {}) {
|
|
36747
36779
|
const resolved = path87.resolve(target ?? process.cwd());
|
|
36748
36780
|
const rules3 = readScopedRules(resolved);
|
|
36749
36781
|
if (rules3.length === 0) {
|
|
36750
36782
|
const label2 = path87.relative(process.cwd(), resolved) || ".";
|
|
36751
|
-
console.log(
|
|
36783
|
+
console.log(chalk239.gray(`No rules in scope for ${label2}`));
|
|
36752
36784
|
return;
|
|
36753
36785
|
}
|
|
36754
36786
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -36758,14 +36790,14 @@ function listRules(target, options2 = {}) {
|
|
|
36758
36790
|
if (rule.source !== shown) {
|
|
36759
36791
|
shown = rule.source;
|
|
36760
36792
|
console.log(
|
|
36761
|
-
|
|
36793
|
+
chalk239.dim(base ? path87.relative(base, rule.source) : rule.source)
|
|
36762
36794
|
);
|
|
36763
36795
|
}
|
|
36764
36796
|
console.log(
|
|
36765
|
-
` ${
|
|
36797
|
+
` ${chalk239.cyan(rule.code.padEnd(width))} ${rule.title ?? rule.text}`
|
|
36766
36798
|
);
|
|
36767
36799
|
if (options2.full && rule.title)
|
|
36768
|
-
console.log(` ${" ".repeat(width)} ${
|
|
36800
|
+
console.log(` ${" ".repeat(width)} ${chalk239.dim(rule.text)}`);
|
|
36769
36801
|
}
|
|
36770
36802
|
}
|
|
36771
36803
|
|
|
@@ -36794,7 +36826,7 @@ function registerRules(program2) {
|
|
|
36794
36826
|
}
|
|
36795
36827
|
|
|
36796
36828
|
// src/commands/seq/seqAuth.ts
|
|
36797
|
-
import
|
|
36829
|
+
import chalk241 from "chalk";
|
|
36798
36830
|
|
|
36799
36831
|
// src/commands/seq/loadConnections.ts
|
|
36800
36832
|
function loadConnections2() {
|
|
@@ -36823,10 +36855,10 @@ function setDefaultConnection(name) {
|
|
|
36823
36855
|
}
|
|
36824
36856
|
|
|
36825
36857
|
// src/shared/assertUniqueName.ts
|
|
36826
|
-
import
|
|
36858
|
+
import chalk240 from "chalk";
|
|
36827
36859
|
function assertUniqueName(existingNames, name) {
|
|
36828
36860
|
if (existingNames.includes(name)) {
|
|
36829
|
-
console.error(
|
|
36861
|
+
console.error(chalk240.red(`Connection "${name}" already exists.`));
|
|
36830
36862
|
process.exit(1);
|
|
36831
36863
|
}
|
|
36832
36864
|
}
|
|
@@ -36844,16 +36876,16 @@ async function promptConnection2(existingNames) {
|
|
|
36844
36876
|
var seqAuth = createConnectionAuth({
|
|
36845
36877
|
load: loadConnections2,
|
|
36846
36878
|
save: saveConnections2,
|
|
36847
|
-
format: (c) => `${
|
|
36879
|
+
format: (c) => `${chalk241.bold(c.name)} ${c.url}`,
|
|
36848
36880
|
promptNew: promptConnection2,
|
|
36849
36881
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
36850
36882
|
});
|
|
36851
36883
|
|
|
36852
36884
|
// src/commands/seq/seqQuery.ts
|
|
36853
|
-
import
|
|
36885
|
+
import chalk245 from "chalk";
|
|
36854
36886
|
|
|
36855
36887
|
// src/commands/seq/fetchSeq.ts
|
|
36856
|
-
import
|
|
36888
|
+
import chalk242 from "chalk";
|
|
36857
36889
|
async function fetchSeq(conn, path106, params) {
|
|
36858
36890
|
const url = `${conn.url}${path106}?${params}`;
|
|
36859
36891
|
const response = await fetch(url, {
|
|
@@ -36864,7 +36896,7 @@ async function fetchSeq(conn, path106, params) {
|
|
|
36864
36896
|
});
|
|
36865
36897
|
if (!response.ok) {
|
|
36866
36898
|
const body = await response.text();
|
|
36867
|
-
console.error(
|
|
36899
|
+
console.error(chalk242.red(`Seq returned ${response.status}: ${body}`));
|
|
36868
36900
|
process.exit(1);
|
|
36869
36901
|
}
|
|
36870
36902
|
return response;
|
|
@@ -36923,23 +36955,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
36923
36955
|
}
|
|
36924
36956
|
|
|
36925
36957
|
// src/commands/seq/formatEvent.ts
|
|
36926
|
-
import
|
|
36958
|
+
import chalk243 from "chalk";
|
|
36927
36959
|
function levelColor(level) {
|
|
36928
36960
|
switch (level) {
|
|
36929
36961
|
case "Fatal":
|
|
36930
|
-
return
|
|
36962
|
+
return chalk243.bgRed.white;
|
|
36931
36963
|
case "Error":
|
|
36932
|
-
return
|
|
36964
|
+
return chalk243.red;
|
|
36933
36965
|
case "Warning":
|
|
36934
|
-
return
|
|
36966
|
+
return chalk243.yellow;
|
|
36935
36967
|
case "Information":
|
|
36936
|
-
return
|
|
36968
|
+
return chalk243.cyan;
|
|
36937
36969
|
case "Debug":
|
|
36938
|
-
return
|
|
36970
|
+
return chalk243.gray;
|
|
36939
36971
|
case "Verbose":
|
|
36940
|
-
return
|
|
36972
|
+
return chalk243.dim;
|
|
36941
36973
|
default:
|
|
36942
|
-
return
|
|
36974
|
+
return chalk243.white;
|
|
36943
36975
|
}
|
|
36944
36976
|
}
|
|
36945
36977
|
function levelAbbrev(level) {
|
|
@@ -36980,12 +37012,12 @@ function formatTimestamp(iso) {
|
|
|
36980
37012
|
function formatEvent(event) {
|
|
36981
37013
|
const color = levelColor(event.Level);
|
|
36982
37014
|
const abbrev = levelAbbrev(event.Level);
|
|
36983
|
-
const ts10 =
|
|
37015
|
+
const ts10 = chalk243.dim(formatTimestamp(event.Timestamp));
|
|
36984
37016
|
const msg = renderMessage(event);
|
|
36985
37017
|
const lines2 = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
|
|
36986
37018
|
if (event.Exception) {
|
|
36987
37019
|
for (const line of event.Exception.split("\n")) {
|
|
36988
|
-
lines2.push(
|
|
37020
|
+
lines2.push(chalk243.red(` ${line}`));
|
|
36989
37021
|
}
|
|
36990
37022
|
}
|
|
36991
37023
|
return lines2.join("\n");
|
|
@@ -37018,11 +37050,11 @@ function rejectTimestampFilter(filter) {
|
|
|
37018
37050
|
}
|
|
37019
37051
|
|
|
37020
37052
|
// src/shared/resolveNamedConnection.ts
|
|
37021
|
-
import
|
|
37053
|
+
import chalk244 from "chalk";
|
|
37022
37054
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
37023
37055
|
if (connections.length === 0) {
|
|
37024
37056
|
console.error(
|
|
37025
|
-
|
|
37057
|
+
chalk244.red(
|
|
37026
37058
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
37027
37059
|
)
|
|
37028
37060
|
);
|
|
@@ -37031,7 +37063,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
37031
37063
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
37032
37064
|
const connection = connections.find((c) => c.name === target);
|
|
37033
37065
|
if (!connection) {
|
|
37034
|
-
console.error(
|
|
37066
|
+
console.error(chalk244.red(`${kind} connection "${target}" not found.`));
|
|
37035
37067
|
process.exit(1);
|
|
37036
37068
|
}
|
|
37037
37069
|
return connection;
|
|
@@ -37060,7 +37092,7 @@ async function seqQuery(filter, options2) {
|
|
|
37060
37092
|
new URLSearchParams({ filter, count: String(count8) })
|
|
37061
37093
|
);
|
|
37062
37094
|
if (events.length === 0) {
|
|
37063
|
-
console.log(
|
|
37095
|
+
console.log(chalk245.yellow("No events found."));
|
|
37064
37096
|
return;
|
|
37065
37097
|
}
|
|
37066
37098
|
if (options2.json) {
|
|
@@ -37071,11 +37103,11 @@ async function seqQuery(filter, options2) {
|
|
|
37071
37103
|
for (const event of chronological) {
|
|
37072
37104
|
console.log(formatEvent(event));
|
|
37073
37105
|
}
|
|
37074
|
-
console.log(
|
|
37106
|
+
console.log(chalk245.dim(`
|
|
37075
37107
|
${events.length} events`));
|
|
37076
37108
|
if (events.length >= count8) {
|
|
37077
37109
|
console.log(
|
|
37078
|
-
|
|
37110
|
+
chalk245.yellow(
|
|
37079
37111
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
37080
37112
|
)
|
|
37081
37113
|
);
|
|
@@ -37083,10 +37115,10 @@ ${events.length} events`));
|
|
|
37083
37115
|
}
|
|
37084
37116
|
|
|
37085
37117
|
// src/shared/setNamedDefaultConnection.ts
|
|
37086
|
-
import
|
|
37118
|
+
import chalk246 from "chalk";
|
|
37087
37119
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
37088
37120
|
if (!connections.find((c) => c.name === name)) {
|
|
37089
|
-
console.error(
|
|
37121
|
+
console.error(chalk246.red(`Connection "${name}" not found.`));
|
|
37090
37122
|
process.exit(1);
|
|
37091
37123
|
}
|
|
37092
37124
|
setDefault(name);
|
|
@@ -37272,12 +37304,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
37272
37304
|
}
|
|
37273
37305
|
|
|
37274
37306
|
// src/commands/slack/slackWorkingFile.ts
|
|
37275
|
-
import { join as
|
|
37307
|
+
import { join as join82 } from "path";
|
|
37276
37308
|
function slackWorkingFile(channel, partIndex) {
|
|
37277
37309
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
37278
|
-
const dir =
|
|
37310
|
+
const dir = join82(getStoreDir(), "slack");
|
|
37279
37311
|
const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
37280
|
-
return { dir, bodyPath:
|
|
37312
|
+
return { dir, bodyPath: join82(dir, `${name}.md`) };
|
|
37281
37313
|
}
|
|
37282
37314
|
|
|
37283
37315
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -37378,7 +37410,7 @@ function registerSlack(program2) {
|
|
|
37378
37410
|
}
|
|
37379
37411
|
|
|
37380
37412
|
// src/commands/sql/sqlAuth.ts
|
|
37381
|
-
import
|
|
37413
|
+
import chalk248 from "chalk";
|
|
37382
37414
|
|
|
37383
37415
|
// src/commands/sql/loadConnections.ts
|
|
37384
37416
|
function loadConnections3() {
|
|
@@ -37407,7 +37439,7 @@ function setDefaultConnection2(name) {
|
|
|
37407
37439
|
}
|
|
37408
37440
|
|
|
37409
37441
|
// src/commands/sql/promptConnection.ts
|
|
37410
|
-
import
|
|
37442
|
+
import chalk247 from "chalk";
|
|
37411
37443
|
async function promptConnection3(existingNames) {
|
|
37412
37444
|
const name = await promptInput("name", "Connection name:", "default");
|
|
37413
37445
|
assertUniqueName(existingNames, name);
|
|
@@ -37415,7 +37447,7 @@ async function promptConnection3(existingNames) {
|
|
|
37415
37447
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
37416
37448
|
const port = Number.parseInt(portStr, 10);
|
|
37417
37449
|
if (!Number.isFinite(port)) {
|
|
37418
|
-
console.error(
|
|
37450
|
+
console.error(chalk247.red(`Invalid port "${portStr}".`));
|
|
37419
37451
|
process.exit(1);
|
|
37420
37452
|
}
|
|
37421
37453
|
const user = await promptInput("user", "User:");
|
|
@@ -37428,13 +37460,13 @@ async function promptConnection3(existingNames) {
|
|
|
37428
37460
|
var sqlAuth = createConnectionAuth({
|
|
37429
37461
|
load: loadConnections3,
|
|
37430
37462
|
save: saveConnections3,
|
|
37431
|
-
format: (c) => `${
|
|
37463
|
+
format: (c) => `${chalk248.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
37432
37464
|
promptNew: promptConnection3,
|
|
37433
37465
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
37434
37466
|
});
|
|
37435
37467
|
|
|
37436
37468
|
// src/commands/sql/printTable.ts
|
|
37437
|
-
import
|
|
37469
|
+
import chalk249 from "chalk";
|
|
37438
37470
|
function formatCell(value) {
|
|
37439
37471
|
if (value === null || value === void 0) return "";
|
|
37440
37472
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -37443,7 +37475,7 @@ function formatCell(value) {
|
|
|
37443
37475
|
}
|
|
37444
37476
|
function printTable(rows) {
|
|
37445
37477
|
if (rows.length === 0) {
|
|
37446
|
-
console.log(
|
|
37478
|
+
console.log(chalk249.yellow("(no rows)"));
|
|
37447
37479
|
return;
|
|
37448
37480
|
}
|
|
37449
37481
|
const columns = Object.keys(rows[0]);
|
|
@@ -37451,13 +37483,13 @@ function printTable(rows) {
|
|
|
37451
37483
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
37452
37484
|
);
|
|
37453
37485
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
37454
|
-
console.log(
|
|
37455
|
-
console.log(
|
|
37486
|
+
console.log(chalk249.dim(header));
|
|
37487
|
+
console.log(chalk249.dim("-".repeat(header.length)));
|
|
37456
37488
|
for (const row of rows) {
|
|
37457
37489
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
37458
37490
|
console.log(line);
|
|
37459
37491
|
}
|
|
37460
|
-
console.log(
|
|
37492
|
+
console.log(chalk249.dim(`
|
|
37461
37493
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
37462
37494
|
}
|
|
37463
37495
|
|
|
@@ -37517,7 +37549,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
37517
37549
|
}
|
|
37518
37550
|
|
|
37519
37551
|
// src/commands/sql/sqlMutate.ts
|
|
37520
|
-
import
|
|
37552
|
+
import chalk250 from "chalk";
|
|
37521
37553
|
|
|
37522
37554
|
// src/commands/sql/isMutation.ts
|
|
37523
37555
|
var MUTATION_KEYWORDS = [
|
|
@@ -37551,7 +37583,7 @@ function isMutation(sql28) {
|
|
|
37551
37583
|
async function sqlMutate(query, connectionName) {
|
|
37552
37584
|
if (!isMutation(query)) {
|
|
37553
37585
|
console.error(
|
|
37554
|
-
|
|
37586
|
+
chalk250.red(
|
|
37555
37587
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
37556
37588
|
)
|
|
37557
37589
|
);
|
|
@@ -37561,18 +37593,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
37561
37593
|
const pool = await sqlConnect(conn);
|
|
37562
37594
|
try {
|
|
37563
37595
|
const result = await pool.request().query(query);
|
|
37564
|
-
console.log(
|
|
37596
|
+
console.log(chalk250.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
37565
37597
|
} finally {
|
|
37566
37598
|
await pool.close();
|
|
37567
37599
|
}
|
|
37568
37600
|
}
|
|
37569
37601
|
|
|
37570
37602
|
// src/commands/sql/sqlQuery.ts
|
|
37571
|
-
import
|
|
37603
|
+
import chalk251 from "chalk";
|
|
37572
37604
|
async function sqlQuery(query, connectionName) {
|
|
37573
37605
|
if (isMutation(query)) {
|
|
37574
37606
|
console.error(
|
|
37575
|
-
|
|
37607
|
+
chalk251.red(
|
|
37576
37608
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
37577
37609
|
)
|
|
37578
37610
|
);
|
|
@@ -37587,7 +37619,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
37587
37619
|
printTable(rows);
|
|
37588
37620
|
} else {
|
|
37589
37621
|
console.log(
|
|
37590
|
-
|
|
37622
|
+
chalk251.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
37591
37623
|
);
|
|
37592
37624
|
}
|
|
37593
37625
|
} finally {
|
|
@@ -38008,7 +38040,7 @@ function syncPi(claudeDir, options2) {
|
|
|
38008
38040
|
// src/commands/sync/syncSettings.ts
|
|
38009
38041
|
import * as fs47 from "fs";
|
|
38010
38042
|
import * as path98 from "path";
|
|
38011
|
-
import
|
|
38043
|
+
import chalk252 from "chalk";
|
|
38012
38044
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
38013
38045
|
const source = path98.join(claudeDir, "settings.json");
|
|
38014
38046
|
const target = path98.join(targetBase, "settings.json");
|
|
@@ -38027,7 +38059,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
38027
38059
|
if (mergedContent !== normalizedTarget) {
|
|
38028
38060
|
if (!options2?.yes) {
|
|
38029
38061
|
console.log(
|
|
38030
|
-
|
|
38062
|
+
chalk252.yellow(
|
|
38031
38063
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
38032
38064
|
)
|
|
38033
38065
|
);
|
|
@@ -38035,7 +38067,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
38035
38067
|
printDiff(targetContent, mergedContent);
|
|
38036
38068
|
printAutoConfirmHint();
|
|
38037
38069
|
const confirm = await promptConfirm(
|
|
38038
|
-
|
|
38070
|
+
chalk252.red("Overwrite existing settings.json?"),
|
|
38039
38071
|
false
|
|
38040
38072
|
);
|
|
38041
38073
|
if (!confirm) {
|
|
@@ -38457,20 +38489,20 @@ async function configure() {
|
|
|
38457
38489
|
|
|
38458
38490
|
// src/commands/transcript/list.ts
|
|
38459
38491
|
import { existsSync as existsSync76, readdirSync as readdirSync20, statSync as statSync12 } from "fs";
|
|
38460
|
-
import { join as
|
|
38492
|
+
import { join as join94 } from "path";
|
|
38461
38493
|
function list3() {
|
|
38462
38494
|
const { vttDir } = getTranscriptConfig();
|
|
38463
38495
|
if (!existsSync76(vttDir)) return;
|
|
38464
38496
|
for (const entry of readdirSync20(vttDir)) {
|
|
38465
38497
|
if (!entry.endsWith(".vtt")) continue;
|
|
38466
|
-
if (statSync12(
|
|
38498
|
+
if (statSync12(join94(vttDir, entry)).isDirectory()) continue;
|
|
38467
38499
|
console.log(entry);
|
|
38468
38500
|
}
|
|
38469
38501
|
}
|
|
38470
38502
|
|
|
38471
38503
|
// src/commands/transcript/move.ts
|
|
38472
38504
|
import { existsSync as existsSync77, mkdirSync as mkdirSync32, renameSync as renameSync2, writeFileSync as writeFileSync50 } from "fs";
|
|
38473
|
-
import { basename as basename25, join as
|
|
38505
|
+
import { basename as basename25, join as join95 } from "path";
|
|
38474
38506
|
|
|
38475
38507
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
38476
38508
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -38480,9 +38512,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
38480
38512
|
// src/commands/transcript/move.ts
|
|
38481
38513
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
38482
38514
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
38483
|
-
const processedDir =
|
|
38515
|
+
const processedDir = join95(vttDir, "processed");
|
|
38484
38516
|
mkdirSync32(processedDir, { recursive: true });
|
|
38485
|
-
renameSync2(sourcePath,
|
|
38517
|
+
renameSync2(sourcePath, join95(processedDir, filename));
|
|
38486
38518
|
}
|
|
38487
38519
|
function move(file, options2) {
|
|
38488
38520
|
const { date, client } = options2;
|
|
@@ -38492,19 +38524,19 @@ function move(file, options2) {
|
|
|
38492
38524
|
}
|
|
38493
38525
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
38494
38526
|
const filename = basename25(file);
|
|
38495
|
-
const sourcePath =
|
|
38527
|
+
const sourcePath = join95(vttDir, filename);
|
|
38496
38528
|
if (!existsSync77(sourcePath)) {
|
|
38497
38529
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
38498
38530
|
process.exit(1);
|
|
38499
38531
|
}
|
|
38500
38532
|
const base = basename25(filename, ".vtt").replace(/ Transcription$/, "");
|
|
38501
38533
|
const outputName = `${date} ${base}.md`;
|
|
38502
|
-
const formattedDir =
|
|
38534
|
+
const formattedDir = join95(transcriptsDir, client);
|
|
38503
38535
|
mkdirSync32(formattedDir, { recursive: true });
|
|
38504
|
-
const formattedPath =
|
|
38536
|
+
const formattedPath = join95(formattedDir, outputName);
|
|
38505
38537
|
writeFileSync50(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
38506
38538
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
38507
|
-
const summaryPath =
|
|
38539
|
+
const summaryPath = join95(summaryDir, client, outputName);
|
|
38508
38540
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
38509
38541
|
console.log(`Summary target: ${summaryPath}`);
|
|
38510
38542
|
}
|
|
@@ -39665,11 +39697,11 @@ function changedPaths(from, cwd) {
|
|
|
39665
39697
|
}
|
|
39666
39698
|
|
|
39667
39699
|
// src/commands/watch/readBuiltVersion.ts
|
|
39668
|
-
import { join as
|
|
39700
|
+
import { join as join96 } from "path";
|
|
39669
39701
|
function readBuiltVersion(cwd) {
|
|
39670
39702
|
try {
|
|
39671
39703
|
const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
39672
|
-
return readPackageJson(
|
|
39704
|
+
return readPackageJson(join96(root2, "package.json")).version ?? "unknown";
|
|
39673
39705
|
} catch {
|
|
39674
39706
|
return "unknown";
|
|
39675
39707
|
}
|
|
@@ -40292,7 +40324,7 @@ function registerWatch(program2) {
|
|
|
40292
40324
|
|
|
40293
40325
|
// src/commands/roam/auth.ts
|
|
40294
40326
|
import { randomBytes } from "crypto";
|
|
40295
|
-
import
|
|
40327
|
+
import chalk253 from "chalk";
|
|
40296
40328
|
|
|
40297
40329
|
// src/commands/roam/waitForCallback.ts
|
|
40298
40330
|
import { createServer as createServer3 } from "http";
|
|
@@ -40423,13 +40455,13 @@ async function auth() {
|
|
|
40423
40455
|
saveGlobalConfig(config);
|
|
40424
40456
|
const state = randomBytes(16).toString("hex");
|
|
40425
40457
|
console.log(
|
|
40426
|
-
|
|
40458
|
+
chalk253.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
40427
40459
|
);
|
|
40428
|
-
console.log(
|
|
40429
|
-
console.log(
|
|
40430
|
-
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..."));
|
|
40431
40463
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
40432
|
-
console.log(
|
|
40464
|
+
console.log(chalk253.dim("Exchanging code for tokens..."));
|
|
40433
40465
|
const tokens = await exchangeToken({
|
|
40434
40466
|
code,
|
|
40435
40467
|
clientId,
|
|
@@ -40445,14 +40477,14 @@ async function auth() {
|
|
|
40445
40477
|
};
|
|
40446
40478
|
saveGlobalConfig(config);
|
|
40447
40479
|
console.log(
|
|
40448
|
-
|
|
40480
|
+
chalk253.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
40449
40481
|
);
|
|
40450
40482
|
}
|
|
40451
40483
|
|
|
40452
40484
|
// src/commands/roam/postRoamActivity.ts
|
|
40453
40485
|
import { execFileSync as execFileSync22 } from "child_process";
|
|
40454
40486
|
import { readdirSync as readdirSync22, readFileSync as readFileSync62, statSync as statSync13 } from "fs";
|
|
40455
|
-
import { join as
|
|
40487
|
+
import { join as join97 } from "path";
|
|
40456
40488
|
function findPortFile(roamDir) {
|
|
40457
40489
|
let entries;
|
|
40458
40490
|
try {
|
|
@@ -40461,7 +40493,7 @@ function findPortFile(roamDir) {
|
|
|
40461
40493
|
return void 0;
|
|
40462
40494
|
}
|
|
40463
40495
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
40464
|
-
const path106 =
|
|
40496
|
+
const path106 = join97(roamDir, name);
|
|
40465
40497
|
try {
|
|
40466
40498
|
return { path: path106, mtimeMs: statSync13(path106).mtimeMs };
|
|
40467
40499
|
} catch {
|
|
@@ -40478,7 +40510,7 @@ var PID_BY_APP = {
|
|
|
40478
40510
|
function postRoamActivity(app, event) {
|
|
40479
40511
|
const appData = process.env.APPDATA;
|
|
40480
40512
|
if (!appData) return;
|
|
40481
|
-
const portFile = findPortFile(
|
|
40513
|
+
const portFile = findPortFile(join97(appData, "Roam"));
|
|
40482
40514
|
if (!portFile) return;
|
|
40483
40515
|
let port;
|
|
40484
40516
|
try {
|
|
@@ -40614,7 +40646,7 @@ async function run3(name, args) {
|
|
|
40614
40646
|
|
|
40615
40647
|
// src/commands/run/add.ts
|
|
40616
40648
|
import { mkdirSync as mkdirSync33, writeFileSync as writeFileSync53 } from "fs";
|
|
40617
|
-
import { join as
|
|
40649
|
+
import { join as join98 } from "path";
|
|
40618
40650
|
|
|
40619
40651
|
// src/commands/run/extractOption.ts
|
|
40620
40652
|
function extractOption(args, flag) {
|
|
@@ -40675,7 +40707,7 @@ function saveNewRunConfig(name, command, args, cwd) {
|
|
|
40675
40707
|
saveConfig(config);
|
|
40676
40708
|
}
|
|
40677
40709
|
function createCommandFile(name) {
|
|
40678
|
-
const dir =
|
|
40710
|
+
const dir = join98(".claude", "commands");
|
|
40679
40711
|
mkdirSync33(dir, { recursive: true });
|
|
40680
40712
|
const content = `---
|
|
40681
40713
|
description: Run ${name}
|
|
@@ -40683,7 +40715,7 @@ description: Run ${name}
|
|
|
40683
40715
|
|
|
40684
40716
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
40685
40717
|
`;
|
|
40686
|
-
const filePath =
|
|
40718
|
+
const filePath = join98(dir, `${name}.md`);
|
|
40687
40719
|
writeFileSync53(filePath, content);
|
|
40688
40720
|
console.log(`Created command file: ${filePath}`);
|
|
40689
40721
|
}
|
|
@@ -40740,7 +40772,7 @@ function link2() {
|
|
|
40740
40772
|
|
|
40741
40773
|
// src/commands/run/remove.ts
|
|
40742
40774
|
import { existsSync as existsSync82, unlinkSync as unlinkSync21 } from "fs";
|
|
40743
|
-
import { join as
|
|
40775
|
+
import { join as join99 } from "path";
|
|
40744
40776
|
function findRemoveIndex() {
|
|
40745
40777
|
const idx = process.argv.indexOf("remove");
|
|
40746
40778
|
if (idx === -1 || idx + 1 >= process.argv.length) return -1;
|
|
@@ -40755,7 +40787,7 @@ function parseRemoveName() {
|
|
|
40755
40787
|
return process.argv[idx + 1];
|
|
40756
40788
|
}
|
|
40757
40789
|
function deleteCommandFile(name) {
|
|
40758
|
-
const filePath =
|
|
40790
|
+
const filePath = join99(".claude", "commands", `${name}.md`);
|
|
40759
40791
|
if (existsSync82(filePath)) {
|
|
40760
40792
|
unlinkSync21(filePath);
|
|
40761
40793
|
console.log(`Deleted command file: ${filePath}`);
|
|
@@ -40800,18 +40832,18 @@ function registerRun(program2) {
|
|
|
40800
40832
|
}
|
|
40801
40833
|
|
|
40802
40834
|
// src/commands/sessions/nodes/formatLink.ts
|
|
40803
|
-
import
|
|
40835
|
+
import chalk254 from "chalk";
|
|
40804
40836
|
var STATE_COLOURS = {
|
|
40805
|
-
connected:
|
|
40806
|
-
connecting:
|
|
40807
|
-
disconnected:
|
|
40808
|
-
"version-blocked":
|
|
40837
|
+
connected: chalk254.green,
|
|
40838
|
+
connecting: chalk254.yellow,
|
|
40839
|
+
disconnected: chalk254.red,
|
|
40840
|
+
"version-blocked": chalk254.red
|
|
40809
40841
|
};
|
|
40810
40842
|
function formatLink(link3) {
|
|
40811
|
-
const colour = STATE_COLOURS[link3.state] ??
|
|
40843
|
+
const colour = STATE_COLOURS[link3.state] ?? chalk254.white;
|
|
40812
40844
|
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
40813
40845
|
const error = link3.error ? `
|
|
40814
|
-
${
|
|
40846
|
+
${chalk254.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
40815
40847
|
return ` ${link3.name} ${colour(link3.state)} ${link3.url}${peer}${error}`;
|
|
40816
40848
|
}
|
|
40817
40849
|
|
|
@@ -41774,12 +41806,12 @@ import { basename as basename28 } from "path";
|
|
|
41774
41806
|
|
|
41775
41807
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
41776
41808
|
import { existsSync as existsSync86 } from "fs";
|
|
41777
|
-
import { join as
|
|
41809
|
+
import { join as join102 } from "path";
|
|
41778
41810
|
|
|
41779
41811
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
41780
41812
|
import { statSync as statSync15 } from "fs";
|
|
41781
41813
|
import { rm as rm3 } from "fs/promises";
|
|
41782
|
-
import { join as
|
|
41814
|
+
import { join as join101 } from "path";
|
|
41783
41815
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
41784
41816
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
41785
41817
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -41807,7 +41839,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
41807
41839
|
return { removed: true };
|
|
41808
41840
|
}
|
|
41809
41841
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
41810
|
-
return statSync15(
|
|
41842
|
+
return statSync15(join101(worktreePath, ".git"), {
|
|
41811
41843
|
throwIfNoEntry: false
|
|
41812
41844
|
})?.isDirectory() === true;
|
|
41813
41845
|
}
|
|
@@ -41843,7 +41875,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
41843
41875
|
);
|
|
41844
41876
|
}
|
|
41845
41877
|
function strandedReason(worktreePath, cause) {
|
|
41846
|
-
if (!existsSync86(
|
|
41878
|
+
if (!existsSync86(join102(worktreePath, ".git")))
|
|
41847
41879
|
return "its .git link is already gone";
|
|
41848
41880
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
41849
41881
|
return "git no longer recognises it as a working tree";
|
|
@@ -42743,12 +42775,12 @@ import { dirname as dirname42 } from "path";
|
|
|
42743
42775
|
// src/commands/sessions/daemon/worktree/watcherLogPath.ts
|
|
42744
42776
|
import { createHash as createHash4 } from "crypto";
|
|
42745
42777
|
import { homedir as homedir26 } from "os";
|
|
42746
|
-
import { basename as basename29, join as
|
|
42778
|
+
import { basename as basename29, join as join103 } from "path";
|
|
42747
42779
|
function watcherLogPath(cwd) {
|
|
42748
42780
|
const clone = canonicalTreePath(cwd);
|
|
42749
42781
|
const key = createHash4("sha1").update(clone).digest("hex").slice(0, 8);
|
|
42750
|
-
const dir = process.env.ASSIST_WATCHER_LOG_DIR ??
|
|
42751
|
-
return
|
|
42782
|
+
const dir = process.env.ASSIST_WATCHER_LOG_DIR ?? join103(homedir26(), ".assist", "watchers");
|
|
42783
|
+
return join103(dir, `${basename29(clone) || "root"}-${key}.log`);
|
|
42752
42784
|
}
|
|
42753
42785
|
|
|
42754
42786
|
// src/commands/sessions/daemon/worktree/appendWatcherLog.ts
|
|
@@ -46537,7 +46569,7 @@ import { existsSync as existsSync95 } from "fs";
|
|
|
46537
46569
|
|
|
46538
46570
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
46539
46571
|
import { copyFileSync as copyFileSync5, existsSync as existsSync94, mkdirSync as mkdirSync37 } from "fs";
|
|
46540
|
-
import { join as
|
|
46572
|
+
import { join as join105 } from "path";
|
|
46541
46573
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
46542
46574
|
const dir = projectDirForCwd(toCwd);
|
|
46543
46575
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -46546,7 +46578,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
46546
46578
|
);
|
|
46547
46579
|
return;
|
|
46548
46580
|
}
|
|
46549
|
-
const dest =
|
|
46581
|
+
const dest = join105(dir, `${claudeSessionId}.jsonl`);
|
|
46550
46582
|
if (existsSync94(dest)) {
|
|
46551
46583
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
46552
46584
|
return;
|
|
@@ -47616,7 +47648,7 @@ async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
|
47616
47648
|
}
|
|
47617
47649
|
|
|
47618
47650
|
// src/commands/sessions/nodes/printReport.ts
|
|
47619
|
-
import
|
|
47651
|
+
import chalk255 from "chalk";
|
|
47620
47652
|
function printReport(report) {
|
|
47621
47653
|
if (report.links.length === 0) {
|
|
47622
47654
|
console.log(`${report.local} has no links`);
|
|
@@ -47630,11 +47662,11 @@ function printReport(report) {
|
|
|
47630
47662
|
for (const diagnosis of report.links) printDiagnosis(diagnosis);
|
|
47631
47663
|
}
|
|
47632
47664
|
function printDiagnosis(diagnosis) {
|
|
47633
|
-
console.log(`${
|
|
47665
|
+
console.log(`${chalk255.bold(diagnosis.name)} ${chalk255.dim(diagnosis.url)}`);
|
|
47634
47666
|
for (const hop of diagnosis.hops) {
|
|
47635
|
-
const mark = hop.ok ?
|
|
47667
|
+
const mark = hop.ok ? chalk255.green("\u2713") : chalk255.red("\u2717");
|
|
47636
47668
|
console.log(` ${mark} ${hop.hop.padEnd(9)} ${hop.detail ?? hop.error}`);
|
|
47637
|
-
if (hop.remediation) console.log(` ${
|
|
47669
|
+
if (hop.remediation) console.log(` ${chalk255.yellow(hop.remediation)}`);
|
|
47638
47670
|
}
|
|
47639
47671
|
}
|
|
47640
47672
|
|
|
@@ -47654,7 +47686,7 @@ async function doctorNodes(name, options2) {
|
|
|
47654
47686
|
}
|
|
47655
47687
|
|
|
47656
47688
|
// src/commands/sessions/nodes/listNodes.ts
|
|
47657
|
-
import
|
|
47689
|
+
import chalk256 from "chalk";
|
|
47658
47690
|
async function nodesReport() {
|
|
47659
47691
|
const live = await queryNodes();
|
|
47660
47692
|
if (live)
|
|
@@ -47671,10 +47703,10 @@ async function listNodes(options2) {
|
|
|
47671
47703
|
console.log(JSON.stringify(report, null, 2));
|
|
47672
47704
|
return;
|
|
47673
47705
|
}
|
|
47674
|
-
console.log(`${report.local} ${
|
|
47706
|
+
console.log(`${report.local} ${chalk256.dim("(this node)")}`);
|
|
47675
47707
|
if (!report.daemonRunning)
|
|
47676
|
-
console.log(
|
|
47677
|
-
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"));
|
|
47678
47710
|
for (const link3 of report.links) console.log(formatLink(link3));
|
|
47679
47711
|
}
|
|
47680
47712
|
|
|
@@ -47713,14 +47745,14 @@ async function nodeLogs(name, options2) {
|
|
|
47713
47745
|
}
|
|
47714
47746
|
|
|
47715
47747
|
// src/commands/sessions/nodes/linkNode.ts
|
|
47716
|
-
import
|
|
47748
|
+
import chalk259 from "chalk";
|
|
47717
47749
|
|
|
47718
47750
|
// src/commands/sessions/nodes/notifyDaemonLinks.ts
|
|
47719
|
-
import
|
|
47751
|
+
import chalk257 from "chalk";
|
|
47720
47752
|
async function notifyDaemonLinks() {
|
|
47721
47753
|
if (!await isDaemonRunning()) {
|
|
47722
47754
|
console.log(
|
|
47723
|
-
|
|
47755
|
+
chalk257.yellow(
|
|
47724
47756
|
"The sessions daemon is not running; it loads the links when it starts."
|
|
47725
47757
|
)
|
|
47726
47758
|
);
|
|
@@ -47728,11 +47760,11 @@ async function notifyDaemonLinks() {
|
|
|
47728
47760
|
}
|
|
47729
47761
|
try {
|
|
47730
47762
|
await sendToDaemonAwaitAck({ type: "reload-links" });
|
|
47731
|
-
console.log(
|
|
47763
|
+
console.log(chalk257.dim("The sessions daemon reloaded its links."));
|
|
47732
47764
|
} catch (error) {
|
|
47733
47765
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
47734
47766
|
console.log(
|
|
47735
|
-
|
|
47767
|
+
chalk257.yellow(
|
|
47736
47768
|
`Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
|
|
47737
47769
|
)
|
|
47738
47770
|
);
|
|
@@ -47740,7 +47772,7 @@ async function notifyDaemonLinks() {
|
|
|
47740
47772
|
}
|
|
47741
47773
|
|
|
47742
47774
|
// src/commands/sessions/nodes/readLinks.ts
|
|
47743
|
-
import
|
|
47775
|
+
import chalk258 from "chalk";
|
|
47744
47776
|
|
|
47745
47777
|
// src/commands/sessions/nodes/writeLinks.ts
|
|
47746
47778
|
async function writeLinks(links2) {
|
|
@@ -47763,7 +47795,7 @@ async function readLinks() {
|
|
|
47763
47795
|
await writeLinks(links2);
|
|
47764
47796
|
const dropped = stored.filter((link3) => !link3.url).map((link3) => link3.name);
|
|
47765
47797
|
console.log(
|
|
47766
|
-
|
|
47798
|
+
chalk258.yellow(`Removed ${dropped.join(", ")}: ${SSH_LINK_RETIRED}`)
|
|
47767
47799
|
);
|
|
47768
47800
|
return links2;
|
|
47769
47801
|
}
|
|
@@ -47819,7 +47851,7 @@ async function linkNode(name, url, options2) {
|
|
|
47819
47851
|
throw new Error(`${name} is this node; link to a different node`);
|
|
47820
47852
|
const link3 = await buildLink(name, url, options2);
|
|
47821
47853
|
await writeLinks([...others, link3]);
|
|
47822
|
-
console.log(
|
|
47854
|
+
console.log(chalk259.green(`Linked ${name} (${link3.url})`));
|
|
47823
47855
|
await notifyDaemonLinks();
|
|
47824
47856
|
}
|
|
47825
47857
|
|
|
@@ -47834,16 +47866,16 @@ function registerLinkCommand(nodes) {
|
|
|
47834
47866
|
}
|
|
47835
47867
|
|
|
47836
47868
|
// src/commands/sessions/nodes/unlinkNode.ts
|
|
47837
|
-
import
|
|
47869
|
+
import chalk260 from "chalk";
|
|
47838
47870
|
async function unlinkNode(name) {
|
|
47839
47871
|
const links2 = await readLinks();
|
|
47840
47872
|
const remaining = links2.filter((link3) => link3.name !== name);
|
|
47841
47873
|
if (remaining.length === links2.length) {
|
|
47842
|
-
console.log(
|
|
47874
|
+
console.log(chalk260.yellow(`No link named ${name}`));
|
|
47843
47875
|
return;
|
|
47844
47876
|
}
|
|
47845
47877
|
await writeLinks(remaining);
|
|
47846
|
-
console.log(
|
|
47878
|
+
console.log(chalk260.green(`Unlinked ${name}`));
|
|
47847
47879
|
await notifyDaemonLinks();
|
|
47848
47880
|
}
|
|
47849
47881
|
|
|
@@ -47974,7 +48006,7 @@ async function renameSession(title) {
|
|
|
47974
48006
|
|
|
47975
48007
|
// src/commands/sessions/summarise.ts
|
|
47976
48008
|
import * as fs58 from "fs";
|
|
47977
|
-
import
|
|
48009
|
+
import chalk261 from "chalk";
|
|
47978
48010
|
|
|
47979
48011
|
// src/commands/sessions/summarise/shared.ts
|
|
47980
48012
|
import * as fs57 from "fs";
|
|
@@ -48033,22 +48065,22 @@ ${firstMessage}`);
|
|
|
48033
48065
|
async function summarise2(options2) {
|
|
48034
48066
|
const files = await discoverSessionFiles();
|
|
48035
48067
|
if (files.length === 0) {
|
|
48036
|
-
console.log(
|
|
48068
|
+
console.log(chalk261.yellow("No sessions found."));
|
|
48037
48069
|
return;
|
|
48038
48070
|
}
|
|
48039
48071
|
const toProcess = selectCandidates(files, options2);
|
|
48040
48072
|
if (toProcess.length === 0) {
|
|
48041
|
-
console.log(
|
|
48073
|
+
console.log(chalk261.green("All sessions already summarised."));
|
|
48042
48074
|
return;
|
|
48043
48075
|
}
|
|
48044
48076
|
console.log(
|
|
48045
|
-
|
|
48077
|
+
chalk261.cyan(
|
|
48046
48078
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
48047
48079
|
)
|
|
48048
48080
|
);
|
|
48049
48081
|
const { succeeded, failed: failed3 } = processSessions(toProcess);
|
|
48050
48082
|
console.log(
|
|
48051
|
-
|
|
48083
|
+
chalk261.green(`Done: ${succeeded} summarised`) + (failed3 > 0 ? chalk261.yellow(`, ${failed3} skipped`) : "")
|
|
48052
48084
|
);
|
|
48053
48085
|
}
|
|
48054
48086
|
function selectCandidates(files, options2) {
|
|
@@ -48068,16 +48100,16 @@ function processSessions(files) {
|
|
|
48068
48100
|
let failed3 = 0;
|
|
48069
48101
|
for (let i = 0; i < files.length; i++) {
|
|
48070
48102
|
const file = files[i];
|
|
48071
|
-
process.stdout.write(
|
|
48103
|
+
process.stdout.write(chalk261.dim(` [${i + 1}/${files.length}] `));
|
|
48072
48104
|
const summary = summariseSession(file);
|
|
48073
48105
|
if (summary) {
|
|
48074
48106
|
writeSummary(file, summary);
|
|
48075
48107
|
succeeded++;
|
|
48076
|
-
process.stdout.write(`${
|
|
48108
|
+
process.stdout.write(`${chalk261.green("\u2713")} ${summary}
|
|
48077
48109
|
`);
|
|
48078
48110
|
} else {
|
|
48079
48111
|
failed3++;
|
|
48080
|
-
process.stdout.write(` ${
|
|
48112
|
+
process.stdout.write(` ${chalk261.yellow("skip")}
|
|
48081
48113
|
`);
|
|
48082
48114
|
}
|
|
48083
48115
|
}
|
|
@@ -48107,10 +48139,10 @@ function registerSessions(program2) {
|
|
|
48107
48139
|
}
|
|
48108
48140
|
|
|
48109
48141
|
// src/reportCliError.ts
|
|
48110
|
-
import
|
|
48142
|
+
import chalk262 from "chalk";
|
|
48111
48143
|
function reportCliError(error) {
|
|
48112
48144
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
48113
|
-
console.error(
|
|
48145
|
+
console.error(chalk262.red(error.message));
|
|
48114
48146
|
} else {
|
|
48115
48147
|
console.error(error);
|
|
48116
48148
|
}
|