Skip to main content
Glama
deleonio
by deleonio
abstract-task.ts1.58 kB
import semver from 'semver'; import { FILE_EXTENSIONS, FileExtension } from '../../types'; import { logAndCreateError } from '../shares/reuse'; import { TaskStatus } from './types'; export type TaskOptions = { taskDependencies?: AbstractTask[]; description?: string; }; export abstract class AbstractTask { private status: TaskStatus = 'pending'; protected static readonly instances: Map<string, AbstractTask> = new Map(); protected readonly description?: string; protected constructor( protected readonly identifier: string, protected readonly title: string, protected readonly extensions: FileExtension[], protected readonly versionRange: string, protected readonly taskDependencies: AbstractTask[] = [], options: TaskOptions = {}, ) { this.description = options.description; this.extensions = this.extensions.filter((ext) => FILE_EXTENSIONS.includes(ext)); if (!semver.validRange(this.versionRange)) { throw logAndCreateError(`[${this.identifier}] Invalid semver range version: ${this.versionRange}`); } } public getTaskDependencies(): AbstractTask[] { return this.taskDependencies; } public getDescription(): string | undefined { return this.description; } public getIdentifier(): string { return this.identifier; } public setStatus(status: TaskStatus): void { this.status = status; } public getStatus(): TaskStatus { return this.status; } public getTitle(): string { return this.title; } public getVersionRange(): string { return this.versionRange; } public abstract run(baseDir: string): void; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/deleonio/public-ui-kolibri'

If you have feedback or need assistance with the MCP directory API, please join our Discord server