@staff0rd/assist 0.549.1 → 0.550.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/allowed.cli-reads +1 -0
- package/dist/allowed.cli-reads +1 -0
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +441 -352
- 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.550.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -1754,8 +1754,8 @@ function findUnmergedPaths() {
|
|
|
1754
1754
|
}
|
|
1755
1755
|
|
|
1756
1756
|
// src/commands/commit/abortOnConflicts.ts
|
|
1757
|
-
function abort(
|
|
1758
|
-
console.error(`Error: refusing to commit \u2014 ${
|
|
1757
|
+
function abort(headline2, guidance2) {
|
|
1758
|
+
console.error(`Error: refusing to commit \u2014 ${headline2}`);
|
|
1759
1759
|
console.error(guidance2);
|
|
1760
1760
|
console.error("Nothing was committed or pushed.");
|
|
1761
1761
|
process.exit(1);
|
|
@@ -4395,6 +4395,15 @@ var complexityConfigHelp = [
|
|
|
4395
4395
|
}
|
|
4396
4396
|
];
|
|
4397
4397
|
|
|
4398
|
+
// src/commands/config/configConfigHelp.ts
|
|
4399
|
+
var configConfigHelp = [
|
|
4400
|
+
{
|
|
4401
|
+
key: "repos",
|
|
4402
|
+
setter: "assist config set worktree.enabled true -g --repo",
|
|
4403
|
+
note: "per-repo override blocks in ~/.assist.yml, keyed by repo identity; written by 'config set -g --repo [name]'"
|
|
4404
|
+
}
|
|
4405
|
+
];
|
|
4406
|
+
|
|
4398
4407
|
// src/commands/deny/denyConfigHelp.ts
|
|
4399
4408
|
var denyConfigHelp = [
|
|
4400
4409
|
{
|
|
@@ -4804,6 +4813,7 @@ var configHelpEntries = [
|
|
|
4804
4813
|
...branchConfigHelp,
|
|
4805
4814
|
...cliHookConfigHelp,
|
|
4806
4815
|
...complexityConfigHelp,
|
|
4816
|
+
...configConfigHelp,
|
|
4807
4817
|
...denyConfigHelp,
|
|
4808
4818
|
...devlogConfigHelp,
|
|
4809
4819
|
...dotnetConfigHelp,
|
|
@@ -4824,7 +4834,7 @@ var configHelpEntries = [
|
|
|
4824
4834
|
];
|
|
4825
4835
|
|
|
4826
4836
|
// src/commands/verify/pendingConfigDocumentation.ts
|
|
4827
|
-
var pendingConfigDocumentation = /* @__PURE__ */ new Set(
|
|
4837
|
+
var pendingConfigDocumentation = /* @__PURE__ */ new Set();
|
|
4828
4838
|
|
|
4829
4839
|
// src/commands/verify/configKeys.ts
|
|
4830
4840
|
function section(label2, keys) {
|
|
@@ -18061,17 +18071,30 @@ function registerComplexity(program2) {
|
|
|
18061
18071
|
}
|
|
18062
18072
|
|
|
18063
18073
|
// src/commands/config/index.ts
|
|
18074
|
+
import chalk132 from "chalk";
|
|
18064
18075
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
18065
18076
|
function configList() {
|
|
18066
18077
|
const config = maskConfigSecrets(
|
|
18067
18078
|
loadConfig(),
|
|
18068
18079
|
describeConfigNode(assistConfigSchema)
|
|
18069
18080
|
);
|
|
18081
|
+
console.log(
|
|
18082
|
+
chalk132.dim(
|
|
18083
|
+
"# Only the keys that are set; run assist config keys for every key and its default"
|
|
18084
|
+
)
|
|
18085
|
+
);
|
|
18070
18086
|
console.log(stringifyYaml2(config, { lineWidth: 0 }).trimEnd());
|
|
18071
18087
|
}
|
|
18072
18088
|
|
|
18073
18089
|
// src/commands/config/configGet.ts
|
|
18074
|
-
import
|
|
18090
|
+
import chalk133 from "chalk";
|
|
18091
|
+
|
|
18092
|
+
// src/commands/config/formatConfigDefault.ts
|
|
18093
|
+
function formatConfigDefault(leaf) {
|
|
18094
|
+
if (leaf.defaultValue === void 0) return "unset";
|
|
18095
|
+
if (leaf.secret) return SECRET_MASK;
|
|
18096
|
+
return typeof leaf.defaultValue === "object" ? JSON.stringify(leaf.defaultValue) : String(leaf.defaultValue);
|
|
18097
|
+
}
|
|
18075
18098
|
|
|
18076
18099
|
// src/commands/config/maskConfigKeySecrets.ts
|
|
18077
18100
|
function maskConfigKeySecrets(key, value) {
|
|
@@ -18097,12 +18120,69 @@ function requireNestedValue(config, key) {
|
|
|
18097
18120
|
return value;
|
|
18098
18121
|
}
|
|
18099
18122
|
function exitKeyNotSet(key) {
|
|
18100
|
-
|
|
18123
|
+
for (const line of unsetLines(key)) console.error(line);
|
|
18101
18124
|
process.exit(1);
|
|
18102
18125
|
}
|
|
18126
|
+
function unsetLines(key) {
|
|
18127
|
+
const leaf = describeConfigLeaves(assistConfigSchema).find(
|
|
18128
|
+
(candidate) => candidate.key === key
|
|
18129
|
+
);
|
|
18130
|
+
if (!leaf) return [chalk133.red(`Key "${key}" is not set`)];
|
|
18131
|
+
const lines2 = [
|
|
18132
|
+
chalk133.red(
|
|
18133
|
+
leaf.defaultValue === void 0 ? `Key "${key}" is not set and has no schema default` : `Key "${key}" is not set; the schema default is ${formatConfigDefault(leaf)}`
|
|
18134
|
+
)
|
|
18135
|
+
];
|
|
18136
|
+
const help = configHelpForKey(key);
|
|
18137
|
+
if (help) lines2.push(help.note, chalk133.green(help.setter));
|
|
18138
|
+
return lines2;
|
|
18139
|
+
}
|
|
18103
18140
|
|
|
18104
|
-
// src/commands/config/
|
|
18141
|
+
// src/commands/config/configKeys.ts
|
|
18105
18142
|
import chalk134 from "chalk";
|
|
18143
|
+
function configKeys2(filter) {
|
|
18144
|
+
const leaves = describeConfigLeaves(assistConfigSchema);
|
|
18145
|
+
const matches = filter ? leaves.filter(matching(filter)) : leaves;
|
|
18146
|
+
if (matches.length === 0) {
|
|
18147
|
+
console.error(chalk134.red(`No config key matches "${filter}"`));
|
|
18148
|
+
process.exit(1);
|
|
18149
|
+
}
|
|
18150
|
+
console.log(headline(matches.length, leaves.length, filter));
|
|
18151
|
+
console.log(
|
|
18152
|
+
chalk134.dim(
|
|
18153
|
+
"Defaults come from the schema; assist config list shows what is set."
|
|
18154
|
+
)
|
|
18155
|
+
);
|
|
18156
|
+
for (const leaf of matches) {
|
|
18157
|
+
console.log("");
|
|
18158
|
+
for (const line of formatLeaf(leaf, configHelpForKey(leaf.key))) {
|
|
18159
|
+
console.log(line);
|
|
18160
|
+
}
|
|
18161
|
+
}
|
|
18162
|
+
}
|
|
18163
|
+
function matching(filter) {
|
|
18164
|
+
const needle = filter.toLowerCase();
|
|
18165
|
+
return (leaf) => leaf.key.toLowerCase().includes(needle);
|
|
18166
|
+
}
|
|
18167
|
+
function headline(shown, total, filter) {
|
|
18168
|
+
return filter ? chalk134.bold(`${shown} of ${total} config keys matching "${filter}"`) : chalk134.bold(`${total} config keys`);
|
|
18169
|
+
}
|
|
18170
|
+
function formatLeaf(leaf, help) {
|
|
18171
|
+
const meta = [typeText(leaf), `default: ${formatConfigDefault(leaf)}`];
|
|
18172
|
+
if (leaf.secret) meta.push("secret");
|
|
18173
|
+
const lines2 = [`${chalk134.cyan(leaf.key)} ${chalk134.dim(meta.join(" "))}`];
|
|
18174
|
+
if (help) lines2.push(` ${help.note}`, ` ${chalk134.green(help.setter)}`);
|
|
18175
|
+
return lines2;
|
|
18176
|
+
}
|
|
18177
|
+
function typeText(leaf) {
|
|
18178
|
+
if (leaf.enumValues) return leaf.enumValues.join(" | ");
|
|
18179
|
+
if (leaf.unionTypes) return leaf.unionTypes.join(" | ");
|
|
18180
|
+
if (leaf.itemType) return `${leaf.itemType}[]`;
|
|
18181
|
+
return leaf.type;
|
|
18182
|
+
}
|
|
18183
|
+
|
|
18184
|
+
// src/commands/config/configSet.ts
|
|
18185
|
+
import chalk136 from "chalk";
|
|
18106
18186
|
|
|
18107
18187
|
// src/commands/config/coerceCliConfigValue.ts
|
|
18108
18188
|
function coerceCliConfigValue(key, raw) {
|
|
@@ -18123,9 +18203,9 @@ function coerceWithoutSchemaLeaf(raw) {
|
|
|
18123
18203
|
}
|
|
18124
18204
|
|
|
18125
18205
|
// src/commands/config/exitWithConfigErrors.ts
|
|
18126
|
-
import
|
|
18206
|
+
import chalk135 from "chalk";
|
|
18127
18207
|
function exitWithConfigErrors(errors) {
|
|
18128
|
-
for (const error of errors) console.error(
|
|
18208
|
+
for (const error of errors) console.error(chalk135.red(error));
|
|
18129
18209
|
process.exit(1);
|
|
18130
18210
|
}
|
|
18131
18211
|
|
|
@@ -18144,13 +18224,13 @@ function resolveRepoTarget(key, value, repo) {
|
|
|
18144
18224
|
function configSet(key, value, options2 = {}) {
|
|
18145
18225
|
if (options2.repo !== void 0 && !options2.global) {
|
|
18146
18226
|
console.error(
|
|
18147
|
-
|
|
18227
|
+
chalk136.red("--repo writes to the global config; add -g (e.g. -g --repo)")
|
|
18148
18228
|
);
|
|
18149
18229
|
process.exit(1);
|
|
18150
18230
|
}
|
|
18151
18231
|
const resolved = resolveRepoTarget(key, value, options2.repo);
|
|
18152
18232
|
if (resolved.value === void 0) {
|
|
18153
|
-
console.error(
|
|
18233
|
+
console.error(chalk136.red(`Missing required argument for '${resolved.key}'`));
|
|
18154
18234
|
process.exit(1);
|
|
18155
18235
|
}
|
|
18156
18236
|
const coercion = coerceCliConfigValue(resolved.key, resolved.value);
|
|
@@ -18158,7 +18238,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
18158
18238
|
const coerced = coercion.value;
|
|
18159
18239
|
const target = resolved.useRepo ? `repo: ${applyRepoOrExit(resolved.key, coerced, resolved.repoName)}` : applyOrExit(resolved.key, coerced, options2.global ?? false);
|
|
18160
18240
|
const shown = JSON.stringify(maskConfigKeySecrets(resolved.key, coerced));
|
|
18161
|
-
console.log(
|
|
18241
|
+
console.log(chalk136.green(`Set ${resolved.key} = ${shown} (${target})`));
|
|
18162
18242
|
}
|
|
18163
18243
|
function applyOrExit(key, coerced, global) {
|
|
18164
18244
|
const result = applyConfigSet(key, coerced, global);
|
|
@@ -18172,7 +18252,7 @@ function applyRepoOrExit(key, coerced, repoName) {
|
|
|
18172
18252
|
}
|
|
18173
18253
|
|
|
18174
18254
|
// src/commands/config/configUnset.ts
|
|
18175
|
-
import
|
|
18255
|
+
import chalk137 from "chalk";
|
|
18176
18256
|
|
|
18177
18257
|
// src/commands/config/resolveRepoUnsetTarget.ts
|
|
18178
18258
|
function resolveRepoUnsetTarget(key, repo) {
|
|
@@ -18188,7 +18268,7 @@ function resolveRepoUnsetTarget(key, repo) {
|
|
|
18188
18268
|
function configUnset(key, options2 = {}) {
|
|
18189
18269
|
if (options2.repo !== void 0 && !options2.global) {
|
|
18190
18270
|
console.error(
|
|
18191
|
-
|
|
18271
|
+
chalk137.red(
|
|
18192
18272
|
"--repo removes from the global config; add -g (e.g. -g --repo)"
|
|
18193
18273
|
)
|
|
18194
18274
|
);
|
|
@@ -18196,7 +18276,7 @@ function configUnset(key, options2 = {}) {
|
|
|
18196
18276
|
}
|
|
18197
18277
|
const resolved = resolveRepoUnsetTarget(key, options2.repo);
|
|
18198
18278
|
if (resolved.key === void 0) {
|
|
18199
|
-
console.error(
|
|
18279
|
+
console.error(chalk137.red("Missing required argument 'key'"));
|
|
18200
18280
|
process.exit(1);
|
|
18201
18281
|
return;
|
|
18202
18282
|
}
|
|
@@ -18204,11 +18284,11 @@ function configUnset(key, options2 = {}) {
|
|
|
18204
18284
|
if (!result.ok) exitWithConfigErrors(result.errors);
|
|
18205
18285
|
if (!result.removed) {
|
|
18206
18286
|
console.log(
|
|
18207
|
-
|
|
18287
|
+
chalk137.yellow(`${resolved.key} is not set in ${whereLabel(result)}`)
|
|
18208
18288
|
);
|
|
18209
18289
|
return;
|
|
18210
18290
|
}
|
|
18211
|
-
console.log(
|
|
18291
|
+
console.log(chalk137.green(`Unset ${resolved.key} (${targetLabel(result)})`));
|
|
18212
18292
|
}
|
|
18213
18293
|
function whereLabel(result) {
|
|
18214
18294
|
return result.target === "repo" ? `repos.${result.label}` : `the ${result.target} config`;
|
|
@@ -18219,7 +18299,11 @@ function targetLabel(result) {
|
|
|
18219
18299
|
|
|
18220
18300
|
// src/commands/registerConfig.ts
|
|
18221
18301
|
function registerConfig(program2) {
|
|
18222
|
-
const configCommand =
|
|
18302
|
+
const configCommand = configHelp(
|
|
18303
|
+
program2.command("config").description("View and modify assist.yml configuration"),
|
|
18304
|
+
configConfigHelp,
|
|
18305
|
+
"Run 'assist config keys [filter]' to list every config key with its default,\nwhat it does, and the command that sets it."
|
|
18306
|
+
);
|
|
18223
18307
|
configCommand.command("set <key> [value]").description("Set a config value (e.g. commit.push true)").option("-g, --global", "Write to global ~/.assist.yml").option(
|
|
18224
18308
|
"-r, --repo [name]",
|
|
18225
18309
|
"Requires -g: scope the global write to a repo's identity (defaults to the current repo)"
|
|
@@ -18229,44 +18313,49 @@ function registerConfig(program2) {
|
|
|
18229
18313
|
"Requires -g: remove the key from a repo's identity block (defaults to the current repo)"
|
|
18230
18314
|
).action((key, options2) => configUnset(key, options2));
|
|
18231
18315
|
configCommand.command("get <key>").description("Get a config value (secrets print as <hidden>)").option("--reveal", "Print the raw value of a secret, undecorated").action((key, options2) => configGet(key, options2));
|
|
18232
|
-
configCommand.command("list").description(
|
|
18316
|
+
configCommand.command("list").description(
|
|
18317
|
+
"List the config values that are set (secrets print as <hidden>); see 'config keys' for every key"
|
|
18318
|
+
).action(configList);
|
|
18319
|
+
configCommand.command("keys [filter]").description(
|
|
18320
|
+
"List every config key with its default, note and setter (filter narrows by key substring)"
|
|
18321
|
+
).action((filter) => configKeys2(filter));
|
|
18233
18322
|
}
|
|
18234
18323
|
|
|
18235
18324
|
// src/commands/db/reportMigrationStatus.ts
|
|
18236
|
-
import
|
|
18325
|
+
import chalk138 from "chalk";
|
|
18237
18326
|
function reportApplied(applied) {
|
|
18238
18327
|
if (applied.length === 0) {
|
|
18239
|
-
console.error(
|
|
18328
|
+
console.error(chalk138.green("Database is up to date; nothing to apply."));
|
|
18240
18329
|
return;
|
|
18241
18330
|
}
|
|
18242
18331
|
for (const migration of applied) {
|
|
18243
18332
|
console.error(
|
|
18244
|
-
|
|
18333
|
+
chalk138.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
18245
18334
|
);
|
|
18246
18335
|
}
|
|
18247
18336
|
}
|
|
18248
18337
|
function reportMigrationStatus(status3) {
|
|
18249
18338
|
if (status3.state === "in-sync") {
|
|
18250
18339
|
console.error(
|
|
18251
|
-
|
|
18340
|
+
chalk138.green(`In sync at migration ${status3.version} (latest).`)
|
|
18252
18341
|
);
|
|
18253
18342
|
return;
|
|
18254
18343
|
}
|
|
18255
18344
|
if (status3.state === "behind") {
|
|
18256
18345
|
console.error(
|
|
18257
|
-
|
|
18346
|
+
chalk138.yellow(
|
|
18258
18347
|
`Behind: applied ${status3.applied}, build expects ${status3.expected}.`
|
|
18259
18348
|
)
|
|
18260
18349
|
);
|
|
18261
18350
|
console.error(
|
|
18262
|
-
|
|
18351
|
+
chalk138.yellow(
|
|
18263
18352
|
`Pending: ${status3.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
18264
18353
|
)
|
|
18265
18354
|
);
|
|
18266
18355
|
return;
|
|
18267
18356
|
}
|
|
18268
18357
|
console.error(
|
|
18269
|
-
|
|
18358
|
+
chalk138.red(
|
|
18270
18359
|
`Ahead: applied ${status3.applied}, build knows ${status3.expected}. Update assist.`
|
|
18271
18360
|
)
|
|
18272
18361
|
);
|
|
@@ -18301,7 +18390,7 @@ function registerDb(program2) {
|
|
|
18301
18390
|
|
|
18302
18391
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
18303
18392
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs";
|
|
18304
|
-
import
|
|
18393
|
+
import chalk139 from "chalk";
|
|
18305
18394
|
|
|
18306
18395
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
18307
18396
|
import { join as join37 } from "path";
|
|
@@ -18332,7 +18421,7 @@ function dbMigrationConfirm(pin) {
|
|
|
18332
18421
|
sweepRestrictedDir();
|
|
18333
18422
|
const state = readMigrationPinState(pin);
|
|
18334
18423
|
if (!state) {
|
|
18335
|
-
console.error(
|
|
18424
|
+
console.error(chalk139.red(`No pending migration unlock for pin: ${pin}`));
|
|
18336
18425
|
process.exitCode = 1;
|
|
18337
18426
|
return;
|
|
18338
18427
|
}
|
|
@@ -18342,7 +18431,7 @@ function dbMigrationConfirm(pin) {
|
|
|
18342
18431
|
);
|
|
18343
18432
|
unlinkSync9(getMigrationPinPath(pin));
|
|
18344
18433
|
console.log(
|
|
18345
|
-
|
|
18434
|
+
chalk139.green(
|
|
18346
18435
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
18347
18436
|
)
|
|
18348
18437
|
);
|
|
@@ -18351,7 +18440,7 @@ function dbMigrationConfirm(pin) {
|
|
|
18351
18440
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
18352
18441
|
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync27 } from "fs";
|
|
18353
18442
|
import { randomInt as randomInt2 } from "crypto";
|
|
18354
|
-
import
|
|
18443
|
+
import chalk140 from "chalk";
|
|
18355
18444
|
|
|
18356
18445
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
18357
18446
|
function nextMigrationId() {
|
|
@@ -18366,7 +18455,7 @@ function dbMigrationUnlock() {
|
|
|
18366
18455
|
sweepRestrictedDir();
|
|
18367
18456
|
writeFileSync27(getMigrationPinPath(pin), JSON.stringify({ pin, migrationId }));
|
|
18368
18457
|
console.error(
|
|
18369
|
-
|
|
18458
|
+
chalk140.yellow.bold(
|
|
18370
18459
|
"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."
|
|
18371
18460
|
)
|
|
18372
18461
|
);
|
|
@@ -18376,7 +18465,7 @@ function dbMigrationUnlock() {
|
|
|
18376
18465
|
});
|
|
18377
18466
|
if (!delivered) {
|
|
18378
18467
|
console.error(
|
|
18379
|
-
|
|
18468
|
+
chalk140.red(
|
|
18380
18469
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
18381
18470
|
)
|
|
18382
18471
|
);
|
|
@@ -18386,7 +18475,7 @@ function dbMigrationUnlock() {
|
|
|
18386
18475
|
console.log(
|
|
18387
18476
|
`A confirmation pin was sent to your desktop notifications.
|
|
18388
18477
|
To approve creating migration ${migrationId}, run:
|
|
18389
|
-
${
|
|
18478
|
+
${chalk140.cyan(" assist db-migration confirm <PIN>")}
|
|
18390
18479
|
using the pin from that notification.`
|
|
18391
18480
|
);
|
|
18392
18481
|
}
|
|
@@ -18406,7 +18495,7 @@ function registerDbMigration(parent) {
|
|
|
18406
18495
|
|
|
18407
18496
|
// src/commands/deploy/redirect.ts
|
|
18408
18497
|
import { existsSync as existsSync38, readFileSync as readFileSync31, writeFileSync as writeFileSync28 } from "fs";
|
|
18409
|
-
import
|
|
18498
|
+
import chalk141 from "chalk";
|
|
18410
18499
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
18411
18500
|
if (!window.location.pathname.endsWith('/')) {
|
|
18412
18501
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -18415,23 +18504,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
18415
18504
|
function redirect() {
|
|
18416
18505
|
const indexPath = "index.html";
|
|
18417
18506
|
if (!existsSync38(indexPath)) {
|
|
18418
|
-
console.log(
|
|
18507
|
+
console.log(chalk141.yellow("No index.html found"));
|
|
18419
18508
|
return;
|
|
18420
18509
|
}
|
|
18421
18510
|
const content = readFileSync31(indexPath, "utf8");
|
|
18422
18511
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
18423
|
-
console.log(
|
|
18512
|
+
console.log(chalk141.dim("Trailing slash script already present"));
|
|
18424
18513
|
return;
|
|
18425
18514
|
}
|
|
18426
18515
|
const headCloseIndex = content.indexOf("</head>");
|
|
18427
18516
|
if (headCloseIndex === -1) {
|
|
18428
|
-
console.log(
|
|
18517
|
+
console.log(chalk141.red("Could not find </head> tag in index.html"));
|
|
18429
18518
|
return;
|
|
18430
18519
|
}
|
|
18431
18520
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
18432
18521
|
${content.slice(headCloseIndex)}`;
|
|
18433
18522
|
writeFileSync28(indexPath, newContent);
|
|
18434
|
-
console.log(
|
|
18523
|
+
console.log(chalk141.green("Added trailing slash redirect to index.html"));
|
|
18435
18524
|
}
|
|
18436
18525
|
|
|
18437
18526
|
// src/commands/registerDeploy.ts
|
|
@@ -18458,7 +18547,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
18458
18547
|
|
|
18459
18548
|
// src/commands/devlog/shared.ts
|
|
18460
18549
|
import { execSync as execSync36 } from "child_process";
|
|
18461
|
-
import
|
|
18550
|
+
import chalk142 from "chalk";
|
|
18462
18551
|
|
|
18463
18552
|
// src/shared/getRepoName.ts
|
|
18464
18553
|
import { existsSync as existsSync39, readFileSync as readFileSync32 } from "fs";
|
|
@@ -18567,13 +18656,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
18567
18656
|
}
|
|
18568
18657
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
18569
18658
|
for (const commit2 of commits2) {
|
|
18570
|
-
console.log(` ${
|
|
18659
|
+
console.log(` ${chalk142.yellow(commit2.hash)} ${commit2.message}`);
|
|
18571
18660
|
if (verbose) {
|
|
18572
18661
|
const visibleFiles = commit2.files.filter(
|
|
18573
18662
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
18574
18663
|
);
|
|
18575
18664
|
for (const file of visibleFiles) {
|
|
18576
|
-
console.log(` ${
|
|
18665
|
+
console.log(` ${chalk142.dim(file)}`);
|
|
18577
18666
|
}
|
|
18578
18667
|
}
|
|
18579
18668
|
}
|
|
@@ -18598,15 +18687,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
18598
18687
|
}
|
|
18599
18688
|
|
|
18600
18689
|
// src/commands/devlog/list/printDateHeader.ts
|
|
18601
|
-
import
|
|
18690
|
+
import chalk143 from "chalk";
|
|
18602
18691
|
function printDateHeader(date, isSkipped, entries) {
|
|
18603
18692
|
if (isSkipped) {
|
|
18604
|
-
console.log(`${
|
|
18693
|
+
console.log(`${chalk143.bold.blue(date)} ${chalk143.dim("skipped")}`);
|
|
18605
18694
|
} else if (entries && entries.length > 0) {
|
|
18606
|
-
const entryInfo = entries.map((e) => `${
|
|
18607
|
-
console.log(`${
|
|
18695
|
+
const entryInfo = entries.map((e) => `${chalk143.green(e.version)} ${e.title}`).join(" | ");
|
|
18696
|
+
console.log(`${chalk143.bold.blue(date)} ${entryInfo}`);
|
|
18608
18697
|
} else {
|
|
18609
|
-
console.log(`${
|
|
18698
|
+
console.log(`${chalk143.bold.blue(date)} ${chalk143.red("\u26A0 devlog missing")}`);
|
|
18610
18699
|
}
|
|
18611
18700
|
}
|
|
18612
18701
|
|
|
@@ -18710,24 +18799,24 @@ function bumpVersion(version2, type) {
|
|
|
18710
18799
|
|
|
18711
18800
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
18712
18801
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
18713
|
-
import
|
|
18802
|
+
import chalk145 from "chalk";
|
|
18714
18803
|
|
|
18715
18804
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
18716
|
-
import
|
|
18805
|
+
import chalk144 from "chalk";
|
|
18717
18806
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
18718
18807
|
if (conventional && firstHash) {
|
|
18719
18808
|
const version2 = getVersionAtCommit(firstHash);
|
|
18720
18809
|
if (version2) {
|
|
18721
|
-
console.log(`${
|
|
18810
|
+
console.log(`${chalk144.bold("version:")} ${stripToMinor(version2)}`);
|
|
18722
18811
|
} else {
|
|
18723
|
-
console.log(`${
|
|
18812
|
+
console.log(`${chalk144.bold("version:")} ${chalk144.red("unknown")}`);
|
|
18724
18813
|
}
|
|
18725
18814
|
} else if (patchVersion && minorVersion) {
|
|
18726
18815
|
console.log(
|
|
18727
|
-
`${
|
|
18816
|
+
`${chalk144.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
18728
18817
|
);
|
|
18729
18818
|
} else {
|
|
18730
|
-
console.log(`${
|
|
18819
|
+
console.log(`${chalk144.bold("version:")} v0.1 (initial)`);
|
|
18731
18820
|
}
|
|
18732
18821
|
}
|
|
18733
18822
|
|
|
@@ -18775,16 +18864,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
18775
18864
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
18776
18865
|
}
|
|
18777
18866
|
function logName(repoName) {
|
|
18778
|
-
console.log(`${
|
|
18867
|
+
console.log(`${chalk145.bold("name:")} ${repoName}`);
|
|
18779
18868
|
}
|
|
18780
18869
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
18781
18870
|
logName(ctx.repoName);
|
|
18782
18871
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
18783
|
-
console.log(
|
|
18872
|
+
console.log(chalk145.bold.blue(targetDate));
|
|
18784
18873
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
18785
18874
|
}
|
|
18786
18875
|
function logNoCommits(lastInfo) {
|
|
18787
|
-
console.log(
|
|
18876
|
+
console.log(chalk145.dim(noCommitsMessage(!!lastInfo)));
|
|
18788
18877
|
}
|
|
18789
18878
|
|
|
18790
18879
|
// src/commands/devlog/next/index.ts
|
|
@@ -18825,11 +18914,11 @@ function next2(options2) {
|
|
|
18825
18914
|
import { execSync as execSync38 } from "child_process";
|
|
18826
18915
|
|
|
18827
18916
|
// src/commands/devlog/repos/printReposTable.ts
|
|
18828
|
-
import
|
|
18917
|
+
import chalk146 from "chalk";
|
|
18829
18918
|
function colorStatus(status3) {
|
|
18830
|
-
if (status3 === "missing") return
|
|
18831
|
-
if (status3 === "outdated") return
|
|
18832
|
-
return
|
|
18919
|
+
if (status3 === "missing") return chalk146.red(status3);
|
|
18920
|
+
if (status3 === "outdated") return chalk146.yellow(status3);
|
|
18921
|
+
return chalk146.green(status3);
|
|
18833
18922
|
}
|
|
18834
18923
|
function formatRow(row, nameWidth) {
|
|
18835
18924
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -18843,8 +18932,8 @@ function printReposTable(rows) {
|
|
|
18843
18932
|
"Last Devlog".padEnd(11),
|
|
18844
18933
|
"Status"
|
|
18845
18934
|
].join(" ");
|
|
18846
|
-
console.log(
|
|
18847
|
-
console.log(
|
|
18935
|
+
console.log(chalk146.dim(header));
|
|
18936
|
+
console.log(chalk146.dim("-".repeat(header.length)));
|
|
18848
18937
|
for (const row of rows) {
|
|
18849
18938
|
console.log(formatRow(row, nameWidth));
|
|
18850
18939
|
}
|
|
@@ -18902,14 +18991,14 @@ function repos(options2) {
|
|
|
18902
18991
|
// src/commands/devlog/skip.ts
|
|
18903
18992
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
18904
18993
|
import { join as join41 } from "path";
|
|
18905
|
-
import
|
|
18994
|
+
import chalk147 from "chalk";
|
|
18906
18995
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
18907
18996
|
function getBlogConfigPath() {
|
|
18908
18997
|
return join41(BLOG_REPO_ROOT, "assist.yml");
|
|
18909
18998
|
}
|
|
18910
18999
|
function skip(date) {
|
|
18911
19000
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
18912
|
-
console.log(
|
|
19001
|
+
console.log(chalk147.red("Invalid date format. Use YYYY-MM-DD"));
|
|
18913
19002
|
process.exit(1);
|
|
18914
19003
|
}
|
|
18915
19004
|
const repoName = getRepoName();
|
|
@@ -18920,7 +19009,7 @@ function skip(date) {
|
|
|
18920
19009
|
const skipDays = skip2[repoName] ?? [];
|
|
18921
19010
|
if (skipDays.includes(date)) {
|
|
18922
19011
|
console.log(
|
|
18923
|
-
|
|
19012
|
+
chalk147.yellow(`${date} is already in skip list for ${repoName}`)
|
|
18924
19013
|
);
|
|
18925
19014
|
return;
|
|
18926
19015
|
}
|
|
@@ -18930,20 +19019,20 @@ function skip(date) {
|
|
|
18930
19019
|
devlog.skip = skip2;
|
|
18931
19020
|
config.devlog = devlog;
|
|
18932
19021
|
writeFileSync29(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
18933
|
-
console.log(
|
|
19022
|
+
console.log(chalk147.green(`Added ${date} to skip list for ${repoName}`));
|
|
18934
19023
|
}
|
|
18935
19024
|
|
|
18936
19025
|
// src/commands/devlog/version.ts
|
|
18937
|
-
import
|
|
19026
|
+
import chalk148 from "chalk";
|
|
18938
19027
|
function version() {
|
|
18939
19028
|
const config = loadConfig();
|
|
18940
19029
|
const name = getRepoName();
|
|
18941
19030
|
const lastInfo = getLastVersionInfo(name, config);
|
|
18942
19031
|
const lastVersion = lastInfo?.version ?? null;
|
|
18943
19032
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
18944
|
-
console.log(`${
|
|
18945
|
-
console.log(`${
|
|
18946
|
-
console.log(`${
|
|
19033
|
+
console.log(`${chalk148.bold("name:")} ${name}`);
|
|
19034
|
+
console.log(`${chalk148.bold("last:")} ${lastVersion ?? chalk148.dim("none")}`);
|
|
19035
|
+
console.log(`${chalk148.bold("next:")} ${nextVersion ?? chalk148.dim("none")}`);
|
|
18947
19036
|
}
|
|
18948
19037
|
|
|
18949
19038
|
// src/commands/registerDevlog.ts
|
|
@@ -18968,7 +19057,7 @@ function registerDevlog(program2) {
|
|
|
18968
19057
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
18969
19058
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync5 } from "fs";
|
|
18970
19059
|
import { join as join42 } from "path";
|
|
18971
|
-
import
|
|
19060
|
+
import chalk149 from "chalk";
|
|
18972
19061
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
18973
19062
|
function isLockedDll(debugDir) {
|
|
18974
19063
|
let files;
|
|
@@ -19015,14 +19104,14 @@ function checkBuildLocks(startDir) {
|
|
|
19015
19104
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
19016
19105
|
if (locked) {
|
|
19017
19106
|
console.error(
|
|
19018
|
-
|
|
19107
|
+
chalk149.red("Build output locked (is VS debugging?): ") + locked
|
|
19019
19108
|
);
|
|
19020
19109
|
process.exit(1);
|
|
19021
19110
|
}
|
|
19022
19111
|
}
|
|
19023
19112
|
async function checkBuildLocksCommand() {
|
|
19024
19113
|
checkBuildLocks();
|
|
19025
|
-
console.log(
|
|
19114
|
+
console.log(chalk149.green("No build locks detected"));
|
|
19026
19115
|
}
|
|
19027
19116
|
|
|
19028
19117
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -19121,30 +19210,30 @@ function escapeRegex(s) {
|
|
|
19121
19210
|
}
|
|
19122
19211
|
|
|
19123
19212
|
// src/commands/dotnet/printTree.ts
|
|
19124
|
-
import
|
|
19213
|
+
import chalk150 from "chalk";
|
|
19125
19214
|
function printNodes(nodes, prefix2) {
|
|
19126
19215
|
for (let i = 0; i < nodes.length; i++) {
|
|
19127
19216
|
const isLast = i === nodes.length - 1;
|
|
19128
19217
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
19129
19218
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
19130
19219
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
19131
|
-
const label2 = isMissing ?
|
|
19220
|
+
const label2 = isMissing ? chalk150.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
19132
19221
|
console.log(`${prefix2}${connector}${label2}`);
|
|
19133
19222
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
19134
19223
|
}
|
|
19135
19224
|
}
|
|
19136
19225
|
function printTree(tree, totalCount, solutions) {
|
|
19137
|
-
console.log(
|
|
19138
|
-
console.log(
|
|
19226
|
+
console.log(chalk150.bold("\nProject Dependency Tree"));
|
|
19227
|
+
console.log(chalk150.cyan(tree.relativePath));
|
|
19139
19228
|
printNodes(tree.children, "");
|
|
19140
|
-
console.log(
|
|
19229
|
+
console.log(chalk150.dim(`
|
|
19141
19230
|
${totalCount} projects total (including root)`));
|
|
19142
|
-
console.log(
|
|
19231
|
+
console.log(chalk150.bold("\nSolution Membership"));
|
|
19143
19232
|
if (solutions.length === 0) {
|
|
19144
|
-
console.log(
|
|
19233
|
+
console.log(chalk150.yellow(" Not found in any .sln"));
|
|
19145
19234
|
} else {
|
|
19146
19235
|
for (const sln of solutions) {
|
|
19147
|
-
console.log(` ${
|
|
19236
|
+
console.log(` ${chalk150.green(sln)}`);
|
|
19148
19237
|
}
|
|
19149
19238
|
}
|
|
19150
19239
|
console.log();
|
|
@@ -19173,16 +19262,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
19173
19262
|
// src/commands/dotnet/resolveCsproj.ts
|
|
19174
19263
|
import { existsSync as existsSync40 } from "fs";
|
|
19175
19264
|
import path33 from "path";
|
|
19176
|
-
import
|
|
19265
|
+
import chalk151 from "chalk";
|
|
19177
19266
|
function resolveCsproj(csprojPath) {
|
|
19178
19267
|
const resolved = path33.resolve(csprojPath);
|
|
19179
19268
|
if (!existsSync40(resolved)) {
|
|
19180
|
-
console.error(
|
|
19269
|
+
console.error(chalk151.red(`File not found: ${resolved}`));
|
|
19181
19270
|
process.exit(1);
|
|
19182
19271
|
}
|
|
19183
19272
|
const repoRoot2 = findRepoRoot(path33.dirname(resolved));
|
|
19184
19273
|
if (!repoRoot2) {
|
|
19185
|
-
console.error(
|
|
19274
|
+
console.error(chalk151.red("Could not find git repository root"));
|
|
19186
19275
|
process.exit(1);
|
|
19187
19276
|
}
|
|
19188
19277
|
return { resolved, repoRoot: repoRoot2 };
|
|
@@ -19232,12 +19321,12 @@ function getChangedCsFiles(scope) {
|
|
|
19232
19321
|
}
|
|
19233
19322
|
|
|
19234
19323
|
// src/commands/dotnet/inSln.ts
|
|
19235
|
-
import
|
|
19324
|
+
import chalk152 from "chalk";
|
|
19236
19325
|
async function inSln(csprojPath) {
|
|
19237
19326
|
const { resolved, repoRoot: repoRoot2 } = resolveCsproj(csprojPath);
|
|
19238
19327
|
const solutions = findContainingSolutions(resolved, repoRoot2);
|
|
19239
19328
|
if (solutions.length === 0) {
|
|
19240
|
-
console.log(
|
|
19329
|
+
console.log(chalk152.yellow("Not found in any .sln file"));
|
|
19241
19330
|
process.exit(1);
|
|
19242
19331
|
}
|
|
19243
19332
|
for (const sln of solutions) {
|
|
@@ -19246,7 +19335,7 @@ async function inSln(csprojPath) {
|
|
|
19246
19335
|
}
|
|
19247
19336
|
|
|
19248
19337
|
// src/commands/dotnet/inspect.ts
|
|
19249
|
-
import
|
|
19338
|
+
import chalk158 from "chalk";
|
|
19250
19339
|
|
|
19251
19340
|
// src/shared/formatElapsed.ts
|
|
19252
19341
|
function formatElapsed(ms) {
|
|
@@ -19258,12 +19347,12 @@ function formatElapsed(ms) {
|
|
|
19258
19347
|
}
|
|
19259
19348
|
|
|
19260
19349
|
// src/commands/dotnet/displayIssues.ts
|
|
19261
|
-
import
|
|
19350
|
+
import chalk153 from "chalk";
|
|
19262
19351
|
var SEVERITY_COLOR = {
|
|
19263
|
-
ERROR:
|
|
19264
|
-
WARNING:
|
|
19265
|
-
SUGGESTION:
|
|
19266
|
-
HINT:
|
|
19352
|
+
ERROR: chalk153.red,
|
|
19353
|
+
WARNING: chalk153.yellow,
|
|
19354
|
+
SUGGESTION: chalk153.cyan,
|
|
19355
|
+
HINT: chalk153.dim
|
|
19267
19356
|
};
|
|
19268
19357
|
function groupByFile(issues) {
|
|
19269
19358
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -19279,15 +19368,15 @@ function groupByFile(issues) {
|
|
|
19279
19368
|
}
|
|
19280
19369
|
function displayIssues(issues) {
|
|
19281
19370
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
19282
|
-
console.log(
|
|
19371
|
+
console.log(chalk153.bold(file));
|
|
19283
19372
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
19284
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
19373
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk153.white;
|
|
19285
19374
|
console.log(
|
|
19286
|
-
` ${
|
|
19375
|
+
` ${chalk153.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
19287
19376
|
);
|
|
19288
19377
|
}
|
|
19289
19378
|
}
|
|
19290
|
-
console.log(
|
|
19379
|
+
console.log(chalk153.dim(`
|
|
19291
19380
|
${issues.length} issue(s) found`));
|
|
19292
19381
|
}
|
|
19293
19382
|
|
|
@@ -19346,12 +19435,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
19346
19435
|
// src/commands/dotnet/resolveSolution.ts
|
|
19347
19436
|
import { existsSync as existsSync41 } from "fs";
|
|
19348
19437
|
import path34 from "path";
|
|
19349
|
-
import
|
|
19438
|
+
import chalk155 from "chalk";
|
|
19350
19439
|
|
|
19351
19440
|
// src/commands/dotnet/findSolution.ts
|
|
19352
19441
|
import { readdirSync as readdirSync7 } from "fs";
|
|
19353
19442
|
import { dirname as dirname24, join as join43 } from "path";
|
|
19354
|
-
import
|
|
19443
|
+
import chalk154 from "chalk";
|
|
19355
19444
|
function findSlnInDir(dir) {
|
|
19356
19445
|
try {
|
|
19357
19446
|
return readdirSync7(dir).filter((f) => f.endsWith(".sln")).map((f) => join43(dir, f));
|
|
@@ -19367,17 +19456,17 @@ function findSolution() {
|
|
|
19367
19456
|
const slnFiles = findSlnInDir(current);
|
|
19368
19457
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
19369
19458
|
if (slnFiles.length > 1) {
|
|
19370
|
-
console.error(
|
|
19459
|
+
console.error(chalk154.red(`Multiple .sln files found in ${current}:`));
|
|
19371
19460
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
19372
19461
|
console.error(
|
|
19373
|
-
|
|
19462
|
+
chalk154.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
19374
19463
|
);
|
|
19375
19464
|
process.exit(1);
|
|
19376
19465
|
}
|
|
19377
19466
|
if (current === ceiling) break;
|
|
19378
19467
|
current = dirname24(current);
|
|
19379
19468
|
}
|
|
19380
|
-
console.error(
|
|
19469
|
+
console.error(chalk154.red("No .sln file found between cwd and repo root"));
|
|
19381
19470
|
process.exit(1);
|
|
19382
19471
|
}
|
|
19383
19472
|
|
|
@@ -19386,7 +19475,7 @@ function resolveSolution(sln) {
|
|
|
19386
19475
|
if (sln) {
|
|
19387
19476
|
const resolved = path34.resolve(sln);
|
|
19388
19477
|
if (!existsSync41(resolved)) {
|
|
19389
|
-
console.error(
|
|
19478
|
+
console.error(chalk155.red(`Solution file not found: ${resolved}`));
|
|
19390
19479
|
process.exit(1);
|
|
19391
19480
|
}
|
|
19392
19481
|
return resolved;
|
|
@@ -19428,14 +19517,14 @@ import { execSync as execSync40 } from "child_process";
|
|
|
19428
19517
|
import { existsSync as existsSync42, readFileSync as readFileSync36, unlinkSync as unlinkSync10 } from "fs";
|
|
19429
19518
|
import { tmpdir as tmpdir4 } from "os";
|
|
19430
19519
|
import path35 from "path";
|
|
19431
|
-
import
|
|
19520
|
+
import chalk156 from "chalk";
|
|
19432
19521
|
function assertJbInstalled() {
|
|
19433
19522
|
try {
|
|
19434
19523
|
execSync40("jb inspectcode --version", { stdio: "pipe" });
|
|
19435
19524
|
} catch {
|
|
19436
|
-
console.error(
|
|
19525
|
+
console.error(chalk156.red("jb is not installed. Install with:"));
|
|
19437
19526
|
console.error(
|
|
19438
|
-
|
|
19527
|
+
chalk156.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
19439
19528
|
);
|
|
19440
19529
|
process.exit(1);
|
|
19441
19530
|
}
|
|
@@ -19453,11 +19542,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
19453
19542
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
19454
19543
|
process.stderr.write(error.stderr);
|
|
19455
19544
|
}
|
|
19456
|
-
console.error(
|
|
19545
|
+
console.error(chalk156.red("jb inspectcode failed"));
|
|
19457
19546
|
process.exit(1);
|
|
19458
19547
|
}
|
|
19459
19548
|
if (!existsSync42(reportPath)) {
|
|
19460
|
-
console.error(
|
|
19549
|
+
console.error(chalk156.red("Report file not generated"));
|
|
19461
19550
|
process.exit(1);
|
|
19462
19551
|
}
|
|
19463
19552
|
const xml = readFileSync36(reportPath, "utf8");
|
|
@@ -19467,7 +19556,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
19467
19556
|
|
|
19468
19557
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
19469
19558
|
import { execSync as execSync41 } from "child_process";
|
|
19470
|
-
import
|
|
19559
|
+
import chalk157 from "chalk";
|
|
19471
19560
|
function resolveMsbuildPath() {
|
|
19472
19561
|
const { run: run4 } = loadConfig();
|
|
19473
19562
|
const configs = resolveRunConfigs(run4, runConfigBaseDir());
|
|
@@ -19479,9 +19568,9 @@ function assertMsbuildInstalled() {
|
|
|
19479
19568
|
try {
|
|
19480
19569
|
execSync41(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
19481
19570
|
} catch {
|
|
19482
|
-
console.error(
|
|
19571
|
+
console.error(chalk157.red(`msbuild not found at: ${msbuild}`));
|
|
19483
19572
|
console.error(
|
|
19484
|
-
|
|
19573
|
+
chalk157.yellow(
|
|
19485
19574
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
19486
19575
|
)
|
|
19487
19576
|
);
|
|
@@ -19528,17 +19617,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
19528
19617
|
// src/commands/dotnet/inspect.ts
|
|
19529
19618
|
function logScope(changedFiles2) {
|
|
19530
19619
|
if (changedFiles2 === null) {
|
|
19531
|
-
console.log(
|
|
19620
|
+
console.log(chalk158.dim("Inspecting full solution..."));
|
|
19532
19621
|
} else {
|
|
19533
19622
|
console.log(
|
|
19534
|
-
|
|
19623
|
+
chalk158.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
19535
19624
|
);
|
|
19536
19625
|
}
|
|
19537
19626
|
}
|
|
19538
19627
|
function reportResults(issues, elapsed) {
|
|
19539
19628
|
if (issues.length > 0) displayIssues(issues);
|
|
19540
|
-
else console.log(
|
|
19541
|
-
console.log(
|
|
19629
|
+
else console.log(chalk158.green("No issues found"));
|
|
19630
|
+
console.log(chalk158.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
19542
19631
|
if (issues.length > 0) process.exit(1);
|
|
19543
19632
|
}
|
|
19544
19633
|
async function inspect(sln, options2) {
|
|
@@ -19549,7 +19638,7 @@ async function inspect(sln, options2) {
|
|
|
19549
19638
|
const scope = parseScope(options2.scope);
|
|
19550
19639
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
19551
19640
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
19552
|
-
console.log(
|
|
19641
|
+
console.log(chalk158.green("No changed .cs files found"));
|
|
19553
19642
|
return;
|
|
19554
19643
|
}
|
|
19555
19644
|
logScope(changedFiles2);
|
|
@@ -19959,25 +20048,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
19959
20048
|
}
|
|
19960
20049
|
|
|
19961
20050
|
// src/commands/github/printCountTable.ts
|
|
19962
|
-
import
|
|
20051
|
+
import chalk159 from "chalk";
|
|
19963
20052
|
function printCountTable(labelHeader, rows) {
|
|
19964
20053
|
const labelWidth = Math.max(
|
|
19965
20054
|
labelHeader.length,
|
|
19966
20055
|
...rows.map((row) => row.label.length)
|
|
19967
20056
|
);
|
|
19968
20057
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
19969
|
-
console.log(
|
|
19970
|
-
console.log(
|
|
20058
|
+
console.log(chalk159.dim(header));
|
|
20059
|
+
console.log(chalk159.dim("-".repeat(header.length)));
|
|
19971
20060
|
for (const row of rows) {
|
|
19972
20061
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
19973
20062
|
}
|
|
19974
20063
|
}
|
|
19975
20064
|
|
|
19976
20065
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
19977
|
-
import
|
|
20066
|
+
import chalk160 from "chalk";
|
|
19978
20067
|
function printRepoAuthorBreakdown(repos2) {
|
|
19979
20068
|
for (const repo of repos2) {
|
|
19980
|
-
console.log(
|
|
20069
|
+
console.log(chalk160.bold(repo.name));
|
|
19981
20070
|
const authorWidth = Math.max(
|
|
19982
20071
|
0,
|
|
19983
20072
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -20295,7 +20384,7 @@ function registerHandover(program2) {
|
|
|
20295
20384
|
}
|
|
20296
20385
|
|
|
20297
20386
|
// src/commands/jira/acceptanceCriteria.ts
|
|
20298
|
-
import
|
|
20387
|
+
import chalk161 from "chalk";
|
|
20299
20388
|
|
|
20300
20389
|
// src/commands/jira/adfToText.ts
|
|
20301
20390
|
function renderInline(node) {
|
|
@@ -20362,7 +20451,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
20362
20451
|
const parsed = fetchIssue(issueKey, field);
|
|
20363
20452
|
const acValue = parsed?.fields?.[field];
|
|
20364
20453
|
if (!acValue) {
|
|
20365
|
-
console.log(
|
|
20454
|
+
console.log(chalk161.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
20366
20455
|
return;
|
|
20367
20456
|
}
|
|
20368
20457
|
if (typeof acValue === "string") {
|
|
@@ -20428,14 +20517,14 @@ async function jiraAuth() {
|
|
|
20428
20517
|
}
|
|
20429
20518
|
|
|
20430
20519
|
// src/commands/jira/viewIssue.ts
|
|
20431
|
-
import
|
|
20520
|
+
import chalk162 from "chalk";
|
|
20432
20521
|
function viewIssue(issueKey) {
|
|
20433
20522
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
20434
20523
|
const fields = parsed?.fields;
|
|
20435
20524
|
const summary = fields?.summary;
|
|
20436
20525
|
const description = fields?.description;
|
|
20437
20526
|
if (summary) {
|
|
20438
|
-
console.log(
|
|
20527
|
+
console.log(chalk162.bold(summary));
|
|
20439
20528
|
}
|
|
20440
20529
|
if (description) {
|
|
20441
20530
|
if (summary) console.log();
|
|
@@ -20449,7 +20538,7 @@ function viewIssue(issueKey) {
|
|
|
20449
20538
|
}
|
|
20450
20539
|
if (!summary && !description) {
|
|
20451
20540
|
console.log(
|
|
20452
|
-
|
|
20541
|
+
chalk162.yellow(`No summary or description found on ${issueKey}.`)
|
|
20453
20542
|
);
|
|
20454
20543
|
}
|
|
20455
20544
|
}
|
|
@@ -20484,7 +20573,7 @@ import { randomUUID as randomUUID6 } from "crypto";
|
|
|
20484
20573
|
|
|
20485
20574
|
// src/commands/review/checkoutPr.ts
|
|
20486
20575
|
import { execFileSync as execFileSync7 } from "child_process";
|
|
20487
|
-
import
|
|
20576
|
+
import chalk163 from "chalk";
|
|
20488
20577
|
|
|
20489
20578
|
// src/commands/sessions/daemon/daemonLog.ts
|
|
20490
20579
|
var RING_CAPACITY = 1e3;
|
|
@@ -21056,7 +21145,7 @@ async function checkoutPr(number) {
|
|
|
21056
21145
|
try {
|
|
21057
21146
|
execFileSync7("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
21058
21147
|
} catch {
|
|
21059
|
-
console.error(
|
|
21148
|
+
console.error(chalk163.red(`gh pr checkout ${number} failed; aborting.`));
|
|
21060
21149
|
process.exit(1);
|
|
21061
21150
|
}
|
|
21062
21151
|
}
|
|
@@ -21193,15 +21282,15 @@ function registerList(program2) {
|
|
|
21193
21282
|
// src/commands/mermaid/index.ts
|
|
21194
21283
|
import { mkdirSync as mkdirSync17, readdirSync as readdirSync9 } from "fs";
|
|
21195
21284
|
import { resolve as resolve15 } from "path";
|
|
21196
|
-
import
|
|
21285
|
+
import chalk166 from "chalk";
|
|
21197
21286
|
|
|
21198
21287
|
// src/commands/mermaid/exportFile.ts
|
|
21199
21288
|
import { readFileSync as readFileSync38, writeFileSync as writeFileSync31 } from "fs";
|
|
21200
21289
|
import { basename as basename15, extname as extname2, resolve as resolve14 } from "path";
|
|
21201
|
-
import
|
|
21290
|
+
import chalk165 from "chalk";
|
|
21202
21291
|
|
|
21203
21292
|
// src/commands/mermaid/renderBlock.ts
|
|
21204
|
-
import
|
|
21293
|
+
import chalk164 from "chalk";
|
|
21205
21294
|
async function renderBlock(krokiUrl, source) {
|
|
21206
21295
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
21207
21296
|
method: "POST",
|
|
@@ -21210,7 +21299,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
21210
21299
|
});
|
|
21211
21300
|
if (!response.ok) {
|
|
21212
21301
|
console.error(
|
|
21213
|
-
|
|
21302
|
+
chalk164.red(
|
|
21214
21303
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
21215
21304
|
)
|
|
21216
21305
|
);
|
|
@@ -21228,19 +21317,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
21228
21317
|
if (onlyIndex !== void 0) {
|
|
21229
21318
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
21230
21319
|
console.error(
|
|
21231
|
-
|
|
21320
|
+
chalk165.red(
|
|
21232
21321
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
21233
21322
|
)
|
|
21234
21323
|
);
|
|
21235
21324
|
process.exit(1);
|
|
21236
21325
|
}
|
|
21237
21326
|
console.log(
|
|
21238
|
-
|
|
21327
|
+
chalk165.gray(
|
|
21239
21328
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
21240
21329
|
)
|
|
21241
21330
|
);
|
|
21242
21331
|
} else {
|
|
21243
|
-
console.log(
|
|
21332
|
+
console.log(chalk165.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
21244
21333
|
}
|
|
21245
21334
|
for (const [i, source] of blocks.entries()) {
|
|
21246
21335
|
const idx = i + 1;
|
|
@@ -21248,7 +21337,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
21248
21337
|
const outPath = resolve14(outDir, `${stem}-${idx}.svg`);
|
|
21249
21338
|
const svg = await renderBlock(krokiUrl, source);
|
|
21250
21339
|
writeFileSync31(outPath, svg, "utf8");
|
|
21251
|
-
console.log(
|
|
21340
|
+
console.log(chalk165.green(` \u2192 ${outPath}`));
|
|
21252
21341
|
}
|
|
21253
21342
|
}
|
|
21254
21343
|
function extractMermaidBlocks(markdown) {
|
|
@@ -21264,18 +21353,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
21264
21353
|
if (options2.index !== void 0) {
|
|
21265
21354
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
21266
21355
|
console.error(
|
|
21267
|
-
|
|
21356
|
+
chalk166.red(`--index must be a positive integer (got ${options2.index})`)
|
|
21268
21357
|
);
|
|
21269
21358
|
process.exit(1);
|
|
21270
21359
|
}
|
|
21271
21360
|
if (!file) {
|
|
21272
|
-
console.error(
|
|
21361
|
+
console.error(chalk166.red("--index requires a file argument"));
|
|
21273
21362
|
process.exit(1);
|
|
21274
21363
|
}
|
|
21275
21364
|
}
|
|
21276
21365
|
const files = file ? [file] : readdirSync9(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
21277
21366
|
if (files.length === 0) {
|
|
21278
|
-
console.log(
|
|
21367
|
+
console.log(chalk166.gray("No markdown files found in current directory."));
|
|
21279
21368
|
return;
|
|
21280
21369
|
}
|
|
21281
21370
|
for (const f of files) {
|
|
@@ -21302,7 +21391,7 @@ function registerMermaid(program2) {
|
|
|
21302
21391
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
21303
21392
|
import { createServer as createServer2 } from "http";
|
|
21304
21393
|
import { dirname as dirname28 } from "path";
|
|
21305
|
-
import
|
|
21394
|
+
import chalk168 from "chalk";
|
|
21306
21395
|
|
|
21307
21396
|
// src/commands/netcap/corsHeaders.ts
|
|
21308
21397
|
var corsHeaders = {
|
|
@@ -21381,7 +21470,7 @@ function createNetcapHandler(options2) {
|
|
|
21381
21470
|
import { cp, readFile as readFile4, writeFile as writeFile4 } from "fs/promises";
|
|
21382
21471
|
import { networkInterfaces } from "os";
|
|
21383
21472
|
import { join as join52 } from "path";
|
|
21384
|
-
import
|
|
21473
|
+
import chalk167 from "chalk";
|
|
21385
21474
|
|
|
21386
21475
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
21387
21476
|
import { dirname as dirname27, join as join51 } from "path";
|
|
@@ -21425,7 +21514,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
21425
21514
|
const host = lanIPv4();
|
|
21426
21515
|
if (!host) {
|
|
21427
21516
|
console.log(
|
|
21428
|
-
|
|
21517
|
+
chalk167.yellow("could not determine the WSL IP for the extension")
|
|
21429
21518
|
);
|
|
21430
21519
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
21431
21520
|
return source;
|
|
@@ -21436,7 +21525,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
21436
21525
|
return WSL_WINDOWS_PATH;
|
|
21437
21526
|
} catch {
|
|
21438
21527
|
console.log(
|
|
21439
|
-
|
|
21528
|
+
chalk167.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
21440
21529
|
);
|
|
21441
21530
|
return source;
|
|
21442
21531
|
}
|
|
@@ -21469,30 +21558,30 @@ async function netcap(options2) {
|
|
|
21469
21558
|
let count8 = 0;
|
|
21470
21559
|
const handler = createNetcapHandler({
|
|
21471
21560
|
outPath,
|
|
21472
|
-
onPing: () => console.log(
|
|
21561
|
+
onPing: () => console.log(chalk168.dim("ping from extension")),
|
|
21473
21562
|
onCapture: (entry) => {
|
|
21474
21563
|
count8 += 1;
|
|
21475
21564
|
console.log(
|
|
21476
|
-
|
|
21477
|
-
|
|
21565
|
+
chalk168.green(`captured #${count8}`),
|
|
21566
|
+
chalk168.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
21478
21567
|
);
|
|
21479
21568
|
}
|
|
21480
21569
|
});
|
|
21481
21570
|
const server = createServer2(handler);
|
|
21482
21571
|
server.listen(port, () => {
|
|
21483
21572
|
console.log(
|
|
21484
|
-
|
|
21573
|
+
chalk168.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
21485
21574
|
);
|
|
21486
|
-
console.log(
|
|
21575
|
+
console.log(chalk168.dim(`appending captures to ${outPath}`));
|
|
21487
21576
|
if (filter)
|
|
21488
|
-
console.log(
|
|
21489
|
-
console.log(
|
|
21490
|
-
console.log(
|
|
21577
|
+
console.log(chalk168.dim(`forwarding only URLs matching "${filter}"`));
|
|
21578
|
+
console.log(chalk168.dim(`load the unpacked extension from ${extensionPath}`));
|
|
21579
|
+
console.log(chalk168.dim("press Ctrl-C to stop"));
|
|
21491
21580
|
});
|
|
21492
21581
|
process.on("SIGINT", () => {
|
|
21493
21582
|
server.close();
|
|
21494
21583
|
console.log(
|
|
21495
|
-
|
|
21584
|
+
chalk168.bold(
|
|
21496
21585
|
`
|
|
21497
21586
|
netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
21498
21587
|
)
|
|
@@ -21504,7 +21593,7 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
21504
21593
|
// src/commands/netcap/netcapExtract.ts
|
|
21505
21594
|
import { writeFileSync as writeFileSync32 } from "fs";
|
|
21506
21595
|
import { join as join55 } from "path";
|
|
21507
|
-
import
|
|
21596
|
+
import chalk169 from "chalk";
|
|
21508
21597
|
|
|
21509
21598
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
21510
21599
|
import { readFileSync as readFileSync39 } from "fs";
|
|
@@ -21952,8 +22041,8 @@ function netcapExtract(file) {
|
|
|
21952
22041
|
writeFileSync32(outFile, `${JSON.stringify(posts, null, 2)}
|
|
21953
22042
|
`);
|
|
21954
22043
|
console.log(
|
|
21955
|
-
|
|
21956
|
-
|
|
22044
|
+
chalk169.green(`extracted ${posts.length} posts`),
|
|
22045
|
+
chalk169.dim(`-> ${outFile}`)
|
|
21957
22046
|
);
|
|
21958
22047
|
}
|
|
21959
22048
|
|
|
@@ -21974,7 +22063,7 @@ function registerNetcap(program2) {
|
|
|
21974
22063
|
}
|
|
21975
22064
|
|
|
21976
22065
|
// src/commands/news/add/index.ts
|
|
21977
|
-
import
|
|
22066
|
+
import chalk170 from "chalk";
|
|
21978
22067
|
import enquirer8 from "enquirer";
|
|
21979
22068
|
async function add2(url) {
|
|
21980
22069
|
if (!url) {
|
|
@@ -21996,10 +22085,10 @@ async function add2(url) {
|
|
|
21996
22085
|
const { orm } = await getReady();
|
|
21997
22086
|
const added = await addFeed(orm, url);
|
|
21998
22087
|
if (!added) {
|
|
21999
|
-
console.log(
|
|
22088
|
+
console.log(chalk170.yellow("Feed already exists"));
|
|
22000
22089
|
return;
|
|
22001
22090
|
}
|
|
22002
|
-
console.log(
|
|
22091
|
+
console.log(chalk170.green(`Added feed: ${url}`));
|
|
22003
22092
|
}
|
|
22004
22093
|
|
|
22005
22094
|
// src/commands/registerNews.ts
|
|
@@ -22046,7 +22135,7 @@ function registerPiHook(program2) {
|
|
|
22046
22135
|
}
|
|
22047
22136
|
|
|
22048
22137
|
// src/commands/prompts/printPromptsTable.ts
|
|
22049
|
-
import
|
|
22138
|
+
import chalk171 from "chalk";
|
|
22050
22139
|
function truncate(str, max) {
|
|
22051
22140
|
if (str.length <= max) return str;
|
|
22052
22141
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -22064,14 +22153,14 @@ function printPromptsTable(rows) {
|
|
|
22064
22153
|
"Command".padEnd(commandWidth),
|
|
22065
22154
|
"Repos"
|
|
22066
22155
|
].join(" ");
|
|
22067
|
-
console.log(
|
|
22068
|
-
console.log(
|
|
22156
|
+
console.log(chalk171.dim(header));
|
|
22157
|
+
console.log(chalk171.dim("-".repeat(header.length)));
|
|
22069
22158
|
for (const row of rows) {
|
|
22070
22159
|
const count8 = String(row.count).padStart(countWidth);
|
|
22071
22160
|
const tool = row.tool.padEnd(toolWidth);
|
|
22072
22161
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
22073
22162
|
console.log(
|
|
22074
|
-
`${
|
|
22163
|
+
`${chalk171.yellow(count8)} ${tool} ${command} ${chalk171.dim(row.repos)}`
|
|
22075
22164
|
);
|
|
22076
22165
|
}
|
|
22077
22166
|
}
|
|
@@ -22737,13 +22826,13 @@ function agentFooter(unresolvedCount) {
|
|
|
22737
22826
|
}
|
|
22738
22827
|
|
|
22739
22828
|
// src/commands/prs/listComments/commentStyle.ts
|
|
22740
|
-
import
|
|
22829
|
+
import chalk172 from "chalk";
|
|
22741
22830
|
var plain = (text17) => text17;
|
|
22742
22831
|
function colouredState(state) {
|
|
22743
22832
|
const label2 = `[${state}]`;
|
|
22744
|
-
if (state === "APPROVED") return
|
|
22745
|
-
if (state === "CHANGES_REQUESTED") return
|
|
22746
|
-
return
|
|
22833
|
+
if (state === "APPROVED") return chalk172.green(label2);
|
|
22834
|
+
if (state === "CHANGES_REQUESTED") return chalk172.red(label2);
|
|
22835
|
+
return chalk172.yellow(label2);
|
|
22747
22836
|
}
|
|
22748
22837
|
function commentStyle() {
|
|
22749
22838
|
if (isClaudeCode()) {
|
|
@@ -22757,9 +22846,9 @@ function commentStyle() {
|
|
|
22757
22846
|
};
|
|
22758
22847
|
}
|
|
22759
22848
|
return {
|
|
22760
|
-
cyan:
|
|
22761
|
-
bold:
|
|
22762
|
-
dim:
|
|
22849
|
+
cyan: chalk172.cyan,
|
|
22850
|
+
bold: chalk172.bold,
|
|
22851
|
+
dim: chalk172.dim,
|
|
22763
22852
|
state: colouredState,
|
|
22764
22853
|
diffHunk: true,
|
|
22765
22854
|
agent: false
|
|
@@ -22929,13 +23018,13 @@ import { execSync as execSync48 } from "child_process";
|
|
|
22929
23018
|
import enquirer9 from "enquirer";
|
|
22930
23019
|
|
|
22931
23020
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
22932
|
-
import
|
|
23021
|
+
import chalk173 from "chalk";
|
|
22933
23022
|
var STATUS_MAP = {
|
|
22934
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
22935
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
23023
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk173.magenta("merged"), date: pr.mergedAt } : null,
|
|
23024
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk173.red("closed"), date: pr.closedAt } : null
|
|
22936
23025
|
};
|
|
22937
23026
|
function defaultStatus(pr) {
|
|
22938
|
-
return { label:
|
|
23027
|
+
return { label: chalk173.green("opened"), date: pr.createdAt };
|
|
22939
23028
|
}
|
|
22940
23029
|
function getStatus2(pr) {
|
|
22941
23030
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -22944,11 +23033,11 @@ function formatDate(dateStr) {
|
|
|
22944
23033
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
22945
23034
|
}
|
|
22946
23035
|
function formatPrHeader(pr, status3) {
|
|
22947
|
-
return `${
|
|
23036
|
+
return `${chalk173.cyan(`#${pr.number}`)} ${pr.title} ${chalk173.dim(`(${pr.author.login},`)} ${status3.label} ${chalk173.dim(`${formatDate(status3.date)})`)}`;
|
|
22948
23037
|
}
|
|
22949
23038
|
function logPrDetails(pr) {
|
|
22950
23039
|
console.log(
|
|
22951
|
-
|
|
23040
|
+
chalk173.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
22952
23041
|
);
|
|
22953
23042
|
console.log();
|
|
22954
23043
|
}
|
|
@@ -23660,10 +23749,10 @@ function registerPrs(program2) {
|
|
|
23660
23749
|
}
|
|
23661
23750
|
|
|
23662
23751
|
// src/commands/ravendb/ravendbAuth.ts
|
|
23663
|
-
import
|
|
23752
|
+
import chalk179 from "chalk";
|
|
23664
23753
|
|
|
23665
23754
|
// src/shared/createConnectionAuth.ts
|
|
23666
|
-
import
|
|
23755
|
+
import chalk174 from "chalk";
|
|
23667
23756
|
function listConnections(connections, format) {
|
|
23668
23757
|
if (connections.length === 0) {
|
|
23669
23758
|
console.log("No connections configured.");
|
|
@@ -23676,7 +23765,7 @@ function listConnections(connections, format) {
|
|
|
23676
23765
|
function removeConnection(connections, name, save) {
|
|
23677
23766
|
const filtered = connections.filter((c) => c.name !== name);
|
|
23678
23767
|
if (filtered.length === connections.length) {
|
|
23679
|
-
console.error(
|
|
23768
|
+
console.error(chalk174.red(`Connection "${name}" not found.`));
|
|
23680
23769
|
process.exit(1);
|
|
23681
23770
|
}
|
|
23682
23771
|
save(filtered);
|
|
@@ -23722,15 +23811,15 @@ function saveConnections(connections) {
|
|
|
23722
23811
|
}
|
|
23723
23812
|
|
|
23724
23813
|
// src/commands/ravendb/promptConnection.ts
|
|
23725
|
-
import
|
|
23814
|
+
import chalk177 from "chalk";
|
|
23726
23815
|
|
|
23727
23816
|
// src/commands/ravendb/selectOpSecret.ts
|
|
23728
|
-
import
|
|
23817
|
+
import chalk176 from "chalk";
|
|
23729
23818
|
import Enquirer2 from "enquirer";
|
|
23730
23819
|
|
|
23731
23820
|
// src/commands/ravendb/searchItems.ts
|
|
23732
23821
|
import { execSync as execSync51 } from "child_process";
|
|
23733
|
-
import
|
|
23822
|
+
import chalk175 from "chalk";
|
|
23734
23823
|
function opExec(args) {
|
|
23735
23824
|
return execSync51(`op ${args}`, {
|
|
23736
23825
|
encoding: "utf8",
|
|
@@ -23743,7 +23832,7 @@ function searchItems(search2) {
|
|
|
23743
23832
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
23744
23833
|
} catch {
|
|
23745
23834
|
console.error(
|
|
23746
|
-
|
|
23835
|
+
chalk175.red(
|
|
23747
23836
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
23748
23837
|
)
|
|
23749
23838
|
);
|
|
@@ -23757,7 +23846,7 @@ function getItemFields(itemId2) {
|
|
|
23757
23846
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
23758
23847
|
return item.fields.filter((f) => f.reference && f.label);
|
|
23759
23848
|
} catch {
|
|
23760
|
-
console.error(
|
|
23849
|
+
console.error(chalk175.red("Failed to get item details from 1Password."));
|
|
23761
23850
|
process.exit(1);
|
|
23762
23851
|
}
|
|
23763
23852
|
}
|
|
@@ -23776,7 +23865,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
23776
23865
|
}).run();
|
|
23777
23866
|
const items2 = searchItems(search2);
|
|
23778
23867
|
if (items2.length === 0) {
|
|
23779
|
-
console.error(
|
|
23868
|
+
console.error(chalk176.red(`No items found matching "${search2}".`));
|
|
23780
23869
|
process.exit(1);
|
|
23781
23870
|
}
|
|
23782
23871
|
const itemId2 = await selectOne(
|
|
@@ -23785,7 +23874,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
23785
23874
|
);
|
|
23786
23875
|
const fields = getItemFields(itemId2);
|
|
23787
23876
|
if (fields.length === 0) {
|
|
23788
|
-
console.error(
|
|
23877
|
+
console.error(chalk176.red("No fields with references found on this item."));
|
|
23789
23878
|
process.exit(1);
|
|
23790
23879
|
}
|
|
23791
23880
|
const ref = await selectOne(
|
|
@@ -23799,7 +23888,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
23799
23888
|
async function promptConnection(existingNames) {
|
|
23800
23889
|
const name = await promptInput("name", "Connection name:");
|
|
23801
23890
|
if (existingNames.includes(name)) {
|
|
23802
|
-
console.error(
|
|
23891
|
+
console.error(chalk177.red(`Connection "${name}" already exists.`));
|
|
23803
23892
|
process.exit(1);
|
|
23804
23893
|
}
|
|
23805
23894
|
const url = await promptInput(
|
|
@@ -23808,22 +23897,22 @@ async function promptConnection(existingNames) {
|
|
|
23808
23897
|
);
|
|
23809
23898
|
const database = await promptInput("database", "Database name:");
|
|
23810
23899
|
if (!name || !url || !database) {
|
|
23811
|
-
console.error(
|
|
23900
|
+
console.error(chalk177.red("All fields are required."));
|
|
23812
23901
|
process.exit(1);
|
|
23813
23902
|
}
|
|
23814
23903
|
const apiKeyRef = await selectOpSecret();
|
|
23815
|
-
console.log(
|
|
23904
|
+
console.log(chalk177.dim(`Using: ${apiKeyRef}`));
|
|
23816
23905
|
return { name, url, database, apiKeyRef };
|
|
23817
23906
|
}
|
|
23818
23907
|
|
|
23819
23908
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
23820
|
-
import
|
|
23909
|
+
import chalk178 from "chalk";
|
|
23821
23910
|
function ravendbSetConnection(name) {
|
|
23822
23911
|
const raw = loadGlobalConfigRaw();
|
|
23823
23912
|
const ravendb = raw.ravendb ?? {};
|
|
23824
23913
|
const connections = ravendb.connections ?? [];
|
|
23825
23914
|
if (!connections.some((c) => c.name === name)) {
|
|
23826
|
-
console.error(
|
|
23915
|
+
console.error(chalk178.red(`Connection "${name}" not found.`));
|
|
23827
23916
|
console.error(
|
|
23828
23917
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
23829
23918
|
);
|
|
@@ -23839,16 +23928,16 @@ function ravendbSetConnection(name) {
|
|
|
23839
23928
|
var ravendbAuth = createConnectionAuth({
|
|
23840
23929
|
load: loadConnections,
|
|
23841
23930
|
save: saveConnections,
|
|
23842
|
-
format: (c) => `${
|
|
23931
|
+
format: (c) => `${chalk179.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
23843
23932
|
promptNew: promptConnection,
|
|
23844
23933
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
23845
23934
|
});
|
|
23846
23935
|
|
|
23847
23936
|
// src/commands/ravendb/ravendbCollections.ts
|
|
23848
|
-
import
|
|
23937
|
+
import chalk183 from "chalk";
|
|
23849
23938
|
|
|
23850
23939
|
// src/commands/ravendb/ravenFetch.ts
|
|
23851
|
-
import
|
|
23940
|
+
import chalk181 from "chalk";
|
|
23852
23941
|
|
|
23853
23942
|
// src/commands/ravendb/getAccessToken.ts
|
|
23854
23943
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -23885,10 +23974,10 @@ ${errorText}`
|
|
|
23885
23974
|
|
|
23886
23975
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
23887
23976
|
import { execSync as execSync52 } from "child_process";
|
|
23888
|
-
import
|
|
23977
|
+
import chalk180 from "chalk";
|
|
23889
23978
|
function resolveOpSecret(reference) {
|
|
23890
23979
|
if (!reference.startsWith("op://")) {
|
|
23891
|
-
console.error(
|
|
23980
|
+
console.error(chalk180.red(`Invalid secret reference: must start with op://`));
|
|
23892
23981
|
process.exit(1);
|
|
23893
23982
|
}
|
|
23894
23983
|
try {
|
|
@@ -23898,7 +23987,7 @@ function resolveOpSecret(reference) {
|
|
|
23898
23987
|
}).trim();
|
|
23899
23988
|
} catch {
|
|
23900
23989
|
console.error(
|
|
23901
|
-
|
|
23990
|
+
chalk180.red(
|
|
23902
23991
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
23903
23992
|
)
|
|
23904
23993
|
);
|
|
@@ -23925,7 +24014,7 @@ async function ravenFetch(connection, path73) {
|
|
|
23925
24014
|
if (!response.ok) {
|
|
23926
24015
|
const body = await response.text();
|
|
23927
24016
|
console.error(
|
|
23928
|
-
|
|
24017
|
+
chalk181.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
23929
24018
|
);
|
|
23930
24019
|
console.error(body.substring(0, 500));
|
|
23931
24020
|
process.exit(1);
|
|
@@ -23934,7 +24023,7 @@ async function ravenFetch(connection, path73) {
|
|
|
23934
24023
|
}
|
|
23935
24024
|
|
|
23936
24025
|
// src/commands/ravendb/resolveConnection.ts
|
|
23937
|
-
import
|
|
24026
|
+
import chalk182 from "chalk";
|
|
23938
24027
|
function loadRavendb() {
|
|
23939
24028
|
const raw = loadGlobalConfigRaw();
|
|
23940
24029
|
const ravendb = raw.ravendb;
|
|
@@ -23948,7 +24037,7 @@ function resolveConnection(name) {
|
|
|
23948
24037
|
const connectionName = name ?? defaultConnection;
|
|
23949
24038
|
if (!connectionName) {
|
|
23950
24039
|
console.error(
|
|
23951
|
-
|
|
24040
|
+
chalk182.red(
|
|
23952
24041
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
23953
24042
|
)
|
|
23954
24043
|
);
|
|
@@ -23956,7 +24045,7 @@ function resolveConnection(name) {
|
|
|
23956
24045
|
}
|
|
23957
24046
|
const connection = connections.find((c) => c.name === connectionName);
|
|
23958
24047
|
if (!connection) {
|
|
23959
|
-
console.error(
|
|
24048
|
+
console.error(chalk182.red(`Connection "${connectionName}" not found.`));
|
|
23960
24049
|
console.error(
|
|
23961
24050
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
23962
24051
|
);
|
|
@@ -23987,15 +24076,15 @@ async function ravendbCollections(connectionName) {
|
|
|
23987
24076
|
return;
|
|
23988
24077
|
}
|
|
23989
24078
|
for (const c of collections) {
|
|
23990
|
-
console.log(`${
|
|
24079
|
+
console.log(`${chalk183.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
23991
24080
|
}
|
|
23992
24081
|
}
|
|
23993
24082
|
|
|
23994
24083
|
// src/commands/ravendb/ravendbQuery.ts
|
|
23995
|
-
import
|
|
24084
|
+
import chalk185 from "chalk";
|
|
23996
24085
|
|
|
23997
24086
|
// src/commands/ravendb/fetchAllPages.ts
|
|
23998
|
-
import
|
|
24087
|
+
import chalk184 from "chalk";
|
|
23999
24088
|
|
|
24000
24089
|
// src/commands/ravendb/buildQueryPath.ts
|
|
24001
24090
|
function buildQueryPath(opts) {
|
|
@@ -24033,7 +24122,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
24033
24122
|
allResults.push(...results);
|
|
24034
24123
|
start3 += results.length;
|
|
24035
24124
|
process.stderr.write(
|
|
24036
|
-
`\r${
|
|
24125
|
+
`\r${chalk184.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
24037
24126
|
);
|
|
24038
24127
|
if (start3 >= totalResults) break;
|
|
24039
24128
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -24048,7 +24137,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
24048
24137
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
24049
24138
|
const resolved = resolveArgs(connectionName, collection);
|
|
24050
24139
|
if (!resolved.collection && !options2.query) {
|
|
24051
|
-
console.error(
|
|
24140
|
+
console.error(chalk185.red("Provide a collection name or --query filter."));
|
|
24052
24141
|
process.exit(1);
|
|
24053
24142
|
}
|
|
24054
24143
|
const { collection: col } = resolved;
|
|
@@ -24087,7 +24176,7 @@ import { spawn as spawn6 } from "child_process";
|
|
|
24087
24176
|
import * as path36 from "path";
|
|
24088
24177
|
|
|
24089
24178
|
// src/commands/refactor/logViolations.ts
|
|
24090
|
-
import
|
|
24179
|
+
import chalk186 from "chalk";
|
|
24091
24180
|
var DEFAULT_MAX_LINES = 100;
|
|
24092
24181
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
24093
24182
|
if (violations.length === 0) {
|
|
@@ -24096,43 +24185,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
24096
24185
|
}
|
|
24097
24186
|
return;
|
|
24098
24187
|
}
|
|
24099
|
-
console.error(
|
|
24188
|
+
console.error(chalk186.red(`
|
|
24100
24189
|
Refactor check failed:
|
|
24101
24190
|
`));
|
|
24102
|
-
console.error(
|
|
24191
|
+
console.error(chalk186.red(` The following files exceed ${maxLines} lines:
|
|
24103
24192
|
`));
|
|
24104
24193
|
for (const violation of violations) {
|
|
24105
|
-
console.error(
|
|
24194
|
+
console.error(chalk186.red(` ${violation.file} (${violation.lines} lines)`));
|
|
24106
24195
|
}
|
|
24107
24196
|
console.error(
|
|
24108
|
-
|
|
24197
|
+
chalk186.yellow(
|
|
24109
24198
|
`
|
|
24110
24199
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
24111
24200
|
way to refactor it, ignore it with:
|
|
24112
24201
|
`
|
|
24113
24202
|
)
|
|
24114
24203
|
);
|
|
24115
|
-
console.error(
|
|
24204
|
+
console.error(chalk186.gray(` assist refactor ignore <file>
|
|
24116
24205
|
`));
|
|
24117
24206
|
if (process.env.CLAUDECODE) {
|
|
24118
|
-
console.error(
|
|
24207
|
+
console.error(chalk186.cyan(`
|
|
24119
24208
|
## Extracting Code to New Files
|
|
24120
24209
|
`));
|
|
24121
24210
|
console.error(
|
|
24122
|
-
|
|
24211
|
+
chalk186.cyan(
|
|
24123
24212
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
24124
24213
|
`
|
|
24125
24214
|
)
|
|
24126
24215
|
);
|
|
24127
24216
|
console.error(
|
|
24128
|
-
|
|
24217
|
+
chalk186.cyan(
|
|
24129
24218
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
24130
24219
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
24131
24220
|
`
|
|
24132
24221
|
)
|
|
24133
24222
|
);
|
|
24134
24223
|
console.error(
|
|
24135
|
-
|
|
24224
|
+
chalk186.cyan(
|
|
24136
24225
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
24137
24226
|
domains, move it to a common/shared folder.
|
|
24138
24227
|
`
|
|
@@ -24288,7 +24377,7 @@ async function check(pattern2, options2) {
|
|
|
24288
24377
|
|
|
24289
24378
|
// src/commands/refactor/extract/index.ts
|
|
24290
24379
|
import path44 from "path";
|
|
24291
|
-
import
|
|
24380
|
+
import chalk189 from "chalk";
|
|
24292
24381
|
|
|
24293
24382
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
24294
24383
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -24887,23 +24976,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
24887
24976
|
|
|
24888
24977
|
// src/commands/refactor/extract/displayPlan.ts
|
|
24889
24978
|
import path40 from "path";
|
|
24890
|
-
import
|
|
24979
|
+
import chalk187 from "chalk";
|
|
24891
24980
|
function section2(title) {
|
|
24892
24981
|
return `
|
|
24893
|
-
${
|
|
24982
|
+
${chalk187.cyan(title)}`;
|
|
24894
24983
|
}
|
|
24895
24984
|
function displayImporters(plan2, cwd) {
|
|
24896
24985
|
if (plan2.importersToUpdate.length === 0) return;
|
|
24897
24986
|
console.log(section2("Update importers:"));
|
|
24898
24987
|
for (const imp of plan2.importersToUpdate) {
|
|
24899
24988
|
const rel = path40.relative(cwd, imp.file.getFilePath());
|
|
24900
|
-
console.log(` ${
|
|
24989
|
+
console.log(` ${chalk187.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
24901
24990
|
}
|
|
24902
24991
|
}
|
|
24903
24992
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
24904
|
-
console.log(
|
|
24993
|
+
console.log(chalk187.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
24905
24994
|
`));
|
|
24906
|
-
console.log(` ${
|
|
24995
|
+
console.log(` ${chalk187.cyan("Functions to move:")}`);
|
|
24907
24996
|
for (const name of plan2.extractedNames) {
|
|
24908
24997
|
console.log(` ${name}`);
|
|
24909
24998
|
}
|
|
@@ -24937,7 +25026,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
24937
25026
|
|
|
24938
25027
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
24939
25028
|
import path43 from "path";
|
|
24940
|
-
import
|
|
25029
|
+
import chalk188 from "chalk";
|
|
24941
25030
|
import { Project as Project4 } from "ts-morph";
|
|
24942
25031
|
|
|
24943
25032
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -25029,7 +25118,7 @@ function loadProjectFile(file) {
|
|
|
25029
25118
|
});
|
|
25030
25119
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
25031
25120
|
if (!sourceFile) {
|
|
25032
|
-
console.log(
|
|
25121
|
+
console.log(chalk188.red(`File not found in project: ${file}`));
|
|
25033
25122
|
process.exit(1);
|
|
25034
25123
|
}
|
|
25035
25124
|
return { project, sourceFile };
|
|
@@ -25052,19 +25141,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
25052
25141
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
25053
25142
|
if (options2.apply) {
|
|
25054
25143
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
25055
|
-
console.log(
|
|
25144
|
+
console.log(chalk189.green("\nExtraction complete"));
|
|
25056
25145
|
} else {
|
|
25057
|
-
console.log(
|
|
25146
|
+
console.log(chalk189.dim("\nDry run. Use --apply to execute."));
|
|
25058
25147
|
}
|
|
25059
25148
|
}
|
|
25060
25149
|
|
|
25061
25150
|
// src/commands/refactor/ignore.ts
|
|
25062
25151
|
import fs28 from "fs";
|
|
25063
|
-
import
|
|
25152
|
+
import chalk190 from "chalk";
|
|
25064
25153
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
25065
25154
|
function ignore2(file) {
|
|
25066
25155
|
if (!fs28.existsSync(file)) {
|
|
25067
|
-
console.error(
|
|
25156
|
+
console.error(chalk190.red(`Error: File does not exist: ${file}`));
|
|
25068
25157
|
process.exit(1);
|
|
25069
25158
|
}
|
|
25070
25159
|
const content = fs28.readFileSync(file, "utf8");
|
|
@@ -25080,7 +25169,7 @@ function ignore2(file) {
|
|
|
25080
25169
|
fs28.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
25081
25170
|
}
|
|
25082
25171
|
console.log(
|
|
25083
|
-
|
|
25172
|
+
chalk190.green(
|
|
25084
25173
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
25085
25174
|
)
|
|
25086
25175
|
);
|
|
@@ -25089,12 +25178,12 @@ function ignore2(file) {
|
|
|
25089
25178
|
// src/commands/refactor/rename/index.ts
|
|
25090
25179
|
import fs31 from "fs";
|
|
25091
25180
|
import path49 from "path";
|
|
25092
|
-
import
|
|
25181
|
+
import chalk193 from "chalk";
|
|
25093
25182
|
|
|
25094
25183
|
// src/commands/refactor/rename/applyRename.ts
|
|
25095
25184
|
import fs30 from "fs";
|
|
25096
25185
|
import path46 from "path";
|
|
25097
|
-
import
|
|
25186
|
+
import chalk191 from "chalk";
|
|
25098
25187
|
|
|
25099
25188
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
25100
25189
|
import path45 from "path";
|
|
@@ -25199,13 +25288,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
25199
25288
|
const updatedContents = applyRewrites(rewrites);
|
|
25200
25289
|
for (const [file, content] of updatedContents) {
|
|
25201
25290
|
fs30.writeFileSync(file, content, "utf8");
|
|
25202
|
-
console.log(
|
|
25291
|
+
console.log(chalk191.cyan(` Updated imports in ${path46.relative(cwd, file)}`));
|
|
25203
25292
|
}
|
|
25204
25293
|
const destDir = path46.dirname(destPath);
|
|
25205
25294
|
if (!fs30.existsSync(destDir)) fs30.mkdirSync(destDir, { recursive: true });
|
|
25206
25295
|
fs30.renameSync(sourcePath, destPath);
|
|
25207
25296
|
console.log(
|
|
25208
|
-
|
|
25297
|
+
chalk191.white(
|
|
25209
25298
|
` Moved ${path46.relative(cwd, sourcePath)} \u2192 ${path46.relative(cwd, destPath)}`
|
|
25210
25299
|
)
|
|
25211
25300
|
);
|
|
@@ -25292,16 +25381,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
25292
25381
|
|
|
25293
25382
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
25294
25383
|
import path48 from "path";
|
|
25295
|
-
import
|
|
25384
|
+
import chalk192 from "chalk";
|
|
25296
25385
|
function printRenamePreview(rewrites, cwd) {
|
|
25297
25386
|
for (const rewrite of rewrites) {
|
|
25298
25387
|
console.log(
|
|
25299
|
-
|
|
25388
|
+
chalk192.dim(
|
|
25300
25389
|
` ${path48.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
25301
25390
|
)
|
|
25302
25391
|
);
|
|
25303
25392
|
}
|
|
25304
|
-
console.log(
|
|
25393
|
+
console.log(chalk192.dim("Dry run. Use --apply to execute."));
|
|
25305
25394
|
}
|
|
25306
25395
|
|
|
25307
25396
|
// src/commands/refactor/rename/index.ts
|
|
@@ -25312,20 +25401,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
25312
25401
|
const relSource = path49.relative(cwd, sourcePath);
|
|
25313
25402
|
const relDest = path49.relative(cwd, destPath);
|
|
25314
25403
|
if (!fs31.existsSync(sourcePath)) {
|
|
25315
|
-
console.log(
|
|
25404
|
+
console.log(chalk193.red(`File not found: ${source}`));
|
|
25316
25405
|
process.exit(1);
|
|
25317
25406
|
}
|
|
25318
25407
|
if (destPath !== sourcePath && fs31.existsSync(destPath)) {
|
|
25319
|
-
console.log(
|
|
25408
|
+
console.log(chalk193.red(`Destination already exists: ${destination}`));
|
|
25320
25409
|
process.exit(1);
|
|
25321
25410
|
}
|
|
25322
|
-
console.log(
|
|
25323
|
-
console.log(
|
|
25324
|
-
console.log(
|
|
25411
|
+
console.log(chalk193.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
25412
|
+
console.log(chalk193.dim("Loading project..."));
|
|
25413
|
+
console.log(chalk193.dim("Scanning imports across the project..."));
|
|
25325
25414
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
25326
25415
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
25327
25416
|
console.log(
|
|
25328
|
-
|
|
25417
|
+
chalk193.dim(
|
|
25329
25418
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
25330
25419
|
)
|
|
25331
25420
|
);
|
|
@@ -25334,11 +25423,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
25334
25423
|
return;
|
|
25335
25424
|
}
|
|
25336
25425
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
25337
|
-
console.log(
|
|
25426
|
+
console.log(chalk193.green("Done"));
|
|
25338
25427
|
}
|
|
25339
25428
|
|
|
25340
25429
|
// src/commands/refactor/renameSymbol/index.ts
|
|
25341
|
-
import
|
|
25430
|
+
import chalk194 from "chalk";
|
|
25342
25431
|
|
|
25343
25432
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
25344
25433
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -25384,33 +25473,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
25384
25473
|
const { project, sourceFile } = loadProjectFile(file);
|
|
25385
25474
|
const symbol = findSymbol(sourceFile, oldName);
|
|
25386
25475
|
if (!symbol) {
|
|
25387
|
-
console.log(
|
|
25476
|
+
console.log(chalk194.red(`Symbol "${oldName}" not found in ${file}`));
|
|
25388
25477
|
process.exit(1);
|
|
25389
25478
|
}
|
|
25390
25479
|
const grouped = groupReferences(symbol, cwd);
|
|
25391
25480
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
25392
25481
|
console.log(
|
|
25393
|
-
|
|
25482
|
+
chalk194.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
25394
25483
|
`)
|
|
25395
25484
|
);
|
|
25396
25485
|
for (const [refFile, lines2] of grouped) {
|
|
25397
25486
|
console.log(
|
|
25398
|
-
` ${
|
|
25487
|
+
` ${chalk194.dim(refFile)}: lines ${chalk194.cyan(lines2.join(", "))}`
|
|
25399
25488
|
);
|
|
25400
25489
|
}
|
|
25401
25490
|
if (options2.apply) {
|
|
25402
25491
|
symbol.rename(newName);
|
|
25403
25492
|
await project.save();
|
|
25404
|
-
console.log(
|
|
25493
|
+
console.log(chalk194.green(`
|
|
25405
25494
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
25406
25495
|
} else {
|
|
25407
|
-
console.log(
|
|
25496
|
+
console.log(chalk194.dim("\nDry run. Use --apply to execute."));
|
|
25408
25497
|
}
|
|
25409
25498
|
}
|
|
25410
25499
|
|
|
25411
25500
|
// src/commands/refactor/restructure/index.ts
|
|
25412
25501
|
import path57 from "path";
|
|
25413
|
-
import
|
|
25502
|
+
import chalk197 from "chalk";
|
|
25414
25503
|
|
|
25415
25504
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
25416
25505
|
import path51 from "path";
|
|
@@ -25489,50 +25578,50 @@ function clusterFiles(graph) {
|
|
|
25489
25578
|
|
|
25490
25579
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
25491
25580
|
import path53 from "path";
|
|
25492
|
-
import
|
|
25581
|
+
import chalk195 from "chalk";
|
|
25493
25582
|
function relPath(filePath) {
|
|
25494
25583
|
return path53.relative(process.cwd(), filePath);
|
|
25495
25584
|
}
|
|
25496
25585
|
function displayMoves(plan2) {
|
|
25497
25586
|
if (plan2.moves.length === 0) return;
|
|
25498
|
-
console.log(
|
|
25587
|
+
console.log(chalk195.bold("\nFile moves:"));
|
|
25499
25588
|
for (const move2 of plan2.moves) {
|
|
25500
25589
|
console.log(
|
|
25501
|
-
` ${
|
|
25590
|
+
` ${chalk195.red(relPath(move2.from))} \u2192 ${chalk195.green(relPath(move2.to))}`
|
|
25502
25591
|
);
|
|
25503
|
-
console.log(
|
|
25592
|
+
console.log(chalk195.dim(` ${move2.reason}`));
|
|
25504
25593
|
}
|
|
25505
25594
|
}
|
|
25506
25595
|
function displayRewrites(rewrites) {
|
|
25507
25596
|
if (rewrites.length === 0) return;
|
|
25508
25597
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
25509
|
-
console.log(
|
|
25598
|
+
console.log(chalk195.bold(`
|
|
25510
25599
|
Import rewrites (${affectedFiles.size} files):`));
|
|
25511
25600
|
for (const file of affectedFiles) {
|
|
25512
|
-
console.log(` ${
|
|
25601
|
+
console.log(` ${chalk195.cyan(relPath(file))}:`);
|
|
25513
25602
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
25514
25603
|
(r) => r.file === file
|
|
25515
25604
|
)) {
|
|
25516
25605
|
console.log(
|
|
25517
|
-
` ${
|
|
25606
|
+
` ${chalk195.red(`"${oldSpecifier}"`)} \u2192 ${chalk195.green(`"${newSpecifier}"`)}`
|
|
25518
25607
|
);
|
|
25519
25608
|
}
|
|
25520
25609
|
}
|
|
25521
25610
|
}
|
|
25522
25611
|
function displayPlan2(plan2) {
|
|
25523
25612
|
if (plan2.warnings.length > 0) {
|
|
25524
|
-
console.log(
|
|
25525
|
-
for (const w of plan2.warnings) console.log(
|
|
25613
|
+
console.log(chalk195.yellow("\nWarnings:"));
|
|
25614
|
+
for (const w of plan2.warnings) console.log(chalk195.yellow(` ${w}`));
|
|
25526
25615
|
}
|
|
25527
25616
|
if (plan2.newDirectories.length > 0) {
|
|
25528
|
-
console.log(
|
|
25617
|
+
console.log(chalk195.bold("\nNew directories:"));
|
|
25529
25618
|
for (const dir of plan2.newDirectories)
|
|
25530
|
-
console.log(
|
|
25619
|
+
console.log(chalk195.green(` ${dir}/`));
|
|
25531
25620
|
}
|
|
25532
25621
|
displayMoves(plan2);
|
|
25533
25622
|
displayRewrites(plan2.rewrites);
|
|
25534
25623
|
console.log(
|
|
25535
|
-
|
|
25624
|
+
chalk195.dim(
|
|
25536
25625
|
`
|
|
25537
25626
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
25538
25627
|
)
|
|
@@ -25542,18 +25631,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
25542
25631
|
// src/commands/refactor/restructure/executePlan.ts
|
|
25543
25632
|
import fs32 from "fs";
|
|
25544
25633
|
import path54 from "path";
|
|
25545
|
-
import
|
|
25634
|
+
import chalk196 from "chalk";
|
|
25546
25635
|
function executePlan(plan2) {
|
|
25547
25636
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
25548
25637
|
for (const [file, content] of updatedContents) {
|
|
25549
25638
|
fs32.writeFileSync(file, content, "utf8");
|
|
25550
25639
|
console.log(
|
|
25551
|
-
|
|
25640
|
+
chalk196.cyan(` Rewrote imports in ${path54.relative(process.cwd(), file)}`)
|
|
25552
25641
|
);
|
|
25553
25642
|
}
|
|
25554
25643
|
for (const dir of plan2.newDirectories) {
|
|
25555
25644
|
fs32.mkdirSync(dir, { recursive: true });
|
|
25556
|
-
console.log(
|
|
25645
|
+
console.log(chalk196.green(` Created ${path54.relative(process.cwd(), dir)}/`));
|
|
25557
25646
|
}
|
|
25558
25647
|
for (const move2 of plan2.moves) {
|
|
25559
25648
|
const targetDir = path54.dirname(move2.to);
|
|
@@ -25562,7 +25651,7 @@ function executePlan(plan2) {
|
|
|
25562
25651
|
}
|
|
25563
25652
|
fs32.renameSync(move2.from, move2.to);
|
|
25564
25653
|
console.log(
|
|
25565
|
-
|
|
25654
|
+
chalk196.white(
|
|
25566
25655
|
` Moved ${path54.relative(process.cwd(), move2.from)} \u2192 ${path54.relative(process.cwd(), move2.to)}`
|
|
25567
25656
|
)
|
|
25568
25657
|
);
|
|
@@ -25577,7 +25666,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
25577
25666
|
if (entries.length === 0) {
|
|
25578
25667
|
fs32.rmdirSync(dir);
|
|
25579
25668
|
console.log(
|
|
25580
|
-
|
|
25669
|
+
chalk196.dim(
|
|
25581
25670
|
` Removed empty directory ${path54.relative(process.cwd(), dir)}`
|
|
25582
25671
|
)
|
|
25583
25672
|
);
|
|
@@ -25710,22 +25799,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
25710
25799
|
const targetPattern = pattern2 ?? "src";
|
|
25711
25800
|
const files = findSourceFiles2(targetPattern);
|
|
25712
25801
|
if (files.length === 0) {
|
|
25713
|
-
console.log(
|
|
25802
|
+
console.log(chalk197.yellow("No files found matching pattern"));
|
|
25714
25803
|
return;
|
|
25715
25804
|
}
|
|
25716
25805
|
const tsConfigPath = findTsConfig(path57.resolve(files[0]));
|
|
25717
25806
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
25718
25807
|
if (plan2.moves.length === 0) {
|
|
25719
|
-
console.log(
|
|
25808
|
+
console.log(chalk197.green("No restructuring needed"));
|
|
25720
25809
|
return;
|
|
25721
25810
|
}
|
|
25722
25811
|
displayPlan2(plan2);
|
|
25723
25812
|
if (options2.apply) {
|
|
25724
|
-
console.log(
|
|
25813
|
+
console.log(chalk197.bold("\nApplying changes..."));
|
|
25725
25814
|
executePlan(plan2);
|
|
25726
|
-
console.log(
|
|
25815
|
+
console.log(chalk197.green("\nRestructuring complete"));
|
|
25727
25816
|
} else {
|
|
25728
|
-
console.log(
|
|
25817
|
+
console.log(chalk197.dim("\nDry run. Use --apply to execute."));
|
|
25729
25818
|
}
|
|
25730
25819
|
}
|
|
25731
25820
|
|
|
@@ -26370,18 +26459,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
26370
26459
|
}
|
|
26371
26460
|
|
|
26372
26461
|
// src/commands/review/warnOutOfDiff.ts
|
|
26373
|
-
import
|
|
26462
|
+
import chalk198 from "chalk";
|
|
26374
26463
|
function warnOutOfDiff(outOfDiff) {
|
|
26375
26464
|
if (outOfDiff.length === 0) return;
|
|
26376
26465
|
console.warn(
|
|
26377
|
-
|
|
26466
|
+
chalk198.yellow(
|
|
26378
26467
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
26379
26468
|
)
|
|
26380
26469
|
);
|
|
26381
26470
|
for (const finding of outOfDiff) {
|
|
26382
26471
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
26383
26472
|
console.warn(
|
|
26384
|
-
` ${
|
|
26473
|
+
` ${chalk198.yellow("\xB7")} ${finding.title} ${chalk198.dim(
|
|
26385
26474
|
`(${finding.file}:${range})`
|
|
26386
26475
|
)}`
|
|
26387
26476
|
);
|
|
@@ -26405,18 +26494,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
26405
26494
|
}
|
|
26406
26495
|
|
|
26407
26496
|
// src/commands/review/warnUnlocated.ts
|
|
26408
|
-
import
|
|
26497
|
+
import chalk199 from "chalk";
|
|
26409
26498
|
function warnUnlocated(unlocated) {
|
|
26410
26499
|
if (unlocated.length === 0) return;
|
|
26411
26500
|
console.warn(
|
|
26412
|
-
|
|
26501
|
+
chalk199.yellow(
|
|
26413
26502
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
26414
26503
|
)
|
|
26415
26504
|
);
|
|
26416
26505
|
for (const finding of unlocated) {
|
|
26417
|
-
const where = finding.location ||
|
|
26506
|
+
const where = finding.location || chalk199.dim("missing");
|
|
26418
26507
|
console.warn(
|
|
26419
|
-
` ${
|
|
26508
|
+
` ${chalk199.yellow("\xB7")} ${finding.title} ${chalk199.dim(`(${where})`)}`
|
|
26420
26509
|
);
|
|
26421
26510
|
}
|
|
26422
26511
|
}
|
|
@@ -27652,7 +27741,7 @@ function registerReview(program2) {
|
|
|
27652
27741
|
}
|
|
27653
27742
|
|
|
27654
27743
|
// src/commands/seq/seqAuth.ts
|
|
27655
|
-
import
|
|
27744
|
+
import chalk201 from "chalk";
|
|
27656
27745
|
|
|
27657
27746
|
// src/commands/seq/loadConnections.ts
|
|
27658
27747
|
function loadConnections2() {
|
|
@@ -27681,10 +27770,10 @@ function setDefaultConnection(name) {
|
|
|
27681
27770
|
}
|
|
27682
27771
|
|
|
27683
27772
|
// src/shared/assertUniqueName.ts
|
|
27684
|
-
import
|
|
27773
|
+
import chalk200 from "chalk";
|
|
27685
27774
|
function assertUniqueName(existingNames, name) {
|
|
27686
27775
|
if (existingNames.includes(name)) {
|
|
27687
|
-
console.error(
|
|
27776
|
+
console.error(chalk200.red(`Connection "${name}" already exists.`));
|
|
27688
27777
|
process.exit(1);
|
|
27689
27778
|
}
|
|
27690
27779
|
}
|
|
@@ -27702,16 +27791,16 @@ async function promptConnection2(existingNames) {
|
|
|
27702
27791
|
var seqAuth = createConnectionAuth({
|
|
27703
27792
|
load: loadConnections2,
|
|
27704
27793
|
save: saveConnections2,
|
|
27705
|
-
format: (c) => `${
|
|
27794
|
+
format: (c) => `${chalk201.bold(c.name)} ${c.url}`,
|
|
27706
27795
|
promptNew: promptConnection2,
|
|
27707
27796
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
27708
27797
|
});
|
|
27709
27798
|
|
|
27710
27799
|
// src/commands/seq/seqQuery.ts
|
|
27711
|
-
import
|
|
27800
|
+
import chalk205 from "chalk";
|
|
27712
27801
|
|
|
27713
27802
|
// src/commands/seq/fetchSeq.ts
|
|
27714
|
-
import
|
|
27803
|
+
import chalk202 from "chalk";
|
|
27715
27804
|
async function fetchSeq(conn, path73, params) {
|
|
27716
27805
|
const url = `${conn.url}${path73}?${params}`;
|
|
27717
27806
|
const response = await fetch(url, {
|
|
@@ -27722,7 +27811,7 @@ async function fetchSeq(conn, path73, params) {
|
|
|
27722
27811
|
});
|
|
27723
27812
|
if (!response.ok) {
|
|
27724
27813
|
const body = await response.text();
|
|
27725
|
-
console.error(
|
|
27814
|
+
console.error(chalk202.red(`Seq returned ${response.status}: ${body}`));
|
|
27726
27815
|
process.exit(1);
|
|
27727
27816
|
}
|
|
27728
27817
|
return response;
|
|
@@ -27781,23 +27870,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
27781
27870
|
}
|
|
27782
27871
|
|
|
27783
27872
|
// src/commands/seq/formatEvent.ts
|
|
27784
|
-
import
|
|
27873
|
+
import chalk203 from "chalk";
|
|
27785
27874
|
function levelColor(level) {
|
|
27786
27875
|
switch (level) {
|
|
27787
27876
|
case "Fatal":
|
|
27788
|
-
return
|
|
27877
|
+
return chalk203.bgRed.white;
|
|
27789
27878
|
case "Error":
|
|
27790
|
-
return
|
|
27879
|
+
return chalk203.red;
|
|
27791
27880
|
case "Warning":
|
|
27792
|
-
return
|
|
27881
|
+
return chalk203.yellow;
|
|
27793
27882
|
case "Information":
|
|
27794
|
-
return
|
|
27883
|
+
return chalk203.cyan;
|
|
27795
27884
|
case "Debug":
|
|
27796
|
-
return
|
|
27885
|
+
return chalk203.gray;
|
|
27797
27886
|
case "Verbose":
|
|
27798
|
-
return
|
|
27887
|
+
return chalk203.dim;
|
|
27799
27888
|
default:
|
|
27800
|
-
return
|
|
27889
|
+
return chalk203.white;
|
|
27801
27890
|
}
|
|
27802
27891
|
}
|
|
27803
27892
|
function levelAbbrev(level) {
|
|
@@ -27838,12 +27927,12 @@ function formatTimestamp(iso) {
|
|
|
27838
27927
|
function formatEvent(event) {
|
|
27839
27928
|
const color = levelColor(event.Level);
|
|
27840
27929
|
const abbrev = levelAbbrev(event.Level);
|
|
27841
|
-
const ts8 =
|
|
27930
|
+
const ts8 = chalk203.dim(formatTimestamp(event.Timestamp));
|
|
27842
27931
|
const msg = renderMessage(event);
|
|
27843
27932
|
const lines2 = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
27844
27933
|
if (event.Exception) {
|
|
27845
27934
|
for (const line of event.Exception.split("\n")) {
|
|
27846
|
-
lines2.push(
|
|
27935
|
+
lines2.push(chalk203.red(` ${line}`));
|
|
27847
27936
|
}
|
|
27848
27937
|
}
|
|
27849
27938
|
return lines2.join("\n");
|
|
@@ -27876,11 +27965,11 @@ function rejectTimestampFilter(filter) {
|
|
|
27876
27965
|
}
|
|
27877
27966
|
|
|
27878
27967
|
// src/shared/resolveNamedConnection.ts
|
|
27879
|
-
import
|
|
27968
|
+
import chalk204 from "chalk";
|
|
27880
27969
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
27881
27970
|
if (connections.length === 0) {
|
|
27882
27971
|
console.error(
|
|
27883
|
-
|
|
27972
|
+
chalk204.red(
|
|
27884
27973
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
27885
27974
|
)
|
|
27886
27975
|
);
|
|
@@ -27889,7 +27978,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
27889
27978
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
27890
27979
|
const connection = connections.find((c) => c.name === target);
|
|
27891
27980
|
if (!connection) {
|
|
27892
|
-
console.error(
|
|
27981
|
+
console.error(chalk204.red(`${kind} connection "${target}" not found.`));
|
|
27893
27982
|
process.exit(1);
|
|
27894
27983
|
}
|
|
27895
27984
|
return connection;
|
|
@@ -27918,7 +28007,7 @@ async function seqQuery(filter, options2) {
|
|
|
27918
28007
|
new URLSearchParams({ filter, count: String(count8) })
|
|
27919
28008
|
);
|
|
27920
28009
|
if (events.length === 0) {
|
|
27921
|
-
console.log(
|
|
28010
|
+
console.log(chalk205.yellow("No events found."));
|
|
27922
28011
|
return;
|
|
27923
28012
|
}
|
|
27924
28013
|
if (options2.json) {
|
|
@@ -27929,11 +28018,11 @@ async function seqQuery(filter, options2) {
|
|
|
27929
28018
|
for (const event of chronological) {
|
|
27930
28019
|
console.log(formatEvent(event));
|
|
27931
28020
|
}
|
|
27932
|
-
console.log(
|
|
28021
|
+
console.log(chalk205.dim(`
|
|
27933
28022
|
${events.length} events`));
|
|
27934
28023
|
if (events.length >= count8) {
|
|
27935
28024
|
console.log(
|
|
27936
|
-
|
|
28025
|
+
chalk205.yellow(
|
|
27937
28026
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
27938
28027
|
)
|
|
27939
28028
|
);
|
|
@@ -27941,10 +28030,10 @@ ${events.length} events`));
|
|
|
27941
28030
|
}
|
|
27942
28031
|
|
|
27943
28032
|
// src/shared/setNamedDefaultConnection.ts
|
|
27944
|
-
import
|
|
28033
|
+
import chalk206 from "chalk";
|
|
27945
28034
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
27946
28035
|
if (!connections.find((c) => c.name === name)) {
|
|
27947
|
-
console.error(
|
|
28036
|
+
console.error(chalk206.red(`Connection "${name}" not found.`));
|
|
27948
28037
|
process.exit(1);
|
|
27949
28038
|
}
|
|
27950
28039
|
setDefault(name);
|
|
@@ -27993,7 +28082,7 @@ function registerSignal(program2) {
|
|
|
27993
28082
|
}
|
|
27994
28083
|
|
|
27995
28084
|
// src/commands/sql/sqlAuth.ts
|
|
27996
|
-
import
|
|
28085
|
+
import chalk208 from "chalk";
|
|
27997
28086
|
|
|
27998
28087
|
// src/commands/sql/loadConnections.ts
|
|
27999
28088
|
function loadConnections3() {
|
|
@@ -28022,7 +28111,7 @@ function setDefaultConnection2(name) {
|
|
|
28022
28111
|
}
|
|
28023
28112
|
|
|
28024
28113
|
// src/commands/sql/promptConnection.ts
|
|
28025
|
-
import
|
|
28114
|
+
import chalk207 from "chalk";
|
|
28026
28115
|
async function promptConnection3(existingNames) {
|
|
28027
28116
|
const name = await promptInput("name", "Connection name:", "default");
|
|
28028
28117
|
assertUniqueName(existingNames, name);
|
|
@@ -28030,7 +28119,7 @@ async function promptConnection3(existingNames) {
|
|
|
28030
28119
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
28031
28120
|
const port = Number.parseInt(portStr, 10);
|
|
28032
28121
|
if (!Number.isFinite(port)) {
|
|
28033
|
-
console.error(
|
|
28122
|
+
console.error(chalk207.red(`Invalid port "${portStr}".`));
|
|
28034
28123
|
process.exit(1);
|
|
28035
28124
|
}
|
|
28036
28125
|
const user = await promptInput("user", "User:");
|
|
@@ -28043,13 +28132,13 @@ async function promptConnection3(existingNames) {
|
|
|
28043
28132
|
var sqlAuth = createConnectionAuth({
|
|
28044
28133
|
load: loadConnections3,
|
|
28045
28134
|
save: saveConnections3,
|
|
28046
|
-
format: (c) => `${
|
|
28135
|
+
format: (c) => `${chalk208.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
28047
28136
|
promptNew: promptConnection3,
|
|
28048
28137
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
28049
28138
|
});
|
|
28050
28139
|
|
|
28051
28140
|
// src/commands/sql/printTable.ts
|
|
28052
|
-
import
|
|
28141
|
+
import chalk209 from "chalk";
|
|
28053
28142
|
function formatCell(value) {
|
|
28054
28143
|
if (value === null || value === void 0) return "";
|
|
28055
28144
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -28058,7 +28147,7 @@ function formatCell(value) {
|
|
|
28058
28147
|
}
|
|
28059
28148
|
function printTable(rows) {
|
|
28060
28149
|
if (rows.length === 0) {
|
|
28061
|
-
console.log(
|
|
28150
|
+
console.log(chalk209.yellow("(no rows)"));
|
|
28062
28151
|
return;
|
|
28063
28152
|
}
|
|
28064
28153
|
const columns = Object.keys(rows[0]);
|
|
@@ -28066,13 +28155,13 @@ function printTable(rows) {
|
|
|
28066
28155
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
28067
28156
|
);
|
|
28068
28157
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
28069
|
-
console.log(
|
|
28070
|
-
console.log(
|
|
28158
|
+
console.log(chalk209.dim(header));
|
|
28159
|
+
console.log(chalk209.dim("-".repeat(header.length)));
|
|
28071
28160
|
for (const row of rows) {
|
|
28072
28161
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
28073
28162
|
console.log(line);
|
|
28074
28163
|
}
|
|
28075
|
-
console.log(
|
|
28164
|
+
console.log(chalk209.dim(`
|
|
28076
28165
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
28077
28166
|
}
|
|
28078
28167
|
|
|
@@ -28132,7 +28221,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
28132
28221
|
}
|
|
28133
28222
|
|
|
28134
28223
|
// src/commands/sql/sqlMutate.ts
|
|
28135
|
-
import
|
|
28224
|
+
import chalk210 from "chalk";
|
|
28136
28225
|
|
|
28137
28226
|
// src/commands/sql/isMutation.ts
|
|
28138
28227
|
var MUTATION_KEYWORDS = [
|
|
@@ -28166,7 +28255,7 @@ function isMutation(sql25) {
|
|
|
28166
28255
|
async function sqlMutate(query, connectionName) {
|
|
28167
28256
|
if (!isMutation(query)) {
|
|
28168
28257
|
console.error(
|
|
28169
|
-
|
|
28258
|
+
chalk210.red(
|
|
28170
28259
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
28171
28260
|
)
|
|
28172
28261
|
);
|
|
@@ -28176,18 +28265,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
28176
28265
|
const pool = await sqlConnect(conn);
|
|
28177
28266
|
try {
|
|
28178
28267
|
const result = await pool.request().query(query);
|
|
28179
|
-
console.log(
|
|
28268
|
+
console.log(chalk210.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
28180
28269
|
} finally {
|
|
28181
28270
|
await pool.close();
|
|
28182
28271
|
}
|
|
28183
28272
|
}
|
|
28184
28273
|
|
|
28185
28274
|
// src/commands/sql/sqlQuery.ts
|
|
28186
|
-
import
|
|
28275
|
+
import chalk211 from "chalk";
|
|
28187
28276
|
async function sqlQuery(query, connectionName) {
|
|
28188
28277
|
if (isMutation(query)) {
|
|
28189
28278
|
console.error(
|
|
28190
|
-
|
|
28279
|
+
chalk211.red(
|
|
28191
28280
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
28192
28281
|
)
|
|
28193
28282
|
);
|
|
@@ -28202,7 +28291,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
28202
28291
|
printTable(rows);
|
|
28203
28292
|
} else {
|
|
28204
28293
|
console.log(
|
|
28205
|
-
|
|
28294
|
+
chalk211.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
28206
28295
|
);
|
|
28207
28296
|
}
|
|
28208
28297
|
} finally {
|
|
@@ -28347,7 +28436,7 @@ function reportPrune(label2, result, force) {
|
|
|
28347
28436
|
// src/commands/sync/syncClaudeMd.ts
|
|
28348
28437
|
import * as fs36 from "fs";
|
|
28349
28438
|
import * as path60 from "path";
|
|
28350
|
-
import
|
|
28439
|
+
import chalk212 from "chalk";
|
|
28351
28440
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
28352
28441
|
const source = path60.join(claudeDir, "CLAUDE.md");
|
|
28353
28442
|
const target = path60.join(targetBase, "CLAUDE.md");
|
|
@@ -28356,14 +28445,14 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
28356
28445
|
const targetContent = fs36.readFileSync(target, "utf8");
|
|
28357
28446
|
if (sourceContent !== targetContent) {
|
|
28358
28447
|
console.log(
|
|
28359
|
-
|
|
28448
|
+
chalk212.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
28360
28449
|
);
|
|
28361
28450
|
console.log();
|
|
28362
28451
|
printDiff(targetContent, sourceContent);
|
|
28363
28452
|
if (!options2?.yes) {
|
|
28364
28453
|
printAutoConfirmHint();
|
|
28365
28454
|
const confirm = await promptConfirm(
|
|
28366
|
-
|
|
28455
|
+
chalk212.red("Overwrite existing CLAUDE.md?"),
|
|
28367
28456
|
false
|
|
28368
28457
|
);
|
|
28369
28458
|
if (!confirm) {
|
|
@@ -28596,7 +28685,7 @@ function syncPi(claudeDir, options2) {
|
|
|
28596
28685
|
// src/commands/sync/syncSettings.ts
|
|
28597
28686
|
import * as fs42 from "fs";
|
|
28598
28687
|
import * as path67 from "path";
|
|
28599
|
-
import
|
|
28688
|
+
import chalk213 from "chalk";
|
|
28600
28689
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
28601
28690
|
const source = path67.join(claudeDir, "settings.json");
|
|
28602
28691
|
const target = path67.join(targetBase, "settings.json");
|
|
@@ -28615,7 +28704,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
28615
28704
|
if (mergedContent !== normalizedTarget) {
|
|
28616
28705
|
if (!options2?.yes) {
|
|
28617
28706
|
console.log(
|
|
28618
|
-
|
|
28707
|
+
chalk213.yellow(
|
|
28619
28708
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
28620
28709
|
)
|
|
28621
28710
|
);
|
|
@@ -28623,7 +28712,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
28623
28712
|
printDiff(targetContent, mergedContent);
|
|
28624
28713
|
printAutoConfirmHint();
|
|
28625
28714
|
const confirm = await promptConfirm(
|
|
28626
|
-
|
|
28715
|
+
chalk213.red("Overwrite existing settings.json?"),
|
|
28627
28716
|
false
|
|
28628
28717
|
);
|
|
28629
28718
|
if (!confirm) {
|
|
@@ -29981,7 +30070,7 @@ function registerWatch(program2) {
|
|
|
29981
30070
|
|
|
29982
30071
|
// src/commands/roam/auth.ts
|
|
29983
30072
|
import { randomBytes } from "crypto";
|
|
29984
|
-
import
|
|
30073
|
+
import chalk214 from "chalk";
|
|
29985
30074
|
|
|
29986
30075
|
// src/commands/roam/waitForCallback.ts
|
|
29987
30076
|
import { createServer as createServer3 } from "http";
|
|
@@ -30112,13 +30201,13 @@ async function auth() {
|
|
|
30112
30201
|
saveGlobalConfig(config);
|
|
30113
30202
|
const state = randomBytes(16).toString("hex");
|
|
30114
30203
|
console.log(
|
|
30115
|
-
|
|
30204
|
+
chalk214.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
30116
30205
|
);
|
|
30117
|
-
console.log(
|
|
30118
|
-
console.log(
|
|
30119
|
-
console.log(
|
|
30206
|
+
console.log(chalk214.white("http://localhost:14523/callback\n"));
|
|
30207
|
+
console.log(chalk214.blue("Opening browser for authorization..."));
|
|
30208
|
+
console.log(chalk214.dim("Waiting for authorization callback..."));
|
|
30120
30209
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
30121
|
-
console.log(
|
|
30210
|
+
console.log(chalk214.dim("Exchanging code for tokens..."));
|
|
30122
30211
|
const tokens = await exchangeToken({
|
|
30123
30212
|
code,
|
|
30124
30213
|
clientId,
|
|
@@ -30134,7 +30223,7 @@ async function auth() {
|
|
|
30134
30223
|
};
|
|
30135
30224
|
saveGlobalConfig(config);
|
|
30136
30225
|
console.log(
|
|
30137
|
-
|
|
30226
|
+
chalk214.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
30138
30227
|
);
|
|
30139
30228
|
}
|
|
30140
30229
|
|
|
@@ -30485,7 +30574,7 @@ import { execSync as execSync60 } from "child_process";
|
|
|
30485
30574
|
import { existsSync as existsSync67, mkdirSync as mkdirSync30, unlinkSync as unlinkSync22, writeFileSync as writeFileSync45 } from "fs";
|
|
30486
30575
|
import { tmpdir as tmpdir8 } from "os";
|
|
30487
30576
|
import { join as join83, resolve as resolve19 } from "path";
|
|
30488
|
-
import
|
|
30577
|
+
import chalk215 from "chalk";
|
|
30489
30578
|
|
|
30490
30579
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
30491
30580
|
var captureWindowPs1 = `
|
|
@@ -30636,13 +30725,13 @@ function screenshot(processName) {
|
|
|
30636
30725
|
const config = loadConfig();
|
|
30637
30726
|
const outputDir = resolve19(config.screenshot.outputDir);
|
|
30638
30727
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
30639
|
-
console.log(
|
|
30728
|
+
console.log(chalk215.gray(`Capturing window for process "${processName}" ...`));
|
|
30640
30729
|
try {
|
|
30641
30730
|
runPowerShellScript(processName, outputPath);
|
|
30642
|
-
console.log(
|
|
30731
|
+
console.log(chalk215.green(`Screenshot saved: ${outputPath}`));
|
|
30643
30732
|
} catch (error) {
|
|
30644
30733
|
const msg = error instanceof Error ? error.message : String(error);
|
|
30645
|
-
console.error(
|
|
30734
|
+
console.error(chalk215.red(`Failed to capture screenshot: ${msg}`));
|
|
30646
30735
|
process.exit(1);
|
|
30647
30736
|
}
|
|
30648
30737
|
}
|
|
@@ -35814,7 +35903,7 @@ function registerSetStatusCommand(cmd) {
|
|
|
35814
35903
|
|
|
35815
35904
|
// src/commands/sessions/summarise/index.ts
|
|
35816
35905
|
import * as fs50 from "fs";
|
|
35817
|
-
import
|
|
35906
|
+
import chalk216 from "chalk";
|
|
35818
35907
|
|
|
35819
35908
|
// src/commands/sessions/summarise/shared.ts
|
|
35820
35909
|
import * as fs49 from "fs";
|
|
@@ -35873,22 +35962,22 @@ ${firstMessage}`);
|
|
|
35873
35962
|
async function summarise2(options2) {
|
|
35874
35963
|
const files = await discoverSessionFiles();
|
|
35875
35964
|
if (files.length === 0) {
|
|
35876
|
-
console.log(
|
|
35965
|
+
console.log(chalk216.yellow("No sessions found."));
|
|
35877
35966
|
return;
|
|
35878
35967
|
}
|
|
35879
35968
|
const toProcess = selectCandidates(files, options2);
|
|
35880
35969
|
if (toProcess.length === 0) {
|
|
35881
|
-
console.log(
|
|
35970
|
+
console.log(chalk216.green("All sessions already summarised."));
|
|
35882
35971
|
return;
|
|
35883
35972
|
}
|
|
35884
35973
|
console.log(
|
|
35885
|
-
|
|
35974
|
+
chalk216.cyan(
|
|
35886
35975
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
35887
35976
|
)
|
|
35888
35977
|
);
|
|
35889
35978
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
35890
35979
|
console.log(
|
|
35891
|
-
|
|
35980
|
+
chalk216.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk216.yellow(`, ${failed2} skipped`) : "")
|
|
35892
35981
|
);
|
|
35893
35982
|
}
|
|
35894
35983
|
function selectCandidates(files, options2) {
|
|
@@ -35908,16 +35997,16 @@ function processSessions(files) {
|
|
|
35908
35997
|
let failed2 = 0;
|
|
35909
35998
|
for (let i = 0; i < files.length; i++) {
|
|
35910
35999
|
const file = files[i];
|
|
35911
|
-
process.stdout.write(
|
|
36000
|
+
process.stdout.write(chalk216.dim(` [${i + 1}/${files.length}] `));
|
|
35912
36001
|
const summary = summariseSession(file);
|
|
35913
36002
|
if (summary) {
|
|
35914
36003
|
writeSummary(file, summary);
|
|
35915
36004
|
succeeded++;
|
|
35916
|
-
process.stdout.write(`${
|
|
36005
|
+
process.stdout.write(`${chalk216.green("\u2713")} ${summary}
|
|
35917
36006
|
`);
|
|
35918
36007
|
} else {
|
|
35919
36008
|
failed2++;
|
|
35920
|
-
process.stdout.write(` ${
|
|
36009
|
+
process.stdout.write(` ${chalk216.yellow("skip")}
|
|
35921
36010
|
`);
|
|
35922
36011
|
}
|
|
35923
36012
|
}
|
|
@@ -35938,7 +36027,7 @@ function registerSessions(program2) {
|
|
|
35938
36027
|
}
|
|
35939
36028
|
|
|
35940
36029
|
// src/commands/statusLine.ts
|
|
35941
|
-
import
|
|
36030
|
+
import chalk218 from "chalk";
|
|
35942
36031
|
|
|
35943
36032
|
// src/shared/contextLevel.ts
|
|
35944
36033
|
function contextLevel(pct) {
|
|
@@ -35948,7 +36037,7 @@ function contextLevel(pct) {
|
|
|
35948
36037
|
}
|
|
35949
36038
|
|
|
35950
36039
|
// src/commands/buildLimitsSegment.ts
|
|
35951
|
-
import
|
|
36040
|
+
import chalk217 from "chalk";
|
|
35952
36041
|
|
|
35953
36042
|
// src/shared/rateLimitLevel.ts
|
|
35954
36043
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -35986,9 +36075,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
35986
36075
|
|
|
35987
36076
|
// src/commands/buildLimitsSegment.ts
|
|
35988
36077
|
var LEVEL_COLOR = {
|
|
35989
|
-
ok:
|
|
35990
|
-
warn:
|
|
35991
|
-
over:
|
|
36078
|
+
ok: chalk217.green,
|
|
36079
|
+
warn: chalk217.yellow,
|
|
36080
|
+
over: chalk217.red
|
|
35992
36081
|
};
|
|
35993
36082
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
35994
36083
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -36084,7 +36173,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
36084
36173
|
}
|
|
36085
36174
|
|
|
36086
36175
|
// src/commands/statusLine.ts
|
|
36087
|
-
|
|
36176
|
+
chalk218.level = 3;
|
|
36088
36177
|
function formatNumber(num) {
|
|
36089
36178
|
return num.toLocaleString("en-US");
|
|
36090
36179
|
}
|
|
@@ -36092,9 +36181,9 @@ function colorizePercent(pct) {
|
|
|
36092
36181
|
const label2 = `${Math.round(pct)}%`;
|
|
36093
36182
|
switch (contextLevel(pct)) {
|
|
36094
36183
|
case "red":
|
|
36095
|
-
return
|
|
36184
|
+
return chalk218.red(label2);
|
|
36096
36185
|
case "yellow":
|
|
36097
|
-
return
|
|
36186
|
+
return chalk218.yellow(label2);
|
|
36098
36187
|
default:
|
|
36099
36188
|
return label2;
|
|
36100
36189
|
}
|
|
@@ -36107,7 +36196,7 @@ async function statusLine() {
|
|
|
36107
36196
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
36108
36197
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
36109
36198
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
36110
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
36199
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk218.cyan(branch2)} | ` : "";
|
|
36111
36200
|
console.log(
|
|
36112
36201
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
36113
36202
|
);
|
|
@@ -36177,10 +36266,10 @@ async function update2() {
|
|
|
36177
36266
|
}
|
|
36178
36267
|
|
|
36179
36268
|
// src/reportCliError.ts
|
|
36180
|
-
import
|
|
36269
|
+
import chalk219 from "chalk";
|
|
36181
36270
|
function reportCliError(error) {
|
|
36182
36271
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError) {
|
|
36183
|
-
console.error(
|
|
36272
|
+
console.error(chalk219.red(error.message));
|
|
36184
36273
|
} else {
|
|
36185
36274
|
console.error(error);
|
|
36186
36275
|
}
|