@staff0rd/assist 0.549.0 → 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 +13 -5
- package/allowed.cli-reads +1 -0
- package/claude/commands/review-pr-comments.md +14 -2
- package/dist/allowed.cli-reads +1 -0
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +551 -427
- 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
|
}
|
|
@@ -22467,10 +22556,10 @@ async function edit(options2) {
|
|
|
22467
22556
|
}
|
|
22468
22557
|
|
|
22469
22558
|
// src/commands/prs/fixed.ts
|
|
22470
|
-
import { execSync as
|
|
22559
|
+
import { execSync as execSync45 } from "child_process";
|
|
22471
22560
|
|
|
22472
22561
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
22473
|
-
import { execSync as
|
|
22562
|
+
import { execSync as execSync44 } from "child_process";
|
|
22474
22563
|
import { unlinkSync as unlinkSync14, writeFileSync as writeFileSync33 } from "fs";
|
|
22475
22564
|
import { tmpdir as tmpdir6 } from "os";
|
|
22476
22565
|
import { join as join57 } from "path";
|
|
@@ -22511,12 +22600,22 @@ function deleteCommentsCache(org, repo, prNumber) {
|
|
|
22511
22600
|
}
|
|
22512
22601
|
|
|
22513
22602
|
// src/commands/prs/replyToComment.ts
|
|
22514
|
-
import {
|
|
22603
|
+
import { spawnSync as spawnSync5 } from "child_process";
|
|
22515
22604
|
function replyToComment(org, repo, prNumber, commentId, message3) {
|
|
22516
|
-
|
|
22517
|
-
|
|
22518
|
-
|
|
22605
|
+
const result = spawnSync5(
|
|
22606
|
+
"gh",
|
|
22607
|
+
[
|
|
22608
|
+
"api",
|
|
22609
|
+
`repos/${org}/${repo}/pulls/${prNumber}/comments`,
|
|
22610
|
+
"-f",
|
|
22611
|
+
`body=${message3}`,
|
|
22612
|
+
"-F",
|
|
22613
|
+
`in_reply_to=${commentId}`
|
|
22614
|
+
],
|
|
22615
|
+
{ encoding: "utf8", windowsHide: true }
|
|
22519
22616
|
);
|
|
22617
|
+
if (result.error) throw result.error;
|
|
22618
|
+
if (result.status !== 0) throw new Error(result.stderr || result.stdout);
|
|
22520
22619
|
}
|
|
22521
22620
|
|
|
22522
22621
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
@@ -22525,7 +22624,7 @@ function resolveThread(threadId) {
|
|
|
22525
22624
|
const queryFile = join57(tmpdir6(), `gh-mutation-${Date.now()}.graphql`);
|
|
22526
22625
|
writeFileSync33(queryFile, mutation);
|
|
22527
22626
|
try {
|
|
22528
|
-
|
|
22627
|
+
execSync44(
|
|
22529
22628
|
`gh api graphql -F query=@${queryFile} -f threadId="${threadId}"`,
|
|
22530
22629
|
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
22531
22630
|
);
|
|
@@ -22577,7 +22676,7 @@ function resolveCommentWithReply(commentId, message3) {
|
|
|
22577
22676
|
// src/commands/prs/fixed.ts
|
|
22578
22677
|
function verifySha(sha) {
|
|
22579
22678
|
try {
|
|
22580
|
-
return
|
|
22679
|
+
return execSync45(`git rev-parse --verify ${sha}`, {
|
|
22581
22680
|
encoding: "utf8"
|
|
22582
22681
|
}).trim();
|
|
22583
22682
|
} catch {
|
|
@@ -22604,7 +22703,7 @@ function fixed(commentId, sha) {
|
|
|
22604
22703
|
}
|
|
22605
22704
|
|
|
22606
22705
|
// src/commands/prs/fetchThreadIds.ts
|
|
22607
|
-
import { execSync as
|
|
22706
|
+
import { execSync as execSync46 } from "child_process";
|
|
22608
22707
|
import { unlinkSync as unlinkSync15, writeFileSync as writeFileSync34 } from "fs";
|
|
22609
22708
|
import { tmpdir as tmpdir7 } from "os";
|
|
22610
22709
|
import { join as join58 } from "path";
|
|
@@ -22613,7 +22712,7 @@ function fetchThreadIds(org, repo, prNumber) {
|
|
|
22613
22712
|
const queryFile = join58(tmpdir7(), `gh-query-${Date.now()}.graphql`);
|
|
22614
22713
|
writeFileSync34(queryFile, THREAD_QUERY);
|
|
22615
22714
|
try {
|
|
22616
|
-
const result =
|
|
22715
|
+
const result = execSync46(
|
|
22617
22716
|
`gh api graphql -F query=@${queryFile} -F owner="${org}" -F repo="${repo}" -F prNumber=${prNumber}`,
|
|
22618
22717
|
{ encoding: "utf8" }
|
|
22619
22718
|
);
|
|
@@ -22635,9 +22734,9 @@ function fetchThreadIds(org, repo, prNumber) {
|
|
|
22635
22734
|
}
|
|
22636
22735
|
|
|
22637
22736
|
// src/commands/prs/listComments/fetchReviewComments.ts
|
|
22638
|
-
import { execSync as
|
|
22737
|
+
import { execSync as execSync47 } from "child_process";
|
|
22639
22738
|
function fetchJson(endpoint) {
|
|
22640
|
-
const result =
|
|
22739
|
+
const result = execSync47(`gh api --paginate ${endpoint}`, {
|
|
22641
22740
|
encoding: "utf8"
|
|
22642
22741
|
});
|
|
22643
22742
|
if (!result.trim()) return [];
|
|
@@ -22727,13 +22826,13 @@ function agentFooter(unresolvedCount) {
|
|
|
22727
22826
|
}
|
|
22728
22827
|
|
|
22729
22828
|
// src/commands/prs/listComments/commentStyle.ts
|
|
22730
|
-
import
|
|
22829
|
+
import chalk172 from "chalk";
|
|
22731
22830
|
var plain = (text17) => text17;
|
|
22732
22831
|
function colouredState(state) {
|
|
22733
22832
|
const label2 = `[${state}]`;
|
|
22734
|
-
if (state === "APPROVED") return
|
|
22735
|
-
if (state === "CHANGES_REQUESTED") return
|
|
22736
|
-
return
|
|
22833
|
+
if (state === "APPROVED") return chalk172.green(label2);
|
|
22834
|
+
if (state === "CHANGES_REQUESTED") return chalk172.red(label2);
|
|
22835
|
+
return chalk172.yellow(label2);
|
|
22737
22836
|
}
|
|
22738
22837
|
function commentStyle() {
|
|
22739
22838
|
if (isClaudeCode()) {
|
|
@@ -22747,9 +22846,9 @@ function commentStyle() {
|
|
|
22747
22846
|
};
|
|
22748
22847
|
}
|
|
22749
22848
|
return {
|
|
22750
|
-
cyan:
|
|
22751
|
-
bold:
|
|
22752
|
-
dim:
|
|
22849
|
+
cyan: chalk172.cyan,
|
|
22850
|
+
bold: chalk172.bold,
|
|
22851
|
+
dim: chalk172.dim,
|
|
22753
22852
|
state: colouredState,
|
|
22754
22853
|
diffHunk: true,
|
|
22755
22854
|
agent: false
|
|
@@ -22913,19 +23012,19 @@ async function listComments() {
|
|
|
22913
23012
|
}
|
|
22914
23013
|
|
|
22915
23014
|
// src/commands/prs/prs/index.ts
|
|
22916
|
-
import { execSync as
|
|
23015
|
+
import { execSync as execSync48 } from "child_process";
|
|
22917
23016
|
|
|
22918
23017
|
// src/commands/prs/prs/displayPaginated/index.ts
|
|
22919
23018
|
import enquirer9 from "enquirer";
|
|
22920
23019
|
|
|
22921
23020
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
22922
|
-
import
|
|
23021
|
+
import chalk173 from "chalk";
|
|
22923
23022
|
var STATUS_MAP = {
|
|
22924
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
22925
|
-
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
|
|
22926
23025
|
};
|
|
22927
23026
|
function defaultStatus(pr) {
|
|
22928
|
-
return { label:
|
|
23027
|
+
return { label: chalk173.green("opened"), date: pr.createdAt };
|
|
22929
23028
|
}
|
|
22930
23029
|
function getStatus2(pr) {
|
|
22931
23030
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -22934,11 +23033,11 @@ function formatDate(dateStr) {
|
|
|
22934
23033
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
22935
23034
|
}
|
|
22936
23035
|
function formatPrHeader(pr, status3) {
|
|
22937
|
-
return `${
|
|
23036
|
+
return `${chalk173.cyan(`#${pr.number}`)} ${pr.title} ${chalk173.dim(`(${pr.author.login},`)} ${status3.label} ${chalk173.dim(`${formatDate(status3.date)})`)}`;
|
|
22938
23037
|
}
|
|
22939
23038
|
function logPrDetails(pr) {
|
|
22940
23039
|
console.log(
|
|
22941
|
-
|
|
23040
|
+
chalk173.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
22942
23041
|
);
|
|
22943
23042
|
console.log();
|
|
22944
23043
|
}
|
|
@@ -23020,7 +23119,7 @@ async function prs(options2) {
|
|
|
23020
23119
|
const state = options2.open ? "open" : options2.closed ? "closed" : "all";
|
|
23021
23120
|
try {
|
|
23022
23121
|
const { org, repo } = getRepoInfo();
|
|
23023
|
-
const result =
|
|
23122
|
+
const result = execSync48(
|
|
23024
23123
|
`gh pr list --state ${state} --json number,title,url,author,createdAt,mergedAt,closedAt,state,changedFiles --limit 100 -R ${org}/${repo}`,
|
|
23025
23124
|
{ encoding: "utf8" }
|
|
23026
23125
|
);
|
|
@@ -23091,16 +23190,16 @@ function buildCreateArgs(title, body, options2) {
|
|
|
23091
23190
|
}
|
|
23092
23191
|
|
|
23093
23192
|
// src/commands/prs/readSessionPrRef.ts
|
|
23094
|
-
import { execSync as
|
|
23193
|
+
import { execSync as execSync49 } from "child_process";
|
|
23095
23194
|
function readSessionPrRef() {
|
|
23096
23195
|
try {
|
|
23097
|
-
const branch2 =
|
|
23196
|
+
const branch2 = execSync49("git rev-parse --abbrev-ref HEAD", {
|
|
23098
23197
|
encoding: "utf8",
|
|
23099
23198
|
stdio: ["pipe", "pipe", "pipe"]
|
|
23100
23199
|
}).trim();
|
|
23101
23200
|
if (!branch2 || branch2 === "HEAD") return null;
|
|
23102
23201
|
const pr = JSON.parse(
|
|
23103
|
-
|
|
23202
|
+
execSync49(`gh pr view ${branch2} --json number,title,url,state`, {
|
|
23104
23203
|
encoding: "utf8",
|
|
23105
23204
|
stdio: ["pipe", "pipe", "pipe"]
|
|
23106
23205
|
})
|
|
@@ -23357,7 +23456,7 @@ function reply(commentId, body) {
|
|
|
23357
23456
|
}
|
|
23358
23457
|
|
|
23359
23458
|
// src/commands/prs/wontfix.ts
|
|
23360
|
-
import { execSync as
|
|
23459
|
+
import { execSync as execSync50 } from "child_process";
|
|
23361
23460
|
function validateReason(reason4) {
|
|
23362
23461
|
const lowerReason = reason4.toLowerCase();
|
|
23363
23462
|
if (lowerReason.includes("claude") || lowerReason.includes("opus")) {
|
|
@@ -23374,7 +23473,7 @@ function validateShaReferences(reason4) {
|
|
|
23374
23473
|
const invalidShas = [];
|
|
23375
23474
|
for (const sha of shas) {
|
|
23376
23475
|
try {
|
|
23377
|
-
|
|
23476
|
+
execSync50(`git cat-file -t ${sha}`, { stdio: "pipe" });
|
|
23378
23477
|
} catch {
|
|
23379
23478
|
invalidShas.push(sha);
|
|
23380
23479
|
}
|
|
@@ -23401,6 +23500,45 @@ function wontfix(commentId, reason4) {
|
|
|
23401
23500
|
}
|
|
23402
23501
|
}
|
|
23403
23502
|
|
|
23503
|
+
// src/commands/prs/readBodyArgument.ts
|
|
23504
|
+
async function readBodyArgument(value) {
|
|
23505
|
+
if (value !== "-") return value;
|
|
23506
|
+
const body = (await readStdinBuffer()).toString("utf8").replace(/\n+$/, "");
|
|
23507
|
+
if (body.trim().length === 0) {
|
|
23508
|
+
console.error("Error: No body was provided on stdin.");
|
|
23509
|
+
process.exit(1);
|
|
23510
|
+
}
|
|
23511
|
+
return body;
|
|
23512
|
+
}
|
|
23513
|
+
|
|
23514
|
+
// src/commands/registerPrsComments.ts
|
|
23515
|
+
function registerPrsComments(prsCommand) {
|
|
23516
|
+
prsCommand.command("list-comments").description("List all comments on the current branch's pull request").action(() => {
|
|
23517
|
+
listComments().then(printComments2);
|
|
23518
|
+
});
|
|
23519
|
+
prsCommand.command("fixed <comment-id> <sha>").description("Reply with commit link and resolve thread").action((commentId, sha) => {
|
|
23520
|
+
fixed(Number.parseInt(commentId, 10), sha);
|
|
23521
|
+
});
|
|
23522
|
+
prsCommand.command("wontfix <comment-id> <reason>").description(
|
|
23523
|
+
"Reply with reason and resolve thread (reason of - reads it from stdin)"
|
|
23524
|
+
).action(async (commentId, reason4) => {
|
|
23525
|
+
wontfix(
|
|
23526
|
+
Number.parseInt(commentId, 10),
|
|
23527
|
+
await readBodyArgument(reason4)
|
|
23528
|
+
);
|
|
23529
|
+
});
|
|
23530
|
+
prsCommand.command("reply <comment-id> <body>").description(
|
|
23531
|
+
"Reply to a comment thread without resolving it (body of - reads it from stdin)"
|
|
23532
|
+
).action(async (commentId, body) => {
|
|
23533
|
+
reply(Number.parseInt(commentId, 10), await readBodyArgument(body));
|
|
23534
|
+
});
|
|
23535
|
+
prsCommand.command("comment <path> <line> <body>").description(
|
|
23536
|
+
"Add a line comment to the pending review (body of - reads it from stdin)"
|
|
23537
|
+
).action(async (path73, line, body) => {
|
|
23538
|
+
comment2(path73, Number.parseInt(line, 10), await readBodyArgument(body));
|
|
23539
|
+
});
|
|
23540
|
+
}
|
|
23541
|
+
|
|
23404
23542
|
// src/commands/prs/prConcisenessGuidance.ts
|
|
23405
23543
|
var prConcisenessGuidance = `Brevity budget \u2014 one paragraph per section, and these are ceilings, not targets:
|
|
23406
23544
|
|
|
@@ -23606,29 +23744,15 @@ function registerPrs(program2) {
|
|
|
23606
23744
|
const prsCommand = program2.command("prs").description("Pull request utilities").option("--open", "List only open pull requests").option("--closed", "List only closed pull requests").action(prs);
|
|
23607
23745
|
registerPrsRaise(prsCommand);
|
|
23608
23746
|
registerPrsEdit(prsCommand);
|
|
23609
|
-
prsCommand
|
|
23610
|
-
listComments().then(printComments2);
|
|
23611
|
-
});
|
|
23612
|
-
prsCommand.command("fixed <comment-id> <sha>").description("Reply with commit link and resolve thread").action((commentId, sha) => {
|
|
23613
|
-
fixed(Number.parseInt(commentId, 10), sha);
|
|
23614
|
-
});
|
|
23615
|
-
prsCommand.command("wontfix <comment-id> <reason>").description("Reply with reason and resolve thread").action((commentId, reason4) => {
|
|
23616
|
-
wontfix(Number.parseInt(commentId, 10), reason4);
|
|
23617
|
-
});
|
|
23618
|
-
prsCommand.command("reply <comment-id> <body>").description("Reply to a comment thread without resolving it").action((commentId, body) => {
|
|
23619
|
-
reply(Number.parseInt(commentId, 10), body);
|
|
23620
|
-
});
|
|
23621
|
-
prsCommand.command("comment <path> <line> <body>").description("Add a line comment to the pending review").action((path73, line, body) => {
|
|
23622
|
-
comment2(path73, Number.parseInt(line, 10), body);
|
|
23623
|
-
});
|
|
23747
|
+
registerPrsComments(prsCommand);
|
|
23624
23748
|
configHelp(prsCommand, prsConfigHelp);
|
|
23625
23749
|
}
|
|
23626
23750
|
|
|
23627
23751
|
// src/commands/ravendb/ravendbAuth.ts
|
|
23628
|
-
import
|
|
23752
|
+
import chalk179 from "chalk";
|
|
23629
23753
|
|
|
23630
23754
|
// src/shared/createConnectionAuth.ts
|
|
23631
|
-
import
|
|
23755
|
+
import chalk174 from "chalk";
|
|
23632
23756
|
function listConnections(connections, format) {
|
|
23633
23757
|
if (connections.length === 0) {
|
|
23634
23758
|
console.log("No connections configured.");
|
|
@@ -23641,7 +23765,7 @@ function listConnections(connections, format) {
|
|
|
23641
23765
|
function removeConnection(connections, name, save) {
|
|
23642
23766
|
const filtered = connections.filter((c) => c.name !== name);
|
|
23643
23767
|
if (filtered.length === connections.length) {
|
|
23644
|
-
console.error(
|
|
23768
|
+
console.error(chalk174.red(`Connection "${name}" not found.`));
|
|
23645
23769
|
process.exit(1);
|
|
23646
23770
|
}
|
|
23647
23771
|
save(filtered);
|
|
@@ -23687,17 +23811,17 @@ function saveConnections(connections) {
|
|
|
23687
23811
|
}
|
|
23688
23812
|
|
|
23689
23813
|
// src/commands/ravendb/promptConnection.ts
|
|
23690
|
-
import
|
|
23814
|
+
import chalk177 from "chalk";
|
|
23691
23815
|
|
|
23692
23816
|
// src/commands/ravendb/selectOpSecret.ts
|
|
23693
|
-
import
|
|
23817
|
+
import chalk176 from "chalk";
|
|
23694
23818
|
import Enquirer2 from "enquirer";
|
|
23695
23819
|
|
|
23696
23820
|
// src/commands/ravendb/searchItems.ts
|
|
23697
|
-
import { execSync as
|
|
23698
|
-
import
|
|
23821
|
+
import { execSync as execSync51 } from "child_process";
|
|
23822
|
+
import chalk175 from "chalk";
|
|
23699
23823
|
function opExec(args) {
|
|
23700
|
-
return
|
|
23824
|
+
return execSync51(`op ${args}`, {
|
|
23701
23825
|
encoding: "utf8",
|
|
23702
23826
|
stdio: ["pipe", "pipe", "pipe"]
|
|
23703
23827
|
}).trim();
|
|
@@ -23708,7 +23832,7 @@ function searchItems(search2) {
|
|
|
23708
23832
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
23709
23833
|
} catch {
|
|
23710
23834
|
console.error(
|
|
23711
|
-
|
|
23835
|
+
chalk175.red(
|
|
23712
23836
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
23713
23837
|
)
|
|
23714
23838
|
);
|
|
@@ -23722,7 +23846,7 @@ function getItemFields(itemId2) {
|
|
|
23722
23846
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
23723
23847
|
return item.fields.filter((f) => f.reference && f.label);
|
|
23724
23848
|
} catch {
|
|
23725
|
-
console.error(
|
|
23849
|
+
console.error(chalk175.red("Failed to get item details from 1Password."));
|
|
23726
23850
|
process.exit(1);
|
|
23727
23851
|
}
|
|
23728
23852
|
}
|
|
@@ -23741,7 +23865,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
23741
23865
|
}).run();
|
|
23742
23866
|
const items2 = searchItems(search2);
|
|
23743
23867
|
if (items2.length === 0) {
|
|
23744
|
-
console.error(
|
|
23868
|
+
console.error(chalk176.red(`No items found matching "${search2}".`));
|
|
23745
23869
|
process.exit(1);
|
|
23746
23870
|
}
|
|
23747
23871
|
const itemId2 = await selectOne(
|
|
@@ -23750,7 +23874,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
23750
23874
|
);
|
|
23751
23875
|
const fields = getItemFields(itemId2);
|
|
23752
23876
|
if (fields.length === 0) {
|
|
23753
|
-
console.error(
|
|
23877
|
+
console.error(chalk176.red("No fields with references found on this item."));
|
|
23754
23878
|
process.exit(1);
|
|
23755
23879
|
}
|
|
23756
23880
|
const ref = await selectOne(
|
|
@@ -23764,7 +23888,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
23764
23888
|
async function promptConnection(existingNames) {
|
|
23765
23889
|
const name = await promptInput("name", "Connection name:");
|
|
23766
23890
|
if (existingNames.includes(name)) {
|
|
23767
|
-
console.error(
|
|
23891
|
+
console.error(chalk177.red(`Connection "${name}" already exists.`));
|
|
23768
23892
|
process.exit(1);
|
|
23769
23893
|
}
|
|
23770
23894
|
const url = await promptInput(
|
|
@@ -23773,22 +23897,22 @@ async function promptConnection(existingNames) {
|
|
|
23773
23897
|
);
|
|
23774
23898
|
const database = await promptInput("database", "Database name:");
|
|
23775
23899
|
if (!name || !url || !database) {
|
|
23776
|
-
console.error(
|
|
23900
|
+
console.error(chalk177.red("All fields are required."));
|
|
23777
23901
|
process.exit(1);
|
|
23778
23902
|
}
|
|
23779
23903
|
const apiKeyRef = await selectOpSecret();
|
|
23780
|
-
console.log(
|
|
23904
|
+
console.log(chalk177.dim(`Using: ${apiKeyRef}`));
|
|
23781
23905
|
return { name, url, database, apiKeyRef };
|
|
23782
23906
|
}
|
|
23783
23907
|
|
|
23784
23908
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
23785
|
-
import
|
|
23909
|
+
import chalk178 from "chalk";
|
|
23786
23910
|
function ravendbSetConnection(name) {
|
|
23787
23911
|
const raw = loadGlobalConfigRaw();
|
|
23788
23912
|
const ravendb = raw.ravendb ?? {};
|
|
23789
23913
|
const connections = ravendb.connections ?? [];
|
|
23790
23914
|
if (!connections.some((c) => c.name === name)) {
|
|
23791
|
-
console.error(
|
|
23915
|
+
console.error(chalk178.red(`Connection "${name}" not found.`));
|
|
23792
23916
|
console.error(
|
|
23793
23917
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
23794
23918
|
);
|
|
@@ -23804,16 +23928,16 @@ function ravendbSetConnection(name) {
|
|
|
23804
23928
|
var ravendbAuth = createConnectionAuth({
|
|
23805
23929
|
load: loadConnections,
|
|
23806
23930
|
save: saveConnections,
|
|
23807
|
-
format: (c) => `${
|
|
23931
|
+
format: (c) => `${chalk179.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
23808
23932
|
promptNew: promptConnection,
|
|
23809
23933
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
23810
23934
|
});
|
|
23811
23935
|
|
|
23812
23936
|
// src/commands/ravendb/ravendbCollections.ts
|
|
23813
|
-
import
|
|
23937
|
+
import chalk183 from "chalk";
|
|
23814
23938
|
|
|
23815
23939
|
// src/commands/ravendb/ravenFetch.ts
|
|
23816
|
-
import
|
|
23940
|
+
import chalk181 from "chalk";
|
|
23817
23941
|
|
|
23818
23942
|
// src/commands/ravendb/getAccessToken.ts
|
|
23819
23943
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -23849,21 +23973,21 @@ ${errorText}`
|
|
|
23849
23973
|
}
|
|
23850
23974
|
|
|
23851
23975
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
23852
|
-
import { execSync as
|
|
23853
|
-
import
|
|
23976
|
+
import { execSync as execSync52 } from "child_process";
|
|
23977
|
+
import chalk180 from "chalk";
|
|
23854
23978
|
function resolveOpSecret(reference) {
|
|
23855
23979
|
if (!reference.startsWith("op://")) {
|
|
23856
|
-
console.error(
|
|
23980
|
+
console.error(chalk180.red(`Invalid secret reference: must start with op://`));
|
|
23857
23981
|
process.exit(1);
|
|
23858
23982
|
}
|
|
23859
23983
|
try {
|
|
23860
|
-
return
|
|
23984
|
+
return execSync52(`op read "${reference}"`, {
|
|
23861
23985
|
encoding: "utf8",
|
|
23862
23986
|
stdio: ["pipe", "pipe", "pipe"]
|
|
23863
23987
|
}).trim();
|
|
23864
23988
|
} catch {
|
|
23865
23989
|
console.error(
|
|
23866
|
-
|
|
23990
|
+
chalk180.red(
|
|
23867
23991
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
23868
23992
|
)
|
|
23869
23993
|
);
|
|
@@ -23890,7 +24014,7 @@ async function ravenFetch(connection, path73) {
|
|
|
23890
24014
|
if (!response.ok) {
|
|
23891
24015
|
const body = await response.text();
|
|
23892
24016
|
console.error(
|
|
23893
|
-
|
|
24017
|
+
chalk181.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
23894
24018
|
);
|
|
23895
24019
|
console.error(body.substring(0, 500));
|
|
23896
24020
|
process.exit(1);
|
|
@@ -23899,7 +24023,7 @@ async function ravenFetch(connection, path73) {
|
|
|
23899
24023
|
}
|
|
23900
24024
|
|
|
23901
24025
|
// src/commands/ravendb/resolveConnection.ts
|
|
23902
|
-
import
|
|
24026
|
+
import chalk182 from "chalk";
|
|
23903
24027
|
function loadRavendb() {
|
|
23904
24028
|
const raw = loadGlobalConfigRaw();
|
|
23905
24029
|
const ravendb = raw.ravendb;
|
|
@@ -23913,7 +24037,7 @@ function resolveConnection(name) {
|
|
|
23913
24037
|
const connectionName = name ?? defaultConnection;
|
|
23914
24038
|
if (!connectionName) {
|
|
23915
24039
|
console.error(
|
|
23916
|
-
|
|
24040
|
+
chalk182.red(
|
|
23917
24041
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
23918
24042
|
)
|
|
23919
24043
|
);
|
|
@@ -23921,7 +24045,7 @@ function resolveConnection(name) {
|
|
|
23921
24045
|
}
|
|
23922
24046
|
const connection = connections.find((c) => c.name === connectionName);
|
|
23923
24047
|
if (!connection) {
|
|
23924
|
-
console.error(
|
|
24048
|
+
console.error(chalk182.red(`Connection "${connectionName}" not found.`));
|
|
23925
24049
|
console.error(
|
|
23926
24050
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
23927
24051
|
);
|
|
@@ -23952,15 +24076,15 @@ async function ravendbCollections(connectionName) {
|
|
|
23952
24076
|
return;
|
|
23953
24077
|
}
|
|
23954
24078
|
for (const c of collections) {
|
|
23955
|
-
console.log(`${
|
|
24079
|
+
console.log(`${chalk183.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
23956
24080
|
}
|
|
23957
24081
|
}
|
|
23958
24082
|
|
|
23959
24083
|
// src/commands/ravendb/ravendbQuery.ts
|
|
23960
|
-
import
|
|
24084
|
+
import chalk185 from "chalk";
|
|
23961
24085
|
|
|
23962
24086
|
// src/commands/ravendb/fetchAllPages.ts
|
|
23963
|
-
import
|
|
24087
|
+
import chalk184 from "chalk";
|
|
23964
24088
|
|
|
23965
24089
|
// src/commands/ravendb/buildQueryPath.ts
|
|
23966
24090
|
function buildQueryPath(opts) {
|
|
@@ -23998,7 +24122,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
23998
24122
|
allResults.push(...results);
|
|
23999
24123
|
start3 += results.length;
|
|
24000
24124
|
process.stderr.write(
|
|
24001
|
-
`\r${
|
|
24125
|
+
`\r${chalk184.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
24002
24126
|
);
|
|
24003
24127
|
if (start3 >= totalResults) break;
|
|
24004
24128
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -24013,7 +24137,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
24013
24137
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
24014
24138
|
const resolved = resolveArgs(connectionName, collection);
|
|
24015
24139
|
if (!resolved.collection && !options2.query) {
|
|
24016
|
-
console.error(
|
|
24140
|
+
console.error(chalk185.red("Provide a collection name or --query filter."));
|
|
24017
24141
|
process.exit(1);
|
|
24018
24142
|
}
|
|
24019
24143
|
const { collection: col } = resolved;
|
|
@@ -24052,7 +24176,7 @@ import { spawn as spawn6 } from "child_process";
|
|
|
24052
24176
|
import * as path36 from "path";
|
|
24053
24177
|
|
|
24054
24178
|
// src/commands/refactor/logViolations.ts
|
|
24055
|
-
import
|
|
24179
|
+
import chalk186 from "chalk";
|
|
24056
24180
|
var DEFAULT_MAX_LINES = 100;
|
|
24057
24181
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
24058
24182
|
if (violations.length === 0) {
|
|
@@ -24061,43 +24185,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
24061
24185
|
}
|
|
24062
24186
|
return;
|
|
24063
24187
|
}
|
|
24064
|
-
console.error(
|
|
24188
|
+
console.error(chalk186.red(`
|
|
24065
24189
|
Refactor check failed:
|
|
24066
24190
|
`));
|
|
24067
|
-
console.error(
|
|
24191
|
+
console.error(chalk186.red(` The following files exceed ${maxLines} lines:
|
|
24068
24192
|
`));
|
|
24069
24193
|
for (const violation of violations) {
|
|
24070
|
-
console.error(
|
|
24194
|
+
console.error(chalk186.red(` ${violation.file} (${violation.lines} lines)`));
|
|
24071
24195
|
}
|
|
24072
24196
|
console.error(
|
|
24073
|
-
|
|
24197
|
+
chalk186.yellow(
|
|
24074
24198
|
`
|
|
24075
24199
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
24076
24200
|
way to refactor it, ignore it with:
|
|
24077
24201
|
`
|
|
24078
24202
|
)
|
|
24079
24203
|
);
|
|
24080
|
-
console.error(
|
|
24204
|
+
console.error(chalk186.gray(` assist refactor ignore <file>
|
|
24081
24205
|
`));
|
|
24082
24206
|
if (process.env.CLAUDECODE) {
|
|
24083
|
-
console.error(
|
|
24207
|
+
console.error(chalk186.cyan(`
|
|
24084
24208
|
## Extracting Code to New Files
|
|
24085
24209
|
`));
|
|
24086
24210
|
console.error(
|
|
24087
|
-
|
|
24211
|
+
chalk186.cyan(
|
|
24088
24212
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
24089
24213
|
`
|
|
24090
24214
|
)
|
|
24091
24215
|
);
|
|
24092
24216
|
console.error(
|
|
24093
|
-
|
|
24217
|
+
chalk186.cyan(
|
|
24094
24218
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
24095
24219
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
24096
24220
|
`
|
|
24097
24221
|
)
|
|
24098
24222
|
);
|
|
24099
24223
|
console.error(
|
|
24100
|
-
|
|
24224
|
+
chalk186.cyan(
|
|
24101
24225
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
24102
24226
|
domains, move it to a common/shared folder.
|
|
24103
24227
|
`
|
|
@@ -24107,7 +24231,7 @@ Refactor check failed:
|
|
|
24107
24231
|
}
|
|
24108
24232
|
|
|
24109
24233
|
// src/commands/refactor/check/getViolations/index.ts
|
|
24110
|
-
import { execSync as
|
|
24234
|
+
import { execSync as execSync53 } from "child_process";
|
|
24111
24235
|
import fs25 from "fs";
|
|
24112
24236
|
import { minimatch as minimatch6 } from "minimatch";
|
|
24113
24237
|
|
|
@@ -24157,7 +24281,7 @@ function getGitFiles(options2) {
|
|
|
24157
24281
|
}
|
|
24158
24282
|
const files = /* @__PURE__ */ new Set();
|
|
24159
24283
|
if (options2.staged || options2.modified) {
|
|
24160
|
-
const staged =
|
|
24284
|
+
const staged = execSync53("git diff --cached --name-only", {
|
|
24161
24285
|
encoding: "utf8"
|
|
24162
24286
|
});
|
|
24163
24287
|
for (const file of staged.trim().split("\n").filter(Boolean)) {
|
|
@@ -24165,7 +24289,7 @@ function getGitFiles(options2) {
|
|
|
24165
24289
|
}
|
|
24166
24290
|
}
|
|
24167
24291
|
if (options2.unstaged || options2.modified) {
|
|
24168
|
-
const unstaged =
|
|
24292
|
+
const unstaged = execSync53("git diff --name-only", { encoding: "utf8" });
|
|
24169
24293
|
for (const file of unstaged.trim().split("\n").filter(Boolean)) {
|
|
24170
24294
|
files.add(file);
|
|
24171
24295
|
}
|
|
@@ -24253,7 +24377,7 @@ async function check(pattern2, options2) {
|
|
|
24253
24377
|
|
|
24254
24378
|
// src/commands/refactor/extract/index.ts
|
|
24255
24379
|
import path44 from "path";
|
|
24256
|
-
import
|
|
24380
|
+
import chalk189 from "chalk";
|
|
24257
24381
|
|
|
24258
24382
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
24259
24383
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -24852,23 +24976,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
24852
24976
|
|
|
24853
24977
|
// src/commands/refactor/extract/displayPlan.ts
|
|
24854
24978
|
import path40 from "path";
|
|
24855
|
-
import
|
|
24979
|
+
import chalk187 from "chalk";
|
|
24856
24980
|
function section2(title) {
|
|
24857
24981
|
return `
|
|
24858
|
-
${
|
|
24982
|
+
${chalk187.cyan(title)}`;
|
|
24859
24983
|
}
|
|
24860
24984
|
function displayImporters(plan2, cwd) {
|
|
24861
24985
|
if (plan2.importersToUpdate.length === 0) return;
|
|
24862
24986
|
console.log(section2("Update importers:"));
|
|
24863
24987
|
for (const imp of plan2.importersToUpdate) {
|
|
24864
24988
|
const rel = path40.relative(cwd, imp.file.getFilePath());
|
|
24865
|
-
console.log(` ${
|
|
24989
|
+
console.log(` ${chalk187.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
24866
24990
|
}
|
|
24867
24991
|
}
|
|
24868
24992
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
24869
|
-
console.log(
|
|
24993
|
+
console.log(chalk187.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
24870
24994
|
`));
|
|
24871
|
-
console.log(` ${
|
|
24995
|
+
console.log(` ${chalk187.cyan("Functions to move:")}`);
|
|
24872
24996
|
for (const name of plan2.extractedNames) {
|
|
24873
24997
|
console.log(` ${name}`);
|
|
24874
24998
|
}
|
|
@@ -24902,7 +25026,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
24902
25026
|
|
|
24903
25027
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
24904
25028
|
import path43 from "path";
|
|
24905
|
-
import
|
|
25029
|
+
import chalk188 from "chalk";
|
|
24906
25030
|
import { Project as Project4 } from "ts-morph";
|
|
24907
25031
|
|
|
24908
25032
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -24994,7 +25118,7 @@ function loadProjectFile(file) {
|
|
|
24994
25118
|
});
|
|
24995
25119
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
24996
25120
|
if (!sourceFile) {
|
|
24997
|
-
console.log(
|
|
25121
|
+
console.log(chalk188.red(`File not found in project: ${file}`));
|
|
24998
25122
|
process.exit(1);
|
|
24999
25123
|
}
|
|
25000
25124
|
return { project, sourceFile };
|
|
@@ -25017,19 +25141,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
25017
25141
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
25018
25142
|
if (options2.apply) {
|
|
25019
25143
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
25020
|
-
console.log(
|
|
25144
|
+
console.log(chalk189.green("\nExtraction complete"));
|
|
25021
25145
|
} else {
|
|
25022
|
-
console.log(
|
|
25146
|
+
console.log(chalk189.dim("\nDry run. Use --apply to execute."));
|
|
25023
25147
|
}
|
|
25024
25148
|
}
|
|
25025
25149
|
|
|
25026
25150
|
// src/commands/refactor/ignore.ts
|
|
25027
25151
|
import fs28 from "fs";
|
|
25028
|
-
import
|
|
25152
|
+
import chalk190 from "chalk";
|
|
25029
25153
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
25030
25154
|
function ignore2(file) {
|
|
25031
25155
|
if (!fs28.existsSync(file)) {
|
|
25032
|
-
console.error(
|
|
25156
|
+
console.error(chalk190.red(`Error: File does not exist: ${file}`));
|
|
25033
25157
|
process.exit(1);
|
|
25034
25158
|
}
|
|
25035
25159
|
const content = fs28.readFileSync(file, "utf8");
|
|
@@ -25045,7 +25169,7 @@ function ignore2(file) {
|
|
|
25045
25169
|
fs28.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
25046
25170
|
}
|
|
25047
25171
|
console.log(
|
|
25048
|
-
|
|
25172
|
+
chalk190.green(
|
|
25049
25173
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
25050
25174
|
)
|
|
25051
25175
|
);
|
|
@@ -25054,12 +25178,12 @@ function ignore2(file) {
|
|
|
25054
25178
|
// src/commands/refactor/rename/index.ts
|
|
25055
25179
|
import fs31 from "fs";
|
|
25056
25180
|
import path49 from "path";
|
|
25057
|
-
import
|
|
25181
|
+
import chalk193 from "chalk";
|
|
25058
25182
|
|
|
25059
25183
|
// src/commands/refactor/rename/applyRename.ts
|
|
25060
25184
|
import fs30 from "fs";
|
|
25061
25185
|
import path46 from "path";
|
|
25062
|
-
import
|
|
25186
|
+
import chalk191 from "chalk";
|
|
25063
25187
|
|
|
25064
25188
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
25065
25189
|
import path45 from "path";
|
|
@@ -25164,13 +25288,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
25164
25288
|
const updatedContents = applyRewrites(rewrites);
|
|
25165
25289
|
for (const [file, content] of updatedContents) {
|
|
25166
25290
|
fs30.writeFileSync(file, content, "utf8");
|
|
25167
|
-
console.log(
|
|
25291
|
+
console.log(chalk191.cyan(` Updated imports in ${path46.relative(cwd, file)}`));
|
|
25168
25292
|
}
|
|
25169
25293
|
const destDir = path46.dirname(destPath);
|
|
25170
25294
|
if (!fs30.existsSync(destDir)) fs30.mkdirSync(destDir, { recursive: true });
|
|
25171
25295
|
fs30.renameSync(sourcePath, destPath);
|
|
25172
25296
|
console.log(
|
|
25173
|
-
|
|
25297
|
+
chalk191.white(
|
|
25174
25298
|
` Moved ${path46.relative(cwd, sourcePath)} \u2192 ${path46.relative(cwd, destPath)}`
|
|
25175
25299
|
)
|
|
25176
25300
|
);
|
|
@@ -25257,16 +25381,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
25257
25381
|
|
|
25258
25382
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
25259
25383
|
import path48 from "path";
|
|
25260
|
-
import
|
|
25384
|
+
import chalk192 from "chalk";
|
|
25261
25385
|
function printRenamePreview(rewrites, cwd) {
|
|
25262
25386
|
for (const rewrite of rewrites) {
|
|
25263
25387
|
console.log(
|
|
25264
|
-
|
|
25388
|
+
chalk192.dim(
|
|
25265
25389
|
` ${path48.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
25266
25390
|
)
|
|
25267
25391
|
);
|
|
25268
25392
|
}
|
|
25269
|
-
console.log(
|
|
25393
|
+
console.log(chalk192.dim("Dry run. Use --apply to execute."));
|
|
25270
25394
|
}
|
|
25271
25395
|
|
|
25272
25396
|
// src/commands/refactor/rename/index.ts
|
|
@@ -25277,20 +25401,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
25277
25401
|
const relSource = path49.relative(cwd, sourcePath);
|
|
25278
25402
|
const relDest = path49.relative(cwd, destPath);
|
|
25279
25403
|
if (!fs31.existsSync(sourcePath)) {
|
|
25280
|
-
console.log(
|
|
25404
|
+
console.log(chalk193.red(`File not found: ${source}`));
|
|
25281
25405
|
process.exit(1);
|
|
25282
25406
|
}
|
|
25283
25407
|
if (destPath !== sourcePath && fs31.existsSync(destPath)) {
|
|
25284
|
-
console.log(
|
|
25408
|
+
console.log(chalk193.red(`Destination already exists: ${destination}`));
|
|
25285
25409
|
process.exit(1);
|
|
25286
25410
|
}
|
|
25287
|
-
console.log(
|
|
25288
|
-
console.log(
|
|
25289
|
-
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..."));
|
|
25290
25414
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
25291
25415
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
25292
25416
|
console.log(
|
|
25293
|
-
|
|
25417
|
+
chalk193.dim(
|
|
25294
25418
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
25295
25419
|
)
|
|
25296
25420
|
);
|
|
@@ -25299,11 +25423,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
25299
25423
|
return;
|
|
25300
25424
|
}
|
|
25301
25425
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
25302
|
-
console.log(
|
|
25426
|
+
console.log(chalk193.green("Done"));
|
|
25303
25427
|
}
|
|
25304
25428
|
|
|
25305
25429
|
// src/commands/refactor/renameSymbol/index.ts
|
|
25306
|
-
import
|
|
25430
|
+
import chalk194 from "chalk";
|
|
25307
25431
|
|
|
25308
25432
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
25309
25433
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -25349,33 +25473,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
25349
25473
|
const { project, sourceFile } = loadProjectFile(file);
|
|
25350
25474
|
const symbol = findSymbol(sourceFile, oldName);
|
|
25351
25475
|
if (!symbol) {
|
|
25352
|
-
console.log(
|
|
25476
|
+
console.log(chalk194.red(`Symbol "${oldName}" not found in ${file}`));
|
|
25353
25477
|
process.exit(1);
|
|
25354
25478
|
}
|
|
25355
25479
|
const grouped = groupReferences(symbol, cwd);
|
|
25356
25480
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
25357
25481
|
console.log(
|
|
25358
|
-
|
|
25482
|
+
chalk194.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
25359
25483
|
`)
|
|
25360
25484
|
);
|
|
25361
25485
|
for (const [refFile, lines2] of grouped) {
|
|
25362
25486
|
console.log(
|
|
25363
|
-
` ${
|
|
25487
|
+
` ${chalk194.dim(refFile)}: lines ${chalk194.cyan(lines2.join(", "))}`
|
|
25364
25488
|
);
|
|
25365
25489
|
}
|
|
25366
25490
|
if (options2.apply) {
|
|
25367
25491
|
symbol.rename(newName);
|
|
25368
25492
|
await project.save();
|
|
25369
|
-
console.log(
|
|
25493
|
+
console.log(chalk194.green(`
|
|
25370
25494
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
25371
25495
|
} else {
|
|
25372
|
-
console.log(
|
|
25496
|
+
console.log(chalk194.dim("\nDry run. Use --apply to execute."));
|
|
25373
25497
|
}
|
|
25374
25498
|
}
|
|
25375
25499
|
|
|
25376
25500
|
// src/commands/refactor/restructure/index.ts
|
|
25377
25501
|
import path57 from "path";
|
|
25378
|
-
import
|
|
25502
|
+
import chalk197 from "chalk";
|
|
25379
25503
|
|
|
25380
25504
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
25381
25505
|
import path51 from "path";
|
|
@@ -25454,50 +25578,50 @@ function clusterFiles(graph) {
|
|
|
25454
25578
|
|
|
25455
25579
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
25456
25580
|
import path53 from "path";
|
|
25457
|
-
import
|
|
25581
|
+
import chalk195 from "chalk";
|
|
25458
25582
|
function relPath(filePath) {
|
|
25459
25583
|
return path53.relative(process.cwd(), filePath);
|
|
25460
25584
|
}
|
|
25461
25585
|
function displayMoves(plan2) {
|
|
25462
25586
|
if (plan2.moves.length === 0) return;
|
|
25463
|
-
console.log(
|
|
25587
|
+
console.log(chalk195.bold("\nFile moves:"));
|
|
25464
25588
|
for (const move2 of plan2.moves) {
|
|
25465
25589
|
console.log(
|
|
25466
|
-
` ${
|
|
25590
|
+
` ${chalk195.red(relPath(move2.from))} \u2192 ${chalk195.green(relPath(move2.to))}`
|
|
25467
25591
|
);
|
|
25468
|
-
console.log(
|
|
25592
|
+
console.log(chalk195.dim(` ${move2.reason}`));
|
|
25469
25593
|
}
|
|
25470
25594
|
}
|
|
25471
25595
|
function displayRewrites(rewrites) {
|
|
25472
25596
|
if (rewrites.length === 0) return;
|
|
25473
25597
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
25474
|
-
console.log(
|
|
25598
|
+
console.log(chalk195.bold(`
|
|
25475
25599
|
Import rewrites (${affectedFiles.size} files):`));
|
|
25476
25600
|
for (const file of affectedFiles) {
|
|
25477
|
-
console.log(` ${
|
|
25601
|
+
console.log(` ${chalk195.cyan(relPath(file))}:`);
|
|
25478
25602
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
25479
25603
|
(r) => r.file === file
|
|
25480
25604
|
)) {
|
|
25481
25605
|
console.log(
|
|
25482
|
-
` ${
|
|
25606
|
+
` ${chalk195.red(`"${oldSpecifier}"`)} \u2192 ${chalk195.green(`"${newSpecifier}"`)}`
|
|
25483
25607
|
);
|
|
25484
25608
|
}
|
|
25485
25609
|
}
|
|
25486
25610
|
}
|
|
25487
25611
|
function displayPlan2(plan2) {
|
|
25488
25612
|
if (plan2.warnings.length > 0) {
|
|
25489
|
-
console.log(
|
|
25490
|
-
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}`));
|
|
25491
25615
|
}
|
|
25492
25616
|
if (plan2.newDirectories.length > 0) {
|
|
25493
|
-
console.log(
|
|
25617
|
+
console.log(chalk195.bold("\nNew directories:"));
|
|
25494
25618
|
for (const dir of plan2.newDirectories)
|
|
25495
|
-
console.log(
|
|
25619
|
+
console.log(chalk195.green(` ${dir}/`));
|
|
25496
25620
|
}
|
|
25497
25621
|
displayMoves(plan2);
|
|
25498
25622
|
displayRewrites(plan2.rewrites);
|
|
25499
25623
|
console.log(
|
|
25500
|
-
|
|
25624
|
+
chalk195.dim(
|
|
25501
25625
|
`
|
|
25502
25626
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
25503
25627
|
)
|
|
@@ -25507,18 +25631,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
25507
25631
|
// src/commands/refactor/restructure/executePlan.ts
|
|
25508
25632
|
import fs32 from "fs";
|
|
25509
25633
|
import path54 from "path";
|
|
25510
|
-
import
|
|
25634
|
+
import chalk196 from "chalk";
|
|
25511
25635
|
function executePlan(plan2) {
|
|
25512
25636
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
25513
25637
|
for (const [file, content] of updatedContents) {
|
|
25514
25638
|
fs32.writeFileSync(file, content, "utf8");
|
|
25515
25639
|
console.log(
|
|
25516
|
-
|
|
25640
|
+
chalk196.cyan(` Rewrote imports in ${path54.relative(process.cwd(), file)}`)
|
|
25517
25641
|
);
|
|
25518
25642
|
}
|
|
25519
25643
|
for (const dir of plan2.newDirectories) {
|
|
25520
25644
|
fs32.mkdirSync(dir, { recursive: true });
|
|
25521
|
-
console.log(
|
|
25645
|
+
console.log(chalk196.green(` Created ${path54.relative(process.cwd(), dir)}/`));
|
|
25522
25646
|
}
|
|
25523
25647
|
for (const move2 of plan2.moves) {
|
|
25524
25648
|
const targetDir = path54.dirname(move2.to);
|
|
@@ -25527,7 +25651,7 @@ function executePlan(plan2) {
|
|
|
25527
25651
|
}
|
|
25528
25652
|
fs32.renameSync(move2.from, move2.to);
|
|
25529
25653
|
console.log(
|
|
25530
|
-
|
|
25654
|
+
chalk196.white(
|
|
25531
25655
|
` Moved ${path54.relative(process.cwd(), move2.from)} \u2192 ${path54.relative(process.cwd(), move2.to)}`
|
|
25532
25656
|
)
|
|
25533
25657
|
);
|
|
@@ -25542,7 +25666,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
25542
25666
|
if (entries.length === 0) {
|
|
25543
25667
|
fs32.rmdirSync(dir);
|
|
25544
25668
|
console.log(
|
|
25545
|
-
|
|
25669
|
+
chalk196.dim(
|
|
25546
25670
|
` Removed empty directory ${path54.relative(process.cwd(), dir)}`
|
|
25547
25671
|
)
|
|
25548
25672
|
);
|
|
@@ -25675,22 +25799,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
25675
25799
|
const targetPattern = pattern2 ?? "src";
|
|
25676
25800
|
const files = findSourceFiles2(targetPattern);
|
|
25677
25801
|
if (files.length === 0) {
|
|
25678
|
-
console.log(
|
|
25802
|
+
console.log(chalk197.yellow("No files found matching pattern"));
|
|
25679
25803
|
return;
|
|
25680
25804
|
}
|
|
25681
25805
|
const tsConfigPath = findTsConfig(path57.resolve(files[0]));
|
|
25682
25806
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
25683
25807
|
if (plan2.moves.length === 0) {
|
|
25684
|
-
console.log(
|
|
25808
|
+
console.log(chalk197.green("No restructuring needed"));
|
|
25685
25809
|
return;
|
|
25686
25810
|
}
|
|
25687
25811
|
displayPlan2(plan2);
|
|
25688
25812
|
if (options2.apply) {
|
|
25689
|
-
console.log(
|
|
25813
|
+
console.log(chalk197.bold("\nApplying changes..."));
|
|
25690
25814
|
executePlan(plan2);
|
|
25691
|
-
console.log(
|
|
25815
|
+
console.log(chalk197.green("\nRestructuring complete"));
|
|
25692
25816
|
} else {
|
|
25693
|
-
console.log(
|
|
25817
|
+
console.log(chalk197.dim("\nDry run. Use --apply to execute."));
|
|
25694
25818
|
}
|
|
25695
25819
|
}
|
|
25696
25820
|
|
|
@@ -25863,9 +25987,9 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
25863
25987
|
}
|
|
25864
25988
|
|
|
25865
25989
|
// src/commands/review/fetchExistingComments.ts
|
|
25866
|
-
import { execSync as
|
|
25990
|
+
import { execSync as execSync54 } from "child_process";
|
|
25867
25991
|
function fetchRawComments(org, repo, prNumber) {
|
|
25868
|
-
const out =
|
|
25992
|
+
const out = execSync54(
|
|
25869
25993
|
`gh api --paginate repos/${org}/${repo}/pulls/${prNumber}/comments`,
|
|
25870
25994
|
{ encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
|
|
25871
25995
|
);
|
|
@@ -25896,14 +26020,14 @@ function fetchExistingComments() {
|
|
|
25896
26020
|
}
|
|
25897
26021
|
|
|
25898
26022
|
// src/commands/review/gatherContext.ts
|
|
25899
|
-
import { execSync as
|
|
26023
|
+
import { execSync as execSync57 } from "child_process";
|
|
25900
26024
|
|
|
25901
26025
|
// src/commands/review/fetchPrDiff.ts
|
|
25902
|
-
import { execSync as
|
|
26026
|
+
import { execSync as execSync55 } from "child_process";
|
|
25903
26027
|
function fetchPrDiff(prNumber, baseSha, headSha) {
|
|
25904
26028
|
const { org, repo } = getRepoInfo();
|
|
25905
26029
|
try {
|
|
25906
|
-
return
|
|
26030
|
+
return execSync55(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
|
|
25907
26031
|
encoding: "utf8",
|
|
25908
26032
|
maxBuffer: 256 * 1024 * 1024,
|
|
25909
26033
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -25918,19 +26042,19 @@ function isDiffTooLarge(error) {
|
|
|
25918
26042
|
}
|
|
25919
26043
|
function fetchDiffViaGit(baseSha, headSha) {
|
|
25920
26044
|
try {
|
|
25921
|
-
|
|
26045
|
+
execSync55(`git fetch origin ${baseSha} ${headSha}`, { stdio: "ignore" });
|
|
25922
26046
|
} catch {
|
|
25923
26047
|
}
|
|
25924
|
-
return
|
|
26048
|
+
return execSync55(`git diff ${baseSha}...${headSha}`, {
|
|
25925
26049
|
encoding: "utf8",
|
|
25926
26050
|
maxBuffer: 256 * 1024 * 1024
|
|
25927
26051
|
});
|
|
25928
26052
|
}
|
|
25929
26053
|
|
|
25930
26054
|
// src/commands/review/fetchPrDiffInfo.ts
|
|
25931
|
-
import { execSync as
|
|
26055
|
+
import { execSync as execSync56 } from "child_process";
|
|
25932
26056
|
function getCurrentBranch3() {
|
|
25933
|
-
return
|
|
26057
|
+
return execSync56("git rev-parse --abbrev-ref HEAD", {
|
|
25934
26058
|
encoding: "utf8"
|
|
25935
26059
|
}).trim();
|
|
25936
26060
|
}
|
|
@@ -25938,7 +26062,7 @@ function fetchPrDiffInfo() {
|
|
|
25938
26062
|
const { org, repo } = getRepoInfo();
|
|
25939
26063
|
const branch2 = getCurrentBranch3();
|
|
25940
26064
|
const fields = "number,baseRefName,baseRefOid,headRefName,headRefOid";
|
|
25941
|
-
const raw =
|
|
26065
|
+
const raw = execSync56(
|
|
25942
26066
|
`gh pr list --state open --head ${branch2} --json ${fields} -R ${org}/${repo}`,
|
|
25943
26067
|
{
|
|
25944
26068
|
encoding: "utf8",
|
|
@@ -25963,7 +26087,7 @@ function fetchPrDiffInfo() {
|
|
|
25963
26087
|
}
|
|
25964
26088
|
function fetchPrChangedFiles(prNumber) {
|
|
25965
26089
|
const { org, repo } = getRepoInfo();
|
|
25966
|
-
const out =
|
|
26090
|
+
const out = execSync56(
|
|
25967
26091
|
`gh api repos/${org}/${repo}/pulls/${prNumber}/files --paginate --jq ".[].filename"`,
|
|
25968
26092
|
{
|
|
25969
26093
|
encoding: "utf8",
|
|
@@ -25975,11 +26099,11 @@ function fetchPrChangedFiles(prNumber) {
|
|
|
25975
26099
|
|
|
25976
26100
|
// src/commands/review/gatherContext.ts
|
|
25977
26101
|
function gatherContext() {
|
|
25978
|
-
const branch2 =
|
|
26102
|
+
const branch2 = execSync57("git rev-parse --abbrev-ref HEAD", {
|
|
25979
26103
|
encoding: "utf8"
|
|
25980
26104
|
}).trim();
|
|
25981
|
-
const sha =
|
|
25982
|
-
const shortSha =
|
|
26105
|
+
const sha = execSync57("git rev-parse HEAD", { encoding: "utf8" }).trim();
|
|
26106
|
+
const shortSha = execSync57("git rev-parse --short=7 HEAD", {
|
|
25983
26107
|
encoding: "utf8"
|
|
25984
26108
|
}).trim();
|
|
25985
26109
|
const prInfo = fetchPrDiffInfo();
|
|
@@ -26335,18 +26459,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
26335
26459
|
}
|
|
26336
26460
|
|
|
26337
26461
|
// src/commands/review/warnOutOfDiff.ts
|
|
26338
|
-
import
|
|
26462
|
+
import chalk198 from "chalk";
|
|
26339
26463
|
function warnOutOfDiff(outOfDiff) {
|
|
26340
26464
|
if (outOfDiff.length === 0) return;
|
|
26341
26465
|
console.warn(
|
|
26342
|
-
|
|
26466
|
+
chalk198.yellow(
|
|
26343
26467
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
26344
26468
|
)
|
|
26345
26469
|
);
|
|
26346
26470
|
for (const finding of outOfDiff) {
|
|
26347
26471
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
26348
26472
|
console.warn(
|
|
26349
|
-
` ${
|
|
26473
|
+
` ${chalk198.yellow("\xB7")} ${finding.title} ${chalk198.dim(
|
|
26350
26474
|
`(${finding.file}:${range})`
|
|
26351
26475
|
)}`
|
|
26352
26476
|
);
|
|
@@ -26370,18 +26494,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
26370
26494
|
}
|
|
26371
26495
|
|
|
26372
26496
|
// src/commands/review/warnUnlocated.ts
|
|
26373
|
-
import
|
|
26497
|
+
import chalk199 from "chalk";
|
|
26374
26498
|
function warnUnlocated(unlocated) {
|
|
26375
26499
|
if (unlocated.length === 0) return;
|
|
26376
26500
|
console.warn(
|
|
26377
|
-
|
|
26501
|
+
chalk199.yellow(
|
|
26378
26502
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
26379
26503
|
)
|
|
26380
26504
|
);
|
|
26381
26505
|
for (const finding of unlocated) {
|
|
26382
|
-
const where = finding.location ||
|
|
26506
|
+
const where = finding.location || chalk199.dim("missing");
|
|
26383
26507
|
console.warn(
|
|
26384
|
-
` ${
|
|
26508
|
+
` ${chalk199.yellow("\xB7")} ${finding.title} ${chalk199.dim(`(${where})`)}`
|
|
26385
26509
|
);
|
|
26386
26510
|
}
|
|
26387
26511
|
}
|
|
@@ -26713,9 +26837,9 @@ var MultiSpinner = class {
|
|
|
26713
26837
|
};
|
|
26714
26838
|
|
|
26715
26839
|
// src/commands/review/ensureCodexAvailable.ts
|
|
26716
|
-
import { spawnSync as
|
|
26840
|
+
import { spawnSync as spawnSync6 } from "child_process";
|
|
26717
26841
|
function runNpmInstall() {
|
|
26718
|
-
const result =
|
|
26842
|
+
const result = spawnSync6("npm", ["install", "-g", "@openai/codex"], {
|
|
26719
26843
|
stdio: "inherit",
|
|
26720
26844
|
shell: true
|
|
26721
26845
|
});
|
|
@@ -27617,7 +27741,7 @@ function registerReview(program2) {
|
|
|
27617
27741
|
}
|
|
27618
27742
|
|
|
27619
27743
|
// src/commands/seq/seqAuth.ts
|
|
27620
|
-
import
|
|
27744
|
+
import chalk201 from "chalk";
|
|
27621
27745
|
|
|
27622
27746
|
// src/commands/seq/loadConnections.ts
|
|
27623
27747
|
function loadConnections2() {
|
|
@@ -27646,10 +27770,10 @@ function setDefaultConnection(name) {
|
|
|
27646
27770
|
}
|
|
27647
27771
|
|
|
27648
27772
|
// src/shared/assertUniqueName.ts
|
|
27649
|
-
import
|
|
27773
|
+
import chalk200 from "chalk";
|
|
27650
27774
|
function assertUniqueName(existingNames, name) {
|
|
27651
27775
|
if (existingNames.includes(name)) {
|
|
27652
|
-
console.error(
|
|
27776
|
+
console.error(chalk200.red(`Connection "${name}" already exists.`));
|
|
27653
27777
|
process.exit(1);
|
|
27654
27778
|
}
|
|
27655
27779
|
}
|
|
@@ -27667,16 +27791,16 @@ async function promptConnection2(existingNames) {
|
|
|
27667
27791
|
var seqAuth = createConnectionAuth({
|
|
27668
27792
|
load: loadConnections2,
|
|
27669
27793
|
save: saveConnections2,
|
|
27670
|
-
format: (c) => `${
|
|
27794
|
+
format: (c) => `${chalk201.bold(c.name)} ${c.url}`,
|
|
27671
27795
|
promptNew: promptConnection2,
|
|
27672
27796
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
27673
27797
|
});
|
|
27674
27798
|
|
|
27675
27799
|
// src/commands/seq/seqQuery.ts
|
|
27676
|
-
import
|
|
27800
|
+
import chalk205 from "chalk";
|
|
27677
27801
|
|
|
27678
27802
|
// src/commands/seq/fetchSeq.ts
|
|
27679
|
-
import
|
|
27803
|
+
import chalk202 from "chalk";
|
|
27680
27804
|
async function fetchSeq(conn, path73, params) {
|
|
27681
27805
|
const url = `${conn.url}${path73}?${params}`;
|
|
27682
27806
|
const response = await fetch(url, {
|
|
@@ -27687,7 +27811,7 @@ async function fetchSeq(conn, path73, params) {
|
|
|
27687
27811
|
});
|
|
27688
27812
|
if (!response.ok) {
|
|
27689
27813
|
const body = await response.text();
|
|
27690
|
-
console.error(
|
|
27814
|
+
console.error(chalk202.red(`Seq returned ${response.status}: ${body}`));
|
|
27691
27815
|
process.exit(1);
|
|
27692
27816
|
}
|
|
27693
27817
|
return response;
|
|
@@ -27746,23 +27870,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
27746
27870
|
}
|
|
27747
27871
|
|
|
27748
27872
|
// src/commands/seq/formatEvent.ts
|
|
27749
|
-
import
|
|
27873
|
+
import chalk203 from "chalk";
|
|
27750
27874
|
function levelColor(level) {
|
|
27751
27875
|
switch (level) {
|
|
27752
27876
|
case "Fatal":
|
|
27753
|
-
return
|
|
27877
|
+
return chalk203.bgRed.white;
|
|
27754
27878
|
case "Error":
|
|
27755
|
-
return
|
|
27879
|
+
return chalk203.red;
|
|
27756
27880
|
case "Warning":
|
|
27757
|
-
return
|
|
27881
|
+
return chalk203.yellow;
|
|
27758
27882
|
case "Information":
|
|
27759
|
-
return
|
|
27883
|
+
return chalk203.cyan;
|
|
27760
27884
|
case "Debug":
|
|
27761
|
-
return
|
|
27885
|
+
return chalk203.gray;
|
|
27762
27886
|
case "Verbose":
|
|
27763
|
-
return
|
|
27887
|
+
return chalk203.dim;
|
|
27764
27888
|
default:
|
|
27765
|
-
return
|
|
27889
|
+
return chalk203.white;
|
|
27766
27890
|
}
|
|
27767
27891
|
}
|
|
27768
27892
|
function levelAbbrev(level) {
|
|
@@ -27803,12 +27927,12 @@ function formatTimestamp(iso) {
|
|
|
27803
27927
|
function formatEvent(event) {
|
|
27804
27928
|
const color = levelColor(event.Level);
|
|
27805
27929
|
const abbrev = levelAbbrev(event.Level);
|
|
27806
|
-
const ts8 =
|
|
27930
|
+
const ts8 = chalk203.dim(formatTimestamp(event.Timestamp));
|
|
27807
27931
|
const msg = renderMessage(event);
|
|
27808
27932
|
const lines2 = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
27809
27933
|
if (event.Exception) {
|
|
27810
27934
|
for (const line of event.Exception.split("\n")) {
|
|
27811
|
-
lines2.push(
|
|
27935
|
+
lines2.push(chalk203.red(` ${line}`));
|
|
27812
27936
|
}
|
|
27813
27937
|
}
|
|
27814
27938
|
return lines2.join("\n");
|
|
@@ -27841,11 +27965,11 @@ function rejectTimestampFilter(filter) {
|
|
|
27841
27965
|
}
|
|
27842
27966
|
|
|
27843
27967
|
// src/shared/resolveNamedConnection.ts
|
|
27844
|
-
import
|
|
27968
|
+
import chalk204 from "chalk";
|
|
27845
27969
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
27846
27970
|
if (connections.length === 0) {
|
|
27847
27971
|
console.error(
|
|
27848
|
-
|
|
27972
|
+
chalk204.red(
|
|
27849
27973
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
27850
27974
|
)
|
|
27851
27975
|
);
|
|
@@ -27854,7 +27978,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
27854
27978
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
27855
27979
|
const connection = connections.find((c) => c.name === target);
|
|
27856
27980
|
if (!connection) {
|
|
27857
|
-
console.error(
|
|
27981
|
+
console.error(chalk204.red(`${kind} connection "${target}" not found.`));
|
|
27858
27982
|
process.exit(1);
|
|
27859
27983
|
}
|
|
27860
27984
|
return connection;
|
|
@@ -27883,7 +28007,7 @@ async function seqQuery(filter, options2) {
|
|
|
27883
28007
|
new URLSearchParams({ filter, count: String(count8) })
|
|
27884
28008
|
);
|
|
27885
28009
|
if (events.length === 0) {
|
|
27886
|
-
console.log(
|
|
28010
|
+
console.log(chalk205.yellow("No events found."));
|
|
27887
28011
|
return;
|
|
27888
28012
|
}
|
|
27889
28013
|
if (options2.json) {
|
|
@@ -27894,11 +28018,11 @@ async function seqQuery(filter, options2) {
|
|
|
27894
28018
|
for (const event of chronological) {
|
|
27895
28019
|
console.log(formatEvent(event));
|
|
27896
28020
|
}
|
|
27897
|
-
console.log(
|
|
28021
|
+
console.log(chalk205.dim(`
|
|
27898
28022
|
${events.length} events`));
|
|
27899
28023
|
if (events.length >= count8) {
|
|
27900
28024
|
console.log(
|
|
27901
|
-
|
|
28025
|
+
chalk205.yellow(
|
|
27902
28026
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
27903
28027
|
)
|
|
27904
28028
|
);
|
|
@@ -27906,10 +28030,10 @@ ${events.length} events`));
|
|
|
27906
28030
|
}
|
|
27907
28031
|
|
|
27908
28032
|
// src/shared/setNamedDefaultConnection.ts
|
|
27909
|
-
import
|
|
28033
|
+
import chalk206 from "chalk";
|
|
27910
28034
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
27911
28035
|
if (!connections.find((c) => c.name === name)) {
|
|
27912
|
-
console.error(
|
|
28036
|
+
console.error(chalk206.red(`Connection "${name}" not found.`));
|
|
27913
28037
|
process.exit(1);
|
|
27914
28038
|
}
|
|
27915
28039
|
setDefault(name);
|
|
@@ -27958,7 +28082,7 @@ function registerSignal(program2) {
|
|
|
27958
28082
|
}
|
|
27959
28083
|
|
|
27960
28084
|
// src/commands/sql/sqlAuth.ts
|
|
27961
|
-
import
|
|
28085
|
+
import chalk208 from "chalk";
|
|
27962
28086
|
|
|
27963
28087
|
// src/commands/sql/loadConnections.ts
|
|
27964
28088
|
function loadConnections3() {
|
|
@@ -27987,7 +28111,7 @@ function setDefaultConnection2(name) {
|
|
|
27987
28111
|
}
|
|
27988
28112
|
|
|
27989
28113
|
// src/commands/sql/promptConnection.ts
|
|
27990
|
-
import
|
|
28114
|
+
import chalk207 from "chalk";
|
|
27991
28115
|
async function promptConnection3(existingNames) {
|
|
27992
28116
|
const name = await promptInput("name", "Connection name:", "default");
|
|
27993
28117
|
assertUniqueName(existingNames, name);
|
|
@@ -27995,7 +28119,7 @@ async function promptConnection3(existingNames) {
|
|
|
27995
28119
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
27996
28120
|
const port = Number.parseInt(portStr, 10);
|
|
27997
28121
|
if (!Number.isFinite(port)) {
|
|
27998
|
-
console.error(
|
|
28122
|
+
console.error(chalk207.red(`Invalid port "${portStr}".`));
|
|
27999
28123
|
process.exit(1);
|
|
28000
28124
|
}
|
|
28001
28125
|
const user = await promptInput("user", "User:");
|
|
@@ -28008,13 +28132,13 @@ async function promptConnection3(existingNames) {
|
|
|
28008
28132
|
var sqlAuth = createConnectionAuth({
|
|
28009
28133
|
load: loadConnections3,
|
|
28010
28134
|
save: saveConnections3,
|
|
28011
|
-
format: (c) => `${
|
|
28135
|
+
format: (c) => `${chalk208.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
28012
28136
|
promptNew: promptConnection3,
|
|
28013
28137
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
28014
28138
|
});
|
|
28015
28139
|
|
|
28016
28140
|
// src/commands/sql/printTable.ts
|
|
28017
|
-
import
|
|
28141
|
+
import chalk209 from "chalk";
|
|
28018
28142
|
function formatCell(value) {
|
|
28019
28143
|
if (value === null || value === void 0) return "";
|
|
28020
28144
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -28023,7 +28147,7 @@ function formatCell(value) {
|
|
|
28023
28147
|
}
|
|
28024
28148
|
function printTable(rows) {
|
|
28025
28149
|
if (rows.length === 0) {
|
|
28026
|
-
console.log(
|
|
28150
|
+
console.log(chalk209.yellow("(no rows)"));
|
|
28027
28151
|
return;
|
|
28028
28152
|
}
|
|
28029
28153
|
const columns = Object.keys(rows[0]);
|
|
@@ -28031,13 +28155,13 @@ function printTable(rows) {
|
|
|
28031
28155
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
28032
28156
|
);
|
|
28033
28157
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
28034
|
-
console.log(
|
|
28035
|
-
console.log(
|
|
28158
|
+
console.log(chalk209.dim(header));
|
|
28159
|
+
console.log(chalk209.dim("-".repeat(header.length)));
|
|
28036
28160
|
for (const row of rows) {
|
|
28037
28161
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
28038
28162
|
console.log(line);
|
|
28039
28163
|
}
|
|
28040
|
-
console.log(
|
|
28164
|
+
console.log(chalk209.dim(`
|
|
28041
28165
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
28042
28166
|
}
|
|
28043
28167
|
|
|
@@ -28097,7 +28221,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
28097
28221
|
}
|
|
28098
28222
|
|
|
28099
28223
|
// src/commands/sql/sqlMutate.ts
|
|
28100
|
-
import
|
|
28224
|
+
import chalk210 from "chalk";
|
|
28101
28225
|
|
|
28102
28226
|
// src/commands/sql/isMutation.ts
|
|
28103
28227
|
var MUTATION_KEYWORDS = [
|
|
@@ -28131,7 +28255,7 @@ function isMutation(sql25) {
|
|
|
28131
28255
|
async function sqlMutate(query, connectionName) {
|
|
28132
28256
|
if (!isMutation(query)) {
|
|
28133
28257
|
console.error(
|
|
28134
|
-
|
|
28258
|
+
chalk210.red(
|
|
28135
28259
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
28136
28260
|
)
|
|
28137
28261
|
);
|
|
@@ -28141,18 +28265,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
28141
28265
|
const pool = await sqlConnect(conn);
|
|
28142
28266
|
try {
|
|
28143
28267
|
const result = await pool.request().query(query);
|
|
28144
|
-
console.log(
|
|
28268
|
+
console.log(chalk210.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
28145
28269
|
} finally {
|
|
28146
28270
|
await pool.close();
|
|
28147
28271
|
}
|
|
28148
28272
|
}
|
|
28149
28273
|
|
|
28150
28274
|
// src/commands/sql/sqlQuery.ts
|
|
28151
|
-
import
|
|
28275
|
+
import chalk211 from "chalk";
|
|
28152
28276
|
async function sqlQuery(query, connectionName) {
|
|
28153
28277
|
if (isMutation(query)) {
|
|
28154
28278
|
console.error(
|
|
28155
|
-
|
|
28279
|
+
chalk211.red(
|
|
28156
28280
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
28157
28281
|
)
|
|
28158
28282
|
);
|
|
@@ -28167,7 +28291,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
28167
28291
|
printTable(rows);
|
|
28168
28292
|
} else {
|
|
28169
28293
|
console.log(
|
|
28170
|
-
|
|
28294
|
+
chalk211.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
28171
28295
|
);
|
|
28172
28296
|
}
|
|
28173
28297
|
} finally {
|
|
@@ -28312,7 +28436,7 @@ function reportPrune(label2, result, force) {
|
|
|
28312
28436
|
// src/commands/sync/syncClaudeMd.ts
|
|
28313
28437
|
import * as fs36 from "fs";
|
|
28314
28438
|
import * as path60 from "path";
|
|
28315
|
-
import
|
|
28439
|
+
import chalk212 from "chalk";
|
|
28316
28440
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
28317
28441
|
const source = path60.join(claudeDir, "CLAUDE.md");
|
|
28318
28442
|
const target = path60.join(targetBase, "CLAUDE.md");
|
|
@@ -28321,14 +28445,14 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
28321
28445
|
const targetContent = fs36.readFileSync(target, "utf8");
|
|
28322
28446
|
if (sourceContent !== targetContent) {
|
|
28323
28447
|
console.log(
|
|
28324
|
-
|
|
28448
|
+
chalk212.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
28325
28449
|
);
|
|
28326
28450
|
console.log();
|
|
28327
28451
|
printDiff(targetContent, sourceContent);
|
|
28328
28452
|
if (!options2?.yes) {
|
|
28329
28453
|
printAutoConfirmHint();
|
|
28330
28454
|
const confirm = await promptConfirm(
|
|
28331
|
-
|
|
28455
|
+
chalk212.red("Overwrite existing CLAUDE.md?"),
|
|
28332
28456
|
false
|
|
28333
28457
|
);
|
|
28334
28458
|
if (!confirm) {
|
|
@@ -28561,7 +28685,7 @@ function syncPi(claudeDir, options2) {
|
|
|
28561
28685
|
// src/commands/sync/syncSettings.ts
|
|
28562
28686
|
import * as fs42 from "fs";
|
|
28563
28687
|
import * as path67 from "path";
|
|
28564
|
-
import
|
|
28688
|
+
import chalk213 from "chalk";
|
|
28565
28689
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
28566
28690
|
const source = path67.join(claudeDir, "settings.json");
|
|
28567
28691
|
const target = path67.join(targetBase, "settings.json");
|
|
@@ -28580,7 +28704,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
28580
28704
|
if (mergedContent !== normalizedTarget) {
|
|
28581
28705
|
if (!options2?.yes) {
|
|
28582
28706
|
console.log(
|
|
28583
|
-
|
|
28707
|
+
chalk213.yellow(
|
|
28584
28708
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
28585
28709
|
)
|
|
28586
28710
|
);
|
|
@@ -28588,7 +28712,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
28588
28712
|
printDiff(targetContent, mergedContent);
|
|
28589
28713
|
printAutoConfirmHint();
|
|
28590
28714
|
const confirm = await promptConfirm(
|
|
28591
|
-
|
|
28715
|
+
chalk213.red("Overwrite existing settings.json?"),
|
|
28592
28716
|
false
|
|
28593
28717
|
);
|
|
28594
28718
|
if (!confirm) {
|
|
@@ -29068,7 +29192,7 @@ function registerVerify(program2) {
|
|
|
29068
29192
|
}
|
|
29069
29193
|
|
|
29070
29194
|
// src/commands/voice/devices.ts
|
|
29071
|
-
import { spawnSync as
|
|
29195
|
+
import { spawnSync as spawnSync7 } from "child_process";
|
|
29072
29196
|
import { join as join74 } from "path";
|
|
29073
29197
|
|
|
29074
29198
|
// src/commands/voice/shared.ts
|
|
@@ -29101,7 +29225,7 @@ function getLockFile() {
|
|
|
29101
29225
|
// src/commands/voice/devices.ts
|
|
29102
29226
|
function devices() {
|
|
29103
29227
|
const script = join74(getPythonDir(), "list_devices.py");
|
|
29104
|
-
|
|
29228
|
+
spawnSync7(getVenvPython(), [script], { stdio: "inherit" });
|
|
29105
29229
|
}
|
|
29106
29230
|
|
|
29107
29231
|
// src/commands/voice/logs.ts
|
|
@@ -29133,12 +29257,12 @@ function logs(options2) {
|
|
|
29133
29257
|
}
|
|
29134
29258
|
|
|
29135
29259
|
// src/commands/voice/setup.ts
|
|
29136
|
-
import { spawnSync as
|
|
29260
|
+
import { spawnSync as spawnSync8 } from "child_process";
|
|
29137
29261
|
import { mkdirSync as mkdirSync27 } from "fs";
|
|
29138
29262
|
import { join as join76 } from "path";
|
|
29139
29263
|
|
|
29140
29264
|
// src/commands/voice/checkLockFile.ts
|
|
29141
|
-
import { execSync as
|
|
29265
|
+
import { execSync as execSync58 } from "child_process";
|
|
29142
29266
|
import { existsSync as existsSync60, mkdirSync as mkdirSync26, readFileSync as readFileSync49, writeFileSync as writeFileSync42 } from "fs";
|
|
29143
29267
|
import { join as join75 } from "path";
|
|
29144
29268
|
function isProcessAlive2(pid) {
|
|
@@ -29167,7 +29291,7 @@ function bootstrapVenv() {
|
|
|
29167
29291
|
if (existsSync60(getVenvPython())) return;
|
|
29168
29292
|
console.log("Setting up Python environment...");
|
|
29169
29293
|
const pythonDir = getPythonDir();
|
|
29170
|
-
|
|
29294
|
+
execSync58(
|
|
29171
29295
|
`uv sync --project "${pythonDir}" --extra runtime --no-install-project`,
|
|
29172
29296
|
{
|
|
29173
29297
|
stdio: "inherit",
|
|
@@ -29194,7 +29318,7 @@ function setup() {
|
|
|
29194
29318
|
bootstrapVenv();
|
|
29195
29319
|
console.log("\nDownloading models...\n");
|
|
29196
29320
|
const script = join76(getPythonDir(), "setup_models.py");
|
|
29197
|
-
const result =
|
|
29321
|
+
const result = spawnSync8(getVenvPython(), [script], {
|
|
29198
29322
|
stdio: "inherit",
|
|
29199
29323
|
env: { ...process.env, VOICE_LOG_FILE: voicePaths.log }
|
|
29200
29324
|
});
|
|
@@ -29750,11 +29874,11 @@ function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
|
29750
29874
|
}
|
|
29751
29875
|
|
|
29752
29876
|
// src/commands/run/runPreCommands.ts
|
|
29753
|
-
import { execSync as
|
|
29877
|
+
import { execSync as execSync59 } from "child_process";
|
|
29754
29878
|
function runPreCommands(pre, cwd) {
|
|
29755
29879
|
for (const cmd of pre) {
|
|
29756
29880
|
try {
|
|
29757
|
-
|
|
29881
|
+
execSync59(cmd, { stdio: "inherit", cwd });
|
|
29758
29882
|
} catch (error) {
|
|
29759
29883
|
const code = error && typeof error === "object" && "status" in error ? error.status : 1;
|
|
29760
29884
|
process.exit(code);
|
|
@@ -29946,7 +30070,7 @@ function registerWatch(program2) {
|
|
|
29946
30070
|
|
|
29947
30071
|
// src/commands/roam/auth.ts
|
|
29948
30072
|
import { randomBytes } from "crypto";
|
|
29949
|
-
import
|
|
30073
|
+
import chalk214 from "chalk";
|
|
29950
30074
|
|
|
29951
30075
|
// src/commands/roam/waitForCallback.ts
|
|
29952
30076
|
import { createServer as createServer3 } from "http";
|
|
@@ -30077,13 +30201,13 @@ async function auth() {
|
|
|
30077
30201
|
saveGlobalConfig(config);
|
|
30078
30202
|
const state = randomBytes(16).toString("hex");
|
|
30079
30203
|
console.log(
|
|
30080
|
-
|
|
30204
|
+
chalk214.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
30081
30205
|
);
|
|
30082
|
-
console.log(
|
|
30083
|
-
console.log(
|
|
30084
|
-
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..."));
|
|
30085
30209
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
30086
|
-
console.log(
|
|
30210
|
+
console.log(chalk214.dim("Exchanging code for tokens..."));
|
|
30087
30211
|
const tokens = await exchangeToken({
|
|
30088
30212
|
code,
|
|
30089
30213
|
clientId,
|
|
@@ -30099,7 +30223,7 @@ async function auth() {
|
|
|
30099
30223
|
};
|
|
30100
30224
|
saveGlobalConfig(config);
|
|
30101
30225
|
console.log(
|
|
30102
|
-
|
|
30226
|
+
chalk214.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
30103
30227
|
);
|
|
30104
30228
|
}
|
|
30105
30229
|
|
|
@@ -30446,11 +30570,11 @@ function registerRun(program2) {
|
|
|
30446
30570
|
}
|
|
30447
30571
|
|
|
30448
30572
|
// src/commands/screenshot/index.ts
|
|
30449
|
-
import { execSync as
|
|
30573
|
+
import { execSync as execSync60 } from "child_process";
|
|
30450
30574
|
import { existsSync as existsSync67, mkdirSync as mkdirSync30, unlinkSync as unlinkSync22, writeFileSync as writeFileSync45 } from "fs";
|
|
30451
30575
|
import { tmpdir as tmpdir8 } from "os";
|
|
30452
30576
|
import { join as join83, resolve as resolve19 } from "path";
|
|
30453
|
-
import
|
|
30577
|
+
import chalk215 from "chalk";
|
|
30454
30578
|
|
|
30455
30579
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
30456
30580
|
var captureWindowPs1 = `
|
|
@@ -30589,7 +30713,7 @@ function runPowerShellScript(processName, outputPath) {
|
|
|
30589
30713
|
const scriptPath = join83(tmpdir8(), `assist-screenshot-${Date.now()}.ps1`);
|
|
30590
30714
|
writeFileSync45(scriptPath, captureWindowPs1, "utf8");
|
|
30591
30715
|
try {
|
|
30592
|
-
|
|
30716
|
+
execSync60(
|
|
30593
30717
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|
|
30594
30718
|
{ stdio: ["ignore", "pipe", "pipe"], encoding: "utf8" }
|
|
30595
30719
|
);
|
|
@@ -30601,13 +30725,13 @@ function screenshot(processName) {
|
|
|
30601
30725
|
const config = loadConfig();
|
|
30602
30726
|
const outputDir = resolve19(config.screenshot.outputDir);
|
|
30603
30727
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
30604
|
-
console.log(
|
|
30728
|
+
console.log(chalk215.gray(`Capturing window for process "${processName}" ...`));
|
|
30605
30729
|
try {
|
|
30606
30730
|
runPowerShellScript(processName, outputPath);
|
|
30607
|
-
console.log(
|
|
30731
|
+
console.log(chalk215.green(`Screenshot saved: ${outputPath}`));
|
|
30608
30732
|
} catch (error) {
|
|
30609
30733
|
const msg = error instanceof Error ? error.message : String(error);
|
|
30610
|
-
console.error(
|
|
30734
|
+
console.error(chalk215.red(`Failed to capture screenshot: ${msg}`));
|
|
30611
30735
|
process.exit(1);
|
|
30612
30736
|
}
|
|
30613
30737
|
}
|
|
@@ -35779,7 +35903,7 @@ function registerSetStatusCommand(cmd) {
|
|
|
35779
35903
|
|
|
35780
35904
|
// src/commands/sessions/summarise/index.ts
|
|
35781
35905
|
import * as fs50 from "fs";
|
|
35782
|
-
import
|
|
35906
|
+
import chalk216 from "chalk";
|
|
35783
35907
|
|
|
35784
35908
|
// src/commands/sessions/summarise/shared.ts
|
|
35785
35909
|
import * as fs49 from "fs";
|
|
@@ -35838,22 +35962,22 @@ ${firstMessage}`);
|
|
|
35838
35962
|
async function summarise2(options2) {
|
|
35839
35963
|
const files = await discoverSessionFiles();
|
|
35840
35964
|
if (files.length === 0) {
|
|
35841
|
-
console.log(
|
|
35965
|
+
console.log(chalk216.yellow("No sessions found."));
|
|
35842
35966
|
return;
|
|
35843
35967
|
}
|
|
35844
35968
|
const toProcess = selectCandidates(files, options2);
|
|
35845
35969
|
if (toProcess.length === 0) {
|
|
35846
|
-
console.log(
|
|
35970
|
+
console.log(chalk216.green("All sessions already summarised."));
|
|
35847
35971
|
return;
|
|
35848
35972
|
}
|
|
35849
35973
|
console.log(
|
|
35850
|
-
|
|
35974
|
+
chalk216.cyan(
|
|
35851
35975
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
35852
35976
|
)
|
|
35853
35977
|
);
|
|
35854
35978
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
35855
35979
|
console.log(
|
|
35856
|
-
|
|
35980
|
+
chalk216.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk216.yellow(`, ${failed2} skipped`) : "")
|
|
35857
35981
|
);
|
|
35858
35982
|
}
|
|
35859
35983
|
function selectCandidates(files, options2) {
|
|
@@ -35873,16 +35997,16 @@ function processSessions(files) {
|
|
|
35873
35997
|
let failed2 = 0;
|
|
35874
35998
|
for (let i = 0; i < files.length; i++) {
|
|
35875
35999
|
const file = files[i];
|
|
35876
|
-
process.stdout.write(
|
|
36000
|
+
process.stdout.write(chalk216.dim(` [${i + 1}/${files.length}] `));
|
|
35877
36001
|
const summary = summariseSession(file);
|
|
35878
36002
|
if (summary) {
|
|
35879
36003
|
writeSummary(file, summary);
|
|
35880
36004
|
succeeded++;
|
|
35881
|
-
process.stdout.write(`${
|
|
36005
|
+
process.stdout.write(`${chalk216.green("\u2713")} ${summary}
|
|
35882
36006
|
`);
|
|
35883
36007
|
} else {
|
|
35884
36008
|
failed2++;
|
|
35885
|
-
process.stdout.write(` ${
|
|
36009
|
+
process.stdout.write(` ${chalk216.yellow("skip")}
|
|
35886
36010
|
`);
|
|
35887
36011
|
}
|
|
35888
36012
|
}
|
|
@@ -35903,7 +36027,7 @@ function registerSessions(program2) {
|
|
|
35903
36027
|
}
|
|
35904
36028
|
|
|
35905
36029
|
// src/commands/statusLine.ts
|
|
35906
|
-
import
|
|
36030
|
+
import chalk218 from "chalk";
|
|
35907
36031
|
|
|
35908
36032
|
// src/shared/contextLevel.ts
|
|
35909
36033
|
function contextLevel(pct) {
|
|
@@ -35913,7 +36037,7 @@ function contextLevel(pct) {
|
|
|
35913
36037
|
}
|
|
35914
36038
|
|
|
35915
36039
|
// src/commands/buildLimitsSegment.ts
|
|
35916
|
-
import
|
|
36040
|
+
import chalk217 from "chalk";
|
|
35917
36041
|
|
|
35918
36042
|
// src/shared/rateLimitLevel.ts
|
|
35919
36043
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -35951,9 +36075,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
35951
36075
|
|
|
35952
36076
|
// src/commands/buildLimitsSegment.ts
|
|
35953
36077
|
var LEVEL_COLOR = {
|
|
35954
|
-
ok:
|
|
35955
|
-
warn:
|
|
35956
|
-
over:
|
|
36078
|
+
ok: chalk217.green,
|
|
36079
|
+
warn: chalk217.yellow,
|
|
36080
|
+
over: chalk217.red
|
|
35957
36081
|
};
|
|
35958
36082
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
35959
36083
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -36049,7 +36173,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
36049
36173
|
}
|
|
36050
36174
|
|
|
36051
36175
|
// src/commands/statusLine.ts
|
|
36052
|
-
|
|
36176
|
+
chalk218.level = 3;
|
|
36053
36177
|
function formatNumber(num) {
|
|
36054
36178
|
return num.toLocaleString("en-US");
|
|
36055
36179
|
}
|
|
@@ -36057,9 +36181,9 @@ function colorizePercent(pct) {
|
|
|
36057
36181
|
const label2 = `${Math.round(pct)}%`;
|
|
36058
36182
|
switch (contextLevel(pct)) {
|
|
36059
36183
|
case "red":
|
|
36060
|
-
return
|
|
36184
|
+
return chalk218.red(label2);
|
|
36061
36185
|
case "yellow":
|
|
36062
|
-
return
|
|
36186
|
+
return chalk218.yellow(label2);
|
|
36063
36187
|
default:
|
|
36064
36188
|
return label2;
|
|
36065
36189
|
}
|
|
@@ -36072,7 +36196,7 @@ async function statusLine() {
|
|
|
36072
36196
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
36073
36197
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
36074
36198
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
36075
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
36199
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk218.cyan(branch2)} | ` : "";
|
|
36076
36200
|
console.log(
|
|
36077
36201
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
36078
36202
|
);
|
|
@@ -36085,7 +36209,7 @@ async function statusLine() {
|
|
|
36085
36209
|
}
|
|
36086
36210
|
|
|
36087
36211
|
// src/commands/update.ts
|
|
36088
|
-
import { execSync as
|
|
36212
|
+
import { execSync as execSync61 } from "child_process";
|
|
36089
36213
|
import * as path72 from "path";
|
|
36090
36214
|
|
|
36091
36215
|
// src/commands/restartDaemonAfterUpdate.ts
|
|
@@ -36109,7 +36233,7 @@ function isGlobalNpmInstall(dir) {
|
|
|
36109
36233
|
if (resolved.split(path72.sep).includes("node_modules")) {
|
|
36110
36234
|
return true;
|
|
36111
36235
|
}
|
|
36112
|
-
const globalPrefix =
|
|
36236
|
+
const globalPrefix = execSync61("npm prefix -g", { stdio: "pipe" }).toString().trim();
|
|
36113
36237
|
return resolved.toLowerCase().startsWith(path72.resolve(globalPrefix).toLowerCase());
|
|
36114
36238
|
} catch {
|
|
36115
36239
|
return false;
|
|
@@ -36120,18 +36244,18 @@ async function update2() {
|
|
|
36120
36244
|
console.log(`Assist is installed at: ${installDir}`);
|
|
36121
36245
|
if (isGitRepo(installDir)) {
|
|
36122
36246
|
console.log("Detected git repo installation, pulling latest...");
|
|
36123
|
-
|
|
36247
|
+
execSync61("git pull", { cwd: installDir, stdio: "inherit" });
|
|
36124
36248
|
console.log("Installing dependencies...");
|
|
36125
|
-
|
|
36249
|
+
execSync61("npm i", { cwd: installDir, stdio: "inherit" });
|
|
36126
36250
|
console.log("Building...");
|
|
36127
|
-
|
|
36251
|
+
execSync61("npm run build", { cwd: installDir, stdio: "inherit" });
|
|
36128
36252
|
console.log("Syncing commands...");
|
|
36129
|
-
|
|
36253
|
+
execSync61("assist sync", { stdio: "inherit" });
|
|
36130
36254
|
} else if (isGlobalNpmInstall(installDir)) {
|
|
36131
36255
|
console.log("Detected global npm installation, updating...");
|
|
36132
|
-
|
|
36256
|
+
execSync61("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
|
|
36133
36257
|
console.log("Syncing commands...");
|
|
36134
|
-
|
|
36258
|
+
execSync61("assist sync", { stdio: "inherit" });
|
|
36135
36259
|
} else {
|
|
36136
36260
|
console.error(
|
|
36137
36261
|
"Could not determine installation method. Expected a git repo or global npm install."
|
|
@@ -36142,10 +36266,10 @@ async function update2() {
|
|
|
36142
36266
|
}
|
|
36143
36267
|
|
|
36144
36268
|
// src/reportCliError.ts
|
|
36145
|
-
import
|
|
36269
|
+
import chalk219 from "chalk";
|
|
36146
36270
|
function reportCliError(error) {
|
|
36147
36271
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError) {
|
|
36148
|
-
console.error(
|
|
36272
|
+
console.error(chalk219.red(error.message));
|
|
36149
36273
|
} else {
|
|
36150
36274
|
console.error(error);
|
|
36151
36275
|
}
|