@use-aistack/cli 0.17.0 → 0.18.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 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 the full summary, and publish the measured layer to your stack. Nothing leaves your machine without your explicit approval at the prompt. Raw transcripts, prompts, and paths never leave at all - only aggregates.
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.17.0" : "0.0.0-dev";
18909
+ var CLI_VERSION = true ? "0.18.0" : "0.0.0-dev";
18910
18910
 
18911
18911
  // src/api.ts
18912
18912
  var BASE_URL = process.env.AISTACK_URL || "https://aistack.to";
@@ -29724,16 +29724,59 @@ function withheldCount(payload) {
29724
29724
  const w = payload.inventory.withheld;
29725
29725
  return w.builtinTools + w.mcpServers + w.skills + w.subagents + w.slashCommands;
29726
29726
  }
29727
- function buildGateDialog(ctx) {
29728
- const { payloads, keptPrivate } = ctx.body;
29729
- const n = payloads.reduce((a, p8) => a + withheldCount(p8), 0);
29730
- const lines2 = ["Publish to aistack?"];
29731
- if (n > 0) {
29732
- lines2.push(
29733
- keptPrivate === void 0 ? `${n} name${n === 1 ? "" : "s"} stay${n === 1 ? "s" : ""} on this machine` : `${n} private review name${n === 1 ? "" : "s"} will be stored`
29727
+ function buildGateDialog(_ctx) {
29728
+ return `Publish to aistack?
29729
+ ${PUBLIC_LINE}`;
29730
+ }
29731
+ var NEVER_SENT = "your prompts, responses, code, file paths, and repo names";
29732
+ var PUBLIC_LINE = "Nothing sensitive is shown in public.";
29733
+ function buildGateBrief(ctx) {
29734
+ const { body, config, source, baseUrl } = ctx;
29735
+ const host = baseUrl.replace(/^https?:\/\//, "");
29736
+ const out = [];
29737
+ if (config.stack === null) {
29738
+ out.push("No linked stack, so publish is unavailable.");
29739
+ } else {
29740
+ out.push(`Publishing to ${config.stack.name}`);
29741
+ out.push(`${host}/stacks/${config.stack.slug}`);
29742
+ }
29743
+ out.push("");
29744
+ const measured = body.payloads.filter((p8) => p8.activity.totalTokens > 0);
29745
+ const sessions = measured.reduce((a, p8) => a + p8.activity.sessions, 0);
29746
+ const tokens = measured.reduce((a, p8) => a + p8.activity.totalTokens, 0);
29747
+ const windowDays = body.payloads[0]?.window.days ?? 30;
29748
+ const counts2 = [
29749
+ `${measured.length} harness${measured.length === 1 ? "" : "es"}`,
29750
+ `${sessions.toLocaleString("en-US")} session${sessions === 1 ? "" : "s"}`,
29751
+ `${fmtTokens(tokens)} tokens`,
29752
+ `last ${windowDays} days`
29753
+ ];
29754
+ const workflow = config.publishWorkflow ? (body.measuredDays?.days ?? []).some((d) => d.workflow) : false;
29755
+ const kinds = [
29756
+ ...body.payloads.some((p8) => p8.models.length > 0) ? ["model names"] : [],
29757
+ ...body.payloads.some(
29758
+ (p8) => NAME_CATEGORIES.some((c) => p8.inventory[c].length > 0)
29759
+ ) ? ["tool and skill names"] : [],
29760
+ ...workflow ? ["time per phase", "git line counts"] : []
29761
+ ];
29762
+ out.push("Sent: statistics about your usage");
29763
+ out.push(` ${counts2.join(" \xB7 ")}`);
29764
+ if (kinds.length > 0) out.push(` ${kinds.join(", ")}`);
29765
+ out.push(`Never sent: ${NEVER_SENT}`);
29766
+ out.push(PUBLIC_LINE);
29767
+ if (body.autoSync !== void 0) {
29768
+ out.push("");
29769
+ out.push(
29770
+ `Auto-sync: ${body.autoSync.enabled ? `on, about every ${body.autoSync.frequencyHours} hours` : "off"}`
29734
29771
  );
29735
29772
  }
29736
- return lines2.join("\n");
29773
+ if (source === "bundled") {
29774
+ out.push("");
29775
+ out.push(
29776
+ "! Could not fetch your settings from aistack, so this publishes less."
29777
+ );
29778
+ }
29779
+ return out.join("\n");
29737
29780
  }
29738
29781
  var CATEGORY_LABEL = {
29739
29782
  builtinTools: "actions",
@@ -30075,11 +30118,11 @@ function buildGateSummary(ctx) {
30075
30118
  const examples = shown.map((r) => r.names > 1 ? `${r.label} \xD7${r.names}` : r.label).join(", ");
30076
30119
  const more = rows.length > shown.length ? `, ...${rows.length - shown.length} more` : "";
30077
30120
  out.push(
30078
- `private ${n} review name${n === 1 ? "" : "s"} \xB7 ${examples}${more}`
30121
+ `private ${n} unapproved name${n === 1 ? "" : "s"} \xB7 ${examples}${more}`
30079
30122
  );
30080
30123
  if (body.keptPrivate !== void 0 && config.stack !== null) {
30081
30124
  out.push(
30082
- ` stored privately for your review at ${host}/stacks/${config.stack.slug}/changes`
30125
+ ` never shown in public, only you see them at ${host}/stacks/${config.stack.slug}/changes`
30083
30126
  );
30084
30127
  out.push(
30085
30128
  " (turn off: Review kept-private names, on your stack)"
@@ -30478,6 +30521,7 @@ async function stageSync(deps) {
30478
30521
  body,
30479
30522
  keptPrivate,
30480
30523
  summary: buildGateSummary(ctx),
30524
+ brief: buildGateBrief(ctx),
30481
30525
  dialog: buildGateDialog(ctx),
30482
30526
  config,
30483
30527
  token,
@@ -30917,24 +30961,28 @@ async function syncCommand(options = {}) {
30917
30961
  }
30918
30962
  board.stop();
30919
30963
  const s = p7.spinner();
30920
- p7.log.message(staged.summary.split("\n").map(styleSummaryLine).join("\n"));
30964
+ p7.log.message(staged.brief.split("\n").map(styleBriefLine).join("\n"));
30921
30965
  if (staged.blockedReason !== null) {
30922
30966
  outroError(staged.blockedReason);
30923
30967
  process.exitCode = 1;
30924
30968
  return;
30925
30969
  }
30926
- const decision = await p7.select({
30927
- message: staged.dialog.split("\n").join(dim(" \xB7 ")),
30928
- options: [
30929
- {
30930
- value: "publish",
30931
- label: "Publish",
30932
- hint: "no sensitive data is shared"
30933
- },
30934
- { value: "cancel", label: "Cancel", hint: "nothing leaves this machine" }
30935
- ],
30936
- initialValue: "publish"
30937
- });
30970
+ let showedDetails = false;
30971
+ let decision;
30972
+ for (; ; ) {
30973
+ decision = await p7.select({
30974
+ message: "Publish to aistack?",
30975
+ options: [
30976
+ { value: "publish", label: "Publish" },
30977
+ ...showedDetails ? [] : [{ value: "details", label: "Show details" }],
30978
+ { value: "cancel", label: "Cancel", hint: "nothing is sent" }
30979
+ ],
30980
+ initialValue: "publish"
30981
+ });
30982
+ if (decision !== "details") break;
30983
+ showedDetails = true;
30984
+ p7.log.message(staged.summary.split("\n").map(styleSummaryLine).join("\n"));
30985
+ }
30938
30986
  if (p7.isCancel(decision) || decision !== "publish") {
30939
30987
  outroCancel("nothing was sent");
30940
30988
  return;
@@ -30944,24 +30992,10 @@ async function syncCommand(options = {}) {
30944
30992
  const res = await syncPublish(staged.token, staged.bodyJson);
30945
30993
  staged.acknowledgePublish?.();
30946
30994
  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
- ];
30995
+ const lines2 = ["See your stack:", lime(res.url)];
30953
30996
  if (res.keptPrivate.refused && staged.body.keptPrivate !== void 0) {
30954
30997
  lines2.push(
30955
- "Note: the server refused the kept-private names because its review switch is off. They stayed on this machine."
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."
30998
+ "Note: the server refused the unapproved names because its review switch is off. They stayed on this machine."
30965
30999
  );
30966
31000
  }
30967
31001
  p7.log.message(lines2.join("\n"));
@@ -30975,6 +31009,14 @@ async function syncCommand(options = {}) {
30975
31009
  process.exitCode = 1;
30976
31010
  }
30977
31011
  }
31012
+ function styleBriefLine(line) {
31013
+ const labelled = /^(Sent:|Never sent:|Auto-sync:)(.*)$/.exec(line);
31014
+ if (labelled) return `${dim(labelled[1] ?? "")}${labelled[2] ?? ""}`;
31015
+ if (line.startsWith("Publishing to ")) return bold(line);
31016
+ if (/^\S+\/stacks\//.test(line)) return lime(line);
31017
+ if (line.startsWith(" ")) return dim(line);
31018
+ return line;
31019
+ }
30978
31020
  function styleSummaryLine(line) {
30979
31021
  if (line.startsWith("\u2500")) return dim(line);
30980
31022
  const section2 = /^([A-Z][A-Z0-9 .-]+?)( \d+)?$/.exec(line);
@@ -31190,7 +31232,7 @@ function createSyncServer(deps, send) {
31190
31232
  );
31191
31233
  } else if (res.keptPrivate.stored > 0) {
31192
31234
  lines2.push(
31193
- `${res.keptPrivate.stored} private review name${res.keptPrivate.stored === 1 ? "" : "s"} stored at ${res.url}/changes`
31235
+ `${res.keptPrivate.stored} unapproved name${res.keptPrivate.stored === 1 ? "" : "s"} visible only to you at ${res.url}/changes, never shown in public`
31194
31236
  );
31195
31237
  }
31196
31238
  if (res.keptPrivate.machineStored > 0) {