From 43fd7c891792be417ad75f232ff38474e45045ae Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 7 Jul 2026 13:23:52 +0200 Subject: [PATCH] Improve Claude Desktop tooling setup --- claude_desktop/CHANGELOG.md | 1 + claude_desktop/Dockerfile | 2 +- claude_desktop/README.md | 5 +++ claude_desktop/config.yaml | 8 ++++ .../rootfs/etc/cont-init.d/83-github_cli.sh | 43 +++++++++++++++++++ 5 files changed, 58 insertions(+), 1 deletion(-) create mode 100755 claude_desktop/rootfs/etc/cont-init.d/83-github_cli.sh diff --git a/claude_desktop/CHANGELOG.md b/claude_desktop/CHANGELOG.md index b69bbf90aa..3f6a13d3e9 100644 --- a/claude_desktop/CHANGELOG.md +++ b/claude_desktop/CHANGELOG.md @@ -1,4 +1,5 @@ ## 1.2 (07-07-2026) +- Add baked-in git/GitHub CLI support with optional startup credential configuration. - Fix Selkies startup by creating the s6 environment directory and XDG runtime directory before services start. diff --git a/claude_desktop/Dockerfile b/claude_desktop/Dockerfile index 590f0358bb..6634d2afb6 100644 --- a/claude_desktop/Dockerfile +++ b/claude_desktop/Dockerfile @@ -56,7 +56,7 @@ RUN if [ ! -f /bin/sh ] && [ -f /usr/bin/sh ]; then ln -s /usr/bin/sh /bin/sh; f RUN curl -fsSLo /usr/share/keyrings/claude-desktop-archive-keyring.asc https://downloads.claude.ai/claude-desktop/key.asc && \ echo "deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/claude-desktop-archive-keyring.asc] https://downloads.claude.ai/claude-desktop/apt/stable stable main" > /etc/apt/sources.list.d/claude-desktop.list && \ apt-get update && \ - apt-get install -y --no-install-recommends claude-desktop python3-pip && \ + apt-get install -y --no-install-recommends claude-desktop python3-pip git gh && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* diff --git a/claude_desktop/README.md b/claude_desktop/README.md index beced8c4f1..97338dc242 100644 --- a/claude_desktop/README.md +++ b/claude_desktop/README.md @@ -22,6 +22,7 @@ Claude Desktop sign-in requires a claude.ai plan that supports the Desktop app. - Persistent `$HOME` under `/config/data`, preserving Claude Desktop and Claude Code sign-in state across restarts. - Optional runtime Claude Desktop updates from Anthropic's apt repository. - Optional extra apt and pip package installation. +- Baked-in `git` and GitHub CLI (`gh`) with optional startup credential configuration. - Custom script support through the repository standard `claude_desktop.sh` script. - Optional bundled Claude Code optimization tools: headroom, rtk, and caveman. - Low-power defaults: GPU device mapping, `AUTO_GPU=1`, `SELKIES_FRAMERATE=30`, `/tmp` tmpfs, and `$HOME/.cache` redirected to `/tmp/cache`. @@ -40,6 +41,10 @@ Claude Desktop sign-in requires a claude.ai plan that supports the Desktop app. | `install_headroom` | `true` | Make the baked-in `headroom` command available and log a usage hint. | | `install_rtk` | `true` | Configure the rtk Claude Code `PreToolUse` hook in the persistent Claude Code settings. | | `install_caveman` | `true` | Install the caveman Claude Code plugin into the persistent Claude Code home. | +| `install_github_cli` | `true` | Enable first-start checks and setup for the baked-in `git` and `gh` commands. | +| `github_token` | | Optional GitHub personal access token used to authenticate `gh` and configure Git credentials for GitHub. | +| `github_username` | | Optional global Git author name. | +| `github_email` | | Optional global Git author email. | | `additional_apps` | | Comma-separated Debian apt packages to install at startup, for example `htop,git`. | | `additional_pip` | | Comma-separated pip packages to install at startup. Installs use `--break-system-packages`. | | `data_location` | `/config/data` | Persistent home directory location. Keep this persistent so Claude sign-in survives restarts. | diff --git a/claude_desktop/config.yaml b/claude_desktop/config.yaml index 1db2114bd5..a06f3b6663 100644 --- a/claude_desktop/config.yaml +++ b/claude_desktop/config.yaml @@ -36,7 +36,11 @@ options: additional_apps: "" additional_pip: "" auto_update: true + github_email: "" + github_token: "" + github_username: "" install_caveman: true + install_github_cli: true install_headroom: true install_rtk: true panel_admin: false @@ -64,7 +68,11 @@ schema: additional_apps: str? additional_pip: str? auto_update: bool? + github_email: str? + github_token: password? + github_username: str? install_caveman: bool + install_github_cli: bool install_headroom: bool install_rtk: bool slug: claude_desktop diff --git a/claude_desktop/rootfs/etc/cont-init.d/83-github_cli.sh b/claude_desktop/rootfs/etc/cont-init.d/83-github_cli.sh new file mode 100755 index 0000000000..1c7a1bd2a5 --- /dev/null +++ b/claude_desktop/rootfs/etc/cont-init.d/83-github_cli.sh @@ -0,0 +1,43 @@ +#!/usr/bin/with-contenv bashio +# shellcheck shell=bash +set -e +set -o pipefail + +if ! bashio::config.true 'install_github_cli'; then + bashio::log.info "GitHub CLI setup disabled" + exit 0 +fi + +if ! command -v git > /dev/null 2>&1; then + bashio::log.warning "git is not available" +fi + +if ! command -v gh > /dev/null 2>&1; then + bashio::log.warning "gh is not available" + exit 0 +fi + +if bashio::config.has_value 'github_username'; then + git config --global user.name "$(bashio::config 'github_username')" +fi + +if bashio::config.has_value 'github_email'; then + git config --global user.email "$(bashio::config 'github_email')" +fi + +if bashio::config.has_value 'github_token'; then + token="$(bashio::config 'github_token')" + mkdir -p "$HOME/.config/gh" + chmod 700 "$HOME/.config/gh" + export GH_TOKEN="$token" + export GITHUB_TOKEN="$token" + if gh auth status --hostname github.com > /dev/null 2>&1; then + bashio::log.info "GitHub CLI already authenticated for github.com" + else + bashio::log.info "Configuring GitHub CLI authentication for github.com" + printf '%s\n' "$token" | gh auth login --hostname github.com --with-token || bashio::log.warning "GitHub CLI authentication failed" + fi + gh auth setup-git --hostname github.com || bashio::log.warning "GitHub CLI git credential setup failed" +else + bashio::log.info "GitHub CLI available. Set github_token to authenticate gh and git operations." +fi