49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
|
|
#!/usr/bin/env -S deno run --allow-all
|
||
|
|
|
||
|
|
/**
|
||
|
|
* SZCI - Serve Zone CI/CD Tool
|
||
|
|
*
|
||
|
|
* A command-line tool for streamlining Node.js and Docker workflows
|
||
|
|
* within CI environments, particularly GitLab CI, GitHub CI, and Gitea CI.
|
||
|
|
*
|
||
|
|
* Required Permissions:
|
||
|
|
* - --allow-net: Network access for Docker registries, npm, git operations
|
||
|
|
* - --allow-read: Read configuration files, Dockerfiles, package.json
|
||
|
|
* - --allow-write: Write configuration files, build artifacts
|
||
|
|
* - --allow-run: Execute system commands (docker, git, npm, ssh)
|
||
|
|
* - --allow-sys: Access system information (OS details)
|
||
|
|
* - --allow-env: Read/write environment variables
|
||
|
|
*
|
||
|
|
* @module
|
||
|
|
*/
|
||
|
|
|
||
|
|
import { Szci } from './ts/szci.classes.szci.ts';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Main entry point for the SZCI application
|
||
|
|
* Parses command-line arguments and executes the requested command
|
||
|
|
*/
|
||
|
|
async function main(): Promise<void> {
|
||
|
|
// Create Szci instance
|
||
|
|
const szciInstance = new Szci();
|
||
|
|
|
||
|
|
// Start the CLI
|
||
|
|
// Deno.args is already 0-indexed (unlike Node's process.argv which starts at index 2)
|
||
|
|
// The smartcli library may expect process.argv format, so we might need to prepend placeholders
|
||
|
|
await szciInstance.start();
|
||
|
|
}
|
||
|
|
|
||
|
|
// 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);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// Export for programmatic use
|
||
|
|
export { Szci } from './ts/szci.classes.szci.ts';
|
||
|
|
export { Dockerfile } from './ts/manager.docker/mod.classes.dockerfile.ts';
|