| 49 | * Load project configuration from .tianjirc in current directory |
| 50 | */ |
| 51 | export async function loadProjectConfig( |
| 52 | cwd: string = process.cwd() |
| 53 | ): Promise<ProjectConfig | null> { |
| 54 | try { |
| 55 | const projectConfigPath = path.join(cwd, PROJECT_CONFIG_FILE); |
| 56 | if (await fs.pathExists(projectConfigPath)) { |
| 57 | const config = await fs.readJson(projectConfigPath); |
| 58 | return config; |
| 59 | } |
| 60 | return null; |
| 61 | } catch (error) { |
| 62 | console.error('Error loading project config:', error); |
| 63 | return null; |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Save project configuration to .tianjirc in specified directory |