Files
registry/ts/cli.ts
Juergen Kunz ab88ac896f feat: implement account settings and API tokens management
- Added SettingsComponent for user profile management, including display name and password change functionality.
- Introduced TokensComponent for managing API tokens, including creation and revocation.
- Created LayoutComponent for consistent application layout with navigation and user information.
- Established main application structure in index.html and main.ts.
- Integrated Tailwind CSS for styling and responsive design.
- Configured TypeScript settings for strict type checking and module resolution.
2025-11-27 22:15:38 +00:00

109 lines
3.1 KiB
TypeScript

/**
* CLI entry point for Stack.Gallery Registry
*/
import * as plugins from './plugins.ts';
import { StackGalleryRegistry, createRegistryFromEnv } from './registry.ts';
import { initDb } from './models/db.ts';
import { User, Organization, OrganizationMember, Repository } from './models/index.ts';
import { AuthService } from './services/auth.service.ts';
export async function runCli(): Promise<void> {
const smartcliInstance = new plugins.smartcli.Smartcli();
// Server command
smartcliInstance.addCommand('server').subscribe(async (argsParsed) => {
console.log('Starting Stack.Gallery Registry...');
const registry = createRegistryFromEnv();
await registry.start();
// Handle shutdown gracefully
const shutdown = async () => {
console.log('\nShutting down...');
await registry.stop();
Deno.exit(0);
};
Deno.addSignalListener('SIGINT', shutdown);
Deno.addSignalListener('SIGTERM', shutdown);
});
// Status command
smartcliInstance.addCommand('status').subscribe(async () => {
console.log('Stack.Gallery Registry Status');
console.log('=============================');
// TODO: Implement status check
console.log('Status check not yet implemented');
});
// User commands
smartcliInstance.addCommand('user').subscribe(async (argsParsed) => {
const subCommand = argsParsed.commandArgs[0];
switch (subCommand) {
case 'create':
console.log('Creating user...');
// TODO: Implement user creation
break;
case 'list':
console.log('Listing users...');
// TODO: Implement user listing
break;
default:
console.log('Usage: user [create|list]');
}
});
// Organization commands
smartcliInstance.addCommand('org').subscribe(async (argsParsed) => {
const subCommand = argsParsed.commandArgs[0];
switch (subCommand) {
case 'create':
console.log('Creating organization...');
// TODO: Implement org creation
break;
case 'list':
console.log('Listing organizations...');
// TODO: Implement org listing
break;
default:
console.log('Usage: org [create|list]');
}
});
// Default/help command
smartcliInstance.addCommand('help').subscribe(() => {
console.log(`
Stack.Gallery Registry - Enterprise Package Registry
Usage:
registry <command> [options]
Commands:
server [--ephemeral] [--monitor] Start the registry server
status Check registry status
user <subcommand> User management
org <subcommand> Organization management
help Show this help message
Options:
--ephemeral Run in ephemeral mode (in-memory database)
--monitor Enable performance monitoring
Environment Variables:
MONGODB_URL MongoDB connection string
S3_ENDPOINT S3-compatible storage endpoint
S3_ACCESS_KEY S3 access key
S3_SECRET_KEY S3 secret key
S3_BUCKET S3 bucket name
JWT_SECRET JWT signing secret
PORT HTTP server port (default: 3000)
`);
});
// Parse CLI arguments
smartcliInstance.startParse();
}