diff --git a/Cargo.lock b/Cargo.lock index 34b22e3..a51be54 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8545,6 +8545,7 @@ dependencies = [ "tokio", "tokio-test", "tracing", + "tracing-subscriber", "uuid", "which", "xxhash-rust", @@ -8632,9 +8633,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "surrealdb" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2679904b834ec4481a5305c5ac5ab68c0b6c8e3538e744c40b5a9b9867d3f5fa" +checksum = "62b7720b39ce2985efbfa10858b7397ffd95655a9bab6d9dfaa03622bbdc3bc2" dependencies = [ "arrayvec", "async-channel", @@ -8674,9 +8675,9 @@ dependencies = [ [[package]] name = "surrealdb-core" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e764f99f016ddfaedafc9c777a830b371a1b2e536b5d146a1ef69674e041ed6" +checksum = "c48e42c81713be2f9b3dae64328999eafe8b8060dd584059445a908748b39787" dependencies = [ "addr", "affinitypool", @@ -8706,6 +8707,7 @@ dependencies = [ "geo 0.28.0", "geo-types", "getrandom 0.3.4", + "hashbrown 0.14.5", "hex", "http 1.4.0", "ipnet", @@ -9731,9 +9733,9 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] name = "uuid" -version = "1.19.0" +version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a" +checksum = "ee48d38b119b0cd71fe4141b30f5ba9c7c5d9f4e7a3a8b4a674e4b6ef789976f" dependencies = [ "getrandom 0.3.4", "js-sys", diff --git a/Cargo.toml b/Cargo.toml index f72e94e..70b0e62 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ fastembed = "5.8" # Vector storage lancedb = "0.23" -surrealdb = { version = "2.5", features = ["kv-mem"] } +surrealdb = { version = "2.6", features = ["kv-mem"] } # LOCKED: Arrow 56.x required for LanceDB 0.23 compatibility # LanceDB 0.23 uses Arrow 56.2.0 internally - Arrow 57 breaks API compatibility # DO NOT upgrade to Arrow 57 until LanceDB supports it @@ -51,7 +51,7 @@ prometheus = "0.14" xxhash-rust = { version = "0.8", features = ["xxh3"] } dirs = "6.0" chrono = "0.4" -uuid = "1.19" +uuid = "1.20" which = "8.0" # Testing diff --git a/crates/stratum-llm/Cargo.toml b/crates/stratum-llm/Cargo.toml index bf54f01..e1371be 100644 --- a/crates/stratum-llm/Cargo.toml +++ b/crates/stratum-llm/Cargo.toml @@ -63,3 +63,4 @@ all = [ [dev-dependencies] tokio-test = { workspace = true } +tracing-subscriber = { workspace = true } diff --git a/crates/stratum-llm/examples/fallback_demo.rs b/crates/stratum-llm/examples/fallback_demo.rs index f07420b..d587a44 100644 --- a/crates/stratum-llm/examples/fallback_demo.rs +++ b/crates/stratum-llm/examples/fallback_demo.rs @@ -1,4 +1,4 @@ -use stratum_llm::{FallbackStrategy, Message, Role, UnifiedClient}; +use stratum_llm::{Message, Role, UnifiedClient}; #[tokio::main] async fn main() -> Result<(), Box> { diff --git a/justfiles/ci.just b/justfiles/ci.just new file mode 100644 index 0000000..ac875da --- /dev/null +++ b/justfiles/ci.just @@ -0,0 +1,196 @@ +# 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-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 + @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 + @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 + +# 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 +setup-hooks: + @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 + +# Run pre-commit on all files +hooks-run-all: + @echo "๐Ÿช Running pre-commit on all files..." + pre-commit run --all-files + +# ============================================================================== +# Utility Commands +# ============================================================================== + +# Clean build artifacts +clean: + @echo "๐Ÿงน Cleaning..." + cargo clean + rm -rf target/ + rm -f sbom.json lcov.info