@devtune/agentpicks 0.4.5 → 0.4.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.
Files changed (3) hide show
  1. package/README.md +13 -6
  2. package/dist/cli.js +649 -275
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1504,7 +1504,7 @@ var require_stringify = __commonJS({
1504
1504
  props.push(doc.directives.tagString(tag));
1505
1505
  return props.join(" ");
1506
1506
  }
1507
- function stringify3(item, ctx, onComment, onChompKeep) {
1507
+ function stringify4(item, ctx, onComment, onChompKeep) {
1508
1508
  if (identity.isPair(item))
1509
1509
  return item.toString(ctx, onComment, onChompKeep);
1510
1510
  if (identity.isAlias(item)) {
@@ -1533,7 +1533,7 @@ var require_stringify = __commonJS({
1533
1533
  ${ctx.indent}${str2}`;
1534
1534
  }
1535
1535
  exports2.createStringifyContext = createStringifyContext;
1536
- exports2.stringify = stringify3;
1536
+ exports2.stringify = stringify4;
1537
1537
  }
1538
1538
  });
1539
1539
 
@@ -1543,7 +1543,7 @@ var require_stringifyPair = __commonJS({
1543
1543
  "use strict";
1544
1544
  var identity = require_identity();
1545
1545
  var Scalar = require_Scalar();
1546
- var stringify3 = require_stringify();
1546
+ var stringify4 = require_stringify();
1547
1547
  var stringifyComment = require_stringifyComment();
1548
1548
  function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
1549
1549
  const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
@@ -1565,7 +1565,7 @@ var require_stringifyPair = __commonJS({
1565
1565
  });
1566
1566
  let keyCommentDone = false;
1567
1567
  let chompKeep = false;
1568
- let str2 = stringify3.stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
1568
+ let str2 = stringify4.stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
1569
1569
  if (!explicitKey && !ctx.inFlow && str2.length > 1024) {
1570
1570
  if (simpleKeys)
1571
1571
  throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
@@ -1617,7 +1617,7 @@ ${indent}:`;
1617
1617
  ctx.indent = ctx.indent.substring(2);
1618
1618
  }
1619
1619
  let valueCommentDone = false;
1620
- const valueStr = stringify3.stringify(value, ctx, () => valueCommentDone = true, () => chompKeep = true);
1620
+ const valueStr = stringify4.stringify(value, ctx, () => valueCommentDone = true, () => chompKeep = true);
1621
1621
  let ws = " ";
1622
1622
  if (keyComment || vsb || vcb) {
1623
1623
  ws = vsb ? "\n" : "";
@@ -1758,7 +1758,7 @@ var require_addPairToJSMap = __commonJS({
1758
1758
  "use strict";
1759
1759
  var log = require_log();
1760
1760
  var merge2 = require_merge();
1761
- var stringify3 = require_stringify();
1761
+ var stringify4 = require_stringify();
1762
1762
  var identity = require_identity();
1763
1763
  var toJS = require_toJS();
1764
1764
  function addPairToJSMap(ctx, map2, { key, value }) {
@@ -1794,7 +1794,7 @@ var require_addPairToJSMap = __commonJS({
1794
1794
  if (typeof jsKey !== "object")
1795
1795
  return String(jsKey);
1796
1796
  if (identity.isNode(key) && ctx?.doc) {
1797
- const strCtx = stringify3.createStringifyContext(ctx.doc, {});
1797
+ const strCtx = stringify4.createStringifyContext(ctx.doc, {});
1798
1798
  strCtx.anchors = /* @__PURE__ */ new Set();
1799
1799
  for (const node2 of ctx.anchors.keys())
1800
1800
  strCtx.anchors.add(node2.anchor);
@@ -1861,12 +1861,12 @@ var require_stringifyCollection = __commonJS({
1861
1861
  "../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/stringify/stringifyCollection.js"(exports2) {
1862
1862
  "use strict";
1863
1863
  var identity = require_identity();
1864
- var stringify3 = require_stringify();
1864
+ var stringify4 = require_stringify();
1865
1865
  var stringifyComment = require_stringifyComment();
1866
1866
  function stringifyCollection(collection, ctx, options) {
1867
1867
  const flow = ctx.inFlow ?? collection.flow;
1868
- const stringify4 = flow ? stringifyFlowCollection : stringifyBlockCollection;
1869
- return stringify4(collection, ctx, options);
1868
+ const stringify5 = flow ? stringifyFlowCollection : stringifyBlockCollection;
1869
+ return stringify5(collection, ctx, options);
1870
1870
  }
1871
1871
  function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {
1872
1872
  const { indent, options: { commentString } } = ctx;
@@ -1891,7 +1891,7 @@ var require_stringifyCollection = __commonJS({
1891
1891
  }
1892
1892
  }
1893
1893
  chompKeep = false;
1894
- let str3 = stringify3.stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
1894
+ let str3 = stringify4.stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
1895
1895
  if (comment2)
1896
1896
  str3 += stringifyComment.lineComment(str3, itemIndent, commentString(comment2));
1897
1897
  if (chompKeep && comment2)
@@ -1958,7 +1958,7 @@ ${indent}${line2}` : "\n";
1958
1958
  }
1959
1959
  if (comment)
1960
1960
  reqNewline = true;
1961
- let str2 = stringify3.stringify(item, itemCtx, () => comment = null);
1961
+ let str2 = stringify4.stringify(item, itemCtx, () => comment = null);
1962
1962
  reqNewline || (reqNewline = lines.length > linesAtValue || str2.includes("\n"));
1963
1963
  if (i < items.length - 1) {
1964
1964
  str2 += ",";
@@ -3319,7 +3319,7 @@ var require_stringifyDocument = __commonJS({
3319
3319
  "../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/stringify/stringifyDocument.js"(exports2) {
3320
3320
  "use strict";
3321
3321
  var identity = require_identity();
3322
- var stringify3 = require_stringify();
3322
+ var stringify4 = require_stringify();
3323
3323
  var stringifyComment = require_stringifyComment();
3324
3324
  function stringifyDocument(doc, options) {
3325
3325
  const lines = [];
@@ -3334,7 +3334,7 @@ var require_stringifyDocument = __commonJS({
3334
3334
  }
3335
3335
  if (hasDirectives)
3336
3336
  lines.push("---");
3337
- const ctx = stringify3.createStringifyContext(doc, options);
3337
+ const ctx = stringify4.createStringifyContext(doc, options);
3338
3338
  const { commentString } = ctx.options;
3339
3339
  if (doc.commentBefore) {
3340
3340
  if (lines.length !== 1)
@@ -3356,7 +3356,7 @@ var require_stringifyDocument = __commonJS({
3356
3356
  contentComment = doc.contents.comment;
3357
3357
  }
3358
3358
  const onChompKeep = contentComment ? void 0 : () => chompKeep = true;
3359
- let body = stringify3.stringify(doc.contents, ctx, () => contentComment = null, onChompKeep);
3359
+ let body = stringify4.stringify(doc.contents, ctx, () => contentComment = null, onChompKeep);
3360
3360
  if (contentComment)
3361
3361
  body += stringifyComment.lineComment(body, "", commentString(contentComment));
3362
3362
  if ((body[0] === "|" || body[0] === ">") && lines[lines.length - 1] === "---") {
@@ -3364,7 +3364,7 @@ var require_stringifyDocument = __commonJS({
3364
3364
  } else
3365
3365
  lines.push(body);
3366
3366
  } else {
3367
- lines.push(stringify3.stringify(doc.contents, ctx));
3367
+ lines.push(stringify4.stringify(doc.contents, ctx));
3368
3368
  }
3369
3369
  if (doc.directives?.docEnd) {
3370
3370
  if (doc.comment) {
@@ -5500,7 +5500,7 @@ var require_cst_scalar = __commonJS({
5500
5500
  var require_cst_stringify = __commonJS({
5501
5501
  "../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/parse/cst-stringify.js"(exports2) {
5502
5502
  "use strict";
5503
- var stringify3 = (cst) => "type" in cst ? stringifyToken(cst) : stringifyItem(cst);
5503
+ var stringify4 = (cst) => "type" in cst ? stringifyToken(cst) : stringifyItem(cst);
5504
5504
  function stringifyToken(token) {
5505
5505
  switch (token.type) {
5506
5506
  case "block-scalar": {
@@ -5553,7 +5553,7 @@ var require_cst_stringify = __commonJS({
5553
5553
  res += stringifyToken(value);
5554
5554
  return res;
5555
5555
  }
5556
- exports2.stringify = stringify3;
5556
+ exports2.stringify = stringify4;
5557
5557
  }
5558
5558
  });
5559
5559
 
@@ -7283,7 +7283,7 @@ var require_public_api = __commonJS({
7283
7283
  }
7284
7284
  return doc.toJS(Object.assign({ reviver: _reviver }, options));
7285
7285
  }
7286
- function stringify3(value, replacer, options) {
7286
+ function stringify4(value, replacer, options) {
7287
7287
  let _replacer = null;
7288
7288
  if (typeof replacer === "function" || Array.isArray(replacer)) {
7289
7289
  _replacer = replacer;
@@ -7308,7 +7308,7 @@ var require_public_api = __commonJS({
7308
7308
  exports2.parse = parse6;
7309
7309
  exports2.parseAllDocuments = parseAllDocuments;
7310
7310
  exports2.parseDocument = parseDocument3;
7311
- exports2.stringify = stringify3;
7311
+ exports2.stringify = stringify4;
7312
7312
  }
7313
7313
  });
7314
7314
 
@@ -7365,17 +7365,17 @@ var require_dist = __commonJS({
7365
7365
  });
7366
7366
 
7367
7367
  // src/cli.ts
7368
- var import_node_path20 = require("node:path");
7368
+ var import_node_path21 = require("node:path");
7369
7369
 
7370
7370
  // src/cli/main.ts
7371
7371
  var import_node_crypto10 = require("node:crypto");
7372
- var import_node_path19 = require("node:path");
7372
+ var import_node_path20 = require("node:path");
7373
7373
  var import_promises5 = require("node:readline/promises");
7374
7374
 
7375
7375
  // package.json
7376
7376
  var package_default = {
7377
7377
  name: "@devtune/agentpicks",
7378
- version: "0.4.5",
7378
+ version: "0.4.7",
7379
7379
  description: "The open Agent Picks runner: the agentpicks CLI, which tests the coding agents installed on your machine in fresh Docker containers, and the sandbox code DevTune runs its managed tests on",
7380
7380
  license: "Apache-2.0",
7381
7381
  engines: {
@@ -8764,6 +8764,11 @@ function environmentRunsIn(slug2, categorySlug) {
8764
8764
  if (categorySlug.startsWith("job-")) return false;
8765
8765
  return !environment.categories || environment.categories.includes(categorySlug);
8766
8766
  }
8767
+ function setupEnvironments(runsIn) {
8768
+ return ENVIRONMENTS.filter(
8769
+ (env) => !isRetiredEnvironment(env.slug) && environmentRunsIn(env.slug, runsIn)
8770
+ );
8771
+ }
8767
8772
 
8768
8773
  // src/catalogue/prompt-intents.ts
8769
8774
  var PROMPT_INTENTS = [
@@ -28676,11 +28681,10 @@ function resolveSetup(name, file2, held) {
28676
28681
  }
28677
28682
  const row = held?.find((each) => each.tool_key === ref);
28678
28683
  if (file2.from) {
28679
- const unchecked = !held && file2.id && CATALOGUE_TOOL_KEYS.has(ref);
28680
- if (!catalogueKeys.includes(ref) && !row && !unchecked)
28684
+ if (!catalogueKeys.includes(ref) && !row && !CATALOGUE_TOOL_KEYS.has(ref))
28681
28685
  problems.push({
28682
28686
  field,
28683
- message: `${file2.from} has no tool ${ref}. Use one of ${catalogueKeys.join(", ")}, or add ${ref} to a category copy in the DevTune app, then run agentpicks pull.`
28687
+ message: `${file2.from} has no tool ${ref}. Give the full entry: key, name and signals, and optionally domain; or, for a tool DevTune's catalogue has added since, update agentpicks.`
28684
28688
  });
28685
28689
  } else if (!CATALOGUE_TOOL_KEYS.has(ref) && row?.signals !== null)
28686
28690
  problems.push({
@@ -28848,9 +28852,7 @@ function editedReason(category, file2, entries2, added) {
28848
28852
  return null;
28849
28853
  }
28850
28854
  function stackChoices(runsIn) {
28851
- return ENVIRONMENTS.filter(
28852
- (env) => !isRetiredEnvironment(env.slug) && environmentRunsIn(env.slug, runsIn)
28853
- ).map((env) => env.slug).join(", ");
28855
+ return setupEnvironments(runsIn).map((env) => env.slug).join(", ");
28854
28856
  }
28855
28857
  var escapeEre = (text3) => text3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
28856
28858
  function watchedPackage(name) {
@@ -28873,10 +28875,10 @@ function mergeEarlyStop(base, entries2, listedKeys) {
28873
28875
  const configNames = unique(
28874
28876
  stopping.flatMap((tool) => tool.signals.configNames ?? [])
28875
28877
  ).map(escapeEre);
28876
- const join16 = (inherited, added) => [inherited, ...added].filter(Boolean).join("|") || NEVER_PATTERN;
28878
+ const join17 = (inherited, added) => [inherited, ...added].filter(Boolean).join("|") || NEVER_PATTERN;
28877
28879
  return {
28878
- installPattern: join16(base?.installPattern, packages),
28879
- codePattern: join16(base?.codePattern, configNames),
28880
+ installPattern: join17(base?.installPattern, packages),
28881
+ codePattern: join17(base?.codePattern, configNames),
28880
28882
  ...base?.pathPattern ? { pathPattern: base.pathPattern } : {}
28881
28883
  };
28882
28884
  }
@@ -78281,10 +78283,10 @@ function readRunOptions(argv) {
78281
78283
  })
78282
78284
  );
78283
78285
  }
78284
- function categoryArgs(values, hint = "") {
78286
+ function categoryArgs(values, hint2 = "") {
78285
78287
  if (!values.category)
78286
78288
  throw new UnknownCategoryError(
78287
- `Choose a category with --category: ${categoryList()}.${hint}`
78289
+ `Choose a category with --category: ${categoryList()}.${hint2}`
78288
78290
  );
78289
78291
  if (values.stack !== void 0 && values.repo !== void 0)
78290
78292
  throw new UsageError(
@@ -78514,6 +78516,73 @@ function stackList(categorySlug) {
78514
78516
  ).map((env) => env.slug).join(", ");
78515
78517
  }
78516
78518
 
78519
+ // src/cli/catalogue-command.ts
78520
+ var import_node_util2 = require("node:util");
78521
+ function catalogueCommand(argv, ctx) {
78522
+ const { json: json3, slug: slug2 } = parseCatalogueArgs(argv);
78523
+ const pairs = (items) => items.map(({ slug: slug3, name }) => ({ slug: slug3, name }));
78524
+ if (slug2 === null) {
78525
+ const categories = pairs(CATEGORY_REQUESTS);
78526
+ const stacks2 = pairs(setupEnvironments("job-"));
78527
+ if (json3) ctx.out(JSON.stringify({ categories, stacks: stacks2 }, null, 2));
78528
+ else
78529
+ for (const line2 of [
78530
+ "Categories:",
78531
+ ...columns(categories),
78532
+ "",
78533
+ "Stacks a job line can run in:",
78534
+ ...columns(stacks2)
78535
+ ])
78536
+ ctx.out(line2);
78537
+ return 0;
78538
+ }
78539
+ const found = findCategoryRequests(slug2);
78540
+ if (!found)
78541
+ throw new UsageError(
78542
+ `There is no category ${slug2}. List them with: agentpicks catalogue`
78543
+ );
78544
+ const category = { slug: found.slug, name: found.name };
78545
+ const tools = CATEGORY_TOOLS[found.slug] ?? [];
78546
+ const stacks = pairs(setupEnvironments(found.slug));
78547
+ if (json3) ctx.out(JSON.stringify({ category, tools, stacks }, null, 2));
78548
+ else
78549
+ for (const line2 of [
78550
+ ...columns([category]),
78551
+ "",
78552
+ "Tools:",
78553
+ ...tools.map((key) => ` ${key}`),
78554
+ "",
78555
+ "Stacks:",
78556
+ ...columns(stacks)
78557
+ ])
78558
+ ctx.out(line2);
78559
+ return 0;
78560
+ }
78561
+ function columns(items) {
78562
+ const width = Math.max(...items.map((item) => item.slug.length));
78563
+ return items.map((item) => ` ${item.slug.padEnd(width)} ${item.name}`);
78564
+ }
78565
+ function parseCatalogueArgs(argv) {
78566
+ let parsed2;
78567
+ try {
78568
+ parsed2 = (0, import_node_util2.parseArgs)({
78569
+ args: argv,
78570
+ strict: true,
78571
+ allowPositionals: true,
78572
+ options: { json: { type: "boolean", default: false } }
78573
+ });
78574
+ } catch (error62) {
78575
+ throw new UsageError(
78576
+ error62 instanceof Error ? error62.message : String(error62)
78577
+ );
78578
+ }
78579
+ if (parsed2.positionals.length > 1)
78580
+ throw new UsageError(
78581
+ "Name one category, or none to list them: agentpicks catalogue [<category>] [--json]"
78582
+ );
78583
+ return { json: parsed2.values.json, slug: parsed2.positionals[0] ?? null };
78584
+ }
78585
+
78517
78586
  // src/setup/link.ts
78518
78587
  var import_yaml2 = __toESM(require_dist());
78519
78588
  function syncState(file2, setup) {
@@ -80106,11 +80175,27 @@ function pushRequest(file2, current, list, shown3, repositoryStacks) {
80106
80175
  ...current ? { setup: current.id } : {}
80107
80176
  };
80108
80177
  if (from) {
80109
- for (const ref of tools)
80110
- if (typeof ref === "string" ? !CATEGORY_TOOLS[from.slug]?.includes(ref) && !current?.tools.some((row) => row.tool_key === ref) : !heldAsWritten(ref, current))
80178
+ const named = [
80179
+ ...file2.tools?.own !== void 0 ? [{ ref: file2.tools.own, field: "tools.own" }] : [],
80180
+ ...(file2.tools?.competitors ?? []).map((ref, index) => ({
80181
+ ref,
80182
+ field: `tools.competitors[${index}]`
80183
+ }))
80184
+ ];
80185
+ for (const { ref, field } of named)
80186
+ if (typeof ref !== "string" && CATALOGUE_TOOL_KEYS.has(ref.key) && !heldAsWritten(ref, current))
80111
80187
  throw new UsageError(
80112
- `${shown3}: ${key(ref)} isn't a tool of ${from.slug}. Add it to a category copy in the DevTune app, then run agentpicks pull.`
80188
+ `${shown3}: ${field}: ${ref.key} is a catalogue tool. Use the key alone (${ref.key}), so pull and push keep the same tool.`
80113
80189
  );
80190
+ }
80191
+ const writesCopy = from && tools.some(
80192
+ (ref) => typeof ref === "string" ? !CATEGORY_TOOLS[from.slug]?.includes(ref) && !current?.tools.some((row) => row.tool_key === ref) : !heldAsWritten(ref, current)
80193
+ );
80194
+ if (writesCopy && current?.kind === "category")
80195
+ throw new UsageError(
80196
+ `${shown3}: this file is linked to a public-category setup, which can't add tools through push. Create a category copy in the DevTune app, pull that copy, then add your tools to its file and push again.`
80197
+ );
80198
+ if (from && !writesCopy) {
80114
80199
  return {
80115
80200
  route: "setup",
80116
80201
  body: {
@@ -80122,11 +80207,12 @@ function pushRequest(file2, current, list, shown3, repositoryStacks) {
80122
80207
  }
80123
80208
  };
80124
80209
  }
80125
- if (file2.requests?.improve != null)
80210
+ if (!from && file2.requests?.improve != null)
80126
80211
  throw new UsageError(
80127
80212
  `${shown3}: requests.improve can't be saved on a job. Remove it, and change it in DevTune instead.`
80128
80213
  );
80129
- const recommend = file2.requests?.recommend;
80214
+ const copyRequests = from ? categoryJobRequests(file2, current, from, shown3) : null;
80215
+ const recommend = copyRequests?.recommend ?? file2.requests?.recommend;
80130
80216
  if (!recommend)
80131
80217
  throw new UsageError(
80132
80218
  `${shown3}: give requests.recommend. DevTune saves a job with its add and recommend requests.`
@@ -80139,18 +80225,23 @@ function pushRequest(file2, current, list, shown3, repositoryStacks) {
80139
80225
  return {
80140
80226
  route: "job",
80141
80227
  body: {
80142
- job: file2.job,
80143
- source_category_id: null,
80144
- requests: {
80228
+ job: from ? current?.name ?? from.name : file2.job,
80229
+ source_category_id: from ? categoryId(list, from.slug, shown3) : null,
80230
+ requests: copyRequests ?? {
80145
80231
  add: file2.requests?.add,
80146
80232
  recommend,
80147
80233
  hosted: file2.requests?.hosted ?? null
80148
80234
  },
80149
- building_blocks: current?.building_blocks ?? NO_BUILDING_BLOCKS,
80235
+ ...!from ? { building_blocks: current?.building_blocks ?? NO_BUILDING_BLOCKS } : {},
80150
80236
  tools: [
80151
80237
  ...tools.map((ref) => jobTool(ref, current)),
80152
- // A tool DevTune measures that is neither yours nor a competitor, which a file can't name.
80153
- ...(current?.tools ?? []).filter((row) => !listed.has(row.tool_key) && !held.has(row.tool_key)).map(heldJobTool)
80238
+ // A new copy inherits every category tool, including ones the file doesn't select.
80239
+ ...(from && !current ? CATEGORY_TOOLS[from.slug] ?? [] : []).filter((tool) => !listed.has(tool)).map((tool_key) => ({ tool_key })),
80240
+ // A tool DevTune measures that is neither yours nor a competitor, which a file can't name. A copy keeps every
80241
+ // tool it holds, as the setup route does; only a job drops a tool its file stops selecting.
80242
+ ...(current?.tools ?? []).filter(
80243
+ (row) => !listed.has(row.tool_key) && (from || !held.has(row.tool_key))
80244
+ ).map(heldJobTool)
80154
80245
  ],
80155
80246
  own_tool_key: file2.tools?.own === void 0 ? null : key(file2.tools.own),
80156
80247
  competitor_tool_keys: (file2.tools?.competitors ?? []).map(key),
@@ -80158,6 +80249,27 @@ function pushRequest(file2, current, list, shown3, repositoryStacks) {
80158
80249
  }
80159
80250
  };
80160
80251
  }
80252
+ function categoryJobRequests(file2, current, from, shown3) {
80253
+ const published = (intent) => from.prompts.find((prompt) => prompt.intent === intent)?.text ?? null;
80254
+ const effective = (intent) => file2.requests?.[intent] === void 0 ? published(intent) : file2.requests[intent];
80255
+ const improve = effective("improve");
80256
+ const heldImprove = current ? current.requests.improve ?? null : published("improve");
80257
+ if (improve !== heldImprove)
80258
+ throw new UsageError(
80259
+ `${shown3}: requests.improve can't be changed while push saves tools to a category copy. Keep the inherited or pulled requests.improve value, then push again.`
80260
+ );
80261
+ const add = effective("add");
80262
+ const recommend = effective("recommend");
80263
+ for (const [intent, text3] of [
80264
+ ["add", add],
80265
+ ["recommend", recommend]
80266
+ ])
80267
+ if (!text3)
80268
+ throw new UsageError(
80269
+ `${shown3}: requests.${intent} can't be left out while push saves tools to a category copy. Give its text, push the tools, then push the omission separately.`
80270
+ );
80271
+ return { add, recommend, hosted: effective("hosted") };
80272
+ }
80161
80273
  var OMITTED_REQUEST = "omitted";
80162
80274
  function setupRequests(file2, current, from) {
80163
80275
  const requests = {};
@@ -80314,7 +80426,7 @@ var messages = {
80314
80426
  }
80315
80427
  };
80316
80428
  function loginPage(state) {
80317
- const { heading, message, hint } = messages[state];
80429
+ const { heading, message, hint: hint2 } = messages[state];
80318
80430
  return `<!doctype html>
80319
80431
  <html lang="en">
80320
80432
  <head>
@@ -80328,7 +80440,7 @@ function loginPage(state) {
80328
80440
  <main>
80329
80441
  <h1>${heading}</h1>
80330
80442
  <p>${message}</p>
80331
- <p class="hint">${hint}</p>
80443
+ <p class="hint">${hint2}</p>
80332
80444
  </main>
80333
80445
  </body>
80334
80446
  </html>`;
@@ -81116,10 +81228,6 @@ async function linkUploads(plan, setup, content, shown3, ctx) {
81116
81228
  }
81117
81229
  } : plan;
81118
81230
  if (setup.id === null) {
81119
- if (setup.customReason && content && hasOwnTools(content))
81120
- throw new UsageError(
81121
- `${shown3} is a custom setup (${setup.customReason}), so its runs have no DevTune setup to upload under, and push can't save tools ${setup.from} doesn't have. Add them to a category copy in the DevTune app, run agentpicks pull, and run the pulled setup, or pass --no-upload to keep the bundles on this machine.`
81122
- );
81123
81231
  if (setup.customReason)
81124
81232
  throw new UsageError(
81125
81233
  `${shown3} is a custom setup (${setup.customReason}), so its runs have no DevTune setup to upload under. Run agentpicks push ${setup.name} to save it to DevTune first, or pass --no-upload to keep the bundles on this machine.`
@@ -81588,9 +81696,9 @@ function dockerBuild(args) {
81588
81696
 
81589
81697
  // src/cli/init.ts
81590
81698
  var import_node_fs8 = require("node:fs");
81591
- var import_node_path13 = require("node:path");
81592
- var import_node_util2 = require("node:util");
81593
- var import_yaml5 = __toESM(require_dist());
81699
+ var import_node_path14 = require("node:path");
81700
+ var import_node_util3 = require("node:util");
81701
+ var import_yaml6 = __toESM(require_dist());
81594
81702
 
81595
81703
  // src/cli/init-detect.ts
81596
81704
  var import_node_fs7 = require("node:fs");
@@ -81855,199 +81963,98 @@ function setupSignals(drafted) {
81855
81963
  return Object.keys(packages).length > 0 || signals.configNames ? parsed2.data : null;
81856
81964
  }
81857
81965
 
81858
- // src/cli/init.ts
81859
- async function initCommand(argv, ctx) {
81860
- const { yes, force } = parseInitArgs(argv);
81861
- if (!yes && !ctx.interactive)
81966
+ // src/cli/init-job-line.ts
81967
+ var import_node_path13 = require("node:path");
81968
+ var import_yaml5 = __toESM(require_dist());
81969
+
81970
+ // src/cli/init-wizard.ts
81971
+ function readGiven(question) {
81972
+ if (question.keys)
81973
+ refuseListNumbers(question.flag, question.given, question.keys);
81974
+ const read = question.read(question.given.trim(), true);
81975
+ if ("problem" in read)
81862
81976
  throw new UsageError(
81863
- "agentpicks init asks questions, and this isn't a terminal. Run it on a terminal, or pass --yes to take every detected default."
81977
+ `${question.flag}: ${read.problem}${question.keys ? ` List the keys with: ${question.keys}` : ""}`
81864
81978
  );
81865
- const wizard = {
81866
- yes,
81867
- ask: ctx.ask,
81868
- out: ctx.out,
81869
- err: ctx.err,
81870
- detected: detectRepository(ctx.cwd, ctx.io),
81871
- drafting: null
81872
- };
81873
- if (!yes) ctx.out("Press Enter to take the default in brackets.");
81874
- const job = await askJob(wizard);
81875
- let file2;
81876
- if ("category" in job) file2 = await askCategoryTools(wizard, job.category);
81877
- else {
81878
- wizard.drafting = devtuneDrafting(ctx.io, ctx.err);
81879
- file2 = await askCustomJob(wizard, job.line);
81880
- }
81881
- Object.assign(file2, await askTests(wizard, file2.from));
81882
- const agents = await askAgents(wizard);
81883
- if (agents) file2.agents = agents;
81884
- const runs = await ask(wizard, {
81885
- label: "Runs per agent and stack",
81886
- fallback: "1",
81887
- read: (answer) => /^[1-9]\d*$/.test(answer) && Number(answer) <= 100 ? { value: Number(answer) } : { problem: "Give a whole number of runs, 1 to 100." }
81888
- });
81889
- if (runs !== 1) file2.runs = runs;
81890
- const dir = (0, import_node_path13.join)(wizard.detected.root, SETUPS_DIR);
81891
- const text3 = `${SCHEMA_LINE}
81892
- ${(0, import_yaml5.stringify)(file2)}`;
81893
- const name = await ask(wizard, {
81894
- label: "Name",
81895
- fallback: file2.from ?? slug(file2.job),
81896
- read: (answer) => {
81897
- if (!/^[a-z0-9][a-z0-9-]{0,62}$/.test(answer))
81898
- return {
81899
- problem: "A name is lowercase letters, digits and hyphens, such as error-tracking."
81900
- };
81901
- const path2 = setupPath(dir, answer);
81902
- if ((0, import_node_fs8.existsSync)(path2) && !force)
81903
- return {
81904
- problem: `${(0, import_node_path13.relative)(ctx.cwd, path2)} exists. Choose another name, or pass --force to replace it.`
81905
- };
81906
- const checked = checkSetupText(path2, text3);
81907
- return checked.problems.length > 0 ? {
81908
- problem: checked.problems.map((p) => `${p.field}: ${p.message}`).join("\n")
81909
- } : { value: answer };
81910
- }
81911
- });
81912
- const path = setupPath(dir, name);
81913
- writeSetup(dir, path, text3, force, ctx.cwd);
81914
- const shown3 = (0, import_node_path13.relative)(ctx.cwd, path) || path;
81915
- ctx.out("");
81916
- ctx.out(`Wrote ${shown3}:`);
81917
- ctx.out("");
81918
- for (const line2 of text3.trimEnd().split("\n").slice(1)) ctx.out(` ${line2}`);
81919
- ctx.out("");
81920
- if (!file2.agents)
81921
- ctx.out(
81922
- "It names no agents, so run uses the one agent installed where it runs."
81923
- );
81924
- const custom2 = checkSetupText(path, text3).setup.customReason !== null;
81925
- if (ctx.io.env.AGENTPICKS_NO_UPLOAD)
81926
- ctx.out(`Run it with: agentpicks run ${name}`);
81927
- else if (!signedIn(ctx.io)) {
81928
- ctx.out(`Run it with: agentpicks run ${name} --no-upload`);
81929
- ctx.out(
81930
- `That needs no DevTune account. To upload its runs to DevTune, sign in with agentpicks login${custom2 ? `, then run agentpicks push ${name}` : ""}.`
81931
- );
81932
- } else
81933
- ctx.out(
81934
- custom2 ? `To upload its runs, first run: agentpicks push ${name}, then agentpicks run ${name}. To keep bundles on this machine only, run: agentpicks run ${name} --no-upload.` : `Run it with: agentpicks run ${name}`
81935
- );
81936
- return 0;
81937
- }
81938
- function signedIn(io) {
81939
- try {
81940
- devtuneTarget(io);
81941
- return true;
81942
- } catch {
81943
- return false;
81944
- }
81979
+ return read.value;
81945
81980
  }
81946
- function parseInitArgs(argv) {
81947
- try {
81948
- const { values } = (0, import_node_util2.parseArgs)({
81949
- args: argv,
81950
- strict: true,
81951
- allowPositionals: false,
81952
- options: {
81953
- yes: { type: "boolean", short: "y", default: false },
81954
- force: { type: "boolean", default: false }
81955
- }
81956
- });
81957
- return { yes: values.yes, force: values.force };
81958
- } catch (error62) {
81981
+ function refuseListNumbers(flag, value, keys) {
81982
+ const number4 = entries(value).find((entry) => /^\d+(-\d+)?$/.test(entry));
81983
+ if (number4 !== void 0)
81959
81984
  throw new UsageError(
81960
- error62 instanceof Error ? error62.message : String(error62)
81985
+ `${flag} takes keys, not list numbers such as ${number4}. Give them from: ${keys}`
81961
81986
  );
81962
- }
81963
81987
  }
81964
81988
  async function ask(wizard, question) {
81989
+ if (question.given !== void 0)
81990
+ return readGiven({ ...question, given: question.given });
81965
81991
  if (wizard.yes) {
81966
81992
  if (question.fallback === null)
81967
81993
  throw new UsageError(
81968
81994
  `agentpicks init --yes ${question.missing ?? `has no default for ${question.label.toLowerCase()}. Run agentpicks init on a terminal to answer it.`}`
81969
81995
  );
81970
- const read = question.read(question.fallback);
81996
+ const read = question.read(question.fallback, false);
81971
81997
  if ("problem" in read) throw new UsageError(read.problem);
81972
81998
  return read.value;
81973
81999
  }
82000
+ if (!wizard.interactive) {
82001
+ const asked = `agentpicks init can't ask "${question.label}" without a terminal`;
82002
+ if (question.fallback !== null)
82003
+ throw new UsageError(
82004
+ `${asked}. Pass ${question.flag ? `${question.flag}, or --yes` : "--yes"} to take its default.`
82005
+ );
82006
+ throw new UsageError(
82007
+ `${asked}, and ${question.missing ?? "it has no default. Answer it on a terminal."}${question.flag ? ` Or pass ${question.flag}.` : ""}`
82008
+ );
82009
+ }
82010
+ hint(wizard);
81974
82011
  for (; ; ) {
81975
82012
  const shown3 = question.fallback === null ? "" : ` [${question.fallback}]`;
81976
82013
  const answer = (await wizard.ask(`${question.label}${shown3}: `)).trim() || question.fallback || "";
81977
- const read = question.read(answer);
82014
+ const read = question.read(answer, false);
81978
82015
  if ("value" in read) return read.value;
81979
82016
  wizard.err(read.problem);
81980
82017
  }
81981
82018
  }
82019
+ function hint(wizard) {
82020
+ if (wizard.hinted) return;
82021
+ wizard.out("Press Enter to take the default in brackets.");
82022
+ wizard.hinted = true;
82023
+ }
82024
+ function showNumbered(wizard, given, title, items, columns2 = items.length > 10 ? 3 : 1) {
82025
+ if (wizard.yes || !wizard.interactive || given !== void 0) return;
82026
+ hint(wizard);
82027
+ wizard.out(title);
82028
+ const rows = Math.ceil(items.length / columns2);
82029
+ const width = Math.max(...items.map((item) => item.length));
82030
+ for (let row = 0; row < rows; row++) {
82031
+ const cells = [];
82032
+ for (let column = 0; column < columns2; column++) {
82033
+ const i = column * rows + row;
82034
+ const item = items[i];
82035
+ if (item !== void 0)
82036
+ cells.push(`${String(i + 1).padStart(2)} ${item.padEnd(width)}`);
82037
+ }
82038
+ wizard.out(` ${cells.join(" ").trimEnd()}`);
82039
+ }
82040
+ }
82041
+ var pickKey = (answer, keys) => /^\d+$/.test(answer) ? keys[Number(answer) - 1] ?? null : keys.includes(answer) ? answer : null;
81982
82042
  var entries = (answer) => answer.split(",").map((entry) => entry.trim()).filter(Boolean);
82043
+ var withRanges = (answer, count) => entries(answer).flatMap((entry) => {
82044
+ const range = /^(\d+)-(\d+)$/.exec(entry);
82045
+ if (!range) return [entry];
82046
+ const [from, to] = [Number(range[1]), Number(range[2])];
82047
+ return from >= 1 && from <= to && to <= count ? Array.from({ length: to - from + 1 }, (_, i) => String(from + i)) : [entry];
82048
+ });
81983
82049
  var badLength = (text3) => {
81984
82050
  const problem = requestTextProblem(text3);
81985
82051
  return problem === "too_short" || problem === "too_long";
81986
82052
  };
81987
- async function askJob(wizard) {
81988
- const detected = wizard.detected.tool?.categories[0];
81989
- const index = CATEGORY_REQUESTS.findIndex((c) => c.slug === detected);
81990
- if (!wizard.yes) {
81991
- wizard.out("Categories:");
81992
- CATEGORY_REQUESTS.forEach(
81993
- (category, i) => wizard.out(` ${String(i + 1).padStart(2)} ${category.name}`)
81994
- );
81995
- }
81996
- return ask(wizard, {
81997
- label: "Job: a category number, or your own job line",
81998
- fallback: index >= 0 ? String(index + 1) : null,
81999
- missing: "can't choose a job: neither package.json nor the git remote names a catalogue tool. Run agentpicks init on a terminal to choose one.",
82000
- read: (answer) => {
82001
- const count = CATEGORY_REQUESTS.length;
82002
- if (/^\d+$/.test(answer)) {
82003
- const category2 = CATEGORY_REQUESTS[Number(answer) - 1];
82004
- return category2 ? { value: { category: category2.slug } } : {
82005
- problem: `Choose a category from 1 to ${count}, or write a job line.`
82006
- };
82007
- }
82008
- const category = findCategoryRequests(answer);
82009
- if (category) return { value: { category: category.slug } };
82010
- if (!/\s/.test(answer) || // A new job line meets a request's length; the guard is resolveSetup's, which names the field.
82011
- badLength(answer))
82012
- return {
82013
- problem: `Choose a category from 1 to ${count}, or write the job as a line of ${SETUP_REQUEST_MIN_LENGTH} to ${SETUP_TEXT_MAX_LENGTH} characters, such as Add feature flags.`
82014
- };
82015
- return { value: { line: answer } };
82016
- }
82017
- });
82018
- }
82019
- async function askCategoryTools(wizard, category) {
82020
- const keys = CATEGORY_TOOLS[category] ?? [];
82021
- const detected = wizard.detected.tool?.key;
82022
- const own2 = await ask(wizard, {
82023
- label: `Your tool: a ${category} tool key, or none`,
82024
- fallback: detected && keys.includes(detected) ? detected : "none",
82025
- read: (answer) => answer === "none" ? { value: null } : keys.includes(answer) ? { value: answer } : {
82026
- problem: `${category} has no tool ${answer}. Use one of ${keys.join(", ")}, or none.`
82027
- }
82028
- });
82029
- const competitors = await ask(wizard, {
82030
- label: `Competitors: ${category} tool keys separated by commas, or all`,
82031
- fallback: "all",
82032
- read: (answer) => {
82033
- if (answer === "all") return { value: null };
82034
- const chosen = [...new Set(entries(answer))];
82035
- const unknown2 = chosen.find((key) => !keys.includes(key) || key === own2);
82036
- if (!unknown2 && chosen.length > SETUP_MAX_COMPETITORS)
82037
- return {
82038
- problem: `List at most ${SETUP_MAX_COMPETITORS} competitors, or all.`
82039
- };
82040
- return unknown2 ? {
82041
- problem: unknown2 === own2 ? `${own2} is your tool. List only competitors.` : `${category} has no tool ${unknown2}. Use ${keys.join(", ")}, or all.`
82042
- } : { value: chosen };
82043
- }
82044
- });
82045
- const tools = {
82046
- ...own2 ? { own: own2 } : {},
82047
- ...competitors ? { competitors } : {}
82048
- };
82049
- return { from: category, ...own2 || competitors ? { tools } : {} };
82053
+ function slug(text3) {
82054
+ return text3.normalize("NFKD").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 63).replace(/-+$/, "") || "setup";
82050
82055
  }
82056
+
82057
+ // src/cli/init-job-line.ts
82051
82058
  var INTENTS = ["add", "recommend", "hosted"];
82052
82059
  async function askCustomJob(wizard, line2) {
82053
82060
  const drafted = await wizard.drafting?.job(line2) ?? null;
@@ -82075,8 +82082,15 @@ async function askCustomJob(wizard, line2) {
82075
82082
  (0, import_yaml5.stringify)(file2)
82076
82083
  );
82077
82084
  if (checked.problems.length === 0) return file2;
82078
- for (const problem of checked.problems)
82079
- wizard.err(`${problem.field}: ${problem.message}`);
82085
+ const problems = checked.problems.map(
82086
+ (problem) => `${problem.field}: ${problem.message}`
82087
+ );
82088
+ if (wizard.yes)
82089
+ throw new UsageError(
82090
+ `${problems.join("\n")}
82091
+ Run agentpicks init on a terminal to answer the requests and tools, or write the setup against agentpicks schema.`
82092
+ );
82093
+ for (const problem of problems) wizard.err(problem);
82080
82094
  wizard.err("Answer the requests and tools again.");
82081
82095
  }
82082
82096
  }
@@ -82178,33 +82192,346 @@ async function toolWithSignals(wizard, tool, job, others, toolDrafts, detected)
82178
82192
  signals: { packages: { npm: packages } }
82179
82193
  };
82180
82194
  }
82195
+
82196
+ // src/cli/init.ts
82197
+ async function initCommand(argv, ctx) {
82198
+ const flags = parseInitArgs(argv);
82199
+ const { yes, force } = flags;
82200
+ const wizard = {
82201
+ yes,
82202
+ interactive: Boolean(ctx.interactive),
82203
+ flags,
82204
+ cwd: ctx.cwd,
82205
+ ask: ctx.ask,
82206
+ out: ctx.out,
82207
+ err: ctx.err,
82208
+ detected: detectRepository(ctx.cwd, ctx.io),
82209
+ drafting: null,
82210
+ hinted: false
82211
+ };
82212
+ checkFlags(wizard);
82213
+ const job = await askJob(wizard);
82214
+ let file2;
82215
+ if ("category" in job) file2 = await askCategoryTools(wizard, job.category);
82216
+ else if (flags.tool !== void 0 || flags.competitors !== void 0)
82217
+ throw new UsageError(
82218
+ `--${flags.tool !== void 0 ? "tool" : "competitors"} answers a category's questions, and ${job.line} is a job line. Pass --category, or leave it out.`
82219
+ );
82220
+ else if (!yes && !wizard.interactive)
82221
+ throw new UsageError(
82222
+ "agentpicks init can't ask a job line's requests and tools without a terminal, and they have no flags. Pass --yes to take DevTune's drafts, which needs a sign-in, or write the setup against agentpicks schema."
82223
+ );
82224
+ else {
82225
+ wizard.drafting = devtuneDrafting(ctx.io, ctx.err);
82226
+ file2 = await askCustomJob(wizard, job.line);
82227
+ }
82228
+ Object.assign(file2, await askTests(wizard, file2.from));
82229
+ const agents = await ask(wizard, agentsQuestion(wizard));
82230
+ if (agents) file2.agents = agents;
82231
+ const runs = await ask(wizard, runsQuestion(wizard));
82232
+ if (runs !== 1) file2.runs = runs;
82233
+ const dir = (0, import_node_path14.join)(wizard.detected.root, SETUPS_DIR);
82234
+ const text3 = `${SCHEMA_LINE}
82235
+ ${(0, import_yaml6.stringify)(file2)}`;
82236
+ const name = await ask(
82237
+ wizard,
82238
+ nameQuestion(wizard, file2.from ?? slug(file2.job), (answer) => {
82239
+ const checked = checkSetupText(setupPath(dir, answer), text3);
82240
+ return checked.problems.length > 0 ? {
82241
+ problem: checked.problems.map((p) => `${p.field}: ${p.message}`).join("\n")
82242
+ } : { value: answer };
82243
+ })
82244
+ );
82245
+ const path = setupPath(dir, name);
82246
+ writeSetup(dir, path, text3, force, ctx.cwd);
82247
+ const shown3 = (0, import_node_path14.relative)(ctx.cwd, path) || path;
82248
+ ctx.out("");
82249
+ ctx.out(`Wrote ${shown3}:`);
82250
+ ctx.out("");
82251
+ for (const line2 of text3.trimEnd().split("\n").slice(1)) ctx.out(` ${line2}`);
82252
+ ctx.out("");
82253
+ if (file2.from)
82254
+ ctx.out(
82255
+ `To write the same setup in another repository: ${initAgain(file2, name)}`
82256
+ );
82257
+ if (!file2.agents)
82258
+ ctx.out(
82259
+ "It names no agents, so run uses the one agent installed where it runs."
82260
+ );
82261
+ const custom2 = checkSetupText(path, text3).setup.customReason !== null;
82262
+ if (ctx.io.env.AGENTPICKS_NO_UPLOAD)
82263
+ ctx.out(`Run it with: agentpicks run ${name}`);
82264
+ else if (!signedIn(ctx.io)) {
82265
+ ctx.out(`Run it with: agentpicks run ${name} --no-upload`);
82266
+ ctx.out(
82267
+ `That needs no DevTune account. To upload its runs to DevTune, sign in with agentpicks login${custom2 ? `, then run agentpicks push ${name}` : ""}.`
82268
+ );
82269
+ } else
82270
+ ctx.out(
82271
+ custom2 ? `To upload its runs, first run: agentpicks push ${name}, then agentpicks run ${name}. To keep bundles on this machine only, run: agentpicks run ${name} --no-upload.` : `Run it with: agentpicks run ${name}`
82272
+ );
82273
+ return 0;
82274
+ }
82275
+ function signedIn(io) {
82276
+ try {
82277
+ devtuneTarget(io);
82278
+ return true;
82279
+ } catch {
82280
+ return false;
82281
+ }
82282
+ }
82283
+ function initAgain(file2, name) {
82284
+ const { own: own2, competitors } = file2.tools ?? {};
82285
+ return [
82286
+ "agentpicks init",
82287
+ `--category ${file2.from}`,
82288
+ `--tool ${typeof own2 === "string" ? own2 : "none"}`,
82289
+ ...competitors ? [`--competitors ${competitors.join(",")}`] : [],
82290
+ ...file2.repo ? ["--repo ."] : (file2.stacks ?? []).map((stack) => `--stack ${stack}`),
82291
+ ...(file2.agents ?? ["any"]).map((agent) => `--agent ${agent}`),
82292
+ ...file2.runs ? [`--runs ${file2.runs}`] : [],
82293
+ `--name ${name}`,
82294
+ "--yes"
82295
+ ].join(" ");
82296
+ }
82297
+ function parseInitArgs(argv) {
82298
+ let values;
82299
+ try {
82300
+ ({ values } = (0, import_node_util3.parseArgs)({
82301
+ args: argv,
82302
+ strict: true,
82303
+ allowPositionals: false,
82304
+ options: {
82305
+ yes: { type: "boolean", short: "y", default: false },
82306
+ force: { type: "boolean", default: false },
82307
+ category: { type: "string" },
82308
+ job: { type: "string" },
82309
+ tool: { type: "string" },
82310
+ competitors: { type: "string" },
82311
+ repo: { type: "string" },
82312
+ stack: { type: "string", multiple: true, default: [] },
82313
+ agent: { type: "string", multiple: true, default: [] },
82314
+ runs: { type: "string" },
82315
+ name: { type: "string" }
82316
+ }
82317
+ }));
82318
+ } catch (error62) {
82319
+ throw new UsageError(
82320
+ error62 instanceof Error ? error62.message : String(error62)
82321
+ );
82322
+ }
82323
+ if (values.category !== void 0 && values.job !== void 0)
82324
+ throw new UsageError(
82325
+ "Pass --category or --job, not both: a setup tests a category or a job line of its own."
82326
+ );
82327
+ if (values.repo !== void 0 && values.stack.length > 0)
82328
+ throw new UsageError(
82329
+ "Pass --repo or --stack, not both: a setup tests this repository or stacks."
82330
+ );
82331
+ if (values.repo !== void 0 && values.repo !== ".")
82332
+ throw new UsageError(
82333
+ `--repo takes only . (this repository's committed files), not ${values.repo}.`
82334
+ );
82335
+ if (values.stack.some((stack) => entries(stack).includes(".")))
82336
+ throw new UsageError(
82337
+ "--stack takes stack slugs. To test this repository's committed files, pass --repo ."
82338
+ );
82339
+ return values;
82340
+ }
82341
+ function checkFlags(wizard) {
82342
+ const read = (question) => question.given === void 0 ? void 0 : readGiven({ ...question, given: question.given });
82343
+ const job = read(jobQuestion(wizard));
82344
+ const { tool, competitors, stack } = wizard.flags;
82345
+ if (job && "category" in job) {
82346
+ const own2 = read(toolQuestion(wizard, job.category));
82347
+ read(competitorsQuestion(wizard, job.category, own2 ?? null));
82348
+ } else
82349
+ for (const [flag, value] of [
82350
+ ["--tool", tool],
82351
+ ["--competitors", competitors]
82352
+ ])
82353
+ if (value !== void 0)
82354
+ refuseListNumbers(flag, value, "agentpicks catalogue <category>");
82355
+ if (job && stack.length > 0)
82356
+ read(testsQuestion(wizard, "category" in job ? job.category : void 0));
82357
+ else if (stack.length > 0) {
82358
+ const given = stack.join(",");
82359
+ refuseListNumbers("--stack", given, "agentpicks catalogue");
82360
+ const unknown2 = entries(given).find(
82361
+ (slug2) => !findEnvironment(slug2) || isRetiredEnvironment(slug2)
82362
+ );
82363
+ if (unknown2 !== void 0)
82364
+ throw new UsageError(
82365
+ `--stack: ${unknown2} isn't a stack. Give stack slugs. List the keys with: agentpicks catalogue`
82366
+ );
82367
+ }
82368
+ read(agentsQuestion(wizard));
82369
+ read(runsQuestion(wizard));
82370
+ read(nameQuestion(wizard, null, (answer) => ({ value: answer })));
82371
+ }
82372
+ async function askJob(wizard) {
82373
+ const question = jobQuestion(wizard);
82374
+ showNumbered(
82375
+ wizard,
82376
+ question.given,
82377
+ "DevTune's public categories. Choose one to write a setup that runs its tests on this machine:",
82378
+ CATEGORY_REQUESTS.map((category) => category.name)
82379
+ );
82380
+ return ask(wizard, question);
82381
+ }
82382
+ function jobQuestion(wizard) {
82383
+ const detected = wizard.detected.tool?.categories[0];
82384
+ const index = CATEGORY_REQUESTS.findIndex((c) => c.slug === detected);
82385
+ const { category, job } = wizard.flags;
82386
+ return {
82387
+ label: "Category number, or your own job line",
82388
+ fallback: index >= 0 ? String(index + 1) : null,
82389
+ missing: "can't choose a job: neither package.json nor the git remote names a catalogue tool. Run agentpicks init on a terminal to choose one.",
82390
+ flag: category !== void 0 ? "--category" : job !== void 0 ? "--job" : "--category or --job",
82391
+ given: category ?? job,
82392
+ keys: category !== void 0 ? "agentpicks catalogue" : void 0,
82393
+ read: (answer, flag) => {
82394
+ const read = readJob(answer, flag);
82395
+ if (category !== void 0 && !("value" in read && "category" in read.value))
82396
+ return { problem: `There is no category ${answer}.` };
82397
+ if ("problem" in read) return read;
82398
+ if (job !== void 0 && "category" in read.value)
82399
+ return {
82400
+ problem: `${answer} names a category. Pass it as --category ${read.value.category}.`
82401
+ };
82402
+ return read;
82403
+ }
82404
+ };
82405
+ }
82406
+ function readJob(answer, flag) {
82407
+ const count = CATEGORY_REQUESTS.length;
82408
+ const line2 = `${flag ? "Write" : `Choose a category from 1 to ${count}, or write`} the job as a line of ${SETUP_REQUEST_MIN_LENGTH} to ${SETUP_TEXT_MAX_LENGTH} characters, such as Add feature flags.`;
82409
+ if (/^\d+$/.test(answer)) {
82410
+ const category2 = CATEGORY_REQUESTS[Number(answer) - 1];
82411
+ return category2 ? { value: { category: category2.slug } } : {
82412
+ problem: flag ? line2 : `Choose a category from 1 to ${count}, or write a job line.`
82413
+ };
82414
+ }
82415
+ const category = findCategoryRequests(answer);
82416
+ if (category) return { value: { category: category.slug } };
82417
+ if (!/\s/.test(answer) || // A new job line meets a request's length; the guard is resolveSetup's, which names the field.
82418
+ badLength(answer))
82419
+ return { problem: line2 };
82420
+ return { value: { line: answer } };
82421
+ }
82422
+ async function askCategoryTools(wizard, category) {
82423
+ const { tool, competitors: rivals } = wizard.flags;
82424
+ showNumbered(
82425
+ wizard,
82426
+ tool !== void 0 && rivals !== void 0 ? tool : void 0,
82427
+ `${findCategoryRequests(category)?.name ?? category} tools DevTune tests:`,
82428
+ CATEGORY_TOOLS[category] ?? []
82429
+ );
82430
+ const own2 = await ask(wizard, toolQuestion(wizard, category));
82431
+ const competitors = await ask(
82432
+ wizard,
82433
+ competitorsQuestion(wizard, category, own2)
82434
+ );
82435
+ const tools = {
82436
+ ...own2 ? { own: own2 } : {},
82437
+ ...competitors ? { competitors } : {}
82438
+ };
82439
+ return { from: category, ...own2 || competitors ? { tools } : {} };
82440
+ }
82441
+ function toolQuestion(wizard, category) {
82442
+ const keys = CATEGORY_TOOLS[category] ?? [];
82443
+ return {
82444
+ label: "Your tool: its number, or none",
82445
+ fallback: toolDefault(wizard, category),
82446
+ flag: "--tool",
82447
+ given: wizard.flags.tool,
82448
+ keys: `agentpicks catalogue ${category}`,
82449
+ read: (answer, flag) => {
82450
+ if (answer === "none") return { value: null };
82451
+ const key = pickKey(answer, keys);
82452
+ return key ? { value: key } : {
82453
+ problem: `${answer} isn't on the list. Give ${flag ? "a tool key" : `a number from 1 to ${keys.length}`}, or none.`
82454
+ };
82455
+ }
82456
+ };
82457
+ }
82458
+ function competitorsQuestion(wizard, category, own2) {
82459
+ const keys = CATEGORY_TOOLS[category] ?? [];
82460
+ return {
82461
+ label: "Competitors: their numbers or ranges separated by commas (2, 5-8), or all",
82462
+ fallback: "all",
82463
+ flag: "--competitors",
82464
+ given: wizard.flags.competitors,
82465
+ keys: `agentpicks catalogue ${category}`,
82466
+ read: (answer, flag) => {
82467
+ if (answer === "all") return { value: null };
82468
+ const give = `Give ${flag ? "tool keys" : `numbers from 1 to ${keys.length}`}, or all.`;
82469
+ const chosen = [];
82470
+ const given = withRanges(answer, keys.length);
82471
+ if (given.length === 0) return { problem: give };
82472
+ for (const entry of given) {
82473
+ const key = pickKey(entry, keys);
82474
+ if (!key) return { problem: `${entry} isn't on the list. ${give}` };
82475
+ if (key === own2)
82476
+ return {
82477
+ problem: wizard.yes && wizard.flags.tool === void 0 ? `${own2} is your tool, as this repository names it. Pass --tool none, or leave ${own2} out.` : `${own2} is your tool. List only competitors.`
82478
+ };
82479
+ if (!chosen.includes(key)) chosen.push(key);
82480
+ }
82481
+ return chosen.length > SETUP_MAX_COMPETITORS ? {
82482
+ problem: `List at most ${SETUP_MAX_COMPETITORS} competitors, or all.`
82483
+ } : { value: chosen };
82484
+ }
82485
+ };
82486
+ }
82487
+ function toolDefault(wizard, category) {
82488
+ const detected = wizard.detected.tool?.key;
82489
+ return detected && (CATEGORY_TOOLS[category] ?? []).includes(detected) ? detected : "none";
82490
+ }
82181
82491
  async function askTests(wizard, from) {
82182
- const runsIn = from ?? "job-";
82183
- const choices = ENVIRONMENTS.filter(
82184
- (env) => !isRetiredEnvironment(env.slug) && environmentRunsIn(env.slug, runsIn)
82185
- ).map((env) => env.slug);
82492
+ const question = testsQuestion(wizard, from);
82493
+ showNumbered(
82494
+ wizard,
82495
+ question.given,
82496
+ "Stacks: starter apps a run can build in instead of this repository:",
82497
+ setupEnvironments(from ?? "job-").map((env) => env.name),
82498
+ 1
82499
+ );
82500
+ return ask(wizard, question);
82501
+ }
82502
+ function testsQuestion(wizard, from) {
82503
+ const choices = setupEnvironments(from ?? "job-").map((env) => env.slug);
82186
82504
  const { git, stacks, root } = wizard.detected;
82187
- const detected = stacks.filter((stack) => choices.includes(stack));
82188
- return ask(wizard, {
82189
- label: "Test in your repository (.) or in stacks separated by commas",
82505
+ const detected = stacks.filter((stack2) => choices.includes(stack2));
82506
+ const { repo, stack } = wizard.flags;
82507
+ return {
82508
+ label: "Test in this repository's committed files (.), or in stacks: their numbers or ranges separated by commas (1, 3-4)",
82190
82509
  fallback: git ? "." : detected.join(", ") || null,
82191
82510
  missing: `found nothing to test in: ${root} isn't a git repository, and its package.json and lockfiles name no framework of a stack (${choices.join(", ")}). Run it in a git repository, or on a terminal to choose stacks.`,
82192
- read: (answer) => {
82511
+ flag: repo !== void 0 ? "--repo" : stack.length > 0 || !git ? "--stack" : "--repo . or --stack",
82512
+ given: repo ?? (stack.length > 0 ? stack.join(",") : void 0),
82513
+ keys: repo === void 0 ? `agentpicks catalogue${from ? ` ${from}` : ""}` : void 0,
82514
+ read: (answer, flag) => {
82193
82515
  if (answer === ".") return { value: { repo: "." } };
82194
- const chosen = [...new Set(entries(answer))];
82195
- const unknown2 = chosen.find((stack) => !choices.includes(stack));
82196
- if (chosen.length === 0 || unknown2)
82516
+ const given = withRanges(answer, choices.length);
82517
+ const chosen = [
82518
+ ...new Set(given.map((entry) => pickKey(entry, choices)))
82519
+ ];
82520
+ const unknown2 = given.find((entry) => !pickKey(entry, choices));
82521
+ if (given.length === 0 || unknown2)
82197
82522
  return {
82198
- problem: `${unknown2 ?? "Nothing"} isn't a stack ${from ? `for ${from}` : "for your own job"}. Give . or stacks from ${choices.join(", ")}.`
82523
+ problem: `${unknown2 ?? "Nothing"} isn't a stack ${from ? `for ${from}` : "for your own job"}. Give ${flag ? "stack slugs" : `. or numbers from 1 to ${choices.length}`}.`
82199
82524
  };
82200
- return { value: { stacks: chosen } };
82525
+ return { value: { stacks: chosen.filter((stack2) => stack2 !== null) } };
82201
82526
  }
82202
- });
82527
+ };
82203
82528
  }
82204
- async function askAgents(wizard) {
82205
- return ask(wizard, {
82529
+ function agentsQuestion(wizard) {
82530
+ return {
82206
82531
  label: "Agents separated by commas, or any",
82207
82532
  fallback: wizard.detected.agents.join(", ") || "any",
82533
+ flag: "--agent",
82534
+ given: wizard.flags.agent.length > 0 ? wizard.flags.agent.join(",") : void 0,
82208
82535
  read: (answer) => {
82209
82536
  if (answer === "any") return { value: null };
82210
82537
  const chosen = entries(answer).map(
@@ -82220,31 +82547,57 @@ async function askAgents(wizard) {
82220
82547
  };
82221
82548
  return { value: unique };
82222
82549
  }
82223
- });
82550
+ };
82224
82551
  }
82225
- function slug(text3) {
82226
- return text3.normalize("NFKD").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 63).replace(/-+$/, "") || "setup";
82552
+ function runsQuestion(wizard) {
82553
+ return {
82554
+ label: "Runs per agent and stack",
82555
+ fallback: "1",
82556
+ flag: "--runs",
82557
+ given: wizard.flags.runs,
82558
+ read: (answer) => /^[1-9]\d*$/.test(answer) && Number(answer) <= 100 ? { value: Number(answer) } : { problem: "Give a whole number of runs, 1 to 100." }
82559
+ };
82560
+ }
82561
+ function nameQuestion(wizard, fallback, written) {
82562
+ return {
82563
+ label: `Setup name, saved as ${SETUPS_DIR}/<name>.yaml`,
82564
+ fallback,
82565
+ flag: "--name",
82566
+ given: wizard.flags.name,
82567
+ read: (answer) => {
82568
+ if (!/^[a-z0-9][a-z0-9-]{0,62}$/.test(answer))
82569
+ return {
82570
+ problem: "A name is lowercase letters, digits and hyphens, such as error-tracking."
82571
+ };
82572
+ const path = setupPath((0, import_node_path14.join)(wizard.detected.root, SETUPS_DIR), answer);
82573
+ if ((0, import_node_fs8.existsSync)(path) && !wizard.flags.force)
82574
+ return {
82575
+ problem: `${(0, import_node_path14.relative)(wizard.cwd, path)} exists. Choose another name, or pass --force to replace it.`
82576
+ };
82577
+ return written(answer);
82578
+ }
82579
+ };
82227
82580
  }
82228
82581
  function setupPath(dir, name) {
82229
- return [".yaml", ".yml"].map((ext) => (0, import_node_path13.join)(dir, `${name}${ext}`)).find(import_node_fs8.existsSync) ?? (0, import_node_path13.join)(dir, `${name}.yaml`);
82582
+ return [".yaml", ".yml"].map((ext) => (0, import_node_path14.join)(dir, `${name}${ext}`)).find(import_node_fs8.existsSync) ?? (0, import_node_path14.join)(dir, `${name}.yaml`);
82230
82583
  }
82231
82584
  function writeSetup(dir, path, text3, force, cwd) {
82232
82585
  try {
82233
82586
  writeSetupText(dir, path, text3, {
82234
82587
  replace: force,
82235
- shown: (target) => (0, import_node_path13.relative)(cwd, target) || target
82588
+ shown: (target) => (0, import_node_path14.relative)(cwd, target) || target
82236
82589
  });
82237
82590
  } catch (error62) {
82238
82591
  if (error62.code === "EEXIST")
82239
82592
  throw new UsageError(
82240
- `${(0, import_node_path13.relative)(cwd, path)} appeared while init ran. Run init again with another name, or pass --force to replace it.`
82593
+ `${(0, import_node_path14.relative)(cwd, path)} appeared while init ran. Run init again with another name, or pass --force to replace it.`
82241
82594
  );
82242
82595
  throw error62;
82243
82596
  }
82244
82597
  }
82245
82598
 
82246
82599
  // src/cli/list-command.ts
82247
- var import_node_path14 = require("node:path");
82600
+ var import_node_path15 = require("node:path");
82248
82601
  async function listCommand(argv, ctx) {
82249
82602
  if (argv.length > 0)
82250
82603
  throw new UsageError(
@@ -82267,7 +82620,7 @@ async function listCommand(argv, ctx) {
82267
82620
  if (devtune)
82268
82621
  return linkedTable(readSetupFiles(root, heldTools(devtune)), devtune, ctx);
82269
82622
  if (files.length === 0) {
82270
- ctx.out(`${(0, import_node_path14.join)(root, SETUPS_DIR)} holds no setup files. ${WRITE_ONE}`);
82623
+ ctx.out(`${(0, import_node_path15.join)(root, SETUPS_DIR)} holds no setup files. ${WRITE_ONE}`);
82271
82624
  return 0;
82272
82625
  }
82273
82626
  printSetups(
@@ -82572,8 +82925,8 @@ function logoPlayer(env, stdout) {
82572
82925
 
82573
82926
  // src/cli/pull-command.ts
82574
82927
  var import_node_fs9 = require("node:fs");
82575
- var import_node_path15 = require("node:path");
82576
- var import_node_util3 = require("node:util");
82928
+ var import_node_path16 = require("node:path");
82929
+ var import_node_util4 = require("node:util");
82577
82930
  async function pullCommand(argv, ctx) {
82578
82931
  const { values, positionals } = parse5(argv);
82579
82932
  if (positionals.length > 1)
@@ -82612,7 +82965,7 @@ async function pullCommand(argv, ctx) {
82612
82965
  }
82613
82966
  function parse5(argv) {
82614
82967
  try {
82615
- return (0, import_node_util3.parseArgs)({
82968
+ return (0, import_node_util4.parseArgs)({
82616
82969
  args: argv,
82617
82970
  strict: true,
82618
82971
  allowPositionals: true,
@@ -82624,7 +82977,7 @@ function parse5(argv) {
82624
82977
  );
82625
82978
  }
82626
82979
  }
82627
- var shown = (path, ctx) => (0, import_node_path15.relative)(ctx.cwd, path) || path;
82980
+ var shown = (path, ctx) => (0, import_node_path16.relative)(ctx.cwd, path) || path;
82628
82981
  function pullOne(setup, root, files, devtune, force, ctx) {
82629
82982
  const name = devtune.names.get(setup.id);
82630
82983
  const linked = files.filter((file2) => file2.content?.id === setup.id);
@@ -82635,7 +82988,7 @@ function pullOne(setup, root, files, devtune, force, ctx) {
82635
82988
  return false;
82636
82989
  }
82637
82990
  const [local] = linked;
82638
- const path = local?.path ?? (0, import_node_path15.join)(root, SETUPS_DIR, `${name}.yaml`);
82991
+ const path = local?.path ?? (0, import_node_path16.join)(root, SETUPS_DIR, `${name}.yaml`);
82639
82992
  if (local) {
82640
82993
  const state = syncState(local.content, setup);
82641
82994
  if (state === "in_sync") {
@@ -82664,7 +83017,7 @@ function pullOne(setup, root, files, devtune, force, ctx) {
82664
83017
  }
82665
83018
  try {
82666
83019
  writeSetupText(
82667
- (0, import_node_path15.join)(root, SETUPS_DIR),
83020
+ (0, import_node_path16.join)(root, SETUPS_DIR),
82668
83021
  path,
82669
83022
  `${SCHEMA_LINE}
82670
83023
  ${linkedSetupYaml(mapped.file, {
@@ -82693,7 +83046,7 @@ ${linkedSetupYaml(mapped.file, {
82693
83046
  }
82694
83047
 
82695
83048
  // src/cli/push-command.ts
82696
- var import_node_path16 = require("node:path");
83049
+ var import_node_path17 = require("node:path");
82697
83050
  async function pushCommand(argv, ctx) {
82698
83051
  const flag = argv.find((arg) => arg.startsWith("-"));
82699
83052
  if (flag)
@@ -82714,7 +83067,7 @@ async function pushCommand(argv, ctx) {
82714
83067
  return failed === 0 ? 0 : 1;
82715
83068
  }
82716
83069
  async function pushOne(file2, devtune, ctx) {
82717
- const shown3 = (0, import_node_path16.relative)(ctx.cwd, file2.path) || file2.path;
83070
+ const shown3 = (0, import_node_path17.relative)(ctx.cwd, file2.path) || file2.path;
82718
83071
  const content = file2.content;
82719
83072
  if (!file2.setup || !content) {
82720
83073
  for (const problem of file2.problems)
@@ -82738,7 +83091,7 @@ async function pushOne(file2, devtune, ctx) {
82738
83091
  return false;
82739
83092
  }
82740
83093
  }
82741
- const repositoryStacks = !current && file2.setup.repo ? detectStacks((0, import_node_path16.resolve)(file2.root, file2.setup.repo.path)).stacks : void 0;
83094
+ const repositoryStacks = !current && file2.setup.repo ? detectStacks((0, import_node_path17.resolve)(file2.root, file2.setup.repo.path)).stacks : void 0;
82742
83095
  let saved;
82743
83096
  try {
82744
83097
  const request2 = pushRequest(
@@ -82773,7 +83126,7 @@ async function pushOne(file2, devtune, ctx) {
82773
83126
  id: saved.setup.id,
82774
83127
  setupDigest: saved.snapshotDigest
82775
83128
  },
82776
- (path) => (0, import_node_path16.relative)(ctx.cwd, path) || path
83129
+ (path) => (0, import_node_path17.relative)(ctx.cwd, path) || path
82777
83130
  );
82778
83131
  ctx.out(
82779
83132
  current ? `Pushed ${shown3} to DevTune setup ${devtune.names.get(current.id)}.` : `Pushed ${shown3} to DevTune, and linked ${shown3} to the setup it saved.`
@@ -82797,7 +83150,7 @@ async function linkExisting(file2, content, ctx, shown3, repositoryStacks) {
82797
83150
  id: existing.id,
82798
83151
  setupDigest: existing.snapshot_digest
82799
83152
  },
82800
- (path) => (0, import_node_path16.relative)(ctx.cwd, path) || path
83153
+ (path) => (0, import_node_path17.relative)(ctx.cwd, path) || path
82801
83154
  );
82802
83155
  ctx.out(
82803
83156
  `DevTune already holds ${shown3} as setup ${after.names.get(existing.id)}; linked ${shown3} to it.`
@@ -82844,8 +83197,8 @@ function sameSubject(setup, content) {
82844
83197
 
82845
83198
  // src/cli/results.ts
82846
83199
  var import_node_fs10 = require("node:fs");
82847
- var import_node_path17 = require("node:path");
82848
- var import_node_util4 = require("node:util");
83200
+ var import_node_path18 = require("node:path");
83201
+ var import_node_util5 = require("node:util");
82849
83202
 
82850
83203
  // src/assets/watch-pick-rule.ts
82851
83204
  var POSIX_CLASSES = {
@@ -83094,7 +83447,7 @@ function resultsCommand(argv, ctx) {
83094
83447
  const rows = [
83095
83448
  ...new Set(
83096
83449
  dirs.flatMap(
83097
- (dir) => bundleDirs((0, import_node_path17.resolve)(ctx.cwd, dir)).map((bundle) => (0, import_node_path17.resolve)(bundle))
83450
+ (dir) => bundleDirs((0, import_node_path18.resolve)(ctx.cwd, dir)).map((bundle) => (0, import_node_path18.resolve)(bundle))
83098
83451
  )
83099
83452
  )
83100
83453
  ].map(resultRow).sort(
@@ -83110,7 +83463,7 @@ function resultsCommand(argv, ctx) {
83110
83463
  function parseResultsArgs(argv) {
83111
83464
  let parsed2;
83112
83465
  try {
83113
- parsed2 = (0, import_node_util4.parseArgs)({
83466
+ parsed2 = (0, import_node_util5.parseArgs)({
83114
83467
  args: argv,
83115
83468
  strict: true,
83116
83469
  allowPositionals: true,
@@ -83142,7 +83495,7 @@ function resultRow(dir) {
83142
83495
  if (!(error62 instanceof BundleError)) throw error62;
83143
83496
  return {
83144
83497
  dir,
83145
- runId: (0, import_node_path17.basename)(dir),
83498
+ runId: (0, import_node_path18.basename)(dir),
83146
83499
  setup: null,
83147
83500
  agent: null,
83148
83501
  model: null,
@@ -85332,7 +85685,7 @@ function isDockerSandbox(box) {
85332
85685
  }
85333
85686
 
85334
85687
  // src/cli/validate-command.ts
85335
- var import_node_path18 = require("node:path");
85688
+ var import_node_path19 = require("node:path");
85336
85689
  function validateCommand(argv, ctx) {
85337
85690
  const flag = argv.find((arg) => arg.startsWith("-"));
85338
85691
  if (flag)
@@ -85347,7 +85700,7 @@ function validateCommand(argv, ctx) {
85347
85700
  }
85348
85701
  }) : readSetupFiles(root);
85349
85702
  if (files.length === 0) {
85350
- ctx.out(`${(0, import_node_path18.join)(root, SETUPS_DIR)} holds no setup files. ${WRITE_ONE}`);
85703
+ ctx.out(`${(0, import_node_path19.join)(root, SETUPS_DIR)} holds no setup files. ${WRITE_ONE}`);
85351
85704
  return 0;
85352
85705
  }
85353
85706
  let failed = 0;
@@ -85358,7 +85711,7 @@ function validateCommand(argv, ctx) {
85358
85711
  continue;
85359
85712
  }
85360
85713
  if (file2.problems.length === 0) {
85361
- ctx.out(`${(0, import_node_path18.relative)(ctx.cwd, file2.path) || file2.path}: valid`);
85714
+ ctx.out(`${(0, import_node_path19.relative)(ctx.cwd, file2.path) || file2.path}: valid`);
85362
85715
  continue;
85363
85716
  }
85364
85717
  failed++;
@@ -85386,7 +85739,10 @@ var RUNNER = {
85386
85739
  version: package_default.version
85387
85740
  };
85388
85741
  var USAGE = `Usage:
85389
- agentpicks init [--yes] [--force]
85742
+ agentpicks init [--yes] [--force] [--category <category> | --job <line>] [--tool <tool>|none]
85743
+ [--competitors <tool>,...|all] [--repo . | --stack <stack>...]
85744
+ [--agent <agent>...|any] [--runs <n>] [--name <name>]
85745
+ agentpicks catalogue [<category>] [--json]
85390
85746
  agentpicks run [<setup>] [--stack <stack> | --repo <path> [--ref <commit>]]
85391
85747
  [--runs <n>] [--agent claude-code|codex|opencode|pi] [--model <model>]
85392
85748
  [--out <dir>] [--no-upload]
@@ -85408,6 +85764,22 @@ var USAGE = `Usage:
85408
85764
  init Writes a setup file, agentpicks/<name>.yaml, from questions whose defaults come from
85409
85765
  this repository. --yes takes every default without asking. --force replaces a setup
85410
85766
  of the same name. Signed in, DevTune drafts the requests and tools of your own job.
85767
+ Each flag answers one question: --category or --job, --tool, --competitors,
85768
+ --repo . or --stack, --agent, --runs and --name. Flags take keys, never list numbers;
85769
+ --stack and --agent repeat or take a comma list. A question a flag answers isn't
85770
+ asked. A flag value that doesn't read stops init before it asks anything, unless the
85771
+ check needs an earlier answer, such as --competitors against the tool this
85772
+ repository names, which waits for that question. Off a terminal, a question no flag
85773
+ answers takes its default with --yes, where it has one; without --yes, init stops at
85774
+ it and names its flag. A job line's requests and tools
85775
+ have no flags: answer them on a terminal or, signed in, take DevTune's drafts with
85776
+ --yes; off a terminal a job line needs --yes. For a category setup, init ends with
85777
+ the agentpicks init command that writes the same setup in another repository.
85778
+ Typed answers take list numbers or keys; the competitors and stacks answers also
85779
+ take ranges such as 2-4.
85780
+ catalogue Lists the category, tool and stack keys init's flags take: every category and the
85781
+ stacks a job line can run in, or with <category>, its tool keys and stacks. --json
85782
+ prints one JSON object.
85411
85783
  run Tests the coding agent installed here in a fresh Docker container per run, writes
85412
85784
  one bundle per completed run to --out (default ./agentpicks-runs), and uploads it to
85413
85785
  your DevTune project. --no-upload keeps bundles on this machine only, as every run
@@ -85461,11 +85833,12 @@ describes every field.
85461
85833
  `;
85462
85834
  var INTRO = `Test which tools coding agents pick when they build your kind of app.
85463
85835
 
85464
- agentpicks init Write a setup file for this repository
85465
- agentpicks run Run a setup with the coding agent installed here
85466
- agentpicks results Show which tool each run picked
85467
- agentpicks list List this repository's setups and your project's
85468
- agentpicks login Sign in to DevTune to upload runs for its analysis
85836
+ agentpicks init Write a setup file for this repository
85837
+ agentpicks catalogue List the categories, tools and stacks init takes by key
85838
+ agentpicks run Run a setup with the coding agent installed here
85839
+ agentpicks results Show which tool each run picked
85840
+ agentpicks list List this repository's setups and your project's
85841
+ agentpicks login Sign in to DevTune to upload runs for its analysis
85469
85842
 
85470
85843
  Runs need no DevTune account: pass --no-upload to run, or set AGENTPICKS_NO_UPLOAD=1, and
85471
85844
  bundles stay on this machine. To upload them later, sign up at ${signUpUrl()}
@@ -85529,6 +85902,7 @@ async function main(argv, given) {
85529
85902
  if (command === "validate") return validateCommand(rest, ctx);
85530
85903
  if (command === "schema") return schemaCommand(rest, ctx);
85531
85904
  if (command === "results") return resultsCommand(rest, ctx);
85905
+ if (command === "catalogue") return catalogueCommand(rest, ctx);
85532
85906
  ctx.err(`agentpicks has no ${command} command.
85533
85907
 
85534
85908
  ${USAGE}`);
@@ -85558,7 +85932,7 @@ async function runCommand(argv, ctx) {
85558
85932
  );
85559
85933
  const file2 = await runnableSetup(command.setup, ctx);
85560
85934
  if (file2 === null) return 1;
85561
- const shown3 = (0, import_node_path19.relative)(ctx.cwd, file2.path) || file2.path;
85935
+ const shown3 = (0, import_node_path20.relative)(ctx.cwd, file2.path) || file2.path;
85562
85936
  const plan = setupPlan(file2, command.flags, ctx.cwd);
85563
85937
  return runPlan(
85564
85938
  await linkUploads(plan, file2.setup, file2.content, shown3, ctx),
@@ -85598,7 +85972,7 @@ async function pickSetup(ctx) {
85598
85972
  const files = readSetupFiles(root);
85599
85973
  if (files.length === 0) {
85600
85974
  ctx.err(
85601
- `${(0, import_node_path19.join)(root, SETUPS_DIR)} holds no setup files. Write one with: agentpicks init
85975
+ `${(0, import_node_path20.join)(root, SETUPS_DIR)} holds no setup files. Write one with: agentpicks init
85602
85976
 
85603
85977
  Or run a built-in category: agentpicks run --category <category> --stack <stack>.`
85604
85978
  );
@@ -85646,7 +86020,7 @@ async function runPlan(given, ctx, link) {
85646
86020
  const platform = await dockerAccess.platform();
85647
86021
  for (const test of plan.tests) assertStackRuns(test.environment, platform);
85648
86022
  if (repository) assertRepositoryRuns(repository.install, platform);
85649
- const outDir = (0, import_node_path19.resolve)(ctx.cwd, plan.out);
86023
+ const outDir = (0, import_node_path20.resolve)(ctx.cwd, plan.out);
85650
86024
  const { runs } = plan;
85651
86025
  const cells = agentPlans.flatMap(
85652
86026
  (agentPlan, a) => plan.tests.map((test) => ({ agentPlan, a, test }))
@@ -85762,7 +86136,7 @@ async function uploadPrinted(dir, target, ctx, bundle) {
85762
86136
  }
85763
86137
  }
85764
86138
  async function uploadCommand(argv, ctx) {
85765
- const dirs = findBundles((0, import_node_path19.resolve)(ctx.cwd, parseUploadArgs(argv).dir));
86139
+ const dirs = findBundles((0, import_node_path20.resolve)(ctx.cwd, parseUploadArgs(argv).dir));
85766
86140
  let target;
85767
86141
  let uploaded = 0;
85768
86142
  for (const dir of dirs) {
@@ -85888,7 +86262,7 @@ function trackSandboxes(inner) {
85888
86262
  // src/cli.ts
85889
86263
  void main(
85890
86264
  process.argv.slice(2),
85891
- defaultContext((0, import_node_path20.join)(__dirname, "..", "docker"))
86265
+ defaultContext((0, import_node_path21.join)(__dirname, "..", "docker"))
85892
86266
  ).then((code) => {
85893
86267
  process.exitCode = code;
85894
86268
  });