Files
modelgrid/mod.ts

45 lines
1.4 KiB
TypeScript
Raw Normal View History

2026-01-30 03:16:57 +00:00
#!/usr/bin/env -S deno run --allow-all
/**
* ModelGrid - GPU Infrastructure Management Daemon
*
* A root-level daemon that manages GPU infrastructure, Docker, and AI model containers
* (Ollama, vLLM, TGI) with an OpenAI-compatible API interface.
*
* Required Permissions:
* - --allow-net: HTTP server for OpenAI API, container communication
* - --allow-read: Read configuration files (/etc/modelgrid/config.json)
* - --allow-write: Write configuration files
* - --allow-run: Execute system commands (docker, nvidia-smi, systemctl)
* - --allow-sys: Access system information (hostname, OS details, GPU info)
* - --allow-env: Read environment variables
*
* @module
*/
import { ModelGridCli } from './ts/cli.ts';
/**
* Main entry point for the ModelGrid application
* Parses command-line arguments and executes the requested command
*/
async function main(): Promise<void> {
const cli = new ModelGridCli();
// Deno.args is already 0-indexed (unlike Node's process.argv which starts at index 2)
// We need to prepend placeholder args to match the existing CLI parser expectations
const args = ['deno', 'mod.ts', ...Deno.args];
await cli.parseAndExecute(args);
}
// Execute main and handle errors
if (import.meta.main) {
try {
await main();
} catch (error) {
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
Deno.exit(1);
}
}