Repository navigation
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·143 lines (114 loc) · 6.53 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·143 lines (114 loc) · 6.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/usr/bin/env bash
# =============================================================================
# Shiro — first-run setup script
# Usage: ./setup.sh
# =============================================================================
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BRIDGE_DIR="$REPO_ROOT/acp-bridge"
SHIRO_DIR="$HOME/.shiro"
# ─── colors ──────────────────────────────────────────────────────────────────
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'
CYAN='\033[0;36m'; BOLD='\033[1m'; RESET='\033[0m'
ok() { echo -e "${GREEN}✓${RESET} $1"; }
warn() { echo -e "${YELLOW}⚠${RESET} $1"; }
err() { echo -e "${RED}✗${RESET} $1"; }
step() { echo -e "\n${CYAN}${BOLD}▸ $1${RESET}"; }
echo -e "${BOLD}"
cat <<'BANNER'
███████╗██╗ ██╗██╗██████╗ ██████╗
██╔════╝██║ ██║██║██╔══██╗██╔═══██╗
███████╗███████║██║██████╔╝██║ ██║
╚════██║██╔══██║██║██╔══██╗██║ ██║
███████║██║ ██║██║██║ ██║╚██████╔╝
╚══════╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝ ╚═════╝
Local-first macOS AI Desktop Agent — Setup
BANNER
echo -e "${RESET}"
# ─── 1. Prerequisites ─────────────────────────────────────────────────────────
step "Checking prerequisites"
if ! command -v node &>/dev/null; then
err "Node.js not found. Install via: brew install node"
exit 1
fi
NODE_VER=$(node --version)
ok "Node.js $NODE_VER"
if ! command -v npm &>/dev/null; then
err "npm not found (should ship with Node.js)"
exit 1
fi
ok "npm $(npm --version)"
if ! xcode-select -p &>/dev/null; then
warn "Xcode Command Line Tools not found. Run: xcode-select --install"
fi
# ─── 2. Build the Node bridge ─────────────────────────────────────────────────
step "Building ACP bridge (acp-bridge/)"
cd "$BRIDGE_DIR"
if [ ! -d node_modules ]; then
echo " Installing npm dependencies…"
npm install --silent
ok "npm install"
else
ok "node_modules already present (skipping install)"
fi
echo " Compiling TypeScript…"
npm run build
ok "Bridge compiled → acp-bridge/dist/"
cd "$REPO_ROOT"
# ─── 3. Create ~/.shiro config directories ────────────────────────────────────
step "Creating ~/.shiro config directories"
mkdir -p "$SHIRO_DIR/skills"
mkdir -p "$SHIRO_DIR/hooks"
ok "~/.shiro/ structure ready"
# ─── 4. Verify Swift package resolves ─────────────────────────────────────────
step "Verifying Swift Package.swift"
if ! command -v swift &>/dev/null; then
warn "swift CLI not found — Xcode must be installed to build the app"
else
echo " Resolving Swift package dependencies…"
swift package resolve 2>&1 | tail -3 || true
ok "Swift package dependencies resolved"
fi
# ─── 5. Print Xcode setup instructions ───────────────────────────────────────
step "Xcode setup instructions"
BRIDGE_DIST="$BRIDGE_DIR/dist/index.js"
echo -e "
${BOLD}Open the project in Xcode:${RESET}
open $REPO_ROOT/Package.swift
(Xcode 15+ treats Package.swift as a full project — no .xcodeproj needed)
${BOLD}Step 1 — Assign Entitlements:${RESET}
1. Click the top-level \"Shiro\" package in the Project Navigator
2. Select the \"Shiro\" target under TARGETS
3. Click \"Signing & Capabilities\" tab
4. Under \"App Sandbox\", disable sandbox (it must be OFF for Node subprocess)
5. In the file inspector for Package.swift, set:
Entitlements File → Shiro.entitlements
OR: in Build Settings search for \"Code Signing Entitlements\"
Set it to: \$(SRCROOT)/Shiro.entitlements
${BOLD}Step 2 — Add Environment Variables to Scheme:${RESET}
1. Product → Scheme → Edit Scheme (⌘<)
2. Select \"Run\" → \"Arguments\" tab
3. Under \"Environment Variables\" add:
${CYAN} Name Value${RESET}
────────────────────────────────────────────────────────────────
SHIRO_NODE_PATH $(which node 2>/dev/null || echo '/opt/homebrew/bin/node')
SHIRO_BRIDGE_PATH $BRIDGE_DIST
LM_STUDIO_URL http://localhost:1234
SHIRO_BRAIN_MODEL google/gemma-4-26b-a4b
SHIRO_FAST_MODEL qwen/qwen3-8b
SHIRO_VISION_MODEL qwen/qwen2.5-vl-7b
SHIRO_EMBED_MODEL text-embedding-embeddinggemma-300m-qat
(ANTHROPIC_API_KEY is optional — set it here OR via the in-app Settings → API Keys tab)
${BOLD}Step 3 — Build & Run:${RESET}
Press ⌘R in Xcode. The app appears as a floating bar (top of screen).
Click the ⚙ icon → API Keys to enter your Anthropic key if using BYOK.
${BOLD}Troubleshooting:${RESET}
• \"Operation not permitted\" on screen capture → System Settings → Privacy → Screen Recording → add Shiro
• \"Node not found\" → make sure SHIRO_NODE_PATH points to the correct node binary
• LM Studio errors → start LM Studio, load a model, start local server (port 1234)
• Bridge log → watch Xcode console for [bridge info/warn/error] lines
"
# ─── 6. Done ──────────────────────────────────────────────────────────────────
echo -e "${GREEN}${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
echo -e "${GREEN}${BOLD} Setup complete! Follow the Xcode steps above.${RESET}"
echo -e "${GREEN}${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"