File size: 8,746 Bytes
931572e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# Master build script for SNAPKITTYWEST sovereign compute stack (PowerShell)
# Builds all components: Haskell, C++, C#, OCaml

$ErrorActionPreference = "Continue"

Write-Host "============================================" -ForegroundColor Cyan
Write-Host "SNAPKITTYWEST Sovereign Compute Stack Build" -ForegroundColor Cyan
Write-Host "============================================" -ForegroundColor Cyan
Write-Host ""

# Track results
$HaskellOk = $false
$CppOk = $false
$CsharpOk = $false
$OcamlOk = $false

# ════════════════════════════════════════════════════════════════
# Phase 1: Haskell Datalog Engine
# ════════════════════════════════════════════════════════════════
Write-Host "Phase 1: Haskell Datalog Engine" -ForegroundColor Yellow
Write-Host "--------------------------------"

if (Get-Command ghc -ErrorAction SilentlyContinue) {
    Write-Host "  GHC found: $(ghc --version)"
    
    if (Get-Command cabal -ErrorAction SilentlyContinue) {
        Write-Host "  Building Haskell Datalog Engine..."
        Push-Location errant/datalog
        
        if (cabal build 2>&1) {
            Write-Host "  βœ“ Haskell Datalog Engine built successfully" -ForegroundColor Green
            $HaskellOk = $true
        } else {
            Write-Host "  βœ— Haskell Datalog Engine build failed" -ForegroundColor Red
        }
        
        Pop-Location
    } else {
        Write-Host "  βœ— cabal not found" -ForegroundColor Red
    }
} else {
    Write-Host "  βœ— GHC not found (Haskell build skipped)" -ForegroundColor Yellow
}
Write-Host ""

# ════════════════════════════════════════════════════════════════
# Phase 2: C++ Modules
# ════════════════════════════════════════════════════════════════
Write-Host "Phase 2: C++ Modules" -ForegroundColor Yellow
Write-Host "--------------------"

if (Get-Command cmake -ErrorAction SilentlyContinue) {
    Write-Host "  CMake found: $(cmake --version | Select-Object -First 1)"
    
    Write-Host "  Building C++ modules..."
    Push-Location sovereign-utqc/cpp
    
    if (cmake -S . -B build) {
        if (cmake --build build) {
            Write-Host "  βœ“ C++ modules built successfully" -ForegroundColor Green
            $CppOk = $true
        } else {
            Write-Host "  βœ— C++ modules build failed" -ForegroundColor Red
        }
    } else {
        Write-Host "  βœ— CMake configuration failed" -ForegroundColor Red
    }
    
    Pop-Location
} else {
    Write-Host "  βœ— CMake not found (C++ build skipped)" -ForegroundColor Yellow
}
Write-Host ""

# ════════════════════════════════════════════════════════════════
# Phase 3: C# AGT
# ════════════════════════════════════════════════════════════════
Write-Host "Phase 3: C# AGT" -ForegroundColor Yellow
Write-Host "----------------"

if (Get-Command dotnet -ErrorAction SilentlyContinue) {
    Write-Host "  .NET found: $(dotnet --version)"
    
    Write-Host "  Building C# AGT..."
    Push-Location sovereign-utqc/csharp
    
    if (dotnet build SnapKitty.AGT.slnx --configuration Release 2>&1) {
        Write-Host "  βœ“ C# AGT built successfully" -ForegroundColor Green
        
        Write-Host "  Running tests..."
        if (dotnet test SnapKitty.AGT.slnx --configuration Release --no-build 2>&1) {
            Write-Host "  βœ“ C# AGT tests passed" -ForegroundColor Green
            $CsharpOk = $true
        } else {
            Write-Host "  βœ— C# AGT tests failed" -ForegroundColor Red
        }
    } else {
        Write-Host "  βœ— C# AGT build failed" -ForegroundColor Red
    }
    
    Pop-Location
} else {
    Write-Host "  βœ— .NET not found (C# build skipped)" -ForegroundColor Yellow
}
Write-Host ""

# ════════════════════════════════════════════════════════════════
# Phase 4: OCaml snap-prism
# ════════════════════════════════════════════════════════════════
Write-Host "Phase 4: OCaml snap-prism" -ForegroundColor Yellow
Write-Host "-------------------------"

if (Get-Command dune -ErrorAction SilentlyContinue) {
    Write-Host "  dune found: $(dune --version)"
    
    Write-Host "  Building OCaml snap-prism..."
    Push-Location sovereign-utqc/snap-prism-ocaml
    
    if (dune build 2>&1) {
        Write-Host "  βœ“ OCaml snap-prism built successfully" -ForegroundColor Green
        
        Write-Host "  Running tests..."
        if (dune runtest 2>&1) {
            Write-Host "  βœ“ OCaml snap-prism tests passed" -ForegroundColor Green
            $OcamlOk = $true
        } else {
            Write-Host "  βœ— OCaml snap-prism tests failed" -ForegroundColor Red
        }
    } else {
        Write-Host "  βœ— OCaml snap-prism build failed" -ForegroundColor Red
    }
    
    Pop-Location
} else {
    Write-Host "  βœ— dune not found (OCaml build skipped)" -ForegroundColor Yellow
}
Write-Host ""

# ════════════════════════════════════════════════════════════════
# Phase 5: Rust Workspaces
# ════════════════════════════════════════════════════════════════
Write-Host "Phase 5: Rust Workspaces" -ForegroundColor Yellow
Write-Host "------------------------"

if (Get-Command cargo -ErrorAction SilentlyContinue) {
    Write-Host "  Cargo found: $(cargo --version)"
    
    Write-Host "  Building sovereign-utqc..."
    if (cargo test --manifest-path sovereign-utqc/Cargo.toml --workspace 2>&1) {
        Write-Host "  βœ“ sovereign-utqc tests passed" -ForegroundColor Green
    } else {
        Write-Host "  βœ— sovereign-utqc tests failed" -ForegroundColor Red
    }
    
    Write-Host "  Building sovereign-llm..."
    if (cargo test --manifest-path sovereign-llm/Cargo.toml --workspace 2>&1) {
        Write-Host "  βœ“ sovereign-llm tests passed" -ForegroundColor Green
    } else {
        Write-Host "  βœ— sovereign-llm tests failed" -ForegroundColor Red
    }
} else {
    Write-Host "  βœ— Cargo not found (Rust build skipped)" -ForegroundColor Yellow
}
Write-Host ""

# ════════════════════════════════════════════════════════════════
# Summary
# ════════════════════════════════════════════════════════════════
Write-Host "============================================" -ForegroundColor Cyan
Write-Host "Build Summary" -ForegroundColor Cyan
Write-Host "============================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "  Haskell Datalog: $(if ($HaskellOk) { 'βœ“ PASS' } else { 'βœ— FAIL' })"
Write-Host "  C++ Modules:     $(if ($CppOk) { 'βœ“ PASS' } else { 'βœ— FAIL' })"
Write-Host "  C# AGT:          $(if ($CsharpOk) { 'βœ“ PASS' } else { 'βœ— FAIL' })"
Write-Host "  OCaml snap-prism: $(if ($OcamlOk) { 'βœ“ PASS' } else { 'βœ— FAIL' })"
Write-Host ""

# Calculate total
$Total = @($HaskellOk, $CppOk, $CsharpOk, $OcamlOk) | Where-Object { $_ } | Measure-Object | Select-Object -ExpandProperty Count
Write-Host "  Total: $Total/4 components built successfully"
Write-Host ""

if ($Total -eq 4) {
    Write-Host "All components built successfully!" -ForegroundColor Green
    exit 0
} else {
    Write-Host "Some components failed to build." -ForegroundColor Yellow
    exit 1
}