Skip to content

Add cf program integration#185

Closed
connerohnesorge wants to merge 4 commits intomainfrom
claude/add-cf-program-01VdXAvAXKbgnDMtN3hCF3vu
Closed

Add cf program integration#185
connerohnesorge wants to merge 4 commits intomainfrom
claude/add-cf-program-01VdXAvAXKbgnDMtN3hCF3vu

Conversation

@connerohnesorge
Copy link
Copy Markdown
Owner

@connerohnesorge connerohnesorge commented Nov 20, 2025

Implements the add-cf-program spec change by converting the hardcoded zsh alias into a standalone Nix program module with proper dependency management.

Changes:

  • Create modules/programs/cf/ with shell script and Nix derivation
  • Enable cf program in engineer feature for both NixOS and Darwin
  • Replace inline alias in .zshrc with wrapper to nix-managed cf command
  • Update tasks.md to reflect completed implementation

The cf program uses fd and fzf for interactive directory selection with graceful cancellation support and cross-platform compatibility.

Summary by CodeRabbit

  • New Features

    • Added an interactive cf utility for fuzzy directory navigation with live preview.
  • Chores

    • Enabled the cf program across relevant system configurations (NixOS and macOS).
    • Updated shell startup to use the new cf command for directory switching.
    • Marked related setup/checklist tasks as completed.

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

Implements the add-cf-program spec change by converting the hardcoded zsh
alias into a standalone Nix program module with proper dependency management.

Changes:
- Create modules/programs/cf/ with shell script and Nix derivation
- Enable cf program in engineer feature for both NixOS and Darwin
- Replace inline alias in .zshrc with wrapper to nix-managed cf command
- Update tasks.md to reflect completed implementation

The cf program uses fd and fzf for interactive directory selection with
graceful cancellation support and cross-platform compatibility.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 20, 2025

Walkthrough

Adds a Nix-packaged cf fuzzy-directory finder, replaces the inline zsh cf alias to delegate to the nix-managed cf command, exposes feature flags to enable the program on NixOS and Darwin, adds the program script and module, and marks related tasks complete.

Changes

Cohort / File(s) Summary
Shell alias update
\.zshrc
Replaced inline fd+fzf alias with alias cf='cd $(command cf)' and updated the comment to indicate delegation to the nix-managed cf program.
Feature flags
modules/features/engineer\.nix
Added cf.enable = true entries under the features/programs blocks and darwin.ifEnabled.myconfig.programs to expose the toggle.
Program implementation
modules/programs/cf/cf\.sh, modules/programs/cf/default\.nix
Added cf.sh: a bash script enumerating directories with fd and selecting via fzf (with preview). Added default.nix: a delib module creating a pkgs.writeShellApplication named cf with runtime inputs fd, fzf, and coreutils, and NixOS/Darwin enablement.
Task tracking
spectr/changes/add-cf-program/tasks\.md
Marked all checklist items as completed.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Z as zsh (interactive)
  participant CF as cf (nix-installed)
  participant FD as fd
  participant FZF as fzf

  Z->>CF: run `command cf` (alias: cd $(command cf))
  CF->>FD: enumerate dirs (hidden allowed, exclude .git)
  FD-->>CF: directory list
  CF->>FZF: show list with `ls` preview
  FZF-->>CF: selected path or cancel
  alt selection made
    CF-->>Z: echo selected path
    Z->>Z: cd into echoed path
  else cancelled
    CF-->>Z: (no output)
    Z->>Z: remain in current directory
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review modules/programs/cf/default.nix for correct runtimeInputs, package creation, and platform install hooks.
  • Inspect modules/programs/cf/cf.sh for robust handling of cancellation, whitespace/newlines in paths, and safe quoting.
  • Verify \.zshrc alias quoting and interaction with cd $(command cf).

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add cf program integration' accurately summarizes the main change: introducing a new cf program module with proper Nix integration and enabling it in the engineer feature.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/add-cf-program-01VdXAvAXKbgnDMtN3hCF3vu

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 580f83e and 3620c61.

📒 Files selected for processing (1)
  • modules/features/engineer.nix (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • modules/features/engineer.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). (4)
  • GitHub Check: Build (linux-x86_64)
  • GitHub Check: Build (macos-aarch64)
  • GitHub Check: Validate Templates (macos-aarch64)
  • GitHub Check: Validate Templates (linux-x86_64)

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

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)
modules/programs/cf/cf.sh (1)

1-1: Verify shebang redundancy with writeShellApplication.

The shebang line is typically redundant when using writeShellApplication, as it adds its own shebang and preamble. While this usually doesn't cause issues, consider removing it for cleaner integration with the Nix wrapper.

Apply this diff if you want to remove the redundant shebang:

-#!/usr/bin/env bash
 # cf - Fuzzy directory finder
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2d6d351 and 9d410dc.

📒 Files selected for processing (5)
  • .zshrc (1 hunks)
  • modules/features/engineer.nix (2 hunks)
  • modules/programs/cf/cf.sh (1 hunks)
  • modules/programs/cf/default.nix (1 hunks)
  • spectr/changes/add-cf-program/tasks.md (1 hunks)
⏰ 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). (4)
  • GitHub Check: Validate Templates (linux-x86_64)
  • GitHub Check: Validate Templates (macos-aarch64)
  • GitHub Check: Build (linux-x86_64)
  • GitHub Check: Build (macos-aarch64)
🔇 Additional comments (8)
spectr/changes/add-cf-program/tasks.md (1)

1-24: LGTM! Task tracking is complete and consistent.

The checklist comprehensively covers the implementation, testing, and integration steps, and all items are appropriately marked as complete in alignment with the actual code changes.

modules/programs/cf/cf.sh (1)

13-26: LGTM! Robust implementation with proper error handling.

The script correctly:

  • Uses strict mode (set -euo pipefail) for error prevention
  • Handles cancellation gracefully with || true
  • Provides sensible defaults for the starting directory
  • Validates output before echoing

The fd/fzf integration is well-structured and the preview command will work correctly with fzf's placeholder substitution.

.zshrc (1)

49-50: LGTM! Correct delegation to the nix-managed cf binary.

The use of command cf properly bypasses alias resolution to call the external program, preventing infinite recursion. The updated comment accurately describes the new behavior.

modules/features/engineer.nix (2)

39-39: LGTM! Correct feature flag addition for NixOS.

The cf program is properly enabled for NixOS configurations with appropriate alphabetical placement among other program enables.


207-207: LGTM! Correct feature flag addition for Darwin.

The cf program is properly enabled for Darwin/macOS configurations with appropriate alphabetical placement.

modules/programs/cf/default.nix (3)

1-41: LGTM! Excellent comprehensive documentation.

The module documentation is thorough and well-structured, covering all essential aspects including description, platform support, features, implementation details, usage examples, and configuration. This follows best practices for Nix module documentation.


50-58: LGTM! Correct writeShellApplication configuration.

The program definition properly:

  • Names the binary "cf"
  • Reads the script content from ./cf.sh
  • Wraps the necessary runtime dependencies (fd, fzf, coreutils)

This follows the standard Nix pattern for creating shell applications with managed dependencies.


60-72: LGTM! Standard module structure with proper cross-platform support.

The module correctly:

  • Uses the delib.module pattern with appropriate naming
  • Defaults to disabled (requiring explicit enablement)
  • Installs the program as a system package on both NixOS and Darwin when enabled
  • Follows the established pattern consistent with other program modules in the codebase

@connerohnesorge connerohnesorge changed the title Add CloudFlare program integration Add cf program integration Nov 20, 2025
@connerohnesorge connerohnesorge deleted the claude/add-cf-program-01VdXAvAXKbgnDMtN3hCF3vu branch November 22, 2025 21:51
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