@staff0rd/assist 0.234.0 → 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 +1 -0
- package/dist/index.js +500 -420
- 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
|
);
|
|
@@ -6266,7 +6345,8 @@ var registrars = [
|
|
|
6266
6345
|
registerSearchCommand,
|
|
6267
6346
|
registerUpdateCommands,
|
|
6268
6347
|
registerExportCommand,
|
|
6269
|
-
registerImportCommand
|
|
6348
|
+
registerImportCommand,
|
|
6349
|
+
registerMoveRepoCommand
|
|
6270
6350
|
];
|
|
6271
6351
|
function registerBacklog(program2) {
|
|
6272
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) => {
|
|
@@ -6893,11 +6973,11 @@ function assertCliExists(cli) {
|
|
|
6893
6973
|
}
|
|
6894
6974
|
|
|
6895
6975
|
// src/commands/permitCliReads/colorize.ts
|
|
6896
|
-
import
|
|
6976
|
+
import chalk75 from "chalk";
|
|
6897
6977
|
function colorize(plainOutput) {
|
|
6898
6978
|
return plainOutput.split("\n").map((line) => {
|
|
6899
|
-
if (line.startsWith(" R ")) return
|
|
6900
|
-
if (line.startsWith(" W ")) return
|
|
6979
|
+
if (line.startsWith(" R ")) return chalk75.green(line);
|
|
6980
|
+
if (line.startsWith(" W ")) return chalk75.red(line);
|
|
6901
6981
|
return line;
|
|
6902
6982
|
}).join("\n");
|
|
6903
6983
|
}
|
|
@@ -7195,7 +7275,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
7195
7275
|
}
|
|
7196
7276
|
|
|
7197
7277
|
// src/commands/deny/denyAdd.ts
|
|
7198
|
-
import
|
|
7278
|
+
import chalk76 from "chalk";
|
|
7199
7279
|
|
|
7200
7280
|
// src/commands/deny/loadDenyConfig.ts
|
|
7201
7281
|
function loadDenyConfig(global) {
|
|
@@ -7215,16 +7295,16 @@ function loadDenyConfig(global) {
|
|
|
7215
7295
|
function denyAdd(pattern2, message, options2) {
|
|
7216
7296
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
7217
7297
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
7218
|
-
console.log(
|
|
7298
|
+
console.log(chalk76.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
7219
7299
|
return;
|
|
7220
7300
|
}
|
|
7221
7301
|
deny.push({ pattern: pattern2, message });
|
|
7222
7302
|
saveDeny(deny);
|
|
7223
|
-
console.log(
|
|
7303
|
+
console.log(chalk76.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
7224
7304
|
}
|
|
7225
7305
|
|
|
7226
7306
|
// src/commands/deny/denyList.ts
|
|
7227
|
-
import
|
|
7307
|
+
import chalk77 from "chalk";
|
|
7228
7308
|
function denyList() {
|
|
7229
7309
|
const globalRaw = loadGlobalConfigRaw();
|
|
7230
7310
|
const projectRaw = loadProjectConfig();
|
|
@@ -7235,7 +7315,7 @@ function denyList() {
|
|
|
7235
7315
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
7236
7316
|
);
|
|
7237
7317
|
if (!merged || merged.length === 0) {
|
|
7238
|
-
console.log(
|
|
7318
|
+
console.log(chalk77.dim("No deny rules configured."));
|
|
7239
7319
|
return;
|
|
7240
7320
|
}
|
|
7241
7321
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -7243,23 +7323,23 @@ function denyList() {
|
|
|
7243
7323
|
for (const rule of merged) {
|
|
7244
7324
|
const inProject = projectPatterns.has(rule.pattern);
|
|
7245
7325
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
7246
|
-
const label2 = inProject && inGlobal ?
|
|
7247
|
-
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}`);
|
|
7248
7328
|
}
|
|
7249
7329
|
}
|
|
7250
7330
|
|
|
7251
7331
|
// src/commands/deny/denyRemove.ts
|
|
7252
|
-
import
|
|
7332
|
+
import chalk78 from "chalk";
|
|
7253
7333
|
function denyRemove(pattern2, options2) {
|
|
7254
7334
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
7255
7335
|
const index2 = deny.findIndex((r) => r.pattern === pattern2);
|
|
7256
7336
|
if (index2 === -1) {
|
|
7257
|
-
console.log(
|
|
7337
|
+
console.log(chalk78.yellow(`No deny rule found for: ${pattern2}`));
|
|
7258
7338
|
return;
|
|
7259
7339
|
}
|
|
7260
7340
|
deny.splice(index2, 1);
|
|
7261
7341
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
7262
|
-
console.log(
|
|
7342
|
+
console.log(chalk78.green(`Removed deny rule: ${pattern2}`));
|
|
7263
7343
|
}
|
|
7264
7344
|
|
|
7265
7345
|
// src/commands/registerDeny.ts
|
|
@@ -7288,15 +7368,15 @@ function registerCliHook(program2) {
|
|
|
7288
7368
|
}
|
|
7289
7369
|
|
|
7290
7370
|
// src/commands/complexity/analyze.ts
|
|
7291
|
-
import
|
|
7371
|
+
import chalk84 from "chalk";
|
|
7292
7372
|
|
|
7293
7373
|
// src/commands/complexity/cyclomatic.ts
|
|
7294
|
-
import
|
|
7374
|
+
import chalk80 from "chalk";
|
|
7295
7375
|
|
|
7296
7376
|
// src/commands/complexity/shared/index.ts
|
|
7297
7377
|
import fs14 from "fs";
|
|
7298
7378
|
import path22 from "path";
|
|
7299
|
-
import
|
|
7379
|
+
import chalk79 from "chalk";
|
|
7300
7380
|
import ts5 from "typescript";
|
|
7301
7381
|
|
|
7302
7382
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -7494,7 +7574,7 @@ function calculateHalstead(node) {
|
|
|
7494
7574
|
// src/commands/complexity/shared/countSloc.ts
|
|
7495
7575
|
function countSloc(content) {
|
|
7496
7576
|
let inMultiLineComment = false;
|
|
7497
|
-
let
|
|
7577
|
+
let count6 = 0;
|
|
7498
7578
|
for (const line of content.split("\n")) {
|
|
7499
7579
|
const trimmed = line.trim();
|
|
7500
7580
|
if (inMultiLineComment) {
|
|
@@ -7502,7 +7582,7 @@ function countSloc(content) {
|
|
|
7502
7582
|
inMultiLineComment = false;
|
|
7503
7583
|
const afterComment = trimmed.substring(trimmed.indexOf("*/") + 2);
|
|
7504
7584
|
if (afterComment.trim().length > 0) {
|
|
7505
|
-
|
|
7585
|
+
count6++;
|
|
7506
7586
|
}
|
|
7507
7587
|
}
|
|
7508
7588
|
continue;
|
|
@@ -7514,7 +7594,7 @@ function countSloc(content) {
|
|
|
7514
7594
|
if (trimmed.includes("*/")) {
|
|
7515
7595
|
const afterComment = trimmed.substring(trimmed.indexOf("*/") + 2);
|
|
7516
7596
|
if (afterComment.trim().length > 0) {
|
|
7517
|
-
|
|
7597
|
+
count6++;
|
|
7518
7598
|
}
|
|
7519
7599
|
} else {
|
|
7520
7600
|
inMultiLineComment = true;
|
|
@@ -7522,10 +7602,10 @@ function countSloc(content) {
|
|
|
7522
7602
|
continue;
|
|
7523
7603
|
}
|
|
7524
7604
|
if (trimmed.length > 0) {
|
|
7525
|
-
|
|
7605
|
+
count6++;
|
|
7526
7606
|
}
|
|
7527
7607
|
}
|
|
7528
|
-
return
|
|
7608
|
+
return count6;
|
|
7529
7609
|
}
|
|
7530
7610
|
|
|
7531
7611
|
// src/commands/complexity/shared/index.ts
|
|
@@ -7542,7 +7622,7 @@ function createSourceFromFile(filePath) {
|
|
|
7542
7622
|
function withSourceFiles(pattern2, callback) {
|
|
7543
7623
|
const files = findSourceFiles2(pattern2);
|
|
7544
7624
|
if (files.length === 0) {
|
|
7545
|
-
console.log(
|
|
7625
|
+
console.log(chalk79.yellow("No files found matching pattern"));
|
|
7546
7626
|
return void 0;
|
|
7547
7627
|
}
|
|
7548
7628
|
return callback(files);
|
|
@@ -7575,11 +7655,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
7575
7655
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
7576
7656
|
for (const { file, name, complexity } of results) {
|
|
7577
7657
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
7578
|
-
const color = exceedsThreshold ?
|
|
7579
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
7658
|
+
const color = exceedsThreshold ? chalk80.red : chalk80.white;
|
|
7659
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk80.cyan(complexity)}`);
|
|
7580
7660
|
}
|
|
7581
7661
|
console.log(
|
|
7582
|
-
|
|
7662
|
+
chalk80.dim(
|
|
7583
7663
|
`
|
|
7584
7664
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
7585
7665
|
)
|
|
@@ -7591,7 +7671,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
7591
7671
|
}
|
|
7592
7672
|
|
|
7593
7673
|
// src/commands/complexity/halstead.ts
|
|
7594
|
-
import
|
|
7674
|
+
import chalk81 from "chalk";
|
|
7595
7675
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
7596
7676
|
withSourceFiles(pattern2, (files) => {
|
|
7597
7677
|
const results = [];
|
|
@@ -7606,13 +7686,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
7606
7686
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
7607
7687
|
for (const { file, name, metrics } of results) {
|
|
7608
7688
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
7609
|
-
const color = exceedsThreshold ?
|
|
7689
|
+
const color = exceedsThreshold ? chalk81.red : chalk81.white;
|
|
7610
7690
|
console.log(
|
|
7611
|
-
`${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))}`
|
|
7612
7692
|
);
|
|
7613
7693
|
}
|
|
7614
7694
|
console.log(
|
|
7615
|
-
|
|
7695
|
+
chalk81.dim(
|
|
7616
7696
|
`
|
|
7617
7697
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
7618
7698
|
)
|
|
@@ -7627,28 +7707,28 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
7627
7707
|
import fs15 from "fs";
|
|
7628
7708
|
|
|
7629
7709
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
7630
|
-
import
|
|
7710
|
+
import chalk82 from "chalk";
|
|
7631
7711
|
function displayMaintainabilityResults(results, threshold) {
|
|
7632
7712
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
7633
7713
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
7634
|
-
console.log(
|
|
7714
|
+
console.log(chalk82.green("All files pass maintainability threshold"));
|
|
7635
7715
|
} else {
|
|
7636
7716
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
7637
|
-
const color = threshold !== void 0 ?
|
|
7717
|
+
const color = threshold !== void 0 ? chalk82.red : chalk82.white;
|
|
7638
7718
|
console.log(
|
|
7639
|
-
`${color(file)} \u2192 avg: ${
|
|
7719
|
+
`${color(file)} \u2192 avg: ${chalk82.cyan(avgMaintainability.toFixed(1))}, min: ${chalk82.yellow(minMaintainability.toFixed(1))}`
|
|
7640
7720
|
);
|
|
7641
7721
|
}
|
|
7642
7722
|
}
|
|
7643
|
-
console.log(
|
|
7723
|
+
console.log(chalk82.dim(`
|
|
7644
7724
|
Analyzed ${results.length} files`));
|
|
7645
7725
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
7646
7726
|
console.error(
|
|
7647
|
-
|
|
7727
|
+
chalk82.red(
|
|
7648
7728
|
`
|
|
7649
7729
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
7650
7730
|
|
|
7651
|
-
\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.`
|
|
7652
7732
|
)
|
|
7653
7733
|
);
|
|
7654
7734
|
process.exit(1);
|
|
@@ -7705,7 +7785,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
7705
7785
|
|
|
7706
7786
|
// src/commands/complexity/sloc.ts
|
|
7707
7787
|
import fs16 from "fs";
|
|
7708
|
-
import
|
|
7788
|
+
import chalk83 from "chalk";
|
|
7709
7789
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
7710
7790
|
withSourceFiles(pattern2, (files) => {
|
|
7711
7791
|
const results = [];
|
|
@@ -7721,12 +7801,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
7721
7801
|
results.sort((a, b) => b.lines - a.lines);
|
|
7722
7802
|
for (const { file, lines } of results) {
|
|
7723
7803
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
7724
|
-
const color = exceedsThreshold ?
|
|
7725
|
-
console.log(`${color(file)} \u2192 ${
|
|
7804
|
+
const color = exceedsThreshold ? chalk83.red : chalk83.white;
|
|
7805
|
+
console.log(`${color(file)} \u2192 ${chalk83.cyan(lines)} lines`);
|
|
7726
7806
|
}
|
|
7727
7807
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
7728
7808
|
console.log(
|
|
7729
|
-
|
|
7809
|
+
chalk83.dim(`
|
|
7730
7810
|
Total: ${total} lines across ${files.length} files`)
|
|
7731
7811
|
);
|
|
7732
7812
|
if (hasViolation) {
|
|
@@ -7740,21 +7820,21 @@ async function analyze(pattern2) {
|
|
|
7740
7820
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
7741
7821
|
const files = findSourceFiles2(searchPattern);
|
|
7742
7822
|
if (files.length === 0) {
|
|
7743
|
-
console.log(
|
|
7823
|
+
console.log(chalk84.yellow("No files found matching pattern"));
|
|
7744
7824
|
return;
|
|
7745
7825
|
}
|
|
7746
7826
|
if (files.length === 1) {
|
|
7747
7827
|
const file = files[0];
|
|
7748
|
-
console.log(
|
|
7828
|
+
console.log(chalk84.bold.underline("SLOC"));
|
|
7749
7829
|
await sloc(file);
|
|
7750
7830
|
console.log();
|
|
7751
|
-
console.log(
|
|
7831
|
+
console.log(chalk84.bold.underline("Cyclomatic Complexity"));
|
|
7752
7832
|
await cyclomatic(file);
|
|
7753
7833
|
console.log();
|
|
7754
|
-
console.log(
|
|
7834
|
+
console.log(chalk84.bold.underline("Halstead Metrics"));
|
|
7755
7835
|
await halstead(file);
|
|
7756
7836
|
console.log();
|
|
7757
|
-
console.log(
|
|
7837
|
+
console.log(chalk84.bold.underline("Maintainability Index"));
|
|
7758
7838
|
await maintainability(file);
|
|
7759
7839
|
return;
|
|
7760
7840
|
}
|
|
@@ -7781,7 +7861,7 @@ function registerComplexity(program2) {
|
|
|
7781
7861
|
}
|
|
7782
7862
|
|
|
7783
7863
|
// src/commands/config/index.ts
|
|
7784
|
-
import
|
|
7864
|
+
import chalk85 from "chalk";
|
|
7785
7865
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
7786
7866
|
|
|
7787
7867
|
// src/commands/config/setNestedValue.ts
|
|
@@ -7844,7 +7924,7 @@ function formatIssuePath(issue, key) {
|
|
|
7844
7924
|
function printValidationErrors(issues, key) {
|
|
7845
7925
|
for (const issue of issues) {
|
|
7846
7926
|
console.error(
|
|
7847
|
-
|
|
7927
|
+
chalk85.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
7848
7928
|
);
|
|
7849
7929
|
}
|
|
7850
7930
|
}
|
|
@@ -7861,7 +7941,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
7861
7941
|
function assertNotGlobalOnly(key, global) {
|
|
7862
7942
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
7863
7943
|
console.error(
|
|
7864
|
-
|
|
7944
|
+
chalk85.red(
|
|
7865
7945
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
7866
7946
|
)
|
|
7867
7947
|
);
|
|
@@ -7884,7 +7964,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
7884
7964
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
7885
7965
|
const target = options2.global ? "global" : "project";
|
|
7886
7966
|
console.log(
|
|
7887
|
-
|
|
7967
|
+
chalk85.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
7888
7968
|
);
|
|
7889
7969
|
}
|
|
7890
7970
|
function configList() {
|
|
@@ -7893,7 +7973,7 @@ function configList() {
|
|
|
7893
7973
|
}
|
|
7894
7974
|
|
|
7895
7975
|
// src/commands/config/configGet.ts
|
|
7896
|
-
import
|
|
7976
|
+
import chalk86 from "chalk";
|
|
7897
7977
|
|
|
7898
7978
|
// src/commands/config/getNestedValue.ts
|
|
7899
7979
|
function isTraversable(value) {
|
|
@@ -7925,7 +8005,7 @@ function requireNestedValue(config, key) {
|
|
|
7925
8005
|
return value;
|
|
7926
8006
|
}
|
|
7927
8007
|
function exitKeyNotSet(key) {
|
|
7928
|
-
console.error(
|
|
8008
|
+
console.error(chalk86.red(`Key "${key}" is not set`));
|
|
7929
8009
|
process.exit(1);
|
|
7930
8010
|
}
|
|
7931
8011
|
|
|
@@ -7939,7 +8019,7 @@ function registerConfig(program2) {
|
|
|
7939
8019
|
|
|
7940
8020
|
// src/commands/deploy/redirect.ts
|
|
7941
8021
|
import { existsSync as existsSync24, readFileSync as readFileSync18, writeFileSync as writeFileSync16 } from "fs";
|
|
7942
|
-
import
|
|
8022
|
+
import chalk87 from "chalk";
|
|
7943
8023
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
7944
8024
|
if (!window.location.pathname.endsWith('/')) {
|
|
7945
8025
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -7948,22 +8028,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
7948
8028
|
function redirect() {
|
|
7949
8029
|
const indexPath = "index.html";
|
|
7950
8030
|
if (!existsSync24(indexPath)) {
|
|
7951
|
-
console.log(
|
|
8031
|
+
console.log(chalk87.yellow("No index.html found"));
|
|
7952
8032
|
return;
|
|
7953
8033
|
}
|
|
7954
8034
|
const content = readFileSync18(indexPath, "utf-8");
|
|
7955
8035
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
7956
|
-
console.log(
|
|
8036
|
+
console.log(chalk87.dim("Trailing slash script already present"));
|
|
7957
8037
|
return;
|
|
7958
8038
|
}
|
|
7959
8039
|
const headCloseIndex = content.indexOf("</head>");
|
|
7960
8040
|
if (headCloseIndex === -1) {
|
|
7961
|
-
console.log(
|
|
8041
|
+
console.log(chalk87.red("Could not find </head> tag in index.html"));
|
|
7962
8042
|
return;
|
|
7963
8043
|
}
|
|
7964
8044
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
7965
8045
|
writeFileSync16(indexPath, newContent);
|
|
7966
|
-
console.log(
|
|
8046
|
+
console.log(chalk87.green("Added trailing slash redirect to index.html"));
|
|
7967
8047
|
}
|
|
7968
8048
|
|
|
7969
8049
|
// src/commands/registerDeploy.ts
|
|
@@ -7990,7 +8070,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
7990
8070
|
|
|
7991
8071
|
// src/commands/devlog/shared.ts
|
|
7992
8072
|
import { execSync as execSync20 } from "child_process";
|
|
7993
|
-
import
|
|
8073
|
+
import chalk88 from "chalk";
|
|
7994
8074
|
|
|
7995
8075
|
// src/shared/getRepoName.ts
|
|
7996
8076
|
import { existsSync as existsSync25, readFileSync as readFileSync19 } from "fs";
|
|
@@ -8099,13 +8179,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
8099
8179
|
}
|
|
8100
8180
|
function printCommitsWithFiles(commits, ignore2, verbose) {
|
|
8101
8181
|
for (const commit2 of commits) {
|
|
8102
|
-
console.log(` ${
|
|
8182
|
+
console.log(` ${chalk88.yellow(commit2.hash)} ${commit2.message}`);
|
|
8103
8183
|
if (verbose) {
|
|
8104
8184
|
const visibleFiles = commit2.files.filter(
|
|
8105
8185
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
8106
8186
|
);
|
|
8107
8187
|
for (const file of visibleFiles) {
|
|
8108
|
-
console.log(` ${
|
|
8188
|
+
console.log(` ${chalk88.dim(file)}`);
|
|
8109
8189
|
}
|
|
8110
8190
|
}
|
|
8111
8191
|
}
|
|
@@ -8130,15 +8210,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
8130
8210
|
}
|
|
8131
8211
|
|
|
8132
8212
|
// src/commands/devlog/list/printDateHeader.ts
|
|
8133
|
-
import
|
|
8213
|
+
import chalk89 from "chalk";
|
|
8134
8214
|
function printDateHeader(date, isSkipped, entries) {
|
|
8135
8215
|
if (isSkipped) {
|
|
8136
|
-
console.log(`${
|
|
8216
|
+
console.log(`${chalk89.bold.blue(date)} ${chalk89.dim("skipped")}`);
|
|
8137
8217
|
} else if (entries && entries.length > 0) {
|
|
8138
|
-
const entryInfo = entries.map((e) => `${
|
|
8139
|
-
console.log(`${
|
|
8218
|
+
const entryInfo = entries.map((e) => `${chalk89.green(e.version)} ${e.title}`).join(" | ");
|
|
8219
|
+
console.log(`${chalk89.bold.blue(date)} ${entryInfo}`);
|
|
8140
8220
|
} else {
|
|
8141
|
-
console.log(`${
|
|
8221
|
+
console.log(`${chalk89.bold.blue(date)} ${chalk89.red("\u26A0 devlog missing")}`);
|
|
8142
8222
|
}
|
|
8143
8223
|
}
|
|
8144
8224
|
|
|
@@ -8242,24 +8322,24 @@ function bumpVersion(version2, type) {
|
|
|
8242
8322
|
|
|
8243
8323
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
8244
8324
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
8245
|
-
import
|
|
8325
|
+
import chalk91 from "chalk";
|
|
8246
8326
|
|
|
8247
8327
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
8248
|
-
import
|
|
8328
|
+
import chalk90 from "chalk";
|
|
8249
8329
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
8250
8330
|
if (conventional && firstHash) {
|
|
8251
8331
|
const version2 = getVersionAtCommit(firstHash);
|
|
8252
8332
|
if (version2) {
|
|
8253
|
-
console.log(`${
|
|
8333
|
+
console.log(`${chalk90.bold("version:")} ${stripToMinor(version2)}`);
|
|
8254
8334
|
} else {
|
|
8255
|
-
console.log(`${
|
|
8335
|
+
console.log(`${chalk90.bold("version:")} ${chalk90.red("unknown")}`);
|
|
8256
8336
|
}
|
|
8257
8337
|
} else if (patchVersion && minorVersion) {
|
|
8258
8338
|
console.log(
|
|
8259
|
-
`${
|
|
8339
|
+
`${chalk90.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
8260
8340
|
);
|
|
8261
8341
|
} else {
|
|
8262
|
-
console.log(`${
|
|
8342
|
+
console.log(`${chalk90.bold("version:")} v0.1 (initial)`);
|
|
8263
8343
|
}
|
|
8264
8344
|
}
|
|
8265
8345
|
|
|
@@ -8307,16 +8387,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
8307
8387
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
8308
8388
|
}
|
|
8309
8389
|
function logName(repoName) {
|
|
8310
|
-
console.log(`${
|
|
8390
|
+
console.log(`${chalk91.bold("name:")} ${repoName}`);
|
|
8311
8391
|
}
|
|
8312
8392
|
function displayNextEntry(ctx, targetDate, commits) {
|
|
8313
8393
|
logName(ctx.repoName);
|
|
8314
8394
|
printVersionInfo(ctx.config, ctx.lastInfo, commits[0]?.hash);
|
|
8315
|
-
console.log(
|
|
8395
|
+
console.log(chalk91.bold.blue(targetDate));
|
|
8316
8396
|
printCommitsWithFiles(commits, ctx.ignore, ctx.verbose);
|
|
8317
8397
|
}
|
|
8318
8398
|
function logNoCommits(lastInfo) {
|
|
8319
|
-
console.log(
|
|
8399
|
+
console.log(chalk91.dim(noCommitsMessage(!!lastInfo)));
|
|
8320
8400
|
}
|
|
8321
8401
|
|
|
8322
8402
|
// src/commands/devlog/next/index.ts
|
|
@@ -8357,11 +8437,11 @@ function next2(options2) {
|
|
|
8357
8437
|
import { execSync as execSync22 } from "child_process";
|
|
8358
8438
|
|
|
8359
8439
|
// src/commands/devlog/repos/printReposTable.ts
|
|
8360
|
-
import
|
|
8440
|
+
import chalk92 from "chalk";
|
|
8361
8441
|
function colorStatus(status2) {
|
|
8362
|
-
if (status2 === "missing") return
|
|
8363
|
-
if (status2 === "outdated") return
|
|
8364
|
-
return
|
|
8442
|
+
if (status2 === "missing") return chalk92.red(status2);
|
|
8443
|
+
if (status2 === "outdated") return chalk92.yellow(status2);
|
|
8444
|
+
return chalk92.green(status2);
|
|
8365
8445
|
}
|
|
8366
8446
|
function formatRow(row, nameWidth) {
|
|
8367
8447
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -8375,8 +8455,8 @@ function printReposTable(rows) {
|
|
|
8375
8455
|
"Last Devlog".padEnd(11),
|
|
8376
8456
|
"Status"
|
|
8377
8457
|
].join(" ");
|
|
8378
|
-
console.log(
|
|
8379
|
-
console.log(
|
|
8458
|
+
console.log(chalk92.dim(header));
|
|
8459
|
+
console.log(chalk92.dim("-".repeat(header.length)));
|
|
8380
8460
|
for (const row of rows) {
|
|
8381
8461
|
console.log(formatRow(row, nameWidth));
|
|
8382
8462
|
}
|
|
@@ -8434,14 +8514,14 @@ function repos(options2) {
|
|
|
8434
8514
|
// src/commands/devlog/skip.ts
|
|
8435
8515
|
import { writeFileSync as writeFileSync17 } from "fs";
|
|
8436
8516
|
import { join as join24 } from "path";
|
|
8437
|
-
import
|
|
8517
|
+
import chalk93 from "chalk";
|
|
8438
8518
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
8439
8519
|
function getBlogConfigPath() {
|
|
8440
8520
|
return join24(BLOG_REPO_ROOT, "assist.yml");
|
|
8441
8521
|
}
|
|
8442
8522
|
function skip(date) {
|
|
8443
8523
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
8444
|
-
console.log(
|
|
8524
|
+
console.log(chalk93.red("Invalid date format. Use YYYY-MM-DD"));
|
|
8445
8525
|
process.exit(1);
|
|
8446
8526
|
}
|
|
8447
8527
|
const repoName = getRepoName();
|
|
@@ -8452,7 +8532,7 @@ function skip(date) {
|
|
|
8452
8532
|
const skipDays = skip2[repoName] ?? [];
|
|
8453
8533
|
if (skipDays.includes(date)) {
|
|
8454
8534
|
console.log(
|
|
8455
|
-
|
|
8535
|
+
chalk93.yellow(`${date} is already in skip list for ${repoName}`)
|
|
8456
8536
|
);
|
|
8457
8537
|
return;
|
|
8458
8538
|
}
|
|
@@ -8462,20 +8542,20 @@ function skip(date) {
|
|
|
8462
8542
|
devlog.skip = skip2;
|
|
8463
8543
|
config.devlog = devlog;
|
|
8464
8544
|
writeFileSync17(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
8465
|
-
console.log(
|
|
8545
|
+
console.log(chalk93.green(`Added ${date} to skip list for ${repoName}`));
|
|
8466
8546
|
}
|
|
8467
8547
|
|
|
8468
8548
|
// src/commands/devlog/version.ts
|
|
8469
|
-
import
|
|
8549
|
+
import chalk94 from "chalk";
|
|
8470
8550
|
function version() {
|
|
8471
8551
|
const config = loadConfig();
|
|
8472
8552
|
const name = getRepoName();
|
|
8473
8553
|
const lastInfo = getLastVersionInfo(name, config);
|
|
8474
8554
|
const lastVersion = lastInfo?.version ?? null;
|
|
8475
8555
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
8476
|
-
console.log(`${
|
|
8477
|
-
console.log(`${
|
|
8478
|
-
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")}`);
|
|
8479
8559
|
}
|
|
8480
8560
|
|
|
8481
8561
|
// src/commands/registerDevlog.ts
|
|
@@ -8499,7 +8579,7 @@ function registerDevlog(program2) {
|
|
|
8499
8579
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
8500
8580
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
8501
8581
|
import { join as join25 } from "path";
|
|
8502
|
-
import
|
|
8582
|
+
import chalk95 from "chalk";
|
|
8503
8583
|
|
|
8504
8584
|
// src/shared/findRepoRoot.ts
|
|
8505
8585
|
import { existsSync as existsSync26 } from "fs";
|
|
@@ -8562,14 +8642,14 @@ function checkBuildLocks(startDir) {
|
|
|
8562
8642
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
8563
8643
|
if (locked) {
|
|
8564
8644
|
console.error(
|
|
8565
|
-
|
|
8645
|
+
chalk95.red("Build output locked (is VS debugging?): ") + locked
|
|
8566
8646
|
);
|
|
8567
8647
|
process.exit(1);
|
|
8568
8648
|
}
|
|
8569
8649
|
}
|
|
8570
8650
|
async function checkBuildLocksCommand() {
|
|
8571
8651
|
checkBuildLocks();
|
|
8572
|
-
console.log(
|
|
8652
|
+
console.log(chalk95.green("No build locks detected"));
|
|
8573
8653
|
}
|
|
8574
8654
|
|
|
8575
8655
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -8668,30 +8748,30 @@ function escapeRegex(s) {
|
|
|
8668
8748
|
}
|
|
8669
8749
|
|
|
8670
8750
|
// src/commands/dotnet/printTree.ts
|
|
8671
|
-
import
|
|
8751
|
+
import chalk96 from "chalk";
|
|
8672
8752
|
function printNodes(nodes, prefix2) {
|
|
8673
8753
|
for (let i = 0; i < nodes.length; i++) {
|
|
8674
8754
|
const isLast = i === nodes.length - 1;
|
|
8675
8755
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
8676
8756
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
8677
8757
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
8678
|
-
const label2 = isMissing ?
|
|
8758
|
+
const label2 = isMissing ? chalk96.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
8679
8759
|
console.log(`${prefix2}${connector}${label2}`);
|
|
8680
8760
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
8681
8761
|
}
|
|
8682
8762
|
}
|
|
8683
8763
|
function printTree(tree, totalCount, solutions) {
|
|
8684
|
-
console.log(
|
|
8685
|
-
console.log(
|
|
8764
|
+
console.log(chalk96.bold("\nProject Dependency Tree"));
|
|
8765
|
+
console.log(chalk96.cyan(tree.relativePath));
|
|
8686
8766
|
printNodes(tree.children, "");
|
|
8687
|
-
console.log(
|
|
8767
|
+
console.log(chalk96.dim(`
|
|
8688
8768
|
${totalCount} projects total (including root)`));
|
|
8689
|
-
console.log(
|
|
8769
|
+
console.log(chalk96.bold("\nSolution Membership"));
|
|
8690
8770
|
if (solutions.length === 0) {
|
|
8691
|
-
console.log(
|
|
8771
|
+
console.log(chalk96.yellow(" Not found in any .sln"));
|
|
8692
8772
|
} else {
|
|
8693
8773
|
for (const sln of solutions) {
|
|
8694
|
-
console.log(` ${
|
|
8774
|
+
console.log(` ${chalk96.green(sln)}`);
|
|
8695
8775
|
}
|
|
8696
8776
|
}
|
|
8697
8777
|
console.log();
|
|
@@ -8720,16 +8800,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
8720
8800
|
// src/commands/dotnet/resolveCsproj.ts
|
|
8721
8801
|
import { existsSync as existsSync27 } from "fs";
|
|
8722
8802
|
import path26 from "path";
|
|
8723
|
-
import
|
|
8803
|
+
import chalk97 from "chalk";
|
|
8724
8804
|
function resolveCsproj(csprojPath) {
|
|
8725
8805
|
const resolved = path26.resolve(csprojPath);
|
|
8726
8806
|
if (!existsSync27(resolved)) {
|
|
8727
|
-
console.error(
|
|
8807
|
+
console.error(chalk97.red(`File not found: ${resolved}`));
|
|
8728
8808
|
process.exit(1);
|
|
8729
8809
|
}
|
|
8730
8810
|
const repoRoot = findRepoRoot(path26.dirname(resolved));
|
|
8731
8811
|
if (!repoRoot) {
|
|
8732
|
-
console.error(
|
|
8812
|
+
console.error(chalk97.red("Could not find git repository root"));
|
|
8733
8813
|
process.exit(1);
|
|
8734
8814
|
}
|
|
8735
8815
|
return { resolved, repoRoot };
|
|
@@ -8779,12 +8859,12 @@ function getChangedCsFiles(scope) {
|
|
|
8779
8859
|
}
|
|
8780
8860
|
|
|
8781
8861
|
// src/commands/dotnet/inSln.ts
|
|
8782
|
-
import
|
|
8862
|
+
import chalk98 from "chalk";
|
|
8783
8863
|
async function inSln(csprojPath) {
|
|
8784
8864
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
8785
8865
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
8786
8866
|
if (solutions.length === 0) {
|
|
8787
|
-
console.log(
|
|
8867
|
+
console.log(chalk98.yellow("Not found in any .sln file"));
|
|
8788
8868
|
process.exit(1);
|
|
8789
8869
|
}
|
|
8790
8870
|
for (const sln of solutions) {
|
|
@@ -8793,7 +8873,7 @@ async function inSln(csprojPath) {
|
|
|
8793
8873
|
}
|
|
8794
8874
|
|
|
8795
8875
|
// src/commands/dotnet/inspect.ts
|
|
8796
|
-
import
|
|
8876
|
+
import chalk104 from "chalk";
|
|
8797
8877
|
|
|
8798
8878
|
// src/shared/formatElapsed.ts
|
|
8799
8879
|
function formatElapsed(ms) {
|
|
@@ -8805,12 +8885,12 @@ function formatElapsed(ms) {
|
|
|
8805
8885
|
}
|
|
8806
8886
|
|
|
8807
8887
|
// src/commands/dotnet/displayIssues.ts
|
|
8808
|
-
import
|
|
8888
|
+
import chalk99 from "chalk";
|
|
8809
8889
|
var SEVERITY_COLOR = {
|
|
8810
|
-
ERROR:
|
|
8811
|
-
WARNING:
|
|
8812
|
-
SUGGESTION:
|
|
8813
|
-
HINT:
|
|
8890
|
+
ERROR: chalk99.red,
|
|
8891
|
+
WARNING: chalk99.yellow,
|
|
8892
|
+
SUGGESTION: chalk99.cyan,
|
|
8893
|
+
HINT: chalk99.dim
|
|
8814
8894
|
};
|
|
8815
8895
|
function groupByFile(issues) {
|
|
8816
8896
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -8826,15 +8906,15 @@ function groupByFile(issues) {
|
|
|
8826
8906
|
}
|
|
8827
8907
|
function displayIssues(issues) {
|
|
8828
8908
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
8829
|
-
console.log(
|
|
8909
|
+
console.log(chalk99.bold(file));
|
|
8830
8910
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
8831
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
8911
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk99.white;
|
|
8832
8912
|
console.log(
|
|
8833
|
-
` ${
|
|
8913
|
+
` ${chalk99.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
8834
8914
|
);
|
|
8835
8915
|
}
|
|
8836
8916
|
}
|
|
8837
|
-
console.log(
|
|
8917
|
+
console.log(chalk99.dim(`
|
|
8838
8918
|
${issues.length} issue(s) found`));
|
|
8839
8919
|
}
|
|
8840
8920
|
|
|
@@ -8893,12 +8973,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
8893
8973
|
// src/commands/dotnet/resolveSolution.ts
|
|
8894
8974
|
import { existsSync as existsSync28 } from "fs";
|
|
8895
8975
|
import path27 from "path";
|
|
8896
|
-
import
|
|
8976
|
+
import chalk101 from "chalk";
|
|
8897
8977
|
|
|
8898
8978
|
// src/commands/dotnet/findSolution.ts
|
|
8899
8979
|
import { readdirSync as readdirSync4 } from "fs";
|
|
8900
8980
|
import { dirname as dirname18, join as join26 } from "path";
|
|
8901
|
-
import
|
|
8981
|
+
import chalk100 from "chalk";
|
|
8902
8982
|
function findSlnInDir(dir) {
|
|
8903
8983
|
try {
|
|
8904
8984
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join26(dir, f));
|
|
@@ -8914,17 +8994,17 @@ function findSolution() {
|
|
|
8914
8994
|
const slnFiles = findSlnInDir(current);
|
|
8915
8995
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
8916
8996
|
if (slnFiles.length > 1) {
|
|
8917
|
-
console.error(
|
|
8997
|
+
console.error(chalk100.red(`Multiple .sln files found in ${current}:`));
|
|
8918
8998
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
8919
8999
|
console.error(
|
|
8920
|
-
|
|
9000
|
+
chalk100.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
8921
9001
|
);
|
|
8922
9002
|
process.exit(1);
|
|
8923
9003
|
}
|
|
8924
9004
|
if (current === ceiling) break;
|
|
8925
9005
|
current = dirname18(current);
|
|
8926
9006
|
}
|
|
8927
|
-
console.error(
|
|
9007
|
+
console.error(chalk100.red("No .sln file found between cwd and repo root"));
|
|
8928
9008
|
process.exit(1);
|
|
8929
9009
|
}
|
|
8930
9010
|
|
|
@@ -8933,7 +9013,7 @@ function resolveSolution(sln) {
|
|
|
8933
9013
|
if (sln) {
|
|
8934
9014
|
const resolved = path27.resolve(sln);
|
|
8935
9015
|
if (!existsSync28(resolved)) {
|
|
8936
|
-
console.error(
|
|
9016
|
+
console.error(chalk101.red(`Solution file not found: ${resolved}`));
|
|
8937
9017
|
process.exit(1);
|
|
8938
9018
|
}
|
|
8939
9019
|
return resolved;
|
|
@@ -8975,14 +9055,14 @@ import { execSync as execSync24 } from "child_process";
|
|
|
8975
9055
|
import { existsSync as existsSync29, readFileSync as readFileSync23, unlinkSync as unlinkSync5 } from "fs";
|
|
8976
9056
|
import { tmpdir as tmpdir3 } from "os";
|
|
8977
9057
|
import path28 from "path";
|
|
8978
|
-
import
|
|
9058
|
+
import chalk102 from "chalk";
|
|
8979
9059
|
function assertJbInstalled() {
|
|
8980
9060
|
try {
|
|
8981
9061
|
execSync24("jb inspectcode --version", { stdio: "pipe" });
|
|
8982
9062
|
} catch {
|
|
8983
|
-
console.error(
|
|
9063
|
+
console.error(chalk102.red("jb is not installed. Install with:"));
|
|
8984
9064
|
console.error(
|
|
8985
|
-
|
|
9065
|
+
chalk102.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
8986
9066
|
);
|
|
8987
9067
|
process.exit(1);
|
|
8988
9068
|
}
|
|
@@ -9000,11 +9080,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
9000
9080
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
9001
9081
|
process.stderr.write(err.stderr);
|
|
9002
9082
|
}
|
|
9003
|
-
console.error(
|
|
9083
|
+
console.error(chalk102.red("jb inspectcode failed"));
|
|
9004
9084
|
process.exit(1);
|
|
9005
9085
|
}
|
|
9006
9086
|
if (!existsSync29(reportPath)) {
|
|
9007
|
-
console.error(
|
|
9087
|
+
console.error(chalk102.red("Report file not generated"));
|
|
9008
9088
|
process.exit(1);
|
|
9009
9089
|
}
|
|
9010
9090
|
const xml = readFileSync23(reportPath, "utf-8");
|
|
@@ -9014,7 +9094,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
9014
9094
|
|
|
9015
9095
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
9016
9096
|
import { execSync as execSync25 } from "child_process";
|
|
9017
|
-
import
|
|
9097
|
+
import chalk103 from "chalk";
|
|
9018
9098
|
function resolveMsbuildPath() {
|
|
9019
9099
|
const { run: run4 } = loadConfig();
|
|
9020
9100
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -9026,9 +9106,9 @@ function assertMsbuildInstalled() {
|
|
|
9026
9106
|
try {
|
|
9027
9107
|
execSync25(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
9028
9108
|
} catch {
|
|
9029
|
-
console.error(
|
|
9109
|
+
console.error(chalk103.red(`msbuild not found at: ${msbuild}`));
|
|
9030
9110
|
console.error(
|
|
9031
|
-
|
|
9111
|
+
chalk103.yellow(
|
|
9032
9112
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
9033
9113
|
)
|
|
9034
9114
|
);
|
|
@@ -9075,17 +9155,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
9075
9155
|
// src/commands/dotnet/inspect.ts
|
|
9076
9156
|
function logScope(changedFiles) {
|
|
9077
9157
|
if (changedFiles === null) {
|
|
9078
|
-
console.log(
|
|
9158
|
+
console.log(chalk104.dim("Inspecting full solution..."));
|
|
9079
9159
|
} else {
|
|
9080
9160
|
console.log(
|
|
9081
|
-
|
|
9161
|
+
chalk104.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
9082
9162
|
);
|
|
9083
9163
|
}
|
|
9084
9164
|
}
|
|
9085
9165
|
function reportResults(issues, elapsed) {
|
|
9086
9166
|
if (issues.length > 0) displayIssues(issues);
|
|
9087
|
-
else console.log(
|
|
9088
|
-
console.log(
|
|
9167
|
+
else console.log(chalk104.green("No issues found"));
|
|
9168
|
+
console.log(chalk104.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
9089
9169
|
if (issues.length > 0) process.exit(1);
|
|
9090
9170
|
}
|
|
9091
9171
|
async function inspect(sln, options2) {
|
|
@@ -9096,7 +9176,7 @@ async function inspect(sln, options2) {
|
|
|
9096
9176
|
const scope = parseScope(options2.scope);
|
|
9097
9177
|
const changedFiles = getChangedCsFiles(scope);
|
|
9098
9178
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
9099
|
-
console.log(
|
|
9179
|
+
console.log(chalk104.green("No changed .cs files found"));
|
|
9100
9180
|
return;
|
|
9101
9181
|
}
|
|
9102
9182
|
logScope(changedFiles);
|
|
@@ -9350,7 +9430,7 @@ function registerHandover(program2) {
|
|
|
9350
9430
|
}
|
|
9351
9431
|
|
|
9352
9432
|
// src/commands/jira/acceptanceCriteria.ts
|
|
9353
|
-
import
|
|
9433
|
+
import chalk106 from "chalk";
|
|
9354
9434
|
|
|
9355
9435
|
// src/commands/jira/adfToText.ts
|
|
9356
9436
|
function renderInline(node) {
|
|
@@ -9411,7 +9491,7 @@ function adfToText(doc) {
|
|
|
9411
9491
|
|
|
9412
9492
|
// src/commands/jira/fetchIssue.ts
|
|
9413
9493
|
import { execSync as execSync26 } from "child_process";
|
|
9414
|
-
import
|
|
9494
|
+
import chalk105 from "chalk";
|
|
9415
9495
|
function fetchIssue(issueKey, fields) {
|
|
9416
9496
|
let result;
|
|
9417
9497
|
try {
|
|
@@ -9424,15 +9504,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
9424
9504
|
const stderr = error.stderr;
|
|
9425
9505
|
if (stderr.includes("unauthorized")) {
|
|
9426
9506
|
console.error(
|
|
9427
|
-
|
|
9507
|
+
chalk105.red("Jira authentication expired."),
|
|
9428
9508
|
"Run",
|
|
9429
|
-
|
|
9509
|
+
chalk105.cyan("assist jira auth"),
|
|
9430
9510
|
"to re-authenticate."
|
|
9431
9511
|
);
|
|
9432
9512
|
process.exit(1);
|
|
9433
9513
|
}
|
|
9434
9514
|
}
|
|
9435
|
-
console.error(
|
|
9515
|
+
console.error(chalk105.red(`Failed to fetch ${issueKey}.`));
|
|
9436
9516
|
process.exit(1);
|
|
9437
9517
|
}
|
|
9438
9518
|
return JSON.parse(result);
|
|
@@ -9446,7 +9526,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
9446
9526
|
const parsed = fetchIssue(issueKey, field);
|
|
9447
9527
|
const acValue = parsed?.fields?.[field];
|
|
9448
9528
|
if (!acValue) {
|
|
9449
|
-
console.log(
|
|
9529
|
+
console.log(chalk106.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
9450
9530
|
return;
|
|
9451
9531
|
}
|
|
9452
9532
|
if (typeof acValue === "string") {
|
|
@@ -9541,14 +9621,14 @@ async function jiraAuth() {
|
|
|
9541
9621
|
}
|
|
9542
9622
|
|
|
9543
9623
|
// src/commands/jira/viewIssue.ts
|
|
9544
|
-
import
|
|
9624
|
+
import chalk107 from "chalk";
|
|
9545
9625
|
function viewIssue(issueKey) {
|
|
9546
9626
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
9547
9627
|
const fields = parsed?.fields;
|
|
9548
9628
|
const summary = fields?.summary;
|
|
9549
9629
|
const description = fields?.description;
|
|
9550
9630
|
if (summary) {
|
|
9551
|
-
console.log(
|
|
9631
|
+
console.log(chalk107.bold(summary));
|
|
9552
9632
|
}
|
|
9553
9633
|
if (description) {
|
|
9554
9634
|
if (summary) console.log();
|
|
@@ -9562,7 +9642,7 @@ function viewIssue(issueKey) {
|
|
|
9562
9642
|
}
|
|
9563
9643
|
if (!summary && !description) {
|
|
9564
9644
|
console.log(
|
|
9565
|
-
|
|
9645
|
+
chalk107.yellow(`No summary or description found on ${issueKey}.`)
|
|
9566
9646
|
);
|
|
9567
9647
|
}
|
|
9568
9648
|
}
|
|
@@ -9578,15 +9658,15 @@ function registerJira(program2) {
|
|
|
9578
9658
|
// src/commands/mermaid/index.ts
|
|
9579
9659
|
import { mkdirSync as mkdirSync8, readdirSync as readdirSync5 } from "fs";
|
|
9580
9660
|
import { resolve as resolve10 } from "path";
|
|
9581
|
-
import
|
|
9661
|
+
import chalk110 from "chalk";
|
|
9582
9662
|
|
|
9583
9663
|
// src/commands/mermaid/exportFile.ts
|
|
9584
9664
|
import { readFileSync as readFileSync27, writeFileSync as writeFileSync19 } from "fs";
|
|
9585
9665
|
import { basename as basename7, extname, resolve as resolve9 } from "path";
|
|
9586
|
-
import
|
|
9666
|
+
import chalk109 from "chalk";
|
|
9587
9667
|
|
|
9588
9668
|
// src/commands/mermaid/renderBlock.ts
|
|
9589
|
-
import
|
|
9669
|
+
import chalk108 from "chalk";
|
|
9590
9670
|
async function renderBlock(krokiUrl, source) {
|
|
9591
9671
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
9592
9672
|
method: "POST",
|
|
@@ -9595,7 +9675,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
9595
9675
|
});
|
|
9596
9676
|
if (!response.ok) {
|
|
9597
9677
|
console.error(
|
|
9598
|
-
|
|
9678
|
+
chalk108.red(
|
|
9599
9679
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
9600
9680
|
)
|
|
9601
9681
|
);
|
|
@@ -9613,19 +9693,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
9613
9693
|
if (onlyIndex !== void 0) {
|
|
9614
9694
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
9615
9695
|
console.error(
|
|
9616
|
-
|
|
9696
|
+
chalk109.red(
|
|
9617
9697
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
9618
9698
|
)
|
|
9619
9699
|
);
|
|
9620
9700
|
process.exit(1);
|
|
9621
9701
|
}
|
|
9622
9702
|
console.log(
|
|
9623
|
-
|
|
9703
|
+
chalk109.gray(
|
|
9624
9704
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
9625
9705
|
)
|
|
9626
9706
|
);
|
|
9627
9707
|
} else {
|
|
9628
|
-
console.log(
|
|
9708
|
+
console.log(chalk109.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
9629
9709
|
}
|
|
9630
9710
|
for (const [i, source] of blocks.entries()) {
|
|
9631
9711
|
const idx = i + 1;
|
|
@@ -9633,7 +9713,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
9633
9713
|
const outPath = resolve9(outDir, `${stem}-${idx}.svg`);
|
|
9634
9714
|
const svg = await renderBlock(krokiUrl, source);
|
|
9635
9715
|
writeFileSync19(outPath, svg, "utf8");
|
|
9636
|
-
console.log(
|
|
9716
|
+
console.log(chalk109.green(` \u2192 ${outPath}`));
|
|
9637
9717
|
}
|
|
9638
9718
|
}
|
|
9639
9719
|
function extractMermaidBlocks(markdown) {
|
|
@@ -9649,18 +9729,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
9649
9729
|
if (options2.index !== void 0) {
|
|
9650
9730
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
9651
9731
|
console.error(
|
|
9652
|
-
|
|
9732
|
+
chalk110.red(`--index must be a positive integer (got ${options2.index})`)
|
|
9653
9733
|
);
|
|
9654
9734
|
process.exit(1);
|
|
9655
9735
|
}
|
|
9656
9736
|
if (!file) {
|
|
9657
|
-
console.error(
|
|
9737
|
+
console.error(chalk110.red("--index requires a file argument"));
|
|
9658
9738
|
process.exit(1);
|
|
9659
9739
|
}
|
|
9660
9740
|
}
|
|
9661
9741
|
const files = file ? [file] : readdirSync5(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
9662
9742
|
if (files.length === 0) {
|
|
9663
|
-
console.log(
|
|
9743
|
+
console.log(chalk110.gray("No markdown files found in current directory."));
|
|
9664
9744
|
return;
|
|
9665
9745
|
}
|
|
9666
9746
|
for (const f of files) {
|
|
@@ -9683,7 +9763,7 @@ function registerMermaid(program2) {
|
|
|
9683
9763
|
}
|
|
9684
9764
|
|
|
9685
9765
|
// src/commands/news/add/index.ts
|
|
9686
|
-
import
|
|
9766
|
+
import chalk111 from "chalk";
|
|
9687
9767
|
import enquirer8 from "enquirer";
|
|
9688
9768
|
async function add2(url) {
|
|
9689
9769
|
if (!url) {
|
|
@@ -9706,17 +9786,17 @@ async function add2(url) {
|
|
|
9706
9786
|
const news = config.news ?? {};
|
|
9707
9787
|
const feeds = news.feeds ?? [];
|
|
9708
9788
|
if (feeds.includes(url)) {
|
|
9709
|
-
console.log(
|
|
9789
|
+
console.log(chalk111.yellow("Feed already exists in config"));
|
|
9710
9790
|
return;
|
|
9711
9791
|
}
|
|
9712
9792
|
feeds.push(url);
|
|
9713
9793
|
config.news = { ...news, feeds };
|
|
9714
9794
|
saveGlobalConfig(config);
|
|
9715
|
-
console.log(
|
|
9795
|
+
console.log(chalk111.green(`Added feed: ${url}`));
|
|
9716
9796
|
}
|
|
9717
9797
|
|
|
9718
9798
|
// src/commands/news/web/handleRequest.ts
|
|
9719
|
-
import
|
|
9799
|
+
import chalk112 from "chalk";
|
|
9720
9800
|
|
|
9721
9801
|
// src/commands/news/web/shared.ts
|
|
9722
9802
|
import { decodeHTML } from "entities";
|
|
@@ -9852,17 +9932,17 @@ function prefetch() {
|
|
|
9852
9932
|
const config = loadConfig();
|
|
9853
9933
|
const total = config.news.feeds.length;
|
|
9854
9934
|
if (total === 0) return;
|
|
9855
|
-
process.stdout.write(
|
|
9935
|
+
process.stdout.write(chalk112.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
9856
9936
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
9857
9937
|
const width = 20;
|
|
9858
9938
|
const filled = Math.round(done2 / t * width);
|
|
9859
9939
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
9860
9940
|
process.stdout.write(
|
|
9861
|
-
`\r${
|
|
9941
|
+
`\r${chalk112.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
9862
9942
|
);
|
|
9863
9943
|
}).then((items2) => {
|
|
9864
9944
|
process.stdout.write(
|
|
9865
|
-
`\r${
|
|
9945
|
+
`\r${chalk112.green(`Fetched ${items2.length} items from ${total} feed(s)`)}
|
|
9866
9946
|
`
|
|
9867
9947
|
);
|
|
9868
9948
|
cachedItems = items2;
|
|
@@ -9907,7 +9987,7 @@ function registerNews(program2) {
|
|
|
9907
9987
|
}
|
|
9908
9988
|
|
|
9909
9989
|
// src/commands/prompts/printPromptsTable.ts
|
|
9910
|
-
import
|
|
9990
|
+
import chalk113 from "chalk";
|
|
9911
9991
|
function truncate(str, max) {
|
|
9912
9992
|
if (str.length <= max) return str;
|
|
9913
9993
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -9925,14 +10005,14 @@ function printPromptsTable(rows) {
|
|
|
9925
10005
|
"Command".padEnd(commandWidth),
|
|
9926
10006
|
"Repos"
|
|
9927
10007
|
].join(" ");
|
|
9928
|
-
console.log(
|
|
9929
|
-
console.log(
|
|
10008
|
+
console.log(chalk113.dim(header));
|
|
10009
|
+
console.log(chalk113.dim("-".repeat(header.length)));
|
|
9930
10010
|
for (const row of rows) {
|
|
9931
|
-
const
|
|
10011
|
+
const count6 = String(row.count).padStart(countWidth);
|
|
9932
10012
|
const tool = row.tool.padEnd(toolWidth);
|
|
9933
10013
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
9934
10014
|
console.log(
|
|
9935
|
-
`${
|
|
10015
|
+
`${chalk113.yellow(count6)} ${tool} ${command} ${chalk113.dim(row.repos)}`
|
|
9936
10016
|
);
|
|
9937
10017
|
}
|
|
9938
10018
|
}
|
|
@@ -10364,20 +10444,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
10364
10444
|
}
|
|
10365
10445
|
|
|
10366
10446
|
// src/commands/prs/listComments/printComments.ts
|
|
10367
|
-
import
|
|
10447
|
+
import chalk114 from "chalk";
|
|
10368
10448
|
function formatForHuman(comment3) {
|
|
10369
10449
|
if (comment3.type === "review") {
|
|
10370
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
10450
|
+
const stateColor = comment3.state === "APPROVED" ? chalk114.green : comment3.state === "CHANGES_REQUESTED" ? chalk114.red : chalk114.yellow;
|
|
10371
10451
|
return [
|
|
10372
|
-
`${
|
|
10452
|
+
`${chalk114.cyan("Review")} by ${chalk114.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
10373
10453
|
comment3.body,
|
|
10374
10454
|
""
|
|
10375
10455
|
].join("\n");
|
|
10376
10456
|
}
|
|
10377
10457
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
10378
10458
|
return [
|
|
10379
|
-
`${
|
|
10380
|
-
|
|
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")),
|
|
10381
10461
|
comment3.body,
|
|
10382
10462
|
""
|
|
10383
10463
|
].join("\n");
|
|
@@ -10467,13 +10547,13 @@ import { execSync as execSync34 } from "child_process";
|
|
|
10467
10547
|
import enquirer9 from "enquirer";
|
|
10468
10548
|
|
|
10469
10549
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
10470
|
-
import
|
|
10550
|
+
import chalk115 from "chalk";
|
|
10471
10551
|
var STATUS_MAP = {
|
|
10472
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
10473
|
-
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
|
|
10474
10554
|
};
|
|
10475
10555
|
function defaultStatus(pr) {
|
|
10476
|
-
return { label:
|
|
10556
|
+
return { label: chalk115.green("opened"), date: pr.createdAt };
|
|
10477
10557
|
}
|
|
10478
10558
|
function getStatus2(pr) {
|
|
10479
10559
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -10482,11 +10562,11 @@ function formatDate(dateStr) {
|
|
|
10482
10562
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
10483
10563
|
}
|
|
10484
10564
|
function formatPrHeader(pr, status2) {
|
|
10485
|
-
return `${
|
|
10565
|
+
return `${chalk115.cyan(`#${pr.number}`)} ${pr.title} ${chalk115.dim(`(${pr.author.login},`)} ${status2.label} ${chalk115.dim(`${formatDate(status2.date)})`)}`;
|
|
10486
10566
|
}
|
|
10487
10567
|
function logPrDetails(pr) {
|
|
10488
10568
|
console.log(
|
|
10489
|
-
|
|
10569
|
+
chalk115.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
10490
10570
|
);
|
|
10491
10571
|
console.log();
|
|
10492
10572
|
}
|
|
@@ -10542,8 +10622,8 @@ async function promptNavigation(currentPage, totalPages) {
|
|
|
10542
10622
|
});
|
|
10543
10623
|
return parseAction(action);
|
|
10544
10624
|
}
|
|
10545
|
-
function computeTotalPages(
|
|
10546
|
-
return Math.ceil(
|
|
10625
|
+
function computeTotalPages(count6) {
|
|
10626
|
+
return Math.ceil(count6 / PAGE_SIZE);
|
|
10547
10627
|
}
|
|
10548
10628
|
async function navigateAndDisplay(pullRequests, totalPages, currentPage) {
|
|
10549
10629
|
const delta = await promptNavigation(currentPage, totalPages);
|
|
@@ -10653,10 +10733,10 @@ function registerPrs(program2) {
|
|
|
10653
10733
|
}
|
|
10654
10734
|
|
|
10655
10735
|
// src/commands/ravendb/ravendbAuth.ts
|
|
10656
|
-
import
|
|
10736
|
+
import chalk121 from "chalk";
|
|
10657
10737
|
|
|
10658
10738
|
// src/shared/createConnectionAuth.ts
|
|
10659
|
-
import
|
|
10739
|
+
import chalk116 from "chalk";
|
|
10660
10740
|
function listConnections(connections, format2) {
|
|
10661
10741
|
if (connections.length === 0) {
|
|
10662
10742
|
console.log("No connections configured.");
|
|
@@ -10669,7 +10749,7 @@ function listConnections(connections, format2) {
|
|
|
10669
10749
|
function removeConnection(connections, name, save) {
|
|
10670
10750
|
const filtered = connections.filter((c) => c.name !== name);
|
|
10671
10751
|
if (filtered.length === connections.length) {
|
|
10672
|
-
console.error(
|
|
10752
|
+
console.error(chalk116.red(`Connection "${name}" not found.`));
|
|
10673
10753
|
process.exit(1);
|
|
10674
10754
|
}
|
|
10675
10755
|
save(filtered);
|
|
@@ -10715,15 +10795,15 @@ function saveConnections(connections) {
|
|
|
10715
10795
|
}
|
|
10716
10796
|
|
|
10717
10797
|
// src/commands/ravendb/promptConnection.ts
|
|
10718
|
-
import
|
|
10798
|
+
import chalk119 from "chalk";
|
|
10719
10799
|
|
|
10720
10800
|
// src/commands/ravendb/selectOpSecret.ts
|
|
10721
|
-
import
|
|
10801
|
+
import chalk118 from "chalk";
|
|
10722
10802
|
import Enquirer2 from "enquirer";
|
|
10723
10803
|
|
|
10724
10804
|
// src/commands/ravendb/searchItems.ts
|
|
10725
10805
|
import { execSync as execSync36 } from "child_process";
|
|
10726
|
-
import
|
|
10806
|
+
import chalk117 from "chalk";
|
|
10727
10807
|
function opExec(args) {
|
|
10728
10808
|
return execSync36(`op ${args}`, {
|
|
10729
10809
|
encoding: "utf-8",
|
|
@@ -10736,7 +10816,7 @@ function searchItems(search2) {
|
|
|
10736
10816
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
10737
10817
|
} catch {
|
|
10738
10818
|
console.error(
|
|
10739
|
-
|
|
10819
|
+
chalk117.red(
|
|
10740
10820
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
10741
10821
|
)
|
|
10742
10822
|
);
|
|
@@ -10750,7 +10830,7 @@ function getItemFields(itemId) {
|
|
|
10750
10830
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
10751
10831
|
return item.fields.filter((f) => f.reference && f.label);
|
|
10752
10832
|
} catch {
|
|
10753
|
-
console.error(
|
|
10833
|
+
console.error(chalk117.red("Failed to get item details from 1Password."));
|
|
10754
10834
|
process.exit(1);
|
|
10755
10835
|
}
|
|
10756
10836
|
}
|
|
@@ -10769,7 +10849,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
10769
10849
|
}).run();
|
|
10770
10850
|
const items2 = searchItems(search2);
|
|
10771
10851
|
if (items2.length === 0) {
|
|
10772
|
-
console.error(
|
|
10852
|
+
console.error(chalk118.red(`No items found matching "${search2}".`));
|
|
10773
10853
|
process.exit(1);
|
|
10774
10854
|
}
|
|
10775
10855
|
const itemId = await selectOne(
|
|
@@ -10778,7 +10858,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
10778
10858
|
);
|
|
10779
10859
|
const fields = getItemFields(itemId);
|
|
10780
10860
|
if (fields.length === 0) {
|
|
10781
|
-
console.error(
|
|
10861
|
+
console.error(chalk118.red("No fields with references found on this item."));
|
|
10782
10862
|
process.exit(1);
|
|
10783
10863
|
}
|
|
10784
10864
|
const ref = await selectOne(
|
|
@@ -10792,7 +10872,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
10792
10872
|
async function promptConnection(existingNames) {
|
|
10793
10873
|
const name = await promptInput("name", "Connection name:");
|
|
10794
10874
|
if (existingNames.includes(name)) {
|
|
10795
|
-
console.error(
|
|
10875
|
+
console.error(chalk119.red(`Connection "${name}" already exists.`));
|
|
10796
10876
|
process.exit(1);
|
|
10797
10877
|
}
|
|
10798
10878
|
const url = await promptInput(
|
|
@@ -10801,22 +10881,22 @@ async function promptConnection(existingNames) {
|
|
|
10801
10881
|
);
|
|
10802
10882
|
const database = await promptInput("database", "Database name:");
|
|
10803
10883
|
if (!name || !url || !database) {
|
|
10804
|
-
console.error(
|
|
10884
|
+
console.error(chalk119.red("All fields are required."));
|
|
10805
10885
|
process.exit(1);
|
|
10806
10886
|
}
|
|
10807
10887
|
const apiKeyRef = await selectOpSecret();
|
|
10808
|
-
console.log(
|
|
10888
|
+
console.log(chalk119.dim(`Using: ${apiKeyRef}`));
|
|
10809
10889
|
return { name, url, database, apiKeyRef };
|
|
10810
10890
|
}
|
|
10811
10891
|
|
|
10812
10892
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
10813
|
-
import
|
|
10893
|
+
import chalk120 from "chalk";
|
|
10814
10894
|
function ravendbSetConnection(name) {
|
|
10815
10895
|
const raw = loadGlobalConfigRaw();
|
|
10816
10896
|
const ravendb = raw.ravendb ?? {};
|
|
10817
10897
|
const connections = ravendb.connections ?? [];
|
|
10818
10898
|
if (!connections.some((c) => c.name === name)) {
|
|
10819
|
-
console.error(
|
|
10899
|
+
console.error(chalk120.red(`Connection "${name}" not found.`));
|
|
10820
10900
|
console.error(
|
|
10821
10901
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
10822
10902
|
);
|
|
@@ -10832,16 +10912,16 @@ function ravendbSetConnection(name) {
|
|
|
10832
10912
|
var ravendbAuth = createConnectionAuth({
|
|
10833
10913
|
load: loadConnections,
|
|
10834
10914
|
save: saveConnections,
|
|
10835
|
-
format: (c) => `${
|
|
10915
|
+
format: (c) => `${chalk121.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
10836
10916
|
promptNew: promptConnection,
|
|
10837
10917
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
10838
10918
|
});
|
|
10839
10919
|
|
|
10840
10920
|
// src/commands/ravendb/ravendbCollections.ts
|
|
10841
|
-
import
|
|
10921
|
+
import chalk125 from "chalk";
|
|
10842
10922
|
|
|
10843
10923
|
// src/commands/ravendb/ravenFetch.ts
|
|
10844
|
-
import
|
|
10924
|
+
import chalk123 from "chalk";
|
|
10845
10925
|
|
|
10846
10926
|
// src/commands/ravendb/getAccessToken.ts
|
|
10847
10927
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -10878,10 +10958,10 @@ ${errorText}`
|
|
|
10878
10958
|
|
|
10879
10959
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
10880
10960
|
import { execSync as execSync37 } from "child_process";
|
|
10881
|
-
import
|
|
10961
|
+
import chalk122 from "chalk";
|
|
10882
10962
|
function resolveOpSecret(reference) {
|
|
10883
10963
|
if (!reference.startsWith("op://")) {
|
|
10884
|
-
console.error(
|
|
10964
|
+
console.error(chalk122.red(`Invalid secret reference: must start with op://`));
|
|
10885
10965
|
process.exit(1);
|
|
10886
10966
|
}
|
|
10887
10967
|
try {
|
|
@@ -10891,7 +10971,7 @@ function resolveOpSecret(reference) {
|
|
|
10891
10971
|
}).trim();
|
|
10892
10972
|
} catch {
|
|
10893
10973
|
console.error(
|
|
10894
|
-
|
|
10974
|
+
chalk122.red(
|
|
10895
10975
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
10896
10976
|
)
|
|
10897
10977
|
);
|
|
@@ -10918,7 +10998,7 @@ async function ravenFetch(connection, path52) {
|
|
|
10918
10998
|
if (!response.ok) {
|
|
10919
10999
|
const body = await response.text();
|
|
10920
11000
|
console.error(
|
|
10921
|
-
|
|
11001
|
+
chalk123.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
10922
11002
|
);
|
|
10923
11003
|
console.error(body.substring(0, 500));
|
|
10924
11004
|
process.exit(1);
|
|
@@ -10927,7 +11007,7 @@ async function ravenFetch(connection, path52) {
|
|
|
10927
11007
|
}
|
|
10928
11008
|
|
|
10929
11009
|
// src/commands/ravendb/resolveConnection.ts
|
|
10930
|
-
import
|
|
11010
|
+
import chalk124 from "chalk";
|
|
10931
11011
|
function loadRavendb() {
|
|
10932
11012
|
const raw = loadGlobalConfigRaw();
|
|
10933
11013
|
const ravendb = raw.ravendb;
|
|
@@ -10941,7 +11021,7 @@ function resolveConnection(name) {
|
|
|
10941
11021
|
const connectionName = name ?? defaultConnection;
|
|
10942
11022
|
if (!connectionName) {
|
|
10943
11023
|
console.error(
|
|
10944
|
-
|
|
11024
|
+
chalk124.red(
|
|
10945
11025
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
10946
11026
|
)
|
|
10947
11027
|
);
|
|
@@ -10949,7 +11029,7 @@ function resolveConnection(name) {
|
|
|
10949
11029
|
}
|
|
10950
11030
|
const connection = connections.find((c) => c.name === connectionName);
|
|
10951
11031
|
if (!connection) {
|
|
10952
|
-
console.error(
|
|
11032
|
+
console.error(chalk124.red(`Connection "${connectionName}" not found.`));
|
|
10953
11033
|
console.error(
|
|
10954
11034
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
10955
11035
|
);
|
|
@@ -10980,15 +11060,15 @@ async function ravendbCollections(connectionName) {
|
|
|
10980
11060
|
return;
|
|
10981
11061
|
}
|
|
10982
11062
|
for (const c of collections) {
|
|
10983
|
-
console.log(`${
|
|
11063
|
+
console.log(`${chalk125.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
10984
11064
|
}
|
|
10985
11065
|
}
|
|
10986
11066
|
|
|
10987
11067
|
// src/commands/ravendb/ravendbQuery.ts
|
|
10988
|
-
import
|
|
11068
|
+
import chalk127 from "chalk";
|
|
10989
11069
|
|
|
10990
11070
|
// src/commands/ravendb/fetchAllPages.ts
|
|
10991
|
-
import
|
|
11071
|
+
import chalk126 from "chalk";
|
|
10992
11072
|
|
|
10993
11073
|
// src/commands/ravendb/buildQueryPath.ts
|
|
10994
11074
|
function buildQueryPath(opts) {
|
|
@@ -11026,7 +11106,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
11026
11106
|
allResults.push(...results);
|
|
11027
11107
|
start3 += results.length;
|
|
11028
11108
|
process.stderr.write(
|
|
11029
|
-
`\r${
|
|
11109
|
+
`\r${chalk126.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
11030
11110
|
);
|
|
11031
11111
|
if (start3 >= totalResults) break;
|
|
11032
11112
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -11041,7 +11121,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
11041
11121
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
11042
11122
|
const resolved = resolveArgs(connectionName, collection);
|
|
11043
11123
|
if (!resolved.collection && !options2.query) {
|
|
11044
|
-
console.error(
|
|
11124
|
+
console.error(chalk127.red("Provide a collection name or --query filter."));
|
|
11045
11125
|
process.exit(1);
|
|
11046
11126
|
}
|
|
11047
11127
|
const { collection: col } = resolved;
|
|
@@ -11079,7 +11159,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
11079
11159
|
import * as path29 from "path";
|
|
11080
11160
|
|
|
11081
11161
|
// src/commands/refactor/logViolations.ts
|
|
11082
|
-
import
|
|
11162
|
+
import chalk128 from "chalk";
|
|
11083
11163
|
var DEFAULT_MAX_LINES = 100;
|
|
11084
11164
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
11085
11165
|
if (violations.length === 0) {
|
|
@@ -11088,43 +11168,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
11088
11168
|
}
|
|
11089
11169
|
return;
|
|
11090
11170
|
}
|
|
11091
|
-
console.error(
|
|
11171
|
+
console.error(chalk128.red(`
|
|
11092
11172
|
Refactor check failed:
|
|
11093
11173
|
`));
|
|
11094
|
-
console.error(
|
|
11174
|
+
console.error(chalk128.red(` The following files exceed ${maxLines} lines:
|
|
11095
11175
|
`));
|
|
11096
11176
|
for (const violation of violations) {
|
|
11097
|
-
console.error(
|
|
11177
|
+
console.error(chalk128.red(` ${violation.file} (${violation.lines} lines)`));
|
|
11098
11178
|
}
|
|
11099
11179
|
console.error(
|
|
11100
|
-
|
|
11180
|
+
chalk128.yellow(
|
|
11101
11181
|
`
|
|
11102
11182
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
11103
11183
|
way to refactor it, ignore it with:
|
|
11104
11184
|
`
|
|
11105
11185
|
)
|
|
11106
11186
|
);
|
|
11107
|
-
console.error(
|
|
11187
|
+
console.error(chalk128.gray(` assist refactor ignore <file>
|
|
11108
11188
|
`));
|
|
11109
11189
|
if (process.env.CLAUDECODE) {
|
|
11110
|
-
console.error(
|
|
11190
|
+
console.error(chalk128.cyan(`
|
|
11111
11191
|
## Extracting Code to New Files
|
|
11112
11192
|
`));
|
|
11113
11193
|
console.error(
|
|
11114
|
-
|
|
11194
|
+
chalk128.cyan(
|
|
11115
11195
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
11116
11196
|
`
|
|
11117
11197
|
)
|
|
11118
11198
|
);
|
|
11119
11199
|
console.error(
|
|
11120
|
-
|
|
11200
|
+
chalk128.cyan(
|
|
11121
11201
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
11122
11202
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
11123
11203
|
`
|
|
11124
11204
|
)
|
|
11125
11205
|
);
|
|
11126
11206
|
console.error(
|
|
11127
|
-
|
|
11207
|
+
chalk128.cyan(
|
|
11128
11208
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
11129
11209
|
domains, move it to a common/shared folder.
|
|
11130
11210
|
`
|
|
@@ -11280,7 +11360,7 @@ async function check(pattern2, options2) {
|
|
|
11280
11360
|
|
|
11281
11361
|
// src/commands/refactor/extract/index.ts
|
|
11282
11362
|
import path36 from "path";
|
|
11283
|
-
import
|
|
11363
|
+
import chalk131 from "chalk";
|
|
11284
11364
|
|
|
11285
11365
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
11286
11366
|
import { SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
@@ -11827,23 +11907,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
11827
11907
|
|
|
11828
11908
|
// src/commands/refactor/extract/displayPlan.ts
|
|
11829
11909
|
import path33 from "path";
|
|
11830
|
-
import
|
|
11910
|
+
import chalk129 from "chalk";
|
|
11831
11911
|
function section(title) {
|
|
11832
11912
|
return `
|
|
11833
|
-
${
|
|
11913
|
+
${chalk129.cyan(title)}`;
|
|
11834
11914
|
}
|
|
11835
11915
|
function displayImporters(plan2, cwd) {
|
|
11836
11916
|
if (plan2.importersToUpdate.length === 0) return;
|
|
11837
11917
|
console.log(section("Update importers:"));
|
|
11838
11918
|
for (const imp of plan2.importersToUpdate) {
|
|
11839
11919
|
const rel = path33.relative(cwd, imp.file.getFilePath());
|
|
11840
|
-
console.log(` ${
|
|
11920
|
+
console.log(` ${chalk129.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
11841
11921
|
}
|
|
11842
11922
|
}
|
|
11843
11923
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
11844
|
-
console.log(
|
|
11924
|
+
console.log(chalk129.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
11845
11925
|
`));
|
|
11846
|
-
console.log(` ${
|
|
11926
|
+
console.log(` ${chalk129.cyan("Functions to move:")}`);
|
|
11847
11927
|
for (const name of plan2.extractedNames) {
|
|
11848
11928
|
console.log(` ${name}`);
|
|
11849
11929
|
}
|
|
@@ -11877,7 +11957,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
11877
11957
|
|
|
11878
11958
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
11879
11959
|
import path35 from "path";
|
|
11880
|
-
import
|
|
11960
|
+
import chalk130 from "chalk";
|
|
11881
11961
|
import { Project as Project3 } from "ts-morph";
|
|
11882
11962
|
|
|
11883
11963
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -11937,7 +12017,7 @@ function loadProjectFile(file) {
|
|
|
11937
12017
|
});
|
|
11938
12018
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
11939
12019
|
if (!sourceFile) {
|
|
11940
|
-
console.log(
|
|
12020
|
+
console.log(chalk130.red(`File not found in project: ${file}`));
|
|
11941
12021
|
process.exit(1);
|
|
11942
12022
|
}
|
|
11943
12023
|
return { project, sourceFile };
|
|
@@ -11960,19 +12040,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
11960
12040
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
11961
12041
|
if (options2.apply) {
|
|
11962
12042
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
11963
|
-
console.log(
|
|
12043
|
+
console.log(chalk131.green("\nExtraction complete"));
|
|
11964
12044
|
} else {
|
|
11965
|
-
console.log(
|
|
12045
|
+
console.log(chalk131.dim("\nDry run. Use --apply to execute."));
|
|
11966
12046
|
}
|
|
11967
12047
|
}
|
|
11968
12048
|
|
|
11969
12049
|
// src/commands/refactor/ignore.ts
|
|
11970
12050
|
import fs21 from "fs";
|
|
11971
|
-
import
|
|
12051
|
+
import chalk132 from "chalk";
|
|
11972
12052
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
11973
12053
|
function ignore(file) {
|
|
11974
12054
|
if (!fs21.existsSync(file)) {
|
|
11975
|
-
console.error(
|
|
12055
|
+
console.error(chalk132.red(`Error: File does not exist: ${file}`));
|
|
11976
12056
|
process.exit(1);
|
|
11977
12057
|
}
|
|
11978
12058
|
const content = fs21.readFileSync(file, "utf-8");
|
|
@@ -11988,7 +12068,7 @@ function ignore(file) {
|
|
|
11988
12068
|
fs21.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
11989
12069
|
}
|
|
11990
12070
|
console.log(
|
|
11991
|
-
|
|
12071
|
+
chalk132.green(
|
|
11992
12072
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
11993
12073
|
)
|
|
11994
12074
|
);
|
|
@@ -11996,25 +12076,25 @@ function ignore(file) {
|
|
|
11996
12076
|
|
|
11997
12077
|
// src/commands/refactor/rename/index.ts
|
|
11998
12078
|
import path37 from "path";
|
|
11999
|
-
import
|
|
12079
|
+
import chalk133 from "chalk";
|
|
12000
12080
|
async function rename(source, destination, options2 = {}) {
|
|
12001
12081
|
const destPath = path37.resolve(destination);
|
|
12002
12082
|
const cwd = process.cwd();
|
|
12003
12083
|
const relSource = path37.relative(cwd, path37.resolve(source));
|
|
12004
12084
|
const relDest = path37.relative(cwd, destPath);
|
|
12005
12085
|
const { project, sourceFile } = loadProjectFile(source);
|
|
12006
|
-
console.log(
|
|
12086
|
+
console.log(chalk133.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
12007
12087
|
if (options2.apply) {
|
|
12008
12088
|
sourceFile.move(destPath);
|
|
12009
12089
|
await project.save();
|
|
12010
|
-
console.log(
|
|
12090
|
+
console.log(chalk133.green("Done"));
|
|
12011
12091
|
} else {
|
|
12012
|
-
console.log(
|
|
12092
|
+
console.log(chalk133.dim("Dry run. Use --apply to execute."));
|
|
12013
12093
|
}
|
|
12014
12094
|
}
|
|
12015
12095
|
|
|
12016
12096
|
// src/commands/refactor/renameSymbol/index.ts
|
|
12017
|
-
import
|
|
12097
|
+
import chalk134 from "chalk";
|
|
12018
12098
|
|
|
12019
12099
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
12020
12100
|
import { SyntaxKind as SyntaxKind13 } from "ts-morph";
|
|
@@ -12060,33 +12140,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
12060
12140
|
const { project, sourceFile } = loadProjectFile(file);
|
|
12061
12141
|
const symbol = findSymbol(sourceFile, oldName);
|
|
12062
12142
|
if (!symbol) {
|
|
12063
|
-
console.log(
|
|
12143
|
+
console.log(chalk134.red(`Symbol "${oldName}" not found in ${file}`));
|
|
12064
12144
|
process.exit(1);
|
|
12065
12145
|
}
|
|
12066
12146
|
const grouped = groupReferences(symbol, cwd);
|
|
12067
12147
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
12068
12148
|
console.log(
|
|
12069
|
-
|
|
12149
|
+
chalk134.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
12070
12150
|
`)
|
|
12071
12151
|
);
|
|
12072
12152
|
for (const [refFile, lines] of grouped) {
|
|
12073
12153
|
console.log(
|
|
12074
|
-
` ${
|
|
12154
|
+
` ${chalk134.dim(refFile)}: lines ${chalk134.cyan(lines.join(", "))}`
|
|
12075
12155
|
);
|
|
12076
12156
|
}
|
|
12077
12157
|
if (options2.apply) {
|
|
12078
12158
|
symbol.rename(newName);
|
|
12079
12159
|
await project.save();
|
|
12080
|
-
console.log(
|
|
12160
|
+
console.log(chalk134.green(`
|
|
12081
12161
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
12082
12162
|
} else {
|
|
12083
|
-
console.log(
|
|
12163
|
+
console.log(chalk134.dim("\nDry run. Use --apply to execute."));
|
|
12084
12164
|
}
|
|
12085
12165
|
}
|
|
12086
12166
|
|
|
12087
12167
|
// src/commands/refactor/restructure/index.ts
|
|
12088
12168
|
import path47 from "path";
|
|
12089
|
-
import
|
|
12169
|
+
import chalk137 from "chalk";
|
|
12090
12170
|
|
|
12091
12171
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
12092
12172
|
import path39 from "path";
|
|
@@ -12329,50 +12409,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
12329
12409
|
|
|
12330
12410
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
12331
12411
|
import path43 from "path";
|
|
12332
|
-
import
|
|
12412
|
+
import chalk135 from "chalk";
|
|
12333
12413
|
function relPath(filePath) {
|
|
12334
12414
|
return path43.relative(process.cwd(), filePath);
|
|
12335
12415
|
}
|
|
12336
12416
|
function displayMoves(plan2) {
|
|
12337
12417
|
if (plan2.moves.length === 0) return;
|
|
12338
|
-
console.log(
|
|
12418
|
+
console.log(chalk135.bold("\nFile moves:"));
|
|
12339
12419
|
for (const move of plan2.moves) {
|
|
12340
12420
|
console.log(
|
|
12341
|
-
` ${
|
|
12421
|
+
` ${chalk135.red(relPath(move.from))} \u2192 ${chalk135.green(relPath(move.to))}`
|
|
12342
12422
|
);
|
|
12343
|
-
console.log(
|
|
12423
|
+
console.log(chalk135.dim(` ${move.reason}`));
|
|
12344
12424
|
}
|
|
12345
12425
|
}
|
|
12346
12426
|
function displayRewrites(rewrites) {
|
|
12347
12427
|
if (rewrites.length === 0) return;
|
|
12348
12428
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
12349
|
-
console.log(
|
|
12429
|
+
console.log(chalk135.bold(`
|
|
12350
12430
|
Import rewrites (${affectedFiles.size} files):`));
|
|
12351
12431
|
for (const file of affectedFiles) {
|
|
12352
|
-
console.log(` ${
|
|
12432
|
+
console.log(` ${chalk135.cyan(relPath(file))}:`);
|
|
12353
12433
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
12354
12434
|
(r) => r.file === file
|
|
12355
12435
|
)) {
|
|
12356
12436
|
console.log(
|
|
12357
|
-
` ${
|
|
12437
|
+
` ${chalk135.red(`"${oldSpecifier}"`)} \u2192 ${chalk135.green(`"${newSpecifier}"`)}`
|
|
12358
12438
|
);
|
|
12359
12439
|
}
|
|
12360
12440
|
}
|
|
12361
12441
|
}
|
|
12362
12442
|
function displayPlan2(plan2) {
|
|
12363
12443
|
if (plan2.warnings.length > 0) {
|
|
12364
|
-
console.log(
|
|
12365
|
-
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}`));
|
|
12366
12446
|
}
|
|
12367
12447
|
if (plan2.newDirectories.length > 0) {
|
|
12368
|
-
console.log(
|
|
12448
|
+
console.log(chalk135.bold("\nNew directories:"));
|
|
12369
12449
|
for (const dir of plan2.newDirectories)
|
|
12370
|
-
console.log(
|
|
12450
|
+
console.log(chalk135.green(` ${dir}/`));
|
|
12371
12451
|
}
|
|
12372
12452
|
displayMoves(plan2);
|
|
12373
12453
|
displayRewrites(plan2.rewrites);
|
|
12374
12454
|
console.log(
|
|
12375
|
-
|
|
12455
|
+
chalk135.dim(
|
|
12376
12456
|
`
|
|
12377
12457
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
12378
12458
|
)
|
|
@@ -12382,18 +12462,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
12382
12462
|
// src/commands/refactor/restructure/executePlan.ts
|
|
12383
12463
|
import fs23 from "fs";
|
|
12384
12464
|
import path44 from "path";
|
|
12385
|
-
import
|
|
12465
|
+
import chalk136 from "chalk";
|
|
12386
12466
|
function executePlan(plan2) {
|
|
12387
12467
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
12388
12468
|
for (const [file, content] of updatedContents) {
|
|
12389
12469
|
fs23.writeFileSync(file, content, "utf-8");
|
|
12390
12470
|
console.log(
|
|
12391
|
-
|
|
12471
|
+
chalk136.cyan(` Rewrote imports in ${path44.relative(process.cwd(), file)}`)
|
|
12392
12472
|
);
|
|
12393
12473
|
}
|
|
12394
12474
|
for (const dir of plan2.newDirectories) {
|
|
12395
12475
|
fs23.mkdirSync(dir, { recursive: true });
|
|
12396
|
-
console.log(
|
|
12476
|
+
console.log(chalk136.green(` Created ${path44.relative(process.cwd(), dir)}/`));
|
|
12397
12477
|
}
|
|
12398
12478
|
for (const move of plan2.moves) {
|
|
12399
12479
|
const targetDir = path44.dirname(move.to);
|
|
@@ -12402,7 +12482,7 @@ function executePlan(plan2) {
|
|
|
12402
12482
|
}
|
|
12403
12483
|
fs23.renameSync(move.from, move.to);
|
|
12404
12484
|
console.log(
|
|
12405
|
-
|
|
12485
|
+
chalk136.white(
|
|
12406
12486
|
` Moved ${path44.relative(process.cwd(), move.from)} \u2192 ${path44.relative(process.cwd(), move.to)}`
|
|
12407
12487
|
)
|
|
12408
12488
|
);
|
|
@@ -12417,7 +12497,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
12417
12497
|
if (entries.length === 0) {
|
|
12418
12498
|
fs23.rmdirSync(dir);
|
|
12419
12499
|
console.log(
|
|
12420
|
-
|
|
12500
|
+
chalk136.dim(
|
|
12421
12501
|
` Removed empty directory ${path44.relative(process.cwd(), dir)}`
|
|
12422
12502
|
)
|
|
12423
12503
|
);
|
|
@@ -12550,22 +12630,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
12550
12630
|
const targetPattern = pattern2 ?? "src";
|
|
12551
12631
|
const files = findSourceFiles2(targetPattern);
|
|
12552
12632
|
if (files.length === 0) {
|
|
12553
|
-
console.log(
|
|
12633
|
+
console.log(chalk137.yellow("No files found matching pattern"));
|
|
12554
12634
|
return;
|
|
12555
12635
|
}
|
|
12556
12636
|
const tsConfigPath = path47.resolve("tsconfig.json");
|
|
12557
12637
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
12558
12638
|
if (plan2.moves.length === 0) {
|
|
12559
|
-
console.log(
|
|
12639
|
+
console.log(chalk137.green("No restructuring needed"));
|
|
12560
12640
|
return;
|
|
12561
12641
|
}
|
|
12562
12642
|
displayPlan2(plan2);
|
|
12563
12643
|
if (options2.apply) {
|
|
12564
|
-
console.log(
|
|
12644
|
+
console.log(chalk137.bold("\nApplying changes..."));
|
|
12565
12645
|
executePlan(plan2);
|
|
12566
|
-
console.log(
|
|
12646
|
+
console.log(chalk137.green("\nRestructuring complete"));
|
|
12567
12647
|
} else {
|
|
12568
|
-
console.log(
|
|
12648
|
+
console.log(chalk137.dim("\nDry run. Use --apply to execute."));
|
|
12569
12649
|
}
|
|
12570
12650
|
}
|
|
12571
12651
|
|
|
@@ -13030,26 +13110,26 @@ async function postAndMaybeSubmit(lineBound, markdown, options2) {
|
|
|
13030
13110
|
}
|
|
13031
13111
|
|
|
13032
13112
|
// src/commands/review/warnUnlocated.ts
|
|
13033
|
-
import
|
|
13113
|
+
import chalk138 from "chalk";
|
|
13034
13114
|
function warnUnlocated(unlocated) {
|
|
13035
13115
|
if (unlocated.length === 0) return;
|
|
13036
13116
|
console.warn(
|
|
13037
|
-
|
|
13117
|
+
chalk138.yellow(
|
|
13038
13118
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
13039
13119
|
)
|
|
13040
13120
|
);
|
|
13041
13121
|
for (const finding of unlocated) {
|
|
13042
|
-
const where = finding.location ||
|
|
13122
|
+
const where = finding.location || chalk138.dim("missing");
|
|
13043
13123
|
console.warn(
|
|
13044
|
-
` ${
|
|
13124
|
+
` ${chalk138.yellow("\xB7")} ${finding.title} ${chalk138.dim(`(${where})`)}`
|
|
13045
13125
|
);
|
|
13046
13126
|
}
|
|
13047
13127
|
}
|
|
13048
13128
|
|
|
13049
13129
|
// src/commands/review/postReviewToPr.ts
|
|
13050
|
-
async function confirmPost(prNumber,
|
|
13130
|
+
async function confirmPost(prNumber, count6, options2) {
|
|
13051
13131
|
if (!options2.prompt) return true;
|
|
13052
|
-
return promptConfirm(`Post ${
|
|
13132
|
+
return promptConfirm(`Post ${count6} comment(s) to PR #${prNumber}?`, false);
|
|
13053
13133
|
}
|
|
13054
13134
|
async function postReviewToPr(synthesisPath, options2) {
|
|
13055
13135
|
const prNumber = findCurrentPrNumber();
|
|
@@ -14073,9 +14153,9 @@ async function runReviewPipeline(paths, options2) {
|
|
|
14073
14153
|
}
|
|
14074
14154
|
|
|
14075
14155
|
// src/commands/review/reviewPr.ts
|
|
14076
|
-
function logPriorComments(
|
|
14077
|
-
if (
|
|
14078
|
-
console.log(`Including ${
|
|
14156
|
+
function logPriorComments(count6) {
|
|
14157
|
+
if (count6 === 0) return;
|
|
14158
|
+
console.log(`Including ${count6} prior review comment(s) in request.md.`);
|
|
14079
14159
|
}
|
|
14080
14160
|
function gatherChangedContext() {
|
|
14081
14161
|
const context = gatherContext();
|
|
@@ -14235,7 +14315,7 @@ function registerReview(program2) {
|
|
|
14235
14315
|
}
|
|
14236
14316
|
|
|
14237
14317
|
// src/commands/seq/seqAuth.ts
|
|
14238
|
-
import
|
|
14318
|
+
import chalk140 from "chalk";
|
|
14239
14319
|
|
|
14240
14320
|
// src/commands/seq/loadConnections.ts
|
|
14241
14321
|
function loadConnections2() {
|
|
@@ -14264,10 +14344,10 @@ function setDefaultConnection(name) {
|
|
|
14264
14344
|
}
|
|
14265
14345
|
|
|
14266
14346
|
// src/shared/assertUniqueName.ts
|
|
14267
|
-
import
|
|
14347
|
+
import chalk139 from "chalk";
|
|
14268
14348
|
function assertUniqueName(existingNames, name) {
|
|
14269
14349
|
if (existingNames.includes(name)) {
|
|
14270
|
-
console.error(
|
|
14350
|
+
console.error(chalk139.red(`Connection "${name}" already exists.`));
|
|
14271
14351
|
process.exit(1);
|
|
14272
14352
|
}
|
|
14273
14353
|
}
|
|
@@ -14285,16 +14365,16 @@ async function promptConnection2(existingNames) {
|
|
|
14285
14365
|
var seqAuth = createConnectionAuth({
|
|
14286
14366
|
load: loadConnections2,
|
|
14287
14367
|
save: saveConnections2,
|
|
14288
|
-
format: (c) => `${
|
|
14368
|
+
format: (c) => `${chalk140.bold(c.name)} ${c.url}`,
|
|
14289
14369
|
promptNew: promptConnection2,
|
|
14290
14370
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
14291
14371
|
});
|
|
14292
14372
|
|
|
14293
14373
|
// src/commands/seq/seqQuery.ts
|
|
14294
|
-
import
|
|
14374
|
+
import chalk144 from "chalk";
|
|
14295
14375
|
|
|
14296
14376
|
// src/commands/seq/fetchSeq.ts
|
|
14297
|
-
import
|
|
14377
|
+
import chalk141 from "chalk";
|
|
14298
14378
|
async function fetchSeq(conn, path52, params) {
|
|
14299
14379
|
const url = `${conn.url}${path52}?${params}`;
|
|
14300
14380
|
const response = await fetch(url, {
|
|
@@ -14305,7 +14385,7 @@ async function fetchSeq(conn, path52, params) {
|
|
|
14305
14385
|
});
|
|
14306
14386
|
if (!response.ok) {
|
|
14307
14387
|
const body = await response.text();
|
|
14308
|
-
console.error(
|
|
14388
|
+
console.error(chalk141.red(`Seq returned ${response.status}: ${body}`));
|
|
14309
14389
|
process.exit(1);
|
|
14310
14390
|
}
|
|
14311
14391
|
return response;
|
|
@@ -14317,9 +14397,9 @@ function filterToSql(filter) {
|
|
|
14317
14397
|
}
|
|
14318
14398
|
|
|
14319
14399
|
// src/commands/seq/fetchSeqData.ts
|
|
14320
|
-
async function fetchSeqData(conn, filter,
|
|
14400
|
+
async function fetchSeqData(conn, filter, count6, from, to) {
|
|
14321
14401
|
const sqlFilter = filterToSql(filter);
|
|
14322
|
-
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}`;
|
|
14323
14403
|
const params = new URLSearchParams({ q: sql4 });
|
|
14324
14404
|
if (from) params.set("fromDateUtc", from);
|
|
14325
14405
|
if (to) params.set("toDateUtc", to);
|
|
@@ -14360,23 +14440,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
14360
14440
|
}
|
|
14361
14441
|
|
|
14362
14442
|
// src/commands/seq/formatEvent.ts
|
|
14363
|
-
import
|
|
14443
|
+
import chalk142 from "chalk";
|
|
14364
14444
|
function levelColor(level) {
|
|
14365
14445
|
switch (level) {
|
|
14366
14446
|
case "Fatal":
|
|
14367
|
-
return
|
|
14447
|
+
return chalk142.bgRed.white;
|
|
14368
14448
|
case "Error":
|
|
14369
|
-
return
|
|
14449
|
+
return chalk142.red;
|
|
14370
14450
|
case "Warning":
|
|
14371
|
-
return
|
|
14451
|
+
return chalk142.yellow;
|
|
14372
14452
|
case "Information":
|
|
14373
|
-
return
|
|
14453
|
+
return chalk142.cyan;
|
|
14374
14454
|
case "Debug":
|
|
14375
|
-
return
|
|
14455
|
+
return chalk142.gray;
|
|
14376
14456
|
case "Verbose":
|
|
14377
|
-
return
|
|
14457
|
+
return chalk142.dim;
|
|
14378
14458
|
default:
|
|
14379
|
-
return
|
|
14459
|
+
return chalk142.white;
|
|
14380
14460
|
}
|
|
14381
14461
|
}
|
|
14382
14462
|
function levelAbbrev(level) {
|
|
@@ -14417,12 +14497,12 @@ function formatTimestamp(iso) {
|
|
|
14417
14497
|
function formatEvent(event) {
|
|
14418
14498
|
const color = levelColor(event.Level);
|
|
14419
14499
|
const abbrev = levelAbbrev(event.Level);
|
|
14420
|
-
const ts8 =
|
|
14500
|
+
const ts8 = chalk142.dim(formatTimestamp(event.Timestamp));
|
|
14421
14501
|
const msg = renderMessage(event);
|
|
14422
14502
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
14423
14503
|
if (event.Exception) {
|
|
14424
14504
|
for (const line of event.Exception.split("\n")) {
|
|
14425
|
-
lines.push(
|
|
14505
|
+
lines.push(chalk142.red(` ${line}`));
|
|
14426
14506
|
}
|
|
14427
14507
|
}
|
|
14428
14508
|
return lines.join("\n");
|
|
@@ -14455,11 +14535,11 @@ function rejectTimestampFilter(filter) {
|
|
|
14455
14535
|
}
|
|
14456
14536
|
|
|
14457
14537
|
// src/shared/resolveNamedConnection.ts
|
|
14458
|
-
import
|
|
14538
|
+
import chalk143 from "chalk";
|
|
14459
14539
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
14460
14540
|
if (connections.length === 0) {
|
|
14461
14541
|
console.error(
|
|
14462
|
-
|
|
14542
|
+
chalk143.red(
|
|
14463
14543
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
14464
14544
|
)
|
|
14465
14545
|
);
|
|
@@ -14468,7 +14548,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
14468
14548
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
14469
14549
|
const connection = connections.find((c) => c.name === target);
|
|
14470
14550
|
if (!connection) {
|
|
14471
|
-
console.error(
|
|
14551
|
+
console.error(chalk143.red(`${kind} connection "${target}" not found.`));
|
|
14472
14552
|
process.exit(1);
|
|
14473
14553
|
}
|
|
14474
14554
|
return connection;
|
|
@@ -14489,15 +14569,15 @@ function resolveConnection2(name) {
|
|
|
14489
14569
|
async function seqQuery(filter, options2) {
|
|
14490
14570
|
rejectTimestampFilter(filter);
|
|
14491
14571
|
const conn = resolveConnection2(options2.connection);
|
|
14492
|
-
const
|
|
14572
|
+
const count6 = Number.parseInt(options2.count ?? "1000", 10);
|
|
14493
14573
|
const from = options2.from ? parseRelativeTime(options2.from) : void 0;
|
|
14494
14574
|
const to = options2.to ? parseRelativeTime(options2.to) : void 0;
|
|
14495
|
-
const events = from || to ? await fetchSeqData(conn, filter,
|
|
14575
|
+
const events = from || to ? await fetchSeqData(conn, filter, count6, from, to) : await fetchSeqEvents(
|
|
14496
14576
|
conn,
|
|
14497
|
-
new URLSearchParams({ filter, count: String(
|
|
14577
|
+
new URLSearchParams({ filter, count: String(count6) })
|
|
14498
14578
|
);
|
|
14499
14579
|
if (events.length === 0) {
|
|
14500
|
-
console.log(
|
|
14580
|
+
console.log(chalk144.yellow("No events found."));
|
|
14501
14581
|
return;
|
|
14502
14582
|
}
|
|
14503
14583
|
if (options2.json) {
|
|
@@ -14508,22 +14588,22 @@ async function seqQuery(filter, options2) {
|
|
|
14508
14588
|
for (const event of chronological) {
|
|
14509
14589
|
console.log(formatEvent(event));
|
|
14510
14590
|
}
|
|
14511
|
-
console.log(
|
|
14591
|
+
console.log(chalk144.dim(`
|
|
14512
14592
|
${events.length} events`));
|
|
14513
|
-
if (events.length >=
|
|
14593
|
+
if (events.length >= count6) {
|
|
14514
14594
|
console.log(
|
|
14515
|
-
|
|
14516
|
-
`Results limited to ${
|
|
14595
|
+
chalk144.yellow(
|
|
14596
|
+
`Results limited to ${count6}. Use --count to retrieve more.`
|
|
14517
14597
|
)
|
|
14518
14598
|
);
|
|
14519
14599
|
}
|
|
14520
14600
|
}
|
|
14521
14601
|
|
|
14522
14602
|
// src/shared/setNamedDefaultConnection.ts
|
|
14523
|
-
import
|
|
14603
|
+
import chalk145 from "chalk";
|
|
14524
14604
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
14525
14605
|
if (!connections.find((c) => c.name === name)) {
|
|
14526
|
-
console.error(
|
|
14606
|
+
console.error(chalk145.red(`Connection "${name}" not found.`));
|
|
14527
14607
|
process.exit(1);
|
|
14528
14608
|
}
|
|
14529
14609
|
setDefault(name);
|
|
@@ -14567,7 +14647,7 @@ function registerSignal(program2) {
|
|
|
14567
14647
|
}
|
|
14568
14648
|
|
|
14569
14649
|
// src/commands/sql/sqlAuth.ts
|
|
14570
|
-
import
|
|
14650
|
+
import chalk147 from "chalk";
|
|
14571
14651
|
|
|
14572
14652
|
// src/commands/sql/loadConnections.ts
|
|
14573
14653
|
function loadConnections3() {
|
|
@@ -14596,7 +14676,7 @@ function setDefaultConnection2(name) {
|
|
|
14596
14676
|
}
|
|
14597
14677
|
|
|
14598
14678
|
// src/commands/sql/promptConnection.ts
|
|
14599
|
-
import
|
|
14679
|
+
import chalk146 from "chalk";
|
|
14600
14680
|
async function promptConnection3(existingNames) {
|
|
14601
14681
|
const name = await promptInput("name", "Connection name:", "default");
|
|
14602
14682
|
assertUniqueName(existingNames, name);
|
|
@@ -14604,7 +14684,7 @@ async function promptConnection3(existingNames) {
|
|
|
14604
14684
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
14605
14685
|
const port = Number.parseInt(portStr, 10);
|
|
14606
14686
|
if (!Number.isFinite(port)) {
|
|
14607
|
-
console.error(
|
|
14687
|
+
console.error(chalk146.red(`Invalid port "${portStr}".`));
|
|
14608
14688
|
process.exit(1);
|
|
14609
14689
|
}
|
|
14610
14690
|
const user = await promptInput("user", "User:");
|
|
@@ -14617,13 +14697,13 @@ async function promptConnection3(existingNames) {
|
|
|
14617
14697
|
var sqlAuth = createConnectionAuth({
|
|
14618
14698
|
load: loadConnections3,
|
|
14619
14699
|
save: saveConnections3,
|
|
14620
|
-
format: (c) => `${
|
|
14700
|
+
format: (c) => `${chalk147.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
14621
14701
|
promptNew: promptConnection3,
|
|
14622
14702
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
14623
14703
|
});
|
|
14624
14704
|
|
|
14625
14705
|
// src/commands/sql/printTable.ts
|
|
14626
|
-
import
|
|
14706
|
+
import chalk148 from "chalk";
|
|
14627
14707
|
function formatCell(value) {
|
|
14628
14708
|
if (value === null || value === void 0) return "";
|
|
14629
14709
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -14632,7 +14712,7 @@ function formatCell(value) {
|
|
|
14632
14712
|
}
|
|
14633
14713
|
function printTable(rows) {
|
|
14634
14714
|
if (rows.length === 0) {
|
|
14635
|
-
console.log(
|
|
14715
|
+
console.log(chalk148.yellow("(no rows)"));
|
|
14636
14716
|
return;
|
|
14637
14717
|
}
|
|
14638
14718
|
const columns = Object.keys(rows[0]);
|
|
@@ -14640,13 +14720,13 @@ function printTable(rows) {
|
|
|
14640
14720
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
14641
14721
|
);
|
|
14642
14722
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
14643
|
-
console.log(
|
|
14644
|
-
console.log(
|
|
14723
|
+
console.log(chalk148.dim(header));
|
|
14724
|
+
console.log(chalk148.dim("-".repeat(header.length)));
|
|
14645
14725
|
for (const row of rows) {
|
|
14646
14726
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
14647
14727
|
console.log(line);
|
|
14648
14728
|
}
|
|
14649
|
-
console.log(
|
|
14729
|
+
console.log(chalk148.dim(`
|
|
14650
14730
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
14651
14731
|
}
|
|
14652
14732
|
|
|
@@ -14706,7 +14786,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
14706
14786
|
}
|
|
14707
14787
|
|
|
14708
14788
|
// src/commands/sql/sqlMutate.ts
|
|
14709
|
-
import
|
|
14789
|
+
import chalk149 from "chalk";
|
|
14710
14790
|
|
|
14711
14791
|
// src/commands/sql/isMutation.ts
|
|
14712
14792
|
var MUTATION_KEYWORDS = [
|
|
@@ -14740,7 +14820,7 @@ function isMutation(sql4) {
|
|
|
14740
14820
|
async function sqlMutate(query, connectionName) {
|
|
14741
14821
|
if (!isMutation(query)) {
|
|
14742
14822
|
console.error(
|
|
14743
|
-
|
|
14823
|
+
chalk149.red(
|
|
14744
14824
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
14745
14825
|
)
|
|
14746
14826
|
);
|
|
@@ -14750,18 +14830,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
14750
14830
|
const pool = await sqlConnect(conn);
|
|
14751
14831
|
try {
|
|
14752
14832
|
const result = await pool.request().query(query);
|
|
14753
|
-
console.log(
|
|
14833
|
+
console.log(chalk149.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
14754
14834
|
} finally {
|
|
14755
14835
|
await pool.close();
|
|
14756
14836
|
}
|
|
14757
14837
|
}
|
|
14758
14838
|
|
|
14759
14839
|
// src/commands/sql/sqlQuery.ts
|
|
14760
|
-
import
|
|
14840
|
+
import chalk150 from "chalk";
|
|
14761
14841
|
async function sqlQuery(query, connectionName) {
|
|
14762
14842
|
if (isMutation(query)) {
|
|
14763
14843
|
console.error(
|
|
14764
|
-
|
|
14844
|
+
chalk150.red(
|
|
14765
14845
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
14766
14846
|
)
|
|
14767
14847
|
);
|
|
@@ -14776,7 +14856,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
14776
14856
|
printTable(rows);
|
|
14777
14857
|
} else {
|
|
14778
14858
|
console.log(
|
|
14779
|
-
|
|
14859
|
+
chalk150.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
14780
14860
|
);
|
|
14781
14861
|
}
|
|
14782
14862
|
} finally {
|
|
@@ -15356,14 +15436,14 @@ import {
|
|
|
15356
15436
|
import { dirname as dirname22, join as join40 } from "path";
|
|
15357
15437
|
|
|
15358
15438
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
15359
|
-
import
|
|
15439
|
+
import chalk151 from "chalk";
|
|
15360
15440
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
15361
15441
|
function validateStagedContent(filename, content) {
|
|
15362
15442
|
const firstLine = content.split("\n")[0];
|
|
15363
15443
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
15364
15444
|
if (!match) {
|
|
15365
15445
|
console.error(
|
|
15366
|
-
|
|
15446
|
+
chalk151.red(
|
|
15367
15447
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
15368
15448
|
)
|
|
15369
15449
|
);
|
|
@@ -15372,7 +15452,7 @@ function validateStagedContent(filename, content) {
|
|
|
15372
15452
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
15373
15453
|
if (!contentAfterLink) {
|
|
15374
15454
|
console.error(
|
|
15375
|
-
|
|
15455
|
+
chalk151.red(
|
|
15376
15456
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
15377
15457
|
)
|
|
15378
15458
|
);
|
|
@@ -15548,13 +15628,13 @@ function logs(options2) {
|
|
|
15548
15628
|
console.log("No voice log file found");
|
|
15549
15629
|
return;
|
|
15550
15630
|
}
|
|
15551
|
-
const
|
|
15631
|
+
const count6 = Number.parseInt(options2.lines ?? "150", 10);
|
|
15552
15632
|
const content = readFileSync33(voicePaths.log, "utf-8").trim();
|
|
15553
15633
|
if (!content) {
|
|
15554
15634
|
console.log("Voice log is empty");
|
|
15555
15635
|
return;
|
|
15556
15636
|
}
|
|
15557
|
-
const lines = content.split("\n").slice(-
|
|
15637
|
+
const lines = content.split("\n").slice(-count6);
|
|
15558
15638
|
for (const line of lines) {
|
|
15559
15639
|
try {
|
|
15560
15640
|
const event = JSON.parse(line);
|
|
@@ -15701,10 +15781,10 @@ function isProcessAlive3(pid) {
|
|
|
15701
15781
|
return false;
|
|
15702
15782
|
}
|
|
15703
15783
|
}
|
|
15704
|
-
function readRecentLogs(
|
|
15784
|
+
function readRecentLogs(count6) {
|
|
15705
15785
|
if (!existsSync45(voicePaths.log)) return [];
|
|
15706
15786
|
const lines = readFileSync35(voicePaths.log, "utf-8").trim().split("\n");
|
|
15707
|
-
return lines.slice(-
|
|
15787
|
+
return lines.slice(-count6);
|
|
15708
15788
|
}
|
|
15709
15789
|
function status() {
|
|
15710
15790
|
if (!existsSync45(voicePaths.pid)) {
|
|
@@ -15768,7 +15848,7 @@ function registerVoice(program2) {
|
|
|
15768
15848
|
|
|
15769
15849
|
// src/commands/roam/auth.ts
|
|
15770
15850
|
import { randomBytes } from "crypto";
|
|
15771
|
-
import
|
|
15851
|
+
import chalk152 from "chalk";
|
|
15772
15852
|
|
|
15773
15853
|
// src/lib/openBrowser.ts
|
|
15774
15854
|
import { execSync as execSync44 } from "child_process";
|
|
@@ -15943,13 +16023,13 @@ async function auth() {
|
|
|
15943
16023
|
saveGlobalConfig(config);
|
|
15944
16024
|
const state = randomBytes(16).toString("hex");
|
|
15945
16025
|
console.log(
|
|
15946
|
-
|
|
16026
|
+
chalk152.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
15947
16027
|
);
|
|
15948
|
-
console.log(
|
|
15949
|
-
console.log(
|
|
15950
|
-
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..."));
|
|
15951
16031
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
15952
|
-
console.log(
|
|
16032
|
+
console.log(chalk152.dim("Exchanging code for tokens..."));
|
|
15953
16033
|
const tokens = await exchangeToken({
|
|
15954
16034
|
code,
|
|
15955
16035
|
clientId,
|
|
@@ -15965,7 +16045,7 @@ async function auth() {
|
|
|
15965
16045
|
};
|
|
15966
16046
|
saveGlobalConfig(config);
|
|
15967
16047
|
console.log(
|
|
15968
|
-
|
|
16048
|
+
chalk152.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
15969
16049
|
);
|
|
15970
16050
|
}
|
|
15971
16051
|
|
|
@@ -16388,7 +16468,7 @@ import { execSync as execSync46 } from "child_process";
|
|
|
16388
16468
|
import { existsSync as existsSync49, mkdirSync as mkdirSync17, unlinkSync as unlinkSync15, writeFileSync as writeFileSync30 } from "fs";
|
|
16389
16469
|
import { tmpdir as tmpdir7 } from "os";
|
|
16390
16470
|
import { join as join51, resolve as resolve13 } from "path";
|
|
16391
|
-
import
|
|
16471
|
+
import chalk153 from "chalk";
|
|
16392
16472
|
|
|
16393
16473
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
16394
16474
|
var captureWindowPs1 = `
|
|
@@ -16539,20 +16619,20 @@ function screenshot(processName) {
|
|
|
16539
16619
|
const config = loadConfig();
|
|
16540
16620
|
const outputDir = resolve13(config.screenshot.outputDir);
|
|
16541
16621
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
16542
|
-
console.log(
|
|
16622
|
+
console.log(chalk153.gray(`Capturing window for process "${processName}" ...`));
|
|
16543
16623
|
try {
|
|
16544
16624
|
runPowerShellScript(processName, outputPath);
|
|
16545
|
-
console.log(
|
|
16625
|
+
console.log(chalk153.green(`Screenshot saved: ${outputPath}`));
|
|
16546
16626
|
} catch (error) {
|
|
16547
16627
|
const msg = error instanceof Error ? error.message : String(error);
|
|
16548
|
-
console.error(
|
|
16628
|
+
console.error(chalk153.red(`Failed to capture screenshot: ${msg}`));
|
|
16549
16629
|
process.exit(1);
|
|
16550
16630
|
}
|
|
16551
16631
|
}
|
|
16552
16632
|
|
|
16553
16633
|
// src/commands/sessions/summarise/index.ts
|
|
16554
16634
|
import * as fs28 from "fs";
|
|
16555
|
-
import
|
|
16635
|
+
import chalk154 from "chalk";
|
|
16556
16636
|
|
|
16557
16637
|
// src/commands/sessions/summarise/shared.ts
|
|
16558
16638
|
import * as fs26 from "fs";
|
|
@@ -16679,22 +16759,22 @@ ${firstMessage}`);
|
|
|
16679
16759
|
async function summarise4(options2) {
|
|
16680
16760
|
const files = await discoverSessionJsonlPaths();
|
|
16681
16761
|
if (files.length === 0) {
|
|
16682
|
-
console.log(
|
|
16762
|
+
console.log(chalk154.yellow("No sessions found."));
|
|
16683
16763
|
return;
|
|
16684
16764
|
}
|
|
16685
16765
|
const toProcess = selectCandidates(files, options2);
|
|
16686
16766
|
if (toProcess.length === 0) {
|
|
16687
|
-
console.log(
|
|
16767
|
+
console.log(chalk154.green("All sessions already summarised."));
|
|
16688
16768
|
return;
|
|
16689
16769
|
}
|
|
16690
16770
|
console.log(
|
|
16691
|
-
|
|
16771
|
+
chalk154.cyan(
|
|
16692
16772
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
16693
16773
|
)
|
|
16694
16774
|
);
|
|
16695
16775
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
16696
16776
|
console.log(
|
|
16697
|
-
|
|
16777
|
+
chalk154.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk154.yellow(`, ${failed2} skipped`) : "")
|
|
16698
16778
|
);
|
|
16699
16779
|
}
|
|
16700
16780
|
function selectCandidates(files, options2) {
|
|
@@ -16714,16 +16794,16 @@ function processSessions(files) {
|
|
|
16714
16794
|
let failed2 = 0;
|
|
16715
16795
|
for (let i = 0; i < files.length; i++) {
|
|
16716
16796
|
const file = files[i];
|
|
16717
|
-
process.stdout.write(
|
|
16797
|
+
process.stdout.write(chalk154.dim(` [${i + 1}/${files.length}] `));
|
|
16718
16798
|
const summary = summariseSession(file);
|
|
16719
16799
|
if (summary) {
|
|
16720
16800
|
writeSummary(file, summary);
|
|
16721
16801
|
succeeded++;
|
|
16722
|
-
process.stdout.write(`${
|
|
16802
|
+
process.stdout.write(`${chalk154.green("\u2713")} ${summary}
|
|
16723
16803
|
`);
|
|
16724
16804
|
} else {
|
|
16725
16805
|
failed2++;
|
|
16726
|
-
process.stdout.write(` ${
|
|
16806
|
+
process.stdout.write(` ${chalk154.yellow("skip")}
|
|
16727
16807
|
`);
|
|
16728
16808
|
}
|
|
16729
16809
|
}
|
|
@@ -16738,10 +16818,10 @@ function registerSessions(program2) {
|
|
|
16738
16818
|
}
|
|
16739
16819
|
|
|
16740
16820
|
// src/commands/statusLine.ts
|
|
16741
|
-
import
|
|
16821
|
+
import chalk156 from "chalk";
|
|
16742
16822
|
|
|
16743
16823
|
// src/commands/buildLimitsSegment.ts
|
|
16744
|
-
import
|
|
16824
|
+
import chalk155 from "chalk";
|
|
16745
16825
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
16746
16826
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
16747
16827
|
function formatTimeLeft(resetsAt) {
|
|
@@ -16764,10 +16844,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
16764
16844
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
16765
16845
|
const label2 = `${Math.round(pct)}%`;
|
|
16766
16846
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
16767
|
-
if (projected == null) return
|
|
16768
|
-
if (projected > 100) return
|
|
16769
|
-
if (projected > 75) return
|
|
16770
|
-
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);
|
|
16771
16851
|
}
|
|
16772
16852
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
16773
16853
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -16793,14 +16873,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
16793
16873
|
}
|
|
16794
16874
|
|
|
16795
16875
|
// src/commands/statusLine.ts
|
|
16796
|
-
|
|
16876
|
+
chalk156.level = 3;
|
|
16797
16877
|
function formatNumber(num) {
|
|
16798
16878
|
return num.toLocaleString("en-US");
|
|
16799
16879
|
}
|
|
16800
16880
|
function colorizePercent(pct) {
|
|
16801
16881
|
const label2 = `${Math.round(pct)}%`;
|
|
16802
|
-
if (pct > 80) return
|
|
16803
|
-
if (pct > 40) return
|
|
16882
|
+
if (pct > 80) return chalk156.red(label2);
|
|
16883
|
+
if (pct > 40) return chalk156.yellow(label2);
|
|
16804
16884
|
return label2;
|
|
16805
16885
|
}
|
|
16806
16886
|
async function statusLine() {
|
|
@@ -16823,7 +16903,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
16823
16903
|
// src/commands/sync/syncClaudeMd.ts
|
|
16824
16904
|
import * as fs29 from "fs";
|
|
16825
16905
|
import * as path48 from "path";
|
|
16826
|
-
import
|
|
16906
|
+
import chalk157 from "chalk";
|
|
16827
16907
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
16828
16908
|
const source = path48.join(claudeDir, "CLAUDE.md");
|
|
16829
16909
|
const target = path48.join(targetBase, "CLAUDE.md");
|
|
@@ -16832,12 +16912,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
16832
16912
|
const targetContent = fs29.readFileSync(target, "utf-8");
|
|
16833
16913
|
if (sourceContent !== targetContent) {
|
|
16834
16914
|
console.log(
|
|
16835
|
-
|
|
16915
|
+
chalk157.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
16836
16916
|
);
|
|
16837
16917
|
console.log();
|
|
16838
16918
|
printDiff(targetContent, sourceContent);
|
|
16839
16919
|
const confirm = options2?.yes || await promptConfirm(
|
|
16840
|
-
|
|
16920
|
+
chalk157.red("Overwrite existing CLAUDE.md?"),
|
|
16841
16921
|
false
|
|
16842
16922
|
);
|
|
16843
16923
|
if (!confirm) {
|
|
@@ -16853,7 +16933,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
16853
16933
|
// src/commands/sync/syncSettings.ts
|
|
16854
16934
|
import * as fs30 from "fs";
|
|
16855
16935
|
import * as path49 from "path";
|
|
16856
|
-
import
|
|
16936
|
+
import chalk158 from "chalk";
|
|
16857
16937
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
16858
16938
|
const source = path49.join(claudeDir, "settings.json");
|
|
16859
16939
|
const target = path49.join(targetBase, "settings.json");
|
|
@@ -16869,14 +16949,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
16869
16949
|
if (mergedContent !== normalizedTarget) {
|
|
16870
16950
|
if (!options2?.yes) {
|
|
16871
16951
|
console.log(
|
|
16872
|
-
|
|
16952
|
+
chalk158.yellow(
|
|
16873
16953
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
16874
16954
|
)
|
|
16875
16955
|
);
|
|
16876
16956
|
console.log();
|
|
16877
16957
|
printDiff(targetContent, mergedContent);
|
|
16878
16958
|
const confirm = await promptConfirm(
|
|
16879
|
-
|
|
16959
|
+
chalk158.red("Overwrite existing settings.json?"),
|
|
16880
16960
|
false
|
|
16881
16961
|
);
|
|
16882
16962
|
if (!confirm) {
|