gdkbox 0.1.20 → 0.1.22

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a5d8a8a1fbb33083f8cfb0b306ee0d6fc4efaffad04a110ef9f1a55141baae5
4
- data.tar.gz: f4ec5a9b60bf6ab209ced26b1c0ec9c6b95503ae6a65484844506553055ea900
3
+ metadata.gz: a353b949138be45d989c30863cb5c6b3e1a1a649f00e7522a867be70c12c4d01
4
+ data.tar.gz: 6b9f387c0afc7ea1e5ce3ba20f9c33f5dbf797b726e160e9c29fbfc9aa17f701
5
5
  SHA512:
6
- metadata.gz: 596f76ed57ea61c0fc0a00a7e0cd72a917a076aa9fcf022127d8b3ac7e5303c6ccb2c60e30c24727dcedb402f14065da1776be58832d1d28446b070850b09145
7
- data.tar.gz: 1e4e94bc489cfc712b5e7a7386cad211e5cdf26b826eddeb43fa5e2bf47cacfde8c945677d896c5a21e97deef8dae99458133ebb4a3253a2530142c66404ff77
6
+ metadata.gz: 4534fe9792143d6377788468efd38868f95581cd9c8d257e42c2df5cf370f8c16e11833331b670d7798bfba7e39063f1046fffdcb8369abe63721684c4ae52ff
7
+ data.tar.gz: 4276196feb72afa6ded3609aa8f18d4790a3291efb6c346437bd455879b48d7a7a8c7da0bf8b3c22842935ba7a6e40e6bb2e5c987254c4149d87d7300495e772
data/README.md CHANGED
@@ -103,7 +103,7 @@ Or run it straight from the checkout without installing:
103
103
  | `gdkbox skills` | List agent skills available to install (bundled + `~/.claude/skills` + `./.claude/skills`). |
104
104
  | `gdkbox add-skill BOX [SKILL...]` | Install skill(s) into a **box** so dispatched agents can use them; interactive picker if no SKILL (`--force`). |
105
105
  | `gdkbox completion SHELL` | Set up bash/zsh completion — `--install` makes it permanent (writes the script + wires your rc file once); without it, prints the script. |
106
- | `gdkbox harnesses` | List the agent harnesses gdkbox can install (claude, codex, opencode, pi). |
106
+ | `gdkbox harnesses` | List the agent harnesses gdkbox can install (claude, codex, opencode, opencode2, pi). |
107
107
  | `gdkbox install-agent NAME` | (Re)install the box's agent harness inside it. |
108
108
 
109
109
  ### `gdkbox up` options
@@ -114,7 +114,7 @@ Or run it straight from the checkout without installing:
114
114
  | `--ssh-port` | next free from 2222 | Host port to publish SSH on. Auto-allocation skips ports in use on the host (e.g. a local GDK). |
115
115
  | `--web-port` | next free from 3000 | Host port to publish the GDK web UI on. Auto-allocation skips ports in use on the host. |
116
116
  | `--vite-port` | next free from 3038 | Port for vite assets. Published with the **same number inside and outside** the box (asset URLs embed it); GDK in the box is reconfigured to match. |
117
- | `--harness ID` | `claude` (or config.yml) | Agent harness to install: claude, codex, opencode, pi. |
117
+ | `--harness ID` | `claude` (or config.yml) | Agent harness to install: claude, codex, opencode, opencode2, pi. |
118
118
  | `--no-agent` | (agent installed) | Skip installing the agent harness. |
119
119
  | `--skill NAME [NAME...]` | (none) | Seed skill(s) into the box at creation for dispatched agents. |
120
120
  | `--gitlab-remote REMOTE` | config.yml, else image default | Point the GitLab checkout at this remote (URL or `namespace/project`); the image ships pointing at the community mirror. |
@@ -123,7 +123,7 @@ Or run it straight from the checkout without installing:
123
123
  | `--docker` | off | Mount the host Docker socket + per-box network so docker-executor CI jobs work. **Grants the box root-equivalent host access** — see "Docker inside a box". |
124
124
  | `--publish PORT [PORT...]` | (none) | Publish extra container ports on `127.0.0.1`, same number on both sides (e.g. AI Gateway `5052`, Duo Workflow `50052`). |
125
125
  | `--key-env NAME` | the harness's | Env var this box's API key is seeded under (e.g. `GITLAB_TOKEN`); see "opencode with GitLab Duo". |
126
- | `--model ID` | the harness's own | Model the box's agent runs with on `dispatch` (claude, codex, opencode; e.g. `gitlab/duo-chat-sonnet-4-5`). |
126
+ | `--model ID` | the harness's own | Model the box's agent runs with on `dispatch` (claude, codex, opencode, opencode2; e.g. `gitlab/duo-chat-sonnet-4-5`). |
127
127
 
128
128
  ## Typical workflow
129
129
 
@@ -375,7 +375,8 @@ harness the box was created with.
375
375
  | --- | --- | --- | --- | --- |
376
376
  | `claude` | Claude Code | `claude -p` | `ANTHROPIC_API_KEY` | `~/.claude/skills` |
377
377
  | `codex` | OpenAI Codex | `codex exec` | `OPENAI_API_KEY` | `~/.codex/skills` |
378
- | `opencode` | opencode (sst) | `opencode run` | `GITLAB_TOKEN` | `~/.config/opencode/skills` |
378
+ | `opencode` | opencode V1 (opencode-ai) | `opencode run` | `GITLAB_TOKEN` | `~/.config/opencode/skills` |
379
+ | `opencode2` | opencode V2 (@opencode/cli) | `opencode2 run` | `GITLAB_TOKEN` | `~/.config/opencode/skills` |
379
380
  | `pi` | pi (earendil-works) | `pi -p` | `GITLAB_TOKEN` | `~/.pi/skills` |
380
381
 
381
382
  ```sh
@@ -386,23 +387,32 @@ gdkbox dispatch reviewer --task "review the diff"
386
387
  gdkbox harnesses # list available harnesses
387
388
  ```
388
389
 
389
- Skills use the same `SKILL.md` format across all four, so a skill installed by
390
- `add-skill`/`--skill` works regardless of harness. The key env is a per-harness
391
- default (claude → `ANTHROPIC_API_KEY`, codex → `OPENAI_API_KEY`, opencode and
392
- pi → `GITLAB_TOKEN`): point a box at another provider with
390
+ Skills use the same `SKILL.md` format across all harnesses, so a skill installed
391
+ by `add-skill`/`--skill` works regardless of harness. The key env is a
392
+ per-harness default (claude → `ANTHROPIC_API_KEY`, codex → `OPENAI_API_KEY`,
393
+ opencode/opencode2/pi → `GITLAB_TOKEN`): point a box at another provider with
393
394
  `gdkbox up --key-env NAME`.
394
395
  `gdkbox up --model ID` pins the model a box's agent is dispatched with
395
- (claude, codex, and opencode; not pi yet). Both are fixed when the box is
396
- created.
396
+ (claude, codex, opencode, and opencode2; not pi yet). Both are fixed when the
397
+ box is created.
398
+
399
+ `opencode` installs opencode V1 (`opencode-ai`); `opencode2` installs opencode
400
+ V2 (`@opencode/cli`, which ships both an `opencode` and an `opencode2` binary —
401
+ gdkbox pins `opencode2` to keep the two harnesses from clashing). V2 is
402
+ config-compatible with V1 (it reads V1's `permission` object config) and adds
403
+ `--auto` to auto-approve non-denied permissions on headless dispatch.
397
404
 
398
405
  ### opencode with GitLab Duo
399
406
 
400
- The `opencode` harness defaults to opencode's GitLab Duo provider, which reads
401
- a personal access token from `GITLAB_TOKEN`. Pin a Duo model with `--model`:
407
+ The `opencode` and `opencode2` harnesses default to opencode's GitLab Duo
408
+ provider, which reads a personal access token from `GITLAB_TOKEN`. Pin a Duo
409
+ model with `--model`:
402
410
 
403
411
  ```sh
404
412
  GITLAB_TOKEN=<token> gdkbox up duo --harness opencode --model gitlab/duo-chat-sonnet-4-5
405
413
  gdkbox dispatch duo --task "review the diff"
414
+ # or opencode V2:
415
+ GITLAB_TOKEN=<token> gdkbox up duo2 --harness opencode2 --model gitlab/duo-chat-opus-5-5
406
416
  ```
407
417
 
408
418
  - The `duo-chat-*` models are GitLab Duo Agentic Chat and work with the token
@@ -146,15 +146,41 @@ module GDKBox
146
146
  # OPENAI_API_KEY).
147
147
  key_env: "GITLAB_TOKEN",
148
148
  config_key: "gitlab_token",
149
- summary: "opencode (sst)",
149
+ summary: "opencode V1 (opencode-ai)",
150
150
  skills_subdir: ".config/opencode/skills",
151
151
  model_flag: "-m",
152
152
  run: lambda do |json:, yolo:|
153
- # `opencode run` is non-interactive and has no skip-permissions flag.
153
+ # opencode V1's `run` is non-interactive and has no skip-permissions
154
+ # flag, so json/yolo are no-ops here (use the opencode2 harness for
155
+ # those).
154
156
  +%(opencode run "$GDKBOX_TASK")
155
157
  end
156
158
  )
157
159
 
160
+ # opencode V2 (`@opencode/cli`, ships both `opencode` and `opencode2`
161
+ # binaries). Registered alongside V1 so a box can run either; this harness
162
+ # pins the `opencode2` binary to avoid clashing with V1's `opencode`. V2
163
+ # reads the same GitLab Duo provider and config as V1 — it accepts V1's
164
+ # `permission` object config and normalises it to its own `permissions`
165
+ # array — so the fleet skill's opencode config snippet works unchanged.
166
+ register(
167
+ id: "opencode2",
168
+ npm_package: "@opencode/cli",
169
+ bin: "opencode2",
170
+ key_env: "GITLAB_TOKEN",
171
+ config_key: "gitlab_token",
172
+ summary: "opencode V2 (@opencode/cli)",
173
+ skills_subdir: ".config/opencode/skills",
174
+ model_flag: "-m",
175
+ run: lambda do |json:, yolo:|
176
+ cmd = +%(opencode2 run "$GDKBOX_TASK")
177
+ cmd << " --format json" if json
178
+ # V2 adds `--auto`: auto-approve permissions not explicitly denied.
179
+ cmd << " --auto" if yolo
180
+ cmd
181
+ end
182
+ )
183
+
158
184
  register(
159
185
  id: "pi",
160
186
  npm_package: "@earendil-works/pi-coding-agent",
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GDKBox
4
- VERSION = "0.1.20"
4
+ VERSION = "0.1.22"
5
5
  end
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  name: gdkbox-fleet
3
+ version: 1.0.1
3
4
  description: >-
4
5
  Orchestrate a fleet of GDK-in-a-box environments with the `gdkbox` CLI:
5
6
  provision a reusable pool of GitLab Development Kit boxes, then dispatch
@@ -89,6 +90,24 @@ gdkbox up "pool-$i" --owner "$OWNER" --ttl 7200 --json \
89
90
  match what you asked for, and `"api_key_set"` must be `true`.
90
91
  - `dispatch --json` output is harness-specific. For opencode it is plain text,
91
92
  so rely on the exit status rather than parsing it.
93
+ - An opencode dispatch starts in the GDK root, so opencode treats the GitLab
94
+ checkout (a git repository of its own) and `/tmp` as outside directories
95
+ and rejects every command there. Before the first dispatch, allow them in
96
+ the box's `~/.config/opencode/opencode.jsonc`:
97
+
98
+ ```json
99
+ {"$schema": "https://opencode.ai/config.json",
100
+ "permission": {"external_directory": {
101
+ "/home/gdk/gitlab-development-kit/gitlab/**": "allow",
102
+ "/tmp/**": "allow"}}}
103
+ ```
104
+
105
+ Use the singular `permission` **object** form above. opencode's config
106
+ schema also defines an ordered `permissions` ruleset array, but that is a
107
+ **V2-only** feature: opencode V1 — what the box installs (`opencode-ai`,
108
+ 1.19.x) — rejects it outright (`Configuration is invalid … V2 permissions
109
+ are not supported by OpenCode V1`). Keep the object form while the harness
110
+ runs opencode V1.
92
111
 
93
112
  In the examples below, `gdkbox` means "the gdkbox CLI, however it is invoked".
94
113
 
@@ -121,7 +140,7 @@ In the examples below, `gdkbox` means "the gdkbox CLI, however it is invoked".
121
140
  "ssh_port": 2222,
122
141
  "web_port": 3000,
123
142
  "web_url": "http://127.0.0.1:3000",
124
- "remote_path": "/home/gdk/gdk",
143
+ "remote_path": "/home/gdk/gitlab-development-kit",
125
144
  "harness": "claude",
126
145
  "claude_installed": true,
127
146
  "api_key_set": true,
@@ -190,8 +209,10 @@ can parse per task.
190
209
  ```
191
210
 
192
211
  When a dispatch returns, that box is idle again — assign it the next task
193
- from the queue. Never run two dispatches against the same box at once,
194
- and never dispatch into a box whose `claimed_by` is not your owner id.
212
+ from the queue, or **stop it immediately if nothing is queued for it**
213
+ (`gdkbox stop <box>`; see the "never leave a box running idle" guardrail).
214
+ Never run two dispatches against the same box at once, and never dispatch
215
+ into a box whose `claimed_by` is not your owner id.
195
216
 
196
217
  **Delegating to subagents:** the renewal in `run_task` above is for when
197
218
  *you* run the loop. If you hand a task to a subagent instead, do the
@@ -205,23 +226,36 @@ can parse per task.
205
226
  tree so tasks don't interfere, e.g.:
206
227
 
207
228
  ```sh
208
- gdkbox ssh pool-1 -t 'cd /home/gdk/gdk && git reset --hard && git clean -fd'
229
+ ssh -o ForwardAgent=no gdkbox-pool-1 'cd /home/gdk/gitlab-development-kit/gitlab && git reset --hard && git clean -fd'
209
230
  ```
210
231
 
232
+ `gdkbox ssh <box>` is interactive only and takes no command, so run
233
+ commands through the `gdkbox-<box>` ssh alias that `up` writes. The GitLab
234
+ checkout is `/home/gdk/gitlab-development-kit/gitlab` (a box's
235
+ `remote_path` is the GDK root, not the checkout). Pass
236
+ `-o ForwardAgent=no` when the box runs untrusted code (an MR under
237
+ review): the alias forwards your ssh agent by default.
238
+
211
239
  Skip this only when tasks are meant to build on each other.
212
240
 
213
241
  5. **Collect and report.** Read each task's output file, parse the JSON result,
214
242
  and summarize per task: success/failure (exit status), what the agent did,
215
243
  and any follow-ups. Surface failures explicitly.
216
244
 
217
- 6. **Wind down — release every box you claimed.** When the batch is done,
218
- release **all** your boxes so the pool is usable by others (a lease would
219
- expire eventually, but do not rely on it for normal completion). Then keep
220
- them warm (`gdkbox stop`, later `gdkbox start`) or `gdkbox rm --force` to
221
- discard:
245
+ 6. **Stop idle boxes as you go; release everything at wind-down.** A box with
246
+ no task running right now must not be left running — `gdkbox stop <box>`
247
+ it the moment it goes idle (stopping keeps the claim, license and seeded
248
+ data; `gdkbox start <box>` brings it straight back). Do this throughout the
249
+ batch, not only at the end — especially whenever you pause to wait on the
250
+ user, on a review, or on another box. See the guardrail below.
251
+
252
+ When the **whole batch is done**, stop every box, then release **all** of
253
+ them so the pool is usable by others (a lease would expire eventually, but
254
+ do not rely on it for normal completion), or `gdkbox rm --force` to discard:
222
255
 
223
256
  ```sh
224
257
  for b in $(gdkbox ls --json | jq -r ".[] | select(.claimed_by==\"$OWNER\") | .name"); do
258
+ gdkbox stop "$b" # no box left running once its work is done
225
259
  gdkbox release "$b" --owner "$OWNER"
226
260
  done
227
261
  ```
@@ -245,7 +279,8 @@ for i in 1 2 3; do
245
279
  gdkbox dispatch "pool-$i" --task-file "tasks/$i.md" --json > "out/$i.json" 2>&1 &
246
280
  done
247
281
  wait
248
- for i in 1 2 3; do gdkbox release "pool-$i" --owner "$OWNER"; done
282
+ # batch done: stop each box so none is left running, then release the pool
283
+ for i in 1 2 3; do gdkbox stop "pool-$i"; gdkbox release "pool-$i" --owner "$OWNER"; done
249
284
  ```
250
285
 
251
286
  Adopt one more existing free box when the queue outgrows the pool (each call
@@ -259,7 +294,7 @@ Reuse a box for the next task after resetting it (keep the claim while the
259
294
  box is yours; release only when you are done with it):
260
295
 
261
296
  ```sh
262
- gdkbox ssh pool-1 -t 'cd /home/gdk/gdk && git reset --hard && git clean -fd'
297
+ ssh -o ForwardAgent=no gdkbox-pool-1 'cd /home/gdk/gitlab-development-kit/gitlab && git reset --hard && git clean -fd'
263
298
  gdkbox dispatch pool-1 --task-file tasks/next.md --json
264
299
  ```
265
300
 
@@ -281,7 +316,7 @@ gdkbox up duo-1 --owner "$OWNER" --ttl 14400 --docker --publish 5052 50052
281
316
  gdkbox set-gcloud duo-1 # Vertex AI credentials for the flow model
282
317
  ```
283
318
 
284
- Then, inside the box (dispatch these as tasks or run them over `gdkbox ssh`),
319
+ Then, inside the box (dispatch these as tasks or run them over the `gdkbox-<box>` ssh alias),
285
320
  follow the README's "Running Duo agentic flows in a box" steps — in short:
286
321
  `gdk rake setup_ai_services` (~20 min, needs a valid `ANTHROPIC_API_KEY`);
287
322
  put the workflow service's env in **`env.runit`** (not `.env` — the two
@@ -303,6 +338,15 @@ rest of the pool accordingly, and give the claim a generous `--ttl`.
303
338
  heavy. Prefer reusing the pool over creating more boxes.
304
339
  - **One dispatch per box at a time.** Serialize tasks on a box; parallelize
305
340
  *across* boxes.
341
+ - **Never leave a box running idle.** A box is expensive (a full GDK
342
+ container); it must be running *only* while a dispatch is actually using it.
343
+ The moment a box has no task queued for it — including whenever the
344
+ orchestration pauses to wait on the user, on a review, or on another box —
345
+ `gdkbox stop <box>` it. Stopping frees the host's memory and CPU but **keeps
346
+ the claim, license and seeded data**, so `gdkbox start <box>` resumes it in
347
+ seconds. Keep the claim while the box is yours and only *release* at session
348
+ wind-down; stopping is for idleness, releasing is for "done with it". If you
349
+ stopped boxes mid-session, `gdkbox start` them again before dispatching.
306
350
  - **Own every box you touch, for the whole batch.** Provision with
307
351
  `up --owner`, adopt with `claim`, and hold the claims until wind-down —
308
352
  then release them all. Claims are advisory: `dispatch` will not stop you
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gdkbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20
4
+ version: 0.1.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - jotolo
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  requirements: []
99
- rubygems_version: 4.0.11
99
+ rubygems_version: 4.0.24
100
100
  specification_version: 4
101
101
  summary: Spin up a GitLab Development Kit (GDK) in a box, ready for VS Code and Claude
102
102
  Code.