@staff0rd/assist 0.449.0 → 0.450.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/commands/sessions/web/bundle.js +360 -360
- package/dist/index.js +196 -109
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.450.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -1770,6 +1770,8 @@ function collectCommitRefs(message2) {
|
|
|
1770
1770
|
const subject = message2.split("\n", 1)[0];
|
|
1771
1771
|
if (subject) ref.title = subject;
|
|
1772
1772
|
refs.push(ref);
|
|
1773
|
+
const parent = git("rev-parse HEAD^");
|
|
1774
|
+
if (parent) refs.push({ kind: "commit-parent", ref: parent });
|
|
1773
1775
|
}
|
|
1774
1776
|
return refs;
|
|
1775
1777
|
}
|
|
@@ -3715,9 +3717,9 @@ function forbiddenStrings() {
|
|
|
3715
3717
|
console.log("No forbidden-strings rules configured.");
|
|
3716
3718
|
process.exit(0);
|
|
3717
3719
|
}
|
|
3718
|
-
const
|
|
3720
|
+
const cache4 = /* @__PURE__ */ new Map();
|
|
3719
3721
|
const readJson = (file) => {
|
|
3720
|
-
if (
|
|
3722
|
+
if (cache4.has(file)) return cache4.get(file);
|
|
3721
3723
|
if (!existsSync12(file)) {
|
|
3722
3724
|
console.log(`Forbidden-strings file not found: ${file}`);
|
|
3723
3725
|
process.exit(1);
|
|
@@ -3729,7 +3731,7 @@ function forbiddenStrings() {
|
|
|
3729
3731
|
console.log(`Could not parse ${file}: ${error.message}`);
|
|
3730
3732
|
process.exit(1);
|
|
3731
3733
|
}
|
|
3732
|
-
|
|
3734
|
+
cache4.set(file, parsed);
|
|
3733
3735
|
return parsed;
|
|
3734
3736
|
};
|
|
3735
3737
|
const violations = findForbiddenStrings(rules, readJson);
|
|
@@ -6091,7 +6093,13 @@ var backlogCommentSchema = z3.strictObject({
|
|
|
6091
6093
|
timestamp: z3.string(),
|
|
6092
6094
|
type: backlogCommentTypeSchema
|
|
6093
6095
|
});
|
|
6094
|
-
var gitRefKindSchema = z3.enum([
|
|
6096
|
+
var gitRefKindSchema = z3.enum([
|
|
6097
|
+
"branch",
|
|
6098
|
+
"commit",
|
|
6099
|
+
"commit-parent",
|
|
6100
|
+
"pr",
|
|
6101
|
+
"slack"
|
|
6102
|
+
]);
|
|
6095
6103
|
var gitRefSchema = z3.strictObject({
|
|
6096
6104
|
kind: gitRefKindSchema,
|
|
6097
6105
|
ref: z3.string(),
|
|
@@ -8372,19 +8380,19 @@ import { dirname as dirname19, join as join23 } from "path";
|
|
|
8372
8380
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
8373
8381
|
function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
|
|
8374
8382
|
const file = join23(dirname19(fileURLToPath4(importMetaUrl)), bundlePath);
|
|
8375
|
-
let
|
|
8383
|
+
let cache4;
|
|
8376
8384
|
return (req, res) => {
|
|
8377
8385
|
const mtimeMs = statSync2(file).mtimeMs;
|
|
8378
|
-
if (
|
|
8386
|
+
if (cache4?.mtimeMs !== mtimeMs) {
|
|
8379
8387
|
const body = readFileSync19(file, "utf8");
|
|
8380
8388
|
const etag = `"${createHash("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
8381
|
-
|
|
8389
|
+
cache4 = { body, etag, mtimeMs };
|
|
8382
8390
|
}
|
|
8383
8391
|
const headers = {
|
|
8384
|
-
ETag:
|
|
8392
|
+
ETag: cache4.etag,
|
|
8385
8393
|
"Cache-Control": "no-cache"
|
|
8386
8394
|
};
|
|
8387
|
-
if (req.headers["if-none-match"] ===
|
|
8395
|
+
if (req.headers["if-none-match"] === cache4.etag) {
|
|
8388
8396
|
res.writeHead(304, headers);
|
|
8389
8397
|
res.end();
|
|
8390
8398
|
return;
|
|
@@ -8393,7 +8401,7 @@ function createBundleHandler(importMetaUrl, bundlePath, contentType = "applicati
|
|
|
8393
8401
|
"Content-Type": contentType,
|
|
8394
8402
|
...headers
|
|
8395
8403
|
});
|
|
8396
|
-
res.end(
|
|
8404
|
+
res.end(cache4.body);
|
|
8397
8405
|
};
|
|
8398
8406
|
}
|
|
8399
8407
|
|
|
@@ -8881,6 +8889,73 @@ function getCwdParam(req, res) {
|
|
|
8881
8889
|
return cwd;
|
|
8882
8890
|
}
|
|
8883
8891
|
|
|
8892
|
+
// src/commands/sessions/web/getSessionParam.ts
|
|
8893
|
+
function getSessionParam(req) {
|
|
8894
|
+
const url = new URL(req.url ?? "/", "http://localhost");
|
|
8895
|
+
return url.searchParams.get("session") ?? void 0;
|
|
8896
|
+
}
|
|
8897
|
+
|
|
8898
|
+
// src/shared/db/findCommitAnchor.ts
|
|
8899
|
+
import { and as and7, asc as asc6, eq as eq16, inArray as inArray3 } from "drizzle-orm";
|
|
8900
|
+
async function findCommitAnchor(db, itemId2) {
|
|
8901
|
+
const rows = await db.select({ kind: itemGitRefs.kind, ref: itemGitRefs.ref }).from(itemGitRefs).where(
|
|
8902
|
+
and7(
|
|
8903
|
+
eq16(itemGitRefs.itemId, itemId2),
|
|
8904
|
+
inArray3(itemGitRefs.kind, ["commit", "commit-parent"])
|
|
8905
|
+
)
|
|
8906
|
+
).orderBy(asc6(itemGitRefs.createdAt));
|
|
8907
|
+
const anchor = {};
|
|
8908
|
+
for (const row of rows) {
|
|
8909
|
+
if (row.kind === "commit") anchor.commit ??= row.ref;
|
|
8910
|
+
else anchor.parent ??= row.ref;
|
|
8911
|
+
}
|
|
8912
|
+
return anchor;
|
|
8913
|
+
}
|
|
8914
|
+
|
|
8915
|
+
// src/shared/db/findItemBySessionId.ts
|
|
8916
|
+
import { asc as asc7, eq as eq17 } from "drizzle-orm";
|
|
8917
|
+
async function findItemBySessionId(db, claudeSessionId) {
|
|
8918
|
+
const rows = await db.select({ itemId: phaseUsage.itemId }).from(phaseUsage).where(eq17(phaseUsage.claudeSessionId, claudeSessionId)).orderBy(asc7(phaseUsage.itemId), asc7(phaseUsage.phaseIdx)).limit(1);
|
|
8919
|
+
return rows[0]?.itemId;
|
|
8920
|
+
}
|
|
8921
|
+
|
|
8922
|
+
// src/commands/sessions/web/sessionCommitAnchor.ts
|
|
8923
|
+
var EMPTY_TTL_MS = 3e4;
|
|
8924
|
+
var cache3 = /* @__PURE__ */ new Map();
|
|
8925
|
+
var inFlight = /* @__PURE__ */ new Map();
|
|
8926
|
+
async function sessionCommitAnchor(sessionId) {
|
|
8927
|
+
const cached = cache3.get(sessionId);
|
|
8928
|
+
if (cached && cached.expiresAt > Date.now()) return cached.anchor;
|
|
8929
|
+
const pending = inFlight.get(sessionId);
|
|
8930
|
+
if (pending) return pending;
|
|
8931
|
+
const lookup = loadAnchor(sessionId).finally(
|
|
8932
|
+
() => inFlight.delete(sessionId)
|
|
8933
|
+
);
|
|
8934
|
+
inFlight.set(sessionId, lookup);
|
|
8935
|
+
return lookup;
|
|
8936
|
+
}
|
|
8937
|
+
async function loadAnchor(sessionId) {
|
|
8938
|
+
const anchor = await queryAnchor(sessionId);
|
|
8939
|
+
const found = Boolean(anchor.commit || anchor.parent);
|
|
8940
|
+
cache3.set(sessionId, {
|
|
8941
|
+
anchor,
|
|
8942
|
+
expiresAt: found ? Number.POSITIVE_INFINITY : Date.now() + EMPTY_TTL_MS
|
|
8943
|
+
});
|
|
8944
|
+
return anchor;
|
|
8945
|
+
}
|
|
8946
|
+
async function queryAnchor(sessionId) {
|
|
8947
|
+
try {
|
|
8948
|
+
if (!process.env.ASSIST_DATABASE_URL && !loadConfig().database.url)
|
|
8949
|
+
return {};
|
|
8950
|
+
const db = await getDb();
|
|
8951
|
+
const itemId2 = await findItemBySessionId(db, sessionId);
|
|
8952
|
+
if (itemId2 === void 0) return {};
|
|
8953
|
+
return await findCommitAnchor(db, itemId2);
|
|
8954
|
+
} catch {
|
|
8955
|
+
return {};
|
|
8956
|
+
}
|
|
8957
|
+
}
|
|
8958
|
+
|
|
8884
8959
|
// src/commands/sessions/web/windowsCwdToWslPath.ts
|
|
8885
8960
|
function windowsCwdToWslPath(cwd) {
|
|
8886
8961
|
const match = /^([A-Za-z]):[\\/](.*)$/.exec(cwd);
|
|
@@ -8914,7 +8989,13 @@ async function refExists2(cwd, ref) {
|
|
|
8914
8989
|
return false;
|
|
8915
8990
|
}
|
|
8916
8991
|
}
|
|
8917
|
-
async function
|
|
8992
|
+
async function anchoredBase(cwd, sessionId) {
|
|
8993
|
+
const { commit: commit2, parent } = await sessionCommitAnchor(sessionId);
|
|
8994
|
+
if (parent && await refExists2(cwd, parent)) return parent;
|
|
8995
|
+
if (commit2 && await refExists2(cwd, `${commit2}^`)) return `${commit2}^`;
|
|
8996
|
+
return void 0;
|
|
8997
|
+
}
|
|
8998
|
+
async function resolveDiffBase(cwd, sessionId) {
|
|
8918
8999
|
let defaultBranch;
|
|
8919
9000
|
try {
|
|
8920
9001
|
const config = loadConfigFrom(toGitCwd(cwd));
|
|
@@ -8923,6 +9004,10 @@ async function resolveDiffBase(cwd) {
|
|
|
8923
9004
|
} catch {
|
|
8924
9005
|
return "HEAD";
|
|
8925
9006
|
}
|
|
9007
|
+
if (sessionId) {
|
|
9008
|
+
const anchored = await anchoredBase(cwd, sessionId);
|
|
9009
|
+
if (anchored) return anchored;
|
|
9010
|
+
}
|
|
8926
9011
|
for (const candidate of baseCandidates(defaultBranch)) {
|
|
8927
9012
|
if (!await refExists2(cwd, candidate)) continue;
|
|
8928
9013
|
try {
|
|
@@ -8960,7 +9045,7 @@ async function diff2(req, res) {
|
|
|
8960
9045
|
const cwd = getCwdParam(req, res);
|
|
8961
9046
|
if (!cwd) return;
|
|
8962
9047
|
try {
|
|
8963
|
-
const base = await resolveDiffBase(cwd);
|
|
9048
|
+
const base = await resolveDiffBase(cwd, getSessionParam(req));
|
|
8964
9049
|
const tracked = await execGit(cwd, ["diff", base], {
|
|
8965
9050
|
maxBuffer: MAX_DIFF_BYTES
|
|
8966
9051
|
});
|
|
@@ -9280,7 +9365,7 @@ async function gitStatus(req, res) {
|
|
|
9280
9365
|
const cwd = getCwdParam(req, res);
|
|
9281
9366
|
if (!cwd) return;
|
|
9282
9367
|
try {
|
|
9283
|
-
const base = await resolveDiffBase(cwd);
|
|
9368
|
+
const base = await resolveDiffBase(cwd, getSessionParam(req));
|
|
9284
9369
|
respondJson(
|
|
9285
9370
|
res,
|
|
9286
9371
|
200,
|
|
@@ -9569,7 +9654,7 @@ async function listNewsItems(_req, res) {
|
|
|
9569
9654
|
}
|
|
9570
9655
|
|
|
9571
9656
|
// src/shared/db/listUsagePeaks.ts
|
|
9572
|
-
import { and as
|
|
9657
|
+
import { and as and8, count, desc as desc2, eq as eq18, getTableColumns, sql as sql16 } from "drizzle-orm";
|
|
9573
9658
|
async function listUsagePeaks(db, paging) {
|
|
9574
9659
|
const avgContext = db.select({
|
|
9575
9660
|
window: phaseCycleContext.window,
|
|
@@ -9585,9 +9670,9 @@ async function listUsagePeaks(db, paging) {
|
|
|
9585
9670
|
phaseCount: avgContext.phaseCount
|
|
9586
9671
|
}).from(usagePeaks).leftJoin(
|
|
9587
9672
|
avgContext,
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9673
|
+
and8(
|
|
9674
|
+
eq18(usagePeaks.window, avgContext.window),
|
|
9675
|
+
eq18(usagePeaks.resetsAt, avgContext.resetsAt)
|
|
9591
9676
|
)
|
|
9592
9677
|
).orderBy(
|
|
9593
9678
|
desc2(usagePeaks.resetsAt),
|
|
@@ -9644,11 +9729,11 @@ var execFileAsync4 = promisify5(execFile5);
|
|
|
9644
9729
|
var CACHE_TTL_MS2 = 3e4;
|
|
9645
9730
|
function createCachedGhJson(args, parse3, fallback, options2 = {}) {
|
|
9646
9731
|
const { cacheFallback = true } = options2;
|
|
9647
|
-
const
|
|
9732
|
+
const cache4 = /* @__PURE__ */ new Map();
|
|
9648
9733
|
return async (cwd, extraArgs = []) => {
|
|
9649
9734
|
const key = extraArgs.length ? `${cwd}\0${extraArgs.join("\0")}` : cwd;
|
|
9650
9735
|
const now = Date.now();
|
|
9651
|
-
const cached =
|
|
9736
|
+
const cached = cache4.get(key);
|
|
9652
9737
|
if (cached && cached.expires > now) return cached.value;
|
|
9653
9738
|
let value = fallback;
|
|
9654
9739
|
try {
|
|
@@ -9661,7 +9746,7 @@ function createCachedGhJson(args, parse3, fallback, options2 = {}) {
|
|
|
9661
9746
|
value = fallback;
|
|
9662
9747
|
}
|
|
9663
9748
|
if (cacheFallback || value !== fallback)
|
|
9664
|
-
|
|
9749
|
+
cache4.set(key, { value, expires: now + CACHE_TTL_MS2 });
|
|
9665
9750
|
return value;
|
|
9666
9751
|
};
|
|
9667
9752
|
}
|
|
@@ -10172,22 +10257,22 @@ import { readFileSync as readFileSync21 } from "fs";
|
|
|
10172
10257
|
import { createRequire as createRequire2 } from "module";
|
|
10173
10258
|
var require3 = createRequire2(import.meta.url);
|
|
10174
10259
|
function createCssHandler(packageEntry) {
|
|
10175
|
-
let
|
|
10260
|
+
let cache4;
|
|
10176
10261
|
return (req, res) => {
|
|
10177
|
-
if (!
|
|
10262
|
+
if (!cache4) {
|
|
10178
10263
|
const resolved = require3.resolve(packageEntry);
|
|
10179
10264
|
const body = readFileSync21(resolved, "utf8");
|
|
10180
10265
|
const etag = `"${createHash2("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
10181
|
-
|
|
10266
|
+
cache4 = { body, etag };
|
|
10182
10267
|
}
|
|
10183
|
-
const headers = { ETag:
|
|
10184
|
-
if (req.headers["if-none-match"] ===
|
|
10268
|
+
const headers = { ETag: cache4.etag, "Cache-Control": "no-cache" };
|
|
10269
|
+
if (req.headers["if-none-match"] === cache4.etag) {
|
|
10185
10270
|
res.writeHead(304, headers);
|
|
10186
10271
|
res.end();
|
|
10187
10272
|
return;
|
|
10188
10273
|
}
|
|
10189
10274
|
res.writeHead(200, { "Content-Type": "text/css", ...headers });
|
|
10190
|
-
res.end(
|
|
10275
|
+
res.end(cache4.body);
|
|
10191
10276
|
};
|
|
10192
10277
|
}
|
|
10193
10278
|
|
|
@@ -10685,11 +10770,11 @@ function registerActivityCommands(cmd) {
|
|
|
10685
10770
|
|
|
10686
10771
|
// src/commands/backlog/associate-github/index.ts
|
|
10687
10772
|
import chalk64 from "chalk";
|
|
10688
|
-
import { eq as
|
|
10773
|
+
import { eq as eq20 } from "drizzle-orm";
|
|
10689
10774
|
|
|
10690
10775
|
// src/commands/backlog/beginAssociation.ts
|
|
10691
10776
|
import chalk63 from "chalk";
|
|
10692
|
-
import { eq as
|
|
10777
|
+
import { eq as eq19 } from "drizzle-orm";
|
|
10693
10778
|
async function beginAssociation(id, options2, clearPatch, label2) {
|
|
10694
10779
|
const found = await findOneItem(id);
|
|
10695
10780
|
if (!found) {
|
|
@@ -10699,7 +10784,7 @@ async function beginAssociation(id, options2, clearPatch, label2) {
|
|
|
10699
10784
|
const { orm } = found;
|
|
10700
10785
|
const itemId2 = found.item.id;
|
|
10701
10786
|
if (options2.clear) {
|
|
10702
|
-
await orm.update(items).set(clearPatch).where(
|
|
10787
|
+
await orm.update(items).set(clearPatch).where(eq19(items.id, itemId2));
|
|
10703
10788
|
console.log(
|
|
10704
10789
|
chalk63.green(
|
|
10705
10790
|
`Cleared ${label2} association on item ${formatItemId(itemId2)}.`
|
|
@@ -10767,7 +10852,7 @@ async function associateGithub(id, issue, options2) {
|
|
|
10767
10852
|
return;
|
|
10768
10853
|
}
|
|
10769
10854
|
const title = fetchGithubIssueTitle(normalized);
|
|
10770
|
-
await orm.update(items).set({ githubIssue: normalized, jiraKey: null }).where(
|
|
10855
|
+
await orm.update(items).set({ githubIssue: normalized, jiraKey: null }).where(eq20(items.id, itemId2));
|
|
10771
10856
|
console.log(
|
|
10772
10857
|
chalk64.green(`Associated ${normalized} with item ${formatItemId(itemId2)}.`),
|
|
10773
10858
|
title ? chalk64.dim(`(${title})`) : ""
|
|
@@ -10781,7 +10866,7 @@ function registerAssociateGithubCommand(cmd) {
|
|
|
10781
10866
|
|
|
10782
10867
|
// src/commands/backlog/associate-jira/index.ts
|
|
10783
10868
|
import chalk66 from "chalk";
|
|
10784
|
-
import { eq as
|
|
10869
|
+
import { eq as eq21 } from "drizzle-orm";
|
|
10785
10870
|
|
|
10786
10871
|
// src/commands/jira/fetchIssue.ts
|
|
10787
10872
|
import { execSync as execSync32 } from "child_process";
|
|
@@ -10846,7 +10931,7 @@ async function associateJira(id, key, options2) {
|
|
|
10846
10931
|
const parsed = fetchIssue(normalized, "summary");
|
|
10847
10932
|
const fields = parsed?.fields;
|
|
10848
10933
|
const summary = fields?.summary;
|
|
10849
|
-
await orm.update(items).set({ jiraKey: normalized, githubIssue: null }).where(
|
|
10934
|
+
await orm.update(items).set({ jiraKey: normalized, githubIssue: null }).where(eq21(items.id, itemId2));
|
|
10850
10935
|
console.log(
|
|
10851
10936
|
chalk66.green(`Associated ${normalized} with item ${formatItemId(itemId2)}.`),
|
|
10852
10937
|
summary ? chalk66.dim(`(${summary})`) : ""
|
|
@@ -11219,15 +11304,15 @@ function registerImportCommand(cmd) {
|
|
|
11219
11304
|
import chalk74 from "chalk";
|
|
11220
11305
|
|
|
11221
11306
|
// src/commands/backlog/insertPhaseAt.ts
|
|
11222
|
-
import { eq as
|
|
11307
|
+
import { eq as eq23 } from "drizzle-orm";
|
|
11223
11308
|
|
|
11224
11309
|
// src/commands/backlog/shiftPhasesUp.ts
|
|
11225
|
-
import { and as
|
|
11310
|
+
import { and as and9, desc as desc3, eq as eq22, gte } from "drizzle-orm";
|
|
11226
11311
|
async function shiftPhasesUp(db, itemId2, fromIdx) {
|
|
11227
|
-
const toShift = await db.select({ idx: planPhases.idx }).from(planPhases).where(
|
|
11312
|
+
const toShift = await db.select({ idx: planPhases.idx }).from(planPhases).where(and9(eq22(planPhases.itemId, itemId2), gte(planPhases.idx, fromIdx))).orderBy(desc3(planPhases.idx));
|
|
11228
11313
|
for (const p of toShift) {
|
|
11229
|
-
await db.update(planTasks).set({ phaseIdx: p.idx + 1 }).where(
|
|
11230
|
-
await db.update(planPhases).set({ idx: p.idx + 1 }).where(
|
|
11314
|
+
await db.update(planTasks).set({ phaseIdx: p.idx + 1 }).where(and9(eq22(planTasks.itemId, itemId2), eq22(planTasks.phaseIdx, p.idx)));
|
|
11315
|
+
await db.update(planPhases).set({ idx: p.idx + 1 }).where(and9(eq22(planPhases.itemId, itemId2), eq22(planPhases.idx, p.idx)));
|
|
11231
11316
|
}
|
|
11232
11317
|
}
|
|
11233
11318
|
|
|
@@ -11240,7 +11325,7 @@ async function insertPhaseAt(orm, itemId2, phaseIdx, name, tasks, manualChecks,
|
|
|
11240
11325
|
await tx.insert(planTasks).values(tasks.map((task, i) => ({ itemId: itemId2, phaseIdx, idx: i, task })));
|
|
11241
11326
|
}
|
|
11242
11327
|
if (currentPhase !== void 0 && currentPhase - 1 >= phaseIdx) {
|
|
11243
|
-
await tx.update(items).set({ currentPhase: phaseIdx + 1 }).where(
|
|
11328
|
+
await tx.update(items).set({ currentPhase: phaseIdx + 1 }).where(eq23(items.id, itemId2));
|
|
11244
11329
|
}
|
|
11245
11330
|
});
|
|
11246
11331
|
}
|
|
@@ -11403,9 +11488,9 @@ import chalk76 from "chalk";
|
|
|
11403
11488
|
|
|
11404
11489
|
// src/commands/backlog/resolveInsertPosition.ts
|
|
11405
11490
|
import chalk75 from "chalk";
|
|
11406
|
-
import { count as count2, eq as
|
|
11491
|
+
import { count as count2, eq as eq24 } from "drizzle-orm";
|
|
11407
11492
|
async function resolveInsertPosition(orm, itemId2, position) {
|
|
11408
|
-
const [row] = await orm.select({ cnt: count2() }).from(planPhases).where(
|
|
11493
|
+
const [row] = await orm.select({ cnt: count2() }).from(planPhases).where(eq24(planPhases.itemId, itemId2));
|
|
11409
11494
|
const phaseCount = row?.cnt ?? 0;
|
|
11410
11495
|
if (position === void 0) return phaseCount;
|
|
11411
11496
|
const pos = Number.parseInt(position, 10);
|
|
@@ -11734,9 +11819,9 @@ function hasCycle(adjacency, fromId, toId) {
|
|
|
11734
11819
|
}
|
|
11735
11820
|
|
|
11736
11821
|
// src/commands/backlog/loadDependencyGraph.ts
|
|
11737
|
-
import { eq as
|
|
11822
|
+
import { eq as eq25 } from "drizzle-orm";
|
|
11738
11823
|
async function loadDependencyGraph(orm) {
|
|
11739
|
-
const rows = await orm.select({ itemId: links.itemId, targetId: links.targetId }).from(links).where(
|
|
11824
|
+
const rows = await orm.select({ itemId: links.itemId, targetId: links.targetId }).from(links).where(eq25(links.type, "depends-on"));
|
|
11740
11825
|
const graph = /* @__PURE__ */ new Map();
|
|
11741
11826
|
for (const { itemId: itemId2, targetId } of rows) {
|
|
11742
11827
|
const bucket = graph.get(itemId2);
|
|
@@ -11803,7 +11888,7 @@ async function link(fromId, toId, opts) {
|
|
|
11803
11888
|
|
|
11804
11889
|
// src/commands/backlog/unlink.ts
|
|
11805
11890
|
import chalk82 from "chalk";
|
|
11806
|
-
import { and as
|
|
11891
|
+
import { and as and10, eq as eq26 } from "drizzle-orm";
|
|
11807
11892
|
async function unlink(fromId, toId) {
|
|
11808
11893
|
const fromNum = parseItemId(fromId);
|
|
11809
11894
|
const toNum = parseItemId(toId);
|
|
@@ -11827,7 +11912,7 @@ async function unlink(fromId, toId) {
|
|
|
11827
11912
|
);
|
|
11828
11913
|
return;
|
|
11829
11914
|
}
|
|
11830
|
-
await orm.delete(links).where(
|
|
11915
|
+
await orm.delete(links).where(and10(eq26(links.itemId, fromNum), eq26(links.targetId, toNum)));
|
|
11831
11916
|
console.log(
|
|
11832
11917
|
chalk82.green(
|
|
11833
11918
|
`Removed link from ${formatItemId(fromNum)} to ${formatItemId(toNum)}.`
|
|
@@ -11847,7 +11932,7 @@ function registerLinkCommands(cmd) {
|
|
|
11847
11932
|
|
|
11848
11933
|
// src/commands/backlog/move-repo/index.ts
|
|
11849
11934
|
import chalk84 from "chalk";
|
|
11850
|
-
import { eq as
|
|
11935
|
+
import { eq as eq28 } from "drizzle-orm";
|
|
11851
11936
|
|
|
11852
11937
|
// src/commands/backlog/move-repo/confirmMove.ts
|
|
11853
11938
|
import chalk83 from "chalk";
|
|
@@ -11862,9 +11947,9 @@ async function confirmMove(cnt, oldOrigin, newOrigin) {
|
|
|
11862
11947
|
}
|
|
11863
11948
|
|
|
11864
11949
|
// src/commands/backlog/move-repo/countByOrigin.ts
|
|
11865
|
-
import { count as count3, eq as
|
|
11950
|
+
import { count as count3, eq as eq27 } from "drizzle-orm";
|
|
11866
11951
|
async function countByOrigin(orm, origin) {
|
|
11867
|
-
const [{ cnt }] = await orm.select({ cnt: count3() }).from(items).where(
|
|
11952
|
+
const [{ cnt }] = await orm.select({ cnt: count3() }).from(items).where(eq27(items.origin, origin));
|
|
11868
11953
|
return cnt;
|
|
11869
11954
|
}
|
|
11870
11955
|
|
|
@@ -11907,7 +11992,7 @@ async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
|
11907
11992
|
console.log(chalk84.yellow("Move cancelled; no changes made."));
|
|
11908
11993
|
return;
|
|
11909
11994
|
}
|
|
11910
|
-
await orm.update(items).set({ origin: newOrigin }).where(
|
|
11995
|
+
await orm.update(items).set({ origin: newOrigin }).where(eq28(items.origin, oldOrigin));
|
|
11911
11996
|
console.log(
|
|
11912
11997
|
chalk84.green(
|
|
11913
11998
|
`Moved ${pluralItems(cnt)} from "${oldOrigin}" to "${newOrigin}".`
|
|
@@ -12324,10 +12409,10 @@ async function start(id) {
|
|
|
12324
12409
|
|
|
12325
12410
|
// src/commands/backlog/stop/index.ts
|
|
12326
12411
|
import chalk96 from "chalk";
|
|
12327
|
-
import { and as
|
|
12412
|
+
import { and as and11, eq as eq29 } from "drizzle-orm";
|
|
12328
12413
|
async function stop() {
|
|
12329
12414
|
const { orm } = await getReady();
|
|
12330
|
-
const stopped = await orm.update(items).set({ status: "todo", currentPhase: 1 }).where(
|
|
12415
|
+
const stopped = await orm.update(items).set({ status: "todo", currentPhase: 1 }).where(and11(eq29(items.status, "in-progress"), eq29(items.origin, getOrigin()))).returning({ id: items.id, name: items.name });
|
|
12331
12416
|
if (stopped.length === 0) {
|
|
12332
12417
|
console.log(chalk96.yellow("No in-progress items to stop."));
|
|
12333
12418
|
return;
|
|
@@ -12444,13 +12529,13 @@ async function findSubtask(id, index3) {
|
|
|
12444
12529
|
}
|
|
12445
12530
|
|
|
12446
12531
|
// src/commands/backlog/updateSubtask.ts
|
|
12447
|
-
import { and as
|
|
12532
|
+
import { and as and12, eq as eq30 } from "drizzle-orm";
|
|
12448
12533
|
async function updateSubtask(orm, itemId2, idx, fields) {
|
|
12449
12534
|
const set = {};
|
|
12450
12535
|
if (fields.title !== void 0) set.title = fields.title;
|
|
12451
12536
|
if (fields.description !== void 0) set.description = fields.description;
|
|
12452
12537
|
if (fields.status !== void 0) set.status = fields.status;
|
|
12453
|
-
const [row] = await orm.update(itemSubtasks).set(set).where(
|
|
12538
|
+
const [row] = await orm.update(itemSubtasks).set(set).where(and12(eq30(itemSubtasks.itemId, itemId2), eq30(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
|
|
12454
12539
|
return row?.title;
|
|
12455
12540
|
}
|
|
12456
12541
|
|
|
@@ -12505,16 +12590,16 @@ async function editSubtask(id, index3, options2) {
|
|
|
12505
12590
|
import chalk102 from "chalk";
|
|
12506
12591
|
|
|
12507
12592
|
// src/commands/backlog/deleteSubtask.ts
|
|
12508
|
-
import { and as
|
|
12593
|
+
import { and as and13, asc as asc8, eq as eq31 } from "drizzle-orm";
|
|
12509
12594
|
async function deleteSubtask(orm, itemId2, idx) {
|
|
12510
|
-
const [row] = await orm.delete(itemSubtasks).where(
|
|
12595
|
+
const [row] = await orm.delete(itemSubtasks).where(and13(eq31(itemSubtasks.itemId, itemId2), eq31(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
|
|
12511
12596
|
if (!row) return void 0;
|
|
12512
|
-
const remaining = await orm.select({ idx: itemSubtasks.idx }).from(itemSubtasks).where(
|
|
12597
|
+
const remaining = await orm.select({ idx: itemSubtasks.idx }).from(itemSubtasks).where(eq31(itemSubtasks.itemId, itemId2)).orderBy(asc8(itemSubtasks.idx));
|
|
12513
12598
|
for (let i = 0; i < remaining.length; i++) {
|
|
12514
12599
|
const oldIdx = remaining[i].idx;
|
|
12515
12600
|
if (oldIdx === i) continue;
|
|
12516
12601
|
await orm.update(itemSubtasks).set({ idx: i }).where(
|
|
12517
|
-
|
|
12602
|
+
and13(eq31(itemSubtasks.itemId, itemId2), eq31(itemSubtasks.idx, oldIdx))
|
|
12518
12603
|
);
|
|
12519
12604
|
}
|
|
12520
12605
|
return row.title;
|
|
@@ -12583,20 +12668,20 @@ function registerSubtaskCommands(cmd) {
|
|
|
12583
12668
|
|
|
12584
12669
|
// src/commands/backlog/movePhase.ts
|
|
12585
12670
|
import chalk104 from "chalk";
|
|
12586
|
-
import { count as count5, eq as
|
|
12671
|
+
import { count as count5, eq as eq34 } from "drizzle-orm";
|
|
12587
12672
|
|
|
12588
12673
|
// src/commands/backlog/reorderPhaseRows.ts
|
|
12589
|
-
import { and as
|
|
12674
|
+
import { and as and15, asc as asc10, eq as eq33 } from "drizzle-orm";
|
|
12590
12675
|
|
|
12591
12676
|
// src/commands/backlog/reindexPhases.ts
|
|
12592
|
-
import { and as
|
|
12677
|
+
import { and as and14, asc as asc9, count as count4, eq as eq32 } from "drizzle-orm";
|
|
12593
12678
|
async function reindexPhases(db, itemId2) {
|
|
12594
|
-
const remaining = await db.select({ idx: planPhases.idx }).from(planPhases).where(
|
|
12679
|
+
const remaining = await db.select({ idx: planPhases.idx }).from(planPhases).where(eq32(planPhases.itemId, itemId2)).orderBy(asc9(planPhases.idx));
|
|
12595
12680
|
for (let i = 0; i < remaining.length; i++) {
|
|
12596
12681
|
const oldIdx = remaining[i].idx;
|
|
12597
12682
|
if (oldIdx === i) continue;
|
|
12598
|
-
await db.update(planTasks).set({ phaseIdx: i }).where(
|
|
12599
|
-
await db.update(planPhases).set({ idx: i }).where(
|
|
12683
|
+
await db.update(planTasks).set({ phaseIdx: i }).where(and14(eq32(planTasks.itemId, itemId2), eq32(planTasks.phaseIdx, oldIdx)));
|
|
12684
|
+
await db.update(planPhases).set({ idx: i }).where(and14(eq32(planPhases.itemId, itemId2), eq32(planPhases.idx, oldIdx)));
|
|
12600
12685
|
}
|
|
12601
12686
|
}
|
|
12602
12687
|
async function adjustCurrentPhase(db, item, removedIdx) {
|
|
@@ -12604,24 +12689,24 @@ async function adjustCurrentPhase(db, item, removedIdx) {
|
|
|
12604
12689
|
if (currentPhase === void 0) return;
|
|
12605
12690
|
const currentIdx = currentPhase - 1;
|
|
12606
12691
|
if (removedIdx < currentIdx) {
|
|
12607
|
-
await db.update(items).set({ currentPhase: currentPhase - 1 }).where(
|
|
12692
|
+
await db.update(items).set({ currentPhase: currentPhase - 1 }).where(eq32(items.id, item.id));
|
|
12608
12693
|
return;
|
|
12609
12694
|
}
|
|
12610
12695
|
if (removedIdx !== currentIdx) return;
|
|
12611
|
-
const [row] = await db.select({ cnt: count4() }).from(planPhases).where(
|
|
12696
|
+
const [row] = await db.select({ cnt: count4() }).from(planPhases).where(eq32(planPhases.itemId, item.id));
|
|
12612
12697
|
const cnt = row?.cnt ?? 0;
|
|
12613
|
-
await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(
|
|
12698
|
+
await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(eq32(items.id, item.id));
|
|
12614
12699
|
}
|
|
12615
12700
|
|
|
12616
12701
|
// src/commands/backlog/reorderPhaseRows.ts
|
|
12617
12702
|
async function reorderPhaseRows(orm, itemId2, fromIdx, toIdx) {
|
|
12618
12703
|
await orm.transaction(async (tx) => {
|
|
12619
|
-
const [phaseRow] = await tx.select({ name: planPhases.name, manualChecks: planPhases.manualChecks }).from(planPhases).where(
|
|
12620
|
-
const tasks = await tx.select({ idx: planTasks.idx, task: planTasks.task }).from(planTasks).where(
|
|
12704
|
+
const [phaseRow] = await tx.select({ name: planPhases.name, manualChecks: planPhases.manualChecks }).from(planPhases).where(and15(eq33(planPhases.itemId, itemId2), eq33(planPhases.idx, fromIdx)));
|
|
12705
|
+
const tasks = await tx.select({ idx: planTasks.idx, task: planTasks.task }).from(planTasks).where(and15(eq33(planTasks.itemId, itemId2), eq33(planTasks.phaseIdx, fromIdx))).orderBy(asc10(planTasks.idx));
|
|
12621
12706
|
await tx.delete(planTasks).where(
|
|
12622
|
-
|
|
12707
|
+
and15(eq33(planTasks.itemId, itemId2), eq33(planTasks.phaseIdx, fromIdx))
|
|
12623
12708
|
);
|
|
12624
|
-
await tx.delete(planPhases).where(
|
|
12709
|
+
await tx.delete(planPhases).where(and15(eq33(planPhases.itemId, itemId2), eq33(planPhases.idx, fromIdx)));
|
|
12625
12710
|
await reindexPhases(tx, itemId2);
|
|
12626
12711
|
await shiftPhasesUp(tx, itemId2, toIdx);
|
|
12627
12712
|
await tx.insert(planPhases).values({
|
|
@@ -12662,7 +12747,7 @@ async function movePhase(id, from, to) {
|
|
|
12662
12747
|
if (!found) return;
|
|
12663
12748
|
const { orm, item } = found;
|
|
12664
12749
|
const itemId2 = item.id;
|
|
12665
|
-
const [row] = await orm.select({ cnt: count5() }).from(planPhases).where(
|
|
12750
|
+
const [row] = await orm.select({ cnt: count5() }).from(planPhases).where(eq34(planPhases.itemId, itemId2));
|
|
12666
12751
|
const phaseCount = row?.cnt ?? 0;
|
|
12667
12752
|
const fromIdx = toIndex(from, phaseCount);
|
|
12668
12753
|
if (fromIdx === void 0) return;
|
|
@@ -12678,22 +12763,22 @@ async function movePhase(id, from, to) {
|
|
|
12678
12763
|
import chalk106 from "chalk";
|
|
12679
12764
|
|
|
12680
12765
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
12681
|
-
import { and as
|
|
12766
|
+
import { and as and16, eq as eq35 } from "drizzle-orm";
|
|
12682
12767
|
async function applyPhaseUpdate(orm, itemId2, phaseIdx, fields) {
|
|
12683
12768
|
await orm.transaction(async (tx) => {
|
|
12684
12769
|
if (fields.name) {
|
|
12685
12770
|
await tx.update(planPhases).set({ name: fields.name }).where(
|
|
12686
|
-
|
|
12771
|
+
and16(eq35(planPhases.itemId, itemId2), eq35(planPhases.idx, phaseIdx))
|
|
12687
12772
|
);
|
|
12688
12773
|
}
|
|
12689
12774
|
if (fields.manualCheck) {
|
|
12690
12775
|
await tx.update(planPhases).set({ manualChecks: JSON.stringify(fields.manualCheck) }).where(
|
|
12691
|
-
|
|
12776
|
+
and16(eq35(planPhases.itemId, itemId2), eq35(planPhases.idx, phaseIdx))
|
|
12692
12777
|
);
|
|
12693
12778
|
}
|
|
12694
12779
|
if (fields.task) {
|
|
12695
12780
|
await tx.delete(planTasks).where(
|
|
12696
|
-
|
|
12781
|
+
and16(eq35(planTasks.itemId, itemId2), eq35(planTasks.phaseIdx, phaseIdx))
|
|
12697
12782
|
);
|
|
12698
12783
|
if (fields.task.length) {
|
|
12699
12784
|
await tx.insert(planTasks).values(
|
|
@@ -12711,14 +12796,14 @@ async function applyPhaseUpdate(orm, itemId2, phaseIdx, fields) {
|
|
|
12711
12796
|
|
|
12712
12797
|
// src/commands/backlog/findPhase.ts
|
|
12713
12798
|
import chalk105 from "chalk";
|
|
12714
|
-
import { and as
|
|
12799
|
+
import { and as and17, count as count6, eq as eq36 } from "drizzle-orm";
|
|
12715
12800
|
async function findPhase(id, phase) {
|
|
12716
12801
|
const found = await findOneItem(id);
|
|
12717
12802
|
if (!found) return void 0;
|
|
12718
12803
|
const { orm, item } = found;
|
|
12719
12804
|
const itemId2 = item.id;
|
|
12720
12805
|
const phaseIdx = Number.parseInt(phase, 10) - 1;
|
|
12721
|
-
const [row] = await orm.select({ cnt: count6() }).from(planPhases).where(
|
|
12806
|
+
const [row] = await orm.select({ cnt: count6() }).from(planPhases).where(and17(eq36(planPhases.itemId, itemId2), eq36(planPhases.idx, phaseIdx)));
|
|
12722
12807
|
if (!row || row.cnt === 0) {
|
|
12723
12808
|
console.log(
|
|
12724
12809
|
chalk105.red(
|
|
@@ -12891,16 +12976,16 @@ function registerUpdatePhaseCommand(cmd) {
|
|
|
12891
12976
|
|
|
12892
12977
|
// src/commands/backlog/removePhase.ts
|
|
12893
12978
|
import chalk107 from "chalk";
|
|
12894
|
-
import { and as
|
|
12979
|
+
import { and as and18, eq as eq37 } from "drizzle-orm";
|
|
12895
12980
|
async function removePhase(id, phase) {
|
|
12896
12981
|
const found = await findPhase(id, phase);
|
|
12897
12982
|
if (!found) return;
|
|
12898
12983
|
const { item, orm, itemId: itemId2, phaseIdx } = found;
|
|
12899
12984
|
await orm.transaction(async (tx) => {
|
|
12900
12985
|
await tx.delete(planTasks).where(
|
|
12901
|
-
|
|
12986
|
+
and18(eq37(planTasks.itemId, itemId2), eq37(planTasks.phaseIdx, phaseIdx))
|
|
12902
12987
|
);
|
|
12903
|
-
await tx.delete(planPhases).where(
|
|
12988
|
+
await tx.delete(planPhases).where(and18(eq37(planPhases.itemId, itemId2), eq37(planPhases.idx, phaseIdx)));
|
|
12904
12989
|
await reindexPhases(tx, itemId2);
|
|
12905
12990
|
await adjustCurrentPhase(tx, item, phaseIdx);
|
|
12906
12991
|
});
|
|
@@ -12913,7 +12998,7 @@ async function removePhase(id, phase) {
|
|
|
12913
12998
|
|
|
12914
12999
|
// src/commands/backlog/update/update.ts
|
|
12915
13000
|
import chalk111 from "chalk";
|
|
12916
|
-
import { eq as
|
|
13001
|
+
import { eq as eq38 } from "drizzle-orm";
|
|
12917
13002
|
|
|
12918
13003
|
// src/commands/backlog/update/buildUpdateValues.ts
|
|
12919
13004
|
import chalk108 from "chalk";
|
|
@@ -13024,7 +13109,7 @@ async function update(id, options2) {
|
|
|
13024
13109
|
if (!built) return;
|
|
13025
13110
|
const { orm } = found;
|
|
13026
13111
|
const itemId2 = found.item.id;
|
|
13027
|
-
await orm.update(items).set(built.set).where(
|
|
13112
|
+
await orm.update(items).set(built.set).where(eq38(items.id, itemId2));
|
|
13028
13113
|
console.log(
|
|
13029
13114
|
chalk111.green(`Updated ${built.fields} on item ${formatItemId(itemId2)}.`)
|
|
13030
13115
|
);
|
|
@@ -17107,9 +17192,9 @@ function registerGithub(program2) {
|
|
|
17107
17192
|
}
|
|
17108
17193
|
|
|
17109
17194
|
// src/commands/handover/countPendingHandovers.ts
|
|
17110
|
-
import { and as
|
|
17195
|
+
import { and as and19, eq as eq39, isNull, sql as sql18 } from "drizzle-orm";
|
|
17111
17196
|
async function countPendingHandovers(orm, origin) {
|
|
17112
|
-
const [row] = await orm.select({ count: sql18`count(*)::int` }).from(handovers).where(
|
|
17197
|
+
const [row] = await orm.select({ count: sql18`count(*)::int` }).from(handovers).where(and19(eq39(handovers.origin, origin), isNull(handovers.recalledAt)));
|
|
17113
17198
|
return row?.count ?? 0;
|
|
17114
17199
|
}
|
|
17115
17200
|
|
|
@@ -17249,13 +17334,13 @@ async function load2(options2 = {}) {
|
|
|
17249
17334
|
}
|
|
17250
17335
|
|
|
17251
17336
|
// src/commands/handover/listPendingHandovers.ts
|
|
17252
|
-
import { and as
|
|
17337
|
+
import { and as and20, desc as desc4, eq as eq40, isNull as isNull2 } from "drizzle-orm";
|
|
17253
17338
|
async function listPendingHandovers(orm, origin) {
|
|
17254
17339
|
return orm.select({
|
|
17255
17340
|
id: handovers.id,
|
|
17256
17341
|
summary: handovers.summary,
|
|
17257
17342
|
createdAt: handovers.createdAt
|
|
17258
|
-
}).from(handovers).where(
|
|
17343
|
+
}).from(handovers).where(and20(eq40(handovers.origin, origin), isNull2(handovers.recalledAt))).orderBy(desc4(handovers.createdAt), desc4(handovers.id));
|
|
17259
17344
|
}
|
|
17260
17345
|
|
|
17261
17346
|
// src/commands/handover/printPendingHandovers.ts
|
|
@@ -17268,17 +17353,17 @@ async function printPendingHandovers() {
|
|
|
17268
17353
|
}
|
|
17269
17354
|
|
|
17270
17355
|
// src/commands/handover/recallHandover.ts
|
|
17271
|
-
import { and as
|
|
17356
|
+
import { and as and21, desc as desc5, eq as eq41, isNull as isNull3 } from "drizzle-orm";
|
|
17272
17357
|
async function recallHandover(orm, origin, id) {
|
|
17273
17358
|
const [row] = await orm.select().from(handovers).where(
|
|
17274
|
-
|
|
17275
|
-
|
|
17359
|
+
and21(
|
|
17360
|
+
eq41(handovers.origin, origin),
|
|
17276
17361
|
isNull3(handovers.recalledAt),
|
|
17277
|
-
...id === void 0 ? [] : [
|
|
17362
|
+
...id === void 0 ? [] : [eq41(handovers.id, id)]
|
|
17278
17363
|
)
|
|
17279
17364
|
).orderBy(desc5(handovers.createdAt), desc5(handovers.id)).limit(1);
|
|
17280
17365
|
if (!row) return void 0;
|
|
17281
|
-
await orm.update(handovers).set({ recalledAt: /* @__PURE__ */ new Date() }).where(
|
|
17366
|
+
await orm.update(handovers).set({ recalledAt: /* @__PURE__ */ new Date() }).where(eq41(handovers.id, row.id));
|
|
17282
17367
|
return row.content;
|
|
17283
17368
|
}
|
|
17284
17369
|
|
|
@@ -19281,20 +19366,20 @@ function resolveThread(threadId) {
|
|
|
19281
19366
|
}
|
|
19282
19367
|
}
|
|
19283
19368
|
function requireCache(prNumber) {
|
|
19284
|
-
const
|
|
19285
|
-
if (!
|
|
19369
|
+
const cache4 = loadCommentsCache(prNumber);
|
|
19370
|
+
if (!cache4) {
|
|
19286
19371
|
console.error(
|
|
19287
19372
|
`Error: No cached comments found for PR #${prNumber}. Run "assist prs list-comments" first.`
|
|
19288
19373
|
);
|
|
19289
19374
|
process.exit(1);
|
|
19290
19375
|
}
|
|
19291
|
-
return
|
|
19376
|
+
return cache4;
|
|
19292
19377
|
}
|
|
19293
19378
|
function findLineComment(comments3, commentId) {
|
|
19294
19379
|
return comments3.find((c) => c.type === "line" && c.id === commentId);
|
|
19295
19380
|
}
|
|
19296
|
-
function requireLineComment(
|
|
19297
|
-
const comment3 = findLineComment(
|
|
19381
|
+
function requireLineComment(cache4, commentId) {
|
|
19382
|
+
const comment3 = findLineComment(cache4.comments, commentId);
|
|
19298
19383
|
if (!comment3 || comment3.type !== "line" || !comment3.threadId) {
|
|
19299
19384
|
console.error(
|
|
19300
19385
|
`Error: Comment #${commentId} not found or has no thread ID.`
|
|
@@ -19303,8 +19388,8 @@ function requireLineComment(cache3, commentId) {
|
|
|
19303
19388
|
}
|
|
19304
19389
|
return comment3;
|
|
19305
19390
|
}
|
|
19306
|
-
function cleanupCacheIfDone(
|
|
19307
|
-
const hasRemaining =
|
|
19391
|
+
function cleanupCacheIfDone(cache4, prNumber, commentId) {
|
|
19392
|
+
const hasRemaining = cache4.comments.some(
|
|
19308
19393
|
(c) => c.type === "line" && c.id !== commentId
|
|
19309
19394
|
);
|
|
19310
19395
|
if (!hasRemaining) deleteCommentsCache(prNumber);
|
|
@@ -19312,13 +19397,13 @@ function cleanupCacheIfDone(cache3, prNumber, commentId) {
|
|
|
19312
19397
|
function resolveCommentWithReply(commentId, message2) {
|
|
19313
19398
|
const prNumber = getCurrentPrNumber();
|
|
19314
19399
|
const { org, repo } = getRepoInfo();
|
|
19315
|
-
const
|
|
19316
|
-
const comment3 = requireLineComment(
|
|
19400
|
+
const cache4 = requireCache(prNumber);
|
|
19401
|
+
const comment3 = requireLineComment(cache4, commentId);
|
|
19317
19402
|
replyToComment(org, repo, prNumber, commentId, message2);
|
|
19318
19403
|
console.log("Reply posted successfully.");
|
|
19319
19404
|
resolveThread(comment3.threadId);
|
|
19320
19405
|
console.log("Thread resolved successfully.");
|
|
19321
|
-
cleanupCacheIfDone(
|
|
19406
|
+
cleanupCacheIfDone(cache4, prNumber, commentId);
|
|
19322
19407
|
}
|
|
19323
19408
|
|
|
19324
19409
|
// src/commands/prs/fixed.ts
|
|
@@ -26478,6 +26563,7 @@ function toSessionInfo({
|
|
|
26478
26563
|
serverOrigin,
|
|
26479
26564
|
assistArgs,
|
|
26480
26565
|
cwd,
|
|
26566
|
+
claudeSessionId,
|
|
26481
26567
|
restored,
|
|
26482
26568
|
error,
|
|
26483
26569
|
activity: activity2,
|
|
@@ -26508,6 +26594,7 @@ function toSessionInfo({
|
|
|
26508
26594
|
remoteOrigin: serverOrigin ?? originForCwd(cwd),
|
|
26509
26595
|
assistArgs,
|
|
26510
26596
|
cwd,
|
|
26597
|
+
claudeSessionId,
|
|
26511
26598
|
repoGroup: repoGroupForCwd(cwd),
|
|
26512
26599
|
restored,
|
|
26513
26600
|
error,
|
|
@@ -27296,10 +27383,10 @@ function applyReviewPause(session, activity2) {
|
|
|
27296
27383
|
}
|
|
27297
27384
|
|
|
27298
27385
|
// src/shared/db/getPhaseActiveMs.ts
|
|
27299
|
-
import { and as
|
|
27386
|
+
import { and as and22, eq as eq42 } from "drizzle-orm";
|
|
27300
27387
|
async function getPhaseActiveMs(db, itemId2, phaseIdx) {
|
|
27301
27388
|
const [row] = await db.select({ activeMs: phaseUsage.activeMs }).from(phaseUsage).where(
|
|
27302
|
-
|
|
27389
|
+
and22(eq42(phaseUsage.itemId, itemId2), eq42(phaseUsage.phaseIdx, phaseIdx))
|
|
27303
27390
|
);
|
|
27304
27391
|
return row?.activeMs ?? 0;
|
|
27305
27392
|
}
|
|
@@ -27810,17 +27897,17 @@ async function recordPhaseTranscriptUsage(db, itemId2, phaseIdx, responses) {
|
|
|
27810
27897
|
}
|
|
27811
27898
|
|
|
27812
27899
|
// src/shared/db/recordWindowTokens.ts
|
|
27813
|
-
import { and as
|
|
27900
|
+
import { and as and23, eq as eq43, sql as sql24 } from "drizzle-orm";
|
|
27814
27901
|
async function recordWindowTokens(db, window, resetsAt, tokensUp, tokensDown) {
|
|
27815
27902
|
if (tokensUp <= 0 && tokensDown <= 0) return;
|
|
27816
27903
|
await db.update(usagePeaks).set({
|
|
27817
27904
|
tokensUp: sql24`${usagePeaks.tokensUp} + ${tokensUp}`,
|
|
27818
27905
|
tokensDown: sql24`${usagePeaks.tokensDown} + ${tokensDown}`
|
|
27819
27906
|
}).where(
|
|
27820
|
-
|
|
27821
|
-
|
|
27822
|
-
|
|
27823
|
-
|
|
27907
|
+
and23(
|
|
27908
|
+
eq43(usagePeaks.window, window),
|
|
27909
|
+
eq43(usagePeaks.resetsAt, resetsAt),
|
|
27910
|
+
eq43(usagePeaks.segment, 0)
|
|
27824
27911
|
)
|
|
27825
27912
|
);
|
|
27826
27913
|
}
|
|
@@ -30278,7 +30365,7 @@ var sessionsConfigHelp = [
|
|
|
30278
30365
|
{
|
|
30279
30366
|
key: "sessions.includeCommittedChanges",
|
|
30280
30367
|
setter: "assist config set sessions.includeCommittedChanges true -g",
|
|
30281
|
-
note: "session card counts and /diff span the whole
|
|
30368
|
+
note: "session card counts and /diff span the whole session (its first commit's parent, else merge-base with the default branch) instead of just uncommitted work (default off)"
|
|
30282
30369
|
},
|
|
30283
30370
|
{
|
|
30284
30371
|
key: "worktree.enabled",
|