Skip to main content

DotGEN: Code/Data Generator

The DotGEN command-line tool is the core utility for bootstrapping new applications, generating boilerplate components, managing project dependencies, and handling internationalization (i18n) resources within the DotHRB ecosystem.

Usage Syntax

dotgen [options] <command>

1. ⚙️ Global Options

These options affect the overall operation of the dotgen tool.

OptionDescription
--helpDisplay this help message and exit.
-vEnable verbose output for detailed operation logs.
-dataInclude the data directory when publishing builds (used for deployment).
--licenseDisplay license and copyright information.
--versionDisplay the version information.

2. 🧩 Primary Commands

These are the main actions used for project scaffolding and dependency management.

CommandDescription
new <tpl> [-o <name>]Create a New Application from the specified template (<tpl>). Optionally, use -o to define the output folder name.
make:<type> <name> [tpl]Generate a Component of the specified type (e.g., make:Controller, make:Page).
restoreRun npm install (or equivalent) to restore project dependencies and rebuild necessary assets.

Example: Creating a new WebApp

dotgen new webapp -o myapp
dotgen make:Controller MyController template model=MyModel
dotgen make:Page UserPage template model=User

3. 🗃️ seed Command: Database Population

The seed command is used to quickly populate a database table with data from a JSON file.

Sub-OptionDescription
(Command)seed
-d 'sqlite db'Specify the target SQLite database file path.
-t 'table'Specify the target table name for seeding.
-json 'file'Specify the source JSON file path containing the data.
-no-truncatePrevents truncation of the table before seeding (new data is appended).
-executeREQUIRED flag to execute the seed operation.

4. 🌐 lang Command: Localization & AI Translation

The lang command provides tools to manage language resource files and generate AI prompts for translation.

SubcommandPurpose
reloadForce a reload of all language resource files.
prompt-for-json=file.jsonGenerates an AI prompt to translate all values found in the specified JSON file.
prompt-for-words=word1[,word2,...]Generates an AI prompt to translate a list of specific words or phrases.
prompt-model-json=model,langGenerates an AI prompt for a model's translation, specifying the target language.
prompt-model-auto=modelGenerates an AI prompt, allowing the AI to guess the target language based on context.
prompt-new-lang-project-json=json,langGenerates an AI prompt to create a new project-level language file.
prompt-new-lang-common-json=json,langGenerates an AI prompt to create a new common-level language file.
rename-key=old,newRename a translation key across all language files.
delete-key=keyDelete a specific translation key across all language files.
reorder-all-by-alphanumReorder all keys in all language files alphabetically.
add-project-json=file.jsonAdd or merge keys from a JSON file into the project language resource.
add-common-json=file.jsonAdd or merge keys from a JSON file into the common language resource.

Example: Generating a Translation Prompt

dotgen lang prompt-for-json=file.json

5. 💻 ts Command: TypeScript Utilities

The ts command is used to generate TypeScript code based on existing models.

SubcommandPurpose
interface-from-model=model.jsonGenerate a TypeScript interface (I<Model>.ts) based on the structure defined in the specified model JSON file.

Example: Generating a TypeScript Interface

dotgen ts interface-from-model=Models/Model.json