start.command: real crows from a local .env key; --mock for offline
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UQnSw4RRWp8uqpj3nsnnXF
This commit is contained in:
2 files changed
+19
-8
No files matched your search
@@ -6,3 +6,4 @@ dist/
|
|||||||
/somanycrows
|
/somanycrows
|
||||||
/web/
|
/web/
|
||||||
/dist/
|
/dist/
|
||||||
|
.env
|
||||||
+18
-8
@@ -1,19 +1,29 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# So Many Crows: local test server.
|
# So Many Crows: local server.
|
||||||
# Double-click to start. Close this window (or Ctrl-C) to stop.
|
# Double-click to start. Close this window (or Ctrl-C) to stop.
|
||||||
#
|
#
|
||||||
# Controlled by default:
|
# - Real crows (Claude) when .env in this folder holds ANTHROPIC_API_KEY=...; mock crows otherwise.
|
||||||
# - offline mock crows (no API key used, no cost, no network calls)
|
# - `./start.command --mock` forces mock crows.
|
||||||
# - listens on this Mac only (127.0.0.1:8080)
|
# - Listens on this Mac only (127.0.0.1:8080). State lives in .crows/ (delete it to start fresh).
|
||||||
# - all state lives in this folder's .crows/ (delete it to start fresh)
|
# - Guardrails: 20,000 tokens per item, 100,000 per list; you approve everything until crows earn trust.
|
||||||
# From Terminal, `./start.command --real` uses real Claude crows (needs ANTHROPIC_API_KEY).
|
|
||||||
cd "$(dirname "$0")" || exit 1
|
cd "$(dirname "$0")" || exit 1
|
||||||
xattr -d com.apple.quarantine ./crows 2>/dev/null
|
xattr -d com.apple.quarantine ./crows 2>/dev/null
|
||||||
chmod +x ./crows
|
chmod +x ./crows
|
||||||
if [ "$1" != "--real" ]; then
|
|
||||||
unset ANTHROPIC_API_KEY
|
unset ANTHROPIC_API_KEY
|
||||||
echo "Controlled mode: offline mock crows."
|
if [ "$1" != "--mock" ] && [ -f .env ]; then
|
||||||
|
# Read only the key line; the file is never executed.
|
||||||
|
ANTHROPIC_API_KEY="$(sed -n 's/^ANTHROPIC_API_KEY=//p' .env | head -n 1 | tr -d '[:space:]')"
|
||||||
|
CROWS_MODEL_FROM_ENV="$(sed -n 's/^CROWS_MODEL=//p' .env | head -n 1 | tr -d '[:space:]')"
|
||||||
|
[ -n "$CROWS_MODEL_FROM_ENV" ] && export CROWS_MODEL="$CROWS_MODEL_FROM_ENV"
|
||||||
|
[ -n "$ANTHROPIC_API_KEY" ] && export ANTHROPIC_API_KEY
|
||||||
fi
|
fi
|
||||||
|
if [ -n "$ANTHROPIC_API_KEY" ]; then
|
||||||
|
echo "Real crows: Claude (${CROWS_MODEL:-claude-sonnet-5-5}). Each list is capped at 100,000 tokens."
|
||||||
|
else
|
||||||
|
echo "Mock crows (no key in .env, or --mock)."
|
||||||
|
fi
|
||||||
|
|
||||||
if lsof -iTCP:8080 -sTCP:LISTEN >/dev/null 2>&1; then
|
if lsof -iTCP:8080 -sTCP:LISTEN >/dev/null 2>&1; then
|
||||||
echo "Something is already using port 8080. Stop it first."
|
echo "Something is already using port 8080. Stop it first."
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in new issue
Block a user