claude-issue-solver 1.5.0 → 1.6.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.
- package/dist/commands/clean.js +45 -0
- package/dist/utils/helpers.js +8 -3
- package/package.json +1 -1
package/dist/commands/clean.js
CHANGED
|
@@ -43,10 +43,51 @@ const ora_1 = __importDefault(require("ora"));
|
|
|
43
43
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
44
44
|
const fs = __importStar(require("fs"));
|
|
45
45
|
const path = __importStar(require("path"));
|
|
46
|
+
const os = __importStar(require("os"));
|
|
46
47
|
const child_process_1 = require("child_process");
|
|
47
48
|
const github_1 = require("../utils/github");
|
|
48
49
|
const git_1 = require("../utils/git");
|
|
49
50
|
const helpers_1 = require("../utils/helpers");
|
|
51
|
+
function closeTerminalWithPath(folderPath) {
|
|
52
|
+
if (os.platform() !== 'darwin')
|
|
53
|
+
return;
|
|
54
|
+
const folderName = path.basename(folderPath);
|
|
55
|
+
// Try to close iTerm2 tabs/windows with this path
|
|
56
|
+
try {
|
|
57
|
+
(0, child_process_1.execSync)(`osascript -e '
|
|
58
|
+
tell application "iTerm"
|
|
59
|
+
repeat with w in windows
|
|
60
|
+
repeat with t in tabs of w
|
|
61
|
+
repeat with s in sessions of t
|
|
62
|
+
set sessionName to name of s
|
|
63
|
+
if sessionName contains "${folderName}" then
|
|
64
|
+
close s
|
|
65
|
+
end if
|
|
66
|
+
end repeat
|
|
67
|
+
end repeat
|
|
68
|
+
end repeat
|
|
69
|
+
end tell
|
|
70
|
+
'`, { stdio: 'pipe' });
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
// iTerm not running or no matching sessions
|
|
74
|
+
}
|
|
75
|
+
// Try to close Terminal.app windows with this path
|
|
76
|
+
try {
|
|
77
|
+
(0, child_process_1.execSync)(`osascript -e '
|
|
78
|
+
tell application "Terminal"
|
|
79
|
+
repeat with w in windows
|
|
80
|
+
if name of w contains "${folderName}" then
|
|
81
|
+
close w
|
|
82
|
+
end if
|
|
83
|
+
end repeat
|
|
84
|
+
end tell
|
|
85
|
+
'`, { stdio: 'pipe' });
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
// Terminal not running or no matching windows
|
|
89
|
+
}
|
|
90
|
+
}
|
|
50
91
|
function getIssueWorktrees() {
|
|
51
92
|
const projectRoot = (0, git_1.getProjectRoot)();
|
|
52
93
|
const projectName = (0, git_1.getProjectName)();
|
|
@@ -107,6 +148,8 @@ async function cleanAllCommand() {
|
|
|
107
148
|
for (const wt of worktrees) {
|
|
108
149
|
const spinner = (0, ora_1.default)(`Cleaning issue #${wt.issueNumber}...`).start();
|
|
109
150
|
try {
|
|
151
|
+
// Close terminal windows for this worktree
|
|
152
|
+
closeTerminalWithPath(wt.path);
|
|
110
153
|
// Remove worktree
|
|
111
154
|
if (fs.existsSync(wt.path)) {
|
|
112
155
|
(0, child_process_1.execSync)(`git worktree remove "${wt.path}" --force`, {
|
|
@@ -165,6 +208,8 @@ async function cleanCommand(issueNumber) {
|
|
|
165
208
|
console.log(chalk_1.default.dim('Cancelled.'));
|
|
166
209
|
return;
|
|
167
210
|
}
|
|
211
|
+
// Close terminal windows for this worktree
|
|
212
|
+
closeTerminalWithPath(worktreePath);
|
|
168
213
|
// Remove worktree
|
|
169
214
|
if (fs.existsSync(worktreePath)) {
|
|
170
215
|
const worktreeSpinner = (0, ora_1.default)('Removing worktree...').start();
|
package/dist/utils/helpers.js
CHANGED
|
@@ -43,12 +43,17 @@ const fs = __importStar(require("fs"));
|
|
|
43
43
|
const path = __importStar(require("path"));
|
|
44
44
|
const os = __importStar(require("os"));
|
|
45
45
|
function slugify(text) {
|
|
46
|
-
|
|
46
|
+
// Remove common prefixes in brackets like [FAQ], [Bug], etc.
|
|
47
|
+
const withoutBrackets = text.replace(/^\[.*?\]\s*/, '');
|
|
48
|
+
const slug = withoutBrackets
|
|
47
49
|
.toLowerCase()
|
|
48
50
|
.replace(/[^a-z0-9]/g, '-')
|
|
49
51
|
.replace(/-+/g, '-')
|
|
50
|
-
.replace(/^-|-$/g, '')
|
|
51
|
-
|
|
52
|
+
.replace(/^-|-$/g, '');
|
|
53
|
+
// Remove duplicate consecutive words (e.g., "faq-faq" -> "faq")
|
|
54
|
+
const words = slug.split('-');
|
|
55
|
+
const deduped = words.filter((word, i) => word !== words[i - 1]);
|
|
56
|
+
return deduped.join('-').slice(0, 30);
|
|
52
57
|
}
|
|
53
58
|
function checkRequirements() {
|
|
54
59
|
const missing = [];
|