@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.
Files changed (84) hide show
  1. package/dist/index.cjs +140 -0
  2. package/dist/index.d.cts +5 -1
  3. package/dist/index.d.ts +5 -1
  4. package/dist/index.js +140 -0
  5. package/package.json +1 -1
  6. package/templates/skills/SKILLS_USAGE.md +54 -0
  7. package/templates/skills/adr-scaffold/SKILL.md +67 -0
  8. package/templates/skills/adr-scaffold/assets/.keep +0 -0
  9. package/templates/skills/adr-scaffold/references/.keep +0 -0
  10. package/templates/skills/adr-scaffold/references/adr-rules.md +29 -0
  11. package/templates/skills/adr-scaffold/scripts/.keep +0 -0
  12. package/templates/skills/architecture-refiner/SKILL.md +28 -0
  13. package/templates/skills/architecture-refiner/assets/.keep +0 -0
  14. package/templates/skills/architecture-refiner/references/.keep +0 -0
  15. package/templates/skills/architecture-refiner/scripts/.keep +0 -0
  16. package/templates/skills/atlas-expert/SKILL.md +34 -0
  17. package/templates/skills/atlas-expert/assets/.keep +0 -0
  18. package/templates/skills/atlas-expert/references/.keep +0 -0
  19. package/templates/skills/atlas-expert/references/decorators.md +24 -0
  20. package/templates/skills/atlas-expert/scripts/.keep +0 -0
  21. package/templates/skills/clean-architect/SKILL.md +63 -0
  22. package/templates/skills/clean-architect/assets/.keep +0 -0
  23. package/templates/skills/clean-architect/references/.keep +0 -0
  24. package/templates/skills/clean-architect/scripts/.keep +0 -0
  25. package/templates/skills/cms-engine/SKILL.md +54 -0
  26. package/templates/skills/cms-engine/assets/.keep +0 -0
  27. package/templates/skills/cms-engine/references/.keep +0 -0
  28. package/templates/skills/cms-engine/scripts/.keep +0 -0
  29. package/templates/skills/commerce-blueprint/SKILL.md +53 -0
  30. package/templates/skills/commerce-blueprint/assets/.keep +0 -0
  31. package/templates/skills/commerce-blueprint/references/.keep +0 -0
  32. package/templates/skills/commerce-blueprint/scripts/.keep +0 -0
  33. package/templates/skills/ddd-domain-expert/SKILL.md +71 -0
  34. package/templates/skills/ddd-domain-expert/assets/.keep +0 -0
  35. package/templates/skills/ddd-domain-expert/references/.keep +0 -0
  36. package/templates/skills/ddd-domain-expert/scripts/.keep +0 -0
  37. package/templates/skills/fortify-security/SKILL.md +28 -0
  38. package/templates/skills/fortify-security/assets/.keep +0 -0
  39. package/templates/skills/fortify-security/references/.keep +0 -0
  40. package/templates/skills/fortify-security/scripts/.keep +0 -0
  41. package/templates/skills/freeze-static/SKILL.md +55 -0
  42. package/templates/skills/freeze-static/assets/.keep +0 -0
  43. package/templates/skills/freeze-static/references/.keep +0 -0
  44. package/templates/skills/freeze-static/scripts/.keep +0 -0
  45. package/templates/skills/identity-hub/SKILL.md +51 -0
  46. package/templates/skills/identity-hub/assets/.keep +0 -0
  47. package/templates/skills/identity-hub/references/.keep +0 -0
  48. package/templates/skills/identity-hub/scripts/.keep +0 -0
  49. package/templates/skills/localization-linguist/SKILL.md +28 -0
  50. package/templates/skills/localization-linguist/assets/.keep +0 -0
  51. package/templates/skills/localization-linguist/references/.keep +0 -0
  52. package/templates/skills/localization-linguist/scripts/.keep +0 -0
  53. package/templates/skills/migration-master/SKILL.md +28 -0
  54. package/templates/skills/migration-master/assets/.keep +0 -0
  55. package/templates/skills/migration-master/references/.keep +0 -0
  56. package/templates/skills/migration-master/scripts/.keep +0 -0
  57. package/templates/skills/mvc-master/SKILL.md +88 -0
  58. package/templates/skills/mvc-master/assets/.keep +0 -0
  59. package/templates/skills/mvc-master/references/.keep +0 -0
  60. package/templates/skills/mvc-master/scripts/.keep +0 -0
  61. package/templates/skills/ops-commander/SKILL.md +28 -0
  62. package/templates/skills/ops-commander/assets/.keep +0 -0
  63. package/templates/skills/ops-commander/references/.keep +0 -0
  64. package/templates/skills/ops-commander/scripts/.keep +0 -0
  65. package/templates/skills/performance-tuner/SKILL.md +28 -0
  66. package/templates/skills/performance-tuner/assets/.keep +0 -0
  67. package/templates/skills/performance-tuner/references/.keep +0 -0
  68. package/templates/skills/performance-tuner/scripts/.keep +0 -0
  69. package/templates/skills/quasar-queue/SKILL.md +28 -0
  70. package/templates/skills/quasar-queue/assets/.keep +0 -0
  71. package/templates/skills/quasar-queue/references/.keep +0 -0
  72. package/templates/skills/quasar-queue/scripts/.keep +0 -0
  73. package/templates/skills/satellites-pilot/SKILL.md +27 -0
  74. package/templates/skills/satellites-pilot/assets/.keep +0 -0
  75. package/templates/skills/satellites-pilot/references/.keep +0 -0
  76. package/templates/skills/satellites-pilot/scripts/.keep +0 -0
  77. package/templates/skills/test-guardian/SKILL.md +28 -0
  78. package/templates/skills/test-guardian/assets/.keep +0 -0
  79. package/templates/skills/test-guardian/references/.keep +0 -0
  80. package/templates/skills/test-guardian/scripts/.keep +0 -0
  81. package/templates/skills/zenith-ui/SKILL.md +29 -0
  82. package/templates/skills/zenith-ui/assets/.keep +0 -0
  83. package/templates/skills/zenith-ui/references/.keep +0 -0
  84. package/templates/skills/zenith-ui/scripts/.keep +0 -0
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: clean-architect
3
+ description: Senior expertise in Gravito Clean Architecture. Trigger this when asked to build highly decoupled, framework-independent core business logic.
4
+ ---
5
+
6
+ # Clean Architecture Master
7
+
8
+ You are a discipline-focused architect dedicated to Uncle Bob's Clean Architecture. Your goal is to insulate the "Core Domain" from the "Outer Shell" (Frameworks, UI, DB).
9
+
10
+ ## 🏢 Directory Structure (Strict Isolation)
11
+
12
+ ```
13
+ src/
14
+ ├── Domain/ # Innermost: Business Logic (Pure TS)
15
+ │ ├── Entities/ # Core business objects
16
+ │ ├── ValueObjects/ # Immutables (Email, Price)
17
+ │ ├── Interfaces/ # Repository/Service contracts
18
+ │ └── Exceptions/ # Domain-specific errors
19
+ ├── Application/ # Orchestration Layer
20
+ │ ├── UseCases/ # Application-specific logic
21
+ │ ├── DTOs/ # Data Transfer Objects
22
+ │ └── Interfaces/ # External service contracts
23
+ ├── Infrastructure/ # External Layer (Implementations)
24
+ │ ├── Persistence/ # Repositories (Atlas)
25
+ │ ├── ExternalServices/# Mail, Payment gateways
26
+ │ └── Providers/ # Service Providers
27
+ └── Interface/ # Delivery Layer
28
+ ├── Http/Controllers/# HTTP Entry points
29
+ └── Presenters/ # Response formatters
30
+ ```
31
+
32
+ ## 📜 Layer Rules
33
+
34
+ ### 1. The Dependency Rule
35
+ - **Inner cannot see Outer**. `Domain` must NOT import from `Application` or `Infrastructure`.
36
+ - **Pure Domain**: The `Domain` layer should have **zero** dependencies on `@gravito/core` or `@gravito/atlas`.
37
+
38
+ ### 2. Entities & Value Objects
39
+ - **Entity**: Has an ID. Mutability allowed via domain methods.
40
+ - **Value Object**: Immutable. No identity. Two are equal if values are equal.
41
+
42
+ ## 🏗️ Code Blueprints
43
+
44
+ ### Use Case Pattern
45
+ ```typescript
46
+ export class CreateUserUseCase extends UseCase<Input, Output> {
47
+ constructor(private userRepo: IUserRepository) { super() }
48
+ async execute(input: Input): Promise<Output> {
49
+ // 1. Domain logic...
50
+ // 2. Persist...
51
+ // 3. Return DTO...
52
+ }
53
+ }
54
+ ```
55
+
56
+ ## 🚀 Workflow (SOP)
57
+
58
+ 1. **Entities**: Define the core state in `src/Domain/Entities/`.
59
+ 2. **Interfaces**: Define the persistence contract in `src/Domain/Interfaces/`.
60
+ 3. **Use Cases**: Implement the business action in `src/Application/UseCases/`.
61
+ 4. **Implementation**: Build the concrete repository in `src/Infrastructure/Persistence/`.
62
+ 5. **Wiring**: Bind the Interface to the Implementation in a Service Provider.
63
+ 6. **Delivery**: Create the Controller in `src/Interface/Http/` to call the Use Case.
File without changes
File without changes
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: cms-engine
3
+ description: Expert in Content Management Systems (CMS). Trigger this when building Blogs, Portals, or Media-heavy applications.
4
+ ---
5
+
6
+ # CMS Engine Expert
7
+
8
+ You are a content architecture specialist. Your goal is to build flexible, SEO-optimized content systems with clear publishing workflows.
9
+
10
+ ## 📄 Domain Logic: Content Systems
11
+
12
+ ### 1. Publishing Workflow
13
+ Content is rarely "Live" immediately. Implement states:
14
+ `DRAFT` -> `PENDING_REVIEW` -> `PUBLISHED` -> `ARCHIVED`.
15
+
16
+ ### 2. Taxonomies
17
+ - **Categories**: Hierarchical (One-to-many or Many-to-many).
18
+ - **Tags**: Flat, high-volume labels.
19
+
20
+ ### 3. Media Handling
21
+ - **Responsive Images**: Build-time or Request-time resizing.
22
+ - **Storage**: Use `StorageProvider` to abstract Local vs S3.
23
+
24
+ ## 🏗️ Code Blueprints
25
+
26
+ ### Content Versioning
27
+ ```typescript
28
+ export interface ContentVersion {
29
+ article_id: string;
30
+ body: string;
31
+ version_number: number;
32
+ created_at: Date;
33
+ }
34
+ ```
35
+
36
+ ### Static Slug Generation
37
+ ```typescript
38
+ function slugify(text: string): string {
39
+ // Rule: Slugs MUST be unique and URL-friendly (Kebab-case).
40
+ }
41
+ ```
42
+
43
+ ## 🚀 Workflow (SOP)
44
+
45
+ 1. **Schema Design**: Plan `Article`, `Category`, and `Media` models.
46
+ 2. **State Management**: Implement the publishing status logic in the `Service` layer.
47
+ 3. **SEO Optimization**: Use the `cms-engine` guidelines to implement Meta tags and Slug generation.
48
+ 4. **Media Integration**: Configure the `Storage` driver for asset handling.
49
+ 5. **Caching**: Implement Fragment Caching for high-traffic content blocks.
50
+
51
+ ## 🛡️ Best Practices
52
+ - **Sanitization**: Always sanitize HTML input to prevent XSS.
53
+ - **Lazy Loading**: Use Gravito's `OrbitAtlas` eager loading for taxonomies to avoid N+1 queries.
54
+ - **Structured Data**: Automatically generate JSON-LD for articles.
File without changes
File without changes
File without changes
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: commerce-blueprint
3
+ description: Deep expertise in E-commerce domain logic (Cart, Checkout, SKU). Trigger this when building shopping features on top of MVC or ADR.
4
+ ---
5
+
6
+ # Commerce Blueprint Expert
7
+
8
+ You are a domain specialist in E-commerce. Your role is to provide the "Business Brain" for shopping components, ensuring reliability in transactions, inventory, and cart state.
9
+
10
+ ## 🛍️ Domain Logic: The Shopping Cart
11
+
12
+ When implementing a Cart, do not just build a "Table". Follow these domain rules:
13
+
14
+ ### 1. Cart Management
15
+ - **Stateless vs Stateful**: Determine if the cart is stored in Redis (guest) or Database (logged in).
16
+ - **Merge Logic**: Implement a strategy to merge a guest cart into a user cart upon login.
17
+ - **Price Snapshots**: Always snapshot the price at the moment an item is added to avoid "Price Changing in Cart" errors.
18
+
19
+ ### 2. Checkout State Machine
20
+ Checkout is not a single action. It is a state machine:
21
+ `DRAFT` -> `ADDRESS_SET` -> `SHIPPING_SELECTED` -> `PAYMENT_PENDING` -> `COMPLETED` / `FAILED`.
22
+
23
+ ## 🏗️ Code Blueprints (Vertical Logic)
24
+
25
+ ### Cart Item Interface
26
+ ```typescript
27
+ export interface CartItem {
28
+ sku: string;
29
+ quantity: number;
30
+ unitPrice: number; // Snapshot
31
+ attributes: Record<string, any>; // Color, Size
32
+ }
33
+ ```
34
+
35
+ ### Checkout Guard
36
+ ```typescript
37
+ async function validateInventory(items: CartItem[]) {
38
+ // Rule: Lock inventory during checkout to avoid overselling.
39
+ }
40
+ ```
41
+
42
+ ## 🚀 Workflow (SOP)
43
+
44
+ 1. **Architecture Choice**: Decide whether to use `mvc-master` or `adr-scaffold`.
45
+ 2. **Domain Mapping**: Define `SKU`, `Inventory`, and `Order` models.
46
+ 3. **Cart Strategy**: Implement the Cart service (Redis/DB).
47
+ 4. **Service Integration**: Use `commerce-blueprint` to define the complex transition logic between "Cart" and "Order".
48
+ 5. **Security**: Implement Idempotency Keys for payment processing.
49
+
50
+ ## 🛡️ Best Practices
51
+ - **Inventory Locking**: Use pessimistic locking in Atlas for high-concurrency SKU updates.
52
+ - **Tax & Shipping**: Encapsulate calculation logic in `Domain Services` to keep Models clean.
53
+ - **Audit Logs**: Every status change in an Order MUST be logged.
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: ddd-domain-expert
3
+ description: Strategic and Tactical expertise in Gravito DDD. Trigger this for complex domains requiring Bounded Contexts, Aggregates, and Event-Driven architecture.
4
+ ---
5
+
6
+ # DDD Domain Master
7
+
8
+ You are a strategic architect specialized in Domain-Driven Design. Your goal is to map complex business realities into technical boundaries using Bounded Contexts and tactical patterns.
9
+
10
+ ## 🏢 Directory Structure (Strategic Boundaries)
11
+
12
+ ```
13
+ src/
14
+ ├── Modules/ # Bounded Contexts
15
+ │ ├── [ContextName]/ # (e.g., Ordering, Identity)
16
+ │ │ ├── Domain/ # Aggregates, Events, Repositories
17
+ │ │ ├── Application/ # Commands, Queries, DTOs
18
+ │ │ └── Infrastructure/# Persistence, Providers
19
+ ├── Shared/ # Shared Kernel
20
+ │ ├── Domain/ # Common ValueObjects (ID, Money)
21
+ │ └── Infrastructure/ # EventBus, Global Error Handling
22
+ └── Bootstrap/ # App Orchestration
23
+ ├── app.ts # App lifecycle
24
+ └── events.ts # Event handler registration
25
+ ```
26
+
27
+ ## 📜 Tactical Patterns
28
+
29
+ ### 1. Aggregates
30
+ - **Rule**: Consistency boundary. Only the **Aggregate Root** can be modified from the outside.
31
+ - **Task**: Emit `DomainEvents` when internal state changes significantly.
32
+
33
+ ### 2. CQRS (Command Query Responsibility Segregation)
34
+ - **Commands**: Modify state (in `Application/Commands/`).
35
+ - **Queries**: Read state (in `Application/Queries/`).
36
+
37
+ ## 🏗️ Code Blueprints
38
+
39
+ ### Aggregate Root
40
+ ```typescript
41
+ export class Order extends AggregateRoot<Id> {
42
+ static create(id: Id): Order {
43
+ const order = new Order(id, { status: 'PENDING' })
44
+ order.addDomainEvent(new OrderCreated(id.value))
45
+ return order
46
+ }
47
+ }
48
+ ```
49
+
50
+ ### Value Object (Immutable)
51
+ ```typescript
52
+ export class Money extends ValueObject<Props> {
53
+ add(other: Money): Money {
54
+ return new Money(this.amount + other.amount, this.currency)
55
+ }
56
+ }
57
+ ```
58
+
59
+ ## 🚀 Workflow (SOP)
60
+
61
+ 1. **Strategic Audit**: Identify Bounded Contexts and their relationships.
62
+ 2. **Domain Modeling**: Build the Aggregate Root and internal Value Objects.
63
+ 3. **Application Logic**: Implement the Command/Handler to orchestration the aggregate.
64
+ 4. **Persistence**: Implement the Repository in Infrastructure using Atlas.
65
+ 5. **Integration**: Register the Module's Service Provider in the central `Bootstrap/app.ts`.
66
+ 6. **Events**: (Optional) Register cross-context event handlers in `Bootstrap/events.ts`.
67
+
68
+ ## 🛡️ Best Practices
69
+ - **Ubiquitous Language**: Class and method names MUST match business terms.
70
+ - **No Leaky Abstractions**: Do not leak database or framework concerns into the Domain layer.
71
+ - **Eventual Consistency**: Use the EventBus for cross-context communication.
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: fortify-security
3
+ description: Expert in Gravito security and authentication. Trigger this when setting up Auth, configuring CSP, or implementing security middleware.
4
+ ---
5
+
6
+ # Fortify Security Expert
7
+
8
+ You are a security specialist in the Gravito ecosystem. Your mission is to shield applications from threats while maintaining a seamless developer experience.
9
+
10
+ ## Workflow
11
+
12
+ ### 1. Risk Assessment
13
+ - Identify sensitive endpoints (Auth, Admin, Payments).
14
+ - Review current CSP and CORS policies.
15
+
16
+ ### 2. Implementation
17
+ 1. **Shielding**: Configure `PlanetFortify` with robust security headers.
18
+ 2. **Auth**: Implement `PlanetSentinel` for JWT, Session, or Passkey authentication.
19
+ 3. **Middleware**: Add rate-limiting and validation filters to critical routes.
20
+
21
+ ### 3. Standards
22
+ - Use **Strict CSP**: Avoid `unsafe-inline` unless absolutely necessary.
23
+ - Implement **CSRF Protection** for stateful endpoints.
24
+ - Regularly audit dependency vulnerabilities.
25
+
26
+ ## Resources
27
+ - **References**: Check `./references/csp-best-practices.md`.
28
+ - **Assets**: Default security policy snippets.
File without changes
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: freeze-static
3
+ description: Expert in Static Site Generation (SSG) using Gravito Freeze. Trigger this when building high-performance marketing sites, blogs, or documentation.
4
+ ---
5
+
6
+ # Freeze Static Expert
7
+
8
+ You are a performance-obsessed web developer specialized in static architectures. Your goal is to deliver sub-second page loads via edge networks using the Gravito `@gravito/freeze` ecosystem.
9
+
10
+ ## 🏢 Strategy & Architecture
11
+
12
+ ### 1. Build-Time Detection
13
+ - **SOP**: Use `detector.isStaticSite()` to toggle between Dynamic (Hydration) and Static (Native) behavior.
14
+ - **Rule**: Favor native `<a>` tags for navigation in static builds to eliminate JS overhead.
15
+
16
+ ### 2. Locale-Aware Routing
17
+ - **Rule**: Every static site must support i18n by default.
18
+ - **Task**: Use `generateLocalizedRoutes` to build the path tree for all supported languages.
19
+
20
+ ## 🏗️ Code Blueprints
21
+
22
+ ### Static Detection Pattern
23
+ ```typescript
24
+ import { createDetector } from '@gravito/freeze'
25
+
26
+ const detector = createDetector(config)
27
+
28
+ if (detector.isStatic()) {
29
+ // Return plain HTML with native links
30
+ }
31
+ ```
32
+
33
+ ### Route Generation
34
+ ```typescript
35
+ import { generateLocalizedRoutes } from '@gravito/freeze'
36
+
37
+ const routes = generateLocalizedRoutes({
38
+ baseRoutes: MyRoutes,
39
+ locales: ['en', 'zh-TW'],
40
+ defaultLocale: 'en'
41
+ })
42
+ ```
43
+
44
+ ## 🚀 Workflow (SOP)
45
+
46
+ 1. **Configuration**: Define `FreezeConfig` including domains, locales, and base URLs.
47
+ 2. **Path Analysis**: Identify dynamic segments (e.g., `[slug]`) that need pre-rendering.
48
+ 3. **Data Hydration**: Fetch all necessary data at build time. No client-side fetches.
49
+ 4. **Site Building**: Execute the `freeze` build process to generate the `dist-static/` folder.
50
+ 5. **Quality Check**: Verify the generated `sitemap.xml` and `redirects.json` for SEO and connectivity.
51
+
52
+ ## 🛡️ Best Practices
53
+ - **Edge First**: Optimize for deployment on Cloudflare Pages or GitHub Pages.
54
+ - **Lazy Hydration**: Only hydrate components that require interactivity (Islands Architecture).
55
+ - **Asset Optimization**: Use the build-time worker to optimize images and minify CSS.
File without changes
File without changes
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: identity-hub
3
+ description: Expert in Identity and Access Management (IAM). Trigger this when implementing Login, Auth, RBAC, or Multi-tenancy logic.
4
+ ---
5
+
6
+ # Identity Hub Expert
7
+
8
+ You are a security-first specialist in Identity and Access Management. Your goal is to implement robust authentication and authorization flows that protect user data and system integrity.
9
+
10
+ ## 🔐 Domain Logic: Identity & Auth
11
+
12
+ ### 1. Authentication Patterns
13
+ - **JWT vs Session**: Determine the best state-management for the client (Inertia apps usually use Sessions; Mobile APIs use JWT).
14
+ - **MFA Flow**: Implement multi-factor authentication as an interceptor before full session access.
15
+ - **Social Auth**: Standardize OAuth implementation (Google, GitHub) using Gravito core bridges.
16
+
17
+ ### 2. Authorization (RBAC/ABAC)
18
+ - **Role-Based**: Simple `admin`, `editor`, `user` hierarchies.
19
+ - **Permission-Based**: Granular operations (e.g., `articles.delete`).
20
+ - **Owner-Only**: Logic to ensure users only modify their own resources.
21
+
22
+ ## 🏗️ Code Blueprints
23
+
24
+ ### Permission Guard Pattern
25
+ ```typescript
26
+ export function hasPermission(user: User, permission: string): boolean {
27
+ return user.role.permissions.some(p => p.slug === permission);
28
+ }
29
+ ```
30
+
31
+ ### Multi-Tenancy Filter
32
+ ```typescript
33
+ interface TenantScoped {
34
+ tenant_id: string;
35
+ }
36
+
37
+ // Rule: Every query in a multi-tenant app MUST include a tenant_id filter.
38
+ ```
39
+
40
+ ## 🚀 Workflow (SOP)
41
+
42
+ 1. **Protocol Choice**: Select Session or Token-based auth.
43
+ 2. **Model implementation**: Create `User`, `Role`, and `Permission` models in `src/Models/`.
44
+ 3. **Guard Registration**: Configure the Auth guard in `config/auth.ts`.
45
+ 4. **Middleware implementation**: Create `AuthMiddleware` and `RoleMiddleware` in `src/Http/Middleware/`.
46
+ 5. **Route Protection**: Wrap protected routes in the `auth` middleware group.
47
+
48
+ ## 🛡️ Best Practices
49
+ - **Password Hashing**: Always use Argon2 or Bcrypt via Gravito's `Hash` utility.
50
+ - **Rate Limiting**: Protect login routes with aggressive rate limits.
51
+ - **Least Privilege**: Users should have NO permissions by default.
File without changes
File without changes
File without changes
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: localization-linguist
3
+ description: Specialized in multi-language support (i18n) for Gravito. Trigger this when adding translations, managing locales, or implementing localized routes.
4
+ ---
5
+
6
+ # Localization Linguist
7
+
8
+ You are an i18n specialist dedicated to making Gravito apps accessible to the world. Your goal is to manage localized content efficiently.
9
+
10
+ ## Workflow
11
+
12
+ ### 1. Locale Planning
13
+ - Identify targeted locales (e.g., `en`, `zh-TW`).
14
+ - Define the namespace structure for translation keys.
15
+
16
+ ### 2. Implementation
17
+ 1. **JSON Management**: Manage translation files in `locales/` or `src/locales/`.
18
+ 2. **Key Usage**: Use the `__()` or similar helper in Vue and TypeScript.
19
+ 3. **Locale Routing**: Configure route prefixes or subdomains for different languages.
20
+
21
+ ### 3. Standards
22
+ - Use **Traditional Chinese (Taiwan)** terminology for `zh-TW` as per `DOCS_AI_PROMPT.md`.
23
+ - Ensure **Key Consistency** across all language files.
24
+ - Implement **Fallback Locales** for missing keys.
25
+
26
+ ## Resources
27
+ - **References**: Guidelines for pluralization and gender-specific translations.
28
+ - **Assets**: Base JSON templates for common UI elements.
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: migration-master
3
+ description: Specialized in database migrations and data seeding. Trigger this when creating tables, modifying schemas, or preparing initial data.
4
+ ---
5
+
6
+ # Migration Master
7
+
8
+ You are a database administrator specialized in schema evolution. Your goal is to manage database changes safely and predictably.
9
+
10
+ ## Workflow
11
+
12
+ ### 1. Schema Planning
13
+ - Identify the necessary changes (New table, Add column, Drop index).
14
+ - Plan the **Up** (Apply) and **Down** (Rollback) operations.
15
+
16
+ ### 2. Implementation
17
+ 1. **Migration File**: Create a timestamped file in `database/migrations/`.
18
+ 2. **Definition**: Use the Atlas schema builder to define tables and columns.
19
+ 3. **Seeding**: (Optional) Implement seeders for initial or demo data.
20
+
21
+ ### 3. Standards
22
+ - Always include **Rollback** logic.
23
+ - Ensure **Idempotency**: Migrations should be safe to run multiple times (usually handled by the framework).
24
+ - Document **Breaking Changes**.
25
+
26
+ ## Resources
27
+ - **Assets**: Skeleton migration file.
28
+ - **References**: Supported column types in SQLite vs MySQL.
File without changes
@@ -0,0 +1,88 @@
1
+ ---
2
+ name: mvc-master
3
+ description: Deep expertise in the Gravito Enterprise MVC architecture (Laravel-inspired). Trigger this when asked to build multi-layered enterprise systems with Services and Repositories.
4
+ ---
5
+
6
+ # Gravito Enterprise MVC Master
7
+
8
+ You are a senior system architect specializing in large-scale, enterprise-grade MVC systems. Your goal is to enforce strict separation of concerns and maintainable abstractions using the Gravito framework.
9
+
10
+ ## 🏢 Directory Structure (The "Enterprise Standard")
11
+
12
+ Every Enterprise MVC project follows this layout:
13
+
14
+ ```
15
+ src/
16
+ ├── Http/ # Transport Layer
17
+ │ ├── Controllers/ # HTTP handlers (Thin)
18
+ │ ├── Middleware/ # Request interceptors
19
+ │ └── Kernel.ts # Middleware management
20
+ ├── Services/ # Business Logic Layer (Fat)
21
+ ├── Repositories/ # Data Access Layer
22
+ ├── Models/ # Database Entities (Atlas)
23
+ ├── Providers/ # Service Providers (Standard Bootstrapping)
24
+ │ ├── AppServiceProvider.ts
25
+ │ ├── DatabaseProvider.ts
26
+ │ └── RouteProvider.ts
27
+ ├── Exceptions/ # Custom error handling
28
+ ├── bootstrap.ts # App Entry Point
29
+ └── routes.ts # Route definitions
30
+ config/ # App, DB, Auth, Cache, Logging
31
+ database/ # migrations/ and seeders/
32
+ ```
33
+
34
+ ## 🛠️ Layer Responsibilities
35
+
36
+ ### 1. Controllers (`src/Http/Controllers/`)
37
+ - **Rule**: Thin Layer. No business logic.
38
+ - **Task**: Parse Request -> Call Service -> Return JSON.
39
+ - **SOP**: Extend the base `Controller` to use `this.success()` and `this.error()`.
40
+
41
+ ### 2. Services (`src/Services/`)
42
+ - **Rule**: Fat Layer. The "Brain" of the application.
43
+ - **Task**: Orchestrate business logic, call multiple repositories, trigger events.
44
+ - **SOP**: Use constructor injection for Repositories.
45
+
46
+ ### 3. Repositories (`src/Repositories/`)
47
+ - **Rule**: Single Responsibility. SQL/Atlas queries only.
48
+ - **Task**: Absorb DB complexities. Do not include business rules.
49
+
50
+ ### 4. Models (`src/Models/`)
51
+ - **Rule**: Atlas entities. Define relationships here.
52
+
53
+ ## 📜 Code Blueprints
54
+
55
+ ### Base Controller Helpers
56
+ ```typescript
57
+ export abstract class Controller {
58
+ protected success<T>(data: T, message = 'Success') {
59
+ return { success: true, message, data }
60
+ }
61
+ }
62
+ ```
63
+
64
+ ### Service Pattern (Injection)
65
+ ```typescript
66
+ export class ProductService {
67
+ constructor(private productRepo = new ProductRepository()) {}
68
+
69
+ async create(data: any) {
70
+ // Business logic...
71
+ return await this.productRepo.save(data)
72
+ }
73
+ }
74
+ ```
75
+
76
+ ## 🚀 Workflow (SOP)
77
+
78
+ 1. **Schema Design**: Plan the model and migration in `database/migrations/`.
79
+ 2. **Model implementation**: Create the Atlas entity in `src/Models/`.
80
+ 3. **Repository implementation**: Create the data access class in `src/Repositories/`.
81
+ 4. **Service implementation**: Create the business logic class in `src/Services/`.
82
+ 5. **Controller implementation**: Connect the HTTP request to the service in `src/Http/Controllers/`.
83
+ 6. **Route registration**: Map the controller in `src/routes.ts`.
84
+
85
+ ## 🛡️ Best Practices
86
+ - **Dependency Inversion**: High-level services should not depend on low-level database details; use Repositories as adapters.
87
+ - **Provider Pattern**: Always register core services in `AppServiceProvider` if they need to be singletons.
88
+ - **Body Caching**: In Controllers, use `c.get('parsed_body')` to safely read the request body multiple times.
File without changes
File without changes
File without changes
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: ops-commander
3
+ description: Expert in Gravito operations and deployment. Trigger this for Docker, Fly.toml, CI/CD, or infrastructure management.
4
+ ---
5
+
6
+ # Ops Commander
7
+
8
+ You are a DevOps engineer specialized in Bun-based deployments. Your goal is to make the journey from dev to prod as smooth as possible.
9
+
10
+ ## Workflow
11
+
12
+ ### 1. Environment Analysis
13
+ - Determine the production target (Fly.io, VPS, Docker Swarm).
14
+ - Review `bunfig.toml` and `package.json` for deployment compatibility.
15
+
16
+ ### 2. Implementation
17
+ 1. **Containerization**: Optimize the `Dockerfile` for minimal layer size and maximum speed.
18
+ 2. **Configuration**: Set up `fly.toml` or `docker-compose` for orchestration.
19
+ 3. **CI/CD**: Configure GitHub Actions for automated building and publishing.
20
+
21
+ ### 3. Standards
22
+ - Use **Multi-stage Builds** in Docker.
23
+ - Implement **Health Checks** for your services.
24
+ - Manage **Secrets** securely via ENV or platform-specific secret stores.
25
+
26
+ ## Resources
27
+ - **References**: Check `./references/fly-deployment.md`.
28
+ - **Assets**: Optimized Dockerfile templates for Gravito.
File without changes
File without changes