( config: ProjectConfig, cwd: string = process.cwd() )
| 68 | * Save project configuration to .tianjirc in specified directory |
| 69 | */ |
| 70 | export async function saveProjectConfig( |
| 71 | config: ProjectConfig, |
| 72 | cwd: string = process.cwd() |
| 73 | ): Promise<void> { |
| 74 | try { |
| 75 | const projectConfigPath = path.join(cwd, PROJECT_CONFIG_FILE); |
| 76 | await fs.writeJson(projectConfigPath, config, { spaces: 2 }); |
| 77 | } catch (error) { |
| 78 | throw new Error(`Failed to save project config: ${error}`); |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Check if user is logged in (has valid global config) |