claude-issue-solver 1.43.1 → 1.43.2

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.
@@ -5,11 +5,13 @@ export declare function checkRequirements(): {
5
5
  };
6
6
  /**
7
7
  * Generate AppleScript for opening a script in iTerm2.
8
+ * Changes to the script's directory first so the session path matches the worktree.
8
9
  * Sends 'n' first to dismiss any oh-my-zsh update prompts, then runs the script with bash.
9
10
  */
10
11
  export declare function generateITermOpenScript(script: string): string;
11
12
  /**
12
13
  * Generate AppleScript for opening a script in Terminal.app.
14
+ * Changes to the script's directory first so the session path matches the worktree.
13
15
  * Sends 'n' first to dismiss any oh-my-zsh update prompts, then runs the script with bash.
14
16
  */
15
17
  export declare function generateTerminalOpenScript(script: string): string;
@@ -75,11 +75,16 @@ function checkRequirements() {
75
75
  }
76
76
  /**
77
77
  * Generate AppleScript for opening a script in iTerm2.
78
+ * Changes to the script's directory first so the session path matches the worktree.
78
79
  * Sends 'n' first to dismiss any oh-my-zsh update prompts, then runs the script with bash.
79
80
  */
80
81
  function generateITermOpenScript(script) {
81
82
  const escapedScript = script.replace(/"/g, '\\"');
82
- const bashCommand = `/bin/bash "${escapedScript}"`;
83
+ // Extract directory from script path to set as working directory
84
+ const scriptDir = path.dirname(script.replace(/'/g, ''));
85
+ const escapedDir = scriptDir.replace(/"/g, '\\"');
86
+ // cd to the script's directory first, so session path matches worktree
87
+ const bashCommand = `cd "${escapedDir}" && /bin/bash "${escapedScript}"`;
83
88
  return `
84
89
  tell application "iTerm"
85
90
  activate
@@ -94,11 +99,16 @@ function generateITermOpenScript(script) {
94
99
  }
95
100
  /**
96
101
  * Generate AppleScript for opening a script in Terminal.app.
102
+ * Changes to the script's directory first so the session path matches the worktree.
97
103
  * Sends 'n' first to dismiss any oh-my-zsh update prompts, then runs the script with bash.
98
104
  */
99
105
  function generateTerminalOpenScript(script) {
100
106
  const escapedScript = script.replace(/"/g, '\\"');
101
- const bashCommand = `/bin/bash "${escapedScript}"`;
107
+ // Extract directory from script path to set as working directory
108
+ const scriptDir = path.dirname(script.replace(/'/g, ''));
109
+ const escapedDir = scriptDir.replace(/"/g, '\\"');
110
+ // cd to the script's directory first, so session path matches worktree
111
+ const bashCommand = `cd "${escapedDir}" && /bin/bash "${escapedScript}"`;
102
112
  return `
103
113
  tell application "Terminal"
104
114
  activate
@@ -99,4 +99,24 @@ const helpers_1 = require("./helpers");
99
99
  (0, vitest_1.expect)(script).toMatch(/do script "n;.*\/bin\/bash/);
100
100
  });
101
101
  });
102
+ (0, vitest_1.describe)('working directory for terminal closing', () => {
103
+ (0, vitest_1.it)('iTerm script should cd to script directory before running', () => {
104
+ const script = (0, helpers_1.generateITermOpenScript)('/path/to/worktree/.claude-runner.sh');
105
+ // Should cd to the script's directory first (quotes are escaped in AppleScript)
106
+ (0, vitest_1.expect)(script).toContain('cd \\"/path/to/worktree\\"');
107
+ (0, vitest_1.expect)(script).toContain('/bin/bash');
108
+ });
109
+ (0, vitest_1.it)('Terminal script should cd to script directory before running', () => {
110
+ const script = (0, helpers_1.generateTerminalOpenScript)('/path/to/worktree/.claude-runner.sh');
111
+ // Should cd to the script's directory first (quotes are escaped in AppleScript)
112
+ (0, vitest_1.expect)(script).toContain('cd \\"/path/to/worktree\\"');
113
+ (0, vitest_1.expect)(script).toContain('/bin/bash');
114
+ });
115
+ (0, vitest_1.it)('should handle script paths with quotes', () => {
116
+ const script = (0, helpers_1.generateITermOpenScript)('/path/to/work"tree/.script.sh');
117
+ (0, vitest_1.expect)(script).toContain('/bin/bash');
118
+ // Path should be escaped
119
+ (0, vitest_1.expect)(script).toContain('work');
120
+ });
121
+ });
102
122
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-issue-solver",
3
- "version": "1.43.1",
3
+ "version": "1.43.2",
4
4
  "description": "Automatically solve GitHub issues using Claude Code",
5
5
  "main": "dist/index.js",
6
6
  "bin": {