@staff0rd/assist 0.403.0 → 0.404.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -5
- package/claude/settings.json +4 -4
- package/dist/commands/sessions/web/bundle.js +84 -84
- package/dist/index.js +663 -694
- package/package.json +1 -1
- /package/claude/commands/{review-comments.md → review-pr-comments.md} +0 -0
- /package/claude/commands/{strip-comments.md → strip-code-comments.md} +0 -0
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.404.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -242,7 +242,7 @@ var assistConfigSchema = z2.strictObject({
|
|
|
242
242
|
hardcodedColors: z2.strictObject({
|
|
243
243
|
ignore: z2.array(z2.string()).default([])
|
|
244
244
|
}).optional(),
|
|
245
|
-
|
|
245
|
+
blockCodeComments: z2.strictObject({
|
|
246
246
|
ignore: z2.array(z2.string()).default([])
|
|
247
247
|
}).optional(),
|
|
248
248
|
restructure: z2.strictObject({
|
|
@@ -2990,7 +2990,7 @@ function lint(options2 = {}) {
|
|
|
2990
2990
|
import { execSync as execSync18 } from "child_process";
|
|
2991
2991
|
import { basename as basename2, resolve as resolve5 } from "path";
|
|
2992
2992
|
|
|
2993
|
-
// src/commands/verify/
|
|
2993
|
+
// src/commands/verify/blockCodeComments/findComments.ts
|
|
2994
2994
|
import { execSync as execSync10 } from "child_process";
|
|
2995
2995
|
import fs15 from "fs";
|
|
2996
2996
|
import { minimatch } from "minimatch";
|
|
@@ -3025,7 +3025,7 @@ function isHashCommentFile(filePath) {
|
|
|
3025
3025
|
return isYamlFile(filePath) || isDockerfile(filePath) || isEnvFile(filePath) || isShellFile(filePath);
|
|
3026
3026
|
}
|
|
3027
3027
|
|
|
3028
|
-
// src/commands/verify/
|
|
3028
|
+
// src/commands/verify/blockCodeComments/collectFileComments.ts
|
|
3029
3029
|
import fs14 from "fs";
|
|
3030
3030
|
|
|
3031
3031
|
// src/shared/isBicepFile.ts
|
|
@@ -3035,7 +3035,7 @@ function isBicepFile(filePath) {
|
|
|
3035
3035
|
return BICEP_EXTENSIONS.some((ext) => filePath.endsWith(ext));
|
|
3036
3036
|
}
|
|
3037
3037
|
|
|
3038
|
-
// src/commands/verify/
|
|
3038
|
+
// src/commands/verify/blockCodeComments/collectBicepComments.ts
|
|
3039
3039
|
function blankNonNewline(text17) {
|
|
3040
3040
|
return text17.replace(/[^\n]/g, " ");
|
|
3041
3041
|
}
|
|
@@ -3058,7 +3058,7 @@ function collectBicepComments(content) {
|
|
|
3058
3058
|
return comments3;
|
|
3059
3059
|
}
|
|
3060
3060
|
|
|
3061
|
-
// src/commands/verify/
|
|
3061
|
+
// src/commands/verify/blockCodeComments/collectHashComments.ts
|
|
3062
3062
|
function blankNonNewline2(text17) {
|
|
3063
3063
|
return text17.replace(/[^\n]/g, " ");
|
|
3064
3064
|
}
|
|
@@ -3084,7 +3084,7 @@ function collectHashComments(content, options2) {
|
|
|
3084
3084
|
return comments3;
|
|
3085
3085
|
}
|
|
3086
3086
|
|
|
3087
|
-
// src/commands/verify/
|
|
3087
|
+
// src/commands/verify/blockCodeComments/collectComments.ts
|
|
3088
3088
|
function collectComments(sourceFile) {
|
|
3089
3089
|
const seen = /* @__PURE__ */ new Set();
|
|
3090
3090
|
const comments3 = [];
|
|
@@ -3121,7 +3121,7 @@ function parseMaintainabilityOverride(content) {
|
|
|
3121
3121
|
return void 0;
|
|
3122
3122
|
}
|
|
3123
3123
|
|
|
3124
|
-
// src/commands/verify/
|
|
3124
|
+
// src/commands/verify/blockCodeComments/isCommentExempt.ts
|
|
3125
3125
|
var MACHINE_DIRECTIVES = [
|
|
3126
3126
|
"oxlint-disable",
|
|
3127
3127
|
"oxlint-enable",
|
|
@@ -3142,7 +3142,7 @@ function isCommentExempt(text17) {
|
|
|
3142
3142
|
return MACHINE_DIRECTIVES.some((d) => lower.includes(d));
|
|
3143
3143
|
}
|
|
3144
3144
|
|
|
3145
|
-
// src/commands/verify/
|
|
3145
|
+
// src/commands/verify/blockCodeComments/collectSourceFindings.ts
|
|
3146
3146
|
function toSingleLine(text17) {
|
|
3147
3147
|
return text17.replace(/\s+/g, " ").trim();
|
|
3148
3148
|
}
|
|
@@ -3158,7 +3158,7 @@ function collectSourceFindings(file, lines, project) {
|
|
|
3158
3158
|
return findings;
|
|
3159
3159
|
}
|
|
3160
3160
|
|
|
3161
|
-
// src/commands/verify/
|
|
3161
|
+
// src/commands/verify/blockCodeComments/collectYamlComments.ts
|
|
3162
3162
|
import { Lexer } from "yaml";
|
|
3163
3163
|
function collectYamlComments(content) {
|
|
3164
3164
|
const comments3 = [];
|
|
@@ -3170,7 +3170,7 @@ function collectYamlComments(content) {
|
|
|
3170
3170
|
return comments3;
|
|
3171
3171
|
}
|
|
3172
3172
|
|
|
3173
|
-
// src/commands/verify/
|
|
3173
|
+
// src/commands/verify/blockCodeComments/collectFileComments.ts
|
|
3174
3174
|
function toFindings(file, lines, raw, exempt) {
|
|
3175
3175
|
const findings = [];
|
|
3176
3176
|
for (const { line, text: text17 } of raw) {
|
|
@@ -3196,7 +3196,7 @@ function collectFileComments(file, lines, project) {
|
|
|
3196
3196
|
return collectSourceFindings(file, lines, project);
|
|
3197
3197
|
}
|
|
3198
3198
|
|
|
3199
|
-
// src/commands/verify/
|
|
3199
|
+
// src/commands/verify/blockCodeComments/parseDiffAddedLines.ts
|
|
3200
3200
|
var FILE_HEADER = /^\+\+\+ (?:b\/)?(.+)$/;
|
|
3201
3201
|
var HUNK_HEADER = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/;
|
|
3202
3202
|
function parseDiffAddedLines(diff2) {
|
|
@@ -3231,7 +3231,7 @@ function parseDiffAddedLines(diff2) {
|
|
|
3231
3231
|
return added;
|
|
3232
3232
|
}
|
|
3233
3233
|
|
|
3234
|
-
// src/commands/verify/
|
|
3234
|
+
// src/commands/verify/blockCodeComments/findComments.ts
|
|
3235
3235
|
var SCANNED_EXTENSIONS = [
|
|
3236
3236
|
".ts",
|
|
3237
3237
|
".tsx",
|
|
@@ -3269,9 +3269,9 @@ function findComments(options2) {
|
|
|
3269
3269
|
return findings;
|
|
3270
3270
|
}
|
|
3271
3271
|
|
|
3272
|
-
// src/commands/verify/
|
|
3273
|
-
function
|
|
3274
|
-
const ignoreGlobs = loadConfig().
|
|
3272
|
+
// src/commands/verify/blockCodeComments/index.ts
|
|
3273
|
+
function blockCodeComments() {
|
|
3274
|
+
const ignoreGlobs = loadConfig().blockCodeComments?.ignore ?? [];
|
|
3275
3275
|
const findings = findComments({ ignoreGlobs });
|
|
3276
3276
|
if (findings.length === 0) {
|
|
3277
3277
|
console.log("No comments on changed lines.");
|
|
@@ -6808,7 +6808,7 @@ function deriveHistoryFields(commandName, commandArgs, name) {
|
|
|
6808
6808
|
return fields;
|
|
6809
6809
|
}
|
|
6810
6810
|
function deriveSessionType(commandName, name) {
|
|
6811
|
-
if (commandName === "review-comments") return "review";
|
|
6811
|
+
if (commandName === "review-pr-comments") return "review";
|
|
6812
6812
|
if (KNOWN.includes(commandName))
|
|
6813
6813
|
return commandName;
|
|
6814
6814
|
if (commandName || name) return "prompt";
|
|
@@ -7564,7 +7564,7 @@ async function show(id) {
|
|
|
7564
7564
|
}
|
|
7565
7565
|
|
|
7566
7566
|
// src/commands/sessions/web/index.ts
|
|
7567
|
-
import
|
|
7567
|
+
import chalk60 from "chalk";
|
|
7568
7568
|
import { WebSocketServer } from "ws";
|
|
7569
7569
|
|
|
7570
7570
|
// src/shared/getInstallDir.ts
|
|
@@ -7839,9 +7839,6 @@ function createFallbackHandler(routes3, htmlHandler2, extra) {
|
|
|
7839
7839
|
};
|
|
7840
7840
|
}
|
|
7841
7841
|
|
|
7842
|
-
// src/commands/backlog/loadBacklogSummaries.ts
|
|
7843
|
-
import { eq as eq13 } from "drizzle-orm";
|
|
7844
|
-
|
|
7845
7842
|
// src/commands/backlog/loadItemSummaries.ts
|
|
7846
7843
|
import { asc as asc5, eq as eq12 } from "drizzle-orm";
|
|
7847
7844
|
|
|
@@ -7915,36 +7912,6 @@ async function loadItemSummaries(orm, origin) {
|
|
|
7915
7912
|
return rows.map(rowToItemSummary);
|
|
7916
7913
|
}
|
|
7917
7914
|
|
|
7918
|
-
// src/commands/backlog/loadBacklogSummaries.ts
|
|
7919
|
-
async function loadBacklogSummaries(allRepos = false) {
|
|
7920
|
-
const { orm } = await getReady();
|
|
7921
|
-
return loadItemSummaries(orm, allRepos ? void 0 : getOrigin());
|
|
7922
|
-
}
|
|
7923
|
-
async function searchBacklogSummaries(query) {
|
|
7924
|
-
const { orm } = await getReady();
|
|
7925
|
-
const origin = getOrigin();
|
|
7926
|
-
const ids = await searchItemIds(orm, query, origin);
|
|
7927
|
-
const summaries = await loadItemSummaries(orm, origin);
|
|
7928
|
-
return summaries.filter((item) => ids.includes(item.id));
|
|
7929
|
-
}
|
|
7930
|
-
async function backlogHasItems() {
|
|
7931
|
-
const { orm } = await getReady();
|
|
7932
|
-
const [row] = await orm.select({ id: items.id }).from(items).where(eq13(items.origin, getOrigin())).limit(1);
|
|
7933
|
-
return row !== void 0;
|
|
7934
|
-
}
|
|
7935
|
-
|
|
7936
|
-
// src/commands/backlog/web/applyCwdFromReq.ts
|
|
7937
|
-
function applyCwdFromReq(req) {
|
|
7938
|
-
const url = new URL(req.url ?? "/", "http://localhost");
|
|
7939
|
-
setBacklogDir(url.searchParams.get("cwd") ?? void 0);
|
|
7940
|
-
}
|
|
7941
|
-
|
|
7942
|
-
// src/commands/backlog/web/getBacklogExists.ts
|
|
7943
|
-
async function getBacklogExists(req, res) {
|
|
7944
|
-
applyCwdFromReq(req);
|
|
7945
|
-
respondJson(res, 200, { exists: await backlogHasItems() });
|
|
7946
|
-
}
|
|
7947
|
-
|
|
7948
7915
|
// src/commands/backlog/originDisplayName.ts
|
|
7949
7916
|
function originDisplayName(origin) {
|
|
7950
7917
|
if (origin.startsWith("local:")) {
|
|
@@ -8018,23 +7985,42 @@ async function getBacklogSummary(req, res) {
|
|
|
8018
7985
|
respondJson(res, 200, await loadRepoSummaries(currentOrigin, knownCwds));
|
|
8019
7986
|
}
|
|
8020
7987
|
|
|
7988
|
+
// src/commands/backlog/web/applyCwdFromReq.ts
|
|
7989
|
+
function applyCwdFromReq(req) {
|
|
7990
|
+
const url = new URL(req.url ?? "/", "http://localhost");
|
|
7991
|
+
setBacklogDir(url.searchParams.get("cwd") ?? void 0);
|
|
7992
|
+
}
|
|
7993
|
+
|
|
8021
7994
|
// src/commands/backlog/deleteComment.ts
|
|
8022
|
-
import { and as and5, eq as
|
|
7995
|
+
import { and as and5, eq as eq13 } from "drizzle-orm";
|
|
8023
7996
|
async function deleteComment(orm, itemId2, commentId) {
|
|
8024
|
-
const [row] = await orm.select({ type: comments.type }).from(comments).where(and5(
|
|
7997
|
+
const [row] = await orm.select({ type: comments.type }).from(comments).where(and5(eq13(comments.id, commentId), eq13(comments.itemId, itemId2)));
|
|
8025
7998
|
if (!row) return "not-found";
|
|
8026
7999
|
if (row.type === "summary") return "is-summary";
|
|
8027
|
-
await orm.delete(comments).where(and5(
|
|
8000
|
+
await orm.delete(comments).where(and5(eq13(comments.id, commentId), eq13(comments.itemId, itemId2)));
|
|
8028
8001
|
return "deleted";
|
|
8029
8002
|
}
|
|
8030
8003
|
|
|
8031
8004
|
// src/commands/backlog/updateStarred.ts
|
|
8032
|
-
import { eq as
|
|
8005
|
+
import { eq as eq14 } from "drizzle-orm";
|
|
8033
8006
|
async function updateStarred(orm, id, starred) {
|
|
8034
|
-
const [row] = await orm.update(items).set({ starred }).where(
|
|
8007
|
+
const [row] = await orm.update(items).set({ starred }).where(eq14(items.id, id)).returning({ name: items.name });
|
|
8035
8008
|
return row?.name;
|
|
8036
8009
|
}
|
|
8037
8010
|
|
|
8011
|
+
// src/commands/backlog/loadBacklogSummaries.ts
|
|
8012
|
+
async function loadBacklogSummaries(allRepos = false) {
|
|
8013
|
+
const { orm } = await getReady();
|
|
8014
|
+
return loadItemSummaries(orm, allRepos ? void 0 : getOrigin());
|
|
8015
|
+
}
|
|
8016
|
+
async function searchBacklogSummaries(query) {
|
|
8017
|
+
const { orm } = await getReady();
|
|
8018
|
+
const origin = getOrigin();
|
|
8019
|
+
const ids = await searchItemIds(orm, query, origin);
|
|
8020
|
+
const summaries = await loadItemSummaries(orm, origin);
|
|
8021
|
+
return summaries.filter((item) => ids.includes(item.id));
|
|
8022
|
+
}
|
|
8023
|
+
|
|
8038
8024
|
// src/commands/backlog/web/parseBacklogFilter.ts
|
|
8039
8025
|
var validFilters = /* @__PURE__ */ new Set(["todo", "done", "all"]);
|
|
8040
8026
|
function parseBacklogFilter(value) {
|
|
@@ -8152,9 +8138,9 @@ async function deleteItemComment(res, itemId2, commentId) {
|
|
|
8152
8138
|
}
|
|
8153
8139
|
|
|
8154
8140
|
// src/commands/backlog/updateSubtaskStatus.ts
|
|
8155
|
-
import { and as and6, eq as
|
|
8141
|
+
import { and as and6, eq as eq15 } from "drizzle-orm";
|
|
8156
8142
|
async function updateSubtaskStatus(orm, itemId2, idx, status3) {
|
|
8157
|
-
const [row] = await orm.update(itemSubtasks).set({ status: status3 }).where(and6(
|
|
8143
|
+
const [row] = await orm.update(itemSubtasks).set({ status: status3 }).where(and6(eq15(itemSubtasks.itemId, itemId2), eq15(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
|
|
8158
8144
|
return row?.title;
|
|
8159
8145
|
}
|
|
8160
8146
|
|
|
@@ -8277,24 +8263,6 @@ async function handleItemRoute(req, res, pathname) {
|
|
|
8277
8263
|
return false;
|
|
8278
8264
|
}
|
|
8279
8265
|
|
|
8280
|
-
// src/commands/backlog/init/index.ts
|
|
8281
|
-
import chalk57 from "chalk";
|
|
8282
|
-
async function init7() {
|
|
8283
|
-
await getDb();
|
|
8284
|
-
console.log(
|
|
8285
|
-
chalk57.green(
|
|
8286
|
-
`Backlog database ready. This repository maps to origin: ${getOrigin()}`
|
|
8287
|
-
)
|
|
8288
|
-
);
|
|
8289
|
-
}
|
|
8290
|
-
|
|
8291
|
-
// src/commands/backlog/web/initBacklog.ts
|
|
8292
|
-
async function initBacklog(req, res) {
|
|
8293
|
-
applyCwdFromReq(req);
|
|
8294
|
-
await init7();
|
|
8295
|
-
respondJson(res, 200, { ok: true });
|
|
8296
|
-
}
|
|
8297
|
-
|
|
8298
8266
|
// src/shared/db/listBackups.ts
|
|
8299
8267
|
import { desc } from "drizzle-orm";
|
|
8300
8268
|
async function listBackups(db) {
|
|
@@ -8706,7 +8674,7 @@ async function listNewsItems(_req, res) {
|
|
|
8706
8674
|
}
|
|
8707
8675
|
|
|
8708
8676
|
// src/shared/db/listUsagePeaks.ts
|
|
8709
|
-
import { and as and7, count, desc as desc2, eq as
|
|
8677
|
+
import { and as and7, count, desc as desc2, eq as eq16, getTableColumns, sql as sql14 } from "drizzle-orm";
|
|
8710
8678
|
async function listUsagePeaks(db, paging) {
|
|
8711
8679
|
const avgContext = db.select({
|
|
8712
8680
|
window: phaseCycleContext.window,
|
|
@@ -8723,8 +8691,8 @@ async function listUsagePeaks(db, paging) {
|
|
|
8723
8691
|
}).from(usagePeaks).leftJoin(
|
|
8724
8692
|
avgContext,
|
|
8725
8693
|
and7(
|
|
8726
|
-
|
|
8727
|
-
|
|
8694
|
+
eq16(usagePeaks.window, avgContext.window),
|
|
8695
|
+
eq16(usagePeaks.resetsAt, avgContext.resetsAt)
|
|
8728
8696
|
)
|
|
8729
8697
|
).orderBy(
|
|
8730
8698
|
desc2(usagePeaks.resetsAt),
|
|
@@ -9027,9 +8995,7 @@ var routes2 = {
|
|
|
9027
8995
|
),
|
|
9028
8996
|
"GET /xterm.css": createCssHandler("@xterm/xterm/css/xterm.css"),
|
|
9029
8997
|
"GET /api/items": listItems,
|
|
9030
|
-
"GET /api/backlog/exists": getBacklogExists,
|
|
9031
8998
|
"GET /api/backlog/summary": getBacklogSummary,
|
|
9032
|
-
"POST /api/backlog/init": initBacklog,
|
|
9033
8999
|
"POST /api/open-in-code": openInCode,
|
|
9034
9000
|
"POST /api/restart": restartWeb,
|
|
9035
9001
|
"GET /api/github-url": githubUrl,
|
|
@@ -9121,25 +9087,25 @@ function withRepoCwd(line, repoCwd) {
|
|
|
9121
9087
|
}
|
|
9122
9088
|
|
|
9123
9089
|
// src/commands/sessions/web/restartMenu/installRestartMenu.ts
|
|
9124
|
-
import
|
|
9090
|
+
import chalk59 from "chalk";
|
|
9125
9091
|
import { createLogUpdate } from "log-update";
|
|
9126
9092
|
|
|
9127
9093
|
// src/commands/sessions/web/restartMenu/runRestartItem.ts
|
|
9128
|
-
import
|
|
9094
|
+
import chalk57 from "chalk";
|
|
9129
9095
|
async function runRestartItem(item, { runRestartDaemon, reExec }) {
|
|
9130
9096
|
if (item.disabled) return;
|
|
9131
9097
|
try {
|
|
9132
9098
|
if (item.action === "restart-daemon" || item.action === "restart-both") {
|
|
9133
|
-
console.log(
|
|
9099
|
+
console.log(chalk57.cyan("Restarting sessions daemon\u2026"));
|
|
9134
9100
|
await runRestartDaemon();
|
|
9135
9101
|
}
|
|
9136
9102
|
if (item.action === "restart-webserver" || item.action === "restart-both") {
|
|
9137
|
-
console.log(
|
|
9103
|
+
console.log(chalk57.cyan("Restarting web server\u2026"));
|
|
9138
9104
|
reExec();
|
|
9139
9105
|
}
|
|
9140
9106
|
} catch (error) {
|
|
9141
9107
|
const message = error instanceof Error ? error.message : String(error);
|
|
9142
|
-
console.error(
|
|
9108
|
+
console.error(chalk57.red(`Restart failed: ${message}`));
|
|
9143
9109
|
}
|
|
9144
9110
|
}
|
|
9145
9111
|
|
|
@@ -9221,20 +9187,20 @@ function firstEnabledIndex(items2) {
|
|
|
9221
9187
|
}
|
|
9222
9188
|
|
|
9223
9189
|
// src/commands/sessions/web/restartMenu/renderRestartMenu.ts
|
|
9224
|
-
import
|
|
9190
|
+
import chalk58 from "chalk";
|
|
9225
9191
|
function renderRestartMenu(items2, selected) {
|
|
9226
|
-
const lines = [
|
|
9192
|
+
const lines = [chalk58.bold.cyan("assist \u2014 restart menu")];
|
|
9227
9193
|
items2.forEach((item, i) => {
|
|
9228
9194
|
const active = i === selected;
|
|
9229
|
-
const pointer = active ?
|
|
9230
|
-
const number =
|
|
9231
|
-
const note = item.note ?
|
|
9195
|
+
const pointer = active ? chalk58.cyan("\u276F ") : " ";
|
|
9196
|
+
const number = chalk58.dim(`${i + 1}. `);
|
|
9197
|
+
const note = item.note ? chalk58.dim(` (${item.note})`) : "";
|
|
9232
9198
|
let label2 = item.label;
|
|
9233
|
-
if (item.disabled) label2 =
|
|
9234
|
-
else if (active) label2 =
|
|
9199
|
+
if (item.disabled) label2 = chalk58.dim(label2);
|
|
9200
|
+
else if (active) label2 = chalk58.cyan.bold(label2);
|
|
9235
9201
|
lines.push(`${pointer}${number}${label2}${note}`);
|
|
9236
9202
|
});
|
|
9237
|
-
lines.push(
|
|
9203
|
+
lines.push(chalk58.dim("\u2191/\u2193 move \xB7 1-3 jump \xB7 enter select \xB7 esc close"));
|
|
9238
9204
|
return lines.join("\n");
|
|
9239
9205
|
}
|
|
9240
9206
|
|
|
@@ -9328,7 +9294,7 @@ function installRestartMenu(options2 = {}) {
|
|
|
9328
9294
|
}
|
|
9329
9295
|
});
|
|
9330
9296
|
const restoreRaw = enableRawMode(stdin, handler);
|
|
9331
|
-
console.log(
|
|
9297
|
+
console.log(chalk59.dim("Press Ctrl+R for the restart menu"));
|
|
9332
9298
|
let cleaned = false;
|
|
9333
9299
|
function cleanup() {
|
|
9334
9300
|
if (cleaned) return;
|
|
@@ -9410,7 +9376,7 @@ async function web(options2) {
|
|
|
9410
9376
|
streamDaemonLogs();
|
|
9411
9377
|
void ensureDaemonRunning("web server start").catch((error) => {
|
|
9412
9378
|
console.error(
|
|
9413
|
-
|
|
9379
|
+
chalk60.yellow(
|
|
9414
9380
|
`sessions daemon not ready yet, will retry on connection: ${error instanceof Error ? error.message : String(error)}`
|
|
9415
9381
|
)
|
|
9416
9382
|
);
|
|
@@ -9441,12 +9407,12 @@ var backlogConfigHelp = [
|
|
|
9441
9407
|
];
|
|
9442
9408
|
|
|
9443
9409
|
// src/commands/backlog/addActivity.ts
|
|
9444
|
-
import
|
|
9410
|
+
import chalk61 from "chalk";
|
|
9445
9411
|
async function addActivity(id, kind, ref, options2) {
|
|
9446
9412
|
const parsedKind = gitRefKindSchema.safeParse(kind);
|
|
9447
9413
|
if (!parsedKind.success) {
|
|
9448
9414
|
console.log(
|
|
9449
|
-
|
|
9415
|
+
chalk61.red(
|
|
9450
9416
|
`Invalid kind "${kind}". Expected one of: ${gitRefKindSchema.options.join(", ")}.`
|
|
9451
9417
|
)
|
|
9452
9418
|
);
|
|
@@ -9468,7 +9434,7 @@ async function addActivity(id, kind, ref, options2) {
|
|
|
9468
9434
|
state: options2.state
|
|
9469
9435
|
});
|
|
9470
9436
|
console.log(
|
|
9471
|
-
|
|
9437
|
+
chalk61.green(
|
|
9472
9438
|
`Attached ${parsedKind.data} "${ref}" to item ${formatItemId(item.id)}.`
|
|
9473
9439
|
)
|
|
9474
9440
|
);
|
|
@@ -9482,12 +9448,12 @@ function registerActivityCommands(cmd) {
|
|
|
9482
9448
|
}
|
|
9483
9449
|
|
|
9484
9450
|
// src/commands/backlog/associate-jira/index.ts
|
|
9485
|
-
import
|
|
9486
|
-
import { eq as
|
|
9451
|
+
import chalk63 from "chalk";
|
|
9452
|
+
import { eq as eq17 } from "drizzle-orm";
|
|
9487
9453
|
|
|
9488
9454
|
// src/commands/jira/fetchIssue.ts
|
|
9489
9455
|
import { execSync as execSync30 } from "child_process";
|
|
9490
|
-
import
|
|
9456
|
+
import chalk62 from "chalk";
|
|
9491
9457
|
function fetchIssue(issueKey, fields) {
|
|
9492
9458
|
let result;
|
|
9493
9459
|
try {
|
|
@@ -9500,15 +9466,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
9500
9466
|
const stderr = error.stderr;
|
|
9501
9467
|
if (stderr.includes("unauthorized")) {
|
|
9502
9468
|
console.error(
|
|
9503
|
-
|
|
9469
|
+
chalk62.red("Jira authentication expired."),
|
|
9504
9470
|
"Run",
|
|
9505
|
-
|
|
9471
|
+
chalk62.cyan("assist jira auth"),
|
|
9506
9472
|
"to re-authenticate."
|
|
9507
9473
|
);
|
|
9508
9474
|
process.exit(1);
|
|
9509
9475
|
}
|
|
9510
9476
|
}
|
|
9511
|
-
console.error(
|
|
9477
|
+
console.error(chalk62.red(`Failed to fetch ${issueKey}.`));
|
|
9512
9478
|
process.exit(1);
|
|
9513
9479
|
}
|
|
9514
9480
|
return JSON.parse(result);
|
|
@@ -9525,20 +9491,20 @@ async function associateJira(id, key, options2) {
|
|
|
9525
9491
|
const { orm } = found;
|
|
9526
9492
|
const itemId2 = found.item.id;
|
|
9527
9493
|
if (options2.clear) {
|
|
9528
|
-
await orm.update(items).set({ jiraKey: null }).where(
|
|
9494
|
+
await orm.update(items).set({ jiraKey: null }).where(eq17(items.id, itemId2));
|
|
9529
9495
|
console.log(
|
|
9530
|
-
|
|
9496
|
+
chalk63.green(`Cleared Jira association on item ${formatItemId(itemId2)}.`)
|
|
9531
9497
|
);
|
|
9532
9498
|
return;
|
|
9533
9499
|
}
|
|
9534
9500
|
if (!key) {
|
|
9535
|
-
console.log(
|
|
9501
|
+
console.log(chalk63.red("Provide a Jira key, or use --clear to remove one."));
|
|
9536
9502
|
process.exitCode = 1;
|
|
9537
9503
|
return;
|
|
9538
9504
|
}
|
|
9539
9505
|
if (!JIRA_KEY_PATTERN.test(key)) {
|
|
9540
9506
|
console.log(
|
|
9541
|
-
|
|
9507
|
+
chalk63.red(`Malformed Jira key "${key}". Expected a key like PROJ-123.`)
|
|
9542
9508
|
);
|
|
9543
9509
|
process.exitCode = 1;
|
|
9544
9510
|
return;
|
|
@@ -9546,10 +9512,10 @@ async function associateJira(id, key, options2) {
|
|
|
9546
9512
|
const parsed = fetchIssue(key, "summary");
|
|
9547
9513
|
const fields = parsed?.fields;
|
|
9548
9514
|
const summary = fields?.summary;
|
|
9549
|
-
await orm.update(items).set({ jiraKey: key }).where(
|
|
9515
|
+
await orm.update(items).set({ jiraKey: key }).where(eq17(items.id, itemId2));
|
|
9550
9516
|
console.log(
|
|
9551
|
-
|
|
9552
|
-
summary ?
|
|
9517
|
+
chalk63.green(`Associated ${key} with item ${formatItemId(itemId2)}.`),
|
|
9518
|
+
summary ? chalk63.dim(`(${summary})`) : ""
|
|
9553
9519
|
);
|
|
9554
9520
|
}
|
|
9555
9521
|
|
|
@@ -9559,29 +9525,29 @@ function registerAssociateJiraCommand(cmd) {
|
|
|
9559
9525
|
}
|
|
9560
9526
|
|
|
9561
9527
|
// src/commands/backlog/comment/index.ts
|
|
9562
|
-
import
|
|
9528
|
+
import chalk64 from "chalk";
|
|
9563
9529
|
async function comment(id, text17) {
|
|
9564
9530
|
const found = await findOneItem(id);
|
|
9565
9531
|
if (!found) process.exit(1);
|
|
9566
9532
|
await appendComment(found.orm, found.item.id, text17);
|
|
9567
9533
|
console.log(
|
|
9568
|
-
|
|
9534
|
+
chalk64.green(`Comment added to item ${formatItemId(found.item.id)}.`)
|
|
9569
9535
|
);
|
|
9570
9536
|
}
|
|
9571
9537
|
|
|
9572
9538
|
// src/commands/backlog/comments/index.ts
|
|
9573
|
-
import
|
|
9539
|
+
import chalk65 from "chalk";
|
|
9574
9540
|
async function comments2(id) {
|
|
9575
9541
|
const found = await findOneItem(id);
|
|
9576
9542
|
if (!found) process.exit(1);
|
|
9577
9543
|
const { item } = found;
|
|
9578
9544
|
const entries = item.comments ?? [];
|
|
9579
9545
|
if (entries.length === 0) {
|
|
9580
|
-
console.log(
|
|
9546
|
+
console.log(chalk65.dim(`No comments on item ${formatItemId(item.id)}.`));
|
|
9581
9547
|
return;
|
|
9582
9548
|
}
|
|
9583
9549
|
console.log(
|
|
9584
|
-
|
|
9550
|
+
chalk65.bold(`Comments for ${formatItemId(item.id)}: ${item.name}
|
|
9585
9551
|
`)
|
|
9586
9552
|
);
|
|
9587
9553
|
for (const entry of entries) {
|
|
@@ -9591,7 +9557,7 @@ async function comments2(id) {
|
|
|
9591
9557
|
}
|
|
9592
9558
|
|
|
9593
9559
|
// src/commands/backlog/delete-comment/index.ts
|
|
9594
|
-
import
|
|
9560
|
+
import chalk66 from "chalk";
|
|
9595
9561
|
async function deleteCommentCmd(id, commentId) {
|
|
9596
9562
|
const found = await findOneItem(id);
|
|
9597
9563
|
if (!found) process.exit(1);
|
|
@@ -9604,14 +9570,14 @@ async function deleteCommentCmd(id, commentId) {
|
|
|
9604
9570
|
switch (outcome) {
|
|
9605
9571
|
case "deleted":
|
|
9606
9572
|
console.log(
|
|
9607
|
-
|
|
9573
|
+
chalk66.green(
|
|
9608
9574
|
`Comment #${commentId} deleted from item ${formatItemId(itemId2)}.`
|
|
9609
9575
|
)
|
|
9610
9576
|
);
|
|
9611
9577
|
break;
|
|
9612
9578
|
case "not-found":
|
|
9613
9579
|
console.log(
|
|
9614
|
-
|
|
9580
|
+
chalk66.red(
|
|
9615
9581
|
`Comment #${commentId} not found on item ${formatItemId(itemId2)}.`
|
|
9616
9582
|
)
|
|
9617
9583
|
);
|
|
@@ -9619,7 +9585,7 @@ async function deleteCommentCmd(id, commentId) {
|
|
|
9619
9585
|
break;
|
|
9620
9586
|
case "is-summary":
|
|
9621
9587
|
console.log(
|
|
9622
|
-
|
|
9588
|
+
chalk66.red(
|
|
9623
9589
|
`Comment #${commentId} is a phase summary and cannot be deleted.`
|
|
9624
9590
|
)
|
|
9625
9591
|
);
|
|
@@ -9644,7 +9610,7 @@ function registerExportCommand(cmd) {
|
|
|
9644
9610
|
|
|
9645
9611
|
// src/commands/backlog/import/index.ts
|
|
9646
9612
|
import { readFile } from "fs/promises";
|
|
9647
|
-
import
|
|
9613
|
+
import chalk68 from "chalk";
|
|
9648
9614
|
|
|
9649
9615
|
// src/commands/backlog/dump/countCopyRows.ts
|
|
9650
9616
|
function countCopyRows(data) {
|
|
@@ -9716,7 +9682,7 @@ function validateDump({ header, sections }) {
|
|
|
9716
9682
|
}
|
|
9717
9683
|
|
|
9718
9684
|
// src/commands/backlog/import/confirmReplace.ts
|
|
9719
|
-
import
|
|
9685
|
+
import chalk67 from "chalk";
|
|
9720
9686
|
async function countRows(client, table) {
|
|
9721
9687
|
const { rows } = await client.query(
|
|
9722
9688
|
`SELECT count(*)::int AS n FROM ${table}`
|
|
@@ -9727,7 +9693,7 @@ function printSummary(tables, current, incoming) {
|
|
|
9727
9693
|
const lines = tables.map(
|
|
9728
9694
|
(t, i) => ` ${t.name}: ${current[i]} \u2192 ${incoming[i]} rows`
|
|
9729
9695
|
);
|
|
9730
|
-
console.error(
|
|
9696
|
+
console.error(chalk67.bold("\nThis will REPLACE all backlog data:"));
|
|
9731
9697
|
console.error(`${lines.join("\n")}
|
|
9732
9698
|
`);
|
|
9733
9699
|
}
|
|
@@ -9829,13 +9795,13 @@ async function importBacklog(file, options2 = {}) {
|
|
|
9829
9795
|
);
|
|
9830
9796
|
await withDbClient(async (client) => {
|
|
9831
9797
|
if (!options2.yes && !await confirmReplace(client, tables, incoming, !file)) {
|
|
9832
|
-
console.error(
|
|
9798
|
+
console.error(chalk68.yellow("Import cancelled; no changes made."));
|
|
9833
9799
|
return;
|
|
9834
9800
|
}
|
|
9835
9801
|
await restore(client, parsed);
|
|
9836
9802
|
const total = incoming.reduce((sum, n) => sum + n, 0);
|
|
9837
9803
|
console.error(
|
|
9838
|
-
|
|
9804
|
+
chalk68.green(
|
|
9839
9805
|
`Imported backlog: ${total} rows restored across ${tables.length} tables.`
|
|
9840
9806
|
)
|
|
9841
9807
|
);
|
|
@@ -9852,18 +9818,18 @@ function registerImportCommand(cmd) {
|
|
|
9852
9818
|
}
|
|
9853
9819
|
|
|
9854
9820
|
// src/commands/backlog/add/index.ts
|
|
9855
|
-
import
|
|
9821
|
+
import chalk70 from "chalk";
|
|
9856
9822
|
|
|
9857
9823
|
// src/commands/backlog/insertPhaseAt.ts
|
|
9858
|
-
import { eq as
|
|
9824
|
+
import { eq as eq19 } from "drizzle-orm";
|
|
9859
9825
|
|
|
9860
9826
|
// src/commands/backlog/shiftPhasesUp.ts
|
|
9861
|
-
import { and as and8, desc as desc3, eq as
|
|
9827
|
+
import { and as and8, desc as desc3, eq as eq18, gte } from "drizzle-orm";
|
|
9862
9828
|
async function shiftPhasesUp(db, itemId2, fromIdx) {
|
|
9863
|
-
const toShift = await db.select({ idx: planPhases.idx }).from(planPhases).where(and8(
|
|
9829
|
+
const toShift = await db.select({ idx: planPhases.idx }).from(planPhases).where(and8(eq18(planPhases.itemId, itemId2), gte(planPhases.idx, fromIdx))).orderBy(desc3(planPhases.idx));
|
|
9864
9830
|
for (const p of toShift) {
|
|
9865
|
-
await db.update(planTasks).set({ phaseIdx: p.idx + 1 }).where(and8(
|
|
9866
|
-
await db.update(planPhases).set({ idx: p.idx + 1 }).where(and8(
|
|
9831
|
+
await db.update(planTasks).set({ phaseIdx: p.idx + 1 }).where(and8(eq18(planTasks.itemId, itemId2), eq18(planTasks.phaseIdx, p.idx)));
|
|
9832
|
+
await db.update(planPhases).set({ idx: p.idx + 1 }).where(and8(eq18(planPhases.itemId, itemId2), eq18(planPhases.idx, p.idx)));
|
|
9867
9833
|
}
|
|
9868
9834
|
}
|
|
9869
9835
|
|
|
@@ -9876,7 +9842,7 @@ async function insertPhaseAt(orm, itemId2, phaseIdx, name, tasks, manualChecks,
|
|
|
9876
9842
|
await tx.insert(planTasks).values(tasks.map((task, i) => ({ itemId: itemId2, phaseIdx, idx: i, task })));
|
|
9877
9843
|
}
|
|
9878
9844
|
if (currentPhase !== void 0 && currentPhase - 1 >= phaseIdx) {
|
|
9879
|
-
await tx.update(items).set({ currentPhase: phaseIdx + 1 }).where(
|
|
9845
|
+
await tx.update(items).set({ currentPhase: phaseIdx + 1 }).where(eq19(items.id, itemId2));
|
|
9880
9846
|
}
|
|
9881
9847
|
});
|
|
9882
9848
|
}
|
|
@@ -9894,11 +9860,11 @@ async function insertSubtask(orm, itemId2, title, description) {
|
|
|
9894
9860
|
}
|
|
9895
9861
|
|
|
9896
9862
|
// src/commands/backlog/ensureRemoteOrigin.ts
|
|
9897
|
-
import
|
|
9863
|
+
import chalk69 from "chalk";
|
|
9898
9864
|
function ensureRemoteOrigin() {
|
|
9899
9865
|
if (getRemoteOriginUrl(getBacklogDir())) return true;
|
|
9900
9866
|
console.log(
|
|
9901
|
-
|
|
9867
|
+
chalk69.red(
|
|
9902
9868
|
"Backlog requires a git remote so items get a stable origin.\nAdd one with: git remote add origin <url>"
|
|
9903
9869
|
)
|
|
9904
9870
|
);
|
|
@@ -10002,23 +9968,23 @@ async function add(options2) {
|
|
|
10002
9968
|
for (const subtask of loadConfig().subtasks ?? []) {
|
|
10003
9969
|
await insertSubtask(orm, id, subtask.title, subtask.description);
|
|
10004
9970
|
}
|
|
10005
|
-
console.log(
|
|
9971
|
+
console.log(chalk70.green(`Added item ${formatItemId(id)}: ${name}`));
|
|
10006
9972
|
}
|
|
10007
9973
|
|
|
10008
9974
|
// src/commands/backlog/addPhase.ts
|
|
10009
|
-
import
|
|
9975
|
+
import chalk72 from "chalk";
|
|
10010
9976
|
|
|
10011
9977
|
// src/commands/backlog/resolveInsertPosition.ts
|
|
10012
|
-
import
|
|
10013
|
-
import { count as count2, eq as
|
|
9978
|
+
import chalk71 from "chalk";
|
|
9979
|
+
import { count as count2, eq as eq20 } from "drizzle-orm";
|
|
10014
9980
|
async function resolveInsertPosition(orm, itemId2, position) {
|
|
10015
|
-
const [row] = await orm.select({ cnt: count2() }).from(planPhases).where(
|
|
9981
|
+
const [row] = await orm.select({ cnt: count2() }).from(planPhases).where(eq20(planPhases.itemId, itemId2));
|
|
10016
9982
|
const phaseCount = row?.cnt ?? 0;
|
|
10017
9983
|
if (position === void 0) return phaseCount;
|
|
10018
9984
|
const pos = Number.parseInt(position, 10);
|
|
10019
9985
|
if (pos < 1 || pos > phaseCount + 1) {
|
|
10020
9986
|
console.log(
|
|
10021
|
-
|
|
9987
|
+
chalk71.red(
|
|
10022
9988
|
`Position ${pos} is out of range. Must be between 1 and ${phaseCount + 1}.`
|
|
10023
9989
|
)
|
|
10024
9990
|
);
|
|
@@ -10040,7 +10006,7 @@ async function addPhase(id, name, options2) {
|
|
|
10040
10006
|
if (!found) return;
|
|
10041
10007
|
const tasks = options2.task ?? [];
|
|
10042
10008
|
if (tasks.length === 0) {
|
|
10043
|
-
console.log(
|
|
10009
|
+
console.log(chalk72.red("At least one --task is required."));
|
|
10044
10010
|
process.exitCode = 1;
|
|
10045
10011
|
return;
|
|
10046
10012
|
}
|
|
@@ -10059,14 +10025,14 @@ async function addPhase(id, name, options2) {
|
|
|
10059
10025
|
);
|
|
10060
10026
|
const verb = options2.position !== void 0 ? "Inserted" : "Added";
|
|
10061
10027
|
console.log(
|
|
10062
|
-
|
|
10028
|
+
chalk72.green(
|
|
10063
10029
|
`${verb} phase ${phaseIdx + 1} "${name}" to item ${formatItemId(itemId2)} with ${tasks.length} task(s).`
|
|
10064
10030
|
)
|
|
10065
10031
|
);
|
|
10066
10032
|
}
|
|
10067
10033
|
|
|
10068
10034
|
// src/commands/backlog/list/index.ts
|
|
10069
|
-
import
|
|
10035
|
+
import chalk73 from "chalk";
|
|
10070
10036
|
function filterItems(items2, options2) {
|
|
10071
10037
|
if (options2.status) return items2.filter((i) => i.status === options2.status);
|
|
10072
10038
|
if (!options2.all)
|
|
@@ -10080,19 +10046,19 @@ function repoPrefixer(items2, allRepos) {
|
|
|
10080
10046
|
);
|
|
10081
10047
|
const repoNameOf = (item) => item.origin ? labels.get(item.origin) ?? "" : "";
|
|
10082
10048
|
const width = Math.max(0, ...items2.map((i) => repoNameOf(i).length));
|
|
10083
|
-
return (item) => `${
|
|
10049
|
+
return (item) => `${chalk73.dim(repoNameOf(item).padEnd(width))} `;
|
|
10084
10050
|
}
|
|
10085
10051
|
async function list2(options2) {
|
|
10086
10052
|
const allItems = await loadBacklog(options2.allRepos);
|
|
10087
10053
|
const items2 = filterItems(allItems, options2);
|
|
10088
10054
|
if (items2.length === 0) {
|
|
10089
|
-
console.log(
|
|
10055
|
+
console.log(chalk73.dim("Backlog is empty."));
|
|
10090
10056
|
return;
|
|
10091
10057
|
}
|
|
10092
10058
|
const prefixOf = repoPrefixer(items2, !!options2.allRepos);
|
|
10093
10059
|
for (const item of items2) {
|
|
10094
10060
|
console.log(
|
|
10095
|
-
`${prefixOf(item)}${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
10061
|
+
`${prefixOf(item)}${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk73.dim(formatItemId(item.id))} ${starMarker(item)}${item.name}${phaseLabel(item)}${dependencyLabel(item, allItems)}`
|
|
10096
10062
|
);
|
|
10097
10063
|
if (options2.verbose) {
|
|
10098
10064
|
printVerboseDetails(item);
|
|
@@ -10102,7 +10068,6 @@ async function list2(options2) {
|
|
|
10102
10068
|
|
|
10103
10069
|
// src/commands/backlog/registerItemCommands.ts
|
|
10104
10070
|
function registerItemCommands(cmd) {
|
|
10105
|
-
cmd.command("init").description("Create an empty backlog").action(init7);
|
|
10106
10071
|
cmd.command("list").alias("ls").description("List all backlog items").option(
|
|
10107
10072
|
"--status <type>",
|
|
10108
10073
|
"Filter by status (todo, in-progress, done, wontdo)"
|
|
@@ -10121,7 +10086,7 @@ function registerItemCommands(cmd) {
|
|
|
10121
10086
|
}
|
|
10122
10087
|
|
|
10123
10088
|
// src/commands/backlog/link.ts
|
|
10124
|
-
import
|
|
10089
|
+
import chalk75 from "chalk";
|
|
10125
10090
|
|
|
10126
10091
|
// src/commands/backlog/hasCycle.ts
|
|
10127
10092
|
function hasCycle(adjacency, fromId, toId) {
|
|
@@ -10140,9 +10105,9 @@ function hasCycle(adjacency, fromId, toId) {
|
|
|
10140
10105
|
}
|
|
10141
10106
|
|
|
10142
10107
|
// src/commands/backlog/loadDependencyGraph.ts
|
|
10143
|
-
import { eq as
|
|
10108
|
+
import { eq as eq21 } from "drizzle-orm";
|
|
10144
10109
|
async function loadDependencyGraph(orm) {
|
|
10145
|
-
const rows = await orm.select({ itemId: links.itemId, targetId: links.targetId }).from(links).where(
|
|
10110
|
+
const rows = await orm.select({ itemId: links.itemId, targetId: links.targetId }).from(links).where(eq21(links.type, "depends-on"));
|
|
10146
10111
|
const graph = /* @__PURE__ */ new Map();
|
|
10147
10112
|
for (const { itemId: itemId2, targetId } of rows) {
|
|
10148
10113
|
const bucket = graph.get(itemId2);
|
|
@@ -10153,14 +10118,14 @@ async function loadDependencyGraph(orm) {
|
|
|
10153
10118
|
}
|
|
10154
10119
|
|
|
10155
10120
|
// src/commands/backlog/validateLinkTarget.ts
|
|
10156
|
-
import
|
|
10121
|
+
import chalk74 from "chalk";
|
|
10157
10122
|
function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
10158
10123
|
const duplicate = (fromItem.links ?? []).some(
|
|
10159
10124
|
(l) => l.targetId === toNum && l.type === linkType
|
|
10160
10125
|
);
|
|
10161
10126
|
if (duplicate) {
|
|
10162
10127
|
console.log(
|
|
10163
|
-
|
|
10128
|
+
chalk74.yellow(
|
|
10164
10129
|
`Link already exists: ${formatItemId(fromNum)} ${linkType} ${formatItemId(toNum)}`
|
|
10165
10130
|
)
|
|
10166
10131
|
);
|
|
@@ -10171,7 +10136,7 @@ function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
|
10171
10136
|
|
|
10172
10137
|
// src/commands/backlog/link.ts
|
|
10173
10138
|
function fail2(message) {
|
|
10174
|
-
console.log(
|
|
10139
|
+
console.log(chalk75.red(message));
|
|
10175
10140
|
return void 0;
|
|
10176
10141
|
}
|
|
10177
10142
|
function parseLinkType(type) {
|
|
@@ -10204,38 +10169,38 @@ async function link(fromId, toId, opts) {
|
|
|
10204
10169
|
if (!validateLinkTarget(fromItem, fromNum, toNum, linkType)) return;
|
|
10205
10170
|
if (await createsCycle(orm, linkType, fromNum, toNum)) return;
|
|
10206
10171
|
await orm.insert(links).values({ itemId: fromNum, type: linkType, targetId: toNum });
|
|
10207
|
-
console.log(
|
|
10172
|
+
console.log(chalk75.green(`Linked ${from} ${linkType} ${to} (${toItem.name})`));
|
|
10208
10173
|
}
|
|
10209
10174
|
|
|
10210
10175
|
// src/commands/backlog/unlink.ts
|
|
10211
|
-
import
|
|
10212
|
-
import { and as and9, eq as
|
|
10176
|
+
import chalk76 from "chalk";
|
|
10177
|
+
import { and as and9, eq as eq22 } from "drizzle-orm";
|
|
10213
10178
|
async function unlink(fromId, toId) {
|
|
10214
10179
|
const fromNum = parseItemId(fromId);
|
|
10215
10180
|
const toNum = parseItemId(toId);
|
|
10216
10181
|
const { orm } = await getReady();
|
|
10217
10182
|
const fromItem = await loadItem(orm, fromNum);
|
|
10218
10183
|
if (!fromItem) {
|
|
10219
|
-
console.log(
|
|
10184
|
+
console.log(chalk76.red(`Item ${formatItemId(fromNum)} not found.`));
|
|
10220
10185
|
return;
|
|
10221
10186
|
}
|
|
10222
10187
|
if (!fromItem.links || fromItem.links.length === 0) {
|
|
10223
10188
|
console.log(
|
|
10224
|
-
|
|
10189
|
+
chalk76.yellow(`No links found on item ${formatItemId(fromNum)}.`)
|
|
10225
10190
|
);
|
|
10226
10191
|
return;
|
|
10227
10192
|
}
|
|
10228
10193
|
if (!fromItem.links.some((l) => l.targetId === toNum)) {
|
|
10229
10194
|
console.log(
|
|
10230
|
-
|
|
10195
|
+
chalk76.yellow(
|
|
10231
10196
|
`No link from ${formatItemId(fromNum)} to ${formatItemId(toNum)} found.`
|
|
10232
10197
|
)
|
|
10233
10198
|
);
|
|
10234
10199
|
return;
|
|
10235
10200
|
}
|
|
10236
|
-
await orm.delete(links).where(and9(
|
|
10201
|
+
await orm.delete(links).where(and9(eq22(links.itemId, fromNum), eq22(links.targetId, toNum)));
|
|
10237
10202
|
console.log(
|
|
10238
|
-
|
|
10203
|
+
chalk76.green(
|
|
10239
10204
|
`Removed link from ${formatItemId(fromNum)} to ${formatItemId(toNum)}.`
|
|
10240
10205
|
)
|
|
10241
10206
|
);
|
|
@@ -10252,25 +10217,25 @@ function registerLinkCommands(cmd) {
|
|
|
10252
10217
|
}
|
|
10253
10218
|
|
|
10254
10219
|
// src/commands/backlog/move-repo/index.ts
|
|
10255
|
-
import
|
|
10256
|
-
import { eq as
|
|
10220
|
+
import chalk78 from "chalk";
|
|
10221
|
+
import { eq as eq24 } from "drizzle-orm";
|
|
10257
10222
|
|
|
10258
10223
|
// src/commands/backlog/move-repo/confirmMove.ts
|
|
10259
|
-
import
|
|
10224
|
+
import chalk77 from "chalk";
|
|
10260
10225
|
function pluralItems(n) {
|
|
10261
10226
|
return `${n} item${n === 1 ? "" : "s"}`;
|
|
10262
10227
|
}
|
|
10263
10228
|
async function confirmMove(cnt, oldOrigin, newOrigin) {
|
|
10264
10229
|
console.log(
|
|
10265
|
-
`${pluralItems(cnt)}: ${
|
|
10230
|
+
`${pluralItems(cnt)}: ${chalk77.cyan(oldOrigin)} \u2192 ${chalk77.cyan(newOrigin)}`
|
|
10266
10231
|
);
|
|
10267
10232
|
return promptConfirm(`Retag ${pluralItems(cnt)}?`);
|
|
10268
10233
|
}
|
|
10269
10234
|
|
|
10270
10235
|
// src/commands/backlog/move-repo/countByOrigin.ts
|
|
10271
|
-
import { count as count3, eq as
|
|
10236
|
+
import { count as count3, eq as eq23 } from "drizzle-orm";
|
|
10272
10237
|
async function countByOrigin(orm, origin) {
|
|
10273
|
-
const [{ cnt }] = await orm.select({ cnt: count3() }).from(items).where(
|
|
10238
|
+
const [{ cnt }] = await orm.select({ cnt: count3() }).from(items).where(eq23(items.origin, origin));
|
|
10274
10239
|
return cnt;
|
|
10275
10240
|
}
|
|
10276
10241
|
|
|
@@ -10294,7 +10259,7 @@ Pass the full origin.`
|
|
|
10294
10259
|
|
|
10295
10260
|
// src/commands/backlog/move-repo/index.ts
|
|
10296
10261
|
function fail3(message) {
|
|
10297
|
-
console.log(
|
|
10262
|
+
console.log(chalk78.red(message));
|
|
10298
10263
|
process.exitCode = 1;
|
|
10299
10264
|
}
|
|
10300
10265
|
async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
@@ -10310,12 +10275,12 @@ async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
|
10310
10275
|
}
|
|
10311
10276
|
const cnt = await countByOrigin(orm, oldOrigin);
|
|
10312
10277
|
if (!options2.yes && !await confirmMove(cnt, oldOrigin, newOrigin)) {
|
|
10313
|
-
console.log(
|
|
10278
|
+
console.log(chalk78.yellow("Move cancelled; no changes made."));
|
|
10314
10279
|
return;
|
|
10315
10280
|
}
|
|
10316
|
-
await orm.update(items).set({ origin: newOrigin }).where(
|
|
10281
|
+
await orm.update(items).set({ origin: newOrigin }).where(eq24(items.origin, oldOrigin));
|
|
10317
10282
|
console.log(
|
|
10318
|
-
|
|
10283
|
+
chalk78.green(
|
|
10319
10284
|
`Moved ${pluralItems(cnt)} from "${oldOrigin}" to "${newOrigin}".`
|
|
10320
10285
|
)
|
|
10321
10286
|
);
|
|
@@ -10344,7 +10309,7 @@ function registerPlanCommands(cmd) {
|
|
|
10344
10309
|
}
|
|
10345
10310
|
|
|
10346
10311
|
// src/commands/backlog/refine.ts
|
|
10347
|
-
import
|
|
10312
|
+
import chalk81 from "chalk";
|
|
10348
10313
|
import enquirer7 from "enquirer";
|
|
10349
10314
|
|
|
10350
10315
|
// src/commands/backlog/launchMode.ts
|
|
@@ -10378,7 +10343,7 @@ function spawnHarness(harness, prompt, options2 = {}) {
|
|
|
10378
10343
|
}
|
|
10379
10344
|
|
|
10380
10345
|
// src/commands/backlog/handleLaunchSignal.ts
|
|
10381
|
-
import
|
|
10346
|
+
import chalk80 from "chalk";
|
|
10382
10347
|
|
|
10383
10348
|
// src/commands/backlog/surfaceCreatedItem.ts
|
|
10384
10349
|
async function surfaceCreatedItem(slashCommand, id) {
|
|
@@ -10401,32 +10366,32 @@ async function surfaceCreatedItem(slashCommand, id) {
|
|
|
10401
10366
|
}
|
|
10402
10367
|
|
|
10403
10368
|
// src/commands/backlog/tryRunById.ts
|
|
10404
|
-
import
|
|
10369
|
+
import chalk79 from "chalk";
|
|
10405
10370
|
async function tryRunById(id, options2) {
|
|
10406
10371
|
const numericId = parseItemId(id);
|
|
10407
10372
|
const label2 = formatItemId(numericId);
|
|
10408
10373
|
const { orm } = await getReady();
|
|
10409
10374
|
const item = await loadItem(orm, numericId);
|
|
10410
10375
|
if (!item) {
|
|
10411
|
-
console.log(
|
|
10376
|
+
console.log(chalk79.red(`Item ${label2} not found.`));
|
|
10412
10377
|
return false;
|
|
10413
10378
|
}
|
|
10414
10379
|
if (item.status === "done") {
|
|
10415
|
-
console.log(
|
|
10380
|
+
console.log(chalk79.red(`Item ${label2} is already done.`));
|
|
10416
10381
|
return false;
|
|
10417
10382
|
}
|
|
10418
10383
|
if (item.status === "wontdo") {
|
|
10419
|
-
console.log(
|
|
10384
|
+
console.log(chalk79.red(`Item ${label2} is marked won't do.`));
|
|
10420
10385
|
return false;
|
|
10421
10386
|
}
|
|
10422
10387
|
const hasDeps = (item.links ?? []).some((l) => l.type === "depends-on");
|
|
10423
10388
|
if (hasDeps && isBlocked(item, await loadItemSummaries(orm, getOrigin()))) {
|
|
10424
10389
|
console.log(
|
|
10425
|
-
|
|
10390
|
+
chalk79.red(`Item ${label2} is blocked by unresolved dependencies.`)
|
|
10426
10391
|
);
|
|
10427
10392
|
return false;
|
|
10428
10393
|
}
|
|
10429
|
-
console.log(
|
|
10394
|
+
console.log(chalk79.bold(`
|
|
10430
10395
|
Running backlog item ${label2}...
|
|
10431
10396
|
`));
|
|
10432
10397
|
await run2(id, options2);
|
|
@@ -10445,13 +10410,13 @@ async function handleLaunchSignal(slashCommand, once) {
|
|
|
10445
10410
|
if (typeof signal.id === "string" && signal.id) {
|
|
10446
10411
|
if (await tryRunById(signal.id, { allowEdits: true })) return;
|
|
10447
10412
|
}
|
|
10448
|
-
console.log(
|
|
10413
|
+
console.log(chalk80.bold("\nChaining into assist next...\n"));
|
|
10449
10414
|
await next({ allowEdits: true, once });
|
|
10450
10415
|
}
|
|
10451
10416
|
} catch (error) {
|
|
10452
10417
|
const message = error instanceof Error ? error.message : String(error);
|
|
10453
10418
|
console.error(
|
|
10454
|
-
|
|
10419
|
+
chalk80.yellow(
|
|
10455
10420
|
`
|
|
10456
10421
|
Could not complete post-run step (${message}).
|
|
10457
10422
|
This is usually a transient database/network blip \u2014 the work is saved and the session is safe to resume.`
|
|
@@ -10498,13 +10463,13 @@ async function pickItemForRefine() {
|
|
|
10498
10463
|
(i) => i.status === "todo" || i.status === "in-progress"
|
|
10499
10464
|
);
|
|
10500
10465
|
if (active.length === 0) {
|
|
10501
|
-
console.log(
|
|
10466
|
+
console.log(chalk81.yellow("No active backlog items to refine."));
|
|
10502
10467
|
return void 0;
|
|
10503
10468
|
}
|
|
10504
10469
|
if (active.length === 1) {
|
|
10505
10470
|
const item = active[0];
|
|
10506
10471
|
console.log(
|
|
10507
|
-
|
|
10472
|
+
chalk81.bold(`Auto-selecting item ${formatItemId(item.id)}: ${item.name}`)
|
|
10508
10473
|
);
|
|
10509
10474
|
return formatItemId(item.id);
|
|
10510
10475
|
}
|
|
@@ -10552,7 +10517,7 @@ function registerRefineCommand(cmd) {
|
|
|
10552
10517
|
}
|
|
10553
10518
|
|
|
10554
10519
|
// src/commands/backlog/rewindPhase.ts
|
|
10555
|
-
import
|
|
10520
|
+
import chalk82 from "chalk";
|
|
10556
10521
|
async function rewindPhase(id, phase, opts) {
|
|
10557
10522
|
const phaseNumber = Number.parseInt(phase, 10);
|
|
10558
10523
|
const found = await findOneItem(id);
|
|
@@ -10560,12 +10525,12 @@ async function rewindPhase(id, phase, opts) {
|
|
|
10560
10525
|
const { orm, item } = found;
|
|
10561
10526
|
const result = await rewindItemToPhase(orm, item, phaseNumber, opts.reason);
|
|
10562
10527
|
if (!result.ok) {
|
|
10563
|
-
console.log(
|
|
10528
|
+
console.log(chalk82.red(result.error));
|
|
10564
10529
|
process.exitCode = 1;
|
|
10565
10530
|
return;
|
|
10566
10531
|
}
|
|
10567
10532
|
console.log(
|
|
10568
|
-
|
|
10533
|
+
chalk82.green(
|
|
10569
10534
|
`Rewound item ${formatItemId(item.id)} to phase ${phaseNumber} (${result.phaseName}).`
|
|
10570
10535
|
)
|
|
10571
10536
|
);
|
|
@@ -10593,22 +10558,22 @@ function registerRunCommand(cmd) {
|
|
|
10593
10558
|
}
|
|
10594
10559
|
|
|
10595
10560
|
// src/commands/backlog/search/index.ts
|
|
10596
|
-
import
|
|
10561
|
+
import chalk83 from "chalk";
|
|
10597
10562
|
async function search(query) {
|
|
10598
10563
|
const items2 = await searchBacklog(query);
|
|
10599
10564
|
if (items2.length === 0) {
|
|
10600
|
-
console.log(
|
|
10565
|
+
console.log(chalk83.dim(`No items matching "${query}".`));
|
|
10601
10566
|
return;
|
|
10602
10567
|
}
|
|
10603
10568
|
console.log(
|
|
10604
|
-
|
|
10569
|
+
chalk83.dim(
|
|
10605
10570
|
`${items2.length} item${items2.length === 1 ? "" : "s"} matching "${query}":
|
|
10606
10571
|
`
|
|
10607
10572
|
)
|
|
10608
10573
|
);
|
|
10609
10574
|
for (const item of items2) {
|
|
10610
10575
|
console.log(
|
|
10611
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
10576
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk83.dim(formatItemId(item.id))} ${item.name}`
|
|
10612
10577
|
);
|
|
10613
10578
|
}
|
|
10614
10579
|
}
|
|
@@ -10619,18 +10584,18 @@ function registerSearchCommand(cmd) {
|
|
|
10619
10584
|
}
|
|
10620
10585
|
|
|
10621
10586
|
// src/commands/backlog/delete/index.ts
|
|
10622
|
-
import
|
|
10587
|
+
import chalk84 from "chalk";
|
|
10623
10588
|
async function del(id) {
|
|
10624
10589
|
const name = await removeItem(id);
|
|
10625
10590
|
if (name) {
|
|
10626
10591
|
console.log(
|
|
10627
|
-
|
|
10592
|
+
chalk84.green(`Deleted item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
10628
10593
|
);
|
|
10629
10594
|
}
|
|
10630
10595
|
}
|
|
10631
10596
|
|
|
10632
10597
|
// src/commands/backlog/done/index.ts
|
|
10633
|
-
import
|
|
10598
|
+
import chalk85 from "chalk";
|
|
10634
10599
|
async function done(id, summary) {
|
|
10635
10600
|
const found = await findOneItem(id);
|
|
10636
10601
|
if (!found) return;
|
|
@@ -10644,12 +10609,12 @@ async function done(id, summary) {
|
|
|
10644
10609
|
const pending = item.plan.slice(completedCount);
|
|
10645
10610
|
if (pending.length > 0) {
|
|
10646
10611
|
console.log(
|
|
10647
|
-
|
|
10612
|
+
chalk85.red(
|
|
10648
10613
|
`Cannot complete item ${formatItemId(item.id)}: ${pending.length} pending phase(s):`
|
|
10649
10614
|
)
|
|
10650
10615
|
);
|
|
10651
10616
|
for (const phase of pending) {
|
|
10652
|
-
console.log(
|
|
10617
|
+
console.log(chalk85.yellow(` - ${phase.name}`));
|
|
10653
10618
|
}
|
|
10654
10619
|
process.exitCode = 1;
|
|
10655
10620
|
return;
|
|
@@ -10661,12 +10626,12 @@ async function done(id, summary) {
|
|
|
10661
10626
|
await appendComment(orm, item.id, summary, { phase, type: "summary" });
|
|
10662
10627
|
}
|
|
10663
10628
|
console.log(
|
|
10664
|
-
|
|
10629
|
+
chalk85.green(`Completed item ${formatItemId(item.id)}: ${item.name}`)
|
|
10665
10630
|
);
|
|
10666
10631
|
}
|
|
10667
10632
|
|
|
10668
10633
|
// src/commands/backlog/set-status/index.ts
|
|
10669
|
-
import
|
|
10634
|
+
import chalk86 from "chalk";
|
|
10670
10635
|
var allowedStatuses = [
|
|
10671
10636
|
"todo",
|
|
10672
10637
|
"in-progress",
|
|
@@ -10676,7 +10641,7 @@ var allowedStatuses = [
|
|
|
10676
10641
|
async function setStatusCommand(id, status3) {
|
|
10677
10642
|
if (!allowedStatuses.includes(status3)) {
|
|
10678
10643
|
console.log(
|
|
10679
|
-
|
|
10644
|
+
chalk86.red(
|
|
10680
10645
|
`Invalid status "${status3}". Must be one of: ${allowedStatuses.join(", ")}.`
|
|
10681
10646
|
)
|
|
10682
10647
|
);
|
|
@@ -10686,7 +10651,7 @@ async function setStatusCommand(id, status3) {
|
|
|
10686
10651
|
const name = await setStatus(id, status3);
|
|
10687
10652
|
if (name) {
|
|
10688
10653
|
console.log(
|
|
10689
|
-
|
|
10654
|
+
chalk86.green(
|
|
10690
10655
|
`Set item ${formatItemId(parseItemId(id))} to ${status3}: ${name}`
|
|
10691
10656
|
)
|
|
10692
10657
|
);
|
|
@@ -10694,16 +10659,16 @@ async function setStatusCommand(id, status3) {
|
|
|
10694
10659
|
}
|
|
10695
10660
|
|
|
10696
10661
|
// src/commands/backlog/star/index.ts
|
|
10697
|
-
import
|
|
10662
|
+
import chalk88 from "chalk";
|
|
10698
10663
|
|
|
10699
10664
|
// src/commands/backlog/setStarred.ts
|
|
10700
|
-
import
|
|
10665
|
+
import chalk87 from "chalk";
|
|
10701
10666
|
async function setStarred(id, starred) {
|
|
10702
10667
|
const { orm } = await getReady();
|
|
10703
10668
|
const numId = parseItemId(id);
|
|
10704
10669
|
const name = await updateStarred(orm, numId, starred);
|
|
10705
10670
|
if (name === void 0)
|
|
10706
|
-
console.log(
|
|
10671
|
+
console.log(chalk87.red(`Item ${formatItemId(numId)} not found.`));
|
|
10707
10672
|
return name;
|
|
10708
10673
|
}
|
|
10709
10674
|
|
|
@@ -10712,52 +10677,52 @@ async function star(id) {
|
|
|
10712
10677
|
const name = await setStarred(id, true);
|
|
10713
10678
|
if (name) {
|
|
10714
10679
|
console.log(
|
|
10715
|
-
|
|
10680
|
+
chalk88.green(`Starred item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
10716
10681
|
);
|
|
10717
10682
|
}
|
|
10718
10683
|
}
|
|
10719
10684
|
|
|
10720
10685
|
// src/commands/backlog/start/index.ts
|
|
10721
|
-
import
|
|
10686
|
+
import chalk89 from "chalk";
|
|
10722
10687
|
async function start(id) {
|
|
10723
10688
|
const name = await setStatus(id, "in-progress");
|
|
10724
10689
|
if (name) {
|
|
10725
10690
|
console.log(
|
|
10726
|
-
|
|
10691
|
+
chalk89.green(`Started item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
10727
10692
|
);
|
|
10728
10693
|
}
|
|
10729
10694
|
}
|
|
10730
10695
|
|
|
10731
10696
|
// src/commands/backlog/stop/index.ts
|
|
10732
|
-
import
|
|
10733
|
-
import { and as and10, eq as
|
|
10697
|
+
import chalk90 from "chalk";
|
|
10698
|
+
import { and as and10, eq as eq25 } from "drizzle-orm";
|
|
10734
10699
|
async function stop() {
|
|
10735
10700
|
const { orm } = await getReady();
|
|
10736
|
-
const stopped = await orm.update(items).set({ status: "todo", currentPhase: 1 }).where(and10(
|
|
10701
|
+
const stopped = await orm.update(items).set({ status: "todo", currentPhase: 1 }).where(and10(eq25(items.status, "in-progress"), eq25(items.origin, getOrigin()))).returning({ id: items.id, name: items.name });
|
|
10737
10702
|
if (stopped.length === 0) {
|
|
10738
|
-
console.log(
|
|
10703
|
+
console.log(chalk90.yellow("No in-progress items to stop."));
|
|
10739
10704
|
return;
|
|
10740
10705
|
}
|
|
10741
10706
|
for (const item of stopped) {
|
|
10742
10707
|
console.log(
|
|
10743
|
-
|
|
10708
|
+
chalk90.yellow(`Stopped item ${formatItemId(item.id)}: ${item.name}`)
|
|
10744
10709
|
);
|
|
10745
10710
|
}
|
|
10746
10711
|
}
|
|
10747
10712
|
|
|
10748
10713
|
// src/commands/backlog/unstar/index.ts
|
|
10749
|
-
import
|
|
10714
|
+
import chalk91 from "chalk";
|
|
10750
10715
|
async function unstar(id) {
|
|
10751
10716
|
const name = await setStarred(id, false);
|
|
10752
10717
|
if (name) {
|
|
10753
10718
|
console.log(
|
|
10754
|
-
|
|
10719
|
+
chalk91.green(`Unstarred item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
10755
10720
|
);
|
|
10756
10721
|
}
|
|
10757
10722
|
}
|
|
10758
10723
|
|
|
10759
10724
|
// src/commands/backlog/wontdo/index.ts
|
|
10760
|
-
import
|
|
10725
|
+
import chalk92 from "chalk";
|
|
10761
10726
|
async function wontdo(id, reason) {
|
|
10762
10727
|
const found = await findOneItem(id);
|
|
10763
10728
|
if (!found) return;
|
|
@@ -10768,7 +10733,7 @@ async function wontdo(id, reason) {
|
|
|
10768
10733
|
await appendComment(orm, item.id, reason, { phase, type: "summary" });
|
|
10769
10734
|
}
|
|
10770
10735
|
console.log(
|
|
10771
|
-
|
|
10736
|
+
chalk92.red(`Won't do item ${formatItemId(item.id)}: ${item.name}`)
|
|
10772
10737
|
);
|
|
10773
10738
|
}
|
|
10774
10739
|
|
|
@@ -10787,17 +10752,17 @@ function registerStatusCommands(cmd) {
|
|
|
10787
10752
|
}
|
|
10788
10753
|
|
|
10789
10754
|
// src/commands/backlog/addSubtask.ts
|
|
10790
|
-
import
|
|
10755
|
+
import chalk93 from "chalk";
|
|
10791
10756
|
async function addSubtask(id, options2) {
|
|
10792
10757
|
const title = options2.title?.trim();
|
|
10793
10758
|
if (!title) {
|
|
10794
|
-
console.log(
|
|
10759
|
+
console.log(chalk93.red("A sub-task title is required (--title)."));
|
|
10795
10760
|
process.exitCode = 1;
|
|
10796
10761
|
return;
|
|
10797
10762
|
}
|
|
10798
10763
|
if (title.length > 50) {
|
|
10799
10764
|
console.log(
|
|
10800
|
-
|
|
10765
|
+
chalk93.red(
|
|
10801
10766
|
"A sub-task title must be 50 characters or fewer. Use --desc for longer detail."
|
|
10802
10767
|
)
|
|
10803
10768
|
);
|
|
@@ -10813,21 +10778,21 @@ async function addSubtask(id, options2) {
|
|
|
10813
10778
|
const description = options2.desc?.replaceAll(String.raw`\n`, "\n");
|
|
10814
10779
|
await insertSubtask(orm, item.id, title, description);
|
|
10815
10780
|
console.log(
|
|
10816
|
-
|
|
10781
|
+
chalk93.green(`Added sub-task to item ${formatItemId(item.id)}: ${title}`)
|
|
10817
10782
|
);
|
|
10818
10783
|
}
|
|
10819
10784
|
|
|
10820
10785
|
// src/commands/backlog/editSubtask.ts
|
|
10821
|
-
import
|
|
10786
|
+
import chalk95 from "chalk";
|
|
10822
10787
|
|
|
10823
10788
|
// src/commands/backlog/resolveSubtaskIndex.ts
|
|
10824
|
-
import
|
|
10789
|
+
import chalk94 from "chalk";
|
|
10825
10790
|
function resolveSubtaskIndex(index3, item) {
|
|
10826
10791
|
const position = Number.parseInt(index3, 10);
|
|
10827
10792
|
const subtasks = item.subtasks ?? [];
|
|
10828
10793
|
if (Number.isNaN(position) || position < 1 || position > subtasks.length) {
|
|
10829
10794
|
console.log(
|
|
10830
|
-
|
|
10795
|
+
chalk94.red(
|
|
10831
10796
|
`Item ${formatItemId(item.id)} has no sub-task ${index3}${subtasks.length > 0 ? ` (1-${subtasks.length})` : ""}.`
|
|
10832
10797
|
)
|
|
10833
10798
|
);
|
|
@@ -10850,13 +10815,13 @@ async function findSubtask(id, index3) {
|
|
|
10850
10815
|
}
|
|
10851
10816
|
|
|
10852
10817
|
// src/commands/backlog/updateSubtask.ts
|
|
10853
|
-
import { and as and11, eq as
|
|
10818
|
+
import { and as and11, eq as eq26 } from "drizzle-orm";
|
|
10854
10819
|
async function updateSubtask(orm, itemId2, idx, fields) {
|
|
10855
10820
|
const set = {};
|
|
10856
10821
|
if (fields.title !== void 0) set.title = fields.title;
|
|
10857
10822
|
if (fields.description !== void 0) set.description = fields.description;
|
|
10858
10823
|
if (fields.status !== void 0) set.status = fields.status;
|
|
10859
|
-
const [row] = await orm.update(itemSubtasks).set(set).where(and11(
|
|
10824
|
+
const [row] = await orm.update(itemSubtasks).set(set).where(and11(eq26(itemSubtasks.itemId, itemId2), eq26(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
|
|
10860
10825
|
return row?.title;
|
|
10861
10826
|
}
|
|
10862
10827
|
|
|
@@ -10894,33 +10859,33 @@ async function editSubtask(id, index3, options2) {
|
|
|
10894
10859
|
if (!found) return;
|
|
10895
10860
|
const fields = buildUpdate(options2);
|
|
10896
10861
|
if (typeof fields === "string") {
|
|
10897
|
-
console.log(
|
|
10862
|
+
console.log(chalk95.red(fields));
|
|
10898
10863
|
process.exitCode = 1;
|
|
10899
10864
|
return;
|
|
10900
10865
|
}
|
|
10901
10866
|
const { orm, item, idx } = found;
|
|
10902
10867
|
const title = await updateSubtask(orm, item.id, idx, fields);
|
|
10903
10868
|
console.log(
|
|
10904
|
-
|
|
10869
|
+
chalk95.green(
|
|
10905
10870
|
`Updated sub-task ${idx + 1} of item ${formatItemId(item.id)}: ${title}`
|
|
10906
10871
|
)
|
|
10907
10872
|
);
|
|
10908
10873
|
}
|
|
10909
10874
|
|
|
10910
10875
|
// src/commands/backlog/removeSubtask.ts
|
|
10911
|
-
import
|
|
10876
|
+
import chalk96 from "chalk";
|
|
10912
10877
|
|
|
10913
10878
|
// src/commands/backlog/deleteSubtask.ts
|
|
10914
|
-
import { and as and12, asc as asc6, eq as
|
|
10879
|
+
import { and as and12, asc as asc6, eq as eq27 } from "drizzle-orm";
|
|
10915
10880
|
async function deleteSubtask(orm, itemId2, idx) {
|
|
10916
|
-
const [row] = await orm.delete(itemSubtasks).where(and12(
|
|
10881
|
+
const [row] = await orm.delete(itemSubtasks).where(and12(eq27(itemSubtasks.itemId, itemId2), eq27(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
|
|
10917
10882
|
if (!row) return void 0;
|
|
10918
|
-
const remaining = await orm.select({ idx: itemSubtasks.idx }).from(itemSubtasks).where(
|
|
10883
|
+
const remaining = await orm.select({ idx: itemSubtasks.idx }).from(itemSubtasks).where(eq27(itemSubtasks.itemId, itemId2)).orderBy(asc6(itemSubtasks.idx));
|
|
10919
10884
|
for (let i = 0; i < remaining.length; i++) {
|
|
10920
10885
|
const oldIdx = remaining[i].idx;
|
|
10921
10886
|
if (oldIdx === i) continue;
|
|
10922
10887
|
await orm.update(itemSubtasks).set({ idx: i }).where(
|
|
10923
|
-
and12(
|
|
10888
|
+
and12(eq27(itemSubtasks.itemId, itemId2), eq27(itemSubtasks.idx, oldIdx))
|
|
10924
10889
|
);
|
|
10925
10890
|
}
|
|
10926
10891
|
return row.title;
|
|
@@ -10933,18 +10898,18 @@ async function removeSubtask(id, index3) {
|
|
|
10933
10898
|
const { orm, item, idx } = found;
|
|
10934
10899
|
const title = await deleteSubtask(orm, item.id, idx);
|
|
10935
10900
|
console.log(
|
|
10936
|
-
|
|
10901
|
+
chalk96.green(
|
|
10937
10902
|
`Removed sub-task ${idx + 1} of item ${formatItemId(item.id)}: ${title}`
|
|
10938
10903
|
)
|
|
10939
10904
|
);
|
|
10940
10905
|
}
|
|
10941
10906
|
|
|
10942
10907
|
// src/commands/backlog/subtaskStatus.ts
|
|
10943
|
-
import
|
|
10908
|
+
import chalk97 from "chalk";
|
|
10944
10909
|
async function subtaskStatus(id, index3, status3) {
|
|
10945
10910
|
if (!validSubtaskStatuses.includes(status3)) {
|
|
10946
10911
|
console.log(
|
|
10947
|
-
|
|
10912
|
+
chalk97.red(
|
|
10948
10913
|
`Invalid status "${status3}". Use one of: ${validSubtaskStatuses.join(", ")}.`
|
|
10949
10914
|
)
|
|
10950
10915
|
);
|
|
@@ -10961,7 +10926,7 @@ async function subtaskStatus(id, index3, status3) {
|
|
|
10961
10926
|
status3
|
|
10962
10927
|
);
|
|
10963
10928
|
console.log(
|
|
10964
|
-
|
|
10929
|
+
chalk97.green(
|
|
10965
10930
|
`Set sub-task ${idx + 1} of item ${formatItemId(item.id)} to ${status3}: ${title}`
|
|
10966
10931
|
)
|
|
10967
10932
|
);
|
|
@@ -10988,21 +10953,21 @@ function registerSubtaskCommands(cmd) {
|
|
|
10988
10953
|
}
|
|
10989
10954
|
|
|
10990
10955
|
// src/commands/backlog/movePhase.ts
|
|
10991
|
-
import
|
|
10992
|
-
import { count as count5, eq as
|
|
10956
|
+
import chalk98 from "chalk";
|
|
10957
|
+
import { count as count5, eq as eq30 } from "drizzle-orm";
|
|
10993
10958
|
|
|
10994
10959
|
// src/commands/backlog/reorderPhaseRows.ts
|
|
10995
|
-
import { and as and14, asc as asc8, eq as
|
|
10960
|
+
import { and as and14, asc as asc8, eq as eq29 } from "drizzle-orm";
|
|
10996
10961
|
|
|
10997
10962
|
// src/commands/backlog/reindexPhases.ts
|
|
10998
|
-
import { and as and13, asc as asc7, count as count4, eq as
|
|
10963
|
+
import { and as and13, asc as asc7, count as count4, eq as eq28 } from "drizzle-orm";
|
|
10999
10964
|
async function reindexPhases(db, itemId2) {
|
|
11000
|
-
const remaining = await db.select({ idx: planPhases.idx }).from(planPhases).where(
|
|
10965
|
+
const remaining = await db.select({ idx: planPhases.idx }).from(planPhases).where(eq28(planPhases.itemId, itemId2)).orderBy(asc7(planPhases.idx));
|
|
11001
10966
|
for (let i = 0; i < remaining.length; i++) {
|
|
11002
10967
|
const oldIdx = remaining[i].idx;
|
|
11003
10968
|
if (oldIdx === i) continue;
|
|
11004
|
-
await db.update(planTasks).set({ phaseIdx: i }).where(and13(
|
|
11005
|
-
await db.update(planPhases).set({ idx: i }).where(and13(
|
|
10969
|
+
await db.update(planTasks).set({ phaseIdx: i }).where(and13(eq28(planTasks.itemId, itemId2), eq28(planTasks.phaseIdx, oldIdx)));
|
|
10970
|
+
await db.update(planPhases).set({ idx: i }).where(and13(eq28(planPhases.itemId, itemId2), eq28(planPhases.idx, oldIdx)));
|
|
11006
10971
|
}
|
|
11007
10972
|
}
|
|
11008
10973
|
async function adjustCurrentPhase(db, item, removedIdx) {
|
|
@@ -11010,24 +10975,24 @@ async function adjustCurrentPhase(db, item, removedIdx) {
|
|
|
11010
10975
|
if (currentPhase === void 0) return;
|
|
11011
10976
|
const currentIdx = currentPhase - 1;
|
|
11012
10977
|
if (removedIdx < currentIdx) {
|
|
11013
|
-
await db.update(items).set({ currentPhase: currentPhase - 1 }).where(
|
|
10978
|
+
await db.update(items).set({ currentPhase: currentPhase - 1 }).where(eq28(items.id, item.id));
|
|
11014
10979
|
return;
|
|
11015
10980
|
}
|
|
11016
10981
|
if (removedIdx !== currentIdx) return;
|
|
11017
|
-
const [row] = await db.select({ cnt: count4() }).from(planPhases).where(
|
|
10982
|
+
const [row] = await db.select({ cnt: count4() }).from(planPhases).where(eq28(planPhases.itemId, item.id));
|
|
11018
10983
|
const cnt = row?.cnt ?? 0;
|
|
11019
|
-
await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(
|
|
10984
|
+
await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(eq28(items.id, item.id));
|
|
11020
10985
|
}
|
|
11021
10986
|
|
|
11022
10987
|
// src/commands/backlog/reorderPhaseRows.ts
|
|
11023
10988
|
async function reorderPhaseRows(orm, itemId2, fromIdx, toIdx) {
|
|
11024
10989
|
await orm.transaction(async (tx) => {
|
|
11025
|
-
const [phaseRow] = await tx.select({ name: planPhases.name, manualChecks: planPhases.manualChecks }).from(planPhases).where(and14(
|
|
11026
|
-
const tasks = await tx.select({ idx: planTasks.idx, task: planTasks.task }).from(planTasks).where(and14(
|
|
10990
|
+
const [phaseRow] = await tx.select({ name: planPhases.name, manualChecks: planPhases.manualChecks }).from(planPhases).where(and14(eq29(planPhases.itemId, itemId2), eq29(planPhases.idx, fromIdx)));
|
|
10991
|
+
const tasks = await tx.select({ idx: planTasks.idx, task: planTasks.task }).from(planTasks).where(and14(eq29(planTasks.itemId, itemId2), eq29(planTasks.phaseIdx, fromIdx))).orderBy(asc8(planTasks.idx));
|
|
11027
10992
|
await tx.delete(planTasks).where(
|
|
11028
|
-
and14(
|
|
10993
|
+
and14(eq29(planTasks.itemId, itemId2), eq29(planTasks.phaseIdx, fromIdx))
|
|
11029
10994
|
);
|
|
11030
|
-
await tx.delete(planPhases).where(and14(
|
|
10995
|
+
await tx.delete(planPhases).where(and14(eq29(planPhases.itemId, itemId2), eq29(planPhases.idx, fromIdx)));
|
|
11031
10996
|
await reindexPhases(tx, itemId2);
|
|
11032
10997
|
await shiftPhasesUp(tx, itemId2, toIdx);
|
|
11033
10998
|
await tx.insert(planPhases).values({
|
|
@@ -11054,7 +11019,7 @@ function toIndex(value, phaseCount) {
|
|
|
11054
11019
|
const pos = Number.parseInt(value, 10);
|
|
11055
11020
|
if (Number.isNaN(pos) || pos < 1 || pos > phaseCount) {
|
|
11056
11021
|
console.log(
|
|
11057
|
-
|
|
11022
|
+
chalk98.red(
|
|
11058
11023
|
`Position "${value}" is out of range. Must be between 1 and ${phaseCount}.`
|
|
11059
11024
|
)
|
|
11060
11025
|
);
|
|
@@ -11068,7 +11033,7 @@ async function movePhase(id, from, to) {
|
|
|
11068
11033
|
if (!found) return;
|
|
11069
11034
|
const { orm, item } = found;
|
|
11070
11035
|
const itemId2 = item.id;
|
|
11071
|
-
const [row] = await orm.select({ cnt: count5() }).from(planPhases).where(
|
|
11036
|
+
const [row] = await orm.select({ cnt: count5() }).from(planPhases).where(eq30(planPhases.itemId, itemId2));
|
|
11072
11037
|
const phaseCount = row?.cnt ?? 0;
|
|
11073
11038
|
const fromIdx = toIndex(from, phaseCount);
|
|
11074
11039
|
if (fromIdx === void 0) return;
|
|
@@ -11077,29 +11042,29 @@ async function movePhase(id, from, to) {
|
|
|
11077
11042
|
if (fromIdx !== toIdx) {
|
|
11078
11043
|
await reorderPhaseRows(orm, itemId2, fromIdx, toIdx);
|
|
11079
11044
|
}
|
|
11080
|
-
console.log(
|
|
11045
|
+
console.log(chalk98.green(`Moved phase ${from} to position ${to}.`));
|
|
11081
11046
|
}
|
|
11082
11047
|
|
|
11083
11048
|
// src/commands/backlog/updatePhase.ts
|
|
11084
|
-
import
|
|
11049
|
+
import chalk100 from "chalk";
|
|
11085
11050
|
|
|
11086
11051
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
11087
|
-
import { and as and15, eq as
|
|
11052
|
+
import { and as and15, eq as eq31 } from "drizzle-orm";
|
|
11088
11053
|
async function applyPhaseUpdate(orm, itemId2, phaseIdx, fields) {
|
|
11089
11054
|
await orm.transaction(async (tx) => {
|
|
11090
11055
|
if (fields.name) {
|
|
11091
11056
|
await tx.update(planPhases).set({ name: fields.name }).where(
|
|
11092
|
-
and15(
|
|
11057
|
+
and15(eq31(planPhases.itemId, itemId2), eq31(planPhases.idx, phaseIdx))
|
|
11093
11058
|
);
|
|
11094
11059
|
}
|
|
11095
11060
|
if (fields.manualCheck) {
|
|
11096
11061
|
await tx.update(planPhases).set({ manualChecks: JSON.stringify(fields.manualCheck) }).where(
|
|
11097
|
-
and15(
|
|
11062
|
+
and15(eq31(planPhases.itemId, itemId2), eq31(planPhases.idx, phaseIdx))
|
|
11098
11063
|
);
|
|
11099
11064
|
}
|
|
11100
11065
|
if (fields.task) {
|
|
11101
11066
|
await tx.delete(planTasks).where(
|
|
11102
|
-
and15(
|
|
11067
|
+
and15(eq31(planTasks.itemId, itemId2), eq31(planTasks.phaseIdx, phaseIdx))
|
|
11103
11068
|
);
|
|
11104
11069
|
if (fields.task.length) {
|
|
11105
11070
|
await tx.insert(planTasks).values(
|
|
@@ -11116,18 +11081,18 @@ async function applyPhaseUpdate(orm, itemId2, phaseIdx, fields) {
|
|
|
11116
11081
|
}
|
|
11117
11082
|
|
|
11118
11083
|
// src/commands/backlog/findPhase.ts
|
|
11119
|
-
import
|
|
11120
|
-
import { and as and16, count as count6, eq as
|
|
11084
|
+
import chalk99 from "chalk";
|
|
11085
|
+
import { and as and16, count as count6, eq as eq32 } from "drizzle-orm";
|
|
11121
11086
|
async function findPhase(id, phase) {
|
|
11122
11087
|
const found = await findOneItem(id);
|
|
11123
11088
|
if (!found) return void 0;
|
|
11124
11089
|
const { orm, item } = found;
|
|
11125
11090
|
const itemId2 = item.id;
|
|
11126
11091
|
const phaseIdx = Number.parseInt(phase, 10) - 1;
|
|
11127
|
-
const [row] = await orm.select({ cnt: count6() }).from(planPhases).where(and16(
|
|
11092
|
+
const [row] = await orm.select({ cnt: count6() }).from(planPhases).where(and16(eq32(planPhases.itemId, itemId2), eq32(planPhases.idx, phaseIdx)));
|
|
11128
11093
|
if (!row || row.cnt === 0) {
|
|
11129
11094
|
console.log(
|
|
11130
|
-
|
|
11095
|
+
chalk99.red(
|
|
11131
11096
|
`Phase ${phaseIdx + 1} not found on item ${formatItemId(itemId2)}.`
|
|
11132
11097
|
)
|
|
11133
11098
|
);
|
|
@@ -11261,7 +11226,7 @@ async function updatePhase(id, phase, options2) {
|
|
|
11261
11226
|
const { item, orm, itemId: itemId2, phaseIdx } = found;
|
|
11262
11227
|
const resolved = resolvePhaseFields(options2, item.plan?.[phaseIdx]);
|
|
11263
11228
|
if (!resolved.ok) {
|
|
11264
|
-
console.log(
|
|
11229
|
+
console.log(chalk100.red(resolved.error));
|
|
11265
11230
|
process.exitCode = 1;
|
|
11266
11231
|
return;
|
|
11267
11232
|
}
|
|
@@ -11273,7 +11238,7 @@ async function updatePhase(id, phase, options2) {
|
|
|
11273
11238
|
manualCheck && "manual checks"
|
|
11274
11239
|
].filter(Boolean).join(", ");
|
|
11275
11240
|
console.log(
|
|
11276
|
-
|
|
11241
|
+
chalk100.green(
|
|
11277
11242
|
`Updated ${fields} on phase ${phaseIdx + 1} of item ${formatItemId(itemId2)}.`
|
|
11278
11243
|
)
|
|
11279
11244
|
);
|
|
@@ -11296,30 +11261,30 @@ function registerUpdatePhaseCommand(cmd) {
|
|
|
11296
11261
|
}
|
|
11297
11262
|
|
|
11298
11263
|
// src/commands/backlog/removePhase.ts
|
|
11299
|
-
import
|
|
11300
|
-
import { and as and17, eq as
|
|
11264
|
+
import chalk101 from "chalk";
|
|
11265
|
+
import { and as and17, eq as eq33 } from "drizzle-orm";
|
|
11301
11266
|
async function removePhase(id, phase) {
|
|
11302
11267
|
const found = await findPhase(id, phase);
|
|
11303
11268
|
if (!found) return;
|
|
11304
11269
|
const { item, orm, itemId: itemId2, phaseIdx } = found;
|
|
11305
11270
|
await orm.transaction(async (tx) => {
|
|
11306
11271
|
await tx.delete(planTasks).where(
|
|
11307
|
-
and17(
|
|
11272
|
+
and17(eq33(planTasks.itemId, itemId2), eq33(planTasks.phaseIdx, phaseIdx))
|
|
11308
11273
|
);
|
|
11309
|
-
await tx.delete(planPhases).where(and17(
|
|
11274
|
+
await tx.delete(planPhases).where(and17(eq33(planPhases.itemId, itemId2), eq33(planPhases.idx, phaseIdx)));
|
|
11310
11275
|
await reindexPhases(tx, itemId2);
|
|
11311
11276
|
await adjustCurrentPhase(tx, item, phaseIdx);
|
|
11312
11277
|
});
|
|
11313
11278
|
console.log(
|
|
11314
|
-
|
|
11279
|
+
chalk101.green(
|
|
11315
11280
|
`Removed phase ${phaseIdx + 1} from item ${formatItemId(itemId2)}.`
|
|
11316
11281
|
)
|
|
11317
11282
|
);
|
|
11318
11283
|
}
|
|
11319
11284
|
|
|
11320
11285
|
// src/commands/backlog/update/index.ts
|
|
11321
|
-
import
|
|
11322
|
-
import { eq as
|
|
11286
|
+
import chalk103 from "chalk";
|
|
11287
|
+
import { eq as eq34 } from "drizzle-orm";
|
|
11323
11288
|
|
|
11324
11289
|
// src/commands/backlog/update/applyAcMutations.ts
|
|
11325
11290
|
function hasAcMutations(options2) {
|
|
@@ -11340,16 +11305,16 @@ function applyAcMutations(current, options2) {
|
|
|
11340
11305
|
}
|
|
11341
11306
|
|
|
11342
11307
|
// src/commands/backlog/update/buildUpdateValues.ts
|
|
11343
|
-
import
|
|
11308
|
+
import chalk102 from "chalk";
|
|
11344
11309
|
function buildUpdateValues(options2) {
|
|
11345
11310
|
const { name, desc: desc6, type, ac } = options2;
|
|
11346
11311
|
if (!name && !desc6 && !type && !ac) {
|
|
11347
|
-
console.log(
|
|
11312
|
+
console.log(chalk102.red("Nothing to update. Provide at least one flag."));
|
|
11348
11313
|
process.exitCode = 1;
|
|
11349
11314
|
return void 0;
|
|
11350
11315
|
}
|
|
11351
11316
|
if (type && type !== "story" && type !== "bug") {
|
|
11352
|
-
console.log(
|
|
11317
|
+
console.log(chalk102.red('Invalid type. Must be "story" or "bug".'));
|
|
11353
11318
|
process.exitCode = 1;
|
|
11354
11319
|
return void 0;
|
|
11355
11320
|
}
|
|
@@ -11382,14 +11347,14 @@ async function update(id, options2) {
|
|
|
11382
11347
|
if (hasAcMutations(options2)) {
|
|
11383
11348
|
if (options2.ac) {
|
|
11384
11349
|
console.log(
|
|
11385
|
-
|
|
11350
|
+
chalk103.red("Cannot combine --ac with --add-ac/--edit-ac/--remove-ac.")
|
|
11386
11351
|
);
|
|
11387
11352
|
process.exitCode = 1;
|
|
11388
11353
|
return;
|
|
11389
11354
|
}
|
|
11390
11355
|
const mutation = applyAcMutations(found.item.acceptanceCriteria, options2);
|
|
11391
11356
|
if (!mutation.ok) {
|
|
11392
|
-
console.log(
|
|
11357
|
+
console.log(chalk103.red(mutation.error));
|
|
11393
11358
|
process.exitCode = 1;
|
|
11394
11359
|
return;
|
|
11395
11360
|
}
|
|
@@ -11399,9 +11364,9 @@ async function update(id, options2) {
|
|
|
11399
11364
|
if (!built) return;
|
|
11400
11365
|
const { orm } = found;
|
|
11401
11366
|
const itemId2 = found.item.id;
|
|
11402
|
-
await orm.update(items).set(built.set).where(
|
|
11367
|
+
await orm.update(items).set(built.set).where(eq34(items.id, itemId2));
|
|
11403
11368
|
console.log(
|
|
11404
|
-
|
|
11369
|
+
chalk103.green(`Updated ${built.fields} on item ${formatItemId(itemId2)}.`)
|
|
11405
11370
|
);
|
|
11406
11371
|
}
|
|
11407
11372
|
|
|
@@ -12204,11 +12169,11 @@ function assertCliExists(cli) {
|
|
|
12204
12169
|
}
|
|
12205
12170
|
|
|
12206
12171
|
// src/commands/permitCliReads/colorize.ts
|
|
12207
|
-
import
|
|
12172
|
+
import chalk104 from "chalk";
|
|
12208
12173
|
function colorize(plainOutput) {
|
|
12209
12174
|
return plainOutput.split("\n").map((line) => {
|
|
12210
|
-
if (line.startsWith(" R ")) return
|
|
12211
|
-
if (line.startsWith(" W ")) return
|
|
12175
|
+
if (line.startsWith(" R ")) return chalk104.green(line);
|
|
12176
|
+
if (line.startsWith(" W ")) return chalk104.red(line);
|
|
12212
12177
|
return line;
|
|
12213
12178
|
}).join("\n");
|
|
12214
12179
|
}
|
|
@@ -12506,7 +12471,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
12506
12471
|
}
|
|
12507
12472
|
|
|
12508
12473
|
// src/commands/deny/denyAdd.ts
|
|
12509
|
-
import
|
|
12474
|
+
import chalk105 from "chalk";
|
|
12510
12475
|
|
|
12511
12476
|
// src/commands/deny/loadDenyConfig.ts
|
|
12512
12477
|
function loadDenyConfig(global) {
|
|
@@ -12526,16 +12491,16 @@ function loadDenyConfig(global) {
|
|
|
12526
12491
|
function denyAdd(pattern2, message, options2) {
|
|
12527
12492
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
12528
12493
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
12529
|
-
console.log(
|
|
12494
|
+
console.log(chalk105.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
12530
12495
|
return;
|
|
12531
12496
|
}
|
|
12532
12497
|
deny.push({ pattern: pattern2, message });
|
|
12533
12498
|
saveDeny(deny);
|
|
12534
|
-
console.log(
|
|
12499
|
+
console.log(chalk105.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
12535
12500
|
}
|
|
12536
12501
|
|
|
12537
12502
|
// src/commands/deny/denyList.ts
|
|
12538
|
-
import
|
|
12503
|
+
import chalk106 from "chalk";
|
|
12539
12504
|
function denyList() {
|
|
12540
12505
|
const globalRaw = loadGlobalConfigRaw();
|
|
12541
12506
|
const projectRaw = loadProjectConfig();
|
|
@@ -12546,7 +12511,7 @@ function denyList() {
|
|
|
12546
12511
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
12547
12512
|
);
|
|
12548
12513
|
if (!merged || merged.length === 0) {
|
|
12549
|
-
console.log(
|
|
12514
|
+
console.log(chalk106.dim("No deny rules configured."));
|
|
12550
12515
|
return;
|
|
12551
12516
|
}
|
|
12552
12517
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -12554,23 +12519,23 @@ function denyList() {
|
|
|
12554
12519
|
for (const rule of merged) {
|
|
12555
12520
|
const inProject = projectPatterns.has(rule.pattern);
|
|
12556
12521
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
12557
|
-
const label2 = inProject && inGlobal ?
|
|
12558
|
-
console.log(`${
|
|
12522
|
+
const label2 = inProject && inGlobal ? chalk106.dim(" (project, overrides global)") : inGlobal ? chalk106.dim(" (global)") : "";
|
|
12523
|
+
console.log(`${chalk106.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
12559
12524
|
}
|
|
12560
12525
|
}
|
|
12561
12526
|
|
|
12562
12527
|
// src/commands/deny/denyRemove.ts
|
|
12563
|
-
import
|
|
12528
|
+
import chalk107 from "chalk";
|
|
12564
12529
|
function denyRemove(pattern2, options2) {
|
|
12565
12530
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
12566
12531
|
const index3 = deny.findIndex((r) => r.pattern === pattern2);
|
|
12567
12532
|
if (index3 === -1) {
|
|
12568
|
-
console.log(
|
|
12533
|
+
console.log(chalk107.yellow(`No deny rule found for: ${pattern2}`));
|
|
12569
12534
|
return;
|
|
12570
12535
|
}
|
|
12571
12536
|
deny.splice(index3, 1);
|
|
12572
12537
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
12573
|
-
console.log(
|
|
12538
|
+
console.log(chalk107.green(`Removed deny rule: ${pattern2}`));
|
|
12574
12539
|
}
|
|
12575
12540
|
|
|
12576
12541
|
// src/commands/registerDeny.ts
|
|
@@ -12614,7 +12579,7 @@ function registerCliHook(program2) {
|
|
|
12614
12579
|
|
|
12615
12580
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
12616
12581
|
import { existsSync as existsSync31, readFileSync as readFileSync27, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
|
|
12617
|
-
import
|
|
12582
|
+
import chalk108 from "chalk";
|
|
12618
12583
|
|
|
12619
12584
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
12620
12585
|
import { homedir as homedir17 } from "os";
|
|
@@ -12667,12 +12632,12 @@ function codeCommentConfirm(pin) {
|
|
|
12667
12632
|
sweepRestrictedDir();
|
|
12668
12633
|
const state = readPinState(pin);
|
|
12669
12634
|
if (!state) {
|
|
12670
|
-
console.error(
|
|
12635
|
+
console.error(chalk108.red(`No pending comment for pin: ${pin}`));
|
|
12671
12636
|
process.exitCode = 1;
|
|
12672
12637
|
return;
|
|
12673
12638
|
}
|
|
12674
12639
|
if (!existsSync31(state.file)) {
|
|
12675
|
-
console.error(
|
|
12640
|
+
console.error(chalk108.red(`Target file no longer exists: ${state.file}`));
|
|
12676
12641
|
process.exitCode = 1;
|
|
12677
12642
|
return;
|
|
12678
12643
|
}
|
|
@@ -12681,7 +12646,7 @@ function codeCommentConfirm(pin) {
|
|
|
12681
12646
|
const index3 = state.line - 1;
|
|
12682
12647
|
if (index3 > lines.length) {
|
|
12683
12648
|
console.error(
|
|
12684
|
-
|
|
12649
|
+
chalk108.red(
|
|
12685
12650
|
`Line ${state.line} is beyond the end of ${state.file} (${lines.length} lines).`
|
|
12686
12651
|
)
|
|
12687
12652
|
);
|
|
@@ -12695,14 +12660,14 @@ function codeCommentConfirm(pin) {
|
|
|
12695
12660
|
writeFileSync24(state.file, lines.join("\n"));
|
|
12696
12661
|
unlinkSync8(getPinStatePath(pin));
|
|
12697
12662
|
console.log(
|
|
12698
|
-
|
|
12663
|
+
chalk108.green(
|
|
12699
12664
|
`Inserted "${marker} ${state.text}" at ${state.file}:${state.line}`
|
|
12700
12665
|
)
|
|
12701
12666
|
);
|
|
12702
12667
|
}
|
|
12703
12668
|
|
|
12704
12669
|
// src/commands/codeComment/codeCommentSet.ts
|
|
12705
|
-
import
|
|
12670
|
+
import chalk109 from "chalk";
|
|
12706
12671
|
|
|
12707
12672
|
// src/commands/codeComment/validateCommentText.ts
|
|
12708
12673
|
var MAX_COMMENT_LENGTH = 50;
|
|
@@ -12753,7 +12718,7 @@ function generatePin() {
|
|
|
12753
12718
|
function codeCommentSet(file, line, text17) {
|
|
12754
12719
|
const lineNumber = Number.parseInt(line, 10);
|
|
12755
12720
|
if (!Number.isInteger(lineNumber) || lineNumber < 1) {
|
|
12756
|
-
console.error(
|
|
12721
|
+
console.error(chalk109.red(`Invalid line number: ${line}`));
|
|
12757
12722
|
process.exitCode = 1;
|
|
12758
12723
|
return;
|
|
12759
12724
|
}
|
|
@@ -12761,20 +12726,20 @@ function codeCommentSet(file, line, text17) {
|
|
|
12761
12726
|
const marker = hash ? "#" : "//";
|
|
12762
12727
|
const validation = validateCommentText(text17, hash);
|
|
12763
12728
|
if (!validation.ok) {
|
|
12764
|
-
console.error(
|
|
12765
|
-
console.error(
|
|
12729
|
+
console.error(chalk109.red(`Refused: ${validation.reason}`));
|
|
12730
|
+
console.error(chalk109.red("No pin issued."));
|
|
12766
12731
|
process.exitCode = 1;
|
|
12767
12732
|
return;
|
|
12768
12733
|
}
|
|
12769
12734
|
console.error(
|
|
12770
|
-
|
|
12735
|
+
chalk109.yellow.bold(
|
|
12771
12736
|
"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."
|
|
12772
12737
|
)
|
|
12773
12738
|
);
|
|
12774
12739
|
const delivered = issuePin(file, lineNumber, validation.text);
|
|
12775
12740
|
if (!delivered) {
|
|
12776
12741
|
console.error(
|
|
12777
|
-
|
|
12742
|
+
chalk109.red(
|
|
12778
12743
|
"Could not deliver the confirmation pin via notification.\nThe comment cannot be confirmed until the notification channel works."
|
|
12779
12744
|
)
|
|
12780
12745
|
);
|
|
@@ -12784,7 +12749,7 @@ function codeCommentSet(file, line, text17) {
|
|
|
12784
12749
|
console.log(
|
|
12785
12750
|
`A confirmation pin was sent to your desktop notifications.
|
|
12786
12751
|
To insert "${marker} ${validation.text}" at ${file}:${lineNumber}, run:
|
|
12787
|
-
${
|
|
12752
|
+
${chalk109.cyan(" assist code-comment confirm <PIN>")}
|
|
12788
12753
|
using the pin from that notification.`
|
|
12789
12754
|
);
|
|
12790
12755
|
}
|
|
@@ -12863,15 +12828,15 @@ function registerCodexHook(program2) {
|
|
|
12863
12828
|
}
|
|
12864
12829
|
|
|
12865
12830
|
// src/commands/complexity/analyze.ts
|
|
12866
|
-
import
|
|
12831
|
+
import chalk118 from "chalk";
|
|
12867
12832
|
|
|
12868
12833
|
// src/commands/complexity/cyclomatic.ts
|
|
12869
|
-
import
|
|
12834
|
+
import chalk111 from "chalk";
|
|
12870
12835
|
|
|
12871
12836
|
// src/commands/complexity/shared/index.ts
|
|
12872
12837
|
import fs20 from "fs";
|
|
12873
12838
|
import path27 from "path";
|
|
12874
|
-
import
|
|
12839
|
+
import chalk110 from "chalk";
|
|
12875
12840
|
import ts5 from "typescript";
|
|
12876
12841
|
|
|
12877
12842
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -13122,7 +13087,7 @@ function createSourceFromFile(filePath) {
|
|
|
13122
13087
|
function withSourceFiles(pattern2, callback, extraIgnore = []) {
|
|
13123
13088
|
const files = findSourceFiles2(pattern2, ".", extraIgnore);
|
|
13124
13089
|
if (files.length === 0) {
|
|
13125
|
-
console.log(
|
|
13090
|
+
console.log(chalk110.yellow("No files found matching pattern"));
|
|
13126
13091
|
return void 0;
|
|
13127
13092
|
}
|
|
13128
13093
|
return callback(files);
|
|
@@ -13155,11 +13120,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
13155
13120
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
13156
13121
|
for (const { file, name, complexity } of results) {
|
|
13157
13122
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
13158
|
-
const color = exceedsThreshold ?
|
|
13159
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
13123
|
+
const color = exceedsThreshold ? chalk111.red : chalk111.white;
|
|
13124
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk111.cyan(complexity)}`);
|
|
13160
13125
|
}
|
|
13161
13126
|
console.log(
|
|
13162
|
-
|
|
13127
|
+
chalk111.dim(
|
|
13163
13128
|
`
|
|
13164
13129
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
13165
13130
|
)
|
|
@@ -13171,7 +13136,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
13171
13136
|
}
|
|
13172
13137
|
|
|
13173
13138
|
// src/commands/complexity/halstead.ts
|
|
13174
|
-
import
|
|
13139
|
+
import chalk112 from "chalk";
|
|
13175
13140
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
13176
13141
|
withSourceFiles(pattern2, (files) => {
|
|
13177
13142
|
const results = [];
|
|
@@ -13186,13 +13151,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
13186
13151
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
13187
13152
|
for (const { file, name, metrics } of results) {
|
|
13188
13153
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
13189
|
-
const color = exceedsThreshold ?
|
|
13154
|
+
const color = exceedsThreshold ? chalk112.red : chalk112.white;
|
|
13190
13155
|
console.log(
|
|
13191
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
13156
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk112.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk112.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk112.magenta(metrics.effort.toFixed(1))}`
|
|
13192
13157
|
);
|
|
13193
13158
|
}
|
|
13194
13159
|
console.log(
|
|
13195
|
-
|
|
13160
|
+
chalk112.dim(
|
|
13196
13161
|
`
|
|
13197
13162
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
13198
13163
|
)
|
|
@@ -13204,27 +13169,27 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
13204
13169
|
}
|
|
13205
13170
|
|
|
13206
13171
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
13207
|
-
import
|
|
13172
|
+
import chalk115 from "chalk";
|
|
13208
13173
|
|
|
13209
13174
|
// src/commands/complexity/maintainability/formatResultLine.ts
|
|
13210
|
-
import
|
|
13175
|
+
import chalk113 from "chalk";
|
|
13211
13176
|
function formatResultLine(entry, failing) {
|
|
13212
13177
|
const { file, avgMaintainability, minMaintainability, override } = entry;
|
|
13213
|
-
const name = failing ?
|
|
13214
|
-
const suffix = override !== void 0 ?
|
|
13215
|
-
return `${name} \u2192 avg: ${
|
|
13178
|
+
const name = failing ? chalk113.red(file) : chalk113.white(file);
|
|
13179
|
+
const suffix = override !== void 0 ? chalk113.magenta(` (override: ${override})`) : "";
|
|
13180
|
+
return `${name} \u2192 avg: ${chalk113.cyan(avgMaintainability.toFixed(1))}, min: ${chalk113.yellow(minMaintainability.toFixed(1))}${suffix}`;
|
|
13216
13181
|
}
|
|
13217
13182
|
|
|
13218
13183
|
// src/commands/complexity/maintainability/printMaintainabilityFailure.ts
|
|
13219
|
-
import
|
|
13184
|
+
import chalk114 from "chalk";
|
|
13220
13185
|
function printMaintainabilityFailure(failingCount, threshold) {
|
|
13221
13186
|
const thresholdLabel = threshold !== void 0 ? ` ${threshold}` : "";
|
|
13222
13187
|
console.error(
|
|
13223
|
-
|
|
13188
|
+
chalk114.red(
|
|
13224
13189
|
`
|
|
13225
13190
|
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.
|
|
13226
13191
|
|
|
13227
|
-
\u26A0\uFE0F ${
|
|
13192
|
+
\u26A0\uFE0F ${chalk114.bold("Diagnose and fix one file at a time")} \u2014 do not investigate or fix multiple files in parallel.
|
|
13228
13193
|
|
|
13229
13194
|
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.`
|
|
13230
13195
|
)
|
|
@@ -13236,7 +13201,7 @@ function displayMaintainabilityResults(results, threshold) {
|
|
|
13236
13201
|
const gating = threshold !== void 0 || results.some((r) => r.override !== void 0);
|
|
13237
13202
|
if (!gating) {
|
|
13238
13203
|
for (const entry of results) console.log(formatResultLine(entry, false));
|
|
13239
|
-
console.log(
|
|
13204
|
+
console.log(chalk115.dim(`
|
|
13240
13205
|
Analyzed ${results.length} files`));
|
|
13241
13206
|
return;
|
|
13242
13207
|
}
|
|
@@ -13245,7 +13210,7 @@ Analyzed ${results.length} files`));
|
|
|
13245
13210
|
return limit !== void 0 && r.minMaintainability < limit;
|
|
13246
13211
|
});
|
|
13247
13212
|
if (failing.length === 0) {
|
|
13248
|
-
console.log(
|
|
13213
|
+
console.log(chalk115.green("All files pass maintainability threshold"));
|
|
13249
13214
|
} else {
|
|
13250
13215
|
for (const entry of failing) console.log(formatResultLine(entry, true));
|
|
13251
13216
|
}
|
|
@@ -13254,7 +13219,7 @@ Analyzed ${results.length} files`));
|
|
|
13254
13219
|
);
|
|
13255
13220
|
for (const entry of passingOverrides)
|
|
13256
13221
|
console.log(formatResultLine(entry, false));
|
|
13257
|
-
console.log(
|
|
13222
|
+
console.log(chalk115.dim(`
|
|
13258
13223
|
Analyzed ${results.length} files`));
|
|
13259
13224
|
if (failing.length > 0) {
|
|
13260
13225
|
printMaintainabilityFailure(failing.length, threshold);
|
|
@@ -13263,10 +13228,10 @@ Analyzed ${results.length} files`));
|
|
|
13263
13228
|
}
|
|
13264
13229
|
|
|
13265
13230
|
// src/commands/complexity/maintainability/printMaintainabilityFormula.ts
|
|
13266
|
-
import
|
|
13231
|
+
import chalk116 from "chalk";
|
|
13267
13232
|
var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
|
|
13268
13233
|
function printMaintainabilityFormula() {
|
|
13269
|
-
console.log(
|
|
13234
|
+
console.log(chalk116.dim(MI_FORMULA));
|
|
13270
13235
|
}
|
|
13271
13236
|
|
|
13272
13237
|
// src/commands/complexity/maintainability/collectFileMetrics.ts
|
|
@@ -13342,7 +13307,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
13342
13307
|
|
|
13343
13308
|
// src/commands/complexity/sloc.ts
|
|
13344
13309
|
import fs22 from "fs";
|
|
13345
|
-
import
|
|
13310
|
+
import chalk117 from "chalk";
|
|
13346
13311
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
13347
13312
|
withSourceFiles(pattern2, (files) => {
|
|
13348
13313
|
const results = [];
|
|
@@ -13358,12 +13323,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
13358
13323
|
results.sort((a, b) => b.lines - a.lines);
|
|
13359
13324
|
for (const { file, lines } of results) {
|
|
13360
13325
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
13361
|
-
const color = exceedsThreshold ?
|
|
13362
|
-
console.log(`${color(file)} \u2192 ${
|
|
13326
|
+
const color = exceedsThreshold ? chalk117.red : chalk117.white;
|
|
13327
|
+
console.log(`${color(file)} \u2192 ${chalk117.cyan(lines)} lines`);
|
|
13363
13328
|
}
|
|
13364
13329
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
13365
13330
|
console.log(
|
|
13366
|
-
|
|
13331
|
+
chalk117.dim(`
|
|
13367
13332
|
Total: ${total} lines across ${files.length} files`)
|
|
13368
13333
|
);
|
|
13369
13334
|
if (hasViolation) {
|
|
@@ -13377,25 +13342,25 @@ async function analyze(pattern2) {
|
|
|
13377
13342
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
13378
13343
|
const files = findSourceFiles2(searchPattern);
|
|
13379
13344
|
if (files.length === 0) {
|
|
13380
|
-
console.log(
|
|
13345
|
+
console.log(chalk118.yellow("No files found matching pattern"));
|
|
13381
13346
|
return;
|
|
13382
13347
|
}
|
|
13383
13348
|
if (files.length === 1) {
|
|
13384
13349
|
const file = files[0];
|
|
13385
|
-
console.log(
|
|
13350
|
+
console.log(chalk118.bold.underline("SLOC"));
|
|
13386
13351
|
await sloc(file);
|
|
13387
13352
|
console.log();
|
|
13388
|
-
console.log(
|
|
13353
|
+
console.log(chalk118.bold.underline("Cyclomatic Complexity"));
|
|
13389
13354
|
await cyclomatic(file);
|
|
13390
13355
|
console.log();
|
|
13391
|
-
console.log(
|
|
13356
|
+
console.log(chalk118.bold.underline("Halstead Metrics"));
|
|
13392
13357
|
await halstead(file);
|
|
13393
13358
|
console.log();
|
|
13394
|
-
console.log(
|
|
13359
|
+
console.log(chalk118.bold.underline("Maintainability Index"));
|
|
13395
13360
|
await maintainability(file);
|
|
13396
13361
|
console.log();
|
|
13397
13362
|
console.log(
|
|
13398
|
-
|
|
13363
|
+
chalk118.dim(
|
|
13399
13364
|
"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."
|
|
13400
13365
|
)
|
|
13401
13366
|
);
|
|
@@ -13439,7 +13404,7 @@ function registerComplexity(program2) {
|
|
|
13439
13404
|
}
|
|
13440
13405
|
|
|
13441
13406
|
// src/commands/config/index.ts
|
|
13442
|
-
import
|
|
13407
|
+
import chalk119 from "chalk";
|
|
13443
13408
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
13444
13409
|
|
|
13445
13410
|
// src/commands/config/setNestedValue.ts
|
|
@@ -13502,7 +13467,7 @@ function formatIssuePath(issue, key) {
|
|
|
13502
13467
|
function printValidationErrors(issues, key) {
|
|
13503
13468
|
for (const issue of issues) {
|
|
13504
13469
|
console.error(
|
|
13505
|
-
|
|
13470
|
+
chalk119.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
13506
13471
|
);
|
|
13507
13472
|
}
|
|
13508
13473
|
}
|
|
@@ -13519,7 +13484,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
13519
13484
|
function assertNotGlobalOnly(key, global) {
|
|
13520
13485
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
13521
13486
|
console.error(
|
|
13522
|
-
|
|
13487
|
+
chalk119.red(
|
|
13523
13488
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
13524
13489
|
)
|
|
13525
13490
|
);
|
|
@@ -13542,7 +13507,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
13542
13507
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
13543
13508
|
const target = options2.global ? "global" : "project";
|
|
13544
13509
|
console.log(
|
|
13545
|
-
|
|
13510
|
+
chalk119.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
13546
13511
|
);
|
|
13547
13512
|
}
|
|
13548
13513
|
function configList() {
|
|
@@ -13551,7 +13516,7 @@ function configList() {
|
|
|
13551
13516
|
}
|
|
13552
13517
|
|
|
13553
13518
|
// src/commands/config/configGet.ts
|
|
13554
|
-
import
|
|
13519
|
+
import chalk120 from "chalk";
|
|
13555
13520
|
|
|
13556
13521
|
// src/commands/config/getNestedValue.ts
|
|
13557
13522
|
function isTraversable(value) {
|
|
@@ -13583,7 +13548,7 @@ function requireNestedValue(config, key) {
|
|
|
13583
13548
|
return value;
|
|
13584
13549
|
}
|
|
13585
13550
|
function exitKeyNotSet(key) {
|
|
13586
|
-
console.error(
|
|
13551
|
+
console.error(chalk120.red(`Key "${key}" is not set`));
|
|
13587
13552
|
process.exit(1);
|
|
13588
13553
|
}
|
|
13589
13554
|
|
|
@@ -13596,40 +13561,40 @@ function registerConfig(program2) {
|
|
|
13596
13561
|
}
|
|
13597
13562
|
|
|
13598
13563
|
// src/commands/db/reportMigrationStatus.ts
|
|
13599
|
-
import
|
|
13564
|
+
import chalk121 from "chalk";
|
|
13600
13565
|
function reportApplied(applied) {
|
|
13601
13566
|
if (applied.length === 0) {
|
|
13602
|
-
console.error(
|
|
13567
|
+
console.error(chalk121.green("Database is up to date; nothing to apply."));
|
|
13603
13568
|
return;
|
|
13604
13569
|
}
|
|
13605
13570
|
for (const migration of applied) {
|
|
13606
13571
|
console.error(
|
|
13607
|
-
|
|
13572
|
+
chalk121.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
13608
13573
|
);
|
|
13609
13574
|
}
|
|
13610
13575
|
}
|
|
13611
13576
|
function reportMigrationStatus(status3) {
|
|
13612
13577
|
if (status3.state === "in-sync") {
|
|
13613
13578
|
console.error(
|
|
13614
|
-
|
|
13579
|
+
chalk121.green(`In sync at migration ${status3.version} (latest).`)
|
|
13615
13580
|
);
|
|
13616
13581
|
return;
|
|
13617
13582
|
}
|
|
13618
13583
|
if (status3.state === "behind") {
|
|
13619
13584
|
console.error(
|
|
13620
|
-
|
|
13585
|
+
chalk121.yellow(
|
|
13621
13586
|
`Behind: applied ${status3.applied}, build expects ${status3.expected}.`
|
|
13622
13587
|
)
|
|
13623
13588
|
);
|
|
13624
13589
|
console.error(
|
|
13625
|
-
|
|
13590
|
+
chalk121.yellow(
|
|
13626
13591
|
`Pending: ${status3.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
13627
13592
|
)
|
|
13628
13593
|
);
|
|
13629
13594
|
return;
|
|
13630
13595
|
}
|
|
13631
13596
|
console.error(
|
|
13632
|
-
|
|
13597
|
+
chalk121.red(
|
|
13633
13598
|
`Ahead: applied ${status3.applied}, build knows ${status3.expected}. Update assist.`
|
|
13634
13599
|
)
|
|
13635
13600
|
);
|
|
@@ -13664,7 +13629,7 @@ function registerDb(program2) {
|
|
|
13664
13629
|
|
|
13665
13630
|
// src/commands/deploy/redirect.ts
|
|
13666
13631
|
import { existsSync as existsSync32, readFileSync as readFileSync28, writeFileSync as writeFileSync26 } from "fs";
|
|
13667
|
-
import
|
|
13632
|
+
import chalk122 from "chalk";
|
|
13668
13633
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
13669
13634
|
if (!window.location.pathname.endsWith('/')) {
|
|
13670
13635
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -13673,23 +13638,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
13673
13638
|
function redirect() {
|
|
13674
13639
|
const indexPath = "index.html";
|
|
13675
13640
|
if (!existsSync32(indexPath)) {
|
|
13676
|
-
console.log(
|
|
13641
|
+
console.log(chalk122.yellow("No index.html found"));
|
|
13677
13642
|
return;
|
|
13678
13643
|
}
|
|
13679
13644
|
const content = readFileSync28(indexPath, "utf8");
|
|
13680
13645
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
13681
|
-
console.log(
|
|
13646
|
+
console.log(chalk122.dim("Trailing slash script already present"));
|
|
13682
13647
|
return;
|
|
13683
13648
|
}
|
|
13684
13649
|
const headCloseIndex = content.indexOf("</head>");
|
|
13685
13650
|
if (headCloseIndex === -1) {
|
|
13686
|
-
console.log(
|
|
13651
|
+
console.log(chalk122.red("Could not find </head> tag in index.html"));
|
|
13687
13652
|
return;
|
|
13688
13653
|
}
|
|
13689
13654
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
13690
13655
|
${content.slice(headCloseIndex)}`;
|
|
13691
13656
|
writeFileSync26(indexPath, newContent);
|
|
13692
|
-
console.log(
|
|
13657
|
+
console.log(chalk122.green("Added trailing slash redirect to index.html"));
|
|
13693
13658
|
}
|
|
13694
13659
|
|
|
13695
13660
|
// src/commands/registerDeploy.ts
|
|
@@ -13716,7 +13681,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
13716
13681
|
|
|
13717
13682
|
// src/commands/devlog/shared.ts
|
|
13718
13683
|
import { execSync as execSync31 } from "child_process";
|
|
13719
|
-
import
|
|
13684
|
+
import chalk123 from "chalk";
|
|
13720
13685
|
|
|
13721
13686
|
// src/shared/getRepoName.ts
|
|
13722
13687
|
import { existsSync as existsSync33, readFileSync as readFileSync29 } from "fs";
|
|
@@ -13825,13 +13790,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
13825
13790
|
}
|
|
13826
13791
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
13827
13792
|
for (const commit2 of commits2) {
|
|
13828
|
-
console.log(` ${
|
|
13793
|
+
console.log(` ${chalk123.yellow(commit2.hash)} ${commit2.message}`);
|
|
13829
13794
|
if (verbose) {
|
|
13830
13795
|
const visibleFiles = commit2.files.filter(
|
|
13831
13796
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
13832
13797
|
);
|
|
13833
13798
|
for (const file of visibleFiles) {
|
|
13834
|
-
console.log(` ${
|
|
13799
|
+
console.log(` ${chalk123.dim(file)}`);
|
|
13835
13800
|
}
|
|
13836
13801
|
}
|
|
13837
13802
|
}
|
|
@@ -13856,15 +13821,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
13856
13821
|
}
|
|
13857
13822
|
|
|
13858
13823
|
// src/commands/devlog/list/printDateHeader.ts
|
|
13859
|
-
import
|
|
13824
|
+
import chalk124 from "chalk";
|
|
13860
13825
|
function printDateHeader(date, isSkipped, entries) {
|
|
13861
13826
|
if (isSkipped) {
|
|
13862
|
-
console.log(`${
|
|
13827
|
+
console.log(`${chalk124.bold.blue(date)} ${chalk124.dim("skipped")}`);
|
|
13863
13828
|
} else if (entries && entries.length > 0) {
|
|
13864
|
-
const entryInfo = entries.map((e) => `${
|
|
13865
|
-
console.log(`${
|
|
13829
|
+
const entryInfo = entries.map((e) => `${chalk124.green(e.version)} ${e.title}`).join(" | ");
|
|
13830
|
+
console.log(`${chalk124.bold.blue(date)} ${entryInfo}`);
|
|
13866
13831
|
} else {
|
|
13867
|
-
console.log(`${
|
|
13832
|
+
console.log(`${chalk124.bold.blue(date)} ${chalk124.red("\u26A0 devlog missing")}`);
|
|
13868
13833
|
}
|
|
13869
13834
|
}
|
|
13870
13835
|
|
|
@@ -13968,24 +13933,24 @@ function bumpVersion(version2, type) {
|
|
|
13968
13933
|
|
|
13969
13934
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
13970
13935
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
13971
|
-
import
|
|
13936
|
+
import chalk126 from "chalk";
|
|
13972
13937
|
|
|
13973
13938
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
13974
|
-
import
|
|
13939
|
+
import chalk125 from "chalk";
|
|
13975
13940
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
13976
13941
|
if (conventional && firstHash) {
|
|
13977
13942
|
const version2 = getVersionAtCommit(firstHash);
|
|
13978
13943
|
if (version2) {
|
|
13979
|
-
console.log(`${
|
|
13944
|
+
console.log(`${chalk125.bold("version:")} ${stripToMinor(version2)}`);
|
|
13980
13945
|
} else {
|
|
13981
|
-
console.log(`${
|
|
13946
|
+
console.log(`${chalk125.bold("version:")} ${chalk125.red("unknown")}`);
|
|
13982
13947
|
}
|
|
13983
13948
|
} else if (patchVersion && minorVersion) {
|
|
13984
13949
|
console.log(
|
|
13985
|
-
`${
|
|
13950
|
+
`${chalk125.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
13986
13951
|
);
|
|
13987
13952
|
} else {
|
|
13988
|
-
console.log(`${
|
|
13953
|
+
console.log(`${chalk125.bold("version:")} v0.1 (initial)`);
|
|
13989
13954
|
}
|
|
13990
13955
|
}
|
|
13991
13956
|
|
|
@@ -14033,16 +13998,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
14033
13998
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
14034
13999
|
}
|
|
14035
14000
|
function logName(repoName) {
|
|
14036
|
-
console.log(`${
|
|
14001
|
+
console.log(`${chalk126.bold("name:")} ${repoName}`);
|
|
14037
14002
|
}
|
|
14038
14003
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
14039
14004
|
logName(ctx.repoName);
|
|
14040
14005
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
14041
|
-
console.log(
|
|
14006
|
+
console.log(chalk126.bold.blue(targetDate));
|
|
14042
14007
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
14043
14008
|
}
|
|
14044
14009
|
function logNoCommits(lastInfo) {
|
|
14045
|
-
console.log(
|
|
14010
|
+
console.log(chalk126.dim(noCommitsMessage(!!lastInfo)));
|
|
14046
14011
|
}
|
|
14047
14012
|
|
|
14048
14013
|
// src/commands/devlog/next/index.ts
|
|
@@ -14083,11 +14048,11 @@ function next2(options2) {
|
|
|
14083
14048
|
import { execSync as execSync33 } from "child_process";
|
|
14084
14049
|
|
|
14085
14050
|
// src/commands/devlog/repos/printReposTable.ts
|
|
14086
|
-
import
|
|
14051
|
+
import chalk127 from "chalk";
|
|
14087
14052
|
function colorStatus(status3) {
|
|
14088
|
-
if (status3 === "missing") return
|
|
14089
|
-
if (status3 === "outdated") return
|
|
14090
|
-
return
|
|
14053
|
+
if (status3 === "missing") return chalk127.red(status3);
|
|
14054
|
+
if (status3 === "outdated") return chalk127.yellow(status3);
|
|
14055
|
+
return chalk127.green(status3);
|
|
14091
14056
|
}
|
|
14092
14057
|
function formatRow(row, nameWidth) {
|
|
14093
14058
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -14101,8 +14066,8 @@ function printReposTable(rows) {
|
|
|
14101
14066
|
"Last Devlog".padEnd(11),
|
|
14102
14067
|
"Status"
|
|
14103
14068
|
].join(" ");
|
|
14104
|
-
console.log(
|
|
14105
|
-
console.log(
|
|
14069
|
+
console.log(chalk127.dim(header));
|
|
14070
|
+
console.log(chalk127.dim("-".repeat(header.length)));
|
|
14106
14071
|
for (const row of rows) {
|
|
14107
14072
|
console.log(formatRow(row, nameWidth));
|
|
14108
14073
|
}
|
|
@@ -14160,14 +14125,14 @@ function repos(options2) {
|
|
|
14160
14125
|
// src/commands/devlog/skip.ts
|
|
14161
14126
|
import { writeFileSync as writeFileSync27 } from "fs";
|
|
14162
14127
|
import { join as join36 } from "path";
|
|
14163
|
-
import
|
|
14128
|
+
import chalk128 from "chalk";
|
|
14164
14129
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
14165
14130
|
function getBlogConfigPath() {
|
|
14166
14131
|
return join36(BLOG_REPO_ROOT, "assist.yml");
|
|
14167
14132
|
}
|
|
14168
14133
|
function skip(date) {
|
|
14169
14134
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
14170
|
-
console.log(
|
|
14135
|
+
console.log(chalk128.red("Invalid date format. Use YYYY-MM-DD"));
|
|
14171
14136
|
process.exit(1);
|
|
14172
14137
|
}
|
|
14173
14138
|
const repoName = getRepoName();
|
|
@@ -14178,7 +14143,7 @@ function skip(date) {
|
|
|
14178
14143
|
const skipDays = skip2[repoName] ?? [];
|
|
14179
14144
|
if (skipDays.includes(date)) {
|
|
14180
14145
|
console.log(
|
|
14181
|
-
|
|
14146
|
+
chalk128.yellow(`${date} is already in skip list for ${repoName}`)
|
|
14182
14147
|
);
|
|
14183
14148
|
return;
|
|
14184
14149
|
}
|
|
@@ -14188,20 +14153,20 @@ function skip(date) {
|
|
|
14188
14153
|
devlog.skip = skip2;
|
|
14189
14154
|
config.devlog = devlog;
|
|
14190
14155
|
writeFileSync27(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
14191
|
-
console.log(
|
|
14156
|
+
console.log(chalk128.green(`Added ${date} to skip list for ${repoName}`));
|
|
14192
14157
|
}
|
|
14193
14158
|
|
|
14194
14159
|
// src/commands/devlog/version.ts
|
|
14195
|
-
import
|
|
14160
|
+
import chalk129 from "chalk";
|
|
14196
14161
|
function version() {
|
|
14197
14162
|
const config = loadConfig();
|
|
14198
14163
|
const name = getRepoName();
|
|
14199
14164
|
const lastInfo = getLastVersionInfo(name, config);
|
|
14200
14165
|
const lastVersion = lastInfo?.version ?? null;
|
|
14201
14166
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
14202
|
-
console.log(`${
|
|
14203
|
-
console.log(`${
|
|
14204
|
-
console.log(`${
|
|
14167
|
+
console.log(`${chalk129.bold("name:")} ${name}`);
|
|
14168
|
+
console.log(`${chalk129.bold("last:")} ${lastVersion ?? chalk129.dim("none")}`);
|
|
14169
|
+
console.log(`${chalk129.bold("next:")} ${nextVersion ?? chalk129.dim("none")}`);
|
|
14205
14170
|
}
|
|
14206
14171
|
|
|
14207
14172
|
// src/commands/devlog/devlogConfigHelp.ts
|
|
@@ -14245,7 +14210,7 @@ function registerDevlog(program2) {
|
|
|
14245
14210
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
14246
14211
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync5 } from "fs";
|
|
14247
14212
|
import { join as join37 } from "path";
|
|
14248
|
-
import
|
|
14213
|
+
import chalk130 from "chalk";
|
|
14249
14214
|
|
|
14250
14215
|
// src/shared/findRepoRoot.ts
|
|
14251
14216
|
import { existsSync as existsSync34 } from "fs";
|
|
@@ -14308,14 +14273,14 @@ function checkBuildLocks(startDir) {
|
|
|
14308
14273
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
14309
14274
|
if (locked) {
|
|
14310
14275
|
console.error(
|
|
14311
|
-
|
|
14276
|
+
chalk130.red("Build output locked (is VS debugging?): ") + locked
|
|
14312
14277
|
);
|
|
14313
14278
|
process.exit(1);
|
|
14314
14279
|
}
|
|
14315
14280
|
}
|
|
14316
14281
|
async function checkBuildLocksCommand() {
|
|
14317
14282
|
checkBuildLocks();
|
|
14318
|
-
console.log(
|
|
14283
|
+
console.log(chalk130.green("No build locks detected"));
|
|
14319
14284
|
}
|
|
14320
14285
|
|
|
14321
14286
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -14414,30 +14379,30 @@ function escapeRegex(s) {
|
|
|
14414
14379
|
}
|
|
14415
14380
|
|
|
14416
14381
|
// src/commands/dotnet/printTree.ts
|
|
14417
|
-
import
|
|
14382
|
+
import chalk131 from "chalk";
|
|
14418
14383
|
function printNodes(nodes, prefix2) {
|
|
14419
14384
|
for (let i = 0; i < nodes.length; i++) {
|
|
14420
14385
|
const isLast = i === nodes.length - 1;
|
|
14421
14386
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
14422
14387
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
14423
14388
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
14424
|
-
const label2 = isMissing ?
|
|
14389
|
+
const label2 = isMissing ? chalk131.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
14425
14390
|
console.log(`${prefix2}${connector}${label2}`);
|
|
14426
14391
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
14427
14392
|
}
|
|
14428
14393
|
}
|
|
14429
14394
|
function printTree(tree, totalCount, solutions) {
|
|
14430
|
-
console.log(
|
|
14431
|
-
console.log(
|
|
14395
|
+
console.log(chalk131.bold("\nProject Dependency Tree"));
|
|
14396
|
+
console.log(chalk131.cyan(tree.relativePath));
|
|
14432
14397
|
printNodes(tree.children, "");
|
|
14433
|
-
console.log(
|
|
14398
|
+
console.log(chalk131.dim(`
|
|
14434
14399
|
${totalCount} projects total (including root)`));
|
|
14435
|
-
console.log(
|
|
14400
|
+
console.log(chalk131.bold("\nSolution Membership"));
|
|
14436
14401
|
if (solutions.length === 0) {
|
|
14437
|
-
console.log(
|
|
14402
|
+
console.log(chalk131.yellow(" Not found in any .sln"));
|
|
14438
14403
|
} else {
|
|
14439
14404
|
for (const sln of solutions) {
|
|
14440
|
-
console.log(` ${
|
|
14405
|
+
console.log(` ${chalk131.green(sln)}`);
|
|
14441
14406
|
}
|
|
14442
14407
|
}
|
|
14443
14408
|
console.log();
|
|
@@ -14466,16 +14431,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
14466
14431
|
// src/commands/dotnet/resolveCsproj.ts
|
|
14467
14432
|
import { existsSync as existsSync35 } from "fs";
|
|
14468
14433
|
import path31 from "path";
|
|
14469
|
-
import
|
|
14434
|
+
import chalk132 from "chalk";
|
|
14470
14435
|
function resolveCsproj(csprojPath) {
|
|
14471
14436
|
const resolved = path31.resolve(csprojPath);
|
|
14472
14437
|
if (!existsSync35(resolved)) {
|
|
14473
|
-
console.error(
|
|
14438
|
+
console.error(chalk132.red(`File not found: ${resolved}`));
|
|
14474
14439
|
process.exit(1);
|
|
14475
14440
|
}
|
|
14476
14441
|
const repoRoot = findRepoRoot(path31.dirname(resolved));
|
|
14477
14442
|
if (!repoRoot) {
|
|
14478
|
-
console.error(
|
|
14443
|
+
console.error(chalk132.red("Could not find git repository root"));
|
|
14479
14444
|
process.exit(1);
|
|
14480
14445
|
}
|
|
14481
14446
|
return { resolved, repoRoot };
|
|
@@ -14525,12 +14490,12 @@ function getChangedCsFiles(scope) {
|
|
|
14525
14490
|
}
|
|
14526
14491
|
|
|
14527
14492
|
// src/commands/dotnet/inSln.ts
|
|
14528
|
-
import
|
|
14493
|
+
import chalk133 from "chalk";
|
|
14529
14494
|
async function inSln(csprojPath) {
|
|
14530
14495
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
14531
14496
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
14532
14497
|
if (solutions.length === 0) {
|
|
14533
|
-
console.log(
|
|
14498
|
+
console.log(chalk133.yellow("Not found in any .sln file"));
|
|
14534
14499
|
process.exit(1);
|
|
14535
14500
|
}
|
|
14536
14501
|
for (const sln of solutions) {
|
|
@@ -14539,7 +14504,7 @@ async function inSln(csprojPath) {
|
|
|
14539
14504
|
}
|
|
14540
14505
|
|
|
14541
14506
|
// src/commands/dotnet/inspect.ts
|
|
14542
|
-
import
|
|
14507
|
+
import chalk139 from "chalk";
|
|
14543
14508
|
|
|
14544
14509
|
// src/shared/formatElapsed.ts
|
|
14545
14510
|
function formatElapsed(ms) {
|
|
@@ -14551,12 +14516,12 @@ function formatElapsed(ms) {
|
|
|
14551
14516
|
}
|
|
14552
14517
|
|
|
14553
14518
|
// src/commands/dotnet/displayIssues.ts
|
|
14554
|
-
import
|
|
14519
|
+
import chalk134 from "chalk";
|
|
14555
14520
|
var SEVERITY_COLOR = {
|
|
14556
|
-
ERROR:
|
|
14557
|
-
WARNING:
|
|
14558
|
-
SUGGESTION:
|
|
14559
|
-
HINT:
|
|
14521
|
+
ERROR: chalk134.red,
|
|
14522
|
+
WARNING: chalk134.yellow,
|
|
14523
|
+
SUGGESTION: chalk134.cyan,
|
|
14524
|
+
HINT: chalk134.dim
|
|
14560
14525
|
};
|
|
14561
14526
|
function groupByFile(issues) {
|
|
14562
14527
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -14572,15 +14537,15 @@ function groupByFile(issues) {
|
|
|
14572
14537
|
}
|
|
14573
14538
|
function displayIssues(issues) {
|
|
14574
14539
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
14575
|
-
console.log(
|
|
14540
|
+
console.log(chalk134.bold(file));
|
|
14576
14541
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
14577
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
14542
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk134.white;
|
|
14578
14543
|
console.log(
|
|
14579
|
-
` ${
|
|
14544
|
+
` ${chalk134.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
14580
14545
|
);
|
|
14581
14546
|
}
|
|
14582
14547
|
}
|
|
14583
|
-
console.log(
|
|
14548
|
+
console.log(chalk134.dim(`
|
|
14584
14549
|
${issues.length} issue(s) found`));
|
|
14585
14550
|
}
|
|
14586
14551
|
|
|
@@ -14639,12 +14604,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
14639
14604
|
// src/commands/dotnet/resolveSolution.ts
|
|
14640
14605
|
import { existsSync as existsSync36 } from "fs";
|
|
14641
14606
|
import path32 from "path";
|
|
14642
|
-
import
|
|
14607
|
+
import chalk136 from "chalk";
|
|
14643
14608
|
|
|
14644
14609
|
// src/commands/dotnet/findSolution.ts
|
|
14645
14610
|
import { readdirSync as readdirSync7 } from "fs";
|
|
14646
14611
|
import { dirname as dirname22, join as join38 } from "path";
|
|
14647
|
-
import
|
|
14612
|
+
import chalk135 from "chalk";
|
|
14648
14613
|
function findSlnInDir(dir) {
|
|
14649
14614
|
try {
|
|
14650
14615
|
return readdirSync7(dir).filter((f) => f.endsWith(".sln")).map((f) => join38(dir, f));
|
|
@@ -14660,17 +14625,17 @@ function findSolution() {
|
|
|
14660
14625
|
const slnFiles = findSlnInDir(current);
|
|
14661
14626
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
14662
14627
|
if (slnFiles.length > 1) {
|
|
14663
|
-
console.error(
|
|
14628
|
+
console.error(chalk135.red(`Multiple .sln files found in ${current}:`));
|
|
14664
14629
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
14665
14630
|
console.error(
|
|
14666
|
-
|
|
14631
|
+
chalk135.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
14667
14632
|
);
|
|
14668
14633
|
process.exit(1);
|
|
14669
14634
|
}
|
|
14670
14635
|
if (current === ceiling) break;
|
|
14671
14636
|
current = dirname22(current);
|
|
14672
14637
|
}
|
|
14673
|
-
console.error(
|
|
14638
|
+
console.error(chalk135.red("No .sln file found between cwd and repo root"));
|
|
14674
14639
|
process.exit(1);
|
|
14675
14640
|
}
|
|
14676
14641
|
|
|
@@ -14679,7 +14644,7 @@ function resolveSolution(sln) {
|
|
|
14679
14644
|
if (sln) {
|
|
14680
14645
|
const resolved = path32.resolve(sln);
|
|
14681
14646
|
if (!existsSync36(resolved)) {
|
|
14682
|
-
console.error(
|
|
14647
|
+
console.error(chalk136.red(`Solution file not found: ${resolved}`));
|
|
14683
14648
|
process.exit(1);
|
|
14684
14649
|
}
|
|
14685
14650
|
return resolved;
|
|
@@ -14721,14 +14686,14 @@ import { execSync as execSync35 } from "child_process";
|
|
|
14721
14686
|
import { existsSync as existsSync37, readFileSync as readFileSync33, unlinkSync as unlinkSync9 } from "fs";
|
|
14722
14687
|
import { tmpdir as tmpdir3 } from "os";
|
|
14723
14688
|
import path33 from "path";
|
|
14724
|
-
import
|
|
14689
|
+
import chalk137 from "chalk";
|
|
14725
14690
|
function assertJbInstalled() {
|
|
14726
14691
|
try {
|
|
14727
14692
|
execSync35("jb inspectcode --version", { stdio: "pipe" });
|
|
14728
14693
|
} catch {
|
|
14729
|
-
console.error(
|
|
14694
|
+
console.error(chalk137.red("jb is not installed. Install with:"));
|
|
14730
14695
|
console.error(
|
|
14731
|
-
|
|
14696
|
+
chalk137.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
14732
14697
|
);
|
|
14733
14698
|
process.exit(1);
|
|
14734
14699
|
}
|
|
@@ -14746,11 +14711,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
14746
14711
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
14747
14712
|
process.stderr.write(error.stderr);
|
|
14748
14713
|
}
|
|
14749
|
-
console.error(
|
|
14714
|
+
console.error(chalk137.red("jb inspectcode failed"));
|
|
14750
14715
|
process.exit(1);
|
|
14751
14716
|
}
|
|
14752
14717
|
if (!existsSync37(reportPath)) {
|
|
14753
|
-
console.error(
|
|
14718
|
+
console.error(chalk137.red("Report file not generated"));
|
|
14754
14719
|
process.exit(1);
|
|
14755
14720
|
}
|
|
14756
14721
|
const xml = readFileSync33(reportPath, "utf8");
|
|
@@ -14760,7 +14725,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
14760
14725
|
|
|
14761
14726
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
14762
14727
|
import { execSync as execSync36 } from "child_process";
|
|
14763
|
-
import
|
|
14728
|
+
import chalk138 from "chalk";
|
|
14764
14729
|
function resolveMsbuildPath() {
|
|
14765
14730
|
const { run: run4 } = loadConfig();
|
|
14766
14731
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -14772,9 +14737,9 @@ function assertMsbuildInstalled() {
|
|
|
14772
14737
|
try {
|
|
14773
14738
|
execSync36(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
14774
14739
|
} catch {
|
|
14775
|
-
console.error(
|
|
14740
|
+
console.error(chalk138.red(`msbuild not found at: ${msbuild}`));
|
|
14776
14741
|
console.error(
|
|
14777
|
-
|
|
14742
|
+
chalk138.yellow(
|
|
14778
14743
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
14779
14744
|
)
|
|
14780
14745
|
);
|
|
@@ -14821,17 +14786,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
14821
14786
|
// src/commands/dotnet/inspect.ts
|
|
14822
14787
|
function logScope(changedFiles) {
|
|
14823
14788
|
if (changedFiles === null) {
|
|
14824
|
-
console.log(
|
|
14789
|
+
console.log(chalk139.dim("Inspecting full solution..."));
|
|
14825
14790
|
} else {
|
|
14826
14791
|
console.log(
|
|
14827
|
-
|
|
14792
|
+
chalk139.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
14828
14793
|
);
|
|
14829
14794
|
}
|
|
14830
14795
|
}
|
|
14831
14796
|
function reportResults(issues, elapsed) {
|
|
14832
14797
|
if (issues.length > 0) displayIssues(issues);
|
|
14833
|
-
else console.log(
|
|
14834
|
-
console.log(
|
|
14798
|
+
else console.log(chalk139.green("No issues found"));
|
|
14799
|
+
console.log(chalk139.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
14835
14800
|
if (issues.length > 0) process.exit(1);
|
|
14836
14801
|
}
|
|
14837
14802
|
async function inspect(sln, options2) {
|
|
@@ -14842,7 +14807,7 @@ async function inspect(sln, options2) {
|
|
|
14842
14807
|
const scope = parseScope(options2.scope);
|
|
14843
14808
|
const changedFiles = getChangedCsFiles(scope);
|
|
14844
14809
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
14845
|
-
console.log(
|
|
14810
|
+
console.log(chalk139.green("No changed .cs files found"));
|
|
14846
14811
|
return;
|
|
14847
14812
|
}
|
|
14848
14813
|
logScope(changedFiles);
|
|
@@ -15190,25 +15155,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
15190
15155
|
}
|
|
15191
15156
|
|
|
15192
15157
|
// src/commands/github/printCountTable.ts
|
|
15193
|
-
import
|
|
15158
|
+
import chalk140 from "chalk";
|
|
15194
15159
|
function printCountTable(labelHeader, rows) {
|
|
15195
15160
|
const labelWidth = Math.max(
|
|
15196
15161
|
labelHeader.length,
|
|
15197
15162
|
...rows.map((row) => row.label.length)
|
|
15198
15163
|
);
|
|
15199
15164
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
15200
|
-
console.log(
|
|
15201
|
-
console.log(
|
|
15165
|
+
console.log(chalk140.dim(header));
|
|
15166
|
+
console.log(chalk140.dim("-".repeat(header.length)));
|
|
15202
15167
|
for (const row of rows) {
|
|
15203
15168
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
15204
15169
|
}
|
|
15205
15170
|
}
|
|
15206
15171
|
|
|
15207
15172
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
15208
|
-
import
|
|
15173
|
+
import chalk141 from "chalk";
|
|
15209
15174
|
function printRepoAuthorBreakdown(repos2) {
|
|
15210
15175
|
for (const repo of repos2) {
|
|
15211
|
-
console.log(
|
|
15176
|
+
console.log(chalk141.bold(repo.name));
|
|
15212
15177
|
const authorWidth = Math.max(
|
|
15213
15178
|
0,
|
|
15214
15179
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -15305,9 +15270,9 @@ function registerGithub(program2) {
|
|
|
15305
15270
|
}
|
|
15306
15271
|
|
|
15307
15272
|
// src/commands/handover/countPendingHandovers.ts
|
|
15308
|
-
import { and as and18, eq as
|
|
15273
|
+
import { and as and18, eq as eq35, isNull, sql as sql16 } from "drizzle-orm";
|
|
15309
15274
|
async function countPendingHandovers(orm, origin) {
|
|
15310
|
-
const [row] = await orm.select({ count: sql16`count(*)::int` }).from(handovers).where(and18(
|
|
15275
|
+
const [row] = await orm.select({ count: sql16`count(*)::int` }).from(handovers).where(and18(eq35(handovers.origin, origin), isNull(handovers.recalledAt)));
|
|
15311
15276
|
return row?.count ?? 0;
|
|
15312
15277
|
}
|
|
15313
15278
|
|
|
@@ -15447,13 +15412,13 @@ async function load2(options2 = {}) {
|
|
|
15447
15412
|
}
|
|
15448
15413
|
|
|
15449
15414
|
// src/commands/handover/listPendingHandovers.ts
|
|
15450
|
-
import { and as and19, desc as desc4, eq as
|
|
15415
|
+
import { and as and19, desc as desc4, eq as eq36, isNull as isNull2 } from "drizzle-orm";
|
|
15451
15416
|
async function listPendingHandovers(orm, origin) {
|
|
15452
15417
|
return orm.select({
|
|
15453
15418
|
id: handovers.id,
|
|
15454
15419
|
summary: handovers.summary,
|
|
15455
15420
|
createdAt: handovers.createdAt
|
|
15456
|
-
}).from(handovers).where(and19(
|
|
15421
|
+
}).from(handovers).where(and19(eq36(handovers.origin, origin), isNull2(handovers.recalledAt))).orderBy(desc4(handovers.createdAt), desc4(handovers.id));
|
|
15457
15422
|
}
|
|
15458
15423
|
|
|
15459
15424
|
// src/commands/handover/printPendingHandovers.ts
|
|
@@ -15466,17 +15431,17 @@ async function printPendingHandovers() {
|
|
|
15466
15431
|
}
|
|
15467
15432
|
|
|
15468
15433
|
// src/commands/handover/recallHandover.ts
|
|
15469
|
-
import { and as and20, desc as desc5, eq as
|
|
15434
|
+
import { and as and20, desc as desc5, eq as eq37, isNull as isNull3 } from "drizzle-orm";
|
|
15470
15435
|
async function recallHandover(orm, origin, id) {
|
|
15471
15436
|
const [row] = await orm.select().from(handovers).where(
|
|
15472
15437
|
and20(
|
|
15473
|
-
|
|
15438
|
+
eq37(handovers.origin, origin),
|
|
15474
15439
|
isNull3(handovers.recalledAt),
|
|
15475
|
-
...id === void 0 ? [] : [
|
|
15440
|
+
...id === void 0 ? [] : [eq37(handovers.id, id)]
|
|
15476
15441
|
)
|
|
15477
15442
|
).orderBy(desc5(handovers.createdAt), desc5(handovers.id)).limit(1);
|
|
15478
15443
|
if (!row) return void 0;
|
|
15479
|
-
await orm.update(handovers).set({ recalledAt: /* @__PURE__ */ new Date() }).where(
|
|
15444
|
+
await orm.update(handovers).set({ recalledAt: /* @__PURE__ */ new Date() }).where(eq37(handovers.id, row.id));
|
|
15480
15445
|
return row.content;
|
|
15481
15446
|
}
|
|
15482
15447
|
|
|
@@ -15526,7 +15491,7 @@ function registerHandover(program2) {
|
|
|
15526
15491
|
}
|
|
15527
15492
|
|
|
15528
15493
|
// src/commands/jira/acceptanceCriteria.ts
|
|
15529
|
-
import
|
|
15494
|
+
import chalk142 from "chalk";
|
|
15530
15495
|
|
|
15531
15496
|
// src/commands/jira/adfToText.ts
|
|
15532
15497
|
function renderInline(node) {
|
|
@@ -15593,7 +15558,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
15593
15558
|
const parsed = fetchIssue(issueKey, field);
|
|
15594
15559
|
const acValue = parsed?.fields?.[field];
|
|
15595
15560
|
if (!acValue) {
|
|
15596
|
-
console.log(
|
|
15561
|
+
console.log(chalk142.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
15597
15562
|
return;
|
|
15598
15563
|
}
|
|
15599
15564
|
if (typeof acValue === "string") {
|
|
@@ -15659,14 +15624,14 @@ async function jiraAuth() {
|
|
|
15659
15624
|
}
|
|
15660
15625
|
|
|
15661
15626
|
// src/commands/jira/viewIssue.ts
|
|
15662
|
-
import
|
|
15627
|
+
import chalk143 from "chalk";
|
|
15663
15628
|
function viewIssue(issueKey) {
|
|
15664
15629
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
15665
15630
|
const fields = parsed?.fields;
|
|
15666
15631
|
const summary = fields?.summary;
|
|
15667
15632
|
const description = fields?.description;
|
|
15668
15633
|
if (summary) {
|
|
15669
|
-
console.log(
|
|
15634
|
+
console.log(chalk143.bold(summary));
|
|
15670
15635
|
}
|
|
15671
15636
|
if (description) {
|
|
15672
15637
|
if (summary) console.log();
|
|
@@ -15680,7 +15645,7 @@ function viewIssue(issueKey) {
|
|
|
15680
15645
|
}
|
|
15681
15646
|
if (!summary && !description) {
|
|
15682
15647
|
console.log(
|
|
15683
|
-
|
|
15648
|
+
chalk143.yellow(`No summary or description found on ${issueKey}.`)
|
|
15684
15649
|
);
|
|
15685
15650
|
}
|
|
15686
15651
|
}
|
|
@@ -15733,22 +15698,26 @@ function registerRefineLaunch(program2, resumeFlag) {
|
|
|
15733
15698
|
configHelp(command, HARNESS_CONFIG_HELP);
|
|
15734
15699
|
}
|
|
15735
15700
|
|
|
15736
|
-
// src/commands/
|
|
15701
|
+
// src/commands/reviewPrComments.ts
|
|
15737
15702
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
15738
15703
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
15739
|
-
import
|
|
15740
|
-
async function
|
|
15704
|
+
import chalk144 from "chalk";
|
|
15705
|
+
async function reviewPrComments(number) {
|
|
15741
15706
|
if (number) {
|
|
15742
15707
|
try {
|
|
15743
15708
|
execFileSync5("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
15744
15709
|
} catch {
|
|
15745
|
-
console.error(
|
|
15710
|
+
console.error(chalk144.red(`gh pr checkout ${number} failed; aborting.`));
|
|
15746
15711
|
process.exit(1);
|
|
15747
15712
|
}
|
|
15748
15713
|
}
|
|
15749
15714
|
const claudeSessionId = randomUUID3();
|
|
15750
|
-
emitActivity({
|
|
15751
|
-
|
|
15715
|
+
emitActivity({
|
|
15716
|
+
kind: "command",
|
|
15717
|
+
name: "review-pr-comments",
|
|
15718
|
+
claudeSessionId
|
|
15719
|
+
});
|
|
15720
|
+
const { done: done2 } = spawnClaude("/review-pr-comments", {
|
|
15752
15721
|
permissionMode: "acceptEdits",
|
|
15753
15722
|
sessionId: claudeSessionId
|
|
15754
15723
|
});
|
|
@@ -15775,8 +15744,8 @@ function registerDescriptionLaunch(program2, name, slashCommand, description, al
|
|
|
15775
15744
|
);
|
|
15776
15745
|
if (alias) command.alias(alias);
|
|
15777
15746
|
}
|
|
15778
|
-
function
|
|
15779
|
-
program2.command("review-comments").argument("[number]", "PR number to check out first").description("Launch Claude in /review-comments mode (single session)").action((number) =>
|
|
15747
|
+
function registerReviewPrComments(program2) {
|
|
15748
|
+
program2.command("review-pr-comments").argument("[number]", "PR number to check out first").description("Launch Claude in /review-pr-comments mode (single session)").action((number) => reviewPrComments(number));
|
|
15780
15749
|
}
|
|
15781
15750
|
function registerLaunch(program2) {
|
|
15782
15751
|
registerNext(program2);
|
|
@@ -15793,7 +15762,7 @@ function registerLaunch(program2) {
|
|
|
15793
15762
|
"bug",
|
|
15794
15763
|
"Launch Claude in /bug mode, chain into next on /next signal"
|
|
15795
15764
|
);
|
|
15796
|
-
|
|
15765
|
+
registerReviewPrComments(program2);
|
|
15797
15766
|
registerRefineLaunch(program2, RESUME_SESSION_FLAG);
|
|
15798
15767
|
}
|
|
15799
15768
|
|
|
@@ -15811,15 +15780,15 @@ function registerList(program2) {
|
|
|
15811
15780
|
// src/commands/mermaid/index.ts
|
|
15812
15781
|
import { mkdirSync as mkdirSync15, readdirSync as readdirSync9 } from "fs";
|
|
15813
15782
|
import { resolve as resolve11 } from "path";
|
|
15814
|
-
import
|
|
15783
|
+
import chalk147 from "chalk";
|
|
15815
15784
|
|
|
15816
15785
|
// src/commands/mermaid/exportFile.ts
|
|
15817
15786
|
import { readFileSync as readFileSync35, writeFileSync as writeFileSync29 } from "fs";
|
|
15818
15787
|
import { basename as basename11, extname, resolve as resolve10 } from "path";
|
|
15819
|
-
import
|
|
15788
|
+
import chalk146 from "chalk";
|
|
15820
15789
|
|
|
15821
15790
|
// src/commands/mermaid/renderBlock.ts
|
|
15822
|
-
import
|
|
15791
|
+
import chalk145 from "chalk";
|
|
15823
15792
|
async function renderBlock(krokiUrl, source) {
|
|
15824
15793
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
15825
15794
|
method: "POST",
|
|
@@ -15828,7 +15797,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
15828
15797
|
});
|
|
15829
15798
|
if (!response.ok) {
|
|
15830
15799
|
console.error(
|
|
15831
|
-
|
|
15800
|
+
chalk145.red(
|
|
15832
15801
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
15833
15802
|
)
|
|
15834
15803
|
);
|
|
@@ -15846,19 +15815,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
15846
15815
|
if (onlyIndex !== void 0) {
|
|
15847
15816
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
15848
15817
|
console.error(
|
|
15849
|
-
|
|
15818
|
+
chalk146.red(
|
|
15850
15819
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
15851
15820
|
)
|
|
15852
15821
|
);
|
|
15853
15822
|
process.exit(1);
|
|
15854
15823
|
}
|
|
15855
15824
|
console.log(
|
|
15856
|
-
|
|
15825
|
+
chalk146.gray(
|
|
15857
15826
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
15858
15827
|
)
|
|
15859
15828
|
);
|
|
15860
15829
|
} else {
|
|
15861
|
-
console.log(
|
|
15830
|
+
console.log(chalk146.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
15862
15831
|
}
|
|
15863
15832
|
for (const [i, source] of blocks.entries()) {
|
|
15864
15833
|
const idx = i + 1;
|
|
@@ -15866,7 +15835,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
15866
15835
|
const outPath = resolve10(outDir, `${stem}-${idx}.svg`);
|
|
15867
15836
|
const svg = await renderBlock(krokiUrl, source);
|
|
15868
15837
|
writeFileSync29(outPath, svg, "utf8");
|
|
15869
|
-
console.log(
|
|
15838
|
+
console.log(chalk146.green(` \u2192 ${outPath}`));
|
|
15870
15839
|
}
|
|
15871
15840
|
}
|
|
15872
15841
|
function extractMermaidBlocks(markdown) {
|
|
@@ -15882,18 +15851,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
15882
15851
|
if (options2.index !== void 0) {
|
|
15883
15852
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
15884
15853
|
console.error(
|
|
15885
|
-
|
|
15854
|
+
chalk147.red(`--index must be a positive integer (got ${options2.index})`)
|
|
15886
15855
|
);
|
|
15887
15856
|
process.exit(1);
|
|
15888
15857
|
}
|
|
15889
15858
|
if (!file) {
|
|
15890
|
-
console.error(
|
|
15859
|
+
console.error(chalk147.red("--index requires a file argument"));
|
|
15891
15860
|
process.exit(1);
|
|
15892
15861
|
}
|
|
15893
15862
|
}
|
|
15894
15863
|
const files = file ? [file] : readdirSync9(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
15895
15864
|
if (files.length === 0) {
|
|
15896
|
-
console.log(
|
|
15865
|
+
console.log(chalk147.gray("No markdown files found in current directory."));
|
|
15897
15866
|
return;
|
|
15898
15867
|
}
|
|
15899
15868
|
for (const f of files) {
|
|
@@ -15926,7 +15895,7 @@ function registerMermaid(program2) {
|
|
|
15926
15895
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
15927
15896
|
import { createServer as createServer2 } from "http";
|
|
15928
15897
|
import { dirname as dirname24 } from "path";
|
|
15929
|
-
import
|
|
15898
|
+
import chalk149 from "chalk";
|
|
15930
15899
|
|
|
15931
15900
|
// src/commands/netcap/corsHeaders.ts
|
|
15932
15901
|
var corsHeaders = {
|
|
@@ -16005,7 +15974,7 @@ function createNetcapHandler(options2) {
|
|
|
16005
15974
|
import { cp, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|
|
16006
15975
|
import { networkInterfaces } from "os";
|
|
16007
15976
|
import { join as join44 } from "path";
|
|
16008
|
-
import
|
|
15977
|
+
import chalk148 from "chalk";
|
|
16009
15978
|
|
|
16010
15979
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
16011
15980
|
import { dirname as dirname23, join as join43 } from "path";
|
|
@@ -16049,7 +16018,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
16049
16018
|
const host = lanIPv4();
|
|
16050
16019
|
if (!host) {
|
|
16051
16020
|
console.log(
|
|
16052
|
-
|
|
16021
|
+
chalk148.yellow("could not determine the WSL IP for the extension")
|
|
16053
16022
|
);
|
|
16054
16023
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
16055
16024
|
return source;
|
|
@@ -16060,7 +16029,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
16060
16029
|
return WSL_WINDOWS_PATH;
|
|
16061
16030
|
} catch {
|
|
16062
16031
|
console.log(
|
|
16063
|
-
|
|
16032
|
+
chalk148.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
16064
16033
|
);
|
|
16065
16034
|
return source;
|
|
16066
16035
|
}
|
|
@@ -16093,30 +16062,30 @@ async function netcap(options2) {
|
|
|
16093
16062
|
let count7 = 0;
|
|
16094
16063
|
const handler = createNetcapHandler({
|
|
16095
16064
|
outPath,
|
|
16096
|
-
onPing: () => console.log(
|
|
16065
|
+
onPing: () => console.log(chalk149.dim("ping from extension")),
|
|
16097
16066
|
onCapture: (entry) => {
|
|
16098
16067
|
count7 += 1;
|
|
16099
16068
|
console.log(
|
|
16100
|
-
|
|
16101
|
-
|
|
16069
|
+
chalk149.green(`captured #${count7}`),
|
|
16070
|
+
chalk149.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
16102
16071
|
);
|
|
16103
16072
|
}
|
|
16104
16073
|
});
|
|
16105
16074
|
const server = createServer2(handler);
|
|
16106
16075
|
server.listen(port, () => {
|
|
16107
16076
|
console.log(
|
|
16108
|
-
|
|
16077
|
+
chalk149.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
16109
16078
|
);
|
|
16110
|
-
console.log(
|
|
16079
|
+
console.log(chalk149.dim(`appending captures to ${outPath}`));
|
|
16111
16080
|
if (filter)
|
|
16112
|
-
console.log(
|
|
16113
|
-
console.log(
|
|
16114
|
-
console.log(
|
|
16081
|
+
console.log(chalk149.dim(`forwarding only URLs matching "${filter}"`));
|
|
16082
|
+
console.log(chalk149.dim(`load the unpacked extension from ${extensionPath}`));
|
|
16083
|
+
console.log(chalk149.dim("press Ctrl-C to stop"));
|
|
16115
16084
|
});
|
|
16116
16085
|
process.on("SIGINT", () => {
|
|
16117
16086
|
server.close();
|
|
16118
16087
|
console.log(
|
|
16119
|
-
|
|
16088
|
+
chalk149.bold(
|
|
16120
16089
|
`
|
|
16121
16090
|
netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
16122
16091
|
)
|
|
@@ -16128,7 +16097,7 @@ netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} t
|
|
|
16128
16097
|
// src/commands/netcap/netcapExtract.ts
|
|
16129
16098
|
import { writeFileSync as writeFileSync30 } from "fs";
|
|
16130
16099
|
import { join as join47 } from "path";
|
|
16131
|
-
import
|
|
16100
|
+
import chalk150 from "chalk";
|
|
16132
16101
|
|
|
16133
16102
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
16134
16103
|
import { readFileSync as readFileSync36 } from "fs";
|
|
@@ -16576,8 +16545,8 @@ function netcapExtract(file) {
|
|
|
16576
16545
|
writeFileSync30(outFile, `${JSON.stringify(posts, null, 2)}
|
|
16577
16546
|
`);
|
|
16578
16547
|
console.log(
|
|
16579
|
-
|
|
16580
|
-
|
|
16548
|
+
chalk150.green(`extracted ${posts.length} posts`),
|
|
16549
|
+
chalk150.dim(`-> ${outFile}`)
|
|
16581
16550
|
);
|
|
16582
16551
|
}
|
|
16583
16552
|
|
|
@@ -16598,7 +16567,7 @@ function registerNetcap(program2) {
|
|
|
16598
16567
|
}
|
|
16599
16568
|
|
|
16600
16569
|
// src/commands/news/add/index.ts
|
|
16601
|
-
import
|
|
16570
|
+
import chalk151 from "chalk";
|
|
16602
16571
|
import enquirer8 from "enquirer";
|
|
16603
16572
|
async function add2(url) {
|
|
16604
16573
|
if (!url) {
|
|
@@ -16620,10 +16589,10 @@ async function add2(url) {
|
|
|
16620
16589
|
const { orm } = await getReady();
|
|
16621
16590
|
const added = await addFeed(orm, url);
|
|
16622
16591
|
if (!added) {
|
|
16623
|
-
console.log(
|
|
16592
|
+
console.log(chalk151.yellow("Feed already exists"));
|
|
16624
16593
|
return;
|
|
16625
16594
|
}
|
|
16626
|
-
console.log(
|
|
16595
|
+
console.log(chalk151.green(`Added feed: ${url}`));
|
|
16627
16596
|
}
|
|
16628
16597
|
|
|
16629
16598
|
// src/commands/registerNews.ts
|
|
@@ -16670,7 +16639,7 @@ function registerPiHook(program2) {
|
|
|
16670
16639
|
}
|
|
16671
16640
|
|
|
16672
16641
|
// src/commands/prompts/printPromptsTable.ts
|
|
16673
|
-
import
|
|
16642
|
+
import chalk152 from "chalk";
|
|
16674
16643
|
function truncate(str, max) {
|
|
16675
16644
|
if (str.length <= max) return str;
|
|
16676
16645
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -16688,14 +16657,14 @@ function printPromptsTable(rows) {
|
|
|
16688
16657
|
"Command".padEnd(commandWidth),
|
|
16689
16658
|
"Repos"
|
|
16690
16659
|
].join(" ");
|
|
16691
|
-
console.log(
|
|
16692
|
-
console.log(
|
|
16660
|
+
console.log(chalk152.dim(header));
|
|
16661
|
+
console.log(chalk152.dim("-".repeat(header.length)));
|
|
16693
16662
|
for (const row of rows) {
|
|
16694
16663
|
const count7 = String(row.count).padStart(countWidth);
|
|
16695
16664
|
const tool = row.tool.padEnd(toolWidth);
|
|
16696
16665
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
16697
16666
|
console.log(
|
|
16698
|
-
`${
|
|
16667
|
+
`${chalk152.yellow(count7)} ${tool} ${command} ${chalk152.dim(row.repos)}`
|
|
16699
16668
|
);
|
|
16700
16669
|
}
|
|
16701
16670
|
}
|
|
@@ -17262,20 +17231,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
17262
17231
|
}
|
|
17263
17232
|
|
|
17264
17233
|
// src/commands/prs/listComments/printComments.ts
|
|
17265
|
-
import
|
|
17234
|
+
import chalk153 from "chalk";
|
|
17266
17235
|
function formatForHuman(comment3) {
|
|
17267
17236
|
if (comment3.type === "review") {
|
|
17268
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
17237
|
+
const stateColor = comment3.state === "APPROVED" ? chalk153.green : comment3.state === "CHANGES_REQUESTED" ? chalk153.red : chalk153.yellow;
|
|
17269
17238
|
return [
|
|
17270
|
-
`${
|
|
17239
|
+
`${chalk153.cyan("Review")} by ${chalk153.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
17271
17240
|
comment3.body,
|
|
17272
17241
|
""
|
|
17273
17242
|
].join("\n");
|
|
17274
17243
|
}
|
|
17275
17244
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
17276
17245
|
return [
|
|
17277
|
-
`${
|
|
17278
|
-
|
|
17246
|
+
`${chalk153.cyan("Line comment")} by ${chalk153.bold(comment3.user)} on ${chalk153.dim(`${comment3.path}${location}`)}`,
|
|
17247
|
+
chalk153.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
17279
17248
|
comment3.body,
|
|
17280
17249
|
""
|
|
17281
17250
|
].join("\n");
|
|
@@ -17365,13 +17334,13 @@ import { execSync as execSync44 } from "child_process";
|
|
|
17365
17334
|
import enquirer9 from "enquirer";
|
|
17366
17335
|
|
|
17367
17336
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
17368
|
-
import
|
|
17337
|
+
import chalk154 from "chalk";
|
|
17369
17338
|
var STATUS_MAP = {
|
|
17370
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
17371
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
17339
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk154.magenta("merged"), date: pr.mergedAt } : null,
|
|
17340
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk154.red("closed"), date: pr.closedAt } : null
|
|
17372
17341
|
};
|
|
17373
17342
|
function defaultStatus(pr) {
|
|
17374
|
-
return { label:
|
|
17343
|
+
return { label: chalk154.green("opened"), date: pr.createdAt };
|
|
17375
17344
|
}
|
|
17376
17345
|
function getStatus2(pr) {
|
|
17377
17346
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -17380,11 +17349,11 @@ function formatDate(dateStr) {
|
|
|
17380
17349
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
17381
17350
|
}
|
|
17382
17351
|
function formatPrHeader(pr, status3) {
|
|
17383
|
-
return `${
|
|
17352
|
+
return `${chalk154.cyan(`#${pr.number}`)} ${pr.title} ${chalk154.dim(`(${pr.author.login},`)} ${status3.label} ${chalk154.dim(`${formatDate(status3.date)})`)}`;
|
|
17384
17353
|
}
|
|
17385
17354
|
function logPrDetails(pr) {
|
|
17386
17355
|
console.log(
|
|
17387
|
-
|
|
17356
|
+
chalk154.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
17388
17357
|
);
|
|
17389
17358
|
console.log();
|
|
17390
17359
|
}
|
|
@@ -17733,10 +17702,10 @@ function registerPrs(program2) {
|
|
|
17733
17702
|
}
|
|
17734
17703
|
|
|
17735
17704
|
// src/commands/ravendb/ravendbAuth.ts
|
|
17736
|
-
import
|
|
17705
|
+
import chalk160 from "chalk";
|
|
17737
17706
|
|
|
17738
17707
|
// src/shared/createConnectionAuth.ts
|
|
17739
|
-
import
|
|
17708
|
+
import chalk155 from "chalk";
|
|
17740
17709
|
function listConnections(connections, format) {
|
|
17741
17710
|
if (connections.length === 0) {
|
|
17742
17711
|
console.log("No connections configured.");
|
|
@@ -17749,7 +17718,7 @@ function listConnections(connections, format) {
|
|
|
17749
17718
|
function removeConnection(connections, name, save) {
|
|
17750
17719
|
const filtered = connections.filter((c) => c.name !== name);
|
|
17751
17720
|
if (filtered.length === connections.length) {
|
|
17752
|
-
console.error(
|
|
17721
|
+
console.error(chalk155.red(`Connection "${name}" not found.`));
|
|
17753
17722
|
process.exit(1);
|
|
17754
17723
|
}
|
|
17755
17724
|
save(filtered);
|
|
@@ -17795,15 +17764,15 @@ function saveConnections(connections) {
|
|
|
17795
17764
|
}
|
|
17796
17765
|
|
|
17797
17766
|
// src/commands/ravendb/promptConnection.ts
|
|
17798
|
-
import
|
|
17767
|
+
import chalk158 from "chalk";
|
|
17799
17768
|
|
|
17800
17769
|
// src/commands/ravendb/selectOpSecret.ts
|
|
17801
|
-
import
|
|
17770
|
+
import chalk157 from "chalk";
|
|
17802
17771
|
import Enquirer2 from "enquirer";
|
|
17803
17772
|
|
|
17804
17773
|
// src/commands/ravendb/searchItems.ts
|
|
17805
17774
|
import { execSync as execSync47 } from "child_process";
|
|
17806
|
-
import
|
|
17775
|
+
import chalk156 from "chalk";
|
|
17807
17776
|
function opExec(args) {
|
|
17808
17777
|
return execSync47(`op ${args}`, {
|
|
17809
17778
|
encoding: "utf8",
|
|
@@ -17816,7 +17785,7 @@ function searchItems(search2) {
|
|
|
17816
17785
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
17817
17786
|
} catch {
|
|
17818
17787
|
console.error(
|
|
17819
|
-
|
|
17788
|
+
chalk156.red(
|
|
17820
17789
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
17821
17790
|
)
|
|
17822
17791
|
);
|
|
@@ -17830,7 +17799,7 @@ function getItemFields(itemId2) {
|
|
|
17830
17799
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
17831
17800
|
return item.fields.filter((f) => f.reference && f.label);
|
|
17832
17801
|
} catch {
|
|
17833
|
-
console.error(
|
|
17802
|
+
console.error(chalk156.red("Failed to get item details from 1Password."));
|
|
17834
17803
|
process.exit(1);
|
|
17835
17804
|
}
|
|
17836
17805
|
}
|
|
@@ -17849,7 +17818,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
17849
17818
|
}).run();
|
|
17850
17819
|
const items2 = searchItems(search2);
|
|
17851
17820
|
if (items2.length === 0) {
|
|
17852
|
-
console.error(
|
|
17821
|
+
console.error(chalk157.red(`No items found matching "${search2}".`));
|
|
17853
17822
|
process.exit(1);
|
|
17854
17823
|
}
|
|
17855
17824
|
const itemId2 = await selectOne(
|
|
@@ -17858,7 +17827,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
17858
17827
|
);
|
|
17859
17828
|
const fields = getItemFields(itemId2);
|
|
17860
17829
|
if (fields.length === 0) {
|
|
17861
|
-
console.error(
|
|
17830
|
+
console.error(chalk157.red("No fields with references found on this item."));
|
|
17862
17831
|
process.exit(1);
|
|
17863
17832
|
}
|
|
17864
17833
|
const ref = await selectOne(
|
|
@@ -17872,7 +17841,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
17872
17841
|
async function promptConnection(existingNames) {
|
|
17873
17842
|
const name = await promptInput("name", "Connection name:");
|
|
17874
17843
|
if (existingNames.includes(name)) {
|
|
17875
|
-
console.error(
|
|
17844
|
+
console.error(chalk158.red(`Connection "${name}" already exists.`));
|
|
17876
17845
|
process.exit(1);
|
|
17877
17846
|
}
|
|
17878
17847
|
const url = await promptInput(
|
|
@@ -17881,22 +17850,22 @@ async function promptConnection(existingNames) {
|
|
|
17881
17850
|
);
|
|
17882
17851
|
const database = await promptInput("database", "Database name:");
|
|
17883
17852
|
if (!name || !url || !database) {
|
|
17884
|
-
console.error(
|
|
17853
|
+
console.error(chalk158.red("All fields are required."));
|
|
17885
17854
|
process.exit(1);
|
|
17886
17855
|
}
|
|
17887
17856
|
const apiKeyRef = await selectOpSecret();
|
|
17888
|
-
console.log(
|
|
17857
|
+
console.log(chalk158.dim(`Using: ${apiKeyRef}`));
|
|
17889
17858
|
return { name, url, database, apiKeyRef };
|
|
17890
17859
|
}
|
|
17891
17860
|
|
|
17892
17861
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
17893
|
-
import
|
|
17862
|
+
import chalk159 from "chalk";
|
|
17894
17863
|
function ravendbSetConnection(name) {
|
|
17895
17864
|
const raw = loadGlobalConfigRaw();
|
|
17896
17865
|
const ravendb = raw.ravendb ?? {};
|
|
17897
17866
|
const connections = ravendb.connections ?? [];
|
|
17898
17867
|
if (!connections.some((c) => c.name === name)) {
|
|
17899
|
-
console.error(
|
|
17868
|
+
console.error(chalk159.red(`Connection "${name}" not found.`));
|
|
17900
17869
|
console.error(
|
|
17901
17870
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
17902
17871
|
);
|
|
@@ -17912,16 +17881,16 @@ function ravendbSetConnection(name) {
|
|
|
17912
17881
|
var ravendbAuth = createConnectionAuth({
|
|
17913
17882
|
load: loadConnections,
|
|
17914
17883
|
save: saveConnections,
|
|
17915
|
-
format: (c) => `${
|
|
17884
|
+
format: (c) => `${chalk160.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
17916
17885
|
promptNew: promptConnection,
|
|
17917
17886
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
17918
17887
|
});
|
|
17919
17888
|
|
|
17920
17889
|
// src/commands/ravendb/ravendbCollections.ts
|
|
17921
|
-
import
|
|
17890
|
+
import chalk164 from "chalk";
|
|
17922
17891
|
|
|
17923
17892
|
// src/commands/ravendb/ravenFetch.ts
|
|
17924
|
-
import
|
|
17893
|
+
import chalk162 from "chalk";
|
|
17925
17894
|
|
|
17926
17895
|
// src/commands/ravendb/getAccessToken.ts
|
|
17927
17896
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -17958,10 +17927,10 @@ ${errorText}`
|
|
|
17958
17927
|
|
|
17959
17928
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
17960
17929
|
import { execSync as execSync48 } from "child_process";
|
|
17961
|
-
import
|
|
17930
|
+
import chalk161 from "chalk";
|
|
17962
17931
|
function resolveOpSecret(reference) {
|
|
17963
17932
|
if (!reference.startsWith("op://")) {
|
|
17964
|
-
console.error(
|
|
17933
|
+
console.error(chalk161.red(`Invalid secret reference: must start with op://`));
|
|
17965
17934
|
process.exit(1);
|
|
17966
17935
|
}
|
|
17967
17936
|
try {
|
|
@@ -17971,7 +17940,7 @@ function resolveOpSecret(reference) {
|
|
|
17971
17940
|
}).trim();
|
|
17972
17941
|
} catch {
|
|
17973
17942
|
console.error(
|
|
17974
|
-
|
|
17943
|
+
chalk161.red(
|
|
17975
17944
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
17976
17945
|
)
|
|
17977
17946
|
);
|
|
@@ -17998,7 +17967,7 @@ async function ravenFetch(connection, path67) {
|
|
|
17998
17967
|
if (!response.ok) {
|
|
17999
17968
|
const body = await response.text();
|
|
18000
17969
|
console.error(
|
|
18001
|
-
|
|
17970
|
+
chalk162.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
18002
17971
|
);
|
|
18003
17972
|
console.error(body.substring(0, 500));
|
|
18004
17973
|
process.exit(1);
|
|
@@ -18007,7 +17976,7 @@ async function ravenFetch(connection, path67) {
|
|
|
18007
17976
|
}
|
|
18008
17977
|
|
|
18009
17978
|
// src/commands/ravendb/resolveConnection.ts
|
|
18010
|
-
import
|
|
17979
|
+
import chalk163 from "chalk";
|
|
18011
17980
|
function loadRavendb() {
|
|
18012
17981
|
const raw = loadGlobalConfigRaw();
|
|
18013
17982
|
const ravendb = raw.ravendb;
|
|
@@ -18021,7 +17990,7 @@ function resolveConnection(name) {
|
|
|
18021
17990
|
const connectionName = name ?? defaultConnection;
|
|
18022
17991
|
if (!connectionName) {
|
|
18023
17992
|
console.error(
|
|
18024
|
-
|
|
17993
|
+
chalk163.red(
|
|
18025
17994
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
18026
17995
|
)
|
|
18027
17996
|
);
|
|
@@ -18029,7 +17998,7 @@ function resolveConnection(name) {
|
|
|
18029
17998
|
}
|
|
18030
17999
|
const connection = connections.find((c) => c.name === connectionName);
|
|
18031
18000
|
if (!connection) {
|
|
18032
|
-
console.error(
|
|
18001
|
+
console.error(chalk163.red(`Connection "${connectionName}" not found.`));
|
|
18033
18002
|
console.error(
|
|
18034
18003
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
18035
18004
|
);
|
|
@@ -18060,7 +18029,7 @@ async function ravendbCollections(connectionName) {
|
|
|
18060
18029
|
return;
|
|
18061
18030
|
}
|
|
18062
18031
|
for (const c of collections) {
|
|
18063
|
-
console.log(`${
|
|
18032
|
+
console.log(`${chalk164.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
18064
18033
|
}
|
|
18065
18034
|
}
|
|
18066
18035
|
|
|
@@ -18079,10 +18048,10 @@ var ravendbConfigHelp = [
|
|
|
18079
18048
|
];
|
|
18080
18049
|
|
|
18081
18050
|
// src/commands/ravendb/ravendbQuery.ts
|
|
18082
|
-
import
|
|
18051
|
+
import chalk166 from "chalk";
|
|
18083
18052
|
|
|
18084
18053
|
// src/commands/ravendb/fetchAllPages.ts
|
|
18085
|
-
import
|
|
18054
|
+
import chalk165 from "chalk";
|
|
18086
18055
|
|
|
18087
18056
|
// src/commands/ravendb/buildQueryPath.ts
|
|
18088
18057
|
function buildQueryPath(opts) {
|
|
@@ -18120,7 +18089,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
18120
18089
|
allResults.push(...results);
|
|
18121
18090
|
start3 += results.length;
|
|
18122
18091
|
process.stderr.write(
|
|
18123
|
-
`\r${
|
|
18092
|
+
`\r${chalk165.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
18124
18093
|
);
|
|
18125
18094
|
if (start3 >= totalResults) break;
|
|
18126
18095
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -18135,7 +18104,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
18135
18104
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
18136
18105
|
const resolved = resolveArgs(connectionName, collection);
|
|
18137
18106
|
if (!resolved.collection && !options2.query) {
|
|
18138
|
-
console.error(
|
|
18107
|
+
console.error(chalk166.red("Provide a collection name or --query filter."));
|
|
18139
18108
|
process.exit(1);
|
|
18140
18109
|
}
|
|
18141
18110
|
const { collection: col } = resolved;
|
|
@@ -18174,7 +18143,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
18174
18143
|
import * as path34 from "path";
|
|
18175
18144
|
|
|
18176
18145
|
// src/commands/refactor/logViolations.ts
|
|
18177
|
-
import
|
|
18146
|
+
import chalk167 from "chalk";
|
|
18178
18147
|
var DEFAULT_MAX_LINES = 100;
|
|
18179
18148
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
18180
18149
|
if (violations.length === 0) {
|
|
@@ -18183,43 +18152,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
18183
18152
|
}
|
|
18184
18153
|
return;
|
|
18185
18154
|
}
|
|
18186
|
-
console.error(
|
|
18155
|
+
console.error(chalk167.red(`
|
|
18187
18156
|
Refactor check failed:
|
|
18188
18157
|
`));
|
|
18189
|
-
console.error(
|
|
18158
|
+
console.error(chalk167.red(` The following files exceed ${maxLines} lines:
|
|
18190
18159
|
`));
|
|
18191
18160
|
for (const violation of violations) {
|
|
18192
|
-
console.error(
|
|
18161
|
+
console.error(chalk167.red(` ${violation.file} (${violation.lines} lines)`));
|
|
18193
18162
|
}
|
|
18194
18163
|
console.error(
|
|
18195
|
-
|
|
18164
|
+
chalk167.yellow(
|
|
18196
18165
|
`
|
|
18197
18166
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
18198
18167
|
way to refactor it, ignore it with:
|
|
18199
18168
|
`
|
|
18200
18169
|
)
|
|
18201
18170
|
);
|
|
18202
|
-
console.error(
|
|
18171
|
+
console.error(chalk167.gray(` assist refactor ignore <file>
|
|
18203
18172
|
`));
|
|
18204
18173
|
if (process.env.CLAUDECODE) {
|
|
18205
|
-
console.error(
|
|
18174
|
+
console.error(chalk167.cyan(`
|
|
18206
18175
|
## Extracting Code to New Files
|
|
18207
18176
|
`));
|
|
18208
18177
|
console.error(
|
|
18209
|
-
|
|
18178
|
+
chalk167.cyan(
|
|
18210
18179
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
18211
18180
|
`
|
|
18212
18181
|
)
|
|
18213
18182
|
);
|
|
18214
18183
|
console.error(
|
|
18215
|
-
|
|
18184
|
+
chalk167.cyan(
|
|
18216
18185
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
18217
18186
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
18218
18187
|
`
|
|
18219
18188
|
)
|
|
18220
18189
|
);
|
|
18221
18190
|
console.error(
|
|
18222
|
-
|
|
18191
|
+
chalk167.cyan(
|
|
18223
18192
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
18224
18193
|
domains, move it to a common/shared folder.
|
|
18225
18194
|
`
|
|
@@ -18375,7 +18344,7 @@ async function check(pattern2, options2) {
|
|
|
18375
18344
|
|
|
18376
18345
|
// src/commands/refactor/extract/index.ts
|
|
18377
18346
|
import path41 from "path";
|
|
18378
|
-
import
|
|
18347
|
+
import chalk170 from "chalk";
|
|
18379
18348
|
|
|
18380
18349
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
18381
18350
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -18649,8 +18618,8 @@ function findTarget(sourceFile, name) {
|
|
|
18649
18618
|
for (const stmt of sourceFile.getVariableStatements()) {
|
|
18650
18619
|
for (const decl of stmt.getDeclarations()) {
|
|
18651
18620
|
if (decl.getName() !== name) continue;
|
|
18652
|
-
const
|
|
18653
|
-
const kind =
|
|
18621
|
+
const init7 = decl.getInitializer();
|
|
18622
|
+
const kind = init7?.getKind();
|
|
18654
18623
|
if (kind === SyntaxKind10.ArrowFunction || kind === SyntaxKind10.FunctionExpression) {
|
|
18655
18624
|
return stmt;
|
|
18656
18625
|
}
|
|
@@ -18974,23 +18943,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
18974
18943
|
|
|
18975
18944
|
// src/commands/refactor/extract/displayPlan.ts
|
|
18976
18945
|
import path38 from "path";
|
|
18977
|
-
import
|
|
18946
|
+
import chalk168 from "chalk";
|
|
18978
18947
|
function section2(title) {
|
|
18979
18948
|
return `
|
|
18980
|
-
${
|
|
18949
|
+
${chalk168.cyan(title)}`;
|
|
18981
18950
|
}
|
|
18982
18951
|
function displayImporters(plan2, cwd) {
|
|
18983
18952
|
if (plan2.importersToUpdate.length === 0) return;
|
|
18984
18953
|
console.log(section2("Update importers:"));
|
|
18985
18954
|
for (const imp of plan2.importersToUpdate) {
|
|
18986
18955
|
const rel = path38.relative(cwd, imp.file.getFilePath());
|
|
18987
|
-
console.log(` ${
|
|
18956
|
+
console.log(` ${chalk168.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
18988
18957
|
}
|
|
18989
18958
|
}
|
|
18990
18959
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
18991
|
-
console.log(
|
|
18960
|
+
console.log(chalk168.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
18992
18961
|
`));
|
|
18993
|
-
console.log(` ${
|
|
18962
|
+
console.log(` ${chalk168.cyan("Functions to move:")}`);
|
|
18994
18963
|
for (const name of plan2.extractedNames) {
|
|
18995
18964
|
console.log(` ${name}`);
|
|
18996
18965
|
}
|
|
@@ -19024,7 +18993,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
19024
18993
|
|
|
19025
18994
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
19026
18995
|
import path40 from "path";
|
|
19027
|
-
import
|
|
18996
|
+
import chalk169 from "chalk";
|
|
19028
18997
|
import { Project as Project4 } from "ts-morph";
|
|
19029
18998
|
|
|
19030
18999
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -19084,7 +19053,7 @@ function loadProjectFile(file) {
|
|
|
19084
19053
|
});
|
|
19085
19054
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
19086
19055
|
if (!sourceFile) {
|
|
19087
|
-
console.log(
|
|
19056
|
+
console.log(chalk169.red(`File not found in project: ${file}`));
|
|
19088
19057
|
process.exit(1);
|
|
19089
19058
|
}
|
|
19090
19059
|
return { project, sourceFile };
|
|
@@ -19107,19 +19076,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
19107
19076
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
19108
19077
|
if (options2.apply) {
|
|
19109
19078
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
19110
|
-
console.log(
|
|
19079
|
+
console.log(chalk170.green("\nExtraction complete"));
|
|
19111
19080
|
} else {
|
|
19112
|
-
console.log(
|
|
19081
|
+
console.log(chalk170.dim("\nDry run. Use --apply to execute."));
|
|
19113
19082
|
}
|
|
19114
19083
|
}
|
|
19115
19084
|
|
|
19116
19085
|
// src/commands/refactor/ignore.ts
|
|
19117
19086
|
import fs27 from "fs";
|
|
19118
|
-
import
|
|
19087
|
+
import chalk171 from "chalk";
|
|
19119
19088
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
19120
19089
|
function ignore2(file) {
|
|
19121
19090
|
if (!fs27.existsSync(file)) {
|
|
19122
|
-
console.error(
|
|
19091
|
+
console.error(chalk171.red(`Error: File does not exist: ${file}`));
|
|
19123
19092
|
process.exit(1);
|
|
19124
19093
|
}
|
|
19125
19094
|
const content = fs27.readFileSync(file, "utf8");
|
|
@@ -19135,7 +19104,7 @@ function ignore2(file) {
|
|
|
19135
19104
|
fs27.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
19136
19105
|
}
|
|
19137
19106
|
console.log(
|
|
19138
|
-
|
|
19107
|
+
chalk171.green(
|
|
19139
19108
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
19140
19109
|
)
|
|
19141
19110
|
);
|
|
@@ -19144,12 +19113,12 @@ function ignore2(file) {
|
|
|
19144
19113
|
// src/commands/refactor/rename/index.ts
|
|
19145
19114
|
import fs30 from "fs";
|
|
19146
19115
|
import path46 from "path";
|
|
19147
|
-
import
|
|
19116
|
+
import chalk174 from "chalk";
|
|
19148
19117
|
|
|
19149
19118
|
// src/commands/refactor/rename/applyRename.ts
|
|
19150
19119
|
import fs29 from "fs";
|
|
19151
19120
|
import path43 from "path";
|
|
19152
|
-
import
|
|
19121
|
+
import chalk172 from "chalk";
|
|
19153
19122
|
|
|
19154
19123
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
19155
19124
|
import path42 from "path";
|
|
@@ -19254,13 +19223,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
19254
19223
|
const updatedContents = applyRewrites(rewrites);
|
|
19255
19224
|
for (const [file, content] of updatedContents) {
|
|
19256
19225
|
fs29.writeFileSync(file, content, "utf8");
|
|
19257
|
-
console.log(
|
|
19226
|
+
console.log(chalk172.cyan(` Updated imports in ${path43.relative(cwd, file)}`));
|
|
19258
19227
|
}
|
|
19259
19228
|
const destDir = path43.dirname(destPath);
|
|
19260
19229
|
if (!fs29.existsSync(destDir)) fs29.mkdirSync(destDir, { recursive: true });
|
|
19261
19230
|
fs29.renameSync(sourcePath, destPath);
|
|
19262
19231
|
console.log(
|
|
19263
|
-
|
|
19232
|
+
chalk172.white(
|
|
19264
19233
|
` Moved ${path43.relative(cwd, sourcePath)} \u2192 ${path43.relative(cwd, destPath)}`
|
|
19265
19234
|
)
|
|
19266
19235
|
);
|
|
@@ -19347,16 +19316,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
19347
19316
|
|
|
19348
19317
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
19349
19318
|
import path45 from "path";
|
|
19350
|
-
import
|
|
19319
|
+
import chalk173 from "chalk";
|
|
19351
19320
|
function printRenamePreview(rewrites, cwd) {
|
|
19352
19321
|
for (const rewrite of rewrites) {
|
|
19353
19322
|
console.log(
|
|
19354
|
-
|
|
19323
|
+
chalk173.dim(
|
|
19355
19324
|
` ${path45.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
19356
19325
|
)
|
|
19357
19326
|
);
|
|
19358
19327
|
}
|
|
19359
|
-
console.log(
|
|
19328
|
+
console.log(chalk173.dim("Dry run. Use --apply to execute."));
|
|
19360
19329
|
}
|
|
19361
19330
|
|
|
19362
19331
|
// src/commands/refactor/rename/index.ts
|
|
@@ -19367,20 +19336,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
19367
19336
|
const relSource = path46.relative(cwd, sourcePath);
|
|
19368
19337
|
const relDest = path46.relative(cwd, destPath);
|
|
19369
19338
|
if (!fs30.existsSync(sourcePath)) {
|
|
19370
|
-
console.log(
|
|
19339
|
+
console.log(chalk174.red(`File not found: ${source}`));
|
|
19371
19340
|
process.exit(1);
|
|
19372
19341
|
}
|
|
19373
19342
|
if (destPath !== sourcePath && fs30.existsSync(destPath)) {
|
|
19374
|
-
console.log(
|
|
19343
|
+
console.log(chalk174.red(`Destination already exists: ${destination}`));
|
|
19375
19344
|
process.exit(1);
|
|
19376
19345
|
}
|
|
19377
|
-
console.log(
|
|
19378
|
-
console.log(
|
|
19379
|
-
console.log(
|
|
19346
|
+
console.log(chalk174.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
19347
|
+
console.log(chalk174.dim("Loading project..."));
|
|
19348
|
+
console.log(chalk174.dim("Scanning imports across the project..."));
|
|
19380
19349
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
19381
19350
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
19382
19351
|
console.log(
|
|
19383
|
-
|
|
19352
|
+
chalk174.dim(
|
|
19384
19353
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
19385
19354
|
)
|
|
19386
19355
|
);
|
|
@@ -19389,11 +19358,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
19389
19358
|
return;
|
|
19390
19359
|
}
|
|
19391
19360
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
19392
|
-
console.log(
|
|
19361
|
+
console.log(chalk174.green("Done"));
|
|
19393
19362
|
}
|
|
19394
19363
|
|
|
19395
19364
|
// src/commands/refactor/renameSymbol/index.ts
|
|
19396
|
-
import
|
|
19365
|
+
import chalk175 from "chalk";
|
|
19397
19366
|
|
|
19398
19367
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
19399
19368
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -19439,33 +19408,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
19439
19408
|
const { project, sourceFile } = loadProjectFile(file);
|
|
19440
19409
|
const symbol = findSymbol(sourceFile, oldName);
|
|
19441
19410
|
if (!symbol) {
|
|
19442
|
-
console.log(
|
|
19411
|
+
console.log(chalk175.red(`Symbol "${oldName}" not found in ${file}`));
|
|
19443
19412
|
process.exit(1);
|
|
19444
19413
|
}
|
|
19445
19414
|
const grouped = groupReferences(symbol, cwd);
|
|
19446
19415
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
19447
19416
|
console.log(
|
|
19448
|
-
|
|
19417
|
+
chalk175.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
19449
19418
|
`)
|
|
19450
19419
|
);
|
|
19451
19420
|
for (const [refFile, lines] of grouped) {
|
|
19452
19421
|
console.log(
|
|
19453
|
-
` ${
|
|
19422
|
+
` ${chalk175.dim(refFile)}: lines ${chalk175.cyan(lines.join(", "))}`
|
|
19454
19423
|
);
|
|
19455
19424
|
}
|
|
19456
19425
|
if (options2.apply) {
|
|
19457
19426
|
symbol.rename(newName);
|
|
19458
19427
|
await project.save();
|
|
19459
|
-
console.log(
|
|
19428
|
+
console.log(chalk175.green(`
|
|
19460
19429
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
19461
19430
|
} else {
|
|
19462
|
-
console.log(
|
|
19431
|
+
console.log(chalk175.dim("\nDry run. Use --apply to execute."));
|
|
19463
19432
|
}
|
|
19464
19433
|
}
|
|
19465
19434
|
|
|
19466
19435
|
// src/commands/refactor/restructure/index.ts
|
|
19467
19436
|
import path54 from "path";
|
|
19468
|
-
import
|
|
19437
|
+
import chalk178 from "chalk";
|
|
19469
19438
|
|
|
19470
19439
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
19471
19440
|
import path48 from "path";
|
|
@@ -19544,50 +19513,50 @@ function clusterFiles(graph) {
|
|
|
19544
19513
|
|
|
19545
19514
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
19546
19515
|
import path50 from "path";
|
|
19547
|
-
import
|
|
19516
|
+
import chalk176 from "chalk";
|
|
19548
19517
|
function relPath(filePath) {
|
|
19549
19518
|
return path50.relative(process.cwd(), filePath);
|
|
19550
19519
|
}
|
|
19551
19520
|
function displayMoves(plan2) {
|
|
19552
19521
|
if (plan2.moves.length === 0) return;
|
|
19553
|
-
console.log(
|
|
19522
|
+
console.log(chalk176.bold("\nFile moves:"));
|
|
19554
19523
|
for (const move2 of plan2.moves) {
|
|
19555
19524
|
console.log(
|
|
19556
|
-
` ${
|
|
19525
|
+
` ${chalk176.red(relPath(move2.from))} \u2192 ${chalk176.green(relPath(move2.to))}`
|
|
19557
19526
|
);
|
|
19558
|
-
console.log(
|
|
19527
|
+
console.log(chalk176.dim(` ${move2.reason}`));
|
|
19559
19528
|
}
|
|
19560
19529
|
}
|
|
19561
19530
|
function displayRewrites(rewrites) {
|
|
19562
19531
|
if (rewrites.length === 0) return;
|
|
19563
19532
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
19564
|
-
console.log(
|
|
19533
|
+
console.log(chalk176.bold(`
|
|
19565
19534
|
Import rewrites (${affectedFiles.size} files):`));
|
|
19566
19535
|
for (const file of affectedFiles) {
|
|
19567
|
-
console.log(` ${
|
|
19536
|
+
console.log(` ${chalk176.cyan(relPath(file))}:`);
|
|
19568
19537
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
19569
19538
|
(r) => r.file === file
|
|
19570
19539
|
)) {
|
|
19571
19540
|
console.log(
|
|
19572
|
-
` ${
|
|
19541
|
+
` ${chalk176.red(`"${oldSpecifier}"`)} \u2192 ${chalk176.green(`"${newSpecifier}"`)}`
|
|
19573
19542
|
);
|
|
19574
19543
|
}
|
|
19575
19544
|
}
|
|
19576
19545
|
}
|
|
19577
19546
|
function displayPlan2(plan2) {
|
|
19578
19547
|
if (plan2.warnings.length > 0) {
|
|
19579
|
-
console.log(
|
|
19580
|
-
for (const w of plan2.warnings) console.log(
|
|
19548
|
+
console.log(chalk176.yellow("\nWarnings:"));
|
|
19549
|
+
for (const w of plan2.warnings) console.log(chalk176.yellow(` ${w}`));
|
|
19581
19550
|
}
|
|
19582
19551
|
if (plan2.newDirectories.length > 0) {
|
|
19583
|
-
console.log(
|
|
19552
|
+
console.log(chalk176.bold("\nNew directories:"));
|
|
19584
19553
|
for (const dir of plan2.newDirectories)
|
|
19585
|
-
console.log(
|
|
19554
|
+
console.log(chalk176.green(` ${dir}/`));
|
|
19586
19555
|
}
|
|
19587
19556
|
displayMoves(plan2);
|
|
19588
19557
|
displayRewrites(plan2.rewrites);
|
|
19589
19558
|
console.log(
|
|
19590
|
-
|
|
19559
|
+
chalk176.dim(
|
|
19591
19560
|
`
|
|
19592
19561
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
19593
19562
|
)
|
|
@@ -19597,18 +19566,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
19597
19566
|
// src/commands/refactor/restructure/executePlan.ts
|
|
19598
19567
|
import fs31 from "fs";
|
|
19599
19568
|
import path51 from "path";
|
|
19600
|
-
import
|
|
19569
|
+
import chalk177 from "chalk";
|
|
19601
19570
|
function executePlan(plan2) {
|
|
19602
19571
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
19603
19572
|
for (const [file, content] of updatedContents) {
|
|
19604
19573
|
fs31.writeFileSync(file, content, "utf8");
|
|
19605
19574
|
console.log(
|
|
19606
|
-
|
|
19575
|
+
chalk177.cyan(` Rewrote imports in ${path51.relative(process.cwd(), file)}`)
|
|
19607
19576
|
);
|
|
19608
19577
|
}
|
|
19609
19578
|
for (const dir of plan2.newDirectories) {
|
|
19610
19579
|
fs31.mkdirSync(dir, { recursive: true });
|
|
19611
|
-
console.log(
|
|
19580
|
+
console.log(chalk177.green(` Created ${path51.relative(process.cwd(), dir)}/`));
|
|
19612
19581
|
}
|
|
19613
19582
|
for (const move2 of plan2.moves) {
|
|
19614
19583
|
const targetDir = path51.dirname(move2.to);
|
|
@@ -19617,7 +19586,7 @@ function executePlan(plan2) {
|
|
|
19617
19586
|
}
|
|
19618
19587
|
fs31.renameSync(move2.from, move2.to);
|
|
19619
19588
|
console.log(
|
|
19620
|
-
|
|
19589
|
+
chalk177.white(
|
|
19621
19590
|
` Moved ${path51.relative(process.cwd(), move2.from)} \u2192 ${path51.relative(process.cwd(), move2.to)}`
|
|
19622
19591
|
)
|
|
19623
19592
|
);
|
|
@@ -19632,7 +19601,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
19632
19601
|
if (entries.length === 0) {
|
|
19633
19602
|
fs31.rmdirSync(dir);
|
|
19634
19603
|
console.log(
|
|
19635
|
-
|
|
19604
|
+
chalk177.dim(
|
|
19636
19605
|
` Removed empty directory ${path51.relative(process.cwd(), dir)}`
|
|
19637
19606
|
)
|
|
19638
19607
|
);
|
|
@@ -19765,22 +19734,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
19765
19734
|
const targetPattern = pattern2 ?? "src";
|
|
19766
19735
|
const files = findSourceFiles2(targetPattern);
|
|
19767
19736
|
if (files.length === 0) {
|
|
19768
|
-
console.log(
|
|
19737
|
+
console.log(chalk178.yellow("No files found matching pattern"));
|
|
19769
19738
|
return;
|
|
19770
19739
|
}
|
|
19771
19740
|
const tsConfigPath = path54.resolve("tsconfig.json");
|
|
19772
19741
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
19773
19742
|
if (plan2.moves.length === 0) {
|
|
19774
|
-
console.log(
|
|
19743
|
+
console.log(chalk178.green("No restructuring needed"));
|
|
19775
19744
|
return;
|
|
19776
19745
|
}
|
|
19777
19746
|
displayPlan2(plan2);
|
|
19778
19747
|
if (options2.apply) {
|
|
19779
|
-
console.log(
|
|
19748
|
+
console.log(chalk178.bold("\nApplying changes..."));
|
|
19780
19749
|
executePlan(plan2);
|
|
19781
|
-
console.log(
|
|
19750
|
+
console.log(chalk178.green("\nRestructuring complete"));
|
|
19782
19751
|
} else {
|
|
19783
|
-
console.log(
|
|
19752
|
+
console.log(chalk178.dim("\nDry run. Use --apply to execute."));
|
|
19784
19753
|
}
|
|
19785
19754
|
}
|
|
19786
19755
|
|
|
@@ -20363,18 +20332,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
20363
20332
|
}
|
|
20364
20333
|
|
|
20365
20334
|
// src/commands/review/warnOutOfDiff.ts
|
|
20366
|
-
import
|
|
20335
|
+
import chalk179 from "chalk";
|
|
20367
20336
|
function warnOutOfDiff(outOfDiff) {
|
|
20368
20337
|
if (outOfDiff.length === 0) return;
|
|
20369
20338
|
console.warn(
|
|
20370
|
-
|
|
20339
|
+
chalk179.yellow(
|
|
20371
20340
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
20372
20341
|
)
|
|
20373
20342
|
);
|
|
20374
20343
|
for (const finding of outOfDiff) {
|
|
20375
20344
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
20376
20345
|
console.warn(
|
|
20377
|
-
` ${
|
|
20346
|
+
` ${chalk179.yellow("\xB7")} ${finding.title} ${chalk179.dim(
|
|
20378
20347
|
`(${finding.file}:${range})`
|
|
20379
20348
|
)}`
|
|
20380
20349
|
);
|
|
@@ -20393,18 +20362,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
20393
20362
|
}
|
|
20394
20363
|
|
|
20395
20364
|
// src/commands/review/warnUnlocated.ts
|
|
20396
|
-
import
|
|
20365
|
+
import chalk180 from "chalk";
|
|
20397
20366
|
function warnUnlocated(unlocated) {
|
|
20398
20367
|
if (unlocated.length === 0) return;
|
|
20399
20368
|
console.warn(
|
|
20400
|
-
|
|
20369
|
+
chalk180.yellow(
|
|
20401
20370
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
20402
20371
|
)
|
|
20403
20372
|
);
|
|
20404
20373
|
for (const finding of unlocated) {
|
|
20405
|
-
const where = finding.location ||
|
|
20374
|
+
const where = finding.location || chalk180.dim("missing");
|
|
20406
20375
|
console.warn(
|
|
20407
|
-
` ${
|
|
20376
|
+
` ${chalk180.yellow("\xB7")} ${finding.title} ${chalk180.dim(`(${where})`)}`
|
|
20408
20377
|
);
|
|
20409
20378
|
}
|
|
20410
20379
|
}
|
|
@@ -21576,7 +21545,7 @@ function registerReview(program2) {
|
|
|
21576
21545
|
}
|
|
21577
21546
|
|
|
21578
21547
|
// src/commands/seq/seqAuth.ts
|
|
21579
|
-
import
|
|
21548
|
+
import chalk182 from "chalk";
|
|
21580
21549
|
|
|
21581
21550
|
// src/commands/seq/loadConnections.ts
|
|
21582
21551
|
function loadConnections2() {
|
|
@@ -21605,10 +21574,10 @@ function setDefaultConnection(name) {
|
|
|
21605
21574
|
}
|
|
21606
21575
|
|
|
21607
21576
|
// src/shared/assertUniqueName.ts
|
|
21608
|
-
import
|
|
21577
|
+
import chalk181 from "chalk";
|
|
21609
21578
|
function assertUniqueName(existingNames, name) {
|
|
21610
21579
|
if (existingNames.includes(name)) {
|
|
21611
|
-
console.error(
|
|
21580
|
+
console.error(chalk181.red(`Connection "${name}" already exists.`));
|
|
21612
21581
|
process.exit(1);
|
|
21613
21582
|
}
|
|
21614
21583
|
}
|
|
@@ -21626,7 +21595,7 @@ async function promptConnection2(existingNames) {
|
|
|
21626
21595
|
var seqAuth = createConnectionAuth({
|
|
21627
21596
|
load: loadConnections2,
|
|
21628
21597
|
save: saveConnections2,
|
|
21629
|
-
format: (c) => `${
|
|
21598
|
+
format: (c) => `${chalk182.bold(c.name)} ${c.url}`,
|
|
21630
21599
|
promptNew: promptConnection2,
|
|
21631
21600
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
21632
21601
|
});
|
|
@@ -21646,10 +21615,10 @@ var seqConfigHelp = [
|
|
|
21646
21615
|
];
|
|
21647
21616
|
|
|
21648
21617
|
// src/commands/seq/seqQuery.ts
|
|
21649
|
-
import
|
|
21618
|
+
import chalk186 from "chalk";
|
|
21650
21619
|
|
|
21651
21620
|
// src/commands/seq/fetchSeq.ts
|
|
21652
|
-
import
|
|
21621
|
+
import chalk183 from "chalk";
|
|
21653
21622
|
async function fetchSeq(conn, path67, params) {
|
|
21654
21623
|
const url = `${conn.url}${path67}?${params}`;
|
|
21655
21624
|
const response = await fetch(url, {
|
|
@@ -21660,7 +21629,7 @@ async function fetchSeq(conn, path67, params) {
|
|
|
21660
21629
|
});
|
|
21661
21630
|
if (!response.ok) {
|
|
21662
21631
|
const body = await response.text();
|
|
21663
|
-
console.error(
|
|
21632
|
+
console.error(chalk183.red(`Seq returned ${response.status}: ${body}`));
|
|
21664
21633
|
process.exit(1);
|
|
21665
21634
|
}
|
|
21666
21635
|
return response;
|
|
@@ -21719,23 +21688,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
21719
21688
|
}
|
|
21720
21689
|
|
|
21721
21690
|
// src/commands/seq/formatEvent.ts
|
|
21722
|
-
import
|
|
21691
|
+
import chalk184 from "chalk";
|
|
21723
21692
|
function levelColor(level) {
|
|
21724
21693
|
switch (level) {
|
|
21725
21694
|
case "Fatal":
|
|
21726
|
-
return
|
|
21695
|
+
return chalk184.bgRed.white;
|
|
21727
21696
|
case "Error":
|
|
21728
|
-
return
|
|
21697
|
+
return chalk184.red;
|
|
21729
21698
|
case "Warning":
|
|
21730
|
-
return
|
|
21699
|
+
return chalk184.yellow;
|
|
21731
21700
|
case "Information":
|
|
21732
|
-
return
|
|
21701
|
+
return chalk184.cyan;
|
|
21733
21702
|
case "Debug":
|
|
21734
|
-
return
|
|
21703
|
+
return chalk184.gray;
|
|
21735
21704
|
case "Verbose":
|
|
21736
|
-
return
|
|
21705
|
+
return chalk184.dim;
|
|
21737
21706
|
default:
|
|
21738
|
-
return
|
|
21707
|
+
return chalk184.white;
|
|
21739
21708
|
}
|
|
21740
21709
|
}
|
|
21741
21710
|
function levelAbbrev(level) {
|
|
@@ -21776,12 +21745,12 @@ function formatTimestamp(iso) {
|
|
|
21776
21745
|
function formatEvent(event) {
|
|
21777
21746
|
const color = levelColor(event.Level);
|
|
21778
21747
|
const abbrev = levelAbbrev(event.Level);
|
|
21779
|
-
const ts8 =
|
|
21748
|
+
const ts8 = chalk184.dim(formatTimestamp(event.Timestamp));
|
|
21780
21749
|
const msg = renderMessage(event);
|
|
21781
21750
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
21782
21751
|
if (event.Exception) {
|
|
21783
21752
|
for (const line of event.Exception.split("\n")) {
|
|
21784
|
-
lines.push(
|
|
21753
|
+
lines.push(chalk184.red(` ${line}`));
|
|
21785
21754
|
}
|
|
21786
21755
|
}
|
|
21787
21756
|
return lines.join("\n");
|
|
@@ -21814,11 +21783,11 @@ function rejectTimestampFilter(filter) {
|
|
|
21814
21783
|
}
|
|
21815
21784
|
|
|
21816
21785
|
// src/shared/resolveNamedConnection.ts
|
|
21817
|
-
import
|
|
21786
|
+
import chalk185 from "chalk";
|
|
21818
21787
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
21819
21788
|
if (connections.length === 0) {
|
|
21820
21789
|
console.error(
|
|
21821
|
-
|
|
21790
|
+
chalk185.red(
|
|
21822
21791
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
21823
21792
|
)
|
|
21824
21793
|
);
|
|
@@ -21827,7 +21796,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
21827
21796
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
21828
21797
|
const connection = connections.find((c) => c.name === target);
|
|
21829
21798
|
if (!connection) {
|
|
21830
|
-
console.error(
|
|
21799
|
+
console.error(chalk185.red(`${kind} connection "${target}" not found.`));
|
|
21831
21800
|
process.exit(1);
|
|
21832
21801
|
}
|
|
21833
21802
|
return connection;
|
|
@@ -21856,7 +21825,7 @@ async function seqQuery(filter, options2) {
|
|
|
21856
21825
|
new URLSearchParams({ filter, count: String(count7) })
|
|
21857
21826
|
);
|
|
21858
21827
|
if (events.length === 0) {
|
|
21859
|
-
console.log(
|
|
21828
|
+
console.log(chalk186.yellow("No events found."));
|
|
21860
21829
|
return;
|
|
21861
21830
|
}
|
|
21862
21831
|
if (options2.json) {
|
|
@@ -21867,11 +21836,11 @@ async function seqQuery(filter, options2) {
|
|
|
21867
21836
|
for (const event of chronological) {
|
|
21868
21837
|
console.log(formatEvent(event));
|
|
21869
21838
|
}
|
|
21870
|
-
console.log(
|
|
21839
|
+
console.log(chalk186.dim(`
|
|
21871
21840
|
${events.length} events`));
|
|
21872
21841
|
if (events.length >= count7) {
|
|
21873
21842
|
console.log(
|
|
21874
|
-
|
|
21843
|
+
chalk186.yellow(
|
|
21875
21844
|
`Results limited to ${count7}. Use --count to retrieve more.`
|
|
21876
21845
|
)
|
|
21877
21846
|
);
|
|
@@ -21879,10 +21848,10 @@ ${events.length} events`));
|
|
|
21879
21848
|
}
|
|
21880
21849
|
|
|
21881
21850
|
// src/shared/setNamedDefaultConnection.ts
|
|
21882
|
-
import
|
|
21851
|
+
import chalk187 from "chalk";
|
|
21883
21852
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
21884
21853
|
if (!connections.find((c) => c.name === name)) {
|
|
21885
|
-
console.error(
|
|
21854
|
+
console.error(chalk187.red(`Connection "${name}" not found.`));
|
|
21886
21855
|
process.exit(1);
|
|
21887
21856
|
}
|
|
21888
21857
|
setDefault(name);
|
|
@@ -21931,7 +21900,7 @@ function registerSignal(program2) {
|
|
|
21931
21900
|
}
|
|
21932
21901
|
|
|
21933
21902
|
// src/commands/sql/sqlAuth.ts
|
|
21934
|
-
import
|
|
21903
|
+
import chalk189 from "chalk";
|
|
21935
21904
|
|
|
21936
21905
|
// src/commands/sql/loadConnections.ts
|
|
21937
21906
|
function loadConnections3() {
|
|
@@ -21960,7 +21929,7 @@ function setDefaultConnection2(name) {
|
|
|
21960
21929
|
}
|
|
21961
21930
|
|
|
21962
21931
|
// src/commands/sql/promptConnection.ts
|
|
21963
|
-
import
|
|
21932
|
+
import chalk188 from "chalk";
|
|
21964
21933
|
async function promptConnection3(existingNames) {
|
|
21965
21934
|
const name = await promptInput("name", "Connection name:", "default");
|
|
21966
21935
|
assertUniqueName(existingNames, name);
|
|
@@ -21968,7 +21937,7 @@ async function promptConnection3(existingNames) {
|
|
|
21968
21937
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
21969
21938
|
const port = Number.parseInt(portStr, 10);
|
|
21970
21939
|
if (!Number.isFinite(port)) {
|
|
21971
|
-
console.error(
|
|
21940
|
+
console.error(chalk188.red(`Invalid port "${portStr}".`));
|
|
21972
21941
|
process.exit(1);
|
|
21973
21942
|
}
|
|
21974
21943
|
const user = await promptInput("user", "User:");
|
|
@@ -21981,13 +21950,13 @@ async function promptConnection3(existingNames) {
|
|
|
21981
21950
|
var sqlAuth = createConnectionAuth({
|
|
21982
21951
|
load: loadConnections3,
|
|
21983
21952
|
save: saveConnections3,
|
|
21984
|
-
format: (c) => `${
|
|
21953
|
+
format: (c) => `${chalk189.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
21985
21954
|
promptNew: promptConnection3,
|
|
21986
21955
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
21987
21956
|
});
|
|
21988
21957
|
|
|
21989
21958
|
// src/commands/sql/printTable.ts
|
|
21990
|
-
import
|
|
21959
|
+
import chalk190 from "chalk";
|
|
21991
21960
|
function formatCell(value) {
|
|
21992
21961
|
if (value === null || value === void 0) return "";
|
|
21993
21962
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -21996,7 +21965,7 @@ function formatCell(value) {
|
|
|
21996
21965
|
}
|
|
21997
21966
|
function printTable(rows) {
|
|
21998
21967
|
if (rows.length === 0) {
|
|
21999
|
-
console.log(
|
|
21968
|
+
console.log(chalk190.yellow("(no rows)"));
|
|
22000
21969
|
return;
|
|
22001
21970
|
}
|
|
22002
21971
|
const columns = Object.keys(rows[0]);
|
|
@@ -22004,13 +21973,13 @@ function printTable(rows) {
|
|
|
22004
21973
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
22005
21974
|
);
|
|
22006
21975
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
22007
|
-
console.log(
|
|
22008
|
-
console.log(
|
|
21976
|
+
console.log(chalk190.dim(header));
|
|
21977
|
+
console.log(chalk190.dim("-".repeat(header.length)));
|
|
22009
21978
|
for (const row of rows) {
|
|
22010
21979
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
22011
21980
|
console.log(line);
|
|
22012
21981
|
}
|
|
22013
|
-
console.log(
|
|
21982
|
+
console.log(chalk190.dim(`
|
|
22014
21983
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
22015
21984
|
}
|
|
22016
21985
|
|
|
@@ -22084,7 +22053,7 @@ var sqlConfigHelp = [
|
|
|
22084
22053
|
];
|
|
22085
22054
|
|
|
22086
22055
|
// src/commands/sql/sqlMutate.ts
|
|
22087
|
-
import
|
|
22056
|
+
import chalk191 from "chalk";
|
|
22088
22057
|
|
|
22089
22058
|
// src/commands/sql/isMutation.ts
|
|
22090
22059
|
var MUTATION_KEYWORDS = [
|
|
@@ -22118,7 +22087,7 @@ function isMutation(sql23) {
|
|
|
22118
22087
|
async function sqlMutate(query, connectionName) {
|
|
22119
22088
|
if (!isMutation(query)) {
|
|
22120
22089
|
console.error(
|
|
22121
|
-
|
|
22090
|
+
chalk191.red(
|
|
22122
22091
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
22123
22092
|
)
|
|
22124
22093
|
);
|
|
@@ -22128,18 +22097,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
22128
22097
|
const pool = await sqlConnect(conn);
|
|
22129
22098
|
try {
|
|
22130
22099
|
const result = await pool.request().query(query);
|
|
22131
|
-
console.log(
|
|
22100
|
+
console.log(chalk191.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
22132
22101
|
} finally {
|
|
22133
22102
|
await pool.close();
|
|
22134
22103
|
}
|
|
22135
22104
|
}
|
|
22136
22105
|
|
|
22137
22106
|
// src/commands/sql/sqlQuery.ts
|
|
22138
|
-
import
|
|
22107
|
+
import chalk192 from "chalk";
|
|
22139
22108
|
async function sqlQuery(query, connectionName) {
|
|
22140
22109
|
if (isMutation(query)) {
|
|
22141
22110
|
console.error(
|
|
22142
|
-
|
|
22111
|
+
chalk192.red(
|
|
22143
22112
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
22144
22113
|
)
|
|
22145
22114
|
);
|
|
@@ -22154,7 +22123,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
22154
22123
|
printTable(rows);
|
|
22155
22124
|
} else {
|
|
22156
22125
|
console.log(
|
|
22157
|
-
|
|
22126
|
+
chalk192.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
22158
22127
|
);
|
|
22159
22128
|
}
|
|
22160
22129
|
} finally {
|
|
@@ -22585,9 +22554,9 @@ var checks = [
|
|
|
22585
22554
|
action: hardcodedColors
|
|
22586
22555
|
},
|
|
22587
22556
|
{
|
|
22588
|
-
name: "block-comments",
|
|
22557
|
+
name: "block-code-comments",
|
|
22589
22558
|
description: "Fail on any comment on a changed line, whether added or edited",
|
|
22590
|
-
action:
|
|
22559
|
+
action: blockCodeComments
|
|
22591
22560
|
},
|
|
22592
22561
|
{
|
|
22593
22562
|
name: "no-venv",
|
|
@@ -22619,9 +22588,9 @@ function registerVerifyChecks(verifyCommand) {
|
|
|
22619
22588
|
// src/commands/verify/verifyConfigHelp.ts
|
|
22620
22589
|
var verifyConfigHelp = [
|
|
22621
22590
|
{
|
|
22622
|
-
key: "
|
|
22623
|
-
setter: 'assist config set
|
|
22624
|
-
note: "globs exempt from the block-comments check"
|
|
22591
|
+
key: "blockCodeComments.ignore",
|
|
22592
|
+
setter: 'assist config set blockCodeComments.ignore "**/*.test.ts"',
|
|
22593
|
+
note: "globs exempt from the block-code-comments check"
|
|
22625
22594
|
},
|
|
22626
22595
|
{
|
|
22627
22596
|
key: "hardcodedColors.ignore",
|
|
@@ -22969,7 +22938,7 @@ function registerVoice(program2) {
|
|
|
22969
22938
|
|
|
22970
22939
|
// src/commands/roam/auth.ts
|
|
22971
22940
|
import { randomBytes } from "crypto";
|
|
22972
|
-
import
|
|
22941
|
+
import chalk193 from "chalk";
|
|
22973
22942
|
|
|
22974
22943
|
// src/commands/roam/waitForCallback.ts
|
|
22975
22944
|
import { createServer as createServer3 } from "http";
|
|
@@ -23100,13 +23069,13 @@ async function auth() {
|
|
|
23100
23069
|
saveGlobalConfig(config);
|
|
23101
23070
|
const state = randomBytes(16).toString("hex");
|
|
23102
23071
|
console.log(
|
|
23103
|
-
|
|
23072
|
+
chalk193.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
23104
23073
|
);
|
|
23105
|
-
console.log(
|
|
23106
|
-
console.log(
|
|
23107
|
-
console.log(
|
|
23074
|
+
console.log(chalk193.white("http://localhost:14523/callback\n"));
|
|
23075
|
+
console.log(chalk193.blue("Opening browser for authorization..."));
|
|
23076
|
+
console.log(chalk193.dim("Waiting for authorization callback..."));
|
|
23108
23077
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
23109
|
-
console.log(
|
|
23078
|
+
console.log(chalk193.dim("Exchanging code for tokens..."));
|
|
23110
23079
|
const tokens = await exchangeToken({
|
|
23111
23080
|
code,
|
|
23112
23081
|
clientId,
|
|
@@ -23122,7 +23091,7 @@ async function auth() {
|
|
|
23122
23091
|
};
|
|
23123
23092
|
saveGlobalConfig(config);
|
|
23124
23093
|
console.log(
|
|
23125
|
-
|
|
23094
|
+
chalk193.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
23126
23095
|
);
|
|
23127
23096
|
}
|
|
23128
23097
|
|
|
@@ -23665,7 +23634,7 @@ import { execSync as execSync56 } from "child_process";
|
|
|
23665
23634
|
import { existsSync as existsSync52, mkdirSync as mkdirSync23, unlinkSync as unlinkSync19, writeFileSync as writeFileSync40 } from "fs";
|
|
23666
23635
|
import { tmpdir as tmpdir7 } from "os";
|
|
23667
23636
|
import { join as join64, resolve as resolve15 } from "path";
|
|
23668
|
-
import
|
|
23637
|
+
import chalk194 from "chalk";
|
|
23669
23638
|
|
|
23670
23639
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
23671
23640
|
var captureWindowPs1 = `
|
|
@@ -23816,13 +23785,13 @@ function screenshot(processName) {
|
|
|
23816
23785
|
const config = loadConfig();
|
|
23817
23786
|
const outputDir = resolve15(config.screenshot.outputDir);
|
|
23818
23787
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
23819
|
-
console.log(
|
|
23788
|
+
console.log(chalk194.gray(`Capturing window for process "${processName}" ...`));
|
|
23820
23789
|
try {
|
|
23821
23790
|
runPowerShellScript(processName, outputPath);
|
|
23822
|
-
console.log(
|
|
23791
|
+
console.log(chalk194.green(`Screenshot saved: ${outputPath}`));
|
|
23823
23792
|
} catch (error) {
|
|
23824
23793
|
const msg = error instanceof Error ? error.message : String(error);
|
|
23825
|
-
console.error(
|
|
23794
|
+
console.error(chalk194.red(`Failed to capture screenshot: ${msg}`));
|
|
23826
23795
|
process.exit(1);
|
|
23827
23796
|
}
|
|
23828
23797
|
}
|
|
@@ -24715,7 +24684,7 @@ async function recordPhaseTranscriptUsage(db, itemId2, phaseIdx, responses) {
|
|
|
24715
24684
|
}
|
|
24716
24685
|
|
|
24717
24686
|
// src/shared/db/recordWindowTokens.ts
|
|
24718
|
-
import { and as and21, eq as
|
|
24687
|
+
import { and as and21, eq as eq38, sql as sql22 } from "drizzle-orm";
|
|
24719
24688
|
async function recordWindowTokens(db, window, resetsAt, tokensUp, tokensDown) {
|
|
24720
24689
|
if (tokensUp <= 0 && tokensDown <= 0) return;
|
|
24721
24690
|
await db.update(usagePeaks).set({
|
|
@@ -24723,9 +24692,9 @@ async function recordWindowTokens(db, window, resetsAt, tokensUp, tokensDown) {
|
|
|
24723
24692
|
tokensDown: sql22`${usagePeaks.tokensDown} + ${tokensDown}`
|
|
24724
24693
|
}).where(
|
|
24725
24694
|
and21(
|
|
24726
|
-
|
|
24727
|
-
|
|
24728
|
-
|
|
24695
|
+
eq38(usagePeaks.window, window),
|
|
24696
|
+
eq38(usagePeaks.resetsAt, resetsAt),
|
|
24697
|
+
eq38(usagePeaks.segment, 0)
|
|
24729
24698
|
)
|
|
24730
24699
|
);
|
|
24731
24700
|
}
|
|
@@ -24829,10 +24798,10 @@ function applyReviewPause(session, activity2) {
|
|
|
24829
24798
|
}
|
|
24830
24799
|
|
|
24831
24800
|
// src/shared/db/getPhaseActiveMs.ts
|
|
24832
|
-
import { and as and22, eq as
|
|
24801
|
+
import { and as and22, eq as eq39 } from "drizzle-orm";
|
|
24833
24802
|
async function getPhaseActiveMs(db, itemId2, phaseIdx) {
|
|
24834
24803
|
const [row] = await db.select({ activeMs: phaseUsage.activeMs }).from(phaseUsage).where(
|
|
24835
|
-
and22(
|
|
24804
|
+
and22(eq39(phaseUsage.itemId, itemId2), eq39(phaseUsage.phaseIdx, phaseIdx))
|
|
24836
24805
|
);
|
|
24837
24806
|
return row?.activeMs ?? 0;
|
|
24838
24807
|
}
|
|
@@ -26595,7 +26564,7 @@ function registerDaemon(program2) {
|
|
|
26595
26564
|
|
|
26596
26565
|
// src/commands/sessions/summarise/index.ts
|
|
26597
26566
|
import * as fs38 from "fs";
|
|
26598
|
-
import
|
|
26567
|
+
import chalk195 from "chalk";
|
|
26599
26568
|
|
|
26600
26569
|
// src/commands/sessions/summarise/shared.ts
|
|
26601
26570
|
import * as fs37 from "fs";
|
|
@@ -26669,22 +26638,22 @@ ${firstMessage}`);
|
|
|
26669
26638
|
async function summarise2(options2) {
|
|
26670
26639
|
const files = await discoverSessionFiles();
|
|
26671
26640
|
if (files.length === 0) {
|
|
26672
|
-
console.log(
|
|
26641
|
+
console.log(chalk195.yellow("No sessions found."));
|
|
26673
26642
|
return;
|
|
26674
26643
|
}
|
|
26675
26644
|
const toProcess = selectCandidates(files, options2);
|
|
26676
26645
|
if (toProcess.length === 0) {
|
|
26677
|
-
console.log(
|
|
26646
|
+
console.log(chalk195.green("All sessions already summarised."));
|
|
26678
26647
|
return;
|
|
26679
26648
|
}
|
|
26680
26649
|
console.log(
|
|
26681
|
-
|
|
26650
|
+
chalk195.cyan(
|
|
26682
26651
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
26683
26652
|
)
|
|
26684
26653
|
);
|
|
26685
26654
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
26686
26655
|
console.log(
|
|
26687
|
-
|
|
26656
|
+
chalk195.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk195.yellow(`, ${failed2} skipped`) : "")
|
|
26688
26657
|
);
|
|
26689
26658
|
}
|
|
26690
26659
|
function selectCandidates(files, options2) {
|
|
@@ -26704,16 +26673,16 @@ function processSessions(files) {
|
|
|
26704
26673
|
let failed2 = 0;
|
|
26705
26674
|
for (let i = 0; i < files.length; i++) {
|
|
26706
26675
|
const file = files[i];
|
|
26707
|
-
process.stdout.write(
|
|
26676
|
+
process.stdout.write(chalk195.dim(` [${i + 1}/${files.length}] `));
|
|
26708
26677
|
const summary = summariseSession(file);
|
|
26709
26678
|
if (summary) {
|
|
26710
26679
|
writeSummary(file, summary);
|
|
26711
26680
|
succeeded++;
|
|
26712
|
-
process.stdout.write(`${
|
|
26681
|
+
process.stdout.write(`${chalk195.green("\u2713")} ${summary}
|
|
26713
26682
|
`);
|
|
26714
26683
|
} else {
|
|
26715
26684
|
failed2++;
|
|
26716
|
-
process.stdout.write(` ${
|
|
26685
|
+
process.stdout.write(` ${chalk195.yellow("skip")}
|
|
26717
26686
|
`);
|
|
26718
26687
|
}
|
|
26719
26688
|
}
|
|
@@ -26757,7 +26726,7 @@ function registerSessions(program2) {
|
|
|
26757
26726
|
}
|
|
26758
26727
|
|
|
26759
26728
|
// src/commands/statusLine.ts
|
|
26760
|
-
import
|
|
26729
|
+
import chalk197 from "chalk";
|
|
26761
26730
|
|
|
26762
26731
|
// src/shared/contextLevel.ts
|
|
26763
26732
|
function contextLevel(pct) {
|
|
@@ -26767,7 +26736,7 @@ function contextLevel(pct) {
|
|
|
26767
26736
|
}
|
|
26768
26737
|
|
|
26769
26738
|
// src/commands/buildLimitsSegment.ts
|
|
26770
|
-
import
|
|
26739
|
+
import chalk196 from "chalk";
|
|
26771
26740
|
|
|
26772
26741
|
// src/shared/rateLimitLevel.ts
|
|
26773
26742
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -26798,9 +26767,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
26798
26767
|
|
|
26799
26768
|
// src/commands/buildLimitsSegment.ts
|
|
26800
26769
|
var LEVEL_COLOR = {
|
|
26801
|
-
ok:
|
|
26802
|
-
warn:
|
|
26803
|
-
over:
|
|
26770
|
+
ok: chalk196.green,
|
|
26771
|
+
warn: chalk196.yellow,
|
|
26772
|
+
over: chalk196.red
|
|
26804
26773
|
};
|
|
26805
26774
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
26806
26775
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -26896,7 +26865,7 @@ async function relayUsage(claudeSessionId, transcriptPath, usedPct) {
|
|
|
26896
26865
|
}
|
|
26897
26866
|
|
|
26898
26867
|
// src/commands/statusLine.ts
|
|
26899
|
-
|
|
26868
|
+
chalk197.level = 3;
|
|
26900
26869
|
function formatNumber(num) {
|
|
26901
26870
|
return num.toLocaleString("en-US");
|
|
26902
26871
|
}
|
|
@@ -26904,9 +26873,9 @@ function colorizePercent(pct) {
|
|
|
26904
26873
|
const label2 = `${Math.round(pct)}%`;
|
|
26905
26874
|
switch (contextLevel(pct)) {
|
|
26906
26875
|
case "red":
|
|
26907
|
-
return
|
|
26876
|
+
return chalk197.red(label2);
|
|
26908
26877
|
case "yellow":
|
|
26909
|
-
return
|
|
26878
|
+
return chalk197.yellow(label2);
|
|
26910
26879
|
default:
|
|
26911
26880
|
return label2;
|
|
26912
26881
|
}
|
|
@@ -26919,7 +26888,7 @@ async function statusLine() {
|
|
|
26919
26888
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
26920
26889
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
26921
26890
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
26922
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
26891
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk197.cyan(branch2)} | ` : "";
|
|
26923
26892
|
console.log(
|
|
26924
26893
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
26925
26894
|
);
|
|
@@ -26940,7 +26909,7 @@ import { fileURLToPath as fileURLToPath9 } from "url";
|
|
|
26940
26909
|
// src/commands/sync/syncClaudeMd.ts
|
|
26941
26910
|
import * as fs39 from "fs";
|
|
26942
26911
|
import * as path57 from "path";
|
|
26943
|
-
import
|
|
26912
|
+
import chalk198 from "chalk";
|
|
26944
26913
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
26945
26914
|
const source = path57.join(claudeDir, "CLAUDE.md");
|
|
26946
26915
|
const target = path57.join(targetBase, "CLAUDE.md");
|
|
@@ -26949,12 +26918,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
26949
26918
|
const targetContent = fs39.readFileSync(target, "utf8");
|
|
26950
26919
|
if (sourceContent !== targetContent) {
|
|
26951
26920
|
console.log(
|
|
26952
|
-
|
|
26921
|
+
chalk198.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
26953
26922
|
);
|
|
26954
26923
|
console.log();
|
|
26955
26924
|
printDiff(targetContent, sourceContent);
|
|
26956
26925
|
const confirm = options2?.yes || await promptConfirm(
|
|
26957
|
-
|
|
26926
|
+
chalk198.red("Overwrite existing CLAUDE.md?"),
|
|
26958
26927
|
false
|
|
26959
26928
|
);
|
|
26960
26929
|
if (!confirm) {
|
|
@@ -27148,7 +27117,7 @@ function syncPi(claudeDir) {
|
|
|
27148
27117
|
// src/commands/sync/syncSettings.ts
|
|
27149
27118
|
import * as fs44 from "fs";
|
|
27150
27119
|
import * as path64 from "path";
|
|
27151
|
-
import
|
|
27120
|
+
import chalk199 from "chalk";
|
|
27152
27121
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
27153
27122
|
const source = path64.join(claudeDir, "settings.json");
|
|
27154
27123
|
const target = path64.join(targetBase, "settings.json");
|
|
@@ -27167,14 +27136,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
27167
27136
|
if (mergedContent !== normalizedTarget) {
|
|
27168
27137
|
if (!options2?.yes) {
|
|
27169
27138
|
console.log(
|
|
27170
|
-
|
|
27139
|
+
chalk199.yellow(
|
|
27171
27140
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
27172
27141
|
)
|
|
27173
27142
|
);
|
|
27174
27143
|
console.log();
|
|
27175
27144
|
printDiff(targetContent, mergedContent);
|
|
27176
27145
|
const confirm = await promptConfirm(
|
|
27177
|
-
|
|
27146
|
+
chalk199.red("Overwrite existing settings.json?"),
|
|
27178
27147
|
false
|
|
27179
27148
|
);
|
|
27180
27149
|
if (!confirm) {
|
|
@@ -27273,10 +27242,10 @@ async function update2() {
|
|
|
27273
27242
|
}
|
|
27274
27243
|
|
|
27275
27244
|
// src/reportCliError.ts
|
|
27276
|
-
import
|
|
27245
|
+
import chalk200 from "chalk";
|
|
27277
27246
|
function reportCliError(error) {
|
|
27278
27247
|
if (error instanceof InvalidItemIdError) {
|
|
27279
|
-
console.error(
|
|
27248
|
+
console.error(chalk200.red(error.message));
|
|
27280
27249
|
} else {
|
|
27281
27250
|
console.error(error);
|
|
27282
27251
|
}
|