Skip to content

fix: use activation script for gemini settings to allow ruler writes - #657

Closed
shunkakinoki wants to merge 40 commits into
mainfrom
fix/gemini-settings-symlink
Closed

fix: use activation script for gemini settings to allow ruler writes#657
shunkakinoki wants to merge 40 commits into
mainfrom
fix/gemini-settings-symlink

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Jan 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • Change gemini settings.json from symlink to copied file using home-manager activation script
  • Only copy if file doesn't exist, allowing ruler and other tools to modify it
  • Restore telegram channel config in clawdbot template

Test plan

  • make build passes
  • make switch applies successfully
  • make sync completes without permission errors
  • Gemini settings.json is writable by ruler

🤖 Generated with Claude Code


Summary by cubic

Switch Gemini settings.json from a symlink to a real file via a Home Manager activation script so tools like ruler can write to it. Restores Telegram channel config in the Clawdbot template.

  • Bug Fixes

    • Copy ~/.gemini/settings.json on activation only if missing and set perms to 644.
    • Remove symlink usage to prevent ruler write failures.
    • Restore Telegram channel in Clawdbot and use token file in config.
  • Migration

    • If ~/.gemini/settings.json is a symlink, delete it once and run make switch to create a writable file.

Written for commit 2f1f1a6. Summary will update on new commits.

…ript

- Added `git-ai` dependency to `Cargo.toml` from the main branch of the GitHub repository.
- Updated `install-cargo-globals.sh` to support parsing of git dependencies and handle version strings more robustly.
- Improved the logic for installing dependencies, including support for git repositories with branch, tag, and revision options.
- Modified `default.nix` to update the pnpmDepsHash for clawdbot.
- Enhanced `upgrade-overlays.sh` to dynamically detect platform and build configuration for better compatibility.
- Updated tests in `cargo_globals_spec.sh` to verify support for new dependency formats and installation methods.
…-4-7 in _ocxe_function.fish and _ocxeh_function.fish
- Use tokenFile instead of token for channels.telegram (schema requirement)
- Simplify hydrate script to only substitute necessary placeholders
Flake lock file updates:

• Updated input 'nix-clawdbot':
    'github:clawdbot/nix-clawdbot/fbbf80bc829180cc1e7c76bd2565de96e624d4e8?narHash=sha256-3tmn4wU1XBmaL7VnZQrtBkQZcth3O%2ButruKCZ6xEUYc%3D' (2026-01-22)
  → 'github:clawdbot/nix-clawdbot/aa60a29d387174c765893b135286714e17d0e85e?narHash=sha256-LkYuoCR07k2gA16XD7G/oyeic3jC5x8t49spvGHHiEo%3D' (2026-01-23)
Copilot AI review requested due to automatic review settings January 24, 2026 04:14
- Change gemini settings.json from symlink to copied file
- Only copy if file doesn't exist, allowing ruler to modify it
- Restore telegram channel config in clawdbot template
@mesa-dot-dev

mesa-dot-dev Bot commented Jan 24, 2026

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@coderabbitai

coderabbitai Bot commented Jan 24, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added git-ai checkpoint integration for Claude, Gemini, and Cursor tools for better version tracking
    • Added quota management configuration with auto and manual modes
  • Chores

    • Updated Claude to latest model versions and upgraded GLM model to 4.7
    • Implemented local Clawdbot service with improved configuration management
    • Enhanced macOS system library compatibility

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

The PR integrates git-ai checkpoint hooks into multiple LLM tools (Claude, Gemini, Cursor), reworks Clawdbot from an external overlay to an internal configuration with hydration and systemd service, migrates model configurations from GLM-4.6 to GLM-4.7 across multiple providers, enhances Cargo dependency parsing for git-based dependencies, and adds GitHub Actions auto-merge functionality.

Changes

Cohort / File(s) Summary
Git-AI Hook Integration
config/claude/settings.json, config/cursor/hooks.json, config/cursor/default.nix, config/gemini/settings.json, config/gemini/default.nix
Adds pre/post-tool-use checkpoint hooks for Claude, Cursor, and Gemini, invoking git-ai checkpoint with tool-specific identifiers and timeouts to capture code editor state during AI interactions.
Clawdbot Configuration Rework
home-manager/modules/clawdbot/default.nix, config/clawdbot/clawdbot.template.json, config/clawdbot/hydrate.sh, home-manager/modules/clawdbot/extract-secrets.sh
Removes external nix-clawdbot overlay dependency; introduces self-contained build from GitHub, template-based configuration hydration, systemd user service for gateway, and consolidated secret management via activation scripts.
Model Configuration Migration
config/clipproxyapi/config.yaml, config/llm/*, config/opencode/opencode.jsonc, config/pi/models.json, config/claude/settings.json
Migrates GLM-4.6 to GLM-4.7 across providers and updates model aliases; switches default models in opencode from openrouter-preset to clipproxyapi; adds local CLIProxyAPI references.
Cargo Dependency Enhancement
home-manager/modules/cargo-globals/install-cargo-globals.sh, home-manager/modules/cargo-globals/default.nix, spec/cargo_globals_spec.sh
Adds support for git-based Cargo dependencies alongside versioned ones; introduces structured parsing of dependency type (version vs. git), optional branch/tag/rev handling, and Darwin-specific libc integration (PKG_CONFIG_PATH, LDFLAGS, CPPFLAGS).
Shell Function Updates
home-manager/programs/fish/default.nix, home-manager/programs/fish/functions/_zpo_function.fish, home-manager/programs/fish/functions/_ocxe_function.fish, home-manager/programs/fish/functions/_ocxeh_function.fish
Reintroduces archived fish functions (_ocxe, _ocxeh, _pixe, _pixeh, _ssh_add_github), adds new zpo abbreviation for zellij attachment, adds ghq picker integration, and updates opencode preset references.
Build & Workflow Automation
.github/workflows/upgrade.yml, scripts/upgrade-overlays.sh
Adds auto-merge step to upgrade workflow with squash option; updates pnpmDeps hash computation to detect platform-specific nix configuration (aarch64-darwin vs. x86_64-darwin) dynamically.
Flake & Overlay Cleanup
flake.nix, overlays/default.nix, home-manager/default.nix, nix-darwin/default.nix
Removes nix-clawdbot flake input and corresponding overlay block; eliminates Darwin-specific Clawdbot.app installation script; simplifies module imports by removing clawdbot from home-manager modules.
Package & Dependency Updates
Cargo.toml, home-manager/packages/default.nix, config/llm/default_model.txt, config/llm/extra-openai-models.yaml
Adds git-ai dependency to Cargo.toml; includes libiconv in package lists for cross-platform Cargo support; sets GLM-4.7 as default LLM model; updates Claude model version pinning.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Possibly related PRs

Poem

🐰 Checkpoints sprouting everywhere,
GLM hops through code with care,
Clawdbot breaks from overlay chains,
Cargo git blooms through the veins! 🌿

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/gemini-settings-symlink

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mesa-dot-dev

mesa-dot-dev Bot commented Jan 24, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Changed gemini/settings.json from a symlink to a copied file via a home-manager activation script to allow external tools like ruler to modify it. Also restored Telegram channel configuration in the clawdbot template.

What changed?

  • gemini/settings.json: Now copied instead of symlinked, enabling write access by tools. The copy operation only occurs if the file doesn't already exist.
  • clawdbot/clawdbot.template.json: Reinstated the Telegram channel configuration.

Description generated by Mesa. Update settings

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @shunkakinoki, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the development environment's AI tool integration and configuration management. It addresses the writability of Gemini settings, streamlines Clawdbot's deployment and secret handling, and updates AI model definitions across several applications. Furthermore, it refines the process for installing global Rust packages, ensuring better compatibility and dependency resolution.

Highlights

  • Gemini Settings Writable: The gemini settings.json file is now copied using a home-manager activation script instead of being symlinked, enabling tools like 'ruler' to modify it directly.
  • Clawdbot Configuration Refactor: The Clawdbot NixOS module has been refactored to build Clawdbot from source, and its configuration now includes a dedicated hydrate.sh script for dynamic secret injection and Chromium path resolution. The Telegram channel configuration has also been restored in the Clawdbot template.
  • AI Tool Integration with git-ai: New git-ai checkpoint hooks have been added to config/claude/settings.json, config/cursor/hooks.json, and config/gemini/settings.json to track changes made by these AI tools during file edits and prompt submissions.
  • Model Configuration Updates: Various AI model configurations across cliproxyapi, llm, opencode, and pi have been updated, primarily focusing on glm-4.7 and newer Claude models, while removing older glm-4.6 references.
  • Improved Cargo Global Package Installation: The cargo-globals module now includes libiconv environment variables for Darwin builds and features a more robust install-cargo-globals.sh script that correctly handles both versioned and git-based Rust dependencies.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/upgrade.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@shunkakinoki
shunkakinoki deleted the fix/gemini-settings-symlink branch January 24, 2026 04:15

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request primarily addresses an issue with Gemini settings to make them writable, but also includes a substantial number of dependency updates and configuration changes across various tools like clawdbot, cliproxyapi, and opencode. A significant refactoring is the removal of the nix-clawdbot flake in favor of building clawdbot from source. My review focuses on improving the robustness, security, and maintainability of the new scripts and configurations. I've identified opportunities for improvement in git dependency pinning, secret handling in shell scripts, the idempotency of activation scripts, and the logic for installing cargo packages from git sources.

Comment thread Cargo.toml
path = "lib.rs"

[dependencies]
git-ai = { git = "https://github.com/git-ai-project/git-ai", branch = "main" }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The git-ai dependency is pinned to the main branch. This can lead to non-reproducible builds as the main branch can change at any time, which is especially risky for a dependency that seems to be used in hooks and automation. It's a best practice to pin git dependencies to a specific commit hash using the rev key to ensure build stability and predictability.

Suggested change
git-ai = { git = "https://github.com/git-ai-project/git-ai", branch = "main" }
git-ai = { git = "https://github.com/git-ai-project/git-ai", rev = "be15ad1b43dfa2febe643e3ed81be4e801df4d09" }

Comment on lines +42 to +48
@sed@ \
-e "s|__CLIPROXY_API_KEY__|${CLIPROXY_API_KEY}|g" \
-e "s|__TELEGRAM_TOKEN__|${TELEGRAM_TOKEN}|g" \
-e "s|__GATEWAY_TOKEN__|${GATEWAY_TOKEN}|g" \
-e "s|__CHROMIUM_PATH__|${CHROMIUM_PATH}|g" \
-e "s|__HOME__|${HOME}|g" \
"$TEMPLATE" >"$CONFIG"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using | as a delimiter in sed is risky when substituting secrets, as API keys or tokens could potentially contain this character, which would break the substitution. It's safer to use a delimiter that is less likely to appear in the secrets, such as # or / (if slashes are not expected in the values).

Suggested change
@sed@ \
-e "s|__CLIPROXY_API_KEY__|${CLIPROXY_API_KEY}|g" \
-e "s|__TELEGRAM_TOKEN__|${TELEGRAM_TOKEN}|g" \
-e "s|__GATEWAY_TOKEN__|${GATEWAY_TOKEN}|g" \
-e "s|__CHROMIUM_PATH__|${CHROMIUM_PATH}|g" \
-e "s|__HOME__|${HOME}|g" \
"$TEMPLATE" >"$CONFIG"
@sed@ \
-e "s#__CLIPROXY_API_KEY__#${CLIPROXY_API_KEY}#g" \
-e "s#__TELEGRAM_TOKEN__#${TELEGRAM_TOKEN}#g" \
-e "s#__GATEWAY_TOKEN__#${GATEWAY_TOKEN}#g" \
-e "s#__CHROMIUM_PATH__#${CHROMIUM_PATH}#g" \
-e "s#__HOME__#${HOME}#g" \
"$TEMPLATE" >"$CONFIG"

Comment on lines +90 to +108
if [ -n "${INSTALLED_MAP[$NAME]:-}" ]; then
echo "$NAME already installed (git), skipping"
continue
fi
echo "Installing $NAME from $GIT_URL..."
INSTALL_ARGS=(--git "$GIT_URL")
if [ -n "$REV" ]; then
INSTALL_ARGS+=(--rev "$REV")
elif [ -n "$TAG" ]; then
INSTALL_ARGS+=(--tag "$TAG")
elif [ -n "$BRANCH" ]; then
INSTALL_ARGS+=(--branch "$BRANCH")
fi
if ! cargo install "$NAME" "${INSTALL_ARGS[@]}" --locked 2>&1; then
if ! cargo install "$NAME" "${INSTALL_ARGS[@]}" 2>&1; then
echo "Failed to install $NAME from git, skipping..."
fi
fi
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The check for already-installed git dependencies is based on the version number from cargo install --list. This is unreliable for git dependencies, as the version in Cargo.toml might not change even if the underlying branch has new commits. This means the script will not update the package if the git repository is updated. To ensure the latest version from the git repository is always installed, you should use cargo install --force for git dependencies and remove the check for existing installations.

Suggested change
if [ -n "${INSTALLED_MAP[$NAME]:-}" ]; then
echo "$NAME already installed (git), skipping"
continue
fi
echo "Installing $NAME from $GIT_URL..."
INSTALL_ARGS=(--git "$GIT_URL")
if [ -n "$REV" ]; then
INSTALL_ARGS+=(--rev "$REV")
elif [ -n "$TAG" ]; then
INSTALL_ARGS+=(--tag "$TAG")
elif [ -n "$BRANCH" ]; then
INSTALL_ARGS+=(--branch "$BRANCH")
fi
if ! cargo install "$NAME" "${INSTALL_ARGS[@]}" --locked 2>&1; then
if ! cargo install "$NAME" "${INSTALL_ARGS[@]}" 2>&1; then
echo "Failed to install $NAME from git, skipping..."
fi
fi
fi
# Use --force to ensure git dependencies are updated to the latest commit from the specified branch/rev.
echo "Installing $NAME from $GIT_URL..."
INSTALL_ARGS=(--git "$GIT_URL")
if [ -n "$REV" ]; then
INSTALL_ARGS+=(--rev "$REV")
elif [ -n "$TAG" ]; then
INSTALL_ARGS+=(--tag "$TAG")
elif [ -n "$BRANCH" ]; then
INSTALL_ARGS+=(--branch "$BRANCH")
fi
if ! cargo install --force "$NAME" "${INSTALL_ARGS[@]}" --locked 2>&1; then
if ! cargo install --force "$NAME" "${INSTALL_ARGS[@]}" 2>&1; then
echo "Failed to install $NAME from git, skipping..."
fi
fi

"tokenFile": "__HOME__/.config/clawdbot/telegram-token",
"groups": {
"*": {"requireMention": false},
"-1003612372477": {"requireMention": false, "enabled": true}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The Telegram group ID "-1003612372477" is hardcoded in this template. If this value is user-specific or could change between environments, it would be better to treat it as a configurable parameter. Consider replacing it with a placeholder, like __TELEGRAM_GROUP_ID__, and substituting it in the hydrate.sh script, similar to how other secrets and configuration values are handled. This would make the template more generic and easier to manage.

Comment thread config/gemini/default.nix
Comment on lines +8 to +14
home.activation.geminiSettings = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
mkdir -p "$HOME/.gemini"
if [ ! -f "$HOME/.gemini/settings.json" ]; then
$DRY_RUN_CMD cp ${geminiSettingsSource} "$HOME/.gemini/settings.json"
$DRY_RUN_CMD chmod 644 "$HOME/.gemini/settings.json"
fi
'';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The activation script for geminiSettings only copies the file if it doesn't exist. As noted in the PR description, this doesn't handle the migration from an existing symlink automatically. To make the migration smoother and the script more robust, consider explicitly checking for and removing a symlink if it exists. This will make the activation script idempotent and handle the transition seamlessly for users.

  home.activation.geminiSettings = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
    TARGET_FILE="$HOME/.gemini/settings.json"
    mkdir -p "$(dirname "$TARGET_FILE")"
    if [ -L "$TARGET_FILE" ]; then
      $DRY_RUN_CMD rm -f "$TARGET_FILE"
    fi
    if [ ! -f "$TARGET_FILE" ]; then
      $DRY_RUN_CMD cp ${geminiSettingsSource} "$TARGET_FILE"
      $DRY_RUN_CMD chmod 644 "$TARGET_FILE"
    fi
  '';

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors several tooling integrations (Gemini, Cursor, Clawdbot, cargo globals, LLM configs) to work better with local state and git-ai checkpoints, and drops the external nix-clawdbot overlay in favor of an in-repo Clawdbot build and config.

Changes:

  • Replace Gemini’s settings symlink with a home-manager activation script that copies a writable settings.json, and add git-ai checkpoints for Gemini, Cursor, and Claude tool/file hooks.
  • Remove the nix-clawdbot flake overlay and introduce a custom Clawdbot derivation plus a hydrate.sh gateway script and template-driven configuration, along with updated secret handling and Telegram channel config.
  • Improve cargo globals installation to support both version and git dependencies and to build reliably on macOS (OpenSSL/libiconv/SDKROOT), and wire in git-ai as a Rust dependency and extra LLM model config.

Notable issues (see inline comments for details):

  • scripts/upgrade-overlays.sh still assumes the old Clawdbot overlay structure and a pnpmDepsHash in overlays/default.nix, which will now break the scheduled upgrade workflow.
  • The new config/clawdbot/hydrate.sh script is not yet included in the shellscript coverage spec, and the coverage list still references the deleted home-manager/modules/clawdbot/extract-secrets.sh.
  • The clawdbot-gateway systemd user unit uses a WorkingDirectory that is never created, so the service will fail to start on a fresh install.

Reviewed changes

Copilot reviewed 32 out of 34 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
spec/cargo_globals_spec.sh Updates shellspec expectations to match the new cargo-globals script behavior (type checks, .value.version, git deps).
scripts/upgrade-overlays.sh Adds platform-aware nix_config selection for pnpm hash computation and still contains Clawdbot-specific overlay upgrade logic (now out of sync with overlays/default.nix).
overlays/default.nix Simplifies overlays to just NUR, neovim-nightly, and a few small overrides, removing the custom Clawdbot overlay entirely.
nix-darwin/default.nix Drops the Clawdbot.app installation activation script for galactica, aligning with removal of the Clawdbot overlay/app package.
home-manager/programs/fish/functions/_zpo_function.fish Adds a helper to attach to the primary zellij session.
home-manager/programs/fish/functions/_ocxeh_function.fish Points the headless OpenCode GLM-4.7 helper at the cliproxyapi/glm-4-7 model instead of the openrouter preset.
home-manager/programs/fish/functions/_ocxe_function.fish Updates the interactive OpenCode GLM-4.7 function to use cliproxyapi/glm-4-7 for both default and run modes.
home-manager/programs/fish/default.nix Registers the new zpo function and reorders/extends the functions list to keep all helpers (including ocx*, pix*, ssh_add_github) loaded.
home-manager/packages/default.nix Adds libiconv to the common home packages to support macOS builds.
home-manager/modules/clawdbot/extract-secrets.sh Removes the old secrets-extraction script that read from .env and cliproxyapi auth; callers/tests still reference this path (see inline comment).
home-manager/modules/clawdbot/default.nix Replaces the nix-clawdbot module with a custom Clawdbot build (pnpm+node), a secrets extraction activation step, and a clawdbot-gateway systemd user service driven by the new hydrate script and template.
home-manager/modules/cargo-globals/install-cargo-globals.sh Extends cargo-globals install to set SDKROOT on macOS and to parse Cargo.toml dependency entries via jq (supporting string, table, and git dependencies) with smarter version reuse.
home-manager/modules/cargo-globals/default.nix Injects additional OpenSSL/libiconv-related build env vars on macOS and wires in the updated install script via a home-manager activation DAG entry.
home-manager/default.nix Stops importing inputs.nix-clawdbot.homeManagerModules.clawdbot, deferring entirely to the new in-tree Clawdbot module.
flake.nix Drops the nix-clawdbot input and simplifies nixpkgs wiring to a single input.
flake.lock Regenerates lockfile to remove nix-clawdbot and related inputs and update the pinned nixpkgs revision.
config/pi/models.json Removes the z-ai/glm-4.6 model from the Pi model config, leaving GLM-4.7 as the remaining GLM entry.
config/opencode/opencode.jsonc Switches default models to cliproxyapi/glm-4.7, adds CLIPROXY API key wiring, renames/normalizes GLM model IDs, and adjusts display names to clarify “local CLIProxyAPI”.
config/llm/extra-openai-models.yaml Updates Claude model IDs to the new 4.5 variants and adds a glm-4.7 entry for use via cliproxyapi.
config/llm/default_model.txt Introduces a default llm model file selecting glm-4.7.
config/llm/default.nix Symlinks extra-openai-models.yaml and the new default_model.txt into platform-appropriate locations for the io.datasette.llm tool on macOS and Linux.
config/gemini/settings.json Adds Gemini tool hooks that call git-ai checkpoint gemini before and after write/replace tools.
config/gemini/default.nix Replaces a symlinked Gemini settings file with a home-manager activation script that copies a real settings.json only if it does not already exist, preserving tool mutability.
config/default.nix Adds the new cursor and gemini config modules to the common configuration imports.
config/cursor/hooks.json Defines Cursor hooks to run git-ai checkpoint cursor after file edits and before prompt submission.
config/cursor/default.nix Installs the Cursor .cursor/hooks.json file into the home directory, forcing overwrites.
config/cliproxyapi/config.yaml Tunes routing strategy (fill-first), swaps the OpenRouter GLM mapping to an @preset/glm-4-7 alias, and simplifies Z-AI GLM configuration to just glm-4.7.
config/clawdbot/hydrate.sh New gateway launcher that reads secrets from files or env, templates clawdbot.json from clawdbot.template.json, sets ANTHROPIC_API_KEY, and starts the Clawdbot gateway.
config/clawdbot/clawdbot.template.json New template-based Clawdbot config defining browser, model providers via cliproxy, default agents, Telegram channels (including the restored group ID), gateway auth, and plugin paths.
config/claude/settings.json Adds Pre/Post tool hooks for Write/Edit/MultiEdit operations to invoke git-ai checkpoints with or without hook-input content.
config/ccs/config.template.yaml Introduces a quota_management section for CCS, describing hybrid/auto/manual modes and thresholds.
Cargo.toml Adds a git dependency on git-ai so Rust tooling can drive checkpoints directly.
Cargo.lock Regenerates the lockfile to include git-ai and its transitive dependencies.
.github/workflows/upgrade.yml Enhances the scheduled overlay upgrade workflow to capture the PR number and enable auto-merge via gh pr merge when a PR is created.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +133 to +143
Service = {
Type = "simple";
ExecStart = "${pkgs.bash}/bin/bash ${hydrateScript}";
Restart = "always";
RestartSec = "5s";
Environment = [
"HOME=${homeDir}"
];
RunAtLoad = true;
KeepAlive = true;
StandardErrorPath = "/tmp/clawdbot-tunnel.err.log";
WorkingDirectory = "${homeDir}/.clawdbot";
StandardOutput = "append:/tmp/clawdbot/clawdbot-gateway.log";
StandardError = "append:/tmp/clawdbot/clawdbot-gateway.log";

Copilot AI Jan 24, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The clawdbot-gateway unit sets WorkingDirectory = "${homeDir}/.clawdbot", but this directory is never created before the service starts; because systemd changes into the working directory before running ExecStart, the service will fail to start on a fresh install and hydrate.sh will never get a chance to create STATE_DIR. Consider either creating ${homeDir}/.clawdbot in a home-manager activation step (similar to clawdbotLogDir/clawdbotSecretsDir) or dropping WorkingDirectory if it is not strictly required.

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +58
# Read secret from file, stripping whitespace
read_secret() {
local file="$1"
if [ -f "$file" ]; then
tr -d '\n\r' <"$file"
else
echo ""
fi
}

# Load secrets from files or environment
CLIPROXY_API_KEY="${CLIPROXY_API_KEY:-$(read_secret "${SECRETS_DIR}/cliproxy-key")}"
TELEGRAM_TOKEN="${TELEGRAM_TOKEN:-$(read_secret "${SECRETS_DIR}/telegram-token")}"
GATEWAY_TOKEN="${GATEWAY_TOKEN:-$(read_secret "${SECRETS_DIR}/gateway-token")}"
ANTHROPIC_API_KEY="${ANTHROPIC_API_KEY:-$(read_secret "${SECRETS_DIR}/anthropic-key")}"

# Chromium path (injected by nix)
CHROMIUM_PATH="@chromium@/bin/chromium"

# Create state directory if needed
mkdir -p "$STATE_DIR"

# Generate config from template with secret substitution
@sed@ \
-e "s|__CLIPROXY_API_KEY__|${CLIPROXY_API_KEY}|g" \
-e "s|__TELEGRAM_TOKEN__|${TELEGRAM_TOKEN}|g" \
-e "s|__GATEWAY_TOKEN__|${GATEWAY_TOKEN}|g" \
-e "s|__CHROMIUM_PATH__|${CHROMIUM_PATH}|g" \
-e "s|__HOME__|${HOME}|g" \
"$TEMPLATE" >"$CONFIG"

echo "Generated clawdbot config at $CONFIG" >&2

# Export Anthropic API key for clawdbot
if [ -n "$ANTHROPIC_API_KEY" ]; then
export ANTHROPIC_API_KEY
fi

# Start clawdbot gateway
exec @clawdbot@/bin/clawdbot gateway --port 18789 "$@"

Copilot AI Jan 24, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new config/clawdbot/hydrate.sh script is not yet covered by the shellspec harness: spec/coverage_spec.sh’s covered_scripts list does not include this path, and it still references the removed home-manager/modules/clawdbot/extract-secrets.sh. As a result, the "covers all non-spec shell scripts" test will start failing once this lands; please add a dedicated spec for config/clawdbot/hydrate.sh and update covered_scripts to drop the old script and include this one.

Copilot uses AI. Check for mistakes.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 34 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="Cargo.toml">

<violation number="1" location="Cargo.toml:10">
P2: Git dependency is pinned to the moving `main` branch without a lockfile, making builds non‑reproducible and susceptible to upstream changes.</violation>
</file>

<file name="config/clawdbot/hydrate.sh">

<violation number="1" location="config/clawdbot/hydrate.sh:43">
P2: Secrets are inserted into sed replacements without escaping, so tokens containing `&`, `|`, or JSON special characters can break sed or produce invalid JSON.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread Cargo.toml
path = "lib.rs"

[dependencies]
git-ai = { git = "https://github.com/git-ai-project/git-ai", branch = "main" }

@cubic-dev-ai cubic-dev-ai Bot Jan 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Git dependency is pinned to the moving main branch without a lockfile, making builds non‑reproducible and susceptible to upstream changes.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At Cargo.toml, line 10:

<comment>Git dependency is pinned to the moving `main` branch without a lockfile, making builds non‑reproducible and susceptible to upstream changes.</comment>

<file context>
@@ -7,4 +7,5 @@ edition = "2021"
 path = "lib.rs"
 
 [dependencies]
+git-ai = { git = "https://github.com/git-ai-project/git-ai", branch = "main" }
 worktrunk = "0.18.2"
</file context>
Fix with Cubic


# Generate config from template with secret substitution
@sed@ \
-e "s|__CLIPROXY_API_KEY__|${CLIPROXY_API_KEY}|g" \

@cubic-dev-ai cubic-dev-ai Bot Jan 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Secrets are inserted into sed replacements without escaping, so tokens containing &, |, or JSON special characters can break sed or produce invalid JSON.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At config/clawdbot/hydrate.sh, line 43:

<comment>Secrets are inserted into sed replacements without escaping, so tokens containing `&`, `|`, or JSON special characters can break sed or produce invalid JSON.</comment>

<file context>
@@ -0,0 +1,58 @@
+
+# Generate config from template with secret substitution
+@sed@ \
+  -e "s|__CLIPROXY_API_KEY__|${CLIPROXY_API_KEY}|g" \
+  -e "s|__TELEGRAM_TOKEN__|${TELEGRAM_TOKEN}|g" \
+  -e "s|__GATEWAY_TOKEN__|${GATEWAY_TOKEN}|g" \
</file context>
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants