@staff0rd/assist 0.1026.2 → 0.1027.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/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.1026.2",
9
+ version: "0.1027.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -1056,25 +1056,25 @@ var MODIFIER_ORDER = [
1056
1056
  "Shift",
1057
1057
  "Meta"
1058
1058
  ];
1059
- function parseModifiers(tokens, text19) {
1059
+ function parseModifiers(tokens, text20) {
1060
1060
  const modifiers = /* @__PURE__ */ new Set();
1061
1061
  for (const token of tokens) {
1062
1062
  const modifier = MODIFIER_ALIASES[token.toLowerCase()];
1063
1063
  if (!modifier)
1064
- return { ok: false, error: `"${token}" is not a modifier in "${text19}"` };
1064
+ return { ok: false, error: `"${token}" is not a modifier in "${text20}"` };
1065
1065
  if (modifiers.has(modifier))
1066
- return { ok: false, error: `"${token}" is repeated in "${text19}"` };
1066
+ return { ok: false, error: `"${token}" is repeated in "${text20}"` };
1067
1067
  modifiers.add(modifier);
1068
1068
  }
1069
1069
  if (![...modifiers].some((modifier) => modifier !== "Shift"))
1070
1070
  return {
1071
1071
  ok: false,
1072
- error: `"${text19}" needs at least one of Mod, Ctrl, Alt or Meta`
1072
+ error: `"${text20}" needs at least one of Mod, Ctrl, Alt or Meta`
1073
1073
  };
1074
1074
  if (modifiers.has("Mod") && (modifiers.has("Ctrl") || modifiers.has("Meta")))
1075
1075
  return {
1076
1076
  ok: false,
1077
- error: `"${text19}" combines Mod with Ctrl or Meta, which Mod already means`
1077
+ error: `"${text20}" combines Mod with Ctrl or Meta, which Mod already means`
1078
1078
  };
1079
1079
  return {
1080
1080
  ok: true,
@@ -1083,16 +1083,16 @@ function parseModifiers(tokens, text19) {
1083
1083
  }
1084
1084
 
1085
1085
  // src/shared/hotkeys/parseChord.ts
1086
- function parseChord(text19, { modifiersOnly = false } = {}) {
1087
- const tokens = text19.split("+").map((token) => token.trim());
1086
+ function parseChord(text20, { modifiersOnly = false } = {}) {
1087
+ const tokens = text20.split("+").map((token) => token.trim());
1088
1088
  const keyToken = modifiersOnly ? void 0 : tokens.pop();
1089
- const parsed = parseModifiers(tokens, text19);
1089
+ const parsed = parseModifiers(tokens, text20);
1090
1090
  if (!parsed.ok) return parsed;
1091
1091
  const { modifiers } = parsed;
1092
1092
  if (keyToken === void 0) return { ok: true, chord: { modifiers } };
1093
1093
  const key = hotkeyKeyCode(keyToken);
1094
1094
  if (!key)
1095
- return { ok: false, error: `"${keyToken}" is not a key in "${text19}"` };
1095
+ return { ok: false, error: `"${keyToken}" is not a key in "${text20}"` };
1096
1096
  return { ok: true, chord: { modifiers, key } };
1097
1097
  }
1098
1098
 
@@ -2049,7 +2049,7 @@ function expandTilde(value) {
2049
2049
  import { asc, eq } from "drizzle-orm";
2050
2050
 
2051
2051
  // src/shared/db/schema.ts
2052
- import { integer as integer13, pgTable as pgTable16, text as text15 } from "drizzle-orm/pg-core";
2052
+ import { integer as integer14, pgTable as pgTable17, text as text16 } from "drizzle-orm/pg-core";
2053
2053
 
2054
2054
  // src/shared/db/backups.ts
2055
2055
  import { bigint, integer, pgTable, text, timestamp } from "drizzle-orm/pg-core";
@@ -2134,35 +2134,69 @@ var itemGitRefs = pgTable5(
2134
2134
  (t) => [primaryKey2({ columns: [t.itemId, t.kind, t.ref] })]
2135
2135
  );
2136
2136
 
2137
+ // src/shared/db/jobRuns.ts
2138
+ import {
2139
+ bigint as bigint2,
2140
+ doublePrecision,
2141
+ index as index2,
2142
+ integer as integer5,
2143
+ pgTable as pgTable6,
2144
+ text as text6,
2145
+ timestamp as timestamp4
2146
+ } from "drizzle-orm/pg-core";
2147
+ var jobRuns = pgTable6(
2148
+ "job_runs",
2149
+ {
2150
+ id: integer5().generatedByDefaultAsIdentity().primaryKey(),
2151
+ kind: text6().$type().notNull(),
2152
+ trigger: text6().$type().notNull(),
2153
+ model: text6(),
2154
+ startedAt: timestamp4("started_at", { withTimezone: true }).notNull().defaultNow(),
2155
+ finishedAt: timestamp4("finished_at", { withTimezone: true }),
2156
+ durationMs: bigint2("duration_ms", { mode: "number" }),
2157
+ inputTokens: bigint2("input_tokens", { mode: "number" }).notNull().default(0),
2158
+ outputTokens: bigint2("output_tokens", { mode: "number" }).notNull().default(0),
2159
+ cacheReadTokens: bigint2("cache_read_tokens", { mode: "number" }).notNull().default(0),
2160
+ cacheWriteTokens: bigint2("cache_write_tokens", { mode: "number" }).notNull().default(0),
2161
+ costUsd: doublePrecision("cost_usd"),
2162
+ status: text6().$type().notNull().default("running"),
2163
+ detail: text6(),
2164
+ repo: text6(),
2165
+ prNumber: integer5("pr_number"),
2166
+ reviewer: text6()
2167
+ },
2168
+ (t) => [index2("job_runs_started_at_idx").on(t.startedAt)]
2169
+ );
2170
+
2137
2171
  // src/shared/db/links.ts
2138
- import { integer as integer5, pgTable as pgTable6, primaryKey as primaryKey3, text as text6 } from "drizzle-orm/pg-core";
2139
- var links = pgTable6(
2172
+ import { integer as integer6, pgTable as pgTable7, primaryKey as primaryKey3, text as text7 } from "drizzle-orm/pg-core";
2173
+ var links = pgTable7(
2140
2174
  "links",
2141
2175
  {
2142
- itemId: integer5("item_id").notNull().references(() => items.id, { onDelete: "cascade" }),
2143
- type: text6().notNull(),
2144
- targetId: integer5("target_id").notNull()
2176
+ itemId: integer6("item_id").notNull().references(() => items.id, { onDelete: "cascade" }),
2177
+ type: text7().notNull(),
2178
+ targetId: integer6("target_id").notNull()
2145
2179
  },
2146
2180
  (t) => [primaryKey3({ columns: [t.itemId, t.type, t.targetId] })]
2147
2181
  );
2148
2182
 
2149
2183
  // src/shared/db/phaseCycleContext.ts
2150
2184
  import {
2151
- bigint as bigint2,
2152
- doublePrecision,
2153
- integer as integer6,
2154
- pgTable as pgTable7,
2185
+ bigint as bigint3,
2186
+ doublePrecision as doublePrecision2,
2187
+ integer as integer7,
2188
+ pgTable as pgTable8,
2155
2189
  primaryKey as primaryKey4,
2156
- text as text7
2190
+ text as text8
2157
2191
  } from "drizzle-orm/pg-core";
2158
- var phaseCycleContext = pgTable7(
2192
+ var phaseCycleContext = pgTable8(
2159
2193
  "phase_cycle_context",
2160
2194
  {
2161
- itemId: integer6("item_id").notNull(),
2162
- phaseIdx: integer6("phase_idx").notNull(),
2163
- window: text7().$type().notNull(),
2164
- resetsAt: bigint2("resets_at", { mode: "number" }).notNull(),
2165
- peakContextPct: doublePrecision("peak_context_pct").notNull().default(0)
2195
+ itemId: integer7("item_id").notNull(),
2196
+ phaseIdx: integer7("phase_idx").notNull(),
2197
+ window: text8().$type().notNull(),
2198
+ resetsAt: bigint3("resets_at", { mode: "number" }).notNull(),
2199
+ peakContextPct: doublePrecision2("peak_context_pct").notNull().default(0)
2166
2200
  },
2167
2201
  (t) => [
2168
2202
  primaryKey4({
@@ -2173,21 +2207,21 @@ var phaseCycleContext = pgTable7(
2173
2207
 
2174
2208
  // src/shared/db/phaseSessions.ts
2175
2209
  import {
2176
- integer as integer7,
2177
- pgTable as pgTable8,
2210
+ integer as integer8,
2211
+ pgTable as pgTable9,
2178
2212
  primaryKey as primaryKey5,
2179
- text as text8,
2180
- timestamp as timestamp4
2213
+ text as text9,
2214
+ timestamp as timestamp5
2181
2215
  } from "drizzle-orm/pg-core";
2182
- var phaseSessions = pgTable8(
2216
+ var phaseSessions = pgTable9(
2183
2217
  "phase_sessions",
2184
2218
  {
2185
- itemId: integer7("item_id").notNull().references(() => items.id, { onDelete: "cascade" }),
2186
- phaseIdx: integer7("phase_idx").notNull(),
2187
- claudeSessionId: text8("claude_session_id").notNull(),
2188
- hostname: text8().notNull(),
2189
- osUser: text8("os_user").notNull(),
2190
- createdAt: timestamp4("created_at", { withTimezone: true }).notNull().defaultNow()
2219
+ itemId: integer8("item_id").notNull().references(() => items.id, { onDelete: "cascade" }),
2220
+ phaseIdx: integer8("phase_idx").notNull(),
2221
+ claudeSessionId: text9("claude_session_id").notNull(),
2222
+ hostname: text9().notNull(),
2223
+ osUser: text9("os_user").notNull(),
2224
+ createdAt: timestamp5("created_at", { withTimezone: true }).notNull().defaultNow()
2191
2225
  },
2192
2226
  (t) => [
2193
2227
  primaryKey5({
@@ -2198,50 +2232,50 @@ var phaseSessions = pgTable8(
2198
2232
 
2199
2233
  // src/shared/db/phaseUsage.ts
2200
2234
  import {
2201
- bigint as bigint3,
2202
- doublePrecision as doublePrecision2,
2203
- integer as integer8,
2204
- pgTable as pgTable9,
2235
+ bigint as bigint4,
2236
+ doublePrecision as doublePrecision3,
2237
+ integer as integer9,
2238
+ pgTable as pgTable10,
2205
2239
  primaryKey as primaryKey6,
2206
- text as text9
2240
+ text as text10
2207
2241
  } from "drizzle-orm/pg-core";
2208
- var phaseUsage = pgTable9(
2242
+ var phaseUsage = pgTable10(
2209
2243
  "phase_usage",
2210
2244
  {
2211
- itemId: integer8("item_id").notNull(),
2212
- phaseIdx: integer8("phase_idx").notNull(),
2213
- tokensUp: bigint3("tokens_up", { mode: "number" }).notNull().default(0),
2214
- tokensDown: bigint3("tokens_down", { mode: "number" }).notNull().default(0),
2215
- activeMs: bigint3("active_ms", { mode: "number" }).notNull().default(0),
2216
- peakContextPct: doublePrecision2("peak_context_pct").notNull().default(0),
2217
- lastTotalIn: bigint3("last_total_in", { mode: "number" }),
2218
- lastTotalOut: bigint3("last_total_out", { mode: "number" }),
2219
- claudeSessionId: text9("claude_session_id")
2245
+ itemId: integer9("item_id").notNull(),
2246
+ phaseIdx: integer9("phase_idx").notNull(),
2247
+ tokensUp: bigint4("tokens_up", { mode: "number" }).notNull().default(0),
2248
+ tokensDown: bigint4("tokens_down", { mode: "number" }).notNull().default(0),
2249
+ activeMs: bigint4("active_ms", { mode: "number" }).notNull().default(0),
2250
+ peakContextPct: doublePrecision3("peak_context_pct").notNull().default(0),
2251
+ lastTotalIn: bigint4("last_total_in", { mode: "number" }),
2252
+ lastTotalOut: bigint4("last_total_out", { mode: "number" }),
2253
+ claudeSessionId: text10("claude_session_id")
2220
2254
  },
2221
2255
  (t) => [primaryKey6({ columns: [t.itemId, t.phaseIdx] })]
2222
2256
  );
2223
2257
 
2224
2258
  // src/shared/db/phaseUsageMessages.ts
2225
- import { integer as integer9, pgTable as pgTable10, primaryKey as primaryKey7, text as text10 } from "drizzle-orm/pg-core";
2226
- var phaseUsageMessages = pgTable10(
2259
+ import { integer as integer10, pgTable as pgTable11, primaryKey as primaryKey7, text as text11 } from "drizzle-orm/pg-core";
2260
+ var phaseUsageMessages = pgTable11(
2227
2261
  "phase_usage_messages",
2228
2262
  {
2229
- itemId: integer9("item_id").notNull(),
2230
- phaseIdx: integer9("phase_idx").notNull(),
2231
- messageId: text10("message_id").notNull()
2263
+ itemId: integer10("item_id").notNull(),
2264
+ phaseIdx: integer10("phase_idx").notNull(),
2265
+ messageId: text11("message_id").notNull()
2232
2266
  },
2233
2267
  (t) => [primaryKey7({ columns: [t.itemId, t.phaseIdx, t.messageId] })]
2234
2268
  );
2235
2269
 
2236
2270
  // src/shared/db/planPhases.ts
2237
- import { integer as integer10, pgTable as pgTable11, primaryKey as primaryKey8, text as text11 } from "drizzle-orm/pg-core";
2238
- var planPhases = pgTable11(
2271
+ import { integer as integer11, pgTable as pgTable12, primaryKey as primaryKey8, text as text12 } from "drizzle-orm/pg-core";
2272
+ var planPhases = pgTable12(
2239
2273
  "plan_phases",
2240
2274
  {
2241
- itemId: integer10("item_id").notNull().references(() => items.id, { onDelete: "cascade" }),
2242
- idx: integer10().notNull(),
2243
- name: text11().notNull(),
2244
- manualChecks: text11("manual_checks")
2275
+ itemId: integer11("item_id").notNull().references(() => items.id, { onDelete: "cascade" }),
2276
+ idx: integer11().notNull(),
2277
+ name: text12().notNull(),
2278
+ manualChecks: text12("manual_checks")
2245
2279
  },
2246
2280
  (t) => [primaryKey8({ columns: [t.itemId, t.idx] })]
2247
2281
  );
@@ -2249,18 +2283,18 @@ var planPhases = pgTable11(
2249
2283
  // src/shared/db/planTasks.ts
2250
2284
  import {
2251
2285
  foreignKey,
2252
- integer as integer11,
2253
- pgTable as pgTable12,
2286
+ integer as integer12,
2287
+ pgTable as pgTable13,
2254
2288
  primaryKey as primaryKey9,
2255
- text as text12
2289
+ text as text13
2256
2290
  } from "drizzle-orm/pg-core";
2257
- var planTasks = pgTable12(
2291
+ var planTasks = pgTable13(
2258
2292
  "plan_tasks",
2259
2293
  {
2260
- itemId: integer11("item_id").notNull(),
2261
- phaseIdx: integer11("phase_idx").notNull(),
2262
- idx: integer11().notNull(),
2263
- task: text12().notNull()
2294
+ itemId: integer12("item_id").notNull(),
2295
+ phaseIdx: integer12("phase_idx").notNull(),
2296
+ idx: integer12().notNull(),
2297
+ task: text13().notNull()
2264
2298
  },
2265
2299
  (t) => [
2266
2300
  primaryKey9({ columns: [t.itemId, t.phaseIdx, t.idx] }),
@@ -2272,55 +2306,55 @@ var planTasks = pgTable12(
2272
2306
  );
2273
2307
 
2274
2308
  // src/shared/db/repoConfigs.ts
2275
- import { jsonb, pgTable as pgTable13, text as text13, timestamp as timestamp5 } from "drizzle-orm/pg-core";
2276
- var repoConfigs = pgTable13("repo_configs", {
2277
- repoKey: text13("repo_key").primaryKey(),
2309
+ import { jsonb, pgTable as pgTable14, text as text14, timestamp as timestamp6 } from "drizzle-orm/pg-core";
2310
+ var repoConfigs = pgTable14("repo_configs", {
2311
+ repoKey: text14("repo_key").primaryKey(),
2278
2312
  config: jsonb().$type().notNull(),
2279
- updatedAt: timestamp5("updated_at", { withTimezone: true }).notNull().defaultNow()
2313
+ updatedAt: timestamp6("updated_at", { withTimezone: true }).notNull().defaultNow()
2280
2314
  });
2281
2315
 
2282
2316
  // src/shared/db/usagePeaks.ts
2283
2317
  import {
2284
- bigint as bigint4,
2318
+ bigint as bigint5,
2285
2319
  boolean as boolean2,
2286
- doublePrecision as doublePrecision3,
2287
- integer as integer12,
2288
- pgTable as pgTable14,
2320
+ doublePrecision as doublePrecision4,
2321
+ integer as integer13,
2322
+ pgTable as pgTable15,
2289
2323
  primaryKey as primaryKey10,
2290
- text as text14,
2291
- timestamp as timestamp6
2324
+ text as text15,
2325
+ timestamp as timestamp7
2292
2326
  } from "drizzle-orm/pg-core";
2293
- var usagePeaks = pgTable14(
2327
+ var usagePeaks = pgTable15(
2294
2328
  "usage_peaks",
2295
2329
  {
2296
- window: text14().$type().notNull(),
2297
- resetsAt: bigint4("resets_at", { mode: "number" }).notNull(),
2298
- segment: integer12().notNull().default(0),
2299
- usedPercentage: doublePrecision3("used_percentage").notNull(),
2330
+ window: text15().$type().notNull(),
2331
+ resetsAt: bigint5("resets_at", { mode: "number" }).notNull(),
2332
+ segment: integer13().notNull().default(0),
2333
+ usedPercentage: doublePrecision4("used_percentage").notNull(),
2300
2334
  resetDetected: boolean2("reset_detected").notNull().default(false),
2301
- tokensUp: bigint4("tokens_up", { mode: "number" }).notNull().default(0),
2302
- tokensDown: bigint4("tokens_down", { mode: "number" }).notNull().default(0),
2303
- createdAt: timestamp6("created_at", { withTimezone: true }).notNull().defaultNow()
2335
+ tokensUp: bigint5("tokens_up", { mode: "number" }).notNull().default(0),
2336
+ tokensDown: bigint5("tokens_down", { mode: "number" }).notNull().default(0),
2337
+ createdAt: timestamp7("created_at", { withTimezone: true }).notNull().defaultNow()
2304
2338
  },
2305
2339
  (t) => [primaryKey10({ columns: [t.window, t.resetsAt, t.segment] })]
2306
2340
  );
2307
2341
 
2308
2342
  // src/shared/db/userConfig.ts
2309
- import { jsonb as jsonb2, pgTable as pgTable15, smallint, timestamp as timestamp7 } from "drizzle-orm/pg-core";
2310
- var userConfig = pgTable15("user_config", {
2343
+ import { jsonb as jsonb2, pgTable as pgTable16, smallint, timestamp as timestamp8 } from "drizzle-orm/pg-core";
2344
+ var userConfig = pgTable16("user_config", {
2311
2345
  id: smallint().primaryKey().default(1),
2312
2346
  config: jsonb2().$type().notNull(),
2313
- updatedAt: timestamp7("updated_at", { withTimezone: true }).notNull().defaultNow()
2347
+ updatedAt: timestamp8("updated_at", { withTimezone: true }).notNull().defaultNow()
2314
2348
  });
2315
2349
 
2316
2350
  // src/shared/db/schema.ts
2317
- var metadata = pgTable16("metadata", {
2318
- key: text15().primaryKey(),
2319
- value: text15().notNull()
2351
+ var metadata = pgTable17("metadata", {
2352
+ key: text16().primaryKey(),
2353
+ value: text16().notNull()
2320
2354
  });
2321
- var feeds = pgTable16("feeds", {
2322
- id: integer13().generatedByDefaultAsIdentity().primaryKey(),
2323
- url: text15().notNull().unique()
2355
+ var feeds = pgTable17("feeds", {
2356
+ id: integer14().generatedByDefaultAsIdentity().primaryKey(),
2357
+ url: text16().notNull().unique()
2324
2358
  });
2325
2359
  var schema = {
2326
2360
  items,
@@ -2339,7 +2373,8 @@ var schema = {
2339
2373
  phaseSessions,
2340
2374
  repoConfigs,
2341
2375
  inboxMessages,
2342
- userConfig
2376
+ userConfig,
2377
+ jobRuns
2343
2378
  };
2344
2379
 
2345
2380
  // src/shared/db/planPhaseCounts.ts
@@ -3448,6 +3483,35 @@ var migration0010UserConfig = {
3448
3483
  sql: sql13
3449
3484
  };
3450
3485
 
3486
+ // src/shared/db/migrations/migration0011JobRuns.ts
3487
+ var sql14 = `
3488
+ CREATE TABLE IF NOT EXISTS job_runs (
3489
+ id INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
3490
+ kind TEXT NOT NULL,
3491
+ trigger TEXT NOT NULL,
3492
+ model TEXT,
3493
+ started_at TIMESTAMPTZ NOT NULL DEFAULT now(),
3494
+ finished_at TIMESTAMPTZ,
3495
+ duration_ms BIGINT,
3496
+ input_tokens BIGINT NOT NULL DEFAULT 0,
3497
+ output_tokens BIGINT NOT NULL DEFAULT 0,
3498
+ cache_read_tokens BIGINT NOT NULL DEFAULT 0,
3499
+ cache_write_tokens BIGINT NOT NULL DEFAULT 0,
3500
+ cost_usd DOUBLE PRECISION,
3501
+ status TEXT NOT NULL DEFAULT 'running',
3502
+ detail TEXT,
3503
+ repo TEXT,
3504
+ pr_number INTEGER,
3505
+ reviewer TEXT
3506
+ );
3507
+ CREATE INDEX IF NOT EXISTS job_runs_started_at_idx ON job_runs (started_at);
3508
+ `;
3509
+ var migration0011JobRuns = {
3510
+ id: 11,
3511
+ name: "job-runs",
3512
+ sql: sql14
3513
+ };
3514
+
3451
3515
  // src/shared/db/migrations.ts
3452
3516
  var migrations = [
3453
3517
  migration0001Baseline,
@@ -3459,7 +3523,8 @@ var migrations = [
3459
3523
  migration0007GithubIssue,
3460
3524
  migration0008RepoConfigs,
3461
3525
  migration0009InboxMessages,
3462
- migration0010UserConfig
3526
+ migration0010UserConfig,
3527
+ migration0011JobRuns
3463
3528
  ];
3464
3529
  var latestMigrationId = migrations.reduce(
3465
3530
  (max, m) => Math.max(max, m.id),
@@ -3542,8 +3607,8 @@ async function assertMigrationsInSync(exec3) {
3542
3607
  // src/shared/db/migrations/MigrationExecutor.ts
3543
3608
  function pgExecutor(queryable) {
3544
3609
  return {
3545
- exec: (sql31) => queryable.query(sql31),
3546
- query: async (sql31, params) => (await queryable.query(sql31, params)).rows
3610
+ exec: (sql32) => queryable.query(sql32),
3611
+ query: async (sql32, params) => (await queryable.query(sql32, params)).rows
3547
3612
  };
3548
3613
  }
3549
3614
 
@@ -3717,13 +3782,13 @@ async function loadItem(orm, id) {
3717
3782
  }
3718
3783
 
3719
3784
  // src/commands/backlog/saveAllItems.ts
3720
- import { eq as eq8, sql as sql14 } from "drizzle-orm";
3785
+ import { eq as eq8, sql as sql15 } from "drizzle-orm";
3721
3786
 
3722
3787
  // src/commands/backlog/deleteItemRelations.ts
3723
3788
  import { eq as eq7 } from "drizzle-orm";
3724
3789
 
3725
3790
  // src/commands/backlog/searchItemIds.ts
3726
- import { and as and3, asc as asc5, eq as eq9, ilike, or, sql as sql15 } from "drizzle-orm";
3791
+ import { and as and3, asc as asc5, eq as eq9, ilike, or, sql as sql16 } from "drizzle-orm";
3727
3792
  async function searchItemIds(orm, query, origin) {
3728
3793
  const pattern2 = `%${query}%`;
3729
3794
  const numberPattern = `%${query.replace(/^#/, "")}%`;
@@ -3737,7 +3802,7 @@ async function searchItemIds(orm, query, origin) {
3737
3802
  ilike(items.jiraKey, pattern2),
3738
3803
  ilike(comments.text, pattern2),
3739
3804
  ilike(planPhases.name, pattern2),
3740
- ilike(sql15`${items.id}::text`, numberPattern)
3805
+ ilike(sql16`${items.id}::text`, numberPattern)
3741
3806
  )
3742
3807
  )
3743
3808
  ).orderBy(asc5(items.id));
@@ -3868,7 +3933,7 @@ async function loadDocsRefreshStories(orm, ids) {
3868
3933
  return rows.map((r) => ({
3869
3934
  id: r.id,
3870
3935
  name: r.name,
3871
- summaries: summaries.filter((s) => s.itemId === r.id).map(({ phase, text: text19 }) => ({ phase, text: text19 })),
3936
+ summaries: summaries.filter((s) => s.itemId === r.id).map(({ phase, text: text20 }) => ({ phase, text: text20 })),
3872
3937
  commits: commits2.filter((c) => c.itemId === r.id).map((c) => c.ref)
3873
3938
  }));
3874
3939
  }
@@ -4226,7 +4291,7 @@ async function readJsonBody(req) {
4226
4291
  // src/commands/sessions/web/browser/parseBrowserRequest.ts
4227
4292
  function parseBrowserRequest(body) {
4228
4293
  const fields = body ?? {};
4229
- const { op, url, selector, text: text19, code } = fields;
4294
+ const { op, url, selector, text: text20, code } = fields;
4230
4295
  if (!optionalString(url)) return void 0;
4231
4296
  if (op === "status" || op === "snapshot") return { op, url };
4232
4297
  if (op === "console") return parseConsoleRequest(url, fields);
@@ -4234,7 +4299,7 @@ function parseBrowserRequest(body) {
4234
4299
  return typeof code === "string" && code.trim() ? { op, url, code } : void 0;
4235
4300
  if (op !== "inspect") return void 0;
4236
4301
  if (typeof selector === "string" && selector) return { op, url, selector };
4237
- if (typeof text19 === "string" && text19) return { op, url, text: text19 };
4302
+ if (typeof text20 === "string" && text20) return { op, url, text: text20 };
4238
4303
  return void 0;
4239
4304
  }
4240
4305
  function optionalString(value) {
@@ -4383,8 +4448,8 @@ async function connectMobile(req, res) {
4383
4448
  // src/commands/sessions/shared/readLogTail.ts
4384
4449
  import { closeSync as closeSync2, fstatSync, openSync as openSync2, readSync } from "fs";
4385
4450
  var MAX_TAIL_BYTES = 4 * 1024 * 1024;
4386
- function completeLines(text19, windowIsPartial) {
4387
- const all = text19.split("\n");
4451
+ function completeLines(text20, windowIsPartial) {
4452
+ const all = text20.split("\n");
4388
4453
  if (all.at(-1) === "") all.pop();
4389
4454
  if (windowIsPartial) all.shift();
4390
4455
  return all;
@@ -4880,10 +4945,10 @@ var docsFeedbackSchema = z9.object({
4880
4945
 
4881
4946
  // src/commands/sessions/web/docsFeedback/docsFeedback.ts
4882
4947
  var DOCS_DIR = "docs/src/";
4883
- function respond(res, text19, status2, message3) {
4948
+ function respond(res, text20, status2, message3) {
4884
4949
  recordPromptJournal({
4885
4950
  event: "outcome",
4886
- text: text19,
4951
+ text: text20,
4887
4952
  message: `${status2} ${message3}`
4888
4953
  });
4889
4954
  respondJson(res, status2, status2 === 200 ? { message: message3 } : { error: message3 });
@@ -4897,19 +4962,19 @@ async function docsFeedback(req, res) {
4897
4962
  respondJson(res, 400, { error: "Invalid docs feedback body" });
4898
4963
  return;
4899
4964
  }
4900
- const text19 = docsFeedbackPrompt(parsed.data);
4901
- recordPromptJournal({ event: "received", text: text19 });
4965
+ const text20 = docsFeedbackPrompt(parsed.data);
4966
+ recordPromptJournal({ event: "received", text: text20 });
4902
4967
  const reply2 = await requestDaemonReply(
4903
4968
  {
4904
4969
  type: "type-prompt-to-writer",
4905
4970
  file: parsed.data.source,
4906
4971
  within: DOCS_DIR,
4907
- text: text19
4972
+ text: text20
4908
4973
  },
4909
4974
  "type-prompt-result"
4910
4975
  );
4911
- if (!reply2) respond(res, text19, 504, "assist daemon did not answer");
4912
- else respond(res, text19, reply2.ok ? 200 : 404, reply2.message);
4976
+ if (!reply2) respond(res, text20, 504, "assist daemon did not answer");
4977
+ else respond(res, text20, reply2.ok ? 200 : 404, reply2.message);
4913
4978
  }
4914
4979
 
4915
4980
  // src/commands/sessions/web/fileContent.ts
@@ -5156,7 +5221,7 @@ var azureDevopsPrActions = prActions.filter(
5156
5221
  function isAllowedAzureDevopsPrArgs(args) {
5157
5222
  if (!Array.isArray(args)) return false;
5158
5223
  return azureDevopsPrActions.some(
5159
- (action) => action.args.length === args.length && action.args.every((arg, index2) => arg === args[index2])
5224
+ (action) => action.args.length === args.length && action.args.every((arg, index3) => arg === args[index3])
5160
5225
  );
5161
5226
  }
5162
5227
 
@@ -5255,7 +5320,7 @@ function reviewOptionArgs(options2) {
5255
5320
 
5256
5321
  // src/shared/isAllowedPrArgs.ts
5257
5322
  function sameArgs(a, b) {
5258
- return a.length === b.length && a.every((arg, index2) => arg === b[index2]);
5323
+ return a.length === b.length && a.every((arg, index3) => arg === b[index3]);
5259
5324
  }
5260
5325
  function isOptionFlags(flags2) {
5261
5326
  const options2 = Object.fromEntries(
@@ -5477,13 +5542,13 @@ function segmentText(segment) {
5477
5542
  return "[]";
5478
5543
  }
5479
5544
  function formatConfigPath(path109) {
5480
- let text19 = "";
5545
+ let text20 = "";
5481
5546
  for (const segment of path109) {
5482
5547
  const dotted = segment.kind === "key" || segment.kind === "entry";
5483
5548
  const rendered = segmentText(segment);
5484
- text19 += dotted && text19 ? `.${rendered}` : rendered;
5549
+ text20 += dotted && text20 ? `.${rendered}` : rendered;
5485
5550
  }
5486
- return text19;
5551
+ return text20;
5487
5552
  }
5488
5553
 
5489
5554
  // src/shared/unwrapSchemaNode.ts
@@ -5772,7 +5837,7 @@ function mapChildren(value, path109, childNode, map) {
5772
5837
  }
5773
5838
  function mapItems(value, path109, item, map) {
5774
5839
  if (!Array.isArray(value)) return value;
5775
- return value.map((entry, index2) => walk(entry, [...path109, index2], item, map));
5840
+ return value.map((entry, index3) => walk(entry, [...path109, index3], item, map));
5776
5841
  }
5777
5842
  function walk(value, path109, node, map) {
5778
5843
  if (!node || value === void 0 || value === null) return value;
@@ -5885,25 +5950,25 @@ function bracketSegment(inner) {
5885
5950
  function nameSegment(name) {
5886
5951
  return name === RECORD_ENTRY_TOKEN ? { kind: "entry" } : { kind: "key", name };
5887
5952
  }
5888
- function parseConfigPath(text19) {
5953
+ function parseConfigPath(text20) {
5889
5954
  const path109 = [];
5890
5955
  let at2 = 0;
5891
- while (at2 < text19.length) {
5892
- if (text19[at2] === "[") {
5893
- const close = text19.indexOf("]", at2);
5894
- const segment = close === -1 ? void 0 : bracketSegment(text19.slice(at2 + 1, close));
5956
+ while (at2 < text20.length) {
5957
+ if (text20[at2] === "[") {
5958
+ const close = text20.indexOf("]", at2);
5959
+ const segment = close === -1 ? void 0 : bracketSegment(text20.slice(at2 + 1, close));
5895
5960
  if (!segment) return void 0;
5896
5961
  path109.push(segment);
5897
5962
  at2 = close + 1;
5898
5963
  continue;
5899
5964
  }
5900
- if (text19[at2] === ".") {
5965
+ if (text20[at2] === ".") {
5901
5966
  if (path109.length === 0) return void 0;
5902
5967
  at2 += 1;
5903
5968
  }
5904
5969
  const start2 = at2;
5905
- while (at2 < text19.length && text19[at2] !== "." && text19[at2] !== "[") at2 += 1;
5906
- const name = text19.slice(start2, at2);
5970
+ while (at2 < text20.length && text20[at2] !== "." && text20[at2] !== "[") at2 += 1;
5971
+ const name = text20.slice(start2, at2);
5907
5972
  if (!name) return void 0;
5908
5973
  path109.push(nameSegment(name));
5909
5974
  }
@@ -7370,12 +7435,12 @@ async function deleteItemComment(res, itemId2, commentId) {
7370
7435
  }
7371
7436
 
7372
7437
  // src/commands/backlog/appendComment.ts
7373
- import { sql as sql16 } from "drizzle-orm";
7374
- async function appendComment(orm, itemId2, text19, opts = {}) {
7438
+ import { sql as sql17 } from "drizzle-orm";
7439
+ async function appendComment(orm, itemId2, text20, opts = {}) {
7375
7440
  await orm.insert(comments).values({
7376
7441
  itemId: itemId2,
7377
- idx: sql16`(SELECT COALESCE(MAX(${comments.idx}) + 1, 0) FROM ${comments} WHERE ${comments.itemId} = ${itemId2})`,
7378
- text: text19,
7442
+ idx: sql17`(SELECT COALESCE(MAX(${comments.idx}) + 1, 0) FROM ${comments} WHERE ${comments.itemId} = ${itemId2})`,
7443
+ text: text20,
7379
7444
  phase: opts.phase ?? null,
7380
7445
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
7381
7446
  type: opts.type ?? "comment"
@@ -7831,8 +7896,8 @@ import * as fs3 from "fs";
7831
7896
  import * as path5 from "path";
7832
7897
 
7833
7898
  // src/commands/sessions/shared/backlogRunMarkers.ts
7834
- function backlogRunMarkers(text19) {
7835
- const match = text19.match(/backlog item a(\d+):[ \t]*([^\n]*)/);
7899
+ function backlogRunMarkers(text20) {
7900
+ const match = text20.match(/backlog item a(\d+):[ \t]*([^\n]*)/);
7836
7901
  if (!match) return { commandName: "", commandArgs: "" };
7837
7902
  const title = match[2].trim();
7838
7903
  return {
@@ -7972,7 +8037,7 @@ import * as fs4 from "fs";
7972
8037
  function extractSessionMeta(lines2) {
7973
8038
  let sessionId = "";
7974
8039
  let cwd = "";
7975
- let timestamp8 = "";
8040
+ let timestamp9 = "";
7976
8041
  let name = "";
7977
8042
  let commandName = "";
7978
8043
  let commandArgs = "";
@@ -7980,14 +8045,14 @@ function extractSessionMeta(lines2) {
7980
8045
  const entry = safeParse(line);
7981
8046
  if (!entry) continue;
7982
8047
  sessionId ||= strField(entry, "sessionId");
7983
- timestamp8 ||= strField(entry, "timestamp");
8048
+ timestamp9 ||= strField(entry, "timestamp");
7984
8049
  cwd ||= strField(entry, "cwd");
7985
8050
  if (entry.type === "user" && !entry.isMeta) {
7986
8051
  ({ name, commandName, commandArgs } = parseFirstUserEntry(entry));
7987
8052
  break;
7988
8053
  }
7989
8054
  }
7990
- return { sessionId, cwd, timestamp: timestamp8, name, commandName, commandArgs };
8055
+ return { sessionId, cwd, timestamp: timestamp9, name, commandName, commandArgs };
7991
8056
  }
7992
8057
  function parseFirstUserEntry(entry) {
7993
8058
  const raw = messageText(entry);
@@ -8013,11 +8078,11 @@ function messageText(entry) {
8013
8078
  const content = msg?.content;
8014
8079
  return typeof content === "string" ? content : Array.isArray(content) ? content.find((c) => c.type === "text")?.text ?? "" : "";
8015
8080
  }
8016
- function stripMarkers(text19) {
8017
- return text19.replace(/<command-[^>]*>[^<]*<\/command-[^>]*>/g, "").trim().slice(0, 80);
8081
+ function stripMarkers(text20) {
8082
+ return text20.replace(/<command-[^>]*>[^<]*<\/command-[^>]*>/g, "").trim().slice(0, 80);
8018
8083
  }
8019
- function matchMarker(text19, tag) {
8020
- const match = text19.match(new RegExp(`<${tag}>([\\s\\S]*?)</${tag}>`));
8084
+ function matchMarker(text20, tag) {
8085
+ const match = text20.match(new RegExp(`<${tag}>([\\s\\S]*?)</${tag}>`));
8021
8086
  return match ? match[1].trim() : "";
8022
8087
  }
8023
8088
 
@@ -8040,13 +8105,13 @@ async function parseSessionFile(filePath, origin = "wsl") {
8040
8105
  handle = await fs4.promises.open(filePath, "r");
8041
8106
  const meta = extractSessionMeta(await readHeadLines(handle));
8042
8107
  if (!meta.sessionId) return null;
8043
- const timestamp8 = meta.timestamp || (await fs4.promises.stat(filePath)).mtime.toISOString();
8108
+ const timestamp9 = meta.timestamp || (await fs4.promises.stat(filePath)).mtime.toISOString();
8044
8109
  return {
8045
8110
  sessionId: meta.sessionId,
8046
8111
  name: meta.name || `Session ${meta.sessionId.slice(0, 8)}`,
8047
8112
  project: deriveProject(meta.cwd, filePath, origin),
8048
8113
  cwd: meta.cwd,
8049
- timestamp: timestamp8,
8114
+ timestamp: timestamp9,
8050
8115
  origin,
8051
8116
  ...deriveHistoryFields(meta.commandName, meta.commandArgs, meta.name)
8052
8117
  };
@@ -8579,11 +8644,11 @@ async function inboxStatus(_req, res) {
8579
8644
  }
8580
8645
 
8581
8646
  // src/shared/db/listInboxMessages.ts
8582
- import { desc as desc3, isNull as isNull2, sql as sql17 } from "drizzle-orm";
8647
+ import { desc as desc3, isNull as isNull2, sql as sql18 } from "drizzle-orm";
8583
8648
  function listInboxMessages(orm) {
8584
8649
  return orm.select().from(inboxMessages).where(isNull2(inboxMessages.dismissedAt)).orderBy(
8585
8650
  desc3(
8586
- sql17`coalesce(${inboxMessages.receivedAt}, ${inboxMessages.flaggedAt})`
8651
+ sql18`coalesce(${inboxMessages.receivedAt}, ${inboxMessages.flaggedAt})`
8587
8652
  )
8588
8653
  );
8589
8654
  }
@@ -8652,14 +8717,14 @@ var BOUNDARY_BONUS = 10;
8652
8717
  var CONSECUTIVE_BONUS = 8;
8653
8718
  var MAX_GAP_PENALTY = 6;
8654
8719
  var MAX_LENGTH_PENALTY = 100;
8655
- function isBoundary(text19, index2) {
8656
- if (index2 === 0) return true;
8657
- const previous = text19[index2 - 1] ?? "";
8720
+ function isBoundary(text20, index3) {
8721
+ if (index3 === 0) return true;
8722
+ const previous = text20[index3 - 1] ?? "";
8658
8723
  if (!/[A-Za-z0-9]/.test(previous)) return true;
8659
- return /[a-z0-9]/.test(previous) && /[A-Z]/.test(text19[index2] ?? "");
8724
+ return /[a-z0-9]/.test(previous) && /[A-Z]/.test(text20[index3] ?? "");
8660
8725
  }
8661
- function subsequenceScore(text19, query) {
8662
- const lower = text19.toLowerCase();
8726
+ function subsequenceScore(text20, query) {
8727
+ const lower = text20.toLowerCase();
8663
8728
  let score = 0;
8664
8729
  let cursor = 0;
8665
8730
  let previous = -1;
@@ -8667,13 +8732,13 @@ function subsequenceScore(text19, query) {
8667
8732
  const at2 = lower.indexOf(char, cursor);
8668
8733
  if (at2 === -1) return null;
8669
8734
  if (at2 === previous + 1) score += CONSECUTIVE_BONUS;
8670
- if (isBoundary(text19, at2)) score += BOUNDARY_BONUS;
8735
+ if (isBoundary(text20, at2)) score += BOUNDARY_BONUS;
8671
8736
  if (at2 === 0) score += START_BONUS;
8672
8737
  score -= Math.min(at2 - cursor, MAX_GAP_PENALTY);
8673
8738
  previous = at2;
8674
8739
  cursor = at2 + 1;
8675
8740
  }
8676
- return score - Math.min(text19.length, MAX_LENGTH_PENALTY);
8741
+ return score - Math.min(text20.length, MAX_LENGTH_PENALTY);
8677
8742
  }
8678
8743
  function scoreFilePath(path109, query) {
8679
8744
  const needle = query.trim().toLowerCase();
@@ -8768,9 +8833,9 @@ function excerpt(xml, ...tags) {
8768
8833
  for (const tag of tags) {
8769
8834
  const raw = extractText(xml, tag);
8770
8835
  if (!raw) continue;
8771
- const text19 = stripHtml(raw);
8772
- if (text19.length <= MAX_EXCERPT) return text19;
8773
- return `${text19.slice(0, MAX_EXCERPT)}\u2026`;
8836
+ const text20 = stripHtml(raw);
8837
+ if (text20.length <= MAX_EXCERPT) return text20;
8838
+ return `${text20.slice(0, MAX_EXCERPT)}\u2026`;
8774
8839
  }
8775
8840
  return "";
8776
8841
  }
@@ -9140,8 +9205,8 @@ async function fetchOpenPrs(cwd, repo, peers) {
9140
9205
 
9141
9206
  // src/commands/sessions/web/next/compareBoardOrder.ts
9142
9207
  function compareBoardOrder(a, b) {
9143
- for (let index2 = 0; index2 < Math.min(a.length, b.length); index2++)
9144
- if (a[index2] !== b[index2]) return a[index2] - b[index2];
9208
+ for (let index3 = 0; index3 < Math.min(a.length, b.length); index3++)
9209
+ if (a[index3] !== b[index3]) return a[index3] - b[index3];
9145
9210
  return a.length - b.length;
9146
9211
  }
9147
9212
 
@@ -9154,10 +9219,10 @@ function ghErrorText(error) {
9154
9219
 
9155
9220
  // src/commands/sessions/web/next/projectErrorText.ts
9156
9221
  function projectErrorText(error) {
9157
- const text19 = ghErrorText(error);
9158
- if (/read:project|required scopes/i.test(text19))
9222
+ const text20 = ghErrorText(error);
9223
+ if (/read:project|required scopes/i.test(text20))
9159
9224
  return "The gh token has no project scope, so the project cannot be read. Run: gh auth refresh -h github.com -s project";
9160
- return text19;
9225
+ return text20;
9161
9226
  }
9162
9227
 
9163
9228
  // src/commands/sessions/web/next/pickupsQuery.ts
@@ -9248,10 +9313,10 @@ async function sectionAcross(repos2, load2, compare) {
9248
9313
  const results = await Promise.allSettled(repos2.map((repo) => load2(repo)));
9249
9314
  const items2 = /* @__PURE__ */ new Map();
9250
9315
  const errors = [];
9251
- results.forEach((result, index2) => {
9316
+ results.forEach((result, index3) => {
9252
9317
  if (result.status === "fulfilled")
9253
9318
  for (const item of result.value) items2.set(item.url, item);
9254
- else errors.push(`${repos2[index2]}: ${ghErrorText(result.reason)}`);
9319
+ else errors.push(`${repos2[index3]}: ${ghErrorText(result.reason)}`);
9255
9320
  });
9256
9321
  return {
9257
9322
  items: [...items2.values()].sort(compare),
@@ -9661,8 +9726,8 @@ function splitTitle(rest) {
9661
9726
  const match = RULE_TITLE.exec(rest);
9662
9727
  if (!match) return { text: rest };
9663
9728
  const title = match[1].trim();
9664
- const text19 = match[2].trim();
9665
- return title === "" || text19 === "" ? { text: rest } : { title, text: text19 };
9729
+ const text20 = match[2].trim();
9730
+ return title === "" || text20 === "" ? { text: rest } : { title, text: text20 };
9666
9731
  }
9667
9732
  function parseRulesSection(content) {
9668
9733
  const lines2 = content.split(/\r?\n/);
@@ -9748,12 +9813,12 @@ async function countUsagePeaks(db, window) {
9748
9813
  import { and as and10, desc as desc4, eq as eq23, getTableColumns } from "drizzle-orm";
9749
9814
 
9750
9815
  // src/shared/db/avgContextPerCycle.ts
9751
- import { count as count2, sql as sql18 } from "drizzle-orm";
9816
+ import { count as count2, sql as sql19 } from "drizzle-orm";
9752
9817
  function avgContextPerCycle(db) {
9753
9818
  return db.select({
9754
9819
  window: phaseCycleContext.window,
9755
9820
  resetsAt: phaseCycleContext.resetsAt,
9756
- avgContextPct: sql18`cast(avg(${phaseCycleContext.peakContextPct}) as double precision)`.as(
9821
+ avgContextPct: sql19`cast(avg(${phaseCycleContext.peakContextPct}) as double precision)`.as(
9757
9822
  "avg_context_pct"
9758
9823
  ),
9759
9824
  phaseCount: count2().as("phase_count")
@@ -9842,10 +9907,10 @@ function listUsageHistory(req, res) {
9842
9907
  }
9843
9908
 
9844
9909
  // src/shared/db/countItemUsageByOrigin.ts
9845
- import { asc as asc9, desc as desc5, eq as eq24, sql as sql19 } from "drizzle-orm";
9910
+ import { asc as asc9, desc as desc5, eq as eq24, sql as sql20 } from "drizzle-orm";
9846
9911
  async function countItemUsageByOrigin(db) {
9847
- const count10 = sql19`count(distinct ${phaseUsage.itemId})::int`;
9848
- const rows = await db.select({ origin: items.origin, count: count10 }).from(items).innerJoin(phaseUsage, eq24(phaseUsage.itemId, items.id)).groupBy(items.origin).orderBy(desc5(count10), asc9(items.origin));
9912
+ const count11 = sql20`count(distinct ${phaseUsage.itemId})::int`;
9913
+ const rows = await db.select({ origin: items.origin, count: count11 }).from(items).innerJoin(phaseUsage, eq24(phaseUsage.itemId, items.id)).groupBy(items.origin).orderBy(desc5(count11), asc9(items.origin));
9849
9914
  return rows.map((row3) => ({ origin: row3.origin, count: Number(row3.count) }));
9850
9915
  }
9851
9916
 
@@ -9886,22 +9951,22 @@ function parseItemUsageSort(field, direction) {
9886
9951
  }
9887
9952
 
9888
9953
  // src/shared/db/itemUsageStats.ts
9889
- import { eq as eq26, sql as sql20 } from "drizzle-orm";
9954
+ import { eq as eq26, sql as sql21 } from "drizzle-orm";
9890
9955
  function median(value) {
9891
- return sql20`coalesce(percentile_cont(0.5) within group (order by (${value})::double precision), 0)`;
9956
+ return sql21`coalesce(percentile_cont(0.5) within group (order by (${value})::double precision), 0)`;
9892
9957
  }
9893
9958
  async function itemUsageStats(db, options2) {
9894
9959
  const totals = phaseUsageTotals(db);
9895
9960
  const planned = planPhaseCounts(db);
9896
9961
  const [row3] = await db.select({
9897
- itemCount: sql20`count(*)::int`,
9898
- doneCount: sql20`count(*) filter (where ${items.status} = 'done')::int`,
9899
- repoCount: sql20`count(distinct ${items.origin})::int`,
9962
+ itemCount: sql21`count(*)::int`,
9963
+ doneCount: sql21`count(*) filter (where ${items.status} = 'done')::int`,
9964
+ repoCount: sql21`count(distinct ${items.origin})::int`,
9900
9965
  medianPhases: median(
9901
- sql20`coalesce(${planned.count}, ${totals.recordedPhases})`
9966
+ sql21`coalesce(${planned.count}, ${totals.recordedPhases})`
9902
9967
  ),
9903
9968
  medianActiveMs: median(totals.activeMs),
9904
- medianTokens: median(sql20`${totals.tokensUp} + ${totals.tokensDown}`)
9969
+ medianTokens: median(sql21`${totals.tokensUp} + ${totals.tokensDown}`)
9905
9970
  }).from(items).innerJoin(totals, eq26(totals.itemId, items.id)).leftJoin(planned, eq26(planned.itemId, items.id)).where(itemUsageWhere(options2));
9906
9971
  return {
9907
9972
  itemCount: Number(row3?.itemCount ?? 0),
@@ -9917,27 +9982,27 @@ async function itemUsageStats(db, options2) {
9917
9982
  import { eq as eq27 } from "drizzle-orm";
9918
9983
 
9919
9984
  // src/shared/db/itemUsageOrderBy.ts
9920
- import { desc as desc6, sql as sql21 } from "drizzle-orm";
9985
+ import { desc as desc6, sql as sql22 } from "drizzle-orm";
9921
9986
  function itemUsageOrderBy(joins, sort = defaultItemUsageSort) {
9922
9987
  const { totals, planned, lastPhase } = joins;
9923
9988
  const sortable = {
9924
- phases: sql21`coalesce(${planned.count}, ${totals.recordedPhases})`,
9925
- active: sql21`${totals.activeMs}`,
9926
- tokens: sql21`${totals.tokensUp} + ${totals.tokensDown}`,
9927
- peakContext: sql21`${totals.peakContextPct}`,
9928
- lastPhase: sql21`${lastPhase.at}`
9989
+ phases: sql22`coalesce(${planned.count}, ${totals.recordedPhases})`,
9990
+ active: sql22`${totals.activeMs}`,
9991
+ tokens: sql22`${totals.tokensUp} + ${totals.tokensDown}`,
9992
+ peakContext: sql22`${totals.peakContextPct}`,
9993
+ lastPhase: sql22`${lastPhase.at}`
9929
9994
  };
9930
- const order = sort.direction === "asc" ? sql21`asc` : sql21`desc`;
9931
- return [sql21`${sortable[sort.field]} ${order} nulls last`, desc6(items.id)];
9995
+ const order = sort.direction === "asc" ? sql22`asc` : sql22`desc`;
9996
+ return [sql22`${sortable[sort.field]} ${order} nulls last`, desc6(items.id)];
9932
9997
  }
9933
9998
 
9934
9999
  // src/shared/db/lastPhaseActivity.ts
9935
- import { sql as sql22 } from "drizzle-orm";
10000
+ import { sql as sql23 } from "drizzle-orm";
9936
10001
  function lastPhaseActivity(db) {
9937
10002
  return db.select({
9938
10003
  itemId: phaseSessions.itemId,
9939
- at: sql22`max(${phaseSessions.createdAt})`.as("last_phase_at"),
9940
- atIso: sql22`to_char(max(${phaseSessions.createdAt}) at time zone 'utc', 'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"')`.as(
10004
+ at: sql23`max(${phaseSessions.createdAt})`.as("last_phase_at"),
10005
+ atIso: sql23`to_char(max(${phaseSessions.createdAt}) at time zone 'utc', 'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"')`.as(
9941
10006
  "last_phase_at_iso"
9942
10007
  )
9943
10008
  }).from(phaseSessions).groupBy(phaseSessions.itemId).as("last_phase_activity");
@@ -10001,6 +10066,25 @@ function listUsageItems(req, res) {
10001
10066
  });
10002
10067
  }
10003
10068
 
10069
+ // src/shared/db/listJobRuns.ts
10070
+ import { count as count3, desc as desc7 } from "drizzle-orm";
10071
+ async function listJobRuns(db, range) {
10072
+ const [rows, [{ total: total2 }]] = await Promise.all([
10073
+ db.select().from(jobRuns).orderBy(desc7(jobRuns.startedAt), desc7(jobRuns.id)).limit(range.limit).offset(range.offset),
10074
+ db.select({ total: count3() }).from(jobRuns)
10075
+ ]);
10076
+ return { rows, total: total2 };
10077
+ }
10078
+
10079
+ // src/commands/sessions/web/listUsageJobs.ts
10080
+ function listUsageJobs(req, res) {
10081
+ return respondPagedRows(
10082
+ req,
10083
+ res,
10084
+ async (range) => listJobRuns(await getDb(), range)
10085
+ );
10086
+ }
10087
+
10004
10088
  // src/commands/sessions/web/openInCode.ts
10005
10089
  import { exec } from "child_process";
10006
10090
  import { promisify as promisify7 } from "util";
@@ -10217,7 +10301,7 @@ function mainlineCommits(commits2) {
10217
10301
  // src/commands/sessions/web/releases/pullRequestsQuery.ts
10218
10302
  function pullRequestsQuery(shas) {
10219
10303
  const lookups = shas.map(
10220
- (sha, index2) => `c${index2}: object(oid:${JSON.stringify(sha)}){ ... on Commit { associatedPullRequests(first:5){ nodes{ number title url author{ login } mergeCommit{ oid } } } } }`
10304
+ (sha, index3) => `c${index3}: object(oid:${JSON.stringify(sha)}){ ... on Commit { associatedPullRequests(first:5){ nodes{ number title url author{ login } mergeCommit{ oid } } } } }`
10221
10305
  );
10222
10306
  return `query($owner:String!,$name:String!){
10223
10307
  repository(owner:$owner,name:$name){ ${lookups.join(" ")} }
@@ -10240,8 +10324,8 @@ async function mergedPullRequests(cwd, repo, shas) {
10240
10324
  `name=${name}`
10241
10325
  ]);
10242
10326
  const repository = response.data?.repository;
10243
- for (const [index2, sha] of shas.entries()) {
10244
- const nodes = repository?.[`c${index2}`]?.associatedPullRequests?.nodes;
10327
+ for (const [index3, sha] of shas.entries()) {
10328
+ const nodes = repository?.[`c${index3}`]?.associatedPullRequests?.nodes;
10245
10329
  const pr = nodes?.find((node) => node.mergeCommit?.oid === sha);
10246
10330
  if (pr)
10247
10331
  merged.set(sha, {
@@ -10391,7 +10475,7 @@ function repoEnvironments(streams) {
10391
10475
  // src/commands/sessions/web/releases/commitsBehind.ts
10392
10476
  function compareQuery(shas) {
10393
10477
  const compares = shas.map(
10394
- (sha, index2) => `c${index2}: compare(headRef:${JSON.stringify(sha)}){ behindBy }`
10478
+ (sha, index3) => `c${index3}: compare(headRef:${JSON.stringify(sha)}){ behindBy }`
10395
10479
  );
10396
10480
  return `query($owner:String!,$name:String!,$base:String!){
10397
10481
  repository(owner:$owner,name:$name){
@@ -10417,9 +10501,9 @@ async function commitsBehind(cwd, repo, base, shas) {
10417
10501
  `base=refs/heads/${base}`
10418
10502
  ]);
10419
10503
  const ref = response.data?.repository?.ref;
10420
- for (const [index2, sha] of shas.entries()) {
10421
- const count10 = ref?.[`c${index2}`]?.behindBy;
10422
- behind.set(sha, typeof count10 === "number" ? count10 : null);
10504
+ for (const [index3, sha] of shas.entries()) {
10505
+ const count11 = ref?.[`c${index3}`]?.behindBy;
10506
+ behind.set(sha, typeof count11 === "number" ? count11 : null);
10423
10507
  }
10424
10508
  } catch {
10425
10509
  return behind;
@@ -10515,11 +10599,11 @@ function deploymentMaps(nodes) {
10515
10599
  // src/commands/sessions/web/releases/deploymentsQuery.ts
10516
10600
  var DEPLOYMENTS_PER_ENVIRONMENT = 50;
10517
10601
  var COMMIT_FIELDS = "oid messageHeadline author{ name }";
10518
- function deploymentsAlias(index2) {
10519
- return `env${index2}`;
10602
+ function deploymentsAlias(index3) {
10603
+ return `env${index3}`;
10520
10604
  }
10521
- function environmentDeployments(environment, index2) {
10522
- return `${deploymentsAlias(index2)}: deployments(environments:${JSON.stringify([environment])}, last:${DEPLOYMENTS_PER_ENVIRONMENT}, orderBy:{field:CREATED_AT,direction:ASC}){
10605
+ function environmentDeployments(environment, index3) {
10606
+ return `${deploymentsAlias(index3)}: deployments(environments:${JSON.stringify([environment])}, last:${DEPLOYMENTS_PER_ENVIRONMENT}, orderBy:{field:CREATED_AT,direction:ASC}){
10523
10607
  nodes{ environment createdAt commitOid commit{ ${COMMIT_FIELDS} } latestStatus{ state createdAt logUrl } }
10524
10608
  }`;
10525
10609
  }
@@ -10536,10 +10620,10 @@ function deploymentsQuery(environments) {
10536
10620
  function headCommit2(node) {
10537
10621
  return node?.oid ? releaseCommit(node.oid, node) : null;
10538
10622
  }
10539
- function environmentNodes(repository, count10) {
10623
+ function environmentNodes(repository, count11) {
10540
10624
  return Array.from(
10541
- { length: count10 },
10542
- (_, index2) => repository[deploymentsAlias(index2)]?.nodes ?? []
10625
+ { length: count11 },
10626
+ (_, index3) => repository[deploymentsAlias(index3)]?.nodes ?? []
10543
10627
  ).flat();
10544
10628
  }
10545
10629
  async function liveDeployments(cwd, repo, environments) {
@@ -10582,8 +10666,8 @@ async function latestRun(cwd, repo, workflow) {
10582
10666
  }
10583
10667
 
10584
10668
  // src/commands/sessions/web/releases/releaseJobTokens.ts
10585
- function normaliseJobName(text19) {
10586
- return ` ${text19.toLowerCase().replaceAll(/[^a-z0-9]+/g, " ").trim()} `;
10669
+ function normaliseJobName(text20) {
10670
+ return ` ${text20.toLowerCase().replaceAll(/[^a-z0-9]+/g, " ").trim()} `;
10587
10671
  }
10588
10672
  function releaseJobTokens(node) {
10589
10673
  const candidates = [node.environment, node.label, node.id].filter(
@@ -10627,14 +10711,14 @@ function runJobState(job) {
10627
10711
 
10628
10712
  // src/commands/sessions/web/releases/matchRunJobs.ts
10629
10713
  function mostSpecificFirst(nodes) {
10630
- return nodes.map((node, index2) => ({ node, index: index2, tokens: releaseJobTokens(node) })).sort(
10714
+ return nodes.map((node, index3) => ({ node, index: index3, tokens: releaseJobTokens(node) })).sort(
10631
10715
  (a, b) => (b.tokens[0]?.length ?? 0) - (a.tokens[0]?.length ?? 0) || a.index - b.index
10632
10716
  );
10633
10717
  }
10634
10718
  function firstUnclaimed(names, claimed, tokens) {
10635
10719
  for (const token of tokens)
10636
- for (const [index2, name] of names.entries())
10637
- if (!claimed.has(index2) && name.includes(token)) return index2;
10720
+ for (const [index3, name] of names.entries())
10721
+ if (!claimed.has(index3) && name.includes(token)) return index3;
10638
10722
  return void 0;
10639
10723
  }
10640
10724
  function matchRunJobs(nodes, jobs) {
@@ -11574,7 +11658,7 @@ function scrubConfigSecrets(messages, value, node) {
11574
11658
  if (needles.length === 0) return messages;
11575
11659
  return messages.map(
11576
11660
  (message3) => needles.reduce(
11577
- (text19, needle) => text19.split(needle).join(SECRET_MASK),
11661
+ (text20, needle) => text20.split(needle).join(SECRET_MASK),
11578
11662
  message3
11579
11663
  )
11580
11664
  );
@@ -12347,8 +12431,8 @@ var ANSI = new RegExp(
12347
12431
  `${String.fromCharCode(27)}\\[[0-9;?]*[ -/]*[@-~]`,
12348
12432
  "g"
12349
12433
  );
12350
- function stripAnsi(text19) {
12351
- return text19.replace(ANSI, "");
12434
+ function stripAnsi(text20) {
12435
+ return text20.replace(ANSI, "");
12352
12436
  }
12353
12437
 
12354
12438
  // src/commands/sessions/daemon/worktree/watcherLogPath.ts
@@ -12805,6 +12889,7 @@ var routes2 = {
12805
12889
  "GET /api/releases/compare": releasesCompare,
12806
12890
  "GET /api/usage/history": listUsageHistory,
12807
12891
  "GET /api/usage/items": listUsageItems,
12892
+ "GET /api/usage/jobs": listUsageJobs,
12808
12893
  "GET /api/backups/list": getBackups,
12809
12894
  "GET /api/backups/status": getBackupStatus,
12810
12895
  "GET /api/config": getConfig,
@@ -12960,10 +13045,10 @@ function createMenuState(items2, log2) {
12960
13045
  render2();
12961
13046
  },
12962
13047
  selectedItem: () => items2[selected],
12963
- jumpTo(index2) {
12964
- const item = items2[index2];
13048
+ jumpTo(index3) {
13049
+ const item = items2[index3];
12965
13050
  if (!item) return false;
12966
- selected = index2;
13051
+ selected = index3;
12967
13052
  render2();
12968
13053
  return !item.disabled;
12969
13054
  }
@@ -13543,8 +13628,8 @@ var options = [
13543
13628
  ];
13544
13629
 
13545
13630
  // src/commands/verify/init/getAvailableOptions.ts
13546
- function resolveDescription(desc7, setup) {
13547
- return typeof desc7 === "function" ? desc7(setup) : desc7;
13631
+ function resolveDescription(desc8, setup) {
13632
+ return typeof desc8 === "function" ? desc8(setup) : desc8;
13548
13633
  }
13549
13634
  function toVerifyOption(def, setup) {
13550
13635
  return {
@@ -14894,13 +14979,13 @@ async function activity(options2) {
14894
14979
  const activeDays = data.filter((d) => d.count > 0).length;
14895
14980
  console.log(`${total2} commits across ${activeDays} active days.`);
14896
14981
  const weekly = /* @__PURE__ */ new Map();
14897
- for (const { date, count: count10 } of data) {
14982
+ for (const { date, count: count11 } of data) {
14898
14983
  const d = new Date(date);
14899
14984
  d.setDate(d.getDate() - d.getDay());
14900
14985
  const weekStart = d.toISOString().slice(0, 10);
14901
- weekly.set(weekStart, (weekly.get(weekStart) ?? 0) + count10);
14986
+ weekly.set(weekStart, (weekly.get(weekStart) ?? 0) + count11);
14902
14987
  }
14903
- const weeklyData = [...weekly.entries()].map(([date, count10]) => ({ date, count: count10 })).sort((a, b) => a.date.localeCompare(b.date));
14988
+ const weeklyData = [...weekly.entries()].map(([date, count11]) => ({ date, count: count11 })).sort((a, b) => a.date.localeCompare(b.date));
14904
14989
  const until = data[data.length - 1].date;
14905
14990
  renderLineChart({
14906
14991
  title: "Commit Activity",
@@ -15128,7 +15213,7 @@ ${extra}`);
15128
15213
  sections.push(
15129
15214
  `## Your rules
15130
15215
 
15131
- ${rules2.map(({ title, text: text19 }) => `- **${title}** \u2014 ${text19}`).join("\n")}`
15216
+ ${rules2.map(({ title, text: text20 }) => `- **${title}** \u2014 ${text20}`).join("\n")}`
15132
15217
  );
15133
15218
  if (sections.length === 0) return "";
15134
15219
  return [heading, ...sections].join("\n\n");
@@ -15489,12 +15574,12 @@ import { randomUUID as randomUUID4 } from "crypto";
15489
15574
 
15490
15575
  // src/commands/sessions/shared/askCheckInputSchema.ts
15491
15576
  import { z as z10 } from "zod";
15492
- var text16 = z10.string().trim().min(1);
15577
+ var text17 = z10.string().trim().min(1);
15493
15578
  var askCheckInputSchema = z10.object({
15494
- title: text16,
15495
- steps: z10.array(text16).min(1, "Give at least 1 step"),
15496
- before: z10.array(text16).optional(),
15497
- changed: text16.optional()
15579
+ title: text17,
15580
+ steps: z10.array(text17).min(1, "Give at least 1 step"),
15581
+ before: z10.array(text17).optional(),
15582
+ changed: text17.optional()
15498
15583
  });
15499
15584
  var CHECK_RESULT_KEY = "result";
15500
15585
  var CHECK_NOTE_KEY = "note";
@@ -15663,8 +15748,8 @@ function formatAskQuestionAnswers(questions, answers) {
15663
15748
 
15664
15749
  // src/commands/askQuestion/rejectLongQuestions.ts
15665
15750
  var MAX_QUESTION_WORDS = 30;
15666
- function countWords(text19) {
15667
- return text19.split(/\s+/).filter(Boolean).length;
15751
+ function countWords(text20) {
15752
+ return text20.split(/\s+/).filter(Boolean).length;
15668
15753
  }
15669
15754
  function rejectLongQuestions(questions) {
15670
15755
  const longQuestions = questions.map((q) => ({ header: q.header, words: countWords(q.question) })).filter((q) => q.words > MAX_QUESTION_WORDS);
@@ -15984,8 +16069,8 @@ async function buildDump(tables, copyOut) {
15984
16069
  // src/commands/backlog/dump/copyTableOut.ts
15985
16070
  import { to as copyTo } from "pg-copy-streams";
15986
16071
  async function copyTableOut(client, table) {
15987
- const sql31 = `COPY ${table.name} (${table.columns.join(", ")}) TO STDOUT`;
15988
- const stream = client.query(copyTo(sql31));
16072
+ const sql32 = `COPY ${table.name} (${table.columns.join(", ")}) TO STDOUT`;
16073
+ const stream = client.query(copyTo(sql32));
15989
16074
  const chunks = [];
15990
16075
  for await (const chunk of stream) {
15991
16076
  chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
@@ -16097,8 +16182,8 @@ async function backup({ out }) {
16097
16182
  const dir = expandTilde(out ?? loadConfig().backup.dir);
16098
16183
  await mkdir3(dir, { recursive: true });
16099
16184
  const start2 = Date.now();
16100
- const timestamp8 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
16101
- const filePath = resolve15(join44(dir, `backup-${timestamp8}.dump`));
16185
+ const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
16186
+ const filePath = resolve15(join44(dir, `backup-${timestamp9}.dump`));
16102
16187
  await exportBacklog(filePath);
16103
16188
  const { size } = await stat4(filePath);
16104
16189
  const durationMs = Date.now() - start2;
@@ -16691,10 +16776,10 @@ function registerCloneCommand(cmd) {
16691
16776
 
16692
16777
  // src/commands/backlog/comment.ts
16693
16778
  import chalk49 from "chalk";
16694
- async function comment(id, text19) {
16779
+ async function comment(id, text20) {
16695
16780
  const found = await findOneItem(id);
16696
16781
  if (!found) process.exit(1);
16697
- await appendComment(found.orm, found.item.id, text19);
16782
+ await appendComment(found.orm, found.item.id, text20);
16698
16783
  console.log(
16699
16784
  chalk49.green(`Comment added to item ${formatItemId(found.item.id)}.`)
16700
16785
  );
@@ -16796,10 +16881,10 @@ import chalk54 from "chalk";
16796
16881
  // src/commands/backlog/dump/countCopyRows.ts
16797
16882
  function countCopyRows(data) {
16798
16883
  let rows = 0;
16799
- let index2 = data.indexOf(10);
16800
- while (index2 !== -1) {
16884
+ let index3 = data.indexOf(10);
16885
+ while (index3 !== -1) {
16801
16886
  rows++;
16802
- index2 = data.indexOf(10, index2 + 1);
16887
+ index3 = data.indexOf(10, index3 + 1);
16803
16888
  }
16804
16889
  return rows;
16805
16890
  }
@@ -16815,9 +16900,9 @@ function readLine(dump, start2) {
16815
16900
  return { text: dump.subarray(start2, eol).toString("utf8"), next: eol + 1 };
16816
16901
  }
16817
16902
  function parseHeader(dump) {
16818
- const { text: text19, next: next3 } = readLine(dump, 0);
16903
+ const { text: text20, next: next3 } = readLine(dump, 0);
16819
16904
  try {
16820
- return { header: JSON.parse(text19), bodyStart: next3 };
16905
+ return { header: JSON.parse(text20), bodyStart: next3 };
16821
16906
  } catch {
16822
16907
  return invalid("header is not valid JSON.");
16823
16908
  }
@@ -16826,9 +16911,9 @@ function parseSections(dump, bodyStart) {
16826
16911
  const sections = /* @__PURE__ */ new Map();
16827
16912
  let cursor = bodyStart;
16828
16913
  while (cursor < dump.length) {
16829
- const { text: text19, next: next3 } = readLine(dump, cursor);
16830
- const match = text19.match(/^@table (\S+) (\d+)$/);
16831
- if (!match) invalid(`malformed table marker "${text19}".`);
16914
+ const { text: text20, next: next3 } = readLine(dump, cursor);
16915
+ const match = text20.match(/^@table (\S+) (\d+)$/);
16916
+ if (!match) invalid(`malformed table marker "${text20}".`);
16832
16917
  const [, name, bytes] = match;
16833
16918
  const end = next3 + Number(bytes);
16834
16919
  if (end > dump.length) invalid(`section "${name}" overruns the dump.`);
@@ -16895,8 +16980,8 @@ async function confirmReplace(client, tables, incoming, fromStdin) {
16895
16980
  import { finished } from "stream/promises";
16896
16981
  import { from as copyFrom } from "pg-copy-streams";
16897
16982
  async function copyTableIn(client, table, data) {
16898
- const sql31 = `COPY ${table.name} (${table.columns.join(", ")}) FROM STDIN`;
16899
- const stream = client.query(copyFrom(sql31));
16983
+ const sql32 = `COPY ${table.name} (${table.columns.join(", ")}) FROM STDIN`;
16984
+ const stream = client.query(copyFrom(sql32));
16900
16985
  stream.end(data);
16901
16986
  await finished(stream);
16902
16987
  }
@@ -16941,8 +17026,8 @@ async function replaceData(client, parsed) {
16941
17026
  await copyTableIn(client, table, data);
16942
17027
  }
16943
17028
  for (const col of await introspectIdentityColumns(client)) {
16944
- const { text: text19, values } = resyncIdentitySql(col);
16945
- await client.query(text19, values);
17029
+ const { text: text20, values } = resyncIdentitySql(col);
17030
+ await client.query(text20, values);
16946
17031
  }
16947
17032
  }
16948
17033
  async function restore(client, parsed) {
@@ -17144,9 +17229,9 @@ import chalk58 from "chalk";
17144
17229
 
17145
17230
  // src/commands/backlog/resolveInsertPosition.ts
17146
17231
  import chalk57 from "chalk";
17147
- import { count as count3, eq as eq33 } from "drizzle-orm";
17232
+ import { count as count4, eq as eq33 } from "drizzle-orm";
17148
17233
  async function resolveInsertPosition(orm, itemId2, position) {
17149
- const [row3] = await orm.select({ cnt: count3() }).from(planPhases).where(eq33(planPhases.itemId, itemId2));
17234
+ const [row3] = await orm.select({ cnt: count4() }).from(planPhases).where(eq33(planPhases.itemId, itemId2));
17150
17235
  const phaseCount = row3?.cnt ?? 0;
17151
17236
  if (position === void 0) return phaseCount;
17152
17237
  const pos = Number.parseInt(position, 10);
@@ -17358,7 +17443,7 @@ import chalk61 from "chalk";
17358
17443
  // src/shared/renderMarkdownTerminal.ts
17359
17444
  import { Marked } from "marked";
17360
17445
  import { markedTerminal } from "marked-terminal";
17361
- function renderMarkdownTerminal(text19) {
17446
+ function renderMarkdownTerminal(text20) {
17362
17447
  const width2 = process.stdout.columns || 80;
17363
17448
  const marked = new Marked(markedTerminal({ width: width2, reflowText: true }));
17364
17449
  marked.use({
@@ -17371,7 +17456,7 @@ function renderMarkdownTerminal(text19) {
17371
17456
  }
17372
17457
  }
17373
17458
  });
17374
- return marked.parse(text19).trimEnd();
17459
+ return marked.parse(text20).trimEnd();
17375
17460
  }
17376
17461
 
17377
17462
  // src/commands/backlog/propose/renderProposedItem.ts
@@ -17825,9 +17910,9 @@ async function confirmMove(cnt, oldOrigin, newOrigin) {
17825
17910
  }
17826
17911
 
17827
17912
  // src/commands/backlog/move-repo/countByOrigin.ts
17828
- import { count as count4, eq as eq38 } from "drizzle-orm";
17913
+ import { count as count5, eq as eq38 } from "drizzle-orm";
17829
17914
  async function countByOrigin(orm, origin) {
17830
- const [{ cnt }] = await orm.select({ cnt: count4() }).from(items).where(eq38(items.origin, origin));
17915
+ const [{ cnt }] = await orm.select({ cnt: count5() }).from(items).where(eq38(items.origin, origin));
17831
17916
  return cnt;
17832
17917
  }
17833
17918
 
@@ -18034,9 +18119,9 @@ function processStartedAt(pid) {
18034
18119
 
18035
18120
  // src/commands/backlog/isStaleLock.ts
18036
18121
  var clockSlackMs = 5e3;
18037
- function isStaleLock(pid, timestamp8) {
18038
- if (typeof timestamp8 !== "string") return false;
18039
- const lockedAt = Date.parse(timestamp8);
18122
+ function isStaleLock(pid, timestamp9) {
18123
+ if (typeof timestamp9 !== "string") return false;
18124
+ const lockedAt = Date.parse(timestamp9);
18040
18125
  if (Number.isNaN(lockedAt)) return false;
18041
18126
  if (lockedAt < bootedAt() - clockSlackMs) return true;
18042
18127
  const startedAt = processStartedAt(pid);
@@ -18201,11 +18286,11 @@ import { promisify as promisify11 } from "util";
18201
18286
  // src/shared/withSpinner.ts
18202
18287
  var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
18203
18288
  var TICK_MS = 80;
18204
- async function withSpinner(text19, task) {
18289
+ async function withSpinner(text20, task) {
18205
18290
  if (!process.stderr.isTTY) return task();
18206
18291
  let frame = 0;
18207
18292
  const render2 = () => {
18208
- process.stderr.write(`\r${SPINNER_FRAMES[frame]} ${text19}`);
18293
+ process.stderr.write(`\r${SPINNER_FRAMES[frame]} ${text20}`);
18209
18294
  };
18210
18295
  render2();
18211
18296
  const timer = setInterval(() => {
@@ -18957,7 +19042,7 @@ import { randomUUID as randomUUID9 } from "crypto";
18957
19042
  import os4 from "os";
18958
19043
 
18959
19044
  // src/shared/db/recordPhaseSession.ts
18960
- import { sql as sql23 } from "drizzle-orm";
19045
+ import { sql as sql24 } from "drizzle-orm";
18961
19046
  async function recordPhaseSession(db, itemId2, phaseIdx, claudeSessionId, hostname2, osUser) {
18962
19047
  await db.insert(phaseSessions).values({ itemId: itemId2, phaseIdx, claudeSessionId, hostname: hostname2, osUser }).onConflictDoUpdate({
18963
19048
  target: [
@@ -18966,7 +19051,7 @@ async function recordPhaseSession(db, itemId2, phaseIdx, claudeSessionId, hostna
18966
19051
  phaseSessions.claudeSessionId
18967
19052
  ],
18968
19053
  set: { hostname: hostname2, osUser },
18969
- setWhere: sql23`${phaseSessions.hostname} = 'unknown'`
19054
+ setWhere: sql24`${phaseSessions.hostname} = 'unknown'`
18970
19055
  });
18971
19056
  }
18972
19057
 
@@ -19931,13 +20016,13 @@ function registerStatusCommands(cmd) {
19931
20016
 
19932
20017
  // src/commands/backlog/movePhase.ts
19933
20018
  import chalk99 from "chalk";
19934
- import { count as count6, eq as eq44 } from "drizzle-orm";
20019
+ import { count as count7, eq as eq44 } from "drizzle-orm";
19935
20020
 
19936
20021
  // src/commands/backlog/reorderPhaseRows.ts
19937
20022
  import { and as and16, asc as asc11, eq as eq43 } from "drizzle-orm";
19938
20023
 
19939
20024
  // src/commands/backlog/reindexPhases.ts
19940
- import { and as and15, asc as asc10, count as count5, eq as eq42 } from "drizzle-orm";
20025
+ import { and as and15, asc as asc10, count as count6, eq as eq42 } from "drizzle-orm";
19941
20026
  async function reindexPhases(db, itemId2) {
19942
20027
  const remaining = await db.select({ idx: planPhases.idx }).from(planPhases).where(eq42(planPhases.itemId, itemId2)).orderBy(asc10(planPhases.idx));
19943
20028
  for (let i = 0; i < remaining.length; i++) {
@@ -19956,7 +20041,7 @@ async function adjustCurrentPhase(db, item, removedIdx) {
19956
20041
  return;
19957
20042
  }
19958
20043
  if (removedIdx !== currentIdx) return;
19959
- const [row3] = await db.select({ cnt: count5() }).from(planPhases).where(eq42(planPhases.itemId, item.id));
20044
+ const [row3] = await db.select({ cnt: count6() }).from(planPhases).where(eq42(planPhases.itemId, item.id));
19960
20045
  const cnt = row3?.cnt ?? 0;
19961
20046
  await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(eq42(items.id, item.id));
19962
20047
  }
@@ -20010,7 +20095,7 @@ async function movePhase(id, from, to) {
20010
20095
  if (!found) return;
20011
20096
  const { orm, item } = found;
20012
20097
  const itemId2 = item.id;
20013
- const [row3] = await orm.select({ cnt: count6() }).from(planPhases).where(eq44(planPhases.itemId, itemId2));
20098
+ const [row3] = await orm.select({ cnt: count7() }).from(planPhases).where(eq44(planPhases.itemId, itemId2));
20014
20099
  const phaseCount = row3?.cnt ?? 0;
20015
20100
  const fromIdx = toIndex2(from, phaseCount);
20016
20101
  if (fromIdx === void 0) return;
@@ -20059,14 +20144,14 @@ async function applyPhaseUpdate(orm, itemId2, phaseIdx, fields) {
20059
20144
 
20060
20145
  // src/commands/backlog/findPhase.ts
20061
20146
  import chalk100 from "chalk";
20062
- import { and as and18, count as count7, eq as eq46 } from "drizzle-orm";
20147
+ import { and as and18, count as count8, eq as eq46 } from "drizzle-orm";
20063
20148
  async function findPhase(id, phase) {
20064
20149
  const found = await findOneItem(id);
20065
20150
  if (!found) return void 0;
20066
20151
  const { orm, item } = found;
20067
20152
  const itemId2 = item.id;
20068
20153
  const phaseIdx = Number.parseInt(phase, 10) - 1;
20069
- const [row3] = await orm.select({ cnt: count7() }).from(planPhases).where(and18(eq46(planPhases.itemId, itemId2), eq46(planPhases.idx, phaseIdx)));
20154
+ const [row3] = await orm.select({ cnt: count8() }).from(planPhases).where(and18(eq46(planPhases.itemId, itemId2), eq46(planPhases.idx, phaseIdx)));
20070
20155
  if (!row3 || row3.cnt === 0) {
20071
20156
  console.log(
20072
20157
  chalk100.red(
@@ -20084,14 +20169,14 @@ function parseListIndex(raw, length, label) {
20084
20169
  if (!/^\d+$/.test(raw)) {
20085
20170
  return { ok: false, error: `${label} must be a positive integer.` };
20086
20171
  }
20087
- const index2 = Number.parseInt(raw, 10);
20088
- if (index2 < 1 || index2 > length) {
20172
+ const index3 = Number.parseInt(raw, 10);
20173
+ if (index3 < 1 || index3 > length) {
20089
20174
  return {
20090
20175
  ok: false,
20091
- error: `${label} ${index2} is out of range (1-${length}).`
20176
+ error: `${label} ${index3} is out of range (1-${length}).`
20092
20177
  };
20093
20178
  }
20094
- return { ok: true, index: index2 };
20179
+ return { ok: true, index: index3 };
20095
20180
  }
20096
20181
 
20097
20182
  // src/commands/backlog/update/applyListMutations.ts
@@ -20266,8 +20351,8 @@ import { eq as eq48 } from "drizzle-orm";
20266
20351
  // src/commands/backlog/update/buildUpdateValues.ts
20267
20352
  import chalk103 from "chalk";
20268
20353
  function buildUpdateValues(options2) {
20269
- const { name, desc: desc7, type, ac, origin } = options2;
20270
- if (!name && !desc7 && !type && !ac && !origin) {
20354
+ const { name, desc: desc8, type, ac, origin } = options2;
20355
+ if (!name && !desc8 && !type && !ac && !origin) {
20271
20356
  console.log(chalk103.red("Nothing to update. Provide at least one flag."));
20272
20357
  process.exitCode = 1;
20273
20358
  return void 0;
@@ -20283,8 +20368,8 @@ function buildUpdateValues(options2) {
20283
20368
  set.name = name;
20284
20369
  fieldNames.push("name");
20285
20370
  }
20286
- if (desc7) {
20287
- set.description = desc7.replaceAll(String.raw`\n`, "\n");
20371
+ if (desc8) {
20372
+ set.description = desc8.replaceAll(String.raw`\n`, "\n");
20288
20373
  fieldNames.push("description");
20289
20374
  }
20290
20375
  if (type) {
@@ -20791,8 +20876,8 @@ function printPhaseTasks(phase) {
20791
20876
  }
20792
20877
 
20793
20878
  // src/commands/backlog/show/printPlan.ts
20794
- function phaseHeader(index2, name, isCurrent) {
20795
- const phaseNumber = index2 + 1;
20879
+ function phaseHeader(index3, name, isCurrent) {
20880
+ const phaseNumber = index3 + 1;
20796
20881
  const marker2 = isCurrent ? chalk112.green("\u25B6 ") : " ";
20797
20882
  const label = isCurrent ? chalk112.green.bold(`Phase ${phaseNumber}: ${name}`) : `${chalk112.bold(`Phase ${phaseNumber}:`)} ${name}`;
20798
20883
  return `${marker2}${label}`;
@@ -20806,8 +20891,8 @@ function printPhaseSessions(sessions) {
20806
20891
  );
20807
20892
  }
20808
20893
  }
20809
- function printPhase(phase, index2, isCurrent, sessions) {
20810
- console.log(phaseHeader(index2, phase.name, isCurrent));
20894
+ function printPhase(phase, index3, isCurrent, sessions) {
20895
+ console.log(phaseHeader(index3, phase.name, isCurrent));
20811
20896
  printPhaseTasks(phase);
20812
20897
  printPhaseSessions(sessions);
20813
20898
  }
@@ -21004,7 +21089,7 @@ function registerBranch(program) {
21004
21089
  import { basename as basename15 } from "path";
21005
21090
 
21006
21091
  // src/commands/backlog/isDocsLocked.ts
21007
- import { and as and20, eq as eq49, notInArray as notInArray2, sql as sql24 } from "drizzle-orm";
21092
+ import { and as and20, eq as eq49, notInArray as notInArray2, sql as sql25 } from "drizzle-orm";
21008
21093
  async function isDocsRefreshItem(itemId2) {
21009
21094
  const orm = await getDb();
21010
21095
  const [row3] = await orm.select({ itemId: links.itemId }).from(links).where(and20(eq49(links.itemId, itemId2), eq49(links.type, "docs-refresh"))).limit(1);
@@ -21018,7 +21103,7 @@ async function hasOpenDocsUnlock(itemId2) {
21018
21103
  eq49(itemGitRefs.kind, "docs-unlock"),
21019
21104
  eq49(
21020
21105
  itemGitRefs.ref,
21021
- sql24`'phase-' || coalesce(${items.currentPhase}, 1)`
21106
+ sql25`'phase-' || coalesce(${items.currentPhase}, 1)`
21022
21107
  ),
21023
21108
  notInArray2(items.status, ["done", "wontdo"])
21024
21109
  )
@@ -21353,16 +21438,16 @@ var BRANCH_CREATION_REGEXES = [
21353
21438
  var builtinDenyRules = [
21354
21439
  ...PATTERN_DENIES.map((rule) => ({
21355
21440
  message: rule.message,
21356
- matches: (text19) => text19.includes(rule.pattern),
21441
+ matches: (text20) => text20.includes(rule.pattern),
21357
21442
  enabled: rule.enabled
21358
21443
  })),
21359
21444
  ...BRANCH_CREATION_REGEXES.map((regex) => ({
21360
21445
  message: BRANCH_CREATION_MESSAGE,
21361
- matches: (text19) => regex.test(text19)
21446
+ matches: (text20) => regex.test(text20)
21362
21447
  })),
21363
21448
  {
21364
21449
  message: CLOSE_WITH_COMMENT_MESSAGE,
21365
- matches: (text19) => CLOSE_WITH_COMMENT_REGEX.test(text19)
21450
+ matches: (text20) => CLOSE_WITH_COMMENT_REGEX.test(text20)
21366
21451
  },
21367
21452
  {
21368
21453
  message: GH_ISSUE_API_MESSAGE,
@@ -21371,11 +21456,11 @@ var builtinDenyRules = [
21371
21456
  ];
21372
21457
 
21373
21458
  // src/commands/cliHook/findBuiltinDeny.ts
21374
- function normaliseWhitespace(text19) {
21375
- return text19.replace(/\\\n/g, " ").replace(/\s+/g, " ");
21459
+ function normaliseWhitespace(text20) {
21460
+ return text20.replace(/\\\n/g, " ").replace(/\s+/g, " ");
21376
21461
  }
21377
- function matchBuiltinDeny(text19) {
21378
- const normalised = normaliseWhitespace(text19);
21462
+ function matchBuiltinDeny(text20) {
21463
+ const normalised = normaliseWhitespace(text20);
21379
21464
  return builtinDenyRules.find(
21380
21465
  (rule) => rule.matches(normalised) && (rule.enabled?.() ?? true)
21381
21466
  );
@@ -22351,8 +22436,8 @@ function formatHuman(cli, commands) {
22351
22436
  `];
22352
22437
  for (const cmd of sorted2) {
22353
22438
  const full = `${cli} ${cmd.path.join(" ")}`;
22354
- const text19 = cmd.description ? `${full} \u2014 ${cmd.description}` : full;
22355
- lines2.push(`${prefix(classifyVerb(cmd.path))}${text19}`);
22439
+ const text20 = cmd.description ? `${full} \u2014 ${cmd.description}` : full;
22440
+ lines2.push(`${prefix(classifyVerb(cmd.path))}${text20}`);
22356
22441
  }
22357
22442
  return lines2.join("\n");
22358
22443
  }
@@ -22487,12 +22572,12 @@ function denyList() {
22487
22572
  import chalk117 from "chalk";
22488
22573
  function denyRemove(pattern2, options2) {
22489
22574
  const { deny, saveDeny } = loadDenyConfig(options2.node);
22490
- const index2 = deny.findIndex((r) => r.pattern === pattern2);
22491
- if (index2 === -1) {
22575
+ const index3 = deny.findIndex((r) => r.pattern === pattern2);
22576
+ if (index3 === -1) {
22492
22577
  console.log(chalk117.yellow(`No deny rule found for: ${pattern2}`));
22493
22578
  return;
22494
22579
  }
22495
- deny.splice(index2, 1);
22580
+ deny.splice(index3, 1);
22496
22581
  saveDeny(deny.length > 0 ? deny : void 0);
22497
22582
  console.log(chalk117.green(`Removed deny rule: ${pattern2}`));
22498
22583
  }
@@ -22620,8 +22705,8 @@ function codeCommentConfirm(pin2) {
22620
22705
  }
22621
22706
  const original = readFileSync33(state.file, "utf8");
22622
22707
  const lines2 = original.split("\n");
22623
- const index2 = state.line - 1;
22624
- if (index2 > lines2.length) {
22708
+ const index3 = state.line - 1;
22709
+ if (index3 > lines2.length) {
22625
22710
  console.error(
22626
22711
  chalk118.red(
22627
22712
  `Line ${state.line} is beyond the end of ${state.file} (${lines2.length} lines).`
@@ -22631,9 +22716,9 @@ function codeCommentConfirm(pin2) {
22631
22716
  return;
22632
22717
  }
22633
22718
  const marker2 = isHashCommentFile(state.file) ? "#" : "//";
22634
- const indentSource = lines2[index2] ?? "";
22719
+ const indentSource = lines2[index3] ?? "";
22635
22720
  const indent4 = indentSource.match(/^\s*/)?.[0] ?? "";
22636
- lines2.splice(index2, 0, `${indent4}${marker2} ${state.text}`);
22721
+ lines2.splice(index3, 0, `${indent4}${marker2} ${state.text}`);
22637
22722
  writeFileSync26(state.file, lines2.join("\n"));
22638
22723
  unlinkSync8(getPinStatePath(pin2));
22639
22724
  console.log(
@@ -22649,26 +22734,26 @@ import chalk119 from "chalk";
22649
22734
  // src/commands/codeComment/validateCommentText.ts
22650
22735
  var MAX_COMMENT_LENGTH = 50;
22651
22736
  function validateCommentText(raw, isHash = false) {
22652
- const text19 = isHash ? raw.replace(/^#\s?/, "") : raw.replace(/^\/\/\s?/, "");
22653
- if (/[\r\n]/.test(text19)) {
22737
+ const text20 = isHash ? raw.replace(/^#\s?/, "") : raw.replace(/^\/\/\s?/, "");
22738
+ if (/[\r\n]/.test(text20)) {
22654
22739
  return {
22655
22740
  ok: false,
22656
22741
  reason: "Comment must be a single line \u2014 multi-line comments are not allowed."
22657
22742
  };
22658
22743
  }
22659
- if (!isHash && (text19.includes("/*") || text19.includes("*/"))) {
22744
+ if (!isHash && (text20.includes("/*") || text20.includes("*/"))) {
22660
22745
  return {
22661
22746
  ok: false,
22662
22747
  reason: "Block comments (/* */) are not allowed \u2014 only single-line // comments."
22663
22748
  };
22664
22749
  }
22665
- if (text19.length > MAX_COMMENT_LENGTH) {
22750
+ if (text20.length > MAX_COMMENT_LENGTH) {
22666
22751
  return {
22667
22752
  ok: false,
22668
- reason: `Comment text is ${text19.length} chars; the cap is ${MAX_COMMENT_LENGTH}. Make it shorter or, better, make the code self-documenting.`
22753
+ reason: `Comment text is ${text20.length} chars; the cap is ${MAX_COMMENT_LENGTH}. Make it shorter or, better, make the code self-documenting.`
22669
22754
  };
22670
22755
  }
22671
- return { ok: true, text: text19 };
22756
+ return { ok: true, text: text20 };
22672
22757
  }
22673
22758
 
22674
22759
  // src/commands/codeComment/issuePin.ts
@@ -22755,13 +22840,13 @@ async function deliverPinNotification(notification) {
22755
22840
  }
22756
22841
 
22757
22842
  // src/commands/codeComment/issuePin.ts
22758
- function issuePin(file, lineNumber, text19) {
22843
+ function issuePin(file, lineNumber, text20) {
22759
22844
  const pin2 = generatePin();
22760
22845
  mkdirSync17(getRestrictedDir(), { recursive: true });
22761
22846
  sweepRestrictedDir();
22762
22847
  writeFileSync27(
22763
22848
  getPinStatePath(pin2),
22764
- JSON.stringify({ pin: pin2, file, line: lineNumber, text: text19 })
22849
+ JSON.stringify({ pin: pin2, file, line: lineNumber, text: text20 })
22765
22850
  );
22766
22851
  return deliverPinNotification({
22767
22852
  area: "code-comment",
@@ -22775,7 +22860,7 @@ function generatePin() {
22775
22860
  }
22776
22861
 
22777
22862
  // src/commands/codeComment/codeCommentSet.ts
22778
- async function codeCommentSet(file, line, text19) {
22863
+ async function codeCommentSet(file, line, text20) {
22779
22864
  const lineNumber = Number.parseInt(line, 10);
22780
22865
  if (!Number.isInteger(lineNumber) || lineNumber < 1) {
22781
22866
  console.error(chalk119.red(`Invalid line number: ${line}`));
@@ -22784,7 +22869,7 @@ async function codeCommentSet(file, line, text19) {
22784
22869
  }
22785
22870
  const hash = isHashCommentFile(file);
22786
22871
  const marker2 = hash ? "#" : "//";
22787
- const validation = validateCommentText(text19, hash);
22872
+ const validation = validateCommentText(text20, hash);
22788
22873
  if (!validation.ok) {
22789
22874
  console.error(chalk119.red(`Refused: ${validation.reason}`));
22790
22875
  console.error(chalk119.red("No pin issued."));
@@ -23274,16 +23359,16 @@ function parseUserLine(line) {
23274
23359
  if (entry.type !== "user") return void 0;
23275
23360
  const msg = entry.message;
23276
23361
  const c = msg?.content;
23277
- let text19;
23362
+ let text20;
23278
23363
  if (typeof c === "string") {
23279
- text19 = c;
23364
+ text20 = c;
23280
23365
  } else if (Array.isArray(c)) {
23281
23366
  const collected = c.filter((b) => b.type === "text").map((b) => b.text ?? "").join("\n");
23282
- text19 = collected || void 0;
23367
+ text20 = collected || void 0;
23283
23368
  }
23284
- if (!text19) return void 0;
23369
+ if (!text20) return void 0;
23285
23370
  return {
23286
- text: text19,
23371
+ text: text20,
23287
23372
  entrypoint: typeof entry.entrypoint === "string" ? entry.entrypoint : void 0
23288
23373
  };
23289
23374
  }
@@ -23300,29 +23385,29 @@ function* iterateUserMessages(filePath, maxBytes = 65536) {
23300
23385
  }
23301
23386
 
23302
23387
  // src/commands/sessions/summarise/scanSessionBacklogRefs.ts
23303
- function extractBacklogIds(text19) {
23388
+ function extractBacklogIds(text20) {
23304
23389
  const ids = [];
23305
- for (const m of text19.matchAll(/backlog\s+run\s+a(\d+)/gi)) {
23390
+ for (const m of text20.matchAll(/backlog\s+run\s+a(\d+)/gi)) {
23306
23391
  ids.push(Number.parseInt(m[1], 10));
23307
23392
  }
23308
- for (const m of text19.matchAll(/backlog\s+(?:item\s+)?a(\d+)/gi)) {
23393
+ for (const m of text20.matchAll(/backlog\s+(?:item\s+)?a(\d+)/gi)) {
23309
23394
  ids.push(Number.parseInt(m[1], 10));
23310
23395
  }
23311
- for (const m of text19.matchAll(/backlog\s+phase-done\s+a(\d+)/gi)) {
23396
+ for (const m of text20.matchAll(/backlog\s+phase-done\s+a(\d+)/gi)) {
23312
23397
  ids.push(Number.parseInt(m[1], 10));
23313
23398
  }
23314
- for (const m of text19.matchAll(/backlog\s+comment\s+a(\d+)/gi)) {
23399
+ for (const m of text20.matchAll(/backlog\s+comment\s+a(\d+)/gi)) {
23315
23400
  ids.push(Number.parseInt(m[1], 10));
23316
23401
  }
23317
- for (const m of text19.matchAll(/(?:^|[\s(])a(\d{1,4})(?=[\s).,;:!?]|$)/gm)) {
23402
+ for (const m of text20.matchAll(/(?:^|[\s(])a(\d{1,4})(?=[\s).,;:!?]|$)/gm)) {
23318
23403
  ids.push(Number.parseInt(m[1], 10));
23319
23404
  }
23320
23405
  return ids;
23321
23406
  }
23322
23407
 
23323
23408
  // src/shared/findBacklogRefs.ts
23324
- function findBacklogRefs(text19) {
23325
- return [...new Set(extractBacklogIds(text19))];
23409
+ function findBacklogRefs(text20) {
23410
+ return [...new Set(extractBacklogIds(text20))];
23326
23411
  }
23327
23412
  function backlogRefError(subject, context, ids) {
23328
23413
  const refs = ids.map((id) => `a${id}`).join(", ");
@@ -23617,7 +23702,7 @@ function calculateHalstead(node) {
23617
23702
  // src/commands/complexity/shared/countSloc.ts
23618
23703
  function countSloc(content) {
23619
23704
  let inMultiLineComment = false;
23620
- let count10 = 0;
23705
+ let count11 = 0;
23621
23706
  for (const line of content.split("\n")) {
23622
23707
  const trimmed = line.trim();
23623
23708
  if (inMultiLineComment) {
@@ -23625,7 +23710,7 @@ function countSloc(content) {
23625
23710
  inMultiLineComment = false;
23626
23711
  const afterComment = trimmed.substring(trimmed.indexOf("*/") + 2);
23627
23712
  if (afterComment.trim().length > 0) {
23628
- count10++;
23713
+ count11++;
23629
23714
  }
23630
23715
  }
23631
23716
  continue;
@@ -23637,7 +23722,7 @@ function countSloc(content) {
23637
23722
  if (trimmed.includes("*/")) {
23638
23723
  const afterComment = trimmed.substring(trimmed.indexOf("*/") + 2);
23639
23724
  if (afterComment.trim().length > 0) {
23640
- count10++;
23725
+ count11++;
23641
23726
  }
23642
23727
  } else {
23643
23728
  inMultiLineComment = true;
@@ -23645,10 +23730,10 @@ function countSloc(content) {
23645
23730
  continue;
23646
23731
  }
23647
23732
  if (trimmed.length > 0) {
23648
- count10++;
23733
+ count11++;
23649
23734
  }
23650
23735
  }
23651
- return count10;
23736
+ return count11;
23652
23737
  }
23653
23738
 
23654
23739
  // src/commands/complexity/shared.ts
@@ -24625,8 +24710,8 @@ import chalk146 from "chalk";
24625
24710
  // src/commands/browser/formatInspectMatches.ts
24626
24711
  function formatInspectMatches({ matches, total: total2 }, query) {
24627
24712
  if (total2 === 0) return [`no elements match ${query}`];
24628
- const lines2 = matches.flatMap((match, index2) => [
24629
- `[${index2 + 1}/${total2}] ${match.width}\xD7${match.height} ${JSON.stringify(match.text)}`,
24713
+ const lines2 = matches.flatMap((match, index3) => [
24714
+ `[${index3 + 1}/${total2}] ${match.width}\xD7${match.height} ${JSON.stringify(match.text)}`,
24630
24715
  ...match.chain.map((step3) => ` ${step3}`)
24631
24716
  ]);
24632
24717
  if (total2 > matches.length)
@@ -24757,8 +24842,8 @@ import { homedir as homedir22 } from "os";
24757
24842
  import { join as join57 } from "path";
24758
24843
  function snapshotPath(tabUrl, now) {
24759
24844
  const host = new URL(tabUrl).host.replace(/[^\w.-]/g, "-");
24760
- const timestamp8 = now.toISOString().replace(/[:.]/g, "-");
24761
- return join57(homedir22(), ".assist", "browser", `${host}-${timestamp8}.html`);
24845
+ const timestamp9 = now.toISOString().replace(/[:.]/g, "-");
24846
+ return join57(homedir22(), ".assist", "browser", `${host}-${timestamp9}.html`);
24762
24847
  }
24763
24848
 
24764
24849
  // src/commands/browser/browserSnapshot.ts
@@ -24819,7 +24904,7 @@ function formatTime(time) {
24819
24904
  const date = new Date(time);
24820
24905
  return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}.${pad(date.getMilliseconds(), 3)}`;
24821
24906
  }
24822
- var indent = (text19, prefix2) => text19.split("\n").map((line) => `${prefix2}${line}`);
24907
+ var indent = (text20, prefix2) => text20.split("\n").map((line) => `${prefix2}${line}`);
24823
24908
  function formatConsoleEntries({
24824
24909
  recording,
24825
24910
  entries
@@ -25157,10 +25242,10 @@ async function findRetiredTables(exec3) {
25157
25242
  const found = [];
25158
25243
  for (const row3 of present) {
25159
25244
  const name = String(row3.table_name);
25160
- const [count10] = await exec3.query(
25245
+ const [count11] = await exec3.query(
25161
25246
  `SELECT count(*)::int AS rows FROM "${name}"`
25162
25247
  );
25163
- found.push({ name, rows: Number(count10.rows) });
25248
+ found.push({ name, rows: Number(count11.rows) });
25164
25249
  }
25165
25250
  return found;
25166
25251
  }
@@ -25691,8 +25776,8 @@ function list2(options2) {
25691
25776
  );
25692
25777
  const weeks = Array.from(byWeek.keys()).sort();
25693
25778
  if (!options2.reverse) weeks.reverse();
25694
- weeks.forEach((week, index2) => {
25695
- if (index2 > 0) console.log();
25779
+ weeks.forEach((week, index3) => {
25780
+ if (index3 > 0) console.log();
25696
25781
  printWeekHeader(week, {
25697
25782
  skipped: skip3.has(week),
25698
25783
  inProgress: !isCompletedWeek(week, today),
@@ -26971,8 +27056,8 @@ var MACHINE_DIRECTIVES = [
26971
27056
  "<auto-generated",
26972
27057
  MAINTAINABILITY_OVERRIDE_MARKER
26973
27058
  ];
26974
- function isCommentExempt(text19) {
26975
- const lower = text19.toLowerCase();
27059
+ function isCommentExempt(text20) {
27060
+ const lower = text20.toLowerCase();
26976
27061
  return MACHINE_DIRECTIVES.some((d) => lower.includes(d));
26977
27062
  }
26978
27063
 
@@ -26993,12 +27078,12 @@ function isSourceFile(filePath) {
26993
27078
  if (!filePath) return false;
26994
27079
  return SOURCE_EXTENSIONS.some((ext) => filePath.endsWith(ext));
26995
27080
  }
26996
- function blankNonNewline(text19) {
26997
- return text19.replace(/[^\n]/g, " ");
27081
+ function blankNonNewline(text20) {
27082
+ return text20.replace(/[^\n]/g, " ");
26998
27083
  }
26999
- function extractComments(text19) {
27084
+ function extractComments(text20) {
27000
27085
  const comments3 = [];
27001
- let work = text19.replace(
27086
+ let work = text20.replace(
27002
27087
  /"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|`(?:[^`\\]|\\.)*`/g,
27003
27088
  blankNonNewline
27004
27089
  );
@@ -27025,26 +27110,26 @@ function lineCounter(content) {
27025
27110
  }
27026
27111
 
27027
27112
  // src/shared/readCsharpComment.ts
27028
- function readCsharpComment(content, index2) {
27029
- if (content[index2] !== "/") return void 0;
27030
- if (content[index2 + 1] === "/") {
27031
- const lineEnd = content.indexOf("\n", index2);
27113
+ function readCsharpComment(content, index3) {
27114
+ if (content[index3] !== "/") return void 0;
27115
+ if (content[index3 + 1] === "/") {
27116
+ const lineEnd = content.indexOf("\n", index3);
27032
27117
  const end = lineEnd === -1 ? content.length : lineEnd;
27033
- return { end, text: content.slice(index2, end) };
27118
+ return { end, text: content.slice(index3, end) };
27034
27119
  }
27035
- if (content[index2 + 1] === "*") {
27036
- const close = content.indexOf("*/", index2 + 2);
27120
+ if (content[index3 + 1] === "*") {
27121
+ const close = content.indexOf("*/", index3 + 2);
27037
27122
  const end = close === -1 ? content.length : close + 2;
27038
- return { end, text: content.slice(index2, end) };
27123
+ return { end, text: content.slice(index3, end) };
27039
27124
  }
27040
27125
  return void 0;
27041
27126
  }
27042
27127
 
27043
27128
  // src/shared/skipCsharpCharLiteral.ts
27044
27129
  var CHAR_LITERAL_MAX_LENGTH = 12;
27045
- function skipCsharpCharLiteral(content, index2) {
27046
- const limit = Math.min(content.length, index2 + CHAR_LITERAL_MAX_LENGTH);
27047
- let cursor = index2 + 1;
27130
+ function skipCsharpCharLiteral(content, index3) {
27131
+ const limit = Math.min(content.length, index3 + CHAR_LITERAL_MAX_LENGTH);
27132
+ let cursor = index3 + 1;
27048
27133
  while (cursor < limit) {
27049
27134
  const char = content[cursor];
27050
27135
  if (char === "\n") break;
@@ -27055,12 +27140,12 @@ function skipCsharpCharLiteral(content, index2) {
27055
27140
  if (char === "'") return cursor + 1;
27056
27141
  cursor++;
27057
27142
  }
27058
- return index2 + 1;
27143
+ return index3 + 1;
27059
27144
  }
27060
27145
 
27061
27146
  // src/shared/readCsharpStringStart.ts
27062
- function readCsharpStringStart(content, index2) {
27063
- let cursor = index2;
27147
+ function readCsharpStringStart(content, index3) {
27148
+ let cursor = index3;
27064
27149
  let verbatim = false;
27065
27150
  let interpolated = false;
27066
27151
  while (content[cursor] === "@" || content[cursor] === "$") {
@@ -27091,8 +27176,8 @@ function skipCsharpRawString(content, quote, quoteRun) {
27091
27176
  }
27092
27177
 
27093
27178
  // src/shared/skipCsharpString.ts
27094
- function skipInterpolationHole(content, index2) {
27095
- let cursor = index2;
27179
+ function skipInterpolationHole(content, index3) {
27180
+ let cursor = index3;
27096
27181
  let depth = 1;
27097
27182
  while (cursor < content.length) {
27098
27183
  const char = content[cursor];
@@ -27128,8 +27213,8 @@ function skipDelimitedString(content, start2) {
27128
27213
  }
27129
27214
  return content.length;
27130
27215
  }
27131
- function skipCsharpString(content, index2) {
27132
- const start2 = readCsharpStringStart(content, index2);
27216
+ function skipCsharpString(content, index3) {
27217
+ const start2 = readCsharpStringStart(content, index3);
27133
27218
  if (!start2) return void 0;
27134
27219
  if (!start2.verbatim && start2.quoteRun >= 3)
27135
27220
  return skipCsharpRawString(content, start2.quote, start2.quoteRun);
@@ -27141,28 +27226,28 @@ var WHITESPACE = /* @__PURE__ */ new Set([" ", " ", "\r"]);
27141
27226
  function extractCsharpComments(content) {
27142
27227
  const comments3 = [];
27143
27228
  const lineOf = lineCounter(content);
27144
- let index2 = 0;
27229
+ let index3 = 0;
27145
27230
  let atLineStart = true;
27146
- while (index2 < content.length) {
27147
- const char = content[index2];
27231
+ while (index3 < content.length) {
27232
+ const char = content[index3];
27148
27233
  if (char === "\n") {
27149
27234
  atLineStart = true;
27150
- index2++;
27235
+ index3++;
27151
27236
  } else if (WHITESPACE.has(char)) {
27152
- index2++;
27237
+ index3++;
27153
27238
  } else if (atLineStart && char === "#") {
27154
- const lineEnd = content.indexOf("\n", index2);
27155
- index2 = lineEnd === -1 ? content.length : lineEnd;
27239
+ const lineEnd = content.indexOf("\n", index3);
27240
+ index3 = lineEnd === -1 ? content.length : lineEnd;
27156
27241
  } else {
27157
27242
  atLineStart = false;
27158
- const comment3 = readCsharpComment(content, index2);
27159
- const afterString = comment3 ? void 0 : skipCsharpString(content, index2);
27243
+ const comment3 = readCsharpComment(content, index3);
27244
+ const afterString = comment3 ? void 0 : skipCsharpString(content, index3);
27160
27245
  if (comment3) {
27161
- comments3.push({ line: lineOf(index2), text: comment3.text });
27162
- index2 = comment3.end;
27163
- } else if (char === "'") index2 = skipCsharpCharLiteral(content, index2);
27164
- else if (afterString !== void 0) index2 = afterString;
27165
- else index2++;
27246
+ comments3.push({ line: lineOf(index3), text: comment3.text });
27247
+ index3 = comment3.end;
27248
+ } else if (char === "'") index3 = skipCsharpCharLiteral(content, index3);
27249
+ else if (afterString !== void 0) index3 = afterString;
27250
+ else index3++;
27166
27251
  }
27167
27252
  }
27168
27253
  return comments3;
@@ -27174,8 +27259,8 @@ function commentTexts(comments3) {
27174
27259
  }
27175
27260
 
27176
27261
  // src/commands/editHook/extractCsharpCommentTexts.ts
27177
- function extractCsharpCommentTexts(text19) {
27178
- return commentTexts(extractCsharpComments(text19));
27262
+ function extractCsharpCommentTexts(text20) {
27263
+ return commentTexts(extractCsharpComments(text20));
27179
27264
  }
27180
27265
 
27181
27266
  // src/shared/readRazorComment.ts
@@ -27183,36 +27268,36 @@ var RAZOR_OPEN = "@*";
27183
27268
  var RAZOR_CLOSE = "*@";
27184
27269
  var HTML_OPEN = "<!--";
27185
27270
  var HTML_CLOSE = "-->";
27186
- function read(content, index2, open, close) {
27187
- const found = content.indexOf(close, index2 + open.length);
27271
+ function read(content, index3, open, close) {
27272
+ const found = content.indexOf(close, index3 + open.length);
27188
27273
  const end = found === -1 ? content.length : found + close.length;
27189
- return { end, text: content.slice(index2, end) };
27274
+ return { end, text: content.slice(index3, end) };
27190
27275
  }
27191
- function readRazorComment(content, index2) {
27192
- if (content.startsWith(RAZOR_OPEN, index2))
27193
- return read(content, index2, RAZOR_OPEN, RAZOR_CLOSE);
27194
- if (content.startsWith(HTML_OPEN, index2))
27195
- return read(content, index2, HTML_OPEN, HTML_CLOSE);
27276
+ function readRazorComment(content, index3) {
27277
+ if (content.startsWith(RAZOR_OPEN, index3))
27278
+ return read(content, index3, RAZOR_OPEN, RAZOR_CLOSE);
27279
+ if (content.startsWith(HTML_OPEN, index3))
27280
+ return read(content, index3, HTML_OPEN, HTML_CLOSE);
27196
27281
  return void 0;
27197
27282
  }
27198
27283
 
27199
27284
  // src/shared/stepRazorCode.ts
27200
- function stepRazorCode(content, index2) {
27201
- const char = content[index2];
27202
- if (char === "{") return { next: index2 + 1, depthChange: 1 };
27203
- if (char === "}") return { next: index2 + 1, depthChange: -1 };
27285
+ function stepRazorCode(content, index3) {
27286
+ const char = content[index3];
27287
+ if (char === "{") return { next: index3 + 1, depthChange: 1 };
27288
+ if (char === "}") return { next: index3 + 1, depthChange: -1 };
27204
27289
  if (char === "'")
27205
- return { next: skipCsharpCharLiteral(content, index2), depthChange: 0 };
27206
- const afterString = skipCsharpString(content, index2);
27207
- return { next: afterString ?? index2 + 1, depthChange: 0 };
27290
+ return { next: skipCsharpCharLiteral(content, index3), depthChange: 0 };
27291
+ const afterString = skipCsharpString(content, index3);
27292
+ return { next: afterString ?? index3 + 1, depthChange: 0 };
27208
27293
  }
27209
27294
 
27210
27295
  // src/shared/readRazorCodeBlockStart.ts
27211
27296
  var CODE_KEYWORDS = ["code", "functions"];
27212
27297
  var WHITESPACE2 = /* @__PURE__ */ new Set([" ", " ", "\r", "\n"]);
27213
- function readRazorCodeBlockStart(content, index2) {
27214
- if (content[index2] !== "@") return void 0;
27215
- let cursor = index2 + 1;
27298
+ function readRazorCodeBlockStart(content, index3) {
27299
+ if (content[index3] !== "@") return void 0;
27300
+ let cursor = index3 + 1;
27216
27301
  const keyword = CODE_KEYWORDS.find(
27217
27302
  (word) => content.startsWith(word, cursor)
27218
27303
  );
@@ -27225,10 +27310,10 @@ function readRazorCodeBlockStart(content, index2) {
27225
27310
 
27226
27311
  // src/shared/skipHtmlTag.ts
27227
27312
  var TAG_NAME_START = /[A-Za-z/]/;
27228
- function skipHtmlTag(content, index2) {
27229
- if (content[index2] !== "<") return void 0;
27230
- if (!TAG_NAME_START.test(content[index2 + 1] ?? "")) return void 0;
27231
- let cursor = index2 + 1;
27313
+ function skipHtmlTag(content, index3) {
27314
+ if (content[index3] !== "<") return void 0;
27315
+ if (!TAG_NAME_START.test(content[index3 + 1] ?? "")) return void 0;
27316
+ let cursor = index3 + 1;
27232
27317
  while (cursor < content.length) {
27233
27318
  const char = content[cursor];
27234
27319
  if (char === '"' || char === "'") {
@@ -27262,10 +27347,10 @@ function skipRawTextElement(content, tagStart, tagEnd) {
27262
27347
  var IDENT_START = /[A-Za-z_]/;
27263
27348
  var IDENT_PART = /[A-Za-z0-9_]/;
27264
27349
  var GROUP_CLOSE = { "(": ")", "[": "]" };
27265
- function skipGroup(content, index2) {
27266
- const open = content[index2];
27350
+ function skipGroup(content, index3) {
27351
+ const open = content[index3];
27267
27352
  const close = GROUP_CLOSE[open];
27268
- let cursor = index2 + 1;
27353
+ let cursor = index3 + 1;
27269
27354
  let depth = 1;
27270
27355
  while (cursor < content.length) {
27271
27356
  const char = content[cursor];
@@ -27285,11 +27370,11 @@ function skipGroup(content, index2) {
27285
27370
  }
27286
27371
  return void 0;
27287
27372
  }
27288
- function skipRazorExpression(content, index2) {
27289
- if (content[index2] !== "@") return void 0;
27290
- const first = content[index2 + 1] ?? "";
27373
+ function skipRazorExpression(content, index3) {
27374
+ if (content[index3] !== "@") return void 0;
27375
+ const first = content[index3 + 1] ?? "";
27291
27376
  if (!IDENT_START.test(first) && !GROUP_CLOSE[first]) return void 0;
27292
- let cursor = index2 + 1;
27377
+ let cursor = index3 + 1;
27293
27378
  while (cursor < content.length) {
27294
27379
  const char = content[cursor];
27295
27380
  if (IDENT_PART.test(char)) cursor++;
@@ -27305,14 +27390,14 @@ function skipRazorExpression(content, index2) {
27305
27390
  }
27306
27391
 
27307
27392
  // src/shared/stepRazorMarkup.ts
27308
- function stepRazorMarkup(content, index2) {
27309
- const blockBody = readRazorCodeBlockStart(content, index2);
27393
+ function stepRazorMarkup(content, index3) {
27394
+ const blockBody = readRazorCodeBlockStart(content, index3);
27310
27395
  if (blockBody !== void 0) return { next: blockBody, enteredCode: true };
27311
- const expressionEnd = skipRazorExpression(content, index2);
27396
+ const expressionEnd = skipRazorExpression(content, index3);
27312
27397
  if (expressionEnd !== void 0)
27313
27398
  return { next: expressionEnd, enteredCode: false };
27314
- const tagEnd = skipHtmlTag(content, index2);
27315
- const next3 = tagEnd === void 0 ? index2 + 1 : skipRawTextElement(content, index2, tagEnd);
27399
+ const tagEnd = skipHtmlTag(content, index3);
27400
+ const next3 = tagEnd === void 0 ? index3 + 1 : skipRawTextElement(content, index3, tagEnd);
27316
27401
  return { next: next3, enteredCode: false };
27317
27402
  }
27318
27403
 
@@ -27320,41 +27405,41 @@ function stepRazorMarkup(content, index2) {
27320
27405
  function extractRazorComments(content) {
27321
27406
  const comments3 = [];
27322
27407
  const lineOf = lineCounter(content);
27323
- let index2 = 0;
27408
+ let index3 = 0;
27324
27409
  let codeDepth = 0;
27325
- while (index2 < content.length) {
27326
- if (content[index2] === "@" && content[index2 + 1] === "@") {
27327
- index2 += 2;
27410
+ while (index3 < content.length) {
27411
+ if (content[index3] === "@" && content[index3 + 1] === "@") {
27412
+ index3 += 2;
27328
27413
  continue;
27329
27414
  }
27330
- const comment3 = readRazorComment(content, index2);
27415
+ const comment3 = readRazorComment(content, index3);
27331
27416
  if (comment3) {
27332
- comments3.push({ line: lineOf(index2), text: comment3.text });
27333
- index2 = comment3.end;
27417
+ comments3.push({ line: lineOf(index3), text: comment3.text });
27418
+ index3 = comment3.end;
27334
27419
  continue;
27335
27420
  }
27336
27421
  if (codeDepth > 0) {
27337
- const step4 = stepRazorCode(content, index2);
27422
+ const step4 = stepRazorCode(content, index3);
27338
27423
  codeDepth += step4.depthChange;
27339
- index2 = step4.next;
27424
+ index3 = step4.next;
27340
27425
  continue;
27341
27426
  }
27342
- const step3 = stepRazorMarkup(content, index2);
27427
+ const step3 = stepRazorMarkup(content, index3);
27343
27428
  if (step3.enteredCode) codeDepth = 1;
27344
- index2 = step3.next;
27429
+ index3 = step3.next;
27345
27430
  }
27346
27431
  return comments3;
27347
27432
  }
27348
27433
 
27349
27434
  // src/commands/editHook/extractRazorCommentTexts.ts
27350
- function extractRazorCommentTexts(text19) {
27351
- return commentTexts(extractRazorComments(text19));
27435
+ function extractRazorCommentTexts(text20) {
27436
+ return commentTexts(extractRazorComments(text20));
27352
27437
  }
27353
27438
 
27354
27439
  // src/shared/readRustComment.ts
27355
- function blockCommentEnd(content, index2) {
27440
+ function blockCommentEnd(content, index3) {
27356
27441
  let depth = 0;
27357
- let cursor = index2;
27442
+ let cursor = index3;
27358
27443
  while (cursor < content.length) {
27359
27444
  const pair = content.slice(cursor, cursor + 2);
27360
27445
  if (pair === "/*") {
@@ -27367,11 +27452,11 @@ function blockCommentEnd(content, index2) {
27367
27452
  }
27368
27453
  return content.length;
27369
27454
  }
27370
- function readRustComment(content, index2) {
27371
- if (!content.startsWith("/*", index2))
27372
- return readCsharpComment(content, index2);
27373
- const end = blockCommentEnd(content, index2);
27374
- return { end, text: content.slice(index2, end) };
27455
+ function readRustComment(content, index3) {
27456
+ if (!content.startsWith("/*", index3))
27457
+ return readCsharpComment(content, index3);
27458
+ const end = blockCommentEnd(content, index3);
27459
+ return { end, text: content.slice(index3, end) };
27375
27460
  }
27376
27461
 
27377
27462
  // src/shared/skipRustLiteral.ts
@@ -27407,21 +27492,21 @@ function skipCharOrLifetime(content, quote) {
27407
27492
  const close = quote + 1 + (codePoint > 65535 ? 2 : 1);
27408
27493
  return content[close] === "'" ? close + 1 : quote + 1;
27409
27494
  }
27410
- function skipPrefixed(content, index2) {
27411
- let end = index2;
27495
+ function skipPrefixed(content, index3) {
27496
+ let end = index3;
27412
27497
  while (end < content.length && IDENTIFIER_CHAR.test(content[end])) end++;
27413
- const word = content.slice(index2, end);
27498
+ const word = content.slice(index3, end);
27414
27499
  const next3 = content[end];
27415
27500
  if (RAW_PREFIX.test(word)) return skipRaw(content, end) ?? end;
27416
27501
  if (QUOTED_PREFIX.test(word) && next3 === '"') return skipQuoted(content, end);
27417
27502
  if (word === "b" && next3 === "'") return skipCharOrLifetime(content, end);
27418
27503
  return end;
27419
27504
  }
27420
- function skipRustLiteral(content, index2) {
27421
- const char = content[index2];
27422
- if (char === '"') return skipQuoted(content, index2);
27423
- if (char === "'") return skipCharOrLifetime(content, index2);
27424
- if (IDENTIFIER_CHAR.test(char)) return skipPrefixed(content, index2);
27505
+ function skipRustLiteral(content, index3) {
27506
+ const char = content[index3];
27507
+ if (char === '"') return skipQuoted(content, index3);
27508
+ if (char === "'") return skipCharOrLifetime(content, index3);
27509
+ if (IDENTIFIER_CHAR.test(char)) return skipPrefixed(content, index3);
27425
27510
  return void 0;
27426
27511
  }
27427
27512
 
@@ -27429,28 +27514,28 @@ function skipRustLiteral(content, index2) {
27429
27514
  function extractRustComments(content) {
27430
27515
  const comments3 = [];
27431
27516
  const lineOf = lineCounter(content);
27432
- let index2 = 0;
27433
- while (index2 < content.length) {
27434
- const comment3 = readRustComment(content, index2);
27517
+ let index3 = 0;
27518
+ while (index3 < content.length) {
27519
+ const comment3 = readRustComment(content, index3);
27435
27520
  if (comment3) {
27436
- comments3.push({ line: lineOf(index2), text: comment3.text });
27437
- index2 = comment3.end;
27438
- } else index2 = skipRustLiteral(content, index2) ?? index2 + 1;
27521
+ comments3.push({ line: lineOf(index3), text: comment3.text });
27522
+ index3 = comment3.end;
27523
+ } else index3 = skipRustLiteral(content, index3) ?? index3 + 1;
27439
27524
  }
27440
27525
  return comments3;
27441
27526
  }
27442
27527
 
27443
27528
  // src/commands/editHook/extractRustCommentTexts.ts
27444
- function extractRustCommentTexts(text19) {
27445
- return commentTexts(extractRustComments(text19));
27529
+ function extractRustCommentTexts(text20) {
27530
+ return commentTexts(extractRustComments(text20));
27446
27531
  }
27447
27532
 
27448
27533
  // src/commands/editHook/extractYamlComments.ts
27449
- function blankNonNewline2(text19) {
27450
- return text19.replace(/[^\n]/g, " ");
27534
+ function blankNonNewline2(text20) {
27535
+ return text20.replace(/[^\n]/g, " ");
27451
27536
  }
27452
- function extractYamlComments(text19) {
27453
- const work = text19.replace(
27537
+ function extractYamlComments(text20) {
27538
+ const work = text20.replace(
27454
27539
  /"(?:[^"\\]|\\.)*"|'(?:[^']|'')*'/g,
27455
27540
  blankNonNewline2
27456
27541
  );
@@ -27466,8 +27551,8 @@ function isHeaderLine(line) {
27466
27551
  const trimmed = line.trim();
27467
27552
  return trimmed === "" || trimmed.startsWith("#");
27468
27553
  }
27469
- function extractShellComments(text19) {
27470
- const lines2 = text19.split("\n");
27554
+ function extractShellComments(text20) {
27555
+ const lines2 = text20.split("\n");
27471
27556
  let firstCodeLine = 0;
27472
27557
  while (firstCodeLine < lines2.length && isHeaderLine(lines2[firstCodeLine])) {
27473
27558
  firstCodeLine++;
@@ -27843,12 +27928,12 @@ function updateIssueType(issueId, issueTypeId) {
27843
27928
  // src/commands/github/issue/fixStructure/writeLineNow.ts
27844
27929
  import { writeSync as writeSync2 } from "fs";
27845
27930
  function writeLineNow(line) {
27846
- const text19 = `${line}
27931
+ const text20 = `${line}
27847
27932
  `;
27848
27933
  try {
27849
- writeSync2(1, text19);
27934
+ writeSync2(1, text20);
27850
27935
  } catch {
27851
- process.stdout.write(text19);
27936
+ process.stdout.write(text20);
27852
27937
  }
27853
27938
  }
27854
27939
 
@@ -28185,8 +28270,8 @@ function annotate(entry) {
28185
28270
  }
28186
28271
  return notes;
28187
28272
  }
28188
- function formatCount(count10, noun) {
28189
- return `${count10} ${noun}${count10 === 1 ? "" : "s"}`;
28273
+ function formatCount(count11, noun) {
28274
+ return `${count11} ${noun}${count11 === 1 ? "" : "s"}`;
28190
28275
  }
28191
28276
  function printFixStructurePlan(plan2, chain2, apply) {
28192
28277
  writeLineNow(chalk182.dim(`chain: ${chain2.join(" > ")}`));
@@ -28276,22 +28361,22 @@ function resolveOrgIssueTypes(owner) {
28276
28361
  // src/commands/github/issue/fixStructure/resolveRootLevelIndex.ts
28277
28362
  function resolveRootLevelIndex(chain2, targetTypeName, level) {
28278
28363
  if (level) {
28279
- const index3 = resolveLevelIndex(chain2, level);
28280
- if (index3 === -1) {
28364
+ const index4 = resolveLevelIndex(chain2, level);
28365
+ if (index4 === -1) {
28281
28366
  throw new Error(
28282
28367
  `--level must name one of ${chain2.join(", ")}, not "${level}"`
28283
28368
  );
28284
28369
  }
28285
- return { index: index3, asserted: true };
28370
+ return { index: index4, asserted: true };
28286
28371
  }
28287
- const index2 = resolveLevelIndex(chain2, targetTypeName);
28288
- if (index2 === -1) {
28372
+ const index3 = resolveLevelIndex(chain2, targetTypeName);
28373
+ if (index3 === -1) {
28289
28374
  const has = targetTypeName ? `has the type ${targetTypeName}, which is not in the ${chain2.join(" > ")} chain` : "has no issue type";
28290
28375
  throw new Error(
28291
28376
  `The target ${has}, so its level cannot be inferred. Re-run with --level ${chain2.map((name) => name.toLowerCase()).join("|")} to assert where it sits.`
28292
28377
  );
28293
28378
  }
28294
- return { index: index2, asserted: false };
28379
+ return { index: index3, asserted: false };
28295
28380
  }
28296
28381
 
28297
28382
  // src/commands/github/issue/fixStructure/types.ts
@@ -28305,14 +28390,14 @@ function fixStructure(target, options2) {
28305
28390
  const issueTypes = resolveOrgIssueTypes(resolved.owner);
28306
28391
  assertChainTypesExist(chain2, issueTypes);
28307
28392
  const root2 = fetchRootIssue(resolved);
28308
- const { index: index2, asserted } = resolveRootLevelIndex(
28393
+ const { index: index3, asserted } = resolveRootLevelIndex(
28309
28394
  chain2,
28310
28395
  root2.typeName,
28311
28396
  options2.level
28312
28397
  );
28313
28398
  const context = {
28314
28399
  chain: chain2,
28315
- rootLevelIndex: index2,
28400
+ rootLevelIndex: index3,
28316
28401
  rootAsserted: asserted,
28317
28402
  issueTypes,
28318
28403
  stripLabels: options2.stripLabel ?? []
@@ -28469,8 +28554,8 @@ function screenshotReference({ path: path109, alt }) {
28469
28554
 
28470
28555
  // src/commands/prs/renderScreenshotBlock.ts
28471
28556
  var VIDEO_EXTENSIONS = /* @__PURE__ */ new Set([".mp4", ".webm", ".mov"]);
28472
- function cell(text19) {
28473
- return text19.replaceAll("|", String.raw`\|`);
28557
+ function cell(text20) {
28558
+ return text20.replaceAll("|", String.raw`\|`);
28474
28559
  }
28475
28560
  function row(cells2) {
28476
28561
  return `| ${cells2.join(" | ")} |`;
@@ -29761,8 +29846,8 @@ function describeInboxScanTool(name, input) {
29761
29846
 
29762
29847
  // src/commands/inbox/assistantScanEvents.ts
29763
29848
  var MAX_TEXT = 500;
29764
- function truncate(text19) {
29765
- const trimmed = text19.trim();
29849
+ function truncate(text20) {
29850
+ const trimmed = text20.trim();
29766
29851
  return trimmed.length <= MAX_TEXT ? trimmed : `${trimmed.slice(0, MAX_TEXT - 1)}\u2026`;
29767
29852
  }
29768
29853
  function blockEvent(block) {
@@ -29781,18 +29866,18 @@ function assistantScanEvents(content) {
29781
29866
  }
29782
29867
 
29783
29868
  // src/commands/review/parseTokenUsage.ts
29784
- function count8(value) {
29869
+ function count9(value) {
29785
29870
  return typeof value === "number" ? value : 0;
29786
29871
  }
29787
29872
  function parseTokenUsage(usage, keys) {
29788
29873
  if (typeof usage !== "object" || usage === null) return void 0;
29789
29874
  const raw = usage;
29790
29875
  const parsed = {
29791
- input: count8(raw.input_tokens),
29792
- output: count8(raw.output_tokens),
29793
- cacheRead: count8(raw[keys.cacheRead])
29876
+ input: count9(raw.input_tokens),
29877
+ output: count9(raw.output_tokens),
29878
+ cacheRead: count9(raw[keys.cacheRead])
29794
29879
  };
29795
- if (keys.cacheWrite) parsed.cacheWrite = count8(raw[keys.cacheWrite]);
29880
+ if (keys.cacheWrite) parsed.cacheWrite = count9(raw[keys.cacheWrite]);
29796
29881
  return parsed;
29797
29882
  }
29798
29883
 
@@ -29873,11 +29958,22 @@ function parseInboxScanOutput(stdout) {
29873
29958
  return inboxScanSchema.parse(result.structured_output).messages;
29874
29959
  }
29875
29960
 
29961
+ // src/commands/inbox/parseScanStreamLine.ts
29962
+ function parseScanStreamLine(line) {
29963
+ try {
29964
+ return JSON.parse(line);
29965
+ } catch {
29966
+ return void 0;
29967
+ }
29968
+ }
29969
+
29876
29970
  // src/commands/inbox/createInboxScanParser.ts
29877
29971
  function createInboxScanParser({
29878
29972
  onEvent = () => {
29879
29973
  },
29880
29974
  onUsage = () => {
29975
+ },
29976
+ onModel = () => {
29881
29977
  }
29882
29978
  } = {}) {
29883
29979
  const usage = createScanUsageTracker();
@@ -29892,13 +29988,11 @@ function createInboxScanParser({
29892
29988
  };
29893
29989
  return {
29894
29990
  onLine(line) {
29895
- let event;
29896
- try {
29897
- event = JSON.parse(line);
29898
- } catch {
29899
- return;
29900
- }
29901
- if (event.type === "assistant") onAssistant(event.message);
29991
+ const event = parseScanStreamLine(line);
29992
+ if (!event) return;
29993
+ if (event.type === "system" && typeof event.model === "string")
29994
+ onModel(event.model);
29995
+ else if (event.type === "assistant") onAssistant(event.message);
29902
29996
  else if (event.type === "result") {
29903
29997
  resultLine = line;
29904
29998
  usage.finish(event);
@@ -30007,6 +30101,67 @@ async function runInboxScanClaude(since, listener = {}) {
30007
30101
  return parser.finish(tail ? `${exit}: ${tail}` : exit);
30008
30102
  }
30009
30103
 
30104
+ // src/shared/db/finishJobRun.ts
30105
+ import { eq as eq50 } from "drizzle-orm";
30106
+ async function finishJobRun(db, id, result) {
30107
+ await db.update(jobRuns).set(result).where(eq50(jobRuns.id, id));
30108
+ }
30109
+
30110
+ // src/shared/db/startJobRun.ts
30111
+ async function startJobRun(db, run4) {
30112
+ const [row3] = await db.insert(jobRuns).values({ ...run4, status: "running" }).returning({ id: jobRuns.id });
30113
+ return row3.id;
30114
+ }
30115
+
30116
+ // src/commands/inbox/withInboxScanJob.ts
30117
+ function usageColumns(usage) {
30118
+ return {
30119
+ inputTokens: usage.input,
30120
+ outputTokens: usage.output,
30121
+ cacheReadTokens: usage.cacheRead,
30122
+ cacheWriteTokens: usage.cacheWrite,
30123
+ costUsd: usage.costUsd
30124
+ };
30125
+ }
30126
+ async function withInboxScanJob(orm, trigger, listener, scan2) {
30127
+ const startedAt = /* @__PURE__ */ new Date();
30128
+ const id = await startJobRun(orm, { kind: "inbox-scan", trigger, startedAt });
30129
+ let usage = emptyScanUsage();
30130
+ let model = null;
30131
+ const finish2 = (status2, detail) => {
30132
+ const finishedAt = /* @__PURE__ */ new Date();
30133
+ return finishJobRun(orm, id, {
30134
+ status: status2,
30135
+ finishedAt,
30136
+ durationMs: finishedAt.getTime() - startedAt.getTime(),
30137
+ model,
30138
+ ...usageColumns(usage),
30139
+ detail
30140
+ });
30141
+ };
30142
+ try {
30143
+ const result = await scan2({
30144
+ ...listener,
30145
+ onUsage: (next3) => {
30146
+ usage = next3;
30147
+ listener.onUsage?.(next3);
30148
+ },
30149
+ onModel: (next3) => {
30150
+ model = next3;
30151
+ listener.onModel?.(next3);
30152
+ }
30153
+ });
30154
+ usage = result.usage;
30155
+ await finish2("finished", `${result.flagged} flagged \xB7 ${result.added} new`);
30156
+ return result;
30157
+ } catch (error) {
30158
+ const message3 = error instanceof Error ? error.message : String(error);
30159
+ await finish2("failed", message3).catch(() => {
30160
+ });
30161
+ throw error;
30162
+ }
30163
+ }
30164
+
30010
30165
  // src/commands/inbox/runInboxScan.ts
30011
30166
  var FIRST_SCAN_LOOKBACK_MS = 24 * 60 * 6e4;
30012
30167
  function toRow2(message3) {
@@ -30020,21 +30175,24 @@ function toRow2(message3) {
30020
30175
  receivedAt: receivedAt && !Number.isNaN(receivedAt.getTime()) ? receivedAt : null
30021
30176
  };
30022
30177
  }
30023
- async function runInboxScan(orm, { wrap = (_since, run4) => run4(), ...listener } = {}) {
30024
- const startedAt = /* @__PURE__ */ new Date();
30025
- const since = await readInboxLastScan(orm) ?? new Date(startedAt.getTime() - FIRST_SCAN_LOOKBACK_MS);
30026
- const { messages, usage } = await wrap(
30027
- since,
30028
- () => runInboxScanClaude(since, listener)
30029
- );
30030
- const added = await upsertInboxMessages(orm, messages.map(toRow2));
30031
- await writeInboxLastScan(orm, startedAt);
30032
- return { flagged: messages.length, added, usage };
30178
+ async function runInboxScan(orm, { trigger, wrap = (_since, run4) => run4(), ...listener }) {
30179
+ return withInboxScanJob(orm, trigger, listener, async (tracked) => {
30180
+ const startedAt = /* @__PURE__ */ new Date();
30181
+ const since = await readInboxLastScan(orm) ?? new Date(startedAt.getTime() - FIRST_SCAN_LOOKBACK_MS);
30182
+ const { messages, usage } = await wrap(
30183
+ since,
30184
+ () => runInboxScanClaude(since, tracked)
30185
+ );
30186
+ const added = await upsertInboxMessages(orm, messages.map(toRow2));
30187
+ await writeInboxLastScan(orm, startedAt);
30188
+ return { flagged: messages.length, added, usage };
30189
+ });
30033
30190
  }
30034
30191
 
30035
30192
  // src/commands/inbox/scan.ts
30036
30193
  async function scan() {
30037
30194
  const { flagged, added, usage } = await runInboxScan(await getDb(), {
30195
+ trigger: "manual",
30038
30196
  wrap: (since, run4) => withSpinner(
30039
30197
  `Scanning Gmail and Slack (Slack since ${since.toISOString()})`,
30040
30198
  run4
@@ -30060,9 +30218,9 @@ import chalk185 from "chalk";
30060
30218
 
30061
30219
  // src/commands/jira/adfToText.ts
30062
30220
  function renderInline(node) {
30063
- const text19 = node.text ?? "";
30064
- if (node.marks?.some((m) => m.type === "code")) return `\`${text19}\``;
30065
- return text19;
30221
+ const text20 = node.text ?? "";
30222
+ if (node.marks?.some((m) => m.type === "code")) return `\`${text20}\``;
30223
+ return text20;
30066
30224
  }
30067
30225
  function renderChildren(node, indent4) {
30068
30226
  return renderNodes(node.content ?? [], indent4);
@@ -30104,8 +30262,8 @@ function isListNode(node) {
30104
30262
  function renderListChild(child, indent4, pad3, marker2, isFirst) {
30105
30263
  if (isListNode(child)) return renderNodes([child], indent4 + 1);
30106
30264
  if (child.type !== "paragraph") return renderNode(child, indent4);
30107
- const text19 = renderChildren(child, indent4);
30108
- return isFirst ? `${pad3}${marker2} ${text19}` : `${pad3} ${text19}`;
30265
+ const text20 = renderChildren(child, indent4);
30266
+ return isFirst ? `${pad3}${marker2} ${text20}` : `${pad3} ${text20}`;
30109
30267
  }
30110
30268
  function renderListItem(node, indent4, marker2) {
30111
30269
  const pad3 = " ".repeat(indent4);
@@ -30709,8 +30867,8 @@ function runInstall(worktreePath, clone, install, onSeeded, onInstalling = () =>
30709
30867
  spawnInstall(worktreePath, worktreePath, command, "", () => onSeeded());
30710
30868
  }
30711
30869
  function installPaths(worktreePath, paths, onSeeded, onInstalling) {
30712
- const next3 = (index2) => {
30713
- const rel = paths[index2];
30870
+ const next3 = (index3) => {
30871
+ const rel = paths[index3];
30714
30872
  if (rel === void 0) {
30715
30873
  onSeeded();
30716
30874
  return;
@@ -30727,12 +30885,12 @@ function installPaths(worktreePath, paths, onSeeded, onInstalling) {
30727
30885
  onInstalling(rel);
30728
30886
  spawnInstall(worktreePath, dir, command, ` in ${rel}`, (outcome) => {
30729
30887
  if (outcome.ok && !outcome.stopped) {
30730
- next3(index2 + 1);
30888
+ next3(index3 + 1);
30731
30889
  return;
30732
30890
  }
30733
- if (index2 < paths.length - 1)
30891
+ if (index3 < paths.length - 1)
30734
30892
  daemonLog(
30735
- `worktree ${worktreePath} install skipping remaining paths: ${paths.slice(index2 + 1).join(", ")}`
30893
+ `worktree ${worktreePath} install skipping remaining paths: ${paths.slice(index3 + 1).join(", ")}`
30736
30894
  );
30737
30895
  onSeeded();
30738
30896
  });
@@ -31130,9 +31288,9 @@ function registerDescriptionLaunch(program, name, slashCommand, description, ali
31130
31288
  "[description]",
31131
31289
  `Text to forward to the /${slashCommand} slash command`
31132
31290
  ).description(description).option("--once", "Exit when the initial task completes").option("--resume-session <id>", RESUME_SESSION_FLAG).action(
31133
- (text19, opts) => launchMode(slashCommand, {
31291
+ (text20, opts) => launchMode(slashCommand, {
31134
31292
  once: opts.once,
31135
- description: text19,
31293
+ description: text20,
31136
31294
  resumeSessionId: opts.resumeSession
31137
31295
  })
31138
31296
  );
@@ -31468,7 +31626,7 @@ function applyIgnore(texts, ignore3) {
31468
31626
  const dropped = new Set(ignore3);
31469
31627
  const present = new Set(texts);
31470
31628
  return {
31471
- texts: texts.filter((text19) => !dropped.has(text19)),
31629
+ texts: texts.filter((text20) => !dropped.has(text20)),
31472
31630
  unmatched: [...new Set(ignore3)].filter((entry) => !present.has(entry))
31473
31631
  };
31474
31632
  }
@@ -31662,9 +31820,9 @@ async function pickAnchors(sessionId, items2) {
31662
31820
 
31663
31821
  // src/commands/miro/readMiroItems.ts
31664
31822
  import { readFileSync as readFileSync46 } from "fs";
31665
- function tryParse(text19) {
31823
+ function tryParse(text20) {
31666
31824
  try {
31667
- return JSON.parse(text19);
31825
+ return JSON.parse(text20);
31668
31826
  } catch {
31669
31827
  return void 0;
31670
31828
  }
@@ -32048,14 +32206,14 @@ async function netcap(options2) {
32048
32206
  const filter = options2.filter ?? "";
32049
32207
  await mkdir6(dirname38(outPath), { recursive: true });
32050
32208
  const extensionPath = await prepareExtensionForLoad(port, filter);
32051
- let count10 = 0;
32209
+ let count11 = 0;
32052
32210
  const handler = createNetcapHandler({
32053
32211
  outPath,
32054
32212
  onPing: () => console.log(chalk196.dim("ping from extension")),
32055
32213
  onCapture: (entry) => {
32056
- count10 += 1;
32214
+ count11 += 1;
32057
32215
  console.log(
32058
- chalk196.green(`captured #${count10}`),
32216
+ chalk196.green(`captured #${count11}`),
32059
32217
  chalk196.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
32060
32218
  );
32061
32219
  }
@@ -32076,7 +32234,7 @@ async function netcap(options2) {
32076
32234
  console.log(
32077
32235
  chalk196.bold(
32078
32236
  `
32079
- netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"} to ${outPath}`
32237
+ netcap stopped \u2014 captured ${count11} ${count11 === 1 ? "entry" : "entries"} to ${outPath}`
32080
32238
  )
32081
32239
  );
32082
32240
  process.exit(0);
@@ -32224,8 +32382,8 @@ function dedupeLinks(links2) {
32224
32382
  }
32225
32383
 
32226
32384
  // src/commands/netcap/linkifyMentions.ts
32227
- function linkifyMentions(text19, mentions) {
32228
- let out = text19;
32385
+ function linkifyMentions(text20, mentions) {
32386
+ let out = text20;
32229
32387
  for (const m of mentions) {
32230
32388
  if (m.name && out.includes(m.name)) {
32231
32389
  out = out.replace(m.name, `[${m.name}](${m.url})`);
@@ -32252,13 +32410,13 @@ function resolveAuthor(mentionMap, author) {
32252
32410
  return mentionMap.get(author) ?? { slug: author, url: profileUrl(author) };
32253
32411
  }
32254
32412
  function buildPost(raw, mentionMap, author) {
32255
- const text19 = joinText(raw.text);
32256
- if (!text19) return void 0;
32413
+ const text20 = joinText(raw.text);
32414
+ if (!text20) return void 0;
32257
32415
  const mentions = resolveMentions(raw, mentionMap, author);
32258
32416
  const relatedPosts = [...new Set(raw.related)];
32259
32417
  return {
32260
- text: text19,
32261
- markdown: linkifyMentions(text19, mentions),
32418
+ text: text20,
32419
+ markdown: linkifyMentions(text20, mentions),
32262
32420
  mentions,
32263
32421
  hashtags: [...new Set(raw.hashtags)],
32264
32422
  links: dedupeLinks(raw.links),
@@ -32399,8 +32557,8 @@ function activityUrnOf(update4) {
32399
32557
  return typeof urn === "string" ? urn : void 0;
32400
32558
  }
32401
32559
  function buildVoyagerPost(update4, profiles) {
32402
- const text19 = commentaryText(update4);
32403
- if (!text19) return void 0;
32560
+ const text20 = commentaryText(update4);
32561
+ if (!text20) return void 0;
32404
32562
  const author = resolveVoyagerAuthor(update4);
32405
32563
  const { mentions, hashtags, links: links2 } = collectVoyagerAttributes(
32406
32564
  update4,
@@ -32409,8 +32567,8 @@ function buildVoyagerPost(update4, profiles) {
32409
32567
  );
32410
32568
  const activityUrn = activityUrnOf(update4);
32411
32569
  return {
32412
- text: text19,
32413
- markdown: linkifyMentions(text19, mentions),
32570
+ text: text20,
32571
+ markdown: linkifyMentions(text20, mentions),
32414
32572
  mentions,
32415
32573
  hashtags,
32416
32574
  links: links2,
@@ -32598,9 +32756,9 @@ async function list4() {
32598
32756
  import chalk200 from "chalk";
32599
32757
 
32600
32758
  // src/commands/backlog/removeFeed.ts
32601
- import { eq as eq50 } from "drizzle-orm";
32759
+ import { eq as eq51 } from "drizzle-orm";
32602
32760
  async function removeFeed(db, url) {
32603
- const deleted = await db.delete(feeds).where(eq50(feeds.url, url)).returning({ id: feeds.id });
32761
+ const deleted = await db.delete(feeds).where(eq51(feeds.url, url)).returning({ id: feeds.id });
32604
32762
  return deleted.length > 0;
32605
32763
  }
32606
32764
 
@@ -32685,11 +32843,11 @@ function printPromptsTable(rows) {
32685
32843
  console.log(chalk201.dim(header));
32686
32844
  console.log(chalk201.dim("-".repeat(header.length)));
32687
32845
  for (const row3 of rows) {
32688
- const count10 = String(row3.count).padStart(countWidth);
32846
+ const count11 = String(row3.count).padStart(countWidth);
32689
32847
  const tool = row3.tool.padEnd(toolWidth);
32690
32848
  const command = truncate2(row3.command, 60).padEnd(commandWidth);
32691
32849
  console.log(
32692
- `${chalk201.yellow(count10)} ${tool} ${command} ${chalk201.dim(row3.repos)}`
32850
+ `${chalk201.yellow(count11)} ${tool} ${command} ${chalk201.dim(row3.repos)}`
32693
32851
  );
32694
32852
  }
32695
32853
  }
@@ -32802,8 +32960,8 @@ async function promptNavigation(currentPage, totalPages) {
32802
32960
  });
32803
32961
  return parseAction(action);
32804
32962
  }
32805
- function computeTotalPages(count10) {
32806
- return Math.ceil(count10 / PAGE_SIZE2);
32963
+ function computeTotalPages(count11) {
32964
+ return Math.ceil(count11 / PAGE_SIZE2);
32807
32965
  }
32808
32966
  async function navigateAndDisplay(pullRequests, totalPages, currentPage) {
32809
32967
  const delta = await promptNavigation(currentPage, totalPages);
@@ -33316,7 +33474,7 @@ function agentFooter(unresolvedCount) {
33316
33474
 
33317
33475
  // src/commands/prs/listComments/commentStyle.ts
33318
33476
  import chalk203 from "chalk";
33319
- var plain = (text19) => text19;
33477
+ var plain = (text20) => text20;
33320
33478
  function colouredState(state) {
33321
33479
  const label = `[${state}]`;
33322
33480
  if (state === "APPROVED") return chalk203.green(label);
@@ -33374,9 +33532,9 @@ function renderResolvedIndex(threads, style) {
33374
33532
  for (const thread of threads) {
33375
33533
  const first = thread.comments[0];
33376
33534
  if (!first) continue;
33377
- const count10 = thread.comments.length > 1 ? ` (${thread.comments.length} comments)` : "";
33535
+ const count11 = thread.comments.length > 1 ? ` (${thread.comments.length} comments)` : "";
33378
33536
  lines2.push(
33379
- ` ${style.bold(threadLocation(first))} ${first.user}: ${firstLine(first.body)}${count10}`
33537
+ ` ${style.bold(threadLocation(first))} ${first.user}: ${firstLine(first.body)}${count11}`
33380
33538
  );
33381
33539
  }
33382
33540
  lines2.push("");
@@ -33384,8 +33542,8 @@ function renderResolvedIndex(threads, style) {
33384
33542
  }
33385
33543
 
33386
33544
  // src/commands/prs/listComments/renderThreadBlock.ts
33387
- function indent2(text19) {
33388
- return text19.split("\n").map((line) => line ? ` ${line}` : line).join("\n");
33545
+ function indent2(text20) {
33546
+ return text20.split("\n").map((line) => line ? ` ${line}` : line).join("\n");
33389
33547
  }
33390
33548
  function renderThreadBlock(thread, style) {
33391
33549
  const first = thread.comments[0];
@@ -33878,9 +34036,9 @@ ${resolves}` : baseWhy);
33878
34036
  import { statSync as statSync9 } from "fs";
33879
34037
  import { basename as basename22, extname as extname5, resolve as resolve24 } from "path";
33880
34038
  function splitOnce(value, separator) {
33881
- const index2 = value.indexOf(separator);
33882
- if (index2 === -1) return null;
33883
- return [value.slice(0, index2), value.slice(index2 + separator.length)];
34039
+ const index3 = value.indexOf(separator);
34040
+ if (index3 === -1) return null;
34041
+ return [value.slice(0, index3), value.slice(index3 + separator.length)];
33884
34042
  }
33885
34043
  function isFile2(path109) {
33886
34044
  try {
@@ -33990,8 +34148,8 @@ function isWallOfText(lines2) {
33990
34148
  if (lines2.some(isListLine)) {
33991
34149
  return false;
33992
34150
  }
33993
- const text19 = lines2.join(" ").trim();
33994
- return text19.length > MAX_PARAGRAPH_CHARS || countSentences(text19) > MAX_PARAGRAPH_SENTENCES;
34151
+ const text20 = lines2.join(" ").trim();
34152
+ return text20.length > MAX_PARAGRAPH_CHARS || countSentences(text20) > MAX_PARAGRAPH_SENTENCES;
33995
34153
  }
33996
34154
  function countSentences(paragraph) {
33997
34155
  return paragraph.match(/[.!?]+(\s|$)/g)?.length ?? 0;
@@ -34628,8 +34786,8 @@ function countUnresolvedThreads(org, repo, prNumber) {
34628
34786
  }
34629
34787
 
34630
34788
  // src/commands/prs/status/describeFetchError.ts
34631
- function firstLine2(text19) {
34632
- const line = text19.split("\n").map((candidate) => candidate.trim()).find((candidate) => candidate.length > 0);
34789
+ function firstLine2(text20) {
34790
+ const line = text20.split("\n").map((candidate) => candidate.trim()).find((candidate) => candidate.length > 0);
34633
34791
  return line ?? null;
34634
34792
  }
34635
34793
  function stderrText(error) {
@@ -34713,8 +34871,8 @@ function bucketPr(pr) {
34713
34871
  }
34714
34872
 
34715
34873
  // src/commands/prs/status/describeAge.ts
34716
- function describeAge(timestamp8, now = Date.now()) {
34717
- const parsed = new Date(timestamp8).getTime();
34874
+ function describeAge(timestamp9, now = Date.now()) {
34875
+ const parsed = new Date(timestamp9).getTime();
34718
34876
  if (Number.isNaN(parsed)) return { hours: null, label: "unknown" };
34719
34877
  const hours = Math.max(0, Math.floor((now - parsed) / 36e5));
34720
34878
  if (hours < 1) return { hours, label: "<1h" };
@@ -34872,12 +35030,12 @@ function printPrStatus(pr) {
34872
35030
  // src/commands/prs/status/printPrsStatus.ts
34873
35031
  function printPrsStatus(report) {
34874
35032
  for (const repo of report.repos) {
34875
- const count10 = repo.pullRequests.length;
34876
- console.log(`${chalk205.bold(repo.repo)} ${chalk205.dim(`(${count10} open)`)}`);
35033
+ const count11 = repo.pullRequests.length;
35034
+ console.log(`${chalk205.bold(repo.repo)} ${chalk205.dim(`(${count11} open)`)}`);
34877
35035
  for (const pr of repo.pullRequests) {
34878
35036
  printPrStatus(pr);
34879
35037
  }
34880
- if (count10 === 0) console.log(chalk205.dim(" no open pull requests"));
35038
+ if (count11 === 0) console.log(chalk205.dim(" no open pull requests"));
34881
35039
  console.log();
34882
35040
  }
34883
35041
  if (report.errors.length === 0) return;
@@ -34949,8 +35107,8 @@ function countProseWords(line) {
34949
35107
  }
34950
35108
  return singles + countTokens(remaining);
34951
35109
  }
34952
- function countTokens(text19) {
34953
- return text19.split(/\s+/).filter((token) => /[A-Za-z0-9]/.test(token)).length;
35110
+ function countTokens(text20) {
35111
+ return text20.split(/\s+/).filter((token) => /[A-Za-z0-9]/.test(token)).length;
34954
35112
  }
34955
35113
 
34956
35114
  // src/commands/readTime/estimateReadSeconds.ts
@@ -35570,8 +35728,8 @@ function unknownEdgeIds(stream, known) {
35570
35728
  );
35571
35729
  }
35572
35730
  function checkStreamGraph(streams) {
35573
- return streams.flatMap((stream, index2) => {
35574
- const where = typeof stream.name === "string" ? stream.name : `stream ${index2}`;
35731
+ return streams.flatMap((stream, index3) => {
35732
+ const where = typeof stream.name === "string" ? stream.name : `stream ${index3}`;
35575
35733
  const ids = nodeIds(stream);
35576
35734
  return [
35577
35735
  ...repeatedIds(ids).map((id) => `${where}: duplicate node id "${id}"`),
@@ -36392,8 +36550,8 @@ function buildOutputPath(outputDir, processName) {
36392
36550
  if (!existsSync66(outputDir)) {
36393
36551
  mkdirSync27(outputDir, { recursive: true });
36394
36552
  }
36395
- const timestamp8 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
36396
- return resolve25(outputDir, `${processName}-${timestamp8}.png`);
36553
+ const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
36554
+ return resolve25(outputDir, `${processName}-${timestamp9}.png`);
36397
36555
  }
36398
36556
  function runPowerShellScript(processName, outputPath) {
36399
36557
  const scriptPath = join87(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
@@ -36923,16 +37081,16 @@ import {
36923
37081
  } from "ts-morph";
36924
37082
  var suppressionPattern = /^\s*(\/\/|\/\*)\s*oxlint-disable\b/;
36925
37083
  function countLeadingSuppressions(sourceFile) {
36926
- let count10 = 0;
37084
+ let count11 = 0;
36927
37085
  for (const stmt of sourceFile.getStatementsWithComments()) {
36928
37086
  const kind = stmt.getKind();
36929
37087
  if ((kind === SyntaxKind6.SingleLineCommentTrivia || kind === SyntaxKind6.MultiLineCommentTrivia) && suppressionPattern.test(stmt.getText())) {
36930
- count10++;
37088
+ count11++;
36931
37089
  } else {
36932
37090
  break;
36933
37091
  }
36934
37092
  }
36935
- return count10;
37093
+ return count11;
36936
37094
  }
36937
37095
  function addImportPreservingSuppressions(sourceFile, structure) {
36938
37096
  if (sourceFile.getImportDeclarations().length > 0) {
@@ -37252,7 +37410,7 @@ function matchNamedImports(importDecl, neededNames) {
37252
37410
  }
37253
37411
  function formatNamedImports(matched, collapseToTypeOnly) {
37254
37412
  return matched.map(
37255
- ({ text: text19, isTypeOnly }) => isTypeOnly && !collapseToTypeOnly ? `type ${text19}` : text19
37413
+ ({ text: text20, isTypeOnly }) => isTypeOnly && !collapseToTypeOnly ? `type ${text20}` : text20
37256
37414
  );
37257
37415
  }
37258
37416
  function matchOptionalImport(node, neededNames) {
@@ -37330,9 +37488,9 @@ function resolveImports(target, dependencies, sourceFile, statements = []) {
37330
37488
  function extractTexts(target, allFunctions, statements) {
37331
37489
  const stmtTexts = statements.map((v) => v.getFullText().trim());
37332
37490
  const fnTexts = allFunctions.map((fn) => {
37333
- const text19 = fn.getFullText().trim();
37334
- if (fn === target && !text19.startsWith("export ")) return `export ${text19}`;
37335
- return text19;
37491
+ const text20 = fn.getFullText().trim();
37492
+ if (fn === target && !text20.startsWith("export ")) return `export ${text20}`;
37493
+ return text20;
37336
37494
  });
37337
37495
  return [...stmtTexts, ...fnTexts];
37338
37496
  }
@@ -38153,8 +38311,8 @@ function pin(anchoring) {
38153
38311
  if (anchoring.root) return anchoring;
38154
38312
  return { ...anchoring, pinned: true, reason: `pinned; ${anchoring.reason}` };
38155
38313
  }
38156
- function anchorTest(file, index2) {
38157
- const imported = sorted(index2.imports.get(file));
38314
+ function anchorTest(file, index3) {
38315
+ const imported = sorted(index3.imports.get(file));
38158
38316
  if (imported.length === 0) return root("test with no subject in scope");
38159
38317
  const stem = testStem(file);
38160
38318
  const subjects = imported.filter(
@@ -38178,23 +38336,23 @@ function anchorImporters(importers, fixed2) {
38178
38336
  )
38179
38337
  };
38180
38338
  }
38181
- function anchorModule(file, index2) {
38182
- if (index2.external.has(file)) return root("imported from outside scope");
38183
- const importers = sorted(index2.importers.get(file));
38184
- const fixed2 = sorted(index2.fixedImporters.get(file));
38339
+ function anchorModule(file, index3) {
38340
+ if (index3.external.has(file)) return root("imported from outside scope");
38341
+ const importers = sorted(index3.importers.get(file));
38342
+ const fixed2 = sorted(index3.fixedImporters.get(file));
38185
38343
  if (importers.length + fixed2.length > 0)
38186
38344
  return anchorImporters(importers, fixed2);
38187
- const tests = sorted(index2.testImporters.get(file));
38345
+ const tests = sorted(index3.testImporters.get(file));
38188
38346
  if (tests.length > 0) return anchored(tests, "sibling", "used only by tests");
38189
38347
  return root("no importers in scope");
38190
38348
  }
38191
- function anchorFile(file, index2, pinned) {
38192
- if (isTestFile(file)) return anchorTest(file, index2);
38193
- const anchoring = anchorModule(file, index2);
38349
+ function anchorFile(file, index3, pinned) {
38350
+ if (isTestFile(file)) return anchorTest(file, index3);
38351
+ const anchoring = anchorModule(file, index3);
38194
38352
  return pinned.has(moduleStem(file)) ? pin(anchoring) : anchoring;
38195
38353
  }
38196
- function collectAnchors(files, index2, pinned) {
38197
- return new Map(files.map((file) => [file, anchorFile(file, index2, pinned)]));
38354
+ function collectAnchors(files, index3, pinned) {
38355
+ return new Map(files.map((file) => [file, anchorFile(file, index3, pinned)]));
38198
38356
  }
38199
38357
 
38200
38358
  // src/commands/refactor/restructure/planRestructure/findCollisions.ts
@@ -38219,7 +38377,7 @@ function add3(map, key, value) {
38219
38377
  map.set(key, set);
38220
38378
  }
38221
38379
  function indexEdges(scope, edges, fixed2) {
38222
- const index2 = {
38380
+ const index3 = {
38223
38381
  importers: /* @__PURE__ */ new Map(),
38224
38382
  testImporters: /* @__PURE__ */ new Map(),
38225
38383
  fixedImporters: /* @__PURE__ */ new Map(),
@@ -38230,17 +38388,17 @@ function indexEdges(scope, edges, fixed2) {
38230
38388
  if (!scope.has(target) || source === target) continue;
38231
38389
  const test = isTestFile(source);
38232
38390
  if (fixed2.has(source)) {
38233
- if (!test) add3(index2.fixedImporters, target, source);
38391
+ if (!test) add3(index3.fixedImporters, target, source);
38234
38392
  continue;
38235
38393
  }
38236
38394
  if (!scope.has(source)) {
38237
- if (!test) index2.external.add(target);
38395
+ if (!test) index3.external.add(target);
38238
38396
  continue;
38239
38397
  }
38240
- add3(index2.imports, source, target);
38241
- add3(test ? index2.testImporters : index2.importers, target, source);
38398
+ add3(index3.imports, source, target);
38399
+ add3(test ? index3.testImporters : index3.importers, target, source);
38242
38400
  }
38243
- return index2;
38401
+ return index3;
38244
38402
  }
38245
38403
 
38246
38404
  // src/commands/refactor/restructure/planRestructure/placeComponents.ts
@@ -38386,12 +38544,12 @@ function placeComponents(files, anchorings, scopeRoot) {
38386
38544
  function planRestructure(input) {
38387
38545
  const scopeRoot = path72.resolve(input.scopeRoot);
38388
38546
  const files = [...new Set(input.files)].sort();
38389
- const index2 = indexEdges(
38547
+ const index3 = indexEdges(
38390
38548
  new Set(files),
38391
38549
  input.edges,
38392
38550
  new Set(input.fixedFiles)
38393
38551
  );
38394
- const anchorings = collectAnchors(files, index2, new Set(input.pinnedModules));
38552
+ const anchorings = collectAnchors(files, index3, new Set(input.pinnedModules));
38395
38553
  const placements = placeComponents(files, anchorings, scopeRoot);
38396
38554
  const targets = /* @__PURE__ */ new Map();
38397
38555
  const moves = [];
@@ -38640,8 +38798,8 @@ import chalk242 from "chalk";
38640
38798
  function relPath(file) {
38641
38799
  return path79.relative(process.cwd(), file);
38642
38800
  }
38643
- function stagingPath(move2, index2) {
38644
- return `${move2.from}.restructure-${process.pid}-${index2}`;
38801
+ function stagingPath(move2, index3) {
38802
+ return `${move2.from}.restructure-${process.pid}-${index3}`;
38645
38803
  }
38646
38804
  function moveFiles(moves) {
38647
38805
  const staged = moves.map((move2, i) => {
@@ -39083,7 +39241,7 @@ function summariseRepoTree(cwd = process.cwd()) {
39083
39241
  return [...directories.entries()].map(([directory, extensions]) => ({
39084
39242
  directory,
39085
39243
  extensions: [...extensions.entries()].sort((a, b) => b[1] - a[1]),
39086
- total: [...extensions.values()].reduce((sum3, count10) => sum3 + count10, 0)
39244
+ total: [...extensions.values()].reduce((sum3, count11) => sum3 + count11, 0)
39087
39245
  })).sort((a, b) => b.total - a.total || a.directory.localeCompare(b.directory)).slice(0, MAX_DIRECTORIES).map(
39088
39246
  (entry) => `${entry.directory} \u2014 ${entry.total} files: ${formatExtensions(entry.extensions)}`
39089
39247
  ).join("\n");
@@ -39111,7 +39269,7 @@ function countByDirectory(files) {
39111
39269
  return directories;
39112
39270
  }
39113
39271
  function formatExtensions(extensions) {
39114
- return extensions.slice(0, MAX_EXTENSIONS_PER_DIRECTORY).map(([extension2, count10]) => `${extension2}(${count10})`).join(", ");
39272
+ return extensions.slice(0, MAX_EXTENSIONS_PER_DIRECTORY).map(([extension2, count11]) => `${extension2}(${count11})`).join(", ");
39115
39273
  }
39116
39274
 
39117
39275
  // src/commands/review/highLevel/proposeHighLevelGlobs.ts
@@ -39393,8 +39551,8 @@ function shownForm(test) {
39393
39551
  );
39394
39552
  return excerptLines <= MAX_TEST_SOURCE_LINES ? { lines: excerptLines, shown: { ...rest, excerpts } } : void 0;
39395
39553
  }
39396
- function lineCount(text19) {
39397
- return text19.split("\n").length;
39554
+ function lineCount(text20) {
39555
+ return text20.split("\n").length;
39398
39556
  }
39399
39557
 
39400
39558
  // src/commands/review/highLevel/capHighLevelTestSources.ts
@@ -39473,9 +39631,9 @@ function testName(call) {
39473
39631
 
39474
39632
  // src/commands/review/highLevel/dedentedSource.ts
39475
39633
  function dedentedSource(call) {
39476
- const text19 = call.getSourceFile().getFullText();
39477
- const lineStart = text19.lastIndexOf("\n", call.getStart()) + 1;
39478
- const indent4 = /^\s*/.exec(text19.slice(lineStart, call.getStart()))?.[0] ?? "";
39634
+ const text20 = call.getSourceFile().getFullText();
39635
+ const lineStart = text20.lastIndexOf("\n", call.getStart()) + 1;
39636
+ const indent4 = /^\s*/.exec(text20.slice(lineStart, call.getStart()))?.[0] ?? "";
39479
39637
  return call.getText().split("\n").map((line) => line.startsWith(indent4) ? line.slice(indent4.length) : line).join("\n");
39480
39638
  }
39481
39639
 
@@ -39535,12 +39693,12 @@ function visit(node, context) {
39535
39693
  }
39536
39694
  ];
39537
39695
  }
39538
- function extractTestHierarchy(path109, text19, changed) {
39696
+ function extractTestHierarchy(path109, text20, changed) {
39539
39697
  const project = new Project5({
39540
39698
  useInMemoryFileSystem: true,
39541
39699
  compilerOptions: { allowJs: true }
39542
39700
  });
39543
- const source = project.createSourceFile(`/${path109}`, text19);
39701
+ const source = project.createSourceFile(`/${path109}`, text20);
39544
39702
  return collect7(source, { path: path109, ...changed ? { changed } : {} });
39545
39703
  }
39546
39704
 
@@ -39662,8 +39820,8 @@ function countEvidence(body) {
39662
39820
  0
39663
39821
  );
39664
39822
  }
39665
- function plural(count10, noun) {
39666
- return `${count10} ${noun}${count10 === 1 ? "" : "s"}`;
39823
+ function plural(count11, noun) {
39824
+ return `${count11} ${noun}${count11 === 1 ? "" : "s"}`;
39667
39825
  }
39668
39826
  function checkUiEvidence(body, changedFiles2, uiPaths) {
39669
39827
  if (uiPaths.length === 0)
@@ -40716,7 +40874,7 @@ function partitionFindings(findings) {
40716
40874
  var FILE_HEADER = /^\+\+\+ (?:b\/)?(.+)$/;
40717
40875
  var HUNK_HEADER3 = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/;
40718
40876
  function buildDiffLineIndex(diff3) {
40719
- const index2 = /* @__PURE__ */ new Map();
40877
+ const index3 = /* @__PURE__ */ new Map();
40720
40878
  let currentFile = null;
40721
40879
  let newLine = 0;
40722
40880
  for (const line of diff3.split("\n")) {
@@ -40733,16 +40891,16 @@ function buildDiffLineIndex(diff3) {
40733
40891
  if (currentFile === null) continue;
40734
40892
  if (line.startsWith("-")) continue;
40735
40893
  if (line.startsWith("+") || line.startsWith(" ")) {
40736
- let set = index2.get(currentFile);
40894
+ let set = index3.get(currentFile);
40737
40895
  if (!set) {
40738
40896
  set = /* @__PURE__ */ new Set();
40739
- index2.set(currentFile, set);
40897
+ index3.set(currentFile, set);
40740
40898
  }
40741
40899
  set.add(newLine);
40742
40900
  newLine++;
40743
40901
  }
40744
40902
  }
40745
- return index2;
40903
+ return index3;
40746
40904
  }
40747
40905
 
40748
40906
  // src/commands/review/fetchPrDiff.ts
@@ -40775,8 +40933,8 @@ function fetchDiffViaGit(baseSha, headSha) {
40775
40933
  }
40776
40934
 
40777
40935
  // src/commands/review/partitionFindingsByDiff.ts
40778
- function isWithinDiff(finding, index2) {
40779
- const lines2 = index2.get(finding.file);
40936
+ function isWithinDiff(finding, index3) {
40937
+ const lines2 = index3.get(finding.file);
40780
40938
  if (!lines2) return false;
40781
40939
  if (!lines2.has(finding.line)) return false;
40782
40940
  if (finding.startLine !== void 0 && !lines2.has(finding.startLine)) {
@@ -40784,11 +40942,11 @@ function isWithinDiff(finding, index2) {
40784
40942
  }
40785
40943
  return true;
40786
40944
  }
40787
- function partitionFindingsByDiff(findings, index2) {
40945
+ function partitionFindingsByDiff(findings, index3) {
40788
40946
  const inDiff = [];
40789
40947
  const outOfDiff = [];
40790
40948
  for (const finding of findings) {
40791
- if (isWithinDiff(finding, index2)) inDiff.push(finding);
40949
+ if (isWithinDiff(finding, index3)) inDiff.push(finding);
40792
40950
  else outOfDiff.push(finding);
40793
40951
  }
40794
40952
  return { inDiff, outOfDiff };
@@ -41122,9 +41280,9 @@ var MultiSpinner = class {
41122
41280
  elapsedPrefix: prefix2
41123
41281
  });
41124
41282
  }
41125
- failRemaining(text19) {
41283
+ failRemaining(text20) {
41126
41284
  for (const entry of this.entries) {
41127
- if (entry.state === "running") this.resolve(entry, "failed", text19);
41285
+ if (entry.state === "running") this.resolve(entry, "failed", text20);
41128
41286
  }
41129
41287
  }
41130
41288
  add(entry) {
@@ -41137,14 +41295,14 @@ var MultiSpinner = class {
41137
41295
  set text(value) {
41138
41296
  entry.text = value;
41139
41297
  },
41140
- succeed: (text19) => this.resolve(entry, "succeeded", text19),
41141
- fail: (text19) => this.resolve(entry, "failed", text19)
41298
+ succeed: (text20) => this.resolve(entry, "succeeded", text20),
41299
+ fail: (text20) => this.resolve(entry, "failed", text20)
41142
41300
  };
41143
41301
  }
41144
- resolve(entry, state, text19) {
41302
+ resolve(entry, state, text20) {
41145
41303
  if (entry.state !== "running") return;
41146
41304
  entry.state = state;
41147
- if (text19 !== void 0) entry.text = text19;
41305
+ if (text20 !== void 0) entry.text = text20;
41148
41306
  entry.elapsedStart = void 0;
41149
41307
  appendReviewLog(renderEntry(entry, 0));
41150
41308
  this.render();
@@ -41485,12 +41643,12 @@ function attachStdoutTail(child, maxBytes = 8192) {
41485
41643
  // src/commands/review/formatReviewerFailure.ts
41486
41644
  var FAST_FAIL_MS = 1e3;
41487
41645
  var STDOUT_TAIL_LINES = 20;
41488
- function indent3(text19) {
41489
- return text19.split(/\r?\n/).map((line) => ` ${line}`);
41646
+ function indent3(text20) {
41647
+ return text20.split(/\r?\n/).map((line) => ` ${line}`);
41490
41648
  }
41491
- function tailLines(text19, maxLines) {
41492
- const lines2 = text19.split(/\r?\n/);
41493
- return lines2.length <= maxLines ? text19 : lines2.slice(-maxLines).join("\n");
41649
+ function tailLines(text20, maxLines) {
41650
+ const lines2 = text20.split(/\r?\n/);
41651
+ return lines2.length <= maxLines ? text20 : lines2.slice(-maxLines).join("\n");
41494
41652
  }
41495
41653
  function isFastFail(input) {
41496
41654
  return input.exitCode !== 0 && input.elapsedMs !== void 0 && input.elapsedMs < FAST_FAIL_MS;
@@ -42300,9 +42458,9 @@ function setupReviewDir(repoRoot2, context, force) {
42300
42458
  console.log(`Review folder: ${paths.reviewDir}`);
42301
42459
  return paths;
42302
42460
  }
42303
- function logPriorComments(count10) {
42304
- if (count10 === 0) return;
42305
- console.log(`Including ${count10} prior review comment(s) in request.md.`);
42461
+ function logPriorComments(count11) {
42462
+ if (count11 === 0) return;
42463
+ console.log(`Including ${count11} prior review comment(s) in request.md.`);
42306
42464
  }
42307
42465
 
42308
42466
  // src/commands/review/gatherContext.ts
@@ -42980,7 +43138,7 @@ function upsertScopedRulesPointer(content, directories) {
42980
43138
  const lines2 = contentLines(content);
42981
43139
  const range = rulesSectionRange(lines2);
42982
43140
  const existing = lines2.findIndex(
42983
- (line, index2) => range !== void 0 && index2 > range.start && index2 < range.end && line.startsWith(POINTER_PREFIX)
43141
+ (line, index3) => range !== void 0 && index3 > range.start && index3 < range.end && line.startsWith(POINTER_PREFIX)
42984
43142
  );
42985
43143
  if (directories.length === 0) {
42986
43144
  if (existing === -1) return content;
@@ -43065,8 +43223,8 @@ import path90 from "path";
43065
43223
  import chalk261 from "chalk";
43066
43224
 
43067
43225
  // src/commands/rules/insertRuleBullet.ts
43068
- function ruleBullet({ code, title, text: text19 }) {
43069
- return title ? `- **${code}** \u2014 **${title}** \u2014 ${text19}` : `- **${code}** \u2014 ${text19}`;
43226
+ function ruleBullet({ code, title, text: text20 }) {
43227
+ return title ? `- **${code}** \u2014 **${title}** \u2014 ${text20}` : `- **${code}** \u2014 ${text20}`;
43070
43228
  }
43071
43229
  function insertRuleBullet(content, rule) {
43072
43230
  const bullet = ruleBullet(rule);
@@ -43075,7 +43233,7 @@ function insertRuleBullet(content, rule) {
43075
43233
  if (!range) return appendRulesSection(lines2, bullet);
43076
43234
  const body = lines2.slice(range.start + 1, range.end);
43077
43235
  const lastBullet = body.reduce(
43078
- (last, line, index2) => RULE_BULLET.test(line) ? index2 : last,
43236
+ (last, line, index3) => RULE_BULLET.test(line) ? index3 : last,
43079
43237
  -1
43080
43238
  );
43081
43239
  const at2 = lastBullet === -1 ? range.start + 1 : range.start + lastBullet + 2;
@@ -43118,8 +43276,8 @@ function resolveRuleScope(target) {
43118
43276
  function read2(file) {
43119
43277
  return existsSync73(file) ? readFileSync59(file, "utf8") : "";
43120
43278
  }
43121
- function addRule(text19, options2) {
43122
- const rule = text19.trim();
43279
+ function addRule(text20, options2) {
43280
+ const rule = text20.trim();
43123
43281
  if (rule === "") {
43124
43282
  console.error(chalk261.red("Rule text is required"));
43125
43283
  process.exitCode = 1;
@@ -43181,10 +43339,10 @@ function addToUserNode(rule, globalConfigPath) {
43181
43339
  `Added ${chalk262.cyan(rule.title)} to advice.rules in user (node) (${globalConfigFileLabel(globalConfigPath)})`
43182
43340
  );
43183
43341
  }
43184
- async function addUserRule(text19, options2, globalConfigPath = getGlobalConfigPath()) {
43342
+ async function addUserRule(text20, options2, globalConfigPath = getGlobalConfigPath()) {
43185
43343
  const error = optionsError(options2);
43186
43344
  if (error) return fail9(error);
43187
- const rule = { title: options2.title?.trim() ?? "", text: text19.trim() };
43345
+ const rule = { title: options2.title?.trim() ?? "", text: text20.trim() };
43188
43346
  if (rule.text === "" || rule.title === "")
43189
43347
  return fail9("User rules need both rule text and --title");
43190
43348
  if (options2.user) return addToUserDb(rule);
@@ -43209,7 +43367,7 @@ function registerRulesAdd(rulesCommand) {
43209
43367
  "--node",
43210
43368
  "As --user, but append to advice.rules in user (node), this node's ~/.assist.yml"
43211
43369
  ).action(
43212
- (text19, options2) => options2.user || options2.node ? addUserRule(text19, options2) : addRule(text19, options2)
43370
+ (text20, options2) => options2.user || options2.node ? addUserRule(text20, options2) : addRule(text20, options2)
43213
43371
  ),
43214
43372
  "/add-rule and /fix-rules"
43215
43373
  );
@@ -43315,16 +43473,16 @@ function filterToSql(filter) {
43315
43473
  }
43316
43474
 
43317
43475
  // src/commands/seq/fetchSeqData.ts
43318
- function buildDataParams(filter, count10, from, to) {
43476
+ function buildDataParams(filter, count11, from, to) {
43319
43477
  const sqlFilter = filterToSql(filter);
43320
- const sql31 = `select @Timestamp, @Level, @Exception, @Message from stream where ${sqlFilter} order by @Timestamp desc limit ${count10}`;
43321
- const params = new URLSearchParams({ q: sql31 });
43478
+ const sql32 = `select @Timestamp, @Level, @Exception, @Message from stream where ${sqlFilter} order by @Timestamp desc limit ${count11}`;
43479
+ const params = new URLSearchParams({ q: sql32 });
43322
43480
  if (from) params.set("rangeStartUtc", from);
43323
43481
  if (to) params.set("rangeEndUtc", to);
43324
43482
  return params;
43325
43483
  }
43326
- async function fetchSeqData(conn, filter, count10, from, to) {
43327
- const params = buildDataParams(filter, count10, from, to);
43484
+ async function fetchSeqData(conn, filter, count11, from, to) {
43485
+ const params = buildDataParams(filter, count11, from, to);
43328
43486
  const response = await fetchSeq(conn, "/api/data", params);
43329
43487
  const data = await response.json();
43330
43488
  return mapDataToEvents(data);
@@ -43491,12 +43649,12 @@ function resolveConnection2(name) {
43491
43649
  async function seqQuery(filter, options2) {
43492
43650
  rejectTimestampFilter(filter);
43493
43651
  const conn = resolveConnection2(options2.connection);
43494
- const count10 = Number.parseInt(options2.count ?? "1000", 10);
43652
+ const count11 = Number.parseInt(options2.count ?? "1000", 10);
43495
43653
  const from = options2.from ? parseRelativeTime(options2.from) : void 0;
43496
43654
  const to = options2.to ? parseRelativeTime(options2.to) : void 0;
43497
- const events = from || to ? await fetchSeqData(conn, filter, count10, from, to) : await fetchSeqEvents(
43655
+ const events = from || to ? await fetchSeqData(conn, filter, count11, from, to) : await fetchSeqEvents(
43498
43656
  conn,
43499
- new URLSearchParams({ filter, count: String(count10) })
43657
+ new URLSearchParams({ filter, count: String(count11) })
43500
43658
  );
43501
43659
  if (events.length === 0) {
43502
43660
  console.log(chalk268.yellow("No events found."));
@@ -43512,10 +43670,10 @@ async function seqQuery(filter, options2) {
43512
43670
  }
43513
43671
  console.log(chalk268.dim(`
43514
43672
  ${events.length} events`));
43515
- if (events.length >= count10) {
43673
+ if (events.length >= count11) {
43516
43674
  console.log(
43517
43675
  chalk268.yellow(
43518
- `Results limited to ${count10}. Use --count to retrieve more.`
43676
+ `Results limited to ${count11}. Use --count to retrieve more.`
43519
43677
  )
43520
43678
  );
43521
43679
  }
@@ -43607,8 +43765,8 @@ var NOT_BEFORE_RELATIVE = String.raw`(?<=^|[^\w.\-/~]|(?:^|[^\w.\-/~])\./)`;
43607
43765
  function normalise(path109) {
43608
43766
  return path109.replaceAll("\\", "/").replace(/\/+$/, "");
43609
43767
  }
43610
- function escapeRegExp2(text19) {
43611
- return text19.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
43768
+ function escapeRegExp2(text20) {
43769
+ return text20.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
43612
43770
  }
43613
43771
  function within(path109, dir) {
43614
43772
  return dir && path109.startsWith(`${dir}/`) ? path109.slice(dir.length + 1) : void 0;
@@ -43632,9 +43790,9 @@ function referencePatterns(path109, { home, cwd }) {
43632
43790
  return patterns;
43633
43791
  }
43634
43792
  function findShownSessionFiles(body, writtenPaths, locations) {
43635
- const text19 = body.replaceAll("\\", "/");
43793
+ const text20 = body.replaceAll("\\", "/");
43636
43794
  return writtenPaths.filter(
43637
- (path109) => referencePatterns(path109, locations).some((pattern2) => pattern2.test(text19))
43795
+ (path109) => referencePatterns(path109, locations).some((pattern2) => pattern2.test(text20))
43638
43796
  );
43639
43797
  }
43640
43798
 
@@ -43665,14 +43823,14 @@ function writtenFilePaths(entry) {
43665
43823
 
43666
43824
  // src/commands/show/sessionWrittenPaths.ts
43667
43825
  function sessionWrittenPaths(transcriptPath2) {
43668
- let text19;
43826
+ let text20;
43669
43827
  try {
43670
- text19 = readFileSync60(transcriptPath2, "utf8");
43828
+ text20 = readFileSync60(transcriptPath2, "utf8");
43671
43829
  } catch {
43672
43830
  return [];
43673
43831
  }
43674
43832
  const paths = /* @__PURE__ */ new Set();
43675
- for (const line of text19.split("\n")) {
43833
+ for (const line of text20.split("\n")) {
43676
43834
  if (!line.includes('"tool_use"')) continue;
43677
43835
  try {
43678
43836
  for (const path109 of writtenFilePaths(JSON.parse(line))) paths.add(path109);
@@ -43847,24 +44005,24 @@ async function previewSlackThreadParts({
43847
44005
  const bodies = readSlackParts(partFiles);
43848
44006
  const { dir } = slackWorkingFile(channel);
43849
44007
  mkdirSync31(dir, { recursive: true });
43850
- const paths = bodies.map((body, index2) => {
43851
- const { bodyPath } = slackWorkingFile(channel, index2 + 1);
44008
+ const paths = bodies.map((body, index3) => {
44009
+ const { bodyPath } = slackWorkingFile(channel, index3 + 1);
43852
44010
  writeFileSync48(bodyPath, `${body}
43853
44011
  `);
43854
44012
  return bodyPath;
43855
44013
  });
43856
- for (const [index2, body] of bodies.entries()) {
44014
+ for (const [index3, body] of bodies.entries()) {
43857
44015
  await reviewProposedSlackMessage(
43858
- { channel, threadTs, part: { index: index2 + 1, total: bodies.length } },
44016
+ { channel, threadTs, part: { index: index3 + 1, total: bodies.length } },
43859
44017
  body,
43860
- paths[index2]
44018
+ paths[index3]
43861
44019
  );
43862
44020
  }
43863
44021
  console.log(
43864
44022
  `Approved for ${target}. The ${bodies.length} bodies to post, in thread order, are at:`
43865
44023
  );
43866
44024
  paths.forEach(
43867
- (path109, index2) => console.log(`${index2 + 1}/${paths.length} ${path109}`)
44025
+ (path109, index3) => console.log(`${index3 + 1}/${paths.length} ${path109}`)
43868
44026
  );
43869
44027
  console.log(
43870
44028
  threadTs ? `Post every part as a reply with thread_ts ${threadTs}.` : `Post 1/${paths.length} to ${channel}, then the rest with the thread_ts it returns.`
@@ -43941,26 +44099,26 @@ import chalk271 from "chalk";
43941
44099
  // src/commands/sql/loadConnections.ts
43942
44100
  function loadConnections3() {
43943
44101
  const raw = loadGlobalConfigRaw();
43944
- const sql31 = raw.sql;
43945
- return sql31?.connections ?? [];
44102
+ const sql32 = raw.sql;
44103
+ return sql32?.connections ?? [];
43946
44104
  }
43947
44105
  function saveConnections3(connections) {
43948
44106
  const raw = loadGlobalConfigRaw();
43949
- const sql31 = raw.sql ?? {};
43950
- sql31.connections = connections;
43951
- raw.sql = sql31;
44107
+ const sql32 = raw.sql ?? {};
44108
+ sql32.connections = connections;
44109
+ raw.sql = sql32;
43952
44110
  saveGlobalConfig(raw);
43953
44111
  }
43954
44112
  function getDefaultConnection2() {
43955
44113
  const raw = loadGlobalConfigRaw();
43956
- const sql31 = raw.sql;
43957
- return sql31?.defaultConnection;
44114
+ const sql32 = raw.sql;
44115
+ return sql32?.defaultConnection;
43958
44116
  }
43959
44117
  function setDefaultConnection2(name) {
43960
44118
  const raw = loadGlobalConfigRaw();
43961
- const sql31 = raw.sql ?? {};
43962
- sql31.defaultConnection = name;
43963
- raw.sql = sql31;
44119
+ const sql32 = raw.sql ?? {};
44120
+ sql32.defaultConnection = name;
44121
+ raw.sql = sql32;
43964
44122
  saveGlobalConfig(raw);
43965
44123
  }
43966
44124
 
@@ -44031,9 +44189,9 @@ function resolveConnection3(name) {
44031
44189
  }
44032
44190
 
44033
44191
  // src/commands/sql/sqlConnect.ts
44034
- import sql25 from "mssql";
44192
+ import sql26 from "mssql";
44035
44193
  async function sqlConnect(conn) {
44036
- return await sql25.connect({
44194
+ return await sql26.connect({
44037
44195
  server: conn.server,
44038
44196
  port: conn.port,
44039
44197
  user: conn.user,
@@ -44096,11 +44254,11 @@ var MUTATION_PATTERN = new RegExp(
44096
44254
  `\\b(${MUTATION_KEYWORDS.join("|")})\\b`,
44097
44255
  "i"
44098
44256
  );
44099
- function stripComments(sql31) {
44100
- return sql31.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/--[^\n]*/g, " ");
44257
+ function stripComments(sql32) {
44258
+ return sql32.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/--[^\n]*/g, " ");
44101
44259
  }
44102
- function isMutation(sql31) {
44103
- const stripped = stripComments(sql31);
44260
+ function isMutation(sql32) {
44261
+ const stripped = stripComments(sql32);
44104
44262
  if (MUTATION_PATTERN.test(stripped)) return true;
44105
44263
  return /\bSELECT\b[\s\S]+\bINTO\s+\w/i.test(stripped);
44106
44264
  }
@@ -44673,8 +44831,8 @@ function formatClock(ms) {
44673
44831
  }
44674
44832
 
44675
44833
  // src/commands/transcript/cleanText.ts
44676
- function cleanText(text19) {
44677
- const words = text19.split(/\s+/);
44834
+ function cleanText(text20) {
44835
+ const words = text20.split(/\s+/);
44678
44836
  const cleaned = [];
44679
44837
  for (let i = 0; i < words.length; i++) {
44680
44838
  let isRepeat = false;
@@ -44694,8 +44852,8 @@ function cleanText(text19) {
44694
44852
  }
44695
44853
 
44696
44854
  // src/commands/transcript/convert/parseVtt/deduplicateCues/removeSubstringDuplicates.ts
44697
- function normalizeText(text19) {
44698
- return text19.toLowerCase().trim();
44855
+ function normalizeText(text20) {
44856
+ return text20.toLowerCase().trim();
44699
44857
  }
44700
44858
  function checkSubstringRelation(textI, textJ) {
44701
44859
  if (textI.includes(textJ) && textI.length > textJ.length)
@@ -44801,8 +44959,8 @@ function parseTimestamp(ts10) {
44801
44959
  }
44802
44960
  function extractSpeaker(fullText) {
44803
44961
  const match = fullText.match(/^<v\s+([^>]+)>/);
44804
- const text19 = fullText.replace(/<v\s+[^>]+>|<\/v>/g, "").trim();
44805
- return { speaker: match ? match[1] : null, text: text19 };
44962
+ const text20 = fullText.replace(/<v\s+[^>]+>|<\/v>/g, "").trim();
44963
+ return { speaker: match ? match[1] : null, text: text20 };
44806
44964
  }
44807
44965
  function isTextLine(line) {
44808
44966
  return !!line.trim() && !line.includes("-->");
@@ -44821,13 +44979,13 @@ function parseTimestampLine(line) {
44821
44979
  return { startMs: parseTimestamp(startStr), endMs: parseTimestamp(endStr) };
44822
44980
  }
44823
44981
  function buildCue(startMs, endMs, fullText) {
44824
- const { speaker, text: text19 } = extractSpeaker(fullText);
44825
- return text19 ? { startMs, endMs, speaker, text: text19 } : null;
44982
+ const { speaker, text: text20 } = extractSpeaker(fullText);
44983
+ return text20 ? { startMs, endMs, speaker, text: text20 } : null;
44826
44984
  }
44827
44985
  function parseCueLine(lines2, i) {
44828
44986
  const { startMs, endMs } = parseTimestampLine(lines2[i]);
44829
- const { text: text19, nextIndex: nextIndex2 } = collectTextLines(lines2, i + 1);
44830
- return { cue: buildCue(startMs, endMs, text19), nextIndex: nextIndex2 };
44987
+ const { text: text20, nextIndex: nextIndex2 } = collectTextLines(lines2, i + 1);
44988
+ return { cue: buildCue(startMs, endMs, text20), nextIndex: nextIndex2 };
44831
44989
  }
44832
44990
  function isCueSeparator(line) {
44833
44991
  return line.trim().includes("-->");
@@ -44878,9 +45036,9 @@ function formatChatLog(messages, options2 = {}) {
44878
45036
  // src/commands/transcript/convert/formatVtt.ts
44879
45037
  function formatCue(cue) {
44880
45038
  const timing = `${formatTimestamp2(cue.startMs)} --> ${formatTimestamp2(cue.endMs)}`;
44881
- const text19 = cue.speaker ? `<v ${cue.speaker}>${cue.text}` : cue.text;
45039
+ const text20 = cue.speaker ? `<v ${cue.speaker}>${cue.text}` : cue.text;
44882
45040
  return `${timing}
44883
- ${text19}`;
45041
+ ${text20}`;
44884
45042
  }
44885
45043
  function formatNoteBlock(lines2) {
44886
45044
  return lines2.length ? [lines2.map((line) => `NOTE ${line}`).join("\n")] : [];
@@ -45196,12 +45354,12 @@ var selectionSchema = z19.strictObject({
45196
45354
  var INTERJECTION = /(?<=^|["',;:.!?—–…])\s*(?:oh,?\s+)?(?:fucking hell|bloody hell|fucking|fuck|shit)(?:\s*[.!?,…]+|\s*$)/gi;
45197
45355
  var WH_EMPHASIS = /\b(whatever|whoever|wherever|whenever|however|what|who|whom|where|when|why|how|which)\s+the\s+(?:fuck|hell|heck)\b/gi;
45198
45356
  var INTENSIFIER = /\b(?:fucking|fuckin'?|(?:god)?damn(?:ed)?)\s+(?=[a-z0-9])(?!(?:it|if|around|about|with|up|off|over|out)\b)/gi;
45199
- function tidy(text19) {
45200
- return text19.replace(/\s+/g, " ").replace(/\s+([,.;:!?])/g, "$1").replace(/,(?=\s*[.!?])/g, "").replace(/^[\s,;:]+/, "").replace(/[\s,;:]+$/, "");
45357
+ function tidy(text20) {
45358
+ return text20.replace(/\s+/g, " ").replace(/\s+([,.;:!?])/g, "$1").replace(/,(?=\s*[.!?])/g, "").replace(/^[\s,;:]+/, "").replace(/[\s,;:]+$/, "");
45201
45359
  }
45202
- function widenAudienceInText(text19) {
45203
- const stripped = text19.replace(INTERJECTION, " ").replace(WH_EMPHASIS, "$1").replace(INTENSIFIER, "");
45204
- return stripped === text19 ? text19 : tidy(stripped);
45360
+ function widenAudienceInText(text20) {
45361
+ const stripped = text20.replace(INTERJECTION, " ").replace(WH_EMPHASIS, "$1").replace(INTENSIFIER, "");
45362
+ return stripped === text20 ? text20 : tidy(stripped);
45205
45363
  }
45206
45364
 
45207
45365
  // src/commands/transcript/widenAudience.ts
@@ -45381,8 +45539,8 @@ function isBicepFile(filePath) {
45381
45539
  }
45382
45540
 
45383
45541
  // src/commands/verify/blockCodeComments/collectBicepComments.ts
45384
- function blankNonNewline3(text19) {
45385
- return text19.replace(/[^\n]/g, " ");
45542
+ function blankNonNewline3(text20) {
45543
+ return text20.replace(/[^\n]/g, " ");
45386
45544
  }
45387
45545
  var STRING_LITERAL = /'''[\s\S]*?'''|'(?:[^'\\]|\\.)*'/g;
45388
45546
  var BLOCK_COMMENT = /\/\*[\s\S]*?\*[/]/g;
@@ -45409,10 +45567,10 @@ function closesBlock(trimmed, from) {
45409
45567
  }
45410
45568
  function csharpHeaderLineCount(content) {
45411
45569
  const lines2 = content.split("\n");
45412
- let count10 = 0;
45570
+ let count11 = 0;
45413
45571
  let inBlock = false;
45414
- while (count10 < lines2.length) {
45415
- const trimmed = lines2[count10].trim();
45572
+ while (count11 < lines2.length) {
45573
+ const trimmed = lines2[count11].trim();
45416
45574
  if (inBlock) {
45417
45575
  inBlock = !closesBlock(trimmed, 0);
45418
45576
  } else if (trimmed.startsWith("/*")) {
@@ -45420,9 +45578,9 @@ function csharpHeaderLineCount(content) {
45420
45578
  } else if (trimmed !== "" && !trimmed.startsWith("//")) {
45421
45579
  break;
45422
45580
  }
45423
- count10++;
45581
+ count11++;
45424
45582
  }
45425
- return count10;
45583
+ return count11;
45426
45584
  }
45427
45585
 
45428
45586
  // src/commands/verify/blockCodeComments/collectCsharpComments.ts
@@ -45434,8 +45592,8 @@ function collectCsharpComments(content) {
45434
45592
  }
45435
45593
 
45436
45594
  // src/commands/verify/blockCodeComments/collectHashComments.ts
45437
- function blankNonNewline4(text19) {
45438
- return text19.replace(/[^\n]/g, " ");
45595
+ function blankNonNewline4(text20) {
45596
+ return text20.replace(/[^\n]/g, " ");
45439
45597
  }
45440
45598
  function isHeaderLine2(line) {
45441
45599
  const trimmed = line.trim();
@@ -45480,17 +45638,17 @@ function collectComments(sourceFile) {
45480
45638
  }
45481
45639
 
45482
45640
  // src/commands/verify/blockCodeComments/collectSourceFindings.ts
45483
- function toSingleLine(text19) {
45484
- return text19.replace(/\s+/g, " ").trim();
45641
+ function toSingleLine(text20) {
45642
+ return text20.replace(/\s+/g, " ").trim();
45485
45643
  }
45486
45644
  function collectSourceFindings(file, lines2, project) {
45487
45645
  const findings = [];
45488
45646
  const sourceFile = project.addSourceFileAtPath(file);
45489
- for (const { pos, text: text19 } of collectComments(sourceFile)) {
45647
+ for (const { pos, text: text20 } of collectComments(sourceFile)) {
45490
45648
  const { line } = sourceFile.getLineAndColumnAtPos(pos);
45491
45649
  if (!lines2.has(line)) continue;
45492
- if (isCommentExempt(text19)) continue;
45493
- findings.push({ file, line, text: toSingleLine(text19) });
45650
+ if (isCommentExempt(text20)) continue;
45651
+ findings.push({ file, line, text: toSingleLine(text20) });
45494
45652
  }
45495
45653
  return findings;
45496
45654
  }
@@ -45510,10 +45668,10 @@ function collectYamlComments(content) {
45510
45668
  // src/commands/verify/blockCodeComments/toFindings.ts
45511
45669
  function toFindings(file, lines2, raw, exempt) {
45512
45670
  const findings = [];
45513
- for (const { line, text: text19 } of raw) {
45671
+ for (const { line, text: text20 } of raw) {
45514
45672
  if (!lines2.has(line)) continue;
45515
- if (exempt && isCommentExempt(text19)) continue;
45516
- findings.push({ file, line, text: text19.replace(/\s+/g, " ").trim() });
45673
+ if (exempt && isCommentExempt(text20)) continue;
45674
+ findings.push({ file, line, text: text20.replace(/\s+/g, " ").trim() });
45517
45675
  }
45518
45676
  return findings;
45519
45677
  }
@@ -45631,8 +45789,8 @@ function blockCodeComments() {
45631
45789
  process.exit(0);
45632
45790
  }
45633
45791
  console.log("Comments on changed lines:\n");
45634
- for (const { file, line, text: text19 } of findings) {
45635
- console.log(`${file}:${line} \u2192 ${text19}`);
45792
+ for (const { file, line, text: text20 } of findings) {
45793
+ console.log(`${file}:${line} \u2192 ${text20}`);
45636
45794
  }
45637
45795
  console.log(`
45638
45796
  Total: ${findings.length} comment(s)`);
@@ -46161,9 +46319,9 @@ function parseWatchDurations(interval, timeout) {
46161
46319
  }
46162
46320
 
46163
46321
  // src/commands/watch/readRecentCommits.ts
46164
- function readRecentCommits(count10 = 10, cwd) {
46322
+ function readRecentCommits(count11 = 10, cwd) {
46165
46323
  const output = runGit3(
46166
- ["log", `-${count10}`, "--pretty=format:%H%x09%h%x09%ar%x09%s"],
46324
+ ["log", `-${count11}`, "--pretty=format:%H%x09%h%x09%ar%x09%s"],
46167
46325
  cwd
46168
46326
  );
46169
46327
  if (!output) return [];
@@ -46174,7 +46332,7 @@ function readRecentCommits(count10 = 10, cwd) {
46174
46332
  }
46175
46333
 
46176
46334
  // src/commands/watch/renderWatchReport.ts
46177
- var escapeCell = (text19) => text19.replaceAll("|", String.raw`\|`);
46335
+ var escapeCell = (text20) => text20.replaceAll("|", String.raw`\|`);
46178
46336
  function renderWatchReport({
46179
46337
  version: version2,
46180
46338
  commits: commits2,
@@ -46319,8 +46477,8 @@ function markSyncPending(from) {
46319
46477
  function gitFailureReason(error) {
46320
46478
  const streams = error;
46321
46479
  for (const stream of [streams?.stderr, streams?.stdout]) {
46322
- const text19 = stream == null ? "" : String(stream).trim();
46323
- if (text19) return text19;
46480
+ const text20 = stream == null ? "" : String(stream).trim();
46481
+ if (text20) return text20;
46324
46482
  }
46325
46483
  const message3 = error instanceof Error ? error.message : String(error);
46326
46484
  return message3.trim() || "git failed without reporting a reason";
@@ -46649,10 +46807,10 @@ function fetchQuietly(cwd, intervalMs) {
46649
46807
  }
46650
46808
 
46651
46809
  // src/commands/watch/detectMovement.ts
46652
- function detectMovement(from, to, count10) {
46810
+ function detectMovement(from, to, count11) {
46653
46811
  if (from === to) return void 0;
46654
- if (!Number.isFinite(count10) || count10 <= 0) return void 0;
46655
- return { from, to, count: count10 };
46812
+ if (!Number.isFinite(count11) || count11 <= 0) return void 0;
46813
+ return { from, to, count: count11 };
46656
46814
  }
46657
46815
 
46658
46816
  // src/commands/watch/readMovement.ts
@@ -46660,8 +46818,8 @@ function readMovement(cwd) {
46660
46818
  try {
46661
46819
  const from = runGit3(["rev-parse", "@"], cwd);
46662
46820
  const to = runGit3(["rev-parse", "@{u}"], cwd);
46663
- const count10 = Number(runGit3(["rev-list", "--count", "@..@{u}"], cwd));
46664
- return detectMovement(from, to, count10);
46821
+ const count11 = Number(runGit3(["rev-list", "--count", "@..@{u}"], cwd));
46822
+ return detectMovement(from, to, count11);
46665
46823
  } catch {
46666
46824
  return void 0;
46667
46825
  }
@@ -47053,11 +47211,11 @@ async function run3(name, args) {
47053
47211
 
47054
47212
  // src/commands/run/extractOption.ts
47055
47213
  function extractOption(args, flag) {
47056
- const index2 = args.indexOf(flag);
47057
- if (index2 === -1) return { value: void 0, remaining: args };
47214
+ const index3 = args.indexOf(flag);
47215
+ if (index3 === -1) return { value: void 0, remaining: args };
47058
47216
  return {
47059
- value: args[index2 + 1],
47060
- remaining: [...args.slice(0, index2), ...args.slice(index2 + 2)]
47217
+ value: args[index3 + 1],
47218
+ remaining: [...args.slice(0, index3), ...args.slice(index3 + 2)]
47061
47219
  };
47062
47220
  }
47063
47221
 
@@ -47141,15 +47299,15 @@ function extractFlag(args, flag) {
47141
47299
 
47142
47300
  // src/commands/run/extractOptionalValueFlag.ts
47143
47301
  function extractOptionalValueFlag(args, flag) {
47144
- const index2 = args.indexOf(flag);
47145
- if (index2 === -1) return { value: void 0, remaining: args };
47146
- const next3 = args[index2 + 1];
47302
+ const index3 = args.indexOf(flag);
47303
+ if (index3 === -1) return { value: void 0, remaining: args };
47304
+ const next3 = args[index3 + 1];
47147
47305
  const hasValue = next3 !== void 0 && !next3.startsWith("-");
47148
47306
  return {
47149
47307
  value: hasValue ? next3 : true,
47150
47308
  remaining: [
47151
- ...args.slice(0, index2),
47152
- ...args.slice(index2 + (hasValue ? 2 : 1))
47309
+ ...args.slice(0, index3),
47310
+ ...args.slice(index3 + (hasValue ? 2 : 1))
47153
47311
  ]
47154
47312
  };
47155
47313
  }
@@ -47173,12 +47331,12 @@ function parseEnvPairs(pairs) {
47173
47331
  if (pairs.length === 0) return void 0;
47174
47332
  const env = {};
47175
47333
  for (const pair of pairs) {
47176
- const eq54 = pair.indexOf("=");
47177
- if (eq54 <= 0) {
47334
+ const eq55 = pair.indexOf("=");
47335
+ if (eq55 <= 0) {
47178
47336
  console.error(`--env must be KEY=VALUE, got "${pair}"`);
47179
47337
  process.exit(1);
47180
47338
  }
47181
- env[pair.slice(0, eq54)] = pair.slice(eq54 + 1);
47339
+ env[pair.slice(0, eq55)] = pair.slice(eq55 + 1);
47182
47340
  }
47183
47341
  return env;
47184
47342
  }
@@ -47191,11 +47349,11 @@ function fail10(spec) {
47191
47349
  process.exit(1);
47192
47350
  }
47193
47351
  function parseParamSpec(spec) {
47194
- const eq54 = spec.indexOf("=");
47195
- const name = eq54 === -1 ? spec : spec.slice(0, eq54);
47196
- if (eq54 !== -1) {
47197
- if (eq54 === 0 || name.endsWith("!")) fail10(spec);
47198
- return { name, default: spec.slice(eq54 + 1) };
47352
+ const eq55 = spec.indexOf("=");
47353
+ const name = eq55 === -1 ? spec : spec.slice(0, eq55);
47354
+ if (eq55 !== -1) {
47355
+ if (eq55 === 0 || name.endsWith("!")) fail10(spec);
47356
+ return { name, default: spec.slice(eq55 + 1) };
47199
47357
  }
47200
47358
  if (name.endsWith("!")) {
47201
47359
  if (name.length === 1) fail10(spec);
@@ -47664,9 +47822,9 @@ async function drainDaemon(options2 = {}) {
47664
47822
  return;
47665
47823
  }
47666
47824
  }
47667
- const count10 = await requestDrain(socket, lines2);
47825
+ const count11 = await requestDrain(socket, lines2);
47668
47826
  socket.destroy();
47669
- console.log(`Drained ${count10} session(s)`);
47827
+ console.log(`Drained ${count11} session(s)`);
47670
47828
  }
47671
47829
  function reportLive(live) {
47672
47830
  console.log(`${live.length} live session(s) would be closed:`);
@@ -47751,10 +47909,10 @@ function createActivityThrottle(onActivity) {
47751
47909
  }
47752
47910
 
47753
47911
  // src/shared/db/readInboxLastRun.ts
47754
- import { eq as eq51 } from "drizzle-orm";
47912
+ import { eq as eq52 } from "drizzle-orm";
47755
47913
  var INBOX_LAST_RUN_KEY = "inbox.lastRun";
47756
47914
  async function readInboxLastRun(orm) {
47757
- const [row3] = await orm.select().from(metadata).where(eq51(metadata.key, INBOX_LAST_RUN_KEY));
47915
+ const [row3] = await orm.select().from(metadata).where(eq52(metadata.key, INBOX_LAST_RUN_KEY));
47758
47916
  return row3 ? JSON.parse(row3.value) : void 0;
47759
47917
  }
47760
47918
 
@@ -47901,10 +48059,10 @@ async function isScheduledScanDue(intervalMinutes) {
47901
48059
  async function runLoggedInboxScan(reason4, listener) {
47902
48060
  daemonLog(`inbox: scan started (${reason4})`);
47903
48061
  try {
47904
- const { flagged, added, usage } = await runInboxScan(
47905
- await getDb(),
47906
- listener
47907
- );
48062
+ const { flagged, added, usage } = await runInboxScan(await getDb(), {
48063
+ ...listener,
48064
+ trigger: reason4 === "scheduled" ? "scheduled" : "manual"
48065
+ });
47908
48066
  daemonLog(
47909
48067
  `inbox: scan flagged ${flagged} message(s), ${added} new (${formatScanUsage(usage)})`
47910
48068
  );
@@ -47981,11 +48139,11 @@ function pollRepoConfigCache(intervalMs = POLL_MS2) {
47981
48139
  inFlight2 = true;
47982
48140
  try {
47983
48141
  const before = cacheSnapshot();
47984
- const count10 = await refreshRepoConfigCache();
48142
+ const count11 = await refreshRepoConfigCache();
47985
48143
  if (failing) daemonLog("repo config cache poll recovered");
47986
48144
  failing = false;
47987
48145
  if (cacheSnapshot() !== before)
47988
- daemonLog(`repo config cache updated (${count10} repos)`);
48146
+ daemonLog(`repo config cache updated (${count11} repos)`);
47989
48147
  } catch (error) {
47990
48148
  if (!failing)
47991
48149
  daemonLog(
@@ -48004,8 +48162,8 @@ function pollRepoConfigCache(intervalMs = POLL_MS2) {
48004
48162
  // src/commands/sessions/daemon/refreshRepoConfigCacheOnStart.ts
48005
48163
  async function refreshRepoConfigCacheOnStart() {
48006
48164
  try {
48007
- const count10 = await refreshRepoConfigCache();
48008
- daemonLog(`repo config cache refreshed (${count10} repos)`);
48165
+ const count11 = await refreshRepoConfigCache();
48166
+ daemonLog(`repo config cache refreshed (${count11} repos)`);
48009
48167
  } catch (error) {
48010
48168
  daemonLog(
48011
48169
  `repo config cache refresh failed; keeping the last snapshot: ${String(error)}`
@@ -48242,9 +48400,9 @@ function latest(current, at2) {
48242
48400
  return current === void 0 || at2 > current ? at2 : current;
48243
48401
  }
48244
48402
  async function lastWriteTimes(transcriptPath2, target) {
48245
- const text19 = await readFile9(transcriptPath2, "utf8").catch(() => "");
48403
+ const text20 = await readFile9(transcriptPath2, "utf8").catch(() => "");
48246
48404
  const result = {};
48247
- for (const line of text19.split("\n")) {
48405
+ for (const line of text20.split("\n")) {
48248
48406
  if (!line.includes('"tool_use"')) continue;
48249
48407
  let entry;
48250
48408
  try {
@@ -48479,14 +48637,14 @@ var ESC3 = String.fromCharCode(27);
48479
48637
  var PASTE_START = `${ESC3}[200~`;
48480
48638
  var PASTE_END = `${ESC3}[201~`;
48481
48639
  var SUBMIT = "\r";
48482
- function bracketedPaste(text19) {
48483
- return `${PASTE_START}${text19.replace(/\r?\n/g, SUBMIT)}${PASTE_END}`;
48640
+ function bracketedPaste(text20) {
48641
+ return `${PASTE_START}${text20.replace(/\r?\n/g, SUBMIT)}${PASTE_END}`;
48484
48642
  }
48485
48643
 
48486
48644
  // src/commands/sessions/shared/pasteAndSubmit.ts
48487
48645
  var SUBMIT_DELAY_MS = 150;
48488
- function pasteAndSubmit(sendInput, sessionId, text19) {
48489
- sendInput(sessionId, bracketedPaste(text19));
48646
+ function pasteAndSubmit(sendInput, sessionId, text20) {
48647
+ sendInput(sessionId, bracketedPaste(text20));
48490
48648
  setTimeout(() => sendInput(sessionId, SUBMIT), SUBMIT_DELAY_MS);
48491
48649
  }
48492
48650
 
@@ -48495,30 +48653,30 @@ function flushPendingPrompts(session, write2) {
48495
48653
  if (!session?.pendingPrompts?.length || session.permissionActive)
48496
48654
  return false;
48497
48655
  if (session.status === "done" || !session.pty) return false;
48498
- const text19 = session.pendingPrompts.join("\n\n");
48656
+ const text20 = session.pendingPrompts.join("\n\n");
48499
48657
  daemonLog(
48500
48658
  `session ${session.id} typed ${session.pendingPrompts.length} queued prompt(s)`
48501
48659
  );
48502
48660
  session.pendingPrompts = void 0;
48503
- pasteAndSubmit(write2, session.id, text19);
48661
+ pasteAndSubmit(write2, session.id, text20);
48504
48662
  return true;
48505
48663
  }
48506
48664
 
48507
48665
  // src/commands/sessions/daemon/typePromptIntoSession.ts
48508
- function typePromptIntoSession(sessions, id, text19, write2) {
48666
+ function typePromptIntoSession(sessions, id, text20, write2) {
48509
48667
  const session = sessions.get(id);
48510
48668
  if (!session) return { refused: `assist session ${id} was not found` };
48511
48669
  if (session.status === "done" || !session.pty)
48512
48670
  return { refused: `assist session ${id} has ended` };
48513
48671
  if (session.permissionActive) {
48514
- session.pendingPrompts = [...session.pendingPrompts ?? [], text19];
48672
+ session.pendingPrompts = [...session.pendingPrompts ?? [], text20];
48515
48673
  daemonLog(
48516
- `session ${id} queued prompt behind open permission prompt: ${JSON.stringify(text19)}`
48674
+ `session ${id} queued prompt behind open permission prompt: ${JSON.stringify(text20)}`
48517
48675
  );
48518
48676
  return { queued: true };
48519
48677
  }
48520
- pasteAndSubmit(write2, id, text19);
48521
- daemonLog(`session ${id} typed prompt: ${JSON.stringify(text19)}`);
48678
+ pasteAndSubmit(write2, id, text20);
48679
+ daemonLog(`session ${id} typed prompt: ${JSON.stringify(text20)}`);
48522
48680
  return { queued: false };
48523
48681
  }
48524
48682
 
@@ -48765,24 +48923,24 @@ var SessionIo = class {
48765
48923
  onClaim: this.notify
48766
48924
  });
48767
48925
  }
48768
- typePrompt(id, text19) {
48926
+ typePrompt(id, text20) {
48769
48927
  const result = typePromptIntoSession(
48770
48928
  this.sessions,
48771
48929
  id,
48772
- text19,
48930
+ text20,
48773
48931
  this.writeAsDaemon
48774
48932
  );
48775
48933
  if ("queued" in result && result.queued) this.notify();
48776
48934
  return typePromptReply(id, result);
48777
48935
  }
48778
- async typePromptToLastWriter(target, text19) {
48936
+ async typePromptToLastWriter(target, text20) {
48779
48937
  const id = await findDocsSession(this.sessions, target);
48780
48938
  if (!id)
48781
48939
  return {
48782
48940
  ok: false,
48783
48941
  message: `No live Claude session shares a directory with the server for ${target.file} or has written anything in ${target.within}`
48784
48942
  };
48785
- return this.typePrompt(id, text19);
48943
+ return this.typePrompt(id, text20);
48786
48944
  }
48787
48945
  flushPendingPrompts(id) {
48788
48946
  if (flushPendingPrompts(this.sessions.get(id), this.writeAsDaemon))
@@ -49278,9 +49436,9 @@ async function holdForEscalation(sessionId, deps2) {
49278
49436
  var OUTPUT_TAIL = 16 * 1024;
49279
49437
  async function runLapCapturingTail(deps2) {
49280
49438
  let tail = "";
49281
- const end = await deps2.runLap((text19) => {
49282
- tail = (tail + text19).slice(-OUTPUT_TAIL);
49283
- deps2.record(text19);
49439
+ const end = await deps2.runLap((text20) => {
49440
+ tail = (tail + text20).slice(-OUTPUT_TAIL);
49441
+ deps2.record(text20);
49284
49442
  });
49285
49443
  return { end, tail };
49286
49444
  }
@@ -49582,8 +49740,8 @@ function escalateDivergence(ctx, cwd, output) {
49582
49740
  // src/commands/sessions/daemon/autoUpdate/lineRecorder.ts
49583
49741
  function lineRecorder(onLine) {
49584
49742
  let pending = "";
49585
- return (text19) => {
49586
- const lines2 = (pending + text19).split(/\r?\n|\r/);
49743
+ return (text20) => {
49744
+ const lines2 = (pending + text20).split(/\r?\n|\r/);
49587
49745
  pending = lines2.pop() ?? "";
49588
49746
  for (const line of lines2) {
49589
49747
  const clean2 = stripAnsi(line).trimEnd();
@@ -49593,16 +49751,16 @@ function lineRecorder(onLine) {
49593
49751
  }
49594
49752
 
49595
49753
  // src/commands/sessions/daemon/watcherNote.ts
49596
- function watcherNote(text19) {
49754
+ function watcherNote(text20) {
49597
49755
  return `\r
49598
- \x1B[2m\u2500\u2500 ${text19} \u2500\u2500\x1B[0m\r
49756
+ \x1B[2m\u2500\u2500 ${text20} \u2500\u2500\x1B[0m\r
49599
49757
  `;
49600
49758
  }
49601
49759
 
49602
49760
  // src/commands/sessions/daemon/autoUpdate/noteAutoUpdate.ts
49603
- function noteAutoUpdate(installDir, text19) {
49604
- appendWatcherLog(installDir, watcherNote(text19));
49605
- daemonLog(`auto-update: ${text19}`);
49761
+ function noteAutoUpdate(installDir, text20) {
49762
+ appendWatcherLog(installDir, watcherNote(text20));
49763
+ daemonLog(`auto-update: ${text20}`);
49606
49764
  }
49607
49765
 
49608
49766
  // src/commands/sessions/daemon/autoUpdate/runUpdateLap.ts
@@ -49651,11 +49809,11 @@ function loopDeps(installDir, ctx) {
49651
49809
  const logLine = lineRecorder((line) => daemonLog(`auto-update: ${line}`));
49652
49810
  return {
49653
49811
  runLap: (onOutput) => runUpdateLap(installDir, onOutput),
49654
- record: (text19) => {
49655
- appendWatcherLog(installDir, text19);
49656
- logLine(text19);
49812
+ record: (text20) => {
49813
+ appendWatcherLog(installDir, text20);
49814
+ logLine(text20);
49657
49815
  },
49658
- note: (text19) => noteAutoUpdate(installDir, text19),
49816
+ note: (text20) => noteAutoUpdate(installDir, text20),
49659
49817
  enter: autoUpdateState.enter,
49660
49818
  liveEscalation: () => liveEscalationIn(ctx().sessions, clone)?.id,
49661
49819
  escalate: (output) => escalateDivergence(ctx(), installDir, output),
@@ -49965,14 +50123,14 @@ function reportUndeliveredPrompts(session, why) {
49965
50123
  const pending = session.pendingPrompts;
49966
50124
  if (!pending?.length) return;
49967
50125
  session.pendingPrompts = void 0;
49968
- for (const text19 of pending) {
50126
+ for (const text20 of pending) {
49969
50127
  daemonLog(
49970
- `session ${session.id} ${why}; queued prompt undelivered: ${JSON.stringify(text19)}`
50128
+ `session ${session.id} ${why}; queued prompt undelivered: ${JSON.stringify(text20)}`
49971
50129
  );
49972
50130
  recordPromptJournal({
49973
50131
  event: "undelivered",
49974
50132
  sessionId: session.id,
49975
- text: text19,
50133
+ text: text20,
49976
50134
  message: why
49977
50135
  });
49978
50136
  }
@@ -50274,13 +50432,13 @@ function drainSessions(sessions, notify2) {
50274
50432
  }
50275
50433
 
50276
50434
  // src/shared/db/recordPhaseActiveMs.ts
50277
- import { sql as sql26 } from "drizzle-orm";
50435
+ import { sql as sql27 } from "drizzle-orm";
50278
50436
  async function recordPhaseActiveMs(db, itemId2, phaseIdx, activeMs) {
50279
50437
  if (activeMs <= 0) return;
50280
50438
  await db.insert(phaseUsage).values({ itemId: itemId2, phaseIdx, activeMs }).onConflictDoUpdate({
50281
50439
  target: [phaseUsage.itemId, phaseUsage.phaseIdx],
50282
50440
  set: {
50283
- activeMs: sql26`${phaseUsage.activeMs} + excluded.active_ms`
50441
+ activeMs: sql27`${phaseUsage.activeMs} + excluded.active_ms`
50284
50442
  }
50285
50443
  });
50286
50444
  }
@@ -50357,12 +50515,12 @@ function closeSessionPreviews(session, waiters, reason4) {
50357
50515
  }
50358
50516
 
50359
50517
  // src/commands/sessions/daemon/logPrDecision.ts
50360
- function count9(value) {
50518
+ function count10(value) {
50361
50519
  return Array.isArray(value) ? value.length : 0;
50362
50520
  }
50363
50521
  function logPrDecision(id, requestId, d) {
50364
50522
  daemonLog(
50365
- `pr-decision received: id=${id} requestId=${requestId} decision=${d.decision} comments=${count9(d.comments)} screenshots=${count9(d.screenshots)} checklist=${count9(d.checklist)} reviewEvent=${d.reviewEvent} reviewComments=${count9(d.reviewComments)} reviewAfter=${d.reviewAfter === true} announceAfter=${d.announceAfter === true} draft=${d.draft} autoMerge=${d.autoMerge === true} autostart=${d.autostart === true} answers=${d.answers && typeof d.answers === "object" ? Object.keys(d.answers).length : 0}`
50523
+ `pr-decision received: id=${id} requestId=${requestId} decision=${d.decision} comments=${count10(d.comments)} screenshots=${count10(d.screenshots)} checklist=${count10(d.checklist)} reviewEvent=${d.reviewEvent} reviewComments=${count10(d.reviewComments)} reviewAfter=${d.reviewAfter === true} announceAfter=${d.announceAfter === true} draft=${d.draft} autoMerge=${d.autoMerge === true} autostart=${d.autostart === true} answers=${d.answers && typeof d.answers === "object" ? Object.keys(d.answers).length : 0}`
50366
50524
  );
50367
50525
  }
50368
50526
 
@@ -50434,12 +50592,12 @@ function parsePreviewMetadata(value) {
50434
50592
  const items2 = value.flatMap((entry) => {
50435
50593
  const {
50436
50594
  label,
50437
- value: text19,
50595
+ value: text20,
50438
50596
  url
50439
50597
  } = entry ?? {};
50440
- if (typeof label !== "string" || typeof text19 !== "string") return [];
50598
+ if (typeof label !== "string" || typeof text20 !== "string") return [];
50441
50599
  return [
50442
- typeof url === "string" ? { label, value: text19, url } : { label, value: text19 }
50600
+ typeof url === "string" ? { label, value: text20, url } : { label, value: text20 }
50443
50601
  ];
50444
50602
  });
50445
50603
  return items2.length > 0 ? items2 : void 0;
@@ -50669,12 +50827,12 @@ function sessionTitlePrompt(session) {
50669
50827
  }
50670
50828
  function assistPromptArg(args) {
50671
50829
  const rest = args?.slice(1).filter((a) => !a.startsWith("--"));
50672
- const text19 = rest?.[rest.length - 1]?.trim();
50673
- if (!text19 || isBacklogItemId(text19)) return void 0;
50674
- return text19;
50830
+ const text20 = rest?.[rest.length - 1]?.trim();
50831
+ if (!text20 || isBacklogItemId(text20)) return void 0;
50832
+ return text20;
50675
50833
  }
50676
- function isBacklogItemId(text19) {
50677
- return /^\d+$/.test(text19);
50834
+ function isBacklogItemId(text20) {
50835
+ return /^\d+$/.test(text20);
50678
50836
  }
50679
50837
 
50680
50838
  // src/commands/sessions/daemon/generateSessionTitle.ts
@@ -50926,10 +51084,10 @@ function applyReviewPause(session, activity2) {
50926
51084
  }
50927
51085
 
50928
51086
  // src/shared/db/getPhaseActiveMs.ts
50929
- import { and as and21, eq as eq52 } from "drizzle-orm";
51087
+ import { and as and21, eq as eq53 } from "drizzle-orm";
50930
51088
  async function getPhaseActiveMs(db, itemId2, phaseIdx) {
50931
51089
  const [row3] = await db.select({ activeMs: phaseUsage.activeMs }).from(phaseUsage).where(
50932
- and21(eq52(phaseUsage.itemId, itemId2), eq52(phaseUsage.phaseIdx, phaseIdx))
51090
+ and21(eq53(phaseUsage.itemId, itemId2), eq53(phaseUsage.phaseIdx, phaseIdx))
50933
51091
  );
50934
51092
  return row3?.activeMs ?? 0;
50935
51093
  }
@@ -51078,7 +51236,7 @@ async function resolveCodexSessionId(cwd, sinceMs) {
51078
51236
  paths.map((file) => touchedSince(file, sinceMs))
51079
51237
  );
51080
51238
  const candidates = await Promise.all(
51081
- paths.filter((_, index2) => touched[index2]).map((file) => startedIn(file, cwd, sinceMs))
51239
+ paths.filter((_, index3) => touched[index3]).map((file) => startedIn(file, cwd, sinceMs))
51082
51240
  );
51083
51241
  return newestSessionId(candidates);
51084
51242
  }
@@ -51206,9 +51364,9 @@ function normalizeUser(entry) {
51206
51364
  function asRecord2(value) {
51207
51365
  return value && typeof value === "object" ? value : null;
51208
51366
  }
51209
- function normalizeUserText(text19) {
51210
- if (isInterruptText(text19)) return { kind: "interrupt" };
51211
- if (typeof text19 === "string" && text19.trimStart().startsWith(TASK_NOTIFICATION))
51367
+ function normalizeUserText(text20) {
51368
+ if (isInterruptText(text20)) return { kind: "interrupt" };
51369
+ if (typeof text20 === "string" && text20.trimStart().startsWith(TASK_NOTIFICATION))
51212
51370
  return { kind: "taskNotification" };
51213
51371
  return { kind: "user" };
51214
51372
  }
@@ -51269,8 +51427,8 @@ function extractLastAssistantMessage(entries) {
51269
51427
  for (let i = entries.length - 1; i >= 0; i--) {
51270
51428
  const entry = entries[i];
51271
51429
  if (entry.isSidechain || entry.type !== "assistant") continue;
51272
- const text19 = assistantText(entry);
51273
- if (text19) return cap(text19);
51430
+ const text20 = assistantText(entry);
51431
+ if (text20) return cap(text20);
51274
51432
  }
51275
51433
  return void 0;
51276
51434
  }
@@ -51285,8 +51443,8 @@ function assistantText(entry) {
51285
51443
  }
51286
51444
  return parts.join("\n");
51287
51445
  }
51288
- function cap(text19) {
51289
- return text19.length <= MAX_LENGTH ? text19 : `${text19.slice(0, MAX_LENGTH).trimEnd()}\u2026`;
51446
+ function cap(text20) {
51447
+ return text20.length <= MAX_LENGTH ? text20 : `${text20.slice(0, MAX_LENGTH).trimEnd()}\u2026`;
51290
51448
  }
51291
51449
  function asRecord4(value) {
51292
51450
  return value && typeof value === "object" ? value : null;
@@ -51334,9 +51492,9 @@ function promptTextOrNull(entry) {
51334
51492
  for (const block of content) {
51335
51493
  const b = asRecord5(block);
51336
51494
  if (b?.type !== "text") continue;
51337
- const text19 = typeof b.text === "string" ? b.text : "";
51338
- if (isInterrupt(text19)) return null;
51339
- parts.push(text19);
51495
+ const text20 = typeof b.text === "string" ? b.text : "";
51496
+ if (isInterrupt(text20)) return null;
51497
+ parts.push(text20);
51340
51498
  }
51341
51499
  return parts.length === 0 ? null : parts.join("\n");
51342
51500
  }
@@ -51426,17 +51584,17 @@ function entryMessages(entry) {
51426
51584
  return [];
51427
51585
  }
51428
51586
  function userMessages(content) {
51429
- if (typeof content === "string") return text17("user", cleanUserText(content));
51587
+ if (typeof content === "string") return text18("user", cleanUserText(content));
51430
51588
  if (!Array.isArray(content)) return [];
51431
- return content.filter((c) => c.type === "text").flatMap((c) => text17("user", cleanUserText(c.text ?? "")));
51589
+ return content.filter((c) => c.type === "text").flatMap((c) => text18("user", cleanUserText(c.text ?? "")));
51432
51590
  }
51433
51591
  function assistantMessages(content) {
51434
- if (typeof content === "string") return text17("assistant", content.trim());
51592
+ if (typeof content === "string") return text18("assistant", content.trim());
51435
51593
  if (!Array.isArray(content)) return [];
51436
51594
  return content.flatMap((c) => assistantItem(c));
51437
51595
  }
51438
51596
  function assistantItem(c) {
51439
- if (c.type === "text") return text17("assistant", (c.text ?? "").trim());
51597
+ if (c.type === "text") return text18("assistant", (c.text ?? "").trim());
51440
51598
  if (c.type === "tool_use")
51441
51599
  return [
51442
51600
  {
@@ -51447,7 +51605,7 @@ function assistantItem(c) {
51447
51605
  ];
51448
51606
  return [];
51449
51607
  }
51450
- function text17(role, value) {
51608
+ function text18(role, value) {
51451
51609
  return value ? [{ role, text: value }] : [];
51452
51610
  }
51453
51611
  function cleanUserText(value) {
@@ -51462,10 +51620,10 @@ function extractContextAfterReference(filePath) {
51462
51620
  if (head === void 0) return void 0;
51463
51621
  const parts = [];
51464
51622
  let length = 0;
51465
- for (const text19 of conversationText(head)) {
51466
- if (parts.length === 0 && isBareReferencePrompt(text19)) continue;
51467
- parts.push(text19);
51468
- length += text19.length;
51623
+ for (const text20 of conversationText(head)) {
51624
+ if (parts.length === 0 && isBareReferencePrompt(text20)) continue;
51625
+ parts.push(text20);
51626
+ length += text20.length;
51469
51627
  if (length >= MAX_CONTEXT_CHARS) break;
51470
51628
  }
51471
51629
  if (length < MIN_CONTEXT_CHARS) return void 0;
@@ -51476,8 +51634,8 @@ function* conversationText(head) {
51476
51634
  if (!line) continue;
51477
51635
  const entry = parseEntry(line);
51478
51636
  if (!entry || entry.isSidechain || entry.isMeta) continue;
51479
- for (const text19 of entryText(entry)) {
51480
- const trimmed = text19.trim();
51637
+ for (const text20 of entryText(entry)) {
51638
+ const trimmed = text20.trim();
51481
51639
  if (trimmed) yield trimmed;
51482
51640
  }
51483
51641
  }
@@ -51512,13 +51670,13 @@ function parseEntry(line) {
51512
51670
 
51513
51671
  // src/commands/sessions/summarise/extractFirstUserMessage.ts
51514
51672
  function extractFirstUserMessage(filePath) {
51515
- for (const text19 of iterateUserMessages(filePath)) {
51516
- return truncate4(text19);
51673
+ for (const text20 of iterateUserMessages(filePath)) {
51674
+ return truncate4(text20);
51517
51675
  }
51518
51676
  return void 0;
51519
51677
  }
51520
- function truncate4(text19, maxChars = 500) {
51521
- const trimmed = text19.trim();
51678
+ function truncate4(text20, maxChars = 500) {
51679
+ const trimmed = text20.trim();
51522
51680
  if (trimmed.length <= maxChars) return trimmed;
51523
51681
  return `${trimmed.slice(0, maxChars)}\u2026`;
51524
51682
  }
@@ -51685,7 +51843,7 @@ async function readTranscriptUsage(transcriptPath2) {
51685
51843
  }
51686
51844
 
51687
51845
  // src/shared/db/recordPhaseCycleContext.ts
51688
- import { sql as sql27 } from "drizzle-orm";
51846
+ import { sql as sql28 } from "drizzle-orm";
51689
51847
  async function recordPhaseCycleContext(db, itemId2, phaseIdx, window, resetsAt, pct) {
51690
51848
  if (pct <= 0) return;
51691
51849
  await db.insert(phaseCycleContext).values({ itemId: itemId2, phaseIdx, window, resetsAt, peakContextPct: pct }).onConflictDoUpdate({
@@ -51696,24 +51854,24 @@ async function recordPhaseCycleContext(db, itemId2, phaseIdx, window, resetsAt,
51696
51854
  phaseCycleContext.resetsAt
51697
51855
  ],
51698
51856
  set: {
51699
- peakContextPct: sql27`GREATEST(${phaseCycleContext.peakContextPct}, ${pct})`
51857
+ peakContextPct: sql28`GREATEST(${phaseCycleContext.peakContextPct}, ${pct})`
51700
51858
  }
51701
51859
  });
51702
51860
  }
51703
51861
 
51704
51862
  // src/shared/db/recordPhasePeakContext.ts
51705
- import { sql as sql28 } from "drizzle-orm";
51863
+ import { sql as sql29 } from "drizzle-orm";
51706
51864
  async function recordPhasePeakContext(db, itemId2, phaseIdx, pct) {
51707
51865
  await db.insert(phaseUsage).values({ itemId: itemId2, phaseIdx, peakContextPct: pct }).onConflictDoUpdate({
51708
51866
  target: [phaseUsage.itemId, phaseUsage.phaseIdx],
51709
51867
  set: {
51710
- peakContextPct: sql28`GREATEST(${phaseUsage.peakContextPct}, ${pct})`
51868
+ peakContextPct: sql29`GREATEST(${phaseUsage.peakContextPct}, ${pct})`
51711
51869
  }
51712
51870
  });
51713
51871
  }
51714
51872
 
51715
51873
  // src/shared/db/recordPhaseTranscriptUsage.ts
51716
- import { sql as sql29 } from "drizzle-orm";
51874
+ import { sql as sql30 } from "drizzle-orm";
51717
51875
  async function recordPhaseTranscriptUsage(db, itemId2, phaseIdx, responses) {
51718
51876
  const byId = /* @__PURE__ */ new Map();
51719
51877
  for (const r of responses) byId.set(r.messageId, r);
@@ -51733,8 +51891,8 @@ async function recordPhaseTranscriptUsage(db, itemId2, phaseIdx, responses) {
51733
51891
  await tx.insert(phaseUsage).values({ itemId: itemId2, phaseIdx, tokensUp, tokensDown }).onConflictDoUpdate({
51734
51892
  target: [phaseUsage.itemId, phaseUsage.phaseIdx],
51735
51893
  set: {
51736
- tokensUp: sql29`${phaseUsage.tokensUp} + ${tokensUp}`,
51737
- tokensDown: sql29`${phaseUsage.tokensDown} + ${tokensDown}`
51894
+ tokensUp: sql30`${phaseUsage.tokensUp} + ${tokensUp}`,
51895
+ tokensDown: sql30`${phaseUsage.tokensDown} + ${tokensDown}`
51738
51896
  }
51739
51897
  });
51740
51898
  return { tokensUp, tokensDown };
@@ -51742,17 +51900,17 @@ async function recordPhaseTranscriptUsage(db, itemId2, phaseIdx, responses) {
51742
51900
  }
51743
51901
 
51744
51902
  // src/shared/db/recordWindowTokens.ts
51745
- import { and as and22, eq as eq53, sql as sql30 } from "drizzle-orm";
51903
+ import { and as and22, eq as eq54, sql as sql31 } from "drizzle-orm";
51746
51904
  async function recordWindowTokens(db, window, resetsAt, tokensUp, tokensDown) {
51747
51905
  if (tokensUp <= 0 && tokensDown <= 0) return;
51748
51906
  await db.update(usagePeaks).set({
51749
- tokensUp: sql30`${usagePeaks.tokensUp} + ${tokensUp}`,
51750
- tokensDown: sql30`${usagePeaks.tokensDown} + ${tokensDown}`
51907
+ tokensUp: sql31`${usagePeaks.tokensUp} + ${tokensUp}`,
51908
+ tokensDown: sql31`${usagePeaks.tokensDown} + ${tokensDown}`
51751
51909
  }).where(
51752
51910
  and22(
51753
- eq53(usagePeaks.window, window),
51754
- eq53(usagePeaks.resetsAt, resetsAt),
51755
- eq53(usagePeaks.segment, 0)
51911
+ eq54(usagePeaks.window, window),
51912
+ eq54(usagePeaks.resetsAt, resetsAt),
51913
+ eq54(usagePeaks.segment, 0)
51756
51914
  )
51757
51915
  );
51758
51916
  }
@@ -52775,10 +52933,10 @@ var NOTIFICATION = /<task-notification>([\s\S]*?)<\/task-notification>/g;
52775
52933
  var TASK_ID = /<task-id>([^<]+)<\/task-id>/;
52776
52934
  var STATUS = /<status>([^<]+)<\/status>/;
52777
52935
  function notifiedTasks(entry) {
52778
- const text19 = taskNotificationText(entry);
52779
- if (!text19) return [];
52936
+ const text20 = taskNotificationText(entry);
52937
+ if (!text20) return [];
52780
52938
  const tasks = [];
52781
- for (const [, body] of text19.matchAll(NOTIFICATION)) {
52939
+ for (const [, body] of text20.matchAll(NOTIFICATION)) {
52782
52940
  const id = body.match(TASK_ID)?.[1];
52783
52941
  if (id) tasks.push({ id, status: body.match(STATUS)?.[1]?.trim() });
52784
52942
  }
@@ -53981,9 +54139,9 @@ function armCreateTimeout(ctx, client, data, traceId) {
53981
54139
  const timer = setTimeout(
53982
54140
  () => {
53983
54141
  const pending = ctx.relay.pendingCreators;
53984
- const index2 = pending.findIndex((p) => p.timer === timer);
53985
- if (index2 === -1) return;
53986
- pending.splice(index2, 1);
54142
+ const index3 = pending.findIndex((p) => p.timer === timer);
54143
+ if (index3 === -1) return;
54144
+ pending.splice(index3, 1);
53987
54145
  daemonLog(`link ${node} ws: ${data.type} timed out (cwd=${data.cwd})`);
53988
54146
  sendTo(client, {
53989
54147
  type: "error",
@@ -54096,9 +54254,9 @@ function relayLinkSessions(state, msg) {
54096
54254
 
54097
54255
  // src/commands/sessions/daemon/links/takePendingCreator.ts
54098
54256
  function takePendingCreator(state, traceId) {
54099
- const index2 = pendingIndex(state, traceId);
54100
- if (index2 === -1) return void 0;
54101
- const [pending] = state.pendingCreators.splice(index2, 1);
54257
+ const index3 = pendingIndex(state, traceId);
54258
+ if (index3 === -1) return void 0;
54259
+ const [pending] = state.pendingCreators.splice(index3, 1);
54102
54260
  if (!pending) return void 0;
54103
54261
  clearTimeout(pending.timer);
54104
54262
  return pending.client;
@@ -54344,8 +54502,8 @@ function requestLinkHistory(ctx) {
54344
54502
  resolve32(sessions);
54345
54503
  };
54346
54504
  const timer = setTimeout(() => {
54347
- const index2 = waiters.indexOf(settle);
54348
- if (index2 !== -1) waiters.splice(index2, 1);
54505
+ const index3 = waiters.indexOf(settle);
54506
+ if (index3 !== -1) waiters.splice(index3, 1);
54349
54507
  daemonLog(`link ${ctx.spec.name} ws: history timed out`);
54350
54508
  resolve32(ctx.relay.lastHistory ?? []);
54351
54509
  }, HISTORY_TIMEOUT_MS);
@@ -55013,18 +55171,18 @@ import * as readline5 from "readline";
55013
55171
 
55014
55172
  // src/commands/sessions/daemon/historySearch/historySnippet.ts
55015
55173
  var CONTEXT_CHARS = 60;
55016
- function collapse(text19) {
55017
- return text19.replace(/\s+/g, " ");
55018
- }
55019
- function historySnippet(text19, index2, length) {
55020
- const start2 = Math.max(0, index2 - CONTEXT_CHARS);
55021
- const end = Math.min(text19.length, index2 + length + CONTEXT_CHARS);
55022
- const before = collapse(text19.slice(start2, index2)).trimStart();
55023
- const after = collapse(text19.slice(index2 + length, end)).trimEnd();
55174
+ function collapse(text20) {
55175
+ return text20.replace(/\s+/g, " ");
55176
+ }
55177
+ function historySnippet(text20, index3, length) {
55178
+ const start2 = Math.max(0, index3 - CONTEXT_CHARS);
55179
+ const end = Math.min(text20.length, index3 + length + CONTEXT_CHARS);
55180
+ const before = collapse(text20.slice(start2, index3)).trimStart();
55181
+ const after = collapse(text20.slice(index3 + length, end)).trimEnd();
55024
55182
  return {
55025
55183
  before: start2 > 0 ? `\u2026${before}` : before,
55026
- match: collapse(text19.slice(index2, index2 + length)),
55027
- after: end < text19.length ? `${after}\u2026` : after
55184
+ match: collapse(text20.slice(index3, index3 + length)),
55185
+ after: end < text20.length ? `${after}\u2026` : after
55028
55186
  };
55029
55187
  }
55030
55188
 
@@ -55069,9 +55227,9 @@ function rolloutMessages(entry) {
55069
55227
  }
55070
55228
  function chatMessages(payload) {
55071
55229
  if (payload.type === "user_message")
55072
- return text18("user", rolloutString(payload.message));
55230
+ return text19("user", rolloutString(payload.message));
55073
55231
  if (payload.type === "agent_message")
55074
- return text18("assistant", rolloutString(payload.message));
55232
+ return text19("assistant", rolloutString(payload.message));
55075
55233
  return [];
55076
55234
  }
55077
55235
  function toolMessages(payload) {
@@ -55085,7 +55243,7 @@ function toolMessages(payload) {
55085
55243
  }
55086
55244
  ];
55087
55245
  }
55088
- function text18(role, value) {
55246
+ function text19(role, value) {
55089
55247
  const trimmed = value.trim();
55090
55248
  return trimmed ? [{ role, text: trimmed }] : [];
55091
55249
  }
@@ -55105,8 +55263,8 @@ function claudeMessages(line) {
55105
55263
  }
55106
55264
 
55107
55265
  // src/commands/sessions/daemon/historySearch/findTranscriptMatch.ts
55108
- function escapeRegExp3(text19) {
55109
- return text19.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
55266
+ function escapeRegExp3(text20) {
55267
+ return text20.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
55110
55268
  }
55111
55269
  function encodesVerbatimInJson(query) {
55112
55270
  return JSON.stringify(query) === `"${query}"`;
@@ -55117,9 +55275,9 @@ function rawLinePrefilter(query) {
55117
55275
  return (line) => line.toLowerCase().includes(lower);
55118
55276
  }
55119
55277
  function matchTexts(texts, pattern2) {
55120
- for (const text19 of texts) {
55121
- const found = pattern2.exec(text19);
55122
- if (found) return historySnippet(text19, found.index, found[0].length);
55278
+ for (const text20 of texts) {
55279
+ const found = pattern2.exec(text20);
55280
+ if (found) return historySnippet(text20, found.index, found[0].length);
55123
55281
  }
55124
55282
  return null;
55125
55283
  }
@@ -56764,10 +56922,10 @@ async function requestSessionOutput(target) {
56764
56922
  }
56765
56923
 
56766
56924
  // src/commands/sessions/lastLines.ts
56767
- function lastLines(scrollback, count10) {
56925
+ function lastLines(scrollback, count11) {
56768
56926
  const lines2 = stripAnsi(scrollback).split(/\r?\n/);
56769
56927
  if (lines2.at(-1) === "") lines2.pop();
56770
- return lines2.slice(-count10);
56928
+ return lines2.slice(-count11);
56771
56929
  }
56772
56930
 
56773
56931
  // src/commands/sessions/sessionOutput.ts
@@ -56787,14 +56945,14 @@ function resolveTarget4(sessionId, server) {
56787
56945
  return { sessionId };
56788
56946
  }
56789
56947
  async function sessionOutput(sessionId, options2) {
56790
- const count10 = Number.parseInt(options2.lines, 10);
56791
- if (!Number.isInteger(count10) || count10 < 1)
56948
+ const count11 = Number.parseInt(options2.lines, 10);
56949
+ if (!Number.isInteger(count11) || count11 < 1)
56792
56950
  return fail11(`-n must be a positive integer, got ${options2.lines}`);
56793
56951
  const target = resolveTarget4(sessionId, options2.server);
56794
56952
  if (typeof target === "string") return fail11(target);
56795
56953
  try {
56796
56954
  const scrollback = await requestSessionOutput(target);
56797
- for (const line of lastLines(scrollback, count10)) console.log(line);
56955
+ for (const line of lastLines(scrollback, count11)) console.log(line);
56798
56956
  } catch (error) {
56799
56957
  fail11(error instanceof Error ? error.message : String(error));
56800
56958
  }