@tritard/waterbrother 0.9.6 → 0.9.7
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/package.json +1 -1
- package/src/cli.js +19 -9
- package/src/experiment.js +3 -3
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -6217,15 +6217,25 @@ async function promptLoop(agent, session, context) {
|
|
|
6217
6217
|
continue;
|
|
6218
6218
|
}
|
|
6219
6219
|
|
|
6220
|
-
// Extract flags
|
|
6221
|
-
const metricMatch = rawArgs.match(/--metric\s+"([^"]+)"|--metric\s+(\S+)/);
|
|
6220
|
+
// Extract flags — parse --metric value (everything until next -- flag or end)
|
|
6222
6221
|
const attemptsMatch = rawArgs.match(/--attempts\s+(\d+)/);
|
|
6223
6222
|
const timeMatch = rawArgs.match(/--time\s+(\d+)/);
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6223
|
+
// Remove --attempts and --time first so --metric can grab the rest
|
|
6224
|
+
let cleaned = rawArgs.replace(/--attempts\s+\d+/g, "").replace(/--time\s+\d+/g, "");
|
|
6225
|
+
let metricCmd = "";
|
|
6226
|
+
const metricIdx = cleaned.indexOf("--metric");
|
|
6227
|
+
if (metricIdx !== -1) {
|
|
6228
|
+
const afterMetric = cleaned.slice(metricIdx + 8).trim();
|
|
6229
|
+
// If quoted, take the quoted content; otherwise take everything until end
|
|
6230
|
+
if (afterMetric.startsWith('"')) {
|
|
6231
|
+
const endQuote = afterMetric.indexOf('"', 1);
|
|
6232
|
+
metricCmd = endQuote > 0 ? afterMetric.slice(1, endQuote) : afterMetric.slice(1);
|
|
6233
|
+
} else {
|
|
6234
|
+
metricCmd = afterMetric;
|
|
6235
|
+
}
|
|
6236
|
+
cleaned = cleaned.slice(0, metricIdx).trim();
|
|
6237
|
+
}
|
|
6238
|
+
const goalArg = cleaned.trim();
|
|
6229
6239
|
|
|
6230
6240
|
if (!goalArg) {
|
|
6231
6241
|
console.log("experiment needs a goal");
|
|
@@ -6234,8 +6244,8 @@ async function promptLoop(agent, session, context) {
|
|
|
6234
6244
|
|
|
6235
6245
|
const charter = parseCharterFromGoal(goalArg);
|
|
6236
6246
|
|
|
6237
|
-
if (
|
|
6238
|
-
charter.metric.command =
|
|
6247
|
+
if (metricCmd) {
|
|
6248
|
+
charter.metric.command = metricCmd.trim();
|
|
6239
6249
|
}
|
|
6240
6250
|
if (attemptsMatch) {
|
|
6241
6251
|
charter.budget.maxAttempts = parseInt(attemptsMatch[1], 10);
|
package/src/experiment.js
CHANGED
|
@@ -63,12 +63,12 @@ export async function runMetric({ command, extract, cwd }) {
|
|
|
63
63
|
let stdout, stderr;
|
|
64
64
|
|
|
65
65
|
if (isWin) {
|
|
66
|
-
|
|
66
|
+
// Use PowerShell on Windows for access to proper commands
|
|
67
|
+
const result = await execFileAsync("powershell.exe", ["-NoProfile", "-Command", command], execOpts);
|
|
67
68
|
stdout = String(result.stdout || "");
|
|
68
69
|
stderr = String(result.stderr || "");
|
|
69
70
|
} else {
|
|
70
|
-
const
|
|
71
|
-
const result = await execFileAsync(parts[0], parts.slice(1), execOpts);
|
|
71
|
+
const result = await execFileAsync("/bin/sh", ["-c", command], execOpts);
|
|
72
72
|
stdout = String(result.stdout || "");
|
|
73
73
|
stderr = String(result.stderr || "");
|
|
74
74
|
}
|