Skip to content

fix: Global install by making lefthook setup conditional#30

Merged
amix merged 3 commits intomainfrom
amix/fix-global-install
Mar 3, 2026
Merged

fix: Global install by making lefthook setup conditional#30
amix merged 3 commits intomainfrom
amix/fix-global-install

Conversation

@amix
Copy link
Member

@amix amix commented Mar 3, 2026

Summary

Fixes global install failure when running npm install -g github:Doist/outline-cli

Problem

The prepare script unconditionally ran lefthook install, which failed during global installs (npm creates a temp directory without .git) and when lefthook isn't available globally.

Solution

Created scripts/prepare.js that:

  • Checks if we're in a git repo before running lefthook
  • Gracefully exits in CI environments
  • Handles lefthook failures without breaking the install

Updated README with simpler install instructions.

Testing

  • Global install with npm install -g . succeeds
  • ol command works correctly after install
  • All tests pass
  • Git hooks still work for local development

The prepare script was failing when installing via npm install -g
because lefthook tried to set up git hooks in non-git directories.

Changes:
- Created scripts/prepare.js that checks for .git before running lefthook
- Script gracefully skips hook setup in CI and non-git environments
- Updated README with simple npm install -g command
- Fixes issue where global install would fail with lefthook error

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@amix amix requested a review from gnapse March 3, 2026 08:07
@amix amix changed the title Fix global install by making lefthook setup conditional fix: Global install by making lefthook setup conditional Mar 3, 2026
@amix amix marked this pull request as ready for review March 3, 2026 08:08
Copy link

@doist-bot doist-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR updates fix: Global install by making lefthook setup conditional. The inline comments cover the issues found in the review.

Share FeedbackReview Logs

amix and others added 2 commits March 3, 2026 11:53
`CI=1` and other truthy values are now caught, not just `CI=true`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@amix amix merged commit a5fd7bf into main Mar 3, 2026
3 checks passed
@gnapse gnapse deleted the amix/fix-global-install branch March 3, 2026 20:07
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.

2 participants