@staff0rd/assist 0.351.0 → 0.352.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 -0
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +710 -633
- 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.352.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -1788,7 +1788,7 @@ function isYamlFile(filePath) {
|
|
|
1788
1788
|
function collectComments(sourceFile) {
|
|
1789
1789
|
const seen = /* @__PURE__ */ new Set();
|
|
1790
1790
|
const comments3 = [];
|
|
1791
|
-
const
|
|
1791
|
+
const collect5 = (node) => {
|
|
1792
1792
|
for (const range of [
|
|
1793
1793
|
...node.getLeadingCommentRanges(),
|
|
1794
1794
|
...node.getTrailingCommentRanges()
|
|
@@ -1799,8 +1799,8 @@ function collectComments(sourceFile) {
|
|
|
1799
1799
|
comments3.push({ pos, text: range.getText() });
|
|
1800
1800
|
}
|
|
1801
1801
|
};
|
|
1802
|
-
|
|
1803
|
-
sourceFile.forEachDescendant(
|
|
1802
|
+
collect5(sourceFile);
|
|
1803
|
+
sourceFile.forEachDescendant(collect5);
|
|
1804
1804
|
return comments3;
|
|
1805
1805
|
}
|
|
1806
1806
|
|
|
@@ -2887,13 +2887,13 @@ async function activity(options2) {
|
|
|
2887
2887
|
const activeDays = data.filter((d) => d.count > 0).length;
|
|
2888
2888
|
console.log(`${total} commits across ${activeDays} active days.`);
|
|
2889
2889
|
const weekly = /* @__PURE__ */ new Map();
|
|
2890
|
-
for (const { date, count:
|
|
2890
|
+
for (const { date, count: count8 } of data) {
|
|
2891
2891
|
const d = new Date(date);
|
|
2892
2892
|
d.setDate(d.getDate() - d.getDay());
|
|
2893
2893
|
const weekStart = d.toISOString().slice(0, 10);
|
|
2894
|
-
weekly.set(weekStart, (weekly.get(weekStart) ?? 0) +
|
|
2894
|
+
weekly.set(weekStart, (weekly.get(weekStart) ?? 0) + count8);
|
|
2895
2895
|
}
|
|
2896
|
-
const weeklyData = [...weekly.entries()].map(([date,
|
|
2896
|
+
const weeklyData = [...weekly.entries()].map(([date, count8]) => ({ date, count: count8 })).sort((a, b) => a.date.localeCompare(b.date));
|
|
2897
2897
|
const until = data[data.length - 1].date;
|
|
2898
2898
|
activityChart(weeklyData, { since, until });
|
|
2899
2899
|
}
|
|
@@ -8561,39 +8561,22 @@ function registerSubtaskCommands(cmd) {
|
|
|
8561
8561
|
).action(subtaskStatus);
|
|
8562
8562
|
}
|
|
8563
8563
|
|
|
8564
|
-
// src/commands/backlog/
|
|
8565
|
-
import chalk92 from "chalk";
|
|
8566
|
-
import { and as and11, eq as eq28 } from "drizzle-orm";
|
|
8567
|
-
|
|
8568
|
-
// src/commands/backlog/findPhase.ts
|
|
8564
|
+
// src/commands/backlog/movePhase.ts
|
|
8569
8565
|
import chalk91 from "chalk";
|
|
8570
|
-
import {
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
const { orm, item } = found;
|
|
8575
|
-
const itemId = item.id;
|
|
8576
|
-
const phaseIdx = Number.parseInt(phase, 10) - 1;
|
|
8577
|
-
const [row] = await orm.select({ cnt: count5() }).from(planPhases).where(and9(eq26(planPhases.itemId, itemId), eq26(planPhases.idx, phaseIdx)));
|
|
8578
|
-
if (!row || row.cnt === 0) {
|
|
8579
|
-
console.log(
|
|
8580
|
-
chalk91.red(`Phase ${phaseIdx + 1} not found on item #${itemId}.`)
|
|
8581
|
-
);
|
|
8582
|
-
process.exitCode = 1;
|
|
8583
|
-
return void 0;
|
|
8584
|
-
}
|
|
8585
|
-
return { item, orm, itemId, phaseIdx };
|
|
8586
|
-
}
|
|
8566
|
+
import { count as count6, eq as eq28 } from "drizzle-orm";
|
|
8567
|
+
|
|
8568
|
+
// src/commands/backlog/reorderPhaseRows.ts
|
|
8569
|
+
import { and as and10, asc as asc7, eq as eq27 } from "drizzle-orm";
|
|
8587
8570
|
|
|
8588
8571
|
// src/commands/backlog/reindexPhases.ts
|
|
8589
|
-
import { and as
|
|
8572
|
+
import { and as and9, asc as asc6, count as count5, eq as eq26 } from "drizzle-orm";
|
|
8590
8573
|
async function reindexPhases(db, itemId) {
|
|
8591
|
-
const remaining = await db.select({ idx: planPhases.idx }).from(planPhases).where(
|
|
8574
|
+
const remaining = await db.select({ idx: planPhases.idx }).from(planPhases).where(eq26(planPhases.itemId, itemId)).orderBy(asc6(planPhases.idx));
|
|
8592
8575
|
for (let i = 0; i < remaining.length; i++) {
|
|
8593
8576
|
const oldIdx = remaining[i].idx;
|
|
8594
8577
|
if (oldIdx === i) continue;
|
|
8595
|
-
await db.update(planTasks).set({ phaseIdx: i }).where(
|
|
8596
|
-
await db.update(planPhases).set({ idx: i }).where(
|
|
8578
|
+
await db.update(planTasks).set({ phaseIdx: i }).where(and9(eq26(planTasks.itemId, itemId), eq26(planTasks.phaseIdx, oldIdx)));
|
|
8579
|
+
await db.update(planPhases).set({ idx: i }).where(and9(eq26(planPhases.itemId, itemId), eq26(planPhases.idx, oldIdx)));
|
|
8597
8580
|
}
|
|
8598
8581
|
}
|
|
8599
8582
|
async function adjustCurrentPhase(db, item, removedIdx) {
|
|
@@ -8601,36 +8584,130 @@ async function adjustCurrentPhase(db, item, removedIdx) {
|
|
|
8601
8584
|
if (currentPhase === void 0) return;
|
|
8602
8585
|
const currentIdx = currentPhase - 1;
|
|
8603
8586
|
if (removedIdx < currentIdx) {
|
|
8604
|
-
await db.update(items).set({ currentPhase: currentPhase - 1 }).where(
|
|
8587
|
+
await db.update(items).set({ currentPhase: currentPhase - 1 }).where(eq26(items.id, item.id));
|
|
8605
8588
|
return;
|
|
8606
8589
|
}
|
|
8607
8590
|
if (removedIdx !== currentIdx) return;
|
|
8608
|
-
const [row] = await db.select({ cnt:
|
|
8591
|
+
const [row] = await db.select({ cnt: count5() }).from(planPhases).where(eq26(planPhases.itemId, item.id));
|
|
8609
8592
|
const cnt = row?.cnt ?? 0;
|
|
8610
|
-
await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(
|
|
8593
|
+
await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(eq26(items.id, item.id));
|
|
8611
8594
|
}
|
|
8612
8595
|
|
|
8613
|
-
// src/commands/backlog/
|
|
8614
|
-
async function
|
|
8615
|
-
const found = await findPhase(id2, phase);
|
|
8616
|
-
if (!found) return;
|
|
8617
|
-
const { item, orm, itemId, phaseIdx } = found;
|
|
8596
|
+
// src/commands/backlog/reorderPhaseRows.ts
|
|
8597
|
+
async function reorderPhaseRows(orm, itemId, fromIdx, toIdx) {
|
|
8618
8598
|
await orm.transaction(async (tx) => {
|
|
8599
|
+
const [phaseRow] = await tx.select({ name: planPhases.name, manualChecks: planPhases.manualChecks }).from(planPhases).where(and10(eq27(planPhases.itemId, itemId), eq27(planPhases.idx, fromIdx)));
|
|
8600
|
+
const tasks = await tx.select({ idx: planTasks.idx, task: planTasks.task }).from(planTasks).where(and10(eq27(planTasks.itemId, itemId), eq27(planTasks.phaseIdx, fromIdx))).orderBy(asc7(planTasks.idx));
|
|
8619
8601
|
await tx.delete(planTasks).where(
|
|
8620
|
-
|
|
8602
|
+
and10(eq27(planTasks.itemId, itemId), eq27(planTasks.phaseIdx, fromIdx))
|
|
8621
8603
|
);
|
|
8622
|
-
await tx.delete(planPhases).where(
|
|
8604
|
+
await tx.delete(planPhases).where(and10(eq27(planPhases.itemId, itemId), eq27(planPhases.idx, fromIdx)));
|
|
8623
8605
|
await reindexPhases(tx, itemId);
|
|
8624
|
-
await
|
|
8606
|
+
await shiftPhasesUp(tx, itemId, toIdx);
|
|
8607
|
+
await tx.insert(planPhases).values({
|
|
8608
|
+
itemId,
|
|
8609
|
+
idx: toIdx,
|
|
8610
|
+
name: phaseRow.name,
|
|
8611
|
+
manualChecks: phaseRow.manualChecks
|
|
8612
|
+
});
|
|
8613
|
+
if (tasks.length) {
|
|
8614
|
+
await tx.insert(planTasks).values(
|
|
8615
|
+
tasks.map((t) => ({
|
|
8616
|
+
itemId,
|
|
8617
|
+
phaseIdx: toIdx,
|
|
8618
|
+
idx: t.idx,
|
|
8619
|
+
task: t.task
|
|
8620
|
+
}))
|
|
8621
|
+
);
|
|
8622
|
+
}
|
|
8625
8623
|
});
|
|
8626
|
-
console.log(
|
|
8627
|
-
chalk92.green(`Removed phase ${phaseIdx + 1} from item #${itemId}.`)
|
|
8628
|
-
);
|
|
8629
8624
|
}
|
|
8630
8625
|
|
|
8631
|
-
// src/commands/backlog/
|
|
8632
|
-
|
|
8633
|
-
|
|
8626
|
+
// src/commands/backlog/movePhase.ts
|
|
8627
|
+
function toIndex(value, phaseCount) {
|
|
8628
|
+
const pos = Number.parseInt(value, 10);
|
|
8629
|
+
if (Number.isNaN(pos) || pos < 1 || pos > phaseCount) {
|
|
8630
|
+
console.log(
|
|
8631
|
+
chalk91.red(
|
|
8632
|
+
`Position "${value}" is out of range. Must be between 1 and ${phaseCount}.`
|
|
8633
|
+
)
|
|
8634
|
+
);
|
|
8635
|
+
process.exitCode = 1;
|
|
8636
|
+
return void 0;
|
|
8637
|
+
}
|
|
8638
|
+
return pos - 1;
|
|
8639
|
+
}
|
|
8640
|
+
async function movePhase(id2, from, to) {
|
|
8641
|
+
const found = await findOneItem(id2);
|
|
8642
|
+
if (!found) return;
|
|
8643
|
+
const { orm, item } = found;
|
|
8644
|
+
const itemId = item.id;
|
|
8645
|
+
const [row] = await orm.select({ cnt: count6() }).from(planPhases).where(eq28(planPhases.itemId, itemId));
|
|
8646
|
+
const phaseCount = row?.cnt ?? 0;
|
|
8647
|
+
const fromIdx = toIndex(from, phaseCount);
|
|
8648
|
+
if (fromIdx === void 0) return;
|
|
8649
|
+
const toIdx = toIndex(to, phaseCount);
|
|
8650
|
+
if (toIdx === void 0) return;
|
|
8651
|
+
if (fromIdx !== toIdx) {
|
|
8652
|
+
await reorderPhaseRows(orm, itemId, fromIdx, toIdx);
|
|
8653
|
+
}
|
|
8654
|
+
console.log(chalk91.green(`Moved phase ${from} to position ${to}.`));
|
|
8655
|
+
}
|
|
8656
|
+
|
|
8657
|
+
// src/commands/backlog/updatePhase.ts
|
|
8658
|
+
import chalk93 from "chalk";
|
|
8659
|
+
|
|
8660
|
+
// src/commands/backlog/applyPhaseUpdate.ts
|
|
8661
|
+
import { and as and11, eq as eq29 } from "drizzle-orm";
|
|
8662
|
+
async function applyPhaseUpdate(orm, itemId, phaseIdx, fields) {
|
|
8663
|
+
await orm.transaction(async (tx) => {
|
|
8664
|
+
if (fields.name) {
|
|
8665
|
+
await tx.update(planPhases).set({ name: fields.name }).where(
|
|
8666
|
+
and11(eq29(planPhases.itemId, itemId), eq29(planPhases.idx, phaseIdx))
|
|
8667
|
+
);
|
|
8668
|
+
}
|
|
8669
|
+
if (fields.manualCheck) {
|
|
8670
|
+
await tx.update(planPhases).set({ manualChecks: JSON.stringify(fields.manualCheck) }).where(
|
|
8671
|
+
and11(eq29(planPhases.itemId, itemId), eq29(planPhases.idx, phaseIdx))
|
|
8672
|
+
);
|
|
8673
|
+
}
|
|
8674
|
+
if (fields.task) {
|
|
8675
|
+
await tx.delete(planTasks).where(
|
|
8676
|
+
and11(eq29(planTasks.itemId, itemId), eq29(planTasks.phaseIdx, phaseIdx))
|
|
8677
|
+
);
|
|
8678
|
+
if (fields.task.length) {
|
|
8679
|
+
await tx.insert(planTasks).values(
|
|
8680
|
+
fields.task.map((task, i) => ({
|
|
8681
|
+
itemId,
|
|
8682
|
+
phaseIdx,
|
|
8683
|
+
idx: i,
|
|
8684
|
+
task
|
|
8685
|
+
}))
|
|
8686
|
+
);
|
|
8687
|
+
}
|
|
8688
|
+
}
|
|
8689
|
+
});
|
|
8690
|
+
}
|
|
8691
|
+
|
|
8692
|
+
// src/commands/backlog/findPhase.ts
|
|
8693
|
+
import chalk92 from "chalk";
|
|
8694
|
+
import { and as and12, count as count7, eq as eq30 } from "drizzle-orm";
|
|
8695
|
+
async function findPhase(id2, phase) {
|
|
8696
|
+
const found = await findOneItem(id2);
|
|
8697
|
+
if (!found) return void 0;
|
|
8698
|
+
const { orm, item } = found;
|
|
8699
|
+
const itemId = item.id;
|
|
8700
|
+
const phaseIdx = Number.parseInt(phase, 10) - 1;
|
|
8701
|
+
const [row] = await orm.select({ cnt: count7() }).from(planPhases).where(and12(eq30(planPhases.itemId, itemId), eq30(planPhases.idx, phaseIdx)));
|
|
8702
|
+
if (!row || row.cnt === 0) {
|
|
8703
|
+
console.log(
|
|
8704
|
+
chalk92.red(`Phase ${phaseIdx + 1} not found on item #${itemId}.`)
|
|
8705
|
+
);
|
|
8706
|
+
process.exitCode = 1;
|
|
8707
|
+
return void 0;
|
|
8708
|
+
}
|
|
8709
|
+
return { item, orm, itemId, phaseIdx };
|
|
8710
|
+
}
|
|
8634
8711
|
|
|
8635
8712
|
// src/commands/backlog/update/parseListIndex.ts
|
|
8636
8713
|
function parseListIndex(raw, length, label2) {
|
|
@@ -8686,123 +8763,6 @@ function applyListMutations(current, options2, flags) {
|
|
|
8686
8763
|
return { ok: true, items: items2 };
|
|
8687
8764
|
}
|
|
8688
8765
|
|
|
8689
|
-
// src/commands/backlog/update/applyAcMutations.ts
|
|
8690
|
-
function hasAcMutations(options2) {
|
|
8691
|
-
return hasListMutations({
|
|
8692
|
-
add: options2.addAc,
|
|
8693
|
-
edit: options2.editAc,
|
|
8694
|
-
remove: options2.removeAc
|
|
8695
|
-
});
|
|
8696
|
-
}
|
|
8697
|
-
function applyAcMutations(current, options2) {
|
|
8698
|
-
const result = applyListMutations(
|
|
8699
|
-
current,
|
|
8700
|
-
{ add: options2.addAc, edit: options2.editAc, remove: options2.removeAc },
|
|
8701
|
-
{ add: "--add-ac", edit: "--edit-ac", remove: "--remove-ac" }
|
|
8702
|
-
);
|
|
8703
|
-
if (!result.ok) return result;
|
|
8704
|
-
return { ok: true, criteria: result.items };
|
|
8705
|
-
}
|
|
8706
|
-
|
|
8707
|
-
// src/commands/backlog/update/buildUpdateValues.ts
|
|
8708
|
-
import chalk93 from "chalk";
|
|
8709
|
-
function buildUpdateValues(options2) {
|
|
8710
|
-
const { name, desc: desc6, type, ac } = options2;
|
|
8711
|
-
if (!name && !desc6 && !type && !ac) {
|
|
8712
|
-
console.log(chalk93.red("Nothing to update. Provide at least one flag."));
|
|
8713
|
-
process.exitCode = 1;
|
|
8714
|
-
return void 0;
|
|
8715
|
-
}
|
|
8716
|
-
if (type && type !== "story" && type !== "bug") {
|
|
8717
|
-
console.log(chalk93.red('Invalid type. Must be "story" or "bug".'));
|
|
8718
|
-
process.exitCode = 1;
|
|
8719
|
-
return void 0;
|
|
8720
|
-
}
|
|
8721
|
-
const set = {};
|
|
8722
|
-
const fieldNames = [];
|
|
8723
|
-
if (name) {
|
|
8724
|
-
set.name = name;
|
|
8725
|
-
fieldNames.push("name");
|
|
8726
|
-
}
|
|
8727
|
-
if (desc6) {
|
|
8728
|
-
set.description = desc6;
|
|
8729
|
-
fieldNames.push("description");
|
|
8730
|
-
}
|
|
8731
|
-
if (type) {
|
|
8732
|
-
set.type = type;
|
|
8733
|
-
fieldNames.push("type");
|
|
8734
|
-
}
|
|
8735
|
-
if (ac) {
|
|
8736
|
-
set.acceptanceCriteria = JSON.stringify(ac);
|
|
8737
|
-
fieldNames.push("acceptance criteria");
|
|
8738
|
-
}
|
|
8739
|
-
return { set, fields: fieldNames.join(", ") };
|
|
8740
|
-
}
|
|
8741
|
-
|
|
8742
|
-
// src/commands/backlog/update/index.ts
|
|
8743
|
-
async function update(id2, options2) {
|
|
8744
|
-
const found = await findOneItem(id2);
|
|
8745
|
-
if (!found) return;
|
|
8746
|
-
let ac = options2.ac;
|
|
8747
|
-
if (hasAcMutations(options2)) {
|
|
8748
|
-
if (options2.ac) {
|
|
8749
|
-
console.log(
|
|
8750
|
-
chalk94.red("Cannot combine --ac with --add-ac/--edit-ac/--remove-ac.")
|
|
8751
|
-
);
|
|
8752
|
-
process.exitCode = 1;
|
|
8753
|
-
return;
|
|
8754
|
-
}
|
|
8755
|
-
const mutation = applyAcMutations(found.item.acceptanceCriteria, options2);
|
|
8756
|
-
if (!mutation.ok) {
|
|
8757
|
-
console.log(chalk94.red(mutation.error));
|
|
8758
|
-
process.exitCode = 1;
|
|
8759
|
-
return;
|
|
8760
|
-
}
|
|
8761
|
-
ac = mutation.criteria;
|
|
8762
|
-
}
|
|
8763
|
-
const built = buildUpdateValues({ ...options2, ac });
|
|
8764
|
-
if (!built) return;
|
|
8765
|
-
const { orm } = found;
|
|
8766
|
-
const itemId = found.item.id;
|
|
8767
|
-
await orm.update(items).set(built.set).where(eq29(items.id, itemId));
|
|
8768
|
-
console.log(chalk94.green(`Updated ${built.fields} on item #${itemId}.`));
|
|
8769
|
-
}
|
|
8770
|
-
|
|
8771
|
-
// src/commands/backlog/updatePhase.ts
|
|
8772
|
-
import chalk95 from "chalk";
|
|
8773
|
-
|
|
8774
|
-
// src/commands/backlog/applyPhaseUpdate.ts
|
|
8775
|
-
import { and as and12, eq as eq30 } from "drizzle-orm";
|
|
8776
|
-
async function applyPhaseUpdate(orm, itemId, phaseIdx, fields) {
|
|
8777
|
-
await orm.transaction(async (tx) => {
|
|
8778
|
-
if (fields.name) {
|
|
8779
|
-
await tx.update(planPhases).set({ name: fields.name }).where(
|
|
8780
|
-
and12(eq30(planPhases.itemId, itemId), eq30(planPhases.idx, phaseIdx))
|
|
8781
|
-
);
|
|
8782
|
-
}
|
|
8783
|
-
if (fields.manualCheck) {
|
|
8784
|
-
await tx.update(planPhases).set({ manualChecks: JSON.stringify(fields.manualCheck) }).where(
|
|
8785
|
-
and12(eq30(planPhases.itemId, itemId), eq30(planPhases.idx, phaseIdx))
|
|
8786
|
-
);
|
|
8787
|
-
}
|
|
8788
|
-
if (fields.task) {
|
|
8789
|
-
await tx.delete(planTasks).where(
|
|
8790
|
-
and12(eq30(planTasks.itemId, itemId), eq30(planTasks.phaseIdx, phaseIdx))
|
|
8791
|
-
);
|
|
8792
|
-
if (fields.task.length) {
|
|
8793
|
-
await tx.insert(planTasks).values(
|
|
8794
|
-
fields.task.map((task, i) => ({
|
|
8795
|
-
itemId,
|
|
8796
|
-
phaseIdx,
|
|
8797
|
-
idx: i,
|
|
8798
|
-
task
|
|
8799
|
-
}))
|
|
8800
|
-
);
|
|
8801
|
-
}
|
|
8802
|
-
}
|
|
8803
|
-
});
|
|
8804
|
-
}
|
|
8805
|
-
|
|
8806
8766
|
// src/commands/backlog/update/resolveListUpdate.ts
|
|
8807
8767
|
function resolveListUpdate(whole, current, mutations, wholeFlag, flags) {
|
|
8808
8768
|
if (!hasListMutations(mutations)) return { ok: true, items: whole };
|
|
@@ -8870,51 +8830,168 @@ function resolvePhaseFields(options2, current) {
|
|
|
8870
8830
|
async function updatePhase(id2, phase, options2) {
|
|
8871
8831
|
const found = await findPhase(id2, phase);
|
|
8872
8832
|
if (!found) return;
|
|
8873
|
-
const { item, orm, itemId, phaseIdx } = found;
|
|
8874
|
-
const resolved = resolvePhaseFields(options2, item.plan?.[phaseIdx]);
|
|
8875
|
-
if (!resolved.ok) {
|
|
8876
|
-
console.log(
|
|
8877
|
-
process.exitCode = 1;
|
|
8878
|
-
return;
|
|
8833
|
+
const { item, orm, itemId, phaseIdx } = found;
|
|
8834
|
+
const resolved = resolvePhaseFields(options2, item.plan?.[phaseIdx]);
|
|
8835
|
+
if (!resolved.ok) {
|
|
8836
|
+
console.log(chalk93.red(resolved.error));
|
|
8837
|
+
process.exitCode = 1;
|
|
8838
|
+
return;
|
|
8839
|
+
}
|
|
8840
|
+
const { name, task, manualCheck } = resolved.fields;
|
|
8841
|
+
await applyPhaseUpdate(orm, itemId, phaseIdx, { name, task, manualCheck });
|
|
8842
|
+
const fields = [
|
|
8843
|
+
name && "name",
|
|
8844
|
+
task && "tasks",
|
|
8845
|
+
manualCheck && "manual checks"
|
|
8846
|
+
].filter(Boolean).join(", ");
|
|
8847
|
+
console.log(
|
|
8848
|
+
chalk93.green(
|
|
8849
|
+
`Updated ${fields} on phase ${phaseIdx + 1} of item #${itemId}.`
|
|
8850
|
+
)
|
|
8851
|
+
);
|
|
8852
|
+
}
|
|
8853
|
+
|
|
8854
|
+
// src/commands/backlog/registerUpdatePhaseCommand.ts
|
|
8855
|
+
function collect(value, previous) {
|
|
8856
|
+
return [...previous, value];
|
|
8857
|
+
}
|
|
8858
|
+
function registerUpdatePhaseCommand(cmd) {
|
|
8859
|
+
cmd.command("update-phase <id> <phase>").description("Modify a plan phase on a backlog item").option("--name <name>", "New phase name").option("--task <task...>", "Replace tasks (repeatable)").option("--manual-check <check...>", "Replace manual checks (repeatable)").option("--add-task <text>", "Append one task (repeatable)", collect, []).option("--edit-task <n> <text...>", "Replace task n (1-based) in place").option("--remove-task <n>", "Remove task n (1-based)").option(
|
|
8860
|
+
"--add-check <text>",
|
|
8861
|
+
"Append one manual check (repeatable)",
|
|
8862
|
+
collect,
|
|
8863
|
+
[]
|
|
8864
|
+
).option(
|
|
8865
|
+
"--edit-check <n> <text...>",
|
|
8866
|
+
"Replace manual check n (1-based) in place"
|
|
8867
|
+
).option("--remove-check <n>", "Remove manual check n (1-based)").action(updatePhase);
|
|
8868
|
+
}
|
|
8869
|
+
|
|
8870
|
+
// src/commands/backlog/removePhase.ts
|
|
8871
|
+
import chalk94 from "chalk";
|
|
8872
|
+
import { and as and13, eq as eq31 } from "drizzle-orm";
|
|
8873
|
+
async function removePhase(id2, phase) {
|
|
8874
|
+
const found = await findPhase(id2, phase);
|
|
8875
|
+
if (!found) return;
|
|
8876
|
+
const { item, orm, itemId, phaseIdx } = found;
|
|
8877
|
+
await orm.transaction(async (tx) => {
|
|
8878
|
+
await tx.delete(planTasks).where(
|
|
8879
|
+
and13(eq31(planTasks.itemId, itemId), eq31(planTasks.phaseIdx, phaseIdx))
|
|
8880
|
+
);
|
|
8881
|
+
await tx.delete(planPhases).where(and13(eq31(planPhases.itemId, itemId), eq31(planPhases.idx, phaseIdx)));
|
|
8882
|
+
await reindexPhases(tx, itemId);
|
|
8883
|
+
await adjustCurrentPhase(tx, item, phaseIdx);
|
|
8884
|
+
});
|
|
8885
|
+
console.log(
|
|
8886
|
+
chalk94.green(`Removed phase ${phaseIdx + 1} from item #${itemId}.`)
|
|
8887
|
+
);
|
|
8888
|
+
}
|
|
8889
|
+
|
|
8890
|
+
// src/commands/backlog/update/index.ts
|
|
8891
|
+
import chalk96 from "chalk";
|
|
8892
|
+
import { eq as eq32 } from "drizzle-orm";
|
|
8893
|
+
|
|
8894
|
+
// src/commands/backlog/update/applyAcMutations.ts
|
|
8895
|
+
function hasAcMutations(options2) {
|
|
8896
|
+
return hasListMutations({
|
|
8897
|
+
add: options2.addAc,
|
|
8898
|
+
edit: options2.editAc,
|
|
8899
|
+
remove: options2.removeAc
|
|
8900
|
+
});
|
|
8901
|
+
}
|
|
8902
|
+
function applyAcMutations(current, options2) {
|
|
8903
|
+
const result = applyListMutations(
|
|
8904
|
+
current,
|
|
8905
|
+
{ add: options2.addAc, edit: options2.editAc, remove: options2.removeAc },
|
|
8906
|
+
{ add: "--add-ac", edit: "--edit-ac", remove: "--remove-ac" }
|
|
8907
|
+
);
|
|
8908
|
+
if (!result.ok) return result;
|
|
8909
|
+
return { ok: true, criteria: result.items };
|
|
8910
|
+
}
|
|
8911
|
+
|
|
8912
|
+
// src/commands/backlog/update/buildUpdateValues.ts
|
|
8913
|
+
import chalk95 from "chalk";
|
|
8914
|
+
function buildUpdateValues(options2) {
|
|
8915
|
+
const { name, desc: desc6, type, ac } = options2;
|
|
8916
|
+
if (!name && !desc6 && !type && !ac) {
|
|
8917
|
+
console.log(chalk95.red("Nothing to update. Provide at least one flag."));
|
|
8918
|
+
process.exitCode = 1;
|
|
8919
|
+
return void 0;
|
|
8920
|
+
}
|
|
8921
|
+
if (type && type !== "story" && type !== "bug") {
|
|
8922
|
+
console.log(chalk95.red('Invalid type. Must be "story" or "bug".'));
|
|
8923
|
+
process.exitCode = 1;
|
|
8924
|
+
return void 0;
|
|
8925
|
+
}
|
|
8926
|
+
const set = {};
|
|
8927
|
+
const fieldNames = [];
|
|
8928
|
+
if (name) {
|
|
8929
|
+
set.name = name;
|
|
8930
|
+
fieldNames.push("name");
|
|
8931
|
+
}
|
|
8932
|
+
if (desc6) {
|
|
8933
|
+
set.description = desc6;
|
|
8934
|
+
fieldNames.push("description");
|
|
8935
|
+
}
|
|
8936
|
+
if (type) {
|
|
8937
|
+
set.type = type;
|
|
8938
|
+
fieldNames.push("type");
|
|
8939
|
+
}
|
|
8940
|
+
if (ac) {
|
|
8941
|
+
set.acceptanceCriteria = JSON.stringify(ac);
|
|
8942
|
+
fieldNames.push("acceptance criteria");
|
|
8943
|
+
}
|
|
8944
|
+
return { set, fields: fieldNames.join(", ") };
|
|
8945
|
+
}
|
|
8946
|
+
|
|
8947
|
+
// src/commands/backlog/update/index.ts
|
|
8948
|
+
async function update(id2, options2) {
|
|
8949
|
+
const found = await findOneItem(id2);
|
|
8950
|
+
if (!found) return;
|
|
8951
|
+
let ac = options2.ac;
|
|
8952
|
+
if (hasAcMutations(options2)) {
|
|
8953
|
+
if (options2.ac) {
|
|
8954
|
+
console.log(
|
|
8955
|
+
chalk96.red("Cannot combine --ac with --add-ac/--edit-ac/--remove-ac.")
|
|
8956
|
+
);
|
|
8957
|
+
process.exitCode = 1;
|
|
8958
|
+
return;
|
|
8959
|
+
}
|
|
8960
|
+
const mutation = applyAcMutations(found.item.acceptanceCriteria, options2);
|
|
8961
|
+
if (!mutation.ok) {
|
|
8962
|
+
console.log(chalk96.red(mutation.error));
|
|
8963
|
+
process.exitCode = 1;
|
|
8964
|
+
return;
|
|
8965
|
+
}
|
|
8966
|
+
ac = mutation.criteria;
|
|
8879
8967
|
}
|
|
8880
|
-
const {
|
|
8881
|
-
|
|
8882
|
-
const
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
].filter(Boolean).join(", ");
|
|
8887
|
-
console.log(
|
|
8888
|
-
chalk95.green(
|
|
8889
|
-
`Updated ${fields} on phase ${phaseIdx + 1} of item #${itemId}.`
|
|
8890
|
-
)
|
|
8891
|
-
);
|
|
8968
|
+
const built = buildUpdateValues({ ...options2, ac });
|
|
8969
|
+
if (!built) return;
|
|
8970
|
+
const { orm } = found;
|
|
8971
|
+
const itemId = found.item.id;
|
|
8972
|
+
await orm.update(items).set(built.set).where(eq32(items.id, itemId));
|
|
8973
|
+
console.log(chalk96.green(`Updated ${built.fields} on item #${itemId}.`));
|
|
8892
8974
|
}
|
|
8893
8975
|
|
|
8894
8976
|
// src/commands/backlog/registerUpdateCommands.ts
|
|
8895
|
-
function
|
|
8977
|
+
function collect2(value, previous) {
|
|
8896
8978
|
return [...previous, value];
|
|
8897
8979
|
}
|
|
8898
8980
|
function registerUpdateCommands(cmd) {
|
|
8899
8981
|
cmd.command("update-field <id>").description("Update fields on a backlog item").option("--name <name>", "New item name").option("--desc <description>", "New description").option("--type <type>", "New type (story or bug)").option("--ac <criterion...>", "Replace acceptance criteria (repeatable)").option(
|
|
8900
8982
|
"--add-ac <text>",
|
|
8901
8983
|
"Append one acceptance criterion (repeatable)",
|
|
8902
|
-
|
|
8984
|
+
collect2,
|
|
8903
8985
|
[]
|
|
8904
8986
|
).option(
|
|
8905
8987
|
"--edit-ac <n> <text...>",
|
|
8906
8988
|
"Replace acceptance criterion n (1-based) in place"
|
|
8907
8989
|
).option("--remove-ac <n>", "Remove acceptance criterion n (1-based)").action(update);
|
|
8908
|
-
cmd
|
|
8909
|
-
"--add-check <text>",
|
|
8910
|
-
"Append one manual check (repeatable)",
|
|
8911
|
-
collect,
|
|
8912
|
-
[]
|
|
8913
|
-
).option(
|
|
8914
|
-
"--edit-check <n> <text...>",
|
|
8915
|
-
"Replace manual check n (1-based) in place"
|
|
8916
|
-
).option("--remove-check <n>", "Remove manual check n (1-based)").action(updatePhase);
|
|
8990
|
+
registerUpdatePhaseCommand(cmd);
|
|
8917
8991
|
cmd.command("remove-phase <id> <phase>").description("Remove a plan phase from a backlog item").action(removePhase);
|
|
8992
|
+
cmd.command("move-phase <id> <from> <to>").description(
|
|
8993
|
+
"Reorder a plan phase from one 1-based position to another, moving its tasks with it"
|
|
8994
|
+
).action(movePhase);
|
|
8918
8995
|
}
|
|
8919
8996
|
|
|
8920
8997
|
// src/commands/registerBacklog.ts
|
|
@@ -9734,11 +9811,11 @@ function assertCliExists(cli) {
|
|
|
9734
9811
|
}
|
|
9735
9812
|
|
|
9736
9813
|
// src/commands/permitCliReads/colorize.ts
|
|
9737
|
-
import
|
|
9814
|
+
import chalk97 from "chalk";
|
|
9738
9815
|
function colorize(plainOutput) {
|
|
9739
9816
|
return plainOutput.split("\n").map((line) => {
|
|
9740
|
-
if (line.startsWith(" R ")) return
|
|
9741
|
-
if (line.startsWith(" W ")) return
|
|
9817
|
+
if (line.startsWith(" R ")) return chalk97.green(line);
|
|
9818
|
+
if (line.startsWith(" W ")) return chalk97.red(line);
|
|
9742
9819
|
return line;
|
|
9743
9820
|
}).join("\n");
|
|
9744
9821
|
}
|
|
@@ -10036,7 +10113,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
10036
10113
|
}
|
|
10037
10114
|
|
|
10038
10115
|
// src/commands/deny/denyAdd.ts
|
|
10039
|
-
import
|
|
10116
|
+
import chalk98 from "chalk";
|
|
10040
10117
|
|
|
10041
10118
|
// src/commands/deny/loadDenyConfig.ts
|
|
10042
10119
|
function loadDenyConfig(global) {
|
|
@@ -10056,16 +10133,16 @@ function loadDenyConfig(global) {
|
|
|
10056
10133
|
function denyAdd(pattern2, message, options2) {
|
|
10057
10134
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
10058
10135
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
10059
|
-
console.log(
|
|
10136
|
+
console.log(chalk98.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
10060
10137
|
return;
|
|
10061
10138
|
}
|
|
10062
10139
|
deny.push({ pattern: pattern2, message });
|
|
10063
10140
|
saveDeny(deny);
|
|
10064
|
-
console.log(
|
|
10141
|
+
console.log(chalk98.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
10065
10142
|
}
|
|
10066
10143
|
|
|
10067
10144
|
// src/commands/deny/denyList.ts
|
|
10068
|
-
import
|
|
10145
|
+
import chalk99 from "chalk";
|
|
10069
10146
|
function denyList() {
|
|
10070
10147
|
const globalRaw = loadGlobalConfigRaw();
|
|
10071
10148
|
const projectRaw = loadProjectConfig();
|
|
@@ -10076,7 +10153,7 @@ function denyList() {
|
|
|
10076
10153
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
10077
10154
|
);
|
|
10078
10155
|
if (!merged || merged.length === 0) {
|
|
10079
|
-
console.log(
|
|
10156
|
+
console.log(chalk99.dim("No deny rules configured."));
|
|
10080
10157
|
return;
|
|
10081
10158
|
}
|
|
10082
10159
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -10084,23 +10161,23 @@ function denyList() {
|
|
|
10084
10161
|
for (const rule of merged) {
|
|
10085
10162
|
const inProject = projectPatterns.has(rule.pattern);
|
|
10086
10163
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
10087
|
-
const label2 = inProject && inGlobal ?
|
|
10088
|
-
console.log(`${
|
|
10164
|
+
const label2 = inProject && inGlobal ? chalk99.dim(" (project, overrides global)") : inGlobal ? chalk99.dim(" (global)") : "";
|
|
10165
|
+
console.log(`${chalk99.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
10089
10166
|
}
|
|
10090
10167
|
}
|
|
10091
10168
|
|
|
10092
10169
|
// src/commands/deny/denyRemove.ts
|
|
10093
|
-
import
|
|
10170
|
+
import chalk100 from "chalk";
|
|
10094
10171
|
function denyRemove(pattern2, options2) {
|
|
10095
10172
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
10096
10173
|
const index3 = deny.findIndex((r) => r.pattern === pattern2);
|
|
10097
10174
|
if (index3 === -1) {
|
|
10098
|
-
console.log(
|
|
10175
|
+
console.log(chalk100.yellow(`No deny rule found for: ${pattern2}`));
|
|
10099
10176
|
return;
|
|
10100
10177
|
}
|
|
10101
10178
|
deny.splice(index3, 1);
|
|
10102
10179
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
10103
|
-
console.log(
|
|
10180
|
+
console.log(chalk100.green(`Removed deny rule: ${pattern2}`));
|
|
10104
10181
|
}
|
|
10105
10182
|
|
|
10106
10183
|
// src/commands/registerDeny.ts
|
|
@@ -10130,7 +10207,7 @@ function registerCliHook(program2) {
|
|
|
10130
10207
|
|
|
10131
10208
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
10132
10209
|
import { existsSync as existsSync29, readFileSync as readFileSync24, unlinkSync as unlinkSync8, writeFileSync as writeFileSync22 } from "fs";
|
|
10133
|
-
import
|
|
10210
|
+
import chalk101 from "chalk";
|
|
10134
10211
|
|
|
10135
10212
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
10136
10213
|
import { homedir as homedir13 } from "os";
|
|
@@ -10183,12 +10260,12 @@ function codeCommentConfirm(pin) {
|
|
|
10183
10260
|
sweepRestrictedDir();
|
|
10184
10261
|
const state = readPinState(pin);
|
|
10185
10262
|
if (!state) {
|
|
10186
|
-
console.error(
|
|
10263
|
+
console.error(chalk101.red(`No pending comment for pin: ${pin}`));
|
|
10187
10264
|
process.exitCode = 1;
|
|
10188
10265
|
return;
|
|
10189
10266
|
}
|
|
10190
10267
|
if (!existsSync29(state.file)) {
|
|
10191
|
-
console.error(
|
|
10268
|
+
console.error(chalk101.red(`Target file no longer exists: ${state.file}`));
|
|
10192
10269
|
process.exitCode = 1;
|
|
10193
10270
|
return;
|
|
10194
10271
|
}
|
|
@@ -10197,7 +10274,7 @@ function codeCommentConfirm(pin) {
|
|
|
10197
10274
|
const index3 = state.line - 1;
|
|
10198
10275
|
if (index3 > lines.length) {
|
|
10199
10276
|
console.error(
|
|
10200
|
-
|
|
10277
|
+
chalk101.red(
|
|
10201
10278
|
`Line ${state.line} is beyond the end of ${state.file} (${lines.length} lines).`
|
|
10202
10279
|
)
|
|
10203
10280
|
);
|
|
@@ -10211,14 +10288,14 @@ function codeCommentConfirm(pin) {
|
|
|
10211
10288
|
writeFileSync22(state.file, lines.join("\n"));
|
|
10212
10289
|
unlinkSync8(getPinStatePath(pin));
|
|
10213
10290
|
console.log(
|
|
10214
|
-
|
|
10291
|
+
chalk101.green(
|
|
10215
10292
|
`Inserted "${marker} ${state.text}" at ${state.file}:${state.line}`
|
|
10216
10293
|
)
|
|
10217
10294
|
);
|
|
10218
10295
|
}
|
|
10219
10296
|
|
|
10220
10297
|
// src/commands/codeComment/codeCommentSet.ts
|
|
10221
|
-
import
|
|
10298
|
+
import chalk102 from "chalk";
|
|
10222
10299
|
|
|
10223
10300
|
// src/commands/codeComment/validateCommentText.ts
|
|
10224
10301
|
var MAX_COMMENT_LENGTH = 50;
|
|
@@ -10269,27 +10346,27 @@ function generatePin() {
|
|
|
10269
10346
|
function codeCommentSet(file, line, text8) {
|
|
10270
10347
|
const lineNumber = Number.parseInt(line, 10);
|
|
10271
10348
|
if (!Number.isInteger(lineNumber) || lineNumber < 1) {
|
|
10272
|
-
console.error(
|
|
10349
|
+
console.error(chalk102.red(`Invalid line number: ${line}`));
|
|
10273
10350
|
process.exitCode = 1;
|
|
10274
10351
|
return;
|
|
10275
10352
|
}
|
|
10276
10353
|
const marker = isYamlFile(file) ? "#" : "//";
|
|
10277
10354
|
const validation = validateCommentText(text8, isYamlFile(file));
|
|
10278
10355
|
if (!validation.ok) {
|
|
10279
|
-
console.error(
|
|
10280
|
-
console.error(
|
|
10356
|
+
console.error(chalk102.red(`Refused: ${validation.reason}`));
|
|
10357
|
+
console.error(chalk102.red("No pin issued."));
|
|
10281
10358
|
process.exitCode = 1;
|
|
10282
10359
|
return;
|
|
10283
10360
|
}
|
|
10284
10361
|
console.error(
|
|
10285
|
-
|
|
10362
|
+
chalk102.yellow.bold(
|
|
10286
10363
|
"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."
|
|
10287
10364
|
)
|
|
10288
10365
|
);
|
|
10289
10366
|
const delivered = issuePin(file, lineNumber, validation.text);
|
|
10290
10367
|
if (!delivered) {
|
|
10291
10368
|
console.error(
|
|
10292
|
-
|
|
10369
|
+
chalk102.red(
|
|
10293
10370
|
"Could not deliver the confirmation pin via notification.\nThe comment cannot be confirmed until the notification channel works."
|
|
10294
10371
|
)
|
|
10295
10372
|
);
|
|
@@ -10299,7 +10376,7 @@ function codeCommentSet(file, line, text8) {
|
|
|
10299
10376
|
console.log(
|
|
10300
10377
|
`A confirmation pin was sent to your desktop notifications.
|
|
10301
10378
|
To insert "${marker} ${validation.text}" at ${file}:${lineNumber}, run:
|
|
10302
|
-
${
|
|
10379
|
+
${chalk102.cyan(" assist code-comment confirm <PIN>")}
|
|
10303
10380
|
using the pin from that notification.`
|
|
10304
10381
|
);
|
|
10305
10382
|
}
|
|
@@ -10319,15 +10396,15 @@ function registerCodeComment(parent) {
|
|
|
10319
10396
|
}
|
|
10320
10397
|
|
|
10321
10398
|
// src/commands/complexity/analyze.ts
|
|
10322
|
-
import
|
|
10399
|
+
import chalk111 from "chalk";
|
|
10323
10400
|
|
|
10324
10401
|
// src/commands/complexity/cyclomatic.ts
|
|
10325
|
-
import
|
|
10402
|
+
import chalk104 from "chalk";
|
|
10326
10403
|
|
|
10327
10404
|
// src/commands/complexity/shared/index.ts
|
|
10328
10405
|
import fs17 from "fs";
|
|
10329
10406
|
import path21 from "path";
|
|
10330
|
-
import
|
|
10407
|
+
import chalk103 from "chalk";
|
|
10331
10408
|
import ts5 from "typescript";
|
|
10332
10409
|
|
|
10333
10410
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -10530,7 +10607,7 @@ function calculateHalstead(node) {
|
|
|
10530
10607
|
// src/commands/complexity/shared/countSloc.ts
|
|
10531
10608
|
function countSloc(content) {
|
|
10532
10609
|
let inMultiLineComment = false;
|
|
10533
|
-
let
|
|
10610
|
+
let count8 = 0;
|
|
10534
10611
|
for (const line of content.split("\n")) {
|
|
10535
10612
|
const trimmed = line.trim();
|
|
10536
10613
|
if (inMultiLineComment) {
|
|
@@ -10538,7 +10615,7 @@ function countSloc(content) {
|
|
|
10538
10615
|
inMultiLineComment = false;
|
|
10539
10616
|
const afterComment = trimmed.substring(trimmed.indexOf("*/") + 2);
|
|
10540
10617
|
if (afterComment.trim().length > 0) {
|
|
10541
|
-
|
|
10618
|
+
count8++;
|
|
10542
10619
|
}
|
|
10543
10620
|
}
|
|
10544
10621
|
continue;
|
|
@@ -10550,7 +10627,7 @@ function countSloc(content) {
|
|
|
10550
10627
|
if (trimmed.includes("*/")) {
|
|
10551
10628
|
const afterComment = trimmed.substring(trimmed.indexOf("*/") + 2);
|
|
10552
10629
|
if (afterComment.trim().length > 0) {
|
|
10553
|
-
|
|
10630
|
+
count8++;
|
|
10554
10631
|
}
|
|
10555
10632
|
} else {
|
|
10556
10633
|
inMultiLineComment = true;
|
|
@@ -10558,10 +10635,10 @@ function countSloc(content) {
|
|
|
10558
10635
|
continue;
|
|
10559
10636
|
}
|
|
10560
10637
|
if (trimmed.length > 0) {
|
|
10561
|
-
|
|
10638
|
+
count8++;
|
|
10562
10639
|
}
|
|
10563
10640
|
}
|
|
10564
|
-
return
|
|
10641
|
+
return count8;
|
|
10565
10642
|
}
|
|
10566
10643
|
|
|
10567
10644
|
// src/commands/complexity/shared/index.ts
|
|
@@ -10578,7 +10655,7 @@ function createSourceFromFile(filePath) {
|
|
|
10578
10655
|
function withSourceFiles(pattern2, callback, extraIgnore = []) {
|
|
10579
10656
|
const files = findSourceFiles2(pattern2, ".", extraIgnore);
|
|
10580
10657
|
if (files.length === 0) {
|
|
10581
|
-
console.log(
|
|
10658
|
+
console.log(chalk103.yellow("No files found matching pattern"));
|
|
10582
10659
|
return void 0;
|
|
10583
10660
|
}
|
|
10584
10661
|
return callback(files);
|
|
@@ -10611,11 +10688,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
10611
10688
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
10612
10689
|
for (const { file, name, complexity } of results) {
|
|
10613
10690
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
10614
|
-
const color = exceedsThreshold ?
|
|
10615
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
10691
|
+
const color = exceedsThreshold ? chalk104.red : chalk104.white;
|
|
10692
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk104.cyan(complexity)}`);
|
|
10616
10693
|
}
|
|
10617
10694
|
console.log(
|
|
10618
|
-
|
|
10695
|
+
chalk104.dim(
|
|
10619
10696
|
`
|
|
10620
10697
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
10621
10698
|
)
|
|
@@ -10627,7 +10704,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
10627
10704
|
}
|
|
10628
10705
|
|
|
10629
10706
|
// src/commands/complexity/halstead.ts
|
|
10630
|
-
import
|
|
10707
|
+
import chalk105 from "chalk";
|
|
10631
10708
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
10632
10709
|
withSourceFiles(pattern2, (files) => {
|
|
10633
10710
|
const results = [];
|
|
@@ -10642,13 +10719,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
10642
10719
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
10643
10720
|
for (const { file, name, metrics } of results) {
|
|
10644
10721
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
10645
|
-
const color = exceedsThreshold ?
|
|
10722
|
+
const color = exceedsThreshold ? chalk105.red : chalk105.white;
|
|
10646
10723
|
console.log(
|
|
10647
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
10724
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk105.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk105.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk105.magenta(metrics.effort.toFixed(1))}`
|
|
10648
10725
|
);
|
|
10649
10726
|
}
|
|
10650
10727
|
console.log(
|
|
10651
|
-
|
|
10728
|
+
chalk105.dim(
|
|
10652
10729
|
`
|
|
10653
10730
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
10654
10731
|
)
|
|
@@ -10660,27 +10737,27 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
10660
10737
|
}
|
|
10661
10738
|
|
|
10662
10739
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
10663
|
-
import
|
|
10740
|
+
import chalk108 from "chalk";
|
|
10664
10741
|
|
|
10665
10742
|
// src/commands/complexity/maintainability/formatResultLine.ts
|
|
10666
|
-
import
|
|
10743
|
+
import chalk106 from "chalk";
|
|
10667
10744
|
function formatResultLine(entry, failing) {
|
|
10668
10745
|
const { file, avgMaintainability, minMaintainability, override } = entry;
|
|
10669
|
-
const name = failing ?
|
|
10670
|
-
const suffix = override !== void 0 ?
|
|
10671
|
-
return `${name} \u2192 avg: ${
|
|
10746
|
+
const name = failing ? chalk106.red(file) : chalk106.white(file);
|
|
10747
|
+
const suffix = override !== void 0 ? chalk106.magenta(` (override: ${override})`) : "";
|
|
10748
|
+
return `${name} \u2192 avg: ${chalk106.cyan(avgMaintainability.toFixed(1))}, min: ${chalk106.yellow(minMaintainability.toFixed(1))}${suffix}`;
|
|
10672
10749
|
}
|
|
10673
10750
|
|
|
10674
10751
|
// src/commands/complexity/maintainability/printMaintainabilityFailure.ts
|
|
10675
|
-
import
|
|
10752
|
+
import chalk107 from "chalk";
|
|
10676
10753
|
function printMaintainabilityFailure(failingCount, threshold) {
|
|
10677
10754
|
const thresholdLabel = threshold !== void 0 ? ` ${threshold}` : "";
|
|
10678
10755
|
console.error(
|
|
10679
|
-
|
|
10756
|
+
chalk107.red(
|
|
10680
10757
|
`
|
|
10681
10758
|
Fail: ${failingCount} file(s) below threshold${thresholdLabel} (files marked "(override: N)" were judged against their own marker). Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
10682
10759
|
|
|
10683
|
-
\u26A0\uFE0F ${
|
|
10760
|
+
\u26A0\uFE0F ${chalk107.bold("Diagnose and fix one file at a time")} \u2014 do not investigate or fix multiple files in parallel.
|
|
10684
10761
|
|
|
10685
10762
|
The score is a property of the whole file, not your diff: any existing logic counts, so the fix is to shrink the file \u2014 not to revert or micro-optimize the lines you just changed. Identify the largest cohesive responsibility (often the biggest function, or a related group of functions) and move it to a new file with 'assist refactor extract'. Run 'assist complexity <file>' for per-function metrics only to locate that responsibility, not to tweak individual lines.`
|
|
10686
10763
|
)
|
|
@@ -10692,7 +10769,7 @@ function displayMaintainabilityResults(results, threshold) {
|
|
|
10692
10769
|
const gating = threshold !== void 0 || results.some((r) => r.override !== void 0);
|
|
10693
10770
|
if (!gating) {
|
|
10694
10771
|
for (const entry of results) console.log(formatResultLine(entry, false));
|
|
10695
|
-
console.log(
|
|
10772
|
+
console.log(chalk108.dim(`
|
|
10696
10773
|
Analyzed ${results.length} files`));
|
|
10697
10774
|
return;
|
|
10698
10775
|
}
|
|
@@ -10701,7 +10778,7 @@ Analyzed ${results.length} files`));
|
|
|
10701
10778
|
return limit !== void 0 && r.minMaintainability < limit;
|
|
10702
10779
|
});
|
|
10703
10780
|
if (failing.length === 0) {
|
|
10704
|
-
console.log(
|
|
10781
|
+
console.log(chalk108.green("All files pass maintainability threshold"));
|
|
10705
10782
|
} else {
|
|
10706
10783
|
for (const entry of failing) console.log(formatResultLine(entry, true));
|
|
10707
10784
|
}
|
|
@@ -10710,7 +10787,7 @@ Analyzed ${results.length} files`));
|
|
|
10710
10787
|
);
|
|
10711
10788
|
for (const entry of passingOverrides)
|
|
10712
10789
|
console.log(formatResultLine(entry, false));
|
|
10713
|
-
console.log(
|
|
10790
|
+
console.log(chalk108.dim(`
|
|
10714
10791
|
Analyzed ${results.length} files`));
|
|
10715
10792
|
if (failing.length > 0) {
|
|
10716
10793
|
printMaintainabilityFailure(failing.length, threshold);
|
|
@@ -10719,10 +10796,10 @@ Analyzed ${results.length} files`));
|
|
|
10719
10796
|
}
|
|
10720
10797
|
|
|
10721
10798
|
// src/commands/complexity/maintainability/printMaintainabilityFormula.ts
|
|
10722
|
-
import
|
|
10799
|
+
import chalk109 from "chalk";
|
|
10723
10800
|
var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
|
|
10724
10801
|
function printMaintainabilityFormula() {
|
|
10725
|
-
console.log(
|
|
10802
|
+
console.log(chalk109.dim(MI_FORMULA));
|
|
10726
10803
|
}
|
|
10727
10804
|
|
|
10728
10805
|
// src/commands/complexity/maintainability/collectFileMetrics.ts
|
|
@@ -10798,7 +10875,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
10798
10875
|
|
|
10799
10876
|
// src/commands/complexity/sloc.ts
|
|
10800
10877
|
import fs19 from "fs";
|
|
10801
|
-
import
|
|
10878
|
+
import chalk110 from "chalk";
|
|
10802
10879
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
10803
10880
|
withSourceFiles(pattern2, (files) => {
|
|
10804
10881
|
const results = [];
|
|
@@ -10814,12 +10891,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
10814
10891
|
results.sort((a, b) => b.lines - a.lines);
|
|
10815
10892
|
for (const { file, lines } of results) {
|
|
10816
10893
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
10817
|
-
const color = exceedsThreshold ?
|
|
10818
|
-
console.log(`${color(file)} \u2192 ${
|
|
10894
|
+
const color = exceedsThreshold ? chalk110.red : chalk110.white;
|
|
10895
|
+
console.log(`${color(file)} \u2192 ${chalk110.cyan(lines)} lines`);
|
|
10819
10896
|
}
|
|
10820
10897
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
10821
10898
|
console.log(
|
|
10822
|
-
|
|
10899
|
+
chalk110.dim(`
|
|
10823
10900
|
Total: ${total} lines across ${files.length} files`)
|
|
10824
10901
|
);
|
|
10825
10902
|
if (hasViolation) {
|
|
@@ -10833,25 +10910,25 @@ async function analyze(pattern2) {
|
|
|
10833
10910
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
10834
10911
|
const files = findSourceFiles2(searchPattern);
|
|
10835
10912
|
if (files.length === 0) {
|
|
10836
|
-
console.log(
|
|
10913
|
+
console.log(chalk111.yellow("No files found matching pattern"));
|
|
10837
10914
|
return;
|
|
10838
10915
|
}
|
|
10839
10916
|
if (files.length === 1) {
|
|
10840
10917
|
const file = files[0];
|
|
10841
|
-
console.log(
|
|
10918
|
+
console.log(chalk111.bold.underline("SLOC"));
|
|
10842
10919
|
await sloc(file);
|
|
10843
10920
|
console.log();
|
|
10844
|
-
console.log(
|
|
10921
|
+
console.log(chalk111.bold.underline("Cyclomatic Complexity"));
|
|
10845
10922
|
await cyclomatic(file);
|
|
10846
10923
|
console.log();
|
|
10847
|
-
console.log(
|
|
10924
|
+
console.log(chalk111.bold.underline("Halstead Metrics"));
|
|
10848
10925
|
await halstead(file);
|
|
10849
10926
|
console.log();
|
|
10850
|
-
console.log(
|
|
10927
|
+
console.log(chalk111.bold.underline("Maintainability Index"));
|
|
10851
10928
|
await maintainability(file);
|
|
10852
10929
|
console.log();
|
|
10853
10930
|
console.log(
|
|
10854
|
-
|
|
10931
|
+
chalk111.dim(
|
|
10855
10932
|
"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."
|
|
10856
10933
|
)
|
|
10857
10934
|
);
|
|
@@ -10885,7 +10962,7 @@ function registerComplexity(program2) {
|
|
|
10885
10962
|
}
|
|
10886
10963
|
|
|
10887
10964
|
// src/commands/config/index.ts
|
|
10888
|
-
import
|
|
10965
|
+
import chalk112 from "chalk";
|
|
10889
10966
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
10890
10967
|
|
|
10891
10968
|
// src/commands/config/setNestedValue.ts
|
|
@@ -10948,7 +11025,7 @@ function formatIssuePath(issue, key) {
|
|
|
10948
11025
|
function printValidationErrors(issues, key) {
|
|
10949
11026
|
for (const issue of issues) {
|
|
10950
11027
|
console.error(
|
|
10951
|
-
|
|
11028
|
+
chalk112.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
10952
11029
|
);
|
|
10953
11030
|
}
|
|
10954
11031
|
}
|
|
@@ -10965,7 +11042,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
10965
11042
|
function assertNotGlobalOnly(key, global) {
|
|
10966
11043
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
10967
11044
|
console.error(
|
|
10968
|
-
|
|
11045
|
+
chalk112.red(
|
|
10969
11046
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
10970
11047
|
)
|
|
10971
11048
|
);
|
|
@@ -10988,7 +11065,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
10988
11065
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
10989
11066
|
const target = options2.global ? "global" : "project";
|
|
10990
11067
|
console.log(
|
|
10991
|
-
|
|
11068
|
+
chalk112.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
10992
11069
|
);
|
|
10993
11070
|
}
|
|
10994
11071
|
function configList() {
|
|
@@ -10997,7 +11074,7 @@ function configList() {
|
|
|
10997
11074
|
}
|
|
10998
11075
|
|
|
10999
11076
|
// src/commands/config/configGet.ts
|
|
11000
|
-
import
|
|
11077
|
+
import chalk113 from "chalk";
|
|
11001
11078
|
|
|
11002
11079
|
// src/commands/config/getNestedValue.ts
|
|
11003
11080
|
function isTraversable(value) {
|
|
@@ -11029,7 +11106,7 @@ function requireNestedValue(config, key) {
|
|
|
11029
11106
|
return value;
|
|
11030
11107
|
}
|
|
11031
11108
|
function exitKeyNotSet(key) {
|
|
11032
|
-
console.error(
|
|
11109
|
+
console.error(chalk113.red(`Key "${key}" is not set`));
|
|
11033
11110
|
process.exit(1);
|
|
11034
11111
|
}
|
|
11035
11112
|
|
|
@@ -11043,7 +11120,7 @@ function registerConfig(program2) {
|
|
|
11043
11120
|
|
|
11044
11121
|
// src/commands/deploy/redirect.ts
|
|
11045
11122
|
import { existsSync as existsSync30, readFileSync as readFileSync25, writeFileSync as writeFileSync24 } from "fs";
|
|
11046
|
-
import
|
|
11123
|
+
import chalk114 from "chalk";
|
|
11047
11124
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
11048
11125
|
if (!window.location.pathname.endsWith('/')) {
|
|
11049
11126
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -11052,23 +11129,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
11052
11129
|
function redirect() {
|
|
11053
11130
|
const indexPath = "index.html";
|
|
11054
11131
|
if (!existsSync30(indexPath)) {
|
|
11055
|
-
console.log(
|
|
11132
|
+
console.log(chalk114.yellow("No index.html found"));
|
|
11056
11133
|
return;
|
|
11057
11134
|
}
|
|
11058
11135
|
const content = readFileSync25(indexPath, "utf8");
|
|
11059
11136
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
11060
|
-
console.log(
|
|
11137
|
+
console.log(chalk114.dim("Trailing slash script already present"));
|
|
11061
11138
|
return;
|
|
11062
11139
|
}
|
|
11063
11140
|
const headCloseIndex = content.indexOf("</head>");
|
|
11064
11141
|
if (headCloseIndex === -1) {
|
|
11065
|
-
console.log(
|
|
11142
|
+
console.log(chalk114.red("Could not find </head> tag in index.html"));
|
|
11066
11143
|
return;
|
|
11067
11144
|
}
|
|
11068
11145
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
11069
11146
|
${content.slice(headCloseIndex)}`;
|
|
11070
11147
|
writeFileSync24(indexPath, newContent);
|
|
11071
|
-
console.log(
|
|
11148
|
+
console.log(chalk114.green("Added trailing slash redirect to index.html"));
|
|
11072
11149
|
}
|
|
11073
11150
|
|
|
11074
11151
|
// src/commands/registerDeploy.ts
|
|
@@ -11095,7 +11172,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
11095
11172
|
|
|
11096
11173
|
// src/commands/devlog/shared.ts
|
|
11097
11174
|
import { execSync as execSync26 } from "child_process";
|
|
11098
|
-
import
|
|
11175
|
+
import chalk115 from "chalk";
|
|
11099
11176
|
|
|
11100
11177
|
// src/shared/getRepoName.ts
|
|
11101
11178
|
import { existsSync as existsSync31, readFileSync as readFileSync26 } from "fs";
|
|
@@ -11204,13 +11281,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
11204
11281
|
}
|
|
11205
11282
|
function printCommitsWithFiles(commits2, ignore2, verbose) {
|
|
11206
11283
|
for (const commit2 of commits2) {
|
|
11207
|
-
console.log(` ${
|
|
11284
|
+
console.log(` ${chalk115.yellow(commit2.hash)} ${commit2.message}`);
|
|
11208
11285
|
if (verbose) {
|
|
11209
11286
|
const visibleFiles = commit2.files.filter(
|
|
11210
11287
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
11211
11288
|
);
|
|
11212
11289
|
for (const file of visibleFiles) {
|
|
11213
|
-
console.log(` ${
|
|
11290
|
+
console.log(` ${chalk115.dim(file)}`);
|
|
11214
11291
|
}
|
|
11215
11292
|
}
|
|
11216
11293
|
}
|
|
@@ -11235,15 +11312,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
11235
11312
|
}
|
|
11236
11313
|
|
|
11237
11314
|
// src/commands/devlog/list/printDateHeader.ts
|
|
11238
|
-
import
|
|
11315
|
+
import chalk116 from "chalk";
|
|
11239
11316
|
function printDateHeader(date, isSkipped, entries) {
|
|
11240
11317
|
if (isSkipped) {
|
|
11241
|
-
console.log(`${
|
|
11318
|
+
console.log(`${chalk116.bold.blue(date)} ${chalk116.dim("skipped")}`);
|
|
11242
11319
|
} else if (entries && entries.length > 0) {
|
|
11243
|
-
const entryInfo = entries.map((e) => `${
|
|
11244
|
-
console.log(`${
|
|
11320
|
+
const entryInfo = entries.map((e) => `${chalk116.green(e.version)} ${e.title}`).join(" | ");
|
|
11321
|
+
console.log(`${chalk116.bold.blue(date)} ${entryInfo}`);
|
|
11245
11322
|
} else {
|
|
11246
|
-
console.log(`${
|
|
11323
|
+
console.log(`${chalk116.bold.blue(date)} ${chalk116.red("\u26A0 devlog missing")}`);
|
|
11247
11324
|
}
|
|
11248
11325
|
}
|
|
11249
11326
|
|
|
@@ -11347,24 +11424,24 @@ function bumpVersion(version2, type) {
|
|
|
11347
11424
|
|
|
11348
11425
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
11349
11426
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
11350
|
-
import
|
|
11427
|
+
import chalk118 from "chalk";
|
|
11351
11428
|
|
|
11352
11429
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
11353
|
-
import
|
|
11430
|
+
import chalk117 from "chalk";
|
|
11354
11431
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
11355
11432
|
if (conventional && firstHash) {
|
|
11356
11433
|
const version2 = getVersionAtCommit(firstHash);
|
|
11357
11434
|
if (version2) {
|
|
11358
|
-
console.log(`${
|
|
11435
|
+
console.log(`${chalk117.bold("version:")} ${stripToMinor(version2)}`);
|
|
11359
11436
|
} else {
|
|
11360
|
-
console.log(`${
|
|
11437
|
+
console.log(`${chalk117.bold("version:")} ${chalk117.red("unknown")}`);
|
|
11361
11438
|
}
|
|
11362
11439
|
} else if (patchVersion && minorVersion) {
|
|
11363
11440
|
console.log(
|
|
11364
|
-
`${
|
|
11441
|
+
`${chalk117.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
11365
11442
|
);
|
|
11366
11443
|
} else {
|
|
11367
|
-
console.log(`${
|
|
11444
|
+
console.log(`${chalk117.bold("version:")} v0.1 (initial)`);
|
|
11368
11445
|
}
|
|
11369
11446
|
}
|
|
11370
11447
|
|
|
@@ -11412,16 +11489,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
11412
11489
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
11413
11490
|
}
|
|
11414
11491
|
function logName(repoName) {
|
|
11415
|
-
console.log(`${
|
|
11492
|
+
console.log(`${chalk118.bold("name:")} ${repoName}`);
|
|
11416
11493
|
}
|
|
11417
11494
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
11418
11495
|
logName(ctx.repoName);
|
|
11419
11496
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
11420
|
-
console.log(
|
|
11497
|
+
console.log(chalk118.bold.blue(targetDate));
|
|
11421
11498
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
11422
11499
|
}
|
|
11423
11500
|
function logNoCommits(lastInfo) {
|
|
11424
|
-
console.log(
|
|
11501
|
+
console.log(chalk118.dim(noCommitsMessage(!!lastInfo)));
|
|
11425
11502
|
}
|
|
11426
11503
|
|
|
11427
11504
|
// src/commands/devlog/next/index.ts
|
|
@@ -11462,11 +11539,11 @@ function next2(options2) {
|
|
|
11462
11539
|
import { execSync as execSync28 } from "child_process";
|
|
11463
11540
|
|
|
11464
11541
|
// src/commands/devlog/repos/printReposTable.ts
|
|
11465
|
-
import
|
|
11542
|
+
import chalk119 from "chalk";
|
|
11466
11543
|
function colorStatus(status2) {
|
|
11467
|
-
if (status2 === "missing") return
|
|
11468
|
-
if (status2 === "outdated") return
|
|
11469
|
-
return
|
|
11544
|
+
if (status2 === "missing") return chalk119.red(status2);
|
|
11545
|
+
if (status2 === "outdated") return chalk119.yellow(status2);
|
|
11546
|
+
return chalk119.green(status2);
|
|
11470
11547
|
}
|
|
11471
11548
|
function formatRow(row, nameWidth) {
|
|
11472
11549
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -11480,8 +11557,8 @@ function printReposTable(rows) {
|
|
|
11480
11557
|
"Last Devlog".padEnd(11),
|
|
11481
11558
|
"Status"
|
|
11482
11559
|
].join(" ");
|
|
11483
|
-
console.log(
|
|
11484
|
-
console.log(
|
|
11560
|
+
console.log(chalk119.dim(header));
|
|
11561
|
+
console.log(chalk119.dim("-".repeat(header.length)));
|
|
11485
11562
|
for (const row of rows) {
|
|
11486
11563
|
console.log(formatRow(row, nameWidth));
|
|
11487
11564
|
}
|
|
@@ -11539,14 +11616,14 @@ function repos(options2) {
|
|
|
11539
11616
|
// src/commands/devlog/skip.ts
|
|
11540
11617
|
import { writeFileSync as writeFileSync25 } from "fs";
|
|
11541
11618
|
import { join as join32 } from "path";
|
|
11542
|
-
import
|
|
11619
|
+
import chalk120 from "chalk";
|
|
11543
11620
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
11544
11621
|
function getBlogConfigPath() {
|
|
11545
11622
|
return join32(BLOG_REPO_ROOT, "assist.yml");
|
|
11546
11623
|
}
|
|
11547
11624
|
function skip(date) {
|
|
11548
11625
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
11549
|
-
console.log(
|
|
11626
|
+
console.log(chalk120.red("Invalid date format. Use YYYY-MM-DD"));
|
|
11550
11627
|
process.exit(1);
|
|
11551
11628
|
}
|
|
11552
11629
|
const repoName = getRepoName();
|
|
@@ -11557,7 +11634,7 @@ function skip(date) {
|
|
|
11557
11634
|
const skipDays = skip2[repoName] ?? [];
|
|
11558
11635
|
if (skipDays.includes(date)) {
|
|
11559
11636
|
console.log(
|
|
11560
|
-
|
|
11637
|
+
chalk120.yellow(`${date} is already in skip list for ${repoName}`)
|
|
11561
11638
|
);
|
|
11562
11639
|
return;
|
|
11563
11640
|
}
|
|
@@ -11567,20 +11644,20 @@ function skip(date) {
|
|
|
11567
11644
|
devlog.skip = skip2;
|
|
11568
11645
|
config.devlog = devlog;
|
|
11569
11646
|
writeFileSync25(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
11570
|
-
console.log(
|
|
11647
|
+
console.log(chalk120.green(`Added ${date} to skip list for ${repoName}`));
|
|
11571
11648
|
}
|
|
11572
11649
|
|
|
11573
11650
|
// src/commands/devlog/version.ts
|
|
11574
|
-
import
|
|
11651
|
+
import chalk121 from "chalk";
|
|
11575
11652
|
function version() {
|
|
11576
11653
|
const config = loadConfig();
|
|
11577
11654
|
const name = getRepoName();
|
|
11578
11655
|
const lastInfo = getLastVersionInfo(name, config);
|
|
11579
11656
|
const lastVersion = lastInfo?.version ?? null;
|
|
11580
11657
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
11581
|
-
console.log(`${
|
|
11582
|
-
console.log(`${
|
|
11583
|
-
console.log(`${
|
|
11658
|
+
console.log(`${chalk121.bold("name:")} ${name}`);
|
|
11659
|
+
console.log(`${chalk121.bold("last:")} ${lastVersion ?? chalk121.dim("none")}`);
|
|
11660
|
+
console.log(`${chalk121.bold("next:")} ${nextVersion ?? chalk121.dim("none")}`);
|
|
11584
11661
|
}
|
|
11585
11662
|
|
|
11586
11663
|
// src/commands/registerDevlog.ts
|
|
@@ -11604,7 +11681,7 @@ function registerDevlog(program2) {
|
|
|
11604
11681
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
11605
11682
|
import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync4 } from "fs";
|
|
11606
11683
|
import { join as join33 } from "path";
|
|
11607
|
-
import
|
|
11684
|
+
import chalk122 from "chalk";
|
|
11608
11685
|
|
|
11609
11686
|
// src/shared/findRepoRoot.ts
|
|
11610
11687
|
import { existsSync as existsSync32 } from "fs";
|
|
@@ -11667,14 +11744,14 @@ function checkBuildLocks(startDir) {
|
|
|
11667
11744
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
11668
11745
|
if (locked) {
|
|
11669
11746
|
console.error(
|
|
11670
|
-
|
|
11747
|
+
chalk122.red("Build output locked (is VS debugging?): ") + locked
|
|
11671
11748
|
);
|
|
11672
11749
|
process.exit(1);
|
|
11673
11750
|
}
|
|
11674
11751
|
}
|
|
11675
11752
|
async function checkBuildLocksCommand() {
|
|
11676
11753
|
checkBuildLocks();
|
|
11677
|
-
console.log(
|
|
11754
|
+
console.log(chalk122.green("No build locks detected"));
|
|
11678
11755
|
}
|
|
11679
11756
|
|
|
11680
11757
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -11773,30 +11850,30 @@ function escapeRegex(s) {
|
|
|
11773
11850
|
}
|
|
11774
11851
|
|
|
11775
11852
|
// src/commands/dotnet/printTree.ts
|
|
11776
|
-
import
|
|
11853
|
+
import chalk123 from "chalk";
|
|
11777
11854
|
function printNodes(nodes, prefix2) {
|
|
11778
11855
|
for (let i = 0; i < nodes.length; i++) {
|
|
11779
11856
|
const isLast = i === nodes.length - 1;
|
|
11780
11857
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
11781
11858
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
11782
11859
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
11783
|
-
const label2 = isMissing ?
|
|
11860
|
+
const label2 = isMissing ? chalk123.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
11784
11861
|
console.log(`${prefix2}${connector}${label2}`);
|
|
11785
11862
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
11786
11863
|
}
|
|
11787
11864
|
}
|
|
11788
11865
|
function printTree(tree, totalCount, solutions) {
|
|
11789
|
-
console.log(
|
|
11790
|
-
console.log(
|
|
11866
|
+
console.log(chalk123.bold("\nProject Dependency Tree"));
|
|
11867
|
+
console.log(chalk123.cyan(tree.relativePath));
|
|
11791
11868
|
printNodes(tree.children, "");
|
|
11792
|
-
console.log(
|
|
11869
|
+
console.log(chalk123.dim(`
|
|
11793
11870
|
${totalCount} projects total (including root)`));
|
|
11794
|
-
console.log(
|
|
11871
|
+
console.log(chalk123.bold("\nSolution Membership"));
|
|
11795
11872
|
if (solutions.length === 0) {
|
|
11796
|
-
console.log(
|
|
11873
|
+
console.log(chalk123.yellow(" Not found in any .sln"));
|
|
11797
11874
|
} else {
|
|
11798
11875
|
for (const sln of solutions) {
|
|
11799
|
-
console.log(` ${
|
|
11876
|
+
console.log(` ${chalk123.green(sln)}`);
|
|
11800
11877
|
}
|
|
11801
11878
|
}
|
|
11802
11879
|
console.log();
|
|
@@ -11825,16 +11902,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
11825
11902
|
// src/commands/dotnet/resolveCsproj.ts
|
|
11826
11903
|
import { existsSync as existsSync33 } from "fs";
|
|
11827
11904
|
import path25 from "path";
|
|
11828
|
-
import
|
|
11905
|
+
import chalk124 from "chalk";
|
|
11829
11906
|
function resolveCsproj(csprojPath) {
|
|
11830
11907
|
const resolved = path25.resolve(csprojPath);
|
|
11831
11908
|
if (!existsSync33(resolved)) {
|
|
11832
|
-
console.error(
|
|
11909
|
+
console.error(chalk124.red(`File not found: ${resolved}`));
|
|
11833
11910
|
process.exit(1);
|
|
11834
11911
|
}
|
|
11835
11912
|
const repoRoot = findRepoRoot(path25.dirname(resolved));
|
|
11836
11913
|
if (!repoRoot) {
|
|
11837
|
-
console.error(
|
|
11914
|
+
console.error(chalk124.red("Could not find git repository root"));
|
|
11838
11915
|
process.exit(1);
|
|
11839
11916
|
}
|
|
11840
11917
|
return { resolved, repoRoot };
|
|
@@ -11884,12 +11961,12 @@ function getChangedCsFiles(scope) {
|
|
|
11884
11961
|
}
|
|
11885
11962
|
|
|
11886
11963
|
// src/commands/dotnet/inSln.ts
|
|
11887
|
-
import
|
|
11964
|
+
import chalk125 from "chalk";
|
|
11888
11965
|
async function inSln(csprojPath) {
|
|
11889
11966
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
11890
11967
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
11891
11968
|
if (solutions.length === 0) {
|
|
11892
|
-
console.log(
|
|
11969
|
+
console.log(chalk125.yellow("Not found in any .sln file"));
|
|
11893
11970
|
process.exit(1);
|
|
11894
11971
|
}
|
|
11895
11972
|
for (const sln of solutions) {
|
|
@@ -11898,7 +11975,7 @@ async function inSln(csprojPath) {
|
|
|
11898
11975
|
}
|
|
11899
11976
|
|
|
11900
11977
|
// src/commands/dotnet/inspect.ts
|
|
11901
|
-
import
|
|
11978
|
+
import chalk131 from "chalk";
|
|
11902
11979
|
|
|
11903
11980
|
// src/shared/formatElapsed.ts
|
|
11904
11981
|
function formatElapsed(ms) {
|
|
@@ -11910,12 +11987,12 @@ function formatElapsed(ms) {
|
|
|
11910
11987
|
}
|
|
11911
11988
|
|
|
11912
11989
|
// src/commands/dotnet/displayIssues.ts
|
|
11913
|
-
import
|
|
11990
|
+
import chalk126 from "chalk";
|
|
11914
11991
|
var SEVERITY_COLOR = {
|
|
11915
|
-
ERROR:
|
|
11916
|
-
WARNING:
|
|
11917
|
-
SUGGESTION:
|
|
11918
|
-
HINT:
|
|
11992
|
+
ERROR: chalk126.red,
|
|
11993
|
+
WARNING: chalk126.yellow,
|
|
11994
|
+
SUGGESTION: chalk126.cyan,
|
|
11995
|
+
HINT: chalk126.dim
|
|
11919
11996
|
};
|
|
11920
11997
|
function groupByFile(issues) {
|
|
11921
11998
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -11931,15 +12008,15 @@ function groupByFile(issues) {
|
|
|
11931
12008
|
}
|
|
11932
12009
|
function displayIssues(issues) {
|
|
11933
12010
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
11934
|
-
console.log(
|
|
12011
|
+
console.log(chalk126.bold(file));
|
|
11935
12012
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
11936
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
12013
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk126.white;
|
|
11937
12014
|
console.log(
|
|
11938
|
-
` ${
|
|
12015
|
+
` ${chalk126.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
11939
12016
|
);
|
|
11940
12017
|
}
|
|
11941
12018
|
}
|
|
11942
|
-
console.log(
|
|
12019
|
+
console.log(chalk126.dim(`
|
|
11943
12020
|
${issues.length} issue(s) found`));
|
|
11944
12021
|
}
|
|
11945
12022
|
|
|
@@ -11998,12 +12075,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
11998
12075
|
// src/commands/dotnet/resolveSolution.ts
|
|
11999
12076
|
import { existsSync as existsSync34 } from "fs";
|
|
12000
12077
|
import path26 from "path";
|
|
12001
|
-
import
|
|
12078
|
+
import chalk128 from "chalk";
|
|
12002
12079
|
|
|
12003
12080
|
// src/commands/dotnet/findSolution.ts
|
|
12004
12081
|
import { readdirSync as readdirSync6 } from "fs";
|
|
12005
12082
|
import { dirname as dirname20, join as join34 } from "path";
|
|
12006
|
-
import
|
|
12083
|
+
import chalk127 from "chalk";
|
|
12007
12084
|
function findSlnInDir(dir) {
|
|
12008
12085
|
try {
|
|
12009
12086
|
return readdirSync6(dir).filter((f) => f.endsWith(".sln")).map((f) => join34(dir, f));
|
|
@@ -12019,17 +12096,17 @@ function findSolution() {
|
|
|
12019
12096
|
const slnFiles = findSlnInDir(current);
|
|
12020
12097
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
12021
12098
|
if (slnFiles.length > 1) {
|
|
12022
|
-
console.error(
|
|
12099
|
+
console.error(chalk127.red(`Multiple .sln files found in ${current}:`));
|
|
12023
12100
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
12024
12101
|
console.error(
|
|
12025
|
-
|
|
12102
|
+
chalk127.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
12026
12103
|
);
|
|
12027
12104
|
process.exit(1);
|
|
12028
12105
|
}
|
|
12029
12106
|
if (current === ceiling) break;
|
|
12030
12107
|
current = dirname20(current);
|
|
12031
12108
|
}
|
|
12032
|
-
console.error(
|
|
12109
|
+
console.error(chalk127.red("No .sln file found between cwd and repo root"));
|
|
12033
12110
|
process.exit(1);
|
|
12034
12111
|
}
|
|
12035
12112
|
|
|
@@ -12038,7 +12115,7 @@ function resolveSolution(sln) {
|
|
|
12038
12115
|
if (sln) {
|
|
12039
12116
|
const resolved = path26.resolve(sln);
|
|
12040
12117
|
if (!existsSync34(resolved)) {
|
|
12041
|
-
console.error(
|
|
12118
|
+
console.error(chalk128.red(`Solution file not found: ${resolved}`));
|
|
12042
12119
|
process.exit(1);
|
|
12043
12120
|
}
|
|
12044
12121
|
return resolved;
|
|
@@ -12080,14 +12157,14 @@ import { execSync as execSync30 } from "child_process";
|
|
|
12080
12157
|
import { existsSync as existsSync35, readFileSync as readFileSync30, unlinkSync as unlinkSync9 } from "fs";
|
|
12081
12158
|
import { tmpdir as tmpdir3 } from "os";
|
|
12082
12159
|
import path27 from "path";
|
|
12083
|
-
import
|
|
12160
|
+
import chalk129 from "chalk";
|
|
12084
12161
|
function assertJbInstalled() {
|
|
12085
12162
|
try {
|
|
12086
12163
|
execSync30("jb inspectcode --version", { stdio: "pipe" });
|
|
12087
12164
|
} catch {
|
|
12088
|
-
console.error(
|
|
12165
|
+
console.error(chalk129.red("jb is not installed. Install with:"));
|
|
12089
12166
|
console.error(
|
|
12090
|
-
|
|
12167
|
+
chalk129.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
12091
12168
|
);
|
|
12092
12169
|
process.exit(1);
|
|
12093
12170
|
}
|
|
@@ -12105,11 +12182,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
12105
12182
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
12106
12183
|
process.stderr.write(error.stderr);
|
|
12107
12184
|
}
|
|
12108
|
-
console.error(
|
|
12185
|
+
console.error(chalk129.red("jb inspectcode failed"));
|
|
12109
12186
|
process.exit(1);
|
|
12110
12187
|
}
|
|
12111
12188
|
if (!existsSync35(reportPath)) {
|
|
12112
|
-
console.error(
|
|
12189
|
+
console.error(chalk129.red("Report file not generated"));
|
|
12113
12190
|
process.exit(1);
|
|
12114
12191
|
}
|
|
12115
12192
|
const xml = readFileSync30(reportPath, "utf8");
|
|
@@ -12119,7 +12196,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
12119
12196
|
|
|
12120
12197
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
12121
12198
|
import { execSync as execSync31 } from "child_process";
|
|
12122
|
-
import
|
|
12199
|
+
import chalk130 from "chalk";
|
|
12123
12200
|
function resolveMsbuildPath() {
|
|
12124
12201
|
const { run: run4 } = loadConfig();
|
|
12125
12202
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -12131,9 +12208,9 @@ function assertMsbuildInstalled() {
|
|
|
12131
12208
|
try {
|
|
12132
12209
|
execSync31(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
12133
12210
|
} catch {
|
|
12134
|
-
console.error(
|
|
12211
|
+
console.error(chalk130.red(`msbuild not found at: ${msbuild}`));
|
|
12135
12212
|
console.error(
|
|
12136
|
-
|
|
12213
|
+
chalk130.yellow(
|
|
12137
12214
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
12138
12215
|
)
|
|
12139
12216
|
);
|
|
@@ -12180,17 +12257,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
12180
12257
|
// src/commands/dotnet/inspect.ts
|
|
12181
12258
|
function logScope(changedFiles) {
|
|
12182
12259
|
if (changedFiles === null) {
|
|
12183
|
-
console.log(
|
|
12260
|
+
console.log(chalk131.dim("Inspecting full solution..."));
|
|
12184
12261
|
} else {
|
|
12185
12262
|
console.log(
|
|
12186
|
-
|
|
12263
|
+
chalk131.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
12187
12264
|
);
|
|
12188
12265
|
}
|
|
12189
12266
|
}
|
|
12190
12267
|
function reportResults(issues, elapsed) {
|
|
12191
12268
|
if (issues.length > 0) displayIssues(issues);
|
|
12192
|
-
else console.log(
|
|
12193
|
-
console.log(
|
|
12269
|
+
else console.log(chalk131.green("No issues found"));
|
|
12270
|
+
console.log(chalk131.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
12194
12271
|
if (issues.length > 0) process.exit(1);
|
|
12195
12272
|
}
|
|
12196
12273
|
async function inspect(sln, options2) {
|
|
@@ -12201,7 +12278,7 @@ async function inspect(sln, options2) {
|
|
|
12201
12278
|
const scope = parseScope(options2.scope);
|
|
12202
12279
|
const changedFiles = getChangedCsFiles(scope);
|
|
12203
12280
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
12204
|
-
console.log(
|
|
12281
|
+
console.log(chalk131.green("No changed .cs files found"));
|
|
12205
12282
|
return;
|
|
12206
12283
|
}
|
|
12207
12284
|
logScope(changedFiles);
|
|
@@ -12526,25 +12603,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
12526
12603
|
}
|
|
12527
12604
|
|
|
12528
12605
|
// src/commands/github/printCountTable.ts
|
|
12529
|
-
import
|
|
12606
|
+
import chalk132 from "chalk";
|
|
12530
12607
|
function printCountTable(labelHeader, rows) {
|
|
12531
12608
|
const labelWidth = Math.max(
|
|
12532
12609
|
labelHeader.length,
|
|
12533
12610
|
...rows.map((row) => row.label.length)
|
|
12534
12611
|
);
|
|
12535
12612
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
12536
|
-
console.log(
|
|
12537
|
-
console.log(
|
|
12613
|
+
console.log(chalk132.dim(header));
|
|
12614
|
+
console.log(chalk132.dim("-".repeat(header.length)));
|
|
12538
12615
|
for (const row of rows) {
|
|
12539
12616
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
12540
12617
|
}
|
|
12541
12618
|
}
|
|
12542
12619
|
|
|
12543
12620
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
12544
|
-
import
|
|
12621
|
+
import chalk133 from "chalk";
|
|
12545
12622
|
function printRepoAuthorBreakdown(repos2) {
|
|
12546
12623
|
for (const repo of repos2) {
|
|
12547
|
-
console.log(
|
|
12624
|
+
console.log(chalk133.bold(repo.name));
|
|
12548
12625
|
const authorWidth = Math.max(
|
|
12549
12626
|
0,
|
|
12550
12627
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -12641,9 +12718,9 @@ function registerGithub(program2) {
|
|
|
12641
12718
|
}
|
|
12642
12719
|
|
|
12643
12720
|
// src/commands/handover/countPendingHandovers.ts
|
|
12644
|
-
import { and as
|
|
12721
|
+
import { and as and14, eq as eq33, isNull, sql as sql5 } from "drizzle-orm";
|
|
12645
12722
|
async function countPendingHandovers(orm, origin) {
|
|
12646
|
-
const [row] = await orm.select({ count: sql5`count(*)::int` }).from(handovers).where(
|
|
12723
|
+
const [row] = await orm.select({ count: sql5`count(*)::int` }).from(handovers).where(and14(eq33(handovers.origin, origin), isNull(handovers.recalledAt)));
|
|
12647
12724
|
return row?.count ?? 0;
|
|
12648
12725
|
}
|
|
12649
12726
|
|
|
@@ -12758,9 +12835,9 @@ function resolveLoadOptions(options2) {
|
|
|
12758
12835
|
}
|
|
12759
12836
|
|
|
12760
12837
|
// src/commands/handover/load.ts
|
|
12761
|
-
function advisory(
|
|
12762
|
-
const noun =
|
|
12763
|
-
return `${
|
|
12838
|
+
function advisory(count8) {
|
|
12839
|
+
const noun = count8 === 1 ? "handover" : "handovers";
|
|
12840
|
+
return `${count8} unrecalled ${noun} for this repo. Run /recall to load.`;
|
|
12764
12841
|
}
|
|
12765
12842
|
function emit2(message) {
|
|
12766
12843
|
const json = JSON.stringify({
|
|
@@ -12777,19 +12854,19 @@ async function load2(options2 = {}) {
|
|
|
12777
12854
|
const origin = getCurrentOrigin(cwd);
|
|
12778
12855
|
const orm = options2.orm ?? await getDb();
|
|
12779
12856
|
await migrateDiskHandovers(orm, origin, cwd);
|
|
12780
|
-
const
|
|
12781
|
-
if (
|
|
12782
|
-
return emit2(advisory(
|
|
12857
|
+
const count8 = await countPendingHandovers(orm, origin);
|
|
12858
|
+
if (count8 === 0) return null;
|
|
12859
|
+
return emit2(advisory(count8));
|
|
12783
12860
|
}
|
|
12784
12861
|
|
|
12785
12862
|
// src/commands/handover/listPendingHandovers.ts
|
|
12786
|
-
import { and as
|
|
12863
|
+
import { and as and15, desc as desc4, eq as eq34, isNull as isNull2 } from "drizzle-orm";
|
|
12787
12864
|
async function listPendingHandovers(orm, origin) {
|
|
12788
12865
|
return orm.select({
|
|
12789
12866
|
id: handovers.id,
|
|
12790
12867
|
summary: handovers.summary,
|
|
12791
12868
|
createdAt: handovers.createdAt
|
|
12792
|
-
}).from(handovers).where(
|
|
12869
|
+
}).from(handovers).where(and15(eq34(handovers.origin, origin), isNull2(handovers.recalledAt))).orderBy(desc4(handovers.createdAt), desc4(handovers.id));
|
|
12793
12870
|
}
|
|
12794
12871
|
|
|
12795
12872
|
// src/commands/handover/printPendingHandovers.ts
|
|
@@ -12802,17 +12879,17 @@ async function printPendingHandovers() {
|
|
|
12802
12879
|
}
|
|
12803
12880
|
|
|
12804
12881
|
// src/commands/handover/recallHandover.ts
|
|
12805
|
-
import { and as
|
|
12882
|
+
import { and as and16, desc as desc5, eq as eq35, isNull as isNull3 } from "drizzle-orm";
|
|
12806
12883
|
async function recallHandover(orm, origin, id2) {
|
|
12807
12884
|
const [row] = await orm.select().from(handovers).where(
|
|
12808
|
-
|
|
12809
|
-
|
|
12885
|
+
and16(
|
|
12886
|
+
eq35(handovers.origin, origin),
|
|
12810
12887
|
isNull3(handovers.recalledAt),
|
|
12811
|
-
...id2 === void 0 ? [] : [
|
|
12888
|
+
...id2 === void 0 ? [] : [eq35(handovers.id, id2)]
|
|
12812
12889
|
)
|
|
12813
12890
|
).orderBy(desc5(handovers.createdAt), desc5(handovers.id)).limit(1);
|
|
12814
12891
|
if (!row) return void 0;
|
|
12815
|
-
await orm.update(handovers).set({ recalledAt: /* @__PURE__ */ new Date() }).where(
|
|
12892
|
+
await orm.update(handovers).set({ recalledAt: /* @__PURE__ */ new Date() }).where(eq35(handovers.id, row.id));
|
|
12816
12893
|
return row.content;
|
|
12817
12894
|
}
|
|
12818
12895
|
|
|
@@ -12862,7 +12939,7 @@ function registerHandover(program2) {
|
|
|
12862
12939
|
}
|
|
12863
12940
|
|
|
12864
12941
|
// src/commands/jira/acceptanceCriteria.ts
|
|
12865
|
-
import
|
|
12942
|
+
import chalk134 from "chalk";
|
|
12866
12943
|
|
|
12867
12944
|
// src/commands/jira/adfToText.ts
|
|
12868
12945
|
function renderInline(node) {
|
|
@@ -12929,7 +13006,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
12929
13006
|
const parsed = fetchIssue(issueKey, field);
|
|
12930
13007
|
const acValue = parsed?.fields?.[field];
|
|
12931
13008
|
if (!acValue) {
|
|
12932
|
-
console.log(
|
|
13009
|
+
console.log(chalk134.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
12933
13010
|
return;
|
|
12934
13011
|
}
|
|
12935
13012
|
if (typeof acValue === "string") {
|
|
@@ -13024,14 +13101,14 @@ async function jiraAuth() {
|
|
|
13024
13101
|
}
|
|
13025
13102
|
|
|
13026
13103
|
// src/commands/jira/viewIssue.ts
|
|
13027
|
-
import
|
|
13104
|
+
import chalk135 from "chalk";
|
|
13028
13105
|
function viewIssue(issueKey) {
|
|
13029
13106
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
13030
13107
|
const fields = parsed?.fields;
|
|
13031
13108
|
const summary = fields?.summary;
|
|
13032
13109
|
const description = fields?.description;
|
|
13033
13110
|
if (summary) {
|
|
13034
|
-
console.log(
|
|
13111
|
+
console.log(chalk135.bold(summary));
|
|
13035
13112
|
}
|
|
13036
13113
|
if (description) {
|
|
13037
13114
|
if (summary) console.log();
|
|
@@ -13045,7 +13122,7 @@ function viewIssue(issueKey) {
|
|
|
13045
13122
|
}
|
|
13046
13123
|
if (!summary && !description) {
|
|
13047
13124
|
console.log(
|
|
13048
|
-
|
|
13125
|
+
chalk135.yellow(`No summary or description found on ${issueKey}.`)
|
|
13049
13126
|
);
|
|
13050
13127
|
}
|
|
13051
13128
|
}
|
|
@@ -13061,13 +13138,13 @@ function registerJira(program2) {
|
|
|
13061
13138
|
// src/commands/reviewComments.ts
|
|
13062
13139
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
13063
13140
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
13064
|
-
import
|
|
13141
|
+
import chalk136 from "chalk";
|
|
13065
13142
|
async function reviewComments(number) {
|
|
13066
13143
|
if (number) {
|
|
13067
13144
|
try {
|
|
13068
13145
|
execFileSync5("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
13069
13146
|
} catch {
|
|
13070
|
-
console.error(
|
|
13147
|
+
console.error(chalk136.red(`gh pr checkout ${number} failed; aborting.`));
|
|
13071
13148
|
process.exit(1);
|
|
13072
13149
|
}
|
|
13073
13150
|
}
|
|
@@ -13141,15 +13218,15 @@ function registerList(program2) {
|
|
|
13141
13218
|
// src/commands/mermaid/index.ts
|
|
13142
13219
|
import { mkdirSync as mkdirSync14, readdirSync as readdirSync8 } from "fs";
|
|
13143
13220
|
import { resolve as resolve11 } from "path";
|
|
13144
|
-
import
|
|
13221
|
+
import chalk139 from "chalk";
|
|
13145
13222
|
|
|
13146
13223
|
// src/commands/mermaid/exportFile.ts
|
|
13147
13224
|
import { readFileSync as readFileSync33, writeFileSync as writeFileSync28 } from "fs";
|
|
13148
13225
|
import { basename as basename8, extname, resolve as resolve10 } from "path";
|
|
13149
|
-
import
|
|
13226
|
+
import chalk138 from "chalk";
|
|
13150
13227
|
|
|
13151
13228
|
// src/commands/mermaid/renderBlock.ts
|
|
13152
|
-
import
|
|
13229
|
+
import chalk137 from "chalk";
|
|
13153
13230
|
async function renderBlock(krokiUrl, source) {
|
|
13154
13231
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
13155
13232
|
method: "POST",
|
|
@@ -13158,7 +13235,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
13158
13235
|
});
|
|
13159
13236
|
if (!response.ok) {
|
|
13160
13237
|
console.error(
|
|
13161
|
-
|
|
13238
|
+
chalk137.red(
|
|
13162
13239
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
13163
13240
|
)
|
|
13164
13241
|
);
|
|
@@ -13176,19 +13253,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
13176
13253
|
if (onlyIndex !== void 0) {
|
|
13177
13254
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
13178
13255
|
console.error(
|
|
13179
|
-
|
|
13256
|
+
chalk138.red(
|
|
13180
13257
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
13181
13258
|
)
|
|
13182
13259
|
);
|
|
13183
13260
|
process.exit(1);
|
|
13184
13261
|
}
|
|
13185
13262
|
console.log(
|
|
13186
|
-
|
|
13263
|
+
chalk138.gray(
|
|
13187
13264
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
13188
13265
|
)
|
|
13189
13266
|
);
|
|
13190
13267
|
} else {
|
|
13191
|
-
console.log(
|
|
13268
|
+
console.log(chalk138.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
13192
13269
|
}
|
|
13193
13270
|
for (const [i, source] of blocks.entries()) {
|
|
13194
13271
|
const idx = i + 1;
|
|
@@ -13196,7 +13273,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
13196
13273
|
const outPath = resolve10(outDir, `${stem}-${idx}.svg`);
|
|
13197
13274
|
const svg = await renderBlock(krokiUrl, source);
|
|
13198
13275
|
writeFileSync28(outPath, svg, "utf8");
|
|
13199
|
-
console.log(
|
|
13276
|
+
console.log(chalk138.green(` \u2192 ${outPath}`));
|
|
13200
13277
|
}
|
|
13201
13278
|
}
|
|
13202
13279
|
function extractMermaidBlocks(markdown) {
|
|
@@ -13212,18 +13289,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
13212
13289
|
if (options2.index !== void 0) {
|
|
13213
13290
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
13214
13291
|
console.error(
|
|
13215
|
-
|
|
13292
|
+
chalk139.red(`--index must be a positive integer (got ${options2.index})`)
|
|
13216
13293
|
);
|
|
13217
13294
|
process.exit(1);
|
|
13218
13295
|
}
|
|
13219
13296
|
if (!file) {
|
|
13220
|
-
console.error(
|
|
13297
|
+
console.error(chalk139.red("--index requires a file argument"));
|
|
13221
13298
|
process.exit(1);
|
|
13222
13299
|
}
|
|
13223
13300
|
}
|
|
13224
13301
|
const files = file ? [file] : readdirSync8(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
13225
13302
|
if (files.length === 0) {
|
|
13226
|
-
console.log(
|
|
13303
|
+
console.log(chalk139.gray("No markdown files found in current directory."));
|
|
13227
13304
|
return;
|
|
13228
13305
|
}
|
|
13229
13306
|
for (const f of files) {
|
|
@@ -13249,7 +13326,7 @@ function registerMermaid(program2) {
|
|
|
13249
13326
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
13250
13327
|
import { createServer as createServer2 } from "http";
|
|
13251
13328
|
import { dirname as dirname22 } from "path";
|
|
13252
|
-
import
|
|
13329
|
+
import chalk141 from "chalk";
|
|
13253
13330
|
|
|
13254
13331
|
// src/commands/netcap/corsHeaders.ts
|
|
13255
13332
|
var corsHeaders = {
|
|
@@ -13328,7 +13405,7 @@ function createNetcapHandler(options2) {
|
|
|
13328
13405
|
import { cp, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|
|
13329
13406
|
import { networkInterfaces } from "os";
|
|
13330
13407
|
import { join as join41 } from "path";
|
|
13331
|
-
import
|
|
13408
|
+
import chalk140 from "chalk";
|
|
13332
13409
|
|
|
13333
13410
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
13334
13411
|
import { dirname as dirname21, join as join40 } from "path";
|
|
@@ -13372,7 +13449,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
13372
13449
|
const host = lanIPv4();
|
|
13373
13450
|
if (!host) {
|
|
13374
13451
|
console.log(
|
|
13375
|
-
|
|
13452
|
+
chalk140.yellow("could not determine the WSL IP for the extension")
|
|
13376
13453
|
);
|
|
13377
13454
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
13378
13455
|
return source;
|
|
@@ -13383,7 +13460,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
13383
13460
|
return WSL_WINDOWS_PATH;
|
|
13384
13461
|
} catch {
|
|
13385
13462
|
console.log(
|
|
13386
|
-
|
|
13463
|
+
chalk140.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
13387
13464
|
);
|
|
13388
13465
|
return source;
|
|
13389
13466
|
}
|
|
@@ -13413,35 +13490,35 @@ async function netcap(options2) {
|
|
|
13413
13490
|
const filter = options2.filter ?? "";
|
|
13414
13491
|
await mkdir3(dirname22(outPath), { recursive: true });
|
|
13415
13492
|
const extensionPath = await prepareExtensionForLoad(port, filter);
|
|
13416
|
-
let
|
|
13493
|
+
let count8 = 0;
|
|
13417
13494
|
const handler = createNetcapHandler({
|
|
13418
13495
|
outPath,
|
|
13419
|
-
onPing: () => console.log(
|
|
13496
|
+
onPing: () => console.log(chalk141.dim("ping from extension")),
|
|
13420
13497
|
onCapture: (entry) => {
|
|
13421
|
-
|
|
13498
|
+
count8 += 1;
|
|
13422
13499
|
console.log(
|
|
13423
|
-
|
|
13424
|
-
|
|
13500
|
+
chalk141.green(`captured #${count8}`),
|
|
13501
|
+
chalk141.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
13425
13502
|
);
|
|
13426
13503
|
}
|
|
13427
13504
|
});
|
|
13428
13505
|
const server = createServer2(handler);
|
|
13429
13506
|
server.listen(port, () => {
|
|
13430
13507
|
console.log(
|
|
13431
|
-
|
|
13508
|
+
chalk141.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
13432
13509
|
);
|
|
13433
|
-
console.log(
|
|
13510
|
+
console.log(chalk141.dim(`appending captures to ${outPath}`));
|
|
13434
13511
|
if (filter)
|
|
13435
|
-
console.log(
|
|
13436
|
-
console.log(
|
|
13437
|
-
console.log(
|
|
13512
|
+
console.log(chalk141.dim(`forwarding only URLs matching "${filter}"`));
|
|
13513
|
+
console.log(chalk141.dim(`load the unpacked extension from ${extensionPath}`));
|
|
13514
|
+
console.log(chalk141.dim("press Ctrl-C to stop"));
|
|
13438
13515
|
});
|
|
13439
13516
|
process.on("SIGINT", () => {
|
|
13440
13517
|
server.close();
|
|
13441
13518
|
console.log(
|
|
13442
|
-
|
|
13519
|
+
chalk141.bold(
|
|
13443
13520
|
`
|
|
13444
|
-
netcap stopped \u2014 captured ${
|
|
13521
|
+
netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
13445
13522
|
)
|
|
13446
13523
|
);
|
|
13447
13524
|
process.exit(0);
|
|
@@ -13451,7 +13528,7 @@ netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} t
|
|
|
13451
13528
|
// src/commands/netcap/netcapExtract.ts
|
|
13452
13529
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
13453
13530
|
import { join as join44 } from "path";
|
|
13454
|
-
import
|
|
13531
|
+
import chalk142 from "chalk";
|
|
13455
13532
|
|
|
13456
13533
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
13457
13534
|
import { readFileSync as readFileSync34 } from "fs";
|
|
@@ -13899,8 +13976,8 @@ function netcapExtract(file) {
|
|
|
13899
13976
|
writeFileSync29(outFile, `${JSON.stringify(posts, null, 2)}
|
|
13900
13977
|
`);
|
|
13901
13978
|
console.log(
|
|
13902
|
-
|
|
13903
|
-
|
|
13979
|
+
chalk142.green(`extracted ${posts.length} posts`),
|
|
13980
|
+
chalk142.dim(`-> ${outFile}`)
|
|
13904
13981
|
);
|
|
13905
13982
|
}
|
|
13906
13983
|
|
|
@@ -13921,7 +13998,7 @@ function registerNetcap(program2) {
|
|
|
13921
13998
|
}
|
|
13922
13999
|
|
|
13923
14000
|
// src/commands/news/add/index.ts
|
|
13924
|
-
import
|
|
14001
|
+
import chalk143 from "chalk";
|
|
13925
14002
|
import enquirer8 from "enquirer";
|
|
13926
14003
|
async function add2(url) {
|
|
13927
14004
|
if (!url) {
|
|
@@ -13943,10 +14020,10 @@ async function add2(url) {
|
|
|
13943
14020
|
const { orm } = await getReady();
|
|
13944
14021
|
const added = await addFeed(orm, url);
|
|
13945
14022
|
if (!added) {
|
|
13946
|
-
console.log(
|
|
14023
|
+
console.log(chalk143.yellow("Feed already exists"));
|
|
13947
14024
|
return;
|
|
13948
14025
|
}
|
|
13949
|
-
console.log(
|
|
14026
|
+
console.log(chalk143.green(`Added feed: ${url}`));
|
|
13950
14027
|
}
|
|
13951
14028
|
|
|
13952
14029
|
// src/commands/registerNews.ts
|
|
@@ -13956,7 +14033,7 @@ function registerNews(program2) {
|
|
|
13956
14033
|
}
|
|
13957
14034
|
|
|
13958
14035
|
// src/commands/prompts/printPromptsTable.ts
|
|
13959
|
-
import
|
|
14036
|
+
import chalk144 from "chalk";
|
|
13960
14037
|
function truncate(str, max) {
|
|
13961
14038
|
if (str.length <= max) return str;
|
|
13962
14039
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -13974,14 +14051,14 @@ function printPromptsTable(rows) {
|
|
|
13974
14051
|
"Command".padEnd(commandWidth),
|
|
13975
14052
|
"Repos"
|
|
13976
14053
|
].join(" ");
|
|
13977
|
-
console.log(
|
|
13978
|
-
console.log(
|
|
14054
|
+
console.log(chalk144.dim(header));
|
|
14055
|
+
console.log(chalk144.dim("-".repeat(header.length)));
|
|
13979
14056
|
for (const row of rows) {
|
|
13980
|
-
const
|
|
14057
|
+
const count8 = String(row.count).padStart(countWidth);
|
|
13981
14058
|
const tool = row.tool.padEnd(toolWidth);
|
|
13982
14059
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
13983
14060
|
console.log(
|
|
13984
|
-
`${
|
|
14061
|
+
`${chalk144.yellow(count8)} ${tool} ${command} ${chalk144.dim(row.repos)}`
|
|
13985
14062
|
);
|
|
13986
14063
|
}
|
|
13987
14064
|
}
|
|
@@ -14530,20 +14607,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
14530
14607
|
}
|
|
14531
14608
|
|
|
14532
14609
|
// src/commands/prs/listComments/printComments.ts
|
|
14533
|
-
import
|
|
14610
|
+
import chalk145 from "chalk";
|
|
14534
14611
|
function formatForHuman(comment3) {
|
|
14535
14612
|
if (comment3.type === "review") {
|
|
14536
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
14613
|
+
const stateColor = comment3.state === "APPROVED" ? chalk145.green : comment3.state === "CHANGES_REQUESTED" ? chalk145.red : chalk145.yellow;
|
|
14537
14614
|
return [
|
|
14538
|
-
`${
|
|
14615
|
+
`${chalk145.cyan("Review")} by ${chalk145.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
14539
14616
|
comment3.body,
|
|
14540
14617
|
""
|
|
14541
14618
|
].join("\n");
|
|
14542
14619
|
}
|
|
14543
14620
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
14544
14621
|
return [
|
|
14545
|
-
`${
|
|
14546
|
-
|
|
14622
|
+
`${chalk145.cyan("Line comment")} by ${chalk145.bold(comment3.user)} on ${chalk145.dim(`${comment3.path}${location}`)}`,
|
|
14623
|
+
chalk145.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
14547
14624
|
comment3.body,
|
|
14548
14625
|
""
|
|
14549
14626
|
].join("\n");
|
|
@@ -14633,13 +14710,13 @@ import { execSync as execSync40 } from "child_process";
|
|
|
14633
14710
|
import enquirer9 from "enquirer";
|
|
14634
14711
|
|
|
14635
14712
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
14636
|
-
import
|
|
14713
|
+
import chalk146 from "chalk";
|
|
14637
14714
|
var STATUS_MAP = {
|
|
14638
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
14639
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
14715
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk146.magenta("merged"), date: pr.mergedAt } : null,
|
|
14716
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk146.red("closed"), date: pr.closedAt } : null
|
|
14640
14717
|
};
|
|
14641
14718
|
function defaultStatus(pr) {
|
|
14642
|
-
return { label:
|
|
14719
|
+
return { label: chalk146.green("opened"), date: pr.createdAt };
|
|
14643
14720
|
}
|
|
14644
14721
|
function getStatus2(pr) {
|
|
14645
14722
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -14648,11 +14725,11 @@ function formatDate(dateStr) {
|
|
|
14648
14725
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
14649
14726
|
}
|
|
14650
14727
|
function formatPrHeader(pr, status2) {
|
|
14651
|
-
return `${
|
|
14728
|
+
return `${chalk146.cyan(`#${pr.number}`)} ${pr.title} ${chalk146.dim(`(${pr.author.login},`)} ${status2.label} ${chalk146.dim(`${formatDate(status2.date)})`)}`;
|
|
14652
14729
|
}
|
|
14653
14730
|
function logPrDetails(pr) {
|
|
14654
14731
|
console.log(
|
|
14655
|
-
|
|
14732
|
+
chalk146.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
14656
14733
|
);
|
|
14657
14734
|
console.log();
|
|
14658
14735
|
}
|
|
@@ -14708,8 +14785,8 @@ async function promptNavigation(currentPage, totalPages) {
|
|
|
14708
14785
|
});
|
|
14709
14786
|
return parseAction(action);
|
|
14710
14787
|
}
|
|
14711
|
-
function computeTotalPages(
|
|
14712
|
-
return Math.ceil(
|
|
14788
|
+
function computeTotalPages(count8) {
|
|
14789
|
+
return Math.ceil(count8 / PAGE_SIZE);
|
|
14713
14790
|
}
|
|
14714
14791
|
async function navigateAndDisplay(pullRequests, totalPages, currentPage) {
|
|
14715
14792
|
const delta = await promptNavigation(currentPage, totalPages);
|
|
@@ -14894,7 +14971,7 @@ function wontfix(commentId, reason) {
|
|
|
14894
14971
|
}
|
|
14895
14972
|
|
|
14896
14973
|
// src/commands/registerPrsEdit.ts
|
|
14897
|
-
function
|
|
14974
|
+
function collect3(value, previous) {
|
|
14898
14975
|
return previous.concat([value]);
|
|
14899
14976
|
}
|
|
14900
14977
|
function registerPrsEdit(prsCommand) {
|
|
@@ -14903,13 +14980,13 @@ function registerPrsEdit(prsCommand) {
|
|
|
14903
14980
|
).option("-t, --title <title>", "New title for the pull request").option("--what <what>", "Replace the ## What section").option("--why <why>", "Replace the ## Why section").option("--how <how>", "Replace the ## How section").option(
|
|
14904
14981
|
"--resolves <key>",
|
|
14905
14982
|
"Jira issue key resolved by this PR, appended to ## Why (repeatable)",
|
|
14906
|
-
|
|
14983
|
+
collect3,
|
|
14907
14984
|
[]
|
|
14908
14985
|
).action(edit);
|
|
14909
14986
|
}
|
|
14910
14987
|
|
|
14911
14988
|
// src/commands/registerPrsRaise.ts
|
|
14912
|
-
function
|
|
14989
|
+
function collect4(value, previous) {
|
|
14913
14990
|
return previous.concat([value]);
|
|
14914
14991
|
}
|
|
14915
14992
|
function registerPrsRaise(prsCommand) {
|
|
@@ -14918,20 +14995,20 @@ function registerPrsRaise(prsCommand) {
|
|
|
14918
14995
|
).option("-t, --title <title>", "Title for the pull request").option("--what <what>", "What the change does (## What section)").option("--why <why>", "Why the change is needed (## Why section)").option("--how <how>", "How the change works (optional ## How section)").option(
|
|
14919
14996
|
"--resolves <key>",
|
|
14920
14997
|
"Jira issue key resolved by this PR, appended to ## Why (repeatable)",
|
|
14921
|
-
|
|
14998
|
+
collect4,
|
|
14922
14999
|
[]
|
|
14923
15000
|
).option(
|
|
14924
15001
|
"--force",
|
|
14925
15002
|
"Overwrite the title and body of an existing pull request"
|
|
14926
|
-
).option("-B, --base <branch>", "Branch into which the pull request merges").option("-H, --head <branch>", "Branch that contains the commits").option("-d, --draft", "Mark the pull request as a draft").option("-w, --web", "Open the browser to create the pull request").option("-l, --label <label>", "Add a label (repeatable)",
|
|
15003
|
+
).option("-B, --base <branch>", "Branch into which the pull request merges").option("-H, --head <branch>", "Branch that contains the commits").option("-d, --draft", "Mark the pull request as a draft").option("-w, --web", "Open the browser to create the pull request").option("-l, --label <label>", "Add a label (repeatable)", collect4, []).option(
|
|
14927
15004
|
"-a, --assignee <login>",
|
|
14928
15005
|
"Assign a person by login (repeatable)",
|
|
14929
|
-
|
|
15006
|
+
collect4,
|
|
14930
15007
|
[]
|
|
14931
15008
|
).option(
|
|
14932
15009
|
"-r, --reviewer <handle>",
|
|
14933
15010
|
"Request a review (repeatable)",
|
|
14934
|
-
|
|
15011
|
+
collect4,
|
|
14935
15012
|
[]
|
|
14936
15013
|
).option("-m, --milestone <name>", "Add the pull request to a milestone").action(raise);
|
|
14937
15014
|
}
|
|
@@ -14959,10 +15036,10 @@ function registerPrs(program2) {
|
|
|
14959
15036
|
}
|
|
14960
15037
|
|
|
14961
15038
|
// src/commands/ravendb/ravendbAuth.ts
|
|
14962
|
-
import
|
|
15039
|
+
import chalk152 from "chalk";
|
|
14963
15040
|
|
|
14964
15041
|
// src/shared/createConnectionAuth.ts
|
|
14965
|
-
import
|
|
15042
|
+
import chalk147 from "chalk";
|
|
14966
15043
|
function listConnections(connections, format) {
|
|
14967
15044
|
if (connections.length === 0) {
|
|
14968
15045
|
console.log("No connections configured.");
|
|
@@ -14975,7 +15052,7 @@ function listConnections(connections, format) {
|
|
|
14975
15052
|
function removeConnection(connections, name, save) {
|
|
14976
15053
|
const filtered = connections.filter((c) => c.name !== name);
|
|
14977
15054
|
if (filtered.length === connections.length) {
|
|
14978
|
-
console.error(
|
|
15055
|
+
console.error(chalk147.red(`Connection "${name}" not found.`));
|
|
14979
15056
|
process.exit(1);
|
|
14980
15057
|
}
|
|
14981
15058
|
save(filtered);
|
|
@@ -15021,15 +15098,15 @@ function saveConnections(connections) {
|
|
|
15021
15098
|
}
|
|
15022
15099
|
|
|
15023
15100
|
// src/commands/ravendb/promptConnection.ts
|
|
15024
|
-
import
|
|
15101
|
+
import chalk150 from "chalk";
|
|
15025
15102
|
|
|
15026
15103
|
// src/commands/ravendb/selectOpSecret.ts
|
|
15027
|
-
import
|
|
15104
|
+
import chalk149 from "chalk";
|
|
15028
15105
|
import Enquirer2 from "enquirer";
|
|
15029
15106
|
|
|
15030
15107
|
// src/commands/ravendb/searchItems.ts
|
|
15031
15108
|
import { execSync as execSync43 } from "child_process";
|
|
15032
|
-
import
|
|
15109
|
+
import chalk148 from "chalk";
|
|
15033
15110
|
function opExec(args) {
|
|
15034
15111
|
return execSync43(`op ${args}`, {
|
|
15035
15112
|
encoding: "utf8",
|
|
@@ -15042,7 +15119,7 @@ function searchItems(search2) {
|
|
|
15042
15119
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
15043
15120
|
} catch {
|
|
15044
15121
|
console.error(
|
|
15045
|
-
|
|
15122
|
+
chalk148.red(
|
|
15046
15123
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
15047
15124
|
)
|
|
15048
15125
|
);
|
|
@@ -15056,7 +15133,7 @@ function getItemFields(itemId) {
|
|
|
15056
15133
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
15057
15134
|
return item.fields.filter((f) => f.reference && f.label);
|
|
15058
15135
|
} catch {
|
|
15059
|
-
console.error(
|
|
15136
|
+
console.error(chalk148.red("Failed to get item details from 1Password."));
|
|
15060
15137
|
process.exit(1);
|
|
15061
15138
|
}
|
|
15062
15139
|
}
|
|
@@ -15075,7 +15152,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
15075
15152
|
}).run();
|
|
15076
15153
|
const items2 = searchItems(search2);
|
|
15077
15154
|
if (items2.length === 0) {
|
|
15078
|
-
console.error(
|
|
15155
|
+
console.error(chalk149.red(`No items found matching "${search2}".`));
|
|
15079
15156
|
process.exit(1);
|
|
15080
15157
|
}
|
|
15081
15158
|
const itemId = await selectOne(
|
|
@@ -15084,7 +15161,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
15084
15161
|
);
|
|
15085
15162
|
const fields = getItemFields(itemId);
|
|
15086
15163
|
if (fields.length === 0) {
|
|
15087
|
-
console.error(
|
|
15164
|
+
console.error(chalk149.red("No fields with references found on this item."));
|
|
15088
15165
|
process.exit(1);
|
|
15089
15166
|
}
|
|
15090
15167
|
const ref = await selectOne(
|
|
@@ -15098,7 +15175,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
15098
15175
|
async function promptConnection(existingNames) {
|
|
15099
15176
|
const name = await promptInput("name", "Connection name:");
|
|
15100
15177
|
if (existingNames.includes(name)) {
|
|
15101
|
-
console.error(
|
|
15178
|
+
console.error(chalk150.red(`Connection "${name}" already exists.`));
|
|
15102
15179
|
process.exit(1);
|
|
15103
15180
|
}
|
|
15104
15181
|
const url = await promptInput(
|
|
@@ -15107,22 +15184,22 @@ async function promptConnection(existingNames) {
|
|
|
15107
15184
|
);
|
|
15108
15185
|
const database = await promptInput("database", "Database name:");
|
|
15109
15186
|
if (!name || !url || !database) {
|
|
15110
|
-
console.error(
|
|
15187
|
+
console.error(chalk150.red("All fields are required."));
|
|
15111
15188
|
process.exit(1);
|
|
15112
15189
|
}
|
|
15113
15190
|
const apiKeyRef = await selectOpSecret();
|
|
15114
|
-
console.log(
|
|
15191
|
+
console.log(chalk150.dim(`Using: ${apiKeyRef}`));
|
|
15115
15192
|
return { name, url, database, apiKeyRef };
|
|
15116
15193
|
}
|
|
15117
15194
|
|
|
15118
15195
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
15119
|
-
import
|
|
15196
|
+
import chalk151 from "chalk";
|
|
15120
15197
|
function ravendbSetConnection(name) {
|
|
15121
15198
|
const raw = loadGlobalConfigRaw();
|
|
15122
15199
|
const ravendb = raw.ravendb ?? {};
|
|
15123
15200
|
const connections = ravendb.connections ?? [];
|
|
15124
15201
|
if (!connections.some((c) => c.name === name)) {
|
|
15125
|
-
console.error(
|
|
15202
|
+
console.error(chalk151.red(`Connection "${name}" not found.`));
|
|
15126
15203
|
console.error(
|
|
15127
15204
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
15128
15205
|
);
|
|
@@ -15138,16 +15215,16 @@ function ravendbSetConnection(name) {
|
|
|
15138
15215
|
var ravendbAuth = createConnectionAuth({
|
|
15139
15216
|
load: loadConnections,
|
|
15140
15217
|
save: saveConnections,
|
|
15141
|
-
format: (c) => `${
|
|
15218
|
+
format: (c) => `${chalk152.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
15142
15219
|
promptNew: promptConnection,
|
|
15143
15220
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
15144
15221
|
});
|
|
15145
15222
|
|
|
15146
15223
|
// src/commands/ravendb/ravendbCollections.ts
|
|
15147
|
-
import
|
|
15224
|
+
import chalk156 from "chalk";
|
|
15148
15225
|
|
|
15149
15226
|
// src/commands/ravendb/ravenFetch.ts
|
|
15150
|
-
import
|
|
15227
|
+
import chalk154 from "chalk";
|
|
15151
15228
|
|
|
15152
15229
|
// src/commands/ravendb/getAccessToken.ts
|
|
15153
15230
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -15184,10 +15261,10 @@ ${errorText}`
|
|
|
15184
15261
|
|
|
15185
15262
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
15186
15263
|
import { execSync as execSync44 } from "child_process";
|
|
15187
|
-
import
|
|
15264
|
+
import chalk153 from "chalk";
|
|
15188
15265
|
function resolveOpSecret(reference) {
|
|
15189
15266
|
if (!reference.startsWith("op://")) {
|
|
15190
|
-
console.error(
|
|
15267
|
+
console.error(chalk153.red(`Invalid secret reference: must start with op://`));
|
|
15191
15268
|
process.exit(1);
|
|
15192
15269
|
}
|
|
15193
15270
|
try {
|
|
@@ -15197,7 +15274,7 @@ function resolveOpSecret(reference) {
|
|
|
15197
15274
|
}).trim();
|
|
15198
15275
|
} catch {
|
|
15199
15276
|
console.error(
|
|
15200
|
-
|
|
15277
|
+
chalk153.red(
|
|
15201
15278
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
15202
15279
|
)
|
|
15203
15280
|
);
|
|
@@ -15224,7 +15301,7 @@ async function ravenFetch(connection, path57) {
|
|
|
15224
15301
|
if (!response.ok) {
|
|
15225
15302
|
const body = await response.text();
|
|
15226
15303
|
console.error(
|
|
15227
|
-
|
|
15304
|
+
chalk154.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
15228
15305
|
);
|
|
15229
15306
|
console.error(body.substring(0, 500));
|
|
15230
15307
|
process.exit(1);
|
|
@@ -15233,7 +15310,7 @@ async function ravenFetch(connection, path57) {
|
|
|
15233
15310
|
}
|
|
15234
15311
|
|
|
15235
15312
|
// src/commands/ravendb/resolveConnection.ts
|
|
15236
|
-
import
|
|
15313
|
+
import chalk155 from "chalk";
|
|
15237
15314
|
function loadRavendb() {
|
|
15238
15315
|
const raw = loadGlobalConfigRaw();
|
|
15239
15316
|
const ravendb = raw.ravendb;
|
|
@@ -15247,7 +15324,7 @@ function resolveConnection(name) {
|
|
|
15247
15324
|
const connectionName = name ?? defaultConnection;
|
|
15248
15325
|
if (!connectionName) {
|
|
15249
15326
|
console.error(
|
|
15250
|
-
|
|
15327
|
+
chalk155.red(
|
|
15251
15328
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
15252
15329
|
)
|
|
15253
15330
|
);
|
|
@@ -15255,7 +15332,7 @@ function resolveConnection(name) {
|
|
|
15255
15332
|
}
|
|
15256
15333
|
const connection = connections.find((c) => c.name === connectionName);
|
|
15257
15334
|
if (!connection) {
|
|
15258
|
-
console.error(
|
|
15335
|
+
console.error(chalk155.red(`Connection "${connectionName}" not found.`));
|
|
15259
15336
|
console.error(
|
|
15260
15337
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
15261
15338
|
);
|
|
@@ -15286,15 +15363,15 @@ async function ravendbCollections(connectionName) {
|
|
|
15286
15363
|
return;
|
|
15287
15364
|
}
|
|
15288
15365
|
for (const c of collections) {
|
|
15289
|
-
console.log(`${
|
|
15366
|
+
console.log(`${chalk156.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
15290
15367
|
}
|
|
15291
15368
|
}
|
|
15292
15369
|
|
|
15293
15370
|
// src/commands/ravendb/ravendbQuery.ts
|
|
15294
|
-
import
|
|
15371
|
+
import chalk158 from "chalk";
|
|
15295
15372
|
|
|
15296
15373
|
// src/commands/ravendb/fetchAllPages.ts
|
|
15297
|
-
import
|
|
15374
|
+
import chalk157 from "chalk";
|
|
15298
15375
|
|
|
15299
15376
|
// src/commands/ravendb/buildQueryPath.ts
|
|
15300
15377
|
function buildQueryPath(opts) {
|
|
@@ -15332,7 +15409,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
15332
15409
|
allResults.push(...results);
|
|
15333
15410
|
start3 += results.length;
|
|
15334
15411
|
process.stderr.write(
|
|
15335
|
-
`\r${
|
|
15412
|
+
`\r${chalk157.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
15336
15413
|
);
|
|
15337
15414
|
if (start3 >= totalResults) break;
|
|
15338
15415
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -15347,7 +15424,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
15347
15424
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
15348
15425
|
const resolved = resolveArgs(connectionName, collection);
|
|
15349
15426
|
if (!resolved.collection && !options2.query) {
|
|
15350
|
-
console.error(
|
|
15427
|
+
console.error(chalk158.red("Provide a collection name or --query filter."));
|
|
15351
15428
|
process.exit(1);
|
|
15352
15429
|
}
|
|
15353
15430
|
const { collection: col } = resolved;
|
|
@@ -15385,7 +15462,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
15385
15462
|
import * as path28 from "path";
|
|
15386
15463
|
|
|
15387
15464
|
// src/commands/refactor/logViolations.ts
|
|
15388
|
-
import
|
|
15465
|
+
import chalk159 from "chalk";
|
|
15389
15466
|
var DEFAULT_MAX_LINES = 100;
|
|
15390
15467
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
15391
15468
|
if (violations.length === 0) {
|
|
@@ -15394,43 +15471,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
15394
15471
|
}
|
|
15395
15472
|
return;
|
|
15396
15473
|
}
|
|
15397
|
-
console.error(
|
|
15474
|
+
console.error(chalk159.red(`
|
|
15398
15475
|
Refactor check failed:
|
|
15399
15476
|
`));
|
|
15400
|
-
console.error(
|
|
15477
|
+
console.error(chalk159.red(` The following files exceed ${maxLines} lines:
|
|
15401
15478
|
`));
|
|
15402
15479
|
for (const violation of violations) {
|
|
15403
|
-
console.error(
|
|
15480
|
+
console.error(chalk159.red(` ${violation.file} (${violation.lines} lines)`));
|
|
15404
15481
|
}
|
|
15405
15482
|
console.error(
|
|
15406
|
-
|
|
15483
|
+
chalk159.yellow(
|
|
15407
15484
|
`
|
|
15408
15485
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
15409
15486
|
way to refactor it, ignore it with:
|
|
15410
15487
|
`
|
|
15411
15488
|
)
|
|
15412
15489
|
);
|
|
15413
|
-
console.error(
|
|
15490
|
+
console.error(chalk159.gray(` assist refactor ignore <file>
|
|
15414
15491
|
`));
|
|
15415
15492
|
if (process.env.CLAUDECODE) {
|
|
15416
|
-
console.error(
|
|
15493
|
+
console.error(chalk159.cyan(`
|
|
15417
15494
|
## Extracting Code to New Files
|
|
15418
15495
|
`));
|
|
15419
15496
|
console.error(
|
|
15420
|
-
|
|
15497
|
+
chalk159.cyan(
|
|
15421
15498
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
15422
15499
|
`
|
|
15423
15500
|
)
|
|
15424
15501
|
);
|
|
15425
15502
|
console.error(
|
|
15426
|
-
|
|
15503
|
+
chalk159.cyan(
|
|
15427
15504
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
15428
15505
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
15429
15506
|
`
|
|
15430
15507
|
)
|
|
15431
15508
|
);
|
|
15432
15509
|
console.error(
|
|
15433
|
-
|
|
15510
|
+
chalk159.cyan(
|
|
15434
15511
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
15435
15512
|
domains, move it to a common/shared folder.
|
|
15436
15513
|
`
|
|
@@ -15586,7 +15663,7 @@ async function check(pattern2, options2) {
|
|
|
15586
15663
|
|
|
15587
15664
|
// src/commands/refactor/extract/index.ts
|
|
15588
15665
|
import path35 from "path";
|
|
15589
|
-
import
|
|
15666
|
+
import chalk162 from "chalk";
|
|
15590
15667
|
|
|
15591
15668
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
15592
15669
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -15597,16 +15674,16 @@ import {
|
|
|
15597
15674
|
} from "ts-morph";
|
|
15598
15675
|
var suppressionPattern = /^\s*(\/\/|\/\*)\s*oxlint-disable\b/;
|
|
15599
15676
|
function countLeadingSuppressions(sourceFile) {
|
|
15600
|
-
let
|
|
15677
|
+
let count8 = 0;
|
|
15601
15678
|
for (const stmt of sourceFile.getStatementsWithComments()) {
|
|
15602
15679
|
const kind = stmt.getKind();
|
|
15603
15680
|
if ((kind === SyntaxKind2.SingleLineCommentTrivia || kind === SyntaxKind2.MultiLineCommentTrivia) && suppressionPattern.test(stmt.getText())) {
|
|
15604
|
-
|
|
15681
|
+
count8++;
|
|
15605
15682
|
} else {
|
|
15606
15683
|
break;
|
|
15607
15684
|
}
|
|
15608
15685
|
}
|
|
15609
|
-
return
|
|
15686
|
+
return count8;
|
|
15610
15687
|
}
|
|
15611
15688
|
function addImportPreservingSuppressions(sourceFile, structure) {
|
|
15612
15689
|
if (sourceFile.getImportDeclarations().length > 0) {
|
|
@@ -16161,23 +16238,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
16161
16238
|
|
|
16162
16239
|
// src/commands/refactor/extract/displayPlan.ts
|
|
16163
16240
|
import path32 from "path";
|
|
16164
|
-
import
|
|
16241
|
+
import chalk160 from "chalk";
|
|
16165
16242
|
function section(title) {
|
|
16166
16243
|
return `
|
|
16167
|
-
${
|
|
16244
|
+
${chalk160.cyan(title)}`;
|
|
16168
16245
|
}
|
|
16169
16246
|
function displayImporters(plan2, cwd) {
|
|
16170
16247
|
if (plan2.importersToUpdate.length === 0) return;
|
|
16171
16248
|
console.log(section("Update importers:"));
|
|
16172
16249
|
for (const imp of plan2.importersToUpdate) {
|
|
16173
16250
|
const rel = path32.relative(cwd, imp.file.getFilePath());
|
|
16174
|
-
console.log(` ${
|
|
16251
|
+
console.log(` ${chalk160.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
16175
16252
|
}
|
|
16176
16253
|
}
|
|
16177
16254
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
16178
|
-
console.log(
|
|
16255
|
+
console.log(chalk160.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
16179
16256
|
`));
|
|
16180
|
-
console.log(` ${
|
|
16257
|
+
console.log(` ${chalk160.cyan("Functions to move:")}`);
|
|
16181
16258
|
for (const name of plan2.extractedNames) {
|
|
16182
16259
|
console.log(` ${name}`);
|
|
16183
16260
|
}
|
|
@@ -16211,7 +16288,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
16211
16288
|
|
|
16212
16289
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
16213
16290
|
import path34 from "path";
|
|
16214
|
-
import
|
|
16291
|
+
import chalk161 from "chalk";
|
|
16215
16292
|
import { Project as Project4 } from "ts-morph";
|
|
16216
16293
|
|
|
16217
16294
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -16271,7 +16348,7 @@ function loadProjectFile(file) {
|
|
|
16271
16348
|
});
|
|
16272
16349
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
16273
16350
|
if (!sourceFile) {
|
|
16274
|
-
console.log(
|
|
16351
|
+
console.log(chalk161.red(`File not found in project: ${file}`));
|
|
16275
16352
|
process.exit(1);
|
|
16276
16353
|
}
|
|
16277
16354
|
return { project, sourceFile };
|
|
@@ -16294,19 +16371,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
16294
16371
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
16295
16372
|
if (options2.apply) {
|
|
16296
16373
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
16297
|
-
console.log(
|
|
16374
|
+
console.log(chalk162.green("\nExtraction complete"));
|
|
16298
16375
|
} else {
|
|
16299
|
-
console.log(
|
|
16376
|
+
console.log(chalk162.dim("\nDry run. Use --apply to execute."));
|
|
16300
16377
|
}
|
|
16301
16378
|
}
|
|
16302
16379
|
|
|
16303
16380
|
// src/commands/refactor/ignore.ts
|
|
16304
16381
|
import fs24 from "fs";
|
|
16305
|
-
import
|
|
16382
|
+
import chalk163 from "chalk";
|
|
16306
16383
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
16307
16384
|
function ignore(file) {
|
|
16308
16385
|
if (!fs24.existsSync(file)) {
|
|
16309
|
-
console.error(
|
|
16386
|
+
console.error(chalk163.red(`Error: File does not exist: ${file}`));
|
|
16310
16387
|
process.exit(1);
|
|
16311
16388
|
}
|
|
16312
16389
|
const content = fs24.readFileSync(file, "utf8");
|
|
@@ -16322,7 +16399,7 @@ function ignore(file) {
|
|
|
16322
16399
|
fs24.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
16323
16400
|
}
|
|
16324
16401
|
console.log(
|
|
16325
|
-
|
|
16402
|
+
chalk163.green(
|
|
16326
16403
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
16327
16404
|
)
|
|
16328
16405
|
);
|
|
@@ -16331,12 +16408,12 @@ function ignore(file) {
|
|
|
16331
16408
|
// src/commands/refactor/rename/index.ts
|
|
16332
16409
|
import fs27 from "fs";
|
|
16333
16410
|
import path40 from "path";
|
|
16334
|
-
import
|
|
16411
|
+
import chalk166 from "chalk";
|
|
16335
16412
|
|
|
16336
16413
|
// src/commands/refactor/rename/applyRename.ts
|
|
16337
16414
|
import fs26 from "fs";
|
|
16338
16415
|
import path37 from "path";
|
|
16339
|
-
import
|
|
16416
|
+
import chalk164 from "chalk";
|
|
16340
16417
|
|
|
16341
16418
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
16342
16419
|
import path36 from "path";
|
|
@@ -16441,13 +16518,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
16441
16518
|
const updatedContents = applyRewrites(rewrites);
|
|
16442
16519
|
for (const [file, content] of updatedContents) {
|
|
16443
16520
|
fs26.writeFileSync(file, content, "utf8");
|
|
16444
|
-
console.log(
|
|
16521
|
+
console.log(chalk164.cyan(` Updated imports in ${path37.relative(cwd, file)}`));
|
|
16445
16522
|
}
|
|
16446
16523
|
const destDir = path37.dirname(destPath);
|
|
16447
16524
|
if (!fs26.existsSync(destDir)) fs26.mkdirSync(destDir, { recursive: true });
|
|
16448
16525
|
fs26.renameSync(sourcePath, destPath);
|
|
16449
16526
|
console.log(
|
|
16450
|
-
|
|
16527
|
+
chalk164.white(
|
|
16451
16528
|
` Moved ${path37.relative(cwd, sourcePath)} \u2192 ${path37.relative(cwd, destPath)}`
|
|
16452
16529
|
)
|
|
16453
16530
|
);
|
|
@@ -16534,16 +16611,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
16534
16611
|
|
|
16535
16612
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
16536
16613
|
import path39 from "path";
|
|
16537
|
-
import
|
|
16614
|
+
import chalk165 from "chalk";
|
|
16538
16615
|
function printRenamePreview(rewrites, cwd) {
|
|
16539
16616
|
for (const rewrite of rewrites) {
|
|
16540
16617
|
console.log(
|
|
16541
|
-
|
|
16618
|
+
chalk165.dim(
|
|
16542
16619
|
` ${path39.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
16543
16620
|
)
|
|
16544
16621
|
);
|
|
16545
16622
|
}
|
|
16546
|
-
console.log(
|
|
16623
|
+
console.log(chalk165.dim("Dry run. Use --apply to execute."));
|
|
16547
16624
|
}
|
|
16548
16625
|
|
|
16549
16626
|
// src/commands/refactor/rename/index.ts
|
|
@@ -16554,20 +16631,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
16554
16631
|
const relSource = path40.relative(cwd, sourcePath);
|
|
16555
16632
|
const relDest = path40.relative(cwd, destPath);
|
|
16556
16633
|
if (!fs27.existsSync(sourcePath)) {
|
|
16557
|
-
console.log(
|
|
16634
|
+
console.log(chalk166.red(`File not found: ${source}`));
|
|
16558
16635
|
process.exit(1);
|
|
16559
16636
|
}
|
|
16560
16637
|
if (destPath !== sourcePath && fs27.existsSync(destPath)) {
|
|
16561
|
-
console.log(
|
|
16638
|
+
console.log(chalk166.red(`Destination already exists: ${destination}`));
|
|
16562
16639
|
process.exit(1);
|
|
16563
16640
|
}
|
|
16564
|
-
console.log(
|
|
16565
|
-
console.log(
|
|
16566
|
-
console.log(
|
|
16641
|
+
console.log(chalk166.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
16642
|
+
console.log(chalk166.dim("Loading project..."));
|
|
16643
|
+
console.log(chalk166.dim("Scanning imports across the project..."));
|
|
16567
16644
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
16568
16645
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
16569
16646
|
console.log(
|
|
16570
|
-
|
|
16647
|
+
chalk166.dim(
|
|
16571
16648
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
16572
16649
|
)
|
|
16573
16650
|
);
|
|
@@ -16576,11 +16653,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
16576
16653
|
return;
|
|
16577
16654
|
}
|
|
16578
16655
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
16579
|
-
console.log(
|
|
16656
|
+
console.log(chalk166.green("Done"));
|
|
16580
16657
|
}
|
|
16581
16658
|
|
|
16582
16659
|
// src/commands/refactor/renameSymbol/index.ts
|
|
16583
|
-
import
|
|
16660
|
+
import chalk167 from "chalk";
|
|
16584
16661
|
|
|
16585
16662
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
16586
16663
|
import { SyntaxKind as SyntaxKind14 } from "ts-morph";
|
|
@@ -16626,33 +16703,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
16626
16703
|
const { project, sourceFile } = loadProjectFile(file);
|
|
16627
16704
|
const symbol = findSymbol(sourceFile, oldName);
|
|
16628
16705
|
if (!symbol) {
|
|
16629
|
-
console.log(
|
|
16706
|
+
console.log(chalk167.red(`Symbol "${oldName}" not found in ${file}`));
|
|
16630
16707
|
process.exit(1);
|
|
16631
16708
|
}
|
|
16632
16709
|
const grouped = groupReferences(symbol, cwd);
|
|
16633
16710
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
16634
16711
|
console.log(
|
|
16635
|
-
|
|
16712
|
+
chalk167.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
16636
16713
|
`)
|
|
16637
16714
|
);
|
|
16638
16715
|
for (const [refFile, lines] of grouped) {
|
|
16639
16716
|
console.log(
|
|
16640
|
-
` ${
|
|
16717
|
+
` ${chalk167.dim(refFile)}: lines ${chalk167.cyan(lines.join(", "))}`
|
|
16641
16718
|
);
|
|
16642
16719
|
}
|
|
16643
16720
|
if (options2.apply) {
|
|
16644
16721
|
symbol.rename(newName);
|
|
16645
16722
|
await project.save();
|
|
16646
|
-
console.log(
|
|
16723
|
+
console.log(chalk167.green(`
|
|
16647
16724
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
16648
16725
|
} else {
|
|
16649
|
-
console.log(
|
|
16726
|
+
console.log(chalk167.dim("\nDry run. Use --apply to execute."));
|
|
16650
16727
|
}
|
|
16651
16728
|
}
|
|
16652
16729
|
|
|
16653
16730
|
// src/commands/refactor/restructure/index.ts
|
|
16654
16731
|
import path48 from "path";
|
|
16655
|
-
import
|
|
16732
|
+
import chalk170 from "chalk";
|
|
16656
16733
|
|
|
16657
16734
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
16658
16735
|
import path42 from "path";
|
|
@@ -16731,50 +16808,50 @@ function clusterFiles(graph) {
|
|
|
16731
16808
|
|
|
16732
16809
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
16733
16810
|
import path44 from "path";
|
|
16734
|
-
import
|
|
16811
|
+
import chalk168 from "chalk";
|
|
16735
16812
|
function relPath(filePath) {
|
|
16736
16813
|
return path44.relative(process.cwd(), filePath);
|
|
16737
16814
|
}
|
|
16738
16815
|
function displayMoves(plan2) {
|
|
16739
16816
|
if (plan2.moves.length === 0) return;
|
|
16740
|
-
console.log(
|
|
16817
|
+
console.log(chalk168.bold("\nFile moves:"));
|
|
16741
16818
|
for (const move2 of plan2.moves) {
|
|
16742
16819
|
console.log(
|
|
16743
|
-
` ${
|
|
16820
|
+
` ${chalk168.red(relPath(move2.from))} \u2192 ${chalk168.green(relPath(move2.to))}`
|
|
16744
16821
|
);
|
|
16745
|
-
console.log(
|
|
16822
|
+
console.log(chalk168.dim(` ${move2.reason}`));
|
|
16746
16823
|
}
|
|
16747
16824
|
}
|
|
16748
16825
|
function displayRewrites(rewrites) {
|
|
16749
16826
|
if (rewrites.length === 0) return;
|
|
16750
16827
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
16751
|
-
console.log(
|
|
16828
|
+
console.log(chalk168.bold(`
|
|
16752
16829
|
Import rewrites (${affectedFiles.size} files):`));
|
|
16753
16830
|
for (const file of affectedFiles) {
|
|
16754
|
-
console.log(` ${
|
|
16831
|
+
console.log(` ${chalk168.cyan(relPath(file))}:`);
|
|
16755
16832
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
16756
16833
|
(r) => r.file === file
|
|
16757
16834
|
)) {
|
|
16758
16835
|
console.log(
|
|
16759
|
-
` ${
|
|
16836
|
+
` ${chalk168.red(`"${oldSpecifier}"`)} \u2192 ${chalk168.green(`"${newSpecifier}"`)}`
|
|
16760
16837
|
);
|
|
16761
16838
|
}
|
|
16762
16839
|
}
|
|
16763
16840
|
}
|
|
16764
16841
|
function displayPlan2(plan2) {
|
|
16765
16842
|
if (plan2.warnings.length > 0) {
|
|
16766
|
-
console.log(
|
|
16767
|
-
for (const w of plan2.warnings) console.log(
|
|
16843
|
+
console.log(chalk168.yellow("\nWarnings:"));
|
|
16844
|
+
for (const w of plan2.warnings) console.log(chalk168.yellow(` ${w}`));
|
|
16768
16845
|
}
|
|
16769
16846
|
if (plan2.newDirectories.length > 0) {
|
|
16770
|
-
console.log(
|
|
16847
|
+
console.log(chalk168.bold("\nNew directories:"));
|
|
16771
16848
|
for (const dir of plan2.newDirectories)
|
|
16772
|
-
console.log(
|
|
16849
|
+
console.log(chalk168.green(` ${dir}/`));
|
|
16773
16850
|
}
|
|
16774
16851
|
displayMoves(plan2);
|
|
16775
16852
|
displayRewrites(plan2.rewrites);
|
|
16776
16853
|
console.log(
|
|
16777
|
-
|
|
16854
|
+
chalk168.dim(
|
|
16778
16855
|
`
|
|
16779
16856
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
16780
16857
|
)
|
|
@@ -16784,18 +16861,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
16784
16861
|
// src/commands/refactor/restructure/executePlan.ts
|
|
16785
16862
|
import fs28 from "fs";
|
|
16786
16863
|
import path45 from "path";
|
|
16787
|
-
import
|
|
16864
|
+
import chalk169 from "chalk";
|
|
16788
16865
|
function executePlan(plan2) {
|
|
16789
16866
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
16790
16867
|
for (const [file, content] of updatedContents) {
|
|
16791
16868
|
fs28.writeFileSync(file, content, "utf8");
|
|
16792
16869
|
console.log(
|
|
16793
|
-
|
|
16870
|
+
chalk169.cyan(` Rewrote imports in ${path45.relative(process.cwd(), file)}`)
|
|
16794
16871
|
);
|
|
16795
16872
|
}
|
|
16796
16873
|
for (const dir of plan2.newDirectories) {
|
|
16797
16874
|
fs28.mkdirSync(dir, { recursive: true });
|
|
16798
|
-
console.log(
|
|
16875
|
+
console.log(chalk169.green(` Created ${path45.relative(process.cwd(), dir)}/`));
|
|
16799
16876
|
}
|
|
16800
16877
|
for (const move2 of plan2.moves) {
|
|
16801
16878
|
const targetDir = path45.dirname(move2.to);
|
|
@@ -16804,7 +16881,7 @@ function executePlan(plan2) {
|
|
|
16804
16881
|
}
|
|
16805
16882
|
fs28.renameSync(move2.from, move2.to);
|
|
16806
16883
|
console.log(
|
|
16807
|
-
|
|
16884
|
+
chalk169.white(
|
|
16808
16885
|
` Moved ${path45.relative(process.cwd(), move2.from)} \u2192 ${path45.relative(process.cwd(), move2.to)}`
|
|
16809
16886
|
)
|
|
16810
16887
|
);
|
|
@@ -16819,7 +16896,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
16819
16896
|
if (entries.length === 0) {
|
|
16820
16897
|
fs28.rmdirSync(dir);
|
|
16821
16898
|
console.log(
|
|
16822
|
-
|
|
16899
|
+
chalk169.dim(
|
|
16823
16900
|
` Removed empty directory ${path45.relative(process.cwd(), dir)}`
|
|
16824
16901
|
)
|
|
16825
16902
|
);
|
|
@@ -16952,22 +17029,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
16952
17029
|
const targetPattern = pattern2 ?? "src";
|
|
16953
17030
|
const files = findSourceFiles2(targetPattern);
|
|
16954
17031
|
if (files.length === 0) {
|
|
16955
|
-
console.log(
|
|
17032
|
+
console.log(chalk170.yellow("No files found matching pattern"));
|
|
16956
17033
|
return;
|
|
16957
17034
|
}
|
|
16958
17035
|
const tsConfigPath = path48.resolve("tsconfig.json");
|
|
16959
17036
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
16960
17037
|
if (plan2.moves.length === 0) {
|
|
16961
|
-
console.log(
|
|
17038
|
+
console.log(chalk170.green("No restructuring needed"));
|
|
16962
17039
|
return;
|
|
16963
17040
|
}
|
|
16964
17041
|
displayPlan2(plan2);
|
|
16965
17042
|
if (options2.apply) {
|
|
16966
|
-
console.log(
|
|
17043
|
+
console.log(chalk170.bold("\nApplying changes..."));
|
|
16967
17044
|
executePlan(plan2);
|
|
16968
|
-
console.log(
|
|
17045
|
+
console.log(chalk170.green("\nRestructuring complete"));
|
|
16969
17046
|
} else {
|
|
16970
|
-
console.log(
|
|
17047
|
+
console.log(chalk170.dim("\nDry run. Use --apply to execute."));
|
|
16971
17048
|
}
|
|
16972
17049
|
}
|
|
16973
17050
|
|
|
@@ -17541,18 +17618,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
17541
17618
|
}
|
|
17542
17619
|
|
|
17543
17620
|
// src/commands/review/warnOutOfDiff.ts
|
|
17544
|
-
import
|
|
17621
|
+
import chalk171 from "chalk";
|
|
17545
17622
|
function warnOutOfDiff(outOfDiff) {
|
|
17546
17623
|
if (outOfDiff.length === 0) return;
|
|
17547
17624
|
console.warn(
|
|
17548
|
-
|
|
17625
|
+
chalk171.yellow(
|
|
17549
17626
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
17550
17627
|
)
|
|
17551
17628
|
);
|
|
17552
17629
|
for (const finding of outOfDiff) {
|
|
17553
17630
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
17554
17631
|
console.warn(
|
|
17555
|
-
` ${
|
|
17632
|
+
` ${chalk171.yellow("\xB7")} ${finding.title} ${chalk171.dim(
|
|
17556
17633
|
`(${finding.file}:${range})`
|
|
17557
17634
|
)}`
|
|
17558
17635
|
);
|
|
@@ -17571,26 +17648,26 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
17571
17648
|
}
|
|
17572
17649
|
|
|
17573
17650
|
// src/commands/review/warnUnlocated.ts
|
|
17574
|
-
import
|
|
17651
|
+
import chalk172 from "chalk";
|
|
17575
17652
|
function warnUnlocated(unlocated) {
|
|
17576
17653
|
if (unlocated.length === 0) return;
|
|
17577
17654
|
console.warn(
|
|
17578
|
-
|
|
17655
|
+
chalk172.yellow(
|
|
17579
17656
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
17580
17657
|
)
|
|
17581
17658
|
);
|
|
17582
17659
|
for (const finding of unlocated) {
|
|
17583
|
-
const where = finding.location ||
|
|
17660
|
+
const where = finding.location || chalk172.dim("missing");
|
|
17584
17661
|
console.warn(
|
|
17585
|
-
` ${
|
|
17662
|
+
` ${chalk172.yellow("\xB7")} ${finding.title} ${chalk172.dim(`(${where})`)}`
|
|
17586
17663
|
);
|
|
17587
17664
|
}
|
|
17588
17665
|
}
|
|
17589
17666
|
|
|
17590
17667
|
// src/commands/review/postReviewToPr.ts
|
|
17591
|
-
async function confirmPost(prNumber,
|
|
17668
|
+
async function confirmPost(prNumber, count8, options2) {
|
|
17592
17669
|
if (!options2.prompt) return true;
|
|
17593
|
-
return promptConfirm(`Post ${
|
|
17670
|
+
return promptConfirm(`Post ${count8} comment(s) to PR #${prNumber}?`, false);
|
|
17594
17671
|
}
|
|
17595
17672
|
async function postReviewToPr(synthesisPath, options2) {
|
|
17596
17673
|
const prInfo = fetchPrDiffInfo();
|
|
@@ -18637,9 +18714,9 @@ async function runReviewPipeline(paths, options2) {
|
|
|
18637
18714
|
}
|
|
18638
18715
|
|
|
18639
18716
|
// src/commands/review/reviewPr.ts
|
|
18640
|
-
function logPriorComments(
|
|
18641
|
-
if (
|
|
18642
|
-
console.log(`Including ${
|
|
18717
|
+
function logPriorComments(count8) {
|
|
18718
|
+
if (count8 === 0) return;
|
|
18719
|
+
console.log(`Including ${count8} prior review comment(s) in request.md.`);
|
|
18643
18720
|
}
|
|
18644
18721
|
function gatherChangedContext() {
|
|
18645
18722
|
const context = gatherContext();
|
|
@@ -18754,7 +18831,7 @@ function registerReview(program2) {
|
|
|
18754
18831
|
}
|
|
18755
18832
|
|
|
18756
18833
|
// src/commands/seq/seqAuth.ts
|
|
18757
|
-
import
|
|
18834
|
+
import chalk174 from "chalk";
|
|
18758
18835
|
|
|
18759
18836
|
// src/commands/seq/loadConnections.ts
|
|
18760
18837
|
function loadConnections2() {
|
|
@@ -18783,10 +18860,10 @@ function setDefaultConnection(name) {
|
|
|
18783
18860
|
}
|
|
18784
18861
|
|
|
18785
18862
|
// src/shared/assertUniqueName.ts
|
|
18786
|
-
import
|
|
18863
|
+
import chalk173 from "chalk";
|
|
18787
18864
|
function assertUniqueName(existingNames, name) {
|
|
18788
18865
|
if (existingNames.includes(name)) {
|
|
18789
|
-
console.error(
|
|
18866
|
+
console.error(chalk173.red(`Connection "${name}" already exists.`));
|
|
18790
18867
|
process.exit(1);
|
|
18791
18868
|
}
|
|
18792
18869
|
}
|
|
@@ -18804,16 +18881,16 @@ async function promptConnection2(existingNames) {
|
|
|
18804
18881
|
var seqAuth = createConnectionAuth({
|
|
18805
18882
|
load: loadConnections2,
|
|
18806
18883
|
save: saveConnections2,
|
|
18807
|
-
format: (c) => `${
|
|
18884
|
+
format: (c) => `${chalk174.bold(c.name)} ${c.url}`,
|
|
18808
18885
|
promptNew: promptConnection2,
|
|
18809
18886
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
18810
18887
|
});
|
|
18811
18888
|
|
|
18812
18889
|
// src/commands/seq/seqQuery.ts
|
|
18813
|
-
import
|
|
18890
|
+
import chalk178 from "chalk";
|
|
18814
18891
|
|
|
18815
18892
|
// src/commands/seq/fetchSeq.ts
|
|
18816
|
-
import
|
|
18893
|
+
import chalk175 from "chalk";
|
|
18817
18894
|
async function fetchSeq(conn, path57, params) {
|
|
18818
18895
|
const url = `${conn.url}${path57}?${params}`;
|
|
18819
18896
|
const response = await fetch(url, {
|
|
@@ -18824,7 +18901,7 @@ async function fetchSeq(conn, path57, params) {
|
|
|
18824
18901
|
});
|
|
18825
18902
|
if (!response.ok) {
|
|
18826
18903
|
const body = await response.text();
|
|
18827
|
-
console.error(
|
|
18904
|
+
console.error(chalk175.red(`Seq returned ${response.status}: ${body}`));
|
|
18828
18905
|
process.exit(1);
|
|
18829
18906
|
}
|
|
18830
18907
|
return response;
|
|
@@ -18836,16 +18913,16 @@ function filterToSql(filter) {
|
|
|
18836
18913
|
}
|
|
18837
18914
|
|
|
18838
18915
|
// src/commands/seq/fetchSeqData.ts
|
|
18839
|
-
function buildDataParams(filter,
|
|
18916
|
+
function buildDataParams(filter, count8, from, to) {
|
|
18840
18917
|
const sqlFilter = filterToSql(filter);
|
|
18841
|
-
const sql9 = `select @Timestamp, @Level, @Exception, @Message from stream where ${sqlFilter} order by @Timestamp desc limit ${
|
|
18918
|
+
const sql9 = `select @Timestamp, @Level, @Exception, @Message from stream where ${sqlFilter} order by @Timestamp desc limit ${count8}`;
|
|
18842
18919
|
const params = new URLSearchParams({ q: sql9 });
|
|
18843
18920
|
if (from) params.set("rangeStartUtc", from);
|
|
18844
18921
|
if (to) params.set("rangeEndUtc", to);
|
|
18845
18922
|
return params;
|
|
18846
18923
|
}
|
|
18847
|
-
async function fetchSeqData(conn, filter,
|
|
18848
|
-
const params = buildDataParams(filter,
|
|
18924
|
+
async function fetchSeqData(conn, filter, count8, from, to) {
|
|
18925
|
+
const params = buildDataParams(filter, count8, from, to);
|
|
18849
18926
|
const response = await fetchSeq(conn, "/api/data", params);
|
|
18850
18927
|
const data = await response.json();
|
|
18851
18928
|
return mapDataToEvents(data);
|
|
@@ -18883,23 +18960,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
18883
18960
|
}
|
|
18884
18961
|
|
|
18885
18962
|
// src/commands/seq/formatEvent.ts
|
|
18886
|
-
import
|
|
18963
|
+
import chalk176 from "chalk";
|
|
18887
18964
|
function levelColor(level) {
|
|
18888
18965
|
switch (level) {
|
|
18889
18966
|
case "Fatal":
|
|
18890
|
-
return
|
|
18967
|
+
return chalk176.bgRed.white;
|
|
18891
18968
|
case "Error":
|
|
18892
|
-
return
|
|
18969
|
+
return chalk176.red;
|
|
18893
18970
|
case "Warning":
|
|
18894
|
-
return
|
|
18971
|
+
return chalk176.yellow;
|
|
18895
18972
|
case "Information":
|
|
18896
|
-
return
|
|
18973
|
+
return chalk176.cyan;
|
|
18897
18974
|
case "Debug":
|
|
18898
|
-
return
|
|
18975
|
+
return chalk176.gray;
|
|
18899
18976
|
case "Verbose":
|
|
18900
|
-
return
|
|
18977
|
+
return chalk176.dim;
|
|
18901
18978
|
default:
|
|
18902
|
-
return
|
|
18979
|
+
return chalk176.white;
|
|
18903
18980
|
}
|
|
18904
18981
|
}
|
|
18905
18982
|
function levelAbbrev(level) {
|
|
@@ -18940,12 +19017,12 @@ function formatTimestamp(iso) {
|
|
|
18940
19017
|
function formatEvent(event) {
|
|
18941
19018
|
const color = levelColor(event.Level);
|
|
18942
19019
|
const abbrev = levelAbbrev(event.Level);
|
|
18943
|
-
const ts8 =
|
|
19020
|
+
const ts8 = chalk176.dim(formatTimestamp(event.Timestamp));
|
|
18944
19021
|
const msg = renderMessage(event);
|
|
18945
19022
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
18946
19023
|
if (event.Exception) {
|
|
18947
19024
|
for (const line of event.Exception.split("\n")) {
|
|
18948
|
-
lines.push(
|
|
19025
|
+
lines.push(chalk176.red(` ${line}`));
|
|
18949
19026
|
}
|
|
18950
19027
|
}
|
|
18951
19028
|
return lines.join("\n");
|
|
@@ -18978,11 +19055,11 @@ function rejectTimestampFilter(filter) {
|
|
|
18978
19055
|
}
|
|
18979
19056
|
|
|
18980
19057
|
// src/shared/resolveNamedConnection.ts
|
|
18981
|
-
import
|
|
19058
|
+
import chalk177 from "chalk";
|
|
18982
19059
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
18983
19060
|
if (connections.length === 0) {
|
|
18984
19061
|
console.error(
|
|
18985
|
-
|
|
19062
|
+
chalk177.red(
|
|
18986
19063
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
18987
19064
|
)
|
|
18988
19065
|
);
|
|
@@ -18991,7 +19068,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
18991
19068
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
18992
19069
|
const connection = connections.find((c) => c.name === target);
|
|
18993
19070
|
if (!connection) {
|
|
18994
|
-
console.error(
|
|
19071
|
+
console.error(chalk177.red(`${kind} connection "${target}" not found.`));
|
|
18995
19072
|
process.exit(1);
|
|
18996
19073
|
}
|
|
18997
19074
|
return connection;
|
|
@@ -19012,15 +19089,15 @@ function resolveConnection2(name) {
|
|
|
19012
19089
|
async function seqQuery(filter, options2) {
|
|
19013
19090
|
rejectTimestampFilter(filter);
|
|
19014
19091
|
const conn = resolveConnection2(options2.connection);
|
|
19015
|
-
const
|
|
19092
|
+
const count8 = Number.parseInt(options2.count ?? "1000", 10);
|
|
19016
19093
|
const from = options2.from ? parseRelativeTime(options2.from) : void 0;
|
|
19017
19094
|
const to = options2.to ? parseRelativeTime(options2.to) : void 0;
|
|
19018
|
-
const events = from || to ? await fetchSeqData(conn, filter,
|
|
19095
|
+
const events = from || to ? await fetchSeqData(conn, filter, count8, from, to) : await fetchSeqEvents(
|
|
19019
19096
|
conn,
|
|
19020
|
-
new URLSearchParams({ filter, count: String(
|
|
19097
|
+
new URLSearchParams({ filter, count: String(count8) })
|
|
19021
19098
|
);
|
|
19022
19099
|
if (events.length === 0) {
|
|
19023
|
-
console.log(
|
|
19100
|
+
console.log(chalk178.yellow("No events found."));
|
|
19024
19101
|
return;
|
|
19025
19102
|
}
|
|
19026
19103
|
if (options2.json) {
|
|
@@ -19031,22 +19108,22 @@ async function seqQuery(filter, options2) {
|
|
|
19031
19108
|
for (const event of chronological) {
|
|
19032
19109
|
console.log(formatEvent(event));
|
|
19033
19110
|
}
|
|
19034
|
-
console.log(
|
|
19111
|
+
console.log(chalk178.dim(`
|
|
19035
19112
|
${events.length} events`));
|
|
19036
|
-
if (events.length >=
|
|
19113
|
+
if (events.length >= count8) {
|
|
19037
19114
|
console.log(
|
|
19038
|
-
|
|
19039
|
-
`Results limited to ${
|
|
19115
|
+
chalk178.yellow(
|
|
19116
|
+
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
19040
19117
|
)
|
|
19041
19118
|
);
|
|
19042
19119
|
}
|
|
19043
19120
|
}
|
|
19044
19121
|
|
|
19045
19122
|
// src/shared/setNamedDefaultConnection.ts
|
|
19046
|
-
import
|
|
19123
|
+
import chalk179 from "chalk";
|
|
19047
19124
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
19048
19125
|
if (!connections.find((c) => c.name === name)) {
|
|
19049
|
-
console.error(
|
|
19126
|
+
console.error(chalk179.red(`Connection "${name}" not found.`));
|
|
19050
19127
|
process.exit(1);
|
|
19051
19128
|
}
|
|
19052
19129
|
setDefault(name);
|
|
@@ -19094,7 +19171,7 @@ function registerSignal(program2) {
|
|
|
19094
19171
|
}
|
|
19095
19172
|
|
|
19096
19173
|
// src/commands/sql/sqlAuth.ts
|
|
19097
|
-
import
|
|
19174
|
+
import chalk181 from "chalk";
|
|
19098
19175
|
|
|
19099
19176
|
// src/commands/sql/loadConnections.ts
|
|
19100
19177
|
function loadConnections3() {
|
|
@@ -19123,7 +19200,7 @@ function setDefaultConnection2(name) {
|
|
|
19123
19200
|
}
|
|
19124
19201
|
|
|
19125
19202
|
// src/commands/sql/promptConnection.ts
|
|
19126
|
-
import
|
|
19203
|
+
import chalk180 from "chalk";
|
|
19127
19204
|
async function promptConnection3(existingNames) {
|
|
19128
19205
|
const name = await promptInput("name", "Connection name:", "default");
|
|
19129
19206
|
assertUniqueName(existingNames, name);
|
|
@@ -19131,7 +19208,7 @@ async function promptConnection3(existingNames) {
|
|
|
19131
19208
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
19132
19209
|
const port = Number.parseInt(portStr, 10);
|
|
19133
19210
|
if (!Number.isFinite(port)) {
|
|
19134
|
-
console.error(
|
|
19211
|
+
console.error(chalk180.red(`Invalid port "${portStr}".`));
|
|
19135
19212
|
process.exit(1);
|
|
19136
19213
|
}
|
|
19137
19214
|
const user = await promptInput("user", "User:");
|
|
@@ -19144,13 +19221,13 @@ async function promptConnection3(existingNames) {
|
|
|
19144
19221
|
var sqlAuth = createConnectionAuth({
|
|
19145
19222
|
load: loadConnections3,
|
|
19146
19223
|
save: saveConnections3,
|
|
19147
|
-
format: (c) => `${
|
|
19224
|
+
format: (c) => `${chalk181.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
19148
19225
|
promptNew: promptConnection3,
|
|
19149
19226
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
19150
19227
|
});
|
|
19151
19228
|
|
|
19152
19229
|
// src/commands/sql/printTable.ts
|
|
19153
|
-
import
|
|
19230
|
+
import chalk182 from "chalk";
|
|
19154
19231
|
function formatCell(value) {
|
|
19155
19232
|
if (value === null || value === void 0) return "";
|
|
19156
19233
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -19159,7 +19236,7 @@ function formatCell(value) {
|
|
|
19159
19236
|
}
|
|
19160
19237
|
function printTable(rows) {
|
|
19161
19238
|
if (rows.length === 0) {
|
|
19162
|
-
console.log(
|
|
19239
|
+
console.log(chalk182.yellow("(no rows)"));
|
|
19163
19240
|
return;
|
|
19164
19241
|
}
|
|
19165
19242
|
const columns = Object.keys(rows[0]);
|
|
@@ -19167,13 +19244,13 @@ function printTable(rows) {
|
|
|
19167
19244
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
19168
19245
|
);
|
|
19169
19246
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
19170
|
-
console.log(
|
|
19171
|
-
console.log(
|
|
19247
|
+
console.log(chalk182.dim(header));
|
|
19248
|
+
console.log(chalk182.dim("-".repeat(header.length)));
|
|
19172
19249
|
for (const row of rows) {
|
|
19173
19250
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
19174
19251
|
console.log(line);
|
|
19175
19252
|
}
|
|
19176
|
-
console.log(
|
|
19253
|
+
console.log(chalk182.dim(`
|
|
19177
19254
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
19178
19255
|
}
|
|
19179
19256
|
|
|
@@ -19233,7 +19310,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
19233
19310
|
}
|
|
19234
19311
|
|
|
19235
19312
|
// src/commands/sql/sqlMutate.ts
|
|
19236
|
-
import
|
|
19313
|
+
import chalk183 from "chalk";
|
|
19237
19314
|
|
|
19238
19315
|
// src/commands/sql/isMutation.ts
|
|
19239
19316
|
var MUTATION_KEYWORDS = [
|
|
@@ -19267,7 +19344,7 @@ function isMutation(sql9) {
|
|
|
19267
19344
|
async function sqlMutate(query, connectionName) {
|
|
19268
19345
|
if (!isMutation(query)) {
|
|
19269
19346
|
console.error(
|
|
19270
|
-
|
|
19347
|
+
chalk183.red(
|
|
19271
19348
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
19272
19349
|
)
|
|
19273
19350
|
);
|
|
@@ -19277,18 +19354,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
19277
19354
|
const pool = await sqlConnect(conn);
|
|
19278
19355
|
try {
|
|
19279
19356
|
const result = await pool.request().query(query);
|
|
19280
|
-
console.log(
|
|
19357
|
+
console.log(chalk183.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
19281
19358
|
} finally {
|
|
19282
19359
|
await pool.close();
|
|
19283
19360
|
}
|
|
19284
19361
|
}
|
|
19285
19362
|
|
|
19286
19363
|
// src/commands/sql/sqlQuery.ts
|
|
19287
|
-
import
|
|
19364
|
+
import chalk184 from "chalk";
|
|
19288
19365
|
async function sqlQuery(query, connectionName) {
|
|
19289
19366
|
if (isMutation(query)) {
|
|
19290
19367
|
console.error(
|
|
19291
|
-
|
|
19368
|
+
chalk184.red(
|
|
19292
19369
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
19293
19370
|
)
|
|
19294
19371
|
);
|
|
@@ -19303,7 +19380,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
19303
19380
|
printTable(rows);
|
|
19304
19381
|
} else {
|
|
19305
19382
|
console.log(
|
|
19306
|
-
|
|
19383
|
+
chalk184.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
19307
19384
|
);
|
|
19308
19385
|
}
|
|
19309
19386
|
} finally {
|
|
@@ -19780,13 +19857,13 @@ function logs(options2) {
|
|
|
19780
19857
|
console.log("No voice log file found");
|
|
19781
19858
|
return;
|
|
19782
19859
|
}
|
|
19783
|
-
const
|
|
19860
|
+
const count8 = Number.parseInt(options2.lines ?? "150", 10);
|
|
19784
19861
|
const content = readFileSync39(voicePaths.log, "utf8").trim();
|
|
19785
19862
|
if (!content) {
|
|
19786
19863
|
console.log("Voice log is empty");
|
|
19787
19864
|
return;
|
|
19788
19865
|
}
|
|
19789
|
-
const lines = content.split("\n").slice(-
|
|
19866
|
+
const lines = content.split("\n").slice(-count8);
|
|
19790
19867
|
for (const line of lines) {
|
|
19791
19868
|
try {
|
|
19792
19869
|
const event = JSON.parse(line);
|
|
@@ -19933,10 +20010,10 @@ function isProcessAlive3(pid) {
|
|
|
19933
20010
|
return false;
|
|
19934
20011
|
}
|
|
19935
20012
|
}
|
|
19936
|
-
function readRecentLogs(
|
|
20013
|
+
function readRecentLogs(count8) {
|
|
19937
20014
|
if (!existsSync47(voicePaths.log)) return [];
|
|
19938
20015
|
const lines = readFileSync41(voicePaths.log, "utf8").trim().split("\n");
|
|
19939
|
-
return lines.slice(-
|
|
20016
|
+
return lines.slice(-count8);
|
|
19940
20017
|
}
|
|
19941
20018
|
function status() {
|
|
19942
20019
|
if (!existsSync47(voicePaths.pid)) {
|
|
@@ -20000,7 +20077,7 @@ function registerVoice(program2) {
|
|
|
20000
20077
|
|
|
20001
20078
|
// src/commands/roam/auth.ts
|
|
20002
20079
|
import { randomBytes } from "crypto";
|
|
20003
|
-
import
|
|
20080
|
+
import chalk185 from "chalk";
|
|
20004
20081
|
|
|
20005
20082
|
// src/commands/roam/waitForCallback.ts
|
|
20006
20083
|
import { createServer as createServer3 } from "http";
|
|
@@ -20131,13 +20208,13 @@ async function auth() {
|
|
|
20131
20208
|
saveGlobalConfig(config);
|
|
20132
20209
|
const state = randomBytes(16).toString("hex");
|
|
20133
20210
|
console.log(
|
|
20134
|
-
|
|
20211
|
+
chalk185.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
20135
20212
|
);
|
|
20136
|
-
console.log(
|
|
20137
|
-
console.log(
|
|
20138
|
-
console.log(
|
|
20213
|
+
console.log(chalk185.white("http://localhost:14523/callback\n"));
|
|
20214
|
+
console.log(chalk185.blue("Opening browser for authorization..."));
|
|
20215
|
+
console.log(chalk185.dim("Waiting for authorization callback..."));
|
|
20139
20216
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
20140
|
-
console.log(
|
|
20217
|
+
console.log(chalk185.dim("Exchanging code for tokens..."));
|
|
20141
20218
|
const tokens = await exchangeToken({
|
|
20142
20219
|
code,
|
|
20143
20220
|
clientId,
|
|
@@ -20153,7 +20230,7 @@ async function auth() {
|
|
|
20153
20230
|
};
|
|
20154
20231
|
saveGlobalConfig(config);
|
|
20155
20232
|
console.log(
|
|
20156
|
-
|
|
20233
|
+
chalk185.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
20157
20234
|
);
|
|
20158
20235
|
}
|
|
20159
20236
|
|
|
@@ -20605,7 +20682,7 @@ import { execSync as execSync52 } from "child_process";
|
|
|
20605
20682
|
import { existsSync as existsSync51, mkdirSync as mkdirSync22, unlinkSync as unlinkSync19, writeFileSync as writeFileSync39 } from "fs";
|
|
20606
20683
|
import { tmpdir as tmpdir7 } from "os";
|
|
20607
20684
|
import { join as join61, resolve as resolve15 } from "path";
|
|
20608
|
-
import
|
|
20685
|
+
import chalk186 from "chalk";
|
|
20609
20686
|
|
|
20610
20687
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
20611
20688
|
var captureWindowPs1 = `
|
|
@@ -20756,13 +20833,13 @@ function screenshot(processName) {
|
|
|
20756
20833
|
const config = loadConfig();
|
|
20757
20834
|
const outputDir = resolve15(config.screenshot.outputDir);
|
|
20758
20835
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
20759
|
-
console.log(
|
|
20836
|
+
console.log(chalk186.gray(`Capturing window for process "${processName}" ...`));
|
|
20760
20837
|
try {
|
|
20761
20838
|
runPowerShellScript(processName, outputPath);
|
|
20762
|
-
console.log(
|
|
20839
|
+
console.log(chalk186.green(`Screenshot saved: ${outputPath}`));
|
|
20763
20840
|
} catch (error) {
|
|
20764
20841
|
const msg = error instanceof Error ? error.message : String(error);
|
|
20765
|
-
console.error(
|
|
20842
|
+
console.error(chalk186.red(`Failed to capture screenshot: ${msg}`));
|
|
20766
20843
|
process.exit(1);
|
|
20767
20844
|
}
|
|
20768
20845
|
}
|
|
@@ -20975,9 +21052,9 @@ async function drainDaemon() {
|
|
|
20975
21052
|
console.log("Sessions daemon is not running; cleared persisted sessions");
|
|
20976
21053
|
return;
|
|
20977
21054
|
}
|
|
20978
|
-
const
|
|
21055
|
+
const count8 = await requestDrain(socket);
|
|
20979
21056
|
socket.destroy();
|
|
20980
|
-
console.log(`Drained ${
|
|
21057
|
+
console.log(`Drained ${count8} session(s)`);
|
|
20981
21058
|
}
|
|
20982
21059
|
function requestDrain(socket) {
|
|
20983
21060
|
socket.write(`${JSON.stringify({ type: "drain" })}
|
|
@@ -21763,10 +21840,10 @@ function applyReviewPause(session, activity2) {
|
|
|
21763
21840
|
}
|
|
21764
21841
|
|
|
21765
21842
|
// src/shared/db/getPhaseActiveMs.ts
|
|
21766
|
-
import { and as
|
|
21843
|
+
import { and as and17, eq as eq36 } from "drizzle-orm";
|
|
21767
21844
|
async function getPhaseActiveMs(db, itemId, phaseIdx) {
|
|
21768
21845
|
const [row] = await db.select({ activeMs: phaseUsage.activeMs }).from(phaseUsage).where(
|
|
21769
|
-
|
|
21846
|
+
and17(eq36(phaseUsage.itemId, itemId), eq36(phaseUsage.phaseIdx, phaseIdx))
|
|
21770
21847
|
);
|
|
21771
21848
|
return row?.activeMs ?? 0;
|
|
21772
21849
|
}
|
|
@@ -23278,7 +23355,7 @@ function registerDaemon(program2) {
|
|
|
23278
23355
|
|
|
23279
23356
|
// src/commands/sessions/summarise/index.ts
|
|
23280
23357
|
import * as fs36 from "fs";
|
|
23281
|
-
import
|
|
23358
|
+
import chalk187 from "chalk";
|
|
23282
23359
|
|
|
23283
23360
|
// src/commands/sessions/summarise/shared.ts
|
|
23284
23361
|
import * as fs34 from "fs";
|
|
@@ -23432,22 +23509,22 @@ ${firstMessage}`);
|
|
|
23432
23509
|
async function summarise2(options2) {
|
|
23433
23510
|
const files = await discoverSessionFiles();
|
|
23434
23511
|
if (files.length === 0) {
|
|
23435
|
-
console.log(
|
|
23512
|
+
console.log(chalk187.yellow("No sessions found."));
|
|
23436
23513
|
return;
|
|
23437
23514
|
}
|
|
23438
23515
|
const toProcess = selectCandidates(files, options2);
|
|
23439
23516
|
if (toProcess.length === 0) {
|
|
23440
|
-
console.log(
|
|
23517
|
+
console.log(chalk187.green("All sessions already summarised."));
|
|
23441
23518
|
return;
|
|
23442
23519
|
}
|
|
23443
23520
|
console.log(
|
|
23444
|
-
|
|
23521
|
+
chalk187.cyan(
|
|
23445
23522
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
23446
23523
|
)
|
|
23447
23524
|
);
|
|
23448
23525
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
23449
23526
|
console.log(
|
|
23450
|
-
|
|
23527
|
+
chalk187.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk187.yellow(`, ${failed2} skipped`) : "")
|
|
23451
23528
|
);
|
|
23452
23529
|
}
|
|
23453
23530
|
function selectCandidates(files, options2) {
|
|
@@ -23467,16 +23544,16 @@ function processSessions(files) {
|
|
|
23467
23544
|
let failed2 = 0;
|
|
23468
23545
|
for (let i = 0; i < files.length; i++) {
|
|
23469
23546
|
const file = files[i];
|
|
23470
|
-
process.stdout.write(
|
|
23547
|
+
process.stdout.write(chalk187.dim(` [${i + 1}/${files.length}] `));
|
|
23471
23548
|
const summary = summariseSession(file);
|
|
23472
23549
|
if (summary) {
|
|
23473
23550
|
writeSummary(file, summary);
|
|
23474
23551
|
succeeded++;
|
|
23475
|
-
process.stdout.write(`${
|
|
23552
|
+
process.stdout.write(`${chalk187.green("\u2713")} ${summary}
|
|
23476
23553
|
`);
|
|
23477
23554
|
} else {
|
|
23478
23555
|
failed2++;
|
|
23479
|
-
process.stdout.write(` ${
|
|
23556
|
+
process.stdout.write(` ${chalk187.yellow("skip")}
|
|
23480
23557
|
`);
|
|
23481
23558
|
}
|
|
23482
23559
|
}
|
|
@@ -23494,10 +23571,10 @@ function registerSessions(program2) {
|
|
|
23494
23571
|
}
|
|
23495
23572
|
|
|
23496
23573
|
// src/commands/statusLine.ts
|
|
23497
|
-
import
|
|
23574
|
+
import chalk189 from "chalk";
|
|
23498
23575
|
|
|
23499
23576
|
// src/commands/buildLimitsSegment.ts
|
|
23500
|
-
import
|
|
23577
|
+
import chalk188 from "chalk";
|
|
23501
23578
|
|
|
23502
23579
|
// src/shared/rateLimitLevel.ts
|
|
23503
23580
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -23528,9 +23605,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
23528
23605
|
|
|
23529
23606
|
// src/commands/buildLimitsSegment.ts
|
|
23530
23607
|
var LEVEL_COLOR = {
|
|
23531
|
-
ok:
|
|
23532
|
-
warn:
|
|
23533
|
-
over:
|
|
23608
|
+
ok: chalk188.green,
|
|
23609
|
+
warn: chalk188.yellow,
|
|
23610
|
+
over: chalk188.red
|
|
23534
23611
|
};
|
|
23535
23612
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
23536
23613
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -23579,14 +23656,14 @@ async function relayUsage(claudeSessionId, totalIn, totalOut) {
|
|
|
23579
23656
|
}
|
|
23580
23657
|
|
|
23581
23658
|
// src/commands/statusLine.ts
|
|
23582
|
-
|
|
23659
|
+
chalk189.level = 3;
|
|
23583
23660
|
function formatNumber(num) {
|
|
23584
23661
|
return num.toLocaleString("en-US");
|
|
23585
23662
|
}
|
|
23586
23663
|
function colorizePercent(pct) {
|
|
23587
23664
|
const label2 = `${Math.round(pct)}%`;
|
|
23588
|
-
if (pct > 80) return
|
|
23589
|
-
if (pct > 40) return
|
|
23665
|
+
if (pct > 80) return chalk189.red(label2);
|
|
23666
|
+
if (pct > 40) return chalk189.yellow(label2);
|
|
23590
23667
|
return label2;
|
|
23591
23668
|
}
|
|
23592
23669
|
async function statusLine() {
|
|
@@ -23611,7 +23688,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
23611
23688
|
// src/commands/sync/syncClaudeMd.ts
|
|
23612
23689
|
import * as fs37 from "fs";
|
|
23613
23690
|
import * as path53 from "path";
|
|
23614
|
-
import
|
|
23691
|
+
import chalk190 from "chalk";
|
|
23615
23692
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
23616
23693
|
const source = path53.join(claudeDir, "CLAUDE.md");
|
|
23617
23694
|
const target = path53.join(targetBase, "CLAUDE.md");
|
|
@@ -23620,12 +23697,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
23620
23697
|
const targetContent = fs37.readFileSync(target, "utf8");
|
|
23621
23698
|
if (sourceContent !== targetContent) {
|
|
23622
23699
|
console.log(
|
|
23623
|
-
|
|
23700
|
+
chalk190.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
23624
23701
|
);
|
|
23625
23702
|
console.log();
|
|
23626
23703
|
printDiff(targetContent, sourceContent);
|
|
23627
23704
|
const confirm = options2?.yes || await promptConfirm(
|
|
23628
|
-
|
|
23705
|
+
chalk190.red("Overwrite existing CLAUDE.md?"),
|
|
23629
23706
|
false
|
|
23630
23707
|
);
|
|
23631
23708
|
if (!confirm) {
|
|
@@ -23641,7 +23718,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
23641
23718
|
// src/commands/sync/syncSettings.ts
|
|
23642
23719
|
import * as fs38 from "fs";
|
|
23643
23720
|
import * as path54 from "path";
|
|
23644
|
-
import
|
|
23721
|
+
import chalk191 from "chalk";
|
|
23645
23722
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
23646
23723
|
const source = path54.join(claudeDir, "settings.json");
|
|
23647
23724
|
const target = path54.join(targetBase, "settings.json");
|
|
@@ -23660,14 +23737,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
23660
23737
|
if (mergedContent !== normalizedTarget) {
|
|
23661
23738
|
if (!options2?.yes) {
|
|
23662
23739
|
console.log(
|
|
23663
|
-
|
|
23740
|
+
chalk191.yellow(
|
|
23664
23741
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
23665
23742
|
)
|
|
23666
23743
|
);
|
|
23667
23744
|
console.log();
|
|
23668
23745
|
printDiff(targetContent, mergedContent);
|
|
23669
23746
|
const confirm = await promptConfirm(
|
|
23670
|
-
|
|
23747
|
+
chalk191.red("Overwrite existing settings.json?"),
|
|
23671
23748
|
false
|
|
23672
23749
|
);
|
|
23673
23750
|
if (!confirm) {
|