claude-issue-solver 1.24.1 â 1.24.3
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/README.md +2 -0
- package/dist/commands/config.js +40 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -279,6 +279,8 @@ Claude auto-detects whether you're reviewing your own PR or someone else's:
|
|
|
279
279
|
cis config bot-token # Interactive setup with instructions
|
|
280
280
|
```
|
|
281
281
|
|
|
282
|
+
> **Note**: For private repos, use a **Classic Token** with `repo` scope. Fine-grained tokens don't work well for collaborator access to repos you don't own.
|
|
283
|
+
|
|
282
284
|
## Tips
|
|
283
285
|
|
|
284
286
|
- PRs are created automatically when Claude makes commits - no need to wait until the end
|
package/dist/commands/config.js
CHANGED
|
@@ -81,6 +81,18 @@ function validateToken(token) {
|
|
|
81
81
|
return { valid: false, error: error.message };
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
+
function getCurrentUser() {
|
|
85
|
+
try {
|
|
86
|
+
const output = (0, child_process_1.execSync)('gh api user --jq .login', {
|
|
87
|
+
encoding: 'utf-8',
|
|
88
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
89
|
+
});
|
|
90
|
+
return output.trim();
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
84
96
|
async function configCommand(action, value) {
|
|
85
97
|
// Handle clear action
|
|
86
98
|
if (action === '--clear' || action === 'clear') {
|
|
@@ -186,16 +198,20 @@ ${chalk_1.default.bold('You have two options:')}\n`);
|
|
|
186
198
|
}
|
|
187
199
|
// Open GitHub token page
|
|
188
200
|
console.log(chalk_1.default.bold('\nđ Creating a Personal Access Token\n'));
|
|
189
|
-
console.log(`I'll open GitHub's token creation page.
|
|
201
|
+
console.log(`I'll open GitHub's token creation page.
|
|
190
202
|
|
|
191
|
-
${chalk_1.default.bold('
|
|
192
|
-
|
|
193
|
-
⢠Expiration: ${chalk_1.default.cyan('90 days')} (or your preference)
|
|
194
|
-
⢠Repository access: ${chalk_1.default.cyan('Only select repositories')} (pick your repos)
|
|
203
|
+
${chalk_1.default.bold.yellow('â ď¸ Use a Classic Token for private repos you don\'t own!')}
|
|
204
|
+
Fine-grained tokens don't work well for collaborator access.
|
|
195
205
|
|
|
196
|
-
${chalk_1.default.bold('
|
|
197
|
-
⢠${chalk_1.default.cyan('
|
|
198
|
-
⢠${chalk_1.default.cyan('
|
|
206
|
+
${chalk_1.default.bold('Option 1: Classic Token')} ${chalk_1.default.green('(recommended for private repos)')}
|
|
207
|
+
⢠Click "${chalk_1.default.cyan('Generate new token (classic)')}"
|
|
208
|
+
⢠Note: ${chalk_1.default.cyan('claude-issue-solver-bot')}
|
|
209
|
+
⢠Expiration: ${chalk_1.default.cyan('90 days')}
|
|
210
|
+
⢠Scope: ${chalk_1.default.cyan('repo')} (full control of private repositories)
|
|
211
|
+
|
|
212
|
+
${chalk_1.default.bold('Option 2: Fine-grained Token')} ${chalk_1.default.dim('(only for repos the bot owns)')}
|
|
213
|
+
⢠Repository access: ${chalk_1.default.cyan('All repositories')}
|
|
214
|
+
⢠Permissions: ${chalk_1.default.cyan('Pull requests')} (Read/write), ${chalk_1.default.cyan('Contents')} (Read)
|
|
199
215
|
`);
|
|
200
216
|
const { openBrowser } = await inquirer_1.default.prompt([
|
|
201
217
|
{
|
|
@@ -206,7 +222,7 @@ ${chalk_1.default.bold('Permissions needed:')}
|
|
|
206
222
|
},
|
|
207
223
|
]);
|
|
208
224
|
if (openBrowser) {
|
|
209
|
-
const tokenUrl = 'https://github.com/settings/
|
|
225
|
+
const tokenUrl = 'https://github.com/settings/tokens';
|
|
210
226
|
try {
|
|
211
227
|
if (process.platform === 'darwin') {
|
|
212
228
|
(0, child_process_1.execSync)(`open "${tokenUrl}"`, { stdio: 'pipe' });
|
|
@@ -244,6 +260,21 @@ async function promptForToken() {
|
|
|
244
260
|
console.log(chalk_1.default.dim('\nValidating token...'));
|
|
245
261
|
const result = validateToken(token);
|
|
246
262
|
if (result.valid) {
|
|
263
|
+
// Check if token belongs to the same user as current gh auth
|
|
264
|
+
const currentUser = getCurrentUser();
|
|
265
|
+
if (currentUser && result.login === currentUser) {
|
|
266
|
+
console.log(chalk_1.default.red(`\nâ This token belongs to your current account (${currentUser}).`));
|
|
267
|
+
console.log(chalk_1.default.yellow('\nâ ď¸ To approve your own PRs, you need a DIFFERENT account.'));
|
|
268
|
+
console.log(chalk_1.default.dim('\nGitHub doesn\'t allow approving your own PRs, even with a different token.'));
|
|
269
|
+
console.log(chalk_1.default.dim('The bot must be a separate GitHub account.\n'));
|
|
270
|
+
console.log('Steps to create a bot account:');
|
|
271
|
+
console.log(chalk_1.default.dim(' 1. Sign out of GitHub (or use incognito)'));
|
|
272
|
+
console.log(chalk_1.default.dim(` 2. Create new account (e.g., ${currentUser}-bot)`));
|
|
273
|
+
console.log(chalk_1.default.dim(' 3. Add the bot as collaborator to your repos'));
|
|
274
|
+
console.log(chalk_1.default.dim(' 4. Create a token from the bot account'));
|
|
275
|
+
console.log(chalk_1.default.dim(' 5. Run `cis config bot-token` again\n'));
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
247
278
|
const config = getConfig();
|
|
248
279
|
config.botToken = token;
|
|
249
280
|
saveConfig(config);
|