MCPcopy Index your code
hub / github.com/AutoForgeAI/autoforge / handleConfig

Function handleConfig

lib/cli.js:550–587  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

548}
549
550function handleConfig(args) {
551 ensureEnvFile();
552
553 if (args.includes('--path')) {
554 console.log(ENV_FILE);
555 return;
556 }
557
558 if (args.includes('--show')) {
559 if (!existsSync(ENV_FILE)) {
560 log('No configuration file found.');
561 return;
562 }
563 const lines = readFileSync(ENV_FILE, 'utf8').split('\n');
564 const active = lines.filter(l => {
565 const t = l.trim();
566 return t && !t.startsWith('#');
567 });
568 if (active.length === 0) {
569 log('No active configuration. All lines are commented out.');
570 log(`Edit: ${ENV_FILE}`);
571 } else {
572 for (const line of active) {
573 console.log(line);
574 }
575 }
576 return;
577 }
578
579 // Open in editor
580 const editor = process.env.EDITOR || process.env.VISUAL || (IS_WIN ? 'notepad' : 'vi');
581 try {
582 execFileSync(editor, [ENV_FILE], { stdio: 'inherit' });
583 } catch {
584 log(`Could not open editor "${editor}".`);
585 log(`Edit the file manually: ${ENV_FILE}`);
586 }
587}
588
589// ---------------------------------------------------------------------------
590// Main server start

Callers 1

runFunction · 0.85

Calls 3

ensureEnvFileFunction · 0.85
logFunction · 0.85
logMethod · 0.80

Tested by

no test coverage detected