@staff0rd/assist 0.802.0 → 0.803.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/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +457 -299
- 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.803.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
|
|
@@ -3197,7 +3197,7 @@ function parsePreviewDecision(line, requestId) {
|
|
|
3197
3197
|
|
|
3198
3198
|
// src/commands/sessions/shared/requestPreviewDecision.ts
|
|
3199
3199
|
function requestPreviewDecision(request) {
|
|
3200
|
-
return new Promise((
|
|
3200
|
+
return new Promise((resolve29, reject) => {
|
|
3201
3201
|
connectToDaemon().then((socket) => {
|
|
3202
3202
|
let settled = false;
|
|
3203
3203
|
const finish2 = (error, decision) => {
|
|
@@ -3205,7 +3205,7 @@ function requestPreviewDecision(request) {
|
|
|
3205
3205
|
settled = true;
|
|
3206
3206
|
socket.destroy();
|
|
3207
3207
|
if (error) reject(error);
|
|
3208
|
-
else
|
|
3208
|
+
else resolve29(decision);
|
|
3209
3209
|
};
|
|
3210
3210
|
readSocketLines(socket, (line) => {
|
|
3211
3211
|
const incoming = parsePreviewDecision(line, request.requestId);
|
|
@@ -4029,7 +4029,7 @@ async function readAppliedIds(exec3) {
|
|
|
4029
4029
|
const rows = await exec3.query(
|
|
4030
4030
|
`SELECT id FROM ${APPLIED_MIGRATIONS_TABLE} ORDER BY id`
|
|
4031
4031
|
);
|
|
4032
|
-
return new Set(rows.map((
|
|
4032
|
+
return new Set(rows.map((row2) => Number(row2.id)));
|
|
4033
4033
|
}
|
|
4034
4034
|
async function applyMigrations(exec3) {
|
|
4035
4035
|
await exec3.exec(CREATE_APPLIED_MIGRATIONS);
|
|
@@ -4070,7 +4070,7 @@ async function readAppliedIds2(exec3) {
|
|
|
4070
4070
|
const rows = await exec3.query(
|
|
4071
4071
|
`SELECT id FROM ${APPLIED_MIGRATIONS_TABLE} ORDER BY id`
|
|
4072
4072
|
);
|
|
4073
|
-
return rows.map((
|
|
4073
|
+
return rows.map((row2) => Number(row2.id));
|
|
4074
4074
|
}
|
|
4075
4075
|
async function getMigrationStatus(exec3) {
|
|
4076
4076
|
return compareMigrations(await readAppliedIds2(exec3));
|
|
@@ -4974,9 +4974,9 @@ function itemColumns(item, origin) {
|
|
|
4974
4974
|
|
|
4975
4975
|
// src/commands/backlog/insertItem.ts
|
|
4976
4976
|
async function insertItem(db, item, origin) {
|
|
4977
|
-
const [
|
|
4978
|
-
if (!
|
|
4979
|
-
return
|
|
4977
|
+
const [row2] = await db.insert(items).values(itemColumns(item, origin)).returning({ id: items.id });
|
|
4978
|
+
if (!row2) throw new Error("Failed to insert backlog item");
|
|
4979
|
+
return row2.id;
|
|
4980
4980
|
}
|
|
4981
4981
|
|
|
4982
4982
|
// src/commands/backlog/insertPlan.ts
|
|
@@ -5081,10 +5081,10 @@ import { asc as asc3, eq as eq3 } from "drizzle-orm";
|
|
|
5081
5081
|
// src/commands/backlog/groupByItem.ts
|
|
5082
5082
|
function groupByItem(rows) {
|
|
5083
5083
|
const map = /* @__PURE__ */ new Map();
|
|
5084
|
-
for (const
|
|
5085
|
-
const bucket = map.get(
|
|
5086
|
-
if (bucket) bucket.push(
|
|
5087
|
-
else map.set(
|
|
5084
|
+
for (const row2 of rows) {
|
|
5085
|
+
const bucket = map.get(row2.itemId);
|
|
5086
|
+
if (bucket) bucket.push(row2);
|
|
5087
|
+
else map.set(row2.itemId, [row2]);
|
|
5088
5088
|
}
|
|
5089
5089
|
return map;
|
|
5090
5090
|
}
|
|
@@ -5265,23 +5265,23 @@ function rowToComment(c) {
|
|
|
5265
5265
|
function rowToLink(l) {
|
|
5266
5266
|
return { type: l.type, targetId: l.targetId };
|
|
5267
5267
|
}
|
|
5268
|
-
function assignOptionalColumns(item,
|
|
5269
|
-
if (
|
|
5270
|
-
if (
|
|
5271
|
-
if (
|
|
5272
|
-
if (
|
|
5268
|
+
function assignOptionalColumns(item, row2) {
|
|
5269
|
+
if (row2.description != null) item.description = row2.description;
|
|
5270
|
+
if (row2.currentPhase != null) item.currentPhase = row2.currentPhase;
|
|
5271
|
+
if (row2.jiraKey != null) item.jiraKey = row2.jiraKey;
|
|
5272
|
+
if (row2.githubIssue != null) item.githubIssue = row2.githubIssue;
|
|
5273
5273
|
}
|
|
5274
|
-
function baseItem(
|
|
5274
|
+
function baseItem(row2) {
|
|
5275
5275
|
const item = {
|
|
5276
|
-
id:
|
|
5277
|
-
type:
|
|
5278
|
-
name:
|
|
5279
|
-
acceptanceCriteria: JSON.parse(
|
|
5280
|
-
status:
|
|
5281
|
-
starred:
|
|
5282
|
-
origin:
|
|
5283
|
-
};
|
|
5284
|
-
assignOptionalColumns(item,
|
|
5276
|
+
id: row2.id,
|
|
5277
|
+
type: row2.type,
|
|
5278
|
+
name: row2.name,
|
|
5279
|
+
acceptanceCriteria: JSON.parse(row2.acceptanceCriteria),
|
|
5280
|
+
status: row2.status,
|
|
5281
|
+
starred: row2.starred,
|
|
5282
|
+
origin: row2.origin
|
|
5283
|
+
};
|
|
5284
|
+
assignOptionalColumns(item, row2);
|
|
5285
5285
|
return item;
|
|
5286
5286
|
}
|
|
5287
5287
|
function attachComments(item, rel, id) {
|
|
@@ -5296,15 +5296,15 @@ function attachPlan(item, rel, id) {
|
|
|
5296
5296
|
const phases = rel.phases.get(id) ?? [];
|
|
5297
5297
|
if (phases.length > 0) item.plan = buildPlan(phases, rel.tasks.get(id) ?? []);
|
|
5298
5298
|
}
|
|
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,
|
|
5299
|
+
function rowToItem(row2, rel) {
|
|
5300
|
+
const item = baseItem(row2);
|
|
5301
|
+
attachComments(item, rel, row2.id);
|
|
5302
|
+
attachSubtasks(item, rel, row2.id);
|
|
5303
|
+
attachLinks(item, rel, row2.id);
|
|
5304
|
+
attachPlan(item, rel, row2.id);
|
|
5305
|
+
attachUsage(item, rel, row2.id);
|
|
5306
|
+
attachSessions(item, rel, row2.id);
|
|
5307
|
+
attachGitRefs(item, rel, row2.id);
|
|
5308
5308
|
return item;
|
|
5309
5309
|
}
|
|
5310
5310
|
|
|
@@ -5317,7 +5317,7 @@ async function loadAllItems(orm, origin) {
|
|
|
5317
5317
|
rows.map((r) => r.id),
|
|
5318
5318
|
{ includeComments: false, includeTasks: false, includeSubtasks: false }
|
|
5319
5319
|
);
|
|
5320
|
-
return rows.map((
|
|
5320
|
+
return rows.map((row2) => rowToItem(row2, rel));
|
|
5321
5321
|
}
|
|
5322
5322
|
|
|
5323
5323
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
@@ -5472,8 +5472,8 @@ async function ensureMigrated(orm, dir, origin) {
|
|
|
5472
5472
|
// src/commands/backlog/deleteItem.ts
|
|
5473
5473
|
import { eq as eq4 } from "drizzle-orm";
|
|
5474
5474
|
async function deleteItem(orm, id) {
|
|
5475
|
-
const [
|
|
5476
|
-
return
|
|
5475
|
+
const [row2] = await orm.delete(items).where(eq4(items.id, id)).returning({ name: items.name });
|
|
5476
|
+
return row2?.name;
|
|
5477
5477
|
}
|
|
5478
5478
|
|
|
5479
5479
|
// src/commands/backlog/findBacklogUp.ts
|
|
@@ -5498,13 +5498,13 @@ function findBacklogUp(startDir) {
|
|
|
5498
5498
|
// src/commands/backlog/loadItem.ts
|
|
5499
5499
|
import { eq as eq5 } from "drizzle-orm";
|
|
5500
5500
|
async function loadItem(orm, id) {
|
|
5501
|
-
const [
|
|
5502
|
-
if (!
|
|
5501
|
+
const [row2] = await orm.select().from(items).where(eq5(items.id, id));
|
|
5502
|
+
if (!row2) return void 0;
|
|
5503
5503
|
const rel = await loadRelations(orm, [id], {
|
|
5504
5504
|
includeUsage: true,
|
|
5505
5505
|
includeGitRefs: true
|
|
5506
5506
|
});
|
|
5507
|
-
return rowToItem(
|
|
5507
|
+
return rowToItem(row2, rel);
|
|
5508
5508
|
}
|
|
5509
5509
|
|
|
5510
5510
|
// src/commands/backlog/saveAllItems.ts
|
|
@@ -5564,8 +5564,8 @@ async function updateCurrentPhase(orm, id, phase) {
|
|
|
5564
5564
|
// src/commands/backlog/updateStatus.ts
|
|
5565
5565
|
import { eq as eq10 } from "drizzle-orm";
|
|
5566
5566
|
async function updateStatus(orm, id, status2) {
|
|
5567
|
-
const [
|
|
5568
|
-
return
|
|
5567
|
+
const [row2] = await orm.update(items).set({ status: status2 }).where(eq10(items.id, id)).returning({ name: items.name });
|
|
5568
|
+
return row2?.name;
|
|
5569
5569
|
}
|
|
5570
5570
|
|
|
5571
5571
|
// src/commands/backlog/shared.ts
|
|
@@ -6096,9 +6096,9 @@ import chalk43 from "chalk";
|
|
|
6096
6096
|
// src/commands/backlog/deleteComment.ts
|
|
6097
6097
|
import { and as and4, eq as eq14 } from "drizzle-orm";
|
|
6098
6098
|
async function deleteComment(orm, itemId2, commentId) {
|
|
6099
|
-
const [
|
|
6100
|
-
if (!
|
|
6101
|
-
if (
|
|
6099
|
+
const [row2] = await orm.select({ type: comments.type }).from(comments).where(and4(eq14(comments.id, commentId), eq14(comments.itemId, itemId2)));
|
|
6100
|
+
if (!row2) return "not-found";
|
|
6101
|
+
if (row2.type === "summary") return "is-summary";
|
|
6102
6102
|
await orm.delete(comments).where(and4(eq14(comments.id, commentId), eq14(comments.itemId, itemId2)));
|
|
6103
6103
|
return "deleted";
|
|
6104
6104
|
}
|
|
@@ -6279,10 +6279,10 @@ var IDENTITY_SQL = `
|
|
|
6279
6279
|
`;
|
|
6280
6280
|
async function introspectIdentityColumns(client) {
|
|
6281
6281
|
const { rows } = await client.query(IDENTITY_SQL);
|
|
6282
|
-
return rows.map((
|
|
6283
|
-
table:
|
|
6284
|
-
column:
|
|
6285
|
-
rawColumn:
|
|
6282
|
+
return rows.map((row2) => ({
|
|
6283
|
+
table: row2.table,
|
|
6284
|
+
column: row2.column,
|
|
6285
|
+
rawColumn: row2.raw_column
|
|
6286
6286
|
}));
|
|
6287
6287
|
}
|
|
6288
6288
|
function resyncIdentitySql(col) {
|
|
@@ -6558,8 +6558,8 @@ import chalk49 from "chalk";
|
|
|
6558
6558
|
import chalk48 from "chalk";
|
|
6559
6559
|
import { count, eq as eq17 } from "drizzle-orm";
|
|
6560
6560
|
async function resolveInsertPosition(orm, itemId2, position) {
|
|
6561
|
-
const [
|
|
6562
|
-
const phaseCount =
|
|
6561
|
+
const [row2] = await orm.select({ cnt: count() }).from(planPhases).where(eq17(planPhases.itemId, itemId2));
|
|
6562
|
+
const phaseCount = row2?.cnt ?? 0;
|
|
6563
6563
|
if (position === void 0) return phaseCount;
|
|
6564
6564
|
const pos = Number.parseInt(position, 10);
|
|
6565
6565
|
if (pos < 1 || pos > phaseCount + 1) {
|
|
@@ -7341,10 +7341,10 @@ function gitInvocation(cwd, args) {
|
|
|
7341
7341
|
}
|
|
7342
7342
|
function git(cwd, args) {
|
|
7343
7343
|
const { file, argv, options: options2 } = gitInvocation(cwd, args);
|
|
7344
|
-
return new Promise((
|
|
7344
|
+
return new Promise((resolve29, reject) => {
|
|
7345
7345
|
execFile(file, argv, options2, (error, stdout) => {
|
|
7346
7346
|
if (error) reject(error);
|
|
7347
|
-
else
|
|
7347
|
+
else resolve29(stdout.toString());
|
|
7348
7348
|
});
|
|
7349
7349
|
});
|
|
7350
7350
|
}
|
|
@@ -7625,8 +7625,8 @@ function spawnInherit(command, args, options2 = {}) {
|
|
|
7625
7625
|
env: { ...env, ...options2.env },
|
|
7626
7626
|
cwd: options2.cwd
|
|
7627
7627
|
});
|
|
7628
|
-
const done2 = new Promise((
|
|
7629
|
-
child.on("close", (code) =>
|
|
7628
|
+
const done2 = new Promise((resolve29, reject) => {
|
|
7629
|
+
child.on("close", (code) => resolve29(code ?? 0));
|
|
7630
7630
|
child.on("error", reject);
|
|
7631
7631
|
});
|
|
7632
7632
|
return { child, done: done2 };
|
|
@@ -8058,7 +8058,7 @@ Failed to launch Claude for ${context}: ${message3}`)
|
|
|
8058
8058
|
// src/commands/sessions/daemon/sendToDaemon.ts
|
|
8059
8059
|
var WRITE_TIMEOUT_MS = 500;
|
|
8060
8060
|
function sendToDaemon(message3) {
|
|
8061
|
-
return new Promise((
|
|
8061
|
+
return new Promise((resolve29, reject) => {
|
|
8062
8062
|
connectToDaemon().then((socket) => {
|
|
8063
8063
|
const timer = setTimeout(() => {
|
|
8064
8064
|
socket.destroy();
|
|
@@ -8072,7 +8072,7 @@ function sendToDaemon(message3) {
|
|
|
8072
8072
|
`, () => {
|
|
8073
8073
|
clearTimeout(timer);
|
|
8074
8074
|
socket.end();
|
|
8075
|
-
|
|
8075
|
+
resolve29();
|
|
8076
8076
|
});
|
|
8077
8077
|
}, reject);
|
|
8078
8078
|
});
|
|
@@ -8081,7 +8081,7 @@ function sendToDaemon(message3) {
|
|
|
8081
8081
|
// src/commands/sessions/daemon/sendToDaemonAwaitAck.ts
|
|
8082
8082
|
var ACK_TIMEOUT_MS = 1e3;
|
|
8083
8083
|
function sendToDaemonAwaitAck(message3) {
|
|
8084
|
-
return new Promise((
|
|
8084
|
+
return new Promise((resolve29, reject) => {
|
|
8085
8085
|
connectToDaemon().then((socket) => {
|
|
8086
8086
|
let settled = false;
|
|
8087
8087
|
const finish2 = (error) => {
|
|
@@ -8090,7 +8090,7 @@ function sendToDaemonAwaitAck(message3) {
|
|
|
8090
8090
|
clearTimeout(timer);
|
|
8091
8091
|
socket.destroy();
|
|
8092
8092
|
if (error) reject(error);
|
|
8093
|
-
else
|
|
8093
|
+
else resolve29();
|
|
8094
8094
|
};
|
|
8095
8095
|
const timer = setTimeout(
|
|
8096
8096
|
() => finish2(new Error("timed out awaiting daemon ack")),
|
|
@@ -8181,7 +8181,7 @@ async function deliverReliably(sessionId, status2, payload) {
|
|
|
8181
8181
|
}
|
|
8182
8182
|
}
|
|
8183
8183
|
function sleep(ms) {
|
|
8184
|
-
return new Promise((
|
|
8184
|
+
return new Promise((resolve29) => setTimeout(resolve29, ms));
|
|
8185
8185
|
}
|
|
8186
8186
|
function describeError(error) {
|
|
8187
8187
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -9487,24 +9487,24 @@ function phaseUsageTotals(orm) {
|
|
|
9487
9487
|
}
|
|
9488
9488
|
|
|
9489
9489
|
// src/commands/backlog/rowToItemSummary.ts
|
|
9490
|
-
function rowToItemSummary(
|
|
9490
|
+
function rowToItemSummary(row2) {
|
|
9491
9491
|
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(
|
|
9492
|
+
id: row2.id,
|
|
9493
|
+
origin: row2.origin,
|
|
9494
|
+
type: row2.type,
|
|
9495
|
+
name: row2.name,
|
|
9496
|
+
status: row2.status,
|
|
9497
|
+
starred: row2.starred,
|
|
9498
|
+
jiraKey: row2.jiraKey ?? void 0,
|
|
9499
|
+
githubIssue: row2.githubIssue ?? void 0,
|
|
9500
|
+
currentPhase: row2.currentPhase ?? void 0,
|
|
9501
|
+
totalPhases: (row2.planPhaseCount || 1) + 1,
|
|
9502
|
+
incompleteSubtasks: row2.incompleteSubtasks ?? 0,
|
|
9503
|
+
usageTotal: row2.tokensUp == null ? void 0 : {
|
|
9504
|
+
tokensUp: Number(row2.tokensUp),
|
|
9505
|
+
tokensDown: Number(row2.tokensDown),
|
|
9506
|
+
activeMs: Number(row2.activeMs),
|
|
9507
|
+
peakContextPct: Number(row2.peakContextPct ?? 0)
|
|
9508
9508
|
}
|
|
9509
9509
|
};
|
|
9510
9510
|
}
|
|
@@ -9894,8 +9894,8 @@ import chalk84 from "chalk";
|
|
|
9894
9894
|
// src/commands/backlog/updateStarred.ts
|
|
9895
9895
|
import { eq as eq24 } from "drizzle-orm";
|
|
9896
9896
|
async function updateStarred(orm, id, starred) {
|
|
9897
|
-
const [
|
|
9898
|
-
return
|
|
9897
|
+
const [row2] = await orm.update(items).set({ starred }).where(eq24(items.id, id)).returning({ name: items.name });
|
|
9898
|
+
return row2?.name;
|
|
9899
9899
|
}
|
|
9900
9900
|
|
|
9901
9901
|
// src/commands/backlog/setStarred.ts
|
|
@@ -10057,8 +10057,8 @@ async function updateSubtask(orm, itemId2, idx, fields) {
|
|
|
10057
10057
|
if (fields.title !== void 0) set.title = fields.title;
|
|
10058
10058
|
if (fields.description !== void 0) set.description = fields.description;
|
|
10059
10059
|
if (fields.status !== void 0) set.status = fields.status;
|
|
10060
|
-
const [
|
|
10061
|
-
return
|
|
10060
|
+
const [row2] = await orm.update(itemSubtasks).set(set).where(and9(eq26(itemSubtasks.itemId, itemId2), eq26(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
|
|
10061
|
+
return row2?.title;
|
|
10062
10062
|
}
|
|
10063
10063
|
|
|
10064
10064
|
// src/commands/backlog/validSubtaskStatuses.ts
|
|
@@ -10114,8 +10114,8 @@ import chalk93 from "chalk";
|
|
|
10114
10114
|
// src/commands/backlog/deleteSubtask.ts
|
|
10115
10115
|
import { and as and10, asc as asc6, eq as eq27 } from "drizzle-orm";
|
|
10116
10116
|
async function deleteSubtask(orm, itemId2, idx) {
|
|
10117
|
-
const [
|
|
10118
|
-
if (!
|
|
10117
|
+
const [row2] = await orm.delete(itemSubtasks).where(and10(eq27(itemSubtasks.itemId, itemId2), eq27(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
|
|
10118
|
+
if (!row2) return void 0;
|
|
10119
10119
|
const remaining = await orm.select({ idx: itemSubtasks.idx }).from(itemSubtasks).where(eq27(itemSubtasks.itemId, itemId2)).orderBy(asc6(itemSubtasks.idx));
|
|
10120
10120
|
for (let i = 0; i < remaining.length; i++) {
|
|
10121
10121
|
const oldIdx = remaining[i].idx;
|
|
@@ -10124,7 +10124,7 @@ async function deleteSubtask(orm, itemId2, idx) {
|
|
|
10124
10124
|
and10(eq27(itemSubtasks.itemId, itemId2), eq27(itemSubtasks.idx, oldIdx))
|
|
10125
10125
|
);
|
|
10126
10126
|
}
|
|
10127
|
-
return
|
|
10127
|
+
return row2.title;
|
|
10128
10128
|
}
|
|
10129
10129
|
|
|
10130
10130
|
// src/commands/backlog/removeSubtask.ts
|
|
@@ -10146,8 +10146,8 @@ import chalk94 from "chalk";
|
|
|
10146
10146
|
// src/commands/backlog/updateSubtaskStatus.ts
|
|
10147
10147
|
import { and as and11, eq as eq28 } from "drizzle-orm";
|
|
10148
10148
|
async function updateSubtaskStatus(orm, itemId2, idx, status2) {
|
|
10149
|
-
const [
|
|
10150
|
-
return
|
|
10149
|
+
const [row2] = await orm.update(itemSubtasks).set({ status: status2 }).where(and11(eq28(itemSubtasks.itemId, itemId2), eq28(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
|
|
10150
|
+
return row2?.title;
|
|
10151
10151
|
}
|
|
10152
10152
|
|
|
10153
10153
|
// src/commands/backlog/subtaskStatus.ts
|
|
@@ -10224,8 +10224,8 @@ async function adjustCurrentPhase(db, item, removedIdx) {
|
|
|
10224
10224
|
return;
|
|
10225
10225
|
}
|
|
10226
10226
|
if (removedIdx !== currentIdx) return;
|
|
10227
|
-
const [
|
|
10228
|
-
const cnt =
|
|
10227
|
+
const [row2] = await db.select({ cnt: count3() }).from(planPhases).where(eq29(planPhases.itemId, item.id));
|
|
10228
|
+
const cnt = row2?.cnt ?? 0;
|
|
10229
10229
|
await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(eq29(items.id, item.id));
|
|
10230
10230
|
}
|
|
10231
10231
|
|
|
@@ -10278,8 +10278,8 @@ async function movePhase(id, from, to) {
|
|
|
10278
10278
|
if (!found) return;
|
|
10279
10279
|
const { orm, item } = found;
|
|
10280
10280
|
const itemId2 = item.id;
|
|
10281
|
-
const [
|
|
10282
|
-
const phaseCount =
|
|
10281
|
+
const [row2] = await orm.select({ cnt: count4() }).from(planPhases).where(eq31(planPhases.itemId, itemId2));
|
|
10282
|
+
const phaseCount = row2?.cnt ?? 0;
|
|
10283
10283
|
const fromIdx = toIndex(from, phaseCount);
|
|
10284
10284
|
if (fromIdx === void 0) return;
|
|
10285
10285
|
const toIdx = toIndex(to, phaseCount);
|
|
@@ -10334,8 +10334,8 @@ async function findPhase(id, phase) {
|
|
|
10334
10334
|
const { orm, item } = found;
|
|
10335
10335
|
const itemId2 = item.id;
|
|
10336
10336
|
const phaseIdx = Number.parseInt(phase, 10) - 1;
|
|
10337
|
-
const [
|
|
10338
|
-
if (!
|
|
10337
|
+
const [row2] = await orm.select({ cnt: count5() }).from(planPhases).where(and15(eq33(planPhases.itemId, itemId2), eq33(planPhases.idx, phaseIdx)));
|
|
10338
|
+
if (!row2 || row2.cnt === 0) {
|
|
10339
10339
|
console.log(
|
|
10340
10340
|
chalk96.red(
|
|
10341
10341
|
`Phase ${phaseIdx + 1} not found on item ${formatItemId(itemId2)}.`
|
|
@@ -11186,7 +11186,7 @@ function spawnDaemon(reason4) {
|
|
|
11186
11186
|
child.unref();
|
|
11187
11187
|
}
|
|
11188
11188
|
function delay(ms) {
|
|
11189
|
-
return new Promise((
|
|
11189
|
+
return new Promise((resolve29) => setTimeout(resolve29, ms));
|
|
11190
11190
|
}
|
|
11191
11191
|
|
|
11192
11192
|
// src/commands/sessions/nodes/tailscaleStatus.ts
|
|
@@ -11292,7 +11292,7 @@ var defaultDeps = {
|
|
|
11292
11292
|
serve: async (args) => {
|
|
11293
11293
|
await runTailscale(args);
|
|
11294
11294
|
},
|
|
11295
|
-
sleep: (ms) => new Promise((
|
|
11295
|
+
sleep: (ms) => new Promise((resolve29) => setTimeout(resolve29, ms)),
|
|
11296
11296
|
httpsPort: tailnetHttpsPort
|
|
11297
11297
|
};
|
|
11298
11298
|
async function ensureTailscaleServe(port, deps2 = {}) {
|
|
@@ -11699,12 +11699,12 @@ async function loadVisibleItems(req) {
|
|
|
11699
11699
|
|
|
11700
11700
|
// src/commands/backlog/web/parseStatusBody.ts
|
|
11701
11701
|
function readBody(req) {
|
|
11702
|
-
return new Promise((
|
|
11702
|
+
return new Promise((resolve29, reject) => {
|
|
11703
11703
|
let body = "";
|
|
11704
11704
|
req.on("data", (chunk) => {
|
|
11705
11705
|
body += chunk.toString();
|
|
11706
11706
|
});
|
|
11707
|
-
req.on("end", () =>
|
|
11707
|
+
req.on("end", () => resolve29(body));
|
|
11708
11708
|
req.on("error", reject);
|
|
11709
11709
|
});
|
|
11710
11710
|
}
|
|
@@ -12046,10 +12046,10 @@ async function listCommitRefs(db, itemId2) {
|
|
|
12046
12046
|
title: itemGitRefs.title,
|
|
12047
12047
|
url: itemGitRefs.url
|
|
12048
12048
|
}).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
|
-
...
|
|
12049
|
+
return rows.map((row2) => ({
|
|
12050
|
+
sha: row2.ref,
|
|
12051
|
+
...row2.title ? { title: row2.title } : {},
|
|
12052
|
+
...row2.url ? { url: row2.url } : {}
|
|
12053
12053
|
}));
|
|
12054
12054
|
}
|
|
12055
12055
|
|
|
@@ -13875,11 +13875,11 @@ async function requestDaemonReply(request, replyType) {
|
|
|
13875
13875
|
} catch {
|
|
13876
13876
|
return void 0;
|
|
13877
13877
|
}
|
|
13878
|
-
return new Promise((
|
|
13878
|
+
return new Promise((resolve29) => {
|
|
13879
13879
|
const finish2 = (result) => {
|
|
13880
13880
|
clearTimeout(timer);
|
|
13881
13881
|
socket.destroy();
|
|
13882
|
-
|
|
13882
|
+
resolve29(result);
|
|
13883
13883
|
};
|
|
13884
13884
|
const timer = setTimeout(() => finish2(void 0), QUERY_TIMEOUT_MS);
|
|
13885
13885
|
const lines2 = createInterface5({ input: socket });
|
|
@@ -13972,8 +13972,8 @@ function subsequenceScore(text18, query) {
|
|
|
13972
13972
|
function scoreFilePath(path106, query) {
|
|
13973
13973
|
const needle = query.trim().toLowerCase();
|
|
13974
13974
|
if (!needle) return 0;
|
|
13975
|
-
const
|
|
13976
|
-
const inBasename = subsequenceScore(
|
|
13975
|
+
const basename35 = path106.slice(path106.lastIndexOf("/") + 1);
|
|
13976
|
+
const inBasename = subsequenceScore(basename35, needle);
|
|
13977
13977
|
if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
|
|
13978
13978
|
return subsequenceScore(path106, needle);
|
|
13979
13979
|
}
|
|
@@ -15038,8 +15038,8 @@ function listScopedRules(req, res) {
|
|
|
15038
15038
|
// src/shared/db/countUsagePeaks.ts
|
|
15039
15039
|
import { count as count6, eq as eq39 } from "drizzle-orm";
|
|
15040
15040
|
async function countUsagePeaks(db, window) {
|
|
15041
|
-
const [
|
|
15042
|
-
return
|
|
15041
|
+
const [row2] = await db.select({ value: count6() }).from(usagePeaks).where(window ? eq39(usagePeaks.window, window) : void 0);
|
|
15042
|
+
return row2?.value ?? 0;
|
|
15043
15043
|
}
|
|
15044
15044
|
|
|
15045
15045
|
// src/shared/db/listUsagePeaks.ts
|
|
@@ -15131,7 +15131,7 @@ import { asc as asc11, desc as desc4, eq as eq41, sql as sql19 } from "drizzle-o
|
|
|
15131
15131
|
async function countItemUsageByOrigin(db) {
|
|
15132
15132
|
const count8 = sql19`count(distinct ${phaseUsage.itemId})::int`;
|
|
15133
15133
|
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((
|
|
15134
|
+
return rows.map((row2) => ({ origin: row2.origin, count: Number(row2.count) }));
|
|
15135
15135
|
}
|
|
15136
15136
|
|
|
15137
15137
|
// src/shared/db/itemUsageWhere.ts
|
|
@@ -15178,7 +15178,7 @@ function median(value) {
|
|
|
15178
15178
|
async function itemUsageStats(db, options2) {
|
|
15179
15179
|
const totals = phaseUsageTotals(db);
|
|
15180
15180
|
const planned = planPhaseCounts(db);
|
|
15181
|
-
const [
|
|
15181
|
+
const [row2] = await db.select({
|
|
15182
15182
|
itemCount: sql20`count(*)::int`,
|
|
15183
15183
|
doneCount: sql20`count(*) filter (where ${items.status} = 'done')::int`,
|
|
15184
15184
|
repoCount: sql20`count(distinct ${items.origin})::int`,
|
|
@@ -15189,12 +15189,12 @@ async function itemUsageStats(db, options2) {
|
|
|
15189
15189
|
medianTokens: median(sql20`${totals.tokensUp} + ${totals.tokensDown}`)
|
|
15190
15190
|
}).from(items).innerJoin(totals, eq43(totals.itemId, items.id)).leftJoin(planned, eq43(planned.itemId, items.id)).where(itemUsageWhere(options2));
|
|
15191
15191
|
return {
|
|
15192
|
-
itemCount: Number(
|
|
15193
|
-
doneCount: Number(
|
|
15194
|
-
repoCount: Number(
|
|
15195
|
-
medianPhases: Number(
|
|
15196
|
-
medianActiveMs: Number(
|
|
15197
|
-
medianTokens: Number(
|
|
15192
|
+
itemCount: Number(row2?.itemCount ?? 0),
|
|
15193
|
+
doneCount: Number(row2?.doneCount ?? 0),
|
|
15194
|
+
repoCount: Number(row2?.repoCount ?? 0),
|
|
15195
|
+
medianPhases: Number(row2?.medianPhases ?? 0),
|
|
15196
|
+
medianActiveMs: Number(row2?.medianActiveMs ?? 0),
|
|
15197
|
+
medianTokens: Number(row2?.medianTokens ?? 0)
|
|
15198
15198
|
};
|
|
15199
15199
|
}
|
|
15200
15200
|
|
|
@@ -15229,16 +15229,16 @@ function lastPhaseActivity(db) {
|
|
|
15229
15229
|
}
|
|
15230
15230
|
|
|
15231
15231
|
// src/shared/db/toItemUsageSummary.ts
|
|
15232
|
-
function toItemUsageSummary(
|
|
15232
|
+
function toItemUsageSummary(row2) {
|
|
15233
15233
|
return {
|
|
15234
|
-
...
|
|
15235
|
-
phaseCount:
|
|
15236
|
-
recordedPhases: Number(
|
|
15237
|
-
tokensUp: Number(
|
|
15238
|
-
tokensDown: Number(
|
|
15239
|
-
activeMs: Number(
|
|
15240
|
-
peakContextPct: Number(
|
|
15241
|
-
lastPhaseAt:
|
|
15234
|
+
...row2,
|
|
15235
|
+
phaseCount: row2.phaseCount ?? 0,
|
|
15236
|
+
recordedPhases: Number(row2.recordedPhases),
|
|
15237
|
+
tokensUp: Number(row2.tokensUp),
|
|
15238
|
+
tokensDown: Number(row2.tokensDown),
|
|
15239
|
+
activeMs: Number(row2.activeMs),
|
|
15240
|
+
peakContextPct: Number(row2.peakContextPct),
|
|
15241
|
+
lastPhaseAt: row2.lastPhaseAt ?? null
|
|
15242
15242
|
};
|
|
15243
15243
|
}
|
|
15244
15244
|
|
|
@@ -15429,7 +15429,7 @@ function forwardToPeer(req, res, node, url) {
|
|
|
15429
15429
|
const label2 = `link ${node} http: ${req.method} ${url.pathname} trace=${traceId}`;
|
|
15430
15430
|
const log2 = (outcome) => console.log(`${label2} -> ${outcome} (${Date.now() - started}ms)`);
|
|
15431
15431
|
const send = url.protocol === "https:" ? httpsRequest : httpRequest;
|
|
15432
|
-
return new Promise((
|
|
15432
|
+
return new Promise((resolve29) => {
|
|
15433
15433
|
const upstream = send(
|
|
15434
15434
|
url,
|
|
15435
15435
|
{
|
|
@@ -15441,7 +15441,7 @@ function forwardToPeer(req, res, node, url) {
|
|
|
15441
15441
|
[TRACE_HEADER]: traceId
|
|
15442
15442
|
}
|
|
15443
15443
|
},
|
|
15444
|
-
(peer) => relayPeerResponse(peer, res, url.pathname, log2,
|
|
15444
|
+
(peer) => relayPeerResponse(peer, res, url.pathname, log2, resolve29)
|
|
15445
15445
|
);
|
|
15446
15446
|
boundUpstream(upstream, res, peerTimeoutFor(url.pathname));
|
|
15447
15447
|
upstream.on("error", (error) => {
|
|
@@ -15451,7 +15451,7 @@ function forwardToPeer(req, res, node, url) {
|
|
|
15451
15451
|
respondJson(res, 502, {
|
|
15452
15452
|
error: `${node} unreachable: ${error.message}`
|
|
15453
15453
|
});
|
|
15454
|
-
|
|
15454
|
+
resolve29();
|
|
15455
15455
|
});
|
|
15456
15456
|
req.pipe(upstream);
|
|
15457
15457
|
});
|
|
@@ -16034,17 +16034,17 @@ async function stopDaemon() {
|
|
|
16034
16034
|
}
|
|
16035
16035
|
}
|
|
16036
16036
|
function closedBeforeTimeout(socket) {
|
|
16037
|
-
return new Promise((
|
|
16037
|
+
return new Promise((resolve29) => {
|
|
16038
16038
|
const timer = setTimeout(() => {
|
|
16039
16039
|
socket.destroy();
|
|
16040
|
-
|
|
16040
|
+
resolve29(false);
|
|
16041
16041
|
}, STOP_TIMEOUT_MS);
|
|
16042
16042
|
socket.resume();
|
|
16043
16043
|
socket.on("error", () => {
|
|
16044
16044
|
});
|
|
16045
16045
|
socket.once("close", () => {
|
|
16046
16046
|
clearTimeout(timer);
|
|
16047
|
-
|
|
16047
|
+
resolve29(true);
|
|
16048
16048
|
});
|
|
16049
16049
|
});
|
|
16050
16050
|
}
|
|
@@ -16107,8 +16107,8 @@ async function restartWeb(req, res, deps2 = {}) {
|
|
|
16107
16107
|
return;
|
|
16108
16108
|
}
|
|
16109
16109
|
console.log(`restart ${target} ${linkedRequester(req)}`);
|
|
16110
|
-
await new Promise((
|
|
16111
|
-
res.once("finish",
|
|
16110
|
+
await new Promise((resolve29) => {
|
|
16111
|
+
res.once("finish", resolve29);
|
|
16112
16112
|
respondJson(res, 200, { ok: true });
|
|
16113
16113
|
});
|
|
16114
16114
|
try {
|
|
@@ -16252,8 +16252,8 @@ async function selfUpdate(req, res, deps2 = {}) {
|
|
|
16252
16252
|
return;
|
|
16253
16253
|
}
|
|
16254
16254
|
console.log("self-update: updated; restarting daemon and web server");
|
|
16255
|
-
await new Promise((
|
|
16256
|
-
res.once("finish",
|
|
16255
|
+
await new Promise((resolve29) => {
|
|
16256
|
+
res.once("finish", resolve29);
|
|
16257
16257
|
respondJson(res, 200, { ok: true });
|
|
16258
16258
|
});
|
|
16259
16259
|
await performRestart("both", restartDeps);
|
|
@@ -16354,14 +16354,14 @@ function linkWebSocketUrl(url) {
|
|
|
16354
16354
|
return target.toString();
|
|
16355
16355
|
}
|
|
16356
16356
|
function connectLinkWebSocket(url, handlers) {
|
|
16357
|
-
return new Promise((
|
|
16357
|
+
return new Promise((resolve29, reject) => {
|
|
16358
16358
|
const ws = new WebSocket(linkWebSocketUrl(url), {
|
|
16359
16359
|
handshakeTimeout: HANDSHAKE_TIMEOUT_MS
|
|
16360
16360
|
});
|
|
16361
16361
|
let open = false;
|
|
16362
16362
|
ws.on("open", () => {
|
|
16363
16363
|
open = true;
|
|
16364
|
-
|
|
16364
|
+
resolve29({
|
|
16365
16365
|
send: (line) => {
|
|
16366
16366
|
if (ws.readyState !== WebSocket.OPEN) return false;
|
|
16367
16367
|
ws.send(line);
|
|
@@ -16387,8 +16387,8 @@ var HELLO_TIMEOUT_MS = 5e3;
|
|
|
16387
16387
|
async function probePeerHello(url) {
|
|
16388
16388
|
let settle = () => {
|
|
16389
16389
|
};
|
|
16390
|
-
const reply2 = new Promise((
|
|
16391
|
-
settle =
|
|
16390
|
+
const reply2 = new Promise((resolve29) => {
|
|
16391
|
+
settle = resolve29;
|
|
16392
16392
|
});
|
|
16393
16393
|
const socket = await connectLinkWebSocket(url, {
|
|
16394
16394
|
onLine: (line) => {
|
|
@@ -16994,7 +16994,7 @@ function globalOnlyRepoKeyError(key, verb) {
|
|
|
16994
16994
|
// src/shared/db/listRepoConfigs.ts
|
|
16995
16995
|
async function listRepoConfigs(orm) {
|
|
16996
16996
|
const rows = await orm.select().from(repoConfigs);
|
|
16997
|
-
return Object.fromEntries(rows.map((
|
|
16997
|
+
return Object.fromEntries(rows.map((row2) => [row2.repoKey, row2.config]));
|
|
16998
16998
|
}
|
|
16999
16999
|
|
|
17000
17000
|
// src/shared/resolveNamedRepoWriteLabel.ts
|
|
@@ -17553,6 +17553,14 @@ async function readRequestBuffer(req, limit) {
|
|
|
17553
17553
|
// src/commands/sessions/web/stageAttachment.ts
|
|
17554
17554
|
import { mkdir as mkdir4, mkdtemp, writeFile as writeFile2 } from "fs/promises";
|
|
17555
17555
|
import { extname as extname2, join as join44 } from "path";
|
|
17556
|
+
|
|
17557
|
+
// src/commands/sessions/web/ghAttachableExtensions.ts
|
|
17558
|
+
var ghAttachableExtensions = /* @__PURE__ */ new Set([
|
|
17559
|
+
...Object.values(attachmentMimeTypes),
|
|
17560
|
+
"jpeg"
|
|
17561
|
+
]);
|
|
17562
|
+
|
|
17563
|
+
// src/commands/sessions/web/stageAttachment.ts
|
|
17556
17564
|
function extensionFromMime(contentType) {
|
|
17557
17565
|
const mime = contentType.split(";")[0].trim().toLowerCase();
|
|
17558
17566
|
const known = attachmentMimeTypes[mime];
|
|
@@ -17560,10 +17568,6 @@ function extensionFromMime(contentType) {
|
|
|
17560
17568
|
const subtype = mime.split("/")[1]?.replace(/^x-/, "").replace(/\+.*$/, "");
|
|
17561
17569
|
return subtype && /^[a-z0-9]+$/.test(subtype) ? subtype : void 0;
|
|
17562
17570
|
}
|
|
17563
|
-
var ghAttachableExtensions = /* @__PURE__ */ new Set([
|
|
17564
|
-
...Object.values(attachmentMimeTypes),
|
|
17565
|
-
"jpeg"
|
|
17566
|
-
]);
|
|
17567
17571
|
function pickExtension(name, contentType) {
|
|
17568
17572
|
const fromName = extname2(name).replace(/^\./, "").toLowerCase();
|
|
17569
17573
|
const ext = /^[a-z0-9]+$/.test(fromName) ? fromName : extensionFromMime(contentType) ?? "png";
|
|
@@ -19796,12 +19800,12 @@ function hasSubcommands(helpText) {
|
|
|
19796
19800
|
// src/commands/permitCliReads/runHelp.ts
|
|
19797
19801
|
import { exec as exec2 } from "child_process";
|
|
19798
19802
|
function runHelp(args) {
|
|
19799
|
-
return new Promise((
|
|
19803
|
+
return new Promise((resolve29) => {
|
|
19800
19804
|
exec2(
|
|
19801
19805
|
`${args.join(" ")} --help`,
|
|
19802
19806
|
{ encoding: "utf8", timeout: 3e4 },
|
|
19803
19807
|
(_err, stdout, stderr) => {
|
|
19804
|
-
|
|
19808
|
+
resolve29(stdout || stderr || "");
|
|
19805
19809
|
}
|
|
19806
19810
|
);
|
|
19807
19811
|
});
|
|
@@ -22194,8 +22198,8 @@ async function findRetiredTables(exec3) {
|
|
|
22194
22198
|
[RETIRED_TABLES]
|
|
22195
22199
|
);
|
|
22196
22200
|
const found = [];
|
|
22197
|
-
for (const
|
|
22198
|
-
const name = String(
|
|
22201
|
+
for (const row2 of present) {
|
|
22202
|
+
const name = String(row2.table_name);
|
|
22199
22203
|
const [count8] = await exec3.query(
|
|
22200
22204
|
`SELECT count(*)::int AS rows FROM "${name}"`
|
|
22201
22205
|
);
|
|
@@ -22843,9 +22847,9 @@ function colorStatus(status2) {
|
|
|
22843
22847
|
if (status2 === "outdated") return chalk154.yellow(status2);
|
|
22844
22848
|
return chalk154.green(status2);
|
|
22845
22849
|
}
|
|
22846
|
-
function formatRow(
|
|
22847
|
-
const devlog = (
|
|
22848
|
-
return `${
|
|
22850
|
+
function formatRow(row2, nameWidth) {
|
|
22851
|
+
const devlog = (row2.lastDevlog ?? "-").padEnd(11);
|
|
22852
|
+
return `${row2.name.padEnd(nameWidth)} ${row2.lastPush} ${devlog} ${colorStatus(row2.status)}`;
|
|
22849
22853
|
}
|
|
22850
22854
|
function printReposTable(rows) {
|
|
22851
22855
|
const nameWidth = Math.max(4, ...rows.map((r) => r.name.length));
|
|
@@ -22857,8 +22861,8 @@ function printReposTable(rows) {
|
|
|
22857
22861
|
].join(" ");
|
|
22858
22862
|
console.log(chalk154.dim(header));
|
|
22859
22863
|
console.log(chalk154.dim("-".repeat(header.length)));
|
|
22860
|
-
for (const
|
|
22861
|
-
console.log(formatRow(
|
|
22864
|
+
for (const row2 of rows) {
|
|
22865
|
+
console.log(formatRow(row2, nameWidth));
|
|
22862
22866
|
}
|
|
22863
22867
|
}
|
|
22864
22868
|
|
|
@@ -24440,13 +24444,13 @@ import chalk167 from "chalk";
|
|
|
24440
24444
|
function printCountTable(labelHeader, rows) {
|
|
24441
24445
|
const labelWidth = Math.max(
|
|
24442
24446
|
labelHeader.length,
|
|
24443
|
-
...rows.map((
|
|
24447
|
+
...rows.map((row2) => row2.label.length)
|
|
24444
24448
|
);
|
|
24445
24449
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
24446
24450
|
console.log(chalk167.dim(header));
|
|
24447
24451
|
console.log(chalk167.dim("-".repeat(header.length)));
|
|
24448
|
-
for (const
|
|
24449
|
-
console.log(`${
|
|
24452
|
+
for (const row2 of rows) {
|
|
24453
|
+
console.log(`${row2.label.padEnd(labelWidth)} ${row2.count}`);
|
|
24450
24454
|
}
|
|
24451
24455
|
}
|
|
24452
24456
|
|
|
@@ -25179,18 +25183,75 @@ function collectLabels(value, previous) {
|
|
|
25179
25183
|
return [...previous, ...added];
|
|
25180
25184
|
}
|
|
25181
25185
|
|
|
25182
|
-
// src/commands/prs/
|
|
25186
|
+
// src/commands/prs/renderScreenshotBlock.ts
|
|
25187
|
+
import { extname as extname3 } from "path";
|
|
25188
|
+
var VIDEO_EXTENSIONS = /* @__PURE__ */ new Set([".mp4", ".webm", ".mov"]);
|
|
25183
25189
|
function reference({ path: path106, alt }) {
|
|
25184
25190
|
const target = /\s/.test(path106) ? `<${path106}>` : path106;
|
|
25185
25191
|
return ``;
|
|
25186
25192
|
}
|
|
25193
|
+
function cell(text18) {
|
|
25194
|
+
return text18.replaceAll("|", String.raw`\|`);
|
|
25195
|
+
}
|
|
25196
|
+
function row(cells) {
|
|
25197
|
+
return `| ${cells.join(" | ")} |`;
|
|
25198
|
+
}
|
|
25199
|
+
function imageTable(images) {
|
|
25200
|
+
if (images.length === 0) return [];
|
|
25201
|
+
const lines2 = [];
|
|
25202
|
+
for (let i = 0; i < images.length; i += 2) {
|
|
25203
|
+
const pair = images.slice(i, i + 2);
|
|
25204
|
+
const captions = [0, 1].map((j) => pair[j] ? cell(pair[j].alt) : "");
|
|
25205
|
+
const refs = [0, 1].map((j) => pair[j] ? cell(reference(pair[j])) : "");
|
|
25206
|
+
if (i === 0) lines2.push(row(captions), row(["---", "---"]));
|
|
25207
|
+
else lines2.push(row(captions.map((c) => c ? `**${c}**` : "")));
|
|
25208
|
+
lines2.push(row(refs));
|
|
25209
|
+
}
|
|
25210
|
+
return [lines2.join("\n")];
|
|
25211
|
+
}
|
|
25212
|
+
function renderScreenshotBlock(attachments) {
|
|
25213
|
+
const isVideo = (a) => VIDEO_EXTENSIONS.has(extname3(a.path).toLowerCase());
|
|
25214
|
+
return [
|
|
25215
|
+
...imageTable(attachments.filter((a) => !isVideo(a))),
|
|
25216
|
+
...attachments.filter(isVideo).map(reference)
|
|
25217
|
+
];
|
|
25218
|
+
}
|
|
25219
|
+
|
|
25220
|
+
// src/commands/prs/renderScreenshotsSection.ts
|
|
25221
|
+
function renderScreenshotsSection(attachments) {
|
|
25222
|
+
const groups = /* @__PURE__ */ new Map();
|
|
25223
|
+
const ungrouped = [];
|
|
25224
|
+
for (const attachment of attachments) {
|
|
25225
|
+
if (!attachment.group) {
|
|
25226
|
+
ungrouped.push(attachment);
|
|
25227
|
+
continue;
|
|
25228
|
+
}
|
|
25229
|
+
const members = groups.get(attachment.group) ?? [];
|
|
25230
|
+
members.push(attachment);
|
|
25231
|
+
groups.set(attachment.group, members);
|
|
25232
|
+
}
|
|
25233
|
+
const blocks = [...groups].flatMap(([group, members]) => [
|
|
25234
|
+
`### ${group}`,
|
|
25235
|
+
...renderScreenshotBlock(members)
|
|
25236
|
+
]);
|
|
25237
|
+
return [
|
|
25238
|
+
"## Screenshots",
|
|
25239
|
+
...blocks,
|
|
25240
|
+
...renderScreenshotBlock(ungrouped)
|
|
25241
|
+
].join("\n\n");
|
|
25242
|
+
}
|
|
25243
|
+
|
|
25244
|
+
// src/commands/prs/appendScreenshots.ts
|
|
25245
|
+
function withoutScreenshotsSection(body) {
|
|
25246
|
+
return body.replace(/(^|\n)## Screenshots[ \t]*(?:\n[\s\S]*?)?(?=\n## |$)/, "").trimEnd();
|
|
25247
|
+
}
|
|
25187
25248
|
function appendScreenshots(body, attachments) {
|
|
25188
25249
|
if (attachments.length === 0) return body;
|
|
25189
|
-
|
|
25250
|
+
const base = withoutScreenshotsSection(body);
|
|
25251
|
+
const section2 = renderScreenshotsSection(attachments);
|
|
25252
|
+
return base ? `${base}
|
|
25190
25253
|
|
|
25191
|
-
|
|
25192
|
-
|
|
25193
|
-
${attachments.map(reference).join("\n\n")}`;
|
|
25254
|
+
${section2}` : section2;
|
|
25194
25255
|
}
|
|
25195
25256
|
|
|
25196
25257
|
// src/commands/github/issue/addIssueToProject.ts
|
|
@@ -26945,7 +27006,7 @@ function placedByDaemon() {
|
|
|
26945
27006
|
function seed(worktreePath, clone) {
|
|
26946
27007
|
console.log(`Preparing ${worktreePath}\u2026`);
|
|
26947
27008
|
return new Promise(
|
|
26948
|
-
(
|
|
27009
|
+
(resolve29) => seedWorktree(worktreePath, clone, resolve29)
|
|
26949
27010
|
);
|
|
26950
27011
|
}
|
|
26951
27012
|
async function moveToPrCheckoutTree() {
|
|
@@ -27246,7 +27307,7 @@ import chalk179 from "chalk";
|
|
|
27246
27307
|
|
|
27247
27308
|
// src/commands/mermaid/exportFile.ts
|
|
27248
27309
|
import { readFileSync as readFileSync40, writeFileSync as writeFileSync33 } from "fs";
|
|
27249
|
-
import { basename as basename21, extname as
|
|
27310
|
+
import { basename as basename21, extname as extname4, resolve as resolve18 } from "path";
|
|
27250
27311
|
import chalk178 from "chalk";
|
|
27251
27312
|
|
|
27252
27313
|
// src/commands/mermaid/renderBlock.ts
|
|
@@ -27273,7 +27334,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
27273
27334
|
async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
27274
27335
|
const content = readFileSync40(file, "utf8");
|
|
27275
27336
|
const blocks = extractMermaidBlocks(content);
|
|
27276
|
-
const stem = basename21(file,
|
|
27337
|
+
const stem = basename21(file, extname4(file));
|
|
27277
27338
|
if (onlyIndex !== void 0) {
|
|
27278
27339
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
27279
27340
|
console.error(
|
|
@@ -28134,25 +28195,25 @@ function isVisibleText(t) {
|
|
|
28134
28195
|
return /[a-zA-Z]{3,}/.test(t);
|
|
28135
28196
|
}
|
|
28136
28197
|
var isHashtag = (t) => /^#[A-Za-z0-9_]+$/.test(t);
|
|
28137
|
-
function collectRscText(v,
|
|
28198
|
+
function collectRscText(v, resolve29, sink3, seen) {
|
|
28138
28199
|
if (v == null) return;
|
|
28139
28200
|
if (typeof v === "string") {
|
|
28140
28201
|
if (isRscRef(v)) {
|
|
28141
28202
|
if (!seen.has(v)) {
|
|
28142
28203
|
seen.add(v);
|
|
28143
|
-
collectRscText(
|
|
28204
|
+
collectRscText(resolve29(v), resolve29, sink3, seen);
|
|
28144
28205
|
}
|
|
28145
28206
|
} else if (isHashtag(v)) sink3.hashtags.push(v);
|
|
28146
28207
|
else if (isVisibleText(v)) sink3.text.push(v);
|
|
28147
28208
|
return;
|
|
28148
28209
|
}
|
|
28149
28210
|
if (Array.isArray(v)) {
|
|
28150
|
-
for (const x of v) collectRscText(x,
|
|
28211
|
+
for (const x of v) collectRscText(x, resolve29, sink3, seen);
|
|
28151
28212
|
return;
|
|
28152
28213
|
}
|
|
28153
28214
|
if (typeof v === "object") {
|
|
28154
28215
|
for (const val of Object.values(v)) {
|
|
28155
|
-
collectRscText(val,
|
|
28216
|
+
collectRscText(val, resolve29, sink3, seen);
|
|
28156
28217
|
}
|
|
28157
28218
|
}
|
|
28158
28219
|
}
|
|
@@ -28184,7 +28245,7 @@ function visitObjects(root2, fn) {
|
|
|
28184
28245
|
}
|
|
28185
28246
|
}
|
|
28186
28247
|
}
|
|
28187
|
-
function buildMentionMap(rows,
|
|
28248
|
+
function buildMentionMap(rows, resolve29) {
|
|
28188
28249
|
const map = /* @__PURE__ */ new Map();
|
|
28189
28250
|
visitObjects(rows, (o) => {
|
|
28190
28251
|
const url = profileActionUrl(o);
|
|
@@ -28192,7 +28253,7 @@ function buildMentionMap(rows, resolve28) {
|
|
|
28192
28253
|
const slug2 = slugFromProfileUrl(url);
|
|
28193
28254
|
if (!slug2 || map.has(slug2)) return;
|
|
28194
28255
|
const sink3 = { text: [], hashtags: [] };
|
|
28195
|
-
collectRscText(o.children,
|
|
28256
|
+
collectRscText(o.children, resolve29, sink3, /* @__PURE__ */ new Set());
|
|
28196
28257
|
const name = sink3.text.join(" ").replace(/\s+/g, " ").trim();
|
|
28197
28258
|
map.set(slug2, name ? { slug: slug2, name, url } : { slug: slug2, url });
|
|
28198
28259
|
});
|
|
@@ -28278,10 +28339,10 @@ function buildPost(raw, mentionMap, author) {
|
|
|
28278
28339
|
|
|
28279
28340
|
// src/commands/netcap/walkPostRow.ts
|
|
28280
28341
|
var isCommentary = (o) => asObject(o.viewTrackingSpecs)?.viewName === "feed-commentary";
|
|
28281
|
-
function walkPostRow(v,
|
|
28342
|
+
function walkPostRow(v, resolve29, raw) {
|
|
28282
28343
|
if (v == null || typeof v !== "object") return;
|
|
28283
28344
|
if (Array.isArray(v)) {
|
|
28284
|
-
for (const x of v) walkPostRow(x,
|
|
28345
|
+
for (const x of v) walkPostRow(x, resolve29, raw);
|
|
28285
28346
|
return;
|
|
28286
28347
|
}
|
|
28287
28348
|
const o = v;
|
|
@@ -28295,9 +28356,9 @@ function walkPostRow(v, resolve28, raw) {
|
|
|
28295
28356
|
}
|
|
28296
28357
|
if (isCommentary(o)) {
|
|
28297
28358
|
const sink3 = { text: raw.text, hashtags: raw.hashtags };
|
|
28298
|
-
collectRscText(o.children,
|
|
28359
|
+
collectRscText(o.children, resolve29, sink3, /* @__PURE__ */ new Set());
|
|
28299
28360
|
}
|
|
28300
|
-
for (const val of Object.values(o)) walkPostRow(val,
|
|
28361
|
+
for (const val of Object.values(o)) walkPostRow(val, resolve29, raw);
|
|
28301
28362
|
}
|
|
28302
28363
|
|
|
28303
28364
|
// src/commands/netcap/extractLinkedInPosts.ts
|
|
@@ -28311,8 +28372,8 @@ function findCommentaryRows(rows) {
|
|
|
28311
28372
|
}
|
|
28312
28373
|
function extractLinkedInPosts(flight, author = findAuthorSlug(flight)) {
|
|
28313
28374
|
const rows = parseRscRows(flight);
|
|
28314
|
-
const
|
|
28315
|
-
const mentionMap = buildMentionMap(rows,
|
|
28375
|
+
const resolve29 = makeRscResolver(rows);
|
|
28376
|
+
const mentionMap = buildMentionMap(rows, resolve29);
|
|
28316
28377
|
const posts = [];
|
|
28317
28378
|
for (const id of findCommentaryRows(rows)) {
|
|
28318
28379
|
const raw = {
|
|
@@ -28322,7 +28383,7 @@ function extractLinkedInPosts(flight, author = findAuthorSlug(flight)) {
|
|
|
28322
28383
|
links: [],
|
|
28323
28384
|
related: []
|
|
28324
28385
|
};
|
|
28325
|
-
walkPostRow(rows[id],
|
|
28386
|
+
walkPostRow(rows[id], resolve29, raw);
|
|
28326
28387
|
const post = buildPost(raw, mentionMap, author);
|
|
28327
28388
|
if (post) posts.push(post);
|
|
28328
28389
|
}
|
|
@@ -28655,12 +28716,12 @@ function printPromptsTable(rows) {
|
|
|
28655
28716
|
].join(" ");
|
|
28656
28717
|
console.log(chalk186.dim(header));
|
|
28657
28718
|
console.log(chalk186.dim("-".repeat(header.length)));
|
|
28658
|
-
for (const
|
|
28659
|
-
const count8 = String(
|
|
28660
|
-
const tool =
|
|
28661
|
-
const command = truncate(
|
|
28719
|
+
for (const row2 of rows) {
|
|
28720
|
+
const count8 = String(row2.count).padStart(countWidth);
|
|
28721
|
+
const tool = row2.tool.padEnd(toolWidth);
|
|
28722
|
+
const command = truncate(row2.command, 60).padEnd(commandWidth);
|
|
28662
28723
|
console.log(
|
|
28663
|
-
`${chalk186.yellow(count8)} ${tool} ${command} ${chalk186.dim(
|
|
28724
|
+
`${chalk186.yellow(count8)} ${tool} ${command} ${chalk186.dim(row2.repos)}`
|
|
28664
28725
|
);
|
|
28665
28726
|
}
|
|
28666
28727
|
}
|
|
@@ -29467,9 +29528,6 @@ function registerPrsComments(prsCommand) {
|
|
|
29467
29528
|
});
|
|
29468
29529
|
}
|
|
29469
29530
|
|
|
29470
|
-
// src/commands/prs/edit.ts
|
|
29471
|
-
import { randomUUID as randomUUID16 } from "crypto";
|
|
29472
|
-
|
|
29473
29531
|
// src/commands/prs/applyEdit.ts
|
|
29474
29532
|
function applyEdit(number, title, body, attachments = []) {
|
|
29475
29533
|
const args = ["pr", "edit", String(number)];
|
|
@@ -29581,6 +29639,65 @@ ${resolves}` : baseWhy);
|
|
|
29581
29639
|
return serializePrBody(parsed);
|
|
29582
29640
|
}
|
|
29583
29641
|
|
|
29642
|
+
// src/commands/prs/parseScreenshotSpec.ts
|
|
29643
|
+
import { statSync as statSync10 } from "fs";
|
|
29644
|
+
import { basename as basename22, extname as extname5, resolve as resolve22 } from "path";
|
|
29645
|
+
function splitOnce(value, separator) {
|
|
29646
|
+
const index2 = value.indexOf(separator);
|
|
29647
|
+
if (index2 === -1) return null;
|
|
29648
|
+
return [value.slice(0, index2), value.slice(index2 + separator.length)];
|
|
29649
|
+
}
|
|
29650
|
+
function isFile2(path106) {
|
|
29651
|
+
try {
|
|
29652
|
+
return statSync10(path106).isFile();
|
|
29653
|
+
} catch {
|
|
29654
|
+
return false;
|
|
29655
|
+
}
|
|
29656
|
+
}
|
|
29657
|
+
function parseScreenshotSpec(spec) {
|
|
29658
|
+
const [label2, rawPath] = splitOnce(spec, "=") ?? ["", spec];
|
|
29659
|
+
const [group, caption] = splitOnce(label2, "/") ?? ["", label2];
|
|
29660
|
+
const path106 = resolve22(rawPath.trim());
|
|
29661
|
+
const ext = extname5(path106).replace(/^\./, "").toLowerCase();
|
|
29662
|
+
if (!isFile2(path106))
|
|
29663
|
+
throw new Error(`--screenshot '${spec}': file not found: ${path106}`);
|
|
29664
|
+
if (!ghAttachableExtensions.has(ext))
|
|
29665
|
+
throw new Error(
|
|
29666
|
+
`--screenshot '${spec}': gh cannot attach .${ext || "(none)"} files (supported: ${[...ghAttachableExtensions].join(", ")}).`
|
|
29667
|
+
);
|
|
29668
|
+
const alt = caption.trim() || basename22(path106, extname5(path106));
|
|
29669
|
+
return group.trim() ? { path: path106, alt, group: group.trim() } : { path: path106, alt };
|
|
29670
|
+
}
|
|
29671
|
+
|
|
29672
|
+
// src/commands/prs/parseScreenshotSpecs.ts
|
|
29673
|
+
function parseScreenshotSpecs(specs) {
|
|
29674
|
+
try {
|
|
29675
|
+
return (specs ?? []).map(parseScreenshotSpec);
|
|
29676
|
+
} catch (error) {
|
|
29677
|
+
console.error(`Error: ${error.message}`);
|
|
29678
|
+
process.exit(1);
|
|
29679
|
+
}
|
|
29680
|
+
}
|
|
29681
|
+
|
|
29682
|
+
// src/commands/prs/previewAndApplyEdit.ts
|
|
29683
|
+
import { randomUUID as randomUUID16 } from "crypto";
|
|
29684
|
+
async function previewAndApplyEdit(args) {
|
|
29685
|
+
const decision = await awaitPreviewApproval("PR preview", {
|
|
29686
|
+
sessionId: args.sessionId,
|
|
29687
|
+
requestId: randomUUID16(),
|
|
29688
|
+
title: args.title ?? args.currentTitle,
|
|
29689
|
+
body: args.body,
|
|
29690
|
+
prNumber: args.number
|
|
29691
|
+
});
|
|
29692
|
+
const attachments = [...args.screenshots, ...decision.screenshots ?? []];
|
|
29693
|
+
applyEdit(
|
|
29694
|
+
args.number,
|
|
29695
|
+
args.title,
|
|
29696
|
+
appendScreenshots(args.body, attachments),
|
|
29697
|
+
attachments
|
|
29698
|
+
);
|
|
29699
|
+
}
|
|
29700
|
+
|
|
29584
29701
|
// src/commands/prs/findWallOfText.ts
|
|
29585
29702
|
var MAX_PARAGRAPH_CHARS = 600;
|
|
29586
29703
|
var MAX_PARAGRAPH_SENTENCES = 4;
|
|
@@ -29645,9 +29762,10 @@ function validatePrContent(title, body) {
|
|
|
29645
29762
|
async function edit(options2) {
|
|
29646
29763
|
const hasResolves = (options2.resolves?.length ?? 0) > 0;
|
|
29647
29764
|
const hasSection = options2.what !== void 0 || options2.why !== void 0 || options2.how !== void 0 || hasResolves;
|
|
29648
|
-
|
|
29765
|
+
const screenshots = parseScreenshotSpecs(options2.screenshot);
|
|
29766
|
+
if (!options2.title && !hasSection && screenshots.length === 0) {
|
|
29649
29767
|
console.error(
|
|
29650
|
-
"Usage: assist prs edit [--title <title>] [--what <what>] [--why <why>] [--how <how>] [--resolves <key>]"
|
|
29768
|
+
"Usage: assist prs edit [--title <title>] [--what <what>] [--why <why>] [--how <how>] [--resolves <key>] [--screenshot '[Group/]Caption=path']"
|
|
29651
29769
|
);
|
|
29652
29770
|
process.exit(1);
|
|
29653
29771
|
}
|
|
@@ -29656,23 +29774,22 @@ async function edit(options2) {
|
|
|
29656
29774
|
validatePrContent(options2.title ?? "", newBody);
|
|
29657
29775
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
29658
29776
|
if (process.env.ASSIST_SESSION === "1" && sessionId) {
|
|
29659
|
-
|
|
29777
|
+
await previewAndApplyEdit({
|
|
29660
29778
|
sessionId,
|
|
29661
|
-
|
|
29662
|
-
title: options2.title
|
|
29779
|
+
number,
|
|
29780
|
+
title: options2.title,
|
|
29781
|
+
currentTitle: title,
|
|
29663
29782
|
body: newBody,
|
|
29664
|
-
|
|
29783
|
+
screenshots
|
|
29665
29784
|
});
|
|
29666
|
-
const attachments = decision.screenshots ?? [];
|
|
29667
|
-
applyEdit(
|
|
29668
|
-
number,
|
|
29669
|
-
options2.title,
|
|
29670
|
-
appendScreenshots(newBody, attachments),
|
|
29671
|
-
attachments
|
|
29672
|
-
);
|
|
29673
29785
|
return;
|
|
29674
29786
|
}
|
|
29675
|
-
applyEdit(
|
|
29787
|
+
applyEdit(
|
|
29788
|
+
number,
|
|
29789
|
+
options2.title,
|
|
29790
|
+
appendScreenshots(newBody, screenshots),
|
|
29791
|
+
screenshots
|
|
29792
|
+
);
|
|
29676
29793
|
}
|
|
29677
29794
|
|
|
29678
29795
|
// src/commands/prs/prConcisenessGuidance.ts
|
|
@@ -29709,6 +29826,20 @@ independent, parallel items (3+); a single bullet is never right. A single
|
|
|
29709
29826
|
non-list paragraph over ~600 characters or ~4 sentences is a wall of text and
|
|
29710
29827
|
will be rejected.`;
|
|
29711
29828
|
|
|
29829
|
+
// src/commands/prs/screenshotGuidance.ts
|
|
29830
|
+
var screenshotGuidance = `Screenshots: pass --screenshot '[Group/]Caption=path' once per image or video
|
|
29831
|
+
(png, jpg, jpeg, gif, webp, svg, mp4, webm, mov). gh ${minGhAttachVersion}+ uploads each
|
|
29832
|
+
file and the body gets a ## Screenshots section: one ### Group heading per group
|
|
29833
|
+
with its images in a 2-column captioned table (so light/dark pairs sit side by
|
|
29834
|
+
side), then any ungrouped images. The spec splits on the first '=' (label vs
|
|
29835
|
+
path), then the label on the first '/' (group vs caption); a missing caption
|
|
29836
|
+
falls back to the file name. A missing file or unsupported extension fails the
|
|
29837
|
+
command before anything is previewed or sent. Never author ## Screenshots in a
|
|
29838
|
+
section option yourself.
|
|
29839
|
+
|
|
29840
|
+
--screenshot 'Profile/Career Connect light=shots/profile-light.png'
|
|
29841
|
+
--screenshot 'Profile/Career Connect dark=shots/profile-dark.png'`;
|
|
29842
|
+
|
|
29712
29843
|
// src/commands/prs/editHelpText.ts
|
|
29713
29844
|
function editHelpText() {
|
|
29714
29845
|
return `
|
|
@@ -29730,6 +29861,9 @@ rescue a body that is already long-winded.
|
|
|
29730
29861
|
## How only non-obvious decisions the diff alone won't explain; omit by
|
|
29731
29862
|
default.
|
|
29732
29863
|
|
|
29864
|
+
${screenshotGuidance} On edit, any supplied screenshots replace the existing
|
|
29865
|
+
## Screenshots section rather than adding a second one, so pass the full set.
|
|
29866
|
+
|
|
29733
29867
|
${prConcisenessGuidance}
|
|
29734
29868
|
`;
|
|
29735
29869
|
}
|
|
@@ -29746,6 +29880,11 @@ function registerPrsEdit(prsCommand) {
|
|
|
29746
29880
|
"Jira issue key or GitHub issue reference resolved by this PR, appended to ## Why (repeatable)",
|
|
29747
29881
|
collect5,
|
|
29748
29882
|
[]
|
|
29883
|
+
).option(
|
|
29884
|
+
"--screenshot <spec>",
|
|
29885
|
+
"Attach a screenshot as '[Group/]Caption=path', replacing the ## Screenshots section (repeatable)",
|
|
29886
|
+
collect5,
|
|
29887
|
+
[]
|
|
29749
29888
|
).addHelpText("after", () => editHelpText()).action(edit);
|
|
29750
29889
|
}
|
|
29751
29890
|
|
|
@@ -29893,7 +30032,7 @@ function parseIncoming(line, type) {
|
|
|
29893
30032
|
}
|
|
29894
30033
|
}
|
|
29895
30034
|
function requestSession(message3) {
|
|
29896
|
-
return new Promise((
|
|
30035
|
+
return new Promise((resolve29, reject) => {
|
|
29897
30036
|
connectToDaemon().then((socket) => {
|
|
29898
30037
|
let settled = false;
|
|
29899
30038
|
const finish2 = (error, sessionId) => {
|
|
@@ -29901,7 +30040,7 @@ function requestSession(message3) {
|
|
|
29901
30040
|
settled = true;
|
|
29902
30041
|
socket.destroy();
|
|
29903
30042
|
if (error) reject(error);
|
|
29904
|
-
else
|
|
30043
|
+
else resolve29(sessionId);
|
|
29905
30044
|
};
|
|
29906
30045
|
readSocketLines(socket, (line) => {
|
|
29907
30046
|
const incoming = parseIncoming(line, message3.type);
|
|
@@ -30035,7 +30174,10 @@ async function previewAndPlace(args) {
|
|
|
30035
30174
|
prNumber: args.prNumber,
|
|
30036
30175
|
draft: args.options.draft === true
|
|
30037
30176
|
});
|
|
30038
|
-
const attachments =
|
|
30177
|
+
const attachments = [
|
|
30178
|
+
...args.screenshots ?? [],
|
|
30179
|
+
...decision.screenshots ?? []
|
|
30180
|
+
];
|
|
30039
30181
|
const body = appendScreenshots(args.body, attachments);
|
|
30040
30182
|
const options2 = decision.draft === void 0 ? args.options : { ...args.options, draft: decision.draft };
|
|
30041
30183
|
await placePr(args.prNumber, args.title, body, options2, attachments);
|
|
@@ -30051,8 +30193,9 @@ function resolveDraftState(options2, command) {
|
|
|
30051
30193
|
}
|
|
30052
30194
|
|
|
30053
30195
|
// src/commands/prs/raise.ts
|
|
30054
|
-
var USAGE6 = "Usage: assist prs raise --title <title> --what <what> --why <why> [--how <how>] [--resolves <key>] [--force]";
|
|
30196
|
+
var USAGE6 = "Usage: assist prs raise --title <title> --what <what> --why <why> [--how <how>] [--resolves <key>] [--screenshot '[Group/]Caption=path'] [--force]";
|
|
30055
30197
|
async function raise(options2, command) {
|
|
30198
|
+
const screenshots = parseScreenshotSpecs(options2.screenshot);
|
|
30056
30199
|
const { title, body } = buildValidatedBody(options2, USAGE6);
|
|
30057
30200
|
const resolved = { ...options2, draft: resolveDraftState(options2, command) };
|
|
30058
30201
|
const existing = findCurrentPrNumber();
|
|
@@ -30063,7 +30206,8 @@ async function raise(options2, command) {
|
|
|
30063
30206
|
title,
|
|
30064
30207
|
body,
|
|
30065
30208
|
prNumber: existing,
|
|
30066
|
-
options: resolved
|
|
30209
|
+
options: resolved,
|
|
30210
|
+
screenshots
|
|
30067
30211
|
});
|
|
30068
30212
|
return;
|
|
30069
30213
|
}
|
|
@@ -30073,7 +30217,13 @@ async function raise(options2, command) {
|
|
|
30073
30217
|
);
|
|
30074
30218
|
process.exit(1);
|
|
30075
30219
|
}
|
|
30076
|
-
await placePr(
|
|
30220
|
+
await placePr(
|
|
30221
|
+
existing,
|
|
30222
|
+
title,
|
|
30223
|
+
appendScreenshots(body, screenshots),
|
|
30224
|
+
resolved,
|
|
30225
|
+
screenshots
|
|
30226
|
+
);
|
|
30077
30227
|
}
|
|
30078
30228
|
|
|
30079
30229
|
// src/commands/prs/resolvesBlurb.ts
|
|
@@ -30130,6 +30280,8 @@ The body is assembled from discrete section options; supply at minimum --title,
|
|
|
30130
30280
|
unless the approach genuinely needs explaining.
|
|
30131
30281
|
${resolves}
|
|
30132
30282
|
|
|
30283
|
+
${screenshotGuidance}
|
|
30284
|
+
|
|
30133
30285
|
Wrap symbols, file paths, function names, class names, variable names, config
|
|
30134
30286
|
keys, CLI commands, and flag names in backticks.
|
|
30135
30287
|
|
|
@@ -30178,11 +30330,12 @@ on rejection it exits non-zero with the reason. The reviewer may also attach
|
|
|
30178
30330
|
inline comments to specific spans of the preview; on rejection these are printed
|
|
30179
30331
|
as numbered quoted-span + note pairs on stderr. Address every comment (and the
|
|
30180
30332
|
reason), then run the command again to re-preview the revised PR. Repeat until it
|
|
30181
|
-
is approved.
|
|
30182
|
-
|
|
30183
|
-
|
|
30184
|
-
|
|
30185
|
-
and
|
|
30333
|
+
is approved. When the session captured screenshots, supply them yourself with
|
|
30334
|
+
--screenshot rather than asking the reviewer to drag them in. The reviewer may
|
|
30335
|
+
also drop or paste more screenshots or video into the pane; on approval gh
|
|
30336
|
+
attaches them (gh ${minGhAttachVersion}+) as ungrouped images after yours in the
|
|
30337
|
+
## Screenshots section; on rejection they stay attached and reappear in the
|
|
30338
|
+
preview you re-propose. Just compose the sections and run the command.`;
|
|
30186
30339
|
function raiseHelpText(promptJira, promptGithub, draft) {
|
|
30187
30340
|
const config = loadConfig().prs;
|
|
30188
30341
|
const jira = promptJira ?? config?.promptJira ?? false;
|
|
@@ -30208,6 +30361,11 @@ function registerPrsRaise(prsCommand) {
|
|
|
30208
30361
|
"Jira issue key or GitHub issue reference resolved by this PR, appended to ## Why (repeatable)",
|
|
30209
30362
|
collect6,
|
|
30210
30363
|
[]
|
|
30364
|
+
).option(
|
|
30365
|
+
"--screenshot <spec>",
|
|
30366
|
+
"Attach a screenshot as '[Group/]Caption=path' under ## Screenshots (repeatable)",
|
|
30367
|
+
collect6,
|
|
30368
|
+
[]
|
|
30211
30369
|
).option(
|
|
30212
30370
|
"--force",
|
|
30213
30371
|
"Overwrite the title and body of an existing pull request"
|
|
@@ -31767,7 +31925,7 @@ async function notify() {
|
|
|
31767
31925
|
import { execSync as execSync53 } from "child_process";
|
|
31768
31926
|
import { existsSync as existsSync64, mkdirSync as mkdirSync22, unlinkSync as unlinkSync17, writeFileSync as writeFileSync39 } from "fs";
|
|
31769
31927
|
import { tmpdir as tmpdir8 } from "os";
|
|
31770
|
-
import { join as join80, resolve as
|
|
31928
|
+
import { join as join80, resolve as resolve23 } from "path";
|
|
31771
31929
|
import chalk209 from "chalk";
|
|
31772
31930
|
|
|
31773
31931
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -31901,7 +32059,7 @@ function buildOutputPath(outputDir, processName) {
|
|
|
31901
32059
|
mkdirSync22(outputDir, { recursive: true });
|
|
31902
32060
|
}
|
|
31903
32061
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
31904
|
-
return
|
|
32062
|
+
return resolve23(outputDir, `${processName}-${timestamp6}.png`);
|
|
31905
32063
|
}
|
|
31906
32064
|
function runPowerShellScript(processName, outputPath) {
|
|
31907
32065
|
const scriptPath = join80(tmpdir8(), `assist-screenshot-${Date.now()}.ps1`);
|
|
@@ -31917,7 +32075,7 @@ function runPowerShellScript(processName, outputPath) {
|
|
|
31917
32075
|
}
|
|
31918
32076
|
function screenshot(processName) {
|
|
31919
32077
|
const config = loadConfig();
|
|
31920
|
-
const outputDir =
|
|
32078
|
+
const outputDir = resolve23(config.screenshot.outputDir);
|
|
31921
32079
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
31922
32080
|
console.log(chalk209.gray(`Capturing window for process "${processName}" ...`));
|
|
31923
32081
|
try {
|
|
@@ -32018,13 +32176,13 @@ function buildLimitsSegment(rateLimits) {
|
|
|
32018
32176
|
}
|
|
32019
32177
|
|
|
32020
32178
|
// src/commands/readGitBranch.ts
|
|
32021
|
-
import { readFileSync as readFileSync47, statSync as
|
|
32022
|
-
import { isAbsolute as isAbsolute6, join as join81, resolve as
|
|
32179
|
+
import { readFileSync as readFileSync47, statSync as statSync11 } from "fs";
|
|
32180
|
+
import { isAbsolute as isAbsolute6, join as join81, resolve as resolve24 } from "path";
|
|
32023
32181
|
function resolveGitDir(cwd) {
|
|
32024
32182
|
const dotGit = join81(cwd, ".git");
|
|
32025
32183
|
let stat5;
|
|
32026
32184
|
try {
|
|
32027
|
-
stat5 =
|
|
32185
|
+
stat5 = statSync11(dotGit);
|
|
32028
32186
|
} catch {
|
|
32029
32187
|
return null;
|
|
32030
32188
|
}
|
|
@@ -32042,7 +32200,7 @@ function resolveGitDir(cwd) {
|
|
|
32042
32200
|
return null;
|
|
32043
32201
|
}
|
|
32044
32202
|
const gitDir = match[1].trim();
|
|
32045
|
-
return isAbsolute6(gitDir) ? gitDir :
|
|
32203
|
+
return isAbsolute6(gitDir) ? gitDir : resolve24(cwd, gitDir);
|
|
32046
32204
|
}
|
|
32047
32205
|
function readGitBranch(cwd) {
|
|
32048
32206
|
const gitDir = resolveGitDir(cwd);
|
|
@@ -32352,7 +32510,7 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
32352
32510
|
|
|
32353
32511
|
// src/commands/refactor/check.ts
|
|
32354
32512
|
function runScript(script, cwd) {
|
|
32355
|
-
return new Promise((
|
|
32513
|
+
return new Promise((resolve29) => {
|
|
32356
32514
|
const child = spawn7("npm", ["run", script], {
|
|
32357
32515
|
stdio: "pipe",
|
|
32358
32516
|
shell: true,
|
|
@@ -32366,7 +32524,7 @@ function runScript(script, cwd) {
|
|
|
32366
32524
|
output += data.toString();
|
|
32367
32525
|
});
|
|
32368
32526
|
child.on("close", (code) => {
|
|
32369
|
-
|
|
32527
|
+
resolve29({ script, code: code ?? 1, output });
|
|
32370
32528
|
});
|
|
32371
32529
|
});
|
|
32372
32530
|
}
|
|
@@ -34521,7 +34679,7 @@ function readGlobs(value) {
|
|
|
34521
34679
|
|
|
34522
34680
|
// src/commands/review/highLevel/summariseRepoTree.ts
|
|
34523
34681
|
import { execFileSync as execFileSync20 } from "child_process";
|
|
34524
|
-
import { dirname as dirname37, extname as
|
|
34682
|
+
import { dirname as dirname37, extname as extname6 } from "path";
|
|
34525
34683
|
var MAX_DIRECTORIES = 200;
|
|
34526
34684
|
var MAX_EXTENSIONS_PER_DIRECTORY = 6;
|
|
34527
34685
|
function summariseRepoTree(cwd = process.cwd()) {
|
|
@@ -34550,7 +34708,7 @@ function countByDirectory(files) {
|
|
|
34550
34708
|
for (const file of files) {
|
|
34551
34709
|
const directory = dirname37(file) === "." ? "(repo root)" : dirname37(file);
|
|
34552
34710
|
const extensions = directories.get(directory) ?? /* @__PURE__ */ new Map();
|
|
34553
|
-
const extension =
|
|
34711
|
+
const extension = extname6(file) === "" ? "(no extension)" : extname6(file);
|
|
34554
34712
|
extensions.set(extension, (extensions.get(extension) ?? 0) + 1);
|
|
34555
34713
|
directories.set(directory, extensions);
|
|
34556
34714
|
}
|
|
@@ -34676,7 +34834,7 @@ function groupFilesByDirectory(files) {
|
|
|
34676
34834
|
}
|
|
34677
34835
|
|
|
34678
34836
|
// src/commands/review/highLevel/buildHighLevelTree.ts
|
|
34679
|
-
function
|
|
34837
|
+
function basename23(path106) {
|
|
34680
34838
|
return path106.slice(path106.lastIndexOf("/") + 1);
|
|
34681
34839
|
}
|
|
34682
34840
|
function sum(nodes, key) {
|
|
@@ -34692,7 +34850,7 @@ function nodesOf(at2, prefix2) {
|
|
|
34692
34850
|
const files = at2.files.map(
|
|
34693
34851
|
(file) => ({
|
|
34694
34852
|
kind: "file",
|
|
34695
|
-
name:
|
|
34853
|
+
name: basename23(file.path),
|
|
34696
34854
|
...file
|
|
34697
34855
|
})
|
|
34698
34856
|
);
|
|
@@ -36202,11 +36360,11 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
36202
36360
|
}
|
|
36203
36361
|
|
|
36204
36362
|
// src/commands/review/cachedReviewerResult.ts
|
|
36205
|
-
import { statSync as
|
|
36363
|
+
import { statSync as statSync12 } from "fs";
|
|
36206
36364
|
function cachedReviewerResult(name, outputPath) {
|
|
36207
36365
|
let size;
|
|
36208
36366
|
try {
|
|
36209
|
-
size =
|
|
36367
|
+
size = statSync12(outputPath).size;
|
|
36210
36368
|
} catch {
|
|
36211
36369
|
return null;
|
|
36212
36370
|
}
|
|
@@ -36845,12 +37003,12 @@ function onCloseResult(ctx, code) {
|
|
|
36845
37003
|
return { ...closed, stderr: ctx.stderr.value, stdout: ctx.stdout.value };
|
|
36846
37004
|
}
|
|
36847
37005
|
function waitForChildExit(ctx) {
|
|
36848
|
-
return new Promise((
|
|
37006
|
+
return new Promise((resolve29) => {
|
|
36849
37007
|
let settled = false;
|
|
36850
37008
|
const settle = (result) => {
|
|
36851
37009
|
if (settled) return;
|
|
36852
37010
|
settled = true;
|
|
36853
|
-
|
|
37011
|
+
resolve29(result);
|
|
36854
37012
|
};
|
|
36855
37013
|
ctx.child.on("error", (err) => settle(onErrorResult(ctx, err)));
|
|
36856
37014
|
ctx.child.on("close", (code) => settle(onCloseResult(ctx, code)));
|
|
@@ -37392,13 +37550,13 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
37392
37550
|
|
|
37393
37551
|
// src/commands/review/buildReviewPaths.ts
|
|
37394
37552
|
import { homedir as homedir25 } from "os";
|
|
37395
|
-
import { basename as
|
|
37553
|
+
import { basename as basename24, join as join85 } from "path";
|
|
37396
37554
|
function buildReviewPaths(repoRoot2, key) {
|
|
37397
37555
|
const reviewDir = join85(
|
|
37398
37556
|
homedir25(),
|
|
37399
37557
|
".assist",
|
|
37400
37558
|
"reviews",
|
|
37401
|
-
|
|
37559
|
+
basename24(repoRoot2),
|
|
37402
37560
|
key
|
|
37403
37561
|
);
|
|
37404
37562
|
return {
|
|
@@ -38118,12 +38276,12 @@ function mapDataToEvents(data) {
|
|
|
38118
38276
|
const levelIdx = col("Level");
|
|
38119
38277
|
const exIdx = col("Exception");
|
|
38120
38278
|
const msgIdx = col("Message");
|
|
38121
|
-
return data.Rows.map((
|
|
38122
|
-
Timestamp: ticksToIso(
|
|
38123
|
-
Level: String(
|
|
38124
|
-
Exception:
|
|
38279
|
+
return data.Rows.map((row2) => ({
|
|
38280
|
+
Timestamp: ticksToIso(row2[tsIdx]),
|
|
38281
|
+
Level: String(row2[levelIdx] ?? ""),
|
|
38282
|
+
Exception: row2[exIdx] != null ? String(row2[exIdx]) : void 0,
|
|
38125
38283
|
Properties: [],
|
|
38126
|
-
MessageTemplateTokens: [{ Text: String(
|
|
38284
|
+
MessageTemplateTokens: [{ Text: String(row2[msgIdx] ?? "") }]
|
|
38127
38285
|
}));
|
|
38128
38286
|
}
|
|
38129
38287
|
|
|
@@ -38338,11 +38496,11 @@ import { randomUUID as randomUUID20 } from "crypto";
|
|
|
38338
38496
|
// src/commands/sessions/shared/sendShowPreview.ts
|
|
38339
38497
|
async function sendShowPreview(request) {
|
|
38340
38498
|
const socket = await connectToDaemon();
|
|
38341
|
-
await new Promise((
|
|
38499
|
+
await new Promise((resolve29, reject) => {
|
|
38342
38500
|
const finish2 = (error) => {
|
|
38343
38501
|
socket.destroy();
|
|
38344
38502
|
if (error) reject(error);
|
|
38345
|
-
else
|
|
38503
|
+
else resolve29();
|
|
38346
38504
|
};
|
|
38347
38505
|
readSocketLines(socket, (line) => {
|
|
38348
38506
|
const reply2 = parseReply(line);
|
|
@@ -38664,8 +38822,8 @@ function printTable(rows) {
|
|
|
38664
38822
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
38665
38823
|
console.log(chalk254.dim(header));
|
|
38666
38824
|
console.log(chalk254.dim("-".repeat(header.length)));
|
|
38667
|
-
for (const
|
|
38668
|
-
const line = columns.map((c, i) => formatCell(
|
|
38825
|
+
for (const row2 of rows) {
|
|
38826
|
+
const line = columns.map((c, i) => formatCell(row2[c]).padEnd(widths[i])).join(" ");
|
|
38669
38827
|
console.log(line);
|
|
38670
38828
|
}
|
|
38671
38829
|
console.log(chalk254.dim(`
|
|
@@ -39605,9 +39763,9 @@ function createReadlineInterface() {
|
|
|
39605
39763
|
});
|
|
39606
39764
|
}
|
|
39607
39765
|
function askQuestion(rl, question) {
|
|
39608
|
-
return new Promise((
|
|
39766
|
+
return new Promise((resolve29) => {
|
|
39609
39767
|
rl.question(question, (answer) => {
|
|
39610
|
-
|
|
39768
|
+
resolve29(answer.trim());
|
|
39611
39769
|
});
|
|
39612
39770
|
});
|
|
39613
39771
|
}
|
|
@@ -39667,21 +39825,21 @@ async function configure() {
|
|
|
39667
39825
|
}
|
|
39668
39826
|
|
|
39669
39827
|
// src/commands/transcript/list.ts
|
|
39670
|
-
import { existsSync as existsSync78, readdirSync as readdirSync20, statSync as
|
|
39828
|
+
import { existsSync as existsSync78, readdirSync as readdirSync20, statSync as statSync13 } from "fs";
|
|
39671
39829
|
import { join as join98 } from "path";
|
|
39672
39830
|
function list3() {
|
|
39673
39831
|
const { vttDir } = getTranscriptConfig();
|
|
39674
39832
|
if (!existsSync78(vttDir)) return;
|
|
39675
39833
|
for (const entry of readdirSync20(vttDir)) {
|
|
39676
39834
|
if (!entry.endsWith(".vtt")) continue;
|
|
39677
|
-
if (
|
|
39835
|
+
if (statSync13(join98(vttDir, entry)).isDirectory()) continue;
|
|
39678
39836
|
console.log(entry);
|
|
39679
39837
|
}
|
|
39680
39838
|
}
|
|
39681
39839
|
|
|
39682
39840
|
// src/commands/transcript/move.ts
|
|
39683
39841
|
import { existsSync as existsSync79, mkdirSync as mkdirSync33, renameSync as renameSync3, writeFileSync as writeFileSync51 } from "fs";
|
|
39684
|
-
import { basename as
|
|
39842
|
+
import { basename as basename28, join as join99 } from "path";
|
|
39685
39843
|
|
|
39686
39844
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
39687
39845
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -39702,13 +39860,13 @@ function move(file, options2) {
|
|
|
39702
39860
|
process.exit(1);
|
|
39703
39861
|
}
|
|
39704
39862
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
39705
|
-
const filename =
|
|
39863
|
+
const filename = basename28(file);
|
|
39706
39864
|
const sourcePath = join99(vttDir, filename);
|
|
39707
39865
|
if (!existsSync79(sourcePath)) {
|
|
39708
39866
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
39709
39867
|
process.exit(1);
|
|
39710
39868
|
}
|
|
39711
|
-
const base =
|
|
39869
|
+
const base = basename28(filename, ".vtt").replace(/ Transcription$/, "");
|
|
39712
39870
|
const outputName = `${date} ${base}.md`;
|
|
39713
39871
|
const formattedDir = join99(transcriptsDir, client);
|
|
39714
39872
|
mkdirSync33(formattedDir, { recursive: true });
|
|
@@ -39722,7 +39880,7 @@ function move(file, options2) {
|
|
|
39722
39880
|
|
|
39723
39881
|
// src/commands/transcript/merge.ts
|
|
39724
39882
|
import { existsSync as existsSync80, writeFileSync as writeFileSync52 } from "fs";
|
|
39725
|
-
import { basename as
|
|
39883
|
+
import { basename as basename29 } from "path";
|
|
39726
39884
|
|
|
39727
39885
|
// src/commands/transcript/failTranscript.ts
|
|
39728
39886
|
function failTranscript(message3) {
|
|
@@ -39868,7 +40026,7 @@ function readSource3(file) {
|
|
|
39868
40026
|
if (!existsSync80(file)) failTranscript(`VTT file not found: ${file}`);
|
|
39869
40027
|
const cues = readCleanedCues(file);
|
|
39870
40028
|
if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
|
|
39871
|
-
return { path: file, name:
|
|
40029
|
+
return { path: file, name: basename29(file), cues };
|
|
39872
40030
|
}
|
|
39873
40031
|
function wholePassages(sources) {
|
|
39874
40032
|
return sources.map((source) => ({
|
|
@@ -40529,7 +40687,7 @@ function listMigrationFiles(dir) {
|
|
|
40529
40687
|
|
|
40530
40688
|
// src/commands/verify/migrations/readBaselineMigrations.ts
|
|
40531
40689
|
import { execSync as execSync64 } from "child_process";
|
|
40532
|
-
import { basename as
|
|
40690
|
+
import { basename as basename30 } from "path";
|
|
40533
40691
|
var MIGRATION_FILE3 = /^migration\d+[A-Za-z0-9]*\.ts$/;
|
|
40534
40692
|
function readBaselineMigrations(repoRelativeDir, ref) {
|
|
40535
40693
|
const baseline = /* @__PURE__ */ new Map();
|
|
@@ -40542,7 +40700,7 @@ function readBaselineMigrations(repoRelativeDir, ref) {
|
|
|
40542
40700
|
} catch {
|
|
40543
40701
|
return baseline;
|
|
40544
40702
|
}
|
|
40545
|
-
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path106) => MIGRATION_FILE3.test(
|
|
40703
|
+
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path106) => MIGRATION_FILE3.test(basename30(path106)));
|
|
40546
40704
|
for (const path106 of paths) {
|
|
40547
40705
|
try {
|
|
40548
40706
|
const content = execSync64(`git show "${ref}:${path106}"`, {
|
|
@@ -40550,7 +40708,7 @@ function readBaselineMigrations(repoRelativeDir, ref) {
|
|
|
40550
40708
|
maxBuffer: 16 * 1024 * 1024,
|
|
40551
40709
|
stdio: ["pipe", "pipe", "pipe"]
|
|
40552
40710
|
});
|
|
40553
|
-
baseline.set(
|
|
40711
|
+
baseline.set(basename30(path106), content);
|
|
40554
40712
|
} catch {
|
|
40555
40713
|
}
|
|
40556
40714
|
}
|
|
@@ -40764,9 +40922,9 @@ function gitFailureReason(error) {
|
|
|
40764
40922
|
}
|
|
40765
40923
|
|
|
40766
40924
|
// src/commands/watch/gitMarkerPath.ts
|
|
40767
|
-
import { resolve as
|
|
40925
|
+
import { resolve as resolve26 } from "path";
|
|
40768
40926
|
function gitMarkerPath(name, cwd) {
|
|
40769
|
-
return
|
|
40927
|
+
return resolve26(
|
|
40770
40928
|
cwd ?? process.cwd(),
|
|
40771
40929
|
runGit3(["rev-parse", "--git-path", name], cwd)
|
|
40772
40930
|
);
|
|
@@ -40803,12 +40961,12 @@ function decideLap(end, interrupted) {
|
|
|
40803
40961
|
import { spawn as spawn9 } from "child_process";
|
|
40804
40962
|
var WATCH_LAP_ARGS = ["watch", "wait", "--pull", "--build"];
|
|
40805
40963
|
function runWatchLap() {
|
|
40806
|
-
return new Promise((
|
|
40964
|
+
return new Promise((resolve29, reject) => {
|
|
40807
40965
|
const assistFromPath = spawn9("assist", WATCH_LAP_ARGS, {
|
|
40808
40966
|
stdio: "inherit",
|
|
40809
40967
|
shell: process.platform === "win32"
|
|
40810
40968
|
});
|
|
40811
|
-
assistFromPath.on("close", (code, signal) =>
|
|
40969
|
+
assistFromPath.on("close", (code, signal) => resolve29({ code, signal }));
|
|
40812
40970
|
assistFromPath.on("error", reject);
|
|
40813
40971
|
});
|
|
40814
40972
|
}
|
|
@@ -41153,7 +41311,7 @@ function resolveParams(params, cliArgs) {
|
|
|
41153
41311
|
|
|
41154
41312
|
// src/commands/run/resolveRunCwd.ts
|
|
41155
41313
|
import { existsSync as existsSync82 } from "fs";
|
|
41156
|
-
import { resolve as
|
|
41314
|
+
import { resolve as resolve27 } from "path";
|
|
41157
41315
|
var MissingRunCwdError = class extends Error {
|
|
41158
41316
|
constructor(runName, cwd) {
|
|
41159
41317
|
super(`run config "${runName}": cwd ${cwd} does not exist`);
|
|
@@ -41164,7 +41322,7 @@ var MissingRunCwdError = class extends Error {
|
|
|
41164
41322
|
};
|
|
41165
41323
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
41166
41324
|
if (!config.cwd) return void 0;
|
|
41167
|
-
const cwd =
|
|
41325
|
+
const cwd = resolve27(baseDir, config.cwd);
|
|
41168
41326
|
if (!existsSync82(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
41169
41327
|
return cwd;
|
|
41170
41328
|
}
|
|
@@ -41328,7 +41486,7 @@ function readMovement(cwd) {
|
|
|
41328
41486
|
var CONTROL_POLL_MS = 1e3;
|
|
41329
41487
|
function pollForMovement(options2) {
|
|
41330
41488
|
const { upstream, intervalMs, timeoutMs, timeout, cwd, control } = options2;
|
|
41331
|
-
return new Promise((
|
|
41489
|
+
return new Promise((resolve29) => {
|
|
41332
41490
|
let settled = false;
|
|
41333
41491
|
const finish2 = (outcome) => {
|
|
41334
41492
|
if (settled) return;
|
|
@@ -41337,7 +41495,7 @@ function pollForMovement(options2) {
|
|
|
41337
41495
|
clearInterval(controller);
|
|
41338
41496
|
clearTimeout(deadline);
|
|
41339
41497
|
process.off("SIGINT", onInterrupt);
|
|
41340
|
-
|
|
41498
|
+
resolve29(outcome);
|
|
41341
41499
|
};
|
|
41342
41500
|
const onInterrupt = () => finish2({ kind: "interrupted" });
|
|
41343
41501
|
const check2 = () => {
|
|
@@ -41484,7 +41642,7 @@ function extractCode(url, expectedState) {
|
|
|
41484
41642
|
return code;
|
|
41485
41643
|
}
|
|
41486
41644
|
function waitForCallback(port, expectedState) {
|
|
41487
|
-
return new Promise((
|
|
41645
|
+
return new Promise((resolve29, reject) => {
|
|
41488
41646
|
const timeout = setTimeout(() => {
|
|
41489
41647
|
server.close();
|
|
41490
41648
|
reject(new Error("Authorization timed out after 120 seconds"));
|
|
@@ -41501,7 +41659,7 @@ function waitForCallback(port, expectedState) {
|
|
|
41501
41659
|
const code = extractCode(url, expectedState);
|
|
41502
41660
|
respondHtml(res, 200, "Authorization successful!");
|
|
41503
41661
|
server.close();
|
|
41504
|
-
|
|
41662
|
+
resolve29(code);
|
|
41505
41663
|
} catch (error) {
|
|
41506
41664
|
respondHtml(res, 400, error.message);
|
|
41507
41665
|
server.close();
|
|
@@ -41622,7 +41780,7 @@ async function auth() {
|
|
|
41622
41780
|
|
|
41623
41781
|
// src/commands/roam/postRoamActivity.ts
|
|
41624
41782
|
import { execFileSync as execFileSync22 } from "child_process";
|
|
41625
|
-
import { readdirSync as readdirSync22, readFileSync as readFileSync65, statSync as
|
|
41783
|
+
import { readdirSync as readdirSync22, readFileSync as readFileSync65, statSync as statSync14 } from "fs";
|
|
41626
41784
|
import { join as join100 } from "path";
|
|
41627
41785
|
function findPortFile(roamDir) {
|
|
41628
41786
|
let entries;
|
|
@@ -41634,7 +41792,7 @@ function findPortFile(roamDir) {
|
|
|
41634
41792
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
41635
41793
|
const path106 = join100(roamDir, name);
|
|
41636
41794
|
try {
|
|
41637
|
-
return { path: path106, mtimeMs:
|
|
41795
|
+
return { path: path106, mtimeMs: statSync14(path106).mtimeMs };
|
|
41638
41796
|
} catch {
|
|
41639
41797
|
return void 0;
|
|
41640
41798
|
}
|
|
@@ -42091,10 +42249,10 @@ var STATUS_TIMEOUT_MS2 = 5e3;
|
|
|
42091
42249
|
function queryDaemon(socket) {
|
|
42092
42250
|
socket.write(`${JSON.stringify({ type: "ping" })}
|
|
42093
42251
|
`);
|
|
42094
|
-
return new Promise((
|
|
42252
|
+
return new Promise((resolve29) => {
|
|
42095
42253
|
const result = { sessions: [] };
|
|
42096
42254
|
const pending = /* @__PURE__ */ new Set(["sessions", "pong"]);
|
|
42097
|
-
const timer = setTimeout(() =>
|
|
42255
|
+
const timer = setTimeout(() => resolve29(result), STATUS_TIMEOUT_MS2);
|
|
42098
42256
|
const lines2 = createInterface8({ input: socket });
|
|
42099
42257
|
lines2.on("error", () => {
|
|
42100
42258
|
});
|
|
@@ -42102,7 +42260,7 @@ function queryDaemon(socket) {
|
|
|
42102
42260
|
applyLine(result, pending, line);
|
|
42103
42261
|
if (pending.size === 0) {
|
|
42104
42262
|
clearTimeout(timer);
|
|
42105
|
-
|
|
42263
|
+
resolve29(result);
|
|
42106
42264
|
}
|
|
42107
42265
|
});
|
|
42108
42266
|
});
|
|
@@ -42202,11 +42360,11 @@ function clearPersistedSessionsOnDrain() {
|
|
|
42202
42360
|
|
|
42203
42361
|
// src/commands/sessions/daemon/readDaemonMessage.ts
|
|
42204
42362
|
function readDaemonMessage(lines2, timeoutMs, fallback, match) {
|
|
42205
|
-
return new Promise((
|
|
42363
|
+
return new Promise((resolve29) => {
|
|
42206
42364
|
const finish2 = (value) => {
|
|
42207
42365
|
clearTimeout(timer);
|
|
42208
42366
|
lines2.off("line", onLine);
|
|
42209
|
-
|
|
42367
|
+
resolve29(value);
|
|
42210
42368
|
};
|
|
42211
42369
|
const timer = setTimeout(() => finish2(fallback), timeoutMs);
|
|
42212
42370
|
const onLine = (line) => {
|
|
@@ -42855,7 +43013,7 @@ import { existsSync as existsSync87 } from "fs";
|
|
|
42855
43013
|
import * as pty from "node-pty";
|
|
42856
43014
|
|
|
42857
43015
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
42858
|
-
import { chmodSync, existsSync as existsSync86, statSync as
|
|
43016
|
+
import { chmodSync, existsSync as existsSync86, statSync as statSync15 } from "fs";
|
|
42859
43017
|
import { createRequire as createRequire3 } from "module";
|
|
42860
43018
|
import path102 from "path";
|
|
42861
43019
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -42871,7 +43029,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
42871
43029
|
"spawn-helper"
|
|
42872
43030
|
);
|
|
42873
43031
|
if (!existsSync86(helper)) return;
|
|
42874
|
-
const mode =
|
|
43032
|
+
const mode = statSync15(helper).mode;
|
|
42875
43033
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
42876
43034
|
}
|
|
42877
43035
|
|
|
@@ -43103,11 +43261,11 @@ var autoUpdateControl = {
|
|
|
43103
43261
|
persist2(value);
|
|
43104
43262
|
wake?.();
|
|
43105
43263
|
},
|
|
43106
|
-
sleep: (ms) => new Promise((
|
|
43264
|
+
sleep: (ms) => new Promise((resolve29) => {
|
|
43107
43265
|
const done2 = () => {
|
|
43108
43266
|
clearTimeout(timer);
|
|
43109
43267
|
if (wake === done2) wake = void 0;
|
|
43110
|
-
|
|
43268
|
+
resolve29();
|
|
43111
43269
|
};
|
|
43112
43270
|
const timer = setTimeout(done2, ms);
|
|
43113
43271
|
wake = done2;
|
|
@@ -43422,7 +43580,7 @@ function clearLapSignals(cwd) {
|
|
|
43422
43580
|
}
|
|
43423
43581
|
function runUpdateLap(cwd, onOutput) {
|
|
43424
43582
|
clearLapSignals(cwd);
|
|
43425
|
-
return new Promise((
|
|
43583
|
+
return new Promise((resolve29, reject) => {
|
|
43426
43584
|
const { ASSIST_ACTIVITY_ID: _activity, ...env } = process.env;
|
|
43427
43585
|
const child = spawn11(
|
|
43428
43586
|
process.execPath,
|
|
@@ -43442,7 +43600,7 @@ function runUpdateLap(cwd, onOutput) {
|
|
|
43442
43600
|
child.stderr.on("data", (chunk) => onOutput(chunk.toString()));
|
|
43443
43601
|
child.on("close", (code, signal) => {
|
|
43444
43602
|
process.off("exit", killWithDaemon);
|
|
43445
|
-
|
|
43603
|
+
resolve29({ code, signal });
|
|
43446
43604
|
});
|
|
43447
43605
|
child.on("error", (error) => {
|
|
43448
43606
|
process.off("exit", killWithDaemon);
|
|
@@ -43523,14 +43681,14 @@ function setStatus2(session, newStatus) {
|
|
|
43523
43681
|
|
|
43524
43682
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
43525
43683
|
import { existsSync as existsSync90 } from "fs";
|
|
43526
|
-
import { basename as
|
|
43684
|
+
import { basename as basename31 } from "path";
|
|
43527
43685
|
|
|
43528
43686
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
43529
43687
|
import { existsSync as existsSync89 } from "fs";
|
|
43530
43688
|
import { join as join105 } from "path";
|
|
43531
43689
|
|
|
43532
43690
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
43533
|
-
import { statSync as
|
|
43691
|
+
import { statSync as statSync16 } from "fs";
|
|
43534
43692
|
import { rm as rm3 } from "fs/promises";
|
|
43535
43693
|
import { join as join104 } from "path";
|
|
43536
43694
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
@@ -43560,7 +43718,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
43560
43718
|
return { removed: true };
|
|
43561
43719
|
}
|
|
43562
43720
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
43563
|
-
return
|
|
43721
|
+
return statSync16(join104(worktreePath, ".git"), {
|
|
43564
43722
|
throwIfNoEntry: false
|
|
43565
43723
|
})?.isDirectory() === true;
|
|
43566
43724
|
}
|
|
@@ -43666,7 +43824,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
43666
43824
|
const clone = owningClone(worktreePath);
|
|
43667
43825
|
const removal = await removeTree(clone, worktreePath, force);
|
|
43668
43826
|
if (!removal.removed) return removal;
|
|
43669
|
-
await deleteWorktreeBranch(clone,
|
|
43827
|
+
await deleteWorktreeBranch(clone, basename31(worktreePath));
|
|
43670
43828
|
forgetWorktree(worktreePath);
|
|
43671
43829
|
daemonLog(`worktree ${worktreePath} reaped${force ? " (forced)" : ""}`);
|
|
43672
43830
|
return removal;
|
|
@@ -43833,12 +43991,12 @@ function processCwd(link3) {
|
|
|
43833
43991
|
var POLL_MS2 = 500;
|
|
43834
43992
|
var GRACE_MS = 5e3;
|
|
43835
43993
|
function awaitTreeVacated(session, treePath) {
|
|
43836
|
-
return new Promise((
|
|
43994
|
+
return new Promise((resolve29) => {
|
|
43837
43995
|
let ticks = GRACE_MS / POLL_MS2;
|
|
43838
43996
|
const settle = (outcome) => {
|
|
43839
43997
|
clearTimeout(timer);
|
|
43840
43998
|
session.closeGrace = void 0;
|
|
43841
|
-
|
|
43999
|
+
resolve29(outcome);
|
|
43842
44000
|
};
|
|
43843
44001
|
const tick = () => {
|
|
43844
44002
|
if (liveProcessesInTree(treePath).length === 0) settle("vacated");
|
|
@@ -44427,7 +44585,7 @@ function emitSessionOutput(session, clients, data) {
|
|
|
44427
44585
|
|
|
44428
44586
|
// src/commands/sessions/daemon/exitReason.ts
|
|
44429
44587
|
import { existsSync as existsSync92 } from "fs";
|
|
44430
|
-
import { resolve as
|
|
44588
|
+
import { resolve as resolve28 } from "path";
|
|
44431
44589
|
function exitDetail(session) {
|
|
44432
44590
|
if (session.cwd && !existsSync92(session.cwd))
|
|
44433
44591
|
return `working directory ${session.cwd} no longer exists`;
|
|
@@ -44442,7 +44600,7 @@ function missingRunConfigCwd(session) {
|
|
|
44442
44600
|
const dir = session.cwd ?? process.cwd();
|
|
44443
44601
|
const config = resolveRunConfig(session.runName, dir);
|
|
44444
44602
|
if (!config?.cwd) return void 0;
|
|
44445
|
-
const configured =
|
|
44603
|
+
const configured = resolve28(runConfigBaseDirFrom(dir), config.cwd);
|
|
44446
44604
|
if (existsSync92(configured)) return void 0;
|
|
44447
44605
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
44448
44606
|
}
|
|
@@ -44516,10 +44674,10 @@ function applyReviewPause(session, activity2) {
|
|
|
44516
44674
|
// src/shared/db/getPhaseActiveMs.ts
|
|
44517
44675
|
import { and as and20, eq as eq46 } from "drizzle-orm";
|
|
44518
44676
|
async function getPhaseActiveMs(db, itemId2, phaseIdx) {
|
|
44519
|
-
const [
|
|
44677
|
+
const [row2] = await db.select({ activeMs: phaseUsage.activeMs }).from(phaseUsage).where(
|
|
44520
44678
|
and20(eq46(phaseUsage.itemId, itemId2), eq46(phaseUsage.phaseIdx, phaseIdx))
|
|
44521
44679
|
);
|
|
44522
|
-
return
|
|
44680
|
+
return row2?.activeMs ?? 0;
|
|
44523
44681
|
}
|
|
44524
44682
|
|
|
44525
44683
|
// src/commands/sessions/daemon/loadPhaseActiveMs.ts
|
|
@@ -46569,7 +46727,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
46569
46727
|
|
|
46570
46728
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
46571
46729
|
import { existsSync as existsSync96 } from "fs";
|
|
46572
|
-
import { basename as
|
|
46730
|
+
import { basename as basename33 } from "path";
|
|
46573
46731
|
|
|
46574
46732
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
46575
46733
|
function accountedTrees(sessions) {
|
|
@@ -46677,7 +46835,7 @@ function capped2(lines2) {
|
|
|
46677
46835
|
}
|
|
46678
46836
|
|
|
46679
46837
|
// src/commands/sessions/daemon/worktree/resurfaceOrphanedWorktree.ts
|
|
46680
|
-
import { basename as
|
|
46838
|
+
import { basename as basename32 } from "path";
|
|
46681
46839
|
function resurfaceOrphanedWorktree(sessions, spawnWith, recovered, notify2) {
|
|
46682
46840
|
const { orphan, reason: reason4, held } = recovered;
|
|
46683
46841
|
let id;
|
|
@@ -46700,7 +46858,7 @@ function orphanedSession(id, recovered) {
|
|
|
46700
46858
|
const { orphan, reason: reason4, held } = recovered;
|
|
46701
46859
|
return {
|
|
46702
46860
|
...sessionBase(id, "stopped"),
|
|
46703
|
-
name: `recovered ${
|
|
46861
|
+
name: `recovered ${basename32(orphan.path)}`,
|
|
46704
46862
|
subtitle: `${held.summary} in ${orphan.path}`,
|
|
46705
46863
|
commandType: "claude",
|
|
46706
46864
|
pty: null,
|
|
@@ -46761,7 +46919,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
46761
46919
|
logVanishedTree(sessions, path106);
|
|
46762
46920
|
vanished.set(clone, [
|
|
46763
46921
|
...vanished.get(clone) ?? [],
|
|
46764
|
-
{ path: path106, branch:
|
|
46922
|
+
{ path: path106, branch: basename33(path106) }
|
|
46765
46923
|
]);
|
|
46766
46924
|
continue;
|
|
46767
46925
|
}
|
|
@@ -47161,7 +47319,7 @@ function failPendingCreators(state, message3) {
|
|
|
47161
47319
|
}
|
|
47162
47320
|
function resetRelayState(state, reason4) {
|
|
47163
47321
|
failPendingCreators(state, reason4);
|
|
47164
|
-
for (const
|
|
47322
|
+
for (const resolve29 of state.historyWaiters) resolve29([]);
|
|
47165
47323
|
state.historyWaiters = [];
|
|
47166
47324
|
state.sessions = [];
|
|
47167
47325
|
state.lastSnapshot = void 0;
|
|
@@ -47553,16 +47711,16 @@ var HISTORY_TIMEOUT_MS = 5e3;
|
|
|
47553
47711
|
function requestLinkHistory(ctx) {
|
|
47554
47712
|
if (!ctx.greeted) return Promise.resolve([]);
|
|
47555
47713
|
const waiters = ctx.relay.historyWaiters;
|
|
47556
|
-
return new Promise((
|
|
47714
|
+
return new Promise((resolve29) => {
|
|
47557
47715
|
const settle = (sessions) => {
|
|
47558
47716
|
clearTimeout(timer);
|
|
47559
|
-
|
|
47717
|
+
resolve29(sessions);
|
|
47560
47718
|
};
|
|
47561
47719
|
const timer = setTimeout(() => {
|
|
47562
47720
|
const index2 = waiters.indexOf(settle);
|
|
47563
47721
|
if (index2 !== -1) waiters.splice(index2, 1);
|
|
47564
47722
|
daemonLog(`link ${ctx.spec.name} ws: history timed out`);
|
|
47565
|
-
|
|
47723
|
+
resolve29(ctx.relay.lastHistory ?? []);
|
|
47566
47724
|
}, HISTORY_TIMEOUT_MS);
|
|
47567
47725
|
timer.unref?.();
|
|
47568
47726
|
waiters.push(settle);
|