astrogrep@4.4.9: add Explorer context menu integration script#17899
astrogrep@4.4.9: add Explorer context menu integration script#17899arvdk wants to merge 5 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR adds Windows Registry context menu integration for AstroGrep. It introduces two registry templates (install-context.reg and uninstall-context.reg) and updates the manifest with a post_install hook that substitutes the installed AstroGrep.exe path into those templates (escaping backslashes), optionally rewrites HKEY_CURRENT_USER to HKEY_LOCAL_MACHINE when $global is set, writes the generated .reg files to $dir, and provides an uninstaller script that imports or prints the uninstall .reg. Manifest notes were updated to document using reg import "$dir\install-context.reg". Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
|
/verify |
|
All changes look good. Wait for review from human collaborators. astrogrep
|
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
bucket/astrogrep.json (2)
6-6: ⚡ Quick winConsider automating registry import in post_install or clarifying manual step.
The note instructs users to manually run
reg import "$dir\\install-context.reg", but theuninstallerautomatically importsuninstall-context.reg(line 30). This creates an asymmetry: installation requires manual intervention, but uninstallation is automatic.Consider either:
- Adding automatic registry import to
post_install(similar to howuninstallerworks), or- If keeping manual installation, ensure the note is clear that this is an optional feature
The
lockhunter.jsonmanifest (context snippet) uses the same manual approach with clearer conditional logic in the uninstaller to detect whether the registry was actually imported.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@bucket/astrogrep.json` at line 6, The manifest currently instructs manual registry import via the "notes" entry for install-context.reg while the "uninstaller" automatically imports uninstall-context.reg; update the manifest to remove asymmetry by either (A) adding an automated registry import step in post_install that runs reg import for install-context.reg (and set a flag/registry marker that the uninstaller can detect, mirroring the logic used in lockhunter.json), or (B) keep manual install but edit the "notes" text to explicitly state the registry import is optional and document why it’s manual; reference the "post_install" hook, the "uninstaller" behavior, and the install-context.reg/uninstall-context.reg files when making the change.
28-28: 💤 Low valueRemove redundant condition check.
The check
if ($cmd -eq 'uninstall')is redundant because theuninstaller.scriptonly executes during uninstallation. This condition will always be true in this context.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@bucket/astrogrep.json` at line 28, Remove the redundant conditional check "if ($cmd -eq 'uninstall')" from the uninstaller script entry (the uninstaller.script that currently contains that if-statement), because the script only runs during uninstallation; simply execute the uninstall commands directly inside that script block and delete the surrounding if statement and its matching endif to avoid dead/always-true branching.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@bucket/astrogrep.json`:
- Around line 26-33: The uninstaller script currently always runs `reg import
"$dir\\uninstall-context.reg"` and doesn't handle global installs; update the
`uninstaller` logic to detect the `$global` flag (same flag used in
`post_install`) and, if set, attempt to remove HKLM entries instead of HKCU:
check existence of the uninstall registry key under both `HKEY_CURRENT_USER` and
`HKEY_LOCAL_MACHINE` and invoke the appropriate import/delete command, using
elevation (e.g., prefixing with `sudo` or the Windows elevation method used in
your repo) when operating on `HKEY_LOCAL_MACHINE`, so global installs are fully
cleaned up.
In `@scripts/astrogrep/install-context.reg`:
- Around line 3-13: The registry keys currently use the literal key name "Search
using &AstroGrep" which contains spaces and an ampersand; rename those keys to a
simple identifier like "AstroGrep" under both Directory\shell and
Directory\Background\shell, and keep the human-readable text in the default
value (the @="Search using &AstroGrep...") and preserve the "Icon" and command
default values (the @="\"$astro\" \"%V\"" entries) under the new AstroGrep key
and its \command subkey so behavior and displayed text remain the same.
In `@scripts/astrogrep/uninstall-context.reg`:
- Around line 3-6: Update the registry key names in uninstall-context.reg to
match the corrected install-context.reg by replacing occurrences of "Search
using &AstroGrep" with the simple key name "AstroGrep" for the Directory and
Directory\Background shell keys (i.e., change
[-HKEY_CURRENT_USER\Software\Classes\Directory\shell\Search using &AstroGrep]
and [-HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\Search using
&AstroGrep] to use "AstroGrep"); also remove the explicit deletions of the
\command subkeys (the lines deleting
[-HKEY_CURRENT_USER\Software\Classes\Directory\shell\Search using
&AstroGrep\command] and
[-HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\Search using
&AstroGrep\command]) since deleting the parent keys (Directory\shell\AstroGrep
and Directory\Background\shell\AstroGrep) already removes child keys.
---
Nitpick comments:
In `@bucket/astrogrep.json`:
- Line 6: The manifest currently instructs manual registry import via the
"notes" entry for install-context.reg while the "uninstaller" automatically
imports uninstall-context.reg; update the manifest to remove asymmetry by either
(A) adding an automated registry import step in post_install that runs reg
import for install-context.reg (and set a flag/registry marker that the
uninstaller can detect, mirroring the logic used in lockhunter.json), or (B)
keep manual install but edit the "notes" text to explicitly state the registry
import is optional and document why it’s manual; reference the "post_install"
hook, the "uninstaller" behavior, and the
install-context.reg/uninstall-context.reg files when making the change.
- Line 28: Remove the redundant conditional check "if ($cmd -eq 'uninstall')"
from the uninstaller script entry (the uninstaller.script that currently
contains that if-statement), because the script only runs during uninstallation;
simply execute the uninstall commands directly inside that script block and
delete the surrounding if statement and its matching endif to avoid
dead/always-true branching.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 59797521-85a1-4736-a110-eb140d04db34
📒 Files selected for processing (3)
bucket/astrogrep.jsonscripts/astrogrep/install-context.regscripts/astrogrep/uninstall-context.reg
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
/verify |
|
All changes look good. Wait for review from human collaborators. astrogrep
|
Changes:
post_installand anuninstallersection. The implementation is copied from notepadplusplus.Closes #17898
<manifest-name[@version]|chore>: <general summary of the pull request>