# ggen Documentation Project Configuration

[project]
name = "ggen"
version = "4.0.0"
description = "RDF-based code generation toolkit with comprehensive documentation"
authors = ["Sean Chatman <sean@ggen.ai>"]
license = "MIT"
repository = "https://github.com/seanchatmangpt/ggen"

# AI configuration for documentation generation
[ai]
provider = "anthropic"
model = "claude-3-opus-20240229"
temperature = 0.5
max_tokens = 8000
timeout = 120

# Template configuration
[templates]
directory = "templates"
output_directory = "generated"
backup_enabled = true
idempotent = true

# RDF configuration for ontology-driven development
[rdf]
base_uri = "https://ggen.dev/"
default_format = "turtle"
cache_queries = true
store_path = ".ggen/rdf-store"

[rdf.prefixes]
ggen = "https://ggen.dev/"
schema = "https://schema.org/"
rdfs = "http://www.w3.org/2000/01/rdf-schema#"
owl = "http://www.w3.org/2002/07/owl#"
xsd = "http://www.w3.org/2001/XMLSchema#"

# SPARQL query configuration
[sparql]
timeout = 60
max_results = 5000
cache_enabled = true
cache_ttl = 7200

# Lifecycle hooks for documentation validation
[lifecycle]
enabled = true
config_file = ".ggen/lifecycle.toml"
cache_directory = ".ggen/cache"
state_file = ".ggen/state.json"

# Pre-generation: validate documentation structure
[lifecycle.phases.pre_generate]
scripts = [
    "scripts/validate-docs/validate-all.sh"
]

# Post-generation: format and validate
[lifecycle.phases.post_generate]
scripts = [
    "scripts/format-docs.sh"
]

# Security configuration
[security]
allowed_domains = [
    "schema.org",
    "w3.org",
    "ggen.dev",
    "github.com"
]
max_file_size = 104857600  # 100MB
validate_ssl = true

# Performance optimization
[performance]
parallel_generation = true
max_workers = 8
cache_templates = true
incremental_build = true

# Logging configuration
[logging]
level = "info"
format = "pretty"
output = "stderr"

# Development environment
[env.development]
"ai.model" = "claude-3-haiku-20240307"  # Faster, cheaper
"ai.temperature" = 0.9  # More creative for exploration
"logging.level" = "debug"
"performance.max_workers" = 4

# CI environment
[env.ci]
"ai.provider" = "ollama"  # Local, no API costs
"ai.model" = "llama2"
"ai.base_url" = "http://localhost:11434"
"logging.level" = "warn"
"logging.format" = "json"

# Production environment
[env.production]
"ai.temperature" = 0.3  # Deterministic
"logging.level" = "warn"
"logging.format" = "json"
"performance.max_workers" = 16
"sparql.cache_ttl" = 86400  # 24 hours

# ============================================================================
# Marketplace Configuration
# Controls behavior when interacting with the ggen marketplace
# ============================================================================
[marketplace]
# Registry URL for package discovery
registry_url = "https://marketplace.ggen.dev"

# Cache downloaded packages locally
cache_packages = true

# Verify package signatures before installation
verify_signatures = true

# ============================================================================
# Generation Configuration (Path Protection & Poka-Yoke)
# Prevents accidental overwrites of domain logic during code generation
# ============================================================================
[generation]
# Enable generation safety checks
enabled = true

# Protected paths (glob patterns) - NEVER overwrite
# These contain domain logic implemented by developers
protected_paths = [
    "src/domain/**",
    "crates/*/src/domain/**",
    "**/src/main.rs",
]

# Regeneratable paths (glob patterns) - safe to overwrite
# These contain generated scaffolding from templates
regenerate_paths = [
    "src/generated/**",
    "crates/*/src/generated/**",
]

# Header to inject into generated files
generated_header = """
// ============================================================
// DO NOT EDIT THIS FILE
//
// This file is auto-generated by ggen from RDF ontology.
// Any manual changes will be OVERWRITTEN on regeneration.
//
// Regenerate with: ggen generate
// ============================================================
"""

# Require confirmation before overwriting any file
require_confirmation = false

# Create backup before overwriting
backup_before_write = true

# Poka-yoke (error-proofing) controls
[generation.poka_yoke]
# Add warning headers to generated files
warning_headers = true
# Add generated files to .gitignore
gitignore_generated = false
# Add generated files to .gitattributes (linguist-generated)
gitattributes_generated = true
# Validate imports don't cross boundaries
validate_imports = false

# ============================================================================
# CODEOWNERS Configuration
# Aggregates team ownership from distributed OWNERS files
# ============================================================================
[codeowners]
# Enable CODEOWNERS generation
enabled = true

# Source directories to scan for OWNERS files
source_dirs = ["ontology", "ontologies"]

# Base directories to generate entries for
base_dirs = [
    "ontology",
    "ontologies",
    "src/generated",
    "src/domain",
    "crates/*/src/generated",
    "crates/*/src/domain",
]

# Output path (defaults to .github/CODEOWNERS)
output_path = ".github/CODEOWNERS"

# Auto-regenerate on noun changes
auto_regenerate = false
