ontoref/justfiles/ci.just
Jesús Pérez 13b03d6edf
Some checks failed
Nickel Type Check / Nickel Type Checking (push) Has been cancelled
Rust CI / Security Audit (push) Has been cancelled
Rust CI / Check + Test + Lint (nightly) (push) Has been cancelled
Rust CI / Check + Test + Lint (stable) (push) Has been cancelled
feat: mode guards, convergence, manifest coverage, doc authoring pattern
## Mode guards and convergence loops (ADR-011)

  - `Guard` and `Converge` types added to `reflection/schema.ncl` and
    `reflection/defaults.ncl`. Guards run pre-flight checks (Block/Warn);
    converge loops iterate until a condition is met (RetryFailed/RetryAll).
  - `sync-ontology.ncl`: 3 guards + converge (zero-drift condition, max 2 iter).
  - `coder-workflow.ncl`: guard (coder-dir-exists) + `novelty-check` step.
  - Rust types in `ontoref-reflection/src/mode.rs`; executor in `executor.rs`
    evaluates guards before steps and convergence loop after.
  - `adrs/adr-011-mode-guards-and-convergence.ncl` added.

  ## Manifest capability completeness

  - `.ontology/manifest.ncl`: 3 → 19 declared capabilities covering the full
    action surface (daemon API, modes, Task Composer, QA, bookmarks, etc.).
  - `sync.nu`: `audit-manifest-coverage` + `sync manifest-check` command.
  - `validate-project.ncl`: 6th category `manifest-cov`.
  - Pre-commit hook `manifest-coverage` added.
  - Migrations `0010-manifest-capability-completeness`,
    `0011-manifest-coverage-hooks`.

  ## Rust doc authoring pattern — canonical `///` convention

  - `#[onto_api]`: `description = "..."` optional when `///` doc comment exists
    above handler — first line used as fallback. `#[derive(OntologyNode)]` same.
  - `ontoref-daemon/src/api.rs`: 42 handlers migrated to `///` doc comments;
    `description = "..."` removed from all `#[onto_api]` blocks.
  - `sync diff --docs --fail-on-drift`: exits 1 on crate `//!` drift; used by
    new `docs-drift` pre-commit hook. `docs-links` hook checks rustdoc broken links.
  - `generator.nu`: mdBook `crates/` chapter — per-crate page from `//!` doc,
    coverage badge, feature flags, implementing practice nodes.
  - `.claude/CLAUDE.md`: `### Documentation Authoring (Rust)` section added.
  - Migration `0012-rust-doc-authoring-pattern`.

  ## OntologyNode derive fixes

  - `#[derive(OntologyNode)]`: `name` and `paths` attributes supported; `///`
    doc fallback for `description`; `artifact_paths` correctly populated.
  - `Core::from_value` calls `merge_contributors()` behind `#[cfg(feature = "derive")]`.

  ## Bug fixes

  - `sync.nu` drift check: exact crate path match (not `str starts-with`);
    first-path-only rule; split on `. ` not `.` to avoid `.ontology/` truncation.
  - `find-unclaimed-artifacts`: fixed absolute vs relative path comparison.
  - Rustdoc broken intra-doc links fixed across all three crates.
  - `ci-docs` recipe now sets `RUSTDOCFLAGS` and actually fails on errors.

  mode guards/converge, manifest coverage validation, 19 capabilities (ADR-011)

  Extend the mode schema with Guard (pre-flight Block/Warn checks) and Converge
  (RetryFailed/RetryAll post-execution loops) — protocol pushes back on invalid
  state and iterates until convergence. ADR-011 records the decision to extend
  modes rather than create a separate action subsystem.

  Manifest expanded from 3 to 19 capabilities covering the full action surface
  (compose, plans, backlog graduation, notifications, coder pipeline, forms,
  templates, drift, quick actions, migrations, config, onboarding). New
  audit-manifest-coverage validator + pre-commit hook + SessionStart hook
  ensure agents always see complete project self-description.

  Bug fix: find-unclaimed-artifacts absolute vs relative path comparison —
  19 phantom MISSING items resolved. Health 43% → 100%.

  Anti-slop: coder novelty-check step (Jaccard overlap against published+QA)
  inserted between triage and publish in coder-workflow.

  Justfile restructured into 5 modules (build/test/dev/ci/assets).
  Migrations 0010-0011 propagate requirements to consumer projects.
2026-03-30 19:08:25 +01:00

191 lines
6.6 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 ci-docs
@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 (alias — prefer dev-fmt)
fmt:
just dev-fmt
# ==============================================================================
# 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 (alias — prefer dev-docs)
docs:
just dev-docs
# Check documentation — broken intra-doc links are compile errors, not warnings.
# RUSTDOCFLAGS are inherited by cargo doc; -D flags turn lint groups into hard errors.
ci-docs:
RUSTDOCFLAGS="-D rustdoc::broken-intra-doc-links -D rustdoc::private-intra-doc-links" \
cargo doc --all-features --no-deps --workspace 2>&1
# ==============================================================================
# Pre-commit Setup
# ==============================================================================
# Install pre-commit hooks (alias — prefer dev-setup-hooks)
setup-hooks:
just dev-setup-hooks
# Run pre-commit on all files (alias — prefer dev-hooks-run-all)
hooks-run-all:
just dev-hooks-run-all
# ==============================================================================
# Install
# ==============================================================================
# Build and install daemon (alias — prefer build-daemon)
install-daemon:
just build-daemon
# ==============================================================================
# Utility Commands
# ==============================================================================
# Clean build artifacts (alias — prefer dev-clean)
clean:
just dev-clean