diff --git a/claude_desktop/CHANGELOG.md b/claude_desktop/CHANGELOG.md index 70bda5d12e..9dfed9c476 100644 --- a/claude_desktop/CHANGELOG.md +++ b/claude_desktop/CHANGELOG.md @@ -11,6 +11,7 @@ - Run Claude Desktop with --disable-dev-shm-usage and drop the misplaced shm_size env var (Home Assistant ignores shm_size), fixing Electron renderer crashes on the default 64 MB /dev/shm. ## 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 618e602e32..ce94689de0 100644 --- a/claude_desktop/Dockerfile +++ b/claude_desktop/Dockerfile @@ -61,7 +61,8 @@ RUN curl -fsSLo /usr/share/keyrings/claude-desktop-archive-keyring.asc https://d python3-pip \ gnome-keyring \ libsecret-1-0 \ - dbus-x11 && \ + dbus-x11 \ + 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 c9b3124fed..6ec8cf444f 100644 --- a/claude_desktop/config.yaml +++ b/claude_desktop/config.yaml @@ -35,7 +35,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 @@ -63,7 +67,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