kairn-cli 2.4.0 → 2.4.1
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 +112 -46
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3881,7 +3881,7 @@ import ora2 from "ora";
|
|
|
3881
3881
|
import fs25 from "fs/promises";
|
|
3882
3882
|
import path25 from "path";
|
|
3883
3883
|
import { parse as yamlParse2 } from "yaml";
|
|
3884
|
-
import { confirm as confirm4, select as select4 } from "@inquirer/prompts";
|
|
3884
|
+
import { confirm as confirm4, input as input4, select as select4 } from "@inquirer/prompts";
|
|
3885
3885
|
|
|
3886
3886
|
// src/evolve/init.ts
|
|
3887
3887
|
import fs15 from "fs/promises";
|
|
@@ -6167,7 +6167,7 @@ evolveCommand.command("baseline").description("Snapshot current .claude/ directo
|
|
|
6167
6167
|
process.exit(1);
|
|
6168
6168
|
}
|
|
6169
6169
|
});
|
|
6170
|
-
evolveCommand.command("run").description("Run tasks against the current harness").option("--task <id>", "Run a specific task by ID").option("--iterations <n>", "Number of evolution iterations", "5").option("--runs <n>", "Run each task N times for variance measurement", "1").option("--parallel <n>", "Run up to N tasks concurrently", "1").option("--max-mutations <n>", "Max mutations per iteration", "3").option("--prune-threshold <n>", "Skip tasks scoring above this on middle iterations", "95").option("--max-task-drop <n>", "Roll back if any task drops more than N points", "20").option("--principal", "Run Principal Proposer as final iteration").option("--eval-sample <n>", "Sample N tasks per middle iteration (0 = all)", "0").action(async (options) => {
|
|
6170
|
+
evolveCommand.command("run").description("Run tasks against the current harness").option("--task <id>", "Run a specific task by ID").option("--iterations <n>", "Number of evolution iterations", "5").option("--runs <n>", "Run each task N times for variance measurement", "1").option("--parallel <n>", "Run up to N tasks concurrently", "1").option("--max-mutations <n>", "Max mutations per iteration", "3").option("--prune-threshold <n>", "Skip tasks scoring above this on middle iterations", "95").option("--max-task-drop <n>", "Roll back if any task drops more than N points", "20").option("--principal", "Run Principal Proposer as final iteration").option("--eval-sample <n>", "Sample N tasks per middle iteration (0 = all)", "0").option("-i, --interactive", "Configure evolution settings interactively").action(async (options) => {
|
|
6171
6171
|
try {
|
|
6172
6172
|
const projectRoot = process.cwd();
|
|
6173
6173
|
const workspace = path25.join(projectRoot, ".kairn-evolve");
|
|
@@ -6230,51 +6230,117 @@ evolveCommand.command("run").description("Run tasks against the current harness"
|
|
|
6230
6230
|
process.exit(1);
|
|
6231
6231
|
}
|
|
6232
6232
|
const evolveConfig = await loadEvolveConfigFromWorkspace(workspace);
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6233
|
+
if (options.interactive) {
|
|
6234
|
+
console.log(chalk14.dim(" Configure evolution settings:\n"));
|
|
6235
|
+
const preset = await select4({
|
|
6236
|
+
message: "Evolution preset",
|
|
6237
|
+
choices: [
|
|
6238
|
+
{ name: "Quick (3 iterations, 1 run, no extras)", value: "quick" },
|
|
6239
|
+
{ name: "Standard (5 iterations, 1 run, parallel)", value: "standard" },
|
|
6240
|
+
{ name: "Rigorous (5 iterations, 3 runs, parallel, principal)", value: "rigorous" },
|
|
6241
|
+
{ name: "Custom (configure each setting)", value: "custom" }
|
|
6242
|
+
]
|
|
6243
|
+
});
|
|
6244
|
+
if (preset === "quick") {
|
|
6245
|
+
evolveConfig.maxIterations = 3;
|
|
6246
|
+
evolveConfig.runsPerTask = 1;
|
|
6247
|
+
evolveConfig.parallelTasks = 3;
|
|
6248
|
+
} else if (preset === "standard") {
|
|
6249
|
+
evolveConfig.maxIterations = 5;
|
|
6250
|
+
evolveConfig.runsPerTask = 1;
|
|
6251
|
+
evolveConfig.parallelTasks = 5;
|
|
6252
|
+
} else if (preset === "rigorous") {
|
|
6253
|
+
evolveConfig.maxIterations = 5;
|
|
6254
|
+
evolveConfig.runsPerTask = 3;
|
|
6255
|
+
evolveConfig.parallelTasks = 5;
|
|
6256
|
+
evolveConfig.usePrincipal = true;
|
|
6257
|
+
} else {
|
|
6258
|
+
evolveConfig.maxIterations = parseInt(
|
|
6259
|
+
await input4({ message: "Iterations", default: "5" }),
|
|
6260
|
+
10
|
|
6261
|
+
) || 5;
|
|
6262
|
+
evolveConfig.runsPerTask = parseInt(
|
|
6263
|
+
await input4({ message: "Runs per task (variance)", default: "1" }),
|
|
6264
|
+
10
|
|
6265
|
+
) || 1;
|
|
6266
|
+
evolveConfig.parallelTasks = parseInt(
|
|
6267
|
+
await input4({ message: "Parallel tasks", default: "3" }),
|
|
6268
|
+
10
|
|
6269
|
+
) || 3;
|
|
6270
|
+
evolveConfig.maxMutationsPerIteration = parseInt(
|
|
6271
|
+
await input4({ message: "Max mutations per iteration", default: "3" }),
|
|
6272
|
+
10
|
|
6273
|
+
) || 3;
|
|
6274
|
+
evolveConfig.pruneThreshold = parseInt(
|
|
6275
|
+
await input4({ message: "Prune threshold (%)", default: "95" }),
|
|
6276
|
+
10
|
|
6277
|
+
) || 95;
|
|
6278
|
+
evolveConfig.maxTaskDrop = parseInt(
|
|
6279
|
+
await input4({ message: "Max task drop (rollback guard)", default: "20" }),
|
|
6280
|
+
10
|
|
6281
|
+
) || 20;
|
|
6282
|
+
evolveConfig.usePrincipal = await confirm4({
|
|
6283
|
+
message: "Run Principal Proposer at end?",
|
|
6284
|
+
default: false
|
|
6285
|
+
});
|
|
6286
|
+
evolveConfig.evalSampleSize = parseInt(
|
|
6287
|
+
await input4({ message: "Eval sample size (0 = all)", default: "0" }),
|
|
6288
|
+
10
|
|
6289
|
+
) || 0;
|
|
6290
|
+
}
|
|
6291
|
+
console.log("");
|
|
6292
|
+
console.log(chalk14.dim(` Iterations: ${evolveConfig.maxIterations}, Runs: ${evolveConfig.runsPerTask}, Parallel: ${evolveConfig.parallelTasks}`));
|
|
6293
|
+
console.log(chalk14.dim(` Mutations: ${evolveConfig.maxMutationsPerIteration}, Prune: ${evolveConfig.pruneThreshold}%, Guard: ${evolveConfig.maxTaskDrop}pt`));
|
|
6294
|
+
if (evolveConfig.usePrincipal) console.log(chalk14.dim(" Principal Proposer: enabled"));
|
|
6295
|
+
if (evolveConfig.evalSampleSize > 0) console.log(chalk14.dim(` Eval sampling: ${evolveConfig.evalSampleSize} tasks/iter`));
|
|
6296
|
+
console.log("");
|
|
6297
|
+
} else {
|
|
6298
|
+
const iterations = parseInt(options.iterations ?? "5", 10);
|
|
6299
|
+
if (isNaN(iterations) || iterations < 1) {
|
|
6300
|
+
console.log(ui.error("--iterations must be a positive integer"));
|
|
6301
|
+
process.exit(1);
|
|
6302
|
+
}
|
|
6303
|
+
evolveConfig.maxIterations = iterations;
|
|
6304
|
+
const runs2 = parseInt(options.runs ?? "1", 10);
|
|
6305
|
+
if (isNaN(runs2) || runs2 < 1) {
|
|
6306
|
+
console.log(ui.error("--runs must be a positive integer"));
|
|
6307
|
+
process.exit(1);
|
|
6308
|
+
}
|
|
6309
|
+
evolveConfig.runsPerTask = runs2;
|
|
6310
|
+
const parallel = parseInt(options.parallel ?? "1", 10);
|
|
6311
|
+
if (isNaN(parallel) || parallel < 1) {
|
|
6312
|
+
console.log(ui.error("--parallel must be a positive integer"));
|
|
6313
|
+
process.exit(1);
|
|
6314
|
+
}
|
|
6315
|
+
evolveConfig.parallelTasks = parallel;
|
|
6316
|
+
const maxMutations = parseInt(options.maxMutations ?? "3", 10);
|
|
6317
|
+
if (isNaN(maxMutations) || maxMutations < 1) {
|
|
6318
|
+
console.log(ui.error("--max-mutations must be a positive integer"));
|
|
6319
|
+
process.exit(1);
|
|
6320
|
+
}
|
|
6321
|
+
evolveConfig.maxMutationsPerIteration = maxMutations;
|
|
6322
|
+
const pruneThreshold = parseInt(options.pruneThreshold ?? "95", 10);
|
|
6323
|
+
if (isNaN(pruneThreshold) || pruneThreshold < 0 || pruneThreshold > 100) {
|
|
6324
|
+
console.log(ui.error("--prune-threshold must be 0-100"));
|
|
6325
|
+
process.exit(1);
|
|
6326
|
+
}
|
|
6327
|
+
evolveConfig.pruneThreshold = pruneThreshold;
|
|
6328
|
+
const maxTaskDrop = parseInt(options.maxTaskDrop ?? "20", 10);
|
|
6329
|
+
if (isNaN(maxTaskDrop) || maxTaskDrop < 1) {
|
|
6330
|
+
console.log(ui.error("--max-task-drop must be a positive integer"));
|
|
6331
|
+
process.exit(1);
|
|
6332
|
+
}
|
|
6333
|
+
evolveConfig.maxTaskDrop = maxTaskDrop;
|
|
6334
|
+
if (options.principal) {
|
|
6335
|
+
evolveConfig.usePrincipal = true;
|
|
6336
|
+
}
|
|
6337
|
+
const evalSample = parseInt(options.evalSample ?? "0", 10);
|
|
6338
|
+
if (isNaN(evalSample) || evalSample < 0) {
|
|
6339
|
+
console.log(ui.error("--eval-sample must be a non-negative integer"));
|
|
6340
|
+
process.exit(1);
|
|
6341
|
+
}
|
|
6342
|
+
evolveConfig.evalSampleSize = evalSample;
|
|
6276
6343
|
}
|
|
6277
|
-
evolveConfig.evalSampleSize = evalSample;
|
|
6278
6344
|
try {
|
|
6279
6345
|
await fs25.access(path25.join(workspace, "iterations", "0", "harness"));
|
|
6280
6346
|
} catch {
|