initial
This commit is contained in:
44
mod.ts
Normal file
44
mod.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user