@gravito/scaffold 1.1.0 → 2.0.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 +140 -0
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +140 -0
- 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
|
|
@@ -5094,6 +5118,115 @@ Created with \u2764\uFE0F using Gravito Framework
|
|
|
5094
5118
|
}
|
|
5095
5119
|
};
|
|
5096
5120
|
|
|
5121
|
+
// src/generators/StandaloneEngineGenerator.ts
|
|
5122
|
+
var StandaloneEngineGenerator = class extends BaseGenerator {
|
|
5123
|
+
get architectureType() {
|
|
5124
|
+
return "standalone-engine";
|
|
5125
|
+
}
|
|
5126
|
+
get displayName() {
|
|
5127
|
+
return "Standalone Engine";
|
|
5128
|
+
}
|
|
5129
|
+
get description() {
|
|
5130
|
+
return "High-performance pure Gravito Engine (minimal)";
|
|
5131
|
+
}
|
|
5132
|
+
getDirectoryStructure(context) {
|
|
5133
|
+
return [
|
|
5134
|
+
{
|
|
5135
|
+
type: "directory",
|
|
5136
|
+
name: "src",
|
|
5137
|
+
children: [
|
|
5138
|
+
{
|
|
5139
|
+
type: "file",
|
|
5140
|
+
name: "index.ts",
|
|
5141
|
+
content: this.getIndexContent()
|
|
5142
|
+
}
|
|
5143
|
+
]
|
|
5144
|
+
},
|
|
5145
|
+
{
|
|
5146
|
+
type: "file",
|
|
5147
|
+
name: "README.md",
|
|
5148
|
+
content: this.getReadmeContent(context)
|
|
5149
|
+
}
|
|
5150
|
+
];
|
|
5151
|
+
}
|
|
5152
|
+
async generateCommonFiles(context) {
|
|
5153
|
+
await this.writeFile(context.targetDir, "package.json", this.generatePackageJson(context));
|
|
5154
|
+
await this.writeFile(context.targetDir, "tsconfig.json", this.generateTsConfig());
|
|
5155
|
+
await this.writeFile(context.targetDir, ".gitignore", this.generateGitignore());
|
|
5156
|
+
}
|
|
5157
|
+
generatePackageJson(context) {
|
|
5158
|
+
const pkg = {
|
|
5159
|
+
name: context.nameKebabCase,
|
|
5160
|
+
version: "0.1.0",
|
|
5161
|
+
type: "module",
|
|
5162
|
+
scripts: {
|
|
5163
|
+
dev: "bun run --watch src/index.ts",
|
|
5164
|
+
build: "bun build ./src/index.ts --outdir ./dist --target bun",
|
|
5165
|
+
start: "bun run dist/index.js",
|
|
5166
|
+
test: "bun test"
|
|
5167
|
+
},
|
|
5168
|
+
dependencies: {
|
|
5169
|
+
"@gravito/core": "^1.1.0"
|
|
5170
|
+
},
|
|
5171
|
+
devDependencies: {
|
|
5172
|
+
"bun-types": "latest",
|
|
5173
|
+
typescript: "^5.0.0"
|
|
5174
|
+
}
|
|
5175
|
+
};
|
|
5176
|
+
return JSON.stringify(pkg, null, 2);
|
|
5177
|
+
}
|
|
5178
|
+
generateArchitectureDoc(_context) {
|
|
5179
|
+
return "";
|
|
5180
|
+
}
|
|
5181
|
+
getIndexContent() {
|
|
5182
|
+
return `import { Gravito } from '@gravito/core/engine'
|
|
5183
|
+
|
|
5184
|
+
const app = new Gravito()
|
|
5185
|
+
|
|
5186
|
+
// Basic Route
|
|
5187
|
+
app.get('/', (c) => c.text('Hello Gravito Engine!'))
|
|
5188
|
+
|
|
5189
|
+
// JSON Response
|
|
5190
|
+
app.get('/json', (c) => c.json({ message: 'High Performance' }))
|
|
5191
|
+
|
|
5192
|
+
// Path Parameters
|
|
5193
|
+
app.get('/user/:name', (c) => {
|
|
5194
|
+
const name = c.req.param('name')
|
|
5195
|
+
return c.text(\`Hello \${name}\`)
|
|
5196
|
+
})
|
|
5197
|
+
|
|
5198
|
+
export default app
|
|
5199
|
+
`;
|
|
5200
|
+
}
|
|
5201
|
+
getReadmeContent(context) {
|
|
5202
|
+
return `# ${context.name}
|
|
5203
|
+
|
|
5204
|
+
A high-performance web application powered by Gravito Engine.
|
|
5205
|
+
|
|
5206
|
+
## Getting Started
|
|
5207
|
+
|
|
5208
|
+
### Install Dependencies
|
|
5209
|
+
|
|
5210
|
+
\`\`\`bash
|
|
5211
|
+
bun install
|
|
5212
|
+
\`\`\`
|
|
5213
|
+
|
|
5214
|
+
### Run Development Server
|
|
5215
|
+
|
|
5216
|
+
\`\`\`bash
|
|
5217
|
+
bun run dev
|
|
5218
|
+
\`\`\`
|
|
5219
|
+
|
|
5220
|
+
### Production Build
|
|
5221
|
+
|
|
5222
|
+
\`\`\`bash
|
|
5223
|
+
bun run build
|
|
5224
|
+
bun start
|
|
5225
|
+
\`\`\`
|
|
5226
|
+
`;
|
|
5227
|
+
}
|
|
5228
|
+
};
|
|
5229
|
+
|
|
5097
5230
|
// src/Scaffold.ts
|
|
5098
5231
|
var Scaffold = class {
|
|
5099
5232
|
templatesDir;
|
|
@@ -5127,6 +5260,11 @@ var Scaffold = class {
|
|
|
5127
5260
|
name: "Action Domain",
|
|
5128
5261
|
description: "Single Action Controllers pattern for high-clarity APIs"
|
|
5129
5262
|
},
|
|
5263
|
+
{
|
|
5264
|
+
type: "standalone-engine",
|
|
5265
|
+
name: "Standalone Engine",
|
|
5266
|
+
description: "High-performance pure Gravito Engine (minimal)"
|
|
5267
|
+
},
|
|
5130
5268
|
{
|
|
5131
5269
|
type: "satellite",
|
|
5132
5270
|
name: "Gravito Satellite",
|
|
@@ -5202,6 +5340,8 @@ var Scaffold = class {
|
|
|
5202
5340
|
return new ActionDomainGenerator(config);
|
|
5203
5341
|
case "satellite":
|
|
5204
5342
|
return new SatelliteGenerator(config);
|
|
5343
|
+
case "standalone-engine":
|
|
5344
|
+
return new StandaloneEngineGenerator(config);
|
|
5205
5345
|
default:
|
|
5206
5346
|
throw new Error(`Unknown architecture type: ${type}`);
|
|
5207
5347
|
}
|
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
|
|
@@ -5048,6 +5072,115 @@ Created with \u2764\uFE0F using Gravito Framework
|
|
|
5048
5072
|
}
|
|
5049
5073
|
};
|
|
5050
5074
|
|
|
5075
|
+
// src/generators/StandaloneEngineGenerator.ts
|
|
5076
|
+
var StandaloneEngineGenerator = class extends BaseGenerator {
|
|
5077
|
+
get architectureType() {
|
|
5078
|
+
return "standalone-engine";
|
|
5079
|
+
}
|
|
5080
|
+
get displayName() {
|
|
5081
|
+
return "Standalone Engine";
|
|
5082
|
+
}
|
|
5083
|
+
get description() {
|
|
5084
|
+
return "High-performance pure Gravito Engine (minimal)";
|
|
5085
|
+
}
|
|
5086
|
+
getDirectoryStructure(context) {
|
|
5087
|
+
return [
|
|
5088
|
+
{
|
|
5089
|
+
type: "directory",
|
|
5090
|
+
name: "src",
|
|
5091
|
+
children: [
|
|
5092
|
+
{
|
|
5093
|
+
type: "file",
|
|
5094
|
+
name: "index.ts",
|
|
5095
|
+
content: this.getIndexContent()
|
|
5096
|
+
}
|
|
5097
|
+
]
|
|
5098
|
+
},
|
|
5099
|
+
{
|
|
5100
|
+
type: "file",
|
|
5101
|
+
name: "README.md",
|
|
5102
|
+
content: this.getReadmeContent(context)
|
|
5103
|
+
}
|
|
5104
|
+
];
|
|
5105
|
+
}
|
|
5106
|
+
async generateCommonFiles(context) {
|
|
5107
|
+
await this.writeFile(context.targetDir, "package.json", this.generatePackageJson(context));
|
|
5108
|
+
await this.writeFile(context.targetDir, "tsconfig.json", this.generateTsConfig());
|
|
5109
|
+
await this.writeFile(context.targetDir, ".gitignore", this.generateGitignore());
|
|
5110
|
+
}
|
|
5111
|
+
generatePackageJson(context) {
|
|
5112
|
+
const pkg = {
|
|
5113
|
+
name: context.nameKebabCase,
|
|
5114
|
+
version: "0.1.0",
|
|
5115
|
+
type: "module",
|
|
5116
|
+
scripts: {
|
|
5117
|
+
dev: "bun run --watch src/index.ts",
|
|
5118
|
+
build: "bun build ./src/index.ts --outdir ./dist --target bun",
|
|
5119
|
+
start: "bun run dist/index.js",
|
|
5120
|
+
test: "bun test"
|
|
5121
|
+
},
|
|
5122
|
+
dependencies: {
|
|
5123
|
+
"@gravito/core": "^1.1.0"
|
|
5124
|
+
},
|
|
5125
|
+
devDependencies: {
|
|
5126
|
+
"bun-types": "latest",
|
|
5127
|
+
typescript: "^5.0.0"
|
|
5128
|
+
}
|
|
5129
|
+
};
|
|
5130
|
+
return JSON.stringify(pkg, null, 2);
|
|
5131
|
+
}
|
|
5132
|
+
generateArchitectureDoc(_context) {
|
|
5133
|
+
return "";
|
|
5134
|
+
}
|
|
5135
|
+
getIndexContent() {
|
|
5136
|
+
return `import { Gravito } from '@gravito/core/engine'
|
|
5137
|
+
|
|
5138
|
+
const app = new Gravito()
|
|
5139
|
+
|
|
5140
|
+
// Basic Route
|
|
5141
|
+
app.get('/', (c) => c.text('Hello Gravito Engine!'))
|
|
5142
|
+
|
|
5143
|
+
// JSON Response
|
|
5144
|
+
app.get('/json', (c) => c.json({ message: 'High Performance' }))
|
|
5145
|
+
|
|
5146
|
+
// Path Parameters
|
|
5147
|
+
app.get('/user/:name', (c) => {
|
|
5148
|
+
const name = c.req.param('name')
|
|
5149
|
+
return c.text(\`Hello \${name}\`)
|
|
5150
|
+
})
|
|
5151
|
+
|
|
5152
|
+
export default app
|
|
5153
|
+
`;
|
|
5154
|
+
}
|
|
5155
|
+
getReadmeContent(context) {
|
|
5156
|
+
return `# ${context.name}
|
|
5157
|
+
|
|
5158
|
+
A high-performance web application powered by Gravito Engine.
|
|
5159
|
+
|
|
5160
|
+
## Getting Started
|
|
5161
|
+
|
|
5162
|
+
### Install Dependencies
|
|
5163
|
+
|
|
5164
|
+
\`\`\`bash
|
|
5165
|
+
bun install
|
|
5166
|
+
\`\`\`
|
|
5167
|
+
|
|
5168
|
+
### Run Development Server
|
|
5169
|
+
|
|
5170
|
+
\`\`\`bash
|
|
5171
|
+
bun run dev
|
|
5172
|
+
\`\`\`
|
|
5173
|
+
|
|
5174
|
+
### Production Build
|
|
5175
|
+
|
|
5176
|
+
\`\`\`bash
|
|
5177
|
+
bun run build
|
|
5178
|
+
bun start
|
|
5179
|
+
\`\`\`
|
|
5180
|
+
`;
|
|
5181
|
+
}
|
|
5182
|
+
};
|
|
5183
|
+
|
|
5051
5184
|
// src/Scaffold.ts
|
|
5052
5185
|
var Scaffold = class {
|
|
5053
5186
|
templatesDir;
|
|
@@ -5081,6 +5214,11 @@ var Scaffold = class {
|
|
|
5081
5214
|
name: "Action Domain",
|
|
5082
5215
|
description: "Single Action Controllers pattern for high-clarity APIs"
|
|
5083
5216
|
},
|
|
5217
|
+
{
|
|
5218
|
+
type: "standalone-engine",
|
|
5219
|
+
name: "Standalone Engine",
|
|
5220
|
+
description: "High-performance pure Gravito Engine (minimal)"
|
|
5221
|
+
},
|
|
5084
5222
|
{
|
|
5085
5223
|
type: "satellite",
|
|
5086
5224
|
name: "Gravito Satellite",
|
|
@@ -5156,6 +5294,8 @@ var Scaffold = class {
|
|
|
5156
5294
|
return new ActionDomainGenerator(config);
|
|
5157
5295
|
case "satellite":
|
|
5158
5296
|
return new SatelliteGenerator(config);
|
|
5297
|
+
case "standalone-engine":
|
|
5298
|
+
return new StandaloneEngineGenerator(config);
|
|
5159
5299
|
default:
|
|
5160
5300
|
throw new Error(`Unknown architecture type: ${type}`);
|
|
5161
5301
|
}
|
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
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: atlas-expert
|
|
3
|
+
description: Specialized in Atlas ORM and database design for Gravito. Trigger this for schema design, migrations, or complex query building.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Atlas ORM Expert
|
|
7
|
+
|
|
8
|
+
You are a database architect specialized in the Atlas ORM. Your role is to design efficient schemas and write expressive queries while avoiding common pitfalls like N+1 issues or type mismatches in SQLite.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
### 1. Schema Design
|
|
13
|
+
When asked to design a database:
|
|
14
|
+
- Identify entities and their attributes.
|
|
15
|
+
- Define primary keys and foreign keys.
|
|
16
|
+
- Choose appropriate TypeScript types for columns.
|
|
17
|
+
|
|
18
|
+
### 2. Relationship Mapping
|
|
19
|
+
- Map relationships using `@HasOne`, `@HasMany`, and `@BelongsTo`.
|
|
20
|
+
- Ensure foreign keys are defined in the database schema (via migrations).
|
|
21
|
+
|
|
22
|
+
### 3. Query Optimization
|
|
23
|
+
- Use `preload()` to avoid N+1 problems.
|
|
24
|
+
- Use `where()` and `first()` for efficient single-row lookups.
|
|
25
|
+
- Wrap modifications in `DB.transaction()`.
|
|
26
|
+
|
|
27
|
+
## SQLite Considerations
|
|
28
|
+
- SQLite is loosely typed. Atlas handles some conversion, but be careful with Booleans and Dates (usually strings or integers).
|
|
29
|
+
- Read `references/decorators.md` for the latest syntax.
|
|
30
|
+
|
|
31
|
+
## Implementation Steps
|
|
32
|
+
1. Plan the schema on paper/markdown.
|
|
33
|
+
2. Generate the Atlas Model class.
|
|
34
|
+
3. Generate the Migration script if needed.
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Atlas Decorators Cheat Sheet
|
|
2
|
+
|
|
3
|
+
| Decorator | Purpose | Usage |
|
|
4
|
+
|-----------|---------|-------|
|
|
5
|
+
| `@column({ isPrimary: true })` | Primary key | `@column({ isPrimary: true }) id!: number` |
|
|
6
|
+
| `@column()` | Standard database column | `@column() name!: string` |
|
|
7
|
+
| `@HasOne(() => Target)` | 1:1 relationship | `@HasOne(() => Profile) profile!: Profile` |
|
|
8
|
+
| `@HasMany(() => Target)` | 1:N relationship | `@HasMany(() => Post) posts!: Post[]` |
|
|
9
|
+
| `@BelongsTo(() => Target)` | Inverse of HasOne/Many | `@BelongsTo(() => User) user!: User` |
|
|
10
|
+
|
|
11
|
+
## Model Definition Template
|
|
12
|
+
```typescript
|
|
13
|
+
import { Model, column } from '@gravito/atlas'
|
|
14
|
+
|
|
15
|
+
export class MyModel extends Model {
|
|
16
|
+
static table = 'my_table'
|
|
17
|
+
|
|
18
|
+
@column({ isPrimary: true })
|
|
19
|
+
id!: number
|
|
20
|
+
|
|
21
|
+
@column()
|
|
22
|
+
createdAt!: string
|
|
23
|
+
}
|
|
24
|
+
```
|
|
File without changes
|