build: add tooling config and setup script
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
repos:
|
||||||
|
- repo: https://github.com/commitizen-tools/commitizen
|
||||||
|
rev: v4.13.9
|
||||||
|
hooks:
|
||||||
|
- id: commitizen
|
||||||
|
stages: [commit-msg]
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
set shell := ["powershell", "-NoProfile", "-Command"]
|
||||||
|
|
||||||
|
# Container runtime: uncomment the line for your preferred tool
|
||||||
|
# docker := "docker"
|
||||||
|
docker := "podman"
|
||||||
|
|
||||||
|
# KollectAI-ETL Task Runner
|
||||||
|
# Uses Commitizen (https://commitizen-tools.github.io/commitizen/) for
|
||||||
|
# Conventional Commits enforcement, automated versioning, and changelog generation.
|
||||||
|
# Configuration: .cz.json (SemVer, conventional_commits schema)
|
||||||
|
# Hook config: .pre-commit-config.yaml (commit-msg stage validation)
|
||||||
|
|
||||||
|
# Full bootstrap: install uv, just, commitizen, pre-commit, and configure git hooks.
|
||||||
|
# Run this once after cloning the repo. Safe to re-run (idempotent).
|
||||||
|
# Requires: PowerShell (pwsh). Installs uv and just if missing.
|
||||||
|
bootstrap:
|
||||||
|
pwsh -ExecutionPolicy Bypass -File ./setup.ps1
|
||||||
|
|
||||||
|
# Install commitizen and pre-commit, then configure git hooks.
|
||||||
|
# Requires: uv, just already installed. Use `just bootstrap` if not.
|
||||||
|
setup:
|
||||||
|
uv tool install commitizen; uv tool install pre-commit; pre-commit install
|
||||||
|
|
||||||
|
# Refresh pre-commit hook versions to latest.
|
||||||
|
# Run after pulling changes that update .pre-commit-config.yaml.
|
||||||
|
update:
|
||||||
|
pre-commit autoupdate
|
||||||
|
|
||||||
|
# Generate or update CHANGELOG.md from conventional commit history.
|
||||||
|
# Reads commits since the last tag and groups by type (feat, fix, etc.).
|
||||||
|
changelog:
|
||||||
|
cz changelog
|
||||||
|
|
||||||
|
# Bump the project version based on commit history since the last tag.
|
||||||
|
# Commitizen determines the SemVer increment automatically:
|
||||||
|
# feat commits → minor bump
|
||||||
|
# fix commits → patch bump
|
||||||
|
# BREAKING CHANGE → major bump
|
||||||
|
# Also updates CHANGELOG.md (update_changelog_on_bump is enabled in .cz.json).
|
||||||
|
bump:
|
||||||
|
cz bump
|
||||||
|
|
||||||
|
# Start infrastructure services (PostgreSQL, Ollama, MinIO)
|
||||||
|
infra:
|
||||||
|
{{docker}} compose up -d postgres ollama minio
|
||||||
|
|
||||||
|
# Run backend in dev mode
|
||||||
|
backend:
|
||||||
|
cd backend/etl; ./mvnw spring-boot:run "-Dspring-boot.run.profiles=dev"
|
||||||
|
|
||||||
|
# Run frontend dev server
|
||||||
|
frontend:
|
||||||
|
cd frontend/svelte; pnpm install; pnpm dev
|
||||||
|
|
||||||
|
# Start infra + backend + frontend for local development
|
||||||
|
dev:
|
||||||
|
just infra; just backend; just frontend
|
||||||
|
|
||||||
|
# Build all artifacts
|
||||||
|
build:
|
||||||
|
cd backend/etl; ./mvnw package -DskipTests
|
||||||
|
cd frontend/svelte; pnpm build
|
||||||
|
|
||||||
|
# Run all tests
|
||||||
|
test:
|
||||||
|
cd backend/etl; ./mvnw test
|
||||||
|
cd frontend/svelte; pnpm test
|
||||||
|
|
||||||
|
# Run linting
|
||||||
|
lint:
|
||||||
|
cd backend/etl; ./mvnw checkstyle:check
|
||||||
|
cd frontend/svelte; pnpm lint
|
||||||
|
|
||||||
|
# Start all services via Docker Compose
|
||||||
|
up:
|
||||||
|
{{docker}} compose up -d --build
|
||||||
|
|
||||||
|
# Stop all services
|
||||||
|
down:
|
||||||
|
{{docker}} compose down
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
#!/usr/bin/env pwsh
|
||||||
|
|
||||||
|
# KollectAI-ETL Bootstrap Setup
|
||||||
|
#
|
||||||
|
# Installs all required development tools and configures git hooks.
|
||||||
|
# Safe to re-run (idempotent) — skips tools that are already installed.
|
||||||
|
#
|
||||||
|
# Usage: pwsh ./setup.ps1
|
||||||
|
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
function Test-Command($Name) {
|
||||||
|
$null -ne (Get-Command $Name -ErrorAction SilentlyContinue)
|
||||||
|
}
|
||||||
|
|
||||||
|
function Install-Tool($Name, $ScriptBlock) {
|
||||||
|
if (Test-Command $Name) {
|
||||||
|
$version = & $Name --version 2>&1 | Select-Object -First 1
|
||||||
|
Write-Host "[OK] $Name already installed: $version" -ForegroundColor Green
|
||||||
|
} else {
|
||||||
|
Write-Host "[INSTALL] Installing $Name..." -ForegroundColor Yellow
|
||||||
|
& $ScriptBlock
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Host "[FAIL] Failed to install $Name" -ForegroundColor Red
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
$version = & $Name --version 2>&1 | Select-Object -First 1
|
||||||
|
Write-Host "[OK] $Name installed: $version" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "KollectAI-ETL Bootstrap Setup" -ForegroundColor Cyan
|
||||||
|
Write-Host "=============================" -ForegroundColor Cyan
|
||||||
|
Write-Host ""
|
||||||
|
|
||||||
|
# 1. uv (Python package manager / tool runner)
|
||||||
|
Install-Tool "uv" {
|
||||||
|
Invoke-RestMethod https://astral.sh/uv/install.ps1 | Invoke-Expression
|
||||||
|
}
|
||||||
|
|
||||||
|
# 2. just (task runner)
|
||||||
|
Install-Tool "just" {
|
||||||
|
uv tool install rust-just
|
||||||
|
}
|
||||||
|
|
||||||
|
# 3. Run just setup (installs commitizen, pre-commit, configures git hooks)
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "Running just setup..." -ForegroundColor Cyan
|
||||||
|
just setup
|
||||||
|
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "Setup complete!" -ForegroundColor Green
|
||||||
|
Write-Host ""
|
||||||
Reference in New Issue
Block a user