Skip to content

Commit 205bb4a

Browse files
max-sixtyclaude
andauthored
simplify: hand the Codex Cloud approvals to wt, at worktrunk 0.74.0 (#987)
`.config/codex-cloud/environment.sh` hand-wrote the container's `approvals.toml`: read the project identifier out of `wt config show --format json`, render every command template through `jq`, write the file with a heredoc, then parse it back to confirm the schema still held. It was a reimplementation of `wt config approvals add`, and it existed for one reason — that command refused a non-TTY even when passed `--yes`, so there was no way to pre-approve a freshly cloned project unattended. [worktrunk 0.74.0](https://github.com/max-sixty/worktrunk/releases/tag/v0.74.0) fixes that ([max-sixty/worktrunk#3819](max-sixty/worktrunk#3819)), so the whole block is now `wt config approvals add --yes`. The schema re-parse goes with it: `add --yes` fails the command when it cannot save, rather than warning behind a `✓ saved` and exiting 0, which is exactly what that check was standing in for. The pin and the new line have to move together — `--yes` does nothing useful on 0.73.0. Testing against the released binary corrected a README claim. `add --yes` merges into `approvals.toml` rather than truncating it, so an unrelated project's entry survives; the old `cat >` genuinely replaced the file. "It replaces the container's Worktrunk approvals file" now reads as what actually makes the script Cloud-only — it approves this repo's `wt` commands without review. The `WORKTRUNK_VERSION` row in `running-tend` loses its instruction to check two `jq` paths the script no longer uses. <details> <summary>Verification</summary> - v0.74.0 installed to a temp dir via the pinned `worktrunk-installer.sh`, and `wt --version` prints exactly `wt v0.74.0` — the string the script's install guard compares against - `git merge-base --is-ancestor 92dfb686b v0.74.0` confirms the release carries the fix, rather than trusting the release notes - with that binary, under a throwaway `XDG_CONFIG_HOME`: the approval line exits 0 from tend's root, records all 8 commands `.config/wt.toml` declares, and leaves `wt config approvals list --format=json` at `state: approved` with nothing stale - seeding that file with an unrelated project's entry first leaves it intact — the basis for the README correction - skimmed the rest of the 0.74.0 notes: the one breaking change (minijinja spelling JSON bools and null as `True`/`False`/`None` inside `{{ vars.… }}`) doesn't reach a `.config/wt.toml` that uses only `{{ branch | hash_port }}` and `{{ args }}` - `pre-commit run --all-files` clean; `uv run pytest` 554 passed </details> > _This was written by Claude Code on behalf of max-sixty_ Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
1 parent 8831087 commit 205bb4a

3 files changed

Lines changed: 10 additions & 31 deletions

File tree

‎.claude/skills/running-tend/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ swamped run finishes nothing.
230230
| `uv_version` | `claude/action.yaml` | move it with `mitmproxy_version` |
231231
| `codex_version` | `codex/action.yaml` | `latest`; `alpha` only for a fix not yet released |
232232
| `uv_build` | `generator/pyproject.toml` | its range must contain the uv doing the build; a stale one only warns during `uv build`, so only this sweep catches it |
233-
| `WORKTRUNK_VERSION` | `.config/codex-cloud/environment.sh` | nothing in CI runs the script, and it dies under `set -euo pipefail` — confirm the release still ships `worktrunk-installer.sh`, and that `wt config show --format json` still has `.project.identifier` and `wt config approvals list --format=json` still has `.commands[].template` |
233+
| `WORKTRUNK_VERSION` | `.config/codex-cloud/environment.sh` | nothing in CI runs the script, and it dies under `set -euo pipefail` — confirm the release still ships `worktrunk-installer.sh` and that `wt config approvals add --yes` still records approvals without a TTY |
234234

235235
A stale `claude` binary resolves `--model opus`/`sonnet` to a superseded alias
236236
target, so drift silently downgrades the model. Skim the claude-code CHANGELOG

‎.config/codex-cloud/README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ pre-commit --version. Require every command to pass and do not modify files.
3232
## Keep it current
3333

3434
`environment.sh` is the one setup command for both fresh and cached containers.
35-
It reads the command list out of Worktrunk, so a `.config/wt.toml` change needs
36-
no edit here. Reset the environment cache when a repository change makes the
35+
Worktrunk records the approvals itself, so a `.config/wt.toml` change needs no
36+
edit here. Reset the environment cache when a repository change makes the
3737
cached container incompatible.
3838

39-
The script is Cloud-specific: it replaces the container's Worktrunk approvals
40-
file. Do not use it as local workstation setup.
39+
The script is Cloud-specific: it approves this repo's `wt` commands without
40+
review. Do not use it as local workstation setup.

‎.config/codex-cloud/environment.sh‎

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,18 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
WORKTRUNK_VERSION=0.73.0
4+
WORKTRUNK_VERSION=0.74.0
55
if ! command -v wt >/dev/null 2>&1 ||
66
[[ "$(wt --version)" != "wt v${WORKTRUNK_VERSION}" ]]; then
77
curl --proto '=https' --tlsv1.2 -LsSf \
88
"https://github.com/max-sixty/worktrunk/releases/download/v${WORKTRUNK_VERSION}/worktrunk-installer.sh" |
99
WORKTRUNK_UNMANAGED_INSTALL="$HOME/.local/bin" sh
1010
fi
1111

12-
# Approve every command `.config/wt.toml` declares, read back out of Worktrunk
13-
# rather than copied here — a hand-kept list blocks every unattended session in
14-
# the container one `wt.toml` edit later, and re-reviewing buys nothing when the
15-
# container runs this script from that same branch. `wt config approvals add` is
16-
# the review flow and refuses a non-TTY even with `--yes`, so write the file
17-
# directly, reading everything before the redirect truncates it.
18-
WORKTRUNK_PROJECT=$(wt config show --format json | jq -r '.project.identifier | @json')
19-
WORKTRUNK_COMMANDS=$(wt config approvals list --format=json |
20-
jq -r '.commands[] | " \(.template | @json),"')
21-
WORKTRUNK_APPROVALS_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/worktrunk"
22-
install -d "$WORKTRUNK_APPROVALS_DIR"
23-
cat >"$WORKTRUNK_APPROVALS_DIR/approvals.toml" <<EOF
24-
[projects.$WORKTRUNK_PROJECT]
25-
approved-commands = [
26-
$WORKTRUNK_COMMANDS
27-
]
28-
EOF
29-
30-
# Worktrunk parses what we just generated, so a release that changes the
31-
# approvals schema fails here rather than at the first hook of a Cloud session.
32-
if [[ "$(wt config approvals list --format=json | jq -r '.state')" != approved ]]; then
33-
echo "Worktrunk approvals do not cover .config/wt.toml" >&2
34-
wt config approvals list >&2
35-
exit 1
36-
fi
12+
# Pre-approve the commands `.config/wt.toml` declares, so unattended `wt` runs
13+
# in the container don't block on the prompt. `--yes` is the CI path; review
14+
# buys nothing here, since the container runs this script from that same branch.
15+
wt config approvals add --yes
3716

3817
uv sync --frozen
3918
npm ci --prefix site --prefer-offline --no-audit --no-fund

0 commit comments

Comments
 (0)