Skip to content

Refactor SSH agent keychain integration for Linux - #426

Merged
shunkakinoki merged 16 commits into
mainfrom
fix-services-imports
Dec 21, 2025
Merged

Refactor SSH agent keychain integration for Linux#426
shunkakinoki merged 16 commits into
mainfrom
fix-services-imports

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Dec 16, 2025

Copy link
Copy Markdown
Owner

Add configuration for keychain integration on Linux while removing the previous implementation that loaded additional keys. This simplifies the key loading process.


Summary by cubic

Simplified Linux SSH agent keychain by loading only the default key. Added CLIProxyAPI auth backup/recovery and Z.ai provider support.

  • New Features

    • Periodic backup and recovery of auth files to R2/S3 to prevent race-condition deletes.
    • Z.ai provider (glm-4.6) with ZAI_API_KEY injection.
  • Migration

    • If you use a separate GitHub key, add it manually or configure it explicitly.

Written for commit f984462. Summary will update automatically on new commits.

Copilot AI review requested due to automatic review settings December 16, 2025 01:20
@shunkakinoki
shunkakinoki enabled auto-merge (squash) December 16, 2025 01:20
@shunkakinoki shunkakinoki self-assigned this Dec 16, 2025

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 the SSH agent keychain integration for Linux by simplifying the key loading logic. It removes the automatic loading of a GitHub-specific SSH key while retaining the default key loading mechanism.

Key Changes:

  • Removed automatic loading of ~/.ssh/id_ed25519_github key
  • Updated comment to remove the "(no passphrase)" note from the default key loading section

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

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Dec 16, 2025

Copy link
Copy Markdown

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added Z‑AI (GLM-4.6) provider integration and API key wiring
    • Introduced scheduled backup & recovery for auth files with S3‑compatible support and helper scripts
  • Bug Fixes

    • Improved macOS hostname detection (ComputerName fallback)
    • Simplified SSH key loading to only consider the default key
  • Refactor

    • Reorganized service/module configuration and renamed yek activation path
  • Tests

    • Added specs for backup/recovery scripts and updated related test coverage

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

Walkthrough

Removed GitHub-specific SSH key auto-loading; moved brewUpgrader into top-level services let and adjusted sshAgent export; renamed programs.yekmodules.yek; added Z‑AI provider entries to OpenAI-compatible configs; added cliproxyapi backup/recover scripts plus launchd/systemd timer+service and tests.

Changes

Cohort / File(s) Summary
SSH agent
home-manager/services/ssh-agent/default.nix
Removed conditional loading of ~/.ssh/id_ed25519_github; updated default-key comment so only ~/.ssh/id_ed25519 is considered.
Services export / brewUpgrader
home-manager/services/default.nix, home-manager/services/.../brew-upgrader*
Moved brewUpgrader = import ./brew-upgrader { inherit pkgs; }; into the top-level let, removed duplicate binding, and preserved export order with brewUpgrader first.
sshAgent export
home-manager/services/default.nix
Changed sshAgent export to import ./ssh-agent with explicit attribute set (inherit config lib pkgs).
Yek module rename
home-manager/default.nix, home-manager/modules/yek/default.nix
Renamed configuration paths and option group from programs.yekmodules.yek; updated cfg references accordingly.
cliproxyapi backup & service
home-manager/services/cliproxyapi/default.nix, home-manager/services/cliproxyapi/start.sh
Added backup scheduling and service entries (Darwin launchd agent; Linux systemd timer & service). Integrated pre-start backup and optional post-config recovery calls in start.sh; moved/objectstore env exports to top.
Backup scripts
home-manager/services/cliproxyapi/scripts/backup-and-recover.sh, .../backup-auth.sh, .../recover-auth.sh
Added strict shell scripts to back up auth files to an S3‑compatible bucket and recover missing files; optional local .env sourcing; aws sync failures treated as non-fatal with warnings.
Config: cliproxyapi OpenAI-compat
config/cliproxyapi/config.yaml
Added openai-compatibility.models provider z-ai with base-url, API key placeholder __ZAI_API_KEY__, and model glm-4.6.
Config: opencode provider models
config/opencode/opencode.jsonc
Added z-ai provider with model glm-4.6 and apiKey option; added apiKey option to existing openrouter provider.
Tests / coverage
spec/cliproxyapi_backup_spec.sh, spec/code_syncer_spec.sh, spec/coverage_spec.sh
Added shellspec suites for backup/recover scripts; hardened PATH handling and simplified expectations in code_syncer tests; updated coverage list to include new scripts.
Misc script tweak
config/claude/pushover.sh
Switched hostname lookup to macOS-friendly scutil --get ComputerName with fallbacks to hostname -s and "unknown".

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Scheduler as Scheduler (launchd / systemd.timer)
  participant BackupScript as backup-and-recover.sh
  participant BackupWorker as backup-auth.sh
  participant RecoverWorker as recover-auth.sh
  participant ObjectStore as S3-compatible object store
  Note over Scheduler,BackupScript: periodic trigger (every 5 minutes)
  Scheduler ->> BackupScript: Execute
  BackupScript ->> BackupWorker: run backup-auth.sh (if present & executable)
  BackupWorker ->> ObjectStore: aws s3 sync AUTH_DIR → BACKUP_DIR
  BackupWorker -->> BackupScript: return (success / warning)
  BackupScript ->> RecoverWorker: run recover-auth.sh (if present & executable)
  RecoverWorker ->> ObjectStore: aws s3 sync BACKUP_DIR → AUTH_DIR (if missing/empty)
  RecoverWorker -->> BackupScript: return (restored / none)
  BackupScript -->> Scheduler: exit
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–30 minutes

  • Areas needing attention:
    • home-manager/services/ssh-agent/default.nix: confirm intent to stop auto-loading id_ed25519_github.
    • home-manager/services/cliproxyapi/* and scripts: credential sourcing precedence, non-fatal aws sync handling, and portability across macOS/Linux.
    • home-manager/services/default.nix: ensure reordering of brewUpgrader and changed sshAgent import don't alter evaluation side-effects.
    • config/opencode/opencode.jsonc and config/cliproxyapi/config.yaml: verify environment variable names/placeholders for new provider.

Possibly related PRs

Suggested labels

enhancement

Poem

🐰 I hopped through lines with careful cheer,
Pruned keys, set timers, backups near,
Z‑AI models added to the stack,
Brew shuffled forward—no step back,
Thump-thump, configs safe and clear 🥕

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title focuses only on SSH agent refactoring, but the changeset includes major features like CLIProxyAPI backup/recovery and Z.ai provider support that are not mentioned. Update the title to reflect the full scope: include SSH agent simplification, CLIProxyAPI backup/recovery, and Z.ai provider support, or focus on the most critical change only.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description is well-related to the changeset, covering SSH key simplification, auth backup/recovery, and Z.ai provider support with migration notes.
✨ 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-services-imports

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.

@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 refactors the SSH agent keychain integration for Linux by streamlining the key loading process and updating the file structure. The primary goal is to simplify how SSH keys are managed and loaded into the agent, making the configuration cleaner and more focused on default key handling.

Highlights

  • File Renaming: The configuration file for the SSH agent service has been renamed from home-manager/services/ssh-agent.nix to home-manager/services/ssh-agent/default.nix. This change likely aligns with standard module structuring practices.
  • Simplified Key Loading: The explicit loading of the ~/.ssh/id_ed25519_github key has been removed from the SSH agent keychain integration. The system will now primarily focus on loading the default ~/.ssh/id_ed25519 key, simplifying the key management logic.
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.

@mesa-dot-dev

mesa-dot-dev Bot commented Dec 16, 2025

Copy link
Copy Markdown

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

@mesa-dot-dev

mesa-dot-dev Bot commented Dec 16, 2025

Copy link
Copy Markdown

Mesa Description

TL;DR

Simplified Linux SSH agent keychain integration by loading only the default key. Introduced robust backup and recovery for cliproxyapi authentication files to S3, and added support for the Z.ai (glm-4.6) provider across cliproxyapi and opencode configurations.

What changed?

  • home-manager/services/ssh-agent/default.nix: Simplified SSH agent configuration by removing explicit GitHub-specific SSH key loading logic.
  • home-manager/services/default.nix: Updated module function signature and sshAgent service import to pass config, lib, and pkgs.
  • home-manager/default.nix: Refactored to pass config and lib to services import; moved yek program enablement.
  • home-manager/modules/yek/default.nix: Refactored yek module configuration path from config.programs.yek to config.modules.yek.
  • config/cliproxyapi/config.yaml: Added "z-ai" provider with "glm-4.6" model to openai-compatibility configuration.
  • config/opencode/opencode.jsonc: Introduced an options field with OPENROUTER_API_KEY and a new z-ai configuration block for the glm-4.6 model using ZAI_API_KEY.
  • home-manager/services/cliproxyapi/default.nix: Implemented a new cliproxyapi-backup service with launchd (macOS) and systemd (Linux) for periodic authentication file backup and recovery.
  • home-manager/services/cliproxyapi/scripts/backup-and-recover.sh: Added a new script to orchestrate the backup and recovery of authentication files, including logging.
  • home-manager/services/cliproxyapi/scripts/backup-auth.sh: Added a new script to back up authentication files to an R2 S3 bucket before service startup to prevent data loss.
  • home-manager/services/cliproxyapi/scripts/recover-auth.sh: Added a new script to recover missing or corrupted authentication files from R2 S3 backup.
  • home-manager/services/cliproxyapi/start.sh: Modified to move S3 environment variable exports, integrate backup/recovery steps, and include sed substitution for __ZAI_API_KEY__.
  • config/claude/pushover.sh: Improved hostname retrieval on macOS for more descriptive notifications.
  • spec/cliproxyapi_backup_spec.sh: Added new shellspec tests for cliproxyapi's backup and recovery scripts.
  • spec/code_syncer_spec.sh: Enhanced testing for VS Code CLI detection by controlling the PATH environment variable.
  • spec/coverage_spec.sh: Extended test coverage tracking to include the new home-manager/services/cliproxyapi scripts.

Description generated by Mesa. Update settings

@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.

No issues found across 1 file

@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

The pull request removes the explicit loading of a GitHub-specific SSH key (~/.ssh/id_ed25519_github) from the ssh-agent configuration, simplifying the key loading process to only include the default id_ed25519 key.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 990cfb1 and 0ad2cb4.

📒 Files selected for processing (1)
  • home-manager/services/ssh-agent/default.nix (1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.nix

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.nix: Use nixfmt for formatting all Nix files
Document complex configurations with comments in Nix files

**/*.nix: Use 2 spaces for indentation in Nix files
Keep line length under 100 characters in Nix files
Sort attribute sets alphabetically in Nix files
Use consistent spacing around operators in Nix files
Format lists and sets consistently in Nix files

Use treefmt.toml for formatting Nix files

**/*.nix: Use mkOption for configurable options in Nix modules
Implement proper typing for all options in Nix modules
Follow the Nix expression language style guide

Files:

  • home-manager/services/ssh-agent/default.nix
**/default.nix

📄 CodeRabbit inference engine (CLAUDE.md)

Use default.nix files for module exports

Files:

  • home-manager/services/ssh-agent/default.nix
home-manager/services/*/default.nix

📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)

Service configurations should be located in home-manager/services/<name>/ with proper service definitions and correct dependency handling

Files:

  • home-manager/services/ssh-agent/default.nix
home-manager/services/**/default.nix

📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)

Service configurations must include proper service definitions, handle dependencies correctly, and document service parameters

Files:

  • home-manager/services/ssh-agent/default.nix
home-manager/**/*.nix

📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)

home-manager/**/*.nix: Use typed options whenever possible in Nix configurations
Document all configuration options in Nix modules and programs
Follow home-manager's module structure and keep configurations modular
Use proper indentation and formatting in Nix configuration files

Files:

  • home-manager/services/ssh-agent/default.nix
home-manager/services/**/*.nix

📄 CodeRabbit inference engine (.cursor/rules/nix.mdc)

Service configurations in home-manager/services/ should follow systemd service conventions, include proper service dependencies, and have clear documentation for service parameters

Files:

  • home-manager/services/ssh-agent/default.nix
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: docker-build-push (linux/amd64, amd64, ubuntu-latest)
  • GitHub Check: lua-neovim-test
  • GitHub Check: docker-build-push (linux/arm64, arm64, ubuntu-24.04-arm)
  • GitHub Check: e2e-run (Ubuntu, ubuntu-latest)
  • GitHub Check: e2e-run (MacOS, macos-latest)
  • GitHub Check: lua-neovim
  • GitHub Check: nix-linux
  • GitHub Check: nix-nixos
  • GitHub Check: lua-hammerspoon
  • GitHub Check: e2e-run (NixOS, ubuntu-latest)
  • GitHub Check: shellcheck
  • GitHub Check: shellspec
🔇 Additional comments (3)
home-manager/services/ssh-agent/default.nix (3)

1-10: LGTM! Clean module structure.

The module structure follows Nix conventions with proper platform detection utilities imported for conditional logic.


11-19: LGTM! Proper platform-specific configuration.

The Linux-specific keychain configuration is properly guarded with lib.mkIf isLinux, and lib.mkAfter ensures correct shell initialization ordering. The comments clearly document the difference between Linux and macOS key management approaches.


26-31: LGTM! Proper keychain initialization with appropriate error handling.

The keychain initialization logic is well-structured:

  • Checks for keys before attempting initialization
  • Uses appropriate flags (--eval, --quiet, --confirm)
  • Comment clearly documents that --confirm will skip passphrase-protected keys in non-interactive contexts
  • Error handling with or true is appropriate for login scripts to prevent shell startup failures

Comment on lines +21 to 24
# Always try to load the default key
if test -f ~/.ssh/id_ed25519
set -a keys ~/.ssh/id_ed25519
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Search for references to id_ed25519_github in the codebase
rg "id_ed25519_github" -n --type-list | head -5
rg "id_ed25519_github" -n 2>/dev/null || echo "No references found"

Repository: shunkakinoki/dotfiles

Length of output: 2153


🏁 Script executed:

# Check for SSH identity configurations that might reference this key pattern
rg "IdentityFile|identity.*github|ssh.*github" -n -g "*.nix" -g "*.conf" -g "*.ssh" 2>/dev/null | head -20

Repository: shunkakinoki/dotfiles

Length of output: 941


🏁 Script executed:

# Get full context of the ssh-agent service configuration
if [ -f "home-manager/services/ssh-agent/default.nix" ]; then
  wc -l "home-manager/services/ssh-agent/default.nix"
  cat -n "home-manager/services/ssh-agent/default.nix"
fi

Repository: shunkakinoki/dotfiles

Length of output: 1325


This removal is a breaking change—verify user migration path or update documentation.

The removal of automatic ~/.ssh/id_ed25519_github loading is confirmed to impact multiple parts of the codebase: SSH client configuration (home-manager/programs/ssh/default.nix:41), a dedicated _ssh_add_github Fish function, and host-specific key setup in named-hosts/kyber/.

While an on-demand mechanism exists via the _ssh_add_github function, users who relied on automatic loading will need to manually invoke it or rename their key to the default. Ensure:

  1. Migration guide or release notes document this behavior change
  2. Users are directed to the _ssh_add_github function as the replacement for automatic loading
  3. Consider whether the default key should still support GitHub usage, or if the dedicated function is the intended pattern

@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 10 files (changes from recent commits).

Prompt for AI agents (all 2 issues)

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


<file name="home-manager/services/cliproxyapi/scripts/recover-auth.sh">

<violation number="1" location="home-manager/services/cliproxyapi/scripts/recover-auth.sh:12">
P2: Unquoted variable `$AUTH_DIR` inside command substitution could cause issues with paths containing spaces. All other usages of `$AUTH_DIR` in this script are properly quoted.</violation>
</file>

<file name="home-manager/services/cliproxyapi/scripts/backup-auth.sh">

<violation number="1" location="home-manager/services/cliproxyapi/scripts/backup-auth.sh:12">
P2: Unquoted variable `$AUTH_DIR` in command substitution could cause issues if the path contains spaces or special characters. Quote the variable for safety.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

AUTH_DIR="$CONFIG_DIR/objectstore/auths"

# Check if auth directory is missing or empty
if [ ! -d "$AUTH_DIR" ] || [ -z "$(ls -A $AUTH_DIR 2>/dev/null)" ]; then

@cubic-dev-ai cubic-dev-ai Bot Dec 19, 2025

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: Unquoted variable $AUTH_DIR inside command substitution could cause issues with paths containing spaces. All other usages of $AUTH_DIR in this script are properly quoted.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At home-manager/services/cliproxyapi/scripts/recover-auth.sh, line 12:

<comment>Unquoted variable `$AUTH_DIR` inside command substitution could cause issues with paths containing spaces. All other usages of `$AUTH_DIR` in this script are properly quoted.</comment>

<file context>
@@ -0,0 +1,22 @@
+AUTH_DIR=&quot;$CONFIG_DIR/objectstore/auths&quot;
+
+# Check if auth directory is missing or empty
+if [ ! -d &quot;$AUTH_DIR&quot; ] || [ -z &quot;$(ls -A $AUTH_DIR 2&gt;/dev/null)&quot; ]; then
+  echo &quot;Auth files missing, attempting recovery from R2 backup...&quot; &gt;&amp;2
+  mkdir -p &quot;$AUTH_DIR&quot;
</file context>

✅ Addressed in 9a5171f

AUTH_DIR="$CONFIG_DIR/objectstore/auths"

# Check if auth directory has files
if [ -d "$AUTH_DIR" ] && [ -n "$(ls -A $AUTH_DIR 2>/dev/null)" ]; then

@cubic-dev-ai cubic-dev-ai Bot Dec 19, 2025

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: Unquoted variable $AUTH_DIR in command substitution could cause issues if the path contains spaces or special characters. Quote the variable for safety.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At home-manager/services/cliproxyapi/scripts/backup-auth.sh, line 12:

<comment>Unquoted variable `$AUTH_DIR` in command substitution could cause issues if the path contains spaces or special characters. Quote the variable for safety.</comment>

<file context>
@@ -0,0 +1,21 @@
+AUTH_DIR=&quot;$CONFIG_DIR/objectstore/auths&quot;
+
+# Check if auth directory has files
+if [ -d &quot;$AUTH_DIR&quot; ] &amp;&amp; [ -n &quot;$(ls -A $AUTH_DIR 2&gt;/dev/null)&quot; ]; then
+  echo &quot;Backing up auth files to R2 backup directory...&quot; &gt;&amp;2
+  AWS_ACCESS_KEY_ID=&quot;${OBJECTSTORE_ACCESS_KEY}&quot; \
</file context>

✅ Addressed in 9a5171f

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (4)
home-manager/services/default.nix (1)

1-26: Consider adding a module-level documentation comment.

While the file structure is clear, a brief header comment explaining that this module aggregates and exports all home-manager service configurations would improve maintainability for future contributors.

📝 Example documentation comment
+# Service module aggregator for home-manager
+# Imports and exports all service configurations as a list
 {
   config,
   lib,

Based on coding guidelines, documenting configuration modules is recommended.

home-manager/services/cliproxyapi/default.nix (1)

45-59: Consider reducing backup frequency and adding documentation.

The 5-minute backup interval (StartInterval = 300) may be unnecessarily aggressive for authentication files that likely change infrequently. Consider increasing the interval to 15-30 minutes unless there's a specific requirement for such frequent backups.

Additionally, document the purpose and behavior of this backup service with comments explaining:

  • What files are being backed up
  • Why the 5-minute interval was chosen
  • The relationship to the main cliproxyapi service

Based on learnings, service configurations should include clear documentation for service parameters.

Suggested documentation improvement
+  # Backup/recovery service for auth files
+  # Runs every 5 minutes to back up ~/.cli-proxy-api/objectstore/auths to R2
+  # and recover missing files if needed (protects against race condition deletions)
   launchd.agents.cliproxyapi-backup = lib.mkIf pkgs.stdenv.isDarwin {
home-manager/services/cliproxyapi/scripts/backup-and-recover.sh (1)

1-25: Add validation for required environment variables.

The script sources .env but doesn't validate that the required OBJECTSTORE_* environment variables are set before proceeding. This could lead to confusing failures in the backup/recovery scripts when AWS commands fail due to missing credentials.

Suggested validation
 # Source .env for credentials
 if [ -f "$HOME/dotfiles/.env" ]; then
   set -a
   # shellcheck source=/dev/null
   source "$HOME/dotfiles/.env"
   set +a
 fi

+# Validate required environment variables
+required_vars=("OBJECTSTORE_ENDPOINT" "OBJECTSTORE_BUCKET" "OBJECTSTORE_ACCESS_KEY" "OBJECTSTORE_SECRET_KEY")
+for var in "${required_vars[@]}"; do
+  if [ -z "${!var:-}" ]; then
+    echo "[$(date)] Warning: $var not set, skipping backup/recovery" >&2
+    exit 0
+  fi
+done
+
 # Run backup
home-manager/services/cliproxyapi/start.sh (1)

21-47: LGTM! Backup/recovery integration is well-structured.

The changes successfully integrate backup and recovery functionality into the startup flow:

  • Object storage environment variables are properly exported at the top
  • Backup runs before config generation to preserve existing state
  • Recovery runs after config generation to restore missing files
  • Conditional execution with -x checks ensures scripts only run when present

The addition of __ZAI_API_KEY__ substitution aligns with the new Z-AI provider configuration.

Optional: Add comment explaining the environment variable fallback logic
+# Export S3-compatible object storage env vars (needed for backup/recovery)
+# Fallback order: OBJECTSTORE_* → AWS_S3_* → AWS_* (for compatibility)
 export OBJECTSTORE_ENDPOINT="${OBJECTSTORE_ENDPOINT:-${AWS_S3_ENDPOINT:-}}"
 export OBJECTSTORE_BUCKET="${OBJECTSTORE_BUCKET:-${AWS_S3_BUCKET:-}}"
 export OBJECTSTORE_ACCESS_KEY="${OBJECTSTORE_ACCESS_KEY:-${AWS_ACCESS_KEY_ID:-}}"
 export OBJECTSTORE_SECRET_KEY="${OBJECTSTORE_SECRET_KEY:-${AWS_SECRET_ACCESS_KEY:-}}"

This clarifies the multiple fallback levels for future maintainers.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between abf72eb and 3523468.

📒 Files selected for processing (9)
  • config/cliproxyapi/config.yaml (1 hunks)
  • config/opencode/opencode.jsonc (1 hunks)
  • home-manager/default.nix (2 hunks)
  • home-manager/services/cliproxyapi/default.nix (2 hunks)
  • home-manager/services/cliproxyapi/scripts/backup-and-recover.sh (1 hunks)
  • home-manager/services/cliproxyapi/scripts/backup-auth.sh (1 hunks)
  • home-manager/services/cliproxyapi/scripts/recover-auth.sh (1 hunks)
  • home-manager/services/cliproxyapi/start.sh (1 hunks)
  • home-manager/services/default.nix (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • home-manager/default.nix
🧰 Additional context used
📓 Path-based instructions (10)
**/*.{sh,bash}

📄 CodeRabbit inference engine (CLAUDE.md)

Use shfmt with 2-space indentation for shell scripts

**/*.{sh,bash}: Use 2 spaces for indentation in shell scripts
Add proper shebang lines to shell scripts
Follow shellcheck recommendations in shell scripts
Document complex commands in shell scripts
Use consistent variable naming in shell scripts

Files:

  • home-manager/services/cliproxyapi/scripts/backup-and-recover.sh
  • home-manager/services/cliproxyapi/scripts/backup-auth.sh
  • home-manager/services/cliproxyapi/scripts/recover-auth.sh
  • home-manager/services/cliproxyapi/start.sh
**/*.{json,yaml,yml,toml}

📄 CodeRabbit inference engine (.cursor/rules/formatting.mdc)

**/*.{json,yaml,yml,toml}: Use consistent indentation (2 spaces) in configuration files
Sort keys alphabetically when possible in configuration files
Use clear, descriptive names in configuration files

Files:

  • config/cliproxyapi/config.yaml
**/*.{yaml,yml,toml}

📄 CodeRabbit inference engine (.cursor/rules/formatting.mdc)

Add comments for complex configurations

Files:

  • config/cliproxyapi/config.yaml
**/*.nix

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.nix: Use nixfmt for formatting all Nix files
Document complex configurations with comments in Nix files

**/*.nix: Use 2 spaces for indentation in Nix files
Keep line length under 100 characters in Nix files
Sort attribute sets alphabetically in Nix files
Use consistent spacing around operators in Nix files
Format lists and sets consistently in Nix files

Use treefmt.toml for formatting Nix files

**/*.nix: Use mkOption for configurable options in Nix modules
Implement proper typing for all options in Nix modules
Follow the Nix expression language style guide

Files:

  • home-manager/services/cliproxyapi/default.nix
  • home-manager/services/default.nix
**/default.nix

📄 CodeRabbit inference engine (CLAUDE.md)

Use default.nix files for module exports

Files:

  • home-manager/services/cliproxyapi/default.nix
  • home-manager/services/default.nix
home-manager/services/*/default.nix

📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)

Service configurations should be located in home-manager/services/<name>/ with proper service definitions and correct dependency handling

Files:

  • home-manager/services/cliproxyapi/default.nix
home-manager/services/**/default.nix

📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)

Service configurations must include proper service definitions, handle dependencies correctly, and document service parameters

Files:

  • home-manager/services/cliproxyapi/default.nix
  • home-manager/services/default.nix
home-manager/**/*.nix

📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)

home-manager/**/*.nix: Use typed options whenever possible in Nix configurations
Document all configuration options in Nix modules and programs
Follow home-manager's module structure and keep configurations modular
Use proper indentation and formatting in Nix configuration files

Files:

  • home-manager/services/cliproxyapi/default.nix
  • home-manager/services/default.nix
home-manager/services/**/*.nix

📄 CodeRabbit inference engine (.cursor/rules/nix.mdc)

Service configurations in home-manager/services/ should follow systemd service conventions, include proper service dependencies, and have clear documentation for service parameters

Files:

  • home-manager/services/cliproxyapi/default.nix
  • home-manager/services/default.nix
**/*.{js,jsx,ts,tsx,json,jsonc,md}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

Use Biome for code formatting as configured in biome.json

Files:

  • config/opencode/opencode.jsonc
🧠 Learnings (15)
📚 Learning: 2025-11-25T09:34:40.062Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T09:34:40.062Z
Learning: Document all major changes in Nix configurations

Applied to files:

  • home-manager/services/cliproxyapi/default.nix
  • home-manager/services/default.nix
📚 Learning: 2025-11-25T09:35:01.066Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/nix.mdc:0-0
Timestamp: 2025-11-25T09:35:01.066Z
Learning: Applies to home-manager/services/**/*.nix : Service configurations in `home-manager/services/` should follow systemd service conventions, include proper service dependencies, and have clear documentation for service parameters

Applied to files:

  • home-manager/services/cliproxyapi/default.nix
  • home-manager/services/default.nix
📚 Learning: 2025-11-25T09:34:55.014Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/services/**/default.nix : Service configurations must include proper service definitions, handle dependencies correctly, and document service parameters

Applied to files:

  • home-manager/services/cliproxyapi/default.nix
  • home-manager/services/default.nix
📚 Learning: 2025-11-25T09:34:55.014Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/programs/**/*.nix : Follow program-specific best practices in program configuration files

Applied to files:

  • home-manager/services/cliproxyapi/default.nix
  • home-manager/services/default.nix
📚 Learning: 2025-11-25T09:34:40.062Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T09:34:40.062Z
Learning: Keep configurations modular across home-manager, hosts, and nix-darwin directories

Applied to files:

  • home-manager/services/cliproxyapi/default.nix
  • home-manager/services/default.nix
📚 Learning: 2025-11-25T09:35:01.066Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/nix.mdc:0-0
Timestamp: 2025-11-25T09:35:01.066Z
Learning: Applies to home-manager/programs/**/*.nix : Program configurations in `home-manager/programs/` should be organized by program name, include all necessary dependencies, use `home.packages` for package installations, and use `programs.<name>` when available in home-manager

Applied to files:

  • home-manager/services/cliproxyapi/default.nix
  • home-manager/services/default.nix
📚 Learning: 2025-11-25T09:34:55.014Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/services/*/default.nix : Service configurations should be located in `home-manager/services/<name>/` with proper service definitions and correct dependency handling

Applied to files:

  • home-manager/services/default.nix
📚 Learning: 2025-11-25T09:34:55.014Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/**/*.nix : Follow home-manager's module structure and keep configurations modular

Applied to files:

  • home-manager/services/default.nix
📚 Learning: 2025-11-25T09:34:55.014Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/**/*.nix : Document all configuration options in Nix modules and programs

Applied to files:

  • home-manager/services/default.nix
📚 Learning: 2025-11-25T09:34:55.014Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/programs/**/default.nix : Program configurations must include all necessary dependencies in their configuration

Applied to files:

  • home-manager/services/default.nix
📚 Learning: 2025-11-25T09:34:23.224Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T09:34:23.224Z
Learning: Applies to nix-darwin/**/*.nix : Use Homebrew only for macOS-specific applications

Applied to files:

  • home-manager/services/default.nix
📚 Learning: 2025-11-25T09:35:01.066Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/nix.mdc:0-0
Timestamp: 2025-11-25T09:35:01.066Z
Learning: Applies to home-manager/modules/**/default.nix : Each module in `home-manager/modules/` should have a clear `default.nix` with proper option declarations following the home-manager module structure

Applied to files:

  • home-manager/services/default.nix
📚 Learning: 2025-11-25T09:34:23.224Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T09:34:23.224Z
Learning: Prefer Nix packages over external package managers

Applied to files:

  • home-manager/services/default.nix
📚 Learning: 2025-11-25T09:34:40.062Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T09:34:40.062Z
Learning: Applies to flake.nix : Maintain flake.nix as the main Nix configuration with proper structure

Applied to files:

  • home-manager/services/default.nix
📚 Learning: 2025-11-25T09:35:01.066Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/nix.mdc:0-0
Timestamp: 2025-11-25T09:35:01.066Z
Learning: Applies to home-manager/modules/**/*.nix : Document all custom modules and options

Applied to files:

  • home-manager/services/default.nix
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: docker-build-push (linux/amd64, amd64, ubuntu-latest)
  • GitHub Check: docker-build-push (linux/arm64, arm64, ubuntu-24.04-arm)
  • GitHub Check: lua-neovim-test
  • GitHub Check: lua-neovim
  • GitHub Check: nix-linux
  • GitHub Check: lua-hammerspoon
  • GitHub Check: nix-nixos
  • GitHub Check: e2e-run (Ubuntu, ubuntu-latest)
  • GitHub Check: nix-darwin
  • GitHub Check: e2e-run (NixOS, ubuntu-latest)
  • GitHub Check: shellcheck
  • GitHub Check: e2e-run (MacOS, macos-latest)
  • GitHub Check: shellspec
🔇 Additional comments (6)
home-manager/services/default.nix (3)

1-6: LGTM! Parameter additions support the refactored ssh-agent module.

The addition of config and lib parameters is necessary to support the updated ssh-agent module import, which now requires these dependencies for its refactored implementation.


14-16: LGTM! Directory-based import follows module structure best practices.

The refactored sshAgent import correctly transitions from a file-based to a directory-based module structure (using default.nix), and properly passes the required config, lib, and pkgs dependencies to support the updated SSH agent implementation.

Based on coding guidelines, this change aligns with the requirement to use default.nix files for module exports and follow home-manager's modular structure.


8-8: Good refactoring to consolidate the brewUpgrader binding.

Moving the brewUpgrader import to the top of the let block improves code clarity by consolidating it into a single, clearly visible location.

config/opencode/opencode.jsonc (1)

191-205: LGTM! Z-AI provider integration looks correct.

The addition of the z-ai provider with environment variable-based API key configuration aligns with the existing pattern used for openrouter. The structure is consistent with the corresponding changes in config/cliproxyapi/config.yaml.

config/cliproxyapi/config.yaml (1)

80-85: LGTM! Z-AI provider configuration is consistent.

The new z-ai provider entry follows the same structure and placeholder pattern as the existing openrouter provider. The configuration aligns with the corresponding changes in config/opencode/opencode.jsonc.

home-manager/services/cliproxyapi/scripts/backup-auth.sh (1)

13-20: Verify aws CLI availability.

Same concern as in recover-auth.sh: the script assumes aws CLI is available without verification. Consider adding a check or ensuring aws is in the service's PATH via the systemd/launchd service definition.

Refer to the verification script provided for recover-auth.sh to check aws CLI availability.

Comment on lines +61 to +83
systemd.user.timers.cliproxyapi-backup = lib.mkIf pkgs.stdenv.isLinux {
Unit = {
Description = "CLIProxyAPI auth backup and recovery timer";
};
Timer = {
OnBootSec = "1min";
OnUnitActiveSec = "5min";
Unit = "cliproxyapi-backup.service";
};
Install = {
WantedBy = [ "timers.target" ];
};
};

systemd.user.services.cliproxyapi-backup = lib.mkIf pkgs.stdenv.isLinux {
Unit = {
Description = "CLIProxyAPI auth backup and recovery";
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.bash}/bin/bash ${./scripts/backup-and-recover.sh}";
};
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Add service dependencies to prevent coordination issues.

The backup service and timer lack explicit dependencies on the main cliproxyapi.service. This could lead to:

  • Both services accessing the same auth files simultaneously during startup
  • Race conditions if backup runs while the main service is modifying files
  • Unclear startup ordering

Based on learnings, service configurations should include proper service dependencies.

Recommended fix to add proper service ordering
   systemd.user.services.cliproxyapi-backup = lib.mkIf pkgs.stdenv.isLinux {
     Unit = {
       Description = "CLIProxyAPI auth backup and recovery";
+      After = [ "cliproxyapi.service" ];
     };
     Service = {
       Type = "oneshot";
       ExecStart = "${pkgs.bash}/bin/bash ${./scripts/backup-and-recover.sh}";
     };
   };

This ensures the backup service runs after the main service is active, reducing the risk of file access conflicts.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
systemd.user.timers.cliproxyapi-backup = lib.mkIf pkgs.stdenv.isLinux {
Unit = {
Description = "CLIProxyAPI auth backup and recovery timer";
};
Timer = {
OnBootSec = "1min";
OnUnitActiveSec = "5min";
Unit = "cliproxyapi-backup.service";
};
Install = {
WantedBy = [ "timers.target" ];
};
};
systemd.user.services.cliproxyapi-backup = lib.mkIf pkgs.stdenv.isLinux {
Unit = {
Description = "CLIProxyAPI auth backup and recovery";
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.bash}/bin/bash ${./scripts/backup-and-recover.sh}";
};
};
systemd.user.timers.cliproxyapi-backup = lib.mkIf pkgs.stdenv.isLinux {
Unit = {
Description = "CLIProxyAPI auth backup and recovery timer";
};
Timer = {
OnBootSec = "1min";
OnUnitActiveSec = "5min";
Unit = "cliproxyapi-backup.service";
};
Install = {
WantedBy = [ "timers.target" ];
};
};
systemd.user.services.cliproxyapi-backup = lib.mkIf pkgs.stdenv.isLinux {
Unit = {
Description = "CLIProxyAPI auth backup and recovery";
After = [ "cliproxyapi.service" ];
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.bash}/bin/bash ${./scripts/backup-and-recover.sh}";
};
};

Comment thread home-manager/services/cliproxyapi/scripts/backup-auth.sh Outdated
Comment thread home-manager/services/cliproxyapi/scripts/recover-auth.sh Outdated
Comment on lines +13 to +21
echo "Auth files missing, attempting recovery from R2 backup..." >&2
mkdir -p "$AUTH_DIR"
AWS_ACCESS_KEY_ID="${OBJECTSTORE_ACCESS_KEY}" \
AWS_SECRET_ACCESS_KEY="${OBJECTSTORE_SECRET_KEY}" \
aws s3 sync \
--endpoint-url="${OBJECTSTORE_ENDPOINT}" \
--no-progress \
"$BACKUP_DIR" \
"$AUTH_DIR/" 2>/dev/null && echo "✅ Recovered auth files from backup" >&2 || echo "⚠️ Recovery failed (no backup available?)" >&2

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find . -name "recover-auth.sh" -type f

Repository: shunkakinoki/dotfiles

Length of output: 124


🏁 Script executed:

cat -n ./home-manager/services/cliproxyapi/scripts/recover-auth.sh

Repository: shunkakinoki/dotfiles

Length of output: 1050


Verify aws CLI availability before use.

The script uses the aws command on line 17 without checking if it exists in PATH. If aws is not available, the error gets suppressed by 2>/dev/null, leaving only a vague "Recovery failed (no backup available?)" message instead of indicating the actual cause. Add a check like command -v aws >/dev/null 2>&1 || { echo "aws CLI not found" >&2; exit 1; } before the sync command.

🤖 Prompt for AI Agents
In home-manager/services/cliproxyapi/scripts/recover-auth.sh around lines 13 to
21, the script calls the aws CLI without verifying it exists and then silences
errors, which hides the real cause when recovery fails; add a pre-check using
command -v aws >/dev/null 2>&1 and if it fails print "aws CLI not found" to
stderr and exit non-zero before attempting the aws s3 sync, so the script fails
fast with a clear message instead of a vague recovery-failed line.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
config/claude/pushover.sh (1)

27-31: Remove redundant empty check.

Lines 29-31 are now unnecessary because line 28's fallback chain (|| echo "unknown") guarantees a non-empty value. The empty check can never trigger.

🔎 Proposed simplification
 # Get Computer Name for notifications (macOS friendly name, fallback to hostname)
 HOSTNAME=$(scutil --get ComputerName 2>/dev/null || hostname -s 2>/dev/null || echo "unknown")
-if [ -z "$HOSTNAME" ]; then
-  HOSTNAME="unknown"
-fi

Additionally, consider documenting the macOS-specific behavior inline:

-# Get Computer Name for notifications (macOS friendly name, fallback to hostname)
+# Get Computer Name for notifications
+# 1. Try macOS-friendly name (scutil - macOS only)
+# 2. Fall back to short hostname (portable)
+# 3. Default to "unknown" if both fail
 HOSTNAME=$(scutil --get ComputerName 2>/dev/null || hostname -s 2>/dev/null || echo "unknown")
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3523468 and 82dda83.

📒 Files selected for processing (3)
  • config/claude/pushover.sh (1 hunks)
  • home-manager/services/cliproxyapi/scripts/backup-auth.sh (1 hunks)
  • home-manager/services/cliproxyapi/scripts/recover-auth.sh (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{sh,bash}

📄 CodeRabbit inference engine (CLAUDE.md)

Use shfmt with 2-space indentation for shell scripts

**/*.{sh,bash}: Use 2 spaces for indentation in shell scripts
Add proper shebang lines to shell scripts
Follow shellcheck recommendations in shell scripts
Document complex commands in shell scripts
Use consistent variable naming in shell scripts

Files:

  • home-manager/services/cliproxyapi/scripts/backup-auth.sh
  • config/claude/pushover.sh
  • home-manager/services/cliproxyapi/scripts/recover-auth.sh
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: shellcheck
  • GitHub Check: nix-linux
  • GitHub Check: nix-flake
  • GitHub Check: docker-build-push (linux/arm64, arm64, ubuntu-24.04-arm)
  • GitHub Check: docker-build-push (linux/amd64, amd64, ubuntu-latest)
  • GitHub Check: lua-neovim-test
  • GitHub Check: e2e-run (Ubuntu, ubuntu-latest)
  • GitHub Check: e2e-run (NixOS, ubuntu-latest)
🔇 Additional comments (6)
home-manager/services/cliproxyapi/scripts/recover-auth.sh (3)

1-5: Good script setup following best practices.

The script properly uses #!/usr/bin/env bash, includes descriptive comments explaining the purpose, and enables strict error handling with set -euo pipefail. This follows the coding guidelines for shell scripts.


7-9: Clear and consistent variable declarations.

The variable names are descriptive and follow consistent naming conventions. Proper quoting is used throughout.


12-12: Variable quoting issue has been resolved.

The $AUTH_DIR variable in the ls -A command is now properly quoted, addressing the concern raised in previous reviews.

home-manager/services/cliproxyapi/scripts/backup-auth.sh (3)

1-5: Good script setup following best practices.

Consistent with recover-auth.sh, this script properly uses #!/usr/bin/env bash, includes descriptive comments, and enables strict error handling with set -euo pipefail.


7-9: Clear variable declarations.

Variable declarations are consistent with the recovery script and properly quoted.


12-12: Variable quoting issue has been resolved.

The $AUTH_DIR variable in the ls -A command is now properly quoted, consistent with the fix in recover-auth.sh.

@shunkakinoki
shunkakinoki merged commit cc635b5 into main Dec 21, 2025
23 of 24 checks passed
@shunkakinoki
shunkakinoki deleted the fix-services-imports branch December 21, 2025 06:03

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
spec/code_syncer_spec.sh (2)

44-54: Consider verifying actual extension filtering behavior.

The tests now only check for string presence (--list-extensions, clean_extension_list) rather than validating that extension filtering works correctly. While this reduces mocking complexity, it also means bugs in the actual filtering logic won't be caught.

Consider adding at least one integration test that verifies the extension filtering produces expected output, even if it requires minimal mocking.


73-91: Consider adding behavior verification for config syncing.

Similar to the extension filtering tests, these now only verify that certain strings and function names exist in the script. This approach won't catch bugs in the actual config file syncing logic, such as incorrect paths, missing error handling, or failed copy operations.

A middle ground could be a lightweight integration test that creates a minimal fixture and verifies sync_config_file actually copies a file, without the extensive platform-specific mocking from before.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 4cf0463 and f984462.

📒 Files selected for processing (1)
  • spec/code_syncer_spec.sh (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{sh,bash}

📄 CodeRabbit inference engine (CLAUDE.md)

Use shfmt with 2-space indentation for shell scripts

**/*.{sh,bash}: Use 2 spaces for indentation in shell scripts
Add proper shebang lines to shell scripts
Follow shellcheck recommendations in shell scripts
Document complex commands in shell scripts
Use consistent variable naming in shell scripts

Files:

  • spec/code_syncer_spec.sh
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: nix-linux
  • GitHub Check: nix-nixos
  • GitHub Check: nix-flake
  • GitHub Check: nix-darwin
  • GitHub Check: docker-build-push (linux/amd64, amd64, ubuntu-latest)
  • GitHub Check: docker-build-push (linux/arm64, arm64, ubuntu-24.04-arm)
  • GitHub Check: lua-hammerspoon
  • GitHub Check: lua-neovim-test
  • GitHub Check: lua-neovim
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: shellspec
  • GitHub Check: shellcheck
  • GitHub Check: e2e-run (MacOS, macos-latest)
  • GitHub Check: e2e-run (Ubuntu, ubuntu-latest)
  • GitHub Check: e2e-run (NixOS, ubuntu-latest)
🔇 Additional comments (4)
spec/code_syncer_spec.sh (4)

10-11: LGTM: Clean approach to simulate missing CLI.

Creating an empty bin directory for PATH restriction is an elegant way to test the "CLI not found" scenario without complex mocking.


29-29: LGTM: Proper cleanup of test artifacts.

Correctly removes both temporary directories created during setup.


36-37: LGTM: Effective use of restricted PATH.

The restricted PATH approach successfully simulates a missing VS Code CLI while preserving essential shell commands for the test execution.


93-103: LGTM: Adds fswatch integration coverage.

The new fswatch tests verify the presence of fswatch checks and fallback messaging. While these are also lightweight string-based checks consistent with the refactored test approach, they do add coverage for a new integration point.

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