diff --git a/.typedialog/ci/README.md b/.typedialog/ci/README.md new file mode 100644 index 0000000..203358a --- /dev/null +++ b/.typedialog/ci/README.md @@ -0,0 +1,320 @@ +# CI System - Configuration Guide + +**Installed**: 2026-03-12 +**Detected Languages**: rust, nushell, nickel, bash, markdown + +--- + +## Quick Start + +### Option 1: Using configure.sh (Recommended) + +A convenience script is installed in `.typedialog/ci/`: + +```bash +# Use web backend (default) - Opens in browser +.typedialog/ci/configure.sh + +# Use TUI backend - Terminal interface +.typedialog/ci/configure.sh tui + +# Use CLI backend - Command-line prompts +.typedialog/ci/configure.sh cli +``` + +**This script automatically:** +- Sources `.typedialog/ci/envrc` for environment setup +- Loads defaults from `config.ncl` (Nickel format) +- Uses cascading search for fragments (local → Tools) +- Creates backup before overwriting existing config +- Saves output in Nickel format using nickel-roundtrip with documented template +- Generates `config.ncl` compatible with `nickel doc` command + +### Option 2: Direct TypeDialog Commands + +Use TypeDialog nickel-roundtrip directly with manual paths: + +#### Web Backend (Recommended - Easy Viewing) + +```bash +cd .typedialog/ci # Change to CI directory +source envrc # Load environment +typedialog-web nickel-roundtrip config.ncl form.toml \ + --output config.ncl \ + --ncl-template $TOOLS_PATH/dev-system/ci/templates/config.ncl.j2 +``` + +#### TUI Backend + +```bash +cd .typedialog/ci +source envrc +typedialog-tui nickel-roundtrip config.ncl form.toml \ + --output config.ncl \ + --ncl-template $TOOLS_PATH/dev-system/ci/templates/config.ncl.j2 +``` + +#### CLI Backend + +```bash +cd .typedialog/ci +source envrc +typedialog nickel-roundtrip config.ncl form.toml \ + --output config.ncl \ + --ncl-template $TOOLS_PATH/dev-system/ci/templates/config.ncl.j2 +``` + +**Note:** The `--ncl-template` flag uses a Tera template that adds: +- Descriptive comments for each section +- Documentation compatible with `nickel doc config.ncl` +- Consistent formatting and structure + +**All backends will:** +- Show only options relevant to your detected languages +- Guide you through all configuration choices +- Validate your inputs +- Generate config.ncl in Nickel format + +### Option 3: Manual Configuration + +Edit `config.ncl` directly: + +```bash +vim .typedialog/ci/config.ncl +``` + +--- + +## Configuration Format: Nickel + +**This project uses Nickel format by default** for all configuration files. + +### Why Nickel? + +- ✅ **Typed configuration** - Static type checking with `nickel typecheck` +- ✅ **Documentation** - Generate docs with `nickel doc config.ncl` +- ✅ **Validation** - Built-in schema validation +- ✅ **Comments** - Rich inline documentation support +- ✅ **Modular** - Import/export system for reusable configs + +### Nickel Template + +The output structure is controlled by a **Tera template** at: +- **Tools default**: `$TOOLS_PATH/dev-system/ci/templates/config.ncl.j2` +- **Local override**: `.typedialog/ci/config.ncl.j2` (optional) + +**To customize the template:** + +```bash +# Copy the default template +cp $TOOLS_PATH/dev-system/ci/templates/config.ncl.j2 \ + .typedialog/ci/config.ncl.j2 + +# Edit to add custom comments, documentation, or structure +vim .typedialog/ci/config.ncl.j2 + +# Your template will now be used automatically +``` + +**Template features:** +- Customizable comments per section +- Control field ordering +- Add project-specific documentation +- Configure output for `nickel doc` command + +### TypeDialog Environment Variables + +You can customize TypeDialog behavior with environment variables: + +```bash +# Web server configuration +export TYPEDIALOG_PORT=9000 # Port for web backend (default: 9000) +export TYPEDIALOG_HOST=localhost # Host binding (default: localhost) + +# Localization +export TYPEDIALOG_LANG=en_US.UTF-8 # Form language (default: system locale) + +# Run with custom settings +TYPEDIALOG_PORT=8080 .typedialog/ci/configure.sh web +``` + +**Common use cases:** + +```bash +# Access from other machines in network +TYPEDIALOG_HOST=0.0.0.0 TYPEDIALOG_PORT=8080 .typedialog/ci/configure.sh web + +# Use different port if 9000 is busy +TYPEDIALOG_PORT=3000 .typedialog/ci/configure.sh web + +# Spanish interface +TYPEDIALOG_LANG=es_ES.UTF-8 .typedialog/ci/configure.sh web +``` + +## Configuration Structure + +Your config.ncl is organized in the `ci` namespace (Nickel format): + +```nickel +{ + ci = { + project = { + name = "rust", + detected_languages = ["rust, nushell, nickel, bash, markdown"], + primary_language = "rust", + }, + tools = { + # Tools are added based on detected languages + }, + features = { + # CI features (pre-commit, GitHub Actions, etc.) + }, + ci_providers = { + # CI provider configurations + }, + }, +} +``` + +## Available Fragments + +Tool configurations are modular. Check `.typedialog/ci/fragments/` for: + +- rust-tools.toml - Tools for rust +- nushell-tools.toml - Tools for nushell +- nickel-tools.toml - Tools for nickel +- bash-tools.toml - Tools for bash +- markdown-tools.toml - Tools for markdown +- general-tools.toml - Cross-language tools +- ci-providers.toml - GitHub Actions, Woodpecker, etc. + +## Cascading Override System + +This project uses a **local → Tools cascading search** for all resources: + +### How It Works + +Resources are searched in priority order: + +1. **Local files** (`.typedialog/ci/`) - **FIRST** (highest priority) +2. **Tools files** (`$TOOLS_PATH/dev-system/ci/`) - **FALLBACK** (default) + +### Affected Resources + +| Resource | Local Path | Tools Path | +|----------|------------|------------| +| Fragments | `.typedialog/ci/fragments/` | `$TOOLS_PATH/dev-system/ci/forms/fragments/` | +| Schemas | `.typedialog/ci/schemas/` | `$TOOLS_PATH/dev-system/ci/schemas/` | +| Validators | `.typedialog/ci/validators/` | `$TOOLS_PATH/dev-system/ci/validators/` | +| Defaults | `.typedialog/ci/defaults/` | `$TOOLS_PATH/dev-system/ci/defaults/` | +| Nickel Template | `.typedialog/ci/config.ncl.j2` | `$TOOLS_PATH/dev-system/ci/templates/config.ncl.j2` | + +### Environment Setup (.envrc) + +The `.typedialog/ci/.envrc` file configures search paths: + +```bash +# Source this file to load environment +source .typedialog/ci/.envrc + +# Or use direnv for automatic loading +echo 'source .typedialog/ci/.envrc' >> .envrc +``` + +**What's in .envrc:** + +```bash +export NICKEL_IMPORT_PATH="schemas:$TOOLS_PATH/dev-system/ci/schemas:validators:..." +export TYPEDIALOG_FRAGMENT_PATH=".:$TOOLS_PATH/dev-system/ci/forms" +export NCL_TEMPLATE="" +export TYPEDIALOG_PORT=9000 # Web server port +export TYPEDIALOG_HOST=localhost # Web server host +export TYPEDIALOG_LANG="${LANG}" # Form localization +``` + +### Creating Overrides + +**By default:** All resources come from Tools (no duplication). + +**To customize:** Create file in local directory with same name: + +```bash +# Override a fragment +cp $TOOLS_PATH/dev-system/ci/fragments/rust-tools.toml \ + .typedialog/ci/fragments/rust-tools.toml + +# Edit your local version +vim .typedialog/ci/fragments/rust-tools.toml + +# Override Nickel template (customize comments, structure, nickel doc output) +cp $TOOLS_PATH/dev-system/ci/templates/config.ncl.j2 \ + .typedialog/ci/config.ncl.j2 + +# Edit to customize documentation and structure +vim .typedialog/ci/config.ncl.j2 + +# Now your version will be used instead of Tools version +``` + +**Benefits:** + +- ✅ Override only what you need +- ✅ Everything else stays synchronized with Tools +- ✅ No duplication by default +- ✅ Automatic updates when Tools is updated + +**See:** `$TOOLS_PATH/dev-system/ci/docs/cascade-override.md` for complete documentation. + +## Testing Your Configuration + +### Validate Configuration + +```bash +nu $env.TOOLS_PATH/dev-system/ci/scripts/validator.nu \ + --config .typedialog/ci/config.ncl \ + --project . \ + --namespace ci +``` + +### Regenerate CI Files + +```bash +nu $env.TOOLS_PATH/dev-system/ci/scripts/generate-configs.nu \ + --config .typedialog/ci/config.ncl \ + --templates $env.TOOLS_PATH/dev-system/ci/templates \ + --output . \ + --namespace ci +``` + +## Common Tasks + +### Add a New Tool + +Edit `config.ncl` and add under `ci.tools`: + +```nickel +{ + ci = { + tools = { + newtool = { + enabled = true, + install_method = "cargo", + version = "latest", + }, + }, + }, +} +``` + +### Disable a Feature + +```toml +[ci.features] +enable_pre_commit = false +``` + +## Need Help? + +For detailed documentation, see: +- $env.TOOLS_PATH/dev-system/ci/docs/configuration-guide.md +- $env.TOOLS_PATH/dev-system/ci/docs/installation-guide.md diff --git a/.typedialog/ci/config.ncl b/.typedialog/ci/config.ncl new file mode 100644 index 0000000..72b2ecf --- /dev/null +++ b/.typedialog/ci/config.ncl @@ -0,0 +1,203 @@ +# CI Configuration - Nickel Format +# Auto-generated by dev-system CI installer +# +# This file is managed by TypeDialog using nickel-roundtrip. +# Edit via: .typedialog/ci/configure.sh +# Or manually edit and validate with: nickel typecheck config.ncl +# +# Documentation: nickel doc config.ncl + +{ + # CI namespace - all configuration lives under 'ci' + ci = { + # Project Information + # Detected languages and primary language for this project + project = { + # Project name + name = "", + # Project description + description = "", + # Project website or documentation site URL + site_url = "", + # Project repository URL (GitHub, GitLab, etc.) + repo_url = "", + # Languages detected in codebase (auto-detected by installer) + detected_languages = [ + "rust", + "markdown", + "nickel" + ], + # Primary language (determines default tooling) + primary_language = "rust", + }, + + # CI Tools Configuration + # Each tool can be enabled/disabled and configured here + tools = { + # Taplo - TOML formatter and linter + taplo = { + enabled = true, + install_method = "cargo", + }, + # YAMLlint - YAML formatter and linter + yamllint = { + enabled = true, + install_method = "pip", + }, + # Clippy - Rust linting tool + clippy = { + enabled = true, + install_method = "cargo", + deny_warnings = true, + }, + # Cargo Audit - Security vulnerability scanner + audit = { + enabled = true, + install_method = "cargo", + }, + # Cargo Deny - Dependency checker + deny = { + enabled = true, + install_method = "cargo", + }, + # Cargo SBOM - Software Bill of Materials + sbom = { + enabled = true, + install_method = "cargo", + }, + # LLVM Coverage - Code coverage tool + llvm-cov = { + enabled = true, + install_method = "cargo", + }, + # Shellcheck - Bash/shell script linter + shellcheck = { + enabled = true, + install_method = "brew", + }, + # Shfmt - Shell script formatter + shfmt = { + enabled = true, + install_method = "brew", + }, + # Markdownlint - Markdown linter + markdownlint = { + enabled = true, + install_method = "npm", + }, + # Vale - Prose linter + vale = { + enabled = true, + install_method = "brew", + }, + # Nickel - Configuration language type checker + nickel = { + enabled = true, + install_method = "brew", + check_all = true, + }, + # NuShell - Shell script validator + nushell = { + enabled = true, + install_method = "builtin", + check_all = true, + }, + # Ruff - Fast Python linter + ruff = { + enabled = true, + install_method = "pip", + }, + # Black - Python code formatter + black = { + enabled = true, + install_method = "pip", + }, + # Mypy - Python static type checker + mypy = { + enabled = false, + install_method = "pip", + }, + # Pytest - Python testing framework + pytest = { + enabled = true, + install_method = "pip", + }, + # Golangci-lint - Go linter aggregator + "golangci-lint" = { + enabled = true, + install_method = "brew", + }, + # Gofmt - Go code formatter + gofmt = { + enabled = true, + install_method = "builtin", + }, + # Staticcheck - Go static analysis + staticcheck = { + enabled = true, + install_method = "brew", + }, + # Gosec - Go security checker + gosec = { + enabled = false, + install_method = "brew", + }, + # ESLint - JavaScript linter + eslint = { + enabled = true, + install_method = "npm", + }, + # Prettier - Code formatter + prettier = { + enabled = true, + install_method = "npm", + }, + # TypeScript - Type checking + typescript = { + enabled = false, + install_method = "npm", + }, + # Jest - JavaScript testing framework + jest = { + enabled = true, + install_method = "npm", + }, + }, + + # CI Features + # High-level feature flags for CI behavior + features = { + enable_ci_cd = true, + enable_pre_commit = true, + generate_taplo_config = true, + generate_contributing = true, + generate_security = true, + generate_code_of_conduct = true, + generate_dockerfiles = true, + enable_cross_compilation = true, + }, + + # CI Provider Configurations + # Settings for GitHub Actions, Woodpecker, GitLab CI, etc. + ci_providers = { + # GitHub Actions + github_actions = { + enabled = true, + branches_push = "main,develop", + branches_pr = "main", + }, + # Woodpecker CI + woodpecker = { + enabled = true, + }, + }, + + # CI Settings + settings = { + parallel_jobs = 1, + job_timeout_minutes = 1, + require_status_checks = true, + run_on_draft_prs = true, + }, + }, +} diff --git a/.typedialog/ci/config.ncl.20260312_005551.bak b/.typedialog/ci/config.ncl.20260312_005551.bak new file mode 100644 index 0000000..72b2ecf --- /dev/null +++ b/.typedialog/ci/config.ncl.20260312_005551.bak @@ -0,0 +1,203 @@ +# CI Configuration - Nickel Format +# Auto-generated by dev-system CI installer +# +# This file is managed by TypeDialog using nickel-roundtrip. +# Edit via: .typedialog/ci/configure.sh +# Or manually edit and validate with: nickel typecheck config.ncl +# +# Documentation: nickel doc config.ncl + +{ + # CI namespace - all configuration lives under 'ci' + ci = { + # Project Information + # Detected languages and primary language for this project + project = { + # Project name + name = "", + # Project description + description = "", + # Project website or documentation site URL + site_url = "", + # Project repository URL (GitHub, GitLab, etc.) + repo_url = "", + # Languages detected in codebase (auto-detected by installer) + detected_languages = [ + "rust", + "markdown", + "nickel" + ], + # Primary language (determines default tooling) + primary_language = "rust", + }, + + # CI Tools Configuration + # Each tool can be enabled/disabled and configured here + tools = { + # Taplo - TOML formatter and linter + taplo = { + enabled = true, + install_method = "cargo", + }, + # YAMLlint - YAML formatter and linter + yamllint = { + enabled = true, + install_method = "pip", + }, + # Clippy - Rust linting tool + clippy = { + enabled = true, + install_method = "cargo", + deny_warnings = true, + }, + # Cargo Audit - Security vulnerability scanner + audit = { + enabled = true, + install_method = "cargo", + }, + # Cargo Deny - Dependency checker + deny = { + enabled = true, + install_method = "cargo", + }, + # Cargo SBOM - Software Bill of Materials + sbom = { + enabled = true, + install_method = "cargo", + }, + # LLVM Coverage - Code coverage tool + llvm-cov = { + enabled = true, + install_method = "cargo", + }, + # Shellcheck - Bash/shell script linter + shellcheck = { + enabled = true, + install_method = "brew", + }, + # Shfmt - Shell script formatter + shfmt = { + enabled = true, + install_method = "brew", + }, + # Markdownlint - Markdown linter + markdownlint = { + enabled = true, + install_method = "npm", + }, + # Vale - Prose linter + vale = { + enabled = true, + install_method = "brew", + }, + # Nickel - Configuration language type checker + nickel = { + enabled = true, + install_method = "brew", + check_all = true, + }, + # NuShell - Shell script validator + nushell = { + enabled = true, + install_method = "builtin", + check_all = true, + }, + # Ruff - Fast Python linter + ruff = { + enabled = true, + install_method = "pip", + }, + # Black - Python code formatter + black = { + enabled = true, + install_method = "pip", + }, + # Mypy - Python static type checker + mypy = { + enabled = false, + install_method = "pip", + }, + # Pytest - Python testing framework + pytest = { + enabled = true, + install_method = "pip", + }, + # Golangci-lint - Go linter aggregator + "golangci-lint" = { + enabled = true, + install_method = "brew", + }, + # Gofmt - Go code formatter + gofmt = { + enabled = true, + install_method = "builtin", + }, + # Staticcheck - Go static analysis + staticcheck = { + enabled = true, + install_method = "brew", + }, + # Gosec - Go security checker + gosec = { + enabled = false, + install_method = "brew", + }, + # ESLint - JavaScript linter + eslint = { + enabled = true, + install_method = "npm", + }, + # Prettier - Code formatter + prettier = { + enabled = true, + install_method = "npm", + }, + # TypeScript - Type checking + typescript = { + enabled = false, + install_method = "npm", + }, + # Jest - JavaScript testing framework + jest = { + enabled = true, + install_method = "npm", + }, + }, + + # CI Features + # High-level feature flags for CI behavior + features = { + enable_ci_cd = true, + enable_pre_commit = true, + generate_taplo_config = true, + generate_contributing = true, + generate_security = true, + generate_code_of_conduct = true, + generate_dockerfiles = true, + enable_cross_compilation = true, + }, + + # CI Provider Configurations + # Settings for GitHub Actions, Woodpecker, GitLab CI, etc. + ci_providers = { + # GitHub Actions + github_actions = { + enabled = true, + branches_push = "main,develop", + branches_pr = "main", + }, + # Woodpecker CI + woodpecker = { + enabled = true, + }, + }, + + # CI Settings + settings = { + parallel_jobs = 1, + job_timeout_minutes = 1, + require_status_checks = true, + run_on_draft_prs = true, + }, + }, +} diff --git a/.typedialog/ci/configure.sh b/.typedialog/ci/configure.sh new file mode 100755 index 0000000..28cf7c8 --- /dev/null +++ b/.typedialog/ci/configure.sh @@ -0,0 +1,116 @@ +#!/usr/bin/env bash +# CI Configuration Script +# Auto-generated by dev-system/ci installer +# +# Interactive configuration for CI tools using TypeDialog. +# Uses Nickel format for configuration files. + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +TYPEDIALOG_CI="${SCRIPT_DIR}" + +# Source envrc to load fragment paths and other environment variables +if [[ -f "${TYPEDIALOG_CI}/envrc" ]]; then + # shellcheck source=/dev/null + source "${TYPEDIALOG_CI}/envrc" +fi + +# Configuration files +FORM_FILE="${TYPEDIALOG_CI}/form.toml" +CONFIG_FILE="${TYPEDIALOG_CI}/config.ncl" + +# NCL_TEMPLATE is set by envrc (cascading: local → Tools) +# If not set, use default from Tools +NCL_TEMPLATE="${NCL_TEMPLATE:-${TOOLS_PATH}/dev-system/ci/templates/config.ncl.j2}" + +# TypeDialog environment variables (can be overridden) +# Port for web backend (default: 9000) +export TYPEDIALOG_PORT="${TYPEDIALOG_PORT:-9000}" + +# Host for web backend (default: localhost) +export TYPEDIALOG_HOST="${TYPEDIALOG_HOST:-localhost}" + +# Locale for form localization (default: system locale) +export TYPEDIALOG_LANG="${TYPEDIALOG_LANG:-${LANG:-en_US.UTF-8}}" + +# Detect which TypeDialog backend to use (default: web) +BACKEND="${1:-web}" + +# Validate backend +case "$BACKEND" in + cli|tui|web) + ;; + *) + echo "Usage: $0 [cli|tui|web]" + echo "" + echo "Launches TypeDialog for interactive CI configuration." + echo "Backend options:" + echo " cli - Command-line interface (simple prompts)" + echo " tui - Terminal UI (interactive panels)" + echo " web - Web server (browser-based) [default]" + exit 1 + ;; +esac + +# Check if form exists +if [[ ! -f "$FORM_FILE" ]]; then + echo "Error: Form file not found: $FORM_FILE" + exit 1 +fi + +# Create backup if config exists +if [[ -f "$CONFIG_FILE" ]]; then + BACKUP="${CONFIG_FILE}.$(date +%Y%m%d_%H%M%S).bak" + cp "$CONFIG_FILE" "$BACKUP" + echo "ℹ️ Backed up existing config to: $(basename "$BACKUP")" +fi + +# Launch TypeDialog with Nickel roundtrip (preserves Nickel format) +echo "🔧 Launching TypeDialog ($BACKEND backend)..." +echo "" + +# Show web server info if using web backend +if [[ "$BACKEND" == "web" ]]; then + echo "🌐 Web server will start on: http://${TYPEDIALOG_HOST}:${TYPEDIALOG_PORT}" + echo " (Override with: TYPEDIALOG_PORT=8080 TYPEDIALOG_HOST=0.0.0.0 $0)" + echo "" +fi + +# Build nickel-roundtrip command with optional template +NCL_TEMPLATE_ARG="" +if [[ -f "$NCL_TEMPLATE" ]]; then + NCL_TEMPLATE_ARG="--ncl-template $NCL_TEMPLATE" + echo "ℹ️ Using Nickel template: $NCL_TEMPLATE" +fi + +case "$BACKEND" in + cli) + typedialog nickel-roundtrip "$CONFIG_FILE" "$FORM_FILE" --output "$CONFIG_FILE" $NCL_TEMPLATE_ARG + ;; + tui) + typedialog-tui nickel-roundtrip "$CONFIG_FILE" "$FORM_FILE" --output "$CONFIG_FILE" $NCL_TEMPLATE_ARG + ;; + web) + typedialog-web nickel-roundtrip "$CONFIG_FILE" "$FORM_FILE" --output "$CONFIG_FILE" $NCL_TEMPLATE_ARG + ;; +esac + +EXIT_CODE=$? + +if [[ $EXIT_CODE -eq 0 ]]; then + echo "" + echo "✅ Configuration saved to: $CONFIG_FILE" + echo "" + echo "Next steps:" + echo " - Review the configuration: cat $CONFIG_FILE" + echo " - Apply CI tools: (run your CI setup command)" + echo " - Re-run this script anytime to update: $0" +else + echo "" + echo "❌ Configuration cancelled or failed (exit code: $EXIT_CODE)" + if [[ -f "${CONFIG_FILE}.bak" ]]; then + echo " Previous config restored from backup" + fi + exit $EXIT_CODE +fi diff --git a/.typedialog/ci/envrc b/.typedialog/ci/envrc new file mode 100644 index 0000000..4c00a1b --- /dev/null +++ b/.typedialog/ci/envrc @@ -0,0 +1,27 @@ +# Auto-generated by dev-system/ci +# +# Cascading Path Strategy: +# 1. Local files in .typedialog/ci/ take precedence (overrides) +# 2. Central files in $TOOLS_PATH/dev-system/ci/ as fallback (defaults) +# +# To customize: Create file in .typedialog/ci/{schemas,validators,defaults,fragments}/ +# Your local version will be used instead of the Tools version. + +# Nickel import paths (cascading: local → Tools) +export NICKEL_IMPORT_PATH="schemas:$TOOLS_PATH/dev-system/ci/schemas:validators:$TOOLS_PATH/dev-system/ci/validators:defaults:$TOOLS_PATH/dev-system/ci/defaults" + +# TypeDialog fragment search paths (cascading: local → Tools) +export TYPEDIALOG_FRAGMENT_PATH=".typedialog/ci:$TOOLS_PATH/dev-system/ci/forms" + +# Nickel template for config.ncl generation (with cascading) +# Local template takes precedence if exists +if [[ -f ".typedialog/ci/config.ncl.j2" ]]; then + export NCL_TEMPLATE=".typedialog/ci/config.ncl.j2" +else + export NCL_TEMPLATE="$TOOLS_PATH/dev-system/ci/templates/config.ncl.j2" +fi + +# TypeDialog web backend configuration (override if needed) +export TYPEDIALOG_PORT=${TYPEDIALOG_PORT:-9000} +export TYPEDIALOG_HOST=${TYPEDIALOG_HOST:-localhost} +export TYPEDIALOG_LANG=${TYPEDIALOG_LANG:-${LANG:-en_US.UTF-8}} diff --git a/.typedialog/ci/form.toml b/.typedialog/ci/form.toml new file mode 100644 index 0000000..f03221f --- /dev/null +++ b/.typedialog/ci/form.toml @@ -0,0 +1,231 @@ +description = "Interactive configuration for continuous integration and code quality tools" +display_mode = "complete" +locales_path = "" +name = "CI Configuration Form" + +[[elements]] +border_bottom = true +border_top = true +name = "project_header" +title = "📦 Project Information" +type = "section_header" + +[[elements]] +help = "Name of the project" +name = "project_name" +nickel_path = [ + "ci", + "project", + "name", +] +placeholder = "my-project" +prompt = "Project name" +required = true +type = "text" + +[[elements]] +help = "Optional description" +name = "project_description" +nickel_path = [ + "ci", + "project", + "description", +] +placeholder = "Brief description of what this project does" +prompt = "Project description" +required = false +type = "text" + +[[elements]] +default = "" +help = "Project website or documentation site URL" +name = "project_site_url" +nickel_path = [ + "ci", + "project", + "site_url", +] +placeholder = "https://example.com" +prompt = "Project Site URL" +required = false +type = "text" + +[[elements]] +default = "" +help = "Project repository URL (GitHub, GitLab, etc.)" +name = "project_repo_url" +nickel_path = [ + "ci", + "project", + "repo_url", +] +placeholder = "https://github.com/user/repo" +prompt = "Project Repo URL" +required = false +type = "text" + +[[elements]] +border_bottom = true +border_top = true +name = "languages_header" +title = "🔍 Detected Languages" +type = "section_header" + +[[elements]] +default = "rust" +display_mode = "grid" +help = "Select all languages detected or used in the project" +min_selected = 1 +name = "detected_languages" +nickel_path = [ + "ci", + "project", + "detected_languages", +] +prompt = "Which languages are used in this project?" +required = true +searchable = true +type = "multiselect" + +[[elements.options]] +value = "rust" +label = "🦀 Rust" + +[[elements.options]] +value = "nushell" +label = "🐚 NuShell" + +[[elements.options]] +value = "nickel" +label = "⚙️ Nickel" + +[[elements.options]] +value = "bash" +label = "🔧 Bash/Shell" + +[[elements.options]] +value = "markdown" +label = "📝 Markdown/Documentation" + +[[elements]] +help = "Main language used for defaults (e.g., in GitHub Actions workflows)" +name = "primary_language" +nickel_path = [ + "ci", + "project", + "primary_language", +] +options_from = "detected_languages" +prompt = "Primary language" +required = true +type = "select" +default = "rust" + +[[elements.options]] +value = "rust" +label = "🦀 Rust" + +[[elements.options]] +value = "nushell" +label = "🐚 NuShell" + +[[elements.options]] +value = "nickel" +label = "⚙️ Nickel" + +[[elements.options]] +value = "bash" +label = "🔧 Bash" + +[[elements.options]] +value = "markdown" +label = "📝 Markdown" + +[[elements]] +includes = ["fragments/rust-tools.toml"] +name = "rust_tools_group" +type = "group" +when = "rust in detected_languages" + +[[elements]] +includes = ["fragments/nushell-tools.toml"] +name = "nushell_tools_group" +type = "group" +when = "nushell in detected_languages" + +[[elements]] +includes = ["fragments/nickel-tools.toml"] +name = "nickel_tools_group" +type = "group" +when = "nickel in detected_languages" + +[[elements]] +includes = ["fragments/bash-tools.toml"] +name = "bash_tools_group" +type = "group" +when = "bash in detected_languages" + +[[elements]] +includes = ["fragments/markdown-tools.toml"] +name = "markdown_tools_group" +type = "group" +when = "markdown in detected_languages" + +[[elements]] +includes = ["fragments/general-tools.toml"] +name = "general_tools_group" +type = "group" + +[[elements]] +border_bottom = true +border_top = true +name = "ci_cd_header" +title = "🔄 CI/CD Configuration" +type = "section_header" + +[[elements]] +default = "true" +help = "Set up continuous integration and deployment pipelines" +name = "enable_ci_cd" +nickel_path = [ + "ci", + "features", + "enable_ci_cd", +] +prompt = "Enable CI/CD integration?" +type = "confirm" + +[[elements]] +includes = ["fragments/ci-providers.toml"] +name = "ci_providers_group" +type = "group" +when = "enable_ci_cd == true" + +[[elements]] +includes = ["fragments/ci-settings.toml"] +name = "ci_settings_group" +type = "group" +when = "enable_ci_cd == true" + +[[elements]] +includes = ["fragments/build-deployment.toml"] +name = "build_deployment_group" +type = "group" +when = "enable_ci_cd == true" + +[[elements]] +includes = ["fragments/documentation.toml"] +name = "documentation_group" +type = "group" + +[[elements]] +border_bottom = true +border_top = true +name = "confirmation_header" +title = "✅ Ready to Install" +type = "section_header" + +[[elements]] +content = "Review your configuration above. After confirming, the CI system will be installed with your chosen settings." +name = "confirmation_footer" +type = "footer" diff --git a/justfiles/ci.just b/justfiles/ci.just new file mode 100644 index 0000000..575e2f5 --- /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 diff --git a/justfiles/rust-axum b/justfiles/rust-axum new file mode 120000 index 0000000..92dcf27 --- /dev/null +++ b/justfiles/rust-axum @@ -0,0 +1 @@ +/Users/Akasha/Tools/dev-system/languages/rust/just-modules/axum \ No newline at end of file diff --git a/justfiles/rust-cargo b/justfiles/rust-cargo new file mode 120000 index 0000000..3d031bf --- /dev/null +++ b/justfiles/rust-cargo @@ -0,0 +1 @@ +/Users/Akasha/Tools/dev-system/languages/rust/just-modules/cargo \ No newline at end of file diff --git a/justfiles/rust-leptos b/justfiles/rust-leptos new file mode 120000 index 0000000..29df629 --- /dev/null +++ b/justfiles/rust-leptos @@ -0,0 +1 @@ +/Users/Akasha/Tools/dev-system/languages/rust/just-modules/leptos \ No newline at end of file