@staff0rd/assist 0.802.0 → 0.804.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/claude/skills/review-ci/scripts/review.mjs +102 -102
- package/dist/commands/sessions/web/bundle.js +392 -392
- package/dist/index.js +490 -309
- 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.804.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -1994,9 +1994,9 @@ var daemonPaths = {
|
|
|
1994
1994
|
|
|
1995
1995
|
// src/commands/sessions/daemon/connectToDaemon.ts
|
|
1996
1996
|
function connectToDaemon() {
|
|
1997
|
-
return new Promise((
|
|
1997
|
+
return new Promise((resolve29, reject) => {
|
|
1998
1998
|
const socket = net.connect(daemonPaths.socket);
|
|
1999
|
-
socket.once("connect", () =>
|
|
1999
|
+
socket.once("connect", () => resolve29(socket));
|
|
2000
2000
|
socket.once("error", reject);
|
|
2001
2001
|
});
|
|
2002
2002
|
}
|
|
@@ -2078,19 +2078,19 @@ function printMeasureTable(records, totalMs) {
|
|
|
2078
2078
|
const nameWidth = Math.max(
|
|
2079
2079
|
"Command".length,
|
|
2080
2080
|
"TOTAL".length,
|
|
2081
|
-
...rows.map((
|
|
2081
|
+
...rows.map((row2) => row2.name.length)
|
|
2082
2082
|
);
|
|
2083
2083
|
const durationWidth = Math.max(
|
|
2084
2084
|
"Duration".length,
|
|
2085
2085
|
formatDuration(totalMs).length,
|
|
2086
|
-
...rows.map((
|
|
2086
|
+
...rows.map((row2) => row2.duration.length)
|
|
2087
2087
|
);
|
|
2088
2088
|
const line = (status2, name, duration) => ` ${status2.padEnd(6)} ${name.padEnd(nameWidth)} ${duration.padStart(durationWidth)}`;
|
|
2089
2089
|
const separator = ` ${" ".repeat(6)} ${"\u2500".repeat(nameWidth)} ${"\u2500".repeat(durationWidth)}`;
|
|
2090
2090
|
console.log();
|
|
2091
2091
|
console.log(line("Status", "Command", "Duration"));
|
|
2092
|
-
for (const
|
|
2093
|
-
console.log(line(
|
|
2092
|
+
for (const row2 of rows) {
|
|
2093
|
+
console.log(line(row2.status, row2.name, row2.duration));
|
|
2094
2094
|
}
|
|
2095
2095
|
console.log(separator);
|
|
2096
2096
|
console.log(line("", "TOTAL", formatDuration(totalMs)));
|
|
@@ -2314,7 +2314,7 @@ ${failed3.length} script(s) failed:`);
|
|
|
2314
2314
|
}
|
|
2315
2315
|
}
|
|
2316
2316
|
function runEntry(entry) {
|
|
2317
|
-
return new Promise((
|
|
2317
|
+
return new Promise((resolve29) => {
|
|
2318
2318
|
const startTime = Date.now();
|
|
2319
2319
|
const child = spawnCommand(
|
|
2320
2320
|
entry.fullCommand,
|
|
@@ -2326,7 +2326,7 @@ function runEntry(entry) {
|
|
|
2326
2326
|
child.on("close", (code) => {
|
|
2327
2327
|
const exitCode = code ?? 1;
|
|
2328
2328
|
flushIfFailed(exitCode, chunks);
|
|
2329
|
-
|
|
2329
|
+
resolve29({
|
|
2330
2330
|
script: entry.name,
|
|
2331
2331
|
code: exitCode,
|
|
2332
2332
|
durationMs: Date.now() - startTime
|
|
@@ -3122,6 +3122,19 @@ function readSocketLines(socket, onLine) {
|
|
|
3122
3122
|
});
|
|
3123
3123
|
}
|
|
3124
3124
|
|
|
3125
|
+
// src/commands/sessions/shared/toAttachments.ts
|
|
3126
|
+
function toAttachments(value) {
|
|
3127
|
+
if (!Array.isArray(value)) return void 0;
|
|
3128
|
+
return value.flatMap((entry) => {
|
|
3129
|
+
const { path: path106, alt, group } = entry ?? {};
|
|
3130
|
+
if (typeof path106 !== "string" || path106 === "") return [];
|
|
3131
|
+
const attachment = { path: path106, alt: typeof alt === "string" ? alt : "" };
|
|
3132
|
+
return [
|
|
3133
|
+
typeof group === "string" && group !== "" ? { ...attachment, group } : attachment
|
|
3134
|
+
];
|
|
3135
|
+
});
|
|
3136
|
+
}
|
|
3137
|
+
|
|
3125
3138
|
// src/commands/sessions/shared/toChecklist.ts
|
|
3126
3139
|
function toChecklist(value) {
|
|
3127
3140
|
if (!Array.isArray(value)) return void 0;
|
|
@@ -3156,14 +3169,6 @@ function toSelection(value) {
|
|
|
3156
3169
|
return void 0;
|
|
3157
3170
|
return { topLeft: selection.topLeft, bottomRight: selection.bottomRight };
|
|
3158
3171
|
}
|
|
3159
|
-
function toAttachments(value) {
|
|
3160
|
-
if (!Array.isArray(value)) return void 0;
|
|
3161
|
-
return value.flatMap((entry) => {
|
|
3162
|
-
const { path: path106, alt } = entry ?? {};
|
|
3163
|
-
if (typeof path106 !== "string" || path106 === "") return [];
|
|
3164
|
-
return [{ path: path106, alt: typeof alt === "string" ? alt : "" }];
|
|
3165
|
-
});
|
|
3166
|
-
}
|
|
3167
3172
|
function toPreviewDecision(msg) {
|
|
3168
3173
|
if (msg.decision !== "approve" && msg.decision !== "reject") return null;
|
|
3169
3174
|
return {
|
|
@@ -3197,7 +3202,7 @@ function parsePreviewDecision(line, requestId) {
|
|
|
3197
3202
|
|
|
3198
3203
|
// src/commands/sessions/shared/requestPreviewDecision.ts
|
|
3199
3204
|
function requestPreviewDecision(request) {
|
|
3200
|
-
return new Promise((
|
|
3205
|
+
return new Promise((resolve29, reject) => {
|
|
3201
3206
|
connectToDaemon().then((socket) => {
|
|
3202
3207
|
let settled = false;
|
|
3203
3208
|
const finish2 = (error, decision) => {
|
|
@@ -3205,7 +3210,7 @@ function requestPreviewDecision(request) {
|
|
|
3205
3210
|
settled = true;
|
|
3206
3211
|
socket.destroy();
|
|
3207
3212
|
if (error) reject(error);
|
|
3208
|
-
else
|
|
3213
|
+
else resolve29(decision);
|
|
3209
3214
|
};
|
|
3210
3215
|
readSocketLines(socket, (line) => {
|
|
3211
3216
|
const incoming = parsePreviewDecision(line, request.requestId);
|
|
@@ -4029,7 +4034,7 @@ async function readAppliedIds(exec3) {
|
|
|
4029
4034
|
const rows = await exec3.query(
|
|
4030
4035
|
`SELECT id FROM ${APPLIED_MIGRATIONS_TABLE} ORDER BY id`
|
|
4031
4036
|
);
|
|
4032
|
-
return new Set(rows.map((
|
|
4037
|
+
return new Set(rows.map((row2) => Number(row2.id)));
|
|
4033
4038
|
}
|
|
4034
4039
|
async function applyMigrations(exec3) {
|
|
4035
4040
|
await exec3.exec(CREATE_APPLIED_MIGRATIONS);
|
|
@@ -4070,7 +4075,7 @@ async function readAppliedIds2(exec3) {
|
|
|
4070
4075
|
const rows = await exec3.query(
|
|
4071
4076
|
`SELECT id FROM ${APPLIED_MIGRATIONS_TABLE} ORDER BY id`
|
|
4072
4077
|
);
|
|
4073
|
-
return rows.map((
|
|
4078
|
+
return rows.map((row2) => Number(row2.id));
|
|
4074
4079
|
}
|
|
4075
4080
|
async function getMigrationStatus(exec3) {
|
|
4076
4081
|
return compareMigrations(await readAppliedIds2(exec3));
|
|
@@ -4974,9 +4979,9 @@ function itemColumns(item, origin) {
|
|
|
4974
4979
|
|
|
4975
4980
|
// src/commands/backlog/insertItem.ts
|
|
4976
4981
|
async function insertItem(db, item, origin) {
|
|
4977
|
-
const [
|
|
4978
|
-
if (!
|
|
4979
|
-
return
|
|
4982
|
+
const [row2] = await db.insert(items).values(itemColumns(item, origin)).returning({ id: items.id });
|
|
4983
|
+
if (!row2) throw new Error("Failed to insert backlog item");
|
|
4984
|
+
return row2.id;
|
|
4980
4985
|
}
|
|
4981
4986
|
|
|
4982
4987
|
// src/commands/backlog/insertPlan.ts
|
|
@@ -5081,10 +5086,10 @@ import { asc as asc3, eq as eq3 } from "drizzle-orm";
|
|
|
5081
5086
|
// src/commands/backlog/groupByItem.ts
|
|
5082
5087
|
function groupByItem(rows) {
|
|
5083
5088
|
const map = /* @__PURE__ */ new Map();
|
|
5084
|
-
for (const
|
|
5085
|
-
const bucket = map.get(
|
|
5086
|
-
if (bucket) bucket.push(
|
|
5087
|
-
else map.set(
|
|
5089
|
+
for (const row2 of rows) {
|
|
5090
|
+
const bucket = map.get(row2.itemId);
|
|
5091
|
+
if (bucket) bucket.push(row2);
|
|
5092
|
+
else map.set(row2.itemId, [row2]);
|
|
5088
5093
|
}
|
|
5089
5094
|
return map;
|
|
5090
5095
|
}
|
|
@@ -5265,23 +5270,23 @@ function rowToComment(c) {
|
|
|
5265
5270
|
function rowToLink(l) {
|
|
5266
5271
|
return { type: l.type, targetId: l.targetId };
|
|
5267
5272
|
}
|
|
5268
|
-
function assignOptionalColumns(item,
|
|
5269
|
-
if (
|
|
5270
|
-
if (
|
|
5271
|
-
if (
|
|
5272
|
-
if (
|
|
5273
|
+
function assignOptionalColumns(item, row2) {
|
|
5274
|
+
if (row2.description != null) item.description = row2.description;
|
|
5275
|
+
if (row2.currentPhase != null) item.currentPhase = row2.currentPhase;
|
|
5276
|
+
if (row2.jiraKey != null) item.jiraKey = row2.jiraKey;
|
|
5277
|
+
if (row2.githubIssue != null) item.githubIssue = row2.githubIssue;
|
|
5273
5278
|
}
|
|
5274
|
-
function baseItem(
|
|
5279
|
+
function baseItem(row2) {
|
|
5275
5280
|
const item = {
|
|
5276
|
-
id:
|
|
5277
|
-
type:
|
|
5278
|
-
name:
|
|
5279
|
-
acceptanceCriteria: JSON.parse(
|
|
5280
|
-
status:
|
|
5281
|
-
starred:
|
|
5282
|
-
origin:
|
|
5283
|
-
};
|
|
5284
|
-
assignOptionalColumns(item,
|
|
5281
|
+
id: row2.id,
|
|
5282
|
+
type: row2.type,
|
|
5283
|
+
name: row2.name,
|
|
5284
|
+
acceptanceCriteria: JSON.parse(row2.acceptanceCriteria),
|
|
5285
|
+
status: row2.status,
|
|
5286
|
+
starred: row2.starred,
|
|
5287
|
+
origin: row2.origin
|
|
5288
|
+
};
|
|
5289
|
+
assignOptionalColumns(item, row2);
|
|
5285
5290
|
return item;
|
|
5286
5291
|
}
|
|
5287
5292
|
function attachComments(item, rel, id) {
|
|
@@ -5296,15 +5301,15 @@ function attachPlan(item, rel, id) {
|
|
|
5296
5301
|
const phases = rel.phases.get(id) ?? [];
|
|
5297
5302
|
if (phases.length > 0) item.plan = buildPlan(phases, rel.tasks.get(id) ?? []);
|
|
5298
5303
|
}
|
|
5299
|
-
function rowToItem(
|
|
5300
|
-
const item = baseItem(
|
|
5301
|
-
attachComments(item, rel,
|
|
5302
|
-
attachSubtasks(item, rel,
|
|
5303
|
-
attachLinks(item, rel,
|
|
5304
|
-
attachPlan(item, rel,
|
|
5305
|
-
attachUsage(item, rel,
|
|
5306
|
-
attachSessions(item, rel,
|
|
5307
|
-
attachGitRefs(item, rel,
|
|
5304
|
+
function rowToItem(row2, rel) {
|
|
5305
|
+
const item = baseItem(row2);
|
|
5306
|
+
attachComments(item, rel, row2.id);
|
|
5307
|
+
attachSubtasks(item, rel, row2.id);
|
|
5308
|
+
attachLinks(item, rel, row2.id);
|
|
5309
|
+
attachPlan(item, rel, row2.id);
|
|
5310
|
+
attachUsage(item, rel, row2.id);
|
|
5311
|
+
attachSessions(item, rel, row2.id);
|
|
5312
|
+
attachGitRefs(item, rel, row2.id);
|
|
5308
5313
|
return item;
|
|
5309
5314
|
}
|
|
5310
5315
|
|
|
@@ -5317,7 +5322,7 @@ async function loadAllItems(orm, origin) {
|
|
|
5317
5322
|
rows.map((r) => r.id),
|
|
5318
5323
|
{ includeComments: false, includeTasks: false, includeSubtasks: false }
|
|
5319
5324
|
);
|
|
5320
|
-
return rows.map((
|
|
5325
|
+
return rows.map((row2) => rowToItem(row2, rel));
|
|
5321
5326
|
}
|
|
5322
5327
|
|
|
5323
5328
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
@@ -5472,8 +5477,8 @@ async function ensureMigrated(orm, dir, origin) {
|
|
|
5472
5477
|
// src/commands/backlog/deleteItem.ts
|
|
5473
5478
|
import { eq as eq4 } from "drizzle-orm";
|
|
5474
5479
|
async function deleteItem(orm, id) {
|
|
5475
|
-
const [
|
|
5476
|
-
return
|
|
5480
|
+
const [row2] = await orm.delete(items).where(eq4(items.id, id)).returning({ name: items.name });
|
|
5481
|
+
return row2?.name;
|
|
5477
5482
|
}
|
|
5478
5483
|
|
|
5479
5484
|
// src/commands/backlog/findBacklogUp.ts
|
|
@@ -5498,13 +5503,13 @@ function findBacklogUp(startDir) {
|
|
|
5498
5503
|
// src/commands/backlog/loadItem.ts
|
|
5499
5504
|
import { eq as eq5 } from "drizzle-orm";
|
|
5500
5505
|
async function loadItem(orm, id) {
|
|
5501
|
-
const [
|
|
5502
|
-
if (!
|
|
5506
|
+
const [row2] = await orm.select().from(items).where(eq5(items.id, id));
|
|
5507
|
+
if (!row2) return void 0;
|
|
5503
5508
|
const rel = await loadRelations(orm, [id], {
|
|
5504
5509
|
includeUsage: true,
|
|
5505
5510
|
includeGitRefs: true
|
|
5506
5511
|
});
|
|
5507
|
-
return rowToItem(
|
|
5512
|
+
return rowToItem(row2, rel);
|
|
5508
5513
|
}
|
|
5509
5514
|
|
|
5510
5515
|
// src/commands/backlog/saveAllItems.ts
|
|
@@ -5564,8 +5569,8 @@ async function updateCurrentPhase(orm, id, phase) {
|
|
|
5564
5569
|
// src/commands/backlog/updateStatus.ts
|
|
5565
5570
|
import { eq as eq10 } from "drizzle-orm";
|
|
5566
5571
|
async function updateStatus(orm, id, status2) {
|
|
5567
|
-
const [
|
|
5568
|
-
return
|
|
5572
|
+
const [row2] = await orm.update(items).set({ status: status2 }).where(eq10(items.id, id)).returning({ name: items.name });
|
|
5573
|
+
return row2?.name;
|
|
5569
5574
|
}
|
|
5570
5575
|
|
|
5571
5576
|
// src/commands/backlog/shared.ts
|
|
@@ -6096,9 +6101,9 @@ import chalk43 from "chalk";
|
|
|
6096
6101
|
// src/commands/backlog/deleteComment.ts
|
|
6097
6102
|
import { and as and4, eq as eq14 } from "drizzle-orm";
|
|
6098
6103
|
async function deleteComment(orm, itemId2, commentId) {
|
|
6099
|
-
const [
|
|
6100
|
-
if (!
|
|
6101
|
-
if (
|
|
6104
|
+
const [row2] = await orm.select({ type: comments.type }).from(comments).where(and4(eq14(comments.id, commentId), eq14(comments.itemId, itemId2)));
|
|
6105
|
+
if (!row2) return "not-found";
|
|
6106
|
+
if (row2.type === "summary") return "is-summary";
|
|
6102
6107
|
await orm.delete(comments).where(and4(eq14(comments.id, commentId), eq14(comments.itemId, itemId2)));
|
|
6103
6108
|
return "deleted";
|
|
6104
6109
|
}
|
|
@@ -6279,10 +6284,10 @@ var IDENTITY_SQL = `
|
|
|
6279
6284
|
`;
|
|
6280
6285
|
async function introspectIdentityColumns(client) {
|
|
6281
6286
|
const { rows } = await client.query(IDENTITY_SQL);
|
|
6282
|
-
return rows.map((
|
|
6283
|
-
table:
|
|
6284
|
-
column:
|
|
6285
|
-
rawColumn:
|
|
6287
|
+
return rows.map((row2) => ({
|
|
6288
|
+
table: row2.table,
|
|
6289
|
+
column: row2.column,
|
|
6290
|
+
rawColumn: row2.raw_column
|
|
6286
6291
|
}));
|
|
6287
6292
|
}
|
|
6288
6293
|
function resyncIdentitySql(col) {
|
|
@@ -6558,8 +6563,8 @@ import chalk49 from "chalk";
|
|
|
6558
6563
|
import chalk48 from "chalk";
|
|
6559
6564
|
import { count, eq as eq17 } from "drizzle-orm";
|
|
6560
6565
|
async function resolveInsertPosition(orm, itemId2, position) {
|
|
6561
|
-
const [
|
|
6562
|
-
const phaseCount =
|
|
6566
|
+
const [row2] = await orm.select({ cnt: count() }).from(planPhases).where(eq17(planPhases.itemId, itemId2));
|
|
6567
|
+
const phaseCount = row2?.cnt ?? 0;
|
|
6563
6568
|
if (position === void 0) return phaseCount;
|
|
6564
6569
|
const pos = Number.parseInt(position, 10);
|
|
6565
6570
|
if (pos < 1 || pos > phaseCount + 1) {
|
|
@@ -7341,10 +7346,10 @@ function gitInvocation(cwd, args) {
|
|
|
7341
7346
|
}
|
|
7342
7347
|
function git(cwd, args) {
|
|
7343
7348
|
const { file, argv, options: options2 } = gitInvocation(cwd, args);
|
|
7344
|
-
return new Promise((
|
|
7349
|
+
return new Promise((resolve29, reject) => {
|
|
7345
7350
|
execFile(file, argv, options2, (error, stdout) => {
|
|
7346
7351
|
if (error) reject(error);
|
|
7347
|
-
else
|
|
7352
|
+
else resolve29(stdout.toString());
|
|
7348
7353
|
});
|
|
7349
7354
|
});
|
|
7350
7355
|
}
|
|
@@ -7625,8 +7630,8 @@ function spawnInherit(command, args, options2 = {}) {
|
|
|
7625
7630
|
env: { ...env, ...options2.env },
|
|
7626
7631
|
cwd: options2.cwd
|
|
7627
7632
|
});
|
|
7628
|
-
const done2 = new Promise((
|
|
7629
|
-
child.on("close", (code) =>
|
|
7633
|
+
const done2 = new Promise((resolve29, reject) => {
|
|
7634
|
+
child.on("close", (code) => resolve29(code ?? 0));
|
|
7630
7635
|
child.on("error", reject);
|
|
7631
7636
|
});
|
|
7632
7637
|
return { child, done: done2 };
|
|
@@ -8058,7 +8063,7 @@ Failed to launch Claude for ${context}: ${message3}`)
|
|
|
8058
8063
|
// src/commands/sessions/daemon/sendToDaemon.ts
|
|
8059
8064
|
var WRITE_TIMEOUT_MS = 500;
|
|
8060
8065
|
function sendToDaemon(message3) {
|
|
8061
|
-
return new Promise((
|
|
8066
|
+
return new Promise((resolve29, reject) => {
|
|
8062
8067
|
connectToDaemon().then((socket) => {
|
|
8063
8068
|
const timer = setTimeout(() => {
|
|
8064
8069
|
socket.destroy();
|
|
@@ -8072,7 +8077,7 @@ function sendToDaemon(message3) {
|
|
|
8072
8077
|
`, () => {
|
|
8073
8078
|
clearTimeout(timer);
|
|
8074
8079
|
socket.end();
|
|
8075
|
-
|
|
8080
|
+
resolve29();
|
|
8076
8081
|
});
|
|
8077
8082
|
}, reject);
|
|
8078
8083
|
});
|
|
@@ -8081,7 +8086,7 @@ function sendToDaemon(message3) {
|
|
|
8081
8086
|
// src/commands/sessions/daemon/sendToDaemonAwaitAck.ts
|
|
8082
8087
|
var ACK_TIMEOUT_MS = 1e3;
|
|
8083
8088
|
function sendToDaemonAwaitAck(message3) {
|
|
8084
|
-
return new Promise((
|
|
8089
|
+
return new Promise((resolve29, reject) => {
|
|
8085
8090
|
connectToDaemon().then((socket) => {
|
|
8086
8091
|
let settled = false;
|
|
8087
8092
|
const finish2 = (error) => {
|
|
@@ -8090,7 +8095,7 @@ function sendToDaemonAwaitAck(message3) {
|
|
|
8090
8095
|
clearTimeout(timer);
|
|
8091
8096
|
socket.destroy();
|
|
8092
8097
|
if (error) reject(error);
|
|
8093
|
-
else
|
|
8098
|
+
else resolve29();
|
|
8094
8099
|
};
|
|
8095
8100
|
const timer = setTimeout(
|
|
8096
8101
|
() => finish2(new Error("timed out awaiting daemon ack")),
|
|
@@ -8181,7 +8186,7 @@ async function deliverReliably(sessionId, status2, payload) {
|
|
|
8181
8186
|
}
|
|
8182
8187
|
}
|
|
8183
8188
|
function sleep(ms) {
|
|
8184
|
-
return new Promise((
|
|
8189
|
+
return new Promise((resolve29) => setTimeout(resolve29, ms));
|
|
8185
8190
|
}
|
|
8186
8191
|
function describeError(error) {
|
|
8187
8192
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -9487,24 +9492,24 @@ function phaseUsageTotals(orm) {
|
|
|
9487
9492
|
}
|
|
9488
9493
|
|
|
9489
9494
|
// src/commands/backlog/rowToItemSummary.ts
|
|
9490
|
-
function rowToItemSummary(
|
|
9495
|
+
function rowToItemSummary(row2) {
|
|
9491
9496
|
return {
|
|
9492
|
-
id:
|
|
9493
|
-
origin:
|
|
9494
|
-
type:
|
|
9495
|
-
name:
|
|
9496
|
-
status:
|
|
9497
|
-
starred:
|
|
9498
|
-
jiraKey:
|
|
9499
|
-
githubIssue:
|
|
9500
|
-
currentPhase:
|
|
9501
|
-
totalPhases: (
|
|
9502
|
-
incompleteSubtasks:
|
|
9503
|
-
usageTotal:
|
|
9504
|
-
tokensUp: Number(
|
|
9505
|
-
tokensDown: Number(
|
|
9506
|
-
activeMs: Number(
|
|
9507
|
-
peakContextPct: Number(
|
|
9497
|
+
id: row2.id,
|
|
9498
|
+
origin: row2.origin,
|
|
9499
|
+
type: row2.type,
|
|
9500
|
+
name: row2.name,
|
|
9501
|
+
status: row2.status,
|
|
9502
|
+
starred: row2.starred,
|
|
9503
|
+
jiraKey: row2.jiraKey ?? void 0,
|
|
9504
|
+
githubIssue: row2.githubIssue ?? void 0,
|
|
9505
|
+
currentPhase: row2.currentPhase ?? void 0,
|
|
9506
|
+
totalPhases: (row2.planPhaseCount || 1) + 1,
|
|
9507
|
+
incompleteSubtasks: row2.incompleteSubtasks ?? 0,
|
|
9508
|
+
usageTotal: row2.tokensUp == null ? void 0 : {
|
|
9509
|
+
tokensUp: Number(row2.tokensUp),
|
|
9510
|
+
tokensDown: Number(row2.tokensDown),
|
|
9511
|
+
activeMs: Number(row2.activeMs),
|
|
9512
|
+
peakContextPct: Number(row2.peakContextPct ?? 0)
|
|
9508
9513
|
}
|
|
9509
9514
|
};
|
|
9510
9515
|
}
|
|
@@ -9894,8 +9899,8 @@ import chalk84 from "chalk";
|
|
|
9894
9899
|
// src/commands/backlog/updateStarred.ts
|
|
9895
9900
|
import { eq as eq24 } from "drizzle-orm";
|
|
9896
9901
|
async function updateStarred(orm, id, starred) {
|
|
9897
|
-
const [
|
|
9898
|
-
return
|
|
9902
|
+
const [row2] = await orm.update(items).set({ starred }).where(eq24(items.id, id)).returning({ name: items.name });
|
|
9903
|
+
return row2?.name;
|
|
9899
9904
|
}
|
|
9900
9905
|
|
|
9901
9906
|
// src/commands/backlog/setStarred.ts
|
|
@@ -10057,8 +10062,8 @@ async function updateSubtask(orm, itemId2, idx, fields) {
|
|
|
10057
10062
|
if (fields.title !== void 0) set.title = fields.title;
|
|
10058
10063
|
if (fields.description !== void 0) set.description = fields.description;
|
|
10059
10064
|
if (fields.status !== void 0) set.status = fields.status;
|
|
10060
|
-
const [
|
|
10061
|
-
return
|
|
10065
|
+
const [row2] = await orm.update(itemSubtasks).set(set).where(and9(eq26(itemSubtasks.itemId, itemId2), eq26(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
|
|
10066
|
+
return row2?.title;
|
|
10062
10067
|
}
|
|
10063
10068
|
|
|
10064
10069
|
// src/commands/backlog/validSubtaskStatuses.ts
|
|
@@ -10114,8 +10119,8 @@ import chalk93 from "chalk";
|
|
|
10114
10119
|
// src/commands/backlog/deleteSubtask.ts
|
|
10115
10120
|
import { and as and10, asc as asc6, eq as eq27 } from "drizzle-orm";
|
|
10116
10121
|
async function deleteSubtask(orm, itemId2, idx) {
|
|
10117
|
-
const [
|
|
10118
|
-
if (!
|
|
10122
|
+
const [row2] = await orm.delete(itemSubtasks).where(and10(eq27(itemSubtasks.itemId, itemId2), eq27(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
|
|
10123
|
+
if (!row2) return void 0;
|
|
10119
10124
|
const remaining = await orm.select({ idx: itemSubtasks.idx }).from(itemSubtasks).where(eq27(itemSubtasks.itemId, itemId2)).orderBy(asc6(itemSubtasks.idx));
|
|
10120
10125
|
for (let i = 0; i < remaining.length; i++) {
|
|
10121
10126
|
const oldIdx = remaining[i].idx;
|
|
@@ -10124,7 +10129,7 @@ async function deleteSubtask(orm, itemId2, idx) {
|
|
|
10124
10129
|
and10(eq27(itemSubtasks.itemId, itemId2), eq27(itemSubtasks.idx, oldIdx))
|
|
10125
10130
|
);
|
|
10126
10131
|
}
|
|
10127
|
-
return
|
|
10132
|
+
return row2.title;
|
|
10128
10133
|
}
|
|
10129
10134
|
|
|
10130
10135
|
// src/commands/backlog/removeSubtask.ts
|
|
@@ -10146,8 +10151,8 @@ import chalk94 from "chalk";
|
|
|
10146
10151
|
// src/commands/backlog/updateSubtaskStatus.ts
|
|
10147
10152
|
import { and as and11, eq as eq28 } from "drizzle-orm";
|
|
10148
10153
|
async function updateSubtaskStatus(orm, itemId2, idx, status2) {
|
|
10149
|
-
const [
|
|
10150
|
-
return
|
|
10154
|
+
const [row2] = await orm.update(itemSubtasks).set({ status: status2 }).where(and11(eq28(itemSubtasks.itemId, itemId2), eq28(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
|
|
10155
|
+
return row2?.title;
|
|
10151
10156
|
}
|
|
10152
10157
|
|
|
10153
10158
|
// src/commands/backlog/subtaskStatus.ts
|
|
@@ -10224,8 +10229,8 @@ async function adjustCurrentPhase(db, item, removedIdx) {
|
|
|
10224
10229
|
return;
|
|
10225
10230
|
}
|
|
10226
10231
|
if (removedIdx !== currentIdx) return;
|
|
10227
|
-
const [
|
|
10228
|
-
const cnt =
|
|
10232
|
+
const [row2] = await db.select({ cnt: count3() }).from(planPhases).where(eq29(planPhases.itemId, item.id));
|
|
10233
|
+
const cnt = row2?.cnt ?? 0;
|
|
10229
10234
|
await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(eq29(items.id, item.id));
|
|
10230
10235
|
}
|
|
10231
10236
|
|
|
@@ -10278,8 +10283,8 @@ async function movePhase(id, from, to) {
|
|
|
10278
10283
|
if (!found) return;
|
|
10279
10284
|
const { orm, item } = found;
|
|
10280
10285
|
const itemId2 = item.id;
|
|
10281
|
-
const [
|
|
10282
|
-
const phaseCount =
|
|
10286
|
+
const [row2] = await orm.select({ cnt: count4() }).from(planPhases).where(eq31(planPhases.itemId, itemId2));
|
|
10287
|
+
const phaseCount = row2?.cnt ?? 0;
|
|
10283
10288
|
const fromIdx = toIndex(from, phaseCount);
|
|
10284
10289
|
if (fromIdx === void 0) return;
|
|
10285
10290
|
const toIdx = toIndex(to, phaseCount);
|
|
@@ -10334,8 +10339,8 @@ async function findPhase(id, phase) {
|
|
|
10334
10339
|
const { orm, item } = found;
|
|
10335
10340
|
const itemId2 = item.id;
|
|
10336
10341
|
const phaseIdx = Number.parseInt(phase, 10) - 1;
|
|
10337
|
-
const [
|
|
10338
|
-
if (!
|
|
10342
|
+
const [row2] = await orm.select({ cnt: count5() }).from(planPhases).where(and15(eq33(planPhases.itemId, itemId2), eq33(planPhases.idx, phaseIdx)));
|
|
10343
|
+
if (!row2 || row2.cnt === 0) {
|
|
10339
10344
|
console.log(
|
|
10340
10345
|
chalk96.red(
|
|
10341
10346
|
`Phase ${phaseIdx + 1} not found on item ${formatItemId(itemId2)}.`
|
|
@@ -11186,7 +11191,7 @@ function spawnDaemon(reason4) {
|
|
|
11186
11191
|
child.unref();
|
|
11187
11192
|
}
|
|
11188
11193
|
function delay(ms) {
|
|
11189
|
-
return new Promise((
|
|
11194
|
+
return new Promise((resolve29) => setTimeout(resolve29, ms));
|
|
11190
11195
|
}
|
|
11191
11196
|
|
|
11192
11197
|
// src/commands/sessions/nodes/tailscaleStatus.ts
|
|
@@ -11292,7 +11297,7 @@ var defaultDeps = {
|
|
|
11292
11297
|
serve: async (args) => {
|
|
11293
11298
|
await runTailscale(args);
|
|
11294
11299
|
},
|
|
11295
|
-
sleep: (ms) => new Promise((
|
|
11300
|
+
sleep: (ms) => new Promise((resolve29) => setTimeout(resolve29, ms)),
|
|
11296
11301
|
httpsPort: tailnetHttpsPort
|
|
11297
11302
|
};
|
|
11298
11303
|
async function ensureTailscaleServe(port, deps2 = {}) {
|
|
@@ -11699,12 +11704,12 @@ async function loadVisibleItems(req) {
|
|
|
11699
11704
|
|
|
11700
11705
|
// src/commands/backlog/web/parseStatusBody.ts
|
|
11701
11706
|
function readBody(req) {
|
|
11702
|
-
return new Promise((
|
|
11707
|
+
return new Promise((resolve29, reject) => {
|
|
11703
11708
|
let body = "";
|
|
11704
11709
|
req.on("data", (chunk) => {
|
|
11705
11710
|
body += chunk.toString();
|
|
11706
11711
|
});
|
|
11707
|
-
req.on("end", () =>
|
|
11712
|
+
req.on("end", () => resolve29(body));
|
|
11708
11713
|
req.on("error", reject);
|
|
11709
11714
|
});
|
|
11710
11715
|
}
|
|
@@ -12046,10 +12051,10 @@ async function listCommitRefs(db, itemId2) {
|
|
|
12046
12051
|
title: itemGitRefs.title,
|
|
12047
12052
|
url: itemGitRefs.url
|
|
12048
12053
|
}).from(itemGitRefs).where(and17(eq38(itemGitRefs.itemId, itemId2), eq38(itemGitRefs.kind, "commit"))).orderBy(asc10(itemGitRefs.createdAt), asc10(itemGitRefs.ref));
|
|
12049
|
-
return rows.map((
|
|
12050
|
-
sha:
|
|
12051
|
-
...
|
|
12052
|
-
...
|
|
12054
|
+
return rows.map((row2) => ({
|
|
12055
|
+
sha: row2.ref,
|
|
12056
|
+
...row2.title ? { title: row2.title } : {},
|
|
12057
|
+
...row2.url ? { url: row2.url } : {}
|
|
12053
12058
|
}));
|
|
12054
12059
|
}
|
|
12055
12060
|
|
|
@@ -13875,11 +13880,11 @@ async function requestDaemonReply(request, replyType) {
|
|
|
13875
13880
|
} catch {
|
|
13876
13881
|
return void 0;
|
|
13877
13882
|
}
|
|
13878
|
-
return new Promise((
|
|
13883
|
+
return new Promise((resolve29) => {
|
|
13879
13884
|
const finish2 = (result) => {
|
|
13880
13885
|
clearTimeout(timer);
|
|
13881
13886
|
socket.destroy();
|
|
13882
|
-
|
|
13887
|
+
resolve29(result);
|
|
13883
13888
|
};
|
|
13884
13889
|
const timer = setTimeout(() => finish2(void 0), QUERY_TIMEOUT_MS);
|
|
13885
13890
|
const lines2 = createInterface5({ input: socket });
|
|
@@ -13972,8 +13977,8 @@ function subsequenceScore(text18, query) {
|
|
|
13972
13977
|
function scoreFilePath(path106, query) {
|
|
13973
13978
|
const needle = query.trim().toLowerCase();
|
|
13974
13979
|
if (!needle) return 0;
|
|
13975
|
-
const
|
|
13976
|
-
const inBasename = subsequenceScore(
|
|
13980
|
+
const basename36 = path106.slice(path106.lastIndexOf("/") + 1);
|
|
13981
|
+
const inBasename = subsequenceScore(basename36, needle);
|
|
13977
13982
|
if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
|
|
13978
13983
|
return subsequenceScore(path106, needle);
|
|
13979
13984
|
}
|
|
@@ -15038,8 +15043,8 @@ function listScopedRules(req, res) {
|
|
|
15038
15043
|
// src/shared/db/countUsagePeaks.ts
|
|
15039
15044
|
import { count as count6, eq as eq39 } from "drizzle-orm";
|
|
15040
15045
|
async function countUsagePeaks(db, window) {
|
|
15041
|
-
const [
|
|
15042
|
-
return
|
|
15046
|
+
const [row2] = await db.select({ value: count6() }).from(usagePeaks).where(window ? eq39(usagePeaks.window, window) : void 0);
|
|
15047
|
+
return row2?.value ?? 0;
|
|
15043
15048
|
}
|
|
15044
15049
|
|
|
15045
15050
|
// src/shared/db/listUsagePeaks.ts
|
|
@@ -15131,7 +15136,7 @@ import { asc as asc11, desc as desc4, eq as eq41, sql as sql19 } from "drizzle-o
|
|
|
15131
15136
|
async function countItemUsageByOrigin(db) {
|
|
15132
15137
|
const count8 = sql19`count(distinct ${phaseUsage.itemId})::int`;
|
|
15133
15138
|
const rows = await db.select({ origin: items.origin, count: count8 }).from(items).innerJoin(phaseUsage, eq41(phaseUsage.itemId, items.id)).groupBy(items.origin).orderBy(desc4(count8), asc11(items.origin));
|
|
15134
|
-
return rows.map((
|
|
15139
|
+
return rows.map((row2) => ({ origin: row2.origin, count: Number(row2.count) }));
|
|
15135
15140
|
}
|
|
15136
15141
|
|
|
15137
15142
|
// src/shared/db/itemUsageWhere.ts
|
|
@@ -15178,7 +15183,7 @@ function median(value) {
|
|
|
15178
15183
|
async function itemUsageStats(db, options2) {
|
|
15179
15184
|
const totals = phaseUsageTotals(db);
|
|
15180
15185
|
const planned = planPhaseCounts(db);
|
|
15181
|
-
const [
|
|
15186
|
+
const [row2] = await db.select({
|
|
15182
15187
|
itemCount: sql20`count(*)::int`,
|
|
15183
15188
|
doneCount: sql20`count(*) filter (where ${items.status} = 'done')::int`,
|
|
15184
15189
|
repoCount: sql20`count(distinct ${items.origin})::int`,
|
|
@@ -15189,12 +15194,12 @@ async function itemUsageStats(db, options2) {
|
|
|
15189
15194
|
medianTokens: median(sql20`${totals.tokensUp} + ${totals.tokensDown}`)
|
|
15190
15195
|
}).from(items).innerJoin(totals, eq43(totals.itemId, items.id)).leftJoin(planned, eq43(planned.itemId, items.id)).where(itemUsageWhere(options2));
|
|
15191
15196
|
return {
|
|
15192
|
-
itemCount: Number(
|
|
15193
|
-
doneCount: Number(
|
|
15194
|
-
repoCount: Number(
|
|
15195
|
-
medianPhases: Number(
|
|
15196
|
-
medianActiveMs: Number(
|
|
15197
|
-
medianTokens: Number(
|
|
15197
|
+
itemCount: Number(row2?.itemCount ?? 0),
|
|
15198
|
+
doneCount: Number(row2?.doneCount ?? 0),
|
|
15199
|
+
repoCount: Number(row2?.repoCount ?? 0),
|
|
15200
|
+
medianPhases: Number(row2?.medianPhases ?? 0),
|
|
15201
|
+
medianActiveMs: Number(row2?.medianActiveMs ?? 0),
|
|
15202
|
+
medianTokens: Number(row2?.medianTokens ?? 0)
|
|
15198
15203
|
};
|
|
15199
15204
|
}
|
|
15200
15205
|
|
|
@@ -15229,16 +15234,16 @@ function lastPhaseActivity(db) {
|
|
|
15229
15234
|
}
|
|
15230
15235
|
|
|
15231
15236
|
// src/shared/db/toItemUsageSummary.ts
|
|
15232
|
-
function toItemUsageSummary(
|
|
15237
|
+
function toItemUsageSummary(row2) {
|
|
15233
15238
|
return {
|
|
15234
|
-
...
|
|
15235
|
-
phaseCount:
|
|
15236
|
-
recordedPhases: Number(
|
|
15237
|
-
tokensUp: Number(
|
|
15238
|
-
tokensDown: Number(
|
|
15239
|
-
activeMs: Number(
|
|
15240
|
-
peakContextPct: Number(
|
|
15241
|
-
lastPhaseAt:
|
|
15239
|
+
...row2,
|
|
15240
|
+
phaseCount: row2.phaseCount ?? 0,
|
|
15241
|
+
recordedPhases: Number(row2.recordedPhases),
|
|
15242
|
+
tokensUp: Number(row2.tokensUp),
|
|
15243
|
+
tokensDown: Number(row2.tokensDown),
|
|
15244
|
+
activeMs: Number(row2.activeMs),
|
|
15245
|
+
peakContextPct: Number(row2.peakContextPct),
|
|
15246
|
+
lastPhaseAt: row2.lastPhaseAt ?? null
|
|
15242
15247
|
};
|
|
15243
15248
|
}
|
|
15244
15249
|
|
|
@@ -15429,7 +15434,7 @@ function forwardToPeer(req, res, node, url) {
|
|
|
15429
15434
|
const label2 = `link ${node} http: ${req.method} ${url.pathname} trace=${traceId}`;
|
|
15430
15435
|
const log2 = (outcome) => console.log(`${label2} -> ${outcome} (${Date.now() - started}ms)`);
|
|
15431
15436
|
const send = url.protocol === "https:" ? httpsRequest : httpRequest;
|
|
15432
|
-
return new Promise((
|
|
15437
|
+
return new Promise((resolve29) => {
|
|
15433
15438
|
const upstream = send(
|
|
15434
15439
|
url,
|
|
15435
15440
|
{
|
|
@@ -15441,7 +15446,7 @@ function forwardToPeer(req, res, node, url) {
|
|
|
15441
15446
|
[TRACE_HEADER]: traceId
|
|
15442
15447
|
}
|
|
15443
15448
|
},
|
|
15444
|
-
(peer) => relayPeerResponse(peer, res, url.pathname, log2,
|
|
15449
|
+
(peer) => relayPeerResponse(peer, res, url.pathname, log2, resolve29)
|
|
15445
15450
|
);
|
|
15446
15451
|
boundUpstream(upstream, res, peerTimeoutFor(url.pathname));
|
|
15447
15452
|
upstream.on("error", (error) => {
|
|
@@ -15451,7 +15456,7 @@ function forwardToPeer(req, res, node, url) {
|
|
|
15451
15456
|
respondJson(res, 502, {
|
|
15452
15457
|
error: `${node} unreachable: ${error.message}`
|
|
15453
15458
|
});
|
|
15454
|
-
|
|
15459
|
+
resolve29();
|
|
15455
15460
|
});
|
|
15456
15461
|
req.pipe(upstream);
|
|
15457
15462
|
});
|
|
@@ -16034,17 +16039,17 @@ async function stopDaemon() {
|
|
|
16034
16039
|
}
|
|
16035
16040
|
}
|
|
16036
16041
|
function closedBeforeTimeout(socket) {
|
|
16037
|
-
return new Promise((
|
|
16042
|
+
return new Promise((resolve29) => {
|
|
16038
16043
|
const timer = setTimeout(() => {
|
|
16039
16044
|
socket.destroy();
|
|
16040
|
-
|
|
16045
|
+
resolve29(false);
|
|
16041
16046
|
}, STOP_TIMEOUT_MS);
|
|
16042
16047
|
socket.resume();
|
|
16043
16048
|
socket.on("error", () => {
|
|
16044
16049
|
});
|
|
16045
16050
|
socket.once("close", () => {
|
|
16046
16051
|
clearTimeout(timer);
|
|
16047
|
-
|
|
16052
|
+
resolve29(true);
|
|
16048
16053
|
});
|
|
16049
16054
|
});
|
|
16050
16055
|
}
|
|
@@ -16107,8 +16112,8 @@ async function restartWeb(req, res, deps2 = {}) {
|
|
|
16107
16112
|
return;
|
|
16108
16113
|
}
|
|
16109
16114
|
console.log(`restart ${target} ${linkedRequester(req)}`);
|
|
16110
|
-
await new Promise((
|
|
16111
|
-
res.once("finish",
|
|
16115
|
+
await new Promise((resolve29) => {
|
|
16116
|
+
res.once("finish", resolve29);
|
|
16112
16117
|
respondJson(res, 200, { ok: true });
|
|
16113
16118
|
});
|
|
16114
16119
|
try {
|
|
@@ -16252,8 +16257,8 @@ async function selfUpdate(req, res, deps2 = {}) {
|
|
|
16252
16257
|
return;
|
|
16253
16258
|
}
|
|
16254
16259
|
console.log("self-update: updated; restarting daemon and web server");
|
|
16255
|
-
await new Promise((
|
|
16256
|
-
res.once("finish",
|
|
16260
|
+
await new Promise((resolve29) => {
|
|
16261
|
+
res.once("finish", resolve29);
|
|
16257
16262
|
respondJson(res, 200, { ok: true });
|
|
16258
16263
|
});
|
|
16259
16264
|
await performRestart("both", restartDeps);
|
|
@@ -16354,14 +16359,14 @@ function linkWebSocketUrl(url) {
|
|
|
16354
16359
|
return target.toString();
|
|
16355
16360
|
}
|
|
16356
16361
|
function connectLinkWebSocket(url, handlers) {
|
|
16357
|
-
return new Promise((
|
|
16362
|
+
return new Promise((resolve29, reject) => {
|
|
16358
16363
|
const ws = new WebSocket(linkWebSocketUrl(url), {
|
|
16359
16364
|
handshakeTimeout: HANDSHAKE_TIMEOUT_MS
|
|
16360
16365
|
});
|
|
16361
16366
|
let open = false;
|
|
16362
16367
|
ws.on("open", () => {
|
|
16363
16368
|
open = true;
|
|
16364
|
-
|
|
16369
|
+
resolve29({
|
|
16365
16370
|
send: (line) => {
|
|
16366
16371
|
if (ws.readyState !== WebSocket.OPEN) return false;
|
|
16367
16372
|
ws.send(line);
|
|
@@ -16387,8 +16392,8 @@ var HELLO_TIMEOUT_MS = 5e3;
|
|
|
16387
16392
|
async function probePeerHello(url) {
|
|
16388
16393
|
let settle = () => {
|
|
16389
16394
|
};
|
|
16390
|
-
const reply2 = new Promise((
|
|
16391
|
-
settle =
|
|
16395
|
+
const reply2 = new Promise((resolve29) => {
|
|
16396
|
+
settle = resolve29;
|
|
16392
16397
|
});
|
|
16393
16398
|
const socket = await connectLinkWebSocket(url, {
|
|
16394
16399
|
onLine: (line) => {
|
|
@@ -16994,7 +16999,7 @@ function globalOnlyRepoKeyError(key, verb) {
|
|
|
16994
16999
|
// src/shared/db/listRepoConfigs.ts
|
|
16995
17000
|
async function listRepoConfigs(orm) {
|
|
16996
17001
|
const rows = await orm.select().from(repoConfigs);
|
|
16997
|
-
return Object.fromEntries(rows.map((
|
|
17002
|
+
return Object.fromEntries(rows.map((row2) => [row2.repoKey, row2.config]));
|
|
16998
17003
|
}
|
|
16999
17004
|
|
|
17000
17005
|
// src/shared/resolveNamedRepoWriteLabel.ts
|
|
@@ -17553,6 +17558,14 @@ async function readRequestBuffer(req, limit) {
|
|
|
17553
17558
|
// src/commands/sessions/web/stageAttachment.ts
|
|
17554
17559
|
import { mkdir as mkdir4, mkdtemp, writeFile as writeFile2 } from "fs/promises";
|
|
17555
17560
|
import { extname as extname2, join as join44 } from "path";
|
|
17561
|
+
|
|
17562
|
+
// src/commands/sessions/web/ghAttachableExtensions.ts
|
|
17563
|
+
var ghAttachableExtensions = /* @__PURE__ */ new Set([
|
|
17564
|
+
...Object.values(attachmentMimeTypes),
|
|
17565
|
+
"jpeg"
|
|
17566
|
+
]);
|
|
17567
|
+
|
|
17568
|
+
// src/commands/sessions/web/stageAttachment.ts
|
|
17556
17569
|
function extensionFromMime(contentType) {
|
|
17557
17570
|
const mime = contentType.split(";")[0].trim().toLowerCase();
|
|
17558
17571
|
const known = attachmentMimeTypes[mime];
|
|
@@ -17560,10 +17573,6 @@ function extensionFromMime(contentType) {
|
|
|
17560
17573
|
const subtype = mime.split("/")[1]?.replace(/^x-/, "").replace(/\+.*$/, "");
|
|
17561
17574
|
return subtype && /^[a-z0-9]+$/.test(subtype) ? subtype : void 0;
|
|
17562
17575
|
}
|
|
17563
|
-
var ghAttachableExtensions = /* @__PURE__ */ new Set([
|
|
17564
|
-
...Object.values(attachmentMimeTypes),
|
|
17565
|
-
"jpeg"
|
|
17566
|
-
]);
|
|
17567
17576
|
function pickExtension(name, contentType) {
|
|
17568
17577
|
const fromName = extname2(name).replace(/^\./, "").toLowerCase();
|
|
17569
17578
|
const ext = /^[a-z0-9]+$/.test(fromName) ? fromName : extensionFromMime(contentType) ?? "png";
|
|
@@ -19796,12 +19805,12 @@ function hasSubcommands(helpText) {
|
|
|
19796
19805
|
// src/commands/permitCliReads/runHelp.ts
|
|
19797
19806
|
import { exec as exec2 } from "child_process";
|
|
19798
19807
|
function runHelp(args) {
|
|
19799
|
-
return new Promise((
|
|
19808
|
+
return new Promise((resolve29) => {
|
|
19800
19809
|
exec2(
|
|
19801
19810
|
`${args.join(" ")} --help`,
|
|
19802
19811
|
{ encoding: "utf8", timeout: 3e4 },
|
|
19803
19812
|
(_err, stdout, stderr) => {
|
|
19804
|
-
|
|
19813
|
+
resolve29(stdout || stderr || "");
|
|
19805
19814
|
}
|
|
19806
19815
|
);
|
|
19807
19816
|
});
|
|
@@ -22194,8 +22203,8 @@ async function findRetiredTables(exec3) {
|
|
|
22194
22203
|
[RETIRED_TABLES]
|
|
22195
22204
|
);
|
|
22196
22205
|
const found = [];
|
|
22197
|
-
for (const
|
|
22198
|
-
const name = String(
|
|
22206
|
+
for (const row2 of present) {
|
|
22207
|
+
const name = String(row2.table_name);
|
|
22199
22208
|
const [count8] = await exec3.query(
|
|
22200
22209
|
`SELECT count(*)::int AS rows FROM "${name}"`
|
|
22201
22210
|
);
|
|
@@ -22843,9 +22852,9 @@ function colorStatus(status2) {
|
|
|
22843
22852
|
if (status2 === "outdated") return chalk154.yellow(status2);
|
|
22844
22853
|
return chalk154.green(status2);
|
|
22845
22854
|
}
|
|
22846
|
-
function formatRow(
|
|
22847
|
-
const devlog = (
|
|
22848
|
-
return `${
|
|
22855
|
+
function formatRow(row2, nameWidth) {
|
|
22856
|
+
const devlog = (row2.lastDevlog ?? "-").padEnd(11);
|
|
22857
|
+
return `${row2.name.padEnd(nameWidth)} ${row2.lastPush} ${devlog} ${colorStatus(row2.status)}`;
|
|
22849
22858
|
}
|
|
22850
22859
|
function printReposTable(rows) {
|
|
22851
22860
|
const nameWidth = Math.max(4, ...rows.map((r) => r.name.length));
|
|
@@ -22857,8 +22866,8 @@ function printReposTable(rows) {
|
|
|
22857
22866
|
].join(" ");
|
|
22858
22867
|
console.log(chalk154.dim(header));
|
|
22859
22868
|
console.log(chalk154.dim("-".repeat(header.length)));
|
|
22860
|
-
for (const
|
|
22861
|
-
console.log(formatRow(
|
|
22869
|
+
for (const row2 of rows) {
|
|
22870
|
+
console.log(formatRow(row2, nameWidth));
|
|
22862
22871
|
}
|
|
22863
22872
|
}
|
|
22864
22873
|
|
|
@@ -24440,13 +24449,13 @@ import chalk167 from "chalk";
|
|
|
24440
24449
|
function printCountTable(labelHeader, rows) {
|
|
24441
24450
|
const labelWidth = Math.max(
|
|
24442
24451
|
labelHeader.length,
|
|
24443
|
-
...rows.map((
|
|
24452
|
+
...rows.map((row2) => row2.label.length)
|
|
24444
24453
|
);
|
|
24445
24454
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
24446
24455
|
console.log(chalk167.dim(header));
|
|
24447
24456
|
console.log(chalk167.dim("-".repeat(header.length)));
|
|
24448
|
-
for (const
|
|
24449
|
-
console.log(`${
|
|
24457
|
+
for (const row2 of rows) {
|
|
24458
|
+
console.log(`${row2.label.padEnd(labelWidth)} ${row2.count}`);
|
|
24450
24459
|
}
|
|
24451
24460
|
}
|
|
24452
24461
|
|
|
@@ -25179,18 +25188,75 @@ function collectLabels(value, previous) {
|
|
|
25179
25188
|
return [...previous, ...added];
|
|
25180
25189
|
}
|
|
25181
25190
|
|
|
25182
|
-
// src/commands/prs/
|
|
25191
|
+
// src/commands/prs/renderScreenshotBlock.ts
|
|
25192
|
+
import { extname as extname3 } from "path";
|
|
25193
|
+
var VIDEO_EXTENSIONS = /* @__PURE__ */ new Set([".mp4", ".webm", ".mov"]);
|
|
25183
25194
|
function reference({ path: path106, alt }) {
|
|
25184
25195
|
const target = /\s/.test(path106) ? `<${path106}>` : path106;
|
|
25185
25196
|
return ``;
|
|
25186
25197
|
}
|
|
25198
|
+
function cell(text18) {
|
|
25199
|
+
return text18.replaceAll("|", String.raw`\|`);
|
|
25200
|
+
}
|
|
25201
|
+
function row(cells) {
|
|
25202
|
+
return `| ${cells.join(" | ")} |`;
|
|
25203
|
+
}
|
|
25204
|
+
function imageTable(images) {
|
|
25205
|
+
if (images.length === 0) return [];
|
|
25206
|
+
const lines2 = [];
|
|
25207
|
+
for (let i = 0; i < images.length; i += 2) {
|
|
25208
|
+
const pair = images.slice(i, i + 2);
|
|
25209
|
+
const captions = [0, 1].map((j) => pair[j] ? cell(pair[j].alt) : "");
|
|
25210
|
+
const refs = [0, 1].map((j) => pair[j] ? cell(reference(pair[j])) : "");
|
|
25211
|
+
if (i === 0) lines2.push(row(captions), row(["---", "---"]));
|
|
25212
|
+
else lines2.push(row(captions.map((c) => c ? `**${c}**` : "")));
|
|
25213
|
+
lines2.push(row(refs));
|
|
25214
|
+
}
|
|
25215
|
+
return [lines2.join("\n")];
|
|
25216
|
+
}
|
|
25217
|
+
function renderScreenshotBlock(attachments) {
|
|
25218
|
+
const isVideo = (a) => VIDEO_EXTENSIONS.has(extname3(a.path).toLowerCase());
|
|
25219
|
+
return [
|
|
25220
|
+
...imageTable(attachments.filter((a) => !isVideo(a))),
|
|
25221
|
+
...attachments.filter(isVideo).map(reference)
|
|
25222
|
+
];
|
|
25223
|
+
}
|
|
25224
|
+
|
|
25225
|
+
// src/commands/prs/renderScreenshotsSection.ts
|
|
25226
|
+
function renderScreenshotsSection(attachments) {
|
|
25227
|
+
const groups = /* @__PURE__ */ new Map();
|
|
25228
|
+
const ungrouped = [];
|
|
25229
|
+
for (const attachment of attachments) {
|
|
25230
|
+
if (!attachment.group) {
|
|
25231
|
+
ungrouped.push(attachment);
|
|
25232
|
+
continue;
|
|
25233
|
+
}
|
|
25234
|
+
const members = groups.get(attachment.group) ?? [];
|
|
25235
|
+
members.push(attachment);
|
|
25236
|
+
groups.set(attachment.group, members);
|
|
25237
|
+
}
|
|
25238
|
+
const blocks = [...groups].flatMap(([group, members]) => [
|
|
25239
|
+
`### ${group}`,
|
|
25240
|
+
...renderScreenshotBlock(members)
|
|
25241
|
+
]);
|
|
25242
|
+
return [
|
|
25243
|
+
"## Screenshots",
|
|
25244
|
+
...blocks,
|
|
25245
|
+
...renderScreenshotBlock(ungrouped)
|
|
25246
|
+
].join("\n\n");
|
|
25247
|
+
}
|
|
25248
|
+
|
|
25249
|
+
// src/commands/prs/appendScreenshots.ts
|
|
25250
|
+
function withoutScreenshotsSection(body) {
|
|
25251
|
+
return body.replace(/(^|\n)## Screenshots[ \t]*(?:\n[\s\S]*?)?(?=\n## |$)/, "").trimEnd();
|
|
25252
|
+
}
|
|
25187
25253
|
function appendScreenshots(body, attachments) {
|
|
25188
25254
|
if (attachments.length === 0) return body;
|
|
25189
|
-
|
|
25190
|
-
|
|
25191
|
-
|
|
25255
|
+
const base = withoutScreenshotsSection(body);
|
|
25256
|
+
const section2 = renderScreenshotsSection(attachments);
|
|
25257
|
+
return base ? `${base}
|
|
25192
25258
|
|
|
25193
|
-
${
|
|
25259
|
+
${section2}` : section2;
|
|
25194
25260
|
}
|
|
25195
25261
|
|
|
25196
25262
|
// src/commands/github/issue/addIssueToProject.ts
|
|
@@ -26945,7 +27011,7 @@ function placedByDaemon() {
|
|
|
26945
27011
|
function seed(worktreePath, clone) {
|
|
26946
27012
|
console.log(`Preparing ${worktreePath}\u2026`);
|
|
26947
27013
|
return new Promise(
|
|
26948
|
-
(
|
|
27014
|
+
(resolve29) => seedWorktree(worktreePath, clone, resolve29)
|
|
26949
27015
|
);
|
|
26950
27016
|
}
|
|
26951
27017
|
async function moveToPrCheckoutTree() {
|
|
@@ -27246,7 +27312,7 @@ import chalk179 from "chalk";
|
|
|
27246
27312
|
|
|
27247
27313
|
// src/commands/mermaid/exportFile.ts
|
|
27248
27314
|
import { readFileSync as readFileSync40, writeFileSync as writeFileSync33 } from "fs";
|
|
27249
|
-
import { basename as basename21, extname as
|
|
27315
|
+
import { basename as basename21, extname as extname4, resolve as resolve18 } from "path";
|
|
27250
27316
|
import chalk178 from "chalk";
|
|
27251
27317
|
|
|
27252
27318
|
// src/commands/mermaid/renderBlock.ts
|
|
@@ -27273,7 +27339,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
27273
27339
|
async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
27274
27340
|
const content = readFileSync40(file, "utf8");
|
|
27275
27341
|
const blocks = extractMermaidBlocks(content);
|
|
27276
|
-
const stem = basename21(file,
|
|
27342
|
+
const stem = basename21(file, extname4(file));
|
|
27277
27343
|
if (onlyIndex !== void 0) {
|
|
27278
27344
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
27279
27345
|
console.error(
|
|
@@ -28134,25 +28200,25 @@ function isVisibleText(t) {
|
|
|
28134
28200
|
return /[a-zA-Z]{3,}/.test(t);
|
|
28135
28201
|
}
|
|
28136
28202
|
var isHashtag = (t) => /^#[A-Za-z0-9_]+$/.test(t);
|
|
28137
|
-
function collectRscText(v,
|
|
28203
|
+
function collectRscText(v, resolve29, sink3, seen) {
|
|
28138
28204
|
if (v == null) return;
|
|
28139
28205
|
if (typeof v === "string") {
|
|
28140
28206
|
if (isRscRef(v)) {
|
|
28141
28207
|
if (!seen.has(v)) {
|
|
28142
28208
|
seen.add(v);
|
|
28143
|
-
collectRscText(
|
|
28209
|
+
collectRscText(resolve29(v), resolve29, sink3, seen);
|
|
28144
28210
|
}
|
|
28145
28211
|
} else if (isHashtag(v)) sink3.hashtags.push(v);
|
|
28146
28212
|
else if (isVisibleText(v)) sink3.text.push(v);
|
|
28147
28213
|
return;
|
|
28148
28214
|
}
|
|
28149
28215
|
if (Array.isArray(v)) {
|
|
28150
|
-
for (const x of v) collectRscText(x,
|
|
28216
|
+
for (const x of v) collectRscText(x, resolve29, sink3, seen);
|
|
28151
28217
|
return;
|
|
28152
28218
|
}
|
|
28153
28219
|
if (typeof v === "object") {
|
|
28154
28220
|
for (const val of Object.values(v)) {
|
|
28155
|
-
collectRscText(val,
|
|
28221
|
+
collectRscText(val, resolve29, sink3, seen);
|
|
28156
28222
|
}
|
|
28157
28223
|
}
|
|
28158
28224
|
}
|
|
@@ -28184,7 +28250,7 @@ function visitObjects(root2, fn) {
|
|
|
28184
28250
|
}
|
|
28185
28251
|
}
|
|
28186
28252
|
}
|
|
28187
|
-
function buildMentionMap(rows,
|
|
28253
|
+
function buildMentionMap(rows, resolve29) {
|
|
28188
28254
|
const map = /* @__PURE__ */ new Map();
|
|
28189
28255
|
visitObjects(rows, (o) => {
|
|
28190
28256
|
const url = profileActionUrl(o);
|
|
@@ -28192,7 +28258,7 @@ function buildMentionMap(rows, resolve28) {
|
|
|
28192
28258
|
const slug2 = slugFromProfileUrl(url);
|
|
28193
28259
|
if (!slug2 || map.has(slug2)) return;
|
|
28194
28260
|
const sink3 = { text: [], hashtags: [] };
|
|
28195
|
-
collectRscText(o.children,
|
|
28261
|
+
collectRscText(o.children, resolve29, sink3, /* @__PURE__ */ new Set());
|
|
28196
28262
|
const name = sink3.text.join(" ").replace(/\s+/g, " ").trim();
|
|
28197
28263
|
map.set(slug2, name ? { slug: slug2, name, url } : { slug: slug2, url });
|
|
28198
28264
|
});
|
|
@@ -28278,10 +28344,10 @@ function buildPost(raw, mentionMap, author) {
|
|
|
28278
28344
|
|
|
28279
28345
|
// src/commands/netcap/walkPostRow.ts
|
|
28280
28346
|
var isCommentary = (o) => asObject(o.viewTrackingSpecs)?.viewName === "feed-commentary";
|
|
28281
|
-
function walkPostRow(v,
|
|
28347
|
+
function walkPostRow(v, resolve29, raw) {
|
|
28282
28348
|
if (v == null || typeof v !== "object") return;
|
|
28283
28349
|
if (Array.isArray(v)) {
|
|
28284
|
-
for (const x of v) walkPostRow(x,
|
|
28350
|
+
for (const x of v) walkPostRow(x, resolve29, raw);
|
|
28285
28351
|
return;
|
|
28286
28352
|
}
|
|
28287
28353
|
const o = v;
|
|
@@ -28295,9 +28361,9 @@ function walkPostRow(v, resolve28, raw) {
|
|
|
28295
28361
|
}
|
|
28296
28362
|
if (isCommentary(o)) {
|
|
28297
28363
|
const sink3 = { text: raw.text, hashtags: raw.hashtags };
|
|
28298
|
-
collectRscText(o.children,
|
|
28364
|
+
collectRscText(o.children, resolve29, sink3, /* @__PURE__ */ new Set());
|
|
28299
28365
|
}
|
|
28300
|
-
for (const val of Object.values(o)) walkPostRow(val,
|
|
28366
|
+
for (const val of Object.values(o)) walkPostRow(val, resolve29, raw);
|
|
28301
28367
|
}
|
|
28302
28368
|
|
|
28303
28369
|
// src/commands/netcap/extractLinkedInPosts.ts
|
|
@@ -28311,8 +28377,8 @@ function findCommentaryRows(rows) {
|
|
|
28311
28377
|
}
|
|
28312
28378
|
function extractLinkedInPosts(flight, author = findAuthorSlug(flight)) {
|
|
28313
28379
|
const rows = parseRscRows(flight);
|
|
28314
|
-
const
|
|
28315
|
-
const mentionMap = buildMentionMap(rows,
|
|
28380
|
+
const resolve29 = makeRscResolver(rows);
|
|
28381
|
+
const mentionMap = buildMentionMap(rows, resolve29);
|
|
28316
28382
|
const posts = [];
|
|
28317
28383
|
for (const id of findCommentaryRows(rows)) {
|
|
28318
28384
|
const raw = {
|
|
@@ -28322,7 +28388,7 @@ function extractLinkedInPosts(flight, author = findAuthorSlug(flight)) {
|
|
|
28322
28388
|
links: [],
|
|
28323
28389
|
related: []
|
|
28324
28390
|
};
|
|
28325
|
-
walkPostRow(rows[id],
|
|
28391
|
+
walkPostRow(rows[id], resolve29, raw);
|
|
28326
28392
|
const post = buildPost(raw, mentionMap, author);
|
|
28327
28393
|
if (post) posts.push(post);
|
|
28328
28394
|
}
|
|
@@ -28655,12 +28721,12 @@ function printPromptsTable(rows) {
|
|
|
28655
28721
|
].join(" ");
|
|
28656
28722
|
console.log(chalk186.dim(header));
|
|
28657
28723
|
console.log(chalk186.dim("-".repeat(header.length)));
|
|
28658
|
-
for (const
|
|
28659
|
-
const count8 = String(
|
|
28660
|
-
const tool =
|
|
28661
|
-
const command = truncate(
|
|
28724
|
+
for (const row2 of rows) {
|
|
28725
|
+
const count8 = String(row2.count).padStart(countWidth);
|
|
28726
|
+
const tool = row2.tool.padEnd(toolWidth);
|
|
28727
|
+
const command = truncate(row2.command, 60).padEnd(commandWidth);
|
|
28662
28728
|
console.log(
|
|
28663
|
-
`${chalk186.yellow(count8)} ${tool} ${command} ${chalk186.dim(
|
|
28729
|
+
`${chalk186.yellow(count8)} ${tool} ${command} ${chalk186.dim(row2.repos)}`
|
|
28664
28730
|
);
|
|
28665
28731
|
}
|
|
28666
28732
|
}
|
|
@@ -29467,9 +29533,6 @@ function registerPrsComments(prsCommand) {
|
|
|
29467
29533
|
});
|
|
29468
29534
|
}
|
|
29469
29535
|
|
|
29470
|
-
// src/commands/prs/edit.ts
|
|
29471
|
-
import { randomUUID as randomUUID16 } from "crypto";
|
|
29472
|
-
|
|
29473
29536
|
// src/commands/prs/applyEdit.ts
|
|
29474
29537
|
function applyEdit(number, title, body, attachments = []) {
|
|
29475
29538
|
const args = ["pr", "edit", String(number)];
|
|
@@ -29581,6 +29644,84 @@ ${resolves}` : baseWhy);
|
|
|
29581
29644
|
return serializePrBody(parsed);
|
|
29582
29645
|
}
|
|
29583
29646
|
|
|
29647
|
+
// src/commands/prs/parseScreenshotSpec.ts
|
|
29648
|
+
import { statSync as statSync10 } from "fs";
|
|
29649
|
+
import { basename as basename22, extname as extname5, resolve as resolve22 } from "path";
|
|
29650
|
+
function splitOnce(value, separator) {
|
|
29651
|
+
const index2 = value.indexOf(separator);
|
|
29652
|
+
if (index2 === -1) return null;
|
|
29653
|
+
return [value.slice(0, index2), value.slice(index2 + separator.length)];
|
|
29654
|
+
}
|
|
29655
|
+
function isFile2(path106) {
|
|
29656
|
+
try {
|
|
29657
|
+
return statSync10(path106).isFile();
|
|
29658
|
+
} catch {
|
|
29659
|
+
return false;
|
|
29660
|
+
}
|
|
29661
|
+
}
|
|
29662
|
+
function parseScreenshotSpec(spec) {
|
|
29663
|
+
const [label2, rawPath] = splitOnce(spec, "=") ?? ["", spec];
|
|
29664
|
+
const [group, caption] = splitOnce(label2, "/") ?? ["", label2];
|
|
29665
|
+
const path106 = resolve22(rawPath.trim());
|
|
29666
|
+
const ext = extname5(path106).replace(/^\./, "").toLowerCase();
|
|
29667
|
+
if (!isFile2(path106))
|
|
29668
|
+
throw new Error(`--screenshot '${spec}': file not found: ${path106}`);
|
|
29669
|
+
if (!ghAttachableExtensions.has(ext))
|
|
29670
|
+
throw new Error(
|
|
29671
|
+
`--screenshot '${spec}': gh cannot attach .${ext || "(none)"} files (supported: ${[...ghAttachableExtensions].join(", ")}).`
|
|
29672
|
+
);
|
|
29673
|
+
const alt = caption.trim() || basename22(path106, extname5(path106));
|
|
29674
|
+
return group.trim() ? { path: path106, alt, group: group.trim() } : { path: path106, alt };
|
|
29675
|
+
}
|
|
29676
|
+
|
|
29677
|
+
// src/commands/prs/parseScreenshotSpecs.ts
|
|
29678
|
+
function parseScreenshotSpecs(specs) {
|
|
29679
|
+
try {
|
|
29680
|
+
return (specs ?? []).map(parseScreenshotSpec);
|
|
29681
|
+
} catch (error) {
|
|
29682
|
+
console.error(`Error: ${error.message}`);
|
|
29683
|
+
process.exit(1);
|
|
29684
|
+
}
|
|
29685
|
+
}
|
|
29686
|
+
|
|
29687
|
+
// src/commands/prs/previewAndApplyEdit.ts
|
|
29688
|
+
import { randomUUID as randomUUID16 } from "crypto";
|
|
29689
|
+
|
|
29690
|
+
// src/commands/prs/stageScreenshots.ts
|
|
29691
|
+
import { readFile as readFile8 } from "fs/promises";
|
|
29692
|
+
import { basename as basename23 } from "path";
|
|
29693
|
+
function stageScreenshots(screenshots = []) {
|
|
29694
|
+
return Promise.all(
|
|
29695
|
+
screenshots.map(async (screenshot2) => {
|
|
29696
|
+
const { filePath } = await stageAttachment(
|
|
29697
|
+
basename23(screenshot2.path),
|
|
29698
|
+
attachmentContentType(screenshot2.path),
|
|
29699
|
+
await readFile8(screenshot2.path)
|
|
29700
|
+
);
|
|
29701
|
+
return { ...screenshot2, path: filePath };
|
|
29702
|
+
})
|
|
29703
|
+
);
|
|
29704
|
+
}
|
|
29705
|
+
|
|
29706
|
+
// src/commands/prs/previewAndApplyEdit.ts
|
|
29707
|
+
async function previewAndApplyEdit(args) {
|
|
29708
|
+
const decision = await awaitPreviewApproval("PR preview", {
|
|
29709
|
+
sessionId: args.sessionId,
|
|
29710
|
+
requestId: randomUUID16(),
|
|
29711
|
+
title: args.title ?? args.currentTitle,
|
|
29712
|
+
body: args.body,
|
|
29713
|
+
prNumber: args.number,
|
|
29714
|
+
screenshots: await stageScreenshots(args.screenshots)
|
|
29715
|
+
});
|
|
29716
|
+
const attachments = decision.screenshots ?? [];
|
|
29717
|
+
applyEdit(
|
|
29718
|
+
args.number,
|
|
29719
|
+
args.title,
|
|
29720
|
+
appendScreenshots(args.body, attachments),
|
|
29721
|
+
attachments
|
|
29722
|
+
);
|
|
29723
|
+
}
|
|
29724
|
+
|
|
29584
29725
|
// src/commands/prs/findWallOfText.ts
|
|
29585
29726
|
var MAX_PARAGRAPH_CHARS = 600;
|
|
29586
29727
|
var MAX_PARAGRAPH_SENTENCES = 4;
|
|
@@ -29645,9 +29786,10 @@ function validatePrContent(title, body) {
|
|
|
29645
29786
|
async function edit(options2) {
|
|
29646
29787
|
const hasResolves = (options2.resolves?.length ?? 0) > 0;
|
|
29647
29788
|
const hasSection = options2.what !== void 0 || options2.why !== void 0 || options2.how !== void 0 || hasResolves;
|
|
29648
|
-
|
|
29789
|
+
const screenshots = parseScreenshotSpecs(options2.screenshot);
|
|
29790
|
+
if (!options2.title && !hasSection && screenshots.length === 0) {
|
|
29649
29791
|
console.error(
|
|
29650
|
-
"Usage: assist prs edit [--title <title>] [--what <what>] [--why <why>] [--how <how>] [--resolves <key>]"
|
|
29792
|
+
"Usage: assist prs edit [--title <title>] [--what <what>] [--why <why>] [--how <how>] [--resolves <key>] [--screenshot '[Group/]Caption=path']"
|
|
29651
29793
|
);
|
|
29652
29794
|
process.exit(1);
|
|
29653
29795
|
}
|
|
@@ -29656,23 +29798,22 @@ async function edit(options2) {
|
|
|
29656
29798
|
validatePrContent(options2.title ?? "", newBody);
|
|
29657
29799
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
29658
29800
|
if (process.env.ASSIST_SESSION === "1" && sessionId) {
|
|
29659
|
-
|
|
29801
|
+
await previewAndApplyEdit({
|
|
29660
29802
|
sessionId,
|
|
29661
|
-
|
|
29662
|
-
title: options2.title
|
|
29803
|
+
number,
|
|
29804
|
+
title: options2.title,
|
|
29805
|
+
currentTitle: title,
|
|
29663
29806
|
body: newBody,
|
|
29664
|
-
|
|
29807
|
+
screenshots
|
|
29665
29808
|
});
|
|
29666
|
-
const attachments = decision.screenshots ?? [];
|
|
29667
|
-
applyEdit(
|
|
29668
|
-
number,
|
|
29669
|
-
options2.title,
|
|
29670
|
-
appendScreenshots(newBody, attachments),
|
|
29671
|
-
attachments
|
|
29672
|
-
);
|
|
29673
29809
|
return;
|
|
29674
29810
|
}
|
|
29675
|
-
applyEdit(
|
|
29811
|
+
applyEdit(
|
|
29812
|
+
number,
|
|
29813
|
+
options2.title,
|
|
29814
|
+
appendScreenshots(newBody, screenshots),
|
|
29815
|
+
screenshots
|
|
29816
|
+
);
|
|
29676
29817
|
}
|
|
29677
29818
|
|
|
29678
29819
|
// src/commands/prs/prConcisenessGuidance.ts
|
|
@@ -29709,6 +29850,20 @@ independent, parallel items (3+); a single bullet is never right. A single
|
|
|
29709
29850
|
non-list paragraph over ~600 characters or ~4 sentences is a wall of text and
|
|
29710
29851
|
will be rejected.`;
|
|
29711
29852
|
|
|
29853
|
+
// src/commands/prs/screenshotGuidance.ts
|
|
29854
|
+
var screenshotGuidance = `Screenshots: pass --screenshot '[Group/]Caption=path' once per image or video
|
|
29855
|
+
(png, jpg, jpeg, gif, webp, svg, mp4, webm, mov). gh ${minGhAttachVersion}+ uploads each
|
|
29856
|
+
file and the body gets a ## Screenshots section: one ### Group heading per group
|
|
29857
|
+
with its images in a 2-column captioned table (so light/dark pairs sit side by
|
|
29858
|
+
side), then any ungrouped images. The spec splits on the first '=' (label vs
|
|
29859
|
+
path), then the label on the first '/' (group vs caption); a missing caption
|
|
29860
|
+
falls back to the file name. A missing file or unsupported extension fails the
|
|
29861
|
+
command before anything is previewed or sent. Never author ## Screenshots in a
|
|
29862
|
+
section option yourself.
|
|
29863
|
+
|
|
29864
|
+
--screenshot 'Profile/Career Connect light=shots/profile-light.png'
|
|
29865
|
+
--screenshot 'Profile/Career Connect dark=shots/profile-dark.png'`;
|
|
29866
|
+
|
|
29712
29867
|
// src/commands/prs/editHelpText.ts
|
|
29713
29868
|
function editHelpText() {
|
|
29714
29869
|
return `
|
|
@@ -29730,6 +29885,9 @@ rescue a body that is already long-winded.
|
|
|
29730
29885
|
## How only non-obvious decisions the diff alone won't explain; omit by
|
|
29731
29886
|
default.
|
|
29732
29887
|
|
|
29888
|
+
${screenshotGuidance} On edit, any supplied screenshots replace the existing
|
|
29889
|
+
## Screenshots section rather than adding a second one, so pass the full set.
|
|
29890
|
+
|
|
29733
29891
|
${prConcisenessGuidance}
|
|
29734
29892
|
`;
|
|
29735
29893
|
}
|
|
@@ -29746,6 +29904,11 @@ function registerPrsEdit(prsCommand) {
|
|
|
29746
29904
|
"Jira issue key or GitHub issue reference resolved by this PR, appended to ## Why (repeatable)",
|
|
29747
29905
|
collect5,
|
|
29748
29906
|
[]
|
|
29907
|
+
).option(
|
|
29908
|
+
"--screenshot <spec>",
|
|
29909
|
+
"Attach a screenshot as '[Group/]Caption=path', replacing the ## Screenshots section (repeatable)",
|
|
29910
|
+
collect5,
|
|
29911
|
+
[]
|
|
29749
29912
|
).addHelpText("after", () => editHelpText()).action(edit);
|
|
29750
29913
|
}
|
|
29751
29914
|
|
|
@@ -29893,7 +30056,7 @@ function parseIncoming(line, type) {
|
|
|
29893
30056
|
}
|
|
29894
30057
|
}
|
|
29895
30058
|
function requestSession(message3) {
|
|
29896
|
-
return new Promise((
|
|
30059
|
+
return new Promise((resolve29, reject) => {
|
|
29897
30060
|
connectToDaemon().then((socket) => {
|
|
29898
30061
|
let settled = false;
|
|
29899
30062
|
const finish2 = (error, sessionId) => {
|
|
@@ -29901,7 +30064,7 @@ function requestSession(message3) {
|
|
|
29901
30064
|
settled = true;
|
|
29902
30065
|
socket.destroy();
|
|
29903
30066
|
if (error) reject(error);
|
|
29904
|
-
else
|
|
30067
|
+
else resolve29(sessionId);
|
|
29905
30068
|
};
|
|
29906
30069
|
readSocketLines(socket, (line) => {
|
|
29907
30070
|
const incoming = parseIncoming(line, message3.type);
|
|
@@ -30033,7 +30196,8 @@ async function previewAndPlace(args) {
|
|
|
30033
30196
|
title: args.title,
|
|
30034
30197
|
body: args.body,
|
|
30035
30198
|
prNumber: args.prNumber,
|
|
30036
|
-
draft: args.options.draft === true
|
|
30199
|
+
draft: args.options.draft === true,
|
|
30200
|
+
screenshots: await stageScreenshots(args.screenshots)
|
|
30037
30201
|
});
|
|
30038
30202
|
const attachments = decision.screenshots ?? [];
|
|
30039
30203
|
const body = appendScreenshots(args.body, attachments);
|
|
@@ -30051,8 +30215,9 @@ function resolveDraftState(options2, command) {
|
|
|
30051
30215
|
}
|
|
30052
30216
|
|
|
30053
30217
|
// src/commands/prs/raise.ts
|
|
30054
|
-
var USAGE6 = "Usage: assist prs raise --title <title> --what <what> --why <why> [--how <how>] [--resolves <key>] [--force]";
|
|
30218
|
+
var USAGE6 = "Usage: assist prs raise --title <title> --what <what> --why <why> [--how <how>] [--resolves <key>] [--screenshot '[Group/]Caption=path'] [--force]";
|
|
30055
30219
|
async function raise(options2, command) {
|
|
30220
|
+
const screenshots = parseScreenshotSpecs(options2.screenshot);
|
|
30056
30221
|
const { title, body } = buildValidatedBody(options2, USAGE6);
|
|
30057
30222
|
const resolved = { ...options2, draft: resolveDraftState(options2, command) };
|
|
30058
30223
|
const existing = findCurrentPrNumber();
|
|
@@ -30063,7 +30228,8 @@ async function raise(options2, command) {
|
|
|
30063
30228
|
title,
|
|
30064
30229
|
body,
|
|
30065
30230
|
prNumber: existing,
|
|
30066
|
-
options: resolved
|
|
30231
|
+
options: resolved,
|
|
30232
|
+
screenshots
|
|
30067
30233
|
});
|
|
30068
30234
|
return;
|
|
30069
30235
|
}
|
|
@@ -30073,7 +30239,13 @@ async function raise(options2, command) {
|
|
|
30073
30239
|
);
|
|
30074
30240
|
process.exit(1);
|
|
30075
30241
|
}
|
|
30076
|
-
await placePr(
|
|
30242
|
+
await placePr(
|
|
30243
|
+
existing,
|
|
30244
|
+
title,
|
|
30245
|
+
appendScreenshots(body, screenshots),
|
|
30246
|
+
resolved,
|
|
30247
|
+
screenshots
|
|
30248
|
+
);
|
|
30077
30249
|
}
|
|
30078
30250
|
|
|
30079
30251
|
// src/commands/prs/resolvesBlurb.ts
|
|
@@ -30130,6 +30302,8 @@ The body is assembled from discrete section options; supply at minimum --title,
|
|
|
30130
30302
|
unless the approach genuinely needs explaining.
|
|
30131
30303
|
${resolves}
|
|
30132
30304
|
|
|
30305
|
+
${screenshotGuidance}
|
|
30306
|
+
|
|
30133
30307
|
Wrap symbols, file paths, function names, class names, variable names, config
|
|
30134
30308
|
keys, CLI commands, and flag names in backticks.
|
|
30135
30309
|
|
|
@@ -30178,11 +30352,12 @@ on rejection it exits non-zero with the reason. The reviewer may also attach
|
|
|
30178
30352
|
inline comments to specific spans of the preview; on rejection these are printed
|
|
30179
30353
|
as numbered quoted-span + note pairs on stderr. Address every comment (and the
|
|
30180
30354
|
reason), then run the command again to re-preview the revised PR. Repeat until it
|
|
30181
|
-
is approved.
|
|
30182
|
-
|
|
30183
|
-
|
|
30184
|
-
|
|
30185
|
-
and
|
|
30355
|
+
is approved. When the session captured screenshots, supply them yourself with
|
|
30356
|
+
--screenshot rather than asking the reviewer to drag them in. The reviewer may
|
|
30357
|
+
also drop or paste more screenshots or video into the pane; on approval gh
|
|
30358
|
+
attaches them (gh ${minGhAttachVersion}+) as ungrouped images after yours in the
|
|
30359
|
+
## Screenshots section; on rejection they stay attached and reappear in the
|
|
30360
|
+
preview you re-propose. Just compose the sections and run the command.`;
|
|
30186
30361
|
function raiseHelpText(promptJira, promptGithub, draft) {
|
|
30187
30362
|
const config = loadConfig().prs;
|
|
30188
30363
|
const jira = promptJira ?? config?.promptJira ?? false;
|
|
@@ -30208,6 +30383,11 @@ function registerPrsRaise(prsCommand) {
|
|
|
30208
30383
|
"Jira issue key or GitHub issue reference resolved by this PR, appended to ## Why (repeatable)",
|
|
30209
30384
|
collect6,
|
|
30210
30385
|
[]
|
|
30386
|
+
).option(
|
|
30387
|
+
"--screenshot <spec>",
|
|
30388
|
+
"Attach a screenshot as '[Group/]Caption=path' under ## Screenshots (repeatable)",
|
|
30389
|
+
collect6,
|
|
30390
|
+
[]
|
|
30211
30391
|
).option(
|
|
30212
30392
|
"--force",
|
|
30213
30393
|
"Overwrite the title and body of an existing pull request"
|
|
@@ -31767,7 +31947,7 @@ async function notify() {
|
|
|
31767
31947
|
import { execSync as execSync53 } from "child_process";
|
|
31768
31948
|
import { existsSync as existsSync64, mkdirSync as mkdirSync22, unlinkSync as unlinkSync17, writeFileSync as writeFileSync39 } from "fs";
|
|
31769
31949
|
import { tmpdir as tmpdir8 } from "os";
|
|
31770
|
-
import { join as join80, resolve as
|
|
31950
|
+
import { join as join80, resolve as resolve23 } from "path";
|
|
31771
31951
|
import chalk209 from "chalk";
|
|
31772
31952
|
|
|
31773
31953
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -31901,7 +32081,7 @@ function buildOutputPath(outputDir, processName) {
|
|
|
31901
32081
|
mkdirSync22(outputDir, { recursive: true });
|
|
31902
32082
|
}
|
|
31903
32083
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
31904
|
-
return
|
|
32084
|
+
return resolve23(outputDir, `${processName}-${timestamp6}.png`);
|
|
31905
32085
|
}
|
|
31906
32086
|
function runPowerShellScript(processName, outputPath) {
|
|
31907
32087
|
const scriptPath = join80(tmpdir8(), `assist-screenshot-${Date.now()}.ps1`);
|
|
@@ -31917,7 +32097,7 @@ function runPowerShellScript(processName, outputPath) {
|
|
|
31917
32097
|
}
|
|
31918
32098
|
function screenshot(processName) {
|
|
31919
32099
|
const config = loadConfig();
|
|
31920
|
-
const outputDir =
|
|
32100
|
+
const outputDir = resolve23(config.screenshot.outputDir);
|
|
31921
32101
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
31922
32102
|
console.log(chalk209.gray(`Capturing window for process "${processName}" ...`));
|
|
31923
32103
|
try {
|
|
@@ -32018,13 +32198,13 @@ function buildLimitsSegment(rateLimits) {
|
|
|
32018
32198
|
}
|
|
32019
32199
|
|
|
32020
32200
|
// src/commands/readGitBranch.ts
|
|
32021
|
-
import { readFileSync as readFileSync47, statSync as
|
|
32022
|
-
import { isAbsolute as isAbsolute6, join as join81, resolve as
|
|
32201
|
+
import { readFileSync as readFileSync47, statSync as statSync11 } from "fs";
|
|
32202
|
+
import { isAbsolute as isAbsolute6, join as join81, resolve as resolve24 } from "path";
|
|
32023
32203
|
function resolveGitDir(cwd) {
|
|
32024
32204
|
const dotGit = join81(cwd, ".git");
|
|
32025
32205
|
let stat5;
|
|
32026
32206
|
try {
|
|
32027
|
-
stat5 =
|
|
32207
|
+
stat5 = statSync11(dotGit);
|
|
32028
32208
|
} catch {
|
|
32029
32209
|
return null;
|
|
32030
32210
|
}
|
|
@@ -32042,7 +32222,7 @@ function resolveGitDir(cwd) {
|
|
|
32042
32222
|
return null;
|
|
32043
32223
|
}
|
|
32044
32224
|
const gitDir = match[1].trim();
|
|
32045
|
-
return isAbsolute6(gitDir) ? gitDir :
|
|
32225
|
+
return isAbsolute6(gitDir) ? gitDir : resolve24(cwd, gitDir);
|
|
32046
32226
|
}
|
|
32047
32227
|
function readGitBranch(cwd) {
|
|
32048
32228
|
const gitDir = resolveGitDir(cwd);
|
|
@@ -32352,7 +32532,7 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
32352
32532
|
|
|
32353
32533
|
// src/commands/refactor/check.ts
|
|
32354
32534
|
function runScript(script, cwd) {
|
|
32355
|
-
return new Promise((
|
|
32535
|
+
return new Promise((resolve29) => {
|
|
32356
32536
|
const child = spawn7("npm", ["run", script], {
|
|
32357
32537
|
stdio: "pipe",
|
|
32358
32538
|
shell: true,
|
|
@@ -32366,7 +32546,7 @@ function runScript(script, cwd) {
|
|
|
32366
32546
|
output += data.toString();
|
|
32367
32547
|
});
|
|
32368
32548
|
child.on("close", (code) => {
|
|
32369
|
-
|
|
32549
|
+
resolve29({ script, code: code ?? 1, output });
|
|
32370
32550
|
});
|
|
32371
32551
|
});
|
|
32372
32552
|
}
|
|
@@ -34521,7 +34701,7 @@ function readGlobs(value) {
|
|
|
34521
34701
|
|
|
34522
34702
|
// src/commands/review/highLevel/summariseRepoTree.ts
|
|
34523
34703
|
import { execFileSync as execFileSync20 } from "child_process";
|
|
34524
|
-
import { dirname as dirname37, extname as
|
|
34704
|
+
import { dirname as dirname37, extname as extname6 } from "path";
|
|
34525
34705
|
var MAX_DIRECTORIES = 200;
|
|
34526
34706
|
var MAX_EXTENSIONS_PER_DIRECTORY = 6;
|
|
34527
34707
|
function summariseRepoTree(cwd = process.cwd()) {
|
|
@@ -34550,7 +34730,7 @@ function countByDirectory(files) {
|
|
|
34550
34730
|
for (const file of files) {
|
|
34551
34731
|
const directory = dirname37(file) === "." ? "(repo root)" : dirname37(file);
|
|
34552
34732
|
const extensions = directories.get(directory) ?? /* @__PURE__ */ new Map();
|
|
34553
|
-
const extension =
|
|
34733
|
+
const extension = extname6(file) === "" ? "(no extension)" : extname6(file);
|
|
34554
34734
|
extensions.set(extension, (extensions.get(extension) ?? 0) + 1);
|
|
34555
34735
|
directories.set(directory, extensions);
|
|
34556
34736
|
}
|
|
@@ -34676,7 +34856,7 @@ function groupFilesByDirectory(files) {
|
|
|
34676
34856
|
}
|
|
34677
34857
|
|
|
34678
34858
|
// src/commands/review/highLevel/buildHighLevelTree.ts
|
|
34679
|
-
function
|
|
34859
|
+
function basename24(path106) {
|
|
34680
34860
|
return path106.slice(path106.lastIndexOf("/") + 1);
|
|
34681
34861
|
}
|
|
34682
34862
|
function sum(nodes, key) {
|
|
@@ -34692,7 +34872,7 @@ function nodesOf(at2, prefix2) {
|
|
|
34692
34872
|
const files = at2.files.map(
|
|
34693
34873
|
(file) => ({
|
|
34694
34874
|
kind: "file",
|
|
34695
|
-
name:
|
|
34875
|
+
name: basename24(file.path),
|
|
34696
34876
|
...file
|
|
34697
34877
|
})
|
|
34698
34878
|
);
|
|
@@ -36202,11 +36382,11 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
36202
36382
|
}
|
|
36203
36383
|
|
|
36204
36384
|
// src/commands/review/cachedReviewerResult.ts
|
|
36205
|
-
import { statSync as
|
|
36385
|
+
import { statSync as statSync12 } from "fs";
|
|
36206
36386
|
function cachedReviewerResult(name, outputPath) {
|
|
36207
36387
|
let size;
|
|
36208
36388
|
try {
|
|
36209
|
-
size =
|
|
36389
|
+
size = statSync12(outputPath).size;
|
|
36210
36390
|
} catch {
|
|
36211
36391
|
return null;
|
|
36212
36392
|
}
|
|
@@ -36845,12 +37025,12 @@ function onCloseResult(ctx, code) {
|
|
|
36845
37025
|
return { ...closed, stderr: ctx.stderr.value, stdout: ctx.stdout.value };
|
|
36846
37026
|
}
|
|
36847
37027
|
function waitForChildExit(ctx) {
|
|
36848
|
-
return new Promise((
|
|
37028
|
+
return new Promise((resolve29) => {
|
|
36849
37029
|
let settled = false;
|
|
36850
37030
|
const settle = (result) => {
|
|
36851
37031
|
if (settled) return;
|
|
36852
37032
|
settled = true;
|
|
36853
|
-
|
|
37033
|
+
resolve29(result);
|
|
36854
37034
|
};
|
|
36855
37035
|
ctx.child.on("error", (err) => settle(onErrorResult(ctx, err)));
|
|
36856
37036
|
ctx.child.on("close", (code) => settle(onCloseResult(ctx, code)));
|
|
@@ -37392,13 +37572,13 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
37392
37572
|
|
|
37393
37573
|
// src/commands/review/buildReviewPaths.ts
|
|
37394
37574
|
import { homedir as homedir25 } from "os";
|
|
37395
|
-
import { basename as
|
|
37575
|
+
import { basename as basename25, join as join85 } from "path";
|
|
37396
37576
|
function buildReviewPaths(repoRoot2, key) {
|
|
37397
37577
|
const reviewDir = join85(
|
|
37398
37578
|
homedir25(),
|
|
37399
37579
|
".assist",
|
|
37400
37580
|
"reviews",
|
|
37401
|
-
|
|
37581
|
+
basename25(repoRoot2),
|
|
37402
37582
|
key
|
|
37403
37583
|
);
|
|
37404
37584
|
return {
|
|
@@ -38118,12 +38298,12 @@ function mapDataToEvents(data) {
|
|
|
38118
38298
|
const levelIdx = col("Level");
|
|
38119
38299
|
const exIdx = col("Exception");
|
|
38120
38300
|
const msgIdx = col("Message");
|
|
38121
|
-
return data.Rows.map((
|
|
38122
|
-
Timestamp: ticksToIso(
|
|
38123
|
-
Level: String(
|
|
38124
|
-
Exception:
|
|
38301
|
+
return data.Rows.map((row2) => ({
|
|
38302
|
+
Timestamp: ticksToIso(row2[tsIdx]),
|
|
38303
|
+
Level: String(row2[levelIdx] ?? ""),
|
|
38304
|
+
Exception: row2[exIdx] != null ? String(row2[exIdx]) : void 0,
|
|
38125
38305
|
Properties: [],
|
|
38126
|
-
MessageTemplateTokens: [{ Text: String(
|
|
38306
|
+
MessageTemplateTokens: [{ Text: String(row2[msgIdx] ?? "") }]
|
|
38127
38307
|
}));
|
|
38128
38308
|
}
|
|
38129
38309
|
|
|
@@ -38338,11 +38518,11 @@ import { randomUUID as randomUUID20 } from "crypto";
|
|
|
38338
38518
|
// src/commands/sessions/shared/sendShowPreview.ts
|
|
38339
38519
|
async function sendShowPreview(request) {
|
|
38340
38520
|
const socket = await connectToDaemon();
|
|
38341
|
-
await new Promise((
|
|
38521
|
+
await new Promise((resolve29, reject) => {
|
|
38342
38522
|
const finish2 = (error) => {
|
|
38343
38523
|
socket.destroy();
|
|
38344
38524
|
if (error) reject(error);
|
|
38345
|
-
else
|
|
38525
|
+
else resolve29();
|
|
38346
38526
|
};
|
|
38347
38527
|
readSocketLines(socket, (line) => {
|
|
38348
38528
|
const reply2 = parseReply(line);
|
|
@@ -38664,8 +38844,8 @@ function printTable(rows) {
|
|
|
38664
38844
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
38665
38845
|
console.log(chalk254.dim(header));
|
|
38666
38846
|
console.log(chalk254.dim("-".repeat(header.length)));
|
|
38667
|
-
for (const
|
|
38668
|
-
const line = columns.map((c, i) => formatCell(
|
|
38847
|
+
for (const row2 of rows) {
|
|
38848
|
+
const line = columns.map((c, i) => formatCell(row2[c]).padEnd(widths[i])).join(" ");
|
|
38669
38849
|
console.log(line);
|
|
38670
38850
|
}
|
|
38671
38851
|
console.log(chalk254.dim(`
|
|
@@ -39605,9 +39785,9 @@ function createReadlineInterface() {
|
|
|
39605
39785
|
});
|
|
39606
39786
|
}
|
|
39607
39787
|
function askQuestion(rl, question) {
|
|
39608
|
-
return new Promise((
|
|
39788
|
+
return new Promise((resolve29) => {
|
|
39609
39789
|
rl.question(question, (answer) => {
|
|
39610
|
-
|
|
39790
|
+
resolve29(answer.trim());
|
|
39611
39791
|
});
|
|
39612
39792
|
});
|
|
39613
39793
|
}
|
|
@@ -39667,21 +39847,21 @@ async function configure() {
|
|
|
39667
39847
|
}
|
|
39668
39848
|
|
|
39669
39849
|
// src/commands/transcript/list.ts
|
|
39670
|
-
import { existsSync as existsSync78, readdirSync as readdirSync20, statSync as
|
|
39850
|
+
import { existsSync as existsSync78, readdirSync as readdirSync20, statSync as statSync13 } from "fs";
|
|
39671
39851
|
import { join as join98 } from "path";
|
|
39672
39852
|
function list3() {
|
|
39673
39853
|
const { vttDir } = getTranscriptConfig();
|
|
39674
39854
|
if (!existsSync78(vttDir)) return;
|
|
39675
39855
|
for (const entry of readdirSync20(vttDir)) {
|
|
39676
39856
|
if (!entry.endsWith(".vtt")) continue;
|
|
39677
|
-
if (
|
|
39857
|
+
if (statSync13(join98(vttDir, entry)).isDirectory()) continue;
|
|
39678
39858
|
console.log(entry);
|
|
39679
39859
|
}
|
|
39680
39860
|
}
|
|
39681
39861
|
|
|
39682
39862
|
// src/commands/transcript/move.ts
|
|
39683
39863
|
import { existsSync as existsSync79, mkdirSync as mkdirSync33, renameSync as renameSync3, writeFileSync as writeFileSync51 } from "fs";
|
|
39684
|
-
import { basename as
|
|
39864
|
+
import { basename as basename29, join as join99 } from "path";
|
|
39685
39865
|
|
|
39686
39866
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
39687
39867
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -39702,13 +39882,13 @@ function move(file, options2) {
|
|
|
39702
39882
|
process.exit(1);
|
|
39703
39883
|
}
|
|
39704
39884
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
39705
|
-
const filename =
|
|
39885
|
+
const filename = basename29(file);
|
|
39706
39886
|
const sourcePath = join99(vttDir, filename);
|
|
39707
39887
|
if (!existsSync79(sourcePath)) {
|
|
39708
39888
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
39709
39889
|
process.exit(1);
|
|
39710
39890
|
}
|
|
39711
|
-
const base =
|
|
39891
|
+
const base = basename29(filename, ".vtt").replace(/ Transcription$/, "");
|
|
39712
39892
|
const outputName = `${date} ${base}.md`;
|
|
39713
39893
|
const formattedDir = join99(transcriptsDir, client);
|
|
39714
39894
|
mkdirSync33(formattedDir, { recursive: true });
|
|
@@ -39722,7 +39902,7 @@ function move(file, options2) {
|
|
|
39722
39902
|
|
|
39723
39903
|
// src/commands/transcript/merge.ts
|
|
39724
39904
|
import { existsSync as existsSync80, writeFileSync as writeFileSync52 } from "fs";
|
|
39725
|
-
import { basename as
|
|
39905
|
+
import { basename as basename30 } from "path";
|
|
39726
39906
|
|
|
39727
39907
|
// src/commands/transcript/failTranscript.ts
|
|
39728
39908
|
function failTranscript(message3) {
|
|
@@ -39868,7 +40048,7 @@ function readSource3(file) {
|
|
|
39868
40048
|
if (!existsSync80(file)) failTranscript(`VTT file not found: ${file}`);
|
|
39869
40049
|
const cues = readCleanedCues(file);
|
|
39870
40050
|
if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
|
|
39871
|
-
return { path: file, name:
|
|
40051
|
+
return { path: file, name: basename30(file), cues };
|
|
39872
40052
|
}
|
|
39873
40053
|
function wholePassages(sources) {
|
|
39874
40054
|
return sources.map((source) => ({
|
|
@@ -40529,7 +40709,7 @@ function listMigrationFiles(dir) {
|
|
|
40529
40709
|
|
|
40530
40710
|
// src/commands/verify/migrations/readBaselineMigrations.ts
|
|
40531
40711
|
import { execSync as execSync64 } from "child_process";
|
|
40532
|
-
import { basename as
|
|
40712
|
+
import { basename as basename31 } from "path";
|
|
40533
40713
|
var MIGRATION_FILE3 = /^migration\d+[A-Za-z0-9]*\.ts$/;
|
|
40534
40714
|
function readBaselineMigrations(repoRelativeDir, ref) {
|
|
40535
40715
|
const baseline = /* @__PURE__ */ new Map();
|
|
@@ -40542,7 +40722,7 @@ function readBaselineMigrations(repoRelativeDir, ref) {
|
|
|
40542
40722
|
} catch {
|
|
40543
40723
|
return baseline;
|
|
40544
40724
|
}
|
|
40545
|
-
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path106) => MIGRATION_FILE3.test(
|
|
40725
|
+
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path106) => MIGRATION_FILE3.test(basename31(path106)));
|
|
40546
40726
|
for (const path106 of paths) {
|
|
40547
40727
|
try {
|
|
40548
40728
|
const content = execSync64(`git show "${ref}:${path106}"`, {
|
|
@@ -40550,7 +40730,7 @@ function readBaselineMigrations(repoRelativeDir, ref) {
|
|
|
40550
40730
|
maxBuffer: 16 * 1024 * 1024,
|
|
40551
40731
|
stdio: ["pipe", "pipe", "pipe"]
|
|
40552
40732
|
});
|
|
40553
|
-
baseline.set(
|
|
40733
|
+
baseline.set(basename31(path106), content);
|
|
40554
40734
|
} catch {
|
|
40555
40735
|
}
|
|
40556
40736
|
}
|
|
@@ -40764,9 +40944,9 @@ function gitFailureReason(error) {
|
|
|
40764
40944
|
}
|
|
40765
40945
|
|
|
40766
40946
|
// src/commands/watch/gitMarkerPath.ts
|
|
40767
|
-
import { resolve as
|
|
40947
|
+
import { resolve as resolve26 } from "path";
|
|
40768
40948
|
function gitMarkerPath(name, cwd) {
|
|
40769
|
-
return
|
|
40949
|
+
return resolve26(
|
|
40770
40950
|
cwd ?? process.cwd(),
|
|
40771
40951
|
runGit3(["rev-parse", "--git-path", name], cwd)
|
|
40772
40952
|
);
|
|
@@ -40803,12 +40983,12 @@ function decideLap(end, interrupted) {
|
|
|
40803
40983
|
import { spawn as spawn9 } from "child_process";
|
|
40804
40984
|
var WATCH_LAP_ARGS = ["watch", "wait", "--pull", "--build"];
|
|
40805
40985
|
function runWatchLap() {
|
|
40806
|
-
return new Promise((
|
|
40986
|
+
return new Promise((resolve29, reject) => {
|
|
40807
40987
|
const assistFromPath = spawn9("assist", WATCH_LAP_ARGS, {
|
|
40808
40988
|
stdio: "inherit",
|
|
40809
40989
|
shell: process.platform === "win32"
|
|
40810
40990
|
});
|
|
40811
|
-
assistFromPath.on("close", (code, signal) =>
|
|
40991
|
+
assistFromPath.on("close", (code, signal) => resolve29({ code, signal }));
|
|
40812
40992
|
assistFromPath.on("error", reject);
|
|
40813
40993
|
});
|
|
40814
40994
|
}
|
|
@@ -41153,7 +41333,7 @@ function resolveParams(params, cliArgs) {
|
|
|
41153
41333
|
|
|
41154
41334
|
// src/commands/run/resolveRunCwd.ts
|
|
41155
41335
|
import { existsSync as existsSync82 } from "fs";
|
|
41156
|
-
import { resolve as
|
|
41336
|
+
import { resolve as resolve27 } from "path";
|
|
41157
41337
|
var MissingRunCwdError = class extends Error {
|
|
41158
41338
|
constructor(runName, cwd) {
|
|
41159
41339
|
super(`run config "${runName}": cwd ${cwd} does not exist`);
|
|
@@ -41164,7 +41344,7 @@ var MissingRunCwdError = class extends Error {
|
|
|
41164
41344
|
};
|
|
41165
41345
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
41166
41346
|
if (!config.cwd) return void 0;
|
|
41167
|
-
const cwd =
|
|
41347
|
+
const cwd = resolve27(baseDir, config.cwd);
|
|
41168
41348
|
if (!existsSync82(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
41169
41349
|
return cwd;
|
|
41170
41350
|
}
|
|
@@ -41328,7 +41508,7 @@ function readMovement(cwd) {
|
|
|
41328
41508
|
var CONTROL_POLL_MS = 1e3;
|
|
41329
41509
|
function pollForMovement(options2) {
|
|
41330
41510
|
const { upstream, intervalMs, timeoutMs, timeout, cwd, control } = options2;
|
|
41331
|
-
return new Promise((
|
|
41511
|
+
return new Promise((resolve29) => {
|
|
41332
41512
|
let settled = false;
|
|
41333
41513
|
const finish2 = (outcome) => {
|
|
41334
41514
|
if (settled) return;
|
|
@@ -41337,7 +41517,7 @@ function pollForMovement(options2) {
|
|
|
41337
41517
|
clearInterval(controller);
|
|
41338
41518
|
clearTimeout(deadline);
|
|
41339
41519
|
process.off("SIGINT", onInterrupt);
|
|
41340
|
-
|
|
41520
|
+
resolve29(outcome);
|
|
41341
41521
|
};
|
|
41342
41522
|
const onInterrupt = () => finish2({ kind: "interrupted" });
|
|
41343
41523
|
const check2 = () => {
|
|
@@ -41484,7 +41664,7 @@ function extractCode(url, expectedState) {
|
|
|
41484
41664
|
return code;
|
|
41485
41665
|
}
|
|
41486
41666
|
function waitForCallback(port, expectedState) {
|
|
41487
|
-
return new Promise((
|
|
41667
|
+
return new Promise((resolve29, reject) => {
|
|
41488
41668
|
const timeout = setTimeout(() => {
|
|
41489
41669
|
server.close();
|
|
41490
41670
|
reject(new Error("Authorization timed out after 120 seconds"));
|
|
@@ -41501,7 +41681,7 @@ function waitForCallback(port, expectedState) {
|
|
|
41501
41681
|
const code = extractCode(url, expectedState);
|
|
41502
41682
|
respondHtml(res, 200, "Authorization successful!");
|
|
41503
41683
|
server.close();
|
|
41504
|
-
|
|
41684
|
+
resolve29(code);
|
|
41505
41685
|
} catch (error) {
|
|
41506
41686
|
respondHtml(res, 400, error.message);
|
|
41507
41687
|
server.close();
|
|
@@ -41622,7 +41802,7 @@ async function auth() {
|
|
|
41622
41802
|
|
|
41623
41803
|
// src/commands/roam/postRoamActivity.ts
|
|
41624
41804
|
import { execFileSync as execFileSync22 } from "child_process";
|
|
41625
|
-
import { readdirSync as readdirSync22, readFileSync as readFileSync65, statSync as
|
|
41805
|
+
import { readdirSync as readdirSync22, readFileSync as readFileSync65, statSync as statSync14 } from "fs";
|
|
41626
41806
|
import { join as join100 } from "path";
|
|
41627
41807
|
function findPortFile(roamDir) {
|
|
41628
41808
|
let entries;
|
|
@@ -41634,7 +41814,7 @@ function findPortFile(roamDir) {
|
|
|
41634
41814
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
41635
41815
|
const path106 = join100(roamDir, name);
|
|
41636
41816
|
try {
|
|
41637
|
-
return { path: path106, mtimeMs:
|
|
41817
|
+
return { path: path106, mtimeMs: statSync14(path106).mtimeMs };
|
|
41638
41818
|
} catch {
|
|
41639
41819
|
return void 0;
|
|
41640
41820
|
}
|
|
@@ -42091,10 +42271,10 @@ var STATUS_TIMEOUT_MS2 = 5e3;
|
|
|
42091
42271
|
function queryDaemon(socket) {
|
|
42092
42272
|
socket.write(`${JSON.stringify({ type: "ping" })}
|
|
42093
42273
|
`);
|
|
42094
|
-
return new Promise((
|
|
42274
|
+
return new Promise((resolve29) => {
|
|
42095
42275
|
const result = { sessions: [] };
|
|
42096
42276
|
const pending = /* @__PURE__ */ new Set(["sessions", "pong"]);
|
|
42097
|
-
const timer = setTimeout(() =>
|
|
42277
|
+
const timer = setTimeout(() => resolve29(result), STATUS_TIMEOUT_MS2);
|
|
42098
42278
|
const lines2 = createInterface8({ input: socket });
|
|
42099
42279
|
lines2.on("error", () => {
|
|
42100
42280
|
});
|
|
@@ -42102,7 +42282,7 @@ function queryDaemon(socket) {
|
|
|
42102
42282
|
applyLine(result, pending, line);
|
|
42103
42283
|
if (pending.size === 0) {
|
|
42104
42284
|
clearTimeout(timer);
|
|
42105
|
-
|
|
42285
|
+
resolve29(result);
|
|
42106
42286
|
}
|
|
42107
42287
|
});
|
|
42108
42288
|
});
|
|
@@ -42202,11 +42382,11 @@ function clearPersistedSessionsOnDrain() {
|
|
|
42202
42382
|
|
|
42203
42383
|
// src/commands/sessions/daemon/readDaemonMessage.ts
|
|
42204
42384
|
function readDaemonMessage(lines2, timeoutMs, fallback, match) {
|
|
42205
|
-
return new Promise((
|
|
42385
|
+
return new Promise((resolve29) => {
|
|
42206
42386
|
const finish2 = (value) => {
|
|
42207
42387
|
clearTimeout(timer);
|
|
42208
42388
|
lines2.off("line", onLine);
|
|
42209
|
-
|
|
42389
|
+
resolve29(value);
|
|
42210
42390
|
};
|
|
42211
42391
|
const timer = setTimeout(() => finish2(fallback), timeoutMs);
|
|
42212
42392
|
const onLine = (line) => {
|
|
@@ -42855,7 +43035,7 @@ import { existsSync as existsSync87 } from "fs";
|
|
|
42855
43035
|
import * as pty from "node-pty";
|
|
42856
43036
|
|
|
42857
43037
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
42858
|
-
import { chmodSync, existsSync as existsSync86, statSync as
|
|
43038
|
+
import { chmodSync, existsSync as existsSync86, statSync as statSync15 } from "fs";
|
|
42859
43039
|
import { createRequire as createRequire3 } from "module";
|
|
42860
43040
|
import path102 from "path";
|
|
42861
43041
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -42871,7 +43051,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
42871
43051
|
"spawn-helper"
|
|
42872
43052
|
);
|
|
42873
43053
|
if (!existsSync86(helper)) return;
|
|
42874
|
-
const mode =
|
|
43054
|
+
const mode = statSync15(helper).mode;
|
|
42875
43055
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
42876
43056
|
}
|
|
42877
43057
|
|
|
@@ -43103,11 +43283,11 @@ var autoUpdateControl = {
|
|
|
43103
43283
|
persist2(value);
|
|
43104
43284
|
wake?.();
|
|
43105
43285
|
},
|
|
43106
|
-
sleep: (ms) => new Promise((
|
|
43286
|
+
sleep: (ms) => new Promise((resolve29) => {
|
|
43107
43287
|
const done2 = () => {
|
|
43108
43288
|
clearTimeout(timer);
|
|
43109
43289
|
if (wake === done2) wake = void 0;
|
|
43110
|
-
|
|
43290
|
+
resolve29();
|
|
43111
43291
|
};
|
|
43112
43292
|
const timer = setTimeout(done2, ms);
|
|
43113
43293
|
wake = done2;
|
|
@@ -43422,7 +43602,7 @@ function clearLapSignals(cwd) {
|
|
|
43422
43602
|
}
|
|
43423
43603
|
function runUpdateLap(cwd, onOutput) {
|
|
43424
43604
|
clearLapSignals(cwd);
|
|
43425
|
-
return new Promise((
|
|
43605
|
+
return new Promise((resolve29, reject) => {
|
|
43426
43606
|
const { ASSIST_ACTIVITY_ID: _activity, ...env } = process.env;
|
|
43427
43607
|
const child = spawn11(
|
|
43428
43608
|
process.execPath,
|
|
@@ -43442,7 +43622,7 @@ function runUpdateLap(cwd, onOutput) {
|
|
|
43442
43622
|
child.stderr.on("data", (chunk) => onOutput(chunk.toString()));
|
|
43443
43623
|
child.on("close", (code, signal) => {
|
|
43444
43624
|
process.off("exit", killWithDaemon);
|
|
43445
|
-
|
|
43625
|
+
resolve29({ code, signal });
|
|
43446
43626
|
});
|
|
43447
43627
|
child.on("error", (error) => {
|
|
43448
43628
|
process.off("exit", killWithDaemon);
|
|
@@ -43523,14 +43703,14 @@ function setStatus2(session, newStatus) {
|
|
|
43523
43703
|
|
|
43524
43704
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
43525
43705
|
import { existsSync as existsSync90 } from "fs";
|
|
43526
|
-
import { basename as
|
|
43706
|
+
import { basename as basename32 } from "path";
|
|
43527
43707
|
|
|
43528
43708
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
43529
43709
|
import { existsSync as existsSync89 } from "fs";
|
|
43530
43710
|
import { join as join105 } from "path";
|
|
43531
43711
|
|
|
43532
43712
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
43533
|
-
import { statSync as
|
|
43713
|
+
import { statSync as statSync16 } from "fs";
|
|
43534
43714
|
import { rm as rm3 } from "fs/promises";
|
|
43535
43715
|
import { join as join104 } from "path";
|
|
43536
43716
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
@@ -43560,7 +43740,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
43560
43740
|
return { removed: true };
|
|
43561
43741
|
}
|
|
43562
43742
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
43563
|
-
return
|
|
43743
|
+
return statSync16(join104(worktreePath, ".git"), {
|
|
43564
43744
|
throwIfNoEntry: false
|
|
43565
43745
|
})?.isDirectory() === true;
|
|
43566
43746
|
}
|
|
@@ -43666,7 +43846,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
43666
43846
|
const clone = owningClone(worktreePath);
|
|
43667
43847
|
const removal = await removeTree(clone, worktreePath, force);
|
|
43668
43848
|
if (!removal.removed) return removal;
|
|
43669
|
-
await deleteWorktreeBranch(clone,
|
|
43849
|
+
await deleteWorktreeBranch(clone, basename32(worktreePath));
|
|
43670
43850
|
forgetWorktree(worktreePath);
|
|
43671
43851
|
daemonLog(`worktree ${worktreePath} reaped${force ? " (forced)" : ""}`);
|
|
43672
43852
|
return removal;
|
|
@@ -43833,12 +44013,12 @@ function processCwd(link3) {
|
|
|
43833
44013
|
var POLL_MS2 = 500;
|
|
43834
44014
|
var GRACE_MS = 5e3;
|
|
43835
44015
|
function awaitTreeVacated(session, treePath) {
|
|
43836
|
-
return new Promise((
|
|
44016
|
+
return new Promise((resolve29) => {
|
|
43837
44017
|
let ticks = GRACE_MS / POLL_MS2;
|
|
43838
44018
|
const settle = (outcome) => {
|
|
43839
44019
|
clearTimeout(timer);
|
|
43840
44020
|
session.closeGrace = void 0;
|
|
43841
|
-
|
|
44021
|
+
resolve29(outcome);
|
|
43842
44022
|
};
|
|
43843
44023
|
const tick = () => {
|
|
43844
44024
|
if (liveProcessesInTree(treePath).length === 0) settle("vacated");
|
|
@@ -44162,7 +44342,8 @@ function buildPrPreview(d, kind, prNumber) {
|
|
|
44162
44342
|
kind,
|
|
44163
44343
|
itemType: kind === "backlog-item" ? d.itemType === "bug" ? "bug" : "story" : void 0,
|
|
44164
44344
|
draft: kind === "pr" && prNumber === null ? draft : void 0,
|
|
44165
|
-
metadata: parsePreviewMetadata(d.metadata)
|
|
44345
|
+
metadata: parsePreviewMetadata(d.metadata),
|
|
44346
|
+
screenshots: kind === "pr" ? toAttachments(d.screenshots) : void 0
|
|
44166
44347
|
};
|
|
44167
44348
|
}
|
|
44168
44349
|
|
|
@@ -44249,7 +44430,7 @@ function setPrPreview(sessions, waiters, notify2, client, d) {
|
|
|
44249
44430
|
d.draft === true
|
|
44250
44431
|
);
|
|
44251
44432
|
daemonLog(
|
|
44252
|
-
`pr-preview set: id=${id} requestId=${d.requestId} kind=${kind} target=${target}`
|
|
44433
|
+
`pr-preview set: id=${id} requestId=${d.requestId} kind=${kind} target=${target} screenshots=${session.pendingPrPreview.screenshots?.length ?? 0}`
|
|
44253
44434
|
);
|
|
44254
44435
|
notify2();
|
|
44255
44436
|
}
|
|
@@ -44427,7 +44608,7 @@ function emitSessionOutput(session, clients, data) {
|
|
|
44427
44608
|
|
|
44428
44609
|
// src/commands/sessions/daemon/exitReason.ts
|
|
44429
44610
|
import { existsSync as existsSync92 } from "fs";
|
|
44430
|
-
import { resolve as
|
|
44611
|
+
import { resolve as resolve28 } from "path";
|
|
44431
44612
|
function exitDetail(session) {
|
|
44432
44613
|
if (session.cwd && !existsSync92(session.cwd))
|
|
44433
44614
|
return `working directory ${session.cwd} no longer exists`;
|
|
@@ -44442,7 +44623,7 @@ function missingRunConfigCwd(session) {
|
|
|
44442
44623
|
const dir = session.cwd ?? process.cwd();
|
|
44443
44624
|
const config = resolveRunConfig(session.runName, dir);
|
|
44444
44625
|
if (!config?.cwd) return void 0;
|
|
44445
|
-
const configured =
|
|
44626
|
+
const configured = resolve28(runConfigBaseDirFrom(dir), config.cwd);
|
|
44446
44627
|
if (existsSync92(configured)) return void 0;
|
|
44447
44628
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
44448
44629
|
}
|
|
@@ -44516,10 +44697,10 @@ function applyReviewPause(session, activity2) {
|
|
|
44516
44697
|
// src/shared/db/getPhaseActiveMs.ts
|
|
44517
44698
|
import { and as and20, eq as eq46 } from "drizzle-orm";
|
|
44518
44699
|
async function getPhaseActiveMs(db, itemId2, phaseIdx) {
|
|
44519
|
-
const [
|
|
44700
|
+
const [row2] = await db.select({ activeMs: phaseUsage.activeMs }).from(phaseUsage).where(
|
|
44520
44701
|
and20(eq46(phaseUsage.itemId, itemId2), eq46(phaseUsage.phaseIdx, phaseIdx))
|
|
44521
44702
|
);
|
|
44522
|
-
return
|
|
44703
|
+
return row2?.activeMs ?? 0;
|
|
44523
44704
|
}
|
|
44524
44705
|
|
|
44525
44706
|
// src/commands/sessions/daemon/loadPhaseActiveMs.ts
|
|
@@ -46569,7 +46750,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
46569
46750
|
|
|
46570
46751
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
46571
46752
|
import { existsSync as existsSync96 } from "fs";
|
|
46572
|
-
import { basename as
|
|
46753
|
+
import { basename as basename34 } from "path";
|
|
46573
46754
|
|
|
46574
46755
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
46575
46756
|
function accountedTrees(sessions) {
|
|
@@ -46677,7 +46858,7 @@ function capped2(lines2) {
|
|
|
46677
46858
|
}
|
|
46678
46859
|
|
|
46679
46860
|
// src/commands/sessions/daemon/worktree/resurfaceOrphanedWorktree.ts
|
|
46680
|
-
import { basename as
|
|
46861
|
+
import { basename as basename33 } from "path";
|
|
46681
46862
|
function resurfaceOrphanedWorktree(sessions, spawnWith, recovered, notify2) {
|
|
46682
46863
|
const { orphan, reason: reason4, held } = recovered;
|
|
46683
46864
|
let id;
|
|
@@ -46700,7 +46881,7 @@ function orphanedSession(id, recovered) {
|
|
|
46700
46881
|
const { orphan, reason: reason4, held } = recovered;
|
|
46701
46882
|
return {
|
|
46702
46883
|
...sessionBase(id, "stopped"),
|
|
46703
|
-
name: `recovered ${
|
|
46884
|
+
name: `recovered ${basename33(orphan.path)}`,
|
|
46704
46885
|
subtitle: `${held.summary} in ${orphan.path}`,
|
|
46705
46886
|
commandType: "claude",
|
|
46706
46887
|
pty: null,
|
|
@@ -46761,7 +46942,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
46761
46942
|
logVanishedTree(sessions, path106);
|
|
46762
46943
|
vanished.set(clone, [
|
|
46763
46944
|
...vanished.get(clone) ?? [],
|
|
46764
|
-
{ path: path106, branch:
|
|
46945
|
+
{ path: path106, branch: basename34(path106) }
|
|
46765
46946
|
]);
|
|
46766
46947
|
continue;
|
|
46767
46948
|
}
|
|
@@ -47161,7 +47342,7 @@ function failPendingCreators(state, message3) {
|
|
|
47161
47342
|
}
|
|
47162
47343
|
function resetRelayState(state, reason4) {
|
|
47163
47344
|
failPendingCreators(state, reason4);
|
|
47164
|
-
for (const
|
|
47345
|
+
for (const resolve29 of state.historyWaiters) resolve29([]);
|
|
47165
47346
|
state.historyWaiters = [];
|
|
47166
47347
|
state.sessions = [];
|
|
47167
47348
|
state.lastSnapshot = void 0;
|
|
@@ -47553,16 +47734,16 @@ var HISTORY_TIMEOUT_MS = 5e3;
|
|
|
47553
47734
|
function requestLinkHistory(ctx) {
|
|
47554
47735
|
if (!ctx.greeted) return Promise.resolve([]);
|
|
47555
47736
|
const waiters = ctx.relay.historyWaiters;
|
|
47556
|
-
return new Promise((
|
|
47737
|
+
return new Promise((resolve29) => {
|
|
47557
47738
|
const settle = (sessions) => {
|
|
47558
47739
|
clearTimeout(timer);
|
|
47559
|
-
|
|
47740
|
+
resolve29(sessions);
|
|
47560
47741
|
};
|
|
47561
47742
|
const timer = setTimeout(() => {
|
|
47562
47743
|
const index2 = waiters.indexOf(settle);
|
|
47563
47744
|
if (index2 !== -1) waiters.splice(index2, 1);
|
|
47564
47745
|
daemonLog(`link ${ctx.spec.name} ws: history timed out`);
|
|
47565
|
-
|
|
47746
|
+
resolve29(ctx.relay.lastHistory ?? []);
|
|
47566
47747
|
}, HISTORY_TIMEOUT_MS);
|
|
47567
47748
|
timer.unref?.();
|
|
47568
47749
|
waiters.push(settle);
|