nairon-bench 0.0.23 → 0.0.25
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/index.js +38 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16066,8 +16066,9 @@ function renderBar2(value, width) {
|
|
|
16066
16066
|
init_dist();
|
|
16067
16067
|
init_client();
|
|
16068
16068
|
import { existsSync as existsSync9, readdirSync as readdirSync3, readFileSync as readFileSync6 } from "node:fs";
|
|
16069
|
-
import { join as join9 } from "node:path";
|
|
16069
|
+
import { join as join9, basename as basename2 } from "node:path";
|
|
16070
16070
|
import { homedir as homedir7 } from "node:os";
|
|
16071
|
+
import { execSync as execSync2 } from "node:child_process";
|
|
16071
16072
|
var publishCommand = defineCommand2({
|
|
16072
16073
|
meta: {
|
|
16073
16074
|
name: "publish",
|
|
@@ -16136,7 +16137,8 @@ var publishCommand = defineCommand2({
|
|
|
16136
16137
|
consola.error("Not connected. Run `nb init` first.");
|
|
16137
16138
|
process.exit(1);
|
|
16138
16139
|
}
|
|
16139
|
-
|
|
16140
|
+
const repoInfo = detectRepository(projectDir);
|
|
16141
|
+
consola.info(`Publishing report for ${repoInfo.name}...`);
|
|
16140
16142
|
try {
|
|
16141
16143
|
const result = await client.mutation(api.publicReports.publish, {
|
|
16142
16144
|
clerkId,
|
|
@@ -16155,14 +16157,16 @@ var publishCommand = defineCommand2({
|
|
|
16155
16157
|
patternCorrectionRate: aggregated.patternCorrectionRate,
|
|
16156
16158
|
scansAnalyzed: reports.length,
|
|
16157
16159
|
periodStart: reports[0]?.date ?? new Date().toISOString(),
|
|
16158
|
-
periodEnd: reports[reports.length - 1]?.date ?? new Date().toISOString()
|
|
16160
|
+
periodEnd: reports[reports.length - 1]?.date ?? new Date().toISOString(),
|
|
16161
|
+
repositoryName: repoInfo.name,
|
|
16162
|
+
...repoInfo.url ? { repositoryUrl: repoInfo.url } : {}
|
|
16159
16163
|
});
|
|
16160
16164
|
consola.success(`Published! Your report is live.`);
|
|
16161
16165
|
consola.log("");
|
|
16162
|
-
consola.log(` URL: https://nairon.
|
|
16166
|
+
consola.log(` URL: https://nairon-bench.pages.dev/u/${result.slug}`);
|
|
16163
16167
|
consola.log("");
|
|
16164
16168
|
consola.log(" Share badge:");
|
|
16165
|
-
consola.log(` `);
|
|
16166
16170
|
consola.log("");
|
|
16167
16171
|
} catch (err) {
|
|
16168
16172
|
consola.error(`Failed to publish: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -16351,6 +16355,27 @@ function formatPreview(data) {
|
|
|
16351
16355
|
return lines.join(`
|
|
16352
16356
|
`);
|
|
16353
16357
|
}
|
|
16358
|
+
function detectRepository(projectDir) {
|
|
16359
|
+
const name = basename2(projectDir);
|
|
16360
|
+
let url;
|
|
16361
|
+
try {
|
|
16362
|
+
const remoteUrl = execSync2("git remote get-url origin", {
|
|
16363
|
+
cwd: projectDir,
|
|
16364
|
+
encoding: "utf-8",
|
|
16365
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
16366
|
+
}).trim();
|
|
16367
|
+
if (remoteUrl.startsWith("git@github.com:")) {
|
|
16368
|
+
url = remoteUrl.replace("git@github.com:", "https://github.com/").replace(/\.git$/, "");
|
|
16369
|
+
} else if (remoteUrl.startsWith("https://")) {
|
|
16370
|
+
url = remoteUrl.replace(/\.git$/, "");
|
|
16371
|
+
} else {
|
|
16372
|
+
url = remoteUrl;
|
|
16373
|
+
}
|
|
16374
|
+
} catch {
|
|
16375
|
+
url = undefined;
|
|
16376
|
+
}
|
|
16377
|
+
return { name, url };
|
|
16378
|
+
}
|
|
16354
16379
|
|
|
16355
16380
|
// src/commands/history.ts
|
|
16356
16381
|
init_client();
|
|
@@ -16658,7 +16683,7 @@ function formatTokens3(tokens) {
|
|
|
16658
16683
|
// src/commands/session.ts
|
|
16659
16684
|
import { existsSync as existsSync10, readdirSync as readdirSync4, readFileSync as readFileSync7, statSync as statSync2 } from "node:fs";
|
|
16660
16685
|
import { homedir as homedir8 } from "node:os";
|
|
16661
|
-
import { join as join10, basename as
|
|
16686
|
+
import { join as join10, basename as basename3 } from "node:path";
|
|
16662
16687
|
var sessionCommand = defineCommand2({
|
|
16663
16688
|
meta: {
|
|
16664
16689
|
name: "session",
|
|
@@ -16831,7 +16856,7 @@ async function collectSessionList() {
|
|
|
16831
16856
|
const files = readdirSync4(projectPath).filter((f3) => f3.endsWith(".jsonl"));
|
|
16832
16857
|
for (const file of files) {
|
|
16833
16858
|
const filePath = join10(projectPath, file);
|
|
16834
|
-
const sessionId =
|
|
16859
|
+
const sessionId = basename3(file, ".jsonl").slice(0, 8);
|
|
16835
16860
|
try {
|
|
16836
16861
|
const content = readFileSync7(filePath, "utf-8");
|
|
16837
16862
|
const lines = content.trim().split(`
|
|
@@ -17172,7 +17197,7 @@ function generateCSV(data) {
|
|
|
17172
17197
|
}
|
|
17173
17198
|
|
|
17174
17199
|
// src/commands/pr.ts
|
|
17175
|
-
import { execSync as
|
|
17200
|
+
import { execSync as execSync3 } from "node:child_process";
|
|
17176
17201
|
var prCommand = defineCommand2({
|
|
17177
17202
|
meta: {
|
|
17178
17203
|
name: "pr",
|
|
@@ -17317,14 +17342,14 @@ async function getPRInfo(prArg) {
|
|
|
17317
17342
|
const match = prArg.match(/\/pull\/(\d+)/);
|
|
17318
17343
|
prNumber = match ? match[1] : prArg;
|
|
17319
17344
|
} else {
|
|
17320
|
-
const branch =
|
|
17321
|
-
const result2 =
|
|
17345
|
+
const branch = execSync3("git branch --show-current", { encoding: "utf-8" }).trim();
|
|
17346
|
+
const result2 = execSync3(`gh pr list --head "${branch}" --json number --limit 1`, { encoding: "utf-8" });
|
|
17322
17347
|
const prs = JSON.parse(result2);
|
|
17323
17348
|
if (prs.length === 0)
|
|
17324
17349
|
return null;
|
|
17325
17350
|
prNumber = prs[0].number.toString();
|
|
17326
17351
|
}
|
|
17327
|
-
const result =
|
|
17352
|
+
const result = execSync3(`gh pr view ${prNumber} --json number,title,author,createdAt,mergedAt,additions,deletions`, { encoding: "utf-8" });
|
|
17328
17353
|
const pr = JSON.parse(result);
|
|
17329
17354
|
return {
|
|
17330
17355
|
number: pr.number,
|
|
@@ -17341,7 +17366,7 @@ async function getPRInfo(prArg) {
|
|
|
17341
17366
|
}
|
|
17342
17367
|
async function getPRCommits(prNumber) {
|
|
17343
17368
|
try {
|
|
17344
|
-
const result =
|
|
17369
|
+
const result = execSync3(`gh pr view ${prNumber} --json commits --jq '.commits[].oid'`, { encoding: "utf-8" });
|
|
17345
17370
|
return result.trim().split(`
|
|
17346
17371
|
`).filter(Boolean);
|
|
17347
17372
|
} catch {
|
|
@@ -17702,7 +17727,7 @@ function formatBytes(bytes) {
|
|
|
17702
17727
|
// package.json
|
|
17703
17728
|
var package_default = {
|
|
17704
17729
|
name: "nairon-bench",
|
|
17705
|
-
version: "0.0.
|
|
17730
|
+
version: "0.0.25",
|
|
17706
17731
|
description: "AI workflow benchmarking CLI",
|
|
17707
17732
|
type: "module",
|
|
17708
17733
|
bin: {
|