@staff0rd/assist 0.1008.0 → 0.1010.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/claude/commands/bug.md +5 -3
- package/claude/commands/devlog.md +41 -54
- package/claude/commands/draft.md +5 -3
- package/claude/commands/refine.md +2 -2
- package/dist/commands/sessions/web/bundle.js +389 -389
- package/dist/index.js +770 -687
- 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.1010.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -6074,7 +6074,7 @@ var devlogConfigHelp = [
|
|
|
6074
6074
|
{
|
|
6075
6075
|
key: "devlog.name",
|
|
6076
6076
|
setter: "assist config set devlog.name my-repo",
|
|
6077
|
-
note: "override the
|
|
6077
|
+
note: "override the project name weekly dev entries are filed under"
|
|
6078
6078
|
},
|
|
6079
6079
|
{
|
|
6080
6080
|
key: "devlog.ignore",
|
|
@@ -6083,8 +6083,8 @@ var devlogConfigHelp = [
|
|
|
6083
6083
|
},
|
|
6084
6084
|
{
|
|
6085
6085
|
key: "devlog.skip",
|
|
6086
|
-
setter: "assist devlog skip 2026-
|
|
6087
|
-
note: "
|
|
6086
|
+
setter: "assist devlog skip 2026-W33",
|
|
6087
|
+
note: "ISO weeks (YYYY-Www, per repo) that get no dev entry"
|
|
6088
6088
|
}
|
|
6089
6089
|
];
|
|
6090
6090
|
|
|
@@ -8653,8 +8653,8 @@ function subsequenceScore(text18, query) {
|
|
|
8653
8653
|
function scoreFilePath(path109, query) {
|
|
8654
8654
|
const needle = query.trim().toLowerCase();
|
|
8655
8655
|
if (!needle) return 0;
|
|
8656
|
-
const
|
|
8657
|
-
const inBasename = subsequenceScore(
|
|
8656
|
+
const basename35 = path109.slice(path109.lastIndexOf("/") + 1);
|
|
8657
|
+
const inBasename = subsequenceScore(basename35, needle);
|
|
8658
8658
|
if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
|
|
8659
8659
|
return subsequenceScore(path109, needle);
|
|
8660
8660
|
}
|
|
@@ -18873,6 +18873,7 @@ var activitySchema = z12.object({
|
|
|
18873
18873
|
name: z12.string().optional(),
|
|
18874
18874
|
itemId: z12.number().optional(),
|
|
18875
18875
|
itemName: z12.string().optional(),
|
|
18876
|
+
itemIds: z12.array(z12.number()).optional(),
|
|
18876
18877
|
phase: z12.number().optional(),
|
|
18877
18878
|
phaseName: z12.string().optional(),
|
|
18878
18879
|
totalPhases: z12.number().optional(),
|
|
@@ -19326,23 +19327,35 @@ import { randomUUID as randomUUID9 } from "crypto";
|
|
|
19326
19327
|
// src/commands/backlog/handleLaunchSignal.ts
|
|
19327
19328
|
import chalk85 from "chalk";
|
|
19328
19329
|
|
|
19329
|
-
// src/commands/backlog/
|
|
19330
|
-
|
|
19331
|
-
|
|
19332
|
-
|
|
19333
|
-
|
|
19334
|
-
|
|
19335
|
-
|
|
19336
|
-
|
|
19330
|
+
// src/commands/backlog/surfaceCreatedItems.ts
|
|
19331
|
+
function parseValidIds(ids) {
|
|
19332
|
+
const parsed = [];
|
|
19333
|
+
for (const id of ids) {
|
|
19334
|
+
try {
|
|
19335
|
+
parsed.push(parseItemId(id));
|
|
19336
|
+
} catch (error) {
|
|
19337
|
+
if (!(error instanceof InvalidItemIdError)) throw error;
|
|
19338
|
+
}
|
|
19337
19339
|
}
|
|
19340
|
+
return [...new Set(parsed)];
|
|
19341
|
+
}
|
|
19342
|
+
async function surfaceCreatedItems(slashCommand, ids) {
|
|
19343
|
+
const numericIds = parseValidIds(ids);
|
|
19344
|
+
if (numericIds.length === 0) return;
|
|
19338
19345
|
const { orm } = await getReady();
|
|
19339
|
-
const
|
|
19340
|
-
|
|
19346
|
+
const items2 = [];
|
|
19347
|
+
for (const id of numericIds) {
|
|
19348
|
+
const item = await loadItem(orm, id);
|
|
19349
|
+
if (item) items2.push(item);
|
|
19350
|
+
}
|
|
19351
|
+
const [first] = items2;
|
|
19352
|
+
if (!first) return;
|
|
19341
19353
|
emitActivity({
|
|
19342
19354
|
kind: "command",
|
|
19343
19355
|
name: slashCommand,
|
|
19344
|
-
itemId:
|
|
19345
|
-
itemName:
|
|
19356
|
+
itemId: first.id,
|
|
19357
|
+
itemName: first.name,
|
|
19358
|
+
...items2.length > 1 && { itemIds: items2.map((item) => item.id) }
|
|
19346
19359
|
});
|
|
19347
19360
|
}
|
|
19348
19361
|
|
|
@@ -19380,12 +19393,17 @@ Running backlog item ${label}...
|
|
|
19380
19393
|
}
|
|
19381
19394
|
|
|
19382
19395
|
// src/commands/backlog/handleLaunchSignal.ts
|
|
19396
|
+
function createdIds(signal) {
|
|
19397
|
+
const ids = Array.isArray(signal.ids) ? signal.ids : [signal.id];
|
|
19398
|
+
return ids.filter((id) => typeof id === "string" && !!id);
|
|
19399
|
+
}
|
|
19383
19400
|
async function handleLaunchSignal(slashCommand, once) {
|
|
19384
19401
|
const signal = readSignal();
|
|
19385
19402
|
cleanupSignal();
|
|
19386
19403
|
try {
|
|
19387
|
-
if (signal?.event === "done"
|
|
19388
|
-
|
|
19404
|
+
if (signal?.event === "done") {
|
|
19405
|
+
const ids = createdIds(signal);
|
|
19406
|
+
if (ids.length > 0) await surfaceCreatedItems(slashCommand, ids);
|
|
19389
19407
|
}
|
|
19390
19408
|
if (signal?.event === "next") {
|
|
19391
19409
|
if (typeof signal.id === "string" && signal.id) {
|
|
@@ -25228,37 +25246,217 @@ function registerDeploy(program) {
|
|
|
25228
25246
|
deployCommand.command("redirect").description("Add trailing slash redirect script to index.html").action(redirect);
|
|
25229
25247
|
}
|
|
25230
25248
|
|
|
25231
|
-
// src/commands/devlog/
|
|
25232
|
-
|
|
25233
|
-
|
|
25249
|
+
// src/commands/devlog/isoWeek.ts
|
|
25250
|
+
var DAY_MS = 864e5;
|
|
25251
|
+
var WEEK_ID_PATTERN = /^(\d{4})-W(\d{2})$/;
|
|
25252
|
+
function toUtc(date) {
|
|
25253
|
+
return /* @__PURE__ */ new Date(`${date}T00:00:00Z`);
|
|
25254
|
+
}
|
|
25255
|
+
function formatDate(date) {
|
|
25256
|
+
return date.toISOString().slice(0, 10);
|
|
25257
|
+
}
|
|
25258
|
+
function isoWeek(date) {
|
|
25259
|
+
const d = toUtc(date);
|
|
25260
|
+
const dayOfWeek = d.getUTCDay() || 7;
|
|
25261
|
+
const thursday = new Date(d.getTime() + (4 - dayOfWeek) * DAY_MS);
|
|
25262
|
+
const year = thursday.getUTCFullYear();
|
|
25263
|
+
const yearStart = Date.UTC(year, 0, 1);
|
|
25264
|
+
const week = Math.ceil(((thursday.getTime() - yearStart) / DAY_MS + 1) / 7);
|
|
25265
|
+
return `${year}-W${String(week).padStart(2, "0")}`;
|
|
25266
|
+
}
|
|
25267
|
+
function isoWeekRange(weekId) {
|
|
25268
|
+
const match = weekId.match(WEEK_ID_PATTERN);
|
|
25269
|
+
if (!match) throw new Error(`Invalid week id: ${weekId}`);
|
|
25270
|
+
const year = Number(match[1]);
|
|
25271
|
+
const week = Number(match[2]);
|
|
25272
|
+
const jan4 = new Date(Date.UTC(year, 0, 4));
|
|
25273
|
+
const jan4Day = jan4.getUTCDay() || 7;
|
|
25274
|
+
const week1Monday = jan4.getTime() - (jan4Day - 1) * DAY_MS;
|
|
25275
|
+
const start2 = new Date(week1Monday + (week - 1) * 7 * DAY_MS);
|
|
25276
|
+
const end = new Date(start2.getTime() + 6 * DAY_MS);
|
|
25277
|
+
return { start: formatDate(start2), end: formatDate(end) };
|
|
25278
|
+
}
|
|
25279
|
+
function isValidWeek(weekId) {
|
|
25280
|
+
const match = weekId.match(WEEK_ID_PATTERN);
|
|
25281
|
+
if (!match || Number(match[2]) < 1) return false;
|
|
25282
|
+
return isoWeek(isoWeekRange(weekId).start) === weekId;
|
|
25283
|
+
}
|
|
25284
|
+
function addDays(date, days) {
|
|
25285
|
+
return formatDate(new Date(toUtc(date).getTime() + days * DAY_MS));
|
|
25286
|
+
}
|
|
25287
|
+
function isCompletedWeek(weekId, today) {
|
|
25288
|
+
return isoWeekRange(weekId).end < today;
|
|
25289
|
+
}
|
|
25290
|
+
|
|
25291
|
+
// src/commands/devlog/list/printWeekHeader.ts
|
|
25292
|
+
import chalk158 from "chalk";
|
|
25293
|
+
function formatVersions(entry) {
|
|
25294
|
+
const { firstVersion: first, lastVersion: last } = entry;
|
|
25295
|
+
if (!first || !last) return first ?? last;
|
|
25296
|
+
return first === last ? first : `${first} \u2013 ${last}`;
|
|
25297
|
+
}
|
|
25298
|
+
function describeEntry(entry) {
|
|
25299
|
+
const versions = formatVersions(entry);
|
|
25300
|
+
const title = entry.title ?? chalk158.dim("untitled");
|
|
25301
|
+
return versions ? `${chalk158.green(versions)} ${title}` : title;
|
|
25302
|
+
}
|
|
25303
|
+
function describeWeek({ skipped, inProgress, entry }) {
|
|
25304
|
+
if (skipped) return chalk158.dim("skipped");
|
|
25305
|
+
if (entry) return describeEntry(entry);
|
|
25306
|
+
if (inProgress) return chalk158.dim("in progress");
|
|
25307
|
+
return chalk158.red("\u26A0 dev entry missing");
|
|
25308
|
+
}
|
|
25309
|
+
function printWeekHeader(week, state) {
|
|
25310
|
+
const { start: start2, end } = isoWeekRange(week);
|
|
25311
|
+
console.log(
|
|
25312
|
+
`${chalk158.bold.blue(week)} ${chalk158.dim(`${start2} \u2013 ${end}`)} ${describeWeek(state)}`
|
|
25313
|
+
);
|
|
25314
|
+
}
|
|
25234
25315
|
|
|
25235
|
-
// src/commands/devlog/
|
|
25316
|
+
// src/commands/devlog/loadBlogSkipWeeks.ts
|
|
25236
25317
|
import { homedir as homedir24 } from "os";
|
|
25237
25318
|
import { join as join65 } from "path";
|
|
25238
25319
|
var BLOG_REPO_ROOT = join65(homedir24(), "git/blog");
|
|
25239
|
-
function
|
|
25320
|
+
function loadBlogSkipWeeks(repoName) {
|
|
25240
25321
|
const config = loadRawYaml(join65(BLOG_REPO_ROOT, "assist.yml"));
|
|
25241
25322
|
const devlog = config.devlog;
|
|
25242
25323
|
const skip3 = devlog?.skip;
|
|
25243
25324
|
return new Set(skip3?.[repoName]);
|
|
25244
25325
|
}
|
|
25245
25326
|
|
|
25327
|
+
// src/commands/devlog/loadDevEntry.ts
|
|
25328
|
+
import { readFileSync as readFileSync37 } from "fs";
|
|
25329
|
+
import { join as join67 } from "path";
|
|
25330
|
+
import { parse as parseYaml3 } from "yaml";
|
|
25331
|
+
|
|
25332
|
+
// src/commands/devlog/loadDevWeeks.ts
|
|
25333
|
+
import { readdirSync as readdirSync8 } from "fs";
|
|
25334
|
+
import { join as join66 } from "path";
|
|
25335
|
+
var DEV_DIR = join66(BLOG_REPO_ROOT, "src/content/dev");
|
|
25336
|
+
var DEV_FILENAME_PATTERN = /^(\d{4})-w(\d{2})\.md$/;
|
|
25337
|
+
function parseDevWeekFilename(filename) {
|
|
25338
|
+
const match = filename.match(DEV_FILENAME_PATTERN);
|
|
25339
|
+
return match ? `${match[1]}-W${match[2]}` : null;
|
|
25340
|
+
}
|
|
25341
|
+
function readFilenames(dir) {
|
|
25342
|
+
try {
|
|
25343
|
+
return readdirSync8(dir);
|
|
25344
|
+
} catch {
|
|
25345
|
+
return [];
|
|
25346
|
+
}
|
|
25347
|
+
}
|
|
25348
|
+
function loadDevWeeks(repoName, devDir = DEV_DIR) {
|
|
25349
|
+
return readFilenames(join66(devDir, repoName)).map(parseDevWeekFilename).filter((week) => week !== null).sort();
|
|
25350
|
+
}
|
|
25351
|
+
|
|
25352
|
+
// src/commands/devlog/loadDevEntry.ts
|
|
25353
|
+
function asString(value) {
|
|
25354
|
+
return value === void 0 || value === null ? null : String(value);
|
|
25355
|
+
}
|
|
25356
|
+
function readFrontmatter(path109) {
|
|
25357
|
+
try {
|
|
25358
|
+
const match = readFileSync37(path109, "utf8").match(/^---\n([\s\S]*?)\n---/);
|
|
25359
|
+
return match ? parseYaml3(match[1]) ?? {} : null;
|
|
25360
|
+
} catch {
|
|
25361
|
+
return null;
|
|
25362
|
+
}
|
|
25363
|
+
}
|
|
25364
|
+
function loadDevEntry(repoName, week, devDir = DEV_DIR) {
|
|
25365
|
+
const path109 = join67(devDir, repoName, `${week.toLowerCase()}.md`);
|
|
25366
|
+
const frontmatter2 = readFrontmatter(path109);
|
|
25367
|
+
if (!frontmatter2) return null;
|
|
25368
|
+
const versions = frontmatter2.versions;
|
|
25369
|
+
return {
|
|
25370
|
+
title: asString(frontmatter2.title),
|
|
25371
|
+
firstVersion: asString(versions?.first),
|
|
25372
|
+
lastVersion: asString(versions?.last)
|
|
25373
|
+
};
|
|
25374
|
+
}
|
|
25375
|
+
|
|
25376
|
+
// src/commands/devlog/localToday.ts
|
|
25377
|
+
function localToday() {
|
|
25378
|
+
const now = /* @__PURE__ */ new Date();
|
|
25379
|
+
const pad3 = (n) => String(n).padStart(2, "0");
|
|
25380
|
+
return `${now.getFullYear()}-${pad3(now.getMonth() + 1)}-${pad3(now.getDate())}`;
|
|
25381
|
+
}
|
|
25382
|
+
|
|
25383
|
+
// src/commands/devlog/next/fetchCommitsAfter.ts
|
|
25384
|
+
import { execFileSync as execFileSync7 } from "child_process";
|
|
25385
|
+
var RECORD_SEPARATOR = "";
|
|
25386
|
+
function parseRecord(record) {
|
|
25387
|
+
const [header, ...fileLines] = record.trim().split("\n");
|
|
25388
|
+
if (!header) return null;
|
|
25389
|
+
const [date, hash, ...messageParts] = header.split("|");
|
|
25390
|
+
if (!date || !hash) return null;
|
|
25391
|
+
return {
|
|
25392
|
+
date,
|
|
25393
|
+
hash,
|
|
25394
|
+
message: messageParts.join("|"),
|
|
25395
|
+
files: fileLines.filter(Boolean)
|
|
25396
|
+
};
|
|
25397
|
+
}
|
|
25398
|
+
function isIgnored(commit2, ignore3) {
|
|
25399
|
+
if (ignore3.length === 0 || commit2.files.length === 0) return false;
|
|
25400
|
+
return commit2.files.every((file) => ignore3.some((p) => file.startsWith(p)));
|
|
25401
|
+
}
|
|
25402
|
+
function parseNameOnlyLog(output, ignore3, afterDate) {
|
|
25403
|
+
const byDate = /* @__PURE__ */ new Map();
|
|
25404
|
+
for (const record of output.split(RECORD_SEPARATOR)) {
|
|
25405
|
+
const commit2 = parseRecord(record);
|
|
25406
|
+
if (!commit2 || afterDate && commit2.date <= afterDate) continue;
|
|
25407
|
+
if (isIgnored(commit2, ignore3)) continue;
|
|
25408
|
+
byDate.set(commit2.date, [...byDate.get(commit2.date) ?? [], commit2]);
|
|
25409
|
+
}
|
|
25410
|
+
return byDate;
|
|
25411
|
+
}
|
|
25412
|
+
function fetchCommitsAfter(ignore3, afterDate) {
|
|
25413
|
+
const range = afterDate ? [`--since=${afterDate}T00:00:00`] : ["-n", "500"];
|
|
25414
|
+
const output = execFileSync7(
|
|
25415
|
+
"git",
|
|
25416
|
+
[
|
|
25417
|
+
"log",
|
|
25418
|
+
"--name-only",
|
|
25419
|
+
`--pretty=format:${RECORD_SEPARATOR}%ad|%h|%s`,
|
|
25420
|
+
"--date=short",
|
|
25421
|
+
...range
|
|
25422
|
+
],
|
|
25423
|
+
{ encoding: "utf8", maxBuffer: 256 * 1024 * 1024 }
|
|
25424
|
+
);
|
|
25425
|
+
return parseNameOnlyLog(output, ignore3, afterDate);
|
|
25426
|
+
}
|
|
25427
|
+
|
|
25428
|
+
// src/commands/devlog/next/findTargetWeek.ts
|
|
25429
|
+
function groupCommitsByWeek(commitsByDate) {
|
|
25430
|
+
const byWeek = /* @__PURE__ */ new Map();
|
|
25431
|
+
const dates = Array.from(commitsByDate.keys()).sort();
|
|
25432
|
+
for (const date of dates) {
|
|
25433
|
+
const week = isoWeek(date);
|
|
25434
|
+
const existing = byWeek.get(week) ?? [];
|
|
25435
|
+
const newestFirst2 = commitsByDate.get(date) ?? [];
|
|
25436
|
+
existing.push(...[...newestFirst2].reverse());
|
|
25437
|
+
byWeek.set(week, existing);
|
|
25438
|
+
}
|
|
25439
|
+
return byWeek;
|
|
25440
|
+
}
|
|
25441
|
+
function findTargetWeek(weeks, { lastWeek, skip: skip3, today }) {
|
|
25442
|
+
return Array.from(weeks).filter((week) => !lastWeek || week > lastWeek).filter((week) => !skip3.has(week)).filter((week) => isCompletedWeek(week, today)).sort()[0];
|
|
25443
|
+
}
|
|
25444
|
+
|
|
25246
25445
|
// src/commands/devlog/shared.ts
|
|
25247
|
-
import
|
|
25248
|
-
import chalk158 from "chalk";
|
|
25446
|
+
import chalk159 from "chalk";
|
|
25249
25447
|
|
|
25250
25448
|
// src/shared/getRepoName.ts
|
|
25251
|
-
import { existsSync as existsSync54, readFileSync as
|
|
25252
|
-
import { basename as basename17, join as
|
|
25449
|
+
import { existsSync as existsSync54, readFileSync as readFileSync38 } from "fs";
|
|
25450
|
+
import { basename as basename17, join as join68 } from "path";
|
|
25253
25451
|
function getRepoName() {
|
|
25254
25452
|
const config = loadConfig();
|
|
25255
25453
|
if (config.devlog?.name) {
|
|
25256
25454
|
return config.devlog.name;
|
|
25257
25455
|
}
|
|
25258
|
-
const packageJsonPath =
|
|
25456
|
+
const packageJsonPath = join68(process.cwd(), "package.json");
|
|
25259
25457
|
if (existsSync54(packageJsonPath)) {
|
|
25260
25458
|
try {
|
|
25261
|
-
const content =
|
|
25459
|
+
const content = readFileSync38(packageJsonPath, "utf8");
|
|
25262
25460
|
const pkg = JSON.parse(content);
|
|
25263
25461
|
if (pkg.name) {
|
|
25264
25462
|
return pkg.name;
|
|
@@ -25269,174 +25467,76 @@ function getRepoName() {
|
|
|
25269
25467
|
return basename17(process.cwd());
|
|
25270
25468
|
}
|
|
25271
25469
|
|
|
25272
|
-
// src/commands/devlog/loadDevlogEntries.ts
|
|
25273
|
-
import { readdirSync as readdirSync8, readFileSync as readFileSync38 } from "fs";
|
|
25274
|
-
import { join as join67 } from "path";
|
|
25275
|
-
var DEVLOG_DIR = join67(BLOG_REPO_ROOT, "src/content/devlog");
|
|
25276
|
-
function extractFrontmatter(content) {
|
|
25277
|
-
const fm = content.match(/^---\n([\s\S]*?)\n---/);
|
|
25278
|
-
return fm?.[1] ?? null;
|
|
25279
|
-
}
|
|
25280
|
-
function matchField(frontmatter2, pattern2) {
|
|
25281
|
-
return frontmatter2.match(pattern2)?.[1]?.trim() ?? null;
|
|
25282
|
-
}
|
|
25283
|
-
function parseFrontmatter(content, filename) {
|
|
25284
|
-
const frontmatter2 = extractFrontmatter(content);
|
|
25285
|
-
if (!frontmatter2) return null;
|
|
25286
|
-
const date = matchField(frontmatter2, /date:\s*"?(\d{4}-\d{2}-\d{2})"?/);
|
|
25287
|
-
const tagsRaw = matchField(frontmatter2, /tags:\s*\[([^\]]*)\]/);
|
|
25288
|
-
if (!date || !tagsRaw) return null;
|
|
25289
|
-
const repoTag = tagsRaw.split(",")[0]?.trim();
|
|
25290
|
-
if (!repoTag) return null;
|
|
25291
|
-
return {
|
|
25292
|
-
date,
|
|
25293
|
-
repoTag,
|
|
25294
|
-
version: matchField(frontmatter2, /version:\s*(.+)/),
|
|
25295
|
-
title: matchField(frontmatter2, /title:\s*(.+)/),
|
|
25296
|
-
filename
|
|
25297
|
-
};
|
|
25298
|
-
}
|
|
25299
|
-
function readDevlogFiles(callback) {
|
|
25300
|
-
try {
|
|
25301
|
-
const files = readdirSync8(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
25302
|
-
for (const file of files) {
|
|
25303
|
-
const content = readFileSync38(join67(DEVLOG_DIR, file), "utf8");
|
|
25304
|
-
const parsed = parseFrontmatter(content, file);
|
|
25305
|
-
if (parsed) callback(parsed);
|
|
25306
|
-
}
|
|
25307
|
-
} catch {
|
|
25308
|
-
}
|
|
25309
|
-
}
|
|
25310
|
-
function loadDevlogEntries(repoName) {
|
|
25311
|
-
const entries = /* @__PURE__ */ new Map();
|
|
25312
|
-
readDevlogFiles((parsed) => {
|
|
25313
|
-
if (parsed.repoTag !== repoName) return;
|
|
25314
|
-
if (!parsed.version || !parsed.title) return;
|
|
25315
|
-
const existing = entries.get(parsed.date) || [];
|
|
25316
|
-
existing.push({
|
|
25317
|
-
version: parsed.version,
|
|
25318
|
-
title: parsed.title,
|
|
25319
|
-
filename: parsed.filename
|
|
25320
|
-
});
|
|
25321
|
-
entries.set(parsed.date, existing);
|
|
25322
|
-
});
|
|
25323
|
-
return entries;
|
|
25324
|
-
}
|
|
25325
|
-
function loadAllDevlogLatestDates() {
|
|
25326
|
-
const latest2 = /* @__PURE__ */ new Map();
|
|
25327
|
-
readDevlogFiles((parsed) => {
|
|
25328
|
-
const existing = latest2.get(parsed.repoTag);
|
|
25329
|
-
if (!existing || parsed.date > existing) {
|
|
25330
|
-
latest2.set(parsed.repoTag, parsed.date);
|
|
25331
|
-
}
|
|
25332
|
-
});
|
|
25333
|
-
return latest2;
|
|
25334
|
-
}
|
|
25335
|
-
|
|
25336
25470
|
// src/commands/devlog/shared.ts
|
|
25337
|
-
function getCommitFiles(hash) {
|
|
25338
|
-
try {
|
|
25339
|
-
const output = execSync33(`git show --name-only --format="" ${hash}`, {
|
|
25340
|
-
encoding: "utf8"
|
|
25341
|
-
});
|
|
25342
|
-
return output.trim().split("\n").filter(Boolean);
|
|
25343
|
-
} catch {
|
|
25344
|
-
return [];
|
|
25345
|
-
}
|
|
25346
|
-
}
|
|
25347
|
-
function shouldIgnoreCommit(files, ignorePaths) {
|
|
25348
|
-
if (ignorePaths.length === 0 || files.length === 0) {
|
|
25349
|
-
return false;
|
|
25350
|
-
}
|
|
25351
|
-
return files.every(
|
|
25352
|
-
(file) => ignorePaths.some((ignorePath) => file.startsWith(ignorePath))
|
|
25353
|
-
);
|
|
25354
|
-
}
|
|
25355
25471
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
25356
25472
|
for (const commit2 of commits2) {
|
|
25357
|
-
console.log(
|
|
25473
|
+
console.log(
|
|
25474
|
+
` ${chalk159.dim(commit2.date)} ${chalk159.yellow(commit2.hash)} ${commit2.message}`
|
|
25475
|
+
);
|
|
25358
25476
|
if (verbose) {
|
|
25359
25477
|
const visibleFiles = commit2.files.filter(
|
|
25360
25478
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
25361
25479
|
);
|
|
25362
25480
|
for (const file of visibleFiles) {
|
|
25363
|
-
console.log(` ${
|
|
25481
|
+
console.log(` ${chalk159.dim(file)}`);
|
|
25364
25482
|
}
|
|
25365
25483
|
}
|
|
25366
25484
|
}
|
|
25367
25485
|
}
|
|
25368
|
-
function parseGitLogCommits(output, ignore3, afterDate) {
|
|
25369
|
-
const lines2 = output.trim().split("\n");
|
|
25370
|
-
const commitsByDate = /* @__PURE__ */ new Map();
|
|
25371
|
-
for (const line of lines2) {
|
|
25372
|
-
const [date, hash, ...messageParts] = line.split("|");
|
|
25373
|
-
const message3 = messageParts.join("|");
|
|
25374
|
-
if (afterDate && date <= afterDate) {
|
|
25375
|
-
continue;
|
|
25376
|
-
}
|
|
25377
|
-
const files = getCommitFiles(hash);
|
|
25378
|
-
if (!shouldIgnoreCommit(files, ignore3)) {
|
|
25379
|
-
const existing = commitsByDate.get(date) || [];
|
|
25380
|
-
existing.push({ date, hash, message: message3, files });
|
|
25381
|
-
commitsByDate.set(date, existing);
|
|
25382
|
-
}
|
|
25383
|
-
}
|
|
25384
|
-
return commitsByDate;
|
|
25385
|
-
}
|
|
25386
25486
|
|
|
25387
|
-
// src/commands/devlog/list/
|
|
25388
|
-
import
|
|
25389
|
-
|
|
25390
|
-
|
|
25391
|
-
|
|
25392
|
-
|
|
25393
|
-
|
|
25394
|
-
|
|
25395
|
-
|
|
25396
|
-
|
|
25397
|
-
|
|
25487
|
+
// src/commands/devlog/list/resolveListAfterDate.ts
|
|
25488
|
+
import chalk160 from "chalk";
|
|
25489
|
+
var DATE_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
25490
|
+
function resolveListAfterDate(options2, today) {
|
|
25491
|
+
if (options2.since) return addDays(resolveSinceDate(options2.since), -1);
|
|
25492
|
+
const weeks = Math.max(1, options2.weeks ?? 6);
|
|
25493
|
+
const currentMonday = isoWeekRange(isoWeek(today)).start;
|
|
25494
|
+
return addDays(currentMonday, -7 * (weeks - 1) - 1);
|
|
25495
|
+
}
|
|
25496
|
+
function resolveSinceDate(since) {
|
|
25497
|
+
if (isValidWeek(since)) return isoWeekRange(since).start;
|
|
25498
|
+
if (DATE_PATTERN.test(since)) return since;
|
|
25499
|
+
console.log(
|
|
25500
|
+
chalk160.red("Invalid --since. Use YYYY-MM-DD or YYYY-Www (e.g. 2026-W33)")
|
|
25501
|
+
);
|
|
25502
|
+
process.exit(1);
|
|
25398
25503
|
}
|
|
25399
25504
|
|
|
25400
25505
|
// src/commands/devlog/list.ts
|
|
25401
25506
|
function list2(options2) {
|
|
25402
25507
|
const config = loadConfig();
|
|
25403
|
-
const days = options2.days ?? 30;
|
|
25404
25508
|
const ignore3 = options2.ignore ?? config.devlog?.ignore ?? [];
|
|
25405
|
-
const repoName =
|
|
25406
|
-
const
|
|
25407
|
-
const
|
|
25408
|
-
const
|
|
25409
|
-
|
|
25410
|
-
|
|
25411
|
-
|
|
25412
|
-
|
|
25413
|
-
|
|
25414
|
-
|
|
25415
|
-
|
|
25416
|
-
|
|
25417
|
-
|
|
25418
|
-
|
|
25419
|
-
|
|
25420
|
-
|
|
25421
|
-
|
|
25422
|
-
|
|
25423
|
-
|
|
25424
|
-
|
|
25425
|
-
|
|
25426
|
-
console.log();
|
|
25427
|
-
}
|
|
25428
|
-
isFirst = false;
|
|
25429
|
-
printDateHeader(date, skipDays.has(date), devlogEntries.get(date));
|
|
25430
|
-
printCommitsWithFiles(dateCommits, ignore3, options2.verbose ?? false);
|
|
25431
|
-
}
|
|
25509
|
+
const repoName = getRepoName();
|
|
25510
|
+
const today = localToday();
|
|
25511
|
+
const skip3 = loadBlogSkipWeeks(repoName);
|
|
25512
|
+
const byWeek = groupCommitsByWeek(
|
|
25513
|
+
fetchCommitsAfter(ignore3, resolveListAfterDate(options2, today))
|
|
25514
|
+
);
|
|
25515
|
+
const weeks = Array.from(byWeek.keys()).sort();
|
|
25516
|
+
if (!options2.reverse) weeks.reverse();
|
|
25517
|
+
weeks.forEach((week, index2) => {
|
|
25518
|
+
if (index2 > 0) console.log();
|
|
25519
|
+
printWeekHeader(week, {
|
|
25520
|
+
skipped: skip3.has(week),
|
|
25521
|
+
inProgress: !isCompletedWeek(week, today),
|
|
25522
|
+
entry: loadDevEntry(repoName, week)
|
|
25523
|
+
});
|
|
25524
|
+
printCommitsWithFiles(
|
|
25525
|
+
byWeek.get(week) ?? [],
|
|
25526
|
+
ignore3,
|
|
25527
|
+
options2.verbose ?? false
|
|
25528
|
+
);
|
|
25529
|
+
});
|
|
25432
25530
|
}
|
|
25433
25531
|
|
|
25434
|
-
// src/commands/devlog/
|
|
25435
|
-
import
|
|
25436
|
-
|
|
25532
|
+
// src/commands/devlog/next/displayNextEntry.ts
|
|
25533
|
+
import chalk161 from "chalk";
|
|
25534
|
+
|
|
25535
|
+
// src/commands/devlog/getVersionAtCommit.ts
|
|
25536
|
+
import { execSync as execSync33 } from "child_process";
|
|
25437
25537
|
function getVersionAtCommit(hash) {
|
|
25438
25538
|
try {
|
|
25439
|
-
const content =
|
|
25539
|
+
const content = execSync33(`git show ${hash}:package.json`, {
|
|
25440
25540
|
encoding: "utf8"
|
|
25441
25541
|
});
|
|
25442
25542
|
const pkg = JSON.parse(content);
|
|
@@ -25445,171 +25545,147 @@ function getVersionAtCommit(hash) {
|
|
|
25445
25545
|
return null;
|
|
25446
25546
|
}
|
|
25447
25547
|
}
|
|
25548
|
+
|
|
25549
|
+
// src/commands/devlog/stripToMinor.ts
|
|
25550
|
+
import semver2 from "semver";
|
|
25448
25551
|
function stripToMinor(version2) {
|
|
25449
25552
|
const parsed = semver2.parse(semver2.coerce(version2));
|
|
25450
25553
|
return parsed ? `v${parsed.major}.${parsed.minor}` : `v${version2}`;
|
|
25451
25554
|
}
|
|
25452
|
-
|
|
25453
|
-
|
|
25454
|
-
|
|
25455
|
-
|
|
25456
|
-
|
|
25457
|
-
|
|
25458
|
-
|
|
25459
|
-
}
|
|
25460
|
-
).trim();
|
|
25461
|
-
const [date, hash] = output.split("|");
|
|
25462
|
-
if (!date || !hash) return null;
|
|
25463
|
-
const version2 = getVersionAtCommit(hash);
|
|
25464
|
-
if (!version2) return null;
|
|
25465
|
-
return { date, version: stripToMinor(version2) };
|
|
25466
|
-
} catch {
|
|
25467
|
-
return null;
|
|
25468
|
-
}
|
|
25469
|
-
}
|
|
25470
|
-
function findLastDate(entries) {
|
|
25471
|
-
const dates = Array.from(entries.keys()).sort().reverse();
|
|
25472
|
-
return dates[0] ?? null;
|
|
25473
|
-
}
|
|
25474
|
-
function getLastVersionInfo(repoName, config) {
|
|
25475
|
-
const entries = loadDevlogEntries(repoName);
|
|
25476
|
-
const lastDate = findLastDate(entries);
|
|
25477
|
-
if (!lastDate) return null;
|
|
25478
|
-
if (config?.commit?.conventional) {
|
|
25479
|
-
const gitInfo = getLastVersionInfoFromGit();
|
|
25480
|
-
if (gitInfo) return { date: lastDate, version: gitInfo.version };
|
|
25481
|
-
}
|
|
25482
|
-
const dayEntries = entries.get(lastDate);
|
|
25483
|
-
const lastVersion = dayEntries?.[dayEntries.length - 1]?.version;
|
|
25484
|
-
return lastVersion ? { date: lastDate, version: lastVersion } : null;
|
|
25555
|
+
|
|
25556
|
+
// src/commands/devlog/next/displayNextEntry.ts
|
|
25557
|
+
function withVersions(commits2) {
|
|
25558
|
+
return commits2.map((commit2) => {
|
|
25559
|
+
const version2 = getVersionAtCommit(commit2.hash);
|
|
25560
|
+
return { ...commit2, version: version2 ? stripToMinor(version2) : null };
|
|
25561
|
+
});
|
|
25485
25562
|
}
|
|
25486
|
-
function
|
|
25487
|
-
|
|
25563
|
+
function versionRange(commits2) {
|
|
25564
|
+
const versions = commits2.map((c) => c.version).filter((v) => v !== null);
|
|
25565
|
+
if (versions.length === 0) return null;
|
|
25566
|
+
const first = versions[0];
|
|
25567
|
+
const last = versions[versions.length - 1];
|
|
25568
|
+
return first === last ? first : `${first} \u2013 ${last}`;
|
|
25488
25569
|
}
|
|
25489
|
-
function
|
|
25490
|
-
|
|
25491
|
-
if (!cleaned) return version2;
|
|
25492
|
-
const bumped = semver2.inc(cleaned, type);
|
|
25493
|
-
if (!bumped) return version2;
|
|
25494
|
-
if (type === "minor") return stripToMinor(bumped);
|
|
25495
|
-
return `v${bumped}`;
|
|
25570
|
+
function printField(label, value) {
|
|
25571
|
+
console.log(`${chalk161.bold(`${label}:`)} ${value}`);
|
|
25496
25572
|
}
|
|
25497
|
-
|
|
25498
|
-
|
|
25499
|
-
|
|
25500
|
-
import chalk161 from "chalk";
|
|
25501
|
-
|
|
25502
|
-
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
25503
|
-
import chalk160 from "chalk";
|
|
25504
|
-
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
25505
|
-
if (conventional && firstHash) {
|
|
25506
|
-
const version2 = getVersionAtCommit(firstHash);
|
|
25507
|
-
if (version2) {
|
|
25508
|
-
console.log(`${chalk160.bold("version:")} ${stripToMinor(version2)}`);
|
|
25509
|
-
} else {
|
|
25510
|
-
console.log(`${chalk160.bold("version:")} ${chalk160.red("unknown")}`);
|
|
25511
|
-
}
|
|
25512
|
-
} else if (patchVersion && minorVersion) {
|
|
25573
|
+
function printCommits(commits2, ignore3, verbose) {
|
|
25574
|
+
for (const commit2 of commits2) {
|
|
25575
|
+
const version2 = commit2.version ? ` ${chalk161.cyan(commit2.version)}` : "";
|
|
25513
25576
|
console.log(
|
|
25514
|
-
|
|
25577
|
+
` ${chalk161.dim(commit2.date)} ${chalk161.yellow(commit2.hash)}${version2} ${commit2.message}`
|
|
25515
25578
|
);
|
|
25516
|
-
|
|
25517
|
-
|
|
25579
|
+
if (!verbose) continue;
|
|
25580
|
+
for (const file of commit2.files) {
|
|
25581
|
+
if (!ignore3.some((p) => file.startsWith(p))) {
|
|
25582
|
+
console.log(` ${chalk161.dim(file)}`);
|
|
25583
|
+
}
|
|
25584
|
+
}
|
|
25518
25585
|
}
|
|
25519
25586
|
}
|
|
25520
|
-
|
|
25521
|
-
|
|
25522
|
-
|
|
25523
|
-
|
|
25524
|
-
|
|
25525
|
-
|
|
25526
|
-
|
|
25527
|
-
|
|
25528
|
-
|
|
25529
|
-
function findTargetDate(commitsByDate, skipDays) {
|
|
25530
|
-
return Array.from(commitsByDate.keys()).filter((d) => !skipDays.has(d)).sort()[0];
|
|
25531
|
-
}
|
|
25532
|
-
function fetchCommitsByDate(ignore3, lastDate) {
|
|
25533
|
-
const output = execFileSync9(
|
|
25534
|
-
"git",
|
|
25535
|
-
["log", "--pretty=format:%ad|%h|%s", "--date=short", "-n", "500"],
|
|
25536
|
-
{ encoding: "utf8" }
|
|
25537
|
-
);
|
|
25538
|
-
return parseGitLogCommits(output, ignore3, lastDate);
|
|
25587
|
+
function displayNextEntry(ctx, week, commits2) {
|
|
25588
|
+
const versioned = withVersions(commits2);
|
|
25589
|
+
const { start: start2, end } = isoWeekRange(week);
|
|
25590
|
+
printField("name", ctx.repoName);
|
|
25591
|
+
printField("week", chalk161.bold.blue(week));
|
|
25592
|
+
printField("range", `${start2} \u2013 ${end}`);
|
|
25593
|
+
const versions = versionRange(versioned);
|
|
25594
|
+
if (versions) printField("versions", versions);
|
|
25595
|
+
printCommits(versioned, ctx.ignore, ctx.verbose);
|
|
25539
25596
|
}
|
|
25540
|
-
function
|
|
25541
|
-
|
|
25542
|
-
|
|
25543
|
-
|
|
25544
|
-
|
|
25545
|
-
versions.patch,
|
|
25546
|
-
versions.minor
|
|
25597
|
+
function logNoCommits(lastWeek) {
|
|
25598
|
+
console.log(
|
|
25599
|
+
chalk161.dim(
|
|
25600
|
+
lastWeek ? `No completed weeks with commits after ${lastWeek}` : "No completed weeks with commits found"
|
|
25601
|
+
)
|
|
25547
25602
|
);
|
|
25548
25603
|
}
|
|
25549
|
-
|
|
25550
|
-
|
|
25551
|
-
}
|
|
25552
|
-
|
|
25553
|
-
|
|
25554
|
-
|
|
25555
|
-
|
|
25556
|
-
|
|
25557
|
-
}
|
|
25558
|
-
|
|
25559
|
-
|
|
25560
|
-
}
|
|
25561
|
-
function noCommitsMessage(hasLastInfo) {
|
|
25562
|
-
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
25563
|
-
}
|
|
25564
|
-
function logName(repoName) {
|
|
25565
|
-
console.log(`${chalk161.bold("name:")} ${repoName}`);
|
|
25604
|
+
|
|
25605
|
+
// src/commands/devlog/next/loadLastDailyDevlogDate.ts
|
|
25606
|
+
import { readdirSync as readdirSync9, readFileSync as readFileSync39 } from "fs";
|
|
25607
|
+
import { join as join69 } from "path";
|
|
25608
|
+
var DEVLOG_DIR = join69(BLOG_REPO_ROOT, "src/content/devlog");
|
|
25609
|
+
function readMarkdownFiles(dir) {
|
|
25610
|
+
try {
|
|
25611
|
+
return readdirSync9(dir).filter((file) => file.endsWith(".md"));
|
|
25612
|
+
} catch {
|
|
25613
|
+
return [];
|
|
25614
|
+
}
|
|
25566
25615
|
}
|
|
25567
|
-
function
|
|
25568
|
-
|
|
25569
|
-
|
|
25570
|
-
|
|
25571
|
-
|
|
25616
|
+
function parseDateForRepo(content, repoName) {
|
|
25617
|
+
const frontmatter2 = content.match(/^---\n([\s\S]*?)\n---/)?.[1];
|
|
25618
|
+
if (!frontmatter2) return null;
|
|
25619
|
+
const date = frontmatter2.match(/date:\s*"?(\d{4}-\d{2}-\d{2})"?/)?.[1];
|
|
25620
|
+
const repoTag = frontmatter2.match(/tags:\s*\[([^,\]]*)/)?.[1]?.trim();
|
|
25621
|
+
return date && repoTag === repoName ? date : null;
|
|
25572
25622
|
}
|
|
25573
|
-
function
|
|
25574
|
-
|
|
25623
|
+
function loadLastDailyDevlogDate(repoName, devlogDir = DEVLOG_DIR) {
|
|
25624
|
+
let latest2 = null;
|
|
25625
|
+
for (const file of readMarkdownFiles(devlogDir)) {
|
|
25626
|
+
const content = readFileSync39(join69(devlogDir, file), "utf8");
|
|
25627
|
+
const date = parseDateForRepo(content, repoName);
|
|
25628
|
+
if (date && (!latest2 || date > latest2)) latest2 = date;
|
|
25629
|
+
}
|
|
25630
|
+
return latest2;
|
|
25575
25631
|
}
|
|
25576
25632
|
|
|
25577
25633
|
// src/commands/devlog/next.ts
|
|
25578
|
-
function
|
|
25579
|
-
|
|
25580
|
-
|
|
25581
|
-
return { repoName, lastInfo, ignore: resolveIgnoreList(options2, config) };
|
|
25634
|
+
function resolveAfterDate(repoName, lastWeek) {
|
|
25635
|
+
if (lastWeek) return isoWeekRange(lastWeek).end;
|
|
25636
|
+
return loadLastDailyDevlogDate(repoName);
|
|
25582
25637
|
}
|
|
25583
|
-
function
|
|
25638
|
+
function next2(options2) {
|
|
25584
25639
|
const config = loadConfig();
|
|
25585
|
-
const
|
|
25586
|
-
|
|
25587
|
-
|
|
25588
|
-
|
|
25589
|
-
const
|
|
25590
|
-
|
|
25591
|
-
|
|
25592
|
-
|
|
25593
|
-
|
|
25594
|
-
|
|
25595
|
-
|
|
25640
|
+
const repoName = getRepoName();
|
|
25641
|
+
const ignore3 = options2.ignore ?? config.devlog?.ignore ?? [];
|
|
25642
|
+
const lastWeek = loadDevWeeks(repoName).at(-1) ?? null;
|
|
25643
|
+
const afterDate = resolveAfterDate(repoName, lastWeek);
|
|
25644
|
+
const byWeek = groupCommitsByWeek(fetchCommitsAfter(ignore3, afterDate));
|
|
25645
|
+
const week = findTargetWeek(byWeek.keys(), {
|
|
25646
|
+
lastWeek,
|
|
25647
|
+
skip: loadBlogSkipWeeks(repoName),
|
|
25648
|
+
today: localToday()
|
|
25649
|
+
});
|
|
25650
|
+
if (!week) {
|
|
25651
|
+
logNoCommits(lastWeek);
|
|
25652
|
+
return;
|
|
25653
|
+
}
|
|
25654
|
+
displayNextEntry(
|
|
25655
|
+
{ repoName, ignore: ignore3, verbose: options2.verbose ?? false },
|
|
25656
|
+
week,
|
|
25657
|
+
byWeek.get(week) ?? []
|
|
25596
25658
|
);
|
|
25597
|
-
return targetDate ? { targetDate, commits: getCommitsForDate(commitsByDate, targetDate) } : null;
|
|
25598
25659
|
}
|
|
25599
|
-
|
|
25600
|
-
|
|
25601
|
-
|
|
25602
|
-
|
|
25660
|
+
|
|
25661
|
+
// src/commands/devlog/repos.ts
|
|
25662
|
+
import { execSync as execSync34 } from "child_process";
|
|
25663
|
+
|
|
25664
|
+
// src/commands/devlog/loadAllDevLatestWeeks.ts
|
|
25665
|
+
import { readdirSync as readdirSync10 } from "fs";
|
|
25666
|
+
function readRepoDirs(devDir) {
|
|
25667
|
+
try {
|
|
25668
|
+
return readdirSync10(devDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
25669
|
+
} catch {
|
|
25670
|
+
return [];
|
|
25603
25671
|
}
|
|
25604
|
-
displayNextEntry(ctx, found.targetDate, found.commits);
|
|
25605
25672
|
}
|
|
25606
|
-
function
|
|
25607
|
-
const
|
|
25608
|
-
|
|
25673
|
+
function loadAllDevLatestWeeks(devDir = DEV_DIR) {
|
|
25674
|
+
const latest2 = /* @__PURE__ */ new Map();
|
|
25675
|
+
for (const repo of readRepoDirs(devDir)) {
|
|
25676
|
+
const week = loadDevWeeks(repo, devDir).at(-1);
|
|
25677
|
+
if (week) latest2.set(repo, week);
|
|
25678
|
+
}
|
|
25679
|
+
return latest2;
|
|
25609
25680
|
}
|
|
25610
25681
|
|
|
25611
|
-
// src/commands/devlog/repos.ts
|
|
25612
|
-
|
|
25682
|
+
// src/commands/devlog/repos/getRepoStatus.ts
|
|
25683
|
+
function getRepoStatus(lastPush, lastWeek, today) {
|
|
25684
|
+
if (!lastWeek) return "missing";
|
|
25685
|
+
const latestCompletedWeek = isoWeek(addDays(today, -7));
|
|
25686
|
+
const pushedAfterLastWeek = isoWeek(lastPush) > lastWeek;
|
|
25687
|
+
return pushedAfterLastWeek && lastWeek < latestCompletedWeek ? "outdated" : "ok";
|
|
25688
|
+
}
|
|
25613
25689
|
|
|
25614
25690
|
// src/commands/devlog/repos/printReposTable.ts
|
|
25615
25691
|
import chalk162 from "chalk";
|
|
@@ -25619,15 +25695,15 @@ function colorStatus(status2) {
|
|
|
25619
25695
|
return chalk162.green(status2);
|
|
25620
25696
|
}
|
|
25621
25697
|
function formatRow(row3, nameWidth) {
|
|
25622
|
-
const
|
|
25623
|
-
return `${row3.name.padEnd(nameWidth)} ${row3.lastPush} ${
|
|
25698
|
+
const week = (row3.lastWeek ?? "-").padEnd(9);
|
|
25699
|
+
return `${row3.name.padEnd(nameWidth)} ${row3.lastPush} ${week} ${colorStatus(row3.status)}`;
|
|
25624
25700
|
}
|
|
25625
25701
|
function printReposTable(rows) {
|
|
25626
25702
|
const nameWidth = Math.max(4, ...rows.map((r) => r.name.length));
|
|
25627
25703
|
const header = [
|
|
25628
25704
|
"Repo".padEnd(nameWidth),
|
|
25629
25705
|
"Last Push".padEnd(10),
|
|
25630
|
-
"Last
|
|
25706
|
+
"Last Week".padEnd(9),
|
|
25631
25707
|
"Status"
|
|
25632
25708
|
].join(" ");
|
|
25633
25709
|
console.log(chalk162.dim(header));
|
|
@@ -25639,12 +25715,8 @@ function printReposTable(rows) {
|
|
|
25639
25715
|
|
|
25640
25716
|
// src/commands/devlog/repos.ts
|
|
25641
25717
|
var statusOrder = { missing: 0, outdated: 1, ok: 2 };
|
|
25642
|
-
function getStatus(lastPush, lastDevlog) {
|
|
25643
|
-
if (!lastDevlog) return "missing";
|
|
25644
|
-
return lastDevlog < lastPush ? "outdated" : "ok";
|
|
25645
|
-
}
|
|
25646
25718
|
function fetchRepos(days, all) {
|
|
25647
|
-
const json =
|
|
25719
|
+
const json = execSync34(
|
|
25648
25720
|
"gh repo list staff0rd --json name,pushedAt,isArchived --limit 200",
|
|
25649
25721
|
{ encoding: "utf8" }
|
|
25650
25722
|
);
|
|
@@ -25658,14 +25730,14 @@ function fetchRepos(days, all) {
|
|
|
25658
25730
|
return r.pushedAt.slice(0, 10) >= cutoffStr;
|
|
25659
25731
|
});
|
|
25660
25732
|
}
|
|
25661
|
-
function toRow(repo,
|
|
25733
|
+
function toRow(repo, latestWeeks, today) {
|
|
25662
25734
|
const lastPush = repo.pushedAt.slice(0, 10);
|
|
25663
|
-
const
|
|
25735
|
+
const lastWeek = latestWeeks.get(repo.name) ?? null;
|
|
25664
25736
|
return {
|
|
25665
25737
|
name: repo.name,
|
|
25666
25738
|
lastPush,
|
|
25667
|
-
|
|
25668
|
-
status:
|
|
25739
|
+
lastWeek,
|
|
25740
|
+
status: getRepoStatus(lastPush, lastWeek, today)
|
|
25669
25741
|
};
|
|
25670
25742
|
}
|
|
25671
25743
|
function sortRows(rows) {
|
|
@@ -25681,22 +25753,23 @@ function repos(options2) {
|
|
|
25681
25753
|
console.log("No repos with recent activity found.");
|
|
25682
25754
|
return;
|
|
25683
25755
|
}
|
|
25684
|
-
const
|
|
25685
|
-
const
|
|
25756
|
+
const latestWeeks = loadAllDevLatestWeeks();
|
|
25757
|
+
const today = localToday();
|
|
25758
|
+
const rows = ghRepos.map((repo) => toRow(repo, latestWeeks, today));
|
|
25686
25759
|
printReposTable(sortRows(rows));
|
|
25687
25760
|
}
|
|
25688
25761
|
|
|
25689
25762
|
// src/commands/devlog/skip.ts
|
|
25690
25763
|
import { writeFileSync as writeFileSync32 } from "fs";
|
|
25691
|
-
import { join as
|
|
25764
|
+
import { join as join70 } from "path";
|
|
25692
25765
|
import chalk163 from "chalk";
|
|
25693
25766
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
25694
25767
|
function getBlogConfigPath() {
|
|
25695
|
-
return
|
|
25768
|
+
return join70(BLOG_REPO_ROOT, "assist.yml");
|
|
25696
25769
|
}
|
|
25697
|
-
function skip2(
|
|
25698
|
-
if (
|
|
25699
|
-
console.log(chalk163.red("Invalid
|
|
25770
|
+
function skip2(week) {
|
|
25771
|
+
if (!isValidWeek(week)) {
|
|
25772
|
+
console.log(chalk163.red("Invalid week. Use YYYY-Www (e.g. 2026-W33)"));
|
|
25700
25773
|
process.exit(1);
|
|
25701
25774
|
}
|
|
25702
25775
|
const repoName = getRepoName();
|
|
@@ -25704,47 +25777,55 @@ function skip2(date) {
|
|
|
25704
25777
|
const config = loadRawYaml(configPath);
|
|
25705
25778
|
const devlog = config.devlog ?? {};
|
|
25706
25779
|
const skip3 = devlog.skip ?? {};
|
|
25707
|
-
const
|
|
25708
|
-
if (
|
|
25780
|
+
const skipWeeks = skip3[repoName] ?? [];
|
|
25781
|
+
if (skipWeeks.includes(week)) {
|
|
25709
25782
|
console.log(
|
|
25710
|
-
chalk163.yellow(`${
|
|
25783
|
+
chalk163.yellow(`${week} is already in skip list for ${repoName}`)
|
|
25711
25784
|
);
|
|
25712
25785
|
return;
|
|
25713
25786
|
}
|
|
25714
|
-
|
|
25715
|
-
|
|
25716
|
-
skip3[repoName] =
|
|
25787
|
+
skipWeeks.push(week);
|
|
25788
|
+
skipWeeks.sort();
|
|
25789
|
+
skip3[repoName] = skipWeeks;
|
|
25717
25790
|
devlog.skip = skip3;
|
|
25718
25791
|
config.devlog = devlog;
|
|
25719
25792
|
writeFileSync32(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
25720
|
-
console.log(chalk163.green(`Added ${
|
|
25793
|
+
console.log(chalk163.green(`Added ${week} to skip list for ${repoName}`));
|
|
25721
25794
|
}
|
|
25722
25795
|
|
|
25723
25796
|
// src/commands/devlog/version.ts
|
|
25724
25797
|
import chalk164 from "chalk";
|
|
25798
|
+
function printField2(label, value) {
|
|
25799
|
+
console.log(`${chalk164.bold(`${label}:`)} ${value ?? chalk164.dim("none")}`);
|
|
25800
|
+
}
|
|
25725
25801
|
function version() {
|
|
25726
|
-
const config = loadConfig();
|
|
25727
25802
|
const name = getRepoName();
|
|
25728
|
-
const
|
|
25729
|
-
const
|
|
25730
|
-
const
|
|
25731
|
-
|
|
25732
|
-
|
|
25733
|
-
|
|
25803
|
+
const lastWeek = loadDevWeeks(name).at(-1) ?? null;
|
|
25804
|
+
const entry = lastWeek ? loadDevEntry(name, lastWeek) : null;
|
|
25805
|
+
const current = getVersionAtCommit("HEAD");
|
|
25806
|
+
printField2("name", name);
|
|
25807
|
+
printField2("last week", lastWeek);
|
|
25808
|
+
printField2("last version", entry?.lastVersion);
|
|
25809
|
+
printField2("current", current ? stripToMinor(current) : null);
|
|
25734
25810
|
}
|
|
25735
25811
|
|
|
25736
25812
|
// src/commands/registerDevlog.ts
|
|
25737
25813
|
function registerDevlog(program) {
|
|
25738
25814
|
const devlogCommand = program.command("devlog").description("Development log utilities");
|
|
25739
|
-
devlogCommand.command("list").description("Group git commits by
|
|
25740
|
-
"--
|
|
25741
|
-
"Number of
|
|
25815
|
+
devlogCommand.command("list").description("Group git commits by ISO week").option(
|
|
25816
|
+
"--weeks <number>",
|
|
25817
|
+
"Number of weeks to show, including the current one (default: 6)",
|
|
25742
25818
|
Number.parseInt
|
|
25743
|
-
).option(
|
|
25744
|
-
|
|
25745
|
-
|
|
25746
|
-
|
|
25747
|
-
devlogCommand.command("
|
|
25819
|
+
).option(
|
|
25820
|
+
"--since <date|week>",
|
|
25821
|
+
"Only show commits since this date (YYYY-MM-DD) or week (YYYY-Www)"
|
|
25822
|
+
).option("-r, --reverse", "Show earliest weeks first").option("-v, --verbose", "Show file names for each commit").action(list2);
|
|
25823
|
+
devlogCommand.command("version").description("Show the repo name, its latest dev entry week and versions").action(version);
|
|
25824
|
+
devlogCommand.command("next").description(
|
|
25825
|
+
"Show commits for the next completed ISO week after the last dev entry"
|
|
25826
|
+
).option("-v, --verbose", "Show file names for each commit").action(next2);
|
|
25827
|
+
devlogCommand.command("skip <week>").description("Add an ISO week (YYYY-Www) to the skip list").action(skip2);
|
|
25828
|
+
devlogCommand.command("repos").description("Show repos missing weekly dev entries").option(
|
|
25748
25829
|
"--days <number>",
|
|
25749
25830
|
"Only show repos pushed within N days (default: 30)",
|
|
25750
25831
|
Number.parseInt
|
|
@@ -25773,13 +25854,13 @@ async function forwardPinConfirm(area, pin2) {
|
|
|
25773
25854
|
import { unlinkSync as unlinkSync10 } from "fs";
|
|
25774
25855
|
|
|
25775
25856
|
// src/commands/docs/getDocsUnlockPinPath.ts
|
|
25776
|
-
import { join as
|
|
25857
|
+
import { join as join71 } from "path";
|
|
25777
25858
|
function getDocsUnlockPinPath(pin2) {
|
|
25778
|
-
return
|
|
25859
|
+
return join71(getRestrictedDir(), `docs-unlock-pin-${pin2}.json`);
|
|
25779
25860
|
}
|
|
25780
25861
|
|
|
25781
25862
|
// src/commands/docs/readDocsUnlockPinState.ts
|
|
25782
|
-
import { existsSync as existsSync55, readFileSync as
|
|
25863
|
+
import { existsSync as existsSync55, readFileSync as readFileSync40 } from "fs";
|
|
25783
25864
|
function isPositiveInteger(value) {
|
|
25784
25865
|
return Number.isInteger(value) && value > 0;
|
|
25785
25866
|
}
|
|
@@ -25787,7 +25868,7 @@ function readDocsUnlockPinState(pin2) {
|
|
|
25787
25868
|
const path109 = getDocsUnlockPinPath(pin2);
|
|
25788
25869
|
if (!existsSync55(path109)) return void 0;
|
|
25789
25870
|
try {
|
|
25790
|
-
const state = JSON.parse(
|
|
25871
|
+
const state = JSON.parse(readFileSync40(path109, "utf8"));
|
|
25791
25872
|
if (state.pin !== pin2) return void 0;
|
|
25792
25873
|
if (!isPositiveInteger(state.itemId)) return void 0;
|
|
25793
25874
|
if (!isPositiveInteger(state.phase)) return void 0;
|
|
@@ -25946,20 +26027,20 @@ function registerDocs(parent) {
|
|
|
25946
26027
|
}
|
|
25947
26028
|
|
|
25948
26029
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
25949
|
-
import { closeSync as closeSync4, openSync as openSync5, readdirSync as
|
|
25950
|
-
import { join as
|
|
26030
|
+
import { closeSync as closeSync4, openSync as openSync5, readdirSync as readdirSync11 } from "fs";
|
|
26031
|
+
import { join as join72 } from "path";
|
|
25951
26032
|
import chalk167 from "chalk";
|
|
25952
26033
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
25953
26034
|
function isLockedDll(debugDir) {
|
|
25954
26035
|
let files;
|
|
25955
26036
|
try {
|
|
25956
|
-
files =
|
|
26037
|
+
files = readdirSync11(debugDir, { recursive: true });
|
|
25957
26038
|
} catch {
|
|
25958
26039
|
return null;
|
|
25959
26040
|
}
|
|
25960
26041
|
for (const file of files) {
|
|
25961
26042
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
25962
|
-
const dllPath =
|
|
26043
|
+
const dllPath = join72(debugDir, file);
|
|
25963
26044
|
try {
|
|
25964
26045
|
const fd = openSync5(dllPath, "r+");
|
|
25965
26046
|
closeSync4(fd);
|
|
@@ -25972,18 +26053,18 @@ function isLockedDll(debugDir) {
|
|
|
25972
26053
|
function findFirstLockedDll(dir) {
|
|
25973
26054
|
let entries;
|
|
25974
26055
|
try {
|
|
25975
|
-
entries =
|
|
26056
|
+
entries = readdirSync11(dir);
|
|
25976
26057
|
} catch {
|
|
25977
26058
|
return null;
|
|
25978
26059
|
}
|
|
25979
26060
|
if (entries.includes("bin")) {
|
|
25980
|
-
const locked = isLockedDll(
|
|
26061
|
+
const locked = isLockedDll(join72(dir, "bin", "Debug"));
|
|
25981
26062
|
if (locked) return locked;
|
|
25982
26063
|
}
|
|
25983
26064
|
for (const entry of entries) {
|
|
25984
26065
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
25985
26066
|
continue;
|
|
25986
|
-
const found = findFirstLockedDll(
|
|
26067
|
+
const found = findFirstLockedDll(join72(dir, entry));
|
|
25987
26068
|
if (found) return found;
|
|
25988
26069
|
}
|
|
25989
26070
|
return null;
|
|
@@ -26006,11 +26087,11 @@ async function checkBuildLocksCommand() {
|
|
|
26006
26087
|
}
|
|
26007
26088
|
|
|
26008
26089
|
// src/commands/dotnet/buildTree.ts
|
|
26009
|
-
import { readFileSync as
|
|
26090
|
+
import { readFileSync as readFileSync41 } from "fs";
|
|
26010
26091
|
import path35 from "path";
|
|
26011
26092
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
26012
26093
|
function getProjectRefs(csprojPath) {
|
|
26013
|
-
const content =
|
|
26094
|
+
const content = readFileSync41(csprojPath, "utf8");
|
|
26014
26095
|
const refs = [];
|
|
26015
26096
|
for (const match of content.matchAll(PROJECT_REF_RE)) {
|
|
26016
26097
|
refs.push(match[1].replace(/\\/g, "/"));
|
|
@@ -26027,7 +26108,7 @@ function buildTree(csprojPath, repoRoot2, visited = /* @__PURE__ */ new Set()) {
|
|
|
26027
26108
|
for (const ref of getProjectRefs(abs)) {
|
|
26028
26109
|
const childAbs = path35.resolve(dir, ref);
|
|
26029
26110
|
try {
|
|
26030
|
-
|
|
26111
|
+
readFileSync41(childAbs);
|
|
26031
26112
|
node.children.push(buildTree(childAbs, repoRoot2, visited));
|
|
26032
26113
|
} catch {
|
|
26033
26114
|
node.children.push({
|
|
@@ -26052,14 +26133,14 @@ function collectAllDeps(node) {
|
|
|
26052
26133
|
}
|
|
26053
26134
|
|
|
26054
26135
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
26055
|
-
import { readdirSync as
|
|
26136
|
+
import { readdirSync as readdirSync12, readFileSync as readFileSync42, statSync as statSync8 } from "fs";
|
|
26056
26137
|
import path36 from "path";
|
|
26057
26138
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
26058
26139
|
if (depth > maxDepth) return [];
|
|
26059
26140
|
const results = [];
|
|
26060
26141
|
let entries;
|
|
26061
26142
|
try {
|
|
26062
|
-
entries =
|
|
26143
|
+
entries = readdirSync12(dir);
|
|
26063
26144
|
} catch {
|
|
26064
26145
|
return results;
|
|
26065
26146
|
}
|
|
@@ -26087,7 +26168,7 @@ function findContainingSolutions(csprojPath, repoRoot2) {
|
|
|
26087
26168
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
26088
26169
|
for (const sln of slnFiles) {
|
|
26089
26170
|
try {
|
|
26090
|
-
const content =
|
|
26171
|
+
const content = readFileSync42(sln, "utf8");
|
|
26091
26172
|
if (pattern2.test(content)) {
|
|
26092
26173
|
matches.push(path36.relative(repoRoot2, sln));
|
|
26093
26174
|
}
|
|
@@ -26182,7 +26263,7 @@ async function deps(csprojPath, options2) {
|
|
|
26182
26263
|
}
|
|
26183
26264
|
|
|
26184
26265
|
// src/commands/dotnet/getChangedCsFiles.ts
|
|
26185
|
-
import { execSync as
|
|
26266
|
+
import { execSync as execSync35 } from "child_process";
|
|
26186
26267
|
var SCOPE_ALL = "all";
|
|
26187
26268
|
var SCOPE_BASE = "base:";
|
|
26188
26269
|
var SCOPE_COMMIT = "commit:";
|
|
@@ -26206,7 +26287,7 @@ function getChangedCsFiles(scope) {
|
|
|
26206
26287
|
} else {
|
|
26207
26288
|
cmd = "git diff --name-only HEAD";
|
|
26208
26289
|
}
|
|
26209
|
-
const output =
|
|
26290
|
+
const output = execSync35(cmd, { encoding: "utf8" }).trim();
|
|
26210
26291
|
if (output === "") return [];
|
|
26211
26292
|
return output.split("\n").filter((f) => f.toLowerCase().endsWith(".cs"));
|
|
26212
26293
|
}
|
|
@@ -26329,12 +26410,12 @@ import path38 from "path";
|
|
|
26329
26410
|
import chalk173 from "chalk";
|
|
26330
26411
|
|
|
26331
26412
|
// src/commands/dotnet/findSolution.ts
|
|
26332
|
-
import { readdirSync as
|
|
26333
|
-
import { dirname as dirname31, join as
|
|
26413
|
+
import { readdirSync as readdirSync13 } from "fs";
|
|
26414
|
+
import { dirname as dirname31, join as join73 } from "path";
|
|
26334
26415
|
import chalk172 from "chalk";
|
|
26335
26416
|
function findSlnInDir(dir) {
|
|
26336
26417
|
try {
|
|
26337
|
-
return
|
|
26418
|
+
return readdirSync13(dir).filter((f) => f.endsWith(".sln")).map((f) => join73(dir, f));
|
|
26338
26419
|
} catch {
|
|
26339
26420
|
return [];
|
|
26340
26421
|
}
|
|
@@ -26404,14 +26485,14 @@ function parseInspectReport(json) {
|
|
|
26404
26485
|
}
|
|
26405
26486
|
|
|
26406
26487
|
// src/commands/dotnet/runInspectCode.ts
|
|
26407
|
-
import { execSync as
|
|
26408
|
-
import { existsSync as existsSync58, readFileSync as
|
|
26488
|
+
import { execSync as execSync36 } from "child_process";
|
|
26489
|
+
import { existsSync as existsSync58, readFileSync as readFileSync43, unlinkSync as unlinkSync12 } from "fs";
|
|
26409
26490
|
import { tmpdir as tmpdir4 } from "os";
|
|
26410
26491
|
import path39 from "path";
|
|
26411
26492
|
import chalk174 from "chalk";
|
|
26412
26493
|
function assertJbInstalled() {
|
|
26413
26494
|
try {
|
|
26414
|
-
|
|
26495
|
+
execSync36("jb inspectcode --version", { stdio: "pipe" });
|
|
26415
26496
|
} catch {
|
|
26416
26497
|
console.error(chalk174.red("jb is not installed. Install with:"));
|
|
26417
26498
|
console.error(
|
|
@@ -26425,7 +26506,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
26425
26506
|
const includeFlag = include ? ` --include="${include}"` : "";
|
|
26426
26507
|
const sweaFlag = swea ? " --swea" : "";
|
|
26427
26508
|
try {
|
|
26428
|
-
|
|
26509
|
+
execSync36(
|
|
26429
26510
|
`jb inspectcode "${slnPath}" -o="${reportPath}"${includeFlag}${sweaFlag} --verbosity=OFF`,
|
|
26430
26511
|
{ stdio: "pipe" }
|
|
26431
26512
|
);
|
|
@@ -26440,13 +26521,13 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
26440
26521
|
console.error(chalk174.red("Report file not generated"));
|
|
26441
26522
|
process.exit(1);
|
|
26442
26523
|
}
|
|
26443
|
-
const xml =
|
|
26524
|
+
const xml = readFileSync43(reportPath, "utf8");
|
|
26444
26525
|
unlinkSync12(reportPath);
|
|
26445
26526
|
return xml;
|
|
26446
26527
|
}
|
|
26447
26528
|
|
|
26448
26529
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
26449
|
-
import { execSync as
|
|
26530
|
+
import { execSync as execSync37 } from "child_process";
|
|
26450
26531
|
import chalk175 from "chalk";
|
|
26451
26532
|
function resolveMsbuildPath() {
|
|
26452
26533
|
const { run: run4 } = loadConfig();
|
|
@@ -26457,7 +26538,7 @@ function resolveMsbuildPath() {
|
|
|
26457
26538
|
function assertMsbuildInstalled() {
|
|
26458
26539
|
const msbuild = resolveMsbuildPath();
|
|
26459
26540
|
try {
|
|
26460
|
-
|
|
26541
|
+
execSync37(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
26461
26542
|
} catch {
|
|
26462
26543
|
console.error(chalk175.red(`msbuild not found at: ${msbuild}`));
|
|
26463
26544
|
console.error(
|
|
@@ -26483,7 +26564,7 @@ function runRoslynInspect(slnPath) {
|
|
|
26483
26564
|
const msbuild = resolveMsbuildPath();
|
|
26484
26565
|
let output;
|
|
26485
26566
|
try {
|
|
26486
|
-
output =
|
|
26567
|
+
output = execSync37(
|
|
26487
26568
|
`"${msbuild}" "${slnPath}" -t:Build -v:minimal -maxcpucount -p:EnforceCodeStyleInBuild=true -p:RunAnalyzersDuringBuild=true 2>&1`,
|
|
26488
26569
|
{ encoding: "utf8", stdio: "pipe", maxBuffer: 50 * 1024 * 1024 }
|
|
26489
26570
|
);
|
|
@@ -27342,7 +27423,7 @@ function aggregateCommitters(authorLists) {
|
|
|
27342
27423
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
27343
27424
|
import { unlinkSync as unlinkSync14, writeFileSync as writeFileSync34 } from "fs";
|
|
27344
27425
|
import { tmpdir as tmpdir5 } from "os";
|
|
27345
|
-
import { join as
|
|
27426
|
+
import { join as join74 } from "path";
|
|
27346
27427
|
function buildArgs2(queryFile, vars) {
|
|
27347
27428
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
27348
27429
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -27352,7 +27433,7 @@ function buildArgs2(queryFile, vars) {
|
|
|
27352
27433
|
return args;
|
|
27353
27434
|
}
|
|
27354
27435
|
function runGhGraphql(mutation, vars) {
|
|
27355
|
-
const queryFile =
|
|
27436
|
+
const queryFile = join74(tmpdir5(), `gh-query-${Date.now()}.graphql`);
|
|
27356
27437
|
writeFileSync34(queryFile, mutation);
|
|
27357
27438
|
try {
|
|
27358
27439
|
const result = spawnSync6("gh", buildArgs2(queryFile, vars), {
|
|
@@ -28056,7 +28137,7 @@ Anything nested below the leaf level fails the run before a single write, naming
|
|
|
28056
28137
|
}
|
|
28057
28138
|
|
|
28058
28139
|
// src/commands/github/issue/commentIssue.ts
|
|
28059
|
-
import { execFileSync as
|
|
28140
|
+
import { execFileSync as execFileSync8 } from "child_process";
|
|
28060
28141
|
|
|
28061
28142
|
// src/shared/validateProposedContent.ts
|
|
28062
28143
|
function validateProposedContent(labels, title, body) {
|
|
@@ -28117,7 +28198,7 @@ async function commentIssue(numberArg, options2) {
|
|
|
28117
28198
|
const args = ["issue", "comment", String(number), "--body", body];
|
|
28118
28199
|
if (options2.repo) args.push("--repo", options2.repo);
|
|
28119
28200
|
try {
|
|
28120
|
-
|
|
28201
|
+
execFileSync8("gh", args, { stdio: "inherit" });
|
|
28121
28202
|
} catch {
|
|
28122
28203
|
process.exit(1);
|
|
28123
28204
|
}
|
|
@@ -28443,7 +28524,7 @@ function resolveIssueMilestone(target, wanted) {
|
|
|
28443
28524
|
}
|
|
28444
28525
|
|
|
28445
28526
|
// src/commands/prs/shared.ts
|
|
28446
|
-
import { execSync as
|
|
28527
|
+
import { execSync as execSync38 } from "child_process";
|
|
28447
28528
|
|
|
28448
28529
|
// src/commands/prs/pinCurrentPr.ts
|
|
28449
28530
|
var pinnedPr;
|
|
@@ -28466,19 +28547,19 @@ function getRepoInfo() {
|
|
|
28466
28547
|
const preferred = getPreferredRemoteRepo();
|
|
28467
28548
|
if (preferred) return preferred;
|
|
28468
28549
|
const repoInfo = JSON.parse(
|
|
28469
|
-
|
|
28550
|
+
execSync38("gh repo view --json owner,name", { encoding: "utf8" })
|
|
28470
28551
|
);
|
|
28471
28552
|
return { org: repoInfo.owner.login, repo: repoInfo.name };
|
|
28472
28553
|
}
|
|
28473
28554
|
function getCurrentBranch2() {
|
|
28474
|
-
return
|
|
28555
|
+
return execSync38("git rev-parse --abbrev-ref HEAD", {
|
|
28475
28556
|
encoding: "utf8"
|
|
28476
28557
|
}).trim();
|
|
28477
28558
|
}
|
|
28478
28559
|
function viewCurrentPr(fields) {
|
|
28479
28560
|
const { org, repo } = getRepoInfo();
|
|
28480
28561
|
return JSON.parse(
|
|
28481
|
-
|
|
28562
|
+
execSync38(
|
|
28482
28563
|
`gh pr view ${currentPrSelector(getCurrentBranch2)} --json ${fields} -R ${org}/${repo}`,
|
|
28483
28564
|
{
|
|
28484
28565
|
encoding: "utf8"
|
|
@@ -28629,8 +28710,8 @@ function attachArgs(attachments) {
|
|
|
28629
28710
|
}
|
|
28630
28711
|
|
|
28631
28712
|
// src/commands/prs/runGhWithAttachments.ts
|
|
28632
|
-
import { execFileSync as
|
|
28633
|
-
import { basename as
|
|
28713
|
+
import { execFileSync as execFileSync9 } from "child_process";
|
|
28714
|
+
import { basename as basename18 } from "path";
|
|
28634
28715
|
|
|
28635
28716
|
// src/shared/removeStagedAttachments.ts
|
|
28636
28717
|
import { rmSync as rmSync5 } from "fs";
|
|
@@ -28647,7 +28728,7 @@ function removeStagedAttachments(attachments) {
|
|
|
28647
28728
|
var PLACED_URL = /https:\/\/\S+\/(pull|issues)\/\d+/;
|
|
28648
28729
|
function reportPartialFailure(attachments, stderr) {
|
|
28649
28730
|
const failed3 = attachments.filter(
|
|
28650
|
-
({ path: path109 }) => stderr.includes(path109) || stderr.includes(
|
|
28731
|
+
({ path: path109 }) => stderr.includes(path109) || stderr.includes(basename18(path109))
|
|
28651
28732
|
);
|
|
28652
28733
|
const named = failed3.length > 0 ? failed3 : attachments;
|
|
28653
28734
|
console.error(
|
|
@@ -28657,7 +28738,7 @@ function reportPartialFailure(attachments, stderr) {
|
|
|
28657
28738
|
function runGhWithAttachments(args, attachments) {
|
|
28658
28739
|
const attaching = attachments.length > 0;
|
|
28659
28740
|
try {
|
|
28660
|
-
const stdout =
|
|
28741
|
+
const stdout = execFileSync9("gh", args, {
|
|
28661
28742
|
encoding: "utf8",
|
|
28662
28743
|
stdio: ["inherit", "pipe", attaching ? "pipe" : "inherit"]
|
|
28663
28744
|
});
|
|
@@ -28768,7 +28849,7 @@ The project scope is needed for --project: gh auth refresh -h github.com -s proj
|
|
|
28768
28849
|
}
|
|
28769
28850
|
|
|
28770
28851
|
// src/commands/github/issue/fetchIssue.ts
|
|
28771
|
-
import { execFileSync as
|
|
28852
|
+
import { execFileSync as execFileSync10 } from "child_process";
|
|
28772
28853
|
function fetchIssue2(number, repo) {
|
|
28773
28854
|
const args = [
|
|
28774
28855
|
"issue",
|
|
@@ -28780,7 +28861,7 @@ function fetchIssue2(number, repo) {
|
|
|
28780
28861
|
if (repo) args.push("--repo", repo);
|
|
28781
28862
|
let raw;
|
|
28782
28863
|
try {
|
|
28783
|
-
raw =
|
|
28864
|
+
raw = execFileSync10("gh", args, { encoding: "utf8" });
|
|
28784
28865
|
} catch {
|
|
28785
28866
|
console.error(`Could not fetch issue #${number} with gh issue view`);
|
|
28786
28867
|
process.exit(1);
|
|
@@ -28803,14 +28884,14 @@ function slugFromUrl(url) {
|
|
|
28803
28884
|
import { mkdirSync as mkdirSync21, writeFileSync as writeFileSync35 } from "fs";
|
|
28804
28885
|
|
|
28805
28886
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
28806
|
-
import { join as
|
|
28887
|
+
import { join as join75 } from "path";
|
|
28807
28888
|
function issueWorkingFile(slug2, number) {
|
|
28808
28889
|
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
28809
|
-
const dir =
|
|
28890
|
+
const dir = join75(getStoreDir(), "github-issues", owner, repo);
|
|
28810
28891
|
return {
|
|
28811
28892
|
dir,
|
|
28812
|
-
bodyPath:
|
|
28813
|
-
metaPath:
|
|
28893
|
+
bodyPath: join75(dir, `${number}.md`),
|
|
28894
|
+
metaPath: join75(dir, `${number}.json`)
|
|
28814
28895
|
};
|
|
28815
28896
|
}
|
|
28816
28897
|
|
|
@@ -28845,14 +28926,14 @@ function fetchIssueToWorkingFile(number, repo) {
|
|
|
28845
28926
|
}
|
|
28846
28927
|
|
|
28847
28928
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
28848
|
-
import { existsSync as existsSync60, readFileSync as
|
|
28929
|
+
import { existsSync as existsSync60, readFileSync as readFileSync44 } from "fs";
|
|
28849
28930
|
function resumeIssueBody(slug2, number, updatedAt) {
|
|
28850
28931
|
const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
28851
28932
|
if (!existsSync60(bodyPath) || !existsSync60(metaPath)) return void 0;
|
|
28852
28933
|
try {
|
|
28853
|
-
const meta = JSON.parse(
|
|
28934
|
+
const meta = JSON.parse(readFileSync44(metaPath, "utf8"));
|
|
28854
28935
|
if (meta.updatedAt !== updatedAt) return void 0;
|
|
28855
|
-
return
|
|
28936
|
+
return readFileSync44(bodyPath, "utf8");
|
|
28856
28937
|
} catch {
|
|
28857
28938
|
return void 0;
|
|
28858
28939
|
}
|
|
@@ -28890,12 +28971,12 @@ function prepareIssueEdit(number, repo, fresh, proposed) {
|
|
|
28890
28971
|
}
|
|
28891
28972
|
|
|
28892
28973
|
// src/commands/github/issue/pushIssueBody.ts
|
|
28893
|
-
import { execFileSync as
|
|
28974
|
+
import { execFileSync as execFileSync11 } from "child_process";
|
|
28894
28975
|
function pushIssueBody(number, repo, bodyPath) {
|
|
28895
28976
|
const args = ["issue", "edit", String(number), "--body-file", bodyPath];
|
|
28896
28977
|
if (repo) args.push("--repo", repo);
|
|
28897
28978
|
try {
|
|
28898
|
-
|
|
28979
|
+
execFileSync11("gh", args, { stdio: "inherit" });
|
|
28899
28980
|
} catch {
|
|
28900
28981
|
process.exit(1);
|
|
28901
28982
|
}
|
|
@@ -28974,12 +29055,12 @@ function setIssueParent(number, repo, parentArg) {
|
|
|
28974
29055
|
}
|
|
28975
29056
|
|
|
28976
29057
|
// src/commands/github/issue/viewIssue.ts
|
|
28977
|
-
import { execFileSync as
|
|
29058
|
+
import { execFileSync as execFileSync12 } from "child_process";
|
|
28978
29059
|
function viewIssue(number, repo) {
|
|
28979
29060
|
const args = ["issue", "view", String(number)];
|
|
28980
29061
|
if (repo) args.push("--repo", repo);
|
|
28981
29062
|
try {
|
|
28982
|
-
|
|
29063
|
+
execFileSync12("gh", args, { stdio: "inherit" });
|
|
28983
29064
|
} catch {
|
|
28984
29065
|
process.exit(1);
|
|
28985
29066
|
}
|
|
@@ -29033,7 +29114,7 @@ function registerEditIssue(issueCommand) {
|
|
|
29033
29114
|
}
|
|
29034
29115
|
|
|
29035
29116
|
// src/commands/github/issue/editIssueComment.ts
|
|
29036
|
-
import { execFileSync as
|
|
29117
|
+
import { execFileSync as execFileSync13 } from "child_process";
|
|
29037
29118
|
var USAGE4 = "Usage: assist github issue edit-comment <comment-id> --body <body> [-R <owner>/<repo>]";
|
|
29038
29119
|
async function editIssueComment(commentIdArg, options2) {
|
|
29039
29120
|
const commentId = Number.parseInt(commentIdArg, 10);
|
|
@@ -29060,7 +29141,7 @@ async function editIssueComment(commentIdArg, options2) {
|
|
|
29060
29141
|
];
|
|
29061
29142
|
let raw;
|
|
29062
29143
|
try {
|
|
29063
|
-
raw =
|
|
29144
|
+
raw = execFileSync13("gh", args, {
|
|
29064
29145
|
input: JSON.stringify({ body }),
|
|
29065
29146
|
encoding: "utf8"
|
|
29066
29147
|
});
|
|
@@ -29832,7 +29913,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
29832
29913
|
}
|
|
29833
29914
|
|
|
29834
29915
|
// src/commands/jira/jiraAuth.ts
|
|
29835
|
-
import { execSync as
|
|
29916
|
+
import { execSync as execSync39 } from "child_process";
|
|
29836
29917
|
|
|
29837
29918
|
// src/shared/promptInput.ts
|
|
29838
29919
|
import Enquirer from "enquirer";
|
|
@@ -29867,7 +29948,7 @@ async function jiraAuth() {
|
|
|
29867
29948
|
console.error("All fields are required.");
|
|
29868
29949
|
process.exit(1);
|
|
29869
29950
|
}
|
|
29870
|
-
|
|
29951
|
+
execSync39(`acli jira auth login --site ${site} --email "${email}" --token`, {
|
|
29871
29952
|
encoding: "utf8",
|
|
29872
29953
|
input: token,
|
|
29873
29954
|
stdio: ["pipe", "inherit", "inherit"]
|
|
@@ -29938,7 +30019,7 @@ function registerRefineLaunch(program, resumeFlag) {
|
|
|
29938
30019
|
import { randomUUID as randomUUID16 } from "crypto";
|
|
29939
30020
|
|
|
29940
30021
|
// src/commands/review/checkoutPr.ts
|
|
29941
|
-
import { execFileSync as
|
|
30022
|
+
import { execFileSync as execFileSync16 } from "child_process";
|
|
29942
30023
|
|
|
29943
30024
|
// src/commands/review/clearStalePrBranch.ts
|
|
29944
30025
|
var tipSetFromRemote = /^branch: (Created from|Reset to)|^fetch\b|: Fast-forward$/;
|
|
@@ -29995,14 +30076,14 @@ function recentDaemonLogLines(includeRelayed = true) {
|
|
|
29995
30076
|
|
|
29996
30077
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
29997
30078
|
import { existsSync as existsSync61 } from "fs";
|
|
29998
|
-
import { basename as
|
|
30079
|
+
import { basename as basename20, dirname as dirname33 } from "path";
|
|
29999
30080
|
|
|
30000
30081
|
// src/commands/sessions/daemon/worktree/nextWorktreePath.ts
|
|
30001
|
-
import { basename as
|
|
30082
|
+
import { basename as basename19, join as join76 } from "path";
|
|
30002
30083
|
function nextWorktreePath(clone, base, isTaken) {
|
|
30003
|
-
const name =
|
|
30084
|
+
const name = basename19(clone);
|
|
30004
30085
|
for (let n = 2; n < 1e3; n++) {
|
|
30005
|
-
const candidate =
|
|
30086
|
+
const candidate = join76(base, `${name}-${n}`);
|
|
30006
30087
|
if (!isTaken(candidate)) return candidate;
|
|
30007
30088
|
}
|
|
30008
30089
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -30026,7 +30107,7 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
30026
30107
|
const base = strategy.root ? expandTilde(strategy.root) : dirname33(clone);
|
|
30027
30108
|
const registered = new Set(listWorktreePaths(clone));
|
|
30028
30109
|
const branches = new Set(listLocalBranches(clone));
|
|
30029
|
-
const isTaken = (candidate) => registered.has(candidate) || existsSync61(candidate) || boundTreeRoots2.has(candidate) || branches.has(
|
|
30110
|
+
const isTaken = (candidate) => registered.has(candidate) || existsSync61(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename20(candidate));
|
|
30030
30111
|
const path109 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
30031
30112
|
const ready = addWorktree(clone, path109, strategy.trunk);
|
|
30032
30113
|
ready.catch(() => {
|
|
@@ -30049,13 +30130,13 @@ async function addWorktree(clone, path109, trunk) {
|
|
|
30049
30130
|
"add",
|
|
30050
30131
|
start2.track ? "--track" : "--no-track",
|
|
30051
30132
|
"-b",
|
|
30052
|
-
|
|
30133
|
+
basename20(path109),
|
|
30053
30134
|
path109,
|
|
30054
30135
|
start2.ref
|
|
30055
30136
|
]);
|
|
30056
30137
|
recordWorktree(path109, clone, getCachedOrigin(clone));
|
|
30057
30138
|
daemonLog(
|
|
30058
|
-
start2.track ? `worktree allocated ${path109} (branch ${
|
|
30139
|
+
start2.track ? `worktree allocated ${path109} (branch ${basename20(path109)} tracking ${start2.ref}) for clone ${clone}` : `worktree allocated ${path109} (branch ${basename20(path109)} off ${start2.ref}, no mainline tracking) for clone ${clone}`
|
|
30059
30140
|
);
|
|
30060
30141
|
}
|
|
30061
30142
|
|
|
@@ -30265,20 +30346,20 @@ function persistedTreeRoots() {
|
|
|
30265
30346
|
|
|
30266
30347
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
30267
30348
|
import { copyFileSync, existsSync as existsSync63, mkdirSync as mkdirSync22 } from "fs";
|
|
30268
|
-
import { dirname as dirname34, join as
|
|
30349
|
+
import { dirname as dirname34, join as join78 } from "path";
|
|
30269
30350
|
|
|
30270
30351
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
30271
30352
|
import { resolve as resolve19 } from "path";
|
|
30272
30353
|
|
|
30273
30354
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
30274
30355
|
import { existsSync as existsSync62 } from "fs";
|
|
30275
|
-
import { join as
|
|
30356
|
+
import { join as join77 } from "path";
|
|
30276
30357
|
function detectInstallCommand(dir) {
|
|
30277
|
-
if (!existsSync62(
|
|
30278
|
-
if (existsSync62(
|
|
30279
|
-
if (existsSync62(
|
|
30280
|
-
if (existsSync62(
|
|
30281
|
-
if (existsSync62(
|
|
30358
|
+
if (!existsSync62(join77(dir, "package.json"))) return null;
|
|
30359
|
+
if (existsSync62(join77(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
30360
|
+
if (existsSync62(join77(dir, "yarn.lock"))) return "yarn install";
|
|
30361
|
+
if (existsSync62(join77(dir, "bun.lockb"))) return "bun install";
|
|
30362
|
+
if (existsSync62(join77(dir, "package-lock.json"))) return "npm ci";
|
|
30282
30363
|
return "npm install";
|
|
30283
30364
|
}
|
|
30284
30365
|
|
|
@@ -30443,9 +30524,9 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
30443
30524
|
}
|
|
30444
30525
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
30445
30526
|
for (const rel of copy) {
|
|
30446
|
-
const src =
|
|
30527
|
+
const src = join78(clone, rel);
|
|
30447
30528
|
if (!existsSync63(src)) continue;
|
|
30448
|
-
const dest =
|
|
30529
|
+
const dest = join78(worktreePath, rel);
|
|
30449
30530
|
try {
|
|
30450
30531
|
mkdirSync22(dirname34(dest), { recursive: true });
|
|
30451
30532
|
copyFileSync(src, dest);
|
|
@@ -30537,13 +30618,13 @@ function prCliCommands(number, cwd) {
|
|
|
30537
30618
|
}
|
|
30538
30619
|
|
|
30539
30620
|
// src/commands/review/prHeadBranch.ts
|
|
30540
|
-
import { execFileSync as
|
|
30621
|
+
import { execFileSync as execFileSync14 } from "child_process";
|
|
30541
30622
|
function prHeadBranch({
|
|
30542
30623
|
headBranch
|
|
30543
30624
|
}) {
|
|
30544
30625
|
try {
|
|
30545
30626
|
return headBranch.parse(
|
|
30546
|
-
|
|
30627
|
+
execFileSync14(headBranch.file, headBranch.args, {
|
|
30547
30628
|
encoding: "utf8",
|
|
30548
30629
|
stdio: ["ignore", "pipe", "pipe"]
|
|
30549
30630
|
})
|
|
@@ -30614,7 +30695,7 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
30614
30695
|
import chalk186 from "chalk";
|
|
30615
30696
|
|
|
30616
30697
|
// src/commands/review/azCliProblem.ts
|
|
30617
|
-
import { execFileSync as
|
|
30698
|
+
import { execFileSync as execFileSync15 } from "child_process";
|
|
30618
30699
|
|
|
30619
30700
|
// src/commands/review/azFailureProblem.ts
|
|
30620
30701
|
var azProblems = {
|
|
@@ -30642,7 +30723,7 @@ function azFailureProblem(error) {
|
|
|
30642
30723
|
// src/commands/review/azCliProblem.ts
|
|
30643
30724
|
function runAz(args) {
|
|
30644
30725
|
try {
|
|
30645
|
-
|
|
30726
|
+
execFileSync15("az", args, { stdio: "ignore" });
|
|
30646
30727
|
return "ok";
|
|
30647
30728
|
} catch (error) {
|
|
30648
30729
|
return error.code === "ENOENT" ? "missing" : "failed";
|
|
@@ -30705,7 +30786,7 @@ async function checkoutPr(number) {
|
|
|
30705
30786
|
const from = branch2 === "HEAD" ? gitSyncOrNull(process.cwd(), ["rev-parse", "HEAD"]) : branch2;
|
|
30706
30787
|
const stale = headRef ? clearStalePrBranch(process.cwd(), headRef) : "absent";
|
|
30707
30788
|
try {
|
|
30708
|
-
|
|
30789
|
+
execFileSync16(commands.checkout.file, commands.checkout.args, {
|
|
30709
30790
|
stdio: "inherit"
|
|
30710
30791
|
});
|
|
30711
30792
|
} catch {
|
|
@@ -30925,13 +31006,13 @@ function registerLitellm(program) {
|
|
|
30925
31006
|
}
|
|
30926
31007
|
|
|
30927
31008
|
// src/commands/mermaidExport.ts
|
|
30928
|
-
import { mkdirSync as mkdirSync23, readdirSync as
|
|
31009
|
+
import { mkdirSync as mkdirSync23, readdirSync as readdirSync14 } from "fs";
|
|
30929
31010
|
import { resolve as resolve21 } from "path";
|
|
30930
31011
|
import chalk191 from "chalk";
|
|
30931
31012
|
|
|
30932
31013
|
// src/commands/mermaid/exportFile.ts
|
|
30933
|
-
import { readFileSync as
|
|
30934
|
-
import { basename as
|
|
31014
|
+
import { readFileSync as readFileSync45, writeFileSync as writeFileSync36 } from "fs";
|
|
31015
|
+
import { basename as basename21, extname as extname4, resolve as resolve20 } from "path";
|
|
30935
31016
|
import chalk190 from "chalk";
|
|
30936
31017
|
|
|
30937
31018
|
// src/commands/mermaid/renderBlock.ts
|
|
@@ -30956,9 +31037,9 @@ async function renderBlock(krokiUrl, source) {
|
|
|
30956
31037
|
|
|
30957
31038
|
// src/commands/mermaid/exportFile.ts
|
|
30958
31039
|
async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
30959
|
-
const content =
|
|
31040
|
+
const content = readFileSync45(file, "utf8");
|
|
30960
31041
|
const blocks = extractMermaidBlocks(content);
|
|
30961
|
-
const stem =
|
|
31042
|
+
const stem = basename21(file, extname4(file));
|
|
30962
31043
|
if (onlyIndex !== void 0) {
|
|
30963
31044
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
30964
31045
|
console.error(
|
|
@@ -31007,7 +31088,7 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
31007
31088
|
process.exit(1);
|
|
31008
31089
|
}
|
|
31009
31090
|
}
|
|
31010
|
-
const files = file ? [file] :
|
|
31091
|
+
const files = file ? [file] : readdirSync14(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
31011
31092
|
if (files.length === 0) {
|
|
31012
31093
|
console.log(chalk191.gray("No markdown files found in current directory."));
|
|
31013
31094
|
return;
|
|
@@ -31168,14 +31249,14 @@ function applyIgnore(texts, ignore3) {
|
|
|
31168
31249
|
}
|
|
31169
31250
|
|
|
31170
31251
|
// src/commands/miro/readIgnoreList.ts
|
|
31171
|
-
import { existsSync as existsSync64, readFileSync as
|
|
31252
|
+
import { existsSync as existsSync64, readFileSync as readFileSync46 } from "fs";
|
|
31172
31253
|
import { parse as parse2 } from "yaml";
|
|
31173
31254
|
function readIgnoreList(file) {
|
|
31174
31255
|
if (!existsSync64(file))
|
|
31175
31256
|
throw new MiroExtractError(
|
|
31176
31257
|
`No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
|
|
31177
31258
|
);
|
|
31178
|
-
const parsed = parse2(
|
|
31259
|
+
const parsed = parse2(readFileSync46(file, "utf8"));
|
|
31179
31260
|
if (parsed === null || parsed === void 0) return [];
|
|
31180
31261
|
if (!Array.isArray(parsed) || parsed.some((entry) => typeof entry !== "string"))
|
|
31181
31262
|
throw new MiroExtractError(
|
|
@@ -31355,7 +31436,7 @@ async function pickAnchors(sessionId, items2) {
|
|
|
31355
31436
|
}
|
|
31356
31437
|
|
|
31357
31438
|
// src/commands/miro/readMiroItems.ts
|
|
31358
|
-
import { readFileSync as
|
|
31439
|
+
import { readFileSync as readFileSync47 } from "fs";
|
|
31359
31440
|
function tryParse(text18) {
|
|
31360
31441
|
try {
|
|
31361
31442
|
return JSON.parse(text18);
|
|
@@ -31384,7 +31465,7 @@ function parsePages(raw, file) {
|
|
|
31384
31465
|
return Array.isArray(parsed) ? parsed.map(toPage) : [toPage(parsed)];
|
|
31385
31466
|
}
|
|
31386
31467
|
function readMiroItems(file) {
|
|
31387
|
-
const items2 = parsePages(
|
|
31468
|
+
const items2 = parsePages(readFileSync47(file, "utf8"), file).flatMap(
|
|
31388
31469
|
(page) => page.data ?? []
|
|
31389
31470
|
);
|
|
31390
31471
|
if (items2.length === 0)
|
|
@@ -31656,15 +31737,15 @@ function createNetcapHandler(options2) {
|
|
|
31656
31737
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
31657
31738
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
31658
31739
|
import { networkInterfaces } from "os";
|
|
31659
|
-
import { join as
|
|
31740
|
+
import { join as join80 } from "path";
|
|
31660
31741
|
import chalk194 from "chalk";
|
|
31661
31742
|
|
|
31662
31743
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
31663
|
-
import { dirname as dirname36, join as
|
|
31744
|
+
import { dirname as dirname36, join as join79 } from "path";
|
|
31664
31745
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
31665
31746
|
var moduleDir2 = dirname36(fileURLToPath7(import.meta.url));
|
|
31666
31747
|
function netcapExtensionDir() {
|
|
31667
|
-
return
|
|
31748
|
+
return join79(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
31668
31749
|
}
|
|
31669
31750
|
|
|
31670
31751
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -31679,7 +31760,7 @@ function lanIPv4() {
|
|
|
31679
31760
|
return void 0;
|
|
31680
31761
|
}
|
|
31681
31762
|
async function configureBackground(dir, host, port, filter) {
|
|
31682
|
-
const file =
|
|
31763
|
+
const file = join80(dir, "background.js");
|
|
31683
31764
|
const source = await readFile7(file, "utf8");
|
|
31684
31765
|
await writeFile6(
|
|
31685
31766
|
file,
|
|
@@ -31719,20 +31800,20 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
31719
31800
|
}
|
|
31720
31801
|
|
|
31721
31802
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
31722
|
-
import { isAbsolute as isAbsolute5, join as
|
|
31803
|
+
import { isAbsolute as isAbsolute5, join as join82, resolve as resolve23 } from "path";
|
|
31723
31804
|
|
|
31724
31805
|
// src/commands/netcap/defaultCapturePath.ts
|
|
31725
31806
|
import { homedir as homedir25 } from "os";
|
|
31726
|
-
import { join as
|
|
31807
|
+
import { join as join81 } from "path";
|
|
31727
31808
|
function defaultCapturePath() {
|
|
31728
|
-
return
|
|
31809
|
+
return join81(homedir25(), ".assist", "netcap", "capture.jsonl");
|
|
31729
31810
|
}
|
|
31730
31811
|
|
|
31731
31812
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
31732
31813
|
function resolveNetcapOutPath(out) {
|
|
31733
31814
|
if (!out) return defaultCapturePath();
|
|
31734
31815
|
const dir = isAbsolute5(out) ? out : resolve23(process.cwd(), out);
|
|
31735
|
-
return
|
|
31816
|
+
return join82(dir, "capture.jsonl");
|
|
31736
31817
|
}
|
|
31737
31818
|
|
|
31738
31819
|
// src/commands/netcap/netcap.ts
|
|
@@ -31779,11 +31860,11 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
31779
31860
|
|
|
31780
31861
|
// src/commands/netcap/netcapExtract.ts
|
|
31781
31862
|
import { writeFileSync as writeFileSync38 } from "fs";
|
|
31782
|
-
import { join as
|
|
31863
|
+
import { join as join83 } from "path";
|
|
31783
31864
|
import chalk196 from "chalk";
|
|
31784
31865
|
|
|
31785
31866
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
31786
|
-
import { readFileSync as
|
|
31867
|
+
import { readFileSync as readFileSync48 } from "fs";
|
|
31787
31868
|
|
|
31788
31869
|
// src/commands/netcap/parseRscRows.ts
|
|
31789
31870
|
var isRscRef = (v) => typeof v === "string" && /^\$[0-9a-fL@]/.test(v);
|
|
@@ -32179,7 +32260,7 @@ function extractVoyagerPosts(body) {
|
|
|
32179
32260
|
|
|
32180
32261
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
32181
32262
|
function captureEntries(captureFile) {
|
|
32182
|
-
const lines2 =
|
|
32263
|
+
const lines2 = readFileSync48(captureFile, "utf8").split("\n").filter(Boolean);
|
|
32183
32264
|
const entries = [];
|
|
32184
32265
|
for (const line of lines2) {
|
|
32185
32266
|
let entry;
|
|
@@ -32224,7 +32305,7 @@ function extractPostsFromCapture(captureFile) {
|
|
|
32224
32305
|
function netcapExtract(file) {
|
|
32225
32306
|
const captureFile = file ?? defaultCapturePath();
|
|
32226
32307
|
const posts = extractPostsFromCapture(captureFile);
|
|
32227
|
-
const outFile =
|
|
32308
|
+
const outFile = join83(captureFile, "..", "posts.json");
|
|
32228
32309
|
writeFileSync38(outFile, `${JSON.stringify(posts, null, 2)}
|
|
32229
32310
|
`);
|
|
32230
32311
|
console.log(
|
|
@@ -32415,7 +32496,7 @@ function registerPrompts(program) {
|
|
|
32415
32496
|
}
|
|
32416
32497
|
|
|
32417
32498
|
// src/commands/prs/prs.ts
|
|
32418
|
-
import { execSync as
|
|
32499
|
+
import { execSync as execSync40 } from "child_process";
|
|
32419
32500
|
|
|
32420
32501
|
// src/commands/prs/prs/displayPaginated.ts
|
|
32421
32502
|
import enquirer9 from "enquirer";
|
|
@@ -32429,14 +32510,14 @@ var STATUS_MAP = {
|
|
|
32429
32510
|
function defaultStatus(pr) {
|
|
32430
32511
|
return { label: chalk201.green("opened"), date: pr.createdAt };
|
|
32431
32512
|
}
|
|
32432
|
-
function
|
|
32513
|
+
function getStatus(pr) {
|
|
32433
32514
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
32434
32515
|
}
|
|
32435
|
-
function
|
|
32516
|
+
function formatDate2(dateStr) {
|
|
32436
32517
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
32437
32518
|
}
|
|
32438
32519
|
function formatPrHeader(pr, status2) {
|
|
32439
|
-
return `${chalk201.cyan(`#${pr.number}`)} ${pr.title} ${chalk201.dim(`(${pr.author.login},`)} ${status2.label} ${chalk201.dim(`${
|
|
32520
|
+
return `${chalk201.cyan(`#${pr.number}`)} ${pr.title} ${chalk201.dim(`(${pr.author.login},`)} ${status2.label} ${chalk201.dim(`${formatDate2(status2.date)})`)}`;
|
|
32440
32521
|
}
|
|
32441
32522
|
function logPrDetails(pr) {
|
|
32442
32523
|
console.log(
|
|
@@ -32445,7 +32526,7 @@ function logPrDetails(pr) {
|
|
|
32445
32526
|
console.log();
|
|
32446
32527
|
}
|
|
32447
32528
|
function printPr(pr) {
|
|
32448
|
-
console.log(formatPrHeader(pr,
|
|
32529
|
+
console.log(formatPrHeader(pr, getStatus(pr)));
|
|
32449
32530
|
logPrDetails(pr);
|
|
32450
32531
|
}
|
|
32451
32532
|
|
|
@@ -32522,7 +32603,7 @@ async function prs(options2) {
|
|
|
32522
32603
|
const state = options2.open ? "open" : options2.closed ? "closed" : "all";
|
|
32523
32604
|
try {
|
|
32524
32605
|
const { org, repo } = getRepoInfo();
|
|
32525
|
-
const result =
|
|
32606
|
+
const result = execSync40(
|
|
32526
32607
|
`gh pr list --state ${state} --json number,title,url,author,createdAt,mergedAt,closedAt,state,changedFiles --limit 100 -R ${org}/${repo}`,
|
|
32527
32608
|
{ encoding: "utf8" }
|
|
32528
32609
|
);
|
|
@@ -32620,9 +32701,9 @@ async function comment2(path109, line, body, options2 = {}) {
|
|
|
32620
32701
|
|
|
32621
32702
|
// src/commands/prs/commentsCachePath.ts
|
|
32622
32703
|
import { homedir as homedir26 } from "os";
|
|
32623
|
-
import { join as
|
|
32704
|
+
import { join as join84 } from "path";
|
|
32624
32705
|
function commentsCachePath(org, repo, prNumber) {
|
|
32625
|
-
return
|
|
32706
|
+
return join84(
|
|
32626
32707
|
homedir26(),
|
|
32627
32708
|
".assist",
|
|
32628
32709
|
"pr-comments",
|
|
@@ -32638,14 +32719,14 @@ import { dirname as dirname38 } from "path";
|
|
|
32638
32719
|
import { stringify as stringify3 } from "yaml";
|
|
32639
32720
|
|
|
32640
32721
|
// src/commands/prs/loadCommentsCache.ts
|
|
32641
|
-
import { existsSync as existsSync65, readFileSync as
|
|
32722
|
+
import { existsSync as existsSync65, readFileSync as readFileSync49, unlinkSync as unlinkSync15 } from "fs";
|
|
32642
32723
|
import { parse as parse3 } from "yaml";
|
|
32643
32724
|
function loadCommentsCache(org, repo, prNumber) {
|
|
32644
32725
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
32645
32726
|
if (!existsSync65(cachePath)) {
|
|
32646
32727
|
return null;
|
|
32647
32728
|
}
|
|
32648
|
-
const content =
|
|
32729
|
+
const content = readFileSync49(cachePath, "utf8");
|
|
32649
32730
|
return parse3(content);
|
|
32650
32731
|
}
|
|
32651
32732
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
@@ -32657,19 +32738,19 @@ function deleteCommentsCache(org, repo, prNumber) {
|
|
|
32657
32738
|
}
|
|
32658
32739
|
|
|
32659
32740
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
32660
|
-
import { readdirSync as
|
|
32661
|
-
import { join as
|
|
32741
|
+
import { readdirSync as readdirSync15, unlinkSync as unlinkSync16 } from "fs";
|
|
32742
|
+
import { join as join85 } from "path";
|
|
32662
32743
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
32663
32744
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
32664
|
-
const dir =
|
|
32745
|
+
const dir = join85(cwd, ".assist");
|
|
32665
32746
|
let entries;
|
|
32666
32747
|
try {
|
|
32667
|
-
entries =
|
|
32748
|
+
entries = readdirSync15(dir);
|
|
32668
32749
|
} catch {
|
|
32669
32750
|
return;
|
|
32670
32751
|
}
|
|
32671
32752
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
32672
|
-
unlinkSync16(
|
|
32753
|
+
unlinkSync16(join85(dir, entry));
|
|
32673
32754
|
}
|
|
32674
32755
|
}
|
|
32675
32756
|
|
|
@@ -32735,9 +32816,9 @@ var azureDevopsThreadRequests = {
|
|
|
32735
32816
|
};
|
|
32736
32817
|
|
|
32737
32818
|
// src/commands/prs/azureDevops/currentAzureDevopsPr.ts
|
|
32738
|
-
import { execFileSync as
|
|
32819
|
+
import { execFileSync as execFileSync17 } from "child_process";
|
|
32739
32820
|
function findPrForBranch(repo, branch2) {
|
|
32740
|
-
const stdout =
|
|
32821
|
+
const stdout = execFileSync17(
|
|
32741
32822
|
"az",
|
|
32742
32823
|
[
|
|
32743
32824
|
"repos",
|
|
@@ -32784,10 +32865,10 @@ function failAzureDevops(error) {
|
|
|
32784
32865
|
}
|
|
32785
32866
|
|
|
32786
32867
|
// src/commands/prs/azureDevops/invokeAzDevops.ts
|
|
32787
|
-
import { execFileSync as
|
|
32868
|
+
import { execFileSync as execFileSync18 } from "child_process";
|
|
32788
32869
|
import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync40 } from "fs";
|
|
32789
32870
|
import { tmpdir as tmpdir6 } from "os";
|
|
32790
|
-
import { join as
|
|
32871
|
+
import { join as join86 } from "path";
|
|
32791
32872
|
function azDevopsInvokeArgs(request, inFile) {
|
|
32792
32873
|
return [
|
|
32793
32874
|
"devops",
|
|
@@ -32813,7 +32894,7 @@ function azDevopsInvokeArgs(request, inFile) {
|
|
|
32813
32894
|
];
|
|
32814
32895
|
}
|
|
32815
32896
|
function runAz2(args) {
|
|
32816
|
-
const stdout =
|
|
32897
|
+
const stdout = execFileSync18("az", args, {
|
|
32817
32898
|
encoding: "utf8",
|
|
32818
32899
|
stdio: ["ignore", "pipe", "pipe"],
|
|
32819
32900
|
windowsHide: true
|
|
@@ -32822,8 +32903,8 @@ function runAz2(args) {
|
|
|
32822
32903
|
}
|
|
32823
32904
|
function invokeAzDevops(request) {
|
|
32824
32905
|
if (request.body === void 0) return runAz2(azDevopsInvokeArgs(request));
|
|
32825
|
-
const dir = mkdtempSync2(
|
|
32826
|
-
const inFile =
|
|
32906
|
+
const dir = mkdtempSync2(join86(tmpdir6(), "assist-az-"));
|
|
32907
|
+
const inFile = join86(dir, "body.json");
|
|
32827
32908
|
try {
|
|
32828
32909
|
writeFileSync40(inFile, JSON.stringify(request.body));
|
|
32829
32910
|
return runAz2(azDevopsInvokeArgs(request, inFile));
|
|
@@ -32882,10 +32963,10 @@ function listAzureDevopsComments(repo) {
|
|
|
32882
32963
|
}
|
|
32883
32964
|
|
|
32884
32965
|
// src/commands/prs/fetchThreadIds.ts
|
|
32885
|
-
import { execFileSync as
|
|
32966
|
+
import { execFileSync as execFileSync19 } from "child_process";
|
|
32886
32967
|
var THREAD_QUERY = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { id isResolved comments(first: 100) { nodes { databaseId } } } } } } }`;
|
|
32887
32968
|
function fetchThreadIds(org, repo, prNumber) {
|
|
32888
|
-
const result =
|
|
32969
|
+
const result = execFileSync19(
|
|
32889
32970
|
"gh",
|
|
32890
32971
|
[
|
|
32891
32972
|
"api",
|
|
@@ -32916,9 +32997,9 @@ function fetchThreadIds(org, repo, prNumber) {
|
|
|
32916
32997
|
}
|
|
32917
32998
|
|
|
32918
32999
|
// src/commands/prs/listComments/fetchReviewComments.ts
|
|
32919
|
-
import { execSync as
|
|
33000
|
+
import { execSync as execSync41 } from "child_process";
|
|
32920
33001
|
function fetchJson(endpoint) {
|
|
32921
|
-
const result =
|
|
33002
|
+
const result = execSync41(`gh api --paginate ${endpoint}`, {
|
|
32922
33003
|
encoding: "utf8"
|
|
32923
33004
|
});
|
|
32924
33005
|
if (!result.trim()) return [];
|
|
@@ -33163,10 +33244,10 @@ function printComments2(result) {
|
|
|
33163
33244
|
}
|
|
33164
33245
|
|
|
33165
33246
|
// src/commands/prs/fixed.ts
|
|
33166
|
-
import { execSync as
|
|
33247
|
+
import { execSync as execSync42 } from "child_process";
|
|
33167
33248
|
|
|
33168
33249
|
// src/commands/prs/threadTarget.ts
|
|
33169
|
-
import { execFileSync as
|
|
33250
|
+
import { execFileSync as execFileSync20 } from "child_process";
|
|
33170
33251
|
|
|
33171
33252
|
// src/commands/prs/azureDevops/azureDevopsThreadActions.ts
|
|
33172
33253
|
function attempt(run4) {
|
|
@@ -33214,7 +33295,7 @@ function replyToComment(org, repo, prNumber, commentId, message3) {
|
|
|
33214
33295
|
// src/commands/prs/threadTarget.ts
|
|
33215
33296
|
function resolveThread(threadId) {
|
|
33216
33297
|
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
33217
|
-
|
|
33298
|
+
execFileSync20(
|
|
33218
33299
|
"gh",
|
|
33219
33300
|
["api", "graphql", "-f", `query=${mutation}`, "-f", `threadId=${threadId}`],
|
|
33220
33301
|
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
@@ -33288,7 +33369,7 @@ function resolveCommentWithReply(commentId, message3, status2) {
|
|
|
33288
33369
|
// src/commands/prs/fixed.ts
|
|
33289
33370
|
function verifySha(sha) {
|
|
33290
33371
|
try {
|
|
33291
|
-
return
|
|
33372
|
+
return execSync42(`git rev-parse --verify ${sha}`, {
|
|
33292
33373
|
encoding: "utf8"
|
|
33293
33374
|
}).trim();
|
|
33294
33375
|
} catch {
|
|
@@ -33352,7 +33433,7 @@ async function reply(commentId, body) {
|
|
|
33352
33433
|
}
|
|
33353
33434
|
|
|
33354
33435
|
// src/commands/prs/wontfix.ts
|
|
33355
|
-
import { execSync as
|
|
33436
|
+
import { execSync as execSync43 } from "child_process";
|
|
33356
33437
|
function validateReason(reason4) {
|
|
33357
33438
|
const lowerReason = reason4.toLowerCase();
|
|
33358
33439
|
if (lowerReason.includes("claude") || lowerReason.includes("opus")) {
|
|
@@ -33369,7 +33450,7 @@ function validateShaReferences(reason4) {
|
|
|
33369
33450
|
const invalidShas = [];
|
|
33370
33451
|
for (const sha of shas) {
|
|
33371
33452
|
try {
|
|
33372
|
-
|
|
33453
|
+
execSync43(`git cat-file -t ${sha}`, { stdio: "pipe" });
|
|
33373
33454
|
} catch {
|
|
33374
33455
|
invalidShas.push(sha);
|
|
33375
33456
|
}
|
|
@@ -33570,7 +33651,7 @@ ${resolves}` : baseWhy);
|
|
|
33570
33651
|
|
|
33571
33652
|
// src/commands/prs/parseScreenshotSpec.ts
|
|
33572
33653
|
import { statSync as statSync9 } from "fs";
|
|
33573
|
-
import { basename as
|
|
33654
|
+
import { basename as basename22, extname as extname5, resolve as resolve24 } from "path";
|
|
33574
33655
|
function splitOnce(value, separator) {
|
|
33575
33656
|
const index2 = value.indexOf(separator);
|
|
33576
33657
|
if (index2 === -1) return null;
|
|
@@ -33594,7 +33675,7 @@ function parseScreenshotSpec(spec) {
|
|
|
33594
33675
|
throw new Error(
|
|
33595
33676
|
`--screenshot '${spec}': gh cannot attach .${ext || "(none)"} files (supported: ${[...ghAttachableExtensions].join(", ")}).`
|
|
33596
33677
|
);
|
|
33597
|
-
const alt = caption.trim() ||
|
|
33678
|
+
const alt = caption.trim() || basename22(path109, extname5(path109));
|
|
33598
33679
|
return group.trim() ? { path: path109, alt, group: group.trim() } : { path: path109, alt };
|
|
33599
33680
|
}
|
|
33600
33681
|
|
|
@@ -33613,12 +33694,12 @@ import { randomUUID as randomUUID20 } from "crypto";
|
|
|
33613
33694
|
|
|
33614
33695
|
// src/commands/prs/stageScreenshots.ts
|
|
33615
33696
|
import { readFile as readFile8 } from "fs/promises";
|
|
33616
|
-
import { basename as
|
|
33697
|
+
import { basename as basename23 } from "path";
|
|
33617
33698
|
function stageScreenshots(screenshots = []) {
|
|
33618
33699
|
return Promise.all(
|
|
33619
33700
|
screenshots.map(async (screenshot2) => {
|
|
33620
33701
|
const { filePath } = await stageAttachment(
|
|
33621
|
-
|
|
33702
|
+
basename23(screenshot2.path),
|
|
33622
33703
|
attachmentContentType(screenshot2.path),
|
|
33623
33704
|
await readFile8(screenshot2.path)
|
|
33624
33705
|
);
|
|
@@ -33854,7 +33935,7 @@ function buildValidatedBody(options2, usage) {
|
|
|
33854
33935
|
}
|
|
33855
33936
|
|
|
33856
33937
|
// src/commands/prs/placePr.ts
|
|
33857
|
-
import { execFileSync as
|
|
33938
|
+
import { execFileSync as execFileSync21 } from "child_process";
|
|
33858
33939
|
|
|
33859
33940
|
// src/commands/prs/buildCreateArgs.ts
|
|
33860
33941
|
function buildCreateArgs(title, body, options2, attachments = []) {
|
|
@@ -33891,16 +33972,16 @@ function buildCreateArgs(title, body, options2, attachments = []) {
|
|
|
33891
33972
|
}
|
|
33892
33973
|
|
|
33893
33974
|
// src/commands/prs/readSessionPrRef.ts
|
|
33894
|
-
import { execSync as
|
|
33975
|
+
import { execSync as execSync44 } from "child_process";
|
|
33895
33976
|
function readSessionPrRef() {
|
|
33896
33977
|
try {
|
|
33897
|
-
const branch2 =
|
|
33978
|
+
const branch2 = execSync44("git rev-parse --abbrev-ref HEAD", {
|
|
33898
33979
|
encoding: "utf8",
|
|
33899
33980
|
stdio: ["pipe", "pipe", "pipe"]
|
|
33900
33981
|
}).trim();
|
|
33901
33982
|
if (!branch2 || branch2 === "HEAD") return null;
|
|
33902
33983
|
const pr = JSON.parse(
|
|
33903
|
-
|
|
33984
|
+
execSync44(`gh pr view ${branch2} --json number,title,url,state`, {
|
|
33904
33985
|
encoding: "utf8",
|
|
33905
33986
|
stdio: ["pipe", "pipe", "pipe"]
|
|
33906
33987
|
})
|
|
@@ -33940,7 +34021,7 @@ function buildEditArgs(number, title, body, attachments = []) {
|
|
|
33940
34021
|
// src/commands/prs/placePr.ts
|
|
33941
34022
|
function hasUpstream2() {
|
|
33942
34023
|
try {
|
|
33943
|
-
|
|
34024
|
+
execFileSync21(
|
|
33944
34025
|
"git",
|
|
33945
34026
|
["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
|
|
33946
34027
|
{ stdio: "pipe" }
|
|
@@ -33952,7 +34033,7 @@ function hasUpstream2() {
|
|
|
33952
34033
|
}
|
|
33953
34034
|
function ensureBranchPushed() {
|
|
33954
34035
|
const args = hasUpstream2() ? ["push"] : ["push", "--set-upstream", "origin", "HEAD"];
|
|
33955
|
-
|
|
34036
|
+
execFileSync21("git", args, { stdio: "inherit" });
|
|
33956
34037
|
}
|
|
33957
34038
|
async function placePr(prNumber, title, body, options2, attachments = []) {
|
|
33958
34039
|
const args = prNumber !== null ? buildEditArgs(prNumber, title, body, attachments) : buildCreateArgs(title, body, options2, attachments);
|
|
@@ -34023,10 +34104,10 @@ function warn(reason4) {
|
|
|
34023
34104
|
}
|
|
34024
34105
|
|
|
34025
34106
|
// src/commands/prs/enableAutoMerge.ts
|
|
34026
|
-
import { execFileSync as
|
|
34107
|
+
import { execFileSync as execFileSync22 } from "child_process";
|
|
34027
34108
|
function enableAutoMerge() {
|
|
34028
34109
|
try {
|
|
34029
|
-
|
|
34110
|
+
execFileSync22(
|
|
34030
34111
|
"gh",
|
|
34031
34112
|
["pr", "merge", getCurrentBranch2(), "--auto", "--squash"],
|
|
34032
34113
|
{ stdio: "inherit" }
|
|
@@ -34284,10 +34365,10 @@ function prsSlackChannel() {
|
|
|
34284
34365
|
}
|
|
34285
34366
|
|
|
34286
34367
|
// src/commands/prs/status/fetchReviewThreads.ts
|
|
34287
|
-
import { execFileSync as
|
|
34368
|
+
import { execFileSync as execFileSync23 } from "child_process";
|
|
34288
34369
|
var THREAD_QUERY2 = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { isResolved } } } } }`;
|
|
34289
34370
|
function fetchReviewThreads(org, repo, prNumber) {
|
|
34290
|
-
const output =
|
|
34371
|
+
const output = execFileSync23(
|
|
34291
34372
|
"gh",
|
|
34292
34373
|
[
|
|
34293
34374
|
"api",
|
|
@@ -34345,10 +34426,10 @@ function describeFetchError(error) {
|
|
|
34345
34426
|
}
|
|
34346
34427
|
|
|
34347
34428
|
// src/commands/prs/status/fetchRepoPullRequests.ts
|
|
34348
|
-
import { execSync as
|
|
34429
|
+
import { execSync as execSync45 } from "child_process";
|
|
34349
34430
|
var FIELDS2 = "number,title,url,author,isDraft,createdAt,updatedAt,reviewDecision,latestReviews,statusCheckRollup,mergeable";
|
|
34350
34431
|
function fetchRepoPullRequests(org, repo) {
|
|
34351
|
-
const output =
|
|
34432
|
+
const output = execSync45(
|
|
34352
34433
|
`gh pr list --state open --json ${FIELDS2} --limit 100 -R ${org}/${repo}`,
|
|
34353
34434
|
{ encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }
|
|
34354
34435
|
);
|
|
@@ -34609,7 +34690,7 @@ function registerPrsStatus(prsCommand) {
|
|
|
34609
34690
|
}
|
|
34610
34691
|
|
|
34611
34692
|
// src/commands/readTime/readTime.ts
|
|
34612
|
-
import { readFileSync as
|
|
34693
|
+
import { readFileSync as readFileSync50 } from "fs";
|
|
34613
34694
|
|
|
34614
34695
|
// src/commands/readTime/countReadingWords.ts
|
|
34615
34696
|
var FENCE_PATTERN = /^\s*(```|~~~)/;
|
|
@@ -34697,7 +34778,7 @@ function resolveReadTimeTarget(target) {
|
|
|
34697
34778
|
}
|
|
34698
34779
|
|
|
34699
34780
|
// src/commands/prs/fetchPrBody.ts
|
|
34700
|
-
import { execSync as
|
|
34781
|
+
import { execSync as execSync46 } from "child_process";
|
|
34701
34782
|
function exitGhNotInstalled() {
|
|
34702
34783
|
console.error("Error: GitHub CLI (gh) is not installed.");
|
|
34703
34784
|
console.error("Install it from https://cli.github.com/");
|
|
@@ -34718,7 +34799,7 @@ function currentRepo() {
|
|
|
34718
34799
|
function fetchPrBody(number, repo) {
|
|
34719
34800
|
const { org, repo: name } = repo ?? currentRepo();
|
|
34720
34801
|
try {
|
|
34721
|
-
const raw =
|
|
34802
|
+
const raw = execSync46(`gh pr view ${number} --json body -R ${org}/${name}`, {
|
|
34722
34803
|
encoding: "utf8",
|
|
34723
34804
|
stdio: ["pipe", "pipe", "pipe"]
|
|
34724
34805
|
});
|
|
@@ -34770,7 +34851,7 @@ async function loadBody(target) {
|
|
|
34770
34851
|
}
|
|
34771
34852
|
function readDraftFile(path109) {
|
|
34772
34853
|
try {
|
|
34773
|
-
return
|
|
34854
|
+
return readFileSync50(path109, "utf8");
|
|
34774
34855
|
} catch {
|
|
34775
34856
|
console.error(`Error: Could not read \`${path109}\`.`);
|
|
34776
34857
|
console.error(
|
|
@@ -34874,10 +34955,10 @@ import chalk207 from "chalk";
|
|
|
34874
34955
|
import Enquirer2 from "enquirer";
|
|
34875
34956
|
|
|
34876
34957
|
// src/commands/ravendb/searchItems.ts
|
|
34877
|
-
import { execSync as
|
|
34958
|
+
import { execSync as execSync47 } from "child_process";
|
|
34878
34959
|
import chalk206 from "chalk";
|
|
34879
34960
|
function opExec(args) {
|
|
34880
|
-
return
|
|
34961
|
+
return execSync47(`op ${args}`, {
|
|
34881
34962
|
encoding: "utf8",
|
|
34882
34963
|
stdio: ["pipe", "pipe", "pipe"]
|
|
34883
34964
|
}).trim();
|
|
@@ -35029,7 +35110,7 @@ ${errorText}`
|
|
|
35029
35110
|
}
|
|
35030
35111
|
|
|
35031
35112
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
35032
|
-
import { execSync as
|
|
35113
|
+
import { execSync as execSync48 } from "child_process";
|
|
35033
35114
|
import chalk211 from "chalk";
|
|
35034
35115
|
function resolveOpSecret(reference) {
|
|
35035
35116
|
if (!reference.startsWith("op://")) {
|
|
@@ -35037,7 +35118,7 @@ function resolveOpSecret(reference) {
|
|
|
35037
35118
|
process.exit(1);
|
|
35038
35119
|
}
|
|
35039
35120
|
try {
|
|
35040
|
-
return
|
|
35121
|
+
return execSync48(`op read "${reference}"`, {
|
|
35041
35122
|
encoding: "utf8",
|
|
35042
35123
|
stdio: ["pipe", "pipe", "pipe"]
|
|
35043
35124
|
}).trim();
|
|
@@ -35277,10 +35358,10 @@ function checkStreamGraph(streams) {
|
|
|
35277
35358
|
}
|
|
35278
35359
|
|
|
35279
35360
|
// src/commands/releases/readStreamsInput.ts
|
|
35280
|
-
import { readFileSync as
|
|
35361
|
+
import { readFileSync as readFileSync51 } from "fs";
|
|
35281
35362
|
import { parse as parse4 } from "yaml";
|
|
35282
35363
|
function readSource2(source) {
|
|
35283
|
-
return
|
|
35364
|
+
return readFileSync51(source === "-" ? 0 : source, "utf8");
|
|
35284
35365
|
}
|
|
35285
35366
|
function readStreamsInput(source) {
|
|
35286
35367
|
let parsed;
|
|
@@ -35491,9 +35572,9 @@ function registerReleases(parent) {
|
|
|
35491
35572
|
}
|
|
35492
35573
|
|
|
35493
35574
|
// src/commands/coverage.ts
|
|
35494
|
-
import { execSync as
|
|
35575
|
+
import { execSync as execSync49 } from "child_process";
|
|
35495
35576
|
function coverage() {
|
|
35496
|
-
const output =
|
|
35577
|
+
const output = execSync49(
|
|
35497
35578
|
"npx vitest run --coverage --coverage.include='src/**/*.ts' --coverage.all --coverage.reporter=text 2>&1",
|
|
35498
35579
|
{ encoding: "utf8", timeout: 12e4 }
|
|
35499
35580
|
);
|
|
@@ -35950,10 +36031,10 @@ async function notify() {
|
|
|
35950
36031
|
}
|
|
35951
36032
|
|
|
35952
36033
|
// src/commands/screenshot.ts
|
|
35953
|
-
import { execSync as
|
|
36034
|
+
import { execSync as execSync50 } from "child_process";
|
|
35954
36035
|
import { existsSync as existsSync66, mkdirSync as mkdirSync26, unlinkSync as unlinkSync17, writeFileSync as writeFileSync41 } from "fs";
|
|
35955
36036
|
import { tmpdir as tmpdir7 } from "os";
|
|
35956
|
-
import { join as
|
|
36037
|
+
import { join as join87, resolve as resolve25 } from "path";
|
|
35957
36038
|
import chalk223 from "chalk";
|
|
35958
36039
|
|
|
35959
36040
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -36090,10 +36171,10 @@ function buildOutputPath(outputDir, processName) {
|
|
|
36090
36171
|
return resolve25(outputDir, `${processName}-${timestamp8}.png`);
|
|
36091
36172
|
}
|
|
36092
36173
|
function runPowerShellScript(processName, outputPath) {
|
|
36093
|
-
const scriptPath =
|
|
36174
|
+
const scriptPath = join87(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
36094
36175
|
writeFileSync41(scriptPath, captureWindowPs1, "utf8");
|
|
36095
36176
|
try {
|
|
36096
|
-
|
|
36177
|
+
execSync50(
|
|
36097
36178
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|
|
36098
36179
|
{ stdio: ["ignore", "pipe", "pipe"], encoding: "utf8" }
|
|
36099
36180
|
);
|
|
@@ -36191,10 +36272,10 @@ function buildLimitsSegment(rateLimits) {
|
|
|
36191
36272
|
}
|
|
36192
36273
|
|
|
36193
36274
|
// src/commands/readGitBranch.ts
|
|
36194
|
-
import { readFileSync as
|
|
36195
|
-
import { isAbsolute as isAbsolute6, join as
|
|
36275
|
+
import { readFileSync as readFileSync52, statSync as statSync10 } from "fs";
|
|
36276
|
+
import { isAbsolute as isAbsolute6, join as join88, resolve as resolve26 } from "path";
|
|
36196
36277
|
function resolveGitDir(cwd) {
|
|
36197
|
-
const dotGit =
|
|
36278
|
+
const dotGit = join88(cwd, ".git");
|
|
36198
36279
|
let stat5;
|
|
36199
36280
|
try {
|
|
36200
36281
|
stat5 = statSync10(dotGit);
|
|
@@ -36206,7 +36287,7 @@ function resolveGitDir(cwd) {
|
|
|
36206
36287
|
}
|
|
36207
36288
|
let contents;
|
|
36208
36289
|
try {
|
|
36209
|
-
contents =
|
|
36290
|
+
contents = readFileSync52(dotGit, "utf8");
|
|
36210
36291
|
} catch {
|
|
36211
36292
|
return null;
|
|
36212
36293
|
}
|
|
@@ -36224,7 +36305,7 @@ function readGitBranch(cwd) {
|
|
|
36224
36305
|
}
|
|
36225
36306
|
let head;
|
|
36226
36307
|
try {
|
|
36227
|
-
head =
|
|
36308
|
+
head = readFileSync52(join88(gitDir, "HEAD"), "utf8");
|
|
36228
36309
|
} catch {
|
|
36229
36310
|
return null;
|
|
36230
36311
|
}
|
|
@@ -36311,7 +36392,7 @@ async function statusLine() {
|
|
|
36311
36392
|
}
|
|
36312
36393
|
|
|
36313
36394
|
// src/commands/update.ts
|
|
36314
|
-
import { execSync as
|
|
36395
|
+
import { execSync as execSync51 } from "child_process";
|
|
36315
36396
|
import * as path47 from "path";
|
|
36316
36397
|
|
|
36317
36398
|
// src/commands/restartDaemonAfterUpdate.ts
|
|
@@ -36335,7 +36416,7 @@ function isGlobalNpmInstall(dir) {
|
|
|
36335
36416
|
if (resolved.split(path47.sep).includes("node_modules")) {
|
|
36336
36417
|
return true;
|
|
36337
36418
|
}
|
|
36338
|
-
const globalPrefix =
|
|
36419
|
+
const globalPrefix = execSync51("npm prefix -g", { stdio: "pipe" }).toString().trim();
|
|
36339
36420
|
return resolved.toLowerCase().startsWith(path47.resolve(globalPrefix).toLowerCase());
|
|
36340
36421
|
} catch {
|
|
36341
36422
|
return false;
|
|
@@ -36346,18 +36427,18 @@ async function update2() {
|
|
|
36346
36427
|
console.log(`Assist is installed at: ${installDir}`);
|
|
36347
36428
|
if (isGitRepo(installDir)) {
|
|
36348
36429
|
console.log("Detected git repo installation, pulling latest...");
|
|
36349
|
-
|
|
36430
|
+
execSync51("git pull", { cwd: installDir, stdio: "inherit" });
|
|
36350
36431
|
console.log("Installing dependencies...");
|
|
36351
|
-
|
|
36432
|
+
execSync51("npm i", { cwd: installDir, stdio: "inherit" });
|
|
36352
36433
|
console.log("Building...");
|
|
36353
|
-
|
|
36434
|
+
execSync51("npm run build", { cwd: installDir, stdio: "inherit" });
|
|
36354
36435
|
console.log("Syncing commands...");
|
|
36355
|
-
|
|
36436
|
+
execSync51("assist sync", { stdio: "inherit" });
|
|
36356
36437
|
} else if (isGlobalNpmInstall(installDir)) {
|
|
36357
36438
|
console.log("Detected global npm installation, updating...");
|
|
36358
|
-
|
|
36439
|
+
execSync51("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
|
|
36359
36440
|
console.log("Syncing commands...");
|
|
36360
|
-
|
|
36441
|
+
execSync51("assist sync", { stdio: "inherit" });
|
|
36361
36442
|
} else {
|
|
36362
36443
|
console.error(
|
|
36363
36444
|
"Could not determine installation method. Expected a git repo or global npm install."
|
|
@@ -36460,7 +36541,7 @@ Refactor check failed:
|
|
|
36460
36541
|
}
|
|
36461
36542
|
|
|
36462
36543
|
// src/commands/refactor/check/getViolations.ts
|
|
36463
|
-
import { execSync as
|
|
36544
|
+
import { execSync as execSync52 } from "child_process";
|
|
36464
36545
|
import fs30 from "fs";
|
|
36465
36546
|
import { minimatch as minimatch3 } from "minimatch";
|
|
36466
36547
|
|
|
@@ -36510,7 +36591,7 @@ function getGitFiles(options2) {
|
|
|
36510
36591
|
}
|
|
36511
36592
|
const files = /* @__PURE__ */ new Set();
|
|
36512
36593
|
if (options2.staged || options2.modified) {
|
|
36513
|
-
const staged =
|
|
36594
|
+
const staged = execSync52("git diff --cached --name-only", {
|
|
36514
36595
|
encoding: "utf8"
|
|
36515
36596
|
});
|
|
36516
36597
|
for (const file of staged.trim().split("\n").filter(Boolean)) {
|
|
@@ -36518,7 +36599,7 @@ function getGitFiles(options2) {
|
|
|
36518
36599
|
}
|
|
36519
36600
|
}
|
|
36520
36601
|
if (options2.unstaged || options2.modified) {
|
|
36521
|
-
const unstaged =
|
|
36602
|
+
const unstaged = execSync52("git diff --name-only", { encoding: "utf8" });
|
|
36522
36603
|
for (const file of unstaged.trim().split("\n").filter(Boolean)) {
|
|
36523
36604
|
files.add(file);
|
|
36524
36605
|
}
|
|
@@ -38314,10 +38395,10 @@ import path78 from "path";
|
|
|
38314
38395
|
import { minimatch as minimatch4 } from "minimatch";
|
|
38315
38396
|
function partitionIgnored(files) {
|
|
38316
38397
|
const globs = loadConfig().restructure?.ignore ?? [];
|
|
38317
|
-
const
|
|
38398
|
+
const isIgnored2 = (file) => globs.some((glob) => minimatch4(path78.relative(process.cwd(), file), glob));
|
|
38318
38399
|
return {
|
|
38319
|
-
scoped: files.filter((f) => !
|
|
38320
|
-
ignored: files.filter(
|
|
38400
|
+
scoped: files.filter((f) => !isIgnored2(f)),
|
|
38401
|
+
ignored: files.filter(isIgnored2)
|
|
38321
38402
|
};
|
|
38322
38403
|
}
|
|
38323
38404
|
|
|
@@ -38719,7 +38800,7 @@ function exitWith(message3) {
|
|
|
38719
38800
|
}
|
|
38720
38801
|
|
|
38721
38802
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
38722
|
-
import { execFileSync as
|
|
38803
|
+
import { execFileSync as execFileSync25 } from "child_process";
|
|
38723
38804
|
import chalk248 from "chalk";
|
|
38724
38805
|
|
|
38725
38806
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
@@ -38768,7 +38849,7 @@ function readGlobs(value) {
|
|
|
38768
38849
|
}
|
|
38769
38850
|
|
|
38770
38851
|
// src/commands/review/highLevel/summariseRepoTree.ts
|
|
38771
|
-
import { execFileSync as
|
|
38852
|
+
import { execFileSync as execFileSync24 } from "child_process";
|
|
38772
38853
|
import { dirname as dirname40, extname as extname6 } from "path";
|
|
38773
38854
|
var MAX_DIRECTORIES = 200;
|
|
38774
38855
|
var MAX_EXTENSIONS_PER_DIRECTORY = 6;
|
|
@@ -38784,7 +38865,7 @@ function summariseRepoTree(cwd = process.cwd()) {
|
|
|
38784
38865
|
}
|
|
38785
38866
|
function listTrackedFiles(cwd) {
|
|
38786
38867
|
try {
|
|
38787
|
-
return
|
|
38868
|
+
return execFileSync24("git", ["ls-files"], {
|
|
38788
38869
|
cwd,
|
|
38789
38870
|
encoding: "utf8",
|
|
38790
38871
|
maxBuffer: 64 * 1024 * 1024
|
|
@@ -38829,7 +38910,7 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
38829
38910
|
}
|
|
38830
38911
|
function askClaude(prompt, cwd) {
|
|
38831
38912
|
try {
|
|
38832
|
-
return
|
|
38913
|
+
return execFileSync25("claude", ["-p", "--model", "sonnet", prompt], {
|
|
38833
38914
|
cwd,
|
|
38834
38915
|
encoding: "utf8",
|
|
38835
38916
|
timeout: 12e4,
|
|
@@ -38929,7 +39010,7 @@ function groupFilesByDirectory(files) {
|
|
|
38929
39010
|
}
|
|
38930
39011
|
|
|
38931
39012
|
// src/commands/review/highLevel/buildHighLevelTree.ts
|
|
38932
|
-
function
|
|
39013
|
+
function basename24(path109) {
|
|
38933
39014
|
return path109.slice(path109.lastIndexOf("/") + 1);
|
|
38934
39015
|
}
|
|
38935
39016
|
function sum(nodes, key) {
|
|
@@ -38945,7 +39026,7 @@ function nodesOf(at2, prefix2) {
|
|
|
38945
39026
|
const files = at2.files.map(
|
|
38946
39027
|
(file) => ({
|
|
38947
39028
|
kind: "file",
|
|
38948
|
-
name:
|
|
39029
|
+
name: basename24(file.path),
|
|
38949
39030
|
...file
|
|
38950
39031
|
})
|
|
38951
39032
|
);
|
|
@@ -39465,11 +39546,11 @@ function evaluateHighLevelChecks(subject) {
|
|
|
39465
39546
|
}
|
|
39466
39547
|
|
|
39467
39548
|
// src/commands/review/highLevel/fetchFileAtSha.ts
|
|
39468
|
-
import { execFileSync as
|
|
39549
|
+
import { execFileSync as execFileSync26 } from "child_process";
|
|
39469
39550
|
function fetchFileAtSha(repo, sha, path109) {
|
|
39470
39551
|
const encodedPath = path109.split("/").map(encodeURIComponent).join("/");
|
|
39471
39552
|
try {
|
|
39472
|
-
return
|
|
39553
|
+
return execFileSync26(
|
|
39473
39554
|
"gh",
|
|
39474
39555
|
[
|
|
39475
39556
|
"api",
|
|
@@ -39491,7 +39572,7 @@ function fetchFileAtSha(repo, sha, path109) {
|
|
|
39491
39572
|
}
|
|
39492
39573
|
|
|
39493
39574
|
// src/commands/review/highLevel/fetchHighLevelFiles.ts
|
|
39494
|
-
import { execFileSync as
|
|
39575
|
+
import { execFileSync as execFileSync27 } from "child_process";
|
|
39495
39576
|
import { createHash as createHash4 } from "crypto";
|
|
39496
39577
|
var JQ = ".[] | {filename,status,additions,deletions,patch} | @json";
|
|
39497
39578
|
function toStatus(status2) {
|
|
@@ -39504,7 +39585,7 @@ function diffUrl(repo, prNumber, path109) {
|
|
|
39504
39585
|
return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
|
|
39505
39586
|
}
|
|
39506
39587
|
function fetchHighLevelFiles(prNumber, repo) {
|
|
39507
|
-
const out =
|
|
39588
|
+
const out = execFileSync27(
|
|
39508
39589
|
"gh",
|
|
39509
39590
|
["api", `repos/${repo}/pulls/${prNumber}/files`, "--paginate", "--jq", JQ],
|
|
39510
39591
|
{ encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
|
|
@@ -39523,7 +39604,7 @@ function fetchHighLevelFiles(prNumber, repo) {
|
|
|
39523
39604
|
}
|
|
39524
39605
|
|
|
39525
39606
|
// src/commands/review/highLevel/fetchHighLevelPr.ts
|
|
39526
|
-
import { execSync as
|
|
39607
|
+
import { execSync as execSync53 } from "child_process";
|
|
39527
39608
|
|
|
39528
39609
|
// src/commands/review/highLevel/waitForMergeable.ts
|
|
39529
39610
|
var MAX_ATTEMPTS = 5;
|
|
@@ -39542,7 +39623,7 @@ function waitForMergeable(initial, refetch, delayMs = DELAY_MS) {
|
|
|
39542
39623
|
|
|
39543
39624
|
// src/commands/review/highLevel/fetchHighLevelPr.ts
|
|
39544
39625
|
function ghPrView(prNumber, repo, fields) {
|
|
39545
|
-
const raw =
|
|
39626
|
+
const raw = execSync53(
|
|
39546
39627
|
`gh pr view ${prNumber} --json ${fields} -R ${repo.org}/${repo.repo}`,
|
|
39547
39628
|
{ encoding: "utf8" }
|
|
39548
39629
|
);
|
|
@@ -39571,12 +39652,12 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
39571
39652
|
}
|
|
39572
39653
|
|
|
39573
39654
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
39574
|
-
import { join as
|
|
39655
|
+
import { join as join89 } from "path";
|
|
39575
39656
|
function slug(value) {
|
|
39576
39657
|
return value.replace(/[^\w.-]+/g, "-");
|
|
39577
39658
|
}
|
|
39578
39659
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
39579
|
-
return
|
|
39660
|
+
return join89(
|
|
39580
39661
|
getStoreDir(),
|
|
39581
39662
|
"high-level-reviews",
|
|
39582
39663
|
slug(repo),
|
|
@@ -39593,11 +39674,11 @@ function highLevelDraftPath(repo, headRef, headSha) {
|
|
|
39593
39674
|
}
|
|
39594
39675
|
|
|
39595
39676
|
// src/commands/review/highLevel/readJsonFile.ts
|
|
39596
|
-
import { existsSync as existsSync67, readFileSync as
|
|
39677
|
+
import { existsSync as existsSync67, readFileSync as readFileSync53 } from "fs";
|
|
39597
39678
|
function readJsonFile(path109) {
|
|
39598
39679
|
if (!existsSync67(path109)) return void 0;
|
|
39599
39680
|
try {
|
|
39600
|
-
return JSON.parse(
|
|
39681
|
+
return JSON.parse(readFileSync53(path109, "utf8"));
|
|
39601
39682
|
} catch {
|
|
39602
39683
|
return void 0;
|
|
39603
39684
|
}
|
|
@@ -40240,7 +40321,7 @@ async function runHighLevelReview(number, options2 = {}) {
|
|
|
40240
40321
|
}
|
|
40241
40322
|
|
|
40242
40323
|
// src/commands/review/ci/writeJobSummary.ts
|
|
40243
|
-
import { appendFileSync as appendFileSync3, readFileSync as
|
|
40324
|
+
import { appendFileSync as appendFileSync3, readFileSync as readFileSync54 } from "fs";
|
|
40244
40325
|
|
|
40245
40326
|
// src/commands/review/carriedUnanchoredFindings.ts
|
|
40246
40327
|
function carriedUnanchoredFindings(unanchored) {
|
|
@@ -40440,11 +40521,11 @@ function buildDiffLineIndex(diff3) {
|
|
|
40440
40521
|
}
|
|
40441
40522
|
|
|
40442
40523
|
// src/commands/review/fetchPrDiff.ts
|
|
40443
|
-
import { execSync as
|
|
40524
|
+
import { execSync as execSync54 } from "child_process";
|
|
40444
40525
|
function fetchPrDiff(prNumber, baseSha, headSha) {
|
|
40445
40526
|
const { org, repo } = getRepoInfo();
|
|
40446
40527
|
try {
|
|
40447
|
-
return
|
|
40528
|
+
return execSync54(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
|
|
40448
40529
|
encoding: "utf8",
|
|
40449
40530
|
maxBuffer: 256 * 1024 * 1024,
|
|
40450
40531
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -40459,10 +40540,10 @@ function isDiffTooLarge(error) {
|
|
|
40459
40540
|
}
|
|
40460
40541
|
function fetchDiffViaGit(baseSha, headSha) {
|
|
40461
40542
|
try {
|
|
40462
|
-
|
|
40543
|
+
execSync54(`git fetch origin ${baseSha} ${headSha}`, { stdio: "ignore" });
|
|
40463
40544
|
} catch {
|
|
40464
40545
|
}
|
|
40465
|
-
return
|
|
40546
|
+
return execSync54(`git diff ${baseSha}...${headSha}`, {
|
|
40466
40547
|
encoding: "utf8",
|
|
40467
40548
|
maxBuffer: 256 * 1024 * 1024
|
|
40468
40549
|
});
|
|
@@ -40622,7 +40703,7 @@ function buildTokenUsageTable(usages) {
|
|
|
40622
40703
|
// src/commands/review/ci/writeJobSummary.ts
|
|
40623
40704
|
function writeJobSummary(synthesisPath, prInfo, summaryPath, slots) {
|
|
40624
40705
|
if (!summaryPath) return;
|
|
40625
|
-
const markdown =
|
|
40706
|
+
const markdown = readFileSync54(synthesisPath, "utf8");
|
|
40626
40707
|
const { unanchored } = selectPostableFindings(markdown, prInfo);
|
|
40627
40708
|
const usageTable = buildTokenUsageTable(slots.map((slot) => slot.usage));
|
|
40628
40709
|
appendFileSync3(
|
|
@@ -40741,7 +40822,7 @@ import { format as format2 } from "util";
|
|
|
40741
40822
|
|
|
40742
40823
|
// src/commands/review/createReviewLogSink.ts
|
|
40743
40824
|
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync28 } from "fs";
|
|
40744
|
-
import { join as
|
|
40825
|
+
import { join as join90 } from "path";
|
|
40745
40826
|
var LOG_FILE = "review.log";
|
|
40746
40827
|
function createReviewLogSink() {
|
|
40747
40828
|
let logPath2;
|
|
@@ -40758,7 +40839,7 @@ function createReviewLogSink() {
|
|
|
40758
40839
|
},
|
|
40759
40840
|
attach(reviewDir) {
|
|
40760
40841
|
mkdirSync28(reviewDir, { recursive: true });
|
|
40761
|
-
logPath2 =
|
|
40842
|
+
logPath2 = join90(reviewDir, LOG_FILE);
|
|
40762
40843
|
const lines2 = [
|
|
40763
40844
|
"",
|
|
40764
40845
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -41585,7 +41666,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
41585
41666
|
import { existsSync as existsSync69, unlinkSync as unlinkSync19 } from "fs";
|
|
41586
41667
|
|
|
41587
41668
|
// src/commands/review/synthesise.ts
|
|
41588
|
-
import { readFileSync as
|
|
41669
|
+
import { readFileSync as readFileSync55 } from "fs";
|
|
41589
41670
|
|
|
41590
41671
|
// src/commands/review/buildSynthesisStdin.ts
|
|
41591
41672
|
var SYNTHESIS_PROMPT = `You are consolidating two independent code reviews of the same change. The original review request is in request.md. The two reviews are in claude.md and codex.md in the current working directory.
|
|
@@ -41654,7 +41735,7 @@ Files:
|
|
|
41654
41735
|
|
|
41655
41736
|
// src/commands/review/synthesise.ts
|
|
41656
41737
|
function printSummary2(synthesisPath) {
|
|
41657
|
-
const markdown =
|
|
41738
|
+
const markdown = readFileSync55(synthesisPath, "utf8");
|
|
41658
41739
|
console.log("");
|
|
41659
41740
|
console.log(buildReviewSummary(markdown));
|
|
41660
41741
|
console.log("");
|
|
@@ -41918,28 +41999,28 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
41918
41999
|
|
|
41919
42000
|
// src/commands/review/buildReviewPaths.ts
|
|
41920
42001
|
import { homedir as homedir27 } from "os";
|
|
41921
|
-
import { basename as
|
|
42002
|
+
import { basename as basename25, join as join91 } from "path";
|
|
41922
42003
|
function buildReviewPaths(repoRoot2, key) {
|
|
41923
|
-
const reviewDir =
|
|
42004
|
+
const reviewDir = join91(
|
|
41924
42005
|
homedir27(),
|
|
41925
42006
|
".assist",
|
|
41926
42007
|
"reviews",
|
|
41927
|
-
|
|
42008
|
+
basename25(repoRoot2),
|
|
41928
42009
|
key
|
|
41929
42010
|
);
|
|
41930
42011
|
return {
|
|
41931
42012
|
reviewDir,
|
|
41932
|
-
requestPath:
|
|
41933
|
-
claudePath:
|
|
41934
|
-
codexPath:
|
|
41935
|
-
synthesisPath:
|
|
42013
|
+
requestPath: join91(reviewDir, "request.md"),
|
|
42014
|
+
claudePath: join91(reviewDir, "claude.md"),
|
|
42015
|
+
codexPath: join91(reviewDir, "codex.md"),
|
|
42016
|
+
synthesisPath: join91(reviewDir, "synthesis.md")
|
|
41936
42017
|
};
|
|
41937
42018
|
}
|
|
41938
42019
|
|
|
41939
42020
|
// src/commands/review/fetchExistingComments.ts
|
|
41940
|
-
import { execSync as
|
|
42021
|
+
import { execSync as execSync55 } from "child_process";
|
|
41941
42022
|
function fetchRawComments(org, repo, prNumber) {
|
|
41942
|
-
const out =
|
|
42023
|
+
const out = execSync55(
|
|
41943
42024
|
`gh api --paginate repos/${org}/${repo}/pulls/${prNumber}/comments`,
|
|
41944
42025
|
{ encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
|
|
41945
42026
|
);
|
|
@@ -42000,18 +42081,18 @@ function logPriorComments(count10) {
|
|
|
42000
42081
|
}
|
|
42001
42082
|
|
|
42002
42083
|
// src/commands/review/gatherContext.ts
|
|
42003
|
-
import { execSync as
|
|
42084
|
+
import { execSync as execSync57 } from "child_process";
|
|
42004
42085
|
|
|
42005
42086
|
// src/commands/review/fetchPrDiffInfo.ts
|
|
42006
|
-
import { execSync as
|
|
42087
|
+
import { execSync as execSync56 } from "child_process";
|
|
42007
42088
|
function getCurrentBranch3() {
|
|
42008
|
-
return
|
|
42089
|
+
return execSync56("git rev-parse --abbrev-ref HEAD", {
|
|
42009
42090
|
encoding: "utf8"
|
|
42010
42091
|
}).trim();
|
|
42011
42092
|
}
|
|
42012
42093
|
var FIELDS3 = "number,baseRefName,baseRefOid,headRefName,headRefOid";
|
|
42013
42094
|
function runGh2(command) {
|
|
42014
|
-
return
|
|
42095
|
+
return execSync56(command, {
|
|
42015
42096
|
encoding: "utf8",
|
|
42016
42097
|
stdio: ["ignore", "pipe", "pipe"]
|
|
42017
42098
|
});
|
|
@@ -42049,7 +42130,7 @@ function fetchPrDiffInfo() {
|
|
|
42049
42130
|
}
|
|
42050
42131
|
function fetchPrChangedFiles(prNumber) {
|
|
42051
42132
|
const { org, repo } = getRepoInfo();
|
|
42052
|
-
const out =
|
|
42133
|
+
const out = execSync56(
|
|
42053
42134
|
`gh api repos/${org}/${repo}/pulls/${prNumber}/files --paginate --jq ".[].filename"`,
|
|
42054
42135
|
{
|
|
42055
42136
|
encoding: "utf8",
|
|
@@ -42061,11 +42142,11 @@ function fetchPrChangedFiles(prNumber) {
|
|
|
42061
42142
|
|
|
42062
42143
|
// src/commands/review/gatherContext.ts
|
|
42063
42144
|
function gatherContext() {
|
|
42064
|
-
const branch2 =
|
|
42145
|
+
const branch2 = execSync57("git rev-parse --abbrev-ref HEAD", {
|
|
42065
42146
|
encoding: "utf8"
|
|
42066
42147
|
}).trim();
|
|
42067
|
-
const sha =
|
|
42068
|
-
const shortSha =
|
|
42148
|
+
const sha = execSync57("git rev-parse HEAD", { encoding: "utf8" }).trim();
|
|
42149
|
+
const shortSha = execSync57("git rev-parse --short=7 HEAD", {
|
|
42069
42150
|
encoding: "utf8"
|
|
42070
42151
|
}).trim();
|
|
42071
42152
|
const prInfo = fetchPrDiffInfo();
|
|
@@ -42096,7 +42177,7 @@ function gatherChangedContext() {
|
|
|
42096
42177
|
}
|
|
42097
42178
|
|
|
42098
42179
|
// src/commands/review/postReviewToPr.ts
|
|
42099
|
-
import { readFileSync as
|
|
42180
|
+
import { readFileSync as readFileSync56 } from "fs";
|
|
42100
42181
|
|
|
42101
42182
|
// src/commands/review/chainAddressComments.ts
|
|
42102
42183
|
function chainAddressComments(prNumber, announce) {
|
|
@@ -42278,7 +42359,7 @@ async function confirmPost(prNumber, work, options2) {
|
|
|
42278
42359
|
return promptConfirm(`Post ${work} to PR #${prNumber}?`, false);
|
|
42279
42360
|
}
|
|
42280
42361
|
async function postFindingsToPr(prInfo, synthesisPath, options2) {
|
|
42281
|
-
const markdown =
|
|
42362
|
+
const markdown = readFileSync56(synthesisPath, "utf8");
|
|
42282
42363
|
const { inDiff, unanchored } = selectPostableFindings(markdown, prInfo);
|
|
42283
42364
|
const carried = carriedUnanchoredFindings(unanchored);
|
|
42284
42365
|
if (inDiff.length === 0 && carried.length === 0)
|
|
@@ -42631,20 +42712,20 @@ import path87 from "path";
|
|
|
42631
42712
|
import chalk258 from "chalk";
|
|
42632
42713
|
|
|
42633
42714
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
42634
|
-
import { existsSync as existsSync71, readFileSync as
|
|
42715
|
+
import { existsSync as existsSync71, readFileSync as readFileSync58, writeFileSync as writeFileSync45 } from "fs";
|
|
42635
42716
|
import path86 from "path";
|
|
42636
42717
|
|
|
42637
42718
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
42638
|
-
import { readFileSync as
|
|
42719
|
+
import { readFileSync as readFileSync57 } from "fs";
|
|
42639
42720
|
import path85 from "path";
|
|
42640
42721
|
|
|
42641
42722
|
// src/commands/rules/findClaudeFiles.ts
|
|
42642
|
-
import { readdirSync as
|
|
42723
|
+
import { readdirSync as readdirSync16 } from "fs";
|
|
42643
42724
|
import path84 from "path";
|
|
42644
42725
|
var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
|
|
42645
42726
|
function findClaudeFiles(dir) {
|
|
42646
42727
|
const results = [];
|
|
42647
|
-
for (const entry of
|
|
42728
|
+
for (const entry of readdirSync16(dir, { withFileTypes: true })) {
|
|
42648
42729
|
if (entry.isDirectory()) {
|
|
42649
42730
|
if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
|
|
42650
42731
|
continue;
|
|
@@ -42659,7 +42740,7 @@ function findClaudeFiles(dir) {
|
|
|
42659
42740
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
42660
42741
|
function scopedRuleDirectories(root2) {
|
|
42661
42742
|
return findClaudeFiles(root2).filter(
|
|
42662
|
-
(file) => path85.dirname(file) !== root2 && parseRulesSection(
|
|
42743
|
+
(file) => path85.dirname(file) !== root2 && parseRulesSection(readFileSync57(file, "utf8")).length > 0
|
|
42663
42744
|
).map(
|
|
42664
42745
|
(file) => `${path85.relative(root2, path85.dirname(file)).split(path85.sep).join("/")}/`
|
|
42665
42746
|
).sort();
|
|
@@ -42701,7 +42782,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
42701
42782
|
function updateScopedRulesIndex(root2) {
|
|
42702
42783
|
const directories = scopedRuleDirectories(root2);
|
|
42703
42784
|
const rootFile = path86.join(root2, "CLAUDE.md");
|
|
42704
|
-
const before = existsSync71(rootFile) ?
|
|
42785
|
+
const before = existsSync71(rootFile) ? readFileSync58(rootFile, "utf8") : "";
|
|
42705
42786
|
const after = upsertScopedRulesPointer(before, directories);
|
|
42706
42787
|
if (after !== before) writeFileSync45(rootFile, after);
|
|
42707
42788
|
return directories;
|
|
@@ -42754,7 +42835,7 @@ function listRules(target, options2 = {}) {
|
|
|
42754
42835
|
}
|
|
42755
42836
|
|
|
42756
42837
|
// src/commands/rules/addRule.ts
|
|
42757
|
-
import { existsSync as existsSync73, readFileSync as
|
|
42838
|
+
import { existsSync as existsSync73, readFileSync as readFileSync60, writeFileSync as writeFileSync46 } from "fs";
|
|
42758
42839
|
import path90 from "path";
|
|
42759
42840
|
import chalk260 from "chalk";
|
|
42760
42841
|
|
|
@@ -42779,11 +42860,11 @@ function insertRuleBullet(content, rule) {
|
|
|
42779
42860
|
}
|
|
42780
42861
|
|
|
42781
42862
|
// src/commands/rules/nextRuleCode.ts
|
|
42782
|
-
import { readFileSync as
|
|
42863
|
+
import { readFileSync as readFileSync59 } from "fs";
|
|
42783
42864
|
var CODE_PREFIX = "R";
|
|
42784
42865
|
function nextRuleCode(root2) {
|
|
42785
42866
|
const numbers = findClaudeFiles(root2).flatMap(
|
|
42786
|
-
(file) => parseRulesSection(
|
|
42867
|
+
(file) => parseRulesSection(readFileSync59(file, "utf8")).map(
|
|
42787
42868
|
(rule) => Number(/(\d+)\s*$/.exec(rule.code)?.[1] ?? 0)
|
|
42788
42869
|
)
|
|
42789
42870
|
);
|
|
@@ -42810,7 +42891,7 @@ function resolveRuleScope(target) {
|
|
|
42810
42891
|
|
|
42811
42892
|
// src/commands/rules/addRule.ts
|
|
42812
42893
|
function read2(file) {
|
|
42813
|
-
return existsSync73(file) ?
|
|
42894
|
+
return existsSync73(file) ? readFileSync60(file, "utf8") : "";
|
|
42814
42895
|
}
|
|
42815
42896
|
function addRule(text18, options2) {
|
|
42816
42897
|
const rule = text18.trim();
|
|
@@ -43339,8 +43420,10 @@ function registerSignal(program) {
|
|
|
43339
43420
|
"/next"
|
|
43340
43421
|
);
|
|
43341
43422
|
internalCommand(
|
|
43342
|
-
signalCommand.command("done").argument("[
|
|
43343
|
-
|
|
43423
|
+
signalCommand.command("done").argument("[ids...]", "Backlog item IDs created by the session").description(
|
|
43424
|
+
"Write a done signal to end a --once launch session, once every item it set out to create exists"
|
|
43425
|
+
).action((ids) => {
|
|
43426
|
+
writeSignal("done", ids.length > 0 ? { ids } : void 0);
|
|
43344
43427
|
console.log("Signal written.");
|
|
43345
43428
|
}),
|
|
43346
43429
|
"/draft, /bug, /refine"
|
|
@@ -43371,12 +43454,12 @@ import { mkdirSync as mkdirSync31, writeFileSync as writeFileSync48 } from "fs";
|
|
|
43371
43454
|
import { mkdirSync as mkdirSync30, writeFileSync as writeFileSync47 } from "fs";
|
|
43372
43455
|
|
|
43373
43456
|
// src/commands/slack/readSlackParts.ts
|
|
43374
|
-
import { readFileSync as
|
|
43457
|
+
import { readFileSync as readFileSync61 } from "fs";
|
|
43375
43458
|
function readSlackParts(files) {
|
|
43376
43459
|
return files.map((file) => {
|
|
43377
43460
|
let contents;
|
|
43378
43461
|
try {
|
|
43379
|
-
contents =
|
|
43462
|
+
contents = readFileSync61(file, "utf8");
|
|
43380
43463
|
} catch {
|
|
43381
43464
|
console.error(`Error: Part file not found: ${file}`);
|
|
43382
43465
|
process.exit(1);
|
|
@@ -43414,12 +43497,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
43414
43497
|
}
|
|
43415
43498
|
|
|
43416
43499
|
// src/commands/slack/slackWorkingFile.ts
|
|
43417
|
-
import { join as
|
|
43500
|
+
import { join as join92 } from "path";
|
|
43418
43501
|
function slackWorkingFile(channel, partIndex) {
|
|
43419
43502
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
43420
|
-
const dir =
|
|
43503
|
+
const dir = join92(getStoreDir(), "slack");
|
|
43421
43504
|
const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
43422
|
-
return { dir, bodyPath:
|
|
43505
|
+
return { dir, bodyPath: join92(dir, `${name}.md`) };
|
|
43423
43506
|
}
|
|
43424
43507
|
|
|
43425
43508
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -44490,9 +44573,9 @@ function formatVttPassages(passages, notes = [], { sourceMarks = true } = {}) {
|
|
|
44490
44573
|
}
|
|
44491
44574
|
|
|
44492
44575
|
// src/commands/transcript/convert/readCleanedCues.ts
|
|
44493
|
-
import { readFileSync as
|
|
44576
|
+
import { readFileSync as readFileSync66 } from "fs";
|
|
44494
44577
|
function readCleanedCues(inputPath) {
|
|
44495
|
-
return deduplicateCues(parseVtt(
|
|
44578
|
+
return deduplicateCues(parseVtt(readFileSync66(inputPath, "utf8")));
|
|
44496
44579
|
}
|
|
44497
44580
|
|
|
44498
44581
|
// src/commands/transcript/clean.ts
|
|
@@ -44601,21 +44684,21 @@ async function configure() {
|
|
|
44601
44684
|
}
|
|
44602
44685
|
|
|
44603
44686
|
// src/commands/transcript/list.ts
|
|
44604
|
-
import { existsSync as existsSync79, readdirSync as
|
|
44605
|
-
import { join as
|
|
44687
|
+
import { existsSync as existsSync79, readdirSync as readdirSync23, statSync as statSync12 } from "fs";
|
|
44688
|
+
import { join as join104 } from "path";
|
|
44606
44689
|
function list5() {
|
|
44607
44690
|
const { vttDir } = getTranscriptConfig();
|
|
44608
44691
|
if (!existsSync79(vttDir)) return;
|
|
44609
|
-
for (const entry of
|
|
44692
|
+
for (const entry of readdirSync23(vttDir)) {
|
|
44610
44693
|
if (!entry.endsWith(".vtt")) continue;
|
|
44611
|
-
if (statSync12(
|
|
44694
|
+
if (statSync12(join104(vttDir, entry)).isDirectory()) continue;
|
|
44612
44695
|
console.log(entry);
|
|
44613
44696
|
}
|
|
44614
44697
|
}
|
|
44615
44698
|
|
|
44616
44699
|
// src/commands/transcript/move.ts
|
|
44617
44700
|
import { existsSync as existsSync80, mkdirSync as mkdirSync37, renameSync as renameSync5, writeFileSync as writeFileSync53 } from "fs";
|
|
44618
|
-
import { basename as
|
|
44701
|
+
import { basename as basename28, join as join105 } from "path";
|
|
44619
44702
|
|
|
44620
44703
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
44621
44704
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -44625,9 +44708,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
44625
44708
|
// src/commands/transcript/move.ts
|
|
44626
44709
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
44627
44710
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
44628
|
-
const processedDir =
|
|
44711
|
+
const processedDir = join105(vttDir, "processed");
|
|
44629
44712
|
mkdirSync37(processedDir, { recursive: true });
|
|
44630
|
-
renameSync5(sourcePath,
|
|
44713
|
+
renameSync5(sourcePath, join105(processedDir, filename));
|
|
44631
44714
|
}
|
|
44632
44715
|
function move(file, options2) {
|
|
44633
44716
|
const { date, client } = options2;
|
|
@@ -44636,27 +44719,27 @@ function move(file, options2) {
|
|
|
44636
44719
|
process.exit(1);
|
|
44637
44720
|
}
|
|
44638
44721
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
44639
|
-
const filename =
|
|
44640
|
-
const sourcePath =
|
|
44722
|
+
const filename = basename28(file);
|
|
44723
|
+
const sourcePath = join105(vttDir, filename);
|
|
44641
44724
|
if (!existsSync80(sourcePath)) {
|
|
44642
44725
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
44643
44726
|
process.exit(1);
|
|
44644
44727
|
}
|
|
44645
|
-
const base =
|
|
44728
|
+
const base = basename28(filename, ".vtt").replace(/ Transcription$/, "");
|
|
44646
44729
|
const outputName = `${date} ${base}.md`;
|
|
44647
|
-
const formattedDir =
|
|
44730
|
+
const formattedDir = join105(transcriptsDir, client);
|
|
44648
44731
|
mkdirSync37(formattedDir, { recursive: true });
|
|
44649
|
-
const formattedPath =
|
|
44732
|
+
const formattedPath = join105(formattedDir, outputName);
|
|
44650
44733
|
writeFileSync53(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
44651
44734
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
44652
|
-
const summaryPath =
|
|
44735
|
+
const summaryPath = join105(summaryDir, client, outputName);
|
|
44653
44736
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
44654
44737
|
console.log(`Summary target: ${summaryPath}`);
|
|
44655
44738
|
}
|
|
44656
44739
|
|
|
44657
44740
|
// src/commands/transcript/merge.ts
|
|
44658
44741
|
import { existsSync as existsSync81, writeFileSync as writeFileSync54 } from "fs";
|
|
44659
|
-
import { basename as
|
|
44742
|
+
import { basename as basename29 } from "path";
|
|
44660
44743
|
|
|
44661
44744
|
// src/commands/transcript/failTranscript.ts
|
|
44662
44745
|
function failTranscript(message3) {
|
|
@@ -44802,7 +44885,7 @@ function readSource3(file) {
|
|
|
44802
44885
|
if (!existsSync81(file)) failTranscript(`VTT file not found: ${file}`);
|
|
44803
44886
|
const cues = readCleanedCues(file);
|
|
44804
44887
|
if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
|
|
44805
|
-
return { path: file, name:
|
|
44888
|
+
return { path: file, name: basename29(file), cues };
|
|
44806
44889
|
}
|
|
44807
44890
|
function wholePassages(sources) {
|
|
44808
44891
|
return sources.map((source) => ({
|
|
@@ -44950,7 +45033,7 @@ function adviceFragments() {
|
|
|
44950
45033
|
}
|
|
44951
45034
|
|
|
44952
45035
|
// src/commands/verify/blockCodeComments/findComments.ts
|
|
44953
|
-
import { execSync as
|
|
45036
|
+
import { execSync as execSync58 } from "child_process";
|
|
44954
45037
|
import fs49 from "fs";
|
|
44955
45038
|
import { minimatch as minimatch9 } from "minimatch";
|
|
44956
45039
|
import { Project as Project6 } from "ts-morph";
|
|
@@ -45189,7 +45272,7 @@ function shouldScan(file, ignoreGlobs) {
|
|
|
45189
45272
|
return fs49.existsSync(file);
|
|
45190
45273
|
}
|
|
45191
45274
|
function findComments(options2) {
|
|
45192
|
-
const diff3 =
|
|
45275
|
+
const diff3 = execSync58("git diff HEAD", {
|
|
45193
45276
|
encoding: "utf8",
|
|
45194
45277
|
maxBuffer: 64 * 1024 * 1024
|
|
45195
45278
|
});
|
|
@@ -45272,7 +45355,7 @@ function configKeys2() {
|
|
|
45272
45355
|
}
|
|
45273
45356
|
|
|
45274
45357
|
// src/commands/verify/forbiddenStrings.ts
|
|
45275
|
-
import { existsSync as existsSync82, readFileSync as
|
|
45358
|
+
import { existsSync as existsSync82, readFileSync as readFileSync67 } from "fs";
|
|
45276
45359
|
|
|
45277
45360
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
45278
45361
|
import { minimatch as minimatch10 } from "minimatch";
|
|
@@ -45319,7 +45402,7 @@ function forbiddenStrings() {
|
|
|
45319
45402
|
}
|
|
45320
45403
|
let parsed;
|
|
45321
45404
|
try {
|
|
45322
|
-
parsed = JSON.parse(
|
|
45405
|
+
parsed = JSON.parse(readFileSync67(file, "utf8"));
|
|
45323
45406
|
} catch (error) {
|
|
45324
45407
|
console.log(`Could not parse ${file}: ${error.message}`);
|
|
45325
45408
|
process.exit(1);
|
|
@@ -45345,13 +45428,13 @@ Total: ${violations.length} forbidden string(s).`);
|
|
|
45345
45428
|
}
|
|
45346
45429
|
|
|
45347
45430
|
// src/commands/verify/hardcodedColors.ts
|
|
45348
|
-
import { execFileSync as
|
|
45431
|
+
import { execFileSync as execFileSync28 } from "child_process";
|
|
45349
45432
|
import { minimatch as minimatch11 } from "minimatch";
|
|
45350
45433
|
var pattern = "0x[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,6}";
|
|
45351
45434
|
function hardcodedColors() {
|
|
45352
45435
|
const ignoreGlobs = loadConfig().hardcodedColors?.ignore ?? [];
|
|
45353
45436
|
try {
|
|
45354
|
-
const output =
|
|
45437
|
+
const output = execFileSync28("grep", ["-rEnH", "-f", "-", "src/"], {
|
|
45355
45438
|
encoding: "utf8",
|
|
45356
45439
|
input: `${pattern}
|
|
45357
45440
|
`
|
|
@@ -45391,7 +45474,7 @@ Total: ${lines2.length} hardcoded color(s)`);
|
|
|
45391
45474
|
}
|
|
45392
45475
|
|
|
45393
45476
|
// src/commands/verify/migrations.ts
|
|
45394
|
-
import { readFileSync as
|
|
45477
|
+
import { readFileSync as readFileSync68 } from "fs";
|
|
45395
45478
|
import path104 from "path";
|
|
45396
45479
|
|
|
45397
45480
|
// src/commands/verify/migrations/checkAppendOnly.ts
|
|
@@ -45463,36 +45546,36 @@ function checkSequential(migrations3, files) {
|
|
|
45463
45546
|
}
|
|
45464
45547
|
|
|
45465
45548
|
// src/commands/verify/migrations/listMigrationFiles.ts
|
|
45466
|
-
import { readdirSync as
|
|
45549
|
+
import { readdirSync as readdirSync24 } from "fs";
|
|
45467
45550
|
var MIGRATION_FILE2 = /^migration\d+[A-Za-z0-9]*\.ts$/;
|
|
45468
45551
|
function listMigrationFiles(dir) {
|
|
45469
|
-
return
|
|
45552
|
+
return readdirSync24(dir).filter((file) => MIGRATION_FILE2.test(file));
|
|
45470
45553
|
}
|
|
45471
45554
|
|
|
45472
45555
|
// src/commands/verify/migrations/readBaselineMigrations.ts
|
|
45473
|
-
import { execSync as
|
|
45474
|
-
import { basename as
|
|
45556
|
+
import { execSync as execSync59 } from "child_process";
|
|
45557
|
+
import { basename as basename30 } from "path";
|
|
45475
45558
|
var MIGRATION_FILE3 = /^migration\d+[A-Za-z0-9]*\.ts$/;
|
|
45476
45559
|
function readBaselineMigrations(repoRelativeDir, ref) {
|
|
45477
45560
|
const baseline = /* @__PURE__ */ new Map();
|
|
45478
45561
|
let listing;
|
|
45479
45562
|
try {
|
|
45480
|
-
listing =
|
|
45563
|
+
listing = execSync59(
|
|
45481
45564
|
`git ls-tree -r --name-only "${ref}" -- "${repoRelativeDir}"`,
|
|
45482
45565
|
{ encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] }
|
|
45483
45566
|
);
|
|
45484
45567
|
} catch {
|
|
45485
45568
|
return baseline;
|
|
45486
45569
|
}
|
|
45487
|
-
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path109) => MIGRATION_FILE3.test(
|
|
45570
|
+
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path109) => MIGRATION_FILE3.test(basename30(path109)));
|
|
45488
45571
|
for (const path109 of paths) {
|
|
45489
45572
|
try {
|
|
45490
|
-
const content =
|
|
45573
|
+
const content = execSync59(`git show "${ref}:${path109}"`, {
|
|
45491
45574
|
encoding: "utf8",
|
|
45492
45575
|
maxBuffer: 16 * 1024 * 1024,
|
|
45493
45576
|
stdio: ["pipe", "pipe", "pipe"]
|
|
45494
45577
|
});
|
|
45495
|
-
baseline.set(
|
|
45578
|
+
baseline.set(basename30(path109), content);
|
|
45496
45579
|
} catch {
|
|
45497
45580
|
}
|
|
45498
45581
|
}
|
|
@@ -45500,10 +45583,10 @@ function readBaselineMigrations(repoRelativeDir, ref) {
|
|
|
45500
45583
|
}
|
|
45501
45584
|
|
|
45502
45585
|
// src/commands/verify/migrations/resolveBaselineRef.ts
|
|
45503
|
-
import { execSync as
|
|
45586
|
+
import { execSync as execSync60 } from "child_process";
|
|
45504
45587
|
function refExists2(ref) {
|
|
45505
45588
|
try {
|
|
45506
|
-
|
|
45589
|
+
execSync60(`git rev-parse --verify --quiet "${ref}"`, {
|
|
45507
45590
|
stdio: ["pipe", "pipe", "pipe"]
|
|
45508
45591
|
});
|
|
45509
45592
|
return true;
|
|
@@ -45556,7 +45639,7 @@ function migrations2() {
|
|
|
45556
45639
|
if (ref) {
|
|
45557
45640
|
const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
|
|
45558
45641
|
const current = new Map(
|
|
45559
|
-
files.map((file) => [file,
|
|
45642
|
+
files.map((file) => [file, readFileSync68(path104.join(dir, file), "utf8")])
|
|
45560
45643
|
);
|
|
45561
45644
|
for (const finding of checkAppendOnly(baseline, current)) {
|
|
45562
45645
|
problems.push(
|
|
@@ -45579,10 +45662,10 @@ Total: ${problems.length} violation(s).`);
|
|
|
45579
45662
|
}
|
|
45580
45663
|
|
|
45581
45664
|
// src/commands/verify/noVenv.ts
|
|
45582
|
-
import { execSync as
|
|
45665
|
+
import { execSync as execSync61 } from "child_process";
|
|
45583
45666
|
function noVenv() {
|
|
45584
45667
|
try {
|
|
45585
|
-
const output =
|
|
45668
|
+
const output = execSync61(
|
|
45586
45669
|
"find . -type d -name venv -not -path '*/node_modules/*'",
|
|
45587
45670
|
{
|
|
45588
45671
|
encoding: "utf8"
|
|
@@ -46019,7 +46102,7 @@ function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
|
46019
46102
|
}
|
|
46020
46103
|
|
|
46021
46104
|
// src/commands/run/runPreCommands.ts
|
|
46022
|
-
import { execSync as
|
|
46105
|
+
import { execSync as execSync62 } from "child_process";
|
|
46023
46106
|
function writeCapturedOutput(error) {
|
|
46024
46107
|
for (const stream of ["stdout", "stderr"]) {
|
|
46025
46108
|
const output = error[stream];
|
|
@@ -46029,7 +46112,7 @@ function writeCapturedOutput(error) {
|
|
|
46029
46112
|
function runPreCommands(pre, cwd, quiet) {
|
|
46030
46113
|
for (const cmd of pre) {
|
|
46031
46114
|
try {
|
|
46032
|
-
|
|
46115
|
+
execSync62(cmd, { stdio: quiet ? "pipe" : "inherit", cwd });
|
|
46033
46116
|
} catch (error) {
|
|
46034
46117
|
if (quiet && error && typeof error === "object")
|
|
46035
46118
|
writeCapturedOutput(error);
|
|
@@ -46169,11 +46252,11 @@ function consumeSimulatedDivergence(cwd) {
|
|
|
46169
46252
|
}
|
|
46170
46253
|
|
|
46171
46254
|
// src/commands/watch/fetchQuietly.ts
|
|
46172
|
-
import { execFileSync as
|
|
46255
|
+
import { execFileSync as execFileSync29 } from "child_process";
|
|
46173
46256
|
var MIN_FETCH_TIMEOUT_MS = 6e4;
|
|
46174
46257
|
function fetchQuietly(cwd, intervalMs) {
|
|
46175
46258
|
try {
|
|
46176
|
-
|
|
46259
|
+
execFileSync29("git", ["fetch", "--quiet"], {
|
|
46177
46260
|
stdio: ["pipe", "pipe", "pipe"],
|
|
46178
46261
|
cwd,
|
|
46179
46262
|
timeout: Math.max(intervalMs, MIN_FETCH_TIMEOUT_MS)
|
|
@@ -46427,18 +46510,18 @@ function registerWatch(program) {
|
|
|
46427
46510
|
}
|
|
46428
46511
|
|
|
46429
46512
|
// src/commands/roam/postRoamActivity.ts
|
|
46430
|
-
import { execFileSync as
|
|
46431
|
-
import { readdirSync as
|
|
46432
|
-
import { join as
|
|
46513
|
+
import { execFileSync as execFileSync30 } from "child_process";
|
|
46514
|
+
import { readdirSync as readdirSync25, readFileSync as readFileSync69, statSync as statSync13 } from "fs";
|
|
46515
|
+
import { join as join106 } from "path";
|
|
46433
46516
|
function findPortFile(roamDir) {
|
|
46434
46517
|
let entries;
|
|
46435
46518
|
try {
|
|
46436
|
-
entries =
|
|
46519
|
+
entries = readdirSync25(roamDir);
|
|
46437
46520
|
} catch {
|
|
46438
46521
|
return void 0;
|
|
46439
46522
|
}
|
|
46440
46523
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
46441
|
-
const path109 =
|
|
46524
|
+
const path109 = join106(roamDir, name);
|
|
46442
46525
|
try {
|
|
46443
46526
|
return { path: path109, mtimeMs: statSync13(path109).mtimeMs };
|
|
46444
46527
|
} catch {
|
|
@@ -46455,18 +46538,18 @@ var PID_BY_APP = {
|
|
|
46455
46538
|
function postRoamActivity(app, event) {
|
|
46456
46539
|
const appData = process.env.APPDATA;
|
|
46457
46540
|
if (!appData) return;
|
|
46458
|
-
const portFile = findPortFile(
|
|
46541
|
+
const portFile = findPortFile(join106(appData, "Roam"));
|
|
46459
46542
|
if (!portFile) return;
|
|
46460
46543
|
let port;
|
|
46461
46544
|
try {
|
|
46462
|
-
port =
|
|
46545
|
+
port = readFileSync69(portFile, "utf8").trim();
|
|
46463
46546
|
} catch {
|
|
46464
46547
|
return;
|
|
46465
46548
|
}
|
|
46466
46549
|
const pid = PID_BY_APP[app] ?? 99999;
|
|
46467
46550
|
const url = `http://127.0.0.1:${port}/api/v1/activity/${app}/${event}?pid=${pid}`;
|
|
46468
46551
|
try {
|
|
46469
|
-
|
|
46552
|
+
execFileSync30("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
|
|
46470
46553
|
stdio: "ignore"
|
|
46471
46554
|
});
|
|
46472
46555
|
} catch {
|
|
@@ -46798,11 +46881,11 @@ function requireParsedArgs() {
|
|
|
46798
46881
|
}
|
|
46799
46882
|
|
|
46800
46883
|
// src/commands/run/runCommandFilePath.ts
|
|
46801
|
-
import { join as
|
|
46884
|
+
import { join as join107 } from "path";
|
|
46802
46885
|
function runCommandFilePath(name) {
|
|
46803
46886
|
const segments = name.split(":");
|
|
46804
46887
|
const file = `${segments.pop()}.md`;
|
|
46805
|
-
return
|
|
46888
|
+
return join107(".claude", "commands", ...segments, file);
|
|
46806
46889
|
}
|
|
46807
46890
|
|
|
46808
46891
|
// src/commands/run/add.ts
|
|
@@ -46930,8 +47013,8 @@ function registerRunAdd(runCommand) {
|
|
|
46930
47013
|
}
|
|
46931
47014
|
|
|
46932
47015
|
// src/commands/run/remove.ts
|
|
46933
|
-
import { existsSync as existsSync85, readdirSync as
|
|
46934
|
-
import { dirname as dirname46, join as
|
|
47016
|
+
import { existsSync as existsSync85, readdirSync as readdirSync26, rmdirSync, unlinkSync as unlinkSync21 } from "fs";
|
|
47017
|
+
import { dirname as dirname46, join as join108 } from "path";
|
|
46935
47018
|
|
|
46936
47019
|
// src/commands/run/removeRepoRunConfig.ts
|
|
46937
47020
|
function isNamed(entry, name) {
|
|
@@ -46949,15 +47032,15 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
|
|
|
46949
47032
|
|
|
46950
47033
|
// src/commands/run/remove.ts
|
|
46951
47034
|
function removeEmptyNamespaceDirs(filePath) {
|
|
46952
|
-
const root2 =
|
|
47035
|
+
const root2 = join108(".claude", "commands");
|
|
46953
47036
|
for (let dir = dirname46(filePath); dir !== root2; dir = dirname46(dir)) {
|
|
46954
|
-
if (!existsSync85(dir) ||
|
|
47037
|
+
if (!existsSync85(dir) || readdirSync26(dir).length > 0) return;
|
|
46955
47038
|
rmdirSync(dir);
|
|
46956
47039
|
}
|
|
46957
47040
|
}
|
|
46958
47041
|
function deleteCommandFile(name) {
|
|
46959
47042
|
const filePath = runCommandFilePath(name);
|
|
46960
|
-
const legacyPath =
|
|
47043
|
+
const legacyPath = join108(".claude", "commands", `${name}.md`);
|
|
46961
47044
|
for (const path109 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
|
|
46962
47045
|
if (existsSync85(path109)) {
|
|
46963
47046
|
unlinkSync21(path109);
|
|
@@ -47030,11 +47113,11 @@ function formatLink(link3) {
|
|
|
47030
47113
|
}
|
|
47031
47114
|
|
|
47032
47115
|
// src/commands/sessions/daemon/listDaemonPids.ts
|
|
47033
|
-
import { execFileSync as
|
|
47116
|
+
import { execFileSync as execFileSync31 } from "child_process";
|
|
47034
47117
|
function listDaemonPids() {
|
|
47035
47118
|
if (process.platform === "win32") return [];
|
|
47036
47119
|
try {
|
|
47037
|
-
const out =
|
|
47120
|
+
const out = execFileSync31("ps", ["-eo", "pid=,args="], {
|
|
47038
47121
|
encoding: "utf8"
|
|
47039
47122
|
});
|
|
47040
47123
|
return out.split("\n").filter((line) => line.includes("assist") && / daemon run\b/.test(line)).map((line) => Number.parseInt(line.trim(), 10)).filter((pid) => Number.isInteger(pid));
|
|
@@ -47080,11 +47163,11 @@ function applyLine(result, pending, line) {
|
|
|
47080
47163
|
}
|
|
47081
47164
|
|
|
47082
47165
|
// src/commands/sessions/daemon/readDaemonPidFile.ts
|
|
47083
|
-
import { readFileSync as
|
|
47166
|
+
import { readFileSync as readFileSync70 } from "fs";
|
|
47084
47167
|
function readDaemonPidFile() {
|
|
47085
47168
|
try {
|
|
47086
47169
|
const pid = Number.parseInt(
|
|
47087
|
-
|
|
47170
|
+
readFileSync70(daemonPaths.pid, "utf8").trim(),
|
|
47088
47171
|
10
|
|
47089
47172
|
);
|
|
47090
47173
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -47749,7 +47832,7 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
47749
47832
|
|
|
47750
47833
|
// src/commands/sessions/daemon/findServerParents.ts
|
|
47751
47834
|
import { existsSync as existsSync87 } from "fs";
|
|
47752
|
-
import { join as
|
|
47835
|
+
import { join as join109, resolve as resolve30 } from "path";
|
|
47753
47836
|
function isLive(session) {
|
|
47754
47837
|
return !!session.pty && session.status !== "done" && session.status !== "error";
|
|
47755
47838
|
}
|
|
@@ -47758,7 +47841,7 @@ function isLiveAgent(session) {
|
|
|
47758
47841
|
}
|
|
47759
47842
|
function serverRunDirs(sessions, file) {
|
|
47760
47843
|
return new Set(
|
|
47761
|
-
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve30(s.cwd)).filter((dir) => existsSync87(
|
|
47844
|
+
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve30(s.cwd)).filter((dir) => existsSync87(join109(dir, file)))
|
|
47762
47845
|
);
|
|
47763
47846
|
}
|
|
47764
47847
|
function findServerParents(sessions, file) {
|
|
@@ -47976,7 +48059,7 @@ function sendResizeSnapshot(s, send) {
|
|
|
47976
48059
|
}
|
|
47977
48060
|
|
|
47978
48061
|
// src/commands/sessions/daemon/viewerSize.ts
|
|
47979
|
-
import { readFileSync as
|
|
48062
|
+
import { readFileSync as readFileSync71, writeFileSync as writeFileSync57 } from "fs";
|
|
47980
48063
|
var DEFAULT_SIZE = { cols: 120, rows: 30 };
|
|
47981
48064
|
var remembered;
|
|
47982
48065
|
function rememberViewerSize(cols, rows) {
|
|
@@ -47998,7 +48081,7 @@ function viewerSize() {
|
|
|
47998
48081
|
function readSavedSize() {
|
|
47999
48082
|
try {
|
|
48000
48083
|
const { cols, rows } = JSON.parse(
|
|
48001
|
-
|
|
48084
|
+
readFileSync71(daemonPaths.viewerSize, "utf8")
|
|
48002
48085
|
);
|
|
48003
48086
|
if (typeof cols === "number" && typeof rows === "number" && cols > 0)
|
|
48004
48087
|
return { cols, rows };
|
|
@@ -48886,14 +48969,14 @@ async function runAutoUpdateLoop(deps2, maxLaps = Number.POSITIVE_INFINITY) {
|
|
|
48886
48969
|
}
|
|
48887
48970
|
|
|
48888
48971
|
// src/commands/sessions/daemon/autoUpdate/trimWatcherLog.ts
|
|
48889
|
-
import { readFileSync as
|
|
48972
|
+
import { readFileSync as readFileSync73, writeFileSync as writeFileSync59 } from "fs";
|
|
48890
48973
|
var KEEP_TAIL = 256 * 1024;
|
|
48891
48974
|
var MAX_LOG_SIZE = 4 * 1024 * 1024;
|
|
48892
48975
|
function trimWatcherLog(cwd) {
|
|
48893
48976
|
const path109 = watcherLogPath(cwd);
|
|
48894
48977
|
let log2;
|
|
48895
48978
|
try {
|
|
48896
|
-
log2 =
|
|
48979
|
+
log2 = readFileSync73(path109, "utf8");
|
|
48897
48980
|
} catch {
|
|
48898
48981
|
return;
|
|
48899
48982
|
}
|
|
@@ -49279,16 +49362,16 @@ function setStatus2(session, newStatus) {
|
|
|
49279
49362
|
|
|
49280
49363
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
49281
49364
|
import { existsSync as existsSync94 } from "fs";
|
|
49282
|
-
import { basename as
|
|
49365
|
+
import { basename as basename31 } from "path";
|
|
49283
49366
|
|
|
49284
49367
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
49285
49368
|
import { existsSync as existsSync93 } from "fs";
|
|
49286
|
-
import { join as
|
|
49369
|
+
import { join as join113 } from "path";
|
|
49287
49370
|
|
|
49288
49371
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
49289
49372
|
import { statSync as statSync15 } from "fs";
|
|
49290
49373
|
import { rm as rm3 } from "fs/promises";
|
|
49291
|
-
import { join as
|
|
49374
|
+
import { join as join112 } from "path";
|
|
49292
49375
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
49293
49376
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
49294
49377
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -49316,7 +49399,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
49316
49399
|
return { removed: true };
|
|
49317
49400
|
}
|
|
49318
49401
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
49319
|
-
return statSync15(
|
|
49402
|
+
return statSync15(join112(worktreePath, ".git"), {
|
|
49320
49403
|
throwIfNoEntry: false
|
|
49321
49404
|
})?.isDirectory() === true;
|
|
49322
49405
|
}
|
|
@@ -49352,7 +49435,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
49352
49435
|
);
|
|
49353
49436
|
}
|
|
49354
49437
|
function strandedReason(worktreePath, cause) {
|
|
49355
|
-
if (!existsSync93(
|
|
49438
|
+
if (!existsSync93(join113(worktreePath, ".git")))
|
|
49356
49439
|
return "its .git link is already gone";
|
|
49357
49440
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
49358
49441
|
return "git no longer recognises it as a working tree";
|
|
@@ -49422,7 +49505,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
49422
49505
|
const clone = owningClone(worktreePath);
|
|
49423
49506
|
const removal = await removeTree(clone, worktreePath, force);
|
|
49424
49507
|
if (!removal.removed) return removal;
|
|
49425
|
-
await deleteWorktreeBranch(clone,
|
|
49508
|
+
await deleteWorktreeBranch(clone, basename31(worktreePath));
|
|
49426
49509
|
forgetWorktree(worktreePath);
|
|
49427
49510
|
daemonLog(`worktree ${worktreePath} reaped${force ? " (forced)" : ""}`);
|
|
49428
49511
|
return removal;
|
|
@@ -49585,12 +49668,12 @@ function closeGateApplies(sessions, session) {
|
|
|
49585
49668
|
}
|
|
49586
49669
|
|
|
49587
49670
|
// src/commands/sessions/daemon/worktree/liveProcessesInTree.ts
|
|
49588
|
-
import { readdirSync as
|
|
49671
|
+
import { readdirSync as readdirSync28, readlinkSync } from "fs";
|
|
49589
49672
|
import { sep as sep4 } from "path";
|
|
49590
49673
|
function liveProcessesInTree(treePath, procRoot = "/proc") {
|
|
49591
49674
|
let entries;
|
|
49592
49675
|
try {
|
|
49593
|
-
entries =
|
|
49676
|
+
entries = readdirSync28(procRoot);
|
|
49594
49677
|
} catch {
|
|
49595
49678
|
return [];
|
|
49596
49679
|
}
|
|
@@ -51743,7 +51826,7 @@ function releaseClient(client, clients, prPreview, verify) {
|
|
|
51743
51826
|
}
|
|
51744
51827
|
|
|
51745
51828
|
// src/commands/sessions/daemon/findPortHolderPid.ts
|
|
51746
|
-
import { execFileSync as
|
|
51829
|
+
import { execFileSync as execFileSync32 } from "child_process";
|
|
51747
51830
|
var PROBE_TIMEOUT_MS = 3e3;
|
|
51748
51831
|
function findPortHolderPid(port) {
|
|
51749
51832
|
try {
|
|
@@ -51753,7 +51836,7 @@ function findPortHolderPid(port) {
|
|
|
51753
51836
|
}
|
|
51754
51837
|
}
|
|
51755
51838
|
function probe(command, args) {
|
|
51756
|
-
return
|
|
51839
|
+
return execFileSync32(command, args, {
|
|
51757
51840
|
encoding: "utf8",
|
|
51758
51841
|
timeout: PROBE_TIMEOUT_MS,
|
|
51759
51842
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -52528,7 +52611,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
52528
52611
|
|
|
52529
52612
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
52530
52613
|
import { existsSync as existsSync99 } from "fs";
|
|
52531
|
-
import { basename as
|
|
52614
|
+
import { basename as basename33 } from "path";
|
|
52532
52615
|
|
|
52533
52616
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
52534
52617
|
function accountedTrees(sessions) {
|
|
@@ -52636,7 +52719,7 @@ function capped2(lines2) {
|
|
|
52636
52719
|
}
|
|
52637
52720
|
|
|
52638
52721
|
// src/commands/sessions/daemon/worktree/resurfaceOrphanedWorktree.ts
|
|
52639
|
-
import { basename as
|
|
52722
|
+
import { basename as basename32 } from "path";
|
|
52640
52723
|
function resurfaceOrphanedWorktree(sessions, spawnWith, recovered, notify2) {
|
|
52641
52724
|
const { orphan, reason: reason4, held } = recovered;
|
|
52642
52725
|
let id;
|
|
@@ -52659,7 +52742,7 @@ function orphanedSession(id, recovered) {
|
|
|
52659
52742
|
const { orphan, reason: reason4, held } = recovered;
|
|
52660
52743
|
return {
|
|
52661
52744
|
...sessionBase(id, "stopped"),
|
|
52662
|
-
name: `recovered ${
|
|
52745
|
+
name: `recovered ${basename32(orphan.path)}`,
|
|
52663
52746
|
subtitle: `${held.summary} in ${orphan.path}`,
|
|
52664
52747
|
commandType: "claude",
|
|
52665
52748
|
pty: null,
|
|
@@ -52720,7 +52803,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
52720
52803
|
logVanishedTree(sessions, path109);
|
|
52721
52804
|
vanished.set(clone, [
|
|
52722
52805
|
...vanished.get(clone) ?? [],
|
|
52723
|
-
{ path: path109, branch:
|
|
52806
|
+
{ path: path109, branch: basename33(path109) }
|
|
52724
52807
|
]);
|
|
52725
52808
|
continue;
|
|
52726
52809
|
}
|
|
@@ -53902,7 +53985,7 @@ import { existsSync as existsSync101 } from "fs";
|
|
|
53902
53985
|
|
|
53903
53986
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
53904
53987
|
import { copyFileSync as copyFileSync4, existsSync as existsSync100, mkdirSync as mkdirSync42 } from "fs";
|
|
53905
|
-
import { join as
|
|
53988
|
+
import { join as join114 } from "path";
|
|
53906
53989
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
53907
53990
|
const dir = projectDirForCwd(toCwd);
|
|
53908
53991
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -53911,7 +53994,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
53911
53994
|
);
|
|
53912
53995
|
return;
|
|
53913
53996
|
}
|
|
53914
|
-
const dest =
|
|
53997
|
+
const dest = join114(dir, `${claudeSessionId}.jsonl`);
|
|
53915
53998
|
if (existsSync100(dest)) {
|
|
53916
53999
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
53917
54000
|
return;
|
|
@@ -55311,7 +55394,7 @@ function handleConnection(socket, manager) {
|
|
|
55311
55394
|
import { unlinkSync as unlinkSync22, writeFileSync as writeFileSync61 } from "fs";
|
|
55312
55395
|
|
|
55313
55396
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
55314
|
-
import { readFileSync as
|
|
55397
|
+
import { readFileSync as readFileSync74 } from "fs";
|
|
55315
55398
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
55316
55399
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
55317
55400
|
const timer = setInterval(() => {
|
|
@@ -55322,7 +55405,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
55322
55405
|
}
|
|
55323
55406
|
function ownsPidFile() {
|
|
55324
55407
|
try {
|
|
55325
|
-
return
|
|
55408
|
+
return readFileSync74(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
55326
55409
|
} catch {
|
|
55327
55410
|
return false;
|
|
55328
55411
|
}
|