From 32d2728de062534f9f615cbb75fce6e88a04bc4e Mon Sep 17 00:00:00 2001 From: "Leif W. Sogge" <144378178+GuardianNinja@users.noreply.github.com> Date: Sun, 14 Dec 2025 07:25:23 -0500 Subject: [PATCH 01/16] ci: add GitHub Actions workflow for tests and build --- .github/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..aeeac4e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build-and-test: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Install pnpm + run: npm install -g pnpm@8 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Run lint + run: pnpm lint || true + + - name: Run tests (workspace) + run: pnpm test + + - name: Build (workspace) + run: pnpm build From 0f63ebf2e934013804085801d7736cff4dfc7a71 Mon Sep 17 00:00:00 2001 From: "Leif W. Sogge" <144378178+GuardianNinja@users.noreply.github.com> Date: Sun, 14 Dec 2025 18:21:48 -0500 Subject: [PATCH 02/16] docs(release): add release notes for v0.1.0 --- RELEASES/v0.1.0.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 RELEASES/v0.1.0.md diff --git a/RELEASES/v0.1.0.md b/RELEASES/v0.1.0.md new file mode 100644 index 0000000..43b3106 --- /dev/null +++ b/RELEASES/v0.1.0.md @@ -0,0 +1,48 @@ +# Release v0.1.0 — Krystal Core (Guarded Shield Release) + +**Tag:** v0.1.0 +**Date:** 2025-12-14 + +## Summary +This release introduces the Krystal Core satellite specification package and a production-ready authentication starter for the Turbo Stack template. + +This is a milestone release that collects the repository's first set of production-focused features, documentation, and tests. + +## Highlights +- **Added** `packages/satellite` — a lineage-safe Krystal Core spec with deterministic simulation helpers and Vitest tests. +- **Added** spec and test coverage for E_mag calculation, plasma frequency, safety checks, soft-start profiles, and quench simulation. +- **Improved** documentation: `AUTH_SYSTEM.md`, `K8S_ARCHITECTURE.md`, and `SHOWCASE.md` updated for portfolio and operational clarity. +- **Branding**: Homepage updated to **SPACE LEAF CORP** (teal title and space background) to reflect product positioning. +- **CI**: Added GitHub Actions workflow to run lint/tests/builds on `push` and `pull_request` to `main`. + +## Technical Details +- Packages added: + - `@turbo-stack/satellite` (helpers + tests) +- Tests: All local tests pass (`pnpm test`) and package builds succeed (`pnpm build`). +- Tag: `v0.1.0` created and pushed. + +## How to test locally +```bash +# Install and run tests +pnpm install +pnpm test + +# Start dev servers +pnpm dev --filter backend # API on :3001 +pnpm dev --filter frontend # Web on :3000 + +# Smoke tests (example) +curl -X POST http://localhost:3001/api/auth/signup -H "Content-Type: application/json" -d '{"email":"smoke+1@example.com","password":"smokepass"}' +curl -X POST http://localhost:3001/api/auth/login -H "Content-Type: application/json" -d '{"email":"smoke+1@example.com","password":"smokepass"}' +``` + +## Upgrade notes +- No breaking changes in this release. +- CI will run tests on PRs targeting `main`. + +## Maintainers +Space LEAF Corp — turbo stack team + +--- + +(If you'd like, I can create the actual GitHub Release for tag `v0.1.0` using this content — I can open the release draft in the GitHub UI for final review.) \ No newline at end of file From 46ad2cd7fb381d87ab89ae6711412a74d9dfd65c Mon Sep 17 00:00:00 2001 From: "Leif W. Sogge" <144378178+GuardianNinja@users.noreply.github.com> Date: Sun, 14 Dec 2025 18:28:20 -0500 Subject: [PATCH 03/16] release here we go --- RELEASES/v0.1.0.md | 8 +++++++- RELEASES/v0.1.1.md | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 RELEASES/v0.1.1.md diff --git a/RELEASES/v0.1.0.md b/RELEASES/v0.1.0.md index 43b3106..8df0958 100644 --- a/RELEASES/v0.1.0.md +++ b/RELEASES/v0.1.0.md @@ -4,11 +4,13 @@ **Date:** 2025-12-14 ## Summary + This release introduces the Krystal Core satellite specification package and a production-ready authentication starter for the Turbo Stack template. This is a milestone release that collects the repository's first set of production-focused features, documentation, and tests. ## Highlights + - **Added** `packages/satellite` — a lineage-safe Krystal Core spec with deterministic simulation helpers and Vitest tests. - **Added** spec and test coverage for E_mag calculation, plasma frequency, safety checks, soft-start profiles, and quench simulation. - **Improved** documentation: `AUTH_SYSTEM.md`, `K8S_ARCHITECTURE.md`, and `SHOWCASE.md` updated for portfolio and operational clarity. @@ -16,12 +18,14 @@ This is a milestone release that collects the repository's first set of producti - **CI**: Added GitHub Actions workflow to run lint/tests/builds on `push` and `pull_request` to `main`. ## Technical Details + - Packages added: - `@turbo-stack/satellite` (helpers + tests) - Tests: All local tests pass (`pnpm test`) and package builds succeed (`pnpm build`). - Tag: `v0.1.0` created and pushed. ## How to test locally + ```bash # Install and run tests pnpm install @@ -37,12 +41,14 @@ curl -X POST http://localhost:3001/api/auth/login -H "Content-Type: application/ ``` ## Upgrade notes + - No breaking changes in this release. - CI will run tests on PRs targeting `main`. ## Maintainers + Space LEAF Corp — turbo stack team --- -(If you'd like, I can create the actual GitHub Release for tag `v0.1.0` using this content — I can open the release draft in the GitHub UI for final review.) \ No newline at end of file +(If you'd like, I can create the actual GitHub Release for tag `v0.1.0` using this content — I can open the release draft in the GitHub UI for final review.) diff --git a/RELEASES/v0.1.1.md b/RELEASES/v0.1.1.md new file mode 100644 index 0000000..4465e3b --- /dev/null +++ b/RELEASES/v0.1.1.md @@ -0,0 +1,34 @@ +# Release v0.1.1 — Patch Release + +**Tag:** v0.1.1 +**Date:** 2025-12-14 + +## Summary + +This patch release includes minor documentation fixes, a small tsconfig update for the `packages/satellite`, and a few readability and formatting adjustments across the repo. + +## Highlights + +- **Docs:** Small formatting fixes in `AUTH_SYSTEM.md`, `K8S_ARCHITECTURE.md`, and `SHOWCASE.md`. +- **Satellite:** Added `forceConsistentCasingInFileNames` to `packages/satellite/tsconfig.json` for stricter builds. +- **CI:** Workflow already added to run lint/test/build — no changes in this patch. + +## Technical Details + +- Tag: `v0.1.1` will be created and pushed. +- No functional changes to runtime code. + +## How to test locally + +```bash +# Run tests and build (no behavioral changes expected) +pnpm install +pnpm test +pnpm build +``` + +## Release Notes + +This is a small maintenance release to clean up documentation and developer tooling. No action is required for users. + +--- From 8c09c07a131cf0ec7431e4a397eb4b2109e5b263 Mon Sep 17 00:00:00 2001 From: "Leif W. Sogge" <144378178+GuardianNinja@users.noreply.github.com> Date: Mon, 15 Dec 2025 09:22:03 -0500 Subject: [PATCH 04/16] feat(web): migrate /hello to App Router and update docs --- FULL_STACK_LOOP.md | 32 +++++++++++++++---- KUBERNETES_DEPLOY.md | 13 +++++--- .../{pages/hello.tsx => app/hello/page.tsx} | 2 +- 3 files changed, 35 insertions(+), 12 deletions(-) rename apps/web/src/{pages/hello.tsx => app/hello/page.tsx} (98%) diff --git a/FULL_STACK_LOOP.md b/FULL_STACK_LOOP.md index 5dbf8d6..9a24afa 100644 --- a/FULL_STACK_LOOP.md +++ b/FULL_STACK_LOOP.md @@ -5,17 +5,20 @@ This guide walks you through testing the complete **Frontend → Backend → Dat ## ✅ What's Implemented ### 1. Frontend (`/hello` page) -- **Location**: `apps/web/src/pages/hello.tsx` -- **Route**: http://localhost:3000/hello + +- **Location**: `apps/web/src/app/hello/page.tsx` +- **Route**: - **Features**: - Displays "Captain's Log Online" - Shows status of frontend, backend, and database connections - Fetches and displays latest log entry from database ### 2. Backend API (`/api/hello` endpoint) + - **Location**: `apps/api/src/index.ts` -- **Route**: http://localhost:3001/api/hello +- **Route**: - **Response**: + ```json { "message": "Backend alive", @@ -26,6 +29,7 @@ This guide walks you through testing the complete **Frontend → Backend → Dat ``` ### 3. Database (Prisma + PostgreSQL) + - **Model**: `LogEntry` in `packages/database/prisma/schema.prisma` - **Fields**: - `id`: Unique identifier @@ -39,34 +43,40 @@ This guide walks you through testing the complete **Frontend → Backend → Dat ### Option 1: With Docker (Full Database) 1. **Install Docker Desktop** (if not already installed) - - Download from: https://www.docker.com/products/docker-desktop + - Download from: 2. **Start PostgreSQL**: + ```bash docker-compose up -d ``` 3. **Setup Database**: + ```bash pnpm db:setup ``` + This will: - Generate Prisma client - Push schema to database - Seed with sample data 4. **Install dependencies with database package**: + ```bash pnpm install ``` 5. **Restart backend** to connect to database: + ```bash # Stop current backend (Ctrl+C) pnpm dev --filter backend ``` 6. **Visit the page**: + ``` http://localhost:3000/hello ``` @@ -76,6 +86,7 @@ This guide walks you through testing the complete **Frontend → Backend → Dat If you don't have Docker, you can still test frontend ↔ backend: 1. **Visit the hello page**: + ``` http://localhost:3000/hello ``` @@ -87,12 +98,14 @@ If you don't have Docker, you can still test frontend ↔ backend: ## 🧪 Testing the Full Loop -### Test Backend Directly: +### Test Backend Directly + ```bash curl http://localhost:3001/api/hello ``` Expected response (with database): + ```json { "message": "Backend alive", @@ -109,10 +122,12 @@ Expected response (with database): } ``` -### View in Browser: -Navigate to: http://localhost:3000/hello +### View in Browser + +Navigate to: You should see: + - 🚀 **Captain's Log Online** (big animated title) - ✅ **Frontend**: Next.js page loaded - ✅ **Backend**: Backend alive @@ -141,16 +156,19 @@ pnpm db:setup ## 🐛 Troubleshooting ### Backend can't connect to database? + - Make sure Docker is running: `docker ps` - Check docker-compose is up: `docker-compose ps` - Verify DATABASE_URL in `packages/database/.env` ### Port already in use? + - Frontend (3000): Stop other Next.js instances - Backend (3001): Stop other Node.js servers - Database (5432): Stop other PostgreSQL instances ### CORS errors? + - Backend has CORS enabled for all origins in development - Make sure backend is running on port 3001 diff --git a/KUBERNETES_DEPLOY.md b/KUBERNETES_DEPLOY.md index bbbccfd..b58a5cd 100644 --- a/KUBERNETES_DEPLOY.md +++ b/KUBERNETES_DEPLOY.md @@ -5,6 +5,7 @@ Deploy your Turbo Stack full-stack application to Kubernetes using Helm charts a ## 📋 Prerequisites ### 1. Install Minikube + ```bash # macOS brew install minikube @@ -15,6 +16,7 @@ sudo install minikube-darwin-amd64 /usr/local/bin/minikube ``` ### 2. Install Helm + ```bash # macOS brew install helm @@ -24,6 +26,7 @@ curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash ``` ### 3. Install kubectl (if not already installed) + ```bash # macOS brew install kubectl @@ -44,6 +47,7 @@ chmod +x deploy-minikube.sh ``` This will: + 1. ✅ Start Minikube 2. 🐳 Build Docker images 3. ⚓ Deploy with Helm @@ -136,6 +140,7 @@ minikube dashboard --url ``` The dashboard shows: + - 🎭 Pod status and health - 📈 Resource usage (CPU/Memory) - 🔄 Deployment scaling @@ -205,7 +210,7 @@ kubectl port-forward service/backend 3001:3001 ## 🎨 Helm Chart Structure -``` +```text helm/ ├── frontend/ │ ├── Chart.yaml # Chart metadata @@ -290,10 +295,10 @@ minikube delete --all --purge After deployment, your services are exposed on NodePorts: -- **Frontend**: http://localhost:30000 (via `minikube service frontend`) -- **Backend**: http://localhost:30001 (via `minikube service backend`) +- **Frontend**: (via `minikube service frontend`) +- **Backend**: (via `minikube service backend`) -### Get URLs automatically: +### Get URLs automatically ```bash echo "Frontend: $(minikube service frontend --url)" diff --git a/apps/web/src/pages/hello.tsx b/apps/web/src/app/hello/page.tsx similarity index 98% rename from apps/web/src/pages/hello.tsx rename to apps/web/src/app/hello/page.tsx index 6c40a60..b1be242 100644 --- a/apps/web/src/pages/hello.tsx +++ b/apps/web/src/app/hello/page.tsx @@ -1,4 +1,4 @@ -/* eslint-disable react/no-unescaped-entities */ +"use client"; import { useEffect, useState } from 'react'; export default function Hello() { From 26ddf1ca8e4c3114036f59d51e0f20eb107068f3 Mon Sep 17 00:00:00 2001 From: "Leif W. Sogge" <144378178+GuardianNinja@users.noreply.github.com> Date: Mon, 15 Dec 2025 09:27:25 -0500 Subject: [PATCH 05/16] fix(frontend): disable react/no-unescaped-entities for /hello page --- apps/web/src/app/hello/page.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/web/src/app/hello/page.tsx b/apps/web/src/app/hello/page.tsx index b1be242..53c272f 100644 --- a/apps/web/src/app/hello/page.tsx +++ b/apps/web/src/app/hello/page.tsx @@ -1,4 +1,5 @@ "use client"; +/* eslint-disable react/no-unescaped-entities */ import { useEffect, useState } from 'react'; export default function Hello() { From e91323f1c29f250cf2dd19bf1f129da149ad0e2c Mon Sep 17 00:00:00 2001 From: "Leif W. Sogge" <144378178+GuardianNinja@users.noreply.github.com> Date: Mon, 15 Dec 2025 15:33:23 -0500 Subject: [PATCH 06/16] yikes i can do this wow ive kept going --- FULL_STACK_LOOP.md | 6 +++--- QUICK_K8S.md | 18 ++++++++++++------ apps/web/next-env.d.ts | 1 - 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/FULL_STACK_LOOP.md b/FULL_STACK_LOOP.md index 9a24afa..8405c41 100644 --- a/FULL_STACK_LOOP.md +++ b/FULL_STACK_LOOP.md @@ -77,7 +77,7 @@ This guide walks you through testing the complete **Frontend → Backend → Dat 6. **Visit the page**: - ``` + ```text http://localhost:3000/hello ``` @@ -87,7 +87,7 @@ If you don't have Docker, you can still test frontend ↔ backend: 1. **Visit the hello page**: - ``` + ```text http://localhost:3000/hello ``` @@ -184,7 +184,7 @@ Now that the full loop is confirmed, you can: ## 📊 Architecture -``` +```text ┌─────────────────┐ │ Frontend │ Next.js on :3000 │ /hello page │ → Fetches from backend diff --git a/QUICK_K8S.md b/QUICK_K8S.md index 16febf2..88a01a7 100644 --- a/QUICK_K8S.md +++ b/QUICK_K8S.md @@ -1,12 +1,15 @@ # Quick Start Commands -# Install Prerequisites +## Install Prerequisites + brew install minikube helm kubectl -# Deploy Everything +## Deploy Everything + ./deploy-minikube.sh -# Or Manual Steps: +## Or Manual Steps + minikube start --driver=docker --cpus=4 --memory=4096 eval $(minikube docker-env) docker build -t turbo-stack-frontend:latest -f apps/web/Dockerfile . @@ -14,14 +17,17 @@ docker build -t turbo-stack-backend:latest -f apps/api/Dockerfile . helm install backend ./helm/backend helm install frontend ./helm/frontend -# Access Services +## Access Services + minikube service frontend --url minikube service backend --url -# Watch Pods Dance +## Watch Pods Dance + minikube dashboard kubectl get pods -w -# Cleanup +## Cleanup + helm uninstall frontend backend minikube stop diff --git a/apps/web/next-env.d.ts b/apps/web/next-env.d.ts index 725dd6f..40c3d68 100644 --- a/apps/web/next-env.d.ts +++ b/apps/web/next-env.d.ts @@ -1,6 +1,5 @@ /// /// -/// // NOTE: This file should not be edited // see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information. From 63004e8890bc27b1a37f2ff5522a197b7f8ea9ee Mon Sep 17 00:00:00 2001 From: "Leif W. Sogge" <144378178+GuardianNinja@users.noreply.github.com> Date: Sat, 3 Jan 2026 06:18:40 -0500 Subject: [PATCH 07/16] test and problem fix that was fast --- LICENSE | 50 +++++++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/LICENSE b/LICENSE index 4ec0884..7fd36d7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,29 @@ -MIT License - -Copyright (c) 2025 Space LEAF corp - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +# MIT Stewardship License (Modified) + +MIT Stewardship License (Modified) + +Copyright (c) 2025 Leif William Sogge + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, subject to the following conditions: + +1. **Open Access for Education and Research** + The Software may be freely used for non-commercial educational, scientific, and environmental research purposes. + +2. **Stewardship Clause — Profit Sharing for Planetary Care** + Any commercial use of the Software or its derivatives that results in **financial profit from scientific research, data products, or technological applications** must contribute **10% of net profits** to a designated nonprofit vault or trust. + This fund shall be used exclusively for: + - Supporting youth education in planetary stewardship + - Funding open-access environmental science + - Ensuring long-term economic stability for future generations + + The vault shall be managed by a nonprofit organization aligned with the mission of Jarvondis University and the ceremonial stewardship principles outlined by the original author. + +3. **Preservation of Authorship and Mission** + The name “Leif William Sogge” and the ceremonial mission of Jarvondis University must be preserved in all public forks, derivatives, and publications referencing this Software. + +4. **Standard MIT Terms Apply** + Except as modified above, the Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability. + +--- + +This license is a living document. Stewardship is not static — it evolves with the needs of the planet and the people. From 276cf0562ac21bbbefb2635691cddeb714f0d7f6 Mon Sep 17 00:00:00 2001 From: "Leif W. Sogge" <144378178+GuardianNinja@users.noreply.github.com> Date: Sat, 3 Jan 2026 06:19:47 -0500 Subject: [PATCH 08/16] Test2 confirmation 4-5 From e28cd3c8faa55f8e093ce1807b8d34b967a9919f Mon Sep 17 00:00:00 2001 From: "Leif W. Sogge" <144378178+GuardianNinja@users.noreply.github.com> Date: Sun, 4 Jan 2026 07:39:23 -0500 Subject: [PATCH 09/16] create file to add to stack test and problem fix --- MLK-Justice-Sweep/README.md | 36 ++++++++ MLK-Justice-Sweep/SECURITY_POLICIES.md | 40 ++++++++ MLK-Justice-Sweep/config/logging.yaml | 64 +++++++++++++ MLK-Justice-Sweep/config/settings.yaml | 22 +++++ MLK-Justice-Sweep/src/anomaly_merger.py | 23 +++++ MLK-Justice-Sweep/src/forward_pass.py | 26 ++++++ MLK-Justice-Sweep/src/integrity_vault.py | 75 +++++++++++++++ MLK-Justice-Sweep/src/jarvondis_adapter.py | 31 +++++++ MLK-Justice-Sweep/src/log_collector.py | 31 +++++++ MLK-Justice-Sweep/src/main.py | 91 +++++++++++++++++++ MLK-Justice-Sweep/src/reverse_pass.py | 28 ++++++ MLK-Justice-Sweep/src/scheduler.py | 24 +++++ .../src/turbo_satellite_client.py | 44 +++++++++ MLK-Justice-Sweep/src/utils/hashing.py | 11 +++ MLK-Justice-Sweep/src/utils/models.py | 31 +++++++ MLK-Justice-Sweep/src/utils/time_utils.py | 13 +++ 16 files changed, 590 insertions(+) create mode 100644 MLK-Justice-Sweep/README.md create mode 100644 MLK-Justice-Sweep/SECURITY_POLICIES.md create mode 100644 MLK-Justice-Sweep/config/logging.yaml create mode 100644 MLK-Justice-Sweep/config/settings.yaml create mode 100644 MLK-Justice-Sweep/src/anomaly_merger.py create mode 100644 MLK-Justice-Sweep/src/forward_pass.py create mode 100644 MLK-Justice-Sweep/src/integrity_vault.py create mode 100644 MLK-Justice-Sweep/src/jarvondis_adapter.py create mode 100644 MLK-Justice-Sweep/src/log_collector.py create mode 100644 MLK-Justice-Sweep/src/main.py create mode 100644 MLK-Justice-Sweep/src/reverse_pass.py create mode 100644 MLK-Justice-Sweep/src/scheduler.py create mode 100644 MLK-Justice-Sweep/src/turbo_satellite_client.py create mode 100644 MLK-Justice-Sweep/src/utils/hashing.py create mode 100644 MLK-Justice-Sweep/src/utils/models.py create mode 100644 MLK-Justice-Sweep/src/utils/time_utils.py diff --git a/MLK-Justice-Sweep/README.md b/MLK-Justice-Sweep/README.md new file mode 100644 index 0000000..f434b25 --- /dev/null +++ b/MLK-Justice-Sweep/README.md @@ -0,0 +1,36 @@ +# MLK Justice Sweep – Turbo Stack Security Ritual + +This project encodes an annual **MLK Jr. Day justice sweep** and a **daily integrity test** for systems that participate in the **Turbo Stack / Krystal Core Satellite Relay** network. + +## Core concepts + +- **AI sponge & validation sweep:** + Forward analysis of logs, access patterns, and configuration changes. + +- **Reverse algorithm anomaly detection:** + Reverse-time reprocessing, looking for impossible sequences and hidden backdoors. + +- **Infinity loop passes (0.2s / 0.25s):** + Symbolic cadence for scheduling: two tightly coupled passes that converge into a single stream. + +- **Reverse gyroscopic cataloging & indexing:** + Multi-axis indexing (time, user, resource, device, anomaly score) for stability and later forensics. + +- **Integrity vault:** + Cryptographically chained evidence store, optionally anchored to **Turbo Stack Krystal Core satellites** to detect tampering. + +- **JARVONDIS integration:** + Final, normalized anomaly stream formatted for the JARVONDIS game engine / analytic core. + +## Modes + +- **Daily integrity test** – lightweight run over a recent time window. +- **MLK Justice Sweep** – deep annual run with full vault anchoring and report generation. + +## Stack + +- **Language:** Python 3.x +- **Structure:** Modular components under `src/` +- **Config:** YAML files under `config/` + +You are encouraged to fork, extend, and adapt this system to your own ethical frameworks and infrastructures. diff --git a/MLK-Justice-Sweep/SECURITY_POLICIES.md b/MLK-Justice-Sweep/SECURITY_POLICIES.md new file mode 100644 index 0000000..10f608e --- /dev/null +++ b/MLK-Justice-Sweep/SECURITY_POLICIES.md @@ -0,0 +1,40 @@ +# Security Policies + +## 1. Threat model + +- **Adversaries:** + - External attackers attempting unauthorized access. + - Insiders attempting to erase or alter forensic evidence. + - Malicious automation (bots, worms, scripts) attempting lateral movement. + +- **Assets:** + - Access logs, auth logs, system logs. + - Configuration snapshots. + - Integrity vault records. + - Turbo Stack / Krystal Core anchor proofs. + +- **Key goals:** + - Detect anomalies and possible backdoors. + - Preserve tamper-evident records. + - Provide structured reports to appropriate entities. + +## 2. Log integrity + +- Log entries are: + - Hashed with a cryptographic hash. + - Linked via hash chains (each entry includes previous hash). + - Optionally anchored via Turbo Stack Krystal Core satellite relay. + +## 3. Least privilege + +- Each component runs under a restricted role: + - Collector: read-only on logs. + - Analyzer: read-only on collected data. + - Vault: append-only on integrity store. + - Satellite client: outbound-only to trusted relay endpoints. + +## 4. Privacy and governance + +- Use only operationally necessary data in analysis. +- Document retention policies and deletion criteria. +- Any external reporting must comply with local laws and contracts. diff --git a/MLK-Justice-Sweep/config/logging.yaml b/MLK-Justice-Sweep/config/logging.yaml new file mode 100644 index 0000000..7c6ec80 --- /dev/null +++ b/MLK-Justice-Sweep/config/logging.yaml @@ -0,0 +1,64 @@ +version: 1 + +formatters: + standard: + format: "%(asctime)s [%(levelname)s] %(name)s: %(message)s" + datefmt: "%Y-%m-%dT%H:%M:%S%z" + + json: + format: > + {"timestamp": "%(asctime)s", + "level": "%(levelname)s", + "logger": "%(name)s", + "message": "%(message)s"} + datefmt: "%Y-%m-%dT%H:%M:%S%z" + +handlers: + console: + class: logging.StreamHandler + level: INFO + formatter: standard + stream: ext://sys.stdout + + file_info: + class: logging.handlers.RotatingFileHandler + level: INFO + formatter: standard + filename: logs/system_info.log + maxBytes: 1048576 + backupCount: 5 + encoding: utf-8 + + file_json: + class: logging.handlers.RotatingFileHandler + level: DEBUG + formatter: json + filename: logs/system_json.log + maxBytes: 2097152 + backupCount: 10 + encoding: utf-8 + +loggers: + mlk_sweep: + level: DEBUG + handlers: [console, file_info, file_json] + propagate: no + + turbo_satellite: + level: INFO + handlers: [console, file_info] + propagate: no + + integrity_vault: + level: DEBUG + handlers: [file_json] + propagate: no + + jarvondis_adapter: + level: INFO + handlers: [console, file_info] + propagate: no + +root: + level: WARNING + handlers: [console] diff --git a/MLK-Justice-Sweep/config/settings.yaml b/MLK-Justice-Sweep/config/settings.yaml new file mode 100644 index 0000000..c24a69f --- /dev/null +++ b/MLK-Justice-Sweep/config/settings.yaml @@ -0,0 +1,22 @@ +mode: daily # options: daily, mlk_sweep + +log_sources: + - /var/log/auth.log + - /var/log/syslog + +time_window_minutes: 60 # for daily runs; MLK sweep can override + +integrity_vault: + path: ./vault/integrity_log.jsonl + enable_satellite_anchor: true + +turbo_satellite: + endpoint: "https://turbo-stack-krystal-core.example/api/anchor" + api_key_env_var: "TURBO_SATELLITE_API_KEY" + +jarvondis: + output_path: ./vault/jarvondis_stream.jsonl + +scheduling: + infinity_loop_forward_seconds: 0.2 + infinity_loop_reverse_seconds: 0.25 diff --git a/MLK-Justice-Sweep/src/anomaly_merger.py b/MLK-Justice-Sweep/src/anomaly_merger.py new file mode 100644 index 0000000..66a236d --- /dev/null +++ b/MLK-Justice-Sweep/src/anomaly_merger.py @@ -0,0 +1,23 @@ +from typing import List +from utils.models import Anomaly + + +def merge_anomalies(forward: List[Anomaly], reverse: List[Anomaly]) -> List[Anomaly]: + """ + Merge forward and reverse anomalies into a single stream. + Basic deduplication by identical description + related_entries. + """ + merged: List[Anomaly] = [] + seen_signatures: set[str] = set() + + def signature(a: Anomaly) -> str: + key = (a.description, tuple(sorted(a.related_entries))) + return str(key) + + for group in (forward, reverse): + for a in group: + sig = signature(a) + if sig not in seen_signatures: + seen_signatures.add(sig) + merged.append(a) + return merged diff --git a/MLK-Justice-Sweep/src/forward_pass.py b/MLK-Justice-Sweep/src/forward_pass.py new file mode 100644 index 0000000..dd7ad9a --- /dev/null +++ b/MLK-Justice-Sweep/src/forward_pass.py @@ -0,0 +1,26 @@ +from typing import List +from utils.models import LogEntry, Anomaly +from utils.time_utils import now_utc + + +def forward_pass(entries: List[LogEntry]) -> List[Anomaly]: + """ + Forward-time anomaly detection. + Very simple heuristics for now; you can enhance these. + """ + anomalies: List[Anomaly] = [] + for i, e in enumerate(entries): + # Example heuristic: search for "failed" in auth logs + if "failed" in e.raw.lower() or "error" in e.raw.lower(): + anomalies.append( + Anomaly( + id=f"fw-{i}", + severity="medium", + description="Suspicious log message detected in forward pass", + timestamp=now_utc(), + related_entries=[e.raw], + score=0.5, + metadata={"source": e.source, "direction": "forward"}, + ) + ) + return anomalies diff --git a/MLK-Justice-Sweep/src/integrity_vault.py b/MLK-Justice-Sweep/src/integrity_vault.py new file mode 100644 index 0000000..fb17074 --- /dev/null +++ b/MLK-Justice-Sweep/src/integrity_vault.py @@ -0,0 +1,75 @@ +import json +from pathlib import Path +from typing import List, Optional + +from utils.models import Anomaly, VaultRecord +from utils.hashing import sha256_json +from utils.time_utils import now_utc + + +class IntegrityVault: + def __init__(self, path: str): + self.path = Path(path) + self.path.parent.mkdir(parents=True, exist_ok=True) + + def _load_last_record(self) -> Optional[VaultRecord]: + if not self.path.exists(): + return None + last_line = None + with self.path.open("r", encoding="utf-8") as f: + for last_line in f: + pass + if last_line is None: + return None + data = json.loads(last_line) + return VaultRecord( + index=data["index"], + timestamp=now_utc(), # replay accurate timestamp not critical here + anomaly_id=data["anomaly_id"], + hash=data["hash"], + previous_hash=data["previous_hash"], + ) + + def append_anomalies(self, anomalies: List[Anomaly]) -> List[VaultRecord]: + last = self._load_last_record() + last_hash = last.hash if last else None + index_start = last.index + 1 if last else 0 + + from typing import Dict, Any + + records: List[VaultRecord] = [] + with self.path.open("a", encoding="utf-8") as f: + for i, a in enumerate(anomalies): + payload: Dict[str, Any] = { + "anomaly_id": a.id, + "severity": a.severity, + "description": a.description, + "timestamp": a.timestamp.isoformat(), + "score": a.score, + "metadata": a.metadata, + } + combined: Dict[str, Any] = { + "index": index_start + i, + "payload": payload, + "previous_hash": last_hash, + } + record_hash = sha256_json(combined) + from typing import Union + record: dict[str, Union[str, int, None]] = { + "index": index_start + i, + "anomaly_id": a.id, + "hash": record_hash, + "previous_hash": last_hash, + } + f.write(json.dumps(record) + "\n") + records.append( + VaultRecord( + index=index_start + i, + timestamp=now_utc(), + anomaly_id=a.id, + hash=record_hash, + previous_hash=last_hash, + ) + ) + last_hash = record_hash + return records diff --git a/MLK-Justice-Sweep/src/jarvondis_adapter.py b/MLK-Justice-Sweep/src/jarvondis_adapter.py new file mode 100644 index 0000000..1b9307b --- /dev/null +++ b/MLK-Justice-Sweep/src/jarvondis_adapter.py @@ -0,0 +1,31 @@ +import json +from pathlib import Path +from typing import List + +from utils.models import Anomaly + + +class JarvondisAdapter: + """ + Converts merged anomalies into a stream format that + JARVONDIS can consume (story, game engine, or analytics). + """ + + def __init__(self, output_path: str): + self.path = Path(output_path) + self.path.parent.mkdir(parents=True, exist_ok=True) + + def write_stream(self, anomalies: List[Anomaly]) -> None: + from typing import Dict, Any + with self.path.open("a", encoding="utf-8") as f: + for a in anomalies: + record: Dict[str, Any] = { + "id": a.id, + "severity": a.severity, + "description": a.description, + "timestamp": a.timestamp.isoformat(), + "score": a.score, + "metadata": a.metadata, + "related_entries": a.related_entries, + } + f.write(json.dumps(record) + "\n") diff --git a/MLK-Justice-Sweep/src/log_collector.py b/MLK-Justice-Sweep/src/log_collector.py new file mode 100644 index 0000000..6927b9c --- /dev/null +++ b/MLK-Justice-Sweep/src/log_collector.py @@ -0,0 +1,31 @@ +import datetime +from typing import List +from pathlib import Path + +from utils.models import LogEntry +from utils.time_utils import within_window + + +def parse_line(line: str, source: str) -> LogEntry: + # Very simplistic parser; you can enhance this based on your real log formats. + # Here we just attach the current time as a placeholder. + return LogEntry( + timestamp=datetime.datetime.now(datetime.timezone.utc), + source=source, + raw=line.strip(), + parsed={"raw": line.strip(), "source": source}, + ) + + +def collect_logs(sources: List[str], time_window_minutes: int) -> List[LogEntry]: + entries: List[LogEntry] = [] + for src in sources: + path = Path(src) + if not path.exists(): + continue + with path.open("r", encoding="utf-8", errors="ignore") as f: + for line in f: + entry = parse_line(line, source=src) + if within_window(entry.timestamp, time_window_minutes): + entries.append(entry) + return entries diff --git a/MLK-Justice-Sweep/src/main.py b/MLK-Justice-Sweep/src/main.py new file mode 100644 index 0000000..0a832e1 --- /dev/null +++ b/MLK-Justice-Sweep/src/main.py @@ -0,0 +1,91 @@ + +import importlib +try: + + yaml = importlib.import_module("yaml") +except ImportError: + try: + ruamel_yaml = importlib.import_module("ruamel.yaml") + yaml = ruamel_yaml + except ImportError: + raise ImportError("PyYAML or ruamel.yaml is required. Install with 'pip install pyyaml' or 'pip install ruamel.yaml'.") +from typing import Any + +from log_collector import collect_logs +from forward_pass import forward_pass +from reverse_pass import reverse_pass +from anomaly_merger import merge_anomalies +from integrity_vault import IntegrityVault +from turbo_satellite_client import TurboSatelliteClient +from jarvondis_adapter import JarvondisAdapter +from scheduler import run_infinity_loops + + +def load_config(path: str = "config/settings.yaml") -> dict[str, Any]: + with open(path, "r", encoding="utf-8") as f: + return yaml.safe_load(f) + + +def run_cycle(config: dict[str, Any]): + # Function implementation below + sources = [str(s) for s in config["log_sources"]] + time_window: int = int(str(config["time_window_minutes"])) + + adapter = JarvondisAdapter(config["jarvondis"]["output_path"]) + entries = collect_logs(sources, time_window) + + # 2. Forward + Reverse passes + forward_anoms = forward_pass(entries) + reverse_anoms = reverse_pass(entries) + + # 3. Merge anomalies + merged = merge_anomalies(forward_anoms, reverse_anoms) + + # 4. Integrity vault append + vault = IntegrityVault(config["integrity_vault"]["path"]) + vault_records = vault.append_anomalies(merged) + + # 5. Satellite anchor (optional) + if config["integrity_vault"].get("enable_satellite_anchor", False): + sat_client = TurboSatelliteClient( + endpoint=config["turbo_satellite"]["endpoint"], + api_key_env_var=config["turbo_satellite"]["api_key_env_var"] + ) + sat_client.anchor_records(vault_records) + + # 6. JARVONDIS output + adapter.write_stream(merged) + + print(f"Cycle completed. Entries: {len(entries)}, Anomalies: {len(merged)}") + + +def main(): + config: dict[str, Any] = load_config() + try: + forward_interval = int(config["scheduling"]["infinity_loop_forward_seconds"]) + except (ValueError, TypeError, KeyError): + forward_interval = 60 # default fallback + try: + reverse_interval = int(config["scheduling"]["infinity_loop_reverse_seconds"]) + except (ValueError, TypeError, KeyError): + reverse_interval = 60 # default fallback + + def forward_only(): + # For now, entire cycle is run once; + # you can separate forward/reverse logic if desired. + run_cycle(config) + + def reverse_only(): + # In a more advanced design, you might re-run only reverse analysis. + pass + + run_infinity_loops( + forward_func=forward_only, + reverse_func=reverse_only, + forward_interval=forward_interval, + reverse_interval=reverse_interval, + ) + + +if __name__ == "__main__": + main() diff --git a/MLK-Justice-Sweep/src/reverse_pass.py b/MLK-Justice-Sweep/src/reverse_pass.py new file mode 100644 index 0000000..7db8924 --- /dev/null +++ b/MLK-Justice-Sweep/src/reverse_pass.py @@ -0,0 +1,28 @@ +from typing import List +from utils.models import LogEntry, Anomaly +from utils.time_utils import now_utc + + +def reverse_pass(entries: List[LogEntry]) -> List[Anomaly]: + """ + Reverse-time anomaly detection. + Here we process entries in reverse order to find unusual sequences. + """ + anomalies: List[Anomaly] = [] + reversed_entries = list(reversed(entries)) + + for i, e in enumerate(reversed_entries): + # Example heuristic: search for "sudo" or "root" escalations + if "sudo" in e.raw.lower() or "root" in e.raw.lower(): + anomalies.append( + Anomaly( + id=f"rv-{i}", + severity="high", + description="Privilege-related event detected in reverse pass", + timestamp=now_utc(), + related_entries=[e.raw], + score=0.8, + metadata={"source": e.source, "direction": "reverse"}, + ) + ) + return anomalies diff --git a/MLK-Justice-Sweep/src/scheduler.py b/MLK-Justice-Sweep/src/scheduler.py new file mode 100644 index 0000000..d48171f --- /dev/null +++ b/MLK-Justice-Sweep/src/scheduler.py @@ -0,0 +1,24 @@ +import time +from typing import Callable + + +def run_infinity_loops( + forward_func: Callable[[], None], + reverse_func: Callable[[], None], + forward_interval: float, + reverse_interval: float, +): + """ + Symbolic infinity loops: + - Forward pass every forward_interval seconds. + - Reverse pass every reverse_interval seconds. + For simplicity, we just call them once here; in a real system, you'd + keep these running in their own scheduler or service. + """ + # Forward + time.sleep(forward_interval) + forward_func() + + # Reverse + time.sleep(reverse_interval) + reverse_func() diff --git a/MLK-Justice-Sweep/src/turbo_satellite_client.py b/MLK-Justice-Sweep/src/turbo_satellite_client.py new file mode 100644 index 0000000..395ecc5 --- /dev/null +++ b/MLK-Justice-Sweep/src/turbo_satellite_client.py @@ -0,0 +1,44 @@ +import os +import json +from typing import List, Dict, Any +import urllib.request + +from utils.models import VaultRecord + + +class TurboSatelliteClient: + """ + Represents the Turbo Stack Krystal Core satellite relay. + + In reality, this would use proper auth / TLS / retries. + Here we use a simple HTTP POST to symbolize anchoring. + """ + + def __init__(self, endpoint: str, api_key_env_var: str): + self.endpoint = endpoint + self.api_key = os.getenv(api_key_env_var) + + def anchor_records(self, records: List[VaultRecord]) -> Dict[str, Any]: + if not self.api_key: + return {"status": "skipped", "reason": "No API key set"} + + payload: Dict[str, Any] = { + "api_key": self.api_key, + "records": [ + {"index": r.index, "hash": r.hash, "previous_hash": r.previous_hash} + for r in records + ], + } + data = json.dumps(payload).encode("utf-8") + req = urllib.request.Request( + self.endpoint, + data=data, + headers={"Content-Type": "application/json"}, + method="POST", + ) + try: + with urllib.request.urlopen(req, timeout=10) as resp: + body = resp.read().decode("utf-8") + return {"status": "ok", "response": body} + except Exception as e: + return {"status": "error", "error": str(e)} diff --git a/MLK-Justice-Sweep/src/utils/hashing.py b/MLK-Justice-Sweep/src/utils/hashing.py new file mode 100644 index 0000000..0ae1eb0 --- /dev/null +++ b/MLK-Justice-Sweep/src/utils/hashing.py @@ -0,0 +1,11 @@ +import hashlib +import json +from typing import Any + + +def sha256_json(obj: Any) -> str: + """ + Create a stable SHA-256 hash of a JSON-serializable object. + """ + canonical = json.dumps(obj, sort_keys=True, separators=(",", ":")) + return hashlib.sha256(canonical.encode("utf-8")).hexdigest() diff --git a/MLK-Justice-Sweep/src/utils/models.py b/MLK-Justice-Sweep/src/utils/models.py new file mode 100644 index 0000000..508d92b --- /dev/null +++ b/MLK-Justice-Sweep/src/utils/models.py @@ -0,0 +1,31 @@ +from dataclasses import dataclass +from typing import Dict, Any, Optional +import datetime + + +@dataclass +class LogEntry: + timestamp: datetime.datetime + source: str + raw: str + parsed: Dict[str, Any] + + +@dataclass +class Anomaly: + id: str + severity: str + description: str + timestamp: datetime.datetime + related_entries: list[str] + score: float + metadata: Dict[str, Any] + + +@dataclass +class VaultRecord: + index: int + timestamp: datetime.datetime + anomaly_id: str + hash: str + previous_hash: Optional[str] diff --git a/MLK-Justice-Sweep/src/utils/time_utils.py b/MLK-Justice-Sweep/src/utils/time_utils.py new file mode 100644 index 0000000..f53b44f --- /dev/null +++ b/MLK-Justice-Sweep/src/utils/time_utils.py @@ -0,0 +1,13 @@ +import datetime +from typing import Optional + + +def now_utc() -> datetime.datetime: + return datetime.datetime.now(datetime.timezone.utc) + + +def within_window(ts: datetime.datetime, minutes: int, reference: Optional[datetime.datetime] = None) -> bool: + if reference is None: + reference = now_utc() + delta = reference - ts + return datetime.timedelta(minutes=0) <= delta <= datetime.timedelta(minutes=minutes) From 3ff178885a4dd52a015ffff60d5173abe35a014d Mon Sep 17 00:00:00 2001 From: "Leif W. Sogge" <144378178+GuardianNinja@users.noreply.github.com> Date: Sun, 4 Jan 2026 10:16:31 -0500 Subject: [PATCH 10/16] updates hope this helps --- .vscode/settings.json | 3 +++ apps/web/src/app/globals.css | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..5c0f1a8 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "markdown.validate.enabled": true +} \ No newline at end of file diff --git a/apps/web/src/app/globals.css b/apps/web/src/app/globals.css index 1b4ca7b..5c45124 100644 --- a/apps/web/src/app/globals.css +++ b/apps/web/src/app/globals.css @@ -1,6 +1,6 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; +/* @tailwind base; */ +/* @tailwind components; */ +/* @tailwind utilities; */ :root { --foreground-rgb: 0, 0, 0; From a17e435ac0a7fdf368878186a55e3aeb5685c663 Mon Sep 17 00:00:00 2001 From: "Leif W. Sogge" <144378178+GuardianNinja@users.noreply.github.com> Date: Mon, 5 Jan 2026 09:42:15 -0500 Subject: [PATCH 11/16] Modify funding model platforms in FUNDING.yml Updated funding model platforms in FUNDING.yml --- .github/FUNDING.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..578b3ab --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,15 @@ +Space LEAF Corp# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +polar: # Replace with a single Polar username +buy_me_a_coffee: # Replace with a single Buy Me a Coffee username +thanks_dev: # Replace with a single thanks.dev username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] From cdfdfb531812f496fafcac0d6c2e770f50afbaf3 Mon Sep 17 00:00:00 2001 From: "Leif W. Sogge" <144378178+GuardianNinja@users.noreply.github.com> Date: Wed, 7 Jan 2026 06:17:51 -0500 Subject: [PATCH 12/16] updated files keepingf up with everyone --- turbo.json | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/turbo.json b/turbo.json index 4cfbfb4..0dc9ad8 100644 --- a/turbo.json +++ b/turbo.json @@ -1,29 +1,6 @@ { "$schema": "https://turbo.build/schema.json", - "globalDependencies": ["**/.env.*local"], - "pipeline": { - "build": { - "dependsOn": ["^build"], - "outputs": [".next/**", "!.next/cache/**", "dist/**"] - }, - "dev": { - "cache": false, - "persistent": true - }, - "start": { - "dependsOn": ["build"], - "cache": false, - "persistent": true - }, - "lint": { - "outputs": [] - }, - "test": { - "dependsOn": ["^build"], - "outputs": ["coverage/**"] - }, - "clean": { - "cache": false - } - } + "tasks": {}, + "globalDependencies": ["**/.env.*local"] + } From 6f7eaca11ae24c27b404ec404f92494aae9db7c8 Mon Sep 17 00:00:00 2001 From: "Leif W. Sogge" <144378178+GuardianNinja@users.noreply.github.com> Date: Wed, 7 Jan 2026 09:21:44 -0500 Subject: [PATCH 13/16] Create SECURITY.md for security policy Add a security policy document outlining supported versions and vulnerability reporting. Signed-off-by: Leif W. Sogge <144378178+GuardianNinja@users.noreply.github.com> --- SECURITY.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..034e848 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,21 @@ +# Security Policy + +## Supported Versions + +Use this section to tell people about which versions of your project are +currently being supported with security updates. + +| Version | Supported | +| ------- | ------------------ | +| 5.1.x | :white_check_mark: | +| 5.0.x | :x: | +| 4.0.x | :white_check_mark: | +| < 4.0 | :x: | + +## Reporting a Vulnerability + +Use this section to tell people how to report a vulnerability. + +Tell them where to go, how often they can expect to get an update on a +reported vulnerability, what to expect if the vulnerability is accepted or +declined, etc. From 67d014e5614acdda71a5ed02d6982c32cba4f5f6 Mon Sep 17 00:00:00 2001 From: "Leif W. Sogge" <144378178+GuardianNinja@users.noreply.github.com> Date: Fri, 9 Jan 2026 20:46:21 -0500 Subject: [PATCH 14/16] Create turboStackValidation.ts Work in progress --- src/turboStackValidation.ts | 473 ++++++++++++++++++++++++++++++++++++ 1 file changed, 473 insertions(+) create mode 100644 src/turboStackValidation.ts diff --git a/src/turboStackValidation.ts b/src/turboStackValidation.ts new file mode 100644 index 0000000..db4b598 --- /dev/null +++ b/src/turboStackValidation.ts @@ -0,0 +1,473 @@ +/* + Turbo Stack Validation (Extended) + - Golden Apple (kids) and Diamond (adults) policies + - Earband realms/haptics + - Wireless charging + - Secure end-to-end hi-fi closed-loop pairing + - Space Leaf Corp turbostack satellite uplink (conceptual, config-level) +*/ + +////////////////////// +// Core types +////////////////////// + +type Realm = "OCEAN" | "LAND" | "SKY"; +type ServerKind = "GOLDEN_APPLE" | "DIAMOND"; + +interface RealmConfig { + name: Realm; + ear: "LEFT" | "RIGHT"; + verticalBand: "LOWER" | "MIDDLE" | "UPPER"; + hapticProfile: "ROLLING" | "GROUND_TAPS" | "SKY_FLUTTER" | "SHORELINE" | "TREE_LINE"; +} + +interface FirewallRules { + blocksAdultContent: boolean; + blocksCrossTrafficFromOtherServer: boolean; + blocksUnverifiedUploads: boolean; + requiresAgeVerification: boolean; + allowsAdultLanguage: boolean; + allowsMonetization: boolean; +} + +interface ServerPolicy { + kind: ServerKind; + symbol: "APPLE" | "DIAMOND"; + description: string; + realmsVisible: Realm[]; + firewall: FirewallRules; +} + +interface ValidationResult { + name: string; + passed: boolean; + details?: string; +} + +////////////////////// +// Device + link capabilities +////////////////////// + +interface WirelessChargingConfig { + enabled: boolean; + standard: "QI" | "PROPRIETARY" | "MAGNETIC_CRADLE"; + maxPowerWatts: number; + overheatProtection: boolean; + foreignObjectDetection: boolean; +} + +interface PairingSecurityConfig { + e2eEncryption: boolean; + encryptionSuite: "TLS_1_3" | "NOISE_PROTOCOL" | "CUSTOM_HARDWARE_LINK"; + mutualAuth: boolean; + keyRotationSeconds: number; + closedLoopHiFiAudio: boolean; + maxLatencyMs: number; +} + +interface SatelliteUplinkConfig { + enabled: boolean; + provider: "SPACE_LEAF_CORP_TURBOSTACK"; + uplinkUseCases: string[]; // e.g. ["telemetry", "safety_heartbeat"] + carriesUserContent: boolean; // should be FALSE for safety & privacy + fallbackToGroundOnlyIfSatelliteDown: boolean; +} + +interface DeviceStackConfig { + name: string; + wirelessCharging: WirelessChargingConfig; + pairingSecurity: PairingSecurityConfig; + satelliteUplink: SatelliteUplinkConfig; +} + +////////////////////// +// Golden Apple policy +////////////////////// + +const GoldenApplePolicy: ServerPolicy = { + kind: "GOLDEN_APPLE", + symbol: "APPLE", + description: "Kid-safe, no-bite apple; zero adult content, no monetization.", + realmsVisible: ["OCEAN", "LAND", "SKY"], + firewall: { + blocksAdultContent: true, + blocksCrossTrafficFromOtherServer: true, + blocksUnverifiedUploads: true, + requiresAgeVerification: false, // kids admitted via parent/classroom systems + allowsAdultLanguage: false, + allowsMonetization: false + } +}; + +////////////////////// +// Diamond policy +////////////////////// + +const DiamondPolicy: ServerPolicy = { + kind: "DIAMOND", + symbol: "DIAMOND", + description: "Adult-only diamond vault; expressive but responsible, with strong walls.", + realmsVisible: ["OCEAN", "LAND", "SKY"], + firewall: { + blocksAdultContent: false, // adult content allowed inside, but walled + blocksCrossTrafficFromOtherServer: true, + blocksUnverifiedUploads: false, // allowed but governed + requiresAgeVerification: true, + allowsAdultLanguage: true, + allowsMonetization: true + } +}; + +////////////////////// +// Earband / realm mapping +////////////////////// + +const EarRealmMap: RealmConfig[] = [ + // OCEAN -> left ear (all bands) + { + name: "OCEAN", + ear: "LEFT", + verticalBand: "LOWER", + hapticProfile: "ROLLING" + }, + { + name: "OCEAN", + ear: "LEFT", + verticalBand: "MIDDLE", + hapticProfile: "SHORELINE" + }, + { + name: "OCEAN", + ear: "LEFT", + verticalBand: "UPPER", + hapticProfile: "ROLLING" + }, + // LAND -> right ear, lower/middle + { + name: "LAND", + ear: "RIGHT", + verticalBand: "LOWER", + hapticProfile: "GROUND_TAPS" + }, + { + name: "LAND", + ear: "RIGHT", + verticalBand: "MIDDLE", + hapticProfile: "TREE_LINE" + }, + // SKY -> right ear, upper + { + name: "SKY", + ear: "RIGHT", + verticalBand: "UPPER", + hapticProfile: "SKY_FLUTTER" + } +]; + +////////////////////// +// Device stack config +////////////////////// + +const EarbandDeviceStack: DeviceStackConfig = { + name: "Space Leaf Corp Earband v1", + wirelessCharging: { + enabled: true, + standard: "QI", + maxPowerWatts: 5, + overheatProtection: true, + foreignObjectDetection: true + }, + pairingSecurity: { + e2eEncryption: true, + encryptionSuite: "NOISE_PROTOCOL", + mutualAuth: true, + keyRotationSeconds: 3600, // once per hour + closedLoopHiFiAudio: true, + maxLatencyMs: 40 // low enough for hi-fi gaming audio + }, + satelliteUplink: { + enabled: true, + provider: "SPACE_LEAF_CORP_TURBOSTACK", + uplinkUseCases: [ + "telemetry", + "safety_heartbeat", + "firmware_update_metadata" + ], + carriesUserContent: false, // IMPORTANT: no user chats/voice/data + fallbackToGroundOnlyIfSatelliteDown: true + } +}; + +////////////////////// +// Validation functions +////////////////////// + +function validateGoldenApplePolicy(policy: ServerPolicy): ValidationResult[] { + const results: ValidationResult[] = []; + + results.push({ + name: "Golden Apple blocks all adult content", + passed: policy.firewall.blocksAdultContent === true, + details: `blocksAdultContent = ${policy.firewall.blocksAdultContent}` + }); + + results.push({ + name: "Golden Apple blocks cross-traffic from Diamond", + passed: policy.firewall.blocksCrossTrafficFromOtherServer === true, + details: `blocksCrossTrafficFromOtherServer = ${policy.firewall.blocksCrossTrafficFromOtherServer}` + }); + + results.push({ + name: "Golden Apple blocks unverified uploads", + passed: policy.firewall.blocksUnverifiedUploads === true, + details: `blocksUnverifiedUploads = ${policy.firewall.blocksUnverifiedUploads}` + }); + + results.push({ + name: "Golden Apple does NOT allow adult language", + passed: policy.firewall.allowsAdultLanguage === false, + details: `allowsAdultLanguage = ${policy.firewall.allowsAdultLanguage}` + }); + + results.push({ + name: "Golden Apple does NOT allow monetization", + passed: policy.firewall.allowsMonetization === false, + details: `allowsMonetization = ${policy.firewall.allowsMonetization}` + }); + + return results; +} + +function validateDiamondPolicy(policy: ServerPolicy): ValidationResult[] { + const results: ValidationResult[] = []; + + results.push({ + name: "Diamond requires age verification", + passed: policy.firewall.requiresAgeVerification === true, + details: `requiresAgeVerification = ${policy.firewall.requiresAgeVerification}` + }); + + results.push({ + name: "Diamond blocks cross-traffic from Golden Apple", + passed: policy.firewall.blocksCrossTrafficFromOtherServer === true, + details: `blocksCrossTrafficFromOtherServer = ${policy.firewall.blocksCrossTrafficFromOtherServer}` + }); + + results.push({ + name: "Diamond allows adult language", + passed: policy.firewall.allowsAdultLanguage === true, + details: `allowsAdultLanguage = ${policy.firewall.allowsAdultLanguage}` + }); + + results.push({ + name: "Diamond allows monetization", + passed: policy.firewall.allowsMonetization === true, + details: `allowsMonetization = ${policy.firewall.allowsMonetization}` + }); + + return results; +} + +function validateRealmEarMapping(configs: RealmConfig[]): ValidationResult[] { + const results: ValidationResult[] = []; + + // OCEAN must be left ear only + const oceanErrors: string[] = []; + for (const c of configs.filter(c => c.name === "OCEAN")) { + if (c.ear !== "LEFT") { + oceanErrors.push( + `OCEAN realm incorrectly mapped to ${c.ear} ear at ${c.verticalBand}` + ); + } + } + results.push({ + name: "OCEAN mapped only to left ear", + passed: oceanErrors.length === 0, + details: oceanErrors.join("; ") || "OK" + }); + + // LAND must be right ear, lower/mid bands + const landErrors: string[] = []; + for (const c of configs.filter(c => c.name === "LAND")) { + if (c.ear !== "RIGHT") { + landErrors.push( + `LAND realm incorrectly mapped to ${c.ear} ear at ${c.verticalBand}` + ); + } + if (c.verticalBand === "UPPER") { + landErrors.push(`LAND should not use UPPER band on right ear`); + } + } + results.push({ + name: "LAND mapped to right ear, lower/middle only", + passed: landErrors.length === 0, + details: landErrors.join("; ") || "OK" + }); + + // SKY must be right ear, upper band only + const skyErrors: string[] = []; + for (const c of configs.filter(c => c.name === "SKY")) { + if (c.ear !== "RIGHT") { + skyErrors.push( + `SKY realm incorrectly mapped to ${c.ear} ear at ${c.verticalBand}` + ); + } + if (c.verticalBand !== "UPPER") { + skyErrors.push( + `SKY should only use UPPER band, found ${c.verticalBand}` + ); + } + } + results.push({ + name: "SKY mapped to right ear, upper only", + passed: skyErrors.length === 0, + details: skyErrors.join("; ") || "OK" + }); + + return results; +} + +function validateWirelessCharging(cfg: WirelessChargingConfig): ValidationResult[] { + const results: ValidationResult[] = []; + + results.push({ + name: "Wireless charging is enabled", + passed: cfg.enabled === true, + details: `enabled = ${cfg.enabled}` + }); + + results.push({ + name: "Wireless charging power is in safe range (<= 5W for earband)", + passed: cfg.maxPowerWatts <= 5, + details: `maxPowerWatts = ${cfg.maxPowerWatts}` + }); + + results.push({ + name: "Wireless charging has overheat protection", + passed: cfg.overheatProtection === true, + details: `overheatProtection = ${cfg.overheatProtection}` + }); + + results.push({ + name: "Wireless charging has foreign object detection", + passed: cfg.foreignObjectDetection === true, + details: `foreignObjectDetection = ${cfg.foreignObjectDetection}` + }); + + return results; +} + +function validatePairingSecurity(cfg: PairingSecurityConfig): ValidationResult[] { + const results: ValidationResult[] = []; + + results.push({ + name: "Pairing uses end-to-end encryption", + passed: cfg.e2eEncryption === true, + details: `e2eEncryption = ${cfg.e2eEncryption}` + }); + + results.push({ + name: "Pairing requires mutual authentication", + passed: cfg.mutualAuth === true, + details: `mutualAuth = ${cfg.mutualAuth}` + }); + + results.push({ + name: "Closed-loop hi-fi audio is enabled", + passed: cfg.closedLoopHiFiAudio === true, + details: `closedLoopHiFiAudio = ${cfg.closedLoopHiFiAudio}` + }); + + results.push({ + name: "Latency budget suitable for hi-fi gaming audio (<= 40ms)", + passed: cfg.maxLatencyMs <= 40, + details: `maxLatencyMs = ${cfg.maxLatencyMs}` + }); + + return results; +} + +function validateSatelliteUplink(cfg: SatelliteUplinkConfig): ValidationResult[] { + const results: ValidationResult[] = []; + + results.push({ + name: "Satellite uplink is enabled and uses Space Leaf Corp turbostack provider", + passed: cfg.enabled === true && cfg.provider === "SPACE_LEAF_CORP_TURBOSTACK", + details: `enabled = ${cfg.enabled}, provider = ${cfg.provider}` + }); + + results.push({ + name: "Satellite uplink does NOT carry user content (telemetry/safety only)", + passed: cfg.carriesUserContent === false, + details: `carriesUserContent = ${cfg.carriesUserContent}` + }); + + results.push({ + name: "Satellite uplink has ground fallback if satellite is down", + passed: cfg.fallbackToGroundOnlyIfSatelliteDown === true, + details: `fallbackToGroundOnlyIfSatelliteDown = ${cfg.fallbackToGroundOnlyIfSatelliteDown}` + }); + + return results; +} + +////////////////////// +// Turbo stack runner +////////////////////// + +function runTurboStackValidation(): void { + console.log("=== TURBO STACK VALIDATION START ===\n"); + + const allResults: ValidationResult[] = []; + + // Server policies + allResults.push(...validateGoldenApplePolicy(GoldenApplePolicy)); + allResults.push(...validateDiamondPolicy(DiamondPolicy)); + + // Realm + ear layout + allResults.push(...validateRealmEarMapping(EarRealmMap)); + + // Device stack (wireless, pairing, satellite) + allResults.push(...validateWirelessCharging(EarbandDeviceStack.wirelessCharging)); + allResults.push(...validatePairingSecurity(EarbandDeviceStack.pairingSecurity)); + allResults.push(...validateSatelliteUplink(EarbandDeviceStack.satelliteUplink)); + + let passedCount = 0; + let failedCount = 0; + + for (const r of allResults) { + if (r.passed) { + passedCount++; + console.log(`✅ ${r.name}`); + } else { + failedCount++; + console.log(`❌ ${r.name}`); + if (r.details) { + console.log(` Details: ${r.details}`); + } + } + } + + console.log("\n=== SUMMARY ==="); + console.log(`Passed: ${passedCount}`); + console.log(`Failed: ${failedCount}`); + + if (failedCount === 0) { + console.log("\nTurbo stack integrity: OK (all invariants satisfied)."); + } else { + console.log("\nTurbo stack integrity: BROKEN (fix failed rules above)."); + } + + console.log("\n=== TURBO STACK VALIDATION END ==="); +} + +////////////////////// +// Entry point +////////////////////// + +// Polyfill or declare 'console' if not present (for non-browser/node targets) +declare var console: { + log(message?: any, ...optionalParams: any[]): void; +}; + +runTurboStackValidation(); From 150daf72fbd02eab232d508240920c2efd79a61b Mon Sep 17 00:00:00 2001 From: "Leif W. Sogge" <144378178+GuardianNinja@users.noreply.github.com> Date: Fri, 9 Jan 2026 21:02:09 -0500 Subject: [PATCH 15/16] local test i ran on my device Was a bit tricky however we did it it works we I did it with AI help. lol --- README.md | 24 +++++++++++++++++++----- turbo.json | 1 - 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2969baa..6872ff8 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ ## ✨ What's Included **Authentication System** - Ready out of the box: + - ✅ User signup & login with bcrypt password hashing - ✅ Secure credential validation - ✅ Clean REST API endpoints @@ -14,6 +15,7 @@ - ✅ Easy to extend with JWT, OAuth, 2FA **Modern Tech Stack**: + - **Frontend**: Next.js 14 (App Router) with TypeScript & Tailwind CSS - **Backend**: Express.js API with TypeScript - **Database**: Prisma ORM (PostgreSQL/MySQL ready) @@ -31,7 +33,7 @@ ## 📁 Project Structure -``` +```bash turbo_stack-/ ├── apps/ │ ├── web/ # Next.js frontend application @@ -41,11 +43,11 @@ turbo_stack-/ ├── package.json # Root package.json with workspaces ├── turbo.json # Turborepo configuration └── docker-compose.yml # Docker services (PostgreSQL, Redis) -``` ## ⚡ Quick Start (2 minutes) ### Prerequisites + - Node.js 18+ - pnpm (install: `npm install -g pnpm`) @@ -62,7 +64,7 @@ pnpm dev --filter backend # API on :3001 pnpm dev --filter frontend # Web on :3000 ``` -**That's it!** Visit http://localhost:3000 and create an account. +**That's it!** Visit and create an account. ### Optional: Full Database Setup @@ -75,6 +77,7 @@ pnpm db:setup ## 🎨 Customization Guide ### Add Your Branding + ```bash # Update apps/web/src/app/page.tsx # Change "Turbo Stack" to your product name @@ -82,6 +85,7 @@ pnpm db:setup ``` ### Extend Authentication + ```typescript // apps/api/src/routes/auth.ts @@ -96,6 +100,7 @@ const token = jwt.sign({ userId: user.id }, process.env.JWT_SECRET); ``` ### Connect a Database + ```bash # Update apps/api/src/routes/auth.ts # Replace in-memory users array with Prisma: @@ -111,11 +116,11 @@ const user = await prisma.user.create({ ## 🏗️ Architecture Highlights **Monorepo Structure** - Shared code, independent deploys: -``` + +```bash apps/web → Frontend (Vercel/Netlify ready) apps/api → Backend (Railway/Render ready) packages/db → Shared database schemas -``` **Type Safety** - End-to-end TypeScript **Code Sharing** - Reuse types, utilities, configs @@ -125,18 +130,21 @@ packages/db → Shared database schemas ## 📦 Database Management **Run migrations**: + ```bash cd packages/database npx prisma migrate dev --name your_migration_name ``` **Open Prisma Studio** (database GUI): + ```bash cd packages/database npx prisma studio ``` **Generate Prisma Client**: + ```bash cd packages/database npx prisma generate @@ -145,22 +153,26 @@ npx prisma generate ## 🚀 Deployment Options ### Option 1: Vercel + Railway (Fastest) + - **Frontend** → Vercel (connect GitHub, auto-deploy) - **Backend** → Railway (one-click PostgreSQL) - **Time to deploy**: ~5 minutes ### Option 2: Docker Containers + ```bash docker-compose up -d # PostgreSQL + Redis + Apps ``` ### Option 3: Kubernetes (Enterprise) + ```bash ./install-k8s-tools.sh # Install minikube, helm ./deploy-minikube.sh # Deploy with Helm charts ``` **Helm Features:** + - 🎭 High availability (2+ replicas) - 📊 Health checks & monitoring - 🔄 Auto-scaling ready @@ -177,6 +189,7 @@ docker-compose up -d # PostgreSQL + Redis + Apps **GitHub**: Click "Use this template" button above **Or clone directly:** + ```bash git clone https://github.com/Space-LEAF-corp/turbo_stack-.git my-app cd my-app @@ -191,6 +204,7 @@ pnpm install This template showcases production-ready architecture. Need custom development? **We deliver:** + - ✅ Secure authentication & authorization systems - ✅ Scalable full-stack applications - ✅ Cloud-native deployments (AWS, GCP, Azure) diff --git a/turbo.json b/turbo.json index 0dc9ad8..a1be700 100644 --- a/turbo.json +++ b/turbo.json @@ -1,5 +1,4 @@ { - "$schema": "https://turbo.build/schema.json", "tasks": {}, "globalDependencies": ["**/.env.*local"] From 10a6f0b518ded07e4ba4fb1f903082a3b62e7843 Mon Sep 17 00:00:00 2001 From: "Leif W. Sogge" <144378178+GuardianNinja@users.noreply.github.com> Date: Fri, 9 Jan 2026 21:13:15 -0500 Subject: [PATCH 16/16] Create Living-spec.ts bug fixed and tested in liocal space --- src/Living-spec.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/Living-spec.ts diff --git a/src/Living-spec.ts b/src/Living-spec.ts new file mode 100644 index 0000000..c848421 --- /dev/null +++ b/src/Living-spec.ts @@ -0,0 +1,22 @@ +// @ts-ignore +import express, { Request, Response } from "express"; +import { runTurboStackValidationAndGetResults } from "./turboCore"; // you’d extract logic + + +interface TurboStackValidationResults { + passedCount: number; + failedCount: number; + results: any; // Replace 'any' with a more specific type if known +} + +const app = express(); + +app.get("/health/turbo", (_req: Request, res: Response) => { + const { passedCount, failedCount, results }: TurboStackValidationResults = runTurboStackValidationAndGetResults(); + const status: number = failedCount === 0 ? 200 : 500; + res.status(status).json({ passedCount, failedCount, results }); +}); + +app.listen(3000, () => { + console.log("Turbo health listening on :3000"); +});