# clap-noun-verb Marketplace Package
# Enterprise-grade CLI generation with FMEA controls and Poka-Yoke patterns

[package]
name = "clap-noun-verb"
full_name = "clap-noun-verb Enterprise CLI Framework"
version = "5.3.2"
description = "Generate production-grade Rust CLIs from RDF with domain logic protection"
category = "framework"
author = "seanchatmangpt"
repository = "https://github.com/seanchatmangpt/clap-noun-verb"
path = "marketplace/packages/clap-noun-verb"
license = "MIT OR Apache-2.0"
production = true
maturity = 90

dependencies = []

[enterprise]
fortune_500_ready = true
fmea_controls = true
poka_yoke_enabled = true
domain_protection = "trait-boundary"
max_commands_tested = 200
team_ownership_model = "codeowners"

features = [
    # Enterprise Patterns
    "Trait-based domain protection (regenerate-safe)",
    "One-file-per-verb (zero merge conflicts)",
    "CODEOWNERS integration (team boundaries)",
    "FMEA-driven error controls",
    "Poka-Yoke guardrails",
    "200+ command scale tested",
    # Architecture
    "Three-layer architecture (CLI → Integration → Domain)",
    "Generated output types from RDF schema",
    "Automatic telemetry injection hooks",
    "Feature flag integration points",
    # Technical
    "Type-safe #[noun] and #[verb] macros",
    "Compile-time command validation",
    "Zero-cost abstractions (generics + macros)",
    "JSON-first structured output",
    "Agent-ready (MCP compatible)",
    "SPARQL-based extraction from ontologies",
]

tags = ["cli", "framework", "code-generation", "rust", "enterprise", "fortune-500"]
keywords = ["cli", "clap", "noun-verb", "rdf", "code-generation", "rust", "sparql", "fmea", "poka-yoke"]

[install]
type = "template"
template_path = "marketplace/packages/clap-noun-verb"

[files]
# Templates (two-phase generation)
"templates/generated-traits.tmpl" = "Phase 1: Generated traits + types (regenerate freely)"
"templates/domain-impl.tmpl" = "Phase 2: Domain stub (generated ONCE, never overwritten)"
"templates/main.tmpl" = "Entry point (generated ONCE)"
"templates/cargo.toml.tmpl" = "Project manifest (generated ONCE)"

# Enterprise example
"examples/enterprise-ops/ontology/" = "Multi-team CLI with 5 nouns"

# Documentation
"README.md" = "Package overview"
"USAGE.md" = "Enterprise usage guide with FMEA/Poka-Yoke"

[variables]
project_name = { type = "string", required = true, description = "CLI project name (e.g., 'acme-cli')" }
domain_rdf = { type = "string", required = true, description = "Path to the RDF/TTL file describing the CLI structure" }
clap_noun_verb_version = { type = "string", default = "5.3", description = "clap-noun-verb crate version" }
telemetry_enabled = { type = "bool", default = true, description = "Inject OpenTelemetry hooks" }
feature_flags_enabled = { type = "bool", default = true, description = "Generate feature flag integration points" }

[generation]
# Domain protection: these paths are generated ONCE, never overwritten
protected_paths = [
    "src/domain/",
    "src/infrastructure/",
    "src/main.rs",
    "Cargo.toml",
]

# Regeneration targets: can be blown away and regenerated freely
regenerate_paths = [
    "src/generated/",
]

# Validation before generation
pre_generate = [
    "ggen ontology validate {{ domain_rdf }}",
]

# Compile check after generation
post_generate = [
    "cargo check",
]

[poka_yoke]
# File header warning (Information Control - FMEA F1)
generated_file_header = """
// ⚠️ DO NOT EDIT - Generated by ggen from {{ domain_rdf }}
// Regenerate with: ggen generate --domain {{ domain_rdf }}
//
// Your changes WILL BE LOST on next regeneration.
// Implement business logic in src/domain/ instead.
"""

# CI validation checks
ci_checks = [
    "unique_noun_names",       # No duplicate nouns across ontology/
    "trait_impl_required",     # Every generated trait must have domain impl
    "no_unimplemented_prod",   # unimplemented!() blocked outside #[cfg(test)]
    "coverage_80_percent",     # 80% test coverage on domain/
    "changelog_on_breaking",   # Breaking changes require CHANGELOG entry
]

# Git controls (Physical Controls)
gitignore_patterns = [
    "src/generated/",          # Never commit generated code
]

[fmea]
# Controls for high-RPN failure modes (Risk Priority Number = Severity × Occurrence × Detection)
# RPN = S × O × D, where each is 1-10 scale
controls = [
    { id = "F1", mode = "Edit generated file", severity = 8, occurrence = 6, detection = 5, control = "File header warning + gitignore" },
    { id = "F2", mode = "Overwrite domain logic", severity = 10, occurrence = 4, detection = 4, control = "Trait boundary - domain in separate files" },
    { id = "F5", mode = "Missing error handling", severity = 8, occurrence = 6, detection = 5, control = "Trait requires Result<T> return type" },
    { id = "F8", mode = "Test pass, prod fail", severity = 9, occurrence = 7, detection = 4, control = "Feature flags + canary hooks" },
    { id = "F9", mode = "Merge conflict in ontology", severity = 5, occurrence = 4, detection = 4, control = "One file per verb pattern" },
]

[examples]
basic = """
# 1. Generate initial project (creates protected files ONCE)
ggen generate \\
  --template clap-noun-verb/templates/main.tmpl \\
  --domain ontology/cli.ttl \\
  --output ./my-cli/ \\
  --var project_name=my-cli

# 2. Regenerate traits after ontology changes (safe - domain untouched)
ggen generate \\
  --template clap-noun-verb/templates/generated-traits.tmpl \\
  --domain ontology/cli.ttl \\
  --output ./my-cli/src/generated/ \\
  --force
"""

enterprise = """
# Enterprise workflow: Adding a new command

# 1. Create verb definition (new file = no merge conflict)
cat > ontology/user/verbs/suspend.ttl << 'EOF'
@prefix cnv: <https://ggen.dev/clap-noun-verb/> .
user:suspend a cnv:Verb ;
    cnv:verbName "suspend" ;
    cnv:hasArguments user:suspend_id, user:suspend_reason .
EOF

# 2. Regenerate generated/ (domain untouched)
ggen generate --domain ontology/cli.ttl --output src/generated/ --force

# 3. Implement domain logic (new file = no merge conflict)
# src/domain/user/suspend.rs - implement UserCommands::suspend()

# 4. Commit (3 new files, 0 modified = zero conflicts)
git add ontology/user/verbs/suspend.ttl src/domain/user/suspend.rs
"""

[docs]
quick_start = "1. Define CLI in RDF, 2. Generate skeleton, 3. Implement domain logic (protected)"
enterprise_scale = "Tested with 50+ developers, 200+ commands, 35 nouns across 8 teams"
domain_protection = "Trait boundary ensures regeneration NEVER touches business logic"
team_ownership = "CODEOWNERS per noun directory prevents cross-team conflicts"
fmea_reference = "See docs/enterprise/CLAP_NOUN_VERB_ENTERPRISE_ARCHITECTURE.md"

[validation]
requires = ["project_name", "domain_rdf"]
formats_supported = ["ttl", "rdf", "turtle"]
