@staff0rd/assist 0.233.2 → 0.235.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/index.js +522 -433
- 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.235.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -4933,13 +4933,13 @@ async function activity(options2) {
|
|
|
4933
4933
|
const activeDays = data.filter((d) => d.count > 0).length;
|
|
4934
4934
|
console.log(`${total} commits across ${activeDays} active days.`);
|
|
4935
4935
|
const weekly = /* @__PURE__ */ new Map();
|
|
4936
|
-
for (const { date, count:
|
|
4936
|
+
for (const { date, count: count6 } of data) {
|
|
4937
4937
|
const d = new Date(date);
|
|
4938
4938
|
d.setDate(d.getDate() - d.getDay());
|
|
4939
4939
|
const weekStart = d.toISOString().slice(0, 10);
|
|
4940
|
-
weekly.set(weekStart, (weekly.get(weekStart) ?? 0) +
|
|
4940
|
+
weekly.set(weekStart, (weekly.get(weekStart) ?? 0) + count6);
|
|
4941
4941
|
}
|
|
4942
|
-
const weeklyData = [...weekly.entries()].map(([date,
|
|
4942
|
+
const weeklyData = [...weekly.entries()].map(([date, count6]) => ({ date, count: count6 })).sort((a, b) => a.date.localeCompare(b.date));
|
|
4943
4943
|
const until = data[data.length - 1].date;
|
|
4944
4944
|
activityChart(weeklyData, { since, until });
|
|
4945
4945
|
}
|
|
@@ -5701,6 +5701,85 @@ function registerLinkCommands(cmd) {
|
|
|
5701
5701
|
cmd.command("unlink <from> <to>").description("Remove a link between two backlog items").action(unlink);
|
|
5702
5702
|
}
|
|
5703
5703
|
|
|
5704
|
+
// src/commands/backlog/move-repo/index.ts
|
|
5705
|
+
import chalk62 from "chalk";
|
|
5706
|
+
import { eq as eq19 } from "drizzle-orm";
|
|
5707
|
+
|
|
5708
|
+
// src/commands/backlog/move-repo/confirmMove.ts
|
|
5709
|
+
import chalk61 from "chalk";
|
|
5710
|
+
function pluralItems(n) {
|
|
5711
|
+
return `${n} item${n === 1 ? "" : "s"}`;
|
|
5712
|
+
}
|
|
5713
|
+
async function confirmMove(cnt, oldOrigin, newOrigin) {
|
|
5714
|
+
console.log(
|
|
5715
|
+
`${pluralItems(cnt)}: ${chalk61.cyan(oldOrigin)} \u2192 ${chalk61.cyan(newOrigin)}`
|
|
5716
|
+
);
|
|
5717
|
+
return promptConfirm(`Retag ${pluralItems(cnt)}?`);
|
|
5718
|
+
}
|
|
5719
|
+
|
|
5720
|
+
// src/commands/backlog/move-repo/countByOrigin.ts
|
|
5721
|
+
import { count as count3, eq as eq18 } from "drizzle-orm";
|
|
5722
|
+
async function countByOrigin(orm, origin) {
|
|
5723
|
+
const [{ cnt }] = await orm.select({ cnt: count3() }).from(items).where(eq18(items.origin, origin));
|
|
5724
|
+
return cnt;
|
|
5725
|
+
}
|
|
5726
|
+
|
|
5727
|
+
// src/commands/backlog/move-repo/resolveOldOrigin.ts
|
|
5728
|
+
async function resolveOldOrigin(orm, input) {
|
|
5729
|
+
const rows = await orm.selectDistinct({ origin: items.origin }).from(items);
|
|
5730
|
+
const origins = rows.map((r) => r.origin);
|
|
5731
|
+
if (origins.includes(input)) return { origin: input };
|
|
5732
|
+
const suffix = `/${input.toLowerCase()}`;
|
|
5733
|
+
const candidates = origins.filter((o) => o.toLowerCase().endsWith(suffix));
|
|
5734
|
+
if (candidates.length === 1) return { origin: candidates[0] };
|
|
5735
|
+
if (candidates.length > 1) {
|
|
5736
|
+
return {
|
|
5737
|
+
error: `Multiple origins match "${input}":
|
|
5738
|
+
${candidates.join("\n ")}
|
|
5739
|
+
Pass the full origin.`
|
|
5740
|
+
};
|
|
5741
|
+
}
|
|
5742
|
+
return { error: `No backlog items found under origin "${input}".` };
|
|
5743
|
+
}
|
|
5744
|
+
|
|
5745
|
+
// src/commands/backlog/move-repo/index.ts
|
|
5746
|
+
function fail2(message) {
|
|
5747
|
+
console.log(chalk62.red(message));
|
|
5748
|
+
process.exitCode = 1;
|
|
5749
|
+
}
|
|
5750
|
+
async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
5751
|
+
const newOrigin = newOriginRaw ? normalizeOrigin(newOriginRaw) : getOrigin();
|
|
5752
|
+
const { orm } = await getReady();
|
|
5753
|
+
const resolved = await resolveOldOrigin(orm, normalizeOrigin(oldOriginRaw));
|
|
5754
|
+
if ("error" in resolved) return fail2(resolved.error);
|
|
5755
|
+
const oldOrigin = resolved.origin;
|
|
5756
|
+
if (oldOrigin === newOrigin) {
|
|
5757
|
+
return fail2(
|
|
5758
|
+
`Old and new origins both resolve to "${oldOrigin}"; nothing to move.`
|
|
5759
|
+
);
|
|
5760
|
+
}
|
|
5761
|
+
const cnt = await countByOrigin(orm, oldOrigin);
|
|
5762
|
+
if (!options2.yes && !await confirmMove(cnt, oldOrigin, newOrigin)) {
|
|
5763
|
+
console.log(chalk62.yellow("Move cancelled; no changes made."));
|
|
5764
|
+
return;
|
|
5765
|
+
}
|
|
5766
|
+
await orm.update(items).set({ origin: newOrigin }).where(eq19(items.origin, oldOrigin));
|
|
5767
|
+
console.log(
|
|
5768
|
+
chalk62.green(
|
|
5769
|
+
`Moved ${pluralItems(cnt)} from "${oldOrigin}" to "${newOrigin}".`
|
|
5770
|
+
)
|
|
5771
|
+
);
|
|
5772
|
+
}
|
|
5773
|
+
|
|
5774
|
+
// src/commands/backlog/registerMoveRepoCommand.ts
|
|
5775
|
+
function registerMoveRepoCommand(cmd) {
|
|
5776
|
+
cmd.command("move-repo <old-origin> [new-origin]").description(
|
|
5777
|
+
"Retag all items from one origin to another after a repo rename (new origin defaults to the current repo's remote)"
|
|
5778
|
+
).option("-y, --yes", "Skip the confirmation prompt").action(
|
|
5779
|
+
(oldOrigin, newOrigin, options2) => moveRepo(oldOrigin, newOrigin, options2)
|
|
5780
|
+
);
|
|
5781
|
+
}
|
|
5782
|
+
|
|
5704
5783
|
// src/commands/backlog/registerPlanCommands.ts
|
|
5705
5784
|
function registerPlanCommands(cmd) {
|
|
5706
5785
|
cmd.command("plan <id>").description("Display the plan for a backlog item").action(plan);
|
|
@@ -5708,7 +5787,7 @@ function registerPlanCommands(cmd) {
|
|
|
5708
5787
|
}
|
|
5709
5788
|
|
|
5710
5789
|
// src/commands/backlog/rewindPhase.ts
|
|
5711
|
-
import
|
|
5790
|
+
import chalk63 from "chalk";
|
|
5712
5791
|
function validateRewind2(item, phaseNumber) {
|
|
5713
5792
|
if (!item.plan || item.plan.length === 0) {
|
|
5714
5793
|
return `Item #${item.id} has no plan phases.`;
|
|
@@ -5728,12 +5807,12 @@ async function rewindPhase(id, phase, opts) {
|
|
|
5728
5807
|
const { orm } = await getReady();
|
|
5729
5808
|
const item = await loadItem(orm, Number.parseInt(id, 10));
|
|
5730
5809
|
if (!item) {
|
|
5731
|
-
console.log(
|
|
5810
|
+
console.log(chalk63.red(`Item #${id} not found.`));
|
|
5732
5811
|
return;
|
|
5733
5812
|
}
|
|
5734
5813
|
const error = validateRewind2(item, phaseNumber);
|
|
5735
5814
|
if (error) {
|
|
5736
|
-
console.log(
|
|
5815
|
+
console.log(chalk63.red(error));
|
|
5737
5816
|
process.exitCode = 1;
|
|
5738
5817
|
return;
|
|
5739
5818
|
}
|
|
@@ -5751,7 +5830,7 @@ async function rewindPhase(id, phase, opts) {
|
|
|
5751
5830
|
targetPhase: phaseIndex
|
|
5752
5831
|
});
|
|
5753
5832
|
console.log(
|
|
5754
|
-
|
|
5833
|
+
chalk63.green(`Rewound item #${id} to phase ${phaseNumber} (${phaseName}).`)
|
|
5755
5834
|
);
|
|
5756
5835
|
}
|
|
5757
5836
|
|
|
@@ -5769,22 +5848,22 @@ function registerRunCommand(cmd) {
|
|
|
5769
5848
|
}
|
|
5770
5849
|
|
|
5771
5850
|
// src/commands/backlog/search/index.ts
|
|
5772
|
-
import
|
|
5851
|
+
import chalk64 from "chalk";
|
|
5773
5852
|
async function search(query) {
|
|
5774
5853
|
const items2 = await searchBacklog(query);
|
|
5775
5854
|
if (items2.length === 0) {
|
|
5776
|
-
console.log(
|
|
5855
|
+
console.log(chalk64.dim(`No items matching "${query}".`));
|
|
5777
5856
|
return;
|
|
5778
5857
|
}
|
|
5779
5858
|
console.log(
|
|
5780
|
-
|
|
5859
|
+
chalk64.dim(
|
|
5781
5860
|
`${items2.length} item${items2.length === 1 ? "" : "s"} matching "${query}":
|
|
5782
5861
|
`
|
|
5783
5862
|
)
|
|
5784
5863
|
);
|
|
5785
5864
|
for (const item of items2) {
|
|
5786
5865
|
console.log(
|
|
5787
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
5866
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk64.dim(`#${item.id}`)} ${item.name}`
|
|
5788
5867
|
);
|
|
5789
5868
|
}
|
|
5790
5869
|
}
|
|
@@ -5795,16 +5874,16 @@ function registerSearchCommand(cmd) {
|
|
|
5795
5874
|
}
|
|
5796
5875
|
|
|
5797
5876
|
// src/commands/backlog/delete/index.ts
|
|
5798
|
-
import
|
|
5877
|
+
import chalk65 from "chalk";
|
|
5799
5878
|
async function del(id) {
|
|
5800
5879
|
const name = await removeItem(id);
|
|
5801
5880
|
if (name) {
|
|
5802
|
-
console.log(
|
|
5881
|
+
console.log(chalk65.green(`Deleted item #${id}: ${name}`));
|
|
5803
5882
|
}
|
|
5804
5883
|
}
|
|
5805
5884
|
|
|
5806
5885
|
// src/commands/backlog/done/index.ts
|
|
5807
|
-
import
|
|
5886
|
+
import chalk66 from "chalk";
|
|
5808
5887
|
async function done(id, summary) {
|
|
5809
5888
|
const found = await findOneItem(id);
|
|
5810
5889
|
if (!found) return;
|
|
@@ -5814,12 +5893,12 @@ async function done(id, summary) {
|
|
|
5814
5893
|
const pending = item.plan.slice(completedCount);
|
|
5815
5894
|
if (pending.length > 0) {
|
|
5816
5895
|
console.log(
|
|
5817
|
-
|
|
5896
|
+
chalk66.red(
|
|
5818
5897
|
`Cannot complete item #${id}: ${pending.length} pending phase(s):`
|
|
5819
5898
|
)
|
|
5820
5899
|
);
|
|
5821
5900
|
for (const phase of pending) {
|
|
5822
|
-
console.log(
|
|
5901
|
+
console.log(chalk66.yellow(` - ${phase.name}`));
|
|
5823
5902
|
}
|
|
5824
5903
|
process.exitCode = 1;
|
|
5825
5904
|
return;
|
|
@@ -5830,35 +5909,35 @@ async function done(id, summary) {
|
|
|
5830
5909
|
const phase = item.currentPhase ?? 1;
|
|
5831
5910
|
await appendComment(orm, item.id, summary, { phase, type: "summary" });
|
|
5832
5911
|
}
|
|
5833
|
-
console.log(
|
|
5912
|
+
console.log(chalk66.green(`Completed item #${id}: ${item.name}`));
|
|
5834
5913
|
}
|
|
5835
5914
|
|
|
5836
5915
|
// src/commands/backlog/start/index.ts
|
|
5837
|
-
import
|
|
5916
|
+
import chalk67 from "chalk";
|
|
5838
5917
|
async function start(id) {
|
|
5839
5918
|
const name = await setStatus(id, "in-progress");
|
|
5840
5919
|
if (name) {
|
|
5841
|
-
console.log(
|
|
5920
|
+
console.log(chalk67.green(`Started item #${id}: ${name}`));
|
|
5842
5921
|
}
|
|
5843
5922
|
}
|
|
5844
5923
|
|
|
5845
5924
|
// src/commands/backlog/stop/index.ts
|
|
5846
|
-
import
|
|
5847
|
-
import { and as and5, eq as
|
|
5925
|
+
import chalk68 from "chalk";
|
|
5926
|
+
import { and as and5, eq as eq20 } from "drizzle-orm";
|
|
5848
5927
|
async function stop() {
|
|
5849
5928
|
const { orm } = await getReady();
|
|
5850
|
-
const stopped = await orm.update(items).set({ status: "todo", currentPhase: 1 }).where(and5(
|
|
5929
|
+
const stopped = await orm.update(items).set({ status: "todo", currentPhase: 1 }).where(and5(eq20(items.status, "in-progress"), eq20(items.origin, getOrigin()))).returning({ id: items.id, name: items.name });
|
|
5851
5930
|
if (stopped.length === 0) {
|
|
5852
|
-
console.log(
|
|
5931
|
+
console.log(chalk68.yellow("No in-progress items to stop."));
|
|
5853
5932
|
return;
|
|
5854
5933
|
}
|
|
5855
5934
|
for (const item of stopped) {
|
|
5856
|
-
console.log(
|
|
5935
|
+
console.log(chalk68.yellow(`Stopped item #${item.id}: ${item.name}`));
|
|
5857
5936
|
}
|
|
5858
5937
|
}
|
|
5859
5938
|
|
|
5860
5939
|
// src/commands/backlog/wontdo/index.ts
|
|
5861
|
-
import
|
|
5940
|
+
import chalk69 from "chalk";
|
|
5862
5941
|
async function wontdo(id, reason) {
|
|
5863
5942
|
const found = await findOneItem(id);
|
|
5864
5943
|
if (!found) return;
|
|
@@ -5868,7 +5947,7 @@ async function wontdo(id, reason) {
|
|
|
5868
5947
|
const phase = item.currentPhase ?? 1;
|
|
5869
5948
|
await appendComment(orm, item.id, reason, { phase, type: "summary" });
|
|
5870
5949
|
}
|
|
5871
|
-
console.log(
|
|
5950
|
+
console.log(chalk69.red(`Won't do item #${id}: ${item.name}`));
|
|
5872
5951
|
}
|
|
5873
5952
|
|
|
5874
5953
|
// src/commands/backlog/registerStatusCommands.ts
|
|
@@ -5881,22 +5960,22 @@ function registerStatusCommands(cmd) {
|
|
|
5881
5960
|
}
|
|
5882
5961
|
|
|
5883
5962
|
// src/commands/backlog/removePhase.ts
|
|
5884
|
-
import
|
|
5885
|
-
import { and as and8, eq as
|
|
5963
|
+
import chalk71 from "chalk";
|
|
5964
|
+
import { and as and8, eq as eq23 } from "drizzle-orm";
|
|
5886
5965
|
|
|
5887
5966
|
// src/commands/backlog/findPhase.ts
|
|
5888
|
-
import
|
|
5889
|
-
import { and as and6, count as
|
|
5967
|
+
import chalk70 from "chalk";
|
|
5968
|
+
import { and as and6, count as count4, eq as eq21 } from "drizzle-orm";
|
|
5890
5969
|
async function findPhase(id, phase) {
|
|
5891
5970
|
const found = await findOneItem(id);
|
|
5892
5971
|
if (!found) return void 0;
|
|
5893
5972
|
const { orm, item } = found;
|
|
5894
5973
|
const itemId = item.id;
|
|
5895
5974
|
const phaseIdx = Number.parseInt(phase, 10) - 1;
|
|
5896
|
-
const [row] = await orm.select({ cnt:
|
|
5975
|
+
const [row] = await orm.select({ cnt: count4() }).from(planPhases).where(and6(eq21(planPhases.itemId, itemId), eq21(planPhases.idx, phaseIdx)));
|
|
5897
5976
|
if (!row || row.cnt === 0) {
|
|
5898
5977
|
console.log(
|
|
5899
|
-
|
|
5978
|
+
chalk70.red(`Phase ${phaseIdx + 1} not found on item #${itemId}.`)
|
|
5900
5979
|
);
|
|
5901
5980
|
process.exitCode = 1;
|
|
5902
5981
|
return void 0;
|
|
@@ -5905,14 +5984,14 @@ async function findPhase(id, phase) {
|
|
|
5905
5984
|
}
|
|
5906
5985
|
|
|
5907
5986
|
// src/commands/backlog/reindexPhases.ts
|
|
5908
|
-
import { and as and7, asc as asc4, count as
|
|
5987
|
+
import { and as and7, asc as asc4, count as count5, eq as eq22 } from "drizzle-orm";
|
|
5909
5988
|
async function reindexPhases(db, itemId) {
|
|
5910
|
-
const remaining = await db.select({ idx: planPhases.idx }).from(planPhases).where(
|
|
5989
|
+
const remaining = await db.select({ idx: planPhases.idx }).from(planPhases).where(eq22(planPhases.itemId, itemId)).orderBy(asc4(planPhases.idx));
|
|
5911
5990
|
for (let i = 0; i < remaining.length; i++) {
|
|
5912
5991
|
const oldIdx = remaining[i].idx;
|
|
5913
5992
|
if (oldIdx === i) continue;
|
|
5914
|
-
await db.update(planTasks).set({ phaseIdx: i }).where(and7(
|
|
5915
|
-
await db.update(planPhases).set({ idx: i }).where(and7(
|
|
5993
|
+
await db.update(planTasks).set({ phaseIdx: i }).where(and7(eq22(planTasks.itemId, itemId), eq22(planTasks.phaseIdx, oldIdx)));
|
|
5994
|
+
await db.update(planPhases).set({ idx: i }).where(and7(eq22(planPhases.itemId, itemId), eq22(planPhases.idx, oldIdx)));
|
|
5916
5995
|
}
|
|
5917
5996
|
}
|
|
5918
5997
|
async function adjustCurrentPhase(db, item, removedIdx) {
|
|
@@ -5920,13 +5999,13 @@ async function adjustCurrentPhase(db, item, removedIdx) {
|
|
|
5920
5999
|
if (currentPhase === void 0) return;
|
|
5921
6000
|
const currentIdx = currentPhase - 1;
|
|
5922
6001
|
if (removedIdx < currentIdx) {
|
|
5923
|
-
await db.update(items).set({ currentPhase: currentPhase - 1 }).where(
|
|
6002
|
+
await db.update(items).set({ currentPhase: currentPhase - 1 }).where(eq22(items.id, item.id));
|
|
5924
6003
|
return;
|
|
5925
6004
|
}
|
|
5926
6005
|
if (removedIdx !== currentIdx) return;
|
|
5927
|
-
const [row] = await db.select({ cnt:
|
|
6006
|
+
const [row] = await db.select({ cnt: count5() }).from(planPhases).where(eq22(planPhases.itemId, item.id));
|
|
5928
6007
|
const cnt = row?.cnt ?? 0;
|
|
5929
|
-
await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(
|
|
6008
|
+
await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(eq22(items.id, item.id));
|
|
5930
6009
|
}
|
|
5931
6010
|
|
|
5932
6011
|
// src/commands/backlog/removePhase.ts
|
|
@@ -5936,20 +6015,20 @@ async function removePhase(id, phase) {
|
|
|
5936
6015
|
const { item, orm, itemId, phaseIdx } = found;
|
|
5937
6016
|
await orm.transaction(async (tx) => {
|
|
5938
6017
|
await tx.delete(planTasks).where(
|
|
5939
|
-
and8(
|
|
6018
|
+
and8(eq23(planTasks.itemId, itemId), eq23(planTasks.phaseIdx, phaseIdx))
|
|
5940
6019
|
);
|
|
5941
|
-
await tx.delete(planPhases).where(and8(
|
|
6020
|
+
await tx.delete(planPhases).where(and8(eq23(planPhases.itemId, itemId), eq23(planPhases.idx, phaseIdx)));
|
|
5942
6021
|
await reindexPhases(tx, itemId);
|
|
5943
6022
|
await adjustCurrentPhase(tx, item, phaseIdx);
|
|
5944
6023
|
});
|
|
5945
6024
|
console.log(
|
|
5946
|
-
|
|
6025
|
+
chalk71.green(`Removed phase ${phaseIdx + 1} from item #${itemId}.`)
|
|
5947
6026
|
);
|
|
5948
6027
|
}
|
|
5949
6028
|
|
|
5950
6029
|
// src/commands/backlog/update/index.ts
|
|
5951
|
-
import
|
|
5952
|
-
import { eq as
|
|
6030
|
+
import chalk73 from "chalk";
|
|
6031
|
+
import { eq as eq24 } from "drizzle-orm";
|
|
5953
6032
|
|
|
5954
6033
|
// src/commands/backlog/update/parseListIndex.ts
|
|
5955
6034
|
function parseListIndex(raw, length, label2) {
|
|
@@ -6024,16 +6103,16 @@ function applyAcMutations(current, options2) {
|
|
|
6024
6103
|
}
|
|
6025
6104
|
|
|
6026
6105
|
// src/commands/backlog/update/buildUpdateValues.ts
|
|
6027
|
-
import
|
|
6106
|
+
import chalk72 from "chalk";
|
|
6028
6107
|
function buildUpdateValues(options2) {
|
|
6029
6108
|
const { name, desc: desc2, type, ac } = options2;
|
|
6030
6109
|
if (!name && !desc2 && !type && !ac) {
|
|
6031
|
-
console.log(
|
|
6110
|
+
console.log(chalk72.red("Nothing to update. Provide at least one flag."));
|
|
6032
6111
|
process.exitCode = 1;
|
|
6033
6112
|
return void 0;
|
|
6034
6113
|
}
|
|
6035
6114
|
if (type && type !== "story" && type !== "bug") {
|
|
6036
|
-
console.log(
|
|
6115
|
+
console.log(chalk72.red('Invalid type. Must be "story" or "bug".'));
|
|
6037
6116
|
process.exitCode = 1;
|
|
6038
6117
|
return void 0;
|
|
6039
6118
|
}
|
|
@@ -6066,14 +6145,14 @@ async function update(id, options2) {
|
|
|
6066
6145
|
if (hasAcMutations(options2)) {
|
|
6067
6146
|
if (options2.ac) {
|
|
6068
6147
|
console.log(
|
|
6069
|
-
|
|
6148
|
+
chalk73.red("Cannot combine --ac with --add-ac/--edit-ac/--remove-ac.")
|
|
6070
6149
|
);
|
|
6071
6150
|
process.exitCode = 1;
|
|
6072
6151
|
return;
|
|
6073
6152
|
}
|
|
6074
6153
|
const mutation = applyAcMutations(found.item.acceptanceCriteria, options2);
|
|
6075
6154
|
if (!mutation.ok) {
|
|
6076
|
-
console.log(
|
|
6155
|
+
console.log(chalk73.red(mutation.error));
|
|
6077
6156
|
process.exitCode = 1;
|
|
6078
6157
|
return;
|
|
6079
6158
|
}
|
|
@@ -6083,30 +6162,30 @@ async function update(id, options2) {
|
|
|
6083
6162
|
if (!built) return;
|
|
6084
6163
|
const { orm } = found;
|
|
6085
6164
|
const itemId = found.item.id;
|
|
6086
|
-
await orm.update(items).set(built.set).where(
|
|
6087
|
-
console.log(
|
|
6165
|
+
await orm.update(items).set(built.set).where(eq24(items.id, itemId));
|
|
6166
|
+
console.log(chalk73.green(`Updated ${built.fields} on item #${itemId}.`));
|
|
6088
6167
|
}
|
|
6089
6168
|
|
|
6090
6169
|
// src/commands/backlog/updatePhase.ts
|
|
6091
|
-
import
|
|
6170
|
+
import chalk74 from "chalk";
|
|
6092
6171
|
|
|
6093
6172
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
6094
|
-
import { and as and9, eq as
|
|
6173
|
+
import { and as and9, eq as eq25 } from "drizzle-orm";
|
|
6095
6174
|
async function applyPhaseUpdate(orm, itemId, phaseIdx, fields) {
|
|
6096
6175
|
await orm.transaction(async (tx) => {
|
|
6097
6176
|
if (fields.name) {
|
|
6098
6177
|
await tx.update(planPhases).set({ name: fields.name }).where(
|
|
6099
|
-
and9(
|
|
6178
|
+
and9(eq25(planPhases.itemId, itemId), eq25(planPhases.idx, phaseIdx))
|
|
6100
6179
|
);
|
|
6101
6180
|
}
|
|
6102
6181
|
if (fields.manualCheck) {
|
|
6103
6182
|
await tx.update(planPhases).set({ manualChecks: JSON.stringify(fields.manualCheck) }).where(
|
|
6104
|
-
and9(
|
|
6183
|
+
and9(eq25(planPhases.itemId, itemId), eq25(planPhases.idx, phaseIdx))
|
|
6105
6184
|
);
|
|
6106
6185
|
}
|
|
6107
6186
|
if (fields.task) {
|
|
6108
6187
|
await tx.delete(planTasks).where(
|
|
6109
|
-
and9(
|
|
6188
|
+
and9(eq25(planTasks.itemId, itemId), eq25(planTasks.phaseIdx, phaseIdx))
|
|
6110
6189
|
);
|
|
6111
6190
|
if (fields.task.length) {
|
|
6112
6191
|
await tx.insert(planTasks).values(
|
|
@@ -6192,7 +6271,7 @@ async function updatePhase(id, phase, options2) {
|
|
|
6192
6271
|
const { item, orm, itemId, phaseIdx } = found;
|
|
6193
6272
|
const resolved = resolvePhaseFields(options2, item.plan?.[phaseIdx]);
|
|
6194
6273
|
if (!resolved.ok) {
|
|
6195
|
-
console.log(
|
|
6274
|
+
console.log(chalk74.red(resolved.error));
|
|
6196
6275
|
process.exitCode = 1;
|
|
6197
6276
|
return;
|
|
6198
6277
|
}
|
|
@@ -6204,7 +6283,7 @@ async function updatePhase(id, phase, options2) {
|
|
|
6204
6283
|
manualCheck && "manual checks"
|
|
6205
6284
|
].filter(Boolean).join(", ");
|
|
6206
6285
|
console.log(
|
|
6207
|
-
|
|
6286
|
+
chalk74.green(
|
|
6208
6287
|
`Updated ${fields} on phase ${phaseIdx + 1} of item #${itemId}.`
|
|
6209
6288
|
)
|
|
6210
6289
|
);
|
|
@@ -6243,29 +6322,39 @@ function registerShowCommands(cmd) {
|
|
|
6243
6322
|
function registerWebCommand(cmd) {
|
|
6244
6323
|
cmd.command("web").description("Open the backlog tab in the web dashboard").option("-p, --port <number>", "Port to listen on", "3100").action(web2);
|
|
6245
6324
|
}
|
|
6325
|
+
function registerRefineCommand(cmd) {
|
|
6326
|
+
cmd.command("refine").argument("[id]", "Backlog item ID").description("Alias for refine").action((id) => refine(id));
|
|
6327
|
+
}
|
|
6246
6328
|
function registerNextCommand(cmd) {
|
|
6247
6329
|
cmd.command("next").description("Pick and run the next backlog item, or open /draft if none").option("-w, --write", "Run Claude with auto permission mode (default)").option("--no-write", "Run Claude without auto permission mode").action(
|
|
6248
6330
|
(opts) => next({ allowEdits: opts.write !== false })
|
|
6249
6331
|
);
|
|
6250
6332
|
}
|
|
6333
|
+
var registrars = [
|
|
6334
|
+
registerItemCommands,
|
|
6335
|
+
registerShowCommands,
|
|
6336
|
+
registerStatusCommands,
|
|
6337
|
+
registerWebCommand,
|
|
6338
|
+
registerCommentCommands,
|
|
6339
|
+
registerLinkCommands,
|
|
6340
|
+
registerPlanCommands,
|
|
6341
|
+
registerRewindCommand,
|
|
6342
|
+
registerNextCommand,
|
|
6343
|
+
registerRefineCommand,
|
|
6344
|
+
registerRunCommand,
|
|
6345
|
+
registerSearchCommand,
|
|
6346
|
+
registerUpdateCommands,
|
|
6347
|
+
registerExportCommand,
|
|
6348
|
+
registerImportCommand,
|
|
6349
|
+
registerMoveRepoCommand
|
|
6350
|
+
];
|
|
6251
6351
|
function registerBacklog(program2) {
|
|
6252
6352
|
const cmd = program2.command("backlog").description("Manage a backlog of work items").option("--dir <path>", "Override directory for backlog file discovery").hook("preAction", (thisCommand) => {
|
|
6253
6353
|
setBacklogDir(thisCommand.opts().dir);
|
|
6254
6354
|
}).action(() => web2({ port: "3100" }));
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
registerWebCommand(cmd);
|
|
6259
|
-
registerCommentCommands(cmd);
|
|
6260
|
-
registerLinkCommands(cmd);
|
|
6261
|
-
registerPlanCommands(cmd);
|
|
6262
|
-
registerRewindCommand(cmd);
|
|
6263
|
-
registerNextCommand(cmd);
|
|
6264
|
-
registerRunCommand(cmd);
|
|
6265
|
-
registerSearchCommand(cmd);
|
|
6266
|
-
registerUpdateCommands(cmd);
|
|
6267
|
-
registerExportCommand(cmd);
|
|
6268
|
-
registerImportCommand(cmd);
|
|
6355
|
+
for (const register of registrars) {
|
|
6356
|
+
register(cmd);
|
|
6357
|
+
}
|
|
6269
6358
|
}
|
|
6270
6359
|
|
|
6271
6360
|
// src/commands/cliHook/index.ts
|
|
@@ -6884,11 +6973,11 @@ function assertCliExists(cli) {
|
|
|
6884
6973
|
}
|
|
6885
6974
|
|
|
6886
6975
|
// src/commands/permitCliReads/colorize.ts
|
|
6887
|
-
import
|
|
6976
|
+
import chalk75 from "chalk";
|
|
6888
6977
|
function colorize(plainOutput) {
|
|
6889
6978
|
return plainOutput.split("\n").map((line) => {
|
|
6890
|
-
if (line.startsWith(" R ")) return
|
|
6891
|
-
if (line.startsWith(" W ")) return
|
|
6979
|
+
if (line.startsWith(" R ")) return chalk75.green(line);
|
|
6980
|
+
if (line.startsWith(" W ")) return chalk75.red(line);
|
|
6892
6981
|
return line;
|
|
6893
6982
|
}).join("\n");
|
|
6894
6983
|
}
|
|
@@ -7186,7 +7275,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
7186
7275
|
}
|
|
7187
7276
|
|
|
7188
7277
|
// src/commands/deny/denyAdd.ts
|
|
7189
|
-
import
|
|
7278
|
+
import chalk76 from "chalk";
|
|
7190
7279
|
|
|
7191
7280
|
// src/commands/deny/loadDenyConfig.ts
|
|
7192
7281
|
function loadDenyConfig(global) {
|
|
@@ -7206,16 +7295,16 @@ function loadDenyConfig(global) {
|
|
|
7206
7295
|
function denyAdd(pattern2, message, options2) {
|
|
7207
7296
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
7208
7297
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
7209
|
-
console.log(
|
|
7298
|
+
console.log(chalk76.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
7210
7299
|
return;
|
|
7211
7300
|
}
|
|
7212
7301
|
deny.push({ pattern: pattern2, message });
|
|
7213
7302
|
saveDeny(deny);
|
|
7214
|
-
console.log(
|
|
7303
|
+
console.log(chalk76.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
7215
7304
|
}
|
|
7216
7305
|
|
|
7217
7306
|
// src/commands/deny/denyList.ts
|
|
7218
|
-
import
|
|
7307
|
+
import chalk77 from "chalk";
|
|
7219
7308
|
function denyList() {
|
|
7220
7309
|
const globalRaw = loadGlobalConfigRaw();
|
|
7221
7310
|
const projectRaw = loadProjectConfig();
|
|
@@ -7226,7 +7315,7 @@ function denyList() {
|
|
|
7226
7315
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
7227
7316
|
);
|
|
7228
7317
|
if (!merged || merged.length === 0) {
|
|
7229
|
-
console.log(
|
|
7318
|
+
console.log(chalk77.dim("No deny rules configured."));
|
|
7230
7319
|
return;
|
|
7231
7320
|
}
|
|
7232
7321
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -7234,23 +7323,23 @@ function denyList() {
|
|
|
7234
7323
|
for (const rule of merged) {
|
|
7235
7324
|
const inProject = projectPatterns.has(rule.pattern);
|
|
7236
7325
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
7237
|
-
const label2 = inProject && inGlobal ?
|
|
7238
|
-
console.log(`${
|
|
7326
|
+
const label2 = inProject && inGlobal ? chalk77.dim(" (project, overrides global)") : inGlobal ? chalk77.dim(" (global)") : "";
|
|
7327
|
+
console.log(`${chalk77.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
7239
7328
|
}
|
|
7240
7329
|
}
|
|
7241
7330
|
|
|
7242
7331
|
// src/commands/deny/denyRemove.ts
|
|
7243
|
-
import
|
|
7332
|
+
import chalk78 from "chalk";
|
|
7244
7333
|
function denyRemove(pattern2, options2) {
|
|
7245
7334
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
7246
7335
|
const index2 = deny.findIndex((r) => r.pattern === pattern2);
|
|
7247
7336
|
if (index2 === -1) {
|
|
7248
|
-
console.log(
|
|
7337
|
+
console.log(chalk78.yellow(`No deny rule found for: ${pattern2}`));
|
|
7249
7338
|
return;
|
|
7250
7339
|
}
|
|
7251
7340
|
deny.splice(index2, 1);
|
|
7252
7341
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
7253
|
-
console.log(
|
|
7342
|
+
console.log(chalk78.green(`Removed deny rule: ${pattern2}`));
|
|
7254
7343
|
}
|
|
7255
7344
|
|
|
7256
7345
|
// src/commands/registerDeny.ts
|
|
@@ -7279,15 +7368,15 @@ function registerCliHook(program2) {
|
|
|
7279
7368
|
}
|
|
7280
7369
|
|
|
7281
7370
|
// src/commands/complexity/analyze.ts
|
|
7282
|
-
import
|
|
7371
|
+
import chalk84 from "chalk";
|
|
7283
7372
|
|
|
7284
7373
|
// src/commands/complexity/cyclomatic.ts
|
|
7285
|
-
import
|
|
7374
|
+
import chalk80 from "chalk";
|
|
7286
7375
|
|
|
7287
7376
|
// src/commands/complexity/shared/index.ts
|
|
7288
7377
|
import fs14 from "fs";
|
|
7289
7378
|
import path22 from "path";
|
|
7290
|
-
import
|
|
7379
|
+
import chalk79 from "chalk";
|
|
7291
7380
|
import ts5 from "typescript";
|
|
7292
7381
|
|
|
7293
7382
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -7485,7 +7574,7 @@ function calculateHalstead(node) {
|
|
|
7485
7574
|
// src/commands/complexity/shared/countSloc.ts
|
|
7486
7575
|
function countSloc(content) {
|
|
7487
7576
|
let inMultiLineComment = false;
|
|
7488
|
-
let
|
|
7577
|
+
let count6 = 0;
|
|
7489
7578
|
for (const line of content.split("\n")) {
|
|
7490
7579
|
const trimmed = line.trim();
|
|
7491
7580
|
if (inMultiLineComment) {
|
|
@@ -7493,7 +7582,7 @@ function countSloc(content) {
|
|
|
7493
7582
|
inMultiLineComment = false;
|
|
7494
7583
|
const afterComment = trimmed.substring(trimmed.indexOf("*/") + 2);
|
|
7495
7584
|
if (afterComment.trim().length > 0) {
|
|
7496
|
-
|
|
7585
|
+
count6++;
|
|
7497
7586
|
}
|
|
7498
7587
|
}
|
|
7499
7588
|
continue;
|
|
@@ -7505,7 +7594,7 @@ function countSloc(content) {
|
|
|
7505
7594
|
if (trimmed.includes("*/")) {
|
|
7506
7595
|
const afterComment = trimmed.substring(trimmed.indexOf("*/") + 2);
|
|
7507
7596
|
if (afterComment.trim().length > 0) {
|
|
7508
|
-
|
|
7597
|
+
count6++;
|
|
7509
7598
|
}
|
|
7510
7599
|
} else {
|
|
7511
7600
|
inMultiLineComment = true;
|
|
@@ -7513,10 +7602,10 @@ function countSloc(content) {
|
|
|
7513
7602
|
continue;
|
|
7514
7603
|
}
|
|
7515
7604
|
if (trimmed.length > 0) {
|
|
7516
|
-
|
|
7605
|
+
count6++;
|
|
7517
7606
|
}
|
|
7518
7607
|
}
|
|
7519
|
-
return
|
|
7608
|
+
return count6;
|
|
7520
7609
|
}
|
|
7521
7610
|
|
|
7522
7611
|
// src/commands/complexity/shared/index.ts
|
|
@@ -7533,7 +7622,7 @@ function createSourceFromFile(filePath) {
|
|
|
7533
7622
|
function withSourceFiles(pattern2, callback) {
|
|
7534
7623
|
const files = findSourceFiles2(pattern2);
|
|
7535
7624
|
if (files.length === 0) {
|
|
7536
|
-
console.log(
|
|
7625
|
+
console.log(chalk79.yellow("No files found matching pattern"));
|
|
7537
7626
|
return void 0;
|
|
7538
7627
|
}
|
|
7539
7628
|
return callback(files);
|
|
@@ -7566,11 +7655,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
7566
7655
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
7567
7656
|
for (const { file, name, complexity } of results) {
|
|
7568
7657
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
7569
|
-
const color = exceedsThreshold ?
|
|
7570
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
7658
|
+
const color = exceedsThreshold ? chalk80.red : chalk80.white;
|
|
7659
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk80.cyan(complexity)}`);
|
|
7571
7660
|
}
|
|
7572
7661
|
console.log(
|
|
7573
|
-
|
|
7662
|
+
chalk80.dim(
|
|
7574
7663
|
`
|
|
7575
7664
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
7576
7665
|
)
|
|
@@ -7582,7 +7671,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
7582
7671
|
}
|
|
7583
7672
|
|
|
7584
7673
|
// src/commands/complexity/halstead.ts
|
|
7585
|
-
import
|
|
7674
|
+
import chalk81 from "chalk";
|
|
7586
7675
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
7587
7676
|
withSourceFiles(pattern2, (files) => {
|
|
7588
7677
|
const results = [];
|
|
@@ -7597,13 +7686,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
7597
7686
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
7598
7687
|
for (const { file, name, metrics } of results) {
|
|
7599
7688
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
7600
|
-
const color = exceedsThreshold ?
|
|
7689
|
+
const color = exceedsThreshold ? chalk81.red : chalk81.white;
|
|
7601
7690
|
console.log(
|
|
7602
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
7691
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk81.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk81.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk81.magenta(metrics.effort.toFixed(1))}`
|
|
7603
7692
|
);
|
|
7604
7693
|
}
|
|
7605
7694
|
console.log(
|
|
7606
|
-
|
|
7695
|
+
chalk81.dim(
|
|
7607
7696
|
`
|
|
7608
7697
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
7609
7698
|
)
|
|
@@ -7618,28 +7707,28 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
7618
7707
|
import fs15 from "fs";
|
|
7619
7708
|
|
|
7620
7709
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
7621
|
-
import
|
|
7710
|
+
import chalk82 from "chalk";
|
|
7622
7711
|
function displayMaintainabilityResults(results, threshold) {
|
|
7623
7712
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
7624
7713
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
7625
|
-
console.log(
|
|
7714
|
+
console.log(chalk82.green("All files pass maintainability threshold"));
|
|
7626
7715
|
} else {
|
|
7627
7716
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
7628
|
-
const color = threshold !== void 0 ?
|
|
7717
|
+
const color = threshold !== void 0 ? chalk82.red : chalk82.white;
|
|
7629
7718
|
console.log(
|
|
7630
|
-
`${color(file)} \u2192 avg: ${
|
|
7719
|
+
`${color(file)} \u2192 avg: ${chalk82.cyan(avgMaintainability.toFixed(1))}, min: ${chalk82.yellow(minMaintainability.toFixed(1))}`
|
|
7631
7720
|
);
|
|
7632
7721
|
}
|
|
7633
7722
|
}
|
|
7634
|
-
console.log(
|
|
7723
|
+
console.log(chalk82.dim(`
|
|
7635
7724
|
Analyzed ${results.length} files`));
|
|
7636
7725
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
7637
7726
|
console.error(
|
|
7638
|
-
|
|
7727
|
+
chalk82.red(
|
|
7639
7728
|
`
|
|
7640
7729
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
7641
7730
|
|
|
7642
|
-
\u26A0\uFE0F ${
|
|
7731
|
+
\u26A0\uFE0F ${chalk82.bold("Diagnose and fix one file at a time")} \u2014 do not investigate or fix multiple files in parallel. Run 'assist complexity <file>' to see all metrics. For larger files, start by extracting responsibilities into smaller files.`
|
|
7643
7732
|
)
|
|
7644
7733
|
);
|
|
7645
7734
|
process.exit(1);
|
|
@@ -7696,7 +7785,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
7696
7785
|
|
|
7697
7786
|
// src/commands/complexity/sloc.ts
|
|
7698
7787
|
import fs16 from "fs";
|
|
7699
|
-
import
|
|
7788
|
+
import chalk83 from "chalk";
|
|
7700
7789
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
7701
7790
|
withSourceFiles(pattern2, (files) => {
|
|
7702
7791
|
const results = [];
|
|
@@ -7712,12 +7801,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
7712
7801
|
results.sort((a, b) => b.lines - a.lines);
|
|
7713
7802
|
for (const { file, lines } of results) {
|
|
7714
7803
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
7715
|
-
const color = exceedsThreshold ?
|
|
7716
|
-
console.log(`${color(file)} \u2192 ${
|
|
7804
|
+
const color = exceedsThreshold ? chalk83.red : chalk83.white;
|
|
7805
|
+
console.log(`${color(file)} \u2192 ${chalk83.cyan(lines)} lines`);
|
|
7717
7806
|
}
|
|
7718
7807
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
7719
7808
|
console.log(
|
|
7720
|
-
|
|
7809
|
+
chalk83.dim(`
|
|
7721
7810
|
Total: ${total} lines across ${files.length} files`)
|
|
7722
7811
|
);
|
|
7723
7812
|
if (hasViolation) {
|
|
@@ -7731,21 +7820,21 @@ async function analyze(pattern2) {
|
|
|
7731
7820
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
7732
7821
|
const files = findSourceFiles2(searchPattern);
|
|
7733
7822
|
if (files.length === 0) {
|
|
7734
|
-
console.log(
|
|
7823
|
+
console.log(chalk84.yellow("No files found matching pattern"));
|
|
7735
7824
|
return;
|
|
7736
7825
|
}
|
|
7737
7826
|
if (files.length === 1) {
|
|
7738
7827
|
const file = files[0];
|
|
7739
|
-
console.log(
|
|
7828
|
+
console.log(chalk84.bold.underline("SLOC"));
|
|
7740
7829
|
await sloc(file);
|
|
7741
7830
|
console.log();
|
|
7742
|
-
console.log(
|
|
7831
|
+
console.log(chalk84.bold.underline("Cyclomatic Complexity"));
|
|
7743
7832
|
await cyclomatic(file);
|
|
7744
7833
|
console.log();
|
|
7745
|
-
console.log(
|
|
7834
|
+
console.log(chalk84.bold.underline("Halstead Metrics"));
|
|
7746
7835
|
await halstead(file);
|
|
7747
7836
|
console.log();
|
|
7748
|
-
console.log(
|
|
7837
|
+
console.log(chalk84.bold.underline("Maintainability Index"));
|
|
7749
7838
|
await maintainability(file);
|
|
7750
7839
|
return;
|
|
7751
7840
|
}
|
|
@@ -7772,7 +7861,7 @@ function registerComplexity(program2) {
|
|
|
7772
7861
|
}
|
|
7773
7862
|
|
|
7774
7863
|
// src/commands/config/index.ts
|
|
7775
|
-
import
|
|
7864
|
+
import chalk85 from "chalk";
|
|
7776
7865
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
7777
7866
|
|
|
7778
7867
|
// src/commands/config/setNestedValue.ts
|
|
@@ -7835,7 +7924,7 @@ function formatIssuePath(issue, key) {
|
|
|
7835
7924
|
function printValidationErrors(issues, key) {
|
|
7836
7925
|
for (const issue of issues) {
|
|
7837
7926
|
console.error(
|
|
7838
|
-
|
|
7927
|
+
chalk85.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
7839
7928
|
);
|
|
7840
7929
|
}
|
|
7841
7930
|
}
|
|
@@ -7852,7 +7941,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
7852
7941
|
function assertNotGlobalOnly(key, global) {
|
|
7853
7942
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
7854
7943
|
console.error(
|
|
7855
|
-
|
|
7944
|
+
chalk85.red(
|
|
7856
7945
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
7857
7946
|
)
|
|
7858
7947
|
);
|
|
@@ -7875,7 +7964,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
7875
7964
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
7876
7965
|
const target = options2.global ? "global" : "project";
|
|
7877
7966
|
console.log(
|
|
7878
|
-
|
|
7967
|
+
chalk85.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
7879
7968
|
);
|
|
7880
7969
|
}
|
|
7881
7970
|
function configList() {
|
|
@@ -7884,7 +7973,7 @@ function configList() {
|
|
|
7884
7973
|
}
|
|
7885
7974
|
|
|
7886
7975
|
// src/commands/config/configGet.ts
|
|
7887
|
-
import
|
|
7976
|
+
import chalk86 from "chalk";
|
|
7888
7977
|
|
|
7889
7978
|
// src/commands/config/getNestedValue.ts
|
|
7890
7979
|
function isTraversable(value) {
|
|
@@ -7916,7 +8005,7 @@ function requireNestedValue(config, key) {
|
|
|
7916
8005
|
return value;
|
|
7917
8006
|
}
|
|
7918
8007
|
function exitKeyNotSet(key) {
|
|
7919
|
-
console.error(
|
|
8008
|
+
console.error(chalk86.red(`Key "${key}" is not set`));
|
|
7920
8009
|
process.exit(1);
|
|
7921
8010
|
}
|
|
7922
8011
|
|
|
@@ -7930,7 +8019,7 @@ function registerConfig(program2) {
|
|
|
7930
8019
|
|
|
7931
8020
|
// src/commands/deploy/redirect.ts
|
|
7932
8021
|
import { existsSync as existsSync24, readFileSync as readFileSync18, writeFileSync as writeFileSync16 } from "fs";
|
|
7933
|
-
import
|
|
8022
|
+
import chalk87 from "chalk";
|
|
7934
8023
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
7935
8024
|
if (!window.location.pathname.endsWith('/')) {
|
|
7936
8025
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -7939,22 +8028,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
7939
8028
|
function redirect() {
|
|
7940
8029
|
const indexPath = "index.html";
|
|
7941
8030
|
if (!existsSync24(indexPath)) {
|
|
7942
|
-
console.log(
|
|
8031
|
+
console.log(chalk87.yellow("No index.html found"));
|
|
7943
8032
|
return;
|
|
7944
8033
|
}
|
|
7945
8034
|
const content = readFileSync18(indexPath, "utf-8");
|
|
7946
8035
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
7947
|
-
console.log(
|
|
8036
|
+
console.log(chalk87.dim("Trailing slash script already present"));
|
|
7948
8037
|
return;
|
|
7949
8038
|
}
|
|
7950
8039
|
const headCloseIndex = content.indexOf("</head>");
|
|
7951
8040
|
if (headCloseIndex === -1) {
|
|
7952
|
-
console.log(
|
|
8041
|
+
console.log(chalk87.red("Could not find </head> tag in index.html"));
|
|
7953
8042
|
return;
|
|
7954
8043
|
}
|
|
7955
8044
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
7956
8045
|
writeFileSync16(indexPath, newContent);
|
|
7957
|
-
console.log(
|
|
8046
|
+
console.log(chalk87.green("Added trailing slash redirect to index.html"));
|
|
7958
8047
|
}
|
|
7959
8048
|
|
|
7960
8049
|
// src/commands/registerDeploy.ts
|
|
@@ -7981,7 +8070,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
7981
8070
|
|
|
7982
8071
|
// src/commands/devlog/shared.ts
|
|
7983
8072
|
import { execSync as execSync20 } from "child_process";
|
|
7984
|
-
import
|
|
8073
|
+
import chalk88 from "chalk";
|
|
7985
8074
|
|
|
7986
8075
|
// src/shared/getRepoName.ts
|
|
7987
8076
|
import { existsSync as existsSync25, readFileSync as readFileSync19 } from "fs";
|
|
@@ -8090,13 +8179,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
8090
8179
|
}
|
|
8091
8180
|
function printCommitsWithFiles(commits, ignore2, verbose) {
|
|
8092
8181
|
for (const commit2 of commits) {
|
|
8093
|
-
console.log(` ${
|
|
8182
|
+
console.log(` ${chalk88.yellow(commit2.hash)} ${commit2.message}`);
|
|
8094
8183
|
if (verbose) {
|
|
8095
8184
|
const visibleFiles = commit2.files.filter(
|
|
8096
8185
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
8097
8186
|
);
|
|
8098
8187
|
for (const file of visibleFiles) {
|
|
8099
|
-
console.log(` ${
|
|
8188
|
+
console.log(` ${chalk88.dim(file)}`);
|
|
8100
8189
|
}
|
|
8101
8190
|
}
|
|
8102
8191
|
}
|
|
@@ -8121,15 +8210,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
8121
8210
|
}
|
|
8122
8211
|
|
|
8123
8212
|
// src/commands/devlog/list/printDateHeader.ts
|
|
8124
|
-
import
|
|
8213
|
+
import chalk89 from "chalk";
|
|
8125
8214
|
function printDateHeader(date, isSkipped, entries) {
|
|
8126
8215
|
if (isSkipped) {
|
|
8127
|
-
console.log(`${
|
|
8216
|
+
console.log(`${chalk89.bold.blue(date)} ${chalk89.dim("skipped")}`);
|
|
8128
8217
|
} else if (entries && entries.length > 0) {
|
|
8129
|
-
const entryInfo = entries.map((e) => `${
|
|
8130
|
-
console.log(`${
|
|
8218
|
+
const entryInfo = entries.map((e) => `${chalk89.green(e.version)} ${e.title}`).join(" | ");
|
|
8219
|
+
console.log(`${chalk89.bold.blue(date)} ${entryInfo}`);
|
|
8131
8220
|
} else {
|
|
8132
|
-
console.log(`${
|
|
8221
|
+
console.log(`${chalk89.bold.blue(date)} ${chalk89.red("\u26A0 devlog missing")}`);
|
|
8133
8222
|
}
|
|
8134
8223
|
}
|
|
8135
8224
|
|
|
@@ -8233,24 +8322,24 @@ function bumpVersion(version2, type) {
|
|
|
8233
8322
|
|
|
8234
8323
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
8235
8324
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
8236
|
-
import
|
|
8325
|
+
import chalk91 from "chalk";
|
|
8237
8326
|
|
|
8238
8327
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
8239
|
-
import
|
|
8328
|
+
import chalk90 from "chalk";
|
|
8240
8329
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
8241
8330
|
if (conventional && firstHash) {
|
|
8242
8331
|
const version2 = getVersionAtCommit(firstHash);
|
|
8243
8332
|
if (version2) {
|
|
8244
|
-
console.log(`${
|
|
8333
|
+
console.log(`${chalk90.bold("version:")} ${stripToMinor(version2)}`);
|
|
8245
8334
|
} else {
|
|
8246
|
-
console.log(`${
|
|
8335
|
+
console.log(`${chalk90.bold("version:")} ${chalk90.red("unknown")}`);
|
|
8247
8336
|
}
|
|
8248
8337
|
} else if (patchVersion && minorVersion) {
|
|
8249
8338
|
console.log(
|
|
8250
|
-
`${
|
|
8339
|
+
`${chalk90.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
8251
8340
|
);
|
|
8252
8341
|
} else {
|
|
8253
|
-
console.log(`${
|
|
8342
|
+
console.log(`${chalk90.bold("version:")} v0.1 (initial)`);
|
|
8254
8343
|
}
|
|
8255
8344
|
}
|
|
8256
8345
|
|
|
@@ -8298,16 +8387,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
8298
8387
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
8299
8388
|
}
|
|
8300
8389
|
function logName(repoName) {
|
|
8301
|
-
console.log(`${
|
|
8390
|
+
console.log(`${chalk91.bold("name:")} ${repoName}`);
|
|
8302
8391
|
}
|
|
8303
8392
|
function displayNextEntry(ctx, targetDate, commits) {
|
|
8304
8393
|
logName(ctx.repoName);
|
|
8305
8394
|
printVersionInfo(ctx.config, ctx.lastInfo, commits[0]?.hash);
|
|
8306
|
-
console.log(
|
|
8395
|
+
console.log(chalk91.bold.blue(targetDate));
|
|
8307
8396
|
printCommitsWithFiles(commits, ctx.ignore, ctx.verbose);
|
|
8308
8397
|
}
|
|
8309
8398
|
function logNoCommits(lastInfo) {
|
|
8310
|
-
console.log(
|
|
8399
|
+
console.log(chalk91.dim(noCommitsMessage(!!lastInfo)));
|
|
8311
8400
|
}
|
|
8312
8401
|
|
|
8313
8402
|
// src/commands/devlog/next/index.ts
|
|
@@ -8348,11 +8437,11 @@ function next2(options2) {
|
|
|
8348
8437
|
import { execSync as execSync22 } from "child_process";
|
|
8349
8438
|
|
|
8350
8439
|
// src/commands/devlog/repos/printReposTable.ts
|
|
8351
|
-
import
|
|
8440
|
+
import chalk92 from "chalk";
|
|
8352
8441
|
function colorStatus(status2) {
|
|
8353
|
-
if (status2 === "missing") return
|
|
8354
|
-
if (status2 === "outdated") return
|
|
8355
|
-
return
|
|
8442
|
+
if (status2 === "missing") return chalk92.red(status2);
|
|
8443
|
+
if (status2 === "outdated") return chalk92.yellow(status2);
|
|
8444
|
+
return chalk92.green(status2);
|
|
8356
8445
|
}
|
|
8357
8446
|
function formatRow(row, nameWidth) {
|
|
8358
8447
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -8366,8 +8455,8 @@ function printReposTable(rows) {
|
|
|
8366
8455
|
"Last Devlog".padEnd(11),
|
|
8367
8456
|
"Status"
|
|
8368
8457
|
].join(" ");
|
|
8369
|
-
console.log(
|
|
8370
|
-
console.log(
|
|
8458
|
+
console.log(chalk92.dim(header));
|
|
8459
|
+
console.log(chalk92.dim("-".repeat(header.length)));
|
|
8371
8460
|
for (const row of rows) {
|
|
8372
8461
|
console.log(formatRow(row, nameWidth));
|
|
8373
8462
|
}
|
|
@@ -8425,14 +8514,14 @@ function repos(options2) {
|
|
|
8425
8514
|
// src/commands/devlog/skip.ts
|
|
8426
8515
|
import { writeFileSync as writeFileSync17 } from "fs";
|
|
8427
8516
|
import { join as join24 } from "path";
|
|
8428
|
-
import
|
|
8517
|
+
import chalk93 from "chalk";
|
|
8429
8518
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
8430
8519
|
function getBlogConfigPath() {
|
|
8431
8520
|
return join24(BLOG_REPO_ROOT, "assist.yml");
|
|
8432
8521
|
}
|
|
8433
8522
|
function skip(date) {
|
|
8434
8523
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
8435
|
-
console.log(
|
|
8524
|
+
console.log(chalk93.red("Invalid date format. Use YYYY-MM-DD"));
|
|
8436
8525
|
process.exit(1);
|
|
8437
8526
|
}
|
|
8438
8527
|
const repoName = getRepoName();
|
|
@@ -8443,7 +8532,7 @@ function skip(date) {
|
|
|
8443
8532
|
const skipDays = skip2[repoName] ?? [];
|
|
8444
8533
|
if (skipDays.includes(date)) {
|
|
8445
8534
|
console.log(
|
|
8446
|
-
|
|
8535
|
+
chalk93.yellow(`${date} is already in skip list for ${repoName}`)
|
|
8447
8536
|
);
|
|
8448
8537
|
return;
|
|
8449
8538
|
}
|
|
@@ -8453,20 +8542,20 @@ function skip(date) {
|
|
|
8453
8542
|
devlog.skip = skip2;
|
|
8454
8543
|
config.devlog = devlog;
|
|
8455
8544
|
writeFileSync17(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
8456
|
-
console.log(
|
|
8545
|
+
console.log(chalk93.green(`Added ${date} to skip list for ${repoName}`));
|
|
8457
8546
|
}
|
|
8458
8547
|
|
|
8459
8548
|
// src/commands/devlog/version.ts
|
|
8460
|
-
import
|
|
8549
|
+
import chalk94 from "chalk";
|
|
8461
8550
|
function version() {
|
|
8462
8551
|
const config = loadConfig();
|
|
8463
8552
|
const name = getRepoName();
|
|
8464
8553
|
const lastInfo = getLastVersionInfo(name, config);
|
|
8465
8554
|
const lastVersion = lastInfo?.version ?? null;
|
|
8466
8555
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
8467
|
-
console.log(`${
|
|
8468
|
-
console.log(`${
|
|
8469
|
-
console.log(`${
|
|
8556
|
+
console.log(`${chalk94.bold("name:")} ${name}`);
|
|
8557
|
+
console.log(`${chalk94.bold("last:")} ${lastVersion ?? chalk94.dim("none")}`);
|
|
8558
|
+
console.log(`${chalk94.bold("next:")} ${nextVersion ?? chalk94.dim("none")}`);
|
|
8470
8559
|
}
|
|
8471
8560
|
|
|
8472
8561
|
// src/commands/registerDevlog.ts
|
|
@@ -8490,7 +8579,7 @@ function registerDevlog(program2) {
|
|
|
8490
8579
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
8491
8580
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
8492
8581
|
import { join as join25 } from "path";
|
|
8493
|
-
import
|
|
8582
|
+
import chalk95 from "chalk";
|
|
8494
8583
|
|
|
8495
8584
|
// src/shared/findRepoRoot.ts
|
|
8496
8585
|
import { existsSync as existsSync26 } from "fs";
|
|
@@ -8553,14 +8642,14 @@ function checkBuildLocks(startDir) {
|
|
|
8553
8642
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
8554
8643
|
if (locked) {
|
|
8555
8644
|
console.error(
|
|
8556
|
-
|
|
8645
|
+
chalk95.red("Build output locked (is VS debugging?): ") + locked
|
|
8557
8646
|
);
|
|
8558
8647
|
process.exit(1);
|
|
8559
8648
|
}
|
|
8560
8649
|
}
|
|
8561
8650
|
async function checkBuildLocksCommand() {
|
|
8562
8651
|
checkBuildLocks();
|
|
8563
|
-
console.log(
|
|
8652
|
+
console.log(chalk95.green("No build locks detected"));
|
|
8564
8653
|
}
|
|
8565
8654
|
|
|
8566
8655
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -8659,30 +8748,30 @@ function escapeRegex(s) {
|
|
|
8659
8748
|
}
|
|
8660
8749
|
|
|
8661
8750
|
// src/commands/dotnet/printTree.ts
|
|
8662
|
-
import
|
|
8751
|
+
import chalk96 from "chalk";
|
|
8663
8752
|
function printNodes(nodes, prefix2) {
|
|
8664
8753
|
for (let i = 0; i < nodes.length; i++) {
|
|
8665
8754
|
const isLast = i === nodes.length - 1;
|
|
8666
8755
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
8667
8756
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
8668
8757
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
8669
|
-
const label2 = isMissing ?
|
|
8758
|
+
const label2 = isMissing ? chalk96.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
8670
8759
|
console.log(`${prefix2}${connector}${label2}`);
|
|
8671
8760
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
8672
8761
|
}
|
|
8673
8762
|
}
|
|
8674
8763
|
function printTree(tree, totalCount, solutions) {
|
|
8675
|
-
console.log(
|
|
8676
|
-
console.log(
|
|
8764
|
+
console.log(chalk96.bold("\nProject Dependency Tree"));
|
|
8765
|
+
console.log(chalk96.cyan(tree.relativePath));
|
|
8677
8766
|
printNodes(tree.children, "");
|
|
8678
|
-
console.log(
|
|
8767
|
+
console.log(chalk96.dim(`
|
|
8679
8768
|
${totalCount} projects total (including root)`));
|
|
8680
|
-
console.log(
|
|
8769
|
+
console.log(chalk96.bold("\nSolution Membership"));
|
|
8681
8770
|
if (solutions.length === 0) {
|
|
8682
|
-
console.log(
|
|
8771
|
+
console.log(chalk96.yellow(" Not found in any .sln"));
|
|
8683
8772
|
} else {
|
|
8684
8773
|
for (const sln of solutions) {
|
|
8685
|
-
console.log(` ${
|
|
8774
|
+
console.log(` ${chalk96.green(sln)}`);
|
|
8686
8775
|
}
|
|
8687
8776
|
}
|
|
8688
8777
|
console.log();
|
|
@@ -8711,16 +8800,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
8711
8800
|
// src/commands/dotnet/resolveCsproj.ts
|
|
8712
8801
|
import { existsSync as existsSync27 } from "fs";
|
|
8713
8802
|
import path26 from "path";
|
|
8714
|
-
import
|
|
8803
|
+
import chalk97 from "chalk";
|
|
8715
8804
|
function resolveCsproj(csprojPath) {
|
|
8716
8805
|
const resolved = path26.resolve(csprojPath);
|
|
8717
8806
|
if (!existsSync27(resolved)) {
|
|
8718
|
-
console.error(
|
|
8807
|
+
console.error(chalk97.red(`File not found: ${resolved}`));
|
|
8719
8808
|
process.exit(1);
|
|
8720
8809
|
}
|
|
8721
8810
|
const repoRoot = findRepoRoot(path26.dirname(resolved));
|
|
8722
8811
|
if (!repoRoot) {
|
|
8723
|
-
console.error(
|
|
8812
|
+
console.error(chalk97.red("Could not find git repository root"));
|
|
8724
8813
|
process.exit(1);
|
|
8725
8814
|
}
|
|
8726
8815
|
return { resolved, repoRoot };
|
|
@@ -8770,12 +8859,12 @@ function getChangedCsFiles(scope) {
|
|
|
8770
8859
|
}
|
|
8771
8860
|
|
|
8772
8861
|
// src/commands/dotnet/inSln.ts
|
|
8773
|
-
import
|
|
8862
|
+
import chalk98 from "chalk";
|
|
8774
8863
|
async function inSln(csprojPath) {
|
|
8775
8864
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
8776
8865
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
8777
8866
|
if (solutions.length === 0) {
|
|
8778
|
-
console.log(
|
|
8867
|
+
console.log(chalk98.yellow("Not found in any .sln file"));
|
|
8779
8868
|
process.exit(1);
|
|
8780
8869
|
}
|
|
8781
8870
|
for (const sln of solutions) {
|
|
@@ -8784,7 +8873,7 @@ async function inSln(csprojPath) {
|
|
|
8784
8873
|
}
|
|
8785
8874
|
|
|
8786
8875
|
// src/commands/dotnet/inspect.ts
|
|
8787
|
-
import
|
|
8876
|
+
import chalk104 from "chalk";
|
|
8788
8877
|
|
|
8789
8878
|
// src/shared/formatElapsed.ts
|
|
8790
8879
|
function formatElapsed(ms) {
|
|
@@ -8796,12 +8885,12 @@ function formatElapsed(ms) {
|
|
|
8796
8885
|
}
|
|
8797
8886
|
|
|
8798
8887
|
// src/commands/dotnet/displayIssues.ts
|
|
8799
|
-
import
|
|
8888
|
+
import chalk99 from "chalk";
|
|
8800
8889
|
var SEVERITY_COLOR = {
|
|
8801
|
-
ERROR:
|
|
8802
|
-
WARNING:
|
|
8803
|
-
SUGGESTION:
|
|
8804
|
-
HINT:
|
|
8890
|
+
ERROR: chalk99.red,
|
|
8891
|
+
WARNING: chalk99.yellow,
|
|
8892
|
+
SUGGESTION: chalk99.cyan,
|
|
8893
|
+
HINT: chalk99.dim
|
|
8805
8894
|
};
|
|
8806
8895
|
function groupByFile(issues) {
|
|
8807
8896
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -8817,15 +8906,15 @@ function groupByFile(issues) {
|
|
|
8817
8906
|
}
|
|
8818
8907
|
function displayIssues(issues) {
|
|
8819
8908
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
8820
|
-
console.log(
|
|
8909
|
+
console.log(chalk99.bold(file));
|
|
8821
8910
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
8822
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
8911
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk99.white;
|
|
8823
8912
|
console.log(
|
|
8824
|
-
` ${
|
|
8913
|
+
` ${chalk99.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
8825
8914
|
);
|
|
8826
8915
|
}
|
|
8827
8916
|
}
|
|
8828
|
-
console.log(
|
|
8917
|
+
console.log(chalk99.dim(`
|
|
8829
8918
|
${issues.length} issue(s) found`));
|
|
8830
8919
|
}
|
|
8831
8920
|
|
|
@@ -8884,12 +8973,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
8884
8973
|
// src/commands/dotnet/resolveSolution.ts
|
|
8885
8974
|
import { existsSync as existsSync28 } from "fs";
|
|
8886
8975
|
import path27 from "path";
|
|
8887
|
-
import
|
|
8976
|
+
import chalk101 from "chalk";
|
|
8888
8977
|
|
|
8889
8978
|
// src/commands/dotnet/findSolution.ts
|
|
8890
8979
|
import { readdirSync as readdirSync4 } from "fs";
|
|
8891
8980
|
import { dirname as dirname18, join as join26 } from "path";
|
|
8892
|
-
import
|
|
8981
|
+
import chalk100 from "chalk";
|
|
8893
8982
|
function findSlnInDir(dir) {
|
|
8894
8983
|
try {
|
|
8895
8984
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join26(dir, f));
|
|
@@ -8905,17 +8994,17 @@ function findSolution() {
|
|
|
8905
8994
|
const slnFiles = findSlnInDir(current);
|
|
8906
8995
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
8907
8996
|
if (slnFiles.length > 1) {
|
|
8908
|
-
console.error(
|
|
8997
|
+
console.error(chalk100.red(`Multiple .sln files found in ${current}:`));
|
|
8909
8998
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
8910
8999
|
console.error(
|
|
8911
|
-
|
|
9000
|
+
chalk100.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
8912
9001
|
);
|
|
8913
9002
|
process.exit(1);
|
|
8914
9003
|
}
|
|
8915
9004
|
if (current === ceiling) break;
|
|
8916
9005
|
current = dirname18(current);
|
|
8917
9006
|
}
|
|
8918
|
-
console.error(
|
|
9007
|
+
console.error(chalk100.red("No .sln file found between cwd and repo root"));
|
|
8919
9008
|
process.exit(1);
|
|
8920
9009
|
}
|
|
8921
9010
|
|
|
@@ -8924,7 +9013,7 @@ function resolveSolution(sln) {
|
|
|
8924
9013
|
if (sln) {
|
|
8925
9014
|
const resolved = path27.resolve(sln);
|
|
8926
9015
|
if (!existsSync28(resolved)) {
|
|
8927
|
-
console.error(
|
|
9016
|
+
console.error(chalk101.red(`Solution file not found: ${resolved}`));
|
|
8928
9017
|
process.exit(1);
|
|
8929
9018
|
}
|
|
8930
9019
|
return resolved;
|
|
@@ -8966,14 +9055,14 @@ import { execSync as execSync24 } from "child_process";
|
|
|
8966
9055
|
import { existsSync as existsSync29, readFileSync as readFileSync23, unlinkSync as unlinkSync5 } from "fs";
|
|
8967
9056
|
import { tmpdir as tmpdir3 } from "os";
|
|
8968
9057
|
import path28 from "path";
|
|
8969
|
-
import
|
|
9058
|
+
import chalk102 from "chalk";
|
|
8970
9059
|
function assertJbInstalled() {
|
|
8971
9060
|
try {
|
|
8972
9061
|
execSync24("jb inspectcode --version", { stdio: "pipe" });
|
|
8973
9062
|
} catch {
|
|
8974
|
-
console.error(
|
|
9063
|
+
console.error(chalk102.red("jb is not installed. Install with:"));
|
|
8975
9064
|
console.error(
|
|
8976
|
-
|
|
9065
|
+
chalk102.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
8977
9066
|
);
|
|
8978
9067
|
process.exit(1);
|
|
8979
9068
|
}
|
|
@@ -8991,11 +9080,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
8991
9080
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
8992
9081
|
process.stderr.write(err.stderr);
|
|
8993
9082
|
}
|
|
8994
|
-
console.error(
|
|
9083
|
+
console.error(chalk102.red("jb inspectcode failed"));
|
|
8995
9084
|
process.exit(1);
|
|
8996
9085
|
}
|
|
8997
9086
|
if (!existsSync29(reportPath)) {
|
|
8998
|
-
console.error(
|
|
9087
|
+
console.error(chalk102.red("Report file not generated"));
|
|
8999
9088
|
process.exit(1);
|
|
9000
9089
|
}
|
|
9001
9090
|
const xml = readFileSync23(reportPath, "utf-8");
|
|
@@ -9005,7 +9094,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
9005
9094
|
|
|
9006
9095
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
9007
9096
|
import { execSync as execSync25 } from "child_process";
|
|
9008
|
-
import
|
|
9097
|
+
import chalk103 from "chalk";
|
|
9009
9098
|
function resolveMsbuildPath() {
|
|
9010
9099
|
const { run: run4 } = loadConfig();
|
|
9011
9100
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -9017,9 +9106,9 @@ function assertMsbuildInstalled() {
|
|
|
9017
9106
|
try {
|
|
9018
9107
|
execSync25(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
9019
9108
|
} catch {
|
|
9020
|
-
console.error(
|
|
9109
|
+
console.error(chalk103.red(`msbuild not found at: ${msbuild}`));
|
|
9021
9110
|
console.error(
|
|
9022
|
-
|
|
9111
|
+
chalk103.yellow(
|
|
9023
9112
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
9024
9113
|
)
|
|
9025
9114
|
);
|
|
@@ -9066,17 +9155,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
9066
9155
|
// src/commands/dotnet/inspect.ts
|
|
9067
9156
|
function logScope(changedFiles) {
|
|
9068
9157
|
if (changedFiles === null) {
|
|
9069
|
-
console.log(
|
|
9158
|
+
console.log(chalk104.dim("Inspecting full solution..."));
|
|
9070
9159
|
} else {
|
|
9071
9160
|
console.log(
|
|
9072
|
-
|
|
9161
|
+
chalk104.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
9073
9162
|
);
|
|
9074
9163
|
}
|
|
9075
9164
|
}
|
|
9076
9165
|
function reportResults(issues, elapsed) {
|
|
9077
9166
|
if (issues.length > 0) displayIssues(issues);
|
|
9078
|
-
else console.log(
|
|
9079
|
-
console.log(
|
|
9167
|
+
else console.log(chalk104.green("No issues found"));
|
|
9168
|
+
console.log(chalk104.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
9080
9169
|
if (issues.length > 0) process.exit(1);
|
|
9081
9170
|
}
|
|
9082
9171
|
async function inspect(sln, options2) {
|
|
@@ -9087,7 +9176,7 @@ async function inspect(sln, options2) {
|
|
|
9087
9176
|
const scope = parseScope(options2.scope);
|
|
9088
9177
|
const changedFiles = getChangedCsFiles(scope);
|
|
9089
9178
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
9090
|
-
console.log(
|
|
9179
|
+
console.log(chalk104.green("No changed .cs files found"));
|
|
9091
9180
|
return;
|
|
9092
9181
|
}
|
|
9093
9182
|
logScope(changedFiles);
|
|
@@ -9341,7 +9430,7 @@ function registerHandover(program2) {
|
|
|
9341
9430
|
}
|
|
9342
9431
|
|
|
9343
9432
|
// src/commands/jira/acceptanceCriteria.ts
|
|
9344
|
-
import
|
|
9433
|
+
import chalk106 from "chalk";
|
|
9345
9434
|
|
|
9346
9435
|
// src/commands/jira/adfToText.ts
|
|
9347
9436
|
function renderInline(node) {
|
|
@@ -9402,7 +9491,7 @@ function adfToText(doc) {
|
|
|
9402
9491
|
|
|
9403
9492
|
// src/commands/jira/fetchIssue.ts
|
|
9404
9493
|
import { execSync as execSync26 } from "child_process";
|
|
9405
|
-
import
|
|
9494
|
+
import chalk105 from "chalk";
|
|
9406
9495
|
function fetchIssue(issueKey, fields) {
|
|
9407
9496
|
let result;
|
|
9408
9497
|
try {
|
|
@@ -9415,15 +9504,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
9415
9504
|
const stderr = error.stderr;
|
|
9416
9505
|
if (stderr.includes("unauthorized")) {
|
|
9417
9506
|
console.error(
|
|
9418
|
-
|
|
9507
|
+
chalk105.red("Jira authentication expired."),
|
|
9419
9508
|
"Run",
|
|
9420
|
-
|
|
9509
|
+
chalk105.cyan("assist jira auth"),
|
|
9421
9510
|
"to re-authenticate."
|
|
9422
9511
|
);
|
|
9423
9512
|
process.exit(1);
|
|
9424
9513
|
}
|
|
9425
9514
|
}
|
|
9426
|
-
console.error(
|
|
9515
|
+
console.error(chalk105.red(`Failed to fetch ${issueKey}.`));
|
|
9427
9516
|
process.exit(1);
|
|
9428
9517
|
}
|
|
9429
9518
|
return JSON.parse(result);
|
|
@@ -9437,7 +9526,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
9437
9526
|
const parsed = fetchIssue(issueKey, field);
|
|
9438
9527
|
const acValue = parsed?.fields?.[field];
|
|
9439
9528
|
if (!acValue) {
|
|
9440
|
-
console.log(
|
|
9529
|
+
console.log(chalk106.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
9441
9530
|
return;
|
|
9442
9531
|
}
|
|
9443
9532
|
if (typeof acValue === "string") {
|
|
@@ -9532,14 +9621,14 @@ async function jiraAuth() {
|
|
|
9532
9621
|
}
|
|
9533
9622
|
|
|
9534
9623
|
// src/commands/jira/viewIssue.ts
|
|
9535
|
-
import
|
|
9624
|
+
import chalk107 from "chalk";
|
|
9536
9625
|
function viewIssue(issueKey) {
|
|
9537
9626
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
9538
9627
|
const fields = parsed?.fields;
|
|
9539
9628
|
const summary = fields?.summary;
|
|
9540
9629
|
const description = fields?.description;
|
|
9541
9630
|
if (summary) {
|
|
9542
|
-
console.log(
|
|
9631
|
+
console.log(chalk107.bold(summary));
|
|
9543
9632
|
}
|
|
9544
9633
|
if (description) {
|
|
9545
9634
|
if (summary) console.log();
|
|
@@ -9553,7 +9642,7 @@ function viewIssue(issueKey) {
|
|
|
9553
9642
|
}
|
|
9554
9643
|
if (!summary && !description) {
|
|
9555
9644
|
console.log(
|
|
9556
|
-
|
|
9645
|
+
chalk107.yellow(`No summary or description found on ${issueKey}.`)
|
|
9557
9646
|
);
|
|
9558
9647
|
}
|
|
9559
9648
|
}
|
|
@@ -9569,15 +9658,15 @@ function registerJira(program2) {
|
|
|
9569
9658
|
// src/commands/mermaid/index.ts
|
|
9570
9659
|
import { mkdirSync as mkdirSync8, readdirSync as readdirSync5 } from "fs";
|
|
9571
9660
|
import { resolve as resolve10 } from "path";
|
|
9572
|
-
import
|
|
9661
|
+
import chalk110 from "chalk";
|
|
9573
9662
|
|
|
9574
9663
|
// src/commands/mermaid/exportFile.ts
|
|
9575
9664
|
import { readFileSync as readFileSync27, writeFileSync as writeFileSync19 } from "fs";
|
|
9576
9665
|
import { basename as basename7, extname, resolve as resolve9 } from "path";
|
|
9577
|
-
import
|
|
9666
|
+
import chalk109 from "chalk";
|
|
9578
9667
|
|
|
9579
9668
|
// src/commands/mermaid/renderBlock.ts
|
|
9580
|
-
import
|
|
9669
|
+
import chalk108 from "chalk";
|
|
9581
9670
|
async function renderBlock(krokiUrl, source) {
|
|
9582
9671
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
9583
9672
|
method: "POST",
|
|
@@ -9586,7 +9675,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
9586
9675
|
});
|
|
9587
9676
|
if (!response.ok) {
|
|
9588
9677
|
console.error(
|
|
9589
|
-
|
|
9678
|
+
chalk108.red(
|
|
9590
9679
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
9591
9680
|
)
|
|
9592
9681
|
);
|
|
@@ -9604,19 +9693,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
9604
9693
|
if (onlyIndex !== void 0) {
|
|
9605
9694
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
9606
9695
|
console.error(
|
|
9607
|
-
|
|
9696
|
+
chalk109.red(
|
|
9608
9697
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
9609
9698
|
)
|
|
9610
9699
|
);
|
|
9611
9700
|
process.exit(1);
|
|
9612
9701
|
}
|
|
9613
9702
|
console.log(
|
|
9614
|
-
|
|
9703
|
+
chalk109.gray(
|
|
9615
9704
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
9616
9705
|
)
|
|
9617
9706
|
);
|
|
9618
9707
|
} else {
|
|
9619
|
-
console.log(
|
|
9708
|
+
console.log(chalk109.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
9620
9709
|
}
|
|
9621
9710
|
for (const [i, source] of blocks.entries()) {
|
|
9622
9711
|
const idx = i + 1;
|
|
@@ -9624,7 +9713,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
9624
9713
|
const outPath = resolve9(outDir, `${stem}-${idx}.svg`);
|
|
9625
9714
|
const svg = await renderBlock(krokiUrl, source);
|
|
9626
9715
|
writeFileSync19(outPath, svg, "utf8");
|
|
9627
|
-
console.log(
|
|
9716
|
+
console.log(chalk109.green(` \u2192 ${outPath}`));
|
|
9628
9717
|
}
|
|
9629
9718
|
}
|
|
9630
9719
|
function extractMermaidBlocks(markdown) {
|
|
@@ -9640,18 +9729,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
9640
9729
|
if (options2.index !== void 0) {
|
|
9641
9730
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
9642
9731
|
console.error(
|
|
9643
|
-
|
|
9732
|
+
chalk110.red(`--index must be a positive integer (got ${options2.index})`)
|
|
9644
9733
|
);
|
|
9645
9734
|
process.exit(1);
|
|
9646
9735
|
}
|
|
9647
9736
|
if (!file) {
|
|
9648
|
-
console.error(
|
|
9737
|
+
console.error(chalk110.red("--index requires a file argument"));
|
|
9649
9738
|
process.exit(1);
|
|
9650
9739
|
}
|
|
9651
9740
|
}
|
|
9652
9741
|
const files = file ? [file] : readdirSync5(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
9653
9742
|
if (files.length === 0) {
|
|
9654
|
-
console.log(
|
|
9743
|
+
console.log(chalk110.gray("No markdown files found in current directory."));
|
|
9655
9744
|
return;
|
|
9656
9745
|
}
|
|
9657
9746
|
for (const f of files) {
|
|
@@ -9674,7 +9763,7 @@ function registerMermaid(program2) {
|
|
|
9674
9763
|
}
|
|
9675
9764
|
|
|
9676
9765
|
// src/commands/news/add/index.ts
|
|
9677
|
-
import
|
|
9766
|
+
import chalk111 from "chalk";
|
|
9678
9767
|
import enquirer8 from "enquirer";
|
|
9679
9768
|
async function add2(url) {
|
|
9680
9769
|
if (!url) {
|
|
@@ -9697,17 +9786,17 @@ async function add2(url) {
|
|
|
9697
9786
|
const news = config.news ?? {};
|
|
9698
9787
|
const feeds = news.feeds ?? [];
|
|
9699
9788
|
if (feeds.includes(url)) {
|
|
9700
|
-
console.log(
|
|
9789
|
+
console.log(chalk111.yellow("Feed already exists in config"));
|
|
9701
9790
|
return;
|
|
9702
9791
|
}
|
|
9703
9792
|
feeds.push(url);
|
|
9704
9793
|
config.news = { ...news, feeds };
|
|
9705
9794
|
saveGlobalConfig(config);
|
|
9706
|
-
console.log(
|
|
9795
|
+
console.log(chalk111.green(`Added feed: ${url}`));
|
|
9707
9796
|
}
|
|
9708
9797
|
|
|
9709
9798
|
// src/commands/news/web/handleRequest.ts
|
|
9710
|
-
import
|
|
9799
|
+
import chalk112 from "chalk";
|
|
9711
9800
|
|
|
9712
9801
|
// src/commands/news/web/shared.ts
|
|
9713
9802
|
import { decodeHTML } from "entities";
|
|
@@ -9843,17 +9932,17 @@ function prefetch() {
|
|
|
9843
9932
|
const config = loadConfig();
|
|
9844
9933
|
const total = config.news.feeds.length;
|
|
9845
9934
|
if (total === 0) return;
|
|
9846
|
-
process.stdout.write(
|
|
9935
|
+
process.stdout.write(chalk112.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
9847
9936
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
9848
9937
|
const width = 20;
|
|
9849
9938
|
const filled = Math.round(done2 / t * width);
|
|
9850
9939
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
9851
9940
|
process.stdout.write(
|
|
9852
|
-
`\r${
|
|
9941
|
+
`\r${chalk112.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
9853
9942
|
);
|
|
9854
9943
|
}).then((items2) => {
|
|
9855
9944
|
process.stdout.write(
|
|
9856
|
-
`\r${
|
|
9945
|
+
`\r${chalk112.green(`Fetched ${items2.length} items from ${total} feed(s)`)}
|
|
9857
9946
|
`
|
|
9858
9947
|
);
|
|
9859
9948
|
cachedItems = items2;
|
|
@@ -9898,7 +9987,7 @@ function registerNews(program2) {
|
|
|
9898
9987
|
}
|
|
9899
9988
|
|
|
9900
9989
|
// src/commands/prompts/printPromptsTable.ts
|
|
9901
|
-
import
|
|
9990
|
+
import chalk113 from "chalk";
|
|
9902
9991
|
function truncate(str, max) {
|
|
9903
9992
|
if (str.length <= max) return str;
|
|
9904
9993
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -9916,14 +10005,14 @@ function printPromptsTable(rows) {
|
|
|
9916
10005
|
"Command".padEnd(commandWidth),
|
|
9917
10006
|
"Repos"
|
|
9918
10007
|
].join(" ");
|
|
9919
|
-
console.log(
|
|
9920
|
-
console.log(
|
|
10008
|
+
console.log(chalk113.dim(header));
|
|
10009
|
+
console.log(chalk113.dim("-".repeat(header.length)));
|
|
9921
10010
|
for (const row of rows) {
|
|
9922
|
-
const
|
|
10011
|
+
const count6 = String(row.count).padStart(countWidth);
|
|
9923
10012
|
const tool = row.tool.padEnd(toolWidth);
|
|
9924
10013
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
9925
10014
|
console.log(
|
|
9926
|
-
`${
|
|
10015
|
+
`${chalk113.yellow(count6)} ${tool} ${command} ${chalk113.dim(row.repos)}`
|
|
9927
10016
|
);
|
|
9928
10017
|
}
|
|
9929
10018
|
}
|
|
@@ -10355,20 +10444,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
10355
10444
|
}
|
|
10356
10445
|
|
|
10357
10446
|
// src/commands/prs/listComments/printComments.ts
|
|
10358
|
-
import
|
|
10447
|
+
import chalk114 from "chalk";
|
|
10359
10448
|
function formatForHuman(comment3) {
|
|
10360
10449
|
if (comment3.type === "review") {
|
|
10361
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
10450
|
+
const stateColor = comment3.state === "APPROVED" ? chalk114.green : comment3.state === "CHANGES_REQUESTED" ? chalk114.red : chalk114.yellow;
|
|
10362
10451
|
return [
|
|
10363
|
-
`${
|
|
10452
|
+
`${chalk114.cyan("Review")} by ${chalk114.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
10364
10453
|
comment3.body,
|
|
10365
10454
|
""
|
|
10366
10455
|
].join("\n");
|
|
10367
10456
|
}
|
|
10368
10457
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
10369
10458
|
return [
|
|
10370
|
-
`${
|
|
10371
|
-
|
|
10459
|
+
`${chalk114.cyan("Line comment")} by ${chalk114.bold(comment3.user)} on ${chalk114.dim(`${comment3.path}${location}`)}`,
|
|
10460
|
+
chalk114.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
10372
10461
|
comment3.body,
|
|
10373
10462
|
""
|
|
10374
10463
|
].join("\n");
|
|
@@ -10458,13 +10547,13 @@ import { execSync as execSync34 } from "child_process";
|
|
|
10458
10547
|
import enquirer9 from "enquirer";
|
|
10459
10548
|
|
|
10460
10549
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
10461
|
-
import
|
|
10550
|
+
import chalk115 from "chalk";
|
|
10462
10551
|
var STATUS_MAP = {
|
|
10463
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
10464
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
10552
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk115.magenta("merged"), date: pr.mergedAt } : null,
|
|
10553
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk115.red("closed"), date: pr.closedAt } : null
|
|
10465
10554
|
};
|
|
10466
10555
|
function defaultStatus(pr) {
|
|
10467
|
-
return { label:
|
|
10556
|
+
return { label: chalk115.green("opened"), date: pr.createdAt };
|
|
10468
10557
|
}
|
|
10469
10558
|
function getStatus2(pr) {
|
|
10470
10559
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -10473,11 +10562,11 @@ function formatDate(dateStr) {
|
|
|
10473
10562
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
10474
10563
|
}
|
|
10475
10564
|
function formatPrHeader(pr, status2) {
|
|
10476
|
-
return `${
|
|
10565
|
+
return `${chalk115.cyan(`#${pr.number}`)} ${pr.title} ${chalk115.dim(`(${pr.author.login},`)} ${status2.label} ${chalk115.dim(`${formatDate(status2.date)})`)}`;
|
|
10477
10566
|
}
|
|
10478
10567
|
function logPrDetails(pr) {
|
|
10479
10568
|
console.log(
|
|
10480
|
-
|
|
10569
|
+
chalk115.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
10481
10570
|
);
|
|
10482
10571
|
console.log();
|
|
10483
10572
|
}
|
|
@@ -10533,8 +10622,8 @@ async function promptNavigation(currentPage, totalPages) {
|
|
|
10533
10622
|
});
|
|
10534
10623
|
return parseAction(action);
|
|
10535
10624
|
}
|
|
10536
|
-
function computeTotalPages(
|
|
10537
|
-
return Math.ceil(
|
|
10625
|
+
function computeTotalPages(count6) {
|
|
10626
|
+
return Math.ceil(count6 / PAGE_SIZE);
|
|
10538
10627
|
}
|
|
10539
10628
|
async function navigateAndDisplay(pullRequests, totalPages, currentPage) {
|
|
10540
10629
|
const delta = await promptNavigation(currentPage, totalPages);
|
|
@@ -10644,10 +10733,10 @@ function registerPrs(program2) {
|
|
|
10644
10733
|
}
|
|
10645
10734
|
|
|
10646
10735
|
// src/commands/ravendb/ravendbAuth.ts
|
|
10647
|
-
import
|
|
10736
|
+
import chalk121 from "chalk";
|
|
10648
10737
|
|
|
10649
10738
|
// src/shared/createConnectionAuth.ts
|
|
10650
|
-
import
|
|
10739
|
+
import chalk116 from "chalk";
|
|
10651
10740
|
function listConnections(connections, format2) {
|
|
10652
10741
|
if (connections.length === 0) {
|
|
10653
10742
|
console.log("No connections configured.");
|
|
@@ -10660,7 +10749,7 @@ function listConnections(connections, format2) {
|
|
|
10660
10749
|
function removeConnection(connections, name, save) {
|
|
10661
10750
|
const filtered = connections.filter((c) => c.name !== name);
|
|
10662
10751
|
if (filtered.length === connections.length) {
|
|
10663
|
-
console.error(
|
|
10752
|
+
console.error(chalk116.red(`Connection "${name}" not found.`));
|
|
10664
10753
|
process.exit(1);
|
|
10665
10754
|
}
|
|
10666
10755
|
save(filtered);
|
|
@@ -10706,15 +10795,15 @@ function saveConnections(connections) {
|
|
|
10706
10795
|
}
|
|
10707
10796
|
|
|
10708
10797
|
// src/commands/ravendb/promptConnection.ts
|
|
10709
|
-
import
|
|
10798
|
+
import chalk119 from "chalk";
|
|
10710
10799
|
|
|
10711
10800
|
// src/commands/ravendb/selectOpSecret.ts
|
|
10712
|
-
import
|
|
10801
|
+
import chalk118 from "chalk";
|
|
10713
10802
|
import Enquirer2 from "enquirer";
|
|
10714
10803
|
|
|
10715
10804
|
// src/commands/ravendb/searchItems.ts
|
|
10716
10805
|
import { execSync as execSync36 } from "child_process";
|
|
10717
|
-
import
|
|
10806
|
+
import chalk117 from "chalk";
|
|
10718
10807
|
function opExec(args) {
|
|
10719
10808
|
return execSync36(`op ${args}`, {
|
|
10720
10809
|
encoding: "utf-8",
|
|
@@ -10727,7 +10816,7 @@ function searchItems(search2) {
|
|
|
10727
10816
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
10728
10817
|
} catch {
|
|
10729
10818
|
console.error(
|
|
10730
|
-
|
|
10819
|
+
chalk117.red(
|
|
10731
10820
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
10732
10821
|
)
|
|
10733
10822
|
);
|
|
@@ -10741,7 +10830,7 @@ function getItemFields(itemId) {
|
|
|
10741
10830
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
10742
10831
|
return item.fields.filter((f) => f.reference && f.label);
|
|
10743
10832
|
} catch {
|
|
10744
|
-
console.error(
|
|
10833
|
+
console.error(chalk117.red("Failed to get item details from 1Password."));
|
|
10745
10834
|
process.exit(1);
|
|
10746
10835
|
}
|
|
10747
10836
|
}
|
|
@@ -10760,7 +10849,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
10760
10849
|
}).run();
|
|
10761
10850
|
const items2 = searchItems(search2);
|
|
10762
10851
|
if (items2.length === 0) {
|
|
10763
|
-
console.error(
|
|
10852
|
+
console.error(chalk118.red(`No items found matching "${search2}".`));
|
|
10764
10853
|
process.exit(1);
|
|
10765
10854
|
}
|
|
10766
10855
|
const itemId = await selectOne(
|
|
@@ -10769,7 +10858,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
10769
10858
|
);
|
|
10770
10859
|
const fields = getItemFields(itemId);
|
|
10771
10860
|
if (fields.length === 0) {
|
|
10772
|
-
console.error(
|
|
10861
|
+
console.error(chalk118.red("No fields with references found on this item."));
|
|
10773
10862
|
process.exit(1);
|
|
10774
10863
|
}
|
|
10775
10864
|
const ref = await selectOne(
|
|
@@ -10783,7 +10872,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
10783
10872
|
async function promptConnection(existingNames) {
|
|
10784
10873
|
const name = await promptInput("name", "Connection name:");
|
|
10785
10874
|
if (existingNames.includes(name)) {
|
|
10786
|
-
console.error(
|
|
10875
|
+
console.error(chalk119.red(`Connection "${name}" already exists.`));
|
|
10787
10876
|
process.exit(1);
|
|
10788
10877
|
}
|
|
10789
10878
|
const url = await promptInput(
|
|
@@ -10792,22 +10881,22 @@ async function promptConnection(existingNames) {
|
|
|
10792
10881
|
);
|
|
10793
10882
|
const database = await promptInput("database", "Database name:");
|
|
10794
10883
|
if (!name || !url || !database) {
|
|
10795
|
-
console.error(
|
|
10884
|
+
console.error(chalk119.red("All fields are required."));
|
|
10796
10885
|
process.exit(1);
|
|
10797
10886
|
}
|
|
10798
10887
|
const apiKeyRef = await selectOpSecret();
|
|
10799
|
-
console.log(
|
|
10888
|
+
console.log(chalk119.dim(`Using: ${apiKeyRef}`));
|
|
10800
10889
|
return { name, url, database, apiKeyRef };
|
|
10801
10890
|
}
|
|
10802
10891
|
|
|
10803
10892
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
10804
|
-
import
|
|
10893
|
+
import chalk120 from "chalk";
|
|
10805
10894
|
function ravendbSetConnection(name) {
|
|
10806
10895
|
const raw = loadGlobalConfigRaw();
|
|
10807
10896
|
const ravendb = raw.ravendb ?? {};
|
|
10808
10897
|
const connections = ravendb.connections ?? [];
|
|
10809
10898
|
if (!connections.some((c) => c.name === name)) {
|
|
10810
|
-
console.error(
|
|
10899
|
+
console.error(chalk120.red(`Connection "${name}" not found.`));
|
|
10811
10900
|
console.error(
|
|
10812
10901
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
10813
10902
|
);
|
|
@@ -10823,16 +10912,16 @@ function ravendbSetConnection(name) {
|
|
|
10823
10912
|
var ravendbAuth = createConnectionAuth({
|
|
10824
10913
|
load: loadConnections,
|
|
10825
10914
|
save: saveConnections,
|
|
10826
|
-
format: (c) => `${
|
|
10915
|
+
format: (c) => `${chalk121.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
10827
10916
|
promptNew: promptConnection,
|
|
10828
10917
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
10829
10918
|
});
|
|
10830
10919
|
|
|
10831
10920
|
// src/commands/ravendb/ravendbCollections.ts
|
|
10832
|
-
import
|
|
10921
|
+
import chalk125 from "chalk";
|
|
10833
10922
|
|
|
10834
10923
|
// src/commands/ravendb/ravenFetch.ts
|
|
10835
|
-
import
|
|
10924
|
+
import chalk123 from "chalk";
|
|
10836
10925
|
|
|
10837
10926
|
// src/commands/ravendb/getAccessToken.ts
|
|
10838
10927
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -10869,10 +10958,10 @@ ${errorText}`
|
|
|
10869
10958
|
|
|
10870
10959
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
10871
10960
|
import { execSync as execSync37 } from "child_process";
|
|
10872
|
-
import
|
|
10961
|
+
import chalk122 from "chalk";
|
|
10873
10962
|
function resolveOpSecret(reference) {
|
|
10874
10963
|
if (!reference.startsWith("op://")) {
|
|
10875
|
-
console.error(
|
|
10964
|
+
console.error(chalk122.red(`Invalid secret reference: must start with op://`));
|
|
10876
10965
|
process.exit(1);
|
|
10877
10966
|
}
|
|
10878
10967
|
try {
|
|
@@ -10882,7 +10971,7 @@ function resolveOpSecret(reference) {
|
|
|
10882
10971
|
}).trim();
|
|
10883
10972
|
} catch {
|
|
10884
10973
|
console.error(
|
|
10885
|
-
|
|
10974
|
+
chalk122.red(
|
|
10886
10975
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
10887
10976
|
)
|
|
10888
10977
|
);
|
|
@@ -10909,7 +10998,7 @@ async function ravenFetch(connection, path52) {
|
|
|
10909
10998
|
if (!response.ok) {
|
|
10910
10999
|
const body = await response.text();
|
|
10911
11000
|
console.error(
|
|
10912
|
-
|
|
11001
|
+
chalk123.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
10913
11002
|
);
|
|
10914
11003
|
console.error(body.substring(0, 500));
|
|
10915
11004
|
process.exit(1);
|
|
@@ -10918,7 +11007,7 @@ async function ravenFetch(connection, path52) {
|
|
|
10918
11007
|
}
|
|
10919
11008
|
|
|
10920
11009
|
// src/commands/ravendb/resolveConnection.ts
|
|
10921
|
-
import
|
|
11010
|
+
import chalk124 from "chalk";
|
|
10922
11011
|
function loadRavendb() {
|
|
10923
11012
|
const raw = loadGlobalConfigRaw();
|
|
10924
11013
|
const ravendb = raw.ravendb;
|
|
@@ -10932,7 +11021,7 @@ function resolveConnection(name) {
|
|
|
10932
11021
|
const connectionName = name ?? defaultConnection;
|
|
10933
11022
|
if (!connectionName) {
|
|
10934
11023
|
console.error(
|
|
10935
|
-
|
|
11024
|
+
chalk124.red(
|
|
10936
11025
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
10937
11026
|
)
|
|
10938
11027
|
);
|
|
@@ -10940,7 +11029,7 @@ function resolveConnection(name) {
|
|
|
10940
11029
|
}
|
|
10941
11030
|
const connection = connections.find((c) => c.name === connectionName);
|
|
10942
11031
|
if (!connection) {
|
|
10943
|
-
console.error(
|
|
11032
|
+
console.error(chalk124.red(`Connection "${connectionName}" not found.`));
|
|
10944
11033
|
console.error(
|
|
10945
11034
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
10946
11035
|
);
|
|
@@ -10971,15 +11060,15 @@ async function ravendbCollections(connectionName) {
|
|
|
10971
11060
|
return;
|
|
10972
11061
|
}
|
|
10973
11062
|
for (const c of collections) {
|
|
10974
|
-
console.log(`${
|
|
11063
|
+
console.log(`${chalk125.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
10975
11064
|
}
|
|
10976
11065
|
}
|
|
10977
11066
|
|
|
10978
11067
|
// src/commands/ravendb/ravendbQuery.ts
|
|
10979
|
-
import
|
|
11068
|
+
import chalk127 from "chalk";
|
|
10980
11069
|
|
|
10981
11070
|
// src/commands/ravendb/fetchAllPages.ts
|
|
10982
|
-
import
|
|
11071
|
+
import chalk126 from "chalk";
|
|
10983
11072
|
|
|
10984
11073
|
// src/commands/ravendb/buildQueryPath.ts
|
|
10985
11074
|
function buildQueryPath(opts) {
|
|
@@ -11017,7 +11106,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
11017
11106
|
allResults.push(...results);
|
|
11018
11107
|
start3 += results.length;
|
|
11019
11108
|
process.stderr.write(
|
|
11020
|
-
`\r${
|
|
11109
|
+
`\r${chalk126.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
11021
11110
|
);
|
|
11022
11111
|
if (start3 >= totalResults) break;
|
|
11023
11112
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -11032,7 +11121,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
11032
11121
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
11033
11122
|
const resolved = resolveArgs(connectionName, collection);
|
|
11034
11123
|
if (!resolved.collection && !options2.query) {
|
|
11035
|
-
console.error(
|
|
11124
|
+
console.error(chalk127.red("Provide a collection name or --query filter."));
|
|
11036
11125
|
process.exit(1);
|
|
11037
11126
|
}
|
|
11038
11127
|
const { collection: col } = resolved;
|
|
@@ -11070,7 +11159,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
11070
11159
|
import * as path29 from "path";
|
|
11071
11160
|
|
|
11072
11161
|
// src/commands/refactor/logViolations.ts
|
|
11073
|
-
import
|
|
11162
|
+
import chalk128 from "chalk";
|
|
11074
11163
|
var DEFAULT_MAX_LINES = 100;
|
|
11075
11164
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
11076
11165
|
if (violations.length === 0) {
|
|
@@ -11079,43 +11168,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
11079
11168
|
}
|
|
11080
11169
|
return;
|
|
11081
11170
|
}
|
|
11082
|
-
console.error(
|
|
11171
|
+
console.error(chalk128.red(`
|
|
11083
11172
|
Refactor check failed:
|
|
11084
11173
|
`));
|
|
11085
|
-
console.error(
|
|
11174
|
+
console.error(chalk128.red(` The following files exceed ${maxLines} lines:
|
|
11086
11175
|
`));
|
|
11087
11176
|
for (const violation of violations) {
|
|
11088
|
-
console.error(
|
|
11177
|
+
console.error(chalk128.red(` ${violation.file} (${violation.lines} lines)`));
|
|
11089
11178
|
}
|
|
11090
11179
|
console.error(
|
|
11091
|
-
|
|
11180
|
+
chalk128.yellow(
|
|
11092
11181
|
`
|
|
11093
11182
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
11094
11183
|
way to refactor it, ignore it with:
|
|
11095
11184
|
`
|
|
11096
11185
|
)
|
|
11097
11186
|
);
|
|
11098
|
-
console.error(
|
|
11187
|
+
console.error(chalk128.gray(` assist refactor ignore <file>
|
|
11099
11188
|
`));
|
|
11100
11189
|
if (process.env.CLAUDECODE) {
|
|
11101
|
-
console.error(
|
|
11190
|
+
console.error(chalk128.cyan(`
|
|
11102
11191
|
## Extracting Code to New Files
|
|
11103
11192
|
`));
|
|
11104
11193
|
console.error(
|
|
11105
|
-
|
|
11194
|
+
chalk128.cyan(
|
|
11106
11195
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
11107
11196
|
`
|
|
11108
11197
|
)
|
|
11109
11198
|
);
|
|
11110
11199
|
console.error(
|
|
11111
|
-
|
|
11200
|
+
chalk128.cyan(
|
|
11112
11201
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
11113
11202
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
11114
11203
|
`
|
|
11115
11204
|
)
|
|
11116
11205
|
);
|
|
11117
11206
|
console.error(
|
|
11118
|
-
|
|
11207
|
+
chalk128.cyan(
|
|
11119
11208
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
11120
11209
|
domains, move it to a common/shared folder.
|
|
11121
11210
|
`
|
|
@@ -11271,7 +11360,7 @@ async function check(pattern2, options2) {
|
|
|
11271
11360
|
|
|
11272
11361
|
// src/commands/refactor/extract/index.ts
|
|
11273
11362
|
import path36 from "path";
|
|
11274
|
-
import
|
|
11363
|
+
import chalk131 from "chalk";
|
|
11275
11364
|
|
|
11276
11365
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
11277
11366
|
import { SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
@@ -11818,23 +11907,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
11818
11907
|
|
|
11819
11908
|
// src/commands/refactor/extract/displayPlan.ts
|
|
11820
11909
|
import path33 from "path";
|
|
11821
|
-
import
|
|
11910
|
+
import chalk129 from "chalk";
|
|
11822
11911
|
function section(title) {
|
|
11823
11912
|
return `
|
|
11824
|
-
${
|
|
11913
|
+
${chalk129.cyan(title)}`;
|
|
11825
11914
|
}
|
|
11826
11915
|
function displayImporters(plan2, cwd) {
|
|
11827
11916
|
if (plan2.importersToUpdate.length === 0) return;
|
|
11828
11917
|
console.log(section("Update importers:"));
|
|
11829
11918
|
for (const imp of plan2.importersToUpdate) {
|
|
11830
11919
|
const rel = path33.relative(cwd, imp.file.getFilePath());
|
|
11831
|
-
console.log(` ${
|
|
11920
|
+
console.log(` ${chalk129.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
11832
11921
|
}
|
|
11833
11922
|
}
|
|
11834
11923
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
11835
|
-
console.log(
|
|
11924
|
+
console.log(chalk129.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
11836
11925
|
`));
|
|
11837
|
-
console.log(` ${
|
|
11926
|
+
console.log(` ${chalk129.cyan("Functions to move:")}`);
|
|
11838
11927
|
for (const name of plan2.extractedNames) {
|
|
11839
11928
|
console.log(` ${name}`);
|
|
11840
11929
|
}
|
|
@@ -11868,7 +11957,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
11868
11957
|
|
|
11869
11958
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
11870
11959
|
import path35 from "path";
|
|
11871
|
-
import
|
|
11960
|
+
import chalk130 from "chalk";
|
|
11872
11961
|
import { Project as Project3 } from "ts-morph";
|
|
11873
11962
|
|
|
11874
11963
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -11928,7 +12017,7 @@ function loadProjectFile(file) {
|
|
|
11928
12017
|
});
|
|
11929
12018
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
11930
12019
|
if (!sourceFile) {
|
|
11931
|
-
console.log(
|
|
12020
|
+
console.log(chalk130.red(`File not found in project: ${file}`));
|
|
11932
12021
|
process.exit(1);
|
|
11933
12022
|
}
|
|
11934
12023
|
return { project, sourceFile };
|
|
@@ -11951,19 +12040,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
11951
12040
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
11952
12041
|
if (options2.apply) {
|
|
11953
12042
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
11954
|
-
console.log(
|
|
12043
|
+
console.log(chalk131.green("\nExtraction complete"));
|
|
11955
12044
|
} else {
|
|
11956
|
-
console.log(
|
|
12045
|
+
console.log(chalk131.dim("\nDry run. Use --apply to execute."));
|
|
11957
12046
|
}
|
|
11958
12047
|
}
|
|
11959
12048
|
|
|
11960
12049
|
// src/commands/refactor/ignore.ts
|
|
11961
12050
|
import fs21 from "fs";
|
|
11962
|
-
import
|
|
12051
|
+
import chalk132 from "chalk";
|
|
11963
12052
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
11964
12053
|
function ignore(file) {
|
|
11965
12054
|
if (!fs21.existsSync(file)) {
|
|
11966
|
-
console.error(
|
|
12055
|
+
console.error(chalk132.red(`Error: File does not exist: ${file}`));
|
|
11967
12056
|
process.exit(1);
|
|
11968
12057
|
}
|
|
11969
12058
|
const content = fs21.readFileSync(file, "utf-8");
|
|
@@ -11979,7 +12068,7 @@ function ignore(file) {
|
|
|
11979
12068
|
fs21.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
11980
12069
|
}
|
|
11981
12070
|
console.log(
|
|
11982
|
-
|
|
12071
|
+
chalk132.green(
|
|
11983
12072
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
11984
12073
|
)
|
|
11985
12074
|
);
|
|
@@ -11987,25 +12076,25 @@ function ignore(file) {
|
|
|
11987
12076
|
|
|
11988
12077
|
// src/commands/refactor/rename/index.ts
|
|
11989
12078
|
import path37 from "path";
|
|
11990
|
-
import
|
|
12079
|
+
import chalk133 from "chalk";
|
|
11991
12080
|
async function rename(source, destination, options2 = {}) {
|
|
11992
12081
|
const destPath = path37.resolve(destination);
|
|
11993
12082
|
const cwd = process.cwd();
|
|
11994
12083
|
const relSource = path37.relative(cwd, path37.resolve(source));
|
|
11995
12084
|
const relDest = path37.relative(cwd, destPath);
|
|
11996
12085
|
const { project, sourceFile } = loadProjectFile(source);
|
|
11997
|
-
console.log(
|
|
12086
|
+
console.log(chalk133.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
11998
12087
|
if (options2.apply) {
|
|
11999
12088
|
sourceFile.move(destPath);
|
|
12000
12089
|
await project.save();
|
|
12001
|
-
console.log(
|
|
12090
|
+
console.log(chalk133.green("Done"));
|
|
12002
12091
|
} else {
|
|
12003
|
-
console.log(
|
|
12092
|
+
console.log(chalk133.dim("Dry run. Use --apply to execute."));
|
|
12004
12093
|
}
|
|
12005
12094
|
}
|
|
12006
12095
|
|
|
12007
12096
|
// src/commands/refactor/renameSymbol/index.ts
|
|
12008
|
-
import
|
|
12097
|
+
import chalk134 from "chalk";
|
|
12009
12098
|
|
|
12010
12099
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
12011
12100
|
import { SyntaxKind as SyntaxKind13 } from "ts-morph";
|
|
@@ -12051,33 +12140,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
12051
12140
|
const { project, sourceFile } = loadProjectFile(file);
|
|
12052
12141
|
const symbol = findSymbol(sourceFile, oldName);
|
|
12053
12142
|
if (!symbol) {
|
|
12054
|
-
console.log(
|
|
12143
|
+
console.log(chalk134.red(`Symbol "${oldName}" not found in ${file}`));
|
|
12055
12144
|
process.exit(1);
|
|
12056
12145
|
}
|
|
12057
12146
|
const grouped = groupReferences(symbol, cwd);
|
|
12058
12147
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
12059
12148
|
console.log(
|
|
12060
|
-
|
|
12149
|
+
chalk134.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
12061
12150
|
`)
|
|
12062
12151
|
);
|
|
12063
12152
|
for (const [refFile, lines] of grouped) {
|
|
12064
12153
|
console.log(
|
|
12065
|
-
` ${
|
|
12154
|
+
` ${chalk134.dim(refFile)}: lines ${chalk134.cyan(lines.join(", "))}`
|
|
12066
12155
|
);
|
|
12067
12156
|
}
|
|
12068
12157
|
if (options2.apply) {
|
|
12069
12158
|
symbol.rename(newName);
|
|
12070
12159
|
await project.save();
|
|
12071
|
-
console.log(
|
|
12160
|
+
console.log(chalk134.green(`
|
|
12072
12161
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
12073
12162
|
} else {
|
|
12074
|
-
console.log(
|
|
12163
|
+
console.log(chalk134.dim("\nDry run. Use --apply to execute."));
|
|
12075
12164
|
}
|
|
12076
12165
|
}
|
|
12077
12166
|
|
|
12078
12167
|
// src/commands/refactor/restructure/index.ts
|
|
12079
12168
|
import path47 from "path";
|
|
12080
|
-
import
|
|
12169
|
+
import chalk137 from "chalk";
|
|
12081
12170
|
|
|
12082
12171
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
12083
12172
|
import path39 from "path";
|
|
@@ -12320,50 +12409,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
12320
12409
|
|
|
12321
12410
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
12322
12411
|
import path43 from "path";
|
|
12323
|
-
import
|
|
12412
|
+
import chalk135 from "chalk";
|
|
12324
12413
|
function relPath(filePath) {
|
|
12325
12414
|
return path43.relative(process.cwd(), filePath);
|
|
12326
12415
|
}
|
|
12327
12416
|
function displayMoves(plan2) {
|
|
12328
12417
|
if (plan2.moves.length === 0) return;
|
|
12329
|
-
console.log(
|
|
12418
|
+
console.log(chalk135.bold("\nFile moves:"));
|
|
12330
12419
|
for (const move of plan2.moves) {
|
|
12331
12420
|
console.log(
|
|
12332
|
-
` ${
|
|
12421
|
+
` ${chalk135.red(relPath(move.from))} \u2192 ${chalk135.green(relPath(move.to))}`
|
|
12333
12422
|
);
|
|
12334
|
-
console.log(
|
|
12423
|
+
console.log(chalk135.dim(` ${move.reason}`));
|
|
12335
12424
|
}
|
|
12336
12425
|
}
|
|
12337
12426
|
function displayRewrites(rewrites) {
|
|
12338
12427
|
if (rewrites.length === 0) return;
|
|
12339
12428
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
12340
|
-
console.log(
|
|
12429
|
+
console.log(chalk135.bold(`
|
|
12341
12430
|
Import rewrites (${affectedFiles.size} files):`));
|
|
12342
12431
|
for (const file of affectedFiles) {
|
|
12343
|
-
console.log(` ${
|
|
12432
|
+
console.log(` ${chalk135.cyan(relPath(file))}:`);
|
|
12344
12433
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
12345
12434
|
(r) => r.file === file
|
|
12346
12435
|
)) {
|
|
12347
12436
|
console.log(
|
|
12348
|
-
` ${
|
|
12437
|
+
` ${chalk135.red(`"${oldSpecifier}"`)} \u2192 ${chalk135.green(`"${newSpecifier}"`)}`
|
|
12349
12438
|
);
|
|
12350
12439
|
}
|
|
12351
12440
|
}
|
|
12352
12441
|
}
|
|
12353
12442
|
function displayPlan2(plan2) {
|
|
12354
12443
|
if (plan2.warnings.length > 0) {
|
|
12355
|
-
console.log(
|
|
12356
|
-
for (const w of plan2.warnings) console.log(
|
|
12444
|
+
console.log(chalk135.yellow("\nWarnings:"));
|
|
12445
|
+
for (const w of plan2.warnings) console.log(chalk135.yellow(` ${w}`));
|
|
12357
12446
|
}
|
|
12358
12447
|
if (plan2.newDirectories.length > 0) {
|
|
12359
|
-
console.log(
|
|
12448
|
+
console.log(chalk135.bold("\nNew directories:"));
|
|
12360
12449
|
for (const dir of plan2.newDirectories)
|
|
12361
|
-
console.log(
|
|
12450
|
+
console.log(chalk135.green(` ${dir}/`));
|
|
12362
12451
|
}
|
|
12363
12452
|
displayMoves(plan2);
|
|
12364
12453
|
displayRewrites(plan2.rewrites);
|
|
12365
12454
|
console.log(
|
|
12366
|
-
|
|
12455
|
+
chalk135.dim(
|
|
12367
12456
|
`
|
|
12368
12457
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
12369
12458
|
)
|
|
@@ -12373,18 +12462,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
12373
12462
|
// src/commands/refactor/restructure/executePlan.ts
|
|
12374
12463
|
import fs23 from "fs";
|
|
12375
12464
|
import path44 from "path";
|
|
12376
|
-
import
|
|
12465
|
+
import chalk136 from "chalk";
|
|
12377
12466
|
function executePlan(plan2) {
|
|
12378
12467
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
12379
12468
|
for (const [file, content] of updatedContents) {
|
|
12380
12469
|
fs23.writeFileSync(file, content, "utf-8");
|
|
12381
12470
|
console.log(
|
|
12382
|
-
|
|
12471
|
+
chalk136.cyan(` Rewrote imports in ${path44.relative(process.cwd(), file)}`)
|
|
12383
12472
|
);
|
|
12384
12473
|
}
|
|
12385
12474
|
for (const dir of plan2.newDirectories) {
|
|
12386
12475
|
fs23.mkdirSync(dir, { recursive: true });
|
|
12387
|
-
console.log(
|
|
12476
|
+
console.log(chalk136.green(` Created ${path44.relative(process.cwd(), dir)}/`));
|
|
12388
12477
|
}
|
|
12389
12478
|
for (const move of plan2.moves) {
|
|
12390
12479
|
const targetDir = path44.dirname(move.to);
|
|
@@ -12393,7 +12482,7 @@ function executePlan(plan2) {
|
|
|
12393
12482
|
}
|
|
12394
12483
|
fs23.renameSync(move.from, move.to);
|
|
12395
12484
|
console.log(
|
|
12396
|
-
|
|
12485
|
+
chalk136.white(
|
|
12397
12486
|
` Moved ${path44.relative(process.cwd(), move.from)} \u2192 ${path44.relative(process.cwd(), move.to)}`
|
|
12398
12487
|
)
|
|
12399
12488
|
);
|
|
@@ -12408,7 +12497,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
12408
12497
|
if (entries.length === 0) {
|
|
12409
12498
|
fs23.rmdirSync(dir);
|
|
12410
12499
|
console.log(
|
|
12411
|
-
|
|
12500
|
+
chalk136.dim(
|
|
12412
12501
|
` Removed empty directory ${path44.relative(process.cwd(), dir)}`
|
|
12413
12502
|
)
|
|
12414
12503
|
);
|
|
@@ -12541,22 +12630,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
12541
12630
|
const targetPattern = pattern2 ?? "src";
|
|
12542
12631
|
const files = findSourceFiles2(targetPattern);
|
|
12543
12632
|
if (files.length === 0) {
|
|
12544
|
-
console.log(
|
|
12633
|
+
console.log(chalk137.yellow("No files found matching pattern"));
|
|
12545
12634
|
return;
|
|
12546
12635
|
}
|
|
12547
12636
|
const tsConfigPath = path47.resolve("tsconfig.json");
|
|
12548
12637
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
12549
12638
|
if (plan2.moves.length === 0) {
|
|
12550
|
-
console.log(
|
|
12639
|
+
console.log(chalk137.green("No restructuring needed"));
|
|
12551
12640
|
return;
|
|
12552
12641
|
}
|
|
12553
12642
|
displayPlan2(plan2);
|
|
12554
12643
|
if (options2.apply) {
|
|
12555
|
-
console.log(
|
|
12644
|
+
console.log(chalk137.bold("\nApplying changes..."));
|
|
12556
12645
|
executePlan(plan2);
|
|
12557
|
-
console.log(
|
|
12646
|
+
console.log(chalk137.green("\nRestructuring complete"));
|
|
12558
12647
|
} else {
|
|
12559
|
-
console.log(
|
|
12648
|
+
console.log(chalk137.dim("\nDry run. Use --apply to execute."));
|
|
12560
12649
|
}
|
|
12561
12650
|
}
|
|
12562
12651
|
|
|
@@ -13021,26 +13110,26 @@ async function postAndMaybeSubmit(lineBound, markdown, options2) {
|
|
|
13021
13110
|
}
|
|
13022
13111
|
|
|
13023
13112
|
// src/commands/review/warnUnlocated.ts
|
|
13024
|
-
import
|
|
13113
|
+
import chalk138 from "chalk";
|
|
13025
13114
|
function warnUnlocated(unlocated) {
|
|
13026
13115
|
if (unlocated.length === 0) return;
|
|
13027
13116
|
console.warn(
|
|
13028
|
-
|
|
13117
|
+
chalk138.yellow(
|
|
13029
13118
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
13030
13119
|
)
|
|
13031
13120
|
);
|
|
13032
13121
|
for (const finding of unlocated) {
|
|
13033
|
-
const where = finding.location ||
|
|
13122
|
+
const where = finding.location || chalk138.dim("missing");
|
|
13034
13123
|
console.warn(
|
|
13035
|
-
` ${
|
|
13124
|
+
` ${chalk138.yellow("\xB7")} ${finding.title} ${chalk138.dim(`(${where})`)}`
|
|
13036
13125
|
);
|
|
13037
13126
|
}
|
|
13038
13127
|
}
|
|
13039
13128
|
|
|
13040
13129
|
// src/commands/review/postReviewToPr.ts
|
|
13041
|
-
async function confirmPost(prNumber,
|
|
13130
|
+
async function confirmPost(prNumber, count6, options2) {
|
|
13042
13131
|
if (!options2.prompt) return true;
|
|
13043
|
-
return promptConfirm(`Post ${
|
|
13132
|
+
return promptConfirm(`Post ${count6} comment(s) to PR #${prNumber}?`, false);
|
|
13044
13133
|
}
|
|
13045
13134
|
async function postReviewToPr(synthesisPath, options2) {
|
|
13046
13135
|
const prNumber = findCurrentPrNumber();
|
|
@@ -14064,9 +14153,9 @@ async function runReviewPipeline(paths, options2) {
|
|
|
14064
14153
|
}
|
|
14065
14154
|
|
|
14066
14155
|
// src/commands/review/reviewPr.ts
|
|
14067
|
-
function logPriorComments(
|
|
14068
|
-
if (
|
|
14069
|
-
console.log(`Including ${
|
|
14156
|
+
function logPriorComments(count6) {
|
|
14157
|
+
if (count6 === 0) return;
|
|
14158
|
+
console.log(`Including ${count6} prior review comment(s) in request.md.`);
|
|
14070
14159
|
}
|
|
14071
14160
|
function gatherChangedContext() {
|
|
14072
14161
|
const context = gatherContext();
|
|
@@ -14226,7 +14315,7 @@ function registerReview(program2) {
|
|
|
14226
14315
|
}
|
|
14227
14316
|
|
|
14228
14317
|
// src/commands/seq/seqAuth.ts
|
|
14229
|
-
import
|
|
14318
|
+
import chalk140 from "chalk";
|
|
14230
14319
|
|
|
14231
14320
|
// src/commands/seq/loadConnections.ts
|
|
14232
14321
|
function loadConnections2() {
|
|
@@ -14255,10 +14344,10 @@ function setDefaultConnection(name) {
|
|
|
14255
14344
|
}
|
|
14256
14345
|
|
|
14257
14346
|
// src/shared/assertUniqueName.ts
|
|
14258
|
-
import
|
|
14347
|
+
import chalk139 from "chalk";
|
|
14259
14348
|
function assertUniqueName(existingNames, name) {
|
|
14260
14349
|
if (existingNames.includes(name)) {
|
|
14261
|
-
console.error(
|
|
14350
|
+
console.error(chalk139.red(`Connection "${name}" already exists.`));
|
|
14262
14351
|
process.exit(1);
|
|
14263
14352
|
}
|
|
14264
14353
|
}
|
|
@@ -14276,16 +14365,16 @@ async function promptConnection2(existingNames) {
|
|
|
14276
14365
|
var seqAuth = createConnectionAuth({
|
|
14277
14366
|
load: loadConnections2,
|
|
14278
14367
|
save: saveConnections2,
|
|
14279
|
-
format: (c) => `${
|
|
14368
|
+
format: (c) => `${chalk140.bold(c.name)} ${c.url}`,
|
|
14280
14369
|
promptNew: promptConnection2,
|
|
14281
14370
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
14282
14371
|
});
|
|
14283
14372
|
|
|
14284
14373
|
// src/commands/seq/seqQuery.ts
|
|
14285
|
-
import
|
|
14374
|
+
import chalk144 from "chalk";
|
|
14286
14375
|
|
|
14287
14376
|
// src/commands/seq/fetchSeq.ts
|
|
14288
|
-
import
|
|
14377
|
+
import chalk141 from "chalk";
|
|
14289
14378
|
async function fetchSeq(conn, path52, params) {
|
|
14290
14379
|
const url = `${conn.url}${path52}?${params}`;
|
|
14291
14380
|
const response = await fetch(url, {
|
|
@@ -14296,7 +14385,7 @@ async function fetchSeq(conn, path52, params) {
|
|
|
14296
14385
|
});
|
|
14297
14386
|
if (!response.ok) {
|
|
14298
14387
|
const body = await response.text();
|
|
14299
|
-
console.error(
|
|
14388
|
+
console.error(chalk141.red(`Seq returned ${response.status}: ${body}`));
|
|
14300
14389
|
process.exit(1);
|
|
14301
14390
|
}
|
|
14302
14391
|
return response;
|
|
@@ -14308,9 +14397,9 @@ function filterToSql(filter) {
|
|
|
14308
14397
|
}
|
|
14309
14398
|
|
|
14310
14399
|
// src/commands/seq/fetchSeqData.ts
|
|
14311
|
-
async function fetchSeqData(conn, filter,
|
|
14400
|
+
async function fetchSeqData(conn, filter, count6, from, to) {
|
|
14312
14401
|
const sqlFilter = filterToSql(filter);
|
|
14313
|
-
const sql4 = `select @Timestamp, @Level, @Exception, @Message from stream where ${sqlFilter} order by @Timestamp desc limit ${
|
|
14402
|
+
const sql4 = `select @Timestamp, @Level, @Exception, @Message from stream where ${sqlFilter} order by @Timestamp desc limit ${count6}`;
|
|
14314
14403
|
const params = new URLSearchParams({ q: sql4 });
|
|
14315
14404
|
if (from) params.set("fromDateUtc", from);
|
|
14316
14405
|
if (to) params.set("toDateUtc", to);
|
|
@@ -14351,23 +14440,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
14351
14440
|
}
|
|
14352
14441
|
|
|
14353
14442
|
// src/commands/seq/formatEvent.ts
|
|
14354
|
-
import
|
|
14443
|
+
import chalk142 from "chalk";
|
|
14355
14444
|
function levelColor(level) {
|
|
14356
14445
|
switch (level) {
|
|
14357
14446
|
case "Fatal":
|
|
14358
|
-
return
|
|
14447
|
+
return chalk142.bgRed.white;
|
|
14359
14448
|
case "Error":
|
|
14360
|
-
return
|
|
14449
|
+
return chalk142.red;
|
|
14361
14450
|
case "Warning":
|
|
14362
|
-
return
|
|
14451
|
+
return chalk142.yellow;
|
|
14363
14452
|
case "Information":
|
|
14364
|
-
return
|
|
14453
|
+
return chalk142.cyan;
|
|
14365
14454
|
case "Debug":
|
|
14366
|
-
return
|
|
14455
|
+
return chalk142.gray;
|
|
14367
14456
|
case "Verbose":
|
|
14368
|
-
return
|
|
14457
|
+
return chalk142.dim;
|
|
14369
14458
|
default:
|
|
14370
|
-
return
|
|
14459
|
+
return chalk142.white;
|
|
14371
14460
|
}
|
|
14372
14461
|
}
|
|
14373
14462
|
function levelAbbrev(level) {
|
|
@@ -14408,12 +14497,12 @@ function formatTimestamp(iso) {
|
|
|
14408
14497
|
function formatEvent(event) {
|
|
14409
14498
|
const color = levelColor(event.Level);
|
|
14410
14499
|
const abbrev = levelAbbrev(event.Level);
|
|
14411
|
-
const ts8 =
|
|
14500
|
+
const ts8 = chalk142.dim(formatTimestamp(event.Timestamp));
|
|
14412
14501
|
const msg = renderMessage(event);
|
|
14413
14502
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
14414
14503
|
if (event.Exception) {
|
|
14415
14504
|
for (const line of event.Exception.split("\n")) {
|
|
14416
|
-
lines.push(
|
|
14505
|
+
lines.push(chalk142.red(` ${line}`));
|
|
14417
14506
|
}
|
|
14418
14507
|
}
|
|
14419
14508
|
return lines.join("\n");
|
|
@@ -14446,11 +14535,11 @@ function rejectTimestampFilter(filter) {
|
|
|
14446
14535
|
}
|
|
14447
14536
|
|
|
14448
14537
|
// src/shared/resolveNamedConnection.ts
|
|
14449
|
-
import
|
|
14538
|
+
import chalk143 from "chalk";
|
|
14450
14539
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
14451
14540
|
if (connections.length === 0) {
|
|
14452
14541
|
console.error(
|
|
14453
|
-
|
|
14542
|
+
chalk143.red(
|
|
14454
14543
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
14455
14544
|
)
|
|
14456
14545
|
);
|
|
@@ -14459,7 +14548,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
14459
14548
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
14460
14549
|
const connection = connections.find((c) => c.name === target);
|
|
14461
14550
|
if (!connection) {
|
|
14462
|
-
console.error(
|
|
14551
|
+
console.error(chalk143.red(`${kind} connection "${target}" not found.`));
|
|
14463
14552
|
process.exit(1);
|
|
14464
14553
|
}
|
|
14465
14554
|
return connection;
|
|
@@ -14480,15 +14569,15 @@ function resolveConnection2(name) {
|
|
|
14480
14569
|
async function seqQuery(filter, options2) {
|
|
14481
14570
|
rejectTimestampFilter(filter);
|
|
14482
14571
|
const conn = resolveConnection2(options2.connection);
|
|
14483
|
-
const
|
|
14572
|
+
const count6 = Number.parseInt(options2.count ?? "1000", 10);
|
|
14484
14573
|
const from = options2.from ? parseRelativeTime(options2.from) : void 0;
|
|
14485
14574
|
const to = options2.to ? parseRelativeTime(options2.to) : void 0;
|
|
14486
|
-
const events = from || to ? await fetchSeqData(conn, filter,
|
|
14575
|
+
const events = from || to ? await fetchSeqData(conn, filter, count6, from, to) : await fetchSeqEvents(
|
|
14487
14576
|
conn,
|
|
14488
|
-
new URLSearchParams({ filter, count: String(
|
|
14577
|
+
new URLSearchParams({ filter, count: String(count6) })
|
|
14489
14578
|
);
|
|
14490
14579
|
if (events.length === 0) {
|
|
14491
|
-
console.log(
|
|
14580
|
+
console.log(chalk144.yellow("No events found."));
|
|
14492
14581
|
return;
|
|
14493
14582
|
}
|
|
14494
14583
|
if (options2.json) {
|
|
@@ -14499,22 +14588,22 @@ async function seqQuery(filter, options2) {
|
|
|
14499
14588
|
for (const event of chronological) {
|
|
14500
14589
|
console.log(formatEvent(event));
|
|
14501
14590
|
}
|
|
14502
|
-
console.log(
|
|
14591
|
+
console.log(chalk144.dim(`
|
|
14503
14592
|
${events.length} events`));
|
|
14504
|
-
if (events.length >=
|
|
14593
|
+
if (events.length >= count6) {
|
|
14505
14594
|
console.log(
|
|
14506
|
-
|
|
14507
|
-
`Results limited to ${
|
|
14595
|
+
chalk144.yellow(
|
|
14596
|
+
`Results limited to ${count6}. Use --count to retrieve more.`
|
|
14508
14597
|
)
|
|
14509
14598
|
);
|
|
14510
14599
|
}
|
|
14511
14600
|
}
|
|
14512
14601
|
|
|
14513
14602
|
// src/shared/setNamedDefaultConnection.ts
|
|
14514
|
-
import
|
|
14603
|
+
import chalk145 from "chalk";
|
|
14515
14604
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
14516
14605
|
if (!connections.find((c) => c.name === name)) {
|
|
14517
|
-
console.error(
|
|
14606
|
+
console.error(chalk145.red(`Connection "${name}" not found.`));
|
|
14518
14607
|
process.exit(1);
|
|
14519
14608
|
}
|
|
14520
14609
|
setDefault(name);
|
|
@@ -14558,7 +14647,7 @@ function registerSignal(program2) {
|
|
|
14558
14647
|
}
|
|
14559
14648
|
|
|
14560
14649
|
// src/commands/sql/sqlAuth.ts
|
|
14561
|
-
import
|
|
14650
|
+
import chalk147 from "chalk";
|
|
14562
14651
|
|
|
14563
14652
|
// src/commands/sql/loadConnections.ts
|
|
14564
14653
|
function loadConnections3() {
|
|
@@ -14587,7 +14676,7 @@ function setDefaultConnection2(name) {
|
|
|
14587
14676
|
}
|
|
14588
14677
|
|
|
14589
14678
|
// src/commands/sql/promptConnection.ts
|
|
14590
|
-
import
|
|
14679
|
+
import chalk146 from "chalk";
|
|
14591
14680
|
async function promptConnection3(existingNames) {
|
|
14592
14681
|
const name = await promptInput("name", "Connection name:", "default");
|
|
14593
14682
|
assertUniqueName(existingNames, name);
|
|
@@ -14595,7 +14684,7 @@ async function promptConnection3(existingNames) {
|
|
|
14595
14684
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
14596
14685
|
const port = Number.parseInt(portStr, 10);
|
|
14597
14686
|
if (!Number.isFinite(port)) {
|
|
14598
|
-
console.error(
|
|
14687
|
+
console.error(chalk146.red(`Invalid port "${portStr}".`));
|
|
14599
14688
|
process.exit(1);
|
|
14600
14689
|
}
|
|
14601
14690
|
const user = await promptInput("user", "User:");
|
|
@@ -14608,13 +14697,13 @@ async function promptConnection3(existingNames) {
|
|
|
14608
14697
|
var sqlAuth = createConnectionAuth({
|
|
14609
14698
|
load: loadConnections3,
|
|
14610
14699
|
save: saveConnections3,
|
|
14611
|
-
format: (c) => `${
|
|
14700
|
+
format: (c) => `${chalk147.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
14612
14701
|
promptNew: promptConnection3,
|
|
14613
14702
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
14614
14703
|
});
|
|
14615
14704
|
|
|
14616
14705
|
// src/commands/sql/printTable.ts
|
|
14617
|
-
import
|
|
14706
|
+
import chalk148 from "chalk";
|
|
14618
14707
|
function formatCell(value) {
|
|
14619
14708
|
if (value === null || value === void 0) return "";
|
|
14620
14709
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -14623,7 +14712,7 @@ function formatCell(value) {
|
|
|
14623
14712
|
}
|
|
14624
14713
|
function printTable(rows) {
|
|
14625
14714
|
if (rows.length === 0) {
|
|
14626
|
-
console.log(
|
|
14715
|
+
console.log(chalk148.yellow("(no rows)"));
|
|
14627
14716
|
return;
|
|
14628
14717
|
}
|
|
14629
14718
|
const columns = Object.keys(rows[0]);
|
|
@@ -14631,13 +14720,13 @@ function printTable(rows) {
|
|
|
14631
14720
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
14632
14721
|
);
|
|
14633
14722
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
14634
|
-
console.log(
|
|
14635
|
-
console.log(
|
|
14723
|
+
console.log(chalk148.dim(header));
|
|
14724
|
+
console.log(chalk148.dim("-".repeat(header.length)));
|
|
14636
14725
|
for (const row of rows) {
|
|
14637
14726
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
14638
14727
|
console.log(line);
|
|
14639
14728
|
}
|
|
14640
|
-
console.log(
|
|
14729
|
+
console.log(chalk148.dim(`
|
|
14641
14730
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
14642
14731
|
}
|
|
14643
14732
|
|
|
@@ -14697,7 +14786,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
14697
14786
|
}
|
|
14698
14787
|
|
|
14699
14788
|
// src/commands/sql/sqlMutate.ts
|
|
14700
|
-
import
|
|
14789
|
+
import chalk149 from "chalk";
|
|
14701
14790
|
|
|
14702
14791
|
// src/commands/sql/isMutation.ts
|
|
14703
14792
|
var MUTATION_KEYWORDS = [
|
|
@@ -14731,7 +14820,7 @@ function isMutation(sql4) {
|
|
|
14731
14820
|
async function sqlMutate(query, connectionName) {
|
|
14732
14821
|
if (!isMutation(query)) {
|
|
14733
14822
|
console.error(
|
|
14734
|
-
|
|
14823
|
+
chalk149.red(
|
|
14735
14824
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
14736
14825
|
)
|
|
14737
14826
|
);
|
|
@@ -14741,18 +14830,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
14741
14830
|
const pool = await sqlConnect(conn);
|
|
14742
14831
|
try {
|
|
14743
14832
|
const result = await pool.request().query(query);
|
|
14744
|
-
console.log(
|
|
14833
|
+
console.log(chalk149.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
14745
14834
|
} finally {
|
|
14746
14835
|
await pool.close();
|
|
14747
14836
|
}
|
|
14748
14837
|
}
|
|
14749
14838
|
|
|
14750
14839
|
// src/commands/sql/sqlQuery.ts
|
|
14751
|
-
import
|
|
14840
|
+
import chalk150 from "chalk";
|
|
14752
14841
|
async function sqlQuery(query, connectionName) {
|
|
14753
14842
|
if (isMutation(query)) {
|
|
14754
14843
|
console.error(
|
|
14755
|
-
|
|
14844
|
+
chalk150.red(
|
|
14756
14845
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
14757
14846
|
)
|
|
14758
14847
|
);
|
|
@@ -14767,7 +14856,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
14767
14856
|
printTable(rows);
|
|
14768
14857
|
} else {
|
|
14769
14858
|
console.log(
|
|
14770
|
-
|
|
14859
|
+
chalk150.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
14771
14860
|
);
|
|
14772
14861
|
}
|
|
14773
14862
|
} finally {
|
|
@@ -15347,14 +15436,14 @@ import {
|
|
|
15347
15436
|
import { dirname as dirname22, join as join40 } from "path";
|
|
15348
15437
|
|
|
15349
15438
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
15350
|
-
import
|
|
15439
|
+
import chalk151 from "chalk";
|
|
15351
15440
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
15352
15441
|
function validateStagedContent(filename, content) {
|
|
15353
15442
|
const firstLine = content.split("\n")[0];
|
|
15354
15443
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
15355
15444
|
if (!match) {
|
|
15356
15445
|
console.error(
|
|
15357
|
-
|
|
15446
|
+
chalk151.red(
|
|
15358
15447
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
15359
15448
|
)
|
|
15360
15449
|
);
|
|
@@ -15363,7 +15452,7 @@ function validateStagedContent(filename, content) {
|
|
|
15363
15452
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
15364
15453
|
if (!contentAfterLink) {
|
|
15365
15454
|
console.error(
|
|
15366
|
-
|
|
15455
|
+
chalk151.red(
|
|
15367
15456
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
15368
15457
|
)
|
|
15369
15458
|
);
|
|
@@ -15539,13 +15628,13 @@ function logs(options2) {
|
|
|
15539
15628
|
console.log("No voice log file found");
|
|
15540
15629
|
return;
|
|
15541
15630
|
}
|
|
15542
|
-
const
|
|
15631
|
+
const count6 = Number.parseInt(options2.lines ?? "150", 10);
|
|
15543
15632
|
const content = readFileSync33(voicePaths.log, "utf-8").trim();
|
|
15544
15633
|
if (!content) {
|
|
15545
15634
|
console.log("Voice log is empty");
|
|
15546
15635
|
return;
|
|
15547
15636
|
}
|
|
15548
|
-
const lines = content.split("\n").slice(-
|
|
15637
|
+
const lines = content.split("\n").slice(-count6);
|
|
15549
15638
|
for (const line of lines) {
|
|
15550
15639
|
try {
|
|
15551
15640
|
const event = JSON.parse(line);
|
|
@@ -15692,10 +15781,10 @@ function isProcessAlive3(pid) {
|
|
|
15692
15781
|
return false;
|
|
15693
15782
|
}
|
|
15694
15783
|
}
|
|
15695
|
-
function readRecentLogs(
|
|
15784
|
+
function readRecentLogs(count6) {
|
|
15696
15785
|
if (!existsSync45(voicePaths.log)) return [];
|
|
15697
15786
|
const lines = readFileSync35(voicePaths.log, "utf-8").trim().split("\n");
|
|
15698
|
-
return lines.slice(-
|
|
15787
|
+
return lines.slice(-count6);
|
|
15699
15788
|
}
|
|
15700
15789
|
function status() {
|
|
15701
15790
|
if (!existsSync45(voicePaths.pid)) {
|
|
@@ -15759,7 +15848,7 @@ function registerVoice(program2) {
|
|
|
15759
15848
|
|
|
15760
15849
|
// src/commands/roam/auth.ts
|
|
15761
15850
|
import { randomBytes } from "crypto";
|
|
15762
|
-
import
|
|
15851
|
+
import chalk152 from "chalk";
|
|
15763
15852
|
|
|
15764
15853
|
// src/lib/openBrowser.ts
|
|
15765
15854
|
import { execSync as execSync44 } from "child_process";
|
|
@@ -15934,13 +16023,13 @@ async function auth() {
|
|
|
15934
16023
|
saveGlobalConfig(config);
|
|
15935
16024
|
const state = randomBytes(16).toString("hex");
|
|
15936
16025
|
console.log(
|
|
15937
|
-
|
|
16026
|
+
chalk152.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
15938
16027
|
);
|
|
15939
|
-
console.log(
|
|
15940
|
-
console.log(
|
|
15941
|
-
console.log(
|
|
16028
|
+
console.log(chalk152.white("http://localhost:14523/callback\n"));
|
|
16029
|
+
console.log(chalk152.blue("Opening browser for authorization..."));
|
|
16030
|
+
console.log(chalk152.dim("Waiting for authorization callback..."));
|
|
15942
16031
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
15943
|
-
console.log(
|
|
16032
|
+
console.log(chalk152.dim("Exchanging code for tokens..."));
|
|
15944
16033
|
const tokens = await exchangeToken({
|
|
15945
16034
|
code,
|
|
15946
16035
|
clientId,
|
|
@@ -15956,7 +16045,7 @@ async function auth() {
|
|
|
15956
16045
|
};
|
|
15957
16046
|
saveGlobalConfig(config);
|
|
15958
16047
|
console.log(
|
|
15959
|
-
|
|
16048
|
+
chalk152.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
15960
16049
|
);
|
|
15961
16050
|
}
|
|
15962
16051
|
|
|
@@ -16379,7 +16468,7 @@ import { execSync as execSync46 } from "child_process";
|
|
|
16379
16468
|
import { existsSync as existsSync49, mkdirSync as mkdirSync17, unlinkSync as unlinkSync15, writeFileSync as writeFileSync30 } from "fs";
|
|
16380
16469
|
import { tmpdir as tmpdir7 } from "os";
|
|
16381
16470
|
import { join as join51, resolve as resolve13 } from "path";
|
|
16382
|
-
import
|
|
16471
|
+
import chalk153 from "chalk";
|
|
16383
16472
|
|
|
16384
16473
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
16385
16474
|
var captureWindowPs1 = `
|
|
@@ -16530,20 +16619,20 @@ function screenshot(processName) {
|
|
|
16530
16619
|
const config = loadConfig();
|
|
16531
16620
|
const outputDir = resolve13(config.screenshot.outputDir);
|
|
16532
16621
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
16533
|
-
console.log(
|
|
16622
|
+
console.log(chalk153.gray(`Capturing window for process "${processName}" ...`));
|
|
16534
16623
|
try {
|
|
16535
16624
|
runPowerShellScript(processName, outputPath);
|
|
16536
|
-
console.log(
|
|
16625
|
+
console.log(chalk153.green(`Screenshot saved: ${outputPath}`));
|
|
16537
16626
|
} catch (error) {
|
|
16538
16627
|
const msg = error instanceof Error ? error.message : String(error);
|
|
16539
|
-
console.error(
|
|
16628
|
+
console.error(chalk153.red(`Failed to capture screenshot: ${msg}`));
|
|
16540
16629
|
process.exit(1);
|
|
16541
16630
|
}
|
|
16542
16631
|
}
|
|
16543
16632
|
|
|
16544
16633
|
// src/commands/sessions/summarise/index.ts
|
|
16545
16634
|
import * as fs28 from "fs";
|
|
16546
|
-
import
|
|
16635
|
+
import chalk154 from "chalk";
|
|
16547
16636
|
|
|
16548
16637
|
// src/commands/sessions/summarise/shared.ts
|
|
16549
16638
|
import * as fs26 from "fs";
|
|
@@ -16670,22 +16759,22 @@ ${firstMessage}`);
|
|
|
16670
16759
|
async function summarise4(options2) {
|
|
16671
16760
|
const files = await discoverSessionJsonlPaths();
|
|
16672
16761
|
if (files.length === 0) {
|
|
16673
|
-
console.log(
|
|
16762
|
+
console.log(chalk154.yellow("No sessions found."));
|
|
16674
16763
|
return;
|
|
16675
16764
|
}
|
|
16676
16765
|
const toProcess = selectCandidates(files, options2);
|
|
16677
16766
|
if (toProcess.length === 0) {
|
|
16678
|
-
console.log(
|
|
16767
|
+
console.log(chalk154.green("All sessions already summarised."));
|
|
16679
16768
|
return;
|
|
16680
16769
|
}
|
|
16681
16770
|
console.log(
|
|
16682
|
-
|
|
16771
|
+
chalk154.cyan(
|
|
16683
16772
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
16684
16773
|
)
|
|
16685
16774
|
);
|
|
16686
16775
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
16687
16776
|
console.log(
|
|
16688
|
-
|
|
16777
|
+
chalk154.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk154.yellow(`, ${failed2} skipped`) : "")
|
|
16689
16778
|
);
|
|
16690
16779
|
}
|
|
16691
16780
|
function selectCandidates(files, options2) {
|
|
@@ -16705,16 +16794,16 @@ function processSessions(files) {
|
|
|
16705
16794
|
let failed2 = 0;
|
|
16706
16795
|
for (let i = 0; i < files.length; i++) {
|
|
16707
16796
|
const file = files[i];
|
|
16708
|
-
process.stdout.write(
|
|
16797
|
+
process.stdout.write(chalk154.dim(` [${i + 1}/${files.length}] `));
|
|
16709
16798
|
const summary = summariseSession(file);
|
|
16710
16799
|
if (summary) {
|
|
16711
16800
|
writeSummary(file, summary);
|
|
16712
16801
|
succeeded++;
|
|
16713
|
-
process.stdout.write(`${
|
|
16802
|
+
process.stdout.write(`${chalk154.green("\u2713")} ${summary}
|
|
16714
16803
|
`);
|
|
16715
16804
|
} else {
|
|
16716
16805
|
failed2++;
|
|
16717
|
-
process.stdout.write(` ${
|
|
16806
|
+
process.stdout.write(` ${chalk154.yellow("skip")}
|
|
16718
16807
|
`);
|
|
16719
16808
|
}
|
|
16720
16809
|
}
|
|
@@ -16729,10 +16818,10 @@ function registerSessions(program2) {
|
|
|
16729
16818
|
}
|
|
16730
16819
|
|
|
16731
16820
|
// src/commands/statusLine.ts
|
|
16732
|
-
import
|
|
16821
|
+
import chalk156 from "chalk";
|
|
16733
16822
|
|
|
16734
16823
|
// src/commands/buildLimitsSegment.ts
|
|
16735
|
-
import
|
|
16824
|
+
import chalk155 from "chalk";
|
|
16736
16825
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
16737
16826
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
16738
16827
|
function formatTimeLeft(resetsAt) {
|
|
@@ -16755,10 +16844,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
16755
16844
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
16756
16845
|
const label2 = `${Math.round(pct)}%`;
|
|
16757
16846
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
16758
|
-
if (projected == null) return
|
|
16759
|
-
if (projected > 100) return
|
|
16760
|
-
if (projected > 75) return
|
|
16761
|
-
return
|
|
16847
|
+
if (projected == null) return chalk155.green(label2);
|
|
16848
|
+
if (projected > 100) return chalk155.red(label2);
|
|
16849
|
+
if (projected > 75) return chalk155.yellow(label2);
|
|
16850
|
+
return chalk155.green(label2);
|
|
16762
16851
|
}
|
|
16763
16852
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
16764
16853
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -16784,14 +16873,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
16784
16873
|
}
|
|
16785
16874
|
|
|
16786
16875
|
// src/commands/statusLine.ts
|
|
16787
|
-
|
|
16876
|
+
chalk156.level = 3;
|
|
16788
16877
|
function formatNumber(num) {
|
|
16789
16878
|
return num.toLocaleString("en-US");
|
|
16790
16879
|
}
|
|
16791
16880
|
function colorizePercent(pct) {
|
|
16792
16881
|
const label2 = `${Math.round(pct)}%`;
|
|
16793
|
-
if (pct > 80) return
|
|
16794
|
-
if (pct > 40) return
|
|
16882
|
+
if (pct > 80) return chalk156.red(label2);
|
|
16883
|
+
if (pct > 40) return chalk156.yellow(label2);
|
|
16795
16884
|
return label2;
|
|
16796
16885
|
}
|
|
16797
16886
|
async function statusLine() {
|
|
@@ -16814,7 +16903,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
16814
16903
|
// src/commands/sync/syncClaudeMd.ts
|
|
16815
16904
|
import * as fs29 from "fs";
|
|
16816
16905
|
import * as path48 from "path";
|
|
16817
|
-
import
|
|
16906
|
+
import chalk157 from "chalk";
|
|
16818
16907
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
16819
16908
|
const source = path48.join(claudeDir, "CLAUDE.md");
|
|
16820
16909
|
const target = path48.join(targetBase, "CLAUDE.md");
|
|
@@ -16823,12 +16912,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
16823
16912
|
const targetContent = fs29.readFileSync(target, "utf-8");
|
|
16824
16913
|
if (sourceContent !== targetContent) {
|
|
16825
16914
|
console.log(
|
|
16826
|
-
|
|
16915
|
+
chalk157.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
16827
16916
|
);
|
|
16828
16917
|
console.log();
|
|
16829
16918
|
printDiff(targetContent, sourceContent);
|
|
16830
16919
|
const confirm = options2?.yes || await promptConfirm(
|
|
16831
|
-
|
|
16920
|
+
chalk157.red("Overwrite existing CLAUDE.md?"),
|
|
16832
16921
|
false
|
|
16833
16922
|
);
|
|
16834
16923
|
if (!confirm) {
|
|
@@ -16844,7 +16933,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
16844
16933
|
// src/commands/sync/syncSettings.ts
|
|
16845
16934
|
import * as fs30 from "fs";
|
|
16846
16935
|
import * as path49 from "path";
|
|
16847
|
-
import
|
|
16936
|
+
import chalk158 from "chalk";
|
|
16848
16937
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
16849
16938
|
const source = path49.join(claudeDir, "settings.json");
|
|
16850
16939
|
const target = path49.join(targetBase, "settings.json");
|
|
@@ -16860,14 +16949,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
16860
16949
|
if (mergedContent !== normalizedTarget) {
|
|
16861
16950
|
if (!options2?.yes) {
|
|
16862
16951
|
console.log(
|
|
16863
|
-
|
|
16952
|
+
chalk158.yellow(
|
|
16864
16953
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
16865
16954
|
)
|
|
16866
16955
|
);
|
|
16867
16956
|
console.log();
|
|
16868
16957
|
printDiff(targetContent, mergedContent);
|
|
16869
16958
|
const confirm = await promptConfirm(
|
|
16870
|
-
|
|
16959
|
+
chalk158.red("Overwrite existing settings.json?"),
|
|
16871
16960
|
false
|
|
16872
16961
|
);
|
|
16873
16962
|
if (!confirm) {
|