@staff0rd/assist 0.344.1 → 0.345.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/claude/settings.json +3 -0
- package/dist/commands/sessions/web/bundle.js +85 -85
- package/dist/index.js +97 -50
- 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.345.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -5656,11 +5656,6 @@ function delay(ms) {
|
|
|
5656
5656
|
return new Promise((resolve17) => setTimeout(resolve17, ms));
|
|
5657
5657
|
}
|
|
5658
5658
|
|
|
5659
|
-
// src/commands/sessions/web/handleRequest.ts
|
|
5660
|
-
import { createHash as createHash2 } from "crypto";
|
|
5661
|
-
import { readFileSync as readFileSync18 } from "fs";
|
|
5662
|
-
import { createRequire as createRequire2 } from "module";
|
|
5663
|
-
|
|
5664
5659
|
// src/shared/createBundleHandler.ts
|
|
5665
5660
|
import { createHash } from "crypto";
|
|
5666
5661
|
import { readFileSync as readFileSync16 } from "fs";
|
|
@@ -5764,6 +5759,79 @@ async function getBacklogExists(req, res) {
|
|
|
5764
5759
|
respondJson(res, 200, { exists: await backlogHasItems() });
|
|
5765
5760
|
}
|
|
5766
5761
|
|
|
5762
|
+
// src/commands/backlog/originDisplayName.ts
|
|
5763
|
+
function originDisplayName(origin) {
|
|
5764
|
+
if (origin.startsWith("local:")) {
|
|
5765
|
+
const path57 = origin.slice("local:".length).replace(/\/+$/, "");
|
|
5766
|
+
const segments = path57.split("/").filter(Boolean);
|
|
5767
|
+
return segments[segments.length - 1] ?? origin;
|
|
5768
|
+
}
|
|
5769
|
+
const firstSlash = origin.indexOf("/");
|
|
5770
|
+
if (firstSlash === -1) return origin;
|
|
5771
|
+
return origin.slice(firstSlash + 1);
|
|
5772
|
+
}
|
|
5773
|
+
|
|
5774
|
+
// src/commands/backlog/originDisplayLabels.ts
|
|
5775
|
+
function originDisplayLabels(origins) {
|
|
5776
|
+
const isLocal = (origin) => origin.startsWith("local:");
|
|
5777
|
+
const bareName = (origin) => {
|
|
5778
|
+
const full = originDisplayName(origin);
|
|
5779
|
+
const segments = full.split("/");
|
|
5780
|
+
return segments[segments.length - 1] ?? full;
|
|
5781
|
+
};
|
|
5782
|
+
const remoteCounts = /* @__PURE__ */ new Map();
|
|
5783
|
+
for (const origin of new Set(origins)) {
|
|
5784
|
+
if (isLocal(origin)) continue;
|
|
5785
|
+
const name = bareName(origin);
|
|
5786
|
+
remoteCounts.set(name, (remoteCounts.get(name) ?? 0) + 1);
|
|
5787
|
+
}
|
|
5788
|
+
const labels = /* @__PURE__ */ new Map();
|
|
5789
|
+
for (const origin of origins) {
|
|
5790
|
+
if (isLocal(origin)) {
|
|
5791
|
+
labels.set(origin, originDisplayName(origin));
|
|
5792
|
+
continue;
|
|
5793
|
+
}
|
|
5794
|
+
const name = bareName(origin);
|
|
5795
|
+
const collides = (remoteCounts.get(name) ?? 0) > 1;
|
|
5796
|
+
labels.set(origin, collides ? originDisplayName(origin) : name);
|
|
5797
|
+
}
|
|
5798
|
+
return labels;
|
|
5799
|
+
}
|
|
5800
|
+
|
|
5801
|
+
// src/commands/backlog/loadRepoSummaries.ts
|
|
5802
|
+
var completedStatuses = /* @__PURE__ */ new Set(["done", "wontdo"]);
|
|
5803
|
+
async function loadRepoSummaries(currentOrigin, knownCwds = []) {
|
|
5804
|
+
const { orm } = await getReady();
|
|
5805
|
+
const summaries = await loadItemSummaries(orm, void 0);
|
|
5806
|
+
const openCounts = /* @__PURE__ */ new Map();
|
|
5807
|
+
for (const item of summaries) {
|
|
5808
|
+
if (!item.origin || completedStatuses.has(item.status)) continue;
|
|
5809
|
+
openCounts.set(item.origin, (openCounts.get(item.origin) ?? 0) + 1);
|
|
5810
|
+
}
|
|
5811
|
+
const cwdByOrigin = /* @__PURE__ */ new Map();
|
|
5812
|
+
for (const cwd of knownCwds) {
|
|
5813
|
+
const origin = getCurrentOrigin(cwd);
|
|
5814
|
+
if (!cwdByOrigin.has(origin)) cwdByOrigin.set(origin, cwd);
|
|
5815
|
+
}
|
|
5816
|
+
const labels = originDisplayLabels([...openCounts.keys()]);
|
|
5817
|
+
return [...openCounts.entries()].map(([origin, openCount]) => ({
|
|
5818
|
+
origin,
|
|
5819
|
+
displayName: labels.get(origin) ?? origin,
|
|
5820
|
+
openCount,
|
|
5821
|
+
isCurrent: origin === currentOrigin,
|
|
5822
|
+
cwd: cwdByOrigin.get(origin)
|
|
5823
|
+
})).sort((a, b) => a.displayName.localeCompare(b.displayName));
|
|
5824
|
+
}
|
|
5825
|
+
|
|
5826
|
+
// src/commands/backlog/web/getBacklogSummary.ts
|
|
5827
|
+
async function getBacklogSummary(req, res) {
|
|
5828
|
+
const url = new URL(req.url ?? "/", "http://localhost");
|
|
5829
|
+
const cwd = url.searchParams.get("cwd") ?? void 0;
|
|
5830
|
+
const knownCwds = url.searchParams.getAll("knownCwd");
|
|
5831
|
+
const currentOrigin = cwd ? getCurrentOrigin(cwd) : getOrigin();
|
|
5832
|
+
respondJson(res, 200, await loadRepoSummaries(currentOrigin, knownCwds));
|
|
5833
|
+
}
|
|
5834
|
+
|
|
5767
5835
|
// src/commands/backlog/deleteComment.ts
|
|
5768
5836
|
import { and as and4, eq as eq14 } from "drizzle-orm";
|
|
5769
5837
|
async function deleteComment(orm, itemId, commentId) {
|
|
@@ -5782,13 +5850,13 @@ async function updateStarred(orm, id2, starred) {
|
|
|
5782
5850
|
}
|
|
5783
5851
|
|
|
5784
5852
|
// src/commands/backlog/web/loadVisibleItems.ts
|
|
5785
|
-
var
|
|
5853
|
+
var completedStatuses2 = /* @__PURE__ */ new Set(["done", "wontdo"]);
|
|
5786
5854
|
async function loadVisibleItems(req) {
|
|
5787
5855
|
const params = new URL(req.url ?? "/", "http://localhost").searchParams;
|
|
5788
5856
|
const q = params.get("q");
|
|
5789
5857
|
const loaded = q ? await searchBacklogSummaries(q) : await loadBacklogSummaries();
|
|
5790
5858
|
if (params.get("showCompleted") === "true") return loaded;
|
|
5791
|
-
return loaded.filter((item) => !
|
|
5859
|
+
return loaded.filter((item) => !completedStatuses2.has(item.status));
|
|
5792
5860
|
}
|
|
5793
5861
|
|
|
5794
5862
|
// src/commands/backlog/web/parseStatusBody.ts
|
|
@@ -6575,7 +6643,10 @@ async function restartWeb(req, res, deps2 = {}) {
|
|
|
6575
6643
|
}
|
|
6576
6644
|
}
|
|
6577
6645
|
|
|
6578
|
-
// src/commands/sessions/web/
|
|
6646
|
+
// src/commands/sessions/web/createCssHandler.ts
|
|
6647
|
+
import { createHash as createHash2 } from "crypto";
|
|
6648
|
+
import { readFileSync as readFileSync18 } from "fs";
|
|
6649
|
+
import { createRequire as createRequire2 } from "module";
|
|
6579
6650
|
var require3 = createRequire2(import.meta.url);
|
|
6580
6651
|
function createCssHandler(packageEntry) {
|
|
6581
6652
|
let cache;
|
|
@@ -6596,6 +6667,8 @@ function createCssHandler(packageEntry) {
|
|
|
6596
6667
|
res.end(cache.body);
|
|
6597
6668
|
};
|
|
6598
6669
|
}
|
|
6670
|
+
|
|
6671
|
+
// src/commands/sessions/web/handleRequest.ts
|
|
6599
6672
|
var htmlHandler = createHtmlHandler(getHtml);
|
|
6600
6673
|
var routes2 = {
|
|
6601
6674
|
"GET /": htmlHandler,
|
|
@@ -6606,6 +6679,7 @@ var routes2 = {
|
|
|
6606
6679
|
"GET /xterm.css": createCssHandler("@xterm/xterm/css/xterm.css"),
|
|
6607
6680
|
"GET /api/items": listItems,
|
|
6608
6681
|
"GET /api/backlog/exists": getBacklogExists,
|
|
6682
|
+
"GET /api/backlog/summary": getBacklogSummary,
|
|
6609
6683
|
"POST /api/backlog/init": initBacklog,
|
|
6610
6684
|
"POST /api/open-in-code": openInCode,
|
|
6611
6685
|
"POST /api/restart": restartWeb,
|
|
@@ -7547,47 +7621,6 @@ async function addPhase(id2, name, options2) {
|
|
|
7547
7621
|
|
|
7548
7622
|
// src/commands/backlog/list/index.ts
|
|
7549
7623
|
import chalk66 from "chalk";
|
|
7550
|
-
|
|
7551
|
-
// src/commands/backlog/originDisplayName.ts
|
|
7552
|
-
function originDisplayName(origin) {
|
|
7553
|
-
if (origin.startsWith("local:")) {
|
|
7554
|
-
const path57 = origin.slice("local:".length).replace(/\/+$/, "");
|
|
7555
|
-
const segments = path57.split("/").filter(Boolean);
|
|
7556
|
-
return segments[segments.length - 1] ?? origin;
|
|
7557
|
-
}
|
|
7558
|
-
const firstSlash = origin.indexOf("/");
|
|
7559
|
-
if (firstSlash === -1) return origin;
|
|
7560
|
-
return origin.slice(firstSlash + 1);
|
|
7561
|
-
}
|
|
7562
|
-
|
|
7563
|
-
// src/commands/backlog/originDisplayLabels.ts
|
|
7564
|
-
function originDisplayLabels(origins) {
|
|
7565
|
-
const isLocal = (origin) => origin.startsWith("local:");
|
|
7566
|
-
const bareName = (origin) => {
|
|
7567
|
-
const full = originDisplayName(origin);
|
|
7568
|
-
const segments = full.split("/");
|
|
7569
|
-
return segments[segments.length - 1] ?? full;
|
|
7570
|
-
};
|
|
7571
|
-
const remoteCounts = /* @__PURE__ */ new Map();
|
|
7572
|
-
for (const origin of new Set(origins)) {
|
|
7573
|
-
if (isLocal(origin)) continue;
|
|
7574
|
-
const name = bareName(origin);
|
|
7575
|
-
remoteCounts.set(name, (remoteCounts.get(name) ?? 0) + 1);
|
|
7576
|
-
}
|
|
7577
|
-
const labels = /* @__PURE__ */ new Map();
|
|
7578
|
-
for (const origin of origins) {
|
|
7579
|
-
if (isLocal(origin)) {
|
|
7580
|
-
labels.set(origin, originDisplayName(origin));
|
|
7581
|
-
continue;
|
|
7582
|
-
}
|
|
7583
|
-
const name = bareName(origin);
|
|
7584
|
-
const collides = (remoteCounts.get(name) ?? 0) > 1;
|
|
7585
|
-
labels.set(origin, collides ? originDisplayName(origin) : name);
|
|
7586
|
-
}
|
|
7587
|
-
return labels;
|
|
7588
|
-
}
|
|
7589
|
-
|
|
7590
|
-
// src/commands/backlog/list/index.ts
|
|
7591
7624
|
function filterItems(items2, options2) {
|
|
7592
7625
|
if (options2.status) return items2.filter((i) => i.status === options2.status);
|
|
7593
7626
|
if (!options2.all)
|
|
@@ -22046,12 +22079,26 @@ var WindowsProxy = class {
|
|
|
22046
22079
|
}
|
|
22047
22080
|
};
|
|
22048
22081
|
|
|
22082
|
+
// src/commands/sessions/daemon/watchPromptSubmit.ts
|
|
22083
|
+
var CARRIAGE_RETURN = "\r";
|
|
22084
|
+
function isPromptSubmit(data) {
|
|
22085
|
+
return data.includes(CARRIAGE_RETURN);
|
|
22086
|
+
}
|
|
22087
|
+
function watchPromptSubmit(session, data, onStatusChange) {
|
|
22088
|
+
if (session.restored !== true) return;
|
|
22089
|
+
if (session.status !== "waiting") return;
|
|
22090
|
+
if (!isPromptSubmit(data)) return;
|
|
22091
|
+
daemonLog(`session ${session.id} resumed-prompt submit -> running`);
|
|
22092
|
+
onStatusChange(session, "running");
|
|
22093
|
+
}
|
|
22094
|
+
|
|
22049
22095
|
// src/commands/sessions/daemon/writeToSession.ts
|
|
22050
22096
|
function writeToSession(sessions, id2, data, onStatusChange) {
|
|
22051
22097
|
const s = sessions.get(id2);
|
|
22052
22098
|
if (!s || s.status === "done") return;
|
|
22053
22099
|
s.pty?.write(data);
|
|
22054
22100
|
watchEscInterrupt(s, data, onStatusChange);
|
|
22101
|
+
watchPromptSubmit(s, data, onStatusChange);
|
|
22055
22102
|
}
|
|
22056
22103
|
function resizeSession(sessions, id2, cols, rows) {
|
|
22057
22104
|
const s = sessions.get(id2);
|