@settlemint/sdk-cli 2.6.3-pr5145c8e4 → 2.6.3-pr8949506b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -263129,7 +263129,13 @@ function yoctoSpinner(options) {
263129
263129
  // ../utils/dist/terminal.js
263130
263130
  var import_console_table_printer = __toESM(require_dist2(), 1);
263131
263131
  function shouldPrint() {
263132
- return process.env.SETTLEMINT_DISABLE_TERMINAL !== "true";
263132
+ if (process.env.SETTLEMINT_DISABLE_TERMINAL === "true") {
263133
+ return false;
263134
+ }
263135
+ if (process.env.CLAUDECODE || process.env.REPL_ID || process.env.AGENT) {
263136
+ return false;
263137
+ }
263138
+ return true;
263133
263139
  }
263134
263140
  var ascii = () => {
263135
263141
  if (!shouldPrint()) {
@@ -263161,8 +263167,13 @@ var CommandError = class extends Error {
263161
263167
  this.output = output;
263162
263168
  }
263163
263169
  };
263170
+ function isQuietMode() {
263171
+ return !!(process.env.CLAUDECODE || process.env.REPL_ID || process.env.AGENT);
263172
+ }
263164
263173
  async function executeCommand(command, args, options) {
263165
263174
  const { silent, ...spawnOptions } = options ?? {};
263175
+ const quietMode = isQuietMode();
263176
+ const shouldSuppressOutput = quietMode ? silent !== false : !!silent;
263166
263177
  const child = spawn(command, args, {
263167
263178
  ...spawnOptions,
263168
263179
  env: {
@@ -263172,23 +263183,38 @@ async function executeCommand(command, args, options) {
263172
263183
  });
263173
263184
  process.stdin.pipe(child.stdin);
263174
263185
  const output = [];
263186
+ const stdoutOutput = [];
263187
+ const stderrOutput = [];
263175
263188
  return new Promise((resolve, reject) => {
263176
263189
  child.stdout.on("data", (data) => {
263177
263190
  const maskedData = maskTokens(data.toString());
263178
- if (!silent) {
263191
+ if (!shouldSuppressOutput) {
263179
263192
  process.stdout.write(maskedData);
263180
263193
  }
263181
263194
  output.push(maskedData);
263195
+ stdoutOutput.push(maskedData);
263182
263196
  });
263183
263197
  child.stderr.on("data", (data) => {
263184
263198
  const maskedData = maskTokens(data.toString());
263185
- if (!silent) {
263199
+ if (!shouldSuppressOutput) {
263186
263200
  process.stderr.write(maskedData);
263187
263201
  }
263188
263202
  output.push(maskedData);
263203
+ stderrOutput.push(maskedData);
263189
263204
  });
263205
+ const showErrorOutput = () => {
263206
+ if (quietMode && shouldSuppressOutput && output.length > 0) {
263207
+ if (stdoutOutput.length > 0) {
263208
+ process.stdout.write(stdoutOutput.join(""));
263209
+ }
263210
+ if (stderrOutput.length > 0) {
263211
+ process.stderr.write(stderrOutput.join(""));
263212
+ }
263213
+ }
263214
+ };
263190
263215
  child.on("error", (err) => {
263191
263216
  process.stdin.unpipe(child.stdin);
263217
+ showErrorOutput();
263192
263218
  reject(new CommandError(err.message, "code" in err && typeof err.code === "number" ? err.code : 1, output));
263193
263219
  });
263194
263220
  child.on("close", (code) => {
@@ -263197,6 +263223,7 @@ async function executeCommand(command, args, options) {
263197
263223
  resolve(output);
263198
263224
  return;
263199
263225
  }
263226
+ showErrorOutput();
263200
263227
  reject(new CommandError(`Command "${command}" exited with code ${code}`, code, output));
263201
263228
  });
263202
263229
  });
@@ -263210,15 +263237,36 @@ var intro = (msg) => {
263210
263237
  console.log("");
263211
263238
  };
263212
263239
  var note = (message, level = "info") => {
263213
- if (!shouldPrint()) {
263240
+ let messageText;
263241
+ let _error;
263242
+ if (message instanceof Error) {
263243
+ _error = message;
263244
+ messageText = message.message;
263245
+ if (level === "error" && message.stack) {
263246
+ messageText = `${messageText}
263247
+
263248
+ ${message.stack}`;
263249
+ }
263250
+ } else {
263251
+ messageText = message;
263252
+ }
263253
+ const maskedMessage = maskTokens(messageText);
263254
+ const _isQuietMode = process.env.CLAUDECODE || process.env.REPL_ID || process.env.AGENT;
263255
+ if (level === "warn" || level === "error") {
263256
+ console.log("");
263257
+ if (level === "warn") {
263258
+ const coloredMessage = maskedMessage.includes("\x1B[") ? maskedMessage : yellowBright(maskedMessage);
263259
+ console.warn(coloredMessage);
263260
+ } else {
263261
+ const coloredMessage = maskedMessage.includes("\x1B[") ? maskedMessage : redBright(maskedMessage);
263262
+ console.error(coloredMessage);
263263
+ }
263214
263264
  return;
263215
263265
  }
263216
- const maskedMessage = maskTokens(message);
263217
- console.log("");
263218
- if (level === "warn") {
263219
- console.warn(yellowBright(maskedMessage));
263266
+ if (!shouldPrint()) {
263220
263267
  return;
263221
263268
  }
263269
+ console.log("");
263222
263270
  console.log(maskedMessage);
263223
263271
  };
263224
263272
  function list(title, items) {
@@ -263253,10 +263301,8 @@ var SpinnerError = class extends Error {
263253
263301
  };
263254
263302
  var spinner = async (options) => {
263255
263303
  const handleError = (error) => {
263304
+ note(error, "error");
263256
263305
  const errorMessage = maskTokens(error.message);
263257
- note(redBright(`${errorMessage}
263258
-
263259
- ${error.stack}`));
263260
263306
  throw new SpinnerError(errorMessage, error);
263261
263307
  };
263262
263308
  if (is_in_ci_default || !shouldPrint()) {
@@ -282006,7 +282052,7 @@ function pruneCurrentEnv(currentEnv, env2) {
282006
282052
  var package_default = {
282007
282053
  name: "@settlemint/sdk-cli",
282008
282054
  description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
282009
- version: "2.6.3-pr5145c8e4",
282055
+ version: "2.6.3-pr8949506b",
282010
282056
  type: "module",
282011
282057
  private: false,
282012
282058
  license: "FSL-1.1-MIT",
@@ -282060,10 +282106,10 @@ var package_default = {
282060
282106
  "@inquirer/input": "4.2.5",
282061
282107
  "@inquirer/password": "4.0.21",
282062
282108
  "@inquirer/select": "4.4.0",
282063
- "@settlemint/sdk-hasura": "2.6.3-pr5145c8e4",
282064
- "@settlemint/sdk-js": "2.6.3-pr5145c8e4",
282065
- "@settlemint/sdk-utils": "2.6.3-pr5145c8e4",
282066
- "@settlemint/sdk-viem": "2.6.3-pr5145c8e4",
282109
+ "@settlemint/sdk-hasura": "2.6.3-pr8949506b",
282110
+ "@settlemint/sdk-js": "2.6.3-pr8949506b",
282111
+ "@settlemint/sdk-utils": "2.6.3-pr8949506b",
282112
+ "@settlemint/sdk-viem": "2.6.3-pr8949506b",
282067
282113
  "@types/node": "24.10.0",
282068
282114
  "@types/semver": "7.7.1",
282069
282115
  "@types/which": "3.0.4",
@@ -282080,7 +282126,7 @@ var package_default = {
282080
282126
  },
282081
282127
  peerDependencies: {
282082
282128
  hardhat: "<= 4",
282083
- "@settlemint/sdk-js": "2.6.3-pr5145c8e4"
282129
+ "@settlemint/sdk-js": "2.6.3-pr8949506b"
282084
282130
  },
282085
282131
  peerDependenciesMeta: {
282086
282132
  hardhat: {
@@ -286066,21 +286112,48 @@ async function getPackageManagerExecutable(targetDir) {
286066
286112
  };
286067
286113
  }
286068
286114
  function shouldPrint2() {
286069
- return process.env.SETTLEMINT_DISABLE_TERMINAL !== "true";
286115
+ if (process.env.SETTLEMINT_DISABLE_TERMINAL === "true") {
286116
+ return false;
286117
+ }
286118
+ if (process.env.CLAUDECODE || process.env.REPL_ID || process.env.AGENT) {
286119
+ return false;
286120
+ }
286121
+ return true;
286070
286122
  }
286071
286123
  var maskTokens4 = (output) => {
286072
286124
  return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
286073
286125
  };
286074
286126
  var note2 = (message, level = "info") => {
286075
- if (!shouldPrint2()) {
286127
+ let messageText;
286128
+ let _error;
286129
+ if (message instanceof Error) {
286130
+ _error = message;
286131
+ messageText = message.message;
286132
+ if (level === "error" && message.stack) {
286133
+ messageText = `${messageText}
286134
+
286135
+ ${message.stack}`;
286136
+ }
286137
+ } else {
286138
+ messageText = message;
286139
+ }
286140
+ const maskedMessage = maskTokens4(messageText);
286141
+ const _isQuietMode = process.env.CLAUDECODE || process.env.REPL_ID || process.env.AGENT;
286142
+ if (level === "warn" || level === "error") {
286143
+ console.log("");
286144
+ if (level === "warn") {
286145
+ const coloredMessage = maskedMessage.includes("\x1B[") ? maskedMessage : yellowBright(maskedMessage);
286146
+ console.warn(coloredMessage);
286147
+ } else {
286148
+ const coloredMessage = maskedMessage.includes("\x1B[") ? maskedMessage : redBright(maskedMessage);
286149
+ console.error(coloredMessage);
286150
+ }
286076
286151
  return;
286077
286152
  }
286078
- const maskedMessage = maskTokens4(message);
286079
- console.log("");
286080
- if (level === "warn") {
286081
- console.warn(yellowBright(maskedMessage));
286153
+ if (!shouldPrint2()) {
286082
286154
  return;
286083
286155
  }
286156
+ console.log("");
286084
286157
  console.log(maskedMessage);
286085
286158
  };
286086
286159
  async function installDependencies(pkgs, cwd) {
@@ -323319,10 +323392,7 @@ async function onError(sdkcli, argv, error51) {
323319
323392
  process.exit(error51.exitCode);
323320
323393
  }
323321
323394
  if (!(error51 instanceof CancelError || error51 instanceof SpinnerError)) {
323322
- const errorMessage2 = maskTokens(error51.message);
323323
- note(redBright(`Unknown error: ${errorMessage2}
323324
-
323325
- ${error51.stack}`));
323395
+ note(error51, "error");
323326
323396
  }
323327
323397
  const commandPath = sdkcli._lastCommand?._commandPath ?? getCommandPathFromArgv(argv);
323328
323398
  if (commandPath) {
@@ -323365,4 +323435,4 @@ async function sdkCliCommand(argv = process.argv) {
323365
323435
  // src/cli.ts
323366
323436
  sdkCliCommand();
323367
323437
 
323368
- //# debugId=23103CD112E5466A64756E2164756E21
323438
+ //# debugId=AD2EE08B850F71D964756E2164756E21