/// <reference types="node" />
import { Readable, Writable } from "stream";

//#region ../../node_modules/typanion/lib/types.d.ts
declare type BoundCoercionFn = () => BoundCoercionFn;
declare type CoercionFn = (v: any) => BoundCoercionFn;
declare type Coercion = [string, BoundCoercionFn];
declare type LooseTest<U> = (value: U, test?: ValidationState) => boolean;
declare type ValidationState = {
  p?: string;
  errors?: string[];
  coercions?: Coercion[];
  coercion?: CoercionFn;
};
//#endregion
//#region ../../node_modules/clipanion/lib/format.d.ts
interface ColorFormat {
  header(str: string): string;
  bold(str: string): string;
  error(str: string): string;
  code(str: string): string;
}
//#endregion
//#region ../../node_modules/clipanion/lib/advanced/options/utils.d.ts
declare const isOptionSymbol: unique symbol;
//#endregion
//#region ../../node_modules/clipanion/lib/advanced/Cli.d.ts
/**
 * The base context of the CLI.
 *
 * All Contexts have to extend it.
 */
declare type BaseContext = {
  /**
   * Environment variables.
   *
   * @default
   * process.env
   */
  env: Record<string, string | undefined>;
  /**
   * The input stream of the CLI.
   *
   * @default
   * process.stdin
   */
  stdin: Readable;
  /**
   * The output stream of the CLI.
   *
   * @default
   * process.stdout
   */
  stdout: Writable;
  /**
   * The error stream of the CLI.
   *
   * @default
   * process.stderr
   */
  stderr: Writable;
  /**
   * Whether colors should be enabled.
   */
  colorDepth: number;
};
declare type CliOptions = Readonly<{
  /**
   * The label of the binary.
   *
   * Shown at the top of the usage information.
   */
  binaryLabel?: string;
  /**
   * The name of the binary.
   *
   * Included in the path and the examples of the definitions.
   */
  binaryName: string;
  /**
   * The version of the binary.
   *
   * Shown at the top of the usage information.
   */
  binaryVersion?: string;
  /**
   * If `true`, the Cli will hook into the process standard streams to catch
   * the output produced by console.log and redirect them into the context
   * streams. Note: stdin isn't captured at the moment.
   *
   * @default
   * false
   */
  enableCapture: boolean;
  /**
   * If `true`, the Cli will use colors in the output. If `false`, it won't.
   * If `undefined`, Clipanion will infer the correct value from the env.
   */
  enableColors?: boolean;
}>;
declare type MiniCli<Context extends BaseContext> = CliOptions & {
  /**
   * Returns an Array representing the definitions of all registered commands.
   */
  definitions(): Array<Definition>;
  /**
   * Formats errors using colors.
   *
   * @param error The error to format. If `error.name` is `'Error'`, it is replaced with `'Internal Error'`.
   * @param opts.command The command whose usage will be included in the formatted error.
   */
  error(error: Error, opts?: {
    command?: Command<Context> | null;
  }): string;
  /**
   * Returns a rich color format if colors are enabled, or a plain text format otherwise.
   *
   * @param colored Forcefully enable or disable colors.
   */
  format(colored?: boolean): ColorFormat;
  /**
   * Compiles a command and its arguments using the `CommandBuilder`.
   *
   * @param input An array containing the name of the command and its arguments
   *
   * @returns The compiled `Command`, with its properties populated with the arguments.
   */
  process(input: Array<string>, context?: Partial<Context>): Command<Context>;
  /**
   * Runs a command.
   *
   * @param input An array containing the name of the command and its arguments
   * @param context Overrides the Context of the main `Cli` instance
   *
   * @returns The exit code of the command
   */
  run(input: Array<string>, context?: Partial<Context>): Promise<number>;
  /**
   * Returns the usage of a command.
   *
   * @param command The `Command` whose usage will be returned or `null` to return the usage of all commands.
   * @param opts.detailed If `true`, the usage of a command will also include its description, details, and examples. Doesn't have any effect if `command` is `null` or doesn't have a `usage` property.
   * @param opts.prefix The prefix displayed before each command. Defaults to `$`.
   */
  usage(command?: CommandClass<Context> | Command<Context> | null, opts?: {
    detailed?: boolean;
    prefix?: string;
  }): string;
};
//#endregion
//#region ../../node_modules/clipanion/lib/advanced/Command.d.ts
/**
 * The usage of a Command.
 */
declare type Usage = {
  /**
   * The category of the command.
   *
   * Included in the detailed usage.
   */
  category?: string;
  /**
   * The short description of the command, formatted as Markdown.
   *
   * Included in the detailed usage.
   */
  description?: string;
  /**
   * The extended details of the command, formatted as Markdown.
   *
   * Included in the detailed usage.
   */
  details?: string;
  /**
   * Examples of the command represented as an Array of tuples.
   *
   * The first element of the tuple represents the description of the example.
   *
   * The second element of the tuple represents the command of the example.
   * If present, the leading `$0` is replaced with `cli.binaryName`.
   */
  examples?: Array<[string, string]>;
};
/**
 * The definition of a Command.
 */
declare type Definition = Usage & {
  /**
   * The path of the command, starting with `cli.binaryName`.
   */
  path: string;
  /**
   * The detailed usage of the command.
   */
  usage: string;
  /**
   * The various options registered on the command.
   */
  options: Array<{
    definition: string;
    description?: string;
    required: boolean;
  }>;
};
declare type CommandClass<Context extends BaseContext = BaseContext> = {
  new (): Command<Context>;
  paths?: Array<Array<string>>;
  schema?: Array<LooseTest<{
    [key: string]: unknown;
  }>>;
  usage?: Usage;
};
/**
 * Base abstract class for CLI commands. The main thing to remember is to
 * declare an async `execute` member function that will be called when the
 * command is invoked from the CLI, and optionally a `paths` property to
 * declare the set of paths under which the command should be exposed.
 */
declare abstract class Command<Context extends BaseContext = BaseContext> {
  /**
   * @deprecated Do not use this; prefer the static `paths` property instead.
   */
  paths?: undefined;
  /**
   * Defined to prevent a common typo.
   */
  static path: never;
  /**
   * Paths under which the command should be exposed.
   */
  static paths?: Array<Array<string>>;
  /**
   * Defines the usage information for the given command.
   */
  static Usage(usage: Usage): Usage;
  /**
   * Contains the usage information for the command. If undefined, the
   * command will be hidden from the general listing.
   */
  static usage?: Usage;
  /**
   * Defines a schema to apply before running the `execute` method. The
   * schema is expected to be generated by Typanion.
   *
   * @see https://github.com/arcanis/typanion
   */
  static schema?: Array<LooseTest<{
    [key: string]: unknown;
  }>>;
  /**
   * Standard function that'll get executed by `Cli#run` and `Cli#runExit`.
   *
   * Expected to return an exit code or nothing (which Clipanion will treat
   * as if 0 had been returned).
   */
  abstract execute(): Promise<number | void>;
  /**
   * Standard error handler which will simply rethrow the error. Can be used
   * to add custom logic to handle errors from the command or simply return
   * the parent class error handling.
   */
  catch(error: any): Promise<void>;
  /**
   * Predefined that will be set to true if `-h,--help` has been used, in
   * which case `Command#execute` won't be called.
   */
  help: boolean;
  /**
   * Predefined variable that will be populated with a miniature API that can
   * be used to query Clipanion and forward commands.
   */
  cli: MiniCli<Context>;
  /**
   * Predefined variable that will be populated with the context of the
   * application.
   */
  context: Context;
  /**
   * Predefined variable that will be populated with the path that got used
   * to access the command currently being executed.
   */
  path: Array<string>;
  validateAndExecute(): Promise<number>;
  /**
   * Used to detect option definitions.
   */
  static isOption: typeof isOptionSymbol;
  /**
   * Just an helper to use along with the `paths` fields, to make it
   * clearer that a command is the default one.
   *
   * @example
   * class MyCommand extends Command {
   *   static paths = [Command.Default];
   * }
   */
  static Default: never[];
}
//#endregion
//#region ../base/dist/helpers/logger.d.ts
declare enum LogLevel {
  DEBUG = 1,
  INFO = 2,
  WARN = 3,
  ERROR = 4
}
interface LoggerOptions {
  shouldIncludeTimestamp?: boolean;
  /**
   * When `true`, every log call emits a single-line JSON object instead of
   * ANSI-coloured text. Useful when Datadog itself (or any other log
   * pipeline) ingests CLI output: each line parses cleanly and `level` is
   * preserved instead of every `error` showing up as `info`.
   */
  jsonOutput?: boolean;
}
declare class Logger {
  private loglevel;
  private rawWriteMessage;
  private shouldIncludeTimestamp;
  private jsonOutput;
  constructor(writeMessage: (s: string) => void, loglevel: LogLevel, shouldIncludeTimestampOrOptions?: boolean | LoggerOptions);
  setLogLevel(newLogLevel: LogLevel): void;
  setShouldIncludeTime(newShouldIncludeTimestamp: boolean): void;
  setJsonOutput(newJsonOutput: boolean): void;
  isJsonOutput(): boolean;
  error(s: string): void;
  warn(s: string): void;
  info(s: string): void;
  debug(s: string): void;
  private emit;
}
//#endregion
//#region ../base/dist/index.d.ts
type CommandContext = BaseContext & {
  builtinPlugins: string[];
};
/**
 * This command should be extended by **every** command in the monorepo.
 */
declare abstract class BaseCommand extends Command<CommandContext> {
  protected logFormat: "json" | "text";
  private _logger?;
  get logger(): Logger;
}
//#endregion
//#region ../base/dist/commands/junit/upload.d.ts
declare class JunitUploadCommand extends BaseCommand {
  static paths: string[][];
  static usage: Usage;
  basePaths: string[];
  verbose: boolean;
  dryRun: boolean;
  env: string | undefined;
  logs: boolean;
  maxConcurrency: number;
  measures: string[] | undefined;
  service: string | undefined;
  tags: string[] | undefined;
  reportTags: string[] | undefined;
  reportMeasures: string[] | undefined;
  rawXPathTags: string[] | undefined;
  gitRepositoryURL: string | undefined;
  skipGitMetadataUpload: boolean;
  automaticReportsDiscovery: boolean;
  ignoredPaths: string | undefined;
  fips: boolean;
  fipsIgnoreError: boolean;
  execute(): Promise<number | void>;
}
//#endregion
//#region src/commands/upload.d.ts
declare class PluginCommand extends JunitUploadCommand {
  private config;
  private xpathTags?;
  execute(): Promise<1 | undefined>;
  private uploadToGitDB;
  private getApiHelper;
  private parseXPathTags;
  private getMatchingJUnitXMLFiles;
  private getSpanTags;
  private getCustomTags;
  private getCustomMeasures;
  private getReportTags;
  private getReportMeasures;
  private uploadJUnitXML;
}
//#endregion
//#region dist/.bundle-entry.d.ts
declare const commands: {
  upload: {
    PluginCommand: typeof PluginCommand;
  };
};
//#endregion
export { commands };
//# sourceMappingURL=bundle.d.ts.map