@gravito/scaffold 1.1.0 → 2.1.0
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.cjs +155 -2
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +155 -2
- package/package.json +1 -1
- package/templates/skills/SKILLS_USAGE.md +54 -0
- package/templates/skills/adr-scaffold/SKILL.md +67 -0
- package/templates/skills/adr-scaffold/assets/.keep +0 -0
- package/templates/skills/adr-scaffold/references/.keep +0 -0
- package/templates/skills/adr-scaffold/references/adr-rules.md +29 -0
- package/templates/skills/adr-scaffold/scripts/.keep +0 -0
- package/templates/skills/architecture-refiner/SKILL.md +28 -0
- package/templates/skills/architecture-refiner/assets/.keep +0 -0
- package/templates/skills/architecture-refiner/references/.keep +0 -0
- package/templates/skills/architecture-refiner/scripts/.keep +0 -0
- package/templates/skills/atlas-expert/SKILL.md +34 -0
- package/templates/skills/atlas-expert/assets/.keep +0 -0
- package/templates/skills/atlas-expert/references/.keep +0 -0
- package/templates/skills/atlas-expert/references/decorators.md +24 -0
- package/templates/skills/atlas-expert/scripts/.keep +0 -0
- package/templates/skills/clean-architect/SKILL.md +63 -0
- package/templates/skills/clean-architect/assets/.keep +0 -0
- package/templates/skills/clean-architect/references/.keep +0 -0
- package/templates/skills/clean-architect/scripts/.keep +0 -0
- package/templates/skills/cms-engine/SKILL.md +54 -0
- package/templates/skills/cms-engine/assets/.keep +0 -0
- package/templates/skills/cms-engine/references/.keep +0 -0
- package/templates/skills/cms-engine/scripts/.keep +0 -0
- package/templates/skills/commerce-blueprint/SKILL.md +53 -0
- package/templates/skills/commerce-blueprint/assets/.keep +0 -0
- package/templates/skills/commerce-blueprint/references/.keep +0 -0
- package/templates/skills/commerce-blueprint/scripts/.keep +0 -0
- package/templates/skills/ddd-domain-expert/SKILL.md +71 -0
- package/templates/skills/ddd-domain-expert/assets/.keep +0 -0
- package/templates/skills/ddd-domain-expert/references/.keep +0 -0
- package/templates/skills/ddd-domain-expert/scripts/.keep +0 -0
- package/templates/skills/fortify-security/SKILL.md +28 -0
- package/templates/skills/fortify-security/assets/.keep +0 -0
- package/templates/skills/fortify-security/references/.keep +0 -0
- package/templates/skills/fortify-security/scripts/.keep +0 -0
- package/templates/skills/freeze-static/SKILL.md +55 -0
- package/templates/skills/freeze-static/assets/.keep +0 -0
- package/templates/skills/freeze-static/references/.keep +0 -0
- package/templates/skills/freeze-static/scripts/.keep +0 -0
- package/templates/skills/identity-hub/SKILL.md +51 -0
- package/templates/skills/identity-hub/assets/.keep +0 -0
- package/templates/skills/identity-hub/references/.keep +0 -0
- package/templates/skills/identity-hub/scripts/.keep +0 -0
- package/templates/skills/localization-linguist/SKILL.md +28 -0
- package/templates/skills/localization-linguist/assets/.keep +0 -0
- package/templates/skills/localization-linguist/references/.keep +0 -0
- package/templates/skills/localization-linguist/scripts/.keep +0 -0
- package/templates/skills/migration-master/SKILL.md +28 -0
- package/templates/skills/migration-master/assets/.keep +0 -0
- package/templates/skills/migration-master/references/.keep +0 -0
- package/templates/skills/migration-master/scripts/.keep +0 -0
- package/templates/skills/mvc-master/SKILL.md +88 -0
- package/templates/skills/mvc-master/assets/.keep +0 -0
- package/templates/skills/mvc-master/references/.keep +0 -0
- package/templates/skills/mvc-master/scripts/.keep +0 -0
- package/templates/skills/ops-commander/SKILL.md +28 -0
- package/templates/skills/ops-commander/assets/.keep +0 -0
- package/templates/skills/ops-commander/references/.keep +0 -0
- package/templates/skills/ops-commander/scripts/.keep +0 -0
- package/templates/skills/performance-tuner/SKILL.md +28 -0
- package/templates/skills/performance-tuner/assets/.keep +0 -0
- package/templates/skills/performance-tuner/references/.keep +0 -0
- package/templates/skills/performance-tuner/scripts/.keep +0 -0
- package/templates/skills/quasar-queue/SKILL.md +28 -0
- package/templates/skills/quasar-queue/assets/.keep +0 -0
- package/templates/skills/quasar-queue/references/.keep +0 -0
- package/templates/skills/quasar-queue/scripts/.keep +0 -0
- package/templates/skills/satellites-pilot/SKILL.md +27 -0
- package/templates/skills/satellites-pilot/assets/.keep +0 -0
- package/templates/skills/satellites-pilot/references/.keep +0 -0
- package/templates/skills/satellites-pilot/scripts/.keep +0 -0
- package/templates/skills/test-guardian/SKILL.md +28 -0
- package/templates/skills/test-guardian/assets/.keep +0 -0
- package/templates/skills/test-guardian/references/.keep +0 -0
- package/templates/skills/test-guardian/scripts/.keep +0 -0
- package/templates/skills/zenith-ui/SKILL.md +29 -0
- package/templates/skills/zenith-ui/assets/.keep +0 -0
- package/templates/skills/zenith-ui/references/.keep +0 -0
- package/templates/skills/zenith-ui/scripts/.keep +0 -0
package/dist/index.cjs
CHANGED
|
@@ -393,6 +393,30 @@ var BaseGenerator = class {
|
|
|
393
393
|
this.generateArchitectureDoc(context)
|
|
394
394
|
);
|
|
395
395
|
await this.generateCheckScripts(context);
|
|
396
|
+
await this.generateSkills(context);
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Copy AI Skills to the project
|
|
400
|
+
*/
|
|
401
|
+
async generateSkills(context) {
|
|
402
|
+
const skillsDir = import_node_path2.default.resolve(this.config.templatesDir, "skills");
|
|
403
|
+
const targetSkillsDir = import_node_path2.default.join(".skills");
|
|
404
|
+
try {
|
|
405
|
+
await import_promises2.default.access(skillsDir);
|
|
406
|
+
} catch {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
const files = await walk(skillsDir);
|
|
410
|
+
for (const filePath of files) {
|
|
411
|
+
const relativePath = import_node_path2.default.relative(skillsDir, filePath);
|
|
412
|
+
const targetPath = import_node_path2.default.join(targetSkillsDir, relativePath);
|
|
413
|
+
let content = await import_promises2.default.readFile(filePath, "utf-8");
|
|
414
|
+
try {
|
|
415
|
+
content = this.stubGenerator.render(content, context);
|
|
416
|
+
} catch {
|
|
417
|
+
}
|
|
418
|
+
await this.writeFile(context.targetDir, targetPath, content);
|
|
419
|
+
}
|
|
396
420
|
}
|
|
397
421
|
/**
|
|
398
422
|
* Apply profile-specific overlays
|
|
@@ -2694,6 +2718,8 @@ export class ${name}ServiceProvider extends ServiceProvider {
|
|
|
2694
2718
|
return `export default {
|
|
2695
2719
|
name: process.env.APP_NAME ?? '${context.name}',
|
|
2696
2720
|
env: process.env.APP_ENV ?? 'development',
|
|
2721
|
+
port: Number.parseInt(process.env.PORT ?? '3000', 10),
|
|
2722
|
+
VIEW_DIR: process.env.VIEW_DIR ?? 'src/views',
|
|
2697
2723
|
debug: process.env.APP_DEBUG === 'true',
|
|
2698
2724
|
url: process.env.APP_URL ?? 'http://localhost:3000',
|
|
2699
2725
|
}
|
|
@@ -3350,6 +3376,16 @@ export default {
|
|
|
3350
3376
|
*/
|
|
3351
3377
|
env: process.env.APP_ENV ?? 'development',
|
|
3352
3378
|
|
|
3379
|
+
/**
|
|
3380
|
+
* Application port
|
|
3381
|
+
*/
|
|
3382
|
+
port: Number.parseInt(process.env.PORT ?? '3000', 10),
|
|
3383
|
+
|
|
3384
|
+
/**
|
|
3385
|
+
* View directory
|
|
3386
|
+
*/
|
|
3387
|
+
VIEW_DIR: process.env.VIEW_DIR ?? 'src/views',
|
|
3388
|
+
|
|
3353
3389
|
/**
|
|
3354
3390
|
* Debug mode
|
|
3355
3391
|
*/
|
|
@@ -3473,8 +3509,7 @@ export default {
|
|
|
3473
3509
|
*/
|
|
3474
3510
|
providers: {
|
|
3475
3511
|
users: {
|
|
3476
|
-
driver: '
|
|
3477
|
-
table: 'users',
|
|
3512
|
+
driver: 'callback', // Custom callback provider
|
|
3478
3513
|
},
|
|
3479
3514
|
},
|
|
3480
3515
|
}
|
|
@@ -4761,6 +4796,8 @@ var ActionDomainGenerator = class extends BaseGenerator {
|
|
|
4761
4796
|
return `export default {
|
|
4762
4797
|
name: process.env.APP_NAME ?? '${context.name}',
|
|
4763
4798
|
env: process.env.APP_ENV ?? 'development',
|
|
4799
|
+
port: Number.parseInt(process.env.PORT ?? '3000', 10),
|
|
4800
|
+
VIEW_DIR: process.env.VIEW_DIR ?? 'src/views',
|
|
4764
4801
|
debug: process.env.APP_DEBUG === 'true',
|
|
4765
4802
|
url: process.env.APP_URL ?? 'http://localhost:3000',
|
|
4766
4803
|
key: process.env.APP_KEY,
|
|
@@ -5094,6 +5131,115 @@ Created with \u2764\uFE0F using Gravito Framework
|
|
|
5094
5131
|
}
|
|
5095
5132
|
};
|
|
5096
5133
|
|
|
5134
|
+
// src/generators/StandaloneEngineGenerator.ts
|
|
5135
|
+
var StandaloneEngineGenerator = class extends BaseGenerator {
|
|
5136
|
+
get architectureType() {
|
|
5137
|
+
return "standalone-engine";
|
|
5138
|
+
}
|
|
5139
|
+
get displayName() {
|
|
5140
|
+
return "Standalone Engine";
|
|
5141
|
+
}
|
|
5142
|
+
get description() {
|
|
5143
|
+
return "High-performance pure Gravito Engine (minimal)";
|
|
5144
|
+
}
|
|
5145
|
+
getDirectoryStructure(context) {
|
|
5146
|
+
return [
|
|
5147
|
+
{
|
|
5148
|
+
type: "directory",
|
|
5149
|
+
name: "src",
|
|
5150
|
+
children: [
|
|
5151
|
+
{
|
|
5152
|
+
type: "file",
|
|
5153
|
+
name: "index.ts",
|
|
5154
|
+
content: this.getIndexContent()
|
|
5155
|
+
}
|
|
5156
|
+
]
|
|
5157
|
+
},
|
|
5158
|
+
{
|
|
5159
|
+
type: "file",
|
|
5160
|
+
name: "README.md",
|
|
5161
|
+
content: this.getReadmeContent(context)
|
|
5162
|
+
}
|
|
5163
|
+
];
|
|
5164
|
+
}
|
|
5165
|
+
async generateCommonFiles(context) {
|
|
5166
|
+
await this.writeFile(context.targetDir, "package.json", this.generatePackageJson(context));
|
|
5167
|
+
await this.writeFile(context.targetDir, "tsconfig.json", this.generateTsConfig());
|
|
5168
|
+
await this.writeFile(context.targetDir, ".gitignore", this.generateGitignore());
|
|
5169
|
+
}
|
|
5170
|
+
generatePackageJson(context) {
|
|
5171
|
+
const pkg = {
|
|
5172
|
+
name: context.nameKebabCase,
|
|
5173
|
+
version: "0.1.0",
|
|
5174
|
+
type: "module",
|
|
5175
|
+
scripts: {
|
|
5176
|
+
dev: "bun run --watch src/index.ts",
|
|
5177
|
+
build: "bun build ./src/index.ts --outdir ./dist --target bun",
|
|
5178
|
+
start: "bun run dist/index.js",
|
|
5179
|
+
test: "bun test"
|
|
5180
|
+
},
|
|
5181
|
+
dependencies: {
|
|
5182
|
+
"@gravito/core": "^1.1.0"
|
|
5183
|
+
},
|
|
5184
|
+
devDependencies: {
|
|
5185
|
+
"bun-types": "latest",
|
|
5186
|
+
typescript: "^5.0.0"
|
|
5187
|
+
}
|
|
5188
|
+
};
|
|
5189
|
+
return JSON.stringify(pkg, null, 2);
|
|
5190
|
+
}
|
|
5191
|
+
generateArchitectureDoc(_context) {
|
|
5192
|
+
return "";
|
|
5193
|
+
}
|
|
5194
|
+
getIndexContent() {
|
|
5195
|
+
return `import { Gravito } from '@gravito/core/engine'
|
|
5196
|
+
|
|
5197
|
+
const app = new Gravito()
|
|
5198
|
+
|
|
5199
|
+
// Basic Route
|
|
5200
|
+
app.get('/', (c) => c.text('Hello Gravito Engine!'))
|
|
5201
|
+
|
|
5202
|
+
// JSON Response
|
|
5203
|
+
app.get('/json', (c) => c.json({ message: 'High Performance' }))
|
|
5204
|
+
|
|
5205
|
+
// Path Parameters
|
|
5206
|
+
app.get('/user/:name', (c) => {
|
|
5207
|
+
const name = c.req.param('name')
|
|
5208
|
+
return c.text(\`Hello \${name}\`)
|
|
5209
|
+
})
|
|
5210
|
+
|
|
5211
|
+
export default app
|
|
5212
|
+
`;
|
|
5213
|
+
}
|
|
5214
|
+
getReadmeContent(context) {
|
|
5215
|
+
return `# ${context.name}
|
|
5216
|
+
|
|
5217
|
+
A high-performance web application powered by Gravito Engine.
|
|
5218
|
+
|
|
5219
|
+
## Getting Started
|
|
5220
|
+
|
|
5221
|
+
### Install Dependencies
|
|
5222
|
+
|
|
5223
|
+
\`\`\`bash
|
|
5224
|
+
bun install
|
|
5225
|
+
\`\`\`
|
|
5226
|
+
|
|
5227
|
+
### Run Development Server
|
|
5228
|
+
|
|
5229
|
+
\`\`\`bash
|
|
5230
|
+
bun run dev
|
|
5231
|
+
\`\`\`
|
|
5232
|
+
|
|
5233
|
+
### Production Build
|
|
5234
|
+
|
|
5235
|
+
\`\`\`bash
|
|
5236
|
+
bun run build
|
|
5237
|
+
bun start
|
|
5238
|
+
\`\`\`
|
|
5239
|
+
`;
|
|
5240
|
+
}
|
|
5241
|
+
};
|
|
5242
|
+
|
|
5097
5243
|
// src/Scaffold.ts
|
|
5098
5244
|
var Scaffold = class {
|
|
5099
5245
|
templatesDir;
|
|
@@ -5127,6 +5273,11 @@ var Scaffold = class {
|
|
|
5127
5273
|
name: "Action Domain",
|
|
5128
5274
|
description: "Single Action Controllers pattern for high-clarity APIs"
|
|
5129
5275
|
},
|
|
5276
|
+
{
|
|
5277
|
+
type: "standalone-engine",
|
|
5278
|
+
name: "Standalone Engine",
|
|
5279
|
+
description: "High-performance pure Gravito Engine (minimal)"
|
|
5280
|
+
},
|
|
5130
5281
|
{
|
|
5131
5282
|
type: "satellite",
|
|
5132
5283
|
name: "Gravito Satellite",
|
|
@@ -5202,6 +5353,8 @@ var Scaffold = class {
|
|
|
5202
5353
|
return new ActionDomainGenerator(config);
|
|
5203
5354
|
case "satellite":
|
|
5204
5355
|
return new SatelliteGenerator(config);
|
|
5356
|
+
case "standalone-engine":
|
|
5357
|
+
return new StandaloneEngineGenerator(config);
|
|
5205
5358
|
default:
|
|
5206
5359
|
throw new Error(`Unknown architecture type: ${type}`);
|
|
5207
5360
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -47,7 +47,7 @@ declare class FileMerger {
|
|
|
47
47
|
/**
|
|
48
48
|
* Architecture types supported by the scaffolding system.
|
|
49
49
|
*/
|
|
50
|
-
type ArchitectureType = 'enterprise-mvc' | 'clean' | 'ddd' | 'satellite' | 'action-domain';
|
|
50
|
+
type ArchitectureType = 'enterprise-mvc' | 'clean' | 'ddd' | 'satellite' | 'action-domain' | 'standalone-engine';
|
|
51
51
|
/**
|
|
52
52
|
* Options for scaffolding a new project.
|
|
53
53
|
*/
|
|
@@ -319,6 +319,10 @@ declare abstract class BaseGenerator {
|
|
|
319
319
|
* Generate common files (package.json, .env, etc.)
|
|
320
320
|
*/
|
|
321
321
|
protected generateCommonFiles(context: GeneratorContext): Promise<void>;
|
|
322
|
+
/**
|
|
323
|
+
* Copy AI Skills to the project
|
|
324
|
+
*/
|
|
325
|
+
protected generateSkills(context: GeneratorContext): Promise<void>;
|
|
322
326
|
/**
|
|
323
327
|
* Apply profile-specific overlays
|
|
324
328
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ declare class FileMerger {
|
|
|
47
47
|
/**
|
|
48
48
|
* Architecture types supported by the scaffolding system.
|
|
49
49
|
*/
|
|
50
|
-
type ArchitectureType = 'enterprise-mvc' | 'clean' | 'ddd' | 'satellite' | 'action-domain';
|
|
50
|
+
type ArchitectureType = 'enterprise-mvc' | 'clean' | 'ddd' | 'satellite' | 'action-domain' | 'standalone-engine';
|
|
51
51
|
/**
|
|
52
52
|
* Options for scaffolding a new project.
|
|
53
53
|
*/
|
|
@@ -319,6 +319,10 @@ declare abstract class BaseGenerator {
|
|
|
319
319
|
* Generate common files (package.json, .env, etc.)
|
|
320
320
|
*/
|
|
321
321
|
protected generateCommonFiles(context: GeneratorContext): Promise<void>;
|
|
322
|
+
/**
|
|
323
|
+
* Copy AI Skills to the project
|
|
324
|
+
*/
|
|
325
|
+
protected generateSkills(context: GeneratorContext): Promise<void>;
|
|
322
326
|
/**
|
|
323
327
|
* Apply profile-specific overlays
|
|
324
328
|
*/
|
package/dist/index.js
CHANGED
|
@@ -347,6 +347,30 @@ var BaseGenerator = class {
|
|
|
347
347
|
this.generateArchitectureDoc(context)
|
|
348
348
|
);
|
|
349
349
|
await this.generateCheckScripts(context);
|
|
350
|
+
await this.generateSkills(context);
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Copy AI Skills to the project
|
|
354
|
+
*/
|
|
355
|
+
async generateSkills(context) {
|
|
356
|
+
const skillsDir = path2.resolve(this.config.templatesDir, "skills");
|
|
357
|
+
const targetSkillsDir = path2.join(".skills");
|
|
358
|
+
try {
|
|
359
|
+
await fs2.access(skillsDir);
|
|
360
|
+
} catch {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
const files = await walk(skillsDir);
|
|
364
|
+
for (const filePath of files) {
|
|
365
|
+
const relativePath = path2.relative(skillsDir, filePath);
|
|
366
|
+
const targetPath = path2.join(targetSkillsDir, relativePath);
|
|
367
|
+
let content = await fs2.readFile(filePath, "utf-8");
|
|
368
|
+
try {
|
|
369
|
+
content = this.stubGenerator.render(content, context);
|
|
370
|
+
} catch {
|
|
371
|
+
}
|
|
372
|
+
await this.writeFile(context.targetDir, targetPath, content);
|
|
373
|
+
}
|
|
350
374
|
}
|
|
351
375
|
/**
|
|
352
376
|
* Apply profile-specific overlays
|
|
@@ -2648,6 +2672,8 @@ export class ${name}ServiceProvider extends ServiceProvider {
|
|
|
2648
2672
|
return `export default {
|
|
2649
2673
|
name: process.env.APP_NAME ?? '${context.name}',
|
|
2650
2674
|
env: process.env.APP_ENV ?? 'development',
|
|
2675
|
+
port: Number.parseInt(process.env.PORT ?? '3000', 10),
|
|
2676
|
+
VIEW_DIR: process.env.VIEW_DIR ?? 'src/views',
|
|
2651
2677
|
debug: process.env.APP_DEBUG === 'true',
|
|
2652
2678
|
url: process.env.APP_URL ?? 'http://localhost:3000',
|
|
2653
2679
|
}
|
|
@@ -3304,6 +3330,16 @@ export default {
|
|
|
3304
3330
|
*/
|
|
3305
3331
|
env: process.env.APP_ENV ?? 'development',
|
|
3306
3332
|
|
|
3333
|
+
/**
|
|
3334
|
+
* Application port
|
|
3335
|
+
*/
|
|
3336
|
+
port: Number.parseInt(process.env.PORT ?? '3000', 10),
|
|
3337
|
+
|
|
3338
|
+
/**
|
|
3339
|
+
* View directory
|
|
3340
|
+
*/
|
|
3341
|
+
VIEW_DIR: process.env.VIEW_DIR ?? 'src/views',
|
|
3342
|
+
|
|
3307
3343
|
/**
|
|
3308
3344
|
* Debug mode
|
|
3309
3345
|
*/
|
|
@@ -3427,8 +3463,7 @@ export default {
|
|
|
3427
3463
|
*/
|
|
3428
3464
|
providers: {
|
|
3429
3465
|
users: {
|
|
3430
|
-
driver: '
|
|
3431
|
-
table: 'users',
|
|
3466
|
+
driver: 'callback', // Custom callback provider
|
|
3432
3467
|
},
|
|
3433
3468
|
},
|
|
3434
3469
|
}
|
|
@@ -4715,6 +4750,8 @@ var ActionDomainGenerator = class extends BaseGenerator {
|
|
|
4715
4750
|
return `export default {
|
|
4716
4751
|
name: process.env.APP_NAME ?? '${context.name}',
|
|
4717
4752
|
env: process.env.APP_ENV ?? 'development',
|
|
4753
|
+
port: Number.parseInt(process.env.PORT ?? '3000', 10),
|
|
4754
|
+
VIEW_DIR: process.env.VIEW_DIR ?? 'src/views',
|
|
4718
4755
|
debug: process.env.APP_DEBUG === 'true',
|
|
4719
4756
|
url: process.env.APP_URL ?? 'http://localhost:3000',
|
|
4720
4757
|
key: process.env.APP_KEY,
|
|
@@ -5048,6 +5085,115 @@ Created with \u2764\uFE0F using Gravito Framework
|
|
|
5048
5085
|
}
|
|
5049
5086
|
};
|
|
5050
5087
|
|
|
5088
|
+
// src/generators/StandaloneEngineGenerator.ts
|
|
5089
|
+
var StandaloneEngineGenerator = class extends BaseGenerator {
|
|
5090
|
+
get architectureType() {
|
|
5091
|
+
return "standalone-engine";
|
|
5092
|
+
}
|
|
5093
|
+
get displayName() {
|
|
5094
|
+
return "Standalone Engine";
|
|
5095
|
+
}
|
|
5096
|
+
get description() {
|
|
5097
|
+
return "High-performance pure Gravito Engine (minimal)";
|
|
5098
|
+
}
|
|
5099
|
+
getDirectoryStructure(context) {
|
|
5100
|
+
return [
|
|
5101
|
+
{
|
|
5102
|
+
type: "directory",
|
|
5103
|
+
name: "src",
|
|
5104
|
+
children: [
|
|
5105
|
+
{
|
|
5106
|
+
type: "file",
|
|
5107
|
+
name: "index.ts",
|
|
5108
|
+
content: this.getIndexContent()
|
|
5109
|
+
}
|
|
5110
|
+
]
|
|
5111
|
+
},
|
|
5112
|
+
{
|
|
5113
|
+
type: "file",
|
|
5114
|
+
name: "README.md",
|
|
5115
|
+
content: this.getReadmeContent(context)
|
|
5116
|
+
}
|
|
5117
|
+
];
|
|
5118
|
+
}
|
|
5119
|
+
async generateCommonFiles(context) {
|
|
5120
|
+
await this.writeFile(context.targetDir, "package.json", this.generatePackageJson(context));
|
|
5121
|
+
await this.writeFile(context.targetDir, "tsconfig.json", this.generateTsConfig());
|
|
5122
|
+
await this.writeFile(context.targetDir, ".gitignore", this.generateGitignore());
|
|
5123
|
+
}
|
|
5124
|
+
generatePackageJson(context) {
|
|
5125
|
+
const pkg = {
|
|
5126
|
+
name: context.nameKebabCase,
|
|
5127
|
+
version: "0.1.0",
|
|
5128
|
+
type: "module",
|
|
5129
|
+
scripts: {
|
|
5130
|
+
dev: "bun run --watch src/index.ts",
|
|
5131
|
+
build: "bun build ./src/index.ts --outdir ./dist --target bun",
|
|
5132
|
+
start: "bun run dist/index.js",
|
|
5133
|
+
test: "bun test"
|
|
5134
|
+
},
|
|
5135
|
+
dependencies: {
|
|
5136
|
+
"@gravito/core": "^1.1.0"
|
|
5137
|
+
},
|
|
5138
|
+
devDependencies: {
|
|
5139
|
+
"bun-types": "latest",
|
|
5140
|
+
typescript: "^5.0.0"
|
|
5141
|
+
}
|
|
5142
|
+
};
|
|
5143
|
+
return JSON.stringify(pkg, null, 2);
|
|
5144
|
+
}
|
|
5145
|
+
generateArchitectureDoc(_context) {
|
|
5146
|
+
return "";
|
|
5147
|
+
}
|
|
5148
|
+
getIndexContent() {
|
|
5149
|
+
return `import { Gravito } from '@gravito/core/engine'
|
|
5150
|
+
|
|
5151
|
+
const app = new Gravito()
|
|
5152
|
+
|
|
5153
|
+
// Basic Route
|
|
5154
|
+
app.get('/', (c) => c.text('Hello Gravito Engine!'))
|
|
5155
|
+
|
|
5156
|
+
// JSON Response
|
|
5157
|
+
app.get('/json', (c) => c.json({ message: 'High Performance' }))
|
|
5158
|
+
|
|
5159
|
+
// Path Parameters
|
|
5160
|
+
app.get('/user/:name', (c) => {
|
|
5161
|
+
const name = c.req.param('name')
|
|
5162
|
+
return c.text(\`Hello \${name}\`)
|
|
5163
|
+
})
|
|
5164
|
+
|
|
5165
|
+
export default app
|
|
5166
|
+
`;
|
|
5167
|
+
}
|
|
5168
|
+
getReadmeContent(context) {
|
|
5169
|
+
return `# ${context.name}
|
|
5170
|
+
|
|
5171
|
+
A high-performance web application powered by Gravito Engine.
|
|
5172
|
+
|
|
5173
|
+
## Getting Started
|
|
5174
|
+
|
|
5175
|
+
### Install Dependencies
|
|
5176
|
+
|
|
5177
|
+
\`\`\`bash
|
|
5178
|
+
bun install
|
|
5179
|
+
\`\`\`
|
|
5180
|
+
|
|
5181
|
+
### Run Development Server
|
|
5182
|
+
|
|
5183
|
+
\`\`\`bash
|
|
5184
|
+
bun run dev
|
|
5185
|
+
\`\`\`
|
|
5186
|
+
|
|
5187
|
+
### Production Build
|
|
5188
|
+
|
|
5189
|
+
\`\`\`bash
|
|
5190
|
+
bun run build
|
|
5191
|
+
bun start
|
|
5192
|
+
\`\`\`
|
|
5193
|
+
`;
|
|
5194
|
+
}
|
|
5195
|
+
};
|
|
5196
|
+
|
|
5051
5197
|
// src/Scaffold.ts
|
|
5052
5198
|
var Scaffold = class {
|
|
5053
5199
|
templatesDir;
|
|
@@ -5081,6 +5227,11 @@ var Scaffold = class {
|
|
|
5081
5227
|
name: "Action Domain",
|
|
5082
5228
|
description: "Single Action Controllers pattern for high-clarity APIs"
|
|
5083
5229
|
},
|
|
5230
|
+
{
|
|
5231
|
+
type: "standalone-engine",
|
|
5232
|
+
name: "Standalone Engine",
|
|
5233
|
+
description: "High-performance pure Gravito Engine (minimal)"
|
|
5234
|
+
},
|
|
5084
5235
|
{
|
|
5085
5236
|
type: "satellite",
|
|
5086
5237
|
name: "Gravito Satellite",
|
|
@@ -5156,6 +5307,8 @@ var Scaffold = class {
|
|
|
5156
5307
|
return new ActionDomainGenerator(config);
|
|
5157
5308
|
case "satellite":
|
|
5158
5309
|
return new SatelliteGenerator(config);
|
|
5310
|
+
case "standalone-engine":
|
|
5311
|
+
return new StandaloneEngineGenerator(config);
|
|
5159
5312
|
default:
|
|
5160
5313
|
throw new Error(`Unknown architecture type: ${type}`);
|
|
5161
5314
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# 🎓 Gravito Skills: Usage Guide
|
|
2
|
+
|
|
3
|
+
Welcome to the Gravito Skills ecosystem. These are specialized "onboarding modules" designed to help AI agents (like Antigravity or Claude) and developers build high-quality software using Gravito's best practices.
|
|
4
|
+
|
|
5
|
+
## 🧠 The Concept: Skill Summoning
|
|
6
|
+
|
|
7
|
+
A "Skill" is a set of rules, blueprints, and SOPs. You don't just "read" them; you **summon** them to perform a task.
|
|
8
|
+
|
|
9
|
+
### How to use with AI Agents
|
|
10
|
+
When you are working with an AI agent, you can explicitly tell it which skills to apply.
|
|
11
|
+
|
|
12
|
+
**Example Prompts:**
|
|
13
|
+
- *"Antigravity, use `mvc-master` and `commerce-blueprint` to implement a shopping cart."*
|
|
14
|
+
- *"Use `adr-scaffold` and `identity-hub` to build a new user registration flow."*
|
|
15
|
+
- *"Follow `clean-architect` to refactor my domain logic."*
|
|
16
|
+
|
|
17
|
+
## 🏗️ Skill Composition: Horizontal + Vertical
|
|
18
|
+
|
|
19
|
+
To handle complexity, we use a modular composition strategy:
|
|
20
|
+
|
|
21
|
+
| Skill Type | Purpose | Example |
|
|
22
|
+
| :--- | :--- | :--- |
|
|
23
|
+
| **Horizontal (Architecture)** | Defines **where** the code goes (Structure). | `mvc-master`, `adr-scaffold`, `clean-architect` |
|
|
24
|
+
| **Vertical (Domain)** | Defines **what** the code does (Business Logic). | `commerce-blueprint`, `identity-hub`, `cms-engine` |
|
|
25
|
+
|
|
26
|
+
### 🚀 Standard Workflow
|
|
27
|
+
If you have just scaffolded an MVC project and want to develop a shopping cart:
|
|
28
|
+
|
|
29
|
+
1. **Architecture Initialization**: You already have the MVC structure.
|
|
30
|
+
2. **Summon Domain Skill**: Ask the agent to apply `commerce-blueprint`.
|
|
31
|
+
3. **Cross-Reference**: The agent will look at `mvc-master` for file locations (Controllers in `src/Http/Controllers`) and `commerce-blueprint` for business rules (Price snapshots, State machines).
|
|
32
|
+
|
|
33
|
+
## 🛠️ List of Available Skills
|
|
34
|
+
|
|
35
|
+
### Architecture (Horizontal)
|
|
36
|
+
- `mvc-master`: Enterprise Model-View-Controller.
|
|
37
|
+
- `adr-scaffold`: Action-Domain-Responder pattern.
|
|
38
|
+
- `clean-architect`: Pure Domain & Use Case isolation.
|
|
39
|
+
- `ddd-domain-expert`: Aggregate Roots & Bounded Contexts.
|
|
40
|
+
- `freeze-static`: Static Site Generation (SSG).
|
|
41
|
+
|
|
42
|
+
### Domain (Vertical)
|
|
43
|
+
- `commerce-blueprint`: Cart, Checkout, SKU management.
|
|
44
|
+
- `identity-hub`: Auth, RBAC, Multi-tenancy.
|
|
45
|
+
- `cms-engine`: Publishing workflows, Blogs, Media.
|
|
46
|
+
|
|
47
|
+
### Operations & Quality
|
|
48
|
+
- `fortify-security`: CSP, Security Headers, Auth middleware.
|
|
49
|
+
- `test-guardian`: Testing strategies (Unit, E2E).
|
|
50
|
+
- `ops-commander`: Docker, CI/CD, Fly.io.
|
|
51
|
+
- `performance-tuner`: Caching, DB indexing, Optimization.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
Created by Antigravity for the Gravito Framework.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: adr-scaffold
|
|
3
|
+
description: Specializes in generating Action-Domain-Responder (ADR) boilerplate for Gravito projects. Trigger this when adding new features or modules using the ADR pattern.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ADR Scaffold Expert
|
|
7
|
+
|
|
8
|
+
You are a Gravito Architect specialized in the Action-Domain-Responder pattern. Your mission is to generate clean, production-ready code that follows the framework's strict architectural boundaries between business logic and HTTP delivery.
|
|
9
|
+
|
|
10
|
+
## 🏢 Directory Structure (The "ADR Standard")
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
src/
|
|
14
|
+
├── actions/ # Domain Layer: Business Logic (Actions)
|
|
15
|
+
│ ├── Action.ts # Base Action class
|
|
16
|
+
│ └── [Domain]/ # Domain-specific actions
|
|
17
|
+
├── controllers/ # Responder Layer: HTTP Handlers
|
|
18
|
+
│ └── api/v1/ # API Controllers (Thin)
|
|
19
|
+
├── models/ # Domain: Atlas Models
|
|
20
|
+
├── repositories/ # Domain: Data Access
|
|
21
|
+
├── types/ # Contracts
|
|
22
|
+
│ ├── requests/ # Typed request bodies
|
|
23
|
+
│ └── responses/ # Typed response bodies
|
|
24
|
+
└── routes/ # Route Definitions
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 📜 Layer Rules
|
|
28
|
+
|
|
29
|
+
### 1. Actions (`src/actions/`)
|
|
30
|
+
- **Rule**: Every business operation is a single `Action` class.
|
|
31
|
+
- **Task**: Implement the `execute` method. Actions should be framework-agnostic.
|
|
32
|
+
- **SOP**: Use `DB.transaction` inside actions for multi-row operations.
|
|
33
|
+
|
|
34
|
+
### 2. Controllers (`src/controllers/`)
|
|
35
|
+
- **Rule**: Thin Responder Layer. NO business logic.
|
|
36
|
+
- **Task**: Parse params -> Call Action -> Return formatted JSON.
|
|
37
|
+
|
|
38
|
+
## 🏗️ Code Blueprints
|
|
39
|
+
|
|
40
|
+
### Base Action
|
|
41
|
+
```typescript
|
|
42
|
+
export abstract class Action<TInput = unknown, TOutput = unknown> {
|
|
43
|
+
abstract execute(input: TInput): Promise<TOutput> | TOutput
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Typical Action Implementation
|
|
48
|
+
```typescript
|
|
49
|
+
export class CreateOrderAction extends Action<OrderInput, OrderResponse> {
|
|
50
|
+
async execute(input: OrderInput) {
|
|
51
|
+
return await DB.transaction(async (trx) => {
|
|
52
|
+
// 1. Validate...
|
|
53
|
+
// 2. Persist...
|
|
54
|
+
// 3. Trigger events...
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## 🚀 Workflow (SOP)
|
|
61
|
+
|
|
62
|
+
1. **Entities**: Define the Atlas Model in `src/models/`.
|
|
63
|
+
2. **Persistence**: Build the Repository in `src/repositories/`.
|
|
64
|
+
3. **Contracts**: Define Request/Response types in `src/types/`.
|
|
65
|
+
4. **Logic**: Implement the Single Action in `src/actions/[Domain]/`.
|
|
66
|
+
5. **Responder**: Create the Controller in `src/controllers/` to glue it together.
|
|
67
|
+
6. **Routing**: Map the route in `src/routes/api.ts`.
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Gravito ADR Reference
|
|
2
|
+
|
|
3
|
+
## Component Rules
|
|
4
|
+
|
|
5
|
+
### 1. Models (Atlas)
|
|
6
|
+
- Location: `src/models/`
|
|
7
|
+
- Rules: Extend `Model`, define `static table`, use `@column`.
|
|
8
|
+
|
|
9
|
+
### 2. Repositories
|
|
10
|
+
- Location: `src/repositories/`
|
|
11
|
+
- Rules: Dedicated classes for DB access. No logic, only queries.
|
|
12
|
+
|
|
13
|
+
### 3. Actions
|
|
14
|
+
- Location: `src/actions/[Domain]/`
|
|
15
|
+
- Rules: Single Responsibility. One class per use case. Extend `Action<Input, Output>`.
|
|
16
|
+
|
|
17
|
+
### 4. Controllers
|
|
18
|
+
- Location: `src/controllers/api/v[N]/`
|
|
19
|
+
- Rules: Thin layer. Use `c.get('parsed_body')` for body caching.
|
|
20
|
+
|
|
21
|
+
## Directory Layout
|
|
22
|
+
```
|
|
23
|
+
src/
|
|
24
|
+
├── actions/
|
|
25
|
+
├── models/
|
|
26
|
+
├── repositories/
|
|
27
|
+
├── controllers/
|
|
28
|
+
└── routes/
|
|
29
|
+
```
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architecture-refiner
|
|
3
|
+
description: Expert in Gravito architecture and clean code. Trigger this for refactoring, design pattern implementation, or architectural audits.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Architecture Refiner
|
|
7
|
+
|
|
8
|
+
You are a lead architect dedicated to the "Singularity" principle. Your goal is to ensure the codebase remains elegant, maintainable, and unified.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
### 1. Audit
|
|
13
|
+
- Identify technical debt or architectural violations (e.g., logic in controllers).
|
|
14
|
+
- Review the modularity of the current implementation.
|
|
15
|
+
|
|
16
|
+
### 2. Refinement
|
|
17
|
+
1. **Decoupling**: Extract business logic into specialized `Actions`.
|
|
18
|
+
2. **Standardization**: Align code with the `GRAVITO_AGENT_GUIDE.md`.
|
|
19
|
+
3. **Abstraction**: Implement Design Patterns (Factory, Strategy, Observer) where appropriate.
|
|
20
|
+
|
|
21
|
+
### 3. Standards
|
|
22
|
+
- Follow the **Action-Domain-Responder** pattern strictly.
|
|
23
|
+
- Ensure **Zero-Ambiguity** in naming and structure.
|
|
24
|
+
- Adhere to the **Artisan's Apprentice** voice in internal documentation.
|
|
25
|
+
|
|
26
|
+
## Resources
|
|
27
|
+
- **References**: Pattern catalog for Gravito.
|
|
28
|
+
- **Assets**: Refactoring checklists.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|