@bogyie/opencode-kiro-plugin 0.3.18 → 0.3.19

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/dist/auth.js +12 -7
  2. package/package.json +1 -1
package/dist/auth.js CHANGED
@@ -445,7 +445,7 @@ function loginMethodSelection(method) {
445
445
  case "github":
446
446
  return "\x1B[B\x1B[B\r";
447
447
  case "organization":
448
- return "\x1B[B\x1B[B\x1B[B\r";
448
+ return "";
449
449
  }
450
450
  }
451
451
  function loginMethodPromptSeen(output) {
@@ -455,6 +455,9 @@ function loginMethodPromptSeen(output) {
455
455
  output.includes("Use with GitHub") ||
456
456
  output.includes("Use with Your Organization"));
457
457
  }
458
+ function loginPromptReady(output) {
459
+ return Boolean(extractKiroLoginCode(output) || firstLoginUrl(output));
460
+ }
458
461
  export function startKiroCliLogin(optionsOrSpawner, spawner) {
459
462
  const resolved = loginOptionsAndSpawner(optionsOrSpawner, spawner);
460
463
  const child = resolved.spawner("kiro-cli", kiroCliLoginArgs(resolved.options));
@@ -463,8 +466,12 @@ export function startKiroCliLogin(optionsOrSpawner, spawner) {
463
466
  let exitCode = null;
464
467
  let selectedLoginMethod = false;
465
468
  const maybeSelectLoginMethod = () => {
466
- if (!resolved.options.method || selectedLoginMethod || !loginMethodPromptSeen(output))
469
+ if (!resolved.options.method ||
470
+ resolved.options.method === "organization" ||
471
+ selectedLoginMethod ||
472
+ !loginMethodPromptSeen(output)) {
467
473
  return;
474
+ }
468
475
  child.stdin?.write(loginMethodSelection(resolved.options.method));
469
476
  selectedLoginMethod = true;
470
477
  };
@@ -494,15 +501,13 @@ export function startKiroCliLogin(optionsOrSpawner, spawner) {
494
501
  async waitForPrompt(timeoutMs = 15_000) {
495
502
  const deadline = Date.now() + timeoutMs;
496
503
  while (Date.now() < deadline) {
497
- if (extractKiroLoginCode(output))
498
- return true;
499
- if (firstLoginUrl(output))
504
+ if (loginPromptReady(output))
500
505
  return true;
501
506
  if (exited && exitCode !== 0)
502
507
  return false;
503
508
  await delay(100);
504
509
  }
505
- return Boolean(extractKiroLoginCode(output) || firstLoginUrl(output));
510
+ return loginPromptReady(output);
506
511
  },
507
512
  async waitForAuth(runner = runCommand) {
508
513
  const deadline = Date.now() + 10 * 60 * 1000;
@@ -510,7 +515,7 @@ export function startKiroCliLogin(optionsOrSpawner, spawner) {
510
515
  const auth = await detectAuth(process.env, runner);
511
516
  if (auth.authenticated)
512
517
  return true;
513
- if (exited && exitCode !== 0)
518
+ if (exited && exitCode !== 0 && !loginPromptReady(output))
514
519
  return false;
515
520
  await delay(2000);
516
521
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bogyie/opencode-kiro-plugin",
3
- "version": "0.3.18",
3
+ "version": "0.3.19",
4
4
  "description": "OpenCode plugin for using Kiro as a provider adapter",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",