@use-aistack/cli 0.17.0 → 0.18.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/README.md +6 -1
- package/dist/index.js +92 -44
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,12 @@ npx @use-aistack/cli sync
|
|
|
12
12
|
|
|
13
13
|
### `npx @use-aistack/cli sync`
|
|
14
14
|
|
|
15
|
-
The default command. Scan your local transcripts (rolling 30 days), review
|
|
15
|
+
The default command. Scan your local transcripts (rolling 30 days), review a short summary, and publish the measured layer to your stack. To read every name that would publish, choose **Show details** at the prompt. Nothing is sent until you choose **Publish**.
|
|
16
|
+
|
|
17
|
+
Your prompts, responses, code, and file paths never leave your machine. aistack publishes only statistics: counts, models, and the names of tools you use. Nothing sensitive is shown in public.
|
|
18
|
+
|
|
19
|
+
- **Sent:** session and token counts, model names, tool and skill names, time per workflow phase, and Git line counts.
|
|
20
|
+
- **Never sent:** your prompts, responses, code, file paths, and repo names.
|
|
16
21
|
|
|
17
22
|
```sh
|
|
18
23
|
npx @use-aistack/cli sync
|
package/dist/index.js
CHANGED
|
@@ -18906,7 +18906,7 @@ function apiEquivalentCost(modelKey, t, atMs) {
|
|
|
18906
18906
|
}
|
|
18907
18907
|
|
|
18908
18908
|
// src/version.ts
|
|
18909
|
-
var CLI_VERSION = true ? "0.
|
|
18909
|
+
var CLI_VERSION = true ? "0.18.1" : "0.0.0-dev";
|
|
18910
18910
|
|
|
18911
18911
|
// src/api.ts
|
|
18912
18912
|
var BASE_URL = process.env.AISTACK_URL || "https://aistack.to";
|
|
@@ -22782,6 +22782,7 @@ function buildSyncBody(built, syncConfig, autoSync, trigger = "manual", measured
|
|
|
22782
22782
|
aggregateVersion: MEASURED_DAYS_V1,
|
|
22783
22783
|
utcOffsetMinutes: measuredDays.utcOffsetMinutes,
|
|
22784
22784
|
...measuredDays.partial ? { partial: true } : {},
|
|
22785
|
+
...measuredDays.partial && measuredDays.partialHarnesses ? { partialHarnesses: measuredDays.partialHarnesses } : {},
|
|
22785
22786
|
days: applyDayConsent(measuredDays.days, syncConfig)
|
|
22786
22787
|
}
|
|
22787
22788
|
} : base;
|
|
@@ -29724,16 +29725,59 @@ function withheldCount(payload) {
|
|
|
29724
29725
|
const w = payload.inventory.withheld;
|
|
29725
29726
|
return w.builtinTools + w.mcpServers + w.skills + w.subagents + w.slashCommands;
|
|
29726
29727
|
}
|
|
29727
|
-
function buildGateDialog(
|
|
29728
|
-
|
|
29729
|
-
|
|
29730
|
-
|
|
29731
|
-
|
|
29732
|
-
|
|
29733
|
-
|
|
29728
|
+
function buildGateDialog(_ctx) {
|
|
29729
|
+
return `Publish to aistack?
|
|
29730
|
+
${PUBLIC_LINE}`;
|
|
29731
|
+
}
|
|
29732
|
+
var NEVER_SENT = "your prompts, responses, code, file paths, and repo names";
|
|
29733
|
+
var PUBLIC_LINE = "Nothing sensitive is shown in public.";
|
|
29734
|
+
function buildGateBrief(ctx) {
|
|
29735
|
+
const { body, config, source, baseUrl } = ctx;
|
|
29736
|
+
const host = baseUrl.replace(/^https?:\/\//, "");
|
|
29737
|
+
const out = [];
|
|
29738
|
+
if (config.stack === null) {
|
|
29739
|
+
out.push("No linked stack, so publish is unavailable.");
|
|
29740
|
+
} else {
|
|
29741
|
+
out.push(`Publishing to ${config.stack.name}`);
|
|
29742
|
+
out.push(`${host}/stacks/${config.stack.slug}`);
|
|
29743
|
+
}
|
|
29744
|
+
out.push("");
|
|
29745
|
+
const measured = body.payloads.filter((p8) => p8.activity.totalTokens > 0);
|
|
29746
|
+
const sessions = measured.reduce((a, p8) => a + p8.activity.sessions, 0);
|
|
29747
|
+
const tokens = measured.reduce((a, p8) => a + p8.activity.totalTokens, 0);
|
|
29748
|
+
const windowDays = body.payloads[0]?.window.days ?? 30;
|
|
29749
|
+
const counts2 = [
|
|
29750
|
+
`${measured.length} harness${measured.length === 1 ? "" : "es"}`,
|
|
29751
|
+
`${sessions.toLocaleString("en-US")} session${sessions === 1 ? "" : "s"}`,
|
|
29752
|
+
`${fmtTokens(tokens)} tokens`,
|
|
29753
|
+
`last ${windowDays} days`
|
|
29754
|
+
];
|
|
29755
|
+
const workflow = config.publishWorkflow ? (body.measuredDays?.days ?? []).some((d) => d.workflow) : false;
|
|
29756
|
+
const kinds = [
|
|
29757
|
+
...body.payloads.some((p8) => p8.models.length > 0) ? ["model names"] : [],
|
|
29758
|
+
...body.payloads.some(
|
|
29759
|
+
(p8) => NAME_CATEGORIES.some((c) => p8.inventory[c].length > 0)
|
|
29760
|
+
) ? ["tool and skill names"] : [],
|
|
29761
|
+
...workflow ? ["time per phase", "git line counts"] : []
|
|
29762
|
+
];
|
|
29763
|
+
out.push("Sent: statistics about your usage");
|
|
29764
|
+
out.push(` ${counts2.join(" \xB7 ")}`);
|
|
29765
|
+
if (kinds.length > 0) out.push(` ${kinds.join(", ")}`);
|
|
29766
|
+
out.push(`Never sent: ${NEVER_SENT}`);
|
|
29767
|
+
out.push(PUBLIC_LINE);
|
|
29768
|
+
if (body.autoSync !== void 0) {
|
|
29769
|
+
out.push("");
|
|
29770
|
+
out.push(
|
|
29771
|
+
`Auto-sync: ${body.autoSync.enabled ? `on, about every ${body.autoSync.frequencyHours} hours` : "off"}`
|
|
29734
29772
|
);
|
|
29735
29773
|
}
|
|
29736
|
-
|
|
29774
|
+
if (source === "bundled") {
|
|
29775
|
+
out.push("");
|
|
29776
|
+
out.push(
|
|
29777
|
+
"! Could not fetch your settings from aistack, so this publishes less."
|
|
29778
|
+
);
|
|
29779
|
+
}
|
|
29780
|
+
return out.join("\n");
|
|
29737
29781
|
}
|
|
29738
29782
|
var CATEGORY_LABEL = {
|
|
29739
29783
|
builtinTools: "actions",
|
|
@@ -30075,11 +30119,11 @@ function buildGateSummary(ctx) {
|
|
|
30075
30119
|
const examples = shown.map((r) => r.names > 1 ? `${r.label} \xD7${r.names}` : r.label).join(", ");
|
|
30076
30120
|
const more = rows.length > shown.length ? `, ...${rows.length - shown.length} more` : "";
|
|
30077
30121
|
out.push(
|
|
30078
|
-
`private ${n}
|
|
30122
|
+
`private ${n} unapproved name${n === 1 ? "" : "s"} \xB7 ${examples}${more}`
|
|
30079
30123
|
);
|
|
30080
30124
|
if (body.keptPrivate !== void 0 && config.stack !== null) {
|
|
30081
30125
|
out.push(
|
|
30082
|
-
`
|
|
30126
|
+
` never shown in public, only you see them at ${host}/stacks/${config.stack.slug}/changes`
|
|
30083
30127
|
);
|
|
30084
30128
|
out.push(
|
|
30085
30129
|
" (turn off: Review kept-private names, on your stack)"
|
|
@@ -30324,6 +30368,7 @@ async function stageSync(deps) {
|
|
|
30324
30368
|
`historical harnesses (${retentionDays} days): ${historical.map((a) => a.name).join(", ") || "none"}`
|
|
30325
30369
|
);
|
|
30326
30370
|
let dayScansComplete = true;
|
|
30371
|
+
const partialHarnesses = /* @__PURE__ */ new Set();
|
|
30327
30372
|
const sessionDatesByHarness = /* @__PURE__ */ new Map();
|
|
30328
30373
|
for (const { adapter, recent } of readings) {
|
|
30329
30374
|
if (!recent) continue;
|
|
@@ -30345,8 +30390,10 @@ async function stageSync(deps) {
|
|
|
30345
30390
|
for (const { adapter, history } of readings) {
|
|
30346
30391
|
if (!history) continue;
|
|
30347
30392
|
const { aggregate, workflow: workflow2, workflowLocal, scanComplete, sessionDates } = history;
|
|
30348
|
-
if (scanComplete === false || history.stats.filesUnreadable > 0 || aggregate.parseErrors > 0)
|
|
30393
|
+
if (scanComplete === false || history.stats.filesUnreadable > 0 || aggregate.parseErrors > 0) {
|
|
30349
30394
|
dayScansComplete = false;
|
|
30395
|
+
partialHarnesses.add(adapter.name);
|
|
30396
|
+
}
|
|
30350
30397
|
if (adapter.name === "grok-build" || adapter.name === "cursor")
|
|
30351
30398
|
sessionDatesByHarness.set(adapter.name, sessionDates ?? /* @__PURE__ */ new Map());
|
|
30352
30399
|
workflowScans.push({ aggregate: workflow2, local: workflowLocal });
|
|
@@ -30398,8 +30445,10 @@ async function stageSync(deps) {
|
|
|
30398
30445
|
for (const date of dates) correctionDates.add(date);
|
|
30399
30446
|
for (const dates of Object.values(current))
|
|
30400
30447
|
for (const date of dates) correctionDates.add(date);
|
|
30401
|
-
if (Object.keys(previous).some((id) => !(id in current)))
|
|
30448
|
+
if (Object.keys(previous).some((id) => !(id in current))) {
|
|
30402
30449
|
dayScansComplete = false;
|
|
30450
|
+
partialHarnesses.add(harness);
|
|
30451
|
+
}
|
|
30403
30452
|
acknowledgements.push(() => saveGrokDateHints(scope, current));
|
|
30404
30453
|
}
|
|
30405
30454
|
if (acknowledgements.length && dayScansComplete)
|
|
@@ -30429,7 +30478,7 @@ async function stageSync(deps) {
|
|
|
30429
30478
|
deps.trigger,
|
|
30430
30479
|
historical.length > 0 ? {
|
|
30431
30480
|
aggregateVersion: MEASURED_DAYS_V1,
|
|
30432
|
-
...!dayScansComplete ? { partial: true } : {},
|
|
30481
|
+
...!dayScansComplete ? { partial: true, partialHarnesses: [...partialHarnesses].sort() } : {},
|
|
30433
30482
|
utcOffsetMinutes: workflow?.utcOffsetMinutes ?? machineUtcOffsetMinutes(),
|
|
30434
30483
|
days: days.send
|
|
30435
30484
|
} : void 0,
|
|
@@ -30478,6 +30527,7 @@ async function stageSync(deps) {
|
|
|
30478
30527
|
body,
|
|
30479
30528
|
keptPrivate,
|
|
30480
30529
|
summary: buildGateSummary(ctx),
|
|
30530
|
+
brief: buildGateBrief(ctx),
|
|
30481
30531
|
dialog: buildGateDialog(ctx),
|
|
30482
30532
|
config,
|
|
30483
30533
|
token,
|
|
@@ -30917,24 +30967,28 @@ async function syncCommand(options = {}) {
|
|
|
30917
30967
|
}
|
|
30918
30968
|
board.stop();
|
|
30919
30969
|
const s = p7.spinner();
|
|
30920
|
-
p7.log.message(staged.
|
|
30970
|
+
p7.log.message(staged.brief.split("\n").map(styleBriefLine).join("\n"));
|
|
30921
30971
|
if (staged.blockedReason !== null) {
|
|
30922
30972
|
outroError(staged.blockedReason);
|
|
30923
30973
|
process.exitCode = 1;
|
|
30924
30974
|
return;
|
|
30925
30975
|
}
|
|
30926
|
-
|
|
30927
|
-
|
|
30928
|
-
|
|
30929
|
-
|
|
30930
|
-
|
|
30931
|
-
|
|
30932
|
-
|
|
30933
|
-
|
|
30934
|
-
|
|
30935
|
-
|
|
30936
|
-
|
|
30937
|
-
|
|
30976
|
+
let showedDetails = false;
|
|
30977
|
+
let decision;
|
|
30978
|
+
for (; ; ) {
|
|
30979
|
+
decision = await p7.select({
|
|
30980
|
+
message: "Publish to aistack?",
|
|
30981
|
+
options: [
|
|
30982
|
+
{ value: "publish", label: "Publish" },
|
|
30983
|
+
...showedDetails ? [] : [{ value: "details", label: "Show details" }],
|
|
30984
|
+
{ value: "cancel", label: "Cancel", hint: "nothing is sent" }
|
|
30985
|
+
],
|
|
30986
|
+
initialValue: "publish"
|
|
30987
|
+
});
|
|
30988
|
+
if (decision !== "details") break;
|
|
30989
|
+
showedDetails = true;
|
|
30990
|
+
p7.log.message(staged.summary.split("\n").map(styleSummaryLine).join("\n"));
|
|
30991
|
+
}
|
|
30938
30992
|
if (p7.isCancel(decision) || decision !== "publish") {
|
|
30939
30993
|
outroCancel("nothing was sent");
|
|
30940
30994
|
return;
|
|
@@ -30944,24 +30998,10 @@ async function syncCommand(options = {}) {
|
|
|
30944
30998
|
const res = await syncPublish(staged.token, staged.bodyJson);
|
|
30945
30999
|
staged.acknowledgePublish?.();
|
|
30946
31000
|
s.stop("Published");
|
|
30947
|
-
const lines2 = [
|
|
30948
|
-
`Snapshot received ${fmtReceivedAt(res.receivedAt)}`,
|
|
30949
|
-
"",
|
|
30950
|
-
"Your stack now shows what actually ran:",
|
|
30951
|
-
lime(res.url)
|
|
30952
|
-
];
|
|
31001
|
+
const lines2 = ["See your stack:", lime(res.url)];
|
|
30953
31002
|
if (res.keptPrivate.refused && staged.body.keptPrivate !== void 0) {
|
|
30954
31003
|
lines2.push(
|
|
30955
|
-
"Note: the server refused the
|
|
30956
|
-
);
|
|
30957
|
-
} else if (res.keptPrivate.stored > 0) {
|
|
30958
|
-
lines2.push(
|
|
30959
|
-
`${res.keptPrivate.stored} private review name${res.keptPrivate.stored === 1 ? "" : "s"} stored at ${res.url}/changes`
|
|
30960
|
-
);
|
|
30961
|
-
}
|
|
30962
|
-
if (res.keptPrivate.machineStored > 0) {
|
|
30963
|
-
lines2.push(
|
|
30964
|
-
"This machine's private label was stored for the same review."
|
|
31004
|
+
"Note: the server refused the unapproved names because its review switch is off. They stayed on this machine."
|
|
30965
31005
|
);
|
|
30966
31006
|
}
|
|
30967
31007
|
p7.log.message(lines2.join("\n"));
|
|
@@ -30975,6 +31015,14 @@ async function syncCommand(options = {}) {
|
|
|
30975
31015
|
process.exitCode = 1;
|
|
30976
31016
|
}
|
|
30977
31017
|
}
|
|
31018
|
+
function styleBriefLine(line) {
|
|
31019
|
+
const labelled = /^(Sent:|Never sent:|Auto-sync:)(.*)$/.exec(line);
|
|
31020
|
+
if (labelled) return `${dim(labelled[1] ?? "")}${labelled[2] ?? ""}`;
|
|
31021
|
+
if (line.startsWith("Publishing to ")) return bold(line);
|
|
31022
|
+
if (/^\S+\/stacks\//.test(line)) return lime(line);
|
|
31023
|
+
if (line.startsWith(" ")) return dim(line);
|
|
31024
|
+
return line;
|
|
31025
|
+
}
|
|
30978
31026
|
function styleSummaryLine(line) {
|
|
30979
31027
|
if (line.startsWith("\u2500")) return dim(line);
|
|
30980
31028
|
const section2 = /^([A-Z][A-Z0-9 .-]+?)( \d+)?$/.exec(line);
|
|
@@ -31190,7 +31238,7 @@ function createSyncServer(deps, send) {
|
|
|
31190
31238
|
);
|
|
31191
31239
|
} else if (res.keptPrivate.stored > 0) {
|
|
31192
31240
|
lines2.push(
|
|
31193
|
-
`${res.keptPrivate.stored}
|
|
31241
|
+
`${res.keptPrivate.stored} unapproved name${res.keptPrivate.stored === 1 ? "" : "s"} visible only to you at ${res.url}/changes, never shown in public`
|
|
31194
31242
|
);
|
|
31195
31243
|
}
|
|
31196
31244
|
if (res.keptPrivate.machineStored > 0) {
|