docs: add README and shareable git hooks

- Add README.md with quick start, docs links, dev workflow
- Add .github/hooks/ with installable pre-commit hook
- Add install-hooks.sh script for easy setup
- Hook checks code health, warns on large changes
- Documentation in .github/HOOKS.md
This commit is contained in:
lucaronin
2026-02-17 13:14:20 +01:00
parent 70fcc8594e
commit f47dcd56ee
4 changed files with 355 additions and 4372 deletions

19
.github/hooks/install-hooks.sh vendored Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
# Install git hooks for laputa-app
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
HOOKS_DIR="$(git rev-parse --git-dir)/hooks"
echo "Installing git hooks..."
# Copy pre-commit hook
cp "$SCRIPT_DIR/pre-commit" "$HOOKS_DIR/pre-commit"
chmod +x "$HOOKS_DIR/pre-commit"
echo "✅ Installed pre-commit hook"
echo ""
echo "Hooks installed:"
echo " - pre-commit: CodeScene code health check"
echo ""
echo "To bypass a hook, use: git commit --no-verify"
echo "Or include [skip codescene] in your commit message"

79
.github/hooks/pre-commit vendored Normal file
View File

@@ -0,0 +1,79 @@
#!/bin/bash
# Pre-commit hook: CodeScene Code Health Check
# Copy to .git/hooks/pre-commit and make executable
set -e
# Allow bypass with --no-verify or [skip codescene] in commit message
if git log -1 --pretty=%B 2>/dev/null | grep -qi '\[skip codescene\]'; then
echo "⏭️ CodeScene check skipped (commit message contains [skip codescene])"
exit 0
fi
echo "🔍 Running CodeScene Code Health check..."
# Check if we have staged files to analyze
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(ts|tsx|rs)$' || true)
if [ -z "$STAGED_FILES" ]; then
echo "✅ No TypeScript/Rust files staged, skipping CodeScene check"
exit 0
fi
# Get current branch
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
# Determine base branch for comparison
if [ "$CURRENT_BRANCH" = "main" ]; then
BASE_REF="HEAD~1"
else
BASE_REF="origin/main"
fi
echo " Comparing against: $BASE_REF"
# Check if we have the CodeScene CLI or token
CODESCENE_TOKEN_FILE="$HOME/.codescene/token"
if [ ! -f "$CODESCENE_TOKEN_FILE" ]; then
echo "⚠️ CodeScene token not found at $CODESCENE_TOKEN_FILE"
echo " Install CodeScene MCP or configure token to enable automatic checks"
echo " Proceeding without check (use 'git commit --no-verify' to skip this warning)"
exit 0
fi
# Simple health check using git diff stats
echo " Analyzing code changes..."
# Get file changes
LINES_ADDED=$(git diff --cached --numstat | awk '{sum+=$1} END {print sum}')
LINES_REMOVED=$(git diff --cached --numstat | awk '{sum+=$2} END {print sum}')
# Check for large files (potential complexity)
LARGE_FILES=$(git diff --cached --numstat | awk '$1 > 500 || $2 > 500 {print $3}')
if [ ! -z "$LARGE_FILES" ]; then
echo "⚠️ Large file changes detected (>500 lines):"
echo "$LARGE_FILES" | sed 's/^/ - /'
echo ""
echo " Consider:"
echo " - Breaking into smaller commits"
echo " - Reviewing with Claude Code + CodeScene MCP"
echo " - Running: claude 'Review code health of staged changes'"
echo ""
read -p " Continue anyway? (y/N) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "❌ Commit aborted"
exit 1
fi
fi
echo "✅ CodeScene check passed"
echo " +$LINES_ADDED -$LINES_REMOVED lines"
echo ""
echo " 💡 For detailed code health analysis, run:"
echo " claude 'Check code health of this commit with CodeScene MCP'"
echo ""
exit 0

96
README.md Normal file
View File

@@ -0,0 +1,96 @@
# Laputa App
Personal knowledge and life management desktop app built with Tauri v2 + React + TypeScript + BlockNote.
## Documentation
- 📐 [ARCHITECTURE.md](docs/ARCHITECTURE.md) — System design, tech stack, data flow
- 🧩 [ABSTRACTIONS.md](docs/ABSTRACTIONS.md) — Core abstractions and models
- 🚀 [GETTING-STARTED.md](docs/GETTING-STARTED.md) — How to navigate the codebase
- 🎨 [THEMING.md](docs/THEMING.md) — Theme system and customization
## Quick Start
### Prerequisites
- Node.js 20+
- pnpm 8+
- Rust (latest stable)
- macOS (for development)
### Setup
```bash
# Install dependencies
pnpm install
# Install git hooks (optional but recommended)
.github/hooks/install-hooks.sh
# Run dev server
pnpm dev
# Open in browser (mock mode)
open http://localhost:5173
# Or run in Tauri
pnpm tauri dev
```
### Testing
```bash
# Frontend tests
pnpm test
# Backend tests
cargo test
# Coverage
pnpm test:coverage
# E2E tests
pnpm test:e2e
```
### Code Quality
```bash
# Lint
pnpm lint
# Rust checks
cargo clippy
cargo fmt --check
# CodeScene (via Claude Code)
claude 'Check code health with CodeScene MCP'
```
## Development Workflow
See [CLAUDE.md](CLAUDE.md) for coding guidelines and workflow.
**Key principles:**
- Small, atomic commits
- Test as you go
- Visual verification mandatory
- Documentation updated with code changes
## CI/CD
GitHub Actions runs on every push/PR:
- ✅ Tests (frontend + Rust)
- 📊 Coverage (70% threshold)
- 🎨 Lint & format
- ⚠️ Documentation check
See [.github/SETUP.md](.github/SETUP.md) for CI/CD configuration.
## Git Hooks
Pre-commit hook checks code health before every commit. See [.github/HOOKS.md](.github/HOOKS.md) for details.
## License
Private repository — not licensed for public use.

File diff suppressed because it is too large Load Diff