summaryrefslogtreecommitdiff
path: root/modes/base.sh
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-03-27 23:23:43 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-03-27 23:23:43 +0000
commit7519de4e56323230d06cfc64b00df52339eb2434 (patch)
tree87712be5ef45a6913601e729c18a67c20fee9f09 /modes/base.sh
Initial project setupHEADmain
Add modal-shell project with .agent/ config, mode stubs, ms dispatcher, bare repo at /site/git.terst.org/repos/modal-shell.git, and ADR-001.
Diffstat (limited to 'modes/base.sh')
-rwxr-xr-xmodes/base.sh53
1 files changed, 53 insertions, 0 deletions
diff --git a/modes/base.sh b/modes/base.sh
new file mode 100755
index 0000000..e914d96
--- /dev/null
+++ b/modes/base.sh
@@ -0,0 +1,53 @@
+#!/usr/bin/env bash
+# base.sh — sourced by all modes. Sets shared environment. Never executed directly.
+#
+# Customize this file for your specific project and toolchain.
+# Do not add mode-specific logic here.
+
+# ── Project root ──────────────────────────────────────────────────────────────
+# Resolves to the repo root regardless of where ms is invoked from.
+export PROJECT_ROOT
+PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+
+# ── Secrets ───────────────────────────────────────────────────────────────────
+# Load secrets from 1Password CLI if available, otherwise fall back to .env.
+# Never commit .env. Never hardcode credentials here.
+#
+# Option A: 1Password CLI (preferred)
+# export OP_ACCOUNT="my.1password.com"
+# eval "$(op signin)"
+#
+# Option B: doppler
+# eval "$(doppler secrets download --no-file --format env)"
+#
+# Option C: local .env (dev only, never commit)
+if [[ -f "$PROJECT_ROOT/.env" ]]; then
+ # shellcheck source=/dev/null
+ set -a
+ source "$PROJECT_ROOT/.env"
+ set +a
+fi
+
+# ── Database ──────────────────────────────────────────────────────────────────
+# Set these via secrets above; stubs provided for clarity.
+export DB_HOST="${DB_HOST:-localhost}"
+export DB_PORT="${DB_PORT:-5432}"
+export DB_NAME="${DB_NAME:-}"
+export DB_USER="${DB_USER:-}"
+export DB_PASS="${DB_PASS:-}"
+
+# ── Runtime ───────────────────────────────────────────────────────────────────
+# Configure the runtime environment your project uses.
+# Examples — uncomment and adjust as needed:
+#
+# Docker Compose:
+# export COMPOSE_FILE="$PROJECT_ROOT/docker-compose.yml"
+#
+# nix:
+# # (handled by nix develop — base.sh runs inside the devshell)
+#
+# Tool versions (if using mise/asdf):
+# export MISE_TOML="$PROJECT_ROOT/.mise.toml"
+
+# ── Path additions ────────────────────────────────────────────────────────────
+export PATH="$PROJECT_ROOT/bin:$PATH"