@autohq/cli 0.1.102 → 0.1.103

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.
Files changed (2) hide show
  1. package/dist/index.js +562 -238
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -17496,7 +17496,7 @@ var init_sessions = __esm({
17496
17496
  message: `description must be at most ${SESSION_IDENTITY_DESCRIPTION_MAX_LENGTH} characters as Slack counts them (a non-ASCII character like "\u2014" counts as 6)`
17497
17497
  }
17498
17498
  ).optional()
17499
- }).strict().refine((identity) => Object.keys(identity).length > 0, {
17499
+ }).strict().refine((identity2) => Object.keys(identity2).length > 0, {
17500
17500
  message: "Session identity requires at least one field"
17501
17501
  });
17502
17502
  SessionSpecSchema = external_exports.object({
@@ -20371,6 +20371,47 @@ var init_client = __esm({
20371
20371
  }
20372
20372
  });
20373
20373
 
20374
+ // src/lib/output/style.ts
20375
+ import { Chalk } from "chalk";
20376
+ function createStyle(flags) {
20377
+ const textual = flags.outputMode === "text" || flags.outputMode === "tui";
20378
+ if (!textual || flags.noColor || !flags.isTTY) {
20379
+ return plainStyle;
20380
+ }
20381
+ const chalk2 = new Chalk({ level: 1 });
20382
+ return {
20383
+ enabled: true,
20384
+ success: (text) => chalk2.green(text),
20385
+ warn: (text) => chalk2.yellow(text),
20386
+ error: (text) => chalk2.red(text),
20387
+ heading: (text) => chalk2.bold.underline(text),
20388
+ label: (text) => chalk2.bold(text),
20389
+ id: (text) => chalk2.cyan(text),
20390
+ url: (text) => chalk2.cyan.underline(text),
20391
+ dim: (text) => chalk2.dim(text)
20392
+ };
20393
+ }
20394
+ function identity(text) {
20395
+ return text;
20396
+ }
20397
+ var plainStyle;
20398
+ var init_style = __esm({
20399
+ "src/lib/output/style.ts"() {
20400
+ "use strict";
20401
+ plainStyle = {
20402
+ enabled: false,
20403
+ success: identity,
20404
+ warn: identity,
20405
+ error: identity,
20406
+ heading: identity,
20407
+ label: identity,
20408
+ id: identity,
20409
+ url: identity,
20410
+ dim: identity
20411
+ };
20412
+ }
20413
+ });
20414
+
20374
20415
  // src/lib/browser.ts
20375
20416
  import { spawn } from "child_process";
20376
20417
  function openBrowser(url2) {
@@ -21165,10 +21206,12 @@ async function applyResource(input) {
21165
21206
  },
21166
21207
  client: input.client,
21167
21208
  request,
21168
- writeOutput: input.writeOutput
21209
+ writeOutput: input.writeOutput,
21210
+ style: input.style
21169
21211
  });
21170
21212
  }
21171
21213
  async function applyProjectInput(input) {
21214
+ const style = input.style ?? plainStyle;
21172
21215
  const response = await input.client.applyProjectResources(
21173
21216
  {
21174
21217
  ...input.request.delete.length > 0 ? { delete: input.request.delete } : {},
@@ -21194,7 +21237,10 @@ async function applyProjectInput(input) {
21194
21237
  );
21195
21238
  for (const item of response.plan) {
21196
21239
  input.writeOutput(
21197
- `${item.action.padEnd(actionWidth + 2)}${item.kind}/${item.name}`
21240
+ `${planActionStyle(
21241
+ style,
21242
+ item.action
21243
+ )(item.action.padEnd(actionWidth + 2))}${item.kind}/${item.name}`
21198
21244
  );
21199
21245
  }
21200
21246
  if (input.commandOptions.connect) {
@@ -21202,30 +21248,42 @@ async function applyProjectInput(input) {
21202
21248
  input.request
21203
21249
  )) {
21204
21250
  input.writeOutput(
21205
- `would connect tool/${item.tool} connection/${item.connection}`
21251
+ style.dim(
21252
+ `would connect tool/${item.tool} connection/${item.connection}`
21253
+ )
21206
21254
  );
21207
21255
  }
21208
21256
  }
21209
- writeDiagnostics(response.diagnostics, input.writeOutput);
21257
+ writeDiagnostics(response.diagnostics, input.writeOutput, style);
21210
21258
  return;
21211
21259
  }
21212
21260
  for (const { kind, resource } of resources) {
21213
- input.writeOutput(`kind ${kind}`);
21214
- input.writeOutput(`name ${resource.metadata.name}`);
21215
- input.writeOutput(`uid ${resource.metadata.uid}`);
21216
- input.writeOutput(`generation ${resource.metadata.generation}`);
21217
- input.writeOutput(`resource_version ${resource.metadata.resourceVersion}`);
21261
+ input.writeOutput(`${style.label("kind")} ${kind}`);
21262
+ input.writeOutput(`${style.label("name")} ${resource.metadata.name}`);
21263
+ input.writeOutput(
21264
+ `${style.label("uid")} ${style.id(resource.metadata.uid)}`
21265
+ );
21266
+ input.writeOutput(
21267
+ `${style.label("generation")} ${resource.metadata.generation}`
21268
+ );
21269
+ input.writeOutput(
21270
+ `${style.label("resource_version")} ${resource.metadata.resourceVersion}`
21271
+ );
21218
21272
  }
21219
21273
  for (const trigger of response.triggers) {
21220
- input.writeOutput(`webhook_event ${trigger.event}`);
21221
- input.writeOutput(`webhook_endpoint ${trigger.endpoint}`);
21222
- input.writeOutput(`webhook_ingest_url ${trigger.ingestUrl}`);
21223
- input.writeOutput(`webhook_status ${trigger.status}`);
21274
+ input.writeOutput(`${style.label("webhook_event")} ${trigger.event}`);
21275
+ input.writeOutput(`${style.label("webhook_endpoint")} ${trigger.endpoint}`);
21276
+ input.writeOutput(
21277
+ `${style.label("webhook_ingest_url")} ${style.url(trigger.ingestUrl)}`
21278
+ );
21279
+ input.writeOutput(`${style.label("webhook_status")} ${trigger.status}`);
21224
21280
  }
21225
21281
  for (const resource of response.pruned) {
21226
- input.writeOutput(`pruned ${resource.kind}/${resource.name}`);
21282
+ input.writeOutput(
21283
+ `${style.warn("pruned")} ${resource.kind}/${resource.name}`
21284
+ );
21227
21285
  }
21228
- writeDiagnostics(response.diagnostics, input.writeOutput);
21286
+ writeDiagnostics(response.diagnostics, input.writeOutput, style);
21229
21287
  if (input.commandOptions.connect) {
21230
21288
  const connections = mcpOAuthToolConnectionsFromAppliedResources(resources);
21231
21289
  for (const item of connections) {
@@ -21239,16 +21297,32 @@ async function applyProjectInput(input) {
21239
21297
  }
21240
21298
  }
21241
21299
  }
21242
- function writeDiagnostics(diagnostics, writeOutput) {
21300
+ function writeDiagnostics(diagnostics, writeOutput, style) {
21243
21301
  for (const diagnostic of diagnostics) {
21302
+ const severity = diagnostic.severity === "error" ? style.error(diagnostic.severity) : style.warn(diagnostic.severity);
21244
21303
  writeOutput(
21245
- `${diagnostic.severity} ${diagnostic.kind}/${diagnostic.name}: ${diagnostic.message}`
21304
+ `${severity} ${diagnostic.kind}/${diagnostic.name}: ${diagnostic.message}`
21246
21305
  );
21247
21306
  }
21248
21307
  }
21308
+ function planActionStyle(style, action) {
21309
+ switch (action) {
21310
+ case "create":
21311
+ return style.success;
21312
+ case "update":
21313
+ return style.warn;
21314
+ case "archive":
21315
+ return style.error;
21316
+ case "unchanged":
21317
+ return style.dim;
21318
+ default:
21319
+ return (text) => text;
21320
+ }
21321
+ }
21249
21322
  var init_actions = __esm({
21250
21323
  "src/commands/apply/actions.ts"() {
21251
21324
  "use strict";
21325
+ init_style();
21252
21326
  init_connect();
21253
21327
  init_files();
21254
21328
  }
@@ -21306,6 +21380,7 @@ var init_pkce = __esm({
21306
21380
 
21307
21381
  // src/commands/auth/login.ts
21308
21382
  async function login(input) {
21383
+ const style = input.style ?? plainStyle;
21309
21384
  const serverUrl = resolveApiBaseUrl({ explicit: input.options.apiUrl });
21310
21385
  if (input.options.device) {
21311
21386
  const device = await postJson(
@@ -21314,9 +21389,13 @@ async function login(input) {
21314
21389
  {}
21315
21390
  );
21316
21391
  input.writeOutput(
21317
- `Open ${device.verification_uri} and enter ${device.user_code}`
21392
+ `Open ${style.url(device.verification_uri)} and enter ${style.label(
21393
+ device.user_code
21394
+ )}`
21395
+ );
21396
+ input.writeOutput(
21397
+ `${style.label("Device code:")} ${style.id(device.device_code)}`
21318
21398
  );
21319
- input.writeOutput(`Device code: ${device.device_code}`);
21320
21399
  const deadline = Date.now() + device.expires_in * 1e3;
21321
21400
  let firstAttempt = true;
21322
21401
  while (Date.now() < deadline) {
@@ -21345,7 +21424,8 @@ async function login(input) {
21345
21424
  serverUrl,
21346
21425
  fetch: input.fetch,
21347
21426
  configPath: input.configPath,
21348
- writeOutput: input.writeOutput
21427
+ writeOutput: input.writeOutput,
21428
+ style
21349
21429
  });
21350
21430
  return;
21351
21431
  }
@@ -21373,8 +21453,8 @@ async function login(input) {
21373
21453
  const authorizeUrl = new URL("/auth/cli", serverUrl);
21374
21454
  authorizeUrl.searchParams.set("pkce_challenge", pkceChallenge(verifier));
21375
21455
  authorizeUrl.searchParams.set("redirect_uri", callback.redirectUri);
21376
- input.writeOutput(`Opening ${authorizeUrl.toString()}`);
21377
- input.writeOutput("Waiting for browser authorization...");
21456
+ input.writeOutput(`Opening ${style.url(authorizeUrl.toString())}`);
21457
+ input.writeOutput(style.dim("Waiting for browser authorization..."));
21378
21458
  openBrowser(authorizeUrl.toString());
21379
21459
  const { code } = await callback.result;
21380
21460
  const token3 = await exchangeAuthorizationCode({
@@ -21389,7 +21469,8 @@ async function login(input) {
21389
21469
  serverUrl,
21390
21470
  fetch: input.fetch,
21391
21471
  configPath: input.configPath,
21392
- writeOutput: input.writeOutput
21472
+ writeOutput: input.writeOutput,
21473
+ style
21393
21474
  });
21394
21475
  return;
21395
21476
  } finally {
@@ -21408,7 +21489,8 @@ async function login(input) {
21408
21489
  serverUrl,
21409
21490
  fetch: input.fetch,
21410
21491
  configPath: input.configPath,
21411
- writeOutput: input.writeOutput
21492
+ writeOutput: input.writeOutput,
21493
+ style
21412
21494
  });
21413
21495
  }
21414
21496
  async function exchangeAuthorizationCode(input) {
@@ -21468,13 +21550,17 @@ async function finishLogin(input) {
21468
21550
  };
21469
21551
  } catch {
21470
21552
  input.writeOutput(
21471
- "The saved organization/project selection is not available for this account; run `auto orgs list` to pick a new one."
21553
+ input.style.warn(
21554
+ "The saved organization/project selection is not available for this account; run `auto orgs list` to pick a new one."
21555
+ )
21472
21556
  );
21473
21557
  }
21474
21558
  }
21475
21559
  writeConfig(config2, input.configPath);
21476
21560
  input.writeOutput(
21477
- token2.user ? `Logged in as ${token2.user.email}.` : "Logged in."
21561
+ input.style.success(
21562
+ token2.user ? `Logged in as ${token2.user.email}.` : "Logged in."
21563
+ )
21478
21564
  );
21479
21565
  }
21480
21566
  async function sleep(ms) {
@@ -21490,6 +21576,7 @@ var init_login = __esm({
21490
21576
  init_file();
21491
21577
  init_profiles2();
21492
21578
  init_loopback();
21579
+ init_style();
21493
21580
  init_pkce();
21494
21581
  }
21495
21582
  });
@@ -21771,7 +21858,7 @@ var init_package = __esm({
21771
21858
  "package.json"() {
21772
21859
  package_default = {
21773
21860
  name: "@autohq/cli",
21774
- version: "0.1.102",
21861
+ version: "0.1.103",
21775
21862
  license: "SEE LICENSE IN README.md",
21776
21863
  publishConfig: {
21777
21864
  access: "public"
@@ -28824,7 +28911,8 @@ function registerApplyCommands(program, context) {
28824
28911
  apiBaseUrl: apiUrlFromOptions(context, commandOptions)
28825
28912
  },
28826
28913
  client: createContextApiClient(context),
28827
- writeOutput: context.writeOutput
28914
+ writeOutput: context.writeOutput,
28915
+ style: context.io.style
28828
28916
  });
28829
28917
  });
28830
28918
  }
@@ -28858,7 +28946,7 @@ function logout(context) {
28858
28946
  },
28859
28947
  context.configPath
28860
28948
  );
28861
- context.writeOutput("Logged out.");
28949
+ context.writeOutput(context.io.style.success("Logged out."));
28862
28950
  }
28863
28951
  function switchAccount(context, accountEmail, options = {}) {
28864
28952
  const profiles = listProfiles(context.configPath);
@@ -28868,7 +28956,9 @@ function switchAccount(context, accountEmail, options = {}) {
28868
28956
  const active = readConfig(context.configPath);
28869
28957
  if (!accountEmail) {
28870
28958
  for (const profile of profiles) {
28871
- context.writeOutput(accountLine(profile.config, active));
28959
+ context.writeOutput(
28960
+ accountLine(profile.config, active, context.io.style)
28961
+ );
28872
28962
  }
28873
28963
  return;
28874
28964
  }
@@ -28889,20 +28979,26 @@ function switchAccount(context, accountEmail, options = {}) {
28889
28979
  );
28890
28980
  }
28891
28981
  writeConfig(match, context.configPath);
28892
- context.writeOutput(`Switched to ${match.userEmail} (${match.serverUrl}).`);
28982
+ context.writeOutput(
28983
+ context.io.style.success(
28984
+ `Switched to ${match.userEmail} (${match.serverUrl}).`
28985
+ )
28986
+ );
28893
28987
  if (!match.refreshToken) {
28894
28988
  context.writeOutput(
28895
- "This account has no stored credentials; run `auto auth login`."
28989
+ context.io.style.warn(
28990
+ "This account has no stored credentials; run `auto auth login`."
28991
+ )
28896
28992
  );
28897
28993
  }
28898
28994
  }
28899
- function accountLine(config2, active) {
28995
+ function accountLine(config2, active, style) {
28900
28996
  const isActive = Boolean(config2.userEmail) && config2.userEmail === active.userEmail && config2.serverUrl === active.serverUrl;
28901
28997
  return [
28902
28998
  config2.userEmail,
28903
- `server=${config2.serverUrl ?? "(unset)"}`,
28904
- config2.refreshToken ? void 0 : "logged_out",
28905
- isActive ? "(active)" : void 0
28999
+ style.dim(`server=${config2.serverUrl ?? "(unset)"}`),
29000
+ config2.refreshToken ? void 0 : style.warn("logged_out"),
29001
+ isActive ? style.success("(active)") : void 0
28906
29002
  ].filter(Boolean).join(" ");
28907
29003
  }
28908
29004
  async function fetchAuthStatus(context) {
@@ -28951,47 +29047,68 @@ async function fetchAuthStatus(context) {
28951
29047
  return { ...base, token: { state: "invalid", error: message } };
28952
29048
  }
28953
29049
  }
28954
- function formatAuthStatusText(result, writeLine) {
28955
- writeLine(`server: ${result.serverUrl ?? "(unset)"}`);
29050
+ function formatAuthStatusText(result, writeLine, style) {
29051
+ const unset = style.dim("(unset)");
29052
+ writeLine(
29053
+ `${style.label("server:")} ${result.serverUrl ? style.url(result.serverUrl) : unset}`
29054
+ );
28956
29055
  if (result.account) {
28957
- writeLine(`account: ${result.account}`);
29056
+ writeLine(`${style.label("account:")} ${result.account}`);
28958
29057
  }
28959
- writeLine(`organization: ${result.organizationId ?? "(unset)"}`);
28960
- writeLine(`project: ${result.projectId ?? "(unset)"}`);
28961
29058
  writeLine(
28962
- `auth: ${result.authSource === "unset" ? "(unset)" : result.authSource}`
29059
+ `${style.label("organization:")} ${result.organizationId ? style.id(result.organizationId) : unset}`
29060
+ );
29061
+ writeLine(
29062
+ `${style.label("project:")} ${result.projectId ? style.id(result.projectId) : unset}`
29063
+ );
29064
+ writeLine(
29065
+ `${style.label("auth:")} ${result.authSource === "unset" ? unset : result.authSource}`
28963
29066
  );
28964
29067
  switch (result.token.state) {
28965
29068
  case "unset":
28966
29069
  return;
28967
29070
  case "not_validated":
28968
- writeLine(`token: not validated (${result.token.reason})`);
29071
+ writeLine(
29072
+ `${style.label("token:")} ${style.warn(`not validated (${result.token.reason})`)}`
29073
+ );
28969
29074
  return;
28970
29075
  case "valid":
28971
- writeLine("token: valid");
29076
+ writeLine(`${style.label("token:")} ${style.success("valid")}`);
28972
29077
  return;
28973
29078
  case "invalid":
28974
- writeLine(`token: invalid \u2014 ${result.token.error}`);
28975
- writeLine("hint: run `auto auth login` to refresh credentials");
29079
+ writeLine(
29080
+ `${style.label("token:")} ${style.error(`invalid \u2014 ${result.token.error}`)}`
29081
+ );
29082
+ writeLine(
29083
+ style.dim("hint: run `auto auth login` to refresh credentials")
29084
+ );
28976
29085
  return;
28977
29086
  }
28978
29087
  }
28979
- function formatWhoamiText(whoami, writeLine) {
28980
- writeLine(`actor: ${actorLabel(whoami)}`);
29088
+ function formatWhoamiText(whoami, writeLine, style) {
29089
+ writeLine(`${style.label("actor:")} ${actorLabel(whoami)}`);
28981
29090
  if (whoami.serviceAccount) {
28982
- writeLine(`service_account: ${whoami.serviceAccount.name}`);
29091
+ writeLine(
29092
+ `${style.label("service_account:")} ${style.id(whoami.serviceAccount.name)}`
29093
+ );
28983
29094
  }
28984
- writeLine(`organization: ${whoami.organizationId}`);
28985
- writeLine(`project: ${whoami.projectId ?? "(unset)"}`);
29095
+ writeLine(
29096
+ `${style.label("organization:")} ${style.id(whoami.organizationId)}`
29097
+ );
29098
+ writeLine(
29099
+ `${style.label("project:")} ${whoami.projectId ? style.id(whoami.projectId) : style.dim("(unset)")}`
29100
+ );
28986
29101
  const organizationName = whoami.organizationName ?? whoami.serviceAccount?.organization.name;
28987
29102
  const projectName = whoami.projectName ?? whoami.serviceAccount?.project.name;
28988
29103
  if (organizationName) {
28989
- writeLine(`organization_name: ${organizationName}`);
29104
+ writeLine(`${style.label("organization_name:")} ${organizationName}`);
28990
29105
  }
28991
29106
  if (projectName) {
28992
- writeLine(`project_name: ${projectName}`);
29107
+ writeLine(`${style.label("project_name:")} ${projectName}`);
28993
29108
  }
28994
- writeLine(`scopes: ${formatScopes(whoami.scopes)}`);
29109
+ writeLine(
29110
+ `${style.label("scopes:")} ${style.dim(formatScopes(whoami.scopes))}`
29111
+ );
28995
29112
  }
28996
29113
  function actorLabel(whoami) {
28997
29114
  const { principal } = whoami.actor;
@@ -29056,7 +29173,8 @@ function registerAuthCommands(program, context) {
29056
29173
  fetch: context.fetch,
29057
29174
  configPath: context.configPath,
29058
29175
  writeOutput: context.writeOutput,
29059
- writeError: context.writeError
29176
+ writeError: context.writeError,
29177
+ style: context.io.style
29060
29178
  });
29061
29179
  });
29062
29180
  auth.command("status").description(
@@ -29108,7 +29226,7 @@ async function confirmDestructiveAction(context, input) {
29108
29226
  }
29109
29227
 
29110
29228
  // src/commands/connections/format.ts
29111
- function connectionRows(connections) {
29229
+ function connectionRows(connections, style) {
29112
29230
  const rows = connections.flatMap(
29113
29231
  (connection) => connection.grants.map((grant) => ({
29114
29232
  provider: connection.provider,
@@ -29124,7 +29242,7 @@ function connectionRows(connections) {
29124
29242
  }))
29125
29243
  );
29126
29244
  if (rows.length === 0) {
29127
- return ["No connections found."];
29245
+ return [style.dim("No connections found.")];
29128
29246
  }
29129
29247
  const headers = {
29130
29248
  provider: "provider",
@@ -29142,18 +29260,25 @@ function connectionRows(connections) {
29142
29260
  )
29143
29261
  ])
29144
29262
  );
29263
+ const headerLine = [
29264
+ headers.provider.padEnd(widths.provider),
29265
+ headers.account.padEnd(widths.account),
29266
+ headers.grant.padEnd(widths.grant),
29267
+ headers.status.padEnd(widths.status),
29268
+ headers.projects
29269
+ ].join(" ");
29145
29270
  const format = (row) => [
29146
29271
  row.provider.padEnd(widths.provider),
29147
29272
  row.account.padEnd(widths.account),
29148
- row.grant.padEnd(widths.grant),
29149
- row.status.padEnd(widths.status),
29150
- row.projects
29273
+ style.id(row.grant.padEnd(widths.grant)),
29274
+ grantStatusStyle(style, row.status)(row.status.padEnd(widths.status)),
29275
+ style.dim(row.projects)
29151
29276
  ].join(" ");
29152
- return [format(headers), ...rows.map(format)];
29277
+ return [style.heading(headerLine), ...rows.map(format)];
29153
29278
  }
29154
- function providerRows(providers) {
29279
+ function providerRows(providers, style) {
29155
29280
  if (providers.length === 0) {
29156
- return ["No connection providers found."];
29281
+ return [style.dim("No connection providers found.")];
29157
29282
  }
29158
29283
  const rows = providers.map((provider) => ({
29159
29284
  provider: provider.provider,
@@ -29177,9 +29302,26 @@ function providerRows(providers) {
29177
29302
  const format = (row) => [
29178
29303
  row.provider.padEnd(widths.provider),
29179
29304
  row.name.padEnd(widths.name),
29180
- row.credential
29305
+ style.dim(row.credential)
29181
29306
  ].join(" ");
29182
- return [format(headers), ...rows.map(format)];
29307
+ const headerLine = [
29308
+ headers.provider.padEnd(widths.provider),
29309
+ headers.name.padEnd(widths.name),
29310
+ headers.credential
29311
+ ].join(" ");
29312
+ return [style.heading(headerLine), ...rows.map(format)];
29313
+ }
29314
+ function grantStatusStyle(style, status) {
29315
+ switch (status) {
29316
+ case "active":
29317
+ return style.success;
29318
+ case "error":
29319
+ return style.error;
29320
+ case "revoked":
29321
+ return style.dim;
29322
+ default:
29323
+ return (text) => text;
29324
+ }
29183
29325
  }
29184
29326
  function projectSummary(connection) {
29185
29327
  const projectIds = [
@@ -29591,7 +29733,7 @@ async function listConnectionsAction(context, commandOptions) {
29591
29733
  ).listConnectionProviders({
29592
29734
  apiBaseUrl
29593
29735
  });
29594
- for (const row of providerRows(result2.providers)) {
29736
+ for (const row of providerRows(result2.providers, context.io.style)) {
29595
29737
  context.writeOutput(row);
29596
29738
  }
29597
29739
  return;
@@ -29600,7 +29742,7 @@ async function listConnectionsAction(context, commandOptions) {
29600
29742
  provider: commandOptions.provider,
29601
29743
  apiBaseUrl
29602
29744
  });
29603
- for (const row of connectionRows(result.connections)) {
29745
+ for (const row of connectionRows(result.connections, context.io.style)) {
29604
29746
  context.writeOutput(row);
29605
29747
  }
29606
29748
  }
@@ -29647,11 +29789,14 @@ async function connectProviderAction(context, provider, commandOptions) {
29647
29789
  allowProjectId: commandOptions.allow,
29648
29790
  apiBaseUrl
29649
29791
  });
29792
+ const style = context.io.style;
29650
29793
  context.writeOutput(result.message);
29651
29794
  if (!result.authorizationUrl) {
29652
29795
  return;
29653
29796
  }
29654
- context.writeOutput(`authorization_url ${result.authorizationUrl}`);
29797
+ context.writeOutput(
29798
+ `${style.label("authorization_url")} ${style.url(result.authorizationUrl)}`
29799
+ );
29655
29800
  const connected = await finishConnectionAuthorization({
29656
29801
  apiBaseUrl,
29657
29802
  authorizationUrl: result.authorizationUrl,
@@ -29675,7 +29820,9 @@ async function connectProviderAction(context, provider, commandOptions) {
29675
29820
  apiBaseUrl
29676
29821
  });
29677
29822
  context.writeOutput(
29678
- `registered slack config token connection/${registered.connection} workspace/${registered.workspace}`
29823
+ style.success(
29824
+ `registered slack config token connection/${registered.connection} workspace/${registered.workspace}`
29825
+ )
29679
29826
  );
29680
29827
  }
29681
29828
  }
@@ -29701,10 +29848,15 @@ async function registerConfigTokenAction(context, provider, commandOptions) {
29701
29848
  refreshToken,
29702
29849
  apiBaseUrl: apiUrlFromOptions(context, commandOptions)
29703
29850
  });
29851
+ const style = context.io.style;
29704
29852
  context.writeOutput(
29705
- `registered slack config token connection/${result.connection} workspace/${result.workspace}`
29853
+ style.success(
29854
+ `registered slack config token connection/${result.connection} workspace/${result.workspace}`
29855
+ )
29856
+ );
29857
+ context.writeOutput(
29858
+ `${style.label("expires_at")} ${style.dim(result.expiresAt)}`
29706
29859
  );
29707
- context.writeOutput(`expires_at ${result.expiresAt}`);
29708
29860
  }
29709
29861
  async function readTrimmedStream(stream) {
29710
29862
  const chunks = [];
@@ -29759,7 +29911,11 @@ async function replaceConnectionAction(context, provider, commandOptions) {
29759
29911
  if (!result.authorizationUrl) {
29760
29912
  return;
29761
29913
  }
29762
- context.writeOutput(`authorization_url ${result.authorizationUrl}`);
29914
+ context.writeOutput(
29915
+ `${context.io.style.label("authorization_url")} ${context.io.style.url(
29916
+ result.authorizationUrl
29917
+ )}`
29918
+ );
29763
29919
  await finishConnectionAuthorization({
29764
29920
  apiBaseUrl,
29765
29921
  authorizationUrl: result.authorizationUrl,
@@ -29922,11 +30078,17 @@ init_file();
29922
30078
  function createDirectoryClient(context) {
29923
30079
  return createContextApiClient(context);
29924
30080
  }
29925
- function organizationLine(organization) {
29926
- return `${organization.organizationName} (${organization.organizationSlug}) role=${organization.role}`;
30081
+ function organizationLine(organization, style) {
30082
+ return `${organization.organizationName} ${style.id(
30083
+ `(${organization.organizationSlug})`
30084
+ )} ${style.dim(`role=${organization.role}`)}`;
29927
30085
  }
29928
- function projectLine(project) {
29929
- return `${project.organizationName} (${project.organizationSlug}) / ${project.projectName} (${project.projectSlug}) role=${project.role}`;
30086
+ function projectLine(project, style) {
30087
+ return `${project.organizationName} ${style.id(
30088
+ `(${project.organizationSlug})`
30089
+ )} / ${project.projectName} ${style.id(`(${project.projectSlug})`)} ${style.dim(
30090
+ `role=${project.role}`
30091
+ )}`;
29930
30092
  }
29931
30093
  function setActiveOrganization(context, organizationId) {
29932
30094
  persistActiveOrganization(context.configPath, organizationId);
@@ -30083,10 +30245,13 @@ function registerOrganizationCommands(program, context) {
30083
30245
  const orgs = program.command("orgs").description("Manage the active organization.");
30084
30246
  orgs.command("use").argument("<organization>").option("--api-url <url>", "Auto API base URL").option("--server <url>", "Auto web server URL").description("Set the active organization.").action(
30085
30247
  async (organizationIdentifier, options) => {
30248
+ const style = context.io.style;
30086
30249
  if (organizationIdentifier.startsWith("org_")) {
30087
30250
  setActiveOrganization(context, organizationIdentifier);
30088
30251
  context.writeOutput(
30089
- `Active organization set to ${organizationIdentifier}`
30252
+ style.success(
30253
+ `Active organization set to ${organizationIdentifier}`
30254
+ )
30090
30255
  );
30091
30256
  return;
30092
30257
  }
@@ -30097,7 +30262,9 @@ function registerOrganizationCommands(program, context) {
30097
30262
  });
30098
30263
  setActiveOrganization(context, organization.organizationId);
30099
30264
  context.writeOutput(
30100
- `Active organization set to ${organization.organizationName}`
30265
+ style.success(
30266
+ `Active organization set to ${organization.organizationName}`
30267
+ )
30101
30268
  );
30102
30269
  }
30103
30270
  );
@@ -30106,22 +30273,23 @@ function registerOrganizationCommands(program, context) {
30106
30273
  apiBaseUrl: apiUrlFromOptions(context, options)
30107
30274
  });
30108
30275
  if (response.organizations.length === 0) {
30109
- context.writeOutput("No organizations found.");
30276
+ context.writeOutput(context.io.style.dim("No organizations found."));
30110
30277
  return;
30111
30278
  }
30112
30279
  for (const organization of response.organizations) {
30113
- context.writeOutput(organizationLine(organization));
30280
+ context.writeOutput(organizationLine(organization, context.io.style));
30114
30281
  }
30115
30282
  });
30116
30283
  orgs.command("create").description("Create an organization, optionally with an initial project.").requiredOption("--name <name>", "Organization name").option("--project-name <name>", "Initial project name").option("--api-url <url>", "Auto API base URL").option("--server <url>", "Auto web server URL").option("--use", "Set the new organization or project as active", true).option("--no-use", "Keep the current active organization and project").action(async (options) => {
30284
+ const style = context.io.style;
30117
30285
  const response = await createDirectoryClient(context).createOrganization({
30118
30286
  organizationName: options.name,
30119
30287
  projectName: options.projectName,
30120
30288
  apiBaseUrl: apiUrlFromOptions(context, options)
30121
30289
  });
30122
- context.writeOutput(organizationLine(response.organization));
30290
+ context.writeOutput(organizationLine(response.organization, style));
30123
30291
  if (response.project) {
30124
- context.writeOutput(projectLine(response.project));
30292
+ context.writeOutput(projectLine(response.project, style));
30125
30293
  }
30126
30294
  if (options.use) {
30127
30295
  if (response.project) {
@@ -30130,11 +30298,15 @@ function registerOrganizationCommands(program, context) {
30130
30298
  setActiveOrganization(context, response.organization.organizationId);
30131
30299
  }
30132
30300
  context.writeOutput(
30133
- `Active organization set to ${response.organization.organizationName}`
30301
+ style.success(
30302
+ `Active organization set to ${response.organization.organizationName}`
30303
+ )
30134
30304
  );
30135
30305
  if (response.project) {
30136
30306
  context.writeOutput(
30137
- `Active project set to ${response.project.projectName}`
30307
+ style.success(
30308
+ `Active project set to ${response.project.projectName}`
30309
+ )
30138
30310
  );
30139
30311
  }
30140
30312
  }
@@ -30149,9 +30321,12 @@ function registerOrganizationCommands(program, context) {
30149
30321
  role: options.role,
30150
30322
  apiBaseUrl: apiUrlFromOptions(context, options)
30151
30323
  });
30152
- const status = response.created === false ? "Invitation already pending" : "Invited";
30324
+ const style = context.io.style;
30325
+ const status = response.created === false ? style.warn("Invitation already pending") : style.success("Invited");
30153
30326
  context.writeOutput(
30154
- `${status} ${response.invitation.targetEmail} to ${response.invitation.organizationName} role=${response.invitation.role}`
30327
+ `${status} ${response.invitation.targetEmail} to ${response.invitation.organizationName} ${style.dim(
30328
+ `role=${response.invitation.role}`
30329
+ )}`
30155
30330
  );
30156
30331
  });
30157
30332
  const members = orgs.command("members").description("Manage active organization members.");
@@ -30162,11 +30337,13 @@ function registerOrganizationCommands(program, context) {
30162
30337
  apiBaseUrl: apiUrlFromOptions(context, options)
30163
30338
  });
30164
30339
  if (response.memberships.length === 0) {
30165
- context.writeOutput("No organization members found.");
30340
+ context.writeOutput(
30341
+ context.io.style.dim("No organization members found.")
30342
+ );
30166
30343
  return;
30167
30344
  }
30168
30345
  for (const member of response.memberships) {
30169
- context.writeOutput(memberLine(member));
30346
+ context.writeOutput(memberLine(member, context.io.style));
30170
30347
  }
30171
30348
  });
30172
30349
  members.command("add").description("Invite a user to the active organization by email.").requiredOption("--email <email>", "Email address to invite").addOption(
@@ -30179,9 +30356,12 @@ function registerOrganizationCommands(program, context) {
30179
30356
  role: options.role,
30180
30357
  apiBaseUrl: apiUrlFromOptions(context, options)
30181
30358
  });
30182
- const status = response.created === false ? "Invitation already pending" : "Invited";
30359
+ const style = context.io.style;
30360
+ const status = response.created === false ? style.warn("Invitation already pending") : style.success("Invited");
30183
30361
  context.writeOutput(
30184
- `${status} ${response.invitation.targetEmail} to ${response.invitation.organizationName} role=${response.invitation.role}`
30362
+ `${status} ${response.invitation.targetEmail} to ${response.invitation.organizationName} ${style.dim(
30363
+ `role=${response.invitation.role}`
30364
+ )}`
30185
30365
  );
30186
30366
  });
30187
30367
  members.command("set-role").description("Set an existing active organization member's role.").requiredOption("--email <email>", "Email address of an existing member").addOption(
@@ -30194,9 +30374,12 @@ function registerOrganizationCommands(program, context) {
30194
30374
  role: options.role,
30195
30375
  apiBaseUrl: apiUrlFromOptions(context, options)
30196
30376
  });
30197
- const status = response.updated ? "Updated" : "Unchanged";
30377
+ const style = context.io.style;
30378
+ const status = response.updated ? style.success("Updated") : style.dim("Unchanged");
30198
30379
  context.writeOutput(
30199
- `${status} ${options.email} in ${response.membership.organizationName} role=${response.previousRole}->${response.membership.role}`
30380
+ `${status} ${options.email} in ${response.membership.organizationName} ${style.dim(
30381
+ `role=${response.previousRole}->${response.membership.role}`
30382
+ )}`
30200
30383
  );
30201
30384
  });
30202
30385
  members.command("remove").description("Remove a user from the active organization.").requiredOption("--email <email>", "Email address of an existing member").option("-y, --yes", "skip confirmation prompt").option("--api-url <url>", "Auto API base URL").option("--server <url>", "Auto web server URL").action(async (options) => {
@@ -30210,17 +30393,20 @@ function registerOrganizationCommands(program, context) {
30210
30393
  email: options.email,
30211
30394
  apiBaseUrl: apiUrlFromOptions(context, options)
30212
30395
  });
30396
+ const style = context.io.style;
30213
30397
  context.writeOutput(
30214
- `Removed ${options.email} from ${response.membership.organizationName} role=${response.previousRole} project_memberships=${response.removedProjectMemberships ?? 0}`
30398
+ `${style.success("Removed")} ${options.email} from ${response.membership.organizationName} ${style.dim(
30399
+ `role=${response.previousRole} project_memberships=${response.removedProjectMemberships ?? 0}`
30400
+ )}`
30215
30401
  );
30216
30402
  });
30217
30403
  }
30218
- function memberLine(member) {
30404
+ function memberLine(member, style) {
30219
30405
  return [
30220
30406
  member.primaryEmail,
30221
- `role=${member.role}`,
30222
- member.displayName ? `name=${member.displayName}` : void 0,
30223
- member.disabledAt ? `disabled_at=${member.disabledAt}` : void 0
30407
+ style.dim(`role=${member.role}`),
30408
+ member.displayName ? style.dim(`name=${member.displayName}`) : void 0,
30409
+ member.disabledAt ? style.warn(`disabled_at=${member.disabledAt}`) : void 0
30224
30410
  ].filter(Boolean).join(" ");
30225
30411
  }
30226
30412
 
@@ -30241,15 +30427,13 @@ async function fetchProjects(context, options) {
30241
30427
  });
30242
30428
  return { projects: response.projects };
30243
30429
  }
30244
- function formatProjectsText(result, writeLine) {
30430
+ function formatProjectsText(result, writeLine, style) {
30245
30431
  if (result.projects.length === 0) {
30246
- writeLine("No projects found.");
30432
+ writeLine(style.dim("No projects found."));
30247
30433
  return;
30248
30434
  }
30249
30435
  for (const project of result.projects) {
30250
- writeLine(
30251
- `${project.organizationName} (${project.organizationSlug}) / ${project.projectName} (${project.projectSlug}) role=${project.role}`
30252
- );
30436
+ writeLine(projectLine(project, style));
30253
30437
  }
30254
30438
  }
30255
30439
 
@@ -30258,13 +30442,16 @@ function registerProjectCommands(program, context) {
30258
30442
  const projects = program.command("projects").description("List, create, and select Auto projects.");
30259
30443
  projects.command("use").argument("<project>").option("--api-url <url>", "Auto API base URL").option("--server <url>", "Auto web server URL").description("Set the active project.").action(
30260
30444
  async (projectIdentifier, options) => {
30445
+ const style = context.io.style;
30261
30446
  if (projectIdentifier.startsWith("proj_")) {
30262
30447
  const config2 = readConfig(context.configPath);
30263
30448
  writeConfig(
30264
30449
  clearAccessToken({ ...config2, projectId: projectIdentifier }),
30265
30450
  context.configPath
30266
30451
  );
30267
- context.writeOutput(`Active project set to ${projectIdentifier}`);
30452
+ context.writeOutput(
30453
+ style.success(`Active project set to ${projectIdentifier}`)
30454
+ );
30268
30455
  return;
30269
30456
  }
30270
30457
  const project = await resolveProject({
@@ -30275,9 +30462,13 @@ function registerProjectCommands(program, context) {
30275
30462
  });
30276
30463
  setActiveProject(context, project);
30277
30464
  context.writeOutput(
30278
- `Active organization set to ${project.organizationName}`
30465
+ style.success(
30466
+ `Active organization set to ${project.organizationName}`
30467
+ )
30468
+ );
30469
+ context.writeOutput(
30470
+ style.success(`Active project set to ${project.projectName}`)
30279
30471
  );
30280
- context.writeOutput(`Active project set to ${project.projectName}`);
30281
30472
  }
30282
30473
  );
30283
30474
  projects.command("list").description(
@@ -30286,18 +30477,23 @@ function registerProjectCommands(program, context) {
30286
30477
  await handleProjectsList(context, options);
30287
30478
  });
30288
30479
  projects.command("create").description("Create a project in the active organization.").requiredOption("--name <name>", "Project name").option("--api-url <url>", "Auto API base URL").option("--server <url>", "Auto web server URL").option("--use", "Set the new project as active", true).option("--no-use", "Keep the current active project").action(async (options) => {
30480
+ const style = context.io.style;
30289
30481
  const response = await createDirectoryClient(context).createProject({
30290
30482
  projectName: options.name,
30291
30483
  apiBaseUrl: apiUrlFromOptions(context, options)
30292
30484
  });
30293
- context.writeOutput(projectLine(response.project));
30485
+ context.writeOutput(projectLine(response.project, style));
30294
30486
  if (options.use) {
30295
30487
  setActiveProject(context, response.project);
30296
30488
  context.writeOutput(
30297
- `Active organization set to ${response.project.organizationName}`
30489
+ style.success(
30490
+ `Active organization set to ${response.project.organizationName}`
30491
+ )
30298
30492
  );
30299
30493
  context.writeOutput(
30300
- `Active project set to ${response.project.projectName}`
30494
+ style.success(
30495
+ `Active project set to ${response.project.projectName}`
30496
+ )
30301
30497
  );
30302
30498
  }
30303
30499
  });
@@ -30311,9 +30507,12 @@ function registerProjectCommands(program, context) {
30311
30507
  apiBaseUrl: apiUrlFromOptions(context, options)
30312
30508
  }
30313
30509
  );
30314
- const status = response.created === false ? "Invitation already pending" : "Invited";
30510
+ const style = context.io.style;
30511
+ const status = response.created === false ? style.warn("Invitation already pending") : style.success("Invited");
30315
30512
  context.writeOutput(
30316
- `${status} ${response.invitation.targetEmail} to ${response.invitation.projectName} role=${response.invitation.role}`
30513
+ `${status} ${response.invitation.targetEmail} to ${response.invitation.projectName} ${style.dim(
30514
+ `role=${response.invitation.role}`
30515
+ )}`
30317
30516
  );
30318
30517
  });
30319
30518
  const members = projects.command("members").description("Manage active project members.");
@@ -30322,11 +30521,11 @@ function registerProjectCommands(program, context) {
30322
30521
  apiBaseUrl: apiUrlFromOptions(context, options)
30323
30522
  });
30324
30523
  if (response.memberships.length === 0) {
30325
- context.writeOutput("No project members found.");
30524
+ context.writeOutput(context.io.style.dim("No project members found."));
30326
30525
  return;
30327
30526
  }
30328
30527
  for (const member of response.memberships) {
30329
- context.writeOutput(memberLine2(member));
30528
+ context.writeOutput(memberLine2(member, context.io.style));
30330
30529
  }
30331
30530
  });
30332
30531
  members.command("add").description("Invite a user to the active project by email.").requiredOption("--email <email>", "Email address to invite").addOption(
@@ -30337,9 +30536,12 @@ function registerProjectCommands(program, context) {
30337
30536
  role: options.role,
30338
30537
  apiBaseUrl: apiUrlFromOptions(context, options)
30339
30538
  });
30340
- const status = response.created === false ? "Invitation already pending" : "Invited";
30539
+ const style = context.io.style;
30540
+ const status = response.created === false ? style.warn("Invitation already pending") : style.success("Invited");
30341
30541
  context.writeOutput(
30342
- `${status} ${response.invitation.targetEmail} to ${response.invitation.projectName} role=${response.invitation.role}`
30542
+ `${status} ${response.invitation.targetEmail} to ${response.invitation.projectName} ${style.dim(
30543
+ `role=${response.invitation.role}`
30544
+ )}`
30343
30545
  );
30344
30546
  });
30345
30547
  members.command("set-role").description("Set an existing active project member's role.").requiredOption("--email <email>", "Email address of an existing member").addOption(
@@ -30352,9 +30554,12 @@ function registerProjectCommands(program, context) {
30352
30554
  role: options.role,
30353
30555
  apiBaseUrl: apiUrlFromOptions(context, options)
30354
30556
  });
30355
- const status = response.updated ? "Updated" : "Unchanged";
30557
+ const style = context.io.style;
30558
+ const status = response.updated ? style.success("Updated") : style.dim("Unchanged");
30356
30559
  context.writeOutput(
30357
- `${status} ${options.email} in ${response.membership.projectName} role=${response.previousRole}->${response.membership.role}`
30560
+ `${status} ${options.email} in ${response.membership.projectName} ${style.dim(
30561
+ `role=${response.previousRole}->${response.membership.role}`
30562
+ )}`
30358
30563
  );
30359
30564
  });
30360
30565
  members.command("remove").description("Remove a user from the active project.").requiredOption("--email <email>", "Email address of an existing member").option("-y, --yes", "skip confirmation prompt").option("--api-url <url>", "Auto API base URL").option("--server <url>", "Auto web server URL").action(async (options) => {
@@ -30368,17 +30573,20 @@ function registerProjectCommands(program, context) {
30368
30573
  apiBaseUrl: apiUrlFromOptions(context, options)
30369
30574
  }
30370
30575
  );
30576
+ const style = context.io.style;
30371
30577
  context.writeOutput(
30372
- `Removed ${options.email} from ${response.membership.projectName} role=${response.previousRole}`
30578
+ `${style.success("Removed")} ${options.email} from ${response.membership.projectName} ${style.dim(
30579
+ `role=${response.previousRole}`
30580
+ )}`
30373
30581
  );
30374
30582
  });
30375
30583
  }
30376
- function memberLine2(member) {
30584
+ function memberLine2(member, style) {
30377
30585
  return [
30378
30586
  member.primaryEmail,
30379
- `role=${member.role}`,
30380
- member.displayName ? `name=${member.displayName}` : void 0,
30381
- member.disabledAt ? `disabled_at=${member.disabledAt}` : void 0
30587
+ style.dim(`role=${member.role}`),
30588
+ member.displayName ? style.dim(`name=${member.displayName}`) : void 0,
30589
+ member.disabledAt ? style.warn(`disabled_at=${member.disabledAt}`) : void 0
30382
30590
  ].filter(Boolean).join(" ");
30383
30591
  }
30384
30592
 
@@ -30597,6 +30805,61 @@ function pollUntilFailed(input) {
30597
30805
  return { done, cancel };
30598
30806
  }
30599
30807
 
30808
+ // src/commands/runs/list.ts
30809
+ async function handleRunsList(context, sessionName, options = {}) {
30810
+ const result = await fetchRuns(context, sessionName, options);
30811
+ context.io.writeResult(result, formatRunsText);
30812
+ }
30813
+ async function fetchRuns(context, sessionName, options) {
30814
+ const client = createContextApiClient(context);
30815
+ const clientOptions = {
30816
+ apiBaseUrl: apiUrlFromOptions(context, options),
30817
+ includeArchived: options.includeArchived,
30818
+ statuses: options.status,
30819
+ since: options.since,
30820
+ limit: options.limit
30821
+ };
30822
+ const response = sessionName ? await client.listSessionRuns(sessionName, clientOptions) : await client.listRuns(clientOptions);
30823
+ return {
30824
+ session: sessionName ?? null,
30825
+ runs: response.runs,
30826
+ includeArchived: Boolean(options.includeArchived)
30827
+ };
30828
+ }
30829
+ function formatRunsText(result, writeLine, style) {
30830
+ if (result.runs.length === 0) {
30831
+ writeLine(
30832
+ style.dim(
30833
+ result.session ? `No runs found for session ${result.session}.` : "No runs found in the current project."
30834
+ )
30835
+ );
30836
+ return;
30837
+ }
30838
+ for (const run of result.runs) {
30839
+ const archived = run.archivedAt ? ` ${style.dim(`archived_at=${run.archivedAt}`)}` : "";
30840
+ writeLine(
30841
+ `${style.id(run.id)} ${styleRunStatus(style, run.status)} ${style.dim(
30842
+ run.createdAt
30843
+ )}${archived}`
30844
+ );
30845
+ }
30846
+ }
30847
+ function styleRunStatus(style, status) {
30848
+ switch (status) {
30849
+ case "failed":
30850
+ return style.error(status);
30851
+ case "running":
30852
+ return style.success(status);
30853
+ case "awaiting":
30854
+ return style.warn(status);
30855
+ case "stopped":
30856
+ case "queued":
30857
+ return style.dim(status);
30858
+ default:
30859
+ return status;
30860
+ }
30861
+ }
30862
+
30600
30863
  // src/commands/runs/service.ts
30601
30864
  function createRunServiceClient(context) {
30602
30865
  return createContextApiClient(context);
@@ -30611,9 +30874,14 @@ async function interactiveRunAction(context, sessionName, commandOptions) {
30611
30874
  interactive: true,
30612
30875
  apiBaseUrl
30613
30876
  });
30614
- context.writeOutput(`run_id ${created.run_id}`);
30615
- context.writeOutput(`workflow_id ${created.workflow_id}`);
30616
- context.writeOutput(`status ${created.status}`);
30877
+ const style = context.io.style;
30878
+ context.writeOutput(`${style.label("run_id")} ${style.id(created.run_id)}`);
30879
+ context.writeOutput(
30880
+ `${style.label("workflow_id")} ${style.id(created.workflow_id)}`
30881
+ );
30882
+ context.writeOutput(
30883
+ `${style.label("status")} ${styleRunStatus(style, created.status)}`
30884
+ );
30617
30885
  await runConsole({
30618
30886
  client,
30619
30887
  runId: created.run_id,
@@ -30639,35 +30907,50 @@ async function archiveRunAction(context, runId, commandOptions) {
30639
30907
  const run = await createRunServiceClient(context).archiveRun(runId, {
30640
30908
  apiBaseUrl: apiUrlFromOptions(context, commandOptions)
30641
30909
  });
30642
- context.writeOutput(`run_id ${run.id}`);
30643
- context.writeOutput(`archived_at ${run.archivedAt ?? ""}`);
30910
+ const style = context.io.style;
30911
+ context.writeOutput(`${style.label("run_id")} ${style.id(run.id)}`);
30912
+ context.writeOutput(
30913
+ `${style.label("archived_at")} ${style.dim(run.archivedAt ?? "")}`
30914
+ );
30644
30915
  }
30645
30916
  async function archiveRunsAction(context, runIds, commandOptions) {
30646
30917
  const result = await createRunServiceClient(context).archiveRuns(runIds, {
30647
30918
  apiBaseUrl: apiUrlFromOptions(context, commandOptions)
30648
30919
  });
30920
+ const style = context.io.style;
30649
30921
  for (const run of result.runs) {
30650
- context.writeOutput(`run_id ${run.id} archived_at ${run.archivedAt ?? ""}`);
30922
+ context.writeOutput(
30923
+ `${style.label("run_id")} ${style.id(run.id)} ${style.label(
30924
+ "archived_at"
30925
+ )} ${style.dim(run.archivedAt ?? "")}`
30926
+ );
30651
30927
  }
30652
30928
  }
30653
30929
  async function unarchiveRunAction(context, runId, commandOptions) {
30654
30930
  const run = await createRunServiceClient(context).unarchiveRun(runId, {
30655
30931
  apiBaseUrl: apiUrlFromOptions(context, commandOptions)
30656
30932
  });
30657
- context.writeOutput(`run_id ${run.id}`);
30658
- context.writeOutput(`archived ${Boolean(run.archivedAt)}`);
30933
+ const style = context.io.style;
30934
+ context.writeOutput(`${style.label("run_id")} ${style.id(run.id)}`);
30935
+ context.writeOutput(`${style.label("archived")} ${Boolean(run.archivedAt)}`);
30659
30936
  }
30660
30937
  async function unarchiveRunsAction(context, runIds, commandOptions) {
30661
30938
  const result = await createRunServiceClient(context).unarchiveRuns(runIds, {
30662
30939
  apiBaseUrl: apiUrlFromOptions(context, commandOptions)
30663
30940
  });
30941
+ const style = context.io.style;
30664
30942
  for (const run of result.runs) {
30665
- context.writeOutput(`run_id ${run.id} archived ${Boolean(run.archivedAt)}`);
30943
+ context.writeOutput(
30944
+ `${style.label("run_id")} ${style.id(run.id)} ${style.label(
30945
+ "archived"
30946
+ )} ${Boolean(run.archivedAt)}`
30947
+ );
30666
30948
  }
30667
30949
  }
30668
30950
  async function stopRunsAction(context, runIds, commandOptions) {
30669
30951
  const client = createRunServiceClient(context);
30670
30952
  const apiBaseUrl = apiUrlFromOptions(context, commandOptions);
30953
+ const style = context.io.style;
30671
30954
  const failedRunIds = [];
30672
30955
  for (const runId of runIds) {
30673
30956
  try {
@@ -30676,12 +30959,16 @@ async function stopRunsAction(context, runIds, commandOptions) {
30676
30959
  reason: commandOptions.reason
30677
30960
  });
30678
30961
  context.writeOutput(
30679
- `run_id ${runId} command_id ${command.command_id} status ${command.status}`
30962
+ `${style.label("run_id")} ${style.id(runId)} ${style.label(
30963
+ "command_id"
30964
+ )} ${style.id(command.command_id)} ${style.label("status")} ${command.status}`
30680
30965
  );
30681
30966
  } catch (error51) {
30682
30967
  failedRunIds.push(runId);
30683
30968
  context.writeOutput(
30684
- `run_id ${runId} error ${error51 instanceof Error ? error51.message : String(error51)}`
30969
+ `${style.label("run_id")} ${style.id(runId)} ${style.error(
30970
+ `error ${error51 instanceof Error ? error51.message : String(error51)}`
30971
+ )}`
30685
30972
  );
30686
30973
  }
30687
30974
  }
@@ -30712,8 +30999,11 @@ async function sendRunMessageAction(context, runId, message, commandOptions) {
30712
30999
  apiBaseUrl: apiUrlFromOptions(context, commandOptions)
30713
31000
  }
30714
31001
  );
30715
- context.writeOutput(`command_id ${command.command_id}`);
30716
- context.writeOutput(`status ${command.status}`);
31002
+ const style = context.io.style;
31003
+ context.writeOutput(
31004
+ `${style.label("command_id")} ${style.id(command.command_id)}`
31005
+ );
31006
+ context.writeOutput(`${style.label("status")} ${command.status}`);
30717
31007
  }
30718
31008
 
30719
31009
  // src/commands/runs/benchmark-startup.ts
@@ -30950,49 +31240,65 @@ async function handleRunsShow(context, runId, options = {}) {
30950
31240
  ]);
30951
31241
  context.io.writeResult({ run, summary }, formatRunShowText);
30952
31242
  }
30953
- function formatRunShowText(result, writeLine) {
31243
+ function formatRunShowText(result, writeLine, style) {
30954
31244
  const { summary } = result;
30955
31245
  writeLine(
30956
- `${summary.run.id} ${summary.run.status} session=${summary.run.sessionName} profile=${summary.run.profileName}`
31246
+ `${style.id(summary.run.id)} ${styleRunStatus(style, summary.run.status)} ${style.dim(
31247
+ `session=${summary.run.sessionName} profile=${summary.run.profileName}`
31248
+ )}`
30957
31249
  );
30958
31250
  if (summary.run.displayTitle) {
30959
- writeLine(`title: ${summary.run.displayTitle}`);
31251
+ writeLine(`${style.label("title:")} ${summary.run.displayTitle}`);
30960
31252
  }
30961
31253
  writeLine(
30962
- `created=${summary.run.createdAt} started=${summary.run.startedAt ?? "-"} finished=${summary.run.finishedAt ?? "-"}`
31254
+ style.dim(
31255
+ `created=${summary.run.createdAt} started=${summary.run.startedAt ?? "-"} finished=${summary.run.finishedAt ?? "-"}`
31256
+ )
30963
31257
  );
30964
31258
  writeLine(
30965
- `timing: queued=${formatMs(summary.timing.queuedMs)} active=${formatMs(summary.timing.activeMs)} total=${formatMs(summary.timing.totalMs)}`
31259
+ `${style.label("timing:")} ${style.dim(
31260
+ `queued=${formatMs(summary.timing.queuedMs)} active=${formatMs(summary.timing.activeMs)} total=${formatMs(summary.timing.totalMs)}`
31261
+ )}`
30966
31262
  );
30967
31263
  writeLine(
30968
- `entries=${summary.conversation.entryCount} failed=${summary.conversation.failedEntryCount} turns=${summary.turns.length} lastSequence=${summary.conversation.lastSequence}`
31264
+ style.dim(
31265
+ `entries=${summary.conversation.entryCount} failed=${summary.conversation.failedEntryCount} turns=${summary.turns.length} lastSequence=${summary.conversation.lastSequence}`
31266
+ )
30969
31267
  );
30970
31268
  writeLine(
30971
- `trigger: spawn=${summary.trigger.spawn} signaled=${summary.trigger.signaledCount} dropped=${summary.trigger.droppedCount}`
31269
+ `${style.label("trigger:")} spawn=${summary.trigger.spawn} ${style.dim(
31270
+ `signaled=${summary.trigger.signaledCount} dropped=${summary.trigger.droppedCount}`
31271
+ )}`
30972
31272
  );
30973
31273
  if (summary.artifacts.count > 0) {
30974
31274
  writeLine(
30975
- `artifacts: ${summary.artifacts.count} (${summary.artifacts.types.join(", ")})`
31275
+ `${style.label("artifacts:")} ${summary.artifacts.count} ${style.dim(
31276
+ `(${summary.artifacts.types.join(", ")})`
31277
+ )}`
30976
31278
  );
30977
31279
  }
30978
31280
  writeLine(
30979
- `commands: ${summary.commands.total} failed=${summary.commands.failed}`
31281
+ `${style.label("commands:")} ${summary.commands.total} ${style.dim(
31282
+ `failed=${summary.commands.failed}`
31283
+ )}`
30980
31284
  );
30981
31285
  if (summary.tools.length > 0) {
30982
- writeLine("tools:");
31286
+ writeLine(style.label("tools:"));
30983
31287
  for (const tool of summary.tools) {
30984
31288
  writeLine(
30985
- ` ${tool.name} calls=${tool.calls} errors=${tool.errors} p50=${formatMs(tool.durationMs.p50)} max=${formatMs(tool.durationMs.max)}`
31289
+ ` ${tool.name} ${style.dim(
31290
+ `calls=${tool.calls} errors=${tool.errors} p50=${formatMs(tool.durationMs.p50)} max=${formatMs(tool.durationMs.max)}`
31291
+ )}`
30986
31292
  );
30987
31293
  }
30988
31294
  }
30989
31295
  for (const check2 of summary.checks) {
30990
31296
  writeLine(
30991
- `check: ${check2.name} ${check2.status}${check2.conclusion ? ` ${check2.conclusion}` : ""}`
31297
+ `${style.label("check:")} ${check2.name} ${check2.status}${check2.conclusion ? ` ${styleCheckConclusion(style, check2.conclusion)}` : ""}`
30992
31298
  );
30993
31299
  }
30994
31300
  if (summary.run.error !== null) {
30995
- writeLine(`error: ${JSON.stringify(summary.run.error)}`);
31301
+ writeLine(style.error(`error: ${JSON.stringify(summary.run.error)}`));
30996
31302
  }
30997
31303
  }
30998
31304
  async function handleRunsConversation(context, runId, options = {}) {
@@ -31019,25 +31325,31 @@ async function handleRunsConversation(context, runId, options = {}) {
31019
31325
  formatConversationText
31020
31326
  );
31021
31327
  }
31022
- function formatConversationText(result, writeLine) {
31328
+ function formatConversationText(result, writeLine, style) {
31023
31329
  if (result.events.length === 0) {
31024
- writeLine("No conversation entries.");
31330
+ writeLine(style.dim("No conversation entries."));
31025
31331
  return;
31026
31332
  }
31027
31333
  for (const event of result.events) {
31028
- const failed = event.status === "failed" ? " FAILED" : "";
31334
+ const failed = event.status === "failed" ? ` ${style.error("FAILED")}` : "";
31029
31335
  writeLine(
31030
- `${event.sequence} ${event.role}/${event.kind}${failed}: ${entryPreview(event, result.full)}`
31336
+ `${style.dim(String(event.sequence))} ${style.label(
31337
+ `${event.role}/${event.kind}`
31338
+ )}${failed}: ${entryPreview(event, result.full)}`
31031
31339
  );
31032
31340
  }
31033
31341
  if (result.hasMore) {
31034
31342
  if (result.tailMode) {
31035
31343
  const oldest = result.events[0]?.sequence;
31036
31344
  writeLine(
31037
- `(more older entries; rerun with --before ${oldest ?? "<sequence>"})`
31345
+ style.dim(
31346
+ `(more older entries; rerun with --before ${oldest ?? "<sequence>"})`
31347
+ )
31038
31348
  );
31039
31349
  } else {
31040
- writeLine(`(more entries; continue with --after ${result.cursor})`);
31350
+ writeLine(
31351
+ style.dim(`(more entries; continue with --after ${result.cursor})`)
31352
+ );
31041
31353
  }
31042
31354
  }
31043
31355
  }
@@ -31051,21 +31363,25 @@ async function handleRunsSearch(context, runId, queries, options = {}) {
31051
31363
  });
31052
31364
  context.io.writeResult({ runId, queries, ...response }, formatSearchText);
31053
31365
  }
31054
- function formatSearchText(result, writeLine) {
31366
+ function formatSearchText(result, writeLine, style) {
31055
31367
  if (result.matches.length === 0) {
31056
- writeLine(`No matches for: ${result.queries.join(", ")}`);
31368
+ writeLine(style.dim(`No matches for: ${result.queries.join(", ")}`));
31057
31369
  return;
31058
31370
  }
31059
31371
  for (const match of result.matches) {
31060
31372
  for (const snippet of match.snippets) {
31061
31373
  writeLine(
31062
- `${match.sequence} ${match.kind} [${snippet.query}]: ${singleLine(snippet.text)}`
31374
+ `${style.dim(String(match.sequence))} ${match.kind} ${style.label(
31375
+ `[${snippet.query}]`
31376
+ )}: ${singleLine(snippet.text)}`
31063
31377
  );
31064
31378
  }
31065
31379
  }
31066
31380
  if (result.hasMore) {
31067
31381
  writeLine(
31068
- `(more scanned entries; continue with --after ${result.nextAfterSequence ?? "<sequence>"})`
31382
+ style.dim(
31383
+ `(more scanned entries; continue with --after ${result.nextAfterSequence ?? "<sequence>"})`
31384
+ )
31069
31385
  );
31070
31386
  }
31071
31387
  }
@@ -31081,29 +31397,33 @@ async function handleRunsTools(context, runId, options = {}) {
31081
31397
  });
31082
31398
  context.io.writeResult({ runId, ...response }, formatToolsText);
31083
31399
  }
31084
- function formatToolsText(result, writeLine) {
31400
+ function formatToolsText(result, writeLine, style) {
31085
31401
  if (result.exchanges.length === 0) {
31086
- writeLine("No tool exchanges.");
31402
+ writeLine(style.dim("No tool exchanges."));
31087
31403
  return;
31088
31404
  }
31089
31405
  for (const exchange of result.exchanges) {
31090
31406
  const duration4 = exchange.durationMs === null ? "-" : `${exchange.durationMs}ms`;
31091
- const outcome = exchangeOutcome(exchange.isError);
31407
+ const outcome = exchangeOutcome(style, exchange.isError);
31092
31408
  writeLine(
31093
- `${exchange.callSequence} ${exchange.name} ${duration4} ${outcome}: ${preview(exchange.input)}`
31409
+ `${style.dim(String(exchange.callSequence))} ${style.label(
31410
+ exchange.name
31411
+ )} ${style.dim(duration4)} ${outcome}: ${preview(exchange.input)}`
31094
31412
  );
31095
31413
  }
31096
31414
  if (result.hasMore) {
31097
31415
  writeLine(
31098
- `(more exchanges; page older with --before ${result.nextBeforeSequence ?? "<sequence>"})`
31416
+ style.dim(
31417
+ `(more exchanges; page older with --before ${result.nextBeforeSequence ?? "<sequence>"})`
31418
+ )
31099
31419
  );
31100
31420
  }
31101
31421
  }
31102
- function exchangeOutcome(isError) {
31422
+ function exchangeOutcome(style, isError) {
31103
31423
  if (isError === null) {
31104
- return "pending";
31424
+ return style.dim("pending");
31105
31425
  }
31106
- return isError ? "ERR" : "ok";
31426
+ return isError ? style.error("ERR") : style.success("ok");
31107
31427
  }
31108
31428
  async function handleRunsTriggers(context, runId, options = {}) {
31109
31429
  const client = createContextApiClient(context);
@@ -31112,26 +31432,28 @@ async function handleRunsTriggers(context, runId, options = {}) {
31112
31432
  });
31113
31433
  context.io.writeResult({ runId, ...response }, formatTriggersText);
31114
31434
  }
31115
- function formatTriggersText(result, writeLine) {
31435
+ function formatTriggersText(result, writeLine, style) {
31116
31436
  if (result.spawn) {
31117
31437
  writeLine(
31118
- `spawn: ${result.spawn.eventKey} (${result.spawn.originKind}) delivered=${result.spawn.deliveredAt}`
31438
+ `${style.label("spawn:")} ${result.spawn.eventKey} ${style.dim(
31439
+ `(${result.spawn.originKind}) delivered=${result.spawn.deliveredAt}`
31440
+ )}`
31119
31441
  );
31120
31442
  } else if (result.starter) {
31121
31443
  writeLine(
31122
- `spawn: ${result.starter.principal.kind === "run" ? "agent" : "manual"} starter=${JSON.stringify(result.starter.principal)}`
31444
+ `${style.label("spawn:")} ${result.starter.principal.kind === "run" ? "agent" : "manual"} ${style.dim(`starter=${JSON.stringify(result.starter.principal)}`)}`
31123
31445
  );
31124
31446
  } else {
31125
- writeLine("spawn: manual");
31447
+ writeLine(`${style.label("spawn:")} manual`);
31126
31448
  }
31127
31449
  if (result.deliveries.length === 0) {
31128
- writeLine("No subsequent deliveries.");
31450
+ writeLine(style.dim("No subsequent deliveries."));
31129
31451
  return;
31130
31452
  }
31131
31453
  for (const delivery of result.deliveries) {
31132
- const reason = delivery.reason ? ` reason=${delivery.reason}` : "";
31454
+ const reason = delivery.reason ? ` ${style.dim(`reason=${delivery.reason}`)}` : "";
31133
31455
  writeLine(
31134
- `${delivery.deliveredAt} ${delivery.action} ${delivery.eventKey}${reason}`
31456
+ `${style.dim(delivery.deliveredAt)} ${delivery.action} ${delivery.eventKey}${reason}`
31135
31457
  );
31136
31458
  }
31137
31459
  }
@@ -31142,14 +31464,16 @@ async function handleRunsArtifacts(context, runId, options = {}) {
31142
31464
  });
31143
31465
  context.io.writeResult({ runId, ...response }, formatArtifactsText);
31144
31466
  }
31145
- function formatArtifactsText(result, writeLine) {
31467
+ function formatArtifactsText(result, writeLine, style) {
31146
31468
  if (result.artifacts.length === 0) {
31147
- writeLine("No artifacts currently owned.");
31469
+ writeLine(style.dim("No artifacts currently owned."));
31148
31470
  return;
31149
31471
  }
31150
31472
  for (const artifact of result.artifacts) {
31151
31473
  writeLine(
31152
- `${artifact.artifactType} ${artifact.externalId} recorded=${artifact.recordedAt}`
31474
+ `${style.label(artifact.artifactType)} ${style.id(artifact.externalId)} ${style.dim(
31475
+ `recorded=${artifact.recordedAt}`
31476
+ )}`
31153
31477
  );
31154
31478
  }
31155
31479
  }
@@ -31160,20 +31484,38 @@ async function handleRunsCommands(context, runId, options = {}) {
31160
31484
  });
31161
31485
  context.io.writeResult({ runId, ...response }, formatCommandsText);
31162
31486
  }
31163
- function formatCommandsText(result, writeLine) {
31487
+ function formatCommandsText(result, writeLine, style) {
31164
31488
  if (result.commands.length === 0) {
31165
- writeLine("No commands.");
31489
+ writeLine(style.dim("No commands."));
31166
31490
  return;
31167
31491
  }
31168
31492
  for (const command of result.commands) {
31493
+ const status = command.status === "failed" ? style.error(command.status) : command.status;
31169
31494
  writeLine(
31170
- `${command.createdAt} ${command.kind} ${command.status} sender=${command.sender.type}: ${preview(command.payload)}`
31495
+ `${style.dim(command.createdAt)} ${style.label(command.kind)} ${status} ${style.dim(
31496
+ `sender=${command.sender.type}`
31497
+ )}: ${preview(command.payload)}`
31171
31498
  );
31172
31499
  }
31173
31500
  }
31174
31501
  function formatMs(value) {
31175
31502
  return value === null ? "-" : `${value}ms`;
31176
31503
  }
31504
+ function styleCheckConclusion(style, conclusion) {
31505
+ switch (conclusion) {
31506
+ case "success":
31507
+ return style.success(conclusion);
31508
+ case "failure":
31509
+ case "timed_out":
31510
+ return style.error(conclusion);
31511
+ case "cancelled":
31512
+ case "skipped":
31513
+ case "neutral":
31514
+ return style.dim(conclusion);
31515
+ default:
31516
+ return conclusion;
31517
+ }
31518
+ }
31177
31519
  function entryPreview(event, full) {
31178
31520
  const texts = event.content.parts.map((part) => {
31179
31521
  switch (part.type) {
@@ -31205,40 +31547,6 @@ function clip(text) {
31205
31547
  return text.length > PREVIEW_CHARS ? `${text.slice(0, PREVIEW_CHARS)}\u2026` : text;
31206
31548
  }
31207
31549
 
31208
- // src/commands/runs/list.ts
31209
- async function handleRunsList(context, sessionName, options = {}) {
31210
- const result = await fetchRuns(context, sessionName, options);
31211
- context.io.writeResult(result, formatRunsText);
31212
- }
31213
- async function fetchRuns(context, sessionName, options) {
31214
- const client = createContextApiClient(context);
31215
- const clientOptions = {
31216
- apiBaseUrl: apiUrlFromOptions(context, options),
31217
- includeArchived: options.includeArchived,
31218
- statuses: options.status,
31219
- since: options.since,
31220
- limit: options.limit
31221
- };
31222
- const response = sessionName ? await client.listSessionRuns(sessionName, clientOptions) : await client.listRuns(clientOptions);
31223
- return {
31224
- session: sessionName ?? null,
31225
- runs: response.runs,
31226
- includeArchived: Boolean(options.includeArchived)
31227
- };
31228
- }
31229
- function formatRunsText(result, writeLine) {
31230
- if (result.runs.length === 0) {
31231
- writeLine(
31232
- result.session ? `No runs found for session ${result.session}.` : "No runs found in the current project."
31233
- );
31234
- return;
31235
- }
31236
- for (const run of result.runs) {
31237
- const archived = run.archivedAt ? ` archived_at=${run.archivedAt}` : "";
31238
- writeLine(`${run.id} ${run.status} ${run.createdAt}${archived}`);
31239
- }
31240
- }
31241
-
31242
31550
  // src/commands/runs/commands.ts
31243
31551
  function collect(value, previous = []) {
31244
31552
  return [...previous, value];
@@ -31675,8 +31983,8 @@ async function connectSessionPresence2(input) {
31675
31983
  const options = { apiBaseUrl: input.apiBaseUrl };
31676
31984
  const result = await connectWithConfigTokenBootstrap(input, options);
31677
31985
  input.writeOutput(result.message);
31678
- for (const identity of result.realized) {
31679
- input.writeOutput(realizedIdentityLine(input.session, identity));
31986
+ for (const identity2 of result.realized) {
31987
+ input.writeOutput(realizedIdentityLine(input.session, identity2));
31680
31988
  }
31681
31989
  if (result.pending.length === 0) {
31682
31990
  await promptForIconUploads(input, options);
@@ -31734,11 +32042,11 @@ async function connectSessionPresence2(input) {
31734
32042
  { name: input.session },
31735
32043
  options
31736
32044
  );
31737
- const identity = presence.identities.find(
32045
+ const identity2 = presence.identities.find(
31738
32046
  (entry) => entry.identityId === pending.identityId
31739
32047
  );
31740
- if (identity?.realized) {
31741
- input.writeOutput(realizedIdentityLine(input.session, identity));
32048
+ if (identity2?.realized) {
32049
+ input.writeOutput(realizedIdentityLine(input.session, identity2));
31742
32050
  realized = true;
31743
32051
  break;
31744
32052
  }
@@ -31751,9 +32059,9 @@ async function connectSessionPresence2(input) {
31751
32059
  }
31752
32060
  await promptForIconUploads(input, options);
31753
32061
  }
31754
- function realizedIdentityLine(session, identity) {
31755
- const handle = identity.botUsername ? `persona/@${identity.botUsername}` : `bot/${identity.botUserId ?? ""}`;
31756
- return `connected session/${session} workspace/${identity.workspace} ${handle}`;
32062
+ function realizedIdentityLine(session, identity2) {
32063
+ const handle = identity2.botUsername ? `persona/@${identity2.botUsername}` : `bot/${identity2.botUserId ?? ""}`;
32064
+ return `connected session/${session} workspace/${identity2.workspace} ${handle}`;
31757
32065
  }
31758
32066
  function manualGuidance(input) {
31759
32067
  if (input.allTelegram) {
@@ -31767,19 +32075,19 @@ async function promptForIconUploads(input, options) {
31767
32075
  options
31768
32076
  );
31769
32077
  const drifted = presence.identities.filter(
31770
- (identity) => identity.realized && identity.appId && identity.avatarSha256 && identity.avatarSha256 !== identity.appliedIconSha256
32078
+ (identity2) => identity2.realized && identity2.appId && identity2.avatarSha256 && identity2.avatarSha256 !== identity2.appliedIconSha256
31771
32079
  );
31772
32080
  if (drifted.length === 0) {
31773
32081
  return;
31774
32082
  }
31775
32083
  const canPrompt = Boolean(input.prompt?.io.canPrompt()) && !input.manual;
31776
- for (const identity of drifted) {
31777
- const settingsUrl = `${SLACK_APPS_URL}/${identity.appId}/general`;
32084
+ for (const identity2 of drifted) {
32085
+ const settingsUrl = `${SLACK_APPS_URL}/${identity2.appId}/general`;
31778
32086
  input.writeOutput(
31779
- `Workspace "${identity.workspace}" agent app icon does not match the session avatar yet. Slack has no app-icon API; upload the avatar image once under "Display Information" at ${settingsUrl}`
32087
+ `Workspace "${identity2.workspace}" agent app icon does not match the session avatar yet. Slack has no app-icon API; upload the avatar image once under "Display Information" at ${settingsUrl}`
31780
32088
  );
31781
- if (identity.avatarUrl) {
31782
- input.writeOutput(`avatar image: ${identity.avatarUrl}`);
32089
+ if (identity2.avatarUrl) {
32090
+ input.writeOutput(`avatar image: ${identity2.avatarUrl}`);
31783
32091
  }
31784
32092
  if (!canPrompt) {
31785
32093
  input.writeOutput(
@@ -31787,8 +32095,8 @@ async function promptForIconUploads(input, options) {
31787
32095
  );
31788
32096
  continue;
31789
32097
  }
31790
- const staged = identity.avatarUrl ? await (input.stageAvatar ?? stageAvatarImage)({
31791
- avatarUrl: identity.avatarUrl,
32098
+ const staged = identity2.avatarUrl ? await (input.stageAvatar ?? stageAvatarImage)({
32099
+ avatarUrl: identity2.avatarUrl,
31792
32100
  session: input.session
31793
32101
  }) : void 0;
31794
32102
  if (staged) {
@@ -31810,20 +32118,20 @@ async function promptForIconUploads(input, options) {
31810
32118
  }
31811
32119
  if (!["y", "yes"].includes(answer.trim().toLowerCase())) {
31812
32120
  input.writeOutput(
31813
- `Skipped recording the icon for workspace "${identity.workspace}"; this prompt repeats on the next connect.`
32121
+ `Skipped recording the icon for workspace "${identity2.workspace}"; this prompt repeats on the next connect.`
31814
32122
  );
31815
32123
  continue;
31816
32124
  }
31817
32125
  const recorded = await input.client.recordSessionPresenceIcon(
31818
32126
  {
31819
32127
  name: input.session,
31820
- identityId: identity.identityId,
31821
- sha256: identity.avatarSha256
32128
+ identityId: identity2.identityId,
32129
+ sha256: identity2.avatarSha256
31822
32130
  },
31823
32131
  options
31824
32132
  );
31825
32133
  input.writeOutput(
31826
- `recorded icon session/${input.session} workspace/${identity.workspace} sha256/${recorded.appliedIconSha256.slice(0, 12)}`
32134
+ `recorded icon session/${input.session} workspace/${identity2.workspace} sha256/${recorded.appliedIconSha256.slice(0, 12)}`
31827
32135
  );
31828
32136
  }
31829
32137
  }
@@ -31907,9 +32215,16 @@ async function launchRun(input) {
31907
32215
  message: input.commandOptions.message,
31908
32216
  apiBaseUrl
31909
32217
  });
31910
- input.context.writeOutput(`run_id ${created.run_id}`);
31911
- input.context.writeOutput(`workflow_id ${created.workflow_id}`);
31912
- input.context.writeOutput(`status ${created.status}`);
32218
+ const style = input.context.io.style;
32219
+ input.context.writeOutput(
32220
+ `${style.label("run_id")} ${style.id(created.run_id)}`
32221
+ );
32222
+ input.context.writeOutput(
32223
+ `${style.label("workflow_id")} ${style.id(created.workflow_id)}`
32224
+ );
32225
+ input.context.writeOutput(
32226
+ `${style.label("status")} ${styleRunStatus(style, created.status)}`
32227
+ );
31913
32228
  if (input.commandOptions.attach) {
31914
32229
  const writeConversationEvent = createConversationStreamWriter({
31915
32230
  writeLine: input.context.writeOutput
@@ -31979,6 +32294,7 @@ function registerToolCommands(program, context) {
31979
32294
  }
31980
32295
 
31981
32296
  // src/lib/output/iostreams.ts
32297
+ init_style();
31982
32298
  function createIOStreams(flags) {
31983
32299
  const isTTY = Boolean(process.stdout.isTTY);
31984
32300
  const isCI = Boolean(process.env.CI);
@@ -31988,18 +32304,20 @@ function createIOStreams(flags) {
31988
32304
  `));
31989
32305
  const writeError = flags.writeError ?? ((text) => process.stderr.write(`${text}
31990
32306
  `));
32307
+ const style = createStyle({ isTTY, noColor, outputMode });
31991
32308
  return {
31992
32309
  isTTY,
31993
32310
  isCI,
31994
32311
  noColor,
31995
32312
  outputMode,
32313
+ style,
31996
32314
  canPrompt: () => isTTY && !isCI,
31997
32315
  writeLine,
31998
32316
  writeError,
31999
32317
  writeResult: (result, renderText) => {
32000
32318
  if (outputMode === "text" || outputMode === "tui") {
32001
32319
  if (renderText) {
32002
- renderText(result, writeLine);
32320
+ renderText(result, writeLine, style);
32003
32321
  } else {
32004
32322
  writeLine(String(result));
32005
32323
  }
@@ -32138,14 +32456,20 @@ function isCliEntrypoint(input) {
32138
32456
  }
32139
32457
 
32140
32458
  // src/entrypoints/index.ts
32459
+ init_style();
32141
32460
  function runEntrypoint(input) {
32142
32461
  if (isCliEntrypoint({
32143
32462
  moduleUrl: input.moduleUrl,
32144
32463
  entrypoint: input.argv[1] ? { kind: "path", path: input.argv[1] } : { kind: "missing" }
32145
32464
  })) {
32146
32465
  createProgram().parseAsync(input.argv).catch((err) => {
32466
+ const style = createStyle({
32467
+ isTTY: Boolean(process.stderr.isTTY),
32468
+ noColor: Boolean(process.env.NO_COLOR) || input.argv.includes("--no-color"),
32469
+ outputMode: "text"
32470
+ });
32147
32471
  process.stderr.write(
32148
- `${err instanceof Error ? err.message : String(err)}
32472
+ `${style.error(err instanceof Error ? err.message : String(err))}
32149
32473
  `
32150
32474
  );
32151
32475
  process.exit(1);