feat(fish): add ocd alias for open-composer CLI - #242
Conversation
Amp-Thread-ID: https://ampcode.com/threads/T-3ca2f261-bca3-46c1-be06-47644da98db4 Co-authored-by: Amp <amp@ampcode.com>
|
Note Other AI code review bot(s) detectedCodeRabbit 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. WalkthroughAdds a new Fish shell alias Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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). (7)
Comment |
Summary of ChangesHello @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 streamlines the developer workflow by adding a new alias, Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request adds a fish shell alias ocd for the open-composer CLI. My review focuses on improving the maintainability and portability of this Nix configuration. The current implementation uses a tilde (~) to reference the home directory, which is not a best practice in Nix. I've suggested replacing it with the config.home.homeDirectory variable to make the configuration more explicit and robust.
| shellAliases = { | ||
| neofetch = "fastfetch"; | ||
|
|
||
| ocd = "bun run ~/ghq/github.com/shunkakinoki/open-composer/apps/cli/src/index.ts"; |
There was a problem hiding this comment.
Using ~ for the home directory path is generally discouraged in Nix configurations because it relies on shell expansion and makes the configuration less portable. To adhere more closely to Nix best practices, it's better to use the ${config.home.homeDirectory} variable provided by home-manager. This makes the path explicit and self-contained within the Nix evaluation, improving the robustness of your configuration.
ocd = "bun run ${config.home.homeDirectory}/ghq/github.com/shunkakinoki/open-composer/apps/cli/src/index.ts";
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
home-manager/programs/fish/default.nix(1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.nix
📄 CodeRabbit inference engine (CLAUDE.md)
Format all Nix files with nixfmt
**/*.nix: Nix: Use 2 spaces for indentation
Nix: Keep line length under 100 characters
Nix: Sort attribute sets alphabetically
Nix: Use consistent spacing around operators
Nix: Format lists and sets consistentlyFollow the Nix expression language style guide
Files:
home-manager/programs/fish/default.nix
**/default.nix
📄 CodeRabbit inference engine (CLAUDE.md)
Use default.nix files for module exports
Files:
home-manager/programs/fish/default.nix
home-manager/**
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Keep home-manager configurations under home-manager/
Files:
home-manager/programs/fish/default.nix
home-manager/programs/*/default.nix
📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)
home-manager/programs/*/default.nix: Program configurations must be located in home-manager/programs// with configuration in default.nix
Program configurations should prefer Home Manager’s built-in modules when available
Program configurations should include all necessary dependencies
Program configurations should follow the provided template (programs..enable, package, and settings attrset)
Files:
home-manager/programs/fish/default.nix
home-manager/**/*.nix
📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)
Use proper indentation and formatting in Nix files
Files:
home-manager/programs/fish/default.nix
home-manager/programs/**/default.nix
📄 CodeRabbit inference engine (.cursor/rules/nix.mdc)
Program configurations in home-manager/programs should be organized by program name (one directory per program with a default.nix)
Files:
home-manager/programs/fish/default.nix
home-manager/programs/**/*.nix
📄 CodeRabbit inference engine (.cursor/rules/nix.mdc)
home-manager/programs/**/*.nix: Program configurations should include all necessary dependencies
Use home.packages for package installations in program configurations
Use programs. options provided by Home Manager when available
Files:
home-manager/programs/fish/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). (7)
- GitHub Check: nix-nixos
- GitHub Check: e2e-run (MacOS, macos-latest)
- GitHub Check: e2e-run (NixOS, ubuntu-latest)
- GitHub Check: e2e-run (Ubuntu, ubuntu-latest)
- GitHub Check: nix-linux
- GitHub Check: nix-darwin
- GitHub Check: docker-build-push (linux/amd64, -amd64, amd64)
|
|
||
| ocd = "bun run ~/ghq/github.com/shunkakinoki/open-composer/apps/cli/src/index.ts"; |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
Make path expansion robust: use $HOME instead of ~ in the alias (fish doesn’t tilde‑expand in double quotes).
If Home Manager emits this alias with quotes (it usually does), fish will not expand ~ inside the quoted string. Use $HOME to ensure the path resolves correctly. Also, bun index.ts is equivalent to bun run index.ts; either form works.
Apply this minimal change:
- ocd = "bun run ~/ghq/github.com/shunkakinoki/open-composer/apps/cli/src/index.ts";
+ ocd = "bun $HOME/ghq/github.com/shunkakinoki/open-composer/apps/cli/src/index.ts";Fish quoting reference (double quotes only expand variables/command substitutions; not tilde). Bun accepts both “bun run file.ts” and “bun file.ts”. (fishshell.com)
Verification scripts:
Nit: run nixfmt to normalize whitespace (the blank line before ocd will be adjusted). As per coding guidelines.
🏁 Script executed:
#!/usr/bin/env bash
# 1) Confirm Bun is managed somewhere in Home Manager (per coding guidelines: include necessary dependencies)
rg -nP --type=nix -C2 '\b(pkgs\.bun|home\.packages.*bun|programs\.bun)\b' || echo "No explicit Bun package found in Home Manager configs."
# 2) Sanity-check the exact alias target path appears anywhere else (optional)
rg -n 'open-composer/apps/cli/src/index.ts' || echo "Target path not referenced elsewhere (ensure it exists on disk)."Length of output: 185
Use $HOME for path expansion and add Bun to Home Manager
- Update the alias in
home-manager/programs/fish/default.nix:- ocd = "bun run ~/ghq/github.com/shunkakinoki/open-composer/apps/cli/src/index.ts"; + ocd = "bun run $HOME/ghq/github.com/shunkakinoki/open-composer/apps/cli/src/index.ts";
- Add
pkgs.bunto yourhome.packagessobunis available. - Verify that
~/ghq/github.com/shunkakinoki/open-composer/apps/cli/src/index.tsexists on disk.
📝 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.
| ocd = "bun run ~/ghq/github.com/shunkakinoki/open-composer/apps/cli/src/index.ts"; | |
| ocd = "bun run $HOME/ghq/github.com/shunkakinoki/open-composer/apps/cli/src/index.ts"; |
🤖 Prompt for AI Agents
In home-manager/programs/fish/default.nix around lines 29 to 30, the fish alias
uses a literal tilde which doesn't expand in all contexts and Bun may not be
installed; change the alias to use $HOME for a reliable home-directory expansion
(e.g. use $HOME/ghq/.../index.ts) and ensure bun is available by adding pkgs.bun
to your home.packages in your Home Manager configuration; also verify that the
target file
$HOME/ghq/github.com/shunkakinoki/open-composer/apps/cli/src/index.ts actually
exists on disk and adjust the path if needed.
Adds a fish shell alias 'ocd' to run the open-composer CLI via bun.\n\n- File: home-manager/programs/fish/default.nix\n- Alias: ocd = "bun run ~/ghq/github.com/shunkakinoki/open-composer/apps/cli/src/index.ts"\n\nThis streamlines launching open-composer from the terminal.
Summary by CodeRabbit