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

Function run

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

Source from the content-addressed store, hash-verified

730 * @param {string[]} args - Command-line arguments (process.argv.slice(2))
731 */
732export function run(args) {
733 // --version / -v
734 if (args.includes('--version') || args.includes('-v')) {
735 printVersion();
736 return;
737 }
738
739 // --help / -h
740 if (args.includes('--help') || args.includes('-h')) {
741 printHelp();
742 return;
743 }
744
745 // --dev guard: this only works from a cloned repository
746 if (args.includes('--dev')) {
747 die(
748 'Dev mode requires a cloned repository.\n' +
749 ' Clone from https://github.com/paperlinguist/autocoder and run start_ui.sh'
750 );
751 return;
752 }
753
754 // "config" subcommand
755 if (args[0] === 'config') {
756 handleConfig(args.slice(1));
757 return;
758 }
759
760 // Parse flags for server start
761 const host = getFlagValue(args, '--host') || '127.0.0.1';
762 const portStr = getFlagValue(args, '--port');
763 const port = portStr ? Number(portStr) : null;
764 const noBrowser = args.includes('--no-browser');
765 const repair = args.includes('--repair');
766
767 if (port !== null && (!Number.isFinite(port) || port < 1 || port > 65535)) {
768 die('Invalid port number. Must be between 1 and 65535.');
769 }
770
771 // Print banner
772 console.log('');
773 log(`AutoForge v${VERSION}`);
774 console.log('');
775
776 startServer({ port, host, noBrowser, repair });
777}
778
779// ---------------------------------------------------------------------------
780// Argument parsing helpers

Callers 1

autoforge.jsFile · 0.90

Calls 8

printVersionFunction · 0.85
printHelpFunction · 0.85
dieFunction · 0.85
handleConfigFunction · 0.85
getFlagValueFunction · 0.85
logFunction · 0.85
startServerFunction · 0.85
logMethod · 0.80

Tested by

no test coverage detected