60 lines
2.1 KiB
Text
60 lines
2.1 KiB
Text
# Dev Module — Development workflows for ontoref
|
|
# ================================================
|
|
|
|
# Format all code (Rust + TOML)
|
|
dev-fmt:
|
|
@echo "Formatting code..."
|
|
cargo fmt --all
|
|
@command -v taplo >/dev/null && taplo format || true
|
|
|
|
# Build UnoCSS in watch mode (development)
|
|
dev-watch-css: sync-assets
|
|
cd assets/css && pnpm install && pnpm run watch
|
|
|
|
# Install pre-commit hooks + ontoref git hooks
|
|
dev-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
|
|
git_hooks_dir="$(git rev-parse --git-dir)/hooks"
|
|
hook_body='#!/usr/bin/env bash'$'\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
|
|
dev-hooks-run-all:
|
|
@echo "Running pre-commit on all files..."
|
|
pre-commit run --all-files
|
|
|
|
# Clean build artifacts
|
|
dev-clean:
|
|
@echo "Cleaning..."
|
|
cargo clean
|
|
rm -rf target/
|
|
rm -f sbom.json lcov.info
|
|
|
|
# Run ontoref sync audit (quick health check)
|
|
dev-audit:
|
|
ONTOREF_ACTOR=developer ./ontoref sync audit
|
|
|
|
# Generate documentation
|
|
dev-docs:
|
|
@echo "Generating documentation..."
|
|
cargo doc --no-deps --open
|
|
|
|
# No arg → dev build into .ontoref/docsite/book/. Pass a docserver url_path
|
|
# (e.g. `just docsite /ontoref`) to bake site-url, build the dist, and emit
|
|
# the [[serv_paths]] registration entry.
|
|
# Project the ontology into the mdBook docsite (cdci-dao model) and build it
|
|
docsite serve_path="":
|
|
cd {{project_root}}/../.ontoref && ONTOREF_ROOT=$PWD ONTOREF_PROJECT_ROOT=$PWD ONTOREF_ACTOR=developer nu -c "use reflection/modules/docsite.nu *; docsite generate --serve-path '{{serve_path}}'"
|