Skip to content

fix(install-hook): print usage on --help and reject unknown flags - #92

Closed
techsaurabh-394 wants to merge 1 commit into
Nutlope:mainfrom
techsaurabh-394:fix/install-hook-unknown-flags
Closed

techsaurabh-394 wants to merge 1 commit into
Nutlope:mainfrom
techsaurabh-394:fix/install-hook-unknown-flags

Conversation

@techsaurabh-394

Copy link
Copy Markdown

Summary

install-hook.mjs ignores every flag it does not recognise. node install-hook.mjs --help (or a typo such as --globl for --global) falls through to the install path and silently writes the hook into .claude/settings.json. install.mjs already handles this with a usage block and an unknown-option check.

This adds the same to install-hook.mjs:

  • --help / -h prints usage and exits 0 without touching any file.
  • Any unknown option prints Unknown option: ... plus usage to stderr and exits 1 before any file is read or written.
  • --global, --print, --remove and the default install behave as before.

Scope

One file, +14 lines. Not included: the hooks container 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.
  • default install, then --remove: installed and removed as before, exit 0.
  • node --check on the script and node 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.

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

vercel Bot commented Oct 26, 2026

Copy link
Copy Markdown

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

@techsaurabh-394 techsaurabh-394 closed this by deleting the head repository Oct 27, 2026
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.

1 participant