ontoref/justfiles/ci.just
Jesús Pérez d59644b96f
feat: unified auth model, project onboarding, install pipeline, config management
The full scope across this batch: POST /sessions key→token exchange, SessionStore dual-index with revoke_by_id, CLI Bearer injection (ONTOREF_TOKEN), ontoref setup
  --gen-keys, install scripts, daemon config form roundtrip, ADR-004/005, on+re self-description update (fully-self-described), and landing page refresh.
2026-03-13 20:56:31 +00:00

222 lines
7.7 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# CI/CD Just Recipes
# Generated by dev-system/ci - Dynamic template
# Provides `just` recipes for running CI checks locally
# Based on detected languages and enabled tools
# Show CI help
[doc("Show ci help")]
help:
@echo "CI/CD Just Recipes"
@echo ""
@echo "Main Commands:"
@echo " just ci-full - Run all CI checks"
@echo " just ci-fmt - Format code"
@echo " just ci-lint - Run all linting checks"
@echo " just ci-test - Run all tests"
@echo " just ci-audit - Run security audits"
@echo ""
@echo "Language-Specific:"
@echo " just ci-lint-rust - Lint Rust (clippy)"
@echo " just ci-fmt-toml - Check TOML formatting"
@echo " just ci-lint-toml - Lint TOML files (taplo)"
@echo " just ci-lint-nickel - Type check Nickel"
@echo " just ci-lint-markdown - Lint Markdown (markdownlint-cli2)"
@echo " just ci-lint-prose - Lint prose (Vale)"
@echo ""
@echo "Other:"
@echo " just ci-check-config-sync - Verify form/template parity"
@echo " just ci-sbom - Generate SBOM"
@echo " just ci-test-coverage - Run tests with coverage"
@echo " just setup-hooks - Install pre-commit hooks"
@echo " just hooks-run-all - Run pre-commit on all files"
@echo " just clean - Clean build artifacts"
# Run all CI checks
ci-full: ci-lint-rust ci-fmt-toml ci-lint-toml ci-lint-nickel ci-lint-markdown ci-lint-prose ci-test ci-audit ci-check-config-sync
@echo "✅ All CI checks passed!"
# ==============================================================================
# Formatting Checks
# ==============================================================================
# Check Rust code formatting
ci-fmt:
@echo "📝 Checking Rust code formatting..."
cargo fmt --all -- --check
# Check TOML file formatting
ci-fmt-toml:
@echo "📝 Checking TOML formatting..."
@command -v taplo >/dev/null || (echo "❌ taplo not installed: cargo install taplo-cli"; exit 1)
taplo format --check
# Format all code
fmt:
@echo "🎨 Formatting code..."
cargo fmt --all
just fmt-toml
# Format TOML files
fmt-toml:
@echo "🎨 Formatting TOML files..."
@command -v taplo >/dev/null || (echo "❌ taplo not installed: cargo install taplo-cli"; exit 1)
taplo format
# ==============================================================================
# Linting
# ==============================================================================
# Run all linting checks
ci-lint: ci-lint-rust ci-lint-toml ci-lint-nickel ci-lint-markdown ci-lint-prose ci-check-config-sync
@echo "✅ All lint checks passed!"
# Lint Rust code
ci-lint-rust:
@echo "🔍 Linting Rust (clippy)..."
cargo clippy --all-targets --all-features -- -D warnings
# Lint TOML files
ci-lint-toml:
@echo "🔍 Linting TOML files..."
@command -v taplo >/dev/null || (echo "❌ taplo not installed: cargo install taplo-cli"; exit 1)
taplo lint
# Lint Nickel schemas
ci-lint-nickel:
#!/usr/bin/env bash
echo "🔍 Type checking Nickel..."
SCHEMAS=$(find . -name "*.ncl" -type f \
! -path "./target/*" \
! -path "./.git/*" \
! -path "./node_modules/*" \
| head -20)
if [ -z "$SCHEMAS" ]; then
echo " No Nickel schemas found"
exit 0
fi
export NICKEL_IMPORT_PATH="/Users/Akasha/Tools/dev-system/ci/schemas:/Users/Akasha/Tools/dev-system/ci/validators:/Users/Akasha/Tools/dev-system/ci/defaults:."
for schema in $SCHEMAS; do
echo " Checking: $schema"
nickel typecheck "$schema" || exit 1
done
echo " ✓ All Nickel schemas valid"
# Lint Markdown files
ci-lint-markdown:
@echo "🔍 Linting Markdown files..."
@command -v markdownlint-cli2 >/dev/null || (echo "❌ markdownlint-cli2 not installed: npm install markdownlint-cli2"; exit 1)
markdownlint-cli2 "**/*.md" "#node_modules" "#.git"
# Lint prose/documentation
ci-lint-prose:
@echo "🔍 Linting prose with Vale..."
@command -v vale >/dev/null || (echo "❌ vale not installed: brew install vale"; exit 1)
vale sync
vale .
# ==============================================================================
# Testing
# ==============================================================================
# Run all tests
ci-test:
@echo "🧪 Running tests..."
cargo test --workspace --all-features
# Run tests with coverage (requires cargo-llvm-cov)
ci-test-coverage:
@echo "📊 Running tests with coverage..."
cargo llvm-cov --all-features --lcov --output-path lcov.info
# ==============================================================================
# Security Auditing
# ==============================================================================
# Run all security audits
ci-audit: ci-audit-rust
@echo "✅ All security audits passed!"
# Audit Rust dependencies
ci-audit-rust:
@echo "🔒 Auditing Rust dependencies..."
cargo audit
cargo deny check licenses
cargo deny check advisories
# Assert reflection/forms/config.ncl and config.ncl.j2 have matching fields
ci-check-config-sync:
@echo "🔍 Checking config form/template sync..."
nu install/check-config-sync.nu
# Generate SBOM
ci-sbom:
@echo "📦 Generating Software Bill of Materials..."
cargo sbom > sbom.json
@echo "✓ SBOM generated: sbom.json"
# ==============================================================================
# Documentation
# ==============================================================================
# Generate documentation
docs:
@echo "📚 Generating documentation..."
cargo doc --no-deps --open
# Check documentation
ci-docs:
@echo "📚 Checking documentation..."
cargo doc --no-deps --document-private-items 2>&1 | grep -i "warning:" && exit 1 || true
@echo "✓ Documentation check passed"
# ==============================================================================
# Pre-commit Setup
# ==============================================================================
# Install pre-commit hooks + ontoref git hooks (post-merge, post-checkout)
setup-hooks:
#!/usr/bin/env bash
set -euo pipefail
echo "Installing pre-commit hooks..."
if command -v pre-commit &> /dev/null; then
pre-commit install && pre-commit install --hook-type pre-push
echo "✓ Pre-commit hooks installed"
else
echo "❌ pre-commit not found. Install with: pip install pre-commit"
exit 1
fi
# ontoref operational hooks — auto-detect mode on merge/checkout
git_hooks_dir="$(git rev-parse --git-dir)/hooks"
hook_body='#!/usr/bin/env bash'$'\n''# ontoref git hook — mode auto-detection and ontology sync'$'\n''nu "$(git rev-parse --show-toplevel)/reflection/hooks/git-event.nu" "$1" 2>/dev/null || true'
for hook in post-merge post-checkout; do
printf '%s\n' "${hook_body}" > "${git_hooks_dir}/${hook}"
chmod +x "${git_hooks_dir}/${hook}"
echo "✓ ${hook} hook installed"
done
# Run pre-commit on all files
hooks-run-all:
@echo "🪝 Running pre-commit on all files..."
pre-commit run --all-files
# ==============================================================================
# Install
# ==============================================================================
# Build ontoref-daemon and install binary, assets, CLI wrapper, and bootstrapper
install-daemon:
cargo build --release -p ontoref-daemon
nu install/install.nu
# ==============================================================================
# Utility Commands
# ==============================================================================
# Clean build artifacts
clean:
@echo "🧹 Cleaning..."
cargo clean
rm -rf target/
rm -f sbom.json lcov.info