badgr-cli 1.1.0 → 1.1.2

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 (66) hide show
  1. package/LICENSE +207 -0
  2. package/README.md +135 -3
  3. package/package.json +44 -2
  4. package/src/api.js +16 -0
  5. package/src/badgr.js +2 -2
  6. package/src/commands/batch.js +11 -0
  7. package/src/commands/comfyui.js +31 -15
  8. package/src/commands/embed.js +13 -10
  9. package/src/commands/launch.js +8 -1
  10. package/src/commands/login.js +75 -20
  11. package/src/commands/run.js +45 -13
  12. package/src/commands/sbatch.js +6 -1
  13. package/src/commands/serve.js +44 -30
  14. package/src/commands/train.js +8 -12
  15. package/src/commands/transcribe.js +13 -10
  16. package/src/envFlag.js +10 -0
  17. package/src/onboarding.js +8 -1
  18. package/src/progress.js +48 -0
  19. package/tests/agent-images.test.js +0 -17
  20. package/tests/api.test.js +0 -168
  21. package/tests/artifactDownload.test.js +0 -113
  22. package/tests/artifacts.test.js +0 -168
  23. package/tests/batch.test.js +0 -641
  24. package/tests/browser.test.js +0 -51
  25. package/tests/capacity.test.js +0 -68
  26. package/tests/commands.test.js +0 -417
  27. package/tests/config.test.js +0 -96
  28. package/tests/connect.test.js +0 -83
  29. package/tests/detect.test.js +0 -191
  30. package/tests/down.test.js +0 -150
  31. package/tests/errors.test.js +0 -130
  32. package/tests/fallback-timeout.test.js +0 -41
  33. package/tests/fanout.test.js +0 -124
  34. package/tests/gpu-doctor-classifiers.test.js +0 -402
  35. package/tests/gpu-doctor-doctor.test.js +0 -304
  36. package/tests/gpu-doctor-probe-cache.test.js +0 -110
  37. package/tests/gpu-doctor-probes.test.js +0 -257
  38. package/tests/heartbeat.test.js +0 -70
  39. package/tests/job-progress-poll.test.js +0 -136
  40. package/tests/launch-command-argv.test.js +0 -93
  41. package/tests/launch-readiness.test.js +0 -403
  42. package/tests/launch.test.js +0 -440
  43. package/tests/onboarding.test.js +0 -134
  44. package/tests/productized-dry-run.test.js +0 -141
  45. package/tests/productized-runners.test.js +0 -237
  46. package/tests/pull.test.js +0 -266
  47. package/tests/rerun.test.js +0 -94
  48. package/tests/restart.test.js +0 -88
  49. package/tests/router.test.js +0 -98
  50. package/tests/run-lifecycle.test.js +0 -1054
  51. package/tests/sbatch.test.js +0 -190
  52. package/tests/secrets.test.js +0 -16
  53. package/tests/serve-apps.test.js +0 -189
  54. package/tests/serve-lifecycle.test.js +0 -931
  55. package/tests/slurm.test.js +0 -77
  56. package/tests/spec.test.js +0 -201
  57. package/tests/status.test.js +0 -73
  58. package/tests/store.test.js +0 -187
  59. package/tests/task.test.js +0 -109
  60. package/tests/template.test.js +0 -556
  61. package/tests/train-lora-dataset.test.js +0 -176
  62. package/tests/upload.test.js +0 -79
  63. package/tests/workload-rerun.test.js +0 -56
  64. package/tests/workload-spec.test.js +0 -180
  65. package/tests/workload-templates.test.js +0 -865
  66. package/tests/workload-workspace-paths.test.js +0 -46
package/LICENSE ADDED
@@ -0,0 +1,207 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submitted" means any form of electronic, verbal,
51
+ or written communication sent to the Licensor or its representatives,
52
+ including but not limited to communication on electronic mailing lists,
53
+ source code control systems, and issue tracking systems that are managed
54
+ by, or on behalf of, the Licensor for the purpose of discussing and
55
+ improving the Work, but excluding communication that is conspicuously
56
+ marked or designated in writing by the copyright owner as "Not a
57
+ Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
60
+ whom a Contribution has been received by the Licensor and included
61
+ within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of
64
+ this License, each Contributor hereby grants to You a perpetual,
65
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66
+ copyright license to reproduce, prepare Derivative Works of,
67
+ publicly display, publicly perform, sublicense, and distribute the
68
+ Work and such Derivative Works in Source or Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ (except as stated in this section) patent license to make, have made,
74
+ use, offer to sell, sell, import, and otherwise transfer the Work,
75
+ where such license applies only to those patent claims licensable
76
+ by such Contributor that are necessarily infringed by their
77
+ Contribution(s) alone or by the combination of their Contribution(s)
78
+ with the Work to which such Contribution(s) was submitted. If You
79
+ institute patent litigation against any entity (including a cross-claim
80
+ or counterclaim in a lawsuit) alleging that the Work or any
81
+ Contribution embodied within the Work constitutes direct or
82
+ contributory patent infringement, then any patent licenses granted to
83
+ You under this License for that Work shall terminate as of the date
84
+ such litigation is filed.
85
+
86
+ 4. Redistribution. You may reproduce and distribute copies of the
87
+ Work or Derivative Works thereof in any medium, with or without
88
+ modifications, and in Source or Object form, provided that You
89
+ meet the following conditions:
90
+
91
+ (a) You must give any other recipients of the Work or Derivative
92
+ Works a copy of this License; and
93
+
94
+ (b) You must cause any modified files to carry prominent notices
95
+ stating that You changed the files; and
96
+
97
+ (c) You must retain, in the Source form of any Derivative Works
98
+ that You distribute, all copyright, patent, trademark, and
99
+ attribution notices from the Source form of the Work,
100
+ excluding those notices that do not pertain to any part of
101
+ the Derivative Works; and
102
+
103
+ (d) If the Work includes a "NOTICE" text file as part of its
104
+ distribution, You must include a readable copy of the
105
+ attribution notices contained within such NOTICE file, in
106
+ at least one of the following places: within a NOTICE text
107
+ file distributed as part of the Derivative Works; within
108
+ the Source form or documentation, if provided along with the
109
+ Derivative Works; or, within a display generated by the
110
+ Derivative Works, if and wherever such third-party notices
111
+ normally appear. The contents of the NOTICE file are for
112
+ informational purposes only and do not modify the License.
113
+ You may add Your own attribution notices within Derivative
114
+ Works that You distribute, alongside or as an addendum to
115
+ the NOTICE text from the Work, provided that such additional
116
+ attribution notices cannot be construed as modifying the License.
117
+
118
+ You may add Your own license statement for Your modifications and
119
+ may provide additional grant of rights to use, copy, modify, merge,
120
+ publish, distribute, sublicense, and/or sell copies of the Work,
121
+ and to permit persons to whom the Work is furnished to do so,
122
+ subject to the following conditions:
123
+
124
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
125
+ any Contribution intentionally submitted for inclusion in the Work
126
+ by You to the Licensor shall be under the terms and conditions of
127
+ this License, without any additional terms or conditions.
128
+ Notwithstanding the above, nothing herein shall supersede or modify
129
+ the terms of any separate license agreement you may have executed
130
+ with Licensor regarding such Contributions.
131
+
132
+ 6. Trademarks. This License does not grant permission to use the trade
133
+ names, trademarks, service marks, or product names of the Licensor,
134
+ except as required for reasonable and customary use in describing the
135
+ origin of the Work and reproducing the content of the NOTICE file.
136
+
137
+ 7. Disclaimer of Warranty. Unless required by applicable law or
138
+ agreed to in writing, Licensor provides the Work (and each
139
+ Contributor provides its Contributions) on an "AS IS" BASIS,
140
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
141
+ implied, including, without limitation, any warranties or conditions
142
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
143
+ PARTICULAR PURPOSE. You are solely responsible for determining the
144
+ appropriateness of using or reproducing the Work and assume any
145
+ risks associated with Your exercise of permissions under this License.
146
+
147
+ 8. Limitation of Liability. In no event and under no legal theory,
148
+ whether in tort (including negligence), contract, or otherwise,
149
+ unless required by applicable law (such as deliberate and grossly
150
+ negligent acts) or agreed to in writing, shall any Contributor be
151
+ liable to You for damages, including any direct, indirect, special,
152
+ incidental, or exemplary damages of any character arising as a
153
+ result of this License or out of the use or inability to use the
154
+ Work (including but not limited to damages for loss of goodwill,
155
+ work stoppage, computer failure or malfunction, or all other
156
+ commercial damages or losses), even if such Contributor has been
157
+ advised of the possibility of such damages.
158
+
159
+ 9. Accepting Warranty or Additional Liability. While redistributing
160
+ the Work or Derivative Works thereof, You may choose to offer,
161
+ and charge a fee for, acceptance of support, warranty, indemnity,
162
+ or other liability obligations and/or rights consistent with this
163
+ License. However, in accepting such obligations, You may offer such
164
+ conditions only on Your own behalf and on Your sole responsibility,
165
+ not on behalf of any other Contributor, and only if You agree to
166
+ indemnify, defend, and hold each Contributor harmless for any
167
+ liability incurred by, or claims asserted against, such Contributor
168
+ by reason of your accepting any such warranty or additional liability.
169
+
170
+ END OF TERMS AND CONDITIONS
171
+
172
+ APPENDIX: How to apply the Apache License to your work.
173
+
174
+ To apply the Apache License to your work, attach the following
175
+ boilerplate notice, with the fields enclosed by brackets "[]"
176
+ replaced with your own identifying information. (Don't include
177
+ the brackets!) The text should be enclosed in the appropriate
178
+ comment syntax for the format in use. Please also include a
179
+ "NOTICE" file as part of the distribution with the contents:
180
+
181
+ Copyright [yyyy] [name of copyright owner]
182
+
183
+ Licensed under the Apache License, Version 2.0 (the "License");
184
+ you may not use this file except in compliance with the License.
185
+ You may obtain a copy of the License at
186
+
187
+ http://www.apache.org/licenses/LICENSE-2.0
188
+
189
+ Unless required by applicable law or agreed to in writing, software
190
+ distributed under the License is distributed on an "AS IS" BASIS,
191
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
192
+ See the License for the specific language governing permissions and
193
+ limitations under the License.
194
+
195
+ Copyright 2024 AI Badgr
196
+
197
+ Licensed under the Apache License, Version 2.0 (the "License");
198
+ you may not use this file except in compliance with the License.
199
+ You may obtain a copy of the License at
200
+
201
+ http://www.apache.org/licenses/LICENSE-2.0
202
+
203
+ Unless required by applicable law or agreed to in writing, software
204
+ distributed under the License is distributed on an "AS IS" BASIS,
205
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
206
+ See the License for the specific language governing permissions and
207
+ limitations under the License.
package/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # badgr-cli
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/badgr-cli.svg)](https://www.npmjs.com/package/badgr-cli)
4
+ [![npm downloads](https://img.shields.io/npm/dm/badgr-cli.svg)](https://www.npmjs.com/package/badgr-cli)
5
+ [![license](https://img.shields.io/npm/l/badgr-cli.svg)](https://github.com/michaelmanly/badgr-cli/blob/main/LICENSE)
6
+ [![node](https://img.shields.io/node/v/badgr-cli.svg)](https://www.npmjs.com/package/badgr-cli)
7
+
3
8
  Badgr supports many GPU workloads through two commands: `serve` for persistent endpoints, `run` for jobs.
4
9
 
5
10
  > **Safety promise:** every run has `--max-cost`, live logs, automatic teardown, and a receipt. Run `badgr down <id>` any time to stop billing immediately.
@@ -8,6 +13,8 @@ Badgr supports many GPU workloads through two commands: `serve` for persistent e
8
13
  npm install -g badgr-cli
9
14
  ```
10
15
 
16
+ **Jump to:** [Quick start](#quick-start) · [Coding agents (`badgr launch`)](#coding--testing-agents-badgr-launch) · [Image generation](#also-try-image-generation) · [`badgr doctor`](#something-not-working-badgr-doctor) · [Commands](#commands) · [`serve` options](#badgr-serve-options) · [`run` options](#badgr-run-options) · [Receipts](#receipts) · [OpenAI compatibility](#openai-compatibility) · [GPU options](#gpu-options) · [Advanced](#advanced) · [Requirements](#requirements)
17
+
11
18
  ---
12
19
 
13
20
  ## Quick start
@@ -36,6 +43,76 @@ badgr receipts
36
43
 
37
44
  ---
38
45
 
46
+ ## Coding & testing agents: `badgr launch`
47
+
48
+ Run a coding agent or a test suite on a CPU VM with one command — no image, source, or `--max-cost` required for the four built-in workloads. Three separate things are going on here, worth keeping straight: **which agent CLI** runs (`cline`, `claude`, `codex`, `playwright`), **who pays for model usage** (Badgr, or your own Anthropic/OpenAI account), and **who provisions the VM and runs the command** (always Badgr).
49
+
50
+ ```bash
51
+ badgr launch cline "Fix the checkout bug" # Badgr provides model access — no account to connect
52
+ badgr launch claude "Fix the checkout bug" # runs Claude Code — connect your Anthropic account
53
+ badgr launch codex "Write tests" # runs the Codex CLI — connect your OpenAI account
54
+ badgr launch playwright "Test the checkout flow" # no model account involved at all
55
+ ```
56
+
57
+ **Authentication model:**
58
+
59
+ | Workload | CLI that runs | Who pays for model usage |
60
+ |----------|---------------|---------------------------|
61
+ | `cline` | Cline | Badgr provides and pays for model access |
62
+ | `claude` | Claude Code | Your Anthropic account — Badgr only provides the VM |
63
+ | `codex` | Codex CLI | Your OpenAI/ChatGPT account — Badgr only provides the VM |
64
+ | `playwright` | Playwright | No model account required |
65
+
66
+ Installing/running the `claude` or `codex` CLI doesn't by itself give a disposable Badgr VM model access — the CLI still needs to authenticate, and a VM's sign-in doesn't inherit from your laptop. `badgr launch claude`/`badgr launch codex` prompt inline the first time to connect your account and store it for next time; `cline` and `playwright` need nothing. Each workload picks its own VM size automatically (`small`, or `browser` for playwright's preinstalled Chromium) — override with `--size small|medium|browser`. A $2 default `--max-cost` applies unless you pass your own.
67
+
68
+ Today, "connect your account" means securely storing an API key (`ANTHROPIC_API_KEY` / `OPENAI_API_KEY`) — both Claude Code and the Codex CLI also support signing in via a Claude.ai/ChatGPT account, and a future version of `badgr connect` may add that OAuth flow instead of a pasted key; the one-time-connection UX is the same either way.
69
+
70
+ ```bash
71
+ badgr connect anthropic --key sk-ant-... # connect your Anthropic account ahead of time (optional — badgr launch prompts inline if missing)
72
+ badgr connect # list what's already connected
73
+ badgr connect anthropic --remove # disconnect
74
+ ```
75
+
76
+ Retrieve results after a run finishes:
77
+
78
+ ```bash
79
+ badgr pull <deployment-id> # pull a code-editing agent's patch as a local git diff/branch
80
+ badgr artifacts <deployment-id> # download everything else — test reports, screenshots, traces
81
+ ```
82
+
83
+ ### Advanced escape hatch — any other command
84
+
85
+ For anything beyond the four built-in workloads, run an arbitrary command on a CPU VM the same way `badgr run` does for GPU jobs:
86
+
87
+ ```bash
88
+ badgr launch . --max-cost 1 -- npm test
89
+ badgr launch https://github.com/user/repo --max-cost 1 -- python narrgo.py
90
+ ```
91
+
92
+ Everything before `--` is a `badgr launch` flag; everything after `--` is passed to your command verbatim, including anything that looks like a flag (`badgr launch . -- claude --max-cost 1` sends `--max-cost 1` to `claude`, not to Badgr). The default runner image has no Node.js/npm — use `--image <image>` for anything that needs it.
93
+
94
+ | Flag | Default | Description |
95
+ |------|---------|-------------|
96
+ | `--cmd "<command>"` | — | Quoted command form, equivalent to `-- <command>` |
97
+ | `--image <image>` | CPU runtime default | Custom image instead of the default |
98
+ | `--detach` / `--no-detach` | detach | `launch` detaches by default; `--no-detach` streams logs and waits |
99
+ | `--env KEY=VALUE` | — | Environment variable (repeatable) — Badgr warns if a value looks like a secret |
100
+ | `--artifacts <path>` | — | Extra path to capture and upload (repeatable), e.g. `--artifacts playwright-report`. Retrieve with `badgr artifacts <id>` |
101
+ | `--max-cost <$>` | `$2` | Auto-stop when spend reaches this amount |
102
+ | `--max-runtime <min>` | 60 | Auto-stop after N minutes |
103
+ | `--region US\|EU\|AU` | — | Region preference |
104
+ | `--size small\|medium\|browser` | per-workload default | VM class override |
105
+
106
+ ### `badgr task` — a labeled launch
107
+
108
+ ```bash
109
+ badgr task "Run the Chromium tests and tell me what failed" --max-cost 1 -- npm run test:chromium
110
+ ```
111
+
112
+ A thin wrapper over `badgr launch . -- <command>` — the description is printed for the human and otherwise discarded; the receipt and `badgr status` still key off the deployment ID like any other launch.
113
+
114
+ ---
115
+
39
116
  ## Also try: image generation
40
117
 
41
118
  ```bash
@@ -78,7 +155,7 @@ badgr doctor --json
78
155
  ```
79
156
 
80
157
  Run `badgr doctor --help` for the full flag list. Details in
81
- [`docs/gpu-doctor.md`](../../docs/gpu-doctor.md).
158
+ [`docs/gpu-doctor.md`](https://github.com/michaelmanly/gpu-ai/blob/main/docs/gpu-doctor.md).
82
159
 
83
160
  ---
84
161
 
@@ -86,11 +163,16 @@ Run `badgr doctor --help` for the full flag list. Details in
86
163
 
87
164
  ```text
88
165
  login
166
+ connect
89
167
  doctor
90
168
  run
169
+ launch
170
+ task
91
171
  serve
92
172
  status
93
173
  logs
174
+ pull
175
+ artifacts
94
176
  down
95
177
  receipts
96
178
  test
@@ -99,16 +181,21 @@ test
99
181
  | Command | What it does |
100
182
  |---------|-------------|
101
183
  | `badgr login` | Save API key to `~/.badgr/config.json` |
184
+ | `badgr connect <provider>` | Store a provider credential (`anthropic`, `openai`) for `badgr launch` |
102
185
  | `badgr doctor` | Diagnose a GPU workload failure — read-only, no login needed |
103
186
  | `badgr run <command>` | Run a one-off GPU job (any container command) |
187
+ | `badgr launch cline\|claude\|codex\|playwright "<task>"` | Run a coding/testing agent on a CPU VM — image + command auto-selected |
188
+ | `badgr task "<desc>" -- <command>` | Label + launch — thin wrapper over `badgr launch . -- <command>` |
104
189
  | `badgr serve <model>` | Start a persistent OpenAI-compatible endpoint |
105
190
  | `badgr status` | Show what's running and what's billing |
106
191
  | `badgr logs <id>` | Fetch log output from a deployment |
192
+ | `badgr pull <id>` | Pull a code-editing agent's patch as a local git diff/branch |
193
+ | `badgr artifacts <id>` | Download non-patch outputs (test reports, screenshots, traces) |
107
194
  | `badgr down <id>` | Terminate a deployment — stops billing immediately |
108
195
  | `badgr receipts [n]` | Cost, route, and retry receipts (default 10) |
109
196
  | `badgr test` | Run an end-to-end test (provision → run → teardown) |
110
197
 
111
- More commands below, under [Advanced](#advanced): `comfyui`, `train`, `transcribe`, `embed`, `workload`, `workspace`, `capacity`, `billing`.
198
+ More commands below, under [Advanced](#advanced): `comfyui`, `train`, `transcribe`, `embed`, `workload`, `workspace`, `batch`, `sbatch`, `capacity`, `billing`.
112
199
 
113
200
  `badgr serve` — for anything that needs a persistent endpoint: LLM serving, embeddings, image generation APIs, transcription APIs.
114
201
 
@@ -304,7 +391,7 @@ Badgr Auto selects the best eligible GPU for your workload. Add `--gpu <type>` o
304
391
  | A100 | NVIDIA A100 | 40–80 GB | Training, inference |
305
392
  | H100 | NVIDIA H100 | 80 GB | Large model training |
306
393
 
307
- Additional GPU types may be routable depending on current capacity — check with `badgr capacity`. Pricing is confirmed before provisioning; use `--dry-run` to see it first. Full GPU support details: see [NOTES.md](../../NOTES.md#gpu-support) in the repo root.
394
+ Additional GPU types may be routable depending on current capacity — check with `badgr capacity`. Pricing is confirmed before provisioning; use `--dry-run` to see it first. Full GPU support details: see [NOTES.md](https://github.com/michaelmanly/gpu-ai/blob/main/NOTES.md#gpu-support).
308
395
 
309
396
  ---
310
397
 
@@ -407,6 +494,51 @@ badgr workspace list
407
494
  badgr workspace delete my-project
408
495
  ```
409
496
 
497
+ ### `badgr batch` — generic containerized batch jobs
498
+
499
+ ```bash
500
+ badgr batch run workload.yml
501
+ badgr batch status dep-abc123
502
+ badgr batch artifacts dep-abc123
503
+ badgr batch receipt dep-abc123
504
+ badgr batch compare dep-abc123 dep-def456
505
+ ```
506
+
507
+ For CV/video/scientific batch, simulation, and physical-AI eval workloads — runs a container from a `workload.yml` spec and captures output artifacts automatically.
508
+
509
+ **Fan-out** — run the same program once per file in a directory, one deployment per input, in parallel:
510
+
511
+ ```bash
512
+ badgr batch run workload.yml --fan-out ./scenarios
513
+ badgr batch run workload.yml --fan-out ./scenarios --max-concurrency 10
514
+ badgr batch run workload.yml --fan-out ./scenarios --only failed1.json,failed2.json
515
+ ```
516
+
517
+ `workload.yml` must declare exactly one `inputs:` entry (the path that varies per task).
518
+
519
+ | Flag | Default | Description |
520
+ |------|---------|-------------|
521
+ | `--fan-out <dir>` | — | Run once per file in this directory instead of a single job |
522
+ | `--max-concurrency <n>` | 5 | Cap in-flight fan-out deployments |
523
+ | `--only <f1,f2>` | — | Rerun just the named input files |
524
+ | `--dry-run` | — | Preview the batch/fan-out plan without provisioning |
525
+
526
+ ### `badgr sbatch` — existing Slurm scripts
527
+
528
+ ```bash
529
+ badgr sbatch job.slurm
530
+ badgr sbatch job.slurm --dry-run
531
+ badgr sbatch array_job.slurm # #SBATCH --array=1-100 fans out into one deployment per task
532
+ badgr sbatch array_job.slurm --max-concurrency 10
533
+ ```
534
+
535
+ Translates `--cpus-per-task`/`--mem`/`--gres`/`--time`/`--export` from a real `.slurm` file. `#SBATCH --array=...` directives fan out into bounded-concurrency deployments the same way `batch run --fan-out` does; unsupported directives (`--partition`, `--qos`, `--account`) print a visible warning but don't block translation of the rest.
536
+
537
+ | Flag | Default | Description |
538
+ |------|---------|-------------|
539
+ | `--max-concurrency <n>` | 5 | Cap in-flight array tasks |
540
+ | `--dry-run` | — | Preview the translated job without provisioning |
541
+
410
542
  ### Other commands
411
543
 
412
544
  - `badgr capacity [--gpu <type>]` — check available GPU capacity right now
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badgr-cli",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Badgr — run or serve GPU workloads from one command",
5
5
  "type": "module",
6
6
  "bin": {
@@ -24,6 +24,14 @@
24
24
  "engines": {
25
25
  "node": ">=20.10.0"
26
26
  },
27
+ "homepage": "https://aibadgr.com",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/michaelmanly/badgr-cli.git"
31
+ },
32
+ "bugs": {
33
+ "url": "https://github.com/michaelmanly/badgr-cli/issues"
34
+ },
27
35
  "keywords": [
28
36
  "gpu",
29
37
  "cli",
@@ -31,11 +39,45 @@
31
39
  "compute",
32
40
  "gateway",
33
41
  "openai",
42
+ "openai-compatible",
34
43
  "workload",
35
44
  "workspace",
36
45
  "llm",
37
46
  "inference",
38
- "fine-tuning"
47
+ "fine-tuning",
48
+ "lora",
49
+ "vllm",
50
+ "gpu-cloud",
51
+ "cloud-gpu",
52
+ "gpu-rental",
53
+ "on-demand-gpu",
54
+ "serverless-gpu",
55
+ "gpu-provisioning",
56
+ "machine-learning",
57
+ "deep-learning",
58
+ "model-serving",
59
+ "model-training",
60
+ "training",
61
+ "huggingface",
62
+ "cuda",
63
+ "h100",
64
+ "a100",
65
+ "rtx-4090",
66
+ "coding-agent",
67
+ "ai-agent",
68
+ "claude-code",
69
+ "codex",
70
+ "playwright",
71
+ "comfyui",
72
+ "stable-diffusion",
73
+ "image-generation",
74
+ "transcription",
75
+ "whisper",
76
+ "embeddings",
77
+ "slurm",
78
+ "batch-jobs",
79
+ "devops",
80
+ "mlops"
39
81
  ],
40
82
  "license": "Apache-2.0"
41
83
  }
package/src/api.js CHANGED
@@ -153,6 +153,22 @@ export function quoteRun(config, body) {
153
153
  });
154
154
  }
155
155
 
156
+ // Live, no-provisioning price/capacity check for a GPU dry-run preview (see
157
+ // backend run_serve_routes.py's GET /v1/capacity/suggestions). Used by every
158
+ // GPU-provisioning command's --dry-run to show a real observed rate instead
159
+ // of just the requested config — callers must treat a failure here as
160
+ // non-fatal (best-effort) and never let it block or delay the dry-run.
161
+ export function getCapacityPreview(config, { gpu, region, maxPrice } = {}) {
162
+ const params = new URLSearchParams({ gpu: gpu || 'RTX_4090' });
163
+ if (region) params.set('region', region);
164
+ if (maxPrice != null) params.set('max_price', String(maxPrice));
165
+ return callApi(`/capacity/suggestions?${params}`, {
166
+ apiKey: config.apiKey,
167
+ baseUrl: config.baseUrl,
168
+ timeoutMs: 8_000,
169
+ });
170
+ }
171
+
156
172
  export function serveModel(config, body) {
157
173
  return callApi('/serve', {
158
174
  method: 'POST',
package/src/badgr.js CHANGED
@@ -37,7 +37,7 @@ const HELP = `
37
37
  ${chalk.bold('badgr')} — run or serve GPU workloads from one command
38
38
 
39
39
  ${chalk.bold('COMMANDS')}
40
- ${chalk.cyan('badgr login')} Authenticate with your API key
40
+ ${chalk.cyan('badgr login')} Open a browser to log in (or: badgr login --key <value>)
41
41
  ${chalk.cyan('badgr connect <provider>')} Credential setup (badgr connect anthropic/openai) — also prompted inline by badgr launch if missing
42
42
  ${chalk.cyan('badgr detect <path>')} Inspect a project and report the GPU job Badgr would run
43
43
  ${chalk.cyan('badgr run <command>')} Run a one-off GPU job
@@ -265,7 +265,7 @@ async function main() {
265
265
  }
266
266
 
267
267
  switch (cmd) {
268
- case 'login': return loginCommand(chalk, saveConfig);
268
+ case 'login': return loginCommand(chalk, saveConfig, rest);
269
269
  case 'connect': return connectCommand(rest, chalk);
270
270
  case 'detect': return detectCommand(config, rest, chalk);
271
271
  case 'run': return runCommand(config, rest, chalk);
@@ -25,6 +25,7 @@ import { monitorBatchJob, fmtRuntime } from '../batch.js';
25
25
  import { runFanOut, DEFAULT_CONCURRENCY } from '../fanout.js';
26
26
  import { uploadBlob } from '../api.js';
27
27
  import { downloadAndExtractArtifact } from '../artifactDownload.js';
28
+ import { printCapacityPreview, formatTierLabel } from '../progress.js';
28
29
  import { logsCommand } from './logs.js';
29
30
 
30
31
  // Server-side watchdog / batch.js reason strings, mapped to the vocabulary
@@ -240,17 +241,21 @@ async function runFanOutSubcommand(config, spec, flags, chalk, yamlPath) {
240
241
  const [{ containerPath }] = spec.inputs;
241
242
  const effectiveTier = normalizeTier(flags.tier);
242
243
  const concurrency = flags.maxConcurrency ?? DEFAULT_CONCURRENCY;
244
+ const resolvedGpu = flags.gpu ? flags.gpu.toUpperCase().replace(/-/g, '_') : 'AUTO';
243
245
 
244
246
  console.log(chalk.bold(`\n📦 Batch fan-out: ${spec.name}\n`));
245
247
  console.log(` ${chalk.bold('Image:')} ${spec.image}`);
246
248
  console.log(` ${chalk.bold('Command:')} ${spec.command.join(' ')}`);
247
249
  console.log(` ${chalk.bold('Inputs dir:')} ${fanOutDir} (${files.length} task(s), max ${Math.min(concurrency, files.length)} concurrent)`);
250
+ console.log(` ${chalk.bold('GPU:')} ${resolvedGpu}`);
251
+ console.log(` ${chalk.bold('Tier:')} ${formatTierLabel(effectiveTier)}`);
248
252
  console.log(` ${chalk.bold('Max cost:')} $${spec.maxCost.toFixed(2)} per task`);
249
253
  console.log(` ${chalk.bold('Max runtime:')} ${spec.maxRuntimeMinutes}min per task`);
250
254
  console.log();
251
255
 
252
256
  if (flags.dryRun) {
253
257
  console.log(chalk.bold(`⚡ Dry run — no GPU will be provisioned (${files.length} task(s) would be submitted)\n`));
258
+ await printCapacityPreview(chalk, config, { gpu: resolvedGpu, region: flags.region?.toUpperCase() });
254
259
  return;
255
260
  }
256
261
 
@@ -402,9 +407,14 @@ async function runSubcommand(config, args, chalk) {
402
407
  return runFanOutSubcommand(config, spec, flags, chalk, yamlPath);
403
408
  }
404
409
 
410
+ const resolvedGpu = flags.gpu ? flags.gpu.toUpperCase().replace(/-/g, '_') : 'AUTO';
411
+ const previewTier = normalizeTier(flags.tier);
412
+
405
413
  console.log(chalk.bold(`\n📦 Batch: ${spec.name}\n`));
406
414
  console.log(` ${chalk.bold('Image:')} ${spec.image}`);
407
415
  console.log(` ${chalk.bold('Command:')} ${spec.command.join(' ')}`);
416
+ console.log(` ${chalk.bold('GPU:')} ${resolvedGpu}`);
417
+ console.log(` ${chalk.bold('Tier:')} ${formatTierLabel(previewTier)}`);
408
418
  console.log(` ${chalk.bold('Max cost:')} $${spec.maxCost.toFixed(2)}`);
409
419
  console.log(` ${chalk.bold('Max runtime:')} ${spec.maxRuntimeMinutes}min`);
410
420
  if (spec.inputs.length) console.log(` ${chalk.bold('Inputs:')} ${spec.inputs.length} path(s)`);
@@ -413,6 +423,7 @@ async function runSubcommand(config, args, chalk) {
413
423
 
414
424
  if (flags.dryRun) {
415
425
  console.log(chalk.bold('⚡ Dry run — no GPU will be provisioned\n'));
426
+ await printCapacityPreview(chalk, config, { gpu: resolvedGpu, region: flags.region?.toUpperCase() });
416
427
  return;
417
428
  }
418
429