* Ensure ~/.autoforge/.env exists. On first run, copy .env.example * from the package directory and print a notice. * * Returns true if the file was newly created.
()
| 365 | * Returns true if the file was newly created. |
| 366 | */ |
| 367 | function ensureEnvFile() { |
| 368 | if (existsSync(ENV_FILE)) return false; |
| 369 | |
| 370 | mkdirSync(CONFIG_HOME, { recursive: true }); |
| 371 | |
| 372 | if (existsSync(ENV_EXAMPLE)) { |
| 373 | copyFileSync(ENV_EXAMPLE, ENV_FILE); |
| 374 | } else { |
| 375 | // Fallback: create a minimal placeholder |
| 376 | writeFileSync(ENV_FILE, '# AutoForge configuration\n# See documentation for available options.\n', 'utf8'); |
| 377 | } |
| 378 | return true; |
| 379 | } |
| 380 | |
| 381 | // --------------------------------------------------------------------------- |
| 382 | // Port detection |
no outgoing calls
no test coverage detected