UNPKG

@gati-framework/cli

Version:

CLI tool for Gati framework - create, develop, build and deploy cloud-native applications

144 lines 3.24 kB
/** * @module cli/analyzer/manifest-generator * @description Generates handler and module manifests from TypeScript code * * Implements Task 8: Handler Manifest Generation * - Extracts handler metadata (ID, path, methods) * - Generates GType references * - Extracts hook definitions * - Generates security policies * - Creates Timescape fingerprint */ /** * Handler manifest structure */ export interface HandlerManifest { handlerId: string; path: string; method: string | string[]; gtypes: { request: string; response: string; params?: string; headers?: string; }; hooks: { before: string[]; after: string[]; catch?: string[]; }; timescapeVersion: string; policies: { roles?: string[]; rateLimit?: { limit: number; window: number; }; }; dependencies: { modules: string[]; plugins?: string[]; }; } /** * Module manifest structure */ export interface ModuleManifest { moduleId: string; runtime: 'node' | 'wasm' | 'oci' | 'binary'; capabilities: Capability[]; methods: ModuleMethod[]; version: string; networkAccess: { egress: boolean; allowedHosts?: string[]; }; } /** * Module capability */ export interface Capability { name: string; description: string; required: boolean; } /** * Module method definition */ export interface ModuleMethod { name: string; inputType: string; outputType: string; timeout?: number; } /** * Manifest generator options */ export interface ManifestGeneratorOptions { /** * Project root directory */ projectRoot: string; /** * TypeScript config file path */ tsConfigPath?: string; /** * Output directory for manifests */ outputDir?: string; } /** * Manifest generator for handlers and modules */ export declare class ManifestGenerator { private program; private checker; private options; constructor(options: ManifestGeneratorOptions); /** * Generate handler manifest from source file */ generateHandlerManifest(filePath: string): HandlerManifest | null; /** * Check if function is a handler */ private isHandlerFunction; /** * Generate handler ID from file path and function name */ private generateHandlerId; /** * Extract JSDoc comments */ private extractJSDoc; /** * Extract GType references from handler parameters */ private extractGTypes; /** * Convert TypeScript type node to string */ private typeToString; /** * Extract hook definitions from handler body */ private extractHooks; /** * Extract security policies from JSDoc */ private extractPolicies; /** * Extract module and plugin dependencies */ private extractDependencies; /** * Generate Timescape version fingerprint */ private generateTimescapeVersion; /** * Write manifest to file */ writeManifest(manifest: HandlerManifest | ModuleManifest, filename: string): void; } //# sourceMappingURL=manifest-generator.d.ts.map