@staff0rd/assist 0.1064.0 → 0.1065.1
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/built-version +1 -1
- package/dist/commands/sessions/web/bundle.js +409 -409
- package/dist/index.js +855 -646
- 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.1065.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -482,11 +482,11 @@ function linkedWorktree(dir) {
|
|
|
482
482
|
return existsSync(clone) ? { root: root2, clone } : null;
|
|
483
483
|
}
|
|
484
484
|
function findGitLink(dir) {
|
|
485
|
-
let
|
|
486
|
-
while (
|
|
487
|
-
const entry = join4(
|
|
488
|
-
if (existsSync(entry)) return isFile(entry) ?
|
|
489
|
-
|
|
485
|
+
let current2 = resolve2(dir);
|
|
486
|
+
while (current2 !== dirname2(current2)) {
|
|
487
|
+
const entry = join4(current2, ".git");
|
|
488
|
+
if (existsSync(entry)) return isFile(entry) ? current2 : null;
|
|
489
|
+
current2 = dirname2(current2);
|
|
490
490
|
}
|
|
491
491
|
return null;
|
|
492
492
|
}
|
|
@@ -682,12 +682,12 @@ import chalk2 from "chalk";
|
|
|
682
682
|
import { existsSync as existsSync5 } from "fs";
|
|
683
683
|
import path from "path";
|
|
684
684
|
function findRepoRoot(dir) {
|
|
685
|
-
let
|
|
686
|
-
while (
|
|
687
|
-
if (existsSync5(path.join(
|
|
688
|
-
return
|
|
685
|
+
let current2 = dir;
|
|
686
|
+
while (current2 !== path.dirname(current2)) {
|
|
687
|
+
if (existsSync5(path.join(current2, ".git"))) {
|
|
688
|
+
return current2;
|
|
689
689
|
}
|
|
690
|
-
|
|
690
|
+
current2 = path.dirname(current2);
|
|
691
691
|
}
|
|
692
692
|
return null;
|
|
693
693
|
}
|
|
@@ -1468,14 +1468,14 @@ function warnUnsharedAdviceRules(globalRaw, userDb) {
|
|
|
1468
1468
|
|
|
1469
1469
|
// src/shared/loadConfigFrom.ts
|
|
1470
1470
|
function findConfigUp(startDir) {
|
|
1471
|
-
let
|
|
1472
|
-
while (
|
|
1473
|
-
const claudePath = join7(
|
|
1471
|
+
let current2 = startDir;
|
|
1472
|
+
while (current2 !== dirname3(current2)) {
|
|
1473
|
+
const claudePath = join7(current2, ".claude", "assist.yml");
|
|
1474
1474
|
if (existsSync6(claudePath))
|
|
1475
|
-
return { configPath: claudePath, rootDir:
|
|
1476
|
-
const rootPath = join7(
|
|
1477
|
-
if (existsSync6(rootPath)) return { configPath: rootPath, rootDir:
|
|
1478
|
-
|
|
1475
|
+
return { configPath: claudePath, rootDir: current2 };
|
|
1476
|
+
const rootPath = join7(current2, "assist.yml");
|
|
1477
|
+
if (existsSync6(rootPath)) return { configPath: rootPath, rootDir: current2 };
|
|
1478
|
+
current2 = dirname3(current2);
|
|
1479
1479
|
}
|
|
1480
1480
|
return null;
|
|
1481
1481
|
}
|
|
@@ -1625,15 +1625,15 @@ async function readServeConfig() {
|
|
|
1625
1625
|
|
|
1626
1626
|
// src/commands/sessions/nodes/runningStatus.ts
|
|
1627
1627
|
async function runningStatus(status2) {
|
|
1628
|
-
let
|
|
1628
|
+
let current2;
|
|
1629
1629
|
try {
|
|
1630
|
-
|
|
1630
|
+
current2 = await status2();
|
|
1631
1631
|
} catch (error) {
|
|
1632
1632
|
if (error.code === "ENOENT")
|
|
1633
1633
|
return `skipped, ${tailscaleCli()} is not installed`;
|
|
1634
1634
|
throw error;
|
|
1635
1635
|
}
|
|
1636
|
-
return
|
|
1636
|
+
return current2.BackendState === "Running" ? current2 : `skipped, Tailscale is ${current2.BackendState ?? "not running"}`;
|
|
1637
1637
|
}
|
|
1638
1638
|
|
|
1639
1639
|
// src/commands/sessions/nodes/tailnetHttpsPort.ts
|
|
@@ -1660,10 +1660,10 @@ async function ensureTailscaleServe(port, deps2 = {}) {
|
|
|
1660
1660
|
...deps2
|
|
1661
1661
|
};
|
|
1662
1662
|
if (!enabled()) return "skipped, sessions.tailscaleServe is false";
|
|
1663
|
-
const
|
|
1664
|
-
if (typeof
|
|
1663
|
+
const current2 = await runningStatus(status2);
|
|
1664
|
+
if (typeof current2 === "string") return current2;
|
|
1665
1665
|
for (let attempt2 = 1; ; attempt2++) {
|
|
1666
|
-
const plan2 = planServe(
|
|
1666
|
+
const plan2 = planServe(current2, await serveStatus(), port, httpsPort(port));
|
|
1667
1667
|
if (plan2.alreadyServing) return `${plan2.url} already serves ${plan2.target}`;
|
|
1668
1668
|
try {
|
|
1669
1669
|
await serve(plan2.args);
|
|
@@ -1817,13 +1817,13 @@ function createBrowserLink(options2 = {}) {
|
|
|
1817
1817
|
},
|
|
1818
1818
|
connectedVersion: () => state.version(),
|
|
1819
1819
|
async request(request, timeoutMs) {
|
|
1820
|
-
const
|
|
1820
|
+
const current2 = await state.connected();
|
|
1821
1821
|
const reply2 = await replies.send(
|
|
1822
|
-
|
|
1822
|
+
current2.ws,
|
|
1823
1823
|
timeoutMs,
|
|
1824
|
-
(id) =>
|
|
1824
|
+
(id) => current2.ws.send(JSON.stringify({ ...request, type: "request", id }))
|
|
1825
1825
|
);
|
|
1826
|
-
return { ...reply2, version:
|
|
1826
|
+
return { ...reply2, version: current2.version };
|
|
1827
1827
|
}
|
|
1828
1828
|
};
|
|
1829
1829
|
}
|
|
@@ -2646,18 +2646,18 @@ function remap(item, newId, oldToNew) {
|
|
|
2646
2646
|
};
|
|
2647
2647
|
return remapped;
|
|
2648
2648
|
}
|
|
2649
|
-
async function importItemsRemapped(orm,
|
|
2649
|
+
async function importItemsRemapped(orm, items3, origin) {
|
|
2650
2650
|
return orm.transaction(async (tx) => {
|
|
2651
2651
|
const oldToNew = /* @__PURE__ */ new Map();
|
|
2652
|
-
for (const item of
|
|
2652
|
+
for (const item of items3) {
|
|
2653
2653
|
oldToNew.set(item.id, await insertItem(tx, item, origin));
|
|
2654
2654
|
}
|
|
2655
|
-
for (const item of
|
|
2655
|
+
for (const item of items3) {
|
|
2656
2656
|
const newId = oldToNew.get(item.id);
|
|
2657
2657
|
if (newId === void 0) continue;
|
|
2658
2658
|
await insertItemRelations(tx, remap(item, newId, oldToNew));
|
|
2659
2659
|
}
|
|
2660
|
-
return
|
|
2660
|
+
return items3.length;
|
|
2661
2661
|
});
|
|
2662
2662
|
}
|
|
2663
2663
|
|
|
@@ -2990,16 +2990,16 @@ function parseBacklogJsonl(path109) {
|
|
|
2990
2990
|
function jsonlPath(dir) {
|
|
2991
2991
|
return join10(dir, ".assist", "backlog.jsonl");
|
|
2992
2992
|
}
|
|
2993
|
-
async function verifyImport(orm, origin,
|
|
2993
|
+
async function verifyImport(orm, origin, items3, imported) {
|
|
2994
2994
|
const reloaded = await loadAllItems(orm, origin);
|
|
2995
2995
|
if (reloaded.length !== imported) {
|
|
2996
2996
|
throw new Error(
|
|
2997
2997
|
`backlog migrate: expected ${imported} item(s) for ${origin} after import but found ${reloaded.length}.`
|
|
2998
2998
|
);
|
|
2999
2999
|
}
|
|
3000
|
-
if (
|
|
3000
|
+
if (items3.length > 0 && !reloaded.some((i) => i.name === items3[0].name)) {
|
|
3001
3001
|
throw new Error(
|
|
3002
|
-
`backlog migrate: spot-check failed; "${
|
|
3002
|
+
`backlog migrate: spot-check failed; "${items3[0].name}" not found after import.`
|
|
3003
3003
|
);
|
|
3004
3004
|
}
|
|
3005
3005
|
}
|
|
@@ -3016,9 +3016,9 @@ async function migrateLocalBacklog(orm, dir, origin) {
|
|
|
3016
3016
|
return;
|
|
3017
3017
|
}
|
|
3018
3018
|
gitPullBacklog(dir);
|
|
3019
|
-
const
|
|
3020
|
-
const imported = await importItemsRemapped(orm,
|
|
3021
|
-
await verifyImport(orm, origin,
|
|
3019
|
+
const items3 = parseBacklogJsonl(jsonlPath(dir));
|
|
3020
|
+
const imported = await importItemsRemapped(orm, items3, origin);
|
|
3021
|
+
await verifyImport(orm, origin, items3, imported);
|
|
3022
3022
|
const moved = backupLocalBacklogFiles(dir);
|
|
3023
3023
|
console.error(
|
|
3024
3024
|
chalk6.green(
|
|
@@ -3762,12 +3762,12 @@ var BACKLOG_MARKERS = [
|
|
|
3762
3762
|
"assist.backlog.yml"
|
|
3763
3763
|
];
|
|
3764
3764
|
function findBacklogUp(startDir) {
|
|
3765
|
-
let
|
|
3766
|
-
while (
|
|
3767
|
-
if (BACKLOG_MARKERS.some((marker2) => existsSync11(join11(
|
|
3768
|
-
return
|
|
3765
|
+
let current2 = startDir;
|
|
3766
|
+
while (current2 !== dirname4(current2)) {
|
|
3767
|
+
if (BACKLOG_MARKERS.some((marker2) => existsSync11(join11(current2, marker2)))) {
|
|
3768
|
+
return current2;
|
|
3769
3769
|
}
|
|
3770
|
-
|
|
3770
|
+
current2 = dirname4(current2);
|
|
3771
3771
|
}
|
|
3772
3772
|
return null;
|
|
3773
3773
|
}
|
|
@@ -4227,7 +4227,7 @@ import { z as z8 } from "zod";
|
|
|
4227
4227
|
// src/commands/sessions/web/readJsonBody.ts
|
|
4228
4228
|
async function readJsonBody(req) {
|
|
4229
4229
|
const chunks = [];
|
|
4230
|
-
for await (const
|
|
4230
|
+
for await (const chunk2 of req) chunks.push(chunk2);
|
|
4231
4231
|
return JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
4232
4232
|
}
|
|
4233
4233
|
|
|
@@ -4311,8 +4311,8 @@ function isGithubAssistMode(mode) {
|
|
|
4311
4311
|
// src/commands/sessions/daemon/readSocketLines.ts
|
|
4312
4312
|
function readSocketLines(socket, onLine) {
|
|
4313
4313
|
let buffer = "";
|
|
4314
|
-
socket.on("data", (
|
|
4315
|
-
buffer +=
|
|
4314
|
+
socket.on("data", (chunk2) => {
|
|
4315
|
+
buffer += chunk2.toString("utf8");
|
|
4316
4316
|
let newline = buffer.indexOf("\n");
|
|
4317
4317
|
while (newline !== -1) {
|
|
4318
4318
|
onLine(buffer.slice(0, newline));
|
|
@@ -4481,8 +4481,8 @@ async function loadVisibleItems(req) {
|
|
|
4481
4481
|
function readBody(req) {
|
|
4482
4482
|
return new Promise((resolve34, reject) => {
|
|
4483
4483
|
let body = "";
|
|
4484
|
-
req.on("data", (
|
|
4485
|
-
body +=
|
|
4484
|
+
req.on("data", (chunk2) => {
|
|
4485
|
+
body += chunk2.toString();
|
|
4486
4486
|
});
|
|
4487
4487
|
req.on("end", () => resolve34(body));
|
|
4488
4488
|
req.on("error", reject);
|
|
@@ -4501,8 +4501,8 @@ async function parseStarBody(req) {
|
|
|
4501
4501
|
// src/commands/backlog/web/shared.ts
|
|
4502
4502
|
async function listItems(req, res) {
|
|
4503
4503
|
applyCwdFromReq(req);
|
|
4504
|
-
const
|
|
4505
|
-
respondJson(res, 200,
|
|
4504
|
+
const items3 = await loadVisibleItems(req);
|
|
4505
|
+
respondJson(res, 200, items3.slice().reverse());
|
|
4506
4506
|
}
|
|
4507
4507
|
async function findItemOr404(res, id) {
|
|
4508
4508
|
const { orm } = await getReady();
|
|
@@ -4645,14 +4645,14 @@ async function resolveTarget(port, deps2) {
|
|
|
4645
4645
|
"sessions.tailscaleServe is false on this node",
|
|
4646
4646
|
`Run \`assist config set sessions.tailscaleServe true --node\`, ${RESTART}`
|
|
4647
4647
|
);
|
|
4648
|
-
const
|
|
4649
|
-
if (typeof
|
|
4648
|
+
const current2 = await runningStatus(deps2.status);
|
|
4649
|
+
if (typeof current2 === "string")
|
|
4650
4650
|
return notServing(
|
|
4651
|
-
|
|
4651
|
+
current2.replace(/^skipped, /, ""),
|
|
4652
4652
|
`Install Tailscale and run \`${tailscaleCli()} up\`, ${RESTART}`
|
|
4653
4653
|
);
|
|
4654
4654
|
const plan2 = planServe(
|
|
4655
|
-
|
|
4655
|
+
current2,
|
|
4656
4656
|
await deps2.serveStatus(),
|
|
4657
4657
|
port,
|
|
4658
4658
|
deps2.httpsPort(port)
|
|
@@ -5831,17 +5831,17 @@ var WRAPPER_TYPES = /* @__PURE__ */ new Set([
|
|
|
5831
5831
|
]);
|
|
5832
5832
|
var OPTIONAL_TYPES = /* @__PURE__ */ new Set(["optional", "nullish"]);
|
|
5833
5833
|
function unwrapSchemaNode(node) {
|
|
5834
|
-
let
|
|
5834
|
+
let current2 = node;
|
|
5835
5835
|
let defaultValue;
|
|
5836
5836
|
let optional = false;
|
|
5837
|
-
while (
|
|
5838
|
-
if (
|
|
5839
|
-
defaultValue =
|
|
5837
|
+
while (current2.def && WRAPPER_TYPES.has(current2.def.type ?? "") && current2.def.innerType) {
|
|
5838
|
+
if (current2.def.type === "default" && defaultValue === void 0) {
|
|
5839
|
+
defaultValue = current2.def.defaultValue;
|
|
5840
5840
|
}
|
|
5841
|
-
if (OPTIONAL_TYPES.has(
|
|
5842
|
-
|
|
5841
|
+
if (OPTIONAL_TYPES.has(current2.def.type ?? "")) optional = true;
|
|
5842
|
+
current2 = current2.def.innerType;
|
|
5843
5843
|
}
|
|
5844
|
-
return { inner:
|
|
5844
|
+
return { inner: current2, defaultValue, optional };
|
|
5845
5845
|
}
|
|
5846
5846
|
|
|
5847
5847
|
// src/shared/scalarUnionMembers.ts
|
|
@@ -6145,13 +6145,13 @@ function redactConfigSecrets(value, node) {
|
|
|
6145
6145
|
function isTraversable(value) {
|
|
6146
6146
|
return value !== null && value !== void 0 && typeof value === "object";
|
|
6147
6147
|
}
|
|
6148
|
-
function stepInto(
|
|
6149
|
-
return isTraversable(
|
|
6148
|
+
function stepInto(current2, key) {
|
|
6149
|
+
return isTraversable(current2) ? current2[key] : void 0;
|
|
6150
6150
|
}
|
|
6151
6151
|
function getNestedValue(obj, path109) {
|
|
6152
|
-
let
|
|
6153
|
-
for (const key of path109.split("."))
|
|
6154
|
-
return
|
|
6152
|
+
let current2 = obj;
|
|
6153
|
+
for (const key of path109.split(".")) current2 = stepInto(current2, key);
|
|
6154
|
+
return current2;
|
|
6155
6155
|
}
|
|
6156
6156
|
|
|
6157
6157
|
// src/commands/config/configEntryLayers.ts
|
|
@@ -6202,12 +6202,12 @@ function step(node, segment) {
|
|
|
6202
6202
|
}
|
|
6203
6203
|
}
|
|
6204
6204
|
function findConfigNode(root2, path109) {
|
|
6205
|
-
let
|
|
6205
|
+
let current2 = root2;
|
|
6206
6206
|
for (const segment of path109) {
|
|
6207
|
-
if (!
|
|
6208
|
-
|
|
6207
|
+
if (!current2) return void 0;
|
|
6208
|
+
current2 = step(current2, segment);
|
|
6209
6209
|
}
|
|
6210
|
-
return
|
|
6210
|
+
return current2;
|
|
6211
6211
|
}
|
|
6212
6212
|
|
|
6213
6213
|
// src/shared/parseConfigPath.ts
|
|
@@ -7133,11 +7133,11 @@ function stepIntoNested(container, key, nextKey) {
|
|
|
7133
7133
|
function setNestedValue(obj, path109, value) {
|
|
7134
7134
|
const keys = path109.split(".");
|
|
7135
7135
|
const result = { ...obj };
|
|
7136
|
-
let
|
|
7136
|
+
let current2 = result;
|
|
7137
7137
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
7138
|
-
|
|
7138
|
+
current2 = stepIntoNested(current2, keys[i], keys[i + 1]);
|
|
7139
7139
|
}
|
|
7140
|
-
setItem(
|
|
7140
|
+
setItem(current2, resolveKey(keys[keys.length - 1]), value);
|
|
7141
7141
|
return result;
|
|
7142
7142
|
}
|
|
7143
7143
|
|
|
@@ -8904,6 +8904,65 @@ function queryNodes() {
|
|
|
8904
8904
|
return requestDaemonReply({ type: "nodes" }, "nodes");
|
|
8905
8905
|
}
|
|
8906
8906
|
|
|
8907
|
+
// src/commands/watch/resolveUpstream.ts
|
|
8908
|
+
import { execFileSync as execFileSync2 } from "child_process";
|
|
8909
|
+
function runGit3(args, cwd) {
|
|
8910
|
+
return execFileSync2("git", args, {
|
|
8911
|
+
encoding: "utf8",
|
|
8912
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
8913
|
+
cwd,
|
|
8914
|
+
windowsHide: true
|
|
8915
|
+
}).trim();
|
|
8916
|
+
}
|
|
8917
|
+
function resolveUpstream(cwd) {
|
|
8918
|
+
try {
|
|
8919
|
+
runGit3(["rev-parse", "--is-inside-work-tree"], cwd);
|
|
8920
|
+
} catch {
|
|
8921
|
+
throw new Error(
|
|
8922
|
+
"not a git repository \u2014 run assist watch wait from inside a repo"
|
|
8923
|
+
);
|
|
8924
|
+
}
|
|
8925
|
+
let branch2;
|
|
8926
|
+
try {
|
|
8927
|
+
branch2 = runGit3(["symbolic-ref", "--quiet", "--short", "HEAD"], cwd);
|
|
8928
|
+
} catch {
|
|
8929
|
+
throw new Error(
|
|
8930
|
+
"HEAD is detached \u2014 check out a branch before waiting on its upstream"
|
|
8931
|
+
);
|
|
8932
|
+
}
|
|
8933
|
+
try {
|
|
8934
|
+
return {
|
|
8935
|
+
branch: branch2,
|
|
8936
|
+
upstream: runGit3(
|
|
8937
|
+
["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
|
|
8938
|
+
cwd
|
|
8939
|
+
)
|
|
8940
|
+
};
|
|
8941
|
+
} catch {
|
|
8942
|
+
throw new Error(
|
|
8943
|
+
`branch "${branch2}" has no upstream \u2014 set one with: git push -u origin ${branch2}`
|
|
8944
|
+
);
|
|
8945
|
+
}
|
|
8946
|
+
}
|
|
8947
|
+
|
|
8948
|
+
// src/commands/watch/headCommit.ts
|
|
8949
|
+
function headCommit2(cwd) {
|
|
8950
|
+
try {
|
|
8951
|
+
return runGit3(["rev-parse", "HEAD"], cwd);
|
|
8952
|
+
} catch {
|
|
8953
|
+
return void 0;
|
|
8954
|
+
}
|
|
8955
|
+
}
|
|
8956
|
+
|
|
8957
|
+
// src/commands/sessions/web/updates/webStartCommit.ts
|
|
8958
|
+
var captured;
|
|
8959
|
+
var webStartCommit = {
|
|
8960
|
+
capture: () => {
|
|
8961
|
+
captured = headCommit2(getInstallDir());
|
|
8962
|
+
},
|
|
8963
|
+
value: () => captured
|
|
8964
|
+
};
|
|
8965
|
+
|
|
8907
8966
|
// src/commands/sessions/web/health.ts
|
|
8908
8967
|
async function health(_req, res) {
|
|
8909
8968
|
const [reachable, nodes] = await Promise.all([
|
|
@@ -8913,6 +8972,7 @@ async function health(_req, res) {
|
|
|
8913
8972
|
respondJson(res, 200, {
|
|
8914
8973
|
nodeName: resolveNodeName(),
|
|
8915
8974
|
version: ASSIST_VERSION,
|
|
8975
|
+
startCommit: webStartCommit.value(),
|
|
8916
8976
|
protocol: PROTOCOL_VERSION,
|
|
8917
8977
|
daemon: { reachable },
|
|
8918
8978
|
links: nodes?.links ?? []
|
|
@@ -9212,22 +9272,22 @@ async function fetchFeeds(urls, onProgress) {
|
|
|
9212
9272
|
const origin = new URL(url).origin;
|
|
9213
9273
|
const res = await fetch(url);
|
|
9214
9274
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
9215
|
-
const
|
|
9275
|
+
const items4 = parseFeed(await res.text(), origin);
|
|
9216
9276
|
done2++;
|
|
9217
9277
|
onProgress?.(done2, urls.length);
|
|
9218
|
-
return
|
|
9278
|
+
return items4;
|
|
9219
9279
|
})
|
|
9220
9280
|
);
|
|
9221
|
-
const
|
|
9281
|
+
const items3 = [];
|
|
9222
9282
|
for (const result of results) {
|
|
9223
9283
|
if (result.status === "fulfilled") {
|
|
9224
|
-
|
|
9284
|
+
items3.push(...result.value);
|
|
9225
9285
|
}
|
|
9226
9286
|
}
|
|
9227
|
-
|
|
9287
|
+
items3.sort(
|
|
9228
9288
|
(a, b) => new Date(b.pubDate).getTime() - new Date(a.pubDate).getTime()
|
|
9229
9289
|
);
|
|
9230
|
-
return
|
|
9290
|
+
return items3;
|
|
9231
9291
|
}
|
|
9232
9292
|
|
|
9233
9293
|
// src/commands/sessions/web/listNewsItems.ts
|
|
@@ -9239,10 +9299,10 @@ async function listNewsItems(_req, res) {
|
|
|
9239
9299
|
const feedsKey = urls.join("\n");
|
|
9240
9300
|
const now = Date.now();
|
|
9241
9301
|
if (!cache3 || cache3.feedsKey !== feedsKey || cache3.expires <= now) {
|
|
9242
|
-
const
|
|
9243
|
-
cache3 = { feedsKey, expires: now + CACHE_TTL_MS4, items:
|
|
9244
|
-
|
|
9245
|
-
if (cache3?.items ===
|
|
9302
|
+
const items3 = fetchFeeds(urls);
|
|
9303
|
+
cache3 = { feedsKey, expires: now + CACHE_TTL_MS4, items: items3 };
|
|
9304
|
+
items3.catch(() => {
|
|
9305
|
+
if (cache3?.items === items3) cache3 = void 0;
|
|
9246
9306
|
});
|
|
9247
9307
|
}
|
|
9248
9308
|
respondJson(res, 200, await cache3.items);
|
|
@@ -9382,7 +9442,7 @@ var ownerOpenPrsQuery = `query($requested: String!, $authored: String!, $mine: S
|
|
|
9382
9442
|
var sameLogin = (a, b) => a?.toLowerCase() === b.toLowerCase();
|
|
9383
9443
|
|
|
9384
9444
|
// src/commands/sessions/web/next/headCommit.ts
|
|
9385
|
-
function
|
|
9445
|
+
function headCommit3(node) {
|
|
9386
9446
|
return node.commits?.nodes?.[0]?.commit ?? null;
|
|
9387
9447
|
}
|
|
9388
9448
|
|
|
@@ -9401,7 +9461,7 @@ function lastRequestedAt(node, viewer) {
|
|
|
9401
9461
|
return events.at(-1)?.createdAt ?? node.createdAt;
|
|
9402
9462
|
}
|
|
9403
9463
|
function toNextPr(node, author, requested, viewer) {
|
|
9404
|
-
const rollup =
|
|
9464
|
+
const rollup = headCommit3(node)?.statusCheckRollup?.state;
|
|
9405
9465
|
return {
|
|
9406
9466
|
number: node.number,
|
|
9407
9467
|
title: node.title,
|
|
@@ -9643,15 +9703,15 @@ async function sectionAcross(repos2, load2, compare) {
|
|
|
9643
9703
|
error: "No GitHub repo to read: set next.repos or select a repo with a GitHub origin."
|
|
9644
9704
|
};
|
|
9645
9705
|
const results = await Promise.allSettled(repos2.map((repo) => load2(repo)));
|
|
9646
|
-
const
|
|
9706
|
+
const items3 = /* @__PURE__ */ new Map();
|
|
9647
9707
|
const errors = [];
|
|
9648
9708
|
results.forEach((result, index3) => {
|
|
9649
9709
|
if (result.status === "fulfilled")
|
|
9650
|
-
for (const item of result.value)
|
|
9710
|
+
for (const item of result.value) items3.set(item.url, item);
|
|
9651
9711
|
else errors.push(`${repos2[index3]}: ${ghErrorText(result.reason)}`);
|
|
9652
9712
|
});
|
|
9653
9713
|
return {
|
|
9654
|
-
items: [...
|
|
9714
|
+
items: [...items3.values()].sort(compare),
|
|
9655
9715
|
error: errors.length > 0 ? errors.join("\n") : null
|
|
9656
9716
|
};
|
|
9657
9717
|
}
|
|
@@ -9847,10 +9907,10 @@ function assertProjectScope() {
|
|
|
9847
9907
|
}
|
|
9848
9908
|
|
|
9849
9909
|
// src/shared/runGhOrThrow.ts
|
|
9850
|
-
import { execFileSync as
|
|
9910
|
+
import { execFileSync as execFileSync3 } from "child_process";
|
|
9851
9911
|
function runGhOrThrow(args, fallbackMessage, input) {
|
|
9852
9912
|
try {
|
|
9853
|
-
|
|
9913
|
+
execFileSync3("gh", args, {
|
|
9854
9914
|
stdio: [input === void 0 ? "ignore" : "pipe", "ignore", "pipe"],
|
|
9855
9915
|
encoding: "utf8",
|
|
9856
9916
|
...input === void 0 ? {} : { input }
|
|
@@ -10090,12 +10150,12 @@ function scopedClaudeFiles(target) {
|
|
|
10090
10150
|
const startDir = scopeDirectory(target);
|
|
10091
10151
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
10092
10152
|
const files = [];
|
|
10093
|
-
let
|
|
10153
|
+
let current2 = startDir;
|
|
10094
10154
|
while (true) {
|
|
10095
|
-
const candidate = path12.join(
|
|
10155
|
+
const candidate = path12.join(current2, "CLAUDE.md");
|
|
10096
10156
|
if (existsSync21(candidate)) files.push(candidate);
|
|
10097
|
-
if (
|
|
10098
|
-
|
|
10157
|
+
if (current2 === root2 || current2 === path12.dirname(current2)) break;
|
|
10158
|
+
current2 = path12.dirname(current2);
|
|
10099
10159
|
}
|
|
10100
10160
|
return files;
|
|
10101
10161
|
}
|
|
@@ -10467,8 +10527,8 @@ function flushBuffer(buffer, onLine) {
|
|
|
10467
10527
|
}
|
|
10468
10528
|
function attachLineParser(child, onLine) {
|
|
10469
10529
|
let buffer = "";
|
|
10470
|
-
child.stdout?.on("data", (
|
|
10471
|
-
buffer +=
|
|
10530
|
+
child.stdout?.on("data", (chunk2) => {
|
|
10531
|
+
buffer += chunk2.toString("utf8");
|
|
10472
10532
|
buffer = flushBuffer(buffer, onLine);
|
|
10473
10533
|
});
|
|
10474
10534
|
return () => {
|
|
@@ -10479,86 +10539,116 @@ function attachLineParser(child, onLine) {
|
|
|
10479
10539
|
// src/commands/review/attachStderrCollector.ts
|
|
10480
10540
|
function attachStderrCollector(child) {
|
|
10481
10541
|
const state = { value: "" };
|
|
10482
|
-
child.stderr?.on("data", (
|
|
10483
|
-
state.value +=
|
|
10542
|
+
child.stderr?.on("data", (chunk2) => {
|
|
10543
|
+
state.value += chunk2.toString("utf8");
|
|
10484
10544
|
});
|
|
10485
10545
|
return state;
|
|
10486
10546
|
}
|
|
10487
10547
|
|
|
10488
|
-
// src/commands/inbox/
|
|
10489
|
-
|
|
10490
|
-
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
|
-
|
|
10494
|
-
|
|
10495
|
-
"
|
|
10496
|
-
|
|
10497
|
-
"
|
|
10498
|
-
"
|
|
10499
|
-
|
|
10500
|
-
|
|
10501
|
-
|
|
10502
|
-
|
|
10503
|
-
|
|
10504
|
-
|
|
10505
|
-
|
|
10506
|
-
|
|
10507
|
-
|
|
10508
|
-
|
|
10509
|
-
|
|
10510
|
-
|
|
10511
|
-
|
|
10512
|
-
|
|
10513
|
-
|
|
10514
|
-
|
|
10515
|
-
|
|
10516
|
-
|
|
10517
|
-
|
|
10518
|
-
|
|
10548
|
+
// src/commands/inbox/inboxScanTools.ts
|
|
10549
|
+
var gmail = (tool) => `mcp__claude_ai_Gmail__${tool}`;
|
|
10550
|
+
var slack = (tool) => `mcp__claude_ai_Slack__${tool}`;
|
|
10551
|
+
var inboxScanTools = {
|
|
10552
|
+
gmailSearch: gmail("search_threads"),
|
|
10553
|
+
gmailGetThread: gmail("get_thread"),
|
|
10554
|
+
allowed: [
|
|
10555
|
+
gmail("search_threads"),
|
|
10556
|
+
gmail("get_thread"),
|
|
10557
|
+
slack("slack_search_public_and_private"),
|
|
10558
|
+
slack("slack_read_thread")
|
|
10559
|
+
],
|
|
10560
|
+
denied: [
|
|
10561
|
+
...[
|
|
10562
|
+
"apply_sensitive_message_label",
|
|
10563
|
+
"apply_sensitive_thread_label",
|
|
10564
|
+
"create_draft",
|
|
10565
|
+
"create_label",
|
|
10566
|
+
"delete_draft",
|
|
10567
|
+
"delete_label",
|
|
10568
|
+
"forward",
|
|
10569
|
+
"label_message",
|
|
10570
|
+
"label_thread",
|
|
10571
|
+
"mark_message_spam",
|
|
10572
|
+
"mark_thread_spam",
|
|
10573
|
+
"reply",
|
|
10574
|
+
"send_message",
|
|
10575
|
+
"trash_message",
|
|
10576
|
+
"trash_thread",
|
|
10577
|
+
"unlabel_message",
|
|
10578
|
+
"unlabel_thread",
|
|
10579
|
+
"unmark_message_spam",
|
|
10580
|
+
"unmark_thread_spam",
|
|
10581
|
+
"untrash_message",
|
|
10582
|
+
"untrash_thread",
|
|
10583
|
+
"update_draft",
|
|
10584
|
+
"update_label",
|
|
10585
|
+
"update_message_labels"
|
|
10586
|
+
].map(gmail),
|
|
10587
|
+
...[
|
|
10588
|
+
"slack_add_reaction",
|
|
10589
|
+
"slack_create_canvas",
|
|
10590
|
+
"slack_create_conversation",
|
|
10591
|
+
"slack_schedule_message",
|
|
10592
|
+
"slack_send_message",
|
|
10593
|
+
"slack_send_message_draft",
|
|
10594
|
+
"slack_update_canvas"
|
|
10595
|
+
].map(slack)
|
|
10596
|
+
]
|
|
10597
|
+
};
|
|
10598
|
+
|
|
10599
|
+
// src/commands/inbox/openedThreadId.ts
|
|
10600
|
+
var BODILESS_FORMATS = /* @__PURE__ */ new Set(["MINIMAL", "METADATA_ONLY"]);
|
|
10601
|
+
function openedThreadId(input) {
|
|
10602
|
+
const { threadId, messageFormat } = input ?? {};
|
|
10603
|
+
if (typeof threadId !== "string") return void 0;
|
|
10604
|
+
return typeof messageFormat === "string" && BODILESS_FORMATS.has(messageFormat) ? void 0 : threadId;
|
|
10519
10605
|
}
|
|
10520
10606
|
|
|
10521
|
-
// src/commands/inbox/
|
|
10522
|
-
function
|
|
10523
|
-
return
|
|
10524
|
-
(value) => typeof value === "string" || typeof value === "number"
|
|
10525
|
-
).map(String);
|
|
10607
|
+
// src/commands/inbox/searchResultThreadIds.ts
|
|
10608
|
+
function items2(value) {
|
|
10609
|
+
return Array.isArray(value) ? value : [];
|
|
10526
10610
|
}
|
|
10527
|
-
function
|
|
10528
|
-
|
|
10529
|
-
return
|
|
10611
|
+
function resultText2(content) {
|
|
10612
|
+
if (typeof content === "string") return content;
|
|
10613
|
+
return items2(content).map((block) => typeof block.text === "string" ? block.text : "").join("");
|
|
10530
10614
|
}
|
|
10531
|
-
function
|
|
10532
|
-
|
|
10533
|
-
|
|
10534
|
-
"
|
|
10535
|
-
|
|
10536
|
-
|
|
10537
|
-
|
|
10538
|
-
"message_ts"
|
|
10539
|
-
]).join(" ");
|
|
10540
|
-
return { label: toolLabel(name), detail };
|
|
10615
|
+
function searchResultThreadIds(content) {
|
|
10616
|
+
try {
|
|
10617
|
+
const { threads } = JSON.parse(resultText2(content));
|
|
10618
|
+
return items2(threads).map((thread) => thread.id).filter((id) => typeof id === "string");
|
|
10619
|
+
} catch {
|
|
10620
|
+
return [];
|
|
10621
|
+
}
|
|
10541
10622
|
}
|
|
10542
10623
|
|
|
10543
|
-
// src/commands/inbox/
|
|
10544
|
-
|
|
10545
|
-
|
|
10546
|
-
const trimmed = text20.trim();
|
|
10547
|
-
return trimmed.length <= MAX_TEXT ? trimmed : `${trimmed.slice(0, MAX_TEXT - 1)}\u2026`;
|
|
10624
|
+
// src/commands/inbox/createGmailCoverage.ts
|
|
10625
|
+
function blocks(content) {
|
|
10626
|
+
return Array.isArray(content) ? content : [];
|
|
10548
10627
|
}
|
|
10549
|
-
function
|
|
10550
|
-
|
|
10551
|
-
|
|
10552
|
-
|
|
10553
|
-
|
|
10554
|
-
|
|
10555
|
-
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
|
|
10560
|
-
|
|
10561
|
-
return
|
|
10628
|
+
function createGmailCoverage() {
|
|
10629
|
+
const searches = /* @__PURE__ */ new Set();
|
|
10630
|
+
const found = /* @__PURE__ */ new Set();
|
|
10631
|
+
const opened = /* @__PURE__ */ new Set();
|
|
10632
|
+
const onToolUse = (block) => {
|
|
10633
|
+
if (block.name === inboxScanTools.gmailSearch)
|
|
10634
|
+
searches.add(String(block.id));
|
|
10635
|
+
else if (block.name === inboxScanTools.gmailGetThread) {
|
|
10636
|
+
const id = openedThreadId(block.input);
|
|
10637
|
+
if (id) opened.add(id);
|
|
10638
|
+
}
|
|
10639
|
+
};
|
|
10640
|
+
return {
|
|
10641
|
+
onAssistant(content) {
|
|
10642
|
+
for (const block of blocks(content))
|
|
10643
|
+
if (block.type === "tool_use") onToolUse(block);
|
|
10644
|
+
},
|
|
10645
|
+
onUser(content) {
|
|
10646
|
+
for (const block of blocks(content))
|
|
10647
|
+
if (searches.has(String(block.tool_use_id)))
|
|
10648
|
+
for (const id of searchResultThreadIds(block.content)) found.add(id);
|
|
10649
|
+
},
|
|
10650
|
+
current: () => ({ found: [...found], opened: [...opened] })
|
|
10651
|
+
};
|
|
10562
10652
|
}
|
|
10563
10653
|
|
|
10564
10654
|
// src/commands/review/parseTokenUsage.ts
|
|
@@ -10637,6 +10727,61 @@ function createScanUsageTracker() {
|
|
|
10637
10727
|
};
|
|
10638
10728
|
}
|
|
10639
10729
|
|
|
10730
|
+
// src/commands/inbox/describeInboxScanTool.ts
|
|
10731
|
+
function pick(input, keys) {
|
|
10732
|
+
return keys.map((key) => input[key]).filter(
|
|
10733
|
+
(value) => typeof value === "string" || typeof value === "number"
|
|
10734
|
+
).map(String);
|
|
10735
|
+
}
|
|
10736
|
+
function toolLabel(name) {
|
|
10737
|
+
const match = name.match(/^mcp__claude_ai_([^_]+)__(?:slack_)?(.+)$/);
|
|
10738
|
+
return match ? `${match[1]} ${match[2]}` : name;
|
|
10739
|
+
}
|
|
10740
|
+
function describeInboxScanTool(name, input) {
|
|
10741
|
+
const record = input && typeof input === "object" ? input : {};
|
|
10742
|
+
const detail = pick(record, [
|
|
10743
|
+
"query",
|
|
10744
|
+
"thread_id",
|
|
10745
|
+
"threadId",
|
|
10746
|
+
"channel_id",
|
|
10747
|
+
"message_ts"
|
|
10748
|
+
]).join(" ");
|
|
10749
|
+
return { label: toolLabel(name), detail };
|
|
10750
|
+
}
|
|
10751
|
+
|
|
10752
|
+
// src/commands/inbox/assistantScanEvents.ts
|
|
10753
|
+
var MAX_TEXT = 500;
|
|
10754
|
+
function truncate(text20) {
|
|
10755
|
+
const trimmed = text20.trim();
|
|
10756
|
+
return trimmed.length <= MAX_TEXT ? trimmed : `${trimmed.slice(0, MAX_TEXT - 1)}\u2026`;
|
|
10757
|
+
}
|
|
10758
|
+
function blockEvent(block) {
|
|
10759
|
+
if (block.type === "tool_use") {
|
|
10760
|
+
const name = typeof block.name === "string" ? block.name : "tool";
|
|
10761
|
+
return { kind: "tool", ...describeInboxScanTool(name, block.input) };
|
|
10762
|
+
}
|
|
10763
|
+
if (block.type === "text" && typeof block.text === "string" && block.text.trim())
|
|
10764
|
+
return { kind: "text", label: "Assistant", detail: truncate(block.text) };
|
|
10765
|
+
return void 0;
|
|
10766
|
+
}
|
|
10767
|
+
function assistantScanEvents(content) {
|
|
10768
|
+
if (!Array.isArray(content)) return [];
|
|
10769
|
+
const at2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
10770
|
+
return content.map(blockEvent).filter((event) => event !== void 0).map((event) => ({ at: at2, ...event }));
|
|
10771
|
+
}
|
|
10772
|
+
|
|
10773
|
+
// src/commands/inbox/handleAssistantTurn.ts
|
|
10774
|
+
function handleAssistantTurn(message3, usage, { onEvent = () => {
|
|
10775
|
+
}, onUsage = () => {
|
|
10776
|
+
} }) {
|
|
10777
|
+
const counted = usage.addTurn(message3?.id, message3?.usage);
|
|
10778
|
+
for (const scanEvent of assistantScanEvents(message3?.content)) {
|
|
10779
|
+
const tokens = usage.takeTurnTokens();
|
|
10780
|
+
onEvent(tokens === void 0 ? scanEvent : { ...scanEvent, tokens });
|
|
10781
|
+
}
|
|
10782
|
+
if (counted) onUsage(usage.current());
|
|
10783
|
+
}
|
|
10784
|
+
|
|
10640
10785
|
// src/commands/inbox/inboxScanSchema.ts
|
|
10641
10786
|
import { z as z12 } from "zod";
|
|
10642
10787
|
var flaggedMessageSchema = z12.object({
|
|
@@ -10669,31 +10814,23 @@ function parseScanStreamLine(line) {
|
|
|
10669
10814
|
}
|
|
10670
10815
|
|
|
10671
10816
|
// src/commands/inbox/createInboxScanParser.ts
|
|
10672
|
-
function createInboxScanParser({
|
|
10673
|
-
|
|
10674
|
-
},
|
|
10675
|
-
|
|
10676
|
-
},
|
|
10677
|
-
onModel = () => {
|
|
10678
|
-
}
|
|
10679
|
-
} = {}) {
|
|
10817
|
+
function createInboxScanParser(listener = {}) {
|
|
10818
|
+
const { onUsage = () => {
|
|
10819
|
+
}, onModel = () => {
|
|
10820
|
+
} } = listener;
|
|
10680
10821
|
const usage = createScanUsageTracker();
|
|
10822
|
+
const coverage2 = createGmailCoverage();
|
|
10681
10823
|
let resultLine;
|
|
10682
|
-
const onAssistant = (message3) => {
|
|
10683
|
-
const counted = usage.addTurn(message3?.id, message3?.usage);
|
|
10684
|
-
for (const scanEvent of assistantScanEvents(message3?.content)) {
|
|
10685
|
-
const tokens = usage.takeTurnTokens();
|
|
10686
|
-
onEvent(tokens === void 0 ? scanEvent : { ...scanEvent, tokens });
|
|
10687
|
-
}
|
|
10688
|
-
if (counted) onUsage(usage.current());
|
|
10689
|
-
};
|
|
10690
10824
|
return {
|
|
10691
10825
|
onLine(line) {
|
|
10692
10826
|
const event = parseScanStreamLine(line);
|
|
10693
10827
|
if (!event) return;
|
|
10694
10828
|
if (event.type === "system" && typeof event.model === "string")
|
|
10695
10829
|
onModel(event.model);
|
|
10696
|
-
else if (event.type === "assistant")
|
|
10830
|
+
else if (event.type === "assistant") {
|
|
10831
|
+
coverage2.onAssistant(event.message?.content);
|
|
10832
|
+
handleAssistantTurn(event.message, usage, listener);
|
|
10833
|
+
} else if (event.type === "user") coverage2.onUser(event.message?.content);
|
|
10697
10834
|
else if (event.type === "result") {
|
|
10698
10835
|
resultLine = line;
|
|
10699
10836
|
usage.finish(event);
|
|
@@ -10704,64 +10841,19 @@ function createInboxScanParser({
|
|
|
10704
10841
|
if (!resultLine) throw new Error(`Inbox scan failed: ${failure}`);
|
|
10705
10842
|
return {
|
|
10706
10843
|
messages: parseInboxScanOutput(resultLine),
|
|
10707
|
-
usage: usage.current()
|
|
10844
|
+
usage: usage.current(),
|
|
10845
|
+
threads: coverage2.current()
|
|
10708
10846
|
};
|
|
10709
10847
|
}
|
|
10710
10848
|
};
|
|
10711
10849
|
}
|
|
10712
10850
|
|
|
10713
|
-
// src/commands/inbox/inboxScanTools.ts
|
|
10714
|
-
var gmail = (tool) => `mcp__claude_ai_Gmail__${tool}`;
|
|
10715
|
-
var slack = (tool) => `mcp__claude_ai_Slack__${tool}`;
|
|
10716
|
-
var inboxScanTools = {
|
|
10717
|
-
allowed: [
|
|
10718
|
-
gmail("search_threads"),
|
|
10719
|
-
gmail("get_thread"),
|
|
10720
|
-
slack("slack_search_public_and_private"),
|
|
10721
|
-
slack("slack_read_thread")
|
|
10722
|
-
],
|
|
10723
|
-
denied: [
|
|
10724
|
-
...[
|
|
10725
|
-
"apply_sensitive_message_label",
|
|
10726
|
-
"apply_sensitive_thread_label",
|
|
10727
|
-
"create_draft",
|
|
10728
|
-
"create_label",
|
|
10729
|
-
"delete_draft",
|
|
10730
|
-
"delete_label",
|
|
10731
|
-
"forward",
|
|
10732
|
-
"label_message",
|
|
10733
|
-
"label_thread",
|
|
10734
|
-
"mark_message_spam",
|
|
10735
|
-
"mark_thread_spam",
|
|
10736
|
-
"reply",
|
|
10737
|
-
"send_message",
|
|
10738
|
-
"trash_message",
|
|
10739
|
-
"trash_thread",
|
|
10740
|
-
"unlabel_message",
|
|
10741
|
-
"unlabel_thread",
|
|
10742
|
-
"unmark_message_spam",
|
|
10743
|
-
"unmark_thread_spam",
|
|
10744
|
-
"untrash_message",
|
|
10745
|
-
"untrash_thread",
|
|
10746
|
-
"update_draft",
|
|
10747
|
-
"update_label",
|
|
10748
|
-
"update_message_labels"
|
|
10749
|
-
].map(gmail),
|
|
10750
|
-
...[
|
|
10751
|
-
"slack_add_reaction",
|
|
10752
|
-
"slack_create_canvas",
|
|
10753
|
-
"slack_create_conversation",
|
|
10754
|
-
"slack_schedule_message",
|
|
10755
|
-
"slack_send_message",
|
|
10756
|
-
"slack_send_message_draft",
|
|
10757
|
-
"slack_update_canvas"
|
|
10758
|
-
].map(slack)
|
|
10759
|
-
]
|
|
10760
|
-
};
|
|
10761
|
-
|
|
10762
10851
|
// src/commands/inbox/runInboxScanClaude.ts
|
|
10763
10852
|
var INBOX_SCAN_TIMEOUT_MS = 20 * 6e4;
|
|
10764
|
-
function buildInboxScanArgs(
|
|
10853
|
+
function buildInboxScanArgs({
|
|
10854
|
+
prompt,
|
|
10855
|
+
allowedTools
|
|
10856
|
+
}) {
|
|
10765
10857
|
return [
|
|
10766
10858
|
"-p",
|
|
10767
10859
|
"--tools",
|
|
@@ -10769,7 +10861,7 @@ function buildInboxScanArgs(since) {
|
|
|
10769
10861
|
"--permission-mode",
|
|
10770
10862
|
"dontAsk",
|
|
10771
10863
|
"--allowedTools",
|
|
10772
|
-
...
|
|
10864
|
+
...allowedTools,
|
|
10773
10865
|
"--disallowedTools",
|
|
10774
10866
|
...inboxScanTools.denied,
|
|
10775
10867
|
"--no-session-persistence",
|
|
@@ -10779,14 +10871,14 @@ function buildInboxScanArgs(since) {
|
|
|
10779
10871
|
"--json-schema",
|
|
10780
10872
|
JSON.stringify(z13.toJSONSchema(inboxScanSchema, { target: "draft-07" })),
|
|
10781
10873
|
"--",
|
|
10782
|
-
|
|
10874
|
+
prompt
|
|
10783
10875
|
];
|
|
10784
10876
|
}
|
|
10785
10877
|
function describeExit(code, signal) {
|
|
10786
10878
|
return signal ? `claude was killed (${signal})` : `claude exited ${code}`;
|
|
10787
10879
|
}
|
|
10788
|
-
async function runInboxScanClaude(
|
|
10789
|
-
const child = spawn2("claude", buildInboxScanArgs(
|
|
10880
|
+
async function runInboxScanClaude(pass, listener = {}) {
|
|
10881
|
+
const child = spawn2("claude", buildInboxScanArgs(pass), {
|
|
10790
10882
|
stdio: ["ignore", "pipe", "pipe"],
|
|
10791
10883
|
windowsHide: true,
|
|
10792
10884
|
timeout: INBOX_SCAN_TIMEOUT_MS
|
|
@@ -11369,7 +11461,7 @@ function deploymentsQuery(environments) {
|
|
|
11369
11461
|
}
|
|
11370
11462
|
|
|
11371
11463
|
// src/commands/sessions/web/releases/liveDeployments.ts
|
|
11372
|
-
function
|
|
11464
|
+
function headCommit4(node) {
|
|
11373
11465
|
return node?.oid ? releaseCommit(node.oid, node) : null;
|
|
11374
11466
|
}
|
|
11375
11467
|
function environmentNodes(repository, count10) {
|
|
@@ -11396,7 +11488,7 @@ async function liveDeployments(cwd, repo, environments) {
|
|
|
11396
11488
|
if (!repository) throw new Error(`Repository not readable: ${repo}`);
|
|
11397
11489
|
return {
|
|
11398
11490
|
defaultBranch: repository.defaultBranchRef?.name ?? null,
|
|
11399
|
-
head:
|
|
11491
|
+
head: headCommit4(repository.defaultBranchRef?.target),
|
|
11400
11492
|
...deploymentMaps(environmentNodes(repository, distinct.length))
|
|
11401
11493
|
};
|
|
11402
11494
|
}
|
|
@@ -11787,13 +11879,13 @@ function expandEnv(env) {
|
|
|
11787
11879
|
}
|
|
11788
11880
|
|
|
11789
11881
|
// src/commands/run/resolveCommand.ts
|
|
11790
|
-
import { execFileSync as
|
|
11882
|
+
import { execFileSync as execFileSync4 } from "child_process";
|
|
11791
11883
|
import { existsSync as existsSync22 } from "fs";
|
|
11792
11884
|
import { dirname as dirname11, join as join26, resolve as resolve10 } from "path";
|
|
11793
11885
|
function resolveCommand(command) {
|
|
11794
11886
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
11795
11887
|
try {
|
|
11796
|
-
const gitPath =
|
|
11888
|
+
const gitPath = execFileSync4("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
11797
11889
|
const gitRoot = resolve10(dirname11(gitPath), "..");
|
|
11798
11890
|
const gitBash = join26(gitRoot, "bin", "bash.exe");
|
|
11799
11891
|
if (existsSync22(gitBash)) return gitBash;
|
|
@@ -12359,14 +12451,14 @@ function coerceString(key, raw) {
|
|
|
12359
12451
|
|
|
12360
12452
|
// src/shared/configLeafSchema.ts
|
|
12361
12453
|
function configLeafSchema(schema2, key) {
|
|
12362
|
-
let
|
|
12454
|
+
let current2 = schema2;
|
|
12363
12455
|
for (const name of key.split(".")) {
|
|
12364
|
-
const { inner } = unwrapSchemaNode(
|
|
12456
|
+
const { inner } = unwrapSchemaNode(current2);
|
|
12365
12457
|
const child = inner.def?.type === "object" ? inner.def.shape?.[name] : void 0;
|
|
12366
12458
|
if (!child) return void 0;
|
|
12367
|
-
|
|
12459
|
+
current2 = child;
|
|
12368
12460
|
}
|
|
12369
|
-
return
|
|
12461
|
+
return current2;
|
|
12370
12462
|
}
|
|
12371
12463
|
|
|
12372
12464
|
// src/commands/config/coerceStructuredConfigValue.ts
|
|
@@ -12496,17 +12588,17 @@ function coerceUnion(key, raw, types) {
|
|
|
12496
12588
|
|
|
12497
12589
|
// src/shared/valueAtConfigPath.ts
|
|
12498
12590
|
function valueAtConfigPath(value, path109) {
|
|
12499
|
-
let
|
|
12591
|
+
let current2 = value;
|
|
12500
12592
|
for (const key of path109) {
|
|
12501
12593
|
if (typeof key === "number") {
|
|
12502
|
-
if (!Array.isArray(
|
|
12503
|
-
|
|
12594
|
+
if (!Array.isArray(current2)) return void 0;
|
|
12595
|
+
current2 = current2[key];
|
|
12504
12596
|
continue;
|
|
12505
12597
|
}
|
|
12506
|
-
if (typeof
|
|
12507
|
-
|
|
12598
|
+
if (typeof current2 !== "object" || current2 === null) return void 0;
|
|
12599
|
+
current2 = current2[key];
|
|
12508
12600
|
}
|
|
12509
|
-
return
|
|
12601
|
+
return current2;
|
|
12510
12602
|
}
|
|
12511
12603
|
|
|
12512
12604
|
// src/shared/restoreConfigSecrets.ts
|
|
@@ -12715,9 +12807,9 @@ async function applyUserConfigSet(key, coerced) {
|
|
|
12715
12807
|
const nodeOnly = userDbKeyError(key, "Set");
|
|
12716
12808
|
if (nodeOnly) return nodeOnly;
|
|
12717
12809
|
const orm = await getDb();
|
|
12718
|
-
const outcome = await updateUserConfig(orm, (
|
|
12719
|
-
const value = typeof coerced === "function" ? coerced(getNestedValue(
|
|
12720
|
-
const config = setNestedValue(
|
|
12810
|
+
const outcome = await updateUserConfig(orm, (current2) => {
|
|
12811
|
+
const value = typeof coerced === "function" ? coerced(getNestedValue(current2, key)) : coerced;
|
|
12812
|
+
const config = setNestedValue(current2, key, value);
|
|
12721
12813
|
const validation = validateConfig(config, key);
|
|
12722
12814
|
return validation.ok ? { ok: true, config, result: void 0 } : validation;
|
|
12723
12815
|
});
|
|
@@ -12943,9 +13035,9 @@ async function applyUserConfigUnset(key) {
|
|
|
12943
13035
|
const nodeOnly = userDbKeyError(key, "Unset");
|
|
12944
13036
|
if (nodeOnly) return nodeOnly;
|
|
12945
13037
|
const orm = await getDb();
|
|
12946
|
-
const outcome = await updateUserConfig(orm, (
|
|
12947
|
-
const { config, removed } = unsetNestedValue(
|
|
12948
|
-
if (!removed) return { ok: true, config:
|
|
13038
|
+
const outcome = await updateUserConfig(orm, (current2) => {
|
|
13039
|
+
const { config, removed } = unsetNestedValue(current2, key);
|
|
13040
|
+
if (!removed) return { ok: true, config: current2, result: false };
|
|
12949
13041
|
const validation = validateConfig(config, key);
|
|
12950
13042
|
return validation.ok ? { ok: true, config, result: true } : validation;
|
|
12951
13043
|
});
|
|
@@ -13020,6 +13112,15 @@ function autoRestartEnabled(installDir) {
|
|
|
13020
13112
|
}
|
|
13021
13113
|
}
|
|
13022
13114
|
|
|
13115
|
+
// src/commands/sessions/web/updates/autoRestart/autoRestartWait.ts
|
|
13116
|
+
var current;
|
|
13117
|
+
var autoRestartWait = {
|
|
13118
|
+
get: () => current,
|
|
13119
|
+
set: (wait2) => {
|
|
13120
|
+
current = wait2;
|
|
13121
|
+
}
|
|
13122
|
+
};
|
|
13123
|
+
|
|
13023
13124
|
// src/commands/extension/fetchLatestSignedExtension.ts
|
|
13024
13125
|
import { readFile as readFile2 } from "fs/promises";
|
|
13025
13126
|
import { join as join28 } from "path";
|
|
@@ -13075,49 +13176,6 @@ import { existsSync as existsSync26 } from "fs";
|
|
|
13075
13176
|
|
|
13076
13177
|
// src/commands/watch/gitMarkerPath.ts
|
|
13077
13178
|
import { resolve as resolve11 } from "path";
|
|
13078
|
-
|
|
13079
|
-
// src/commands/watch/resolveUpstream.ts
|
|
13080
|
-
import { execFileSync as execFileSync4 } from "child_process";
|
|
13081
|
-
function runGit3(args, cwd) {
|
|
13082
|
-
return execFileSync4("git", args, {
|
|
13083
|
-
encoding: "utf8",
|
|
13084
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
13085
|
-
cwd,
|
|
13086
|
-
windowsHide: true
|
|
13087
|
-
}).trim();
|
|
13088
|
-
}
|
|
13089
|
-
function resolveUpstream(cwd) {
|
|
13090
|
-
try {
|
|
13091
|
-
runGit3(["rev-parse", "--is-inside-work-tree"], cwd);
|
|
13092
|
-
} catch {
|
|
13093
|
-
throw new Error(
|
|
13094
|
-
"not a git repository \u2014 run assist watch wait from inside a repo"
|
|
13095
|
-
);
|
|
13096
|
-
}
|
|
13097
|
-
let branch2;
|
|
13098
|
-
try {
|
|
13099
|
-
branch2 = runGit3(["symbolic-ref", "--quiet", "--short", "HEAD"], cwd);
|
|
13100
|
-
} catch {
|
|
13101
|
-
throw new Error(
|
|
13102
|
-
"HEAD is detached \u2014 check out a branch before waiting on its upstream"
|
|
13103
|
-
);
|
|
13104
|
-
}
|
|
13105
|
-
try {
|
|
13106
|
-
return {
|
|
13107
|
-
branch: branch2,
|
|
13108
|
-
upstream: runGit3(
|
|
13109
|
-
["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
|
|
13110
|
-
cwd
|
|
13111
|
-
)
|
|
13112
|
-
};
|
|
13113
|
-
} catch {
|
|
13114
|
-
throw new Error(
|
|
13115
|
-
`branch "${branch2}" has no upstream \u2014 set one with: git push -u origin ${branch2}`
|
|
13116
|
-
);
|
|
13117
|
-
}
|
|
13118
|
-
}
|
|
13119
|
-
|
|
13120
|
-
// src/commands/watch/gitMarkerPath.ts
|
|
13121
13179
|
function gitMarkerPath(name, cwd) {
|
|
13122
13180
|
return resolve11(
|
|
13123
13181
|
cwd ?? process.cwd(),
|
|
@@ -13269,24 +13327,6 @@ function pendingRestarts(input) {
|
|
|
13269
13327
|
];
|
|
13270
13328
|
}
|
|
13271
13329
|
|
|
13272
|
-
// src/commands/watch/headCommit.ts
|
|
13273
|
-
function headCommit4(cwd) {
|
|
13274
|
-
try {
|
|
13275
|
-
return runGit3(["rev-parse", "HEAD"], cwd);
|
|
13276
|
-
} catch {
|
|
13277
|
-
return void 0;
|
|
13278
|
-
}
|
|
13279
|
-
}
|
|
13280
|
-
|
|
13281
|
-
// src/commands/sessions/web/updates/webStartCommit.ts
|
|
13282
|
-
var captured;
|
|
13283
|
-
var webStartCommit = {
|
|
13284
|
-
capture: () => {
|
|
13285
|
-
captured = headCommit4(getInstallDir());
|
|
13286
|
-
},
|
|
13287
|
-
value: () => captured
|
|
13288
|
-
};
|
|
13289
|
-
|
|
13290
13330
|
// src/commands/sessions/web/updates/readRestartState.ts
|
|
13291
13331
|
async function readRestartState(installDir) {
|
|
13292
13332
|
const reply2 = await requestDaemonReply(
|
|
@@ -13361,6 +13401,7 @@ async function updates(_req, res) {
|
|
|
13361
13401
|
buildPending,
|
|
13362
13402
|
restart,
|
|
13363
13403
|
autoRestart: autoRestartEnabled(installDir),
|
|
13404
|
+
autoRestartWait: autoRestartWait.get(),
|
|
13364
13405
|
daemonReachable: reply2 !== void 0,
|
|
13365
13406
|
loop: reply2?.loop ?? {
|
|
13366
13407
|
phase: "off",
|
|
@@ -13408,8 +13449,8 @@ async function readRequestBuffer(req, limit) {
|
|
|
13408
13449
|
const chunks = [];
|
|
13409
13450
|
let size = 0;
|
|
13410
13451
|
let overLimit = false;
|
|
13411
|
-
for await (const
|
|
13412
|
-
const buf = Buffer.isBuffer(
|
|
13452
|
+
for await (const chunk2 of req) {
|
|
13453
|
+
const buf = Buffer.isBuffer(chunk2) ? chunk2 : Buffer.from(chunk2);
|
|
13413
13454
|
size += buf.length;
|
|
13414
13455
|
if (overLimit) continue;
|
|
13415
13456
|
if (size > limit) {
|
|
@@ -13828,9 +13869,9 @@ function parseMenuKey(data, toggleKey) {
|
|
|
13828
13869
|
// src/commands/sessions/web/restartMenu/createKeyHandler.ts
|
|
13829
13870
|
function createKeyHandler(deps2) {
|
|
13830
13871
|
const { menu, toggleKey, isBusy: isBusy2, activate, quit } = deps2;
|
|
13831
|
-
return (
|
|
13872
|
+
return (chunk2) => {
|
|
13832
13873
|
if (isBusy2()) return;
|
|
13833
|
-
const { key, digit } = parseMenuKey(
|
|
13874
|
+
const { key, digit } = parseMenuKey(chunk2, toggleKey);
|
|
13834
13875
|
if (key === "quit") return quit();
|
|
13835
13876
|
if (key === "toggle") {
|
|
13836
13877
|
if (menu.isOpen()) menu.close();
|
|
@@ -13847,21 +13888,21 @@ function createKeyHandler(deps2) {
|
|
|
13847
13888
|
}
|
|
13848
13889
|
|
|
13849
13890
|
// src/commands/sessions/web/restartMenu/nextIndex.ts
|
|
13850
|
-
function nextIndex(
|
|
13851
|
-
const n =
|
|
13852
|
-
if (n === 0) return
|
|
13853
|
-
return (
|
|
13891
|
+
function nextIndex(items3, current2, direction) {
|
|
13892
|
+
const n = items3.length;
|
|
13893
|
+
if (n === 0) return current2;
|
|
13894
|
+
return (current2 + direction + n) % n;
|
|
13854
13895
|
}
|
|
13855
|
-
function firstEnabledIndex(
|
|
13856
|
-
const idx =
|
|
13896
|
+
function firstEnabledIndex(items3) {
|
|
13897
|
+
const idx = items3.findIndex((item) => !item.disabled);
|
|
13857
13898
|
return idx === -1 ? 0 : idx;
|
|
13858
13899
|
}
|
|
13859
13900
|
|
|
13860
13901
|
// src/commands/sessions/web/restartMenu/renderRestartMenu.ts
|
|
13861
13902
|
import chalk13 from "chalk";
|
|
13862
|
-
function renderRestartMenu(
|
|
13903
|
+
function renderRestartMenu(items3, selected) {
|
|
13863
13904
|
const lines2 = [chalk13.bold.cyan("assist \u2014 restart menu")];
|
|
13864
|
-
|
|
13905
|
+
items3.forEach((item, i) => {
|
|
13865
13906
|
const active = i === selected;
|
|
13866
13907
|
const pointer = active ? chalk13.cyan("\u276F ") : " ";
|
|
13867
13908
|
const number = chalk13.dim(`${i + 1}. `);
|
|
@@ -13876,15 +13917,15 @@ function renderRestartMenu(items2, selected) {
|
|
|
13876
13917
|
}
|
|
13877
13918
|
|
|
13878
13919
|
// src/commands/sessions/web/restartMenu/createMenuState.ts
|
|
13879
|
-
function createMenuState(
|
|
13920
|
+
function createMenuState(items3, log2) {
|
|
13880
13921
|
let open = false;
|
|
13881
|
-
let selected = firstEnabledIndex(
|
|
13882
|
-
const render2 = () => log2(renderRestartMenu(
|
|
13922
|
+
let selected = firstEnabledIndex(items3);
|
|
13923
|
+
const render2 = () => log2(renderRestartMenu(items3, selected));
|
|
13883
13924
|
return {
|
|
13884
13925
|
isOpen: () => open,
|
|
13885
13926
|
open() {
|
|
13886
13927
|
open = true;
|
|
13887
|
-
selected = firstEnabledIndex(
|
|
13928
|
+
selected = firstEnabledIndex(items3);
|
|
13888
13929
|
render2();
|
|
13889
13930
|
},
|
|
13890
13931
|
close() {
|
|
@@ -13893,12 +13934,12 @@ function createMenuState(items2, log2) {
|
|
|
13893
13934
|
log2.clear();
|
|
13894
13935
|
},
|
|
13895
13936
|
move(direction) {
|
|
13896
|
-
selected = nextIndex(
|
|
13937
|
+
selected = nextIndex(items3, selected, direction);
|
|
13897
13938
|
render2();
|
|
13898
13939
|
},
|
|
13899
|
-
selectedItem: () =>
|
|
13940
|
+
selectedItem: () => items3[selected],
|
|
13900
13941
|
jumpTo(index3) {
|
|
13901
|
-
const item =
|
|
13942
|
+
const item = items3[index3];
|
|
13902
13943
|
if (!item) return false;
|
|
13903
13944
|
selected = index3;
|
|
13904
13945
|
render2();
|
|
@@ -13944,11 +13985,11 @@ function resolveOptions(options2) {
|
|
|
13944
13985
|
|
|
13945
13986
|
// src/commands/sessions/web/restartMenu/installRestartMenu.ts
|
|
13946
13987
|
function installRestartMenu(options2 = {}) {
|
|
13947
|
-
const { stdin, out, toggleKey, exit, restartDaemonFn, reExecFn, items:
|
|
13988
|
+
const { stdin, out, toggleKey, exit, restartDaemonFn, reExecFn, items: items3 } = resolveOptions(options2);
|
|
13948
13989
|
if (!stdin.isTTY) return () => {
|
|
13949
13990
|
};
|
|
13950
13991
|
const log2 = createLogUpdate(out);
|
|
13951
|
-
const menu = createMenuState(
|
|
13992
|
+
const menu = createMenuState(items3, log2);
|
|
13952
13993
|
const reExec = () => reExecFn({ beforeExec: () => cleanup(), exit });
|
|
13953
13994
|
const { isBusy: isBusy2, activate } = createActivate(menu, {
|
|
13954
13995
|
runRestartDaemon: restartDaemonFn,
|
|
@@ -14057,6 +14098,11 @@ async function attemptAutoRestart(deps2, target, built) {
|
|
|
14057
14098
|
}
|
|
14058
14099
|
}
|
|
14059
14100
|
|
|
14101
|
+
// src/commands/sessions/web/updates/autoRestart/autoRestartTarget.ts
|
|
14102
|
+
function autoRestartTarget(restart) {
|
|
14103
|
+
return restart.length > 1 ? "both" : restart[0];
|
|
14104
|
+
}
|
|
14105
|
+
|
|
14060
14106
|
// src/commands/sessions/web/updates/autoRestart/autoRestartBlocker.ts
|
|
14061
14107
|
function isBusy(session) {
|
|
14062
14108
|
if (session.node !== void 0 || session.commandType === "run") return false;
|
|
@@ -14075,45 +14121,62 @@ function autoRestartBlocker(input) {
|
|
|
14075
14121
|
return void 0;
|
|
14076
14122
|
}
|
|
14077
14123
|
|
|
14078
|
-
// src/commands/sessions/web/updates/autoRestart/
|
|
14079
|
-
function
|
|
14080
|
-
|
|
14124
|
+
// src/commands/sessions/web/updates/autoRestart/blockedBy.ts
|
|
14125
|
+
function blockedBy(snap, attempted2) {
|
|
14126
|
+
if (attempted2 === snap.built) return "already attempted";
|
|
14127
|
+
return autoRestartBlocker(snap);
|
|
14128
|
+
}
|
|
14129
|
+
|
|
14130
|
+
// src/commands/sessions/web/updates/autoRestart/createAutoRestartNotes.ts
|
|
14131
|
+
function createAutoRestartNotes(deps2) {
|
|
14132
|
+
const report = deps2.report ?? (() => {
|
|
14133
|
+
});
|
|
14134
|
+
let idleSince;
|
|
14135
|
+
let lastNote;
|
|
14136
|
+
return {
|
|
14137
|
+
idleSince: () => idleSince,
|
|
14138
|
+
settling: (at2) => {
|
|
14139
|
+
idleSince = at2;
|
|
14140
|
+
},
|
|
14141
|
+
note: (message3, wait2) => {
|
|
14142
|
+
if (message3 !== void 0 && message3 !== lastNote)
|
|
14143
|
+
deps2.log(`auto-restart: ${message3}`);
|
|
14144
|
+
lastNote = message3;
|
|
14145
|
+
idleSince = void 0;
|
|
14146
|
+
report(wait2);
|
|
14147
|
+
}
|
|
14148
|
+
};
|
|
14081
14149
|
}
|
|
14082
14150
|
|
|
14083
14151
|
// src/commands/sessions/web/updates/autoRestart/createAutoRestartCheck.ts
|
|
14084
14152
|
var AUTO_RESTART_SETTLE_MS = 6e4;
|
|
14085
|
-
function skipReason(snap, attempted2) {
|
|
14086
|
-
if (attempted2 === snap.built) return `: already attempted for v${snap.built}`;
|
|
14087
|
-
const blocker = autoRestartBlocker(snap);
|
|
14088
|
-
return blocker && ` for v${snap.built}: ${blocker}`;
|
|
14089
|
-
}
|
|
14090
14153
|
function createAutoRestartCheck(deps2) {
|
|
14091
14154
|
const now = deps2.now ?? Date.now;
|
|
14092
|
-
|
|
14093
|
-
|
|
14094
|
-
const note = (message3) => {
|
|
14095
|
-
if (message3 !== void 0 && message3 !== lastNote)
|
|
14096
|
-
deps2.log(`auto-restart: ${message3}`);
|
|
14097
|
-
lastNote = message3;
|
|
14098
|
-
idleSince = void 0;
|
|
14099
|
-
};
|
|
14155
|
+
const notes = createAutoRestartNotes(deps2);
|
|
14156
|
+
const { note } = notes;
|
|
14100
14157
|
return async function tick() {
|
|
14101
14158
|
if (!deps2.enabled()) return note(void 0);
|
|
14102
14159
|
const snap = await deps2.snapshot();
|
|
14103
14160
|
if (snap.restart.length === 0) return note(void 0);
|
|
14104
14161
|
const target = autoRestartTarget(snap.restart);
|
|
14105
|
-
const
|
|
14106
|
-
if (
|
|
14162
|
+
const blocker = blockedBy(snap, deps2.attempted.get());
|
|
14163
|
+
if (blocker)
|
|
14164
|
+
return note(
|
|
14165
|
+
`skipped ${target} restart for v${snap.built}: ${blocker}`,
|
|
14166
|
+
blocker
|
|
14167
|
+
);
|
|
14107
14168
|
const at2 = now();
|
|
14169
|
+
const idleSince = notes.idleSince();
|
|
14108
14170
|
if (idleSince === void 0) {
|
|
14109
14171
|
note(
|
|
14110
|
-
`${target} restart for v${snap.built} ready; restarting once idle for ${AUTO_RESTART_SETTLE_MS / 1e3}s
|
|
14172
|
+
`${target} restart for v${snap.built} ready; restarting once idle for ${AUTO_RESTART_SETTLE_MS / 1e3}s`,
|
|
14173
|
+
`idle \xB7 restarting within ${AUTO_RESTART_SETTLE_MS / 1e3}s`
|
|
14111
14174
|
);
|
|
14112
|
-
|
|
14175
|
+
notes.settling(at2);
|
|
14113
14176
|
return;
|
|
14114
14177
|
}
|
|
14115
14178
|
if (at2 - idleSince < AUTO_RESTART_SETTLE_MS) return;
|
|
14116
|
-
note(void 0);
|
|
14179
|
+
note(void 0, "restarting");
|
|
14117
14180
|
await attemptAutoRestart(deps2, target, snap.built);
|
|
14118
14181
|
};
|
|
14119
14182
|
}
|
|
@@ -14154,7 +14217,8 @@ function startAutoRestart(port) {
|
|
|
14154
14217
|
snapshot: () => snapshot(installDir),
|
|
14155
14218
|
attempted: autoRestartAttempts(port),
|
|
14156
14219
|
restart: (target) => performRestart(target),
|
|
14157
|
-
log: (message3) => void logViaDaemon(message3)
|
|
14220
|
+
log: (message3) => void logViaDaemon(message3),
|
|
14221
|
+
report: autoRestartWait.set
|
|
14158
14222
|
});
|
|
14159
14223
|
let running3 = false;
|
|
14160
14224
|
setInterval(() => {
|
|
@@ -14326,10 +14390,10 @@ function resolveRepoGroup(cwd) {
|
|
|
14326
14390
|
};
|
|
14327
14391
|
const reaped = worktreeAttributionIncludingReaped(cwd);
|
|
14328
14392
|
if (!reaped) return { group: void 0, stable: repoDirExists(cwd) };
|
|
14329
|
-
const
|
|
14393
|
+
const current2 = currentOriginOfClone(reaped.clone);
|
|
14330
14394
|
return {
|
|
14331
|
-
group: hostedGroup(
|
|
14332
|
-
stable:
|
|
14395
|
+
group: hostedGroup(current2?.origin ?? reaped.origin, reaped.clone),
|
|
14396
|
+
stable: current2?.stable === true
|
|
14333
14397
|
};
|
|
14334
14398
|
}
|
|
14335
14399
|
function currentOriginOfClone(clone) {
|
|
@@ -16065,11 +16129,11 @@ import { existsSync as existsSync39 } from "fs";
|
|
|
16065
16129
|
import { dirname as dirname26, join as join45 } from "path";
|
|
16066
16130
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
16067
16131
|
function adviceDir() {
|
|
16068
|
-
let
|
|
16069
|
-
while (
|
|
16070
|
-
const candidate = join45(
|
|
16132
|
+
let current2 = dirname26(fileURLToPath5(import.meta.url));
|
|
16133
|
+
while (current2 !== dirname26(current2)) {
|
|
16134
|
+
const candidate = join45(current2, "claude", "advice");
|
|
16071
16135
|
if (existsSync39(candidate)) return candidate;
|
|
16072
|
-
|
|
16136
|
+
current2 = dirname26(current2);
|
|
16073
16137
|
}
|
|
16074
16138
|
throw new Error("Could not locate the shipped claude/advice directory");
|
|
16075
16139
|
}
|
|
@@ -16319,8 +16383,8 @@ import { randomUUID as randomUUID3 } from "crypto";
|
|
|
16319
16383
|
// src/commands/backlog/import/readStdinBuffer.ts
|
|
16320
16384
|
async function readStdinBuffer() {
|
|
16321
16385
|
const chunks = [];
|
|
16322
|
-
for await (const
|
|
16323
|
-
chunks.push(Buffer.isBuffer(
|
|
16386
|
+
for await (const chunk2 of process.stdin) {
|
|
16387
|
+
chunks.push(Buffer.isBuffer(chunk2) ? chunk2 : Buffer.from(chunk2));
|
|
16324
16388
|
}
|
|
16325
16389
|
return Buffer.concat(chunks);
|
|
16326
16390
|
}
|
|
@@ -17231,13 +17295,13 @@ function scheduleStatus() {
|
|
|
17231
17295
|
console.error(`assist backup runs every ${block.every} (${block.cron}).`);
|
|
17232
17296
|
}
|
|
17233
17297
|
function scheduleRemove() {
|
|
17234
|
-
const
|
|
17235
|
-
if (!readScheduleBlock(
|
|
17298
|
+
const current2 = readCrontab();
|
|
17299
|
+
if (!readScheduleBlock(current2)) {
|
|
17236
17300
|
console.error("No assist backup schedule is set; nothing to remove.");
|
|
17237
17301
|
return;
|
|
17238
17302
|
}
|
|
17239
17303
|
try {
|
|
17240
|
-
writeCrontab(removeScheduleBlock(
|
|
17304
|
+
writeCrontab(removeScheduleBlock(current2));
|
|
17241
17305
|
} catch (error) {
|
|
17242
17306
|
fail2(error.message);
|
|
17243
17307
|
}
|
|
@@ -17276,8 +17340,8 @@ async function copyTableOut(client, table) {
|
|
|
17276
17340
|
const sql33 = `COPY ${table.name} (${table.columns.join(", ")}) TO STDOUT`;
|
|
17277
17341
|
const stream = client.query(copyTo(sql33));
|
|
17278
17342
|
const chunks = [];
|
|
17279
|
-
for await (const
|
|
17280
|
-
chunks.push(Buffer.isBuffer(
|
|
17343
|
+
for await (const chunk2 of stream) {
|
|
17344
|
+
chunks.push(Buffer.isBuffer(chunk2) ? chunk2 : Buffer.from(chunk2));
|
|
17281
17345
|
}
|
|
17282
17346
|
return Buffer.concat(chunks);
|
|
17283
17347
|
}
|
|
@@ -18141,9 +18205,9 @@ async function countRows(client, table) {
|
|
|
18141
18205
|
);
|
|
18142
18206
|
return rows[0].n;
|
|
18143
18207
|
}
|
|
18144
|
-
function printSummary(tables,
|
|
18208
|
+
function printSummary(tables, current2, incoming) {
|
|
18145
18209
|
const lines2 = tables.map(
|
|
18146
|
-
(t, i) => ` ${t.name}: ${
|
|
18210
|
+
(t, i) => ` ${t.name}: ${current2[i]} \u2192 ${incoming[i]} rows`
|
|
18147
18211
|
);
|
|
18148
18212
|
console.error(chalk53.bold("\nThis will REPLACE all backlog data:"));
|
|
18149
18213
|
console.error(`${lines2.join("\n")}
|
|
@@ -18155,10 +18219,10 @@ async function confirmReplace(client, tables, incoming, fromStdin) {
|
|
|
18155
18219
|
"Reading a dump from stdin requires --yes (stdin is consumed by the dump)."
|
|
18156
18220
|
);
|
|
18157
18221
|
}
|
|
18158
|
-
const
|
|
18222
|
+
const current2 = await Promise.all(
|
|
18159
18223
|
tables.map((t) => countRows(client, t.name))
|
|
18160
18224
|
);
|
|
18161
|
-
printSummary(tables,
|
|
18225
|
+
printSummary(tables, current2, incoming);
|
|
18162
18226
|
return promptConfirm("Replace all backlog data with this dump?", false);
|
|
18163
18227
|
}
|
|
18164
18228
|
|
|
@@ -18505,17 +18569,17 @@ function phaseLabel(item) {
|
|
|
18505
18569
|
` (phase ${item.currentPhase ?? 1}/${authoredPhases(item.plan).length})`
|
|
18506
18570
|
);
|
|
18507
18571
|
}
|
|
18508
|
-
function isBlocked(item,
|
|
18572
|
+
function isBlocked(item, items3) {
|
|
18509
18573
|
const deps2 = (item.links ?? []).filter((l) => l.type === "depends-on");
|
|
18510
18574
|
return deps2.some((dep) => {
|
|
18511
|
-
const target =
|
|
18575
|
+
const target = items3.find((i) => i.id === dep.targetId);
|
|
18512
18576
|
return target !== void 0 && target.status !== "done";
|
|
18513
18577
|
});
|
|
18514
18578
|
}
|
|
18515
|
-
function dependencyLabel(item,
|
|
18579
|
+
function dependencyLabel(item, items3) {
|
|
18516
18580
|
const deps2 = (item.links ?? []).filter((l) => l.type === "depends-on");
|
|
18517
18581
|
if (deps2.length === 0) return "";
|
|
18518
|
-
if (isBlocked(item,
|
|
18582
|
+
if (isBlocked(item, items3)) return chalk59.red(" [blocked]");
|
|
18519
18583
|
return chalk59.dim(` [${deps2.length} dep${deps2.length > 1 ? "s" : ""}]`);
|
|
18520
18584
|
}
|
|
18521
18585
|
function printVerboseDetails(item) {
|
|
@@ -18532,30 +18596,30 @@ function printVerboseDetails(item) {
|
|
|
18532
18596
|
}
|
|
18533
18597
|
|
|
18534
18598
|
// src/commands/backlog/list.ts
|
|
18535
|
-
function filterItems(
|
|
18536
|
-
if (options2.status) return
|
|
18599
|
+
function filterItems(items3, options2) {
|
|
18600
|
+
if (options2.status) return items3.filter((i) => i.status === options2.status);
|
|
18537
18601
|
if (!options2.all)
|
|
18538
|
-
return
|
|
18539
|
-
return
|
|
18602
|
+
return items3.filter((i) => i.status !== "done" && i.status !== "wontdo");
|
|
18603
|
+
return items3;
|
|
18540
18604
|
}
|
|
18541
|
-
function repoPrefixer(
|
|
18605
|
+
function repoPrefixer(items3, allRepos) {
|
|
18542
18606
|
if (!allRepos) return () => "";
|
|
18543
18607
|
const labels = originDisplayLabels(
|
|
18544
|
-
|
|
18608
|
+
items3.flatMap((i) => i.origin ? [i.origin] : [])
|
|
18545
18609
|
);
|
|
18546
18610
|
const repoNameOf = (item) => item.origin ? labels.get(item.origin) ?? "" : "";
|
|
18547
|
-
const width2 = Math.max(0, ...
|
|
18611
|
+
const width2 = Math.max(0, ...items3.map((i) => repoNameOf(i).length));
|
|
18548
18612
|
return (item) => `${chalk60.dim(repoNameOf(item).padEnd(width2))} `;
|
|
18549
18613
|
}
|
|
18550
18614
|
async function list(options2) {
|
|
18551
18615
|
const allItems = await loadBacklog(options2.allRepos);
|
|
18552
|
-
const
|
|
18553
|
-
if (
|
|
18616
|
+
const items3 = filterItems(allItems, options2);
|
|
18617
|
+
if (items3.length === 0) {
|
|
18554
18618
|
console.log(chalk60.dim("Backlog is empty."));
|
|
18555
18619
|
return;
|
|
18556
18620
|
}
|
|
18557
|
-
const prefixOf = repoPrefixer(
|
|
18558
|
-
for (const item of
|
|
18621
|
+
const prefixOf = repoPrefixer(items3, !!options2.allRepos);
|
|
18622
|
+
for (const item of items3) {
|
|
18559
18623
|
console.log(
|
|
18560
18624
|
`${prefixOf(item)}${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk60.dim(formatItemId(item.id))} ${starMarker(item)}${item.name}${phaseLabel(item)}${dependencyLabel(item, allItems)}`
|
|
18561
18625
|
);
|
|
@@ -18925,11 +18989,11 @@ function hasCycle(adjacency, fromId, toId) {
|
|
|
18925
18989
|
const visited = /* @__PURE__ */ new Set();
|
|
18926
18990
|
const stack = [toId];
|
|
18927
18991
|
while (stack.length > 0) {
|
|
18928
|
-
const
|
|
18929
|
-
if (
|
|
18930
|
-
if (visited.has(
|
|
18931
|
-
visited.add(
|
|
18932
|
-
for (const target of adjacency.get(
|
|
18992
|
+
const current2 = stack.pop();
|
|
18993
|
+
if (current2 === fromId) return true;
|
|
18994
|
+
if (visited.has(current2)) continue;
|
|
18995
|
+
visited.add(current2);
|
|
18996
|
+
for (const target of adjacency.get(current2) ?? []) {
|
|
18933
18997
|
stack.push(target);
|
|
18934
18998
|
}
|
|
18935
18999
|
}
|
|
@@ -19387,21 +19451,21 @@ function releaseLock(itemId2) {
|
|
|
19387
19451
|
}
|
|
19388
19452
|
|
|
19389
19453
|
// src/commands/backlog/findResumable.ts
|
|
19390
|
-
function findResumable(
|
|
19391
|
-
return
|
|
19392
|
-
(i) => i.status === "in-progress" && i.plan && !isLockedByOther(i.id) && !isBlocked(i,
|
|
19454
|
+
function findResumable(items3) {
|
|
19455
|
+
return items3.find(
|
|
19456
|
+
(i) => i.status === "in-progress" && i.plan && !isLockedByOther(i.id) && !isBlocked(i, items3)
|
|
19393
19457
|
);
|
|
19394
19458
|
}
|
|
19395
19459
|
|
|
19396
19460
|
// src/commands/backlog/findUnblockedTodos.ts
|
|
19397
19461
|
import chalk72 from "chalk";
|
|
19398
|
-
function findUnblockedTodos(
|
|
19399
|
-
const todo =
|
|
19462
|
+
function findUnblockedTodos(items3) {
|
|
19463
|
+
const todo = items3.filter((i) => i.status === "todo");
|
|
19400
19464
|
if (todo.length === 0) {
|
|
19401
19465
|
console.log(chalk72.green("All backlog items complete."));
|
|
19402
19466
|
return void 0;
|
|
19403
19467
|
}
|
|
19404
|
-
const unblocked = todo.filter((i) => !isBlocked(i,
|
|
19468
|
+
const unblocked = todo.filter((i) => !isBlocked(i, items3));
|
|
19405
19469
|
if (unblocked.length === 0) {
|
|
19406
19470
|
console.log(
|
|
19407
19471
|
chalk72.yellow("All remaining todo items are blocked by dependencies.")
|
|
@@ -20634,23 +20698,23 @@ function logProgress({ plan: plan2, startPhase, item }) {
|
|
|
20634
20698
|
}
|
|
20635
20699
|
|
|
20636
20700
|
// src/commands/backlog/next.ts
|
|
20637
|
-
function toChoice(item,
|
|
20701
|
+
function toChoice(item, items3) {
|
|
20638
20702
|
const name = `${typeLabel(item.type)} ${formatItemId(item.id)}: ${item.name}`;
|
|
20639
|
-
return isBlocked(item,
|
|
20703
|
+
return isBlocked(item, items3) ? { name, disabled: chalk81.red("[blocked]") } : { name };
|
|
20640
20704
|
}
|
|
20641
|
-
async function selectItem(todo,
|
|
20705
|
+
async function selectItem(todo, items3) {
|
|
20642
20706
|
const { selected } = await exitOnCancel(
|
|
20643
20707
|
enquirer6.prompt({
|
|
20644
20708
|
type: "select",
|
|
20645
20709
|
name: "selected",
|
|
20646
20710
|
message: "Choose a backlog item to start:",
|
|
20647
|
-
choices: todo.map((i) => toChoice(i,
|
|
20711
|
+
choices: todo.map((i) => toChoice(i, items3))
|
|
20648
20712
|
})
|
|
20649
20713
|
);
|
|
20650
20714
|
return selected.match(/(a\d+):/)?.[1] ?? "";
|
|
20651
20715
|
}
|
|
20652
|
-
function pickResumable(
|
|
20653
|
-
const resumable = findResumable(
|
|
20716
|
+
function pickResumable(items3) {
|
|
20717
|
+
const resumable = findResumable(items3);
|
|
20654
20718
|
if (!resumable) return void 0;
|
|
20655
20719
|
console.log(
|
|
20656
20720
|
chalk81.bold(
|
|
@@ -20666,14 +20730,14 @@ function autoSelect(unblocked) {
|
|
|
20666
20730
|
);
|
|
20667
20731
|
return formatItemId(item.id);
|
|
20668
20732
|
}
|
|
20669
|
-
async function pickItem(
|
|
20670
|
-
const resumable = pickResumable(
|
|
20733
|
+
async function pickItem(items3, firstPick = false) {
|
|
20734
|
+
const resumable = pickResumable(items3);
|
|
20671
20735
|
if (resumable) return resumable;
|
|
20672
|
-
const unblocked = findUnblockedTodos(
|
|
20736
|
+
const unblocked = findUnblockedTodos(items3);
|
|
20673
20737
|
if (!unblocked) return void 0;
|
|
20674
20738
|
if (firstPick && unblocked.length === 1) return autoSelect(unblocked);
|
|
20675
|
-
const todo =
|
|
20676
|
-
return selectItem(todo,
|
|
20739
|
+
const todo = items3.filter((i) => i.status === "todo");
|
|
20740
|
+
return selectItem(todo, items3);
|
|
20677
20741
|
}
|
|
20678
20742
|
async function next(options2, startId) {
|
|
20679
20743
|
await pullIfConfigured();
|
|
@@ -20809,19 +20873,19 @@ async function surfaceCreatedItems(slashCommand, ids) {
|
|
|
20809
20873
|
const numericIds = parseValidIds(ids);
|
|
20810
20874
|
if (numericIds.length === 0) return;
|
|
20811
20875
|
const { orm } = await getReady();
|
|
20812
|
-
const
|
|
20876
|
+
const items3 = [];
|
|
20813
20877
|
for (const id of numericIds) {
|
|
20814
20878
|
const item = await loadItem(orm, id);
|
|
20815
|
-
if (item)
|
|
20879
|
+
if (item) items3.push(item);
|
|
20816
20880
|
}
|
|
20817
|
-
const [first] =
|
|
20881
|
+
const [first] = items3;
|
|
20818
20882
|
if (!first) return;
|
|
20819
20883
|
emitActivity({
|
|
20820
20884
|
kind: "command",
|
|
20821
20885
|
name: slashCommand,
|
|
20822
20886
|
itemId: first.id,
|
|
20823
20887
|
itemName: first.name,
|
|
20824
|
-
...
|
|
20888
|
+
...items3.length > 1 && { itemIds: items3.map((item) => item.id) }
|
|
20825
20889
|
});
|
|
20826
20890
|
}
|
|
20827
20891
|
|
|
@@ -20929,8 +20993,8 @@ async function launchMode(slashCommand, options2) {
|
|
|
20929
20993
|
|
|
20930
20994
|
// src/commands/backlog/refine.ts
|
|
20931
20995
|
async function pickItemForRefine() {
|
|
20932
|
-
const
|
|
20933
|
-
const active =
|
|
20996
|
+
const items3 = await loadBacklogSummaries();
|
|
20997
|
+
const active = items3.filter(
|
|
20934
20998
|
(i) => i.status === "todo" || i.status === "in-progress"
|
|
20935
20999
|
);
|
|
20936
21000
|
if (active.length === 0) {
|
|
@@ -21069,18 +21133,18 @@ function registerRunCommand(cmd) {
|
|
|
21069
21133
|
// src/commands/backlog/search.ts
|
|
21070
21134
|
import chalk90 from "chalk";
|
|
21071
21135
|
async function search(query) {
|
|
21072
|
-
const
|
|
21073
|
-
if (
|
|
21136
|
+
const items3 = await searchBacklog(query);
|
|
21137
|
+
if (items3.length === 0) {
|
|
21074
21138
|
console.log(chalk90.dim(`No items matching "${query}".`));
|
|
21075
21139
|
return;
|
|
21076
21140
|
}
|
|
21077
21141
|
console.log(
|
|
21078
21142
|
chalk90.dim(
|
|
21079
|
-
`${
|
|
21143
|
+
`${items3.length} item${items3.length === 1 ? "" : "s"} matching "${query}":
|
|
21080
21144
|
`
|
|
21081
21145
|
)
|
|
21082
21146
|
);
|
|
21083
|
-
for (const item of
|
|
21147
|
+
for (const item of items3) {
|
|
21084
21148
|
console.log(
|
|
21085
21149
|
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk90.dim(formatItemId(item.id))} ${item.name}`
|
|
21086
21150
|
);
|
|
@@ -21430,8 +21494,8 @@ function hasListMutations(options2) {
|
|
|
21430
21494
|
options2.add && options2.add.length > 0 || options2.edit || options2.remove
|
|
21431
21495
|
);
|
|
21432
21496
|
}
|
|
21433
|
-
function applyListMutations(
|
|
21434
|
-
let
|
|
21497
|
+
function applyListMutations(current2, options2, flags2) {
|
|
21498
|
+
let items3 = [...current2];
|
|
21435
21499
|
if (options2.edit) {
|
|
21436
21500
|
const [rawIndex, ...textParts] = options2.edit;
|
|
21437
21501
|
if (rawIndex === void 0 || textParts.length === 0) {
|
|
@@ -21442,29 +21506,29 @@ function applyListMutations(current, options2, flags2) {
|
|
|
21442
21506
|
}
|
|
21443
21507
|
const parsed = parseListIndex(
|
|
21444
21508
|
rawIndex,
|
|
21445
|
-
|
|
21509
|
+
items3.length,
|
|
21446
21510
|
`${flags2.edit} index`
|
|
21447
21511
|
);
|
|
21448
21512
|
if (!parsed.ok) return parsed;
|
|
21449
|
-
|
|
21513
|
+
items3[parsed.index - 1] = textParts.join(" ");
|
|
21450
21514
|
}
|
|
21451
21515
|
if (options2.remove) {
|
|
21452
21516
|
const parsed = parseListIndex(
|
|
21453
21517
|
options2.remove,
|
|
21454
|
-
|
|
21518
|
+
items3.length,
|
|
21455
21519
|
`${flags2.remove} index`
|
|
21456
21520
|
);
|
|
21457
21521
|
if (!parsed.ok) return parsed;
|
|
21458
|
-
|
|
21522
|
+
items3 = items3.filter((_, i) => i !== parsed.index - 1);
|
|
21459
21523
|
}
|
|
21460
21524
|
if (options2.add) {
|
|
21461
|
-
|
|
21525
|
+
items3.push(...options2.add);
|
|
21462
21526
|
}
|
|
21463
|
-
return { ok: true, items:
|
|
21527
|
+
return { ok: true, items: items3 };
|
|
21464
21528
|
}
|
|
21465
21529
|
|
|
21466
21530
|
// src/commands/backlog/update/resolveListUpdate.ts
|
|
21467
|
-
function resolveListUpdate(whole,
|
|
21531
|
+
function resolveListUpdate(whole, current2, mutations, wholeFlag, flags2) {
|
|
21468
21532
|
if (!hasListMutations(mutations)) return { ok: true, items: whole };
|
|
21469
21533
|
if (whole) {
|
|
21470
21534
|
return {
|
|
@@ -21472,7 +21536,7 @@ function resolveListUpdate(whole, current, mutations, wholeFlag, flags2) {
|
|
|
21472
21536
|
error: `Cannot combine ${wholeFlag} with ${flags2.add}/${flags2.edit}/${flags2.remove}.`
|
|
21473
21537
|
};
|
|
21474
21538
|
}
|
|
21475
|
-
return applyListMutations(
|
|
21539
|
+
return applyListMutations(current2, mutations, flags2);
|
|
21476
21540
|
}
|
|
21477
21541
|
|
|
21478
21542
|
// src/commands/backlog/resolvePhaseFields.ts
|
|
@@ -21486,19 +21550,19 @@ var CHECK_FLAGS = {
|
|
|
21486
21550
|
edit: "--edit-check",
|
|
21487
21551
|
remove: "--remove-check"
|
|
21488
21552
|
};
|
|
21489
|
-
function resolveTasks(o,
|
|
21553
|
+
function resolveTasks(o, current2) {
|
|
21490
21554
|
return resolveListUpdate(
|
|
21491
21555
|
o.task,
|
|
21492
|
-
(
|
|
21556
|
+
(current2?.tasks ?? []).map((t) => t.task),
|
|
21493
21557
|
{ add: o.addTask, edit: o.editTask, remove: o.removeTask },
|
|
21494
21558
|
"--task",
|
|
21495
21559
|
TASK_FLAGS
|
|
21496
21560
|
);
|
|
21497
21561
|
}
|
|
21498
|
-
function resolveChecks(o,
|
|
21562
|
+
function resolveChecks(o, current2) {
|
|
21499
21563
|
return resolveListUpdate(
|
|
21500
21564
|
o.manualCheck,
|
|
21501
|
-
|
|
21565
|
+
current2?.manualChecks ?? [],
|
|
21502
21566
|
{ add: o.addCheck, edit: o.editCheck, remove: o.removeCheck },
|
|
21503
21567
|
"--manual-check",
|
|
21504
21568
|
CHECK_FLAGS
|
|
@@ -21518,10 +21582,10 @@ function buildFields(name, tasks, checks2) {
|
|
|
21518
21582
|
}
|
|
21519
21583
|
return { ok: true, fields };
|
|
21520
21584
|
}
|
|
21521
|
-
function resolvePhaseFields(options2,
|
|
21522
|
-
const tasks = resolveTasks(options2,
|
|
21585
|
+
function resolvePhaseFields(options2, current2) {
|
|
21586
|
+
const tasks = resolveTasks(options2, current2);
|
|
21523
21587
|
if (!tasks.ok) return tasks;
|
|
21524
|
-
const checks2 = resolveChecks(options2,
|
|
21588
|
+
const checks2 = resolveChecks(options2, current2);
|
|
21525
21589
|
if (!checks2.ok) return checks2;
|
|
21526
21590
|
return buildFields(options2.name, tasks, checks2);
|
|
21527
21591
|
}
|
|
@@ -21643,9 +21707,9 @@ function hasAcMutations(options2) {
|
|
|
21643
21707
|
remove: options2.removeAc
|
|
21644
21708
|
});
|
|
21645
21709
|
}
|
|
21646
|
-
function applyAcMutations(
|
|
21710
|
+
function applyAcMutations(current2, options2) {
|
|
21647
21711
|
const result = applyListMutations(
|
|
21648
|
-
|
|
21712
|
+
current2,
|
|
21649
21713
|
{ add: options2.addAc, edit: options2.editAc, remove: options2.removeAc },
|
|
21650
21714
|
{ add: "--add-ac", edit: "--edit-ac", remove: "--remove-ac" }
|
|
21651
21715
|
);
|
|
@@ -22410,7 +22474,7 @@ function isUnderPosixTmp(target, tmp) {
|
|
|
22410
22474
|
}
|
|
22411
22475
|
|
|
22412
22476
|
// src/shared/consumeRedirect.ts
|
|
22413
|
-
function consumeRedirect(tokens, opIndex,
|
|
22477
|
+
function consumeRedirect(tokens, opIndex, current2) {
|
|
22414
22478
|
const target = tokens[opIndex + 1];
|
|
22415
22479
|
if (typeof target !== "string") {
|
|
22416
22480
|
return { ok: false, error: "unable to parse" };
|
|
@@ -22421,32 +22485,32 @@ function consumeRedirect(tokens, opIndex, current) {
|
|
|
22421
22485
|
error: `redirect target '${target}' is outside the OS temp directory`
|
|
22422
22486
|
};
|
|
22423
22487
|
}
|
|
22424
|
-
popFdPrefix(
|
|
22488
|
+
popFdPrefix(current2);
|
|
22425
22489
|
return { ok: true, nextIndex: opIndex + 1 };
|
|
22426
22490
|
}
|
|
22427
|
-
function popFdPrefix(
|
|
22428
|
-
if (
|
|
22429
|
-
|
|
22491
|
+
function popFdPrefix(current2) {
|
|
22492
|
+
if (current2.length > 0 && /^\d$/.test(current2[current2.length - 1])) {
|
|
22493
|
+
current2.pop();
|
|
22430
22494
|
}
|
|
22431
22495
|
}
|
|
22432
22496
|
|
|
22433
22497
|
// src/shared/consumeHeredoc.ts
|
|
22434
|
-
function consumeHeredoc(tokens, opIndex,
|
|
22498
|
+
function consumeHeredoc(tokens, opIndex, current2) {
|
|
22435
22499
|
const delimiter = tokens[opIndex + 2];
|
|
22436
22500
|
if (typeof delimiter !== "string") {
|
|
22437
22501
|
return { ok: false, error: "unable to parse" };
|
|
22438
22502
|
}
|
|
22439
|
-
popFdPrefix(
|
|
22503
|
+
popFdPrefix(current2);
|
|
22440
22504
|
return { ok: true, nextIndex: opIndex + 2 };
|
|
22441
22505
|
}
|
|
22442
22506
|
|
|
22443
22507
|
// src/shared/consumeInputRedirect.ts
|
|
22444
|
-
function consumeInputRedirect(tokens, opIndex,
|
|
22508
|
+
function consumeInputRedirect(tokens, opIndex, current2) {
|
|
22445
22509
|
const source = tokens[opIndex + 1];
|
|
22446
22510
|
if (typeof source !== "string") {
|
|
22447
22511
|
return { ok: false, error: "unable to parse" };
|
|
22448
22512
|
}
|
|
22449
|
-
popFdPrefix(
|
|
22513
|
+
popFdPrefix(current2);
|
|
22450
22514
|
return { ok: true, nextIndex: opIndex + 1 };
|
|
22451
22515
|
}
|
|
22452
22516
|
|
|
@@ -22480,8 +22544,8 @@ function handleToken(tokens, i, groups) {
|
|
|
22480
22544
|
return consumeRedirect(tokens, i, groups[groups.length - 1]);
|
|
22481
22545
|
}
|
|
22482
22546
|
if (op === INPUT_REDIRECT_OP) {
|
|
22483
|
-
const
|
|
22484
|
-
return getOp(tokens[i + 1]) === INPUT_REDIRECT_OP ? consumeHeredoc(tokens, i,
|
|
22547
|
+
const current2 = groups[groups.length - 1];
|
|
22548
|
+
return getOp(tokens[i + 1]) === INPUT_REDIRECT_OP ? consumeHeredoc(tokens, i, current2) : consumeInputRedirect(tokens, i, current2);
|
|
22485
22549
|
}
|
|
22486
22550
|
return UNPARSEABLE;
|
|
22487
22551
|
}
|
|
@@ -22882,29 +22946,29 @@ function configuresReleases(command) {
|
|
|
22882
22946
|
// src/shared/tokenize.ts
|
|
22883
22947
|
function tokenize(command) {
|
|
22884
22948
|
const tokens = [];
|
|
22885
|
-
let
|
|
22949
|
+
let current2 = "";
|
|
22886
22950
|
let inSingle = false;
|
|
22887
22951
|
let inDouble = false;
|
|
22888
22952
|
for (let i = 0; i < command.length; i++) {
|
|
22889
22953
|
const ch = command[i];
|
|
22890
22954
|
if (ch === "'" && !inDouble) {
|
|
22891
22955
|
inSingle = !inSingle;
|
|
22892
|
-
|
|
22956
|
+
current2 += ch;
|
|
22893
22957
|
} else if (ch === '"' && !inSingle) {
|
|
22894
22958
|
inDouble = !inDouble;
|
|
22895
|
-
|
|
22959
|
+
current2 += ch;
|
|
22896
22960
|
} else if (ch === "\\" && inDouble && i + 1 < command.length) {
|
|
22897
|
-
|
|
22961
|
+
current2 += ch + command[++i];
|
|
22898
22962
|
} else if (/\s/.test(ch) && !inSingle && !inDouble) {
|
|
22899
|
-
if (
|
|
22900
|
-
tokens.push(
|
|
22901
|
-
|
|
22963
|
+
if (current2) {
|
|
22964
|
+
tokens.push(current2);
|
|
22965
|
+
current2 = "";
|
|
22902
22966
|
}
|
|
22903
22967
|
} else {
|
|
22904
|
-
|
|
22968
|
+
current2 += ch;
|
|
22905
22969
|
}
|
|
22906
22970
|
}
|
|
22907
|
-
if (
|
|
22971
|
+
if (current2) tokens.push(current2);
|
|
22908
22972
|
return tokens;
|
|
22909
22973
|
}
|
|
22910
22974
|
|
|
@@ -23608,18 +23672,18 @@ function colorize(plainOutput) {
|
|
|
23608
23672
|
}).join("\n");
|
|
23609
23673
|
}
|
|
23610
23674
|
|
|
23611
|
-
// src/
|
|
23612
|
-
async function mapAsync(
|
|
23613
|
-
const results = Array.from({ length:
|
|
23675
|
+
// src/shared/mapAsync.ts
|
|
23676
|
+
async function mapAsync(items3, concurrency, fn) {
|
|
23677
|
+
const results = Array.from({ length: items3.length });
|
|
23614
23678
|
let next3 = 0;
|
|
23615
23679
|
async function worker() {
|
|
23616
|
-
while (next3 <
|
|
23680
|
+
while (next3 < items3.length) {
|
|
23617
23681
|
const idx = next3++;
|
|
23618
|
-
results[idx] = await fn(
|
|
23682
|
+
results[idx] = await fn(items3[idx]);
|
|
23619
23683
|
}
|
|
23620
23684
|
}
|
|
23621
23685
|
const workers = Array.from(
|
|
23622
|
-
{ length: Math.min(concurrency,
|
|
23686
|
+
{ length: Math.min(concurrency, items3.length) },
|
|
23623
23687
|
() => worker()
|
|
23624
23688
|
);
|
|
23625
23689
|
await Promise.all(workers);
|
|
@@ -24439,8 +24503,8 @@ function upstreamBranch() {
|
|
|
24439
24503
|
function warnIfUnexpectedBranch(config) {
|
|
24440
24504
|
const expected = config.commit?.expectedBranch;
|
|
24441
24505
|
if (!expected) return;
|
|
24442
|
-
const
|
|
24443
|
-
if (
|
|
24506
|
+
const current2 = currentBranch3();
|
|
24507
|
+
if (current2 === null || current2 === expected) return;
|
|
24444
24508
|
if (upstreamBranch() === expected) return;
|
|
24445
24509
|
const line = "\u2500".repeat(64);
|
|
24446
24510
|
console.warn(
|
|
@@ -24448,7 +24512,7 @@ function warnIfUnexpectedBranch(config) {
|
|
|
24448
24512
|
[
|
|
24449
24513
|
"",
|
|
24450
24514
|
line,
|
|
24451
|
-
`\u26A0 On branch "${
|
|
24515
|
+
`\u26A0 On branch "${current2}", but this repo expects "${expected}".`,
|
|
24452
24516
|
` Work committed here may be orphaned and never reach "${expected}".`,
|
|
24453
24517
|
line,
|
|
24454
24518
|
""
|
|
@@ -25451,13 +25515,13 @@ function cheatLine(entry, gitState) {
|
|
|
25451
25515
|
${chalk127.red("\u2717 You shrank existing lines in this file without creating a new file. That cannot clear the gate \u2014 extract a responsibility to a new file.")}`;
|
|
25452
25516
|
}
|
|
25453
25517
|
function printMaintainabilityFailure(failing, gitState) {
|
|
25454
|
-
const
|
|
25518
|
+
const blocks2 = failing.map((entry) => `${remediationLine(entry)}${cheatLine(entry, gitState)}`).join("\n");
|
|
25455
25519
|
console.error(
|
|
25456
25520
|
chalk127.red(
|
|
25457
25521
|
`
|
|
25458
25522
|
Fail: ${failing.length} file(s) below threshold \u2192 extract a responsibility to a new file.
|
|
25459
25523
|
|
|
25460
|
-
${
|
|
25524
|
+
${blocks2}
|
|
25461
25525
|
|
|
25462
25526
|
${chalk127.bold("Diagnose and fix one file at a time.")} Only a new file (Write) or 'assist refactor extract' clears this gate \u2014 editing the existing lines does not.`
|
|
25463
25527
|
)
|
|
@@ -25681,8 +25745,8 @@ function exitWithConfigErrors(errors) {
|
|
|
25681
25745
|
|
|
25682
25746
|
// src/commands/config/diffRepoConfigLeaves.ts
|
|
25683
25747
|
import { isDeepStrictEqual as isDeepStrictEqual2 } from "util";
|
|
25684
|
-
function diffRepoConfigLeaves(
|
|
25685
|
-
const existing = new Map(leaves(
|
|
25748
|
+
function diffRepoConfigLeaves(current2, incoming) {
|
|
25749
|
+
const existing = new Map(leaves(current2));
|
|
25686
25750
|
return leaves(incoming).flatMap(([key, to]) => {
|
|
25687
25751
|
if (!existing.has(key)) return [{ key, to }];
|
|
25688
25752
|
const from = existing.get(key);
|
|
@@ -25703,12 +25767,12 @@ function isPlainObject4(value) {
|
|
|
25703
25767
|
function planRepoConfigImport(ymlRepos, dbRepos) {
|
|
25704
25768
|
return Object.entries(ymlRepos).map(([ymlKey, block]) => {
|
|
25705
25769
|
const dbKey = matchDbKey(dbRepos, ymlKey) ?? ymlKey;
|
|
25706
|
-
const
|
|
25770
|
+
const current2 = dbRepos[dbKey] ?? {};
|
|
25707
25771
|
const incoming = isPlainObject5(block) ? block : {};
|
|
25708
|
-
const changes = diffRepoConfigLeaves(
|
|
25772
|
+
const changes = diffRepoConfigLeaves(current2, incoming);
|
|
25709
25773
|
const merged = changes.reduce(
|
|
25710
25774
|
(acc, change) => setNestedValue(acc, change.key, change.to),
|
|
25711
|
-
|
|
25775
|
+
current2
|
|
25712
25776
|
);
|
|
25713
25777
|
const validation = validateConfig(merged, ymlKey, repoConfigSchema);
|
|
25714
25778
|
const errors = validation.ok ? [] : validation.errors.map((error) => `repos.${ymlKey}.${error}`);
|
|
@@ -25813,8 +25877,8 @@ function planValue(merged, key, incoming) {
|
|
|
25813
25877
|
};
|
|
25814
25878
|
}
|
|
25815
25879
|
function planArray(merged, key, incoming) {
|
|
25816
|
-
const
|
|
25817
|
-
const existing = Array.isArray(
|
|
25880
|
+
const current2 = getNestedValue(merged, key);
|
|
25881
|
+
const existing = Array.isArray(current2) ? current2 : [];
|
|
25818
25882
|
const added = incoming.filter(
|
|
25819
25883
|
(item) => !existing.some((entry) => isDeepStrictEqual3(entry, item))
|
|
25820
25884
|
);
|
|
@@ -25890,8 +25954,8 @@ async function configImportUser(keys) {
|
|
|
25890
25954
|
console.log("Nothing imported.");
|
|
25891
25955
|
return;
|
|
25892
25956
|
}
|
|
25893
|
-
const outcome = await updateUserConfig(orm, (
|
|
25894
|
-
const latest2 = planUserConfigImport(yml,
|
|
25957
|
+
const outcome = await updateUserConfig(orm, (current2) => {
|
|
25958
|
+
const latest2 = planUserConfigImport(yml, current2, plan2.imported);
|
|
25895
25959
|
return latest2.errors.length > 0 ? { ok: false, errors: latest2.errors } : { ok: true, config: latest2.merged, result: void 0 };
|
|
25896
25960
|
});
|
|
25897
25961
|
if (!outcome.ok) exitWithConfigErrors(outcome.errors);
|
|
@@ -27520,11 +27584,11 @@ function version() {
|
|
|
27520
27584
|
const name = getRepoName();
|
|
27521
27585
|
const lastWeek = loadDevWeeks(name, devDir).at(-1) ?? null;
|
|
27522
27586
|
const entry = lastWeek ? loadDevEntry(name, lastWeek, devDir) : null;
|
|
27523
|
-
const
|
|
27587
|
+
const current2 = getVersionAtCommit("HEAD");
|
|
27524
27588
|
printField2("name", name);
|
|
27525
27589
|
printField2("last week", lastWeek);
|
|
27526
27590
|
printField2("last version", entry?.lastVersion);
|
|
27527
|
-
printField2("current",
|
|
27591
|
+
printField2("current", current2 ? stripToMinor(current2) : null);
|
|
27528
27592
|
}
|
|
27529
27593
|
|
|
27530
27594
|
// src/commands/registerDevlog.ts
|
|
@@ -28264,20 +28328,20 @@ function findSlnInDir(dir) {
|
|
|
28264
28328
|
function findSolution() {
|
|
28265
28329
|
const repoRoot2 = findRepoRoot(process.cwd());
|
|
28266
28330
|
const ceiling = repoRoot2 ?? process.cwd();
|
|
28267
|
-
let
|
|
28331
|
+
let current2 = process.cwd();
|
|
28268
28332
|
while (true) {
|
|
28269
|
-
const slnFiles = findSlnInDir(
|
|
28333
|
+
const slnFiles = findSlnInDir(current2);
|
|
28270
28334
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
28271
28335
|
if (slnFiles.length > 1) {
|
|
28272
|
-
console.error(chalk177.red(`Multiple .sln files found in ${
|
|
28336
|
+
console.error(chalk177.red(`Multiple .sln files found in ${current2}:`));
|
|
28273
28337
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
28274
28338
|
console.error(
|
|
28275
28339
|
chalk177.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
28276
28340
|
);
|
|
28277
28341
|
process.exit(1);
|
|
28278
28342
|
}
|
|
28279
|
-
if (
|
|
28280
|
-
|
|
28343
|
+
if (current2 === ceiling) break;
|
|
28344
|
+
current2 = dirname33(current2);
|
|
28281
28345
|
}
|
|
28282
28346
|
console.error(chalk177.red("No .sln file found between cwd and repo root"));
|
|
28283
28347
|
process.exit(1);
|
|
@@ -30107,13 +30171,13 @@ function renderScreenshotsSection(attachments) {
|
|
|
30107
30171
|
members.push(attachment);
|
|
30108
30172
|
groups.set(attachment.group, members);
|
|
30109
30173
|
}
|
|
30110
|
-
const
|
|
30174
|
+
const blocks2 = [...groups].flatMap(([group, members]) => [
|
|
30111
30175
|
`### ${group}`,
|
|
30112
30176
|
...renderScreenshotBlock(members)
|
|
30113
30177
|
]);
|
|
30114
30178
|
return [
|
|
30115
30179
|
"## Screenshots",
|
|
30116
|
-
...
|
|
30180
|
+
...blocks2,
|
|
30117
30181
|
...ungrouped.map(screenshotReference)
|
|
30118
30182
|
].join("\n\n");
|
|
30119
30183
|
}
|
|
@@ -30228,26 +30292,26 @@ function applyCreatedIssueMetadata(createOutput, metadata2) {
|
|
|
30228
30292
|
function issuePreviewMetadata(resolved) {
|
|
30229
30293
|
if (!resolved) return [];
|
|
30230
30294
|
const { target, issueType, parent, project, labels, milestone } = resolved;
|
|
30231
|
-
const
|
|
30295
|
+
const items3 = [
|
|
30232
30296
|
{ label: "Repository", value: `${target.owner}/${target.repo}` }
|
|
30233
30297
|
];
|
|
30234
|
-
if (issueType)
|
|
30298
|
+
if (issueType) items3.push({ label: "Type", value: issueType.name });
|
|
30235
30299
|
if (parent)
|
|
30236
|
-
|
|
30300
|
+
items3.push({
|
|
30237
30301
|
label: "Parent",
|
|
30238
30302
|
value: `${parent.owner}/${parent.repo}#${parent.number}`,
|
|
30239
30303
|
url: `https://github.com/${parent.owner}/${parent.repo}/issues/${parent.number}`
|
|
30240
30304
|
});
|
|
30241
30305
|
if (project)
|
|
30242
|
-
|
|
30306
|
+
items3.push({
|
|
30243
30307
|
label: "Project",
|
|
30244
30308
|
value: `${project.number} (${project.title})`
|
|
30245
30309
|
});
|
|
30246
30310
|
if (project?.status)
|
|
30247
|
-
|
|
30248
|
-
if (labels?.length)
|
|
30249
|
-
if (milestone)
|
|
30250
|
-
return
|
|
30311
|
+
items3.push({ label: "Status", value: project.status.optionName });
|
|
30312
|
+
if (labels?.length) items3.push({ label: "Labels", value: labels.join(", ") });
|
|
30313
|
+
if (milestone) items3.push({ label: "Milestone", value: milestone });
|
|
30314
|
+
return items3;
|
|
30251
30315
|
}
|
|
30252
30316
|
|
|
30253
30317
|
// src/commands/github/issue/hasCreateIssueMetadataOptions.ts
|
|
@@ -31018,8 +31082,8 @@ function toIssueProjectItem(node) {
|
|
|
31018
31082
|
function parseIssueProjectItems(raw, label) {
|
|
31019
31083
|
const issue = JSON.parse(raw).data?.repository?.issue;
|
|
31020
31084
|
if (!issue?.id) throw new Error(`No issue ${label} could be read`);
|
|
31021
|
-
const
|
|
31022
|
-
return { issueId: issue.id, items:
|
|
31085
|
+
const items3 = (issue.projectItems?.nodes ?? []).map(toIssueProjectItem).filter((item) => item !== void 0);
|
|
31086
|
+
return { issueId: issue.id, items: items3 };
|
|
31023
31087
|
}
|
|
31024
31088
|
|
|
31025
31089
|
// src/commands/github/issue/fetchIssueProjectItems.ts
|
|
@@ -31086,14 +31150,14 @@ function moveIssueToInProgress(target) {
|
|
|
31086
31150
|
console.log(error instanceof Error ? error.message : String(error));
|
|
31087
31151
|
return;
|
|
31088
31152
|
}
|
|
31089
|
-
const { items:
|
|
31090
|
-
if (
|
|
31153
|
+
const { items: items3 } = fetchIssueProjectItems(target);
|
|
31154
|
+
if (items3.length === 0) {
|
|
31091
31155
|
console.log(
|
|
31092
31156
|
`${target.owner}/${target.repo}#${target.number} is on no project board, so there was nothing to move`
|
|
31093
31157
|
);
|
|
31094
31158
|
return;
|
|
31095
31159
|
}
|
|
31096
|
-
for (const item of
|
|
31160
|
+
for (const item of items3) moveItem(item);
|
|
31097
31161
|
}
|
|
31098
31162
|
|
|
31099
31163
|
// src/commands/github/issue/parseIssueTarget.ts
|
|
@@ -31260,6 +31324,151 @@ async function writeInboxLastScan(orm, at2) {
|
|
|
31260
31324
|
await orm.insert(metadata).values({ key: INBOX_LAST_SCAN_KEY, value }).onConflictDoUpdate({ target: metadata.key, set: { value } });
|
|
31261
31325
|
}
|
|
31262
31326
|
|
|
31327
|
+
// src/commands/inbox/addScanUsage.ts
|
|
31328
|
+
function sumNullable(a, b) {
|
|
31329
|
+
return a === null && b === null ? null : (a ?? 0) + (b ?? 0);
|
|
31330
|
+
}
|
|
31331
|
+
function addScanUsage(a, b) {
|
|
31332
|
+
return {
|
|
31333
|
+
input: a.input + b.input,
|
|
31334
|
+
output: a.output + b.output,
|
|
31335
|
+
cacheRead: a.cacheRead + b.cacheRead,
|
|
31336
|
+
cacheWrite: a.cacheWrite + b.cacheWrite,
|
|
31337
|
+
costUsd: sumNullable(a.costUsd, b.costUsd),
|
|
31338
|
+
durationMs: sumNullable(a.durationMs, b.durationMs)
|
|
31339
|
+
};
|
|
31340
|
+
}
|
|
31341
|
+
|
|
31342
|
+
// src/commands/inbox/inboxFlagInstructions.ts
|
|
31343
|
+
function inboxFlagInstructions() {
|
|
31344
|
+
return [
|
|
31345
|
+
"Do not flag anything from bots, apps, automated or notification systems (CI, calendars, ticketing, monitoring, no-reply addresses), newsletters or mailing lists.",
|
|
31346
|
+
"Flag messages a person wrote to me that need me to reply or act. That includes messages that hand me something to act on without asking a question, such as a credential or secret to retrieve, a document to review, or a deadline to meet.",
|
|
31347
|
+
"Judge each message on its full content, never on a search snippet alone.",
|
|
31348
|
+
"",
|
|
31349
|
+
"For each flagged message return:",
|
|
31350
|
+
'- source: "gmail" or "slack"',
|
|
31351
|
+
"- messageId: the Gmail message id, or for Slack <channel_id>:<message ts>",
|
|
31352
|
+
"- sender: the sender's name",
|
|
31353
|
+
"- summary: one sentence on the reply or action it needs from me",
|
|
31354
|
+
"- link: the Gmail message viewUrl or the Slack permalink",
|
|
31355
|
+
"- receivedAt: when it was sent, as an ISO 8601 timestamp",
|
|
31356
|
+
"",
|
|
31357
|
+
"Return an empty messages array when nothing needs my reply or action."
|
|
31358
|
+
];
|
|
31359
|
+
}
|
|
31360
|
+
|
|
31361
|
+
// src/commands/inbox/buildInboxScanPrompt.ts
|
|
31362
|
+
function buildInboxScanPrompt(since) {
|
|
31363
|
+
const sinceUnix = Math.floor(since.getTime() / 1e3);
|
|
31364
|
+
return [
|
|
31365
|
+
"Triage my Gmail and Slack for messages a person wrote to me that need my reply or action.",
|
|
31366
|
+
"You are read-only: never label, mark read, react to, reply to or otherwise change any message.",
|
|
31367
|
+
"",
|
|
31368
|
+
"Gmail:",
|
|
31369
|
+
'- Call search_threads with query "in:inbox is:unread" (page through all results).',
|
|
31370
|
+
"- Call get_thread with messageFormat PLAIN_TEXT on each thread.",
|
|
31371
|
+
"- Consider the latest unread message in each thread.",
|
|
31372
|
+
"",
|
|
31373
|
+
`Slack (only messages since ${since.toISOString()}, unix ${sinceUnix}):`,
|
|
31374
|
+
`- Call slack_search_public_and_private with filters "is:dm" and after "${sinceUnix}".`,
|
|
31375
|
+
`- Call slack_search_public_and_private with keywords ["<@MY_USER_ID>"] and after "${sinceUnix}", where MY_USER_ID is the logged-in user id from the tool description.`,
|
|
31376
|
+
"- Skip messages I wrote myself.",
|
|
31377
|
+
"- For a message in a thread, call slack_read_thread and skip it if I have replied in that thread after it.",
|
|
31378
|
+
"",
|
|
31379
|
+
...inboxFlagInstructions()
|
|
31380
|
+
].join("\n");
|
|
31381
|
+
}
|
|
31382
|
+
|
|
31383
|
+
// src/commands/inbox/buildInboxThreadsPrompt.ts
|
|
31384
|
+
function buildInboxThreadsPrompt(threadIds) {
|
|
31385
|
+
return [
|
|
31386
|
+
"Triage these unread threads from my Gmail inbox for messages that need my reply or action.",
|
|
31387
|
+
"You are read-only: never label, mark read, reply to or otherwise change any message.",
|
|
31388
|
+
"",
|
|
31389
|
+
"Call get_thread with messageFormat PLAIN_TEXT on every one of these thread ids, and consider the latest unread message in each:",
|
|
31390
|
+
...threadIds.map((id) => `- ${id}`),
|
|
31391
|
+
"",
|
|
31392
|
+
...inboxFlagInstructions()
|
|
31393
|
+
].join("\n");
|
|
31394
|
+
}
|
|
31395
|
+
|
|
31396
|
+
// src/commands/inbox/scanUnopenedThreads.ts
|
|
31397
|
+
var BATCH_SIZE = 25;
|
|
31398
|
+
var CONCURRENCY2 = 4;
|
|
31399
|
+
var MAX_ATTEMPTS = 2;
|
|
31400
|
+
function chunk(items3, size) {
|
|
31401
|
+
return Array.from(
|
|
31402
|
+
{ length: Math.ceil(items3.length / size) },
|
|
31403
|
+
(_, i) => items3.slice(i * size, (i + 1) * size)
|
|
31404
|
+
);
|
|
31405
|
+
}
|
|
31406
|
+
function errorEvent(detail) {
|
|
31407
|
+
return {
|
|
31408
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
31409
|
+
kind: "error",
|
|
31410
|
+
label: "Gmail",
|
|
31411
|
+
detail
|
|
31412
|
+
};
|
|
31413
|
+
}
|
|
31414
|
+
async function scanUnopenedThreads(threadIds, scanThreads, onEvent = () => {
|
|
31415
|
+
}) {
|
|
31416
|
+
const messages = [];
|
|
31417
|
+
let pending = threadIds;
|
|
31418
|
+
for (let attempt2 = 0; attempt2 < MAX_ATTEMPTS && pending.length; attempt2++) {
|
|
31419
|
+
const results = await mapAsync(
|
|
31420
|
+
chunk(pending, BATCH_SIZE),
|
|
31421
|
+
CONCURRENCY2,
|
|
31422
|
+
(batch) => scanThreads(batch).catch((error) => {
|
|
31423
|
+
onEvent(
|
|
31424
|
+
errorEvent(error instanceof Error ? error.message : String(error))
|
|
31425
|
+
);
|
|
31426
|
+
return void 0;
|
|
31427
|
+
})
|
|
31428
|
+
);
|
|
31429
|
+
const opened = new Set(results.flatMap((r) => r?.threads.opened ?? []));
|
|
31430
|
+
messages.push(...results.flatMap((r) => r?.messages ?? []));
|
|
31431
|
+
pending = pending.filter((id) => !opened.has(id));
|
|
31432
|
+
}
|
|
31433
|
+
if (pending.length)
|
|
31434
|
+
onEvent(
|
|
31435
|
+
errorEvent(
|
|
31436
|
+
`${pending.length} unread thread(s) never opened: ${pending.join(" ")}`
|
|
31437
|
+
)
|
|
31438
|
+
);
|
|
31439
|
+
return messages;
|
|
31440
|
+
}
|
|
31441
|
+
|
|
31442
|
+
// src/commands/inbox/scanInboxWithCoverage.ts
|
|
31443
|
+
async function scanInboxWithCoverage(since, listener) {
|
|
31444
|
+
const runs = [];
|
|
31445
|
+
const total3 = () => runs.reduce(addScanUsage, emptyScanUsage());
|
|
31446
|
+
const run4 = (pass) => {
|
|
31447
|
+
const slot = runs.push(emptyScanUsage()) - 1;
|
|
31448
|
+
return runInboxScanClaude(pass, {
|
|
31449
|
+
...listener,
|
|
31450
|
+
onUsage: (usage) => {
|
|
31451
|
+
runs[slot] = usage;
|
|
31452
|
+
listener.onUsage?.(total3());
|
|
31453
|
+
}
|
|
31454
|
+
});
|
|
31455
|
+
};
|
|
31456
|
+
const main = await run4({
|
|
31457
|
+
prompt: buildInboxScanPrompt(since),
|
|
31458
|
+
allowedTools: inboxScanTools.allowed
|
|
31459
|
+
});
|
|
31460
|
+
const opened = new Set(main.threads.opened);
|
|
31461
|
+
const followUp = await scanUnopenedThreads(
|
|
31462
|
+
main.threads.found.filter((id) => !opened.has(id)),
|
|
31463
|
+
(threadIds) => run4({
|
|
31464
|
+
prompt: buildInboxThreadsPrompt(threadIds),
|
|
31465
|
+
allowedTools: [inboxScanTools.gmailGetThread]
|
|
31466
|
+
}),
|
|
31467
|
+
listener.onEvent
|
|
31468
|
+
);
|
|
31469
|
+
return { messages: [...main.messages, ...followUp], usage: total3() };
|
|
31470
|
+
}
|
|
31471
|
+
|
|
31263
31472
|
// src/shared/db/finishJobRun.ts
|
|
31264
31473
|
import { eq as eq55 } from "drizzle-orm";
|
|
31265
31474
|
async function finishJobRun(db, id, result) {
|
|
@@ -31340,7 +31549,7 @@ async function runInboxScan(orm, { trigger, wrap = (_since, run4) => run4(), ...
|
|
|
31340
31549
|
const since = await readInboxLastScan(orm) ?? new Date(startedAt.getTime() - FIRST_SCAN_LOOKBACK_MS);
|
|
31341
31550
|
const { messages, usage } = await wrap(
|
|
31342
31551
|
since,
|
|
31343
|
-
() =>
|
|
31552
|
+
() => scanInboxWithCoverage(since, tracked)
|
|
31344
31553
|
);
|
|
31345
31554
|
const added = await upsertInboxMessages(orm, messages.map(toRow2));
|
|
31346
31555
|
await writeInboxLastScan(orm, startedAt);
|
|
@@ -31986,8 +32195,8 @@ function spawnInstall(worktreePath, cwd, command, where, onDone) {
|
|
|
31986
32195
|
const child = spawn7(...installInvocation(cwd, command));
|
|
31987
32196
|
trackInstall(worktreePath, child);
|
|
31988
32197
|
let stderr = "";
|
|
31989
|
-
child.stderr?.on("data", (
|
|
31990
|
-
stderr = (stderr +
|
|
32198
|
+
child.stderr?.on("data", (chunk2) => {
|
|
32199
|
+
stderr = (stderr + chunk2.toString()).slice(-STDERR_TAIL);
|
|
31991
32200
|
});
|
|
31992
32201
|
let settled = false;
|
|
31993
32202
|
const settle = (ok, outcome) => {
|
|
@@ -32569,26 +32778,26 @@ async function renderBlock(krokiUrl, source) {
|
|
|
32569
32778
|
// src/commands/mermaid/exportFile.ts
|
|
32570
32779
|
async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
32571
32780
|
const content = readFileSync47(file, "utf8");
|
|
32572
|
-
const
|
|
32781
|
+
const blocks2 = extractMermaidBlocks(content);
|
|
32573
32782
|
const stem = basename21(file, extname4(file));
|
|
32574
32783
|
if (onlyIndex !== void 0) {
|
|
32575
|
-
if (onlyIndex < 1 || onlyIndex >
|
|
32784
|
+
if (onlyIndex < 1 || onlyIndex > blocks2.length) {
|
|
32576
32785
|
console.error(
|
|
32577
32786
|
chalk195.red(
|
|
32578
|
-
`${file}: --index ${onlyIndex} out of range (file has ${
|
|
32787
|
+
`${file}: --index ${onlyIndex} out of range (file has ${blocks2.length} diagram(s))`
|
|
32579
32788
|
)
|
|
32580
32789
|
);
|
|
32581
32790
|
process.exit(1);
|
|
32582
32791
|
}
|
|
32583
32792
|
console.log(
|
|
32584
32793
|
chalk195.gray(
|
|
32585
|
-
`${file} \u2014 rendering diagram ${onlyIndex} of ${
|
|
32794
|
+
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks2.length}`
|
|
32586
32795
|
)
|
|
32587
32796
|
);
|
|
32588
32797
|
} else {
|
|
32589
|
-
console.log(chalk195.gray(`${file} \u2014 ${
|
|
32798
|
+
console.log(chalk195.gray(`${file} \u2014 ${blocks2.length} diagram(s)`));
|
|
32590
32799
|
}
|
|
32591
|
-
for (const [i, source] of
|
|
32800
|
+
for (const [i, source] of blocks2.entries()) {
|
|
32592
32801
|
const idx = i + 1;
|
|
32593
32802
|
if (onlyIndex !== void 0 && idx !== onlyIndex) continue;
|
|
32594
32803
|
const outPath = resolve23(outDir, `${stem}-${idx}.svg`);
|
|
@@ -32679,9 +32888,9 @@ function anchorSource(options2) {
|
|
|
32679
32888
|
function boardId(url) {
|
|
32680
32889
|
return url ? /\/board\/([^/?]+)/.exec(url)?.[1] : void 0;
|
|
32681
32890
|
}
|
|
32682
|
-
function miroSource(
|
|
32683
|
-
const anchor =
|
|
32684
|
-
const ordered = anchor ? [anchor, ...
|
|
32891
|
+
function miroSource(items3, anchorId) {
|
|
32892
|
+
const anchor = items3.find((item) => item.id === anchorId);
|
|
32893
|
+
const ordered = anchor ? [anchor, ...items3] : items3;
|
|
32685
32894
|
return {
|
|
32686
32895
|
board: boardId(ordered.find((item) => item.miro_url)?.miro_url),
|
|
32687
32896
|
frame: ordered.find((item) => item.parent?.id)?.parent?.id
|
|
@@ -32869,12 +33078,12 @@ function toItem(item) {
|
|
|
32869
33078
|
bottom: y + halfHeight
|
|
32870
33079
|
};
|
|
32871
33080
|
}
|
|
32872
|
-
function normaliseItems(
|
|
32873
|
-
const rejected =
|
|
33081
|
+
function normaliseItems(items3) {
|
|
33082
|
+
const rejected = items3.filter(
|
|
32874
33083
|
(item) => item.position?.relativeTo !== frameCoordinates
|
|
32875
33084
|
);
|
|
32876
33085
|
if (rejected.length > 0) throw coordinateSpaceError(rejected);
|
|
32877
|
-
return
|
|
33086
|
+
return items3.map(toItem);
|
|
32878
33087
|
}
|
|
32879
33088
|
|
|
32880
33089
|
// src/commands/miro/saveMiroExtract.ts
|
|
@@ -32937,21 +33146,21 @@ function isBox(item) {
|
|
|
32937
33146
|
}
|
|
32938
33147
|
|
|
32939
33148
|
// src/commands/miro/encodeMiroBoardPreview.ts
|
|
32940
|
-
function encodeMiroBoardPreview(
|
|
32941
|
-
const preview = { boxes:
|
|
33149
|
+
function encodeMiroBoardPreview(items3) {
|
|
33150
|
+
const preview = { boxes: items3.filter(isBox) };
|
|
32942
33151
|
return JSON.stringify(preview);
|
|
32943
33152
|
}
|
|
32944
33153
|
|
|
32945
33154
|
// src/commands/miro/pickAnchors.ts
|
|
32946
33155
|
var skipAdvice = "Re-run with --top-left <id|link> --bottom-right <id|link> to skip the picker.";
|
|
32947
|
-
async function pickAnchors(sessionId2,
|
|
33156
|
+
async function pickAnchors(sessionId2, items3) {
|
|
32948
33157
|
const decision = await awaitPreviewApproval(
|
|
32949
33158
|
"Miro anchor selection",
|
|
32950
33159
|
{
|
|
32951
33160
|
sessionId: sessionId2,
|
|
32952
33161
|
requestId: randomUUID19(),
|
|
32953
33162
|
title: "Pick the top-left then the bottom-right box",
|
|
32954
|
-
body: encodeMiroBoardPreview(
|
|
33163
|
+
body: encodeMiroBoardPreview(items3),
|
|
32955
33164
|
prNumber: null,
|
|
32956
33165
|
kind: "miro-board"
|
|
32957
33166
|
},
|
|
@@ -32996,14 +33205,14 @@ function parsePages(raw, file) {
|
|
|
32996
33205
|
return Array.isArray(parsed) ? parsed.map(toPage) : [toPage(parsed)];
|
|
32997
33206
|
}
|
|
32998
33207
|
function readMiroItems(file) {
|
|
32999
|
-
const
|
|
33208
|
+
const items3 = parsePages(readFileSync49(file, "utf8"), file).flatMap(
|
|
33000
33209
|
(page) => page.data ?? []
|
|
33001
33210
|
);
|
|
33002
|
-
if (
|
|
33211
|
+
if (items3.length === 0)
|
|
33003
33212
|
throw new MiroExtractError(
|
|
33004
33213
|
`No board items found in ${file}. Dump the frame with board_list_items, paging until has_more is false.`
|
|
33005
33214
|
);
|
|
33006
|
-
return
|
|
33215
|
+
return items3;
|
|
33007
33216
|
}
|
|
33008
33217
|
|
|
33009
33218
|
// src/commands/miro/resolveExtractOptions.ts
|
|
@@ -33090,8 +33299,8 @@ function resolveExtractOptions(name, options2, paths) {
|
|
|
33090
33299
|
}
|
|
33091
33300
|
|
|
33092
33301
|
// src/commands/miro/selectBoxes.ts
|
|
33093
|
-
function findAnchor(
|
|
33094
|
-
const anchor =
|
|
33302
|
+
function findAnchor(items3, id) {
|
|
33303
|
+
const anchor = items3.find((item) => item.id === id);
|
|
33095
33304
|
if (!anchor)
|
|
33096
33305
|
throw new MiroExtractError(
|
|
33097
33306
|
`No item with id ${id} in the supplied items. Re-dump the frame so the anchor is included, then try again.`
|
|
@@ -33103,16 +33312,16 @@ function centreInside(rect, item) {
|
|
|
33103
33312
|
const y = (item.top + item.bottom) / 2;
|
|
33104
33313
|
return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
|
|
33105
33314
|
}
|
|
33106
|
-
function selectBoxes(
|
|
33107
|
-
const topLeft = findAnchor(
|
|
33108
|
-
const bottomRight = findAnchor(
|
|
33315
|
+
function selectBoxes(items3, topLeftId, bottomRightId) {
|
|
33316
|
+
const topLeft = findAnchor(items3, topLeftId);
|
|
33317
|
+
const bottomRight = findAnchor(items3, bottomRightId);
|
|
33109
33318
|
const rect = {
|
|
33110
33319
|
left: topLeft.left,
|
|
33111
33320
|
top: topLeft.top,
|
|
33112
33321
|
right: bottomRight.right,
|
|
33113
33322
|
bottom: bottomRight.bottom
|
|
33114
33323
|
};
|
|
33115
|
-
const boxes =
|
|
33324
|
+
const boxes = items3.filter((item) => isBox(item) && centreInside(rect, item)).sort((a, b) => a.left - b.left || a.top - b.top);
|
|
33116
33325
|
return { rect, boxes };
|
|
33117
33326
|
}
|
|
33118
33327
|
|
|
@@ -33129,9 +33338,9 @@ async function runExtract(name, options2, paths = {}) {
|
|
|
33129
33338
|
const source = anchorSource(resolved);
|
|
33130
33339
|
const itemsFile = requireItems(resolved.items);
|
|
33131
33340
|
const raw = readMiroItems(itemsFile);
|
|
33132
|
-
const
|
|
33133
|
-
const [topLeft, bottomRight] = source.pick ? await pickAnchors(source.sessionId,
|
|
33134
|
-
const selection = selectBoxes(
|
|
33341
|
+
const items3 = normaliseItems(raw);
|
|
33342
|
+
const [topLeft, bottomRight] = source.pick ? await pickAnchors(source.sessionId, items3) : [source.topLeft, source.bottomRight];
|
|
33343
|
+
const selection = selectBoxes(items3, topLeft, bottomRight);
|
|
33135
33344
|
const board = boardSource(raw, topLeft, resolved);
|
|
33136
33345
|
emitExtract(
|
|
33137
33346
|
resolved.out,
|
|
@@ -33217,8 +33426,8 @@ function parseNetcapEntry(body) {
|
|
|
33217
33426
|
// src/commands/netcap/handleNetcapPost.ts
|
|
33218
33427
|
function handleNetcapPost(req, res, options2) {
|
|
33219
33428
|
let body = "";
|
|
33220
|
-
req.on("data", (
|
|
33221
|
-
body +=
|
|
33429
|
+
req.on("data", (chunk2) => {
|
|
33430
|
+
body += chunk2;
|
|
33222
33431
|
});
|
|
33223
33432
|
req.on("end", () => {
|
|
33224
33433
|
const entry = parseNetcapEntry(body);
|
|
@@ -35119,12 +35328,12 @@ ${sections.how}`);
|
|
|
35119
35328
|
// src/commands/prs/parsePrBody.ts
|
|
35120
35329
|
function parsePrBody(body) {
|
|
35121
35330
|
const sections = [];
|
|
35122
|
-
let
|
|
35331
|
+
let current2 = null;
|
|
35123
35332
|
const flush = () => {
|
|
35124
|
-
if (
|
|
35333
|
+
if (current2) {
|
|
35125
35334
|
sections.push({
|
|
35126
|
-
heading:
|
|
35127
|
-
content:
|
|
35335
|
+
heading: current2.heading,
|
|
35336
|
+
content: current2.lines.join("\n").trim()
|
|
35128
35337
|
});
|
|
35129
35338
|
}
|
|
35130
35339
|
};
|
|
@@ -35132,9 +35341,9 @@ function parsePrBody(body) {
|
|
|
35132
35341
|
const match = /^##\s+(.+?)\s*$/.exec(line);
|
|
35133
35342
|
if (match) {
|
|
35134
35343
|
flush();
|
|
35135
|
-
|
|
35136
|
-
} else if (
|
|
35137
|
-
|
|
35344
|
+
current2 = { heading: match[1], lines: [] };
|
|
35345
|
+
} else if (current2) {
|
|
35346
|
+
current2.lines.push(line);
|
|
35138
35347
|
}
|
|
35139
35348
|
}
|
|
35140
35349
|
flush();
|
|
@@ -36495,9 +36704,9 @@ function opExec(args) {
|
|
|
36495
36704
|
}).trim();
|
|
36496
36705
|
}
|
|
36497
36706
|
function searchItems(search2) {
|
|
36498
|
-
let
|
|
36707
|
+
let items3;
|
|
36499
36708
|
try {
|
|
36500
|
-
|
|
36709
|
+
items3 = JSON.parse(opExec("item list --format=json"));
|
|
36501
36710
|
} catch {
|
|
36502
36711
|
console.error(
|
|
36503
36712
|
chalk211.red(
|
|
@@ -36507,7 +36716,7 @@ function searchItems(search2) {
|
|
|
36507
36716
|
process.exit(1);
|
|
36508
36717
|
}
|
|
36509
36718
|
const lower = search2.toLowerCase();
|
|
36510
|
-
return
|
|
36719
|
+
return items3.filter((i) => i.title.toLowerCase().includes(lower));
|
|
36511
36720
|
}
|
|
36512
36721
|
function getItemFields(itemId2) {
|
|
36513
36722
|
try {
|
|
@@ -36531,14 +36740,14 @@ async function selectOpSecret(searchTerm) {
|
|
|
36531
36740
|
name: "search",
|
|
36532
36741
|
message: "Search 1Password for API key item:"
|
|
36533
36742
|
}).run();
|
|
36534
|
-
const
|
|
36535
|
-
if (
|
|
36743
|
+
const items3 = searchItems(search2);
|
|
36744
|
+
if (items3.length === 0) {
|
|
36536
36745
|
console.error(chalk212.red(`No items found matching "${search2}".`));
|
|
36537
36746
|
process.exit(1);
|
|
36538
36747
|
}
|
|
36539
36748
|
const itemId2 = await selectOne(
|
|
36540
36749
|
"Select item:",
|
|
36541
|
-
|
|
36750
|
+
items3.map((i) => ({ name: `${i.title} (${i.vault.name})`, value: i.id }))
|
|
36542
36751
|
);
|
|
36543
36752
|
const fields = getItemFields(itemId2);
|
|
36544
36753
|
if (fields.length === 0) {
|
|
@@ -38370,9 +38579,9 @@ function getCalledFunctionNames(fn) {
|
|
|
38370
38579
|
function collectPrivateFunctions(target, fnMap) {
|
|
38371
38580
|
const collected = /* @__PURE__ */ new Set();
|
|
38372
38581
|
const queue = [target];
|
|
38373
|
-
let
|
|
38374
|
-
while (
|
|
38375
|
-
for (const name of getCalledFunctionNames(
|
|
38582
|
+
let current2 = queue.pop();
|
|
38583
|
+
while (current2) {
|
|
38584
|
+
for (const name of getCalledFunctionNames(current2)) {
|
|
38376
38585
|
if (collected.has(name)) continue;
|
|
38377
38586
|
const fn = fnMap.get(name);
|
|
38378
38587
|
if (fn && isPrivate(fn)) {
|
|
@@ -38380,7 +38589,7 @@ function collectPrivateFunctions(target, fnMap) {
|
|
|
38380
38589
|
queue.push(fn);
|
|
38381
38590
|
}
|
|
38382
38591
|
}
|
|
38383
|
-
|
|
38592
|
+
current2 = queue.pop();
|
|
38384
38593
|
}
|
|
38385
38594
|
return [...collected].flatMap((name) => {
|
|
38386
38595
|
const fn = fnMap.get(name);
|
|
@@ -38771,15 +38980,15 @@ var DECLARATION_KINDS = /* @__PURE__ */ new Set([
|
|
|
38771
38980
|
SyntaxKind18.ExportSpecifier
|
|
38772
38981
|
]);
|
|
38773
38982
|
function isInsideExtractedFunction(node, extracted) {
|
|
38774
|
-
let
|
|
38775
|
-
while (
|
|
38776
|
-
if (
|
|
38777
|
-
|
|
38983
|
+
let current2 = node;
|
|
38984
|
+
while (current2) {
|
|
38985
|
+
if (current2.getKind() !== SyntaxKind18.FunctionDeclaration) {
|
|
38986
|
+
current2 = current2.getParent();
|
|
38778
38987
|
continue;
|
|
38779
38988
|
}
|
|
38780
|
-
const name =
|
|
38989
|
+
const name = current2.getName?.();
|
|
38781
38990
|
if (name && extracted.has(name)) return true;
|
|
38782
|
-
|
|
38991
|
+
current2 = current2.getParent();
|
|
38783
38992
|
}
|
|
38784
38993
|
return false;
|
|
38785
38994
|
}
|
|
@@ -40271,39 +40480,39 @@ var highLevelConfigKeys = {
|
|
|
40271
40480
|
};
|
|
40272
40481
|
|
|
40273
40482
|
// src/commands/review/highLevel/buildHighLevelQuestions.ts
|
|
40274
|
-
function buildHighLevelQuestions(
|
|
40483
|
+
function buildHighLevelQuestions(current2, proposed) {
|
|
40275
40484
|
return [
|
|
40276
40485
|
{
|
|
40277
40486
|
key: highLevelConfigKeys.criticalPaths,
|
|
40278
40487
|
question: "Critical paths \u2014 comma-separated globs whose full diffs the review shows (blank to leave unset)",
|
|
40279
40488
|
suggest: suggestCriticalPaths(
|
|
40280
|
-
|
|
40489
|
+
current2.criticalPaths,
|
|
40281
40490
|
proposed.criticalPaths
|
|
40282
40491
|
)
|
|
40283
40492
|
},
|
|
40284
40493
|
{
|
|
40285
40494
|
key: highLevelConfigKeys.uiPaths,
|
|
40286
40495
|
question: "UI paths \u2014 comma-separated globs that make a change a UI change, so a screenshot or video is required (blank to leave unset)",
|
|
40287
|
-
suggest: suggestGlobs(
|
|
40496
|
+
suggest: suggestGlobs(current2.uiPaths, proposed.uiPaths)
|
|
40288
40497
|
},
|
|
40289
40498
|
{
|
|
40290
40499
|
key: highLevelConfigKeys.descriptionWordCap,
|
|
40291
40500
|
question: "Description word cap (blank to leave unset)",
|
|
40292
|
-
suggest: String(
|
|
40501
|
+
suggest: String(current2.descriptionWordCap)
|
|
40293
40502
|
},
|
|
40294
40503
|
{
|
|
40295
40504
|
key: highLevelConfigKeys.collapsedPaths,
|
|
40296
40505
|
question: "Collapsed paths \u2014 comma-separated globs whose files start collapsed in the changed-files tree (blank to leave unset)",
|
|
40297
|
-
suggest: suggestGlobs(
|
|
40506
|
+
suggest: suggestGlobs(current2.collapsedPaths, [])
|
|
40298
40507
|
}
|
|
40299
40508
|
];
|
|
40300
40509
|
}
|
|
40301
|
-
function suggestCriticalPaths(
|
|
40302
|
-
if (
|
|
40510
|
+
function suggestCriticalPaths(current2, proposed) {
|
|
40511
|
+
if (current2) return suggestGlobs(current2, []);
|
|
40303
40512
|
return [.../* @__PURE__ */ new Set([...defaultCriticalPaths, ...proposed])].join(",");
|
|
40304
40513
|
}
|
|
40305
|
-
function suggestGlobs(
|
|
40306
|
-
const globs =
|
|
40514
|
+
function suggestGlobs(current2, proposed) {
|
|
40515
|
+
const globs = current2.length > 0 ? current2 : proposed;
|
|
40307
40516
|
return globs.length > 0 ? globs.join(",") : void 0;
|
|
40308
40517
|
}
|
|
40309
40518
|
|
|
@@ -40473,11 +40682,11 @@ var NOTHING_PROPOSED2 = { criticalPaths: [], uiPaths: [] };
|
|
|
40473
40682
|
async function configureHighLevelReview(options2 = {}) {
|
|
40474
40683
|
const answers = parseConfigureAnswers(options2.answer ?? []);
|
|
40475
40684
|
const proposed = answersCoverEveryKey(answers) ? NOTHING_PROPOSED2 : proposeHighLevelGlobs();
|
|
40476
|
-
const
|
|
40685
|
+
const current2 = resolveHighLevelConfig(loadConfig());
|
|
40477
40686
|
const questions = buildHighLevelQuestions(
|
|
40478
40687
|
{
|
|
40479
|
-
...
|
|
40480
|
-
criticalPaths: isConfigKeySet(highLevelConfigKeys.criticalPaths) ?
|
|
40688
|
+
...current2,
|
|
40689
|
+
criticalPaths: isConfigKeySet(highLevelConfigKeys.criticalPaths) ? current2.criticalPaths : void 0
|
|
40481
40690
|
},
|
|
40482
40691
|
proposed
|
|
40483
40692
|
);
|
|
@@ -40910,14 +41119,14 @@ function fetchHighLevelFiles(prNumber, repo) {
|
|
|
40910
41119
|
import { execSync as execSync57 } from "child_process";
|
|
40911
41120
|
|
|
40912
41121
|
// src/commands/review/highLevel/waitForMergeable.ts
|
|
40913
|
-
var
|
|
41122
|
+
var MAX_ATTEMPTS2 = 5;
|
|
40914
41123
|
var DELAY_MS = 2e3;
|
|
40915
41124
|
function sleepSync2(ms) {
|
|
40916
41125
|
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
40917
41126
|
}
|
|
40918
41127
|
function waitForMergeable(initial, refetch, delayMs = DELAY_MS) {
|
|
40919
41128
|
let mergeable = initial;
|
|
40920
|
-
for (let attempt2 = 1; mergeable === "UNKNOWN" && attempt2 <
|
|
41129
|
+
for (let attempt2 = 1; mergeable === "UNKNOWN" && attempt2 < MAX_ATTEMPTS2; attempt2++) {
|
|
40921
41130
|
sleepSync2(delayMs);
|
|
40922
41131
|
mergeable = refetch();
|
|
40923
41132
|
}
|
|
@@ -41707,13 +41916,13 @@ function formatItem(item) {
|
|
|
41707
41916
|
const comment3 = item.comment.replace(/\n/g, "\n ");
|
|
41708
41917
|
return `- ${statusMarkers[item.status]} **${item.title}** \u2014 ${comment3}`;
|
|
41709
41918
|
}
|
|
41710
|
-
function findings(
|
|
41711
|
-
const lines2 =
|
|
41919
|
+
function findings(items3) {
|
|
41920
|
+
const lines2 = items3.map(formatItem).filter((line) => line !== void 0);
|
|
41712
41921
|
return lines2.length > 0 ? lines2.join("\n") : void 0;
|
|
41713
41922
|
}
|
|
41714
|
-
function sliceSections(
|
|
41923
|
+
function sliceSections(items3) {
|
|
41715
41924
|
const bySlice = /* @__PURE__ */ new Map();
|
|
41716
|
-
for (const item of
|
|
41925
|
+
for (const item of items3)
|
|
41717
41926
|
if (item.slice !== void 0)
|
|
41718
41927
|
bySlice.set(item.slice, [...bySlice.get(item.slice) ?? [], item]);
|
|
41719
41928
|
return [...bySlice].flatMap(([number, sliceItems]) => {
|
|
@@ -41725,11 +41934,11 @@ function sliceSections(items2) {
|
|
|
41725
41934
|
${lines2}`];
|
|
41726
41935
|
});
|
|
41727
41936
|
}
|
|
41728
|
-
function formatHighLevelReviewBody(
|
|
41937
|
+
function formatHighLevelReviewBody(items3, reviewComments2 = []) {
|
|
41729
41938
|
const sections = [];
|
|
41730
|
-
const prWide = findings(
|
|
41939
|
+
const prWide = findings(items3.filter((item) => item.slice === void 0));
|
|
41731
41940
|
if (prWide) sections.push(prWide);
|
|
41732
|
-
sections.push(...sliceSections(
|
|
41941
|
+
sections.push(...sliceSections(items3));
|
|
41733
41942
|
if (reviewComments2.length > 0)
|
|
41734
41943
|
sections.push(
|
|
41735
41944
|
`**Comments**
|
|
@@ -41776,22 +41985,22 @@ function postHighLevelReview(repo, prNumber, { event, body, comments: comments3
|
|
|
41776
41985
|
var HUNK_HEADER2 = /^@@ -(\d+)(?:,\d+)? \+(\d+)/;
|
|
41777
41986
|
function patchHunkLines(patch2) {
|
|
41778
41987
|
const hunks = [];
|
|
41779
|
-
let
|
|
41988
|
+
let current2;
|
|
41780
41989
|
let left = 0;
|
|
41781
41990
|
let right = 0;
|
|
41782
41991
|
for (const line of patch2.split("\n")) {
|
|
41783
41992
|
const header = HUNK_HEADER2.exec(line);
|
|
41784
41993
|
if (header) {
|
|
41785
|
-
|
|
41786
|
-
hunks.push(
|
|
41994
|
+
current2 = { LEFT: /* @__PURE__ */ new Set(), RIGHT: /* @__PURE__ */ new Set() };
|
|
41995
|
+
hunks.push(current2);
|
|
41787
41996
|
left = Number(header[1]);
|
|
41788
41997
|
right = Number(header[2]);
|
|
41789
|
-
} else if (!
|
|
41790
|
-
else if (line.startsWith("+"))
|
|
41791
|
-
else if (line.startsWith("-"))
|
|
41998
|
+
} else if (!current2 || line.startsWith("\\")) continue;
|
|
41999
|
+
else if (line.startsWith("+")) current2.RIGHT.add(right++);
|
|
42000
|
+
else if (line.startsWith("-")) current2.LEFT.add(left++);
|
|
41792
42001
|
else {
|
|
41793
|
-
|
|
41794
|
-
|
|
42002
|
+
current2.LEFT.add(left++);
|
|
42003
|
+
current2.RIGHT.add(right++);
|
|
41795
42004
|
}
|
|
41796
42005
|
}
|
|
41797
42006
|
return hunks;
|
|
@@ -43073,8 +43282,8 @@ import { spawn as spawn9 } from "child_process";
|
|
|
43073
43282
|
// src/commands/review/attachStdoutTail.ts
|
|
43074
43283
|
function attachStdoutTail(child, maxBytes = 8192) {
|
|
43075
43284
|
const state = { value: "" };
|
|
43076
|
-
child.stdout?.on("data", (
|
|
43077
|
-
state.value +=
|
|
43285
|
+
child.stdout?.on("data", (chunk2) => {
|
|
43286
|
+
state.value += chunk2.toString("utf8");
|
|
43078
43287
|
if (state.value.length > maxBytes) {
|
|
43079
43288
|
state.value = state.value.slice(state.value.length - maxBytes);
|
|
43080
43289
|
}
|
|
@@ -43614,7 +43823,7 @@ async function synthesiseAfterReviewers(input) {
|
|
|
43614
43823
|
}
|
|
43615
43824
|
|
|
43616
43825
|
// src/commands/review/skipReason.ts
|
|
43617
|
-
function
|
|
43826
|
+
function skipReason(results, failures, strict) {
|
|
43618
43827
|
if (failures.length === results.length)
|
|
43619
43828
|
return "Both reviewers failed; skipping synthesis.";
|
|
43620
43829
|
if (strict && failures.length > 0)
|
|
@@ -43643,7 +43852,7 @@ async function runAndSynthesise(args) {
|
|
|
43643
43852
|
);
|
|
43644
43853
|
if (args.job) await recordReviewerRuns(fresh, args.job, startedAt);
|
|
43645
43854
|
const failures = failed2(results);
|
|
43646
|
-
const reason4 =
|
|
43855
|
+
const reason4 = skipReason(results, failures, args.strict);
|
|
43647
43856
|
if (reason4) {
|
|
43648
43857
|
console.error(reason4);
|
|
43649
43858
|
return { ok: false, failures, slots: results };
|
|
@@ -43788,12 +43997,12 @@ function formatThread(thread) {
|
|
|
43788
43997
|
var INTRO = `The PR already has the review comments below (including resolved and outdated threads). Avoid re-raising findings that a prior comment substantively covers.`;
|
|
43789
43998
|
function formatPriorComments(comments3) {
|
|
43790
43999
|
if (comments3.length === 0) return "";
|
|
43791
|
-
const
|
|
44000
|
+
const blocks2 = groupIntoThreads(comments3).map(formatThread);
|
|
43792
44001
|
return `## Prior review comments
|
|
43793
44002
|
|
|
43794
44003
|
${INTRO}
|
|
43795
44004
|
|
|
43796
|
-
${
|
|
44005
|
+
${blocks2.join("\n\n")}`;
|
|
43797
44006
|
}
|
|
43798
44007
|
|
|
43799
44008
|
// src/commands/review/buildRequest.ts
|
|
@@ -44149,10 +44358,10 @@ function currentPrNumber() {
|
|
|
44149
44358
|
}
|
|
44150
44359
|
}
|
|
44151
44360
|
function stillOnReviewedPr(prNumber) {
|
|
44152
|
-
const
|
|
44153
|
-
if (
|
|
44361
|
+
const current2 = currentPrNumber();
|
|
44362
|
+
if (current2 === prNumber) return true;
|
|
44154
44363
|
console.error(
|
|
44155
|
-
`Error: this tree is now on ${
|
|
44364
|
+
`Error: this tree is now on ${current2 === null ? "a branch with no open PR" : `PR #${current2}`}, not the reviewed PR #${prNumber}; skipping the post and any chained sessions.`
|
|
44156
44365
|
);
|
|
44157
44366
|
return false;
|
|
44158
44367
|
}
|
|
@@ -44721,12 +44930,12 @@ function resolveRuleScope(target) {
|
|
|
44721
44930
|
if (path90.basename(resolved) === "CLAUDE.md") return resolved;
|
|
44722
44931
|
const startDir = scopeDirectory(resolved);
|
|
44723
44932
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
44724
|
-
let
|
|
44933
|
+
let current2 = startDir;
|
|
44725
44934
|
while (true) {
|
|
44726
|
-
const candidate = path90.join(
|
|
44935
|
+
const candidate = path90.join(current2, "CLAUDE.md");
|
|
44727
44936
|
if (existsSync76(candidate)) return candidate;
|
|
44728
|
-
if (
|
|
44729
|
-
|
|
44937
|
+
if (current2 === root2 || current2 === path90.dirname(current2)) break;
|
|
44938
|
+
current2 = path90.dirname(current2);
|
|
44730
44939
|
}
|
|
44731
44940
|
return path90.join(root2, "CLAUDE.md");
|
|
44732
44941
|
}
|
|
@@ -44777,8 +44986,8 @@ function optionsError(options2) {
|
|
|
44777
44986
|
return void 0;
|
|
44778
44987
|
}
|
|
44779
44988
|
async function addToUserDb(rule) {
|
|
44780
|
-
const result = await applyUserConfigSet("advice.rules", (
|
|
44781
|
-
...asRules(
|
|
44989
|
+
const result = await applyUserConfigSet("advice.rules", (current2) => [
|
|
44990
|
+
...asRules(current2),
|
|
44782
44991
|
rule
|
|
44783
44992
|
]);
|
|
44784
44993
|
if (!result.ok) return fail10(result.errors.join("\n"));
|
|
@@ -46371,23 +46580,23 @@ function joinWithOverlap(currentText, nextText) {
|
|
|
46371
46580
|
}
|
|
46372
46581
|
return currentText.includes(nextText) ? currentText : `${currentText} ${nextText}`;
|
|
46373
46582
|
}
|
|
46374
|
-
function canMergeCues(
|
|
46375
|
-
return
|
|
46583
|
+
function canMergeCues(current2, next3) {
|
|
46584
|
+
return current2.speaker === next3.speaker && next3.startMs <= current2.endMs + 500;
|
|
46376
46585
|
}
|
|
46377
46586
|
function mergeOverlappingCues(cues) {
|
|
46378
46587
|
if (cues.length === 0) return [];
|
|
46379
46588
|
const result = [];
|
|
46380
|
-
let
|
|
46589
|
+
let current2 = { ...cues[0] };
|
|
46381
46590
|
for (let i = 1; i < cues.length; i++) {
|
|
46382
|
-
if (canMergeCues(
|
|
46383
|
-
|
|
46384
|
-
|
|
46591
|
+
if (canMergeCues(current2, cues[i])) {
|
|
46592
|
+
current2.text = joinWithOverlap(current2.text, cues[i].text);
|
|
46593
|
+
current2.endMs = Math.max(current2.endMs, cues[i].endMs);
|
|
46385
46594
|
} else {
|
|
46386
|
-
result.push(
|
|
46387
|
-
|
|
46595
|
+
result.push(current2);
|
|
46596
|
+
current2 = { ...cues[i] };
|
|
46388
46597
|
}
|
|
46389
46598
|
}
|
|
46390
|
-
result.push(
|
|
46599
|
+
result.push(current2);
|
|
46391
46600
|
return result;
|
|
46392
46601
|
}
|
|
46393
46602
|
function deduplicateCues(cues) {
|
|
@@ -46579,8 +46788,8 @@ function askQuestion2(rl, question) {
|
|
|
46579
46788
|
}
|
|
46580
46789
|
|
|
46581
46790
|
// src/commands/transcript/configure.ts
|
|
46582
|
-
function buildPrompt4(label,
|
|
46583
|
-
return
|
|
46791
|
+
function buildPrompt4(label, current2) {
|
|
46792
|
+
return current2 ? `${label} [${current2}]: ` : `${label}: `;
|
|
46584
46793
|
}
|
|
46585
46794
|
function printExisting(existing) {
|
|
46586
46795
|
console.log("Current configuration:");
|
|
@@ -47309,14 +47518,14 @@ import { existsSync as existsSync86, readFileSync as readFileSync71 } from "fs";
|
|
|
47309
47518
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
47310
47519
|
import { minimatch as minimatch10 } from "minimatch";
|
|
47311
47520
|
function resolveStringsAtPath(data, path109) {
|
|
47312
|
-
let
|
|
47521
|
+
let current2 = data;
|
|
47313
47522
|
for (const segment of path109.split(".")) {
|
|
47314
|
-
if (
|
|
47315
|
-
|
|
47523
|
+
if (current2 === null || typeof current2 !== "object") return [];
|
|
47524
|
+
current2 = current2[segment];
|
|
47316
47525
|
}
|
|
47317
|
-
if (typeof
|
|
47318
|
-
if (Array.isArray(
|
|
47319
|
-
return
|
|
47526
|
+
if (typeof current2 === "string") return [current2];
|
|
47527
|
+
if (Array.isArray(current2))
|
|
47528
|
+
return current2.filter(
|
|
47320
47529
|
(value) => typeof value === "string"
|
|
47321
47530
|
);
|
|
47322
47531
|
return [];
|
|
@@ -47427,10 +47636,10 @@ import { readFileSync as readFileSync72 } from "fs";
|
|
|
47427
47636
|
import path105 from "path";
|
|
47428
47637
|
|
|
47429
47638
|
// src/commands/verify/migrations/checkAppendOnly.ts
|
|
47430
|
-
function checkAppendOnly(baseline,
|
|
47639
|
+
function checkAppendOnly(baseline, current2) {
|
|
47431
47640
|
const findings2 = [];
|
|
47432
47641
|
for (const [file, content] of baseline) {
|
|
47433
|
-
const now =
|
|
47642
|
+
const now = current2.get(file);
|
|
47434
47643
|
if (now === void 0) findings2.push({ file, kind: "removed" });
|
|
47435
47644
|
else if (now !== content) findings2.push({ file, kind: "modified" });
|
|
47436
47645
|
}
|
|
@@ -47587,10 +47796,10 @@ function migrations2() {
|
|
|
47587
47796
|
const ref = resolveBaselineRef();
|
|
47588
47797
|
if (ref) {
|
|
47589
47798
|
const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
|
|
47590
|
-
const
|
|
47799
|
+
const current2 = new Map(
|
|
47591
47800
|
files.map((file) => [file, readFileSync72(path105.join(dir, file), "utf8")])
|
|
47592
47801
|
);
|
|
47593
|
-
for (const finding of checkAppendOnly(baseline,
|
|
47802
|
+
for (const finding of checkAppendOnly(baseline, current2)) {
|
|
47594
47803
|
problems.push(
|
|
47595
47804
|
finding.kind === "removed" ? `Migration ${finding.file} was removed but ships in ${ref}; migrations are append-only once shipped.` : `Migration ${finding.file} was edited but already ships in ${ref}; migrations are append-only. Add a new numbered migration instead.`
|
|
47596
47805
|
);
|
|
@@ -49905,8 +50114,8 @@ import { readFile as readFile9 } from "fs/promises";
|
|
|
49905
50114
|
function normalise2(path109) {
|
|
49906
50115
|
return path109.replaceAll("\\", "/");
|
|
49907
50116
|
}
|
|
49908
|
-
function latest(
|
|
49909
|
-
return
|
|
50117
|
+
function latest(current2, at2) {
|
|
50118
|
+
return current2 === void 0 || at2 > current2 ? at2 : current2;
|
|
49910
50119
|
}
|
|
49911
50120
|
async function lastWriteTimes(transcriptPath2, target) {
|
|
49912
50121
|
const text20 = await readFile9(transcriptPath2, "utf8").catch(() => "");
|
|
@@ -51265,8 +51474,8 @@ function runUpdateLap(cwd, onOutput) {
|
|
|
51265
51474
|
child.kill();
|
|
51266
51475
|
};
|
|
51267
51476
|
process.on("exit", killWithDaemon);
|
|
51268
|
-
child.stdout.on("data", (
|
|
51269
|
-
child.stderr.on("data", (
|
|
51477
|
+
child.stdout.on("data", (chunk2) => onOutput(chunk2.toString()));
|
|
51478
|
+
child.stderr.on("data", (chunk2) => onOutput(chunk2.toString()));
|
|
51270
51479
|
child.on("close", (code, signal) => {
|
|
51271
51480
|
process.off("exit", killWithDaemon);
|
|
51272
51481
|
resolve34({ code, signal });
|
|
@@ -51313,7 +51522,7 @@ function startAutoUpdate(ctx) {
|
|
|
51313
51522
|
stayOff(`${installDir} is not a git clone`);
|
|
51314
51523
|
return;
|
|
51315
51524
|
}
|
|
51316
|
-
autoUpdateState.setStartCommit(
|
|
51525
|
+
autoUpdateState.setStartCommit(headCommit2(installDir));
|
|
51317
51526
|
if (!autoUpdateEnabled(installDir)) {
|
|
51318
51527
|
stayOff("autoUpdate.enabled is false");
|
|
51319
51528
|
return;
|
|
@@ -51542,8 +51751,8 @@ function owningClone(worktreePath) {
|
|
|
51542
51751
|
}
|
|
51543
51752
|
async function deleteWorktreeBranch(clone, branch2) {
|
|
51544
51753
|
if (!listLocalBranches(clone).includes(branch2)) return;
|
|
51545
|
-
const
|
|
51546
|
-
if (branch2 ===
|
|
51754
|
+
const current2 = await gitOrNull(clone, ["symbolic-ref", "--short", "HEAD"]);
|
|
51755
|
+
if (branch2 === current2) return;
|
|
51547
51756
|
try {
|
|
51548
51757
|
await git2(clone, ["branch", "-D", branch2]);
|
|
51549
51758
|
daemonLog(`worktree branch ${branch2} deleted from clone ${clone}`);
|
|
@@ -51793,12 +52002,12 @@ function readOccupant(pid, procRoot = "/proc") {
|
|
|
51793
52002
|
};
|
|
51794
52003
|
}
|
|
51795
52004
|
function underVsCode(pid, procRoot) {
|
|
51796
|
-
let
|
|
51797
|
-
for (let depth = 0;
|
|
51798
|
-
const cmdline = readProc(procRoot,
|
|
52005
|
+
let current2 = pid;
|
|
52006
|
+
for (let depth = 0; current2 && current2 > 1 && depth < MAX_ANCESTORS; depth++) {
|
|
52007
|
+
const cmdline = readProc(procRoot, current2, "cmdline");
|
|
51799
52008
|
if (cmdline && VSCODE_PATHS.some((path109) => cmdline.includes(path109)))
|
|
51800
52009
|
return true;
|
|
51801
|
-
|
|
52010
|
+
current2 = parentPid(readProc(procRoot, current2, "stat"));
|
|
51802
52011
|
}
|
|
51803
52012
|
return false;
|
|
51804
52013
|
}
|
|
@@ -52164,7 +52373,7 @@ function autoApprovePreview(sessions, waiters, notify2, session) {
|
|
|
52164
52373
|
// src/commands/sessions/daemon/parsePreviewMetadata.ts
|
|
52165
52374
|
function parsePreviewMetadata(value) {
|
|
52166
52375
|
if (!Array.isArray(value)) return void 0;
|
|
52167
|
-
const
|
|
52376
|
+
const items3 = value.flatMap((entry) => {
|
|
52168
52377
|
const {
|
|
52169
52378
|
label,
|
|
52170
52379
|
value: text20,
|
|
@@ -52175,7 +52384,7 @@ function parsePreviewMetadata(value) {
|
|
|
52175
52384
|
typeof url === "string" ? { label, value: text20, url } : { label, value: text20 }
|
|
52176
52385
|
];
|
|
52177
52386
|
});
|
|
52178
|
-
return
|
|
52387
|
+
return items3.length > 0 ? items3 : void 0;
|
|
52179
52388
|
}
|
|
52180
52389
|
|
|
52181
52390
|
// src/commands/sessions/daemon/buildPrPreview.ts
|
|
@@ -52842,13 +53051,13 @@ async function touchedSince(file, sinceMs) {
|
|
|
52842
53051
|
|
|
52843
53052
|
// src/commands/sessions/daemon/bindCodexSession.ts
|
|
52844
53053
|
var POLL_MS6 = 1e3;
|
|
52845
|
-
var
|
|
53054
|
+
var MAX_ATTEMPTS3 = 120;
|
|
52846
53055
|
var START_SLACK_MS = 5e3;
|
|
52847
53056
|
function bindCodexSession(session, notify2) {
|
|
52848
53057
|
const cwd = session.cwd;
|
|
52849
53058
|
if (session.harness !== "codex" || !cwd || session.harnessSessionId) return;
|
|
52850
53059
|
const since = session.startedAt - START_SLACK_MS;
|
|
52851
|
-
let attemptsLeft =
|
|
53060
|
+
let attemptsLeft = MAX_ATTEMPTS3;
|
|
52852
53061
|
const schedule = () => setTimeout(() => void poll(), POLL_MS6).unref();
|
|
52853
53062
|
const poll = async () => {
|
|
52854
53063
|
if (session.harnessSessionId) return;
|
|
@@ -56977,7 +57186,7 @@ function findTitleMatch(title, query) {
|
|
|
56977
57186
|
}
|
|
56978
57187
|
|
|
56979
57188
|
// src/commands/sessions/daemon/historySearch/searchHistory.ts
|
|
56980
|
-
var
|
|
57189
|
+
var BATCH_SIZE2 = 16;
|
|
56981
57190
|
var MAX_RESULTS2 = 100;
|
|
56982
57191
|
function inRepo(cwd) {
|
|
56983
57192
|
const selectedKey = repoGroupForCwd(cwd)?.origin || cwd;
|
|
@@ -56999,9 +57208,9 @@ async function matchBatch(batch, query) {
|
|
|
56999
57208
|
async function searchHistory(cwd, query) {
|
|
57000
57209
|
const candidates = (await discoverHistoryEntries()).filter(inRepo(cwd));
|
|
57001
57210
|
const hits = [];
|
|
57002
|
-
for (let i = 0; i < candidates.length && hits.length < MAX_RESULTS2; i +=
|
|
57211
|
+
for (let i = 0; i < candidates.length && hits.length < MAX_RESULTS2; i += BATCH_SIZE2)
|
|
57003
57212
|
hits.push(
|
|
57004
|
-
...await matchBatch(candidates.slice(i, i +
|
|
57213
|
+
...await matchBatch(candidates.slice(i, i + BATCH_SIZE2), query)
|
|
57005
57214
|
);
|
|
57006
57215
|
return withRepoGroups(hits.slice(0, MAX_RESULTS2));
|
|
57007
57216
|
}
|