@kervnet/opencode-kiro-auth 1.7.1 → 1.7.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.
@@ -2,5 +2,13 @@ export declare class KiroCliAuthMethod {
2
2
  private config;
3
3
  private repository;
4
4
  constructor(config: any, repository: any);
5
- authorize(): Promise<any>;
5
+ authorize(): Promise<{
6
+ url: string;
7
+ instructions: string;
8
+ method: 'auto';
9
+ callback: () => Promise<{
10
+ type: 'success' | 'failed';
11
+ key?: string;
12
+ }>;
13
+ }>;
6
14
  }
@@ -6,20 +6,36 @@ export class KiroCliAuthMethod {
6
6
  this.repository = repository;
7
7
  }
8
8
  async authorize() {
9
- // Sync from kiro-cli first
10
- const { syncFromKiroCli } = await import('../../plugin/sync/kiro-cli.js');
11
- await syncFromKiroCli();
12
- // Give it a moment for the database to be written
13
- await new Promise(resolve => setTimeout(resolve, 1000));
14
- // Check if we have any accounts
15
- const accounts = await this.repository.findAll();
16
- if (accounts.length === 0) {
17
- throw new Error('No Kiro CLI session found. Please run "kiro-cli login" first, then try again.');
18
- }
19
- // Return success - no actual OAuth needed since we sync from kiro-cli
20
9
  return {
21
- success: true,
22
- message: `Successfully synced ${accounts.length} account(s) from Kiro CLI`
10
+ url: '',
11
+ instructions: 'Syncing credentials from Kiro CLI...',
12
+ method: 'auto',
13
+ callback: async () => {
14
+ try {
15
+ // Sync from kiro-cli
16
+ const { syncFromKiroCli } = await import('../../plugin/sync/kiro-cli.js');
17
+ await syncFromKiroCli();
18
+ // Give it a moment for the database to be written
19
+ await new Promise(resolve => setTimeout(resolve, 1000));
20
+ // Check if we have any accounts
21
+ const accounts = await this.repository.findAll();
22
+ if (accounts.length === 0) {
23
+ return {
24
+ type: 'failed'
25
+ };
26
+ }
27
+ // Return success with a dummy key (not used, but required by OpenCode)
28
+ return {
29
+ type: 'success',
30
+ key: 'kiro-cli-synced'
31
+ };
32
+ }
33
+ catch (error) {
34
+ return {
35
+ type: 'failed'
36
+ };
37
+ }
38
+ }
23
39
  };
24
40
  }
25
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kervnet/opencode-kiro-auth",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "OpenCode plugin for AWS Kiro (CodeWhisperer) with IAM Identity Center profile support",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",