claude-issue-solver 1.24.1 → 1.24.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.
- package/dist/commands/config.js +27 -0
- package/package.json +1 -1
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') {
|
|
@@ -244,6 +256,21 @@ async function promptForToken() {
|
|
|
244
256
|
console.log(chalk_1.default.dim('\nValidating token...'));
|
|
245
257
|
const result = validateToken(token);
|
|
246
258
|
if (result.valid) {
|
|
259
|
+
// Check if token belongs to the same user as current gh auth
|
|
260
|
+
const currentUser = getCurrentUser();
|
|
261
|
+
if (currentUser && result.login === currentUser) {
|
|
262
|
+
console.log(chalk_1.default.red(`\n❌ This token belongs to your current account (${currentUser}).`));
|
|
263
|
+
console.log(chalk_1.default.yellow('\n⚠️ To approve your own PRs, you need a DIFFERENT account.'));
|
|
264
|
+
console.log(chalk_1.default.dim('\nGitHub doesn\'t allow approving your own PRs, even with a different token.'));
|
|
265
|
+
console.log(chalk_1.default.dim('The bot must be a separate GitHub account.\n'));
|
|
266
|
+
console.log('Steps to create a bot account:');
|
|
267
|
+
console.log(chalk_1.default.dim(' 1. Sign out of GitHub (or use incognito)'));
|
|
268
|
+
console.log(chalk_1.default.dim(` 2. Create new account (e.g., ${currentUser}-bot)`));
|
|
269
|
+
console.log(chalk_1.default.dim(' 3. Add the bot as collaborator to your repos'));
|
|
270
|
+
console.log(chalk_1.default.dim(' 4. Create a token from the bot account'));
|
|
271
|
+
console.log(chalk_1.default.dim(' 5. Run `cis config bot-token` again\n'));
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
247
274
|
const config = getConfig();
|
|
248
275
|
config.botToken = token;
|
|
249
276
|
saveConfig(config);
|