{
    "sourceFile": "tests/integration/test_cli_generator_workspace.rs",
    "activeCommit": 0,
    "commits": [
        {
            "activePatchIndex": 0,
            "patches": [
                {
                    "date": 1762978965517,
                    "content": "Index: \n===================================================================\n--- \n+++ \n"
                }
            ],
            "date": 1762978965517,
            "name": "Commit-0",
            "content": "//! Integration tests for CLI generator with workspace pattern\n//!\n//! Tests the full pipeline:\n//! 1. Parse RDF/TTL file\n//! 2. Generate workspace structure (crates/{cli-crate}, crates/{domain-crate})\n//! 3. Generate CLI layer with clap-noun-verb v3.3.0\n//! 4. Generate domain layer\n//! 5. Verify workspace structure\n//! 6. Verify CLI-to-domain contract\n\nuse anyhow::Result;\nuse assert_fs::prelude::*;\nuse assert_fs::TempDir;\nuse std::fs;\nuse std::path::Path;\n\n#[test]\nfn test_generate_workspace_structure() -> Result<()> {\n    let temp_dir = TempDir::new()?;\n    let output_dir = temp_dir.path().join(\"generated-cli\");\n    \n    // Create template directory with new templates\n    let template_dir = temp_dir.path().join(\"templates\");\n    fs::create_dir_all(&template_dir)?;\n    \n    // Copy workspace template\n    let workspace_templates_dir = Path::new(\"templates/cli/workspace\");\n    if workspace_templates_dir.exists() {\n        // Test with actual templates\n        let generator = ggen_ai::rdf::CliGenerator::new(Path::new(\"templates\").to_path_buf());\n        \n        // Create a minimal TTL file for testing\n        let ttl_content = r#\"\n@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n@prefix cli: <http://ggen.dev/schema/cli#> .\n@prefix cnv: <http://ggen.dev/schema/clap-noun-verb#> .\n\n<#test-project> a cli:CliProject ;\n    cli:name \"test-cli\" ;\n    cli:version \"0.1.0\" ;\n    cli:description \"Test CLI project\" ;\n    cli:edition \"2021\" ;\n    cli:license \"MIT\" ;\n    cli:hasCliCrate \"test-cli\" ;\n    cli:hasDomainCrate \"test-core\" ;\n    cli:hasWorkspaceResolver \"2\" .\n\n<#user> a cnv:Noun ;\n    cnv:name \"user\" ;\n    cnv:description \"User management\" ;\n    cnv:hasVerb <#create-user> .\n\n<#create-user> a cnv:Verb ;\n    cnv:name \"create\" ;\n    cnv:description \"Create a new user\" ;\n    cnv:domainFunction \"test_core::user::create\" .\n\"#;\n        \n        let ttl_file = temp_dir.path().join(\"test.ttl\");\n        fs::write(&ttl_file, ttl_content)?;\n        \n        // Generate CLI project\n        generator.generate_from_ttl(&ttl_file, &output_dir)?;\n        \n        // Verify workspace structure exists\n        assert!(output_dir.join(\"Cargo.toml\").exists(), \"Workspace Cargo.toml should exist\");\n        assert!(output_dir.join(\"crates\").exists(), \"crates/ directory should exist\");\n        assert!(output_dir.join(\"crates/test-cli\").exists(), \"CLI crate directory should exist\");\n        assert!(output_dir.join(\"crates/test-core\").exists(), \"Domain crate directory should exist\");\n        \n        // Verify workspace Cargo.toml has correct members\n        let workspace_cargo = fs::read_to_string(output_dir.join(\"Cargo.toml\"))?;\n        assert!(workspace_cargo.contains(\"crates/test-cli\"), \"Should include CLI crate in members\");\n        assert!(workspace_cargo.contains(\"crates/test-core\"), \"Should include domain crate in members\");\n        assert!(workspace_cargo.contains(\"clap-noun-verb = \\\"3.4.0\\\"\"), \"Should use clap-noun-verb v3.4.0\");\n        \n        // Verify CLI crate structure\n        let cli_crate_dir = output_dir.join(\"crates/test-cli\");\n        assert!(cli_crate_dir.join(\"Cargo.toml\").exists(), \"CLI crate Cargo.toml should exist\");\n        assert!(cli_crate_dir.join(\"src/main.rs\").exists(), \"CLI main.rs should exist\");\n        assert!(cli_crate_dir.join(\"src/lib.rs\").exists(), \"CLI lib.rs should exist\");\n        assert!(cli_crate_dir.join(\"src/runtime.rs\").exists(), \"CLI runtime.rs should exist\");\n        assert!(cli_crate_dir.join(\"src/cmds\").exists(), \"CLI cmds/ directory should exist\");\n        \n        // Verify domain crate structure\n        let domain_crate_dir = output_dir.join(\"crates/test-core\");\n        assert!(domain_crate_dir.join(\"Cargo.toml\").exists(), \"Domain crate Cargo.toml should exist\");\n        assert!(domain_crate_dir.join(\"src/lib.rs\").exists(), \"Domain lib.rs should exist\");\n        assert!(domain_crate_dir.join(\"src/user\").exists(), \"Domain user module should exist\");\n        \n        Ok(())\n    } else {\n        // Skip test if templates don't exist (e.g., in CI without templates)\n        eprintln!(\"Warning: templates/cli/workspace not found, skipping test\");\n        Ok(())\n    }\n}\n\n#[test]\nfn test_cli_to_domain_contract() -> Result<()> {\n    let temp_dir = TempDir::new()?;\n    let output_dir = temp_dir.path().join(\"generated-cli\");\n    \n    let workspace_templates_dir = Path::new(\"templates/cli/workspace\");\n    if workspace_templates_dir.exists() {\n        let generator = ggen_ai::rdf::CliGenerator::new(Path::new(\"templates\").to_path_buf());\n        \n        let ttl_content = r#\"\n@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n@prefix cli: <http://ggen.dev/schema/cli#> .\n@prefix cnv: <http://ggen.dev/schema/clap-noun-verb#> .\n\n<#test-project> a cli:CliProject ;\n    cli:name \"test-cli\" ;\n    cli:version \"0.1.0\" ;\n    cli:description \"Test CLI project\" ;\n    cli:edition \"2021\" ;\n    cli:license \"MIT\" ;\n    cli:hasCliCrate \"test-cli\" ;\n    cli:hasDomainCrate \"test-core\" .\n\n<#user> a cnv:Noun ;\n    cnv:name \"user\" ;\n    cnv:description \"User management\" ;\n    cnv:hasVerb <#create-user> .\n\n<#create-user> a cnv:Verb ;\n    cnv:name \"create\" ;\n    cnv:description \"Create a new user\" ;\n    cnv:domainFunction \"test_core::user::create\" .\n\"#;\n        \n        let ttl_file = temp_dir.path().join(\"test.ttl\");\n        fs::write(&ttl_file, ttl_content)?;\n        \n        generator.generate_from_ttl(&ttl_file, &output_dir)?;\n        \n        // Verify CLI crate references domain crate\n        let cli_cargo = fs::read_to_string(output_dir.join(\"crates/test-cli/Cargo.toml\"))?;\n        assert!(cli_cargo.contains(\"test-core\"), \"CLI crate should depend on domain crate\");\n        \n        // Verify CLI verb calls domain function\n        let verb_file = output_dir.join(\"crates/test-cli/src/cmds/user/create.rs\");\n        if verb_file.exists() {\n            let verb_content = fs::read_to_string(&verb_file)?;\n            assert!(verb_content.contains(\"test_core\"), \"Verb should reference domain crate\");\n            assert!(verb_content.contains(\"user::create\"), \"Verb should reference domain function\");\n        }\n        \n        // Verify domain crate has no CLI dependencies\n        let domain_cargo = fs::read_to_string(output_dir.join(\"crates/test-core/Cargo.toml\"))?;\n        assert!(!domain_cargo.contains(\"clap\"), \"Domain crate should not depend on clap\");\n        assert!(!domain_cargo.contains(\"clap-noun-verb\"), \"Domain crate should not depend on clap-noun-verb\");\n        \n        Ok(())\n    } else {\n        eprintln!(\"Warning: templates/cli/workspace not found, skipping test\");\n        Ok(())\n    }\n}\n\n"
        }
    ]
}