claude-issue-solver 1.0.0 → 1.2.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.
@@ -125,40 +125,30 @@ cd "${worktreePath}"
125
125
  echo "🤖 Claude Code - Issue #${issueNumber}: ${issue.title}"
126
126
  echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
127
127
  echo ""
128
- echo "Claude will stay open after solving the issue."
129
- echo "You can ask for more changes or type /exit when done."
128
+ echo "When Claude commits, a PR will be created automatically."
129
+ echo "The terminal stays open for follow-up changes."
130
130
  echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
131
131
  echo ""
132
132
 
133
- claude --dangerously-skip-permissions "${prompt.replace(/"/g, '\\"').replace(/\n/g, '\\n')}"
134
-
135
- echo ""
136
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
137
- echo "Claude session ended."
138
- echo ""
139
-
140
- COMMITS=$(git log origin/main..HEAD --oneline 2>/dev/null | wc -l | tr -d ' ')
133
+ # Function to create PR
134
+ create_pr() {
135
+ COMMITS=$(git log origin/main..HEAD --oneline 2>/dev/null | wc -l | tr -d ' ')
141
136
 
142
- if [ "$COMMITS" -eq 0 ]; then
143
- echo "⚠️ No commits were made."
144
- echo "To clean up: claude-issue clean ${issueNumber}"
145
- else
146
- echo "✅ Found $COMMITS commit(s)"
147
- echo ""
148
- read -p "Create PR to close issue #${issueNumber}? (Y/n) " -n 1 -r
149
- echo ""
137
+ if [ "$COMMITS" -gt 0 ]; then
138
+ # Check if PR already exists
139
+ EXISTING_PR=$(gh pr list --head "${branchName}" --json number --jq '.[0].number' 2>/dev/null)
150
140
 
151
- if [[ ! $REPLY =~ ^[Nn]$ ]]; then
152
- echo ""
153
- echo "📤 Pushing branch and creating PR..."
141
+ if [ -z "$EXISTING_PR" ]; then
142
+ echo ""
143
+ echo "📤 Pushing branch and creating PR..."
154
144
 
155
- git push -u origin "${branchName}"
145
+ git push -u origin "${branchName}" 2>/dev/null
156
146
 
157
- COMMIT_LIST=$(git log origin/main..HEAD --pretty=format:'- %s' | head -10)
147
+ COMMIT_LIST=$(git log origin/main..HEAD --pretty=format:'- %s' | head -10)
158
148
 
159
- PR_URL=$(gh pr create \\
160
- --title "Fix #${issueNumber}: ${issue.title.replace(/"/g, '\\"')}" \\
161
- --body "## Summary
149
+ PR_URL=$(gh pr create \\
150
+ --title "Fix #${issueNumber}: ${issue.title.replace(/"/g, '\\"')}" \\
151
+ --body "## Summary
162
152
 
163
153
  Closes #${issueNumber}
164
154
 
@@ -169,21 +159,54 @@ $COMMIT_LIST
169
159
  ---
170
160
 
171
161
  🤖 Generated with [Claude Code](https://claude.com/claude-code)" \\
172
- --head "${branchName}" \\
173
- --base main)
162
+ --head "${branchName}" \\
163
+ --base main 2>/dev/null)
164
+
165
+ if [ -n "$PR_URL" ]; then
166
+ echo ""
167
+ echo "✅ PR created: $PR_URL"
168
+ echo ""
169
+ fi
170
+ else
171
+ # PR exists, just push new commits
172
+ git push origin "${branchName}" 2>/dev/null
173
+ echo ""
174
+ echo "📤 Pushed new commits to existing PR #$EXISTING_PR"
175
+ echo ""
176
+ fi
177
+ fi
178
+ }
174
179
 
175
- echo ""
176
- echo "✅ PR created: $PR_URL"
177
- echo ""
178
- echo "The PR will automatically close issue #${issueNumber} when merged."
180
+ # Watch for new commits in background and create PR
181
+ LAST_COMMIT=""
182
+ while true; do
183
+ CURRENT_COMMIT=$(git rev-parse HEAD 2>/dev/null)
184
+ if [ "$CURRENT_COMMIT" != "$LAST_COMMIT" ] && [ -n "$LAST_COMMIT" ]; then
185
+ create_pr
179
186
  fi
187
+ LAST_COMMIT="$CURRENT_COMMIT"
188
+ sleep 2
189
+ done &
190
+ WATCHER_PID=$!
180
191
 
181
- echo ""
182
- echo "To clean up after merge: claude-issue clean ${issueNumber}"
183
- fi
192
+ # Run Claude interactively
193
+ claude --dangerously-skip-permissions "${prompt.replace(/"/g, '\\"').replace(/\n/g, '\\n')}"
194
+
195
+ # Kill the watcher
196
+ kill $WATCHER_PID 2>/dev/null
197
+
198
+ # Final PR check after Claude exits
199
+ create_pr
184
200
 
185
201
  echo ""
186
- rm -f "${runnerScript}"
202
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
203
+ echo "Claude session ended. Terminal staying open."
204
+ echo "To clean up after merge: claude-issue clean ${issueNumber}"
205
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
206
+ echo ""
207
+
208
+ # Keep terminal open
209
+ exec bash
187
210
  `;
188
211
  fs.writeFileSync(runnerScript, runnerContent, { mode: 0o755 });
189
212
  console.log();
package/dist/index.js CHANGED
@@ -13,11 +13,13 @@ const solve_1 = require("./commands/solve");
13
13
  const pr_1 = require("./commands/pr");
14
14
  const clean_1 = require("./commands/clean");
15
15
  const select_1 = require("./commands/select");
16
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
17
+ const packageJson = require('../package.json');
16
18
  const program = new commander_1.Command();
17
19
  program
18
20
  .name('claude-issue')
19
21
  .description('Automatically solve GitHub issues using Claude Code')
20
- .version('1.0.0');
22
+ .version(packageJson.version);
21
23
  // Check requirements before any command
22
24
  program.hook('preAction', () => {
23
25
  if (!(0, git_1.isGitRepo)()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-issue-solver",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "Automatically solve GitHub issues using Claude Code",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -40,6 +40,7 @@
40
40
  "node": ">=18.0.0"
41
41
  },
42
42
  "files": [
43
- "dist"
43
+ "dist",
44
+ "package.json"
44
45
  ]
45
46
  }