import { dashed } from '../../lib/index.js'; import type { FileFragment } from '../providers/types.js'; export interface TemplateManifest { version: number; [key: string]: any; } export interface ResolvedLicense { text: string; header: string; name: string; tag: string; } export interface ServiceTokenInput { name: string; className: string; version: string; description: string; author: string; email: string; namespace: string; homepage: string; bugs: string; license: ResolvedLicense; addonPreload?: string; addonConfig?: string; repoUrl?: string; homeUrl?: string; bugsUrl?: string; } /** * Resolves a template reference to a local template directory. A reference may * be a filesystem path, a git url (ssh/https/bare `*.git`), the name of a * template in the pinned templates repo, or the name of a custom template * directory the user placed under `~/.imq/custom-templates/`. * * @param {string} template * @param {string} [ref] - templates-repo git ref * @param {boolean} [interactive] - whether prompts are allowed (git-url reuse) * @return {Promise} */ export declare function ensureTemplate(template: string, ref?: string, interactive?: boolean): Promise; /** * Reads a template's manifest (imq-template.json). Absent/unreadable manifest * means a legacy v1 template. * * @param {string} templatePath * @return {TemplateManifest | null} */ export declare function loadTemplateManifest(templatePath: string): TemplateManifest | null; /** * Whether the scaffolded service is an ES module (package.json type=module), * which decides the module style of generated code. * * @param {string} servicePath * @return {boolean} */ export declare function isEsmService(servicePath: string): boolean; /** * Overlays provider/addon file fragments onto a scaffolded service, * overwriting any same-named template file. * * @param {string} servicePath * @param {FileFragment[]} fragments */ export declare function overlayFragments(servicePath: string, fragments: FileFragment[]): void; /** * Removes docker artifacts from a v2 service when dockerization is disabled. * (v2 templates ship no CI file, so only docker files are removed here.) * * @param {string} path */ export declare function removeDockerFiles(path: string): void; /** * Produces the license text/header/name/tag for a resolved license id. Does * not prompt (selection happens during plan building). Supports the special * UNLICENSED value, SPDX ids/names from the bundled catalog, and a path to a * custom license file. * * @param {string} license - resolved license id, name, path, or "UNLICENSED" * @param {string} author * @param {string} email * @param {string} homepage * @param {string} serviceName * @return {ResolvedLicense} */ export declare function resolveLicense(license: string, author: string, email: string, homepage: string, serviceName: string): ResolvedLicense; /** * Writes the LICENSE file into the service directory, overwriting any file * shipped by the template. * * @param {string} path - service directory * @param {string} text - license body */ export declare function writeLicense(path: string, text: string): void; /** * Builds the base %TOKEN map (service metadata + license) used to compile the * template tree. * * @param {ServiceTokenInput} input * @return {Record} */ export declare function buildServiceTokens(input: ServiceTokenInput): Record; /** * Generates the main service class source file. * * @param {string} path - service directory * @param {Record} tokens */ export declare function createServiceFile(path: string, tokens: Record, esm: boolean): void; /** * Generates the main service test file. * * @param {string} path - service directory * @param {Record} tokens */ export declare function createServiceTestFile(path: string, tokens: Record, esm: boolean): void; /** * Generates optional add-on files for a scaffolded service based on the * selected catalog packages: the OpenTelemetry preload, and the full * @imqueue/pg-prisma persistence setup (schema, prisma config, request-context * accessors and the extended client). Also swaps in a native-decorator * tsconfig and patches package.json when pg-prisma/validation are selected. * * @param {string} path - service directory * @param {string} header - resolved license header for generated files * @param {string[]} packages - selected catalog package ids * @param {boolean} isV2 - whether the target template ships the v2 contract * (src/config.ts + src/env-defaults.ts); v1 templates get a self-contained * telemetry file that does not import them * @param {string} serviceName - service name baked into v1 telemetry as the * OpenTelemetry resource attribute (v2 reads it from config.serviceName) */ export declare function generateAddons(path: string, header: string, packages: string[], isV2: boolean, serviceName: string): void; /** * Recursively compiles %TOKEN placeholders across every file under a path, * skipping VCS/dependency directories and symlinks. * * @param {string} path - directory to compile * @param {Record} tokens */ export declare function compileTemplate(path: string, tokens: Record): void; /** * Removes docker/legacy-CI artifacts from a v1 template when dockerization is * disabled (strips the travis services block and deletes docker files). * * @param {string} path - service directory */ export declare function stripDockerization(path: string): void; /** re-export dashed for callers building names into tokens */ export { dashed };