@slahon/lazykit 1.2.9 → 1.3.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.
Files changed (2) hide show
  1. package/init.js +22 -13
  2. package/package.json +1 -1
package/init.js CHANGED
@@ -7,7 +7,7 @@ const chalk = require('chalk');
7
7
  const ora = require('ora');
8
8
 
9
9
  const { log } = require('./logger');
10
- const { confirm } = require('./prompt');
10
+ const { ask, confirm } = require('./prompt');
11
11
  const { isGitRepo, getGitRemote, parseGitHubRepo, isGhCliAvailable, isGhAuthenticated, detectStack, hasBranchProtection } = require('./git');
12
12
  const { generateWorkflow } = require('./workflow');
13
13
  const { generateClaudeMd } = require('./claude-md');
@@ -197,22 +197,32 @@ async function init({ dryRun = false } = {}) {
197
197
  if (result.stderr) process.stderr.write(result.stderr);
198
198
 
199
199
  const output = (result.stdout || '') + (result.stderr || '');
200
- const tokenMatch = output.match(/sk-ant-oat[^\s]+/);
200
+ let token = (output.match(/sk-ant-oat[^\s]+/) || [])[0];
201
+
202
+ // Fallback: ask user to paste if auto-capture didn't work
203
+ if (!token) {
204
+ console.log();
205
+ log.warn('Could not capture the token automatically.');
206
+ console.log(chalk.gray(' If a browser opened, complete the auth and copy the token it shows.\n'));
207
+ const pasted = await ask('Paste your token here (or press Enter to skip)', '');
208
+ if (pasted && pasted.trim().startsWith('sk-ant-oat')) {
209
+ token = pasted.trim();
210
+ }
211
+ }
201
212
 
202
- if (tokenMatch && ghReady) {
213
+ if (token && ghReady) {
203
214
  const secretSpinner = ora({ text: 'Adding CLAUDE_CODE_OAUTH_TOKEN to GitHub secrets...', color: 'cyan' }).start();
204
215
  execSync(
205
- `gh secret set CLAUDE_CODE_OAUTH_TOKEN --body "${tokenMatch[0]}" --repo ${repoInfo.owner}/${repoInfo.repo}`,
216
+ `gh secret set CLAUDE_CODE_OAUTH_TOKEN --body "${token}" --repo ${repoInfo.owner}/${repoInfo.repo}`,
206
217
  { stdio: 'pipe' }
207
218
  );
208
219
  secretSpinner.succeed(chalk.green('CLAUDE_CODE_OAUTH_TOKEN added to GitHub secrets'));
209
- } else if (tokenMatch && !ghReady) {
210
- log.warn('Token generated but gh CLI not available — add it manually:');
211
- console.log(chalk.gray(' Name: ') + chalk.cyan('CLAUDE_CODE_OAUTH_TOKEN'));
212
- console.log(chalk.gray(' Value: ') + chalk.cyan(tokenMatch[0]));
213
- console.log(chalk.cyan(` https://github.com/${repoInfo.owner}/${repoInfo.repo}/settings/secrets/actions`));
220
+ } else if (token && !ghReady) {
221
+ log.warn('gh CLI not available — add the secret manually:');
222
+ console.log(chalk.gray(' Go to: ') + chalk.cyan(`https://github.com/${repoInfo.owner}/${repoInfo.repo}/settings/secrets/actions`));
223
+ console.log(chalk.gray(' Add secret: ') + chalk.cyan('CLAUDE_CODE_OAUTH_TOKEN') + chalk.gray(' = ') + chalk.cyan(token));
214
224
  } else {
215
- throw new Error('Token not found in output');
225
+ throw new Error('No token');
216
226
  }
217
227
  } catch (err) {
218
228
  const isNotFound = (err.message || '').includes('ENOENT');
@@ -220,10 +230,9 @@ async function init({ dryRun = false } = {}) {
220
230
  log.warn('Claude Code CLI not found — install it first:');
221
231
  console.log(chalk.cyan('\n npm install -g @anthropic-ai/claude-code'));
222
232
  } else {
223
- log.warn('Could not set token automatically.');
233
+ log.warn('Token not set add it manually:');
224
234
  }
225
- console.log(chalk.gray('\n Add it manually:'));
226
- console.log(chalk.gray(' 1. Run: ') + chalk.cyan('claude setup-token'));
235
+ console.log(chalk.gray('\n 1. Run: ') + chalk.cyan('claude setup-token'));
227
236
  console.log(chalk.gray(' 2. Go to: ') + chalk.cyan(`https://github.com/${repoInfo.owner}/${repoInfo.repo}/settings/secrets/actions`));
228
237
  console.log(chalk.gray(' 3. Add secret: ') + chalk.cyan('CLAUDE_CODE_OAUTH_TOKEN') + chalk.gray(' = the token you copied\n'));
229
238
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slahon/lazykit",
3
- "version": "1.2.9",
3
+ "version": "1.3.0",
4
4
  "description": "Drop an issue, get a PR. AI-powered issue-to-PR automation using Claude.",
5
5
  "bin": {
6
6
  "lazykit": "./index.js"