import { Command, type OptionValues } from 'commander'; import type { Action } from '@dynatrace/openkit-js'; /** Shared context threaded through the authoring-flow resolution helpers. */ export interface DocumentCommandContext { program: OptionValues; cwd: string; documentsDir: string; rootAction?: Action; addNewLine: boolean; } /** The resolved ``/``/`` inputs, common to both authoring flows. */ export interface ResolvedDocumentInputs { name: string; type: string; extension?: string; sourceFilePath?: string; } /** Create domain based document command */ export declare function createDocumentCommand(): Command; /** Creates a ready-made document */ export declare function createDocument(program: OptionValues): Promise; /** Result of validating a candidate document `` part. */ export type DocumentNameValidation = { valid: true; } | { valid: false; reason: 'invalid' | 'exists'; message: string; }; /** * Pure decision function validating a candidate document `` part: it * must match the backend document `id` rule (see `isValidDocumentId`) and * must not collide with an existing document. Used both for the eager check * on the `--name` flag and for the interactive name prompt, so the rule is * defined once. Callers are responsible for any logging/telemetry. */ export declare function validateDocumentName(name: string, options: { documentsDir: string; cwd: string; }): DocumentNameValidation; /** * Determines whether the existing-file authoring flow should be used. * Skips the interactive choice prompt whenever a flag already disambiguates * the intended flow: `--file-path` implies the existing-file flow; `--name`, * `--type`, or non-interactive mode imply the new-file flow. */ export declare function resolveAuthoringFlow(context: DocumentCommandContext): Promise; /** * Resolves the inputs (name, type, extension) for the new-file authoring flow, * prompting for any missing values in interactive mode, or throwing a clear * error in non-interactive mode. */ export declare function resolveNewFileInputs(context: DocumentCommandContext): Promise; /** * Resolves the inputs (name, type, extension) for the existing-file authoring * flow: the document name and extension are derived by parsing the file path, * while the type is prompted for (or read from `--type`). */ export declare function resolveExistingFileInputs(context: DocumentCommandContext): Promise; /** * Resolves the document `` part, prompting or throwing as needed. An * explicit `--type` flag always wins; otherwise a valid `derivedType` (parsed * from an existing file's name) is used before falling back to a prompt. */ export declare function resolveType(context: DocumentCommandContext, derivedType?: string): Promise; /** * Resolves the optional document `` part. Only prompted for in the * new-file flow, when `--ext` was not explicitly passed and running * interactively. */ export declare function resolveExtension(context: DocumentCommandContext): Promise;