@staff0rd/assist 0.435.0 → 0.435.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/commands/sessions/web/bundle.js +384 -384
- package/dist/index.js +735 -707
- 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.435.
|
|
9
|
+
version: "0.435.2",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -5104,7 +5104,7 @@ function registerBackup(program2) {
|
|
|
5104
5104
|
}
|
|
5105
5105
|
|
|
5106
5106
|
// src/commands/backlog/next.ts
|
|
5107
|
-
import
|
|
5107
|
+
import chalk46 from "chalk";
|
|
5108
5108
|
import enquirer5 from "enquirer";
|
|
5109
5109
|
|
|
5110
5110
|
// src/shared/pullIfConfigured.ts
|
|
@@ -5181,17 +5181,21 @@ function isProcessAlive(pid) {
|
|
|
5181
5181
|
return false;
|
|
5182
5182
|
}
|
|
5183
5183
|
}
|
|
5184
|
-
function
|
|
5184
|
+
function foreignLockHolder(itemId2) {
|
|
5185
5185
|
const lockPath = getLockPath(itemId2);
|
|
5186
|
-
if (!existsSync16(lockPath)) return
|
|
5186
|
+
if (!existsSync16(lockPath)) return null;
|
|
5187
5187
|
try {
|
|
5188
5188
|
const lock2 = JSON.parse(readFileSync13(lockPath, "utf8"));
|
|
5189
|
-
if (lock2.pid === process.pid) return
|
|
5190
|
-
|
|
5189
|
+
if (typeof lock2.pid !== "number" || lock2.pid === process.pid) return null;
|
|
5190
|
+
if (!isProcessAlive(lock2.pid)) return null;
|
|
5191
|
+
return { pid: lock2.pid, timestamp: lock2.timestamp };
|
|
5191
5192
|
} catch {
|
|
5192
|
-
return
|
|
5193
|
+
return null;
|
|
5193
5194
|
}
|
|
5194
5195
|
}
|
|
5196
|
+
function isLockedByOther(itemId2) {
|
|
5197
|
+
return foreignLockHolder(itemId2) !== null;
|
|
5198
|
+
}
|
|
5195
5199
|
function acquireLock(itemId2) {
|
|
5196
5200
|
mkdirSync4(getLocksDir(), { recursive: true });
|
|
5197
5201
|
writeFileSync14(
|
|
@@ -5288,7 +5292,7 @@ function findUnblockedTodos(items2) {
|
|
|
5288
5292
|
}
|
|
5289
5293
|
|
|
5290
5294
|
// src/commands/backlog/run.ts
|
|
5291
|
-
import
|
|
5295
|
+
import chalk45 from "chalk";
|
|
5292
5296
|
|
|
5293
5297
|
// src/commands/sessions/daemon/ensureHooksSettings.ts
|
|
5294
5298
|
import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync15 } from "fs";
|
|
@@ -5392,53 +5396,6 @@ function buildArgs(prompt, options2) {
|
|
|
5392
5396
|
return [prompt];
|
|
5393
5397
|
}
|
|
5394
5398
|
|
|
5395
|
-
// src/commands/sessions/daemon/appendDaemonLog.ts
|
|
5396
|
-
import { appendFileSync } from "fs";
|
|
5397
|
-
function appendDaemonLog(message2) {
|
|
5398
|
-
const line = `${(/* @__PURE__ */ new Date()).toISOString()} [${process.pid}] ${message2}`;
|
|
5399
|
-
try {
|
|
5400
|
-
appendFileSync(daemonPaths.log, `${line}
|
|
5401
|
-
`);
|
|
5402
|
-
} catch {
|
|
5403
|
-
}
|
|
5404
|
-
}
|
|
5405
|
-
|
|
5406
|
-
// src/commands/backlog/consumePause.ts
|
|
5407
|
-
import { existsSync as existsSync17, mkdirSync as mkdirSync6, unlinkSync as unlinkSync3, writeFileSync as writeFileSync16 } from "fs";
|
|
5408
|
-
import { homedir as homedir6 } from "os";
|
|
5409
|
-
import { join as join14 } from "path";
|
|
5410
|
-
function getControlsDir() {
|
|
5411
|
-
return join14(homedir6(), ".assist", "controls");
|
|
5412
|
-
}
|
|
5413
|
-
function getPausePath(itemId2) {
|
|
5414
|
-
return join14(getControlsDir(), `pause-${itemId2}.json`);
|
|
5415
|
-
}
|
|
5416
|
-
function requestPause(itemId2) {
|
|
5417
|
-
mkdirSync6(getControlsDir(), { recursive: true });
|
|
5418
|
-
writeFileSync16(
|
|
5419
|
-
getPausePath(itemId2),
|
|
5420
|
-
JSON.stringify({ timestamp: (/* @__PURE__ */ new Date()).toISOString() })
|
|
5421
|
-
);
|
|
5422
|
-
}
|
|
5423
|
-
function isPausePending(itemId2) {
|
|
5424
|
-
return existsSync17(getPausePath(itemId2));
|
|
5425
|
-
}
|
|
5426
|
-
function clearPause(itemId2) {
|
|
5427
|
-
try {
|
|
5428
|
-
unlinkSync3(getPausePath(itemId2));
|
|
5429
|
-
} catch {
|
|
5430
|
-
}
|
|
5431
|
-
}
|
|
5432
|
-
function consumePause(itemId2) {
|
|
5433
|
-
const pausePath = getPausePath(itemId2);
|
|
5434
|
-
if (!existsSync17(pausePath)) return false;
|
|
5435
|
-
try {
|
|
5436
|
-
unlinkSync3(pausePath);
|
|
5437
|
-
} catch {
|
|
5438
|
-
}
|
|
5439
|
-
return true;
|
|
5440
|
-
}
|
|
5441
|
-
|
|
5442
5399
|
// src/commands/branch/createBranch.ts
|
|
5443
5400
|
import { execSync as execSync25 } from "child_process";
|
|
5444
5401
|
|
|
@@ -5587,6 +5544,17 @@ function buildPrompt(description) {
|
|
|
5587
5544
|
].join("\n");
|
|
5588
5545
|
}
|
|
5589
5546
|
|
|
5547
|
+
// src/commands/sessions/daemon/appendDaemonLog.ts
|
|
5548
|
+
import { appendFileSync } from "fs";
|
|
5549
|
+
function appendDaemonLog(message2) {
|
|
5550
|
+
const line = `${(/* @__PURE__ */ new Date()).toISOString()} [${process.pid}] ${message2}`;
|
|
5551
|
+
try {
|
|
5552
|
+
appendFileSync(daemonPaths.log, `${line}
|
|
5553
|
+
`);
|
|
5554
|
+
} catch {
|
|
5555
|
+
}
|
|
5556
|
+
}
|
|
5557
|
+
|
|
5590
5558
|
// src/commands/backlog/ensureStoryBranch.ts
|
|
5591
5559
|
async function ensureStoryBranch(item) {
|
|
5592
5560
|
const config = loadConfig();
|
|
@@ -5607,19 +5575,19 @@ function hasBranchRef(item) {
|
|
|
5607
5575
|
import chalk37 from "chalk";
|
|
5608
5576
|
|
|
5609
5577
|
// src/commands/backlog/migrateLocalBacklog.ts
|
|
5610
|
-
import { existsSync as
|
|
5611
|
-
import { join as
|
|
5578
|
+
import { existsSync as existsSync18 } from "fs";
|
|
5579
|
+
import { join as join15 } from "path";
|
|
5612
5580
|
import chalk36 from "chalk";
|
|
5613
5581
|
|
|
5614
5582
|
// src/commands/backlog/backupLocalBacklogFiles.ts
|
|
5615
|
-
import { existsSync as
|
|
5616
|
-
import { join as
|
|
5583
|
+
import { existsSync as existsSync17, renameSync } from "fs";
|
|
5584
|
+
import { join as join14 } from "path";
|
|
5617
5585
|
var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
|
|
5618
5586
|
function backupLocalBacklogFiles(dir) {
|
|
5619
5587
|
const moved = [];
|
|
5620
5588
|
for (const name of LOCAL_FILES) {
|
|
5621
|
-
const path71 =
|
|
5622
|
-
if (
|
|
5589
|
+
const path71 = join14(dir, ".assist", name);
|
|
5590
|
+
if (existsSync17(path71)) {
|
|
5623
5591
|
renameSync(path71, `${path71}.bak`);
|
|
5624
5592
|
moved.push(`${name} \u2192 ${name}.bak`);
|
|
5625
5593
|
}
|
|
@@ -6100,7 +6068,7 @@ function parseBacklogJsonl(path71) {
|
|
|
6100
6068
|
|
|
6101
6069
|
// src/commands/backlog/migrateLocalBacklog.ts
|
|
6102
6070
|
function jsonlPath(dir) {
|
|
6103
|
-
return
|
|
6071
|
+
return join15(dir, ".assist", "backlog.jsonl");
|
|
6104
6072
|
}
|
|
6105
6073
|
async function verifyImport(orm, origin, items2, imported) {
|
|
6106
6074
|
const reloaded = await loadAllItems(orm, origin);
|
|
@@ -6116,7 +6084,7 @@ async function verifyImport(orm, origin, items2, imported) {
|
|
|
6116
6084
|
}
|
|
6117
6085
|
}
|
|
6118
6086
|
async function migrateLocalBacklog(orm, dir, origin) {
|
|
6119
|
-
if (!
|
|
6087
|
+
if (!existsSync18(jsonlPath(dir))) return;
|
|
6120
6088
|
const existing = (await loadAllItems(orm, origin)).length;
|
|
6121
6089
|
if (existing > 0) {
|
|
6122
6090
|
const moved2 = backupLocalBacklogFiles(dir);
|
|
@@ -6155,17 +6123,17 @@ async function deleteItem(orm, id) {
|
|
|
6155
6123
|
}
|
|
6156
6124
|
|
|
6157
6125
|
// src/commands/backlog/findBacklogUp.ts
|
|
6158
|
-
import { existsSync as
|
|
6159
|
-
import { dirname as dirname13, join as
|
|
6126
|
+
import { existsSync as existsSync19 } from "fs";
|
|
6127
|
+
import { dirname as dirname13, join as join16 } from "path";
|
|
6160
6128
|
var BACKLOG_MARKERS = [
|
|
6161
|
-
|
|
6162
|
-
|
|
6129
|
+
join16(".assist", "backlog.db"),
|
|
6130
|
+
join16(".assist", "backlog.jsonl"),
|
|
6163
6131
|
"assist.backlog.yml"
|
|
6164
6132
|
];
|
|
6165
6133
|
function findBacklogUp(startDir) {
|
|
6166
6134
|
let current = startDir;
|
|
6167
6135
|
while (current !== dirname13(current)) {
|
|
6168
|
-
if (BACKLOG_MARKERS.some((marker) =>
|
|
6136
|
+
if (BACKLOG_MARKERS.some((marker) => existsSync19(join16(current, marker)))) {
|
|
6169
6137
|
return current;
|
|
6170
6138
|
}
|
|
6171
6139
|
current = dirname13(current);
|
|
@@ -6408,12 +6376,58 @@ async function prepareRun(id, resumeSessionId) {
|
|
|
6408
6376
|
return { item, plan: plan2, startPhase };
|
|
6409
6377
|
}
|
|
6410
6378
|
|
|
6379
|
+
// src/commands/backlog/reportDuplicateRun.ts
|
|
6380
|
+
import chalk39 from "chalk";
|
|
6381
|
+
function reportDuplicateRun(itemId2, holder) {
|
|
6382
|
+
const since = holder.timestamp ? `, started ${holder.timestamp}` : "";
|
|
6383
|
+
const reason = `another session is already running it (pid ${holder.pid}${since}); close that session before running it again`;
|
|
6384
|
+
console.log(chalk39.yellow(`Already running: ${formatItemId(itemId2)}`));
|
|
6385
|
+
console.log(chalk39.dim(`Refusing to start a second run \u2014 ${reason}.`));
|
|
6386
|
+
appendDaemonLog(`backlog run ${itemId2}: refused \u2014 ${reason}`);
|
|
6387
|
+
}
|
|
6388
|
+
|
|
6389
|
+
// src/commands/backlog/consumePause.ts
|
|
6390
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync6, unlinkSync as unlinkSync3, writeFileSync as writeFileSync16 } from "fs";
|
|
6391
|
+
import { homedir as homedir6 } from "os";
|
|
6392
|
+
import { join as join17 } from "path";
|
|
6393
|
+
function getControlsDir() {
|
|
6394
|
+
return join17(homedir6(), ".assist", "controls");
|
|
6395
|
+
}
|
|
6396
|
+
function getPausePath(itemId2) {
|
|
6397
|
+
return join17(getControlsDir(), `pause-${itemId2}.json`);
|
|
6398
|
+
}
|
|
6399
|
+
function requestPause(itemId2) {
|
|
6400
|
+
mkdirSync6(getControlsDir(), { recursive: true });
|
|
6401
|
+
writeFileSync16(
|
|
6402
|
+
getPausePath(itemId2),
|
|
6403
|
+
JSON.stringify({ timestamp: (/* @__PURE__ */ new Date()).toISOString() })
|
|
6404
|
+
);
|
|
6405
|
+
}
|
|
6406
|
+
function isPausePending(itemId2) {
|
|
6407
|
+
return existsSync20(getPausePath(itemId2));
|
|
6408
|
+
}
|
|
6409
|
+
function clearPause(itemId2) {
|
|
6410
|
+
try {
|
|
6411
|
+
unlinkSync3(getPausePath(itemId2));
|
|
6412
|
+
} catch {
|
|
6413
|
+
}
|
|
6414
|
+
}
|
|
6415
|
+
function consumePause(itemId2) {
|
|
6416
|
+
const pausePath = getPausePath(itemId2);
|
|
6417
|
+
if (!existsSync20(pausePath)) return false;
|
|
6418
|
+
try {
|
|
6419
|
+
unlinkSync3(pausePath);
|
|
6420
|
+
} catch {
|
|
6421
|
+
}
|
|
6422
|
+
return true;
|
|
6423
|
+
}
|
|
6424
|
+
|
|
6411
6425
|
// src/commands/backlog/executePhase.ts
|
|
6412
6426
|
import { randomUUID } from "crypto";
|
|
6413
|
-
import
|
|
6427
|
+
import chalk44 from "chalk";
|
|
6414
6428
|
|
|
6415
6429
|
// src/shared/awaitClaude.ts
|
|
6416
|
-
import
|
|
6430
|
+
import chalk40 from "chalk";
|
|
6417
6431
|
var CLAUDE_SPAWN_FAILED = null;
|
|
6418
6432
|
async function awaitClaude(done2, context) {
|
|
6419
6433
|
try {
|
|
@@ -6421,7 +6435,7 @@ async function awaitClaude(done2, context) {
|
|
|
6421
6435
|
} catch (error) {
|
|
6422
6436
|
const message2 = error instanceof Error ? error.message : String(error);
|
|
6423
6437
|
console.error(
|
|
6424
|
-
|
|
6438
|
+
chalk40.red(`
|
|
6425
6439
|
Failed to launch Claude for ${context}: ${message2}`)
|
|
6426
6440
|
);
|
|
6427
6441
|
return CLAUDE_SPAWN_FAILED;
|
|
@@ -6716,7 +6730,7 @@ import { existsSync as existsSync22, readFileSync as readFileSync16 } from "fs";
|
|
|
6716
6730
|
import { mkdirSync as mkdirSync8, writeFileSync as writeFileSync18 } from "fs";
|
|
6717
6731
|
import { homedir as homedir8 } from "os";
|
|
6718
6732
|
import { dirname as dirname15, join as join19 } from "path";
|
|
6719
|
-
import
|
|
6733
|
+
import chalk41 from "chalk";
|
|
6720
6734
|
|
|
6721
6735
|
// src/commands/backlog/recordSignalOwner.ts
|
|
6722
6736
|
import {
|
|
@@ -6769,7 +6783,7 @@ function resolveSignalTarget(event, data) {
|
|
|
6769
6783
|
if (owner) {
|
|
6770
6784
|
if (caller && owner !== caller) {
|
|
6771
6785
|
console.log(
|
|
6772
|
-
|
|
6786
|
+
chalk41.dim(
|
|
6773
6787
|
`Routing ${event} signal for item ${itemId2} to its run (${owner}), not this session (${caller}).`
|
|
6774
6788
|
)
|
|
6775
6789
|
);
|
|
@@ -6778,7 +6792,7 @@ function resolveSignalTarget(event, data) {
|
|
|
6778
6792
|
}
|
|
6779
6793
|
if (caller) {
|
|
6780
6794
|
console.log(
|
|
6781
|
-
|
|
6795
|
+
chalk41.yellow(
|
|
6782
6796
|
`Not signalling ${event} for item ${itemId2}: no live run owns it, and this session (${caller}) does not either.`
|
|
6783
6797
|
)
|
|
6784
6798
|
);
|
|
@@ -6976,7 +6990,7 @@ function reportPhaseActivity(item, phaseNumber, totalPhases, phase, claudeSessio
|
|
|
6976
6990
|
|
|
6977
6991
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
6978
6992
|
import { existsSync as existsSync24, unlinkSync as unlinkSync4 } from "fs";
|
|
6979
|
-
import
|
|
6993
|
+
import chalk42 from "chalk";
|
|
6980
6994
|
|
|
6981
6995
|
// src/commands/backlog/handleIncompletePhase.ts
|
|
6982
6996
|
import enquirer4 from "enquirer";
|
|
@@ -7019,18 +7033,18 @@ async function resolvePhaseResult(phaseIndex, itemId2) {
|
|
|
7019
7033
|
if (signal?.event === "rewind") {
|
|
7020
7034
|
const targetPhase = signal.targetPhase;
|
|
7021
7035
|
const targetPhaseNumber = targetPhase + 1;
|
|
7022
|
-
console.log(
|
|
7036
|
+
console.log(chalk42.yellow(`
|
|
7023
7037
|
Rewinding to phase ${targetPhaseNumber}.`));
|
|
7024
7038
|
return { kind: "rewind", targetPhase };
|
|
7025
7039
|
}
|
|
7026
7040
|
const phaseNumber = phaseIndex + 1;
|
|
7027
|
-
console.log(
|
|
7041
|
+
console.log(chalk42.green(`
|
|
7028
7042
|
Phase ${phaseNumber} completed.`));
|
|
7029
7043
|
return { kind: "advance" };
|
|
7030
7044
|
}
|
|
7031
7045
|
|
|
7032
7046
|
// src/commands/backlog/verifyResumeConversation.ts
|
|
7033
|
-
import
|
|
7047
|
+
import chalk43 from "chalk";
|
|
7034
7048
|
|
|
7035
7049
|
// src/commands/sessions/shared/findSessionJsonlPath.ts
|
|
7036
7050
|
import * as path24 from "path";
|
|
@@ -7247,7 +7261,7 @@ async function findSessionJsonlPath(sessionId) {
|
|
|
7247
7261
|
async function verifyResumeConversation(itemId2, resumeSessionId, phaseLabel2) {
|
|
7248
7262
|
if (await findSessionJsonlPath(resumeSessionId)) return true;
|
|
7249
7263
|
const message2 = `${phaseLabel2}: resume found no conversation for session ${resumeSessionId}; phase not advanced`;
|
|
7250
|
-
console.error(
|
|
7264
|
+
console.error(chalk43.red(`
|
|
7251
7265
|
${message2}`));
|
|
7252
7266
|
appendDaemonLog(`backlog run ${itemId2}: ${message2}`);
|
|
7253
7267
|
try {
|
|
@@ -7271,7 +7285,7 @@ async function executePhase(item, phaseIndex, phases, spawnOptions, totalPhases
|
|
|
7271
7285
|
const phase = phases[phaseIndex];
|
|
7272
7286
|
const phaseNumber = phaseIndex + 1;
|
|
7273
7287
|
console.log(
|
|
7274
|
-
|
|
7288
|
+
chalk44.bold(
|
|
7275
7289
|
`
|
|
7276
7290
|
--- Phase ${phaseNumber}/${totalPhases}: ${phase.name} ---
|
|
7277
7291
|
`
|
|
@@ -7385,8 +7399,31 @@ async function runOnce(item, startPhase, plan2, spawnOptions) {
|
|
|
7385
7399
|
return runReview(item, plan2, reviewOptions);
|
|
7386
7400
|
}
|
|
7387
7401
|
|
|
7402
|
+
// src/commands/backlog/discardStalePause.ts
|
|
7403
|
+
function discardStalePause(itemId2) {
|
|
7404
|
+
if (!isPausePending(itemId2)) return;
|
|
7405
|
+
clearPause(itemId2);
|
|
7406
|
+
appendDaemonLog(
|
|
7407
|
+
`backlog run ${itemId2}: discarded stale pause file at run start; this run starts auto-advancing (Continue on) regardless of a prior run's pause`
|
|
7408
|
+
);
|
|
7409
|
+
}
|
|
7410
|
+
|
|
7388
7411
|
// src/commands/backlog/run.ts
|
|
7389
7412
|
async function run2(id, spawnOptions) {
|
|
7413
|
+
const itemId2 = parseItemId(id);
|
|
7414
|
+
const holder = foreignLockHolder(itemId2);
|
|
7415
|
+
if (holder) {
|
|
7416
|
+
reportDuplicateRun(itemId2, holder);
|
|
7417
|
+
return false;
|
|
7418
|
+
}
|
|
7419
|
+
acquireLock(itemId2);
|
|
7420
|
+
try {
|
|
7421
|
+
return await runLocked(id, spawnOptions);
|
|
7422
|
+
} finally {
|
|
7423
|
+
releaseLock(itemId2);
|
|
7424
|
+
}
|
|
7425
|
+
}
|
|
7426
|
+
async function runLocked(id, spawnOptions) {
|
|
7390
7427
|
const prepared = await prepareRun(id, spawnOptions?.resumeSessionId);
|
|
7391
7428
|
if (!prepared) return false;
|
|
7392
7429
|
await ensureStoryBranch(prepared.item);
|
|
@@ -7395,17 +7432,9 @@ async function run2(id, spawnOptions) {
|
|
|
7395
7432
|
logProgress(prepared);
|
|
7396
7433
|
return runPrepared(id, prepared, spawnOptions);
|
|
7397
7434
|
}
|
|
7398
|
-
function discardStalePause(itemId2) {
|
|
7399
|
-
if (!isPausePending(itemId2)) return;
|
|
7400
|
-
clearPause(itemId2);
|
|
7401
|
-
appendDaemonLog(
|
|
7402
|
-
`backlog run ${itemId2}: discarded stale pause file at run start; this run starts auto-advancing (Continue on) regardless of a prior run's pause`
|
|
7403
|
-
);
|
|
7404
|
-
}
|
|
7405
7435
|
async function runPrepared(id, prepared, spawnOptions) {
|
|
7406
7436
|
const { item } = prepared;
|
|
7407
7437
|
let { plan: plan2, startPhase } = prepared;
|
|
7408
|
-
acquireLock(item.id);
|
|
7409
7438
|
try {
|
|
7410
7439
|
while (true) {
|
|
7411
7440
|
const review2 = await runOnce(item, startPhase, plan2, spawnOptions);
|
|
@@ -7418,23 +7447,22 @@ async function runPrepared(id, prepared, spawnOptions) {
|
|
|
7418
7447
|
plan2 = outcome.plan;
|
|
7419
7448
|
}
|
|
7420
7449
|
} finally {
|
|
7421
|
-
releaseLock(item.id);
|
|
7422
7450
|
clearSignalOwner(item.id);
|
|
7423
7451
|
}
|
|
7424
7452
|
}
|
|
7425
7453
|
function logProgress({ plan: plan2, startPhase, item }) {
|
|
7426
7454
|
console.log(
|
|
7427
|
-
|
|
7455
|
+
chalk45.bold(`Running plan for ${formatItemId(item.id)}: ${item.name}`)
|
|
7428
7456
|
);
|
|
7429
7457
|
const totalPhases = plan2.length + 1;
|
|
7430
7458
|
if (startPhase > 0) {
|
|
7431
7459
|
const phaseNumber = startPhase + 1;
|
|
7432
7460
|
console.log(
|
|
7433
|
-
|
|
7461
|
+
chalk45.dim(`Resuming from phase ${phaseNumber}/${totalPhases}
|
|
7434
7462
|
`)
|
|
7435
7463
|
);
|
|
7436
7464
|
} else {
|
|
7437
|
-
console.log(
|
|
7465
|
+
console.log(chalk45.dim(`${totalPhases} phase(s)
|
|
7438
7466
|
`));
|
|
7439
7467
|
}
|
|
7440
7468
|
}
|
|
@@ -7442,7 +7470,7 @@ function logProgress({ plan: plan2, startPhase, item }) {
|
|
|
7442
7470
|
// src/commands/backlog/next.ts
|
|
7443
7471
|
function toChoice(item, items2) {
|
|
7444
7472
|
const name = `${typeLabel(item.type)} ${formatItemId(item.id)}: ${item.name}`;
|
|
7445
|
-
return isBlocked(item, items2) ? { name, disabled:
|
|
7473
|
+
return isBlocked(item, items2) ? { name, disabled: chalk46.red("[blocked]") } : { name };
|
|
7446
7474
|
}
|
|
7447
7475
|
async function selectItem(todo, items2) {
|
|
7448
7476
|
const { selected } = await exitOnCancel(
|
|
@@ -7459,7 +7487,7 @@ function pickResumable(items2) {
|
|
|
7459
7487
|
const resumable = findResumable(items2);
|
|
7460
7488
|
if (!resumable) return void 0;
|
|
7461
7489
|
console.log(
|
|
7462
|
-
|
|
7490
|
+
chalk46.bold(
|
|
7463
7491
|
`Resuming in-progress item ${formatItemId(resumable.id)}: ${resumable.name}`
|
|
7464
7492
|
)
|
|
7465
7493
|
);
|
|
@@ -7468,7 +7496,7 @@ function pickResumable(items2) {
|
|
|
7468
7496
|
function autoSelect(unblocked) {
|
|
7469
7497
|
const item = unblocked[0];
|
|
7470
7498
|
console.log(
|
|
7471
|
-
|
|
7499
|
+
chalk46.bold(`Auto-selecting item ${formatItemId(item.id)}: ${item.name}`)
|
|
7472
7500
|
);
|
|
7473
7501
|
return formatItemId(item.id);
|
|
7474
7502
|
}
|
|
@@ -7496,20 +7524,20 @@ async function next(options2, startId) {
|
|
|
7496
7524
|
}
|
|
7497
7525
|
|
|
7498
7526
|
// src/commands/backlog/phaseDone.ts
|
|
7499
|
-
import
|
|
7527
|
+
import chalk48 from "chalk";
|
|
7500
7528
|
|
|
7501
7529
|
// src/commands/backlog/checkSubtasksComplete.ts
|
|
7502
|
-
import
|
|
7530
|
+
import chalk47 from "chalk";
|
|
7503
7531
|
function checkSubtasksComplete(item) {
|
|
7504
7532
|
const pending = (item.subtasks ?? []).filter((s) => s.status !== "done");
|
|
7505
7533
|
if (pending.length === 0) return true;
|
|
7506
7534
|
console.log(
|
|
7507
|
-
|
|
7535
|
+
chalk47.red(
|
|
7508
7536
|
`Cannot complete item ${formatItemId(item.id)}: ${pending.length} incomplete sub-task(s):`
|
|
7509
7537
|
)
|
|
7510
7538
|
);
|
|
7511
7539
|
for (const subtask of pending) {
|
|
7512
|
-
console.log(
|
|
7540
|
+
console.log(chalk47.yellow(` - [${subtask.status}] ${subtask.title}`));
|
|
7513
7541
|
}
|
|
7514
7542
|
return false;
|
|
7515
7543
|
}
|
|
@@ -7523,7 +7551,7 @@ async function phaseDone(id, phase, summary) {
|
|
|
7523
7551
|
const { orm } = await getReady();
|
|
7524
7552
|
const item = await loadItem(orm, itemId2);
|
|
7525
7553
|
if (item === void 0) {
|
|
7526
|
-
console.log(
|
|
7554
|
+
console.log(chalk48.red(`Item ${label2} not found.`));
|
|
7527
7555
|
return;
|
|
7528
7556
|
}
|
|
7529
7557
|
function signal() {
|
|
@@ -7536,7 +7564,7 @@ async function phaseDone(id, phase, summary) {
|
|
|
7536
7564
|
if (item.status === "done") {
|
|
7537
7565
|
signal();
|
|
7538
7566
|
console.log(
|
|
7539
|
-
|
|
7567
|
+
chalk48.dim(`Item ${label2} already done, skipping phase advance.`)
|
|
7540
7568
|
);
|
|
7541
7569
|
return;
|
|
7542
7570
|
}
|
|
@@ -7552,24 +7580,24 @@ async function phaseDone(id, phase, summary) {
|
|
|
7552
7580
|
await setCurrentPhase(id, phaseNumber + 1);
|
|
7553
7581
|
signal();
|
|
7554
7582
|
console.log(
|
|
7555
|
-
|
|
7583
|
+
chalk48.green(`Phase ${phaseNumber} of item ${label2} marked as complete.`)
|
|
7556
7584
|
);
|
|
7557
7585
|
}
|
|
7558
7586
|
|
|
7559
7587
|
// src/commands/backlog/plan.ts
|
|
7560
|
-
import
|
|
7588
|
+
import chalk49 from "chalk";
|
|
7561
7589
|
async function plan(id) {
|
|
7562
7590
|
const found = await findOneItem(id);
|
|
7563
7591
|
if (!found) return;
|
|
7564
7592
|
const { item } = found;
|
|
7565
7593
|
if (!item.plan || item.plan.length === 0) {
|
|
7566
|
-
console.log(
|
|
7594
|
+
console.log(chalk49.dim("No plan defined for this item."));
|
|
7567
7595
|
return;
|
|
7568
7596
|
}
|
|
7569
|
-
console.log(
|
|
7597
|
+
console.log(chalk49.bold(item.name));
|
|
7570
7598
|
console.log();
|
|
7571
7599
|
for (const [i, phase] of item.plan.entries()) {
|
|
7572
|
-
console.log(`${
|
|
7600
|
+
console.log(`${chalk49.bold(`Phase ${i + 1}:`)} ${phase.name}`);
|
|
7573
7601
|
for (const task of phase.tasks) {
|
|
7574
7602
|
console.log(` - ${task.task}`);
|
|
7575
7603
|
}
|
|
@@ -7578,15 +7606,15 @@ async function plan(id) {
|
|
|
7578
7606
|
}
|
|
7579
7607
|
|
|
7580
7608
|
// src/commands/backlog/show/index.ts
|
|
7581
|
-
import
|
|
7609
|
+
import chalk56 from "chalk";
|
|
7582
7610
|
|
|
7583
7611
|
// src/commands/backlog/formatComment.ts
|
|
7584
|
-
import
|
|
7612
|
+
import chalk50 from "chalk";
|
|
7585
7613
|
function formatComment(entry) {
|
|
7586
|
-
const id = entry.id !== void 0 ?
|
|
7587
|
-
const tag = entry.type === "summary" ?
|
|
7588
|
-
const phase = entry.phase !== void 0 ?
|
|
7589
|
-
const time =
|
|
7614
|
+
const id = entry.id !== void 0 ? chalk50.dim(`#${entry.id} `) : "";
|
|
7615
|
+
const tag = entry.type === "summary" ? chalk50.magenta("[summary]") : chalk50.cyan("[comment]");
|
|
7616
|
+
const phase = entry.phase !== void 0 ? chalk50.dim(` (phase ${entry.phase})`) : "";
|
|
7617
|
+
const time = chalk50.dim(entry.timestamp);
|
|
7590
7618
|
return `${id}${tag}${phase} ${time}
|
|
7591
7619
|
${entry.text}`;
|
|
7592
7620
|
}
|
|
@@ -7623,7 +7651,7 @@ function shortenGithubIssue(githubIssue, origin) {
|
|
|
7623
7651
|
}
|
|
7624
7652
|
|
|
7625
7653
|
// src/commands/backlog/show/printActivity.ts
|
|
7626
|
-
import
|
|
7654
|
+
import chalk51 from "chalk";
|
|
7627
7655
|
|
|
7628
7656
|
// src/commands/backlog/groupActivityRefs.ts
|
|
7629
7657
|
var ACTIVITY_COMMIT_LIMIT = 10;
|
|
@@ -7641,8 +7669,8 @@ function groupActivityRefs(refs, commitLimit = ACTIVITY_COMMIT_LIMIT) {
|
|
|
7641
7669
|
|
|
7642
7670
|
// src/commands/backlog/show/printActivity.ts
|
|
7643
7671
|
function printRef(label2, text17, ref) {
|
|
7644
|
-
const url = ref.url ? ` ${
|
|
7645
|
-
console.log(` ${
|
|
7672
|
+
const url = ref.url ? ` ${chalk51.dim(ref.url)}` : "";
|
|
7673
|
+
console.log(` ${chalk51.cyan(label2)} ${text17}${url}`);
|
|
7646
7674
|
}
|
|
7647
7675
|
function printActivity(item) {
|
|
7648
7676
|
const { branches, commits: commits2, prs: prs2, slacks, hiddenCommits } = groupActivityRefs(
|
|
@@ -7650,7 +7678,7 @@ function printActivity(item) {
|
|
|
7650
7678
|
);
|
|
7651
7679
|
if (branches.length + commits2.length + prs2.length + slacks.length === 0)
|
|
7652
7680
|
return;
|
|
7653
|
-
console.log(
|
|
7681
|
+
console.log(chalk51.bold("Activity"));
|
|
7654
7682
|
for (const branch2 of branches) {
|
|
7655
7683
|
printRef("branch", branch2.ref, branch2);
|
|
7656
7684
|
}
|
|
@@ -7659,11 +7687,11 @@ function printActivity(item) {
|
|
|
7659
7687
|
printRef("commit", `${commit2.ref.slice(0, 8)}${subject}`, commit2);
|
|
7660
7688
|
}
|
|
7661
7689
|
if (hiddenCommits > 0) {
|
|
7662
|
-
console.log(` ${
|
|
7690
|
+
console.log(` ${chalk51.dim(`\u2026 and ${hiddenCommits} more commits`)}`);
|
|
7663
7691
|
}
|
|
7664
7692
|
for (const pr of prs2) {
|
|
7665
7693
|
const title = pr.title ? ` ${pr.title}` : "";
|
|
7666
|
-
const state = pr.state ? ` ${
|
|
7694
|
+
const state = pr.state ? ` ${chalk51.dim(`(${pr.state.toLowerCase()})`)}` : "";
|
|
7667
7695
|
printRef("pr", `#${pr.ref}${title}${state}`, pr);
|
|
7668
7696
|
}
|
|
7669
7697
|
for (const slack of slacks) {
|
|
@@ -7673,7 +7701,7 @@ function printActivity(item) {
|
|
|
7673
7701
|
}
|
|
7674
7702
|
|
|
7675
7703
|
// src/commands/backlog/show/printLinks.ts
|
|
7676
|
-
import
|
|
7704
|
+
import chalk52 from "chalk";
|
|
7677
7705
|
|
|
7678
7706
|
// src/commands/backlog/show/loadLinkTargets.ts
|
|
7679
7707
|
import { inArray as inArray2 } from "drizzle-orm";
|
|
@@ -7695,17 +7723,17 @@ async function printLinks(orm, item) {
|
|
|
7695
7723
|
orm,
|
|
7696
7724
|
links2.map((l) => l.targetId)
|
|
7697
7725
|
);
|
|
7698
|
-
console.log(
|
|
7726
|
+
console.log(chalk52.bold("Links"));
|
|
7699
7727
|
for (const link3 of links2) {
|
|
7700
7728
|
const target = targets.find((i) => i.id === link3.targetId);
|
|
7701
|
-
const typeLabel2 = link3.type === "depends-on" ?
|
|
7729
|
+
const typeLabel2 = link3.type === "depends-on" ? chalk52.red("depends-on") : chalk52.blue("relates-to");
|
|
7702
7730
|
if (target) {
|
|
7703
7731
|
console.log(
|
|
7704
|
-
` ${typeLabel2} ${formatItemId(target.id)} ${target.name} ${
|
|
7732
|
+
` ${typeLabel2} ${formatItemId(target.id)} ${target.name} ${chalk52.dim(`(${target.status})`)}`
|
|
7705
7733
|
);
|
|
7706
7734
|
} else {
|
|
7707
7735
|
console.log(
|
|
7708
|
-
` ${typeLabel2} ${formatItemId(link3.targetId)} ${
|
|
7736
|
+
` ${typeLabel2} ${formatItemId(link3.targetId)} ${chalk52.dim("(not found)")}`
|
|
7709
7737
|
);
|
|
7710
7738
|
}
|
|
7711
7739
|
}
|
|
@@ -7713,18 +7741,18 @@ async function printLinks(orm, item) {
|
|
|
7713
7741
|
}
|
|
7714
7742
|
|
|
7715
7743
|
// src/commands/backlog/show/printPlan.ts
|
|
7716
|
-
import
|
|
7744
|
+
import chalk54 from "chalk";
|
|
7717
7745
|
|
|
7718
7746
|
// src/commands/backlog/show/printPhaseTasks.ts
|
|
7719
|
-
import
|
|
7747
|
+
import chalk53 from "chalk";
|
|
7720
7748
|
function printPhaseTasks(phase) {
|
|
7721
7749
|
for (const task of phase.tasks) {
|
|
7722
7750
|
console.log(` - ${task.task}`);
|
|
7723
7751
|
}
|
|
7724
7752
|
if (phase.manualChecks && phase.manualChecks.length > 0) {
|
|
7725
|
-
console.log(` ${
|
|
7753
|
+
console.log(` ${chalk53.dim("Manual checks:")}`);
|
|
7726
7754
|
for (const check2 of phase.manualChecks) {
|
|
7727
|
-
console.log(` ${
|
|
7755
|
+
console.log(` ${chalk53.dim(`- ${check2}`)}`);
|
|
7728
7756
|
}
|
|
7729
7757
|
}
|
|
7730
7758
|
}
|
|
@@ -7732,16 +7760,16 @@ function printPhaseTasks(phase) {
|
|
|
7732
7760
|
// src/commands/backlog/show/printPlan.ts
|
|
7733
7761
|
function phaseHeader(index3, name, isCurrent) {
|
|
7734
7762
|
const phaseNumber = index3 + 1;
|
|
7735
|
-
const marker = isCurrent ?
|
|
7736
|
-
const label2 = isCurrent ?
|
|
7763
|
+
const marker = isCurrent ? chalk54.green("\u25B6 ") : " ";
|
|
7764
|
+
const label2 = isCurrent ? chalk54.green.bold(`Phase ${phaseNumber}: ${name}`) : `${chalk54.bold(`Phase ${phaseNumber}:`)} ${name}`;
|
|
7737
7765
|
return `${marker}${label2}`;
|
|
7738
7766
|
}
|
|
7739
7767
|
function printPhaseSessions(sessions) {
|
|
7740
7768
|
if (sessions.length === 0) return;
|
|
7741
|
-
console.log(` ${
|
|
7769
|
+
console.log(` ${chalk54.dim("Sessions:")}`);
|
|
7742
7770
|
for (const s of sessions) {
|
|
7743
7771
|
console.log(
|
|
7744
|
-
` ${
|
|
7772
|
+
` ${chalk54.dim(`- ${s.hostname} / ${s.osUser} / ${s.claudeSessionId}`)}`
|
|
7745
7773
|
);
|
|
7746
7774
|
}
|
|
7747
7775
|
}
|
|
@@ -7761,7 +7789,7 @@ function printReviewSessions(item, planLength) {
|
|
|
7761
7789
|
}
|
|
7762
7790
|
function printPlan(item) {
|
|
7763
7791
|
if (!item.plan || item.plan.length === 0) return;
|
|
7764
|
-
console.log(
|
|
7792
|
+
console.log(chalk54.bold("Plan"));
|
|
7765
7793
|
for (const [i, phase] of item.plan.entries()) {
|
|
7766
7794
|
const isCurrent = item.currentPhase === i + 1;
|
|
7767
7795
|
const sessions = (item.phaseSessions ?? []).filter((s) => s.phaseIdx === i);
|
|
@@ -7772,13 +7800,13 @@ function printPlan(item) {
|
|
|
7772
7800
|
}
|
|
7773
7801
|
|
|
7774
7802
|
// src/commands/backlog/show/printSubtasks.ts
|
|
7775
|
-
import
|
|
7803
|
+
import chalk55 from "chalk";
|
|
7776
7804
|
function printSubtasks(item) {
|
|
7777
7805
|
const subtasks = item.subtasks ?? [];
|
|
7778
7806
|
if (subtasks.length === 0) return;
|
|
7779
|
-
console.log(
|
|
7807
|
+
console.log(chalk55.bold("Sub-tasks"));
|
|
7780
7808
|
for (const [i, subtask] of subtasks.entries()) {
|
|
7781
|
-
const status3 =
|
|
7809
|
+
const status3 = chalk55.dim(`[${subtask.status}]`);
|
|
7782
7810
|
console.log(` ${i + 1}. ${status3} ${subtask.title}`);
|
|
7783
7811
|
if (subtask.description) {
|
|
7784
7812
|
const rendered = renderMarkdownTerminal(subtask.description);
|
|
@@ -7792,23 +7820,23 @@ function printSubtasks(item) {
|
|
|
7792
7820
|
|
|
7793
7821
|
// src/commands/backlog/show/index.ts
|
|
7794
7822
|
function printHeader(item) {
|
|
7795
|
-
console.log(
|
|
7823
|
+
console.log(chalk56.bold(`${formatItemId(item.id)} ${item.name}`));
|
|
7796
7824
|
console.log(
|
|
7797
|
-
`${
|
|
7825
|
+
`${chalk56.dim("Type:")} ${item.type} ${chalk56.dim("Status:")} ${item.status}`
|
|
7798
7826
|
);
|
|
7799
7827
|
if (item.jiraKey) {
|
|
7800
|
-
console.log(`${
|
|
7828
|
+
console.log(`${chalk56.dim("Jira:")} ${item.jiraKey}`);
|
|
7801
7829
|
}
|
|
7802
7830
|
if (item.githubIssue) {
|
|
7803
7831
|
console.log(
|
|
7804
|
-
`${
|
|
7832
|
+
`${chalk56.dim("GitHub:")} ${shortenGithubIssue(item.githubIssue, item.origin)}`
|
|
7805
7833
|
);
|
|
7806
7834
|
}
|
|
7807
7835
|
console.log();
|
|
7808
7836
|
}
|
|
7809
7837
|
function printAcceptanceCriteria(criteria) {
|
|
7810
7838
|
if (criteria.length === 0) return;
|
|
7811
|
-
console.log(
|
|
7839
|
+
console.log(chalk56.bold("Acceptance Criteria"));
|
|
7812
7840
|
for (const [i, ac] of criteria.entries()) {
|
|
7813
7841
|
console.log(` ${i + 1}. ${ac}`);
|
|
7814
7842
|
}
|
|
@@ -7817,7 +7845,7 @@ function printAcceptanceCriteria(criteria) {
|
|
|
7817
7845
|
function printComments(item) {
|
|
7818
7846
|
const entries = item.comments ?? [];
|
|
7819
7847
|
if (entries.length === 0) return;
|
|
7820
|
-
console.log(
|
|
7848
|
+
console.log(chalk56.bold("Comments"));
|
|
7821
7849
|
for (const entry of entries) {
|
|
7822
7850
|
console.log(` ${formatComment(entry)}`);
|
|
7823
7851
|
}
|
|
@@ -7829,7 +7857,7 @@ async function show(id) {
|
|
|
7829
7857
|
const { orm, item } = found;
|
|
7830
7858
|
printHeader(item);
|
|
7831
7859
|
if (item.description) {
|
|
7832
|
-
console.log(
|
|
7860
|
+
console.log(chalk56.bold("Description"));
|
|
7833
7861
|
console.log(renderMarkdownTerminal(item.description));
|
|
7834
7862
|
console.log();
|
|
7835
7863
|
}
|
|
@@ -7842,7 +7870,7 @@ async function show(id) {
|
|
|
7842
7870
|
}
|
|
7843
7871
|
|
|
7844
7872
|
// src/commands/sessions/web/index.ts
|
|
7845
|
-
import
|
|
7873
|
+
import chalk61 from "chalk";
|
|
7846
7874
|
import { WebSocketServer } from "ws";
|
|
7847
7875
|
|
|
7848
7876
|
// src/shared/getInstallDir.ts
|
|
@@ -7870,7 +7898,7 @@ function isGitRepo(dir) {
|
|
|
7870
7898
|
import {
|
|
7871
7899
|
createServer
|
|
7872
7900
|
} from "http";
|
|
7873
|
-
import
|
|
7901
|
+
import chalk57 from "chalk";
|
|
7874
7902
|
|
|
7875
7903
|
// src/lib/openBrowser.ts
|
|
7876
7904
|
import { execSync as execSync28 } from "child_process";
|
|
@@ -7980,8 +8008,8 @@ function startWebServer(label2, port, handler, initialPath, open = true) {
|
|
|
7980
8008
|
runHandler(handler, req, res, port);
|
|
7981
8009
|
});
|
|
7982
8010
|
server.listen(port, () => {
|
|
7983
|
-
console.log(
|
|
7984
|
-
console.log(
|
|
8011
|
+
console.log(chalk57.green(`${label2}: ${url}`));
|
|
8012
|
+
console.log(chalk57.dim("Press Ctrl+C to stop"));
|
|
7985
8013
|
if (open) {
|
|
7986
8014
|
openBrowser(url);
|
|
7987
8015
|
}
|
|
@@ -9621,25 +9649,25 @@ function withRepoCwd(line, repoCwd) {
|
|
|
9621
9649
|
}
|
|
9622
9650
|
|
|
9623
9651
|
// src/commands/sessions/web/restartMenu/installRestartMenu.ts
|
|
9624
|
-
import
|
|
9652
|
+
import chalk60 from "chalk";
|
|
9625
9653
|
import { createLogUpdate } from "log-update";
|
|
9626
9654
|
|
|
9627
9655
|
// src/commands/sessions/web/restartMenu/runRestartItem.ts
|
|
9628
|
-
import
|
|
9656
|
+
import chalk58 from "chalk";
|
|
9629
9657
|
async function runRestartItem(item, { runRestartDaemon, reExec }) {
|
|
9630
9658
|
if (item.disabled) return;
|
|
9631
9659
|
try {
|
|
9632
9660
|
if (item.action === "restart-daemon" || item.action === "restart-both") {
|
|
9633
|
-
console.log(
|
|
9661
|
+
console.log(chalk58.cyan("Restarting sessions daemon\u2026"));
|
|
9634
9662
|
await runRestartDaemon();
|
|
9635
9663
|
}
|
|
9636
9664
|
if (item.action === "restart-webserver" || item.action === "restart-both") {
|
|
9637
|
-
console.log(
|
|
9665
|
+
console.log(chalk58.cyan("Restarting web server\u2026"));
|
|
9638
9666
|
reExec();
|
|
9639
9667
|
}
|
|
9640
9668
|
} catch (error) {
|
|
9641
9669
|
const message2 = error instanceof Error ? error.message : String(error);
|
|
9642
|
-
console.error(
|
|
9670
|
+
console.error(chalk58.red(`Restart failed: ${message2}`));
|
|
9643
9671
|
}
|
|
9644
9672
|
}
|
|
9645
9673
|
|
|
@@ -9721,20 +9749,20 @@ function firstEnabledIndex(items2) {
|
|
|
9721
9749
|
}
|
|
9722
9750
|
|
|
9723
9751
|
// src/commands/sessions/web/restartMenu/renderRestartMenu.ts
|
|
9724
|
-
import
|
|
9752
|
+
import chalk59 from "chalk";
|
|
9725
9753
|
function renderRestartMenu(items2, selected) {
|
|
9726
|
-
const lines = [
|
|
9754
|
+
const lines = [chalk59.bold.cyan("assist \u2014 restart menu")];
|
|
9727
9755
|
items2.forEach((item, i) => {
|
|
9728
9756
|
const active = i === selected;
|
|
9729
|
-
const pointer = active ?
|
|
9730
|
-
const number =
|
|
9731
|
-
const note = item.note ?
|
|
9757
|
+
const pointer = active ? chalk59.cyan("\u276F ") : " ";
|
|
9758
|
+
const number = chalk59.dim(`${i + 1}. `);
|
|
9759
|
+
const note = item.note ? chalk59.dim(` (${item.note})`) : "";
|
|
9732
9760
|
let label2 = item.label;
|
|
9733
|
-
if (item.disabled) label2 =
|
|
9734
|
-
else if (active) label2 =
|
|
9761
|
+
if (item.disabled) label2 = chalk59.dim(label2);
|
|
9762
|
+
else if (active) label2 = chalk59.cyan.bold(label2);
|
|
9735
9763
|
lines.push(`${pointer}${number}${label2}${note}`);
|
|
9736
9764
|
});
|
|
9737
|
-
lines.push(
|
|
9765
|
+
lines.push(chalk59.dim("\u2191/\u2193 move \xB7 1-3 jump \xB7 enter select \xB7 esc close"));
|
|
9738
9766
|
return lines.join("\n");
|
|
9739
9767
|
}
|
|
9740
9768
|
|
|
@@ -9828,7 +9856,7 @@ function installRestartMenu(options2 = {}) {
|
|
|
9828
9856
|
}
|
|
9829
9857
|
});
|
|
9830
9858
|
const restoreRaw = enableRawMode(stdin, handler);
|
|
9831
|
-
console.log(
|
|
9859
|
+
console.log(chalk60.dim("Press Ctrl+R for the restart menu"));
|
|
9832
9860
|
let cleaned = false;
|
|
9833
9861
|
function cleanup() {
|
|
9834
9862
|
if (cleaned) return;
|
|
@@ -9910,7 +9938,7 @@ async function web(options2) {
|
|
|
9910
9938
|
streamDaemonLogs();
|
|
9911
9939
|
void ensureDaemonRunning("web server start").catch((error) => {
|
|
9912
9940
|
console.error(
|
|
9913
|
-
|
|
9941
|
+
chalk61.yellow(
|
|
9914
9942
|
`sessions daemon not ready yet, will retry on connection: ${error instanceof Error ? error.message : String(error)}`
|
|
9915
9943
|
)
|
|
9916
9944
|
);
|
|
@@ -9946,12 +9974,12 @@ var backlogConfigHelp = [
|
|
|
9946
9974
|
];
|
|
9947
9975
|
|
|
9948
9976
|
// src/commands/backlog/addActivity.ts
|
|
9949
|
-
import
|
|
9977
|
+
import chalk62 from "chalk";
|
|
9950
9978
|
async function addActivity(id, kind, ref, options2) {
|
|
9951
9979
|
const parsedKind = gitRefKindSchema.safeParse(kind);
|
|
9952
9980
|
if (!parsedKind.success) {
|
|
9953
9981
|
console.log(
|
|
9954
|
-
|
|
9982
|
+
chalk62.red(
|
|
9955
9983
|
`Invalid kind "${kind}". Expected one of: ${gitRefKindSchema.options.join(", ")}.`
|
|
9956
9984
|
)
|
|
9957
9985
|
);
|
|
@@ -9973,7 +10001,7 @@ async function addActivity(id, kind, ref, options2) {
|
|
|
9973
10001
|
state: options2.state
|
|
9974
10002
|
});
|
|
9975
10003
|
console.log(
|
|
9976
|
-
|
|
10004
|
+
chalk62.green(
|
|
9977
10005
|
`Attached ${parsedKind.data} "${ref}" to item ${formatItemId(item.id)}.`
|
|
9978
10006
|
)
|
|
9979
10007
|
);
|
|
@@ -9997,11 +10025,11 @@ function registerActivityCommands(cmd) {
|
|
|
9997
10025
|
}
|
|
9998
10026
|
|
|
9999
10027
|
// src/commands/backlog/associate-github/index.ts
|
|
10000
|
-
import
|
|
10028
|
+
import chalk64 from "chalk";
|
|
10001
10029
|
import { eq as eq18 } from "drizzle-orm";
|
|
10002
10030
|
|
|
10003
10031
|
// src/commands/backlog/beginAssociation.ts
|
|
10004
|
-
import
|
|
10032
|
+
import chalk63 from "chalk";
|
|
10005
10033
|
import { eq as eq17 } from "drizzle-orm";
|
|
10006
10034
|
async function beginAssociation(id, options2, clearPatch, label2) {
|
|
10007
10035
|
const found = await findOneItem(id);
|
|
@@ -10014,7 +10042,7 @@ async function beginAssociation(id, options2, clearPatch, label2) {
|
|
|
10014
10042
|
if (options2.clear) {
|
|
10015
10043
|
await orm.update(items).set(clearPatch).where(eq17(items.id, itemId2));
|
|
10016
10044
|
console.log(
|
|
10017
|
-
|
|
10045
|
+
chalk63.green(
|
|
10018
10046
|
`Cleared ${label2} association on item ${formatItemId(itemId2)}.`
|
|
10019
10047
|
)
|
|
10020
10048
|
);
|
|
@@ -10064,7 +10092,7 @@ async function associateGithub(id, issue, options2) {
|
|
|
10064
10092
|
const { orm, itemId: itemId2 } = target;
|
|
10065
10093
|
if (!issue) {
|
|
10066
10094
|
console.log(
|
|
10067
|
-
|
|
10095
|
+
chalk64.red("Provide a GitHub issue, or use --clear to remove one.")
|
|
10068
10096
|
);
|
|
10069
10097
|
process.exitCode = 1;
|
|
10070
10098
|
return;
|
|
@@ -10072,7 +10100,7 @@ async function associateGithub(id, issue, options2) {
|
|
|
10072
10100
|
const normalized = normalizeGithubIssue(issue);
|
|
10073
10101
|
if (!normalized) {
|
|
10074
10102
|
console.log(
|
|
10075
|
-
|
|
10103
|
+
chalk64.red(
|
|
10076
10104
|
`Malformed GitHub issue "${issue}". Expected owner/repo#number or a github.com issue URL.`
|
|
10077
10105
|
)
|
|
10078
10106
|
);
|
|
@@ -10082,8 +10110,8 @@ async function associateGithub(id, issue, options2) {
|
|
|
10082
10110
|
const title = fetchGithubIssueTitle(normalized);
|
|
10083
10111
|
await orm.update(items).set({ githubIssue: normalized, jiraKey: null }).where(eq18(items.id, itemId2));
|
|
10084
10112
|
console.log(
|
|
10085
|
-
|
|
10086
|
-
title ?
|
|
10113
|
+
chalk64.green(`Associated ${normalized} with item ${formatItemId(itemId2)}.`),
|
|
10114
|
+
title ? chalk64.dim(`(${title})`) : ""
|
|
10087
10115
|
);
|
|
10088
10116
|
}
|
|
10089
10117
|
|
|
@@ -10093,12 +10121,12 @@ function registerAssociateGithubCommand(cmd) {
|
|
|
10093
10121
|
}
|
|
10094
10122
|
|
|
10095
10123
|
// src/commands/backlog/associate-jira/index.ts
|
|
10096
|
-
import
|
|
10124
|
+
import chalk66 from "chalk";
|
|
10097
10125
|
import { eq as eq19 } from "drizzle-orm";
|
|
10098
10126
|
|
|
10099
10127
|
// src/commands/jira/fetchIssue.ts
|
|
10100
10128
|
import { execSync as execSync31 } from "child_process";
|
|
10101
|
-
import
|
|
10129
|
+
import chalk65 from "chalk";
|
|
10102
10130
|
function fetchIssue(issueKey, fields) {
|
|
10103
10131
|
let result;
|
|
10104
10132
|
try {
|
|
@@ -10111,15 +10139,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
10111
10139
|
const stderr = error.stderr;
|
|
10112
10140
|
if (stderr.includes("unauthorized")) {
|
|
10113
10141
|
console.error(
|
|
10114
|
-
|
|
10142
|
+
chalk65.red("Jira authentication expired."),
|
|
10115
10143
|
"Run",
|
|
10116
|
-
|
|
10144
|
+
chalk65.cyan("assist jira auth"),
|
|
10117
10145
|
"to re-authenticate."
|
|
10118
10146
|
);
|
|
10119
10147
|
process.exit(1);
|
|
10120
10148
|
}
|
|
10121
10149
|
}
|
|
10122
|
-
console.error(
|
|
10150
|
+
console.error(chalk65.red(`Failed to fetch ${issueKey}.`));
|
|
10123
10151
|
process.exit(1);
|
|
10124
10152
|
}
|
|
10125
10153
|
return JSON.parse(result);
|
|
@@ -10142,14 +10170,14 @@ async function associateJira(id, key, options2) {
|
|
|
10142
10170
|
if (!target) return;
|
|
10143
10171
|
const { orm, itemId: itemId2 } = target;
|
|
10144
10172
|
if (!key) {
|
|
10145
|
-
console.log(
|
|
10173
|
+
console.log(chalk66.red("Provide a Jira key, or use --clear to remove one."));
|
|
10146
10174
|
process.exitCode = 1;
|
|
10147
10175
|
return;
|
|
10148
10176
|
}
|
|
10149
10177
|
const normalized = normalizeJiraKey(key);
|
|
10150
10178
|
if (!normalized) {
|
|
10151
10179
|
console.log(
|
|
10152
|
-
|
|
10180
|
+
chalk66.red(
|
|
10153
10181
|
`Malformed Jira key "${key}". Expected a key like PROJ-123 or a browse URL.`
|
|
10154
10182
|
)
|
|
10155
10183
|
);
|
|
@@ -10161,8 +10189,8 @@ async function associateJira(id, key, options2) {
|
|
|
10161
10189
|
const summary = fields?.summary;
|
|
10162
10190
|
await orm.update(items).set({ jiraKey: normalized, githubIssue: null }).where(eq19(items.id, itemId2));
|
|
10163
10191
|
console.log(
|
|
10164
|
-
|
|
10165
|
-
summary ?
|
|
10192
|
+
chalk66.green(`Associated ${normalized} with item ${formatItemId(itemId2)}.`),
|
|
10193
|
+
summary ? chalk66.dim(`(${summary})`) : ""
|
|
10166
10194
|
);
|
|
10167
10195
|
}
|
|
10168
10196
|
|
|
@@ -10175,7 +10203,7 @@ function registerAssociateJiraCommand(cmd) {
|
|
|
10175
10203
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
10176
10204
|
import { existsSync as existsSync28 } from "fs";
|
|
10177
10205
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
10178
|
-
import
|
|
10206
|
+
import chalk67 from "chalk";
|
|
10179
10207
|
|
|
10180
10208
|
// src/commands/backlog/originToSshUrl.ts
|
|
10181
10209
|
function originToSshUrl(origin) {
|
|
@@ -10190,7 +10218,7 @@ function originToSshUrl(origin) {
|
|
|
10190
10218
|
|
|
10191
10219
|
// src/commands/backlog/cloneRepo.ts
|
|
10192
10220
|
function fail2(message2) {
|
|
10193
|
-
console.log(
|
|
10221
|
+
console.log(chalk67.red(message2));
|
|
10194
10222
|
process.exitCode = 1;
|
|
10195
10223
|
}
|
|
10196
10224
|
async function cloneRepo(originRaw) {
|
|
@@ -10213,7 +10241,7 @@ async function cloneRepo(originRaw) {
|
|
|
10213
10241
|
return fail2(`Clone target already exists: ${target}`);
|
|
10214
10242
|
}
|
|
10215
10243
|
await mkdir3(baseDir, { recursive: true });
|
|
10216
|
-
console.error(
|
|
10244
|
+
console.error(chalk67.dim(`Cloning ${sshUrl} into ${target}`));
|
|
10217
10245
|
const result = spawnSync2("git", ["clone", sshUrl, target], {
|
|
10218
10246
|
stdio: "inherit"
|
|
10219
10247
|
});
|
|
@@ -10225,7 +10253,7 @@ async function cloneRepo(originRaw) {
|
|
|
10225
10253
|
`git clone failed with exit code ${result.status ?? "unknown"}.`
|
|
10226
10254
|
);
|
|
10227
10255
|
}
|
|
10228
|
-
console.error(
|
|
10256
|
+
console.error(chalk67.green(`Cloned ${origin} into ${target}`));
|
|
10229
10257
|
}
|
|
10230
10258
|
|
|
10231
10259
|
// src/commands/backlog/registerCloneCommand.ts
|
|
@@ -10236,29 +10264,29 @@ function registerCloneCommand(cmd) {
|
|
|
10236
10264
|
}
|
|
10237
10265
|
|
|
10238
10266
|
// src/commands/backlog/comment/index.ts
|
|
10239
|
-
import
|
|
10267
|
+
import chalk68 from "chalk";
|
|
10240
10268
|
async function comment(id, text17) {
|
|
10241
10269
|
const found = await findOneItem(id);
|
|
10242
10270
|
if (!found) process.exit(1);
|
|
10243
10271
|
await appendComment(found.orm, found.item.id, text17);
|
|
10244
10272
|
console.log(
|
|
10245
|
-
|
|
10273
|
+
chalk68.green(`Comment added to item ${formatItemId(found.item.id)}.`)
|
|
10246
10274
|
);
|
|
10247
10275
|
}
|
|
10248
10276
|
|
|
10249
10277
|
// src/commands/backlog/comments/index.ts
|
|
10250
|
-
import
|
|
10278
|
+
import chalk69 from "chalk";
|
|
10251
10279
|
async function comments2(id) {
|
|
10252
10280
|
const found = await findOneItem(id);
|
|
10253
10281
|
if (!found) process.exit(1);
|
|
10254
10282
|
const { item } = found;
|
|
10255
10283
|
const entries = item.comments ?? [];
|
|
10256
10284
|
if (entries.length === 0) {
|
|
10257
|
-
console.log(
|
|
10285
|
+
console.log(chalk69.dim(`No comments on item ${formatItemId(item.id)}.`));
|
|
10258
10286
|
return;
|
|
10259
10287
|
}
|
|
10260
10288
|
console.log(
|
|
10261
|
-
|
|
10289
|
+
chalk69.bold(`Comments for ${formatItemId(item.id)}: ${item.name}
|
|
10262
10290
|
`)
|
|
10263
10291
|
);
|
|
10264
10292
|
for (const entry of entries) {
|
|
@@ -10268,7 +10296,7 @@ async function comments2(id) {
|
|
|
10268
10296
|
}
|
|
10269
10297
|
|
|
10270
10298
|
// src/commands/backlog/delete-comment/index.ts
|
|
10271
|
-
import
|
|
10299
|
+
import chalk70 from "chalk";
|
|
10272
10300
|
async function deleteCommentCmd(id, commentId) {
|
|
10273
10301
|
const found = await findOneItem(id);
|
|
10274
10302
|
if (!found) process.exit(1);
|
|
@@ -10281,14 +10309,14 @@ async function deleteCommentCmd(id, commentId) {
|
|
|
10281
10309
|
switch (outcome) {
|
|
10282
10310
|
case "deleted":
|
|
10283
10311
|
console.log(
|
|
10284
|
-
|
|
10312
|
+
chalk70.green(
|
|
10285
10313
|
`Comment #${commentId} deleted from item ${formatItemId(itemId2)}.`
|
|
10286
10314
|
)
|
|
10287
10315
|
);
|
|
10288
10316
|
break;
|
|
10289
10317
|
case "not-found":
|
|
10290
10318
|
console.log(
|
|
10291
|
-
|
|
10319
|
+
chalk70.red(
|
|
10292
10320
|
`Comment #${commentId} not found on item ${formatItemId(itemId2)}.`
|
|
10293
10321
|
)
|
|
10294
10322
|
);
|
|
@@ -10296,7 +10324,7 @@ async function deleteCommentCmd(id, commentId) {
|
|
|
10296
10324
|
break;
|
|
10297
10325
|
case "is-summary":
|
|
10298
10326
|
console.log(
|
|
10299
|
-
|
|
10327
|
+
chalk70.red(
|
|
10300
10328
|
`Comment #${commentId} is a phase summary and cannot be deleted.`
|
|
10301
10329
|
)
|
|
10302
10330
|
);
|
|
@@ -10321,7 +10349,7 @@ function registerExportCommand(cmd) {
|
|
|
10321
10349
|
|
|
10322
10350
|
// src/commands/backlog/import/index.ts
|
|
10323
10351
|
import { readFile as readFile2 } from "fs/promises";
|
|
10324
|
-
import
|
|
10352
|
+
import chalk72 from "chalk";
|
|
10325
10353
|
|
|
10326
10354
|
// src/commands/backlog/dump/countCopyRows.ts
|
|
10327
10355
|
function countCopyRows(data) {
|
|
@@ -10393,7 +10421,7 @@ function validateDump({ header, sections }) {
|
|
|
10393
10421
|
}
|
|
10394
10422
|
|
|
10395
10423
|
// src/commands/backlog/import/confirmReplace.ts
|
|
10396
|
-
import
|
|
10424
|
+
import chalk71 from "chalk";
|
|
10397
10425
|
async function countRows(client, table) {
|
|
10398
10426
|
const { rows } = await client.query(
|
|
10399
10427
|
`SELECT count(*)::int AS n FROM ${table}`
|
|
@@ -10404,7 +10432,7 @@ function printSummary(tables, current, incoming) {
|
|
|
10404
10432
|
const lines = tables.map(
|
|
10405
10433
|
(t, i) => ` ${t.name}: ${current[i]} \u2192 ${incoming[i]} rows`
|
|
10406
10434
|
);
|
|
10407
|
-
console.error(
|
|
10435
|
+
console.error(chalk71.bold("\nThis will REPLACE all backlog data:"));
|
|
10408
10436
|
console.error(`${lines.join("\n")}
|
|
10409
10437
|
`);
|
|
10410
10438
|
}
|
|
@@ -10506,13 +10534,13 @@ async function importBacklog(file, options2 = {}) {
|
|
|
10506
10534
|
);
|
|
10507
10535
|
await withDbClient(async (client) => {
|
|
10508
10536
|
if (!options2.yes && !await confirmReplace(client, tables, incoming, !file)) {
|
|
10509
|
-
console.error(
|
|
10537
|
+
console.error(chalk72.yellow("Import cancelled; no changes made."));
|
|
10510
10538
|
return;
|
|
10511
10539
|
}
|
|
10512
10540
|
await restore(client, parsed);
|
|
10513
10541
|
const total = incoming.reduce((sum, n) => sum + n, 0);
|
|
10514
10542
|
console.error(
|
|
10515
|
-
|
|
10543
|
+
chalk72.green(
|
|
10516
10544
|
`Imported backlog: ${total} rows restored across ${tables.length} tables.`
|
|
10517
10545
|
)
|
|
10518
10546
|
);
|
|
@@ -10529,7 +10557,7 @@ function registerImportCommand(cmd) {
|
|
|
10529
10557
|
}
|
|
10530
10558
|
|
|
10531
10559
|
// src/commands/backlog/add/index.ts
|
|
10532
|
-
import
|
|
10560
|
+
import chalk74 from "chalk";
|
|
10533
10561
|
|
|
10534
10562
|
// src/commands/backlog/insertPhaseAt.ts
|
|
10535
10563
|
import { eq as eq21 } from "drizzle-orm";
|
|
@@ -10571,11 +10599,11 @@ async function insertSubtask(orm, itemId2, title, description) {
|
|
|
10571
10599
|
}
|
|
10572
10600
|
|
|
10573
10601
|
// src/commands/backlog/ensureRemoteOrigin.ts
|
|
10574
|
-
import
|
|
10602
|
+
import chalk73 from "chalk";
|
|
10575
10603
|
function ensureRemoteOrigin() {
|
|
10576
10604
|
if (getRemoteOriginUrl(getBacklogDir())) return true;
|
|
10577
10605
|
console.log(
|
|
10578
|
-
|
|
10606
|
+
chalk73.red(
|
|
10579
10607
|
"Backlog requires a git remote so items get a stable origin.\nAdd one with: git remote add origin <url>"
|
|
10580
10608
|
)
|
|
10581
10609
|
);
|
|
@@ -10679,14 +10707,14 @@ async function add(options2) {
|
|
|
10679
10707
|
for (const subtask of loadConfig().subtasks ?? []) {
|
|
10680
10708
|
await insertSubtask(orm, id, subtask.title, subtask.description);
|
|
10681
10709
|
}
|
|
10682
|
-
console.log(
|
|
10710
|
+
console.log(chalk74.green(`Added item ${formatItemId(id)}: ${name}`));
|
|
10683
10711
|
}
|
|
10684
10712
|
|
|
10685
10713
|
// src/commands/backlog/addPhase.ts
|
|
10686
|
-
import
|
|
10714
|
+
import chalk76 from "chalk";
|
|
10687
10715
|
|
|
10688
10716
|
// src/commands/backlog/resolveInsertPosition.ts
|
|
10689
|
-
import
|
|
10717
|
+
import chalk75 from "chalk";
|
|
10690
10718
|
import { count as count2, eq as eq22 } from "drizzle-orm";
|
|
10691
10719
|
async function resolveInsertPosition(orm, itemId2, position) {
|
|
10692
10720
|
const [row] = await orm.select({ cnt: count2() }).from(planPhases).where(eq22(planPhases.itemId, itemId2));
|
|
@@ -10695,7 +10723,7 @@ async function resolveInsertPosition(orm, itemId2, position) {
|
|
|
10695
10723
|
const pos = Number.parseInt(position, 10);
|
|
10696
10724
|
if (pos < 1 || pos > phaseCount + 1) {
|
|
10697
10725
|
console.log(
|
|
10698
|
-
|
|
10726
|
+
chalk75.red(
|
|
10699
10727
|
`Position ${pos} is out of range. Must be between 1 and ${phaseCount + 1}.`
|
|
10700
10728
|
)
|
|
10701
10729
|
);
|
|
@@ -10717,7 +10745,7 @@ async function addPhase(id, name, options2) {
|
|
|
10717
10745
|
if (!found) return;
|
|
10718
10746
|
const tasks = options2.task ?? [];
|
|
10719
10747
|
if (tasks.length === 0) {
|
|
10720
|
-
console.log(
|
|
10748
|
+
console.log(chalk76.red("At least one --task is required."));
|
|
10721
10749
|
process.exitCode = 1;
|
|
10722
10750
|
return;
|
|
10723
10751
|
}
|
|
@@ -10736,14 +10764,14 @@ async function addPhase(id, name, options2) {
|
|
|
10736
10764
|
);
|
|
10737
10765
|
const verb = options2.position !== void 0 ? "Inserted" : "Added";
|
|
10738
10766
|
console.log(
|
|
10739
|
-
|
|
10767
|
+
chalk76.green(
|
|
10740
10768
|
`${verb} phase ${phaseIdx + 1} "${name}" to item ${formatItemId(itemId2)} with ${tasks.length} task(s).`
|
|
10741
10769
|
)
|
|
10742
10770
|
);
|
|
10743
10771
|
}
|
|
10744
10772
|
|
|
10745
10773
|
// src/commands/backlog/list/index.ts
|
|
10746
|
-
import
|
|
10774
|
+
import chalk77 from "chalk";
|
|
10747
10775
|
function filterItems(items2, options2) {
|
|
10748
10776
|
if (options2.status) return items2.filter((i) => i.status === options2.status);
|
|
10749
10777
|
if (!options2.all)
|
|
@@ -10757,19 +10785,19 @@ function repoPrefixer(items2, allRepos) {
|
|
|
10757
10785
|
);
|
|
10758
10786
|
const repoNameOf = (item) => item.origin ? labels.get(item.origin) ?? "" : "";
|
|
10759
10787
|
const width = Math.max(0, ...items2.map((i) => repoNameOf(i).length));
|
|
10760
|
-
return (item) => `${
|
|
10788
|
+
return (item) => `${chalk77.dim(repoNameOf(item).padEnd(width))} `;
|
|
10761
10789
|
}
|
|
10762
10790
|
async function list2(options2) {
|
|
10763
10791
|
const allItems = await loadBacklog(options2.allRepos);
|
|
10764
10792
|
const items2 = filterItems(allItems, options2);
|
|
10765
10793
|
if (items2.length === 0) {
|
|
10766
|
-
console.log(
|
|
10794
|
+
console.log(chalk77.dim("Backlog is empty."));
|
|
10767
10795
|
return;
|
|
10768
10796
|
}
|
|
10769
10797
|
const prefixOf = repoPrefixer(items2, !!options2.allRepos);
|
|
10770
10798
|
for (const item of items2) {
|
|
10771
10799
|
console.log(
|
|
10772
|
-
`${prefixOf(item)}${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
10800
|
+
`${prefixOf(item)}${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk77.dim(formatItemId(item.id))} ${starMarker(item)}${item.name}${phaseLabel(item)}${dependencyLabel(item, allItems)}`
|
|
10773
10801
|
);
|
|
10774
10802
|
if (options2.verbose) {
|
|
10775
10803
|
printVerboseDetails(item);
|
|
@@ -10797,7 +10825,7 @@ function registerItemCommands(cmd) {
|
|
|
10797
10825
|
}
|
|
10798
10826
|
|
|
10799
10827
|
// src/commands/backlog/link.ts
|
|
10800
|
-
import
|
|
10828
|
+
import chalk79 from "chalk";
|
|
10801
10829
|
|
|
10802
10830
|
// src/commands/backlog/hasCycle.ts
|
|
10803
10831
|
function hasCycle(adjacency, fromId, toId) {
|
|
@@ -10829,14 +10857,14 @@ async function loadDependencyGraph(orm) {
|
|
|
10829
10857
|
}
|
|
10830
10858
|
|
|
10831
10859
|
// src/commands/backlog/validateLinkTarget.ts
|
|
10832
|
-
import
|
|
10860
|
+
import chalk78 from "chalk";
|
|
10833
10861
|
function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
10834
10862
|
const duplicate = (fromItem.links ?? []).some(
|
|
10835
10863
|
(l) => l.targetId === toNum && l.type === linkType
|
|
10836
10864
|
);
|
|
10837
10865
|
if (duplicate) {
|
|
10838
10866
|
console.log(
|
|
10839
|
-
|
|
10867
|
+
chalk78.yellow(
|
|
10840
10868
|
`Link already exists: ${formatItemId(fromNum)} ${linkType} ${formatItemId(toNum)}`
|
|
10841
10869
|
)
|
|
10842
10870
|
);
|
|
@@ -10847,7 +10875,7 @@ function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
|
10847
10875
|
|
|
10848
10876
|
// src/commands/backlog/link.ts
|
|
10849
10877
|
function fail3(message2) {
|
|
10850
|
-
console.log(
|
|
10878
|
+
console.log(chalk79.red(message2));
|
|
10851
10879
|
return void 0;
|
|
10852
10880
|
}
|
|
10853
10881
|
function parseLinkType(type) {
|
|
@@ -10880,11 +10908,11 @@ async function link(fromId, toId, opts) {
|
|
|
10880
10908
|
if (!validateLinkTarget(fromItem, fromNum, toNum, linkType)) return;
|
|
10881
10909
|
if (await createsCycle(orm, linkType, fromNum, toNum)) return;
|
|
10882
10910
|
await orm.insert(links).values({ itemId: fromNum, type: linkType, targetId: toNum });
|
|
10883
|
-
console.log(
|
|
10911
|
+
console.log(chalk79.green(`Linked ${from} ${linkType} ${to} (${toItem.name})`));
|
|
10884
10912
|
}
|
|
10885
10913
|
|
|
10886
10914
|
// src/commands/backlog/unlink.ts
|
|
10887
|
-
import
|
|
10915
|
+
import chalk80 from "chalk";
|
|
10888
10916
|
import { and as and9, eq as eq24 } from "drizzle-orm";
|
|
10889
10917
|
async function unlink(fromId, toId) {
|
|
10890
10918
|
const fromNum = parseItemId(fromId);
|
|
@@ -10892,18 +10920,18 @@ async function unlink(fromId, toId) {
|
|
|
10892
10920
|
const { orm } = await getReady();
|
|
10893
10921
|
const fromItem = await loadItem(orm, fromNum);
|
|
10894
10922
|
if (!fromItem) {
|
|
10895
|
-
console.log(
|
|
10923
|
+
console.log(chalk80.red(`Item ${formatItemId(fromNum)} not found.`));
|
|
10896
10924
|
return;
|
|
10897
10925
|
}
|
|
10898
10926
|
if (!fromItem.links || fromItem.links.length === 0) {
|
|
10899
10927
|
console.log(
|
|
10900
|
-
|
|
10928
|
+
chalk80.yellow(`No links found on item ${formatItemId(fromNum)}.`)
|
|
10901
10929
|
);
|
|
10902
10930
|
return;
|
|
10903
10931
|
}
|
|
10904
10932
|
if (!fromItem.links.some((l) => l.targetId === toNum)) {
|
|
10905
10933
|
console.log(
|
|
10906
|
-
|
|
10934
|
+
chalk80.yellow(
|
|
10907
10935
|
`No link from ${formatItemId(fromNum)} to ${formatItemId(toNum)} found.`
|
|
10908
10936
|
)
|
|
10909
10937
|
);
|
|
@@ -10911,7 +10939,7 @@ async function unlink(fromId, toId) {
|
|
|
10911
10939
|
}
|
|
10912
10940
|
await orm.delete(links).where(and9(eq24(links.itemId, fromNum), eq24(links.targetId, toNum)));
|
|
10913
10941
|
console.log(
|
|
10914
|
-
|
|
10942
|
+
chalk80.green(
|
|
10915
10943
|
`Removed link from ${formatItemId(fromNum)} to ${formatItemId(toNum)}.`
|
|
10916
10944
|
)
|
|
10917
10945
|
);
|
|
@@ -10928,17 +10956,17 @@ function registerLinkCommands(cmd) {
|
|
|
10928
10956
|
}
|
|
10929
10957
|
|
|
10930
10958
|
// src/commands/backlog/move-repo/index.ts
|
|
10931
|
-
import
|
|
10959
|
+
import chalk82 from "chalk";
|
|
10932
10960
|
import { eq as eq26 } from "drizzle-orm";
|
|
10933
10961
|
|
|
10934
10962
|
// src/commands/backlog/move-repo/confirmMove.ts
|
|
10935
|
-
import
|
|
10963
|
+
import chalk81 from "chalk";
|
|
10936
10964
|
function pluralItems(n) {
|
|
10937
10965
|
return `${n} item${n === 1 ? "" : "s"}`;
|
|
10938
10966
|
}
|
|
10939
10967
|
async function confirmMove(cnt, oldOrigin, newOrigin) {
|
|
10940
10968
|
console.log(
|
|
10941
|
-
`${pluralItems(cnt)}: ${
|
|
10969
|
+
`${pluralItems(cnt)}: ${chalk81.cyan(oldOrigin)} \u2192 ${chalk81.cyan(newOrigin)}`
|
|
10942
10970
|
);
|
|
10943
10971
|
return promptConfirm(`Retag ${pluralItems(cnt)}?`);
|
|
10944
10972
|
}
|
|
@@ -10970,7 +10998,7 @@ Pass the full origin.`
|
|
|
10970
10998
|
|
|
10971
10999
|
// src/commands/backlog/move-repo/index.ts
|
|
10972
11000
|
function fail4(message2) {
|
|
10973
|
-
console.log(
|
|
11001
|
+
console.log(chalk82.red(message2));
|
|
10974
11002
|
process.exitCode = 1;
|
|
10975
11003
|
}
|
|
10976
11004
|
async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
@@ -10986,12 +11014,12 @@ async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
|
10986
11014
|
}
|
|
10987
11015
|
const cnt = await countByOrigin(orm, oldOrigin);
|
|
10988
11016
|
if (!options2.yes && !await confirmMove(cnt, oldOrigin, newOrigin)) {
|
|
10989
|
-
console.log(
|
|
11017
|
+
console.log(chalk82.yellow("Move cancelled; no changes made."));
|
|
10990
11018
|
return;
|
|
10991
11019
|
}
|
|
10992
11020
|
await orm.update(items).set({ origin: newOrigin }).where(eq26(items.origin, oldOrigin));
|
|
10993
11021
|
console.log(
|
|
10994
|
-
|
|
11022
|
+
chalk82.green(
|
|
10995
11023
|
`Moved ${pluralItems(cnt)} from "${oldOrigin}" to "${newOrigin}".`
|
|
10996
11024
|
)
|
|
10997
11025
|
);
|
|
@@ -11020,7 +11048,7 @@ function registerPlanCommands(cmd) {
|
|
|
11020
11048
|
}
|
|
11021
11049
|
|
|
11022
11050
|
// src/commands/backlog/refine.ts
|
|
11023
|
-
import
|
|
11051
|
+
import chalk85 from "chalk";
|
|
11024
11052
|
import enquirer7 from "enquirer";
|
|
11025
11053
|
|
|
11026
11054
|
// src/commands/backlog/launchMode.ts
|
|
@@ -11054,7 +11082,7 @@ function spawnHarness(harness, prompt, options2 = {}) {
|
|
|
11054
11082
|
}
|
|
11055
11083
|
|
|
11056
11084
|
// src/commands/backlog/handleLaunchSignal.ts
|
|
11057
|
-
import
|
|
11085
|
+
import chalk84 from "chalk";
|
|
11058
11086
|
|
|
11059
11087
|
// src/commands/backlog/surfaceCreatedItem.ts
|
|
11060
11088
|
async function surfaceCreatedItem(slashCommand, id) {
|
|
@@ -11077,32 +11105,32 @@ async function surfaceCreatedItem(slashCommand, id) {
|
|
|
11077
11105
|
}
|
|
11078
11106
|
|
|
11079
11107
|
// src/commands/backlog/tryRunById.ts
|
|
11080
|
-
import
|
|
11108
|
+
import chalk83 from "chalk";
|
|
11081
11109
|
async function tryRunById(id, options2) {
|
|
11082
11110
|
const numericId = parseItemId(id);
|
|
11083
11111
|
const label2 = formatItemId(numericId);
|
|
11084
11112
|
const { orm } = await getReady();
|
|
11085
11113
|
const item = await loadItem(orm, numericId);
|
|
11086
11114
|
if (!item) {
|
|
11087
|
-
console.log(
|
|
11115
|
+
console.log(chalk83.red(`Item ${label2} not found.`));
|
|
11088
11116
|
return false;
|
|
11089
11117
|
}
|
|
11090
11118
|
if (item.status === "done") {
|
|
11091
|
-
console.log(
|
|
11119
|
+
console.log(chalk83.red(`Item ${label2} is already done.`));
|
|
11092
11120
|
return false;
|
|
11093
11121
|
}
|
|
11094
11122
|
if (item.status === "wontdo") {
|
|
11095
|
-
console.log(
|
|
11123
|
+
console.log(chalk83.red(`Item ${label2} is marked won't do.`));
|
|
11096
11124
|
return false;
|
|
11097
11125
|
}
|
|
11098
11126
|
const hasDeps = (item.links ?? []).some((l) => l.type === "depends-on");
|
|
11099
11127
|
if (hasDeps && isBlocked(item, await loadItemSummaries(orm, getOrigin()))) {
|
|
11100
11128
|
console.log(
|
|
11101
|
-
|
|
11129
|
+
chalk83.red(`Item ${label2} is blocked by unresolved dependencies.`)
|
|
11102
11130
|
);
|
|
11103
11131
|
return false;
|
|
11104
11132
|
}
|
|
11105
|
-
console.log(
|
|
11133
|
+
console.log(chalk83.bold(`
|
|
11106
11134
|
Running backlog item ${label2}...
|
|
11107
11135
|
`));
|
|
11108
11136
|
await run2(id, options2);
|
|
@@ -11121,13 +11149,13 @@ async function handleLaunchSignal(slashCommand, once) {
|
|
|
11121
11149
|
if (typeof signal.id === "string" && signal.id) {
|
|
11122
11150
|
if (await tryRunById(signal.id, { allowEdits: true })) return;
|
|
11123
11151
|
}
|
|
11124
|
-
console.log(
|
|
11152
|
+
console.log(chalk84.bold("\nChaining into assist next...\n"));
|
|
11125
11153
|
await next({ allowEdits: true, once });
|
|
11126
11154
|
}
|
|
11127
11155
|
} catch (error) {
|
|
11128
11156
|
const message2 = error instanceof Error ? error.message : String(error);
|
|
11129
11157
|
console.error(
|
|
11130
|
-
|
|
11158
|
+
chalk84.yellow(
|
|
11131
11159
|
`
|
|
11132
11160
|
Could not complete post-run step (${message2}).
|
|
11133
11161
|
This is usually a transient database/network blip \u2014 the work is saved and the session is safe to resume.`
|
|
@@ -11174,13 +11202,13 @@ async function pickItemForRefine() {
|
|
|
11174
11202
|
(i) => i.status === "todo" || i.status === "in-progress"
|
|
11175
11203
|
);
|
|
11176
11204
|
if (active.length === 0) {
|
|
11177
|
-
console.log(
|
|
11205
|
+
console.log(chalk85.yellow("No active backlog items to refine."));
|
|
11178
11206
|
return void 0;
|
|
11179
11207
|
}
|
|
11180
11208
|
if (active.length === 1) {
|
|
11181
11209
|
const item = active[0];
|
|
11182
11210
|
console.log(
|
|
11183
|
-
|
|
11211
|
+
chalk85.bold(`Auto-selecting item ${formatItemId(item.id)}: ${item.name}`)
|
|
11184
11212
|
);
|
|
11185
11213
|
return formatItemId(item.id);
|
|
11186
11214
|
}
|
|
@@ -11228,7 +11256,7 @@ function registerRefineCommand(cmd) {
|
|
|
11228
11256
|
}
|
|
11229
11257
|
|
|
11230
11258
|
// src/commands/backlog/rewindPhase.ts
|
|
11231
|
-
import
|
|
11259
|
+
import chalk86 from "chalk";
|
|
11232
11260
|
async function rewindPhase(id, phase, opts) {
|
|
11233
11261
|
const phaseNumber = Number.parseInt(phase, 10);
|
|
11234
11262
|
const found = await findOneItem(id);
|
|
@@ -11236,12 +11264,12 @@ async function rewindPhase(id, phase, opts) {
|
|
|
11236
11264
|
const { orm, item } = found;
|
|
11237
11265
|
const result = await rewindItemToPhase(orm, item, phaseNumber, opts.reason);
|
|
11238
11266
|
if (!result.ok) {
|
|
11239
|
-
console.log(
|
|
11267
|
+
console.log(chalk86.red(result.error));
|
|
11240
11268
|
process.exitCode = 1;
|
|
11241
11269
|
return;
|
|
11242
11270
|
}
|
|
11243
11271
|
console.log(
|
|
11244
|
-
|
|
11272
|
+
chalk86.green(
|
|
11245
11273
|
`Rewound item ${formatItemId(item.id)} to phase ${phaseNumber} (${result.phaseName}).`
|
|
11246
11274
|
)
|
|
11247
11275
|
);
|
|
@@ -11269,22 +11297,22 @@ function registerRunCommand(cmd) {
|
|
|
11269
11297
|
}
|
|
11270
11298
|
|
|
11271
11299
|
// src/commands/backlog/search/index.ts
|
|
11272
|
-
import
|
|
11300
|
+
import chalk87 from "chalk";
|
|
11273
11301
|
async function search(query) {
|
|
11274
11302
|
const items2 = await searchBacklog(query);
|
|
11275
11303
|
if (items2.length === 0) {
|
|
11276
|
-
console.log(
|
|
11304
|
+
console.log(chalk87.dim(`No items matching "${query}".`));
|
|
11277
11305
|
return;
|
|
11278
11306
|
}
|
|
11279
11307
|
console.log(
|
|
11280
|
-
|
|
11308
|
+
chalk87.dim(
|
|
11281
11309
|
`${items2.length} item${items2.length === 1 ? "" : "s"} matching "${query}":
|
|
11282
11310
|
`
|
|
11283
11311
|
)
|
|
11284
11312
|
);
|
|
11285
11313
|
for (const item of items2) {
|
|
11286
11314
|
console.log(
|
|
11287
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
11315
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk87.dim(formatItemId(item.id))} ${item.name}`
|
|
11288
11316
|
);
|
|
11289
11317
|
}
|
|
11290
11318
|
}
|
|
@@ -11295,18 +11323,18 @@ function registerSearchCommand(cmd) {
|
|
|
11295
11323
|
}
|
|
11296
11324
|
|
|
11297
11325
|
// src/commands/backlog/delete/index.ts
|
|
11298
|
-
import
|
|
11326
|
+
import chalk88 from "chalk";
|
|
11299
11327
|
async function del(id) {
|
|
11300
11328
|
const name = await removeItem(id);
|
|
11301
11329
|
if (name) {
|
|
11302
11330
|
console.log(
|
|
11303
|
-
|
|
11331
|
+
chalk88.green(`Deleted item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
11304
11332
|
);
|
|
11305
11333
|
}
|
|
11306
11334
|
}
|
|
11307
11335
|
|
|
11308
11336
|
// src/commands/backlog/done/index.ts
|
|
11309
|
-
import
|
|
11337
|
+
import chalk89 from "chalk";
|
|
11310
11338
|
async function done(id, summary) {
|
|
11311
11339
|
const found = await findOneItem(id);
|
|
11312
11340
|
if (!found) return;
|
|
@@ -11320,12 +11348,12 @@ async function done(id, summary) {
|
|
|
11320
11348
|
const pending = item.plan.slice(completedCount);
|
|
11321
11349
|
if (pending.length > 0) {
|
|
11322
11350
|
console.log(
|
|
11323
|
-
|
|
11351
|
+
chalk89.red(
|
|
11324
11352
|
`Cannot complete item ${formatItemId(item.id)}: ${pending.length} pending phase(s):`
|
|
11325
11353
|
)
|
|
11326
11354
|
);
|
|
11327
11355
|
for (const phase of pending) {
|
|
11328
|
-
console.log(
|
|
11356
|
+
console.log(chalk89.yellow(` - ${phase.name}`));
|
|
11329
11357
|
}
|
|
11330
11358
|
process.exitCode = 1;
|
|
11331
11359
|
return;
|
|
@@ -11337,12 +11365,12 @@ async function done(id, summary) {
|
|
|
11337
11365
|
await appendComment(orm, item.id, summary, { phase, type: "summary" });
|
|
11338
11366
|
}
|
|
11339
11367
|
console.log(
|
|
11340
|
-
|
|
11368
|
+
chalk89.green(`Completed item ${formatItemId(item.id)}: ${item.name}`)
|
|
11341
11369
|
);
|
|
11342
11370
|
}
|
|
11343
11371
|
|
|
11344
11372
|
// src/commands/backlog/set-status/index.ts
|
|
11345
|
-
import
|
|
11373
|
+
import chalk90 from "chalk";
|
|
11346
11374
|
var allowedStatuses = [
|
|
11347
11375
|
"todo",
|
|
11348
11376
|
"in-progress",
|
|
@@ -11352,7 +11380,7 @@ var allowedStatuses = [
|
|
|
11352
11380
|
async function setStatusCommand(id, status3) {
|
|
11353
11381
|
if (!allowedStatuses.includes(status3)) {
|
|
11354
11382
|
console.log(
|
|
11355
|
-
|
|
11383
|
+
chalk90.red(
|
|
11356
11384
|
`Invalid status "${status3}". Must be one of: ${allowedStatuses.join(", ")}.`
|
|
11357
11385
|
)
|
|
11358
11386
|
);
|
|
@@ -11362,7 +11390,7 @@ async function setStatusCommand(id, status3) {
|
|
|
11362
11390
|
const name = await setStatus(id, status3);
|
|
11363
11391
|
if (name) {
|
|
11364
11392
|
console.log(
|
|
11365
|
-
|
|
11393
|
+
chalk90.green(
|
|
11366
11394
|
`Set item ${formatItemId(parseItemId(id))} to ${status3}: ${name}`
|
|
11367
11395
|
)
|
|
11368
11396
|
);
|
|
@@ -11370,16 +11398,16 @@ async function setStatusCommand(id, status3) {
|
|
|
11370
11398
|
}
|
|
11371
11399
|
|
|
11372
11400
|
// src/commands/backlog/star/index.ts
|
|
11373
|
-
import
|
|
11401
|
+
import chalk92 from "chalk";
|
|
11374
11402
|
|
|
11375
11403
|
// src/commands/backlog/setStarred.ts
|
|
11376
|
-
import
|
|
11404
|
+
import chalk91 from "chalk";
|
|
11377
11405
|
async function setStarred(id, starred) {
|
|
11378
11406
|
const { orm } = await getReady();
|
|
11379
11407
|
const numId = parseItemId(id);
|
|
11380
11408
|
const name = await updateStarred(orm, numId, starred);
|
|
11381
11409
|
if (name === void 0)
|
|
11382
|
-
console.log(
|
|
11410
|
+
console.log(chalk91.red(`Item ${formatItemId(numId)} not found.`));
|
|
11383
11411
|
return name;
|
|
11384
11412
|
}
|
|
11385
11413
|
|
|
@@ -11388,52 +11416,52 @@ async function star(id) {
|
|
|
11388
11416
|
const name = await setStarred(id, true);
|
|
11389
11417
|
if (name) {
|
|
11390
11418
|
console.log(
|
|
11391
|
-
|
|
11419
|
+
chalk92.green(`Starred item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
11392
11420
|
);
|
|
11393
11421
|
}
|
|
11394
11422
|
}
|
|
11395
11423
|
|
|
11396
11424
|
// src/commands/backlog/start/index.ts
|
|
11397
|
-
import
|
|
11425
|
+
import chalk93 from "chalk";
|
|
11398
11426
|
async function start(id) {
|
|
11399
11427
|
const name = await setStatus(id, "in-progress");
|
|
11400
11428
|
if (name) {
|
|
11401
11429
|
console.log(
|
|
11402
|
-
|
|
11430
|
+
chalk93.green(`Started item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
11403
11431
|
);
|
|
11404
11432
|
}
|
|
11405
11433
|
}
|
|
11406
11434
|
|
|
11407
11435
|
// src/commands/backlog/stop/index.ts
|
|
11408
|
-
import
|
|
11436
|
+
import chalk94 from "chalk";
|
|
11409
11437
|
import { and as and10, eq as eq27 } from "drizzle-orm";
|
|
11410
11438
|
async function stop() {
|
|
11411
11439
|
const { orm } = await getReady();
|
|
11412
11440
|
const stopped = await orm.update(items).set({ status: "todo", currentPhase: 1 }).where(and10(eq27(items.status, "in-progress"), eq27(items.origin, getOrigin()))).returning({ id: items.id, name: items.name });
|
|
11413
11441
|
if (stopped.length === 0) {
|
|
11414
|
-
console.log(
|
|
11442
|
+
console.log(chalk94.yellow("No in-progress items to stop."));
|
|
11415
11443
|
return;
|
|
11416
11444
|
}
|
|
11417
11445
|
for (const item of stopped) {
|
|
11418
11446
|
console.log(
|
|
11419
|
-
|
|
11447
|
+
chalk94.yellow(`Stopped item ${formatItemId(item.id)}: ${item.name}`)
|
|
11420
11448
|
);
|
|
11421
11449
|
}
|
|
11422
11450
|
}
|
|
11423
11451
|
|
|
11424
11452
|
// src/commands/backlog/unstar/index.ts
|
|
11425
|
-
import
|
|
11453
|
+
import chalk95 from "chalk";
|
|
11426
11454
|
async function unstar(id) {
|
|
11427
11455
|
const name = await setStarred(id, false);
|
|
11428
11456
|
if (name) {
|
|
11429
11457
|
console.log(
|
|
11430
|
-
|
|
11458
|
+
chalk95.green(`Unstarred item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
11431
11459
|
);
|
|
11432
11460
|
}
|
|
11433
11461
|
}
|
|
11434
11462
|
|
|
11435
11463
|
// src/commands/backlog/wontdo/index.ts
|
|
11436
|
-
import
|
|
11464
|
+
import chalk96 from "chalk";
|
|
11437
11465
|
async function wontdo(id, reason) {
|
|
11438
11466
|
const found = await findOneItem(id);
|
|
11439
11467
|
if (!found) return;
|
|
@@ -11444,7 +11472,7 @@ async function wontdo(id, reason) {
|
|
|
11444
11472
|
await appendComment(orm, item.id, reason, { phase, type: "summary" });
|
|
11445
11473
|
}
|
|
11446
11474
|
console.log(
|
|
11447
|
-
|
|
11475
|
+
chalk96.red(`Won't do item ${formatItemId(item.id)}: ${item.name}`)
|
|
11448
11476
|
);
|
|
11449
11477
|
}
|
|
11450
11478
|
|
|
@@ -11463,17 +11491,17 @@ function registerStatusCommands(cmd) {
|
|
|
11463
11491
|
}
|
|
11464
11492
|
|
|
11465
11493
|
// src/commands/backlog/addSubtask.ts
|
|
11466
|
-
import
|
|
11494
|
+
import chalk97 from "chalk";
|
|
11467
11495
|
async function addSubtask(id, options2) {
|
|
11468
11496
|
const title = options2.title?.trim();
|
|
11469
11497
|
if (!title) {
|
|
11470
|
-
console.log(
|
|
11498
|
+
console.log(chalk97.red("A sub-task title is required (--title)."));
|
|
11471
11499
|
process.exitCode = 1;
|
|
11472
11500
|
return;
|
|
11473
11501
|
}
|
|
11474
11502
|
if (title.length > 50) {
|
|
11475
11503
|
console.log(
|
|
11476
|
-
|
|
11504
|
+
chalk97.red(
|
|
11477
11505
|
"A sub-task title must be 50 characters or fewer. Use --desc for longer detail."
|
|
11478
11506
|
)
|
|
11479
11507
|
);
|
|
@@ -11489,21 +11517,21 @@ async function addSubtask(id, options2) {
|
|
|
11489
11517
|
const description = options2.desc?.replaceAll(String.raw`\n`, "\n");
|
|
11490
11518
|
await insertSubtask(orm, item.id, title, description);
|
|
11491
11519
|
console.log(
|
|
11492
|
-
|
|
11520
|
+
chalk97.green(`Added sub-task to item ${formatItemId(item.id)}: ${title}`)
|
|
11493
11521
|
);
|
|
11494
11522
|
}
|
|
11495
11523
|
|
|
11496
11524
|
// src/commands/backlog/editSubtask.ts
|
|
11497
|
-
import
|
|
11525
|
+
import chalk99 from "chalk";
|
|
11498
11526
|
|
|
11499
11527
|
// src/commands/backlog/resolveSubtaskIndex.ts
|
|
11500
|
-
import
|
|
11528
|
+
import chalk98 from "chalk";
|
|
11501
11529
|
function resolveSubtaskIndex(index3, item) {
|
|
11502
11530
|
const position = Number.parseInt(index3, 10);
|
|
11503
11531
|
const subtasks = item.subtasks ?? [];
|
|
11504
11532
|
if (Number.isNaN(position) || position < 1 || position > subtasks.length) {
|
|
11505
11533
|
console.log(
|
|
11506
|
-
|
|
11534
|
+
chalk98.red(
|
|
11507
11535
|
`Item ${formatItemId(item.id)} has no sub-task ${index3}${subtasks.length > 0 ? ` (1-${subtasks.length})` : ""}.`
|
|
11508
11536
|
)
|
|
11509
11537
|
);
|
|
@@ -11570,21 +11598,21 @@ async function editSubtask(id, index3, options2) {
|
|
|
11570
11598
|
if (!found) return;
|
|
11571
11599
|
const fields = buildUpdate(options2);
|
|
11572
11600
|
if (typeof fields === "string") {
|
|
11573
|
-
console.log(
|
|
11601
|
+
console.log(chalk99.red(fields));
|
|
11574
11602
|
process.exitCode = 1;
|
|
11575
11603
|
return;
|
|
11576
11604
|
}
|
|
11577
11605
|
const { orm, item, idx } = found;
|
|
11578
11606
|
const title = await updateSubtask(orm, item.id, idx, fields);
|
|
11579
11607
|
console.log(
|
|
11580
|
-
|
|
11608
|
+
chalk99.green(
|
|
11581
11609
|
`Updated sub-task ${idx + 1} of item ${formatItemId(item.id)}: ${title}`
|
|
11582
11610
|
)
|
|
11583
11611
|
);
|
|
11584
11612
|
}
|
|
11585
11613
|
|
|
11586
11614
|
// src/commands/backlog/removeSubtask.ts
|
|
11587
|
-
import
|
|
11615
|
+
import chalk100 from "chalk";
|
|
11588
11616
|
|
|
11589
11617
|
// src/commands/backlog/deleteSubtask.ts
|
|
11590
11618
|
import { and as and12, asc as asc6, eq as eq29 } from "drizzle-orm";
|
|
@@ -11609,18 +11637,18 @@ async function removeSubtask(id, index3) {
|
|
|
11609
11637
|
const { orm, item, idx } = found;
|
|
11610
11638
|
const title = await deleteSubtask(orm, item.id, idx);
|
|
11611
11639
|
console.log(
|
|
11612
|
-
|
|
11640
|
+
chalk100.green(
|
|
11613
11641
|
`Removed sub-task ${idx + 1} of item ${formatItemId(item.id)}: ${title}`
|
|
11614
11642
|
)
|
|
11615
11643
|
);
|
|
11616
11644
|
}
|
|
11617
11645
|
|
|
11618
11646
|
// src/commands/backlog/subtaskStatus.ts
|
|
11619
|
-
import
|
|
11647
|
+
import chalk101 from "chalk";
|
|
11620
11648
|
async function subtaskStatus(id, index3, status3) {
|
|
11621
11649
|
if (!validSubtaskStatuses.includes(status3)) {
|
|
11622
11650
|
console.log(
|
|
11623
|
-
|
|
11651
|
+
chalk101.red(
|
|
11624
11652
|
`Invalid status "${status3}". Use one of: ${validSubtaskStatuses.join(", ")}.`
|
|
11625
11653
|
)
|
|
11626
11654
|
);
|
|
@@ -11637,7 +11665,7 @@ async function subtaskStatus(id, index3, status3) {
|
|
|
11637
11665
|
status3
|
|
11638
11666
|
);
|
|
11639
11667
|
console.log(
|
|
11640
|
-
|
|
11668
|
+
chalk101.green(
|
|
11641
11669
|
`Set sub-task ${idx + 1} of item ${formatItemId(item.id)} to ${status3}: ${title}`
|
|
11642
11670
|
)
|
|
11643
11671
|
);
|
|
@@ -11664,7 +11692,7 @@ function registerSubtaskCommands(cmd) {
|
|
|
11664
11692
|
}
|
|
11665
11693
|
|
|
11666
11694
|
// src/commands/backlog/movePhase.ts
|
|
11667
|
-
import
|
|
11695
|
+
import chalk102 from "chalk";
|
|
11668
11696
|
import { count as count5, eq as eq32 } from "drizzle-orm";
|
|
11669
11697
|
|
|
11670
11698
|
// src/commands/backlog/reorderPhaseRows.ts
|
|
@@ -11730,7 +11758,7 @@ function toIndex(value, phaseCount) {
|
|
|
11730
11758
|
const pos = Number.parseInt(value, 10);
|
|
11731
11759
|
if (Number.isNaN(pos) || pos < 1 || pos > phaseCount) {
|
|
11732
11760
|
console.log(
|
|
11733
|
-
|
|
11761
|
+
chalk102.red(
|
|
11734
11762
|
`Position "${value}" is out of range. Must be between 1 and ${phaseCount}.`
|
|
11735
11763
|
)
|
|
11736
11764
|
);
|
|
@@ -11753,11 +11781,11 @@ async function movePhase(id, from, to) {
|
|
|
11753
11781
|
if (fromIdx !== toIdx) {
|
|
11754
11782
|
await reorderPhaseRows(orm, itemId2, fromIdx, toIdx);
|
|
11755
11783
|
}
|
|
11756
|
-
console.log(
|
|
11784
|
+
console.log(chalk102.green(`Moved phase ${from} to position ${to}.`));
|
|
11757
11785
|
}
|
|
11758
11786
|
|
|
11759
11787
|
// src/commands/backlog/updatePhase.ts
|
|
11760
|
-
import
|
|
11788
|
+
import chalk104 from "chalk";
|
|
11761
11789
|
|
|
11762
11790
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
11763
11791
|
import { and as and15, eq as eq33 } from "drizzle-orm";
|
|
@@ -11792,7 +11820,7 @@ async function applyPhaseUpdate(orm, itemId2, phaseIdx, fields) {
|
|
|
11792
11820
|
}
|
|
11793
11821
|
|
|
11794
11822
|
// src/commands/backlog/findPhase.ts
|
|
11795
|
-
import
|
|
11823
|
+
import chalk103 from "chalk";
|
|
11796
11824
|
import { and as and16, count as count6, eq as eq34 } from "drizzle-orm";
|
|
11797
11825
|
async function findPhase(id, phase) {
|
|
11798
11826
|
const found = await findOneItem(id);
|
|
@@ -11803,7 +11831,7 @@ async function findPhase(id, phase) {
|
|
|
11803
11831
|
const [row] = await orm.select({ cnt: count6() }).from(planPhases).where(and16(eq34(planPhases.itemId, itemId2), eq34(planPhases.idx, phaseIdx)));
|
|
11804
11832
|
if (!row || row.cnt === 0) {
|
|
11805
11833
|
console.log(
|
|
11806
|
-
|
|
11834
|
+
chalk103.red(
|
|
11807
11835
|
`Phase ${phaseIdx + 1} not found on item ${formatItemId(itemId2)}.`
|
|
11808
11836
|
)
|
|
11809
11837
|
);
|
|
@@ -11937,7 +11965,7 @@ async function updatePhase(id, phase, options2) {
|
|
|
11937
11965
|
const { item, orm, itemId: itemId2, phaseIdx } = found;
|
|
11938
11966
|
const resolved = resolvePhaseFields(options2, item.plan?.[phaseIdx]);
|
|
11939
11967
|
if (!resolved.ok) {
|
|
11940
|
-
console.log(
|
|
11968
|
+
console.log(chalk104.red(resolved.error));
|
|
11941
11969
|
process.exitCode = 1;
|
|
11942
11970
|
return;
|
|
11943
11971
|
}
|
|
@@ -11949,7 +11977,7 @@ async function updatePhase(id, phase, options2) {
|
|
|
11949
11977
|
manualCheck && "manual checks"
|
|
11950
11978
|
].filter(Boolean).join(", ");
|
|
11951
11979
|
console.log(
|
|
11952
|
-
|
|
11980
|
+
chalk104.green(
|
|
11953
11981
|
`Updated ${fields} on phase ${phaseIdx + 1} of item ${formatItemId(itemId2)}.`
|
|
11954
11982
|
)
|
|
11955
11983
|
);
|
|
@@ -11972,7 +12000,7 @@ function registerUpdatePhaseCommand(cmd) {
|
|
|
11972
12000
|
}
|
|
11973
12001
|
|
|
11974
12002
|
// src/commands/backlog/removePhase.ts
|
|
11975
|
-
import
|
|
12003
|
+
import chalk105 from "chalk";
|
|
11976
12004
|
import { and as and17, eq as eq35 } from "drizzle-orm";
|
|
11977
12005
|
async function removePhase(id, phase) {
|
|
11978
12006
|
const found = await findPhase(id, phase);
|
|
@@ -11987,27 +12015,27 @@ async function removePhase(id, phase) {
|
|
|
11987
12015
|
await adjustCurrentPhase(tx, item, phaseIdx);
|
|
11988
12016
|
});
|
|
11989
12017
|
console.log(
|
|
11990
|
-
|
|
12018
|
+
chalk105.green(
|
|
11991
12019
|
`Removed phase ${phaseIdx + 1} from item ${formatItemId(itemId2)}.`
|
|
11992
12020
|
)
|
|
11993
12021
|
);
|
|
11994
12022
|
}
|
|
11995
12023
|
|
|
11996
12024
|
// src/commands/backlog/update/update.ts
|
|
11997
|
-
import
|
|
12025
|
+
import chalk109 from "chalk";
|
|
11998
12026
|
import { eq as eq36 } from "drizzle-orm";
|
|
11999
12027
|
|
|
12000
12028
|
// src/commands/backlog/update/buildUpdateValues.ts
|
|
12001
|
-
import
|
|
12029
|
+
import chalk106 from "chalk";
|
|
12002
12030
|
function buildUpdateValues(options2) {
|
|
12003
12031
|
const { name, desc: desc6, type, ac, origin } = options2;
|
|
12004
12032
|
if (!name && !desc6 && !type && !ac && !origin) {
|
|
12005
|
-
console.log(
|
|
12033
|
+
console.log(chalk106.red("Nothing to update. Provide at least one flag."));
|
|
12006
12034
|
process.exitCode = 1;
|
|
12007
12035
|
return void 0;
|
|
12008
12036
|
}
|
|
12009
12037
|
if (type && type !== "story" && type !== "bug") {
|
|
12010
|
-
console.log(
|
|
12038
|
+
console.log(chalk106.red('Invalid type. Must be "story" or "bug".'));
|
|
12011
12039
|
process.exitCode = 1;
|
|
12012
12040
|
return void 0;
|
|
12013
12041
|
}
|
|
@@ -12037,7 +12065,7 @@ function buildUpdateValues(options2) {
|
|
|
12037
12065
|
}
|
|
12038
12066
|
|
|
12039
12067
|
// src/commands/backlog/update/resolveAcUpdate.ts
|
|
12040
|
-
import
|
|
12068
|
+
import chalk107 from "chalk";
|
|
12041
12069
|
|
|
12042
12070
|
// src/commands/backlog/update/applyAcMutations.ts
|
|
12043
12071
|
function hasAcMutations(options2) {
|
|
@@ -12062,14 +12090,14 @@ function resolveAcUpdate(options2, currentCriteria) {
|
|
|
12062
12090
|
if (!hasAcMutations(options2)) return { ok: true, ac: options2.ac };
|
|
12063
12091
|
if (options2.ac) {
|
|
12064
12092
|
console.log(
|
|
12065
|
-
|
|
12093
|
+
chalk107.red("Cannot combine --ac with --add-ac/--edit-ac/--remove-ac.")
|
|
12066
12094
|
);
|
|
12067
12095
|
process.exitCode = 1;
|
|
12068
12096
|
return { ok: false };
|
|
12069
12097
|
}
|
|
12070
12098
|
const mutation = applyAcMutations(currentCriteria, options2);
|
|
12071
12099
|
if (!mutation.ok) {
|
|
12072
|
-
console.log(
|
|
12100
|
+
console.log(chalk107.red(mutation.error));
|
|
12073
12101
|
process.exitCode = 1;
|
|
12074
12102
|
return { ok: false };
|
|
12075
12103
|
}
|
|
@@ -12077,14 +12105,14 @@ function resolveAcUpdate(options2, currentCriteria) {
|
|
|
12077
12105
|
}
|
|
12078
12106
|
|
|
12079
12107
|
// src/commands/backlog/update/resolveOriginUpdate.ts
|
|
12080
|
-
import
|
|
12108
|
+
import chalk108 from "chalk";
|
|
12081
12109
|
function resolveOriginUpdate(optionOrigin, item) {
|
|
12082
12110
|
if (optionOrigin === void 0 || optionOrigin === false)
|
|
12083
12111
|
return { kind: "none" };
|
|
12084
12112
|
const origin = typeof optionOrigin === "string" ? normalizeOrigin(optionOrigin) : getOrigin();
|
|
12085
12113
|
if (origin === item.origin) {
|
|
12086
12114
|
console.log(
|
|
12087
|
-
|
|
12115
|
+
chalk108.yellow(
|
|
12088
12116
|
`Item ${formatItemId(item.id)} is already on origin "${origin}"; nothing to change.`
|
|
12089
12117
|
)
|
|
12090
12118
|
);
|
|
@@ -12108,7 +12136,7 @@ async function update(id, options2) {
|
|
|
12108
12136
|
const itemId2 = found.item.id;
|
|
12109
12137
|
await orm.update(items).set(built.set).where(eq36(items.id, itemId2));
|
|
12110
12138
|
console.log(
|
|
12111
|
-
|
|
12139
|
+
chalk109.green(`Updated ${built.fields} on item ${formatItemId(itemId2)}.`)
|
|
12112
12140
|
);
|
|
12113
12141
|
}
|
|
12114
12142
|
|
|
@@ -12918,11 +12946,11 @@ function assertCliExists(cli) {
|
|
|
12918
12946
|
}
|
|
12919
12947
|
|
|
12920
12948
|
// src/commands/permitCliReads/colorize.ts
|
|
12921
|
-
import
|
|
12949
|
+
import chalk110 from "chalk";
|
|
12922
12950
|
function colorize(plainOutput) {
|
|
12923
12951
|
return plainOutput.split("\n").map((line) => {
|
|
12924
|
-
if (line.startsWith(" R ")) return
|
|
12925
|
-
if (line.startsWith(" W ")) return
|
|
12952
|
+
if (line.startsWith(" R ")) return chalk110.green(line);
|
|
12953
|
+
if (line.startsWith(" W ")) return chalk110.red(line);
|
|
12926
12954
|
return line;
|
|
12927
12955
|
}).join("\n");
|
|
12928
12956
|
}
|
|
@@ -13220,7 +13248,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
13220
13248
|
}
|
|
13221
13249
|
|
|
13222
13250
|
// src/commands/deny/denyAdd.ts
|
|
13223
|
-
import
|
|
13251
|
+
import chalk111 from "chalk";
|
|
13224
13252
|
|
|
13225
13253
|
// src/commands/deny/loadDenyConfig.ts
|
|
13226
13254
|
function loadDenyConfig(global) {
|
|
@@ -13240,16 +13268,16 @@ function loadDenyConfig(global) {
|
|
|
13240
13268
|
function denyAdd(pattern2, message2, options2) {
|
|
13241
13269
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
13242
13270
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
13243
|
-
console.log(
|
|
13271
|
+
console.log(chalk111.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
13244
13272
|
return;
|
|
13245
13273
|
}
|
|
13246
13274
|
deny.push({ pattern: pattern2, message: message2 });
|
|
13247
13275
|
saveDeny(deny);
|
|
13248
|
-
console.log(
|
|
13276
|
+
console.log(chalk111.green(`Added deny rule: ${pattern2} \u2192 ${message2}`));
|
|
13249
13277
|
}
|
|
13250
13278
|
|
|
13251
13279
|
// src/commands/deny/denyList.ts
|
|
13252
|
-
import
|
|
13280
|
+
import chalk112 from "chalk";
|
|
13253
13281
|
function denyList() {
|
|
13254
13282
|
const globalRaw = loadGlobalConfigRaw();
|
|
13255
13283
|
const projectRaw = loadProjectConfig();
|
|
@@ -13260,7 +13288,7 @@ function denyList() {
|
|
|
13260
13288
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
13261
13289
|
);
|
|
13262
13290
|
if (!merged || merged.length === 0) {
|
|
13263
|
-
console.log(
|
|
13291
|
+
console.log(chalk112.dim("No deny rules configured."));
|
|
13264
13292
|
return;
|
|
13265
13293
|
}
|
|
13266
13294
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -13268,23 +13296,23 @@ function denyList() {
|
|
|
13268
13296
|
for (const rule of merged) {
|
|
13269
13297
|
const inProject = projectPatterns.has(rule.pattern);
|
|
13270
13298
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
13271
|
-
const label2 = inProject && inGlobal ?
|
|
13272
|
-
console.log(`${
|
|
13299
|
+
const label2 = inProject && inGlobal ? chalk112.dim(" (project, overrides global)") : inGlobal ? chalk112.dim(" (global)") : "";
|
|
13300
|
+
console.log(`${chalk112.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
13273
13301
|
}
|
|
13274
13302
|
}
|
|
13275
13303
|
|
|
13276
13304
|
// src/commands/deny/denyRemove.ts
|
|
13277
|
-
import
|
|
13305
|
+
import chalk113 from "chalk";
|
|
13278
13306
|
function denyRemove(pattern2, options2) {
|
|
13279
13307
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
13280
13308
|
const index3 = deny.findIndex((r) => r.pattern === pattern2);
|
|
13281
13309
|
if (index3 === -1) {
|
|
13282
|
-
console.log(
|
|
13310
|
+
console.log(chalk113.yellow(`No deny rule found for: ${pattern2}`));
|
|
13283
13311
|
return;
|
|
13284
13312
|
}
|
|
13285
13313
|
deny.splice(index3, 1);
|
|
13286
13314
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
13287
|
-
console.log(
|
|
13315
|
+
console.log(chalk113.green(`Removed deny rule: ${pattern2}`));
|
|
13288
13316
|
}
|
|
13289
13317
|
|
|
13290
13318
|
// src/commands/registerDeny.ts
|
|
@@ -13328,7 +13356,7 @@ function registerCliHook(program2) {
|
|
|
13328
13356
|
|
|
13329
13357
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
13330
13358
|
import { existsSync as existsSync33, readFileSync as readFileSync27, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
|
|
13331
|
-
import
|
|
13359
|
+
import chalk114 from "chalk";
|
|
13332
13360
|
|
|
13333
13361
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
13334
13362
|
import { homedir as homedir17 } from "os";
|
|
@@ -13381,12 +13409,12 @@ function codeCommentConfirm(pin) {
|
|
|
13381
13409
|
sweepRestrictedDir();
|
|
13382
13410
|
const state = readPinState(pin);
|
|
13383
13411
|
if (!state) {
|
|
13384
|
-
console.error(
|
|
13412
|
+
console.error(chalk114.red(`No pending comment for pin: ${pin}`));
|
|
13385
13413
|
process.exitCode = 1;
|
|
13386
13414
|
return;
|
|
13387
13415
|
}
|
|
13388
13416
|
if (!existsSync33(state.file)) {
|
|
13389
|
-
console.error(
|
|
13417
|
+
console.error(chalk114.red(`Target file no longer exists: ${state.file}`));
|
|
13390
13418
|
process.exitCode = 1;
|
|
13391
13419
|
return;
|
|
13392
13420
|
}
|
|
@@ -13395,7 +13423,7 @@ function codeCommentConfirm(pin) {
|
|
|
13395
13423
|
const index3 = state.line - 1;
|
|
13396
13424
|
if (index3 > lines.length) {
|
|
13397
13425
|
console.error(
|
|
13398
|
-
|
|
13426
|
+
chalk114.red(
|
|
13399
13427
|
`Line ${state.line} is beyond the end of ${state.file} (${lines.length} lines).`
|
|
13400
13428
|
)
|
|
13401
13429
|
);
|
|
@@ -13409,14 +13437,14 @@ function codeCommentConfirm(pin) {
|
|
|
13409
13437
|
writeFileSync24(state.file, lines.join("\n"));
|
|
13410
13438
|
unlinkSync8(getPinStatePath(pin));
|
|
13411
13439
|
console.log(
|
|
13412
|
-
|
|
13440
|
+
chalk114.green(
|
|
13413
13441
|
`Inserted "${marker} ${state.text}" at ${state.file}:${state.line}`
|
|
13414
13442
|
)
|
|
13415
13443
|
);
|
|
13416
13444
|
}
|
|
13417
13445
|
|
|
13418
13446
|
// src/commands/codeComment/codeCommentSet.ts
|
|
13419
|
-
import
|
|
13447
|
+
import chalk115 from "chalk";
|
|
13420
13448
|
|
|
13421
13449
|
// src/commands/codeComment/validateCommentText.ts
|
|
13422
13450
|
var MAX_COMMENT_LENGTH = 50;
|
|
@@ -13467,7 +13495,7 @@ function generatePin() {
|
|
|
13467
13495
|
function codeCommentSet(file, line, text17) {
|
|
13468
13496
|
const lineNumber = Number.parseInt(line, 10);
|
|
13469
13497
|
if (!Number.isInteger(lineNumber) || lineNumber < 1) {
|
|
13470
|
-
console.error(
|
|
13498
|
+
console.error(chalk115.red(`Invalid line number: ${line}`));
|
|
13471
13499
|
process.exitCode = 1;
|
|
13472
13500
|
return;
|
|
13473
13501
|
}
|
|
@@ -13475,20 +13503,20 @@ function codeCommentSet(file, line, text17) {
|
|
|
13475
13503
|
const marker = hash ? "#" : "//";
|
|
13476
13504
|
const validation = validateCommentText(text17, hash);
|
|
13477
13505
|
if (!validation.ok) {
|
|
13478
|
-
console.error(
|
|
13479
|
-
console.error(
|
|
13506
|
+
console.error(chalk115.red(`Refused: ${validation.reason}`));
|
|
13507
|
+
console.error(chalk115.red("No pin issued."));
|
|
13480
13508
|
process.exitCode = 1;
|
|
13481
13509
|
return;
|
|
13482
13510
|
}
|
|
13483
13511
|
console.error(
|
|
13484
|
-
|
|
13512
|
+
chalk115.yellow.bold(
|
|
13485
13513
|
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a comment. DO NOT WASTE THEIR TIME.\nYou had BETTER BE RIGHT that this comment is genuinely necessary.\n\nComments are a last resort, not a habit. Almost every comment you reach for is a sign\nthe code should be clearer instead. Before a human is pulled in, ask whether a better\nname, a smaller function, or a test would make the comment redundant. ONLY if you are\ncertain this one line earns its keep should you proceed to the confirm step below."
|
|
13486
13514
|
)
|
|
13487
13515
|
);
|
|
13488
13516
|
const delivered = issuePin(file, lineNumber, validation.text);
|
|
13489
13517
|
if (!delivered) {
|
|
13490
13518
|
console.error(
|
|
13491
|
-
|
|
13519
|
+
chalk115.red(
|
|
13492
13520
|
"Could not deliver the confirmation pin via notification.\nThe comment cannot be confirmed until the notification channel works."
|
|
13493
13521
|
)
|
|
13494
13522
|
);
|
|
@@ -13498,7 +13526,7 @@ function codeCommentSet(file, line, text17) {
|
|
|
13498
13526
|
console.log(
|
|
13499
13527
|
`A confirmation pin was sent to your desktop notifications.
|
|
13500
13528
|
To insert "${marker} ${validation.text}" at ${file}:${lineNumber}, run:
|
|
13501
|
-
${
|
|
13529
|
+
${chalk115.cyan(" assist code-comment confirm <PIN>")}
|
|
13502
13530
|
using the pin from that notification.`
|
|
13503
13531
|
);
|
|
13504
13532
|
}
|
|
@@ -13577,15 +13605,15 @@ function registerCodexHook(program2) {
|
|
|
13577
13605
|
}
|
|
13578
13606
|
|
|
13579
13607
|
// src/commands/complexity/analyze.ts
|
|
13580
|
-
import
|
|
13608
|
+
import chalk124 from "chalk";
|
|
13581
13609
|
|
|
13582
13610
|
// src/commands/complexity/cyclomatic.ts
|
|
13583
|
-
import
|
|
13611
|
+
import chalk117 from "chalk";
|
|
13584
13612
|
|
|
13585
13613
|
// src/commands/complexity/shared/index.ts
|
|
13586
13614
|
import fs20 from "fs";
|
|
13587
13615
|
import path27 from "path";
|
|
13588
|
-
import
|
|
13616
|
+
import chalk116 from "chalk";
|
|
13589
13617
|
import ts5 from "typescript";
|
|
13590
13618
|
|
|
13591
13619
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -13836,7 +13864,7 @@ function createSourceFromFile(filePath) {
|
|
|
13836
13864
|
function withSourceFiles(pattern2, callback, extraIgnore = []) {
|
|
13837
13865
|
const files = findSourceFiles2(pattern2, ".", extraIgnore);
|
|
13838
13866
|
if (files.length === 0) {
|
|
13839
|
-
console.log(
|
|
13867
|
+
console.log(chalk116.yellow("No files found matching pattern"));
|
|
13840
13868
|
return void 0;
|
|
13841
13869
|
}
|
|
13842
13870
|
return callback(files);
|
|
@@ -13869,11 +13897,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
13869
13897
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
13870
13898
|
for (const { file, name, complexity } of results) {
|
|
13871
13899
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
13872
|
-
const color = exceedsThreshold ?
|
|
13873
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
13900
|
+
const color = exceedsThreshold ? chalk117.red : chalk117.white;
|
|
13901
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk117.cyan(complexity)}`);
|
|
13874
13902
|
}
|
|
13875
13903
|
console.log(
|
|
13876
|
-
|
|
13904
|
+
chalk117.dim(
|
|
13877
13905
|
`
|
|
13878
13906
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
13879
13907
|
)
|
|
@@ -13885,7 +13913,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
13885
13913
|
}
|
|
13886
13914
|
|
|
13887
13915
|
// src/commands/complexity/halstead.ts
|
|
13888
|
-
import
|
|
13916
|
+
import chalk118 from "chalk";
|
|
13889
13917
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
13890
13918
|
withSourceFiles(pattern2, (files) => {
|
|
13891
13919
|
const results = [];
|
|
@@ -13900,13 +13928,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
13900
13928
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
13901
13929
|
for (const { file, name, metrics } of results) {
|
|
13902
13930
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
13903
|
-
const color = exceedsThreshold ?
|
|
13931
|
+
const color = exceedsThreshold ? chalk118.red : chalk118.white;
|
|
13904
13932
|
console.log(
|
|
13905
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
13933
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk118.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk118.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk118.magenta(metrics.effort.toFixed(1))}`
|
|
13906
13934
|
);
|
|
13907
13935
|
}
|
|
13908
13936
|
console.log(
|
|
13909
|
-
|
|
13937
|
+
chalk118.dim(
|
|
13910
13938
|
`
|
|
13911
13939
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
13912
13940
|
)
|
|
@@ -13975,15 +14003,15 @@ function collectFileMetrics(files) {
|
|
|
13975
14003
|
}
|
|
13976
14004
|
|
|
13977
14005
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
13978
|
-
import
|
|
14006
|
+
import chalk122 from "chalk";
|
|
13979
14007
|
|
|
13980
14008
|
// src/commands/complexity/maintainability/formatResultLine.ts
|
|
13981
|
-
import
|
|
14009
|
+
import chalk119 from "chalk";
|
|
13982
14010
|
function formatResultLine(entry, failing) {
|
|
13983
14011
|
const { file, avgMaintainability, minMaintainability, override } = entry;
|
|
13984
|
-
const name = failing ?
|
|
13985
|
-
const suffix = override !== void 0 ?
|
|
13986
|
-
return `${name} \u2192 avg: ${
|
|
14012
|
+
const name = failing ? chalk119.red(file) : chalk119.white(file);
|
|
14013
|
+
const suffix = override !== void 0 ? chalk119.magenta(` (override: ${override})`) : "";
|
|
14014
|
+
return `${name} \u2192 avg: ${chalk119.cyan(avgMaintainability.toFixed(1))}, min: ${chalk119.yellow(minMaintainability.toFixed(1))}${suffix}`;
|
|
13987
14015
|
}
|
|
13988
14016
|
|
|
13989
14017
|
// src/commands/complexity/maintainability/getMaintainabilityGitState.ts
|
|
@@ -14034,38 +14062,38 @@ function getMaintainabilityGitState() {
|
|
|
14034
14062
|
|
|
14035
14063
|
// src/commands/complexity/maintainability/printMaintainabilityFailure.ts
|
|
14036
14064
|
import path29 from "path";
|
|
14037
|
-
import
|
|
14065
|
+
import chalk120 from "chalk";
|
|
14038
14066
|
var extractTemplate = "assist refactor extract <file> <functionName> <destination> --apply";
|
|
14039
14067
|
function remediationLine(entry) {
|
|
14040
|
-
return ` ${
|
|
14068
|
+
return ` ${chalk120.bold(entry.file)}
|
|
14041
14069
|
Pick a responsibility and extract it:
|
|
14042
|
-
${
|
|
14070
|
+
${chalk120.cyan(extractTemplate)}`;
|
|
14043
14071
|
}
|
|
14044
14072
|
function cheatLine(entry, gitState) {
|
|
14045
14073
|
const shrank = gitState.shrunkFiles.has(path29.resolve(entry.file));
|
|
14046
14074
|
if (!shrank || gitState.newFileCreated) return "";
|
|
14047
14075
|
return `
|
|
14048
|
-
${
|
|
14076
|
+
${chalk120.red("\u2717 You shrank existing lines in this file without creating a new file. That cannot clear the gate \u2014 extract a responsibility to a new file.")}`;
|
|
14049
14077
|
}
|
|
14050
14078
|
function printMaintainabilityFailure(failing, gitState) {
|
|
14051
14079
|
const blocks = failing.map((entry) => `${remediationLine(entry)}${cheatLine(entry, gitState)}`).join("\n");
|
|
14052
14080
|
console.error(
|
|
14053
|
-
|
|
14081
|
+
chalk120.red(
|
|
14054
14082
|
`
|
|
14055
14083
|
Fail: ${failing.length} file(s) below threshold \u2192 extract a responsibility to a new file.
|
|
14056
14084
|
|
|
14057
14085
|
${blocks}
|
|
14058
14086
|
|
|
14059
|
-
${
|
|
14087
|
+
${chalk120.bold("Diagnose and fix one file at a time.")} Only a new file (Write) or 'assist refactor extract' clears this gate \u2014 editing the existing lines does not.`
|
|
14060
14088
|
)
|
|
14061
14089
|
);
|
|
14062
14090
|
}
|
|
14063
14091
|
|
|
14064
14092
|
// src/commands/complexity/maintainability/printMaintainabilityFormula.ts
|
|
14065
|
-
import
|
|
14093
|
+
import chalk121 from "chalk";
|
|
14066
14094
|
var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
|
|
14067
14095
|
function printMaintainabilityFormula() {
|
|
14068
|
-
console.log(
|
|
14096
|
+
console.log(chalk121.dim(MI_FORMULA));
|
|
14069
14097
|
}
|
|
14070
14098
|
|
|
14071
14099
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
@@ -14074,7 +14102,7 @@ function displayMaintainabilityResults(results, threshold, gitState = getMaintai
|
|
|
14074
14102
|
if (!gating) {
|
|
14075
14103
|
printMaintainabilityFormula();
|
|
14076
14104
|
for (const entry of results) console.log(formatResultLine(entry, false));
|
|
14077
|
-
console.log(
|
|
14105
|
+
console.log(chalk122.dim(`
|
|
14078
14106
|
Analyzed ${results.length} files`));
|
|
14079
14107
|
return;
|
|
14080
14108
|
}
|
|
@@ -14083,14 +14111,14 @@ Analyzed ${results.length} files`));
|
|
|
14083
14111
|
return limit !== void 0 && r.minMaintainability < limit;
|
|
14084
14112
|
});
|
|
14085
14113
|
if (failing.length === 0) {
|
|
14086
|
-
console.log(
|
|
14114
|
+
console.log(chalk122.green("All files pass maintainability threshold"));
|
|
14087
14115
|
}
|
|
14088
14116
|
const passingOverrides = results.filter(
|
|
14089
14117
|
(r) => r.override !== void 0 && !failing.includes(r)
|
|
14090
14118
|
);
|
|
14091
14119
|
for (const entry of passingOverrides)
|
|
14092
14120
|
console.log(formatResultLine(entry, false));
|
|
14093
|
-
console.log(
|
|
14121
|
+
console.log(chalk122.dim(`
|
|
14094
14122
|
Analyzed ${results.length} files`));
|
|
14095
14123
|
if (failing.length > 0) {
|
|
14096
14124
|
printMaintainabilityFailure(failing, gitState);
|
|
@@ -14113,7 +14141,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
14113
14141
|
|
|
14114
14142
|
// src/commands/complexity/sloc.ts
|
|
14115
14143
|
import fs22 from "fs";
|
|
14116
|
-
import
|
|
14144
|
+
import chalk123 from "chalk";
|
|
14117
14145
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
14118
14146
|
withSourceFiles(pattern2, (files) => {
|
|
14119
14147
|
const results = [];
|
|
@@ -14129,12 +14157,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
14129
14157
|
results.sort((a, b) => b.lines - a.lines);
|
|
14130
14158
|
for (const { file, lines } of results) {
|
|
14131
14159
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
14132
|
-
const color = exceedsThreshold ?
|
|
14133
|
-
console.log(`${color(file)} \u2192 ${
|
|
14160
|
+
const color = exceedsThreshold ? chalk123.red : chalk123.white;
|
|
14161
|
+
console.log(`${color(file)} \u2192 ${chalk123.cyan(lines)} lines`);
|
|
14134
14162
|
}
|
|
14135
14163
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
14136
14164
|
console.log(
|
|
14137
|
-
|
|
14165
|
+
chalk123.dim(`
|
|
14138
14166
|
Total: ${total} lines across ${files.length} files`)
|
|
14139
14167
|
);
|
|
14140
14168
|
if (hasViolation) {
|
|
@@ -14148,25 +14176,25 @@ async function analyze(pattern2) {
|
|
|
14148
14176
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
14149
14177
|
const files = findSourceFiles2(searchPattern);
|
|
14150
14178
|
if (files.length === 0) {
|
|
14151
|
-
console.log(
|
|
14179
|
+
console.log(chalk124.yellow("No files found matching pattern"));
|
|
14152
14180
|
return;
|
|
14153
14181
|
}
|
|
14154
14182
|
if (files.length === 1) {
|
|
14155
14183
|
const file = files[0];
|
|
14156
|
-
console.log(
|
|
14184
|
+
console.log(chalk124.bold.underline("SLOC"));
|
|
14157
14185
|
await sloc(file);
|
|
14158
14186
|
console.log();
|
|
14159
|
-
console.log(
|
|
14187
|
+
console.log(chalk124.bold.underline("Cyclomatic Complexity"));
|
|
14160
14188
|
await cyclomatic(file);
|
|
14161
14189
|
console.log();
|
|
14162
|
-
console.log(
|
|
14190
|
+
console.log(chalk124.bold.underline("Halstead Metrics"));
|
|
14163
14191
|
await halstead(file);
|
|
14164
14192
|
console.log();
|
|
14165
|
-
console.log(
|
|
14193
|
+
console.log(chalk124.bold.underline("Maintainability Index"));
|
|
14166
14194
|
await maintainability(file);
|
|
14167
14195
|
console.log();
|
|
14168
14196
|
console.log(
|
|
14169
|
-
|
|
14197
|
+
chalk124.dim(
|
|
14170
14198
|
"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."
|
|
14171
14199
|
)
|
|
14172
14200
|
);
|
|
@@ -14217,7 +14245,7 @@ function configList() {
|
|
|
14217
14245
|
}
|
|
14218
14246
|
|
|
14219
14247
|
// src/commands/config/configGet.ts
|
|
14220
|
-
import
|
|
14248
|
+
import chalk125 from "chalk";
|
|
14221
14249
|
|
|
14222
14250
|
// src/commands/config/getNestedValue.ts
|
|
14223
14251
|
function isTraversable(value) {
|
|
@@ -14249,15 +14277,15 @@ function requireNestedValue(config, key) {
|
|
|
14249
14277
|
return value;
|
|
14250
14278
|
}
|
|
14251
14279
|
function exitKeyNotSet(key) {
|
|
14252
|
-
console.error(
|
|
14280
|
+
console.error(chalk125.red(`Key "${key}" is not set`));
|
|
14253
14281
|
process.exit(1);
|
|
14254
14282
|
}
|
|
14255
14283
|
|
|
14256
14284
|
// src/commands/config/configSet.ts
|
|
14257
|
-
import
|
|
14285
|
+
import chalk128 from "chalk";
|
|
14258
14286
|
|
|
14259
14287
|
// src/commands/config/applyConfigSet.ts
|
|
14260
|
-
import
|
|
14288
|
+
import chalk127 from "chalk";
|
|
14261
14289
|
|
|
14262
14290
|
// src/commands/config/setNestedValue.ts
|
|
14263
14291
|
function isPlainObject(val) {
|
|
@@ -14308,7 +14336,7 @@ function setNestedValue(obj, path71, value) {
|
|
|
14308
14336
|
}
|
|
14309
14337
|
|
|
14310
14338
|
// src/commands/config/validateConfig.ts
|
|
14311
|
-
import
|
|
14339
|
+
import chalk126 from "chalk";
|
|
14312
14340
|
function validateConfig(updated, key) {
|
|
14313
14341
|
const result = assistConfigSchema.safeParse(updated);
|
|
14314
14342
|
if (!result.success) return exitValidationFailed(result.error.issues, key);
|
|
@@ -14321,7 +14349,7 @@ function exitValidationFailed(issues, key) {
|
|
|
14321
14349
|
function printValidationErrors(issues, key) {
|
|
14322
14350
|
for (const issue of issues) {
|
|
14323
14351
|
console.error(
|
|
14324
|
-
|
|
14352
|
+
chalk126.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
14325
14353
|
);
|
|
14326
14354
|
}
|
|
14327
14355
|
}
|
|
@@ -14346,7 +14374,7 @@ function applyConfigSet(key, coerced, global) {
|
|
|
14346
14374
|
function assertNotGlobalOnly(key, global) {
|
|
14347
14375
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
14348
14376
|
console.error(
|
|
14349
|
-
|
|
14377
|
+
chalk127.red(
|
|
14350
14378
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
14351
14379
|
)
|
|
14352
14380
|
);
|
|
@@ -14407,19 +14435,19 @@ function resolveRepoTarget(key, value, repo) {
|
|
|
14407
14435
|
function configSet(key, value, options2 = {}) {
|
|
14408
14436
|
if (options2.repo !== void 0 && !options2.global) {
|
|
14409
14437
|
console.error(
|
|
14410
|
-
|
|
14438
|
+
chalk128.red("--repo writes to the global config; add -g (e.g. -g --repo)")
|
|
14411
14439
|
);
|
|
14412
14440
|
process.exit(1);
|
|
14413
14441
|
}
|
|
14414
14442
|
const resolved = resolveRepoTarget(key, value, options2.repo);
|
|
14415
14443
|
if (resolved.value === void 0) {
|
|
14416
|
-
console.error(
|
|
14444
|
+
console.error(chalk128.red(`Missing required argument for '${resolved.key}'`));
|
|
14417
14445
|
process.exit(1);
|
|
14418
14446
|
}
|
|
14419
14447
|
const coerced = coerceValue(resolved.value);
|
|
14420
14448
|
const target = resolved.useRepo ? `repo: ${applyRepoConfigSet(resolved.key, coerced, resolved.repoName)}` : applyConfigSet(resolved.key, coerced, options2.global ?? false);
|
|
14421
14449
|
console.log(
|
|
14422
|
-
|
|
14450
|
+
chalk128.green(`Set ${resolved.key} = ${JSON.stringify(coerced)} (${target})`)
|
|
14423
14451
|
);
|
|
14424
14452
|
}
|
|
14425
14453
|
function coerceValue(value) {
|
|
@@ -14440,40 +14468,40 @@ function registerConfig(program2) {
|
|
|
14440
14468
|
}
|
|
14441
14469
|
|
|
14442
14470
|
// src/commands/db/reportMigrationStatus.ts
|
|
14443
|
-
import
|
|
14471
|
+
import chalk129 from "chalk";
|
|
14444
14472
|
function reportApplied(applied) {
|
|
14445
14473
|
if (applied.length === 0) {
|
|
14446
|
-
console.error(
|
|
14474
|
+
console.error(chalk129.green("Database is up to date; nothing to apply."));
|
|
14447
14475
|
return;
|
|
14448
14476
|
}
|
|
14449
14477
|
for (const migration of applied) {
|
|
14450
14478
|
console.error(
|
|
14451
|
-
|
|
14479
|
+
chalk129.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
14452
14480
|
);
|
|
14453
14481
|
}
|
|
14454
14482
|
}
|
|
14455
14483
|
function reportMigrationStatus(status3) {
|
|
14456
14484
|
if (status3.state === "in-sync") {
|
|
14457
14485
|
console.error(
|
|
14458
|
-
|
|
14486
|
+
chalk129.green(`In sync at migration ${status3.version} (latest).`)
|
|
14459
14487
|
);
|
|
14460
14488
|
return;
|
|
14461
14489
|
}
|
|
14462
14490
|
if (status3.state === "behind") {
|
|
14463
14491
|
console.error(
|
|
14464
|
-
|
|
14492
|
+
chalk129.yellow(
|
|
14465
14493
|
`Behind: applied ${status3.applied}, build expects ${status3.expected}.`
|
|
14466
14494
|
)
|
|
14467
14495
|
);
|
|
14468
14496
|
console.error(
|
|
14469
|
-
|
|
14497
|
+
chalk129.yellow(
|
|
14470
14498
|
`Pending: ${status3.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
14471
14499
|
)
|
|
14472
14500
|
);
|
|
14473
14501
|
return;
|
|
14474
14502
|
}
|
|
14475
14503
|
console.error(
|
|
14476
|
-
|
|
14504
|
+
chalk129.red(
|
|
14477
14505
|
`Ahead: applied ${status3.applied}, build knows ${status3.expected}. Update assist.`
|
|
14478
14506
|
)
|
|
14479
14507
|
);
|
|
@@ -14508,7 +14536,7 @@ function registerDb(program2) {
|
|
|
14508
14536
|
|
|
14509
14537
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
14510
14538
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs";
|
|
14511
|
-
import
|
|
14539
|
+
import chalk130 from "chalk";
|
|
14512
14540
|
|
|
14513
14541
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
14514
14542
|
import { join as join35 } from "path";
|
|
@@ -14539,7 +14567,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14539
14567
|
sweepRestrictedDir();
|
|
14540
14568
|
const state = readMigrationPinState(pin);
|
|
14541
14569
|
if (!state) {
|
|
14542
|
-
console.error(
|
|
14570
|
+
console.error(chalk130.red(`No pending migration unlock for pin: ${pin}`));
|
|
14543
14571
|
process.exitCode = 1;
|
|
14544
14572
|
return;
|
|
14545
14573
|
}
|
|
@@ -14549,7 +14577,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14549
14577
|
);
|
|
14550
14578
|
unlinkSync9(getMigrationPinPath(pin));
|
|
14551
14579
|
console.log(
|
|
14552
|
-
|
|
14580
|
+
chalk130.green(
|
|
14553
14581
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
14554
14582
|
)
|
|
14555
14583
|
);
|
|
@@ -14558,7 +14586,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14558
14586
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
14559
14587
|
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync27 } from "fs";
|
|
14560
14588
|
import { randomInt as randomInt2 } from "crypto";
|
|
14561
|
-
import
|
|
14589
|
+
import chalk131 from "chalk";
|
|
14562
14590
|
|
|
14563
14591
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
14564
14592
|
function nextMigrationId() {
|
|
@@ -14573,7 +14601,7 @@ function dbMigrationUnlock() {
|
|
|
14573
14601
|
sweepRestrictedDir();
|
|
14574
14602
|
writeFileSync27(getMigrationPinPath(pin), JSON.stringify({ pin, migrationId }));
|
|
14575
14603
|
console.error(
|
|
14576
|
-
|
|
14604
|
+
chalk131.yellow.bold(
|
|
14577
14605
|
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a new database migration.\nA schema change is hard to reverse once shipped. You had BETTER have confirmed\nthe change with the user and be certain this migration is genuinely necessary."
|
|
14578
14606
|
)
|
|
14579
14607
|
);
|
|
@@ -14583,7 +14611,7 @@ function dbMigrationUnlock() {
|
|
|
14583
14611
|
});
|
|
14584
14612
|
if (!delivered) {
|
|
14585
14613
|
console.error(
|
|
14586
|
-
|
|
14614
|
+
chalk131.red(
|
|
14587
14615
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
14588
14616
|
)
|
|
14589
14617
|
);
|
|
@@ -14593,7 +14621,7 @@ function dbMigrationUnlock() {
|
|
|
14593
14621
|
console.log(
|
|
14594
14622
|
`A confirmation pin was sent to your desktop notifications.
|
|
14595
14623
|
To approve creating migration ${migrationId}, run:
|
|
14596
|
-
${
|
|
14624
|
+
${chalk131.cyan(" assist db-migration confirm <PIN>")}
|
|
14597
14625
|
using the pin from that notification.`
|
|
14598
14626
|
);
|
|
14599
14627
|
}
|
|
@@ -14613,7 +14641,7 @@ function registerDbMigration(parent) {
|
|
|
14613
14641
|
|
|
14614
14642
|
// src/commands/deploy/redirect.ts
|
|
14615
14643
|
import { existsSync as existsSync35, readFileSync as readFileSync29, writeFileSync as writeFileSync28 } from "fs";
|
|
14616
|
-
import
|
|
14644
|
+
import chalk132 from "chalk";
|
|
14617
14645
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
14618
14646
|
if (!window.location.pathname.endsWith('/')) {
|
|
14619
14647
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -14622,23 +14650,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
14622
14650
|
function redirect() {
|
|
14623
14651
|
const indexPath = "index.html";
|
|
14624
14652
|
if (!existsSync35(indexPath)) {
|
|
14625
|
-
console.log(
|
|
14653
|
+
console.log(chalk132.yellow("No index.html found"));
|
|
14626
14654
|
return;
|
|
14627
14655
|
}
|
|
14628
14656
|
const content = readFileSync29(indexPath, "utf8");
|
|
14629
14657
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
14630
|
-
console.log(
|
|
14658
|
+
console.log(chalk132.dim("Trailing slash script already present"));
|
|
14631
14659
|
return;
|
|
14632
14660
|
}
|
|
14633
14661
|
const headCloseIndex = content.indexOf("</head>");
|
|
14634
14662
|
if (headCloseIndex === -1) {
|
|
14635
|
-
console.log(
|
|
14663
|
+
console.log(chalk132.red("Could not find </head> tag in index.html"));
|
|
14636
14664
|
return;
|
|
14637
14665
|
}
|
|
14638
14666
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
14639
14667
|
${content.slice(headCloseIndex)}`;
|
|
14640
14668
|
writeFileSync28(indexPath, newContent);
|
|
14641
|
-
console.log(
|
|
14669
|
+
console.log(chalk132.green("Added trailing slash redirect to index.html"));
|
|
14642
14670
|
}
|
|
14643
14671
|
|
|
14644
14672
|
// src/commands/registerDeploy.ts
|
|
@@ -14665,7 +14693,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
14665
14693
|
|
|
14666
14694
|
// src/commands/devlog/shared.ts
|
|
14667
14695
|
import { execSync as execSync33 } from "child_process";
|
|
14668
|
-
import
|
|
14696
|
+
import chalk133 from "chalk";
|
|
14669
14697
|
|
|
14670
14698
|
// src/shared/getRepoName.ts
|
|
14671
14699
|
import { existsSync as existsSync36, readFileSync as readFileSync30 } from "fs";
|
|
@@ -14774,13 +14802,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
14774
14802
|
}
|
|
14775
14803
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
14776
14804
|
for (const commit2 of commits2) {
|
|
14777
|
-
console.log(` ${
|
|
14805
|
+
console.log(` ${chalk133.yellow(commit2.hash)} ${commit2.message}`);
|
|
14778
14806
|
if (verbose) {
|
|
14779
14807
|
const visibleFiles = commit2.files.filter(
|
|
14780
14808
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
14781
14809
|
);
|
|
14782
14810
|
for (const file of visibleFiles) {
|
|
14783
|
-
console.log(` ${
|
|
14811
|
+
console.log(` ${chalk133.dim(file)}`);
|
|
14784
14812
|
}
|
|
14785
14813
|
}
|
|
14786
14814
|
}
|
|
@@ -14805,15 +14833,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
14805
14833
|
}
|
|
14806
14834
|
|
|
14807
14835
|
// src/commands/devlog/list/printDateHeader.ts
|
|
14808
|
-
import
|
|
14836
|
+
import chalk134 from "chalk";
|
|
14809
14837
|
function printDateHeader(date, isSkipped, entries) {
|
|
14810
14838
|
if (isSkipped) {
|
|
14811
|
-
console.log(`${
|
|
14839
|
+
console.log(`${chalk134.bold.blue(date)} ${chalk134.dim("skipped")}`);
|
|
14812
14840
|
} else if (entries && entries.length > 0) {
|
|
14813
|
-
const entryInfo = entries.map((e) => `${
|
|
14814
|
-
console.log(`${
|
|
14841
|
+
const entryInfo = entries.map((e) => `${chalk134.green(e.version)} ${e.title}`).join(" | ");
|
|
14842
|
+
console.log(`${chalk134.bold.blue(date)} ${entryInfo}`);
|
|
14815
14843
|
} else {
|
|
14816
|
-
console.log(`${
|
|
14844
|
+
console.log(`${chalk134.bold.blue(date)} ${chalk134.red("\u26A0 devlog missing")}`);
|
|
14817
14845
|
}
|
|
14818
14846
|
}
|
|
14819
14847
|
|
|
@@ -14917,24 +14945,24 @@ function bumpVersion(version2, type) {
|
|
|
14917
14945
|
|
|
14918
14946
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
14919
14947
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
14920
|
-
import
|
|
14948
|
+
import chalk136 from "chalk";
|
|
14921
14949
|
|
|
14922
14950
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
14923
|
-
import
|
|
14951
|
+
import chalk135 from "chalk";
|
|
14924
14952
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
14925
14953
|
if (conventional && firstHash) {
|
|
14926
14954
|
const version2 = getVersionAtCommit(firstHash);
|
|
14927
14955
|
if (version2) {
|
|
14928
|
-
console.log(`${
|
|
14956
|
+
console.log(`${chalk135.bold("version:")} ${stripToMinor(version2)}`);
|
|
14929
14957
|
} else {
|
|
14930
|
-
console.log(`${
|
|
14958
|
+
console.log(`${chalk135.bold("version:")} ${chalk135.red("unknown")}`);
|
|
14931
14959
|
}
|
|
14932
14960
|
} else if (patchVersion && minorVersion) {
|
|
14933
14961
|
console.log(
|
|
14934
|
-
`${
|
|
14962
|
+
`${chalk135.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
14935
14963
|
);
|
|
14936
14964
|
} else {
|
|
14937
|
-
console.log(`${
|
|
14965
|
+
console.log(`${chalk135.bold("version:")} v0.1 (initial)`);
|
|
14938
14966
|
}
|
|
14939
14967
|
}
|
|
14940
14968
|
|
|
@@ -14982,16 +15010,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
14982
15010
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
14983
15011
|
}
|
|
14984
15012
|
function logName(repoName) {
|
|
14985
|
-
console.log(`${
|
|
15013
|
+
console.log(`${chalk136.bold("name:")} ${repoName}`);
|
|
14986
15014
|
}
|
|
14987
15015
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
14988
15016
|
logName(ctx.repoName);
|
|
14989
15017
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
14990
|
-
console.log(
|
|
15018
|
+
console.log(chalk136.bold.blue(targetDate));
|
|
14991
15019
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
14992
15020
|
}
|
|
14993
15021
|
function logNoCommits(lastInfo) {
|
|
14994
|
-
console.log(
|
|
15022
|
+
console.log(chalk136.dim(noCommitsMessage(!!lastInfo)));
|
|
14995
15023
|
}
|
|
14996
15024
|
|
|
14997
15025
|
// src/commands/devlog/next/index.ts
|
|
@@ -15032,11 +15060,11 @@ function next2(options2) {
|
|
|
15032
15060
|
import { execSync as execSync35 } from "child_process";
|
|
15033
15061
|
|
|
15034
15062
|
// src/commands/devlog/repos/printReposTable.ts
|
|
15035
|
-
import
|
|
15063
|
+
import chalk137 from "chalk";
|
|
15036
15064
|
function colorStatus(status3) {
|
|
15037
|
-
if (status3 === "missing") return
|
|
15038
|
-
if (status3 === "outdated") return
|
|
15039
|
-
return
|
|
15065
|
+
if (status3 === "missing") return chalk137.red(status3);
|
|
15066
|
+
if (status3 === "outdated") return chalk137.yellow(status3);
|
|
15067
|
+
return chalk137.green(status3);
|
|
15040
15068
|
}
|
|
15041
15069
|
function formatRow(row, nameWidth) {
|
|
15042
15070
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -15050,8 +15078,8 @@ function printReposTable(rows) {
|
|
|
15050
15078
|
"Last Devlog".padEnd(11),
|
|
15051
15079
|
"Status"
|
|
15052
15080
|
].join(" ");
|
|
15053
|
-
console.log(
|
|
15054
|
-
console.log(
|
|
15081
|
+
console.log(chalk137.dim(header));
|
|
15082
|
+
console.log(chalk137.dim("-".repeat(header.length)));
|
|
15055
15083
|
for (const row of rows) {
|
|
15056
15084
|
console.log(formatRow(row, nameWidth));
|
|
15057
15085
|
}
|
|
@@ -15109,14 +15137,14 @@ function repos(options2) {
|
|
|
15109
15137
|
// src/commands/devlog/skip.ts
|
|
15110
15138
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
15111
15139
|
import { join as join39 } from "path";
|
|
15112
|
-
import
|
|
15140
|
+
import chalk138 from "chalk";
|
|
15113
15141
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
15114
15142
|
function getBlogConfigPath() {
|
|
15115
15143
|
return join39(BLOG_REPO_ROOT, "assist.yml");
|
|
15116
15144
|
}
|
|
15117
15145
|
function skip(date) {
|
|
15118
15146
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
15119
|
-
console.log(
|
|
15147
|
+
console.log(chalk138.red("Invalid date format. Use YYYY-MM-DD"));
|
|
15120
15148
|
process.exit(1);
|
|
15121
15149
|
}
|
|
15122
15150
|
const repoName = getRepoName();
|
|
@@ -15127,7 +15155,7 @@ function skip(date) {
|
|
|
15127
15155
|
const skipDays = skip2[repoName] ?? [];
|
|
15128
15156
|
if (skipDays.includes(date)) {
|
|
15129
15157
|
console.log(
|
|
15130
|
-
|
|
15158
|
+
chalk138.yellow(`${date} is already in skip list for ${repoName}`)
|
|
15131
15159
|
);
|
|
15132
15160
|
return;
|
|
15133
15161
|
}
|
|
@@ -15137,20 +15165,20 @@ function skip(date) {
|
|
|
15137
15165
|
devlog.skip = skip2;
|
|
15138
15166
|
config.devlog = devlog;
|
|
15139
15167
|
writeFileSync29(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
15140
|
-
console.log(
|
|
15168
|
+
console.log(chalk138.green(`Added ${date} to skip list for ${repoName}`));
|
|
15141
15169
|
}
|
|
15142
15170
|
|
|
15143
15171
|
// src/commands/devlog/version.ts
|
|
15144
|
-
import
|
|
15172
|
+
import chalk139 from "chalk";
|
|
15145
15173
|
function version() {
|
|
15146
15174
|
const config = loadConfig();
|
|
15147
15175
|
const name = getRepoName();
|
|
15148
15176
|
const lastInfo = getLastVersionInfo(name, config);
|
|
15149
15177
|
const lastVersion = lastInfo?.version ?? null;
|
|
15150
15178
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
15151
|
-
console.log(`${
|
|
15152
|
-
console.log(`${
|
|
15153
|
-
console.log(`${
|
|
15179
|
+
console.log(`${chalk139.bold("name:")} ${name}`);
|
|
15180
|
+
console.log(`${chalk139.bold("last:")} ${lastVersion ?? chalk139.dim("none")}`);
|
|
15181
|
+
console.log(`${chalk139.bold("next:")} ${nextVersion ?? chalk139.dim("none")}`);
|
|
15154
15182
|
}
|
|
15155
15183
|
|
|
15156
15184
|
// src/commands/devlog/devlogConfigHelp.ts
|
|
@@ -15194,7 +15222,7 @@ function registerDevlog(program2) {
|
|
|
15194
15222
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
15195
15223
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync5 } from "fs";
|
|
15196
15224
|
import { join as join40 } from "path";
|
|
15197
|
-
import
|
|
15225
|
+
import chalk140 from "chalk";
|
|
15198
15226
|
|
|
15199
15227
|
// src/shared/findRepoRoot.ts
|
|
15200
15228
|
import { existsSync as existsSync37 } from "fs";
|
|
@@ -15257,14 +15285,14 @@ function checkBuildLocks(startDir) {
|
|
|
15257
15285
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
15258
15286
|
if (locked) {
|
|
15259
15287
|
console.error(
|
|
15260
|
-
|
|
15288
|
+
chalk140.red("Build output locked (is VS debugging?): ") + locked
|
|
15261
15289
|
);
|
|
15262
15290
|
process.exit(1);
|
|
15263
15291
|
}
|
|
15264
15292
|
}
|
|
15265
15293
|
async function checkBuildLocksCommand() {
|
|
15266
15294
|
checkBuildLocks();
|
|
15267
|
-
console.log(
|
|
15295
|
+
console.log(chalk140.green("No build locks detected"));
|
|
15268
15296
|
}
|
|
15269
15297
|
|
|
15270
15298
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -15363,30 +15391,30 @@ function escapeRegex(s) {
|
|
|
15363
15391
|
}
|
|
15364
15392
|
|
|
15365
15393
|
// src/commands/dotnet/printTree.ts
|
|
15366
|
-
import
|
|
15394
|
+
import chalk141 from "chalk";
|
|
15367
15395
|
function printNodes(nodes, prefix2) {
|
|
15368
15396
|
for (let i = 0; i < nodes.length; i++) {
|
|
15369
15397
|
const isLast = i === nodes.length - 1;
|
|
15370
15398
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
15371
15399
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
15372
15400
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
15373
|
-
const label2 = isMissing ?
|
|
15401
|
+
const label2 = isMissing ? chalk141.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
15374
15402
|
console.log(`${prefix2}${connector}${label2}`);
|
|
15375
15403
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
15376
15404
|
}
|
|
15377
15405
|
}
|
|
15378
15406
|
function printTree(tree, totalCount, solutions) {
|
|
15379
|
-
console.log(
|
|
15380
|
-
console.log(
|
|
15407
|
+
console.log(chalk141.bold("\nProject Dependency Tree"));
|
|
15408
|
+
console.log(chalk141.cyan(tree.relativePath));
|
|
15381
15409
|
printNodes(tree.children, "");
|
|
15382
|
-
console.log(
|
|
15410
|
+
console.log(chalk141.dim(`
|
|
15383
15411
|
${totalCount} projects total (including root)`));
|
|
15384
|
-
console.log(
|
|
15412
|
+
console.log(chalk141.bold("\nSolution Membership"));
|
|
15385
15413
|
if (solutions.length === 0) {
|
|
15386
|
-
console.log(
|
|
15414
|
+
console.log(chalk141.yellow(" Not found in any .sln"));
|
|
15387
15415
|
} else {
|
|
15388
15416
|
for (const sln of solutions) {
|
|
15389
|
-
console.log(` ${
|
|
15417
|
+
console.log(` ${chalk141.green(sln)}`);
|
|
15390
15418
|
}
|
|
15391
15419
|
}
|
|
15392
15420
|
console.log();
|
|
@@ -15415,16 +15443,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
15415
15443
|
// src/commands/dotnet/resolveCsproj.ts
|
|
15416
15444
|
import { existsSync as existsSync38 } from "fs";
|
|
15417
15445
|
import path33 from "path";
|
|
15418
|
-
import
|
|
15446
|
+
import chalk142 from "chalk";
|
|
15419
15447
|
function resolveCsproj(csprojPath) {
|
|
15420
15448
|
const resolved = path33.resolve(csprojPath);
|
|
15421
15449
|
if (!existsSync38(resolved)) {
|
|
15422
|
-
console.error(
|
|
15450
|
+
console.error(chalk142.red(`File not found: ${resolved}`));
|
|
15423
15451
|
process.exit(1);
|
|
15424
15452
|
}
|
|
15425
15453
|
const repoRoot = findRepoRoot(path33.dirname(resolved));
|
|
15426
15454
|
if (!repoRoot) {
|
|
15427
|
-
console.error(
|
|
15455
|
+
console.error(chalk142.red("Could not find git repository root"));
|
|
15428
15456
|
process.exit(1);
|
|
15429
15457
|
}
|
|
15430
15458
|
return { resolved, repoRoot };
|
|
@@ -15474,12 +15502,12 @@ function getChangedCsFiles(scope) {
|
|
|
15474
15502
|
}
|
|
15475
15503
|
|
|
15476
15504
|
// src/commands/dotnet/inSln.ts
|
|
15477
|
-
import
|
|
15505
|
+
import chalk143 from "chalk";
|
|
15478
15506
|
async function inSln(csprojPath) {
|
|
15479
15507
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
15480
15508
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
15481
15509
|
if (solutions.length === 0) {
|
|
15482
|
-
console.log(
|
|
15510
|
+
console.log(chalk143.yellow("Not found in any .sln file"));
|
|
15483
15511
|
process.exit(1);
|
|
15484
15512
|
}
|
|
15485
15513
|
for (const sln of solutions) {
|
|
@@ -15488,7 +15516,7 @@ async function inSln(csprojPath) {
|
|
|
15488
15516
|
}
|
|
15489
15517
|
|
|
15490
15518
|
// src/commands/dotnet/inspect.ts
|
|
15491
|
-
import
|
|
15519
|
+
import chalk149 from "chalk";
|
|
15492
15520
|
|
|
15493
15521
|
// src/shared/formatElapsed.ts
|
|
15494
15522
|
function formatElapsed(ms) {
|
|
@@ -15500,12 +15528,12 @@ function formatElapsed(ms) {
|
|
|
15500
15528
|
}
|
|
15501
15529
|
|
|
15502
15530
|
// src/commands/dotnet/displayIssues.ts
|
|
15503
|
-
import
|
|
15531
|
+
import chalk144 from "chalk";
|
|
15504
15532
|
var SEVERITY_COLOR = {
|
|
15505
|
-
ERROR:
|
|
15506
|
-
WARNING:
|
|
15507
|
-
SUGGESTION:
|
|
15508
|
-
HINT:
|
|
15533
|
+
ERROR: chalk144.red,
|
|
15534
|
+
WARNING: chalk144.yellow,
|
|
15535
|
+
SUGGESTION: chalk144.cyan,
|
|
15536
|
+
HINT: chalk144.dim
|
|
15509
15537
|
};
|
|
15510
15538
|
function groupByFile(issues) {
|
|
15511
15539
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -15521,15 +15549,15 @@ function groupByFile(issues) {
|
|
|
15521
15549
|
}
|
|
15522
15550
|
function displayIssues(issues) {
|
|
15523
15551
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
15524
|
-
console.log(
|
|
15552
|
+
console.log(chalk144.bold(file));
|
|
15525
15553
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
15526
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
15554
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk144.white;
|
|
15527
15555
|
console.log(
|
|
15528
|
-
` ${
|
|
15556
|
+
` ${chalk144.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
15529
15557
|
);
|
|
15530
15558
|
}
|
|
15531
15559
|
}
|
|
15532
|
-
console.log(
|
|
15560
|
+
console.log(chalk144.dim(`
|
|
15533
15561
|
${issues.length} issue(s) found`));
|
|
15534
15562
|
}
|
|
15535
15563
|
|
|
@@ -15588,12 +15616,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
15588
15616
|
// src/commands/dotnet/resolveSolution.ts
|
|
15589
15617
|
import { existsSync as existsSync39 } from "fs";
|
|
15590
15618
|
import path34 from "path";
|
|
15591
|
-
import
|
|
15619
|
+
import chalk146 from "chalk";
|
|
15592
15620
|
|
|
15593
15621
|
// src/commands/dotnet/findSolution.ts
|
|
15594
15622
|
import { readdirSync as readdirSync7 } from "fs";
|
|
15595
15623
|
import { dirname as dirname22, join as join41 } from "path";
|
|
15596
|
-
import
|
|
15624
|
+
import chalk145 from "chalk";
|
|
15597
15625
|
function findSlnInDir(dir) {
|
|
15598
15626
|
try {
|
|
15599
15627
|
return readdirSync7(dir).filter((f) => f.endsWith(".sln")).map((f) => join41(dir, f));
|
|
@@ -15609,17 +15637,17 @@ function findSolution() {
|
|
|
15609
15637
|
const slnFiles = findSlnInDir(current);
|
|
15610
15638
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
15611
15639
|
if (slnFiles.length > 1) {
|
|
15612
|
-
console.error(
|
|
15640
|
+
console.error(chalk145.red(`Multiple .sln files found in ${current}:`));
|
|
15613
15641
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
15614
15642
|
console.error(
|
|
15615
|
-
|
|
15643
|
+
chalk145.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
15616
15644
|
);
|
|
15617
15645
|
process.exit(1);
|
|
15618
15646
|
}
|
|
15619
15647
|
if (current === ceiling) break;
|
|
15620
15648
|
current = dirname22(current);
|
|
15621
15649
|
}
|
|
15622
|
-
console.error(
|
|
15650
|
+
console.error(chalk145.red("No .sln file found between cwd and repo root"));
|
|
15623
15651
|
process.exit(1);
|
|
15624
15652
|
}
|
|
15625
15653
|
|
|
@@ -15628,7 +15656,7 @@ function resolveSolution(sln) {
|
|
|
15628
15656
|
if (sln) {
|
|
15629
15657
|
const resolved = path34.resolve(sln);
|
|
15630
15658
|
if (!existsSync39(resolved)) {
|
|
15631
|
-
console.error(
|
|
15659
|
+
console.error(chalk146.red(`Solution file not found: ${resolved}`));
|
|
15632
15660
|
process.exit(1);
|
|
15633
15661
|
}
|
|
15634
15662
|
return resolved;
|
|
@@ -15670,14 +15698,14 @@ import { execSync as execSync37 } from "child_process";
|
|
|
15670
15698
|
import { existsSync as existsSync40, readFileSync as readFileSync34, unlinkSync as unlinkSync10 } from "fs";
|
|
15671
15699
|
import { tmpdir as tmpdir4 } from "os";
|
|
15672
15700
|
import path35 from "path";
|
|
15673
|
-
import
|
|
15701
|
+
import chalk147 from "chalk";
|
|
15674
15702
|
function assertJbInstalled() {
|
|
15675
15703
|
try {
|
|
15676
15704
|
execSync37("jb inspectcode --version", { stdio: "pipe" });
|
|
15677
15705
|
} catch {
|
|
15678
|
-
console.error(
|
|
15706
|
+
console.error(chalk147.red("jb is not installed. Install with:"));
|
|
15679
15707
|
console.error(
|
|
15680
|
-
|
|
15708
|
+
chalk147.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
15681
15709
|
);
|
|
15682
15710
|
process.exit(1);
|
|
15683
15711
|
}
|
|
@@ -15695,11 +15723,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
15695
15723
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
15696
15724
|
process.stderr.write(error.stderr);
|
|
15697
15725
|
}
|
|
15698
|
-
console.error(
|
|
15726
|
+
console.error(chalk147.red("jb inspectcode failed"));
|
|
15699
15727
|
process.exit(1);
|
|
15700
15728
|
}
|
|
15701
15729
|
if (!existsSync40(reportPath)) {
|
|
15702
|
-
console.error(
|
|
15730
|
+
console.error(chalk147.red("Report file not generated"));
|
|
15703
15731
|
process.exit(1);
|
|
15704
15732
|
}
|
|
15705
15733
|
const xml = readFileSync34(reportPath, "utf8");
|
|
@@ -15709,7 +15737,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
15709
15737
|
|
|
15710
15738
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
15711
15739
|
import { execSync as execSync38 } from "child_process";
|
|
15712
|
-
import
|
|
15740
|
+
import chalk148 from "chalk";
|
|
15713
15741
|
function resolveMsbuildPath() {
|
|
15714
15742
|
const { run: run4 } = loadConfig();
|
|
15715
15743
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -15721,9 +15749,9 @@ function assertMsbuildInstalled() {
|
|
|
15721
15749
|
try {
|
|
15722
15750
|
execSync38(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
15723
15751
|
} catch {
|
|
15724
|
-
console.error(
|
|
15752
|
+
console.error(chalk148.red(`msbuild not found at: ${msbuild}`));
|
|
15725
15753
|
console.error(
|
|
15726
|
-
|
|
15754
|
+
chalk148.yellow(
|
|
15727
15755
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
15728
15756
|
)
|
|
15729
15757
|
);
|
|
@@ -15770,17 +15798,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
15770
15798
|
// src/commands/dotnet/inspect.ts
|
|
15771
15799
|
function logScope(changedFiles) {
|
|
15772
15800
|
if (changedFiles === null) {
|
|
15773
|
-
console.log(
|
|
15801
|
+
console.log(chalk149.dim("Inspecting full solution..."));
|
|
15774
15802
|
} else {
|
|
15775
15803
|
console.log(
|
|
15776
|
-
|
|
15804
|
+
chalk149.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
15777
15805
|
);
|
|
15778
15806
|
}
|
|
15779
15807
|
}
|
|
15780
15808
|
function reportResults(issues, elapsed) {
|
|
15781
15809
|
if (issues.length > 0) displayIssues(issues);
|
|
15782
|
-
else console.log(
|
|
15783
|
-
console.log(
|
|
15810
|
+
else console.log(chalk149.green("No issues found"));
|
|
15811
|
+
console.log(chalk149.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
15784
15812
|
if (issues.length > 0) process.exit(1);
|
|
15785
15813
|
}
|
|
15786
15814
|
async function inspect(sln, options2) {
|
|
@@ -15791,7 +15819,7 @@ async function inspect(sln, options2) {
|
|
|
15791
15819
|
const scope = parseScope(options2.scope);
|
|
15792
15820
|
const changedFiles = getChangedCsFiles(scope);
|
|
15793
15821
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
15794
|
-
console.log(
|
|
15822
|
+
console.log(chalk149.green("No changed .cs files found"));
|
|
15795
15823
|
return;
|
|
15796
15824
|
}
|
|
15797
15825
|
logScope(changedFiles);
|
|
@@ -16174,25 +16202,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
16174
16202
|
}
|
|
16175
16203
|
|
|
16176
16204
|
// src/commands/github/printCountTable.ts
|
|
16177
|
-
import
|
|
16205
|
+
import chalk150 from "chalk";
|
|
16178
16206
|
function printCountTable(labelHeader, rows) {
|
|
16179
16207
|
const labelWidth = Math.max(
|
|
16180
16208
|
labelHeader.length,
|
|
16181
16209
|
...rows.map((row) => row.label.length)
|
|
16182
16210
|
);
|
|
16183
16211
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
16184
|
-
console.log(
|
|
16185
|
-
console.log(
|
|
16212
|
+
console.log(chalk150.dim(header));
|
|
16213
|
+
console.log(chalk150.dim("-".repeat(header.length)));
|
|
16186
16214
|
for (const row of rows) {
|
|
16187
16215
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
16188
16216
|
}
|
|
16189
16217
|
}
|
|
16190
16218
|
|
|
16191
16219
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
16192
|
-
import
|
|
16220
|
+
import chalk151 from "chalk";
|
|
16193
16221
|
function printRepoAuthorBreakdown(repos2) {
|
|
16194
16222
|
for (const repo of repos2) {
|
|
16195
|
-
console.log(
|
|
16223
|
+
console.log(chalk151.bold(repo.name));
|
|
16196
16224
|
const authorWidth = Math.max(
|
|
16197
16225
|
0,
|
|
16198
16226
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -16510,7 +16538,7 @@ function registerHandover(program2) {
|
|
|
16510
16538
|
}
|
|
16511
16539
|
|
|
16512
16540
|
// src/commands/jira/acceptanceCriteria.ts
|
|
16513
|
-
import
|
|
16541
|
+
import chalk152 from "chalk";
|
|
16514
16542
|
|
|
16515
16543
|
// src/commands/jira/adfToText.ts
|
|
16516
16544
|
function renderInline(node) {
|
|
@@ -16577,7 +16605,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
16577
16605
|
const parsed = fetchIssue(issueKey, field);
|
|
16578
16606
|
const acValue = parsed?.fields?.[field];
|
|
16579
16607
|
if (!acValue) {
|
|
16580
|
-
console.log(
|
|
16608
|
+
console.log(chalk152.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
16581
16609
|
return;
|
|
16582
16610
|
}
|
|
16583
16611
|
if (typeof acValue === "string") {
|
|
@@ -16643,14 +16671,14 @@ async function jiraAuth() {
|
|
|
16643
16671
|
}
|
|
16644
16672
|
|
|
16645
16673
|
// src/commands/jira/viewIssue.ts
|
|
16646
|
-
import
|
|
16674
|
+
import chalk153 from "chalk";
|
|
16647
16675
|
function viewIssue(issueKey) {
|
|
16648
16676
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
16649
16677
|
const fields = parsed?.fields;
|
|
16650
16678
|
const summary = fields?.summary;
|
|
16651
16679
|
const description = fields?.description;
|
|
16652
16680
|
if (summary) {
|
|
16653
|
-
console.log(
|
|
16681
|
+
console.log(chalk153.bold(summary));
|
|
16654
16682
|
}
|
|
16655
16683
|
if (description) {
|
|
16656
16684
|
if (summary) console.log();
|
|
@@ -16664,7 +16692,7 @@ function viewIssue(issueKey) {
|
|
|
16664
16692
|
}
|
|
16665
16693
|
if (!summary && !description) {
|
|
16666
16694
|
console.log(
|
|
16667
|
-
|
|
16695
|
+
chalk153.yellow(`No summary or description found on ${issueKey}.`)
|
|
16668
16696
|
);
|
|
16669
16697
|
}
|
|
16670
16698
|
}
|
|
@@ -16720,13 +16748,13 @@ function registerRefineLaunch(program2, resumeFlag) {
|
|
|
16720
16748
|
// src/commands/reviewPrComments.ts
|
|
16721
16749
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
16722
16750
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
16723
|
-
import
|
|
16751
|
+
import chalk154 from "chalk";
|
|
16724
16752
|
async function reviewPrComments(number) {
|
|
16725
16753
|
if (number) {
|
|
16726
16754
|
try {
|
|
16727
16755
|
execFileSync5("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
16728
16756
|
} catch {
|
|
16729
|
-
console.error(
|
|
16757
|
+
console.error(chalk154.red(`gh pr checkout ${number} failed; aborting.`));
|
|
16730
16758
|
process.exit(1);
|
|
16731
16759
|
}
|
|
16732
16760
|
}
|
|
@@ -16799,15 +16827,15 @@ function registerList(program2) {
|
|
|
16799
16827
|
// src/commands/mermaid/index.ts
|
|
16800
16828
|
import { mkdirSync as mkdirSync16, readdirSync as readdirSync9 } from "fs";
|
|
16801
16829
|
import { resolve as resolve13 } from "path";
|
|
16802
|
-
import
|
|
16830
|
+
import chalk157 from "chalk";
|
|
16803
16831
|
|
|
16804
16832
|
// src/commands/mermaid/exportFile.ts
|
|
16805
16833
|
import { readFileSync as readFileSync36, writeFileSync as writeFileSync31 } from "fs";
|
|
16806
16834
|
import { basename as basename11, extname as extname2, resolve as resolve12 } from "path";
|
|
16807
|
-
import
|
|
16835
|
+
import chalk156 from "chalk";
|
|
16808
16836
|
|
|
16809
16837
|
// src/commands/mermaid/renderBlock.ts
|
|
16810
|
-
import
|
|
16838
|
+
import chalk155 from "chalk";
|
|
16811
16839
|
async function renderBlock(krokiUrl, source) {
|
|
16812
16840
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
16813
16841
|
method: "POST",
|
|
@@ -16816,7 +16844,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
16816
16844
|
});
|
|
16817
16845
|
if (!response.ok) {
|
|
16818
16846
|
console.error(
|
|
16819
|
-
|
|
16847
|
+
chalk155.red(
|
|
16820
16848
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
16821
16849
|
)
|
|
16822
16850
|
);
|
|
@@ -16834,19 +16862,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
16834
16862
|
if (onlyIndex !== void 0) {
|
|
16835
16863
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
16836
16864
|
console.error(
|
|
16837
|
-
|
|
16865
|
+
chalk156.red(
|
|
16838
16866
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
16839
16867
|
)
|
|
16840
16868
|
);
|
|
16841
16869
|
process.exit(1);
|
|
16842
16870
|
}
|
|
16843
16871
|
console.log(
|
|
16844
|
-
|
|
16872
|
+
chalk156.gray(
|
|
16845
16873
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
16846
16874
|
)
|
|
16847
16875
|
);
|
|
16848
16876
|
} else {
|
|
16849
|
-
console.log(
|
|
16877
|
+
console.log(chalk156.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
16850
16878
|
}
|
|
16851
16879
|
for (const [i, source] of blocks.entries()) {
|
|
16852
16880
|
const idx = i + 1;
|
|
@@ -16854,7 +16882,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
16854
16882
|
const outPath = resolve12(outDir, `${stem}-${idx}.svg`);
|
|
16855
16883
|
const svg = await renderBlock(krokiUrl, source);
|
|
16856
16884
|
writeFileSync31(outPath, svg, "utf8");
|
|
16857
|
-
console.log(
|
|
16885
|
+
console.log(chalk156.green(` \u2192 ${outPath}`));
|
|
16858
16886
|
}
|
|
16859
16887
|
}
|
|
16860
16888
|
function extractMermaidBlocks(markdown) {
|
|
@@ -16870,18 +16898,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
16870
16898
|
if (options2.index !== void 0) {
|
|
16871
16899
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
16872
16900
|
console.error(
|
|
16873
|
-
|
|
16901
|
+
chalk157.red(`--index must be a positive integer (got ${options2.index})`)
|
|
16874
16902
|
);
|
|
16875
16903
|
process.exit(1);
|
|
16876
16904
|
}
|
|
16877
16905
|
if (!file) {
|
|
16878
|
-
console.error(
|
|
16906
|
+
console.error(chalk157.red("--index requires a file argument"));
|
|
16879
16907
|
process.exit(1);
|
|
16880
16908
|
}
|
|
16881
16909
|
}
|
|
16882
16910
|
const files = file ? [file] : readdirSync9(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
16883
16911
|
if (files.length === 0) {
|
|
16884
|
-
console.log(
|
|
16912
|
+
console.log(chalk157.gray("No markdown files found in current directory."));
|
|
16885
16913
|
return;
|
|
16886
16914
|
}
|
|
16887
16915
|
for (const f of files) {
|
|
@@ -16914,7 +16942,7 @@ function registerMermaid(program2) {
|
|
|
16914
16942
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
16915
16943
|
import { createServer as createServer2 } from "http";
|
|
16916
16944
|
import { dirname as dirname24 } from "path";
|
|
16917
|
-
import
|
|
16945
|
+
import chalk159 from "chalk";
|
|
16918
16946
|
|
|
16919
16947
|
// src/commands/netcap/corsHeaders.ts
|
|
16920
16948
|
var corsHeaders = {
|
|
@@ -16993,7 +17021,7 @@ function createNetcapHandler(options2) {
|
|
|
16993
17021
|
import { cp, readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
|
|
16994
17022
|
import { networkInterfaces } from "os";
|
|
16995
17023
|
import { join as join47 } from "path";
|
|
16996
|
-
import
|
|
17024
|
+
import chalk158 from "chalk";
|
|
16997
17025
|
|
|
16998
17026
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
16999
17027
|
import { dirname as dirname23, join as join46 } from "path";
|
|
@@ -17037,7 +17065,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
17037
17065
|
const host = lanIPv4();
|
|
17038
17066
|
if (!host) {
|
|
17039
17067
|
console.log(
|
|
17040
|
-
|
|
17068
|
+
chalk158.yellow("could not determine the WSL IP for the extension")
|
|
17041
17069
|
);
|
|
17042
17070
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
17043
17071
|
return source;
|
|
@@ -17048,7 +17076,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
17048
17076
|
return WSL_WINDOWS_PATH;
|
|
17049
17077
|
} catch {
|
|
17050
17078
|
console.log(
|
|
17051
|
-
|
|
17079
|
+
chalk158.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
17052
17080
|
);
|
|
17053
17081
|
return source;
|
|
17054
17082
|
}
|
|
@@ -17081,30 +17109,30 @@ async function netcap(options2) {
|
|
|
17081
17109
|
let count7 = 0;
|
|
17082
17110
|
const handler = createNetcapHandler({
|
|
17083
17111
|
outPath,
|
|
17084
|
-
onPing: () => console.log(
|
|
17112
|
+
onPing: () => console.log(chalk159.dim("ping from extension")),
|
|
17085
17113
|
onCapture: (entry) => {
|
|
17086
17114
|
count7 += 1;
|
|
17087
17115
|
console.log(
|
|
17088
|
-
|
|
17089
|
-
|
|
17116
|
+
chalk159.green(`captured #${count7}`),
|
|
17117
|
+
chalk159.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
17090
17118
|
);
|
|
17091
17119
|
}
|
|
17092
17120
|
});
|
|
17093
17121
|
const server = createServer2(handler);
|
|
17094
17122
|
server.listen(port, () => {
|
|
17095
17123
|
console.log(
|
|
17096
|
-
|
|
17124
|
+
chalk159.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
17097
17125
|
);
|
|
17098
|
-
console.log(
|
|
17126
|
+
console.log(chalk159.dim(`appending captures to ${outPath}`));
|
|
17099
17127
|
if (filter)
|
|
17100
|
-
console.log(
|
|
17101
|
-
console.log(
|
|
17102
|
-
console.log(
|
|
17128
|
+
console.log(chalk159.dim(`forwarding only URLs matching "${filter}"`));
|
|
17129
|
+
console.log(chalk159.dim(`load the unpacked extension from ${extensionPath}`));
|
|
17130
|
+
console.log(chalk159.dim("press Ctrl-C to stop"));
|
|
17103
17131
|
});
|
|
17104
17132
|
process.on("SIGINT", () => {
|
|
17105
17133
|
server.close();
|
|
17106
17134
|
console.log(
|
|
17107
|
-
|
|
17135
|
+
chalk159.bold(
|
|
17108
17136
|
`
|
|
17109
17137
|
netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
17110
17138
|
)
|
|
@@ -17116,7 +17144,7 @@ netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} t
|
|
|
17116
17144
|
// src/commands/netcap/netcapExtract.ts
|
|
17117
17145
|
import { writeFileSync as writeFileSync32 } from "fs";
|
|
17118
17146
|
import { join as join50 } from "path";
|
|
17119
|
-
import
|
|
17147
|
+
import chalk160 from "chalk";
|
|
17120
17148
|
|
|
17121
17149
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
17122
17150
|
import { readFileSync as readFileSync37 } from "fs";
|
|
@@ -17564,8 +17592,8 @@ function netcapExtract(file) {
|
|
|
17564
17592
|
writeFileSync32(outFile, `${JSON.stringify(posts, null, 2)}
|
|
17565
17593
|
`);
|
|
17566
17594
|
console.log(
|
|
17567
|
-
|
|
17568
|
-
|
|
17595
|
+
chalk160.green(`extracted ${posts.length} posts`),
|
|
17596
|
+
chalk160.dim(`-> ${outFile}`)
|
|
17569
17597
|
);
|
|
17570
17598
|
}
|
|
17571
17599
|
|
|
@@ -17586,7 +17614,7 @@ function registerNetcap(program2) {
|
|
|
17586
17614
|
}
|
|
17587
17615
|
|
|
17588
17616
|
// src/commands/news/add/index.ts
|
|
17589
|
-
import
|
|
17617
|
+
import chalk161 from "chalk";
|
|
17590
17618
|
import enquirer8 from "enquirer";
|
|
17591
17619
|
async function add2(url) {
|
|
17592
17620
|
if (!url) {
|
|
@@ -17608,10 +17636,10 @@ async function add2(url) {
|
|
|
17608
17636
|
const { orm } = await getReady();
|
|
17609
17637
|
const added = await addFeed(orm, url);
|
|
17610
17638
|
if (!added) {
|
|
17611
|
-
console.log(
|
|
17639
|
+
console.log(chalk161.yellow("Feed already exists"));
|
|
17612
17640
|
return;
|
|
17613
17641
|
}
|
|
17614
|
-
console.log(
|
|
17642
|
+
console.log(chalk161.green(`Added feed: ${url}`));
|
|
17615
17643
|
}
|
|
17616
17644
|
|
|
17617
17645
|
// src/commands/registerNews.ts
|
|
@@ -17658,7 +17686,7 @@ function registerPiHook(program2) {
|
|
|
17658
17686
|
}
|
|
17659
17687
|
|
|
17660
17688
|
// src/commands/prompts/printPromptsTable.ts
|
|
17661
|
-
import
|
|
17689
|
+
import chalk162 from "chalk";
|
|
17662
17690
|
function truncate(str, max) {
|
|
17663
17691
|
if (str.length <= max) return str;
|
|
17664
17692
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -17676,14 +17704,14 @@ function printPromptsTable(rows) {
|
|
|
17676
17704
|
"Command".padEnd(commandWidth),
|
|
17677
17705
|
"Repos"
|
|
17678
17706
|
].join(" ");
|
|
17679
|
-
console.log(
|
|
17680
|
-
console.log(
|
|
17707
|
+
console.log(chalk162.dim(header));
|
|
17708
|
+
console.log(chalk162.dim("-".repeat(header.length)));
|
|
17681
17709
|
for (const row of rows) {
|
|
17682
17710
|
const count7 = String(row.count).padStart(countWidth);
|
|
17683
17711
|
const tool = row.tool.padEnd(toolWidth);
|
|
17684
17712
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
17685
17713
|
console.log(
|
|
17686
|
-
`${
|
|
17714
|
+
`${chalk162.yellow(count7)} ${tool} ${command} ${chalk162.dim(row.repos)}`
|
|
17687
17715
|
);
|
|
17688
17716
|
}
|
|
17689
17717
|
}
|
|
@@ -18250,20 +18278,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
18250
18278
|
}
|
|
18251
18279
|
|
|
18252
18280
|
// src/commands/prs/listComments/printComments.ts
|
|
18253
|
-
import
|
|
18281
|
+
import chalk163 from "chalk";
|
|
18254
18282
|
function formatForHuman(comment3) {
|
|
18255
18283
|
if (comment3.type === "review") {
|
|
18256
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
18284
|
+
const stateColor = comment3.state === "APPROVED" ? chalk163.green : comment3.state === "CHANGES_REQUESTED" ? chalk163.red : chalk163.yellow;
|
|
18257
18285
|
return [
|
|
18258
|
-
`${
|
|
18286
|
+
`${chalk163.cyan("Review")} by ${chalk163.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
18259
18287
|
comment3.body,
|
|
18260
18288
|
""
|
|
18261
18289
|
].join("\n");
|
|
18262
18290
|
}
|
|
18263
18291
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
18264
18292
|
return [
|
|
18265
|
-
`${
|
|
18266
|
-
|
|
18293
|
+
`${chalk163.cyan("Line comment")} by ${chalk163.bold(comment3.user)} on ${chalk163.dim(`${comment3.path}${location}`)}`,
|
|
18294
|
+
chalk163.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
18267
18295
|
comment3.body,
|
|
18268
18296
|
""
|
|
18269
18297
|
].join("\n");
|
|
@@ -18353,13 +18381,13 @@ import { execSync as execSync46 } from "child_process";
|
|
|
18353
18381
|
import enquirer9 from "enquirer";
|
|
18354
18382
|
|
|
18355
18383
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
18356
|
-
import
|
|
18384
|
+
import chalk164 from "chalk";
|
|
18357
18385
|
var STATUS_MAP = {
|
|
18358
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
18359
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
18386
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk164.magenta("merged"), date: pr.mergedAt } : null,
|
|
18387
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk164.red("closed"), date: pr.closedAt } : null
|
|
18360
18388
|
};
|
|
18361
18389
|
function defaultStatus(pr) {
|
|
18362
|
-
return { label:
|
|
18390
|
+
return { label: chalk164.green("opened"), date: pr.createdAt };
|
|
18363
18391
|
}
|
|
18364
18392
|
function getStatus2(pr) {
|
|
18365
18393
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -18368,11 +18396,11 @@ function formatDate(dateStr) {
|
|
|
18368
18396
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
18369
18397
|
}
|
|
18370
18398
|
function formatPrHeader(pr, status3) {
|
|
18371
|
-
return `${
|
|
18399
|
+
return `${chalk164.cyan(`#${pr.number}`)} ${pr.title} ${chalk164.dim(`(${pr.author.login},`)} ${status3.label} ${chalk164.dim(`${formatDate(status3.date)})`)}`;
|
|
18372
18400
|
}
|
|
18373
18401
|
function logPrDetails(pr) {
|
|
18374
18402
|
console.log(
|
|
18375
|
-
|
|
18403
|
+
chalk164.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
18376
18404
|
);
|
|
18377
18405
|
console.log();
|
|
18378
18406
|
}
|
|
@@ -18971,10 +18999,10 @@ function registerPrs(program2) {
|
|
|
18971
18999
|
}
|
|
18972
19000
|
|
|
18973
19001
|
// src/commands/ravendb/ravendbAuth.ts
|
|
18974
|
-
import
|
|
19002
|
+
import chalk170 from "chalk";
|
|
18975
19003
|
|
|
18976
19004
|
// src/shared/createConnectionAuth.ts
|
|
18977
|
-
import
|
|
19005
|
+
import chalk165 from "chalk";
|
|
18978
19006
|
function listConnections(connections, format) {
|
|
18979
19007
|
if (connections.length === 0) {
|
|
18980
19008
|
console.log("No connections configured.");
|
|
@@ -18987,7 +19015,7 @@ function listConnections(connections, format) {
|
|
|
18987
19015
|
function removeConnection(connections, name, save) {
|
|
18988
19016
|
const filtered = connections.filter((c) => c.name !== name);
|
|
18989
19017
|
if (filtered.length === connections.length) {
|
|
18990
|
-
console.error(
|
|
19018
|
+
console.error(chalk165.red(`Connection "${name}" not found.`));
|
|
18991
19019
|
process.exit(1);
|
|
18992
19020
|
}
|
|
18993
19021
|
save(filtered);
|
|
@@ -19033,15 +19061,15 @@ function saveConnections(connections) {
|
|
|
19033
19061
|
}
|
|
19034
19062
|
|
|
19035
19063
|
// src/commands/ravendb/promptConnection.ts
|
|
19036
|
-
import
|
|
19064
|
+
import chalk168 from "chalk";
|
|
19037
19065
|
|
|
19038
19066
|
// src/commands/ravendb/selectOpSecret.ts
|
|
19039
|
-
import
|
|
19067
|
+
import chalk167 from "chalk";
|
|
19040
19068
|
import Enquirer2 from "enquirer";
|
|
19041
19069
|
|
|
19042
19070
|
// src/commands/ravendb/searchItems.ts
|
|
19043
19071
|
import { execSync as execSync49 } from "child_process";
|
|
19044
|
-
import
|
|
19072
|
+
import chalk166 from "chalk";
|
|
19045
19073
|
function opExec(args) {
|
|
19046
19074
|
return execSync49(`op ${args}`, {
|
|
19047
19075
|
encoding: "utf8",
|
|
@@ -19054,7 +19082,7 @@ function searchItems(search2) {
|
|
|
19054
19082
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
19055
19083
|
} catch {
|
|
19056
19084
|
console.error(
|
|
19057
|
-
|
|
19085
|
+
chalk166.red(
|
|
19058
19086
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
19059
19087
|
)
|
|
19060
19088
|
);
|
|
@@ -19068,7 +19096,7 @@ function getItemFields(itemId2) {
|
|
|
19068
19096
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
19069
19097
|
return item.fields.filter((f) => f.reference && f.label);
|
|
19070
19098
|
} catch {
|
|
19071
|
-
console.error(
|
|
19099
|
+
console.error(chalk166.red("Failed to get item details from 1Password."));
|
|
19072
19100
|
process.exit(1);
|
|
19073
19101
|
}
|
|
19074
19102
|
}
|
|
@@ -19087,7 +19115,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
19087
19115
|
}).run();
|
|
19088
19116
|
const items2 = searchItems(search2);
|
|
19089
19117
|
if (items2.length === 0) {
|
|
19090
|
-
console.error(
|
|
19118
|
+
console.error(chalk167.red(`No items found matching "${search2}".`));
|
|
19091
19119
|
process.exit(1);
|
|
19092
19120
|
}
|
|
19093
19121
|
const itemId2 = await selectOne(
|
|
@@ -19096,7 +19124,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
19096
19124
|
);
|
|
19097
19125
|
const fields = getItemFields(itemId2);
|
|
19098
19126
|
if (fields.length === 0) {
|
|
19099
|
-
console.error(
|
|
19127
|
+
console.error(chalk167.red("No fields with references found on this item."));
|
|
19100
19128
|
process.exit(1);
|
|
19101
19129
|
}
|
|
19102
19130
|
const ref = await selectOne(
|
|
@@ -19110,7 +19138,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
19110
19138
|
async function promptConnection(existingNames) {
|
|
19111
19139
|
const name = await promptInput("name", "Connection name:");
|
|
19112
19140
|
if (existingNames.includes(name)) {
|
|
19113
|
-
console.error(
|
|
19141
|
+
console.error(chalk168.red(`Connection "${name}" already exists.`));
|
|
19114
19142
|
process.exit(1);
|
|
19115
19143
|
}
|
|
19116
19144
|
const url = await promptInput(
|
|
@@ -19119,22 +19147,22 @@ async function promptConnection(existingNames) {
|
|
|
19119
19147
|
);
|
|
19120
19148
|
const database = await promptInput("database", "Database name:");
|
|
19121
19149
|
if (!name || !url || !database) {
|
|
19122
|
-
console.error(
|
|
19150
|
+
console.error(chalk168.red("All fields are required."));
|
|
19123
19151
|
process.exit(1);
|
|
19124
19152
|
}
|
|
19125
19153
|
const apiKeyRef = await selectOpSecret();
|
|
19126
|
-
console.log(
|
|
19154
|
+
console.log(chalk168.dim(`Using: ${apiKeyRef}`));
|
|
19127
19155
|
return { name, url, database, apiKeyRef };
|
|
19128
19156
|
}
|
|
19129
19157
|
|
|
19130
19158
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
19131
|
-
import
|
|
19159
|
+
import chalk169 from "chalk";
|
|
19132
19160
|
function ravendbSetConnection(name) {
|
|
19133
19161
|
const raw = loadGlobalConfigRaw();
|
|
19134
19162
|
const ravendb = raw.ravendb ?? {};
|
|
19135
19163
|
const connections = ravendb.connections ?? [];
|
|
19136
19164
|
if (!connections.some((c) => c.name === name)) {
|
|
19137
|
-
console.error(
|
|
19165
|
+
console.error(chalk169.red(`Connection "${name}" not found.`));
|
|
19138
19166
|
console.error(
|
|
19139
19167
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
19140
19168
|
);
|
|
@@ -19150,16 +19178,16 @@ function ravendbSetConnection(name) {
|
|
|
19150
19178
|
var ravendbAuth = createConnectionAuth({
|
|
19151
19179
|
load: loadConnections,
|
|
19152
19180
|
save: saveConnections,
|
|
19153
|
-
format: (c) => `${
|
|
19181
|
+
format: (c) => `${chalk170.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
19154
19182
|
promptNew: promptConnection,
|
|
19155
19183
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
19156
19184
|
});
|
|
19157
19185
|
|
|
19158
19186
|
// src/commands/ravendb/ravendbCollections.ts
|
|
19159
|
-
import
|
|
19187
|
+
import chalk174 from "chalk";
|
|
19160
19188
|
|
|
19161
19189
|
// src/commands/ravendb/ravenFetch.ts
|
|
19162
|
-
import
|
|
19190
|
+
import chalk172 from "chalk";
|
|
19163
19191
|
|
|
19164
19192
|
// src/commands/ravendb/getAccessToken.ts
|
|
19165
19193
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -19196,10 +19224,10 @@ ${errorText}`
|
|
|
19196
19224
|
|
|
19197
19225
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
19198
19226
|
import { execSync as execSync50 } from "child_process";
|
|
19199
|
-
import
|
|
19227
|
+
import chalk171 from "chalk";
|
|
19200
19228
|
function resolveOpSecret(reference) {
|
|
19201
19229
|
if (!reference.startsWith("op://")) {
|
|
19202
|
-
console.error(
|
|
19230
|
+
console.error(chalk171.red(`Invalid secret reference: must start with op://`));
|
|
19203
19231
|
process.exit(1);
|
|
19204
19232
|
}
|
|
19205
19233
|
try {
|
|
@@ -19209,7 +19237,7 @@ function resolveOpSecret(reference) {
|
|
|
19209
19237
|
}).trim();
|
|
19210
19238
|
} catch {
|
|
19211
19239
|
console.error(
|
|
19212
|
-
|
|
19240
|
+
chalk171.red(
|
|
19213
19241
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
19214
19242
|
)
|
|
19215
19243
|
);
|
|
@@ -19236,7 +19264,7 @@ async function ravenFetch(connection, path71) {
|
|
|
19236
19264
|
if (!response.ok) {
|
|
19237
19265
|
const body = await response.text();
|
|
19238
19266
|
console.error(
|
|
19239
|
-
|
|
19267
|
+
chalk172.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
19240
19268
|
);
|
|
19241
19269
|
console.error(body.substring(0, 500));
|
|
19242
19270
|
process.exit(1);
|
|
@@ -19245,7 +19273,7 @@ async function ravenFetch(connection, path71) {
|
|
|
19245
19273
|
}
|
|
19246
19274
|
|
|
19247
19275
|
// src/commands/ravendb/resolveConnection.ts
|
|
19248
|
-
import
|
|
19276
|
+
import chalk173 from "chalk";
|
|
19249
19277
|
function loadRavendb() {
|
|
19250
19278
|
const raw = loadGlobalConfigRaw();
|
|
19251
19279
|
const ravendb = raw.ravendb;
|
|
@@ -19259,7 +19287,7 @@ function resolveConnection(name) {
|
|
|
19259
19287
|
const connectionName = name ?? defaultConnection;
|
|
19260
19288
|
if (!connectionName) {
|
|
19261
19289
|
console.error(
|
|
19262
|
-
|
|
19290
|
+
chalk173.red(
|
|
19263
19291
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
19264
19292
|
)
|
|
19265
19293
|
);
|
|
@@ -19267,7 +19295,7 @@ function resolveConnection(name) {
|
|
|
19267
19295
|
}
|
|
19268
19296
|
const connection = connections.find((c) => c.name === connectionName);
|
|
19269
19297
|
if (!connection) {
|
|
19270
|
-
console.error(
|
|
19298
|
+
console.error(chalk173.red(`Connection "${connectionName}" not found.`));
|
|
19271
19299
|
console.error(
|
|
19272
19300
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
19273
19301
|
);
|
|
@@ -19298,7 +19326,7 @@ async function ravendbCollections(connectionName) {
|
|
|
19298
19326
|
return;
|
|
19299
19327
|
}
|
|
19300
19328
|
for (const c of collections) {
|
|
19301
|
-
console.log(`${
|
|
19329
|
+
console.log(`${chalk174.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
19302
19330
|
}
|
|
19303
19331
|
}
|
|
19304
19332
|
|
|
@@ -19317,10 +19345,10 @@ var ravendbConfigHelp = [
|
|
|
19317
19345
|
];
|
|
19318
19346
|
|
|
19319
19347
|
// src/commands/ravendb/ravendbQuery.ts
|
|
19320
|
-
import
|
|
19348
|
+
import chalk176 from "chalk";
|
|
19321
19349
|
|
|
19322
19350
|
// src/commands/ravendb/fetchAllPages.ts
|
|
19323
|
-
import
|
|
19351
|
+
import chalk175 from "chalk";
|
|
19324
19352
|
|
|
19325
19353
|
// src/commands/ravendb/buildQueryPath.ts
|
|
19326
19354
|
function buildQueryPath(opts) {
|
|
@@ -19358,7 +19386,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
19358
19386
|
allResults.push(...results);
|
|
19359
19387
|
start3 += results.length;
|
|
19360
19388
|
process.stderr.write(
|
|
19361
|
-
`\r${
|
|
19389
|
+
`\r${chalk175.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
19362
19390
|
);
|
|
19363
19391
|
if (start3 >= totalResults) break;
|
|
19364
19392
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -19373,7 +19401,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
19373
19401
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
19374
19402
|
const resolved = resolveArgs(connectionName, collection);
|
|
19375
19403
|
if (!resolved.collection && !options2.query) {
|
|
19376
|
-
console.error(
|
|
19404
|
+
console.error(chalk176.red("Provide a collection name or --query filter."));
|
|
19377
19405
|
process.exit(1);
|
|
19378
19406
|
}
|
|
19379
19407
|
const { collection: col } = resolved;
|
|
@@ -19412,7 +19440,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
19412
19440
|
import * as path36 from "path";
|
|
19413
19441
|
|
|
19414
19442
|
// src/commands/refactor/logViolations.ts
|
|
19415
|
-
import
|
|
19443
|
+
import chalk177 from "chalk";
|
|
19416
19444
|
var DEFAULT_MAX_LINES = 100;
|
|
19417
19445
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
19418
19446
|
if (violations.length === 0) {
|
|
@@ -19421,43 +19449,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
19421
19449
|
}
|
|
19422
19450
|
return;
|
|
19423
19451
|
}
|
|
19424
|
-
console.error(
|
|
19452
|
+
console.error(chalk177.red(`
|
|
19425
19453
|
Refactor check failed:
|
|
19426
19454
|
`));
|
|
19427
|
-
console.error(
|
|
19455
|
+
console.error(chalk177.red(` The following files exceed ${maxLines} lines:
|
|
19428
19456
|
`));
|
|
19429
19457
|
for (const violation of violations) {
|
|
19430
|
-
console.error(
|
|
19458
|
+
console.error(chalk177.red(` ${violation.file} (${violation.lines} lines)`));
|
|
19431
19459
|
}
|
|
19432
19460
|
console.error(
|
|
19433
|
-
|
|
19461
|
+
chalk177.yellow(
|
|
19434
19462
|
`
|
|
19435
19463
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
19436
19464
|
way to refactor it, ignore it with:
|
|
19437
19465
|
`
|
|
19438
19466
|
)
|
|
19439
19467
|
);
|
|
19440
|
-
console.error(
|
|
19468
|
+
console.error(chalk177.gray(` assist refactor ignore <file>
|
|
19441
19469
|
`));
|
|
19442
19470
|
if (process.env.CLAUDECODE) {
|
|
19443
|
-
console.error(
|
|
19471
|
+
console.error(chalk177.cyan(`
|
|
19444
19472
|
## Extracting Code to New Files
|
|
19445
19473
|
`));
|
|
19446
19474
|
console.error(
|
|
19447
|
-
|
|
19475
|
+
chalk177.cyan(
|
|
19448
19476
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
19449
19477
|
`
|
|
19450
19478
|
)
|
|
19451
19479
|
);
|
|
19452
19480
|
console.error(
|
|
19453
|
-
|
|
19481
|
+
chalk177.cyan(
|
|
19454
19482
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
19455
19483
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
19456
19484
|
`
|
|
19457
19485
|
)
|
|
19458
19486
|
);
|
|
19459
19487
|
console.error(
|
|
19460
|
-
|
|
19488
|
+
chalk177.cyan(
|
|
19461
19489
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
19462
19490
|
domains, move it to a common/shared folder.
|
|
19463
19491
|
`
|
|
@@ -19613,7 +19641,7 @@ async function check(pattern2, options2) {
|
|
|
19613
19641
|
|
|
19614
19642
|
// src/commands/refactor/extract/index.ts
|
|
19615
19643
|
import path44 from "path";
|
|
19616
|
-
import
|
|
19644
|
+
import chalk180 from "chalk";
|
|
19617
19645
|
|
|
19618
19646
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
19619
19647
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -20212,23 +20240,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
20212
20240
|
|
|
20213
20241
|
// src/commands/refactor/extract/displayPlan.ts
|
|
20214
20242
|
import path40 from "path";
|
|
20215
|
-
import
|
|
20243
|
+
import chalk178 from "chalk";
|
|
20216
20244
|
function section2(title) {
|
|
20217
20245
|
return `
|
|
20218
|
-
${
|
|
20246
|
+
${chalk178.cyan(title)}`;
|
|
20219
20247
|
}
|
|
20220
20248
|
function displayImporters(plan2, cwd) {
|
|
20221
20249
|
if (plan2.importersToUpdate.length === 0) return;
|
|
20222
20250
|
console.log(section2("Update importers:"));
|
|
20223
20251
|
for (const imp of plan2.importersToUpdate) {
|
|
20224
20252
|
const rel = path40.relative(cwd, imp.file.getFilePath());
|
|
20225
|
-
console.log(` ${
|
|
20253
|
+
console.log(` ${chalk178.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
20226
20254
|
}
|
|
20227
20255
|
}
|
|
20228
20256
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
20229
|
-
console.log(
|
|
20257
|
+
console.log(chalk178.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
20230
20258
|
`));
|
|
20231
|
-
console.log(` ${
|
|
20259
|
+
console.log(` ${chalk178.cyan("Functions to move:")}`);
|
|
20232
20260
|
for (const name of plan2.extractedNames) {
|
|
20233
20261
|
console.log(` ${name}`);
|
|
20234
20262
|
}
|
|
@@ -20262,7 +20290,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
20262
20290
|
|
|
20263
20291
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
20264
20292
|
import path43 from "path";
|
|
20265
|
-
import
|
|
20293
|
+
import chalk179 from "chalk";
|
|
20266
20294
|
import { Project as Project4 } from "ts-morph";
|
|
20267
20295
|
|
|
20268
20296
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -20354,7 +20382,7 @@ function loadProjectFile(file) {
|
|
|
20354
20382
|
});
|
|
20355
20383
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
20356
20384
|
if (!sourceFile) {
|
|
20357
|
-
console.log(
|
|
20385
|
+
console.log(chalk179.red(`File not found in project: ${file}`));
|
|
20358
20386
|
process.exit(1);
|
|
20359
20387
|
}
|
|
20360
20388
|
return { project, sourceFile };
|
|
@@ -20377,19 +20405,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
20377
20405
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
20378
20406
|
if (options2.apply) {
|
|
20379
20407
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
20380
|
-
console.log(
|
|
20408
|
+
console.log(chalk180.green("\nExtraction complete"));
|
|
20381
20409
|
} else {
|
|
20382
|
-
console.log(
|
|
20410
|
+
console.log(chalk180.dim("\nDry run. Use --apply to execute."));
|
|
20383
20411
|
}
|
|
20384
20412
|
}
|
|
20385
20413
|
|
|
20386
20414
|
// src/commands/refactor/ignore.ts
|
|
20387
20415
|
import fs28 from "fs";
|
|
20388
|
-
import
|
|
20416
|
+
import chalk181 from "chalk";
|
|
20389
20417
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
20390
20418
|
function ignore2(file) {
|
|
20391
20419
|
if (!fs28.existsSync(file)) {
|
|
20392
|
-
console.error(
|
|
20420
|
+
console.error(chalk181.red(`Error: File does not exist: ${file}`));
|
|
20393
20421
|
process.exit(1);
|
|
20394
20422
|
}
|
|
20395
20423
|
const content = fs28.readFileSync(file, "utf8");
|
|
@@ -20405,7 +20433,7 @@ function ignore2(file) {
|
|
|
20405
20433
|
fs28.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
20406
20434
|
}
|
|
20407
20435
|
console.log(
|
|
20408
|
-
|
|
20436
|
+
chalk181.green(
|
|
20409
20437
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
20410
20438
|
)
|
|
20411
20439
|
);
|
|
@@ -20414,12 +20442,12 @@ function ignore2(file) {
|
|
|
20414
20442
|
// src/commands/refactor/rename/index.ts
|
|
20415
20443
|
import fs31 from "fs";
|
|
20416
20444
|
import path49 from "path";
|
|
20417
|
-
import
|
|
20445
|
+
import chalk184 from "chalk";
|
|
20418
20446
|
|
|
20419
20447
|
// src/commands/refactor/rename/applyRename.ts
|
|
20420
20448
|
import fs30 from "fs";
|
|
20421
20449
|
import path46 from "path";
|
|
20422
|
-
import
|
|
20450
|
+
import chalk182 from "chalk";
|
|
20423
20451
|
|
|
20424
20452
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
20425
20453
|
import path45 from "path";
|
|
@@ -20524,13 +20552,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
20524
20552
|
const updatedContents = applyRewrites(rewrites);
|
|
20525
20553
|
for (const [file, content] of updatedContents) {
|
|
20526
20554
|
fs30.writeFileSync(file, content, "utf8");
|
|
20527
|
-
console.log(
|
|
20555
|
+
console.log(chalk182.cyan(` Updated imports in ${path46.relative(cwd, file)}`));
|
|
20528
20556
|
}
|
|
20529
20557
|
const destDir = path46.dirname(destPath);
|
|
20530
20558
|
if (!fs30.existsSync(destDir)) fs30.mkdirSync(destDir, { recursive: true });
|
|
20531
20559
|
fs30.renameSync(sourcePath, destPath);
|
|
20532
20560
|
console.log(
|
|
20533
|
-
|
|
20561
|
+
chalk182.white(
|
|
20534
20562
|
` Moved ${path46.relative(cwd, sourcePath)} \u2192 ${path46.relative(cwd, destPath)}`
|
|
20535
20563
|
)
|
|
20536
20564
|
);
|
|
@@ -20617,16 +20645,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
20617
20645
|
|
|
20618
20646
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
20619
20647
|
import path48 from "path";
|
|
20620
|
-
import
|
|
20648
|
+
import chalk183 from "chalk";
|
|
20621
20649
|
function printRenamePreview(rewrites, cwd) {
|
|
20622
20650
|
for (const rewrite of rewrites) {
|
|
20623
20651
|
console.log(
|
|
20624
|
-
|
|
20652
|
+
chalk183.dim(
|
|
20625
20653
|
` ${path48.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
20626
20654
|
)
|
|
20627
20655
|
);
|
|
20628
20656
|
}
|
|
20629
|
-
console.log(
|
|
20657
|
+
console.log(chalk183.dim("Dry run. Use --apply to execute."));
|
|
20630
20658
|
}
|
|
20631
20659
|
|
|
20632
20660
|
// src/commands/refactor/rename/index.ts
|
|
@@ -20637,20 +20665,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
20637
20665
|
const relSource = path49.relative(cwd, sourcePath);
|
|
20638
20666
|
const relDest = path49.relative(cwd, destPath);
|
|
20639
20667
|
if (!fs31.existsSync(sourcePath)) {
|
|
20640
|
-
console.log(
|
|
20668
|
+
console.log(chalk184.red(`File not found: ${source}`));
|
|
20641
20669
|
process.exit(1);
|
|
20642
20670
|
}
|
|
20643
20671
|
if (destPath !== sourcePath && fs31.existsSync(destPath)) {
|
|
20644
|
-
console.log(
|
|
20672
|
+
console.log(chalk184.red(`Destination already exists: ${destination}`));
|
|
20645
20673
|
process.exit(1);
|
|
20646
20674
|
}
|
|
20647
|
-
console.log(
|
|
20648
|
-
console.log(
|
|
20649
|
-
console.log(
|
|
20675
|
+
console.log(chalk184.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
20676
|
+
console.log(chalk184.dim("Loading project..."));
|
|
20677
|
+
console.log(chalk184.dim("Scanning imports across the project..."));
|
|
20650
20678
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
20651
20679
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
20652
20680
|
console.log(
|
|
20653
|
-
|
|
20681
|
+
chalk184.dim(
|
|
20654
20682
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
20655
20683
|
)
|
|
20656
20684
|
);
|
|
@@ -20659,11 +20687,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
20659
20687
|
return;
|
|
20660
20688
|
}
|
|
20661
20689
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
20662
|
-
console.log(
|
|
20690
|
+
console.log(chalk184.green("Done"));
|
|
20663
20691
|
}
|
|
20664
20692
|
|
|
20665
20693
|
// src/commands/refactor/renameSymbol/index.ts
|
|
20666
|
-
import
|
|
20694
|
+
import chalk185 from "chalk";
|
|
20667
20695
|
|
|
20668
20696
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
20669
20697
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -20709,33 +20737,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
20709
20737
|
const { project, sourceFile } = loadProjectFile(file);
|
|
20710
20738
|
const symbol = findSymbol(sourceFile, oldName);
|
|
20711
20739
|
if (!symbol) {
|
|
20712
|
-
console.log(
|
|
20740
|
+
console.log(chalk185.red(`Symbol "${oldName}" not found in ${file}`));
|
|
20713
20741
|
process.exit(1);
|
|
20714
20742
|
}
|
|
20715
20743
|
const grouped = groupReferences(symbol, cwd);
|
|
20716
20744
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
20717
20745
|
console.log(
|
|
20718
|
-
|
|
20746
|
+
chalk185.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
20719
20747
|
`)
|
|
20720
20748
|
);
|
|
20721
20749
|
for (const [refFile, lines] of grouped) {
|
|
20722
20750
|
console.log(
|
|
20723
|
-
` ${
|
|
20751
|
+
` ${chalk185.dim(refFile)}: lines ${chalk185.cyan(lines.join(", "))}`
|
|
20724
20752
|
);
|
|
20725
20753
|
}
|
|
20726
20754
|
if (options2.apply) {
|
|
20727
20755
|
symbol.rename(newName);
|
|
20728
20756
|
await project.save();
|
|
20729
|
-
console.log(
|
|
20757
|
+
console.log(chalk185.green(`
|
|
20730
20758
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
20731
20759
|
} else {
|
|
20732
|
-
console.log(
|
|
20760
|
+
console.log(chalk185.dim("\nDry run. Use --apply to execute."));
|
|
20733
20761
|
}
|
|
20734
20762
|
}
|
|
20735
20763
|
|
|
20736
20764
|
// src/commands/refactor/restructure/index.ts
|
|
20737
20765
|
import path57 from "path";
|
|
20738
|
-
import
|
|
20766
|
+
import chalk188 from "chalk";
|
|
20739
20767
|
|
|
20740
20768
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
20741
20769
|
import path51 from "path";
|
|
@@ -20814,50 +20842,50 @@ function clusterFiles(graph) {
|
|
|
20814
20842
|
|
|
20815
20843
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
20816
20844
|
import path53 from "path";
|
|
20817
|
-
import
|
|
20845
|
+
import chalk186 from "chalk";
|
|
20818
20846
|
function relPath(filePath) {
|
|
20819
20847
|
return path53.relative(process.cwd(), filePath);
|
|
20820
20848
|
}
|
|
20821
20849
|
function displayMoves(plan2) {
|
|
20822
20850
|
if (plan2.moves.length === 0) return;
|
|
20823
|
-
console.log(
|
|
20851
|
+
console.log(chalk186.bold("\nFile moves:"));
|
|
20824
20852
|
for (const move2 of plan2.moves) {
|
|
20825
20853
|
console.log(
|
|
20826
|
-
` ${
|
|
20854
|
+
` ${chalk186.red(relPath(move2.from))} \u2192 ${chalk186.green(relPath(move2.to))}`
|
|
20827
20855
|
);
|
|
20828
|
-
console.log(
|
|
20856
|
+
console.log(chalk186.dim(` ${move2.reason}`));
|
|
20829
20857
|
}
|
|
20830
20858
|
}
|
|
20831
20859
|
function displayRewrites(rewrites) {
|
|
20832
20860
|
if (rewrites.length === 0) return;
|
|
20833
20861
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
20834
|
-
console.log(
|
|
20862
|
+
console.log(chalk186.bold(`
|
|
20835
20863
|
Import rewrites (${affectedFiles.size} files):`));
|
|
20836
20864
|
for (const file of affectedFiles) {
|
|
20837
|
-
console.log(` ${
|
|
20865
|
+
console.log(` ${chalk186.cyan(relPath(file))}:`);
|
|
20838
20866
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
20839
20867
|
(r) => r.file === file
|
|
20840
20868
|
)) {
|
|
20841
20869
|
console.log(
|
|
20842
|
-
` ${
|
|
20870
|
+
` ${chalk186.red(`"${oldSpecifier}"`)} \u2192 ${chalk186.green(`"${newSpecifier}"`)}`
|
|
20843
20871
|
);
|
|
20844
20872
|
}
|
|
20845
20873
|
}
|
|
20846
20874
|
}
|
|
20847
20875
|
function displayPlan2(plan2) {
|
|
20848
20876
|
if (plan2.warnings.length > 0) {
|
|
20849
|
-
console.log(
|
|
20850
|
-
for (const w of plan2.warnings) console.log(
|
|
20877
|
+
console.log(chalk186.yellow("\nWarnings:"));
|
|
20878
|
+
for (const w of plan2.warnings) console.log(chalk186.yellow(` ${w}`));
|
|
20851
20879
|
}
|
|
20852
20880
|
if (plan2.newDirectories.length > 0) {
|
|
20853
|
-
console.log(
|
|
20881
|
+
console.log(chalk186.bold("\nNew directories:"));
|
|
20854
20882
|
for (const dir of plan2.newDirectories)
|
|
20855
|
-
console.log(
|
|
20883
|
+
console.log(chalk186.green(` ${dir}/`));
|
|
20856
20884
|
}
|
|
20857
20885
|
displayMoves(plan2);
|
|
20858
20886
|
displayRewrites(plan2.rewrites);
|
|
20859
20887
|
console.log(
|
|
20860
|
-
|
|
20888
|
+
chalk186.dim(
|
|
20861
20889
|
`
|
|
20862
20890
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
20863
20891
|
)
|
|
@@ -20867,18 +20895,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
20867
20895
|
// src/commands/refactor/restructure/executePlan.ts
|
|
20868
20896
|
import fs32 from "fs";
|
|
20869
20897
|
import path54 from "path";
|
|
20870
|
-
import
|
|
20898
|
+
import chalk187 from "chalk";
|
|
20871
20899
|
function executePlan(plan2) {
|
|
20872
20900
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
20873
20901
|
for (const [file, content] of updatedContents) {
|
|
20874
20902
|
fs32.writeFileSync(file, content, "utf8");
|
|
20875
20903
|
console.log(
|
|
20876
|
-
|
|
20904
|
+
chalk187.cyan(` Rewrote imports in ${path54.relative(process.cwd(), file)}`)
|
|
20877
20905
|
);
|
|
20878
20906
|
}
|
|
20879
20907
|
for (const dir of plan2.newDirectories) {
|
|
20880
20908
|
fs32.mkdirSync(dir, { recursive: true });
|
|
20881
|
-
console.log(
|
|
20909
|
+
console.log(chalk187.green(` Created ${path54.relative(process.cwd(), dir)}/`));
|
|
20882
20910
|
}
|
|
20883
20911
|
for (const move2 of plan2.moves) {
|
|
20884
20912
|
const targetDir = path54.dirname(move2.to);
|
|
@@ -20887,7 +20915,7 @@ function executePlan(plan2) {
|
|
|
20887
20915
|
}
|
|
20888
20916
|
fs32.renameSync(move2.from, move2.to);
|
|
20889
20917
|
console.log(
|
|
20890
|
-
|
|
20918
|
+
chalk187.white(
|
|
20891
20919
|
` Moved ${path54.relative(process.cwd(), move2.from)} \u2192 ${path54.relative(process.cwd(), move2.to)}`
|
|
20892
20920
|
)
|
|
20893
20921
|
);
|
|
@@ -20902,7 +20930,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
20902
20930
|
if (entries.length === 0) {
|
|
20903
20931
|
fs32.rmdirSync(dir);
|
|
20904
20932
|
console.log(
|
|
20905
|
-
|
|
20933
|
+
chalk187.dim(
|
|
20906
20934
|
` Removed empty directory ${path54.relative(process.cwd(), dir)}`
|
|
20907
20935
|
)
|
|
20908
20936
|
);
|
|
@@ -21035,22 +21063,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
21035
21063
|
const targetPattern = pattern2 ?? "src";
|
|
21036
21064
|
const files = findSourceFiles2(targetPattern);
|
|
21037
21065
|
if (files.length === 0) {
|
|
21038
|
-
console.log(
|
|
21066
|
+
console.log(chalk188.yellow("No files found matching pattern"));
|
|
21039
21067
|
return;
|
|
21040
21068
|
}
|
|
21041
21069
|
const tsConfigPath = findTsConfig(path57.resolve(files[0]));
|
|
21042
21070
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
21043
21071
|
if (plan2.moves.length === 0) {
|
|
21044
|
-
console.log(
|
|
21072
|
+
console.log(chalk188.green("No restructuring needed"));
|
|
21045
21073
|
return;
|
|
21046
21074
|
}
|
|
21047
21075
|
displayPlan2(plan2);
|
|
21048
21076
|
if (options2.apply) {
|
|
21049
|
-
console.log(
|
|
21077
|
+
console.log(chalk188.bold("\nApplying changes..."));
|
|
21050
21078
|
executePlan(plan2);
|
|
21051
|
-
console.log(
|
|
21079
|
+
console.log(chalk188.green("\nRestructuring complete"));
|
|
21052
21080
|
} else {
|
|
21053
|
-
console.log(
|
|
21081
|
+
console.log(chalk188.dim("\nDry run. Use --apply to execute."));
|
|
21054
21082
|
}
|
|
21055
21083
|
}
|
|
21056
21084
|
|
|
@@ -21633,18 +21661,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
21633
21661
|
}
|
|
21634
21662
|
|
|
21635
21663
|
// src/commands/review/warnOutOfDiff.ts
|
|
21636
|
-
import
|
|
21664
|
+
import chalk189 from "chalk";
|
|
21637
21665
|
function warnOutOfDiff(outOfDiff) {
|
|
21638
21666
|
if (outOfDiff.length === 0) return;
|
|
21639
21667
|
console.warn(
|
|
21640
|
-
|
|
21668
|
+
chalk189.yellow(
|
|
21641
21669
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
21642
21670
|
)
|
|
21643
21671
|
);
|
|
21644
21672
|
for (const finding of outOfDiff) {
|
|
21645
21673
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
21646
21674
|
console.warn(
|
|
21647
|
-
` ${
|
|
21675
|
+
` ${chalk189.yellow("\xB7")} ${finding.title} ${chalk189.dim(
|
|
21648
21676
|
`(${finding.file}:${range})`
|
|
21649
21677
|
)}`
|
|
21650
21678
|
);
|
|
@@ -21663,18 +21691,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
21663
21691
|
}
|
|
21664
21692
|
|
|
21665
21693
|
// src/commands/review/warnUnlocated.ts
|
|
21666
|
-
import
|
|
21694
|
+
import chalk190 from "chalk";
|
|
21667
21695
|
function warnUnlocated(unlocated) {
|
|
21668
21696
|
if (unlocated.length === 0) return;
|
|
21669
21697
|
console.warn(
|
|
21670
|
-
|
|
21698
|
+
chalk190.yellow(
|
|
21671
21699
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
21672
21700
|
)
|
|
21673
21701
|
);
|
|
21674
21702
|
for (const finding of unlocated) {
|
|
21675
|
-
const where = finding.location ||
|
|
21703
|
+
const where = finding.location || chalk190.dim("missing");
|
|
21676
21704
|
console.warn(
|
|
21677
|
-
` ${
|
|
21705
|
+
` ${chalk190.yellow("\xB7")} ${finding.title} ${chalk190.dim(`(${where})`)}`
|
|
21678
21706
|
);
|
|
21679
21707
|
}
|
|
21680
21708
|
}
|
|
@@ -22846,7 +22874,7 @@ function registerReview(program2) {
|
|
|
22846
22874
|
}
|
|
22847
22875
|
|
|
22848
22876
|
// src/commands/seq/seqAuth.ts
|
|
22849
|
-
import
|
|
22877
|
+
import chalk192 from "chalk";
|
|
22850
22878
|
|
|
22851
22879
|
// src/commands/seq/loadConnections.ts
|
|
22852
22880
|
function loadConnections2() {
|
|
@@ -22875,10 +22903,10 @@ function setDefaultConnection(name) {
|
|
|
22875
22903
|
}
|
|
22876
22904
|
|
|
22877
22905
|
// src/shared/assertUniqueName.ts
|
|
22878
|
-
import
|
|
22906
|
+
import chalk191 from "chalk";
|
|
22879
22907
|
function assertUniqueName(existingNames, name) {
|
|
22880
22908
|
if (existingNames.includes(name)) {
|
|
22881
|
-
console.error(
|
|
22909
|
+
console.error(chalk191.red(`Connection "${name}" already exists.`));
|
|
22882
22910
|
process.exit(1);
|
|
22883
22911
|
}
|
|
22884
22912
|
}
|
|
@@ -22896,7 +22924,7 @@ async function promptConnection2(existingNames) {
|
|
|
22896
22924
|
var seqAuth = createConnectionAuth({
|
|
22897
22925
|
load: loadConnections2,
|
|
22898
22926
|
save: saveConnections2,
|
|
22899
|
-
format: (c) => `${
|
|
22927
|
+
format: (c) => `${chalk192.bold(c.name)} ${c.url}`,
|
|
22900
22928
|
promptNew: promptConnection2,
|
|
22901
22929
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
22902
22930
|
});
|
|
@@ -22916,10 +22944,10 @@ var seqConfigHelp = [
|
|
|
22916
22944
|
];
|
|
22917
22945
|
|
|
22918
22946
|
// src/commands/seq/seqQuery.ts
|
|
22919
|
-
import
|
|
22947
|
+
import chalk196 from "chalk";
|
|
22920
22948
|
|
|
22921
22949
|
// src/commands/seq/fetchSeq.ts
|
|
22922
|
-
import
|
|
22950
|
+
import chalk193 from "chalk";
|
|
22923
22951
|
async function fetchSeq(conn, path71, params) {
|
|
22924
22952
|
const url = `${conn.url}${path71}?${params}`;
|
|
22925
22953
|
const response = await fetch(url, {
|
|
@@ -22930,7 +22958,7 @@ async function fetchSeq(conn, path71, params) {
|
|
|
22930
22958
|
});
|
|
22931
22959
|
if (!response.ok) {
|
|
22932
22960
|
const body = await response.text();
|
|
22933
|
-
console.error(
|
|
22961
|
+
console.error(chalk193.red(`Seq returned ${response.status}: ${body}`));
|
|
22934
22962
|
process.exit(1);
|
|
22935
22963
|
}
|
|
22936
22964
|
return response;
|
|
@@ -22989,23 +23017,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
22989
23017
|
}
|
|
22990
23018
|
|
|
22991
23019
|
// src/commands/seq/formatEvent.ts
|
|
22992
|
-
import
|
|
23020
|
+
import chalk194 from "chalk";
|
|
22993
23021
|
function levelColor(level) {
|
|
22994
23022
|
switch (level) {
|
|
22995
23023
|
case "Fatal":
|
|
22996
|
-
return
|
|
23024
|
+
return chalk194.bgRed.white;
|
|
22997
23025
|
case "Error":
|
|
22998
|
-
return
|
|
23026
|
+
return chalk194.red;
|
|
22999
23027
|
case "Warning":
|
|
23000
|
-
return
|
|
23028
|
+
return chalk194.yellow;
|
|
23001
23029
|
case "Information":
|
|
23002
|
-
return
|
|
23030
|
+
return chalk194.cyan;
|
|
23003
23031
|
case "Debug":
|
|
23004
|
-
return
|
|
23032
|
+
return chalk194.gray;
|
|
23005
23033
|
case "Verbose":
|
|
23006
|
-
return
|
|
23034
|
+
return chalk194.dim;
|
|
23007
23035
|
default:
|
|
23008
|
-
return
|
|
23036
|
+
return chalk194.white;
|
|
23009
23037
|
}
|
|
23010
23038
|
}
|
|
23011
23039
|
function levelAbbrev(level) {
|
|
@@ -23046,12 +23074,12 @@ function formatTimestamp(iso) {
|
|
|
23046
23074
|
function formatEvent(event) {
|
|
23047
23075
|
const color = levelColor(event.Level);
|
|
23048
23076
|
const abbrev = levelAbbrev(event.Level);
|
|
23049
|
-
const ts8 =
|
|
23077
|
+
const ts8 = chalk194.dim(formatTimestamp(event.Timestamp));
|
|
23050
23078
|
const msg = renderMessage(event);
|
|
23051
23079
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
23052
23080
|
if (event.Exception) {
|
|
23053
23081
|
for (const line of event.Exception.split("\n")) {
|
|
23054
|
-
lines.push(
|
|
23082
|
+
lines.push(chalk194.red(` ${line}`));
|
|
23055
23083
|
}
|
|
23056
23084
|
}
|
|
23057
23085
|
return lines.join("\n");
|
|
@@ -23084,11 +23112,11 @@ function rejectTimestampFilter(filter) {
|
|
|
23084
23112
|
}
|
|
23085
23113
|
|
|
23086
23114
|
// src/shared/resolveNamedConnection.ts
|
|
23087
|
-
import
|
|
23115
|
+
import chalk195 from "chalk";
|
|
23088
23116
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
23089
23117
|
if (connections.length === 0) {
|
|
23090
23118
|
console.error(
|
|
23091
|
-
|
|
23119
|
+
chalk195.red(
|
|
23092
23120
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
23093
23121
|
)
|
|
23094
23122
|
);
|
|
@@ -23097,7 +23125,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
23097
23125
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
23098
23126
|
const connection = connections.find((c) => c.name === target);
|
|
23099
23127
|
if (!connection) {
|
|
23100
|
-
console.error(
|
|
23128
|
+
console.error(chalk195.red(`${kind} connection "${target}" not found.`));
|
|
23101
23129
|
process.exit(1);
|
|
23102
23130
|
}
|
|
23103
23131
|
return connection;
|
|
@@ -23126,7 +23154,7 @@ async function seqQuery(filter, options2) {
|
|
|
23126
23154
|
new URLSearchParams({ filter, count: String(count7) })
|
|
23127
23155
|
);
|
|
23128
23156
|
if (events.length === 0) {
|
|
23129
|
-
console.log(
|
|
23157
|
+
console.log(chalk196.yellow("No events found."));
|
|
23130
23158
|
return;
|
|
23131
23159
|
}
|
|
23132
23160
|
if (options2.json) {
|
|
@@ -23137,11 +23165,11 @@ async function seqQuery(filter, options2) {
|
|
|
23137
23165
|
for (const event of chronological) {
|
|
23138
23166
|
console.log(formatEvent(event));
|
|
23139
23167
|
}
|
|
23140
|
-
console.log(
|
|
23168
|
+
console.log(chalk196.dim(`
|
|
23141
23169
|
${events.length} events`));
|
|
23142
23170
|
if (events.length >= count7) {
|
|
23143
23171
|
console.log(
|
|
23144
|
-
|
|
23172
|
+
chalk196.yellow(
|
|
23145
23173
|
`Results limited to ${count7}. Use --count to retrieve more.`
|
|
23146
23174
|
)
|
|
23147
23175
|
);
|
|
@@ -23149,10 +23177,10 @@ ${events.length} events`));
|
|
|
23149
23177
|
}
|
|
23150
23178
|
|
|
23151
23179
|
// src/shared/setNamedDefaultConnection.ts
|
|
23152
|
-
import
|
|
23180
|
+
import chalk197 from "chalk";
|
|
23153
23181
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
23154
23182
|
if (!connections.find((c) => c.name === name)) {
|
|
23155
|
-
console.error(
|
|
23183
|
+
console.error(chalk197.red(`Connection "${name}" not found.`));
|
|
23156
23184
|
process.exit(1);
|
|
23157
23185
|
}
|
|
23158
23186
|
setDefault(name);
|
|
@@ -23201,7 +23229,7 @@ function registerSignal(program2) {
|
|
|
23201
23229
|
}
|
|
23202
23230
|
|
|
23203
23231
|
// src/commands/sql/sqlAuth.ts
|
|
23204
|
-
import
|
|
23232
|
+
import chalk199 from "chalk";
|
|
23205
23233
|
|
|
23206
23234
|
// src/commands/sql/loadConnections.ts
|
|
23207
23235
|
function loadConnections3() {
|
|
@@ -23230,7 +23258,7 @@ function setDefaultConnection2(name) {
|
|
|
23230
23258
|
}
|
|
23231
23259
|
|
|
23232
23260
|
// src/commands/sql/promptConnection.ts
|
|
23233
|
-
import
|
|
23261
|
+
import chalk198 from "chalk";
|
|
23234
23262
|
async function promptConnection3(existingNames) {
|
|
23235
23263
|
const name = await promptInput("name", "Connection name:", "default");
|
|
23236
23264
|
assertUniqueName(existingNames, name);
|
|
@@ -23238,7 +23266,7 @@ async function promptConnection3(existingNames) {
|
|
|
23238
23266
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
23239
23267
|
const port = Number.parseInt(portStr, 10);
|
|
23240
23268
|
if (!Number.isFinite(port)) {
|
|
23241
|
-
console.error(
|
|
23269
|
+
console.error(chalk198.red(`Invalid port "${portStr}".`));
|
|
23242
23270
|
process.exit(1);
|
|
23243
23271
|
}
|
|
23244
23272
|
const user = await promptInput("user", "User:");
|
|
@@ -23251,13 +23279,13 @@ async function promptConnection3(existingNames) {
|
|
|
23251
23279
|
var sqlAuth = createConnectionAuth({
|
|
23252
23280
|
load: loadConnections3,
|
|
23253
23281
|
save: saveConnections3,
|
|
23254
|
-
format: (c) => `${
|
|
23282
|
+
format: (c) => `${chalk199.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
23255
23283
|
promptNew: promptConnection3,
|
|
23256
23284
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
23257
23285
|
});
|
|
23258
23286
|
|
|
23259
23287
|
// src/commands/sql/printTable.ts
|
|
23260
|
-
import
|
|
23288
|
+
import chalk200 from "chalk";
|
|
23261
23289
|
function formatCell(value) {
|
|
23262
23290
|
if (value === null || value === void 0) return "";
|
|
23263
23291
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -23266,7 +23294,7 @@ function formatCell(value) {
|
|
|
23266
23294
|
}
|
|
23267
23295
|
function printTable(rows) {
|
|
23268
23296
|
if (rows.length === 0) {
|
|
23269
|
-
console.log(
|
|
23297
|
+
console.log(chalk200.yellow("(no rows)"));
|
|
23270
23298
|
return;
|
|
23271
23299
|
}
|
|
23272
23300
|
const columns = Object.keys(rows[0]);
|
|
@@ -23274,13 +23302,13 @@ function printTable(rows) {
|
|
|
23274
23302
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
23275
23303
|
);
|
|
23276
23304
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
23277
|
-
console.log(
|
|
23278
|
-
console.log(
|
|
23305
|
+
console.log(chalk200.dim(header));
|
|
23306
|
+
console.log(chalk200.dim("-".repeat(header.length)));
|
|
23279
23307
|
for (const row of rows) {
|
|
23280
23308
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
23281
23309
|
console.log(line);
|
|
23282
23310
|
}
|
|
23283
|
-
console.log(
|
|
23311
|
+
console.log(chalk200.dim(`
|
|
23284
23312
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
23285
23313
|
}
|
|
23286
23314
|
|
|
@@ -23354,7 +23382,7 @@ var sqlConfigHelp = [
|
|
|
23354
23382
|
];
|
|
23355
23383
|
|
|
23356
23384
|
// src/commands/sql/sqlMutate.ts
|
|
23357
|
-
import
|
|
23385
|
+
import chalk201 from "chalk";
|
|
23358
23386
|
|
|
23359
23387
|
// src/commands/sql/isMutation.ts
|
|
23360
23388
|
var MUTATION_KEYWORDS = [
|
|
@@ -23388,7 +23416,7 @@ function isMutation(sql25) {
|
|
|
23388
23416
|
async function sqlMutate(query, connectionName) {
|
|
23389
23417
|
if (!isMutation(query)) {
|
|
23390
23418
|
console.error(
|
|
23391
|
-
|
|
23419
|
+
chalk201.red(
|
|
23392
23420
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
23393
23421
|
)
|
|
23394
23422
|
);
|
|
@@ -23398,18 +23426,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
23398
23426
|
const pool = await sqlConnect(conn);
|
|
23399
23427
|
try {
|
|
23400
23428
|
const result = await pool.request().query(query);
|
|
23401
|
-
console.log(
|
|
23429
|
+
console.log(chalk201.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
23402
23430
|
} finally {
|
|
23403
23431
|
await pool.close();
|
|
23404
23432
|
}
|
|
23405
23433
|
}
|
|
23406
23434
|
|
|
23407
23435
|
// src/commands/sql/sqlQuery.ts
|
|
23408
|
-
import
|
|
23436
|
+
import chalk202 from "chalk";
|
|
23409
23437
|
async function sqlQuery(query, connectionName) {
|
|
23410
23438
|
if (isMutation(query)) {
|
|
23411
23439
|
console.error(
|
|
23412
|
-
|
|
23440
|
+
chalk202.red(
|
|
23413
23441
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
23414
23442
|
)
|
|
23415
23443
|
);
|
|
@@ -23424,7 +23452,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
23424
23452
|
printTable(rows);
|
|
23425
23453
|
} else {
|
|
23426
23454
|
console.log(
|
|
23427
|
-
|
|
23455
|
+
chalk202.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
23428
23456
|
);
|
|
23429
23457
|
}
|
|
23430
23458
|
} finally {
|
|
@@ -24239,7 +24267,7 @@ function registerVoice(program2) {
|
|
|
24239
24267
|
|
|
24240
24268
|
// src/commands/roam/auth.ts
|
|
24241
24269
|
import { randomBytes } from "crypto";
|
|
24242
|
-
import
|
|
24270
|
+
import chalk203 from "chalk";
|
|
24243
24271
|
|
|
24244
24272
|
// src/commands/roam/waitForCallback.ts
|
|
24245
24273
|
import { createServer as createServer3 } from "http";
|
|
@@ -24370,13 +24398,13 @@ async function auth() {
|
|
|
24370
24398
|
saveGlobalConfig(config);
|
|
24371
24399
|
const state = randomBytes(16).toString("hex");
|
|
24372
24400
|
console.log(
|
|
24373
|
-
|
|
24401
|
+
chalk203.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
24374
24402
|
);
|
|
24375
|
-
console.log(
|
|
24376
|
-
console.log(
|
|
24377
|
-
console.log(
|
|
24403
|
+
console.log(chalk203.white("http://localhost:14523/callback\n"));
|
|
24404
|
+
console.log(chalk203.blue("Opening browser for authorization..."));
|
|
24405
|
+
console.log(chalk203.dim("Waiting for authorization callback..."));
|
|
24378
24406
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
24379
|
-
console.log(
|
|
24407
|
+
console.log(chalk203.dim("Exchanging code for tokens..."));
|
|
24380
24408
|
const tokens = await exchangeToken({
|
|
24381
24409
|
code,
|
|
24382
24410
|
clientId,
|
|
@@ -24392,7 +24420,7 @@ async function auth() {
|
|
|
24392
24420
|
};
|
|
24393
24421
|
saveGlobalConfig(config);
|
|
24394
24422
|
console.log(
|
|
24395
|
-
|
|
24423
|
+
chalk203.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
24396
24424
|
);
|
|
24397
24425
|
}
|
|
24398
24426
|
|
|
@@ -24935,7 +24963,7 @@ import { execSync as execSync58 } from "child_process";
|
|
|
24935
24963
|
import { existsSync as existsSync56, mkdirSync as mkdirSync24, unlinkSync as unlinkSync21, writeFileSync as writeFileSync42 } from "fs";
|
|
24936
24964
|
import { tmpdir as tmpdir8 } from "os";
|
|
24937
24965
|
import { join as join67, resolve as resolve17 } from "path";
|
|
24938
|
-
import
|
|
24966
|
+
import chalk204 from "chalk";
|
|
24939
24967
|
|
|
24940
24968
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
24941
24969
|
var captureWindowPs1 = `
|
|
@@ -25086,13 +25114,13 @@ function screenshot(processName) {
|
|
|
25086
25114
|
const config = loadConfig();
|
|
25087
25115
|
const outputDir = resolve17(config.screenshot.outputDir);
|
|
25088
25116
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
25089
|
-
console.log(
|
|
25117
|
+
console.log(chalk204.gray(`Capturing window for process "${processName}" ...`));
|
|
25090
25118
|
try {
|
|
25091
25119
|
runPowerShellScript(processName, outputPath);
|
|
25092
|
-
console.log(
|
|
25120
|
+
console.log(chalk204.green(`Screenshot saved: ${outputPath}`));
|
|
25093
25121
|
} catch (error) {
|
|
25094
25122
|
const msg = error instanceof Error ? error.message : String(error);
|
|
25095
|
-
console.error(
|
|
25123
|
+
console.error(chalk204.red(`Failed to capture screenshot: ${msg}`));
|
|
25096
25124
|
process.exit(1);
|
|
25097
25125
|
}
|
|
25098
25126
|
}
|
|
@@ -29296,7 +29324,7 @@ var sessionsConfigHelp = [
|
|
|
29296
29324
|
|
|
29297
29325
|
// src/commands/sessions/summarise/index.ts
|
|
29298
29326
|
import * as fs41 from "fs";
|
|
29299
|
-
import
|
|
29327
|
+
import chalk205 from "chalk";
|
|
29300
29328
|
|
|
29301
29329
|
// src/commands/sessions/summarise/shared.ts
|
|
29302
29330
|
import * as fs40 from "fs";
|
|
@@ -29370,22 +29398,22 @@ ${firstMessage}`);
|
|
|
29370
29398
|
async function summarise2(options2) {
|
|
29371
29399
|
const files = await discoverSessionFiles();
|
|
29372
29400
|
if (files.length === 0) {
|
|
29373
|
-
console.log(
|
|
29401
|
+
console.log(chalk205.yellow("No sessions found."));
|
|
29374
29402
|
return;
|
|
29375
29403
|
}
|
|
29376
29404
|
const toProcess = selectCandidates(files, options2);
|
|
29377
29405
|
if (toProcess.length === 0) {
|
|
29378
|
-
console.log(
|
|
29406
|
+
console.log(chalk205.green("All sessions already summarised."));
|
|
29379
29407
|
return;
|
|
29380
29408
|
}
|
|
29381
29409
|
console.log(
|
|
29382
|
-
|
|
29410
|
+
chalk205.cyan(
|
|
29383
29411
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
29384
29412
|
)
|
|
29385
29413
|
);
|
|
29386
29414
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
29387
29415
|
console.log(
|
|
29388
|
-
|
|
29416
|
+
chalk205.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk205.yellow(`, ${failed2} skipped`) : "")
|
|
29389
29417
|
);
|
|
29390
29418
|
}
|
|
29391
29419
|
function selectCandidates(files, options2) {
|
|
@@ -29405,16 +29433,16 @@ function processSessions(files) {
|
|
|
29405
29433
|
let failed2 = 0;
|
|
29406
29434
|
for (let i = 0; i < files.length; i++) {
|
|
29407
29435
|
const file = files[i];
|
|
29408
|
-
process.stdout.write(
|
|
29436
|
+
process.stdout.write(chalk205.dim(` [${i + 1}/${files.length}] `));
|
|
29409
29437
|
const summary = summariseSession(file);
|
|
29410
29438
|
if (summary) {
|
|
29411
29439
|
writeSummary(file, summary);
|
|
29412
29440
|
succeeded++;
|
|
29413
|
-
process.stdout.write(`${
|
|
29441
|
+
process.stdout.write(`${chalk205.green("\u2713")} ${summary}
|
|
29414
29442
|
`);
|
|
29415
29443
|
} else {
|
|
29416
29444
|
failed2++;
|
|
29417
|
-
process.stdout.write(` ${
|
|
29445
|
+
process.stdout.write(` ${chalk205.yellow("skip")}
|
|
29418
29446
|
`);
|
|
29419
29447
|
}
|
|
29420
29448
|
}
|
|
@@ -29435,7 +29463,7 @@ function registerSessions(program2) {
|
|
|
29435
29463
|
}
|
|
29436
29464
|
|
|
29437
29465
|
// src/commands/statusLine.ts
|
|
29438
|
-
import
|
|
29466
|
+
import chalk207 from "chalk";
|
|
29439
29467
|
|
|
29440
29468
|
// src/shared/contextLevel.ts
|
|
29441
29469
|
function contextLevel(pct) {
|
|
@@ -29445,7 +29473,7 @@ function contextLevel(pct) {
|
|
|
29445
29473
|
}
|
|
29446
29474
|
|
|
29447
29475
|
// src/commands/buildLimitsSegment.ts
|
|
29448
|
-
import
|
|
29476
|
+
import chalk206 from "chalk";
|
|
29449
29477
|
|
|
29450
29478
|
// src/shared/rateLimitLevel.ts
|
|
29451
29479
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -29476,9 +29504,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
29476
29504
|
|
|
29477
29505
|
// src/commands/buildLimitsSegment.ts
|
|
29478
29506
|
var LEVEL_COLOR = {
|
|
29479
|
-
ok:
|
|
29480
|
-
warn:
|
|
29481
|
-
over:
|
|
29507
|
+
ok: chalk206.green,
|
|
29508
|
+
warn: chalk206.yellow,
|
|
29509
|
+
over: chalk206.red
|
|
29482
29510
|
};
|
|
29483
29511
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
29484
29512
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -29574,7 +29602,7 @@ async function relayUsage(claudeSessionId, transcriptPath, usedPct) {
|
|
|
29574
29602
|
}
|
|
29575
29603
|
|
|
29576
29604
|
// src/commands/statusLine.ts
|
|
29577
|
-
|
|
29605
|
+
chalk207.level = 3;
|
|
29578
29606
|
function formatNumber(num) {
|
|
29579
29607
|
return num.toLocaleString("en-US");
|
|
29580
29608
|
}
|
|
@@ -29582,9 +29610,9 @@ function colorizePercent(pct) {
|
|
|
29582
29610
|
const label2 = `${Math.round(pct)}%`;
|
|
29583
29611
|
switch (contextLevel(pct)) {
|
|
29584
29612
|
case "red":
|
|
29585
|
-
return
|
|
29613
|
+
return chalk207.red(label2);
|
|
29586
29614
|
case "yellow":
|
|
29587
|
-
return
|
|
29615
|
+
return chalk207.yellow(label2);
|
|
29588
29616
|
default:
|
|
29589
29617
|
return label2;
|
|
29590
29618
|
}
|
|
@@ -29597,7 +29625,7 @@ async function statusLine() {
|
|
|
29597
29625
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
29598
29626
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
29599
29627
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
29600
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
29628
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk207.cyan(branch2)} | ` : "";
|
|
29601
29629
|
console.log(
|
|
29602
29630
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
29603
29631
|
);
|
|
@@ -29618,14 +29646,14 @@ import { fileURLToPath as fileURLToPath9 } from "url";
|
|
|
29618
29646
|
// src/commands/sync/syncClaudeMd.ts
|
|
29619
29647
|
import * as fs42 from "fs";
|
|
29620
29648
|
import * as path61 from "path";
|
|
29621
|
-
import
|
|
29649
|
+
import chalk209 from "chalk";
|
|
29622
29650
|
|
|
29623
29651
|
// src/commands/sync/printAutoConfirmHint.ts
|
|
29624
|
-
import
|
|
29652
|
+
import chalk208 from "chalk";
|
|
29625
29653
|
var autoConfirmHintCommand = "assist config set sync.autoConfirm true --global";
|
|
29626
29654
|
function printAutoConfirmHint() {
|
|
29627
29655
|
console.log(
|
|
29628
|
-
|
|
29656
|
+
chalk208.dim(
|
|
29629
29657
|
`Tip: run \`${autoConfirmHintCommand}\` to overwrite automatically next time`
|
|
29630
29658
|
)
|
|
29631
29659
|
);
|
|
@@ -29641,14 +29669,14 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
29641
29669
|
const targetContent = fs42.readFileSync(target, "utf8");
|
|
29642
29670
|
if (sourceContent !== targetContent) {
|
|
29643
29671
|
console.log(
|
|
29644
|
-
|
|
29672
|
+
chalk209.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
29645
29673
|
);
|
|
29646
29674
|
console.log();
|
|
29647
29675
|
printDiff(targetContent, sourceContent);
|
|
29648
29676
|
if (!options2?.yes) {
|
|
29649
29677
|
printAutoConfirmHint();
|
|
29650
29678
|
const confirm = await promptConfirm(
|
|
29651
|
-
|
|
29679
|
+
chalk209.red("Overwrite existing CLAUDE.md?"),
|
|
29652
29680
|
false
|
|
29653
29681
|
);
|
|
29654
29682
|
if (!confirm) {
|
|
@@ -29843,7 +29871,7 @@ function syncPi(claudeDir) {
|
|
|
29843
29871
|
// src/commands/sync/syncSettings.ts
|
|
29844
29872
|
import * as fs47 from "fs";
|
|
29845
29873
|
import * as path68 from "path";
|
|
29846
|
-
import
|
|
29874
|
+
import chalk210 from "chalk";
|
|
29847
29875
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
29848
29876
|
const source = path68.join(claudeDir, "settings.json");
|
|
29849
29877
|
const target = path68.join(targetBase, "settings.json");
|
|
@@ -29862,7 +29890,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
29862
29890
|
if (mergedContent !== normalizedTarget) {
|
|
29863
29891
|
if (!options2?.yes) {
|
|
29864
29892
|
console.log(
|
|
29865
|
-
|
|
29893
|
+
chalk210.yellow(
|
|
29866
29894
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
29867
29895
|
)
|
|
29868
29896
|
);
|
|
@@ -29870,7 +29898,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
29870
29898
|
printDiff(targetContent, mergedContent);
|
|
29871
29899
|
printAutoConfirmHint();
|
|
29872
29900
|
const confirm = await promptConfirm(
|
|
29873
|
-
|
|
29901
|
+
chalk210.red("Overwrite existing settings.json?"),
|
|
29874
29902
|
false
|
|
29875
29903
|
);
|
|
29876
29904
|
if (!confirm) {
|
|
@@ -29969,10 +29997,10 @@ async function update2() {
|
|
|
29969
29997
|
}
|
|
29970
29998
|
|
|
29971
29999
|
// src/reportCliError.ts
|
|
29972
|
-
import
|
|
30000
|
+
import chalk211 from "chalk";
|
|
29973
30001
|
function reportCliError(error) {
|
|
29974
30002
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError) {
|
|
29975
|
-
console.error(
|
|
30003
|
+
console.error(chalk211.red(error.message));
|
|
29976
30004
|
} else {
|
|
29977
30005
|
console.error(error);
|
|
29978
30006
|
}
|