@settlemint/sdk-cli 2.6.3-pr88f1ab51 → 2.6.3-prc010bdb8

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
@@ -263167,8 +263167,13 @@ var CommandError = class extends Error {
263167
263167
  this.output = output;
263168
263168
  }
263169
263169
  };
263170
+ function isQuietMode() {
263171
+ return !!(process.env.CLAUDECODE || process.env.REPL_ID || process.env.AGENT);
263172
+ }
263170
263173
  async function executeCommand(command, args, options) {
263171
263174
  const { silent, ...spawnOptions } = options ?? {};
263175
+ const quietMode = isQuietMode();
263176
+ const shouldSuppressOutput = quietMode ? silent !== false : !!silent;
263172
263177
  const child = spawn(command, args, {
263173
263178
  ...spawnOptions,
263174
263179
  env: {
@@ -263178,23 +263183,38 @@ async function executeCommand(command, args, options) {
263178
263183
  });
263179
263184
  process.stdin.pipe(child.stdin);
263180
263185
  const output = [];
263186
+ const stdoutOutput = [];
263187
+ const stderrOutput = [];
263181
263188
  return new Promise((resolve, reject) => {
263182
263189
  child.stdout.on("data", (data) => {
263183
263190
  const maskedData = maskTokens(data.toString());
263184
- if (!silent) {
263191
+ if (!shouldSuppressOutput) {
263185
263192
  process.stdout.write(maskedData);
263186
263193
  }
263187
263194
  output.push(maskedData);
263195
+ stdoutOutput.push(maskedData);
263188
263196
  });
263189
263197
  child.stderr.on("data", (data) => {
263190
263198
  const maskedData = maskTokens(data.toString());
263191
- if (!silent) {
263199
+ if (!shouldSuppressOutput) {
263192
263200
  process.stderr.write(maskedData);
263193
263201
  }
263194
263202
  output.push(maskedData);
263203
+ stderrOutput.push(maskedData);
263195
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
+ };
263196
263215
  child.on("error", (err) => {
263197
263216
  process.stdin.unpipe(child.stdin);
263217
+ showErrorOutput();
263198
263218
  reject(new CommandError(err.message, "code" in err && typeof err.code === "number" ? err.code : 1, output));
263199
263219
  });
263200
263220
  child.on("close", (code) => {
@@ -263203,6 +263223,7 @@ async function executeCommand(command, args, options) {
263203
263223
  resolve(output);
263204
263224
  return;
263205
263225
  }
263226
+ showErrorOutput();
263206
263227
  reject(new CommandError(`Command "${command}" exited with code ${code}`, code, output));
263207
263228
  });
263208
263229
  });
@@ -263215,38 +263236,51 @@ var intro = (msg) => {
263215
263236
  console.log(magentaBright(maskTokens(msg)));
263216
263237
  console.log("");
263217
263238
  };
263218
- var note = (message, level = "info") => {
263219
- let messageText;
263220
- let _error;
263221
- if (message instanceof Error) {
263222
- _error = message;
263223
- messageText = message.message;
263224
- if (level === "error" && message.stack) {
263225
- messageText = `${messageText}
263239
+ function colorize(msg, level) {
263240
+ if (msg.includes("\x1B[")) {
263241
+ return msg;
263242
+ }
263243
+ if (level === "warn") {
263244
+ return yellowBright(msg);
263245
+ }
263246
+ if (level === "error") {
263247
+ return redBright(msg);
263248
+ }
263249
+ return msg;
263250
+ }
263251
+ function canPrint(level) {
263252
+ if (level !== "info") {
263253
+ return true;
263254
+ }
263255
+ return shouldPrint();
263256
+ }
263257
+ function prepareMessage(value, level) {
263258
+ let text;
263259
+ if (value instanceof Error) {
263260
+ text = value.message;
263261
+ if (level === "error" && value.stack) {
263262
+ text = `${text}
263226
263263
 
263227
- ${message.stack}`;
263264
+ ${value.stack}`;
263228
263265
  }
263229
263266
  } else {
263230
- messageText = message;
263231
- }
263232
- const maskedMessage = maskTokens(messageText);
263233
- const _isQuietMode = process.env.CLAUDECODE || process.env.REPL_ID || process.env.AGENT;
263234
- if (level === "warn" || level === "error") {
263235
- console.log("");
263236
- if (level === "warn") {
263237
- const coloredMessage = maskedMessage.includes("\x1B[") ? maskedMessage : yellowBright(maskedMessage);
263238
- console.warn(coloredMessage);
263239
- } else {
263240
- const coloredMessage = maskedMessage.includes("\x1B[") ? maskedMessage : redBright(maskedMessage);
263241
- console.error(coloredMessage);
263242
- }
263243
- return;
263267
+ text = value;
263244
263268
  }
263245
- if (!shouldPrint()) {
263269
+ return maskTokens(text);
263270
+ }
263271
+ var note = (message, level = "info") => {
263272
+ if (!canPrint(level)) {
263246
263273
  return;
263247
263274
  }
263275
+ const msg = prepareMessage(message, level);
263248
263276
  console.log("");
263249
- console.log(maskedMessage);
263277
+ if (level === "warn") {
263278
+ console.warn(colorize(msg, level));
263279
+ } else if (level === "error") {
263280
+ console.error(colorize(msg, level));
263281
+ } else {
263282
+ console.log(msg);
263283
+ }
263250
263284
  };
263251
263285
  function list(title, items) {
263252
263286
  const formatItems = (items$1) => {
@@ -263281,8 +263315,7 @@ var SpinnerError = class extends Error {
263281
263315
  var spinner = async (options) => {
263282
263316
  const handleError = (error) => {
263283
263317
  note(error, "error");
263284
- const errorMessage = maskTokens(error.message);
263285
- throw new SpinnerError(errorMessage, error);
263318
+ throw new SpinnerError(error.message, error);
263286
263319
  };
263287
263320
  if (is_in_ci_default || !shouldPrint()) {
263288
263321
  try {
@@ -282031,7 +282064,7 @@ function pruneCurrentEnv(currentEnv, env2) {
282031
282064
  var package_default = {
282032
282065
  name: "@settlemint/sdk-cli",
282033
282066
  description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
282034
- version: "2.6.3-pr88f1ab51",
282067
+ version: "2.6.3-prc010bdb8",
282035
282068
  type: "module",
282036
282069
  private: false,
282037
282070
  license: "FSL-1.1-MIT",
@@ -282085,10 +282118,10 @@ var package_default = {
282085
282118
  "@inquirer/input": "4.2.5",
282086
282119
  "@inquirer/password": "4.0.21",
282087
282120
  "@inquirer/select": "4.4.0",
282088
- "@settlemint/sdk-hasura": "2.6.3-pr88f1ab51",
282089
- "@settlemint/sdk-js": "2.6.3-pr88f1ab51",
282090
- "@settlemint/sdk-utils": "2.6.3-pr88f1ab51",
282091
- "@settlemint/sdk-viem": "2.6.3-pr88f1ab51",
282121
+ "@settlemint/sdk-hasura": "2.6.3-prc010bdb8",
282122
+ "@settlemint/sdk-js": "2.6.3-prc010bdb8",
282123
+ "@settlemint/sdk-utils": "2.6.3-prc010bdb8",
282124
+ "@settlemint/sdk-viem": "2.6.3-prc010bdb8",
282092
282125
  "@types/node": "24.10.0",
282093
282126
  "@types/semver": "7.7.1",
282094
282127
  "@types/which": "3.0.4",
@@ -282105,7 +282138,7 @@ var package_default = {
282105
282138
  },
282106
282139
  peerDependencies: {
282107
282140
  hardhat: "<= 4",
282108
- "@settlemint/sdk-js": "2.6.3-pr88f1ab51"
282141
+ "@settlemint/sdk-js": "2.6.3-prc010bdb8"
282109
282142
  },
282110
282143
  peerDependenciesMeta: {
282111
282144
  hardhat: {
@@ -286102,38 +286135,51 @@ function shouldPrint2() {
286102
286135
  var maskTokens4 = (output) => {
286103
286136
  return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
286104
286137
  };
286105
- var note2 = (message, level = "info") => {
286106
- let messageText;
286107
- let _error;
286108
- if (message instanceof Error) {
286109
- _error = message;
286110
- messageText = message.message;
286111
- if (level === "error" && message.stack) {
286112
- messageText = `${messageText}
286138
+ function colorize2(msg, level) {
286139
+ if (msg.includes("\x1B[")) {
286140
+ return msg;
286141
+ }
286142
+ if (level === "warn") {
286143
+ return yellowBright(msg);
286144
+ }
286145
+ if (level === "error") {
286146
+ return redBright(msg);
286147
+ }
286148
+ return msg;
286149
+ }
286150
+ function canPrint2(level) {
286151
+ if (level !== "info") {
286152
+ return true;
286153
+ }
286154
+ return shouldPrint2();
286155
+ }
286156
+ function prepareMessage2(value2, level) {
286157
+ let text;
286158
+ if (value2 instanceof Error) {
286159
+ text = value2.message;
286160
+ if (level === "error" && value2.stack) {
286161
+ text = `${text}
286113
286162
 
286114
- ${message.stack}`;
286163
+ ${value2.stack}`;
286115
286164
  }
286116
286165
  } else {
286117
- messageText = message;
286118
- }
286119
- const maskedMessage = maskTokens4(messageText);
286120
- const _isQuietMode = process.env.CLAUDECODE || process.env.REPL_ID || process.env.AGENT;
286121
- if (level === "warn" || level === "error") {
286122
- console.log("");
286123
- if (level === "warn") {
286124
- const coloredMessage = maskedMessage.includes("\x1B[") ? maskedMessage : yellowBright(maskedMessage);
286125
- console.warn(coloredMessage);
286126
- } else {
286127
- const coloredMessage = maskedMessage.includes("\x1B[") ? maskedMessage : redBright(maskedMessage);
286128
- console.error(coloredMessage);
286129
- }
286130
- return;
286166
+ text = value2;
286131
286167
  }
286132
- if (!shouldPrint2()) {
286168
+ return maskTokens4(text);
286169
+ }
286170
+ var note2 = (message, level = "info") => {
286171
+ if (!canPrint2(level)) {
286133
286172
  return;
286134
286173
  }
286174
+ const msg = prepareMessage2(message, level);
286135
286175
  console.log("");
286136
- console.log(maskedMessage);
286176
+ if (level === "warn") {
286177
+ console.warn(colorize2(msg, level));
286178
+ } else if (level === "error") {
286179
+ console.error(colorize2(msg, level));
286180
+ } else {
286181
+ console.log(msg);
286182
+ }
286137
286183
  };
286138
286184
  async function installDependencies(pkgs, cwd) {
286139
286185
  try {
@@ -323414,4 +323460,4 @@ async function sdkCliCommand(argv = process.argv) {
323414
323460
  // src/cli.ts
323415
323461
  sdkCliCommand();
323416
323462
 
323417
- //# debugId=43E1D8728748CAA864756E2164756E21
323463
+ //# debugId=DDA3D38BD1C5394364756E2164756E21