greptile 2.2.3 → 2.2.5

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.
@@ -6,7 +6,7 @@
6
6
  -- 1. macOS sends us the greptile:// URL
7
7
  -- 2. We call greptile-fix CLI to parse the URL, resolve the repo path, and create a runner script
8
8
  -- 3. greptile-fix prints the runner script path to stdout
9
- -- 4. We detect the user's terminal and open the runner script with "open -a <terminal>"
9
+ -- 4. We detect the user's terminal and execute the runner script in it
10
10
 
11
11
  on open location theURL
12
12
  try
@@ -14,37 +14,46 @@ on open location theURL
14
14
  set runnerPath to do shell script "PATH=/opt/homebrew/bin:/usr/local/bin:$PATH greptile-fix " & quoted form of theURL & " 2>> /tmp/greptile-fix.log"
15
15
 
16
16
  if runnerPath is not "" then
17
- -- Detect terminal app: prefer frontmost if it's a terminal, else first running terminal, else Terminal.app
17
+ -- Detect terminal by checking running processes via shell (no accessibility permissions needed).
18
+ -- Check non-default terminals first; fall back to Terminal.app.
18
19
  set termApp to "Terminal"
19
- set knownTerminals to {"iTerm2", "Ghostty", "Warp", "kitty", "WezTerm", "Alacritty", "Terminal"}
20
- -- Map process names to the app name expected by "open -a"
21
- -- (iTerm2's process name is "iTerm2" but the app name is "iTerm")
22
- set termAppNames to {"iTerm", "Ghostty", "Warp", "kitty", "WezTerm", "Alacritty", "Terminal"}
23
20
  try
24
- tell application "System Events"
25
- set frontName to name of first application process whose frontmost is true
26
- set runningApps to name of every application process whose background only is false
27
- end tell
28
- -- If the frontmost app is a known terminal, use it
29
- set foundFront to false
30
- repeat with i from 1 to count of knownTerminals
31
- if frontName is equal to item i of knownTerminals then
32
- set termApp to item i of termAppNames
33
- set foundFront to true
34
- exit repeat
35
- end if
36
- end repeat
37
- -- Otherwise pick the first running terminal we recognize
38
- if not foundFront then
39
- repeat with i from 1 to count of knownTerminals
40
- if item i of knownTerminals is in runningApps then
41
- set termApp to item i of termAppNames
42
- exit repeat
43
- end if
44
- end repeat
21
+ set ps to do shell script "ps -eo comm= 2>/dev/null"
22
+ if ps contains "/Ghostty.app/" then
23
+ set termApp to "Ghostty"
24
+ else if ps contains "/iTerm.app/" then
25
+ set termApp to "iTerm"
26
+ else if ps contains "/Warp.app/" then
27
+ set termApp to "Warp"
28
+ else if ps contains "/kitty.app/" then
29
+ set termApp to "kitty"
30
+ else if ps contains "/WezTerm.app/" then
31
+ set termApp to "WezTerm"
32
+ else if ps contains "/Alacritty.app/" then
33
+ set termApp to "Alacritty"
45
34
  end if
46
35
  end try
47
- do shell script "open -a " & quoted form of termApp & " " & quoted form of runnerPath
36
+
37
+ do shell script "echo 'Detected terminal: " & termApp & "' >> /tmp/greptile-fix.log"
38
+
39
+ -- Terminal-specific launch commands for macOS.
40
+ -- Ghostty/kitty/WezTerm/Alacritty close the window when the -e command exits,
41
+ -- so we launch bash and source the runner script to keep the shell session alive
42
+ -- after the IDE command (claude/codex/cursor) finishes.
43
+ -- Unset CLAUDECODE so the new session doesn't think it's nested inside an existing one.
44
+ set cleanEnv to "unset CLAUDECODE; source " & quoted form of runnerPath & " ; exec bash"
45
+ if termApp is "Ghostty" then
46
+ do shell script "open -na Ghostty --args -e bash -c '" & cleanEnv & "' &>/dev/null &"
47
+ else if termApp is "kitty" then
48
+ do shell script "open -na kitty --args bash -c '" & cleanEnv & "' &>/dev/null &"
49
+ else if termApp is "WezTerm" then
50
+ do shell script "open -na WezTerm --args start -- bash -c '" & cleanEnv & "' &>/dev/null &"
51
+ else if termApp is "Alacritty" then
52
+ do shell script "open -na Alacritty --args -e bash -c '" & cleanEnv & "' &>/dev/null &"
53
+ else
54
+ -- Terminal.app, iTerm, and Warp natively execute scripts via "open -a"
55
+ do shell script "open -a " & quoted form of termApp & " " & quoted form of runnerPath
56
+ end if
48
57
  end if
49
58
  on error errMsg
50
59
  do shell script "echo '[ERROR] " & quoted form of errMsg & "' >> /tmp/greptile-fix.log"
package/health-server.js CHANGED
@@ -22,7 +22,7 @@ function selfCheck() {
22
22
  }
23
23
  }
24
24
 
25
- const ALLOWED_ORIGINS = ['https://app.greptile.com', 'https://staging.greptile.com', 'http://localhost:3000']
25
+ const ALLOWED_ORIGINS = ['https://app.greptile.com', 'https://app.staging.greptile.com', 'http://localhost:3000']
26
26
 
27
27
  const server = http.createServer((req, res) => {
28
28
  const origin = req.headers.origin || ''
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "greptile",
3
- "version": "2.2.3",
3
+ "version": "2.2.5",
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"