claude-issue-solver 1.43.6 → 1.44.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/dist/utils/helpers.d.ts +0 -5
- package/dist/utils/helpers.js +10 -42
- package/dist/utils/helpers.test.js +1 -42
- package/package.json +1 -1
package/dist/utils/helpers.d.ts
CHANGED
|
@@ -3,11 +3,6 @@ export declare function checkRequirements(): {
|
|
|
3
3
|
ok: boolean;
|
|
4
4
|
missing: string[];
|
|
5
5
|
};
|
|
6
|
-
/**
|
|
7
|
-
* Generate AppleScript for opening a script in iTerm2.
|
|
8
|
-
* Creates a new window and runs the command directly to avoid session restoration issues.
|
|
9
|
-
*/
|
|
10
|
-
export declare function generateITermOpenScript(script: string): string;
|
|
11
6
|
/**
|
|
12
7
|
* Generate AppleScript for opening a script in Terminal.app.
|
|
13
8
|
* Changes to the script's directory first so the session path matches the worktree.
|
package/dist/utils/helpers.js
CHANGED
|
@@ -35,15 +35,14 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.slugify = slugify;
|
|
37
37
|
exports.checkRequirements = checkRequirements;
|
|
38
|
-
exports.generateITermOpenScript = generateITermOpenScript;
|
|
39
38
|
exports.generateTerminalOpenScript = generateTerminalOpenScript;
|
|
40
39
|
exports.openInNewTerminal = openInNewTerminal;
|
|
41
40
|
exports.copyEnvFiles = copyEnvFiles;
|
|
42
41
|
exports.symlinkNodeModules = symlinkNodeModules;
|
|
43
42
|
const child_process_1 = require("child_process");
|
|
44
|
-
const fs = __importStar(require("fs"));
|
|
45
43
|
const path = __importStar(require("path"));
|
|
46
44
|
const os = __importStar(require("os"));
|
|
45
|
+
const fs = __importStar(require("fs"));
|
|
47
46
|
function slugify(text) {
|
|
48
47
|
// Remove common prefixes in brackets like [FAQ], [Bug], etc.
|
|
49
48
|
const withoutBrackets = text.replace(/^\[.*?\]\s*/, '');
|
|
@@ -73,26 +72,6 @@ function checkRequirements() {
|
|
|
73
72
|
}
|
|
74
73
|
return { ok: missing.length === 0, missing };
|
|
75
74
|
}
|
|
76
|
-
/**
|
|
77
|
-
* Generate AppleScript for opening a script in iTerm2.
|
|
78
|
-
* Creates a new window and runs the command directly to avoid session restoration issues.
|
|
79
|
-
*/
|
|
80
|
-
function generateITermOpenScript(script) {
|
|
81
|
-
const escapedScript = script.replace(/"/g, '\\"').replace(/'/g, '');
|
|
82
|
-
// Extract directory from script path to set as working directory
|
|
83
|
-
const scriptDir = path.dirname(script.replace(/'/g, ''));
|
|
84
|
-
const escapedDir = scriptDir.replace(/"/g, '\\"');
|
|
85
|
-
// cd to the script's directory first, so session path matches worktree
|
|
86
|
-
const bashCommand = `cd "${escapedDir}" && /bin/bash "${escapedScript}"`;
|
|
87
|
-
const escapedBashCommand = bashCommand.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
88
|
-
return `
|
|
89
|
-
tell application "iTerm"
|
|
90
|
-
activate
|
|
91
|
-
-- Create a new window with a command to avoid session restoration issues
|
|
92
|
-
create window with default profile command "/bin/bash -c '${bashCommand.replace(/'/g, "'\\''")}'"
|
|
93
|
-
end tell
|
|
94
|
-
`;
|
|
95
|
-
}
|
|
96
75
|
/**
|
|
97
76
|
* Generate AppleScript for opening a script in Terminal.app.
|
|
98
77
|
* Changes to the script's directory first so the session path matches the worktree.
|
|
@@ -115,27 +94,16 @@ function generateTerminalOpenScript(script) {
|
|
|
115
94
|
function openInNewTerminal(script) {
|
|
116
95
|
const platform = os.platform();
|
|
117
96
|
if (platform === 'darwin') {
|
|
118
|
-
// macOS -
|
|
119
|
-
const iTermScript = generateITermOpenScript(script);
|
|
97
|
+
// macOS - use Terminal.app (always available, no session restoration issues)
|
|
120
98
|
const terminalScript = generateTerminalOpenScript(script);
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
catch {
|
|
131
|
-
// Fallback to Terminal
|
|
132
|
-
try {
|
|
133
|
-
(0, child_process_1.execSync)(`osascript -e '${terminalScript}'`, { stdio: 'pipe' });
|
|
134
|
-
}
|
|
135
|
-
catch {
|
|
136
|
-
console.log('Could not open new terminal. Run manually:');
|
|
137
|
-
console.log(script);
|
|
138
|
-
}
|
|
99
|
+
// Use spawnSync with stdin to avoid shell escaping issues
|
|
100
|
+
const result = (0, child_process_1.spawnSync)('osascript', [], {
|
|
101
|
+
input: terminalScript,
|
|
102
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
103
|
+
});
|
|
104
|
+
if (result.status !== 0) {
|
|
105
|
+
console.log('Could not open new terminal. Run manually:');
|
|
106
|
+
console.log(script);
|
|
139
107
|
}
|
|
140
108
|
}
|
|
141
109
|
else if (platform === 'linux') {
|
|
@@ -22,35 +22,6 @@ const helpers_1 = require("./helpers");
|
|
|
22
22
|
(0, vitest_1.expect)((0, helpers_1.slugify)(longTitle).length).toBeLessThanOrEqual(30);
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
|
-
(0, vitest_1.describe)('generateITermOpenScript', () => {
|
|
26
|
-
(0, vitest_1.it)('should generate valid AppleScript for iTerm', () => {
|
|
27
|
-
const script = (0, helpers_1.generateITermOpenScript)('/path/to/script.sh');
|
|
28
|
-
(0, vitest_1.expect)(script).toContain('tell application "iTerm"');
|
|
29
|
-
(0, vitest_1.expect)(script).toContain('create window with default profile command');
|
|
30
|
-
});
|
|
31
|
-
(0, vitest_1.it)('should use create window with command to avoid session restoration', () => {
|
|
32
|
-
const script = (0, helpers_1.generateITermOpenScript)('/path/to/script.sh');
|
|
33
|
-
// Should use command parameter to run directly without session restoration
|
|
34
|
-
(0, vitest_1.expect)(script).toContain('create window with default profile command');
|
|
35
|
-
(0, vitest_1.expect)(script).toContain('/bin/bash -c');
|
|
36
|
-
});
|
|
37
|
-
(0, vitest_1.it)('should use /bin/bash to run the script', () => {
|
|
38
|
-
const script = (0, helpers_1.generateITermOpenScript)('/path/to/script.sh');
|
|
39
|
-
(0, vitest_1.expect)(script).toContain('/bin/bash');
|
|
40
|
-
(0, vitest_1.expect)(script).toContain('/path/to/script.sh');
|
|
41
|
-
});
|
|
42
|
-
(0, vitest_1.it)('should handle double quotes in script path without breaking AppleScript', () => {
|
|
43
|
-
const script = (0, helpers_1.generateITermOpenScript)('/path/to/"quoted"/script.sh');
|
|
44
|
-
// Should still contain the path and be valid AppleScript structure
|
|
45
|
-
(0, vitest_1.expect)(script).toContain('tell application "iTerm"');
|
|
46
|
-
(0, vitest_1.expect)(script).toContain('/bin/bash');
|
|
47
|
-
(0, vitest_1.expect)(script).toContain('quoted');
|
|
48
|
-
});
|
|
49
|
-
(0, vitest_1.it)('should handle paths with spaces', () => {
|
|
50
|
-
const script = (0, helpers_1.generateITermOpenScript)('/path/with spaces/script.sh');
|
|
51
|
-
(0, vitest_1.expect)(script).toContain('/path/with spaces/script.sh');
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
25
|
(0, vitest_1.describe)('generateTerminalOpenScript', () => {
|
|
55
26
|
(0, vitest_1.it)('should generate valid AppleScript for Terminal.app', () => {
|
|
56
27
|
const script = (0, helpers_1.generateTerminalOpenScript)('/path/to/script.sh');
|
|
@@ -79,12 +50,6 @@ const helpers_1 = require("./helpers");
|
|
|
79
50
|
});
|
|
80
51
|
});
|
|
81
52
|
(0, vitest_1.describe)('oh-my-zsh bypass behavior', () => {
|
|
82
|
-
(0, vitest_1.it)('iTerm script should run command directly to avoid session restoration', () => {
|
|
83
|
-
const script = (0, helpers_1.generateITermOpenScript)('/test/script.sh');
|
|
84
|
-
// Should use create window with command to avoid session restoration issues
|
|
85
|
-
(0, vitest_1.expect)(script).toContain('create window with default profile command');
|
|
86
|
-
(0, vitest_1.expect)(script).toContain('/bin/bash');
|
|
87
|
-
});
|
|
88
53
|
(0, vitest_1.it)('Terminal script should combine dismiss and command in single do script', () => {
|
|
89
54
|
const script = (0, helpers_1.generateTerminalOpenScript)('/test/script.sh');
|
|
90
55
|
// Should have "n; /bin/bash..." in a single do script call
|
|
@@ -92,12 +57,6 @@ const helpers_1 = require("./helpers");
|
|
|
92
57
|
});
|
|
93
58
|
});
|
|
94
59
|
(0, vitest_1.describe)('working directory for terminal closing', () => {
|
|
95
|
-
(0, vitest_1.it)('iTerm script should cd to script directory before running', () => {
|
|
96
|
-
const script = (0, helpers_1.generateITermOpenScript)('/path/to/worktree/.claude-runner.sh');
|
|
97
|
-
// Should cd to the script's directory
|
|
98
|
-
(0, vitest_1.expect)(script).toContain('cd "/path/to/worktree"');
|
|
99
|
-
(0, vitest_1.expect)(script).toContain('/bin/bash');
|
|
100
|
-
});
|
|
101
60
|
(0, vitest_1.it)('Terminal script should cd to script directory before running', () => {
|
|
102
61
|
const script = (0, helpers_1.generateTerminalOpenScript)('/path/to/worktree/.claude-runner.sh');
|
|
103
62
|
// Should cd to the script's directory first (quotes are escaped in AppleScript)
|
|
@@ -105,7 +64,7 @@ const helpers_1 = require("./helpers");
|
|
|
105
64
|
(0, vitest_1.expect)(script).toContain('/bin/bash');
|
|
106
65
|
});
|
|
107
66
|
(0, vitest_1.it)('should handle script paths with quotes', () => {
|
|
108
|
-
const script = (0, helpers_1.
|
|
67
|
+
const script = (0, helpers_1.generateTerminalOpenScript)('/path/to/work"tree/.script.sh');
|
|
109
68
|
(0, vitest_1.expect)(script).toContain('/bin/bash');
|
|
110
69
|
// Path should be escaped
|
|
111
70
|
(0, vitest_1.expect)(script).toContain('work');
|