Skip to content

fix: reject invalid hook settings before rewriting configuration - #85

Draft
Aliciawque wants to merge 1 commit into
Nutlope:mainfrom
Aliciawque:fix/reject-invalid-hook-settings
Draft

Aliciawque wants to merge 1 commit into
Nutlope:mainfrom
Aliciawque:fix/reject-invalid-hook-settings

Conversation

@Aliciawque

Copy link
Copy Markdown

Summary

Reject a non-object hooks container before changing .claude/settings.json in the lint-hook installer.

With valid JSON such as {"hooks": []}, the current installer assigns PostToolUse as an array property. JSON.stringify drops that property, so the command exits successfully and says the hook was installed, but no hook is saved. Both install and remove also rewrite the original settings bytes. Primitive containers instead fail with an unhandled TypeError.

This change refuses arrays and primitives with a clear diagnostic, without writing the file. Missing/null containers keep their existing initialization behavior. Unrelated configuration, shared third-party hooks, idempotent installation, and removal behavior are preserved.

Tests

  • Added 16 Node built-in test-runner regressions using isolated temporary project settings. Original base: 6 pass / 10 fail; patched: 16 pass / 0 fail.
  • The array cases establish the false-success/rewriting bug; primitive cases improve the existing failure diagnostic rather than claiming new data-loss prevention.
  • Added these tests to the existing verify workflow; no dependencies or permissions changed.
  • Independent four-case array install/remove checks preserve exact bytes and leave no temporary file.
  • refcheck.mjs: clean across 99 reference files.
  • All 48 themes validate; node --check and git diff --check pass.
  • Tested locally with Node 24.22.1 on Linux. Node 20 CI has not run yet.

Known baseline limitation

The existing theme-index freshness command fails on both the unchanged base and this patch because generation updates only built from 2026-10-22 to today's date. That generated date-only change is excluded from this PR; this does not claim the complete existing CI command is green.

This is separate from #80, which concerns theme run-history validation, not hook settings. No user/global configuration was modified during testing. Prepared with AI assistance and independently reviewed.

@vercel

vercel Bot commented Oct 25, 2026

Copy link
Copy Markdown

@Aliciawque is attempting to deploy a commit to the Together AI Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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