Skip to main content

Interface: TemplateConfigModule<TParentFinalSettings, TInputSettingsSchema, TFinalSettingsSchema, TAiResultsObject, TInputSettings, TFinalSettings>

Defined in: ../../template-types-lib/src/types/template-config-types.ts:195

Interface representing the module to be exported from every templateConfig.ts file.

Template

The type of the schema used for template settings.

Type Parameters

TParentFinalSettings

TParentFinalSettings extends FinalTemplateSettings

TInputSettingsSchema

TInputSettingsSchema extends z.AnyZodObject

TFinalSettingsSchema

TFinalSettingsSchema extends z.AnyZodObject = TInputSettingsSchema

TAiResultsObject

TAiResultsObject extends AiResultsObject = { }

TInputSettings

TInputSettings extends UserTemplateSettings = z.output<TInputSettingsSchema>

TFinalSettings

TFinalSettings extends FinalTemplateSettings = z.output<TFinalSettingsSchema>

Properties

aiAutoGenerate?

optional aiAutoGenerate: AiAutoGenerateSettings<TFinalSettings>

Defined in: ../../template-types-lib/src/types/template-config-types.ts:304

Ai auto generation settings. This is invoked to add ai generated vars to the template. Provides the expected keys the ai will produce. In the template ai_results will be a Record string string where the expected keys are the ones provided here. These have to be provided to generate the template so this function needs to return these keys.


aiContext?

optional aiContext: AnyOrCallback<TFinalSettings, AiContext>

Defined in: ../../template-types-lib/src/types/template-config-types.ts:295

A description of this template. Usefull for the AI. When instantiating a child template this description will be used to describe the the things this template adds.


aiUserConversationSettings?

optional aiUserConversationSettings: AiUserConversationSettings<TFinalSettings>[]

Defined in: ../../template-types-lib/src/types/template-config-types.ts:310

Ai user conversation settings. These settings are used to start a conversation with the user. After the conversation is resolved the ai will call the final conversation ending tool and the ai should provide the expected keys otherwise generation will fail. Allow the user to retry a conversation if the ai doesnt provide the keys or if the user wants to modify the keys. Show all results to user before actually using the ai generated results in the template. All ai results will also go inside the templateSettings. Bit ugly but otherwise needs to go in a hidden file or a subdir.


allowedOverwrites?

optional allowedOverwrites: AnyOrCallback<TFinalSettings, AllowOverwrite[]>

Defined in: ../../template-types-lib/src/types/template-config-types.ts:266

Overwrite Rules


assertions?

optional assertions: AnyOrCallback<TFinalSettings, boolean>

Defined in: ../../template-types-lib/src/types/template-config-types.ts:279

Assertions. Function must return true otherwise the template generation will fail.


autoInstantiatedSubtemplates?

optional autoInstantiatedSubtemplates: AnyOrCallback<TFinalSettings, AutoInstantiatedSubtemplate<TFinalSettings>[]>

Defined in: ../../template-types-lib/src/types/template-config-types.ts:271

Auto instantiate subtemplates.


commands?

optional commands: TemplateCommand<TFinalSettings>[]

Defined in: ../../template-types-lib/src/types/template-config-types.ts:289

A list of commands the user might want to run inside the project. Related to this template. Executed using bash.


handlebarHelpers?

optional handlebarHelpers: Record<string, HelperDelegate>

Defined in: ../../template-types-lib/src/types/template-config-types.ts:284

A list of helper functions provided to handlebars before rendering the template.


mapFinalSettings()

mapFinalSettings: (inputSettings) => TFinalSettings

Defined in: ../../template-types-lib/src/types/template-config-types.ts:230

The final settings type mapping after the user inputted settings are merged with the template settings. This is the type that will be used to generate the template.

Parameters

inputSettings
aiResults

TAiResultsObject

fullProjectSettings

{ instantiatedTemplates: object[]; projectAuthor: string; projectName: string; rootTemplateName: string; }

fullProjectSettings.instantiatedTemplates

object[] = ...

fullProjectSettings.projectAuthor

string = ...

fullProjectSettings.projectName

string = ...

fullProjectSettings.rootTemplateName

string = ...

parentSettings?

TParentFinalSettings

templateSettings

TInputSettings

Returns

TFinalSettings


migrations?

optional migrations: TemplateMigration[]

Defined in: ../../template-types-lib/src/types/template-config-types.ts:243


parentFinalSettingsSchema?

optional parentFinalSettingsSchema: ZodType<TParentFinalSettings, ZodTypeDef, TParentFinalSettings>

Defined in: ../../template-types-lib/src/types/template-config-types.ts:241

Schema describing the expected final settings from the parent template. Required when this template is referenced from a different repository.


redirects?

optional redirects: AnyOrCallback<TFinalSettings, RedirectFile[]>

Defined in: ../../template-types-lib/src/types/template-config-types.ts:261

Redirects of files or directories to another location based from project root.


sideEffects?

optional sideEffects: AnyOrCallback<TFinalSettings, SideEffect<TFinalSettings>[]>

Defined in: ../../template-types-lib/src/types/template-config-types.ts:253

Side effects to be applied when generating the template.


targetPath?

optional targetPath: StringOrCallback<TFinalSettings>

Defined in: ../../template-types-lib/src/types/template-config-types.ts:209

The target path for the template. Must be set on subtemplates. relative to the project root

Default

"."

Example

"src"

templateConfig

templateConfig: object

Defined in: ../../template-types-lib/src/types/template-config-types.ts:214

Template base configuration options.

author

author: string

description?

optional description: string

multiInstance?

optional multiInstance: boolean

name

name: string

specVersion

specVersion: string


templateFinalSettingsSchema

templateFinalSettingsSchema: TFinalSettingsSchema

Defined in: ../../template-types-lib/src/types/template-config-types.ts:224

Schema expected when generating template. Might be same as templateSettingsSchema. Used to check template validity when loading.


templateSettingsSchema

templateSettingsSchema: TInputSettingsSchema

Defined in: ../../template-types-lib/src/types/template-config-types.ts:219

Schema inputted by user before generating the template.


templatesThatDisableThis?

optional templatesThatDisableThis: TemplateDisablingThis[]

Defined in: ../../template-types-lib/src/types/template-config-types.ts:248

Templates that when already existing in the project will disable the generation of this template.