diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index 9ea0c8b..3b80084 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -28,7 +28,7 @@ jobs: - name: Check TODO/FIXME run: | echo "=== TODOs ===" - grep -rn "TODO\|FIXME\|HACK\|XXX" --include="*.rs" --include="*.res" --include="*.py" --include="*.ex" . | head -20 || echo "None found" + grep -rn "TODO\|FIXME\|HACK\|XXX" --include="*.scm" --include="*.adoc" --include="*.rs" --include="*.res" . | head -20 || echo "None found" - name: Check for large files run: | diff --git a/justfile b/justfile index 0e12d43..4fbcc4e 100644 --- a/justfile +++ b/justfile @@ -1,8 +1,8 @@ -# RSR-template-repo - RSR Standard Justfile Template +# anchor.scm - ANCHOR Format Specification # https://just.systems/man/en/ # -# This is the CANONICAL template for all RSR projects. -# Copy this file to new projects and customize the {{PLACEHOLDER}} values. +# Justfile for the ANCHOR.scm specification repository. +# Part of the SCM Format Family. # # Run `just` to see all available recipes # Run `just cookbook` to generate docs/just-cookbook.adoc @@ -12,10 +12,10 @@ set shell := ["bash", "-uc"] set dotenv-load := true set positional-arguments := true -# Project metadata - CUSTOMIZE THESE -project := "RSR-template-repo" +# Project metadata +project := "anchor.scm" version := "0.1.0" -tier := "infrastructure" # 1 | 2 | infrastructure +tier := "infrastructure" # SCM Format Family specification # ═══════════════════════════════════════════════════════════════════════════════ # DEFAULT & HELP @@ -50,26 +50,23 @@ info: # BUILD & COMPILE # ═══════════════════════════════════════════════════════════════════════════════ -# Build the project (debug mode) +# Build the project (generate documentation) build *args: - @echo "Building {{project}}..." - # TODO: Add build command for your language - # Rust: cargo build {{args}} - # ReScript: npm run build - # Elixir: mix compile + @echo "Building {{project}} documentation..." + @mkdir -p docs/generated + @just cookbook + @echo "Documentation built successfully" -# Build in release mode with optimizations +# Build in release mode (full documentation with man pages) build-release *args: @echo "Building {{project}} (release)..." - # TODO: Add release build command - # Rust: cargo build --release {{args}} + @just docs + @echo "Full documentation build complete" -# Build and watch for changes +# Build and watch for changes (spec repos: manual rebuild) build-watch: - @echo "Watching for changes..." - # TODO: Add watch command - # Rust: cargo watch -x build - # ReScript: npm run watch + @echo "Specification repository - run 'just build' after changes" + @echo "For continuous file monitoring, use: watch -n 5 'just validate'" # Clean build artifacts [reversible: rebuild with `just build`] clean: @@ -84,24 +81,52 @@ clean-all: clean # TEST & QUALITY # ═══════════════════════════════════════════════════════════════════════════════ -# Run all tests +# Run all tests (validate Scheme syntax) test *args: - @echo "Running tests..." - # TODO: Add test command - # Rust: cargo test {{args}} - # ReScript: npm test - # Elixir: mix test + #!/usr/bin/env bash + echo "Running Scheme syntax validation..." + FAILED=0 + for f in $(find . -name "*.scm" -not -path "./.git/*" 2>/dev/null); do + if command -v guile >/dev/null 2>&1; then + guile -c "(primitive-load \"$f\")" 2>/dev/null || { echo "FAIL: $f"; FAILED=1; } + else + echo "SKIP: $f (guile not available)" + fi + done + [ $FAILED -eq 0 ] && echo "All Scheme files valid" || exit 1 # Run tests with verbose output test-verbose: - @echo "Running tests (verbose)..." - # TODO: Add verbose test + #!/usr/bin/env bash + echo "Running Scheme syntax validation (verbose)..." + for f in $(find . -name "*.scm" -not -path "./.git/*" 2>/dev/null); do + echo -n "Checking $f... " + if command -v guile >/dev/null 2>&1; then + if guile -c "(primitive-load \"$f\")" 2>&1; then + echo "OK" + else + echo "FAIL" + fi + else + echo "SKIP (guile not available)" + fi + done -# Run tests and generate coverage report +# Run tests and generate coverage report (spec repo: validation report) test-coverage: - @echo "Running tests with coverage..." - # TODO: Add coverage command - # Rust: cargo llvm-cov + #!/usr/bin/env bash + echo "=== Specification Validation Report ===" + echo "" + SCM_COUNT=$(find . -name "*.scm" -not -path "./.git/*" 2>/dev/null | wc -l) + ADOC_COUNT=$(find . -name "*.adoc" 2>/dev/null | wc -l) + echo "Scheme files: $SCM_COUNT" + echo "AsciiDoc files: $ADOC_COUNT" + echo "" + echo "=== Scheme Validation ===" + just test + echo "" + echo "=== Structure Validation ===" + just validate-rsr # ═══════════════════════════════════════════════════════════════════════════════ # LINT & FORMAT @@ -109,23 +134,45 @@ test-coverage: # Format all source files [reversible: git checkout] fmt: - @echo "Formatting..." - # TODO: Add format command - # Rust: cargo fmt - # ReScript: npm run format - # Elixir: mix format + #!/usr/bin/env bash + echo "Formatting Scheme files..." + # Scheme files use consistent indentation (manual review recommended) + # Ensure consistent line endings + find . -name "*.scm" -not -path "./.git/*" -exec sed -i 's/[[:space:]]*$//' {} \; + echo "Trailing whitespace removed from Scheme files" # Check formatting without changes fmt-check: - @echo "Checking format..." - # TODO: Add format check - # Rust: cargo fmt --check + #!/usr/bin/env bash + echo "Checking format..." + ISSUES=0 + # Check for trailing whitespace in Scheme files + if grep -rn '[[:space:]]$' --include="*.scm" . 2>/dev/null | grep -v ".git"; then + echo "Found trailing whitespace" + ISSUES=1 + fi + # Check for tabs (Scheme typically uses spaces) + if grep -rn $'\t' --include="*.scm" . 2>/dev/null | grep -v ".git"; then + echo "Found tabs (prefer spaces in Scheme)" + ISSUES=1 + fi + [ $ISSUES -eq 0 ] && echo "Format check passed" || exit 1 # Run linter lint: - @echo "Linting..." - # TODO: Add lint command - # Rust: cargo clippy -- -D warnings + #!/usr/bin/env bash + echo "Linting Scheme files..." + ISSUES=0 + # Check for SPDX license headers + for f in $(find . -name "*.scm" -not -path "./.git/*" 2>/dev/null); do + if ! head -1 "$f" | grep -q "SPDX-License-Identifier"; then + echo "WARN: Missing SPDX header: $f" + ISSUES=1 + fi + done + # Validate Scheme syntax + just test || ISSUES=1 + [ $ISSUES -eq 0 ] && echo "Lint passed" || echo "Lint completed with warnings" # Run all quality checks quality: fmt-check lint test @@ -139,23 +186,22 @@ fix: fmt # RUN & EXECUTE # ═══════════════════════════════════════════════════════════════════════════════ -# Run the application +# Run the application (spec repo: validate and show info) run *args: - @echo "Running {{project}}..." - # TODO: Add run command - # Rust: cargo run {{args}} + @echo "{{project}} is a specification repository" + @just info + @just validate -# Run in development mode with hot reload +# Run in development mode (spec repo: continuous validation) dev: - @echo "Starting dev mode..." - # TODO: Add dev command + @echo "Development mode for specification repository" + @echo "Edit files and run 'just validate' to check changes" + @just validate # Run REPL/interactive mode repl: - @echo "Starting REPL..." - # TODO: Add REPL command - # Elixir: iex -S mix - # Guile: guix shell guile -- guile + @echo "Starting Guile REPL..." + @command -v guile >/dev/null 2>&1 && guile || echo "Guile not installed. Install via: guix install guile" # ═══════════════════════════════════════════════════════════════════════════════ # DEPENDENCIES @@ -164,16 +210,15 @@ repl: # Install all dependencies deps: @echo "Installing dependencies..." - # TODO: Add deps command - # Rust: (automatic with cargo) - # ReScript: npm install - # Elixir: mix deps.get + @echo "This specification repository requires only Guile Scheme" + @command -v guile >/dev/null 2>&1 && echo "Guile: $(guile --version | head -1)" || echo "Install Guile via: guix install guile" # Audit dependencies for vulnerabilities deps-audit: @echo "Auditing dependencies..." - # TODO: Add audit command - # Rust: cargo audit + @echo "Specification repository with no external dependencies" + @echo "Checking for common security issues..." + @grep -rn "http://" --include="*.scm" --include="*.adoc" . 2>/dev/null | grep -v ".git" | grep -v "https://" && echo "WARN: Found non-HTTPS URLs" || echo "No insecure URLs found" # ═══════════════════════════════════════════════════════════════════════════════ # DOCUMENTATION @@ -425,7 +470,7 @@ loc: # Show TODO comments todos: - @grep -rn "TODO\|FIXME" --include="*.rs" --include="*.ex" --include="*.res" . 2>/dev/null || echo "No TODOs" + @grep -rn "TODO\|FIXME" --include="*.scm" --include="*.adoc" --include="*.rs" --include="*.res" . 2>/dev/null || echo "No TODOs" # Open in editor edit: