From d0444c800b99f4c2d27b5ec07a86ac8b58b20049 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 11 Jan 2026 12:27:58 +0000 Subject: [PATCH 01/11] Initial plan From 0625d8c6115cceb3b0c0e9ac49fc2512b17ac748 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 11 Jan 2026 12:32:31 +0000 Subject: [PATCH 02/11] Add directory structure and ML pipeline files Co-authored-by: SolanaRemix <240965752+SolanaRemix@users.noreply.github.com> --- datasets/README.md | 67 ++++++++++ datasets/validation/validate.js | 193 +++++++++++++++++++++++++++ inference/README.md | 60 +++++++++ inference/cli/index.js | 227 ++++++++++++++++++++++++++++++++ models/README.md | 44 +++++++ models/metadata/schema.json | 95 +++++++++++++ scripts/README.md | 82 ++++++++++++ scripts/audit.sh | 217 ++++++++++++++++++++++++++++++ scripts/bootstrap.sh | 115 ++++++++++++++++ scripts/validate-model.sh | 138 +++++++++++++++++++ src/README.md | 73 ++++++++++ tests/README.md | 106 +++++++++++++++ tools/README.md | 88 +++++++++++++ training/README.md | 76 +++++++++++ training/cli/index.js | 48 +++++++ 15 files changed, 1629 insertions(+) create mode 100644 datasets/README.md create mode 100644 datasets/validation/validate.js create mode 100644 inference/README.md create mode 100644 inference/cli/index.js create mode 100644 models/README.md create mode 100644 models/metadata/schema.json create mode 100644 scripts/README.md create mode 100755 scripts/audit.sh create mode 100755 scripts/bootstrap.sh create mode 100755 scripts/validate-model.sh create mode 100644 src/README.md create mode 100644 tests/README.md create mode 100644 tools/README.md create mode 100644 training/README.md create mode 100644 training/cli/index.js diff --git a/datasets/README.md b/datasets/README.md new file mode 100644 index 0000000..79af210 --- /dev/null +++ b/datasets/README.md @@ -0,0 +1,67 @@ +# Datasets + +This directory contains dataset validation scripts and dataset management infrastructure for SmartBrain. + +## Structure + +``` +/datasets + /validation # Dataset validation scripts +``` + +## Overview + +The datasets directory provides: +- Dataset validation and quality checks +- Schema validation +- Data integrity verification +- Dataset versioning support + +## Dataset Validation + +The validation subdirectory contains scripts for: +- Schema validation +- Data type checking +- Missing value detection +- Outlier identification +- Statistical analysis +- Format verification + +Example usage: +```bash +node datasets/validation/validate.js --dataset path/to/data.json --schema path/to/schema.json +``` + +## Dataset Requirements + +Datasets should include: +- Proper formatting (JSON, CSV, etc.) +- Schema documentation +- Metadata (source, version, date) +- Train/validation/test splits +- Quality metrics + +## Validation Rules + +Datasets are validated against: +- Schema definitions +- Data type constraints +- Required fields +- Value ranges +- Consistency checks + +## Integration + +Dataset validation integrates with: +- Training pipeline (`/training`) +- Model registry (`/models`) +- Inference engine (`/inference`) + +## Best Practices + +- Validate datasets before training +- Document dataset versions +- Track data quality metrics +- Maintain data lineage +- Use consistent formats +- Include metadata diff --git a/datasets/validation/validate.js b/datasets/validation/validate.js new file mode 100644 index 0000000..c05956a --- /dev/null +++ b/datasets/validation/validate.js @@ -0,0 +1,193 @@ +#!/usr/bin/env node + +/** + * Dataset Validation Script + * + * Validates datasets against defined schemas and performs quality checks. + * + * Usage: + * node datasets/validation/validate.js --dataset --schema + */ + +const fs = require('fs'); +const path = require('path'); + +// Parse command line arguments +function parseArgs() { + const args = process.argv.slice(2); + const config = { + dataset: null, + schema: null, + verbose: false + }; + + for (let i = 0; i < args.length; i++) { + if (args[i] === '--dataset' && i + 1 < args.length) { + config.dataset = args[i + 1]; + i++; + } else if (args[i] === '--schema' && i + 1 < args.length) { + config.schema = args[i + 1]; + i++; + } else if (args[i] === '--verbose' || args[i] === '-v') { + config.verbose = true; + } + } + + return config; +} + +// Load JSON file +function loadJSON(filePath) { + try { + const content = fs.readFileSync(filePath, 'utf8'); + return JSON.parse(content); + } catch (error) { + console.error(`Error loading ${filePath}: ${error.message}`); + process.exit(1); + } +} + +// Validate dataset structure +function validateStructure(dataset, schema) { + const errors = []; + + // Check if dataset is an array or object + if (!Array.isArray(dataset) && typeof dataset !== 'object') { + errors.push('Dataset must be an array or object'); + return errors; + } + + // If schema is provided, validate required fields + if (schema && schema.required) { + const items = Array.isArray(dataset) ? dataset : [dataset]; + + items.forEach((item, index) => { + schema.required.forEach(field => { + if (!(field in item)) { + errors.push(`Missing required field '${field}' at index ${index}`); + } + }); + }); + } + + return errors; +} + +// Check for missing values +function checkMissingValues(dataset) { + const warnings = []; + const items = Array.isArray(dataset) ? dataset : [dataset]; + + items.forEach((item, index) => { + Object.entries(item).forEach(([key, value]) => { + if (value === null || value === undefined || value === '') { + warnings.push(`Missing or empty value for '${key}' at index ${index}`); + } + }); + }); + + return warnings; +} + +// Calculate basic statistics +function calculateStats(dataset) { + const items = Array.isArray(dataset) ? dataset : [dataset]; + + return { + totalRecords: items.length, + fields: items.length > 0 ? Object.keys(items[0]).length : 0, + fieldNames: items.length > 0 ? Object.keys(items[0]) : [] + }; +} + +// Main validation function +function validate(datasetPath, schemaPath, verbose) { + console.log('========================================'); + console.log(' Dataset Validation'); + console.log('========================================\n'); + + console.log(`Dataset: ${datasetPath}`); + if (schemaPath) { + console.log(`Schema: ${schemaPath}`); + } + console.log(''); + + // Load dataset + const dataset = loadJSON(datasetPath); + + // Load schema if provided + let schema = null; + if (schemaPath) { + schema = loadJSON(schemaPath); + } + + // Calculate statistics + const stats = calculateStats(dataset); + console.log('Dataset Statistics:'); + console.log(` Total records: ${stats.totalRecords}`); + console.log(` Number of fields: ${stats.fields}`); + if (verbose && stats.fieldNames.length > 0) { + console.log(` Field names: ${stats.fieldNames.join(', ')}`); + } + console.log(''); + + // Validate structure + console.log('Validating structure...'); + const structureErrors = validateStructure(dataset, schema); + if (structureErrors.length === 0) { + console.log(' ✓ Structure validation passed'); + } else { + console.log(` ✗ Found ${structureErrors.length} error(s):`); + structureErrors.forEach(err => console.log(` - ${err}`)); + } + console.log(''); + + // Check for missing values + console.log('Checking for missing values...'); + const missingWarnings = checkMissingValues(dataset); + if (missingWarnings.length === 0) { + console.log(' ✓ No missing values found'); + } else { + console.log(` ⚠ Found ${missingWarnings.length} missing value(s):`); + if (verbose) { + missingWarnings.forEach(warn => console.log(` - ${warn}`)); + } else { + console.log(` (use --verbose to see details)`); + } + } + console.log(''); + + // Summary + console.log('========================================'); + console.log(' Validation Summary'); + console.log('========================================'); + console.log(`Errors: ${structureErrors.length}`); + console.log(`Warnings: ${missingWarnings.length}`); + console.log(''); + + if (structureErrors.length === 0) { + console.log('✓ Dataset validation passed!'); + process.exit(0); + } else { + console.log('✗ Dataset validation failed'); + process.exit(1); + } +} + +// Main execution +if (require.main === module) { + const config = parseArgs(); + + if (!config.dataset) { + console.error('Error: --dataset argument is required'); + console.log('\nUsage:'); + console.log(' node datasets/validation/validate.js --dataset [--schema ] [--verbose]'); + console.log('\nExample:'); + console.log(' node datasets/validation/validate.js --dataset data.json --schema schema.json'); + process.exit(1); + } + + validate(config.dataset, config.schema, config.verbose); +} + +module.exports = { validate, validateStructure, checkMissingValues, calculateStats }; diff --git a/inference/README.md b/inference/README.md new file mode 100644 index 0000000..70f038c --- /dev/null +++ b/inference/README.md @@ -0,0 +1,60 @@ +# Inference + +This directory contains the inference engine, CLI commands, and API endpoints for running model predictions in SmartBrain. + +## Structure + +``` +/inference + /engine # Inference engine core + /cli # CLI commands for inference + /api # API endpoints for inference +``` + +## Overview + +The inference directory provides: +- High-performance inference engine +- Command-line interface for running predictions +- REST API endpoints for model serving +- Batch and real-time inference support + +## Inference Engine + +The engine subdirectory contains the core inference logic, model loading, and prediction execution. + +## CLI Interface + +The CLI subdirectory provides command-line tools for: +- Running single predictions +- Batch inference +- Model benchmarking +- Performance profiling + +Example: +```bash +node inference/cli/index.js predict --model my-model --input data.json +``` + +## API Endpoints + +The API subdirectory contains REST API endpoints for: +- Real-time predictions +- Batch processing +- Model health checks +- Performance monitoring + +## Integration + +Inference components integrate with: +- Model registry (`/models`) +- Training outputs (`/training`) +- Validation datasets (`/datasets`) + +## Performance + +The inference engine is optimized for: +- Low latency predictions +- High throughput batch processing +- Efficient memory usage +- Multi-model serving diff --git a/inference/cli/index.js b/inference/cli/index.js new file mode 100644 index 0000000..d5c9930 --- /dev/null +++ b/inference/cli/index.js @@ -0,0 +1,227 @@ +#!/usr/bin/env node + +/** + * SmartBrain Inference CLI + * + * Command-line interface for running model inference. + * + * Usage: + * node inference/cli/index.js [options] + * + * Commands: + * predict Run prediction on input data + * batch Run batch inference + * benchmark Benchmark model performance + * info Display model information + */ + +const fs = require('fs'); +const path = require('path'); + +// Parse command line arguments +function parseArgs() { + const args = process.argv.slice(2); + + if (args.length === 0) { + return { command: 'help' }; + } + + const command = args[0]; + const options = {}; + + for (let i = 1; i < args.length; i++) { + if (args[i].startsWith('--')) { + const key = args[i].slice(2); + const value = args[i + 1] && !args[i + 1].startsWith('--') ? args[i + 1] : true; + options[key] = value; + if (value !== true) i++; + } + } + + return { command, options }; +} + +// Display help +function showHelp() { + console.log('SmartBrain Inference CLI\n'); + console.log('Usage:'); + console.log(' node inference/cli/index.js [options]\n'); + console.log('Commands:'); + console.log(' predict Run prediction on input data'); + console.log(' --model Path to model directory'); + console.log(' --input Path to input data (JSON)'); + console.log(' --output Path to save results (optional)\n'); + console.log(' batch Run batch inference'); + console.log(' --model Path to model directory'); + console.log(' --input Path to input data batch'); + console.log(' --output Path to save results'); + console.log(' --batch-size Batch size (default: 32)\n'); + console.log(' benchmark Benchmark model performance'); + console.log(' --model Path to model directory'); + console.log(' --iterations Number of iterations (default: 100)\n'); + console.log(' info Display model information'); + console.log(' --model Path to model directory\n'); + console.log('Examples:'); + console.log(' node inference/cli/index.js predict --model models/my-model --input data.json'); + console.log(' node inference/cli/index.js batch --model models/my-model --input batch.json --output results.json'); + console.log(' node inference/cli/index.js benchmark --model models/my-model --iterations 1000'); + console.log(' node inference/cli/index.js info --model models/my-model'); +} + +// Load model metadata +function loadModelMetadata(modelPath) { + const metadataPath = path.join(modelPath, 'metadata.json'); + + if (!fs.existsSync(metadataPath)) { + throw new Error(`Model metadata not found at ${metadataPath}`); + } + + const content = fs.readFileSync(metadataPath, 'utf8'); + return JSON.parse(content); +} + +// Run prediction +function predict(options) { + console.log('Running prediction...\n'); + + if (!options.model || !options.input) { + console.error('Error: --model and --input are required'); + console.log('Usage: predict --model --input [--output ]'); + process.exit(1); + } + + // Load model metadata + const metadata = loadModelMetadata(options.model); + console.log(`Model: ${metadata.name} v${metadata.version}`); + console.log(`Framework: ${metadata.framework}`); + console.log(`Task: ${metadata.task}\n`); + + // Load input data + const inputData = JSON.parse(fs.readFileSync(options.input, 'utf8')); + console.log('Input data loaded'); + + // Placeholder for actual inference + console.log('\n⚠ Note: Actual inference engine not yet implemented'); + console.log('This is a placeholder that demonstrates the CLI structure.'); + console.log('\nPrediction would process the input through the model here.'); + + if (options.output) { + const result = { + model: metadata.name, + version: metadata.version, + input: inputData, + prediction: 'placeholder_result', + timestamp: new Date().toISOString() + }; + fs.writeFileSync(options.output, JSON.stringify(result, null, 2)); + console.log(`\nResults saved to ${options.output}`); + } +} + +// Run batch inference +function batchInference(options) { + console.log('Running batch inference...\n'); + + if (!options.model || !options.input) { + console.error('Error: --model and --input are required'); + console.log('Usage: batch --model --input --output [--batch-size ]'); + process.exit(1); + } + + const batchSize = parseInt(options['batch-size']) || 32; + const metadata = loadModelMetadata(options.model); + + console.log(`Model: ${metadata.name} v${metadata.version}`); + console.log(`Batch size: ${batchSize}\n`); + + console.log('⚠ Note: Batch inference engine not yet implemented'); + console.log('This would process multiple inputs efficiently in batches.'); +} + +// Benchmark model +function benchmark(options) { + console.log('Benchmarking model...\n'); + + if (!options.model) { + console.error('Error: --model is required'); + console.log('Usage: benchmark --model [--iterations ]'); + process.exit(1); + } + + const iterations = parseInt(options.iterations) || 100; + const metadata = loadModelMetadata(options.model); + + console.log(`Model: ${metadata.name} v${metadata.version}`); + console.log(`Iterations: ${iterations}\n`); + + console.log('⚠ Note: Benchmarking not yet implemented'); + console.log('This would measure inference latency and throughput.'); +} + +// Display model info +function showInfo(options) { + if (!options.model) { + console.error('Error: --model is required'); + console.log('Usage: info --model '); + process.exit(1); + } + + const metadata = loadModelMetadata(options.model); + + console.log('========================================'); + console.log(' Model Information'); + console.log('========================================\n'); + + console.log(`Name: ${metadata.name}`); + console.log(`Version: ${metadata.version}`); + console.log(`Framework: ${metadata.framework}`); + console.log(`Task: ${metadata.task}`); + + if (metadata.description) { + console.log(`Description: ${metadata.description}`); + } + + if (metadata.author) { + console.log(`Author: ${metadata.author}`); + } + + if (metadata.metrics) { + console.log('\nMetrics:'); + Object.entries(metadata.metrics).forEach(([key, value]) => { + console.log(` ${key}: ${value}`); + }); + } + + console.log(''); +} + +// Main execution +if (require.main === module) { + const { command, options } = parseArgs(); + + try { + switch (command) { + case 'predict': + predict(options); + break; + case 'batch': + batchInference(options); + break; + case 'benchmark': + benchmark(options); + break; + case 'info': + showInfo(options); + break; + case 'help': + default: + showHelp(); + break; + } + } catch (error) { + console.error(`Error: ${error.message}`); + process.exit(1); + } +} + +module.exports = { predict, batchInference, benchmark, showInfo }; diff --git a/models/README.md b/models/README.md new file mode 100644 index 0000000..931f931 --- /dev/null +++ b/models/README.md @@ -0,0 +1,44 @@ +# Models + +This directory contains the ML model registry, metadata, and versioning infrastructure for SmartBrain. + +## Structure + +``` +/models + /registry # Model registry and versioning + /metadata # Model metadata schemas +``` + +## Overview + +The models directory manages: +- Model versioning and lifecycle +- Model metadata and schemas +- Model registry for tracking trained models +- Model performance metrics + +## Model Registry + +The registry subdirectory contains the infrastructure for tracking and managing different model versions across the SmartBrain ecosystem. + +## Model Metadata + +The metadata subdirectory contains JSON schemas and validation rules for model metadata, ensuring consistent model documentation and tracking. + +## Usage + +Models are registered with metadata including: +- Model name and version +- Framework (TensorFlow, PyTorch, etc.) +- Task type (classification, generation, etc.) +- Performance metrics +- Training information +- Dependencies + +## Integration + +Models in this registry integrate with: +- Inference engine (`/inference`) +- Training pipeline (`/training`) +- Dataset validation (`/datasets`) diff --git a/models/metadata/schema.json b/models/metadata/schema.json new file mode 100644 index 0000000..67654fe --- /dev/null +++ b/models/metadata/schema.json @@ -0,0 +1,95 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "title": "SmartBrain Model Metadata Schema", + "description": "Schema for model metadata in the SmartBrain ecosystem", + "properties": { + "name": { + "type": "string", + "description": "The name of the model" + }, + "version": { + "type": "string", + "description": "The version of the model (semver format)", + "pattern": "^\\d+\\.\\d+\\.\\d+$" + }, + "description": { + "type": "string", + "description": "A brief description of the model" + }, + "author": { + "type": "string", + "description": "The author or creator of the model" + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "When the model was created" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "description": "When the model was last updated" + }, + "framework": { + "type": "string", + "description": "The ML framework used (e.g., TensorFlow, PyTorch, scikit-learn)", + "enum": ["tensorflow", "pytorch", "scikit-learn", "onnx", "keras", "jax", "other"] + }, + "task": { + "type": "string", + "description": "The type of ML task (e.g., classification, regression, generation)", + "enum": ["classification", "regression", "generation", "detection", "segmentation", "clustering", "other"] + }, + "metrics": { + "type": "object", + "description": "Performance metrics for the model", + "properties": { + "accuracy": { "type": "number", "minimum": 0, "maximum": 1 }, + "precision": { "type": "number", "minimum": 0, "maximum": 1 }, + "recall": { "type": "number", "minimum": 0, "maximum": 1 }, + "f1_score": { "type": "number", "minimum": 0, "maximum": 1 }, + "loss": { "type": "number", "minimum": 0 } + } + }, + "input_shape": { + "type": "array", + "description": "The expected input shape for the model", + "items": { "type": "integer" } + }, + "output_shape": { + "type": "array", + "description": "The output shape of the model", + "items": { "type": "integer" } + }, + "training_dataset": { + "type": "string", + "description": "The dataset used for training" + }, + "hyperparameters": { + "type": "object", + "description": "Hyperparameters used during training" + }, + "dependencies": { + "type": "object", + "description": "Required dependencies and their versions", + "properties": { + "python": { "type": "string" }, + "packages": { + "type": "object", + "additionalProperties": { "type": "string" } + } + } + }, + "tags": { + "type": "array", + "description": "Tags for categorizing the model", + "items": { "type": "string" } + }, + "license": { + "type": "string", + "description": "The license under which the model is released" + } + }, + "required": ["name", "version", "framework", "task"] +} diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000..48ae1cc --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,82 @@ +# Scripts + +This directory contains utility scripts for bootstrapping, auditing, and validating SmartBrain infrastructure. + +## Available Scripts + +### bootstrap.sh +Bootstraps the SmartBrain infrastructure by: +- Checking dependencies +- Setting up directories +- Installing required packages +- Configuring environment +- Validating setup + +Usage: +```bash +./scripts/bootstrap.sh +``` + +### audit.sh +Audits the SmartBrain setup and configurations: +- Validates directory structure +- Checks file permissions +- Verifies configurations +- Tests integrations +- Generates audit report + +Usage: +```bash +./scripts/audit.sh +``` + +### validate-model.sh +Validates model files and metadata: +- Checks model format +- Validates metadata schema +- Verifies model integrity +- Tests model loading +- Checks dependencies + +Usage: +```bash +./scripts/validate-model.sh path/to/model +``` + +## Usage Guidelines + +1. Make scripts executable: + ```bash + chmod +x scripts/*.sh + ``` + +2. Run bootstrap first on new setups: + ```bash + ./scripts/bootstrap.sh + ``` + +3. Run audit to verify setup: + ```bash + ./scripts/audit.sh + ``` + +4. Validate models before deployment: + ```bash + ./scripts/validate-model.sh models/my-model + ``` + +## Integration + +Scripts integrate with: +- GitHub Actions workflows +- CI/CD pipelines +- Local development environment +- Model deployment process + +## Best Practices + +- Run bootstrap.sh on initial setup +- Run audit.sh regularly to verify integrity +- Validate all models before deployment +- Review audit reports +- Keep scripts updated diff --git a/scripts/audit.sh b/scripts/audit.sh new file mode 100755 index 0000000..ea04723 --- /dev/null +++ b/scripts/audit.sh @@ -0,0 +1,217 @@ +#!/bin/bash + +# SmartBrain Audit Script +# This script audits the SmartBrain infrastructure setup + +set -e + +echo "======================================" +echo " SmartBrain Infrastructure Audit" +echo "======================================" +echo "" + +# Colors for output +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +RED='\033[0;31m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +PASS_COUNT=0 +WARN_COUNT=0 +FAIL_COUNT=0 + +# Helper functions +check_pass() { + echo -e "${GREEN}✓ $1${NC}" + ((PASS_COUNT++)) +} + +check_warn() { + echo -e "${YELLOW}⚠ $1${NC}" + ((WARN_COUNT++)) +} + +check_fail() { + echo -e "${RED}✗ $1${NC}" + ((FAIL_COUNT++)) +} + +# Check directory structure +echo -e "${BLUE}Checking directory structure...${NC}" +REQUIRED_DIRS=( + "models/registry" + "models/metadata" + "inference/engine" + "inference/cli" + "inference/api" + "training/pipeline" + "training/configs" + "datasets/validation" + "scripts" + "src/core" + "src/utils" + "tests/unit" + "tests/integration" + "tools/ml-helpers" + ".github/workflows" +) + +for dir in "${REQUIRED_DIRS[@]}"; do + if [ -d "$dir" ]; then + check_pass "Directory exists: $dir" + else + check_fail "Directory missing: $dir" + fi +done + +# Check required files +echo "" +echo -e "${BLUE}Checking required files...${NC}" +REQUIRED_FILES=( + "package.json" + "README.md" + ".gitignore" + "LICENSE" +) + +for file in "${REQUIRED_FILES[@]}"; do + if [ -f "$file" ]; then + check_pass "File exists: $file" + else + check_fail "File missing: $file" + fi +done + +# Check documentation +echo "" +echo -e "${BLUE}Checking documentation...${NC}" +DOC_FILES=( + "SECURITY.md" + "CONTRIBUTING.md" + "CODE_OF_CONDUCT.md" + "docs/index.md" +) + +for file in "${DOC_FILES[@]}"; do + if [ -f "$file" ]; then + check_pass "Documentation exists: $file" + else + check_warn "Documentation missing: $file" + fi +done + +# Check workflows +echo "" +echo -e "${BLUE}Checking GitHub Actions workflows...${NC}" +WORKFLOW_FILES=( + ".github/workflows/ci.yml" + ".github/workflows/lint.yml" + ".github/workflows/codeql.yml" +) + +for file in "${WORKFLOW_FILES[@]}"; do + if [ -f "$file" ]; then + check_pass "Workflow exists: $file" + else + check_warn "Workflow missing: $file" + fi +done + +# Check agent configuration +echo "" +echo -e "${BLUE}Checking agent configuration...${NC}" +if [ -f ".github/copilot/agent.yaml" ]; then + check_pass "Agent configuration exists" +else + check_warn "Agent configuration missing: .github/copilot/agent.yaml" +fi + +# Check Node.js setup +echo "" +echo -e "${BLUE}Checking Node.js setup...${NC}" +if command -v node &> /dev/null; then + NODE_VERSION=$(node -v) + check_pass "Node.js installed: $NODE_VERSION" +else + check_fail "Node.js not installed" +fi + +if command -v npm &> /dev/null; then + NPM_VERSION=$(npm -v) + check_pass "npm installed: $NPM_VERSION" +else + check_fail "npm not installed" +fi + +# Check dependencies +echo "" +echo -e "${BLUE}Checking dependencies...${NC}" +if [ -f "package.json" ]; then + if [ -d "node_modules" ]; then + check_pass "Dependencies installed" + else + check_warn "Dependencies not installed (run: npm install)" + fi +fi + +# Check environment configuration +echo "" +echo -e "${BLUE}Checking environment configuration...${NC}" +if [ -f ".env" ]; then + check_pass ".env file exists" +else + if [ -f ".env.example" ]; then + check_warn ".env file missing (template available at .env.example)" + else + check_warn ".env and .env.example files missing" + fi +fi + +# Check model metadata schema +echo "" +echo -e "${BLUE}Checking ML infrastructure...${NC}" +if [ -f "models/metadata/schema.json" ]; then + check_pass "Model metadata schema exists" +else + check_warn "Model metadata schema missing" +fi + +# Check scripts +echo "" +echo -e "${BLUE}Checking utility scripts...${NC}" +SCRIPTS=( + "scripts/bootstrap.sh" + "scripts/audit.sh" + "scripts/validate-model.sh" +) + +for script in "${SCRIPTS[@]}"; do + if [ -f "$script" ]; then + if [ -x "$script" ]; then + check_pass "Script exists and is executable: $script" + else + check_warn "Script exists but not executable: $script (run: chmod +x $script)" + fi + else + check_warn "Script missing: $script" + fi +done + +# Summary +echo "" +echo "======================================" +echo " Audit Summary" +echo "======================================" +echo -e "${GREEN}Passed: $PASS_COUNT${NC}" +echo -e "${YELLOW}Warnings: $WARN_COUNT${NC}" +echo -e "${RED}Failed: $FAIL_COUNT${NC}" +echo "" + +if [ "$FAIL_COUNT" -eq 0 ]; then + echo -e "${GREEN}✓ Audit completed successfully!${NC}" + exit 0 +else + echo -e "${RED}✗ Audit found critical issues${NC}" + exit 1 +fi diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh new file mode 100755 index 0000000..d7159ab --- /dev/null +++ b/scripts/bootstrap.sh @@ -0,0 +1,115 @@ +#!/bin/bash + +# SmartBrain Bootstrap Script +# This script initializes the SmartBrain infrastructure + +set -e + +echo "======================================" +echo " SmartBrain Infrastructure Bootstrap" +echo "======================================" +echo "" + +# Colors for output +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +RED='\033[0;31m' +NC='\033[0m' # No Color + +# Check if Node.js is installed +echo "Checking dependencies..." +if ! command -v node &> /dev/null; then + echo -e "${RED}Error: Node.js is not installed${NC}" + echo "Please install Node.js >= 16.0.0" + exit 1 +fi + +NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1) +if [ "$NODE_VERSION" -lt 16 ]; then + echo -e "${RED}Error: Node.js version must be >= 16.0.0${NC}" + echo "Current version: $(node -v)" + exit 1 +fi + +echo -e "${GREEN}✓ Node.js $(node -v) detected${NC}" + +# Check if npm is installed +if ! command -v npm &> /dev/null; then + echo -e "${RED}Error: npm is not installed${NC}" + exit 1 +fi + +echo -e "${GREEN}✓ npm $(npm -v) detected${NC}" + +# Create required directories if they don't exist +echo "" +echo "Setting up directory structure..." +mkdir -p models/registry models/metadata +mkdir -p inference/engine inference/cli inference/api +mkdir -p training/pipeline training/configs +mkdir -p datasets/validation +mkdir -p src/core src/utils +mkdir -p tests/unit tests/integration +mkdir -p tools/ml-helpers +mkdir -p .github/workflows .github/copilot + +echo -e "${GREEN}✓ Directory structure created${NC}" + +# Install dependencies +echo "" +echo "Installing dependencies..." +if [ -f "package.json" ]; then + npm install + echo -e "${GREEN}✓ Dependencies installed${NC}" +else + echo -e "${YELLOW}⚠ package.json not found, skipping dependency installation${NC}" +fi + +# Create .env file if it doesn't exist +if [ ! -f ".env" ]; then + if [ -f ".env.example" ]; then + echo "" + echo "Creating .env file from .env.example..." + cp .env.example .env + echo -e "${GREEN}✓ .env file created${NC}" + echo -e "${YELLOW}⚠ Please update .env with your configuration${NC}" + fi +fi + +# Verify model metadata schema +echo "" +echo "Verifying model metadata schema..." +if [ -f "models/metadata/schema.json" ]; then + echo -e "${GREEN}✓ Model metadata schema exists${NC}" +else + echo -e "${YELLOW}⚠ Model metadata schema not found${NC}" +fi + +# Check for required workflows +echo "" +echo "Checking GitHub Actions workflows..." +WORKFLOW_COUNT=$(find .github/workflows -name "*.yml" -o -name "*.yaml" 2>/dev/null | wc -l) +if [ "$WORKFLOW_COUNT" -gt 0 ]; then + echo -e "${GREEN}✓ Found $WORKFLOW_COUNT workflow(s)${NC}" +else + echo -e "${YELLOW}⚠ No workflows found in .github/workflows/${NC}" +fi + +# Verify scripts are executable +echo "" +echo "Setting script permissions..." +chmod +x scripts/*.sh 2>/dev/null || true +echo -e "${GREEN}✓ Script permissions set${NC}" + +# Final summary +echo "" +echo "======================================" +echo " Bootstrap Complete!" +echo "======================================" +echo "" +echo "Next steps:" +echo "1. Update .env with your configuration" +echo "2. Run: npm test (to verify setup)" +echo "3. Run: ./scripts/audit.sh (to audit setup)" +echo "4. Start developing!" +echo "" diff --git a/scripts/validate-model.sh b/scripts/validate-model.sh new file mode 100755 index 0000000..e523751 --- /dev/null +++ b/scripts/validate-model.sh @@ -0,0 +1,138 @@ +#!/bin/bash + +# SmartBrain Model Validation Script +# This script validates model files and metadata + +set -e + +# Colors for output +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +RED='\033[0;31m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +# Check if model path is provided +if [ -z "$1" ]; then + echo -e "${RED}Error: Model path required${NC}" + echo "Usage: ./validate-model.sh " + echo "Example: ./validate-model.sh models/my-model" + exit 1 +fi + +MODEL_PATH=$1 + +echo "======================================" +echo " SmartBrain Model Validation" +echo "======================================" +echo "" +echo "Model path: $MODEL_PATH" +echo "" + +PASS_COUNT=0 +FAIL_COUNT=0 + +# Helper functions +check_pass() { + echo -e "${GREEN}✓ $1${NC}" + ((PASS_COUNT++)) +} + +check_fail() { + echo -e "${RED}✗ $1${NC}" + ((FAIL_COUNT++)) +} + +# Check if model directory exists +echo -e "${BLUE}Checking model directory...${NC}" +if [ -d "$MODEL_PATH" ]; then + check_pass "Model directory exists" +else + check_fail "Model directory not found: $MODEL_PATH" + exit 1 +fi + +# Check for metadata file +echo "" +echo -e "${BLUE}Checking model metadata...${NC}" +METADATA_FILE="$MODEL_PATH/metadata.json" +if [ -f "$METADATA_FILE" ]; then + check_pass "Metadata file exists" + + # Validate JSON format + if command -v node &> /dev/null; then + if node -e "JSON.parse(require('fs').readFileSync('$METADATA_FILE', 'utf8'))" 2>/dev/null; then + check_pass "Metadata is valid JSON" + else + check_fail "Metadata is not valid JSON" + fi + + # Check required fields + HAS_NAME=$(node -e "const m = JSON.parse(require('fs').readFileSync('$METADATA_FILE', 'utf8')); console.log(!!m.name)" 2>/dev/null) + HAS_VERSION=$(node -e "const m = JSON.parse(require('fs').readFileSync('$METADATA_FILE', 'utf8')); console.log(!!m.version)" 2>/dev/null) + HAS_FRAMEWORK=$(node -e "const m = JSON.parse(require('fs').readFileSync('$METADATA_FILE', 'utf8')); console.log(!!m.framework)" 2>/dev/null) + HAS_TASK=$(node -e "const m = JSON.parse(require('fs').readFileSync('$METADATA_FILE', 'utf8')); console.log(!!m.task)" 2>/dev/null) + + if [ "$HAS_NAME" = "true" ]; then + check_pass "Metadata has 'name' field" + else + check_fail "Metadata missing 'name' field" + fi + + if [ "$HAS_VERSION" = "true" ]; then + check_pass "Metadata has 'version' field" + else + check_fail "Metadata missing 'version' field" + fi + + if [ "$HAS_FRAMEWORK" = "true" ]; then + check_pass "Metadata has 'framework' field" + else + check_fail "Metadata missing 'framework' field" + fi + + if [ "$HAS_TASK" = "true" ]; then + check_pass "Metadata has 'task' field" + else + check_fail "Metadata missing 'task' field" + fi + fi +else + check_fail "Metadata file not found: $METADATA_FILE" +fi + +# Check for model files +echo "" +echo -e "${BLUE}Checking model files...${NC}" +MODEL_FILES=$(find "$MODEL_PATH" -type f \( -name "*.h5" -o -name "*.pb" -o -name "*.pth" -o -name "*.pt" -o -name "*.onnx" -o -name "*.pkl" \) 2>/dev/null | wc -l) +if [ "$MODEL_FILES" -gt 0 ]; then + check_pass "Found $MODEL_FILES model file(s)" +else + check_fail "No model files found (looking for .h5, .pb, .pth, .pt, .onnx, .pkl)" +fi + +# Check for README +echo "" +echo -e "${BLUE}Checking documentation...${NC}" +if [ -f "$MODEL_PATH/README.md" ]; then + check_pass "Model README exists" +else + check_fail "Model README not found" +fi + +# Summary +echo "" +echo "======================================" +echo " Validation Summary" +echo "======================================" +echo -e "${GREEN}Passed: $PASS_COUNT${NC}" +echo -e "${RED}Failed: $FAIL_COUNT${NC}" +echo "" + +if [ "$FAIL_COUNT" -eq 0 ]; then + echo -e "${GREEN}✓ Model validation passed!${NC}" + exit 0 +else + echo -e "${RED}✗ Model validation failed${NC}" + exit 1 +fi diff --git a/src/README.md b/src/README.md new file mode 100644 index 0000000..b2c0162 --- /dev/null +++ b/src/README.md @@ -0,0 +1,73 @@ +# Source Code + +This directory contains the core logic and utilities for SmartBrain. + +## Structure + +``` +/src + /core # Core business logic + /utils # Utility functions and helpers +``` + +## Overview + +The src directory provides: +- Core SmartBrain functionality +- Reusable utility functions +- Common helpers +- Shared components + +## Core + +The core subdirectory contains: +- Main application logic +- Business rules +- Domain models +- Service implementations +- Integration points + +## Utils + +The utils subdirectory contains: +- File I/O utilities +- Data transformation helpers +- Logging utilities +- Configuration loaders +- Common validators +- String/array helpers +- Date/time utilities + +## Design Principles + +- **Modularity**: Components should be loosely coupled +- **Reusability**: Write DRY (Don't Repeat Yourself) code +- **Testability**: All code should be unit testable +- **Documentation**: Document public APIs +- **Error Handling**: Graceful error handling throughout + +## Usage + +Import core functionality: +```javascript +const { ModelManager } = require('./src/core/model-manager'); +const { validateInput } = require('./src/utils/validators'); +``` + +## Integration + +Source code integrates with: +- Bots (`/bots`) +- Models (`/models`) +- Inference (`/inference`) +- Training (`/training`) +- All other components + +## Best Practices + +- Keep functions small and focused +- Write comprehensive tests +- Use meaningful variable names +- Add JSDoc comments for public APIs +- Handle errors appropriately +- Follow project coding standards diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000..5e27876 --- /dev/null +++ b/tests/README.md @@ -0,0 +1,106 @@ +# Tests + +This directory contains unit and integration tests for SmartBrain. + +## Structure + +``` +/tests + /unit # Unit tests for individual components + /integration # Integration tests for system interactions +``` + +## Overview + +The tests directory provides: +- Comprehensive test coverage +- Unit tests for isolated components +- Integration tests for system flows +- Test utilities and fixtures +- Mock data and helpers + +## Unit Tests + +The unit subdirectory contains: +- Component-level tests +- Function-level tests +- Isolated logic tests +- Mock-based testing + +Example: +```javascript +// tests/unit/model-validator.test.js +describe('ModelValidator', () => { + it('should validate model metadata', () => { + // test implementation + }); +}); +``` + +## Integration Tests + +The integration subdirectory contains: +- End-to-end workflow tests +- API integration tests +- Database integration tests +- Multi-component tests + +Example: +```javascript +// tests/integration/inference-pipeline.test.js +describe('Inference Pipeline', () => { + it('should load model and make predictions', async () => { + // test implementation + }); +}); +``` + +## Running Tests + +Run all tests: +```bash +npm test +``` + +Run unit tests only: +```bash +npm run test:unit +``` + +Run integration tests only: +```bash +npm run test:integration +``` + +Run with coverage: +```bash +npm run test:coverage +``` + +## Test Structure + +Each test file should: +- Import dependencies +- Set up test fixtures +- Define test cases +- Clean up after tests +- Use descriptive test names + +## Best Practices + +- Write tests for all new code +- Aim for high code coverage (>80%) +- Use descriptive test names +- Keep tests independent +- Use setup/teardown appropriately +- Mock external dependencies +- Test edge cases and error conditions +- Keep tests fast and reliable + +## Integration + +Tests integrate with: +- CI/CD workflows +- Code coverage tools +- Linting and formatting +- All application components diff --git a/tools/README.md b/tools/README.md new file mode 100644 index 0000000..a6915c8 --- /dev/null +++ b/tools/README.md @@ -0,0 +1,88 @@ +# Tools + +This directory contains ML helper utilities and development tools for SmartBrain. + +## Structure + +``` +/tools + /ml-helpers # ML helper utilities +``` + +## Overview + +The tools directory provides: +- ML-specific helper utilities +- Data processing tools +- Model evaluation tools +- Debugging utilities +- Development helpers + +## ML Helpers + +The ml-helpers subdirectory contains: +- Data preprocessing utilities +- Feature engineering tools +- Model evaluation helpers +- Metrics calculation +- Visualization tools +- Debugging utilities + +Example utilities: +- Data normalization +- Feature scaling +- Confusion matrix generation +- ROC curve plotting +- Model comparison tools +- Performance profiling + +## Usage + +Import ML helpers: +```javascript +const { normalizeData } = require('./tools/ml-helpers/preprocessing'); +const { calculateMetrics } = require('./tools/ml-helpers/metrics'); +``` + +## Available Tools + +### Data Processing +- Data cleaning +- Normalization/standardization +- Feature extraction +- Data augmentation + +### Model Evaluation +- Metrics calculation (accuracy, precision, recall, F1) +- Confusion matrix +- ROC/AUC analysis +- Cross-validation helpers + +### Visualization +- Training curves +- Model performance plots +- Data distribution plots +- Feature importance charts + +### Debugging +- Model inspection +- Activation visualization +- Gradient checking +- Performance profiling + +## Best Practices + +- Use type checking for inputs +- Document helper functions +- Write unit tests for utilities +- Keep helpers focused and reusable +- Handle edge cases +- Provide clear error messages + +## Integration + +Tools integrate with: +- Training pipeline (`/training`) +- Inference engine (`/inference`) +- Dataset validation (`/datasets`) +- Testing framework (`/tests`) diff --git a/training/README.md b/training/README.md new file mode 100644 index 0000000..0351f20 --- /dev/null +++ b/training/README.md @@ -0,0 +1,76 @@ +# Training + +This directory contains the training pipeline scaffolding and configurations for SmartBrain models. + +## Structure + +``` +/training + /pipeline # Training pipeline implementation + /configs # Training configurations +``` + +## Overview + +The training directory provides: +- End-to-end training pipeline +- Configuration management +- Hyperparameter tuning +- Training monitoring and logging + +## Training Pipeline + +The pipeline subdirectory contains: +- Data preprocessing +- Model training logic +- Evaluation and validation +- Checkpoint management +- Training orchestration + +## Training Configurations + +The configs subdirectory contains: +- Model architectures +- Hyperparameter settings +- Training schedules +- Resource allocation +- Environment configurations + +Example configuration: +```yaml +model: + name: smart-contract-classifier + architecture: transformer + params: + layers: 12 + hidden_size: 768 + +training: + batch_size: 32 + learning_rate: 2e-5 + epochs: 10 + optimizer: adamw +``` + +## Usage + +Train a model: +```bash +node training/cli/index.js train --config configs/my-model.yaml +``` + +## Integration + +Training components integrate with: +- Model registry (`/models`) +- Datasets (`/datasets`) +- Inference engine (`/inference`) +- Validation scripts (`/datasets/validation`) + +## Best Practices + +- Use configuration files for reproducibility +- Track experiments with metadata +- Save checkpoints regularly +- Monitor training metrics +- Validate on held-out data diff --git a/training/cli/index.js b/training/cli/index.js new file mode 100644 index 0000000..3fdbcc8 --- /dev/null +++ b/training/cli/index.js @@ -0,0 +1,48 @@ +#!/usr/bin/env node + +/** + * SmartBrain Training CLI + * + * Command-line interface for training ML models. + */ + +const fs = require('fs'); +const path = require('path'); + +function parseArgs() { + const args = process.argv.slice(2); + if (args.length === 0) { + return { command: 'help' }; + } + const command = args[0]; + const options = {}; + for (let i = 1; i < args.length; i++) { + if (args[i].startsWith('--')) { + const key = args[i].slice(2); + const value = args[i + 1] && !args[i + 1].startsWith('--') ? args[i + 1] : true; + options[key] = value; + if (value !== true) i++; + } + } + return { command, options }; +} + +function showHelp() { + console.log('SmartBrain Training CLI\n'); + console.log('Usage: node training/cli/index.js [options]\n'); + console.log('Commands:'); + console.log(' train - Train a model'); + console.log(' evaluate - Evaluate a trained model'); + console.log(' config - Generate configuration template\n'); +} + +if (require.main === module) { + const { command } = parseArgs(); + if (command === 'help' || !command) { + showHelp(); + } else { + console.log(`Training CLI - ${command} command (not yet implemented)`); + } +} + +module.exports = { parseArgs, showHelp }; From a46c81caef3fb17eee88d26c7ed947171b74ef86 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 11 Jan 2026 12:35:52 +0000 Subject: [PATCH 03/11] Add documentation, workflows, and configuration files Co-authored-by: SolanaRemix <240965752+SolanaRemix@users.noreply.github.com> --- .editorconfig | 31 ++ .eslintrc.json | 50 +++ .github/copilot/agent.yaml | 107 +++++ .github/dependabot.yml | 43 ++ .github/labeler.yml | 70 ++++ .github/workflows/ci.yml | 44 ++ .github/workflows/codeql.yml | 41 ++ .github/workflows/dependency-review.yml | 23 + .github/workflows/labeler.yml | 23 + .github/workflows/lint.yml | 56 +++ .github/workflows/model-lint.yml | 94 +++++ .github/workflows/model-validate.yml | 61 +++ .github/workflows/release.yml | 40 ++ .prettierrc | 12 + CODE_OF_CONDUCT.md | 133 ++++++ CONTRIBUTING.md | 340 +++++++++++++++ SECURITY.md | 145 +++++++ commitlint.config.js | 30 ++ docs/index.md | 536 ++++++++++++++++++++++++ package.json | 41 +- 20 files changed, 1916 insertions(+), 4 deletions(-) create mode 100644 .editorconfig create mode 100644 .eslintrc.json create mode 100644 .github/copilot/agent.yaml create mode 100644 .github/dependabot.yml create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/codeql.yml create mode 100644 .github/workflows/dependency-review.yml create mode 100644 .github/workflows/labeler.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/model-lint.yml create mode 100644 .github/workflows/model-validate.yml create mode 100644 .github/workflows/release.yml create mode 100644 .prettierrc create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 SECURITY.md create mode 100644 commitlint.config.js create mode 100644 docs/index.md diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..2dcf269 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,31 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +trim_trailing_whitespace = true + +# JavaScript, JSON, YAML +[*.{js,json,yml,yaml}] +indent_style = space +indent_size = 2 + +# Markdown +[*.md] +trim_trailing_whitespace = false +max_line_length = off + +# Shell scripts +[*.sh] +indent_style = space +indent_size = 2 + +# Package files +[{package.json,package-lock.json}] +indent_style = space +indent_size = 2 diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..799da6e --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,50 @@ +{ + "env": { + "node": true, + "es2021": true, + "jest": true + }, + "extends": [ + "eslint:recommended" + ], + "parserOptions": { + "ecmaVersion": 12, + "sourceType": "module" + }, + "rules": { + "indent": ["error", 2], + "linebreak-style": ["error", "unix"], + "quotes": ["error", "single"], + "semi": ["error", "always"], + "no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }], + "no-console": "off", + "prefer-const": "error", + "no-var": "error", + "eqeqeq": ["error", "always"], + "curly": ["error", "all"], + "brace-style": ["error", "1tbs"], + "comma-dangle": ["error", "never"], + "arrow-spacing": "error", + "space-before-function-paren": ["error", { + "anonymous": "always", + "named": "never", + "asyncArrow": "always" + }], + "keyword-spacing": "error", + "space-infix-ops": "error", + "no-trailing-spaces": "error", + "eol-last": ["error", "always"], + "object-curly-spacing": ["error", "always"], + "array-bracket-spacing": ["error", "never"], + "max-len": ["warn", { "code": 120, "ignoreUrls": true, "ignoreStrings": true }], + "no-multiple-empty-lines": ["error", { "max": 1 }], + "no-multi-spaces": "error" + }, + "ignorePatterns": [ + "node_modules/", + "dist/", + "build/", + "coverage/", + "*.min.js" + ] +} diff --git a/.github/copilot/agent.yaml b/.github/copilot/agent.yaml new file mode 100644 index 0000000..6688373 --- /dev/null +++ b/.github/copilot/agent.yaml @@ -0,0 +1,107 @@ +name: SmartBrain +description: AI/ML Engine for CyberAi Ecosystem +version: 1.0.0 + +commands: + - name: /terminal SmartBrain + description: SmartBrain main command - displays help and system status + endpoint: smartbrain.main + parameters: [] + + - name: /terminal SmartBrain.status + description: Check SmartBrain status - displays models, training jobs, and system health + endpoint: smartbrain.status + parameters: [] + + - name: /terminal SmartBrain.validate + description: Validate models and configurations - runs validation checks on all components + endpoint: smartbrain.validate + parameters: + - name: target + description: What to validate (models, datasets, configs, all) + type: string + required: false + default: "all" + + - name: /terminal SmartBrain.inference + description: Run inference commands - execute model predictions + endpoint: smartbrain.inference + parameters: + - name: model + description: Path to the model directory + type: string + required: true + - name: input + description: Path to input data file (JSON) + type: string + required: true + - name: output + description: Path to save results (optional) + type: string + required: false + + - name: /terminal SmartBrain.train + description: Run training commands - train ML models + endpoint: smartbrain.train + parameters: + - name: config + description: Path to training configuration file + type: string + required: true + - name: output + description: Path to save trained model + type: string + required: false + - name: epochs + description: Number of training epochs + type: integer + required: false + + - name: /terminal SmartBrain.models + description: List and manage models - display registered models and their status + endpoint: smartbrain.models + parameters: + - name: action + description: Action to perform (list, info, validate) + type: string + required: false + default: "list" + - name: model + description: Model name for info/validate actions + type: string + required: false + + - name: /terminal SmartBrain.fix + description: Auto-fix common issues - automatically fixes validation errors and configuration issues + endpoint: smartbrain.fix + parameters: + - name: target + description: What to fix (permissions, configs, all) + type: string + required: false + default: "all" + +permissions: + contents: write + pull-requests: write + issues: write + workflows: write + +features: + - model_management + - training_pipeline + - inference_engine + - dataset_validation + - auto_fix + +integration: + ecosystem: CyberAi + bots: + - SmartContractDeploy + - SmartContractAudit + workflows: + - ci + - lint + - model-validate + - model-lint + - codeql diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..3f845c9 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,43 @@ +version: 2 + +updates: + # Enable version updates for npm + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + time: "09:00" + open-pull-requests-limit: 10 + assignees: + - "SolanaRemix" + labels: + - "dependencies" + - "npm" + commit-message: + prefix: "chore(deps)" + include: "scope" + versioning-strategy: increase + allow: + - dependency-type: "all" + ignore: + # Ignore major version updates for stability + - dependency-name: "*" + update-types: ["version-update:semver-major"] + + # Enable version updates for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + time: "09:00" + open-pull-requests-limit: 5 + assignees: + - "SolanaRemix" + labels: + - "dependencies" + - "github-actions" + commit-message: + prefix: "chore(actions)" + include: "scope" diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..f6916d4 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,70 @@ +# Configuration for PR labeler +# See https://github.com/actions/labeler + +# Models +models: + - changed-files: + - any-glob-to-any-file: 'models/**' + +# Inference +inference: + - changed-files: + - any-glob-to-any-file: 'inference/**' + +# Training +training: + - changed-files: + - any-glob-to-any-file: 'training/**' + +# Datasets +datasets: + - changed-files: + - any-glob-to-any-file: 'datasets/**' + +# Documentation +documentation: + - changed-files: + - any-glob-to-any-file: + - 'docs/**' + - '*.md' + - 'README.md' + - 'CONTRIBUTING.md' + - 'SECURITY.md' + - 'CODE_OF_CONDUCT.md' + +# Tests +tests: + - changed-files: + - any-glob-to-any-file: 'tests/**' + +# Scripts +scripts: + - changed-files: + - any-glob-to-any-file: 'scripts/**' + +# Workflows +workflows: + - changed-files: + - any-glob-to-any-file: '.github/workflows/**' + +# Dependencies +dependencies: + - changed-files: + - any-glob-to-any-file: + - 'package.json' + - 'package-lock.json' + +# Bots +bots: + - changed-files: + - any-glob-to-any-file: 'bots/**' + +# Configuration +configuration: + - changed-files: + - any-glob-to-any-file: + - '.eslintrc.json' + - '.prettierrc' + - 'commitlint.config.js' + - '.editorconfig' + - '.github/**' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d7cb10d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,44 @@ +name: CI + +on: + push: + branches: [ main, develop ] + pull_request: + branches: [ main ] + +jobs: + build-and-test: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x, 18.x, 20.x] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm test + + - name: Run build (if exists) + run: npm run build --if-present + + - name: Upload coverage + if: matrix.node-version == '20.x' + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage/coverage-final.json + flags: unittests + name: codecov-umbrella + fail_ci_if_error: false diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..533e20a --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,41 @@ +name: "CodeQL" + +on: + push: + branches: [ main, develop ] + pull_request: + branches: [ main ] + schedule: + - cron: '0 0 * * 1' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'javascript' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + queries: security-and-quality + + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 0000000..0f56358 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,23 @@ +name: 'Dependency Review' + +on: + pull_request: + branches: [ main ] + +permissions: + contents: read + pull-requests: write + +jobs: + dependency-review: + runs-on: ubuntu-latest + steps: + - name: 'Checkout Repository' + uses: actions/checkout@v4 + + - name: 'Dependency Review' + uses: actions/dependency-review-action@v4 + with: + fail-on-severity: moderate + deny-licenses: GPL-3.0, AGPL-3.0 + comment-summary-in-pr: always diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 0000000..d08e2fd --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,23 @@ +name: "Pull Request Labeler" + +on: + pull_request_target: + types: [opened, synchronize, reopened] + +permissions: + contents: read + pull-requests: write + +jobs: + label: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Label PR + uses: actions/labeler@v5 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + configuration-path: .github/labeler.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..3a51cdf --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,56 @@ +name: Lint + +on: + push: + branches: [ main, develop ] + pull_request: + branches: [ main ] + +jobs: + eslint: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run ESLint + run: npm run lint + continue-on-error: true + + - name: Annotate code with ESLint results + uses: ataylorme/eslint-annotate-action@v2 + if: always() + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + report-json: "eslint-report.json" + only-pr-files: true + fail-on-error: false + + prettier: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Check formatting with Prettier + run: npm run format:check diff --git a/.github/workflows/model-lint.yml b/.github/workflows/model-lint.yml new file mode 100644 index 0000000..f7d08c2 --- /dev/null +++ b/.github/workflows/model-lint.yml @@ -0,0 +1,94 @@ +name: Model Lint + +on: + push: + branches: [ main, develop ] + paths: + - 'models/**' + - 'training/configs/**' + - 'datasets/**' + pull_request: + branches: [ main ] + paths: + - 'models/**' + - 'training/configs/**' + - 'datasets/**' + +jobs: + lint-configs: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + + - name: Validate JSON files + run: | + echo "Validating JSON configuration files..." + + # Validate model metadata files + find models -name "*.json" -type f | while read jsonfile; do + echo "Checking $jsonfile..." + if node -e "JSON.parse(require('fs').readFileSync('$jsonfile', 'utf8'))"; then + echo " ✓ Valid JSON" + else + echo " ✗ Invalid JSON" + exit 1 + fi + done + + # Validate training configs + find training/configs -name "*.json" -type f 2>/dev/null | while read jsonfile; do + echo "Checking $jsonfile..." + if node -e "JSON.parse(require('fs').readFileSync('$jsonfile', 'utf8'))"; then + echo " ✓ Valid JSON" + else + echo " ✗ Invalid JSON" + exit 1 + fi + done || true + + echo "JSON validation complete!" + + - name: Validate dataset schemas + run: | + echo "Validating dataset files..." + + find datasets -name "*.json" -type f | while read dataset; do + echo "Checking $dataset..." + if node -e "JSON.parse(require('fs').readFileSync('$dataset', 'utf8'))"; then + echo " ✓ Valid JSON" + else + echo " ✗ Invalid JSON" + exit 1 + fi + done || true + + echo "Dataset validation complete!" + + - name: Check for required metadata fields + run: | + echo "Checking required metadata fields..." + + find models -name "metadata.json" -type f | while read metadata; do + echo "Checking $metadata..." + MISSING_FIELDS="" + + for field in name version framework task; do + HAS_FIELD=$(node -e "const m = JSON.parse(require('fs').readFileSync('$metadata', 'utf8')); console.log(!!m.$field)" 2>/dev/null || echo "false") + if [ "$HAS_FIELD" != "true" ]; then + MISSING_FIELDS="$MISSING_FIELDS $field" + fi + done + + if [ -n "$MISSING_FIELDS" ]; then + echo " ⚠ Missing required fields:$MISSING_FIELDS" + else + echo " ✓ All required fields present" + fi + done || true diff --git a/.github/workflows/model-validate.yml b/.github/workflows/model-validate.yml new file mode 100644 index 0000000..76c846e --- /dev/null +++ b/.github/workflows/model-validate.yml @@ -0,0 +1,61 @@ +name: Model Validation + +on: + push: + branches: [ main, develop ] + paths: + - 'models/**' + pull_request: + branches: [ main ] + paths: + - 'models/**' + +jobs: + validate-models: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Find changed models + id: changed-models + run: | + MODELS=$(find models -type d -mindepth 1 -maxdepth 1 | grep -v metadata | grep -v registry || true) + echo "models<> $GITHUB_OUTPUT + echo "$MODELS" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Validate model metadata + if: steps.changed-models.outputs.models != '' + run: | + for model_dir in ${{ steps.changed-models.outputs.models }}; do + if [ -d "$model_dir" ]; then + echo "Validating $model_dir..." + ./scripts/validate-model.sh "$model_dir" || echo "Validation failed for $model_dir" + fi + done + + - name: Validate model metadata schema + run: | + if [ -f "models/metadata/schema.json" ]; then + echo "Validating model metadata schema..." + node -e "JSON.parse(require('fs').readFileSync('models/metadata/schema.json', 'utf8'))" && echo "✓ Schema is valid JSON" + fi + + - name: Check model versioning + run: | + echo "Checking model versions..." + find models -name "metadata.json" -type f | while read metadata; do + VERSION=$(node -e "console.log(JSON.parse(require('fs').readFileSync('$metadata', 'utf8')).version || 'missing')") + echo " $(dirname $metadata): $VERSION" + done diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e1955f2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,40 @@ +name: Release + +on: + push: + branches: + - main + +permissions: + contents: write + issues: write + pull-requests: write + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm test + + - name: Semantic Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npx semantic-release diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..72f0c64 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,12 @@ +{ + "semi": true, + "singleQuote": true, + "trailingComma": "none", + "tabWidth": 2, + "useTabs": false, + "printWidth": 100, + "arrowParens": "avoid", + "bracketSpacing": true, + "endOfLine": "lf", + "quoteProps": "as-needed" +} diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..a25eac1 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,133 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or advances of + any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email address, + without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +conduct@smartbrain.dev. + +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..7b29ea8 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,340 @@ +# Contributing to SmartBrain + +Thank you for your interest in contributing to SmartBrain! This document provides guidelines for contributing to the project. + +## Table of Contents + +- [Code of Conduct](#code-of-conduct) +- [Getting Started](#getting-started) +- [How to Contribute](#how-to-contribute) +- [Development Setup](#development-setup) +- [Code Style](#code-style) +- [Testing](#testing) +- [Pull Request Process](#pull-request-process) +- [Model Contribution Guidelines](#model-contribution-guidelines) +- [Commit Guidelines](#commit-guidelines) + +## Code of Conduct + +This project adheres to a Code of Conduct. By participating, you are expected to uphold this code. Please read [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) before contributing. + +## Getting Started + +1. Fork the repository +2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/SmartBrain.git` +3. Add upstream remote: `git remote add upstream https://github.com/SolanaRemix/SmartBrain.git` +4. Create a new branch: `git checkout -b feature/your-feature-name` + +## How to Contribute + +### Reporting Bugs + +Before creating bug reports, please check existing issues to avoid duplicates. + +When creating a bug report, include: + +- **Clear title and description** +- **Steps to reproduce** the behavior +- **Expected behavior** +- **Actual behavior** +- **Screenshots** (if applicable) +- **Environment details** (OS, Node.js version, etc.) + +### Suggesting Enhancements + +Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, include: + +- **Clear title and description** +- **Use case** and rationale +- **Possible implementation** approach +- **Alternative solutions** considered + +### Contributing Code + +1. Pick an issue or create one +2. Comment on the issue to let others know you're working on it +3. Fork the repository and create a branch +4. Make your changes +5. Write or update tests +6. Update documentation +7. Submit a pull request + +## Development Setup + +```bash +# Clone the repository +git clone https://github.com/YOUR_USERNAME/SmartBrain.git +cd SmartBrain + +# Install dependencies +npm install + +# Copy environment template +cp .env.example .env +# Edit .env with your configuration + +# Run bootstrap script +./scripts/bootstrap.sh + +# Run tests +npm test + +# Run linter +npm run lint + +# Run audit script +./scripts/audit.sh +``` + +## Code Style + +We follow JavaScript Standard Style with some modifications. + +### JavaScript/Node.js + +- Use 2 spaces for indentation +- Use single quotes for strings +- Add semicolons at the end of statements +- Use `const` for constants, `let` for variables +- Use meaningful variable and function names +- Add JSDoc comments for public APIs + +### Example + +```javascript +/** + * Validates model metadata against schema + * @param {Object} metadata - The model metadata + * @param {Object} schema - The validation schema + * @returns {boolean} True if valid, false otherwise + */ +function validateMetadata(metadata, schema) { + if (!metadata || !schema) { + return false; + } + + // Validation logic + return true; +} +``` + +### Configuration Files + +- ESLint: `.eslintrc.json` +- Prettier: `.prettierrc` +- EditorConfig: `.editorconfig` + +Run linting: +```bash +npm run lint +npm run lint:fix # Auto-fix issues +``` + +## Testing + +We use a test-driven development approach. + +### Writing Tests + +- Write unit tests for new functions +- Write integration tests for new features +- Aim for >80% code coverage +- Use descriptive test names + +### Test Structure + +```javascript +describe('ModelValidator', () => { + describe('validateMetadata', () => { + it('should return true for valid metadata', () => { + const metadata = { name: 'test', version: '1.0.0' }; + const result = validateMetadata(metadata); + expect(result).toBe(true); + }); + + it('should return false for invalid metadata', () => { + const metadata = { name: 'test' }; // missing version + const result = validateMetadata(metadata); + expect(result).toBe(false); + }); + }); +}); +``` + +### Running Tests + +```bash +# Run all tests +npm test + +# Run unit tests only +npm run test:unit + +# Run integration tests only +npm run test:integration + +# Run with coverage +npm run test:coverage + +# Watch mode +npm run test:watch +``` + +## Pull Request Process + +1. **Update documentation** for any changed functionality +2. **Add or update tests** for your changes +3. **Ensure all tests pass** (`npm test`) +4. **Run linting** (`npm run lint`) +5. **Update CHANGELOG.md** with your changes +6. **Follow commit message conventions** (see below) +7. **Request review** from maintainers + +### PR Checklist + +- [ ] Code follows the project's style guidelines +- [ ] Self-review completed +- [ ] Comments added for complex code +- [ ] Documentation updated +- [ ] No new warnings generated +- [ ] Tests added/updated and passing +- [ ] Dependent changes merged +- [ ] CHANGELOG.md updated + +### PR Title Format + +Use conventional commits format: + +``` +type(scope): description + +Examples: +feat(inference): add batch prediction support +fix(training): resolve checkpoint loading issue +docs(readme): update installation instructions +``` + +## Model Contribution Guidelines + +### Adding New Models + +When contributing ML models: + +1. **Create model directory** in `/models/` +2. **Add metadata.json** following the schema in `/models/metadata/schema.json` +3. **Include README.md** with: + - Model description + - Training details + - Usage examples + - Performance metrics + - License information + +### Model Metadata Requirements + +```json +{ + "name": "model-name", + "version": "1.0.0", + "description": "Model description", + "framework": "tensorflow", + "task": "classification", + "author": "Your Name", + "created_at": "2025-01-11T00:00:00Z", + "metrics": { + "accuracy": 0.95, + "f1_score": 0.94 + } +} +``` + +### Model Validation + +Before submitting: + +```bash +# Validate model +./scripts/validate-model.sh models/your-model + +# Ensure validation passes +``` + +### Model Size Considerations + +- Models >100MB should use Git LFS +- Consider model compression techniques +- Provide download links for large models + +## Commit Guidelines + +We follow [Conventional Commits](https://www.conventionalcommits.org/). + +### Commit Message Format + +``` +(): + + + +