@heyamiko/amiko-cli 0.4.8 → 0.4.10

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
@@ -61,12 +61,14 @@ function parseArgs(argv) {
61
61
  return overrides;
62
62
  }
63
63
  async function main() {
64
- // Ensure safe terminal dimensions for non-TTY environments (e.g. openclaw exec)
65
- // Prevents Ink RangeError from negative layout calculations
66
- if (!process.stdout.columns)
67
- process.stdout.columns = 80;
68
- if (!process.stdout.rows)
69
- process.stdout.rows = 24;
64
+ // Ink's render-border.js calls box.top.repeat(contentWidth) where
65
+ // contentWidth = width - 2. When yoga computes a zero-width node (common
66
+ // in non-TTY / piped environments), contentWidth goes negative and
67
+ // String.repeat() throws. Patch String.repeat to clamp to 0.
68
+ const origRepeat = String.prototype.repeat;
69
+ String.prototype.repeat = function (count) {
70
+ return origRepeat.call(this, Math.max(0, Math.floor(count)));
71
+ };
70
72
  const config = loadConfig();
71
73
  const overrides = parseArgs(process.argv.slice(2));
72
74
  const finalConfig = { ...config, ...overrides };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heyamiko/amiko-cli",
3
- "version": "0.4.8",
3
+ "version": "0.4.10",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "amiko": "dist/cli.js"
package/src/cli.tsx CHANGED
@@ -77,10 +77,14 @@ function parseArgs(argv: string[]): ArgOverrides {
77
77
  }
78
78
 
79
79
  async function main() {
80
- // Ensure safe terminal dimensions for non-TTY environments (e.g. openclaw exec)
81
- // Prevents Ink RangeError from negative layout calculations
82
- if (!process.stdout.columns) process.stdout.columns = 80;
83
- if (!process.stdout.rows) process.stdout.rows = 24;
80
+ // Ink's render-border.js calls box.top.repeat(contentWidth) where
81
+ // contentWidth = width - 2. When yoga computes a zero-width node (common
82
+ // in non-TTY / piped environments), contentWidth goes negative and
83
+ // String.repeat() throws. Patch String.repeat to clamp to 0.
84
+ const origRepeat = String.prototype.repeat;
85
+ String.prototype.repeat = function (count: number) {
86
+ return origRepeat.call(this, Math.max(0, Math.floor(count)));
87
+ };
84
88
 
85
89
  const config = loadConfig();
86
90
  const overrides = parseArgs(process.argv.slice(2));