@autohq/cli 0.1.176 → 0.1.178

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.
@@ -26572,7 +26572,7 @@ Object.assign(lookup, {
26572
26572
  // package.json
26573
26573
  var package_default = {
26574
26574
  name: "@autohq/cli",
26575
- version: "0.1.176",
26575
+ version: "0.1.178",
26576
26576
  license: "SEE LICENSE IN README.md",
26577
26577
  publishConfig: {
26578
26578
  access: "public"
package/dist/index.js CHANGED
@@ -21682,7 +21682,7 @@ var init_package = __esm({
21682
21682
  "package.json"() {
21683
21683
  package_default = {
21684
21684
  name: "@autohq/cli",
21685
- version: "0.1.176",
21685
+ version: "0.1.178",
21686
21686
  license: "SEE LICENSE IN README.md",
21687
21687
  publishConfig: {
21688
21688
  access: "public"
@@ -22393,6 +22393,64 @@ var init_conversation2 = __esm({
22393
22393
  }
22394
22394
  });
22395
22395
 
22396
+ // src/lib/output/progress.ts
22397
+ function createSpinner(options) {
22398
+ if (!options.enabled) {
22399
+ return NOOP_SPINNER;
22400
+ }
22401
+ const stream = options.stream ?? process.stderr;
22402
+ const intervalMs = options.intervalMs ?? FRAME_INTERVAL_MS;
22403
+ const now3 = options.now ?? Date.now;
22404
+ const setIntervalFn = options.setInterval ?? setInterval;
22405
+ const clearIntervalFn = options.clearInterval ?? clearInterval;
22406
+ let label = "";
22407
+ let frame = 0;
22408
+ let startedAt = 0;
22409
+ let timer;
22410
+ const render2 = () => {
22411
+ const elapsedSeconds2 = Math.floor((now3() - startedAt) / 1e3);
22412
+ const suffix = elapsedSeconds2 >= 1 ? ` (${elapsedSeconds2}s)` : "";
22413
+ stream.write(`${CLEAR_LINE}${FRAMES[frame]} ${label}${suffix}`);
22414
+ frame = (frame + 1) % FRAMES.length;
22415
+ };
22416
+ return {
22417
+ start(next) {
22418
+ label = next;
22419
+ frame = 0;
22420
+ startedAt = now3();
22421
+ if (timer === void 0) {
22422
+ stream.write(HIDE_CURSOR);
22423
+ timer = setIntervalFn(render2, intervalMs);
22424
+ }
22425
+ render2();
22426
+ },
22427
+ stop() {
22428
+ if (timer !== void 0) {
22429
+ clearIntervalFn(timer);
22430
+ timer = void 0;
22431
+ stream.write(`${CLEAR_LINE}${SHOW_CURSOR}`);
22432
+ }
22433
+ }
22434
+ };
22435
+ }
22436
+ var FRAMES, FRAME_INTERVAL_MS, HIDE_CURSOR, SHOW_CURSOR, CLEAR_LINE, NOOP_SPINNER;
22437
+ var init_progress = __esm({
22438
+ "src/lib/output/progress.ts"() {
22439
+ "use strict";
22440
+ FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
22441
+ FRAME_INTERVAL_MS = 80;
22442
+ HIDE_CURSOR = "\x1B[?25l";
22443
+ SHOW_CURSOR = "\x1B[?25h";
22444
+ CLEAR_LINE = "\r\x1B[K";
22445
+ NOOP_SPINNER = {
22446
+ start() {
22447
+ },
22448
+ stop() {
22449
+ }
22450
+ };
22451
+ }
22452
+ });
22453
+
22396
22454
  // src/commands/apply/agent-tool-connect.ts
22397
22455
  async function connectAgentTool(input) {
22398
22456
  if (input.manual) {
@@ -23851,7 +23909,8 @@ async function applyResource(input) {
23851
23909
  client: input.client,
23852
23910
  input: bundleInput,
23853
23911
  writeOutput: input.writeOutput,
23854
- style: input.style
23912
+ style: input.style,
23913
+ io: input.io
23855
23914
  });
23856
23915
  }
23857
23916
  async function applyProjectBundleInput(input) {
@@ -23864,31 +23923,42 @@ async function applyProjectBundleInput(input) {
23864
23923
  `Project apply bundle is ${formatMegabytes(sizeBytes)}MB, over the ${formatMegabytes(MAX_PROJECT_APPLY_BUNDLE_BYTES)}MB upload limit.`
23865
23924
  );
23866
23925
  }
23867
- const upload = await input.client.prepareProjectApplyBundleUpload(
23868
- {
23869
- sha256: createHash5("sha256").update(body).digest("hex"),
23870
- sizeBytes
23871
- },
23872
- { apiBaseUrl: input.commandOptions.apiBaseUrl }
23873
- );
23874
- await input.client.uploadProjectApplyBundle({
23875
- uploadUrl: upload.uploadUrl,
23876
- method: upload.method,
23877
- contentType: upload.contentType,
23878
- body
23926
+ const spinner = createSpinner({
23927
+ enabled: applyProgressEnabled(input.io, input.commandOptions.json)
23879
23928
  });
23880
- const response = await input.client.applyProjectResources(
23881
- {
23882
- source: {
23883
- kind: "bundle",
23884
- bundle: upload.source,
23885
- entrypoint: input.input.entrypoint
23929
+ let response;
23930
+ try {
23931
+ spinner.start("Preparing upload");
23932
+ const upload = await input.client.prepareProjectApplyBundleUpload(
23933
+ {
23934
+ sha256: createHash5("sha256").update(body).digest("hex"),
23935
+ sizeBytes
23886
23936
  },
23887
- dryRun,
23888
- prune
23889
- },
23890
- { apiBaseUrl: input.commandOptions.apiBaseUrl }
23891
- );
23937
+ { apiBaseUrl: input.commandOptions.apiBaseUrl }
23938
+ );
23939
+ spinner.start("Uploading bundle");
23940
+ await input.client.uploadProjectApplyBundle({
23941
+ uploadUrl: upload.uploadUrl,
23942
+ method: upload.method,
23943
+ contentType: upload.contentType,
23944
+ body
23945
+ });
23946
+ spinner.start(dryRun ? "Computing apply plan" : "Applying resources");
23947
+ response = await input.client.applyProjectResources(
23948
+ {
23949
+ source: {
23950
+ kind: "bundle",
23951
+ bundle: upload.source,
23952
+ entrypoint: input.input.entrypoint
23953
+ },
23954
+ dryRun,
23955
+ prune
23956
+ },
23957
+ { apiBaseUrl: input.commandOptions.apiBaseUrl }
23958
+ );
23959
+ } finally {
23960
+ spinner.stop();
23961
+ }
23892
23962
  await writeProjectApplyResponse({
23893
23963
  commandOptions: {
23894
23964
  ...input.commandOptions,
@@ -24005,10 +24075,14 @@ function planActionStyle(style, action) {
24005
24075
  function formatMegabytes(bytes) {
24006
24076
  return (bytes / (1024 * 1024)).toFixed(1);
24007
24077
  }
24078
+ function applyProgressEnabled(io2, json2) {
24079
+ return !!io2 && io2.isTTY && !io2.isCI && io2.outputMode !== "json" && io2.outputMode !== "stream-json" && !json2;
24080
+ }
24008
24081
  var init_actions = __esm({
24009
24082
  "src/commands/apply/actions.ts"() {
24010
24083
  "use strict";
24011
24084
  init_src();
24085
+ init_progress();
24012
24086
  init_style();
24013
24087
  init_agent_tool_connect();
24014
24088
  init_files();
@@ -24157,7 +24231,8 @@ async function editResource(input) {
24157
24231
  },
24158
24232
  client: input.client,
24159
24233
  input: bundleInput,
24160
- writeOutput: input.writeOutput
24234
+ writeOutput: input.writeOutput,
24235
+ io: input.io
24161
24236
  });
24162
24237
  removeTempFile = true;
24163
24238
  return { changed: true, resource: reference };
@@ -32601,7 +32676,8 @@ function registerApplyCommands(program, context) {
32601
32676
  },
32602
32677
  client: createContextApiClient(context),
32603
32678
  writeOutput: context.writeOutput,
32604
- style: context.io.style
32679
+ style: context.io.style,
32680
+ io: context.io
32605
32681
  });
32606
32682
  });
32607
32683
  }
@@ -33719,7 +33795,8 @@ function registerEditCommands(program, context) {
33719
33795
  client: createContextApiClient(context),
33720
33796
  env: context.env,
33721
33797
  resource,
33722
- writeOutput: context.writeOutput
33798
+ writeOutput: context.writeOutput,
33799
+ io: context.io
33723
33800
  });
33724
33801
  });
33725
33802
  }
@@ -35668,7 +35745,9 @@ async function setupAction(context, options) {
35668
35745
  context.writeOutput("Tag `@auto.onboarding` in Slack to begin.");
35669
35746
  }
35670
35747
  async function showPitchAndWait(context) {
35671
- context.writeOutput(setupPitchText(context.io.style));
35748
+ context.writeOutput(
35749
+ setupPitchText(context.io.style, { terminalWidth: context.stdout.columns })
35750
+ );
35672
35751
  if (!context.io.canPrompt()) {
35673
35752
  throw new Error("`auto setup` requires an interactive terminal.");
35674
35753
  }
@@ -35859,9 +35938,9 @@ async function selectRepository(context, github, explicitRepo) {
35859
35938
  "GitHub repository to install Auto in (owner/repo): "
35860
35939
  );
35861
35940
  }
35862
- function setupPitchText(style = plainStyle) {
35941
+ function setupPitchText(style = plainStyle, options = {}) {
35863
35942
  return [
35864
- ...autoLogo(style),
35943
+ ...autoLogo(style, options.terminalWidth),
35865
35944
  "",
35866
35945
  style.heading(
35867
35946
  "auto lets you program software factories the same way you program CI/CD."
@@ -35906,14 +35985,49 @@ function setupPitchText(style = plainStyle) {
35906
35985
  ""
35907
35986
  ].join("\n");
35908
35987
  }
35909
- function autoLogo(style) {
35910
- return [
35911
- style.id(" _ "),
35912
- style.id(" __ _ _ _| |_ ___ "),
35913
- style.id(" / _` | | | | __/ _ \\ "),
35914
- style.id("| (_| | |_| | || (_) |"),
35915
- style.id(" \\__,_|\\__,_|\\__\\___/ ")
35916
- ];
35988
+ function autoLogo(style = plainStyle, terminalWidth) {
35989
+ const width = terminalWidth ?? Number.POSITIVE_INFINITY;
35990
+ const logo = SETUP_AUTO_LOGOS.find(
35991
+ (candidate) => logoWidth(candidate) <= width
35992
+ ) ?? ["auto"];
35993
+ return logo.map((line) => style.id(line));
35994
+ }
35995
+ var SETUP_AUTO_LOGOS = [
35996
+ [
35997
+ " \u2584\u2584\u2584\u2584",
35998
+ " \u2584\u2584\u2584\u2584",
35999
+ " \u2584\u2584\u2584\u2584",
36000
+ " \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584",
36001
+ " \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584",
36002
+ "\u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584",
36003
+ "\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584",
36004
+ " \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584",
36005
+ " \u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584",
36006
+ " \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584",
36007
+ " \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584",
36008
+ "\u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584",
36009
+ "\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584",
36010
+ "\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584",
36011
+ "\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584",
36012
+ " \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584",
36013
+ " \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584"
36014
+ ],
36015
+ [
36016
+ " \u2584\u2584",
36017
+ " \u2584\u2584",
36018
+ " \u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584 \u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584",
36019
+ " \u2584\u2584\u2584\u2584 \u2584\u2584 \u2584\u2584 \u2584\u2584 \u2584\u2584 \u2584\u2584\u2584 \u2584\u2584\u2584",
36020
+ " \u2584\u2584 \u2584\u2584 \u2584\u2584 \u2584\u2584 \u2584\u2584 \u2584\u2584\u2584 \u2584\u2584\u2584",
36021
+ " \u2584\u2584\u2584\u2584 \u2584\u2584 \u2584\u2584 \u2584\u2584 \u2584\u2584\u2584 \u2584\u2584\u2584",
36022
+ " \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584 \u2584\u2584 \u2584\u2584 \u2584\u2584\u2584 \u2584\u2584\u2584",
36023
+ " \u2584\u2584\u2584\u2584 \u2584\u2584 \u2584\u2584 \u2584\u2584 \u2584\u2584 \u2584\u2584\u2584 \u2584\u2584\u2584",
36024
+ " \u2584\u2584 \u2584\u2584 \u2584\u2584 \u2584\u2584 \u2584\u2584 \u2584\u2584\u2584 \u2584\u2584\u2584",
36025
+ " \u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584 \u2584\u2584\u2584",
36026
+ " \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584"
36027
+ ]
36028
+ ];
36029
+ function logoWidth(logo) {
36030
+ return Math.max(...logo.map((line) => line.length));
35917
36031
  }
35918
36032
  function bullet(style, text) {
35919
36033
  return `${style.id(" -")} ${text}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.176",
3
+ "version": "0.1.178",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"