import type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from 'openapi-types'; import type { PackageJson } from 'type-fest'; /** Supported OpenAPI document types */ export type OpenAPISpec = OpenAPIV2.Document | OpenAPIV3.Document | OpenAPIV3_1.Document; /** * Represents the parsed sections of an existing SDK_CONTEXT.md file */ export interface ExistingContextSections { /** Content before the DOMAINS-START marker (null if no existing file or no markers) */ beforeDomains: string | null; /** Content after the DOMAINS-END marker (null if no existing file or no markers) */ afterDomains: string | null; /** Disambiguation notes extracted from the file */ disambiguation: string; } /** * Parse SDK_CONTEXT.md content to extract preserved sections * @param content The content of the SDK_CONTEXT.md file (null if file doesn't exist) * @returns Parsed sections or defaults if content is null */ export declare function parseExistingContext(content: string | null): ExistingContextSections; /** * Result of updating package.json for prepare:context script */ export interface PrepareContextScriptResult { /** Updated package.json object */ packageJson: PackageJson.PackageJsonStandard; /** Whether the prepare:context script was added */ prepareContextAdded: boolean; /** Whether the build script was updated */ buildScriptUpdated: boolean; } /** * Updates a package.json object to add prepare:context script and update build script * @param packageJson The package.json object to update * @returns Result containing updated package.json and flags indicating what was changed */ export declare function updatePackageJsonForContextScript(packageJson: PackageJson): PrepareContextScriptResult; /** * Represents a domain extracted from an OpenAPI specification * A domain groups related API operations together */ export interface Domain { /** Domain name (typically from OpenAPI tag) */ name: string; /** Human-readable description of the domain */ description: string; /** List of operations belonging to this domain */ operations: { /** Unique operation identifier */ operationId: string; /** HTTP method (GET, POST, etc.) */ method: string; /** Short description of the operation */ summary: string; /** API endpoint path */ path: string; }[]; /** Set of model names referenced by operations in this domain */ models: Set; } /** Standard HTTP methods supported in OpenAPI specifications */ export declare const HTTP_METHODS: ["get", "post", "put", "delete", "patch", "options", "head"]; /** * Extracts the model name from an OpenAPI $ref string * @param ref The $ref string to extract from * @returns The model name or null if not found */ export declare function extractRefModel(ref?: string): string | null; /** * Extracts all referenced model names from an OpenAPI operation (supports both V2 and V3) * @param operation The OpenAPI operation to extract models from * @returns Array of model names */ export declare function extractModelsFromOperation(operation: OpenAPIV2.OperationObject | OpenAPIV3.OperationObject | OpenAPIV3_1.OperationObject): string[]; /** * Infers a domain name from an API path * @param apiPath The API path to infer from * @returns The inferred domain name or 'default' */ export declare function inferDomainFromPath(apiPath: string): string; /** * Extracts domains from an OpenAPI specification * @param spec The OpenAPI specification to extract from * @param customDescriptions Optional custom descriptions for domains * @returns Map of domain names to Domain objects */ export declare function extractDomains(spec: OpenAPISpec, customDescriptions?: Record | null): Map; //# sourceMappingURL=update-sdk-context.helpers.d.ts.map