@staff0rd/assist 0.352.0 → 0.353.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/dist/commands/sessions/web/bundle.js +64 -64
- package/dist/index.js +491 -473
- 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.353.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -4605,8 +4605,11 @@ function firstRemoteUrl(cwd) {
|
|
|
4605
4605
|
}
|
|
4606
4606
|
return null;
|
|
4607
4607
|
}
|
|
4608
|
+
function getRemoteOriginUrl(cwd) {
|
|
4609
|
+
return tryGit(cwd, ["remote", "get-url", "origin"]) ?? firstRemoteUrl(cwd);
|
|
4610
|
+
}
|
|
4608
4611
|
function getCurrentOrigin(cwd) {
|
|
4609
|
-
const url =
|
|
4612
|
+
const url = getRemoteOriginUrl(cwd);
|
|
4610
4613
|
if (url) return normalizeOrigin(url);
|
|
4611
4614
|
const root = tryGit(cwd, ["rev-parse", "--show-toplevel"]);
|
|
4612
4615
|
return `local:${root ?? cwd}`;
|
|
@@ -7645,7 +7648,7 @@ function registerImportCommand(cmd) {
|
|
|
7645
7648
|
}
|
|
7646
7649
|
|
|
7647
7650
|
// src/commands/backlog/add/index.ts
|
|
7648
|
-
import
|
|
7651
|
+
import chalk67 from "chalk";
|
|
7649
7652
|
|
|
7650
7653
|
// src/commands/backlog/insertPhaseAt.ts
|
|
7651
7654
|
import { count as count2, eq as eq19 } from "drizzle-orm";
|
|
@@ -7689,6 +7692,19 @@ async function insertSubtask(orm, itemId, title, description) {
|
|
|
7689
7692
|
});
|
|
7690
7693
|
}
|
|
7691
7694
|
|
|
7695
|
+
// src/commands/backlog/ensureRemoteOrigin.ts
|
|
7696
|
+
import chalk66 from "chalk";
|
|
7697
|
+
function ensureRemoteOrigin() {
|
|
7698
|
+
if (getRemoteOriginUrl(getBacklogDir())) return true;
|
|
7699
|
+
console.log(
|
|
7700
|
+
chalk66.red(
|
|
7701
|
+
"Backlog requires a git remote so items get a stable origin.\nAdd one with: git remote add origin <url>"
|
|
7702
|
+
)
|
|
7703
|
+
);
|
|
7704
|
+
process.exitCode = 1;
|
|
7705
|
+
return false;
|
|
7706
|
+
}
|
|
7707
|
+
|
|
7692
7708
|
// src/commands/backlog/add/shared.ts
|
|
7693
7709
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
7694
7710
|
import { mkdtempSync, readFileSync as readFileSync19, unlinkSync as unlinkSync6, writeFileSync as writeFileSync19 } from "fs";
|
|
@@ -7761,6 +7777,7 @@ async function promptAcceptanceCriteria() {
|
|
|
7761
7777
|
|
|
7762
7778
|
// src/commands/backlog/add/index.ts
|
|
7763
7779
|
async function add(options2) {
|
|
7780
|
+
if (!ensureRemoteOrigin()) return;
|
|
7764
7781
|
const type = options2.type ?? await promptType();
|
|
7765
7782
|
const name = options2.name ?? await promptName();
|
|
7766
7783
|
const description = options2.desc?.replaceAll(String.raw`\n`, "\n") ?? await promptDescription();
|
|
@@ -7784,14 +7801,14 @@ async function add(options2) {
|
|
|
7784
7801
|
for (const subtask of loadConfig().subtasks ?? []) {
|
|
7785
7802
|
await insertSubtask(orm, id2, subtask.title, subtask.description);
|
|
7786
7803
|
}
|
|
7787
|
-
console.log(
|
|
7804
|
+
console.log(chalk67.green(`Added item #${id2}: ${name}`));
|
|
7788
7805
|
}
|
|
7789
7806
|
|
|
7790
7807
|
// src/commands/backlog/addPhase.ts
|
|
7791
|
-
import
|
|
7808
|
+
import chalk69 from "chalk";
|
|
7792
7809
|
|
|
7793
7810
|
// src/commands/backlog/resolveInsertPosition.ts
|
|
7794
|
-
import
|
|
7811
|
+
import chalk68 from "chalk";
|
|
7795
7812
|
import { count as count3, eq as eq20 } from "drizzle-orm";
|
|
7796
7813
|
async function resolveInsertPosition(orm, itemId, position) {
|
|
7797
7814
|
const [row] = await orm.select({ cnt: count3() }).from(planPhases).where(eq20(planPhases.itemId, itemId));
|
|
@@ -7800,7 +7817,7 @@ async function resolveInsertPosition(orm, itemId, position) {
|
|
|
7800
7817
|
const pos = Number.parseInt(position, 10);
|
|
7801
7818
|
if (pos < 1 || pos > phaseCount + 1) {
|
|
7802
7819
|
console.log(
|
|
7803
|
-
|
|
7820
|
+
chalk68.red(
|
|
7804
7821
|
`Position ${pos} is out of range. Must be between 1 and ${phaseCount + 1}.`
|
|
7805
7822
|
)
|
|
7806
7823
|
);
|
|
@@ -7817,11 +7834,12 @@ function serializeManualChecks(manualCheck) {
|
|
|
7817
7834
|
|
|
7818
7835
|
// src/commands/backlog/addPhase.ts
|
|
7819
7836
|
async function addPhase(id2, name, options2) {
|
|
7837
|
+
if (!ensureRemoteOrigin()) return;
|
|
7820
7838
|
const found = await findOneItem(id2);
|
|
7821
7839
|
if (!found) return;
|
|
7822
7840
|
const tasks = options2.task ?? [];
|
|
7823
7841
|
if (tasks.length === 0) {
|
|
7824
|
-
console.log(
|
|
7842
|
+
console.log(chalk69.red("At least one --task is required."));
|
|
7825
7843
|
process.exitCode = 1;
|
|
7826
7844
|
return;
|
|
7827
7845
|
}
|
|
@@ -7840,14 +7858,14 @@ async function addPhase(id2, name, options2) {
|
|
|
7840
7858
|
);
|
|
7841
7859
|
const verb = options2.position !== void 0 ? "Inserted" : "Added";
|
|
7842
7860
|
console.log(
|
|
7843
|
-
|
|
7861
|
+
chalk69.green(
|
|
7844
7862
|
`${verb} phase ${phaseIdx + 1} "${name}" to item #${itemId} with ${tasks.length} task(s).`
|
|
7845
7863
|
)
|
|
7846
7864
|
);
|
|
7847
7865
|
}
|
|
7848
7866
|
|
|
7849
7867
|
// src/commands/backlog/list/index.ts
|
|
7850
|
-
import
|
|
7868
|
+
import chalk70 from "chalk";
|
|
7851
7869
|
function filterItems(items2, options2) {
|
|
7852
7870
|
if (options2.status) return items2.filter((i) => i.status === options2.status);
|
|
7853
7871
|
if (!options2.all)
|
|
@@ -7858,7 +7876,7 @@ async function list2(options2) {
|
|
|
7858
7876
|
const allItems = await loadBacklog(options2.allRepos);
|
|
7859
7877
|
const items2 = filterItems(allItems, options2);
|
|
7860
7878
|
if (items2.length === 0) {
|
|
7861
|
-
console.log(
|
|
7879
|
+
console.log(chalk70.dim("Backlog is empty."));
|
|
7862
7880
|
return;
|
|
7863
7881
|
}
|
|
7864
7882
|
const labels = originDisplayLabels(
|
|
@@ -7867,9 +7885,9 @@ async function list2(options2) {
|
|
|
7867
7885
|
const repoNameOf = (item) => item.origin ? labels.get(item.origin) ?? "" : "";
|
|
7868
7886
|
const prefixWidth = options2.allRepos ? Math.max(0, ...items2.map((i) => repoNameOf(i).length)) : 0;
|
|
7869
7887
|
for (const item of items2) {
|
|
7870
|
-
const repoPrefix = options2.allRepos ? `${
|
|
7888
|
+
const repoPrefix = options2.allRepos ? `${chalk70.dim(repoNameOf(item).padEnd(prefixWidth))} ` : "";
|
|
7871
7889
|
console.log(
|
|
7872
|
-
`${repoPrefix}${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
7890
|
+
`${repoPrefix}${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk70.dim(`#${item.id}`)} ${starMarker(item)}${item.name}${phaseLabel(item)}${dependencyLabel(item, allItems)}`
|
|
7873
7891
|
);
|
|
7874
7892
|
if (options2.verbose) {
|
|
7875
7893
|
printVerboseDetails(item);
|
|
@@ -7895,7 +7913,7 @@ function registerItemCommands(cmd) {
|
|
|
7895
7913
|
}
|
|
7896
7914
|
|
|
7897
7915
|
// src/commands/backlog/link.ts
|
|
7898
|
-
import
|
|
7916
|
+
import chalk72 from "chalk";
|
|
7899
7917
|
|
|
7900
7918
|
// src/commands/backlog/hasCycle.ts
|
|
7901
7919
|
function hasCycle(adjacency, fromId, toId) {
|
|
@@ -7927,14 +7945,14 @@ async function loadDependencyGraph(orm) {
|
|
|
7927
7945
|
}
|
|
7928
7946
|
|
|
7929
7947
|
// src/commands/backlog/validateLinkTarget.ts
|
|
7930
|
-
import
|
|
7948
|
+
import chalk71 from "chalk";
|
|
7931
7949
|
function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
7932
7950
|
const duplicate = (fromItem.links ?? []).some(
|
|
7933
7951
|
(l) => l.targetId === toNum && l.type === linkType
|
|
7934
7952
|
);
|
|
7935
7953
|
if (duplicate) {
|
|
7936
7954
|
console.log(
|
|
7937
|
-
|
|
7955
|
+
chalk71.yellow(`Link already exists: #${fromNum} ${linkType} #${toNum}`)
|
|
7938
7956
|
);
|
|
7939
7957
|
return false;
|
|
7940
7958
|
}
|
|
@@ -7943,7 +7961,7 @@ function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
|
7943
7961
|
|
|
7944
7962
|
// src/commands/backlog/link.ts
|
|
7945
7963
|
function fail2(message) {
|
|
7946
|
-
console.log(
|
|
7964
|
+
console.log(chalk72.red(message));
|
|
7947
7965
|
return void 0;
|
|
7948
7966
|
}
|
|
7949
7967
|
function parseLinkType(type) {
|
|
@@ -7973,12 +7991,12 @@ async function link(fromId, toId, opts) {
|
|
|
7973
7991
|
if (await createsCycle(orm, linkType, fromNum, toNum)) return;
|
|
7974
7992
|
await orm.insert(links).values({ itemId: fromNum, type: linkType, targetId: toNum });
|
|
7975
7993
|
console.log(
|
|
7976
|
-
|
|
7994
|
+
chalk72.green(`Linked #${fromNum} ${linkType} #${toNum} (${toItem.name})`)
|
|
7977
7995
|
);
|
|
7978
7996
|
}
|
|
7979
7997
|
|
|
7980
7998
|
// src/commands/backlog/unlink.ts
|
|
7981
|
-
import
|
|
7999
|
+
import chalk73 from "chalk";
|
|
7982
8000
|
import { and as and7, eq as eq22 } from "drizzle-orm";
|
|
7983
8001
|
async function unlink(fromId, toId) {
|
|
7984
8002
|
const fromNum = Number.parseInt(fromId, 10);
|
|
@@ -7986,19 +8004,19 @@ async function unlink(fromId, toId) {
|
|
|
7986
8004
|
const { orm } = await getReady();
|
|
7987
8005
|
const fromItem = await loadItem(orm, fromNum);
|
|
7988
8006
|
if (!fromItem) {
|
|
7989
|
-
console.log(
|
|
8007
|
+
console.log(chalk73.red(`Item #${fromId} not found.`));
|
|
7990
8008
|
return;
|
|
7991
8009
|
}
|
|
7992
8010
|
if (!fromItem.links || fromItem.links.length === 0) {
|
|
7993
|
-
console.log(
|
|
8011
|
+
console.log(chalk73.yellow(`No links found on item #${fromId}.`));
|
|
7994
8012
|
return;
|
|
7995
8013
|
}
|
|
7996
8014
|
if (!fromItem.links.some((l) => l.targetId === toNum)) {
|
|
7997
|
-
console.log(
|
|
8015
|
+
console.log(chalk73.yellow(`No link from #${fromId} to #${toId} found.`));
|
|
7998
8016
|
return;
|
|
7999
8017
|
}
|
|
8000
8018
|
await orm.delete(links).where(and7(eq22(links.itemId, fromNum), eq22(links.targetId, toNum)));
|
|
8001
|
-
console.log(
|
|
8019
|
+
console.log(chalk73.green(`Removed link from #${fromId} to #${toId}.`));
|
|
8002
8020
|
}
|
|
8003
8021
|
|
|
8004
8022
|
// src/commands/backlog/registerLinkCommands.ts
|
|
@@ -8012,17 +8030,17 @@ function registerLinkCommands(cmd) {
|
|
|
8012
8030
|
}
|
|
8013
8031
|
|
|
8014
8032
|
// src/commands/backlog/move-repo/index.ts
|
|
8015
|
-
import
|
|
8033
|
+
import chalk75 from "chalk";
|
|
8016
8034
|
import { eq as eq24 } from "drizzle-orm";
|
|
8017
8035
|
|
|
8018
8036
|
// src/commands/backlog/move-repo/confirmMove.ts
|
|
8019
|
-
import
|
|
8037
|
+
import chalk74 from "chalk";
|
|
8020
8038
|
function pluralItems(n) {
|
|
8021
8039
|
return `${n} item${n === 1 ? "" : "s"}`;
|
|
8022
8040
|
}
|
|
8023
8041
|
async function confirmMove(cnt, oldOrigin, newOrigin) {
|
|
8024
8042
|
console.log(
|
|
8025
|
-
`${pluralItems(cnt)}: ${
|
|
8043
|
+
`${pluralItems(cnt)}: ${chalk74.cyan(oldOrigin)} \u2192 ${chalk74.cyan(newOrigin)}`
|
|
8026
8044
|
);
|
|
8027
8045
|
return promptConfirm(`Retag ${pluralItems(cnt)}?`);
|
|
8028
8046
|
}
|
|
@@ -8054,7 +8072,7 @@ Pass the full origin.`
|
|
|
8054
8072
|
|
|
8055
8073
|
// src/commands/backlog/move-repo/index.ts
|
|
8056
8074
|
function fail3(message) {
|
|
8057
|
-
console.log(
|
|
8075
|
+
console.log(chalk75.red(message));
|
|
8058
8076
|
process.exitCode = 1;
|
|
8059
8077
|
}
|
|
8060
8078
|
async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
@@ -8070,12 +8088,12 @@ async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
|
8070
8088
|
}
|
|
8071
8089
|
const cnt = await countByOrigin(orm, oldOrigin);
|
|
8072
8090
|
if (!options2.yes && !await confirmMove(cnt, oldOrigin, newOrigin)) {
|
|
8073
|
-
console.log(
|
|
8091
|
+
console.log(chalk75.yellow("Move cancelled; no changes made."));
|
|
8074
8092
|
return;
|
|
8075
8093
|
}
|
|
8076
8094
|
await orm.update(items).set({ origin: newOrigin }).where(eq24(items.origin, oldOrigin));
|
|
8077
8095
|
console.log(
|
|
8078
|
-
|
|
8096
|
+
chalk75.green(
|
|
8079
8097
|
`Moved ${pluralItems(cnt)} from "${oldOrigin}" to "${newOrigin}".`
|
|
8080
8098
|
)
|
|
8081
8099
|
);
|
|
@@ -8104,14 +8122,14 @@ function registerPlanCommands(cmd) {
|
|
|
8104
8122
|
}
|
|
8105
8123
|
|
|
8106
8124
|
// src/commands/backlog/refine.ts
|
|
8107
|
-
import
|
|
8125
|
+
import chalk78 from "chalk";
|
|
8108
8126
|
import enquirer7 from "enquirer";
|
|
8109
8127
|
|
|
8110
8128
|
// src/commands/backlog/launchMode.ts
|
|
8111
8129
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
8112
8130
|
|
|
8113
8131
|
// src/commands/backlog/handleLaunchSignal.ts
|
|
8114
|
-
import
|
|
8132
|
+
import chalk77 from "chalk";
|
|
8115
8133
|
|
|
8116
8134
|
// src/commands/backlog/surfaceCreatedItem.ts
|
|
8117
8135
|
async function surfaceCreatedItem(slashCommand, id2) {
|
|
@@ -8129,31 +8147,31 @@ async function surfaceCreatedItem(slashCommand, id2) {
|
|
|
8129
8147
|
}
|
|
8130
8148
|
|
|
8131
8149
|
// src/commands/backlog/tryRunById.ts
|
|
8132
|
-
import
|
|
8150
|
+
import chalk76 from "chalk";
|
|
8133
8151
|
async function tryRunById(id2, options2) {
|
|
8134
8152
|
const numericId = Number.parseInt(id2, 10);
|
|
8135
8153
|
const { orm } = await getReady();
|
|
8136
8154
|
const item = Number.isNaN(numericId) ? void 0 : await loadItem(orm, numericId);
|
|
8137
8155
|
if (!item) {
|
|
8138
|
-
console.log(
|
|
8156
|
+
console.log(chalk76.red(`Item #${id2} not found.`));
|
|
8139
8157
|
return false;
|
|
8140
8158
|
}
|
|
8141
8159
|
if (item.status === "done") {
|
|
8142
|
-
console.log(
|
|
8160
|
+
console.log(chalk76.red(`Item #${id2} is already done.`));
|
|
8143
8161
|
return false;
|
|
8144
8162
|
}
|
|
8145
8163
|
if (item.status === "wontdo") {
|
|
8146
|
-
console.log(
|
|
8164
|
+
console.log(chalk76.red(`Item #${id2} is marked won't do.`));
|
|
8147
8165
|
return false;
|
|
8148
8166
|
}
|
|
8149
8167
|
const hasDeps = (item.links ?? []).some((l) => l.type === "depends-on");
|
|
8150
8168
|
if (hasDeps && isBlocked(item, await loadItemSummaries(orm, getOrigin()))) {
|
|
8151
8169
|
console.log(
|
|
8152
|
-
|
|
8170
|
+
chalk76.red(`Item #${id2} is blocked by unresolved dependencies.`)
|
|
8153
8171
|
);
|
|
8154
8172
|
return false;
|
|
8155
8173
|
}
|
|
8156
|
-
console.log(
|
|
8174
|
+
console.log(chalk76.bold(`
|
|
8157
8175
|
Running backlog item #${id2}...
|
|
8158
8176
|
`));
|
|
8159
8177
|
await run2(id2, options2);
|
|
@@ -8171,7 +8189,7 @@ async function handleLaunchSignal(slashCommand, once) {
|
|
|
8171
8189
|
if (typeof signal.id === "string" && signal.id) {
|
|
8172
8190
|
if (await tryRunById(signal.id, { allowEdits: true })) return;
|
|
8173
8191
|
}
|
|
8174
|
-
console.log(
|
|
8192
|
+
console.log(chalk77.bold("\nChaining into assist next...\n"));
|
|
8175
8193
|
await next({ allowEdits: true, once });
|
|
8176
8194
|
}
|
|
8177
8195
|
}
|
|
@@ -8211,12 +8229,12 @@ async function pickItemForRefine() {
|
|
|
8211
8229
|
(i) => i.status === "todo" || i.status === "in-progress"
|
|
8212
8230
|
);
|
|
8213
8231
|
if (active.length === 0) {
|
|
8214
|
-
console.log(
|
|
8232
|
+
console.log(chalk78.yellow("No active backlog items to refine."));
|
|
8215
8233
|
return void 0;
|
|
8216
8234
|
}
|
|
8217
8235
|
if (active.length === 1) {
|
|
8218
8236
|
const item = active[0];
|
|
8219
|
-
console.log(
|
|
8237
|
+
console.log(chalk78.bold(`Auto-selecting item #${item.id}: ${item.name}`));
|
|
8220
8238
|
return String(item.id);
|
|
8221
8239
|
}
|
|
8222
8240
|
const { selected } = await exitOnCancel(
|
|
@@ -8251,7 +8269,7 @@ function registerRefineCommand(cmd) {
|
|
|
8251
8269
|
}
|
|
8252
8270
|
|
|
8253
8271
|
// src/commands/backlog/rewindPhase.ts
|
|
8254
|
-
import
|
|
8272
|
+
import chalk79 from "chalk";
|
|
8255
8273
|
function validateRewind2(item, plan2, phaseNumber) {
|
|
8256
8274
|
if (phaseNumber < 1 || phaseNumber > plan2.length) {
|
|
8257
8275
|
return `Phase ${phaseNumber} does not exist. Valid range: 1\u2013${plan2.length}.`;
|
|
@@ -8268,13 +8286,13 @@ async function rewindPhase(id2, phase, opts) {
|
|
|
8268
8286
|
const { orm } = await getReady();
|
|
8269
8287
|
const item = await loadItem(orm, Number.parseInt(id2, 10));
|
|
8270
8288
|
if (!item) {
|
|
8271
|
-
console.log(
|
|
8289
|
+
console.log(chalk79.red(`Item #${id2} not found.`));
|
|
8272
8290
|
return;
|
|
8273
8291
|
}
|
|
8274
8292
|
const plan2 = resolveRewindPlan(item);
|
|
8275
8293
|
const error = validateRewind2(item, plan2, phaseNumber);
|
|
8276
8294
|
if (error) {
|
|
8277
|
-
console.log(
|
|
8295
|
+
console.log(chalk79.red(error));
|
|
8278
8296
|
process.exitCode = 1;
|
|
8279
8297
|
return;
|
|
8280
8298
|
}
|
|
@@ -8292,7 +8310,7 @@ async function rewindPhase(id2, phase, opts) {
|
|
|
8292
8310
|
targetPhase: phaseIndex
|
|
8293
8311
|
});
|
|
8294
8312
|
console.log(
|
|
8295
|
-
|
|
8313
|
+
chalk79.green(`Rewound item #${id2} to phase ${phaseNumber} (${phaseName}).`)
|
|
8296
8314
|
);
|
|
8297
8315
|
}
|
|
8298
8316
|
|
|
@@ -8318,22 +8336,22 @@ function registerRunCommand(cmd) {
|
|
|
8318
8336
|
}
|
|
8319
8337
|
|
|
8320
8338
|
// src/commands/backlog/search/index.ts
|
|
8321
|
-
import
|
|
8339
|
+
import chalk80 from "chalk";
|
|
8322
8340
|
async function search(query) {
|
|
8323
8341
|
const items2 = await searchBacklog(query);
|
|
8324
8342
|
if (items2.length === 0) {
|
|
8325
|
-
console.log(
|
|
8343
|
+
console.log(chalk80.dim(`No items matching "${query}".`));
|
|
8326
8344
|
return;
|
|
8327
8345
|
}
|
|
8328
8346
|
console.log(
|
|
8329
|
-
|
|
8347
|
+
chalk80.dim(
|
|
8330
8348
|
`${items2.length} item${items2.length === 1 ? "" : "s"} matching "${query}":
|
|
8331
8349
|
`
|
|
8332
8350
|
)
|
|
8333
8351
|
);
|
|
8334
8352
|
for (const item of items2) {
|
|
8335
8353
|
console.log(
|
|
8336
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
8354
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk80.dim(`#${item.id}`)} ${item.name}`
|
|
8337
8355
|
);
|
|
8338
8356
|
}
|
|
8339
8357
|
}
|
|
@@ -8344,16 +8362,16 @@ function registerSearchCommand(cmd) {
|
|
|
8344
8362
|
}
|
|
8345
8363
|
|
|
8346
8364
|
// src/commands/backlog/delete/index.ts
|
|
8347
|
-
import
|
|
8365
|
+
import chalk81 from "chalk";
|
|
8348
8366
|
async function del(id2) {
|
|
8349
8367
|
const name = await removeItem(id2);
|
|
8350
8368
|
if (name) {
|
|
8351
|
-
console.log(
|
|
8369
|
+
console.log(chalk81.green(`Deleted item #${id2}: ${name}`));
|
|
8352
8370
|
}
|
|
8353
8371
|
}
|
|
8354
8372
|
|
|
8355
8373
|
// src/commands/backlog/done/index.ts
|
|
8356
|
-
import
|
|
8374
|
+
import chalk82 from "chalk";
|
|
8357
8375
|
async function done(id2, summary) {
|
|
8358
8376
|
const found = await findOneItem(id2);
|
|
8359
8377
|
if (!found) return;
|
|
@@ -8367,12 +8385,12 @@ async function done(id2, summary) {
|
|
|
8367
8385
|
const pending = item.plan.slice(completedCount);
|
|
8368
8386
|
if (pending.length > 0) {
|
|
8369
8387
|
console.log(
|
|
8370
|
-
|
|
8388
|
+
chalk82.red(
|
|
8371
8389
|
`Cannot complete item #${id2}: ${pending.length} pending phase(s):`
|
|
8372
8390
|
)
|
|
8373
8391
|
);
|
|
8374
8392
|
for (const phase of pending) {
|
|
8375
|
-
console.log(
|
|
8393
|
+
console.log(chalk82.yellow(` - ${phase.name}`));
|
|
8376
8394
|
}
|
|
8377
8395
|
process.exitCode = 1;
|
|
8378
8396
|
return;
|
|
@@ -8383,11 +8401,11 @@ async function done(id2, summary) {
|
|
|
8383
8401
|
const phase = item.currentPhase ?? 1;
|
|
8384
8402
|
await appendComment(orm, item.id, summary, { phase, type: "summary" });
|
|
8385
8403
|
}
|
|
8386
|
-
console.log(
|
|
8404
|
+
console.log(chalk82.green(`Completed item #${id2}: ${item.name}`));
|
|
8387
8405
|
}
|
|
8388
8406
|
|
|
8389
8407
|
// src/commands/backlog/set-status/index.ts
|
|
8390
|
-
import
|
|
8408
|
+
import chalk83 from "chalk";
|
|
8391
8409
|
var allowedStatuses = [
|
|
8392
8410
|
"todo",
|
|
8393
8411
|
"in-progress",
|
|
@@ -8397,7 +8415,7 @@ var allowedStatuses = [
|
|
|
8397
8415
|
async function setStatusCommand(id2, status2) {
|
|
8398
8416
|
if (!allowedStatuses.includes(status2)) {
|
|
8399
8417
|
console.log(
|
|
8400
|
-
|
|
8418
|
+
chalk83.red(
|
|
8401
8419
|
`Invalid status "${status2}". Must be one of: ${allowedStatuses.join(", ")}.`
|
|
8402
8420
|
)
|
|
8403
8421
|
);
|
|
@@ -8406,19 +8424,19 @@ async function setStatusCommand(id2, status2) {
|
|
|
8406
8424
|
}
|
|
8407
8425
|
const name = await setStatus(id2, status2);
|
|
8408
8426
|
if (name) {
|
|
8409
|
-
console.log(
|
|
8427
|
+
console.log(chalk83.green(`Set item #${id2} to ${status2}: ${name}`));
|
|
8410
8428
|
}
|
|
8411
8429
|
}
|
|
8412
8430
|
|
|
8413
8431
|
// src/commands/backlog/star/index.ts
|
|
8414
|
-
import
|
|
8432
|
+
import chalk85 from "chalk";
|
|
8415
8433
|
|
|
8416
8434
|
// src/commands/backlog/setStarred.ts
|
|
8417
|
-
import
|
|
8435
|
+
import chalk84 from "chalk";
|
|
8418
8436
|
async function setStarred(id2, starred) {
|
|
8419
8437
|
const { orm } = await getReady();
|
|
8420
8438
|
const name = await updateStarred(orm, Number.parseInt(id2, 10), starred);
|
|
8421
|
-
if (name === void 0) console.log(
|
|
8439
|
+
if (name === void 0) console.log(chalk84.red(`Item #${id2} not found.`));
|
|
8422
8440
|
return name;
|
|
8423
8441
|
}
|
|
8424
8442
|
|
|
@@ -8426,45 +8444,45 @@ async function setStarred(id2, starred) {
|
|
|
8426
8444
|
async function star(id2) {
|
|
8427
8445
|
const name = await setStarred(id2, true);
|
|
8428
8446
|
if (name) {
|
|
8429
|
-
console.log(
|
|
8447
|
+
console.log(chalk85.green(`Starred item #${id2}: ${name}`));
|
|
8430
8448
|
}
|
|
8431
8449
|
}
|
|
8432
8450
|
|
|
8433
8451
|
// src/commands/backlog/start/index.ts
|
|
8434
|
-
import
|
|
8452
|
+
import chalk86 from "chalk";
|
|
8435
8453
|
async function start(id2) {
|
|
8436
8454
|
const name = await setStatus(id2, "in-progress");
|
|
8437
8455
|
if (name) {
|
|
8438
|
-
console.log(
|
|
8456
|
+
console.log(chalk86.green(`Started item #${id2}: ${name}`));
|
|
8439
8457
|
}
|
|
8440
8458
|
}
|
|
8441
8459
|
|
|
8442
8460
|
// src/commands/backlog/stop/index.ts
|
|
8443
|
-
import
|
|
8461
|
+
import chalk87 from "chalk";
|
|
8444
8462
|
import { and as and8, eq as eq25 } from "drizzle-orm";
|
|
8445
8463
|
async function stop() {
|
|
8446
8464
|
const { orm } = await getReady();
|
|
8447
8465
|
const stopped = await orm.update(items).set({ status: "todo", currentPhase: 1 }).where(and8(eq25(items.status, "in-progress"), eq25(items.origin, getOrigin()))).returning({ id: items.id, name: items.name });
|
|
8448
8466
|
if (stopped.length === 0) {
|
|
8449
|
-
console.log(
|
|
8467
|
+
console.log(chalk87.yellow("No in-progress items to stop."));
|
|
8450
8468
|
return;
|
|
8451
8469
|
}
|
|
8452
8470
|
for (const item of stopped) {
|
|
8453
|
-
console.log(
|
|
8471
|
+
console.log(chalk87.yellow(`Stopped item #${item.id}: ${item.name}`));
|
|
8454
8472
|
}
|
|
8455
8473
|
}
|
|
8456
8474
|
|
|
8457
8475
|
// src/commands/backlog/unstar/index.ts
|
|
8458
|
-
import
|
|
8476
|
+
import chalk88 from "chalk";
|
|
8459
8477
|
async function unstar(id2) {
|
|
8460
8478
|
const name = await setStarred(id2, false);
|
|
8461
8479
|
if (name) {
|
|
8462
|
-
console.log(
|
|
8480
|
+
console.log(chalk88.green(`Unstarred item #${id2}: ${name}`));
|
|
8463
8481
|
}
|
|
8464
8482
|
}
|
|
8465
8483
|
|
|
8466
8484
|
// src/commands/backlog/wontdo/index.ts
|
|
8467
|
-
import
|
|
8485
|
+
import chalk89 from "chalk";
|
|
8468
8486
|
async function wontdo(id2, reason) {
|
|
8469
8487
|
const found = await findOneItem(id2);
|
|
8470
8488
|
if (!found) return;
|
|
@@ -8474,7 +8492,7 @@ async function wontdo(id2, reason) {
|
|
|
8474
8492
|
const phase = item.currentPhase ?? 1;
|
|
8475
8493
|
await appendComment(orm, item.id, reason, { phase, type: "summary" });
|
|
8476
8494
|
}
|
|
8477
|
-
console.log(
|
|
8495
|
+
console.log(chalk89.red(`Won't do item #${id2}: ${item.name}`));
|
|
8478
8496
|
}
|
|
8479
8497
|
|
|
8480
8498
|
// src/commands/backlog/registerStatusCommands.ts
|
|
@@ -8492,11 +8510,11 @@ function registerStatusCommands(cmd) {
|
|
|
8492
8510
|
}
|
|
8493
8511
|
|
|
8494
8512
|
// src/commands/backlog/addSubtask.ts
|
|
8495
|
-
import
|
|
8513
|
+
import chalk90 from "chalk";
|
|
8496
8514
|
async function addSubtask(id2, options2) {
|
|
8497
8515
|
const title = options2.title?.trim();
|
|
8498
8516
|
if (!title) {
|
|
8499
|
-
console.log(
|
|
8517
|
+
console.log(chalk90.red("A sub-task title is required (--title)."));
|
|
8500
8518
|
process.exitCode = 1;
|
|
8501
8519
|
return;
|
|
8502
8520
|
}
|
|
@@ -8507,16 +8525,16 @@ async function addSubtask(id2, options2) {
|
|
|
8507
8525
|
}
|
|
8508
8526
|
const { orm, item } = found;
|
|
8509
8527
|
await insertSubtask(orm, item.id, title, options2.desc);
|
|
8510
|
-
console.log(
|
|
8528
|
+
console.log(chalk90.green(`Added sub-task to item #${id2}: ${title}`));
|
|
8511
8529
|
}
|
|
8512
8530
|
|
|
8513
8531
|
// src/commands/backlog/subtaskStatus.ts
|
|
8514
|
-
import
|
|
8532
|
+
import chalk91 from "chalk";
|
|
8515
8533
|
var validStatuses2 = ["todo", "in-progress", "done"];
|
|
8516
8534
|
async function subtaskStatus(id2, index3, status2) {
|
|
8517
8535
|
if (!validStatuses2.includes(status2)) {
|
|
8518
8536
|
console.log(
|
|
8519
|
-
|
|
8537
|
+
chalk91.red(
|
|
8520
8538
|
`Invalid status "${status2}". Use one of: ${validStatuses2.join(", ")}.`
|
|
8521
8539
|
)
|
|
8522
8540
|
);
|
|
@@ -8533,7 +8551,7 @@ async function subtaskStatus(id2, index3, status2) {
|
|
|
8533
8551
|
const subtasks = item.subtasks ?? [];
|
|
8534
8552
|
if (Number.isNaN(position) || position < 1 || position > subtasks.length) {
|
|
8535
8553
|
console.log(
|
|
8536
|
-
|
|
8554
|
+
chalk91.red(
|
|
8537
8555
|
`Item #${id2} has no sub-task ${index3}${subtasks.length > 0 ? ` (1-${subtasks.length})` : ""}.`
|
|
8538
8556
|
)
|
|
8539
8557
|
);
|
|
@@ -8547,7 +8565,7 @@ async function subtaskStatus(id2, index3, status2) {
|
|
|
8547
8565
|
status2
|
|
8548
8566
|
);
|
|
8549
8567
|
console.log(
|
|
8550
|
-
|
|
8568
|
+
chalk91.green(
|
|
8551
8569
|
`Set sub-task ${position} of item #${id2} to ${status2}: ${title}`
|
|
8552
8570
|
)
|
|
8553
8571
|
);
|
|
@@ -8562,7 +8580,7 @@ function registerSubtaskCommands(cmd) {
|
|
|
8562
8580
|
}
|
|
8563
8581
|
|
|
8564
8582
|
// src/commands/backlog/movePhase.ts
|
|
8565
|
-
import
|
|
8583
|
+
import chalk92 from "chalk";
|
|
8566
8584
|
import { count as count6, eq as eq28 } from "drizzle-orm";
|
|
8567
8585
|
|
|
8568
8586
|
// src/commands/backlog/reorderPhaseRows.ts
|
|
@@ -8628,7 +8646,7 @@ function toIndex(value, phaseCount) {
|
|
|
8628
8646
|
const pos = Number.parseInt(value, 10);
|
|
8629
8647
|
if (Number.isNaN(pos) || pos < 1 || pos > phaseCount) {
|
|
8630
8648
|
console.log(
|
|
8631
|
-
|
|
8649
|
+
chalk92.red(
|
|
8632
8650
|
`Position "${value}" is out of range. Must be between 1 and ${phaseCount}.`
|
|
8633
8651
|
)
|
|
8634
8652
|
);
|
|
@@ -8651,11 +8669,11 @@ async function movePhase(id2, from, to) {
|
|
|
8651
8669
|
if (fromIdx !== toIdx) {
|
|
8652
8670
|
await reorderPhaseRows(orm, itemId, fromIdx, toIdx);
|
|
8653
8671
|
}
|
|
8654
|
-
console.log(
|
|
8672
|
+
console.log(chalk92.green(`Moved phase ${from} to position ${to}.`));
|
|
8655
8673
|
}
|
|
8656
8674
|
|
|
8657
8675
|
// src/commands/backlog/updatePhase.ts
|
|
8658
|
-
import
|
|
8676
|
+
import chalk94 from "chalk";
|
|
8659
8677
|
|
|
8660
8678
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
8661
8679
|
import { and as and11, eq as eq29 } from "drizzle-orm";
|
|
@@ -8690,7 +8708,7 @@ async function applyPhaseUpdate(orm, itemId, phaseIdx, fields) {
|
|
|
8690
8708
|
}
|
|
8691
8709
|
|
|
8692
8710
|
// src/commands/backlog/findPhase.ts
|
|
8693
|
-
import
|
|
8711
|
+
import chalk93 from "chalk";
|
|
8694
8712
|
import { and as and12, count as count7, eq as eq30 } from "drizzle-orm";
|
|
8695
8713
|
async function findPhase(id2, phase) {
|
|
8696
8714
|
const found = await findOneItem(id2);
|
|
@@ -8701,7 +8719,7 @@ async function findPhase(id2, phase) {
|
|
|
8701
8719
|
const [row] = await orm.select({ cnt: count7() }).from(planPhases).where(and12(eq30(planPhases.itemId, itemId), eq30(planPhases.idx, phaseIdx)));
|
|
8702
8720
|
if (!row || row.cnt === 0) {
|
|
8703
8721
|
console.log(
|
|
8704
|
-
|
|
8722
|
+
chalk93.red(`Phase ${phaseIdx + 1} not found on item #${itemId}.`)
|
|
8705
8723
|
);
|
|
8706
8724
|
process.exitCode = 1;
|
|
8707
8725
|
return void 0;
|
|
@@ -8833,7 +8851,7 @@ async function updatePhase(id2, phase, options2) {
|
|
|
8833
8851
|
const { item, orm, itemId, phaseIdx } = found;
|
|
8834
8852
|
const resolved = resolvePhaseFields(options2, item.plan?.[phaseIdx]);
|
|
8835
8853
|
if (!resolved.ok) {
|
|
8836
|
-
console.log(
|
|
8854
|
+
console.log(chalk94.red(resolved.error));
|
|
8837
8855
|
process.exitCode = 1;
|
|
8838
8856
|
return;
|
|
8839
8857
|
}
|
|
@@ -8845,7 +8863,7 @@ async function updatePhase(id2, phase, options2) {
|
|
|
8845
8863
|
manualCheck && "manual checks"
|
|
8846
8864
|
].filter(Boolean).join(", ");
|
|
8847
8865
|
console.log(
|
|
8848
|
-
|
|
8866
|
+
chalk94.green(
|
|
8849
8867
|
`Updated ${fields} on phase ${phaseIdx + 1} of item #${itemId}.`
|
|
8850
8868
|
)
|
|
8851
8869
|
);
|
|
@@ -8868,7 +8886,7 @@ function registerUpdatePhaseCommand(cmd) {
|
|
|
8868
8886
|
}
|
|
8869
8887
|
|
|
8870
8888
|
// src/commands/backlog/removePhase.ts
|
|
8871
|
-
import
|
|
8889
|
+
import chalk95 from "chalk";
|
|
8872
8890
|
import { and as and13, eq as eq31 } from "drizzle-orm";
|
|
8873
8891
|
async function removePhase(id2, phase) {
|
|
8874
8892
|
const found = await findPhase(id2, phase);
|
|
@@ -8883,12 +8901,12 @@ async function removePhase(id2, phase) {
|
|
|
8883
8901
|
await adjustCurrentPhase(tx, item, phaseIdx);
|
|
8884
8902
|
});
|
|
8885
8903
|
console.log(
|
|
8886
|
-
|
|
8904
|
+
chalk95.green(`Removed phase ${phaseIdx + 1} from item #${itemId}.`)
|
|
8887
8905
|
);
|
|
8888
8906
|
}
|
|
8889
8907
|
|
|
8890
8908
|
// src/commands/backlog/update/index.ts
|
|
8891
|
-
import
|
|
8909
|
+
import chalk97 from "chalk";
|
|
8892
8910
|
import { eq as eq32 } from "drizzle-orm";
|
|
8893
8911
|
|
|
8894
8912
|
// src/commands/backlog/update/applyAcMutations.ts
|
|
@@ -8910,16 +8928,16 @@ function applyAcMutations(current, options2) {
|
|
|
8910
8928
|
}
|
|
8911
8929
|
|
|
8912
8930
|
// src/commands/backlog/update/buildUpdateValues.ts
|
|
8913
|
-
import
|
|
8931
|
+
import chalk96 from "chalk";
|
|
8914
8932
|
function buildUpdateValues(options2) {
|
|
8915
8933
|
const { name, desc: desc6, type, ac } = options2;
|
|
8916
8934
|
if (!name && !desc6 && !type && !ac) {
|
|
8917
|
-
console.log(
|
|
8935
|
+
console.log(chalk96.red("Nothing to update. Provide at least one flag."));
|
|
8918
8936
|
process.exitCode = 1;
|
|
8919
8937
|
return void 0;
|
|
8920
8938
|
}
|
|
8921
8939
|
if (type && type !== "story" && type !== "bug") {
|
|
8922
|
-
console.log(
|
|
8940
|
+
console.log(chalk96.red('Invalid type. Must be "story" or "bug".'));
|
|
8923
8941
|
process.exitCode = 1;
|
|
8924
8942
|
return void 0;
|
|
8925
8943
|
}
|
|
@@ -8952,14 +8970,14 @@ async function update(id2, options2) {
|
|
|
8952
8970
|
if (hasAcMutations(options2)) {
|
|
8953
8971
|
if (options2.ac) {
|
|
8954
8972
|
console.log(
|
|
8955
|
-
|
|
8973
|
+
chalk97.red("Cannot combine --ac with --add-ac/--edit-ac/--remove-ac.")
|
|
8956
8974
|
);
|
|
8957
8975
|
process.exitCode = 1;
|
|
8958
8976
|
return;
|
|
8959
8977
|
}
|
|
8960
8978
|
const mutation = applyAcMutations(found.item.acceptanceCriteria, options2);
|
|
8961
8979
|
if (!mutation.ok) {
|
|
8962
|
-
console.log(
|
|
8980
|
+
console.log(chalk97.red(mutation.error));
|
|
8963
8981
|
process.exitCode = 1;
|
|
8964
8982
|
return;
|
|
8965
8983
|
}
|
|
@@ -8970,7 +8988,7 @@ async function update(id2, options2) {
|
|
|
8970
8988
|
const { orm } = found;
|
|
8971
8989
|
const itemId = found.item.id;
|
|
8972
8990
|
await orm.update(items).set(built.set).where(eq32(items.id, itemId));
|
|
8973
|
-
console.log(
|
|
8991
|
+
console.log(chalk97.green(`Updated ${built.fields} on item #${itemId}.`));
|
|
8974
8992
|
}
|
|
8975
8993
|
|
|
8976
8994
|
// src/commands/backlog/registerUpdateCommands.ts
|
|
@@ -9811,11 +9829,11 @@ function assertCliExists(cli) {
|
|
|
9811
9829
|
}
|
|
9812
9830
|
|
|
9813
9831
|
// src/commands/permitCliReads/colorize.ts
|
|
9814
|
-
import
|
|
9832
|
+
import chalk98 from "chalk";
|
|
9815
9833
|
function colorize(plainOutput) {
|
|
9816
9834
|
return plainOutput.split("\n").map((line) => {
|
|
9817
|
-
if (line.startsWith(" R ")) return
|
|
9818
|
-
if (line.startsWith(" W ")) return
|
|
9835
|
+
if (line.startsWith(" R ")) return chalk98.green(line);
|
|
9836
|
+
if (line.startsWith(" W ")) return chalk98.red(line);
|
|
9819
9837
|
return line;
|
|
9820
9838
|
}).join("\n");
|
|
9821
9839
|
}
|
|
@@ -10113,7 +10131,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
10113
10131
|
}
|
|
10114
10132
|
|
|
10115
10133
|
// src/commands/deny/denyAdd.ts
|
|
10116
|
-
import
|
|
10134
|
+
import chalk99 from "chalk";
|
|
10117
10135
|
|
|
10118
10136
|
// src/commands/deny/loadDenyConfig.ts
|
|
10119
10137
|
function loadDenyConfig(global) {
|
|
@@ -10133,16 +10151,16 @@ function loadDenyConfig(global) {
|
|
|
10133
10151
|
function denyAdd(pattern2, message, options2) {
|
|
10134
10152
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
10135
10153
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
10136
|
-
console.log(
|
|
10154
|
+
console.log(chalk99.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
10137
10155
|
return;
|
|
10138
10156
|
}
|
|
10139
10157
|
deny.push({ pattern: pattern2, message });
|
|
10140
10158
|
saveDeny(deny);
|
|
10141
|
-
console.log(
|
|
10159
|
+
console.log(chalk99.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
10142
10160
|
}
|
|
10143
10161
|
|
|
10144
10162
|
// src/commands/deny/denyList.ts
|
|
10145
|
-
import
|
|
10163
|
+
import chalk100 from "chalk";
|
|
10146
10164
|
function denyList() {
|
|
10147
10165
|
const globalRaw = loadGlobalConfigRaw();
|
|
10148
10166
|
const projectRaw = loadProjectConfig();
|
|
@@ -10153,7 +10171,7 @@ function denyList() {
|
|
|
10153
10171
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
10154
10172
|
);
|
|
10155
10173
|
if (!merged || merged.length === 0) {
|
|
10156
|
-
console.log(
|
|
10174
|
+
console.log(chalk100.dim("No deny rules configured."));
|
|
10157
10175
|
return;
|
|
10158
10176
|
}
|
|
10159
10177
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -10161,23 +10179,23 @@ function denyList() {
|
|
|
10161
10179
|
for (const rule of merged) {
|
|
10162
10180
|
const inProject = projectPatterns.has(rule.pattern);
|
|
10163
10181
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
10164
|
-
const label2 = inProject && inGlobal ?
|
|
10165
|
-
console.log(`${
|
|
10182
|
+
const label2 = inProject && inGlobal ? chalk100.dim(" (project, overrides global)") : inGlobal ? chalk100.dim(" (global)") : "";
|
|
10183
|
+
console.log(`${chalk100.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
10166
10184
|
}
|
|
10167
10185
|
}
|
|
10168
10186
|
|
|
10169
10187
|
// src/commands/deny/denyRemove.ts
|
|
10170
|
-
import
|
|
10188
|
+
import chalk101 from "chalk";
|
|
10171
10189
|
function denyRemove(pattern2, options2) {
|
|
10172
10190
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
10173
10191
|
const index3 = deny.findIndex((r) => r.pattern === pattern2);
|
|
10174
10192
|
if (index3 === -1) {
|
|
10175
|
-
console.log(
|
|
10193
|
+
console.log(chalk101.yellow(`No deny rule found for: ${pattern2}`));
|
|
10176
10194
|
return;
|
|
10177
10195
|
}
|
|
10178
10196
|
deny.splice(index3, 1);
|
|
10179
10197
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
10180
|
-
console.log(
|
|
10198
|
+
console.log(chalk101.green(`Removed deny rule: ${pattern2}`));
|
|
10181
10199
|
}
|
|
10182
10200
|
|
|
10183
10201
|
// src/commands/registerDeny.ts
|
|
@@ -10207,7 +10225,7 @@ function registerCliHook(program2) {
|
|
|
10207
10225
|
|
|
10208
10226
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
10209
10227
|
import { existsSync as existsSync29, readFileSync as readFileSync24, unlinkSync as unlinkSync8, writeFileSync as writeFileSync22 } from "fs";
|
|
10210
|
-
import
|
|
10228
|
+
import chalk102 from "chalk";
|
|
10211
10229
|
|
|
10212
10230
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
10213
10231
|
import { homedir as homedir13 } from "os";
|
|
@@ -10260,12 +10278,12 @@ function codeCommentConfirm(pin) {
|
|
|
10260
10278
|
sweepRestrictedDir();
|
|
10261
10279
|
const state = readPinState(pin);
|
|
10262
10280
|
if (!state) {
|
|
10263
|
-
console.error(
|
|
10281
|
+
console.error(chalk102.red(`No pending comment for pin: ${pin}`));
|
|
10264
10282
|
process.exitCode = 1;
|
|
10265
10283
|
return;
|
|
10266
10284
|
}
|
|
10267
10285
|
if (!existsSync29(state.file)) {
|
|
10268
|
-
console.error(
|
|
10286
|
+
console.error(chalk102.red(`Target file no longer exists: ${state.file}`));
|
|
10269
10287
|
process.exitCode = 1;
|
|
10270
10288
|
return;
|
|
10271
10289
|
}
|
|
@@ -10274,7 +10292,7 @@ function codeCommentConfirm(pin) {
|
|
|
10274
10292
|
const index3 = state.line - 1;
|
|
10275
10293
|
if (index3 > lines.length) {
|
|
10276
10294
|
console.error(
|
|
10277
|
-
|
|
10295
|
+
chalk102.red(
|
|
10278
10296
|
`Line ${state.line} is beyond the end of ${state.file} (${lines.length} lines).`
|
|
10279
10297
|
)
|
|
10280
10298
|
);
|
|
@@ -10288,14 +10306,14 @@ function codeCommentConfirm(pin) {
|
|
|
10288
10306
|
writeFileSync22(state.file, lines.join("\n"));
|
|
10289
10307
|
unlinkSync8(getPinStatePath(pin));
|
|
10290
10308
|
console.log(
|
|
10291
|
-
|
|
10309
|
+
chalk102.green(
|
|
10292
10310
|
`Inserted "${marker} ${state.text}" at ${state.file}:${state.line}`
|
|
10293
10311
|
)
|
|
10294
10312
|
);
|
|
10295
10313
|
}
|
|
10296
10314
|
|
|
10297
10315
|
// src/commands/codeComment/codeCommentSet.ts
|
|
10298
|
-
import
|
|
10316
|
+
import chalk103 from "chalk";
|
|
10299
10317
|
|
|
10300
10318
|
// src/commands/codeComment/validateCommentText.ts
|
|
10301
10319
|
var MAX_COMMENT_LENGTH = 50;
|
|
@@ -10346,27 +10364,27 @@ function generatePin() {
|
|
|
10346
10364
|
function codeCommentSet(file, line, text8) {
|
|
10347
10365
|
const lineNumber = Number.parseInt(line, 10);
|
|
10348
10366
|
if (!Number.isInteger(lineNumber) || lineNumber < 1) {
|
|
10349
|
-
console.error(
|
|
10367
|
+
console.error(chalk103.red(`Invalid line number: ${line}`));
|
|
10350
10368
|
process.exitCode = 1;
|
|
10351
10369
|
return;
|
|
10352
10370
|
}
|
|
10353
10371
|
const marker = isYamlFile(file) ? "#" : "//";
|
|
10354
10372
|
const validation = validateCommentText(text8, isYamlFile(file));
|
|
10355
10373
|
if (!validation.ok) {
|
|
10356
|
-
console.error(
|
|
10357
|
-
console.error(
|
|
10374
|
+
console.error(chalk103.red(`Refused: ${validation.reason}`));
|
|
10375
|
+
console.error(chalk103.red("No pin issued."));
|
|
10358
10376
|
process.exitCode = 1;
|
|
10359
10377
|
return;
|
|
10360
10378
|
}
|
|
10361
10379
|
console.error(
|
|
10362
|
-
|
|
10380
|
+
chalk103.yellow.bold(
|
|
10363
10381
|
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a comment. DO NOT WASTE THEIR TIME.\nYou had BETTER BE RIGHT that this comment is genuinely necessary.\n\nComments are a last resort, not a habit. Almost every comment you reach for is a sign\nthe code should be clearer instead. Before a human is pulled in, ask whether a better\nname, a smaller function, or a test would make the comment redundant. ONLY if you are\ncertain this one line earns its keep should you proceed to the confirm step below."
|
|
10364
10382
|
)
|
|
10365
10383
|
);
|
|
10366
10384
|
const delivered = issuePin(file, lineNumber, validation.text);
|
|
10367
10385
|
if (!delivered) {
|
|
10368
10386
|
console.error(
|
|
10369
|
-
|
|
10387
|
+
chalk103.red(
|
|
10370
10388
|
"Could not deliver the confirmation pin via notification.\nThe comment cannot be confirmed until the notification channel works."
|
|
10371
10389
|
)
|
|
10372
10390
|
);
|
|
@@ -10376,7 +10394,7 @@ function codeCommentSet(file, line, text8) {
|
|
|
10376
10394
|
console.log(
|
|
10377
10395
|
`A confirmation pin was sent to your desktop notifications.
|
|
10378
10396
|
To insert "${marker} ${validation.text}" at ${file}:${lineNumber}, run:
|
|
10379
|
-
${
|
|
10397
|
+
${chalk103.cyan(" assist code-comment confirm <PIN>")}
|
|
10380
10398
|
using the pin from that notification.`
|
|
10381
10399
|
);
|
|
10382
10400
|
}
|
|
@@ -10396,15 +10414,15 @@ function registerCodeComment(parent) {
|
|
|
10396
10414
|
}
|
|
10397
10415
|
|
|
10398
10416
|
// src/commands/complexity/analyze.ts
|
|
10399
|
-
import
|
|
10417
|
+
import chalk112 from "chalk";
|
|
10400
10418
|
|
|
10401
10419
|
// src/commands/complexity/cyclomatic.ts
|
|
10402
|
-
import
|
|
10420
|
+
import chalk105 from "chalk";
|
|
10403
10421
|
|
|
10404
10422
|
// src/commands/complexity/shared/index.ts
|
|
10405
10423
|
import fs17 from "fs";
|
|
10406
10424
|
import path21 from "path";
|
|
10407
|
-
import
|
|
10425
|
+
import chalk104 from "chalk";
|
|
10408
10426
|
import ts5 from "typescript";
|
|
10409
10427
|
|
|
10410
10428
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -10655,7 +10673,7 @@ function createSourceFromFile(filePath) {
|
|
|
10655
10673
|
function withSourceFiles(pattern2, callback, extraIgnore = []) {
|
|
10656
10674
|
const files = findSourceFiles2(pattern2, ".", extraIgnore);
|
|
10657
10675
|
if (files.length === 0) {
|
|
10658
|
-
console.log(
|
|
10676
|
+
console.log(chalk104.yellow("No files found matching pattern"));
|
|
10659
10677
|
return void 0;
|
|
10660
10678
|
}
|
|
10661
10679
|
return callback(files);
|
|
@@ -10688,11 +10706,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
10688
10706
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
10689
10707
|
for (const { file, name, complexity } of results) {
|
|
10690
10708
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
10691
|
-
const color = exceedsThreshold ?
|
|
10692
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
10709
|
+
const color = exceedsThreshold ? chalk105.red : chalk105.white;
|
|
10710
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk105.cyan(complexity)}`);
|
|
10693
10711
|
}
|
|
10694
10712
|
console.log(
|
|
10695
|
-
|
|
10713
|
+
chalk105.dim(
|
|
10696
10714
|
`
|
|
10697
10715
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
10698
10716
|
)
|
|
@@ -10704,7 +10722,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
10704
10722
|
}
|
|
10705
10723
|
|
|
10706
10724
|
// src/commands/complexity/halstead.ts
|
|
10707
|
-
import
|
|
10725
|
+
import chalk106 from "chalk";
|
|
10708
10726
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
10709
10727
|
withSourceFiles(pattern2, (files) => {
|
|
10710
10728
|
const results = [];
|
|
@@ -10719,13 +10737,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
10719
10737
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
10720
10738
|
for (const { file, name, metrics } of results) {
|
|
10721
10739
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
10722
|
-
const color = exceedsThreshold ?
|
|
10740
|
+
const color = exceedsThreshold ? chalk106.red : chalk106.white;
|
|
10723
10741
|
console.log(
|
|
10724
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
10742
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk106.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk106.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk106.magenta(metrics.effort.toFixed(1))}`
|
|
10725
10743
|
);
|
|
10726
10744
|
}
|
|
10727
10745
|
console.log(
|
|
10728
|
-
|
|
10746
|
+
chalk106.dim(
|
|
10729
10747
|
`
|
|
10730
10748
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
10731
10749
|
)
|
|
@@ -10737,27 +10755,27 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
10737
10755
|
}
|
|
10738
10756
|
|
|
10739
10757
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
10740
|
-
import
|
|
10758
|
+
import chalk109 from "chalk";
|
|
10741
10759
|
|
|
10742
10760
|
// src/commands/complexity/maintainability/formatResultLine.ts
|
|
10743
|
-
import
|
|
10761
|
+
import chalk107 from "chalk";
|
|
10744
10762
|
function formatResultLine(entry, failing) {
|
|
10745
10763
|
const { file, avgMaintainability, minMaintainability, override } = entry;
|
|
10746
|
-
const name = failing ?
|
|
10747
|
-
const suffix = override !== void 0 ?
|
|
10748
|
-
return `${name} \u2192 avg: ${
|
|
10764
|
+
const name = failing ? chalk107.red(file) : chalk107.white(file);
|
|
10765
|
+
const suffix = override !== void 0 ? chalk107.magenta(` (override: ${override})`) : "";
|
|
10766
|
+
return `${name} \u2192 avg: ${chalk107.cyan(avgMaintainability.toFixed(1))}, min: ${chalk107.yellow(minMaintainability.toFixed(1))}${suffix}`;
|
|
10749
10767
|
}
|
|
10750
10768
|
|
|
10751
10769
|
// src/commands/complexity/maintainability/printMaintainabilityFailure.ts
|
|
10752
|
-
import
|
|
10770
|
+
import chalk108 from "chalk";
|
|
10753
10771
|
function printMaintainabilityFailure(failingCount, threshold) {
|
|
10754
10772
|
const thresholdLabel = threshold !== void 0 ? ` ${threshold}` : "";
|
|
10755
10773
|
console.error(
|
|
10756
|
-
|
|
10774
|
+
chalk108.red(
|
|
10757
10775
|
`
|
|
10758
10776
|
Fail: ${failingCount} file(s) below threshold${thresholdLabel} (files marked "(override: N)" were judged against their own marker). Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
10759
10777
|
|
|
10760
|
-
\u26A0\uFE0F ${
|
|
10778
|
+
\u26A0\uFE0F ${chalk108.bold("Diagnose and fix one file at a time")} \u2014 do not investigate or fix multiple files in parallel.
|
|
10761
10779
|
|
|
10762
10780
|
The score is a property of the whole file, not your diff: any existing logic counts, so the fix is to shrink the file \u2014 not to revert or micro-optimize the lines you just changed. Identify the largest cohesive responsibility (often the biggest function, or a related group of functions) and move it to a new file with 'assist refactor extract'. Run 'assist complexity <file>' for per-function metrics only to locate that responsibility, not to tweak individual lines.`
|
|
10763
10781
|
)
|
|
@@ -10769,7 +10787,7 @@ function displayMaintainabilityResults(results, threshold) {
|
|
|
10769
10787
|
const gating = threshold !== void 0 || results.some((r) => r.override !== void 0);
|
|
10770
10788
|
if (!gating) {
|
|
10771
10789
|
for (const entry of results) console.log(formatResultLine(entry, false));
|
|
10772
|
-
console.log(
|
|
10790
|
+
console.log(chalk109.dim(`
|
|
10773
10791
|
Analyzed ${results.length} files`));
|
|
10774
10792
|
return;
|
|
10775
10793
|
}
|
|
@@ -10778,7 +10796,7 @@ Analyzed ${results.length} files`));
|
|
|
10778
10796
|
return limit !== void 0 && r.minMaintainability < limit;
|
|
10779
10797
|
});
|
|
10780
10798
|
if (failing.length === 0) {
|
|
10781
|
-
console.log(
|
|
10799
|
+
console.log(chalk109.green("All files pass maintainability threshold"));
|
|
10782
10800
|
} else {
|
|
10783
10801
|
for (const entry of failing) console.log(formatResultLine(entry, true));
|
|
10784
10802
|
}
|
|
@@ -10787,7 +10805,7 @@ Analyzed ${results.length} files`));
|
|
|
10787
10805
|
);
|
|
10788
10806
|
for (const entry of passingOverrides)
|
|
10789
10807
|
console.log(formatResultLine(entry, false));
|
|
10790
|
-
console.log(
|
|
10808
|
+
console.log(chalk109.dim(`
|
|
10791
10809
|
Analyzed ${results.length} files`));
|
|
10792
10810
|
if (failing.length > 0) {
|
|
10793
10811
|
printMaintainabilityFailure(failing.length, threshold);
|
|
@@ -10796,10 +10814,10 @@ Analyzed ${results.length} files`));
|
|
|
10796
10814
|
}
|
|
10797
10815
|
|
|
10798
10816
|
// src/commands/complexity/maintainability/printMaintainabilityFormula.ts
|
|
10799
|
-
import
|
|
10817
|
+
import chalk110 from "chalk";
|
|
10800
10818
|
var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
|
|
10801
10819
|
function printMaintainabilityFormula() {
|
|
10802
|
-
console.log(
|
|
10820
|
+
console.log(chalk110.dim(MI_FORMULA));
|
|
10803
10821
|
}
|
|
10804
10822
|
|
|
10805
10823
|
// src/commands/complexity/maintainability/collectFileMetrics.ts
|
|
@@ -10875,7 +10893,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
10875
10893
|
|
|
10876
10894
|
// src/commands/complexity/sloc.ts
|
|
10877
10895
|
import fs19 from "fs";
|
|
10878
|
-
import
|
|
10896
|
+
import chalk111 from "chalk";
|
|
10879
10897
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
10880
10898
|
withSourceFiles(pattern2, (files) => {
|
|
10881
10899
|
const results = [];
|
|
@@ -10891,12 +10909,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
10891
10909
|
results.sort((a, b) => b.lines - a.lines);
|
|
10892
10910
|
for (const { file, lines } of results) {
|
|
10893
10911
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
10894
|
-
const color = exceedsThreshold ?
|
|
10895
|
-
console.log(`${color(file)} \u2192 ${
|
|
10912
|
+
const color = exceedsThreshold ? chalk111.red : chalk111.white;
|
|
10913
|
+
console.log(`${color(file)} \u2192 ${chalk111.cyan(lines)} lines`);
|
|
10896
10914
|
}
|
|
10897
10915
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
10898
10916
|
console.log(
|
|
10899
|
-
|
|
10917
|
+
chalk111.dim(`
|
|
10900
10918
|
Total: ${total} lines across ${files.length} files`)
|
|
10901
10919
|
);
|
|
10902
10920
|
if (hasViolation) {
|
|
@@ -10910,25 +10928,25 @@ async function analyze(pattern2) {
|
|
|
10910
10928
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
10911
10929
|
const files = findSourceFiles2(searchPattern);
|
|
10912
10930
|
if (files.length === 0) {
|
|
10913
|
-
console.log(
|
|
10931
|
+
console.log(chalk112.yellow("No files found matching pattern"));
|
|
10914
10932
|
return;
|
|
10915
10933
|
}
|
|
10916
10934
|
if (files.length === 1) {
|
|
10917
10935
|
const file = files[0];
|
|
10918
|
-
console.log(
|
|
10936
|
+
console.log(chalk112.bold.underline("SLOC"));
|
|
10919
10937
|
await sloc(file);
|
|
10920
10938
|
console.log();
|
|
10921
|
-
console.log(
|
|
10939
|
+
console.log(chalk112.bold.underline("Cyclomatic Complexity"));
|
|
10922
10940
|
await cyclomatic(file);
|
|
10923
10941
|
console.log();
|
|
10924
|
-
console.log(
|
|
10942
|
+
console.log(chalk112.bold.underline("Halstead Metrics"));
|
|
10925
10943
|
await halstead(file);
|
|
10926
10944
|
console.log();
|
|
10927
|
-
console.log(
|
|
10945
|
+
console.log(chalk112.bold.underline("Maintainability Index"));
|
|
10928
10946
|
await maintainability(file);
|
|
10929
10947
|
console.log();
|
|
10930
10948
|
console.log(
|
|
10931
|
-
|
|
10949
|
+
chalk112.dim(
|
|
10932
10950
|
"To improve the maintainability index, extract functions and logic out of this file into separate, smaller modules. Collapsing whitespace or removing comments is not the goal."
|
|
10933
10951
|
)
|
|
10934
10952
|
);
|
|
@@ -10962,7 +10980,7 @@ function registerComplexity(program2) {
|
|
|
10962
10980
|
}
|
|
10963
10981
|
|
|
10964
10982
|
// src/commands/config/index.ts
|
|
10965
|
-
import
|
|
10983
|
+
import chalk113 from "chalk";
|
|
10966
10984
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
10967
10985
|
|
|
10968
10986
|
// src/commands/config/setNestedValue.ts
|
|
@@ -11025,7 +11043,7 @@ function formatIssuePath(issue, key) {
|
|
|
11025
11043
|
function printValidationErrors(issues, key) {
|
|
11026
11044
|
for (const issue of issues) {
|
|
11027
11045
|
console.error(
|
|
11028
|
-
|
|
11046
|
+
chalk113.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
11029
11047
|
);
|
|
11030
11048
|
}
|
|
11031
11049
|
}
|
|
@@ -11042,7 +11060,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
11042
11060
|
function assertNotGlobalOnly(key, global) {
|
|
11043
11061
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
11044
11062
|
console.error(
|
|
11045
|
-
|
|
11063
|
+
chalk113.red(
|
|
11046
11064
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
11047
11065
|
)
|
|
11048
11066
|
);
|
|
@@ -11065,7 +11083,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
11065
11083
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
11066
11084
|
const target = options2.global ? "global" : "project";
|
|
11067
11085
|
console.log(
|
|
11068
|
-
|
|
11086
|
+
chalk113.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
11069
11087
|
);
|
|
11070
11088
|
}
|
|
11071
11089
|
function configList() {
|
|
@@ -11074,7 +11092,7 @@ function configList() {
|
|
|
11074
11092
|
}
|
|
11075
11093
|
|
|
11076
11094
|
// src/commands/config/configGet.ts
|
|
11077
|
-
import
|
|
11095
|
+
import chalk114 from "chalk";
|
|
11078
11096
|
|
|
11079
11097
|
// src/commands/config/getNestedValue.ts
|
|
11080
11098
|
function isTraversable(value) {
|
|
@@ -11106,7 +11124,7 @@ function requireNestedValue(config, key) {
|
|
|
11106
11124
|
return value;
|
|
11107
11125
|
}
|
|
11108
11126
|
function exitKeyNotSet(key) {
|
|
11109
|
-
console.error(
|
|
11127
|
+
console.error(chalk114.red(`Key "${key}" is not set`));
|
|
11110
11128
|
process.exit(1);
|
|
11111
11129
|
}
|
|
11112
11130
|
|
|
@@ -11120,7 +11138,7 @@ function registerConfig(program2) {
|
|
|
11120
11138
|
|
|
11121
11139
|
// src/commands/deploy/redirect.ts
|
|
11122
11140
|
import { existsSync as existsSync30, readFileSync as readFileSync25, writeFileSync as writeFileSync24 } from "fs";
|
|
11123
|
-
import
|
|
11141
|
+
import chalk115 from "chalk";
|
|
11124
11142
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
11125
11143
|
if (!window.location.pathname.endsWith('/')) {
|
|
11126
11144
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -11129,23 +11147,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
11129
11147
|
function redirect() {
|
|
11130
11148
|
const indexPath = "index.html";
|
|
11131
11149
|
if (!existsSync30(indexPath)) {
|
|
11132
|
-
console.log(
|
|
11150
|
+
console.log(chalk115.yellow("No index.html found"));
|
|
11133
11151
|
return;
|
|
11134
11152
|
}
|
|
11135
11153
|
const content = readFileSync25(indexPath, "utf8");
|
|
11136
11154
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
11137
|
-
console.log(
|
|
11155
|
+
console.log(chalk115.dim("Trailing slash script already present"));
|
|
11138
11156
|
return;
|
|
11139
11157
|
}
|
|
11140
11158
|
const headCloseIndex = content.indexOf("</head>");
|
|
11141
11159
|
if (headCloseIndex === -1) {
|
|
11142
|
-
console.log(
|
|
11160
|
+
console.log(chalk115.red("Could not find </head> tag in index.html"));
|
|
11143
11161
|
return;
|
|
11144
11162
|
}
|
|
11145
11163
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
11146
11164
|
${content.slice(headCloseIndex)}`;
|
|
11147
11165
|
writeFileSync24(indexPath, newContent);
|
|
11148
|
-
console.log(
|
|
11166
|
+
console.log(chalk115.green("Added trailing slash redirect to index.html"));
|
|
11149
11167
|
}
|
|
11150
11168
|
|
|
11151
11169
|
// src/commands/registerDeploy.ts
|
|
@@ -11172,7 +11190,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
11172
11190
|
|
|
11173
11191
|
// src/commands/devlog/shared.ts
|
|
11174
11192
|
import { execSync as execSync26 } from "child_process";
|
|
11175
|
-
import
|
|
11193
|
+
import chalk116 from "chalk";
|
|
11176
11194
|
|
|
11177
11195
|
// src/shared/getRepoName.ts
|
|
11178
11196
|
import { existsSync as existsSync31, readFileSync as readFileSync26 } from "fs";
|
|
@@ -11281,13 +11299,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
11281
11299
|
}
|
|
11282
11300
|
function printCommitsWithFiles(commits2, ignore2, verbose) {
|
|
11283
11301
|
for (const commit2 of commits2) {
|
|
11284
|
-
console.log(` ${
|
|
11302
|
+
console.log(` ${chalk116.yellow(commit2.hash)} ${commit2.message}`);
|
|
11285
11303
|
if (verbose) {
|
|
11286
11304
|
const visibleFiles = commit2.files.filter(
|
|
11287
11305
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
11288
11306
|
);
|
|
11289
11307
|
for (const file of visibleFiles) {
|
|
11290
|
-
console.log(` ${
|
|
11308
|
+
console.log(` ${chalk116.dim(file)}`);
|
|
11291
11309
|
}
|
|
11292
11310
|
}
|
|
11293
11311
|
}
|
|
@@ -11312,15 +11330,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
11312
11330
|
}
|
|
11313
11331
|
|
|
11314
11332
|
// src/commands/devlog/list/printDateHeader.ts
|
|
11315
|
-
import
|
|
11333
|
+
import chalk117 from "chalk";
|
|
11316
11334
|
function printDateHeader(date, isSkipped, entries) {
|
|
11317
11335
|
if (isSkipped) {
|
|
11318
|
-
console.log(`${
|
|
11336
|
+
console.log(`${chalk117.bold.blue(date)} ${chalk117.dim("skipped")}`);
|
|
11319
11337
|
} else if (entries && entries.length > 0) {
|
|
11320
|
-
const entryInfo = entries.map((e) => `${
|
|
11321
|
-
console.log(`${
|
|
11338
|
+
const entryInfo = entries.map((e) => `${chalk117.green(e.version)} ${e.title}`).join(" | ");
|
|
11339
|
+
console.log(`${chalk117.bold.blue(date)} ${entryInfo}`);
|
|
11322
11340
|
} else {
|
|
11323
|
-
console.log(`${
|
|
11341
|
+
console.log(`${chalk117.bold.blue(date)} ${chalk117.red("\u26A0 devlog missing")}`);
|
|
11324
11342
|
}
|
|
11325
11343
|
}
|
|
11326
11344
|
|
|
@@ -11424,24 +11442,24 @@ function bumpVersion(version2, type) {
|
|
|
11424
11442
|
|
|
11425
11443
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
11426
11444
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
11427
|
-
import
|
|
11445
|
+
import chalk119 from "chalk";
|
|
11428
11446
|
|
|
11429
11447
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
11430
|
-
import
|
|
11448
|
+
import chalk118 from "chalk";
|
|
11431
11449
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
11432
11450
|
if (conventional && firstHash) {
|
|
11433
11451
|
const version2 = getVersionAtCommit(firstHash);
|
|
11434
11452
|
if (version2) {
|
|
11435
|
-
console.log(`${
|
|
11453
|
+
console.log(`${chalk118.bold("version:")} ${stripToMinor(version2)}`);
|
|
11436
11454
|
} else {
|
|
11437
|
-
console.log(`${
|
|
11455
|
+
console.log(`${chalk118.bold("version:")} ${chalk118.red("unknown")}`);
|
|
11438
11456
|
}
|
|
11439
11457
|
} else if (patchVersion && minorVersion) {
|
|
11440
11458
|
console.log(
|
|
11441
|
-
`${
|
|
11459
|
+
`${chalk118.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
11442
11460
|
);
|
|
11443
11461
|
} else {
|
|
11444
|
-
console.log(`${
|
|
11462
|
+
console.log(`${chalk118.bold("version:")} v0.1 (initial)`);
|
|
11445
11463
|
}
|
|
11446
11464
|
}
|
|
11447
11465
|
|
|
@@ -11489,16 +11507,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
11489
11507
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
11490
11508
|
}
|
|
11491
11509
|
function logName(repoName) {
|
|
11492
|
-
console.log(`${
|
|
11510
|
+
console.log(`${chalk119.bold("name:")} ${repoName}`);
|
|
11493
11511
|
}
|
|
11494
11512
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
11495
11513
|
logName(ctx.repoName);
|
|
11496
11514
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
11497
|
-
console.log(
|
|
11515
|
+
console.log(chalk119.bold.blue(targetDate));
|
|
11498
11516
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
11499
11517
|
}
|
|
11500
11518
|
function logNoCommits(lastInfo) {
|
|
11501
|
-
console.log(
|
|
11519
|
+
console.log(chalk119.dim(noCommitsMessage(!!lastInfo)));
|
|
11502
11520
|
}
|
|
11503
11521
|
|
|
11504
11522
|
// src/commands/devlog/next/index.ts
|
|
@@ -11539,11 +11557,11 @@ function next2(options2) {
|
|
|
11539
11557
|
import { execSync as execSync28 } from "child_process";
|
|
11540
11558
|
|
|
11541
11559
|
// src/commands/devlog/repos/printReposTable.ts
|
|
11542
|
-
import
|
|
11560
|
+
import chalk120 from "chalk";
|
|
11543
11561
|
function colorStatus(status2) {
|
|
11544
|
-
if (status2 === "missing") return
|
|
11545
|
-
if (status2 === "outdated") return
|
|
11546
|
-
return
|
|
11562
|
+
if (status2 === "missing") return chalk120.red(status2);
|
|
11563
|
+
if (status2 === "outdated") return chalk120.yellow(status2);
|
|
11564
|
+
return chalk120.green(status2);
|
|
11547
11565
|
}
|
|
11548
11566
|
function formatRow(row, nameWidth) {
|
|
11549
11567
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -11557,8 +11575,8 @@ function printReposTable(rows) {
|
|
|
11557
11575
|
"Last Devlog".padEnd(11),
|
|
11558
11576
|
"Status"
|
|
11559
11577
|
].join(" ");
|
|
11560
|
-
console.log(
|
|
11561
|
-
console.log(
|
|
11578
|
+
console.log(chalk120.dim(header));
|
|
11579
|
+
console.log(chalk120.dim("-".repeat(header.length)));
|
|
11562
11580
|
for (const row of rows) {
|
|
11563
11581
|
console.log(formatRow(row, nameWidth));
|
|
11564
11582
|
}
|
|
@@ -11616,14 +11634,14 @@ function repos(options2) {
|
|
|
11616
11634
|
// src/commands/devlog/skip.ts
|
|
11617
11635
|
import { writeFileSync as writeFileSync25 } from "fs";
|
|
11618
11636
|
import { join as join32 } from "path";
|
|
11619
|
-
import
|
|
11637
|
+
import chalk121 from "chalk";
|
|
11620
11638
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
11621
11639
|
function getBlogConfigPath() {
|
|
11622
11640
|
return join32(BLOG_REPO_ROOT, "assist.yml");
|
|
11623
11641
|
}
|
|
11624
11642
|
function skip(date) {
|
|
11625
11643
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
11626
|
-
console.log(
|
|
11644
|
+
console.log(chalk121.red("Invalid date format. Use YYYY-MM-DD"));
|
|
11627
11645
|
process.exit(1);
|
|
11628
11646
|
}
|
|
11629
11647
|
const repoName = getRepoName();
|
|
@@ -11634,7 +11652,7 @@ function skip(date) {
|
|
|
11634
11652
|
const skipDays = skip2[repoName] ?? [];
|
|
11635
11653
|
if (skipDays.includes(date)) {
|
|
11636
11654
|
console.log(
|
|
11637
|
-
|
|
11655
|
+
chalk121.yellow(`${date} is already in skip list for ${repoName}`)
|
|
11638
11656
|
);
|
|
11639
11657
|
return;
|
|
11640
11658
|
}
|
|
@@ -11644,20 +11662,20 @@ function skip(date) {
|
|
|
11644
11662
|
devlog.skip = skip2;
|
|
11645
11663
|
config.devlog = devlog;
|
|
11646
11664
|
writeFileSync25(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
11647
|
-
console.log(
|
|
11665
|
+
console.log(chalk121.green(`Added ${date} to skip list for ${repoName}`));
|
|
11648
11666
|
}
|
|
11649
11667
|
|
|
11650
11668
|
// src/commands/devlog/version.ts
|
|
11651
|
-
import
|
|
11669
|
+
import chalk122 from "chalk";
|
|
11652
11670
|
function version() {
|
|
11653
11671
|
const config = loadConfig();
|
|
11654
11672
|
const name = getRepoName();
|
|
11655
11673
|
const lastInfo = getLastVersionInfo(name, config);
|
|
11656
11674
|
const lastVersion = lastInfo?.version ?? null;
|
|
11657
11675
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
11658
|
-
console.log(`${
|
|
11659
|
-
console.log(`${
|
|
11660
|
-
console.log(`${
|
|
11676
|
+
console.log(`${chalk122.bold("name:")} ${name}`);
|
|
11677
|
+
console.log(`${chalk122.bold("last:")} ${lastVersion ?? chalk122.dim("none")}`);
|
|
11678
|
+
console.log(`${chalk122.bold("next:")} ${nextVersion ?? chalk122.dim("none")}`);
|
|
11661
11679
|
}
|
|
11662
11680
|
|
|
11663
11681
|
// src/commands/registerDevlog.ts
|
|
@@ -11681,7 +11699,7 @@ function registerDevlog(program2) {
|
|
|
11681
11699
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
11682
11700
|
import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync4 } from "fs";
|
|
11683
11701
|
import { join as join33 } from "path";
|
|
11684
|
-
import
|
|
11702
|
+
import chalk123 from "chalk";
|
|
11685
11703
|
|
|
11686
11704
|
// src/shared/findRepoRoot.ts
|
|
11687
11705
|
import { existsSync as existsSync32 } from "fs";
|
|
@@ -11744,14 +11762,14 @@ function checkBuildLocks(startDir) {
|
|
|
11744
11762
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
11745
11763
|
if (locked) {
|
|
11746
11764
|
console.error(
|
|
11747
|
-
|
|
11765
|
+
chalk123.red("Build output locked (is VS debugging?): ") + locked
|
|
11748
11766
|
);
|
|
11749
11767
|
process.exit(1);
|
|
11750
11768
|
}
|
|
11751
11769
|
}
|
|
11752
11770
|
async function checkBuildLocksCommand() {
|
|
11753
11771
|
checkBuildLocks();
|
|
11754
|
-
console.log(
|
|
11772
|
+
console.log(chalk123.green("No build locks detected"));
|
|
11755
11773
|
}
|
|
11756
11774
|
|
|
11757
11775
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -11850,30 +11868,30 @@ function escapeRegex(s) {
|
|
|
11850
11868
|
}
|
|
11851
11869
|
|
|
11852
11870
|
// src/commands/dotnet/printTree.ts
|
|
11853
|
-
import
|
|
11871
|
+
import chalk124 from "chalk";
|
|
11854
11872
|
function printNodes(nodes, prefix2) {
|
|
11855
11873
|
for (let i = 0; i < nodes.length; i++) {
|
|
11856
11874
|
const isLast = i === nodes.length - 1;
|
|
11857
11875
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
11858
11876
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
11859
11877
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
11860
|
-
const label2 = isMissing ?
|
|
11878
|
+
const label2 = isMissing ? chalk124.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
11861
11879
|
console.log(`${prefix2}${connector}${label2}`);
|
|
11862
11880
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
11863
11881
|
}
|
|
11864
11882
|
}
|
|
11865
11883
|
function printTree(tree, totalCount, solutions) {
|
|
11866
|
-
console.log(
|
|
11867
|
-
console.log(
|
|
11884
|
+
console.log(chalk124.bold("\nProject Dependency Tree"));
|
|
11885
|
+
console.log(chalk124.cyan(tree.relativePath));
|
|
11868
11886
|
printNodes(tree.children, "");
|
|
11869
|
-
console.log(
|
|
11887
|
+
console.log(chalk124.dim(`
|
|
11870
11888
|
${totalCount} projects total (including root)`));
|
|
11871
|
-
console.log(
|
|
11889
|
+
console.log(chalk124.bold("\nSolution Membership"));
|
|
11872
11890
|
if (solutions.length === 0) {
|
|
11873
|
-
console.log(
|
|
11891
|
+
console.log(chalk124.yellow(" Not found in any .sln"));
|
|
11874
11892
|
} else {
|
|
11875
11893
|
for (const sln of solutions) {
|
|
11876
|
-
console.log(` ${
|
|
11894
|
+
console.log(` ${chalk124.green(sln)}`);
|
|
11877
11895
|
}
|
|
11878
11896
|
}
|
|
11879
11897
|
console.log();
|
|
@@ -11902,16 +11920,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
11902
11920
|
// src/commands/dotnet/resolveCsproj.ts
|
|
11903
11921
|
import { existsSync as existsSync33 } from "fs";
|
|
11904
11922
|
import path25 from "path";
|
|
11905
|
-
import
|
|
11923
|
+
import chalk125 from "chalk";
|
|
11906
11924
|
function resolveCsproj(csprojPath) {
|
|
11907
11925
|
const resolved = path25.resolve(csprojPath);
|
|
11908
11926
|
if (!existsSync33(resolved)) {
|
|
11909
|
-
console.error(
|
|
11927
|
+
console.error(chalk125.red(`File not found: ${resolved}`));
|
|
11910
11928
|
process.exit(1);
|
|
11911
11929
|
}
|
|
11912
11930
|
const repoRoot = findRepoRoot(path25.dirname(resolved));
|
|
11913
11931
|
if (!repoRoot) {
|
|
11914
|
-
console.error(
|
|
11932
|
+
console.error(chalk125.red("Could not find git repository root"));
|
|
11915
11933
|
process.exit(1);
|
|
11916
11934
|
}
|
|
11917
11935
|
return { resolved, repoRoot };
|
|
@@ -11961,12 +11979,12 @@ function getChangedCsFiles(scope) {
|
|
|
11961
11979
|
}
|
|
11962
11980
|
|
|
11963
11981
|
// src/commands/dotnet/inSln.ts
|
|
11964
|
-
import
|
|
11982
|
+
import chalk126 from "chalk";
|
|
11965
11983
|
async function inSln(csprojPath) {
|
|
11966
11984
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
11967
11985
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
11968
11986
|
if (solutions.length === 0) {
|
|
11969
|
-
console.log(
|
|
11987
|
+
console.log(chalk126.yellow("Not found in any .sln file"));
|
|
11970
11988
|
process.exit(1);
|
|
11971
11989
|
}
|
|
11972
11990
|
for (const sln of solutions) {
|
|
@@ -11975,7 +11993,7 @@ async function inSln(csprojPath) {
|
|
|
11975
11993
|
}
|
|
11976
11994
|
|
|
11977
11995
|
// src/commands/dotnet/inspect.ts
|
|
11978
|
-
import
|
|
11996
|
+
import chalk132 from "chalk";
|
|
11979
11997
|
|
|
11980
11998
|
// src/shared/formatElapsed.ts
|
|
11981
11999
|
function formatElapsed(ms) {
|
|
@@ -11987,12 +12005,12 @@ function formatElapsed(ms) {
|
|
|
11987
12005
|
}
|
|
11988
12006
|
|
|
11989
12007
|
// src/commands/dotnet/displayIssues.ts
|
|
11990
|
-
import
|
|
12008
|
+
import chalk127 from "chalk";
|
|
11991
12009
|
var SEVERITY_COLOR = {
|
|
11992
|
-
ERROR:
|
|
11993
|
-
WARNING:
|
|
11994
|
-
SUGGESTION:
|
|
11995
|
-
HINT:
|
|
12010
|
+
ERROR: chalk127.red,
|
|
12011
|
+
WARNING: chalk127.yellow,
|
|
12012
|
+
SUGGESTION: chalk127.cyan,
|
|
12013
|
+
HINT: chalk127.dim
|
|
11996
12014
|
};
|
|
11997
12015
|
function groupByFile(issues) {
|
|
11998
12016
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -12008,15 +12026,15 @@ function groupByFile(issues) {
|
|
|
12008
12026
|
}
|
|
12009
12027
|
function displayIssues(issues) {
|
|
12010
12028
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
12011
|
-
console.log(
|
|
12029
|
+
console.log(chalk127.bold(file));
|
|
12012
12030
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
12013
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
12031
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk127.white;
|
|
12014
12032
|
console.log(
|
|
12015
|
-
` ${
|
|
12033
|
+
` ${chalk127.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
12016
12034
|
);
|
|
12017
12035
|
}
|
|
12018
12036
|
}
|
|
12019
|
-
console.log(
|
|
12037
|
+
console.log(chalk127.dim(`
|
|
12020
12038
|
${issues.length} issue(s) found`));
|
|
12021
12039
|
}
|
|
12022
12040
|
|
|
@@ -12075,12 +12093,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
12075
12093
|
// src/commands/dotnet/resolveSolution.ts
|
|
12076
12094
|
import { existsSync as existsSync34 } from "fs";
|
|
12077
12095
|
import path26 from "path";
|
|
12078
|
-
import
|
|
12096
|
+
import chalk129 from "chalk";
|
|
12079
12097
|
|
|
12080
12098
|
// src/commands/dotnet/findSolution.ts
|
|
12081
12099
|
import { readdirSync as readdirSync6 } from "fs";
|
|
12082
12100
|
import { dirname as dirname20, join as join34 } from "path";
|
|
12083
|
-
import
|
|
12101
|
+
import chalk128 from "chalk";
|
|
12084
12102
|
function findSlnInDir(dir) {
|
|
12085
12103
|
try {
|
|
12086
12104
|
return readdirSync6(dir).filter((f) => f.endsWith(".sln")).map((f) => join34(dir, f));
|
|
@@ -12096,17 +12114,17 @@ function findSolution() {
|
|
|
12096
12114
|
const slnFiles = findSlnInDir(current);
|
|
12097
12115
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
12098
12116
|
if (slnFiles.length > 1) {
|
|
12099
|
-
console.error(
|
|
12117
|
+
console.error(chalk128.red(`Multiple .sln files found in ${current}:`));
|
|
12100
12118
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
12101
12119
|
console.error(
|
|
12102
|
-
|
|
12120
|
+
chalk128.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
12103
12121
|
);
|
|
12104
12122
|
process.exit(1);
|
|
12105
12123
|
}
|
|
12106
12124
|
if (current === ceiling) break;
|
|
12107
12125
|
current = dirname20(current);
|
|
12108
12126
|
}
|
|
12109
|
-
console.error(
|
|
12127
|
+
console.error(chalk128.red("No .sln file found between cwd and repo root"));
|
|
12110
12128
|
process.exit(1);
|
|
12111
12129
|
}
|
|
12112
12130
|
|
|
@@ -12115,7 +12133,7 @@ function resolveSolution(sln) {
|
|
|
12115
12133
|
if (sln) {
|
|
12116
12134
|
const resolved = path26.resolve(sln);
|
|
12117
12135
|
if (!existsSync34(resolved)) {
|
|
12118
|
-
console.error(
|
|
12136
|
+
console.error(chalk129.red(`Solution file not found: ${resolved}`));
|
|
12119
12137
|
process.exit(1);
|
|
12120
12138
|
}
|
|
12121
12139
|
return resolved;
|
|
@@ -12157,14 +12175,14 @@ import { execSync as execSync30 } from "child_process";
|
|
|
12157
12175
|
import { existsSync as existsSync35, readFileSync as readFileSync30, unlinkSync as unlinkSync9 } from "fs";
|
|
12158
12176
|
import { tmpdir as tmpdir3 } from "os";
|
|
12159
12177
|
import path27 from "path";
|
|
12160
|
-
import
|
|
12178
|
+
import chalk130 from "chalk";
|
|
12161
12179
|
function assertJbInstalled() {
|
|
12162
12180
|
try {
|
|
12163
12181
|
execSync30("jb inspectcode --version", { stdio: "pipe" });
|
|
12164
12182
|
} catch {
|
|
12165
|
-
console.error(
|
|
12183
|
+
console.error(chalk130.red("jb is not installed. Install with:"));
|
|
12166
12184
|
console.error(
|
|
12167
|
-
|
|
12185
|
+
chalk130.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
12168
12186
|
);
|
|
12169
12187
|
process.exit(1);
|
|
12170
12188
|
}
|
|
@@ -12182,11 +12200,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
12182
12200
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
12183
12201
|
process.stderr.write(error.stderr);
|
|
12184
12202
|
}
|
|
12185
|
-
console.error(
|
|
12203
|
+
console.error(chalk130.red("jb inspectcode failed"));
|
|
12186
12204
|
process.exit(1);
|
|
12187
12205
|
}
|
|
12188
12206
|
if (!existsSync35(reportPath)) {
|
|
12189
|
-
console.error(
|
|
12207
|
+
console.error(chalk130.red("Report file not generated"));
|
|
12190
12208
|
process.exit(1);
|
|
12191
12209
|
}
|
|
12192
12210
|
const xml = readFileSync30(reportPath, "utf8");
|
|
@@ -12196,7 +12214,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
12196
12214
|
|
|
12197
12215
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
12198
12216
|
import { execSync as execSync31 } from "child_process";
|
|
12199
|
-
import
|
|
12217
|
+
import chalk131 from "chalk";
|
|
12200
12218
|
function resolveMsbuildPath() {
|
|
12201
12219
|
const { run: run4 } = loadConfig();
|
|
12202
12220
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -12208,9 +12226,9 @@ function assertMsbuildInstalled() {
|
|
|
12208
12226
|
try {
|
|
12209
12227
|
execSync31(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
12210
12228
|
} catch {
|
|
12211
|
-
console.error(
|
|
12229
|
+
console.error(chalk131.red(`msbuild not found at: ${msbuild}`));
|
|
12212
12230
|
console.error(
|
|
12213
|
-
|
|
12231
|
+
chalk131.yellow(
|
|
12214
12232
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
12215
12233
|
)
|
|
12216
12234
|
);
|
|
@@ -12257,17 +12275,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
12257
12275
|
// src/commands/dotnet/inspect.ts
|
|
12258
12276
|
function logScope(changedFiles) {
|
|
12259
12277
|
if (changedFiles === null) {
|
|
12260
|
-
console.log(
|
|
12278
|
+
console.log(chalk132.dim("Inspecting full solution..."));
|
|
12261
12279
|
} else {
|
|
12262
12280
|
console.log(
|
|
12263
|
-
|
|
12281
|
+
chalk132.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
12264
12282
|
);
|
|
12265
12283
|
}
|
|
12266
12284
|
}
|
|
12267
12285
|
function reportResults(issues, elapsed) {
|
|
12268
12286
|
if (issues.length > 0) displayIssues(issues);
|
|
12269
|
-
else console.log(
|
|
12270
|
-
console.log(
|
|
12287
|
+
else console.log(chalk132.green("No issues found"));
|
|
12288
|
+
console.log(chalk132.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
12271
12289
|
if (issues.length > 0) process.exit(1);
|
|
12272
12290
|
}
|
|
12273
12291
|
async function inspect(sln, options2) {
|
|
@@ -12278,7 +12296,7 @@ async function inspect(sln, options2) {
|
|
|
12278
12296
|
const scope = parseScope(options2.scope);
|
|
12279
12297
|
const changedFiles = getChangedCsFiles(scope);
|
|
12280
12298
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
12281
|
-
console.log(
|
|
12299
|
+
console.log(chalk132.green("No changed .cs files found"));
|
|
12282
12300
|
return;
|
|
12283
12301
|
}
|
|
12284
12302
|
logScope(changedFiles);
|
|
@@ -12603,25 +12621,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
12603
12621
|
}
|
|
12604
12622
|
|
|
12605
12623
|
// src/commands/github/printCountTable.ts
|
|
12606
|
-
import
|
|
12624
|
+
import chalk133 from "chalk";
|
|
12607
12625
|
function printCountTable(labelHeader, rows) {
|
|
12608
12626
|
const labelWidth = Math.max(
|
|
12609
12627
|
labelHeader.length,
|
|
12610
12628
|
...rows.map((row) => row.label.length)
|
|
12611
12629
|
);
|
|
12612
12630
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
12613
|
-
console.log(
|
|
12614
|
-
console.log(
|
|
12631
|
+
console.log(chalk133.dim(header));
|
|
12632
|
+
console.log(chalk133.dim("-".repeat(header.length)));
|
|
12615
12633
|
for (const row of rows) {
|
|
12616
12634
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
12617
12635
|
}
|
|
12618
12636
|
}
|
|
12619
12637
|
|
|
12620
12638
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
12621
|
-
import
|
|
12639
|
+
import chalk134 from "chalk";
|
|
12622
12640
|
function printRepoAuthorBreakdown(repos2) {
|
|
12623
12641
|
for (const repo of repos2) {
|
|
12624
|
-
console.log(
|
|
12642
|
+
console.log(chalk134.bold(repo.name));
|
|
12625
12643
|
const authorWidth = Math.max(
|
|
12626
12644
|
0,
|
|
12627
12645
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -12939,7 +12957,7 @@ function registerHandover(program2) {
|
|
|
12939
12957
|
}
|
|
12940
12958
|
|
|
12941
12959
|
// src/commands/jira/acceptanceCriteria.ts
|
|
12942
|
-
import
|
|
12960
|
+
import chalk135 from "chalk";
|
|
12943
12961
|
|
|
12944
12962
|
// src/commands/jira/adfToText.ts
|
|
12945
12963
|
function renderInline(node) {
|
|
@@ -13006,7 +13024,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
13006
13024
|
const parsed = fetchIssue(issueKey, field);
|
|
13007
13025
|
const acValue = parsed?.fields?.[field];
|
|
13008
13026
|
if (!acValue) {
|
|
13009
|
-
console.log(
|
|
13027
|
+
console.log(chalk135.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
13010
13028
|
return;
|
|
13011
13029
|
}
|
|
13012
13030
|
if (typeof acValue === "string") {
|
|
@@ -13101,14 +13119,14 @@ async function jiraAuth() {
|
|
|
13101
13119
|
}
|
|
13102
13120
|
|
|
13103
13121
|
// src/commands/jira/viewIssue.ts
|
|
13104
|
-
import
|
|
13122
|
+
import chalk136 from "chalk";
|
|
13105
13123
|
function viewIssue(issueKey) {
|
|
13106
13124
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
13107
13125
|
const fields = parsed?.fields;
|
|
13108
13126
|
const summary = fields?.summary;
|
|
13109
13127
|
const description = fields?.description;
|
|
13110
13128
|
if (summary) {
|
|
13111
|
-
console.log(
|
|
13129
|
+
console.log(chalk136.bold(summary));
|
|
13112
13130
|
}
|
|
13113
13131
|
if (description) {
|
|
13114
13132
|
if (summary) console.log();
|
|
@@ -13122,7 +13140,7 @@ function viewIssue(issueKey) {
|
|
|
13122
13140
|
}
|
|
13123
13141
|
if (!summary && !description) {
|
|
13124
13142
|
console.log(
|
|
13125
|
-
|
|
13143
|
+
chalk136.yellow(`No summary or description found on ${issueKey}.`)
|
|
13126
13144
|
);
|
|
13127
13145
|
}
|
|
13128
13146
|
}
|
|
@@ -13138,13 +13156,13 @@ function registerJira(program2) {
|
|
|
13138
13156
|
// src/commands/reviewComments.ts
|
|
13139
13157
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
13140
13158
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
13141
|
-
import
|
|
13159
|
+
import chalk137 from "chalk";
|
|
13142
13160
|
async function reviewComments(number) {
|
|
13143
13161
|
if (number) {
|
|
13144
13162
|
try {
|
|
13145
13163
|
execFileSync5("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
13146
13164
|
} catch {
|
|
13147
|
-
console.error(
|
|
13165
|
+
console.error(chalk137.red(`gh pr checkout ${number} failed; aborting.`));
|
|
13148
13166
|
process.exit(1);
|
|
13149
13167
|
}
|
|
13150
13168
|
}
|
|
@@ -13218,15 +13236,15 @@ function registerList(program2) {
|
|
|
13218
13236
|
// src/commands/mermaid/index.ts
|
|
13219
13237
|
import { mkdirSync as mkdirSync14, readdirSync as readdirSync8 } from "fs";
|
|
13220
13238
|
import { resolve as resolve11 } from "path";
|
|
13221
|
-
import
|
|
13239
|
+
import chalk140 from "chalk";
|
|
13222
13240
|
|
|
13223
13241
|
// src/commands/mermaid/exportFile.ts
|
|
13224
13242
|
import { readFileSync as readFileSync33, writeFileSync as writeFileSync28 } from "fs";
|
|
13225
13243
|
import { basename as basename8, extname, resolve as resolve10 } from "path";
|
|
13226
|
-
import
|
|
13244
|
+
import chalk139 from "chalk";
|
|
13227
13245
|
|
|
13228
13246
|
// src/commands/mermaid/renderBlock.ts
|
|
13229
|
-
import
|
|
13247
|
+
import chalk138 from "chalk";
|
|
13230
13248
|
async function renderBlock(krokiUrl, source) {
|
|
13231
13249
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
13232
13250
|
method: "POST",
|
|
@@ -13235,7 +13253,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
13235
13253
|
});
|
|
13236
13254
|
if (!response.ok) {
|
|
13237
13255
|
console.error(
|
|
13238
|
-
|
|
13256
|
+
chalk138.red(
|
|
13239
13257
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
13240
13258
|
)
|
|
13241
13259
|
);
|
|
@@ -13253,19 +13271,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
13253
13271
|
if (onlyIndex !== void 0) {
|
|
13254
13272
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
13255
13273
|
console.error(
|
|
13256
|
-
|
|
13274
|
+
chalk139.red(
|
|
13257
13275
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
13258
13276
|
)
|
|
13259
13277
|
);
|
|
13260
13278
|
process.exit(1);
|
|
13261
13279
|
}
|
|
13262
13280
|
console.log(
|
|
13263
|
-
|
|
13281
|
+
chalk139.gray(
|
|
13264
13282
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
13265
13283
|
)
|
|
13266
13284
|
);
|
|
13267
13285
|
} else {
|
|
13268
|
-
console.log(
|
|
13286
|
+
console.log(chalk139.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
13269
13287
|
}
|
|
13270
13288
|
for (const [i, source] of blocks.entries()) {
|
|
13271
13289
|
const idx = i + 1;
|
|
@@ -13273,7 +13291,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
13273
13291
|
const outPath = resolve10(outDir, `${stem}-${idx}.svg`);
|
|
13274
13292
|
const svg = await renderBlock(krokiUrl, source);
|
|
13275
13293
|
writeFileSync28(outPath, svg, "utf8");
|
|
13276
|
-
console.log(
|
|
13294
|
+
console.log(chalk139.green(` \u2192 ${outPath}`));
|
|
13277
13295
|
}
|
|
13278
13296
|
}
|
|
13279
13297
|
function extractMermaidBlocks(markdown) {
|
|
@@ -13289,18 +13307,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
13289
13307
|
if (options2.index !== void 0) {
|
|
13290
13308
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
13291
13309
|
console.error(
|
|
13292
|
-
|
|
13310
|
+
chalk140.red(`--index must be a positive integer (got ${options2.index})`)
|
|
13293
13311
|
);
|
|
13294
13312
|
process.exit(1);
|
|
13295
13313
|
}
|
|
13296
13314
|
if (!file) {
|
|
13297
|
-
console.error(
|
|
13315
|
+
console.error(chalk140.red("--index requires a file argument"));
|
|
13298
13316
|
process.exit(1);
|
|
13299
13317
|
}
|
|
13300
13318
|
}
|
|
13301
13319
|
const files = file ? [file] : readdirSync8(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
13302
13320
|
if (files.length === 0) {
|
|
13303
|
-
console.log(
|
|
13321
|
+
console.log(chalk140.gray("No markdown files found in current directory."));
|
|
13304
13322
|
return;
|
|
13305
13323
|
}
|
|
13306
13324
|
for (const f of files) {
|
|
@@ -13326,7 +13344,7 @@ function registerMermaid(program2) {
|
|
|
13326
13344
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
13327
13345
|
import { createServer as createServer2 } from "http";
|
|
13328
13346
|
import { dirname as dirname22 } from "path";
|
|
13329
|
-
import
|
|
13347
|
+
import chalk142 from "chalk";
|
|
13330
13348
|
|
|
13331
13349
|
// src/commands/netcap/corsHeaders.ts
|
|
13332
13350
|
var corsHeaders = {
|
|
@@ -13405,7 +13423,7 @@ function createNetcapHandler(options2) {
|
|
|
13405
13423
|
import { cp, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|
|
13406
13424
|
import { networkInterfaces } from "os";
|
|
13407
13425
|
import { join as join41 } from "path";
|
|
13408
|
-
import
|
|
13426
|
+
import chalk141 from "chalk";
|
|
13409
13427
|
|
|
13410
13428
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
13411
13429
|
import { dirname as dirname21, join as join40 } from "path";
|
|
@@ -13449,7 +13467,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
13449
13467
|
const host = lanIPv4();
|
|
13450
13468
|
if (!host) {
|
|
13451
13469
|
console.log(
|
|
13452
|
-
|
|
13470
|
+
chalk141.yellow("could not determine the WSL IP for the extension")
|
|
13453
13471
|
);
|
|
13454
13472
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
13455
13473
|
return source;
|
|
@@ -13460,7 +13478,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
13460
13478
|
return WSL_WINDOWS_PATH;
|
|
13461
13479
|
} catch {
|
|
13462
13480
|
console.log(
|
|
13463
|
-
|
|
13481
|
+
chalk141.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
13464
13482
|
);
|
|
13465
13483
|
return source;
|
|
13466
13484
|
}
|
|
@@ -13493,30 +13511,30 @@ async function netcap(options2) {
|
|
|
13493
13511
|
let count8 = 0;
|
|
13494
13512
|
const handler = createNetcapHandler({
|
|
13495
13513
|
outPath,
|
|
13496
|
-
onPing: () => console.log(
|
|
13514
|
+
onPing: () => console.log(chalk142.dim("ping from extension")),
|
|
13497
13515
|
onCapture: (entry) => {
|
|
13498
13516
|
count8 += 1;
|
|
13499
13517
|
console.log(
|
|
13500
|
-
|
|
13501
|
-
|
|
13518
|
+
chalk142.green(`captured #${count8}`),
|
|
13519
|
+
chalk142.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
13502
13520
|
);
|
|
13503
13521
|
}
|
|
13504
13522
|
});
|
|
13505
13523
|
const server = createServer2(handler);
|
|
13506
13524
|
server.listen(port, () => {
|
|
13507
13525
|
console.log(
|
|
13508
|
-
|
|
13526
|
+
chalk142.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
13509
13527
|
);
|
|
13510
|
-
console.log(
|
|
13528
|
+
console.log(chalk142.dim(`appending captures to ${outPath}`));
|
|
13511
13529
|
if (filter)
|
|
13512
|
-
console.log(
|
|
13513
|
-
console.log(
|
|
13514
|
-
console.log(
|
|
13530
|
+
console.log(chalk142.dim(`forwarding only URLs matching "${filter}"`));
|
|
13531
|
+
console.log(chalk142.dim(`load the unpacked extension from ${extensionPath}`));
|
|
13532
|
+
console.log(chalk142.dim("press Ctrl-C to stop"));
|
|
13515
13533
|
});
|
|
13516
13534
|
process.on("SIGINT", () => {
|
|
13517
13535
|
server.close();
|
|
13518
13536
|
console.log(
|
|
13519
|
-
|
|
13537
|
+
chalk142.bold(
|
|
13520
13538
|
`
|
|
13521
13539
|
netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
13522
13540
|
)
|
|
@@ -13528,7 +13546,7 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
13528
13546
|
// src/commands/netcap/netcapExtract.ts
|
|
13529
13547
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
13530
13548
|
import { join as join44 } from "path";
|
|
13531
|
-
import
|
|
13549
|
+
import chalk143 from "chalk";
|
|
13532
13550
|
|
|
13533
13551
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
13534
13552
|
import { readFileSync as readFileSync34 } from "fs";
|
|
@@ -13976,8 +13994,8 @@ function netcapExtract(file) {
|
|
|
13976
13994
|
writeFileSync29(outFile, `${JSON.stringify(posts, null, 2)}
|
|
13977
13995
|
`);
|
|
13978
13996
|
console.log(
|
|
13979
|
-
|
|
13980
|
-
|
|
13997
|
+
chalk143.green(`extracted ${posts.length} posts`),
|
|
13998
|
+
chalk143.dim(`-> ${outFile}`)
|
|
13981
13999
|
);
|
|
13982
14000
|
}
|
|
13983
14001
|
|
|
@@ -13998,7 +14016,7 @@ function registerNetcap(program2) {
|
|
|
13998
14016
|
}
|
|
13999
14017
|
|
|
14000
14018
|
// src/commands/news/add/index.ts
|
|
14001
|
-
import
|
|
14019
|
+
import chalk144 from "chalk";
|
|
14002
14020
|
import enquirer8 from "enquirer";
|
|
14003
14021
|
async function add2(url) {
|
|
14004
14022
|
if (!url) {
|
|
@@ -14020,10 +14038,10 @@ async function add2(url) {
|
|
|
14020
14038
|
const { orm } = await getReady();
|
|
14021
14039
|
const added = await addFeed(orm, url);
|
|
14022
14040
|
if (!added) {
|
|
14023
|
-
console.log(
|
|
14041
|
+
console.log(chalk144.yellow("Feed already exists"));
|
|
14024
14042
|
return;
|
|
14025
14043
|
}
|
|
14026
|
-
console.log(
|
|
14044
|
+
console.log(chalk144.green(`Added feed: ${url}`));
|
|
14027
14045
|
}
|
|
14028
14046
|
|
|
14029
14047
|
// src/commands/registerNews.ts
|
|
@@ -14033,7 +14051,7 @@ function registerNews(program2) {
|
|
|
14033
14051
|
}
|
|
14034
14052
|
|
|
14035
14053
|
// src/commands/prompts/printPromptsTable.ts
|
|
14036
|
-
import
|
|
14054
|
+
import chalk145 from "chalk";
|
|
14037
14055
|
function truncate(str, max) {
|
|
14038
14056
|
if (str.length <= max) return str;
|
|
14039
14057
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -14051,14 +14069,14 @@ function printPromptsTable(rows) {
|
|
|
14051
14069
|
"Command".padEnd(commandWidth),
|
|
14052
14070
|
"Repos"
|
|
14053
14071
|
].join(" ");
|
|
14054
|
-
console.log(
|
|
14055
|
-
console.log(
|
|
14072
|
+
console.log(chalk145.dim(header));
|
|
14073
|
+
console.log(chalk145.dim("-".repeat(header.length)));
|
|
14056
14074
|
for (const row of rows) {
|
|
14057
14075
|
const count8 = String(row.count).padStart(countWidth);
|
|
14058
14076
|
const tool = row.tool.padEnd(toolWidth);
|
|
14059
14077
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
14060
14078
|
console.log(
|
|
14061
|
-
`${
|
|
14079
|
+
`${chalk145.yellow(count8)} ${tool} ${command} ${chalk145.dim(row.repos)}`
|
|
14062
14080
|
);
|
|
14063
14081
|
}
|
|
14064
14082
|
}
|
|
@@ -14607,20 +14625,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
14607
14625
|
}
|
|
14608
14626
|
|
|
14609
14627
|
// src/commands/prs/listComments/printComments.ts
|
|
14610
|
-
import
|
|
14628
|
+
import chalk146 from "chalk";
|
|
14611
14629
|
function formatForHuman(comment3) {
|
|
14612
14630
|
if (comment3.type === "review") {
|
|
14613
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
14631
|
+
const stateColor = comment3.state === "APPROVED" ? chalk146.green : comment3.state === "CHANGES_REQUESTED" ? chalk146.red : chalk146.yellow;
|
|
14614
14632
|
return [
|
|
14615
|
-
`${
|
|
14633
|
+
`${chalk146.cyan("Review")} by ${chalk146.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
14616
14634
|
comment3.body,
|
|
14617
14635
|
""
|
|
14618
14636
|
].join("\n");
|
|
14619
14637
|
}
|
|
14620
14638
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
14621
14639
|
return [
|
|
14622
|
-
`${
|
|
14623
|
-
|
|
14640
|
+
`${chalk146.cyan("Line comment")} by ${chalk146.bold(comment3.user)} on ${chalk146.dim(`${comment3.path}${location}`)}`,
|
|
14641
|
+
chalk146.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
14624
14642
|
comment3.body,
|
|
14625
14643
|
""
|
|
14626
14644
|
].join("\n");
|
|
@@ -14710,13 +14728,13 @@ import { execSync as execSync40 } from "child_process";
|
|
|
14710
14728
|
import enquirer9 from "enquirer";
|
|
14711
14729
|
|
|
14712
14730
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
14713
|
-
import
|
|
14731
|
+
import chalk147 from "chalk";
|
|
14714
14732
|
var STATUS_MAP = {
|
|
14715
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
14716
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
14733
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk147.magenta("merged"), date: pr.mergedAt } : null,
|
|
14734
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk147.red("closed"), date: pr.closedAt } : null
|
|
14717
14735
|
};
|
|
14718
14736
|
function defaultStatus(pr) {
|
|
14719
|
-
return { label:
|
|
14737
|
+
return { label: chalk147.green("opened"), date: pr.createdAt };
|
|
14720
14738
|
}
|
|
14721
14739
|
function getStatus2(pr) {
|
|
14722
14740
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -14725,11 +14743,11 @@ function formatDate(dateStr) {
|
|
|
14725
14743
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
14726
14744
|
}
|
|
14727
14745
|
function formatPrHeader(pr, status2) {
|
|
14728
|
-
return `${
|
|
14746
|
+
return `${chalk147.cyan(`#${pr.number}`)} ${pr.title} ${chalk147.dim(`(${pr.author.login},`)} ${status2.label} ${chalk147.dim(`${formatDate(status2.date)})`)}`;
|
|
14729
14747
|
}
|
|
14730
14748
|
function logPrDetails(pr) {
|
|
14731
14749
|
console.log(
|
|
14732
|
-
|
|
14750
|
+
chalk147.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
14733
14751
|
);
|
|
14734
14752
|
console.log();
|
|
14735
14753
|
}
|
|
@@ -15036,10 +15054,10 @@ function registerPrs(program2) {
|
|
|
15036
15054
|
}
|
|
15037
15055
|
|
|
15038
15056
|
// src/commands/ravendb/ravendbAuth.ts
|
|
15039
|
-
import
|
|
15057
|
+
import chalk153 from "chalk";
|
|
15040
15058
|
|
|
15041
15059
|
// src/shared/createConnectionAuth.ts
|
|
15042
|
-
import
|
|
15060
|
+
import chalk148 from "chalk";
|
|
15043
15061
|
function listConnections(connections, format) {
|
|
15044
15062
|
if (connections.length === 0) {
|
|
15045
15063
|
console.log("No connections configured.");
|
|
@@ -15052,7 +15070,7 @@ function listConnections(connections, format) {
|
|
|
15052
15070
|
function removeConnection(connections, name, save) {
|
|
15053
15071
|
const filtered = connections.filter((c) => c.name !== name);
|
|
15054
15072
|
if (filtered.length === connections.length) {
|
|
15055
|
-
console.error(
|
|
15073
|
+
console.error(chalk148.red(`Connection "${name}" not found.`));
|
|
15056
15074
|
process.exit(1);
|
|
15057
15075
|
}
|
|
15058
15076
|
save(filtered);
|
|
@@ -15098,15 +15116,15 @@ function saveConnections(connections) {
|
|
|
15098
15116
|
}
|
|
15099
15117
|
|
|
15100
15118
|
// src/commands/ravendb/promptConnection.ts
|
|
15101
|
-
import
|
|
15119
|
+
import chalk151 from "chalk";
|
|
15102
15120
|
|
|
15103
15121
|
// src/commands/ravendb/selectOpSecret.ts
|
|
15104
|
-
import
|
|
15122
|
+
import chalk150 from "chalk";
|
|
15105
15123
|
import Enquirer2 from "enquirer";
|
|
15106
15124
|
|
|
15107
15125
|
// src/commands/ravendb/searchItems.ts
|
|
15108
15126
|
import { execSync as execSync43 } from "child_process";
|
|
15109
|
-
import
|
|
15127
|
+
import chalk149 from "chalk";
|
|
15110
15128
|
function opExec(args) {
|
|
15111
15129
|
return execSync43(`op ${args}`, {
|
|
15112
15130
|
encoding: "utf8",
|
|
@@ -15119,7 +15137,7 @@ function searchItems(search2) {
|
|
|
15119
15137
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
15120
15138
|
} catch {
|
|
15121
15139
|
console.error(
|
|
15122
|
-
|
|
15140
|
+
chalk149.red(
|
|
15123
15141
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
15124
15142
|
)
|
|
15125
15143
|
);
|
|
@@ -15133,7 +15151,7 @@ function getItemFields(itemId) {
|
|
|
15133
15151
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
15134
15152
|
return item.fields.filter((f) => f.reference && f.label);
|
|
15135
15153
|
} catch {
|
|
15136
|
-
console.error(
|
|
15154
|
+
console.error(chalk149.red("Failed to get item details from 1Password."));
|
|
15137
15155
|
process.exit(1);
|
|
15138
15156
|
}
|
|
15139
15157
|
}
|
|
@@ -15152,7 +15170,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
15152
15170
|
}).run();
|
|
15153
15171
|
const items2 = searchItems(search2);
|
|
15154
15172
|
if (items2.length === 0) {
|
|
15155
|
-
console.error(
|
|
15173
|
+
console.error(chalk150.red(`No items found matching "${search2}".`));
|
|
15156
15174
|
process.exit(1);
|
|
15157
15175
|
}
|
|
15158
15176
|
const itemId = await selectOne(
|
|
@@ -15161,7 +15179,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
15161
15179
|
);
|
|
15162
15180
|
const fields = getItemFields(itemId);
|
|
15163
15181
|
if (fields.length === 0) {
|
|
15164
|
-
console.error(
|
|
15182
|
+
console.error(chalk150.red("No fields with references found on this item."));
|
|
15165
15183
|
process.exit(1);
|
|
15166
15184
|
}
|
|
15167
15185
|
const ref = await selectOne(
|
|
@@ -15175,7 +15193,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
15175
15193
|
async function promptConnection(existingNames) {
|
|
15176
15194
|
const name = await promptInput("name", "Connection name:");
|
|
15177
15195
|
if (existingNames.includes(name)) {
|
|
15178
|
-
console.error(
|
|
15196
|
+
console.error(chalk151.red(`Connection "${name}" already exists.`));
|
|
15179
15197
|
process.exit(1);
|
|
15180
15198
|
}
|
|
15181
15199
|
const url = await promptInput(
|
|
@@ -15184,22 +15202,22 @@ async function promptConnection(existingNames) {
|
|
|
15184
15202
|
);
|
|
15185
15203
|
const database = await promptInput("database", "Database name:");
|
|
15186
15204
|
if (!name || !url || !database) {
|
|
15187
|
-
console.error(
|
|
15205
|
+
console.error(chalk151.red("All fields are required."));
|
|
15188
15206
|
process.exit(1);
|
|
15189
15207
|
}
|
|
15190
15208
|
const apiKeyRef = await selectOpSecret();
|
|
15191
|
-
console.log(
|
|
15209
|
+
console.log(chalk151.dim(`Using: ${apiKeyRef}`));
|
|
15192
15210
|
return { name, url, database, apiKeyRef };
|
|
15193
15211
|
}
|
|
15194
15212
|
|
|
15195
15213
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
15196
|
-
import
|
|
15214
|
+
import chalk152 from "chalk";
|
|
15197
15215
|
function ravendbSetConnection(name) {
|
|
15198
15216
|
const raw = loadGlobalConfigRaw();
|
|
15199
15217
|
const ravendb = raw.ravendb ?? {};
|
|
15200
15218
|
const connections = ravendb.connections ?? [];
|
|
15201
15219
|
if (!connections.some((c) => c.name === name)) {
|
|
15202
|
-
console.error(
|
|
15220
|
+
console.error(chalk152.red(`Connection "${name}" not found.`));
|
|
15203
15221
|
console.error(
|
|
15204
15222
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
15205
15223
|
);
|
|
@@ -15215,16 +15233,16 @@ function ravendbSetConnection(name) {
|
|
|
15215
15233
|
var ravendbAuth = createConnectionAuth({
|
|
15216
15234
|
load: loadConnections,
|
|
15217
15235
|
save: saveConnections,
|
|
15218
|
-
format: (c) => `${
|
|
15236
|
+
format: (c) => `${chalk153.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
15219
15237
|
promptNew: promptConnection,
|
|
15220
15238
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
15221
15239
|
});
|
|
15222
15240
|
|
|
15223
15241
|
// src/commands/ravendb/ravendbCollections.ts
|
|
15224
|
-
import
|
|
15242
|
+
import chalk157 from "chalk";
|
|
15225
15243
|
|
|
15226
15244
|
// src/commands/ravendb/ravenFetch.ts
|
|
15227
|
-
import
|
|
15245
|
+
import chalk155 from "chalk";
|
|
15228
15246
|
|
|
15229
15247
|
// src/commands/ravendb/getAccessToken.ts
|
|
15230
15248
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -15261,10 +15279,10 @@ ${errorText}`
|
|
|
15261
15279
|
|
|
15262
15280
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
15263
15281
|
import { execSync as execSync44 } from "child_process";
|
|
15264
|
-
import
|
|
15282
|
+
import chalk154 from "chalk";
|
|
15265
15283
|
function resolveOpSecret(reference) {
|
|
15266
15284
|
if (!reference.startsWith("op://")) {
|
|
15267
|
-
console.error(
|
|
15285
|
+
console.error(chalk154.red(`Invalid secret reference: must start with op://`));
|
|
15268
15286
|
process.exit(1);
|
|
15269
15287
|
}
|
|
15270
15288
|
try {
|
|
@@ -15274,7 +15292,7 @@ function resolveOpSecret(reference) {
|
|
|
15274
15292
|
}).trim();
|
|
15275
15293
|
} catch {
|
|
15276
15294
|
console.error(
|
|
15277
|
-
|
|
15295
|
+
chalk154.red(
|
|
15278
15296
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
15279
15297
|
)
|
|
15280
15298
|
);
|
|
@@ -15301,7 +15319,7 @@ async function ravenFetch(connection, path57) {
|
|
|
15301
15319
|
if (!response.ok) {
|
|
15302
15320
|
const body = await response.text();
|
|
15303
15321
|
console.error(
|
|
15304
|
-
|
|
15322
|
+
chalk155.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
15305
15323
|
);
|
|
15306
15324
|
console.error(body.substring(0, 500));
|
|
15307
15325
|
process.exit(1);
|
|
@@ -15310,7 +15328,7 @@ async function ravenFetch(connection, path57) {
|
|
|
15310
15328
|
}
|
|
15311
15329
|
|
|
15312
15330
|
// src/commands/ravendb/resolveConnection.ts
|
|
15313
|
-
import
|
|
15331
|
+
import chalk156 from "chalk";
|
|
15314
15332
|
function loadRavendb() {
|
|
15315
15333
|
const raw = loadGlobalConfigRaw();
|
|
15316
15334
|
const ravendb = raw.ravendb;
|
|
@@ -15324,7 +15342,7 @@ function resolveConnection(name) {
|
|
|
15324
15342
|
const connectionName = name ?? defaultConnection;
|
|
15325
15343
|
if (!connectionName) {
|
|
15326
15344
|
console.error(
|
|
15327
|
-
|
|
15345
|
+
chalk156.red(
|
|
15328
15346
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
15329
15347
|
)
|
|
15330
15348
|
);
|
|
@@ -15332,7 +15350,7 @@ function resolveConnection(name) {
|
|
|
15332
15350
|
}
|
|
15333
15351
|
const connection = connections.find((c) => c.name === connectionName);
|
|
15334
15352
|
if (!connection) {
|
|
15335
|
-
console.error(
|
|
15353
|
+
console.error(chalk156.red(`Connection "${connectionName}" not found.`));
|
|
15336
15354
|
console.error(
|
|
15337
15355
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
15338
15356
|
);
|
|
@@ -15363,15 +15381,15 @@ async function ravendbCollections(connectionName) {
|
|
|
15363
15381
|
return;
|
|
15364
15382
|
}
|
|
15365
15383
|
for (const c of collections) {
|
|
15366
|
-
console.log(`${
|
|
15384
|
+
console.log(`${chalk157.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
15367
15385
|
}
|
|
15368
15386
|
}
|
|
15369
15387
|
|
|
15370
15388
|
// src/commands/ravendb/ravendbQuery.ts
|
|
15371
|
-
import
|
|
15389
|
+
import chalk159 from "chalk";
|
|
15372
15390
|
|
|
15373
15391
|
// src/commands/ravendb/fetchAllPages.ts
|
|
15374
|
-
import
|
|
15392
|
+
import chalk158 from "chalk";
|
|
15375
15393
|
|
|
15376
15394
|
// src/commands/ravendb/buildQueryPath.ts
|
|
15377
15395
|
function buildQueryPath(opts) {
|
|
@@ -15409,7 +15427,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
15409
15427
|
allResults.push(...results);
|
|
15410
15428
|
start3 += results.length;
|
|
15411
15429
|
process.stderr.write(
|
|
15412
|
-
`\r${
|
|
15430
|
+
`\r${chalk158.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
15413
15431
|
);
|
|
15414
15432
|
if (start3 >= totalResults) break;
|
|
15415
15433
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -15424,7 +15442,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
15424
15442
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
15425
15443
|
const resolved = resolveArgs(connectionName, collection);
|
|
15426
15444
|
if (!resolved.collection && !options2.query) {
|
|
15427
|
-
console.error(
|
|
15445
|
+
console.error(chalk159.red("Provide a collection name or --query filter."));
|
|
15428
15446
|
process.exit(1);
|
|
15429
15447
|
}
|
|
15430
15448
|
const { collection: col } = resolved;
|
|
@@ -15462,7 +15480,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
15462
15480
|
import * as path28 from "path";
|
|
15463
15481
|
|
|
15464
15482
|
// src/commands/refactor/logViolations.ts
|
|
15465
|
-
import
|
|
15483
|
+
import chalk160 from "chalk";
|
|
15466
15484
|
var DEFAULT_MAX_LINES = 100;
|
|
15467
15485
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
15468
15486
|
if (violations.length === 0) {
|
|
@@ -15471,43 +15489,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
15471
15489
|
}
|
|
15472
15490
|
return;
|
|
15473
15491
|
}
|
|
15474
|
-
console.error(
|
|
15492
|
+
console.error(chalk160.red(`
|
|
15475
15493
|
Refactor check failed:
|
|
15476
15494
|
`));
|
|
15477
|
-
console.error(
|
|
15495
|
+
console.error(chalk160.red(` The following files exceed ${maxLines} lines:
|
|
15478
15496
|
`));
|
|
15479
15497
|
for (const violation of violations) {
|
|
15480
|
-
console.error(
|
|
15498
|
+
console.error(chalk160.red(` ${violation.file} (${violation.lines} lines)`));
|
|
15481
15499
|
}
|
|
15482
15500
|
console.error(
|
|
15483
|
-
|
|
15501
|
+
chalk160.yellow(
|
|
15484
15502
|
`
|
|
15485
15503
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
15486
15504
|
way to refactor it, ignore it with:
|
|
15487
15505
|
`
|
|
15488
15506
|
)
|
|
15489
15507
|
);
|
|
15490
|
-
console.error(
|
|
15508
|
+
console.error(chalk160.gray(` assist refactor ignore <file>
|
|
15491
15509
|
`));
|
|
15492
15510
|
if (process.env.CLAUDECODE) {
|
|
15493
|
-
console.error(
|
|
15511
|
+
console.error(chalk160.cyan(`
|
|
15494
15512
|
## Extracting Code to New Files
|
|
15495
15513
|
`));
|
|
15496
15514
|
console.error(
|
|
15497
|
-
|
|
15515
|
+
chalk160.cyan(
|
|
15498
15516
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
15499
15517
|
`
|
|
15500
15518
|
)
|
|
15501
15519
|
);
|
|
15502
15520
|
console.error(
|
|
15503
|
-
|
|
15521
|
+
chalk160.cyan(
|
|
15504
15522
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
15505
15523
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
15506
15524
|
`
|
|
15507
15525
|
)
|
|
15508
15526
|
);
|
|
15509
15527
|
console.error(
|
|
15510
|
-
|
|
15528
|
+
chalk160.cyan(
|
|
15511
15529
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
15512
15530
|
domains, move it to a common/shared folder.
|
|
15513
15531
|
`
|
|
@@ -15663,7 +15681,7 @@ async function check(pattern2, options2) {
|
|
|
15663
15681
|
|
|
15664
15682
|
// src/commands/refactor/extract/index.ts
|
|
15665
15683
|
import path35 from "path";
|
|
15666
|
-
import
|
|
15684
|
+
import chalk163 from "chalk";
|
|
15667
15685
|
|
|
15668
15686
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
15669
15687
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -16238,23 +16256,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
16238
16256
|
|
|
16239
16257
|
// src/commands/refactor/extract/displayPlan.ts
|
|
16240
16258
|
import path32 from "path";
|
|
16241
|
-
import
|
|
16259
|
+
import chalk161 from "chalk";
|
|
16242
16260
|
function section(title) {
|
|
16243
16261
|
return `
|
|
16244
|
-
${
|
|
16262
|
+
${chalk161.cyan(title)}`;
|
|
16245
16263
|
}
|
|
16246
16264
|
function displayImporters(plan2, cwd) {
|
|
16247
16265
|
if (plan2.importersToUpdate.length === 0) return;
|
|
16248
16266
|
console.log(section("Update importers:"));
|
|
16249
16267
|
for (const imp of plan2.importersToUpdate) {
|
|
16250
16268
|
const rel = path32.relative(cwd, imp.file.getFilePath());
|
|
16251
|
-
console.log(` ${
|
|
16269
|
+
console.log(` ${chalk161.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
16252
16270
|
}
|
|
16253
16271
|
}
|
|
16254
16272
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
16255
|
-
console.log(
|
|
16273
|
+
console.log(chalk161.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
16256
16274
|
`));
|
|
16257
|
-
console.log(` ${
|
|
16275
|
+
console.log(` ${chalk161.cyan("Functions to move:")}`);
|
|
16258
16276
|
for (const name of plan2.extractedNames) {
|
|
16259
16277
|
console.log(` ${name}`);
|
|
16260
16278
|
}
|
|
@@ -16288,7 +16306,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
16288
16306
|
|
|
16289
16307
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
16290
16308
|
import path34 from "path";
|
|
16291
|
-
import
|
|
16309
|
+
import chalk162 from "chalk";
|
|
16292
16310
|
import { Project as Project4 } from "ts-morph";
|
|
16293
16311
|
|
|
16294
16312
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -16348,7 +16366,7 @@ function loadProjectFile(file) {
|
|
|
16348
16366
|
});
|
|
16349
16367
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
16350
16368
|
if (!sourceFile) {
|
|
16351
|
-
console.log(
|
|
16369
|
+
console.log(chalk162.red(`File not found in project: ${file}`));
|
|
16352
16370
|
process.exit(1);
|
|
16353
16371
|
}
|
|
16354
16372
|
return { project, sourceFile };
|
|
@@ -16371,19 +16389,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
16371
16389
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
16372
16390
|
if (options2.apply) {
|
|
16373
16391
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
16374
|
-
console.log(
|
|
16392
|
+
console.log(chalk163.green("\nExtraction complete"));
|
|
16375
16393
|
} else {
|
|
16376
|
-
console.log(
|
|
16394
|
+
console.log(chalk163.dim("\nDry run. Use --apply to execute."));
|
|
16377
16395
|
}
|
|
16378
16396
|
}
|
|
16379
16397
|
|
|
16380
16398
|
// src/commands/refactor/ignore.ts
|
|
16381
16399
|
import fs24 from "fs";
|
|
16382
|
-
import
|
|
16400
|
+
import chalk164 from "chalk";
|
|
16383
16401
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
16384
16402
|
function ignore(file) {
|
|
16385
16403
|
if (!fs24.existsSync(file)) {
|
|
16386
|
-
console.error(
|
|
16404
|
+
console.error(chalk164.red(`Error: File does not exist: ${file}`));
|
|
16387
16405
|
process.exit(1);
|
|
16388
16406
|
}
|
|
16389
16407
|
const content = fs24.readFileSync(file, "utf8");
|
|
@@ -16399,7 +16417,7 @@ function ignore(file) {
|
|
|
16399
16417
|
fs24.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
16400
16418
|
}
|
|
16401
16419
|
console.log(
|
|
16402
|
-
|
|
16420
|
+
chalk164.green(
|
|
16403
16421
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
16404
16422
|
)
|
|
16405
16423
|
);
|
|
@@ -16408,12 +16426,12 @@ function ignore(file) {
|
|
|
16408
16426
|
// src/commands/refactor/rename/index.ts
|
|
16409
16427
|
import fs27 from "fs";
|
|
16410
16428
|
import path40 from "path";
|
|
16411
|
-
import
|
|
16429
|
+
import chalk167 from "chalk";
|
|
16412
16430
|
|
|
16413
16431
|
// src/commands/refactor/rename/applyRename.ts
|
|
16414
16432
|
import fs26 from "fs";
|
|
16415
16433
|
import path37 from "path";
|
|
16416
|
-
import
|
|
16434
|
+
import chalk165 from "chalk";
|
|
16417
16435
|
|
|
16418
16436
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
16419
16437
|
import path36 from "path";
|
|
@@ -16518,13 +16536,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
16518
16536
|
const updatedContents = applyRewrites(rewrites);
|
|
16519
16537
|
for (const [file, content] of updatedContents) {
|
|
16520
16538
|
fs26.writeFileSync(file, content, "utf8");
|
|
16521
|
-
console.log(
|
|
16539
|
+
console.log(chalk165.cyan(` Updated imports in ${path37.relative(cwd, file)}`));
|
|
16522
16540
|
}
|
|
16523
16541
|
const destDir = path37.dirname(destPath);
|
|
16524
16542
|
if (!fs26.existsSync(destDir)) fs26.mkdirSync(destDir, { recursive: true });
|
|
16525
16543
|
fs26.renameSync(sourcePath, destPath);
|
|
16526
16544
|
console.log(
|
|
16527
|
-
|
|
16545
|
+
chalk165.white(
|
|
16528
16546
|
` Moved ${path37.relative(cwd, sourcePath)} \u2192 ${path37.relative(cwd, destPath)}`
|
|
16529
16547
|
)
|
|
16530
16548
|
);
|
|
@@ -16611,16 +16629,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
16611
16629
|
|
|
16612
16630
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
16613
16631
|
import path39 from "path";
|
|
16614
|
-
import
|
|
16632
|
+
import chalk166 from "chalk";
|
|
16615
16633
|
function printRenamePreview(rewrites, cwd) {
|
|
16616
16634
|
for (const rewrite of rewrites) {
|
|
16617
16635
|
console.log(
|
|
16618
|
-
|
|
16636
|
+
chalk166.dim(
|
|
16619
16637
|
` ${path39.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
16620
16638
|
)
|
|
16621
16639
|
);
|
|
16622
16640
|
}
|
|
16623
|
-
console.log(
|
|
16641
|
+
console.log(chalk166.dim("Dry run. Use --apply to execute."));
|
|
16624
16642
|
}
|
|
16625
16643
|
|
|
16626
16644
|
// src/commands/refactor/rename/index.ts
|
|
@@ -16631,20 +16649,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
16631
16649
|
const relSource = path40.relative(cwd, sourcePath);
|
|
16632
16650
|
const relDest = path40.relative(cwd, destPath);
|
|
16633
16651
|
if (!fs27.existsSync(sourcePath)) {
|
|
16634
|
-
console.log(
|
|
16652
|
+
console.log(chalk167.red(`File not found: ${source}`));
|
|
16635
16653
|
process.exit(1);
|
|
16636
16654
|
}
|
|
16637
16655
|
if (destPath !== sourcePath && fs27.existsSync(destPath)) {
|
|
16638
|
-
console.log(
|
|
16656
|
+
console.log(chalk167.red(`Destination already exists: ${destination}`));
|
|
16639
16657
|
process.exit(1);
|
|
16640
16658
|
}
|
|
16641
|
-
console.log(
|
|
16642
|
-
console.log(
|
|
16643
|
-
console.log(
|
|
16659
|
+
console.log(chalk167.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
16660
|
+
console.log(chalk167.dim("Loading project..."));
|
|
16661
|
+
console.log(chalk167.dim("Scanning imports across the project..."));
|
|
16644
16662
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
16645
16663
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
16646
16664
|
console.log(
|
|
16647
|
-
|
|
16665
|
+
chalk167.dim(
|
|
16648
16666
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
16649
16667
|
)
|
|
16650
16668
|
);
|
|
@@ -16653,11 +16671,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
16653
16671
|
return;
|
|
16654
16672
|
}
|
|
16655
16673
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
16656
|
-
console.log(
|
|
16674
|
+
console.log(chalk167.green("Done"));
|
|
16657
16675
|
}
|
|
16658
16676
|
|
|
16659
16677
|
// src/commands/refactor/renameSymbol/index.ts
|
|
16660
|
-
import
|
|
16678
|
+
import chalk168 from "chalk";
|
|
16661
16679
|
|
|
16662
16680
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
16663
16681
|
import { SyntaxKind as SyntaxKind14 } from "ts-morph";
|
|
@@ -16703,33 +16721,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
16703
16721
|
const { project, sourceFile } = loadProjectFile(file);
|
|
16704
16722
|
const symbol = findSymbol(sourceFile, oldName);
|
|
16705
16723
|
if (!symbol) {
|
|
16706
|
-
console.log(
|
|
16724
|
+
console.log(chalk168.red(`Symbol "${oldName}" not found in ${file}`));
|
|
16707
16725
|
process.exit(1);
|
|
16708
16726
|
}
|
|
16709
16727
|
const grouped = groupReferences(symbol, cwd);
|
|
16710
16728
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
16711
16729
|
console.log(
|
|
16712
|
-
|
|
16730
|
+
chalk168.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
16713
16731
|
`)
|
|
16714
16732
|
);
|
|
16715
16733
|
for (const [refFile, lines] of grouped) {
|
|
16716
16734
|
console.log(
|
|
16717
|
-
` ${
|
|
16735
|
+
` ${chalk168.dim(refFile)}: lines ${chalk168.cyan(lines.join(", "))}`
|
|
16718
16736
|
);
|
|
16719
16737
|
}
|
|
16720
16738
|
if (options2.apply) {
|
|
16721
16739
|
symbol.rename(newName);
|
|
16722
16740
|
await project.save();
|
|
16723
|
-
console.log(
|
|
16741
|
+
console.log(chalk168.green(`
|
|
16724
16742
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
16725
16743
|
} else {
|
|
16726
|
-
console.log(
|
|
16744
|
+
console.log(chalk168.dim("\nDry run. Use --apply to execute."));
|
|
16727
16745
|
}
|
|
16728
16746
|
}
|
|
16729
16747
|
|
|
16730
16748
|
// src/commands/refactor/restructure/index.ts
|
|
16731
16749
|
import path48 from "path";
|
|
16732
|
-
import
|
|
16750
|
+
import chalk171 from "chalk";
|
|
16733
16751
|
|
|
16734
16752
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
16735
16753
|
import path42 from "path";
|
|
@@ -16808,50 +16826,50 @@ function clusterFiles(graph) {
|
|
|
16808
16826
|
|
|
16809
16827
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
16810
16828
|
import path44 from "path";
|
|
16811
|
-
import
|
|
16829
|
+
import chalk169 from "chalk";
|
|
16812
16830
|
function relPath(filePath) {
|
|
16813
16831
|
return path44.relative(process.cwd(), filePath);
|
|
16814
16832
|
}
|
|
16815
16833
|
function displayMoves(plan2) {
|
|
16816
16834
|
if (plan2.moves.length === 0) return;
|
|
16817
|
-
console.log(
|
|
16835
|
+
console.log(chalk169.bold("\nFile moves:"));
|
|
16818
16836
|
for (const move2 of plan2.moves) {
|
|
16819
16837
|
console.log(
|
|
16820
|
-
` ${
|
|
16838
|
+
` ${chalk169.red(relPath(move2.from))} \u2192 ${chalk169.green(relPath(move2.to))}`
|
|
16821
16839
|
);
|
|
16822
|
-
console.log(
|
|
16840
|
+
console.log(chalk169.dim(` ${move2.reason}`));
|
|
16823
16841
|
}
|
|
16824
16842
|
}
|
|
16825
16843
|
function displayRewrites(rewrites) {
|
|
16826
16844
|
if (rewrites.length === 0) return;
|
|
16827
16845
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
16828
|
-
console.log(
|
|
16846
|
+
console.log(chalk169.bold(`
|
|
16829
16847
|
Import rewrites (${affectedFiles.size} files):`));
|
|
16830
16848
|
for (const file of affectedFiles) {
|
|
16831
|
-
console.log(` ${
|
|
16849
|
+
console.log(` ${chalk169.cyan(relPath(file))}:`);
|
|
16832
16850
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
16833
16851
|
(r) => r.file === file
|
|
16834
16852
|
)) {
|
|
16835
16853
|
console.log(
|
|
16836
|
-
` ${
|
|
16854
|
+
` ${chalk169.red(`"${oldSpecifier}"`)} \u2192 ${chalk169.green(`"${newSpecifier}"`)}`
|
|
16837
16855
|
);
|
|
16838
16856
|
}
|
|
16839
16857
|
}
|
|
16840
16858
|
}
|
|
16841
16859
|
function displayPlan2(plan2) {
|
|
16842
16860
|
if (plan2.warnings.length > 0) {
|
|
16843
|
-
console.log(
|
|
16844
|
-
for (const w of plan2.warnings) console.log(
|
|
16861
|
+
console.log(chalk169.yellow("\nWarnings:"));
|
|
16862
|
+
for (const w of plan2.warnings) console.log(chalk169.yellow(` ${w}`));
|
|
16845
16863
|
}
|
|
16846
16864
|
if (plan2.newDirectories.length > 0) {
|
|
16847
|
-
console.log(
|
|
16865
|
+
console.log(chalk169.bold("\nNew directories:"));
|
|
16848
16866
|
for (const dir of plan2.newDirectories)
|
|
16849
|
-
console.log(
|
|
16867
|
+
console.log(chalk169.green(` ${dir}/`));
|
|
16850
16868
|
}
|
|
16851
16869
|
displayMoves(plan2);
|
|
16852
16870
|
displayRewrites(plan2.rewrites);
|
|
16853
16871
|
console.log(
|
|
16854
|
-
|
|
16872
|
+
chalk169.dim(
|
|
16855
16873
|
`
|
|
16856
16874
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
16857
16875
|
)
|
|
@@ -16861,18 +16879,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
16861
16879
|
// src/commands/refactor/restructure/executePlan.ts
|
|
16862
16880
|
import fs28 from "fs";
|
|
16863
16881
|
import path45 from "path";
|
|
16864
|
-
import
|
|
16882
|
+
import chalk170 from "chalk";
|
|
16865
16883
|
function executePlan(plan2) {
|
|
16866
16884
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
16867
16885
|
for (const [file, content] of updatedContents) {
|
|
16868
16886
|
fs28.writeFileSync(file, content, "utf8");
|
|
16869
16887
|
console.log(
|
|
16870
|
-
|
|
16888
|
+
chalk170.cyan(` Rewrote imports in ${path45.relative(process.cwd(), file)}`)
|
|
16871
16889
|
);
|
|
16872
16890
|
}
|
|
16873
16891
|
for (const dir of plan2.newDirectories) {
|
|
16874
16892
|
fs28.mkdirSync(dir, { recursive: true });
|
|
16875
|
-
console.log(
|
|
16893
|
+
console.log(chalk170.green(` Created ${path45.relative(process.cwd(), dir)}/`));
|
|
16876
16894
|
}
|
|
16877
16895
|
for (const move2 of plan2.moves) {
|
|
16878
16896
|
const targetDir = path45.dirname(move2.to);
|
|
@@ -16881,7 +16899,7 @@ function executePlan(plan2) {
|
|
|
16881
16899
|
}
|
|
16882
16900
|
fs28.renameSync(move2.from, move2.to);
|
|
16883
16901
|
console.log(
|
|
16884
|
-
|
|
16902
|
+
chalk170.white(
|
|
16885
16903
|
` Moved ${path45.relative(process.cwd(), move2.from)} \u2192 ${path45.relative(process.cwd(), move2.to)}`
|
|
16886
16904
|
)
|
|
16887
16905
|
);
|
|
@@ -16896,7 +16914,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
16896
16914
|
if (entries.length === 0) {
|
|
16897
16915
|
fs28.rmdirSync(dir);
|
|
16898
16916
|
console.log(
|
|
16899
|
-
|
|
16917
|
+
chalk170.dim(
|
|
16900
16918
|
` Removed empty directory ${path45.relative(process.cwd(), dir)}`
|
|
16901
16919
|
)
|
|
16902
16920
|
);
|
|
@@ -17029,22 +17047,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
17029
17047
|
const targetPattern = pattern2 ?? "src";
|
|
17030
17048
|
const files = findSourceFiles2(targetPattern);
|
|
17031
17049
|
if (files.length === 0) {
|
|
17032
|
-
console.log(
|
|
17050
|
+
console.log(chalk171.yellow("No files found matching pattern"));
|
|
17033
17051
|
return;
|
|
17034
17052
|
}
|
|
17035
17053
|
const tsConfigPath = path48.resolve("tsconfig.json");
|
|
17036
17054
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
17037
17055
|
if (plan2.moves.length === 0) {
|
|
17038
|
-
console.log(
|
|
17056
|
+
console.log(chalk171.green("No restructuring needed"));
|
|
17039
17057
|
return;
|
|
17040
17058
|
}
|
|
17041
17059
|
displayPlan2(plan2);
|
|
17042
17060
|
if (options2.apply) {
|
|
17043
|
-
console.log(
|
|
17061
|
+
console.log(chalk171.bold("\nApplying changes..."));
|
|
17044
17062
|
executePlan(plan2);
|
|
17045
|
-
console.log(
|
|
17063
|
+
console.log(chalk171.green("\nRestructuring complete"));
|
|
17046
17064
|
} else {
|
|
17047
|
-
console.log(
|
|
17065
|
+
console.log(chalk171.dim("\nDry run. Use --apply to execute."));
|
|
17048
17066
|
}
|
|
17049
17067
|
}
|
|
17050
17068
|
|
|
@@ -17618,18 +17636,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
17618
17636
|
}
|
|
17619
17637
|
|
|
17620
17638
|
// src/commands/review/warnOutOfDiff.ts
|
|
17621
|
-
import
|
|
17639
|
+
import chalk172 from "chalk";
|
|
17622
17640
|
function warnOutOfDiff(outOfDiff) {
|
|
17623
17641
|
if (outOfDiff.length === 0) return;
|
|
17624
17642
|
console.warn(
|
|
17625
|
-
|
|
17643
|
+
chalk172.yellow(
|
|
17626
17644
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
17627
17645
|
)
|
|
17628
17646
|
);
|
|
17629
17647
|
for (const finding of outOfDiff) {
|
|
17630
17648
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
17631
17649
|
console.warn(
|
|
17632
|
-
` ${
|
|
17650
|
+
` ${chalk172.yellow("\xB7")} ${finding.title} ${chalk172.dim(
|
|
17633
17651
|
`(${finding.file}:${range})`
|
|
17634
17652
|
)}`
|
|
17635
17653
|
);
|
|
@@ -17648,18 +17666,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
17648
17666
|
}
|
|
17649
17667
|
|
|
17650
17668
|
// src/commands/review/warnUnlocated.ts
|
|
17651
|
-
import
|
|
17669
|
+
import chalk173 from "chalk";
|
|
17652
17670
|
function warnUnlocated(unlocated) {
|
|
17653
17671
|
if (unlocated.length === 0) return;
|
|
17654
17672
|
console.warn(
|
|
17655
|
-
|
|
17673
|
+
chalk173.yellow(
|
|
17656
17674
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
17657
17675
|
)
|
|
17658
17676
|
);
|
|
17659
17677
|
for (const finding of unlocated) {
|
|
17660
|
-
const where = finding.location ||
|
|
17678
|
+
const where = finding.location || chalk173.dim("missing");
|
|
17661
17679
|
console.warn(
|
|
17662
|
-
` ${
|
|
17680
|
+
` ${chalk173.yellow("\xB7")} ${finding.title} ${chalk173.dim(`(${where})`)}`
|
|
17663
17681
|
);
|
|
17664
17682
|
}
|
|
17665
17683
|
}
|
|
@@ -18831,7 +18849,7 @@ function registerReview(program2) {
|
|
|
18831
18849
|
}
|
|
18832
18850
|
|
|
18833
18851
|
// src/commands/seq/seqAuth.ts
|
|
18834
|
-
import
|
|
18852
|
+
import chalk175 from "chalk";
|
|
18835
18853
|
|
|
18836
18854
|
// src/commands/seq/loadConnections.ts
|
|
18837
18855
|
function loadConnections2() {
|
|
@@ -18860,10 +18878,10 @@ function setDefaultConnection(name) {
|
|
|
18860
18878
|
}
|
|
18861
18879
|
|
|
18862
18880
|
// src/shared/assertUniqueName.ts
|
|
18863
|
-
import
|
|
18881
|
+
import chalk174 from "chalk";
|
|
18864
18882
|
function assertUniqueName(existingNames, name) {
|
|
18865
18883
|
if (existingNames.includes(name)) {
|
|
18866
|
-
console.error(
|
|
18884
|
+
console.error(chalk174.red(`Connection "${name}" already exists.`));
|
|
18867
18885
|
process.exit(1);
|
|
18868
18886
|
}
|
|
18869
18887
|
}
|
|
@@ -18881,16 +18899,16 @@ async function promptConnection2(existingNames) {
|
|
|
18881
18899
|
var seqAuth = createConnectionAuth({
|
|
18882
18900
|
load: loadConnections2,
|
|
18883
18901
|
save: saveConnections2,
|
|
18884
|
-
format: (c) => `${
|
|
18902
|
+
format: (c) => `${chalk175.bold(c.name)} ${c.url}`,
|
|
18885
18903
|
promptNew: promptConnection2,
|
|
18886
18904
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
18887
18905
|
});
|
|
18888
18906
|
|
|
18889
18907
|
// src/commands/seq/seqQuery.ts
|
|
18890
|
-
import
|
|
18908
|
+
import chalk179 from "chalk";
|
|
18891
18909
|
|
|
18892
18910
|
// src/commands/seq/fetchSeq.ts
|
|
18893
|
-
import
|
|
18911
|
+
import chalk176 from "chalk";
|
|
18894
18912
|
async function fetchSeq(conn, path57, params) {
|
|
18895
18913
|
const url = `${conn.url}${path57}?${params}`;
|
|
18896
18914
|
const response = await fetch(url, {
|
|
@@ -18901,7 +18919,7 @@ async function fetchSeq(conn, path57, params) {
|
|
|
18901
18919
|
});
|
|
18902
18920
|
if (!response.ok) {
|
|
18903
18921
|
const body = await response.text();
|
|
18904
|
-
console.error(
|
|
18922
|
+
console.error(chalk176.red(`Seq returned ${response.status}: ${body}`));
|
|
18905
18923
|
process.exit(1);
|
|
18906
18924
|
}
|
|
18907
18925
|
return response;
|
|
@@ -18960,23 +18978,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
18960
18978
|
}
|
|
18961
18979
|
|
|
18962
18980
|
// src/commands/seq/formatEvent.ts
|
|
18963
|
-
import
|
|
18981
|
+
import chalk177 from "chalk";
|
|
18964
18982
|
function levelColor(level) {
|
|
18965
18983
|
switch (level) {
|
|
18966
18984
|
case "Fatal":
|
|
18967
|
-
return
|
|
18985
|
+
return chalk177.bgRed.white;
|
|
18968
18986
|
case "Error":
|
|
18969
|
-
return
|
|
18987
|
+
return chalk177.red;
|
|
18970
18988
|
case "Warning":
|
|
18971
|
-
return
|
|
18989
|
+
return chalk177.yellow;
|
|
18972
18990
|
case "Information":
|
|
18973
|
-
return
|
|
18991
|
+
return chalk177.cyan;
|
|
18974
18992
|
case "Debug":
|
|
18975
|
-
return
|
|
18993
|
+
return chalk177.gray;
|
|
18976
18994
|
case "Verbose":
|
|
18977
|
-
return
|
|
18995
|
+
return chalk177.dim;
|
|
18978
18996
|
default:
|
|
18979
|
-
return
|
|
18997
|
+
return chalk177.white;
|
|
18980
18998
|
}
|
|
18981
18999
|
}
|
|
18982
19000
|
function levelAbbrev(level) {
|
|
@@ -19017,12 +19035,12 @@ function formatTimestamp(iso) {
|
|
|
19017
19035
|
function formatEvent(event) {
|
|
19018
19036
|
const color = levelColor(event.Level);
|
|
19019
19037
|
const abbrev = levelAbbrev(event.Level);
|
|
19020
|
-
const ts8 =
|
|
19038
|
+
const ts8 = chalk177.dim(formatTimestamp(event.Timestamp));
|
|
19021
19039
|
const msg = renderMessage(event);
|
|
19022
19040
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
19023
19041
|
if (event.Exception) {
|
|
19024
19042
|
for (const line of event.Exception.split("\n")) {
|
|
19025
|
-
lines.push(
|
|
19043
|
+
lines.push(chalk177.red(` ${line}`));
|
|
19026
19044
|
}
|
|
19027
19045
|
}
|
|
19028
19046
|
return lines.join("\n");
|
|
@@ -19055,11 +19073,11 @@ function rejectTimestampFilter(filter) {
|
|
|
19055
19073
|
}
|
|
19056
19074
|
|
|
19057
19075
|
// src/shared/resolveNamedConnection.ts
|
|
19058
|
-
import
|
|
19076
|
+
import chalk178 from "chalk";
|
|
19059
19077
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
19060
19078
|
if (connections.length === 0) {
|
|
19061
19079
|
console.error(
|
|
19062
|
-
|
|
19080
|
+
chalk178.red(
|
|
19063
19081
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
19064
19082
|
)
|
|
19065
19083
|
);
|
|
@@ -19068,7 +19086,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
19068
19086
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
19069
19087
|
const connection = connections.find((c) => c.name === target);
|
|
19070
19088
|
if (!connection) {
|
|
19071
|
-
console.error(
|
|
19089
|
+
console.error(chalk178.red(`${kind} connection "${target}" not found.`));
|
|
19072
19090
|
process.exit(1);
|
|
19073
19091
|
}
|
|
19074
19092
|
return connection;
|
|
@@ -19097,7 +19115,7 @@ async function seqQuery(filter, options2) {
|
|
|
19097
19115
|
new URLSearchParams({ filter, count: String(count8) })
|
|
19098
19116
|
);
|
|
19099
19117
|
if (events.length === 0) {
|
|
19100
|
-
console.log(
|
|
19118
|
+
console.log(chalk179.yellow("No events found."));
|
|
19101
19119
|
return;
|
|
19102
19120
|
}
|
|
19103
19121
|
if (options2.json) {
|
|
@@ -19108,11 +19126,11 @@ async function seqQuery(filter, options2) {
|
|
|
19108
19126
|
for (const event of chronological) {
|
|
19109
19127
|
console.log(formatEvent(event));
|
|
19110
19128
|
}
|
|
19111
|
-
console.log(
|
|
19129
|
+
console.log(chalk179.dim(`
|
|
19112
19130
|
${events.length} events`));
|
|
19113
19131
|
if (events.length >= count8) {
|
|
19114
19132
|
console.log(
|
|
19115
|
-
|
|
19133
|
+
chalk179.yellow(
|
|
19116
19134
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
19117
19135
|
)
|
|
19118
19136
|
);
|
|
@@ -19120,10 +19138,10 @@ ${events.length} events`));
|
|
|
19120
19138
|
}
|
|
19121
19139
|
|
|
19122
19140
|
// src/shared/setNamedDefaultConnection.ts
|
|
19123
|
-
import
|
|
19141
|
+
import chalk180 from "chalk";
|
|
19124
19142
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
19125
19143
|
if (!connections.find((c) => c.name === name)) {
|
|
19126
|
-
console.error(
|
|
19144
|
+
console.error(chalk180.red(`Connection "${name}" not found.`));
|
|
19127
19145
|
process.exit(1);
|
|
19128
19146
|
}
|
|
19129
19147
|
setDefault(name);
|
|
@@ -19171,7 +19189,7 @@ function registerSignal(program2) {
|
|
|
19171
19189
|
}
|
|
19172
19190
|
|
|
19173
19191
|
// src/commands/sql/sqlAuth.ts
|
|
19174
|
-
import
|
|
19192
|
+
import chalk182 from "chalk";
|
|
19175
19193
|
|
|
19176
19194
|
// src/commands/sql/loadConnections.ts
|
|
19177
19195
|
function loadConnections3() {
|
|
@@ -19200,7 +19218,7 @@ function setDefaultConnection2(name) {
|
|
|
19200
19218
|
}
|
|
19201
19219
|
|
|
19202
19220
|
// src/commands/sql/promptConnection.ts
|
|
19203
|
-
import
|
|
19221
|
+
import chalk181 from "chalk";
|
|
19204
19222
|
async function promptConnection3(existingNames) {
|
|
19205
19223
|
const name = await promptInput("name", "Connection name:", "default");
|
|
19206
19224
|
assertUniqueName(existingNames, name);
|
|
@@ -19208,7 +19226,7 @@ async function promptConnection3(existingNames) {
|
|
|
19208
19226
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
19209
19227
|
const port = Number.parseInt(portStr, 10);
|
|
19210
19228
|
if (!Number.isFinite(port)) {
|
|
19211
|
-
console.error(
|
|
19229
|
+
console.error(chalk181.red(`Invalid port "${portStr}".`));
|
|
19212
19230
|
process.exit(1);
|
|
19213
19231
|
}
|
|
19214
19232
|
const user = await promptInput("user", "User:");
|
|
@@ -19221,13 +19239,13 @@ async function promptConnection3(existingNames) {
|
|
|
19221
19239
|
var sqlAuth = createConnectionAuth({
|
|
19222
19240
|
load: loadConnections3,
|
|
19223
19241
|
save: saveConnections3,
|
|
19224
|
-
format: (c) => `${
|
|
19242
|
+
format: (c) => `${chalk182.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
19225
19243
|
promptNew: promptConnection3,
|
|
19226
19244
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
19227
19245
|
});
|
|
19228
19246
|
|
|
19229
19247
|
// src/commands/sql/printTable.ts
|
|
19230
|
-
import
|
|
19248
|
+
import chalk183 from "chalk";
|
|
19231
19249
|
function formatCell(value) {
|
|
19232
19250
|
if (value === null || value === void 0) return "";
|
|
19233
19251
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -19236,7 +19254,7 @@ function formatCell(value) {
|
|
|
19236
19254
|
}
|
|
19237
19255
|
function printTable(rows) {
|
|
19238
19256
|
if (rows.length === 0) {
|
|
19239
|
-
console.log(
|
|
19257
|
+
console.log(chalk183.yellow("(no rows)"));
|
|
19240
19258
|
return;
|
|
19241
19259
|
}
|
|
19242
19260
|
const columns = Object.keys(rows[0]);
|
|
@@ -19244,13 +19262,13 @@ function printTable(rows) {
|
|
|
19244
19262
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
19245
19263
|
);
|
|
19246
19264
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
19247
|
-
console.log(
|
|
19248
|
-
console.log(
|
|
19265
|
+
console.log(chalk183.dim(header));
|
|
19266
|
+
console.log(chalk183.dim("-".repeat(header.length)));
|
|
19249
19267
|
for (const row of rows) {
|
|
19250
19268
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
19251
19269
|
console.log(line);
|
|
19252
19270
|
}
|
|
19253
|
-
console.log(
|
|
19271
|
+
console.log(chalk183.dim(`
|
|
19254
19272
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
19255
19273
|
}
|
|
19256
19274
|
|
|
@@ -19310,7 +19328,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
19310
19328
|
}
|
|
19311
19329
|
|
|
19312
19330
|
// src/commands/sql/sqlMutate.ts
|
|
19313
|
-
import
|
|
19331
|
+
import chalk184 from "chalk";
|
|
19314
19332
|
|
|
19315
19333
|
// src/commands/sql/isMutation.ts
|
|
19316
19334
|
var MUTATION_KEYWORDS = [
|
|
@@ -19344,7 +19362,7 @@ function isMutation(sql9) {
|
|
|
19344
19362
|
async function sqlMutate(query, connectionName) {
|
|
19345
19363
|
if (!isMutation(query)) {
|
|
19346
19364
|
console.error(
|
|
19347
|
-
|
|
19365
|
+
chalk184.red(
|
|
19348
19366
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
19349
19367
|
)
|
|
19350
19368
|
);
|
|
@@ -19354,18 +19372,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
19354
19372
|
const pool = await sqlConnect(conn);
|
|
19355
19373
|
try {
|
|
19356
19374
|
const result = await pool.request().query(query);
|
|
19357
|
-
console.log(
|
|
19375
|
+
console.log(chalk184.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
19358
19376
|
} finally {
|
|
19359
19377
|
await pool.close();
|
|
19360
19378
|
}
|
|
19361
19379
|
}
|
|
19362
19380
|
|
|
19363
19381
|
// src/commands/sql/sqlQuery.ts
|
|
19364
|
-
import
|
|
19382
|
+
import chalk185 from "chalk";
|
|
19365
19383
|
async function sqlQuery(query, connectionName) {
|
|
19366
19384
|
if (isMutation(query)) {
|
|
19367
19385
|
console.error(
|
|
19368
|
-
|
|
19386
|
+
chalk185.red(
|
|
19369
19387
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
19370
19388
|
)
|
|
19371
19389
|
);
|
|
@@ -19380,7 +19398,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
19380
19398
|
printTable(rows);
|
|
19381
19399
|
} else {
|
|
19382
19400
|
console.log(
|
|
19383
|
-
|
|
19401
|
+
chalk185.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
19384
19402
|
);
|
|
19385
19403
|
}
|
|
19386
19404
|
} finally {
|
|
@@ -20077,7 +20095,7 @@ function registerVoice(program2) {
|
|
|
20077
20095
|
|
|
20078
20096
|
// src/commands/roam/auth.ts
|
|
20079
20097
|
import { randomBytes } from "crypto";
|
|
20080
|
-
import
|
|
20098
|
+
import chalk186 from "chalk";
|
|
20081
20099
|
|
|
20082
20100
|
// src/commands/roam/waitForCallback.ts
|
|
20083
20101
|
import { createServer as createServer3 } from "http";
|
|
@@ -20208,13 +20226,13 @@ async function auth() {
|
|
|
20208
20226
|
saveGlobalConfig(config);
|
|
20209
20227
|
const state = randomBytes(16).toString("hex");
|
|
20210
20228
|
console.log(
|
|
20211
|
-
|
|
20229
|
+
chalk186.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
20212
20230
|
);
|
|
20213
|
-
console.log(
|
|
20214
|
-
console.log(
|
|
20215
|
-
console.log(
|
|
20231
|
+
console.log(chalk186.white("http://localhost:14523/callback\n"));
|
|
20232
|
+
console.log(chalk186.blue("Opening browser for authorization..."));
|
|
20233
|
+
console.log(chalk186.dim("Waiting for authorization callback..."));
|
|
20216
20234
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
20217
|
-
console.log(
|
|
20235
|
+
console.log(chalk186.dim("Exchanging code for tokens..."));
|
|
20218
20236
|
const tokens = await exchangeToken({
|
|
20219
20237
|
code,
|
|
20220
20238
|
clientId,
|
|
@@ -20230,7 +20248,7 @@ async function auth() {
|
|
|
20230
20248
|
};
|
|
20231
20249
|
saveGlobalConfig(config);
|
|
20232
20250
|
console.log(
|
|
20233
|
-
|
|
20251
|
+
chalk186.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
20234
20252
|
);
|
|
20235
20253
|
}
|
|
20236
20254
|
|
|
@@ -20682,7 +20700,7 @@ import { execSync as execSync52 } from "child_process";
|
|
|
20682
20700
|
import { existsSync as existsSync51, mkdirSync as mkdirSync22, unlinkSync as unlinkSync19, writeFileSync as writeFileSync39 } from "fs";
|
|
20683
20701
|
import { tmpdir as tmpdir7 } from "os";
|
|
20684
20702
|
import { join as join61, resolve as resolve15 } from "path";
|
|
20685
|
-
import
|
|
20703
|
+
import chalk187 from "chalk";
|
|
20686
20704
|
|
|
20687
20705
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
20688
20706
|
var captureWindowPs1 = `
|
|
@@ -20833,13 +20851,13 @@ function screenshot(processName) {
|
|
|
20833
20851
|
const config = loadConfig();
|
|
20834
20852
|
const outputDir = resolve15(config.screenshot.outputDir);
|
|
20835
20853
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
20836
|
-
console.log(
|
|
20854
|
+
console.log(chalk187.gray(`Capturing window for process "${processName}" ...`));
|
|
20837
20855
|
try {
|
|
20838
20856
|
runPowerShellScript(processName, outputPath);
|
|
20839
|
-
console.log(
|
|
20857
|
+
console.log(chalk187.green(`Screenshot saved: ${outputPath}`));
|
|
20840
20858
|
} catch (error) {
|
|
20841
20859
|
const msg = error instanceof Error ? error.message : String(error);
|
|
20842
|
-
console.error(
|
|
20860
|
+
console.error(chalk187.red(`Failed to capture screenshot: ${msg}`));
|
|
20843
20861
|
process.exit(1);
|
|
20844
20862
|
}
|
|
20845
20863
|
}
|
|
@@ -23355,7 +23373,7 @@ function registerDaemon(program2) {
|
|
|
23355
23373
|
|
|
23356
23374
|
// src/commands/sessions/summarise/index.ts
|
|
23357
23375
|
import * as fs36 from "fs";
|
|
23358
|
-
import
|
|
23376
|
+
import chalk188 from "chalk";
|
|
23359
23377
|
|
|
23360
23378
|
// src/commands/sessions/summarise/shared.ts
|
|
23361
23379
|
import * as fs34 from "fs";
|
|
@@ -23509,22 +23527,22 @@ ${firstMessage}`);
|
|
|
23509
23527
|
async function summarise2(options2) {
|
|
23510
23528
|
const files = await discoverSessionFiles();
|
|
23511
23529
|
if (files.length === 0) {
|
|
23512
|
-
console.log(
|
|
23530
|
+
console.log(chalk188.yellow("No sessions found."));
|
|
23513
23531
|
return;
|
|
23514
23532
|
}
|
|
23515
23533
|
const toProcess = selectCandidates(files, options2);
|
|
23516
23534
|
if (toProcess.length === 0) {
|
|
23517
|
-
console.log(
|
|
23535
|
+
console.log(chalk188.green("All sessions already summarised."));
|
|
23518
23536
|
return;
|
|
23519
23537
|
}
|
|
23520
23538
|
console.log(
|
|
23521
|
-
|
|
23539
|
+
chalk188.cyan(
|
|
23522
23540
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
23523
23541
|
)
|
|
23524
23542
|
);
|
|
23525
23543
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
23526
23544
|
console.log(
|
|
23527
|
-
|
|
23545
|
+
chalk188.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk188.yellow(`, ${failed2} skipped`) : "")
|
|
23528
23546
|
);
|
|
23529
23547
|
}
|
|
23530
23548
|
function selectCandidates(files, options2) {
|
|
@@ -23544,16 +23562,16 @@ function processSessions(files) {
|
|
|
23544
23562
|
let failed2 = 0;
|
|
23545
23563
|
for (let i = 0; i < files.length; i++) {
|
|
23546
23564
|
const file = files[i];
|
|
23547
|
-
process.stdout.write(
|
|
23565
|
+
process.stdout.write(chalk188.dim(` [${i + 1}/${files.length}] `));
|
|
23548
23566
|
const summary = summariseSession(file);
|
|
23549
23567
|
if (summary) {
|
|
23550
23568
|
writeSummary(file, summary);
|
|
23551
23569
|
succeeded++;
|
|
23552
|
-
process.stdout.write(`${
|
|
23570
|
+
process.stdout.write(`${chalk188.green("\u2713")} ${summary}
|
|
23553
23571
|
`);
|
|
23554
23572
|
} else {
|
|
23555
23573
|
failed2++;
|
|
23556
|
-
process.stdout.write(` ${
|
|
23574
|
+
process.stdout.write(` ${chalk188.yellow("skip")}
|
|
23557
23575
|
`);
|
|
23558
23576
|
}
|
|
23559
23577
|
}
|
|
@@ -23571,10 +23589,10 @@ function registerSessions(program2) {
|
|
|
23571
23589
|
}
|
|
23572
23590
|
|
|
23573
23591
|
// src/commands/statusLine.ts
|
|
23574
|
-
import
|
|
23592
|
+
import chalk190 from "chalk";
|
|
23575
23593
|
|
|
23576
23594
|
// src/commands/buildLimitsSegment.ts
|
|
23577
|
-
import
|
|
23595
|
+
import chalk189 from "chalk";
|
|
23578
23596
|
|
|
23579
23597
|
// src/shared/rateLimitLevel.ts
|
|
23580
23598
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -23605,9 +23623,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
23605
23623
|
|
|
23606
23624
|
// src/commands/buildLimitsSegment.ts
|
|
23607
23625
|
var LEVEL_COLOR = {
|
|
23608
|
-
ok:
|
|
23609
|
-
warn:
|
|
23610
|
-
over:
|
|
23626
|
+
ok: chalk189.green,
|
|
23627
|
+
warn: chalk189.yellow,
|
|
23628
|
+
over: chalk189.red
|
|
23611
23629
|
};
|
|
23612
23630
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
23613
23631
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -23656,14 +23674,14 @@ async function relayUsage(claudeSessionId, totalIn, totalOut) {
|
|
|
23656
23674
|
}
|
|
23657
23675
|
|
|
23658
23676
|
// src/commands/statusLine.ts
|
|
23659
|
-
|
|
23677
|
+
chalk190.level = 3;
|
|
23660
23678
|
function formatNumber(num) {
|
|
23661
23679
|
return num.toLocaleString("en-US");
|
|
23662
23680
|
}
|
|
23663
23681
|
function colorizePercent(pct) {
|
|
23664
23682
|
const label2 = `${Math.round(pct)}%`;
|
|
23665
|
-
if (pct > 80) return
|
|
23666
|
-
if (pct > 40) return
|
|
23683
|
+
if (pct > 80) return chalk190.red(label2);
|
|
23684
|
+
if (pct > 40) return chalk190.yellow(label2);
|
|
23667
23685
|
return label2;
|
|
23668
23686
|
}
|
|
23669
23687
|
async function statusLine() {
|
|
@@ -23688,7 +23706,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
23688
23706
|
// src/commands/sync/syncClaudeMd.ts
|
|
23689
23707
|
import * as fs37 from "fs";
|
|
23690
23708
|
import * as path53 from "path";
|
|
23691
|
-
import
|
|
23709
|
+
import chalk191 from "chalk";
|
|
23692
23710
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
23693
23711
|
const source = path53.join(claudeDir, "CLAUDE.md");
|
|
23694
23712
|
const target = path53.join(targetBase, "CLAUDE.md");
|
|
@@ -23697,12 +23715,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
23697
23715
|
const targetContent = fs37.readFileSync(target, "utf8");
|
|
23698
23716
|
if (sourceContent !== targetContent) {
|
|
23699
23717
|
console.log(
|
|
23700
|
-
|
|
23718
|
+
chalk191.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
23701
23719
|
);
|
|
23702
23720
|
console.log();
|
|
23703
23721
|
printDiff(targetContent, sourceContent);
|
|
23704
23722
|
const confirm = options2?.yes || await promptConfirm(
|
|
23705
|
-
|
|
23723
|
+
chalk191.red("Overwrite existing CLAUDE.md?"),
|
|
23706
23724
|
false
|
|
23707
23725
|
);
|
|
23708
23726
|
if (!confirm) {
|
|
@@ -23718,7 +23736,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
23718
23736
|
// src/commands/sync/syncSettings.ts
|
|
23719
23737
|
import * as fs38 from "fs";
|
|
23720
23738
|
import * as path54 from "path";
|
|
23721
|
-
import
|
|
23739
|
+
import chalk192 from "chalk";
|
|
23722
23740
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
23723
23741
|
const source = path54.join(claudeDir, "settings.json");
|
|
23724
23742
|
const target = path54.join(targetBase, "settings.json");
|
|
@@ -23737,14 +23755,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
23737
23755
|
if (mergedContent !== normalizedTarget) {
|
|
23738
23756
|
if (!options2?.yes) {
|
|
23739
23757
|
console.log(
|
|
23740
|
-
|
|
23758
|
+
chalk192.yellow(
|
|
23741
23759
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
23742
23760
|
)
|
|
23743
23761
|
);
|
|
23744
23762
|
console.log();
|
|
23745
23763
|
printDiff(targetContent, mergedContent);
|
|
23746
23764
|
const confirm = await promptConfirm(
|
|
23747
|
-
|
|
23765
|
+
chalk192.red("Overwrite existing settings.json?"),
|
|
23748
23766
|
false
|
|
23749
23767
|
);
|
|
23750
23768
|
if (!confirm) {
|