()
| 31 | } |
| 32 | |
| 33 | private async initializeFS(): Promise<void> { |
| 34 | if (this.fs) return; |
| 35 | |
| 36 | logger.debug('Initializing SqliteFS', { id: this.ctx.id.toString() }); |
| 37 | |
| 38 | try { |
| 39 | this.fs = new SqliteFS(this.db); |
| 40 | this.fs.init(); |
| 41 | } catch (error) { |
| 42 | this.fs = null; |
| 43 | logger.error('Failed to initialize SqliteFS', formatError(error)); |
| 44 | throw error; |
| 45 | } |
| 46 | |
| 47 | // Check if .git directory exists |
| 48 | try { |
| 49 | await this.fs.stat('.git'); |
| 50 | this._initialized = true; |
| 51 | logger.debug('Repository already initialized'); |
| 52 | } catch (_err) { |
| 53 | // .git doesn't exist, repo not initialized yet |
| 54 | this._initialized = false; |
| 55 | logger.debug('Repository not yet initialized'); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | async isInitialized(): Promise<boolean> { |
| 60 | return withLogTags( |
no test coverage detected