@gravito/scaffold 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,20 @@
1
1
  import Handlebars from 'handlebars';
2
2
 
3
+ /**
4
+ * Supported project profiles defining the set of included orbits and default drivers.
5
+ *
6
+ * @public
7
+ * @since 3.0.0
8
+ */
3
9
  type ProfileType = 'core' | 'scale' | 'enterprise';
10
+ /**
11
+ * Resolved configuration for a project profile.
12
+ *
13
+ * @public
14
+ * @since 3.0.0
15
+ */
4
16
  interface ProfileConfig {
17
+ /** Map of default service drivers. */
5
18
  drivers: {
6
19
  database: string;
7
20
  cache: string;
@@ -9,8 +22,19 @@ interface ProfileConfig {
9
22
  storage: string;
10
23
  session: string;
11
24
  };
25
+ /** List of enabled features and orbits. */
12
26
  features: string[];
13
27
  }
28
+ /**
29
+ * ProfileResolver manages the resolution of project profiles and feature add-ons.
30
+ *
31
+ * It maps high-level profiles (Core, Scale, Enterprise) to specific sets of
32
+ * service drivers and orbits, and handles the conditional inclusion of
33
+ * additional features.
34
+ *
35
+ * @public
36
+ * @since 3.0.0
37
+ */
14
38
  declare class ProfileResolver {
15
39
  private static readonly DEFAULTS;
16
40
  resolve(profile?: ProfileType, withFeatures?: string[]): ProfileConfig;
@@ -25,16 +49,44 @@ declare class ProfileResolver {
25
49
  isValidFeature(feature: string): boolean;
26
50
  }
27
51
 
52
+ /**
53
+ * Represents the results of an environment detection scan.
54
+ *
55
+ * @public
56
+ * @since 3.0.0
57
+ */
28
58
  interface DetectedEnvironment {
59
+ /** The detected cloud or hosting platform. */
29
60
  platform: 'aws' | 'gcp' | 'azure' | 'k8s' | 'vercel' | 'netlify' | 'unknown';
61
+ /** The project profile most suitable for this environment. */
30
62
  suggestedProfile: ProfileType;
63
+ /** The degree of certainty in the detection. */
31
64
  confidence: 'high' | 'medium' | 'low';
65
+ /** The reason or heuristic used for the detection. */
32
66
  reason: string;
33
67
  }
68
+ /**
69
+ * EnvironmentDetector inspects environment variables to identify the hosting platform.
70
+ *
71
+ * It uses these heuristics to suggest the most appropriate project profile
72
+ * (Core, Scale, or Enterprise) for the current environment.
73
+ *
74
+ * @public
75
+ * @since 3.0.0
76
+ */
34
77
  declare class EnvironmentDetector {
35
78
  detect(): DetectedEnvironment;
36
79
  }
37
80
 
81
+ /**
82
+ * FileMerger handles the intelligent merging of file contents during scaffolding.
83
+ *
84
+ * It understands different file formats (JSON, ENV) and applies appropriate
85
+ * merging strategies instead of simple overwriting.
86
+ *
87
+ * @public
88
+ * @since 3.0.0
89
+ */
38
90
  declare class FileMerger {
39
91
  /**
40
92
  * Merge content of two files based on their type.
@@ -45,356 +97,130 @@ declare class FileMerger {
45
97
  }
46
98
 
47
99
  /**
48
- * Architecture types supported by the scaffolding system.
100
+ * Architecture patterns supported by the scaffolding engine.
101
+ *
102
+ * @public
103
+ * @since 3.0.0
49
104
  */
50
105
  type ArchitectureType = 'enterprise-mvc' | 'clean' | 'ddd' | 'satellite' | 'action-domain' | 'standalone-engine';
51
106
  /**
52
- * Options for scaffolding a new project.
107
+ * Configuration options for creating a new project via Scaffold.
108
+ *
109
+ * @public
110
+ * @since 3.0.0
53
111
  */
54
112
  interface ScaffoldOptions {
55
- /**
56
- * Project name
57
- */
113
+ /** The name of the new project (e.g., 'my-api'). */
58
114
  name: string;
59
- /**
60
- * Target directory (absolute path)
61
- */
115
+ /** Absolute path where the project files should be generated. */
62
116
  targetDir: string;
63
- /**
64
- * Architecture type
65
- */
117
+ /** The primary architectural pattern to apply. */
66
118
  architecture: ArchitectureType;
67
- /**
68
- * Package manager to use
69
- * @default 'bun'
70
- */
119
+ /** Preferred package manager for dependency installation. @default 'bun' */
71
120
  packageManager?: 'bun' | 'npm' | 'yarn' | 'pnpm';
72
- /**
73
- * Whether to initialize git
74
- * @default true
75
- */
121
+ /** Whether to run `git init` in the target directory. @default true */
76
122
  initGit?: boolean;
77
- /**
78
- * Whether to install dependencies
79
- * @default true
80
- */
123
+ /** Whether to automatically run `install` after file generation. @default true */
81
124
  installDeps?: boolean;
82
- /**
83
- * Whether to include Spectrum debug dashboard
84
- * @default false
85
- */
125
+ /** If true, includes the Spectrum observability dashboard in the scaffolded app. */
86
126
  withSpectrum?: boolean;
87
- /**
88
- * Whether this is an internal official satellite
89
- * @default false
90
- */
127
+ /** Internal flag for official Gravito satellite projects. */
91
128
  isInternal?: boolean;
92
- /**
93
- * Profile preset (Core, Scale, Enterprise)
94
- * @default 'core'
95
- */
129
+ /** Selected project profile determining the set of included orbits/packages. */
96
130
  profile?: 'core' | 'scale' | 'enterprise';
97
- /**
98
- * Feature add-ons (e.g. 'redis', 'queue', 'otel')
99
- */
131
+ /** List of additional feature orbits to include (e.g., 'redis', 'queue', 'otel'). */
100
132
  features?: string[];
101
- /**
102
- * Additional context variables for templates
103
- */
133
+ /** Additional template variables to be used during file generation. */
104
134
  context?: Record<string, unknown>;
105
135
  }
106
136
  /**
107
- * Result of scaffolding operation.
137
+ * The outcome of a scaffolding operation.
138
+ *
139
+ * @public
140
+ * @since 3.0.0
108
141
  */
109
142
  interface ScaffoldResult {
143
+ /** True if the operation completed without fatal errors. */
110
144
  success: boolean;
145
+ /** The absolute path where the project was created. */
111
146
  targetDir: string;
147
+ /** List of relative file paths that were successfully generated. */
112
148
  filesCreated: string[];
149
+ /** Any non-fatal error messages encountered during generation. */
113
150
  errors?: string[];
114
151
  }
115
152
  /**
116
- * Directory structure node.
153
+ * Represents a node in the project file structure blueprint.
154
+ *
155
+ * Used to define the skeleton of a new project before generation.
156
+ *
157
+ * @public
158
+ * @since 3.0.0
117
159
  */
118
160
  interface DirectoryNode {
161
+ /** The type of node (file vs folder). */
119
162
  type: 'file' | 'directory';
163
+ /** The name of the file or directory. */
120
164
  name: string;
165
+ /** Literal string content if this is a file node. */
121
166
  content?: string;
167
+ /** The name or path of a template to use for this file's content. */
122
168
  template?: string;
169
+ /** Nested nodes if this is a directory. */
123
170
  children?: DirectoryNode[];
124
171
  }
125
172
 
126
- /**
127
- * StubGenerator - Abstract template processor for generating code files.
128
- *
129
- * Provides a flexible system for processing stub templates with Handlebars,
130
- * enabling extensible code generation for any file type.
131
- *
132
- * @example
133
- * ```typescript
134
- * const generator = new StubGenerator({
135
- * stubsDir: './stubs',
136
- * outputDir: './src',
137
- * });
138
- *
139
- * await generator.generate('controller.stub', 'Controllers/UserController.ts', {
140
- * name: 'User',
141
- * namespace: 'App\\Controllers',
142
- * });
143
- * ```
144
- */
145
-
146
- /**
147
- * Variables passed to stub templates.
148
- */
149
- interface StubVariables {
150
- [key: string]: unknown;
151
- }
152
- /**
153
- * Configuration for StubGenerator.
154
- */
155
- interface StubConfig {
156
- /**
157
- * Directory containing stub templates
158
- */
159
- stubsDir: string;
160
- /**
161
- * Output directory for generated files
162
- */
163
- outputDir: string;
164
- /**
165
- * Default variables applied to all templates
166
- */
167
- defaultVariables?: StubVariables;
168
- /**
169
- * Custom Handlebars helpers
170
- */
171
- helpers?: Record<string, Handlebars.HelperDelegate>;
172
- }
173
- declare class StubGenerator {
174
- private config;
175
- private handlebars;
176
- constructor(config: StubConfig);
177
- /**
178
- * Register built-in Handlebars helpers.
179
- */
180
- private registerBuiltinHelpers;
181
- /**
182
- * Generate a file from a stub template.
183
- *
184
- * @param stubName - Name of the stub file (relative to stubsDir)
185
- * @param outputPath - Output path (relative to outputDir)
186
- * @param variables - Template variables
187
- * @returns Path to the generated file
188
- */
189
- generate(stubName: string, outputPath: string, variables?: StubVariables): Promise<string>;
190
- /**
191
- * Generate multiple files from a stub template.
192
- *
193
- * @param stubName - Name of the stub file
194
- * @param outputs - Array of [outputPath, variables] tuples
195
- * @returns Array of generated file paths
196
- */
197
- generateMany(stubName: string, outputs: [string, StubVariables][]): Promise<string[]>;
198
- /**
199
- * Render a template string directly.
200
- *
201
- * @param template - Template string
202
- * @param variables - Template variables
203
- * @returns Rendered content
204
- */
205
- render(template: string, variables?: StubVariables): string;
206
- /**
207
- * Register a custom Handlebars helper.
208
- *
209
- * @param name - Helper name
210
- * @param helper - Helper function
211
- */
212
- registerHelper(name: string, helper: Handlebars.HelperDelegate): void;
213
- /**
214
- * Register a Handlebars partial.
215
- *
216
- * @param name - Partial name
217
- * @param partial - Partial template string
218
- */
219
- registerPartial(name: string, partial: string): void;
173
+ declare class TemplateManager {
174
+ private stubGenerator;
175
+ constructor(templatesDir: string);
176
+ render(template: string, context: Record<string, unknown>): string;
177
+ applyOverlay(sourceDir: string, targetDir: string, context: Record<string, unknown>, fileMerger: FileMerger, log?: (msg: string) => void): Promise<string[]>;
220
178
  }
221
179
 
222
180
  /**
223
181
  * BaseGenerator - Abstract base class for architecture generators.
224
- *
225
- * Provides common functionality for generating project structures,
226
- * including directory creation, file generation, and context management.
227
182
  */
228
183
 
229
- /**
230
- * Context passed to generators during scaffolding.
231
- */
232
184
  interface GeneratorContext {
233
- /**
234
- * Project name
235
- */
236
185
  name: string;
237
- /**
238
- * Project name in various cases
239
- */
240
186
  namePascalCase: string;
241
187
  nameCamelCase: string;
242
188
  nameSnakeCase: string;
243
189
  nameKebabCase: string;
244
- /**
245
- * Target directory
246
- */
247
190
  targetDir: string;
248
- /**
249
- * Architecture type
250
- */
251
191
  architecture: ArchitectureType;
252
- /**
253
- * Package manager
254
- */
255
192
  packageManager: 'bun' | 'npm' | 'yarn' | 'pnpm';
256
- /**
257
- * Current year (for license headers)
258
- */
259
193
  year: string;
260
- /**
261
- * Current date
262
- */
263
194
  date: string;
264
- /**
265
- * Additional custom context
266
- */
267
195
  [key: string]: unknown;
268
196
  }
269
- /**
270
- * Configuration for generators.
271
- */
272
197
  interface GeneratorConfig {
273
- /**
274
- * Directory containing stub templates
275
- */
276
198
  templatesDir: string;
277
- /**
278
- * Verbose logging
279
- */
280
199
  verbose?: boolean;
281
200
  }
282
- /**
283
- * Abstract base class for architecture generators.
284
- */
285
201
  declare abstract class BaseGenerator {
286
202
  protected config: GeneratorConfig;
287
- protected stubGenerator: StubGenerator;
203
+ protected templateManager: TemplateManager;
288
204
  protected fileMerger: FileMerger;
289
205
  protected filesCreated: string[];
290
206
  constructor(config: GeneratorConfig);
291
- /**
292
- * Get the architecture type this generator handles.
293
- */
294
207
  abstract get architectureType(): ArchitectureType;
295
- /**
296
- * Get the display name for this architecture.
297
- */
298
208
  abstract get displayName(): string;
299
- /**
300
- * Get the description for this architecture.
301
- */
302
209
  abstract get description(): string;
303
- /**
304
- * Get the directory structure for this architecture.
305
- */
306
210
  abstract getDirectoryStructure(context: GeneratorContext): DirectoryNode[];
307
- /**
308
- * Generate the project scaffold.
309
- *
310
- * @param context - Generator context
311
- * @returns Array of created file paths
312
- */
313
211
  generate(context: GeneratorContext): Promise<string[]>;
314
- /**
315
- * Create directory structure recursively.
316
- */
317
212
  protected createStructure(basePath: string, nodes: DirectoryNode[], context: GeneratorContext): Promise<void>;
318
- /**
319
- * Generate common files (package.json, .env, etc.)
320
- */
321
213
  protected generateCommonFiles(context: GeneratorContext): Promise<void>;
322
- /**
323
- * Copy AI Skills to the project
324
- */
214
+ protected generateFileFromTemplate(tplDir: string, tplName: string, targetName: string, context: GeneratorContext): Promise<void>;
325
215
  protected generateSkills(context: GeneratorContext): Promise<void>;
326
- /**
327
- * Apply profile-specific overlays
328
- */
329
216
  protected applyOverlays(context: GeneratorContext): Promise<void>;
330
- /**
331
- * Apply feature-specific overlays
332
- */
333
217
  protected applyFeatureOverlays(context: GeneratorContext): Promise<void>;
334
- /**
335
- * Helper to copy/merge an overlay directory into the target
336
- */
337
218
  protected copyOverlayDirectory(sourceDir: string, context: GeneratorContext): Promise<void>;
338
- /**
339
- * Write a file and track it.
340
- */
341
219
  protected writeFile(basePath: string, relativePath: string, content: string): Promise<void>;
342
- /**
343
- * Generate package.json content.
344
- */
345
220
  protected generatePackageJson(context: GeneratorContext): string;
346
- /**
347
- * Generate Dockerfile content.
348
- */
349
- protected generateDockerfile(context: GeneratorContext): string;
350
- /**
351
- * Generate .dockerignore content.
352
- */
353
- protected generateDockerIgnore(): string;
354
- /**
355
- * Generate .env.example content.
356
- */
357
- protected generateEnvExample(context: GeneratorContext): string;
358
- /**
359
- * Generate .gitignore content.
360
- */
361
- protected generateGitignore(): string;
362
- /**
363
- * Generate tsconfig.json content.
364
- */
365
- protected generateTsConfig(): string;
366
- /**
367
- * Generate ARCHITECTURE.md content.
368
- * Override in subclasses for architecture-specific docs.
369
- */
370
221
  protected abstract generateArchitectureDoc(context: GeneratorContext): string;
371
- /**
372
- * Generate check scripts for project validation.
373
- */
374
222
  protected generateCheckScripts(context: GeneratorContext): Promise<void>;
375
- /**
376
- * Generate check-dependencies.ts script content.
377
- */
378
- protected generateCheckDependenciesScript(): string;
379
- /**
380
- * Generate check.sh script content.
381
- */
382
- protected generateCheckShellScript(): string;
383
- /**
384
- * Generate pre-commit.sh script content.
385
- */
386
- protected generatePreCommitScript(): string;
387
- /**
388
- * Generate CHECK_SYSTEM.md documentation.
389
- */
390
- protected generateCheckSystemDoc(context: GeneratorContext): string;
391
- /**
392
- * Log a message if verbose mode is enabled.
393
- */
394
223
  protected log(message: string): void;
395
- /**
396
- * Create generator context from options.
397
- */
398
224
  static createContext(name: string, targetDir: string, architecture: ArchitectureType, packageManager?: 'bun' | 'npm' | 'yarn' | 'pnpm', extra?: Record<string, unknown>): GeneratorContext;
399
225
  }
400
226
 
@@ -408,6 +234,16 @@ declare abstract class BaseGenerator {
408
234
  * - Interface: HTTP Controllers, Presenters
409
235
  */
410
236
 
237
+ /**
238
+ * CleanArchitectureGenerator implements Uncle Bob's Clean Architecture pattern.
239
+ *
240
+ * It generates a strictly layered structure including Domain, Application,
241
+ * Infrastructure, and Interface layers, ensuring business logic is isolated
242
+ * from framework and external dependencies.
243
+ *
244
+ * @public
245
+ * @since 3.0.0
246
+ */
411
247
  declare class CleanArchitectureGenerator extends BaseGenerator {
412
248
  get architectureType(): "clean";
413
249
  get displayName(): string;
@@ -449,44 +285,29 @@ declare class CleanArchitectureGenerator extends BaseGenerator {
449
285
  * - Each context has Domain, Application, Infrastructure, UserInterface layers
450
286
  */
451
287
 
288
+ /**
289
+ * DddGenerator implements the full Domain-Driven Design (DDD) architectural pattern.
290
+ *
291
+ * It generates a sophisticated structure including Bounded Contexts, Aggregates,
292
+ * Value Objects, Domain Events, and a Shared Kernel. It is ideal for complex
293
+ * enterprise applications with rich business logic.
294
+ *
295
+ * @public
296
+ * @since 3.0.0
297
+ */
452
298
  declare class DddGenerator extends BaseGenerator {
299
+ private moduleGenerator;
300
+ private sharedKernelGenerator;
301
+ private bootstrapGenerator;
302
+ constructor(config: GeneratorConfig);
453
303
  get architectureType(): "ddd";
454
304
  get displayName(): string;
455
305
  get description(): string;
456
306
  getDirectoryStructure(context: GeneratorContext): DirectoryNode[];
457
- private generateBootstrapDirectory;
458
- private generateShared;
459
- private generateModule;
460
- private generateBootstrapApp;
461
- private generateProvidersRegistry;
462
- private generateEventsRegistry;
463
- private generateRoutesRegistry;
464
- private generateMainEntry;
465
- private generateModulesConfig;
466
- private generateModuleServiceProvider;
467
307
  /**
468
308
  * Override package.json for DDD architecture (uses main.ts instead of bootstrap.ts)
469
309
  */
470
310
  protected generatePackageJson(context: GeneratorContext): string;
471
- private generateAppConfig;
472
- private generateDatabaseConfig;
473
- private generateCacheConfig;
474
- private generateLoggingConfig;
475
- private generateIdValueObject;
476
- private generateMoneyValueObject;
477
- private generateEmailValueObject;
478
- private generateEventDispatcher;
479
- private generateAggregate;
480
- private generateAggregateStatus;
481
- private generateCreatedEvent;
482
- private generateRepositoryInterface;
483
- private generateCommand;
484
- private generateCommandHandler;
485
- private generateQuery;
486
- private generateQueryHandler;
487
- private generateDTO;
488
- private generateRepository;
489
- private generateExceptionHandler;
490
311
  protected generateArchitectureDoc(context: GeneratorContext): string;
491
312
  }
492
313
 
@@ -500,6 +321,16 @@ declare class DddGenerator extends BaseGenerator {
500
321
  * - Http/Kernel for middleware management
501
322
  */
502
323
 
324
+ /**
325
+ * EnterpriseMvcGenerator implements a Laravel-inspired MVC architectural pattern.
326
+ *
327
+ * It generates a pragmatic, robust structure with Controllers, Services,
328
+ * Repositories, and Service Providers. It is the recommended architecture
329
+ * for most web applications and APIs.
330
+ *
331
+ * @public
332
+ * @since 3.0.0
333
+ */
503
334
  declare class EnterpriseMvcGenerator extends BaseGenerator {
504
335
  get architectureType(): "enterprise-mvc";
505
336
  get displayName(): string;
@@ -515,7 +346,6 @@ declare class EnterpriseMvcGenerator extends BaseGenerator {
515
346
  private generateHomeController;
516
347
  private generateAuthMiddleware;
517
348
  private generateAppServiceProvider;
518
- private generateRouteServiceProvider;
519
349
  private generateProvidersIndex;
520
350
  private generateDatabaseProvider;
521
351
  private generateMiddlewareProvider;
@@ -533,6 +363,15 @@ declare class EnterpriseMvcGenerator extends BaseGenerator {
533
363
  * Dogfooding support (pre-configured with Gravito modules).
534
364
  */
535
365
 
366
+ /**
367
+ * SatelliteGenerator scaffolds modular plug-and-play extensions for Gravito.
368
+ *
369
+ * It follows a strict DDD and Clean Architecture pattern to ensure that
370
+ * satellites remain decoupled from the core framework and other satellites.
371
+ *
372
+ * @public
373
+ * @since 3.0.0
374
+ */
536
375
  declare class SatelliteGenerator extends BaseGenerator {
537
376
  get architectureType(): "satellite";
538
377
  get displayName(): string;
@@ -548,12 +387,124 @@ declare class SatelliteGenerator extends BaseGenerator {
548
387
  protected generateArchitectureDoc(context: GeneratorContext): string;
549
388
  }
550
389
 
390
+ /**
391
+ * StubGenerator - Abstract template processor for generating code files.
392
+ *
393
+ * Provides a flexible system for processing stub templates with Handlebars,
394
+ * enabling extensible code generation for any file type.
395
+ *
396
+ * @example
397
+ * ```typescript
398
+ * const generator = new StubGenerator({
399
+ * stubsDir: './stubs',
400
+ * outputDir: './src',
401
+ * });
402
+ *
403
+ * await generator.generate('controller.stub', 'Controllers/UserController.ts', {
404
+ * name: 'User',
405
+ * namespace: 'App\\Controllers',
406
+ * });
407
+ * ```
408
+ */
409
+
410
+ /**
411
+ * Variables passed to stub templates during processing.
412
+ *
413
+ * @public
414
+ * @since 3.0.0
415
+ */
416
+ interface StubVariables {
417
+ [key: string]: unknown;
418
+ }
419
+ /**
420
+ * Configuration for the `StubGenerator`.
421
+ *
422
+ * @public
423
+ * @since 3.0.0
424
+ */
425
+ interface StubConfig {
426
+ /** Directory containing the raw stub templates. */
427
+ stubsDir: string;
428
+ /** Root directory for all generated files. */
429
+ outputDir: string;
430
+ /** Default variables available to all templates. */
431
+ defaultVariables?: StubVariables;
432
+ /** Optional custom Handlebars helper implementations. */
433
+ helpers?: Record<string, Handlebars.HelperDelegate>;
434
+ }
435
+ /**
436
+ * StubGenerator processes template stubs using the Handlebars engine.
437
+ *
438
+ * It provides a rich set of built-in helpers for string manipulation
439
+ * (camelCase, PascalCase, etc.) and handles file reading and writing.
440
+ *
441
+ * @public
442
+ * @since 3.0.0
443
+ */
444
+ declare class StubGenerator {
445
+ private config;
446
+ private handlebars;
447
+ constructor(config: StubConfig);
448
+ /**
449
+ * Register built-in Handlebars helpers.
450
+ */
451
+ private registerBuiltinHelpers;
452
+ /**
453
+ * Generate a file from a stub template.
454
+ *
455
+ * @param stubName - Name of the stub file (relative to stubsDir)
456
+ * @param outputPath - Output path (relative to outputDir)
457
+ * @param variables - Template variables
458
+ * @returns Path to the generated file
459
+ */
460
+ generate(stubName: string, outputPath: string, variables?: StubVariables): Promise<string>;
461
+ /**
462
+ * Generate multiple files from a stub template.
463
+ *
464
+ * @param stubName - Name of the stub file
465
+ * @param outputs - Array of [outputPath, variables] tuples
466
+ * @returns Array of generated file paths
467
+ */
468
+ generateMany(stubName: string, outputs: [string, StubVariables][]): Promise<string[]>;
469
+ /**
470
+ * Render a template string directly.
471
+ *
472
+ * @param template - Template string
473
+ * @param variables - Template variables
474
+ * @returns Rendered content
475
+ */
476
+ render(template: string, variables?: StubVariables): string;
477
+ /**
478
+ * Register a custom Handlebars helper.
479
+ *
480
+ * @param name - Helper name
481
+ * @param helper - Helper function
482
+ */
483
+ registerHelper(name: string, helper: Handlebars.HelperDelegate): void;
484
+ /**
485
+ * Register a Handlebars partial.
486
+ *
487
+ * @param name - Partial name
488
+ * @param partial - Partial template string
489
+ */
490
+ registerPartial(name: string, partial: string): void;
491
+ }
492
+
493
+ /**
494
+ * Represents the structure of a `gravito.lock.json` file.
495
+ *
496
+ * @public
497
+ * @since 3.0.0
498
+ */
551
499
  interface LockFile {
500
+ /** Information about the selected project profile. */
552
501
  profile: {
553
502
  name: ProfileType;
554
503
  version: string;
555
504
  };
505
+ /** List of enabled features and orbits. */
556
506
  features: string[];
507
+ /** Selected default drivers for various services. */
557
508
  drivers: {
558
509
  database: string;
559
510
  cache: string;
@@ -561,23 +512,46 @@ interface LockFile {
561
512
  storage: string;
562
513
  session: string;
563
514
  };
515
+ /** Metadata about the template used for generation. */
564
516
  manifest: {
565
517
  template: string;
566
518
  version: string;
567
519
  };
520
+ /** ISO timestamp when the project was scaffolded. */
568
521
  createdAt: string;
569
522
  }
523
+ /**
524
+ * LockGenerator creates the `gravito.lock.json` file during scaffolding.
525
+ *
526
+ * This file records the architectural choices and feature set of the project,
527
+ * allowing the CLI to perform consistent upgrades and feature injections later.
528
+ *
529
+ * @public
530
+ * @since 3.0.0
531
+ */
570
532
  declare class LockGenerator {
571
533
  generate(profileName: ProfileType, config: ProfileConfig, templateName?: string, templateVersion?: string): string;
572
534
  }
573
535
 
574
536
  /**
575
- * Scaffold - Main API for project scaffolding
537
+ * Scaffold is the primary engine for generating Gravito project structures.
538
+ *
539
+ * It orchestrates dynamic template generation, architecture patterns,
540
+ * profile resolution, and environment setup.
541
+ *
542
+ * @example
543
+ * ```typescript
544
+ * const engine = new Scaffold();
545
+ * const result = await engine.create({
546
+ * name: 'new-app',
547
+ * targetDir: '/path/to/app',
548
+ * architecture: 'enterprise-mvc'
549
+ * });
550
+ * ```
576
551
  *
577
- * Provides a unified interface for generating project structures
578
- * with different architectural patterns.
552
+ * @public
553
+ * @since 3.0.0
579
554
  */
580
-
581
555
  declare class Scaffold {
582
556
  private templatesDir;
583
557
  private verbose;
@@ -586,7 +560,10 @@ declare class Scaffold {
586
560
  verbose?: boolean;
587
561
  });
588
562
  /**
589
- * Get all available architecture types.
563
+ * Returns a list of all architectural patterns supported by the engine,
564
+ * along with human-readable names and descriptions.
565
+ *
566
+ * @returns {Array<{type: ArchitectureType, name: string, description: string}>}
590
567
  */
591
568
  getArchitectureTypes(): Array<{
592
569
  type: ArchitectureType;
@@ -594,7 +571,12 @@ declare class Scaffold {
594
571
  description: string;
595
572
  }>;
596
573
  /**
597
- * Create a new project scaffold.
574
+ * Orchestrates the complete project generation lifecycle.
575
+ * This includes directory creation, file layout, profile resolution,
576
+ * dependency mapping, and optional post-install hooks.
577
+ *
578
+ * @param {ScaffoldOptions} options - Detailed configuration for the new project.
579
+ * @returns {Promise<ScaffoldResult>}
598
580
  */
599
581
  create(options: ScaffoldOptions): Promise<ScaffoldResult>;
600
582
  /**