@staff0rd/assist 0.318.4 → 0.318.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +580 -583
- 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.318.
|
|
9
|
+
version: "0.318.6",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -3897,7 +3897,12 @@ var hooksSettings = {
|
|
|
3897
3897
|
UserPromptSubmit: on(RUNNING),
|
|
3898
3898
|
PreToolUse: on(RUNNING),
|
|
3899
3899
|
Stop: on(WAITING),
|
|
3900
|
-
Notification: on(WAITING)
|
|
3900
|
+
Notification: on(WAITING),
|
|
3901
|
+
/* why: a tool/plan approval prompt appears mid-turn, after PreToolUse has
|
|
3902
|
+
* already set running; PermissionRequest fires when the agent blocks on
|
|
3903
|
+
* that decision, so the card shows waiting rather than staying running while
|
|
3904
|
+
* it is genuinely awaiting the user (#449). */
|
|
3905
|
+
PermissionRequest: on(WAITING)
|
|
3901
3906
|
}
|
|
3902
3907
|
};
|
|
3903
3908
|
function ensureHooksSettings() {
|
|
@@ -4604,51 +4609,43 @@ Failed to launch Claude for ${context}: ${message}`)
|
|
|
4604
4609
|
}
|
|
4605
4610
|
}
|
|
4606
4611
|
|
|
4607
|
-
// src/
|
|
4608
|
-
import
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
itemId: z4.number().optional(),
|
|
4616
|
-
itemName: z4.string().optional(),
|
|
4617
|
-
phase: z4.number().optional(),
|
|
4618
|
-
phaseName: z4.string().optional(),
|
|
4619
|
-
totalPhases: z4.number().optional(),
|
|
4620
|
-
claudeSessionId: z4.string().optional(),
|
|
4621
|
-
startedAt: z4.number()
|
|
4622
|
-
});
|
|
4623
|
-
function activityPath(sessionId) {
|
|
4624
|
-
return join18(homedir7(), ".assist", "activity", `activity-${sessionId}.json`);
|
|
4625
|
-
}
|
|
4626
|
-
function emitActivity(activity2) {
|
|
4627
|
-
const sessionId = process.env.ASSIST_ACTIVITY_ID;
|
|
4628
|
-
if (!sessionId) return;
|
|
4629
|
-
const path57 = activityPath(sessionId);
|
|
4630
|
-
mkdirSync7(dirname14(path57), { recursive: true });
|
|
4631
|
-
writeFileSync17(path57, JSON.stringify({ ...activity2, startedAt: Date.now() }));
|
|
4612
|
+
// src/commands/sessions/daemon/connectToDaemon.ts
|
|
4613
|
+
import * as net from "net";
|
|
4614
|
+
function connectToDaemon() {
|
|
4615
|
+
return new Promise((resolve17, reject) => {
|
|
4616
|
+
const socket = net.connect(daemonPaths.socket);
|
|
4617
|
+
socket.once("connect", () => resolve17(socket));
|
|
4618
|
+
socket.once("error", reject);
|
|
4619
|
+
});
|
|
4632
4620
|
}
|
|
4633
|
-
function
|
|
4621
|
+
async function isDaemonRunning() {
|
|
4634
4622
|
try {
|
|
4635
|
-
|
|
4623
|
+
(await connectToDaemon()).destroy();
|
|
4624
|
+
return true;
|
|
4636
4625
|
} catch {
|
|
4637
|
-
return
|
|
4626
|
+
return false;
|
|
4638
4627
|
}
|
|
4639
4628
|
}
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4629
|
+
|
|
4630
|
+
// src/commands/sessions/daemon/sendToDaemon.ts
|
|
4631
|
+
async function sendToDaemon(message) {
|
|
4632
|
+
const socket = await connectToDaemon();
|
|
4633
|
+
const timer = setTimeout(() => socket.destroy(), 500);
|
|
4634
|
+
socket.on("error", () => {
|
|
4635
|
+
});
|
|
4636
|
+
socket.write(`${JSON.stringify(message)}
|
|
4637
|
+
`, () => {
|
|
4638
|
+
clearTimeout(timer);
|
|
4639
|
+
socket.end();
|
|
4640
|
+
});
|
|
4648
4641
|
}
|
|
4649
|
-
|
|
4642
|
+
|
|
4643
|
+
// src/commands/sessions/setSessionStatus.ts
|
|
4644
|
+
async function setSessionStatus(status2) {
|
|
4645
|
+
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
4646
|
+
if (!sessionId) return;
|
|
4650
4647
|
try {
|
|
4651
|
-
|
|
4648
|
+
await sendToDaemon({ type: "set-status", sessionId, status: status2 });
|
|
4652
4649
|
} catch {
|
|
4653
4650
|
}
|
|
4654
4651
|
}
|
|
@@ -4762,6 +4759,69 @@ function buildResumePrompt() {
|
|
|
4762
4759
|
return "A restart interrupted this conversation. Continue from where you left off.";
|
|
4763
4760
|
}
|
|
4764
4761
|
|
|
4762
|
+
// src/shared/emitActivity.ts
|
|
4763
|
+
import { mkdirSync as mkdirSync7, readFileSync as readFileSync14, rmSync, writeFileSync as writeFileSync17 } from "fs";
|
|
4764
|
+
import { homedir as homedir7 } from "os";
|
|
4765
|
+
import { dirname as dirname14, join as join18 } from "path";
|
|
4766
|
+
import { z as z4 } from "zod";
|
|
4767
|
+
var activitySchema = z4.object({
|
|
4768
|
+
kind: z4.enum(["command", "backlog"]),
|
|
4769
|
+
name: z4.string().optional(),
|
|
4770
|
+
itemId: z4.number().optional(),
|
|
4771
|
+
itemName: z4.string().optional(),
|
|
4772
|
+
phase: z4.number().optional(),
|
|
4773
|
+
phaseName: z4.string().optional(),
|
|
4774
|
+
totalPhases: z4.number().optional(),
|
|
4775
|
+
claudeSessionId: z4.string().optional(),
|
|
4776
|
+
startedAt: z4.number()
|
|
4777
|
+
});
|
|
4778
|
+
function activityPath(sessionId) {
|
|
4779
|
+
return join18(homedir7(), ".assist", "activity", `activity-${sessionId}.json`);
|
|
4780
|
+
}
|
|
4781
|
+
function emitActivity(activity2) {
|
|
4782
|
+
const sessionId = process.env.ASSIST_ACTIVITY_ID;
|
|
4783
|
+
if (!sessionId) return;
|
|
4784
|
+
const path57 = activityPath(sessionId);
|
|
4785
|
+
mkdirSync7(dirname14(path57), { recursive: true });
|
|
4786
|
+
writeFileSync17(path57, JSON.stringify({ ...activity2, startedAt: Date.now() }));
|
|
4787
|
+
}
|
|
4788
|
+
function readActivity(path57) {
|
|
4789
|
+
try {
|
|
4790
|
+
return JSON.parse(readFileSync14(path57, "utf8"));
|
|
4791
|
+
} catch {
|
|
4792
|
+
return void 0;
|
|
4793
|
+
}
|
|
4794
|
+
}
|
|
4795
|
+
function reconcileActivity(sessionId, activity2) {
|
|
4796
|
+
if (!activity2) {
|
|
4797
|
+
removeActivity(sessionId);
|
|
4798
|
+
return;
|
|
4799
|
+
}
|
|
4800
|
+
const path57 = activityPath(sessionId);
|
|
4801
|
+
mkdirSync7(dirname14(path57), { recursive: true });
|
|
4802
|
+
writeFileSync17(path57, JSON.stringify(activity2));
|
|
4803
|
+
}
|
|
4804
|
+
function removeActivity(sessionId) {
|
|
4805
|
+
try {
|
|
4806
|
+
rmSync(activityPath(sessionId));
|
|
4807
|
+
} catch {
|
|
4808
|
+
}
|
|
4809
|
+
}
|
|
4810
|
+
|
|
4811
|
+
// src/commands/backlog/reportPhaseActivity.ts
|
|
4812
|
+
function reportPhaseActivity(item, phaseNumber, totalPhases, phase, claudeSessionId) {
|
|
4813
|
+
const isReviewPhase = phaseNumber >= totalPhases;
|
|
4814
|
+
emitActivity({
|
|
4815
|
+
kind: "backlog",
|
|
4816
|
+
itemId: item.id,
|
|
4817
|
+
itemName: item.name,
|
|
4818
|
+
phase: phaseNumber,
|
|
4819
|
+
phaseName: isReviewPhase ? REVIEW_PHASE_NAME : phase.name,
|
|
4820
|
+
totalPhases,
|
|
4821
|
+
claudeSessionId
|
|
4822
|
+
});
|
|
4823
|
+
}
|
|
4824
|
+
|
|
4765
4825
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
4766
4826
|
import { existsSync as existsSync22, unlinkSync as unlinkSync4 } from "fs";
|
|
4767
4827
|
import chalk40 from "chalk";
|
|
@@ -4875,16 +4935,7 @@ async function executePhase(item, phaseIndex, phases, spawnOptions, totalPhases
|
|
|
4875
4935
|
const resumeSessionId = spawnOptions?.resumeSessionId;
|
|
4876
4936
|
const claudeSessionId = resumeSessionId ?? randomUUID();
|
|
4877
4937
|
process.env.ASSIST_SESSION_ID ??= String(process.pid);
|
|
4878
|
-
|
|
4879
|
-
emitActivity({
|
|
4880
|
-
kind: "backlog",
|
|
4881
|
-
itemId: item.id,
|
|
4882
|
-
itemName: item.name,
|
|
4883
|
-
phase: phaseNumber,
|
|
4884
|
-
phaseName: isReviewPhase ? REVIEW_PHASE_NAME : phase.name,
|
|
4885
|
-
totalPhases,
|
|
4886
|
-
claudeSessionId
|
|
4887
|
-
});
|
|
4938
|
+
reportPhaseActivity(item, phaseNumber, totalPhases, phase, claudeSessionId);
|
|
4888
4939
|
const { child, done: done2 } = spawnClaude(
|
|
4889
4940
|
resumeSessionId ? buildResumePrompt() : buildPhasePrompt(item, phaseNumber, phase),
|
|
4890
4941
|
resumeSessionId ? spawnOptions : { ...spawnOptions, sessionId: claudeSessionId }
|
|
@@ -4896,6 +4947,7 @@ async function executePhase(item, phaseIndex, phases, spawnOptions, totalPhases
|
|
|
4896
4947
|
);
|
|
4897
4948
|
stopWatching();
|
|
4898
4949
|
if (!launched) return -1;
|
|
4950
|
+
void setSessionStatus("running");
|
|
4899
4951
|
return await resolvePhaseResult(phaseIndex, item.id);
|
|
4900
4952
|
}
|
|
4901
4953
|
|
|
@@ -5262,6 +5314,7 @@ function printComments(item) {
|
|
|
5262
5314
|
}
|
|
5263
5315
|
|
|
5264
5316
|
// src/commands/sessions/web/index.ts
|
|
5317
|
+
import chalk55 from "chalk";
|
|
5265
5318
|
import { WebSocketServer } from "ws";
|
|
5266
5319
|
|
|
5267
5320
|
// src/shared/getInstallDir.ts
|
|
@@ -5418,26 +5471,6 @@ import {
|
|
|
5418
5471
|
unlinkSync as unlinkSync5,
|
|
5419
5472
|
writeSync
|
|
5420
5473
|
} from "fs";
|
|
5421
|
-
|
|
5422
|
-
// src/commands/sessions/daemon/connectToDaemon.ts
|
|
5423
|
-
import * as net from "net";
|
|
5424
|
-
function connectToDaemon() {
|
|
5425
|
-
return new Promise((resolve17, reject) => {
|
|
5426
|
-
const socket = net.connect(daemonPaths.socket);
|
|
5427
|
-
socket.once("connect", () => resolve17(socket));
|
|
5428
|
-
socket.once("error", reject);
|
|
5429
|
-
});
|
|
5430
|
-
}
|
|
5431
|
-
async function isDaemonRunning() {
|
|
5432
|
-
try {
|
|
5433
|
-
(await connectToDaemon()).destroy();
|
|
5434
|
-
return true;
|
|
5435
|
-
} catch {
|
|
5436
|
-
return false;
|
|
5437
|
-
}
|
|
5438
|
-
}
|
|
5439
|
-
|
|
5440
|
-
// src/commands/sessions/daemon/ensureDaemonRunning.ts
|
|
5441
5474
|
var SPAWN_TIMEOUT_MS = 1e4;
|
|
5442
5475
|
var RETRY_DELAY_MS = 200;
|
|
5443
5476
|
var STALE_LOCK_MS = SPAWN_TIMEOUT_MS + 5e3;
|
|
@@ -6677,7 +6710,6 @@ function installRestartMenu(options2 = {}) {
|
|
|
6677
6710
|
|
|
6678
6711
|
// src/commands/sessions/web/index.ts
|
|
6679
6712
|
async function web(options2) {
|
|
6680
|
-
await ensureDaemonRunning("web server start");
|
|
6681
6713
|
const port = Number.parseInt(options2.port, 10);
|
|
6682
6714
|
const server = startWebServer(
|
|
6683
6715
|
"Assist",
|
|
@@ -6702,6 +6734,13 @@ async function web(options2) {
|
|
|
6702
6734
|
}
|
|
6703
6735
|
});
|
|
6704
6736
|
installRestartMenu();
|
|
6737
|
+
void ensureDaemonRunning("web server start").catch((error) => {
|
|
6738
|
+
console.error(
|
|
6739
|
+
chalk55.yellow(
|
|
6740
|
+
`sessions daemon not ready yet, will retry on connection: ${error instanceof Error ? error.message : String(error)}`
|
|
6741
|
+
)
|
|
6742
|
+
);
|
|
6743
|
+
});
|
|
6705
6744
|
}
|
|
6706
6745
|
|
|
6707
6746
|
// src/commands/backlog/web/index.ts
|
|
@@ -6714,26 +6753,26 @@ async function web2(options2) {
|
|
|
6714
6753
|
}
|
|
6715
6754
|
|
|
6716
6755
|
// src/commands/backlog/comment/index.ts
|
|
6717
|
-
import
|
|
6756
|
+
import chalk56 from "chalk";
|
|
6718
6757
|
async function comment(id2, text6) {
|
|
6719
6758
|
const found = await findOneItem(id2);
|
|
6720
6759
|
if (!found) process.exit(1);
|
|
6721
6760
|
await appendComment(found.orm, found.item.id, text6);
|
|
6722
|
-
console.log(
|
|
6761
|
+
console.log(chalk56.green(`Comment added to item #${id2}.`));
|
|
6723
6762
|
}
|
|
6724
6763
|
|
|
6725
6764
|
// src/commands/backlog/comments/index.ts
|
|
6726
|
-
import
|
|
6765
|
+
import chalk57 from "chalk";
|
|
6727
6766
|
async function comments2(id2) {
|
|
6728
6767
|
const found = await findOneItem(id2);
|
|
6729
6768
|
if (!found) process.exit(1);
|
|
6730
6769
|
const { item } = found;
|
|
6731
6770
|
const entries = item.comments ?? [];
|
|
6732
6771
|
if (entries.length === 0) {
|
|
6733
|
-
console.log(
|
|
6772
|
+
console.log(chalk57.dim(`No comments on item #${id2}.`));
|
|
6734
6773
|
return;
|
|
6735
6774
|
}
|
|
6736
|
-
console.log(
|
|
6775
|
+
console.log(chalk57.bold(`Comments for #${id2}: ${item.name}
|
|
6737
6776
|
`));
|
|
6738
6777
|
for (const entry of entries) {
|
|
6739
6778
|
console.log(`${formatComment(entry)}
|
|
@@ -6742,7 +6781,7 @@ async function comments2(id2) {
|
|
|
6742
6781
|
}
|
|
6743
6782
|
|
|
6744
6783
|
// src/commands/backlog/delete-comment/index.ts
|
|
6745
|
-
import
|
|
6784
|
+
import chalk58 from "chalk";
|
|
6746
6785
|
async function deleteCommentCmd(id2, commentId) {
|
|
6747
6786
|
const found = await findOneItem(id2);
|
|
6748
6787
|
if (!found) process.exit(1);
|
|
@@ -6754,16 +6793,16 @@ async function deleteCommentCmd(id2, commentId) {
|
|
|
6754
6793
|
switch (outcome) {
|
|
6755
6794
|
case "deleted":
|
|
6756
6795
|
console.log(
|
|
6757
|
-
|
|
6796
|
+
chalk58.green(`Comment #${commentId} deleted from item #${id2}.`)
|
|
6758
6797
|
);
|
|
6759
6798
|
break;
|
|
6760
6799
|
case "not-found":
|
|
6761
|
-
console.log(
|
|
6800
|
+
console.log(chalk58.red(`Comment #${commentId} not found on item #${id2}.`));
|
|
6762
6801
|
process.exit(1);
|
|
6763
6802
|
break;
|
|
6764
6803
|
case "is-summary":
|
|
6765
6804
|
console.log(
|
|
6766
|
-
|
|
6805
|
+
chalk58.red(
|
|
6767
6806
|
`Comment #${commentId} is a phase summary and cannot be deleted.`
|
|
6768
6807
|
)
|
|
6769
6808
|
);
|
|
@@ -6788,7 +6827,7 @@ function registerExportCommand(cmd) {
|
|
|
6788
6827
|
|
|
6789
6828
|
// src/commands/backlog/import/index.ts
|
|
6790
6829
|
import { readFile } from "fs/promises";
|
|
6791
|
-
import
|
|
6830
|
+
import chalk60 from "chalk";
|
|
6792
6831
|
|
|
6793
6832
|
// src/commands/backlog/dump/countCopyRows.ts
|
|
6794
6833
|
function countCopyRows(data) {
|
|
@@ -6860,7 +6899,7 @@ function validateDump({ header, sections }) {
|
|
|
6860
6899
|
}
|
|
6861
6900
|
|
|
6862
6901
|
// src/commands/backlog/import/confirmReplace.ts
|
|
6863
|
-
import
|
|
6902
|
+
import chalk59 from "chalk";
|
|
6864
6903
|
async function countRows(client, table) {
|
|
6865
6904
|
const { rows } = await client.query(
|
|
6866
6905
|
`SELECT count(*)::int AS n FROM ${table}`
|
|
@@ -6871,7 +6910,7 @@ function printSummary(tables, current, incoming) {
|
|
|
6871
6910
|
const lines = tables.map(
|
|
6872
6911
|
(t, i) => ` ${t.name}: ${current[i]} \u2192 ${incoming[i]} rows`
|
|
6873
6912
|
);
|
|
6874
|
-
console.error(
|
|
6913
|
+
console.error(chalk59.bold("\nThis will REPLACE all backlog data:"));
|
|
6875
6914
|
console.error(`${lines.join("\n")}
|
|
6876
6915
|
`);
|
|
6877
6916
|
}
|
|
@@ -6973,13 +7012,13 @@ async function importBacklog(file, options2 = {}) {
|
|
|
6973
7012
|
);
|
|
6974
7013
|
await withDbClient(async (client) => {
|
|
6975
7014
|
if (!options2.yes && !await confirmReplace(client, tables, incoming, !file)) {
|
|
6976
|
-
console.error(
|
|
7015
|
+
console.error(chalk60.yellow("Import cancelled; no changes made."));
|
|
6977
7016
|
return;
|
|
6978
7017
|
}
|
|
6979
7018
|
await restore(client, parsed);
|
|
6980
7019
|
const total = incoming.reduce((sum, n) => sum + n, 0);
|
|
6981
7020
|
console.error(
|
|
6982
|
-
|
|
7021
|
+
chalk60.green(
|
|
6983
7022
|
`Imported backlog: ${total} rows restored across ${tables.length} tables.`
|
|
6984
7023
|
)
|
|
6985
7024
|
);
|
|
@@ -6996,7 +7035,7 @@ function registerImportCommand(cmd) {
|
|
|
6996
7035
|
}
|
|
6997
7036
|
|
|
6998
7037
|
// src/commands/backlog/add/index.ts
|
|
6999
|
-
import
|
|
7038
|
+
import chalk61 from "chalk";
|
|
7000
7039
|
|
|
7001
7040
|
// src/commands/backlog/add/shared.ts
|
|
7002
7041
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
@@ -7087,11 +7126,11 @@ async function add(options2) {
|
|
|
7087
7126
|
},
|
|
7088
7127
|
getOrigin()
|
|
7089
7128
|
);
|
|
7090
|
-
console.log(
|
|
7129
|
+
console.log(chalk61.green(`Added item #${id2}: ${name}`));
|
|
7091
7130
|
}
|
|
7092
7131
|
|
|
7093
7132
|
// src/commands/backlog/addPhase.ts
|
|
7094
|
-
import
|
|
7133
|
+
import chalk63 from "chalk";
|
|
7095
7134
|
|
|
7096
7135
|
// src/commands/backlog/insertPhaseAt.ts
|
|
7097
7136
|
import { count, eq as eq18 } from "drizzle-orm";
|
|
@@ -7124,7 +7163,7 @@ async function insertPhaseAt(orm, itemId, phaseIdx, name, tasks, manualChecks, c
|
|
|
7124
7163
|
}
|
|
7125
7164
|
|
|
7126
7165
|
// src/commands/backlog/resolveInsertPosition.ts
|
|
7127
|
-
import
|
|
7166
|
+
import chalk62 from "chalk";
|
|
7128
7167
|
import { count as count2, eq as eq19 } from "drizzle-orm";
|
|
7129
7168
|
async function resolveInsertPosition(orm, itemId, position) {
|
|
7130
7169
|
const [row] = await orm.select({ cnt: count2() }).from(planPhases).where(eq19(planPhases.itemId, itemId));
|
|
@@ -7133,7 +7172,7 @@ async function resolveInsertPosition(orm, itemId, position) {
|
|
|
7133
7172
|
const pos = Number.parseInt(position, 10);
|
|
7134
7173
|
if (pos < 1 || pos > phaseCount + 1) {
|
|
7135
7174
|
console.log(
|
|
7136
|
-
|
|
7175
|
+
chalk62.red(
|
|
7137
7176
|
`Position ${pos} is out of range. Must be between 1 and ${phaseCount + 1}.`
|
|
7138
7177
|
)
|
|
7139
7178
|
);
|
|
@@ -7154,7 +7193,7 @@ async function addPhase(id2, name, options2) {
|
|
|
7154
7193
|
if (!found) return;
|
|
7155
7194
|
const tasks = options2.task ?? [];
|
|
7156
7195
|
if (tasks.length === 0) {
|
|
7157
|
-
console.log(
|
|
7196
|
+
console.log(chalk63.red("At least one --task is required."));
|
|
7158
7197
|
process.exitCode = 1;
|
|
7159
7198
|
return;
|
|
7160
7199
|
}
|
|
@@ -7173,14 +7212,14 @@ async function addPhase(id2, name, options2) {
|
|
|
7173
7212
|
);
|
|
7174
7213
|
const verb = options2.position !== void 0 ? "Inserted" : "Added";
|
|
7175
7214
|
console.log(
|
|
7176
|
-
|
|
7215
|
+
chalk63.green(
|
|
7177
7216
|
`${verb} phase ${phaseIdx + 1} "${name}" to item #${itemId} with ${tasks.length} task(s).`
|
|
7178
7217
|
)
|
|
7179
7218
|
);
|
|
7180
7219
|
}
|
|
7181
7220
|
|
|
7182
7221
|
// src/commands/backlog/list/index.ts
|
|
7183
|
-
import
|
|
7222
|
+
import chalk64 from "chalk";
|
|
7184
7223
|
|
|
7185
7224
|
// src/commands/backlog/originDisplayName.ts
|
|
7186
7225
|
function originDisplayName(origin) {
|
|
@@ -7232,7 +7271,7 @@ async function list2(options2) {
|
|
|
7232
7271
|
const allItems = await loadBacklog(options2.allRepos);
|
|
7233
7272
|
const items2 = filterItems(allItems, options2);
|
|
7234
7273
|
if (items2.length === 0) {
|
|
7235
|
-
console.log(
|
|
7274
|
+
console.log(chalk64.dim("Backlog is empty."));
|
|
7236
7275
|
return;
|
|
7237
7276
|
}
|
|
7238
7277
|
const labels = originDisplayLabels(
|
|
@@ -7241,9 +7280,9 @@ async function list2(options2) {
|
|
|
7241
7280
|
const repoNameOf = (item) => item.origin ? labels.get(item.origin) ?? "" : "";
|
|
7242
7281
|
const prefixWidth = options2.allRepos ? Math.max(0, ...items2.map((i) => repoNameOf(i).length)) : 0;
|
|
7243
7282
|
for (const item of items2) {
|
|
7244
|
-
const repoPrefix = options2.allRepos ? `${
|
|
7283
|
+
const repoPrefix = options2.allRepos ? `${chalk64.dim(repoNameOf(item).padEnd(prefixWidth))} ` : "";
|
|
7245
7284
|
console.log(
|
|
7246
|
-
`${repoPrefix}${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
7285
|
+
`${repoPrefix}${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk64.dim(`#${item.id}`)} ${starMarker(item)}${item.name}${phaseLabel(item)}${dependencyLabel(item, allItems)}`
|
|
7247
7286
|
);
|
|
7248
7287
|
if (options2.verbose) {
|
|
7249
7288
|
printVerboseDetails(item);
|
|
@@ -7269,7 +7308,7 @@ function registerItemCommands(cmd) {
|
|
|
7269
7308
|
}
|
|
7270
7309
|
|
|
7271
7310
|
// src/commands/backlog/link.ts
|
|
7272
|
-
import
|
|
7311
|
+
import chalk66 from "chalk";
|
|
7273
7312
|
|
|
7274
7313
|
// src/commands/backlog/hasCycle.ts
|
|
7275
7314
|
function hasCycle(adjacency, fromId, toId) {
|
|
@@ -7301,14 +7340,14 @@ async function loadDependencyGraph(orm) {
|
|
|
7301
7340
|
}
|
|
7302
7341
|
|
|
7303
7342
|
// src/commands/backlog/validateLinkTarget.ts
|
|
7304
|
-
import
|
|
7343
|
+
import chalk65 from "chalk";
|
|
7305
7344
|
function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
7306
7345
|
const duplicate = (fromItem.links ?? []).some(
|
|
7307
7346
|
(l) => l.targetId === toNum && l.type === linkType
|
|
7308
7347
|
);
|
|
7309
7348
|
if (duplicate) {
|
|
7310
7349
|
console.log(
|
|
7311
|
-
|
|
7350
|
+
chalk65.yellow(`Link already exists: #${fromNum} ${linkType} #${toNum}`)
|
|
7312
7351
|
);
|
|
7313
7352
|
return false;
|
|
7314
7353
|
}
|
|
@@ -7317,7 +7356,7 @@ function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
|
7317
7356
|
|
|
7318
7357
|
// src/commands/backlog/link.ts
|
|
7319
7358
|
function fail2(message) {
|
|
7320
|
-
console.log(
|
|
7359
|
+
console.log(chalk66.red(message));
|
|
7321
7360
|
return void 0;
|
|
7322
7361
|
}
|
|
7323
7362
|
function parseLinkType(type) {
|
|
@@ -7347,12 +7386,12 @@ async function link(fromId, toId, opts) {
|
|
|
7347
7386
|
if (await createsCycle(orm, linkType, fromNum, toNum)) return;
|
|
7348
7387
|
await orm.insert(links).values({ itemId: fromNum, type: linkType, targetId: toNum });
|
|
7349
7388
|
console.log(
|
|
7350
|
-
|
|
7389
|
+
chalk66.green(`Linked #${fromNum} ${linkType} #${toNum} (${toItem.name})`)
|
|
7351
7390
|
);
|
|
7352
7391
|
}
|
|
7353
7392
|
|
|
7354
7393
|
// src/commands/backlog/unlink.ts
|
|
7355
|
-
import
|
|
7394
|
+
import chalk67 from "chalk";
|
|
7356
7395
|
import { and as and6, eq as eq21 } from "drizzle-orm";
|
|
7357
7396
|
async function unlink(fromId, toId) {
|
|
7358
7397
|
const fromNum = Number.parseInt(fromId, 10);
|
|
@@ -7360,19 +7399,19 @@ async function unlink(fromId, toId) {
|
|
|
7360
7399
|
const { orm } = await getReady();
|
|
7361
7400
|
const fromItem = await loadItem(orm, fromNum);
|
|
7362
7401
|
if (!fromItem) {
|
|
7363
|
-
console.log(
|
|
7402
|
+
console.log(chalk67.red(`Item #${fromId} not found.`));
|
|
7364
7403
|
return;
|
|
7365
7404
|
}
|
|
7366
7405
|
if (!fromItem.links || fromItem.links.length === 0) {
|
|
7367
|
-
console.log(
|
|
7406
|
+
console.log(chalk67.yellow(`No links found on item #${fromId}.`));
|
|
7368
7407
|
return;
|
|
7369
7408
|
}
|
|
7370
7409
|
if (!fromItem.links.some((l) => l.targetId === toNum)) {
|
|
7371
|
-
console.log(
|
|
7410
|
+
console.log(chalk67.yellow(`No link from #${fromId} to #${toId} found.`));
|
|
7372
7411
|
return;
|
|
7373
7412
|
}
|
|
7374
7413
|
await orm.delete(links).where(and6(eq21(links.itemId, fromNum), eq21(links.targetId, toNum)));
|
|
7375
|
-
console.log(
|
|
7414
|
+
console.log(chalk67.green(`Removed link from #${fromId} to #${toId}.`));
|
|
7376
7415
|
}
|
|
7377
7416
|
|
|
7378
7417
|
// src/commands/backlog/registerLinkCommands.ts
|
|
@@ -7386,17 +7425,17 @@ function registerLinkCommands(cmd) {
|
|
|
7386
7425
|
}
|
|
7387
7426
|
|
|
7388
7427
|
// src/commands/backlog/move-repo/index.ts
|
|
7389
|
-
import
|
|
7428
|
+
import chalk69 from "chalk";
|
|
7390
7429
|
import { eq as eq23 } from "drizzle-orm";
|
|
7391
7430
|
|
|
7392
7431
|
// src/commands/backlog/move-repo/confirmMove.ts
|
|
7393
|
-
import
|
|
7432
|
+
import chalk68 from "chalk";
|
|
7394
7433
|
function pluralItems(n) {
|
|
7395
7434
|
return `${n} item${n === 1 ? "" : "s"}`;
|
|
7396
7435
|
}
|
|
7397
7436
|
async function confirmMove(cnt, oldOrigin, newOrigin) {
|
|
7398
7437
|
console.log(
|
|
7399
|
-
`${pluralItems(cnt)}: ${
|
|
7438
|
+
`${pluralItems(cnt)}: ${chalk68.cyan(oldOrigin)} \u2192 ${chalk68.cyan(newOrigin)}`
|
|
7400
7439
|
);
|
|
7401
7440
|
return promptConfirm(`Retag ${pluralItems(cnt)}?`);
|
|
7402
7441
|
}
|
|
@@ -7428,7 +7467,7 @@ Pass the full origin.`
|
|
|
7428
7467
|
|
|
7429
7468
|
// src/commands/backlog/move-repo/index.ts
|
|
7430
7469
|
function fail3(message) {
|
|
7431
|
-
console.log(
|
|
7470
|
+
console.log(chalk69.red(message));
|
|
7432
7471
|
process.exitCode = 1;
|
|
7433
7472
|
}
|
|
7434
7473
|
async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
@@ -7444,12 +7483,12 @@ async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
|
7444
7483
|
}
|
|
7445
7484
|
const cnt = await countByOrigin(orm, oldOrigin);
|
|
7446
7485
|
if (!options2.yes && !await confirmMove(cnt, oldOrigin, newOrigin)) {
|
|
7447
|
-
console.log(
|
|
7486
|
+
console.log(chalk69.yellow("Move cancelled; no changes made."));
|
|
7448
7487
|
return;
|
|
7449
7488
|
}
|
|
7450
7489
|
await orm.update(items).set({ origin: newOrigin }).where(eq23(items.origin, oldOrigin));
|
|
7451
7490
|
console.log(
|
|
7452
|
-
|
|
7491
|
+
chalk69.green(
|
|
7453
7492
|
`Moved ${pluralItems(cnt)} from "${oldOrigin}" to "${newOrigin}".`
|
|
7454
7493
|
)
|
|
7455
7494
|
);
|
|
@@ -7478,14 +7517,14 @@ function registerPlanCommands(cmd) {
|
|
|
7478
7517
|
}
|
|
7479
7518
|
|
|
7480
7519
|
// src/commands/backlog/refine.ts
|
|
7481
|
-
import
|
|
7520
|
+
import chalk72 from "chalk";
|
|
7482
7521
|
import enquirer7 from "enquirer";
|
|
7483
7522
|
|
|
7484
7523
|
// src/commands/backlog/launchMode.ts
|
|
7485
7524
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
7486
7525
|
|
|
7487
7526
|
// src/commands/backlog/handleLaunchSignal.ts
|
|
7488
|
-
import
|
|
7527
|
+
import chalk71 from "chalk";
|
|
7489
7528
|
|
|
7490
7529
|
// src/commands/backlog/surfaceCreatedItem.ts
|
|
7491
7530
|
async function surfaceCreatedItem(slashCommand, id2) {
|
|
@@ -7503,31 +7542,31 @@ async function surfaceCreatedItem(slashCommand, id2) {
|
|
|
7503
7542
|
}
|
|
7504
7543
|
|
|
7505
7544
|
// src/commands/backlog/tryRunById.ts
|
|
7506
|
-
import
|
|
7545
|
+
import chalk70 from "chalk";
|
|
7507
7546
|
async function tryRunById(id2, options2) {
|
|
7508
7547
|
const numericId = Number.parseInt(id2, 10);
|
|
7509
7548
|
const { orm } = await getReady();
|
|
7510
7549
|
const item = Number.isNaN(numericId) ? void 0 : await loadItem(orm, numericId);
|
|
7511
7550
|
if (!item) {
|
|
7512
|
-
console.log(
|
|
7551
|
+
console.log(chalk70.red(`Item #${id2} not found.`));
|
|
7513
7552
|
return false;
|
|
7514
7553
|
}
|
|
7515
7554
|
if (item.status === "done") {
|
|
7516
|
-
console.log(
|
|
7555
|
+
console.log(chalk70.red(`Item #${id2} is already done.`));
|
|
7517
7556
|
return false;
|
|
7518
7557
|
}
|
|
7519
7558
|
if (item.status === "wontdo") {
|
|
7520
|
-
console.log(
|
|
7559
|
+
console.log(chalk70.red(`Item #${id2} is marked won't do.`));
|
|
7521
7560
|
return false;
|
|
7522
7561
|
}
|
|
7523
7562
|
const hasDeps = (item.links ?? []).some((l) => l.type === "depends-on");
|
|
7524
7563
|
if (hasDeps && isBlocked(item, await loadItemSummaries(orm, getOrigin()))) {
|
|
7525
7564
|
console.log(
|
|
7526
|
-
|
|
7565
|
+
chalk70.red(`Item #${id2} is blocked by unresolved dependencies.`)
|
|
7527
7566
|
);
|
|
7528
7567
|
return false;
|
|
7529
7568
|
}
|
|
7530
|
-
console.log(
|
|
7569
|
+
console.log(chalk70.bold(`
|
|
7531
7570
|
Running backlog item #${id2}...
|
|
7532
7571
|
`));
|
|
7533
7572
|
await run2(id2, options2);
|
|
@@ -7545,7 +7584,7 @@ async function handleLaunchSignal(slashCommand, once) {
|
|
|
7545
7584
|
if (typeof signal.id === "string" && signal.id) {
|
|
7546
7585
|
if (await tryRunById(signal.id, { allowEdits: true })) return;
|
|
7547
7586
|
}
|
|
7548
|
-
console.log(
|
|
7587
|
+
console.log(chalk71.bold("\nChaining into assist next...\n"));
|
|
7549
7588
|
await next({ allowEdits: true, once });
|
|
7550
7589
|
}
|
|
7551
7590
|
}
|
|
@@ -7584,12 +7623,12 @@ async function pickItemForRefine() {
|
|
|
7584
7623
|
(i) => i.status === "todo" || i.status === "in-progress"
|
|
7585
7624
|
);
|
|
7586
7625
|
if (active.length === 0) {
|
|
7587
|
-
console.log(
|
|
7626
|
+
console.log(chalk72.yellow("No active backlog items to refine."));
|
|
7588
7627
|
return void 0;
|
|
7589
7628
|
}
|
|
7590
7629
|
if (active.length === 1) {
|
|
7591
7630
|
const item = active[0];
|
|
7592
|
-
console.log(
|
|
7631
|
+
console.log(chalk72.bold(`Auto-selecting item #${item.id}: ${item.name}`));
|
|
7593
7632
|
return String(item.id);
|
|
7594
7633
|
}
|
|
7595
7634
|
const { selected } = await exitOnCancel(
|
|
@@ -7624,7 +7663,7 @@ function registerRefineCommand(cmd) {
|
|
|
7624
7663
|
}
|
|
7625
7664
|
|
|
7626
7665
|
// src/commands/backlog/rewindPhase.ts
|
|
7627
|
-
import
|
|
7666
|
+
import chalk73 from "chalk";
|
|
7628
7667
|
function validateRewind2(item, plan2, phaseNumber) {
|
|
7629
7668
|
if (phaseNumber < 1 || phaseNumber > plan2.length) {
|
|
7630
7669
|
return `Phase ${phaseNumber} does not exist. Valid range: 1\u2013${plan2.length}.`;
|
|
@@ -7641,13 +7680,13 @@ async function rewindPhase(id2, phase, opts) {
|
|
|
7641
7680
|
const { orm } = await getReady();
|
|
7642
7681
|
const item = await loadItem(orm, Number.parseInt(id2, 10));
|
|
7643
7682
|
if (!item) {
|
|
7644
|
-
console.log(
|
|
7683
|
+
console.log(chalk73.red(`Item #${id2} not found.`));
|
|
7645
7684
|
return;
|
|
7646
7685
|
}
|
|
7647
7686
|
const plan2 = resolveRewindPlan(item);
|
|
7648
7687
|
const error = validateRewind2(item, plan2, phaseNumber);
|
|
7649
7688
|
if (error) {
|
|
7650
|
-
console.log(
|
|
7689
|
+
console.log(chalk73.red(error));
|
|
7651
7690
|
process.exitCode = 1;
|
|
7652
7691
|
return;
|
|
7653
7692
|
}
|
|
@@ -7665,7 +7704,7 @@ async function rewindPhase(id2, phase, opts) {
|
|
|
7665
7704
|
targetPhase: phaseIndex
|
|
7666
7705
|
});
|
|
7667
7706
|
console.log(
|
|
7668
|
-
|
|
7707
|
+
chalk73.green(`Rewound item #${id2} to phase ${phaseNumber} (${phaseName}).`)
|
|
7669
7708
|
);
|
|
7670
7709
|
}
|
|
7671
7710
|
|
|
@@ -7691,22 +7730,22 @@ function registerRunCommand(cmd) {
|
|
|
7691
7730
|
}
|
|
7692
7731
|
|
|
7693
7732
|
// src/commands/backlog/search/index.ts
|
|
7694
|
-
import
|
|
7733
|
+
import chalk74 from "chalk";
|
|
7695
7734
|
async function search(query) {
|
|
7696
7735
|
const items2 = await searchBacklog(query);
|
|
7697
7736
|
if (items2.length === 0) {
|
|
7698
|
-
console.log(
|
|
7737
|
+
console.log(chalk74.dim(`No items matching "${query}".`));
|
|
7699
7738
|
return;
|
|
7700
7739
|
}
|
|
7701
7740
|
console.log(
|
|
7702
|
-
|
|
7741
|
+
chalk74.dim(
|
|
7703
7742
|
`${items2.length} item${items2.length === 1 ? "" : "s"} matching "${query}":
|
|
7704
7743
|
`
|
|
7705
7744
|
)
|
|
7706
7745
|
);
|
|
7707
7746
|
for (const item of items2) {
|
|
7708
7747
|
console.log(
|
|
7709
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
7748
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk74.dim(`#${item.id}`)} ${item.name}`
|
|
7710
7749
|
);
|
|
7711
7750
|
}
|
|
7712
7751
|
}
|
|
@@ -7717,16 +7756,16 @@ function registerSearchCommand(cmd) {
|
|
|
7717
7756
|
}
|
|
7718
7757
|
|
|
7719
7758
|
// src/commands/backlog/delete/index.ts
|
|
7720
|
-
import
|
|
7759
|
+
import chalk75 from "chalk";
|
|
7721
7760
|
async function del(id2) {
|
|
7722
7761
|
const name = await removeItem(id2);
|
|
7723
7762
|
if (name) {
|
|
7724
|
-
console.log(
|
|
7763
|
+
console.log(chalk75.green(`Deleted item #${id2}: ${name}`));
|
|
7725
7764
|
}
|
|
7726
7765
|
}
|
|
7727
7766
|
|
|
7728
7767
|
// src/commands/backlog/done/index.ts
|
|
7729
|
-
import
|
|
7768
|
+
import chalk76 from "chalk";
|
|
7730
7769
|
async function done(id2, summary) {
|
|
7731
7770
|
const found = await findOneItem(id2);
|
|
7732
7771
|
if (!found) return;
|
|
@@ -7736,12 +7775,12 @@ async function done(id2, summary) {
|
|
|
7736
7775
|
const pending = item.plan.slice(completedCount);
|
|
7737
7776
|
if (pending.length > 0) {
|
|
7738
7777
|
console.log(
|
|
7739
|
-
|
|
7778
|
+
chalk76.red(
|
|
7740
7779
|
`Cannot complete item #${id2}: ${pending.length} pending phase(s):`
|
|
7741
7780
|
)
|
|
7742
7781
|
);
|
|
7743
7782
|
for (const phase of pending) {
|
|
7744
|
-
console.log(
|
|
7783
|
+
console.log(chalk76.yellow(` - ${phase.name}`));
|
|
7745
7784
|
}
|
|
7746
7785
|
process.exitCode = 1;
|
|
7747
7786
|
return;
|
|
@@ -7752,18 +7791,18 @@ async function done(id2, summary) {
|
|
|
7752
7791
|
const phase = item.currentPhase ?? 1;
|
|
7753
7792
|
await appendComment(orm, item.id, summary, { phase, type: "summary" });
|
|
7754
7793
|
}
|
|
7755
|
-
console.log(
|
|
7794
|
+
console.log(chalk76.green(`Completed item #${id2}: ${item.name}`));
|
|
7756
7795
|
}
|
|
7757
7796
|
|
|
7758
7797
|
// src/commands/backlog/star/index.ts
|
|
7759
|
-
import
|
|
7798
|
+
import chalk78 from "chalk";
|
|
7760
7799
|
|
|
7761
7800
|
// src/commands/backlog/setStarred.ts
|
|
7762
|
-
import
|
|
7801
|
+
import chalk77 from "chalk";
|
|
7763
7802
|
async function setStarred(id2, starred) {
|
|
7764
7803
|
const { orm } = await getReady();
|
|
7765
7804
|
const name = await updateStarred(orm, Number.parseInt(id2, 10), starred);
|
|
7766
|
-
if (name === void 0) console.log(
|
|
7805
|
+
if (name === void 0) console.log(chalk77.red(`Item #${id2} not found.`));
|
|
7767
7806
|
return name;
|
|
7768
7807
|
}
|
|
7769
7808
|
|
|
@@ -7771,45 +7810,45 @@ async function setStarred(id2, starred) {
|
|
|
7771
7810
|
async function star(id2) {
|
|
7772
7811
|
const name = await setStarred(id2, true);
|
|
7773
7812
|
if (name) {
|
|
7774
|
-
console.log(
|
|
7813
|
+
console.log(chalk78.green(`Starred item #${id2}: ${name}`));
|
|
7775
7814
|
}
|
|
7776
7815
|
}
|
|
7777
7816
|
|
|
7778
7817
|
// src/commands/backlog/start/index.ts
|
|
7779
|
-
import
|
|
7818
|
+
import chalk79 from "chalk";
|
|
7780
7819
|
async function start(id2) {
|
|
7781
7820
|
const name = await setStatus(id2, "in-progress");
|
|
7782
7821
|
if (name) {
|
|
7783
|
-
console.log(
|
|
7822
|
+
console.log(chalk79.green(`Started item #${id2}: ${name}`));
|
|
7784
7823
|
}
|
|
7785
7824
|
}
|
|
7786
7825
|
|
|
7787
7826
|
// src/commands/backlog/stop/index.ts
|
|
7788
|
-
import
|
|
7827
|
+
import chalk80 from "chalk";
|
|
7789
7828
|
import { and as and7, eq as eq24 } from "drizzle-orm";
|
|
7790
7829
|
async function stop() {
|
|
7791
7830
|
const { orm } = await getReady();
|
|
7792
7831
|
const stopped = await orm.update(items).set({ status: "todo", currentPhase: 1 }).where(and7(eq24(items.status, "in-progress"), eq24(items.origin, getOrigin()))).returning({ id: items.id, name: items.name });
|
|
7793
7832
|
if (stopped.length === 0) {
|
|
7794
|
-
console.log(
|
|
7833
|
+
console.log(chalk80.yellow("No in-progress items to stop."));
|
|
7795
7834
|
return;
|
|
7796
7835
|
}
|
|
7797
7836
|
for (const item of stopped) {
|
|
7798
|
-
console.log(
|
|
7837
|
+
console.log(chalk80.yellow(`Stopped item #${item.id}: ${item.name}`));
|
|
7799
7838
|
}
|
|
7800
7839
|
}
|
|
7801
7840
|
|
|
7802
7841
|
// src/commands/backlog/unstar/index.ts
|
|
7803
|
-
import
|
|
7842
|
+
import chalk81 from "chalk";
|
|
7804
7843
|
async function unstar(id2) {
|
|
7805
7844
|
const name = await setStarred(id2, false);
|
|
7806
7845
|
if (name) {
|
|
7807
|
-
console.log(
|
|
7846
|
+
console.log(chalk81.green(`Unstarred item #${id2}: ${name}`));
|
|
7808
7847
|
}
|
|
7809
7848
|
}
|
|
7810
7849
|
|
|
7811
7850
|
// src/commands/backlog/wontdo/index.ts
|
|
7812
|
-
import
|
|
7851
|
+
import chalk82 from "chalk";
|
|
7813
7852
|
async function wontdo(id2, reason) {
|
|
7814
7853
|
const found = await findOneItem(id2);
|
|
7815
7854
|
if (!found) return;
|
|
@@ -7819,7 +7858,7 @@ async function wontdo(id2, reason) {
|
|
|
7819
7858
|
const phase = item.currentPhase ?? 1;
|
|
7820
7859
|
await appendComment(orm, item.id, reason, { phase, type: "summary" });
|
|
7821
7860
|
}
|
|
7822
|
-
console.log(
|
|
7861
|
+
console.log(chalk82.red(`Won't do item #${id2}: ${item.name}`));
|
|
7823
7862
|
}
|
|
7824
7863
|
|
|
7825
7864
|
// src/commands/backlog/registerStatusCommands.ts
|
|
@@ -7834,11 +7873,11 @@ function registerStatusCommands(cmd) {
|
|
|
7834
7873
|
}
|
|
7835
7874
|
|
|
7836
7875
|
// src/commands/backlog/removePhase.ts
|
|
7837
|
-
import
|
|
7876
|
+
import chalk84 from "chalk";
|
|
7838
7877
|
import { and as and10, eq as eq27 } from "drizzle-orm";
|
|
7839
7878
|
|
|
7840
7879
|
// src/commands/backlog/findPhase.ts
|
|
7841
|
-
import
|
|
7880
|
+
import chalk83 from "chalk";
|
|
7842
7881
|
import { and as and8, count as count4, eq as eq25 } from "drizzle-orm";
|
|
7843
7882
|
async function findPhase(id2, phase) {
|
|
7844
7883
|
const found = await findOneItem(id2);
|
|
@@ -7849,7 +7888,7 @@ async function findPhase(id2, phase) {
|
|
|
7849
7888
|
const [row] = await orm.select({ cnt: count4() }).from(planPhases).where(and8(eq25(planPhases.itemId, itemId), eq25(planPhases.idx, phaseIdx)));
|
|
7850
7889
|
if (!row || row.cnt === 0) {
|
|
7851
7890
|
console.log(
|
|
7852
|
-
|
|
7891
|
+
chalk83.red(`Phase ${phaseIdx + 1} not found on item #${itemId}.`)
|
|
7853
7892
|
);
|
|
7854
7893
|
process.exitCode = 1;
|
|
7855
7894
|
return void 0;
|
|
@@ -7896,12 +7935,12 @@ async function removePhase(id2, phase) {
|
|
|
7896
7935
|
await adjustCurrentPhase(tx, item, phaseIdx);
|
|
7897
7936
|
});
|
|
7898
7937
|
console.log(
|
|
7899
|
-
|
|
7938
|
+
chalk84.green(`Removed phase ${phaseIdx + 1} from item #${itemId}.`)
|
|
7900
7939
|
);
|
|
7901
7940
|
}
|
|
7902
7941
|
|
|
7903
7942
|
// src/commands/backlog/update/index.ts
|
|
7904
|
-
import
|
|
7943
|
+
import chalk86 from "chalk";
|
|
7905
7944
|
import { eq as eq28 } from "drizzle-orm";
|
|
7906
7945
|
|
|
7907
7946
|
// src/commands/backlog/update/parseListIndex.ts
|
|
@@ -7977,16 +8016,16 @@ function applyAcMutations(current, options2) {
|
|
|
7977
8016
|
}
|
|
7978
8017
|
|
|
7979
8018
|
// src/commands/backlog/update/buildUpdateValues.ts
|
|
7980
|
-
import
|
|
8019
|
+
import chalk85 from "chalk";
|
|
7981
8020
|
function buildUpdateValues(options2) {
|
|
7982
8021
|
const { name, desc: desc6, type, ac } = options2;
|
|
7983
8022
|
if (!name && !desc6 && !type && !ac) {
|
|
7984
|
-
console.log(
|
|
8023
|
+
console.log(chalk85.red("Nothing to update. Provide at least one flag."));
|
|
7985
8024
|
process.exitCode = 1;
|
|
7986
8025
|
return void 0;
|
|
7987
8026
|
}
|
|
7988
8027
|
if (type && type !== "story" && type !== "bug") {
|
|
7989
|
-
console.log(
|
|
8028
|
+
console.log(chalk85.red('Invalid type. Must be "story" or "bug".'));
|
|
7990
8029
|
process.exitCode = 1;
|
|
7991
8030
|
return void 0;
|
|
7992
8031
|
}
|
|
@@ -8019,14 +8058,14 @@ async function update(id2, options2) {
|
|
|
8019
8058
|
if (hasAcMutations(options2)) {
|
|
8020
8059
|
if (options2.ac) {
|
|
8021
8060
|
console.log(
|
|
8022
|
-
|
|
8061
|
+
chalk86.red("Cannot combine --ac with --add-ac/--edit-ac/--remove-ac.")
|
|
8023
8062
|
);
|
|
8024
8063
|
process.exitCode = 1;
|
|
8025
8064
|
return;
|
|
8026
8065
|
}
|
|
8027
8066
|
const mutation = applyAcMutations(found.item.acceptanceCriteria, options2);
|
|
8028
8067
|
if (!mutation.ok) {
|
|
8029
|
-
console.log(
|
|
8068
|
+
console.log(chalk86.red(mutation.error));
|
|
8030
8069
|
process.exitCode = 1;
|
|
8031
8070
|
return;
|
|
8032
8071
|
}
|
|
@@ -8037,11 +8076,11 @@ async function update(id2, options2) {
|
|
|
8037
8076
|
const { orm } = found;
|
|
8038
8077
|
const itemId = found.item.id;
|
|
8039
8078
|
await orm.update(items).set(built.set).where(eq28(items.id, itemId));
|
|
8040
|
-
console.log(
|
|
8079
|
+
console.log(chalk86.green(`Updated ${built.fields} on item #${itemId}.`));
|
|
8041
8080
|
}
|
|
8042
8081
|
|
|
8043
8082
|
// src/commands/backlog/updatePhase.ts
|
|
8044
|
-
import
|
|
8083
|
+
import chalk87 from "chalk";
|
|
8045
8084
|
|
|
8046
8085
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
8047
8086
|
import { and as and11, eq as eq29 } from "drizzle-orm";
|
|
@@ -8145,7 +8184,7 @@ async function updatePhase(id2, phase, options2) {
|
|
|
8145
8184
|
const { item, orm, itemId, phaseIdx } = found;
|
|
8146
8185
|
const resolved = resolvePhaseFields(options2, item.plan?.[phaseIdx]);
|
|
8147
8186
|
if (!resolved.ok) {
|
|
8148
|
-
console.log(
|
|
8187
|
+
console.log(chalk87.red(resolved.error));
|
|
8149
8188
|
process.exitCode = 1;
|
|
8150
8189
|
return;
|
|
8151
8190
|
}
|
|
@@ -8157,7 +8196,7 @@ async function updatePhase(id2, phase, options2) {
|
|
|
8157
8196
|
manualCheck && "manual checks"
|
|
8158
8197
|
].filter(Boolean).join(", ");
|
|
8159
8198
|
console.log(
|
|
8160
|
-
|
|
8199
|
+
chalk87.green(
|
|
8161
8200
|
`Updated ${fields} on phase ${phaseIdx + 1} of item #${itemId}.`
|
|
8162
8201
|
)
|
|
8163
8202
|
);
|
|
@@ -8890,11 +8929,11 @@ function assertCliExists(cli) {
|
|
|
8890
8929
|
}
|
|
8891
8930
|
|
|
8892
8931
|
// src/commands/permitCliReads/colorize.ts
|
|
8893
|
-
import
|
|
8932
|
+
import chalk88 from "chalk";
|
|
8894
8933
|
function colorize(plainOutput) {
|
|
8895
8934
|
return plainOutput.split("\n").map((line) => {
|
|
8896
|
-
if (line.startsWith(" R ")) return
|
|
8897
|
-
if (line.startsWith(" W ")) return
|
|
8935
|
+
if (line.startsWith(" R ")) return chalk88.green(line);
|
|
8936
|
+
if (line.startsWith(" W ")) return chalk88.red(line);
|
|
8898
8937
|
return line;
|
|
8899
8938
|
}).join("\n");
|
|
8900
8939
|
}
|
|
@@ -9192,7 +9231,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
9192
9231
|
}
|
|
9193
9232
|
|
|
9194
9233
|
// src/commands/deny/denyAdd.ts
|
|
9195
|
-
import
|
|
9234
|
+
import chalk89 from "chalk";
|
|
9196
9235
|
|
|
9197
9236
|
// src/commands/deny/loadDenyConfig.ts
|
|
9198
9237
|
function loadDenyConfig(global) {
|
|
@@ -9212,16 +9251,16 @@ function loadDenyConfig(global) {
|
|
|
9212
9251
|
function denyAdd(pattern2, message, options2) {
|
|
9213
9252
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
9214
9253
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
9215
|
-
console.log(
|
|
9254
|
+
console.log(chalk89.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
9216
9255
|
return;
|
|
9217
9256
|
}
|
|
9218
9257
|
deny.push({ pattern: pattern2, message });
|
|
9219
9258
|
saveDeny(deny);
|
|
9220
|
-
console.log(
|
|
9259
|
+
console.log(chalk89.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
9221
9260
|
}
|
|
9222
9261
|
|
|
9223
9262
|
// src/commands/deny/denyList.ts
|
|
9224
|
-
import
|
|
9263
|
+
import chalk90 from "chalk";
|
|
9225
9264
|
function denyList() {
|
|
9226
9265
|
const globalRaw = loadGlobalConfigRaw();
|
|
9227
9266
|
const projectRaw = loadProjectConfig();
|
|
@@ -9232,7 +9271,7 @@ function denyList() {
|
|
|
9232
9271
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
9233
9272
|
);
|
|
9234
9273
|
if (!merged || merged.length === 0) {
|
|
9235
|
-
console.log(
|
|
9274
|
+
console.log(chalk90.dim("No deny rules configured."));
|
|
9236
9275
|
return;
|
|
9237
9276
|
}
|
|
9238
9277
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -9240,23 +9279,23 @@ function denyList() {
|
|
|
9240
9279
|
for (const rule of merged) {
|
|
9241
9280
|
const inProject = projectPatterns.has(rule.pattern);
|
|
9242
9281
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
9243
|
-
const label2 = inProject && inGlobal ?
|
|
9244
|
-
console.log(`${
|
|
9282
|
+
const label2 = inProject && inGlobal ? chalk90.dim(" (project, overrides global)") : inGlobal ? chalk90.dim(" (global)") : "";
|
|
9283
|
+
console.log(`${chalk90.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
9245
9284
|
}
|
|
9246
9285
|
}
|
|
9247
9286
|
|
|
9248
9287
|
// src/commands/deny/denyRemove.ts
|
|
9249
|
-
import
|
|
9288
|
+
import chalk91 from "chalk";
|
|
9250
9289
|
function denyRemove(pattern2, options2) {
|
|
9251
9290
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
9252
9291
|
const index3 = deny.findIndex((r) => r.pattern === pattern2);
|
|
9253
9292
|
if (index3 === -1) {
|
|
9254
|
-
console.log(
|
|
9293
|
+
console.log(chalk91.yellow(`No deny rule found for: ${pattern2}`));
|
|
9255
9294
|
return;
|
|
9256
9295
|
}
|
|
9257
9296
|
deny.splice(index3, 1);
|
|
9258
9297
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
9259
|
-
console.log(
|
|
9298
|
+
console.log(chalk91.green(`Removed deny rule: ${pattern2}`));
|
|
9260
9299
|
}
|
|
9261
9300
|
|
|
9262
9301
|
// src/commands/registerDeny.ts
|
|
@@ -9285,15 +9324,15 @@ function registerCliHook(program2) {
|
|
|
9285
9324
|
}
|
|
9286
9325
|
|
|
9287
9326
|
// src/commands/complexity/analyze.ts
|
|
9288
|
-
import
|
|
9327
|
+
import chalk98 from "chalk";
|
|
9289
9328
|
|
|
9290
9329
|
// src/commands/complexity/cyclomatic.ts
|
|
9291
|
-
import
|
|
9330
|
+
import chalk93 from "chalk";
|
|
9292
9331
|
|
|
9293
9332
|
// src/commands/complexity/shared/index.ts
|
|
9294
9333
|
import fs16 from "fs";
|
|
9295
9334
|
import path21 from "path";
|
|
9296
|
-
import
|
|
9335
|
+
import chalk92 from "chalk";
|
|
9297
9336
|
import ts5 from "typescript";
|
|
9298
9337
|
|
|
9299
9338
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -9544,7 +9583,7 @@ function createSourceFromFile(filePath) {
|
|
|
9544
9583
|
function withSourceFiles(pattern2, callback, extraIgnore = []) {
|
|
9545
9584
|
const files = findSourceFiles2(pattern2, ".", extraIgnore);
|
|
9546
9585
|
if (files.length === 0) {
|
|
9547
|
-
console.log(
|
|
9586
|
+
console.log(chalk92.yellow("No files found matching pattern"));
|
|
9548
9587
|
return void 0;
|
|
9549
9588
|
}
|
|
9550
9589
|
return callback(files);
|
|
@@ -9577,11 +9616,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
9577
9616
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
9578
9617
|
for (const { file, name, complexity } of results) {
|
|
9579
9618
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
9580
|
-
const color = exceedsThreshold ?
|
|
9581
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
9619
|
+
const color = exceedsThreshold ? chalk93.red : chalk93.white;
|
|
9620
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk93.cyan(complexity)}`);
|
|
9582
9621
|
}
|
|
9583
9622
|
console.log(
|
|
9584
|
-
|
|
9623
|
+
chalk93.dim(
|
|
9585
9624
|
`
|
|
9586
9625
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
9587
9626
|
)
|
|
@@ -9593,7 +9632,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
9593
9632
|
}
|
|
9594
9633
|
|
|
9595
9634
|
// src/commands/complexity/halstead.ts
|
|
9596
|
-
import
|
|
9635
|
+
import chalk94 from "chalk";
|
|
9597
9636
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
9598
9637
|
withSourceFiles(pattern2, (files) => {
|
|
9599
9638
|
const results = [];
|
|
@@ -9608,13 +9647,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
9608
9647
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
9609
9648
|
for (const { file, name, metrics } of results) {
|
|
9610
9649
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
9611
|
-
const color = exceedsThreshold ?
|
|
9650
|
+
const color = exceedsThreshold ? chalk94.red : chalk94.white;
|
|
9612
9651
|
console.log(
|
|
9613
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
9652
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk94.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk94.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk94.magenta(metrics.effort.toFixed(1))}`
|
|
9614
9653
|
);
|
|
9615
9654
|
}
|
|
9616
9655
|
console.log(
|
|
9617
|
-
|
|
9656
|
+
chalk94.dim(
|
|
9618
9657
|
`
|
|
9619
9658
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
9620
9659
|
)
|
|
@@ -9638,28 +9677,28 @@ function calculateMaintainabilityIndex(halsteadVolume, cyclomaticComplexity, slo
|
|
|
9638
9677
|
}
|
|
9639
9678
|
|
|
9640
9679
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
9641
|
-
import
|
|
9680
|
+
import chalk95 from "chalk";
|
|
9642
9681
|
function displayMaintainabilityResults(results, threshold) {
|
|
9643
9682
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
9644
9683
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
9645
|
-
console.log(
|
|
9684
|
+
console.log(chalk95.green("All files pass maintainability threshold"));
|
|
9646
9685
|
} else {
|
|
9647
9686
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
9648
|
-
const color = threshold !== void 0 ?
|
|
9687
|
+
const color = threshold !== void 0 ? chalk95.red : chalk95.white;
|
|
9649
9688
|
console.log(
|
|
9650
|
-
`${color(file)} \u2192 avg: ${
|
|
9689
|
+
`${color(file)} \u2192 avg: ${chalk95.cyan(avgMaintainability.toFixed(1))}, min: ${chalk95.yellow(minMaintainability.toFixed(1))}`
|
|
9651
9690
|
);
|
|
9652
9691
|
}
|
|
9653
9692
|
}
|
|
9654
|
-
console.log(
|
|
9693
|
+
console.log(chalk95.dim(`
|
|
9655
9694
|
Analyzed ${results.length} files`));
|
|
9656
9695
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
9657
9696
|
console.error(
|
|
9658
|
-
|
|
9697
|
+
chalk95.red(
|
|
9659
9698
|
`
|
|
9660
9699
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
9661
9700
|
|
|
9662
|
-
\u26A0\uFE0F ${
|
|
9701
|
+
\u26A0\uFE0F ${chalk95.bold("Diagnose and fix one file at a time")} \u2014 do not investigate or fix multiple files in parallel. Run 'assist complexity <file>' to see all metrics. For larger files, start by extracting responsibilities into smaller files.`
|
|
9663
9702
|
)
|
|
9664
9703
|
);
|
|
9665
9704
|
process.exit(1);
|
|
@@ -9667,10 +9706,10 @@ Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability i
|
|
|
9667
9706
|
}
|
|
9668
9707
|
|
|
9669
9708
|
// src/commands/complexity/maintainability/printMaintainabilityFormula.ts
|
|
9670
|
-
import
|
|
9709
|
+
import chalk96 from "chalk";
|
|
9671
9710
|
var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
|
|
9672
9711
|
function printMaintainabilityFormula() {
|
|
9673
|
-
console.log(
|
|
9712
|
+
console.log(chalk96.dim(MI_FORMULA));
|
|
9674
9713
|
}
|
|
9675
9714
|
|
|
9676
9715
|
// src/commands/complexity/maintainability/index.ts
|
|
@@ -9721,7 +9760,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
9721
9760
|
|
|
9722
9761
|
// src/commands/complexity/sloc.ts
|
|
9723
9762
|
import fs18 from "fs";
|
|
9724
|
-
import
|
|
9763
|
+
import chalk97 from "chalk";
|
|
9725
9764
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
9726
9765
|
withSourceFiles(pattern2, (files) => {
|
|
9727
9766
|
const results = [];
|
|
@@ -9737,12 +9776,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
9737
9776
|
results.sort((a, b) => b.lines - a.lines);
|
|
9738
9777
|
for (const { file, lines } of results) {
|
|
9739
9778
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
9740
|
-
const color = exceedsThreshold ?
|
|
9741
|
-
console.log(`${color(file)} \u2192 ${
|
|
9779
|
+
const color = exceedsThreshold ? chalk97.red : chalk97.white;
|
|
9780
|
+
console.log(`${color(file)} \u2192 ${chalk97.cyan(lines)} lines`);
|
|
9742
9781
|
}
|
|
9743
9782
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
9744
9783
|
console.log(
|
|
9745
|
-
|
|
9784
|
+
chalk97.dim(`
|
|
9746
9785
|
Total: ${total} lines across ${files.length} files`)
|
|
9747
9786
|
);
|
|
9748
9787
|
if (hasViolation) {
|
|
@@ -9756,25 +9795,25 @@ async function analyze(pattern2) {
|
|
|
9756
9795
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
9757
9796
|
const files = findSourceFiles2(searchPattern);
|
|
9758
9797
|
if (files.length === 0) {
|
|
9759
|
-
console.log(
|
|
9798
|
+
console.log(chalk98.yellow("No files found matching pattern"));
|
|
9760
9799
|
return;
|
|
9761
9800
|
}
|
|
9762
9801
|
if (files.length === 1) {
|
|
9763
9802
|
const file = files[0];
|
|
9764
|
-
console.log(
|
|
9803
|
+
console.log(chalk98.bold.underline("SLOC"));
|
|
9765
9804
|
await sloc(file);
|
|
9766
9805
|
console.log();
|
|
9767
|
-
console.log(
|
|
9806
|
+
console.log(chalk98.bold.underline("Cyclomatic Complexity"));
|
|
9768
9807
|
await cyclomatic(file);
|
|
9769
9808
|
console.log();
|
|
9770
|
-
console.log(
|
|
9809
|
+
console.log(chalk98.bold.underline("Halstead Metrics"));
|
|
9771
9810
|
await halstead(file);
|
|
9772
9811
|
console.log();
|
|
9773
|
-
console.log(
|
|
9812
|
+
console.log(chalk98.bold.underline("Maintainability Index"));
|
|
9774
9813
|
await maintainability(file);
|
|
9775
9814
|
console.log();
|
|
9776
9815
|
console.log(
|
|
9777
|
-
|
|
9816
|
+
chalk98.dim(
|
|
9778
9817
|
"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."
|
|
9779
9818
|
)
|
|
9780
9819
|
);
|
|
@@ -9808,7 +9847,7 @@ function registerComplexity(program2) {
|
|
|
9808
9847
|
}
|
|
9809
9848
|
|
|
9810
9849
|
// src/commands/config/index.ts
|
|
9811
|
-
import
|
|
9850
|
+
import chalk99 from "chalk";
|
|
9812
9851
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
9813
9852
|
|
|
9814
9853
|
// src/commands/config/setNestedValue.ts
|
|
@@ -9871,7 +9910,7 @@ function formatIssuePath(issue, key) {
|
|
|
9871
9910
|
function printValidationErrors(issues, key) {
|
|
9872
9911
|
for (const issue of issues) {
|
|
9873
9912
|
console.error(
|
|
9874
|
-
|
|
9913
|
+
chalk99.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
9875
9914
|
);
|
|
9876
9915
|
}
|
|
9877
9916
|
}
|
|
@@ -9888,7 +9927,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
9888
9927
|
function assertNotGlobalOnly(key, global) {
|
|
9889
9928
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
9890
9929
|
console.error(
|
|
9891
|
-
|
|
9930
|
+
chalk99.red(
|
|
9892
9931
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
9893
9932
|
)
|
|
9894
9933
|
);
|
|
@@ -9911,7 +9950,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
9911
9950
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
9912
9951
|
const target = options2.global ? "global" : "project";
|
|
9913
9952
|
console.log(
|
|
9914
|
-
|
|
9953
|
+
chalk99.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
9915
9954
|
);
|
|
9916
9955
|
}
|
|
9917
9956
|
function configList() {
|
|
@@ -9920,7 +9959,7 @@ function configList() {
|
|
|
9920
9959
|
}
|
|
9921
9960
|
|
|
9922
9961
|
// src/commands/config/configGet.ts
|
|
9923
|
-
import
|
|
9962
|
+
import chalk100 from "chalk";
|
|
9924
9963
|
|
|
9925
9964
|
// src/commands/config/getNestedValue.ts
|
|
9926
9965
|
function isTraversable(value) {
|
|
@@ -9952,7 +9991,7 @@ function requireNestedValue(config, key) {
|
|
|
9952
9991
|
return value;
|
|
9953
9992
|
}
|
|
9954
9993
|
function exitKeyNotSet(key) {
|
|
9955
|
-
console.error(
|
|
9994
|
+
console.error(chalk100.red(`Key "${key}" is not set`));
|
|
9956
9995
|
process.exit(1);
|
|
9957
9996
|
}
|
|
9958
9997
|
|
|
@@ -9966,7 +10005,7 @@ function registerConfig(program2) {
|
|
|
9966
10005
|
|
|
9967
10006
|
// src/commands/deploy/redirect.ts
|
|
9968
10007
|
import { existsSync as existsSync27, readFileSync as readFileSync22, writeFileSync as writeFileSync22 } from "fs";
|
|
9969
|
-
import
|
|
10008
|
+
import chalk101 from "chalk";
|
|
9970
10009
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
9971
10010
|
if (!window.location.pathname.endsWith('/')) {
|
|
9972
10011
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -9975,23 +10014,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
9975
10014
|
function redirect() {
|
|
9976
10015
|
const indexPath = "index.html";
|
|
9977
10016
|
if (!existsSync27(indexPath)) {
|
|
9978
|
-
console.log(
|
|
10017
|
+
console.log(chalk101.yellow("No index.html found"));
|
|
9979
10018
|
return;
|
|
9980
10019
|
}
|
|
9981
10020
|
const content = readFileSync22(indexPath, "utf8");
|
|
9982
10021
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
9983
|
-
console.log(
|
|
10022
|
+
console.log(chalk101.dim("Trailing slash script already present"));
|
|
9984
10023
|
return;
|
|
9985
10024
|
}
|
|
9986
10025
|
const headCloseIndex = content.indexOf("</head>");
|
|
9987
10026
|
if (headCloseIndex === -1) {
|
|
9988
|
-
console.log(
|
|
10027
|
+
console.log(chalk101.red("Could not find </head> tag in index.html"));
|
|
9989
10028
|
return;
|
|
9990
10029
|
}
|
|
9991
10030
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
9992
10031
|
${content.slice(headCloseIndex)}`;
|
|
9993
10032
|
writeFileSync22(indexPath, newContent);
|
|
9994
|
-
console.log(
|
|
10033
|
+
console.log(chalk101.green("Added trailing slash redirect to index.html"));
|
|
9995
10034
|
}
|
|
9996
10035
|
|
|
9997
10036
|
// src/commands/registerDeploy.ts
|
|
@@ -10018,7 +10057,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
10018
10057
|
|
|
10019
10058
|
// src/commands/devlog/shared.ts
|
|
10020
10059
|
import { execSync as execSync23 } from "child_process";
|
|
10021
|
-
import
|
|
10060
|
+
import chalk102 from "chalk";
|
|
10022
10061
|
|
|
10023
10062
|
// src/shared/getRepoName.ts
|
|
10024
10063
|
import { existsSync as existsSync28, readFileSync as readFileSync23 } from "fs";
|
|
@@ -10127,13 +10166,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
10127
10166
|
}
|
|
10128
10167
|
function printCommitsWithFiles(commits2, ignore2, verbose) {
|
|
10129
10168
|
for (const commit2 of commits2) {
|
|
10130
|
-
console.log(` ${
|
|
10169
|
+
console.log(` ${chalk102.yellow(commit2.hash)} ${commit2.message}`);
|
|
10131
10170
|
if (verbose) {
|
|
10132
10171
|
const visibleFiles = commit2.files.filter(
|
|
10133
10172
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
10134
10173
|
);
|
|
10135
10174
|
for (const file of visibleFiles) {
|
|
10136
|
-
console.log(` ${
|
|
10175
|
+
console.log(` ${chalk102.dim(file)}`);
|
|
10137
10176
|
}
|
|
10138
10177
|
}
|
|
10139
10178
|
}
|
|
@@ -10158,15 +10197,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
10158
10197
|
}
|
|
10159
10198
|
|
|
10160
10199
|
// src/commands/devlog/list/printDateHeader.ts
|
|
10161
|
-
import
|
|
10200
|
+
import chalk103 from "chalk";
|
|
10162
10201
|
function printDateHeader(date, isSkipped, entries) {
|
|
10163
10202
|
if (isSkipped) {
|
|
10164
|
-
console.log(`${
|
|
10203
|
+
console.log(`${chalk103.bold.blue(date)} ${chalk103.dim("skipped")}`);
|
|
10165
10204
|
} else if (entries && entries.length > 0) {
|
|
10166
|
-
const entryInfo = entries.map((e) => `${
|
|
10167
|
-
console.log(`${
|
|
10205
|
+
const entryInfo = entries.map((e) => `${chalk103.green(e.version)} ${e.title}`).join(" | ");
|
|
10206
|
+
console.log(`${chalk103.bold.blue(date)} ${entryInfo}`);
|
|
10168
10207
|
} else {
|
|
10169
|
-
console.log(`${
|
|
10208
|
+
console.log(`${chalk103.bold.blue(date)} ${chalk103.red("\u26A0 devlog missing")}`);
|
|
10170
10209
|
}
|
|
10171
10210
|
}
|
|
10172
10211
|
|
|
@@ -10270,24 +10309,24 @@ function bumpVersion(version2, type) {
|
|
|
10270
10309
|
|
|
10271
10310
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
10272
10311
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
10273
|
-
import
|
|
10312
|
+
import chalk105 from "chalk";
|
|
10274
10313
|
|
|
10275
10314
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
10276
|
-
import
|
|
10315
|
+
import chalk104 from "chalk";
|
|
10277
10316
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
10278
10317
|
if (conventional && firstHash) {
|
|
10279
10318
|
const version2 = getVersionAtCommit(firstHash);
|
|
10280
10319
|
if (version2) {
|
|
10281
|
-
console.log(`${
|
|
10320
|
+
console.log(`${chalk104.bold("version:")} ${stripToMinor(version2)}`);
|
|
10282
10321
|
} else {
|
|
10283
|
-
console.log(`${
|
|
10322
|
+
console.log(`${chalk104.bold("version:")} ${chalk104.red("unknown")}`);
|
|
10284
10323
|
}
|
|
10285
10324
|
} else if (patchVersion && minorVersion) {
|
|
10286
10325
|
console.log(
|
|
10287
|
-
`${
|
|
10326
|
+
`${chalk104.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
10288
10327
|
);
|
|
10289
10328
|
} else {
|
|
10290
|
-
console.log(`${
|
|
10329
|
+
console.log(`${chalk104.bold("version:")} v0.1 (initial)`);
|
|
10291
10330
|
}
|
|
10292
10331
|
}
|
|
10293
10332
|
|
|
@@ -10335,16 +10374,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
10335
10374
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
10336
10375
|
}
|
|
10337
10376
|
function logName(repoName) {
|
|
10338
|
-
console.log(`${
|
|
10377
|
+
console.log(`${chalk105.bold("name:")} ${repoName}`);
|
|
10339
10378
|
}
|
|
10340
10379
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
10341
10380
|
logName(ctx.repoName);
|
|
10342
10381
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
10343
|
-
console.log(
|
|
10382
|
+
console.log(chalk105.bold.blue(targetDate));
|
|
10344
10383
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
10345
10384
|
}
|
|
10346
10385
|
function logNoCommits(lastInfo) {
|
|
10347
|
-
console.log(
|
|
10386
|
+
console.log(chalk105.dim(noCommitsMessage(!!lastInfo)));
|
|
10348
10387
|
}
|
|
10349
10388
|
|
|
10350
10389
|
// src/commands/devlog/next/index.ts
|
|
@@ -10385,11 +10424,11 @@ function next2(options2) {
|
|
|
10385
10424
|
import { execSync as execSync25 } from "child_process";
|
|
10386
10425
|
|
|
10387
10426
|
// src/commands/devlog/repos/printReposTable.ts
|
|
10388
|
-
import
|
|
10427
|
+
import chalk106 from "chalk";
|
|
10389
10428
|
function colorStatus(status2) {
|
|
10390
|
-
if (status2 === "missing") return
|
|
10391
|
-
if (status2 === "outdated") return
|
|
10392
|
-
return
|
|
10429
|
+
if (status2 === "missing") return chalk106.red(status2);
|
|
10430
|
+
if (status2 === "outdated") return chalk106.yellow(status2);
|
|
10431
|
+
return chalk106.green(status2);
|
|
10393
10432
|
}
|
|
10394
10433
|
function formatRow(row, nameWidth) {
|
|
10395
10434
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -10403,8 +10442,8 @@ function printReposTable(rows) {
|
|
|
10403
10442
|
"Last Devlog".padEnd(11),
|
|
10404
10443
|
"Status"
|
|
10405
10444
|
].join(" ");
|
|
10406
|
-
console.log(
|
|
10407
|
-
console.log(
|
|
10445
|
+
console.log(chalk106.dim(header));
|
|
10446
|
+
console.log(chalk106.dim("-".repeat(header.length)));
|
|
10408
10447
|
for (const row of rows) {
|
|
10409
10448
|
console.log(formatRow(row, nameWidth));
|
|
10410
10449
|
}
|
|
@@ -10462,14 +10501,14 @@ function repos(options2) {
|
|
|
10462
10501
|
// src/commands/devlog/skip.ts
|
|
10463
10502
|
import { writeFileSync as writeFileSync23 } from "fs";
|
|
10464
10503
|
import { join as join28 } from "path";
|
|
10465
|
-
import
|
|
10504
|
+
import chalk107 from "chalk";
|
|
10466
10505
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
10467
10506
|
function getBlogConfigPath() {
|
|
10468
10507
|
return join28(BLOG_REPO_ROOT, "assist.yml");
|
|
10469
10508
|
}
|
|
10470
10509
|
function skip(date) {
|
|
10471
10510
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
10472
|
-
console.log(
|
|
10511
|
+
console.log(chalk107.red("Invalid date format. Use YYYY-MM-DD"));
|
|
10473
10512
|
process.exit(1);
|
|
10474
10513
|
}
|
|
10475
10514
|
const repoName = getRepoName();
|
|
@@ -10480,7 +10519,7 @@ function skip(date) {
|
|
|
10480
10519
|
const skipDays = skip2[repoName] ?? [];
|
|
10481
10520
|
if (skipDays.includes(date)) {
|
|
10482
10521
|
console.log(
|
|
10483
|
-
|
|
10522
|
+
chalk107.yellow(`${date} is already in skip list for ${repoName}`)
|
|
10484
10523
|
);
|
|
10485
10524
|
return;
|
|
10486
10525
|
}
|
|
@@ -10490,20 +10529,20 @@ function skip(date) {
|
|
|
10490
10529
|
devlog.skip = skip2;
|
|
10491
10530
|
config.devlog = devlog;
|
|
10492
10531
|
writeFileSync23(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
10493
|
-
console.log(
|
|
10532
|
+
console.log(chalk107.green(`Added ${date} to skip list for ${repoName}`));
|
|
10494
10533
|
}
|
|
10495
10534
|
|
|
10496
10535
|
// src/commands/devlog/version.ts
|
|
10497
|
-
import
|
|
10536
|
+
import chalk108 from "chalk";
|
|
10498
10537
|
function version() {
|
|
10499
10538
|
const config = loadConfig();
|
|
10500
10539
|
const name = getRepoName();
|
|
10501
10540
|
const lastInfo = getLastVersionInfo(name, config);
|
|
10502
10541
|
const lastVersion = lastInfo?.version ?? null;
|
|
10503
10542
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
10504
|
-
console.log(`${
|
|
10505
|
-
console.log(`${
|
|
10506
|
-
console.log(`${
|
|
10543
|
+
console.log(`${chalk108.bold("name:")} ${name}`);
|
|
10544
|
+
console.log(`${chalk108.bold("last:")} ${lastVersion ?? chalk108.dim("none")}`);
|
|
10545
|
+
console.log(`${chalk108.bold("next:")} ${nextVersion ?? chalk108.dim("none")}`);
|
|
10507
10546
|
}
|
|
10508
10547
|
|
|
10509
10548
|
// src/commands/registerDevlog.ts
|
|
@@ -10527,7 +10566,7 @@ function registerDevlog(program2) {
|
|
|
10527
10566
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
10528
10567
|
import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync2 } from "fs";
|
|
10529
10568
|
import { join as join29 } from "path";
|
|
10530
|
-
import
|
|
10569
|
+
import chalk109 from "chalk";
|
|
10531
10570
|
|
|
10532
10571
|
// src/shared/findRepoRoot.ts
|
|
10533
10572
|
import { existsSync as existsSync29 } from "fs";
|
|
@@ -10590,14 +10629,14 @@ function checkBuildLocks(startDir) {
|
|
|
10590
10629
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
10591
10630
|
if (locked) {
|
|
10592
10631
|
console.error(
|
|
10593
|
-
|
|
10632
|
+
chalk109.red("Build output locked (is VS debugging?): ") + locked
|
|
10594
10633
|
);
|
|
10595
10634
|
process.exit(1);
|
|
10596
10635
|
}
|
|
10597
10636
|
}
|
|
10598
10637
|
async function checkBuildLocksCommand() {
|
|
10599
10638
|
checkBuildLocks();
|
|
10600
|
-
console.log(
|
|
10639
|
+
console.log(chalk109.green("No build locks detected"));
|
|
10601
10640
|
}
|
|
10602
10641
|
|
|
10603
10642
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -10696,30 +10735,30 @@ function escapeRegex(s) {
|
|
|
10696
10735
|
}
|
|
10697
10736
|
|
|
10698
10737
|
// src/commands/dotnet/printTree.ts
|
|
10699
|
-
import
|
|
10738
|
+
import chalk110 from "chalk";
|
|
10700
10739
|
function printNodes(nodes, prefix2) {
|
|
10701
10740
|
for (let i = 0; i < nodes.length; i++) {
|
|
10702
10741
|
const isLast = i === nodes.length - 1;
|
|
10703
10742
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
10704
10743
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
10705
10744
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
10706
|
-
const label2 = isMissing ?
|
|
10745
|
+
const label2 = isMissing ? chalk110.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
10707
10746
|
console.log(`${prefix2}${connector}${label2}`);
|
|
10708
10747
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
10709
10748
|
}
|
|
10710
10749
|
}
|
|
10711
10750
|
function printTree(tree, totalCount, solutions) {
|
|
10712
|
-
console.log(
|
|
10713
|
-
console.log(
|
|
10751
|
+
console.log(chalk110.bold("\nProject Dependency Tree"));
|
|
10752
|
+
console.log(chalk110.cyan(tree.relativePath));
|
|
10714
10753
|
printNodes(tree.children, "");
|
|
10715
|
-
console.log(
|
|
10754
|
+
console.log(chalk110.dim(`
|
|
10716
10755
|
${totalCount} projects total (including root)`));
|
|
10717
|
-
console.log(
|
|
10756
|
+
console.log(chalk110.bold("\nSolution Membership"));
|
|
10718
10757
|
if (solutions.length === 0) {
|
|
10719
|
-
console.log(
|
|
10758
|
+
console.log(chalk110.yellow(" Not found in any .sln"));
|
|
10720
10759
|
} else {
|
|
10721
10760
|
for (const sln of solutions) {
|
|
10722
|
-
console.log(` ${
|
|
10761
|
+
console.log(` ${chalk110.green(sln)}`);
|
|
10723
10762
|
}
|
|
10724
10763
|
}
|
|
10725
10764
|
console.log();
|
|
@@ -10748,16 +10787,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
10748
10787
|
// src/commands/dotnet/resolveCsproj.ts
|
|
10749
10788
|
import { existsSync as existsSync30 } from "fs";
|
|
10750
10789
|
import path25 from "path";
|
|
10751
|
-
import
|
|
10790
|
+
import chalk111 from "chalk";
|
|
10752
10791
|
function resolveCsproj(csprojPath) {
|
|
10753
10792
|
const resolved = path25.resolve(csprojPath);
|
|
10754
10793
|
if (!existsSync30(resolved)) {
|
|
10755
|
-
console.error(
|
|
10794
|
+
console.error(chalk111.red(`File not found: ${resolved}`));
|
|
10756
10795
|
process.exit(1);
|
|
10757
10796
|
}
|
|
10758
10797
|
const repoRoot = findRepoRoot(path25.dirname(resolved));
|
|
10759
10798
|
if (!repoRoot) {
|
|
10760
|
-
console.error(
|
|
10799
|
+
console.error(chalk111.red("Could not find git repository root"));
|
|
10761
10800
|
process.exit(1);
|
|
10762
10801
|
}
|
|
10763
10802
|
return { resolved, repoRoot };
|
|
@@ -10807,12 +10846,12 @@ function getChangedCsFiles(scope) {
|
|
|
10807
10846
|
}
|
|
10808
10847
|
|
|
10809
10848
|
// src/commands/dotnet/inSln.ts
|
|
10810
|
-
import
|
|
10849
|
+
import chalk112 from "chalk";
|
|
10811
10850
|
async function inSln(csprojPath) {
|
|
10812
10851
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
10813
10852
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
10814
10853
|
if (solutions.length === 0) {
|
|
10815
|
-
console.log(
|
|
10854
|
+
console.log(chalk112.yellow("Not found in any .sln file"));
|
|
10816
10855
|
process.exit(1);
|
|
10817
10856
|
}
|
|
10818
10857
|
for (const sln of solutions) {
|
|
@@ -10821,7 +10860,7 @@ async function inSln(csprojPath) {
|
|
|
10821
10860
|
}
|
|
10822
10861
|
|
|
10823
10862
|
// src/commands/dotnet/inspect.ts
|
|
10824
|
-
import
|
|
10863
|
+
import chalk118 from "chalk";
|
|
10825
10864
|
|
|
10826
10865
|
// src/shared/formatElapsed.ts
|
|
10827
10866
|
function formatElapsed(ms) {
|
|
@@ -10833,12 +10872,12 @@ function formatElapsed(ms) {
|
|
|
10833
10872
|
}
|
|
10834
10873
|
|
|
10835
10874
|
// src/commands/dotnet/displayIssues.ts
|
|
10836
|
-
import
|
|
10875
|
+
import chalk113 from "chalk";
|
|
10837
10876
|
var SEVERITY_COLOR = {
|
|
10838
|
-
ERROR:
|
|
10839
|
-
WARNING:
|
|
10840
|
-
SUGGESTION:
|
|
10841
|
-
HINT:
|
|
10877
|
+
ERROR: chalk113.red,
|
|
10878
|
+
WARNING: chalk113.yellow,
|
|
10879
|
+
SUGGESTION: chalk113.cyan,
|
|
10880
|
+
HINT: chalk113.dim
|
|
10842
10881
|
};
|
|
10843
10882
|
function groupByFile(issues) {
|
|
10844
10883
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -10854,15 +10893,15 @@ function groupByFile(issues) {
|
|
|
10854
10893
|
}
|
|
10855
10894
|
function displayIssues(issues) {
|
|
10856
10895
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
10857
|
-
console.log(
|
|
10896
|
+
console.log(chalk113.bold(file));
|
|
10858
10897
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
10859
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
10898
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk113.white;
|
|
10860
10899
|
console.log(
|
|
10861
|
-
` ${
|
|
10900
|
+
` ${chalk113.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
10862
10901
|
);
|
|
10863
10902
|
}
|
|
10864
10903
|
}
|
|
10865
|
-
console.log(
|
|
10904
|
+
console.log(chalk113.dim(`
|
|
10866
10905
|
${issues.length} issue(s) found`));
|
|
10867
10906
|
}
|
|
10868
10907
|
|
|
@@ -10921,12 +10960,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
10921
10960
|
// src/commands/dotnet/resolveSolution.ts
|
|
10922
10961
|
import { existsSync as existsSync31 } from "fs";
|
|
10923
10962
|
import path26 from "path";
|
|
10924
|
-
import
|
|
10963
|
+
import chalk115 from "chalk";
|
|
10925
10964
|
|
|
10926
10965
|
// src/commands/dotnet/findSolution.ts
|
|
10927
10966
|
import { readdirSync as readdirSync4 } from "fs";
|
|
10928
10967
|
import { dirname as dirname18, join as join30 } from "path";
|
|
10929
|
-
import
|
|
10968
|
+
import chalk114 from "chalk";
|
|
10930
10969
|
function findSlnInDir(dir) {
|
|
10931
10970
|
try {
|
|
10932
10971
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join30(dir, f));
|
|
@@ -10942,17 +10981,17 @@ function findSolution() {
|
|
|
10942
10981
|
const slnFiles = findSlnInDir(current);
|
|
10943
10982
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
10944
10983
|
if (slnFiles.length > 1) {
|
|
10945
|
-
console.error(
|
|
10984
|
+
console.error(chalk114.red(`Multiple .sln files found in ${current}:`));
|
|
10946
10985
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
10947
10986
|
console.error(
|
|
10948
|
-
|
|
10987
|
+
chalk114.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
10949
10988
|
);
|
|
10950
10989
|
process.exit(1);
|
|
10951
10990
|
}
|
|
10952
10991
|
if (current === ceiling) break;
|
|
10953
10992
|
current = dirname18(current);
|
|
10954
10993
|
}
|
|
10955
|
-
console.error(
|
|
10994
|
+
console.error(chalk114.red("No .sln file found between cwd and repo root"));
|
|
10956
10995
|
process.exit(1);
|
|
10957
10996
|
}
|
|
10958
10997
|
|
|
@@ -10961,7 +11000,7 @@ function resolveSolution(sln) {
|
|
|
10961
11000
|
if (sln) {
|
|
10962
11001
|
const resolved = path26.resolve(sln);
|
|
10963
11002
|
if (!existsSync31(resolved)) {
|
|
10964
|
-
console.error(
|
|
11003
|
+
console.error(chalk115.red(`Solution file not found: ${resolved}`));
|
|
10965
11004
|
process.exit(1);
|
|
10966
11005
|
}
|
|
10967
11006
|
return resolved;
|
|
@@ -11003,14 +11042,14 @@ import { execSync as execSync27 } from "child_process";
|
|
|
11003
11042
|
import { existsSync as existsSync32, readFileSync as readFileSync27, unlinkSync as unlinkSync7 } from "fs";
|
|
11004
11043
|
import { tmpdir as tmpdir3 } from "os";
|
|
11005
11044
|
import path27 from "path";
|
|
11006
|
-
import
|
|
11045
|
+
import chalk116 from "chalk";
|
|
11007
11046
|
function assertJbInstalled() {
|
|
11008
11047
|
try {
|
|
11009
11048
|
execSync27("jb inspectcode --version", { stdio: "pipe" });
|
|
11010
11049
|
} catch {
|
|
11011
|
-
console.error(
|
|
11050
|
+
console.error(chalk116.red("jb is not installed. Install with:"));
|
|
11012
11051
|
console.error(
|
|
11013
|
-
|
|
11052
|
+
chalk116.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
11014
11053
|
);
|
|
11015
11054
|
process.exit(1);
|
|
11016
11055
|
}
|
|
@@ -11028,11 +11067,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
11028
11067
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
11029
11068
|
process.stderr.write(error.stderr);
|
|
11030
11069
|
}
|
|
11031
|
-
console.error(
|
|
11070
|
+
console.error(chalk116.red("jb inspectcode failed"));
|
|
11032
11071
|
process.exit(1);
|
|
11033
11072
|
}
|
|
11034
11073
|
if (!existsSync32(reportPath)) {
|
|
11035
|
-
console.error(
|
|
11074
|
+
console.error(chalk116.red("Report file not generated"));
|
|
11036
11075
|
process.exit(1);
|
|
11037
11076
|
}
|
|
11038
11077
|
const xml = readFileSync27(reportPath, "utf8");
|
|
@@ -11042,7 +11081,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
11042
11081
|
|
|
11043
11082
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
11044
11083
|
import { execSync as execSync28 } from "child_process";
|
|
11045
|
-
import
|
|
11084
|
+
import chalk117 from "chalk";
|
|
11046
11085
|
function resolveMsbuildPath() {
|
|
11047
11086
|
const { run: run4 } = loadConfig();
|
|
11048
11087
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -11054,9 +11093,9 @@ function assertMsbuildInstalled() {
|
|
|
11054
11093
|
try {
|
|
11055
11094
|
execSync28(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
11056
11095
|
} catch {
|
|
11057
|
-
console.error(
|
|
11096
|
+
console.error(chalk117.red(`msbuild not found at: ${msbuild}`));
|
|
11058
11097
|
console.error(
|
|
11059
|
-
|
|
11098
|
+
chalk117.yellow(
|
|
11060
11099
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
11061
11100
|
)
|
|
11062
11101
|
);
|
|
@@ -11103,17 +11142,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
11103
11142
|
// src/commands/dotnet/inspect.ts
|
|
11104
11143
|
function logScope(changedFiles) {
|
|
11105
11144
|
if (changedFiles === null) {
|
|
11106
|
-
console.log(
|
|
11145
|
+
console.log(chalk118.dim("Inspecting full solution..."));
|
|
11107
11146
|
} else {
|
|
11108
11147
|
console.log(
|
|
11109
|
-
|
|
11148
|
+
chalk118.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
11110
11149
|
);
|
|
11111
11150
|
}
|
|
11112
11151
|
}
|
|
11113
11152
|
function reportResults(issues, elapsed) {
|
|
11114
11153
|
if (issues.length > 0) displayIssues(issues);
|
|
11115
|
-
else console.log(
|
|
11116
|
-
console.log(
|
|
11154
|
+
else console.log(chalk118.green("No issues found"));
|
|
11155
|
+
console.log(chalk118.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
11117
11156
|
if (issues.length > 0) process.exit(1);
|
|
11118
11157
|
}
|
|
11119
11158
|
async function inspect(sln, options2) {
|
|
@@ -11124,7 +11163,7 @@ async function inspect(sln, options2) {
|
|
|
11124
11163
|
const scope = parseScope(options2.scope);
|
|
11125
11164
|
const changedFiles = getChangedCsFiles(scope);
|
|
11126
11165
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
11127
|
-
console.log(
|
|
11166
|
+
console.log(chalk118.green("No changed .cs files found"));
|
|
11128
11167
|
return;
|
|
11129
11168
|
}
|
|
11130
11169
|
logScope(changedFiles);
|
|
@@ -11253,25 +11292,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
11253
11292
|
}
|
|
11254
11293
|
|
|
11255
11294
|
// src/commands/github/printCountTable.ts
|
|
11256
|
-
import
|
|
11295
|
+
import chalk119 from "chalk";
|
|
11257
11296
|
function printCountTable(labelHeader, rows) {
|
|
11258
11297
|
const labelWidth = Math.max(
|
|
11259
11298
|
labelHeader.length,
|
|
11260
11299
|
...rows.map((row) => row.label.length)
|
|
11261
11300
|
);
|
|
11262
11301
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
11263
|
-
console.log(
|
|
11264
|
-
console.log(
|
|
11302
|
+
console.log(chalk119.dim(header));
|
|
11303
|
+
console.log(chalk119.dim("-".repeat(header.length)));
|
|
11265
11304
|
for (const row of rows) {
|
|
11266
11305
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
11267
11306
|
}
|
|
11268
11307
|
}
|
|
11269
11308
|
|
|
11270
11309
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
11271
|
-
import
|
|
11310
|
+
import chalk120 from "chalk";
|
|
11272
11311
|
function printRepoAuthorBreakdown(repos2) {
|
|
11273
11312
|
for (const repo of repos2) {
|
|
11274
|
-
console.log(
|
|
11313
|
+
console.log(chalk120.bold(repo.name));
|
|
11275
11314
|
const authorWidth = Math.max(
|
|
11276
11315
|
0,
|
|
11277
11316
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -11589,7 +11628,7 @@ function registerHandover(program2) {
|
|
|
11589
11628
|
}
|
|
11590
11629
|
|
|
11591
11630
|
// src/commands/jira/acceptanceCriteria.ts
|
|
11592
|
-
import
|
|
11631
|
+
import chalk122 from "chalk";
|
|
11593
11632
|
|
|
11594
11633
|
// src/commands/jira/adfToText.ts
|
|
11595
11634
|
function renderInline(node) {
|
|
@@ -11650,7 +11689,7 @@ function adfToText(doc) {
|
|
|
11650
11689
|
|
|
11651
11690
|
// src/commands/jira/fetchIssue.ts
|
|
11652
11691
|
import { execSync as execSync29 } from "child_process";
|
|
11653
|
-
import
|
|
11692
|
+
import chalk121 from "chalk";
|
|
11654
11693
|
function fetchIssue(issueKey, fields) {
|
|
11655
11694
|
let result;
|
|
11656
11695
|
try {
|
|
@@ -11663,15 +11702,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
11663
11702
|
const stderr = error.stderr;
|
|
11664
11703
|
if (stderr.includes("unauthorized")) {
|
|
11665
11704
|
console.error(
|
|
11666
|
-
|
|
11705
|
+
chalk121.red("Jira authentication expired."),
|
|
11667
11706
|
"Run",
|
|
11668
|
-
|
|
11707
|
+
chalk121.cyan("assist jira auth"),
|
|
11669
11708
|
"to re-authenticate."
|
|
11670
11709
|
);
|
|
11671
11710
|
process.exit(1);
|
|
11672
11711
|
}
|
|
11673
11712
|
}
|
|
11674
|
-
console.error(
|
|
11713
|
+
console.error(chalk121.red(`Failed to fetch ${issueKey}.`));
|
|
11675
11714
|
process.exit(1);
|
|
11676
11715
|
}
|
|
11677
11716
|
return JSON.parse(result);
|
|
@@ -11685,7 +11724,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
11685
11724
|
const parsed = fetchIssue(issueKey, field);
|
|
11686
11725
|
const acValue = parsed?.fields?.[field];
|
|
11687
11726
|
if (!acValue) {
|
|
11688
|
-
console.log(
|
|
11727
|
+
console.log(chalk122.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
11689
11728
|
return;
|
|
11690
11729
|
}
|
|
11691
11730
|
if (typeof acValue === "string") {
|
|
@@ -11780,14 +11819,14 @@ async function jiraAuth() {
|
|
|
11780
11819
|
}
|
|
11781
11820
|
|
|
11782
11821
|
// src/commands/jira/viewIssue.ts
|
|
11783
|
-
import
|
|
11822
|
+
import chalk123 from "chalk";
|
|
11784
11823
|
function viewIssue(issueKey) {
|
|
11785
11824
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
11786
11825
|
const fields = parsed?.fields;
|
|
11787
11826
|
const summary = fields?.summary;
|
|
11788
11827
|
const description = fields?.description;
|
|
11789
11828
|
if (summary) {
|
|
11790
|
-
console.log(
|
|
11829
|
+
console.log(chalk123.bold(summary));
|
|
11791
11830
|
}
|
|
11792
11831
|
if (description) {
|
|
11793
11832
|
if (summary) console.log();
|
|
@@ -11801,7 +11840,7 @@ function viewIssue(issueKey) {
|
|
|
11801
11840
|
}
|
|
11802
11841
|
if (!summary && !description) {
|
|
11803
11842
|
console.log(
|
|
11804
|
-
|
|
11843
|
+
chalk123.yellow(`No summary or description found on ${issueKey}.`)
|
|
11805
11844
|
);
|
|
11806
11845
|
}
|
|
11807
11846
|
}
|
|
@@ -11817,13 +11856,13 @@ function registerJira(program2) {
|
|
|
11817
11856
|
// src/commands/reviewComments.ts
|
|
11818
11857
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
11819
11858
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
11820
|
-
import
|
|
11859
|
+
import chalk124 from "chalk";
|
|
11821
11860
|
async function reviewComments(number) {
|
|
11822
11861
|
if (number) {
|
|
11823
11862
|
try {
|
|
11824
11863
|
execFileSync5("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
11825
11864
|
} catch {
|
|
11826
|
-
console.error(
|
|
11865
|
+
console.error(chalk124.red(`gh pr checkout ${number} failed; aborting.`));
|
|
11827
11866
|
process.exit(1);
|
|
11828
11867
|
}
|
|
11829
11868
|
}
|
|
@@ -11869,15 +11908,15 @@ function registerList(program2) {
|
|
|
11869
11908
|
// src/commands/mermaid/index.ts
|
|
11870
11909
|
import { mkdirSync as mkdirSync12, readdirSync as readdirSync6 } from "fs";
|
|
11871
11910
|
import { resolve as resolve11 } from "path";
|
|
11872
|
-
import
|
|
11911
|
+
import chalk127 from "chalk";
|
|
11873
11912
|
|
|
11874
11913
|
// src/commands/mermaid/exportFile.ts
|
|
11875
11914
|
import { readFileSync as readFileSync30, writeFileSync as writeFileSync26 } from "fs";
|
|
11876
11915
|
import { basename as basename6, extname, resolve as resolve10 } from "path";
|
|
11877
|
-
import
|
|
11916
|
+
import chalk126 from "chalk";
|
|
11878
11917
|
|
|
11879
11918
|
// src/commands/mermaid/renderBlock.ts
|
|
11880
|
-
import
|
|
11919
|
+
import chalk125 from "chalk";
|
|
11881
11920
|
async function renderBlock(krokiUrl, source) {
|
|
11882
11921
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
11883
11922
|
method: "POST",
|
|
@@ -11886,7 +11925,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
11886
11925
|
});
|
|
11887
11926
|
if (!response.ok) {
|
|
11888
11927
|
console.error(
|
|
11889
|
-
|
|
11928
|
+
chalk125.red(
|
|
11890
11929
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
11891
11930
|
)
|
|
11892
11931
|
);
|
|
@@ -11904,19 +11943,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
11904
11943
|
if (onlyIndex !== void 0) {
|
|
11905
11944
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
11906
11945
|
console.error(
|
|
11907
|
-
|
|
11946
|
+
chalk126.red(
|
|
11908
11947
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
11909
11948
|
)
|
|
11910
11949
|
);
|
|
11911
11950
|
process.exit(1);
|
|
11912
11951
|
}
|
|
11913
11952
|
console.log(
|
|
11914
|
-
|
|
11953
|
+
chalk126.gray(
|
|
11915
11954
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
11916
11955
|
)
|
|
11917
11956
|
);
|
|
11918
11957
|
} else {
|
|
11919
|
-
console.log(
|
|
11958
|
+
console.log(chalk126.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
11920
11959
|
}
|
|
11921
11960
|
for (const [i, source] of blocks.entries()) {
|
|
11922
11961
|
const idx = i + 1;
|
|
@@ -11924,7 +11963,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
11924
11963
|
const outPath = resolve10(outDir, `${stem}-${idx}.svg`);
|
|
11925
11964
|
const svg = await renderBlock(krokiUrl, source);
|
|
11926
11965
|
writeFileSync26(outPath, svg, "utf8");
|
|
11927
|
-
console.log(
|
|
11966
|
+
console.log(chalk126.green(` \u2192 ${outPath}`));
|
|
11928
11967
|
}
|
|
11929
11968
|
}
|
|
11930
11969
|
function extractMermaidBlocks(markdown) {
|
|
@@ -11940,18 +11979,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
11940
11979
|
if (options2.index !== void 0) {
|
|
11941
11980
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
11942
11981
|
console.error(
|
|
11943
|
-
|
|
11982
|
+
chalk127.red(`--index must be a positive integer (got ${options2.index})`)
|
|
11944
11983
|
);
|
|
11945
11984
|
process.exit(1);
|
|
11946
11985
|
}
|
|
11947
11986
|
if (!file) {
|
|
11948
|
-
console.error(
|
|
11987
|
+
console.error(chalk127.red("--index requires a file argument"));
|
|
11949
11988
|
process.exit(1);
|
|
11950
11989
|
}
|
|
11951
11990
|
}
|
|
11952
11991
|
const files = file ? [file] : readdirSync6(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
11953
11992
|
if (files.length === 0) {
|
|
11954
|
-
console.log(
|
|
11993
|
+
console.log(chalk127.gray("No markdown files found in current directory."));
|
|
11955
11994
|
return;
|
|
11956
11995
|
}
|
|
11957
11996
|
for (const f of files) {
|
|
@@ -11977,7 +12016,7 @@ function registerMermaid(program2) {
|
|
|
11977
12016
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
11978
12017
|
import { createServer as createServer2 } from "http";
|
|
11979
12018
|
import { dirname as dirname20 } from "path";
|
|
11980
|
-
import
|
|
12019
|
+
import chalk129 from "chalk";
|
|
11981
12020
|
|
|
11982
12021
|
// src/commands/netcap/corsHeaders.ts
|
|
11983
12022
|
var corsHeaders = {
|
|
@@ -12056,7 +12095,7 @@ function createNetcapHandler(options2) {
|
|
|
12056
12095
|
import { cp, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|
|
12057
12096
|
import { networkInterfaces } from "os";
|
|
12058
12097
|
import { join as join37 } from "path";
|
|
12059
|
-
import
|
|
12098
|
+
import chalk128 from "chalk";
|
|
12060
12099
|
|
|
12061
12100
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
12062
12101
|
import { dirname as dirname19, join as join36 } from "path";
|
|
@@ -12100,7 +12139,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
12100
12139
|
const host = lanIPv4();
|
|
12101
12140
|
if (!host) {
|
|
12102
12141
|
console.log(
|
|
12103
|
-
|
|
12142
|
+
chalk128.yellow("could not determine the WSL IP for the extension")
|
|
12104
12143
|
);
|
|
12105
12144
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
12106
12145
|
return source;
|
|
@@ -12111,7 +12150,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
12111
12150
|
return WSL_WINDOWS_PATH;
|
|
12112
12151
|
} catch {
|
|
12113
12152
|
console.log(
|
|
12114
|
-
|
|
12153
|
+
chalk128.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
12115
12154
|
);
|
|
12116
12155
|
return source;
|
|
12117
12156
|
}
|
|
@@ -12144,30 +12183,30 @@ async function netcap(options2) {
|
|
|
12144
12183
|
let count6 = 0;
|
|
12145
12184
|
const handler = createNetcapHandler({
|
|
12146
12185
|
outPath,
|
|
12147
|
-
onPing: () => console.log(
|
|
12186
|
+
onPing: () => console.log(chalk129.dim("ping from extension")),
|
|
12148
12187
|
onCapture: (entry) => {
|
|
12149
12188
|
count6 += 1;
|
|
12150
12189
|
console.log(
|
|
12151
|
-
|
|
12152
|
-
|
|
12190
|
+
chalk129.green(`captured #${count6}`),
|
|
12191
|
+
chalk129.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
12153
12192
|
);
|
|
12154
12193
|
}
|
|
12155
12194
|
});
|
|
12156
12195
|
const server = createServer2(handler);
|
|
12157
12196
|
server.listen(port, () => {
|
|
12158
12197
|
console.log(
|
|
12159
|
-
|
|
12198
|
+
chalk129.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
12160
12199
|
);
|
|
12161
|
-
console.log(
|
|
12200
|
+
console.log(chalk129.dim(`appending captures to ${outPath}`));
|
|
12162
12201
|
if (filter)
|
|
12163
|
-
console.log(
|
|
12164
|
-
console.log(
|
|
12165
|
-
console.log(
|
|
12202
|
+
console.log(chalk129.dim(`forwarding only URLs matching "${filter}"`));
|
|
12203
|
+
console.log(chalk129.dim(`load the unpacked extension from ${extensionPath}`));
|
|
12204
|
+
console.log(chalk129.dim("press Ctrl-C to stop"));
|
|
12166
12205
|
});
|
|
12167
12206
|
process.on("SIGINT", () => {
|
|
12168
12207
|
server.close();
|
|
12169
12208
|
console.log(
|
|
12170
|
-
|
|
12209
|
+
chalk129.bold(
|
|
12171
12210
|
`
|
|
12172
12211
|
netcap stopped \u2014 captured ${count6} ${count6 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
12173
12212
|
)
|
|
@@ -12179,7 +12218,7 @@ netcap stopped \u2014 captured ${count6} ${count6 === 1 ? "entry" : "entries"} t
|
|
|
12179
12218
|
// src/commands/netcap/netcapExtract.ts
|
|
12180
12219
|
import { writeFileSync as writeFileSync27 } from "fs";
|
|
12181
12220
|
import { join as join40 } from "path";
|
|
12182
|
-
import
|
|
12221
|
+
import chalk130 from "chalk";
|
|
12183
12222
|
|
|
12184
12223
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
12185
12224
|
import { readFileSync as readFileSync31 } from "fs";
|
|
@@ -12627,8 +12666,8 @@ function netcapExtract(file) {
|
|
|
12627
12666
|
writeFileSync27(outFile, `${JSON.stringify(posts, null, 2)}
|
|
12628
12667
|
`);
|
|
12629
12668
|
console.log(
|
|
12630
|
-
|
|
12631
|
-
|
|
12669
|
+
chalk130.green(`extracted ${posts.length} posts`),
|
|
12670
|
+
chalk130.dim(`-> ${outFile}`)
|
|
12632
12671
|
);
|
|
12633
12672
|
}
|
|
12634
12673
|
|
|
@@ -12649,7 +12688,7 @@ function registerNetcap(program2) {
|
|
|
12649
12688
|
}
|
|
12650
12689
|
|
|
12651
12690
|
// src/commands/news/add/index.ts
|
|
12652
|
-
import
|
|
12691
|
+
import chalk131 from "chalk";
|
|
12653
12692
|
import enquirer8 from "enquirer";
|
|
12654
12693
|
async function add2(url) {
|
|
12655
12694
|
if (!url) {
|
|
@@ -12671,10 +12710,10 @@ async function add2(url) {
|
|
|
12671
12710
|
const { orm } = await getReady();
|
|
12672
12711
|
const added = await addFeed(orm, url);
|
|
12673
12712
|
if (!added) {
|
|
12674
|
-
console.log(
|
|
12713
|
+
console.log(chalk131.yellow("Feed already exists"));
|
|
12675
12714
|
return;
|
|
12676
12715
|
}
|
|
12677
|
-
console.log(
|
|
12716
|
+
console.log(chalk131.green(`Added feed: ${url}`));
|
|
12678
12717
|
}
|
|
12679
12718
|
|
|
12680
12719
|
// src/commands/registerNews.ts
|
|
@@ -12684,7 +12723,7 @@ function registerNews(program2) {
|
|
|
12684
12723
|
}
|
|
12685
12724
|
|
|
12686
12725
|
// src/commands/prompts/printPromptsTable.ts
|
|
12687
|
-
import
|
|
12726
|
+
import chalk132 from "chalk";
|
|
12688
12727
|
function truncate(str, max) {
|
|
12689
12728
|
if (str.length <= max) return str;
|
|
12690
12729
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -12702,14 +12741,14 @@ function printPromptsTable(rows) {
|
|
|
12702
12741
|
"Command".padEnd(commandWidth),
|
|
12703
12742
|
"Repos"
|
|
12704
12743
|
].join(" ");
|
|
12705
|
-
console.log(
|
|
12706
|
-
console.log(
|
|
12744
|
+
console.log(chalk132.dim(header));
|
|
12745
|
+
console.log(chalk132.dim("-".repeat(header.length)));
|
|
12707
12746
|
for (const row of rows) {
|
|
12708
12747
|
const count6 = String(row.count).padStart(countWidth);
|
|
12709
12748
|
const tool = row.tool.padEnd(toolWidth);
|
|
12710
12749
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
12711
12750
|
console.log(
|
|
12712
|
-
`${
|
|
12751
|
+
`${chalk132.yellow(count6)} ${tool} ${command} ${chalk132.dim(row.repos)}`
|
|
12713
12752
|
);
|
|
12714
12753
|
}
|
|
12715
12754
|
}
|
|
@@ -13258,20 +13297,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
13258
13297
|
}
|
|
13259
13298
|
|
|
13260
13299
|
// src/commands/prs/listComments/printComments.ts
|
|
13261
|
-
import
|
|
13300
|
+
import chalk133 from "chalk";
|
|
13262
13301
|
function formatForHuman(comment3) {
|
|
13263
13302
|
if (comment3.type === "review") {
|
|
13264
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
13303
|
+
const stateColor = comment3.state === "APPROVED" ? chalk133.green : comment3.state === "CHANGES_REQUESTED" ? chalk133.red : chalk133.yellow;
|
|
13265
13304
|
return [
|
|
13266
|
-
`${
|
|
13305
|
+
`${chalk133.cyan("Review")} by ${chalk133.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
13267
13306
|
comment3.body,
|
|
13268
13307
|
""
|
|
13269
13308
|
].join("\n");
|
|
13270
13309
|
}
|
|
13271
13310
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
13272
13311
|
return [
|
|
13273
|
-
`${
|
|
13274
|
-
|
|
13312
|
+
`${chalk133.cyan("Line comment")} by ${chalk133.bold(comment3.user)} on ${chalk133.dim(`${comment3.path}${location}`)}`,
|
|
13313
|
+
chalk133.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
13275
13314
|
comment3.body,
|
|
13276
13315
|
""
|
|
13277
13316
|
].join("\n");
|
|
@@ -13361,13 +13400,13 @@ import { execSync as execSync38 } from "child_process";
|
|
|
13361
13400
|
import enquirer9 from "enquirer";
|
|
13362
13401
|
|
|
13363
13402
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
13364
|
-
import
|
|
13403
|
+
import chalk134 from "chalk";
|
|
13365
13404
|
var STATUS_MAP = {
|
|
13366
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
13367
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
13405
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk134.magenta("merged"), date: pr.mergedAt } : null,
|
|
13406
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk134.red("closed"), date: pr.closedAt } : null
|
|
13368
13407
|
};
|
|
13369
13408
|
function defaultStatus(pr) {
|
|
13370
|
-
return { label:
|
|
13409
|
+
return { label: chalk134.green("opened"), date: pr.createdAt };
|
|
13371
13410
|
}
|
|
13372
13411
|
function getStatus2(pr) {
|
|
13373
13412
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -13376,11 +13415,11 @@ function formatDate(dateStr) {
|
|
|
13376
13415
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
13377
13416
|
}
|
|
13378
13417
|
function formatPrHeader(pr, status2) {
|
|
13379
|
-
return `${
|
|
13418
|
+
return `${chalk134.cyan(`#${pr.number}`)} ${pr.title} ${chalk134.dim(`(${pr.author.login},`)} ${status2.label} ${chalk134.dim(`${formatDate(status2.date)})`)}`;
|
|
13380
13419
|
}
|
|
13381
13420
|
function logPrDetails(pr) {
|
|
13382
13421
|
console.log(
|
|
13383
|
-
|
|
13422
|
+
chalk134.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
13384
13423
|
);
|
|
13385
13424
|
console.log();
|
|
13386
13425
|
}
|
|
@@ -13687,10 +13726,10 @@ function registerPrs(program2) {
|
|
|
13687
13726
|
}
|
|
13688
13727
|
|
|
13689
13728
|
// src/commands/ravendb/ravendbAuth.ts
|
|
13690
|
-
import
|
|
13729
|
+
import chalk140 from "chalk";
|
|
13691
13730
|
|
|
13692
13731
|
// src/shared/createConnectionAuth.ts
|
|
13693
|
-
import
|
|
13732
|
+
import chalk135 from "chalk";
|
|
13694
13733
|
function listConnections(connections, format2) {
|
|
13695
13734
|
if (connections.length === 0) {
|
|
13696
13735
|
console.log("No connections configured.");
|
|
@@ -13703,7 +13742,7 @@ function listConnections(connections, format2) {
|
|
|
13703
13742
|
function removeConnection(connections, name, save) {
|
|
13704
13743
|
const filtered = connections.filter((c) => c.name !== name);
|
|
13705
13744
|
if (filtered.length === connections.length) {
|
|
13706
|
-
console.error(
|
|
13745
|
+
console.error(chalk135.red(`Connection "${name}" not found.`));
|
|
13707
13746
|
process.exit(1);
|
|
13708
13747
|
}
|
|
13709
13748
|
save(filtered);
|
|
@@ -13749,15 +13788,15 @@ function saveConnections(connections) {
|
|
|
13749
13788
|
}
|
|
13750
13789
|
|
|
13751
13790
|
// src/commands/ravendb/promptConnection.ts
|
|
13752
|
-
import
|
|
13791
|
+
import chalk138 from "chalk";
|
|
13753
13792
|
|
|
13754
13793
|
// src/commands/ravendb/selectOpSecret.ts
|
|
13755
|
-
import
|
|
13794
|
+
import chalk137 from "chalk";
|
|
13756
13795
|
import Enquirer2 from "enquirer";
|
|
13757
13796
|
|
|
13758
13797
|
// src/commands/ravendb/searchItems.ts
|
|
13759
13798
|
import { execSync as execSync41 } from "child_process";
|
|
13760
|
-
import
|
|
13799
|
+
import chalk136 from "chalk";
|
|
13761
13800
|
function opExec(args) {
|
|
13762
13801
|
return execSync41(`op ${args}`, {
|
|
13763
13802
|
encoding: "utf8",
|
|
@@ -13770,7 +13809,7 @@ function searchItems(search2) {
|
|
|
13770
13809
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
13771
13810
|
} catch {
|
|
13772
13811
|
console.error(
|
|
13773
|
-
|
|
13812
|
+
chalk136.red(
|
|
13774
13813
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
13775
13814
|
)
|
|
13776
13815
|
);
|
|
@@ -13784,7 +13823,7 @@ function getItemFields(itemId) {
|
|
|
13784
13823
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
13785
13824
|
return item.fields.filter((f) => f.reference && f.label);
|
|
13786
13825
|
} catch {
|
|
13787
|
-
console.error(
|
|
13826
|
+
console.error(chalk136.red("Failed to get item details from 1Password."));
|
|
13788
13827
|
process.exit(1);
|
|
13789
13828
|
}
|
|
13790
13829
|
}
|
|
@@ -13803,7 +13842,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
13803
13842
|
}).run();
|
|
13804
13843
|
const items2 = searchItems(search2);
|
|
13805
13844
|
if (items2.length === 0) {
|
|
13806
|
-
console.error(
|
|
13845
|
+
console.error(chalk137.red(`No items found matching "${search2}".`));
|
|
13807
13846
|
process.exit(1);
|
|
13808
13847
|
}
|
|
13809
13848
|
const itemId = await selectOne(
|
|
@@ -13812,7 +13851,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
13812
13851
|
);
|
|
13813
13852
|
const fields = getItemFields(itemId);
|
|
13814
13853
|
if (fields.length === 0) {
|
|
13815
|
-
console.error(
|
|
13854
|
+
console.error(chalk137.red("No fields with references found on this item."));
|
|
13816
13855
|
process.exit(1);
|
|
13817
13856
|
}
|
|
13818
13857
|
const ref = await selectOne(
|
|
@@ -13826,7 +13865,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
13826
13865
|
async function promptConnection(existingNames) {
|
|
13827
13866
|
const name = await promptInput("name", "Connection name:");
|
|
13828
13867
|
if (existingNames.includes(name)) {
|
|
13829
|
-
console.error(
|
|
13868
|
+
console.error(chalk138.red(`Connection "${name}" already exists.`));
|
|
13830
13869
|
process.exit(1);
|
|
13831
13870
|
}
|
|
13832
13871
|
const url = await promptInput(
|
|
@@ -13835,22 +13874,22 @@ async function promptConnection(existingNames) {
|
|
|
13835
13874
|
);
|
|
13836
13875
|
const database = await promptInput("database", "Database name:");
|
|
13837
13876
|
if (!name || !url || !database) {
|
|
13838
|
-
console.error(
|
|
13877
|
+
console.error(chalk138.red("All fields are required."));
|
|
13839
13878
|
process.exit(1);
|
|
13840
13879
|
}
|
|
13841
13880
|
const apiKeyRef = await selectOpSecret();
|
|
13842
|
-
console.log(
|
|
13881
|
+
console.log(chalk138.dim(`Using: ${apiKeyRef}`));
|
|
13843
13882
|
return { name, url, database, apiKeyRef };
|
|
13844
13883
|
}
|
|
13845
13884
|
|
|
13846
13885
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
13847
|
-
import
|
|
13886
|
+
import chalk139 from "chalk";
|
|
13848
13887
|
function ravendbSetConnection(name) {
|
|
13849
13888
|
const raw = loadGlobalConfigRaw();
|
|
13850
13889
|
const ravendb = raw.ravendb ?? {};
|
|
13851
13890
|
const connections = ravendb.connections ?? [];
|
|
13852
13891
|
if (!connections.some((c) => c.name === name)) {
|
|
13853
|
-
console.error(
|
|
13892
|
+
console.error(chalk139.red(`Connection "${name}" not found.`));
|
|
13854
13893
|
console.error(
|
|
13855
13894
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
13856
13895
|
);
|
|
@@ -13866,16 +13905,16 @@ function ravendbSetConnection(name) {
|
|
|
13866
13905
|
var ravendbAuth = createConnectionAuth({
|
|
13867
13906
|
load: loadConnections,
|
|
13868
13907
|
save: saveConnections,
|
|
13869
|
-
format: (c) => `${
|
|
13908
|
+
format: (c) => `${chalk140.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
13870
13909
|
promptNew: promptConnection,
|
|
13871
13910
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
13872
13911
|
});
|
|
13873
13912
|
|
|
13874
13913
|
// src/commands/ravendb/ravendbCollections.ts
|
|
13875
|
-
import
|
|
13914
|
+
import chalk144 from "chalk";
|
|
13876
13915
|
|
|
13877
13916
|
// src/commands/ravendb/ravenFetch.ts
|
|
13878
|
-
import
|
|
13917
|
+
import chalk142 from "chalk";
|
|
13879
13918
|
|
|
13880
13919
|
// src/commands/ravendb/getAccessToken.ts
|
|
13881
13920
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -13912,10 +13951,10 @@ ${errorText}`
|
|
|
13912
13951
|
|
|
13913
13952
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
13914
13953
|
import { execSync as execSync42 } from "child_process";
|
|
13915
|
-
import
|
|
13954
|
+
import chalk141 from "chalk";
|
|
13916
13955
|
function resolveOpSecret(reference) {
|
|
13917
13956
|
if (!reference.startsWith("op://")) {
|
|
13918
|
-
console.error(
|
|
13957
|
+
console.error(chalk141.red(`Invalid secret reference: must start with op://`));
|
|
13919
13958
|
process.exit(1);
|
|
13920
13959
|
}
|
|
13921
13960
|
try {
|
|
@@ -13925,7 +13964,7 @@ function resolveOpSecret(reference) {
|
|
|
13925
13964
|
}).trim();
|
|
13926
13965
|
} catch {
|
|
13927
13966
|
console.error(
|
|
13928
|
-
|
|
13967
|
+
chalk141.red(
|
|
13929
13968
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
13930
13969
|
)
|
|
13931
13970
|
);
|
|
@@ -13952,7 +13991,7 @@ async function ravenFetch(connection, path57) {
|
|
|
13952
13991
|
if (!response.ok) {
|
|
13953
13992
|
const body = await response.text();
|
|
13954
13993
|
console.error(
|
|
13955
|
-
|
|
13994
|
+
chalk142.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
13956
13995
|
);
|
|
13957
13996
|
console.error(body.substring(0, 500));
|
|
13958
13997
|
process.exit(1);
|
|
@@ -13961,7 +14000,7 @@ async function ravenFetch(connection, path57) {
|
|
|
13961
14000
|
}
|
|
13962
14001
|
|
|
13963
14002
|
// src/commands/ravendb/resolveConnection.ts
|
|
13964
|
-
import
|
|
14003
|
+
import chalk143 from "chalk";
|
|
13965
14004
|
function loadRavendb() {
|
|
13966
14005
|
const raw = loadGlobalConfigRaw();
|
|
13967
14006
|
const ravendb = raw.ravendb;
|
|
@@ -13975,7 +14014,7 @@ function resolveConnection(name) {
|
|
|
13975
14014
|
const connectionName = name ?? defaultConnection;
|
|
13976
14015
|
if (!connectionName) {
|
|
13977
14016
|
console.error(
|
|
13978
|
-
|
|
14017
|
+
chalk143.red(
|
|
13979
14018
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
13980
14019
|
)
|
|
13981
14020
|
);
|
|
@@ -13983,7 +14022,7 @@ function resolveConnection(name) {
|
|
|
13983
14022
|
}
|
|
13984
14023
|
const connection = connections.find((c) => c.name === connectionName);
|
|
13985
14024
|
if (!connection) {
|
|
13986
|
-
console.error(
|
|
14025
|
+
console.error(chalk143.red(`Connection "${connectionName}" not found.`));
|
|
13987
14026
|
console.error(
|
|
13988
14027
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
13989
14028
|
);
|
|
@@ -14014,15 +14053,15 @@ async function ravendbCollections(connectionName) {
|
|
|
14014
14053
|
return;
|
|
14015
14054
|
}
|
|
14016
14055
|
for (const c of collections) {
|
|
14017
|
-
console.log(`${
|
|
14056
|
+
console.log(`${chalk144.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
14018
14057
|
}
|
|
14019
14058
|
}
|
|
14020
14059
|
|
|
14021
14060
|
// src/commands/ravendb/ravendbQuery.ts
|
|
14022
|
-
import
|
|
14061
|
+
import chalk146 from "chalk";
|
|
14023
14062
|
|
|
14024
14063
|
// src/commands/ravendb/fetchAllPages.ts
|
|
14025
|
-
import
|
|
14064
|
+
import chalk145 from "chalk";
|
|
14026
14065
|
|
|
14027
14066
|
// src/commands/ravendb/buildQueryPath.ts
|
|
14028
14067
|
function buildQueryPath(opts) {
|
|
@@ -14060,7 +14099,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
14060
14099
|
allResults.push(...results);
|
|
14061
14100
|
start3 += results.length;
|
|
14062
14101
|
process.stderr.write(
|
|
14063
|
-
`\r${
|
|
14102
|
+
`\r${chalk145.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
14064
14103
|
);
|
|
14065
14104
|
if (start3 >= totalResults) break;
|
|
14066
14105
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -14075,7 +14114,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
14075
14114
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
14076
14115
|
const resolved = resolveArgs(connectionName, collection);
|
|
14077
14116
|
if (!resolved.collection && !options2.query) {
|
|
14078
|
-
console.error(
|
|
14117
|
+
console.error(chalk146.red("Provide a collection name or --query filter."));
|
|
14079
14118
|
process.exit(1);
|
|
14080
14119
|
}
|
|
14081
14120
|
const { collection: col } = resolved;
|
|
@@ -14113,7 +14152,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
14113
14152
|
import * as path28 from "path";
|
|
14114
14153
|
|
|
14115
14154
|
// src/commands/refactor/logViolations.ts
|
|
14116
|
-
import
|
|
14155
|
+
import chalk147 from "chalk";
|
|
14117
14156
|
var DEFAULT_MAX_LINES = 100;
|
|
14118
14157
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
14119
14158
|
if (violations.length === 0) {
|
|
@@ -14122,43 +14161,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
14122
14161
|
}
|
|
14123
14162
|
return;
|
|
14124
14163
|
}
|
|
14125
|
-
console.error(
|
|
14164
|
+
console.error(chalk147.red(`
|
|
14126
14165
|
Refactor check failed:
|
|
14127
14166
|
`));
|
|
14128
|
-
console.error(
|
|
14167
|
+
console.error(chalk147.red(` The following files exceed ${maxLines} lines:
|
|
14129
14168
|
`));
|
|
14130
14169
|
for (const violation of violations) {
|
|
14131
|
-
console.error(
|
|
14170
|
+
console.error(chalk147.red(` ${violation.file} (${violation.lines} lines)`));
|
|
14132
14171
|
}
|
|
14133
14172
|
console.error(
|
|
14134
|
-
|
|
14173
|
+
chalk147.yellow(
|
|
14135
14174
|
`
|
|
14136
14175
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
14137
14176
|
way to refactor it, ignore it with:
|
|
14138
14177
|
`
|
|
14139
14178
|
)
|
|
14140
14179
|
);
|
|
14141
|
-
console.error(
|
|
14180
|
+
console.error(chalk147.gray(` assist refactor ignore <file>
|
|
14142
14181
|
`));
|
|
14143
14182
|
if (process.env.CLAUDECODE) {
|
|
14144
|
-
console.error(
|
|
14183
|
+
console.error(chalk147.cyan(`
|
|
14145
14184
|
## Extracting Code to New Files
|
|
14146
14185
|
`));
|
|
14147
14186
|
console.error(
|
|
14148
|
-
|
|
14187
|
+
chalk147.cyan(
|
|
14149
14188
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
14150
14189
|
`
|
|
14151
14190
|
)
|
|
14152
14191
|
);
|
|
14153
14192
|
console.error(
|
|
14154
|
-
|
|
14193
|
+
chalk147.cyan(
|
|
14155
14194
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
14156
14195
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
14157
14196
|
`
|
|
14158
14197
|
)
|
|
14159
14198
|
);
|
|
14160
14199
|
console.error(
|
|
14161
|
-
|
|
14200
|
+
chalk147.cyan(
|
|
14162
14201
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
14163
14202
|
domains, move it to a common/shared folder.
|
|
14164
14203
|
`
|
|
@@ -14314,7 +14353,7 @@ async function check(pattern2, options2) {
|
|
|
14314
14353
|
|
|
14315
14354
|
// src/commands/refactor/extract/index.ts
|
|
14316
14355
|
import path35 from "path";
|
|
14317
|
-
import
|
|
14356
|
+
import chalk150 from "chalk";
|
|
14318
14357
|
|
|
14319
14358
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
14320
14359
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -14889,23 +14928,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
14889
14928
|
|
|
14890
14929
|
// src/commands/refactor/extract/displayPlan.ts
|
|
14891
14930
|
import path32 from "path";
|
|
14892
|
-
import
|
|
14931
|
+
import chalk148 from "chalk";
|
|
14893
14932
|
function section(title) {
|
|
14894
14933
|
return `
|
|
14895
|
-
${
|
|
14934
|
+
${chalk148.cyan(title)}`;
|
|
14896
14935
|
}
|
|
14897
14936
|
function displayImporters(plan2, cwd) {
|
|
14898
14937
|
if (plan2.importersToUpdate.length === 0) return;
|
|
14899
14938
|
console.log(section("Update importers:"));
|
|
14900
14939
|
for (const imp of plan2.importersToUpdate) {
|
|
14901
14940
|
const rel = path32.relative(cwd, imp.file.getFilePath());
|
|
14902
|
-
console.log(` ${
|
|
14941
|
+
console.log(` ${chalk148.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
14903
14942
|
}
|
|
14904
14943
|
}
|
|
14905
14944
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
14906
|
-
console.log(
|
|
14945
|
+
console.log(chalk148.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
14907
14946
|
`));
|
|
14908
|
-
console.log(` ${
|
|
14947
|
+
console.log(` ${chalk148.cyan("Functions to move:")}`);
|
|
14909
14948
|
for (const name of plan2.extractedNames) {
|
|
14910
14949
|
console.log(` ${name}`);
|
|
14911
14950
|
}
|
|
@@ -14939,7 +14978,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
14939
14978
|
|
|
14940
14979
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
14941
14980
|
import path34 from "path";
|
|
14942
|
-
import
|
|
14981
|
+
import chalk149 from "chalk";
|
|
14943
14982
|
import { Project as Project4 } from "ts-morph";
|
|
14944
14983
|
|
|
14945
14984
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -14999,7 +15038,7 @@ function loadProjectFile(file) {
|
|
|
14999
15038
|
});
|
|
15000
15039
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
15001
15040
|
if (!sourceFile) {
|
|
15002
|
-
console.log(
|
|
15041
|
+
console.log(chalk149.red(`File not found in project: ${file}`));
|
|
15003
15042
|
process.exit(1);
|
|
15004
15043
|
}
|
|
15005
15044
|
return { project, sourceFile };
|
|
@@ -15022,19 +15061,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
15022
15061
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
15023
15062
|
if (options2.apply) {
|
|
15024
15063
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
15025
|
-
console.log(
|
|
15064
|
+
console.log(chalk150.green("\nExtraction complete"));
|
|
15026
15065
|
} else {
|
|
15027
|
-
console.log(
|
|
15066
|
+
console.log(chalk150.dim("\nDry run. Use --apply to execute."));
|
|
15028
15067
|
}
|
|
15029
15068
|
}
|
|
15030
15069
|
|
|
15031
15070
|
// src/commands/refactor/ignore.ts
|
|
15032
15071
|
import fs22 from "fs";
|
|
15033
|
-
import
|
|
15072
|
+
import chalk151 from "chalk";
|
|
15034
15073
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
15035
15074
|
function ignore(file) {
|
|
15036
15075
|
if (!fs22.existsSync(file)) {
|
|
15037
|
-
console.error(
|
|
15076
|
+
console.error(chalk151.red(`Error: File does not exist: ${file}`));
|
|
15038
15077
|
process.exit(1);
|
|
15039
15078
|
}
|
|
15040
15079
|
const content = fs22.readFileSync(file, "utf8");
|
|
@@ -15050,7 +15089,7 @@ function ignore(file) {
|
|
|
15050
15089
|
fs22.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
15051
15090
|
}
|
|
15052
15091
|
console.log(
|
|
15053
|
-
|
|
15092
|
+
chalk151.green(
|
|
15054
15093
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
15055
15094
|
)
|
|
15056
15095
|
);
|
|
@@ -15059,12 +15098,12 @@ function ignore(file) {
|
|
|
15059
15098
|
// src/commands/refactor/rename/index.ts
|
|
15060
15099
|
import fs25 from "fs";
|
|
15061
15100
|
import path40 from "path";
|
|
15062
|
-
import
|
|
15101
|
+
import chalk154 from "chalk";
|
|
15063
15102
|
|
|
15064
15103
|
// src/commands/refactor/rename/applyRename.ts
|
|
15065
15104
|
import fs24 from "fs";
|
|
15066
15105
|
import path37 from "path";
|
|
15067
|
-
import
|
|
15106
|
+
import chalk152 from "chalk";
|
|
15068
15107
|
|
|
15069
15108
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
15070
15109
|
import path36 from "path";
|
|
@@ -15169,13 +15208,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
15169
15208
|
const updatedContents = applyRewrites(rewrites);
|
|
15170
15209
|
for (const [file, content] of updatedContents) {
|
|
15171
15210
|
fs24.writeFileSync(file, content, "utf8");
|
|
15172
|
-
console.log(
|
|
15211
|
+
console.log(chalk152.cyan(` Updated imports in ${path37.relative(cwd, file)}`));
|
|
15173
15212
|
}
|
|
15174
15213
|
const destDir = path37.dirname(destPath);
|
|
15175
15214
|
if (!fs24.existsSync(destDir)) fs24.mkdirSync(destDir, { recursive: true });
|
|
15176
15215
|
fs24.renameSync(sourcePath, destPath);
|
|
15177
15216
|
console.log(
|
|
15178
|
-
|
|
15217
|
+
chalk152.white(
|
|
15179
15218
|
` Moved ${path37.relative(cwd, sourcePath)} \u2192 ${path37.relative(cwd, destPath)}`
|
|
15180
15219
|
)
|
|
15181
15220
|
);
|
|
@@ -15262,16 +15301,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
15262
15301
|
|
|
15263
15302
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
15264
15303
|
import path39 from "path";
|
|
15265
|
-
import
|
|
15304
|
+
import chalk153 from "chalk";
|
|
15266
15305
|
function printRenamePreview(rewrites, cwd) {
|
|
15267
15306
|
for (const rewrite of rewrites) {
|
|
15268
15307
|
console.log(
|
|
15269
|
-
|
|
15308
|
+
chalk153.dim(
|
|
15270
15309
|
` ${path39.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
15271
15310
|
)
|
|
15272
15311
|
);
|
|
15273
15312
|
}
|
|
15274
|
-
console.log(
|
|
15313
|
+
console.log(chalk153.dim("Dry run. Use --apply to execute."));
|
|
15275
15314
|
}
|
|
15276
15315
|
|
|
15277
15316
|
// src/commands/refactor/rename/index.ts
|
|
@@ -15282,20 +15321,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
15282
15321
|
const relSource = path40.relative(cwd, sourcePath);
|
|
15283
15322
|
const relDest = path40.relative(cwd, destPath);
|
|
15284
15323
|
if (!fs25.existsSync(sourcePath)) {
|
|
15285
|
-
console.log(
|
|
15324
|
+
console.log(chalk154.red(`File not found: ${source}`));
|
|
15286
15325
|
process.exit(1);
|
|
15287
15326
|
}
|
|
15288
15327
|
if (destPath !== sourcePath && fs25.existsSync(destPath)) {
|
|
15289
|
-
console.log(
|
|
15328
|
+
console.log(chalk154.red(`Destination already exists: ${destination}`));
|
|
15290
15329
|
process.exit(1);
|
|
15291
15330
|
}
|
|
15292
|
-
console.log(
|
|
15293
|
-
console.log(
|
|
15294
|
-
console.log(
|
|
15331
|
+
console.log(chalk154.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
15332
|
+
console.log(chalk154.dim("Loading project..."));
|
|
15333
|
+
console.log(chalk154.dim("Scanning imports across the project..."));
|
|
15295
15334
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
15296
15335
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
15297
15336
|
console.log(
|
|
15298
|
-
|
|
15337
|
+
chalk154.dim(
|
|
15299
15338
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
15300
15339
|
)
|
|
15301
15340
|
);
|
|
@@ -15304,11 +15343,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
15304
15343
|
return;
|
|
15305
15344
|
}
|
|
15306
15345
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
15307
|
-
console.log(
|
|
15346
|
+
console.log(chalk154.green("Done"));
|
|
15308
15347
|
}
|
|
15309
15348
|
|
|
15310
15349
|
// src/commands/refactor/renameSymbol/index.ts
|
|
15311
|
-
import
|
|
15350
|
+
import chalk155 from "chalk";
|
|
15312
15351
|
|
|
15313
15352
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
15314
15353
|
import { SyntaxKind as SyntaxKind14 } from "ts-morph";
|
|
@@ -15354,33 +15393,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
15354
15393
|
const { project, sourceFile } = loadProjectFile(file);
|
|
15355
15394
|
const symbol = findSymbol(sourceFile, oldName);
|
|
15356
15395
|
if (!symbol) {
|
|
15357
|
-
console.log(
|
|
15396
|
+
console.log(chalk155.red(`Symbol "${oldName}" not found in ${file}`));
|
|
15358
15397
|
process.exit(1);
|
|
15359
15398
|
}
|
|
15360
15399
|
const grouped = groupReferences(symbol, cwd);
|
|
15361
15400
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
15362
15401
|
console.log(
|
|
15363
|
-
|
|
15402
|
+
chalk155.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
15364
15403
|
`)
|
|
15365
15404
|
);
|
|
15366
15405
|
for (const [refFile, lines] of grouped) {
|
|
15367
15406
|
console.log(
|
|
15368
|
-
` ${
|
|
15407
|
+
` ${chalk155.dim(refFile)}: lines ${chalk155.cyan(lines.join(", "))}`
|
|
15369
15408
|
);
|
|
15370
15409
|
}
|
|
15371
15410
|
if (options2.apply) {
|
|
15372
15411
|
symbol.rename(newName);
|
|
15373
15412
|
await project.save();
|
|
15374
|
-
console.log(
|
|
15413
|
+
console.log(chalk155.green(`
|
|
15375
15414
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
15376
15415
|
} else {
|
|
15377
|
-
console.log(
|
|
15416
|
+
console.log(chalk155.dim("\nDry run. Use --apply to execute."));
|
|
15378
15417
|
}
|
|
15379
15418
|
}
|
|
15380
15419
|
|
|
15381
15420
|
// src/commands/refactor/restructure/index.ts
|
|
15382
15421
|
import path48 from "path";
|
|
15383
|
-
import
|
|
15422
|
+
import chalk158 from "chalk";
|
|
15384
15423
|
|
|
15385
15424
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
15386
15425
|
import path42 from "path";
|
|
@@ -15459,50 +15498,50 @@ function clusterFiles(graph) {
|
|
|
15459
15498
|
|
|
15460
15499
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
15461
15500
|
import path44 from "path";
|
|
15462
|
-
import
|
|
15501
|
+
import chalk156 from "chalk";
|
|
15463
15502
|
function relPath(filePath) {
|
|
15464
15503
|
return path44.relative(process.cwd(), filePath);
|
|
15465
15504
|
}
|
|
15466
15505
|
function displayMoves(plan2) {
|
|
15467
15506
|
if (plan2.moves.length === 0) return;
|
|
15468
|
-
console.log(
|
|
15507
|
+
console.log(chalk156.bold("\nFile moves:"));
|
|
15469
15508
|
for (const move of plan2.moves) {
|
|
15470
15509
|
console.log(
|
|
15471
|
-
` ${
|
|
15510
|
+
` ${chalk156.red(relPath(move.from))} \u2192 ${chalk156.green(relPath(move.to))}`
|
|
15472
15511
|
);
|
|
15473
|
-
console.log(
|
|
15512
|
+
console.log(chalk156.dim(` ${move.reason}`));
|
|
15474
15513
|
}
|
|
15475
15514
|
}
|
|
15476
15515
|
function displayRewrites(rewrites) {
|
|
15477
15516
|
if (rewrites.length === 0) return;
|
|
15478
15517
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
15479
|
-
console.log(
|
|
15518
|
+
console.log(chalk156.bold(`
|
|
15480
15519
|
Import rewrites (${affectedFiles.size} files):`));
|
|
15481
15520
|
for (const file of affectedFiles) {
|
|
15482
|
-
console.log(` ${
|
|
15521
|
+
console.log(` ${chalk156.cyan(relPath(file))}:`);
|
|
15483
15522
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
15484
15523
|
(r) => r.file === file
|
|
15485
15524
|
)) {
|
|
15486
15525
|
console.log(
|
|
15487
|
-
` ${
|
|
15526
|
+
` ${chalk156.red(`"${oldSpecifier}"`)} \u2192 ${chalk156.green(`"${newSpecifier}"`)}`
|
|
15488
15527
|
);
|
|
15489
15528
|
}
|
|
15490
15529
|
}
|
|
15491
15530
|
}
|
|
15492
15531
|
function displayPlan2(plan2) {
|
|
15493
15532
|
if (plan2.warnings.length > 0) {
|
|
15494
|
-
console.log(
|
|
15495
|
-
for (const w of plan2.warnings) console.log(
|
|
15533
|
+
console.log(chalk156.yellow("\nWarnings:"));
|
|
15534
|
+
for (const w of plan2.warnings) console.log(chalk156.yellow(` ${w}`));
|
|
15496
15535
|
}
|
|
15497
15536
|
if (plan2.newDirectories.length > 0) {
|
|
15498
|
-
console.log(
|
|
15537
|
+
console.log(chalk156.bold("\nNew directories:"));
|
|
15499
15538
|
for (const dir of plan2.newDirectories)
|
|
15500
|
-
console.log(
|
|
15539
|
+
console.log(chalk156.green(` ${dir}/`));
|
|
15501
15540
|
}
|
|
15502
15541
|
displayMoves(plan2);
|
|
15503
15542
|
displayRewrites(plan2.rewrites);
|
|
15504
15543
|
console.log(
|
|
15505
|
-
|
|
15544
|
+
chalk156.dim(
|
|
15506
15545
|
`
|
|
15507
15546
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
15508
15547
|
)
|
|
@@ -15512,18 +15551,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
15512
15551
|
// src/commands/refactor/restructure/executePlan.ts
|
|
15513
15552
|
import fs26 from "fs";
|
|
15514
15553
|
import path45 from "path";
|
|
15515
|
-
import
|
|
15554
|
+
import chalk157 from "chalk";
|
|
15516
15555
|
function executePlan(plan2) {
|
|
15517
15556
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
15518
15557
|
for (const [file, content] of updatedContents) {
|
|
15519
15558
|
fs26.writeFileSync(file, content, "utf8");
|
|
15520
15559
|
console.log(
|
|
15521
|
-
|
|
15560
|
+
chalk157.cyan(` Rewrote imports in ${path45.relative(process.cwd(), file)}`)
|
|
15522
15561
|
);
|
|
15523
15562
|
}
|
|
15524
15563
|
for (const dir of plan2.newDirectories) {
|
|
15525
15564
|
fs26.mkdirSync(dir, { recursive: true });
|
|
15526
|
-
console.log(
|
|
15565
|
+
console.log(chalk157.green(` Created ${path45.relative(process.cwd(), dir)}/`));
|
|
15527
15566
|
}
|
|
15528
15567
|
for (const move of plan2.moves) {
|
|
15529
15568
|
const targetDir = path45.dirname(move.to);
|
|
@@ -15532,7 +15571,7 @@ function executePlan(plan2) {
|
|
|
15532
15571
|
}
|
|
15533
15572
|
fs26.renameSync(move.from, move.to);
|
|
15534
15573
|
console.log(
|
|
15535
|
-
|
|
15574
|
+
chalk157.white(
|
|
15536
15575
|
` Moved ${path45.relative(process.cwd(), move.from)} \u2192 ${path45.relative(process.cwd(), move.to)}`
|
|
15537
15576
|
)
|
|
15538
15577
|
);
|
|
@@ -15547,7 +15586,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
15547
15586
|
if (entries.length === 0) {
|
|
15548
15587
|
fs26.rmdirSync(dir);
|
|
15549
15588
|
console.log(
|
|
15550
|
-
|
|
15589
|
+
chalk157.dim(
|
|
15551
15590
|
` Removed empty directory ${path45.relative(process.cwd(), dir)}`
|
|
15552
15591
|
)
|
|
15553
15592
|
);
|
|
@@ -15680,22 +15719,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
15680
15719
|
const targetPattern = pattern2 ?? "src";
|
|
15681
15720
|
const files = findSourceFiles2(targetPattern);
|
|
15682
15721
|
if (files.length === 0) {
|
|
15683
|
-
console.log(
|
|
15722
|
+
console.log(chalk158.yellow("No files found matching pattern"));
|
|
15684
15723
|
return;
|
|
15685
15724
|
}
|
|
15686
15725
|
const tsConfigPath = path48.resolve("tsconfig.json");
|
|
15687
15726
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
15688
15727
|
if (plan2.moves.length === 0) {
|
|
15689
|
-
console.log(
|
|
15728
|
+
console.log(chalk158.green("No restructuring needed"));
|
|
15690
15729
|
return;
|
|
15691
15730
|
}
|
|
15692
15731
|
displayPlan2(plan2);
|
|
15693
15732
|
if (options2.apply) {
|
|
15694
|
-
console.log(
|
|
15733
|
+
console.log(chalk158.bold("\nApplying changes..."));
|
|
15695
15734
|
executePlan(plan2);
|
|
15696
|
-
console.log(
|
|
15735
|
+
console.log(chalk158.green("\nRestructuring complete"));
|
|
15697
15736
|
} else {
|
|
15698
|
-
console.log(
|
|
15737
|
+
console.log(chalk158.dim("\nDry run. Use --apply to execute."));
|
|
15699
15738
|
}
|
|
15700
15739
|
}
|
|
15701
15740
|
|
|
@@ -16264,18 +16303,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
16264
16303
|
}
|
|
16265
16304
|
|
|
16266
16305
|
// src/commands/review/warnOutOfDiff.ts
|
|
16267
|
-
import
|
|
16306
|
+
import chalk159 from "chalk";
|
|
16268
16307
|
function warnOutOfDiff(outOfDiff) {
|
|
16269
16308
|
if (outOfDiff.length === 0) return;
|
|
16270
16309
|
console.warn(
|
|
16271
|
-
|
|
16310
|
+
chalk159.yellow(
|
|
16272
16311
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
16273
16312
|
)
|
|
16274
16313
|
);
|
|
16275
16314
|
for (const finding of outOfDiff) {
|
|
16276
16315
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
16277
16316
|
console.warn(
|
|
16278
|
-
` ${
|
|
16317
|
+
` ${chalk159.yellow("\xB7")} ${finding.title} ${chalk159.dim(
|
|
16279
16318
|
`(${finding.file}:${range})`
|
|
16280
16319
|
)}`
|
|
16281
16320
|
);
|
|
@@ -16294,18 +16333,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
16294
16333
|
}
|
|
16295
16334
|
|
|
16296
16335
|
// src/commands/review/warnUnlocated.ts
|
|
16297
|
-
import
|
|
16336
|
+
import chalk160 from "chalk";
|
|
16298
16337
|
function warnUnlocated(unlocated) {
|
|
16299
16338
|
if (unlocated.length === 0) return;
|
|
16300
16339
|
console.warn(
|
|
16301
|
-
|
|
16340
|
+
chalk160.yellow(
|
|
16302
16341
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
16303
16342
|
)
|
|
16304
16343
|
);
|
|
16305
16344
|
for (const finding of unlocated) {
|
|
16306
|
-
const where = finding.location ||
|
|
16345
|
+
const where = finding.location || chalk160.dim("missing");
|
|
16307
16346
|
console.warn(
|
|
16308
|
-
` ${
|
|
16347
|
+
` ${chalk160.yellow("\xB7")} ${finding.title} ${chalk160.dim(`(${where})`)}`
|
|
16309
16348
|
);
|
|
16310
16349
|
}
|
|
16311
16350
|
}
|
|
@@ -17476,7 +17515,7 @@ function registerReview(program2) {
|
|
|
17476
17515
|
}
|
|
17477
17516
|
|
|
17478
17517
|
// src/commands/seq/seqAuth.ts
|
|
17479
|
-
import
|
|
17518
|
+
import chalk162 from "chalk";
|
|
17480
17519
|
|
|
17481
17520
|
// src/commands/seq/loadConnections.ts
|
|
17482
17521
|
function loadConnections2() {
|
|
@@ -17505,10 +17544,10 @@ function setDefaultConnection(name) {
|
|
|
17505
17544
|
}
|
|
17506
17545
|
|
|
17507
17546
|
// src/shared/assertUniqueName.ts
|
|
17508
|
-
import
|
|
17547
|
+
import chalk161 from "chalk";
|
|
17509
17548
|
function assertUniqueName(existingNames, name) {
|
|
17510
17549
|
if (existingNames.includes(name)) {
|
|
17511
|
-
console.error(
|
|
17550
|
+
console.error(chalk161.red(`Connection "${name}" already exists.`));
|
|
17512
17551
|
process.exit(1);
|
|
17513
17552
|
}
|
|
17514
17553
|
}
|
|
@@ -17526,16 +17565,16 @@ async function promptConnection2(existingNames) {
|
|
|
17526
17565
|
var seqAuth = createConnectionAuth({
|
|
17527
17566
|
load: loadConnections2,
|
|
17528
17567
|
save: saveConnections2,
|
|
17529
|
-
format: (c) => `${
|
|
17568
|
+
format: (c) => `${chalk162.bold(c.name)} ${c.url}`,
|
|
17530
17569
|
promptNew: promptConnection2,
|
|
17531
17570
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
17532
17571
|
});
|
|
17533
17572
|
|
|
17534
17573
|
// src/commands/seq/seqQuery.ts
|
|
17535
|
-
import
|
|
17574
|
+
import chalk166 from "chalk";
|
|
17536
17575
|
|
|
17537
17576
|
// src/commands/seq/fetchSeq.ts
|
|
17538
|
-
import
|
|
17577
|
+
import chalk163 from "chalk";
|
|
17539
17578
|
async function fetchSeq(conn, path57, params) {
|
|
17540
17579
|
const url = `${conn.url}${path57}?${params}`;
|
|
17541
17580
|
const response = await fetch(url, {
|
|
@@ -17546,7 +17585,7 @@ async function fetchSeq(conn, path57, params) {
|
|
|
17546
17585
|
});
|
|
17547
17586
|
if (!response.ok) {
|
|
17548
17587
|
const body = await response.text();
|
|
17549
|
-
console.error(
|
|
17588
|
+
console.error(chalk163.red(`Seq returned ${response.status}: ${body}`));
|
|
17550
17589
|
process.exit(1);
|
|
17551
17590
|
}
|
|
17552
17591
|
return response;
|
|
@@ -17605,23 +17644,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
17605
17644
|
}
|
|
17606
17645
|
|
|
17607
17646
|
// src/commands/seq/formatEvent.ts
|
|
17608
|
-
import
|
|
17647
|
+
import chalk164 from "chalk";
|
|
17609
17648
|
function levelColor(level) {
|
|
17610
17649
|
switch (level) {
|
|
17611
17650
|
case "Fatal":
|
|
17612
|
-
return
|
|
17651
|
+
return chalk164.bgRed.white;
|
|
17613
17652
|
case "Error":
|
|
17614
|
-
return
|
|
17653
|
+
return chalk164.red;
|
|
17615
17654
|
case "Warning":
|
|
17616
|
-
return
|
|
17655
|
+
return chalk164.yellow;
|
|
17617
17656
|
case "Information":
|
|
17618
|
-
return
|
|
17657
|
+
return chalk164.cyan;
|
|
17619
17658
|
case "Debug":
|
|
17620
|
-
return
|
|
17659
|
+
return chalk164.gray;
|
|
17621
17660
|
case "Verbose":
|
|
17622
|
-
return
|
|
17661
|
+
return chalk164.dim;
|
|
17623
17662
|
default:
|
|
17624
|
-
return
|
|
17663
|
+
return chalk164.white;
|
|
17625
17664
|
}
|
|
17626
17665
|
}
|
|
17627
17666
|
function levelAbbrev(level) {
|
|
@@ -17662,12 +17701,12 @@ function formatTimestamp(iso) {
|
|
|
17662
17701
|
function formatEvent(event) {
|
|
17663
17702
|
const color = levelColor(event.Level);
|
|
17664
17703
|
const abbrev = levelAbbrev(event.Level);
|
|
17665
|
-
const ts8 =
|
|
17704
|
+
const ts8 = chalk164.dim(formatTimestamp(event.Timestamp));
|
|
17666
17705
|
const msg = renderMessage(event);
|
|
17667
17706
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
17668
17707
|
if (event.Exception) {
|
|
17669
17708
|
for (const line of event.Exception.split("\n")) {
|
|
17670
|
-
lines.push(
|
|
17709
|
+
lines.push(chalk164.red(` ${line}`));
|
|
17671
17710
|
}
|
|
17672
17711
|
}
|
|
17673
17712
|
return lines.join("\n");
|
|
@@ -17700,11 +17739,11 @@ function rejectTimestampFilter(filter) {
|
|
|
17700
17739
|
}
|
|
17701
17740
|
|
|
17702
17741
|
// src/shared/resolveNamedConnection.ts
|
|
17703
|
-
import
|
|
17742
|
+
import chalk165 from "chalk";
|
|
17704
17743
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
17705
17744
|
if (connections.length === 0) {
|
|
17706
17745
|
console.error(
|
|
17707
|
-
|
|
17746
|
+
chalk165.red(
|
|
17708
17747
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
17709
17748
|
)
|
|
17710
17749
|
);
|
|
@@ -17713,7 +17752,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
17713
17752
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
17714
17753
|
const connection = connections.find((c) => c.name === target);
|
|
17715
17754
|
if (!connection) {
|
|
17716
|
-
console.error(
|
|
17755
|
+
console.error(chalk165.red(`${kind} connection "${target}" not found.`));
|
|
17717
17756
|
process.exit(1);
|
|
17718
17757
|
}
|
|
17719
17758
|
return connection;
|
|
@@ -17742,7 +17781,7 @@ async function seqQuery(filter, options2) {
|
|
|
17742
17781
|
new URLSearchParams({ filter, count: String(count6) })
|
|
17743
17782
|
);
|
|
17744
17783
|
if (events.length === 0) {
|
|
17745
|
-
console.log(
|
|
17784
|
+
console.log(chalk166.yellow("No events found."));
|
|
17746
17785
|
return;
|
|
17747
17786
|
}
|
|
17748
17787
|
if (options2.json) {
|
|
@@ -17753,11 +17792,11 @@ async function seqQuery(filter, options2) {
|
|
|
17753
17792
|
for (const event of chronological) {
|
|
17754
17793
|
console.log(formatEvent(event));
|
|
17755
17794
|
}
|
|
17756
|
-
console.log(
|
|
17795
|
+
console.log(chalk166.dim(`
|
|
17757
17796
|
${events.length} events`));
|
|
17758
17797
|
if (events.length >= count6) {
|
|
17759
17798
|
console.log(
|
|
17760
|
-
|
|
17799
|
+
chalk166.yellow(
|
|
17761
17800
|
`Results limited to ${count6}. Use --count to retrieve more.`
|
|
17762
17801
|
)
|
|
17763
17802
|
);
|
|
@@ -17765,10 +17804,10 @@ ${events.length} events`));
|
|
|
17765
17804
|
}
|
|
17766
17805
|
|
|
17767
17806
|
// src/shared/setNamedDefaultConnection.ts
|
|
17768
|
-
import
|
|
17807
|
+
import chalk167 from "chalk";
|
|
17769
17808
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
17770
17809
|
if (!connections.find((c) => c.name === name)) {
|
|
17771
|
-
console.error(
|
|
17810
|
+
console.error(chalk167.red(`Connection "${name}" not found.`));
|
|
17772
17811
|
process.exit(1);
|
|
17773
17812
|
}
|
|
17774
17813
|
setDefault(name);
|
|
@@ -17816,7 +17855,7 @@ function registerSignal(program2) {
|
|
|
17816
17855
|
}
|
|
17817
17856
|
|
|
17818
17857
|
// src/commands/sql/sqlAuth.ts
|
|
17819
|
-
import
|
|
17858
|
+
import chalk169 from "chalk";
|
|
17820
17859
|
|
|
17821
17860
|
// src/commands/sql/loadConnections.ts
|
|
17822
17861
|
function loadConnections3() {
|
|
@@ -17845,7 +17884,7 @@ function setDefaultConnection2(name) {
|
|
|
17845
17884
|
}
|
|
17846
17885
|
|
|
17847
17886
|
// src/commands/sql/promptConnection.ts
|
|
17848
|
-
import
|
|
17887
|
+
import chalk168 from "chalk";
|
|
17849
17888
|
async function promptConnection3(existingNames) {
|
|
17850
17889
|
const name = await promptInput("name", "Connection name:", "default");
|
|
17851
17890
|
assertUniqueName(existingNames, name);
|
|
@@ -17853,7 +17892,7 @@ async function promptConnection3(existingNames) {
|
|
|
17853
17892
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
17854
17893
|
const port = Number.parseInt(portStr, 10);
|
|
17855
17894
|
if (!Number.isFinite(port)) {
|
|
17856
|
-
console.error(
|
|
17895
|
+
console.error(chalk168.red(`Invalid port "${portStr}".`));
|
|
17857
17896
|
process.exit(1);
|
|
17858
17897
|
}
|
|
17859
17898
|
const user = await promptInput("user", "User:");
|
|
@@ -17866,13 +17905,13 @@ async function promptConnection3(existingNames) {
|
|
|
17866
17905
|
var sqlAuth = createConnectionAuth({
|
|
17867
17906
|
load: loadConnections3,
|
|
17868
17907
|
save: saveConnections3,
|
|
17869
|
-
format: (c) => `${
|
|
17908
|
+
format: (c) => `${chalk169.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
17870
17909
|
promptNew: promptConnection3,
|
|
17871
17910
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
17872
17911
|
});
|
|
17873
17912
|
|
|
17874
17913
|
// src/commands/sql/printTable.ts
|
|
17875
|
-
import
|
|
17914
|
+
import chalk170 from "chalk";
|
|
17876
17915
|
function formatCell(value) {
|
|
17877
17916
|
if (value === null || value === void 0) return "";
|
|
17878
17917
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -17881,7 +17920,7 @@ function formatCell(value) {
|
|
|
17881
17920
|
}
|
|
17882
17921
|
function printTable(rows) {
|
|
17883
17922
|
if (rows.length === 0) {
|
|
17884
|
-
console.log(
|
|
17923
|
+
console.log(chalk170.yellow("(no rows)"));
|
|
17885
17924
|
return;
|
|
17886
17925
|
}
|
|
17887
17926
|
const columns = Object.keys(rows[0]);
|
|
@@ -17889,13 +17928,13 @@ function printTable(rows) {
|
|
|
17889
17928
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
17890
17929
|
);
|
|
17891
17930
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
17892
|
-
console.log(
|
|
17893
|
-
console.log(
|
|
17931
|
+
console.log(chalk170.dim(header));
|
|
17932
|
+
console.log(chalk170.dim("-".repeat(header.length)));
|
|
17894
17933
|
for (const row of rows) {
|
|
17895
17934
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
17896
17935
|
console.log(line);
|
|
17897
17936
|
}
|
|
17898
|
-
console.log(
|
|
17937
|
+
console.log(chalk170.dim(`
|
|
17899
17938
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
17900
17939
|
}
|
|
17901
17940
|
|
|
@@ -17955,7 +17994,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
17955
17994
|
}
|
|
17956
17995
|
|
|
17957
17996
|
// src/commands/sql/sqlMutate.ts
|
|
17958
|
-
import
|
|
17997
|
+
import chalk171 from "chalk";
|
|
17959
17998
|
|
|
17960
17999
|
// src/commands/sql/isMutation.ts
|
|
17961
18000
|
var MUTATION_KEYWORDS = [
|
|
@@ -17989,7 +18028,7 @@ function isMutation(sql6) {
|
|
|
17989
18028
|
async function sqlMutate(query, connectionName) {
|
|
17990
18029
|
if (!isMutation(query)) {
|
|
17991
18030
|
console.error(
|
|
17992
|
-
|
|
18031
|
+
chalk171.red(
|
|
17993
18032
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
17994
18033
|
)
|
|
17995
18034
|
);
|
|
@@ -17999,18 +18038,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
17999
18038
|
const pool = await sqlConnect(conn);
|
|
18000
18039
|
try {
|
|
18001
18040
|
const result = await pool.request().query(query);
|
|
18002
|
-
console.log(
|
|
18041
|
+
console.log(chalk171.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
18003
18042
|
} finally {
|
|
18004
18043
|
await pool.close();
|
|
18005
18044
|
}
|
|
18006
18045
|
}
|
|
18007
18046
|
|
|
18008
18047
|
// src/commands/sql/sqlQuery.ts
|
|
18009
|
-
import
|
|
18048
|
+
import chalk172 from "chalk";
|
|
18010
18049
|
async function sqlQuery(query, connectionName) {
|
|
18011
18050
|
if (isMutation(query)) {
|
|
18012
18051
|
console.error(
|
|
18013
|
-
|
|
18052
|
+
chalk172.red(
|
|
18014
18053
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
18015
18054
|
)
|
|
18016
18055
|
);
|
|
@@ -18025,7 +18064,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
18025
18064
|
printTable(rows);
|
|
18026
18065
|
} else {
|
|
18027
18066
|
console.log(
|
|
18028
|
-
|
|
18067
|
+
chalk172.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
18029
18068
|
);
|
|
18030
18069
|
}
|
|
18031
18070
|
} finally {
|
|
@@ -18605,14 +18644,14 @@ import {
|
|
|
18605
18644
|
import { dirname as dirname24, join as join50 } from "path";
|
|
18606
18645
|
|
|
18607
18646
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
18608
|
-
import
|
|
18647
|
+
import chalk173 from "chalk";
|
|
18609
18648
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
18610
18649
|
function validateStagedContent(filename, content) {
|
|
18611
18650
|
const firstLine = content.split("\n")[0];
|
|
18612
18651
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
18613
18652
|
if (!match) {
|
|
18614
18653
|
console.error(
|
|
18615
|
-
|
|
18654
|
+
chalk173.red(
|
|
18616
18655
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
18617
18656
|
)
|
|
18618
18657
|
);
|
|
@@ -18621,7 +18660,7 @@ function validateStagedContent(filename, content) {
|
|
|
18621
18660
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
18622
18661
|
if (!contentAfterLink) {
|
|
18623
18662
|
console.error(
|
|
18624
|
-
|
|
18663
|
+
chalk173.red(
|
|
18625
18664
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
18626
18665
|
)
|
|
18627
18666
|
);
|
|
@@ -19023,7 +19062,7 @@ function registerVoice(program2) {
|
|
|
19023
19062
|
|
|
19024
19063
|
// src/commands/roam/auth.ts
|
|
19025
19064
|
import { randomBytes } from "crypto";
|
|
19026
|
-
import
|
|
19065
|
+
import chalk174 from "chalk";
|
|
19027
19066
|
|
|
19028
19067
|
// src/commands/roam/waitForCallback.ts
|
|
19029
19068
|
import { createServer as createServer3 } from "http";
|
|
@@ -19154,13 +19193,13 @@ async function auth() {
|
|
|
19154
19193
|
saveGlobalConfig(config);
|
|
19155
19194
|
const state = randomBytes(16).toString("hex");
|
|
19156
19195
|
console.log(
|
|
19157
|
-
|
|
19196
|
+
chalk174.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
19158
19197
|
);
|
|
19159
|
-
console.log(
|
|
19160
|
-
console.log(
|
|
19161
|
-
console.log(
|
|
19198
|
+
console.log(chalk174.white("http://localhost:14523/callback\n"));
|
|
19199
|
+
console.log(chalk174.blue("Opening browser for authorization..."));
|
|
19200
|
+
console.log(chalk174.dim("Waiting for authorization callback..."));
|
|
19162
19201
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
19163
|
-
console.log(
|
|
19202
|
+
console.log(chalk174.dim("Exchanging code for tokens..."));
|
|
19164
19203
|
const tokens = await exchangeToken({
|
|
19165
19204
|
code,
|
|
19166
19205
|
clientId,
|
|
@@ -19176,7 +19215,7 @@ async function auth() {
|
|
|
19176
19215
|
};
|
|
19177
19216
|
saveGlobalConfig(config);
|
|
19178
19217
|
console.log(
|
|
19179
|
-
|
|
19218
|
+
chalk174.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
19180
19219
|
);
|
|
19181
19220
|
}
|
|
19182
19221
|
|
|
@@ -19628,7 +19667,7 @@ import { execSync as execSync50 } from "child_process";
|
|
|
19628
19667
|
import { existsSync as existsSync51, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync37 } from "fs";
|
|
19629
19668
|
import { tmpdir as tmpdir7 } from "os";
|
|
19630
19669
|
import { join as join61, resolve as resolve15 } from "path";
|
|
19631
|
-
import
|
|
19670
|
+
import chalk175 from "chalk";
|
|
19632
19671
|
|
|
19633
19672
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
19634
19673
|
var captureWindowPs1 = `
|
|
@@ -19779,13 +19818,13 @@ function screenshot(processName) {
|
|
|
19779
19818
|
const config = loadConfig();
|
|
19780
19819
|
const outputDir = resolve15(config.screenshot.outputDir);
|
|
19781
19820
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
19782
|
-
console.log(
|
|
19821
|
+
console.log(chalk175.gray(`Capturing window for process "${processName}" ...`));
|
|
19783
19822
|
try {
|
|
19784
19823
|
runPowerShellScript(processName, outputPath);
|
|
19785
|
-
console.log(
|
|
19824
|
+
console.log(chalk175.green(`Screenshot saved: ${outputPath}`));
|
|
19786
19825
|
} catch (error) {
|
|
19787
19826
|
const msg = error instanceof Error ? error.message : String(error);
|
|
19788
|
-
console.error(
|
|
19827
|
+
console.error(chalk175.red(`Failed to capture screenshot: ${msg}`));
|
|
19789
19828
|
process.exit(1);
|
|
19790
19829
|
}
|
|
19791
19830
|
}
|
|
@@ -20193,21 +20232,23 @@ function spawnRun(opts) {
|
|
|
20193
20232
|
}
|
|
20194
20233
|
|
|
20195
20234
|
// src/commands/sessions/daemon/createSession.ts
|
|
20196
|
-
function
|
|
20235
|
+
function sessionBase(id2, status2) {
|
|
20197
20236
|
const startedAt = Date.now();
|
|
20198
20237
|
return {
|
|
20199
20238
|
id: id2,
|
|
20200
|
-
status:
|
|
20239
|
+
status: status2,
|
|
20201
20240
|
startedAt,
|
|
20202
20241
|
runningMs: 0,
|
|
20203
|
-
|
|
20242
|
+
/* why: runningMs counts only running stretches, so a session that starts
|
|
20243
|
+
* waiting (idle, awaiting first input) has no open stretch to stamp. */
|
|
20244
|
+
runningSince: status2 === "running" ? startedAt : null,
|
|
20204
20245
|
scrollback: ""
|
|
20205
20246
|
};
|
|
20206
20247
|
}
|
|
20207
20248
|
function createSession(id2, prompt, cwd) {
|
|
20208
20249
|
const claudeSessionId = randomUUID4();
|
|
20209
20250
|
return {
|
|
20210
|
-
...
|
|
20251
|
+
...sessionBase(id2, prompt ? "running" : "waiting"),
|
|
20211
20252
|
name: prompt?.slice(0, 40) || `Session ${id2}`,
|
|
20212
20253
|
commandType: "claude",
|
|
20213
20254
|
pty: spawnClaude2({ prompt, cwd, sessionId: id2, claudeSessionId }),
|
|
@@ -20217,7 +20258,7 @@ function createSession(id2, prompt, cwd) {
|
|
|
20217
20258
|
}
|
|
20218
20259
|
function createRunSession(id2, runName, runArgs, cwd) {
|
|
20219
20260
|
return {
|
|
20220
|
-
...
|
|
20261
|
+
...sessionBase(id2, "running"),
|
|
20221
20262
|
name: `run: ${runName}`,
|
|
20222
20263
|
commandType: "run",
|
|
20223
20264
|
pty: spawnRun({ name: runName, args: runArgs, cwd }),
|
|
@@ -20536,26 +20577,6 @@ function refreshActivity(session) {
|
|
|
20536
20577
|
session.claudeSessionId = activity2.claudeSessionId;
|
|
20537
20578
|
}
|
|
20538
20579
|
|
|
20539
|
-
// src/commands/sessions/daemon/noteOutputForThinking.ts
|
|
20540
|
-
var ACTIVATE_MS = 500;
|
|
20541
|
-
var GAP_MS = 1e3;
|
|
20542
|
-
function noteOutputForThinking(session, onStatusChange) {
|
|
20543
|
-
if (session.status !== "waiting") {
|
|
20544
|
-
session.thinkingStreakStart = void 0;
|
|
20545
|
-
session.thinkingLastOutput = void 0;
|
|
20546
|
-
return;
|
|
20547
|
-
}
|
|
20548
|
-
const now = Date.now();
|
|
20549
|
-
const stale = session.thinkingStreakStart == null || session.thinkingLastOutput == null || now - session.thinkingLastOutput > GAP_MS;
|
|
20550
|
-
if (stale) session.thinkingStreakStart = now;
|
|
20551
|
-
session.thinkingLastOutput = now;
|
|
20552
|
-
if (now - (session.thinkingStreakStart ?? now) < ACTIVATE_MS) return;
|
|
20553
|
-
session.thinkingStreakStart = void 0;
|
|
20554
|
-
session.thinkingLastOutput = void 0;
|
|
20555
|
-
daemonLog(`session ${session.id} sustained output while waiting -> running`);
|
|
20556
|
-
onStatusChange(session, "running");
|
|
20557
|
-
}
|
|
20558
|
-
|
|
20559
20580
|
// src/commands/sessions/daemon/wirePtyEvents.ts
|
|
20560
20581
|
var MAX_SCROLLBACK = 256 * 1024;
|
|
20561
20582
|
function appendScrollback(session, data) {
|
|
@@ -20569,7 +20590,6 @@ function wirePtyEvents(session, clients, onStatusChange) {
|
|
|
20569
20590
|
session.pty.onData((data) => {
|
|
20570
20591
|
appendScrollback(session, data);
|
|
20571
20592
|
noteOutputForEscInterrupt(session, onStatusChange);
|
|
20572
|
-
noteOutputForThinking(session, onStatusChange);
|
|
20573
20593
|
broadcast(clients, { type: "output", sessionId: session.id, data });
|
|
20574
20594
|
});
|
|
20575
20595
|
session.pty.onExit(({ exitCode }) => {
|
|
@@ -21832,32 +21852,9 @@ function registerDaemon(program2) {
|
|
|
21832
21852
|
).action(restartDaemon);
|
|
21833
21853
|
}
|
|
21834
21854
|
|
|
21835
|
-
// src/commands/sessions/daemon/sendToDaemon.ts
|
|
21836
|
-
async function sendToDaemon(message) {
|
|
21837
|
-
const socket = await connectToDaemon();
|
|
21838
|
-
const timer = setTimeout(() => socket.destroy(), 500);
|
|
21839
|
-
socket.on("error", () => {
|
|
21840
|
-
});
|
|
21841
|
-
socket.write(`${JSON.stringify(message)}
|
|
21842
|
-
`, () => {
|
|
21843
|
-
clearTimeout(timer);
|
|
21844
|
-
socket.end();
|
|
21845
|
-
});
|
|
21846
|
-
}
|
|
21847
|
-
|
|
21848
|
-
// src/commands/sessions/setSessionStatus.ts
|
|
21849
|
-
async function setSessionStatus(status2) {
|
|
21850
|
-
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
21851
|
-
if (!sessionId) return;
|
|
21852
|
-
try {
|
|
21853
|
-
await sendToDaemon({ type: "set-status", sessionId, status: status2 });
|
|
21854
|
-
} catch {
|
|
21855
|
-
}
|
|
21856
|
-
}
|
|
21857
|
-
|
|
21858
21855
|
// src/commands/sessions/summarise/index.ts
|
|
21859
21856
|
import * as fs34 from "fs";
|
|
21860
|
-
import
|
|
21857
|
+
import chalk176 from "chalk";
|
|
21861
21858
|
|
|
21862
21859
|
// src/commands/sessions/summarise/shared.ts
|
|
21863
21860
|
import * as fs32 from "fs";
|
|
@@ -22011,22 +22008,22 @@ ${firstMessage}`);
|
|
|
22011
22008
|
async function summarise3(options2) {
|
|
22012
22009
|
const files = await discoverSessionFiles();
|
|
22013
22010
|
if (files.length === 0) {
|
|
22014
|
-
console.log(
|
|
22011
|
+
console.log(chalk176.yellow("No sessions found."));
|
|
22015
22012
|
return;
|
|
22016
22013
|
}
|
|
22017
22014
|
const toProcess = selectCandidates(files, options2);
|
|
22018
22015
|
if (toProcess.length === 0) {
|
|
22019
|
-
console.log(
|
|
22016
|
+
console.log(chalk176.green("All sessions already summarised."));
|
|
22020
22017
|
return;
|
|
22021
22018
|
}
|
|
22022
22019
|
console.log(
|
|
22023
|
-
|
|
22020
|
+
chalk176.cyan(
|
|
22024
22021
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
22025
22022
|
)
|
|
22026
22023
|
);
|
|
22027
22024
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
22028
22025
|
console.log(
|
|
22029
|
-
|
|
22026
|
+
chalk176.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk176.yellow(`, ${failed2} skipped`) : "")
|
|
22030
22027
|
);
|
|
22031
22028
|
}
|
|
22032
22029
|
function selectCandidates(files, options2) {
|
|
@@ -22046,16 +22043,16 @@ function processSessions(files) {
|
|
|
22046
22043
|
let failed2 = 0;
|
|
22047
22044
|
for (let i = 0; i < files.length; i++) {
|
|
22048
22045
|
const file = files[i];
|
|
22049
|
-
process.stdout.write(
|
|
22046
|
+
process.stdout.write(chalk176.dim(` [${i + 1}/${files.length}] `));
|
|
22050
22047
|
const summary = summariseSession(file);
|
|
22051
22048
|
if (summary) {
|
|
22052
22049
|
writeSummary(file, summary);
|
|
22053
22050
|
succeeded++;
|
|
22054
|
-
process.stdout.write(`${
|
|
22051
|
+
process.stdout.write(`${chalk176.green("\u2713")} ${summary}
|
|
22055
22052
|
`);
|
|
22056
22053
|
} else {
|
|
22057
22054
|
failed2++;
|
|
22058
|
-
process.stdout.write(` ${
|
|
22055
|
+
process.stdout.write(` ${chalk176.yellow("skip")}
|
|
22059
22056
|
`);
|
|
22060
22057
|
}
|
|
22061
22058
|
}
|
|
@@ -22073,10 +22070,10 @@ function registerSessions(program2) {
|
|
|
22073
22070
|
}
|
|
22074
22071
|
|
|
22075
22072
|
// src/commands/statusLine.ts
|
|
22076
|
-
import
|
|
22073
|
+
import chalk178 from "chalk";
|
|
22077
22074
|
|
|
22078
22075
|
// src/commands/buildLimitsSegment.ts
|
|
22079
|
-
import
|
|
22076
|
+
import chalk177 from "chalk";
|
|
22080
22077
|
|
|
22081
22078
|
// src/shared/rateLimitLevel.ts
|
|
22082
22079
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -22107,9 +22104,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
22107
22104
|
|
|
22108
22105
|
// src/commands/buildLimitsSegment.ts
|
|
22109
22106
|
var LEVEL_COLOR = {
|
|
22110
|
-
ok:
|
|
22111
|
-
warn:
|
|
22112
|
-
over:
|
|
22107
|
+
ok: chalk177.green,
|
|
22108
|
+
warn: chalk177.yellow,
|
|
22109
|
+
over: chalk177.red
|
|
22113
22110
|
};
|
|
22114
22111
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
22115
22112
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -22149,14 +22146,14 @@ async function relayRateLimits(rateLimits) {
|
|
|
22149
22146
|
}
|
|
22150
22147
|
|
|
22151
22148
|
// src/commands/statusLine.ts
|
|
22152
|
-
|
|
22149
|
+
chalk178.level = 3;
|
|
22153
22150
|
function formatNumber(num) {
|
|
22154
22151
|
return num.toLocaleString("en-US");
|
|
22155
22152
|
}
|
|
22156
22153
|
function colorizePercent(pct) {
|
|
22157
22154
|
const label2 = `${Math.round(pct)}%`;
|
|
22158
|
-
if (pct > 80) return
|
|
22159
|
-
if (pct > 40) return
|
|
22155
|
+
if (pct > 80) return chalk178.red(label2);
|
|
22156
|
+
if (pct > 40) return chalk178.yellow(label2);
|
|
22160
22157
|
return label2;
|
|
22161
22158
|
}
|
|
22162
22159
|
async function statusLine() {
|
|
@@ -22180,7 +22177,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
22180
22177
|
// src/commands/sync/syncClaudeMd.ts
|
|
22181
22178
|
import * as fs35 from "fs";
|
|
22182
22179
|
import * as path53 from "path";
|
|
22183
|
-
import
|
|
22180
|
+
import chalk179 from "chalk";
|
|
22184
22181
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
22185
22182
|
const source = path53.join(claudeDir, "CLAUDE.md");
|
|
22186
22183
|
const target = path53.join(targetBase, "CLAUDE.md");
|
|
@@ -22189,12 +22186,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
22189
22186
|
const targetContent = fs35.readFileSync(target, "utf8");
|
|
22190
22187
|
if (sourceContent !== targetContent) {
|
|
22191
22188
|
console.log(
|
|
22192
|
-
|
|
22189
|
+
chalk179.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
22193
22190
|
);
|
|
22194
22191
|
console.log();
|
|
22195
22192
|
printDiff(targetContent, sourceContent);
|
|
22196
22193
|
const confirm = options2?.yes || await promptConfirm(
|
|
22197
|
-
|
|
22194
|
+
chalk179.red("Overwrite existing CLAUDE.md?"),
|
|
22198
22195
|
false
|
|
22199
22196
|
);
|
|
22200
22197
|
if (!confirm) {
|
|
@@ -22210,7 +22207,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
22210
22207
|
// src/commands/sync/syncSettings.ts
|
|
22211
22208
|
import * as fs36 from "fs";
|
|
22212
22209
|
import * as path54 from "path";
|
|
22213
|
-
import
|
|
22210
|
+
import chalk180 from "chalk";
|
|
22214
22211
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
22215
22212
|
const source = path54.join(claudeDir, "settings.json");
|
|
22216
22213
|
const target = path54.join(targetBase, "settings.json");
|
|
@@ -22226,14 +22223,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
22226
22223
|
if (mergedContent !== normalizedTarget) {
|
|
22227
22224
|
if (!options2?.yes) {
|
|
22228
22225
|
console.log(
|
|
22229
|
-
|
|
22226
|
+
chalk180.yellow(
|
|
22230
22227
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
22231
22228
|
)
|
|
22232
22229
|
);
|
|
22233
22230
|
console.log();
|
|
22234
22231
|
printDiff(targetContent, mergedContent);
|
|
22235
22232
|
const confirm = await promptConfirm(
|
|
22236
|
-
|
|
22233
|
+
chalk180.red("Overwrite existing settings.json?"),
|
|
22237
22234
|
false
|
|
22238
22235
|
);
|
|
22239
22236
|
if (!confirm) {
|