@use-aistack/cli 0.10.0 → 0.10.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/index.js +62 -38
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
|
|
6
6
|
// src/version.ts
|
|
7
|
-
var CLI_VERSION = true ? "0.10.
|
|
7
|
+
var CLI_VERSION = true ? "0.10.1" : "0.0.0-dev";
|
|
8
8
|
|
|
9
9
|
// src/api.ts
|
|
10
10
|
var BASE_URL = process.env.AISTACK_URL || "https://aistack.to";
|
|
@@ -7254,10 +7254,18 @@ function payloadBlock(payload, width, ownWindow, stats) {
|
|
|
7254
7254
|
`${days} active day${days === 1 ? "" : "s"}`,
|
|
7255
7255
|
`${fmtTokens(payload.activity.totalTokens)} tokens`
|
|
7256
7256
|
];
|
|
7257
|
-
out.push(
|
|
7258
|
-
if (payload.activity.totalTokens === 0)
|
|
7257
|
+
out.push(`${label.toUpperCase()} ${payload.activity.sessions}`);
|
|
7258
|
+
if (payload.activity.totalTokens === 0) {
|
|
7259
|
+
out.push(`usage ${totals.slice(1).join(" \xB7 ")}`);
|
|
7260
|
+
return out;
|
|
7261
|
+
}
|
|
7259
7262
|
out.push(
|
|
7260
|
-
|
|
7263
|
+
...wrapRow(
|
|
7264
|
+
"usage ",
|
|
7265
|
+
" ".repeat(LABEL_WIDTH),
|
|
7266
|
+
`${totals.slice(1).join(" \xB7 ")} \xB7 ${usd === null ? "cost not published" : `${fmtUSD(usd)} at API prices`}`,
|
|
7267
|
+
width
|
|
7268
|
+
)
|
|
7261
7269
|
);
|
|
7262
7270
|
if (ownWindow) {
|
|
7263
7271
|
out.push(
|
|
@@ -7273,24 +7281,29 @@ function payloadBlock(payload, width, ownWindow, stats) {
|
|
|
7273
7281
|
if (stats) {
|
|
7274
7282
|
out.push(...scanNoteLines(stats, harnessLabel2(payload.harness.name)));
|
|
7275
7283
|
}
|
|
7276
|
-
const indent = " ".repeat(LABEL_WIDTH);
|
|
7277
7284
|
const shown = payload.models.filter((m) => m.tokenShare >= MODEL_ROLLUP);
|
|
7278
7285
|
const rolled = payload.models.filter((m) => m.tokenShare < MODEL_ROLLUP);
|
|
7279
|
-
const
|
|
7280
|
-
const
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
out.push(row(i, m.id, m.tokenShare, dollars));
|
|
7284
|
-
});
|
|
7286
|
+
const entry = (name, share, dollars) => `${name} ${fmtPct(share)}${usd !== null && dollars !== void 0 ? ` ${fmtUSD(dollars)}` : ""}`;
|
|
7287
|
+
const entries = shown.map(
|
|
7288
|
+
(m) => entry(m.id, m.tokenShare, m.apiEquivalentUSD)
|
|
7289
|
+
);
|
|
7285
7290
|
if (rolled.length > 0) {
|
|
7286
7291
|
const priced = rolled.every((m) => m.apiEquivalentUSD !== void 0);
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
row(
|
|
7290
|
-
shown.length,
|
|
7292
|
+
entries.push(
|
|
7293
|
+
entry(
|
|
7291
7294
|
`+${rolled.length} more`,
|
|
7292
7295
|
rolled.reduce((a, m) => a + m.tokenShare, 0),
|
|
7293
|
-
|
|
7296
|
+
priced ? rolled.reduce((a, m) => a + (m.apiEquivalentUSD ?? 0), 0) : void 0
|
|
7297
|
+
)
|
|
7298
|
+
);
|
|
7299
|
+
}
|
|
7300
|
+
if (entries.length > 0) {
|
|
7301
|
+
out.push(
|
|
7302
|
+
...wrapRow(
|
|
7303
|
+
"models ",
|
|
7304
|
+
" ".repeat(LABEL_WIDTH),
|
|
7305
|
+
entries.join(" \xB7 "),
|
|
7306
|
+
width
|
|
7294
7307
|
)
|
|
7295
7308
|
);
|
|
7296
7309
|
}
|
|
@@ -7323,6 +7336,7 @@ function payloadBlock(payload, width, ownWindow, stats) {
|
|
|
7323
7336
|
}
|
|
7324
7337
|
return out;
|
|
7325
7338
|
}
|
|
7339
|
+
var DIVIDER = "\u2500".repeat(40);
|
|
7326
7340
|
var MODEL_ROLLUP = 0.01;
|
|
7327
7341
|
var PHASE_ORDER = ["scout", "build", "verify", "handoff", "unknown"];
|
|
7328
7342
|
function workflowBlock(workflowDays, utcOffsetMinutes, host) {
|
|
@@ -7385,8 +7399,6 @@ function buildGateSummary(ctx) {
|
|
|
7385
7399
|
const { payloads } = body;
|
|
7386
7400
|
const host = baseUrl.replace(/^https?:\/\//, "");
|
|
7387
7401
|
const out = [];
|
|
7388
|
-
out.push("from your machine \xB7 sync preview");
|
|
7389
|
-
out.push("");
|
|
7390
7402
|
if (config.stack === null) {
|
|
7391
7403
|
out.push("to (no linked stack; publish is unavailable)");
|
|
7392
7404
|
} else {
|
|
@@ -7395,26 +7407,28 @@ function buildGateSummary(ctx) {
|
|
|
7395
7407
|
);
|
|
7396
7408
|
}
|
|
7397
7409
|
out.push(
|
|
7398
|
-
`searched ${HARNESS_ADAPTERS.map((a) => harnessLabel2(a.name).toLowerCase()).join(", ")}
|
|
7410
|
+
`searched ${HARNESS_ADAPTERS.map((a) => harnessLabel2(a.name).toLowerCase()).join(", ")}`
|
|
7399
7411
|
);
|
|
7400
7412
|
const windows = new Set(
|
|
7401
7413
|
payloads.map(
|
|
7402
7414
|
(p8) => `${p8.window.days} days \xB7 ${p8.window.from} \u2192 ${p8.window.to}`
|
|
7403
7415
|
)
|
|
7404
7416
|
);
|
|
7405
|
-
if (windows.size === 1)
|
|
7417
|
+
if (windows.size === 1) {
|
|
7418
|
+
out.push(
|
|
7419
|
+
`window ${[...windows][0]}${body.cliVersion ? ` \xB7 aistack ${body.cliVersion}` : ""}`
|
|
7420
|
+
);
|
|
7421
|
+
}
|
|
7406
7422
|
const width = wrapWidth(ctx.width);
|
|
7407
7423
|
for (const payload of payloads) {
|
|
7408
7424
|
const stats = ctx.scanStats?.[payload.harness.name];
|
|
7409
|
-
out.push("");
|
|
7425
|
+
out.push("", DIVIDER, "");
|
|
7410
7426
|
out.push(...payloadBlock(payload, width, windows.size > 1, stats));
|
|
7411
7427
|
}
|
|
7412
|
-
|
|
7428
|
+
out.push("", DIVIDER, "", "ALSO PUBLISHING");
|
|
7413
7429
|
if (body.measuredDays) {
|
|
7414
|
-
out.push("");
|
|
7415
7430
|
out.push(...daysBlock(body.measuredDays, ctx.days));
|
|
7416
7431
|
}
|
|
7417
|
-
out.push("");
|
|
7418
7432
|
const workflowDays = (body.measuredDays?.days ?? []).flatMap(
|
|
7419
7433
|
(d) => d.workflow ? [d.workflow] : []
|
|
7420
7434
|
);
|
|
@@ -7429,28 +7443,23 @@ function buildGateSummary(ctx) {
|
|
|
7429
7443
|
}
|
|
7430
7444
|
const n = payloads.reduce((a, p8) => a + withheldCount(p8), 0);
|
|
7431
7445
|
if (n > 0) {
|
|
7432
|
-
out.push("");
|
|
7433
|
-
out.push(`kept private: ${n} name${n === 1 ? "" : "s"}`);
|
|
7434
7446
|
const rows = keptPrivateRows(keptPrivate);
|
|
7435
7447
|
const shown = rows.slice(0, KEPT_PRIVATE_ROWS_SHOWN);
|
|
7436
|
-
const
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
}
|
|
7440
|
-
if (rows.length > shown.length) {
|
|
7441
|
-
out.push(` ...${rows.length - shown.length} more`);
|
|
7442
|
-
}
|
|
7448
|
+
const examples = shown.map((r) => r.names > 1 ? `${r.label} \xD7${r.names}` : r.label).join(", ");
|
|
7449
|
+
const more = rows.length > shown.length ? `, ...${rows.length - shown.length} more` : "";
|
|
7450
|
+
out.push(`private ${n} name${n === 1 ? "" : "s"} \xB7 ${examples}${more}`);
|
|
7443
7451
|
if (body.keptPrivate !== void 0 && config.stack !== null) {
|
|
7444
|
-
out.push(` publish them at ${host}/stacks/${config.stack.slug}/changes`);
|
|
7445
7452
|
out.push(
|
|
7446
|
-
|
|
7453
|
+
` they go up for you to review at ${host}/stacks/${config.stack.slug}/changes`
|
|
7454
|
+
);
|
|
7455
|
+
out.push(
|
|
7456
|
+
" (turn off: Review kept-private names, on your stack)"
|
|
7447
7457
|
);
|
|
7448
7458
|
} else {
|
|
7449
|
-
out.push("
|
|
7459
|
+
out.push(" they stay on this machine");
|
|
7450
7460
|
}
|
|
7451
7461
|
}
|
|
7452
7462
|
if (body.autoSync !== void 0) {
|
|
7453
|
-
out.push("");
|
|
7454
7463
|
out.push(
|
|
7455
7464
|
`auto-sync ${body.autoSync.enabled ? `on, about every ${body.autoSync.frequencyHours}h` : "off"}`
|
|
7456
7465
|
);
|
|
@@ -7783,7 +7792,7 @@ async function syncCommand(options = {}) {
|
|
|
7783
7792
|
return;
|
|
7784
7793
|
}
|
|
7785
7794
|
s.stop("Scan complete");
|
|
7786
|
-
p7.log.message(staged.summary.split("\n").join("\n"));
|
|
7795
|
+
p7.log.message(staged.summary.split("\n").map(styleSummaryLine).join("\n"));
|
|
7787
7796
|
if (staged.blockedReason !== null) {
|
|
7788
7797
|
outroError(staged.blockedReason);
|
|
7789
7798
|
process.exitCode = 1;
|
|
@@ -7830,6 +7839,21 @@ async function syncCommand(options = {}) {
|
|
|
7830
7839
|
process.exitCode = 1;
|
|
7831
7840
|
}
|
|
7832
7841
|
}
|
|
7842
|
+
function styleSummaryLine(line) {
|
|
7843
|
+
if (line.startsWith("\u2500")) return dim(line);
|
|
7844
|
+
const section2 = /^([A-Z][A-Z0-9 .-]+?)( \d+)?$/.exec(line);
|
|
7845
|
+
if (section2) return `${bold(section2[1] ?? "")}${dim(section2[2] ?? "")}`;
|
|
7846
|
+
const labelled = /^([a-z-]+)( +)(.*)$/.exec(line);
|
|
7847
|
+
if (labelled) {
|
|
7848
|
+
const [, label = "", gap = "", rest = ""] = labelled;
|
|
7849
|
+
const body = label === "skipped" ? yellow(rest) : rest.replace(/≈\$[\d,]+/g, (m) => lime(m));
|
|
7850
|
+
return `${dim(label)}${gap}${body}`;
|
|
7851
|
+
}
|
|
7852
|
+
const sub = /^( {2}[a-z]+ +)(.*)$/.exec(line);
|
|
7853
|
+
if (sub) return `${lime(sub[1] ?? "")}${dim(sub[2] ?? "")}`;
|
|
7854
|
+
if (/^ {10}\S/.test(line)) return dim(line);
|
|
7855
|
+
return line;
|
|
7856
|
+
}
|
|
7833
7857
|
|
|
7834
7858
|
// src/sync/server.ts
|
|
7835
7859
|
var SERVER_NAME = "aistack";
|