greptile 2.1.1 → 2.2.1

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.
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>Label</key>
6
+ <string>com.greptile.health</string>
7
+ <key>ProgramArguments</key>
8
+ <array>
9
+ <string>/usr/local/bin/node</string>
10
+ <string>health-server.js</string>
11
+ </array>
12
+ <key>WorkingDirectory</key>
13
+ <string>__PACKAGE_DIR__</string>
14
+ <key>RunAtLoad</key>
15
+ <true/>
16
+ <key>KeepAlive</key>
17
+ <true/>
18
+ <key>StandardOutPath</key>
19
+ <string>/tmp/greptile-health.log</string>
20
+ <key>StandardErrorPath</key>
21
+ <string>/tmp/greptile-health.log</string>
22
+ </dict>
23
+ </plist>
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env node
2
+ const http = require('http')
3
+
4
+ const PORT = 4747
5
+
6
+ const server = http.createServer((req, res) => {
7
+ res.setHeader('Access-Control-Allow-Origin', '*')
8
+ res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS')
9
+ res.setHeader('Access-Control-Allow-Headers', 'Content-Type')
10
+
11
+ if (req.method === 'OPTIONS') {
12
+ res.writeHead(204)
13
+ res.end()
14
+ return
15
+ }
16
+
17
+ if (req.method === 'GET' && req.url === '/health') {
18
+ res.writeHead(200, { 'Content-Type': 'application/json' })
19
+ res.end(JSON.stringify({ status: 'ok' }))
20
+ return
21
+ }
22
+
23
+ res.writeHead(404)
24
+ res.end()
25
+ })
26
+
27
+ server.on('error', (err) => {
28
+ if (err.code === 'EADDRINUSE') {
29
+ console.error(`Port ${PORT} is already in use. Exiting.`)
30
+ process.exit(0) // Exit cleanly so launchd KeepAlive doesn't restart in a tight loop
31
+ }
32
+ console.error('Health server error:', err.message)
33
+ process.exit(1)
34
+ })
35
+
36
+ server.listen(PORT, '127.0.0.1', () => {
37
+ console.log(`Greptile health server listening on http://127.0.0.1:${PORT}`)
38
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "greptile",
3
- "version": "2.1.1",
3
+ "version": "2.2.1",
4
4
  "description": "Bridge for Greptile code review 'Fix in Claude Code' and 'Fix in Codex' links",
5
5
  "bin": {
6
6
  "greptile-fix": "bin/greptile-fix.js"
@@ -15,7 +15,9 @@
15
15
  "greptile-fix.applescript",
16
16
  "build-app.sh",
17
17
  "postinstall.sh",
18
- "preuninstall.sh"
18
+ "preuninstall.sh",
19
+ "health-server.js",
20
+ "com.greptile.health.plist"
19
21
  ],
20
22
  "os": [
21
23
  "darwin"
package/postinstall.sh CHANGED
@@ -22,6 +22,29 @@ mkdir -p "$APP_DIR"
22
22
  # Build the .app bundle into ~/Applications
23
23
  bash "$SCRIPT_DIR/build-app.sh" "$APP_DIR"
24
24
 
25
+ # --- Health server LaunchAgent ---
26
+ PLIST_NAME="com.greptile.health.plist"
27
+ PLIST_SRC="$SCRIPT_DIR/$PLIST_NAME"
28
+ PLIST_DST="$HOME/Library/LaunchAgents/$PLIST_NAME"
29
+
30
+ if [ -f "$PLIST_SRC" ]; then
31
+ # Ensure LaunchAgents directory exists
32
+ mkdir -p "$HOME/Library/LaunchAgents"
33
+
34
+ # Resolve the node binary path
35
+ NODE_BIN="$(command -v node 2>/dev/null || echo "/usr/local/bin/node")"
36
+
37
+ # Create a configured copy with the correct paths
38
+ sed -e "s|__PACKAGE_DIR__|$SCRIPT_DIR|g" \
39
+ -e "s|/usr/local/bin/node|$NODE_BIN|g" \
40
+ "$PLIST_SRC" > "$PLIST_DST"
41
+
42
+ # Load the agent (unload first in case it's already loaded)
43
+ launchctl unload "$PLIST_DST" 2>/dev/null || true
44
+ launchctl load "$PLIST_DST"
45
+ echo "Greptile health server installed and started."
46
+ fi
47
+
25
48
  echo ""
26
49
  echo "Repo path mappings are stored in ~/.greptile/repos.json."
27
50
  echo "The first time you click 'Fix in Claude Code' for a repo,"
package/preuninstall.sh CHANGED
@@ -13,3 +13,11 @@ if [ -d "$APP_PATH" ]; then
13
13
  rm -rf "$APP_PATH"
14
14
  echo "Removed: $APP_PATH"
15
15
  fi
16
+
17
+ # --- Health server LaunchAgent ---
18
+ PLIST_PATH="$HOME/Library/LaunchAgents/com.greptile.health.plist"
19
+ if [ -f "$PLIST_PATH" ]; then
20
+ launchctl unload "$PLIST_PATH" 2>/dev/null || true
21
+ rm -f "$PLIST_PATH"
22
+ echo "Removed Greptile health server LaunchAgent."
23
+ fi