MCPcopy Index your code
hub / github.com/codeaashu/claude-code / AwsAuthStatusManager

Class AwsAuthStatusManager

src/utils/awsAuthStatusManager.ts:18–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16}
17
18export class AwsAuthStatusManager {
19 private static instance: AwsAuthStatusManager | null = null
20 private status: AwsAuthStatus = {
21 isAuthenticating: false,
22 output: [],
23 }
24 private changed = createSignal<[status: AwsAuthStatus]>()
25
26 static getInstance(): AwsAuthStatusManager {
27 if (!AwsAuthStatusManager.instance) {
28 AwsAuthStatusManager.instance = new AwsAuthStatusManager()
29 }
30 return AwsAuthStatusManager.instance
31 }
32
33 getStatus(): AwsAuthStatus {
34 return {
35 ...this.status,
36 output: [...this.status.output],
37 }
38 }
39
40 startAuthentication(): void {
41 this.status = {
42 isAuthenticating: true,
43 output: [],
44 }
45 this.changed.emit(this.getStatus())
46 }
47
48 addOutput(line: string): void {
49 this.status.output.push(line)
50 this.changed.emit(this.getStatus())
51 }
52
53 setError(error: string): void {
54 this.status.error = error
55 this.changed.emit(this.getStatus())
56 }
57
58 endAuthentication(success: boolean): void {
59 if (success) {
60 // Clear the status completely on success
61 this.status = {
62 isAuthenticating: false,
63 output: [],
64 }
65 } else {
66 // Keep the output visible on failure
67 this.status.isAuthenticating = false
68 }
69 this.changed.emit(this.getStatus())
70 }
71
72 subscribe = this.changed.subscribe
73
74 // Clean up for testing
75 static reset(): void {

Callers

nothing calls this directly

Calls 1

createSignalFunction · 0.85

Tested by

no test coverage detected