import type { PackageManagerId } from '../shared/package-managers.js'; import type { ScaffoldWordPressTargetVersion } from './scaffold-compatibility.js'; import type { ScaffoldTemplateVariableGroupsCarrier } from './scaffold-template-variable-groups.js'; /** * User-facing scaffold answers before template rendering. * * `namespace`, `textDomain`, and `phpPrefix` are normalized before use so * callers can pass human-entered values while generated output stays * predictable. */ export interface ScaffoldAnswers { author: string; compoundInnerBlocksPreset?: import('../add/compound-inner-blocks.js').CompoundInnerBlocksPresetId; dataStorageMode?: DataStorageMode; description: string; /** Block namespace used in generated block names such as `namespace/slug`. */ namespace: string; persistencePolicy?: PersistencePolicy; /** Snake_case PHP symbol prefix used for generated functions, constants, and keys. */ phpPrefix?: string; queryPostType?: string; slug: string; /** Kebab-case WordPress text domain used in block metadata and i18n strings. */ textDomain?: string; title: string; } export declare const DATA_STORAGE_MODES: readonly ['post-meta', 'custom-table']; export type DataStorageMode = (typeof DATA_STORAGE_MODES)[number]; export declare const PERSISTENCE_POLICIES: readonly ['authenticated', 'public']; export type PersistencePolicy = (typeof PERSISTENCE_POLICIES)[number]; /** Supported create profile ids for opt-in workspace scaffold presets. */ export declare const CREATE_PROFILE_IDS: readonly ['plugin-qa']; /** Union of supported `wp-typia create --profile` id strings. */ export type CreateProfileId = (typeof CREATE_PROFILE_IDS)[number]; /** * Normalized template variables shared by built-in and remote scaffold flows. */ export interface FlatScaffoldTemplateVariables extends Record { alternateRenderTargetsCsv: string; alternateRenderTargetsJson: string; apiClientPackageVersion: string; author: string; bootstrapEndpointDeclaration: string; blockRuntimePackageVersion: string; blockMetadataVersion: string; blockTypesPackageVersion: string; category: string; icon: string; compoundChildTitle: string; compoundChildCategory: string; compoundChildCssClassName: string; compoundChildIcon: string; compoundChildTitleJson: string; compoundChildTitleTsLiteral: string; compoundPersistenceEnabled: 'false' | 'true'; compoundInnerBlocksDirectInsert: 'false' | 'true'; compoundInnerBlocksOrientation: '' | 'horizontal' | 'vertical'; compoundInnerBlocksOrientationExpression: string; compoundInnerBlocksPreset: string; compoundInnerBlocksPresetDescription: string; compoundInnerBlocksPresetLabel: string; compoundInnerBlocksTemplateLockExpression: string; hasAlternateEmailRenderTarget: 'false' | 'true'; hasAlternateMjmlRenderTarget: 'false' | 'true'; hasAlternatePlainTextRenderTarget: 'false' | 'true'; hasAlternateRenderTargets: 'false' | 'true'; projectToolsPackageVersion: string; wpTypiaPackageVersion: string; requiresAtLeast: string; requiresPhp: string; cssClassName: string; dashCase: string; dataStorageMode: DataStorageMode; description: string; descriptionJson: string; descriptionTsLiteral: string; frontendCssClassName: string; keyword: string; namespace: string; needsMigration: string; pascalCase: string; phpPrefix: string; phpPrefixUpper: string; queryAllowedControlsJson: string; queryAllowedControlsTsLiteral: string; queryPostTypeJson: string; queryPostTypeTsLiteral: string; queryPostType: string; queryVariationNamespace: string; queryVariationNamespaceJson: string; queryVariationNamespaceTsLiteral: string; isAuthenticatedPersistencePolicy: 'false' | 'true'; isPublicPersistencePolicy: 'false' | 'true'; bootstrapCredentialDeclarations: string; persistencePolicyDescriptionJson: string; persistencePolicyDescriptionTsLiteral: string; publicWriteRequestIdDeclaration: string; restPackageVersion: string; restWriteAuthIntent: 'authenticated' | 'public-write-protected'; restWriteAuthMechanism: 'public-signed-token' | 'rest-nonce'; restWriteAuthMode: 'authenticated-rest-nonce' | 'public-signed-token'; slug: string; slugCamelCase: string; slugKebabCase: string; slugSnakeCase: string; stateEndpointDeclaration: string; textDomain: string; textdomain: string; testedUpTo: string; title: string; titleJson: string; titleTsLiteral: string; titleCase: string; persistencePolicy: PersistencePolicy; writeStateEndpointDeclaration: string; } export interface ScaffoldTemplateVariables extends FlatScaffoldTemplateVariables, ScaffoldTemplateVariableGroupsCarrier { } /** * Resolve scaffold template input from either built-in template ids or custom * template identifiers such as local paths, GitHub refs, and npm packages. * * The callback returns `Promise` on purpose so interactive selection * can surface custom ids. Downstream code uses `isBuiltInTemplateId()` to * distinguish built-in templates from custom sources. */ export interface ResolveTemplateOptions { isInteractive?: boolean; selectTemplate?: () => Promise; templateId?: string; yes?: boolean; } /** * Options for resolving the package manager in CLI and interactive scaffold flows. */ export interface ResolvePackageManagerOptions { isInteractive?: boolean; packageManager?: string; selectPackageManager?: () => Promise; yes?: boolean; } /** * Options for collecting scaffold answers from defaults, overrides, and prompts. */ export interface CollectScaffoldAnswersOptions { dataStorageMode?: DataStorageMode; namespace?: string; phpPrefix?: string; projectName: string; promptText?: (message: string, defaultValue: string, validate?: (value: string) => true | string) => Promise; persistencePolicy?: PersistencePolicy; queryPostType?: string; textDomain?: string; templateId: string; withTestPreset?: boolean; withWpEnv?: boolean; yes?: boolean; } interface InstallDependenciesOptions { packageManager: PackageManagerId; projectDir: string; } export interface ScaffoldProgressEvent { detail: string; phase: 'finalize-project' | 'generate-files' | 'install-dependencies' | 'resolve-template' | 'seed-artifacts'; title: string; } interface ScaffoldProjectOptions { allowExistingDir?: boolean; alternateRenderTargets?: string; answers: ScaffoldAnswers; cwd?: string; dataStorageMode?: DataStorageMode; externalLayerId?: string; externalLayerSource?: string; externalLayerSourceLabel?: string; installDependencies?: ((options: InstallDependenciesOptions) => Promise) | undefined; noInstall?: boolean; onProgress?: ((event: ScaffoldProgressEvent) => void | Promise) | undefined; packageManager: PackageManagerId; persistencePolicy?: PersistencePolicy; profile?: CreateProfileId; projectDir: string; repositoryReference?: string; /** Whether compiler-backed metadata and REST artifacts should be seeded. */ seedCompilerArtifacts?: boolean; templateId: string; variant?: string; withMigrationUi?: boolean; withTestPreset?: boolean; withWpEnv?: boolean; wpVersion?: ScaffoldWordPressTargetVersion; } export interface ScaffoldProjectResult { packageManager: PackageManagerId; projectDir: string; selectedVariant: string | null; templateId: string; variables: ScaffoldTemplateVariables; warnings: string[]; } export { buildBlockCssClassName } from './scaffold-identifiers.js'; export { collectScaffoldAnswers, detectAuthor, getDefaultAnswers, resolvePackageManagerId, resolveTemplateId, } from './scaffold-answer-resolution.js'; export { getTemplateVariables } from './scaffold-template-variables.js'; export { getScaffoldTemplateVariableGroups, type BasicScaffoldTemplateVariableGroups, type CompoundScaffoldTemplateVariableGroups, type ExternalScaffoldTemplateVariableGroups, type InteractivityScaffoldTemplateVariableGroups, type PersistenceScaffoldTemplateVariableGroups, type QueryLoopScaffoldTemplateVariableGroups, type ScaffoldTemplateFamily, type ScaffoldTemplateVariableGroups, type ScaffoldTemplateVariableGroupsCarrier, } from './scaffold-template-variable-groups.js'; export declare function isDataStorageMode(value: string): value is DataStorageMode; export declare function isPersistencePolicy(value: string): value is PersistencePolicy; /** * Return whether a raw string is a supported create profile id. */ export declare function isCreateProfileId(value: string): value is CreateProfileId; /** * Resolve an optional create profile flag into a validated profile id. * * Empty input disables profile application; unknown ids throw with the allowed * profile list for CLI diagnostics. */ export declare function resolveCreateProfileId(profile?: string): CreateProfileId | undefined; export declare function scaffoldProject({ projectDir, templateId, answers, alternateRenderTargets, dataStorageMode, persistencePolicy, packageManager, externalLayerId, externalLayerSource, externalLayerSourceLabel, profile, repositoryReference, seedCompilerArtifacts, cwd, allowExistingDir, noInstall, installDependencies, onProgress, variant, withMigrationUi, withTestPreset, withWpEnv, wpVersion }: ScaffoldProjectOptions): Promise;