#!/bin/bash # Strata Framework - Environment Setup # Source this file to set up the Strata environment without installing # Usage: source ./scripts/env.sh # or: . ./scripts/env.sh # Get the directory of this script if [ -n "$BASH_SOURCE" ]; then SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" elif [ -n "$ZSH_VERSION" ]; then SCRIPT_DIR="$(cd "$(dirname "${(%):-%x}")" && pwd)" else SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" fi REPO_DIR="$(dirname "$SCRIPT_DIR")" # Check if binary exists if [ ! -x "$REPO_DIR/bin/strata" ]; then echo "Strata binary not found. Building..." (cd "$REPO_DIR" && make build) fi # Set environment variables export STRATA_DEV=1 export STRATA_REPO="$REPO_DIR" export PATH="$REPO_DIR/bin:$PATH" # Set aliases alias st='strata-compile' alias stdev='strata-compile dev' alias stbuild='strata-compile build' alias stgen='strata-compile generate' alias stnew='npx create-strata-compile' # Development aliases alias stmake='make -C "$STRATA_REPO"' alias stbuild-compiler='make -C "$STRATA_REPO" build' alias stclean='make -C "$STRATA_REPO" clean' alias sttest='make -C "$STRATA_REPO" test' # Quick function to rebuild and run strebuild() { make -C "$STRATA_REPO" build && strata "$@" } # Function to run example app stexample() { cd "$STRATA_REPO/examples/basic-app" && strata-compile dev } echo "" echo "Strata development environment activated!" echo "" echo " Binary: $REPO_DIR/bin/strata" echo " Version: $(strata version 2>/dev/null || echo 'unknown')" echo "" echo " Commands:" echo " strata - Run strata CLI" echo " strebuild - Rebuild compiler and run command" echo " stexample - Run example app" echo " stmake - Run make command in repo" echo "" echo " Aliases:" echo " st, stdev, stbuild, stgen, stnew" echo ""