Skip to content

Commit 5cf9c82

Browse files
gilesknapclaude
andcommitted
refactor(copier): drop install_gh / install_glab questions
Always install gh and glab when add_claude is on. The base image will ship them on Ubuntu 26.04, at which point the Dockerfile install blocks can be dropped wholesale; in the meantime, having them unconditional removes two questions and the matching jinja gating across the Dockerfile, devcontainer.json, postStart.sh and justfile. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d886d20 commit 5cf9c82

7 files changed

Lines changed: 13 additions & 45 deletions

copier.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -121,22 +121,6 @@ add_claude:
121121
the container, mounts ~/.claude from the host, installs Claude Code
122122
CLI, and enables `--dangerously-skip-permissions` autopilot mode.
123123
124-
install_gh:
125-
type: bool
126-
when: "{{ add_claude }}"
127-
help: |
128-
Install the GitHub CLI (gh) so Claude can push/pull via PAT auth?
129-
Only useful inside the Claude sandbox — ordinary users typically
130-
rely on SSH keys or VS Code git credentials.
131-
132-
install_glab:
133-
type: bool
134-
when: "{{ add_claude }}"
135-
help: |
136-
Install the GitLab CLI (glab) for projects that talk to a GitLab
137-
instance (e.g. gitlab.diamond.ac.uk submodules)?
138-
Only useful inside the Claude sandbox.
139-
140124
docs_type:
141125
type: str
142126
help: |

example-answers.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ distribution_name: dls-python-copier-template-example
88
docker: true
99
docker_debug: true
1010
add_claude: true
11-
install_gh: true
12-
install_glab: true
1311
docs_type: sphinx
1412
git_platform: github.com
1513
github_org: DiamondLightSource

template/.devcontainer/devcontainer.json.jinja

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,19 @@
7979
"source": "devcontainer-shared-cache",
8080
"target": "/cache",
8181
"type": "volume"
82-
}{% if install_gh %},
82+
}{% if add_claude %},
8383
// Persist gh auth across container rebuilds with per-repo scoped PAT
8484
{
8585
"source": "gh-auth-${localWorkspaceFolderBasename}",
8686
"target": "/root/.config/gh",
8787
"type": "volume"
88-
}{% endif %}{% if install_glab %},
88+
},
8989
// Persist glab auth across container rebuilds (GitLab CLI)
9090
{
9191
"source": "glab-auth-${localWorkspaceFolderBasename}",
9292
"target": "/root/.config/glab-cli",
9393
"type": "volume"
94-
}{% endif %}{% if add_claude %},
94+
},
9595
// Mount Claude config from host (settings, memory, skills)
9696
{
9797
"source": "${localEnv:HOME}/.claude",

template/.devcontainer/{% if add_claude %}postStart.sh{% endif %}.jinja

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ set -euo pipefail
1212
for scope in --system --global; do
1313
git config $scope --unset-all credential.helper 2>/dev/null || true
1414
git config $scope --unset-all credential.https://github.com.helper 2>/dev/null || true
15-
{%- if install_glab %}
1615
git config $scope --unset-all credential.https://gitlab.diamond.ac.uk.helper 2>/dev/null || true
17-
{%- endif %}
1816
git config $scope --unset-all url.ssh://git@github.com/.insteadOf 2>/dev/null || true
1917
done
2018

@@ -28,11 +26,8 @@ rm -f /tmp/vscode-remote-containers-*.js
2826
# handle auth. This keeps the container SSH-key-free (Claude stays sandboxed)
2927
# while still allowing push/pull on repos whose remotes are set to git@...:.
3028
git config --global url."https://github.com/".insteadOf "git@github.com:"
31-
{%- if install_glab %}
3229
git config --global url."https://gitlab.diamond.ac.uk/".insteadOf "git@gitlab.diamond.ac.uk:"
33-
{%- endif %}
3430

35-
{% if install_gh -%}
3631
# Pin per-host helper to the in-container gh path. The host gitconfig may
3732
# reference /usr/local/bin/gh which doesn't exist here (apt installs to
3833
# /usr/bin/gh); without this, git falls through to the next helper.
@@ -45,10 +40,8 @@ fi
4540
if gh auth status &>/dev/null; then
4641
gh auth setup-git
4742
fi
48-
{%- endif %}
49-
{% if install_glab %}
43+
5044
# Pin per-host helper to the in-container glab path.
5145
if command -v glab >/dev/null; then
5246
git config --global credential.https://gitlab.diamond.ac.uk.helper "!$(command -v glab) auth git-credential"
5347
fi
54-
{%- endif %}

template/Dockerfile.jinja

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,26 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \
99

1010
# Node is required by Claude Code's hook runtime; just powers the
1111
# container's claude/gh-auth/glab-auth recipes in justfile.
12-
# TODO: nodejs (and gh / glab below) will move into the
13-
# ubuntu-devcontainer base image once it ships on Ubuntu 26.04, where
14-
# all three are available from apt at sufficient versions. At that
15-
# point this block and the install_gh / install_glab copier options
16-
# can be dropped.
12+
# TODO: nodejs, just, gh and glab will move into the ubuntu-devcontainer
13+
# base image once it ships on Ubuntu 26.04, where all are available
14+
# from apt at sufficient versions. At that point these blocks can be
15+
# dropped.
1716
RUN apt-get update -y && apt-get install -y --no-install-recommends \
1817
nodejs \
1918
just \
20-
&& apt-get dist-clean{% endif %}{% if install_gh %}
19+
&& apt-get dist-clean
2120

2221
# GitHub CLI — used by Claude to authenticate to github.com via PAT.
23-
# TODO: drop once the ubuntu-devcontainer base ships on Ubuntu 26.04
24-
# (apt has gh 2.46.0-4 there).
2522
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | \
2623
dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && \
2724
chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg && \
2825
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
2926
| tee /etc/apt/sources.list.d/github-cli.list > /dev/null && \
3027
apt-get update && apt-get install -y --no-install-recommends gh && \
31-
apt-get dist-clean{% endif %}{% if install_glab %}
28+
apt-get dist-clean
3229

3330
# GitLab CLI — used by Claude to authenticate to gitlab instances via PAT.
3431
# No apt repo, so install from the upstream release tarball.
35-
# TODO: drop once the ubuntu-devcontainer base ships on Ubuntu 26.04
36-
# (apt has glab 1.53.0-1build1 there).
3732
ARG GLAB_VERSION=1.93.0
3833
RUN curl -fsSL "https://gitlab.com/gitlab-org/cli/-/releases/v${GLAB_VERSION}/downloads/glab_${GLAB_VERSION}_linux_amd64.tar.gz" \
3934
| tar -xz -C /tmp bin/glab && \

template/{% if add_claude %}justfile{% endif %}.jinja

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Start Claude Code in sandbox mode (no SSH agent, skip permission prompts)
22
claude:
3-
SSH_AUTH_SOCK= IS_SANDBOX=1 VSCODE_GIT_IPC_HANDLE= GIT_ASKPASS= claude --dangerously-skip-permissions{% if install_gh %}
3+
SSH_AUTH_SOCK= IS_SANDBOX=1 VSCODE_GIT_IPC_HANDLE= GIT_ASKPASS= claude --dangerously-skip-permissions
44

55

66
# Authenticate gh CLI with a GitHub PAT (token not stored in shell history)
@@ -10,7 +10,7 @@ gh-auth:
1010
echo "$t" | gh auth login --with-token
1111
unset t
1212
gh auth setup-git
13-
gh auth status{% endif %}{% if install_glab %}
13+
gh auth status
1414

1515

1616
# Authenticate glab CLI with a GitLab PAT (token not stored in shell history).
@@ -20,4 +20,4 @@ glab-auth hostname="gitlab.com":
2020
read -sp "GitLab PAT for {{ '{{' }} hostname {{ '}}' }}: " t && echo
2121
echo "$t" | glab auth login --stdin --hostname {{ '{{' }} hostname {{ '}}' }} --git-protocol https
2222
unset t
23-
glab auth status{% endif %}
23+
glab auth status

tests/test_example.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,6 @@ def test_meta_matches_no_claude_template(tmp_path: Path):
215215
copy_project(
216216
tmp_path,
217217
add_claude=False,
218-
install_gh=False,
219-
install_glab=False,
220218
docker=False,
221219
docker_debug=False,
222220
)

0 commit comments

Comments
 (0)