import * as effect_Types0 from "effect/Types";
import * as effect_Cause0 from "effect/Cause";
import { Cause, Context, Effect } from "effect";
import * as _effect_cli_ValidationError0 from "@effect/cli/ValidationError";
import * as _effect_cli_CliApp0 from "@effect/cli/CliApp";

//#region src/utils/packageManager.d.ts
type PackageManager = "npm" | "pnpm" | "yarn" | "bun";
//#endregion
//#region src/core/types.d.ts
type AppType = "browser" | "webviewer";
type UIType = "shadcn" | "mantine";
type DataSourceType = "filemaker" | "none";
type OverwriteMode = "overwrite" | "clear";
interface CliFlags {
  noGit: boolean;
  noInstall: boolean;
  force: boolean;
  default: boolean;
  importAlias: string;
  debug?: boolean;
  server?: string;
  adminApiKey?: string;
  fileName?: string;
  layoutName?: string;
  schemaName?: string;
  dataApiKey?: string;
  auth?: "none";
  dataSource?: DataSourceType;
  ui?: UIType;
  CI: boolean;
  nonInteractive?: boolean;
  appType?: AppType;
}
interface FileMakerEnvNames {
  database: string;
  server: string;
  apiKey: string;
}
interface HostedFileMakerInputs {
  mode: "hosted-otto";
  dataSourceName: string;
  envNames: FileMakerEnvNames;
  server: string;
  fileName: string;
  dataApiKey: string;
  layoutName?: string;
  schemaName?: string;
  adminApiKey?: string;
  fmsVersion?: string;
  ottoVersion?: string | null;
}
interface LocalFmMcpInputs {
  mode: "local-fm-mcp";
  dataSourceName: string;
  envNames: FileMakerEnvNames;
  fmMcpBaseUrl: string;
  fileName: string;
  layoutName?: string;
  schemaName?: string;
}
type FileMakerInputs = HostedFileMakerInputs | LocalFmMcpInputs;
interface InitRequest {
  projectName: string;
  scopedAppName: string;
  appDir: string;
  appType: AppType;
  ui: UIType;
  dataSource: DataSourceType;
  packageManager: PackageManager;
  noInstall: boolean;
  noGit: boolean;
  force: boolean;
  cwd: string;
  importAlias: string;
  nonInteractive: boolean;
  debug: boolean;
  skipFileMakerSetup: boolean;
  fileMaker?: FileMakerInputs;
  hasExplicitFileMakerInputs: boolean;
}
interface ProofKitSettings {
  ui: UIType;
  appType: AppType;
  envFile?: string;
  dataSources: Array<{
    type: "fm";
    name: string;
    envNames: {
      database: string;
      server: string;
      apiKey: string;
    };
  }>;
  replacedMainPage: boolean;
  registryTemplates: string[];
}
interface InitPlan {
  request: InitRequest;
  targetDir: string;
  templateDir: string;
  overwriteMode?: OverwriteMode;
  packageManagerCommand: string;
  packageManagerExecuteCommand: string;
  packageJson: {
    name: string;
    devEngines?: {
      packageManager: {
        name: PackageManager;
        version: string;
        onFail: "download";
      };
      runtime: {
        name: "node";
        version: string;
        onFail: "download";
      };
    };
    engines: {
      node: string;
    };
    proofkitMetadata: {
      initVersion: string;
      scaffoldPackage: "@proofkit/cli";
    };
    dependencies: Record<string, string>;
    devDependencies: Record<string, string>;
  };
  settings: ProofKitSettings;
  envFile: {
    path: string;
    content: string;
  };
  writes: Array<{
    path: string;
    content: string;
  }>;
  commands: Array<{
    type: "install";
  } | {
    type: "ultracite-init";
  } | {
    type: "intent-install";
  } | {
    type: "codegen";
  } | {
    type: "fix";
  } | {
    type: "lint";
  } | {
    type: "git-init";
  }>;
  tasks: {
    bootstrapFileMaker: boolean;
    checkWebViewerAddon: boolean;
    runInstall: boolean;
    runUltraciteInit: boolean;
    runIntentInstall: boolean;
    runInitialCodegen: boolean;
    runFix: boolean;
    runLint: boolean;
    initializeGit: boolean;
  };
  nextSteps: string[];
}
//#endregion
//#region src/core/errors.d.ts
declare const CliValidationError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => effect_Cause0.YieldableError & {
  readonly _tag: "CliValidationError";
} & Readonly<A>;
declare class CliValidationError extends CliValidationError_base<{
  readonly message: string;
  readonly cause?: unknown;
}> {}
declare const UserCancelledError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => effect_Cause0.YieldableError & {
  readonly _tag: "UserCancelledError";
} & Readonly<A>;
declare class UserCancelledError extends UserCancelledError_base<{
  readonly message: string;
}> {}
declare const NonInteractiveInputError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => effect_Cause0.YieldableError & {
  readonly _tag: "NonInteractiveInputError";
} & Readonly<A>;
declare class NonInteractiveInputError extends NonInteractiveInputError_base<{
  readonly message: string;
}> {}
declare const DirectoryConflictError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => effect_Cause0.YieldableError & {
  readonly _tag: "DirectoryConflictError";
} & Readonly<A>;
declare class DirectoryConflictError extends DirectoryConflictError_base<{
  readonly message: string;
  readonly path: string;
}> {}
declare const FileMakerSetupError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => effect_Cause0.YieldableError & {
  readonly _tag: "FileMakerSetupError";
} & Readonly<A>;
declare class FileMakerSetupError extends FileMakerSetupError_base<{
  readonly message: string;
  readonly cause?: unknown;
}> {}
declare const RegistryError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => effect_Cause0.YieldableError & {
  readonly _tag: "RegistryError";
} & Readonly<A>;
declare class RegistryError extends RegistryError_base<{
  readonly message: string;
  readonly cause?: unknown;
}> {}
declare const ExternalCommandError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => effect_Cause0.YieldableError & {
  readonly _tag: "ExternalCommandError";
} & Readonly<A>;
declare class ExternalCommandError extends ExternalCommandError_base<{
  readonly message: string;
  readonly command: string;
  readonly args: readonly string[];
  readonly cwd: string;
  readonly cause?: unknown;
}> {}
declare const FileSystemError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => effect_Cause0.YieldableError & {
  readonly _tag: "FileSystemError";
} & Readonly<A>;
declare class FileSystemError extends FileSystemError_base<{
  readonly message: string;
  readonly operation: string;
  readonly path: string;
  readonly cause?: unknown;
}> {}
type CliError = CliValidationError | UserCancelledError | NonInteractiveInputError | DirectoryConflictError | FileMakerSetupError | RegistryError | ExternalCommandError | FileSystemError;
//#endregion
//#region src/core/context.d.ts
type Eff<A, E = never, R = never> = Effect.Effect<A, E, R>;
interface CliContextValue {
  cwd: string;
  debug: boolean;
  nonInteractive: boolean;
  packageManager: PackageManager;
  resolvedProjectConfig?: {
    appType?: AppType;
    ui?: UIType;
    projectDir?: string;
  };
}
interface PromptService {
  readonly text: (options: {
    message: string;
    defaultValue?: string;
    validate?: (value: string) => string | undefined;
  }) => Promise<string>;
  readonly password: (options: {
    message: string;
    validate?: (value: string) => string | undefined;
  }) => Promise<string>;
  readonly select: <T extends string>(options: {
    message: string;
    options: Array<{
      value: T;
      label: string;
      hint?: string;
      disabled?: boolean | string;
    }>;
  }) => Promise<T>;
  readonly searchSelect: <T extends string>(options: {
    message: string;
    emptyMessage?: string;
    options: Array<{
      value: T;
      label: string;
      hint?: string;
      keywords?: string[];
      disabled?: boolean | string;
    }>;
  }) => Promise<T>;
  readonly multiSearchSelect: <T extends string>(options: {
    message: string;
    options: Array<{
      value: T;
      label: string;
      hint?: string;
      keywords?: string[];
      disabled?: boolean | string;
    }>;
    required?: boolean;
  }) => Promise<T[]>;
  readonly confirm: (options: {
    message: string;
    initialValue?: boolean;
  }) => Promise<boolean>;
}
declare const PromptService: Context.Tag<PromptService, PromptService>;
interface ConsoleService {
  readonly info: (message: string) => void;
  readonly warn: (message: string) => void;
  readonly error: (message: string) => void;
  readonly success: (message: string) => void;
  readonly note: (message: string, title?: string) => void;
}
declare const ConsoleService: Context.Tag<ConsoleService, ConsoleService>;
interface FileSystemService {
  readonly exists: (path: string) => Eff<boolean, CliError>;
  readonly readdir: (path: string) => Eff<string[], CliError>;
  readonly emptyDir: (path: string) => Eff<void, CliError>;
  readonly copyDir: (from: string, to: string, options?: {
    overwrite?: boolean;
  }) => Eff<void, CliError>;
  readonly rename: (from: string, to: string) => Eff<void, CliError>;
  readonly remove: (path: string) => Eff<void, CliError>;
  readonly readJson: <T>(path: string) => Eff<T, CliError>;
  readonly writeJson: (path: string, value: unknown) => Eff<void, CliError>;
  readonly writeFile: (path: string, content: string) => Eff<void, CliError>;
  readonly readFile: (path: string) => Eff<string, CliError>;
}
declare const FileSystemService: Context.Tag<FileSystemService, FileSystemService>;
interface TemplateService {
  readonly getTemplateDir: (appType: AppType, ui: UIType) => string;
}
declare const TemplateService: Context.Tag<TemplateService, TemplateService>;
interface PackageManagerService {
  readonly getVersion: (packageManager: PackageManager, cwd: string) => Eff<string | undefined, CliError>;
}
declare const PackageManagerService: Context.Tag<PackageManagerService, PackageManagerService>;
interface ProcessService {
  readonly run: (command: string, args: string[], options: {
    cwd: string;
    stdout?: "pipe" | "inherit" | "ignore";
    stderr?: "pipe" | "inherit" | "ignore";
  }) => Eff<{
    stdout: string;
    stderr: string;
  }, CliError>;
}
declare const ProcessService: Context.Tag<ProcessService, ProcessService>;
interface GitService {
  readonly initialize: (projectDir: string) => Eff<void, CliError>;
}
declare const GitService: Context.Tag<GitService, GitService>;
interface SettingsService {
  readonly writeSettings: (projectDir: string, settings: ProofKitSettings) => Eff<void, CliError>;
  readonly appendEnvVars: (projectDir: string, vars: Record<string, string>) => Eff<void, CliError>;
}
declare const SettingsService: Context.Tag<SettingsService, SettingsService>;
interface FmMcpStatus {
  baseUrl: string;
  healthy: boolean;
  connectedFiles: string[];
}
interface FileMakerServerVersions {
  fmsVersion: string;
  ottoVersion: string | null;
}
interface OttoFileInfo {
  filename: string;
  status: string;
}
interface OttoApiKeyInfo {
  key: string;
  user: string;
  database: string;
  label: string;
}
interface FileMakerBootstrapArtifacts {
  settings: ProofKitSettings;
  envVars: Record<string, string>;
  envSchemaEntries: Array<{
    name: string;
    zodSchema: string;
    defaultValue: string;
  }>;
  typegenConfig: {
    mode: FileMakerInputs["mode"];
    dataSourceName: string;
    envNames?: FileMakerEnvNames;
    fmMcpBaseUrl?: string;
    connectedFileName?: string;
    layoutName?: string;
    schemaName?: string;
    appType: AppType;
  };
}
interface FileMakerService {
  readonly detectLocalFmMcp: (baseUrl?: string) => Eff<FmMcpStatus, CliError>;
  readonly installLocalWebViewerAddon: () => Eff<void, CliError>;
  readonly validateHostedServerUrl: (serverUrl: string, ottoPort?: number | null) => Eff<{
    normalizedUrl: string;
    versions: FileMakerServerVersions;
  }, CliError>;
  readonly getOttoFMSToken: (options: {
    url: URL;
  }) => Eff<{
    token: string;
  }, CliError>;
  readonly listFiles: (options: {
    url: URL;
    token: string;
  }) => Eff<OttoFileInfo[], CliError>;
  readonly listAPIKeys: (options: {
    url: URL;
    token: string;
  }) => Eff<OttoApiKeyInfo[], CliError>;
  readonly createDataAPIKeyWithCredentials: (options: {
    url: URL;
    filename: string;
    username: string;
    password: string;
  }) => Eff<{
    apiKey: string;
  }, CliError>;
  readonly deployDemoFile: (options: {
    url: URL;
    token: string;
    operation: "install" | "replace";
  }) => Eff<{
    apiKey: string;
    filename: string;
  }, CliError>;
  readonly listLayouts: (options: {
    dataApiKey: string;
    fmFile: string;
    server: string;
  }) => Eff<string[], CliError>;
  readonly createFileMakerBootstrapArtifacts: (settings: ProofKitSettings, inputs: FileMakerInputs, appType: AppType) => Eff<FileMakerBootstrapArtifacts, CliError>;
  readonly bootstrap: (projectDir: string, settings: ProofKitSettings, inputs: FileMakerInputs, appType: AppType) => Eff<ProofKitSettings, CliError>;
}
declare const FileMakerService: Context.Tag<FileMakerService, FileMakerService>;
interface CodegenService {
  readonly runInitial: (projectDir: string, packageManager: PackageManager) => Eff<void, CliError>;
}
declare const CodegenService: Context.Tag<CodegenService, CodegenService>;
//#endregion
//#region src/index.d.ts
declare const runInit: (name?: string, rawFlags?: Partial<CliFlags>) => Effect.Effect<{
  request: {
    projectName: string;
    scopedAppName: string;
    appDir: string;
    appType: AppType;
    ui: UIType;
    dataSource: DataSourceType;
    packageManager: "npm" | "pnpm" | "yarn" | "bun";
    noInstall: boolean;
    noGit: boolean;
    force: boolean;
    cwd: string;
    importAlias: string;
    nonInteractive: boolean;
    debug: boolean;
    fileMaker: {
      mode: "hosted-otto";
      dataSourceName: string;
      envNames: FileMakerEnvNames;
      server: string;
      fileName: string;
      dataApiKey: string;
      layoutName: string | undefined;
      schemaName: string | undefined;
      adminApiKey: string | undefined;
      fmsVersion: string;
      ottoVersion: string | null;
    } | {
      mode: "local-fm-mcp";
      dataSourceName: string;
      envNames: FileMakerEnvNames;
      fmMcpBaseUrl: string;
      fileName: string;
      layoutName: string | undefined;
      schemaName: string | undefined;
    } | undefined;
    skipFileMakerSetup: boolean;
    hasExplicitFileMakerInputs: boolean;
  };
  plan: InitPlan;
}, CliError, PromptService | CliContextValue | PackageManagerService | ConsoleService | FileMakerService | TemplateService | FileSystemService | SettingsService | ProcessService | GitService | CodegenService>;
declare const runDefaultCommand: (rawFlags?: Partial<CliFlags>) => Effect.Effect<void, Error, PromptService | CliContextValue | PackageManagerService | ConsoleService | FileMakerService | TemplateService | FileSystemService | SettingsService | ProcessService | GitService | CodegenService>;
declare const cli: (args: ReadonlyArray<string>) => Effect.Effect<void, Error | CliError | _effect_cli_ValidationError0.ValidationError, _effect_cli_CliApp0.CliApp.Environment>;
declare function renderFailure(cause: Cause.Cause<unknown>, showDebugDetails: boolean): void;
//#endregion
export { cli, renderFailure, runDefaultCommand, runInit };
//# sourceMappingURL=index-gxXsknla.d.ts.map