@agentmessier/restwalker 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/install.sh ADDED
@@ -0,0 +1,176 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ INSTALL_DIR="$(cd "$(dirname "$0")" && pwd)"
5
+ DATA_DIR="$HOME/.restwalker"
6
+ PLIST_SRC="$INSTALL_DIR/com.restwalker.plist"
7
+ PLIST_DST="$HOME/Library/LaunchAgents/com.restwalker.plist"
8
+ RUNTIME="node" # default
9
+
10
+ # ── Parse args ────────────────────────────────────────────────────────────────
11
+ for arg in "$@"; do
12
+ case $arg in
13
+ --node) RUNTIME="node" ;;
14
+ --python) RUNTIME="python" ;;
15
+ esac
16
+ done
17
+
18
+ echo "==> restwalker installer (runtime: $RUNTIME)"
19
+ echo " install dir : $INSTALL_DIR"
20
+ echo " data dir : $DATA_DIR"
21
+ echo ""
22
+
23
+ # ── Runtime: Node ─────────────────────────────────────────────────────────────
24
+ if [ "$RUNTIME" = "node" ]; then
25
+ NODE="${NODE:-$(which node 2>/dev/null)}"
26
+ if [ -z "$NODE" ]; then
27
+ echo "ERROR: node not found. Install Node.js 20+ from https://nodejs.org"
28
+ exit 1
29
+ fi
30
+ NODE_VER=$("$NODE" -e "process.stdout.write(process.version.slice(1).split('.')[0])")
31
+ if [ "$NODE_VER" -lt 20 ]; then
32
+ echo "ERROR: Node.js 20+ required (found $("$NODE" --version))"
33
+ exit 1
34
+ fi
35
+ echo " node : $NODE ($("$NODE" --version))"
36
+ echo ""
37
+ echo "==> Installing Node dependencies..."
38
+ (cd "$INSTALL_DIR/node" && npm install --quiet)
39
+
40
+ TSX="$INSTALL_DIR/node/node_modules/.bin/tsx"
41
+
42
+ PROGRAM_ARGS="<string>$NODE</string>
43
+ <string>$TSX</string>
44
+ <string>$INSTALL_DIR/node/app.ts</string>"
45
+
46
+ # ── Runtime: Python ───────────────────────────────────────────────────────────
47
+ else
48
+ if [ -n "$PYTHON" ]; then
49
+ : # use as-is
50
+ elif python3 -c "import sys; assert sys.version_info >= (3,10)" 2>/dev/null; then
51
+ PYTHON="$(which python3)"
52
+ else
53
+ for candidate in python3.12 python3.11 python3.10; do
54
+ if command -v "$candidate" &>/dev/null && "$candidate" -c "import sys; assert sys.version_info >= (3,10)" 2>/dev/null; then
55
+ PYTHON="$(which $candidate)"; break
56
+ fi
57
+ done
58
+ fi
59
+ PYTHON="${PYTHON:-python3}"
60
+
61
+ if ! "$PYTHON" -c "import sys; assert sys.version_info >= (3,10)" 2>/dev/null; then
62
+ echo "ERROR: Python 3.10+ required. Set PYTHON=/path/to/python3 to override."
63
+ exit 1
64
+ fi
65
+ echo " python : $PYTHON ($("$PYTHON" --version))"
66
+ echo ""
67
+ echo "==> Installing Python dependencies..."
68
+ "$PYTHON" -m pip install -q -r "$INSTALL_DIR/requirements.txt"
69
+
70
+ PROGRAM_ARGS="<string>$PYTHON</string>
71
+ <string>-m</string>
72
+ <string>uvicorn</string>
73
+ <string>app:app</string>
74
+ <string>--host</string>
75
+ <string>0.0.0.0</string>
76
+ <string>--port</string>
77
+ <string>47290</string>"
78
+ fi
79
+
80
+ # ── Data directory ─────────────────────────────────────────────────────────────
81
+ mkdir -p "$DATA_DIR"
82
+
83
+ # ── LaunchAgent plist ─────────────────────────────────────────────────────────
84
+ echo "==> Installing LaunchAgent..."
85
+
86
+ # Resolve claude binary path
87
+ CLAUDE_BIN=$(which claude 2>/dev/null || echo "claude")
88
+
89
+ # Build plist with correct ProgramArguments, paths, and log locations
90
+ cat > "$PLIST_DST" <<PLIST
91
+ <?xml version="1.0" encoding="UTF-8"?>
92
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
93
+ <plist version="1.0">
94
+ <dict>
95
+ <key>Label</key>
96
+ <string>com.restwalker</string>
97
+ <key>ProgramArguments</key>
98
+ <array>
99
+ $PROGRAM_ARGS
100
+ </array>
101
+ <key>WorkingDirectory</key>
102
+ <string>$INSTALL_DIR</string>
103
+ <key>RunAtLoad</key>
104
+ <true/>
105
+ <key>KeepAlive</key>
106
+ <true/>
107
+ <key>EnvironmentVariables</key>
108
+ <dict>
109
+ <key>CLAUDE_BIN</key>
110
+ <string>$CLAUDE_BIN</string>
111
+ </dict>
112
+ <key>StandardOutPath</key>
113
+ <string>$DATA_DIR/restwalker.log</string>
114
+ <key>StandardErrorPath</key>
115
+ <string>$DATA_DIR/restwalker.log</string>
116
+ </dict>
117
+ </plist>
118
+ PLIST
119
+
120
+ # ── Load ──────────────────────────────────────────────────────────────────────
121
+ launchctl unload "$PLIST_DST" 2>/dev/null || true
122
+ launchctl load "$PLIST_DST"
123
+
124
+ # ── Register MCP with Claude Code ─────────────────────────────────────────────
125
+ if command -v claude &>/dev/null; then
126
+ echo ""
127
+ echo "┌─ Claude Code MCP ──────────────────────────────────────────────────────────┐"
128
+ echo "│ The restwalker MCP server lets Claude Code queue tasks, check status, │"
129
+ echo "│ list projects/models, and manage providers — directly from any chat, │"
130
+ echo "│ without opening the dashboard. │"
131
+ echo "│ │"
132
+ echo "│ Scopes: │"
133
+ echo "│ user — available in every Claude Code session on this machine │"
134
+ echo "│ project — available only when Claude Code is opened in a specific folder │"
135
+ echo "└────────────────────────────────────────────────────────────────────────────┘"
136
+ echo ""
137
+
138
+ read -r -p " Register restwalker MCP with Claude Code? [Y/n] " yn
139
+ case "${yn:-Y}" in
140
+ [Yy]*)
141
+ echo ""
142
+ echo " Scope options:"
143
+ echo " 1) user — all sessions on this machine (recommended)"
144
+ echo " 2) project — only in the current directory"
145
+ echo ""
146
+ read -r -p " Choose scope [1/2, default 1]: " scope_choice
147
+ case "${scope_choice:-1}" in
148
+ 2)
149
+ MCP_SCOPE="project"
150
+ ;;
151
+ *)
152
+ MCP_SCOPE="user"
153
+ ;;
154
+ esac
155
+
156
+ claude mcp remove restwalker 2>/dev/null || true
157
+ claude mcp add --scope "$MCP_SCOPE" restwalker -- "$NODE" "$TSX" "$INSTALL_DIR/node/mcp.ts"
158
+ echo " ✓ MCP registered (scope: $MCP_SCOPE)"
159
+ ;;
160
+ *)
161
+ echo " Skipping MCP registration."
162
+ echo " To add it later:"
163
+ echo " claude mcp add --scope user restwalker -- $NODE $TSX $INSTALL_DIR/node/mcp.ts"
164
+ ;;
165
+ esac
166
+ else
167
+ echo ""
168
+ echo " Note: Claude Code CLI not found — skipping MCP registration."
169
+ echo " Install it and then run:"
170
+ echo " claude mcp add --scope user restwalker -- node $TSX $INSTALL_DIR/node/mcp.ts"
171
+ fi
172
+
173
+ echo ""
174
+ echo "✓ restwalker ($RUNTIME) → http://localhost:47290 | logs: tail -f $DATA_DIR/restwalker.log"
175
+ echo " Dashboard + task queue: http://localhost:47290"
176
+ echo " To uninstall: ./uninstall.sh"