@staff0rd/assist 0.163.0 → 0.164.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +272 -259
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.164.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -79,8 +79,25 @@ var package_default = {
|
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
-
// src/commands/backlog/
|
|
83
|
-
import
|
|
82
|
+
// src/commands/backlog/next.ts
|
|
83
|
+
import chalk7 from "chalk";
|
|
84
|
+
import enquirer2 from "enquirer";
|
|
85
|
+
|
|
86
|
+
// src/shared/exitOnCancel.ts
|
|
87
|
+
async function exitOnCancel(promise) {
|
|
88
|
+
try {
|
|
89
|
+
return await promise;
|
|
90
|
+
} catch (err) {
|
|
91
|
+
if (err === "" || err === void 0) {
|
|
92
|
+
process.exit(0);
|
|
93
|
+
}
|
|
94
|
+
throw err;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// src/commands/backlog/acquireLock.ts
|
|
99
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2, unlinkSync, writeFileSync as writeFileSync2 } from "fs";
|
|
100
|
+
import { join as join2 } from "path";
|
|
84
101
|
|
|
85
102
|
// src/commands/backlog/shared.ts
|
|
86
103
|
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
@@ -122,8 +139,15 @@ var backlogItemSchema = z.strictObject({
|
|
|
122
139
|
var backlogFileSchema = z.array(backlogItemSchema);
|
|
123
140
|
|
|
124
141
|
// src/commands/backlog/shared.ts
|
|
142
|
+
var _backlogDir;
|
|
143
|
+
function setBacklogDir(dir) {
|
|
144
|
+
_backlogDir = dir;
|
|
145
|
+
}
|
|
146
|
+
function getBacklogDir() {
|
|
147
|
+
return _backlogDir ?? process.cwd();
|
|
148
|
+
}
|
|
125
149
|
function getBacklogPath() {
|
|
126
|
-
return join(
|
|
150
|
+
return join(getBacklogDir(), "assist.backlog.yml");
|
|
127
151
|
}
|
|
128
152
|
function loadBacklog() {
|
|
129
153
|
const backlogPath = getBacklogPath();
|
|
@@ -185,82 +209,10 @@ function getNextId(items) {
|
|
|
185
209
|
if (items.length === 0) return 1;
|
|
186
210
|
return Math.max(...items.map((item) => item.id)) + 1;
|
|
187
211
|
}
|
|
188
|
-
function readStdin() {
|
|
189
|
-
return new Promise((resolve7, reject) => {
|
|
190
|
-
const chunks = [];
|
|
191
|
-
process.stdin.on("data", (chunk) => chunks.push(chunk));
|
|
192
|
-
process.stdin.on("end", () => resolve7(Buffer.concat(chunks).toString()));
|
|
193
|
-
process.stdin.on("error", reject);
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// src/commands/backlog/delete/index.ts
|
|
198
|
-
async function del(id) {
|
|
199
|
-
const name = removeItem(id);
|
|
200
|
-
if (name) {
|
|
201
|
-
console.log(chalk2.green(`Deleted item #${id}: ${name}`));
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// src/commands/backlog/done/index.ts
|
|
206
|
-
import chalk3 from "chalk";
|
|
207
|
-
|
|
208
|
-
// src/commands/backlog/addComment.ts
|
|
209
|
-
function addComment(item, text, phase) {
|
|
210
|
-
const entry = {
|
|
211
|
-
text,
|
|
212
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
213
|
-
type: "comment",
|
|
214
|
-
...phase !== void 0 && { phase }
|
|
215
|
-
};
|
|
216
|
-
if (!item.comments) item.comments = [];
|
|
217
|
-
item.comments.push(entry);
|
|
218
|
-
}
|
|
219
|
-
function addPhaseSummary(item, text, phase) {
|
|
220
|
-
const entry = {
|
|
221
|
-
text,
|
|
222
|
-
phase,
|
|
223
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
224
|
-
type: "summary"
|
|
225
|
-
};
|
|
226
|
-
if (!item.comments) item.comments = [];
|
|
227
|
-
item.comments.push(entry);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
// src/commands/backlog/done/index.ts
|
|
231
|
-
async function done(id, summary) {
|
|
232
|
-
const result = loadAndFindItem(id);
|
|
233
|
-
if (!result) return;
|
|
234
|
-
result.item.status = "done";
|
|
235
|
-
if (summary) {
|
|
236
|
-
const phase = result.item.currentPhase ?? 0;
|
|
237
|
-
addPhaseSummary(result.item, summary, phase);
|
|
238
|
-
}
|
|
239
|
-
saveBacklog(result.items);
|
|
240
|
-
console.log(chalk3.green(`Completed item #${id}: ${result.item.name}`));
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
// src/commands/backlog/next.ts
|
|
244
|
-
import chalk9 from "chalk";
|
|
245
|
-
import enquirer2 from "enquirer";
|
|
246
|
-
|
|
247
|
-
// src/shared/exitOnCancel.ts
|
|
248
|
-
async function exitOnCancel(promise) {
|
|
249
|
-
try {
|
|
250
|
-
return await promise;
|
|
251
|
-
} catch (err) {
|
|
252
|
-
if (err === "" || err === void 0) {
|
|
253
|
-
process.exit(0);
|
|
254
|
-
}
|
|
255
|
-
throw err;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
212
|
|
|
259
213
|
// src/commands/backlog/acquireLock.ts
|
|
260
|
-
import { existsSync as existsSync2, readFileSync as readFileSync2, unlinkSync, writeFileSync as writeFileSync2 } from "fs";
|
|
261
|
-
import { join as join2 } from "path";
|
|
262
214
|
function getLockPath(itemId) {
|
|
263
|
-
return join2(
|
|
215
|
+
return join2(getBacklogDir(), `.assist-lock-${itemId}.json`);
|
|
264
216
|
}
|
|
265
217
|
function isProcessAlive(pid) {
|
|
266
218
|
try {
|
|
@@ -296,37 +248,37 @@ function releaseLock(itemId) {
|
|
|
296
248
|
}
|
|
297
249
|
|
|
298
250
|
// src/commands/backlog/list/shared.ts
|
|
299
|
-
import
|
|
251
|
+
import chalk2 from "chalk";
|
|
300
252
|
function statusIcon(status2) {
|
|
301
253
|
switch (status2) {
|
|
302
254
|
case "todo":
|
|
303
|
-
return
|
|
255
|
+
return chalk2.dim("[ ]");
|
|
304
256
|
case "in-progress":
|
|
305
|
-
return
|
|
257
|
+
return chalk2.yellow("[~]");
|
|
306
258
|
case "done":
|
|
307
|
-
return
|
|
259
|
+
return chalk2.green("[x]");
|
|
308
260
|
}
|
|
309
261
|
}
|
|
310
262
|
function typeLabel(type) {
|
|
311
263
|
switch (type) {
|
|
312
264
|
case "bug":
|
|
313
|
-
return
|
|
265
|
+
return chalk2.magenta("Bug");
|
|
314
266
|
case "story":
|
|
315
|
-
return
|
|
267
|
+
return chalk2.cyan("Story");
|
|
316
268
|
}
|
|
317
269
|
}
|
|
318
270
|
function phaseLabel(item) {
|
|
319
271
|
if (!item.plan) return "";
|
|
320
|
-
return
|
|
272
|
+
return chalk2.dim(
|
|
321
273
|
` (phase ${(item.currentPhase ?? 0) + 1}/${item.plan.length})`
|
|
322
274
|
);
|
|
323
275
|
}
|
|
324
276
|
function printVerboseDetails(item) {
|
|
325
277
|
if (item.description) {
|
|
326
|
-
console.log(` ${
|
|
278
|
+
console.log(` ${chalk2.dim("Description:")} ${item.description}`);
|
|
327
279
|
}
|
|
328
280
|
if (item.acceptanceCriteria.length > 0) {
|
|
329
|
-
console.log(` ${
|
|
281
|
+
console.log(` ${chalk2.dim("Acceptance criteria:")}`);
|
|
330
282
|
for (const [i, criterion] of item.acceptanceCriteria.entries()) {
|
|
331
283
|
console.log(` ${i + 1}. ${criterion}`);
|
|
332
284
|
}
|
|
@@ -335,7 +287,7 @@ function printVerboseDetails(item) {
|
|
|
335
287
|
}
|
|
336
288
|
|
|
337
289
|
// src/commands/backlog/run.ts
|
|
338
|
-
import
|
|
290
|
+
import chalk6 from "chalk";
|
|
339
291
|
|
|
340
292
|
// src/commands/backlog/buildCommentLines.ts
|
|
341
293
|
function buildCommentLines(comments2) {
|
|
@@ -454,11 +406,11 @@ function buildReviewPhase() {
|
|
|
454
406
|
}
|
|
455
407
|
|
|
456
408
|
// src/commands/backlog/executePhase.ts
|
|
457
|
-
import
|
|
409
|
+
import chalk4 from "chalk";
|
|
458
410
|
|
|
459
411
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
460
412
|
import { existsSync as existsSync3, unlinkSync as unlinkSync2 } from "fs";
|
|
461
|
-
import
|
|
413
|
+
import chalk3 from "chalk";
|
|
462
414
|
|
|
463
415
|
// src/commands/backlog/handleIncompletePhase.ts
|
|
464
416
|
import enquirer from "enquirer";
|
|
@@ -481,7 +433,7 @@ import { writeFileSync as writeFileSync3 } from "fs";
|
|
|
481
433
|
import { join as join3 } from "path";
|
|
482
434
|
var SIGNAL_FILE = ".assist-signal.json";
|
|
483
435
|
function getSignalPath() {
|
|
484
|
-
return join3(
|
|
436
|
+
return join3(getBacklogDir(), SIGNAL_FILE);
|
|
485
437
|
}
|
|
486
438
|
function writeSignal(event, data) {
|
|
487
439
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
@@ -503,7 +455,7 @@ async function resolvePhaseResult(phaseIndex) {
|
|
|
503
455
|
return action === "skip" ? 1 : 0;
|
|
504
456
|
}
|
|
505
457
|
cleanupSignal();
|
|
506
|
-
console.log(
|
|
458
|
+
console.log(chalk3.green(`
|
|
507
459
|
Phase ${phaseIndex + 1} completed.`));
|
|
508
460
|
return 1;
|
|
509
461
|
}
|
|
@@ -561,7 +513,7 @@ function stopWatching() {
|
|
|
561
513
|
async function executePhase(item, phaseIndex, phases, spawnOptions) {
|
|
562
514
|
const phase = phases[phaseIndex];
|
|
563
515
|
console.log(
|
|
564
|
-
|
|
516
|
+
chalk4.bold(
|
|
565
517
|
`
|
|
566
518
|
--- Phase ${phaseIndex + 1}/${phases.length}: ${phase.name} ---
|
|
567
519
|
`
|
|
@@ -580,7 +532,7 @@ async function executePhase(item, phaseIndex, phases, spawnOptions) {
|
|
|
580
532
|
}
|
|
581
533
|
|
|
582
534
|
// src/commands/backlog/prepareRun.ts
|
|
583
|
-
import
|
|
535
|
+
import chalk5 from "chalk";
|
|
584
536
|
|
|
585
537
|
// src/commands/backlog/resolvePlan.ts
|
|
586
538
|
function resolvePlan(item) {
|
|
@@ -603,13 +555,13 @@ function prepareRun(id) {
|
|
|
603
555
|
const plan2 = resolvePlan(item);
|
|
604
556
|
const startPhase = item.currentPhase ?? 0;
|
|
605
557
|
if (item.status === "done") {
|
|
606
|
-
console.log(
|
|
558
|
+
console.log(chalk5.green(`Already done: #${id}: ${item.name}`));
|
|
607
559
|
return void 0;
|
|
608
560
|
}
|
|
609
561
|
if (startPhase > plan2.length) {
|
|
610
562
|
setStatus(id, "done");
|
|
611
563
|
console.log(
|
|
612
|
-
|
|
564
|
+
chalk5.green(`All phases already complete for #${id}: ${item.name}`)
|
|
613
565
|
);
|
|
614
566
|
return void 0;
|
|
615
567
|
}
|
|
@@ -634,12 +586,12 @@ async function run(id, spawnOptions) {
|
|
|
634
586
|
}
|
|
635
587
|
}
|
|
636
588
|
function logProgress(id, name, startPhase, total) {
|
|
637
|
-
console.log(
|
|
589
|
+
console.log(chalk6.bold(`Running plan for #${id}: ${name}`));
|
|
638
590
|
if (startPhase > 0) {
|
|
639
|
-
console.log(
|
|
591
|
+
console.log(chalk6.dim(`Resuming from phase ${startPhase + 1}/${total}
|
|
640
592
|
`));
|
|
641
593
|
} else {
|
|
642
|
-
console.log(
|
|
594
|
+
console.log(chalk6.dim(`${total} phase(s)
|
|
643
595
|
`));
|
|
644
596
|
}
|
|
645
597
|
}
|
|
@@ -693,7 +645,7 @@ async function next(options2) {
|
|
|
693
645
|
const inProgress = findResumable(items);
|
|
694
646
|
if (inProgress) {
|
|
695
647
|
console.log(
|
|
696
|
-
|
|
648
|
+
chalk7.bold(
|
|
697
649
|
`Resuming in-progress item #${inProgress.id}: ${inProgress.name}`
|
|
698
650
|
)
|
|
699
651
|
);
|
|
@@ -703,13 +655,13 @@ async function next(options2) {
|
|
|
703
655
|
}
|
|
704
656
|
const todo = items.filter((i) => i.status === "todo");
|
|
705
657
|
if (todo.length === 0) {
|
|
706
|
-
console.log(
|
|
658
|
+
console.log(chalk7.green("All backlog items complete."));
|
|
707
659
|
return;
|
|
708
660
|
}
|
|
709
661
|
let id;
|
|
710
662
|
if (todo.length === 1) {
|
|
711
663
|
const only = todo[0];
|
|
712
|
-
console.log(
|
|
664
|
+
console.log(chalk7.bold(`Starting #${only.id}: ${only.name}`));
|
|
713
665
|
id = String(only.id);
|
|
714
666
|
} else {
|
|
715
667
|
id = await selectItem(todo);
|
|
@@ -720,7 +672,31 @@ async function next(options2) {
|
|
|
720
672
|
}
|
|
721
673
|
|
|
722
674
|
// src/commands/backlog/phaseDone.ts
|
|
723
|
-
import
|
|
675
|
+
import chalk8 from "chalk";
|
|
676
|
+
|
|
677
|
+
// src/commands/backlog/addComment.ts
|
|
678
|
+
function addComment(item, text, phase) {
|
|
679
|
+
const entry = {
|
|
680
|
+
text,
|
|
681
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
682
|
+
type: "comment",
|
|
683
|
+
...phase !== void 0 && { phase }
|
|
684
|
+
};
|
|
685
|
+
if (!item.comments) item.comments = [];
|
|
686
|
+
item.comments.push(entry);
|
|
687
|
+
}
|
|
688
|
+
function addPhaseSummary(item, text, phase) {
|
|
689
|
+
const entry = {
|
|
690
|
+
text,
|
|
691
|
+
phase,
|
|
692
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
693
|
+
type: "summary"
|
|
694
|
+
};
|
|
695
|
+
if (!item.comments) item.comments = [];
|
|
696
|
+
item.comments.push(entry);
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
// src/commands/backlog/phaseDone.ts
|
|
724
700
|
function phaseDone(id, phase, summary) {
|
|
725
701
|
const phaseIndex = Number.parseInt(phase, 10);
|
|
726
702
|
writeSignal("phase-done", {
|
|
@@ -730,7 +706,7 @@ function phaseDone(id, phase, summary) {
|
|
|
730
706
|
});
|
|
731
707
|
const result = loadAndFindItem(id);
|
|
732
708
|
if (result?.item.status === "done") {
|
|
733
|
-
console.log(
|
|
709
|
+
console.log(chalk8.dim(`Item #${id} already done, skipping phase advance.`));
|
|
734
710
|
return;
|
|
735
711
|
}
|
|
736
712
|
if (result) {
|
|
@@ -738,27 +714,27 @@ function phaseDone(id, phase, summary) {
|
|
|
738
714
|
saveBacklog(result.items);
|
|
739
715
|
}
|
|
740
716
|
setCurrentPhase(id, phaseIndex + 1);
|
|
741
|
-
console.log(
|
|
717
|
+
console.log(chalk8.green(`Phase ${phase} of item #${id} marked as complete.`));
|
|
742
718
|
}
|
|
743
719
|
|
|
744
720
|
// src/commands/backlog/plan.ts
|
|
745
|
-
import
|
|
721
|
+
import chalk9 from "chalk";
|
|
746
722
|
function plan(id) {
|
|
747
723
|
const result = loadAndFindItem(id);
|
|
748
724
|
if (!result) return;
|
|
749
725
|
const { item } = result;
|
|
750
726
|
if (!item.plan || item.plan.length === 0) {
|
|
751
|
-
console.log(
|
|
727
|
+
console.log(chalk9.dim("No plan defined for this item."));
|
|
752
728
|
return;
|
|
753
729
|
}
|
|
754
|
-
console.log(
|
|
730
|
+
console.log(chalk9.bold(item.name));
|
|
755
731
|
console.log();
|
|
756
732
|
for (const [i, phase] of item.plan.entries()) {
|
|
757
|
-
console.log(`${
|
|
733
|
+
console.log(`${chalk9.bold(`Phase ${i + 1}:`)} ${phase.name}`);
|
|
758
734
|
for (const task of phase.tasks) {
|
|
759
735
|
console.log(` - ${task.task}`);
|
|
760
736
|
if (task.verify) {
|
|
761
|
-
console.log(` ${
|
|
737
|
+
console.log(` ${chalk9.dim(`verify: ${task.verify}`)}`);
|
|
762
738
|
}
|
|
763
739
|
}
|
|
764
740
|
console.log();
|
|
@@ -766,14 +742,14 @@ function plan(id) {
|
|
|
766
742
|
}
|
|
767
743
|
|
|
768
744
|
// src/commands/backlog/show/index.ts
|
|
769
|
-
import
|
|
745
|
+
import chalk11 from "chalk";
|
|
770
746
|
|
|
771
747
|
// src/commands/backlog/formatComment.ts
|
|
772
|
-
import
|
|
748
|
+
import chalk10 from "chalk";
|
|
773
749
|
function formatComment(entry) {
|
|
774
|
-
const tag = entry.type === "summary" ?
|
|
775
|
-
const phase = entry.phase !== void 0 ?
|
|
776
|
-
const time =
|
|
750
|
+
const tag = entry.type === "summary" ? chalk10.magenta("[summary]") : chalk10.cyan("[comment]");
|
|
751
|
+
const phase = entry.phase !== void 0 ? chalk10.dim(` (phase ${entry.phase + 1})`) : "";
|
|
752
|
+
const time = chalk10.dim(entry.timestamp);
|
|
777
753
|
return `${tag}${phase} ${time}
|
|
778
754
|
${entry.text}`;
|
|
779
755
|
}
|
|
@@ -781,7 +757,7 @@ function formatComment(entry) {
|
|
|
781
757
|
// src/commands/backlog/show/index.ts
|
|
782
758
|
function printPlan(item) {
|
|
783
759
|
if (!item.plan || item.plan.length === 0) return;
|
|
784
|
-
console.log(
|
|
760
|
+
console.log(chalk11.bold("Plan"));
|
|
785
761
|
for (const [i, phase] of item.plan.entries()) {
|
|
786
762
|
const isCurrent = item.currentPhase === i;
|
|
787
763
|
printPhase(phase, i, isCurrent);
|
|
@@ -789,21 +765,21 @@ function printPlan(item) {
|
|
|
789
765
|
console.log();
|
|
790
766
|
}
|
|
791
767
|
function phaseHeader(index, name, isCurrent) {
|
|
792
|
-
const marker = isCurrent ?
|
|
793
|
-
const label2 = isCurrent ?
|
|
768
|
+
const marker = isCurrent ? chalk11.green("\u25B6 ") : " ";
|
|
769
|
+
const label2 = isCurrent ? chalk11.green.bold(`Phase ${index + 1}: ${name}`) : `${chalk11.bold(`Phase ${index + 1}:`)} ${name}`;
|
|
794
770
|
return `${marker}${label2}`;
|
|
795
771
|
}
|
|
796
772
|
function printPhaseTasks(phase) {
|
|
797
773
|
for (const task of phase.tasks) {
|
|
798
774
|
console.log(` - ${task.task}`);
|
|
799
775
|
if (task.verify) {
|
|
800
|
-
console.log(` ${
|
|
776
|
+
console.log(` ${chalk11.dim(`verify: ${task.verify}`)}`);
|
|
801
777
|
}
|
|
802
778
|
}
|
|
803
779
|
if (phase.manualChecks && phase.manualChecks.length > 0) {
|
|
804
|
-
console.log(` ${
|
|
780
|
+
console.log(` ${chalk11.dim("Manual checks:")}`);
|
|
805
781
|
for (const check2 of phase.manualChecks) {
|
|
806
|
-
console.log(` ${
|
|
782
|
+
console.log(` ${chalk11.dim(`- ${check2}`)}`);
|
|
807
783
|
}
|
|
808
784
|
}
|
|
809
785
|
}
|
|
@@ -812,15 +788,15 @@ function printPhase(phase, index, isCurrent) {
|
|
|
812
788
|
printPhaseTasks(phase);
|
|
813
789
|
}
|
|
814
790
|
function printHeader(item) {
|
|
815
|
-
console.log(
|
|
791
|
+
console.log(chalk11.bold(`#${item.id} ${item.name}`));
|
|
816
792
|
console.log(
|
|
817
|
-
`${
|
|
793
|
+
`${chalk11.dim("Type:")} ${item.type} ${chalk11.dim("Status:")} ${item.status}`
|
|
818
794
|
);
|
|
819
795
|
console.log();
|
|
820
796
|
}
|
|
821
797
|
function printAcceptanceCriteria(criteria) {
|
|
822
798
|
if (criteria.length === 0) return;
|
|
823
|
-
console.log(
|
|
799
|
+
console.log(chalk11.bold("Acceptance Criteria"));
|
|
824
800
|
for (const [i, ac] of criteria.entries()) {
|
|
825
801
|
console.log(` ${i + 1}. ${ac}`);
|
|
826
802
|
}
|
|
@@ -832,7 +808,7 @@ function show(id) {
|
|
|
832
808
|
const { item } = result;
|
|
833
809
|
printHeader(item);
|
|
834
810
|
if (item.description) {
|
|
835
|
-
console.log(
|
|
811
|
+
console.log(chalk11.bold("Description"));
|
|
836
812
|
console.log(item.description);
|
|
837
813
|
console.log();
|
|
838
814
|
}
|
|
@@ -843,22 +819,13 @@ function show(id) {
|
|
|
843
819
|
function printComments(item) {
|
|
844
820
|
const entries = item.comments ?? [];
|
|
845
821
|
if (entries.length === 0) return;
|
|
846
|
-
console.log(
|
|
822
|
+
console.log(chalk11.bold("Comments"));
|
|
847
823
|
for (const entry of entries) {
|
|
848
824
|
console.log(` ${formatComment(entry)}`);
|
|
849
825
|
}
|
|
850
826
|
console.log();
|
|
851
827
|
}
|
|
852
828
|
|
|
853
|
-
// src/commands/backlog/start/index.ts
|
|
854
|
-
import chalk14 from "chalk";
|
|
855
|
-
async function start(id) {
|
|
856
|
-
const name = setStatus(id, "in-progress");
|
|
857
|
-
if (name) {
|
|
858
|
-
console.log(chalk14.green(`Started item #${id}: ${name}`));
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
|
|
862
829
|
// src/shared/web.ts
|
|
863
830
|
import { exec } from "child_process";
|
|
864
831
|
import { readFileSync as readFileSync4 } from "fs";
|
|
@@ -867,7 +834,7 @@ import {
|
|
|
867
834
|
} from "http";
|
|
868
835
|
import { dirname, join as join4 } from "path";
|
|
869
836
|
import { fileURLToPath } from "url";
|
|
870
|
-
import
|
|
837
|
+
import chalk12 from "chalk";
|
|
871
838
|
function respondJson(res, status2, data) {
|
|
872
839
|
res.writeHead(status2, { "Content-Type": "application/json" });
|
|
873
840
|
res.end(JSON.stringify(data));
|
|
@@ -911,8 +878,8 @@ function startWebServer(label2, port, handler) {
|
|
|
911
878
|
handler(req, res, port);
|
|
912
879
|
});
|
|
913
880
|
server.listen(port, () => {
|
|
914
|
-
console.log(
|
|
915
|
-
console.log(
|
|
881
|
+
console.log(chalk12.green(`${label2}: ${url}`));
|
|
882
|
+
console.log(chalk12.dim("Press Ctrl+C to stop"));
|
|
916
883
|
exec(`open ${url}`);
|
|
917
884
|
});
|
|
918
885
|
}
|
|
@@ -1060,7 +1027,7 @@ async function web(options2) {
|
|
|
1060
1027
|
}
|
|
1061
1028
|
|
|
1062
1029
|
// src/commands/backlog/launchMode.ts
|
|
1063
|
-
import
|
|
1030
|
+
import chalk13 from "chalk";
|
|
1064
1031
|
async function launchMode(slashCommand) {
|
|
1065
1032
|
process.env.ASSIST_SESSION_ID = String(process.pid);
|
|
1066
1033
|
const { child, done: done2 } = spawnClaude(`/${slashCommand}`);
|
|
@@ -1070,7 +1037,7 @@ async function launchMode(slashCommand) {
|
|
|
1070
1037
|
const signal = readSignal();
|
|
1071
1038
|
cleanupSignal();
|
|
1072
1039
|
if (signal?.event === "next") {
|
|
1073
|
-
console.log(
|
|
1040
|
+
console.log(chalk13.bold("\nChaining into assist next...\n"));
|
|
1074
1041
|
await next({ allowEdits: true });
|
|
1075
1042
|
}
|
|
1076
1043
|
}
|
|
@@ -1082,7 +1049,7 @@ import { execSync } from "child_process";
|
|
|
1082
1049
|
import { existsSync as existsSync7, readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "fs";
|
|
1083
1050
|
import { homedir } from "os";
|
|
1084
1051
|
import { basename, dirname as dirname2, join as join5 } from "path";
|
|
1085
|
-
import
|
|
1052
|
+
import chalk14 from "chalk";
|
|
1086
1053
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
1087
1054
|
|
|
1088
1055
|
// src/shared/loadRawYaml.ts
|
|
@@ -1278,7 +1245,7 @@ function getTranscriptConfig() {
|
|
|
1278
1245
|
const config = loadConfig();
|
|
1279
1246
|
if (!config.transcript) {
|
|
1280
1247
|
console.error(
|
|
1281
|
-
|
|
1248
|
+
chalk14.red(
|
|
1282
1249
|
"Transcript directories not configured. Run 'assist transcript configure' first."
|
|
1283
1250
|
)
|
|
1284
1251
|
);
|
|
@@ -1367,7 +1334,7 @@ function commit(args) {
|
|
|
1367
1334
|
}
|
|
1368
1335
|
|
|
1369
1336
|
// src/commands/config/index.ts
|
|
1370
|
-
import
|
|
1337
|
+
import chalk15 from "chalk";
|
|
1371
1338
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
1372
1339
|
|
|
1373
1340
|
// src/commands/config/setNestedValue.ts
|
|
@@ -1430,7 +1397,7 @@ function formatIssuePath(issue, key) {
|
|
|
1430
1397
|
function printValidationErrors(issues, key) {
|
|
1431
1398
|
for (const issue of issues) {
|
|
1432
1399
|
console.error(
|
|
1433
|
-
|
|
1400
|
+
chalk15.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
1434
1401
|
);
|
|
1435
1402
|
}
|
|
1436
1403
|
}
|
|
@@ -1447,7 +1414,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
1447
1414
|
function assertNotGlobalOnly(key, global) {
|
|
1448
1415
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
1449
1416
|
console.error(
|
|
1450
|
-
|
|
1417
|
+
chalk15.red(
|
|
1451
1418
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
1452
1419
|
)
|
|
1453
1420
|
);
|
|
@@ -1470,7 +1437,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
1470
1437
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
1471
1438
|
const target = options2.global ? "global" : "project";
|
|
1472
1439
|
console.log(
|
|
1473
|
-
|
|
1440
|
+
chalk15.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
1474
1441
|
);
|
|
1475
1442
|
}
|
|
1476
1443
|
function configList() {
|
|
@@ -1479,7 +1446,7 @@ function configList() {
|
|
|
1479
1446
|
}
|
|
1480
1447
|
|
|
1481
1448
|
// src/commands/config/configGet.ts
|
|
1482
|
-
import
|
|
1449
|
+
import chalk16 from "chalk";
|
|
1483
1450
|
|
|
1484
1451
|
// src/commands/config/getNestedValue.ts
|
|
1485
1452
|
function isTraversable(value) {
|
|
@@ -1511,7 +1478,7 @@ function requireNestedValue(config, key) {
|
|
|
1511
1478
|
return value;
|
|
1512
1479
|
}
|
|
1513
1480
|
function exitKeyNotSet(key) {
|
|
1514
|
-
console.error(
|
|
1481
|
+
console.error(chalk16.red(`Key "${key}" is not set`));
|
|
1515
1482
|
process.exit(1);
|
|
1516
1483
|
}
|
|
1517
1484
|
|
|
@@ -1531,10 +1498,10 @@ function coverage() {
|
|
|
1531
1498
|
}
|
|
1532
1499
|
|
|
1533
1500
|
// src/commands/verify/init/index.ts
|
|
1534
|
-
import
|
|
1501
|
+
import chalk31 from "chalk";
|
|
1535
1502
|
|
|
1536
1503
|
// src/shared/promptMultiselect.ts
|
|
1537
|
-
import
|
|
1504
|
+
import chalk17 from "chalk";
|
|
1538
1505
|
import enquirer3 from "enquirer";
|
|
1539
1506
|
async function promptMultiselect(message, options2) {
|
|
1540
1507
|
const { selected } = await exitOnCancel(
|
|
@@ -1544,7 +1511,7 @@ async function promptMultiselect(message, options2) {
|
|
|
1544
1511
|
message,
|
|
1545
1512
|
choices: options2.map((opt) => ({
|
|
1546
1513
|
name: opt.value,
|
|
1547
|
-
message: `${opt.name} - ${
|
|
1514
|
+
message: `${opt.name} - ${chalk17.dim(opt.description)}`
|
|
1548
1515
|
})),
|
|
1549
1516
|
// @ts-expect-error - enquirer types don't include symbols but it's supported
|
|
1550
1517
|
symbols: {
|
|
@@ -1561,7 +1528,7 @@ async function promptMultiselect(message, options2) {
|
|
|
1561
1528
|
// src/shared/readPackageJson.ts
|
|
1562
1529
|
import * as fs from "fs";
|
|
1563
1530
|
import * as path from "path";
|
|
1564
|
-
import
|
|
1531
|
+
import chalk18 from "chalk";
|
|
1565
1532
|
function findPackageJson() {
|
|
1566
1533
|
const packageJsonPath = path.join(process.cwd(), "package.json");
|
|
1567
1534
|
if (fs.existsSync(packageJsonPath)) {
|
|
@@ -1575,7 +1542,7 @@ function readPackageJson(filePath) {
|
|
|
1575
1542
|
function requirePackageJson() {
|
|
1576
1543
|
const packageJsonPath = findPackageJson();
|
|
1577
1544
|
if (!packageJsonPath) {
|
|
1578
|
-
console.error(
|
|
1545
|
+
console.error(chalk18.red("No package.json found in current directory"));
|
|
1579
1546
|
process.exit(1);
|
|
1580
1547
|
}
|
|
1581
1548
|
const pkg = readPackageJson(packageJsonPath);
|
|
@@ -1606,7 +1573,7 @@ function findPackageJsonWithVerifyScripts(startDir) {
|
|
|
1606
1573
|
// src/commands/verify/installPackage.ts
|
|
1607
1574
|
import { execSync as execSync3 } from "child_process";
|
|
1608
1575
|
import { writeFileSync as writeFileSync5 } from "fs";
|
|
1609
|
-
import
|
|
1576
|
+
import chalk19 from "chalk";
|
|
1610
1577
|
function writePackageJson(filePath, pkg) {
|
|
1611
1578
|
writeFileSync5(filePath, `${JSON.stringify(pkg, null, 2)}
|
|
1612
1579
|
`);
|
|
@@ -1621,12 +1588,12 @@ function addScript(pkg, name, command) {
|
|
|
1621
1588
|
};
|
|
1622
1589
|
}
|
|
1623
1590
|
function installPackage(name, cwd) {
|
|
1624
|
-
console.log(
|
|
1591
|
+
console.log(chalk19.dim(`Installing ${name}...`));
|
|
1625
1592
|
try {
|
|
1626
1593
|
execSync3(`npm install -D ${name}`, { stdio: "inherit", cwd });
|
|
1627
1594
|
return true;
|
|
1628
1595
|
} catch {
|
|
1629
|
-
console.error(
|
|
1596
|
+
console.error(chalk19.red(`Failed to install ${name}`));
|
|
1630
1597
|
return false;
|
|
1631
1598
|
}
|
|
1632
1599
|
}
|
|
@@ -1673,9 +1640,9 @@ var expectedScripts = {
|
|
|
1673
1640
|
};
|
|
1674
1641
|
|
|
1675
1642
|
// src/commands/verify/setup/setupBuild.ts
|
|
1676
|
-
import
|
|
1643
|
+
import chalk20 from "chalk";
|
|
1677
1644
|
async function setupBuild(_packageJsonPath, writer, hasVite, hasTypescript) {
|
|
1678
|
-
console.log(
|
|
1645
|
+
console.log(chalk20.blue("\nSetting up build verification..."));
|
|
1679
1646
|
let command;
|
|
1680
1647
|
if (hasVite && hasTypescript) {
|
|
1681
1648
|
command = "tsc -b && vite build --logLevel error";
|
|
@@ -1684,21 +1651,21 @@ async function setupBuild(_packageJsonPath, writer, hasVite, hasTypescript) {
|
|
|
1684
1651
|
} else {
|
|
1685
1652
|
command = "npm run build";
|
|
1686
1653
|
}
|
|
1687
|
-
console.log(
|
|
1654
|
+
console.log(chalk20.dim(`Using: ${command}`));
|
|
1688
1655
|
writer("verify:build", command);
|
|
1689
1656
|
}
|
|
1690
1657
|
async function setupTypecheck(_packageJsonPath, writer) {
|
|
1691
|
-
console.log(
|
|
1658
|
+
console.log(chalk20.blue("\nSetting up typecheck verification..."));
|
|
1692
1659
|
const command = "tsc --noEmit";
|
|
1693
|
-
console.log(
|
|
1660
|
+
console.log(chalk20.dim(`Using: ${command}`));
|
|
1694
1661
|
writer("verify:typecheck", command);
|
|
1695
1662
|
}
|
|
1696
1663
|
|
|
1697
1664
|
// src/commands/verify/setup/setupDuplicateCode.ts
|
|
1698
1665
|
import * as path2 from "path";
|
|
1699
|
-
import
|
|
1666
|
+
import chalk21 from "chalk";
|
|
1700
1667
|
async function setupDuplicateCode(packageJsonPath, writer) {
|
|
1701
|
-
console.log(
|
|
1668
|
+
console.log(chalk21.blue("\nSetting up jscpd..."));
|
|
1702
1669
|
const cwd = path2.dirname(packageJsonPath);
|
|
1703
1670
|
const pkg = readPackageJson(packageJsonPath);
|
|
1704
1671
|
const hasJscpd = !!pkg.dependencies?.jscpd || !!pkg.devDependencies?.jscpd;
|
|
@@ -1710,12 +1677,12 @@ async function setupDuplicateCode(packageJsonPath, writer) {
|
|
|
1710
1677
|
|
|
1711
1678
|
// src/commands/verify/setup/setupHardcodedColors.ts
|
|
1712
1679
|
import * as path3 from "path";
|
|
1713
|
-
import
|
|
1680
|
+
import chalk23 from "chalk";
|
|
1714
1681
|
|
|
1715
1682
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
1716
1683
|
import { existsSync as existsSync9, readFileSync as readFileSync8, writeFileSync as writeFileSync6 } from "fs";
|
|
1717
1684
|
import { join as join7 } from "path";
|
|
1718
|
-
import
|
|
1685
|
+
import chalk22 from "chalk";
|
|
1719
1686
|
function loadKnipConfig(knipJsonPath) {
|
|
1720
1687
|
if (existsSync9(knipJsonPath)) {
|
|
1721
1688
|
return JSON.parse(readFileSync8(knipJsonPath, "utf-8"));
|
|
@@ -1734,16 +1701,16 @@ function addToKnipIgnoreBinaries(cwd, binary) {
|
|
|
1734
1701
|
`${JSON.stringify(knipConfig, null, " ")}
|
|
1735
1702
|
`
|
|
1736
1703
|
);
|
|
1737
|
-
console.log(
|
|
1704
|
+
console.log(chalk22.dim(`Added '${binary}' to knip.json ignoreBinaries`));
|
|
1738
1705
|
}
|
|
1739
1706
|
} catch {
|
|
1740
|
-
console.log(
|
|
1707
|
+
console.log(chalk22.yellow("Warning: Could not update knip.json"));
|
|
1741
1708
|
}
|
|
1742
1709
|
}
|
|
1743
1710
|
|
|
1744
1711
|
// src/commands/verify/setup/setupHardcodedColors.ts
|
|
1745
1712
|
async function setupHardcodedColors(packageJsonPath, writer, hasOpenColor) {
|
|
1746
|
-
console.log(
|
|
1713
|
+
console.log(chalk23.blue("\nSetting up hardcoded colors check..."));
|
|
1747
1714
|
const cwd = path3.dirname(packageJsonPath);
|
|
1748
1715
|
if (!hasOpenColor) {
|
|
1749
1716
|
installPackage("open-color", cwd);
|
|
@@ -1754,9 +1721,9 @@ async function setupHardcodedColors(packageJsonPath, writer, hasOpenColor) {
|
|
|
1754
1721
|
|
|
1755
1722
|
// src/commands/verify/setup/setupKnip.ts
|
|
1756
1723
|
import * as path4 from "path";
|
|
1757
|
-
import
|
|
1724
|
+
import chalk24 from "chalk";
|
|
1758
1725
|
async function setupKnip(packageJsonPath, writer) {
|
|
1759
|
-
console.log(
|
|
1726
|
+
console.log(chalk24.blue("\nSetting up knip..."));
|
|
1760
1727
|
const cwd = path4.dirname(packageJsonPath);
|
|
1761
1728
|
const pkg = readPackageJson(packageJsonPath);
|
|
1762
1729
|
if (!pkg.devDependencies?.knip && !installPackage("knip", cwd)) {
|
|
@@ -1767,14 +1734,14 @@ async function setupKnip(packageJsonPath, writer) {
|
|
|
1767
1734
|
|
|
1768
1735
|
// src/commands/verify/setup/setupLint.ts
|
|
1769
1736
|
import * as path5 from "path";
|
|
1770
|
-
import
|
|
1737
|
+
import chalk27 from "chalk";
|
|
1771
1738
|
|
|
1772
1739
|
// src/commands/lint/init.ts
|
|
1773
1740
|
import { execSync as execSync5 } from "child_process";
|
|
1774
1741
|
import { existsSync as existsSync12, readFileSync as readFileSync10, writeFileSync as writeFileSync8 } from "fs";
|
|
1775
1742
|
import { dirname as dirname7, join as join8 } from "path";
|
|
1776
1743
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1777
|
-
import
|
|
1744
|
+
import chalk26 from "chalk";
|
|
1778
1745
|
|
|
1779
1746
|
// src/shared/promptConfirm.ts
|
|
1780
1747
|
import enquirer4 from "enquirer";
|
|
@@ -1878,7 +1845,7 @@ function removeEslintScripts(scripts, options2) {
|
|
|
1878
1845
|
}
|
|
1879
1846
|
|
|
1880
1847
|
// src/utils/printDiff.ts
|
|
1881
|
-
import
|
|
1848
|
+
import chalk25 from "chalk";
|
|
1882
1849
|
import * as diff from "diff";
|
|
1883
1850
|
function normalizeJson(content) {
|
|
1884
1851
|
try {
|
|
@@ -1896,11 +1863,11 @@ function printDiff(oldContent, newContent) {
|
|
|
1896
1863
|
const lines = change.value.replace(/\n$/, "").split("\n");
|
|
1897
1864
|
for (const line of lines) {
|
|
1898
1865
|
if (change.added) {
|
|
1899
|
-
console.log(
|
|
1866
|
+
console.log(chalk25.green(`+ ${line}`));
|
|
1900
1867
|
} else if (change.removed) {
|
|
1901
|
-
console.log(
|
|
1868
|
+
console.log(chalk25.red(`- ${line}`));
|
|
1902
1869
|
} else {
|
|
1903
|
-
console.log(
|
|
1870
|
+
console.log(chalk25.dim(` ${line}`));
|
|
1904
1871
|
}
|
|
1905
1872
|
}
|
|
1906
1873
|
}
|
|
@@ -1934,10 +1901,10 @@ async function init() {
|
|
|
1934
1901
|
console.log("biome.json already has the correct linter config");
|
|
1935
1902
|
return;
|
|
1936
1903
|
}
|
|
1937
|
-
console.log(
|
|
1904
|
+
console.log(chalk26.yellow("\n\u26A0\uFE0F biome.json will be updated:"));
|
|
1938
1905
|
console.log();
|
|
1939
1906
|
printDiff(oldContent, newContent);
|
|
1940
|
-
const confirm = await promptConfirm(
|
|
1907
|
+
const confirm = await promptConfirm(chalk26.red("Update biome.json?"));
|
|
1941
1908
|
if (!confirm) {
|
|
1942
1909
|
console.log("Skipped biome.json update");
|
|
1943
1910
|
return;
|
|
@@ -1948,7 +1915,7 @@ async function init() {
|
|
|
1948
1915
|
|
|
1949
1916
|
// src/commands/verify/setup/setupLint.ts
|
|
1950
1917
|
async function setupLint(packageJsonPath, writer) {
|
|
1951
|
-
console.log(
|
|
1918
|
+
console.log(chalk27.blue("\nSetting up biome..."));
|
|
1952
1919
|
const cwd = path5.dirname(packageJsonPath);
|
|
1953
1920
|
const pkg = readPackageJson(packageJsonPath);
|
|
1954
1921
|
if (!pkg.devDependencies?.["@biomejs/biome"]) {
|
|
@@ -1962,9 +1929,9 @@ async function setupLint(packageJsonPath, writer) {
|
|
|
1962
1929
|
|
|
1963
1930
|
// src/commands/verify/setup/setupMadge.ts
|
|
1964
1931
|
import * as path6 from "path";
|
|
1965
|
-
import
|
|
1932
|
+
import chalk28 from "chalk";
|
|
1966
1933
|
async function setupMadge(packageJsonPath, writer) {
|
|
1967
|
-
console.log(
|
|
1934
|
+
console.log(chalk28.blue("\nSetting up madge..."));
|
|
1968
1935
|
const cwd = path6.dirname(packageJsonPath);
|
|
1969
1936
|
const pkg = readPackageJson(packageJsonPath);
|
|
1970
1937
|
const hasMadge = !!pkg.dependencies?.madge || !!pkg.devDependencies?.madge;
|
|
@@ -1976,18 +1943,18 @@ async function setupMadge(packageJsonPath, writer) {
|
|
|
1976
1943
|
|
|
1977
1944
|
// src/commands/verify/setup/setupMaintainability.ts
|
|
1978
1945
|
import * as path7 from "path";
|
|
1979
|
-
import
|
|
1946
|
+
import chalk29 from "chalk";
|
|
1980
1947
|
async function setupMaintainability(packageJsonPath, writer) {
|
|
1981
|
-
console.log(
|
|
1948
|
+
console.log(chalk29.blue("\nSetting up maintainability check..."));
|
|
1982
1949
|
addToKnipIgnoreBinaries(path7.dirname(packageJsonPath), "assist");
|
|
1983
1950
|
writer("verify:maintainability", expectedScripts["verify:maintainability"]);
|
|
1984
1951
|
}
|
|
1985
1952
|
|
|
1986
1953
|
// src/commands/verify/setup/setupTest.ts
|
|
1987
1954
|
import * as path8 from "path";
|
|
1988
|
-
import
|
|
1955
|
+
import chalk30 from "chalk";
|
|
1989
1956
|
async function setupTest(packageJsonPath, writer) {
|
|
1990
|
-
console.log(
|
|
1957
|
+
console.log(chalk30.blue("\nSetting up vitest..."));
|
|
1991
1958
|
const cwd = path8.dirname(packageJsonPath);
|
|
1992
1959
|
const pkg = readPackageJson(packageJsonPath);
|
|
1993
1960
|
if (!pkg.devDependencies?.vitest && !installPackage("vitest", cwd)) {
|
|
@@ -2156,25 +2123,25 @@ async function runSelectedSetups(selected, packageJsonPath, writer, handlers) {
|
|
|
2156
2123
|
for (const choice of selected) {
|
|
2157
2124
|
await handlers[choice]?.(packageJsonPath, writer);
|
|
2158
2125
|
}
|
|
2159
|
-
console.log(
|
|
2126
|
+
console.log(chalk31.green(`
|
|
2160
2127
|
Added ${selected.length} verify script(s):`));
|
|
2161
2128
|
for (const choice of selected) {
|
|
2162
|
-
console.log(
|
|
2129
|
+
console.log(chalk31.green(` - verify:${choice}`));
|
|
2163
2130
|
}
|
|
2164
|
-
console.log(
|
|
2131
|
+
console.log(chalk31.dim("\nRun 'assist verify' to run all verify scripts"));
|
|
2165
2132
|
}
|
|
2166
2133
|
async function promptForScripts(availableOptions) {
|
|
2167
2134
|
if (availableOptions.length === 0) {
|
|
2168
|
-
console.log(
|
|
2135
|
+
console.log(chalk31.green("All verify scripts are already configured!"));
|
|
2169
2136
|
return null;
|
|
2170
2137
|
}
|
|
2171
|
-
console.log(
|
|
2138
|
+
console.log(chalk31.bold("Available verify scripts to add:\n"));
|
|
2172
2139
|
const selected = await promptMultiselect(
|
|
2173
2140
|
"Select verify scripts to add:",
|
|
2174
2141
|
availableOptions
|
|
2175
2142
|
);
|
|
2176
2143
|
if (selected.length === 0) {
|
|
2177
|
-
console.log(
|
|
2144
|
+
console.log(chalk31.yellow("No scripts selected"));
|
|
2178
2145
|
return null;
|
|
2179
2146
|
}
|
|
2180
2147
|
return selected;
|
|
@@ -2194,17 +2161,17 @@ async function init2() {
|
|
|
2194
2161
|
}
|
|
2195
2162
|
|
|
2196
2163
|
// src/commands/vscode/init/index.ts
|
|
2197
|
-
import
|
|
2164
|
+
import chalk33 from "chalk";
|
|
2198
2165
|
|
|
2199
2166
|
// src/commands/vscode/init/createLaunchJson.ts
|
|
2200
2167
|
import * as fs2 from "fs";
|
|
2201
2168
|
import * as path9 from "path";
|
|
2202
|
-
import
|
|
2169
|
+
import chalk32 from "chalk";
|
|
2203
2170
|
function ensureVscodeFolder() {
|
|
2204
2171
|
const vscodeDir = path9.join(process.cwd(), ".vscode");
|
|
2205
2172
|
if (!fs2.existsSync(vscodeDir)) {
|
|
2206
2173
|
fs2.mkdirSync(vscodeDir);
|
|
2207
|
-
console.log(
|
|
2174
|
+
console.log(chalk32.dim("Created .vscode folder"));
|
|
2208
2175
|
}
|
|
2209
2176
|
}
|
|
2210
2177
|
function removeVscodeFromGitignore() {
|
|
@@ -2219,7 +2186,7 @@ function removeVscodeFromGitignore() {
|
|
|
2219
2186
|
);
|
|
2220
2187
|
if (filteredLines.length !== lines.length) {
|
|
2221
2188
|
fs2.writeFileSync(gitignorePath, filteredLines.join("\n"));
|
|
2222
|
-
console.log(
|
|
2189
|
+
console.log(chalk32.dim("Removed .vscode references from .gitignore"));
|
|
2223
2190
|
}
|
|
2224
2191
|
}
|
|
2225
2192
|
function createLaunchJson(type) {
|
|
@@ -2238,7 +2205,7 @@ function createLaunchJson(type) {
|
|
|
2238
2205
|
const launchPath = path9.join(process.cwd(), ".vscode", "launch.json");
|
|
2239
2206
|
fs2.writeFileSync(launchPath, `${JSON.stringify(launchConfig, null, " ")}
|
|
2240
2207
|
`);
|
|
2241
|
-
console.log(
|
|
2208
|
+
console.log(chalk32.green("Created .vscode/launch.json"));
|
|
2242
2209
|
}
|
|
2243
2210
|
function createSettingsJson() {
|
|
2244
2211
|
const settings = {
|
|
@@ -2251,7 +2218,7 @@ function createSettingsJson() {
|
|
|
2251
2218
|
const settingsPath = path9.join(process.cwd(), ".vscode", "settings.json");
|
|
2252
2219
|
fs2.writeFileSync(settingsPath, `${JSON.stringify(settings, null, " ")}
|
|
2253
2220
|
`);
|
|
2254
|
-
console.log(
|
|
2221
|
+
console.log(chalk32.green("Created .vscode/settings.json"));
|
|
2255
2222
|
}
|
|
2256
2223
|
function createExtensionsJson() {
|
|
2257
2224
|
const extensions = {
|
|
@@ -2263,7 +2230,7 @@ function createExtensionsJson() {
|
|
|
2263
2230
|
`${JSON.stringify(extensions, null, " ")}
|
|
2264
2231
|
`
|
|
2265
2232
|
);
|
|
2266
|
-
console.log(
|
|
2233
|
+
console.log(chalk32.green("Created .vscode/extensions.json"));
|
|
2267
2234
|
}
|
|
2268
2235
|
|
|
2269
2236
|
// src/commands/vscode/init/detectVscodeSetup.ts
|
|
@@ -2320,7 +2287,7 @@ function applySelections(selected, setup2) {
|
|
|
2320
2287
|
for (const choice of selected) handlers[choice]?.();
|
|
2321
2288
|
}
|
|
2322
2289
|
async function promptForOptions(options2) {
|
|
2323
|
-
console.log(
|
|
2290
|
+
console.log(chalk33.bold("Available VS Code configurations to add:\n"));
|
|
2324
2291
|
return promptMultiselect("Select configurations to add:", options2);
|
|
2325
2292
|
}
|
|
2326
2293
|
async function init3({ all = false } = {}) {
|
|
@@ -2328,17 +2295,17 @@ async function init3({ all = false } = {}) {
|
|
|
2328
2295
|
const setup2 = detectVscodeSetup(pkg);
|
|
2329
2296
|
const options2 = getAvailableOptions2(setup2);
|
|
2330
2297
|
if (options2.length === 0) {
|
|
2331
|
-
console.log(
|
|
2298
|
+
console.log(chalk33.green("VS Code configuration already exists!"));
|
|
2332
2299
|
return;
|
|
2333
2300
|
}
|
|
2334
2301
|
const selected = all ? options2.map((o) => o.value) : await promptForOptions(options2);
|
|
2335
2302
|
if (selected.length === 0) {
|
|
2336
|
-
console.log(
|
|
2303
|
+
console.log(chalk33.yellow("No configurations selected"));
|
|
2337
2304
|
return;
|
|
2338
2305
|
}
|
|
2339
2306
|
applySelections(selected, setup2);
|
|
2340
2307
|
console.log(
|
|
2341
|
-
|
|
2308
|
+
chalk33.green(`
|
|
2342
2309
|
Added ${selected.length} VS Code configuration(s)`)
|
|
2343
2310
|
);
|
|
2344
2311
|
}
|
|
@@ -2351,7 +2318,7 @@ async function init4() {
|
|
|
2351
2318
|
|
|
2352
2319
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
2353
2320
|
import path16 from "path";
|
|
2354
|
-
import
|
|
2321
|
+
import chalk35 from "chalk";
|
|
2355
2322
|
|
|
2356
2323
|
// src/commands/lint/lint/checkFileNames.ts
|
|
2357
2324
|
import fs5 from "fs";
|
|
@@ -2431,7 +2398,7 @@ function checkFileNames() {
|
|
|
2431
2398
|
}
|
|
2432
2399
|
|
|
2433
2400
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
2434
|
-
import
|
|
2401
|
+
import chalk34 from "chalk";
|
|
2435
2402
|
|
|
2436
2403
|
// src/commands/lint/lint/applyMoves.ts
|
|
2437
2404
|
import fs6 from "fs";
|
|
@@ -2516,25 +2483,25 @@ function fixFileNameViolations(moves) {
|
|
|
2516
2483
|
const start3 = performance.now();
|
|
2517
2484
|
const project = createLintProject();
|
|
2518
2485
|
const cwd = process.cwd();
|
|
2519
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
2486
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk34.green(line)));
|
|
2520
2487
|
const ms = (performance.now() - start3).toFixed(0);
|
|
2521
|
-
console.log(
|
|
2488
|
+
console.log(chalk34.dim(` Done in ${ms}ms`));
|
|
2522
2489
|
}
|
|
2523
2490
|
|
|
2524
2491
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
2525
2492
|
function reportViolations(violations) {
|
|
2526
|
-
console.error(
|
|
2493
|
+
console.error(chalk35.red("\nFile name check failed:\n"));
|
|
2527
2494
|
console.error(
|
|
2528
|
-
|
|
2495
|
+
chalk35.red(
|
|
2529
2496
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
2530
2497
|
)
|
|
2531
2498
|
);
|
|
2532
2499
|
for (const violation of violations) {
|
|
2533
|
-
console.error(
|
|
2534
|
-
console.error(
|
|
2500
|
+
console.error(chalk35.red(` ${violation.filePath}`));
|
|
2501
|
+
console.error(chalk35.gray(` Rename to: ${violation.suggestedName}
|
|
2535
2502
|
`));
|
|
2536
2503
|
}
|
|
2537
|
-
console.error(
|
|
2504
|
+
console.error(chalk35.dim(" Run with -f to auto-fix.\n"));
|
|
2538
2505
|
}
|
|
2539
2506
|
function runFileNameCheck(fix = false) {
|
|
2540
2507
|
const violations = checkFileNames();
|
|
@@ -2563,17 +2530,17 @@ function runFileNameCheck(fix = false) {
|
|
|
2563
2530
|
import fs8 from "fs";
|
|
2564
2531
|
|
|
2565
2532
|
// src/commands/lint/shared.ts
|
|
2566
|
-
import
|
|
2533
|
+
import chalk36 from "chalk";
|
|
2567
2534
|
function reportViolations2(violations, checkName, errorMessage, successMessage) {
|
|
2568
2535
|
if (violations.length > 0) {
|
|
2569
|
-
console.error(
|
|
2536
|
+
console.error(chalk36.red(`
|
|
2570
2537
|
${checkName} failed:
|
|
2571
2538
|
`));
|
|
2572
|
-
console.error(
|
|
2539
|
+
console.error(chalk36.red(` ${errorMessage}
|
|
2573
2540
|
`));
|
|
2574
2541
|
for (const violation of violations) {
|
|
2575
|
-
console.error(
|
|
2576
|
-
console.error(
|
|
2542
|
+
console.error(chalk36.red(` ${violation.filePath}:${violation.line}`));
|
|
2543
|
+
console.error(chalk36.gray(` ${violation.content}
|
|
2577
2544
|
`));
|
|
2578
2545
|
}
|
|
2579
2546
|
return false;
|
|
@@ -3053,14 +3020,14 @@ import { existsSync as existsSync16, readFileSync as readFileSync13, writeFileSy
|
|
|
3053
3020
|
|
|
3054
3021
|
// src/commands/deploy/init/index.ts
|
|
3055
3022
|
import { execSync as execSync12 } from "child_process";
|
|
3056
|
-
import
|
|
3023
|
+
import chalk38 from "chalk";
|
|
3057
3024
|
import enquirer5 from "enquirer";
|
|
3058
3025
|
|
|
3059
3026
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
3060
3027
|
import { existsSync as existsSync15, mkdirSync as mkdirSync3, readFileSync as readFileSync12, writeFileSync as writeFileSync12 } from "fs";
|
|
3061
3028
|
import { dirname as dirname13, join as join11 } from "path";
|
|
3062
3029
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
3063
|
-
import
|
|
3030
|
+
import chalk37 from "chalk";
|
|
3064
3031
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
3065
3032
|
var __dirname3 = dirname13(fileURLToPath3(import.meta.url));
|
|
3066
3033
|
function getExistingSiteId() {
|
|
@@ -3085,20 +3052,20 @@ async function updateWorkflow(siteId) {
|
|
|
3085
3052
|
if (existsSync15(WORKFLOW_PATH)) {
|
|
3086
3053
|
const oldContent = readFileSync12(WORKFLOW_PATH, "utf-8");
|
|
3087
3054
|
if (oldContent === newContent) {
|
|
3088
|
-
console.log(
|
|
3055
|
+
console.log(chalk37.green("build.yml is already up to date"));
|
|
3089
3056
|
return;
|
|
3090
3057
|
}
|
|
3091
|
-
console.log(
|
|
3058
|
+
console.log(chalk37.yellow("\nbuild.yml will be updated:"));
|
|
3092
3059
|
console.log();
|
|
3093
3060
|
printDiff(oldContent, newContent);
|
|
3094
|
-
const confirm = await promptConfirm(
|
|
3061
|
+
const confirm = await promptConfirm(chalk37.red("Update build.yml?"));
|
|
3095
3062
|
if (!confirm) {
|
|
3096
3063
|
console.log("Skipped build.yml update");
|
|
3097
3064
|
return;
|
|
3098
3065
|
}
|
|
3099
3066
|
}
|
|
3100
3067
|
writeFileSync12(WORKFLOW_PATH, newContent);
|
|
3101
|
-
console.log(
|
|
3068
|
+
console.log(chalk37.green(`
|
|
3102
3069
|
Created ${WORKFLOW_PATH}`));
|
|
3103
3070
|
}
|
|
3104
3071
|
|
|
@@ -3109,43 +3076,43 @@ async function ensureNetlifyCli() {
|
|
|
3109
3076
|
} catch (error) {
|
|
3110
3077
|
if (!(error instanceof Error) || !error.message.includes("command not found"))
|
|
3111
3078
|
throw error;
|
|
3112
|
-
console.error(
|
|
3079
|
+
console.error(chalk38.red("\nNetlify CLI is not installed.\n"));
|
|
3113
3080
|
const install = await promptConfirm("Would you like to install it now?");
|
|
3114
3081
|
if (!install) {
|
|
3115
3082
|
console.log(
|
|
3116
|
-
|
|
3083
|
+
chalk38.yellow(
|
|
3117
3084
|
"\nInstall it manually with: npm install -g netlify-cli\n"
|
|
3118
3085
|
)
|
|
3119
3086
|
);
|
|
3120
3087
|
process.exit(1);
|
|
3121
3088
|
}
|
|
3122
|
-
console.log(
|
|
3089
|
+
console.log(chalk38.dim("\nInstalling netlify-cli...\n"));
|
|
3123
3090
|
execSync12("npm install -g netlify-cli", { stdio: "inherit" });
|
|
3124
3091
|
console.log();
|
|
3125
3092
|
execSync12("netlify sites:create --disable-linking", { stdio: "inherit" });
|
|
3126
3093
|
}
|
|
3127
3094
|
}
|
|
3128
3095
|
function printSetupInstructions() {
|
|
3129
|
-
console.log(
|
|
3096
|
+
console.log(chalk38.bold("\nDeployment initialized successfully!"));
|
|
3130
3097
|
console.log(
|
|
3131
|
-
|
|
3098
|
+
chalk38.yellow("\nTo complete setup, create a personal access token at:")
|
|
3132
3099
|
);
|
|
3133
3100
|
console.log(
|
|
3134
|
-
|
|
3101
|
+
chalk38.cyan(
|
|
3135
3102
|
"https://app.netlify.com/user/applications#personal-access-tokens"
|
|
3136
3103
|
)
|
|
3137
3104
|
);
|
|
3138
3105
|
console.log(
|
|
3139
|
-
|
|
3106
|
+
chalk38.yellow(
|
|
3140
3107
|
"\nThen add it as NETLIFY_AUTH_TOKEN in your GitHub repository secrets."
|
|
3141
3108
|
)
|
|
3142
3109
|
);
|
|
3143
3110
|
}
|
|
3144
3111
|
async function init5() {
|
|
3145
|
-
console.log(
|
|
3112
|
+
console.log(chalk38.bold("Initializing Netlify deployment...\n"));
|
|
3146
3113
|
const existingSiteId = getExistingSiteId();
|
|
3147
3114
|
if (existingSiteId) {
|
|
3148
|
-
console.log(
|
|
3115
|
+
console.log(chalk38.dim(`Using existing site ID: ${existingSiteId}
|
|
3149
3116
|
`));
|
|
3150
3117
|
await updateWorkflow(existingSiteId);
|
|
3151
3118
|
return;
|
|
@@ -3205,7 +3172,7 @@ function registerNew(program2) {
|
|
|
3205
3172
|
|
|
3206
3173
|
// src/lib/readStdin.ts
|
|
3207
3174
|
import * as readline from "readline";
|
|
3208
|
-
async function
|
|
3175
|
+
async function readStdin() {
|
|
3209
3176
|
const rl = readline.createInterface({
|
|
3210
3177
|
input: process.stdin,
|
|
3211
3178
|
output: process.stdout,
|
|
@@ -3296,7 +3263,7 @@ async function notify() {
|
|
|
3296
3263
|
if (!config.notify?.enabled) {
|
|
3297
3264
|
return;
|
|
3298
3265
|
}
|
|
3299
|
-
const inputData = await
|
|
3266
|
+
const inputData = await readStdin();
|
|
3300
3267
|
const data = JSON.parse(inputData);
|
|
3301
3268
|
const { notification_type, cwd, message } = data;
|
|
3302
3269
|
const projectName = cwd?.split(/[/\\]/).pop() ?? "Unknown Project";
|
|
@@ -3324,27 +3291,27 @@ async function notify() {
|
|
|
3324
3291
|
}
|
|
3325
3292
|
|
|
3326
3293
|
// src/commands/backlog/comment/index.ts
|
|
3327
|
-
import
|
|
3294
|
+
import chalk39 from "chalk";
|
|
3328
3295
|
function comment(id, text) {
|
|
3329
3296
|
const result = loadAndFindItem(id);
|
|
3330
3297
|
if (!result) process.exit(1);
|
|
3331
3298
|
addComment(result.item, text);
|
|
3332
3299
|
saveBacklog(result.items);
|
|
3333
|
-
console.log(
|
|
3300
|
+
console.log(chalk39.green(`Comment added to item #${id}.`));
|
|
3334
3301
|
}
|
|
3335
3302
|
|
|
3336
3303
|
// src/commands/backlog/comments/index.ts
|
|
3337
|
-
import
|
|
3304
|
+
import chalk40 from "chalk";
|
|
3338
3305
|
function comments(id) {
|
|
3339
3306
|
const result = loadAndFindItem(id);
|
|
3340
3307
|
if (!result) process.exit(1);
|
|
3341
3308
|
const { item } = result;
|
|
3342
3309
|
const entries = item.comments ?? [];
|
|
3343
3310
|
if (entries.length === 0) {
|
|
3344
|
-
console.log(
|
|
3311
|
+
console.log(chalk40.dim(`No comments on item #${id}.`));
|
|
3345
3312
|
return;
|
|
3346
3313
|
}
|
|
3347
|
-
console.log(
|
|
3314
|
+
console.log(chalk40.bold(`Comments for #${id}: ${item.name}
|
|
3348
3315
|
`));
|
|
3349
3316
|
for (const entry of entries) {
|
|
3350
3317
|
console.log(`${formatComment(entry)}
|
|
@@ -3360,11 +3327,11 @@ function registerCommentCommands(cmd) {
|
|
|
3360
3327
|
|
|
3361
3328
|
// src/commands/backlog/add/index.ts
|
|
3362
3329
|
import { existsSync as existsSync17 } from "fs";
|
|
3363
|
-
import
|
|
3330
|
+
import chalk42 from "chalk";
|
|
3364
3331
|
|
|
3365
3332
|
// src/commands/backlog/commitBacklog.ts
|
|
3366
3333
|
import { execSync as execSync14 } from "child_process";
|
|
3367
|
-
import
|
|
3334
|
+
import chalk41 from "chalk";
|
|
3368
3335
|
function commitBacklog(id, name) {
|
|
3369
3336
|
try {
|
|
3370
3337
|
const backlogPath = getBacklogPath();
|
|
@@ -3372,10 +3339,20 @@ function commitBacklog(id, name) {
|
|
|
3372
3339
|
execSync14(`git add ${shellQuote(backlogPath)}`, { stdio: "ignore" });
|
|
3373
3340
|
execSync14(`git commit -m ${shellQuote(message)}`, { stdio: "ignore" });
|
|
3374
3341
|
} catch {
|
|
3375
|
-
console.log(
|
|
3342
|
+
console.log(chalk41.yellow("Warning: could not auto-commit backlog file."));
|
|
3376
3343
|
}
|
|
3377
3344
|
}
|
|
3378
3345
|
|
|
3346
|
+
// src/commands/backlog/readStdin.ts
|
|
3347
|
+
function readStdin2() {
|
|
3348
|
+
return new Promise((resolve7, reject) => {
|
|
3349
|
+
const chunks = [];
|
|
3350
|
+
process.stdin.on("data", (chunk) => chunks.push(chunk));
|
|
3351
|
+
process.stdin.on("end", () => resolve7(Buffer.concat(chunks).toString()));
|
|
3352
|
+
process.stdin.on("error", reject);
|
|
3353
|
+
});
|
|
3354
|
+
}
|
|
3355
|
+
|
|
3379
3356
|
// src/commands/backlog/add/shared.ts
|
|
3380
3357
|
import { spawnSync } from "child_process";
|
|
3381
3358
|
import { mkdtempSync, readFileSync as readFileSync14, unlinkSync as unlinkSync4, writeFileSync as writeFileSync14 } from "fs";
|
|
@@ -3450,10 +3427,10 @@ async function promptAcceptanceCriteria() {
|
|
|
3450
3427
|
var addItemSchema = backlogItemSchema.omit({ id: true, status: true });
|
|
3451
3428
|
async function addFromJson() {
|
|
3452
3429
|
if (process.stdin.isTTY) {
|
|
3453
|
-
console.log(
|
|
3430
|
+
console.log(chalk42.red("--json requires piped input on stdin."));
|
|
3454
3431
|
return;
|
|
3455
3432
|
}
|
|
3456
|
-
const input = await
|
|
3433
|
+
const input = await readStdin2();
|
|
3457
3434
|
const sanitised = input.replace(
|
|
3458
3435
|
/"(?:[^"\\]|\\.)*"/g,
|
|
3459
3436
|
(match) => match.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t")
|
|
@@ -3464,7 +3441,7 @@ async function addFromJson() {
|
|
|
3464
3441
|
items.push({ ...data, id, status: "todo" });
|
|
3465
3442
|
saveBacklog(items);
|
|
3466
3443
|
commitBacklog(id, data.name);
|
|
3467
|
-
console.log(
|
|
3444
|
+
console.log(chalk42.green(`Added item #${id}: ${data.name}`));
|
|
3468
3445
|
}
|
|
3469
3446
|
async function addInteractive() {
|
|
3470
3447
|
const type = await promptType();
|
|
@@ -3483,12 +3460,12 @@ async function addInteractive() {
|
|
|
3483
3460
|
});
|
|
3484
3461
|
saveBacklog(items);
|
|
3485
3462
|
commitBacklog(id, name);
|
|
3486
|
-
console.log(
|
|
3463
|
+
console.log(chalk42.green(`Added item #${id}: ${name}`));
|
|
3487
3464
|
}
|
|
3488
3465
|
async function add(options2) {
|
|
3489
3466
|
if (!existsSync17(getBacklogPath())) {
|
|
3490
3467
|
console.log(
|
|
3491
|
-
|
|
3468
|
+
chalk42.yellow(
|
|
3492
3469
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
3493
3470
|
)
|
|
3494
3471
|
);
|
|
@@ -3503,20 +3480,20 @@ async function add(options2) {
|
|
|
3503
3480
|
|
|
3504
3481
|
// src/commands/backlog/init/index.ts
|
|
3505
3482
|
import { existsSync as existsSync18 } from "fs";
|
|
3506
|
-
import
|
|
3483
|
+
import chalk43 from "chalk";
|
|
3507
3484
|
async function init6() {
|
|
3508
3485
|
const backlogPath = getBacklogPath();
|
|
3509
3486
|
if (existsSync18(backlogPath)) {
|
|
3510
|
-
console.log(
|
|
3487
|
+
console.log(chalk43.yellow("assist.backlog.yml already exists."));
|
|
3511
3488
|
return;
|
|
3512
3489
|
}
|
|
3513
3490
|
saveBacklog([]);
|
|
3514
|
-
console.log(
|
|
3491
|
+
console.log(chalk43.green("Created assist.backlog.yml"));
|
|
3515
3492
|
}
|
|
3516
3493
|
|
|
3517
3494
|
// src/commands/backlog/list/index.ts
|
|
3518
3495
|
import { existsSync as existsSync19 } from "fs";
|
|
3519
|
-
import
|
|
3496
|
+
import chalk44 from "chalk";
|
|
3520
3497
|
function filterItems(items, options2) {
|
|
3521
3498
|
if (options2.status) return items.filter((i) => i.status === options2.status);
|
|
3522
3499
|
if (!options2.all) return items.filter((i) => i.status !== "done");
|
|
@@ -3525,7 +3502,7 @@ function filterItems(items, options2) {
|
|
|
3525
3502
|
async function list2(options2) {
|
|
3526
3503
|
if (!existsSync19(getBacklogPath())) {
|
|
3527
3504
|
console.log(
|
|
3528
|
-
|
|
3505
|
+
chalk44.yellow(
|
|
3529
3506
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
3530
3507
|
)
|
|
3531
3508
|
);
|
|
@@ -3533,12 +3510,12 @@ async function list2(options2) {
|
|
|
3533
3510
|
}
|
|
3534
3511
|
const items = filterItems(loadBacklog(), options2);
|
|
3535
3512
|
if (items.length === 0) {
|
|
3536
|
-
console.log(
|
|
3513
|
+
console.log(chalk44.dim("Backlog is empty."));
|
|
3537
3514
|
return;
|
|
3538
3515
|
}
|
|
3539
3516
|
for (const item of items) {
|
|
3540
3517
|
console.log(
|
|
3541
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
3518
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk44.dim(`#${item.id}`)} ${item.name}${phaseLabel(item)}`
|
|
3542
3519
|
);
|
|
3543
3520
|
if (options2.verbose) {
|
|
3544
3521
|
printVerboseDetails(item);
|
|
@@ -3553,15 +3530,49 @@ function registerItemCommands(cmd) {
|
|
|
3553
3530
|
cmd.command("add").description("Add a new backlog item").option("--json", "Read item as JSON from stdin").action(add);
|
|
3554
3531
|
}
|
|
3555
3532
|
|
|
3556
|
-
// src/commands/
|
|
3557
|
-
|
|
3558
|
-
|
|
3533
|
+
// src/commands/backlog/delete/index.ts
|
|
3534
|
+
import chalk45 from "chalk";
|
|
3535
|
+
async function del(id) {
|
|
3536
|
+
const name = removeItem(id);
|
|
3537
|
+
if (name) {
|
|
3538
|
+
console.log(chalk45.green(`Deleted item #${id}: ${name}`));
|
|
3539
|
+
}
|
|
3559
3540
|
}
|
|
3541
|
+
|
|
3542
|
+
// src/commands/backlog/done/index.ts
|
|
3543
|
+
import chalk46 from "chalk";
|
|
3544
|
+
async function done(id, summary) {
|
|
3545
|
+
const result = loadAndFindItem(id);
|
|
3546
|
+
if (!result) return;
|
|
3547
|
+
result.item.status = "done";
|
|
3548
|
+
if (summary) {
|
|
3549
|
+
const phase = result.item.currentPhase ?? 0;
|
|
3550
|
+
addPhaseSummary(result.item, summary, phase);
|
|
3551
|
+
}
|
|
3552
|
+
saveBacklog(result.items);
|
|
3553
|
+
console.log(chalk46.green(`Completed item #${id}: ${result.item.name}`));
|
|
3554
|
+
}
|
|
3555
|
+
|
|
3556
|
+
// src/commands/backlog/start/index.ts
|
|
3557
|
+
import chalk47 from "chalk";
|
|
3558
|
+
async function start(id) {
|
|
3559
|
+
const name = setStatus(id, "in-progress");
|
|
3560
|
+
if (name) {
|
|
3561
|
+
console.log(chalk47.green(`Started item #${id}: ${name}`));
|
|
3562
|
+
}
|
|
3563
|
+
}
|
|
3564
|
+
|
|
3565
|
+
// src/commands/backlog/registerStatusCommands.ts
|
|
3560
3566
|
function registerStatusCommands(cmd) {
|
|
3561
3567
|
cmd.command("start <id>").description("Set a backlog item to in-progress").action(start);
|
|
3562
3568
|
cmd.command("done <id> [summary]").description("Set a backlog item to done").action(done);
|
|
3563
3569
|
cmd.command("delete <id>").alias("remove").description("Delete a backlog item").action(del);
|
|
3564
3570
|
}
|
|
3571
|
+
|
|
3572
|
+
// src/commands/registerBacklog.ts
|
|
3573
|
+
function registerShowCommands(cmd) {
|
|
3574
|
+
cmd.command("show <id>").alias("view").description("Show full detail for a backlog item").action(show);
|
|
3575
|
+
}
|
|
3565
3576
|
function registerWebCommand(cmd) {
|
|
3566
3577
|
cmd.command("web").description("Start a web view of the backlog").option("-p, --port <number>", "Port to listen on", "3000").action(web);
|
|
3567
3578
|
}
|
|
@@ -3580,7 +3591,9 @@ function registerRunCommand(cmd) {
|
|
|
3580
3591
|
});
|
|
3581
3592
|
}
|
|
3582
3593
|
function registerBacklog(program2) {
|
|
3583
|
-
const cmd = program2.command("backlog").description("Manage a backlog of work items").
|
|
3594
|
+
const cmd = program2.command("backlog").description("Manage a backlog of work items").option("--dir <path>", "Override directory for backlog file discovery").hook("preAction", (thisCommand) => {
|
|
3595
|
+
setBacklogDir(thisCommand.opts().dir);
|
|
3596
|
+
}).action(() => web({ port: "3000" }));
|
|
3584
3597
|
registerItemCommands(cmd);
|
|
3585
3598
|
registerShowCommands(cmd);
|
|
3586
3599
|
registerStatusCommands(cmd);
|
|
@@ -3919,7 +3932,7 @@ function extractCommand(data) {
|
|
|
3919
3932
|
return parts ? { toolName: data.tool_name, parts } : void 0;
|
|
3920
3933
|
}
|
|
3921
3934
|
async function cliHook() {
|
|
3922
|
-
const data = tryParseJson(await
|
|
3935
|
+
const data = tryParseJson(await readStdin());
|
|
3923
3936
|
if (!data) return;
|
|
3924
3937
|
const cmd = extractCommand(data);
|
|
3925
3938
|
if (!cmd) return;
|
|
@@ -10353,7 +10366,7 @@ async function showClaudeCodeIcon() {
|
|
|
10353
10366
|
} catch {
|
|
10354
10367
|
return;
|
|
10355
10368
|
}
|
|
10356
|
-
const body = process.stdin.isTTY ? "{}" : await
|
|
10369
|
+
const body = process.stdin.isTTY ? "{}" : await readStdin();
|
|
10357
10370
|
try {
|
|
10358
10371
|
await fetch(`http://localhost:${port}/api/v1/activity`, {
|
|
10359
10372
|
method: "POST",
|
|
@@ -10778,7 +10791,7 @@ function colorizePercent(pct) {
|
|
|
10778
10791
|
return label2;
|
|
10779
10792
|
}
|
|
10780
10793
|
async function statusLine() {
|
|
10781
|
-
const inputData = await
|
|
10794
|
+
const inputData = await readStdin();
|
|
10782
10795
|
const data = JSON.parse(inputData);
|
|
10783
10796
|
const model = data.model.display_name;
|
|
10784
10797
|
const { total_input_tokens: totalIn, total_output_tokens: totalOut } = data.context_window;
|