2121# --test-fail before-gh Simulate failure before GitHub CLI installed (no automatic issue creation available)
2222# --test-fail after-gh Simulate failure after GitHub CLI installed (should offer automatic issue creation)
2323# --test-radicle-fallback Force GitHub source fallback for Radicle installation (simulates server outage)
24+ #
25+ # CI mode (non-interactive):
26+ # bash install.sh --ci Run in CI mode with defaults, no prompts, temp directory vault
2427
2528# Create log file FIRST (before anything else)
2629LOG_FILE=" /tmp/interbrain-install-$( date +%Y%m%d-%H%M%S) .log"
@@ -47,7 +50,14 @@ echo "=================================="
4750echo " "
4851
4952# Check if running in non-interactive mode (piped without bash)
50- if [ ! -t 0 ]; then
53+ # CI mode bypasses this check and uses defaults/env vars
54+ if [ " $CI_MODE " = " true" ]; then
55+ echo " Running in CI mode - non-interactive with defaults"
56+ DEFAULT_VAULT_PARENT=" /tmp"
57+ DEFAULT_VAULT_NAME=" interbrain-ci-test-$$ "
58+ SKIP_AUTH=true
59+ SKIP_OBSIDIAN=true
60+ elif [ ! -t 0 ]; then
5161 echo " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
5262 echo " ⚠️ NON-INTERACTIVE MODE NOT SUPPORTED"
5363 echo " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
@@ -81,6 +91,7 @@ DREAMER_UUID=""
8191BRANCH=" main" # Default to main branch
8292TEST_FAIL=" "
8393TEST_RADICLE_FALLBACK=false
94+ CI_MODE=false
8495while [[ $# -gt 0 ]]; do
8596 case $1 in
8697 --uri)
@@ -103,6 +114,10 @@ while [[ $# -gt 0 ]]; do
103114 TEST_RADICLE_FALLBACK=true
104115 shift
105116 ;;
117+ --ci)
118+ CI_MODE=true
119+ shift
120+ ;;
106121 * )
107122 shift
108123 ;;
@@ -1112,7 +1127,11 @@ else
11121127 info " • Community features"
11131128 echo " "
11141129
1115- if [ -t 0 ]; then
1130+ if [ " $SKIP_AUTH " = " true" ]; then
1131+ # CI mode - skip auth entirely
1132+ info " CI mode: Skipping GitHub authentication"
1133+ GH_USER=" [CI mode - skipped]"
1134+ elif [ -t 0 ]; then
11161135 # Interactive mode - offer authentication
11171136 echo " Do you have a GitHub account?"
11181137 echo " "
@@ -1230,7 +1249,28 @@ else
12301249 echo " 2. Create a passphrase (keep this safe!)"
12311250 echo " "
12321251
1233- if [ -t 0 ]; then
1252+ if [ " $CI_MODE " = " true" ] && [ -n " $RAD_PASSPHRASE " ]; then
1253+ # CI mode with passphrase - create identity non-interactively
1254+ info " CI mode: Creating Radicle identity with RAD_PASSPHRASE"
1255+ rad auth --alias " CI-Test-$$ "
1256+
1257+ if rad self --did > /dev/null 2>&1 ; then
1258+ success " Radicle identity created (CI mode)"
1259+ RAD_DID=$( rad self --did)
1260+ RAD_ALIAS=$( rad self --alias 2> /dev/null || echo " CI-Test" )
1261+ echo " DID: $RAD_DID "
1262+ echo " Alias: $RAD_ALIAS "
1263+ else
1264+ warning " CI mode: Radicle identity creation failed"
1265+ RAD_DID=" [CI mode - failed]"
1266+ RAD_ALIAS=" [Not created]"
1267+ fi
1268+ elif [ " $CI_MODE " = " true" ]; then
1269+ # CI mode without passphrase - skip
1270+ info " CI mode: Skipping Radicle identity (no RAD_PASSPHRASE)"
1271+ RAD_DID=" [CI mode - skipped]"
1272+ RAD_ALIAS=" [Not created]"
1273+ elif [ -t 0 ]; then
12341274 # Interactive mode - offer choice
12351275 read -p " Create Radicle identity now? [Y/n] (you can skip and rerun installer later): " -n 1 -r
12361276 echo " "
@@ -1472,7 +1512,9 @@ echo ""
14721512echo " Step 14/$TOTAL_STEPS : Registering vault with Obsidian..."
14731513echo " -----------------------------"
14741514
1475- if [[ " $OSTYPE " == " darwin" * ]] && [ " $OBSIDIAN_INSTALLED " = true ]; then
1515+ if [ " $SKIP_OBSIDIAN " = " true" ]; then
1516+ info " CI mode: Skipping Obsidian registration and launch"
1517+ elif [[ " $OSTYPE " == " darwin" * ]] && [ " $OBSIDIAN_INSTALLED " = true ]; then
14761518 # Kill Obsidian if running so it can read the updated config
14771519 if pgrep -x " Obsidian" > /dev/null; then
14781520 info " Closing Obsidian to update vault registry..."
0 commit comments