@devtune/agentpicks 0.4.4 → 0.4.5
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/README.md +10 -7
- package/dist/cli.js +134 -75
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,6 +12,8 @@ npx @devtune/agentpicks results
|
|
|
12
12
|
npm install -g @devtune/agentpicks # then: agentpicks run ...
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
Set `AGENTPICKS_NO_UPLOAD=1` to keep every run on this machine without passing `--no-upload`.
|
|
16
|
+
|
|
15
17
|
To have DevTune analyse the runs (what the agent said it picked, pick rates, loss reasons and the Actions that follow), sign in, save the setup and upload what you already ran:
|
|
16
18
|
|
|
17
19
|
```sh
|
|
@@ -20,7 +22,7 @@ npx @devtune/agentpicks push
|
|
|
20
22
|
npx @devtune/agentpicks upload ./agentpicks-runs
|
|
21
23
|
```
|
|
22
24
|
|
|
23
|
-
A kept run uploads once its setup is pushed with the same `from`, add request and tools the run tested. See [Upload](#upload).
|
|
25
|
+
A kept run uploads once its setup is pushed with the same `from`, add request and tools the run tested. See [Upload](#upload). No DevTune account yet? [Sign up](https://devtune.ai/auth/sign-up) and create a project, or have your coding agent [set one up](https://docs.devtune.ai/getting-started/agent-setup).
|
|
24
26
|
|
|
25
27
|
## Requirements
|
|
26
28
|
|
|
@@ -46,7 +48,7 @@ agentpicks run --category error-tracking --repo .
|
|
|
46
48
|
| `--agent` | `claude-code`, `codex`, `opencode` or `pi`. Required when several are installed. |
|
|
47
49
|
| `--model` | The model to ask for. OpenCode and Pi take `anthropic/<model>` or `openai/<model>`. |
|
|
48
50
|
| `--out` | Where bundles go. Default `./agentpicks-runs`. |
|
|
49
|
-
| `--no-upload` | Keep bundles on this machine only. Send them later with `agentpicks upload`; a custom setup's once `agentpicks push` saves it (see [Setups](#setups)). |
|
|
51
|
+
| `--no-upload` | Keep bundles on this machine only. Send them later with `agentpicks upload`; a custom setup's once `agentpicks push` saves it (see [Setups](#setups)). `AGENTPICKS_NO_UPLOAD`, set to anything, does the same for every run. |
|
|
50
52
|
|
|
51
53
|
`agentpicks --help`, or `--help` after any command, prints the usage and exits successfully.
|
|
52
54
|
|
|
@@ -113,7 +115,7 @@ Either login is saved to `agentpicks/credentials.json` under `$XDG_CONFIG_HOME`,
|
|
|
113
115
|
|
|
114
116
|
In CI, set `DEVTUNE_API_KEY` and `DEVTUNE_PROJECT_ID` instead: they override the saved login. Without `DEVTUNE_API_KEY`, a saved sign-in is used only for its own API address and project. `DEVTUNE_API_BASE_URL` sets the API address, default `https://devtune.ai/api/v2`. These are the names the `devtune` CLI reads.
|
|
115
117
|
|
|
116
|
-
`run` checks for a sign-in or key before anything starts, and refuses without one
|
|
118
|
+
`run` checks for a sign-in or key before anything starts, and refuses without one unless you pass `--no-upload` or set `AGENTPICKS_NO_UPLOAD`. Once a run's bundle is written, `run` lists its files, their sizes and the redactions, then uploads it: the manifest to DevTune, and each artifact straight to storage. It prints the run id and the upload's API address. If DevTune refuses the upload, `run` prints DevTune's reason and the command that sends the bundle later, and starts no further runs. The bundle stays on disk either way.
|
|
117
119
|
|
|
118
120
|
A `--repo` run needs the repository to have a remote that `agentpicks` records (see [The bundle](#the-bundle)), since DevTune groups a repository's runs by its remote. Without one, `run` refuses before anything starts; add an `origin` remote, or pass `--no-upload`.
|
|
119
121
|
|
|
@@ -157,6 +159,7 @@ agentpicks init --yes
|
|
|
157
159
|
`agentpicks init` writes a setup file from a few questions. Each shows its default in brackets, and Enter takes it:
|
|
158
160
|
|
|
159
161
|
- **Job**: a built-in category, which the file inherits with `from:`, or a job line of your own. The default is the category of your tool.
|
|
162
|
+
- **Requests**, for a job of your own: the add request a run asks, the recommend request `push` saves with it, and a hosted request or none.
|
|
160
163
|
- **Your tool**: a catalogue tool named by your `package.json` name or scope, or your git remote's repository or owner, such as `sentry` from `getsentry/sentry-docs`.
|
|
161
164
|
- **Competitors**: for a category, its tools; for your own job, typed as npm packages.
|
|
162
165
|
- **Where to test**: `repo: .` in a git repository, else the stacks your `package.json` and lockfiles name (`next`, `@tanstack/react-start`, `@sveltejs/kit` and `express`, a pnpm monorepo's apps included, plus FastAPI and Rails).
|
|
@@ -219,7 +222,7 @@ runs: 3
|
|
|
219
222
|
| `id` | The DevTune setup the file is linked to. `pull` and `push` write it. |
|
|
220
223
|
| `synced` | What the file and its DevTune setup held when they last matched: `setup`, the setup's digest, and `file`, the file's. `pull` and `push` write it; don't edit it. |
|
|
221
224
|
|
|
222
|
-
`schema/setup.v1.json` in this package
|
|
225
|
+
`agentpicks schema` prints the file's JSON Schema. It is `schema/setup.v1.json` in this package, and each version's is at `https://raw.githubusercontent.com/devtunehq/agentpicks/v<version>/schema/setup.v1.json`. `init` and `pull` start a file with `# yaml-language-server: $schema=<that address>`, so an editor with YAML support completes and checks it. To have a coding agent write a setup, give it the schema and this section, and have it run `agentpicks validate` until the file passes.
|
|
223
226
|
|
|
224
227
|
```sh
|
|
225
228
|
agentpicks run feature-flags --no-upload
|
|
@@ -278,7 +281,7 @@ jobs:
|
|
|
278
281
|
steps:
|
|
279
282
|
- uses: actions/checkout@v5
|
|
280
283
|
- run: npm install -g @anthropic-ai/claude-code@2.1.323
|
|
281
|
-
- uses: devtunehq/agentpicks@v0.4.
|
|
284
|
+
- uses: devtunehq/agentpicks@v0.4.5
|
|
282
285
|
with:
|
|
283
286
|
setup: agentpicks/error-tracking.yaml
|
|
284
287
|
agent: claude-code
|
|
@@ -292,7 +295,7 @@ jobs:
|
|
|
292
295
|
|
|
293
296
|
Use a Linux runner: `ubuntu-latest` has Docker and Node.js 20 or later. Without Docker, `run` refuses; without Node.js 20 or later, the action does. The action uses the runner's Node.js and doesn't change it for later steps.
|
|
294
297
|
|
|
295
|
-
Pin a release tag, such as `v0.4.
|
|
298
|
+
Pin a release tag, such as `v0.4.5`. The action runs the `@devtune/agentpicks` version in the `package.json` of its ref, so a tag runs the same CLI every time. A branch moves to each new version when the mirror syncs, and fails while that version isn't on npm.
|
|
296
299
|
|
|
297
300
|
| Input | Passed as |
|
|
298
301
|
|---|---|
|
|
@@ -333,7 +336,7 @@ Install Docker, Node.js 20 or later and the agent, set `DEVTUNE_API_KEY`, `DEVTU
|
|
|
333
336
|
|
|
334
337
|
```sh
|
|
335
338
|
npm install -g @anthropic-ai/claude-code@2.1.323
|
|
336
|
-
npx --yes @devtune/agentpicks@0.4.
|
|
339
|
+
npx --yes @devtune/agentpicks@0.4.5 run error-tracking --agent claude-code
|
|
337
340
|
```
|
|
338
341
|
|
|
339
342
|
## The bundle
|
package/dist/cli.js
CHANGED
|
@@ -7365,17 +7365,17 @@ var require_dist = __commonJS({
|
|
|
7365
7365
|
});
|
|
7366
7366
|
|
|
7367
7367
|
// src/cli.ts
|
|
7368
|
-
var
|
|
7368
|
+
var import_node_path20 = require("node:path");
|
|
7369
7369
|
|
|
7370
7370
|
// src/cli/main.ts
|
|
7371
7371
|
var import_node_crypto10 = require("node:crypto");
|
|
7372
|
-
var
|
|
7372
|
+
var import_node_path19 = 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.
|
|
7378
|
+
version: "0.4.5",
|
|
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: {
|
|
@@ -7444,10 +7444,6 @@ var package_default = {
|
|
|
7444
7444
|
}
|
|
7445
7445
|
};
|
|
7446
7446
|
|
|
7447
|
-
// src/sandbox/docker.ts
|
|
7448
|
-
var import_node_child_process = require("node:child_process");
|
|
7449
|
-
var import_node_crypto = require("node:crypto");
|
|
7450
|
-
|
|
7451
7447
|
// src/assets/script.ts
|
|
7452
7448
|
var SANDBOX_ROOT = "/opt/agent-picks";
|
|
7453
7449
|
function script(strings) {
|
|
@@ -7456,6 +7452,13 @@ function script(strings) {
|
|
|
7456
7452
|
function shellQuote(value) {
|
|
7457
7453
|
return `'${value.replaceAll("'", `'\\''`)}'`;
|
|
7458
7454
|
}
|
|
7455
|
+
function shellArg(value) {
|
|
7456
|
+
return /^[\w./:@%+=,-]+$/.test(value) ? value : shellQuote(value);
|
|
7457
|
+
}
|
|
7458
|
+
|
|
7459
|
+
// src/sandbox/docker.ts
|
|
7460
|
+
var import_node_child_process = require("node:child_process");
|
|
7461
|
+
var import_node_crypto = require("node:crypto");
|
|
7459
7462
|
|
|
7460
7463
|
// src/sandbox/platform.ts
|
|
7461
7464
|
var PLATFORMS = {
|
|
@@ -28870,10 +28873,10 @@ function mergeEarlyStop(base, entries2, listedKeys) {
|
|
|
28870
28873
|
const configNames = unique(
|
|
28871
28874
|
stopping.flatMap((tool) => tool.signals.configNames ?? [])
|
|
28872
28875
|
).map(escapeEre);
|
|
28873
|
-
const
|
|
28876
|
+
const join16 = (inherited, added) => [inherited, ...added].filter(Boolean).join("|") || NEVER_PATTERN;
|
|
28874
28877
|
return {
|
|
28875
|
-
installPattern:
|
|
28876
|
-
codePattern:
|
|
28878
|
+
installPattern: join16(base?.installPattern, packages),
|
|
28879
|
+
codePattern: join16(base?.codePattern, configNames),
|
|
28877
28880
|
...base?.pathPattern ? { pathPattern: base.pathPattern } : {}
|
|
28878
28881
|
};
|
|
28879
28882
|
}
|
|
@@ -35628,6 +35631,13 @@ var setupFileSchema = external_exports.object({
|
|
|
35628
35631
|
),
|
|
35629
35632
|
runs: external_exports.number().int().min(1).max(100).optional().describe("How many runs per agent and stack. Default 1.")
|
|
35630
35633
|
}).strict();
|
|
35634
|
+
function setupJsonSchema() {
|
|
35635
|
+
return {
|
|
35636
|
+
...external_exports.toJSONSchema(setupFileSchema, { io: "input" }),
|
|
35637
|
+
title: "Agent Picks setup",
|
|
35638
|
+
description: "What agentpicks run tests: a job, its requests, your tool and its competitors, stacks or your repository, agents and runs. See https://www.npmjs.com/package/@devtune/agentpicks."
|
|
35639
|
+
};
|
|
35640
|
+
}
|
|
35631
35641
|
|
|
35632
35642
|
// src/setup/files.ts
|
|
35633
35643
|
var SETUPS_DIR = "agentpicks";
|
|
@@ -80727,6 +80737,10 @@ function apiRoot(value) {
|
|
|
80727
80737
|
return null;
|
|
80728
80738
|
return url2.href.replace(/\/$/, "");
|
|
80729
80739
|
}
|
|
80740
|
+
function signUpUrl(baseUrl = DEFAULT_API_BASE_URL) {
|
|
80741
|
+
return new URL("/auth/sign-up", baseUrl).href;
|
|
80742
|
+
}
|
|
80743
|
+
var AGENT_SETUP_URL = "https://docs.devtune.ai/getting-started/agent-setup";
|
|
80730
80744
|
function apiBaseUrl(env) {
|
|
80731
80745
|
const value = env.DEVTUNE_API_BASE_URL || DEFAULT_API_BASE_URL;
|
|
80732
80746
|
const root = apiRoot(value);
|
|
@@ -80774,7 +80788,7 @@ function devtuneTarget(io, purpose = "upload") {
|
|
|
80774
80788
|
const projectId = io.env.DEVTUNE_PROJECT_ID || saved?.projectId;
|
|
80775
80789
|
if (!apiKey || !projectId)
|
|
80776
80790
|
throw new NotLoggedInError(
|
|
80777
|
-
purpose === "setups" ? "Pushing or pulling setups needs a DevTune sign-in or project API key. Run agentpicks login, or set DEVTUNE_API_KEY and DEVTUNE_PROJECT_ID." : "Uploading needs a DevTune sign-in or project API key. Run agentpicks login, or set DEVTUNE_API_KEY and DEVTUNE_PROJECT_ID. To keep bundles on this machine only, pass --no-upload."
|
|
80791
|
+
purpose === "setups" ? "Pushing or pulling setups needs a DevTune sign-in or project API key. Run agentpicks login, or set DEVTUNE_API_KEY and DEVTUNE_PROJECT_ID." : "Uploading needs a DevTune sign-in or project API key. Run agentpicks login, or set DEVTUNE_API_KEY and DEVTUNE_PROJECT_ID. To keep bundles on this machine only, pass --no-upload, or set AGENTPICKS_NO_UPLOAD=1 for every run."
|
|
80778
80792
|
);
|
|
80779
80793
|
if (io.env.DEVTUNE_API_KEY) assertApiKey(apiKey, "DEVTUNE_API_KEY");
|
|
80780
80794
|
if (!external_exports.uuid().safeParse(projectId).success)
|
|
@@ -80969,6 +80983,8 @@ async function readSecretLine(prompt) {
|
|
|
80969
80983
|
var import_node_crypto8 = require("node:crypto");
|
|
80970
80984
|
var import_node_fs5 = require("node:fs");
|
|
80971
80985
|
var import_node_path9 = require("node:path");
|
|
80986
|
+
var SETUP_SCHEMA_URL = `https://raw.githubusercontent.com/devtunehq/agentpicks/v${package_default.version}/schema/setup.v1.json`;
|
|
80987
|
+
var SCHEMA_LINE = `# yaml-language-server: $schema=${SETUP_SCHEMA_URL}`;
|
|
80972
80988
|
function isSymlink(path) {
|
|
80973
80989
|
try {
|
|
80974
80990
|
return (0, import_node_fs5.lstatSync)(path).isSymbolicLink();
|
|
@@ -81164,7 +81180,7 @@ function pushedSince(record2, dir, shown3, ctx) {
|
|
|
81164
81180
|
`${shown3} tested a version of ${record2.name} that the file no longer holds, so no push can save what it tested. ${runAgain}`
|
|
81165
81181
|
);
|
|
81166
81182
|
throw new UsageError(
|
|
81167
|
-
`${shown3} tested what ${record2.name} holds now, which isn't saved to DevTune yet. Run agentpicks push ${record2.name}, then agentpicks upload ${dir} again.`
|
|
81183
|
+
`${shown3} tested what ${record2.name} holds now, which isn't saved to DevTune yet. Run agentpicks push ${record2.name}, then agentpicks upload ${shellArg(dir)} again.`
|
|
81168
81184
|
);
|
|
81169
81185
|
}
|
|
81170
81186
|
if (!asked || record2.id && record2.id !== content.id)
|
|
@@ -81872,7 +81888,8 @@ async function initCommand(argv, ctx) {
|
|
|
81872
81888
|
});
|
|
81873
81889
|
if (runs !== 1) file2.runs = runs;
|
|
81874
81890
|
const dir = (0, import_node_path13.join)(wizard.detected.root, SETUPS_DIR);
|
|
81875
|
-
const text3 =
|
|
81891
|
+
const text3 = `${SCHEMA_LINE}
|
|
81892
|
+
${(0, import_yaml5.stringify)(file2)}`;
|
|
81876
81893
|
const name = await ask(wizard, {
|
|
81877
81894
|
label: "Name",
|
|
81878
81895
|
fallback: file2.from ?? slug(file2.job),
|
|
@@ -81898,18 +81915,34 @@ async function initCommand(argv, ctx) {
|
|
|
81898
81915
|
ctx.out("");
|
|
81899
81916
|
ctx.out(`Wrote ${shown3}:`);
|
|
81900
81917
|
ctx.out("");
|
|
81901
|
-
for (const line2 of text3.trimEnd().split("\n")) ctx.out(` ${line2}`);
|
|
81918
|
+
for (const line2 of text3.trimEnd().split("\n").slice(1)) ctx.out(` ${line2}`);
|
|
81902
81919
|
ctx.out("");
|
|
81903
81920
|
if (!file2.agents)
|
|
81904
81921
|
ctx.out(
|
|
81905
81922
|
"It names no agents, so run uses the one agent installed where it runs."
|
|
81906
81923
|
);
|
|
81907
81924
|
const custom2 = checkSetupText(path, text3).setup.customReason !== null;
|
|
81908
|
-
ctx.
|
|
81909
|
-
|
|
81910
|
-
)
|
|
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
|
+
);
|
|
81911
81936
|
return 0;
|
|
81912
81937
|
}
|
|
81938
|
+
function signedIn(io) {
|
|
81939
|
+
try {
|
|
81940
|
+
devtuneTarget(io);
|
|
81941
|
+
return true;
|
|
81942
|
+
} catch {
|
|
81943
|
+
return false;
|
|
81944
|
+
}
|
|
81945
|
+
}
|
|
81913
81946
|
function parseInitArgs(argv) {
|
|
81914
81947
|
try {
|
|
81915
81948
|
const { values } = (0, import_node_util2.parseArgs)({
|
|
@@ -82049,13 +82082,14 @@ async function askCustomJob(wizard, line2) {
|
|
|
82049
82082
|
}
|
|
82050
82083
|
async function askRequest(wizard, intent, drafted) {
|
|
82051
82084
|
const draft = drafted?.requests.find((r) => r.intent === intent)?.text;
|
|
82085
|
+
const optional2 = intent === "hosted";
|
|
82052
82086
|
return ask(wizard, {
|
|
82053
|
-
label: intent === "add" ? "The add request, which a run asks" : `The ${intent} request, or none`,
|
|
82054
|
-
fallback: draft ?? (
|
|
82087
|
+
label: intent === "add" ? "The add request, which a run asks" : intent === "recommend" ? "The recommend request, which DevTune saves with the add request" : `The ${intent} request, or none`,
|
|
82088
|
+
fallback: draft ?? (optional2 ? "none" : null),
|
|
82055
82089
|
read: (answer) => {
|
|
82056
|
-
if (answer === "none" &&
|
|
82090
|
+
if (answer === "none" && optional2) return { value: null };
|
|
82057
82091
|
return !badLength(answer) ? { value: answer } : {
|
|
82058
|
-
problem: `Write the ${intent} request in ${SETUP_REQUEST_MIN_LENGTH} to ${SETUP_TEXT_MAX_LENGTH} characters${
|
|
82092
|
+
problem: `Write the ${intent} request in ${SETUP_REQUEST_MIN_LENGTH} to ${SETUP_TEXT_MAX_LENGTH} characters${optional2 ? ", or none" : ""}.`
|
|
82059
82093
|
};
|
|
82060
82094
|
}
|
|
82061
82095
|
});
|
|
@@ -82422,7 +82456,8 @@ async function loginCommand(argv, ctx) {
|
|
|
82422
82456
|
baseUrl,
|
|
82423
82457
|
notify: (url2) => ctx.out(
|
|
82424
82458
|
`Open this address in a browser to sign in and choose your project:
|
|
82425
|
-
${url2}
|
|
82459
|
+
${url2}
|
|
82460
|
+
No DevTune project yet? Sign up at ${signUpUrl(baseUrl)} and create one, or have your coding agent set one up (${AGENT_SETUP_URL}), then run agentpicks login again.`
|
|
82426
82461
|
),
|
|
82427
82462
|
openBrowser: args.noBrowser ? null : ctx.openBrowser ?? openBrowser,
|
|
82428
82463
|
browserUnavailable: () => ctx.out(
|
|
@@ -82631,10 +82666,11 @@ function pullOne(setup, root, files, devtune, force, ctx) {
|
|
|
82631
82666
|
writeSetupText(
|
|
82632
82667
|
(0, import_node_path15.join)(root, SETUPS_DIR),
|
|
82633
82668
|
path,
|
|
82634
|
-
|
|
82669
|
+
`${SCHEMA_LINE}
|
|
82670
|
+
${linkedSetupYaml(mapped.file, {
|
|
82635
82671
|
id: setup.id,
|
|
82636
82672
|
setupDigest: setup.snapshot_digest
|
|
82637
|
-
})
|
|
82673
|
+
})}`,
|
|
82638
82674
|
{ replace: force || local !== void 0, shown: (at) => shown(at, ctx) }
|
|
82639
82675
|
);
|
|
82640
82676
|
} catch (error62) {
|
|
@@ -85295,6 +85331,55 @@ function isDockerSandbox(box) {
|
|
|
85295
85331
|
return "imageDigest" in box && typeof box.imageDigest === "function";
|
|
85296
85332
|
}
|
|
85297
85333
|
|
|
85334
|
+
// src/cli/validate-command.ts
|
|
85335
|
+
var import_node_path18 = require("node:path");
|
|
85336
|
+
function validateCommand(argv, ctx) {
|
|
85337
|
+
const flag = argv.find((arg) => arg.startsWith("-"));
|
|
85338
|
+
if (flag)
|
|
85339
|
+
throw new UsageError(`agentpicks validate takes no flags, not ${flag}.`);
|
|
85340
|
+
const root = setupsRoot(ctx.cwd);
|
|
85341
|
+
const files = argv.length > 0 ? argv.map((arg) => {
|
|
85342
|
+
try {
|
|
85343
|
+
return readSetupFile(findSetup(arg, ctx.cwd));
|
|
85344
|
+
} catch (error62) {
|
|
85345
|
+
if (!(error62 instanceof UsageError)) throw error62;
|
|
85346
|
+
return { path: arg, error: error62.message };
|
|
85347
|
+
}
|
|
85348
|
+
}) : readSetupFiles(root);
|
|
85349
|
+
if (files.length === 0) {
|
|
85350
|
+
ctx.out(`${(0, import_node_path18.join)(root, SETUPS_DIR)} holds no setup files. ${WRITE_ONE}`);
|
|
85351
|
+
return 0;
|
|
85352
|
+
}
|
|
85353
|
+
let failed = 0;
|
|
85354
|
+
for (const file2 of files) {
|
|
85355
|
+
if ("error" in file2) {
|
|
85356
|
+
failed++;
|
|
85357
|
+
ctx.err(file2.error);
|
|
85358
|
+
continue;
|
|
85359
|
+
}
|
|
85360
|
+
if (file2.problems.length === 0) {
|
|
85361
|
+
ctx.out(`${(0, import_node_path18.relative)(ctx.cwd, file2.path) || file2.path}: valid`);
|
|
85362
|
+
continue;
|
|
85363
|
+
}
|
|
85364
|
+
failed++;
|
|
85365
|
+
for (const problem of file2.problems)
|
|
85366
|
+
ctx.err(formatProblem(file2.path, problem, ctx.cwd));
|
|
85367
|
+
}
|
|
85368
|
+
const count = files.length;
|
|
85369
|
+
ctx.out(
|
|
85370
|
+
`${count - failed} of ${count} setup file${count === 1 ? "" : "s"} valid.`
|
|
85371
|
+
);
|
|
85372
|
+
return failed === 0 ? 0 : 1;
|
|
85373
|
+
}
|
|
85374
|
+
function schemaCommand(argv, ctx) {
|
|
85375
|
+
if (argv.length > 0)
|
|
85376
|
+
throw new UsageError(
|
|
85377
|
+
`agentpicks schema takes no arguments, not ${argv[0]}.`
|
|
85378
|
+
);
|
|
85379
|
+
ctx.out(JSON.stringify(setupJsonSchema(), null, 2));
|
|
85380
|
+
return 0;
|
|
85381
|
+
}
|
|
85382
|
+
|
|
85298
85383
|
// src/cli/main.ts
|
|
85299
85384
|
var RUNNER = {
|
|
85300
85385
|
name: "@devtune/agentpicks",
|
|
@@ -85312,6 +85397,7 @@ var USAGE = `Usage:
|
|
|
85312
85397
|
agentpicks pull [<setup>] [--force]
|
|
85313
85398
|
agentpicks push [<setup>]
|
|
85314
85399
|
agentpicks validate [<setup>...]
|
|
85400
|
+
agentpicks schema
|
|
85315
85401
|
agentpicks upload <dir>
|
|
85316
85402
|
agentpicks results [<dir>...] [--json]
|
|
85317
85403
|
agentpicks login [--no-browser]
|
|
@@ -85324,7 +85410,8 @@ init Writes a setup file, agentpicks/<name>.yaml, from questions whose defa
|
|
|
85324
85410
|
of the same name. Signed in, DevTune drafts the requests and tools of your own job.
|
|
85325
85411
|
run Tests the coding agent installed here in a fresh Docker container per run, writes
|
|
85326
85412
|
one bundle per completed run to --out (default ./agentpicks-runs), and uploads it to
|
|
85327
|
-
your DevTune project. --no-upload keeps bundles on this machine only
|
|
85413
|
+
your DevTune project. --no-upload keeps bundles on this machine only, as every run
|
|
85414
|
+
does while AGENTPICKS_NO_UPLOAD is set to anything. --repo tests
|
|
85328
85415
|
your repository's committed files at HEAD, or at --ref; uncommitted changes aren't
|
|
85329
85416
|
included. Uploading a --repo run needs the repository to have a remote.
|
|
85330
85417
|
<setup> is a setup file's name in the repository's agentpicks folder, or its path,
|
|
@@ -85347,6 +85434,8 @@ push Saves a setup file, or every one, to DevTune and links it. A setup cha
|
|
|
85347
85434
|
DevTune since the file last saw it is refused as setup_changed: pull first.
|
|
85348
85435
|
validate Checks every setup file, or the ones named, against the setup schema and the
|
|
85349
85436
|
catalogue. Exits non-zero if any fails, naming the file and field.
|
|
85437
|
+
schema Prints the setup file's JSON Schema, which is also at
|
|
85438
|
+
${SETUP_SCHEMA_URL}
|
|
85350
85439
|
upload Uploads a bundle directory, or every bundle in an --out directory. Uploading again
|
|
85351
85440
|
sends only what isn't stored yet. A custom setup's bundle, or one of changes not
|
|
85352
85441
|
pushed, uploads once agentpicks push has saved the add request and tools it tested.
|
|
@@ -85367,15 +85456,21 @@ A setup file, agentpicks/error-tracking.yaml:
|
|
|
85367
85456
|
from: error-tracking
|
|
85368
85457
|
stacks: [nextjs]
|
|
85369
85458
|
|
|
85370
|
-
|
|
85459
|
+
init and pull start each file with a line that points an editor at the schema; the README
|
|
85460
|
+
describes every field.
|
|
85371
85461
|
`;
|
|
85372
85462
|
var INTRO = `Test which tools coding agents pick when they build your kind of app.
|
|
85373
85463
|
|
|
85374
|
-
agentpicks login Sign in to your DevTune project
|
|
85375
85464
|
agentpicks init Write a setup file for this repository
|
|
85376
85465
|
agentpicks run Run a setup with the coding agent installed here
|
|
85377
85466
|
agentpicks results Show which tool each run picked
|
|
85378
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
|
|
85469
|
+
|
|
85470
|
+
Runs need no DevTune account: pass --no-upload to run, or set AGENTPICKS_NO_UPLOAD=1, and
|
|
85471
|
+
bundles stay on this machine. To upload them later, sign up at ${signUpUrl()}
|
|
85472
|
+
and create a project, or have your coding agent set one up:
|
|
85473
|
+
${AGENT_SETUP_URL}
|
|
85379
85474
|
|
|
85380
85475
|
agentpicks --help lists every command and flag.`;
|
|
85381
85476
|
function defaultContext(dockerfileDir) {
|
|
@@ -85432,6 +85527,7 @@ async function main(argv, given) {
|
|
|
85432
85527
|
if (command === "pull") return await pullCommand(rest, ctx);
|
|
85433
85528
|
if (command === "push") return await pushCommand(rest, ctx);
|
|
85434
85529
|
if (command === "validate") return validateCommand(rest, ctx);
|
|
85530
|
+
if (command === "schema") return schemaCommand(rest, ctx);
|
|
85435
85531
|
if (command === "results") return resultsCommand(rest, ctx);
|
|
85436
85532
|
ctx.err(`agentpicks has no ${command} command.
|
|
85437
85533
|
|
|
@@ -85452,6 +85548,8 @@ function docker2(ctx) {
|
|
|
85452
85548
|
}
|
|
85453
85549
|
async function runCommand(argv, ctx) {
|
|
85454
85550
|
const command = parseRunCommand(argv, { picker: Boolean(ctx.interactive) });
|
|
85551
|
+
if (ctx.io.env.AGENTPICKS_NO_UPLOAD)
|
|
85552
|
+
(command.kind === "category" ? command.args : command.flags).upload = false;
|
|
85455
85553
|
if (command.kind === "category")
|
|
85456
85554
|
return runPlan(
|
|
85457
85555
|
categoryPlan(command.args, ctx.cwd),
|
|
@@ -85460,7 +85558,7 @@ async function runCommand(argv, ctx) {
|
|
|
85460
85558
|
);
|
|
85461
85559
|
const file2 = await runnableSetup(command.setup, ctx);
|
|
85462
85560
|
if (file2 === null) return 1;
|
|
85463
|
-
const shown3 = (0,
|
|
85561
|
+
const shown3 = (0, import_node_path19.relative)(ctx.cwd, file2.path) || file2.path;
|
|
85464
85562
|
const plan = setupPlan(file2, command.flags, ctx.cwd);
|
|
85465
85563
|
return runPlan(
|
|
85466
85564
|
await linkUploads(plan, file2.setup, file2.content, shown3, ctx),
|
|
@@ -85500,7 +85598,7 @@ async function pickSetup(ctx) {
|
|
|
85500
85598
|
const files = readSetupFiles(root);
|
|
85501
85599
|
if (files.length === 0) {
|
|
85502
85600
|
ctx.err(
|
|
85503
|
-
`${(0,
|
|
85601
|
+
`${(0, import_node_path19.join)(root, SETUPS_DIR)} holds no setup files. Write one with: agentpicks init
|
|
85504
85602
|
|
|
85505
85603
|
Or run a built-in category: agentpicks run --category <category> --stack <stack>.`
|
|
85506
85604
|
);
|
|
@@ -85548,7 +85646,7 @@ async function runPlan(given, ctx, link) {
|
|
|
85548
85646
|
const platform = await dockerAccess.platform();
|
|
85549
85647
|
for (const test of plan.tests) assertStackRuns(test.environment, platform);
|
|
85550
85648
|
if (repository) assertRepositoryRuns(repository.install, platform);
|
|
85551
|
-
const outDir = (0,
|
|
85649
|
+
const outDir = (0, import_node_path19.resolve)(ctx.cwd, plan.out);
|
|
85552
85650
|
const { runs } = plan;
|
|
85553
85651
|
const cells = agentPlans.flatMap(
|
|
85554
85652
|
(agentPlan, a) => plan.tests.map((test) => ({ agentPlan, a, test }))
|
|
@@ -85567,10 +85665,9 @@ async function runPlan(given, ctx, link) {
|
|
|
85567
85665
|
);
|
|
85568
85666
|
for (const each of credentials)
|
|
85569
85667
|
for (const line2 of each.summary) ctx.out(line2);
|
|
85570
|
-
|
|
85571
|
-
|
|
85572
|
-
|
|
85573
|
-
);
|
|
85668
|
+
ctx.out(
|
|
85669
|
+
target ? `Uploads each bundle to DevTune project ${target.projectId} once it is written.` : `Keeps each bundle on this machine only. agentpicks upload ${shellArg(plan.out)} sends them to DevTune later.`
|
|
85670
|
+
);
|
|
85574
85671
|
ctx.out(runRequirements());
|
|
85575
85672
|
const image = await ensureSandboxImage({
|
|
85576
85673
|
version: RUNNER.version,
|
|
@@ -85659,13 +85756,13 @@ async function uploadPrinted(dir, target, ctx, bundle) {
|
|
|
85659
85756
|
if (!(error62 instanceof UploadError)) throw error62;
|
|
85660
85757
|
ctx.err(error62.message);
|
|
85661
85758
|
ctx.err(
|
|
85662
|
-
`The bundle stays in ${dir}. Send it with: agentpicks upload ${dir}`
|
|
85759
|
+
`The bundle stays in ${dir}. Send it with: agentpicks upload ${shellArg(dir)}`
|
|
85663
85760
|
);
|
|
85664
85761
|
return false;
|
|
85665
85762
|
}
|
|
85666
85763
|
}
|
|
85667
85764
|
async function uploadCommand(argv, ctx) {
|
|
85668
|
-
const dirs = findBundles((0,
|
|
85765
|
+
const dirs = findBundles((0, import_node_path19.resolve)(ctx.cwd, parseUploadArgs(argv).dir));
|
|
85669
85766
|
let target;
|
|
85670
85767
|
let uploaded = 0;
|
|
85671
85768
|
for (const dir of dirs) {
|
|
@@ -85704,44 +85801,6 @@ async function uploadCommand(argv, ctx) {
|
|
|
85704
85801
|
ctx.out(`${uploaded} of ${dirs.length} bundles uploaded to DevTune.`);
|
|
85705
85802
|
return uploaded === dirs.length ? 0 : 1;
|
|
85706
85803
|
}
|
|
85707
|
-
function validateCommand(argv, ctx) {
|
|
85708
|
-
const flag = argv.find((arg) => arg.startsWith("-"));
|
|
85709
|
-
if (flag)
|
|
85710
|
-
throw new UsageError(`agentpicks validate takes no flags, not ${flag}.`);
|
|
85711
|
-
const root = setupsRoot(ctx.cwd);
|
|
85712
|
-
const files = argv.length > 0 ? argv.map((arg) => {
|
|
85713
|
-
try {
|
|
85714
|
-
return readSetupFile(findSetup(arg, ctx.cwd));
|
|
85715
|
-
} catch (error62) {
|
|
85716
|
-
if (!(error62 instanceof UsageError)) throw error62;
|
|
85717
|
-
return { path: arg, error: error62.message };
|
|
85718
|
-
}
|
|
85719
|
-
}) : readSetupFiles(root);
|
|
85720
|
-
if (files.length === 0) {
|
|
85721
|
-
ctx.out(`${(0, import_node_path18.join)(root, SETUPS_DIR)} holds no setup files. ${WRITE_ONE}`);
|
|
85722
|
-
return 0;
|
|
85723
|
-
}
|
|
85724
|
-
let failed = 0;
|
|
85725
|
-
for (const file2 of files) {
|
|
85726
|
-
if ("error" in file2) {
|
|
85727
|
-
failed++;
|
|
85728
|
-
ctx.err(file2.error);
|
|
85729
|
-
continue;
|
|
85730
|
-
}
|
|
85731
|
-
if (file2.problems.length === 0) {
|
|
85732
|
-
ctx.out(`${(0, import_node_path18.relative)(ctx.cwd, file2.path) || file2.path}: valid`);
|
|
85733
|
-
continue;
|
|
85734
|
-
}
|
|
85735
|
-
failed++;
|
|
85736
|
-
for (const problem of file2.problems)
|
|
85737
|
-
ctx.err(formatProblem(file2.path, problem, ctx.cwd));
|
|
85738
|
-
}
|
|
85739
|
-
const count = files.length;
|
|
85740
|
-
ctx.out(
|
|
85741
|
-
`${count - failed} of ${count} setup file${count === 1 ? "" : "s"} valid.`
|
|
85742
|
-
);
|
|
85743
|
-
return failed === 0 ? 0 : 1;
|
|
85744
|
-
}
|
|
85745
85804
|
async function cleanupCommand(ctx) {
|
|
85746
85805
|
const dockerAccess = docker2(ctx);
|
|
85747
85806
|
await dockerAccess.version();
|
|
@@ -85829,7 +85888,7 @@ function trackSandboxes(inner) {
|
|
|
85829
85888
|
// src/cli.ts
|
|
85830
85889
|
void main(
|
|
85831
85890
|
process.argv.slice(2),
|
|
85832
|
-
defaultContext((0,
|
|
85891
|
+
defaultContext((0, import_node_path20.join)(__dirname, "..", "docker"))
|
|
85833
85892
|
).then((code) => {
|
|
85834
85893
|
process.exitCode = code;
|
|
85835
85894
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devtune/agentpicks",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"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",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"engines": {
|