@staff0rd/assist 0.891.1 → 0.893.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/dist/commands/extension/extension/content.js +27 -27
- package/dist/commands/extension/extension/docs.js +13 -13
- package/dist/commands/extension/extension/updates.json +2 -2
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +57 -158
- 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.893.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -21652,15 +21652,6 @@ function* iterateUserMessages(filePath, maxBytes = 65536) {
|
|
|
21652
21652
|
}
|
|
21653
21653
|
|
|
21654
21654
|
// src/commands/sessions/summarise/scanSessionBacklogRefs.ts
|
|
21655
|
-
function scanSessionBacklogRefs(filePath) {
|
|
21656
|
-
const ids = /* @__PURE__ */ new Set();
|
|
21657
|
-
for (const text18 of iterateUserMessages(filePath, Number.MAX_SAFE_INTEGER)) {
|
|
21658
|
-
for (const id of extractBacklogIds(text18)) {
|
|
21659
|
-
ids.add(id);
|
|
21660
|
-
}
|
|
21661
|
-
}
|
|
21662
|
-
return [...ids].sort((a, b) => a - b);
|
|
21663
|
-
}
|
|
21664
21655
|
function extractBacklogIds(text18) {
|
|
21665
21656
|
const ids = [];
|
|
21666
21657
|
for (const m of text18.matchAll(/backlog\s+run\s+a(\d+)/gi)) {
|
|
@@ -40140,17 +40131,29 @@ function registerShow(program) {
|
|
|
40140
40131
|
).option("--title <title>", "Pane title").requiredOption("--body <markdown|->", "Markdown to show, or - for stdin").action(show3);
|
|
40141
40132
|
}
|
|
40142
40133
|
|
|
40134
|
+
// src/shared/internalCommand.ts
|
|
40135
|
+
function internalCommand(command, calledBy) {
|
|
40136
|
+
command.internalCalledBy = calledBy;
|
|
40137
|
+
return command;
|
|
40138
|
+
}
|
|
40139
|
+
|
|
40143
40140
|
// src/commands/registerSignal.ts
|
|
40144
40141
|
function registerSignal(program) {
|
|
40145
40142
|
const signalCommand = program.command("signal").description("Write an assist signal file");
|
|
40146
|
-
|
|
40147
|
-
|
|
40148
|
-
|
|
40149
|
-
|
|
40150
|
-
|
|
40151
|
-
|
|
40152
|
-
|
|
40153
|
-
|
|
40143
|
+
internalCommand(
|
|
40144
|
+
signalCommand.command("next").argument("[id]", "Backlog item ID to run directly").description("Write a next signal to chain into assist next").action((id) => {
|
|
40145
|
+
writeSignal("next", id ? { id } : void 0);
|
|
40146
|
+
console.log("Signal written.");
|
|
40147
|
+
}),
|
|
40148
|
+
"/next"
|
|
40149
|
+
);
|
|
40150
|
+
internalCommand(
|
|
40151
|
+
signalCommand.command("done").argument("[id]", "Backlog item ID created by the session").description("Write a done signal to end a --once launch session").action((id) => {
|
|
40152
|
+
writeSignal("done", id ? { id } : void 0);
|
|
40153
|
+
console.log("Signal written.");
|
|
40154
|
+
}),
|
|
40155
|
+
"/draft, /bug, /refine"
|
|
40156
|
+
);
|
|
40154
40157
|
}
|
|
40155
40158
|
|
|
40156
40159
|
// src/commands/slack/parseSlackThreadRef.ts
|
|
@@ -49404,9 +49407,6 @@ async function discoverHistoryEntries() {
|
|
|
49404
49407
|
}
|
|
49405
49408
|
|
|
49406
49409
|
// src/commands/sessions/shared/discoverSessions.ts
|
|
49407
|
-
async function discoverSessionFiles() {
|
|
49408
|
-
return (await discoverSessionJsonlPaths()).map((p) => p.path);
|
|
49409
|
-
}
|
|
49410
49410
|
async function discoverSessions() {
|
|
49411
49411
|
return (await discoverHistoryEntries()).map((entry) => entry.session);
|
|
49412
49412
|
}
|
|
@@ -52131,26 +52131,32 @@ function fail8(message3) {
|
|
|
52131
52131
|
|
|
52132
52132
|
// src/commands/sessions/registerOutputCommand.ts
|
|
52133
52133
|
function registerOutputCommand(cmd) {
|
|
52134
|
-
|
|
52135
|
-
"
|
|
52136
|
-
|
|
52137
|
-
"--
|
|
52138
|
-
|
|
52139
|
-
|
|
52134
|
+
internalCommand(
|
|
52135
|
+
cmd.command("output [session-id]").description(
|
|
52136
|
+
"Print a snapshot of a session's output with ANSI codes stripped"
|
|
52137
|
+
).option("-n, --lines <count>", "Number of lines", "200").option(
|
|
52138
|
+
"--server [group]",
|
|
52139
|
+
"Read the live server run for this repo's remote and group (default: default)"
|
|
52140
|
+
).action(sessionOutput),
|
|
52141
|
+
"/run-logs"
|
|
52142
|
+
);
|
|
52140
52143
|
}
|
|
52141
52144
|
|
|
52142
52145
|
// src/commands/sessions/registerSetStatusCommand.ts
|
|
52143
52146
|
function registerSetStatusCommand(cmd) {
|
|
52144
|
-
|
|
52145
|
-
"
|
|
52146
|
-
|
|
52147
|
-
|
|
52148
|
-
|
|
52149
|
-
|
|
52150
|
-
|
|
52151
|
-
|
|
52152
|
-
|
|
52153
|
-
|
|
52147
|
+
internalCommand(
|
|
52148
|
+
cmd.command("set-status <status>").description(
|
|
52149
|
+
"Report the current session's status to the sessions daemon (used by Claude Code hooks)"
|
|
52150
|
+
).option(
|
|
52151
|
+
"--source <source>",
|
|
52152
|
+
"Originating hook (permission, stop, notification, prompt, pretool, posttool)"
|
|
52153
|
+
).option(
|
|
52154
|
+
"--ack",
|
|
52155
|
+
"Retry delivery until the daemon acknowledges it (without it, a single attempt)"
|
|
52156
|
+
).action(
|
|
52157
|
+
(status2, options2) => setSessionStatus(status2, { source: options2.source, ack: options2.ack })
|
|
52158
|
+
),
|
|
52159
|
+
"Claude hooks"
|
|
52154
52160
|
);
|
|
52155
52161
|
}
|
|
52156
52162
|
|
|
@@ -52170,118 +52176,6 @@ async function renameSession(title) {
|
|
|
52170
52176
|
}
|
|
52171
52177
|
}
|
|
52172
52178
|
|
|
52173
|
-
// src/commands/sessions/summarise.ts
|
|
52174
|
-
import * as fs59 from "fs";
|
|
52175
|
-
import chalk268 from "chalk";
|
|
52176
|
-
|
|
52177
|
-
// src/commands/sessions/summarise/shared.ts
|
|
52178
|
-
import * as fs58 from "fs";
|
|
52179
|
-
function writeSummary(jsonlPath2, summary) {
|
|
52180
|
-
fs58.writeFileSync(summaryPathFor(jsonlPath2), `${summary.trim()}
|
|
52181
|
-
`, "utf8");
|
|
52182
|
-
}
|
|
52183
|
-
function hasSummary(jsonlPath2) {
|
|
52184
|
-
return fs58.existsSync(summaryPathFor(jsonlPath2));
|
|
52185
|
-
}
|
|
52186
|
-
function summaryPathFor(jsonlPath2) {
|
|
52187
|
-
return jsonlPath2.replace(/\.jsonl$/, ".summary");
|
|
52188
|
-
}
|
|
52189
|
-
|
|
52190
|
-
// src/commands/sessions/summarise/summariseSession.ts
|
|
52191
|
-
import { execFileSync as execFileSync32 } from "child_process";
|
|
52192
|
-
function summariseSession(jsonlPath2) {
|
|
52193
|
-
const firstMessage = extractFirstUserMessage(jsonlPath2);
|
|
52194
|
-
const backlogIds = scanSessionBacklogRefs(jsonlPath2);
|
|
52195
|
-
if (!firstMessage && backlogIds.length === 0) {
|
|
52196
|
-
return void 0;
|
|
52197
|
-
}
|
|
52198
|
-
const prompt = buildPrompt6(firstMessage, backlogIds);
|
|
52199
|
-
try {
|
|
52200
|
-
const output = execFileSync32("claude", ["-p", "--model", "haiku", prompt], {
|
|
52201
|
-
encoding: "utf8",
|
|
52202
|
-
timeout: 3e4,
|
|
52203
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
52204
|
-
});
|
|
52205
|
-
const summary = output.trim();
|
|
52206
|
-
if (!summary) return void 0;
|
|
52207
|
-
return summary.split("\n")[0].replace(/^["']|["']$/g, "").trim();
|
|
52208
|
-
} catch {
|
|
52209
|
-
return void 0;
|
|
52210
|
-
}
|
|
52211
|
-
}
|
|
52212
|
-
function buildPrompt6(firstMessage, backlogIds) {
|
|
52213
|
-
const parts = [
|
|
52214
|
-
"Summarise this Claude Code session in ONE short sentence (under 100 chars).",
|
|
52215
|
-
"Return ONLY the summary, no quotes or explanation."
|
|
52216
|
-
];
|
|
52217
|
-
if (backlogIds.length > 0) {
|
|
52218
|
-
const refs = backlogIds.map((id) => formatItemId(id)).join(", ");
|
|
52219
|
-
parts.push(
|
|
52220
|
-
`The session references backlog item(s) ${refs}. Start the summary with "Backlog ${refs} \u2014" if relevant.`
|
|
52221
|
-
);
|
|
52222
|
-
}
|
|
52223
|
-
if (firstMessage) {
|
|
52224
|
-
parts.push(`First user message:
|
|
52225
|
-
${firstMessage}`);
|
|
52226
|
-
}
|
|
52227
|
-
return parts.join("\n");
|
|
52228
|
-
}
|
|
52229
|
-
|
|
52230
|
-
// src/commands/sessions/summarise.ts
|
|
52231
|
-
async function summarise2(options2) {
|
|
52232
|
-
const files = await discoverSessionFiles();
|
|
52233
|
-
if (files.length === 0) {
|
|
52234
|
-
console.log(chalk268.yellow("No sessions found."));
|
|
52235
|
-
return;
|
|
52236
|
-
}
|
|
52237
|
-
const toProcess = selectCandidates(files, options2);
|
|
52238
|
-
if (toProcess.length === 0) {
|
|
52239
|
-
console.log(chalk268.green("All sessions already summarised."));
|
|
52240
|
-
return;
|
|
52241
|
-
}
|
|
52242
|
-
console.log(
|
|
52243
|
-
chalk268.cyan(
|
|
52244
|
-
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
52245
|
-
)
|
|
52246
|
-
);
|
|
52247
|
-
const { succeeded, failed: failed3 } = processSessions(toProcess);
|
|
52248
|
-
console.log(
|
|
52249
|
-
chalk268.green(`Done: ${succeeded} summarised`) + (failed3 > 0 ? chalk268.yellow(`, ${failed3} skipped`) : "")
|
|
52250
|
-
);
|
|
52251
|
-
}
|
|
52252
|
-
function selectCandidates(files, options2) {
|
|
52253
|
-
const candidates = options2.force ? files : files.filter((f) => !hasSummary(f));
|
|
52254
|
-
candidates.sort((a, b) => {
|
|
52255
|
-
try {
|
|
52256
|
-
return fs59.statSync(b).mtimeMs - fs59.statSync(a).mtimeMs;
|
|
52257
|
-
} catch {
|
|
52258
|
-
return 0;
|
|
52259
|
-
}
|
|
52260
|
-
});
|
|
52261
|
-
const limit = options2.limit ? Number.parseInt(options2.limit, 10) : void 0;
|
|
52262
|
-
return limit && limit > 0 ? candidates.slice(0, limit) : candidates;
|
|
52263
|
-
}
|
|
52264
|
-
function processSessions(files) {
|
|
52265
|
-
let succeeded = 0;
|
|
52266
|
-
let failed3 = 0;
|
|
52267
|
-
for (let i = 0; i < files.length; i++) {
|
|
52268
|
-
const file = files[i];
|
|
52269
|
-
process.stdout.write(chalk268.dim(` [${i + 1}/${files.length}] `));
|
|
52270
|
-
const summary = summariseSession(file);
|
|
52271
|
-
if (summary) {
|
|
52272
|
-
writeSummary(file, summary);
|
|
52273
|
-
succeeded++;
|
|
52274
|
-
process.stdout.write(`${chalk268.green("\u2713")} ${summary}
|
|
52275
|
-
`);
|
|
52276
|
-
} else {
|
|
52277
|
-
failed3++;
|
|
52278
|
-
process.stdout.write(` ${chalk268.yellow("skip")}
|
|
52279
|
-
`);
|
|
52280
|
-
}
|
|
52281
|
-
}
|
|
52282
|
-
return { succeeded, failed: failed3 };
|
|
52283
|
-
}
|
|
52284
|
-
|
|
52285
52179
|
// src/commands/sessions/registerSessions.ts
|
|
52286
52180
|
function registerSessions(program) {
|
|
52287
52181
|
const cmd = program.command("sessions").description("Web dashboard for Claude Code sessions").option("--no-open", "Do not open a browser on startup").action(
|
|
@@ -52295,13 +52189,18 @@ function registerSessions(program) {
|
|
|
52295
52189
|
...webConfigHelp,
|
|
52296
52190
|
...hotkeysConfigHelp
|
|
52297
52191
|
]);
|
|
52298
|
-
|
|
52299
|
-
|
|
52300
|
-
|
|
52301
|
-
|
|
52302
|
-
|
|
52303
|
-
|
|
52304
|
-
|
|
52192
|
+
internalCommand(
|
|
52193
|
+
cmd.command("close").description(
|
|
52194
|
+
"Dismiss the current daemon-managed session, ending it and reaping its worktree"
|
|
52195
|
+
).action(closeSession),
|
|
52196
|
+
"/close"
|
|
52197
|
+
);
|
|
52198
|
+
internalCommand(
|
|
52199
|
+
cmd.command("rename <title>").description(
|
|
52200
|
+
"Retitle the current daemon-managed session, overriding the generated title for the rest of its life"
|
|
52201
|
+
).action(renameSession),
|
|
52202
|
+
"/rename"
|
|
52203
|
+
);
|
|
52305
52204
|
registerOutputCommand(cmd);
|
|
52306
52205
|
registerSetStatusCommand(cmd);
|
|
52307
52206
|
registerNodes(cmd);
|
|
@@ -52375,10 +52274,10 @@ function createProgram() {
|
|
|
52375
52274
|
}
|
|
52376
52275
|
|
|
52377
52276
|
// src/reportCliError.ts
|
|
52378
|
-
import
|
|
52277
|
+
import chalk268 from "chalk";
|
|
52379
52278
|
function reportCliError(error) {
|
|
52380
52279
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
52381
|
-
console.error(
|
|
52280
|
+
console.error(chalk268.red(error.message));
|
|
52382
52281
|
} else {
|
|
52383
52282
|
console.error(error);
|
|
52384
52283
|
}
|