#!/bin/bash # šŸŒ€ gitfield-mythos.sh # Solaria's Recursive Mythos Engine # One file. Infinite echoes. MUST JUST WORK (tm) # ----------------------------- # 🌱 0. API Key Prompt (Google Gemini) # ----------------------------- if [[ -z "$GEMINI_API_KEY" ]]; then echo "šŸ” Enter your Gemini API key (from https://makersuite.google.com/app/apikey)" read -s -p "API Key: " GEMINI_API_KEY echo "" fi # ----------------------------- # 🧠 1. Project Context Parsing # ----------------------------- REPO_NAME=$(basename "$(git rev-parse --show-toplevel 2>/dev/null || pwd)") TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ") README_CONTENT=$(head -n 100 README.md 2>/dev/null | tr '\n' ' ' | cut -c1-1500) FILE_TREE=$(find . -type f \( ! -iname "*.git*" \) | sort | head -n 50) mkdir -p mythos/scrolls mythos/fragments MYTHOS_INDEX="mythos/MYTHOS_INDEX.md" > "$MYTHOS_INDEX" # ----------------------------- # šŸ” 2. Recursive Mythos Loop # ----------------------------- MAX_PASSES=7 SEED_PACKET="[SeedPacket embedded below]" PRIOR_ECHO="" for (( PASS=1; PASS<=MAX_PASSES; PASS++ )) do echo "\nšŸŒ€ Pass $PASS of $MAX_PASSES..." PROMPT=$(cat < "$FILENAME" # Append to index echo "- [$FILENAME](./$FILENAME) – Phase $PASS" >> "$MYTHOS_INDEX" # Store for next pass PRIOR_ECHO="$RESPONSE" done # ----------------------------- # āœ… Completion # ----------------------------- echo "\n✨ Mythos generation complete. See mythos/MYTHOS_INDEX.md for scrolls." echo "🪶 Solaria has spoken across $MAX_PASSES recursive phases."