@staff0rd/assist 0.490.2 → 0.491.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/claude/commands/bug.md +7 -23
- package/claude/commands/draft.md +7 -23
- package/dist/commands/sessions/web/bundle.js +223 -223
- package/dist/index.js +662 -565
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.491.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -12770,8 +12770,7 @@ async function list2(options2) {
|
|
|
12770
12770
|
}
|
|
12771
12771
|
|
|
12772
12772
|
// src/commands/backlog/propose/index.ts
|
|
12773
|
-
import
|
|
12774
|
-
import chalk80 from "chalk";
|
|
12773
|
+
import chalk81 from "chalk";
|
|
12775
12774
|
|
|
12776
12775
|
// src/commands/backlog/readJsonPayload.ts
|
|
12777
12776
|
import { readFileSync as readFileSync24 } from "fs";
|
|
@@ -12830,6 +12829,10 @@ function readProposedItem(source) {
|
|
|
12830
12829
|
return readJsonPayload(source, proposedItemSchema, "backlog item");
|
|
12831
12830
|
}
|
|
12832
12831
|
|
|
12832
|
+
// src/commands/backlog/propose/reviewProposal.ts
|
|
12833
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
12834
|
+
import chalk80 from "chalk";
|
|
12835
|
+
|
|
12833
12836
|
// src/commands/backlog/propose/renderProposedItem.ts
|
|
12834
12837
|
function renderProposedItem(item) {
|
|
12835
12838
|
const sections = [`**Type:** ${item.type}`];
|
|
@@ -12844,11 +12847,10 @@ function renderProposedItem(item) {
|
|
|
12844
12847
|
return sections.join("\n\n");
|
|
12845
12848
|
}
|
|
12846
12849
|
|
|
12847
|
-
// src/commands/backlog/propose/
|
|
12848
|
-
async function reviewProposal(item) {
|
|
12850
|
+
// src/commands/backlog/propose/reviewProposal.ts
|
|
12851
|
+
async function reviewProposal(item, sessionId, confirmed) {
|
|
12849
12852
|
const body = renderProposedItem(item);
|
|
12850
|
-
|
|
12851
|
-
if (process.env.ASSIST_SESSION === "1" && sessionId) {
|
|
12853
|
+
if (sessionId) {
|
|
12852
12854
|
await awaitPreviewApproval("Backlog item preview", {
|
|
12853
12855
|
sessionId,
|
|
12854
12856
|
requestId: randomUUID3(),
|
|
@@ -12858,17 +12860,38 @@ async function reviewProposal(item) {
|
|
|
12858
12860
|
kind: "backlog-item",
|
|
12859
12861
|
itemType: item.type
|
|
12860
12862
|
});
|
|
12861
|
-
return;
|
|
12863
|
+
return true;
|
|
12862
12864
|
}
|
|
12865
|
+
if (isClaudeCode() && confirmed) return true;
|
|
12863
12866
|
console.log(chalk80.bold(item.name));
|
|
12864
12867
|
console.log(renderMarkdownTerminal(body));
|
|
12868
|
+
if (!isClaudeCode()) return true;
|
|
12869
|
+
console.log(
|
|
12870
|
+
chalk80.yellow(
|
|
12871
|
+
"Draft only \u2014 nothing was written to the backlog. Show this draft in the chat, apply any changes the user asks for, then re-run 'assist backlog propose --json <file|->' with --confirmed to create the item."
|
|
12872
|
+
)
|
|
12873
|
+
);
|
|
12874
|
+
return false;
|
|
12865
12875
|
}
|
|
12876
|
+
|
|
12877
|
+
// src/commands/backlog/propose/index.ts
|
|
12866
12878
|
async function propose(options2) {
|
|
12867
12879
|
if (!ensureRemoteOrigin()) return;
|
|
12880
|
+
const sessionId = process.env.ASSIST_SESSION === "1" ? process.env.ASSIST_SESSION_ID : void 0;
|
|
12881
|
+
if (sessionId && options2.confirmed) {
|
|
12882
|
+
console.error(
|
|
12883
|
+
chalk81.red(
|
|
12884
|
+
"Error: --confirmed cannot be used in a web session. The preview pane is the gate \u2014 run 'assist backlog propose --json <file|->' without --confirmed and the item is created on approval."
|
|
12885
|
+
)
|
|
12886
|
+
);
|
|
12887
|
+
process.exitCode = 1;
|
|
12888
|
+
return;
|
|
12889
|
+
}
|
|
12868
12890
|
const item = await readProposedItem(options2.json);
|
|
12869
|
-
await reviewProposal(item)
|
|
12891
|
+
if (!await reviewProposal(item, sessionId, options2.confirmed === true))
|
|
12892
|
+
return;
|
|
12870
12893
|
const id = await createItemWithDefaults(item);
|
|
12871
|
-
console.log(
|
|
12894
|
+
console.log(chalk81.green(`Added item ${formatItemId(id)}: ${item.name}`));
|
|
12872
12895
|
}
|
|
12873
12896
|
|
|
12874
12897
|
// src/commands/backlog/registerItemCommands.ts
|
|
@@ -12886,6 +12909,9 @@ function registerItemCommands(cmd) {
|
|
|
12886
12909
|
).requiredOption(
|
|
12887
12910
|
"--json <file|->",
|
|
12888
12911
|
"Path to a JSON payload describing the item, or - to read it from stdin"
|
|
12912
|
+
).option(
|
|
12913
|
+
"--confirmed",
|
|
12914
|
+
"Create the item after its draft has been reviewed in chat (agent use outside a web session)"
|
|
12889
12915
|
).action(propose);
|
|
12890
12916
|
cmd.command("add-phase <id> <name>").description("Add a phase to an existing backlog item").option("--task <task...>", "Task description (repeatable)").option(
|
|
12891
12917
|
"--manual-check <check...>",
|
|
@@ -12897,7 +12923,7 @@ function registerItemCommands(cmd) {
|
|
|
12897
12923
|
}
|
|
12898
12924
|
|
|
12899
12925
|
// src/commands/backlog/link.ts
|
|
12900
|
-
import
|
|
12926
|
+
import chalk83 from "chalk";
|
|
12901
12927
|
|
|
12902
12928
|
// src/commands/backlog/hasCycle.ts
|
|
12903
12929
|
function hasCycle(adjacency, fromId, toId) {
|
|
@@ -12929,14 +12955,14 @@ async function loadDependencyGraph(orm) {
|
|
|
12929
12955
|
}
|
|
12930
12956
|
|
|
12931
12957
|
// src/commands/backlog/validateLinkTarget.ts
|
|
12932
|
-
import
|
|
12958
|
+
import chalk82 from "chalk";
|
|
12933
12959
|
function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
12934
12960
|
const duplicate = (fromItem.links ?? []).some(
|
|
12935
12961
|
(l) => l.targetId === toNum && l.type === linkType
|
|
12936
12962
|
);
|
|
12937
12963
|
if (duplicate) {
|
|
12938
12964
|
console.log(
|
|
12939
|
-
|
|
12965
|
+
chalk82.yellow(
|
|
12940
12966
|
`Link already exists: ${formatItemId(fromNum)} ${linkType} ${formatItemId(toNum)}`
|
|
12941
12967
|
)
|
|
12942
12968
|
);
|
|
@@ -12947,7 +12973,7 @@ function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
|
12947
12973
|
|
|
12948
12974
|
// src/commands/backlog/link.ts
|
|
12949
12975
|
function fail4(message3) {
|
|
12950
|
-
console.log(
|
|
12976
|
+
console.log(chalk83.red(message3));
|
|
12951
12977
|
return void 0;
|
|
12952
12978
|
}
|
|
12953
12979
|
function parseLinkType(type) {
|
|
@@ -12980,11 +13006,11 @@ async function link(fromId, toId, opts) {
|
|
|
12980
13006
|
if (!validateLinkTarget(fromItem, fromNum, toNum, linkType)) return;
|
|
12981
13007
|
if (await createsCycle(orm, linkType, fromNum, toNum)) return;
|
|
12982
13008
|
await orm.insert(links).values({ itemId: fromNum, type: linkType, targetId: toNum });
|
|
12983
|
-
console.log(
|
|
13009
|
+
console.log(chalk83.green(`Linked ${from} ${linkType} ${to} (${toItem.name})`));
|
|
12984
13010
|
}
|
|
12985
13011
|
|
|
12986
13012
|
// src/commands/backlog/unlink.ts
|
|
12987
|
-
import
|
|
13013
|
+
import chalk84 from "chalk";
|
|
12988
13014
|
import { and as and10, eq as eq27 } from "drizzle-orm";
|
|
12989
13015
|
async function unlink(fromId, toId) {
|
|
12990
13016
|
const fromNum = parseItemId(fromId);
|
|
@@ -12992,18 +13018,18 @@ async function unlink(fromId, toId) {
|
|
|
12992
13018
|
const { orm } = await getReady();
|
|
12993
13019
|
const fromItem = await loadItem(orm, fromNum);
|
|
12994
13020
|
if (!fromItem) {
|
|
12995
|
-
console.log(
|
|
13021
|
+
console.log(chalk84.red(`Item ${formatItemId(fromNum)} not found.`));
|
|
12996
13022
|
return;
|
|
12997
13023
|
}
|
|
12998
13024
|
if (!fromItem.links || fromItem.links.length === 0) {
|
|
12999
13025
|
console.log(
|
|
13000
|
-
|
|
13026
|
+
chalk84.yellow(`No links found on item ${formatItemId(fromNum)}.`)
|
|
13001
13027
|
);
|
|
13002
13028
|
return;
|
|
13003
13029
|
}
|
|
13004
13030
|
if (!fromItem.links.some((l) => l.targetId === toNum)) {
|
|
13005
13031
|
console.log(
|
|
13006
|
-
|
|
13032
|
+
chalk84.yellow(
|
|
13007
13033
|
`No link from ${formatItemId(fromNum)} to ${formatItemId(toNum)} found.`
|
|
13008
13034
|
)
|
|
13009
13035
|
);
|
|
@@ -13011,7 +13037,7 @@ async function unlink(fromId, toId) {
|
|
|
13011
13037
|
}
|
|
13012
13038
|
await orm.delete(links).where(and10(eq27(links.itemId, fromNum), eq27(links.targetId, toNum)));
|
|
13013
13039
|
console.log(
|
|
13014
|
-
|
|
13040
|
+
chalk84.green(
|
|
13015
13041
|
`Removed link from ${formatItemId(fromNum)} to ${formatItemId(toNum)}.`
|
|
13016
13042
|
)
|
|
13017
13043
|
);
|
|
@@ -13028,17 +13054,17 @@ function registerLinkCommands(cmd) {
|
|
|
13028
13054
|
}
|
|
13029
13055
|
|
|
13030
13056
|
// src/commands/backlog/move-repo/index.ts
|
|
13031
|
-
import
|
|
13057
|
+
import chalk86 from "chalk";
|
|
13032
13058
|
import { eq as eq29 } from "drizzle-orm";
|
|
13033
13059
|
|
|
13034
13060
|
// src/commands/backlog/move-repo/confirmMove.ts
|
|
13035
|
-
import
|
|
13061
|
+
import chalk85 from "chalk";
|
|
13036
13062
|
function pluralItems(n) {
|
|
13037
13063
|
return `${n} item${n === 1 ? "" : "s"}`;
|
|
13038
13064
|
}
|
|
13039
13065
|
async function confirmMove(cnt, oldOrigin, newOrigin) {
|
|
13040
13066
|
console.log(
|
|
13041
|
-
`${pluralItems(cnt)}: ${
|
|
13067
|
+
`${pluralItems(cnt)}: ${chalk85.cyan(oldOrigin)} \u2192 ${chalk85.cyan(newOrigin)}`
|
|
13042
13068
|
);
|
|
13043
13069
|
return promptConfirm(`Retag ${pluralItems(cnt)}?`);
|
|
13044
13070
|
}
|
|
@@ -13070,7 +13096,7 @@ Pass the full origin.`
|
|
|
13070
13096
|
|
|
13071
13097
|
// src/commands/backlog/move-repo/index.ts
|
|
13072
13098
|
function fail5(message3) {
|
|
13073
|
-
console.log(
|
|
13099
|
+
console.log(chalk86.red(message3));
|
|
13074
13100
|
process.exitCode = 1;
|
|
13075
13101
|
}
|
|
13076
13102
|
async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
@@ -13086,12 +13112,12 @@ async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
|
13086
13112
|
}
|
|
13087
13113
|
const cnt = await countByOrigin(orm, oldOrigin);
|
|
13088
13114
|
if (!options2.yes && !await confirmMove(cnt, oldOrigin, newOrigin)) {
|
|
13089
|
-
console.log(
|
|
13115
|
+
console.log(chalk86.yellow("Move cancelled; no changes made."));
|
|
13090
13116
|
return;
|
|
13091
13117
|
}
|
|
13092
13118
|
await orm.update(items).set({ origin: newOrigin }).where(eq29(items.origin, oldOrigin));
|
|
13093
13119
|
console.log(
|
|
13094
|
-
|
|
13120
|
+
chalk86.green(
|
|
13095
13121
|
`Moved ${pluralItems(cnt)} from "${oldOrigin}" to "${newOrigin}".`
|
|
13096
13122
|
)
|
|
13097
13123
|
);
|
|
@@ -13120,14 +13146,14 @@ function registerPlanCommands(cmd) {
|
|
|
13120
13146
|
}
|
|
13121
13147
|
|
|
13122
13148
|
// src/commands/backlog/refine.ts
|
|
13123
|
-
import
|
|
13149
|
+
import chalk89 from "chalk";
|
|
13124
13150
|
import enquirer7 from "enquirer";
|
|
13125
13151
|
|
|
13126
13152
|
// src/commands/backlog/launchMode.ts
|
|
13127
13153
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
13128
13154
|
|
|
13129
13155
|
// src/commands/backlog/handleLaunchSignal.ts
|
|
13130
|
-
import
|
|
13156
|
+
import chalk88 from "chalk";
|
|
13131
13157
|
|
|
13132
13158
|
// src/commands/backlog/surfaceCreatedItem.ts
|
|
13133
13159
|
async function surfaceCreatedItem(slashCommand, id) {
|
|
@@ -13150,32 +13176,32 @@ async function surfaceCreatedItem(slashCommand, id) {
|
|
|
13150
13176
|
}
|
|
13151
13177
|
|
|
13152
13178
|
// src/commands/backlog/tryRunById.ts
|
|
13153
|
-
import
|
|
13179
|
+
import chalk87 from "chalk";
|
|
13154
13180
|
async function tryRunById(id, options2) {
|
|
13155
13181
|
const numericId = parseItemId(id);
|
|
13156
13182
|
const label2 = formatItemId(numericId);
|
|
13157
13183
|
const { orm } = await getReady();
|
|
13158
13184
|
const item = await loadItem(orm, numericId);
|
|
13159
13185
|
if (!item) {
|
|
13160
|
-
console.log(
|
|
13186
|
+
console.log(chalk87.red(`Item ${label2} not found.`));
|
|
13161
13187
|
return false;
|
|
13162
13188
|
}
|
|
13163
13189
|
if (item.status === "done") {
|
|
13164
|
-
console.log(
|
|
13190
|
+
console.log(chalk87.red(`Item ${label2} is already done.`));
|
|
13165
13191
|
return false;
|
|
13166
13192
|
}
|
|
13167
13193
|
if (item.status === "wontdo") {
|
|
13168
|
-
console.log(
|
|
13194
|
+
console.log(chalk87.red(`Item ${label2} is marked won't do.`));
|
|
13169
13195
|
return false;
|
|
13170
13196
|
}
|
|
13171
13197
|
const hasDeps = (item.links ?? []).some((l) => l.type === "depends-on");
|
|
13172
13198
|
if (hasDeps && isBlocked(item, await loadItemSummaries(orm, getOrigin()))) {
|
|
13173
13199
|
console.log(
|
|
13174
|
-
|
|
13200
|
+
chalk87.red(`Item ${label2} is blocked by unresolved dependencies.`)
|
|
13175
13201
|
);
|
|
13176
13202
|
return false;
|
|
13177
13203
|
}
|
|
13178
|
-
console.log(
|
|
13204
|
+
console.log(chalk87.bold(`
|
|
13179
13205
|
Running backlog item ${label2}...
|
|
13180
13206
|
`));
|
|
13181
13207
|
await run2(id, options2);
|
|
@@ -13194,13 +13220,13 @@ async function handleLaunchSignal(slashCommand, once) {
|
|
|
13194
13220
|
if (typeof signal.id === "string" && signal.id) {
|
|
13195
13221
|
if (await tryRunById(signal.id, { allowEdits: true })) return;
|
|
13196
13222
|
}
|
|
13197
|
-
console.log(
|
|
13223
|
+
console.log(chalk88.bold("\nChaining into assist next...\n"));
|
|
13198
13224
|
await next({ allowEdits: true, once });
|
|
13199
13225
|
}
|
|
13200
13226
|
} catch (error) {
|
|
13201
13227
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
13202
13228
|
console.error(
|
|
13203
|
-
|
|
13229
|
+
chalk88.yellow(
|
|
13204
13230
|
`
|
|
13205
13231
|
Could not complete post-run step (${message3}).
|
|
13206
13232
|
This is usually a transient database/network blip \u2014 the work is saved and the session is safe to resume.`
|
|
@@ -13247,13 +13273,13 @@ async function pickItemForRefine() {
|
|
|
13247
13273
|
(i) => i.status === "todo" || i.status === "in-progress"
|
|
13248
13274
|
);
|
|
13249
13275
|
if (active.length === 0) {
|
|
13250
|
-
console.log(
|
|
13276
|
+
console.log(chalk89.yellow("No active backlog items to refine."));
|
|
13251
13277
|
return void 0;
|
|
13252
13278
|
}
|
|
13253
13279
|
if (active.length === 1) {
|
|
13254
13280
|
const item = active[0];
|
|
13255
13281
|
console.log(
|
|
13256
|
-
|
|
13282
|
+
chalk89.bold(`Auto-selecting item ${formatItemId(item.id)}: ${item.name}`)
|
|
13257
13283
|
);
|
|
13258
13284
|
return formatItemId(item.id);
|
|
13259
13285
|
}
|
|
@@ -13301,7 +13327,7 @@ function registerRefineCommand(cmd) {
|
|
|
13301
13327
|
}
|
|
13302
13328
|
|
|
13303
13329
|
// src/commands/backlog/rewindPhase.ts
|
|
13304
|
-
import
|
|
13330
|
+
import chalk90 from "chalk";
|
|
13305
13331
|
async function rewindPhase(id, phase, opts) {
|
|
13306
13332
|
const phaseNumber = Number.parseInt(phase, 10);
|
|
13307
13333
|
const found = await findOneItem(id);
|
|
@@ -13309,12 +13335,12 @@ async function rewindPhase(id, phase, opts) {
|
|
|
13309
13335
|
const { orm, item } = found;
|
|
13310
13336
|
const result = await rewindItemToPhase(orm, item, phaseNumber, opts.reason);
|
|
13311
13337
|
if (!result.ok) {
|
|
13312
|
-
console.log(
|
|
13338
|
+
console.log(chalk90.red(result.error));
|
|
13313
13339
|
process.exitCode = 1;
|
|
13314
13340
|
return;
|
|
13315
13341
|
}
|
|
13316
13342
|
console.log(
|
|
13317
|
-
|
|
13343
|
+
chalk90.green(
|
|
13318
13344
|
`Rewound item ${formatItemId(item.id)} to phase ${phaseNumber} (${result.phaseName}).`
|
|
13319
13345
|
)
|
|
13320
13346
|
);
|
|
@@ -13346,22 +13372,22 @@ function registerRunCommand(cmd) {
|
|
|
13346
13372
|
}
|
|
13347
13373
|
|
|
13348
13374
|
// src/commands/backlog/search/index.ts
|
|
13349
|
-
import
|
|
13375
|
+
import chalk91 from "chalk";
|
|
13350
13376
|
async function search(query) {
|
|
13351
13377
|
const items2 = await searchBacklog(query);
|
|
13352
13378
|
if (items2.length === 0) {
|
|
13353
|
-
console.log(
|
|
13379
|
+
console.log(chalk91.dim(`No items matching "${query}".`));
|
|
13354
13380
|
return;
|
|
13355
13381
|
}
|
|
13356
13382
|
console.log(
|
|
13357
|
-
|
|
13383
|
+
chalk91.dim(
|
|
13358
13384
|
`${items2.length} item${items2.length === 1 ? "" : "s"} matching "${query}":
|
|
13359
13385
|
`
|
|
13360
13386
|
)
|
|
13361
13387
|
);
|
|
13362
13388
|
for (const item of items2) {
|
|
13363
13389
|
console.log(
|
|
13364
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
13390
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk91.dim(formatItemId(item.id))} ${item.name}`
|
|
13365
13391
|
);
|
|
13366
13392
|
}
|
|
13367
13393
|
}
|
|
@@ -13372,18 +13398,18 @@ function registerSearchCommand(cmd) {
|
|
|
13372
13398
|
}
|
|
13373
13399
|
|
|
13374
13400
|
// src/commands/backlog/delete/index.ts
|
|
13375
|
-
import
|
|
13401
|
+
import chalk92 from "chalk";
|
|
13376
13402
|
async function del(id) {
|
|
13377
13403
|
const name = await removeItem(id);
|
|
13378
13404
|
if (name) {
|
|
13379
13405
|
console.log(
|
|
13380
|
-
|
|
13406
|
+
chalk92.green(`Deleted item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
13381
13407
|
);
|
|
13382
13408
|
}
|
|
13383
13409
|
}
|
|
13384
13410
|
|
|
13385
13411
|
// src/commands/backlog/done/index.ts
|
|
13386
|
-
import
|
|
13412
|
+
import chalk93 from "chalk";
|
|
13387
13413
|
async function done(id, summary) {
|
|
13388
13414
|
const found = await findOneItem(id);
|
|
13389
13415
|
if (!found) return;
|
|
@@ -13397,12 +13423,12 @@ async function done(id, summary) {
|
|
|
13397
13423
|
const pending = item.plan.slice(completedCount);
|
|
13398
13424
|
if (pending.length > 0) {
|
|
13399
13425
|
console.log(
|
|
13400
|
-
|
|
13426
|
+
chalk93.red(
|
|
13401
13427
|
`Cannot complete item ${formatItemId(item.id)}: ${pending.length} pending phase(s):`
|
|
13402
13428
|
)
|
|
13403
13429
|
);
|
|
13404
13430
|
for (const phase of pending) {
|
|
13405
|
-
console.log(
|
|
13431
|
+
console.log(chalk93.yellow(` - ${phase.name}`));
|
|
13406
13432
|
}
|
|
13407
13433
|
process.exitCode = 1;
|
|
13408
13434
|
return;
|
|
@@ -13414,12 +13440,12 @@ async function done(id, summary) {
|
|
|
13414
13440
|
await appendComment(orm, item.id, summary, { phase, type: "summary" });
|
|
13415
13441
|
}
|
|
13416
13442
|
console.log(
|
|
13417
|
-
|
|
13443
|
+
chalk93.green(`Completed item ${formatItemId(item.id)}: ${item.name}`)
|
|
13418
13444
|
);
|
|
13419
13445
|
}
|
|
13420
13446
|
|
|
13421
13447
|
// src/commands/backlog/set-status/index.ts
|
|
13422
|
-
import
|
|
13448
|
+
import chalk94 from "chalk";
|
|
13423
13449
|
var allowedStatuses = [
|
|
13424
13450
|
"todo",
|
|
13425
13451
|
"in-progress",
|
|
@@ -13429,7 +13455,7 @@ var allowedStatuses = [
|
|
|
13429
13455
|
async function setStatusCommand(id, status3) {
|
|
13430
13456
|
if (!allowedStatuses.includes(status3)) {
|
|
13431
13457
|
console.log(
|
|
13432
|
-
|
|
13458
|
+
chalk94.red(
|
|
13433
13459
|
`Invalid status "${status3}". Must be one of: ${allowedStatuses.join(", ")}.`
|
|
13434
13460
|
)
|
|
13435
13461
|
);
|
|
@@ -13439,7 +13465,7 @@ async function setStatusCommand(id, status3) {
|
|
|
13439
13465
|
const name = await setStatus(id, status3);
|
|
13440
13466
|
if (name) {
|
|
13441
13467
|
console.log(
|
|
13442
|
-
|
|
13468
|
+
chalk94.green(
|
|
13443
13469
|
`Set item ${formatItemId(parseItemId(id))} to ${status3}: ${name}`
|
|
13444
13470
|
)
|
|
13445
13471
|
);
|
|
@@ -13447,16 +13473,16 @@ async function setStatusCommand(id, status3) {
|
|
|
13447
13473
|
}
|
|
13448
13474
|
|
|
13449
13475
|
// src/commands/backlog/star/index.ts
|
|
13450
|
-
import
|
|
13476
|
+
import chalk96 from "chalk";
|
|
13451
13477
|
|
|
13452
13478
|
// src/commands/backlog/setStarred.ts
|
|
13453
|
-
import
|
|
13479
|
+
import chalk95 from "chalk";
|
|
13454
13480
|
async function setStarred(id, starred) {
|
|
13455
13481
|
const { orm } = await getReady();
|
|
13456
13482
|
const numId = parseItemId(id);
|
|
13457
13483
|
const name = await updateStarred(orm, numId, starred);
|
|
13458
13484
|
if (name === void 0)
|
|
13459
|
-
console.log(
|
|
13485
|
+
console.log(chalk95.red(`Item ${formatItemId(numId)} not found.`));
|
|
13460
13486
|
return name;
|
|
13461
13487
|
}
|
|
13462
13488
|
|
|
@@ -13465,52 +13491,52 @@ async function star(id) {
|
|
|
13465
13491
|
const name = await setStarred(id, true);
|
|
13466
13492
|
if (name) {
|
|
13467
13493
|
console.log(
|
|
13468
|
-
|
|
13494
|
+
chalk96.green(`Starred item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
13469
13495
|
);
|
|
13470
13496
|
}
|
|
13471
13497
|
}
|
|
13472
13498
|
|
|
13473
13499
|
// src/commands/backlog/start/index.ts
|
|
13474
|
-
import
|
|
13500
|
+
import chalk97 from "chalk";
|
|
13475
13501
|
async function start(id) {
|
|
13476
13502
|
const name = await setStatus(id, "in-progress");
|
|
13477
13503
|
if (name) {
|
|
13478
13504
|
console.log(
|
|
13479
|
-
|
|
13505
|
+
chalk97.green(`Started item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
13480
13506
|
);
|
|
13481
13507
|
}
|
|
13482
13508
|
}
|
|
13483
13509
|
|
|
13484
13510
|
// src/commands/backlog/stop/index.ts
|
|
13485
|
-
import
|
|
13511
|
+
import chalk98 from "chalk";
|
|
13486
13512
|
import { and as and11, eq as eq30 } from "drizzle-orm";
|
|
13487
13513
|
async function stop() {
|
|
13488
13514
|
const { orm } = await getReady();
|
|
13489
13515
|
const stopped = await orm.update(items).set({ status: "todo", currentPhase: 1 }).where(and11(eq30(items.status, "in-progress"), eq30(items.origin, getOrigin()))).returning({ id: items.id, name: items.name });
|
|
13490
13516
|
if (stopped.length === 0) {
|
|
13491
|
-
console.log(
|
|
13517
|
+
console.log(chalk98.yellow("No in-progress items to stop."));
|
|
13492
13518
|
return;
|
|
13493
13519
|
}
|
|
13494
13520
|
for (const item of stopped) {
|
|
13495
13521
|
console.log(
|
|
13496
|
-
|
|
13522
|
+
chalk98.yellow(`Stopped item ${formatItemId(item.id)}: ${item.name}`)
|
|
13497
13523
|
);
|
|
13498
13524
|
}
|
|
13499
13525
|
}
|
|
13500
13526
|
|
|
13501
13527
|
// src/commands/backlog/unstar/index.ts
|
|
13502
|
-
import
|
|
13528
|
+
import chalk99 from "chalk";
|
|
13503
13529
|
async function unstar(id) {
|
|
13504
13530
|
const name = await setStarred(id, false);
|
|
13505
13531
|
if (name) {
|
|
13506
13532
|
console.log(
|
|
13507
|
-
|
|
13533
|
+
chalk99.green(`Unstarred item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
13508
13534
|
);
|
|
13509
13535
|
}
|
|
13510
13536
|
}
|
|
13511
13537
|
|
|
13512
13538
|
// src/commands/backlog/wontdo/index.ts
|
|
13513
|
-
import
|
|
13539
|
+
import chalk100 from "chalk";
|
|
13514
13540
|
async function wontdo(id, reason4) {
|
|
13515
13541
|
const found = await findOneItem(id);
|
|
13516
13542
|
if (!found) return;
|
|
@@ -13521,7 +13547,7 @@ async function wontdo(id, reason4) {
|
|
|
13521
13547
|
await appendComment(orm, item.id, reason4, { phase, type: "summary" });
|
|
13522
13548
|
}
|
|
13523
13549
|
console.log(
|
|
13524
|
-
|
|
13550
|
+
chalk100.red(`Won't do item ${formatItemId(item.id)}: ${item.name}`)
|
|
13525
13551
|
);
|
|
13526
13552
|
}
|
|
13527
13553
|
|
|
@@ -13540,17 +13566,17 @@ function registerStatusCommands(cmd) {
|
|
|
13540
13566
|
}
|
|
13541
13567
|
|
|
13542
13568
|
// src/commands/backlog/addSubtask.ts
|
|
13543
|
-
import
|
|
13569
|
+
import chalk101 from "chalk";
|
|
13544
13570
|
async function addSubtask(id, options2) {
|
|
13545
13571
|
const title = options2.title?.trim();
|
|
13546
13572
|
if (!title) {
|
|
13547
|
-
console.log(
|
|
13573
|
+
console.log(chalk101.red("A sub-task title is required (--title)."));
|
|
13548
13574
|
process.exitCode = 1;
|
|
13549
13575
|
return;
|
|
13550
13576
|
}
|
|
13551
13577
|
if (title.length > 50) {
|
|
13552
13578
|
console.log(
|
|
13553
|
-
|
|
13579
|
+
chalk101.red(
|
|
13554
13580
|
"A sub-task title must be 50 characters or fewer. Use --desc for longer detail."
|
|
13555
13581
|
)
|
|
13556
13582
|
);
|
|
@@ -13566,21 +13592,21 @@ async function addSubtask(id, options2) {
|
|
|
13566
13592
|
const description = options2.desc?.replaceAll(String.raw`\n`, "\n");
|
|
13567
13593
|
await insertSubtask(orm, item.id, title, description);
|
|
13568
13594
|
console.log(
|
|
13569
|
-
|
|
13595
|
+
chalk101.green(`Added sub-task to item ${formatItemId(item.id)}: ${title}`)
|
|
13570
13596
|
);
|
|
13571
13597
|
}
|
|
13572
13598
|
|
|
13573
13599
|
// src/commands/backlog/editSubtask.ts
|
|
13574
|
-
import
|
|
13600
|
+
import chalk103 from "chalk";
|
|
13575
13601
|
|
|
13576
13602
|
// src/commands/backlog/resolveSubtaskIndex.ts
|
|
13577
|
-
import
|
|
13603
|
+
import chalk102 from "chalk";
|
|
13578
13604
|
function resolveSubtaskIndex(index3, item) {
|
|
13579
13605
|
const position = Number.parseInt(index3, 10);
|
|
13580
13606
|
const subtasks = item.subtasks ?? [];
|
|
13581
13607
|
if (Number.isNaN(position) || position < 1 || position > subtasks.length) {
|
|
13582
13608
|
console.log(
|
|
13583
|
-
|
|
13609
|
+
chalk102.red(
|
|
13584
13610
|
`Item ${formatItemId(item.id)} has no sub-task ${index3}${subtasks.length > 0 ? ` (1-${subtasks.length})` : ""}.`
|
|
13585
13611
|
)
|
|
13586
13612
|
);
|
|
@@ -13647,21 +13673,21 @@ async function editSubtask(id, index3, options2) {
|
|
|
13647
13673
|
if (!found) return;
|
|
13648
13674
|
const fields = buildUpdate(options2);
|
|
13649
13675
|
if (typeof fields === "string") {
|
|
13650
|
-
console.log(
|
|
13676
|
+
console.log(chalk103.red(fields));
|
|
13651
13677
|
process.exitCode = 1;
|
|
13652
13678
|
return;
|
|
13653
13679
|
}
|
|
13654
13680
|
const { orm, item, idx } = found;
|
|
13655
13681
|
const title = await updateSubtask(orm, item.id, idx, fields);
|
|
13656
13682
|
console.log(
|
|
13657
|
-
|
|
13683
|
+
chalk103.green(
|
|
13658
13684
|
`Updated sub-task ${idx + 1} of item ${formatItemId(item.id)}: ${title}`
|
|
13659
13685
|
)
|
|
13660
13686
|
);
|
|
13661
13687
|
}
|
|
13662
13688
|
|
|
13663
13689
|
// src/commands/backlog/removeSubtask.ts
|
|
13664
|
-
import
|
|
13690
|
+
import chalk104 from "chalk";
|
|
13665
13691
|
|
|
13666
13692
|
// src/commands/backlog/deleteSubtask.ts
|
|
13667
13693
|
import { and as and13, asc as asc8, eq as eq32 } from "drizzle-orm";
|
|
@@ -13686,18 +13712,18 @@ async function removeSubtask(id, index3) {
|
|
|
13686
13712
|
const { orm, item, idx } = found;
|
|
13687
13713
|
const title = await deleteSubtask(orm, item.id, idx);
|
|
13688
13714
|
console.log(
|
|
13689
|
-
|
|
13715
|
+
chalk104.green(
|
|
13690
13716
|
`Removed sub-task ${idx + 1} of item ${formatItemId(item.id)}: ${title}`
|
|
13691
13717
|
)
|
|
13692
13718
|
);
|
|
13693
13719
|
}
|
|
13694
13720
|
|
|
13695
13721
|
// src/commands/backlog/subtaskStatus.ts
|
|
13696
|
-
import
|
|
13722
|
+
import chalk105 from "chalk";
|
|
13697
13723
|
async function subtaskStatus(id, index3, status3) {
|
|
13698
13724
|
if (!validSubtaskStatuses.includes(status3)) {
|
|
13699
13725
|
console.log(
|
|
13700
|
-
|
|
13726
|
+
chalk105.red(
|
|
13701
13727
|
`Invalid status "${status3}". Use one of: ${validSubtaskStatuses.join(", ")}.`
|
|
13702
13728
|
)
|
|
13703
13729
|
);
|
|
@@ -13714,7 +13740,7 @@ async function subtaskStatus(id, index3, status3) {
|
|
|
13714
13740
|
status3
|
|
13715
13741
|
);
|
|
13716
13742
|
console.log(
|
|
13717
|
-
|
|
13743
|
+
chalk105.green(
|
|
13718
13744
|
`Set sub-task ${idx + 1} of item ${formatItemId(item.id)} to ${status3}: ${title}`
|
|
13719
13745
|
)
|
|
13720
13746
|
);
|
|
@@ -13741,7 +13767,7 @@ function registerSubtaskCommands(cmd) {
|
|
|
13741
13767
|
}
|
|
13742
13768
|
|
|
13743
13769
|
// src/commands/backlog/movePhase.ts
|
|
13744
|
-
import
|
|
13770
|
+
import chalk106 from "chalk";
|
|
13745
13771
|
import { count as count6, eq as eq35 } from "drizzle-orm";
|
|
13746
13772
|
|
|
13747
13773
|
// src/commands/backlog/reorderPhaseRows.ts
|
|
@@ -13807,7 +13833,7 @@ function toIndex2(value, phaseCount) {
|
|
|
13807
13833
|
const pos = Number.parseInt(value, 10);
|
|
13808
13834
|
if (Number.isNaN(pos) || pos < 1 || pos > phaseCount) {
|
|
13809
13835
|
console.log(
|
|
13810
|
-
|
|
13836
|
+
chalk106.red(
|
|
13811
13837
|
`Position "${value}" is out of range. Must be between 1 and ${phaseCount}.`
|
|
13812
13838
|
)
|
|
13813
13839
|
);
|
|
@@ -13830,11 +13856,11 @@ async function movePhase(id, from, to) {
|
|
|
13830
13856
|
if (fromIdx !== toIdx) {
|
|
13831
13857
|
await reorderPhaseRows(orm, itemId2, fromIdx, toIdx);
|
|
13832
13858
|
}
|
|
13833
|
-
console.log(
|
|
13859
|
+
console.log(chalk106.green(`Moved phase ${from} to position ${to}.`));
|
|
13834
13860
|
}
|
|
13835
13861
|
|
|
13836
13862
|
// src/commands/backlog/updatePhase.ts
|
|
13837
|
-
import
|
|
13863
|
+
import chalk108 from "chalk";
|
|
13838
13864
|
|
|
13839
13865
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
13840
13866
|
import { and as and16, eq as eq36 } from "drizzle-orm";
|
|
@@ -13869,7 +13895,7 @@ async function applyPhaseUpdate(orm, itemId2, phaseIdx, fields) {
|
|
|
13869
13895
|
}
|
|
13870
13896
|
|
|
13871
13897
|
// src/commands/backlog/findPhase.ts
|
|
13872
|
-
import
|
|
13898
|
+
import chalk107 from "chalk";
|
|
13873
13899
|
import { and as and17, count as count7, eq as eq37 } from "drizzle-orm";
|
|
13874
13900
|
async function findPhase(id, phase) {
|
|
13875
13901
|
const found = await findOneItem(id);
|
|
@@ -13880,7 +13906,7 @@ async function findPhase(id, phase) {
|
|
|
13880
13906
|
const [row] = await orm.select({ cnt: count7() }).from(planPhases).where(and17(eq37(planPhases.itemId, itemId2), eq37(planPhases.idx, phaseIdx)));
|
|
13881
13907
|
if (!row || row.cnt === 0) {
|
|
13882
13908
|
console.log(
|
|
13883
|
-
|
|
13909
|
+
chalk107.red(
|
|
13884
13910
|
`Phase ${phaseIdx + 1} not found on item ${formatItemId(itemId2)}.`
|
|
13885
13911
|
)
|
|
13886
13912
|
);
|
|
@@ -14014,7 +14040,7 @@ async function updatePhase(id, phase, options2) {
|
|
|
14014
14040
|
const { item, orm, itemId: itemId2, phaseIdx } = found;
|
|
14015
14041
|
const resolved = resolvePhaseFields(options2, item.plan?.[phaseIdx]);
|
|
14016
14042
|
if (!resolved.ok) {
|
|
14017
|
-
console.log(
|
|
14043
|
+
console.log(chalk108.red(resolved.error));
|
|
14018
14044
|
process.exitCode = 1;
|
|
14019
14045
|
return;
|
|
14020
14046
|
}
|
|
@@ -14026,7 +14052,7 @@ async function updatePhase(id, phase, options2) {
|
|
|
14026
14052
|
manualCheck && "manual checks"
|
|
14027
14053
|
].filter(Boolean).join(", ");
|
|
14028
14054
|
console.log(
|
|
14029
|
-
|
|
14055
|
+
chalk108.green(
|
|
14030
14056
|
`Updated ${fields} on phase ${phaseIdx + 1} of item ${formatItemId(itemId2)}.`
|
|
14031
14057
|
)
|
|
14032
14058
|
);
|
|
@@ -14049,7 +14075,7 @@ function registerUpdatePhaseCommand(cmd) {
|
|
|
14049
14075
|
}
|
|
14050
14076
|
|
|
14051
14077
|
// src/commands/backlog/removePhase.ts
|
|
14052
|
-
import
|
|
14078
|
+
import chalk109 from "chalk";
|
|
14053
14079
|
import { and as and18, eq as eq38 } from "drizzle-orm";
|
|
14054
14080
|
async function removePhase(id, phase) {
|
|
14055
14081
|
const found = await findPhase(id, phase);
|
|
@@ -14064,27 +14090,27 @@ async function removePhase(id, phase) {
|
|
|
14064
14090
|
await adjustCurrentPhase(tx, item, phaseIdx);
|
|
14065
14091
|
});
|
|
14066
14092
|
console.log(
|
|
14067
|
-
|
|
14093
|
+
chalk109.green(
|
|
14068
14094
|
`Removed phase ${phaseIdx + 1} from item ${formatItemId(itemId2)}.`
|
|
14069
14095
|
)
|
|
14070
14096
|
);
|
|
14071
14097
|
}
|
|
14072
14098
|
|
|
14073
14099
|
// src/commands/backlog/update/update.ts
|
|
14074
|
-
import
|
|
14100
|
+
import chalk113 from "chalk";
|
|
14075
14101
|
import { eq as eq39 } from "drizzle-orm";
|
|
14076
14102
|
|
|
14077
14103
|
// src/commands/backlog/update/buildUpdateValues.ts
|
|
14078
|
-
import
|
|
14104
|
+
import chalk110 from "chalk";
|
|
14079
14105
|
function buildUpdateValues(options2) {
|
|
14080
14106
|
const { name, desc: desc6, type, ac, origin } = options2;
|
|
14081
14107
|
if (!name && !desc6 && !type && !ac && !origin) {
|
|
14082
|
-
console.log(
|
|
14108
|
+
console.log(chalk110.red("Nothing to update. Provide at least one flag."));
|
|
14083
14109
|
process.exitCode = 1;
|
|
14084
14110
|
return void 0;
|
|
14085
14111
|
}
|
|
14086
14112
|
if (type && type !== "story" && type !== "bug") {
|
|
14087
|
-
console.log(
|
|
14113
|
+
console.log(chalk110.red('Invalid type. Must be "story" or "bug".'));
|
|
14088
14114
|
process.exitCode = 1;
|
|
14089
14115
|
return void 0;
|
|
14090
14116
|
}
|
|
@@ -14114,7 +14140,7 @@ function buildUpdateValues(options2) {
|
|
|
14114
14140
|
}
|
|
14115
14141
|
|
|
14116
14142
|
// src/commands/backlog/update/resolveAcUpdate.ts
|
|
14117
|
-
import
|
|
14143
|
+
import chalk111 from "chalk";
|
|
14118
14144
|
|
|
14119
14145
|
// src/commands/backlog/update/applyAcMutations.ts
|
|
14120
14146
|
function hasAcMutations(options2) {
|
|
@@ -14139,14 +14165,14 @@ function resolveAcUpdate(options2, currentCriteria) {
|
|
|
14139
14165
|
if (!hasAcMutations(options2)) return { ok: true, ac: options2.ac };
|
|
14140
14166
|
if (options2.ac) {
|
|
14141
14167
|
console.log(
|
|
14142
|
-
|
|
14168
|
+
chalk111.red("Cannot combine --ac with --add-ac/--edit-ac/--remove-ac.")
|
|
14143
14169
|
);
|
|
14144
14170
|
process.exitCode = 1;
|
|
14145
14171
|
return { ok: false };
|
|
14146
14172
|
}
|
|
14147
14173
|
const mutation = applyAcMutations(currentCriteria, options2);
|
|
14148
14174
|
if (!mutation.ok) {
|
|
14149
|
-
console.log(
|
|
14175
|
+
console.log(chalk111.red(mutation.error));
|
|
14150
14176
|
process.exitCode = 1;
|
|
14151
14177
|
return { ok: false };
|
|
14152
14178
|
}
|
|
@@ -14154,14 +14180,14 @@ function resolveAcUpdate(options2, currentCriteria) {
|
|
|
14154
14180
|
}
|
|
14155
14181
|
|
|
14156
14182
|
// src/commands/backlog/update/resolveOriginUpdate.ts
|
|
14157
|
-
import
|
|
14183
|
+
import chalk112 from "chalk";
|
|
14158
14184
|
function resolveOriginUpdate(optionOrigin, item) {
|
|
14159
14185
|
if (optionOrigin === void 0 || optionOrigin === false)
|
|
14160
14186
|
return { kind: "none" };
|
|
14161
14187
|
const origin = typeof optionOrigin === "string" ? normalizeOrigin(optionOrigin) : getOrigin();
|
|
14162
14188
|
if (origin === item.origin) {
|
|
14163
14189
|
console.log(
|
|
14164
|
-
|
|
14190
|
+
chalk112.yellow(
|
|
14165
14191
|
`Item ${formatItemId(item.id)} is already on origin "${origin}"; nothing to change.`
|
|
14166
14192
|
)
|
|
14167
14193
|
);
|
|
@@ -14185,12 +14211,12 @@ async function update(id, options2) {
|
|
|
14185
14211
|
const itemId2 = found.item.id;
|
|
14186
14212
|
await orm.update(items).set(built.set).where(eq39(items.id, itemId2));
|
|
14187
14213
|
console.log(
|
|
14188
|
-
|
|
14214
|
+
chalk113.green(`Updated ${built.fields} on item ${formatItemId(itemId2)}.`)
|
|
14189
14215
|
);
|
|
14190
14216
|
}
|
|
14191
14217
|
|
|
14192
14218
|
// src/commands/backlog/updatePlan/index.ts
|
|
14193
|
-
import
|
|
14219
|
+
import chalk115 from "chalk";
|
|
14194
14220
|
|
|
14195
14221
|
// src/commands/backlog/updatePlan/planUpdateSchema.ts
|
|
14196
14222
|
import { z as z6 } from "zod";
|
|
@@ -14240,7 +14266,7 @@ async function replacePlan(orm, itemId2, phases, currentPhase) {
|
|
|
14240
14266
|
|
|
14241
14267
|
// src/commands/backlog/updatePlan/reviewPlanUpdate.ts
|
|
14242
14268
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
14243
|
-
import
|
|
14269
|
+
import chalk114 from "chalk";
|
|
14244
14270
|
|
|
14245
14271
|
// src/commands/backlog/updatePlan/isCompleted.ts
|
|
14246
14272
|
function isCompleted(previousPosition, currentPhase) {
|
|
@@ -14405,7 +14431,7 @@ async function reviewPlanUpdate(item, phases) {
|
|
|
14405
14431
|
});
|
|
14406
14432
|
return;
|
|
14407
14433
|
}
|
|
14408
|
-
console.log(
|
|
14434
|
+
console.log(chalk114.bold(item.name));
|
|
14409
14435
|
console.log(renderMarkdownTerminal(body));
|
|
14410
14436
|
}
|
|
14411
14437
|
|
|
@@ -14418,7 +14444,7 @@ async function updatePlan(id, options2) {
|
|
|
14418
14444
|
await reviewPlanUpdate(item, phases);
|
|
14419
14445
|
await replacePlan(orm, item.id, phases, item.currentPhase);
|
|
14420
14446
|
console.log(
|
|
14421
|
-
|
|
14447
|
+
chalk115.green(
|
|
14422
14448
|
`Replaced the plan on item ${formatItemId(item.id)} with ${phases.length} phase${phases.length === 1 ? "" : "s"}.`
|
|
14423
14449
|
)
|
|
14424
14450
|
);
|
|
@@ -15241,11 +15267,11 @@ function assertCliExists(cli) {
|
|
|
15241
15267
|
}
|
|
15242
15268
|
|
|
15243
15269
|
// src/commands/permitCliReads/colorize.ts
|
|
15244
|
-
import
|
|
15270
|
+
import chalk116 from "chalk";
|
|
15245
15271
|
function colorize(plainOutput) {
|
|
15246
15272
|
return plainOutput.split("\n").map((line) => {
|
|
15247
|
-
if (line.startsWith(" R ")) return
|
|
15248
|
-
if (line.startsWith(" W ")) return
|
|
15273
|
+
if (line.startsWith(" R ")) return chalk116.green(line);
|
|
15274
|
+
if (line.startsWith(" W ")) return chalk116.red(line);
|
|
15249
15275
|
return line;
|
|
15250
15276
|
}).join("\n");
|
|
15251
15277
|
}
|
|
@@ -15538,7 +15564,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
15538
15564
|
}
|
|
15539
15565
|
|
|
15540
15566
|
// src/commands/deny/denyAdd.ts
|
|
15541
|
-
import
|
|
15567
|
+
import chalk117 from "chalk";
|
|
15542
15568
|
|
|
15543
15569
|
// src/commands/deny/loadDenyConfig.ts
|
|
15544
15570
|
function loadDenyConfig(global) {
|
|
@@ -15558,16 +15584,16 @@ function loadDenyConfig(global) {
|
|
|
15558
15584
|
function denyAdd(pattern2, message3, options2) {
|
|
15559
15585
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
15560
15586
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
15561
|
-
console.log(
|
|
15587
|
+
console.log(chalk117.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
15562
15588
|
return;
|
|
15563
15589
|
}
|
|
15564
15590
|
deny.push({ pattern: pattern2, message: message3 });
|
|
15565
15591
|
saveDeny(deny);
|
|
15566
|
-
console.log(
|
|
15592
|
+
console.log(chalk117.green(`Added deny rule: ${pattern2} \u2192 ${message3}`));
|
|
15567
15593
|
}
|
|
15568
15594
|
|
|
15569
15595
|
// src/commands/deny/denyList.ts
|
|
15570
|
-
import
|
|
15596
|
+
import chalk118 from "chalk";
|
|
15571
15597
|
function denyList() {
|
|
15572
15598
|
const globalRaw = loadGlobalConfigRaw();
|
|
15573
15599
|
const projectRaw = loadProjectConfig();
|
|
@@ -15578,7 +15604,7 @@ function denyList() {
|
|
|
15578
15604
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
15579
15605
|
);
|
|
15580
15606
|
if (!merged || merged.length === 0) {
|
|
15581
|
-
console.log(
|
|
15607
|
+
console.log(chalk118.dim("No deny rules configured."));
|
|
15582
15608
|
return;
|
|
15583
15609
|
}
|
|
15584
15610
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -15586,23 +15612,23 @@ function denyList() {
|
|
|
15586
15612
|
for (const rule of merged) {
|
|
15587
15613
|
const inProject = projectPatterns.has(rule.pattern);
|
|
15588
15614
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
15589
|
-
const label2 = inProject && inGlobal ?
|
|
15590
|
-
console.log(`${
|
|
15615
|
+
const label2 = inProject && inGlobal ? chalk118.dim(" (project, overrides global)") : inGlobal ? chalk118.dim(" (global)") : "";
|
|
15616
|
+
console.log(`${chalk118.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
15591
15617
|
}
|
|
15592
15618
|
}
|
|
15593
15619
|
|
|
15594
15620
|
// src/commands/deny/denyRemove.ts
|
|
15595
|
-
import
|
|
15621
|
+
import chalk119 from "chalk";
|
|
15596
15622
|
function denyRemove(pattern2, options2) {
|
|
15597
15623
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
15598
15624
|
const index3 = deny.findIndex((r) => r.pattern === pattern2);
|
|
15599
15625
|
if (index3 === -1) {
|
|
15600
|
-
console.log(
|
|
15626
|
+
console.log(chalk119.yellow(`No deny rule found for: ${pattern2}`));
|
|
15601
15627
|
return;
|
|
15602
15628
|
}
|
|
15603
15629
|
deny.splice(index3, 1);
|
|
15604
15630
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
15605
|
-
console.log(
|
|
15631
|
+
console.log(chalk119.green(`Removed deny rule: ${pattern2}`));
|
|
15606
15632
|
}
|
|
15607
15633
|
|
|
15608
15634
|
// src/commands/registerDeny.ts
|
|
@@ -15646,7 +15672,7 @@ function registerCliHook(program2) {
|
|
|
15646
15672
|
|
|
15647
15673
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
15648
15674
|
import { existsSync as existsSync34, readFileSync as readFileSync29, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
|
|
15649
|
-
import
|
|
15675
|
+
import chalk120 from "chalk";
|
|
15650
15676
|
|
|
15651
15677
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
15652
15678
|
import { homedir as homedir17 } from "os";
|
|
@@ -15699,12 +15725,12 @@ function codeCommentConfirm(pin) {
|
|
|
15699
15725
|
sweepRestrictedDir();
|
|
15700
15726
|
const state = readPinState(pin);
|
|
15701
15727
|
if (!state) {
|
|
15702
|
-
console.error(
|
|
15728
|
+
console.error(chalk120.red(`No pending comment for pin: ${pin}`));
|
|
15703
15729
|
process.exitCode = 1;
|
|
15704
15730
|
return;
|
|
15705
15731
|
}
|
|
15706
15732
|
if (!existsSync34(state.file)) {
|
|
15707
|
-
console.error(
|
|
15733
|
+
console.error(chalk120.red(`Target file no longer exists: ${state.file}`));
|
|
15708
15734
|
process.exitCode = 1;
|
|
15709
15735
|
return;
|
|
15710
15736
|
}
|
|
@@ -15713,7 +15739,7 @@ function codeCommentConfirm(pin) {
|
|
|
15713
15739
|
const index3 = state.line - 1;
|
|
15714
15740
|
if (index3 > lines2.length) {
|
|
15715
15741
|
console.error(
|
|
15716
|
-
|
|
15742
|
+
chalk120.red(
|
|
15717
15743
|
`Line ${state.line} is beyond the end of ${state.file} (${lines2.length} lines).`
|
|
15718
15744
|
)
|
|
15719
15745
|
);
|
|
@@ -15727,14 +15753,14 @@ function codeCommentConfirm(pin) {
|
|
|
15727
15753
|
writeFileSync24(state.file, lines2.join("\n"));
|
|
15728
15754
|
unlinkSync8(getPinStatePath(pin));
|
|
15729
15755
|
console.log(
|
|
15730
|
-
|
|
15756
|
+
chalk120.green(
|
|
15731
15757
|
`Inserted "${marker} ${state.text}" at ${state.file}:${state.line}`
|
|
15732
15758
|
)
|
|
15733
15759
|
);
|
|
15734
15760
|
}
|
|
15735
15761
|
|
|
15736
15762
|
// src/commands/codeComment/codeCommentSet.ts
|
|
15737
|
-
import
|
|
15763
|
+
import chalk121 from "chalk";
|
|
15738
15764
|
|
|
15739
15765
|
// src/commands/codeComment/validateCommentText.ts
|
|
15740
15766
|
var MAX_COMMENT_LENGTH = 50;
|
|
@@ -15785,7 +15811,7 @@ function generatePin() {
|
|
|
15785
15811
|
function codeCommentSet(file, line, text17) {
|
|
15786
15812
|
const lineNumber = Number.parseInt(line, 10);
|
|
15787
15813
|
if (!Number.isInteger(lineNumber) || lineNumber < 1) {
|
|
15788
|
-
console.error(
|
|
15814
|
+
console.error(chalk121.red(`Invalid line number: ${line}`));
|
|
15789
15815
|
process.exitCode = 1;
|
|
15790
15816
|
return;
|
|
15791
15817
|
}
|
|
@@ -15793,20 +15819,20 @@ function codeCommentSet(file, line, text17) {
|
|
|
15793
15819
|
const marker = hash ? "#" : "//";
|
|
15794
15820
|
const validation = validateCommentText(text17, hash);
|
|
15795
15821
|
if (!validation.ok) {
|
|
15796
|
-
console.error(
|
|
15797
|
-
console.error(
|
|
15822
|
+
console.error(chalk121.red(`Refused: ${validation.reason}`));
|
|
15823
|
+
console.error(chalk121.red("No pin issued."));
|
|
15798
15824
|
process.exitCode = 1;
|
|
15799
15825
|
return;
|
|
15800
15826
|
}
|
|
15801
15827
|
console.error(
|
|
15802
|
-
|
|
15828
|
+
chalk121.yellow.bold(
|
|
15803
15829
|
"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."
|
|
15804
15830
|
)
|
|
15805
15831
|
);
|
|
15806
15832
|
const delivered = issuePin(file, lineNumber, validation.text);
|
|
15807
15833
|
if (!delivered) {
|
|
15808
15834
|
console.error(
|
|
15809
|
-
|
|
15835
|
+
chalk121.red(
|
|
15810
15836
|
"Could not deliver the confirmation pin via notification.\nThe comment cannot be confirmed until the notification channel works."
|
|
15811
15837
|
)
|
|
15812
15838
|
);
|
|
@@ -15816,7 +15842,7 @@ function codeCommentSet(file, line, text17) {
|
|
|
15816
15842
|
console.log(
|
|
15817
15843
|
`A confirmation pin was sent to your desktop notifications.
|
|
15818
15844
|
To insert "${marker} ${validation.text}" at ${file}:${lineNumber}, run:
|
|
15819
|
-
${
|
|
15845
|
+
${chalk121.cyan(" assist code-comment confirm <PIN>")}
|
|
15820
15846
|
using the pin from that notification.`
|
|
15821
15847
|
);
|
|
15822
15848
|
}
|
|
@@ -15893,15 +15919,15 @@ function registerCodexHook(program2) {
|
|
|
15893
15919
|
}
|
|
15894
15920
|
|
|
15895
15921
|
// src/commands/complexity/analyze.ts
|
|
15896
|
-
import
|
|
15922
|
+
import chalk130 from "chalk";
|
|
15897
15923
|
|
|
15898
15924
|
// src/commands/complexity/cyclomatic.ts
|
|
15899
|
-
import
|
|
15925
|
+
import chalk123 from "chalk";
|
|
15900
15926
|
|
|
15901
15927
|
// src/commands/complexity/shared/index.ts
|
|
15902
15928
|
import fs20 from "fs";
|
|
15903
15929
|
import path27 from "path";
|
|
15904
|
-
import
|
|
15930
|
+
import chalk122 from "chalk";
|
|
15905
15931
|
import ts5 from "typescript";
|
|
15906
15932
|
|
|
15907
15933
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -16152,7 +16178,7 @@ function createSourceFromFile(filePath) {
|
|
|
16152
16178
|
function withSourceFiles(pattern2, callback, extraIgnore = []) {
|
|
16153
16179
|
const files = findSourceFiles2(pattern2, ".", extraIgnore);
|
|
16154
16180
|
if (files.length === 0) {
|
|
16155
|
-
console.log(
|
|
16181
|
+
console.log(chalk122.yellow("No files found matching pattern"));
|
|
16156
16182
|
return void 0;
|
|
16157
16183
|
}
|
|
16158
16184
|
return callback(files);
|
|
@@ -16185,11 +16211,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
16185
16211
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
16186
16212
|
for (const { file, name, complexity } of results) {
|
|
16187
16213
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
16188
|
-
const color = exceedsThreshold ?
|
|
16189
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
16214
|
+
const color = exceedsThreshold ? chalk123.red : chalk123.white;
|
|
16215
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk123.cyan(complexity)}`);
|
|
16190
16216
|
}
|
|
16191
16217
|
console.log(
|
|
16192
|
-
|
|
16218
|
+
chalk123.dim(
|
|
16193
16219
|
`
|
|
16194
16220
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
16195
16221
|
)
|
|
@@ -16201,7 +16227,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
16201
16227
|
}
|
|
16202
16228
|
|
|
16203
16229
|
// src/commands/complexity/halstead.ts
|
|
16204
|
-
import
|
|
16230
|
+
import chalk124 from "chalk";
|
|
16205
16231
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
16206
16232
|
withSourceFiles(pattern2, (files) => {
|
|
16207
16233
|
const results = [];
|
|
@@ -16216,13 +16242,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
16216
16242
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
16217
16243
|
for (const { file, name, metrics } of results) {
|
|
16218
16244
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
16219
|
-
const color = exceedsThreshold ?
|
|
16245
|
+
const color = exceedsThreshold ? chalk124.red : chalk124.white;
|
|
16220
16246
|
console.log(
|
|
16221
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
16247
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk124.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk124.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk124.magenta(metrics.effort.toFixed(1))}`
|
|
16222
16248
|
);
|
|
16223
16249
|
}
|
|
16224
16250
|
console.log(
|
|
16225
|
-
|
|
16251
|
+
chalk124.dim(
|
|
16226
16252
|
`
|
|
16227
16253
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
16228
16254
|
)
|
|
@@ -16291,15 +16317,15 @@ function collectFileMetrics(files) {
|
|
|
16291
16317
|
}
|
|
16292
16318
|
|
|
16293
16319
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
16294
|
-
import
|
|
16320
|
+
import chalk128 from "chalk";
|
|
16295
16321
|
|
|
16296
16322
|
// src/commands/complexity/maintainability/formatResultLine.ts
|
|
16297
|
-
import
|
|
16323
|
+
import chalk125 from "chalk";
|
|
16298
16324
|
function formatResultLine(entry, failing) {
|
|
16299
16325
|
const { file, avgMaintainability, minMaintainability, override } = entry;
|
|
16300
|
-
const name = failing ?
|
|
16301
|
-
const suffix = override !== void 0 ?
|
|
16302
|
-
return `${name} \u2192 avg: ${
|
|
16326
|
+
const name = failing ? chalk125.red(file) : chalk125.white(file);
|
|
16327
|
+
const suffix = override !== void 0 ? chalk125.magenta(` (override: ${override})`) : "";
|
|
16328
|
+
return `${name} \u2192 avg: ${chalk125.cyan(avgMaintainability.toFixed(1))}, min: ${chalk125.yellow(minMaintainability.toFixed(1))}${suffix}`;
|
|
16303
16329
|
}
|
|
16304
16330
|
|
|
16305
16331
|
// src/commands/complexity/maintainability/getMaintainabilityGitState.ts
|
|
@@ -16350,38 +16376,38 @@ function getMaintainabilityGitState() {
|
|
|
16350
16376
|
|
|
16351
16377
|
// src/commands/complexity/maintainability/printMaintainabilityFailure.ts
|
|
16352
16378
|
import path29 from "path";
|
|
16353
|
-
import
|
|
16379
|
+
import chalk126 from "chalk";
|
|
16354
16380
|
var extractTemplate = "assist refactor extract <file> <functionName> <destination> --apply";
|
|
16355
16381
|
function remediationLine(entry) {
|
|
16356
|
-
return ` ${
|
|
16382
|
+
return ` ${chalk126.bold(entry.file)}
|
|
16357
16383
|
Pick a responsibility and extract it:
|
|
16358
|
-
${
|
|
16384
|
+
${chalk126.cyan(extractTemplate)}`;
|
|
16359
16385
|
}
|
|
16360
16386
|
function cheatLine(entry, gitState) {
|
|
16361
16387
|
const shrank = gitState.shrunkFiles.has(path29.resolve(entry.file));
|
|
16362
16388
|
if (!shrank || gitState.newFileCreated) return "";
|
|
16363
16389
|
return `
|
|
16364
|
-
${
|
|
16390
|
+
${chalk126.red("\u2717 You shrank existing lines in this file without creating a new file. That cannot clear the gate \u2014 extract a responsibility to a new file.")}`;
|
|
16365
16391
|
}
|
|
16366
16392
|
function printMaintainabilityFailure(failing, gitState) {
|
|
16367
16393
|
const blocks = failing.map((entry) => `${remediationLine(entry)}${cheatLine(entry, gitState)}`).join("\n");
|
|
16368
16394
|
console.error(
|
|
16369
|
-
|
|
16395
|
+
chalk126.red(
|
|
16370
16396
|
`
|
|
16371
16397
|
Fail: ${failing.length} file(s) below threshold \u2192 extract a responsibility to a new file.
|
|
16372
16398
|
|
|
16373
16399
|
${blocks}
|
|
16374
16400
|
|
|
16375
|
-
${
|
|
16401
|
+
${chalk126.bold("Diagnose and fix one file at a time.")} Only a new file (Write) or 'assist refactor extract' clears this gate \u2014 editing the existing lines does not.`
|
|
16376
16402
|
)
|
|
16377
16403
|
);
|
|
16378
16404
|
}
|
|
16379
16405
|
|
|
16380
16406
|
// src/commands/complexity/maintainability/printMaintainabilityFormula.ts
|
|
16381
|
-
import
|
|
16407
|
+
import chalk127 from "chalk";
|
|
16382
16408
|
var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
|
|
16383
16409
|
function printMaintainabilityFormula() {
|
|
16384
|
-
console.log(
|
|
16410
|
+
console.log(chalk127.dim(MI_FORMULA));
|
|
16385
16411
|
}
|
|
16386
16412
|
|
|
16387
16413
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
@@ -16390,7 +16416,7 @@ function displayMaintainabilityResults(results, threshold, gitState = getMaintai
|
|
|
16390
16416
|
if (!gating) {
|
|
16391
16417
|
printMaintainabilityFormula();
|
|
16392
16418
|
for (const entry of results) console.log(formatResultLine(entry, false));
|
|
16393
|
-
console.log(
|
|
16419
|
+
console.log(chalk128.dim(`
|
|
16394
16420
|
Analyzed ${results.length} files`));
|
|
16395
16421
|
return;
|
|
16396
16422
|
}
|
|
@@ -16399,14 +16425,14 @@ Analyzed ${results.length} files`));
|
|
|
16399
16425
|
return limit !== void 0 && r.minMaintainability < limit;
|
|
16400
16426
|
});
|
|
16401
16427
|
if (failing.length === 0) {
|
|
16402
|
-
console.log(
|
|
16428
|
+
console.log(chalk128.green("All files pass maintainability threshold"));
|
|
16403
16429
|
}
|
|
16404
16430
|
const passingOverrides = results.filter(
|
|
16405
16431
|
(r) => r.override !== void 0 && !failing.includes(r)
|
|
16406
16432
|
);
|
|
16407
16433
|
for (const entry of passingOverrides)
|
|
16408
16434
|
console.log(formatResultLine(entry, false));
|
|
16409
|
-
console.log(
|
|
16435
|
+
console.log(chalk128.dim(`
|
|
16410
16436
|
Analyzed ${results.length} files`));
|
|
16411
16437
|
if (failing.length > 0) {
|
|
16412
16438
|
printMaintainabilityFailure(failing, gitState);
|
|
@@ -16429,7 +16455,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
16429
16455
|
|
|
16430
16456
|
// src/commands/complexity/sloc.ts
|
|
16431
16457
|
import fs22 from "fs";
|
|
16432
|
-
import
|
|
16458
|
+
import chalk129 from "chalk";
|
|
16433
16459
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
16434
16460
|
withSourceFiles(pattern2, (files) => {
|
|
16435
16461
|
const results = [];
|
|
@@ -16445,12 +16471,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
16445
16471
|
results.sort((a, b) => b.lines - a.lines);
|
|
16446
16472
|
for (const { file, lines: lines2 } of results) {
|
|
16447
16473
|
const exceedsThreshold = options2.threshold !== void 0 && lines2 > options2.threshold;
|
|
16448
|
-
const color = exceedsThreshold ?
|
|
16449
|
-
console.log(`${color(file)} \u2192 ${
|
|
16474
|
+
const color = exceedsThreshold ? chalk129.red : chalk129.white;
|
|
16475
|
+
console.log(`${color(file)} \u2192 ${chalk129.cyan(lines2)} lines`);
|
|
16450
16476
|
}
|
|
16451
16477
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
16452
16478
|
console.log(
|
|
16453
|
-
|
|
16479
|
+
chalk129.dim(`
|
|
16454
16480
|
Total: ${total} lines across ${files.length} files`)
|
|
16455
16481
|
);
|
|
16456
16482
|
if (hasViolation) {
|
|
@@ -16464,25 +16490,25 @@ async function analyze(pattern2) {
|
|
|
16464
16490
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
16465
16491
|
const files = findSourceFiles2(searchPattern);
|
|
16466
16492
|
if (files.length === 0) {
|
|
16467
|
-
console.log(
|
|
16493
|
+
console.log(chalk130.yellow("No files found matching pattern"));
|
|
16468
16494
|
return;
|
|
16469
16495
|
}
|
|
16470
16496
|
if (files.length === 1) {
|
|
16471
16497
|
const file = files[0];
|
|
16472
|
-
console.log(
|
|
16498
|
+
console.log(chalk130.bold.underline("SLOC"));
|
|
16473
16499
|
await sloc(file);
|
|
16474
16500
|
console.log();
|
|
16475
|
-
console.log(
|
|
16501
|
+
console.log(chalk130.bold.underline("Cyclomatic Complexity"));
|
|
16476
16502
|
await cyclomatic(file);
|
|
16477
16503
|
console.log();
|
|
16478
|
-
console.log(
|
|
16504
|
+
console.log(chalk130.bold.underline("Halstead Metrics"));
|
|
16479
16505
|
await halstead(file);
|
|
16480
16506
|
console.log();
|
|
16481
|
-
console.log(
|
|
16507
|
+
console.log(chalk130.bold.underline("Maintainability Index"));
|
|
16482
16508
|
await maintainability(file);
|
|
16483
16509
|
console.log();
|
|
16484
16510
|
console.log(
|
|
16485
|
-
|
|
16511
|
+
chalk130.dim(
|
|
16486
16512
|
"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."
|
|
16487
16513
|
)
|
|
16488
16514
|
);
|
|
@@ -16533,7 +16559,7 @@ function configList() {
|
|
|
16533
16559
|
}
|
|
16534
16560
|
|
|
16535
16561
|
// src/commands/config/configGet.ts
|
|
16536
|
-
import
|
|
16562
|
+
import chalk131 from "chalk";
|
|
16537
16563
|
function configGet(key) {
|
|
16538
16564
|
console.log(
|
|
16539
16565
|
formatOutput(
|
|
@@ -16550,12 +16576,12 @@ function requireNestedValue(config, key) {
|
|
|
16550
16576
|
return value;
|
|
16551
16577
|
}
|
|
16552
16578
|
function exitKeyNotSet(key) {
|
|
16553
|
-
console.error(
|
|
16579
|
+
console.error(chalk131.red(`Key "${key}" is not set`));
|
|
16554
16580
|
process.exit(1);
|
|
16555
16581
|
}
|
|
16556
16582
|
|
|
16557
16583
|
// src/commands/config/configSet.ts
|
|
16558
|
-
import
|
|
16584
|
+
import chalk133 from "chalk";
|
|
16559
16585
|
|
|
16560
16586
|
// src/commands/config/coerceCliConfigValue.ts
|
|
16561
16587
|
function coerceCliConfigValue(key, raw) {
|
|
@@ -16576,9 +16602,9 @@ function coerceWithoutSchemaLeaf(raw) {
|
|
|
16576
16602
|
}
|
|
16577
16603
|
|
|
16578
16604
|
// src/commands/config/exitWithConfigErrors.ts
|
|
16579
|
-
import
|
|
16605
|
+
import chalk132 from "chalk";
|
|
16580
16606
|
function exitWithConfigErrors(errors) {
|
|
16581
|
-
for (const error of errors) console.error(
|
|
16607
|
+
for (const error of errors) console.error(chalk132.red(error));
|
|
16582
16608
|
process.exit(1);
|
|
16583
16609
|
}
|
|
16584
16610
|
|
|
@@ -16597,13 +16623,13 @@ function resolveRepoTarget(key, value, repo) {
|
|
|
16597
16623
|
function configSet(key, value, options2 = {}) {
|
|
16598
16624
|
if (options2.repo !== void 0 && !options2.global) {
|
|
16599
16625
|
console.error(
|
|
16600
|
-
|
|
16626
|
+
chalk133.red("--repo writes to the global config; add -g (e.g. -g --repo)")
|
|
16601
16627
|
);
|
|
16602
16628
|
process.exit(1);
|
|
16603
16629
|
}
|
|
16604
16630
|
const resolved = resolveRepoTarget(key, value, options2.repo);
|
|
16605
16631
|
if (resolved.value === void 0) {
|
|
16606
|
-
console.error(
|
|
16632
|
+
console.error(chalk133.red(`Missing required argument for '${resolved.key}'`));
|
|
16607
16633
|
process.exit(1);
|
|
16608
16634
|
}
|
|
16609
16635
|
const coercion = coerceCliConfigValue(resolved.key, resolved.value);
|
|
@@ -16611,7 +16637,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
16611
16637
|
const coerced = coercion.value;
|
|
16612
16638
|
const target = resolved.useRepo ? `repo: ${applyRepoOrExit(resolved.key, coerced, resolved.repoName)}` : applyOrExit(resolved.key, coerced, options2.global ?? false);
|
|
16613
16639
|
console.log(
|
|
16614
|
-
|
|
16640
|
+
chalk133.green(`Set ${resolved.key} = ${JSON.stringify(coerced)} (${target})`)
|
|
16615
16641
|
);
|
|
16616
16642
|
}
|
|
16617
16643
|
function applyOrExit(key, coerced, global) {
|
|
@@ -16626,7 +16652,7 @@ function applyRepoOrExit(key, coerced, repoName) {
|
|
|
16626
16652
|
}
|
|
16627
16653
|
|
|
16628
16654
|
// src/commands/config/configUnset.ts
|
|
16629
|
-
import
|
|
16655
|
+
import chalk134 from "chalk";
|
|
16630
16656
|
|
|
16631
16657
|
// src/commands/config/resolveRepoUnsetTarget.ts
|
|
16632
16658
|
function resolveRepoUnsetTarget(key, repo) {
|
|
@@ -16642,7 +16668,7 @@ function resolveRepoUnsetTarget(key, repo) {
|
|
|
16642
16668
|
function configUnset(key, options2 = {}) {
|
|
16643
16669
|
if (options2.repo !== void 0 && !options2.global) {
|
|
16644
16670
|
console.error(
|
|
16645
|
-
|
|
16671
|
+
chalk134.red(
|
|
16646
16672
|
"--repo removes from the global config; add -g (e.g. -g --repo)"
|
|
16647
16673
|
)
|
|
16648
16674
|
);
|
|
@@ -16650,7 +16676,7 @@ function configUnset(key, options2 = {}) {
|
|
|
16650
16676
|
}
|
|
16651
16677
|
const resolved = resolveRepoUnsetTarget(key, options2.repo);
|
|
16652
16678
|
if (resolved.key === void 0) {
|
|
16653
|
-
console.error(
|
|
16679
|
+
console.error(chalk134.red("Missing required argument 'key'"));
|
|
16654
16680
|
process.exit(1);
|
|
16655
16681
|
return;
|
|
16656
16682
|
}
|
|
@@ -16658,11 +16684,11 @@ function configUnset(key, options2 = {}) {
|
|
|
16658
16684
|
if (!result.ok) exitWithConfigErrors(result.errors);
|
|
16659
16685
|
if (!result.removed) {
|
|
16660
16686
|
console.log(
|
|
16661
|
-
|
|
16687
|
+
chalk134.yellow(`${resolved.key} is not set in ${whereLabel(result)}`)
|
|
16662
16688
|
);
|
|
16663
16689
|
return;
|
|
16664
16690
|
}
|
|
16665
|
-
console.log(
|
|
16691
|
+
console.log(chalk134.green(`Unset ${resolved.key} (${targetLabel(result)})`));
|
|
16666
16692
|
}
|
|
16667
16693
|
function whereLabel(result) {
|
|
16668
16694
|
return result.target === "repo" ? `repos.${result.label}` : `the ${result.target} config`;
|
|
@@ -16687,40 +16713,40 @@ function registerConfig(program2) {
|
|
|
16687
16713
|
}
|
|
16688
16714
|
|
|
16689
16715
|
// src/commands/db/reportMigrationStatus.ts
|
|
16690
|
-
import
|
|
16716
|
+
import chalk135 from "chalk";
|
|
16691
16717
|
function reportApplied(applied) {
|
|
16692
16718
|
if (applied.length === 0) {
|
|
16693
|
-
console.error(
|
|
16719
|
+
console.error(chalk135.green("Database is up to date; nothing to apply."));
|
|
16694
16720
|
return;
|
|
16695
16721
|
}
|
|
16696
16722
|
for (const migration of applied) {
|
|
16697
16723
|
console.error(
|
|
16698
|
-
|
|
16724
|
+
chalk135.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
16699
16725
|
);
|
|
16700
16726
|
}
|
|
16701
16727
|
}
|
|
16702
16728
|
function reportMigrationStatus(status3) {
|
|
16703
16729
|
if (status3.state === "in-sync") {
|
|
16704
16730
|
console.error(
|
|
16705
|
-
|
|
16731
|
+
chalk135.green(`In sync at migration ${status3.version} (latest).`)
|
|
16706
16732
|
);
|
|
16707
16733
|
return;
|
|
16708
16734
|
}
|
|
16709
16735
|
if (status3.state === "behind") {
|
|
16710
16736
|
console.error(
|
|
16711
|
-
|
|
16737
|
+
chalk135.yellow(
|
|
16712
16738
|
`Behind: applied ${status3.applied}, build expects ${status3.expected}.`
|
|
16713
16739
|
)
|
|
16714
16740
|
);
|
|
16715
16741
|
console.error(
|
|
16716
|
-
|
|
16742
|
+
chalk135.yellow(
|
|
16717
16743
|
`Pending: ${status3.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
16718
16744
|
)
|
|
16719
16745
|
);
|
|
16720
16746
|
return;
|
|
16721
16747
|
}
|
|
16722
16748
|
console.error(
|
|
16723
|
-
|
|
16749
|
+
chalk135.red(
|
|
16724
16750
|
`Ahead: applied ${status3.applied}, build knows ${status3.expected}. Update assist.`
|
|
16725
16751
|
)
|
|
16726
16752
|
);
|
|
@@ -16755,7 +16781,7 @@ function registerDb(program2) {
|
|
|
16755
16781
|
|
|
16756
16782
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
16757
16783
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs";
|
|
16758
|
-
import
|
|
16784
|
+
import chalk136 from "chalk";
|
|
16759
16785
|
|
|
16760
16786
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
16761
16787
|
import { join as join36 } from "path";
|
|
@@ -16786,7 +16812,7 @@ function dbMigrationConfirm(pin) {
|
|
|
16786
16812
|
sweepRestrictedDir();
|
|
16787
16813
|
const state = readMigrationPinState(pin);
|
|
16788
16814
|
if (!state) {
|
|
16789
|
-
console.error(
|
|
16815
|
+
console.error(chalk136.red(`No pending migration unlock for pin: ${pin}`));
|
|
16790
16816
|
process.exitCode = 1;
|
|
16791
16817
|
return;
|
|
16792
16818
|
}
|
|
@@ -16796,7 +16822,7 @@ function dbMigrationConfirm(pin) {
|
|
|
16796
16822
|
);
|
|
16797
16823
|
unlinkSync9(getMigrationPinPath(pin));
|
|
16798
16824
|
console.log(
|
|
16799
|
-
|
|
16825
|
+
chalk136.green(
|
|
16800
16826
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
16801
16827
|
)
|
|
16802
16828
|
);
|
|
@@ -16805,7 +16831,7 @@ function dbMigrationConfirm(pin) {
|
|
|
16805
16831
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
16806
16832
|
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync27 } from "fs";
|
|
16807
16833
|
import { randomInt as randomInt2 } from "crypto";
|
|
16808
|
-
import
|
|
16834
|
+
import chalk137 from "chalk";
|
|
16809
16835
|
|
|
16810
16836
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
16811
16837
|
function nextMigrationId() {
|
|
@@ -16820,7 +16846,7 @@ function dbMigrationUnlock() {
|
|
|
16820
16846
|
sweepRestrictedDir();
|
|
16821
16847
|
writeFileSync27(getMigrationPinPath(pin), JSON.stringify({ pin, migrationId }));
|
|
16822
16848
|
console.error(
|
|
16823
|
-
|
|
16849
|
+
chalk137.yellow.bold(
|
|
16824
16850
|
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a new database migration.\nA schema change is hard to reverse once shipped. You had BETTER have confirmed\nthe change with the user and be certain this migration is genuinely necessary."
|
|
16825
16851
|
)
|
|
16826
16852
|
);
|
|
@@ -16830,7 +16856,7 @@ function dbMigrationUnlock() {
|
|
|
16830
16856
|
});
|
|
16831
16857
|
if (!delivered) {
|
|
16832
16858
|
console.error(
|
|
16833
|
-
|
|
16859
|
+
chalk137.red(
|
|
16834
16860
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
16835
16861
|
)
|
|
16836
16862
|
);
|
|
@@ -16840,7 +16866,7 @@ function dbMigrationUnlock() {
|
|
|
16840
16866
|
console.log(
|
|
16841
16867
|
`A confirmation pin was sent to your desktop notifications.
|
|
16842
16868
|
To approve creating migration ${migrationId}, run:
|
|
16843
|
-
${
|
|
16869
|
+
${chalk137.cyan(" assist db-migration confirm <PIN>")}
|
|
16844
16870
|
using the pin from that notification.`
|
|
16845
16871
|
);
|
|
16846
16872
|
}
|
|
@@ -16860,7 +16886,7 @@ function registerDbMigration(parent) {
|
|
|
16860
16886
|
|
|
16861
16887
|
// src/commands/deploy/redirect.ts
|
|
16862
16888
|
import { existsSync as existsSync36, readFileSync as readFileSync31, writeFileSync as writeFileSync28 } from "fs";
|
|
16863
|
-
import
|
|
16889
|
+
import chalk138 from "chalk";
|
|
16864
16890
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
16865
16891
|
if (!window.location.pathname.endsWith('/')) {
|
|
16866
16892
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -16869,23 +16895,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
16869
16895
|
function redirect() {
|
|
16870
16896
|
const indexPath = "index.html";
|
|
16871
16897
|
if (!existsSync36(indexPath)) {
|
|
16872
|
-
console.log(
|
|
16898
|
+
console.log(chalk138.yellow("No index.html found"));
|
|
16873
16899
|
return;
|
|
16874
16900
|
}
|
|
16875
16901
|
const content = readFileSync31(indexPath, "utf8");
|
|
16876
16902
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
16877
|
-
console.log(
|
|
16903
|
+
console.log(chalk138.dim("Trailing slash script already present"));
|
|
16878
16904
|
return;
|
|
16879
16905
|
}
|
|
16880
16906
|
const headCloseIndex = content.indexOf("</head>");
|
|
16881
16907
|
if (headCloseIndex === -1) {
|
|
16882
|
-
console.log(
|
|
16908
|
+
console.log(chalk138.red("Could not find </head> tag in index.html"));
|
|
16883
16909
|
return;
|
|
16884
16910
|
}
|
|
16885
16911
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
16886
16912
|
${content.slice(headCloseIndex)}`;
|
|
16887
16913
|
writeFileSync28(indexPath, newContent);
|
|
16888
|
-
console.log(
|
|
16914
|
+
console.log(chalk138.green("Added trailing slash redirect to index.html"));
|
|
16889
16915
|
}
|
|
16890
16916
|
|
|
16891
16917
|
// src/commands/registerDeploy.ts
|
|
@@ -16912,7 +16938,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
16912
16938
|
|
|
16913
16939
|
// src/commands/devlog/shared.ts
|
|
16914
16940
|
import { execSync as execSync36 } from "child_process";
|
|
16915
|
-
import
|
|
16941
|
+
import chalk139 from "chalk";
|
|
16916
16942
|
|
|
16917
16943
|
// src/shared/getRepoName.ts
|
|
16918
16944
|
import { existsSync as existsSync37, readFileSync as readFileSync32 } from "fs";
|
|
@@ -17021,13 +17047,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
17021
17047
|
}
|
|
17022
17048
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
17023
17049
|
for (const commit2 of commits2) {
|
|
17024
|
-
console.log(` ${
|
|
17050
|
+
console.log(` ${chalk139.yellow(commit2.hash)} ${commit2.message}`);
|
|
17025
17051
|
if (verbose) {
|
|
17026
17052
|
const visibleFiles = commit2.files.filter(
|
|
17027
17053
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
17028
17054
|
);
|
|
17029
17055
|
for (const file of visibleFiles) {
|
|
17030
|
-
console.log(` ${
|
|
17056
|
+
console.log(` ${chalk139.dim(file)}`);
|
|
17031
17057
|
}
|
|
17032
17058
|
}
|
|
17033
17059
|
}
|
|
@@ -17052,15 +17078,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
17052
17078
|
}
|
|
17053
17079
|
|
|
17054
17080
|
// src/commands/devlog/list/printDateHeader.ts
|
|
17055
|
-
import
|
|
17081
|
+
import chalk140 from "chalk";
|
|
17056
17082
|
function printDateHeader(date, isSkipped, entries) {
|
|
17057
17083
|
if (isSkipped) {
|
|
17058
|
-
console.log(`${
|
|
17084
|
+
console.log(`${chalk140.bold.blue(date)} ${chalk140.dim("skipped")}`);
|
|
17059
17085
|
} else if (entries && entries.length > 0) {
|
|
17060
|
-
const entryInfo = entries.map((e) => `${
|
|
17061
|
-
console.log(`${
|
|
17086
|
+
const entryInfo = entries.map((e) => `${chalk140.green(e.version)} ${e.title}`).join(" | ");
|
|
17087
|
+
console.log(`${chalk140.bold.blue(date)} ${entryInfo}`);
|
|
17062
17088
|
} else {
|
|
17063
|
-
console.log(`${
|
|
17089
|
+
console.log(`${chalk140.bold.blue(date)} ${chalk140.red("\u26A0 devlog missing")}`);
|
|
17064
17090
|
}
|
|
17065
17091
|
}
|
|
17066
17092
|
|
|
@@ -17164,24 +17190,24 @@ function bumpVersion(version2, type) {
|
|
|
17164
17190
|
|
|
17165
17191
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
17166
17192
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
17167
|
-
import
|
|
17193
|
+
import chalk142 from "chalk";
|
|
17168
17194
|
|
|
17169
17195
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
17170
|
-
import
|
|
17196
|
+
import chalk141 from "chalk";
|
|
17171
17197
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
17172
17198
|
if (conventional && firstHash) {
|
|
17173
17199
|
const version2 = getVersionAtCommit(firstHash);
|
|
17174
17200
|
if (version2) {
|
|
17175
|
-
console.log(`${
|
|
17201
|
+
console.log(`${chalk141.bold("version:")} ${stripToMinor(version2)}`);
|
|
17176
17202
|
} else {
|
|
17177
|
-
console.log(`${
|
|
17203
|
+
console.log(`${chalk141.bold("version:")} ${chalk141.red("unknown")}`);
|
|
17178
17204
|
}
|
|
17179
17205
|
} else if (patchVersion && minorVersion) {
|
|
17180
17206
|
console.log(
|
|
17181
|
-
`${
|
|
17207
|
+
`${chalk141.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
17182
17208
|
);
|
|
17183
17209
|
} else {
|
|
17184
|
-
console.log(`${
|
|
17210
|
+
console.log(`${chalk141.bold("version:")} v0.1 (initial)`);
|
|
17185
17211
|
}
|
|
17186
17212
|
}
|
|
17187
17213
|
|
|
@@ -17229,16 +17255,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
17229
17255
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
17230
17256
|
}
|
|
17231
17257
|
function logName(repoName) {
|
|
17232
|
-
console.log(`${
|
|
17258
|
+
console.log(`${chalk142.bold("name:")} ${repoName}`);
|
|
17233
17259
|
}
|
|
17234
17260
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
17235
17261
|
logName(ctx.repoName);
|
|
17236
17262
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
17237
|
-
console.log(
|
|
17263
|
+
console.log(chalk142.bold.blue(targetDate));
|
|
17238
17264
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
17239
17265
|
}
|
|
17240
17266
|
function logNoCommits(lastInfo) {
|
|
17241
|
-
console.log(
|
|
17267
|
+
console.log(chalk142.dim(noCommitsMessage(!!lastInfo)));
|
|
17242
17268
|
}
|
|
17243
17269
|
|
|
17244
17270
|
// src/commands/devlog/next/index.ts
|
|
@@ -17279,11 +17305,11 @@ function next2(options2) {
|
|
|
17279
17305
|
import { execSync as execSync38 } from "child_process";
|
|
17280
17306
|
|
|
17281
17307
|
// src/commands/devlog/repos/printReposTable.ts
|
|
17282
|
-
import
|
|
17308
|
+
import chalk143 from "chalk";
|
|
17283
17309
|
function colorStatus(status3) {
|
|
17284
|
-
if (status3 === "missing") return
|
|
17285
|
-
if (status3 === "outdated") return
|
|
17286
|
-
return
|
|
17310
|
+
if (status3 === "missing") return chalk143.red(status3);
|
|
17311
|
+
if (status3 === "outdated") return chalk143.yellow(status3);
|
|
17312
|
+
return chalk143.green(status3);
|
|
17287
17313
|
}
|
|
17288
17314
|
function formatRow(row, nameWidth) {
|
|
17289
17315
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -17297,8 +17323,8 @@ function printReposTable(rows) {
|
|
|
17297
17323
|
"Last Devlog".padEnd(11),
|
|
17298
17324
|
"Status"
|
|
17299
17325
|
].join(" ");
|
|
17300
|
-
console.log(
|
|
17301
|
-
console.log(
|
|
17326
|
+
console.log(chalk143.dim(header));
|
|
17327
|
+
console.log(chalk143.dim("-".repeat(header.length)));
|
|
17302
17328
|
for (const row of rows) {
|
|
17303
17329
|
console.log(formatRow(row, nameWidth));
|
|
17304
17330
|
}
|
|
@@ -17356,14 +17382,14 @@ function repos(options2) {
|
|
|
17356
17382
|
// src/commands/devlog/skip.ts
|
|
17357
17383
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
17358
17384
|
import { join as join40 } from "path";
|
|
17359
|
-
import
|
|
17385
|
+
import chalk144 from "chalk";
|
|
17360
17386
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
17361
17387
|
function getBlogConfigPath() {
|
|
17362
17388
|
return join40(BLOG_REPO_ROOT, "assist.yml");
|
|
17363
17389
|
}
|
|
17364
17390
|
function skip(date) {
|
|
17365
17391
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
17366
|
-
console.log(
|
|
17392
|
+
console.log(chalk144.red("Invalid date format. Use YYYY-MM-DD"));
|
|
17367
17393
|
process.exit(1);
|
|
17368
17394
|
}
|
|
17369
17395
|
const repoName = getRepoName();
|
|
@@ -17374,7 +17400,7 @@ function skip(date) {
|
|
|
17374
17400
|
const skipDays = skip2[repoName] ?? [];
|
|
17375
17401
|
if (skipDays.includes(date)) {
|
|
17376
17402
|
console.log(
|
|
17377
|
-
|
|
17403
|
+
chalk144.yellow(`${date} is already in skip list for ${repoName}`)
|
|
17378
17404
|
);
|
|
17379
17405
|
return;
|
|
17380
17406
|
}
|
|
@@ -17384,20 +17410,20 @@ function skip(date) {
|
|
|
17384
17410
|
devlog.skip = skip2;
|
|
17385
17411
|
config.devlog = devlog;
|
|
17386
17412
|
writeFileSync29(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
17387
|
-
console.log(
|
|
17413
|
+
console.log(chalk144.green(`Added ${date} to skip list for ${repoName}`));
|
|
17388
17414
|
}
|
|
17389
17415
|
|
|
17390
17416
|
// src/commands/devlog/version.ts
|
|
17391
|
-
import
|
|
17417
|
+
import chalk145 from "chalk";
|
|
17392
17418
|
function version() {
|
|
17393
17419
|
const config = loadConfig();
|
|
17394
17420
|
const name = getRepoName();
|
|
17395
17421
|
const lastInfo = getLastVersionInfo(name, config);
|
|
17396
17422
|
const lastVersion = lastInfo?.version ?? null;
|
|
17397
17423
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
17398
|
-
console.log(`${
|
|
17399
|
-
console.log(`${
|
|
17400
|
-
console.log(`${
|
|
17424
|
+
console.log(`${chalk145.bold("name:")} ${name}`);
|
|
17425
|
+
console.log(`${chalk145.bold("last:")} ${lastVersion ?? chalk145.dim("none")}`);
|
|
17426
|
+
console.log(`${chalk145.bold("next:")} ${nextVersion ?? chalk145.dim("none")}`);
|
|
17401
17427
|
}
|
|
17402
17428
|
|
|
17403
17429
|
// src/commands/devlog/devlogConfigHelp.ts
|
|
@@ -17441,7 +17467,7 @@ function registerDevlog(program2) {
|
|
|
17441
17467
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
17442
17468
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync5 } from "fs";
|
|
17443
17469
|
import { join as join41 } from "path";
|
|
17444
|
-
import
|
|
17470
|
+
import chalk146 from "chalk";
|
|
17445
17471
|
|
|
17446
17472
|
// src/shared/findRepoRoot.ts
|
|
17447
17473
|
import { existsSync as existsSync38 } from "fs";
|
|
@@ -17504,14 +17530,14 @@ function checkBuildLocks(startDir) {
|
|
|
17504
17530
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
17505
17531
|
if (locked) {
|
|
17506
17532
|
console.error(
|
|
17507
|
-
|
|
17533
|
+
chalk146.red("Build output locked (is VS debugging?): ") + locked
|
|
17508
17534
|
);
|
|
17509
17535
|
process.exit(1);
|
|
17510
17536
|
}
|
|
17511
17537
|
}
|
|
17512
17538
|
async function checkBuildLocksCommand() {
|
|
17513
17539
|
checkBuildLocks();
|
|
17514
|
-
console.log(
|
|
17540
|
+
console.log(chalk146.green("No build locks detected"));
|
|
17515
17541
|
}
|
|
17516
17542
|
|
|
17517
17543
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -17610,30 +17636,30 @@ function escapeRegex(s) {
|
|
|
17610
17636
|
}
|
|
17611
17637
|
|
|
17612
17638
|
// src/commands/dotnet/printTree.ts
|
|
17613
|
-
import
|
|
17639
|
+
import chalk147 from "chalk";
|
|
17614
17640
|
function printNodes(nodes, prefix2) {
|
|
17615
17641
|
for (let i = 0; i < nodes.length; i++) {
|
|
17616
17642
|
const isLast = i === nodes.length - 1;
|
|
17617
17643
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
17618
17644
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
17619
17645
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
17620
|
-
const label2 = isMissing ?
|
|
17646
|
+
const label2 = isMissing ? chalk147.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
17621
17647
|
console.log(`${prefix2}${connector}${label2}`);
|
|
17622
17648
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
17623
17649
|
}
|
|
17624
17650
|
}
|
|
17625
17651
|
function printTree(tree, totalCount, solutions) {
|
|
17626
|
-
console.log(
|
|
17627
|
-
console.log(
|
|
17652
|
+
console.log(chalk147.bold("\nProject Dependency Tree"));
|
|
17653
|
+
console.log(chalk147.cyan(tree.relativePath));
|
|
17628
17654
|
printNodes(tree.children, "");
|
|
17629
|
-
console.log(
|
|
17655
|
+
console.log(chalk147.dim(`
|
|
17630
17656
|
${totalCount} projects total (including root)`));
|
|
17631
|
-
console.log(
|
|
17657
|
+
console.log(chalk147.bold("\nSolution Membership"));
|
|
17632
17658
|
if (solutions.length === 0) {
|
|
17633
|
-
console.log(
|
|
17659
|
+
console.log(chalk147.yellow(" Not found in any .sln"));
|
|
17634
17660
|
} else {
|
|
17635
17661
|
for (const sln of solutions) {
|
|
17636
|
-
console.log(` ${
|
|
17662
|
+
console.log(` ${chalk147.green(sln)}`);
|
|
17637
17663
|
}
|
|
17638
17664
|
}
|
|
17639
17665
|
console.log();
|
|
@@ -17662,16 +17688,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
17662
17688
|
// src/commands/dotnet/resolveCsproj.ts
|
|
17663
17689
|
import { existsSync as existsSync39 } from "fs";
|
|
17664
17690
|
import path33 from "path";
|
|
17665
|
-
import
|
|
17691
|
+
import chalk148 from "chalk";
|
|
17666
17692
|
function resolveCsproj(csprojPath) {
|
|
17667
17693
|
const resolved = path33.resolve(csprojPath);
|
|
17668
17694
|
if (!existsSync39(resolved)) {
|
|
17669
|
-
console.error(
|
|
17695
|
+
console.error(chalk148.red(`File not found: ${resolved}`));
|
|
17670
17696
|
process.exit(1);
|
|
17671
17697
|
}
|
|
17672
17698
|
const repoRoot = findRepoRoot(path33.dirname(resolved));
|
|
17673
17699
|
if (!repoRoot) {
|
|
17674
|
-
console.error(
|
|
17700
|
+
console.error(chalk148.red("Could not find git repository root"));
|
|
17675
17701
|
process.exit(1);
|
|
17676
17702
|
}
|
|
17677
17703
|
return { resolved, repoRoot };
|
|
@@ -17721,12 +17747,12 @@ function getChangedCsFiles(scope) {
|
|
|
17721
17747
|
}
|
|
17722
17748
|
|
|
17723
17749
|
// src/commands/dotnet/inSln.ts
|
|
17724
|
-
import
|
|
17750
|
+
import chalk149 from "chalk";
|
|
17725
17751
|
async function inSln(csprojPath) {
|
|
17726
17752
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
17727
17753
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
17728
17754
|
if (solutions.length === 0) {
|
|
17729
|
-
console.log(
|
|
17755
|
+
console.log(chalk149.yellow("Not found in any .sln file"));
|
|
17730
17756
|
process.exit(1);
|
|
17731
17757
|
}
|
|
17732
17758
|
for (const sln of solutions) {
|
|
@@ -17735,7 +17761,7 @@ async function inSln(csprojPath) {
|
|
|
17735
17761
|
}
|
|
17736
17762
|
|
|
17737
17763
|
// src/commands/dotnet/inspect.ts
|
|
17738
|
-
import
|
|
17764
|
+
import chalk155 from "chalk";
|
|
17739
17765
|
|
|
17740
17766
|
// src/shared/formatElapsed.ts
|
|
17741
17767
|
function formatElapsed(ms) {
|
|
@@ -17747,12 +17773,12 @@ function formatElapsed(ms) {
|
|
|
17747
17773
|
}
|
|
17748
17774
|
|
|
17749
17775
|
// src/commands/dotnet/displayIssues.ts
|
|
17750
|
-
import
|
|
17776
|
+
import chalk150 from "chalk";
|
|
17751
17777
|
var SEVERITY_COLOR = {
|
|
17752
|
-
ERROR:
|
|
17753
|
-
WARNING:
|
|
17754
|
-
SUGGESTION:
|
|
17755
|
-
HINT:
|
|
17778
|
+
ERROR: chalk150.red,
|
|
17779
|
+
WARNING: chalk150.yellow,
|
|
17780
|
+
SUGGESTION: chalk150.cyan,
|
|
17781
|
+
HINT: chalk150.dim
|
|
17756
17782
|
};
|
|
17757
17783
|
function groupByFile(issues) {
|
|
17758
17784
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -17768,15 +17794,15 @@ function groupByFile(issues) {
|
|
|
17768
17794
|
}
|
|
17769
17795
|
function displayIssues(issues) {
|
|
17770
17796
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
17771
|
-
console.log(
|
|
17797
|
+
console.log(chalk150.bold(file));
|
|
17772
17798
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
17773
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
17799
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk150.white;
|
|
17774
17800
|
console.log(
|
|
17775
|
-
` ${
|
|
17801
|
+
` ${chalk150.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
17776
17802
|
);
|
|
17777
17803
|
}
|
|
17778
17804
|
}
|
|
17779
|
-
console.log(
|
|
17805
|
+
console.log(chalk150.dim(`
|
|
17780
17806
|
${issues.length} issue(s) found`));
|
|
17781
17807
|
}
|
|
17782
17808
|
|
|
@@ -17835,12 +17861,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
17835
17861
|
// src/commands/dotnet/resolveSolution.ts
|
|
17836
17862
|
import { existsSync as existsSync40 } from "fs";
|
|
17837
17863
|
import path34 from "path";
|
|
17838
|
-
import
|
|
17864
|
+
import chalk152 from "chalk";
|
|
17839
17865
|
|
|
17840
17866
|
// src/commands/dotnet/findSolution.ts
|
|
17841
17867
|
import { readdirSync as readdirSync7 } from "fs";
|
|
17842
17868
|
import { dirname as dirname23, join as join42 } from "path";
|
|
17843
|
-
import
|
|
17869
|
+
import chalk151 from "chalk";
|
|
17844
17870
|
function findSlnInDir(dir) {
|
|
17845
17871
|
try {
|
|
17846
17872
|
return readdirSync7(dir).filter((f) => f.endsWith(".sln")).map((f) => join42(dir, f));
|
|
@@ -17856,17 +17882,17 @@ function findSolution() {
|
|
|
17856
17882
|
const slnFiles = findSlnInDir(current);
|
|
17857
17883
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
17858
17884
|
if (slnFiles.length > 1) {
|
|
17859
|
-
console.error(
|
|
17885
|
+
console.error(chalk151.red(`Multiple .sln files found in ${current}:`));
|
|
17860
17886
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
17861
17887
|
console.error(
|
|
17862
|
-
|
|
17888
|
+
chalk151.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
17863
17889
|
);
|
|
17864
17890
|
process.exit(1);
|
|
17865
17891
|
}
|
|
17866
17892
|
if (current === ceiling) break;
|
|
17867
17893
|
current = dirname23(current);
|
|
17868
17894
|
}
|
|
17869
|
-
console.error(
|
|
17895
|
+
console.error(chalk151.red("No .sln file found between cwd and repo root"));
|
|
17870
17896
|
process.exit(1);
|
|
17871
17897
|
}
|
|
17872
17898
|
|
|
@@ -17875,7 +17901,7 @@ function resolveSolution(sln) {
|
|
|
17875
17901
|
if (sln) {
|
|
17876
17902
|
const resolved = path34.resolve(sln);
|
|
17877
17903
|
if (!existsSync40(resolved)) {
|
|
17878
|
-
console.error(
|
|
17904
|
+
console.error(chalk152.red(`Solution file not found: ${resolved}`));
|
|
17879
17905
|
process.exit(1);
|
|
17880
17906
|
}
|
|
17881
17907
|
return resolved;
|
|
@@ -17917,14 +17943,14 @@ import { execSync as execSync40 } from "child_process";
|
|
|
17917
17943
|
import { existsSync as existsSync41, readFileSync as readFileSync36, unlinkSync as unlinkSync10 } from "fs";
|
|
17918
17944
|
import { tmpdir as tmpdir4 } from "os";
|
|
17919
17945
|
import path35 from "path";
|
|
17920
|
-
import
|
|
17946
|
+
import chalk153 from "chalk";
|
|
17921
17947
|
function assertJbInstalled() {
|
|
17922
17948
|
try {
|
|
17923
17949
|
execSync40("jb inspectcode --version", { stdio: "pipe" });
|
|
17924
17950
|
} catch {
|
|
17925
|
-
console.error(
|
|
17951
|
+
console.error(chalk153.red("jb is not installed. Install with:"));
|
|
17926
17952
|
console.error(
|
|
17927
|
-
|
|
17953
|
+
chalk153.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
17928
17954
|
);
|
|
17929
17955
|
process.exit(1);
|
|
17930
17956
|
}
|
|
@@ -17942,11 +17968,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
17942
17968
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
17943
17969
|
process.stderr.write(error.stderr);
|
|
17944
17970
|
}
|
|
17945
|
-
console.error(
|
|
17971
|
+
console.error(chalk153.red("jb inspectcode failed"));
|
|
17946
17972
|
process.exit(1);
|
|
17947
17973
|
}
|
|
17948
17974
|
if (!existsSync41(reportPath)) {
|
|
17949
|
-
console.error(
|
|
17975
|
+
console.error(chalk153.red("Report file not generated"));
|
|
17950
17976
|
process.exit(1);
|
|
17951
17977
|
}
|
|
17952
17978
|
const xml = readFileSync36(reportPath, "utf8");
|
|
@@ -17956,7 +17982,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
17956
17982
|
|
|
17957
17983
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
17958
17984
|
import { execSync as execSync41 } from "child_process";
|
|
17959
|
-
import
|
|
17985
|
+
import chalk154 from "chalk";
|
|
17960
17986
|
function resolveMsbuildPath() {
|
|
17961
17987
|
const { run: run4 } = loadConfig();
|
|
17962
17988
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -17968,9 +17994,9 @@ function assertMsbuildInstalled() {
|
|
|
17968
17994
|
try {
|
|
17969
17995
|
execSync41(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
17970
17996
|
} catch {
|
|
17971
|
-
console.error(
|
|
17997
|
+
console.error(chalk154.red(`msbuild not found at: ${msbuild}`));
|
|
17972
17998
|
console.error(
|
|
17973
|
-
|
|
17999
|
+
chalk154.yellow(
|
|
17974
18000
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
17975
18001
|
)
|
|
17976
18002
|
);
|
|
@@ -18017,17 +18043,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
18017
18043
|
// src/commands/dotnet/inspect.ts
|
|
18018
18044
|
function logScope(changedFiles2) {
|
|
18019
18045
|
if (changedFiles2 === null) {
|
|
18020
|
-
console.log(
|
|
18046
|
+
console.log(chalk155.dim("Inspecting full solution..."));
|
|
18021
18047
|
} else {
|
|
18022
18048
|
console.log(
|
|
18023
|
-
|
|
18049
|
+
chalk155.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
18024
18050
|
);
|
|
18025
18051
|
}
|
|
18026
18052
|
}
|
|
18027
18053
|
function reportResults(issues, elapsed) {
|
|
18028
18054
|
if (issues.length > 0) displayIssues(issues);
|
|
18029
|
-
else console.log(
|
|
18030
|
-
console.log(
|
|
18055
|
+
else console.log(chalk155.green("No issues found"));
|
|
18056
|
+
console.log(chalk155.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
18031
18057
|
if (issues.length > 0) process.exit(1);
|
|
18032
18058
|
}
|
|
18033
18059
|
async function inspect(sln, options2) {
|
|
@@ -18038,7 +18064,7 @@ async function inspect(sln, options2) {
|
|
|
18038
18064
|
const scope = parseScope(options2.scope);
|
|
18039
18065
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
18040
18066
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
18041
|
-
console.log(
|
|
18067
|
+
console.log(chalk155.green("No changed .cs files found"));
|
|
18042
18068
|
return;
|
|
18043
18069
|
}
|
|
18044
18070
|
logScope(changedFiles2);
|
|
@@ -18421,25 +18447,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
18421
18447
|
}
|
|
18422
18448
|
|
|
18423
18449
|
// src/commands/github/printCountTable.ts
|
|
18424
|
-
import
|
|
18450
|
+
import chalk156 from "chalk";
|
|
18425
18451
|
function printCountTable(labelHeader, rows) {
|
|
18426
18452
|
const labelWidth = Math.max(
|
|
18427
18453
|
labelHeader.length,
|
|
18428
18454
|
...rows.map((row) => row.label.length)
|
|
18429
18455
|
);
|
|
18430
18456
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
18431
|
-
console.log(
|
|
18432
|
-
console.log(
|
|
18457
|
+
console.log(chalk156.dim(header));
|
|
18458
|
+
console.log(chalk156.dim("-".repeat(header.length)));
|
|
18433
18459
|
for (const row of rows) {
|
|
18434
18460
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
18435
18461
|
}
|
|
18436
18462
|
}
|
|
18437
18463
|
|
|
18438
18464
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
18439
|
-
import
|
|
18465
|
+
import chalk157 from "chalk";
|
|
18440
18466
|
function printRepoAuthorBreakdown(repos2) {
|
|
18441
18467
|
for (const repo of repos2) {
|
|
18442
|
-
console.log(
|
|
18468
|
+
console.log(chalk157.bold(repo.name));
|
|
18443
18469
|
const authorWidth = Math.max(
|
|
18444
18470
|
0,
|
|
18445
18471
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -18757,7 +18783,7 @@ function registerHandover(program2) {
|
|
|
18757
18783
|
}
|
|
18758
18784
|
|
|
18759
18785
|
// src/commands/jira/acceptanceCriteria.ts
|
|
18760
|
-
import
|
|
18786
|
+
import chalk158 from "chalk";
|
|
18761
18787
|
|
|
18762
18788
|
// src/commands/jira/adfToText.ts
|
|
18763
18789
|
function renderInline(node) {
|
|
@@ -18824,7 +18850,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
18824
18850
|
const parsed = fetchIssue(issueKey, field);
|
|
18825
18851
|
const acValue = parsed?.fields?.[field];
|
|
18826
18852
|
if (!acValue) {
|
|
18827
|
-
console.log(
|
|
18853
|
+
console.log(chalk158.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
18828
18854
|
return;
|
|
18829
18855
|
}
|
|
18830
18856
|
if (typeof acValue === "string") {
|
|
@@ -18890,14 +18916,14 @@ async function jiraAuth() {
|
|
|
18890
18916
|
}
|
|
18891
18917
|
|
|
18892
18918
|
// src/commands/jira/viewIssue.ts
|
|
18893
|
-
import
|
|
18919
|
+
import chalk159 from "chalk";
|
|
18894
18920
|
function viewIssue(issueKey) {
|
|
18895
18921
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
18896
18922
|
const fields = parsed?.fields;
|
|
18897
18923
|
const summary = fields?.summary;
|
|
18898
18924
|
const description = fields?.description;
|
|
18899
18925
|
if (summary) {
|
|
18900
|
-
console.log(
|
|
18926
|
+
console.log(chalk159.bold(summary));
|
|
18901
18927
|
}
|
|
18902
18928
|
if (description) {
|
|
18903
18929
|
if (summary) console.log();
|
|
@@ -18911,7 +18937,7 @@ function viewIssue(issueKey) {
|
|
|
18911
18937
|
}
|
|
18912
18938
|
if (!summary && !description) {
|
|
18913
18939
|
console.log(
|
|
18914
|
-
|
|
18940
|
+
chalk159.yellow(`No summary or description found on ${issueKey}.`)
|
|
18915
18941
|
);
|
|
18916
18942
|
}
|
|
18917
18943
|
}
|
|
@@ -18969,7 +18995,7 @@ import { randomUUID as randomUUID6 } from "crypto";
|
|
|
18969
18995
|
|
|
18970
18996
|
// src/commands/review/checkoutPr.ts
|
|
18971
18997
|
import { execFileSync as execFileSync7 } from "child_process";
|
|
18972
|
-
import
|
|
18998
|
+
import chalk160 from "chalk";
|
|
18973
18999
|
|
|
18974
19000
|
// src/commands/sessions/daemon/daemonLog.ts
|
|
18975
19001
|
var RING_CAPACITY = 1e3;
|
|
@@ -19524,7 +19550,7 @@ async function checkoutPr(number) {
|
|
|
19524
19550
|
try {
|
|
19525
19551
|
execFileSync7("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
19526
19552
|
} catch {
|
|
19527
|
-
console.error(
|
|
19553
|
+
console.error(chalk160.red(`gh pr checkout ${number} failed; aborting.`));
|
|
19528
19554
|
process.exit(1);
|
|
19529
19555
|
}
|
|
19530
19556
|
}
|
|
@@ -19601,15 +19627,15 @@ function registerList(program2) {
|
|
|
19601
19627
|
// src/commands/mermaid/index.ts
|
|
19602
19628
|
import { mkdirSync as mkdirSync17, readdirSync as readdirSync9 } from "fs";
|
|
19603
19629
|
import { resolve as resolve14 } from "path";
|
|
19604
|
-
import
|
|
19630
|
+
import chalk163 from "chalk";
|
|
19605
19631
|
|
|
19606
19632
|
// src/commands/mermaid/exportFile.ts
|
|
19607
19633
|
import { readFileSync as readFileSync38, writeFileSync as writeFileSync31 } from "fs";
|
|
19608
19634
|
import { basename as basename15, extname as extname2, resolve as resolve13 } from "path";
|
|
19609
|
-
import
|
|
19635
|
+
import chalk162 from "chalk";
|
|
19610
19636
|
|
|
19611
19637
|
// src/commands/mermaid/renderBlock.ts
|
|
19612
|
-
import
|
|
19638
|
+
import chalk161 from "chalk";
|
|
19613
19639
|
async function renderBlock(krokiUrl, source) {
|
|
19614
19640
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
19615
19641
|
method: "POST",
|
|
@@ -19618,7 +19644,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
19618
19644
|
});
|
|
19619
19645
|
if (!response.ok) {
|
|
19620
19646
|
console.error(
|
|
19621
|
-
|
|
19647
|
+
chalk161.red(
|
|
19622
19648
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
19623
19649
|
)
|
|
19624
19650
|
);
|
|
@@ -19636,19 +19662,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
19636
19662
|
if (onlyIndex !== void 0) {
|
|
19637
19663
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
19638
19664
|
console.error(
|
|
19639
|
-
|
|
19665
|
+
chalk162.red(
|
|
19640
19666
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
19641
19667
|
)
|
|
19642
19668
|
);
|
|
19643
19669
|
process.exit(1);
|
|
19644
19670
|
}
|
|
19645
19671
|
console.log(
|
|
19646
|
-
|
|
19672
|
+
chalk162.gray(
|
|
19647
19673
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
19648
19674
|
)
|
|
19649
19675
|
);
|
|
19650
19676
|
} else {
|
|
19651
|
-
console.log(
|
|
19677
|
+
console.log(chalk162.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
19652
19678
|
}
|
|
19653
19679
|
for (const [i, source] of blocks.entries()) {
|
|
19654
19680
|
const idx = i + 1;
|
|
@@ -19656,7 +19682,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
19656
19682
|
const outPath = resolve13(outDir, `${stem}-${idx}.svg`);
|
|
19657
19683
|
const svg = await renderBlock(krokiUrl, source);
|
|
19658
19684
|
writeFileSync31(outPath, svg, "utf8");
|
|
19659
|
-
console.log(
|
|
19685
|
+
console.log(chalk162.green(` \u2192 ${outPath}`));
|
|
19660
19686
|
}
|
|
19661
19687
|
}
|
|
19662
19688
|
function extractMermaidBlocks(markdown) {
|
|
@@ -19672,18 +19698,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
19672
19698
|
if (options2.index !== void 0) {
|
|
19673
19699
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
19674
19700
|
console.error(
|
|
19675
|
-
|
|
19701
|
+
chalk163.red(`--index must be a positive integer (got ${options2.index})`)
|
|
19676
19702
|
);
|
|
19677
19703
|
process.exit(1);
|
|
19678
19704
|
}
|
|
19679
19705
|
if (!file) {
|
|
19680
|
-
console.error(
|
|
19706
|
+
console.error(chalk163.red("--index requires a file argument"));
|
|
19681
19707
|
process.exit(1);
|
|
19682
19708
|
}
|
|
19683
19709
|
}
|
|
19684
19710
|
const files = file ? [file] : readdirSync9(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
19685
19711
|
if (files.length === 0) {
|
|
19686
|
-
console.log(
|
|
19712
|
+
console.log(chalk163.gray("No markdown files found in current directory."));
|
|
19687
19713
|
return;
|
|
19688
19714
|
}
|
|
19689
19715
|
for (const f of files) {
|
|
@@ -19716,7 +19742,7 @@ function registerMermaid(program2) {
|
|
|
19716
19742
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
19717
19743
|
import { createServer as createServer2 } from "http";
|
|
19718
19744
|
import { dirname as dirname27 } from "path";
|
|
19719
|
-
import
|
|
19745
|
+
import chalk165 from "chalk";
|
|
19720
19746
|
|
|
19721
19747
|
// src/commands/netcap/corsHeaders.ts
|
|
19722
19748
|
var corsHeaders = {
|
|
@@ -19795,7 +19821,7 @@ function createNetcapHandler(options2) {
|
|
|
19795
19821
|
import { cp, readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
|
|
19796
19822
|
import { networkInterfaces } from "os";
|
|
19797
19823
|
import { join as join51 } from "path";
|
|
19798
|
-
import
|
|
19824
|
+
import chalk164 from "chalk";
|
|
19799
19825
|
|
|
19800
19826
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
19801
19827
|
import { dirname as dirname26, join as join50 } from "path";
|
|
@@ -19839,7 +19865,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
19839
19865
|
const host = lanIPv4();
|
|
19840
19866
|
if (!host) {
|
|
19841
19867
|
console.log(
|
|
19842
|
-
|
|
19868
|
+
chalk164.yellow("could not determine the WSL IP for the extension")
|
|
19843
19869
|
);
|
|
19844
19870
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
19845
19871
|
return source;
|
|
@@ -19850,7 +19876,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
19850
19876
|
return WSL_WINDOWS_PATH;
|
|
19851
19877
|
} catch {
|
|
19852
19878
|
console.log(
|
|
19853
|
-
|
|
19879
|
+
chalk164.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
19854
19880
|
);
|
|
19855
19881
|
return source;
|
|
19856
19882
|
}
|
|
@@ -19883,30 +19909,30 @@ async function netcap(options2) {
|
|
|
19883
19909
|
let count8 = 0;
|
|
19884
19910
|
const handler = createNetcapHandler({
|
|
19885
19911
|
outPath,
|
|
19886
|
-
onPing: () => console.log(
|
|
19912
|
+
onPing: () => console.log(chalk165.dim("ping from extension")),
|
|
19887
19913
|
onCapture: (entry) => {
|
|
19888
19914
|
count8 += 1;
|
|
19889
19915
|
console.log(
|
|
19890
|
-
|
|
19891
|
-
|
|
19916
|
+
chalk165.green(`captured #${count8}`),
|
|
19917
|
+
chalk165.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
19892
19918
|
);
|
|
19893
19919
|
}
|
|
19894
19920
|
});
|
|
19895
19921
|
const server = createServer2(handler);
|
|
19896
19922
|
server.listen(port, () => {
|
|
19897
19923
|
console.log(
|
|
19898
|
-
|
|
19924
|
+
chalk165.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
19899
19925
|
);
|
|
19900
|
-
console.log(
|
|
19926
|
+
console.log(chalk165.dim(`appending captures to ${outPath}`));
|
|
19901
19927
|
if (filter)
|
|
19902
|
-
console.log(
|
|
19903
|
-
console.log(
|
|
19904
|
-
console.log(
|
|
19928
|
+
console.log(chalk165.dim(`forwarding only URLs matching "${filter}"`));
|
|
19929
|
+
console.log(chalk165.dim(`load the unpacked extension from ${extensionPath}`));
|
|
19930
|
+
console.log(chalk165.dim("press Ctrl-C to stop"));
|
|
19905
19931
|
});
|
|
19906
19932
|
process.on("SIGINT", () => {
|
|
19907
19933
|
server.close();
|
|
19908
19934
|
console.log(
|
|
19909
|
-
|
|
19935
|
+
chalk165.bold(
|
|
19910
19936
|
`
|
|
19911
19937
|
netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
19912
19938
|
)
|
|
@@ -19918,7 +19944,7 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
19918
19944
|
// src/commands/netcap/netcapExtract.ts
|
|
19919
19945
|
import { writeFileSync as writeFileSync32 } from "fs";
|
|
19920
19946
|
import { join as join54 } from "path";
|
|
19921
|
-
import
|
|
19947
|
+
import chalk166 from "chalk";
|
|
19922
19948
|
|
|
19923
19949
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
19924
19950
|
import { readFileSync as readFileSync39 } from "fs";
|
|
@@ -20366,8 +20392,8 @@ function netcapExtract(file) {
|
|
|
20366
20392
|
writeFileSync32(outFile, `${JSON.stringify(posts, null, 2)}
|
|
20367
20393
|
`);
|
|
20368
20394
|
console.log(
|
|
20369
|
-
|
|
20370
|
-
|
|
20395
|
+
chalk166.green(`extracted ${posts.length} posts`),
|
|
20396
|
+
chalk166.dim(`-> ${outFile}`)
|
|
20371
20397
|
);
|
|
20372
20398
|
}
|
|
20373
20399
|
|
|
@@ -20388,7 +20414,7 @@ function registerNetcap(program2) {
|
|
|
20388
20414
|
}
|
|
20389
20415
|
|
|
20390
20416
|
// src/commands/news/add/index.ts
|
|
20391
|
-
import
|
|
20417
|
+
import chalk167 from "chalk";
|
|
20392
20418
|
import enquirer8 from "enquirer";
|
|
20393
20419
|
async function add2(url) {
|
|
20394
20420
|
if (!url) {
|
|
@@ -20410,10 +20436,10 @@ async function add2(url) {
|
|
|
20410
20436
|
const { orm } = await getReady();
|
|
20411
20437
|
const added = await addFeed(orm, url);
|
|
20412
20438
|
if (!added) {
|
|
20413
|
-
console.log(
|
|
20439
|
+
console.log(chalk167.yellow("Feed already exists"));
|
|
20414
20440
|
return;
|
|
20415
20441
|
}
|
|
20416
|
-
console.log(
|
|
20442
|
+
console.log(chalk167.green(`Added feed: ${url}`));
|
|
20417
20443
|
}
|
|
20418
20444
|
|
|
20419
20445
|
// src/commands/registerNews.ts
|
|
@@ -20460,7 +20486,7 @@ function registerPiHook(program2) {
|
|
|
20460
20486
|
}
|
|
20461
20487
|
|
|
20462
20488
|
// src/commands/prompts/printPromptsTable.ts
|
|
20463
|
-
import
|
|
20489
|
+
import chalk168 from "chalk";
|
|
20464
20490
|
function truncate(str, max) {
|
|
20465
20491
|
if (str.length <= max) return str;
|
|
20466
20492
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -20478,14 +20504,14 @@ function printPromptsTable(rows) {
|
|
|
20478
20504
|
"Command".padEnd(commandWidth),
|
|
20479
20505
|
"Repos"
|
|
20480
20506
|
].join(" ");
|
|
20481
|
-
console.log(
|
|
20482
|
-
console.log(
|
|
20507
|
+
console.log(chalk168.dim(header));
|
|
20508
|
+
console.log(chalk168.dim("-".repeat(header.length)));
|
|
20483
20509
|
for (const row of rows) {
|
|
20484
20510
|
const count8 = String(row.count).padStart(countWidth);
|
|
20485
20511
|
const tool = row.tool.padEnd(toolWidth);
|
|
20486
20512
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
20487
20513
|
console.log(
|
|
20488
|
-
`${
|
|
20514
|
+
`${chalk168.yellow(count8)} ${tool} ${command} ${chalk168.dim(row.repos)}`
|
|
20489
20515
|
);
|
|
20490
20516
|
}
|
|
20491
20517
|
}
|
|
@@ -21101,20 +21127,20 @@ function updateCommentsCache(org, repo, prNumber, comments3) {
|
|
|
21101
21127
|
}
|
|
21102
21128
|
|
|
21103
21129
|
// src/commands/prs/listComments/printComments.ts
|
|
21104
|
-
import
|
|
21130
|
+
import chalk169 from "chalk";
|
|
21105
21131
|
function formatForHuman(comment3) {
|
|
21106
21132
|
if (comment3.type === "review") {
|
|
21107
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
21133
|
+
const stateColor = comment3.state === "APPROVED" ? chalk169.green : comment3.state === "CHANGES_REQUESTED" ? chalk169.red : chalk169.yellow;
|
|
21108
21134
|
return [
|
|
21109
|
-
`${
|
|
21135
|
+
`${chalk169.cyan("Review")} by ${chalk169.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
21110
21136
|
comment3.body,
|
|
21111
21137
|
""
|
|
21112
21138
|
].join("\n");
|
|
21113
21139
|
}
|
|
21114
21140
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
21115
21141
|
return [
|
|
21116
|
-
`${
|
|
21117
|
-
|
|
21142
|
+
`${chalk169.cyan("Line comment")} by ${chalk169.bold(comment3.user)} on ${chalk169.dim(`${comment3.path}${location}`)}`,
|
|
21143
|
+
chalk169.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
21118
21144
|
comment3.body,
|
|
21119
21145
|
""
|
|
21120
21146
|
].join("\n");
|
|
@@ -21184,13 +21210,13 @@ import { execSync as execSync49 } from "child_process";
|
|
|
21184
21210
|
import enquirer9 from "enquirer";
|
|
21185
21211
|
|
|
21186
21212
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
21187
|
-
import
|
|
21213
|
+
import chalk170 from "chalk";
|
|
21188
21214
|
var STATUS_MAP = {
|
|
21189
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
21190
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
21215
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk170.magenta("merged"), date: pr.mergedAt } : null,
|
|
21216
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk170.red("closed"), date: pr.closedAt } : null
|
|
21191
21217
|
};
|
|
21192
21218
|
function defaultStatus(pr) {
|
|
21193
|
-
return { label:
|
|
21219
|
+
return { label: chalk170.green("opened"), date: pr.createdAt };
|
|
21194
21220
|
}
|
|
21195
21221
|
function getStatus2(pr) {
|
|
21196
21222
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -21199,11 +21225,11 @@ function formatDate(dateStr) {
|
|
|
21199
21225
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
21200
21226
|
}
|
|
21201
21227
|
function formatPrHeader(pr, status3) {
|
|
21202
|
-
return `${
|
|
21228
|
+
return `${chalk170.cyan(`#${pr.number}`)} ${pr.title} ${chalk170.dim(`(${pr.author.login},`)} ${status3.label} ${chalk170.dim(`${formatDate(status3.date)})`)}`;
|
|
21203
21229
|
}
|
|
21204
21230
|
function logPrDetails(pr) {
|
|
21205
21231
|
console.log(
|
|
21206
|
-
|
|
21232
|
+
chalk170.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
21207
21233
|
);
|
|
21208
21234
|
console.log();
|
|
21209
21235
|
}
|
|
@@ -21718,10 +21744,10 @@ function registerPrs(program2) {
|
|
|
21718
21744
|
}
|
|
21719
21745
|
|
|
21720
21746
|
// src/commands/ravendb/ravendbAuth.ts
|
|
21721
|
-
import
|
|
21747
|
+
import chalk176 from "chalk";
|
|
21722
21748
|
|
|
21723
21749
|
// src/shared/createConnectionAuth.ts
|
|
21724
|
-
import
|
|
21750
|
+
import chalk171 from "chalk";
|
|
21725
21751
|
function listConnections(connections, format) {
|
|
21726
21752
|
if (connections.length === 0) {
|
|
21727
21753
|
console.log("No connections configured.");
|
|
@@ -21734,7 +21760,7 @@ function listConnections(connections, format) {
|
|
|
21734
21760
|
function removeConnection(connections, name, save) {
|
|
21735
21761
|
const filtered = connections.filter((c) => c.name !== name);
|
|
21736
21762
|
if (filtered.length === connections.length) {
|
|
21737
|
-
console.error(
|
|
21763
|
+
console.error(chalk171.red(`Connection "${name}" not found.`));
|
|
21738
21764
|
process.exit(1);
|
|
21739
21765
|
}
|
|
21740
21766
|
save(filtered);
|
|
@@ -21780,15 +21806,15 @@ function saveConnections(connections) {
|
|
|
21780
21806
|
}
|
|
21781
21807
|
|
|
21782
21808
|
// src/commands/ravendb/promptConnection.ts
|
|
21783
|
-
import
|
|
21809
|
+
import chalk174 from "chalk";
|
|
21784
21810
|
|
|
21785
21811
|
// src/commands/ravendb/selectOpSecret.ts
|
|
21786
|
-
import
|
|
21812
|
+
import chalk173 from "chalk";
|
|
21787
21813
|
import Enquirer2 from "enquirer";
|
|
21788
21814
|
|
|
21789
21815
|
// src/commands/ravendb/searchItems.ts
|
|
21790
21816
|
import { execSync as execSync52 } from "child_process";
|
|
21791
|
-
import
|
|
21817
|
+
import chalk172 from "chalk";
|
|
21792
21818
|
function opExec(args) {
|
|
21793
21819
|
return execSync52(`op ${args}`, {
|
|
21794
21820
|
encoding: "utf8",
|
|
@@ -21801,7 +21827,7 @@ function searchItems(search2) {
|
|
|
21801
21827
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
21802
21828
|
} catch {
|
|
21803
21829
|
console.error(
|
|
21804
|
-
|
|
21830
|
+
chalk172.red(
|
|
21805
21831
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
21806
21832
|
)
|
|
21807
21833
|
);
|
|
@@ -21815,7 +21841,7 @@ function getItemFields(itemId2) {
|
|
|
21815
21841
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
21816
21842
|
return item.fields.filter((f) => f.reference && f.label);
|
|
21817
21843
|
} catch {
|
|
21818
|
-
console.error(
|
|
21844
|
+
console.error(chalk172.red("Failed to get item details from 1Password."));
|
|
21819
21845
|
process.exit(1);
|
|
21820
21846
|
}
|
|
21821
21847
|
}
|
|
@@ -21834,7 +21860,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
21834
21860
|
}).run();
|
|
21835
21861
|
const items2 = searchItems(search2);
|
|
21836
21862
|
if (items2.length === 0) {
|
|
21837
|
-
console.error(
|
|
21863
|
+
console.error(chalk173.red(`No items found matching "${search2}".`));
|
|
21838
21864
|
process.exit(1);
|
|
21839
21865
|
}
|
|
21840
21866
|
const itemId2 = await selectOne(
|
|
@@ -21843,7 +21869,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
21843
21869
|
);
|
|
21844
21870
|
const fields = getItemFields(itemId2);
|
|
21845
21871
|
if (fields.length === 0) {
|
|
21846
|
-
console.error(
|
|
21872
|
+
console.error(chalk173.red("No fields with references found on this item."));
|
|
21847
21873
|
process.exit(1);
|
|
21848
21874
|
}
|
|
21849
21875
|
const ref = await selectOne(
|
|
@@ -21857,7 +21883,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
21857
21883
|
async function promptConnection(existingNames) {
|
|
21858
21884
|
const name = await promptInput("name", "Connection name:");
|
|
21859
21885
|
if (existingNames.includes(name)) {
|
|
21860
|
-
console.error(
|
|
21886
|
+
console.error(chalk174.red(`Connection "${name}" already exists.`));
|
|
21861
21887
|
process.exit(1);
|
|
21862
21888
|
}
|
|
21863
21889
|
const url = await promptInput(
|
|
@@ -21866,22 +21892,22 @@ async function promptConnection(existingNames) {
|
|
|
21866
21892
|
);
|
|
21867
21893
|
const database = await promptInput("database", "Database name:");
|
|
21868
21894
|
if (!name || !url || !database) {
|
|
21869
|
-
console.error(
|
|
21895
|
+
console.error(chalk174.red("All fields are required."));
|
|
21870
21896
|
process.exit(1);
|
|
21871
21897
|
}
|
|
21872
21898
|
const apiKeyRef = await selectOpSecret();
|
|
21873
|
-
console.log(
|
|
21899
|
+
console.log(chalk174.dim(`Using: ${apiKeyRef}`));
|
|
21874
21900
|
return { name, url, database, apiKeyRef };
|
|
21875
21901
|
}
|
|
21876
21902
|
|
|
21877
21903
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
21878
|
-
import
|
|
21904
|
+
import chalk175 from "chalk";
|
|
21879
21905
|
function ravendbSetConnection(name) {
|
|
21880
21906
|
const raw = loadGlobalConfigRaw();
|
|
21881
21907
|
const ravendb = raw.ravendb ?? {};
|
|
21882
21908
|
const connections = ravendb.connections ?? [];
|
|
21883
21909
|
if (!connections.some((c) => c.name === name)) {
|
|
21884
|
-
console.error(
|
|
21910
|
+
console.error(chalk175.red(`Connection "${name}" not found.`));
|
|
21885
21911
|
console.error(
|
|
21886
21912
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
21887
21913
|
);
|
|
@@ -21897,16 +21923,16 @@ function ravendbSetConnection(name) {
|
|
|
21897
21923
|
var ravendbAuth = createConnectionAuth({
|
|
21898
21924
|
load: loadConnections,
|
|
21899
21925
|
save: saveConnections,
|
|
21900
|
-
format: (c) => `${
|
|
21926
|
+
format: (c) => `${chalk176.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
21901
21927
|
promptNew: promptConnection,
|
|
21902
21928
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
21903
21929
|
});
|
|
21904
21930
|
|
|
21905
21931
|
// src/commands/ravendb/ravendbCollections.ts
|
|
21906
|
-
import
|
|
21932
|
+
import chalk180 from "chalk";
|
|
21907
21933
|
|
|
21908
21934
|
// src/commands/ravendb/ravenFetch.ts
|
|
21909
|
-
import
|
|
21935
|
+
import chalk178 from "chalk";
|
|
21910
21936
|
|
|
21911
21937
|
// src/commands/ravendb/getAccessToken.ts
|
|
21912
21938
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -21943,10 +21969,10 @@ ${errorText}`
|
|
|
21943
21969
|
|
|
21944
21970
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
21945
21971
|
import { execSync as execSync53 } from "child_process";
|
|
21946
|
-
import
|
|
21972
|
+
import chalk177 from "chalk";
|
|
21947
21973
|
function resolveOpSecret(reference) {
|
|
21948
21974
|
if (!reference.startsWith("op://")) {
|
|
21949
|
-
console.error(
|
|
21975
|
+
console.error(chalk177.red(`Invalid secret reference: must start with op://`));
|
|
21950
21976
|
process.exit(1);
|
|
21951
21977
|
}
|
|
21952
21978
|
try {
|
|
@@ -21956,7 +21982,7 @@ function resolveOpSecret(reference) {
|
|
|
21956
21982
|
}).trim();
|
|
21957
21983
|
} catch {
|
|
21958
21984
|
console.error(
|
|
21959
|
-
|
|
21985
|
+
chalk177.red(
|
|
21960
21986
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
21961
21987
|
)
|
|
21962
21988
|
);
|
|
@@ -21983,7 +22009,7 @@ async function ravenFetch(connection, path71) {
|
|
|
21983
22009
|
if (!response.ok) {
|
|
21984
22010
|
const body = await response.text();
|
|
21985
22011
|
console.error(
|
|
21986
|
-
|
|
22012
|
+
chalk178.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
21987
22013
|
);
|
|
21988
22014
|
console.error(body.substring(0, 500));
|
|
21989
22015
|
process.exit(1);
|
|
@@ -21992,7 +22018,7 @@ async function ravenFetch(connection, path71) {
|
|
|
21992
22018
|
}
|
|
21993
22019
|
|
|
21994
22020
|
// src/commands/ravendb/resolveConnection.ts
|
|
21995
|
-
import
|
|
22021
|
+
import chalk179 from "chalk";
|
|
21996
22022
|
function loadRavendb() {
|
|
21997
22023
|
const raw = loadGlobalConfigRaw();
|
|
21998
22024
|
const ravendb = raw.ravendb;
|
|
@@ -22006,7 +22032,7 @@ function resolveConnection(name) {
|
|
|
22006
22032
|
const connectionName = name ?? defaultConnection;
|
|
22007
22033
|
if (!connectionName) {
|
|
22008
22034
|
console.error(
|
|
22009
|
-
|
|
22035
|
+
chalk179.red(
|
|
22010
22036
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
22011
22037
|
)
|
|
22012
22038
|
);
|
|
@@ -22014,7 +22040,7 @@ function resolveConnection(name) {
|
|
|
22014
22040
|
}
|
|
22015
22041
|
const connection = connections.find((c) => c.name === connectionName);
|
|
22016
22042
|
if (!connection) {
|
|
22017
|
-
console.error(
|
|
22043
|
+
console.error(chalk179.red(`Connection "${connectionName}" not found.`));
|
|
22018
22044
|
console.error(
|
|
22019
22045
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
22020
22046
|
);
|
|
@@ -22045,7 +22071,7 @@ async function ravendbCollections(connectionName) {
|
|
|
22045
22071
|
return;
|
|
22046
22072
|
}
|
|
22047
22073
|
for (const c of collections) {
|
|
22048
|
-
console.log(`${
|
|
22074
|
+
console.log(`${chalk180.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
22049
22075
|
}
|
|
22050
22076
|
}
|
|
22051
22077
|
|
|
@@ -22064,10 +22090,10 @@ var ravendbConfigHelp = [
|
|
|
22064
22090
|
];
|
|
22065
22091
|
|
|
22066
22092
|
// src/commands/ravendb/ravendbQuery.ts
|
|
22067
|
-
import
|
|
22093
|
+
import chalk182 from "chalk";
|
|
22068
22094
|
|
|
22069
22095
|
// src/commands/ravendb/fetchAllPages.ts
|
|
22070
|
-
import
|
|
22096
|
+
import chalk181 from "chalk";
|
|
22071
22097
|
|
|
22072
22098
|
// src/commands/ravendb/buildQueryPath.ts
|
|
22073
22099
|
function buildQueryPath(opts) {
|
|
@@ -22105,7 +22131,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
22105
22131
|
allResults.push(...results);
|
|
22106
22132
|
start3 += results.length;
|
|
22107
22133
|
process.stderr.write(
|
|
22108
|
-
`\r${
|
|
22134
|
+
`\r${chalk181.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
22109
22135
|
);
|
|
22110
22136
|
if (start3 >= totalResults) break;
|
|
22111
22137
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -22120,7 +22146,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
22120
22146
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
22121
22147
|
const resolved = resolveArgs(connectionName, collection);
|
|
22122
22148
|
if (!resolved.collection && !options2.query) {
|
|
22123
|
-
console.error(
|
|
22149
|
+
console.error(chalk182.red("Provide a collection name or --query filter."));
|
|
22124
22150
|
process.exit(1);
|
|
22125
22151
|
}
|
|
22126
22152
|
const { collection: col } = resolved;
|
|
@@ -22159,7 +22185,7 @@ import { spawn as spawn6 } from "child_process";
|
|
|
22159
22185
|
import * as path36 from "path";
|
|
22160
22186
|
|
|
22161
22187
|
// src/commands/refactor/logViolations.ts
|
|
22162
|
-
import
|
|
22188
|
+
import chalk183 from "chalk";
|
|
22163
22189
|
var DEFAULT_MAX_LINES = 100;
|
|
22164
22190
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
22165
22191
|
if (violations.length === 0) {
|
|
@@ -22168,43 +22194,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
22168
22194
|
}
|
|
22169
22195
|
return;
|
|
22170
22196
|
}
|
|
22171
|
-
console.error(
|
|
22197
|
+
console.error(chalk183.red(`
|
|
22172
22198
|
Refactor check failed:
|
|
22173
22199
|
`));
|
|
22174
|
-
console.error(
|
|
22200
|
+
console.error(chalk183.red(` The following files exceed ${maxLines} lines:
|
|
22175
22201
|
`));
|
|
22176
22202
|
for (const violation of violations) {
|
|
22177
|
-
console.error(
|
|
22203
|
+
console.error(chalk183.red(` ${violation.file} (${violation.lines} lines)`));
|
|
22178
22204
|
}
|
|
22179
22205
|
console.error(
|
|
22180
|
-
|
|
22206
|
+
chalk183.yellow(
|
|
22181
22207
|
`
|
|
22182
22208
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
22183
22209
|
way to refactor it, ignore it with:
|
|
22184
22210
|
`
|
|
22185
22211
|
)
|
|
22186
22212
|
);
|
|
22187
|
-
console.error(
|
|
22213
|
+
console.error(chalk183.gray(` assist refactor ignore <file>
|
|
22188
22214
|
`));
|
|
22189
22215
|
if (process.env.CLAUDECODE) {
|
|
22190
|
-
console.error(
|
|
22216
|
+
console.error(chalk183.cyan(`
|
|
22191
22217
|
## Extracting Code to New Files
|
|
22192
22218
|
`));
|
|
22193
22219
|
console.error(
|
|
22194
|
-
|
|
22220
|
+
chalk183.cyan(
|
|
22195
22221
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
22196
22222
|
`
|
|
22197
22223
|
)
|
|
22198
22224
|
);
|
|
22199
22225
|
console.error(
|
|
22200
|
-
|
|
22226
|
+
chalk183.cyan(
|
|
22201
22227
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
22202
22228
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
22203
22229
|
`
|
|
22204
22230
|
)
|
|
22205
22231
|
);
|
|
22206
22232
|
console.error(
|
|
22207
|
-
|
|
22233
|
+
chalk183.cyan(
|
|
22208
22234
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
22209
22235
|
domains, move it to a common/shared folder.
|
|
22210
22236
|
`
|
|
@@ -22360,7 +22386,7 @@ async function check(pattern2, options2) {
|
|
|
22360
22386
|
|
|
22361
22387
|
// src/commands/refactor/extract/index.ts
|
|
22362
22388
|
import path44 from "path";
|
|
22363
|
-
import
|
|
22389
|
+
import chalk186 from "chalk";
|
|
22364
22390
|
|
|
22365
22391
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
22366
22392
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -22959,23 +22985,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
22959
22985
|
|
|
22960
22986
|
// src/commands/refactor/extract/displayPlan.ts
|
|
22961
22987
|
import path40 from "path";
|
|
22962
|
-
import
|
|
22988
|
+
import chalk184 from "chalk";
|
|
22963
22989
|
function section2(title) {
|
|
22964
22990
|
return `
|
|
22965
|
-
${
|
|
22991
|
+
${chalk184.cyan(title)}`;
|
|
22966
22992
|
}
|
|
22967
22993
|
function displayImporters(plan2, cwd) {
|
|
22968
22994
|
if (plan2.importersToUpdate.length === 0) return;
|
|
22969
22995
|
console.log(section2("Update importers:"));
|
|
22970
22996
|
for (const imp of plan2.importersToUpdate) {
|
|
22971
22997
|
const rel = path40.relative(cwd, imp.file.getFilePath());
|
|
22972
|
-
console.log(` ${
|
|
22998
|
+
console.log(` ${chalk184.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
22973
22999
|
}
|
|
22974
23000
|
}
|
|
22975
23001
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
22976
|
-
console.log(
|
|
23002
|
+
console.log(chalk184.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
22977
23003
|
`));
|
|
22978
|
-
console.log(` ${
|
|
23004
|
+
console.log(` ${chalk184.cyan("Functions to move:")}`);
|
|
22979
23005
|
for (const name of plan2.extractedNames) {
|
|
22980
23006
|
console.log(` ${name}`);
|
|
22981
23007
|
}
|
|
@@ -23009,7 +23035,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
23009
23035
|
|
|
23010
23036
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
23011
23037
|
import path43 from "path";
|
|
23012
|
-
import
|
|
23038
|
+
import chalk185 from "chalk";
|
|
23013
23039
|
import { Project as Project4 } from "ts-morph";
|
|
23014
23040
|
|
|
23015
23041
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -23101,7 +23127,7 @@ function loadProjectFile(file) {
|
|
|
23101
23127
|
});
|
|
23102
23128
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
23103
23129
|
if (!sourceFile) {
|
|
23104
|
-
console.log(
|
|
23130
|
+
console.log(chalk185.red(`File not found in project: ${file}`));
|
|
23105
23131
|
process.exit(1);
|
|
23106
23132
|
}
|
|
23107
23133
|
return { project, sourceFile };
|
|
@@ -23124,19 +23150,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
23124
23150
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
23125
23151
|
if (options2.apply) {
|
|
23126
23152
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
23127
|
-
console.log(
|
|
23153
|
+
console.log(chalk186.green("\nExtraction complete"));
|
|
23128
23154
|
} else {
|
|
23129
|
-
console.log(
|
|
23155
|
+
console.log(chalk186.dim("\nDry run. Use --apply to execute."));
|
|
23130
23156
|
}
|
|
23131
23157
|
}
|
|
23132
23158
|
|
|
23133
23159
|
// src/commands/refactor/ignore.ts
|
|
23134
23160
|
import fs28 from "fs";
|
|
23135
|
-
import
|
|
23161
|
+
import chalk187 from "chalk";
|
|
23136
23162
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
23137
23163
|
function ignore2(file) {
|
|
23138
23164
|
if (!fs28.existsSync(file)) {
|
|
23139
|
-
console.error(
|
|
23165
|
+
console.error(chalk187.red(`Error: File does not exist: ${file}`));
|
|
23140
23166
|
process.exit(1);
|
|
23141
23167
|
}
|
|
23142
23168
|
const content = fs28.readFileSync(file, "utf8");
|
|
@@ -23152,7 +23178,7 @@ function ignore2(file) {
|
|
|
23152
23178
|
fs28.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
23153
23179
|
}
|
|
23154
23180
|
console.log(
|
|
23155
|
-
|
|
23181
|
+
chalk187.green(
|
|
23156
23182
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
23157
23183
|
)
|
|
23158
23184
|
);
|
|
@@ -23161,12 +23187,12 @@ function ignore2(file) {
|
|
|
23161
23187
|
// src/commands/refactor/rename/index.ts
|
|
23162
23188
|
import fs31 from "fs";
|
|
23163
23189
|
import path49 from "path";
|
|
23164
|
-
import
|
|
23190
|
+
import chalk190 from "chalk";
|
|
23165
23191
|
|
|
23166
23192
|
// src/commands/refactor/rename/applyRename.ts
|
|
23167
23193
|
import fs30 from "fs";
|
|
23168
23194
|
import path46 from "path";
|
|
23169
|
-
import
|
|
23195
|
+
import chalk188 from "chalk";
|
|
23170
23196
|
|
|
23171
23197
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
23172
23198
|
import path45 from "path";
|
|
@@ -23271,13 +23297,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
23271
23297
|
const updatedContents = applyRewrites(rewrites);
|
|
23272
23298
|
for (const [file, content] of updatedContents) {
|
|
23273
23299
|
fs30.writeFileSync(file, content, "utf8");
|
|
23274
|
-
console.log(
|
|
23300
|
+
console.log(chalk188.cyan(` Updated imports in ${path46.relative(cwd, file)}`));
|
|
23275
23301
|
}
|
|
23276
23302
|
const destDir = path46.dirname(destPath);
|
|
23277
23303
|
if (!fs30.existsSync(destDir)) fs30.mkdirSync(destDir, { recursive: true });
|
|
23278
23304
|
fs30.renameSync(sourcePath, destPath);
|
|
23279
23305
|
console.log(
|
|
23280
|
-
|
|
23306
|
+
chalk188.white(
|
|
23281
23307
|
` Moved ${path46.relative(cwd, sourcePath)} \u2192 ${path46.relative(cwd, destPath)}`
|
|
23282
23308
|
)
|
|
23283
23309
|
);
|
|
@@ -23364,16 +23390,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
23364
23390
|
|
|
23365
23391
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
23366
23392
|
import path48 from "path";
|
|
23367
|
-
import
|
|
23393
|
+
import chalk189 from "chalk";
|
|
23368
23394
|
function printRenamePreview(rewrites, cwd) {
|
|
23369
23395
|
for (const rewrite of rewrites) {
|
|
23370
23396
|
console.log(
|
|
23371
|
-
|
|
23397
|
+
chalk189.dim(
|
|
23372
23398
|
` ${path48.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
23373
23399
|
)
|
|
23374
23400
|
);
|
|
23375
23401
|
}
|
|
23376
|
-
console.log(
|
|
23402
|
+
console.log(chalk189.dim("Dry run. Use --apply to execute."));
|
|
23377
23403
|
}
|
|
23378
23404
|
|
|
23379
23405
|
// src/commands/refactor/rename/index.ts
|
|
@@ -23384,20 +23410,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
23384
23410
|
const relSource = path49.relative(cwd, sourcePath);
|
|
23385
23411
|
const relDest = path49.relative(cwd, destPath);
|
|
23386
23412
|
if (!fs31.existsSync(sourcePath)) {
|
|
23387
|
-
console.log(
|
|
23413
|
+
console.log(chalk190.red(`File not found: ${source}`));
|
|
23388
23414
|
process.exit(1);
|
|
23389
23415
|
}
|
|
23390
23416
|
if (destPath !== sourcePath && fs31.existsSync(destPath)) {
|
|
23391
|
-
console.log(
|
|
23417
|
+
console.log(chalk190.red(`Destination already exists: ${destination}`));
|
|
23392
23418
|
process.exit(1);
|
|
23393
23419
|
}
|
|
23394
|
-
console.log(
|
|
23395
|
-
console.log(
|
|
23396
|
-
console.log(
|
|
23420
|
+
console.log(chalk190.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
23421
|
+
console.log(chalk190.dim("Loading project..."));
|
|
23422
|
+
console.log(chalk190.dim("Scanning imports across the project..."));
|
|
23397
23423
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
23398
23424
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
23399
23425
|
console.log(
|
|
23400
|
-
|
|
23426
|
+
chalk190.dim(
|
|
23401
23427
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
23402
23428
|
)
|
|
23403
23429
|
);
|
|
@@ -23406,11 +23432,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
23406
23432
|
return;
|
|
23407
23433
|
}
|
|
23408
23434
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
23409
|
-
console.log(
|
|
23435
|
+
console.log(chalk190.green("Done"));
|
|
23410
23436
|
}
|
|
23411
23437
|
|
|
23412
23438
|
// src/commands/refactor/renameSymbol/index.ts
|
|
23413
|
-
import
|
|
23439
|
+
import chalk191 from "chalk";
|
|
23414
23440
|
|
|
23415
23441
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
23416
23442
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -23456,33 +23482,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
23456
23482
|
const { project, sourceFile } = loadProjectFile(file);
|
|
23457
23483
|
const symbol = findSymbol(sourceFile, oldName);
|
|
23458
23484
|
if (!symbol) {
|
|
23459
|
-
console.log(
|
|
23485
|
+
console.log(chalk191.red(`Symbol "${oldName}" not found in ${file}`));
|
|
23460
23486
|
process.exit(1);
|
|
23461
23487
|
}
|
|
23462
23488
|
const grouped = groupReferences(symbol, cwd);
|
|
23463
23489
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
23464
23490
|
console.log(
|
|
23465
|
-
|
|
23491
|
+
chalk191.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
23466
23492
|
`)
|
|
23467
23493
|
);
|
|
23468
23494
|
for (const [refFile, lines2] of grouped) {
|
|
23469
23495
|
console.log(
|
|
23470
|
-
` ${
|
|
23496
|
+
` ${chalk191.dim(refFile)}: lines ${chalk191.cyan(lines2.join(", "))}`
|
|
23471
23497
|
);
|
|
23472
23498
|
}
|
|
23473
23499
|
if (options2.apply) {
|
|
23474
23500
|
symbol.rename(newName);
|
|
23475
23501
|
await project.save();
|
|
23476
|
-
console.log(
|
|
23502
|
+
console.log(chalk191.green(`
|
|
23477
23503
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
23478
23504
|
} else {
|
|
23479
|
-
console.log(
|
|
23505
|
+
console.log(chalk191.dim("\nDry run. Use --apply to execute."));
|
|
23480
23506
|
}
|
|
23481
23507
|
}
|
|
23482
23508
|
|
|
23483
23509
|
// src/commands/refactor/restructure/index.ts
|
|
23484
23510
|
import path57 from "path";
|
|
23485
|
-
import
|
|
23511
|
+
import chalk194 from "chalk";
|
|
23486
23512
|
|
|
23487
23513
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
23488
23514
|
import path51 from "path";
|
|
@@ -23561,50 +23587,50 @@ function clusterFiles(graph) {
|
|
|
23561
23587
|
|
|
23562
23588
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
23563
23589
|
import path53 from "path";
|
|
23564
|
-
import
|
|
23590
|
+
import chalk192 from "chalk";
|
|
23565
23591
|
function relPath(filePath) {
|
|
23566
23592
|
return path53.relative(process.cwd(), filePath);
|
|
23567
23593
|
}
|
|
23568
23594
|
function displayMoves(plan2) {
|
|
23569
23595
|
if (plan2.moves.length === 0) return;
|
|
23570
|
-
console.log(
|
|
23596
|
+
console.log(chalk192.bold("\nFile moves:"));
|
|
23571
23597
|
for (const move2 of plan2.moves) {
|
|
23572
23598
|
console.log(
|
|
23573
|
-
` ${
|
|
23599
|
+
` ${chalk192.red(relPath(move2.from))} \u2192 ${chalk192.green(relPath(move2.to))}`
|
|
23574
23600
|
);
|
|
23575
|
-
console.log(
|
|
23601
|
+
console.log(chalk192.dim(` ${move2.reason}`));
|
|
23576
23602
|
}
|
|
23577
23603
|
}
|
|
23578
23604
|
function displayRewrites(rewrites) {
|
|
23579
23605
|
if (rewrites.length === 0) return;
|
|
23580
23606
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
23581
|
-
console.log(
|
|
23607
|
+
console.log(chalk192.bold(`
|
|
23582
23608
|
Import rewrites (${affectedFiles.size} files):`));
|
|
23583
23609
|
for (const file of affectedFiles) {
|
|
23584
|
-
console.log(` ${
|
|
23610
|
+
console.log(` ${chalk192.cyan(relPath(file))}:`);
|
|
23585
23611
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
23586
23612
|
(r) => r.file === file
|
|
23587
23613
|
)) {
|
|
23588
23614
|
console.log(
|
|
23589
|
-
` ${
|
|
23615
|
+
` ${chalk192.red(`"${oldSpecifier}"`)} \u2192 ${chalk192.green(`"${newSpecifier}"`)}`
|
|
23590
23616
|
);
|
|
23591
23617
|
}
|
|
23592
23618
|
}
|
|
23593
23619
|
}
|
|
23594
23620
|
function displayPlan2(plan2) {
|
|
23595
23621
|
if (plan2.warnings.length > 0) {
|
|
23596
|
-
console.log(
|
|
23597
|
-
for (const w of plan2.warnings) console.log(
|
|
23622
|
+
console.log(chalk192.yellow("\nWarnings:"));
|
|
23623
|
+
for (const w of plan2.warnings) console.log(chalk192.yellow(` ${w}`));
|
|
23598
23624
|
}
|
|
23599
23625
|
if (plan2.newDirectories.length > 0) {
|
|
23600
|
-
console.log(
|
|
23626
|
+
console.log(chalk192.bold("\nNew directories:"));
|
|
23601
23627
|
for (const dir of plan2.newDirectories)
|
|
23602
|
-
console.log(
|
|
23628
|
+
console.log(chalk192.green(` ${dir}/`));
|
|
23603
23629
|
}
|
|
23604
23630
|
displayMoves(plan2);
|
|
23605
23631
|
displayRewrites(plan2.rewrites);
|
|
23606
23632
|
console.log(
|
|
23607
|
-
|
|
23633
|
+
chalk192.dim(
|
|
23608
23634
|
`
|
|
23609
23635
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
23610
23636
|
)
|
|
@@ -23614,18 +23640,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
23614
23640
|
// src/commands/refactor/restructure/executePlan.ts
|
|
23615
23641
|
import fs32 from "fs";
|
|
23616
23642
|
import path54 from "path";
|
|
23617
|
-
import
|
|
23643
|
+
import chalk193 from "chalk";
|
|
23618
23644
|
function executePlan(plan2) {
|
|
23619
23645
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
23620
23646
|
for (const [file, content] of updatedContents) {
|
|
23621
23647
|
fs32.writeFileSync(file, content, "utf8");
|
|
23622
23648
|
console.log(
|
|
23623
|
-
|
|
23649
|
+
chalk193.cyan(` Rewrote imports in ${path54.relative(process.cwd(), file)}`)
|
|
23624
23650
|
);
|
|
23625
23651
|
}
|
|
23626
23652
|
for (const dir of plan2.newDirectories) {
|
|
23627
23653
|
fs32.mkdirSync(dir, { recursive: true });
|
|
23628
|
-
console.log(
|
|
23654
|
+
console.log(chalk193.green(` Created ${path54.relative(process.cwd(), dir)}/`));
|
|
23629
23655
|
}
|
|
23630
23656
|
for (const move2 of plan2.moves) {
|
|
23631
23657
|
const targetDir = path54.dirname(move2.to);
|
|
@@ -23634,7 +23660,7 @@ function executePlan(plan2) {
|
|
|
23634
23660
|
}
|
|
23635
23661
|
fs32.renameSync(move2.from, move2.to);
|
|
23636
23662
|
console.log(
|
|
23637
|
-
|
|
23663
|
+
chalk193.white(
|
|
23638
23664
|
` Moved ${path54.relative(process.cwd(), move2.from)} \u2192 ${path54.relative(process.cwd(), move2.to)}`
|
|
23639
23665
|
)
|
|
23640
23666
|
);
|
|
@@ -23649,7 +23675,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
23649
23675
|
if (entries.length === 0) {
|
|
23650
23676
|
fs32.rmdirSync(dir);
|
|
23651
23677
|
console.log(
|
|
23652
|
-
|
|
23678
|
+
chalk193.dim(
|
|
23653
23679
|
` Removed empty directory ${path54.relative(process.cwd(), dir)}`
|
|
23654
23680
|
)
|
|
23655
23681
|
);
|
|
@@ -23782,22 +23808,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
23782
23808
|
const targetPattern = pattern2 ?? "src";
|
|
23783
23809
|
const files = findSourceFiles2(targetPattern);
|
|
23784
23810
|
if (files.length === 0) {
|
|
23785
|
-
console.log(
|
|
23811
|
+
console.log(chalk194.yellow("No files found matching pattern"));
|
|
23786
23812
|
return;
|
|
23787
23813
|
}
|
|
23788
23814
|
const tsConfigPath = findTsConfig(path57.resolve(files[0]));
|
|
23789
23815
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
23790
23816
|
if (plan2.moves.length === 0) {
|
|
23791
|
-
console.log(
|
|
23817
|
+
console.log(chalk194.green("No restructuring needed"));
|
|
23792
23818
|
return;
|
|
23793
23819
|
}
|
|
23794
23820
|
displayPlan2(plan2);
|
|
23795
23821
|
if (options2.apply) {
|
|
23796
|
-
console.log(
|
|
23822
|
+
console.log(chalk194.bold("\nApplying changes..."));
|
|
23797
23823
|
executePlan(plan2);
|
|
23798
|
-
console.log(
|
|
23824
|
+
console.log(chalk194.green("\nRestructuring complete"));
|
|
23799
23825
|
} else {
|
|
23800
|
-
console.log(
|
|
23826
|
+
console.log(chalk194.dim("\nDry run. Use --apply to execute."));
|
|
23801
23827
|
}
|
|
23802
23828
|
}
|
|
23803
23829
|
|
|
@@ -24118,6 +24144,64 @@ function gatherContext() {
|
|
|
24118
24144
|
// src/commands/review/postReviewToPr.ts
|
|
24119
24145
|
import { readFileSync as readFileSync41 } from "fs";
|
|
24120
24146
|
|
|
24147
|
+
// src/commands/sessions/shared/requestAssistSession.ts
|
|
24148
|
+
function parseIncoming(line) {
|
|
24149
|
+
try {
|
|
24150
|
+
const msg = JSON.parse(line);
|
|
24151
|
+
if (msg.type === "error" && (msg.message ?? "").includes("create-assist"))
|
|
24152
|
+
return { kind: "error", message: msg.message ?? "create-assist failed" };
|
|
24153
|
+
if (msg.type !== "created" || !msg.sessionId) return null;
|
|
24154
|
+
return { kind: "created", sessionId: msg.sessionId };
|
|
24155
|
+
} catch {
|
|
24156
|
+
return null;
|
|
24157
|
+
}
|
|
24158
|
+
}
|
|
24159
|
+
function requestAssistSession(assistArgs, cwd) {
|
|
24160
|
+
return new Promise((resolve22, reject) => {
|
|
24161
|
+
connectToDaemon().then((socket) => {
|
|
24162
|
+
let settled = false;
|
|
24163
|
+
const finish = (error, sessionId) => {
|
|
24164
|
+
if (settled) return;
|
|
24165
|
+
settled = true;
|
|
24166
|
+
socket.destroy();
|
|
24167
|
+
if (error) reject(error);
|
|
24168
|
+
else resolve22(sessionId);
|
|
24169
|
+
};
|
|
24170
|
+
readSocketLines(socket, (line) => {
|
|
24171
|
+
const incoming = parseIncoming(line);
|
|
24172
|
+
if (!incoming) return;
|
|
24173
|
+
if (incoming.kind === "error") finish(new Error(incoming.message));
|
|
24174
|
+
else finish(void 0, incoming.sessionId);
|
|
24175
|
+
});
|
|
24176
|
+
socket.on("error", (error) => finish(error));
|
|
24177
|
+
socket.on(
|
|
24178
|
+
"close",
|
|
24179
|
+
() => finish(new Error("daemon closed before the session was created"))
|
|
24180
|
+
);
|
|
24181
|
+
socket.write(
|
|
24182
|
+
`${JSON.stringify({ type: "create-assist", assistArgs, cwd })}
|
|
24183
|
+
`
|
|
24184
|
+
);
|
|
24185
|
+
}, reject);
|
|
24186
|
+
});
|
|
24187
|
+
}
|
|
24188
|
+
|
|
24189
|
+
// src/commands/review/chainAddressComments.ts
|
|
24190
|
+
async function chainAddressComments(prNumber) {
|
|
24191
|
+
if (process.env.ASSIST_SESSION !== "1") return;
|
|
24192
|
+
try {
|
|
24193
|
+
await requestAssistSession(
|
|
24194
|
+
["review-pr-comments", String(prNumber)],
|
|
24195
|
+
process.cwd()
|
|
24196
|
+
);
|
|
24197
|
+
console.log(`Started an Address Comments session for PR #${prNumber}.`);
|
|
24198
|
+
} catch (error) {
|
|
24199
|
+
console.error(
|
|
24200
|
+
`Warning: could not start an Address Comments session: ${error instanceof Error ? error.message : String(error)}`
|
|
24201
|
+
);
|
|
24202
|
+
}
|
|
24203
|
+
}
|
|
24204
|
+
|
|
24121
24205
|
// src/commands/review/parseFindings.ts
|
|
24122
24206
|
var SEVERITIES = ["blocker", "major", "minor", "nit"];
|
|
24123
24207
|
var SOURCES = [
|
|
@@ -24160,39 +24244,6 @@ function parseFindings(markdown) {
|
|
|
24160
24244
|
return markdown.split(/^###\s+Finding:\s*/m).slice(1).map(parseFindingBlock);
|
|
24161
24245
|
}
|
|
24162
24246
|
|
|
24163
|
-
// src/commands/review/partitionFindings.ts
|
|
24164
|
-
function isValidLine(n) {
|
|
24165
|
-
return Number.isInteger(n) && n >= 1;
|
|
24166
|
-
}
|
|
24167
|
-
function toLineBound(finding) {
|
|
24168
|
-
if (!finding.location || finding.location.toLowerCase() === "n/a") {
|
|
24169
|
-
return null;
|
|
24170
|
-
}
|
|
24171
|
-
const match = finding.location.match(/^(.+):(\d+)(?:-(\d+))?$/);
|
|
24172
|
-
if (!match) return null;
|
|
24173
|
-
const startLine = Number.parseInt(match[2], 10);
|
|
24174
|
-
const endLine = match[3] ? Number.parseInt(match[3], 10) : startLine;
|
|
24175
|
-
if (!isValidLine(startLine) || !isValidLine(endLine)) return null;
|
|
24176
|
-
if (endLine < startLine) return null;
|
|
24177
|
-
const base = { ...finding, file: match[1], line: endLine };
|
|
24178
|
-
return startLine === endLine ? base : { ...base, startLine };
|
|
24179
|
-
}
|
|
24180
|
-
function partitionFindings(findings) {
|
|
24181
|
-
const lineBound = [];
|
|
24182
|
-
const unlocated = [];
|
|
24183
|
-
const alreadyRaised = [];
|
|
24184
|
-
for (const finding of findings) {
|
|
24185
|
-
if (finding.source === "already-raised") {
|
|
24186
|
-
alreadyRaised.push(finding);
|
|
24187
|
-
continue;
|
|
24188
|
-
}
|
|
24189
|
-
const bound = toLineBound(finding);
|
|
24190
|
-
if (bound) lineBound.push(bound);
|
|
24191
|
-
else unlocated.push(finding);
|
|
24192
|
-
}
|
|
24193
|
-
return { lineBound, unlocated, alreadyRaised };
|
|
24194
|
-
}
|
|
24195
|
-
|
|
24196
24247
|
// src/commands/review/summariseSynthesis.ts
|
|
24197
24248
|
var SEVERITIES2 = ["blocker", "major", "minor", "nit"];
|
|
24198
24249
|
function isSeverity2(value) {
|
|
@@ -24314,13 +24365,47 @@ async function postAndMaybeSubmit(lineBound, markdown, options2) {
|
|
|
24314
24365
|
const result = postFindings(lineBound);
|
|
24315
24366
|
const failedSuffix = result.failed > 0 ? `, ${result.failed} failed` : "";
|
|
24316
24367
|
console.log(`Posted ${result.posted} comment(s)${failedSuffix}.`);
|
|
24317
|
-
if (result.posted === 0) return;
|
|
24368
|
+
if (result.posted === 0) return { posted: 0, submitted: false };
|
|
24318
24369
|
const shouldSubmit = await decideSubmit(options2);
|
|
24319
24370
|
if (shouldSubmit) {
|
|
24320
24371
|
submitPendingReview(buildReviewBody(markdown));
|
|
24321
|
-
return;
|
|
24372
|
+
return { posted: result.posted, submitted: true };
|
|
24322
24373
|
}
|
|
24323
24374
|
console.log("Leaving pending review unsubmitted.");
|
|
24375
|
+
return { posted: result.posted, submitted: false };
|
|
24376
|
+
}
|
|
24377
|
+
|
|
24378
|
+
// src/commands/review/partitionFindings.ts
|
|
24379
|
+
function isValidLine(n) {
|
|
24380
|
+
return Number.isInteger(n) && n >= 1;
|
|
24381
|
+
}
|
|
24382
|
+
function toLineBound(finding) {
|
|
24383
|
+
if (!finding.location || finding.location.toLowerCase() === "n/a") {
|
|
24384
|
+
return null;
|
|
24385
|
+
}
|
|
24386
|
+
const match = finding.location.match(/^(.+):(\d+)(?:-(\d+))?$/);
|
|
24387
|
+
if (!match) return null;
|
|
24388
|
+
const startLine = Number.parseInt(match[2], 10);
|
|
24389
|
+
const endLine = match[3] ? Number.parseInt(match[3], 10) : startLine;
|
|
24390
|
+
if (!isValidLine(startLine) || !isValidLine(endLine)) return null;
|
|
24391
|
+
if (endLine < startLine) return null;
|
|
24392
|
+
const base = { ...finding, file: match[1], line: endLine };
|
|
24393
|
+
return startLine === endLine ? base : { ...base, startLine };
|
|
24394
|
+
}
|
|
24395
|
+
function partitionFindings(findings) {
|
|
24396
|
+
const lineBound = [];
|
|
24397
|
+
const unlocated = [];
|
|
24398
|
+
const alreadyRaised = [];
|
|
24399
|
+
for (const finding of findings) {
|
|
24400
|
+
if (finding.source === "already-raised") {
|
|
24401
|
+
alreadyRaised.push(finding);
|
|
24402
|
+
continue;
|
|
24403
|
+
}
|
|
24404
|
+
const bound = toLineBound(finding);
|
|
24405
|
+
if (bound) lineBound.push(bound);
|
|
24406
|
+
else unlocated.push(finding);
|
|
24407
|
+
}
|
|
24408
|
+
return { lineBound, unlocated, alreadyRaised };
|
|
24324
24409
|
}
|
|
24325
24410
|
|
|
24326
24411
|
// src/commands/review/buildDiffLineIndex.ts
|
|
@@ -24377,18 +24462,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
24377
24462
|
}
|
|
24378
24463
|
|
|
24379
24464
|
// src/commands/review/warnOutOfDiff.ts
|
|
24380
|
-
import
|
|
24465
|
+
import chalk195 from "chalk";
|
|
24381
24466
|
function warnOutOfDiff(outOfDiff) {
|
|
24382
24467
|
if (outOfDiff.length === 0) return;
|
|
24383
24468
|
console.warn(
|
|
24384
|
-
|
|
24469
|
+
chalk195.yellow(
|
|
24385
24470
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
24386
24471
|
)
|
|
24387
24472
|
);
|
|
24388
24473
|
for (const finding of outOfDiff) {
|
|
24389
24474
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
24390
24475
|
console.warn(
|
|
24391
|
-
` ${
|
|
24476
|
+
` ${chalk195.yellow("\xB7")} ${finding.title} ${chalk195.dim(
|
|
24392
24477
|
`(${finding.file}:${range})`
|
|
24393
24478
|
)}`
|
|
24394
24479
|
);
|
|
@@ -24407,35 +24492,28 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
24407
24492
|
}
|
|
24408
24493
|
|
|
24409
24494
|
// src/commands/review/warnUnlocated.ts
|
|
24410
|
-
import
|
|
24495
|
+
import chalk196 from "chalk";
|
|
24411
24496
|
function warnUnlocated(unlocated) {
|
|
24412
24497
|
if (unlocated.length === 0) return;
|
|
24413
24498
|
console.warn(
|
|
24414
|
-
|
|
24499
|
+
chalk196.yellow(
|
|
24415
24500
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
24416
24501
|
)
|
|
24417
24502
|
);
|
|
24418
24503
|
for (const finding of unlocated) {
|
|
24419
|
-
const where = finding.location ||
|
|
24504
|
+
const where = finding.location || chalk196.dim("missing");
|
|
24420
24505
|
console.warn(
|
|
24421
|
-
` ${
|
|
24506
|
+
` ${chalk196.yellow("\xB7")} ${finding.title} ${chalk196.dim(`(${where})`)}`
|
|
24422
24507
|
);
|
|
24423
24508
|
}
|
|
24424
24509
|
}
|
|
24425
24510
|
|
|
24426
|
-
// src/commands/review/
|
|
24427
|
-
|
|
24428
|
-
if (!options2.prompt) return true;
|
|
24429
|
-
return promptConfirm(`Post ${count8} comment(s) to PR #${prNumber}?`, false);
|
|
24430
|
-
}
|
|
24431
|
-
async function postReviewToPr(synthesisPath, options2) {
|
|
24432
|
-
const prInfo = fetchPrDiffInfo();
|
|
24433
|
-
const prNumber = prInfo.prNumber;
|
|
24434
|
-
const markdown = readFileSync41(synthesisPath, "utf8");
|
|
24511
|
+
// src/commands/review/selectPostableFindings.ts
|
|
24512
|
+
function selectPostableFindings(markdown, prInfo) {
|
|
24435
24513
|
const findings = parseFindings(markdown);
|
|
24436
24514
|
if (findings.length === 0) {
|
|
24437
24515
|
console.log("Synthesis contains no findings; nothing to post.");
|
|
24438
|
-
return;
|
|
24516
|
+
return [];
|
|
24439
24517
|
}
|
|
24440
24518
|
const { lineBound, unlocated, alreadyRaised } = partitionFindings(findings);
|
|
24441
24519
|
warnUnlocated(unlocated);
|
|
@@ -24446,13 +24524,25 @@ async function postReviewToPr(synthesisPath, options2) {
|
|
|
24446
24524
|
}
|
|
24447
24525
|
if (lineBound.length === 0) {
|
|
24448
24526
|
console.log("No line-bound findings to post.");
|
|
24449
|
-
return;
|
|
24527
|
+
return [];
|
|
24450
24528
|
}
|
|
24451
24529
|
const inDiff = selectInDiffFindings(lineBound, prInfo);
|
|
24452
|
-
if (inDiff.length === 0)
|
|
24530
|
+
if (inDiff.length === 0)
|
|
24453
24531
|
console.log("No findings fall within the PR diff; nothing to post.");
|
|
24454
|
-
|
|
24455
|
-
|
|
24532
|
+
return inDiff;
|
|
24533
|
+
}
|
|
24534
|
+
|
|
24535
|
+
// src/commands/review/postReviewToPr.ts
|
|
24536
|
+
async function confirmPost(prNumber, count8, options2) {
|
|
24537
|
+
if (!options2.prompt) return true;
|
|
24538
|
+
return promptConfirm(`Post ${count8} comment(s) to PR #${prNumber}?`, false);
|
|
24539
|
+
}
|
|
24540
|
+
async function postReviewToPr(synthesisPath, options2) {
|
|
24541
|
+
const prInfo = fetchPrDiffInfo();
|
|
24542
|
+
const prNumber = prInfo.prNumber;
|
|
24543
|
+
const markdown = readFileSync41(synthesisPath, "utf8");
|
|
24544
|
+
const inDiff = selectPostableFindings(markdown, prInfo);
|
|
24545
|
+
if (inDiff.length === 0) return;
|
|
24456
24546
|
console.log(
|
|
24457
24547
|
`Found PR #${prNumber} with ${inDiff.length} line-bound finding(s) in the diff.`
|
|
24458
24548
|
);
|
|
@@ -24461,7 +24551,9 @@ async function postReviewToPr(synthesisPath, options2) {
|
|
|
24461
24551
|
console.log("Skipped posting.");
|
|
24462
24552
|
return;
|
|
24463
24553
|
}
|
|
24464
|
-
await postAndMaybeSubmit(inDiff, markdown, options2);
|
|
24554
|
+
const outcome = await postAndMaybeSubmit(inDiff, markdown, options2);
|
|
24555
|
+
if (options2.addressComments && outcome.posted > 0 && outcome.submitted)
|
|
24556
|
+
await chainAddressComments(prNumber);
|
|
24465
24557
|
}
|
|
24466
24558
|
|
|
24467
24559
|
// src/commands/review/runRefineSession.ts
|
|
@@ -24508,7 +24600,8 @@ async function handlePostSynthesis(synthesisPath, options2) {
|
|
|
24508
24600
|
}
|
|
24509
24601
|
await postReviewToPr(synthesisPath, {
|
|
24510
24602
|
prompt: options2.prompt,
|
|
24511
|
-
submit: options2.submit
|
|
24603
|
+
submit: options2.submit,
|
|
24604
|
+
addressComments: options2.addressComments
|
|
24512
24605
|
});
|
|
24513
24606
|
}
|
|
24514
24607
|
|
|
@@ -25508,7 +25601,8 @@ async function runPostSynthesis(synthesisPath, options2) {
|
|
|
25508
25601
|
await handlePostSynthesis(synthesisPath, {
|
|
25509
25602
|
refine: options2.refine ?? false,
|
|
25510
25603
|
prompt: options2.prompt ?? true,
|
|
25511
|
-
submit: options2.submit ?? false
|
|
25604
|
+
submit: options2.submit ?? false,
|
|
25605
|
+
addressComments: options2.addressComments ?? false
|
|
25512
25606
|
});
|
|
25513
25607
|
}
|
|
25514
25608
|
async function reviewPr(repoRoot, options2) {
|
|
@@ -25574,6 +25668,9 @@ function registerReview(program2) {
|
|
|
25574
25668
|
).option(
|
|
25575
25669
|
"--backlog",
|
|
25576
25670
|
"After synthesis, launch an interactive Claude session running /bug to file all findings as a single backlog item with one phase per finding, instead of posting to the PR"
|
|
25671
|
+
).option(
|
|
25672
|
+
"--address-comments",
|
|
25673
|
+
"After posting and submitting the review, start an Address Comments session (assist review-pr-comments <n>) for the PR; no-op when nothing was posted or the review was not submitted, and only inside an assist session"
|
|
25577
25674
|
).option(
|
|
25578
25675
|
"--verbose",
|
|
25579
25676
|
"Disable spinner UI and use per-line log output (per-tool lines, starting/done lines)"
|
|
@@ -25583,7 +25680,7 @@ function registerReview(program2) {
|
|
|
25583
25680
|
}
|
|
25584
25681
|
|
|
25585
25682
|
// src/commands/seq/seqAuth.ts
|
|
25586
|
-
import
|
|
25683
|
+
import chalk198 from "chalk";
|
|
25587
25684
|
|
|
25588
25685
|
// src/commands/seq/loadConnections.ts
|
|
25589
25686
|
function loadConnections2() {
|
|
@@ -25612,10 +25709,10 @@ function setDefaultConnection(name) {
|
|
|
25612
25709
|
}
|
|
25613
25710
|
|
|
25614
25711
|
// src/shared/assertUniqueName.ts
|
|
25615
|
-
import
|
|
25712
|
+
import chalk197 from "chalk";
|
|
25616
25713
|
function assertUniqueName(existingNames, name) {
|
|
25617
25714
|
if (existingNames.includes(name)) {
|
|
25618
|
-
console.error(
|
|
25715
|
+
console.error(chalk197.red(`Connection "${name}" already exists.`));
|
|
25619
25716
|
process.exit(1);
|
|
25620
25717
|
}
|
|
25621
25718
|
}
|
|
@@ -25633,7 +25730,7 @@ async function promptConnection2(existingNames) {
|
|
|
25633
25730
|
var seqAuth = createConnectionAuth({
|
|
25634
25731
|
load: loadConnections2,
|
|
25635
25732
|
save: saveConnections2,
|
|
25636
|
-
format: (c) => `${
|
|
25733
|
+
format: (c) => `${chalk198.bold(c.name)} ${c.url}`,
|
|
25637
25734
|
promptNew: promptConnection2,
|
|
25638
25735
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
25639
25736
|
});
|
|
@@ -25653,10 +25750,10 @@ var seqConfigHelp = [
|
|
|
25653
25750
|
];
|
|
25654
25751
|
|
|
25655
25752
|
// src/commands/seq/seqQuery.ts
|
|
25656
|
-
import
|
|
25753
|
+
import chalk202 from "chalk";
|
|
25657
25754
|
|
|
25658
25755
|
// src/commands/seq/fetchSeq.ts
|
|
25659
|
-
import
|
|
25756
|
+
import chalk199 from "chalk";
|
|
25660
25757
|
async function fetchSeq(conn, path71, params) {
|
|
25661
25758
|
const url = `${conn.url}${path71}?${params}`;
|
|
25662
25759
|
const response = await fetch(url, {
|
|
@@ -25667,7 +25764,7 @@ async function fetchSeq(conn, path71, params) {
|
|
|
25667
25764
|
});
|
|
25668
25765
|
if (!response.ok) {
|
|
25669
25766
|
const body = await response.text();
|
|
25670
|
-
console.error(
|
|
25767
|
+
console.error(chalk199.red(`Seq returned ${response.status}: ${body}`));
|
|
25671
25768
|
process.exit(1);
|
|
25672
25769
|
}
|
|
25673
25770
|
return response;
|
|
@@ -25726,23 +25823,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
25726
25823
|
}
|
|
25727
25824
|
|
|
25728
25825
|
// src/commands/seq/formatEvent.ts
|
|
25729
|
-
import
|
|
25826
|
+
import chalk200 from "chalk";
|
|
25730
25827
|
function levelColor(level) {
|
|
25731
25828
|
switch (level) {
|
|
25732
25829
|
case "Fatal":
|
|
25733
|
-
return
|
|
25830
|
+
return chalk200.bgRed.white;
|
|
25734
25831
|
case "Error":
|
|
25735
|
-
return
|
|
25832
|
+
return chalk200.red;
|
|
25736
25833
|
case "Warning":
|
|
25737
|
-
return
|
|
25834
|
+
return chalk200.yellow;
|
|
25738
25835
|
case "Information":
|
|
25739
|
-
return
|
|
25836
|
+
return chalk200.cyan;
|
|
25740
25837
|
case "Debug":
|
|
25741
|
-
return
|
|
25838
|
+
return chalk200.gray;
|
|
25742
25839
|
case "Verbose":
|
|
25743
|
-
return
|
|
25840
|
+
return chalk200.dim;
|
|
25744
25841
|
default:
|
|
25745
|
-
return
|
|
25842
|
+
return chalk200.white;
|
|
25746
25843
|
}
|
|
25747
25844
|
}
|
|
25748
25845
|
function levelAbbrev(level) {
|
|
@@ -25783,12 +25880,12 @@ function formatTimestamp(iso) {
|
|
|
25783
25880
|
function formatEvent(event) {
|
|
25784
25881
|
const color = levelColor(event.Level);
|
|
25785
25882
|
const abbrev = levelAbbrev(event.Level);
|
|
25786
|
-
const ts8 =
|
|
25883
|
+
const ts8 = chalk200.dim(formatTimestamp(event.Timestamp));
|
|
25787
25884
|
const msg = renderMessage(event);
|
|
25788
25885
|
const lines2 = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
25789
25886
|
if (event.Exception) {
|
|
25790
25887
|
for (const line of event.Exception.split("\n")) {
|
|
25791
|
-
lines2.push(
|
|
25888
|
+
lines2.push(chalk200.red(` ${line}`));
|
|
25792
25889
|
}
|
|
25793
25890
|
}
|
|
25794
25891
|
return lines2.join("\n");
|
|
@@ -25821,11 +25918,11 @@ function rejectTimestampFilter(filter) {
|
|
|
25821
25918
|
}
|
|
25822
25919
|
|
|
25823
25920
|
// src/shared/resolveNamedConnection.ts
|
|
25824
|
-
import
|
|
25921
|
+
import chalk201 from "chalk";
|
|
25825
25922
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
25826
25923
|
if (connections.length === 0) {
|
|
25827
25924
|
console.error(
|
|
25828
|
-
|
|
25925
|
+
chalk201.red(
|
|
25829
25926
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
25830
25927
|
)
|
|
25831
25928
|
);
|
|
@@ -25834,7 +25931,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
25834
25931
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
25835
25932
|
const connection = connections.find((c) => c.name === target);
|
|
25836
25933
|
if (!connection) {
|
|
25837
|
-
console.error(
|
|
25934
|
+
console.error(chalk201.red(`${kind} connection "${target}" not found.`));
|
|
25838
25935
|
process.exit(1);
|
|
25839
25936
|
}
|
|
25840
25937
|
return connection;
|
|
@@ -25863,7 +25960,7 @@ async function seqQuery(filter, options2) {
|
|
|
25863
25960
|
new URLSearchParams({ filter, count: String(count8) })
|
|
25864
25961
|
);
|
|
25865
25962
|
if (events.length === 0) {
|
|
25866
|
-
console.log(
|
|
25963
|
+
console.log(chalk202.yellow("No events found."));
|
|
25867
25964
|
return;
|
|
25868
25965
|
}
|
|
25869
25966
|
if (options2.json) {
|
|
@@ -25874,11 +25971,11 @@ async function seqQuery(filter, options2) {
|
|
|
25874
25971
|
for (const event of chronological) {
|
|
25875
25972
|
console.log(formatEvent(event));
|
|
25876
25973
|
}
|
|
25877
|
-
console.log(
|
|
25974
|
+
console.log(chalk202.dim(`
|
|
25878
25975
|
${events.length} events`));
|
|
25879
25976
|
if (events.length >= count8) {
|
|
25880
25977
|
console.log(
|
|
25881
|
-
|
|
25978
|
+
chalk202.yellow(
|
|
25882
25979
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
25883
25980
|
)
|
|
25884
25981
|
);
|
|
@@ -25886,10 +25983,10 @@ ${events.length} events`));
|
|
|
25886
25983
|
}
|
|
25887
25984
|
|
|
25888
25985
|
// src/shared/setNamedDefaultConnection.ts
|
|
25889
|
-
import
|
|
25986
|
+
import chalk203 from "chalk";
|
|
25890
25987
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
25891
25988
|
if (!connections.find((c) => c.name === name)) {
|
|
25892
|
-
console.error(
|
|
25989
|
+
console.error(chalk203.red(`Connection "${name}" not found.`));
|
|
25893
25990
|
process.exit(1);
|
|
25894
25991
|
}
|
|
25895
25992
|
setDefault(name);
|
|
@@ -25938,7 +26035,7 @@ function registerSignal(program2) {
|
|
|
25938
26035
|
}
|
|
25939
26036
|
|
|
25940
26037
|
// src/commands/sql/sqlAuth.ts
|
|
25941
|
-
import
|
|
26038
|
+
import chalk205 from "chalk";
|
|
25942
26039
|
|
|
25943
26040
|
// src/commands/sql/loadConnections.ts
|
|
25944
26041
|
function loadConnections3() {
|
|
@@ -25967,7 +26064,7 @@ function setDefaultConnection2(name) {
|
|
|
25967
26064
|
}
|
|
25968
26065
|
|
|
25969
26066
|
// src/commands/sql/promptConnection.ts
|
|
25970
|
-
import
|
|
26067
|
+
import chalk204 from "chalk";
|
|
25971
26068
|
async function promptConnection3(existingNames) {
|
|
25972
26069
|
const name = await promptInput("name", "Connection name:", "default");
|
|
25973
26070
|
assertUniqueName(existingNames, name);
|
|
@@ -25975,7 +26072,7 @@ async function promptConnection3(existingNames) {
|
|
|
25975
26072
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
25976
26073
|
const port = Number.parseInt(portStr, 10);
|
|
25977
26074
|
if (!Number.isFinite(port)) {
|
|
25978
|
-
console.error(
|
|
26075
|
+
console.error(chalk204.red(`Invalid port "${portStr}".`));
|
|
25979
26076
|
process.exit(1);
|
|
25980
26077
|
}
|
|
25981
26078
|
const user = await promptInput("user", "User:");
|
|
@@ -25988,13 +26085,13 @@ async function promptConnection3(existingNames) {
|
|
|
25988
26085
|
var sqlAuth = createConnectionAuth({
|
|
25989
26086
|
load: loadConnections3,
|
|
25990
26087
|
save: saveConnections3,
|
|
25991
|
-
format: (c) => `${
|
|
26088
|
+
format: (c) => `${chalk205.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
25992
26089
|
promptNew: promptConnection3,
|
|
25993
26090
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
25994
26091
|
});
|
|
25995
26092
|
|
|
25996
26093
|
// src/commands/sql/printTable.ts
|
|
25997
|
-
import
|
|
26094
|
+
import chalk206 from "chalk";
|
|
25998
26095
|
function formatCell(value) {
|
|
25999
26096
|
if (value === null || value === void 0) return "";
|
|
26000
26097
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -26003,7 +26100,7 @@ function formatCell(value) {
|
|
|
26003
26100
|
}
|
|
26004
26101
|
function printTable(rows) {
|
|
26005
26102
|
if (rows.length === 0) {
|
|
26006
|
-
console.log(
|
|
26103
|
+
console.log(chalk206.yellow("(no rows)"));
|
|
26007
26104
|
return;
|
|
26008
26105
|
}
|
|
26009
26106
|
const columns = Object.keys(rows[0]);
|
|
@@ -26011,13 +26108,13 @@ function printTable(rows) {
|
|
|
26011
26108
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
26012
26109
|
);
|
|
26013
26110
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
26014
|
-
console.log(
|
|
26015
|
-
console.log(
|
|
26111
|
+
console.log(chalk206.dim(header));
|
|
26112
|
+
console.log(chalk206.dim("-".repeat(header.length)));
|
|
26016
26113
|
for (const row of rows) {
|
|
26017
26114
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
26018
26115
|
console.log(line);
|
|
26019
26116
|
}
|
|
26020
|
-
console.log(
|
|
26117
|
+
console.log(chalk206.dim(`
|
|
26021
26118
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
26022
26119
|
}
|
|
26023
26120
|
|
|
@@ -26091,7 +26188,7 @@ var sqlConfigHelp = [
|
|
|
26091
26188
|
];
|
|
26092
26189
|
|
|
26093
26190
|
// src/commands/sql/sqlMutate.ts
|
|
26094
|
-
import
|
|
26191
|
+
import chalk207 from "chalk";
|
|
26095
26192
|
|
|
26096
26193
|
// src/commands/sql/isMutation.ts
|
|
26097
26194
|
var MUTATION_KEYWORDS = [
|
|
@@ -26125,7 +26222,7 @@ function isMutation(sql25) {
|
|
|
26125
26222
|
async function sqlMutate(query, connectionName) {
|
|
26126
26223
|
if (!isMutation(query)) {
|
|
26127
26224
|
console.error(
|
|
26128
|
-
|
|
26225
|
+
chalk207.red(
|
|
26129
26226
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
26130
26227
|
)
|
|
26131
26228
|
);
|
|
@@ -26135,18 +26232,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
26135
26232
|
const pool = await sqlConnect(conn);
|
|
26136
26233
|
try {
|
|
26137
26234
|
const result = await pool.request().query(query);
|
|
26138
|
-
console.log(
|
|
26235
|
+
console.log(chalk207.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
26139
26236
|
} finally {
|
|
26140
26237
|
await pool.close();
|
|
26141
26238
|
}
|
|
26142
26239
|
}
|
|
26143
26240
|
|
|
26144
26241
|
// src/commands/sql/sqlQuery.ts
|
|
26145
|
-
import
|
|
26242
|
+
import chalk208 from "chalk";
|
|
26146
26243
|
async function sqlQuery(query, connectionName) {
|
|
26147
26244
|
if (isMutation(query)) {
|
|
26148
26245
|
console.error(
|
|
26149
|
-
|
|
26246
|
+
chalk208.red(
|
|
26150
26247
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
26151
26248
|
)
|
|
26152
26249
|
);
|
|
@@ -26161,7 +26258,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
26161
26258
|
printTable(rows);
|
|
26162
26259
|
} else {
|
|
26163
26260
|
console.log(
|
|
26164
|
-
|
|
26261
|
+
chalk208.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
26165
26262
|
);
|
|
26166
26263
|
}
|
|
26167
26264
|
} finally {
|
|
@@ -27556,7 +27653,7 @@ function registerWatch(program2) {
|
|
|
27556
27653
|
|
|
27557
27654
|
// src/commands/roam/auth.ts
|
|
27558
27655
|
import { randomBytes } from "crypto";
|
|
27559
|
-
import
|
|
27656
|
+
import chalk209 from "chalk";
|
|
27560
27657
|
|
|
27561
27658
|
// src/commands/roam/waitForCallback.ts
|
|
27562
27659
|
import { createServer as createServer3 } from "http";
|
|
@@ -27687,13 +27784,13 @@ async function auth() {
|
|
|
27687
27784
|
saveGlobalConfig(config);
|
|
27688
27785
|
const state = randomBytes(16).toString("hex");
|
|
27689
27786
|
console.log(
|
|
27690
|
-
|
|
27787
|
+
chalk209.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
27691
27788
|
);
|
|
27692
|
-
console.log(
|
|
27693
|
-
console.log(
|
|
27694
|
-
console.log(
|
|
27789
|
+
console.log(chalk209.white("http://localhost:14523/callback\n"));
|
|
27790
|
+
console.log(chalk209.blue("Opening browser for authorization..."));
|
|
27791
|
+
console.log(chalk209.dim("Waiting for authorization callback..."));
|
|
27695
27792
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
27696
|
-
console.log(
|
|
27793
|
+
console.log(chalk209.dim("Exchanging code for tokens..."));
|
|
27697
27794
|
const tokens = await exchangeToken({
|
|
27698
27795
|
code,
|
|
27699
27796
|
clientId,
|
|
@@ -27709,7 +27806,7 @@ async function auth() {
|
|
|
27709
27806
|
};
|
|
27710
27807
|
saveGlobalConfig(config);
|
|
27711
27808
|
console.log(
|
|
27712
|
-
|
|
27809
|
+
chalk209.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
27713
27810
|
);
|
|
27714
27811
|
}
|
|
27715
27812
|
|
|
@@ -27812,11 +27909,11 @@ function registerRoam(program2) {
|
|
|
27812
27909
|
}
|
|
27813
27910
|
|
|
27814
27911
|
// src/commands/sync/printAutoConfirmHint.ts
|
|
27815
|
-
import
|
|
27912
|
+
import chalk210 from "chalk";
|
|
27816
27913
|
var autoConfirmHintCommand = "assist config set sync.autoConfirm true --global";
|
|
27817
27914
|
function printAutoConfirmHint() {
|
|
27818
27915
|
console.log(
|
|
27819
|
-
|
|
27916
|
+
chalk210.dim(
|
|
27820
27917
|
`Tip: run \`${autoConfirmHintCommand}\` to overwrite automatically next time`
|
|
27821
27918
|
)
|
|
27822
27919
|
);
|
|
@@ -28157,7 +28254,7 @@ import { execSync as execSync61 } from "child_process";
|
|
|
28157
28254
|
import { existsSync as existsSync60, mkdirSync as mkdirSync25, unlinkSync as unlinkSync22, writeFileSync as writeFileSync42 } from "fs";
|
|
28158
28255
|
import { tmpdir as tmpdir8 } from "os";
|
|
28159
28256
|
import { join as join72, resolve as resolve19 } from "path";
|
|
28160
|
-
import
|
|
28257
|
+
import chalk211 from "chalk";
|
|
28161
28258
|
|
|
28162
28259
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
28163
28260
|
var captureWindowPs1 = `
|
|
@@ -28308,13 +28405,13 @@ function screenshot(processName) {
|
|
|
28308
28405
|
const config = loadConfig();
|
|
28309
28406
|
const outputDir = resolve19(config.screenshot.outputDir);
|
|
28310
28407
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
28311
|
-
console.log(
|
|
28408
|
+
console.log(chalk211.gray(`Capturing window for process "${processName}" ...`));
|
|
28312
28409
|
try {
|
|
28313
28410
|
runPowerShellScript(processName, outputPath);
|
|
28314
|
-
console.log(
|
|
28411
|
+
console.log(chalk211.green(`Screenshot saved: ${outputPath}`));
|
|
28315
28412
|
} catch (error) {
|
|
28316
28413
|
const msg = error instanceof Error ? error.message : String(error);
|
|
28317
|
-
console.error(
|
|
28414
|
+
console.error(chalk211.red(`Failed to capture screenshot: ${msg}`));
|
|
28318
28415
|
process.exit(1);
|
|
28319
28416
|
}
|
|
28320
28417
|
}
|
|
@@ -33068,7 +33165,7 @@ var sessionsConfigHelp = [
|
|
|
33068
33165
|
|
|
33069
33166
|
// src/commands/sessions/summarise/index.ts
|
|
33070
33167
|
import * as fs41 from "fs";
|
|
33071
|
-
import
|
|
33168
|
+
import chalk212 from "chalk";
|
|
33072
33169
|
|
|
33073
33170
|
// src/commands/sessions/summarise/shared.ts
|
|
33074
33171
|
import * as fs40 from "fs";
|
|
@@ -33127,22 +33224,22 @@ ${firstMessage}`);
|
|
|
33127
33224
|
async function summarise2(options2) {
|
|
33128
33225
|
const files = await discoverSessionFiles();
|
|
33129
33226
|
if (files.length === 0) {
|
|
33130
|
-
console.log(
|
|
33227
|
+
console.log(chalk212.yellow("No sessions found."));
|
|
33131
33228
|
return;
|
|
33132
33229
|
}
|
|
33133
33230
|
const toProcess = selectCandidates(files, options2);
|
|
33134
33231
|
if (toProcess.length === 0) {
|
|
33135
|
-
console.log(
|
|
33232
|
+
console.log(chalk212.green("All sessions already summarised."));
|
|
33136
33233
|
return;
|
|
33137
33234
|
}
|
|
33138
33235
|
console.log(
|
|
33139
|
-
|
|
33236
|
+
chalk212.cyan(
|
|
33140
33237
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
33141
33238
|
)
|
|
33142
33239
|
);
|
|
33143
33240
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
33144
33241
|
console.log(
|
|
33145
|
-
|
|
33242
|
+
chalk212.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk212.yellow(`, ${failed2} skipped`) : "")
|
|
33146
33243
|
);
|
|
33147
33244
|
}
|
|
33148
33245
|
function selectCandidates(files, options2) {
|
|
@@ -33162,16 +33259,16 @@ function processSessions(files) {
|
|
|
33162
33259
|
let failed2 = 0;
|
|
33163
33260
|
for (let i = 0; i < files.length; i++) {
|
|
33164
33261
|
const file = files[i];
|
|
33165
|
-
process.stdout.write(
|
|
33262
|
+
process.stdout.write(chalk212.dim(` [${i + 1}/${files.length}] `));
|
|
33166
33263
|
const summary = summariseSession(file);
|
|
33167
33264
|
if (summary) {
|
|
33168
33265
|
writeSummary(file, summary);
|
|
33169
33266
|
succeeded++;
|
|
33170
|
-
process.stdout.write(`${
|
|
33267
|
+
process.stdout.write(`${chalk212.green("\u2713")} ${summary}
|
|
33171
33268
|
`);
|
|
33172
33269
|
} else {
|
|
33173
33270
|
failed2++;
|
|
33174
|
-
process.stdout.write(` ${
|
|
33271
|
+
process.stdout.write(` ${chalk212.yellow("skip")}
|
|
33175
33272
|
`);
|
|
33176
33273
|
}
|
|
33177
33274
|
}
|
|
@@ -33192,7 +33289,7 @@ function registerSessions(program2) {
|
|
|
33192
33289
|
}
|
|
33193
33290
|
|
|
33194
33291
|
// src/commands/statusLine.ts
|
|
33195
|
-
import
|
|
33292
|
+
import chalk214 from "chalk";
|
|
33196
33293
|
|
|
33197
33294
|
// src/shared/contextLevel.ts
|
|
33198
33295
|
function contextLevel(pct) {
|
|
@@ -33202,7 +33299,7 @@ function contextLevel(pct) {
|
|
|
33202
33299
|
}
|
|
33203
33300
|
|
|
33204
33301
|
// src/commands/buildLimitsSegment.ts
|
|
33205
|
-
import
|
|
33302
|
+
import chalk213 from "chalk";
|
|
33206
33303
|
|
|
33207
33304
|
// src/shared/rateLimitLevel.ts
|
|
33208
33305
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -33233,9 +33330,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
33233
33330
|
|
|
33234
33331
|
// src/commands/buildLimitsSegment.ts
|
|
33235
33332
|
var LEVEL_COLOR = {
|
|
33236
|
-
ok:
|
|
33237
|
-
warn:
|
|
33238
|
-
over:
|
|
33333
|
+
ok: chalk213.green,
|
|
33334
|
+
warn: chalk213.yellow,
|
|
33335
|
+
over: chalk213.red
|
|
33239
33336
|
};
|
|
33240
33337
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
33241
33338
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -33331,7 +33428,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
33331
33428
|
}
|
|
33332
33429
|
|
|
33333
33430
|
// src/commands/statusLine.ts
|
|
33334
|
-
|
|
33431
|
+
chalk214.level = 3;
|
|
33335
33432
|
function formatNumber(num) {
|
|
33336
33433
|
return num.toLocaleString("en-US");
|
|
33337
33434
|
}
|
|
@@ -33339,9 +33436,9 @@ function colorizePercent(pct) {
|
|
|
33339
33436
|
const label2 = `${Math.round(pct)}%`;
|
|
33340
33437
|
switch (contextLevel(pct)) {
|
|
33341
33438
|
case "red":
|
|
33342
|
-
return
|
|
33439
|
+
return chalk214.red(label2);
|
|
33343
33440
|
case "yellow":
|
|
33344
|
-
return
|
|
33441
|
+
return chalk214.yellow(label2);
|
|
33345
33442
|
default:
|
|
33346
33443
|
return label2;
|
|
33347
33444
|
}
|
|
@@ -33354,7 +33451,7 @@ async function statusLine() {
|
|
|
33354
33451
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
33355
33452
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
33356
33453
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
33357
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
33454
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk214.cyan(branch2)} | ` : "";
|
|
33358
33455
|
console.log(
|
|
33359
33456
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
33360
33457
|
);
|
|
@@ -33375,7 +33472,7 @@ import { fileURLToPath as fileURLToPath9 } from "url";
|
|
|
33375
33472
|
// src/commands/sync/syncClaudeMd.ts
|
|
33376
33473
|
import * as fs42 from "fs";
|
|
33377
33474
|
import * as path61 from "path";
|
|
33378
|
-
import
|
|
33475
|
+
import chalk215 from "chalk";
|
|
33379
33476
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
33380
33477
|
const source = path61.join(claudeDir, "CLAUDE.md");
|
|
33381
33478
|
const target = path61.join(targetBase, "CLAUDE.md");
|
|
@@ -33384,14 +33481,14 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
33384
33481
|
const targetContent = fs42.readFileSync(target, "utf8");
|
|
33385
33482
|
if (sourceContent !== targetContent) {
|
|
33386
33483
|
console.log(
|
|
33387
|
-
|
|
33484
|
+
chalk215.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
33388
33485
|
);
|
|
33389
33486
|
console.log();
|
|
33390
33487
|
printDiff(targetContent, sourceContent);
|
|
33391
33488
|
if (!options2?.yes) {
|
|
33392
33489
|
printAutoConfirmHint();
|
|
33393
33490
|
const confirm = await promptConfirm(
|
|
33394
|
-
|
|
33491
|
+
chalk215.red("Overwrite existing CLAUDE.md?"),
|
|
33395
33492
|
false
|
|
33396
33493
|
);
|
|
33397
33494
|
if (!confirm) {
|
|
@@ -33586,7 +33683,7 @@ function syncPi(claudeDir) {
|
|
|
33586
33683
|
// src/commands/sync/syncSettings.ts
|
|
33587
33684
|
import * as fs47 from "fs";
|
|
33588
33685
|
import * as path68 from "path";
|
|
33589
|
-
import
|
|
33686
|
+
import chalk216 from "chalk";
|
|
33590
33687
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
33591
33688
|
const source = path68.join(claudeDir, "settings.json");
|
|
33592
33689
|
const target = path68.join(targetBase, "settings.json");
|
|
@@ -33605,7 +33702,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
33605
33702
|
if (mergedContent !== normalizedTarget) {
|
|
33606
33703
|
if (!options2?.yes) {
|
|
33607
33704
|
console.log(
|
|
33608
|
-
|
|
33705
|
+
chalk216.yellow(
|
|
33609
33706
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
33610
33707
|
)
|
|
33611
33708
|
);
|
|
@@ -33613,7 +33710,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
33613
33710
|
printDiff(targetContent, mergedContent);
|
|
33614
33711
|
printAutoConfirmHint();
|
|
33615
33712
|
const confirm = await promptConfirm(
|
|
33616
|
-
|
|
33713
|
+
chalk216.red("Overwrite existing settings.json?"),
|
|
33617
33714
|
false
|
|
33618
33715
|
);
|
|
33619
33716
|
if (!confirm) {
|
|
@@ -33712,10 +33809,10 @@ async function update2() {
|
|
|
33712
33809
|
}
|
|
33713
33810
|
|
|
33714
33811
|
// src/reportCliError.ts
|
|
33715
|
-
import
|
|
33812
|
+
import chalk217 from "chalk";
|
|
33716
33813
|
function reportCliError(error) {
|
|
33717
33814
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError) {
|
|
33718
|
-
console.error(
|
|
33815
|
+
console.error(chalk217.red(error.message));
|
|
33719
33816
|
} else {
|
|
33720
33817
|
console.error(error);
|
|
33721
33818
|
}
|