Repository navigation
fix(install-hook): print usage on --help and reject unknown flags - #92
Closed
techsaurabh-394 wants to merge 1 commit into
Closed
techsaurabh-394 wants to merge 1 commit into
techsaurabh-394 wants to merge 1 commit into
Conversation
install-hook.mjs ignored every flag it did not know, so --help (and any typo such as --globl for --global) fell through to the install path and silently wrote the hook into the project's .claude/settings.json. Add a usage block, handle --help/-h, and exit 1 on an unknown option before any file is read or written. Matches how install.mjs behaves. Signed-off-by: Saurabh Pathak <saurabhpathak394@gmail.com>
|
@techsaurabh-394 is attempting to deploy a commit to the Together AI Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
install-hook.mjsignores every flag it does not recognise.node install-hook.mjs --help(or a typo such as--globlfor--global) falls through to the install path and silently writes the hook into.claude/settings.json.install.mjsalready handles this with a usage block and an unknown-option check.This adds the same to
install-hook.mjs:--help/-hprints usage and exits 0 without touching any file.Unknown option: ...plus usage to stderr and exits 1 before any file is read or written.--global,--print,--removeand the default install behave as before.Scope
One file, +14 lines. Not included: the
hookscontainer validation in #85 (different code path, no overlap in the diff).Verification (run in a throwaway temp dir)
--help: usage printed, exit 0, no.claude/created.--globl:Unknown option: --globl+ usage, exit 1, no.claude/created.--print: prints the settings entry, exit 0, nothing written.--remove: installed and removed as before, exit 0.node --checkon the script andnode skills/hallmark/scripts/refcheck.mjs: clean across 99 reference files.Not run: the theme validate and theme-index CI steps (this change does not touch themes), and Node 20 (tested on Node 22.19).
Risk / rollback
Low. Scripts that pass an unrecognised flag to this installer would now exit 1 instead of installing; revert the single commit to restore the old behaviour.