qmd/skills/release/scripts/install-hooks.sh
Tobi Lutke 09803a75b7
feat: compile to JS for npm, release system, full changelog
- Add tsc build step (tsconfig.build.json) so npm package ships
  compiled JS instead of raw TypeScript requiring tsx at runtime
- Update qmd wrapper and daemon spawn to use dist/qmd.js in
  production while keeping tsx for development
- Add self-installing pre-push hook validating v* tag pushes:
  package.json version match, changelog entry, CI status
- Add release.sh script that renames [Unreleased] to versioned
  entry, bumps package.json, commits, and tags
- Add extract-changelog.sh for cumulative GitHub release notes
- Update publish workflow with build step and GitHub release creation
- Flesh out CHANGELOG.md with full history from 0.1.0 through 1.0.0
  in Keep-a-Changelog format with PR/contributor attributions
- Add release standards and changelog guidelines to CLAUDE.md
2026-02-16 08:42:32 -04:00

39 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Install git hooks for release validation.
# Idempotent — safe to run multiple times.
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
if [[ -z "$REPO_ROOT" ]]; then
echo "Error: not in a git repository" >&2
exit 1
fi
HOOKS_DIR="$REPO_ROOT/.git/hooks"
SOURCE="$REPO_ROOT/scripts/pre-push"
if [[ ! -f "$SOURCE" ]]; then
echo "Error: scripts/pre-push not found at $SOURCE" >&2
exit 1
fi
# Install pre-push hook
if [[ -L "$HOOKS_DIR/pre-push" ]] && [[ "$(readlink "$HOOKS_DIR/pre-push")" == "$SOURCE" ]]; then
echo "pre-push hook: already installed (symlink)"
elif [[ -f "$HOOKS_DIR/pre-push" ]]; then
# Existing hook that isn't our symlink — back it up
BACKUP="$HOOKS_DIR/pre-push.backup.$(date +%s)"
echo "pre-push hook: backing up existing hook to $(basename "$BACKUP")"
mv "$HOOKS_DIR/pre-push" "$BACKUP"
ln -sf "$SOURCE" "$HOOKS_DIR/pre-push"
echo "pre-push hook: installed (symlink → scripts/pre-push)"
else
ln -sf "$SOURCE" "$HOOKS_DIR/pre-push"
echo "pre-push hook: installed (symlink → scripts/pre-push)"
fi
# Ensure the source is executable
chmod +x "$SOURCE"
echo "Done."