This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

stigmergic / src / cli-utils.ts
679 B 22 lines
1/** 2 * CLI utilities for stigmergic commands 3 */ 4 5import { existsSync } from 'node:fs'; 6import { readFile } from 'node:fs/promises'; 7 8export async function loadDotEnv(filePath: string): Promise<void> { 9 if (!existsSync(filePath)) return; 10 const content = await readFile(filePath, 'utf-8'); 11 for (const line of content.split('\n')) { 12 const trimmed = line.trim(); 13 if (!trimmed || trimmed.startsWith('#')) continue; 14 const eq = trimmed.indexOf('='); 15 if (eq === -1) continue; 16 const key = trimmed.slice(0, eq).trim(); 17 const value = trimmed.slice(eq + 1).trim(); 18 if (key && value) { 19 process.env[key] = value.replace(/^["']|["']$/g, ''); 20 } 21 } 22}