minovative-mind-cli 2.8.2 → 2.8.3

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.
@@ -1,5 +1,6 @@
1
1
  import * as p from '@clack/prompts';
2
2
  import pc from 'picocolors';
3
+ import { truncateForTerminal } from '../../utils/terminal.js';
3
4
  /**
4
5
  * Asynchronous Input Handler (AsyncInputHandler)
5
6
  *
@@ -161,7 +162,7 @@ export class AsyncInputHandler {
161
162
  ;
162
163
  spinner._lastMessage = msg;
163
164
  }
164
- originalMessage(msg);
165
+ originalMessage(msg ? truncateForTerminal(msg) : msg);
165
166
  };
166
167
  const originalStart = spinner.start.bind(spinner);
167
168
  spinner.start = (msg) => {
@@ -169,7 +170,7 @@ export class AsyncInputHandler {
169
170
  ;
170
171
  spinner._lastMessage = msg;
171
172
  }
172
- originalStart(msg);
173
+ originalStart(msg ? truncateForTerminal(msg) : msg);
173
174
  };
174
175
  }
175
176
  }
@@ -215,7 +216,7 @@ export class AsyncInputHandler {
215
216
  ;
216
217
  spinner._lastMessage = msg;
217
218
  }
218
- originalMessage(msg);
219
+ originalMessage(msg ? truncateForTerminal(msg) : msg);
219
220
  };
220
221
  const originalStart = spinner.start.bind(spinner);
221
222
  spinner.start = (msg) => {
@@ -223,7 +224,7 @@ export class AsyncInputHandler {
223
224
  ;
224
225
  spinner._lastMessage = msg;
225
226
  }
226
- originalStart(msg);
227
+ originalStart(msg ? truncateForTerminal(msg) : msg);
227
228
  };
228
229
  }
229
230
  }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Strips ANSI escape sequences from a string to accurately measure its visible terminal length.
3
+ *
4
+ * @param str - The input string containing potential ANSI codes.
5
+ * @returns The plain text representation without ANSI sequences.
6
+ */
7
+ export declare function stripAnsi(str: string): string;
8
+ /**
9
+ * Safely truncates a string so that its visible length fits within the available terminal columns.
10
+ * Prevents terminal line wrapping and multi-line spinner spam.
11
+ *
12
+ * @param str - The status string to truncate.
13
+ * @param maxLen - Optional explicit column limit. Defaults to terminal width minus padding margin.
14
+ * @returns The original string if it fits, or a safely truncated string with an ellipsis.
15
+ */
16
+ export declare function truncateForTerminal(str: string, maxLen?: number): string;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Strips ANSI escape sequences from a string to accurately measure its visible terminal length.
3
+ *
4
+ * @param str - The input string containing potential ANSI codes.
5
+ * @returns The plain text representation without ANSI sequences.
6
+ */
7
+ export function stripAnsi(str) {
8
+ if (!str)
9
+ return '';
10
+ return str.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, '');
11
+ }
12
+ /**
13
+ * Safely truncates a string so that its visible length fits within the available terminal columns.
14
+ * Prevents terminal line wrapping and multi-line spinner spam.
15
+ *
16
+ * @param str - The status string to truncate.
17
+ * @param maxLen - Optional explicit column limit. Defaults to terminal width minus padding margin.
18
+ * @returns The original string if it fits, or a safely truncated string with an ellipsis.
19
+ */
20
+ export function truncateForTerminal(str, maxLen) {
21
+ if (!str)
22
+ return str;
23
+ const cols = process.stdout.columns || 80;
24
+ // Default padding margin of 6 columns to account for spinner symbols (e.g. `◐ `) and borders
25
+ const limit = maxLen ?? Math.max(20, cols - 6);
26
+ const plain = stripAnsi(str);
27
+ if (plain.length <= limit) {
28
+ return str;
29
+ }
30
+ // Truncate plain text safely without overflowing terminal columns
31
+ return plain.slice(0, limit - 3) + '...';
32
+ }
@@ -65,5 +65,5 @@
65
65
  ]
66
66
  }
67
67
  },
68
- "version": "2.8.2"
68
+ "version": "2.8.3"
69
69
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "minovative-mind-cli",
3
3
  "description": "An automated AI agent powered by Vertex AI that helps you write software",
4
- "version": "2.8.2",
4
+ "version": "2.8.3",
5
5
  "author": "Daniel Ward",
6
6
  "bin": {
7
7
  "minovative-mind-cli": "bin/run.js"
@@ -10,7 +10,6 @@
10
10
  "dependencies": {
11
11
  "@clack/prompts": "^0.11.0",
12
12
  "@google/generative-ai": "^0.21.0",
13
- "@oclif/core": "^4",
14
13
  "@oclif/plugin-help": "^6",
15
14
  "dotenv": "^16",
16
15
  "fastest-levenshtein": "^1.0.16",
@@ -23,6 +22,7 @@
23
22
  },
24
23
  "devDependencies": {
25
24
  "@eslint/compat": "^1",
25
+ "@oclif/core": "^4.13.3",
26
26
  "@oclif/prettier-config": "^0.2.1",
27
27
  "@oclif/test": "^4",
28
28
  "@types/chai": "^4",
@@ -35,7 +35,7 @@
35
35
  "eslint-config-oclif": "^6",
36
36
  "eslint-config-prettier": "^10",
37
37
  "mocha": "^11",
38
- "oclif": "^4",
38
+ "oclif": "^4.23.30",
39
39
  "shx": "^0.3.3",
40
40
  "ts-node": "^10",
41
41
  "typescript": "^5"