@heyamiko/amiko-cli 0.4.9 → 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 +9 -32
- package/package.json +1 -1
- package/src/cli.tsx +9 -32
package/dist/cli.js
CHANGED
|
@@ -61,39 +61,16 @@ function parseArgs(argv) {
|
|
|
61
61
|
return overrides;
|
|
62
62
|
}
|
|
63
63
|
async function main() {
|
|
64
|
-
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
console.log(" --workspace, -w <path> Workspace directory");
|
|
73
|
-
console.log(" --model <provider/model> Model override");
|
|
74
|
-
console.log(" --session <id> Resume session");
|
|
75
|
-
console.log(" --thinking <level> off|minimal|low|medium|high|xhigh");
|
|
76
|
-
process.exit(0);
|
|
77
|
-
}
|
|
78
|
-
if (flag === "-v" || flag === "--version") {
|
|
79
|
-
const { readFileSync } = await import("node:fs");
|
|
80
|
-
const { fileURLToPath } = await import("node:url");
|
|
81
|
-
const { dirname, join } = await import("node:path");
|
|
82
|
-
try {
|
|
83
|
-
const pkgPath = join(dirname(fileURLToPath(import.meta.url)), "..", "package.json");
|
|
84
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
85
|
-
console.log(pkg.version);
|
|
86
|
-
}
|
|
87
|
-
catch {
|
|
88
|
-
console.log("unknown");
|
|
89
|
-
}
|
|
90
|
-
process.exit(0);
|
|
91
|
-
}
|
|
92
|
-
console.error("amiko-cli requires an interactive terminal (TTY). Cannot render UI in piped/non-TTY mode.");
|
|
93
|
-
process.exit(1);
|
|
94
|
-
}
|
|
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
|
+
};
|
|
95
72
|
const config = loadConfig();
|
|
96
|
-
const overrides = parseArgs(argv);
|
|
73
|
+
const overrides = parseArgs(process.argv.slice(2));
|
|
97
74
|
const finalConfig = { ...config, ...overrides };
|
|
98
75
|
const workspace = await initWorkspace(finalConfig.workspacePath);
|
|
99
76
|
const persisted = await loadConfigFile(workspace.root);
|
package/package.json
CHANGED
package/src/cli.tsx
CHANGED
|
@@ -77,40 +77,17 @@ function parseArgs(argv: string[]): ArgOverrides {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
async function main() {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
//
|
|
83
|
-
//
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
console.log("Usage: amiko [options]");
|
|
89
|
-
console.log(" --workspace, -w <path> Workspace directory");
|
|
90
|
-
console.log(" --model <provider/model> Model override");
|
|
91
|
-
console.log(" --session <id> Resume session");
|
|
92
|
-
console.log(" --thinking <level> off|minimal|low|medium|high|xhigh");
|
|
93
|
-
process.exit(0);
|
|
94
|
-
}
|
|
95
|
-
if (flag === "-v" || flag === "--version") {
|
|
96
|
-
const { readFileSync } = await import("node:fs");
|
|
97
|
-
const { fileURLToPath } = await import("node:url");
|
|
98
|
-
const { dirname, join } = await import("node:path");
|
|
99
|
-
try {
|
|
100
|
-
const pkgPath = join(dirname(fileURLToPath(import.meta.url)), "..", "package.json");
|
|
101
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
102
|
-
console.log(pkg.version);
|
|
103
|
-
} catch {
|
|
104
|
-
console.log("unknown");
|
|
105
|
-
}
|
|
106
|
-
process.exit(0);
|
|
107
|
-
}
|
|
108
|
-
console.error("amiko-cli requires an interactive terminal (TTY). Cannot render UI in piped/non-TTY mode.");
|
|
109
|
-
process.exit(1);
|
|
110
|
-
}
|
|
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
|
+
};
|
|
111
88
|
|
|
112
89
|
const config = loadConfig();
|
|
113
|
-
const overrides = parseArgs(argv);
|
|
90
|
+
const overrides = parseArgs(process.argv.slice(2));
|
|
114
91
|
const finalConfig = { ...config, ...overrides };
|
|
115
92
|
const workspace = await initWorkspace(finalConfig.workspacePath);
|
|
116
93
|
const persisted = await loadConfigFile(workspace.root);
|