@staff0rd/assist 0.844.0 → 0.845.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/claude/skills/review-ci/scripts/review.mjs +141 -141
- package/dist/commands/sessions/web/bundle.js +327 -327
- package/dist/index.js +56 -12
- 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.845.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -37208,19 +37208,28 @@ function simplifyShellCommand(command) {
|
|
|
37208
37208
|
return truncate2(inner);
|
|
37209
37209
|
}
|
|
37210
37210
|
|
|
37211
|
-
// src/commands/review/
|
|
37211
|
+
// src/commands/review/parseTokenUsage.ts
|
|
37212
37212
|
function count8(value) {
|
|
37213
37213
|
return typeof value === "number" ? value : 0;
|
|
37214
37214
|
}
|
|
37215
|
-
function
|
|
37215
|
+
function parseTokenUsage(usage, keys) {
|
|
37216
37216
|
if (typeof usage !== "object" || usage === null) return void 0;
|
|
37217
37217
|
const raw = usage;
|
|
37218
|
-
|
|
37218
|
+
const parsed = {
|
|
37219
37219
|
input: count8(raw.input_tokens),
|
|
37220
37220
|
output: count8(raw.output_tokens),
|
|
37221
|
-
cacheRead: count8(raw.
|
|
37222
|
-
cacheWrite: count8(raw.cache_creation_input_tokens)
|
|
37221
|
+
cacheRead: count8(raw[keys.cacheRead])
|
|
37223
37222
|
};
|
|
37223
|
+
if (keys.cacheWrite) parsed.cacheWrite = count8(raw[keys.cacheWrite]);
|
|
37224
|
+
return parsed;
|
|
37225
|
+
}
|
|
37226
|
+
|
|
37227
|
+
// src/commands/review/parseClaudeUsage.ts
|
|
37228
|
+
function parseClaudeUsage(usage) {
|
|
37229
|
+
return parseTokenUsage(usage, {
|
|
37230
|
+
cacheRead: "cache_read_input_tokens",
|
|
37231
|
+
cacheWrite: "cache_creation_input_tokens"
|
|
37232
|
+
});
|
|
37224
37233
|
}
|
|
37225
37234
|
|
|
37226
37235
|
// src/commands/review/parseClaudeEvent.ts
|
|
@@ -37612,10 +37621,18 @@ async function runClaudeReviewer(spec) {
|
|
|
37612
37621
|
// src/commands/review/runCodexReviewer.ts
|
|
37613
37622
|
import { existsSync as existsSync67, unlinkSync as unlinkSync18 } from "fs";
|
|
37614
37623
|
|
|
37624
|
+
// src/commands/review/parseCodexUsage.ts
|
|
37625
|
+
function parseCodexUsage(usage) {
|
|
37626
|
+
return parseTokenUsage(usage, { cacheRead: "cached_input_tokens" });
|
|
37627
|
+
}
|
|
37628
|
+
|
|
37615
37629
|
// src/commands/review/parseCodexEvent.ts
|
|
37616
37630
|
function isItemStarted(value) {
|
|
37617
37631
|
return typeof value === "object" && value !== null && value.type === "item.started";
|
|
37618
37632
|
}
|
|
37633
|
+
function isTurnCompleted(value) {
|
|
37634
|
+
return typeof value === "object" && value !== null && value.type === "turn.completed";
|
|
37635
|
+
}
|
|
37619
37636
|
function parseCodexEvent(line) {
|
|
37620
37637
|
let event;
|
|
37621
37638
|
try {
|
|
@@ -37623,6 +37640,10 @@ function parseCodexEvent(line) {
|
|
|
37623
37640
|
} catch {
|
|
37624
37641
|
return { kind: "ignore" };
|
|
37625
37642
|
}
|
|
37643
|
+
if (isTurnCompleted(event)) {
|
|
37644
|
+
const usage = parseCodexUsage(event.usage);
|
|
37645
|
+
return usage ? { kind: "usage", usage } : { kind: "ignore" };
|
|
37646
|
+
}
|
|
37626
37647
|
if (!isItemStarted(event)) return { kind: "ignore" };
|
|
37627
37648
|
const item = event.item;
|
|
37628
37649
|
if (!item) return { kind: "ignore" };
|
|
@@ -37636,6 +37657,27 @@ function parseCodexEvent(line) {
|
|
|
37636
37657
|
return { kind: "ignore" };
|
|
37637
37658
|
}
|
|
37638
37659
|
|
|
37660
|
+
// src/commands/review/createCodexLineHandler.ts
|
|
37661
|
+
function addUsage(total2, turn) {
|
|
37662
|
+
if (!total2) return turn;
|
|
37663
|
+
return {
|
|
37664
|
+
input: total2.input + turn.input,
|
|
37665
|
+
output: total2.output + turn.output,
|
|
37666
|
+
cacheRead: total2.cacheRead + turn.cacheRead
|
|
37667
|
+
};
|
|
37668
|
+
}
|
|
37669
|
+
function createCodexLineHandler(name, spinner, model) {
|
|
37670
|
+
const state = {};
|
|
37671
|
+
const onLine = (line) => {
|
|
37672
|
+
const event = parseCodexEvent(line);
|
|
37673
|
+
if (event.kind === "tool_use")
|
|
37674
|
+
reportReviewerToolUse(name, event, spinner, model);
|
|
37675
|
+
else if (event.kind === "usage")
|
|
37676
|
+
state.usage = addUsage(state.usage, event.usage);
|
|
37677
|
+
};
|
|
37678
|
+
return { state, onLine };
|
|
37679
|
+
}
|
|
37680
|
+
|
|
37639
37681
|
// src/commands/review/runCodexReviewer.ts
|
|
37640
37682
|
function codexArgs(outputPath, modelArgs) {
|
|
37641
37683
|
return [
|
|
@@ -37651,6 +37693,11 @@ function codexArgs(outputPath, modelArgs) {
|
|
|
37651
37693
|
async function runCodexReviewer(spec) {
|
|
37652
37694
|
const { spinner, override } = spec;
|
|
37653
37695
|
const command = "codex";
|
|
37696
|
+
const { state, onLine } = createCodexLineHandler(
|
|
37697
|
+
spec.name,
|
|
37698
|
+
spinner,
|
|
37699
|
+
override.model
|
|
37700
|
+
);
|
|
37654
37701
|
const result = await runStreamingChild({
|
|
37655
37702
|
name: spec.name,
|
|
37656
37703
|
command,
|
|
@@ -37659,16 +37706,12 @@ async function runCodexReviewer(spec) {
|
|
|
37659
37706
|
stdin: spec.stdin,
|
|
37660
37707
|
quiet: Boolean(spinner),
|
|
37661
37708
|
...override.args.length > 0 ? { env: override.env } : {},
|
|
37662
|
-
onLine
|
|
37663
|
-
const event = parseCodexEvent(line);
|
|
37664
|
-
if (event.kind !== "tool_use") return;
|
|
37665
|
-
reportReviewerToolUse(spec.name, event, spinner, override.model);
|
|
37666
|
-
}
|
|
37709
|
+
onLine
|
|
37667
37710
|
});
|
|
37668
37711
|
if (result.exitCode !== 0 && existsSync67(spec.outputPath)) {
|
|
37669
37712
|
unlinkSync18(spec.outputPath);
|
|
37670
37713
|
}
|
|
37671
|
-
|
|
37714
|
+
const finalised = finaliseReviewerRun(
|
|
37672
37715
|
{
|
|
37673
37716
|
name: spec.name,
|
|
37674
37717
|
command,
|
|
@@ -37678,6 +37721,7 @@ async function runCodexReviewer(spec) {
|
|
|
37678
37721
|
spinner,
|
|
37679
37722
|
result
|
|
37680
37723
|
);
|
|
37724
|
+
return state.usage ? { ...finalised, usage: state.usage } : finalised;
|
|
37681
37725
|
}
|
|
37682
37726
|
|
|
37683
37727
|
// src/commands/review/runSlot.ts
|