linxus fs fixes

This commit is contained in:
Boki 2025-06-09 22:55:51 -04:00
parent ac23b70146
commit 0b7846fe67
292 changed files with 41947 additions and 41947 deletions

View file

@ -1,85 +1,85 @@
@echo off
REM Build All Script for Stock Bot (Batch version)
REM Builds libraries first, then apps with Turbo, then dashboard with Angular CLI
echo 🚀 Starting complete build process...
REM Store original directory
set "ORIGINAL_DIR=%CD%"
cd /d "g:\repos\stock-bot"
REM Step 1: Build libraries first
echo 📚 Building libraries...
call powershell ./scripts/build-libs.ps1
if %ERRORLEVEL% NEQ 0 (
echo ❌ Library build failed
cd /d "%ORIGINAL_DIR%"
exit /b 1
)
REM Step 2: Build apps with Turbo (excluding dashboard)
echo 🏗️ Building applications with Turbo...
REM Check if each app exists and build individually
if exist "apps\data-service" (
echo Building data-service...
call turbo run build --filter="./apps/data-service"
if %ERRORLEVEL% NEQ 0 (
echo ❌ data-service build failed
cd /d "%ORIGINAL_DIR%"
exit /b 1
)
)
if exist "apps\execution-service" (
echo Building execution-service...
call turbo run build --filter="./apps/execution-service"
if %ERRORLEVEL% NEQ 0 (
echo ❌ execution-service build failed
cd /d "%ORIGINAL_DIR%"
exit /b 1
)
)
if exist "apps\portfolio-service" (
echo Building portfolio-service...
call turbo run build --filter="./apps/portfolio-service"
if %ERRORLEVEL% NEQ 0 (
echo ❌ portfolio-service build failed
cd /d "%ORIGINAL_DIR%"
exit /b 1
)
)
if exist "apps\processing-service" (
echo Building processing-service...
call turbo run build --filter="./apps/processing-service"
if %ERRORLEVEL% NEQ 0 (
echo ❌ processing-service build failed
cd /d "%ORIGINAL_DIR%"
exit /b 1
)
)
if exist "apps\strategy-service" (
echo Building strategy-service...
call turbo run build --filter="./apps/strategy-service"
if %ERRORLEVEL% NEQ 0 (
echo ❌ strategy-service build failed
cd /d "%ORIGINAL_DIR%"
exit /b 1
)
)
REM Step 3: Build dashboard with Angular CLI
echo 🎨 Building Angular dashboard...
cd apps\dashboard
call ng build --configuration production
if %ERRORLEVEL% NEQ 0 (
echo ❌ Dashboard build failed
cd /d "%ORIGINAL_DIR%"
exit /b 1
)
cd /d "%ORIGINAL_DIR%"
echo 🎉 Complete build finished successfully!
@echo off
REM Build All Script for Stock Bot (Batch version)
REM Builds libraries first, then apps with Turbo, then dashboard with Angular CLI
echo 🚀 Starting complete build process...
REM Store original directory
set "ORIGINAL_DIR=%CD%"
cd /d "g:\repos\stock-bot"
REM Step 1: Build libraries first
echo 📚 Building libraries...
call powershell ./scripts/build-libs.ps1
if %ERRORLEVEL% NEQ 0 (
echo ❌ Library build failed
cd /d "%ORIGINAL_DIR%"
exit /b 1
)
REM Step 2: Build apps with Turbo (excluding dashboard)
echo 🏗️ Building applications with Turbo...
REM Check if each app exists and build individually
if exist "apps\data-service" (
echo Building data-service...
call turbo run build --filter="./apps/data-service"
if %ERRORLEVEL% NEQ 0 (
echo ❌ data-service build failed
cd /d "%ORIGINAL_DIR%"
exit /b 1
)
)
if exist "apps\execution-service" (
echo Building execution-service...
call turbo run build --filter="./apps/execution-service"
if %ERRORLEVEL% NEQ 0 (
echo ❌ execution-service build failed
cd /d "%ORIGINAL_DIR%"
exit /b 1
)
)
if exist "apps\portfolio-service" (
echo Building portfolio-service...
call turbo run build --filter="./apps/portfolio-service"
if %ERRORLEVEL% NEQ 0 (
echo ❌ portfolio-service build failed
cd /d "%ORIGINAL_DIR%"
exit /b 1
)
)
if exist "apps\processing-service" (
echo Building processing-service...
call turbo run build --filter="./apps/processing-service"
if %ERRORLEVEL% NEQ 0 (
echo ❌ processing-service build failed
cd /d "%ORIGINAL_DIR%"
exit /b 1
)
)
if exist "apps\strategy-service" (
echo Building strategy-service...
call turbo run build --filter="./apps/strategy-service"
if %ERRORLEVEL% NEQ 0 (
echo ❌ strategy-service build failed
cd /d "%ORIGINAL_DIR%"
exit /b 1
)
)
REM Step 3: Build dashboard with Angular CLI
echo 🎨 Building Angular dashboard...
cd apps\dashboard
call ng build --configuration production
if %ERRORLEVEL% NEQ 0 (
echo ❌ Dashboard build failed
cd /d "%ORIGINAL_DIR%"
exit /b 1
)
cd /d "%ORIGINAL_DIR%"
echo 🎉 Complete build finished successfully!

View file

@ -1,108 +1,108 @@
# Build All Script for Stock Bot
# Builds libraries first, then apps with Turbo, then dashboard with Angular CLI
param(
[switch]$Clean,
[switch]$Verbose
)
$ErrorActionPreference = "Stop"
Write-Host "🚀 Starting complete build process..." -ForegroundColor Cyan
# Store original location
$originalLocation = Get-Location
Set-Location "g:\repos\stock-bot"
try {
# Step 1: Clean if requested
if ($Clean) {
Write-Host "🧹 Cleaning previous builds..." -ForegroundColor Yellow
& powershell ./scripts/clean.ps1 -dist
if ($LASTEXITCODE -ne 0) {
throw "Clean failed"
}
}
# Step 2: Build libraries first
Write-Host "📚 Building libraries..." -ForegroundColor Green
& powershell ./scripts/build-libs.ps1
if ($LASTEXITCODE -ne 0) {
throw "Library build failed"
} # Step 3: Build apps with Turbo (excluding dashboard)
Write-Host "🏗️ Building applications with Turbo..." -ForegroundColor Green
# Get list of apps excluding dashboard
$appDirs = Get-ChildItem -Path "apps" -Directory | Where-Object { $_.Name -ne "dashboard" }
if ($appDirs.Count -gt 0) {
# Build each app individually to avoid filter syntax issues
foreach ($app in $appDirs) {
$appPath = "./apps/$($app.Name)"
Write-Host " Building $($app.Name)..." -ForegroundColor Cyan
$turboCmd = "turbo run build --filter=$appPath"
if ($Verbose) {
Write-Host " Running: $turboCmd" -ForegroundColor DarkGray
}
Invoke-Expression $turboCmd
if ($LASTEXITCODE -ne 0) {
throw "Failed to build app: $($app.Name)"
}
}
Write-Host "✅ Apps built successfully: $($appDirs.Name -join ', ')" -ForegroundColor Green
} else {
Write-Host " No non-dashboard apps found to build with Turbo" -ForegroundColor Yellow
}
# Step 4: Build dashboard with Angular CLI
$dashboardPath = "apps/dashboard"
if (Test-Path $dashboardPath) {
Write-Host "🎨 Building Angular dashboard..." -ForegroundColor Green
Set-Location $dashboardPath
# Check if ng is available
try {
ng version | Out-Null
} catch {
Write-Host "❌ Angular CLI not found. Installing..." -ForegroundColor Red
npm install -g @angular/cli
if ($LASTEXITCODE -ne 0) {
throw "Failed to install Angular CLI"
}
}
# Build dashboard
ng build --configuration production
if ($LASTEXITCODE -ne 0) {
throw "Dashboard build failed"
}
Write-Host "✅ Dashboard built successfully" -ForegroundColor Green
Set-Location $originalLocation
} else {
Write-Host "⚠️ Dashboard not found at $dashboardPath" -ForegroundColor Yellow
}
Write-Host "🎉 Complete build finished successfully!" -ForegroundColor Green
Write-Host ""
Write-Host "Build Summary:" -ForegroundColor Cyan
Write-Host " ✅ Libraries built" -ForegroundColor Green
if ($appFilters.Count -gt 0) {
Write-Host " ✅ Apps built: $($appDirs.Name -join ', ')" -ForegroundColor Green
}
if (Test-Path "apps/dashboard") {
Write-Host " ✅ Dashboard built" -ForegroundColor Green
}
} catch {
Write-Host "❌ Build failed: $($_.Exception.Message)" -ForegroundColor Red
Set-Location $originalLocation
exit 1
} finally {
Set-Location $originalLocation
}
# Build All Script for Stock Bot
# Builds libraries first, then apps with Turbo, then dashboard with Angular CLI
param(
[switch]$Clean,
[switch]$Verbose
)
$ErrorActionPreference = "Stop"
Write-Host "🚀 Starting complete build process..." -ForegroundColor Cyan
# Store original location
$originalLocation = Get-Location
Set-Location "g:\repos\stock-bot"
try {
# Step 1: Clean if requested
if ($Clean) {
Write-Host "🧹 Cleaning previous builds..." -ForegroundColor Yellow
& powershell ./scripts/clean.ps1 -dist
if ($LASTEXITCODE -ne 0) {
throw "Clean failed"
}
}
# Step 2: Build libraries first
Write-Host "📚 Building libraries..." -ForegroundColor Green
& powershell ./scripts/build-libs.ps1
if ($LASTEXITCODE -ne 0) {
throw "Library build failed"
} # Step 3: Build apps with Turbo (excluding dashboard)
Write-Host "🏗️ Building applications with Turbo..." -ForegroundColor Green
# Get list of apps excluding dashboard
$appDirs = Get-ChildItem -Path "apps" -Directory | Where-Object { $_.Name -ne "dashboard" }
if ($appDirs.Count -gt 0) {
# Build each app individually to avoid filter syntax issues
foreach ($app in $appDirs) {
$appPath = "./apps/$($app.Name)"
Write-Host " Building $($app.Name)..." -ForegroundColor Cyan
$turboCmd = "turbo run build --filter=$appPath"
if ($Verbose) {
Write-Host " Running: $turboCmd" -ForegroundColor DarkGray
}
Invoke-Expression $turboCmd
if ($LASTEXITCODE -ne 0) {
throw "Failed to build app: $($app.Name)"
}
}
Write-Host "✅ Apps built successfully: $($appDirs.Name -join ', ')" -ForegroundColor Green
} else {
Write-Host " No non-dashboard apps found to build with Turbo" -ForegroundColor Yellow
}
# Step 4: Build dashboard with Angular CLI
$dashboardPath = "apps/dashboard"
if (Test-Path $dashboardPath) {
Write-Host "🎨 Building Angular dashboard..." -ForegroundColor Green
Set-Location $dashboardPath
# Check if ng is available
try {
ng version | Out-Null
} catch {
Write-Host "❌ Angular CLI not found. Installing..." -ForegroundColor Red
npm install -g @angular/cli
if ($LASTEXITCODE -ne 0) {
throw "Failed to install Angular CLI"
}
}
# Build dashboard
ng build --configuration production
if ($LASTEXITCODE -ne 0) {
throw "Dashboard build failed"
}
Write-Host "✅ Dashboard built successfully" -ForegroundColor Green
Set-Location $originalLocation
} else {
Write-Host "⚠️ Dashboard not found at $dashboardPath" -ForegroundColor Yellow
}
Write-Host "🎉 Complete build finished successfully!" -ForegroundColor Green
Write-Host ""
Write-Host "Build Summary:" -ForegroundColor Cyan
Write-Host " ✅ Libraries built" -ForegroundColor Green
if ($appFilters.Count -gt 0) {
Write-Host " ✅ Apps built: $($appDirs.Name -join ', ')" -ForegroundColor Green
}
if (Test-Path "apps/dashboard") {
Write-Host " ✅ Dashboard built" -ForegroundColor Green
}
} catch {
Write-Host "❌ Build failed: $($_.Exception.Message)" -ForegroundColor Red
Set-Location $originalLocation
exit 1
} finally {
Set-Location $originalLocation
}

View file

@ -1,64 +1,64 @@
param(
[switch]$force
)
Write-Host "=== Clean Build Process ===" -ForegroundColor Green
# Step 1: Clean everything
Write-Host "Step 1: Cleaning build artifacts..." -ForegroundColor Yellow
& ".\scripts\clean.ps1" -dist -force
# Step 2: Install dependencies
Write-Host "Step 2: Installing dependencies..." -ForegroundColor Yellow
bun install
# Step 3: Build libraries in dependency order
Write-Host "Step 3: Building libraries..." -ForegroundColor Yellow
$libraries = @(
"types",
"config",
"logger",
"utils",
"postgres-client",
"mongodb-client",
"questdb-client",
"cache",
"http",
"event-bus",
"shutdown",
"data-frame",
"vector-engine",
"strategy-engine",
"data-adjustments"
)
foreach ($lib in $libraries) {
$libPath = "libs\$lib"
if (Test-Path $libPath) {
Write-Host "Building $lib..." -ForegroundColor Blue
Set-Location $libPath
bun run build
if ($LASTEXITCODE -ne 0) {
Write-Host "Failed to build $lib" -ForegroundColor Red
Set-Location "..\..\"
exit 1
}
Set-Location "..\..\"
Write-Host "$lib built successfully" -ForegroundColor Green
} else {
Write-Host "⚠ Library $lib not found, skipping..." -ForegroundColor Yellow
}
}
# Step 4: Build applications
Write-Host "Step 4: Building applications..." -ForegroundColor Yellow
turbo run build --filter='./apps/*'
if ($LASTEXITCODE -ne 0) {
Write-Host "Failed to build applications" -ForegroundColor Red
exit 1
}
Write-Host "=== Clean Build Complete! ===" -ForegroundColor Green
Write-Host "All packages built successfully" -ForegroundColor Blue
param(
[switch]$force
)
Write-Host "=== Clean Build Process ===" -ForegroundColor Green
# Step 1: Clean everything
Write-Host "Step 1: Cleaning build artifacts..." -ForegroundColor Yellow
& ".\scripts\clean.ps1" -dist -force
# Step 2: Install dependencies
Write-Host "Step 2: Installing dependencies..." -ForegroundColor Yellow
bun install
# Step 3: Build libraries in dependency order
Write-Host "Step 3: Building libraries..." -ForegroundColor Yellow
$libraries = @(
"types",
"config",
"logger",
"utils",
"postgres-client",
"mongodb-client",
"questdb-client",
"cache",
"http",
"event-bus",
"shutdown",
"data-frame",
"vector-engine",
"strategy-engine",
"data-adjustments"
)
foreach ($lib in $libraries) {
$libPath = "libs\$lib"
if (Test-Path $libPath) {
Write-Host "Building $lib..." -ForegroundColor Blue
Set-Location $libPath
bun run build
if ($LASTEXITCODE -ne 0) {
Write-Host "Failed to build $lib" -ForegroundColor Red
Set-Location "..\..\"
exit 1
}
Set-Location "..\..\"
Write-Host "$lib built successfully" -ForegroundColor Green
} else {
Write-Host "⚠ Library $lib not found, skipping..." -ForegroundColor Yellow
}
}
# Step 4: Build applications
Write-Host "Step 4: Building applications..." -ForegroundColor Yellow
turbo run build --filter='./apps/*'
if ($LASTEXITCODE -ne 0) {
Write-Host "Failed to build applications" -ForegroundColor Red
exit 1
}
Write-Host "=== Clean Build Complete! ===" -ForegroundColor Green
Write-Host "All packages built successfully" -ForegroundColor Blue

View file

@ -1,43 +1,43 @@
# Build and install the new libraries
Write-Host "Building and installing new libraries..." -ForegroundColor Cyan
# Build order is important due to dependencies
$libs = @(
"types", # Base types - no dependencies
"config", # Configuration - depends on types
"logger", # Logging utilities - depends on types
"utils", # Utilities - depends on types and config
# Database clients
"postgres-client", # PostgreSQL client - depends on types, config, logger
# "mongodb-client", # MongoDB client - depends on types, config, logger (temporarily disabled - needs zod->yup conversion)
"questdb-client", # QuestDB client - depends on types, config, logger
# Service libraries
"cache", # Cache - depends on types and logger
"http", # HTTP client - depends on types, config, logger
"event-bus", # Event bus - depends on types, logger
"shutdown", # Shutdown - depends on types, logger
# Engine libraries
"data-frame", # Data frame - depends on types, utils
"vector-engine", # Vector engine - depends on types, utils, data-frame
"strategy-engine" # Strategy engine - depends on types, utils, event-bus
)
# Build each library in order
foreach ($lib in $libs) {
$libPath = "g:\repos\stock-bot\libs\$lib"
Write-Host "Building $lib..." -ForegroundColor Green
Set-Location $libPath
bun run build
if ($LASTEXITCODE -ne 0) {
Write-Host "Failed to build $lib. Exiting." -ForegroundColor Red
exit 1
}
}
Write-Host "All libraries built successfully!" -ForegroundColor Green
Set-Location g:\repos\stock-bot
# Build and install the new libraries
Write-Host "Building and installing new libraries..." -ForegroundColor Cyan
# Build order is important due to dependencies
$libs = @(
"types", # Base types - no dependencies
"config", # Configuration - depends on types
"logger", # Logging utilities - depends on types
"utils", # Utilities - depends on types and config
# Database clients
"postgres-client", # PostgreSQL client - depends on types, config, logger
# "mongodb-client", # MongoDB client - depends on types, config, logger (temporarily disabled - needs zod->yup conversion)
"questdb-client", # QuestDB client - depends on types, config, logger
# Service libraries
"cache", # Cache - depends on types and logger
"http", # HTTP client - depends on types, config, logger
"event-bus", # Event bus - depends on types, logger
"shutdown", # Shutdown - depends on types, logger
# Engine libraries
"data-frame", # Data frame - depends on types, utils
"vector-engine", # Vector engine - depends on types, utils, data-frame
"strategy-engine" # Strategy engine - depends on types, utils, event-bus
)
# Build each library in order
foreach ($lib in $libs) {
$libPath = "g:\repos\stock-bot\libs\$lib"
Write-Host "Building $lib..." -ForegroundColor Green
Set-Location $libPath
bun run build
if ($LASTEXITCODE -ne 0) {
Write-Host "Failed to build $lib. Exiting." -ForegroundColor Red
exit 1
}
}
Write-Host "All libraries built successfully!" -ForegroundColor Green
Set-Location g:\repos\stock-bot

View file

@ -1,182 +1,182 @@
param(
[switch]$modules,
[switch]$dist,
[switch]$cache,
[switch]$tsbuildinfo,
[switch]$all,
[switch]$fresh,
[switch]$force
)
function Remove-DirectoriesByName {
param([string]$Name, [string]$Description)
Write-Host "Removing $Description..." -ForegroundColor Blue
$directories = Get-ChildItem -Path . -Name $Name -Recurse -Directory -ErrorAction SilentlyContinue
if ($directories.Count -gt 0) {
Write-Host "Found $($directories.Count) $Description to remove" -ForegroundColor Gray
$directories | ForEach-Object {
Remove-Item $_ -Recurse -Force -ErrorAction SilentlyContinue
Write-Host " Removed: $_" -ForegroundColor Gray
}
} else {
Write-Host "No $Description found" -ForegroundColor Gray
}
}
function Remove-FilesByPattern {
param([string]$Pattern, [string]$Description)
Write-Host "Removing $Description..." -ForegroundColor Blue
$files = Get-ChildItem -Path . -Name $Pattern -Recurse -File -ErrorAction SilentlyContinue
if ($files.Count -gt 0) {
Write-Host "Found $($files.Count) $Description to remove" -ForegroundColor Gray
$files | ForEach-Object {
Remove-Item $_ -Force -ErrorAction SilentlyContinue
Write-Host " Removed: $_" -ForegroundColor Gray
}
} else {
Write-Host "No $Description found" -ForegroundColor Gray
}
}
Write-Host "Starting cleanup..." -ForegroundColor Yellow
if ($all -or $fresh) {
if (-not $force) {
Write-Host "WARNING: This will remove ALL build artifacts, caches, dependencies, and temporary files!" -ForegroundColor Red
Write-Host "This includes: node_modules, dist, all caches, logs, databases, and lock files" -ForegroundColor Yellow
$confirmation = Read-Host "Are you sure you want to continue? (y/N)"
if ($confirmation -ne 'y' -and $confirmation -ne 'Y') {
Write-Host "Operation cancelled." -ForegroundColor Yellow
exit 0
}
}
Write-Host "=== NUCLEAR CLEAN: Removing EVERYTHING ===" -ForegroundColor Red
# Dependencies and packages
Remove-DirectoriesByName "node_modules" "node_modules directories"
# Build outputs
Remove-DirectoriesByName "dist" "dist directories"
Remove-DirectoriesByName "build" "build directories"
Remove-DirectoriesByName "lib" "lib directories"
Remove-DirectoriesByName "out" "out directories"
Remove-DirectoriesByName ".out" "build output directories"
# Cache directories
Remove-DirectoriesByName ".turbo" "Turborepo cache directories"
Remove-DirectoriesByName ".next" "Next.js cache directories"
Remove-DirectoriesByName ".parcel-cache" "Parcel cache directories"
Remove-DirectoriesByName ".angular" "Angular CLI cache directories"
Remove-DirectoriesByName ".nuxt" "Nuxt.js cache directories"
Remove-DirectoriesByName ".vite" "Vite cache directories"
Remove-DirectoriesByName ".webpack" "Webpack cache directories"
Remove-DirectoriesByName ".rollup.cache" "Rollup cache directories"
# Test and coverage
Remove-DirectoriesByName "coverage" "test coverage directories"
Remove-DirectoriesByName ".nyc_output" "NYC coverage directories"
Remove-DirectoriesByName ".jest" "Jest cache directories"
Remove-DirectoriesByName ".vitest" "Vitest cache directories"
# Storybook
Remove-DirectoriesByName ".storybook-out" "Storybook build directories"
Remove-DirectoriesByName "storybook-static" "Storybook static directories"
# Temporary and log directories
Remove-DirectoriesByName "tmp" "temporary directories"
Remove-DirectoriesByName "temp" "temp directories"
Remove-DirectoriesByName ".tmp" "hidden temp directories"
Remove-DirectoriesByName "logs" "log directories"
Remove-DirectoriesByName ".logs" "hidden log directories"
# Project specific (from .gitignore)
Remove-DirectoriesByName ".data" "data directories"
Remove-DirectoriesByName ".backtest-results" "backtest result directories"
Remove-DirectoriesByName ".old" "old backup directories"
Remove-DirectoriesByName ".mongo" "MongoDB data directories"
Remove-DirectoriesByName ".chat" "chat directories"
Write-Host "Removing lock files..." -ForegroundColor Blue
Remove-Item -Path "bun.lockb" -Force -ErrorAction SilentlyContinue
Remove-Item -Path "package-lock.json" -Force -ErrorAction SilentlyContinue
Remove-Item -Path "yarn.lock" -Force -ErrorAction SilentlyContinue
Remove-Item -Path "pnpm-lock.yaml" -Force -ErrorAction SilentlyContinue
Get-ChildItem -Path . -Name "bun.lockb" -Recurse -File | Remove-Item -Force -ErrorAction SilentlyContinue
Get-ChildItem -Path . -Name "package-lock.json" -Recurse -File | Remove-Item -Force -ErrorAction SilentlyContinue
Get-ChildItem -Path . -Name "yarn.lock" -Recurse -File | Remove-Item -Force -ErrorAction SilentlyContinue
Get-ChildItem -Path . -Name "pnpm-lock.yaml" -Recurse -File | Remove-Item -Force -ErrorAction SilentlyContinue
# TypeScript and build files
Remove-FilesByPattern "*.tsbuildinfo" "TypeScript build info files"
Remove-FilesByPattern ".eslintcache" "ESLint cache files"
Remove-FilesByPattern ".stylelintcache" "Stylelint cache files"
Remove-FilesByPattern ".prettiercache" "Prettier cache files"
Remove-FilesByPattern "*.d.ts" "TypeScript build info files"
# Database files
Remove-FilesByPattern "*.db" "database files"
Remove-FilesByPattern "*.sqlite" "SQLite database files"
Remove-FilesByPattern "*.sqlite3" "SQLite3 database files"
# Log files
Remove-FilesByPattern "*.log" "log files"
Remove-FilesByPattern "npm-debug.log*" "npm debug logs"
Remove-FilesByPattern "yarn-debug.log*" "yarn debug logs"
Remove-FilesByPattern "yarn-error.log*" "yarn error logs"
Remove-FilesByPattern "lerna-debug.log*" "lerna debug logs"
# OS generated files
Remove-FilesByPattern ".DS_Store" "macOS .DS_Store files"
Remove-FilesByPattern "Thumbs.db" "Windows thumbnail files"
Remove-FilesByPattern "ehthumbs.db" "Windows thumbnail cache files"
Remove-FilesByPattern "Desktop.ini" "Windows desktop files"
Write-Host "=== NUCLEAR CLEAN COMPLETE ===" -ForegroundColor Red
Write-Host "Cleanup complete - no need for turbo clean" -ForegroundColor Blue
}
elseif ($modules) {
Remove-DirectoriesByName "node_modules" "node_modules directories"
Write-Host "Removing lock files..." -ForegroundColor Blue
Remove-Item -Path "bun.lockb" -Force -ErrorAction SilentlyContinue
Get-ChildItem -Path . -Name "bun.lockb" -Recurse -File | Remove-Item -Force -ErrorAction SilentlyContinue
}
elseif ($dist) {
Remove-DirectoriesByName "dist" "dist directories"
Remove-DirectoriesByName ".turbo" "Turborepo cache directories"
Remove-DirectoriesByName ".next" "Next.js cache directories"
Remove-DirectoriesByName ".parcel-cache" "Parcel cache directories"
Remove-DirectoriesByName ".angular" "Angular CLI cache directories"
Remove-FilesByPattern "*.tsbuildinfo" "TypeScript build info files"
Remove-FilesByPattern ".eslintcache" "ESLint cache files"
}
elseif ($cache) {
Remove-DirectoriesByName ".turbo" "Turborepo cache directories"
Remove-DirectoriesByName ".next" "Next.js cache directories"
Remove-DirectoriesByName ".parcel-cache" "Parcel cache directories"
Remove-DirectoriesByName ".angular" "Angular CLI cache directories"
Remove-DirectoriesByName "coverage" "test coverage directories"
Remove-DirectoriesByName ".nyc_output" "NYC coverage directories"
Remove-FilesByPattern ".eslintcache" "ESLint cache files"
}
elseif ($tsbuildinfo) {
Remove-FilesByPattern "*.tsbuildinfo" "TypeScript build info files"
}
else {
Write-Host "Running turbo clean..." -ForegroundColor Blue
# Only run turbo clean for the default case
turbo run clean
}
if ($fresh) {
Write-Host "Installing dependencies..." -ForegroundColor Green
bun install
}
param(
[switch]$modules,
[switch]$dist,
[switch]$cache,
[switch]$tsbuildinfo,
[switch]$all,
[switch]$fresh,
[switch]$force
)
function Remove-DirectoriesByName {
param([string]$Name, [string]$Description)
Write-Host "Removing $Description..." -ForegroundColor Blue
$directories = Get-ChildItem -Path . -Name $Name -Recurse -Directory -ErrorAction SilentlyContinue
if ($directories.Count -gt 0) {
Write-Host "Found $($directories.Count) $Description to remove" -ForegroundColor Gray
$directories | ForEach-Object {
Remove-Item $_ -Recurse -Force -ErrorAction SilentlyContinue
Write-Host " Removed: $_" -ForegroundColor Gray
}
} else {
Write-Host "No $Description found" -ForegroundColor Gray
}
}
function Remove-FilesByPattern {
param([string]$Pattern, [string]$Description)
Write-Host "Removing $Description..." -ForegroundColor Blue
$files = Get-ChildItem -Path . -Name $Pattern -Recurse -File -ErrorAction SilentlyContinue
if ($files.Count -gt 0) {
Write-Host "Found $($files.Count) $Description to remove" -ForegroundColor Gray
$files | ForEach-Object {
Remove-Item $_ -Force -ErrorAction SilentlyContinue
Write-Host " Removed: $_" -ForegroundColor Gray
}
} else {
Write-Host "No $Description found" -ForegroundColor Gray
}
}
Write-Host "Starting cleanup..." -ForegroundColor Yellow
if ($all -or $fresh) {
if (-not $force) {
Write-Host "WARNING: This will remove ALL build artifacts, caches, dependencies, and temporary files!" -ForegroundColor Red
Write-Host "This includes: node_modules, dist, all caches, logs, databases, and lock files" -ForegroundColor Yellow
$confirmation = Read-Host "Are you sure you want to continue? (y/N)"
if ($confirmation -ne 'y' -and $confirmation -ne 'Y') {
Write-Host "Operation cancelled." -ForegroundColor Yellow
exit 0
}
}
Write-Host "=== NUCLEAR CLEAN: Removing EVERYTHING ===" -ForegroundColor Red
# Dependencies and packages
Remove-DirectoriesByName "node_modules" "node_modules directories"
# Build outputs
Remove-DirectoriesByName "dist" "dist directories"
Remove-DirectoriesByName "build" "build directories"
Remove-DirectoriesByName "lib" "lib directories"
Remove-DirectoriesByName "out" "out directories"
Remove-DirectoriesByName ".out" "build output directories"
# Cache directories
Remove-DirectoriesByName ".turbo" "Turborepo cache directories"
Remove-DirectoriesByName ".next" "Next.js cache directories"
Remove-DirectoriesByName ".parcel-cache" "Parcel cache directories"
Remove-DirectoriesByName ".angular" "Angular CLI cache directories"
Remove-DirectoriesByName ".nuxt" "Nuxt.js cache directories"
Remove-DirectoriesByName ".vite" "Vite cache directories"
Remove-DirectoriesByName ".webpack" "Webpack cache directories"
Remove-DirectoriesByName ".rollup.cache" "Rollup cache directories"
# Test and coverage
Remove-DirectoriesByName "coverage" "test coverage directories"
Remove-DirectoriesByName ".nyc_output" "NYC coverage directories"
Remove-DirectoriesByName ".jest" "Jest cache directories"
Remove-DirectoriesByName ".vitest" "Vitest cache directories"
# Storybook
Remove-DirectoriesByName ".storybook-out" "Storybook build directories"
Remove-DirectoriesByName "storybook-static" "Storybook static directories"
# Temporary and log directories
Remove-DirectoriesByName "tmp" "temporary directories"
Remove-DirectoriesByName "temp" "temp directories"
Remove-DirectoriesByName ".tmp" "hidden temp directories"
Remove-DirectoriesByName "logs" "log directories"
Remove-DirectoriesByName ".logs" "hidden log directories"
# Project specific (from .gitignore)
Remove-DirectoriesByName ".data" "data directories"
Remove-DirectoriesByName ".backtest-results" "backtest result directories"
Remove-DirectoriesByName ".old" "old backup directories"
Remove-DirectoriesByName ".mongo" "MongoDB data directories"
Remove-DirectoriesByName ".chat" "chat directories"
Write-Host "Removing lock files..." -ForegroundColor Blue
Remove-Item -Path "bun.lockb" -Force -ErrorAction SilentlyContinue
Remove-Item -Path "package-lock.json" -Force -ErrorAction SilentlyContinue
Remove-Item -Path "yarn.lock" -Force -ErrorAction SilentlyContinue
Remove-Item -Path "pnpm-lock.yaml" -Force -ErrorAction SilentlyContinue
Get-ChildItem -Path . -Name "bun.lockb" -Recurse -File | Remove-Item -Force -ErrorAction SilentlyContinue
Get-ChildItem -Path . -Name "package-lock.json" -Recurse -File | Remove-Item -Force -ErrorAction SilentlyContinue
Get-ChildItem -Path . -Name "yarn.lock" -Recurse -File | Remove-Item -Force -ErrorAction SilentlyContinue
Get-ChildItem -Path . -Name "pnpm-lock.yaml" -Recurse -File | Remove-Item -Force -ErrorAction SilentlyContinue
# TypeScript and build files
Remove-FilesByPattern "*.tsbuildinfo" "TypeScript build info files"
Remove-FilesByPattern ".eslintcache" "ESLint cache files"
Remove-FilesByPattern ".stylelintcache" "Stylelint cache files"
Remove-FilesByPattern ".prettiercache" "Prettier cache files"
Remove-FilesByPattern "*.d.ts" "TypeScript build info files"
# Database files
Remove-FilesByPattern "*.db" "database files"
Remove-FilesByPattern "*.sqlite" "SQLite database files"
Remove-FilesByPattern "*.sqlite3" "SQLite3 database files"
# Log files
Remove-FilesByPattern "*.log" "log files"
Remove-FilesByPattern "npm-debug.log*" "npm debug logs"
Remove-FilesByPattern "yarn-debug.log*" "yarn debug logs"
Remove-FilesByPattern "yarn-error.log*" "yarn error logs"
Remove-FilesByPattern "lerna-debug.log*" "lerna debug logs"
# OS generated files
Remove-FilesByPattern ".DS_Store" "macOS .DS_Store files"
Remove-FilesByPattern "Thumbs.db" "Windows thumbnail files"
Remove-FilesByPattern "ehthumbs.db" "Windows thumbnail cache files"
Remove-FilesByPattern "Desktop.ini" "Windows desktop files"
Write-Host "=== NUCLEAR CLEAN COMPLETE ===" -ForegroundColor Red
Write-Host "Cleanup complete - no need for turbo clean" -ForegroundColor Blue
}
elseif ($modules) {
Remove-DirectoriesByName "node_modules" "node_modules directories"
Write-Host "Removing lock files..." -ForegroundColor Blue
Remove-Item -Path "bun.lockb" -Force -ErrorAction SilentlyContinue
Get-ChildItem -Path . -Name "bun.lockb" -Recurse -File | Remove-Item -Force -ErrorAction SilentlyContinue
}
elseif ($dist) {
Remove-DirectoriesByName "dist" "dist directories"
Remove-DirectoriesByName ".turbo" "Turborepo cache directories"
Remove-DirectoriesByName ".next" "Next.js cache directories"
Remove-DirectoriesByName ".parcel-cache" "Parcel cache directories"
Remove-DirectoriesByName ".angular" "Angular CLI cache directories"
Remove-FilesByPattern "*.tsbuildinfo" "TypeScript build info files"
Remove-FilesByPattern ".eslintcache" "ESLint cache files"
}
elseif ($cache) {
Remove-DirectoriesByName ".turbo" "Turborepo cache directories"
Remove-DirectoriesByName ".next" "Next.js cache directories"
Remove-DirectoriesByName ".parcel-cache" "Parcel cache directories"
Remove-DirectoriesByName ".angular" "Angular CLI cache directories"
Remove-DirectoriesByName "coverage" "test coverage directories"
Remove-DirectoriesByName ".nyc_output" "NYC coverage directories"
Remove-FilesByPattern ".eslintcache" "ESLint cache files"
}
elseif ($tsbuildinfo) {
Remove-FilesByPattern "*.tsbuildinfo" "TypeScript build info files"
}
else {
Write-Host "Running turbo clean..." -ForegroundColor Blue
# Only run turbo clean for the default case
turbo run clean
}
if ($fresh) {
Write-Host "Installing dependencies..." -ForegroundColor Green
bun install
}
Write-Host "Cleanup complete!" -ForegroundColor Green

View file

@ -1,142 +1,142 @@
#!/usr/bin/env pwsh
# Trading Bot Docker Management Script
param(
[Parameter(Mandatory=$true)]
[ValidateSet("start", "stop", "restart", "status", "logs", "reset", "admin", "monitoring", "help")]
[string]$Action,
[Parameter(Mandatory=$false)]
[string]$Service = "",
[Parameter(Mandatory=$false)]
[switch]$Dev = $false
)
$ComposeFiles = if ($Dev) {
"-f docker-compose.yml -f docker-compose.dev.yml"
} else {
"-f docker-compose.yml"
}
switch ($Action) {
"start" {
Write-Host "🚀 Starting Trading Bot infrastructure..." -ForegroundColor Green
if ($Service) {
Invoke-Expression "docker-compose $ComposeFiles up -d $Service"
} else {
Invoke-Expression "docker-compose $ComposeFiles up -d dragonfly postgres questdb"
}
Write-Host "✅ Infrastructure started!" -ForegroundColor Green
Write-Host ""
Write-Host "🔗 Access Points:" -ForegroundColor Cyan
Write-Host " Dragonfly: localhost:6379"
Write-Host " PostgreSQL: localhost:5432"
Write-Host " QuestDB Console: http://localhost:9000"
Write-Host ""
Write-Host "💡 Use './scripts/docker.ps1 admin' to start admin interfaces"
}
"stop" {
Write-Host "🛑 Stopping Trading Bot infrastructure..." -ForegroundColor Yellow
if ($Service) {
Invoke-Expression "docker-compose $ComposeFiles stop $Service"
} else {
Invoke-Expression "docker-compose $ComposeFiles down"
}
Write-Host "✅ Infrastructure stopped!" -ForegroundColor Green
}
"restart" {
Write-Host "🔄 Restarting Trading Bot infrastructure..." -ForegroundColor Yellow
if ($Service) {
Invoke-Expression "docker-compose $ComposeFiles restart $Service"
} else {
Invoke-Expression "docker-compose $ComposeFiles restart"
}
Write-Host "✅ Infrastructure restarted!" -ForegroundColor Green
}
"status" {
Write-Host "📊 Trading Bot Infrastructure Status:" -ForegroundColor Cyan
Invoke-Expression "docker-compose $ComposeFiles ps"
Write-Host ""
Write-Host "🔍 Health Checks:" -ForegroundColor Cyan
docker ps --filter "name=trading-bot" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
}
"logs" {
if ($Service) {
Write-Host "📋 Logs for ${Service}:" -ForegroundColor Cyan
Invoke-Expression "docker-compose $ComposeFiles logs -f $Service"
} else {
Write-Host "📋 All service logs:" -ForegroundColor Cyan
Invoke-Expression "docker-compose $ComposeFiles logs -f"
}
}
"reset" {
Write-Host "⚠️ Resetting Trading Bot infrastructure (will delete all data)..." -ForegroundColor Red
$confirm = Read-Host "Are you sure? Type 'yes' to confirm"
if ($confirm -eq "yes") {
Invoke-Expression "docker-compose $ComposeFiles down -v"
Write-Host "🗑️ Volumes removed"
Invoke-Expression "docker-compose $ComposeFiles up -d dragonfly postgres questdb"
Write-Host "✅ Infrastructure reset complete!" -ForegroundColor Green
} else {
Write-Host "❌ Reset cancelled" -ForegroundColor Yellow
}
}
"admin" {
Write-Host "🔧 Starting admin interfaces..." -ForegroundColor Green
Invoke-Expression "docker-compose $ComposeFiles up -d redis-insight pgadmin"
Write-Host "✅ Admin interfaces started!" -ForegroundColor Green
Write-Host ""
Write-Host "🔗 Admin Access:" -ForegroundColor Cyan
Write-Host " Redis Insight: http://localhost:8001"
Write-Host " PgAdmin: http://localhost:8080"
Write-Host " Email: admin@tradingbot.local"
Write-Host " Password: admin123"
} "monitoring" {
Write-Host "📊 Starting monitoring stack..." -ForegroundColor Green
Invoke-Expression "docker-compose $ComposeFiles up -d prometheus grafana loki"
Write-Host "✅ Monitoring started!" -ForegroundColor Green
Write-Host ""
Write-Host "🔗 Monitoring Access:" -ForegroundColor Cyan
Write-Host " Prometheus: http://localhost:9090"
Write-Host " Grafana: http://localhost:3000"
Write-Host " Username: admin"
Write-Host " Password: admin"
Write-Host " Loki: http://localhost:3100"
}
"help" {
Write-Host ""
Write-Host "🤖 Trading Bot Docker Management" -ForegroundColor Green
Write-Host ""
Write-Host "Usage: ./scripts/docker.ps1 <action> [options]" -ForegroundColor Cyan
Write-Host ""
Write-Host "Actions:" -ForegroundColor Yellow
Write-Host " start Start infrastructure services"
Write-Host " stop Stop infrastructure services"
Write-Host " restart Restart infrastructure services"
Write-Host " status Show service status"
Write-Host " logs Show service logs"
Write-Host " reset Reset all data (destructive)"
Write-Host " admin Start admin interfaces"
Write-Host " monitoring Start monitoring stack"
Write-Host " help Show this help"
Write-Host ""
Write-Host "Options:" -ForegroundColor Yellow
Write-Host " -Service Specify a specific service"
Write-Host " -Dev Use development configuration"
Write-Host ""
Write-Host "Examples:" -ForegroundColor Cyan
Write-Host " ./scripts/docker.ps1 start"
Write-Host " ./scripts/docker.ps1 start -Dev"
Write-Host " ./scripts/docker.ps1 logs -Service dragonfly"
Write-Host " ./scripts/docker.ps1 admin"
}
}
#!/usr/bin/env pwsh
# Trading Bot Docker Management Script
param(
[Parameter(Mandatory=$true)]
[ValidateSet("start", "stop", "restart", "status", "logs", "reset", "admin", "monitoring", "help")]
[string]$Action,
[Parameter(Mandatory=$false)]
[string]$Service = "",
[Parameter(Mandatory=$false)]
[switch]$Dev = $false
)
$ComposeFiles = if ($Dev) {
"-f docker-compose.yml -f docker-compose.dev.yml"
} else {
"-f docker-compose.yml"
}
switch ($Action) {
"start" {
Write-Host "🚀 Starting Trading Bot infrastructure..." -ForegroundColor Green
if ($Service) {
Invoke-Expression "docker-compose $ComposeFiles up -d $Service"
} else {
Invoke-Expression "docker-compose $ComposeFiles up -d dragonfly postgres questdb"
}
Write-Host "✅ Infrastructure started!" -ForegroundColor Green
Write-Host ""
Write-Host "🔗 Access Points:" -ForegroundColor Cyan
Write-Host " Dragonfly: localhost:6379"
Write-Host " PostgreSQL: localhost:5432"
Write-Host " QuestDB Console: http://localhost:9000"
Write-Host ""
Write-Host "💡 Use './scripts/docker.ps1 admin' to start admin interfaces"
}
"stop" {
Write-Host "🛑 Stopping Trading Bot infrastructure..." -ForegroundColor Yellow
if ($Service) {
Invoke-Expression "docker-compose $ComposeFiles stop $Service"
} else {
Invoke-Expression "docker-compose $ComposeFiles down"
}
Write-Host "✅ Infrastructure stopped!" -ForegroundColor Green
}
"restart" {
Write-Host "🔄 Restarting Trading Bot infrastructure..." -ForegroundColor Yellow
if ($Service) {
Invoke-Expression "docker-compose $ComposeFiles restart $Service"
} else {
Invoke-Expression "docker-compose $ComposeFiles restart"
}
Write-Host "✅ Infrastructure restarted!" -ForegroundColor Green
}
"status" {
Write-Host "📊 Trading Bot Infrastructure Status:" -ForegroundColor Cyan
Invoke-Expression "docker-compose $ComposeFiles ps"
Write-Host ""
Write-Host "🔍 Health Checks:" -ForegroundColor Cyan
docker ps --filter "name=trading-bot" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
}
"logs" {
if ($Service) {
Write-Host "📋 Logs for ${Service}:" -ForegroundColor Cyan
Invoke-Expression "docker-compose $ComposeFiles logs -f $Service"
} else {
Write-Host "📋 All service logs:" -ForegroundColor Cyan
Invoke-Expression "docker-compose $ComposeFiles logs -f"
}
}
"reset" {
Write-Host "⚠️ Resetting Trading Bot infrastructure (will delete all data)..." -ForegroundColor Red
$confirm = Read-Host "Are you sure? Type 'yes' to confirm"
if ($confirm -eq "yes") {
Invoke-Expression "docker-compose $ComposeFiles down -v"
Write-Host "🗑️ Volumes removed"
Invoke-Expression "docker-compose $ComposeFiles up -d dragonfly postgres questdb"
Write-Host "✅ Infrastructure reset complete!" -ForegroundColor Green
} else {
Write-Host "❌ Reset cancelled" -ForegroundColor Yellow
}
}
"admin" {
Write-Host "🔧 Starting admin interfaces..." -ForegroundColor Green
Invoke-Expression "docker-compose $ComposeFiles up -d redis-insight pgadmin"
Write-Host "✅ Admin interfaces started!" -ForegroundColor Green
Write-Host ""
Write-Host "🔗 Admin Access:" -ForegroundColor Cyan
Write-Host " Redis Insight: http://localhost:8001"
Write-Host " PgAdmin: http://localhost:8080"
Write-Host " Email: admin@tradingbot.local"
Write-Host " Password: admin123"
} "monitoring" {
Write-Host "📊 Starting monitoring stack..." -ForegroundColor Green
Invoke-Expression "docker-compose $ComposeFiles up -d prometheus grafana loki"
Write-Host "✅ Monitoring started!" -ForegroundColor Green
Write-Host ""
Write-Host "🔗 Monitoring Access:" -ForegroundColor Cyan
Write-Host " Prometheus: http://localhost:9090"
Write-Host " Grafana: http://localhost:3000"
Write-Host " Username: admin"
Write-Host " Password: admin"
Write-Host " Loki: http://localhost:3100"
}
"help" {
Write-Host ""
Write-Host "🤖 Trading Bot Docker Management" -ForegroundColor Green
Write-Host ""
Write-Host "Usage: ./scripts/docker.ps1 <action> [options]" -ForegroundColor Cyan
Write-Host ""
Write-Host "Actions:" -ForegroundColor Yellow
Write-Host " start Start infrastructure services"
Write-Host " stop Stop infrastructure services"
Write-Host " restart Restart infrastructure services"
Write-Host " status Show service status"
Write-Host " logs Show service logs"
Write-Host " reset Reset all data (destructive)"
Write-Host " admin Start admin interfaces"
Write-Host " monitoring Start monitoring stack"
Write-Host " help Show this help"
Write-Host ""
Write-Host "Options:" -ForegroundColor Yellow
Write-Host " -Service Specify a specific service"
Write-Host " -Dev Use development configuration"
Write-Host ""
Write-Host "Examples:" -ForegroundColor Cyan
Write-Host " ./scripts/docker.ps1 start"
Write-Host " ./scripts/docker.ps1 start -Dev"
Write-Host " ./scripts/docker.ps1 logs -Service dragonfly"
Write-Host " ./scripts/docker.ps1 admin"
}
}

View file

@ -1,94 +1,94 @@
param(
[switch]$verbose
)
Write-Host "=== Verifying Build Health ===" -ForegroundColor Green
$errors = @()
$warnings = @()
# Check for common build issues
Write-Host "Checking for common build issues..." -ForegroundColor Yellow
# Check for mismatched .d.ts files in source directories
Write-Host "Checking for .d.ts files in source directories..." -ForegroundColor Blue
$sourceDtsFiles = Get-ChildItem -Path ".\libs\*\src\**\*.d.ts" -Recurse -ErrorAction SilentlyContinue
if ($sourceDtsFiles.Count -gt 0) {
$warnings += "Found .d.ts files in source directories:"
foreach ($file in $sourceDtsFiles) {
$warnings += " - $($file.FullName)"
}
}
# Check for missing dist directories after build
Write-Host "Checking for missing dist directories..." -ForegroundColor Blue
$libraries = @("types", "config", "logger", "utils", "cache", "http")
foreach ($lib in $libraries) {
$distPath = "libs\$lib\dist"
if (-not (Test-Path $distPath)) {
$errors += "Missing dist directory for $lib"
} else {
$indexFile = "$distPath\index.js"
if (-not (Test-Path $indexFile)) {
$errors += "Missing index.js in $lib dist directory"
}
}
}
# Check for stale tsbuildinfo files
Write-Host "Checking for stale tsbuildinfo files..." -ForegroundColor Blue
$tsbuildFiles = Get-ChildItem -Path ".\**\*.tsbuildinfo" -Recurse -ErrorAction SilentlyContinue
if ($tsbuildFiles.Count -gt 0) {
$warnings += "Found stale .tsbuildinfo files:"
foreach ($file in $tsbuildFiles) {
$warnings += " - $($file.FullName)"
}
}
# Check package.json dependencies
Write-Host "Checking package.json files..." -ForegroundColor Blue
$packageFiles = Get-ChildItem -Path ".\**\package.json" -Recurse -ErrorAction SilentlyContinue
foreach ($packageFile in $packageFiles) {
try {
$packageContent = Get-Content $packageFile.FullName | ConvertFrom-Json
if (-not $packageContent.name) {
$errors += "Package.json missing name: $($packageFile.FullName)"
}
if (-not $packageContent.version) {
$warnings += "Package.json missing version: $($packageFile.FullName)"
}
} catch {
$errors += "Invalid package.json: $($packageFile.FullName)"
}
}
# Report results
Write-Host "`n=== Build Health Report ===" -ForegroundColor Green
if ($errors.Count -gt 0) {
Write-Host "❌ ERRORS FOUND:" -ForegroundColor Red
foreach ($error in $errors) {
Write-Host " $error" -ForegroundColor Red
}
}
if ($warnings.Count -gt 0) {
Write-Host "⚠ WARNINGS:" -ForegroundColor Yellow
foreach ($warning in $warnings) {
Write-Host " $warning" -ForegroundColor Yellow
}
}
if ($errors.Count -eq 0 -and $warnings.Count -eq 0) {
Write-Host "✅ No issues found - build environment is healthy!" -ForegroundColor Green
} elseif ($errors.Count -eq 0) {
Write-Host "✅ No critical errors found (only warnings)" -ForegroundColor Green
} else {
Write-Host "❌ Critical errors found - build may fail" -ForegroundColor Red
exit 1
}
Write-Host "`nRecommended commands:" -ForegroundColor Cyan
Write-Host " Clean build: bun run reset" -ForegroundColor Gray
Write-Host " Quick build: bun run build" -ForegroundColor Gray
Write-Host " Clean only: bun run clean:dist" -ForegroundColor Gray
param(
[switch]$verbose
)
Write-Host "=== Verifying Build Health ===" -ForegroundColor Green
$errors = @()
$warnings = @()
# Check for common build issues
Write-Host "Checking for common build issues..." -ForegroundColor Yellow
# Check for mismatched .d.ts files in source directories
Write-Host "Checking for .d.ts files in source directories..." -ForegroundColor Blue
$sourceDtsFiles = Get-ChildItem -Path ".\libs\*\src\**\*.d.ts" -Recurse -ErrorAction SilentlyContinue
if ($sourceDtsFiles.Count -gt 0) {
$warnings += "Found .d.ts files in source directories:"
foreach ($file in $sourceDtsFiles) {
$warnings += " - $($file.FullName)"
}
}
# Check for missing dist directories after build
Write-Host "Checking for missing dist directories..." -ForegroundColor Blue
$libraries = @("types", "config", "logger", "utils", "cache", "http")
foreach ($lib in $libraries) {
$distPath = "libs\$lib\dist"
if (-not (Test-Path $distPath)) {
$errors += "Missing dist directory for $lib"
} else {
$indexFile = "$distPath\index.js"
if (-not (Test-Path $indexFile)) {
$errors += "Missing index.js in $lib dist directory"
}
}
}
# Check for stale tsbuildinfo files
Write-Host "Checking for stale tsbuildinfo files..." -ForegroundColor Blue
$tsbuildFiles = Get-ChildItem -Path ".\**\*.tsbuildinfo" -Recurse -ErrorAction SilentlyContinue
if ($tsbuildFiles.Count -gt 0) {
$warnings += "Found stale .tsbuildinfo files:"
foreach ($file in $tsbuildFiles) {
$warnings += " - $($file.FullName)"
}
}
# Check package.json dependencies
Write-Host "Checking package.json files..." -ForegroundColor Blue
$packageFiles = Get-ChildItem -Path ".\**\package.json" -Recurse -ErrorAction SilentlyContinue
foreach ($packageFile in $packageFiles) {
try {
$packageContent = Get-Content $packageFile.FullName | ConvertFrom-Json
if (-not $packageContent.name) {
$errors += "Package.json missing name: $($packageFile.FullName)"
}
if (-not $packageContent.version) {
$warnings += "Package.json missing version: $($packageFile.FullName)"
}
} catch {
$errors += "Invalid package.json: $($packageFile.FullName)"
}
}
# Report results
Write-Host "`n=== Build Health Report ===" -ForegroundColor Green
if ($errors.Count -gt 0) {
Write-Host "❌ ERRORS FOUND:" -ForegroundColor Red
foreach ($error in $errors) {
Write-Host " $error" -ForegroundColor Red
}
}
if ($warnings.Count -gt 0) {
Write-Host "⚠ WARNINGS:" -ForegroundColor Yellow
foreach ($warning in $warnings) {
Write-Host " $warning" -ForegroundColor Yellow
}
}
if ($errors.Count -eq 0 -and $warnings.Count -eq 0) {
Write-Host "✅ No issues found - build environment is healthy!" -ForegroundColor Green
} elseif ($errors.Count -eq 0) {
Write-Host "✅ No critical errors found (only warnings)" -ForegroundColor Green
} else {
Write-Host "❌ Critical errors found - build may fail" -ForegroundColor Red
exit 1
}
Write-Host "`nRecommended commands:" -ForegroundColor Cyan
Write-Host " Clean build: bun run reset" -ForegroundColor Gray
Write-Host " Quick build: bun run build" -ForegroundColor Gray
Write-Host " Clean only: bun run clean:dist" -ForegroundColor Gray