Files
Memoh/.husky/check-large-files
Fodesu 313c3b84f3 chore(husky): large file pre-commit check support (#75)
* chore: add large file check in husky

* refactor(husky): modularize pre-commit hooks

* chore(lint): add vitepress generate cache dir to eslint ignores config

* fix(container): propagate host timezone to all containers

Replace TZ env var with /etc/localtime bind-mount in docker-compose
and inject timezone spec opts into containerd bot containers.

* ci(docker): add docker-publish workflow and clean up release.yml

Add dedicated docker-publish.yml with full CI/CD pipeline:
- Build & push server/agent/web/mcp images on tag, main push, and PR
- Publish to both Docker Hub and GHCR
- Semver tag strategy (latest, version, major.minor, major, sha)
- GHA build cache, SLSA provenance, and SBOM
- PR builds validate without pushing

Remove superseded dockerhub job from release.yml.

* ci: add migration validation workflow

Run migrate up -> down -> up against a temporary PostgreSQL service
container on every PR and push to main, verifying all migrations
apply, rollback, and re-apply correctly.

* ci(docker): only push on tag, skip latest for prereleases

- Remove push-to-main trigger; only tag push publishes images
- Prerelease tags (e.g. v0.1.0-beta.2) publish their version tag
  only, without updating latest or short semver tags

* ci: optimize workflow performance

- PR docker builds use single arch (amd64 only), tag push uses dual
- Add paths-ignore to skip CI on docs-only changes
- Add concurrency groups to cancel stale runs on re-push
- Build Go binary once instead of 3x go run in migrate job

* ci: only run migrate job when db/migrations changes

* fix: change memory message role from system to user caused by the imcompatibility of anthropic messages api

* chore(husky): rm web build

---------

Co-authored-by: BBQ <ckr@chenkr.cn>
Co-authored-by: Acbox <acbox0328@gmail.com>
2026-02-20 22:40:37 +08:00

30 lines
829 B
Bash
Executable File

#!/usr/bin/env sh
# Check for large files before commit
MAX_SIZE=1048576 # 1MB in bytes
files=$(git diff --cached --name-only --diff-filter=ACMR)
has_large_file=false
echo "Checking for large files..."
for file in $files; do
if [ -f "$file" ]; then
size=$(stat -f%z "$file" 2>/dev/null || stat -c%s "$file" 2>/dev/null)
if [ "$size" -gt "$MAX_SIZE" ]; then
size_mb=$(echo "scale=2; $size / 1048576" | bc 2>/dev/null || echo "$((size / 1048576))")
echo " File '$file' is too large (${size_mb}MB). Maximum allowed is $((MAX_SIZE / 1048576))MB."
has_large_file=true
fi
fi
done
if [ "$has_large_file" = true ]; then
echo ""
echo "Error: Large files detected. Commit rejected."
echo " If this is intentional, use: git commit --no-verify"
exit 1
fi
echo "File size check passed"