cli.ts•954 B
import { parseArgs as nodeParseArgs } from 'util';
/**
* Parse command line arguments
* @returns Parsed CLI options
*/
export function parseArgs() {
const { values } = nodeParseArgs({
options: {
port: {
type: 'string',
short: 'p',
description: 'Port to run HTTP server on'
},
stdio: {
type: 'boolean',
short: 's',
description: 'Force STDIO transport even if PORT is set'
},
debug: {
type: 'boolean',
short: 'd',
description: 'Enable debug logging'
}
},
strict: false,
allowPositionals: true
});
return {
port: values.port && typeof values.port === 'string' ? parseInt(values.port, 10) : undefined,
stdio: values.stdio || false,
debug: values.debug || false
};
}