@kervnet/opencode-kiro-auth 1.7.0 → 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<
|
|
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,18 +6,36 @@ export class KiroCliAuthMethod {
|
|
|
6
6
|
this.repository = repository;
|
|
7
7
|
}
|
|
8
8
|
async authorize() {
|
|
9
|
-
// Sync from kiro-cli
|
|
10
|
-
const { syncFromKiroCli } = await import('../../plugin/sync/kiro-cli.js');
|
|
11
|
-
await syncFromKiroCli();
|
|
12
|
-
// Check if we have any accounts
|
|
13
|
-
const accounts = await this.repository.findAll();
|
|
14
|
-
if (accounts.length === 0) {
|
|
15
|
-
throw new Error('No Kiro CLI session found. Please run "kiro-cli login" first, then try again.');
|
|
16
|
-
}
|
|
17
|
-
// Return success - no actual OAuth needed since we sync from kiro-cli
|
|
18
9
|
return {
|
|
19
|
-
|
|
20
|
-
|
|
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
|
+
}
|
|
21
39
|
};
|
|
22
40
|
}
|
|
23
41
|
}
|
package/package.json
CHANGED