Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
167 changes: 106 additions & 61 deletions justfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -84,48 +81,98 @@ 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
# ═══════════════════════════════════════════════════════════════════════════════

# 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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down
Loading