@staff0rd/assist 0.466.0 → 0.468.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 -0
- package/dist/commands/sessions/web/bundle.js +374 -371
- package/dist/index.js +486 -357
- 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.468.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -10592,8 +10592,8 @@ async function readJsonBody(req) {
|
|
|
10592
10592
|
return JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
10593
10593
|
}
|
|
10594
10594
|
|
|
10595
|
-
// src/commands/sessions/web/
|
|
10596
|
-
async function
|
|
10595
|
+
// src/commands/sessions/web/parseConfigWriteRequest.ts
|
|
10596
|
+
async function parseConfigWriteRequest(req) {
|
|
10597
10597
|
let body;
|
|
10598
10598
|
try {
|
|
10599
10599
|
body = await readJsonBody(req);
|
|
@@ -10610,25 +10610,15 @@ async function parseSetConfigRequest(req) {
|
|
|
10610
10610
|
return { ok: true, key, value: body.value, cwd, global: scope === "global" };
|
|
10611
10611
|
}
|
|
10612
10612
|
|
|
10613
|
-
// src/commands/sessions/web/
|
|
10614
|
-
async function
|
|
10615
|
-
const parsed = await
|
|
10613
|
+
// src/commands/sessions/web/handleConfigWrite.ts
|
|
10614
|
+
async function handleConfigWrite(req, res, apply) {
|
|
10615
|
+
const parsed = await parseConfigWriteRequest(req);
|
|
10616
10616
|
if (!parsed.ok) {
|
|
10617
10617
|
respondJson(res, 400, { error: parsed.error });
|
|
10618
10618
|
return;
|
|
10619
10619
|
}
|
|
10620
|
-
const coerced = coerceConfigValue(parsed.key, parsed.value);
|
|
10621
|
-
if (!coerced.ok) {
|
|
10622
|
-
respondJson(res, 400, { error: coerced.error, errors: [coerced.error] });
|
|
10623
|
-
return;
|
|
10624
|
-
}
|
|
10625
10620
|
try {
|
|
10626
|
-
const result =
|
|
10627
|
-
parsed.key,
|
|
10628
|
-
coerced.value,
|
|
10629
|
-
parsed.global,
|
|
10630
|
-
parsed.cwd
|
|
10631
|
-
);
|
|
10621
|
+
const result = apply(parsed);
|
|
10632
10622
|
if (!result.ok) {
|
|
10633
10623
|
respondJson(res, 400, {
|
|
10634
10624
|
error: result.errors.join("\n"),
|
|
@@ -10636,7 +10626,7 @@ async function setConfig(req, res) {
|
|
|
10636
10626
|
});
|
|
10637
10627
|
return;
|
|
10638
10628
|
}
|
|
10639
|
-
respondJson(res, 200,
|
|
10629
|
+
respondJson(res, 200, result.payload);
|
|
10640
10630
|
} catch (error) {
|
|
10641
10631
|
respondJson(res, 500, {
|
|
10642
10632
|
error: error instanceof Error ? error.message : "Failed to save config"
|
|
@@ -10644,6 +10634,129 @@ async function setConfig(req, res) {
|
|
|
10644
10634
|
}
|
|
10645
10635
|
}
|
|
10646
10636
|
|
|
10637
|
+
// src/commands/sessions/web/setConfig.ts
|
|
10638
|
+
function setConfig(req, res) {
|
|
10639
|
+
return handleConfigWrite(req, res, (request) => {
|
|
10640
|
+
const coerced = coerceConfigValue(request.key, request.value);
|
|
10641
|
+
if (!coerced.ok) return { ok: false, errors: [coerced.error] };
|
|
10642
|
+
const result = applyConfigSet(
|
|
10643
|
+
request.key,
|
|
10644
|
+
coerced.value,
|
|
10645
|
+
request.global,
|
|
10646
|
+
request.cwd
|
|
10647
|
+
);
|
|
10648
|
+
return result.ok ? { ok: true, payload: { target: result.target } } : result;
|
|
10649
|
+
});
|
|
10650
|
+
}
|
|
10651
|
+
|
|
10652
|
+
// src/commands/config/unsetNestedValue.ts
|
|
10653
|
+
function isPlainObject2(val) {
|
|
10654
|
+
return val !== null && typeof val === "object" && !Array.isArray(val);
|
|
10655
|
+
}
|
|
10656
|
+
function isContainer(val) {
|
|
10657
|
+
return Array.isArray(val) || isPlainObject2(val);
|
|
10658
|
+
}
|
|
10659
|
+
function isNumericKey2(key) {
|
|
10660
|
+
return /^\d+$/.test(key);
|
|
10661
|
+
}
|
|
10662
|
+
function toIndex(key) {
|
|
10663
|
+
return Number.parseInt(key, 10);
|
|
10664
|
+
}
|
|
10665
|
+
function hasKey(container, key) {
|
|
10666
|
+
if (Array.isArray(container)) {
|
|
10667
|
+
return isNumericKey2(key) && toIndex(key) < container.length;
|
|
10668
|
+
}
|
|
10669
|
+
return Object.hasOwn(container, key);
|
|
10670
|
+
}
|
|
10671
|
+
function getItem2(container, key) {
|
|
10672
|
+
if (Array.isArray(container)) return container[toIndex(key)];
|
|
10673
|
+
return container[key];
|
|
10674
|
+
}
|
|
10675
|
+
function withoutKey(container, key) {
|
|
10676
|
+
if (Array.isArray(container)) {
|
|
10677
|
+
const next3 = [...container];
|
|
10678
|
+
next3.splice(toIndex(key), 1);
|
|
10679
|
+
return next3;
|
|
10680
|
+
}
|
|
10681
|
+
const { [key]: _deleted, ...rest } = container;
|
|
10682
|
+
return rest;
|
|
10683
|
+
}
|
|
10684
|
+
function withChild(container, key, child) {
|
|
10685
|
+
if (Array.isArray(container)) {
|
|
10686
|
+
const next3 = [...container];
|
|
10687
|
+
next3[toIndex(key)] = child;
|
|
10688
|
+
return next3;
|
|
10689
|
+
}
|
|
10690
|
+
return { ...container, [key]: child };
|
|
10691
|
+
}
|
|
10692
|
+
function isPrunable(container) {
|
|
10693
|
+
return isPlainObject2(container) && Object.keys(container).length === 0;
|
|
10694
|
+
}
|
|
10695
|
+
function replaceOrPrune(container, key, child) {
|
|
10696
|
+
return isPrunable(child) ? withoutKey(container, key) : withChild(container, key, child);
|
|
10697
|
+
}
|
|
10698
|
+
function removeFromChild(container, key, rest) {
|
|
10699
|
+
const child = getItem2(container, key);
|
|
10700
|
+
if (!isContainer(child)) return { container, removed: false };
|
|
10701
|
+
const inner = removeAt(child, rest);
|
|
10702
|
+
if (!inner.removed) return { container, removed: false };
|
|
10703
|
+
return {
|
|
10704
|
+
container: replaceOrPrune(container, key, inner.container),
|
|
10705
|
+
removed: true
|
|
10706
|
+
};
|
|
10707
|
+
}
|
|
10708
|
+
function removeAt(container, keys) {
|
|
10709
|
+
const [key, ...rest] = keys;
|
|
10710
|
+
if (!hasKey(container, key)) return { container, removed: false };
|
|
10711
|
+
if (rest.length === 0) {
|
|
10712
|
+
return { container: withoutKey(container, key), removed: true };
|
|
10713
|
+
}
|
|
10714
|
+
return removeFromChild(container, key, rest);
|
|
10715
|
+
}
|
|
10716
|
+
function unsetNestedValue(obj, path71) {
|
|
10717
|
+
const { container, removed } = removeAt(obj, path71.split("."));
|
|
10718
|
+
return { config: container, removed };
|
|
10719
|
+
}
|
|
10720
|
+
|
|
10721
|
+
// src/commands/config/applyConfigUnset.ts
|
|
10722
|
+
function applyConfigUnset(key, global, cwd = process.cwd()) {
|
|
10723
|
+
if (!global && isGlobalOnlyConfigKey(key)) {
|
|
10724
|
+
return {
|
|
10725
|
+
ok: false,
|
|
10726
|
+
errors: [
|
|
10727
|
+
`"${key}" is a global-only key. Use --global to unset it in ~/.assist.yml`
|
|
10728
|
+
]
|
|
10729
|
+
};
|
|
10730
|
+
}
|
|
10731
|
+
const target = global ? "global" : "project";
|
|
10732
|
+
const raw = global ? loadGlobalConfigRaw() : loadProjectConfig(cwd);
|
|
10733
|
+
const { config, removed } = unsetNestedValue(raw, key);
|
|
10734
|
+
if (!removed) return { ok: true, target, removed: false };
|
|
10735
|
+
const validation = validateConfig(config, key);
|
|
10736
|
+
if (!validation.ok) return validation;
|
|
10737
|
+
if (global) saveGlobalConfig(config);
|
|
10738
|
+
else saveConfig(config, cwd);
|
|
10739
|
+
return { ok: true, target, removed: true };
|
|
10740
|
+
}
|
|
10741
|
+
|
|
10742
|
+
// src/commands/config/isKnownConfigKey.ts
|
|
10743
|
+
function isKnownConfigKey(key) {
|
|
10744
|
+
return enumerateConfigLeafKeys(assistConfigSchema).includes(key);
|
|
10745
|
+
}
|
|
10746
|
+
|
|
10747
|
+
// src/commands/sessions/web/unsetConfig.ts
|
|
10748
|
+
function unsetConfig(req, res) {
|
|
10749
|
+
return handleConfigWrite(req, res, (request) => {
|
|
10750
|
+
if (!isKnownConfigKey(request.key))
|
|
10751
|
+
return { ok: false, errors: [`Unknown config key "${request.key}"`] };
|
|
10752
|
+
const result = applyConfigUnset(request.key, request.global, request.cwd);
|
|
10753
|
+
return result.ok ? {
|
|
10754
|
+
ok: true,
|
|
10755
|
+
payload: { target: result.target, removed: result.removed }
|
|
10756
|
+
} : result;
|
|
10757
|
+
});
|
|
10758
|
+
}
|
|
10759
|
+
|
|
10647
10760
|
// src/commands/sessions/web/uploadPrImage.ts
|
|
10648
10761
|
import { rm } from "fs/promises";
|
|
10649
10762
|
|
|
@@ -10830,6 +10943,7 @@ var routes2 = {
|
|
|
10830
10943
|
"GET /api/backups/list": getBackups,
|
|
10831
10944
|
"GET /api/config": getConfig,
|
|
10832
10945
|
"POST /api/config/set": setConfig,
|
|
10946
|
+
"POST /api/config/unset": unsetConfig,
|
|
10833
10947
|
"GET /api/review/synthesis": getReviewSynthesis
|
|
10834
10948
|
};
|
|
10835
10949
|
var handleRequest = createFallbackHandler(
|
|
@@ -13290,7 +13404,7 @@ async function reorderPhaseRows(orm, itemId2, fromIdx, toIdx) {
|
|
|
13290
13404
|
}
|
|
13291
13405
|
|
|
13292
13406
|
// src/commands/backlog/movePhase.ts
|
|
13293
|
-
function
|
|
13407
|
+
function toIndex2(value, phaseCount) {
|
|
13294
13408
|
const pos = Number.parseInt(value, 10);
|
|
13295
13409
|
if (Number.isNaN(pos) || pos < 1 || pos > phaseCount) {
|
|
13296
13410
|
console.log(
|
|
@@ -13310,9 +13424,9 @@ async function movePhase(id, from, to) {
|
|
|
13310
13424
|
const itemId2 = item.id;
|
|
13311
13425
|
const [row] = await orm.select({ cnt: count6() }).from(planPhases).where(eq36(planPhases.itemId, itemId2));
|
|
13312
13426
|
const phaseCount = row?.cnt ?? 0;
|
|
13313
|
-
const fromIdx =
|
|
13427
|
+
const fromIdx = toIndex2(from, phaseCount);
|
|
13314
13428
|
if (fromIdx === void 0) return;
|
|
13315
|
-
const toIdx =
|
|
13429
|
+
const toIdx = toIndex2(to, phaseCount);
|
|
13316
13430
|
if (toIdx === void 0) return;
|
|
13317
13431
|
if (fromIdx !== toIdx) {
|
|
13318
13432
|
await reorderPhaseRows(orm, itemId2, fromIdx, toIdx);
|
|
@@ -15833,8 +15947,8 @@ function exitWithConfigErrors(errors) {
|
|
|
15833
15947
|
function applyRepoConfigSet(key, coerced, repoName) {
|
|
15834
15948
|
const globalRaw = loadGlobalConfigRaw();
|
|
15835
15949
|
const label2 = repoName === void 0 ? resolveRepoWriteLabel(globalRaw, getCurrentOrigin(process.cwd())) : resolveNamedRepoWriteLabel(globalRaw, repoName);
|
|
15836
|
-
const repos2 =
|
|
15837
|
-
const existingBlock =
|
|
15950
|
+
const repos2 = isPlainObject3(globalRaw.repos) ? { ...globalRaw.repos } : {};
|
|
15951
|
+
const existingBlock = isPlainObject3(repos2[label2]) ? repos2[label2] : {};
|
|
15838
15952
|
const updatedBlock = setNestedValue(existingBlock, key, coerced);
|
|
15839
15953
|
const validation = validateConfig(updatedBlock, key);
|
|
15840
15954
|
if (!validation.ok) exitWithConfigErrors(validation.errors);
|
|
@@ -15842,7 +15956,7 @@ function applyRepoConfigSet(key, coerced, repoName) {
|
|
|
15842
15956
|
saveGlobalConfig({ ...globalRaw, repos: repos2 });
|
|
15843
15957
|
return label2;
|
|
15844
15958
|
}
|
|
15845
|
-
function
|
|
15959
|
+
function isPlainObject3(value) {
|
|
15846
15960
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
15847
15961
|
}
|
|
15848
15962
|
|
|
@@ -15887,6 +16001,20 @@ function coerceValue(value) {
|
|
|
15887
16001
|
return value;
|
|
15888
16002
|
}
|
|
15889
16003
|
|
|
16004
|
+
// src/commands/config/configUnset.ts
|
|
16005
|
+
import chalk130 from "chalk";
|
|
16006
|
+
function configUnset(key, options2 = {}) {
|
|
16007
|
+
const result = applyConfigUnset(key, options2.global ?? false);
|
|
16008
|
+
if (!result.ok) exitWithConfigErrors(result.errors);
|
|
16009
|
+
if (!result.removed) {
|
|
16010
|
+
console.log(
|
|
16011
|
+
chalk130.yellow(`${key} is not set in the ${result.target} config`)
|
|
16012
|
+
);
|
|
16013
|
+
return;
|
|
16014
|
+
}
|
|
16015
|
+
console.log(chalk130.green(`Unset ${key} (${result.target})`));
|
|
16016
|
+
}
|
|
16017
|
+
|
|
15890
16018
|
// src/commands/registerConfig.ts
|
|
15891
16019
|
function registerConfig(program2) {
|
|
15892
16020
|
const configCommand = program2.command("config").description("View and modify assist.yml configuration");
|
|
@@ -15894,45 +16022,46 @@ function registerConfig(program2) {
|
|
|
15894
16022
|
"-r, --repo [name]",
|
|
15895
16023
|
"Requires -g: scope the global write to a repo's identity (defaults to the current repo)"
|
|
15896
16024
|
).action((key, value, options2) => configSet(key, value, options2));
|
|
16025
|
+
configCommand.command("unset <key>").description("Remove a config value (e.g. commit.push)").option("-g, --global", "Remove from global ~/.assist.yml").action((key, options2) => configUnset(key, options2));
|
|
15897
16026
|
configCommand.command("get <key>").description("Get a config value").action(configGet);
|
|
15898
16027
|
configCommand.command("list").description("List all config values").action(configList);
|
|
15899
16028
|
}
|
|
15900
16029
|
|
|
15901
16030
|
// src/commands/db/reportMigrationStatus.ts
|
|
15902
|
-
import
|
|
16031
|
+
import chalk131 from "chalk";
|
|
15903
16032
|
function reportApplied(applied) {
|
|
15904
16033
|
if (applied.length === 0) {
|
|
15905
|
-
console.error(
|
|
16034
|
+
console.error(chalk131.green("Database is up to date; nothing to apply."));
|
|
15906
16035
|
return;
|
|
15907
16036
|
}
|
|
15908
16037
|
for (const migration of applied) {
|
|
15909
16038
|
console.error(
|
|
15910
|
-
|
|
16039
|
+
chalk131.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
15911
16040
|
);
|
|
15912
16041
|
}
|
|
15913
16042
|
}
|
|
15914
16043
|
function reportMigrationStatus(status3) {
|
|
15915
16044
|
if (status3.state === "in-sync") {
|
|
15916
16045
|
console.error(
|
|
15917
|
-
|
|
16046
|
+
chalk131.green(`In sync at migration ${status3.version} (latest).`)
|
|
15918
16047
|
);
|
|
15919
16048
|
return;
|
|
15920
16049
|
}
|
|
15921
16050
|
if (status3.state === "behind") {
|
|
15922
16051
|
console.error(
|
|
15923
|
-
|
|
16052
|
+
chalk131.yellow(
|
|
15924
16053
|
`Behind: applied ${status3.applied}, build expects ${status3.expected}.`
|
|
15925
16054
|
)
|
|
15926
16055
|
);
|
|
15927
16056
|
console.error(
|
|
15928
|
-
|
|
16057
|
+
chalk131.yellow(
|
|
15929
16058
|
`Pending: ${status3.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
15930
16059
|
)
|
|
15931
16060
|
);
|
|
15932
16061
|
return;
|
|
15933
16062
|
}
|
|
15934
16063
|
console.error(
|
|
15935
|
-
|
|
16064
|
+
chalk131.red(
|
|
15936
16065
|
`Ahead: applied ${status3.applied}, build knows ${status3.expected}. Update assist.`
|
|
15937
16066
|
)
|
|
15938
16067
|
);
|
|
@@ -15967,7 +16096,7 @@ function registerDb(program2) {
|
|
|
15967
16096
|
|
|
15968
16097
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
15969
16098
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs";
|
|
15970
|
-
import
|
|
16099
|
+
import chalk132 from "chalk";
|
|
15971
16100
|
|
|
15972
16101
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
15973
16102
|
import { join as join35 } from "path";
|
|
@@ -15998,7 +16127,7 @@ function dbMigrationConfirm(pin) {
|
|
|
15998
16127
|
sweepRestrictedDir();
|
|
15999
16128
|
const state = readMigrationPinState(pin);
|
|
16000
16129
|
if (!state) {
|
|
16001
|
-
console.error(
|
|
16130
|
+
console.error(chalk132.red(`No pending migration unlock for pin: ${pin}`));
|
|
16002
16131
|
process.exitCode = 1;
|
|
16003
16132
|
return;
|
|
16004
16133
|
}
|
|
@@ -16008,7 +16137,7 @@ function dbMigrationConfirm(pin) {
|
|
|
16008
16137
|
);
|
|
16009
16138
|
unlinkSync9(getMigrationPinPath(pin));
|
|
16010
16139
|
console.log(
|
|
16011
|
-
|
|
16140
|
+
chalk132.green(
|
|
16012
16141
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
16013
16142
|
)
|
|
16014
16143
|
);
|
|
@@ -16017,7 +16146,7 @@ function dbMigrationConfirm(pin) {
|
|
|
16017
16146
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
16018
16147
|
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync27 } from "fs";
|
|
16019
16148
|
import { randomInt as randomInt2 } from "crypto";
|
|
16020
|
-
import
|
|
16149
|
+
import chalk133 from "chalk";
|
|
16021
16150
|
|
|
16022
16151
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
16023
16152
|
function nextMigrationId() {
|
|
@@ -16032,7 +16161,7 @@ function dbMigrationUnlock() {
|
|
|
16032
16161
|
sweepRestrictedDir();
|
|
16033
16162
|
writeFileSync27(getMigrationPinPath(pin), JSON.stringify({ pin, migrationId }));
|
|
16034
16163
|
console.error(
|
|
16035
|
-
|
|
16164
|
+
chalk133.yellow.bold(
|
|
16036
16165
|
"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."
|
|
16037
16166
|
)
|
|
16038
16167
|
);
|
|
@@ -16042,7 +16171,7 @@ function dbMigrationUnlock() {
|
|
|
16042
16171
|
});
|
|
16043
16172
|
if (!delivered) {
|
|
16044
16173
|
console.error(
|
|
16045
|
-
|
|
16174
|
+
chalk133.red(
|
|
16046
16175
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
16047
16176
|
)
|
|
16048
16177
|
);
|
|
@@ -16052,7 +16181,7 @@ function dbMigrationUnlock() {
|
|
|
16052
16181
|
console.log(
|
|
16053
16182
|
`A confirmation pin was sent to your desktop notifications.
|
|
16054
16183
|
To approve creating migration ${migrationId}, run:
|
|
16055
|
-
${
|
|
16184
|
+
${chalk133.cyan(" assist db-migration confirm <PIN>")}
|
|
16056
16185
|
using the pin from that notification.`
|
|
16057
16186
|
);
|
|
16058
16187
|
}
|
|
@@ -16072,7 +16201,7 @@ function registerDbMigration(parent) {
|
|
|
16072
16201
|
|
|
16073
16202
|
// src/commands/deploy/redirect.ts
|
|
16074
16203
|
import { existsSync as existsSync35, readFileSync as readFileSync30, writeFileSync as writeFileSync28 } from "fs";
|
|
16075
|
-
import
|
|
16204
|
+
import chalk134 from "chalk";
|
|
16076
16205
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
16077
16206
|
if (!window.location.pathname.endsWith('/')) {
|
|
16078
16207
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -16081,23 +16210,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
16081
16210
|
function redirect() {
|
|
16082
16211
|
const indexPath = "index.html";
|
|
16083
16212
|
if (!existsSync35(indexPath)) {
|
|
16084
|
-
console.log(
|
|
16213
|
+
console.log(chalk134.yellow("No index.html found"));
|
|
16085
16214
|
return;
|
|
16086
16215
|
}
|
|
16087
16216
|
const content = readFileSync30(indexPath, "utf8");
|
|
16088
16217
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
16089
|
-
console.log(
|
|
16218
|
+
console.log(chalk134.dim("Trailing slash script already present"));
|
|
16090
16219
|
return;
|
|
16091
16220
|
}
|
|
16092
16221
|
const headCloseIndex = content.indexOf("</head>");
|
|
16093
16222
|
if (headCloseIndex === -1) {
|
|
16094
|
-
console.log(
|
|
16223
|
+
console.log(chalk134.red("Could not find </head> tag in index.html"));
|
|
16095
16224
|
return;
|
|
16096
16225
|
}
|
|
16097
16226
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
16098
16227
|
${content.slice(headCloseIndex)}`;
|
|
16099
16228
|
writeFileSync28(indexPath, newContent);
|
|
16100
|
-
console.log(
|
|
16229
|
+
console.log(chalk134.green("Added trailing slash redirect to index.html"));
|
|
16101
16230
|
}
|
|
16102
16231
|
|
|
16103
16232
|
// src/commands/registerDeploy.ts
|
|
@@ -16124,7 +16253,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
16124
16253
|
|
|
16125
16254
|
// src/commands/devlog/shared.ts
|
|
16126
16255
|
import { execSync as execSync35 } from "child_process";
|
|
16127
|
-
import
|
|
16256
|
+
import chalk135 from "chalk";
|
|
16128
16257
|
|
|
16129
16258
|
// src/shared/getRepoName.ts
|
|
16130
16259
|
import { existsSync as existsSync36, readFileSync as readFileSync31 } from "fs";
|
|
@@ -16233,13 +16362,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
16233
16362
|
}
|
|
16234
16363
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
16235
16364
|
for (const commit2 of commits2) {
|
|
16236
|
-
console.log(` ${
|
|
16365
|
+
console.log(` ${chalk135.yellow(commit2.hash)} ${commit2.message}`);
|
|
16237
16366
|
if (verbose) {
|
|
16238
16367
|
const visibleFiles = commit2.files.filter(
|
|
16239
16368
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
16240
16369
|
);
|
|
16241
16370
|
for (const file of visibleFiles) {
|
|
16242
|
-
console.log(` ${
|
|
16371
|
+
console.log(` ${chalk135.dim(file)}`);
|
|
16243
16372
|
}
|
|
16244
16373
|
}
|
|
16245
16374
|
}
|
|
@@ -16264,15 +16393,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
16264
16393
|
}
|
|
16265
16394
|
|
|
16266
16395
|
// src/commands/devlog/list/printDateHeader.ts
|
|
16267
|
-
import
|
|
16396
|
+
import chalk136 from "chalk";
|
|
16268
16397
|
function printDateHeader(date, isSkipped, entries) {
|
|
16269
16398
|
if (isSkipped) {
|
|
16270
|
-
console.log(`${
|
|
16399
|
+
console.log(`${chalk136.bold.blue(date)} ${chalk136.dim("skipped")}`);
|
|
16271
16400
|
} else if (entries && entries.length > 0) {
|
|
16272
|
-
const entryInfo = entries.map((e) => `${
|
|
16273
|
-
console.log(`${
|
|
16401
|
+
const entryInfo = entries.map((e) => `${chalk136.green(e.version)} ${e.title}`).join(" | ");
|
|
16402
|
+
console.log(`${chalk136.bold.blue(date)} ${entryInfo}`);
|
|
16274
16403
|
} else {
|
|
16275
|
-
console.log(`${
|
|
16404
|
+
console.log(`${chalk136.bold.blue(date)} ${chalk136.red("\u26A0 devlog missing")}`);
|
|
16276
16405
|
}
|
|
16277
16406
|
}
|
|
16278
16407
|
|
|
@@ -16376,24 +16505,24 @@ function bumpVersion(version2, type) {
|
|
|
16376
16505
|
|
|
16377
16506
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
16378
16507
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
16379
|
-
import
|
|
16508
|
+
import chalk138 from "chalk";
|
|
16380
16509
|
|
|
16381
16510
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
16382
|
-
import
|
|
16511
|
+
import chalk137 from "chalk";
|
|
16383
16512
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
16384
16513
|
if (conventional && firstHash) {
|
|
16385
16514
|
const version2 = getVersionAtCommit(firstHash);
|
|
16386
16515
|
if (version2) {
|
|
16387
|
-
console.log(`${
|
|
16516
|
+
console.log(`${chalk137.bold("version:")} ${stripToMinor(version2)}`);
|
|
16388
16517
|
} else {
|
|
16389
|
-
console.log(`${
|
|
16518
|
+
console.log(`${chalk137.bold("version:")} ${chalk137.red("unknown")}`);
|
|
16390
16519
|
}
|
|
16391
16520
|
} else if (patchVersion && minorVersion) {
|
|
16392
16521
|
console.log(
|
|
16393
|
-
`${
|
|
16522
|
+
`${chalk137.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
16394
16523
|
);
|
|
16395
16524
|
} else {
|
|
16396
|
-
console.log(`${
|
|
16525
|
+
console.log(`${chalk137.bold("version:")} v0.1 (initial)`);
|
|
16397
16526
|
}
|
|
16398
16527
|
}
|
|
16399
16528
|
|
|
@@ -16441,16 +16570,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
16441
16570
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
16442
16571
|
}
|
|
16443
16572
|
function logName(repoName) {
|
|
16444
|
-
console.log(`${
|
|
16573
|
+
console.log(`${chalk138.bold("name:")} ${repoName}`);
|
|
16445
16574
|
}
|
|
16446
16575
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
16447
16576
|
logName(ctx.repoName);
|
|
16448
16577
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
16449
|
-
console.log(
|
|
16578
|
+
console.log(chalk138.bold.blue(targetDate));
|
|
16450
16579
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
16451
16580
|
}
|
|
16452
16581
|
function logNoCommits(lastInfo) {
|
|
16453
|
-
console.log(
|
|
16582
|
+
console.log(chalk138.dim(noCommitsMessage(!!lastInfo)));
|
|
16454
16583
|
}
|
|
16455
16584
|
|
|
16456
16585
|
// src/commands/devlog/next/index.ts
|
|
@@ -16491,11 +16620,11 @@ function next2(options2) {
|
|
|
16491
16620
|
import { execSync as execSync37 } from "child_process";
|
|
16492
16621
|
|
|
16493
16622
|
// src/commands/devlog/repos/printReposTable.ts
|
|
16494
|
-
import
|
|
16623
|
+
import chalk139 from "chalk";
|
|
16495
16624
|
function colorStatus(status3) {
|
|
16496
|
-
if (status3 === "missing") return
|
|
16497
|
-
if (status3 === "outdated") return
|
|
16498
|
-
return
|
|
16625
|
+
if (status3 === "missing") return chalk139.red(status3);
|
|
16626
|
+
if (status3 === "outdated") return chalk139.yellow(status3);
|
|
16627
|
+
return chalk139.green(status3);
|
|
16499
16628
|
}
|
|
16500
16629
|
function formatRow(row, nameWidth) {
|
|
16501
16630
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -16509,8 +16638,8 @@ function printReposTable(rows) {
|
|
|
16509
16638
|
"Last Devlog".padEnd(11),
|
|
16510
16639
|
"Status"
|
|
16511
16640
|
].join(" ");
|
|
16512
|
-
console.log(
|
|
16513
|
-
console.log(
|
|
16641
|
+
console.log(chalk139.dim(header));
|
|
16642
|
+
console.log(chalk139.dim("-".repeat(header.length)));
|
|
16514
16643
|
for (const row of rows) {
|
|
16515
16644
|
console.log(formatRow(row, nameWidth));
|
|
16516
16645
|
}
|
|
@@ -16568,14 +16697,14 @@ function repos(options2) {
|
|
|
16568
16697
|
// src/commands/devlog/skip.ts
|
|
16569
16698
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
16570
16699
|
import { join as join39 } from "path";
|
|
16571
|
-
import
|
|
16700
|
+
import chalk140 from "chalk";
|
|
16572
16701
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
16573
16702
|
function getBlogConfigPath() {
|
|
16574
16703
|
return join39(BLOG_REPO_ROOT, "assist.yml");
|
|
16575
16704
|
}
|
|
16576
16705
|
function skip(date) {
|
|
16577
16706
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
16578
|
-
console.log(
|
|
16707
|
+
console.log(chalk140.red("Invalid date format. Use YYYY-MM-DD"));
|
|
16579
16708
|
process.exit(1);
|
|
16580
16709
|
}
|
|
16581
16710
|
const repoName = getRepoName();
|
|
@@ -16586,7 +16715,7 @@ function skip(date) {
|
|
|
16586
16715
|
const skipDays = skip2[repoName] ?? [];
|
|
16587
16716
|
if (skipDays.includes(date)) {
|
|
16588
16717
|
console.log(
|
|
16589
|
-
|
|
16718
|
+
chalk140.yellow(`${date} is already in skip list for ${repoName}`)
|
|
16590
16719
|
);
|
|
16591
16720
|
return;
|
|
16592
16721
|
}
|
|
@@ -16596,20 +16725,20 @@ function skip(date) {
|
|
|
16596
16725
|
devlog.skip = skip2;
|
|
16597
16726
|
config.devlog = devlog;
|
|
16598
16727
|
writeFileSync29(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
16599
|
-
console.log(
|
|
16728
|
+
console.log(chalk140.green(`Added ${date} to skip list for ${repoName}`));
|
|
16600
16729
|
}
|
|
16601
16730
|
|
|
16602
16731
|
// src/commands/devlog/version.ts
|
|
16603
|
-
import
|
|
16732
|
+
import chalk141 from "chalk";
|
|
16604
16733
|
function version() {
|
|
16605
16734
|
const config = loadConfig();
|
|
16606
16735
|
const name = getRepoName();
|
|
16607
16736
|
const lastInfo = getLastVersionInfo(name, config);
|
|
16608
16737
|
const lastVersion = lastInfo?.version ?? null;
|
|
16609
16738
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
16610
|
-
console.log(`${
|
|
16611
|
-
console.log(`${
|
|
16612
|
-
console.log(`${
|
|
16739
|
+
console.log(`${chalk141.bold("name:")} ${name}`);
|
|
16740
|
+
console.log(`${chalk141.bold("last:")} ${lastVersion ?? chalk141.dim("none")}`);
|
|
16741
|
+
console.log(`${chalk141.bold("next:")} ${nextVersion ?? chalk141.dim("none")}`);
|
|
16613
16742
|
}
|
|
16614
16743
|
|
|
16615
16744
|
// src/commands/devlog/devlogConfigHelp.ts
|
|
@@ -16653,7 +16782,7 @@ function registerDevlog(program2) {
|
|
|
16653
16782
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
16654
16783
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync5 } from "fs";
|
|
16655
16784
|
import { join as join40 } from "path";
|
|
16656
|
-
import
|
|
16785
|
+
import chalk142 from "chalk";
|
|
16657
16786
|
|
|
16658
16787
|
// src/shared/findRepoRoot.ts
|
|
16659
16788
|
import { existsSync as existsSync37 } from "fs";
|
|
@@ -16716,14 +16845,14 @@ function checkBuildLocks(startDir) {
|
|
|
16716
16845
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
16717
16846
|
if (locked) {
|
|
16718
16847
|
console.error(
|
|
16719
|
-
|
|
16848
|
+
chalk142.red("Build output locked (is VS debugging?): ") + locked
|
|
16720
16849
|
);
|
|
16721
16850
|
process.exit(1);
|
|
16722
16851
|
}
|
|
16723
16852
|
}
|
|
16724
16853
|
async function checkBuildLocksCommand() {
|
|
16725
16854
|
checkBuildLocks();
|
|
16726
|
-
console.log(
|
|
16855
|
+
console.log(chalk142.green("No build locks detected"));
|
|
16727
16856
|
}
|
|
16728
16857
|
|
|
16729
16858
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -16822,30 +16951,30 @@ function escapeRegex(s) {
|
|
|
16822
16951
|
}
|
|
16823
16952
|
|
|
16824
16953
|
// src/commands/dotnet/printTree.ts
|
|
16825
|
-
import
|
|
16954
|
+
import chalk143 from "chalk";
|
|
16826
16955
|
function printNodes(nodes, prefix2) {
|
|
16827
16956
|
for (let i = 0; i < nodes.length; i++) {
|
|
16828
16957
|
const isLast = i === nodes.length - 1;
|
|
16829
16958
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
16830
16959
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
16831
16960
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
16832
|
-
const label2 = isMissing ?
|
|
16961
|
+
const label2 = isMissing ? chalk143.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
16833
16962
|
console.log(`${prefix2}${connector}${label2}`);
|
|
16834
16963
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
16835
16964
|
}
|
|
16836
16965
|
}
|
|
16837
16966
|
function printTree(tree, totalCount, solutions) {
|
|
16838
|
-
console.log(
|
|
16839
|
-
console.log(
|
|
16967
|
+
console.log(chalk143.bold("\nProject Dependency Tree"));
|
|
16968
|
+
console.log(chalk143.cyan(tree.relativePath));
|
|
16840
16969
|
printNodes(tree.children, "");
|
|
16841
|
-
console.log(
|
|
16970
|
+
console.log(chalk143.dim(`
|
|
16842
16971
|
${totalCount} projects total (including root)`));
|
|
16843
|
-
console.log(
|
|
16972
|
+
console.log(chalk143.bold("\nSolution Membership"));
|
|
16844
16973
|
if (solutions.length === 0) {
|
|
16845
|
-
console.log(
|
|
16974
|
+
console.log(chalk143.yellow(" Not found in any .sln"));
|
|
16846
16975
|
} else {
|
|
16847
16976
|
for (const sln of solutions) {
|
|
16848
|
-
console.log(` ${
|
|
16977
|
+
console.log(` ${chalk143.green(sln)}`);
|
|
16849
16978
|
}
|
|
16850
16979
|
}
|
|
16851
16980
|
console.log();
|
|
@@ -16874,16 +17003,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
16874
17003
|
// src/commands/dotnet/resolveCsproj.ts
|
|
16875
17004
|
import { existsSync as existsSync38 } from "fs";
|
|
16876
17005
|
import path33 from "path";
|
|
16877
|
-
import
|
|
17006
|
+
import chalk144 from "chalk";
|
|
16878
17007
|
function resolveCsproj(csprojPath) {
|
|
16879
17008
|
const resolved = path33.resolve(csprojPath);
|
|
16880
17009
|
if (!existsSync38(resolved)) {
|
|
16881
|
-
console.error(
|
|
17010
|
+
console.error(chalk144.red(`File not found: ${resolved}`));
|
|
16882
17011
|
process.exit(1);
|
|
16883
17012
|
}
|
|
16884
17013
|
const repoRoot = findRepoRoot(path33.dirname(resolved));
|
|
16885
17014
|
if (!repoRoot) {
|
|
16886
|
-
console.error(
|
|
17015
|
+
console.error(chalk144.red("Could not find git repository root"));
|
|
16887
17016
|
process.exit(1);
|
|
16888
17017
|
}
|
|
16889
17018
|
return { resolved, repoRoot };
|
|
@@ -16933,12 +17062,12 @@ function getChangedCsFiles(scope) {
|
|
|
16933
17062
|
}
|
|
16934
17063
|
|
|
16935
17064
|
// src/commands/dotnet/inSln.ts
|
|
16936
|
-
import
|
|
17065
|
+
import chalk145 from "chalk";
|
|
16937
17066
|
async function inSln(csprojPath) {
|
|
16938
17067
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
16939
17068
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
16940
17069
|
if (solutions.length === 0) {
|
|
16941
|
-
console.log(
|
|
17070
|
+
console.log(chalk145.yellow("Not found in any .sln file"));
|
|
16942
17071
|
process.exit(1);
|
|
16943
17072
|
}
|
|
16944
17073
|
for (const sln of solutions) {
|
|
@@ -16947,7 +17076,7 @@ async function inSln(csprojPath) {
|
|
|
16947
17076
|
}
|
|
16948
17077
|
|
|
16949
17078
|
// src/commands/dotnet/inspect.ts
|
|
16950
|
-
import
|
|
17079
|
+
import chalk151 from "chalk";
|
|
16951
17080
|
|
|
16952
17081
|
// src/shared/formatElapsed.ts
|
|
16953
17082
|
function formatElapsed(ms) {
|
|
@@ -16959,12 +17088,12 @@ function formatElapsed(ms) {
|
|
|
16959
17088
|
}
|
|
16960
17089
|
|
|
16961
17090
|
// src/commands/dotnet/displayIssues.ts
|
|
16962
|
-
import
|
|
17091
|
+
import chalk146 from "chalk";
|
|
16963
17092
|
var SEVERITY_COLOR = {
|
|
16964
|
-
ERROR:
|
|
16965
|
-
WARNING:
|
|
16966
|
-
SUGGESTION:
|
|
16967
|
-
HINT:
|
|
17093
|
+
ERROR: chalk146.red,
|
|
17094
|
+
WARNING: chalk146.yellow,
|
|
17095
|
+
SUGGESTION: chalk146.cyan,
|
|
17096
|
+
HINT: chalk146.dim
|
|
16968
17097
|
};
|
|
16969
17098
|
function groupByFile(issues) {
|
|
16970
17099
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -16980,15 +17109,15 @@ function groupByFile(issues) {
|
|
|
16980
17109
|
}
|
|
16981
17110
|
function displayIssues(issues) {
|
|
16982
17111
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
16983
|
-
console.log(
|
|
17112
|
+
console.log(chalk146.bold(file));
|
|
16984
17113
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
16985
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
17114
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk146.white;
|
|
16986
17115
|
console.log(
|
|
16987
|
-
` ${
|
|
17116
|
+
` ${chalk146.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
16988
17117
|
);
|
|
16989
17118
|
}
|
|
16990
17119
|
}
|
|
16991
|
-
console.log(
|
|
17120
|
+
console.log(chalk146.dim(`
|
|
16992
17121
|
${issues.length} issue(s) found`));
|
|
16993
17122
|
}
|
|
16994
17123
|
|
|
@@ -17047,12 +17176,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
17047
17176
|
// src/commands/dotnet/resolveSolution.ts
|
|
17048
17177
|
import { existsSync as existsSync39 } from "fs";
|
|
17049
17178
|
import path34 from "path";
|
|
17050
|
-
import
|
|
17179
|
+
import chalk148 from "chalk";
|
|
17051
17180
|
|
|
17052
17181
|
// src/commands/dotnet/findSolution.ts
|
|
17053
17182
|
import { readdirSync as readdirSync7 } from "fs";
|
|
17054
17183
|
import { dirname as dirname22, join as join41 } from "path";
|
|
17055
|
-
import
|
|
17184
|
+
import chalk147 from "chalk";
|
|
17056
17185
|
function findSlnInDir(dir) {
|
|
17057
17186
|
try {
|
|
17058
17187
|
return readdirSync7(dir).filter((f) => f.endsWith(".sln")).map((f) => join41(dir, f));
|
|
@@ -17068,17 +17197,17 @@ function findSolution() {
|
|
|
17068
17197
|
const slnFiles = findSlnInDir(current);
|
|
17069
17198
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
17070
17199
|
if (slnFiles.length > 1) {
|
|
17071
|
-
console.error(
|
|
17200
|
+
console.error(chalk147.red(`Multiple .sln files found in ${current}:`));
|
|
17072
17201
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
17073
17202
|
console.error(
|
|
17074
|
-
|
|
17203
|
+
chalk147.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
17075
17204
|
);
|
|
17076
17205
|
process.exit(1);
|
|
17077
17206
|
}
|
|
17078
17207
|
if (current === ceiling) break;
|
|
17079
17208
|
current = dirname22(current);
|
|
17080
17209
|
}
|
|
17081
|
-
console.error(
|
|
17210
|
+
console.error(chalk147.red("No .sln file found between cwd and repo root"));
|
|
17082
17211
|
process.exit(1);
|
|
17083
17212
|
}
|
|
17084
17213
|
|
|
@@ -17087,7 +17216,7 @@ function resolveSolution(sln) {
|
|
|
17087
17216
|
if (sln) {
|
|
17088
17217
|
const resolved = path34.resolve(sln);
|
|
17089
17218
|
if (!existsSync39(resolved)) {
|
|
17090
|
-
console.error(
|
|
17219
|
+
console.error(chalk148.red(`Solution file not found: ${resolved}`));
|
|
17091
17220
|
process.exit(1);
|
|
17092
17221
|
}
|
|
17093
17222
|
return resolved;
|
|
@@ -17129,14 +17258,14 @@ import { execSync as execSync39 } from "child_process";
|
|
|
17129
17258
|
import { existsSync as existsSync40, readFileSync as readFileSync35, unlinkSync as unlinkSync10 } from "fs";
|
|
17130
17259
|
import { tmpdir as tmpdir4 } from "os";
|
|
17131
17260
|
import path35 from "path";
|
|
17132
|
-
import
|
|
17261
|
+
import chalk149 from "chalk";
|
|
17133
17262
|
function assertJbInstalled() {
|
|
17134
17263
|
try {
|
|
17135
17264
|
execSync39("jb inspectcode --version", { stdio: "pipe" });
|
|
17136
17265
|
} catch {
|
|
17137
|
-
console.error(
|
|
17266
|
+
console.error(chalk149.red("jb is not installed. Install with:"));
|
|
17138
17267
|
console.error(
|
|
17139
|
-
|
|
17268
|
+
chalk149.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
17140
17269
|
);
|
|
17141
17270
|
process.exit(1);
|
|
17142
17271
|
}
|
|
@@ -17154,11 +17283,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
17154
17283
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
17155
17284
|
process.stderr.write(error.stderr);
|
|
17156
17285
|
}
|
|
17157
|
-
console.error(
|
|
17286
|
+
console.error(chalk149.red("jb inspectcode failed"));
|
|
17158
17287
|
process.exit(1);
|
|
17159
17288
|
}
|
|
17160
17289
|
if (!existsSync40(reportPath)) {
|
|
17161
|
-
console.error(
|
|
17290
|
+
console.error(chalk149.red("Report file not generated"));
|
|
17162
17291
|
process.exit(1);
|
|
17163
17292
|
}
|
|
17164
17293
|
const xml = readFileSync35(reportPath, "utf8");
|
|
@@ -17168,7 +17297,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
17168
17297
|
|
|
17169
17298
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
17170
17299
|
import { execSync as execSync40 } from "child_process";
|
|
17171
|
-
import
|
|
17300
|
+
import chalk150 from "chalk";
|
|
17172
17301
|
function resolveMsbuildPath() {
|
|
17173
17302
|
const { run: run4 } = loadConfig();
|
|
17174
17303
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -17180,9 +17309,9 @@ function assertMsbuildInstalled() {
|
|
|
17180
17309
|
try {
|
|
17181
17310
|
execSync40(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
17182
17311
|
} catch {
|
|
17183
|
-
console.error(
|
|
17312
|
+
console.error(chalk150.red(`msbuild not found at: ${msbuild}`));
|
|
17184
17313
|
console.error(
|
|
17185
|
-
|
|
17314
|
+
chalk150.yellow(
|
|
17186
17315
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
17187
17316
|
)
|
|
17188
17317
|
);
|
|
@@ -17229,17 +17358,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
17229
17358
|
// src/commands/dotnet/inspect.ts
|
|
17230
17359
|
function logScope(changedFiles2) {
|
|
17231
17360
|
if (changedFiles2 === null) {
|
|
17232
|
-
console.log(
|
|
17361
|
+
console.log(chalk151.dim("Inspecting full solution..."));
|
|
17233
17362
|
} else {
|
|
17234
17363
|
console.log(
|
|
17235
|
-
|
|
17364
|
+
chalk151.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
17236
17365
|
);
|
|
17237
17366
|
}
|
|
17238
17367
|
}
|
|
17239
17368
|
function reportResults(issues, elapsed) {
|
|
17240
17369
|
if (issues.length > 0) displayIssues(issues);
|
|
17241
|
-
else console.log(
|
|
17242
|
-
console.log(
|
|
17370
|
+
else console.log(chalk151.green("No issues found"));
|
|
17371
|
+
console.log(chalk151.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
17243
17372
|
if (issues.length > 0) process.exit(1);
|
|
17244
17373
|
}
|
|
17245
17374
|
async function inspect(sln, options2) {
|
|
@@ -17250,7 +17379,7 @@ async function inspect(sln, options2) {
|
|
|
17250
17379
|
const scope = parseScope(options2.scope);
|
|
17251
17380
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
17252
17381
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
17253
|
-
console.log(
|
|
17382
|
+
console.log(chalk151.green("No changed .cs files found"));
|
|
17254
17383
|
return;
|
|
17255
17384
|
}
|
|
17256
17385
|
logScope(changedFiles2);
|
|
@@ -17633,25 +17762,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
17633
17762
|
}
|
|
17634
17763
|
|
|
17635
17764
|
// src/commands/github/printCountTable.ts
|
|
17636
|
-
import
|
|
17765
|
+
import chalk152 from "chalk";
|
|
17637
17766
|
function printCountTable(labelHeader, rows) {
|
|
17638
17767
|
const labelWidth = Math.max(
|
|
17639
17768
|
labelHeader.length,
|
|
17640
17769
|
...rows.map((row) => row.label.length)
|
|
17641
17770
|
);
|
|
17642
17771
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
17643
|
-
console.log(
|
|
17644
|
-
console.log(
|
|
17772
|
+
console.log(chalk152.dim(header));
|
|
17773
|
+
console.log(chalk152.dim("-".repeat(header.length)));
|
|
17645
17774
|
for (const row of rows) {
|
|
17646
17775
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
17647
17776
|
}
|
|
17648
17777
|
}
|
|
17649
17778
|
|
|
17650
17779
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
17651
|
-
import
|
|
17780
|
+
import chalk153 from "chalk";
|
|
17652
17781
|
function printRepoAuthorBreakdown(repos2) {
|
|
17653
17782
|
for (const repo of repos2) {
|
|
17654
|
-
console.log(
|
|
17783
|
+
console.log(chalk153.bold(repo.name));
|
|
17655
17784
|
const authorWidth = Math.max(
|
|
17656
17785
|
0,
|
|
17657
17786
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -17969,7 +18098,7 @@ function registerHandover(program2) {
|
|
|
17969
18098
|
}
|
|
17970
18099
|
|
|
17971
18100
|
// src/commands/jira/acceptanceCriteria.ts
|
|
17972
|
-
import
|
|
18101
|
+
import chalk154 from "chalk";
|
|
17973
18102
|
|
|
17974
18103
|
// src/commands/jira/adfToText.ts
|
|
17975
18104
|
function renderInline(node) {
|
|
@@ -18036,7 +18165,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
18036
18165
|
const parsed = fetchIssue(issueKey, field);
|
|
18037
18166
|
const acValue = parsed?.fields?.[field];
|
|
18038
18167
|
if (!acValue) {
|
|
18039
|
-
console.log(
|
|
18168
|
+
console.log(chalk154.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
18040
18169
|
return;
|
|
18041
18170
|
}
|
|
18042
18171
|
if (typeof acValue === "string") {
|
|
@@ -18102,14 +18231,14 @@ async function jiraAuth() {
|
|
|
18102
18231
|
}
|
|
18103
18232
|
|
|
18104
18233
|
// src/commands/jira/viewIssue.ts
|
|
18105
|
-
import
|
|
18234
|
+
import chalk155 from "chalk";
|
|
18106
18235
|
function viewIssue(issueKey) {
|
|
18107
18236
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
18108
18237
|
const fields = parsed?.fields;
|
|
18109
18238
|
const summary = fields?.summary;
|
|
18110
18239
|
const description = fields?.description;
|
|
18111
18240
|
if (summary) {
|
|
18112
|
-
console.log(
|
|
18241
|
+
console.log(chalk155.bold(summary));
|
|
18113
18242
|
}
|
|
18114
18243
|
if (description) {
|
|
18115
18244
|
if (summary) console.log();
|
|
@@ -18123,7 +18252,7 @@ function viewIssue(issueKey) {
|
|
|
18123
18252
|
}
|
|
18124
18253
|
if (!summary && !description) {
|
|
18125
18254
|
console.log(
|
|
18126
|
-
|
|
18255
|
+
chalk155.yellow(`No summary or description found on ${issueKey}.`)
|
|
18127
18256
|
);
|
|
18128
18257
|
}
|
|
18129
18258
|
}
|
|
@@ -18181,7 +18310,7 @@ import { randomUUID as randomUUID5 } from "crypto";
|
|
|
18181
18310
|
|
|
18182
18311
|
// src/commands/review/checkoutPr.ts
|
|
18183
18312
|
import { execFileSync as execFileSync6 } from "child_process";
|
|
18184
|
-
import
|
|
18313
|
+
import chalk156 from "chalk";
|
|
18185
18314
|
|
|
18186
18315
|
// src/commands/sessions/daemon/daemonLog.ts
|
|
18187
18316
|
var RING_CAPACITY = 1e3;
|
|
@@ -18557,7 +18686,7 @@ async function checkoutPr(number) {
|
|
|
18557
18686
|
try {
|
|
18558
18687
|
execFileSync6("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
18559
18688
|
} catch {
|
|
18560
|
-
console.error(
|
|
18689
|
+
console.error(chalk156.red(`gh pr checkout ${number} failed; aborting.`));
|
|
18561
18690
|
process.exit(1);
|
|
18562
18691
|
}
|
|
18563
18692
|
}
|
|
@@ -18634,15 +18763,15 @@ function registerList(program2) {
|
|
|
18634
18763
|
// src/commands/mermaid/index.ts
|
|
18635
18764
|
import { mkdirSync as mkdirSync17, readdirSync as readdirSync9 } from "fs";
|
|
18636
18765
|
import { resolve as resolve13 } from "path";
|
|
18637
|
-
import
|
|
18766
|
+
import chalk159 from "chalk";
|
|
18638
18767
|
|
|
18639
18768
|
// src/commands/mermaid/exportFile.ts
|
|
18640
18769
|
import { readFileSync as readFileSync37, writeFileSync as writeFileSync31 } from "fs";
|
|
18641
18770
|
import { basename as basename13, extname as extname2, resolve as resolve12 } from "path";
|
|
18642
|
-
import
|
|
18771
|
+
import chalk158 from "chalk";
|
|
18643
18772
|
|
|
18644
18773
|
// src/commands/mermaid/renderBlock.ts
|
|
18645
|
-
import
|
|
18774
|
+
import chalk157 from "chalk";
|
|
18646
18775
|
async function renderBlock(krokiUrl, source) {
|
|
18647
18776
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
18648
18777
|
method: "POST",
|
|
@@ -18651,7 +18780,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
18651
18780
|
});
|
|
18652
18781
|
if (!response.ok) {
|
|
18653
18782
|
console.error(
|
|
18654
|
-
|
|
18783
|
+
chalk157.red(
|
|
18655
18784
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
18656
18785
|
)
|
|
18657
18786
|
);
|
|
@@ -18669,19 +18798,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
18669
18798
|
if (onlyIndex !== void 0) {
|
|
18670
18799
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
18671
18800
|
console.error(
|
|
18672
|
-
|
|
18801
|
+
chalk158.red(
|
|
18673
18802
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
18674
18803
|
)
|
|
18675
18804
|
);
|
|
18676
18805
|
process.exit(1);
|
|
18677
18806
|
}
|
|
18678
18807
|
console.log(
|
|
18679
|
-
|
|
18808
|
+
chalk158.gray(
|
|
18680
18809
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
18681
18810
|
)
|
|
18682
18811
|
);
|
|
18683
18812
|
} else {
|
|
18684
|
-
console.log(
|
|
18813
|
+
console.log(chalk158.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
18685
18814
|
}
|
|
18686
18815
|
for (const [i, source] of blocks.entries()) {
|
|
18687
18816
|
const idx = i + 1;
|
|
@@ -18689,7 +18818,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
18689
18818
|
const outPath = resolve12(outDir, `${stem}-${idx}.svg`);
|
|
18690
18819
|
const svg = await renderBlock(krokiUrl, source);
|
|
18691
18820
|
writeFileSync31(outPath, svg, "utf8");
|
|
18692
|
-
console.log(
|
|
18821
|
+
console.log(chalk158.green(` \u2192 ${outPath}`));
|
|
18693
18822
|
}
|
|
18694
18823
|
}
|
|
18695
18824
|
function extractMermaidBlocks(markdown) {
|
|
@@ -18705,18 +18834,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
18705
18834
|
if (options2.index !== void 0) {
|
|
18706
18835
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
18707
18836
|
console.error(
|
|
18708
|
-
|
|
18837
|
+
chalk159.red(`--index must be a positive integer (got ${options2.index})`)
|
|
18709
18838
|
);
|
|
18710
18839
|
process.exit(1);
|
|
18711
18840
|
}
|
|
18712
18841
|
if (!file) {
|
|
18713
|
-
console.error(
|
|
18842
|
+
console.error(chalk159.red("--index requires a file argument"));
|
|
18714
18843
|
process.exit(1);
|
|
18715
18844
|
}
|
|
18716
18845
|
}
|
|
18717
18846
|
const files = file ? [file] : readdirSync9(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
18718
18847
|
if (files.length === 0) {
|
|
18719
|
-
console.log(
|
|
18848
|
+
console.log(chalk159.gray("No markdown files found in current directory."));
|
|
18720
18849
|
return;
|
|
18721
18850
|
}
|
|
18722
18851
|
for (const f of files) {
|
|
@@ -18749,7 +18878,7 @@ function registerMermaid(program2) {
|
|
|
18749
18878
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
18750
18879
|
import { createServer as createServer2 } from "http";
|
|
18751
18880
|
import { dirname as dirname26 } from "path";
|
|
18752
|
-
import
|
|
18881
|
+
import chalk161 from "chalk";
|
|
18753
18882
|
|
|
18754
18883
|
// src/commands/netcap/corsHeaders.ts
|
|
18755
18884
|
var corsHeaders = {
|
|
@@ -18828,7 +18957,7 @@ function createNetcapHandler(options2) {
|
|
|
18828
18957
|
import { cp, readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
|
|
18829
18958
|
import { networkInterfaces } from "os";
|
|
18830
18959
|
import { join as join50 } from "path";
|
|
18831
|
-
import
|
|
18960
|
+
import chalk160 from "chalk";
|
|
18832
18961
|
|
|
18833
18962
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
18834
18963
|
import { dirname as dirname25, join as join49 } from "path";
|
|
@@ -18872,7 +19001,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
18872
19001
|
const host = lanIPv4();
|
|
18873
19002
|
if (!host) {
|
|
18874
19003
|
console.log(
|
|
18875
|
-
|
|
19004
|
+
chalk160.yellow("could not determine the WSL IP for the extension")
|
|
18876
19005
|
);
|
|
18877
19006
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
18878
19007
|
return source;
|
|
@@ -18883,7 +19012,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
18883
19012
|
return WSL_WINDOWS_PATH;
|
|
18884
19013
|
} catch {
|
|
18885
19014
|
console.log(
|
|
18886
|
-
|
|
19015
|
+
chalk160.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
18887
19016
|
);
|
|
18888
19017
|
return source;
|
|
18889
19018
|
}
|
|
@@ -18916,30 +19045,30 @@ async function netcap(options2) {
|
|
|
18916
19045
|
let count8 = 0;
|
|
18917
19046
|
const handler = createNetcapHandler({
|
|
18918
19047
|
outPath,
|
|
18919
|
-
onPing: () => console.log(
|
|
19048
|
+
onPing: () => console.log(chalk161.dim("ping from extension")),
|
|
18920
19049
|
onCapture: (entry) => {
|
|
18921
19050
|
count8 += 1;
|
|
18922
19051
|
console.log(
|
|
18923
|
-
|
|
18924
|
-
|
|
19052
|
+
chalk161.green(`captured #${count8}`),
|
|
19053
|
+
chalk161.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
18925
19054
|
);
|
|
18926
19055
|
}
|
|
18927
19056
|
});
|
|
18928
19057
|
const server = createServer2(handler);
|
|
18929
19058
|
server.listen(port, () => {
|
|
18930
19059
|
console.log(
|
|
18931
|
-
|
|
19060
|
+
chalk161.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
18932
19061
|
);
|
|
18933
|
-
console.log(
|
|
19062
|
+
console.log(chalk161.dim(`appending captures to ${outPath}`));
|
|
18934
19063
|
if (filter)
|
|
18935
|
-
console.log(
|
|
18936
|
-
console.log(
|
|
18937
|
-
console.log(
|
|
19064
|
+
console.log(chalk161.dim(`forwarding only URLs matching "${filter}"`));
|
|
19065
|
+
console.log(chalk161.dim(`load the unpacked extension from ${extensionPath}`));
|
|
19066
|
+
console.log(chalk161.dim("press Ctrl-C to stop"));
|
|
18938
19067
|
});
|
|
18939
19068
|
process.on("SIGINT", () => {
|
|
18940
19069
|
server.close();
|
|
18941
19070
|
console.log(
|
|
18942
|
-
|
|
19071
|
+
chalk161.bold(
|
|
18943
19072
|
`
|
|
18944
19073
|
netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
18945
19074
|
)
|
|
@@ -18951,7 +19080,7 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
18951
19080
|
// src/commands/netcap/netcapExtract.ts
|
|
18952
19081
|
import { writeFileSync as writeFileSync32 } from "fs";
|
|
18953
19082
|
import { join as join53 } from "path";
|
|
18954
|
-
import
|
|
19083
|
+
import chalk162 from "chalk";
|
|
18955
19084
|
|
|
18956
19085
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
18957
19086
|
import { readFileSync as readFileSync38 } from "fs";
|
|
@@ -19399,8 +19528,8 @@ function netcapExtract(file) {
|
|
|
19399
19528
|
writeFileSync32(outFile, `${JSON.stringify(posts, null, 2)}
|
|
19400
19529
|
`);
|
|
19401
19530
|
console.log(
|
|
19402
|
-
|
|
19403
|
-
|
|
19531
|
+
chalk162.green(`extracted ${posts.length} posts`),
|
|
19532
|
+
chalk162.dim(`-> ${outFile}`)
|
|
19404
19533
|
);
|
|
19405
19534
|
}
|
|
19406
19535
|
|
|
@@ -19421,7 +19550,7 @@ function registerNetcap(program2) {
|
|
|
19421
19550
|
}
|
|
19422
19551
|
|
|
19423
19552
|
// src/commands/news/add/index.ts
|
|
19424
|
-
import
|
|
19553
|
+
import chalk163 from "chalk";
|
|
19425
19554
|
import enquirer8 from "enquirer";
|
|
19426
19555
|
async function add2(url) {
|
|
19427
19556
|
if (!url) {
|
|
@@ -19443,10 +19572,10 @@ async function add2(url) {
|
|
|
19443
19572
|
const { orm } = await getReady();
|
|
19444
19573
|
const added = await addFeed(orm, url);
|
|
19445
19574
|
if (!added) {
|
|
19446
|
-
console.log(
|
|
19575
|
+
console.log(chalk163.yellow("Feed already exists"));
|
|
19447
19576
|
return;
|
|
19448
19577
|
}
|
|
19449
|
-
console.log(
|
|
19578
|
+
console.log(chalk163.green(`Added feed: ${url}`));
|
|
19450
19579
|
}
|
|
19451
19580
|
|
|
19452
19581
|
// src/commands/registerNews.ts
|
|
@@ -19493,7 +19622,7 @@ function registerPiHook(program2) {
|
|
|
19493
19622
|
}
|
|
19494
19623
|
|
|
19495
19624
|
// src/commands/prompts/printPromptsTable.ts
|
|
19496
|
-
import
|
|
19625
|
+
import chalk164 from "chalk";
|
|
19497
19626
|
function truncate(str, max) {
|
|
19498
19627
|
if (str.length <= max) return str;
|
|
19499
19628
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -19511,14 +19640,14 @@ function printPromptsTable(rows) {
|
|
|
19511
19640
|
"Command".padEnd(commandWidth),
|
|
19512
19641
|
"Repos"
|
|
19513
19642
|
].join(" ");
|
|
19514
|
-
console.log(
|
|
19515
|
-
console.log(
|
|
19643
|
+
console.log(chalk164.dim(header));
|
|
19644
|
+
console.log(chalk164.dim("-".repeat(header.length)));
|
|
19516
19645
|
for (const row of rows) {
|
|
19517
19646
|
const count8 = String(row.count).padStart(countWidth);
|
|
19518
19647
|
const tool = row.tool.padEnd(toolWidth);
|
|
19519
19648
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
19520
19649
|
console.log(
|
|
19521
|
-
`${
|
|
19650
|
+
`${chalk164.yellow(count8)} ${tool} ${command} ${chalk164.dim(row.repos)}`
|
|
19522
19651
|
);
|
|
19523
19652
|
}
|
|
19524
19653
|
}
|
|
@@ -20085,20 +20214,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
20085
20214
|
}
|
|
20086
20215
|
|
|
20087
20216
|
// src/commands/prs/listComments/printComments.ts
|
|
20088
|
-
import
|
|
20217
|
+
import chalk165 from "chalk";
|
|
20089
20218
|
function formatForHuman(comment3) {
|
|
20090
20219
|
if (comment3.type === "review") {
|
|
20091
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
20220
|
+
const stateColor = comment3.state === "APPROVED" ? chalk165.green : comment3.state === "CHANGES_REQUESTED" ? chalk165.red : chalk165.yellow;
|
|
20092
20221
|
return [
|
|
20093
|
-
`${
|
|
20222
|
+
`${chalk165.cyan("Review")} by ${chalk165.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
20094
20223
|
comment3.body,
|
|
20095
20224
|
""
|
|
20096
20225
|
].join("\n");
|
|
20097
20226
|
}
|
|
20098
20227
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
20099
20228
|
return [
|
|
20100
|
-
`${
|
|
20101
|
-
|
|
20229
|
+
`${chalk165.cyan("Line comment")} by ${chalk165.bold(comment3.user)} on ${chalk165.dim(`${comment3.path}${location}`)}`,
|
|
20230
|
+
chalk165.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
20102
20231
|
comment3.body,
|
|
20103
20232
|
""
|
|
20104
20233
|
].join("\n");
|
|
@@ -20188,13 +20317,13 @@ import { execSync as execSync48 } from "child_process";
|
|
|
20188
20317
|
import enquirer9 from "enquirer";
|
|
20189
20318
|
|
|
20190
20319
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
20191
|
-
import
|
|
20320
|
+
import chalk166 from "chalk";
|
|
20192
20321
|
var STATUS_MAP = {
|
|
20193
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
20194
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
20322
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk166.magenta("merged"), date: pr.mergedAt } : null,
|
|
20323
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk166.red("closed"), date: pr.closedAt } : null
|
|
20195
20324
|
};
|
|
20196
20325
|
function defaultStatus(pr) {
|
|
20197
|
-
return { label:
|
|
20326
|
+
return { label: chalk166.green("opened"), date: pr.createdAt };
|
|
20198
20327
|
}
|
|
20199
20328
|
function getStatus2(pr) {
|
|
20200
20329
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -20203,11 +20332,11 @@ function formatDate(dateStr) {
|
|
|
20203
20332
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
20204
20333
|
}
|
|
20205
20334
|
function formatPrHeader(pr, status3) {
|
|
20206
|
-
return `${
|
|
20335
|
+
return `${chalk166.cyan(`#${pr.number}`)} ${pr.title} ${chalk166.dim(`(${pr.author.login},`)} ${status3.label} ${chalk166.dim(`${formatDate(status3.date)})`)}`;
|
|
20207
20336
|
}
|
|
20208
20337
|
function logPrDetails(pr) {
|
|
20209
20338
|
console.log(
|
|
20210
|
-
|
|
20339
|
+
chalk166.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
20211
20340
|
);
|
|
20212
20341
|
console.log();
|
|
20213
20342
|
}
|
|
@@ -20722,10 +20851,10 @@ function registerPrs(program2) {
|
|
|
20722
20851
|
}
|
|
20723
20852
|
|
|
20724
20853
|
// src/commands/ravendb/ravendbAuth.ts
|
|
20725
|
-
import
|
|
20854
|
+
import chalk172 from "chalk";
|
|
20726
20855
|
|
|
20727
20856
|
// src/shared/createConnectionAuth.ts
|
|
20728
|
-
import
|
|
20857
|
+
import chalk167 from "chalk";
|
|
20729
20858
|
function listConnections(connections, format) {
|
|
20730
20859
|
if (connections.length === 0) {
|
|
20731
20860
|
console.log("No connections configured.");
|
|
@@ -20738,7 +20867,7 @@ function listConnections(connections, format) {
|
|
|
20738
20867
|
function removeConnection(connections, name, save) {
|
|
20739
20868
|
const filtered = connections.filter((c) => c.name !== name);
|
|
20740
20869
|
if (filtered.length === connections.length) {
|
|
20741
|
-
console.error(
|
|
20870
|
+
console.error(chalk167.red(`Connection "${name}" not found.`));
|
|
20742
20871
|
process.exit(1);
|
|
20743
20872
|
}
|
|
20744
20873
|
save(filtered);
|
|
@@ -20784,15 +20913,15 @@ function saveConnections(connections) {
|
|
|
20784
20913
|
}
|
|
20785
20914
|
|
|
20786
20915
|
// src/commands/ravendb/promptConnection.ts
|
|
20787
|
-
import
|
|
20916
|
+
import chalk170 from "chalk";
|
|
20788
20917
|
|
|
20789
20918
|
// src/commands/ravendb/selectOpSecret.ts
|
|
20790
|
-
import
|
|
20919
|
+
import chalk169 from "chalk";
|
|
20791
20920
|
import Enquirer2 from "enquirer";
|
|
20792
20921
|
|
|
20793
20922
|
// src/commands/ravendb/searchItems.ts
|
|
20794
20923
|
import { execSync as execSync51 } from "child_process";
|
|
20795
|
-
import
|
|
20924
|
+
import chalk168 from "chalk";
|
|
20796
20925
|
function opExec(args) {
|
|
20797
20926
|
return execSync51(`op ${args}`, {
|
|
20798
20927
|
encoding: "utf8",
|
|
@@ -20805,7 +20934,7 @@ function searchItems(search2) {
|
|
|
20805
20934
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
20806
20935
|
} catch {
|
|
20807
20936
|
console.error(
|
|
20808
|
-
|
|
20937
|
+
chalk168.red(
|
|
20809
20938
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
20810
20939
|
)
|
|
20811
20940
|
);
|
|
@@ -20819,7 +20948,7 @@ function getItemFields(itemId2) {
|
|
|
20819
20948
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
20820
20949
|
return item.fields.filter((f) => f.reference && f.label);
|
|
20821
20950
|
} catch {
|
|
20822
|
-
console.error(
|
|
20951
|
+
console.error(chalk168.red("Failed to get item details from 1Password."));
|
|
20823
20952
|
process.exit(1);
|
|
20824
20953
|
}
|
|
20825
20954
|
}
|
|
@@ -20838,7 +20967,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
20838
20967
|
}).run();
|
|
20839
20968
|
const items2 = searchItems(search2);
|
|
20840
20969
|
if (items2.length === 0) {
|
|
20841
|
-
console.error(
|
|
20970
|
+
console.error(chalk169.red(`No items found matching "${search2}".`));
|
|
20842
20971
|
process.exit(1);
|
|
20843
20972
|
}
|
|
20844
20973
|
const itemId2 = await selectOne(
|
|
@@ -20847,7 +20976,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
20847
20976
|
);
|
|
20848
20977
|
const fields = getItemFields(itemId2);
|
|
20849
20978
|
if (fields.length === 0) {
|
|
20850
|
-
console.error(
|
|
20979
|
+
console.error(chalk169.red("No fields with references found on this item."));
|
|
20851
20980
|
process.exit(1);
|
|
20852
20981
|
}
|
|
20853
20982
|
const ref = await selectOne(
|
|
@@ -20861,7 +20990,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
20861
20990
|
async function promptConnection(existingNames) {
|
|
20862
20991
|
const name = await promptInput("name", "Connection name:");
|
|
20863
20992
|
if (existingNames.includes(name)) {
|
|
20864
|
-
console.error(
|
|
20993
|
+
console.error(chalk170.red(`Connection "${name}" already exists.`));
|
|
20865
20994
|
process.exit(1);
|
|
20866
20995
|
}
|
|
20867
20996
|
const url = await promptInput(
|
|
@@ -20870,22 +20999,22 @@ async function promptConnection(existingNames) {
|
|
|
20870
20999
|
);
|
|
20871
21000
|
const database = await promptInput("database", "Database name:");
|
|
20872
21001
|
if (!name || !url || !database) {
|
|
20873
|
-
console.error(
|
|
21002
|
+
console.error(chalk170.red("All fields are required."));
|
|
20874
21003
|
process.exit(1);
|
|
20875
21004
|
}
|
|
20876
21005
|
const apiKeyRef = await selectOpSecret();
|
|
20877
|
-
console.log(
|
|
21006
|
+
console.log(chalk170.dim(`Using: ${apiKeyRef}`));
|
|
20878
21007
|
return { name, url, database, apiKeyRef };
|
|
20879
21008
|
}
|
|
20880
21009
|
|
|
20881
21010
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
20882
|
-
import
|
|
21011
|
+
import chalk171 from "chalk";
|
|
20883
21012
|
function ravendbSetConnection(name) {
|
|
20884
21013
|
const raw = loadGlobalConfigRaw();
|
|
20885
21014
|
const ravendb = raw.ravendb ?? {};
|
|
20886
21015
|
const connections = ravendb.connections ?? [];
|
|
20887
21016
|
if (!connections.some((c) => c.name === name)) {
|
|
20888
|
-
console.error(
|
|
21017
|
+
console.error(chalk171.red(`Connection "${name}" not found.`));
|
|
20889
21018
|
console.error(
|
|
20890
21019
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
20891
21020
|
);
|
|
@@ -20901,16 +21030,16 @@ function ravendbSetConnection(name) {
|
|
|
20901
21030
|
var ravendbAuth = createConnectionAuth({
|
|
20902
21031
|
load: loadConnections,
|
|
20903
21032
|
save: saveConnections,
|
|
20904
|
-
format: (c) => `${
|
|
21033
|
+
format: (c) => `${chalk172.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
20905
21034
|
promptNew: promptConnection,
|
|
20906
21035
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
20907
21036
|
});
|
|
20908
21037
|
|
|
20909
21038
|
// src/commands/ravendb/ravendbCollections.ts
|
|
20910
|
-
import
|
|
21039
|
+
import chalk176 from "chalk";
|
|
20911
21040
|
|
|
20912
21041
|
// src/commands/ravendb/ravenFetch.ts
|
|
20913
|
-
import
|
|
21042
|
+
import chalk174 from "chalk";
|
|
20914
21043
|
|
|
20915
21044
|
// src/commands/ravendb/getAccessToken.ts
|
|
20916
21045
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -20947,10 +21076,10 @@ ${errorText}`
|
|
|
20947
21076
|
|
|
20948
21077
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
20949
21078
|
import { execSync as execSync52 } from "child_process";
|
|
20950
|
-
import
|
|
21079
|
+
import chalk173 from "chalk";
|
|
20951
21080
|
function resolveOpSecret(reference) {
|
|
20952
21081
|
if (!reference.startsWith("op://")) {
|
|
20953
|
-
console.error(
|
|
21082
|
+
console.error(chalk173.red(`Invalid secret reference: must start with op://`));
|
|
20954
21083
|
process.exit(1);
|
|
20955
21084
|
}
|
|
20956
21085
|
try {
|
|
@@ -20960,7 +21089,7 @@ function resolveOpSecret(reference) {
|
|
|
20960
21089
|
}).trim();
|
|
20961
21090
|
} catch {
|
|
20962
21091
|
console.error(
|
|
20963
|
-
|
|
21092
|
+
chalk173.red(
|
|
20964
21093
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
20965
21094
|
)
|
|
20966
21095
|
);
|
|
@@ -20987,7 +21116,7 @@ async function ravenFetch(connection, path71) {
|
|
|
20987
21116
|
if (!response.ok) {
|
|
20988
21117
|
const body = await response.text();
|
|
20989
21118
|
console.error(
|
|
20990
|
-
|
|
21119
|
+
chalk174.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
20991
21120
|
);
|
|
20992
21121
|
console.error(body.substring(0, 500));
|
|
20993
21122
|
process.exit(1);
|
|
@@ -20996,7 +21125,7 @@ async function ravenFetch(connection, path71) {
|
|
|
20996
21125
|
}
|
|
20997
21126
|
|
|
20998
21127
|
// src/commands/ravendb/resolveConnection.ts
|
|
20999
|
-
import
|
|
21128
|
+
import chalk175 from "chalk";
|
|
21000
21129
|
function loadRavendb() {
|
|
21001
21130
|
const raw = loadGlobalConfigRaw();
|
|
21002
21131
|
const ravendb = raw.ravendb;
|
|
@@ -21010,7 +21139,7 @@ function resolveConnection(name) {
|
|
|
21010
21139
|
const connectionName = name ?? defaultConnection;
|
|
21011
21140
|
if (!connectionName) {
|
|
21012
21141
|
console.error(
|
|
21013
|
-
|
|
21142
|
+
chalk175.red(
|
|
21014
21143
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
21015
21144
|
)
|
|
21016
21145
|
);
|
|
@@ -21018,7 +21147,7 @@ function resolveConnection(name) {
|
|
|
21018
21147
|
}
|
|
21019
21148
|
const connection = connections.find((c) => c.name === connectionName);
|
|
21020
21149
|
if (!connection) {
|
|
21021
|
-
console.error(
|
|
21150
|
+
console.error(chalk175.red(`Connection "${connectionName}" not found.`));
|
|
21022
21151
|
console.error(
|
|
21023
21152
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
21024
21153
|
);
|
|
@@ -21049,7 +21178,7 @@ async function ravendbCollections(connectionName) {
|
|
|
21049
21178
|
return;
|
|
21050
21179
|
}
|
|
21051
21180
|
for (const c of collections) {
|
|
21052
|
-
console.log(`${
|
|
21181
|
+
console.log(`${chalk176.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
21053
21182
|
}
|
|
21054
21183
|
}
|
|
21055
21184
|
|
|
@@ -21068,10 +21197,10 @@ var ravendbConfigHelp = [
|
|
|
21068
21197
|
];
|
|
21069
21198
|
|
|
21070
21199
|
// src/commands/ravendb/ravendbQuery.ts
|
|
21071
|
-
import
|
|
21200
|
+
import chalk178 from "chalk";
|
|
21072
21201
|
|
|
21073
21202
|
// src/commands/ravendb/fetchAllPages.ts
|
|
21074
|
-
import
|
|
21203
|
+
import chalk177 from "chalk";
|
|
21075
21204
|
|
|
21076
21205
|
// src/commands/ravendb/buildQueryPath.ts
|
|
21077
21206
|
function buildQueryPath(opts) {
|
|
@@ -21109,7 +21238,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
21109
21238
|
allResults.push(...results);
|
|
21110
21239
|
start3 += results.length;
|
|
21111
21240
|
process.stderr.write(
|
|
21112
|
-
`\r${
|
|
21241
|
+
`\r${chalk177.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
21113
21242
|
);
|
|
21114
21243
|
if (start3 >= totalResults) break;
|
|
21115
21244
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -21124,7 +21253,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
21124
21253
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
21125
21254
|
const resolved = resolveArgs(connectionName, collection);
|
|
21126
21255
|
if (!resolved.collection && !options2.query) {
|
|
21127
|
-
console.error(
|
|
21256
|
+
console.error(chalk178.red("Provide a collection name or --query filter."));
|
|
21128
21257
|
process.exit(1);
|
|
21129
21258
|
}
|
|
21130
21259
|
const { collection: col } = resolved;
|
|
@@ -21163,7 +21292,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
21163
21292
|
import * as path36 from "path";
|
|
21164
21293
|
|
|
21165
21294
|
// src/commands/refactor/logViolations.ts
|
|
21166
|
-
import
|
|
21295
|
+
import chalk179 from "chalk";
|
|
21167
21296
|
var DEFAULT_MAX_LINES = 100;
|
|
21168
21297
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
21169
21298
|
if (violations.length === 0) {
|
|
@@ -21172,43 +21301,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
21172
21301
|
}
|
|
21173
21302
|
return;
|
|
21174
21303
|
}
|
|
21175
|
-
console.error(
|
|
21304
|
+
console.error(chalk179.red(`
|
|
21176
21305
|
Refactor check failed:
|
|
21177
21306
|
`));
|
|
21178
|
-
console.error(
|
|
21307
|
+
console.error(chalk179.red(` The following files exceed ${maxLines} lines:
|
|
21179
21308
|
`));
|
|
21180
21309
|
for (const violation of violations) {
|
|
21181
|
-
console.error(
|
|
21310
|
+
console.error(chalk179.red(` ${violation.file} (${violation.lines} lines)`));
|
|
21182
21311
|
}
|
|
21183
21312
|
console.error(
|
|
21184
|
-
|
|
21313
|
+
chalk179.yellow(
|
|
21185
21314
|
`
|
|
21186
21315
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
21187
21316
|
way to refactor it, ignore it with:
|
|
21188
21317
|
`
|
|
21189
21318
|
)
|
|
21190
21319
|
);
|
|
21191
|
-
console.error(
|
|
21320
|
+
console.error(chalk179.gray(` assist refactor ignore <file>
|
|
21192
21321
|
`));
|
|
21193
21322
|
if (process.env.CLAUDECODE) {
|
|
21194
|
-
console.error(
|
|
21323
|
+
console.error(chalk179.cyan(`
|
|
21195
21324
|
## Extracting Code to New Files
|
|
21196
21325
|
`));
|
|
21197
21326
|
console.error(
|
|
21198
|
-
|
|
21327
|
+
chalk179.cyan(
|
|
21199
21328
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
21200
21329
|
`
|
|
21201
21330
|
)
|
|
21202
21331
|
);
|
|
21203
21332
|
console.error(
|
|
21204
|
-
|
|
21333
|
+
chalk179.cyan(
|
|
21205
21334
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
21206
21335
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
21207
21336
|
`
|
|
21208
21337
|
)
|
|
21209
21338
|
);
|
|
21210
21339
|
console.error(
|
|
21211
|
-
|
|
21340
|
+
chalk179.cyan(
|
|
21212
21341
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
21213
21342
|
domains, move it to a common/shared folder.
|
|
21214
21343
|
`
|
|
@@ -21364,7 +21493,7 @@ async function check(pattern2, options2) {
|
|
|
21364
21493
|
|
|
21365
21494
|
// src/commands/refactor/extract/index.ts
|
|
21366
21495
|
import path44 from "path";
|
|
21367
|
-
import
|
|
21496
|
+
import chalk182 from "chalk";
|
|
21368
21497
|
|
|
21369
21498
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
21370
21499
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -21963,23 +22092,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
21963
22092
|
|
|
21964
22093
|
// src/commands/refactor/extract/displayPlan.ts
|
|
21965
22094
|
import path40 from "path";
|
|
21966
|
-
import
|
|
22095
|
+
import chalk180 from "chalk";
|
|
21967
22096
|
function section2(title) {
|
|
21968
22097
|
return `
|
|
21969
|
-
${
|
|
22098
|
+
${chalk180.cyan(title)}`;
|
|
21970
22099
|
}
|
|
21971
22100
|
function displayImporters(plan2, cwd) {
|
|
21972
22101
|
if (plan2.importersToUpdate.length === 0) return;
|
|
21973
22102
|
console.log(section2("Update importers:"));
|
|
21974
22103
|
for (const imp of plan2.importersToUpdate) {
|
|
21975
22104
|
const rel = path40.relative(cwd, imp.file.getFilePath());
|
|
21976
|
-
console.log(` ${
|
|
22105
|
+
console.log(` ${chalk180.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
21977
22106
|
}
|
|
21978
22107
|
}
|
|
21979
22108
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
21980
|
-
console.log(
|
|
22109
|
+
console.log(chalk180.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
21981
22110
|
`));
|
|
21982
|
-
console.log(` ${
|
|
22111
|
+
console.log(` ${chalk180.cyan("Functions to move:")}`);
|
|
21983
22112
|
for (const name of plan2.extractedNames) {
|
|
21984
22113
|
console.log(` ${name}`);
|
|
21985
22114
|
}
|
|
@@ -22013,7 +22142,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
22013
22142
|
|
|
22014
22143
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
22015
22144
|
import path43 from "path";
|
|
22016
|
-
import
|
|
22145
|
+
import chalk181 from "chalk";
|
|
22017
22146
|
import { Project as Project4 } from "ts-morph";
|
|
22018
22147
|
|
|
22019
22148
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -22105,7 +22234,7 @@ function loadProjectFile(file) {
|
|
|
22105
22234
|
});
|
|
22106
22235
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
22107
22236
|
if (!sourceFile) {
|
|
22108
|
-
console.log(
|
|
22237
|
+
console.log(chalk181.red(`File not found in project: ${file}`));
|
|
22109
22238
|
process.exit(1);
|
|
22110
22239
|
}
|
|
22111
22240
|
return { project, sourceFile };
|
|
@@ -22128,19 +22257,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
22128
22257
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
22129
22258
|
if (options2.apply) {
|
|
22130
22259
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
22131
|
-
console.log(
|
|
22260
|
+
console.log(chalk182.green("\nExtraction complete"));
|
|
22132
22261
|
} else {
|
|
22133
|
-
console.log(
|
|
22262
|
+
console.log(chalk182.dim("\nDry run. Use --apply to execute."));
|
|
22134
22263
|
}
|
|
22135
22264
|
}
|
|
22136
22265
|
|
|
22137
22266
|
// src/commands/refactor/ignore.ts
|
|
22138
22267
|
import fs28 from "fs";
|
|
22139
|
-
import
|
|
22268
|
+
import chalk183 from "chalk";
|
|
22140
22269
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
22141
22270
|
function ignore2(file) {
|
|
22142
22271
|
if (!fs28.existsSync(file)) {
|
|
22143
|
-
console.error(
|
|
22272
|
+
console.error(chalk183.red(`Error: File does not exist: ${file}`));
|
|
22144
22273
|
process.exit(1);
|
|
22145
22274
|
}
|
|
22146
22275
|
const content = fs28.readFileSync(file, "utf8");
|
|
@@ -22156,7 +22285,7 @@ function ignore2(file) {
|
|
|
22156
22285
|
fs28.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
22157
22286
|
}
|
|
22158
22287
|
console.log(
|
|
22159
|
-
|
|
22288
|
+
chalk183.green(
|
|
22160
22289
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
22161
22290
|
)
|
|
22162
22291
|
);
|
|
@@ -22165,12 +22294,12 @@ function ignore2(file) {
|
|
|
22165
22294
|
// src/commands/refactor/rename/index.ts
|
|
22166
22295
|
import fs31 from "fs";
|
|
22167
22296
|
import path49 from "path";
|
|
22168
|
-
import
|
|
22297
|
+
import chalk186 from "chalk";
|
|
22169
22298
|
|
|
22170
22299
|
// src/commands/refactor/rename/applyRename.ts
|
|
22171
22300
|
import fs30 from "fs";
|
|
22172
22301
|
import path46 from "path";
|
|
22173
|
-
import
|
|
22302
|
+
import chalk184 from "chalk";
|
|
22174
22303
|
|
|
22175
22304
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
22176
22305
|
import path45 from "path";
|
|
@@ -22275,13 +22404,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
22275
22404
|
const updatedContents = applyRewrites(rewrites);
|
|
22276
22405
|
for (const [file, content] of updatedContents) {
|
|
22277
22406
|
fs30.writeFileSync(file, content, "utf8");
|
|
22278
|
-
console.log(
|
|
22407
|
+
console.log(chalk184.cyan(` Updated imports in ${path46.relative(cwd, file)}`));
|
|
22279
22408
|
}
|
|
22280
22409
|
const destDir = path46.dirname(destPath);
|
|
22281
22410
|
if (!fs30.existsSync(destDir)) fs30.mkdirSync(destDir, { recursive: true });
|
|
22282
22411
|
fs30.renameSync(sourcePath, destPath);
|
|
22283
22412
|
console.log(
|
|
22284
|
-
|
|
22413
|
+
chalk184.white(
|
|
22285
22414
|
` Moved ${path46.relative(cwd, sourcePath)} \u2192 ${path46.relative(cwd, destPath)}`
|
|
22286
22415
|
)
|
|
22287
22416
|
);
|
|
@@ -22368,16 +22497,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
22368
22497
|
|
|
22369
22498
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
22370
22499
|
import path48 from "path";
|
|
22371
|
-
import
|
|
22500
|
+
import chalk185 from "chalk";
|
|
22372
22501
|
function printRenamePreview(rewrites, cwd) {
|
|
22373
22502
|
for (const rewrite of rewrites) {
|
|
22374
22503
|
console.log(
|
|
22375
|
-
|
|
22504
|
+
chalk185.dim(
|
|
22376
22505
|
` ${path48.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
22377
22506
|
)
|
|
22378
22507
|
);
|
|
22379
22508
|
}
|
|
22380
|
-
console.log(
|
|
22509
|
+
console.log(chalk185.dim("Dry run. Use --apply to execute."));
|
|
22381
22510
|
}
|
|
22382
22511
|
|
|
22383
22512
|
// src/commands/refactor/rename/index.ts
|
|
@@ -22388,20 +22517,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
22388
22517
|
const relSource = path49.relative(cwd, sourcePath);
|
|
22389
22518
|
const relDest = path49.relative(cwd, destPath);
|
|
22390
22519
|
if (!fs31.existsSync(sourcePath)) {
|
|
22391
|
-
console.log(
|
|
22520
|
+
console.log(chalk186.red(`File not found: ${source}`));
|
|
22392
22521
|
process.exit(1);
|
|
22393
22522
|
}
|
|
22394
22523
|
if (destPath !== sourcePath && fs31.existsSync(destPath)) {
|
|
22395
|
-
console.log(
|
|
22524
|
+
console.log(chalk186.red(`Destination already exists: ${destination}`));
|
|
22396
22525
|
process.exit(1);
|
|
22397
22526
|
}
|
|
22398
|
-
console.log(
|
|
22399
|
-
console.log(
|
|
22400
|
-
console.log(
|
|
22527
|
+
console.log(chalk186.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
22528
|
+
console.log(chalk186.dim("Loading project..."));
|
|
22529
|
+
console.log(chalk186.dim("Scanning imports across the project..."));
|
|
22401
22530
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
22402
22531
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
22403
22532
|
console.log(
|
|
22404
|
-
|
|
22533
|
+
chalk186.dim(
|
|
22405
22534
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
22406
22535
|
)
|
|
22407
22536
|
);
|
|
@@ -22410,11 +22539,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
22410
22539
|
return;
|
|
22411
22540
|
}
|
|
22412
22541
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
22413
|
-
console.log(
|
|
22542
|
+
console.log(chalk186.green("Done"));
|
|
22414
22543
|
}
|
|
22415
22544
|
|
|
22416
22545
|
// src/commands/refactor/renameSymbol/index.ts
|
|
22417
|
-
import
|
|
22546
|
+
import chalk187 from "chalk";
|
|
22418
22547
|
|
|
22419
22548
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
22420
22549
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -22460,33 +22589,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
22460
22589
|
const { project, sourceFile } = loadProjectFile(file);
|
|
22461
22590
|
const symbol = findSymbol(sourceFile, oldName);
|
|
22462
22591
|
if (!symbol) {
|
|
22463
|
-
console.log(
|
|
22592
|
+
console.log(chalk187.red(`Symbol "${oldName}" not found in ${file}`));
|
|
22464
22593
|
process.exit(1);
|
|
22465
22594
|
}
|
|
22466
22595
|
const grouped = groupReferences(symbol, cwd);
|
|
22467
22596
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
22468
22597
|
console.log(
|
|
22469
|
-
|
|
22598
|
+
chalk187.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
22470
22599
|
`)
|
|
22471
22600
|
);
|
|
22472
22601
|
for (const [refFile, lines] of grouped) {
|
|
22473
22602
|
console.log(
|
|
22474
|
-
` ${
|
|
22603
|
+
` ${chalk187.dim(refFile)}: lines ${chalk187.cyan(lines.join(", "))}`
|
|
22475
22604
|
);
|
|
22476
22605
|
}
|
|
22477
22606
|
if (options2.apply) {
|
|
22478
22607
|
symbol.rename(newName);
|
|
22479
22608
|
await project.save();
|
|
22480
|
-
console.log(
|
|
22609
|
+
console.log(chalk187.green(`
|
|
22481
22610
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
22482
22611
|
} else {
|
|
22483
|
-
console.log(
|
|
22612
|
+
console.log(chalk187.dim("\nDry run. Use --apply to execute."));
|
|
22484
22613
|
}
|
|
22485
22614
|
}
|
|
22486
22615
|
|
|
22487
22616
|
// src/commands/refactor/restructure/index.ts
|
|
22488
22617
|
import path57 from "path";
|
|
22489
|
-
import
|
|
22618
|
+
import chalk190 from "chalk";
|
|
22490
22619
|
|
|
22491
22620
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
22492
22621
|
import path51 from "path";
|
|
@@ -22565,50 +22694,50 @@ function clusterFiles(graph) {
|
|
|
22565
22694
|
|
|
22566
22695
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
22567
22696
|
import path53 from "path";
|
|
22568
|
-
import
|
|
22697
|
+
import chalk188 from "chalk";
|
|
22569
22698
|
function relPath(filePath) {
|
|
22570
22699
|
return path53.relative(process.cwd(), filePath);
|
|
22571
22700
|
}
|
|
22572
22701
|
function displayMoves(plan2) {
|
|
22573
22702
|
if (plan2.moves.length === 0) return;
|
|
22574
|
-
console.log(
|
|
22703
|
+
console.log(chalk188.bold("\nFile moves:"));
|
|
22575
22704
|
for (const move2 of plan2.moves) {
|
|
22576
22705
|
console.log(
|
|
22577
|
-
` ${
|
|
22706
|
+
` ${chalk188.red(relPath(move2.from))} \u2192 ${chalk188.green(relPath(move2.to))}`
|
|
22578
22707
|
);
|
|
22579
|
-
console.log(
|
|
22708
|
+
console.log(chalk188.dim(` ${move2.reason}`));
|
|
22580
22709
|
}
|
|
22581
22710
|
}
|
|
22582
22711
|
function displayRewrites(rewrites) {
|
|
22583
22712
|
if (rewrites.length === 0) return;
|
|
22584
22713
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
22585
|
-
console.log(
|
|
22714
|
+
console.log(chalk188.bold(`
|
|
22586
22715
|
Import rewrites (${affectedFiles.size} files):`));
|
|
22587
22716
|
for (const file of affectedFiles) {
|
|
22588
|
-
console.log(` ${
|
|
22717
|
+
console.log(` ${chalk188.cyan(relPath(file))}:`);
|
|
22589
22718
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
22590
22719
|
(r) => r.file === file
|
|
22591
22720
|
)) {
|
|
22592
22721
|
console.log(
|
|
22593
|
-
` ${
|
|
22722
|
+
` ${chalk188.red(`"${oldSpecifier}"`)} \u2192 ${chalk188.green(`"${newSpecifier}"`)}`
|
|
22594
22723
|
);
|
|
22595
22724
|
}
|
|
22596
22725
|
}
|
|
22597
22726
|
}
|
|
22598
22727
|
function displayPlan2(plan2) {
|
|
22599
22728
|
if (plan2.warnings.length > 0) {
|
|
22600
|
-
console.log(
|
|
22601
|
-
for (const w of plan2.warnings) console.log(
|
|
22729
|
+
console.log(chalk188.yellow("\nWarnings:"));
|
|
22730
|
+
for (const w of plan2.warnings) console.log(chalk188.yellow(` ${w}`));
|
|
22602
22731
|
}
|
|
22603
22732
|
if (plan2.newDirectories.length > 0) {
|
|
22604
|
-
console.log(
|
|
22733
|
+
console.log(chalk188.bold("\nNew directories:"));
|
|
22605
22734
|
for (const dir of plan2.newDirectories)
|
|
22606
|
-
console.log(
|
|
22735
|
+
console.log(chalk188.green(` ${dir}/`));
|
|
22607
22736
|
}
|
|
22608
22737
|
displayMoves(plan2);
|
|
22609
22738
|
displayRewrites(plan2.rewrites);
|
|
22610
22739
|
console.log(
|
|
22611
|
-
|
|
22740
|
+
chalk188.dim(
|
|
22612
22741
|
`
|
|
22613
22742
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
22614
22743
|
)
|
|
@@ -22618,18 +22747,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
22618
22747
|
// src/commands/refactor/restructure/executePlan.ts
|
|
22619
22748
|
import fs32 from "fs";
|
|
22620
22749
|
import path54 from "path";
|
|
22621
|
-
import
|
|
22750
|
+
import chalk189 from "chalk";
|
|
22622
22751
|
function executePlan(plan2) {
|
|
22623
22752
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
22624
22753
|
for (const [file, content] of updatedContents) {
|
|
22625
22754
|
fs32.writeFileSync(file, content, "utf8");
|
|
22626
22755
|
console.log(
|
|
22627
|
-
|
|
22756
|
+
chalk189.cyan(` Rewrote imports in ${path54.relative(process.cwd(), file)}`)
|
|
22628
22757
|
);
|
|
22629
22758
|
}
|
|
22630
22759
|
for (const dir of plan2.newDirectories) {
|
|
22631
22760
|
fs32.mkdirSync(dir, { recursive: true });
|
|
22632
|
-
console.log(
|
|
22761
|
+
console.log(chalk189.green(` Created ${path54.relative(process.cwd(), dir)}/`));
|
|
22633
22762
|
}
|
|
22634
22763
|
for (const move2 of plan2.moves) {
|
|
22635
22764
|
const targetDir = path54.dirname(move2.to);
|
|
@@ -22638,7 +22767,7 @@ function executePlan(plan2) {
|
|
|
22638
22767
|
}
|
|
22639
22768
|
fs32.renameSync(move2.from, move2.to);
|
|
22640
22769
|
console.log(
|
|
22641
|
-
|
|
22770
|
+
chalk189.white(
|
|
22642
22771
|
` Moved ${path54.relative(process.cwd(), move2.from)} \u2192 ${path54.relative(process.cwd(), move2.to)}`
|
|
22643
22772
|
)
|
|
22644
22773
|
);
|
|
@@ -22653,7 +22782,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
22653
22782
|
if (entries.length === 0) {
|
|
22654
22783
|
fs32.rmdirSync(dir);
|
|
22655
22784
|
console.log(
|
|
22656
|
-
|
|
22785
|
+
chalk189.dim(
|
|
22657
22786
|
` Removed empty directory ${path54.relative(process.cwd(), dir)}`
|
|
22658
22787
|
)
|
|
22659
22788
|
);
|
|
@@ -22786,22 +22915,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
22786
22915
|
const targetPattern = pattern2 ?? "src";
|
|
22787
22916
|
const files = findSourceFiles2(targetPattern);
|
|
22788
22917
|
if (files.length === 0) {
|
|
22789
|
-
console.log(
|
|
22918
|
+
console.log(chalk190.yellow("No files found matching pattern"));
|
|
22790
22919
|
return;
|
|
22791
22920
|
}
|
|
22792
22921
|
const tsConfigPath = findTsConfig(path57.resolve(files[0]));
|
|
22793
22922
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
22794
22923
|
if (plan2.moves.length === 0) {
|
|
22795
|
-
console.log(
|
|
22924
|
+
console.log(chalk190.green("No restructuring needed"));
|
|
22796
22925
|
return;
|
|
22797
22926
|
}
|
|
22798
22927
|
displayPlan2(plan2);
|
|
22799
22928
|
if (options2.apply) {
|
|
22800
|
-
console.log(
|
|
22929
|
+
console.log(chalk190.bold("\nApplying changes..."));
|
|
22801
22930
|
executePlan(plan2);
|
|
22802
|
-
console.log(
|
|
22931
|
+
console.log(chalk190.green("\nRestructuring complete"));
|
|
22803
22932
|
} else {
|
|
22804
|
-
console.log(
|
|
22933
|
+
console.log(chalk190.dim("\nDry run. Use --apply to execute."));
|
|
22805
22934
|
}
|
|
22806
22935
|
}
|
|
22807
22936
|
|
|
@@ -23381,18 +23510,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
23381
23510
|
}
|
|
23382
23511
|
|
|
23383
23512
|
// src/commands/review/warnOutOfDiff.ts
|
|
23384
|
-
import
|
|
23513
|
+
import chalk191 from "chalk";
|
|
23385
23514
|
function warnOutOfDiff(outOfDiff) {
|
|
23386
23515
|
if (outOfDiff.length === 0) return;
|
|
23387
23516
|
console.warn(
|
|
23388
|
-
|
|
23517
|
+
chalk191.yellow(
|
|
23389
23518
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
23390
23519
|
)
|
|
23391
23520
|
);
|
|
23392
23521
|
for (const finding of outOfDiff) {
|
|
23393
23522
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
23394
23523
|
console.warn(
|
|
23395
|
-
` ${
|
|
23524
|
+
` ${chalk191.yellow("\xB7")} ${finding.title} ${chalk191.dim(
|
|
23396
23525
|
`(${finding.file}:${range})`
|
|
23397
23526
|
)}`
|
|
23398
23527
|
);
|
|
@@ -23411,18 +23540,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
23411
23540
|
}
|
|
23412
23541
|
|
|
23413
23542
|
// src/commands/review/warnUnlocated.ts
|
|
23414
|
-
import
|
|
23543
|
+
import chalk192 from "chalk";
|
|
23415
23544
|
function warnUnlocated(unlocated) {
|
|
23416
23545
|
if (unlocated.length === 0) return;
|
|
23417
23546
|
console.warn(
|
|
23418
|
-
|
|
23547
|
+
chalk192.yellow(
|
|
23419
23548
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
23420
23549
|
)
|
|
23421
23550
|
);
|
|
23422
23551
|
for (const finding of unlocated) {
|
|
23423
|
-
const where = finding.location ||
|
|
23552
|
+
const where = finding.location || chalk192.dim("missing");
|
|
23424
23553
|
console.warn(
|
|
23425
|
-
` ${
|
|
23554
|
+
` ${chalk192.yellow("\xB7")} ${finding.title} ${chalk192.dim(`(${where})`)}`
|
|
23426
23555
|
);
|
|
23427
23556
|
}
|
|
23428
23557
|
}
|
|
@@ -24587,7 +24716,7 @@ function registerReview(program2) {
|
|
|
24587
24716
|
}
|
|
24588
24717
|
|
|
24589
24718
|
// src/commands/seq/seqAuth.ts
|
|
24590
|
-
import
|
|
24719
|
+
import chalk194 from "chalk";
|
|
24591
24720
|
|
|
24592
24721
|
// src/commands/seq/loadConnections.ts
|
|
24593
24722
|
function loadConnections2() {
|
|
@@ -24616,10 +24745,10 @@ function setDefaultConnection(name) {
|
|
|
24616
24745
|
}
|
|
24617
24746
|
|
|
24618
24747
|
// src/shared/assertUniqueName.ts
|
|
24619
|
-
import
|
|
24748
|
+
import chalk193 from "chalk";
|
|
24620
24749
|
function assertUniqueName(existingNames, name) {
|
|
24621
24750
|
if (existingNames.includes(name)) {
|
|
24622
|
-
console.error(
|
|
24751
|
+
console.error(chalk193.red(`Connection "${name}" already exists.`));
|
|
24623
24752
|
process.exit(1);
|
|
24624
24753
|
}
|
|
24625
24754
|
}
|
|
@@ -24637,7 +24766,7 @@ async function promptConnection2(existingNames) {
|
|
|
24637
24766
|
var seqAuth = createConnectionAuth({
|
|
24638
24767
|
load: loadConnections2,
|
|
24639
24768
|
save: saveConnections2,
|
|
24640
|
-
format: (c) => `${
|
|
24769
|
+
format: (c) => `${chalk194.bold(c.name)} ${c.url}`,
|
|
24641
24770
|
promptNew: promptConnection2,
|
|
24642
24771
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
24643
24772
|
});
|
|
@@ -24657,10 +24786,10 @@ var seqConfigHelp = [
|
|
|
24657
24786
|
];
|
|
24658
24787
|
|
|
24659
24788
|
// src/commands/seq/seqQuery.ts
|
|
24660
|
-
import
|
|
24789
|
+
import chalk198 from "chalk";
|
|
24661
24790
|
|
|
24662
24791
|
// src/commands/seq/fetchSeq.ts
|
|
24663
|
-
import
|
|
24792
|
+
import chalk195 from "chalk";
|
|
24664
24793
|
async function fetchSeq(conn, path71, params) {
|
|
24665
24794
|
const url = `${conn.url}${path71}?${params}`;
|
|
24666
24795
|
const response = await fetch(url, {
|
|
@@ -24671,7 +24800,7 @@ async function fetchSeq(conn, path71, params) {
|
|
|
24671
24800
|
});
|
|
24672
24801
|
if (!response.ok) {
|
|
24673
24802
|
const body = await response.text();
|
|
24674
|
-
console.error(
|
|
24803
|
+
console.error(chalk195.red(`Seq returned ${response.status}: ${body}`));
|
|
24675
24804
|
process.exit(1);
|
|
24676
24805
|
}
|
|
24677
24806
|
return response;
|
|
@@ -24730,23 +24859,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
24730
24859
|
}
|
|
24731
24860
|
|
|
24732
24861
|
// src/commands/seq/formatEvent.ts
|
|
24733
|
-
import
|
|
24862
|
+
import chalk196 from "chalk";
|
|
24734
24863
|
function levelColor(level) {
|
|
24735
24864
|
switch (level) {
|
|
24736
24865
|
case "Fatal":
|
|
24737
|
-
return
|
|
24866
|
+
return chalk196.bgRed.white;
|
|
24738
24867
|
case "Error":
|
|
24739
|
-
return
|
|
24868
|
+
return chalk196.red;
|
|
24740
24869
|
case "Warning":
|
|
24741
|
-
return
|
|
24870
|
+
return chalk196.yellow;
|
|
24742
24871
|
case "Information":
|
|
24743
|
-
return
|
|
24872
|
+
return chalk196.cyan;
|
|
24744
24873
|
case "Debug":
|
|
24745
|
-
return
|
|
24874
|
+
return chalk196.gray;
|
|
24746
24875
|
case "Verbose":
|
|
24747
|
-
return
|
|
24876
|
+
return chalk196.dim;
|
|
24748
24877
|
default:
|
|
24749
|
-
return
|
|
24878
|
+
return chalk196.white;
|
|
24750
24879
|
}
|
|
24751
24880
|
}
|
|
24752
24881
|
function levelAbbrev(level) {
|
|
@@ -24787,12 +24916,12 @@ function formatTimestamp(iso) {
|
|
|
24787
24916
|
function formatEvent(event) {
|
|
24788
24917
|
const color = levelColor(event.Level);
|
|
24789
24918
|
const abbrev = levelAbbrev(event.Level);
|
|
24790
|
-
const ts8 =
|
|
24919
|
+
const ts8 = chalk196.dim(formatTimestamp(event.Timestamp));
|
|
24791
24920
|
const msg = renderMessage(event);
|
|
24792
24921
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
24793
24922
|
if (event.Exception) {
|
|
24794
24923
|
for (const line of event.Exception.split("\n")) {
|
|
24795
|
-
lines.push(
|
|
24924
|
+
lines.push(chalk196.red(` ${line}`));
|
|
24796
24925
|
}
|
|
24797
24926
|
}
|
|
24798
24927
|
return lines.join("\n");
|
|
@@ -24825,11 +24954,11 @@ function rejectTimestampFilter(filter) {
|
|
|
24825
24954
|
}
|
|
24826
24955
|
|
|
24827
24956
|
// src/shared/resolveNamedConnection.ts
|
|
24828
|
-
import
|
|
24957
|
+
import chalk197 from "chalk";
|
|
24829
24958
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
24830
24959
|
if (connections.length === 0) {
|
|
24831
24960
|
console.error(
|
|
24832
|
-
|
|
24961
|
+
chalk197.red(
|
|
24833
24962
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
24834
24963
|
)
|
|
24835
24964
|
);
|
|
@@ -24838,7 +24967,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
24838
24967
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
24839
24968
|
const connection = connections.find((c) => c.name === target);
|
|
24840
24969
|
if (!connection) {
|
|
24841
|
-
console.error(
|
|
24970
|
+
console.error(chalk197.red(`${kind} connection "${target}" not found.`));
|
|
24842
24971
|
process.exit(1);
|
|
24843
24972
|
}
|
|
24844
24973
|
return connection;
|
|
@@ -24867,7 +24996,7 @@ async function seqQuery(filter, options2) {
|
|
|
24867
24996
|
new URLSearchParams({ filter, count: String(count8) })
|
|
24868
24997
|
);
|
|
24869
24998
|
if (events.length === 0) {
|
|
24870
|
-
console.log(
|
|
24999
|
+
console.log(chalk198.yellow("No events found."));
|
|
24871
25000
|
return;
|
|
24872
25001
|
}
|
|
24873
25002
|
if (options2.json) {
|
|
@@ -24878,11 +25007,11 @@ async function seqQuery(filter, options2) {
|
|
|
24878
25007
|
for (const event of chronological) {
|
|
24879
25008
|
console.log(formatEvent(event));
|
|
24880
25009
|
}
|
|
24881
|
-
console.log(
|
|
25010
|
+
console.log(chalk198.dim(`
|
|
24882
25011
|
${events.length} events`));
|
|
24883
25012
|
if (events.length >= count8) {
|
|
24884
25013
|
console.log(
|
|
24885
|
-
|
|
25014
|
+
chalk198.yellow(
|
|
24886
25015
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
24887
25016
|
)
|
|
24888
25017
|
);
|
|
@@ -24890,10 +25019,10 @@ ${events.length} events`));
|
|
|
24890
25019
|
}
|
|
24891
25020
|
|
|
24892
25021
|
// src/shared/setNamedDefaultConnection.ts
|
|
24893
|
-
import
|
|
25022
|
+
import chalk199 from "chalk";
|
|
24894
25023
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
24895
25024
|
if (!connections.find((c) => c.name === name)) {
|
|
24896
|
-
console.error(
|
|
25025
|
+
console.error(chalk199.red(`Connection "${name}" not found.`));
|
|
24897
25026
|
process.exit(1);
|
|
24898
25027
|
}
|
|
24899
25028
|
setDefault(name);
|
|
@@ -24942,7 +25071,7 @@ function registerSignal(program2) {
|
|
|
24942
25071
|
}
|
|
24943
25072
|
|
|
24944
25073
|
// src/commands/sql/sqlAuth.ts
|
|
24945
|
-
import
|
|
25074
|
+
import chalk201 from "chalk";
|
|
24946
25075
|
|
|
24947
25076
|
// src/commands/sql/loadConnections.ts
|
|
24948
25077
|
function loadConnections3() {
|
|
@@ -24971,7 +25100,7 @@ function setDefaultConnection2(name) {
|
|
|
24971
25100
|
}
|
|
24972
25101
|
|
|
24973
25102
|
// src/commands/sql/promptConnection.ts
|
|
24974
|
-
import
|
|
25103
|
+
import chalk200 from "chalk";
|
|
24975
25104
|
async function promptConnection3(existingNames) {
|
|
24976
25105
|
const name = await promptInput("name", "Connection name:", "default");
|
|
24977
25106
|
assertUniqueName(existingNames, name);
|
|
@@ -24979,7 +25108,7 @@ async function promptConnection3(existingNames) {
|
|
|
24979
25108
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
24980
25109
|
const port = Number.parseInt(portStr, 10);
|
|
24981
25110
|
if (!Number.isFinite(port)) {
|
|
24982
|
-
console.error(
|
|
25111
|
+
console.error(chalk200.red(`Invalid port "${portStr}".`));
|
|
24983
25112
|
process.exit(1);
|
|
24984
25113
|
}
|
|
24985
25114
|
const user = await promptInput("user", "User:");
|
|
@@ -24992,13 +25121,13 @@ async function promptConnection3(existingNames) {
|
|
|
24992
25121
|
var sqlAuth = createConnectionAuth({
|
|
24993
25122
|
load: loadConnections3,
|
|
24994
25123
|
save: saveConnections3,
|
|
24995
|
-
format: (c) => `${
|
|
25124
|
+
format: (c) => `${chalk201.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
24996
25125
|
promptNew: promptConnection3,
|
|
24997
25126
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
24998
25127
|
});
|
|
24999
25128
|
|
|
25000
25129
|
// src/commands/sql/printTable.ts
|
|
25001
|
-
import
|
|
25130
|
+
import chalk202 from "chalk";
|
|
25002
25131
|
function formatCell(value) {
|
|
25003
25132
|
if (value === null || value === void 0) return "";
|
|
25004
25133
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -25007,7 +25136,7 @@ function formatCell(value) {
|
|
|
25007
25136
|
}
|
|
25008
25137
|
function printTable(rows) {
|
|
25009
25138
|
if (rows.length === 0) {
|
|
25010
|
-
console.log(
|
|
25139
|
+
console.log(chalk202.yellow("(no rows)"));
|
|
25011
25140
|
return;
|
|
25012
25141
|
}
|
|
25013
25142
|
const columns = Object.keys(rows[0]);
|
|
@@ -25015,13 +25144,13 @@ function printTable(rows) {
|
|
|
25015
25144
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
25016
25145
|
);
|
|
25017
25146
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
25018
|
-
console.log(
|
|
25019
|
-
console.log(
|
|
25147
|
+
console.log(chalk202.dim(header));
|
|
25148
|
+
console.log(chalk202.dim("-".repeat(header.length)));
|
|
25020
25149
|
for (const row of rows) {
|
|
25021
25150
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
25022
25151
|
console.log(line);
|
|
25023
25152
|
}
|
|
25024
|
-
console.log(
|
|
25153
|
+
console.log(chalk202.dim(`
|
|
25025
25154
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
25026
25155
|
}
|
|
25027
25156
|
|
|
@@ -25095,7 +25224,7 @@ var sqlConfigHelp = [
|
|
|
25095
25224
|
];
|
|
25096
25225
|
|
|
25097
25226
|
// src/commands/sql/sqlMutate.ts
|
|
25098
|
-
import
|
|
25227
|
+
import chalk203 from "chalk";
|
|
25099
25228
|
|
|
25100
25229
|
// src/commands/sql/isMutation.ts
|
|
25101
25230
|
var MUTATION_KEYWORDS = [
|
|
@@ -25129,7 +25258,7 @@ function isMutation(sql25) {
|
|
|
25129
25258
|
async function sqlMutate(query, connectionName) {
|
|
25130
25259
|
if (!isMutation(query)) {
|
|
25131
25260
|
console.error(
|
|
25132
|
-
|
|
25261
|
+
chalk203.red(
|
|
25133
25262
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
25134
25263
|
)
|
|
25135
25264
|
);
|
|
@@ -25139,18 +25268,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
25139
25268
|
const pool = await sqlConnect(conn);
|
|
25140
25269
|
try {
|
|
25141
25270
|
const result = await pool.request().query(query);
|
|
25142
|
-
console.log(
|
|
25271
|
+
console.log(chalk203.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
25143
25272
|
} finally {
|
|
25144
25273
|
await pool.close();
|
|
25145
25274
|
}
|
|
25146
25275
|
}
|
|
25147
25276
|
|
|
25148
25277
|
// src/commands/sql/sqlQuery.ts
|
|
25149
|
-
import
|
|
25278
|
+
import chalk204 from "chalk";
|
|
25150
25279
|
async function sqlQuery(query, connectionName) {
|
|
25151
25280
|
if (isMutation(query)) {
|
|
25152
25281
|
console.error(
|
|
25153
|
-
|
|
25282
|
+
chalk204.red(
|
|
25154
25283
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
25155
25284
|
)
|
|
25156
25285
|
);
|
|
@@ -25165,7 +25294,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
25165
25294
|
printTable(rows);
|
|
25166
25295
|
} else {
|
|
25167
25296
|
console.log(
|
|
25168
|
-
|
|
25297
|
+
chalk204.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
25169
25298
|
);
|
|
25170
25299
|
}
|
|
25171
25300
|
} finally {
|
|
@@ -26217,7 +26346,7 @@ function registerWatch(program2) {
|
|
|
26217
26346
|
|
|
26218
26347
|
// src/commands/roam/auth.ts
|
|
26219
26348
|
import { randomBytes } from "crypto";
|
|
26220
|
-
import
|
|
26349
|
+
import chalk205 from "chalk";
|
|
26221
26350
|
|
|
26222
26351
|
// src/commands/roam/waitForCallback.ts
|
|
26223
26352
|
import { createServer as createServer3 } from "http";
|
|
@@ -26348,13 +26477,13 @@ async function auth() {
|
|
|
26348
26477
|
saveGlobalConfig(config);
|
|
26349
26478
|
const state = randomBytes(16).toString("hex");
|
|
26350
26479
|
console.log(
|
|
26351
|
-
|
|
26480
|
+
chalk205.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
26352
26481
|
);
|
|
26353
|
-
console.log(
|
|
26354
|
-
console.log(
|
|
26355
|
-
console.log(
|
|
26482
|
+
console.log(chalk205.white("http://localhost:14523/callback\n"));
|
|
26483
|
+
console.log(chalk205.blue("Opening browser for authorization..."));
|
|
26484
|
+
console.log(chalk205.dim("Waiting for authorization callback..."));
|
|
26356
26485
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
26357
|
-
console.log(
|
|
26486
|
+
console.log(chalk205.dim("Exchanging code for tokens..."));
|
|
26358
26487
|
const tokens = await exchangeToken({
|
|
26359
26488
|
code,
|
|
26360
26489
|
clientId,
|
|
@@ -26370,7 +26499,7 @@ async function auth() {
|
|
|
26370
26499
|
};
|
|
26371
26500
|
saveGlobalConfig(config);
|
|
26372
26501
|
console.log(
|
|
26373
|
-
|
|
26502
|
+
chalk205.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
26374
26503
|
);
|
|
26375
26504
|
}
|
|
26376
26505
|
|
|
@@ -26473,11 +26602,11 @@ function registerRoam(program2) {
|
|
|
26473
26602
|
}
|
|
26474
26603
|
|
|
26475
26604
|
// src/commands/sync/printAutoConfirmHint.ts
|
|
26476
|
-
import
|
|
26605
|
+
import chalk206 from "chalk";
|
|
26477
26606
|
var autoConfirmHintCommand = "assist config set sync.autoConfirm true --global";
|
|
26478
26607
|
function printAutoConfirmHint() {
|
|
26479
26608
|
console.log(
|
|
26480
|
-
|
|
26609
|
+
chalk206.dim(
|
|
26481
26610
|
`Tip: run \`${autoConfirmHintCommand}\` to overwrite automatically next time`
|
|
26482
26611
|
)
|
|
26483
26612
|
);
|
|
@@ -26925,7 +27054,7 @@ import { execSync as execSync60 } from "child_process";
|
|
|
26925
27054
|
import { existsSync as existsSync60, mkdirSync as mkdirSync25, unlinkSync as unlinkSync21, writeFileSync as writeFileSync42 } from "fs";
|
|
26926
27055
|
import { tmpdir as tmpdir8 } from "os";
|
|
26927
27056
|
import { join as join70, resolve as resolve17 } from "path";
|
|
26928
|
-
import
|
|
27057
|
+
import chalk207 from "chalk";
|
|
26929
27058
|
|
|
26930
27059
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
26931
27060
|
var captureWindowPs1 = `
|
|
@@ -27076,13 +27205,13 @@ function screenshot(processName) {
|
|
|
27076
27205
|
const config = loadConfig();
|
|
27077
27206
|
const outputDir = resolve17(config.screenshot.outputDir);
|
|
27078
27207
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
27079
|
-
console.log(
|
|
27208
|
+
console.log(chalk207.gray(`Capturing window for process "${processName}" ...`));
|
|
27080
27209
|
try {
|
|
27081
27210
|
runPowerShellScript(processName, outputPath);
|
|
27082
|
-
console.log(
|
|
27211
|
+
console.log(chalk207.green(`Screenshot saved: ${outputPath}`));
|
|
27083
27212
|
} catch (error) {
|
|
27084
27213
|
const msg = error instanceof Error ? error.message : String(error);
|
|
27085
|
-
console.error(
|
|
27214
|
+
console.error(chalk207.red(`Failed to capture screenshot: ${msg}`));
|
|
27086
27215
|
process.exit(1);
|
|
27087
27216
|
}
|
|
27088
27217
|
}
|
|
@@ -31278,7 +31407,7 @@ var sessionsConfigHelp = [
|
|
|
31278
31407
|
|
|
31279
31408
|
// src/commands/sessions/summarise/index.ts
|
|
31280
31409
|
import * as fs41 from "fs";
|
|
31281
|
-
import
|
|
31410
|
+
import chalk208 from "chalk";
|
|
31282
31411
|
|
|
31283
31412
|
// src/commands/sessions/summarise/shared.ts
|
|
31284
31413
|
import * as fs40 from "fs";
|
|
@@ -31352,22 +31481,22 @@ ${firstMessage}`);
|
|
|
31352
31481
|
async function summarise2(options2) {
|
|
31353
31482
|
const files = await discoverSessionFiles();
|
|
31354
31483
|
if (files.length === 0) {
|
|
31355
|
-
console.log(
|
|
31484
|
+
console.log(chalk208.yellow("No sessions found."));
|
|
31356
31485
|
return;
|
|
31357
31486
|
}
|
|
31358
31487
|
const toProcess = selectCandidates(files, options2);
|
|
31359
31488
|
if (toProcess.length === 0) {
|
|
31360
|
-
console.log(
|
|
31489
|
+
console.log(chalk208.green("All sessions already summarised."));
|
|
31361
31490
|
return;
|
|
31362
31491
|
}
|
|
31363
31492
|
console.log(
|
|
31364
|
-
|
|
31493
|
+
chalk208.cyan(
|
|
31365
31494
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
31366
31495
|
)
|
|
31367
31496
|
);
|
|
31368
31497
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
31369
31498
|
console.log(
|
|
31370
|
-
|
|
31499
|
+
chalk208.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk208.yellow(`, ${failed2} skipped`) : "")
|
|
31371
31500
|
);
|
|
31372
31501
|
}
|
|
31373
31502
|
function selectCandidates(files, options2) {
|
|
@@ -31387,16 +31516,16 @@ function processSessions(files) {
|
|
|
31387
31516
|
let failed2 = 0;
|
|
31388
31517
|
for (let i = 0; i < files.length; i++) {
|
|
31389
31518
|
const file = files[i];
|
|
31390
|
-
process.stdout.write(
|
|
31519
|
+
process.stdout.write(chalk208.dim(` [${i + 1}/${files.length}] `));
|
|
31391
31520
|
const summary = summariseSession(file);
|
|
31392
31521
|
if (summary) {
|
|
31393
31522
|
writeSummary(file, summary);
|
|
31394
31523
|
succeeded++;
|
|
31395
|
-
process.stdout.write(`${
|
|
31524
|
+
process.stdout.write(`${chalk208.green("\u2713")} ${summary}
|
|
31396
31525
|
`);
|
|
31397
31526
|
} else {
|
|
31398
31527
|
failed2++;
|
|
31399
|
-
process.stdout.write(` ${
|
|
31528
|
+
process.stdout.write(` ${chalk208.yellow("skip")}
|
|
31400
31529
|
`);
|
|
31401
31530
|
}
|
|
31402
31531
|
}
|
|
@@ -31417,7 +31546,7 @@ function registerSessions(program2) {
|
|
|
31417
31546
|
}
|
|
31418
31547
|
|
|
31419
31548
|
// src/commands/statusLine.ts
|
|
31420
|
-
import
|
|
31549
|
+
import chalk210 from "chalk";
|
|
31421
31550
|
|
|
31422
31551
|
// src/shared/contextLevel.ts
|
|
31423
31552
|
function contextLevel(pct) {
|
|
@@ -31427,7 +31556,7 @@ function contextLevel(pct) {
|
|
|
31427
31556
|
}
|
|
31428
31557
|
|
|
31429
31558
|
// src/commands/buildLimitsSegment.ts
|
|
31430
|
-
import
|
|
31559
|
+
import chalk209 from "chalk";
|
|
31431
31560
|
|
|
31432
31561
|
// src/shared/rateLimitLevel.ts
|
|
31433
31562
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -31458,9 +31587,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
31458
31587
|
|
|
31459
31588
|
// src/commands/buildLimitsSegment.ts
|
|
31460
31589
|
var LEVEL_COLOR = {
|
|
31461
|
-
ok:
|
|
31462
|
-
warn:
|
|
31463
|
-
over:
|
|
31590
|
+
ok: chalk209.green,
|
|
31591
|
+
warn: chalk209.yellow,
|
|
31592
|
+
over: chalk209.red
|
|
31464
31593
|
};
|
|
31465
31594
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
31466
31595
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -31556,7 +31685,7 @@ async function relayUsage(claudeSessionId, transcriptPath, usedPct) {
|
|
|
31556
31685
|
}
|
|
31557
31686
|
|
|
31558
31687
|
// src/commands/statusLine.ts
|
|
31559
|
-
|
|
31688
|
+
chalk210.level = 3;
|
|
31560
31689
|
function formatNumber(num) {
|
|
31561
31690
|
return num.toLocaleString("en-US");
|
|
31562
31691
|
}
|
|
@@ -31564,9 +31693,9 @@ function colorizePercent(pct) {
|
|
|
31564
31693
|
const label2 = `${Math.round(pct)}%`;
|
|
31565
31694
|
switch (contextLevel(pct)) {
|
|
31566
31695
|
case "red":
|
|
31567
|
-
return
|
|
31696
|
+
return chalk210.red(label2);
|
|
31568
31697
|
case "yellow":
|
|
31569
|
-
return
|
|
31698
|
+
return chalk210.yellow(label2);
|
|
31570
31699
|
default:
|
|
31571
31700
|
return label2;
|
|
31572
31701
|
}
|
|
@@ -31579,7 +31708,7 @@ async function statusLine() {
|
|
|
31579
31708
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
31580
31709
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
31581
31710
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
31582
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
31711
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk210.cyan(branch2)} | ` : "";
|
|
31583
31712
|
console.log(
|
|
31584
31713
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
31585
31714
|
);
|
|
@@ -31600,7 +31729,7 @@ import { fileURLToPath as fileURLToPath9 } from "url";
|
|
|
31600
31729
|
// src/commands/sync/syncClaudeMd.ts
|
|
31601
31730
|
import * as fs42 from "fs";
|
|
31602
31731
|
import * as path61 from "path";
|
|
31603
|
-
import
|
|
31732
|
+
import chalk211 from "chalk";
|
|
31604
31733
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
31605
31734
|
const source = path61.join(claudeDir, "CLAUDE.md");
|
|
31606
31735
|
const target = path61.join(targetBase, "CLAUDE.md");
|
|
@@ -31609,14 +31738,14 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
31609
31738
|
const targetContent = fs42.readFileSync(target, "utf8");
|
|
31610
31739
|
if (sourceContent !== targetContent) {
|
|
31611
31740
|
console.log(
|
|
31612
|
-
|
|
31741
|
+
chalk211.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
31613
31742
|
);
|
|
31614
31743
|
console.log();
|
|
31615
31744
|
printDiff(targetContent, sourceContent);
|
|
31616
31745
|
if (!options2?.yes) {
|
|
31617
31746
|
printAutoConfirmHint();
|
|
31618
31747
|
const confirm = await promptConfirm(
|
|
31619
|
-
|
|
31748
|
+
chalk211.red("Overwrite existing CLAUDE.md?"),
|
|
31620
31749
|
false
|
|
31621
31750
|
);
|
|
31622
31751
|
if (!confirm) {
|
|
@@ -31811,7 +31940,7 @@ function syncPi(claudeDir) {
|
|
|
31811
31940
|
// src/commands/sync/syncSettings.ts
|
|
31812
31941
|
import * as fs47 from "fs";
|
|
31813
31942
|
import * as path68 from "path";
|
|
31814
|
-
import
|
|
31943
|
+
import chalk212 from "chalk";
|
|
31815
31944
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
31816
31945
|
const source = path68.join(claudeDir, "settings.json");
|
|
31817
31946
|
const target = path68.join(targetBase, "settings.json");
|
|
@@ -31830,7 +31959,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
31830
31959
|
if (mergedContent !== normalizedTarget) {
|
|
31831
31960
|
if (!options2?.yes) {
|
|
31832
31961
|
console.log(
|
|
31833
|
-
|
|
31962
|
+
chalk212.yellow(
|
|
31834
31963
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
31835
31964
|
)
|
|
31836
31965
|
);
|
|
@@ -31838,7 +31967,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
31838
31967
|
printDiff(targetContent, mergedContent);
|
|
31839
31968
|
printAutoConfirmHint();
|
|
31840
31969
|
const confirm = await promptConfirm(
|
|
31841
|
-
|
|
31970
|
+
chalk212.red("Overwrite existing settings.json?"),
|
|
31842
31971
|
false
|
|
31843
31972
|
);
|
|
31844
31973
|
if (!confirm) {
|
|
@@ -31937,10 +32066,10 @@ async function update2() {
|
|
|
31937
32066
|
}
|
|
31938
32067
|
|
|
31939
32068
|
// src/reportCliError.ts
|
|
31940
|
-
import
|
|
32069
|
+
import chalk213 from "chalk";
|
|
31941
32070
|
function reportCliError(error) {
|
|
31942
32071
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError) {
|
|
31943
|
-
console.error(
|
|
32072
|
+
console.error(chalk213.red(error.message));
|
|
31944
32073
|
} else {
|
|
31945
32074
|
console.error(error);
|
|
31946
32075
|
}
|