@staff0rd/assist 0.337.2 → 0.339.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 +3 -4
- package/allowed.cli-reads +1 -0
- package/allowed.cli-writes +0 -2
- package/claude/commands/transcripts.md +49 -0
- package/claude/settings.json +2 -4
- package/dist/allowed.cli-reads +1 -0
- package/dist/allowed.cli-writes +0 -2
- package/dist/commands/sessions/web/bundle.js +93 -93
- package/dist/index.js +264 -550
- package/package.json +1 -1
- package/claude/commands/transcript-format.md +0 -7
- package/claude/commands/transcript-summarise.md +0 -3
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.339.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -2825,13 +2825,13 @@ async function activity(options2) {
|
|
|
2825
2825
|
const activeDays = data.filter((d) => d.count > 0).length;
|
|
2826
2826
|
console.log(`${total} commits across ${activeDays} active days.`);
|
|
2827
2827
|
const weekly = /* @__PURE__ */ new Map();
|
|
2828
|
-
for (const { date, count:
|
|
2828
|
+
for (const { date, count: count7 } of data) {
|
|
2829
2829
|
const d = new Date(date);
|
|
2830
2830
|
d.setDate(d.getDate() - d.getDay());
|
|
2831
2831
|
const weekStart = d.toISOString().slice(0, 10);
|
|
2832
|
-
weekly.set(weekStart, (weekly.get(weekStart) ?? 0) +
|
|
2832
|
+
weekly.set(weekStart, (weekly.get(weekStart) ?? 0) + count7);
|
|
2833
2833
|
}
|
|
2834
|
-
const weeklyData = [...weekly.entries()].map(([date,
|
|
2834
|
+
const weeklyData = [...weekly.entries()].map(([date, count7]) => ({ date, count: count7 })).sort((a, b) => a.date.localeCompare(b.date));
|
|
2835
2835
|
const until = data[data.length - 1].date;
|
|
2836
2836
|
activityChart(weeklyData, { since, until });
|
|
2837
2837
|
}
|
|
@@ -6206,19 +6206,36 @@ async function listNewsItems(_req, res) {
|
|
|
6206
6206
|
}
|
|
6207
6207
|
|
|
6208
6208
|
// src/shared/db/listUsagePeaks.ts
|
|
6209
|
-
import { desc as desc2 } from "drizzle-orm";
|
|
6210
|
-
async function listUsagePeaks(db) {
|
|
6211
|
-
|
|
6209
|
+
import { count, desc as desc2 } from "drizzle-orm";
|
|
6210
|
+
async function listUsagePeaks(db, paging) {
|
|
6211
|
+
const query = db.select().from(usagePeaks).orderBy(
|
|
6212
6212
|
desc2(usagePeaks.resetsAt),
|
|
6213
6213
|
usagePeaks.window,
|
|
6214
6214
|
desc2(usagePeaks.createdAt),
|
|
6215
6215
|
desc2(usagePeaks.segment)
|
|
6216
6216
|
);
|
|
6217
|
+
if (paging) {
|
|
6218
|
+
return query.limit(paging.limit).offset(paging.offset);
|
|
6219
|
+
}
|
|
6220
|
+
return query;
|
|
6221
|
+
}
|
|
6222
|
+
async function countUsagePeaks(db) {
|
|
6223
|
+
const [row] = await db.select({ value: count() }).from(usagePeaks);
|
|
6224
|
+
return row?.value ?? 0;
|
|
6217
6225
|
}
|
|
6218
6226
|
|
|
6219
6227
|
// src/commands/sessions/web/listUsageHistory.ts
|
|
6220
|
-
|
|
6221
|
-
|
|
6228
|
+
var DEFAULT_PAGE_SIZE = 30;
|
|
6229
|
+
async function listUsageHistory(req, res) {
|
|
6230
|
+
const params = new URL(req.url ?? "/", "http://localhost").searchParams;
|
|
6231
|
+
const page = Math.max(0, Number(params.get("page")) || 0);
|
|
6232
|
+
const pageSize = Number(params.get("pageSize")) || DEFAULT_PAGE_SIZE;
|
|
6233
|
+
const db = await getDb();
|
|
6234
|
+
const [rows, total] = await Promise.all([
|
|
6235
|
+
listUsagePeaks(db, { limit: pageSize, offset: page * pageSize }),
|
|
6236
|
+
countUsagePeaks(db)
|
|
6237
|
+
]);
|
|
6238
|
+
respondJson(res, 200, { rows, total });
|
|
6222
6239
|
}
|
|
6223
6240
|
|
|
6224
6241
|
// src/commands/sessions/web/openInCode.ts
|
|
@@ -7292,7 +7309,7 @@ async function add(options2) {
|
|
|
7292
7309
|
import chalk65 from "chalk";
|
|
7293
7310
|
|
|
7294
7311
|
// src/commands/backlog/insertPhaseAt.ts
|
|
7295
|
-
import { count, eq as eq19 } from "drizzle-orm";
|
|
7312
|
+
import { count as count2, eq as eq19 } from "drizzle-orm";
|
|
7296
7313
|
|
|
7297
7314
|
// src/commands/backlog/shiftPhasesUp.ts
|
|
7298
7315
|
import { and as and5, desc as desc3, eq as eq18, gte } from "drizzle-orm";
|
|
@@ -7307,7 +7324,7 @@ async function shiftPhasesUp(db, itemId, fromIdx) {
|
|
|
7307
7324
|
// src/commands/backlog/insertPhaseAt.ts
|
|
7308
7325
|
async function insertPhaseAt(orm, itemId, phaseIdx, name, tasks, manualChecks, currentPhase) {
|
|
7309
7326
|
await orm.transaction(async (tx) => {
|
|
7310
|
-
const [row] = await tx.select({ cnt:
|
|
7327
|
+
const [row] = await tx.select({ cnt: count2() }).from(planPhases).where(eq19(planPhases.itemId, itemId));
|
|
7311
7328
|
const phaseCount = row?.cnt ?? 0;
|
|
7312
7329
|
await shiftPhasesUp(tx, itemId, phaseIdx);
|
|
7313
7330
|
await tx.insert(planPhases).values({ itemId, idx: phaseIdx, name, manualChecks });
|
|
@@ -7323,9 +7340,9 @@ async function insertPhaseAt(orm, itemId, phaseIdx, name, tasks, manualChecks, c
|
|
|
7323
7340
|
|
|
7324
7341
|
// src/commands/backlog/resolveInsertPosition.ts
|
|
7325
7342
|
import chalk64 from "chalk";
|
|
7326
|
-
import { count as
|
|
7343
|
+
import { count as count3, eq as eq20 } from "drizzle-orm";
|
|
7327
7344
|
async function resolveInsertPosition(orm, itemId, position) {
|
|
7328
|
-
const [row] = await orm.select({ cnt:
|
|
7345
|
+
const [row] = await orm.select({ cnt: count3() }).from(planPhases).where(eq20(planPhases.itemId, itemId));
|
|
7329
7346
|
const phaseCount = row?.cnt ?? 0;
|
|
7330
7347
|
if (position === void 0) return phaseCount;
|
|
7331
7348
|
const pos = Number.parseInt(position, 10);
|
|
@@ -7600,9 +7617,9 @@ async function confirmMove(cnt, oldOrigin, newOrigin) {
|
|
|
7600
7617
|
}
|
|
7601
7618
|
|
|
7602
7619
|
// src/commands/backlog/move-repo/countByOrigin.ts
|
|
7603
|
-
import { count as
|
|
7620
|
+
import { count as count4, eq as eq23 } from "drizzle-orm";
|
|
7604
7621
|
async function countByOrigin(orm, origin) {
|
|
7605
|
-
const [{ cnt }] = await orm.select({ cnt:
|
|
7622
|
+
const [{ cnt }] = await orm.select({ cnt: count4() }).from(items).where(eq23(items.origin, origin));
|
|
7606
7623
|
return cnt;
|
|
7607
7624
|
}
|
|
7608
7625
|
|
|
@@ -8038,14 +8055,14 @@ import { and as and10, eq as eq28 } from "drizzle-orm";
|
|
|
8038
8055
|
|
|
8039
8056
|
// src/commands/backlog/findPhase.ts
|
|
8040
8057
|
import chalk85 from "chalk";
|
|
8041
|
-
import { and as and8, count as
|
|
8058
|
+
import { and as and8, count as count5, eq as eq26 } from "drizzle-orm";
|
|
8042
8059
|
async function findPhase(id2, phase) {
|
|
8043
8060
|
const found = await findOneItem(id2);
|
|
8044
8061
|
if (!found) return void 0;
|
|
8045
8062
|
const { orm, item } = found;
|
|
8046
8063
|
const itemId = item.id;
|
|
8047
8064
|
const phaseIdx = Number.parseInt(phase, 10) - 1;
|
|
8048
|
-
const [row] = await orm.select({ cnt:
|
|
8065
|
+
const [row] = await orm.select({ cnt: count5() }).from(planPhases).where(and8(eq26(planPhases.itemId, itemId), eq26(planPhases.idx, phaseIdx)));
|
|
8049
8066
|
if (!row || row.cnt === 0) {
|
|
8050
8067
|
console.log(
|
|
8051
8068
|
chalk85.red(`Phase ${phaseIdx + 1} not found on item #${itemId}.`)
|
|
@@ -8057,7 +8074,7 @@ async function findPhase(id2, phase) {
|
|
|
8057
8074
|
}
|
|
8058
8075
|
|
|
8059
8076
|
// src/commands/backlog/reindexPhases.ts
|
|
8060
|
-
import { and as and9, asc as asc6, count as
|
|
8077
|
+
import { and as and9, asc as asc6, count as count6, eq as eq27 } from "drizzle-orm";
|
|
8061
8078
|
async function reindexPhases(db, itemId) {
|
|
8062
8079
|
const remaining = await db.select({ idx: planPhases.idx }).from(planPhases).where(eq27(planPhases.itemId, itemId)).orderBy(asc6(planPhases.idx));
|
|
8063
8080
|
for (let i = 0; i < remaining.length; i++) {
|
|
@@ -8076,7 +8093,7 @@ async function adjustCurrentPhase(db, item, removedIdx) {
|
|
|
8076
8093
|
return;
|
|
8077
8094
|
}
|
|
8078
8095
|
if (removedIdx !== currentIdx) return;
|
|
8079
|
-
const [row] = await db.select({ cnt:
|
|
8096
|
+
const [row] = await db.select({ cnt: count6() }).from(planPhases).where(eq27(planPhases.itemId, item.id));
|
|
8080
8097
|
const cnt = row?.cnt ?? 0;
|
|
8081
8098
|
await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(eq27(items.id, item.id));
|
|
8082
8099
|
}
|
|
@@ -8844,9 +8861,9 @@ function parsePerms(entries) {
|
|
|
8844
8861
|
const tool = m[1];
|
|
8845
8862
|
const command = normCmd(m[2]);
|
|
8846
8863
|
const wildcard = m[3] !== void 0;
|
|
8847
|
-
const
|
|
8848
|
-
|
|
8849
|
-
map.set(tool,
|
|
8864
|
+
const list5 = map.get(tool) ?? [];
|
|
8865
|
+
list5.push({ command, wildcard });
|
|
8866
|
+
map.set(tool, list5);
|
|
8850
8867
|
}
|
|
8851
8868
|
}
|
|
8852
8869
|
return map;
|
|
@@ -9878,7 +9895,7 @@ function calculateHalstead(node) {
|
|
|
9878
9895
|
// src/commands/complexity/shared/countSloc.ts
|
|
9879
9896
|
function countSloc(content) {
|
|
9880
9897
|
let inMultiLineComment = false;
|
|
9881
|
-
let
|
|
9898
|
+
let count7 = 0;
|
|
9882
9899
|
for (const line of content.split("\n")) {
|
|
9883
9900
|
const trimmed = line.trim();
|
|
9884
9901
|
if (inMultiLineComment) {
|
|
@@ -9886,7 +9903,7 @@ function countSloc(content) {
|
|
|
9886
9903
|
inMultiLineComment = false;
|
|
9887
9904
|
const afterComment = trimmed.substring(trimmed.indexOf("*/") + 2);
|
|
9888
9905
|
if (afterComment.trim().length > 0) {
|
|
9889
|
-
|
|
9906
|
+
count7++;
|
|
9890
9907
|
}
|
|
9891
9908
|
}
|
|
9892
9909
|
continue;
|
|
@@ -9898,7 +9915,7 @@ function countSloc(content) {
|
|
|
9898
9915
|
if (trimmed.includes("*/")) {
|
|
9899
9916
|
const afterComment = trimmed.substring(trimmed.indexOf("*/") + 2);
|
|
9900
9917
|
if (afterComment.trim().length > 0) {
|
|
9901
|
-
|
|
9918
|
+
count7++;
|
|
9902
9919
|
}
|
|
9903
9920
|
} else {
|
|
9904
9921
|
inMultiLineComment = true;
|
|
@@ -9906,10 +9923,10 @@ function countSloc(content) {
|
|
|
9906
9923
|
continue;
|
|
9907
9924
|
}
|
|
9908
9925
|
if (trimmed.length > 0) {
|
|
9909
|
-
|
|
9926
|
+
count7++;
|
|
9910
9927
|
}
|
|
9911
9928
|
}
|
|
9912
|
-
return
|
|
9929
|
+
return count7;
|
|
9913
9930
|
}
|
|
9914
9931
|
|
|
9915
9932
|
// src/commands/complexity/shared/index.ts
|
|
@@ -12084,9 +12101,9 @@ function resolveLoadOptions(options2) {
|
|
|
12084
12101
|
}
|
|
12085
12102
|
|
|
12086
12103
|
// src/commands/handover/load.ts
|
|
12087
|
-
function advisory(
|
|
12088
|
-
const noun =
|
|
12089
|
-
return `${
|
|
12104
|
+
function advisory(count7) {
|
|
12105
|
+
const noun = count7 === 1 ? "handover" : "handovers";
|
|
12106
|
+
return `${count7} unrecalled ${noun} for this repo. Run /recall to load.`;
|
|
12090
12107
|
}
|
|
12091
12108
|
function emit2(message) {
|
|
12092
12109
|
const json = JSON.stringify({
|
|
@@ -12103,9 +12120,9 @@ async function load2(options2 = {}) {
|
|
|
12103
12120
|
const origin = getCurrentOrigin(cwd);
|
|
12104
12121
|
const orm = options2.orm ?? await getDb();
|
|
12105
12122
|
await migrateDiskHandovers(orm, origin, cwd);
|
|
12106
|
-
const
|
|
12107
|
-
if (
|
|
12108
|
-
return emit2(advisory(
|
|
12123
|
+
const count7 = await countPendingHandovers(orm, origin);
|
|
12124
|
+
if (count7 === 0) return null;
|
|
12125
|
+
return emit2(advisory(count7));
|
|
12109
12126
|
}
|
|
12110
12127
|
|
|
12111
12128
|
// src/commands/handover/listPendingHandovers.ts
|
|
@@ -12739,14 +12756,14 @@ async function netcap(options2) {
|
|
|
12739
12756
|
const filter = options2.filter ?? "";
|
|
12740
12757
|
await mkdir3(dirname21(outPath), { recursive: true });
|
|
12741
12758
|
const extensionPath = await prepareExtensionForLoad(port, filter);
|
|
12742
|
-
let
|
|
12759
|
+
let count7 = 0;
|
|
12743
12760
|
const handler = createNetcapHandler({
|
|
12744
12761
|
outPath,
|
|
12745
12762
|
onPing: () => console.log(chalk134.dim("ping from extension")),
|
|
12746
12763
|
onCapture: (entry) => {
|
|
12747
|
-
|
|
12764
|
+
count7 += 1;
|
|
12748
12765
|
console.log(
|
|
12749
|
-
chalk134.green(`captured #${
|
|
12766
|
+
chalk134.green(`captured #${count7}`),
|
|
12750
12767
|
chalk134.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
12751
12768
|
);
|
|
12752
12769
|
}
|
|
@@ -12767,7 +12784,7 @@ async function netcap(options2) {
|
|
|
12767
12784
|
console.log(
|
|
12768
12785
|
chalk134.bold(
|
|
12769
12786
|
`
|
|
12770
|
-
netcap stopped \u2014 captured ${
|
|
12787
|
+
netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
12771
12788
|
)
|
|
12772
12789
|
);
|
|
12773
12790
|
process.exit(0);
|
|
@@ -13303,11 +13320,11 @@ function printPromptsTable(rows) {
|
|
|
13303
13320
|
console.log(chalk137.dim(header));
|
|
13304
13321
|
console.log(chalk137.dim("-".repeat(header.length)));
|
|
13305
13322
|
for (const row of rows) {
|
|
13306
|
-
const
|
|
13323
|
+
const count7 = String(row.count).padStart(countWidth);
|
|
13307
13324
|
const tool = row.tool.padEnd(toolWidth);
|
|
13308
13325
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
13309
13326
|
console.log(
|
|
13310
|
-
`${chalk137.yellow(
|
|
13327
|
+
`${chalk137.yellow(count7)} ${tool} ${command} ${chalk137.dim(row.repos)}`
|
|
13311
13328
|
);
|
|
13312
13329
|
}
|
|
13313
13330
|
}
|
|
@@ -14034,8 +14051,8 @@ async function promptNavigation(currentPage, totalPages) {
|
|
|
14034
14051
|
});
|
|
14035
14052
|
return parseAction(action);
|
|
14036
14053
|
}
|
|
14037
|
-
function computeTotalPages(
|
|
14038
|
-
return Math.ceil(
|
|
14054
|
+
function computeTotalPages(count7) {
|
|
14055
|
+
return Math.ceil(count7 / PAGE_SIZE);
|
|
14039
14056
|
}
|
|
14040
14057
|
async function navigateAndDisplay(pullRequests, totalPages, currentPage) {
|
|
14041
14058
|
const delta = await promptNavigation(currentPage, totalPages);
|
|
@@ -14289,12 +14306,12 @@ import chalk145 from "chalk";
|
|
|
14289
14306
|
|
|
14290
14307
|
// src/shared/createConnectionAuth.ts
|
|
14291
14308
|
import chalk140 from "chalk";
|
|
14292
|
-
function listConnections(connections,
|
|
14309
|
+
function listConnections(connections, format) {
|
|
14293
14310
|
if (connections.length === 0) {
|
|
14294
14311
|
console.log("No connections configured.");
|
|
14295
14312
|
} else {
|
|
14296
14313
|
for (const c of connections) {
|
|
14297
|
-
console.log(
|
|
14314
|
+
console.log(format(c));
|
|
14298
14315
|
}
|
|
14299
14316
|
}
|
|
14300
14317
|
}
|
|
@@ -14923,16 +14940,16 @@ import {
|
|
|
14923
14940
|
} from "ts-morph";
|
|
14924
14941
|
var suppressionPattern = /^\s*(\/\/|\/\*)\s*oxlint-disable\b/;
|
|
14925
14942
|
function countLeadingSuppressions(sourceFile) {
|
|
14926
|
-
let
|
|
14943
|
+
let count7 = 0;
|
|
14927
14944
|
for (const stmt of sourceFile.getStatementsWithComments()) {
|
|
14928
14945
|
const kind = stmt.getKind();
|
|
14929
14946
|
if ((kind === SyntaxKind2.SingleLineCommentTrivia || kind === SyntaxKind2.MultiLineCommentTrivia) && suppressionPattern.test(stmt.getText())) {
|
|
14930
|
-
|
|
14947
|
+
count7++;
|
|
14931
14948
|
} else {
|
|
14932
14949
|
break;
|
|
14933
14950
|
}
|
|
14934
14951
|
}
|
|
14935
|
-
return
|
|
14952
|
+
return count7;
|
|
14936
14953
|
}
|
|
14937
14954
|
function addImportPreservingSuppressions(sourceFile, structure) {
|
|
14938
14955
|
if (sourceFile.getImportDeclarations().length > 0) {
|
|
@@ -15670,9 +15687,9 @@ import path36 from "path";
|
|
|
15670
15687
|
// src/commands/refactor/restructure/computeRewrites/applyRewrites.ts
|
|
15671
15688
|
import fs24 from "fs";
|
|
15672
15689
|
function getOrCreateList(map, key) {
|
|
15673
|
-
const
|
|
15674
|
-
if (!map.has(key)) map.set(key,
|
|
15675
|
-
return
|
|
15690
|
+
const list5 = map.get(key) ?? [];
|
|
15691
|
+
if (!map.has(key)) map.set(key, list5);
|
|
15692
|
+
return list5;
|
|
15676
15693
|
}
|
|
15677
15694
|
function groupByFile2(rewrites) {
|
|
15678
15695
|
const grouped = /* @__PURE__ */ new Map();
|
|
@@ -15704,7 +15721,7 @@ function applyRewrites(rewrites) {
|
|
|
15704
15721
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
15705
15722
|
function buildMoveMap(moves) {
|
|
15706
15723
|
const map = /* @__PURE__ */ new Map();
|
|
15707
|
-
for (const
|
|
15724
|
+
for (const move2 of moves) map.set(move2.from, move2.to);
|
|
15708
15725
|
return map;
|
|
15709
15726
|
}
|
|
15710
15727
|
function stripTrailingIndex(specifier) {
|
|
@@ -15854,8 +15871,8 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
15854
15871
|
...graph.imports.keys(),
|
|
15855
15872
|
sourcePath
|
|
15856
15873
|
]);
|
|
15857
|
-
const
|
|
15858
|
-
return computeRewrites([
|
|
15874
|
+
const move2 = { from: sourcePath, to: destPath, reason: "rename" };
|
|
15875
|
+
return computeRewrites([move2], graph.edges, allProjectFiles);
|
|
15859
15876
|
}
|
|
15860
15877
|
|
|
15861
15878
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
@@ -16035,8 +16052,8 @@ function findRootParent(file, importedBy, visited) {
|
|
|
16035
16052
|
function clusterFiles(graph) {
|
|
16036
16053
|
const clusters = /* @__PURE__ */ new Map();
|
|
16037
16054
|
for (const file of graph.files) {
|
|
16038
|
-
const
|
|
16039
|
-
if (
|
|
16055
|
+
const basename11 = path43.basename(file, path43.extname(file));
|
|
16056
|
+
if (basename11 === "index") continue;
|
|
16040
16057
|
const importers = graph.importedBy.get(file);
|
|
16041
16058
|
if (!importers || importers.size !== 1) continue;
|
|
16042
16059
|
const parent = [...importers][0];
|
|
@@ -16064,11 +16081,11 @@ function relPath(filePath) {
|
|
|
16064
16081
|
function displayMoves(plan2) {
|
|
16065
16082
|
if (plan2.moves.length === 0) return;
|
|
16066
16083
|
console.log(chalk161.bold("\nFile moves:"));
|
|
16067
|
-
for (const
|
|
16084
|
+
for (const move2 of plan2.moves) {
|
|
16068
16085
|
console.log(
|
|
16069
|
-
` ${chalk161.red(relPath(
|
|
16086
|
+
` ${chalk161.red(relPath(move2.from))} \u2192 ${chalk161.green(relPath(move2.to))}`
|
|
16070
16087
|
);
|
|
16071
|
-
console.log(chalk161.dim(` ${
|
|
16088
|
+
console.log(chalk161.dim(` ${move2.reason}`));
|
|
16072
16089
|
}
|
|
16073
16090
|
}
|
|
16074
16091
|
function displayRewrites(rewrites) {
|
|
@@ -16123,15 +16140,15 @@ function executePlan(plan2) {
|
|
|
16123
16140
|
fs27.mkdirSync(dir, { recursive: true });
|
|
16124
16141
|
console.log(chalk162.green(` Created ${path45.relative(process.cwd(), dir)}/`));
|
|
16125
16142
|
}
|
|
16126
|
-
for (const
|
|
16127
|
-
const targetDir = path45.dirname(
|
|
16143
|
+
for (const move2 of plan2.moves) {
|
|
16144
|
+
const targetDir = path45.dirname(move2.to);
|
|
16128
16145
|
if (!fs27.existsSync(targetDir)) {
|
|
16129
16146
|
fs27.mkdirSync(targetDir, { recursive: true });
|
|
16130
16147
|
}
|
|
16131
|
-
fs27.renameSync(
|
|
16148
|
+
fs27.renameSync(move2.from, move2.to);
|
|
16132
16149
|
console.log(
|
|
16133
16150
|
chalk162.white(
|
|
16134
|
-
` Moved ${path45.relative(process.cwd(),
|
|
16151
|
+
` Moved ${path45.relative(process.cwd(), move2.from)} \u2192 ${path45.relative(process.cwd(), move2.to)}`
|
|
16135
16152
|
)
|
|
16136
16153
|
);
|
|
16137
16154
|
}
|
|
@@ -16909,9 +16926,9 @@ function warnUnlocated(unlocated) {
|
|
|
16909
16926
|
}
|
|
16910
16927
|
|
|
16911
16928
|
// src/commands/review/postReviewToPr.ts
|
|
16912
|
-
async function confirmPost(prNumber,
|
|
16929
|
+
async function confirmPost(prNumber, count7, options2) {
|
|
16913
16930
|
if (!options2.prompt) return true;
|
|
16914
|
-
return promptConfirm(`Post ${
|
|
16931
|
+
return promptConfirm(`Post ${count7} comment(s) to PR #${prNumber}?`, false);
|
|
16915
16932
|
}
|
|
16916
16933
|
async function postReviewToPr(synthesisPath, options2) {
|
|
16917
16934
|
const prInfo = fetchPrDiffInfo();
|
|
@@ -17958,9 +17975,9 @@ async function runReviewPipeline(paths, options2) {
|
|
|
17958
17975
|
}
|
|
17959
17976
|
|
|
17960
17977
|
// src/commands/review/reviewPr.ts
|
|
17961
|
-
function logPriorComments(
|
|
17962
|
-
if (
|
|
17963
|
-
console.log(`Including ${
|
|
17978
|
+
function logPriorComments(count7) {
|
|
17979
|
+
if (count7 === 0) return;
|
|
17980
|
+
console.log(`Including ${count7} prior review comment(s) in request.md.`);
|
|
17964
17981
|
}
|
|
17965
17982
|
function gatherChangedContext() {
|
|
17966
17983
|
const context = gatherContext();
|
|
@@ -18156,16 +18173,16 @@ function filterToSql(filter) {
|
|
|
18156
18173
|
}
|
|
18157
18174
|
|
|
18158
18175
|
// src/commands/seq/fetchSeqData.ts
|
|
18159
|
-
function buildDataParams(filter,
|
|
18176
|
+
function buildDataParams(filter, count7, from, to) {
|
|
18160
18177
|
const sqlFilter = filterToSql(filter);
|
|
18161
|
-
const sql6 = `select @Timestamp, @Level, @Exception, @Message from stream where ${sqlFilter} order by @Timestamp desc limit ${
|
|
18178
|
+
const sql6 = `select @Timestamp, @Level, @Exception, @Message from stream where ${sqlFilter} order by @Timestamp desc limit ${count7}`;
|
|
18162
18179
|
const params = new URLSearchParams({ q: sql6 });
|
|
18163
18180
|
if (from) params.set("rangeStartUtc", from);
|
|
18164
18181
|
if (to) params.set("rangeEndUtc", to);
|
|
18165
18182
|
return params;
|
|
18166
18183
|
}
|
|
18167
|
-
async function fetchSeqData(conn, filter,
|
|
18168
|
-
const params = buildDataParams(filter,
|
|
18184
|
+
async function fetchSeqData(conn, filter, count7, from, to) {
|
|
18185
|
+
const params = buildDataParams(filter, count7, from, to);
|
|
18169
18186
|
const response = await fetchSeq(conn, "/api/data", params);
|
|
18170
18187
|
const data = await response.json();
|
|
18171
18188
|
return mapDataToEvents(data);
|
|
@@ -18332,12 +18349,12 @@ function resolveConnection2(name) {
|
|
|
18332
18349
|
async function seqQuery(filter, options2) {
|
|
18333
18350
|
rejectTimestampFilter(filter);
|
|
18334
18351
|
const conn = resolveConnection2(options2.connection);
|
|
18335
|
-
const
|
|
18352
|
+
const count7 = Number.parseInt(options2.count ?? "1000", 10);
|
|
18336
18353
|
const from = options2.from ? parseRelativeTime(options2.from) : void 0;
|
|
18337
18354
|
const to = options2.to ? parseRelativeTime(options2.to) : void 0;
|
|
18338
|
-
const events = from || to ? await fetchSeqData(conn, filter,
|
|
18355
|
+
const events = from || to ? await fetchSeqData(conn, filter, count7, from, to) : await fetchSeqEvents(
|
|
18339
18356
|
conn,
|
|
18340
|
-
new URLSearchParams({ filter, count: String(
|
|
18357
|
+
new URLSearchParams({ filter, count: String(count7) })
|
|
18341
18358
|
);
|
|
18342
18359
|
if (events.length === 0) {
|
|
18343
18360
|
console.log(chalk171.yellow("No events found."));
|
|
@@ -18353,10 +18370,10 @@ async function seqQuery(filter, options2) {
|
|
|
18353
18370
|
}
|
|
18354
18371
|
console.log(chalk171.dim(`
|
|
18355
18372
|
${events.length} events`));
|
|
18356
|
-
if (events.length >=
|
|
18373
|
+
if (events.length >= count7) {
|
|
18357
18374
|
console.log(
|
|
18358
18375
|
chalk171.yellow(
|
|
18359
|
-
`Results limited to ${
|
|
18376
|
+
`Results limited to ${count7}. Use --count to retrieve more.`
|
|
18360
18377
|
)
|
|
18361
18378
|
);
|
|
18362
18379
|
}
|
|
@@ -18683,50 +18700,7 @@ function registerSql(program2) {
|
|
|
18683
18700
|
}
|
|
18684
18701
|
|
|
18685
18702
|
// src/commands/transcript/shared.ts
|
|
18686
|
-
import { existsSync as existsSync41, readdirSync as readdirSync8, statSync as statSync6 } from "fs";
|
|
18687
|
-
import { basename as basename8, join as join48, relative as relative2 } from "path";
|
|
18688
18703
|
import * as readline2 from "readline";
|
|
18689
|
-
var DATE_PREFIX_REGEX = /^\d{4}-\d{2}-\d{2}/;
|
|
18690
|
-
function getDatePrefix(daysOffset = 0) {
|
|
18691
|
-
const date = /* @__PURE__ */ new Date();
|
|
18692
|
-
date.setDate(date.getDate() + daysOffset);
|
|
18693
|
-
const year = date.getFullYear();
|
|
18694
|
-
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
18695
|
-
const day = String(date.getDate()).padStart(2, "0");
|
|
18696
|
-
return `${year}-${month}-${day}`;
|
|
18697
|
-
}
|
|
18698
|
-
function isValidDatePrefix(filename) {
|
|
18699
|
-
return DATE_PREFIX_REGEX.test(filename);
|
|
18700
|
-
}
|
|
18701
|
-
function collectFiles(dir, extension) {
|
|
18702
|
-
if (!existsSync41(dir)) return [];
|
|
18703
|
-
const results = [];
|
|
18704
|
-
for (const entry of readdirSync8(dir)) {
|
|
18705
|
-
const fullPath = join48(dir, entry);
|
|
18706
|
-
if (statSync6(fullPath).isDirectory()) {
|
|
18707
|
-
results.push(...collectFiles(fullPath, extension));
|
|
18708
|
-
} else if (entry.endsWith(extension)) {
|
|
18709
|
-
results.push(fullPath);
|
|
18710
|
-
}
|
|
18711
|
-
}
|
|
18712
|
-
return results;
|
|
18713
|
-
}
|
|
18714
|
-
function toFileInfo(baseDir, fullPath) {
|
|
18715
|
-
return {
|
|
18716
|
-
absolutePath: fullPath,
|
|
18717
|
-
relativePath: relative2(baseDir, fullPath),
|
|
18718
|
-
filename: basename8(fullPath)
|
|
18719
|
-
};
|
|
18720
|
-
}
|
|
18721
|
-
function findVttFilesRecursive(dir, baseDir = dir) {
|
|
18722
|
-
return collectFiles(dir, ".vtt").map((f) => toFileInfo(baseDir, f));
|
|
18723
|
-
}
|
|
18724
|
-
function findMdFilesRecursive(dir, baseDir = dir) {
|
|
18725
|
-
return collectFiles(dir, ".md").map((f) => toFileInfo(baseDir, f));
|
|
18726
|
-
}
|
|
18727
|
-
function getTranscriptBaseName(transcriptFile) {
|
|
18728
|
-
return basename8(transcriptFile, ".md").replace(/ Transcription$/, "");
|
|
18729
|
-
}
|
|
18730
18704
|
function createReadlineInterface() {
|
|
18731
18705
|
return readline2.createInterface({
|
|
18732
18706
|
input: process.stdin,
|
|
@@ -18795,83 +18769,28 @@ async function configure() {
|
|
|
18795
18769
|
}
|
|
18796
18770
|
}
|
|
18797
18771
|
|
|
18798
|
-
// src/commands/transcript/
|
|
18799
|
-
import { existsSync as
|
|
18800
|
-
|
|
18801
|
-
|
|
18802
|
-
|
|
18803
|
-
|
|
18804
|
-
|
|
18805
|
-
|
|
18806
|
-
|
|
18807
|
-
|
|
18808
|
-
if (choice === "1") return getDatePrefix(0);
|
|
18809
|
-
if (choice === "2") return getDatePrefix(-1);
|
|
18810
|
-
if (choice === "3") {
|
|
18811
|
-
const customDate = await askQuestion(rl, "Enter date (YYYY-MM-DD): ");
|
|
18812
|
-
if (/^\d{4}-\d{2}-\d{2}$/.test(customDate)) return customDate;
|
|
18813
|
-
console.log("Invalid date format. Cancelling.");
|
|
18814
|
-
return null;
|
|
18815
|
-
}
|
|
18816
|
-
console.log("Cancelled.");
|
|
18817
|
-
return null;
|
|
18818
|
-
}
|
|
18819
|
-
function renameWithPrefix(vttDir, vttFile, prefix2) {
|
|
18820
|
-
const newFilename = `${prefix2}.${vttFile}`;
|
|
18821
|
-
renameSync2(join49(vttDir, vttFile), join49(vttDir, newFilename));
|
|
18822
|
-
console.log(`Renamed to: ${newFilename}`);
|
|
18823
|
-
return newFilename;
|
|
18824
|
-
}
|
|
18825
|
-
async function promptForDateFix(vttFile, vttDir) {
|
|
18826
|
-
const rl = createReadlineInterface();
|
|
18827
|
-
console.log(
|
|
18828
|
-
`
|
|
18829
|
-
Error: File "${vttFile}" does not start with YYYY-MM-DD format.`
|
|
18830
|
-
);
|
|
18831
|
-
console.log("\nOptions:");
|
|
18832
|
-
console.log(" 1. Use today's date");
|
|
18833
|
-
console.log(" 2. Use yesterday's date");
|
|
18834
|
-
console.log(" 3. Enter your own date");
|
|
18835
|
-
console.log(" 4. Cancel");
|
|
18836
|
-
try {
|
|
18837
|
-
const choice = await askQuestion(rl, "\nSelect an option (1/2/3/4): ");
|
|
18838
|
-
const prefix2 = await resolveDate(rl, choice);
|
|
18839
|
-
rl.close();
|
|
18840
|
-
return prefix2 ? renameWithPrefix(vttDir, vttFile, prefix2) : null;
|
|
18841
|
-
} catch (error) {
|
|
18842
|
-
rl.close();
|
|
18843
|
-
throw error;
|
|
18844
|
-
}
|
|
18845
|
-
}
|
|
18846
|
-
|
|
18847
|
-
// src/commands/transcript/format/fixInvalidDatePrefixes/index.ts
|
|
18848
|
-
async function fixInvalidDatePrefixes(vttFiles) {
|
|
18849
|
-
for (let i = 0; i < vttFiles.length; i++) {
|
|
18850
|
-
const vttFile = vttFiles[i];
|
|
18851
|
-
if (!isValidDatePrefix(vttFile.filename)) {
|
|
18852
|
-
const vttFileDir = dirname23(vttFile.absolutePath);
|
|
18853
|
-
const newFilename = await promptForDateFix(vttFile.filename, vttFileDir);
|
|
18854
|
-
if (newFilename) {
|
|
18855
|
-
const newRelativePath = join50(
|
|
18856
|
-
dirname23(vttFile.relativePath),
|
|
18857
|
-
newFilename
|
|
18858
|
-
);
|
|
18859
|
-
vttFiles[i] = {
|
|
18860
|
-
absolutePath: join50(vttFileDir, newFilename),
|
|
18861
|
-
relativePath: newRelativePath,
|
|
18862
|
-
filename: newFilename
|
|
18863
|
-
};
|
|
18864
|
-
} else {
|
|
18865
|
-
vttFiles[i] = { absolutePath: "", relativePath: "", filename: "" };
|
|
18866
|
-
}
|
|
18867
|
-
}
|
|
18772
|
+
// src/commands/transcript/list.ts
|
|
18773
|
+
import { existsSync as existsSync41, readdirSync as readdirSync8, statSync as statSync6 } from "fs";
|
|
18774
|
+
import { join as join48 } from "path";
|
|
18775
|
+
function list4() {
|
|
18776
|
+
const { vttDir } = getTranscriptConfig();
|
|
18777
|
+
if (!existsSync41(vttDir)) return;
|
|
18778
|
+
for (const entry of readdirSync8(vttDir)) {
|
|
18779
|
+
if (!entry.endsWith(".vtt")) continue;
|
|
18780
|
+
if (statSync6(join48(vttDir, entry)).isDirectory()) continue;
|
|
18781
|
+
console.log(entry);
|
|
18868
18782
|
}
|
|
18869
|
-
return vttFiles.filter((f) => f.absolutePath !== "");
|
|
18870
18783
|
}
|
|
18871
18784
|
|
|
18872
|
-
// src/commands/transcript/
|
|
18873
|
-
import {
|
|
18874
|
-
|
|
18785
|
+
// src/commands/transcript/move.ts
|
|
18786
|
+
import {
|
|
18787
|
+
existsSync as existsSync42,
|
|
18788
|
+
mkdirSync as mkdirSync17,
|
|
18789
|
+
readFileSync as readFileSync36,
|
|
18790
|
+
renameSync as renameSync2,
|
|
18791
|
+
writeFileSync as writeFileSync35
|
|
18792
|
+
} from "fs";
|
|
18793
|
+
import { basename as basename8, join as join49 } from "path";
|
|
18875
18794
|
|
|
18876
18795
|
// src/commands/transcript/cleanText.ts
|
|
18877
18796
|
function cleanText(text6) {
|
|
@@ -18894,7 +18813,7 @@ function cleanText(text6) {
|
|
|
18894
18813
|
return cleaned.join(" ").replace(/\s+/g, " ").trim();
|
|
18895
18814
|
}
|
|
18896
18815
|
|
|
18897
|
-
// src/commands/transcript/
|
|
18816
|
+
// src/commands/transcript/convert/parseVtt/deduplicateCues/removeSubstringDuplicates.ts
|
|
18898
18817
|
function normalizeText(text6) {
|
|
18899
18818
|
return text6.toLowerCase().trim();
|
|
18900
18819
|
}
|
|
@@ -18937,7 +18856,7 @@ function removeSubstringDuplicates(cues) {
|
|
|
18937
18856
|
return cues.filter((_, i) => !toRemove.has(i));
|
|
18938
18857
|
}
|
|
18939
18858
|
|
|
18940
|
-
// src/commands/transcript/
|
|
18859
|
+
// src/commands/transcript/convert/parseVtt/deduplicateCues/index.ts
|
|
18941
18860
|
function findWordOverlap(currentWords, nextWords) {
|
|
18942
18861
|
for (let j = Math.min(5, currentWords.length); j >= 1; j--) {
|
|
18943
18862
|
const suffix = currentWords.slice(-j).join(" ");
|
|
@@ -18985,7 +18904,7 @@ function deduplicateCues(cues) {
|
|
|
18985
18904
|
}));
|
|
18986
18905
|
}
|
|
18987
18906
|
|
|
18988
|
-
// src/commands/transcript/
|
|
18907
|
+
// src/commands/transcript/convert/parseVtt/index.ts
|
|
18989
18908
|
function parseHMS(h, m, s) {
|
|
18990
18909
|
return Number.parseInt(h, 10) * 3600 + Number.parseInt(m, 10) * 60 + Number.parseFloat(s);
|
|
18991
18910
|
}
|
|
@@ -19055,7 +18974,7 @@ function parseVtt(content) {
|
|
|
19055
18974
|
return cues;
|
|
19056
18975
|
}
|
|
19057
18976
|
|
|
19058
|
-
// src/commands/transcript/
|
|
18977
|
+
// src/commands/transcript/convert/formatChatLog.ts
|
|
19059
18978
|
function cuesToChatMessages(cues) {
|
|
19060
18979
|
const messages = [];
|
|
19061
18980
|
for (const cue of cues) {
|
|
@@ -19076,256 +18995,51 @@ function formatChatLog(messages) {
|
|
|
19076
18995
|
return messages.map((msg) => `${msg.speaker}: ${msg.text}`).join("\n\n");
|
|
19077
18996
|
}
|
|
19078
18997
|
|
|
19079
|
-
// src/commands/transcript/
|
|
19080
|
-
|
|
19081
|
-
|
|
19082
|
-
|
|
19083
|
-
|
|
19084
|
-
return
|
|
19085
|
-
}
|
|
19086
|
-
function buildOutputPaths(vttFile, transcriptsDir) {
|
|
19087
|
-
const mdFile = toMdFilename(vttFile.filename);
|
|
19088
|
-
const relativeDir = dirname24(vttFile.relativePath);
|
|
19089
|
-
const outputDir = resolveOutputDir(relativeDir, transcriptsDir);
|
|
19090
|
-
const outputPath = join51(outputDir, mdFile);
|
|
19091
|
-
return { outputDir, outputPath, mdFile, relativeDir };
|
|
19092
|
-
}
|
|
19093
|
-
function logSkipped(relativeDir, mdFile) {
|
|
19094
|
-
console.log(`Skipping (already exists): ${join51(relativeDir, mdFile)}`);
|
|
19095
|
-
return "skipped";
|
|
19096
|
-
}
|
|
19097
|
-
function ensureDirectory(dir, label2) {
|
|
19098
|
-
if (!existsSync42(dir)) {
|
|
19099
|
-
mkdirSync17(dir, { recursive: true });
|
|
19100
|
-
console.log(`Created ${label2}: ${dir}`);
|
|
19101
|
-
}
|
|
19102
|
-
}
|
|
19103
|
-
function processCues(content) {
|
|
19104
|
-
const cues = parseVtt(content);
|
|
19105
|
-
console.log(`Parsed ${cues.length} cues`);
|
|
19106
|
-
const dedupedCues = deduplicateCues(cues);
|
|
19107
|
-
console.log(`After deduplication: ${dedupedCues.length} cues`);
|
|
19108
|
-
return { cues, dedupedCues };
|
|
19109
|
-
}
|
|
19110
|
-
function convertToMessages(dedupedCues) {
|
|
19111
|
-
const chatMessages = cuesToChatMessages(dedupedCues);
|
|
19112
|
-
console.log(`Consolidated to ${chatMessages.length} chat messages`);
|
|
19113
|
-
return chatMessages;
|
|
19114
|
-
}
|
|
19115
|
-
function logReduction(cueCount, messageCount) {
|
|
19116
|
-
console.log(`Reduction: ${cueCount} cues -> ${messageCount} messages
|
|
19117
|
-
`);
|
|
19118
|
-
}
|
|
19119
|
-
function readAndParseCues(inputPath) {
|
|
19120
|
-
console.log(`Reading: ${inputPath}`);
|
|
19121
|
-
return processCues(readFileSync36(inputPath, "utf8"));
|
|
19122
|
-
}
|
|
19123
|
-
function writeFormatted(outputPath, content) {
|
|
19124
|
-
writeFileSync35(outputPath, content, "utf8");
|
|
19125
|
-
console.log(`Written: ${outputPath}`);
|
|
19126
|
-
}
|
|
19127
|
-
function convertVttToMarkdown(inputPath, outputPath) {
|
|
19128
|
-
const { cues, dedupedCues } = readAndParseCues(inputPath);
|
|
19129
|
-
const chatMessages = convertToMessages(dedupedCues);
|
|
19130
|
-
writeFormatted(outputPath, formatChatLog(chatMessages));
|
|
19131
|
-
logReduction(cues.length, chatMessages.length);
|
|
19132
|
-
}
|
|
19133
|
-
function tryProcessVtt(vttFile, paths) {
|
|
19134
|
-
if (existsSync42(paths.outputPath))
|
|
19135
|
-
return logSkipped(paths.relativeDir, paths.mdFile);
|
|
19136
|
-
convertVttToMarkdown(vttFile.absolutePath, paths.outputPath);
|
|
19137
|
-
return "processed";
|
|
19138
|
-
}
|
|
19139
|
-
function processVttFile(vttFile, transcriptsDir) {
|
|
19140
|
-
const paths = buildOutputPaths(vttFile, transcriptsDir);
|
|
19141
|
-
ensureDirectory(paths.outputDir, "output directory");
|
|
19142
|
-
return tryProcessVtt(vttFile, paths);
|
|
19143
|
-
}
|
|
19144
|
-
|
|
19145
|
-
// src/commands/transcript/format/index.ts
|
|
19146
|
-
function logSummary(counts) {
|
|
19147
|
-
console.log(
|
|
19148
|
-
`
|
|
19149
|
-
Summary: ${counts.processed} processed, ${counts.skipped} skipped`
|
|
19150
|
-
);
|
|
18998
|
+
// src/commands/transcript/move.ts
|
|
18999
|
+
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
19000
|
+
function convertVttToMarkdown(inputPath) {
|
|
19001
|
+
const cues = parseVtt(readFileSync36(inputPath, "utf8"));
|
|
19002
|
+
const messages = cuesToChatMessages(deduplicateCues(cues));
|
|
19003
|
+
return formatChatLog(messages);
|
|
19151
19004
|
}
|
|
19152
|
-
function
|
|
19153
|
-
const
|
|
19154
|
-
|
|
19155
|
-
|
|
19156
|
-
}
|
|
19157
|
-
logSummary(counts);
|
|
19005
|
+
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
19006
|
+
const processedDir = join49(vttDir, "processed");
|
|
19007
|
+
mkdirSync17(processedDir, { recursive: true });
|
|
19008
|
+
renameSync2(sourcePath, join49(processedDir, filename));
|
|
19158
19009
|
}
|
|
19159
|
-
function
|
|
19160
|
-
|
|
19161
|
-
|
|
19010
|
+
function move(file, options2) {
|
|
19011
|
+
const { date, client } = options2;
|
|
19012
|
+
if (!DATE_REGEX.test(date)) {
|
|
19013
|
+
console.error("Error: --date must be in YYYY-MM-DD format.");
|
|
19162
19014
|
process.exit(1);
|
|
19163
19015
|
}
|
|
19164
|
-
}
|
|
19165
|
-
|
|
19166
|
-
|
|
19167
|
-
|
|
19168
|
-
}
|
|
19169
|
-
function logNoVttFiles() {
|
|
19170
|
-
console.log("No VTT files found in vtt directory.");
|
|
19171
|
-
return null;
|
|
19172
|
-
}
|
|
19173
|
-
function loadVttFiles(vttDir) {
|
|
19174
|
-
const files = findVttFilesRecursive(vttDir);
|
|
19175
|
-
if (files.length === 0) return logNoVttFiles();
|
|
19176
|
-
logFoundFiles(files, vttDir);
|
|
19177
|
-
return files;
|
|
19178
|
-
}
|
|
19179
|
-
async function formatLoadedFiles(vttFiles, transcriptsDir) {
|
|
19180
|
-
const fixed2 = await fixInvalidDatePrefixes(vttFiles);
|
|
19181
|
-
processAllFiles(fixed2, transcriptsDir);
|
|
19182
|
-
}
|
|
19183
|
-
async function format() {
|
|
19184
|
-
const { vttDir, transcriptsDir } = getTranscriptConfig();
|
|
19185
|
-
requireVttDir(vttDir);
|
|
19186
|
-
ensureDirectory(transcriptsDir, "output directory");
|
|
19187
|
-
const vttFiles = loadVttFiles(vttDir);
|
|
19188
|
-
if (vttFiles) await formatLoadedFiles(vttFiles, transcriptsDir);
|
|
19189
|
-
}
|
|
19190
|
-
|
|
19191
|
-
// src/commands/transcript/summarise/index.ts
|
|
19192
|
-
import { existsSync as existsSync45 } from "fs";
|
|
19193
|
-
import { basename as basename10, dirname as dirname26, join as join53, relative as relative3 } from "path";
|
|
19194
|
-
|
|
19195
|
-
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
19196
|
-
import {
|
|
19197
|
-
existsSync as existsSync44,
|
|
19198
|
-
mkdirSync as mkdirSync18,
|
|
19199
|
-
readFileSync as readFileSync37,
|
|
19200
|
-
renameSync as renameSync3,
|
|
19201
|
-
rmSync as rmSync3
|
|
19202
|
-
} from "fs";
|
|
19203
|
-
import { dirname as dirname25, join as join52 } from "path";
|
|
19204
|
-
|
|
19205
|
-
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
19206
|
-
import chalk178 from "chalk";
|
|
19207
|
-
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
19208
|
-
function validateStagedContent(filename, content) {
|
|
19209
|
-
const firstLine = content.split("\n")[0];
|
|
19210
|
-
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
19211
|
-
if (!match) {
|
|
19212
|
-
console.error(
|
|
19213
|
-
chalk178.red(
|
|
19214
|
-
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
19215
|
-
)
|
|
19216
|
-
);
|
|
19217
|
-
process.exit(1);
|
|
19218
|
-
}
|
|
19219
|
-
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
19220
|
-
if (!contentAfterLink) {
|
|
19221
|
-
console.error(
|
|
19222
|
-
chalk178.red(
|
|
19223
|
-
`Staged file ${filename} has no summary content after the transcript link.`
|
|
19224
|
-
)
|
|
19225
|
-
);
|
|
19226
|
-
process.exit(1);
|
|
19227
|
-
}
|
|
19228
|
-
return { contentAfterLink };
|
|
19229
|
-
}
|
|
19230
|
-
|
|
19231
|
-
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
19232
|
-
var STAGING_DIR = join52(process.cwd(), ".assist", "transcript");
|
|
19233
|
-
function processStagedFile() {
|
|
19234
|
-
if (!existsSync44(STAGING_DIR)) {
|
|
19235
|
-
return false;
|
|
19236
|
-
}
|
|
19237
|
-
const stagedFiles = findMdFilesRecursive(STAGING_DIR);
|
|
19238
|
-
if (stagedFiles.length === 0) {
|
|
19239
|
-
return false;
|
|
19240
|
-
}
|
|
19241
|
-
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
19242
|
-
const stagedFile = stagedFiles[0];
|
|
19243
|
-
const content = readFileSync37(stagedFile.absolutePath, "utf8");
|
|
19244
|
-
validateStagedContent(stagedFile.filename, content);
|
|
19245
|
-
const stagedBaseName = getTranscriptBaseName(stagedFile.filename);
|
|
19246
|
-
const transcriptFiles = findMdFilesRecursive(transcriptsDir);
|
|
19247
|
-
const matchingTranscript = transcriptFiles.find(
|
|
19248
|
-
(t) => getTranscriptBaseName(t.filename) === stagedBaseName
|
|
19249
|
-
);
|
|
19250
|
-
if (!matchingTranscript) {
|
|
19251
|
-
console.error(
|
|
19252
|
-
`No transcript found matching staged file: ${stagedFile.filename}`
|
|
19253
|
-
);
|
|
19016
|
+
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
19017
|
+
const filename = basename8(file);
|
|
19018
|
+
const sourcePath = join49(vttDir, filename);
|
|
19019
|
+
if (!existsSync42(sourcePath)) {
|
|
19020
|
+
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
19254
19021
|
process.exit(1);
|
|
19255
19022
|
}
|
|
19256
|
-
const
|
|
19257
|
-
const
|
|
19258
|
-
|
|
19259
|
-
|
|
19260
|
-
|
|
19261
|
-
|
|
19262
|
-
|
|
19263
|
-
|
|
19264
|
-
|
|
19265
|
-
|
|
19266
|
-
return true;
|
|
19267
|
-
}
|
|
19268
|
-
|
|
19269
|
-
// src/commands/transcript/summarise/index.ts
|
|
19270
|
-
function buildRelativeKey(relativePath, baseName) {
|
|
19271
|
-
const relDir = dirname26(relativePath);
|
|
19272
|
-
return relDir === "." ? baseName : join53(relDir, baseName);
|
|
19273
|
-
}
|
|
19274
|
-
function buildSummaryIndex(summaryDir) {
|
|
19275
|
-
const summaryFiles = findMdFilesRecursive(summaryDir);
|
|
19276
|
-
return new Set(
|
|
19277
|
-
summaryFiles.map(
|
|
19278
|
-
(f) => buildRelativeKey(f.relativePath, basename10(f.filename, ".md"))
|
|
19279
|
-
)
|
|
19280
|
-
);
|
|
19281
|
-
}
|
|
19282
|
-
function summarise2() {
|
|
19283
|
-
processStagedFile();
|
|
19284
|
-
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
19285
|
-
if (!existsSync45(transcriptsDir)) {
|
|
19286
|
-
console.log("No transcripts directory found.");
|
|
19287
|
-
return;
|
|
19288
|
-
}
|
|
19289
|
-
const transcriptFiles = findMdFilesRecursive(transcriptsDir);
|
|
19290
|
-
if (transcriptFiles.length === 0) {
|
|
19291
|
-
console.log("No transcript files found.");
|
|
19292
|
-
return;
|
|
19293
|
-
}
|
|
19294
|
-
const summaryIndex = buildSummaryIndex(summaryDir);
|
|
19295
|
-
const missing = transcriptFiles.filter(
|
|
19296
|
-
(t) => !summaryIndex.has(
|
|
19297
|
-
buildRelativeKey(t.relativePath, getTranscriptBaseName(t.filename))
|
|
19298
|
-
)
|
|
19299
|
-
);
|
|
19300
|
-
if (missing.length === 0) {
|
|
19301
|
-
console.log("All transcripts have summaries.");
|
|
19302
|
-
return;
|
|
19303
|
-
}
|
|
19304
|
-
const next3 = missing[0];
|
|
19305
|
-
const outputFilename = `${getTranscriptBaseName(next3.filename)}.md`;
|
|
19306
|
-
const outputPath = join53(STAGING_DIR, outputFilename);
|
|
19307
|
-
const summaryFileDir = join53(summaryDir, dirname26(next3.relativePath));
|
|
19308
|
-
const relativeTranscriptPath = encodeURI(
|
|
19309
|
-
relative3(summaryFileDir, next3.absolutePath).replace(/\\/g, "/")
|
|
19310
|
-
);
|
|
19311
|
-
console.log(`Missing summaries: ${missing.length}
|
|
19312
|
-
`);
|
|
19313
|
-
console.log("Read and summarise this transcript:");
|
|
19314
|
-
console.log(` ${next3.absolutePath}
|
|
19315
|
-
`);
|
|
19316
|
-
console.log("Write the summary to:");
|
|
19317
|
-
console.log(` ${outputPath}
|
|
19318
|
-
`);
|
|
19319
|
-
console.log("The summary must start with:");
|
|
19320
|
-
console.log(` [Full Transcript](${relativeTranscriptPath})`);
|
|
19023
|
+
const base = basename8(filename, ".vtt").replace(/ Transcription$/, "");
|
|
19024
|
+
const outputName = `${date} ${base}.md`;
|
|
19025
|
+
const formattedDir = join49(transcriptsDir, client);
|
|
19026
|
+
mkdirSync17(formattedDir, { recursive: true });
|
|
19027
|
+
const formattedPath = join49(formattedDir, outputName);
|
|
19028
|
+
writeFileSync35(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
19029
|
+
archiveRawVtt(vttDir, sourcePath, filename);
|
|
19030
|
+
const summaryPath = join49(summaryDir, client, outputName);
|
|
19031
|
+
console.log(formattedPath);
|
|
19032
|
+
console.log(summaryPath);
|
|
19321
19033
|
}
|
|
19322
19034
|
|
|
19323
19035
|
// src/commands/registerTranscript.ts
|
|
19324
19036
|
function registerTranscript(program2) {
|
|
19325
19037
|
const transcriptCommand = program2.command("transcript").description("Meeting transcript utilities");
|
|
19326
19038
|
transcriptCommand.command("configure").description("Configure transcript directories").action(configure);
|
|
19327
|
-
transcriptCommand.command("
|
|
19328
|
-
transcriptCommand.command("
|
|
19039
|
+
transcriptCommand.command("list").description("List raw .vtt filenames waiting in the pick-up directory").action(list4);
|
|
19040
|
+
transcriptCommand.command("move <file>").description(
|
|
19041
|
+
"Convert a raw .vtt to a dated markdown transcript and archive the original"
|
|
19042
|
+
).requiredOption("--date <YYYY-MM-DD>", "meeting date").requiredOption("--client <name>", "client name").action(move);
|
|
19329
19043
|
}
|
|
19330
19044
|
|
|
19331
19045
|
// src/commands/registerVerify.ts
|
|
@@ -19361,55 +19075,55 @@ function registerVerify(program2) {
|
|
|
19361
19075
|
|
|
19362
19076
|
// src/commands/voice/devices.ts
|
|
19363
19077
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
19364
|
-
import { join as
|
|
19078
|
+
import { join as join51 } from "path";
|
|
19365
19079
|
|
|
19366
19080
|
// src/commands/voice/shared.ts
|
|
19367
19081
|
import { homedir as homedir17 } from "os";
|
|
19368
|
-
import { dirname as
|
|
19082
|
+
import { dirname as dirname23, join as join50 } from "path";
|
|
19369
19083
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
19370
|
-
var __dirname5 =
|
|
19371
|
-
var VOICE_DIR =
|
|
19084
|
+
var __dirname5 = dirname23(fileURLToPath6(import.meta.url));
|
|
19085
|
+
var VOICE_DIR = join50(homedir17(), ".assist", "voice");
|
|
19372
19086
|
var voicePaths = {
|
|
19373
19087
|
dir: VOICE_DIR,
|
|
19374
|
-
pid:
|
|
19375
|
-
log:
|
|
19376
|
-
venv:
|
|
19377
|
-
lock:
|
|
19088
|
+
pid: join50(VOICE_DIR, "voice.pid"),
|
|
19089
|
+
log: join50(VOICE_DIR, "voice.log"),
|
|
19090
|
+
venv: join50(VOICE_DIR, ".venv"),
|
|
19091
|
+
lock: join50(VOICE_DIR, "voice.lock")
|
|
19378
19092
|
};
|
|
19379
19093
|
function getPythonDir() {
|
|
19380
|
-
return
|
|
19094
|
+
return join50(__dirname5, "commands", "voice", "python");
|
|
19381
19095
|
}
|
|
19382
19096
|
function getVenvPython() {
|
|
19383
|
-
return process.platform === "win32" ?
|
|
19097
|
+
return process.platform === "win32" ? join50(voicePaths.venv, "Scripts", "python.exe") : join50(voicePaths.venv, "bin", "python");
|
|
19384
19098
|
}
|
|
19385
19099
|
function getLockDir() {
|
|
19386
19100
|
const config = loadConfig();
|
|
19387
19101
|
return config.voice?.lockDir ?? VOICE_DIR;
|
|
19388
19102
|
}
|
|
19389
19103
|
function getLockFile() {
|
|
19390
|
-
return
|
|
19104
|
+
return join50(getLockDir(), "voice.lock");
|
|
19391
19105
|
}
|
|
19392
19106
|
|
|
19393
19107
|
// src/commands/voice/devices.ts
|
|
19394
19108
|
function devices() {
|
|
19395
|
-
const script =
|
|
19109
|
+
const script = join51(getPythonDir(), "list_devices.py");
|
|
19396
19110
|
spawnSync5(getVenvPython(), [script], { stdio: "inherit" });
|
|
19397
19111
|
}
|
|
19398
19112
|
|
|
19399
19113
|
// src/commands/voice/logs.ts
|
|
19400
|
-
import { existsSync as
|
|
19114
|
+
import { existsSync as existsSync43, readFileSync as readFileSync37 } from "fs";
|
|
19401
19115
|
function logs(options2) {
|
|
19402
|
-
if (!
|
|
19116
|
+
if (!existsSync43(voicePaths.log)) {
|
|
19403
19117
|
console.log("No voice log file found");
|
|
19404
19118
|
return;
|
|
19405
19119
|
}
|
|
19406
|
-
const
|
|
19407
|
-
const content =
|
|
19120
|
+
const count7 = Number.parseInt(options2.lines ?? "150", 10);
|
|
19121
|
+
const content = readFileSync37(voicePaths.log, "utf8").trim();
|
|
19408
19122
|
if (!content) {
|
|
19409
19123
|
console.log("Voice log is empty");
|
|
19410
19124
|
return;
|
|
19411
19125
|
}
|
|
19412
|
-
const lines = content.split("\n").slice(-
|
|
19126
|
+
const lines = content.split("\n").slice(-count7);
|
|
19413
19127
|
for (const line of lines) {
|
|
19414
19128
|
try {
|
|
19415
19129
|
const event = JSON.parse(line);
|
|
@@ -19426,13 +19140,13 @@ function logs(options2) {
|
|
|
19426
19140
|
|
|
19427
19141
|
// src/commands/voice/setup.ts
|
|
19428
19142
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
19429
|
-
import { mkdirSync as
|
|
19430
|
-
import { join as
|
|
19143
|
+
import { mkdirSync as mkdirSync19 } from "fs";
|
|
19144
|
+
import { join as join53 } from "path";
|
|
19431
19145
|
|
|
19432
19146
|
// src/commands/voice/checkLockFile.ts
|
|
19433
19147
|
import { execSync as execSync48 } from "child_process";
|
|
19434
|
-
import { existsSync as
|
|
19435
|
-
import { join as
|
|
19148
|
+
import { existsSync as existsSync44, mkdirSync as mkdirSync18, readFileSync as readFileSync38, writeFileSync as writeFileSync36 } from "fs";
|
|
19149
|
+
import { join as join52 } from "path";
|
|
19436
19150
|
function isProcessAlive2(pid) {
|
|
19437
19151
|
try {
|
|
19438
19152
|
process.kill(pid, 0);
|
|
@@ -19443,9 +19157,9 @@ function isProcessAlive2(pid) {
|
|
|
19443
19157
|
}
|
|
19444
19158
|
function checkLockFile() {
|
|
19445
19159
|
const lockFile = getLockFile();
|
|
19446
|
-
if (!
|
|
19160
|
+
if (!existsSync44(lockFile)) return;
|
|
19447
19161
|
try {
|
|
19448
|
-
const lock2 = JSON.parse(
|
|
19162
|
+
const lock2 = JSON.parse(readFileSync38(lockFile, "utf8"));
|
|
19449
19163
|
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
19450
19164
|
console.error(
|
|
19451
19165
|
`Voice daemon already running (PID ${lock2.pid}, env: ${lock2.env}). Stop it first with: assist voice stop`
|
|
@@ -19456,7 +19170,7 @@ function checkLockFile() {
|
|
|
19456
19170
|
}
|
|
19457
19171
|
}
|
|
19458
19172
|
function bootstrapVenv() {
|
|
19459
|
-
if (
|
|
19173
|
+
if (existsSync44(getVenvPython())) return;
|
|
19460
19174
|
console.log("Setting up Python environment...");
|
|
19461
19175
|
const pythonDir = getPythonDir();
|
|
19462
19176
|
execSync48(
|
|
@@ -19469,7 +19183,7 @@ function bootstrapVenv() {
|
|
|
19469
19183
|
}
|
|
19470
19184
|
function writeLockFile(pid) {
|
|
19471
19185
|
const lockFile = getLockFile();
|
|
19472
|
-
|
|
19186
|
+
mkdirSync18(join52(lockFile, ".."), { recursive: true });
|
|
19473
19187
|
writeFileSync36(
|
|
19474
19188
|
lockFile,
|
|
19475
19189
|
JSON.stringify({
|
|
@@ -19482,10 +19196,10 @@ function writeLockFile(pid) {
|
|
|
19482
19196
|
|
|
19483
19197
|
// src/commands/voice/setup.ts
|
|
19484
19198
|
function setup() {
|
|
19485
|
-
|
|
19199
|
+
mkdirSync19(voicePaths.dir, { recursive: true });
|
|
19486
19200
|
bootstrapVenv();
|
|
19487
19201
|
console.log("\nDownloading models...\n");
|
|
19488
|
-
const script =
|
|
19202
|
+
const script = join53(getPythonDir(), "setup_models.py");
|
|
19489
19203
|
const result = spawnSync6(getVenvPython(), [script], {
|
|
19490
19204
|
stdio: "inherit",
|
|
19491
19205
|
env: { ...process.env, VOICE_LOG_FILE: voicePaths.log }
|
|
@@ -19498,8 +19212,8 @@ function setup() {
|
|
|
19498
19212
|
|
|
19499
19213
|
// src/commands/voice/start.ts
|
|
19500
19214
|
import { spawn as spawn7 } from "child_process";
|
|
19501
|
-
import { mkdirSync as
|
|
19502
|
-
import { join as
|
|
19215
|
+
import { mkdirSync as mkdirSync20, writeFileSync as writeFileSync37 } from "fs";
|
|
19216
|
+
import { join as join54 } from "path";
|
|
19503
19217
|
|
|
19504
19218
|
// src/commands/voice/buildDaemonEnv.ts
|
|
19505
19219
|
function buildDaemonEnv(options2) {
|
|
@@ -19532,12 +19246,12 @@ function spawnBackground(python, script, env) {
|
|
|
19532
19246
|
console.log(`Voice daemon started (PID ${pid})`);
|
|
19533
19247
|
}
|
|
19534
19248
|
function start2(options2) {
|
|
19535
|
-
|
|
19249
|
+
mkdirSync20(voicePaths.dir, { recursive: true });
|
|
19536
19250
|
checkLockFile();
|
|
19537
19251
|
bootstrapVenv();
|
|
19538
19252
|
const debug = options2.debug || options2.foreground || process.platform === "win32";
|
|
19539
19253
|
const env = buildDaemonEnv({ debug });
|
|
19540
|
-
const script =
|
|
19254
|
+
const script = join54(getPythonDir(), "voice_daemon.py");
|
|
19541
19255
|
const python = getVenvPython();
|
|
19542
19256
|
if (options2.foreground) {
|
|
19543
19257
|
spawnForeground(python, script, env);
|
|
@@ -19547,7 +19261,7 @@ function start2(options2) {
|
|
|
19547
19261
|
}
|
|
19548
19262
|
|
|
19549
19263
|
// src/commands/voice/status.ts
|
|
19550
|
-
import { existsSync as
|
|
19264
|
+
import { existsSync as existsSync45, readFileSync as readFileSync39 } from "fs";
|
|
19551
19265
|
function isProcessAlive3(pid) {
|
|
19552
19266
|
try {
|
|
19553
19267
|
process.kill(pid, 0);
|
|
@@ -19556,17 +19270,17 @@ function isProcessAlive3(pid) {
|
|
|
19556
19270
|
return false;
|
|
19557
19271
|
}
|
|
19558
19272
|
}
|
|
19559
|
-
function readRecentLogs(
|
|
19560
|
-
if (!
|
|
19561
|
-
const lines =
|
|
19562
|
-
return lines.slice(-
|
|
19273
|
+
function readRecentLogs(count7) {
|
|
19274
|
+
if (!existsSync45(voicePaths.log)) return [];
|
|
19275
|
+
const lines = readFileSync39(voicePaths.log, "utf8").trim().split("\n");
|
|
19276
|
+
return lines.slice(-count7);
|
|
19563
19277
|
}
|
|
19564
19278
|
function status() {
|
|
19565
|
-
if (!
|
|
19279
|
+
if (!existsSync45(voicePaths.pid)) {
|
|
19566
19280
|
console.log("Voice daemon: not running (no PID file)");
|
|
19567
19281
|
return;
|
|
19568
19282
|
}
|
|
19569
|
-
const pid = Number.parseInt(
|
|
19283
|
+
const pid = Number.parseInt(readFileSync39(voicePaths.pid, "utf8").trim(), 10);
|
|
19570
19284
|
const alive = isProcessAlive3(pid);
|
|
19571
19285
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
19572
19286
|
const recent = readRecentLogs(5);
|
|
@@ -19585,13 +19299,13 @@ function status() {
|
|
|
19585
19299
|
}
|
|
19586
19300
|
|
|
19587
19301
|
// src/commands/voice/stop.ts
|
|
19588
|
-
import { existsSync as
|
|
19302
|
+
import { existsSync as existsSync46, readFileSync as readFileSync40, unlinkSync as unlinkSync17 } from "fs";
|
|
19589
19303
|
function stop2() {
|
|
19590
|
-
if (!
|
|
19304
|
+
if (!existsSync46(voicePaths.pid)) {
|
|
19591
19305
|
console.log("Voice daemon is not running (no PID file)");
|
|
19592
19306
|
return;
|
|
19593
19307
|
}
|
|
19594
|
-
const pid = Number.parseInt(
|
|
19308
|
+
const pid = Number.parseInt(readFileSync40(voicePaths.pid, "utf8").trim(), 10);
|
|
19595
19309
|
try {
|
|
19596
19310
|
process.kill(pid, "SIGTERM");
|
|
19597
19311
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -19604,7 +19318,7 @@ function stop2() {
|
|
|
19604
19318
|
}
|
|
19605
19319
|
try {
|
|
19606
19320
|
const lockFile = getLockFile();
|
|
19607
|
-
if (
|
|
19321
|
+
if (existsSync46(lockFile)) unlinkSync17(lockFile);
|
|
19608
19322
|
} catch {
|
|
19609
19323
|
}
|
|
19610
19324
|
console.log("Voice daemon stopped");
|
|
@@ -19623,7 +19337,7 @@ function registerVoice(program2) {
|
|
|
19623
19337
|
|
|
19624
19338
|
// src/commands/roam/auth.ts
|
|
19625
19339
|
import { randomBytes } from "crypto";
|
|
19626
|
-
import
|
|
19340
|
+
import chalk178 from "chalk";
|
|
19627
19341
|
|
|
19628
19342
|
// src/commands/roam/waitForCallback.ts
|
|
19629
19343
|
import { createServer as createServer3 } from "http";
|
|
@@ -19754,13 +19468,13 @@ async function auth() {
|
|
|
19754
19468
|
saveGlobalConfig(config);
|
|
19755
19469
|
const state = randomBytes(16).toString("hex");
|
|
19756
19470
|
console.log(
|
|
19757
|
-
|
|
19471
|
+
chalk178.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
19758
19472
|
);
|
|
19759
|
-
console.log(
|
|
19760
|
-
console.log(
|
|
19761
|
-
console.log(
|
|
19473
|
+
console.log(chalk178.white("http://localhost:14523/callback\n"));
|
|
19474
|
+
console.log(chalk178.blue("Opening browser for authorization..."));
|
|
19475
|
+
console.log(chalk178.dim("Waiting for authorization callback..."));
|
|
19762
19476
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
19763
|
-
console.log(
|
|
19477
|
+
console.log(chalk178.dim("Exchanging code for tokens..."));
|
|
19764
19478
|
const tokens = await exchangeToken({
|
|
19765
19479
|
code,
|
|
19766
19480
|
clientId,
|
|
@@ -19776,14 +19490,14 @@ async function auth() {
|
|
|
19776
19490
|
};
|
|
19777
19491
|
saveGlobalConfig(config);
|
|
19778
19492
|
console.log(
|
|
19779
|
-
|
|
19493
|
+
chalk178.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
19780
19494
|
);
|
|
19781
19495
|
}
|
|
19782
19496
|
|
|
19783
19497
|
// src/commands/roam/postRoamActivity.ts
|
|
19784
19498
|
import { execFileSync as execFileSync7 } from "child_process";
|
|
19785
|
-
import { readdirSync as readdirSync9, readFileSync as
|
|
19786
|
-
import { join as
|
|
19499
|
+
import { readdirSync as readdirSync9, readFileSync as readFileSync41, statSync as statSync7 } from "fs";
|
|
19500
|
+
import { join as join55 } from "path";
|
|
19787
19501
|
function findPortFile(roamDir) {
|
|
19788
19502
|
let entries;
|
|
19789
19503
|
try {
|
|
@@ -19792,7 +19506,7 @@ function findPortFile(roamDir) {
|
|
|
19792
19506
|
return void 0;
|
|
19793
19507
|
}
|
|
19794
19508
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
19795
|
-
const path57 =
|
|
19509
|
+
const path57 = join55(roamDir, name);
|
|
19796
19510
|
try {
|
|
19797
19511
|
return { path: path57, mtimeMs: statSync7(path57).mtimeMs };
|
|
19798
19512
|
} catch {
|
|
@@ -19804,11 +19518,11 @@ function findPortFile(roamDir) {
|
|
|
19804
19518
|
function postRoamActivity(app, event) {
|
|
19805
19519
|
const appData = process.env.APPDATA;
|
|
19806
19520
|
if (!appData) return;
|
|
19807
|
-
const portFile = findPortFile(
|
|
19521
|
+
const portFile = findPortFile(join55(appData, "Roam"));
|
|
19808
19522
|
if (!portFile) return;
|
|
19809
19523
|
let port;
|
|
19810
19524
|
try {
|
|
19811
|
-
port =
|
|
19525
|
+
port = readFileSync41(portFile, "utf8").trim();
|
|
19812
19526
|
} catch {
|
|
19813
19527
|
return;
|
|
19814
19528
|
}
|
|
@@ -19950,15 +19664,15 @@ function runPreCommands(pre, cwd) {
|
|
|
19950
19664
|
|
|
19951
19665
|
// src/commands/run/spawnRunCommand.ts
|
|
19952
19666
|
import { execFileSync as execFileSync8, spawn as spawn8 } from "child_process";
|
|
19953
|
-
import { existsSync as
|
|
19954
|
-
import { dirname as
|
|
19667
|
+
import { existsSync as existsSync47 } from "fs";
|
|
19668
|
+
import { dirname as dirname24, join as join56, resolve as resolve13 } from "path";
|
|
19955
19669
|
function resolveCommand2(command) {
|
|
19956
19670
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
19957
19671
|
try {
|
|
19958
19672
|
const gitPath = execFileSync8("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
19959
|
-
const gitRoot = resolve13(
|
|
19960
|
-
const gitBash =
|
|
19961
|
-
if (
|
|
19673
|
+
const gitRoot = resolve13(dirname24(gitPath), "..");
|
|
19674
|
+
const gitBash = join56(gitRoot, "bin", "bash.exe");
|
|
19675
|
+
if (existsSync47(gitBash)) return gitBash;
|
|
19962
19676
|
} catch {
|
|
19963
19677
|
}
|
|
19964
19678
|
return command;
|
|
@@ -20043,8 +19757,8 @@ async function run3(name, args) {
|
|
|
20043
19757
|
}
|
|
20044
19758
|
|
|
20045
19759
|
// src/commands/run/add.ts
|
|
20046
|
-
import { mkdirSync as
|
|
20047
|
-
import { join as
|
|
19760
|
+
import { mkdirSync as mkdirSync21, writeFileSync as writeFileSync38 } from "fs";
|
|
19761
|
+
import { join as join57 } from "path";
|
|
20048
19762
|
|
|
20049
19763
|
// src/commands/run/extractOption.ts
|
|
20050
19764
|
function extractOption(args, flag) {
|
|
@@ -20105,15 +19819,15 @@ function saveNewRunConfig(name, command, args, cwd) {
|
|
|
20105
19819
|
saveConfig(config);
|
|
20106
19820
|
}
|
|
20107
19821
|
function createCommandFile(name) {
|
|
20108
|
-
const dir =
|
|
20109
|
-
|
|
19822
|
+
const dir = join57(".claude", "commands");
|
|
19823
|
+
mkdirSync21(dir, { recursive: true });
|
|
20110
19824
|
const content = `---
|
|
20111
19825
|
description: Run ${name}
|
|
20112
19826
|
---
|
|
20113
19827
|
|
|
20114
19828
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
20115
19829
|
`;
|
|
20116
|
-
const filePath =
|
|
19830
|
+
const filePath = join57(dir, `${name}.md`);
|
|
20117
19831
|
writeFileSync38(filePath, content);
|
|
20118
19832
|
console.log(`Created command file: ${filePath}`);
|
|
20119
19833
|
}
|
|
@@ -20169,8 +19883,8 @@ function link2() {
|
|
|
20169
19883
|
}
|
|
20170
19884
|
|
|
20171
19885
|
// src/commands/run/remove.ts
|
|
20172
|
-
import { existsSync as
|
|
20173
|
-
import { join as
|
|
19886
|
+
import { existsSync as existsSync48, unlinkSync as unlinkSync18 } from "fs";
|
|
19887
|
+
import { join as join58 } from "path";
|
|
20174
19888
|
function findRemoveIndex() {
|
|
20175
19889
|
const idx = process.argv.indexOf("remove");
|
|
20176
19890
|
if (idx === -1 || idx + 1 >= process.argv.length) return -1;
|
|
@@ -20185,8 +19899,8 @@ function parseRemoveName() {
|
|
|
20185
19899
|
return process.argv[idx + 1];
|
|
20186
19900
|
}
|
|
20187
19901
|
function deleteCommandFile(name) {
|
|
20188
|
-
const filePath =
|
|
20189
|
-
if (
|
|
19902
|
+
const filePath = join58(".claude", "commands", `${name}.md`);
|
|
19903
|
+
if (existsSync48(filePath)) {
|
|
20190
19904
|
unlinkSync18(filePath);
|
|
20191
19905
|
console.log(`Deleted command file: ${filePath}`);
|
|
20192
19906
|
}
|
|
@@ -20225,10 +19939,10 @@ function registerRun(program2) {
|
|
|
20225
19939
|
|
|
20226
19940
|
// src/commands/screenshot/index.ts
|
|
20227
19941
|
import { execSync as execSync50 } from "child_process";
|
|
20228
|
-
import { existsSync as
|
|
19942
|
+
import { existsSync as existsSync49, mkdirSync as mkdirSync22, unlinkSync as unlinkSync19, writeFileSync as writeFileSync39 } from "fs";
|
|
20229
19943
|
import { tmpdir as tmpdir7 } from "os";
|
|
20230
|
-
import { join as
|
|
20231
|
-
import
|
|
19944
|
+
import { join as join59, resolve as resolve15 } from "path";
|
|
19945
|
+
import chalk179 from "chalk";
|
|
20232
19946
|
|
|
20233
19947
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
20234
19948
|
var captureWindowPs1 = `
|
|
@@ -20357,14 +20071,14 @@ Write-Output $OutputPath
|
|
|
20357
20071
|
|
|
20358
20072
|
// src/commands/screenshot/index.ts
|
|
20359
20073
|
function buildOutputPath(outputDir, processName) {
|
|
20360
|
-
if (!
|
|
20361
|
-
|
|
20074
|
+
if (!existsSync49(outputDir)) {
|
|
20075
|
+
mkdirSync22(outputDir, { recursive: true });
|
|
20362
20076
|
}
|
|
20363
20077
|
const timestamp4 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
20364
20078
|
return resolve15(outputDir, `${processName}-${timestamp4}.png`);
|
|
20365
20079
|
}
|
|
20366
20080
|
function runPowerShellScript(processName, outputPath) {
|
|
20367
|
-
const scriptPath =
|
|
20081
|
+
const scriptPath = join59(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
20368
20082
|
writeFileSync39(scriptPath, captureWindowPs1, "utf8");
|
|
20369
20083
|
try {
|
|
20370
20084
|
execSync50(
|
|
@@ -20379,13 +20093,13 @@ function screenshot(processName) {
|
|
|
20379
20093
|
const config = loadConfig();
|
|
20380
20094
|
const outputDir = resolve15(config.screenshot.outputDir);
|
|
20381
20095
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
20382
|
-
console.log(
|
|
20096
|
+
console.log(chalk179.gray(`Capturing window for process "${processName}" ...`));
|
|
20383
20097
|
try {
|
|
20384
20098
|
runPowerShellScript(processName, outputPath);
|
|
20385
|
-
console.log(
|
|
20099
|
+
console.log(chalk179.green(`Screenshot saved: ${outputPath}`));
|
|
20386
20100
|
} catch (error) {
|
|
20387
20101
|
const msg = error instanceof Error ? error.message : String(error);
|
|
20388
|
-
console.error(
|
|
20102
|
+
console.error(chalk179.red(`Failed to capture screenshot: ${msg}`));
|
|
20389
20103
|
process.exit(1);
|
|
20390
20104
|
}
|
|
20391
20105
|
}
|
|
@@ -20441,7 +20155,7 @@ function applyLine(result, pending, line) {
|
|
|
20441
20155
|
}
|
|
20442
20156
|
|
|
20443
20157
|
// src/commands/sessions/daemon/reportStolenSocket.ts
|
|
20444
|
-
import { readFileSync as
|
|
20158
|
+
import { readFileSync as readFileSync42 } from "fs";
|
|
20445
20159
|
function reportStolenSocket(socketPid) {
|
|
20446
20160
|
if (!socketPid) return;
|
|
20447
20161
|
const filePid = readPidFile();
|
|
@@ -20453,7 +20167,7 @@ function reportStolenSocket(socketPid) {
|
|
|
20453
20167
|
function readPidFile() {
|
|
20454
20168
|
try {
|
|
20455
20169
|
const pid = Number.parseInt(
|
|
20456
|
-
|
|
20170
|
+
readFileSync42(daemonPaths.pid, "utf8").trim(),
|
|
20457
20171
|
10
|
|
20458
20172
|
);
|
|
20459
20173
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -20592,9 +20306,9 @@ async function drainDaemon() {
|
|
|
20592
20306
|
console.log("Sessions daemon is not running; cleared persisted sessions");
|
|
20593
20307
|
return;
|
|
20594
20308
|
}
|
|
20595
|
-
const
|
|
20309
|
+
const count7 = await requestDrain(socket);
|
|
20596
20310
|
socket.destroy();
|
|
20597
|
-
console.log(`Drained ${
|
|
20311
|
+
console.log(`Drained ${count7} session(s)`);
|
|
20598
20312
|
}
|
|
20599
20313
|
function requestDrain(socket) {
|
|
20600
20314
|
socket.write(`${JSON.stringify({ type: "drain" })}
|
|
@@ -20618,7 +20332,7 @@ function requestDrain(socket) {
|
|
|
20618
20332
|
}
|
|
20619
20333
|
|
|
20620
20334
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
20621
|
-
import { mkdirSync as
|
|
20335
|
+
import { mkdirSync as mkdirSync24 } from "fs";
|
|
20622
20336
|
|
|
20623
20337
|
// src/commands/sessions/daemon/createAutoExit.ts
|
|
20624
20338
|
var DEFAULT_GRACE_MS = 6e4;
|
|
@@ -20801,7 +20515,7 @@ var ClientHub = class extends Set {
|
|
|
20801
20515
|
import * as pty from "node-pty";
|
|
20802
20516
|
|
|
20803
20517
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
20804
|
-
import { chmodSync, existsSync as
|
|
20518
|
+
import { chmodSync, existsSync as existsSync50, statSync as statSync8 } from "fs";
|
|
20805
20519
|
import { createRequire as createRequire3 } from "module";
|
|
20806
20520
|
import path49 from "path";
|
|
20807
20521
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -20816,7 +20530,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
20816
20530
|
`${process.platform}-${process.arch}`,
|
|
20817
20531
|
"spawn-helper"
|
|
20818
20532
|
);
|
|
20819
|
-
if (!
|
|
20533
|
+
if (!existsSync50(helper)) return;
|
|
20820
20534
|
const mode = statSync8(helper).mode;
|
|
20821
20535
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
20822
20536
|
}
|
|
@@ -21259,8 +20973,8 @@ function resumeSession(id2, sessionId, cwd, name) {
|
|
|
21259
20973
|
}
|
|
21260
20974
|
|
|
21261
20975
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
21262
|
-
import { existsSync as
|
|
21263
|
-
import { dirname as
|
|
20976
|
+
import { existsSync as existsSync51, mkdirSync as mkdirSync23, watch } from "fs";
|
|
20977
|
+
import { dirname as dirname25 } from "path";
|
|
21264
20978
|
|
|
21265
20979
|
// src/commands/sessions/daemon/applyReviewPause.ts
|
|
21266
20980
|
function applyReviewPause(session, activity2) {
|
|
@@ -21278,9 +20992,9 @@ var DEBOUNCE_MS = 50;
|
|
|
21278
20992
|
function watchActivity(session, notify2) {
|
|
21279
20993
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
21280
20994
|
const path57 = activityPath(session.id);
|
|
21281
|
-
const dir =
|
|
20995
|
+
const dir = dirname25(path57);
|
|
21282
20996
|
try {
|
|
21283
|
-
|
|
20997
|
+
mkdirSync23(dir, { recursive: true });
|
|
21284
20998
|
} catch {
|
|
21285
20999
|
return;
|
|
21286
21000
|
}
|
|
@@ -21301,7 +21015,7 @@ function watchActivity(session, notify2) {
|
|
|
21301
21015
|
if (timer) clearTimeout(timer);
|
|
21302
21016
|
timer = setTimeout(read, DEBOUNCE_MS);
|
|
21303
21017
|
});
|
|
21304
|
-
if (
|
|
21018
|
+
if (existsSync51(path57)) read();
|
|
21305
21019
|
}
|
|
21306
21020
|
function refreshActivity(session) {
|
|
21307
21021
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -22571,7 +22285,7 @@ function handleConnection(socket, manager) {
|
|
|
22571
22285
|
import { unlinkSync as unlinkSync20, writeFileSync as writeFileSync40 } from "fs";
|
|
22572
22286
|
|
|
22573
22287
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
22574
|
-
import { readFileSync as
|
|
22288
|
+
import { readFileSync as readFileSync43 } from "fs";
|
|
22575
22289
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
22576
22290
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
22577
22291
|
const timer = setInterval(() => {
|
|
@@ -22582,7 +22296,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
22582
22296
|
}
|
|
22583
22297
|
function ownsPidFile() {
|
|
22584
22298
|
try {
|
|
22585
|
-
return
|
|
22299
|
+
return readFileSync43(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
22586
22300
|
} catch {
|
|
22587
22301
|
return false;
|
|
22588
22302
|
}
|
|
@@ -22670,7 +22384,7 @@ async function recoverFromAddrInUse(server, manager, checkAutoExit) {
|
|
|
22670
22384
|
|
|
22671
22385
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
22672
22386
|
async function runDaemon() {
|
|
22673
|
-
|
|
22387
|
+
mkdirSync24(daemonPaths.dir, { recursive: true });
|
|
22674
22388
|
daemonLog(
|
|
22675
22389
|
`starting (reason: ${process.env.ASSIST_DAEMON_SPAWN_REASON ?? "manual"})`
|
|
22676
22390
|
);
|
|
@@ -22710,7 +22424,7 @@ function registerDaemon(program2) {
|
|
|
22710
22424
|
|
|
22711
22425
|
// src/commands/sessions/summarise/index.ts
|
|
22712
22426
|
import * as fs35 from "fs";
|
|
22713
|
-
import
|
|
22427
|
+
import chalk180 from "chalk";
|
|
22714
22428
|
|
|
22715
22429
|
// src/commands/sessions/summarise/shared.ts
|
|
22716
22430
|
import * as fs33 from "fs";
|
|
@@ -22861,25 +22575,25 @@ ${firstMessage}`);
|
|
|
22861
22575
|
}
|
|
22862
22576
|
|
|
22863
22577
|
// src/commands/sessions/summarise/index.ts
|
|
22864
|
-
async function
|
|
22578
|
+
async function summarise2(options2) {
|
|
22865
22579
|
const files = await discoverSessionFiles();
|
|
22866
22580
|
if (files.length === 0) {
|
|
22867
|
-
console.log(
|
|
22581
|
+
console.log(chalk180.yellow("No sessions found."));
|
|
22868
22582
|
return;
|
|
22869
22583
|
}
|
|
22870
22584
|
const toProcess = selectCandidates(files, options2);
|
|
22871
22585
|
if (toProcess.length === 0) {
|
|
22872
|
-
console.log(
|
|
22586
|
+
console.log(chalk180.green("All sessions already summarised."));
|
|
22873
22587
|
return;
|
|
22874
22588
|
}
|
|
22875
22589
|
console.log(
|
|
22876
|
-
|
|
22590
|
+
chalk180.cyan(
|
|
22877
22591
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
22878
22592
|
)
|
|
22879
22593
|
);
|
|
22880
22594
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
22881
22595
|
console.log(
|
|
22882
|
-
|
|
22596
|
+
chalk180.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk180.yellow(`, ${failed2} skipped`) : "")
|
|
22883
22597
|
);
|
|
22884
22598
|
}
|
|
22885
22599
|
function selectCandidates(files, options2) {
|
|
@@ -22899,16 +22613,16 @@ function processSessions(files) {
|
|
|
22899
22613
|
let failed2 = 0;
|
|
22900
22614
|
for (let i = 0; i < files.length; i++) {
|
|
22901
22615
|
const file = files[i];
|
|
22902
|
-
process.stdout.write(
|
|
22616
|
+
process.stdout.write(chalk180.dim(` [${i + 1}/${files.length}] `));
|
|
22903
22617
|
const summary = summariseSession(file);
|
|
22904
22618
|
if (summary) {
|
|
22905
22619
|
writeSummary(file, summary);
|
|
22906
22620
|
succeeded++;
|
|
22907
|
-
process.stdout.write(`${
|
|
22621
|
+
process.stdout.write(`${chalk180.green("\u2713")} ${summary}
|
|
22908
22622
|
`);
|
|
22909
22623
|
} else {
|
|
22910
22624
|
failed2++;
|
|
22911
|
-
process.stdout.write(` ${
|
|
22625
|
+
process.stdout.write(` ${chalk180.yellow("skip")}
|
|
22912
22626
|
`);
|
|
22913
22627
|
}
|
|
22914
22628
|
}
|
|
@@ -22919,17 +22633,17 @@ function processSessions(files) {
|
|
|
22919
22633
|
function registerSessions(program2) {
|
|
22920
22634
|
const cmd = program2.command("sessions").description("Web dashboard for Claude Code sessions").option("--no-open", "Do not open a browser on startup").action((options2) => web({ port: "3100", open: options2.open }));
|
|
22921
22635
|
cmd.command("web").description("Start the sessions web dashboard").option("-p, --port <number>", "Port to listen on", "3100").option("--no-open", "Do not open a browser on startup").action(web);
|
|
22922
|
-
cmd.command("summarise").description("Generate one-line summaries for Claude sessions").option("-f, --force", "Re-generate all summaries, even existing ones").option("-n, --limit <count>", "Maximum number of sessions to summarise").action(
|
|
22636
|
+
cmd.command("summarise").description("Generate one-line summaries for Claude sessions").option("-f, --force", "Re-generate all summaries, even existing ones").option("-n, --limit <count>", "Maximum number of sessions to summarise").action(summarise2);
|
|
22923
22637
|
cmd.command("set-status <status>").description(
|
|
22924
22638
|
"Report the current session's status to the sessions daemon (used by Claude Code hooks)"
|
|
22925
22639
|
).action(setSessionStatus);
|
|
22926
22640
|
}
|
|
22927
22641
|
|
|
22928
22642
|
// src/commands/statusLine.ts
|
|
22929
|
-
import
|
|
22643
|
+
import chalk182 from "chalk";
|
|
22930
22644
|
|
|
22931
22645
|
// src/commands/buildLimitsSegment.ts
|
|
22932
|
-
import
|
|
22646
|
+
import chalk181 from "chalk";
|
|
22933
22647
|
|
|
22934
22648
|
// src/shared/rateLimitLevel.ts
|
|
22935
22649
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -22960,9 +22674,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
22960
22674
|
|
|
22961
22675
|
// src/commands/buildLimitsSegment.ts
|
|
22962
22676
|
var LEVEL_COLOR = {
|
|
22963
|
-
ok:
|
|
22964
|
-
warn:
|
|
22965
|
-
over:
|
|
22677
|
+
ok: chalk181.green,
|
|
22678
|
+
warn: chalk181.yellow,
|
|
22679
|
+
over: chalk181.red
|
|
22966
22680
|
};
|
|
22967
22681
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
22968
22682
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -23002,14 +22716,14 @@ async function relayRateLimits(rateLimits) {
|
|
|
23002
22716
|
}
|
|
23003
22717
|
|
|
23004
22718
|
// src/commands/statusLine.ts
|
|
23005
|
-
|
|
22719
|
+
chalk182.level = 3;
|
|
23006
22720
|
function formatNumber(num) {
|
|
23007
22721
|
return num.toLocaleString("en-US");
|
|
23008
22722
|
}
|
|
23009
22723
|
function colorizePercent(pct) {
|
|
23010
22724
|
const label2 = `${Math.round(pct)}%`;
|
|
23011
|
-
if (pct > 80) return
|
|
23012
|
-
if (pct > 40) return
|
|
22725
|
+
if (pct > 80) return chalk182.red(label2);
|
|
22726
|
+
if (pct > 40) return chalk182.yellow(label2);
|
|
23013
22727
|
return label2;
|
|
23014
22728
|
}
|
|
23015
22729
|
async function statusLine() {
|
|
@@ -23033,7 +22747,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
23033
22747
|
// src/commands/sync/syncClaudeMd.ts
|
|
23034
22748
|
import * as fs36 from "fs";
|
|
23035
22749
|
import * as path53 from "path";
|
|
23036
|
-
import
|
|
22750
|
+
import chalk183 from "chalk";
|
|
23037
22751
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
23038
22752
|
const source = path53.join(claudeDir, "CLAUDE.md");
|
|
23039
22753
|
const target = path53.join(targetBase, "CLAUDE.md");
|
|
@@ -23042,12 +22756,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
23042
22756
|
const targetContent = fs36.readFileSync(target, "utf8");
|
|
23043
22757
|
if (sourceContent !== targetContent) {
|
|
23044
22758
|
console.log(
|
|
23045
|
-
|
|
22759
|
+
chalk183.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
23046
22760
|
);
|
|
23047
22761
|
console.log();
|
|
23048
22762
|
printDiff(targetContent, sourceContent);
|
|
23049
22763
|
const confirm = options2?.yes || await promptConfirm(
|
|
23050
|
-
|
|
22764
|
+
chalk183.red("Overwrite existing CLAUDE.md?"),
|
|
23051
22765
|
false
|
|
23052
22766
|
);
|
|
23053
22767
|
if (!confirm) {
|
|
@@ -23063,7 +22777,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
23063
22777
|
// src/commands/sync/syncSettings.ts
|
|
23064
22778
|
import * as fs37 from "fs";
|
|
23065
22779
|
import * as path54 from "path";
|
|
23066
|
-
import
|
|
22780
|
+
import chalk184 from "chalk";
|
|
23067
22781
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
23068
22782
|
const source = path54.join(claudeDir, "settings.json");
|
|
23069
22783
|
const target = path54.join(targetBase, "settings.json");
|
|
@@ -23079,14 +22793,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
23079
22793
|
if (mergedContent !== normalizedTarget) {
|
|
23080
22794
|
if (!options2?.yes) {
|
|
23081
22795
|
console.log(
|
|
23082
|
-
|
|
22796
|
+
chalk184.yellow(
|
|
23083
22797
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
23084
22798
|
)
|
|
23085
22799
|
);
|
|
23086
22800
|
console.log();
|
|
23087
22801
|
printDiff(targetContent, mergedContent);
|
|
23088
22802
|
const confirm = await promptConfirm(
|
|
23089
|
-
|
|
22803
|
+
chalk184.red("Overwrite existing settings.json?"),
|
|
23090
22804
|
false
|
|
23091
22805
|
);
|
|
23092
22806
|
if (!confirm) {
|