@staff0rd/assist 0.423.0 → 0.424.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 +1 -1
- package/dist/commands/sessions/web/bundle.js +2 -2
- package/dist/index.js +409 -369
- 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.424.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -13998,6 +13998,9 @@ function exitKeyNotSet(key) {
|
|
|
13998
13998
|
}
|
|
13999
13999
|
|
|
14000
14000
|
// src/commands/config/configSet.ts
|
|
14001
|
+
import chalk127 from "chalk";
|
|
14002
|
+
|
|
14003
|
+
// src/commands/config/applyConfigSet.ts
|
|
14001
14004
|
import chalk126 from "chalk";
|
|
14002
14005
|
|
|
14003
14006
|
// src/commands/config/setNestedValue.ts
|
|
@@ -14070,13 +14073,57 @@ function formatIssuePath(issue, key) {
|
|
|
14070
14073
|
return issue.path.length > 0 ? issue.path.join(".") : key;
|
|
14071
14074
|
}
|
|
14072
14075
|
|
|
14076
|
+
// src/commands/config/applyConfigSet.ts
|
|
14077
|
+
var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
14078
|
+
function applyConfigSet(key, coerced, global) {
|
|
14079
|
+
assertNotGlobalOnly(key, global);
|
|
14080
|
+
const raw = global ? loadGlobalConfigRaw() : loadProjectConfig();
|
|
14081
|
+
const updated = setNestedValue(raw, key, coerced);
|
|
14082
|
+
validateConfig(updated, key);
|
|
14083
|
+
if (global) {
|
|
14084
|
+
saveGlobalConfig(updated);
|
|
14085
|
+
return "global";
|
|
14086
|
+
}
|
|
14087
|
+
saveConfig(updated);
|
|
14088
|
+
return "project";
|
|
14089
|
+
}
|
|
14090
|
+
function assertNotGlobalOnly(key, global) {
|
|
14091
|
+
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
14092
|
+
console.error(
|
|
14093
|
+
chalk126.red(
|
|
14094
|
+
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
14095
|
+
)
|
|
14096
|
+
);
|
|
14097
|
+
process.exit(1);
|
|
14098
|
+
}
|
|
14099
|
+
}
|
|
14100
|
+
|
|
14101
|
+
// src/shared/resolveNamedRepoWriteLabel.ts
|
|
14102
|
+
var UnknownRepoConfigError = class extends Error {
|
|
14103
|
+
name = "UnknownRepoConfigError";
|
|
14104
|
+
};
|
|
14105
|
+
function resolveNamedRepoWriteLabel(globalRaw, name) {
|
|
14106
|
+
const repos2 = globalRaw.repos;
|
|
14107
|
+
const entries = repos2 && typeof repos2 === "object" && !Array.isArray(repos2) ? repos2 : {};
|
|
14108
|
+
const candidates = originKeyCandidates(name);
|
|
14109
|
+
const matches = Object.keys(entries).filter((key) => candidates.has(key));
|
|
14110
|
+
if (matches.length === 0) {
|
|
14111
|
+
throw new UnknownRepoConfigError(
|
|
14112
|
+
`No repo in ~/.assist.yml matches "${name}". Use an existing repos key (full origin, org/repo, or bare repo name).`
|
|
14113
|
+
);
|
|
14114
|
+
}
|
|
14115
|
+
if (matches.length > 1) {
|
|
14116
|
+
throw new AmbiguousRepoConfigError(
|
|
14117
|
+
`Ambiguous repos config in ~/.assist.yml: keys ${matches.map((m) => `"${m}"`).join(", ")} all match "${name}". Keep a single key per repository.`
|
|
14118
|
+
);
|
|
14119
|
+
}
|
|
14120
|
+
return matches[0];
|
|
14121
|
+
}
|
|
14122
|
+
|
|
14073
14123
|
// src/commands/config/applyRepoConfigSet.ts
|
|
14074
|
-
function applyRepoConfigSet(key, coerced) {
|
|
14124
|
+
function applyRepoConfigSet(key, coerced, repoName) {
|
|
14075
14125
|
const globalRaw = loadGlobalConfigRaw();
|
|
14076
|
-
const label2 = resolveRepoWriteLabel(
|
|
14077
|
-
globalRaw,
|
|
14078
|
-
getCurrentOrigin(process.cwd())
|
|
14079
|
-
);
|
|
14126
|
+
const label2 = repoName === void 0 ? resolveRepoWriteLabel(globalRaw, getCurrentOrigin(process.cwd())) : resolveNamedRepoWriteLabel(globalRaw, repoName);
|
|
14080
14127
|
const repos2 = isPlainObject2(globalRaw.repos) ? { ...globalRaw.repos } : {};
|
|
14081
14128
|
const existingBlock = isPlainObject2(repos2[label2]) ? repos2[label2] : {};
|
|
14082
14129
|
const updatedBlock = setNestedValue(existingBlock, key, coerced);
|
|
@@ -14089,17 +14136,32 @@ function isPlainObject2(value) {
|
|
|
14089
14136
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
14090
14137
|
}
|
|
14091
14138
|
|
|
14139
|
+
// src/commands/config/resolveRepoTarget.ts
|
|
14140
|
+
function resolveRepoTarget(key, value, repo) {
|
|
14141
|
+
if (typeof repo === "string") {
|
|
14142
|
+
if (value === void 0) {
|
|
14143
|
+
return { key: repo, value: key, useRepo: true, repoName: void 0 };
|
|
14144
|
+
}
|
|
14145
|
+
return { key, value, useRepo: true, repoName: repo };
|
|
14146
|
+
}
|
|
14147
|
+
return { key, value, useRepo: repo === true, repoName: void 0 };
|
|
14148
|
+
}
|
|
14149
|
+
|
|
14092
14150
|
// src/commands/config/configSet.ts
|
|
14093
|
-
var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
14094
14151
|
function configSet(key, value, options2 = {}) {
|
|
14095
|
-
|
|
14096
|
-
|
|
14097
|
-
|
|
14152
|
+
if (options2.repo !== void 0 && options2.global) {
|
|
14153
|
+
console.error(chalk127.red("Use either --repo or --global, not both"));
|
|
14154
|
+
process.exit(1);
|
|
14155
|
+
}
|
|
14156
|
+
const resolved = resolveRepoTarget(key, value, options2.repo);
|
|
14157
|
+
if (resolved.value === void 0) {
|
|
14158
|
+
console.error(chalk127.red(`Missing required argument for '${resolved.key}'`));
|
|
14098
14159
|
process.exit(1);
|
|
14099
14160
|
}
|
|
14100
|
-
const
|
|
14161
|
+
const coerced = coerceValue(resolved.value);
|
|
14162
|
+
const target = resolved.useRepo ? `repo: ${applyRepoConfigSet(resolved.key, coerced, resolved.repoName)}` : applyConfigSet(resolved.key, coerced, options2.global ?? false);
|
|
14101
14163
|
console.log(
|
|
14102
|
-
|
|
14164
|
+
chalk127.green(`Set ${resolved.key} = ${JSON.stringify(coerced)} (${target})`)
|
|
14103
14165
|
);
|
|
14104
14166
|
}
|
|
14105
14167
|
function coerceValue(value) {
|
|
@@ -14107,75 +14169,53 @@ function coerceValue(value) {
|
|
|
14107
14169
|
if (value === "false") return false;
|
|
14108
14170
|
return value;
|
|
14109
14171
|
}
|
|
14110
|
-
function applyConfigSet(key, coerced, global) {
|
|
14111
|
-
assertNotGlobalOnly(key, global);
|
|
14112
|
-
const raw = global ? loadGlobalConfigRaw() : loadProjectConfig();
|
|
14113
|
-
const updated = setNestedValue(raw, key, coerced);
|
|
14114
|
-
validateConfig(updated, key);
|
|
14115
|
-
if (global) {
|
|
14116
|
-
saveGlobalConfig(updated);
|
|
14117
|
-
return "global";
|
|
14118
|
-
}
|
|
14119
|
-
saveConfig(updated);
|
|
14120
|
-
return "project";
|
|
14121
|
-
}
|
|
14122
|
-
function assertNotGlobalOnly(key, global) {
|
|
14123
|
-
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
14124
|
-
console.error(
|
|
14125
|
-
chalk126.red(
|
|
14126
|
-
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
14127
|
-
)
|
|
14128
|
-
);
|
|
14129
|
-
process.exit(1);
|
|
14130
|
-
}
|
|
14131
|
-
}
|
|
14132
14172
|
|
|
14133
14173
|
// src/commands/registerConfig.ts
|
|
14134
14174
|
function registerConfig(program2) {
|
|
14135
14175
|
const configCommand = program2.command("config").description("View and modify assist.yml configuration");
|
|
14136
|
-
configCommand.command("set <key>
|
|
14137
|
-
"-r, --repo",
|
|
14138
|
-
"Write to ~/.assist.yml under
|
|
14176
|
+
configCommand.command("set <key> [value]").description("Set a config value (e.g. commit.push true)").option("-g, --global", "Write to global ~/.assist.yml").option(
|
|
14177
|
+
"-r, --repo [name]",
|
|
14178
|
+
"Write to ~/.assist.yml under a repo's identity (defaults to the current repo)"
|
|
14139
14179
|
).action((key, value, options2) => configSet(key, value, options2));
|
|
14140
14180
|
configCommand.command("get <key>").description("Get a config value").action(configGet);
|
|
14141
14181
|
configCommand.command("list").description("List all config values").action(configList);
|
|
14142
14182
|
}
|
|
14143
14183
|
|
|
14144
14184
|
// src/commands/db/reportMigrationStatus.ts
|
|
14145
|
-
import
|
|
14185
|
+
import chalk128 from "chalk";
|
|
14146
14186
|
function reportApplied(applied) {
|
|
14147
14187
|
if (applied.length === 0) {
|
|
14148
|
-
console.error(
|
|
14188
|
+
console.error(chalk128.green("Database is up to date; nothing to apply."));
|
|
14149
14189
|
return;
|
|
14150
14190
|
}
|
|
14151
14191
|
for (const migration of applied) {
|
|
14152
14192
|
console.error(
|
|
14153
|
-
|
|
14193
|
+
chalk128.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
14154
14194
|
);
|
|
14155
14195
|
}
|
|
14156
14196
|
}
|
|
14157
14197
|
function reportMigrationStatus(status3) {
|
|
14158
14198
|
if (status3.state === "in-sync") {
|
|
14159
14199
|
console.error(
|
|
14160
|
-
|
|
14200
|
+
chalk128.green(`In sync at migration ${status3.version} (latest).`)
|
|
14161
14201
|
);
|
|
14162
14202
|
return;
|
|
14163
14203
|
}
|
|
14164
14204
|
if (status3.state === "behind") {
|
|
14165
14205
|
console.error(
|
|
14166
|
-
|
|
14206
|
+
chalk128.yellow(
|
|
14167
14207
|
`Behind: applied ${status3.applied}, build expects ${status3.expected}.`
|
|
14168
14208
|
)
|
|
14169
14209
|
);
|
|
14170
14210
|
console.error(
|
|
14171
|
-
|
|
14211
|
+
chalk128.yellow(
|
|
14172
14212
|
`Pending: ${status3.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
14173
14213
|
)
|
|
14174
14214
|
);
|
|
14175
14215
|
return;
|
|
14176
14216
|
}
|
|
14177
14217
|
console.error(
|
|
14178
|
-
|
|
14218
|
+
chalk128.red(
|
|
14179
14219
|
`Ahead: applied ${status3.applied}, build knows ${status3.expected}. Update assist.`
|
|
14180
14220
|
)
|
|
14181
14221
|
);
|
|
@@ -14210,7 +14250,7 @@ function registerDb(program2) {
|
|
|
14210
14250
|
|
|
14211
14251
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
14212
14252
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs";
|
|
14213
|
-
import
|
|
14253
|
+
import chalk129 from "chalk";
|
|
14214
14254
|
|
|
14215
14255
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
14216
14256
|
import { join as join34 } from "path";
|
|
@@ -14241,7 +14281,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14241
14281
|
sweepRestrictedDir();
|
|
14242
14282
|
const state = readMigrationPinState(pin);
|
|
14243
14283
|
if (!state) {
|
|
14244
|
-
console.error(
|
|
14284
|
+
console.error(chalk129.red(`No pending migration unlock for pin: ${pin}`));
|
|
14245
14285
|
process.exitCode = 1;
|
|
14246
14286
|
return;
|
|
14247
14287
|
}
|
|
@@ -14251,7 +14291,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14251
14291
|
);
|
|
14252
14292
|
unlinkSync9(getMigrationPinPath(pin));
|
|
14253
14293
|
console.log(
|
|
14254
|
-
|
|
14294
|
+
chalk129.green(
|
|
14255
14295
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
14256
14296
|
)
|
|
14257
14297
|
);
|
|
@@ -14260,7 +14300,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14260
14300
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
14261
14301
|
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync27 } from "fs";
|
|
14262
14302
|
import { randomInt as randomInt2 } from "crypto";
|
|
14263
|
-
import
|
|
14303
|
+
import chalk130 from "chalk";
|
|
14264
14304
|
|
|
14265
14305
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
14266
14306
|
function nextMigrationId() {
|
|
@@ -14275,7 +14315,7 @@ function dbMigrationUnlock() {
|
|
|
14275
14315
|
sweepRestrictedDir();
|
|
14276
14316
|
writeFileSync27(getMigrationPinPath(pin), JSON.stringify({ pin, migrationId }));
|
|
14277
14317
|
console.error(
|
|
14278
|
-
|
|
14318
|
+
chalk130.yellow.bold(
|
|
14279
14319
|
"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."
|
|
14280
14320
|
)
|
|
14281
14321
|
);
|
|
@@ -14285,7 +14325,7 @@ function dbMigrationUnlock() {
|
|
|
14285
14325
|
});
|
|
14286
14326
|
if (!delivered) {
|
|
14287
14327
|
console.error(
|
|
14288
|
-
|
|
14328
|
+
chalk130.red(
|
|
14289
14329
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
14290
14330
|
)
|
|
14291
14331
|
);
|
|
@@ -14295,7 +14335,7 @@ function dbMigrationUnlock() {
|
|
|
14295
14335
|
console.log(
|
|
14296
14336
|
`A confirmation pin was sent to your desktop notifications.
|
|
14297
14337
|
To approve creating migration ${migrationId}, run:
|
|
14298
|
-
${
|
|
14338
|
+
${chalk130.cyan(" assist db-migration confirm <PIN>")}
|
|
14299
14339
|
using the pin from that notification.`
|
|
14300
14340
|
);
|
|
14301
14341
|
}
|
|
@@ -14315,7 +14355,7 @@ function registerDbMigration(parent) {
|
|
|
14315
14355
|
|
|
14316
14356
|
// src/commands/deploy/redirect.ts
|
|
14317
14357
|
import { existsSync as existsSync35, readFileSync as readFileSync29, writeFileSync as writeFileSync28 } from "fs";
|
|
14318
|
-
import
|
|
14358
|
+
import chalk131 from "chalk";
|
|
14319
14359
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
14320
14360
|
if (!window.location.pathname.endsWith('/')) {
|
|
14321
14361
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -14324,23 +14364,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
14324
14364
|
function redirect() {
|
|
14325
14365
|
const indexPath = "index.html";
|
|
14326
14366
|
if (!existsSync35(indexPath)) {
|
|
14327
|
-
console.log(
|
|
14367
|
+
console.log(chalk131.yellow("No index.html found"));
|
|
14328
14368
|
return;
|
|
14329
14369
|
}
|
|
14330
14370
|
const content = readFileSync29(indexPath, "utf8");
|
|
14331
14371
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
14332
|
-
console.log(
|
|
14372
|
+
console.log(chalk131.dim("Trailing slash script already present"));
|
|
14333
14373
|
return;
|
|
14334
14374
|
}
|
|
14335
14375
|
const headCloseIndex = content.indexOf("</head>");
|
|
14336
14376
|
if (headCloseIndex === -1) {
|
|
14337
|
-
console.log(
|
|
14377
|
+
console.log(chalk131.red("Could not find </head> tag in index.html"));
|
|
14338
14378
|
return;
|
|
14339
14379
|
}
|
|
14340
14380
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
14341
14381
|
${content.slice(headCloseIndex)}`;
|
|
14342
14382
|
writeFileSync28(indexPath, newContent);
|
|
14343
|
-
console.log(
|
|
14383
|
+
console.log(chalk131.green("Added trailing slash redirect to index.html"));
|
|
14344
14384
|
}
|
|
14345
14385
|
|
|
14346
14386
|
// src/commands/registerDeploy.ts
|
|
@@ -14367,7 +14407,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
14367
14407
|
|
|
14368
14408
|
// src/commands/devlog/shared.ts
|
|
14369
14409
|
import { execSync as execSync33 } from "child_process";
|
|
14370
|
-
import
|
|
14410
|
+
import chalk132 from "chalk";
|
|
14371
14411
|
|
|
14372
14412
|
// src/shared/getRepoName.ts
|
|
14373
14413
|
import { existsSync as existsSync36, readFileSync as readFileSync30 } from "fs";
|
|
@@ -14476,13 +14516,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
14476
14516
|
}
|
|
14477
14517
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
14478
14518
|
for (const commit2 of commits2) {
|
|
14479
|
-
console.log(` ${
|
|
14519
|
+
console.log(` ${chalk132.yellow(commit2.hash)} ${commit2.message}`);
|
|
14480
14520
|
if (verbose) {
|
|
14481
14521
|
const visibleFiles = commit2.files.filter(
|
|
14482
14522
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
14483
14523
|
);
|
|
14484
14524
|
for (const file of visibleFiles) {
|
|
14485
|
-
console.log(` ${
|
|
14525
|
+
console.log(` ${chalk132.dim(file)}`);
|
|
14486
14526
|
}
|
|
14487
14527
|
}
|
|
14488
14528
|
}
|
|
@@ -14507,15 +14547,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
14507
14547
|
}
|
|
14508
14548
|
|
|
14509
14549
|
// src/commands/devlog/list/printDateHeader.ts
|
|
14510
|
-
import
|
|
14550
|
+
import chalk133 from "chalk";
|
|
14511
14551
|
function printDateHeader(date, isSkipped, entries) {
|
|
14512
14552
|
if (isSkipped) {
|
|
14513
|
-
console.log(`${
|
|
14553
|
+
console.log(`${chalk133.bold.blue(date)} ${chalk133.dim("skipped")}`);
|
|
14514
14554
|
} else if (entries && entries.length > 0) {
|
|
14515
|
-
const entryInfo = entries.map((e) => `${
|
|
14516
|
-
console.log(`${
|
|
14555
|
+
const entryInfo = entries.map((e) => `${chalk133.green(e.version)} ${e.title}`).join(" | ");
|
|
14556
|
+
console.log(`${chalk133.bold.blue(date)} ${entryInfo}`);
|
|
14517
14557
|
} else {
|
|
14518
|
-
console.log(`${
|
|
14558
|
+
console.log(`${chalk133.bold.blue(date)} ${chalk133.red("\u26A0 devlog missing")}`);
|
|
14519
14559
|
}
|
|
14520
14560
|
}
|
|
14521
14561
|
|
|
@@ -14619,24 +14659,24 @@ function bumpVersion(version2, type) {
|
|
|
14619
14659
|
|
|
14620
14660
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
14621
14661
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
14622
|
-
import
|
|
14662
|
+
import chalk135 from "chalk";
|
|
14623
14663
|
|
|
14624
14664
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
14625
|
-
import
|
|
14665
|
+
import chalk134 from "chalk";
|
|
14626
14666
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
14627
14667
|
if (conventional && firstHash) {
|
|
14628
14668
|
const version2 = getVersionAtCommit(firstHash);
|
|
14629
14669
|
if (version2) {
|
|
14630
|
-
console.log(`${
|
|
14670
|
+
console.log(`${chalk134.bold("version:")} ${stripToMinor(version2)}`);
|
|
14631
14671
|
} else {
|
|
14632
|
-
console.log(`${
|
|
14672
|
+
console.log(`${chalk134.bold("version:")} ${chalk134.red("unknown")}`);
|
|
14633
14673
|
}
|
|
14634
14674
|
} else if (patchVersion && minorVersion) {
|
|
14635
14675
|
console.log(
|
|
14636
|
-
`${
|
|
14676
|
+
`${chalk134.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
14637
14677
|
);
|
|
14638
14678
|
} else {
|
|
14639
|
-
console.log(`${
|
|
14679
|
+
console.log(`${chalk134.bold("version:")} v0.1 (initial)`);
|
|
14640
14680
|
}
|
|
14641
14681
|
}
|
|
14642
14682
|
|
|
@@ -14684,16 +14724,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
14684
14724
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
14685
14725
|
}
|
|
14686
14726
|
function logName(repoName) {
|
|
14687
|
-
console.log(`${
|
|
14727
|
+
console.log(`${chalk135.bold("name:")} ${repoName}`);
|
|
14688
14728
|
}
|
|
14689
14729
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
14690
14730
|
logName(ctx.repoName);
|
|
14691
14731
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
14692
|
-
console.log(
|
|
14732
|
+
console.log(chalk135.bold.blue(targetDate));
|
|
14693
14733
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
14694
14734
|
}
|
|
14695
14735
|
function logNoCommits(lastInfo) {
|
|
14696
|
-
console.log(
|
|
14736
|
+
console.log(chalk135.dim(noCommitsMessage(!!lastInfo)));
|
|
14697
14737
|
}
|
|
14698
14738
|
|
|
14699
14739
|
// src/commands/devlog/next/index.ts
|
|
@@ -14734,11 +14774,11 @@ function next2(options2) {
|
|
|
14734
14774
|
import { execSync as execSync35 } from "child_process";
|
|
14735
14775
|
|
|
14736
14776
|
// src/commands/devlog/repos/printReposTable.ts
|
|
14737
|
-
import
|
|
14777
|
+
import chalk136 from "chalk";
|
|
14738
14778
|
function colorStatus(status3) {
|
|
14739
|
-
if (status3 === "missing") return
|
|
14740
|
-
if (status3 === "outdated") return
|
|
14741
|
-
return
|
|
14779
|
+
if (status3 === "missing") return chalk136.red(status3);
|
|
14780
|
+
if (status3 === "outdated") return chalk136.yellow(status3);
|
|
14781
|
+
return chalk136.green(status3);
|
|
14742
14782
|
}
|
|
14743
14783
|
function formatRow(row, nameWidth) {
|
|
14744
14784
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -14752,8 +14792,8 @@ function printReposTable(rows) {
|
|
|
14752
14792
|
"Last Devlog".padEnd(11),
|
|
14753
14793
|
"Status"
|
|
14754
14794
|
].join(" ");
|
|
14755
|
-
console.log(
|
|
14756
|
-
console.log(
|
|
14795
|
+
console.log(chalk136.dim(header));
|
|
14796
|
+
console.log(chalk136.dim("-".repeat(header.length)));
|
|
14757
14797
|
for (const row of rows) {
|
|
14758
14798
|
console.log(formatRow(row, nameWidth));
|
|
14759
14799
|
}
|
|
@@ -14811,14 +14851,14 @@ function repos(options2) {
|
|
|
14811
14851
|
// src/commands/devlog/skip.ts
|
|
14812
14852
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
14813
14853
|
import { join as join38 } from "path";
|
|
14814
|
-
import
|
|
14854
|
+
import chalk137 from "chalk";
|
|
14815
14855
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
14816
14856
|
function getBlogConfigPath() {
|
|
14817
14857
|
return join38(BLOG_REPO_ROOT, "assist.yml");
|
|
14818
14858
|
}
|
|
14819
14859
|
function skip(date) {
|
|
14820
14860
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
14821
|
-
console.log(
|
|
14861
|
+
console.log(chalk137.red("Invalid date format. Use YYYY-MM-DD"));
|
|
14822
14862
|
process.exit(1);
|
|
14823
14863
|
}
|
|
14824
14864
|
const repoName = getRepoName();
|
|
@@ -14829,7 +14869,7 @@ function skip(date) {
|
|
|
14829
14869
|
const skipDays = skip2[repoName] ?? [];
|
|
14830
14870
|
if (skipDays.includes(date)) {
|
|
14831
14871
|
console.log(
|
|
14832
|
-
|
|
14872
|
+
chalk137.yellow(`${date} is already in skip list for ${repoName}`)
|
|
14833
14873
|
);
|
|
14834
14874
|
return;
|
|
14835
14875
|
}
|
|
@@ -14839,20 +14879,20 @@ function skip(date) {
|
|
|
14839
14879
|
devlog.skip = skip2;
|
|
14840
14880
|
config.devlog = devlog;
|
|
14841
14881
|
writeFileSync29(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
14842
|
-
console.log(
|
|
14882
|
+
console.log(chalk137.green(`Added ${date} to skip list for ${repoName}`));
|
|
14843
14883
|
}
|
|
14844
14884
|
|
|
14845
14885
|
// src/commands/devlog/version.ts
|
|
14846
|
-
import
|
|
14886
|
+
import chalk138 from "chalk";
|
|
14847
14887
|
function version() {
|
|
14848
14888
|
const config = loadConfig();
|
|
14849
14889
|
const name = getRepoName();
|
|
14850
14890
|
const lastInfo = getLastVersionInfo(name, config);
|
|
14851
14891
|
const lastVersion = lastInfo?.version ?? null;
|
|
14852
14892
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
14853
|
-
console.log(`${
|
|
14854
|
-
console.log(`${
|
|
14855
|
-
console.log(`${
|
|
14893
|
+
console.log(`${chalk138.bold("name:")} ${name}`);
|
|
14894
|
+
console.log(`${chalk138.bold("last:")} ${lastVersion ?? chalk138.dim("none")}`);
|
|
14895
|
+
console.log(`${chalk138.bold("next:")} ${nextVersion ?? chalk138.dim("none")}`);
|
|
14856
14896
|
}
|
|
14857
14897
|
|
|
14858
14898
|
// src/commands/devlog/devlogConfigHelp.ts
|
|
@@ -14896,7 +14936,7 @@ function registerDevlog(program2) {
|
|
|
14896
14936
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
14897
14937
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync5 } from "fs";
|
|
14898
14938
|
import { join as join39 } from "path";
|
|
14899
|
-
import
|
|
14939
|
+
import chalk139 from "chalk";
|
|
14900
14940
|
|
|
14901
14941
|
// src/shared/findRepoRoot.ts
|
|
14902
14942
|
import { existsSync as existsSync37 } from "fs";
|
|
@@ -14959,14 +14999,14 @@ function checkBuildLocks(startDir) {
|
|
|
14959
14999
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
14960
15000
|
if (locked) {
|
|
14961
15001
|
console.error(
|
|
14962
|
-
|
|
15002
|
+
chalk139.red("Build output locked (is VS debugging?): ") + locked
|
|
14963
15003
|
);
|
|
14964
15004
|
process.exit(1);
|
|
14965
15005
|
}
|
|
14966
15006
|
}
|
|
14967
15007
|
async function checkBuildLocksCommand() {
|
|
14968
15008
|
checkBuildLocks();
|
|
14969
|
-
console.log(
|
|
15009
|
+
console.log(chalk139.green("No build locks detected"));
|
|
14970
15010
|
}
|
|
14971
15011
|
|
|
14972
15012
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -15065,30 +15105,30 @@ function escapeRegex(s) {
|
|
|
15065
15105
|
}
|
|
15066
15106
|
|
|
15067
15107
|
// src/commands/dotnet/printTree.ts
|
|
15068
|
-
import
|
|
15108
|
+
import chalk140 from "chalk";
|
|
15069
15109
|
function printNodes(nodes, prefix2) {
|
|
15070
15110
|
for (let i = 0; i < nodes.length; i++) {
|
|
15071
15111
|
const isLast = i === nodes.length - 1;
|
|
15072
15112
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
15073
15113
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
15074
15114
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
15075
|
-
const label2 = isMissing ?
|
|
15115
|
+
const label2 = isMissing ? chalk140.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
15076
15116
|
console.log(`${prefix2}${connector}${label2}`);
|
|
15077
15117
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
15078
15118
|
}
|
|
15079
15119
|
}
|
|
15080
15120
|
function printTree(tree, totalCount, solutions) {
|
|
15081
|
-
console.log(
|
|
15082
|
-
console.log(
|
|
15121
|
+
console.log(chalk140.bold("\nProject Dependency Tree"));
|
|
15122
|
+
console.log(chalk140.cyan(tree.relativePath));
|
|
15083
15123
|
printNodes(tree.children, "");
|
|
15084
|
-
console.log(
|
|
15124
|
+
console.log(chalk140.dim(`
|
|
15085
15125
|
${totalCount} projects total (including root)`));
|
|
15086
|
-
console.log(
|
|
15126
|
+
console.log(chalk140.bold("\nSolution Membership"));
|
|
15087
15127
|
if (solutions.length === 0) {
|
|
15088
|
-
console.log(
|
|
15128
|
+
console.log(chalk140.yellow(" Not found in any .sln"));
|
|
15089
15129
|
} else {
|
|
15090
15130
|
for (const sln of solutions) {
|
|
15091
|
-
console.log(` ${
|
|
15131
|
+
console.log(` ${chalk140.green(sln)}`);
|
|
15092
15132
|
}
|
|
15093
15133
|
}
|
|
15094
15134
|
console.log();
|
|
@@ -15117,16 +15157,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
15117
15157
|
// src/commands/dotnet/resolveCsproj.ts
|
|
15118
15158
|
import { existsSync as existsSync38 } from "fs";
|
|
15119
15159
|
import path33 from "path";
|
|
15120
|
-
import
|
|
15160
|
+
import chalk141 from "chalk";
|
|
15121
15161
|
function resolveCsproj(csprojPath) {
|
|
15122
15162
|
const resolved = path33.resolve(csprojPath);
|
|
15123
15163
|
if (!existsSync38(resolved)) {
|
|
15124
|
-
console.error(
|
|
15164
|
+
console.error(chalk141.red(`File not found: ${resolved}`));
|
|
15125
15165
|
process.exit(1);
|
|
15126
15166
|
}
|
|
15127
15167
|
const repoRoot = findRepoRoot(path33.dirname(resolved));
|
|
15128
15168
|
if (!repoRoot) {
|
|
15129
|
-
console.error(
|
|
15169
|
+
console.error(chalk141.red("Could not find git repository root"));
|
|
15130
15170
|
process.exit(1);
|
|
15131
15171
|
}
|
|
15132
15172
|
return { resolved, repoRoot };
|
|
@@ -15176,12 +15216,12 @@ function getChangedCsFiles(scope) {
|
|
|
15176
15216
|
}
|
|
15177
15217
|
|
|
15178
15218
|
// src/commands/dotnet/inSln.ts
|
|
15179
|
-
import
|
|
15219
|
+
import chalk142 from "chalk";
|
|
15180
15220
|
async function inSln(csprojPath) {
|
|
15181
15221
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
15182
15222
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
15183
15223
|
if (solutions.length === 0) {
|
|
15184
|
-
console.log(
|
|
15224
|
+
console.log(chalk142.yellow("Not found in any .sln file"));
|
|
15185
15225
|
process.exit(1);
|
|
15186
15226
|
}
|
|
15187
15227
|
for (const sln of solutions) {
|
|
@@ -15190,7 +15230,7 @@ async function inSln(csprojPath) {
|
|
|
15190
15230
|
}
|
|
15191
15231
|
|
|
15192
15232
|
// src/commands/dotnet/inspect.ts
|
|
15193
|
-
import
|
|
15233
|
+
import chalk148 from "chalk";
|
|
15194
15234
|
|
|
15195
15235
|
// src/shared/formatElapsed.ts
|
|
15196
15236
|
function formatElapsed(ms) {
|
|
@@ -15202,12 +15242,12 @@ function formatElapsed(ms) {
|
|
|
15202
15242
|
}
|
|
15203
15243
|
|
|
15204
15244
|
// src/commands/dotnet/displayIssues.ts
|
|
15205
|
-
import
|
|
15245
|
+
import chalk143 from "chalk";
|
|
15206
15246
|
var SEVERITY_COLOR = {
|
|
15207
|
-
ERROR:
|
|
15208
|
-
WARNING:
|
|
15209
|
-
SUGGESTION:
|
|
15210
|
-
HINT:
|
|
15247
|
+
ERROR: chalk143.red,
|
|
15248
|
+
WARNING: chalk143.yellow,
|
|
15249
|
+
SUGGESTION: chalk143.cyan,
|
|
15250
|
+
HINT: chalk143.dim
|
|
15211
15251
|
};
|
|
15212
15252
|
function groupByFile(issues) {
|
|
15213
15253
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -15223,15 +15263,15 @@ function groupByFile(issues) {
|
|
|
15223
15263
|
}
|
|
15224
15264
|
function displayIssues(issues) {
|
|
15225
15265
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
15226
|
-
console.log(
|
|
15266
|
+
console.log(chalk143.bold(file));
|
|
15227
15267
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
15228
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
15268
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk143.white;
|
|
15229
15269
|
console.log(
|
|
15230
|
-
` ${
|
|
15270
|
+
` ${chalk143.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
15231
15271
|
);
|
|
15232
15272
|
}
|
|
15233
15273
|
}
|
|
15234
|
-
console.log(
|
|
15274
|
+
console.log(chalk143.dim(`
|
|
15235
15275
|
${issues.length} issue(s) found`));
|
|
15236
15276
|
}
|
|
15237
15277
|
|
|
@@ -15290,12 +15330,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
15290
15330
|
// src/commands/dotnet/resolveSolution.ts
|
|
15291
15331
|
import { existsSync as existsSync39 } from "fs";
|
|
15292
15332
|
import path34 from "path";
|
|
15293
|
-
import
|
|
15333
|
+
import chalk145 from "chalk";
|
|
15294
15334
|
|
|
15295
15335
|
// src/commands/dotnet/findSolution.ts
|
|
15296
15336
|
import { readdirSync as readdirSync7 } from "fs";
|
|
15297
15337
|
import { dirname as dirname22, join as join40 } from "path";
|
|
15298
|
-
import
|
|
15338
|
+
import chalk144 from "chalk";
|
|
15299
15339
|
function findSlnInDir(dir) {
|
|
15300
15340
|
try {
|
|
15301
15341
|
return readdirSync7(dir).filter((f) => f.endsWith(".sln")).map((f) => join40(dir, f));
|
|
@@ -15311,17 +15351,17 @@ function findSolution() {
|
|
|
15311
15351
|
const slnFiles = findSlnInDir(current);
|
|
15312
15352
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
15313
15353
|
if (slnFiles.length > 1) {
|
|
15314
|
-
console.error(
|
|
15354
|
+
console.error(chalk144.red(`Multiple .sln files found in ${current}:`));
|
|
15315
15355
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
15316
15356
|
console.error(
|
|
15317
|
-
|
|
15357
|
+
chalk144.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
15318
15358
|
);
|
|
15319
15359
|
process.exit(1);
|
|
15320
15360
|
}
|
|
15321
15361
|
if (current === ceiling) break;
|
|
15322
15362
|
current = dirname22(current);
|
|
15323
15363
|
}
|
|
15324
|
-
console.error(
|
|
15364
|
+
console.error(chalk144.red("No .sln file found between cwd and repo root"));
|
|
15325
15365
|
process.exit(1);
|
|
15326
15366
|
}
|
|
15327
15367
|
|
|
@@ -15330,7 +15370,7 @@ function resolveSolution(sln) {
|
|
|
15330
15370
|
if (sln) {
|
|
15331
15371
|
const resolved = path34.resolve(sln);
|
|
15332
15372
|
if (!existsSync39(resolved)) {
|
|
15333
|
-
console.error(
|
|
15373
|
+
console.error(chalk145.red(`Solution file not found: ${resolved}`));
|
|
15334
15374
|
process.exit(1);
|
|
15335
15375
|
}
|
|
15336
15376
|
return resolved;
|
|
@@ -15372,14 +15412,14 @@ import { execSync as execSync37 } from "child_process";
|
|
|
15372
15412
|
import { existsSync as existsSync40, readFileSync as readFileSync34, unlinkSync as unlinkSync10 } from "fs";
|
|
15373
15413
|
import { tmpdir as tmpdir3 } from "os";
|
|
15374
15414
|
import path35 from "path";
|
|
15375
|
-
import
|
|
15415
|
+
import chalk146 from "chalk";
|
|
15376
15416
|
function assertJbInstalled() {
|
|
15377
15417
|
try {
|
|
15378
15418
|
execSync37("jb inspectcode --version", { stdio: "pipe" });
|
|
15379
15419
|
} catch {
|
|
15380
|
-
console.error(
|
|
15420
|
+
console.error(chalk146.red("jb is not installed. Install with:"));
|
|
15381
15421
|
console.error(
|
|
15382
|
-
|
|
15422
|
+
chalk146.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
15383
15423
|
);
|
|
15384
15424
|
process.exit(1);
|
|
15385
15425
|
}
|
|
@@ -15397,11 +15437,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
15397
15437
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
15398
15438
|
process.stderr.write(error.stderr);
|
|
15399
15439
|
}
|
|
15400
|
-
console.error(
|
|
15440
|
+
console.error(chalk146.red("jb inspectcode failed"));
|
|
15401
15441
|
process.exit(1);
|
|
15402
15442
|
}
|
|
15403
15443
|
if (!existsSync40(reportPath)) {
|
|
15404
|
-
console.error(
|
|
15444
|
+
console.error(chalk146.red("Report file not generated"));
|
|
15405
15445
|
process.exit(1);
|
|
15406
15446
|
}
|
|
15407
15447
|
const xml = readFileSync34(reportPath, "utf8");
|
|
@@ -15411,7 +15451,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
15411
15451
|
|
|
15412
15452
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
15413
15453
|
import { execSync as execSync38 } from "child_process";
|
|
15414
|
-
import
|
|
15454
|
+
import chalk147 from "chalk";
|
|
15415
15455
|
function resolveMsbuildPath() {
|
|
15416
15456
|
const { run: run4 } = loadConfig();
|
|
15417
15457
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -15423,9 +15463,9 @@ function assertMsbuildInstalled() {
|
|
|
15423
15463
|
try {
|
|
15424
15464
|
execSync38(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
15425
15465
|
} catch {
|
|
15426
|
-
console.error(
|
|
15466
|
+
console.error(chalk147.red(`msbuild not found at: ${msbuild}`));
|
|
15427
15467
|
console.error(
|
|
15428
|
-
|
|
15468
|
+
chalk147.yellow(
|
|
15429
15469
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
15430
15470
|
)
|
|
15431
15471
|
);
|
|
@@ -15472,17 +15512,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
15472
15512
|
// src/commands/dotnet/inspect.ts
|
|
15473
15513
|
function logScope(changedFiles) {
|
|
15474
15514
|
if (changedFiles === null) {
|
|
15475
|
-
console.log(
|
|
15515
|
+
console.log(chalk148.dim("Inspecting full solution..."));
|
|
15476
15516
|
} else {
|
|
15477
15517
|
console.log(
|
|
15478
|
-
|
|
15518
|
+
chalk148.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
15479
15519
|
);
|
|
15480
15520
|
}
|
|
15481
15521
|
}
|
|
15482
15522
|
function reportResults(issues, elapsed) {
|
|
15483
15523
|
if (issues.length > 0) displayIssues(issues);
|
|
15484
|
-
else console.log(
|
|
15485
|
-
console.log(
|
|
15524
|
+
else console.log(chalk148.green("No issues found"));
|
|
15525
|
+
console.log(chalk148.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
15486
15526
|
if (issues.length > 0) process.exit(1);
|
|
15487
15527
|
}
|
|
15488
15528
|
async function inspect(sln, options2) {
|
|
@@ -15493,7 +15533,7 @@ async function inspect(sln, options2) {
|
|
|
15493
15533
|
const scope = parseScope(options2.scope);
|
|
15494
15534
|
const changedFiles = getChangedCsFiles(scope);
|
|
15495
15535
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
15496
|
-
console.log(
|
|
15536
|
+
console.log(chalk148.green("No changed .cs files found"));
|
|
15497
15537
|
return;
|
|
15498
15538
|
}
|
|
15499
15539
|
logScope(changedFiles);
|
|
@@ -15876,25 +15916,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
15876
15916
|
}
|
|
15877
15917
|
|
|
15878
15918
|
// src/commands/github/printCountTable.ts
|
|
15879
|
-
import
|
|
15919
|
+
import chalk149 from "chalk";
|
|
15880
15920
|
function printCountTable(labelHeader, rows) {
|
|
15881
15921
|
const labelWidth = Math.max(
|
|
15882
15922
|
labelHeader.length,
|
|
15883
15923
|
...rows.map((row) => row.label.length)
|
|
15884
15924
|
);
|
|
15885
15925
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
15886
|
-
console.log(
|
|
15887
|
-
console.log(
|
|
15926
|
+
console.log(chalk149.dim(header));
|
|
15927
|
+
console.log(chalk149.dim("-".repeat(header.length)));
|
|
15888
15928
|
for (const row of rows) {
|
|
15889
15929
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
15890
15930
|
}
|
|
15891
15931
|
}
|
|
15892
15932
|
|
|
15893
15933
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
15894
|
-
import
|
|
15934
|
+
import chalk150 from "chalk";
|
|
15895
15935
|
function printRepoAuthorBreakdown(repos2) {
|
|
15896
15936
|
for (const repo of repos2) {
|
|
15897
|
-
console.log(
|
|
15937
|
+
console.log(chalk150.bold(repo.name));
|
|
15898
15938
|
const authorWidth = Math.max(
|
|
15899
15939
|
0,
|
|
15900
15940
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -16212,7 +16252,7 @@ function registerHandover(program2) {
|
|
|
16212
16252
|
}
|
|
16213
16253
|
|
|
16214
16254
|
// src/commands/jira/acceptanceCriteria.ts
|
|
16215
|
-
import
|
|
16255
|
+
import chalk151 from "chalk";
|
|
16216
16256
|
|
|
16217
16257
|
// src/commands/jira/adfToText.ts
|
|
16218
16258
|
function renderInline(node) {
|
|
@@ -16279,7 +16319,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
16279
16319
|
const parsed = fetchIssue(issueKey, field);
|
|
16280
16320
|
const acValue = parsed?.fields?.[field];
|
|
16281
16321
|
if (!acValue) {
|
|
16282
|
-
console.log(
|
|
16322
|
+
console.log(chalk151.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
16283
16323
|
return;
|
|
16284
16324
|
}
|
|
16285
16325
|
if (typeof acValue === "string") {
|
|
@@ -16345,14 +16385,14 @@ async function jiraAuth() {
|
|
|
16345
16385
|
}
|
|
16346
16386
|
|
|
16347
16387
|
// src/commands/jira/viewIssue.ts
|
|
16348
|
-
import
|
|
16388
|
+
import chalk152 from "chalk";
|
|
16349
16389
|
function viewIssue(issueKey) {
|
|
16350
16390
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
16351
16391
|
const fields = parsed?.fields;
|
|
16352
16392
|
const summary = fields?.summary;
|
|
16353
16393
|
const description = fields?.description;
|
|
16354
16394
|
if (summary) {
|
|
16355
|
-
console.log(
|
|
16395
|
+
console.log(chalk152.bold(summary));
|
|
16356
16396
|
}
|
|
16357
16397
|
if (description) {
|
|
16358
16398
|
if (summary) console.log();
|
|
@@ -16366,7 +16406,7 @@ function viewIssue(issueKey) {
|
|
|
16366
16406
|
}
|
|
16367
16407
|
if (!summary && !description) {
|
|
16368
16408
|
console.log(
|
|
16369
|
-
|
|
16409
|
+
chalk152.yellow(`No summary or description found on ${issueKey}.`)
|
|
16370
16410
|
);
|
|
16371
16411
|
}
|
|
16372
16412
|
}
|
|
@@ -16422,13 +16462,13 @@ function registerRefineLaunch(program2, resumeFlag) {
|
|
|
16422
16462
|
// src/commands/reviewPrComments.ts
|
|
16423
16463
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
16424
16464
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
16425
|
-
import
|
|
16465
|
+
import chalk153 from "chalk";
|
|
16426
16466
|
async function reviewPrComments(number) {
|
|
16427
16467
|
if (number) {
|
|
16428
16468
|
try {
|
|
16429
16469
|
execFileSync5("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
16430
16470
|
} catch {
|
|
16431
|
-
console.error(
|
|
16471
|
+
console.error(chalk153.red(`gh pr checkout ${number} failed; aborting.`));
|
|
16432
16472
|
process.exit(1);
|
|
16433
16473
|
}
|
|
16434
16474
|
}
|
|
@@ -16501,15 +16541,15 @@ function registerList(program2) {
|
|
|
16501
16541
|
// src/commands/mermaid/index.ts
|
|
16502
16542
|
import { mkdirSync as mkdirSync16, readdirSync as readdirSync9 } from "fs";
|
|
16503
16543
|
import { resolve as resolve12 } from "path";
|
|
16504
|
-
import
|
|
16544
|
+
import chalk156 from "chalk";
|
|
16505
16545
|
|
|
16506
16546
|
// src/commands/mermaid/exportFile.ts
|
|
16507
16547
|
import { readFileSync as readFileSync36, writeFileSync as writeFileSync31 } from "fs";
|
|
16508
16548
|
import { basename as basename11, extname, resolve as resolve11 } from "path";
|
|
16509
|
-
import
|
|
16549
|
+
import chalk155 from "chalk";
|
|
16510
16550
|
|
|
16511
16551
|
// src/commands/mermaid/renderBlock.ts
|
|
16512
|
-
import
|
|
16552
|
+
import chalk154 from "chalk";
|
|
16513
16553
|
async function renderBlock(krokiUrl, source) {
|
|
16514
16554
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
16515
16555
|
method: "POST",
|
|
@@ -16518,7 +16558,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
16518
16558
|
});
|
|
16519
16559
|
if (!response.ok) {
|
|
16520
16560
|
console.error(
|
|
16521
|
-
|
|
16561
|
+
chalk154.red(
|
|
16522
16562
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
16523
16563
|
)
|
|
16524
16564
|
);
|
|
@@ -16536,19 +16576,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
16536
16576
|
if (onlyIndex !== void 0) {
|
|
16537
16577
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
16538
16578
|
console.error(
|
|
16539
|
-
|
|
16579
|
+
chalk155.red(
|
|
16540
16580
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
16541
16581
|
)
|
|
16542
16582
|
);
|
|
16543
16583
|
process.exit(1);
|
|
16544
16584
|
}
|
|
16545
16585
|
console.log(
|
|
16546
|
-
|
|
16586
|
+
chalk155.gray(
|
|
16547
16587
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
16548
16588
|
)
|
|
16549
16589
|
);
|
|
16550
16590
|
} else {
|
|
16551
|
-
console.log(
|
|
16591
|
+
console.log(chalk155.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
16552
16592
|
}
|
|
16553
16593
|
for (const [i, source] of blocks.entries()) {
|
|
16554
16594
|
const idx = i + 1;
|
|
@@ -16556,7 +16596,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
16556
16596
|
const outPath = resolve11(outDir, `${stem}-${idx}.svg`);
|
|
16557
16597
|
const svg = await renderBlock(krokiUrl, source);
|
|
16558
16598
|
writeFileSync31(outPath, svg, "utf8");
|
|
16559
|
-
console.log(
|
|
16599
|
+
console.log(chalk155.green(` \u2192 ${outPath}`));
|
|
16560
16600
|
}
|
|
16561
16601
|
}
|
|
16562
16602
|
function extractMermaidBlocks(markdown) {
|
|
@@ -16572,18 +16612,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
16572
16612
|
if (options2.index !== void 0) {
|
|
16573
16613
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
16574
16614
|
console.error(
|
|
16575
|
-
|
|
16615
|
+
chalk156.red(`--index must be a positive integer (got ${options2.index})`)
|
|
16576
16616
|
);
|
|
16577
16617
|
process.exit(1);
|
|
16578
16618
|
}
|
|
16579
16619
|
if (!file) {
|
|
16580
|
-
console.error(
|
|
16620
|
+
console.error(chalk156.red("--index requires a file argument"));
|
|
16581
16621
|
process.exit(1);
|
|
16582
16622
|
}
|
|
16583
16623
|
}
|
|
16584
16624
|
const files = file ? [file] : readdirSync9(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
16585
16625
|
if (files.length === 0) {
|
|
16586
|
-
console.log(
|
|
16626
|
+
console.log(chalk156.gray("No markdown files found in current directory."));
|
|
16587
16627
|
return;
|
|
16588
16628
|
}
|
|
16589
16629
|
for (const f of files) {
|
|
@@ -16616,7 +16656,7 @@ function registerMermaid(program2) {
|
|
|
16616
16656
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
16617
16657
|
import { createServer as createServer2 } from "http";
|
|
16618
16658
|
import { dirname as dirname24 } from "path";
|
|
16619
|
-
import
|
|
16659
|
+
import chalk158 from "chalk";
|
|
16620
16660
|
|
|
16621
16661
|
// src/commands/netcap/corsHeaders.ts
|
|
16622
16662
|
var corsHeaders = {
|
|
@@ -16695,7 +16735,7 @@ function createNetcapHandler(options2) {
|
|
|
16695
16735
|
import { cp, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|
|
16696
16736
|
import { networkInterfaces } from "os";
|
|
16697
16737
|
import { join as join46 } from "path";
|
|
16698
|
-
import
|
|
16738
|
+
import chalk157 from "chalk";
|
|
16699
16739
|
|
|
16700
16740
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
16701
16741
|
import { dirname as dirname23, join as join45 } from "path";
|
|
@@ -16739,7 +16779,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
16739
16779
|
const host = lanIPv4();
|
|
16740
16780
|
if (!host) {
|
|
16741
16781
|
console.log(
|
|
16742
|
-
|
|
16782
|
+
chalk157.yellow("could not determine the WSL IP for the extension")
|
|
16743
16783
|
);
|
|
16744
16784
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
16745
16785
|
return source;
|
|
@@ -16750,7 +16790,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
16750
16790
|
return WSL_WINDOWS_PATH;
|
|
16751
16791
|
} catch {
|
|
16752
16792
|
console.log(
|
|
16753
|
-
|
|
16793
|
+
chalk157.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
16754
16794
|
);
|
|
16755
16795
|
return source;
|
|
16756
16796
|
}
|
|
@@ -16783,30 +16823,30 @@ async function netcap(options2) {
|
|
|
16783
16823
|
let count7 = 0;
|
|
16784
16824
|
const handler = createNetcapHandler({
|
|
16785
16825
|
outPath,
|
|
16786
|
-
onPing: () => console.log(
|
|
16826
|
+
onPing: () => console.log(chalk158.dim("ping from extension")),
|
|
16787
16827
|
onCapture: (entry) => {
|
|
16788
16828
|
count7 += 1;
|
|
16789
16829
|
console.log(
|
|
16790
|
-
|
|
16791
|
-
|
|
16830
|
+
chalk158.green(`captured #${count7}`),
|
|
16831
|
+
chalk158.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
16792
16832
|
);
|
|
16793
16833
|
}
|
|
16794
16834
|
});
|
|
16795
16835
|
const server = createServer2(handler);
|
|
16796
16836
|
server.listen(port, () => {
|
|
16797
16837
|
console.log(
|
|
16798
|
-
|
|
16838
|
+
chalk158.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
16799
16839
|
);
|
|
16800
|
-
console.log(
|
|
16840
|
+
console.log(chalk158.dim(`appending captures to ${outPath}`));
|
|
16801
16841
|
if (filter)
|
|
16802
|
-
console.log(
|
|
16803
|
-
console.log(
|
|
16804
|
-
console.log(
|
|
16842
|
+
console.log(chalk158.dim(`forwarding only URLs matching "${filter}"`));
|
|
16843
|
+
console.log(chalk158.dim(`load the unpacked extension from ${extensionPath}`));
|
|
16844
|
+
console.log(chalk158.dim("press Ctrl-C to stop"));
|
|
16805
16845
|
});
|
|
16806
16846
|
process.on("SIGINT", () => {
|
|
16807
16847
|
server.close();
|
|
16808
16848
|
console.log(
|
|
16809
|
-
|
|
16849
|
+
chalk158.bold(
|
|
16810
16850
|
`
|
|
16811
16851
|
netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
16812
16852
|
)
|
|
@@ -16818,7 +16858,7 @@ netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} t
|
|
|
16818
16858
|
// src/commands/netcap/netcapExtract.ts
|
|
16819
16859
|
import { writeFileSync as writeFileSync32 } from "fs";
|
|
16820
16860
|
import { join as join49 } from "path";
|
|
16821
|
-
import
|
|
16861
|
+
import chalk159 from "chalk";
|
|
16822
16862
|
|
|
16823
16863
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
16824
16864
|
import { readFileSync as readFileSync37 } from "fs";
|
|
@@ -17266,8 +17306,8 @@ function netcapExtract(file) {
|
|
|
17266
17306
|
writeFileSync32(outFile, `${JSON.stringify(posts, null, 2)}
|
|
17267
17307
|
`);
|
|
17268
17308
|
console.log(
|
|
17269
|
-
|
|
17270
|
-
|
|
17309
|
+
chalk159.green(`extracted ${posts.length} posts`),
|
|
17310
|
+
chalk159.dim(`-> ${outFile}`)
|
|
17271
17311
|
);
|
|
17272
17312
|
}
|
|
17273
17313
|
|
|
@@ -17288,7 +17328,7 @@ function registerNetcap(program2) {
|
|
|
17288
17328
|
}
|
|
17289
17329
|
|
|
17290
17330
|
// src/commands/news/add/index.ts
|
|
17291
|
-
import
|
|
17331
|
+
import chalk160 from "chalk";
|
|
17292
17332
|
import enquirer8 from "enquirer";
|
|
17293
17333
|
async function add2(url) {
|
|
17294
17334
|
if (!url) {
|
|
@@ -17310,10 +17350,10 @@ async function add2(url) {
|
|
|
17310
17350
|
const { orm } = await getReady();
|
|
17311
17351
|
const added = await addFeed(orm, url);
|
|
17312
17352
|
if (!added) {
|
|
17313
|
-
console.log(
|
|
17353
|
+
console.log(chalk160.yellow("Feed already exists"));
|
|
17314
17354
|
return;
|
|
17315
17355
|
}
|
|
17316
|
-
console.log(
|
|
17356
|
+
console.log(chalk160.green(`Added feed: ${url}`));
|
|
17317
17357
|
}
|
|
17318
17358
|
|
|
17319
17359
|
// src/commands/registerNews.ts
|
|
@@ -17360,7 +17400,7 @@ function registerPiHook(program2) {
|
|
|
17360
17400
|
}
|
|
17361
17401
|
|
|
17362
17402
|
// src/commands/prompts/printPromptsTable.ts
|
|
17363
|
-
import
|
|
17403
|
+
import chalk161 from "chalk";
|
|
17364
17404
|
function truncate(str, max) {
|
|
17365
17405
|
if (str.length <= max) return str;
|
|
17366
17406
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -17378,14 +17418,14 @@ function printPromptsTable(rows) {
|
|
|
17378
17418
|
"Command".padEnd(commandWidth),
|
|
17379
17419
|
"Repos"
|
|
17380
17420
|
].join(" ");
|
|
17381
|
-
console.log(
|
|
17382
|
-
console.log(
|
|
17421
|
+
console.log(chalk161.dim(header));
|
|
17422
|
+
console.log(chalk161.dim("-".repeat(header.length)));
|
|
17383
17423
|
for (const row of rows) {
|
|
17384
17424
|
const count7 = String(row.count).padStart(countWidth);
|
|
17385
17425
|
const tool = row.tool.padEnd(toolWidth);
|
|
17386
17426
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
17387
17427
|
console.log(
|
|
17388
|
-
`${
|
|
17428
|
+
`${chalk161.yellow(count7)} ${tool} ${command} ${chalk161.dim(row.repos)}`
|
|
17389
17429
|
);
|
|
17390
17430
|
}
|
|
17391
17431
|
}
|
|
@@ -17952,20 +17992,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
17952
17992
|
}
|
|
17953
17993
|
|
|
17954
17994
|
// src/commands/prs/listComments/printComments.ts
|
|
17955
|
-
import
|
|
17995
|
+
import chalk162 from "chalk";
|
|
17956
17996
|
function formatForHuman(comment3) {
|
|
17957
17997
|
if (comment3.type === "review") {
|
|
17958
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
17998
|
+
const stateColor = comment3.state === "APPROVED" ? chalk162.green : comment3.state === "CHANGES_REQUESTED" ? chalk162.red : chalk162.yellow;
|
|
17959
17999
|
return [
|
|
17960
|
-
`${
|
|
18000
|
+
`${chalk162.cyan("Review")} by ${chalk162.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
17961
18001
|
comment3.body,
|
|
17962
18002
|
""
|
|
17963
18003
|
].join("\n");
|
|
17964
18004
|
}
|
|
17965
18005
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
17966
18006
|
return [
|
|
17967
|
-
`${
|
|
17968
|
-
|
|
18007
|
+
`${chalk162.cyan("Line comment")} by ${chalk162.bold(comment3.user)} on ${chalk162.dim(`${comment3.path}${location}`)}`,
|
|
18008
|
+
chalk162.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
17969
18009
|
comment3.body,
|
|
17970
18010
|
""
|
|
17971
18011
|
].join("\n");
|
|
@@ -18055,13 +18095,13 @@ import { execSync as execSync46 } from "child_process";
|
|
|
18055
18095
|
import enquirer9 from "enquirer";
|
|
18056
18096
|
|
|
18057
18097
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
18058
|
-
import
|
|
18098
|
+
import chalk163 from "chalk";
|
|
18059
18099
|
var STATUS_MAP = {
|
|
18060
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
18061
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
18100
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk163.magenta("merged"), date: pr.mergedAt } : null,
|
|
18101
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk163.red("closed"), date: pr.closedAt } : null
|
|
18062
18102
|
};
|
|
18063
18103
|
function defaultStatus(pr) {
|
|
18064
|
-
return { label:
|
|
18104
|
+
return { label: chalk163.green("opened"), date: pr.createdAt };
|
|
18065
18105
|
}
|
|
18066
18106
|
function getStatus2(pr) {
|
|
18067
18107
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -18070,11 +18110,11 @@ function formatDate(dateStr) {
|
|
|
18070
18110
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
18071
18111
|
}
|
|
18072
18112
|
function formatPrHeader(pr, status3) {
|
|
18073
|
-
return `${
|
|
18113
|
+
return `${chalk163.cyan(`#${pr.number}`)} ${pr.title} ${chalk163.dim(`(${pr.author.login},`)} ${status3.label} ${chalk163.dim(`${formatDate(status3.date)})`)}`;
|
|
18074
18114
|
}
|
|
18075
18115
|
function logPrDetails(pr) {
|
|
18076
18116
|
console.log(
|
|
18077
|
-
|
|
18117
|
+
chalk163.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
18078
18118
|
);
|
|
18079
18119
|
console.log();
|
|
18080
18120
|
}
|
|
@@ -18655,10 +18695,10 @@ function registerPrs(program2) {
|
|
|
18655
18695
|
}
|
|
18656
18696
|
|
|
18657
18697
|
// src/commands/ravendb/ravendbAuth.ts
|
|
18658
|
-
import
|
|
18698
|
+
import chalk169 from "chalk";
|
|
18659
18699
|
|
|
18660
18700
|
// src/shared/createConnectionAuth.ts
|
|
18661
|
-
import
|
|
18701
|
+
import chalk164 from "chalk";
|
|
18662
18702
|
function listConnections(connections, format) {
|
|
18663
18703
|
if (connections.length === 0) {
|
|
18664
18704
|
console.log("No connections configured.");
|
|
@@ -18671,7 +18711,7 @@ function listConnections(connections, format) {
|
|
|
18671
18711
|
function removeConnection(connections, name, save) {
|
|
18672
18712
|
const filtered = connections.filter((c) => c.name !== name);
|
|
18673
18713
|
if (filtered.length === connections.length) {
|
|
18674
|
-
console.error(
|
|
18714
|
+
console.error(chalk164.red(`Connection "${name}" not found.`));
|
|
18675
18715
|
process.exit(1);
|
|
18676
18716
|
}
|
|
18677
18717
|
save(filtered);
|
|
@@ -18717,15 +18757,15 @@ function saveConnections(connections) {
|
|
|
18717
18757
|
}
|
|
18718
18758
|
|
|
18719
18759
|
// src/commands/ravendb/promptConnection.ts
|
|
18720
|
-
import
|
|
18760
|
+
import chalk167 from "chalk";
|
|
18721
18761
|
|
|
18722
18762
|
// src/commands/ravendb/selectOpSecret.ts
|
|
18723
|
-
import
|
|
18763
|
+
import chalk166 from "chalk";
|
|
18724
18764
|
import Enquirer2 from "enquirer";
|
|
18725
18765
|
|
|
18726
18766
|
// src/commands/ravendb/searchItems.ts
|
|
18727
18767
|
import { execSync as execSync49 } from "child_process";
|
|
18728
|
-
import
|
|
18768
|
+
import chalk165 from "chalk";
|
|
18729
18769
|
function opExec(args) {
|
|
18730
18770
|
return execSync49(`op ${args}`, {
|
|
18731
18771
|
encoding: "utf8",
|
|
@@ -18738,7 +18778,7 @@ function searchItems(search2) {
|
|
|
18738
18778
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
18739
18779
|
} catch {
|
|
18740
18780
|
console.error(
|
|
18741
|
-
|
|
18781
|
+
chalk165.red(
|
|
18742
18782
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
18743
18783
|
)
|
|
18744
18784
|
);
|
|
@@ -18752,7 +18792,7 @@ function getItemFields(itemId2) {
|
|
|
18752
18792
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
18753
18793
|
return item.fields.filter((f) => f.reference && f.label);
|
|
18754
18794
|
} catch {
|
|
18755
|
-
console.error(
|
|
18795
|
+
console.error(chalk165.red("Failed to get item details from 1Password."));
|
|
18756
18796
|
process.exit(1);
|
|
18757
18797
|
}
|
|
18758
18798
|
}
|
|
@@ -18771,7 +18811,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
18771
18811
|
}).run();
|
|
18772
18812
|
const items2 = searchItems(search2);
|
|
18773
18813
|
if (items2.length === 0) {
|
|
18774
|
-
console.error(
|
|
18814
|
+
console.error(chalk166.red(`No items found matching "${search2}".`));
|
|
18775
18815
|
process.exit(1);
|
|
18776
18816
|
}
|
|
18777
18817
|
const itemId2 = await selectOne(
|
|
@@ -18780,7 +18820,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
18780
18820
|
);
|
|
18781
18821
|
const fields = getItemFields(itemId2);
|
|
18782
18822
|
if (fields.length === 0) {
|
|
18783
|
-
console.error(
|
|
18823
|
+
console.error(chalk166.red("No fields with references found on this item."));
|
|
18784
18824
|
process.exit(1);
|
|
18785
18825
|
}
|
|
18786
18826
|
const ref = await selectOne(
|
|
@@ -18794,7 +18834,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
18794
18834
|
async function promptConnection(existingNames) {
|
|
18795
18835
|
const name = await promptInput("name", "Connection name:");
|
|
18796
18836
|
if (existingNames.includes(name)) {
|
|
18797
|
-
console.error(
|
|
18837
|
+
console.error(chalk167.red(`Connection "${name}" already exists.`));
|
|
18798
18838
|
process.exit(1);
|
|
18799
18839
|
}
|
|
18800
18840
|
const url = await promptInput(
|
|
@@ -18803,22 +18843,22 @@ async function promptConnection(existingNames) {
|
|
|
18803
18843
|
);
|
|
18804
18844
|
const database = await promptInput("database", "Database name:");
|
|
18805
18845
|
if (!name || !url || !database) {
|
|
18806
|
-
console.error(
|
|
18846
|
+
console.error(chalk167.red("All fields are required."));
|
|
18807
18847
|
process.exit(1);
|
|
18808
18848
|
}
|
|
18809
18849
|
const apiKeyRef = await selectOpSecret();
|
|
18810
|
-
console.log(
|
|
18850
|
+
console.log(chalk167.dim(`Using: ${apiKeyRef}`));
|
|
18811
18851
|
return { name, url, database, apiKeyRef };
|
|
18812
18852
|
}
|
|
18813
18853
|
|
|
18814
18854
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
18815
|
-
import
|
|
18855
|
+
import chalk168 from "chalk";
|
|
18816
18856
|
function ravendbSetConnection(name) {
|
|
18817
18857
|
const raw = loadGlobalConfigRaw();
|
|
18818
18858
|
const ravendb = raw.ravendb ?? {};
|
|
18819
18859
|
const connections = ravendb.connections ?? [];
|
|
18820
18860
|
if (!connections.some((c) => c.name === name)) {
|
|
18821
|
-
console.error(
|
|
18861
|
+
console.error(chalk168.red(`Connection "${name}" not found.`));
|
|
18822
18862
|
console.error(
|
|
18823
18863
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
18824
18864
|
);
|
|
@@ -18834,16 +18874,16 @@ function ravendbSetConnection(name) {
|
|
|
18834
18874
|
var ravendbAuth = createConnectionAuth({
|
|
18835
18875
|
load: loadConnections,
|
|
18836
18876
|
save: saveConnections,
|
|
18837
|
-
format: (c) => `${
|
|
18877
|
+
format: (c) => `${chalk169.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
18838
18878
|
promptNew: promptConnection,
|
|
18839
18879
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
18840
18880
|
});
|
|
18841
18881
|
|
|
18842
18882
|
// src/commands/ravendb/ravendbCollections.ts
|
|
18843
|
-
import
|
|
18883
|
+
import chalk173 from "chalk";
|
|
18844
18884
|
|
|
18845
18885
|
// src/commands/ravendb/ravenFetch.ts
|
|
18846
|
-
import
|
|
18886
|
+
import chalk171 from "chalk";
|
|
18847
18887
|
|
|
18848
18888
|
// src/commands/ravendb/getAccessToken.ts
|
|
18849
18889
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -18880,10 +18920,10 @@ ${errorText}`
|
|
|
18880
18920
|
|
|
18881
18921
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
18882
18922
|
import { execSync as execSync50 } from "child_process";
|
|
18883
|
-
import
|
|
18923
|
+
import chalk170 from "chalk";
|
|
18884
18924
|
function resolveOpSecret(reference) {
|
|
18885
18925
|
if (!reference.startsWith("op://")) {
|
|
18886
|
-
console.error(
|
|
18926
|
+
console.error(chalk170.red(`Invalid secret reference: must start with op://`));
|
|
18887
18927
|
process.exit(1);
|
|
18888
18928
|
}
|
|
18889
18929
|
try {
|
|
@@ -18893,7 +18933,7 @@ function resolveOpSecret(reference) {
|
|
|
18893
18933
|
}).trim();
|
|
18894
18934
|
} catch {
|
|
18895
18935
|
console.error(
|
|
18896
|
-
|
|
18936
|
+
chalk170.red(
|
|
18897
18937
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
18898
18938
|
)
|
|
18899
18939
|
);
|
|
@@ -18920,7 +18960,7 @@ async function ravenFetch(connection, path71) {
|
|
|
18920
18960
|
if (!response.ok) {
|
|
18921
18961
|
const body = await response.text();
|
|
18922
18962
|
console.error(
|
|
18923
|
-
|
|
18963
|
+
chalk171.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
18924
18964
|
);
|
|
18925
18965
|
console.error(body.substring(0, 500));
|
|
18926
18966
|
process.exit(1);
|
|
@@ -18929,7 +18969,7 @@ async function ravenFetch(connection, path71) {
|
|
|
18929
18969
|
}
|
|
18930
18970
|
|
|
18931
18971
|
// src/commands/ravendb/resolveConnection.ts
|
|
18932
|
-
import
|
|
18972
|
+
import chalk172 from "chalk";
|
|
18933
18973
|
function loadRavendb() {
|
|
18934
18974
|
const raw = loadGlobalConfigRaw();
|
|
18935
18975
|
const ravendb = raw.ravendb;
|
|
@@ -18943,7 +18983,7 @@ function resolveConnection(name) {
|
|
|
18943
18983
|
const connectionName = name ?? defaultConnection;
|
|
18944
18984
|
if (!connectionName) {
|
|
18945
18985
|
console.error(
|
|
18946
|
-
|
|
18986
|
+
chalk172.red(
|
|
18947
18987
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
18948
18988
|
)
|
|
18949
18989
|
);
|
|
@@ -18951,7 +18991,7 @@ function resolveConnection(name) {
|
|
|
18951
18991
|
}
|
|
18952
18992
|
const connection = connections.find((c) => c.name === connectionName);
|
|
18953
18993
|
if (!connection) {
|
|
18954
|
-
console.error(
|
|
18994
|
+
console.error(chalk172.red(`Connection "${connectionName}" not found.`));
|
|
18955
18995
|
console.error(
|
|
18956
18996
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
18957
18997
|
);
|
|
@@ -18982,7 +19022,7 @@ async function ravendbCollections(connectionName) {
|
|
|
18982
19022
|
return;
|
|
18983
19023
|
}
|
|
18984
19024
|
for (const c of collections) {
|
|
18985
|
-
console.log(`${
|
|
19025
|
+
console.log(`${chalk173.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
18986
19026
|
}
|
|
18987
19027
|
}
|
|
18988
19028
|
|
|
@@ -19001,10 +19041,10 @@ var ravendbConfigHelp = [
|
|
|
19001
19041
|
];
|
|
19002
19042
|
|
|
19003
19043
|
// src/commands/ravendb/ravendbQuery.ts
|
|
19004
|
-
import
|
|
19044
|
+
import chalk175 from "chalk";
|
|
19005
19045
|
|
|
19006
19046
|
// src/commands/ravendb/fetchAllPages.ts
|
|
19007
|
-
import
|
|
19047
|
+
import chalk174 from "chalk";
|
|
19008
19048
|
|
|
19009
19049
|
// src/commands/ravendb/buildQueryPath.ts
|
|
19010
19050
|
function buildQueryPath(opts) {
|
|
@@ -19042,7 +19082,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
19042
19082
|
allResults.push(...results);
|
|
19043
19083
|
start3 += results.length;
|
|
19044
19084
|
process.stderr.write(
|
|
19045
|
-
`\r${
|
|
19085
|
+
`\r${chalk174.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
19046
19086
|
);
|
|
19047
19087
|
if (start3 >= totalResults) break;
|
|
19048
19088
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -19057,7 +19097,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
19057
19097
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
19058
19098
|
const resolved = resolveArgs(connectionName, collection);
|
|
19059
19099
|
if (!resolved.collection && !options2.query) {
|
|
19060
|
-
console.error(
|
|
19100
|
+
console.error(chalk175.red("Provide a collection name or --query filter."));
|
|
19061
19101
|
process.exit(1);
|
|
19062
19102
|
}
|
|
19063
19103
|
const { collection: col } = resolved;
|
|
@@ -19096,7 +19136,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
19096
19136
|
import * as path36 from "path";
|
|
19097
19137
|
|
|
19098
19138
|
// src/commands/refactor/logViolations.ts
|
|
19099
|
-
import
|
|
19139
|
+
import chalk176 from "chalk";
|
|
19100
19140
|
var DEFAULT_MAX_LINES = 100;
|
|
19101
19141
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
19102
19142
|
if (violations.length === 0) {
|
|
@@ -19105,43 +19145,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
19105
19145
|
}
|
|
19106
19146
|
return;
|
|
19107
19147
|
}
|
|
19108
|
-
console.error(
|
|
19148
|
+
console.error(chalk176.red(`
|
|
19109
19149
|
Refactor check failed:
|
|
19110
19150
|
`));
|
|
19111
|
-
console.error(
|
|
19151
|
+
console.error(chalk176.red(` The following files exceed ${maxLines} lines:
|
|
19112
19152
|
`));
|
|
19113
19153
|
for (const violation of violations) {
|
|
19114
|
-
console.error(
|
|
19154
|
+
console.error(chalk176.red(` ${violation.file} (${violation.lines} lines)`));
|
|
19115
19155
|
}
|
|
19116
19156
|
console.error(
|
|
19117
|
-
|
|
19157
|
+
chalk176.yellow(
|
|
19118
19158
|
`
|
|
19119
19159
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
19120
19160
|
way to refactor it, ignore it with:
|
|
19121
19161
|
`
|
|
19122
19162
|
)
|
|
19123
19163
|
);
|
|
19124
|
-
console.error(
|
|
19164
|
+
console.error(chalk176.gray(` assist refactor ignore <file>
|
|
19125
19165
|
`));
|
|
19126
19166
|
if (process.env.CLAUDECODE) {
|
|
19127
|
-
console.error(
|
|
19167
|
+
console.error(chalk176.cyan(`
|
|
19128
19168
|
## Extracting Code to New Files
|
|
19129
19169
|
`));
|
|
19130
19170
|
console.error(
|
|
19131
|
-
|
|
19171
|
+
chalk176.cyan(
|
|
19132
19172
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
19133
19173
|
`
|
|
19134
19174
|
)
|
|
19135
19175
|
);
|
|
19136
19176
|
console.error(
|
|
19137
|
-
|
|
19177
|
+
chalk176.cyan(
|
|
19138
19178
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
19139
19179
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
19140
19180
|
`
|
|
19141
19181
|
)
|
|
19142
19182
|
);
|
|
19143
19183
|
console.error(
|
|
19144
|
-
|
|
19184
|
+
chalk176.cyan(
|
|
19145
19185
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
19146
19186
|
domains, move it to a common/shared folder.
|
|
19147
19187
|
`
|
|
@@ -19297,7 +19337,7 @@ async function check(pattern2, options2) {
|
|
|
19297
19337
|
|
|
19298
19338
|
// src/commands/refactor/extract/index.ts
|
|
19299
19339
|
import path44 from "path";
|
|
19300
|
-
import
|
|
19340
|
+
import chalk179 from "chalk";
|
|
19301
19341
|
|
|
19302
19342
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
19303
19343
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -19896,23 +19936,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
19896
19936
|
|
|
19897
19937
|
// src/commands/refactor/extract/displayPlan.ts
|
|
19898
19938
|
import path40 from "path";
|
|
19899
|
-
import
|
|
19939
|
+
import chalk177 from "chalk";
|
|
19900
19940
|
function section2(title) {
|
|
19901
19941
|
return `
|
|
19902
|
-
${
|
|
19942
|
+
${chalk177.cyan(title)}`;
|
|
19903
19943
|
}
|
|
19904
19944
|
function displayImporters(plan2, cwd) {
|
|
19905
19945
|
if (plan2.importersToUpdate.length === 0) return;
|
|
19906
19946
|
console.log(section2("Update importers:"));
|
|
19907
19947
|
for (const imp of plan2.importersToUpdate) {
|
|
19908
19948
|
const rel = path40.relative(cwd, imp.file.getFilePath());
|
|
19909
|
-
console.log(` ${
|
|
19949
|
+
console.log(` ${chalk177.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
19910
19950
|
}
|
|
19911
19951
|
}
|
|
19912
19952
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
19913
|
-
console.log(
|
|
19953
|
+
console.log(chalk177.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
19914
19954
|
`));
|
|
19915
|
-
console.log(` ${
|
|
19955
|
+
console.log(` ${chalk177.cyan("Functions to move:")}`);
|
|
19916
19956
|
for (const name of plan2.extractedNames) {
|
|
19917
19957
|
console.log(` ${name}`);
|
|
19918
19958
|
}
|
|
@@ -19946,7 +19986,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
19946
19986
|
|
|
19947
19987
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
19948
19988
|
import path43 from "path";
|
|
19949
|
-
import
|
|
19989
|
+
import chalk178 from "chalk";
|
|
19950
19990
|
import { Project as Project4 } from "ts-morph";
|
|
19951
19991
|
|
|
19952
19992
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -20038,7 +20078,7 @@ function loadProjectFile(file) {
|
|
|
20038
20078
|
});
|
|
20039
20079
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
20040
20080
|
if (!sourceFile) {
|
|
20041
|
-
console.log(
|
|
20081
|
+
console.log(chalk178.red(`File not found in project: ${file}`));
|
|
20042
20082
|
process.exit(1);
|
|
20043
20083
|
}
|
|
20044
20084
|
return { project, sourceFile };
|
|
@@ -20061,19 +20101,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
20061
20101
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
20062
20102
|
if (options2.apply) {
|
|
20063
20103
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
20064
|
-
console.log(
|
|
20104
|
+
console.log(chalk179.green("\nExtraction complete"));
|
|
20065
20105
|
} else {
|
|
20066
|
-
console.log(
|
|
20106
|
+
console.log(chalk179.dim("\nDry run. Use --apply to execute."));
|
|
20067
20107
|
}
|
|
20068
20108
|
}
|
|
20069
20109
|
|
|
20070
20110
|
// src/commands/refactor/ignore.ts
|
|
20071
20111
|
import fs28 from "fs";
|
|
20072
|
-
import
|
|
20112
|
+
import chalk180 from "chalk";
|
|
20073
20113
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
20074
20114
|
function ignore2(file) {
|
|
20075
20115
|
if (!fs28.existsSync(file)) {
|
|
20076
|
-
console.error(
|
|
20116
|
+
console.error(chalk180.red(`Error: File does not exist: ${file}`));
|
|
20077
20117
|
process.exit(1);
|
|
20078
20118
|
}
|
|
20079
20119
|
const content = fs28.readFileSync(file, "utf8");
|
|
@@ -20089,7 +20129,7 @@ function ignore2(file) {
|
|
|
20089
20129
|
fs28.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
20090
20130
|
}
|
|
20091
20131
|
console.log(
|
|
20092
|
-
|
|
20132
|
+
chalk180.green(
|
|
20093
20133
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
20094
20134
|
)
|
|
20095
20135
|
);
|
|
@@ -20098,12 +20138,12 @@ function ignore2(file) {
|
|
|
20098
20138
|
// src/commands/refactor/rename/index.ts
|
|
20099
20139
|
import fs31 from "fs";
|
|
20100
20140
|
import path49 from "path";
|
|
20101
|
-
import
|
|
20141
|
+
import chalk183 from "chalk";
|
|
20102
20142
|
|
|
20103
20143
|
// src/commands/refactor/rename/applyRename.ts
|
|
20104
20144
|
import fs30 from "fs";
|
|
20105
20145
|
import path46 from "path";
|
|
20106
|
-
import
|
|
20146
|
+
import chalk181 from "chalk";
|
|
20107
20147
|
|
|
20108
20148
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
20109
20149
|
import path45 from "path";
|
|
@@ -20208,13 +20248,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
20208
20248
|
const updatedContents = applyRewrites(rewrites);
|
|
20209
20249
|
for (const [file, content] of updatedContents) {
|
|
20210
20250
|
fs30.writeFileSync(file, content, "utf8");
|
|
20211
|
-
console.log(
|
|
20251
|
+
console.log(chalk181.cyan(` Updated imports in ${path46.relative(cwd, file)}`));
|
|
20212
20252
|
}
|
|
20213
20253
|
const destDir = path46.dirname(destPath);
|
|
20214
20254
|
if (!fs30.existsSync(destDir)) fs30.mkdirSync(destDir, { recursive: true });
|
|
20215
20255
|
fs30.renameSync(sourcePath, destPath);
|
|
20216
20256
|
console.log(
|
|
20217
|
-
|
|
20257
|
+
chalk181.white(
|
|
20218
20258
|
` Moved ${path46.relative(cwd, sourcePath)} \u2192 ${path46.relative(cwd, destPath)}`
|
|
20219
20259
|
)
|
|
20220
20260
|
);
|
|
@@ -20301,16 +20341,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
20301
20341
|
|
|
20302
20342
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
20303
20343
|
import path48 from "path";
|
|
20304
|
-
import
|
|
20344
|
+
import chalk182 from "chalk";
|
|
20305
20345
|
function printRenamePreview(rewrites, cwd) {
|
|
20306
20346
|
for (const rewrite of rewrites) {
|
|
20307
20347
|
console.log(
|
|
20308
|
-
|
|
20348
|
+
chalk182.dim(
|
|
20309
20349
|
` ${path48.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
20310
20350
|
)
|
|
20311
20351
|
);
|
|
20312
20352
|
}
|
|
20313
|
-
console.log(
|
|
20353
|
+
console.log(chalk182.dim("Dry run. Use --apply to execute."));
|
|
20314
20354
|
}
|
|
20315
20355
|
|
|
20316
20356
|
// src/commands/refactor/rename/index.ts
|
|
@@ -20321,20 +20361,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
20321
20361
|
const relSource = path49.relative(cwd, sourcePath);
|
|
20322
20362
|
const relDest = path49.relative(cwd, destPath);
|
|
20323
20363
|
if (!fs31.existsSync(sourcePath)) {
|
|
20324
|
-
console.log(
|
|
20364
|
+
console.log(chalk183.red(`File not found: ${source}`));
|
|
20325
20365
|
process.exit(1);
|
|
20326
20366
|
}
|
|
20327
20367
|
if (destPath !== sourcePath && fs31.existsSync(destPath)) {
|
|
20328
|
-
console.log(
|
|
20368
|
+
console.log(chalk183.red(`Destination already exists: ${destination}`));
|
|
20329
20369
|
process.exit(1);
|
|
20330
20370
|
}
|
|
20331
|
-
console.log(
|
|
20332
|
-
console.log(
|
|
20333
|
-
console.log(
|
|
20371
|
+
console.log(chalk183.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
20372
|
+
console.log(chalk183.dim("Loading project..."));
|
|
20373
|
+
console.log(chalk183.dim("Scanning imports across the project..."));
|
|
20334
20374
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
20335
20375
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
20336
20376
|
console.log(
|
|
20337
|
-
|
|
20377
|
+
chalk183.dim(
|
|
20338
20378
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
20339
20379
|
)
|
|
20340
20380
|
);
|
|
@@ -20343,11 +20383,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
20343
20383
|
return;
|
|
20344
20384
|
}
|
|
20345
20385
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
20346
|
-
console.log(
|
|
20386
|
+
console.log(chalk183.green("Done"));
|
|
20347
20387
|
}
|
|
20348
20388
|
|
|
20349
20389
|
// src/commands/refactor/renameSymbol/index.ts
|
|
20350
|
-
import
|
|
20390
|
+
import chalk184 from "chalk";
|
|
20351
20391
|
|
|
20352
20392
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
20353
20393
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -20393,33 +20433,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
20393
20433
|
const { project, sourceFile } = loadProjectFile(file);
|
|
20394
20434
|
const symbol = findSymbol(sourceFile, oldName);
|
|
20395
20435
|
if (!symbol) {
|
|
20396
|
-
console.log(
|
|
20436
|
+
console.log(chalk184.red(`Symbol "${oldName}" not found in ${file}`));
|
|
20397
20437
|
process.exit(1);
|
|
20398
20438
|
}
|
|
20399
20439
|
const grouped = groupReferences(symbol, cwd);
|
|
20400
20440
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
20401
20441
|
console.log(
|
|
20402
|
-
|
|
20442
|
+
chalk184.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
20403
20443
|
`)
|
|
20404
20444
|
);
|
|
20405
20445
|
for (const [refFile, lines] of grouped) {
|
|
20406
20446
|
console.log(
|
|
20407
|
-
` ${
|
|
20447
|
+
` ${chalk184.dim(refFile)}: lines ${chalk184.cyan(lines.join(", "))}`
|
|
20408
20448
|
);
|
|
20409
20449
|
}
|
|
20410
20450
|
if (options2.apply) {
|
|
20411
20451
|
symbol.rename(newName);
|
|
20412
20452
|
await project.save();
|
|
20413
|
-
console.log(
|
|
20453
|
+
console.log(chalk184.green(`
|
|
20414
20454
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
20415
20455
|
} else {
|
|
20416
|
-
console.log(
|
|
20456
|
+
console.log(chalk184.dim("\nDry run. Use --apply to execute."));
|
|
20417
20457
|
}
|
|
20418
20458
|
}
|
|
20419
20459
|
|
|
20420
20460
|
// src/commands/refactor/restructure/index.ts
|
|
20421
20461
|
import path57 from "path";
|
|
20422
|
-
import
|
|
20462
|
+
import chalk187 from "chalk";
|
|
20423
20463
|
|
|
20424
20464
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
20425
20465
|
import path51 from "path";
|
|
@@ -20498,50 +20538,50 @@ function clusterFiles(graph) {
|
|
|
20498
20538
|
|
|
20499
20539
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
20500
20540
|
import path53 from "path";
|
|
20501
|
-
import
|
|
20541
|
+
import chalk185 from "chalk";
|
|
20502
20542
|
function relPath(filePath) {
|
|
20503
20543
|
return path53.relative(process.cwd(), filePath);
|
|
20504
20544
|
}
|
|
20505
20545
|
function displayMoves(plan2) {
|
|
20506
20546
|
if (plan2.moves.length === 0) return;
|
|
20507
|
-
console.log(
|
|
20547
|
+
console.log(chalk185.bold("\nFile moves:"));
|
|
20508
20548
|
for (const move2 of plan2.moves) {
|
|
20509
20549
|
console.log(
|
|
20510
|
-
` ${
|
|
20550
|
+
` ${chalk185.red(relPath(move2.from))} \u2192 ${chalk185.green(relPath(move2.to))}`
|
|
20511
20551
|
);
|
|
20512
|
-
console.log(
|
|
20552
|
+
console.log(chalk185.dim(` ${move2.reason}`));
|
|
20513
20553
|
}
|
|
20514
20554
|
}
|
|
20515
20555
|
function displayRewrites(rewrites) {
|
|
20516
20556
|
if (rewrites.length === 0) return;
|
|
20517
20557
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
20518
|
-
console.log(
|
|
20558
|
+
console.log(chalk185.bold(`
|
|
20519
20559
|
Import rewrites (${affectedFiles.size} files):`));
|
|
20520
20560
|
for (const file of affectedFiles) {
|
|
20521
|
-
console.log(` ${
|
|
20561
|
+
console.log(` ${chalk185.cyan(relPath(file))}:`);
|
|
20522
20562
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
20523
20563
|
(r) => r.file === file
|
|
20524
20564
|
)) {
|
|
20525
20565
|
console.log(
|
|
20526
|
-
` ${
|
|
20566
|
+
` ${chalk185.red(`"${oldSpecifier}"`)} \u2192 ${chalk185.green(`"${newSpecifier}"`)}`
|
|
20527
20567
|
);
|
|
20528
20568
|
}
|
|
20529
20569
|
}
|
|
20530
20570
|
}
|
|
20531
20571
|
function displayPlan2(plan2) {
|
|
20532
20572
|
if (plan2.warnings.length > 0) {
|
|
20533
|
-
console.log(
|
|
20534
|
-
for (const w of plan2.warnings) console.log(
|
|
20573
|
+
console.log(chalk185.yellow("\nWarnings:"));
|
|
20574
|
+
for (const w of plan2.warnings) console.log(chalk185.yellow(` ${w}`));
|
|
20535
20575
|
}
|
|
20536
20576
|
if (plan2.newDirectories.length > 0) {
|
|
20537
|
-
console.log(
|
|
20577
|
+
console.log(chalk185.bold("\nNew directories:"));
|
|
20538
20578
|
for (const dir of plan2.newDirectories)
|
|
20539
|
-
console.log(
|
|
20579
|
+
console.log(chalk185.green(` ${dir}/`));
|
|
20540
20580
|
}
|
|
20541
20581
|
displayMoves(plan2);
|
|
20542
20582
|
displayRewrites(plan2.rewrites);
|
|
20543
20583
|
console.log(
|
|
20544
|
-
|
|
20584
|
+
chalk185.dim(
|
|
20545
20585
|
`
|
|
20546
20586
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
20547
20587
|
)
|
|
@@ -20551,18 +20591,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
20551
20591
|
// src/commands/refactor/restructure/executePlan.ts
|
|
20552
20592
|
import fs32 from "fs";
|
|
20553
20593
|
import path54 from "path";
|
|
20554
|
-
import
|
|
20594
|
+
import chalk186 from "chalk";
|
|
20555
20595
|
function executePlan(plan2) {
|
|
20556
20596
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
20557
20597
|
for (const [file, content] of updatedContents) {
|
|
20558
20598
|
fs32.writeFileSync(file, content, "utf8");
|
|
20559
20599
|
console.log(
|
|
20560
|
-
|
|
20600
|
+
chalk186.cyan(` Rewrote imports in ${path54.relative(process.cwd(), file)}`)
|
|
20561
20601
|
);
|
|
20562
20602
|
}
|
|
20563
20603
|
for (const dir of plan2.newDirectories) {
|
|
20564
20604
|
fs32.mkdirSync(dir, { recursive: true });
|
|
20565
|
-
console.log(
|
|
20605
|
+
console.log(chalk186.green(` Created ${path54.relative(process.cwd(), dir)}/`));
|
|
20566
20606
|
}
|
|
20567
20607
|
for (const move2 of plan2.moves) {
|
|
20568
20608
|
const targetDir = path54.dirname(move2.to);
|
|
@@ -20571,7 +20611,7 @@ function executePlan(plan2) {
|
|
|
20571
20611
|
}
|
|
20572
20612
|
fs32.renameSync(move2.from, move2.to);
|
|
20573
20613
|
console.log(
|
|
20574
|
-
|
|
20614
|
+
chalk186.white(
|
|
20575
20615
|
` Moved ${path54.relative(process.cwd(), move2.from)} \u2192 ${path54.relative(process.cwd(), move2.to)}`
|
|
20576
20616
|
)
|
|
20577
20617
|
);
|
|
@@ -20586,7 +20626,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
20586
20626
|
if (entries.length === 0) {
|
|
20587
20627
|
fs32.rmdirSync(dir);
|
|
20588
20628
|
console.log(
|
|
20589
|
-
|
|
20629
|
+
chalk186.dim(
|
|
20590
20630
|
` Removed empty directory ${path54.relative(process.cwd(), dir)}`
|
|
20591
20631
|
)
|
|
20592
20632
|
);
|
|
@@ -20719,22 +20759,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
20719
20759
|
const targetPattern = pattern2 ?? "src";
|
|
20720
20760
|
const files = findSourceFiles2(targetPattern);
|
|
20721
20761
|
if (files.length === 0) {
|
|
20722
|
-
console.log(
|
|
20762
|
+
console.log(chalk187.yellow("No files found matching pattern"));
|
|
20723
20763
|
return;
|
|
20724
20764
|
}
|
|
20725
20765
|
const tsConfigPath = findTsConfig(path57.resolve(files[0]));
|
|
20726
20766
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
20727
20767
|
if (plan2.moves.length === 0) {
|
|
20728
|
-
console.log(
|
|
20768
|
+
console.log(chalk187.green("No restructuring needed"));
|
|
20729
20769
|
return;
|
|
20730
20770
|
}
|
|
20731
20771
|
displayPlan2(plan2);
|
|
20732
20772
|
if (options2.apply) {
|
|
20733
|
-
console.log(
|
|
20773
|
+
console.log(chalk187.bold("\nApplying changes..."));
|
|
20734
20774
|
executePlan(plan2);
|
|
20735
|
-
console.log(
|
|
20775
|
+
console.log(chalk187.green("\nRestructuring complete"));
|
|
20736
20776
|
} else {
|
|
20737
|
-
console.log(
|
|
20777
|
+
console.log(chalk187.dim("\nDry run. Use --apply to execute."));
|
|
20738
20778
|
}
|
|
20739
20779
|
}
|
|
20740
20780
|
|
|
@@ -21317,18 +21357,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
21317
21357
|
}
|
|
21318
21358
|
|
|
21319
21359
|
// src/commands/review/warnOutOfDiff.ts
|
|
21320
|
-
import
|
|
21360
|
+
import chalk188 from "chalk";
|
|
21321
21361
|
function warnOutOfDiff(outOfDiff) {
|
|
21322
21362
|
if (outOfDiff.length === 0) return;
|
|
21323
21363
|
console.warn(
|
|
21324
|
-
|
|
21364
|
+
chalk188.yellow(
|
|
21325
21365
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
21326
21366
|
)
|
|
21327
21367
|
);
|
|
21328
21368
|
for (const finding of outOfDiff) {
|
|
21329
21369
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
21330
21370
|
console.warn(
|
|
21331
|
-
` ${
|
|
21371
|
+
` ${chalk188.yellow("\xB7")} ${finding.title} ${chalk188.dim(
|
|
21332
21372
|
`(${finding.file}:${range})`
|
|
21333
21373
|
)}`
|
|
21334
21374
|
);
|
|
@@ -21347,18 +21387,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
21347
21387
|
}
|
|
21348
21388
|
|
|
21349
21389
|
// src/commands/review/warnUnlocated.ts
|
|
21350
|
-
import
|
|
21390
|
+
import chalk189 from "chalk";
|
|
21351
21391
|
function warnUnlocated(unlocated) {
|
|
21352
21392
|
if (unlocated.length === 0) return;
|
|
21353
21393
|
console.warn(
|
|
21354
|
-
|
|
21394
|
+
chalk189.yellow(
|
|
21355
21395
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
21356
21396
|
)
|
|
21357
21397
|
);
|
|
21358
21398
|
for (const finding of unlocated) {
|
|
21359
|
-
const where = finding.location ||
|
|
21399
|
+
const where = finding.location || chalk189.dim("missing");
|
|
21360
21400
|
console.warn(
|
|
21361
|
-
` ${
|
|
21401
|
+
` ${chalk189.yellow("\xB7")} ${finding.title} ${chalk189.dim(`(${where})`)}`
|
|
21362
21402
|
);
|
|
21363
21403
|
}
|
|
21364
21404
|
}
|
|
@@ -22530,7 +22570,7 @@ function registerReview(program2) {
|
|
|
22530
22570
|
}
|
|
22531
22571
|
|
|
22532
22572
|
// src/commands/seq/seqAuth.ts
|
|
22533
|
-
import
|
|
22573
|
+
import chalk191 from "chalk";
|
|
22534
22574
|
|
|
22535
22575
|
// src/commands/seq/loadConnections.ts
|
|
22536
22576
|
function loadConnections2() {
|
|
@@ -22559,10 +22599,10 @@ function setDefaultConnection(name) {
|
|
|
22559
22599
|
}
|
|
22560
22600
|
|
|
22561
22601
|
// src/shared/assertUniqueName.ts
|
|
22562
|
-
import
|
|
22602
|
+
import chalk190 from "chalk";
|
|
22563
22603
|
function assertUniqueName(existingNames, name) {
|
|
22564
22604
|
if (existingNames.includes(name)) {
|
|
22565
|
-
console.error(
|
|
22605
|
+
console.error(chalk190.red(`Connection "${name}" already exists.`));
|
|
22566
22606
|
process.exit(1);
|
|
22567
22607
|
}
|
|
22568
22608
|
}
|
|
@@ -22580,7 +22620,7 @@ async function promptConnection2(existingNames) {
|
|
|
22580
22620
|
var seqAuth = createConnectionAuth({
|
|
22581
22621
|
load: loadConnections2,
|
|
22582
22622
|
save: saveConnections2,
|
|
22583
|
-
format: (c) => `${
|
|
22623
|
+
format: (c) => `${chalk191.bold(c.name)} ${c.url}`,
|
|
22584
22624
|
promptNew: promptConnection2,
|
|
22585
22625
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
22586
22626
|
});
|
|
@@ -22600,10 +22640,10 @@ var seqConfigHelp = [
|
|
|
22600
22640
|
];
|
|
22601
22641
|
|
|
22602
22642
|
// src/commands/seq/seqQuery.ts
|
|
22603
|
-
import
|
|
22643
|
+
import chalk195 from "chalk";
|
|
22604
22644
|
|
|
22605
22645
|
// src/commands/seq/fetchSeq.ts
|
|
22606
|
-
import
|
|
22646
|
+
import chalk192 from "chalk";
|
|
22607
22647
|
async function fetchSeq(conn, path71, params) {
|
|
22608
22648
|
const url = `${conn.url}${path71}?${params}`;
|
|
22609
22649
|
const response = await fetch(url, {
|
|
@@ -22614,7 +22654,7 @@ async function fetchSeq(conn, path71, params) {
|
|
|
22614
22654
|
});
|
|
22615
22655
|
if (!response.ok) {
|
|
22616
22656
|
const body = await response.text();
|
|
22617
|
-
console.error(
|
|
22657
|
+
console.error(chalk192.red(`Seq returned ${response.status}: ${body}`));
|
|
22618
22658
|
process.exit(1);
|
|
22619
22659
|
}
|
|
22620
22660
|
return response;
|
|
@@ -22673,23 +22713,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
22673
22713
|
}
|
|
22674
22714
|
|
|
22675
22715
|
// src/commands/seq/formatEvent.ts
|
|
22676
|
-
import
|
|
22716
|
+
import chalk193 from "chalk";
|
|
22677
22717
|
function levelColor(level) {
|
|
22678
22718
|
switch (level) {
|
|
22679
22719
|
case "Fatal":
|
|
22680
|
-
return
|
|
22720
|
+
return chalk193.bgRed.white;
|
|
22681
22721
|
case "Error":
|
|
22682
|
-
return
|
|
22722
|
+
return chalk193.red;
|
|
22683
22723
|
case "Warning":
|
|
22684
|
-
return
|
|
22724
|
+
return chalk193.yellow;
|
|
22685
22725
|
case "Information":
|
|
22686
|
-
return
|
|
22726
|
+
return chalk193.cyan;
|
|
22687
22727
|
case "Debug":
|
|
22688
|
-
return
|
|
22728
|
+
return chalk193.gray;
|
|
22689
22729
|
case "Verbose":
|
|
22690
|
-
return
|
|
22730
|
+
return chalk193.dim;
|
|
22691
22731
|
default:
|
|
22692
|
-
return
|
|
22732
|
+
return chalk193.white;
|
|
22693
22733
|
}
|
|
22694
22734
|
}
|
|
22695
22735
|
function levelAbbrev(level) {
|
|
@@ -22730,12 +22770,12 @@ function formatTimestamp(iso) {
|
|
|
22730
22770
|
function formatEvent(event) {
|
|
22731
22771
|
const color = levelColor(event.Level);
|
|
22732
22772
|
const abbrev = levelAbbrev(event.Level);
|
|
22733
|
-
const ts8 =
|
|
22773
|
+
const ts8 = chalk193.dim(formatTimestamp(event.Timestamp));
|
|
22734
22774
|
const msg = renderMessage(event);
|
|
22735
22775
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
22736
22776
|
if (event.Exception) {
|
|
22737
22777
|
for (const line of event.Exception.split("\n")) {
|
|
22738
|
-
lines.push(
|
|
22778
|
+
lines.push(chalk193.red(` ${line}`));
|
|
22739
22779
|
}
|
|
22740
22780
|
}
|
|
22741
22781
|
return lines.join("\n");
|
|
@@ -22768,11 +22808,11 @@ function rejectTimestampFilter(filter) {
|
|
|
22768
22808
|
}
|
|
22769
22809
|
|
|
22770
22810
|
// src/shared/resolveNamedConnection.ts
|
|
22771
|
-
import
|
|
22811
|
+
import chalk194 from "chalk";
|
|
22772
22812
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
22773
22813
|
if (connections.length === 0) {
|
|
22774
22814
|
console.error(
|
|
22775
|
-
|
|
22815
|
+
chalk194.red(
|
|
22776
22816
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
22777
22817
|
)
|
|
22778
22818
|
);
|
|
@@ -22781,7 +22821,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
22781
22821
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
22782
22822
|
const connection = connections.find((c) => c.name === target);
|
|
22783
22823
|
if (!connection) {
|
|
22784
|
-
console.error(
|
|
22824
|
+
console.error(chalk194.red(`${kind} connection "${target}" not found.`));
|
|
22785
22825
|
process.exit(1);
|
|
22786
22826
|
}
|
|
22787
22827
|
return connection;
|
|
@@ -22810,7 +22850,7 @@ async function seqQuery(filter, options2) {
|
|
|
22810
22850
|
new URLSearchParams({ filter, count: String(count7) })
|
|
22811
22851
|
);
|
|
22812
22852
|
if (events.length === 0) {
|
|
22813
|
-
console.log(
|
|
22853
|
+
console.log(chalk195.yellow("No events found."));
|
|
22814
22854
|
return;
|
|
22815
22855
|
}
|
|
22816
22856
|
if (options2.json) {
|
|
@@ -22821,11 +22861,11 @@ async function seqQuery(filter, options2) {
|
|
|
22821
22861
|
for (const event of chronological) {
|
|
22822
22862
|
console.log(formatEvent(event));
|
|
22823
22863
|
}
|
|
22824
|
-
console.log(
|
|
22864
|
+
console.log(chalk195.dim(`
|
|
22825
22865
|
${events.length} events`));
|
|
22826
22866
|
if (events.length >= count7) {
|
|
22827
22867
|
console.log(
|
|
22828
|
-
|
|
22868
|
+
chalk195.yellow(
|
|
22829
22869
|
`Results limited to ${count7}. Use --count to retrieve more.`
|
|
22830
22870
|
)
|
|
22831
22871
|
);
|
|
@@ -22833,10 +22873,10 @@ ${events.length} events`));
|
|
|
22833
22873
|
}
|
|
22834
22874
|
|
|
22835
22875
|
// src/shared/setNamedDefaultConnection.ts
|
|
22836
|
-
import
|
|
22876
|
+
import chalk196 from "chalk";
|
|
22837
22877
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
22838
22878
|
if (!connections.find((c) => c.name === name)) {
|
|
22839
|
-
console.error(
|
|
22879
|
+
console.error(chalk196.red(`Connection "${name}" not found.`));
|
|
22840
22880
|
process.exit(1);
|
|
22841
22881
|
}
|
|
22842
22882
|
setDefault(name);
|
|
@@ -22885,7 +22925,7 @@ function registerSignal(program2) {
|
|
|
22885
22925
|
}
|
|
22886
22926
|
|
|
22887
22927
|
// src/commands/sql/sqlAuth.ts
|
|
22888
|
-
import
|
|
22928
|
+
import chalk198 from "chalk";
|
|
22889
22929
|
|
|
22890
22930
|
// src/commands/sql/loadConnections.ts
|
|
22891
22931
|
function loadConnections3() {
|
|
@@ -22914,7 +22954,7 @@ function setDefaultConnection2(name) {
|
|
|
22914
22954
|
}
|
|
22915
22955
|
|
|
22916
22956
|
// src/commands/sql/promptConnection.ts
|
|
22917
|
-
import
|
|
22957
|
+
import chalk197 from "chalk";
|
|
22918
22958
|
async function promptConnection3(existingNames) {
|
|
22919
22959
|
const name = await promptInput("name", "Connection name:", "default");
|
|
22920
22960
|
assertUniqueName(existingNames, name);
|
|
@@ -22922,7 +22962,7 @@ async function promptConnection3(existingNames) {
|
|
|
22922
22962
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
22923
22963
|
const port = Number.parseInt(portStr, 10);
|
|
22924
22964
|
if (!Number.isFinite(port)) {
|
|
22925
|
-
console.error(
|
|
22965
|
+
console.error(chalk197.red(`Invalid port "${portStr}".`));
|
|
22926
22966
|
process.exit(1);
|
|
22927
22967
|
}
|
|
22928
22968
|
const user = await promptInput("user", "User:");
|
|
@@ -22935,13 +22975,13 @@ async function promptConnection3(existingNames) {
|
|
|
22935
22975
|
var sqlAuth = createConnectionAuth({
|
|
22936
22976
|
load: loadConnections3,
|
|
22937
22977
|
save: saveConnections3,
|
|
22938
|
-
format: (c) => `${
|
|
22978
|
+
format: (c) => `${chalk198.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
22939
22979
|
promptNew: promptConnection3,
|
|
22940
22980
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
22941
22981
|
});
|
|
22942
22982
|
|
|
22943
22983
|
// src/commands/sql/printTable.ts
|
|
22944
|
-
import
|
|
22984
|
+
import chalk199 from "chalk";
|
|
22945
22985
|
function formatCell(value) {
|
|
22946
22986
|
if (value === null || value === void 0) return "";
|
|
22947
22987
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -22950,7 +22990,7 @@ function formatCell(value) {
|
|
|
22950
22990
|
}
|
|
22951
22991
|
function printTable(rows) {
|
|
22952
22992
|
if (rows.length === 0) {
|
|
22953
|
-
console.log(
|
|
22993
|
+
console.log(chalk199.yellow("(no rows)"));
|
|
22954
22994
|
return;
|
|
22955
22995
|
}
|
|
22956
22996
|
const columns = Object.keys(rows[0]);
|
|
@@ -22958,13 +22998,13 @@ function printTable(rows) {
|
|
|
22958
22998
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
22959
22999
|
);
|
|
22960
23000
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
22961
|
-
console.log(
|
|
22962
|
-
console.log(
|
|
23001
|
+
console.log(chalk199.dim(header));
|
|
23002
|
+
console.log(chalk199.dim("-".repeat(header.length)));
|
|
22963
23003
|
for (const row of rows) {
|
|
22964
23004
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
22965
23005
|
console.log(line);
|
|
22966
23006
|
}
|
|
22967
|
-
console.log(
|
|
23007
|
+
console.log(chalk199.dim(`
|
|
22968
23008
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
22969
23009
|
}
|
|
22970
23010
|
|
|
@@ -23038,7 +23078,7 @@ var sqlConfigHelp = [
|
|
|
23038
23078
|
];
|
|
23039
23079
|
|
|
23040
23080
|
// src/commands/sql/sqlMutate.ts
|
|
23041
|
-
import
|
|
23081
|
+
import chalk200 from "chalk";
|
|
23042
23082
|
|
|
23043
23083
|
// src/commands/sql/isMutation.ts
|
|
23044
23084
|
var MUTATION_KEYWORDS = [
|
|
@@ -23072,7 +23112,7 @@ function isMutation(sql25) {
|
|
|
23072
23112
|
async function sqlMutate(query, connectionName) {
|
|
23073
23113
|
if (!isMutation(query)) {
|
|
23074
23114
|
console.error(
|
|
23075
|
-
|
|
23115
|
+
chalk200.red(
|
|
23076
23116
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
23077
23117
|
)
|
|
23078
23118
|
);
|
|
@@ -23082,18 +23122,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
23082
23122
|
const pool = await sqlConnect(conn);
|
|
23083
23123
|
try {
|
|
23084
23124
|
const result = await pool.request().query(query);
|
|
23085
|
-
console.log(
|
|
23125
|
+
console.log(chalk200.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
23086
23126
|
} finally {
|
|
23087
23127
|
await pool.close();
|
|
23088
23128
|
}
|
|
23089
23129
|
}
|
|
23090
23130
|
|
|
23091
23131
|
// src/commands/sql/sqlQuery.ts
|
|
23092
|
-
import
|
|
23132
|
+
import chalk201 from "chalk";
|
|
23093
23133
|
async function sqlQuery(query, connectionName) {
|
|
23094
23134
|
if (isMutation(query)) {
|
|
23095
23135
|
console.error(
|
|
23096
|
-
|
|
23136
|
+
chalk201.red(
|
|
23097
23137
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
23098
23138
|
)
|
|
23099
23139
|
);
|
|
@@ -23108,7 +23148,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
23108
23148
|
printTable(rows);
|
|
23109
23149
|
} else {
|
|
23110
23150
|
console.log(
|
|
23111
|
-
|
|
23151
|
+
chalk201.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
23112
23152
|
);
|
|
23113
23153
|
}
|
|
23114
23154
|
} finally {
|
|
@@ -23923,7 +23963,7 @@ function registerVoice(program2) {
|
|
|
23923
23963
|
|
|
23924
23964
|
// src/commands/roam/auth.ts
|
|
23925
23965
|
import { randomBytes } from "crypto";
|
|
23926
|
-
import
|
|
23966
|
+
import chalk202 from "chalk";
|
|
23927
23967
|
|
|
23928
23968
|
// src/commands/roam/waitForCallback.ts
|
|
23929
23969
|
import { createServer as createServer3 } from "http";
|
|
@@ -24054,13 +24094,13 @@ async function auth() {
|
|
|
24054
24094
|
saveGlobalConfig(config);
|
|
24055
24095
|
const state = randomBytes(16).toString("hex");
|
|
24056
24096
|
console.log(
|
|
24057
|
-
|
|
24097
|
+
chalk202.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
24058
24098
|
);
|
|
24059
|
-
console.log(
|
|
24060
|
-
console.log(
|
|
24061
|
-
console.log(
|
|
24099
|
+
console.log(chalk202.white("http://localhost:14523/callback\n"));
|
|
24100
|
+
console.log(chalk202.blue("Opening browser for authorization..."));
|
|
24101
|
+
console.log(chalk202.dim("Waiting for authorization callback..."));
|
|
24062
24102
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
24063
|
-
console.log(
|
|
24103
|
+
console.log(chalk202.dim("Exchanging code for tokens..."));
|
|
24064
24104
|
const tokens = await exchangeToken({
|
|
24065
24105
|
code,
|
|
24066
24106
|
clientId,
|
|
@@ -24076,7 +24116,7 @@ async function auth() {
|
|
|
24076
24116
|
};
|
|
24077
24117
|
saveGlobalConfig(config);
|
|
24078
24118
|
console.log(
|
|
24079
|
-
|
|
24119
|
+
chalk202.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
24080
24120
|
);
|
|
24081
24121
|
}
|
|
24082
24122
|
|
|
@@ -24619,7 +24659,7 @@ import { execSync as execSync58 } from "child_process";
|
|
|
24619
24659
|
import { existsSync as existsSync56, mkdirSync as mkdirSync24, unlinkSync as unlinkSync21, writeFileSync as writeFileSync42 } from "fs";
|
|
24620
24660
|
import { tmpdir as tmpdir7 } from "os";
|
|
24621
24661
|
import { join as join66, resolve as resolve16 } from "path";
|
|
24622
|
-
import
|
|
24662
|
+
import chalk203 from "chalk";
|
|
24623
24663
|
|
|
24624
24664
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
24625
24665
|
var captureWindowPs1 = `
|
|
@@ -24770,13 +24810,13 @@ function screenshot(processName) {
|
|
|
24770
24810
|
const config = loadConfig();
|
|
24771
24811
|
const outputDir = resolve16(config.screenshot.outputDir);
|
|
24772
24812
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
24773
|
-
console.log(
|
|
24813
|
+
console.log(chalk203.gray(`Capturing window for process "${processName}" ...`));
|
|
24774
24814
|
try {
|
|
24775
24815
|
runPowerShellScript(processName, outputPath);
|
|
24776
|
-
console.log(
|
|
24816
|
+
console.log(chalk203.green(`Screenshot saved: ${outputPath}`));
|
|
24777
24817
|
} catch (error) {
|
|
24778
24818
|
const msg = error instanceof Error ? error.message : String(error);
|
|
24779
|
-
console.error(
|
|
24819
|
+
console.error(chalk203.red(`Failed to capture screenshot: ${msg}`));
|
|
24780
24820
|
process.exit(1);
|
|
24781
24821
|
}
|
|
24782
24822
|
}
|
|
@@ -28120,7 +28160,7 @@ function registerSetStatusCommand(cmd) {
|
|
|
28120
28160
|
|
|
28121
28161
|
// src/commands/sessions/summarise/index.ts
|
|
28122
28162
|
import * as fs41 from "fs";
|
|
28123
|
-
import
|
|
28163
|
+
import chalk204 from "chalk";
|
|
28124
28164
|
|
|
28125
28165
|
// src/commands/sessions/summarise/shared.ts
|
|
28126
28166
|
import * as fs40 from "fs";
|
|
@@ -28194,22 +28234,22 @@ ${firstMessage}`);
|
|
|
28194
28234
|
async function summarise2(options2) {
|
|
28195
28235
|
const files = await discoverSessionFiles();
|
|
28196
28236
|
if (files.length === 0) {
|
|
28197
|
-
console.log(
|
|
28237
|
+
console.log(chalk204.yellow("No sessions found."));
|
|
28198
28238
|
return;
|
|
28199
28239
|
}
|
|
28200
28240
|
const toProcess = selectCandidates(files, options2);
|
|
28201
28241
|
if (toProcess.length === 0) {
|
|
28202
|
-
console.log(
|
|
28242
|
+
console.log(chalk204.green("All sessions already summarised."));
|
|
28203
28243
|
return;
|
|
28204
28244
|
}
|
|
28205
28245
|
console.log(
|
|
28206
|
-
|
|
28246
|
+
chalk204.cyan(
|
|
28207
28247
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
28208
28248
|
)
|
|
28209
28249
|
);
|
|
28210
28250
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
28211
28251
|
console.log(
|
|
28212
|
-
|
|
28252
|
+
chalk204.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk204.yellow(`, ${failed2} skipped`) : "")
|
|
28213
28253
|
);
|
|
28214
28254
|
}
|
|
28215
28255
|
function selectCandidates(files, options2) {
|
|
@@ -28229,16 +28269,16 @@ function processSessions(files) {
|
|
|
28229
28269
|
let failed2 = 0;
|
|
28230
28270
|
for (let i = 0; i < files.length; i++) {
|
|
28231
28271
|
const file = files[i];
|
|
28232
|
-
process.stdout.write(
|
|
28272
|
+
process.stdout.write(chalk204.dim(` [${i + 1}/${files.length}] `));
|
|
28233
28273
|
const summary = summariseSession(file);
|
|
28234
28274
|
if (summary) {
|
|
28235
28275
|
writeSummary(file, summary);
|
|
28236
28276
|
succeeded++;
|
|
28237
|
-
process.stdout.write(`${
|
|
28277
|
+
process.stdout.write(`${chalk204.green("\u2713")} ${summary}
|
|
28238
28278
|
`);
|
|
28239
28279
|
} else {
|
|
28240
28280
|
failed2++;
|
|
28241
|
-
process.stdout.write(` ${
|
|
28281
|
+
process.stdout.write(` ${chalk204.yellow("skip")}
|
|
28242
28282
|
`);
|
|
28243
28283
|
}
|
|
28244
28284
|
}
|
|
@@ -28280,7 +28320,7 @@ function registerSessions(program2) {
|
|
|
28280
28320
|
}
|
|
28281
28321
|
|
|
28282
28322
|
// src/commands/statusLine.ts
|
|
28283
|
-
import
|
|
28323
|
+
import chalk206 from "chalk";
|
|
28284
28324
|
|
|
28285
28325
|
// src/shared/contextLevel.ts
|
|
28286
28326
|
function contextLevel(pct) {
|
|
@@ -28290,7 +28330,7 @@ function contextLevel(pct) {
|
|
|
28290
28330
|
}
|
|
28291
28331
|
|
|
28292
28332
|
// src/commands/buildLimitsSegment.ts
|
|
28293
|
-
import
|
|
28333
|
+
import chalk205 from "chalk";
|
|
28294
28334
|
|
|
28295
28335
|
// src/shared/rateLimitLevel.ts
|
|
28296
28336
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -28321,9 +28361,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
28321
28361
|
|
|
28322
28362
|
// src/commands/buildLimitsSegment.ts
|
|
28323
28363
|
var LEVEL_COLOR = {
|
|
28324
|
-
ok:
|
|
28325
|
-
warn:
|
|
28326
|
-
over:
|
|
28364
|
+
ok: chalk205.green,
|
|
28365
|
+
warn: chalk205.yellow,
|
|
28366
|
+
over: chalk205.red
|
|
28327
28367
|
};
|
|
28328
28368
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
28329
28369
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -28419,7 +28459,7 @@ async function relayUsage(claudeSessionId, transcriptPath, usedPct) {
|
|
|
28419
28459
|
}
|
|
28420
28460
|
|
|
28421
28461
|
// src/commands/statusLine.ts
|
|
28422
|
-
|
|
28462
|
+
chalk206.level = 3;
|
|
28423
28463
|
function formatNumber(num) {
|
|
28424
28464
|
return num.toLocaleString("en-US");
|
|
28425
28465
|
}
|
|
@@ -28427,9 +28467,9 @@ function colorizePercent(pct) {
|
|
|
28427
28467
|
const label2 = `${Math.round(pct)}%`;
|
|
28428
28468
|
switch (contextLevel(pct)) {
|
|
28429
28469
|
case "red":
|
|
28430
|
-
return
|
|
28470
|
+
return chalk206.red(label2);
|
|
28431
28471
|
case "yellow":
|
|
28432
|
-
return
|
|
28472
|
+
return chalk206.yellow(label2);
|
|
28433
28473
|
default:
|
|
28434
28474
|
return label2;
|
|
28435
28475
|
}
|
|
@@ -28442,7 +28482,7 @@ async function statusLine() {
|
|
|
28442
28482
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
28443
28483
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
28444
28484
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
28445
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
28485
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk206.cyan(branch2)} | ` : "";
|
|
28446
28486
|
console.log(
|
|
28447
28487
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
28448
28488
|
);
|
|
@@ -28463,7 +28503,7 @@ import { fileURLToPath as fileURLToPath9 } from "url";
|
|
|
28463
28503
|
// src/commands/sync/syncClaudeMd.ts
|
|
28464
28504
|
import * as fs42 from "fs";
|
|
28465
28505
|
import * as path61 from "path";
|
|
28466
|
-
import
|
|
28506
|
+
import chalk207 from "chalk";
|
|
28467
28507
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
28468
28508
|
const source = path61.join(claudeDir, "CLAUDE.md");
|
|
28469
28509
|
const target = path61.join(targetBase, "CLAUDE.md");
|
|
@@ -28472,12 +28512,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
28472
28512
|
const targetContent = fs42.readFileSync(target, "utf8");
|
|
28473
28513
|
if (sourceContent !== targetContent) {
|
|
28474
28514
|
console.log(
|
|
28475
|
-
|
|
28515
|
+
chalk207.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
28476
28516
|
);
|
|
28477
28517
|
console.log();
|
|
28478
28518
|
printDiff(targetContent, sourceContent);
|
|
28479
28519
|
const confirm = options2?.yes || await promptConfirm(
|
|
28480
|
-
|
|
28520
|
+
chalk207.red("Overwrite existing CLAUDE.md?"),
|
|
28481
28521
|
false
|
|
28482
28522
|
);
|
|
28483
28523
|
if (!confirm) {
|
|
@@ -28671,7 +28711,7 @@ function syncPi(claudeDir) {
|
|
|
28671
28711
|
// src/commands/sync/syncSettings.ts
|
|
28672
28712
|
import * as fs47 from "fs";
|
|
28673
28713
|
import * as path68 from "path";
|
|
28674
|
-
import
|
|
28714
|
+
import chalk208 from "chalk";
|
|
28675
28715
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
28676
28716
|
const source = path68.join(claudeDir, "settings.json");
|
|
28677
28717
|
const target = path68.join(targetBase, "settings.json");
|
|
@@ -28690,14 +28730,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
28690
28730
|
if (mergedContent !== normalizedTarget) {
|
|
28691
28731
|
if (!options2?.yes) {
|
|
28692
28732
|
console.log(
|
|
28693
|
-
|
|
28733
|
+
chalk208.yellow(
|
|
28694
28734
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
28695
28735
|
)
|
|
28696
28736
|
);
|
|
28697
28737
|
console.log();
|
|
28698
28738
|
printDiff(targetContent, mergedContent);
|
|
28699
28739
|
const confirm = await promptConfirm(
|
|
28700
|
-
|
|
28740
|
+
chalk208.red("Overwrite existing settings.json?"),
|
|
28701
28741
|
false
|
|
28702
28742
|
);
|
|
28703
28743
|
if (!confirm) {
|
|
@@ -28796,10 +28836,10 @@ async function update2() {
|
|
|
28796
28836
|
}
|
|
28797
28837
|
|
|
28798
28838
|
// src/reportCliError.ts
|
|
28799
|
-
import
|
|
28839
|
+
import chalk209 from "chalk";
|
|
28800
28840
|
function reportCliError(error) {
|
|
28801
|
-
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError) {
|
|
28802
|
-
console.error(
|
|
28841
|
+
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError) {
|
|
28842
|
+
console.error(chalk209.red(error.message));
|
|
28803
28843
|
} else {
|
|
28804
28844
|
console.error(error);
|
|
28805
28845
|
}
|