@solid-stack/mason 1.0.11
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/LICENSE +18 -0
- package/README.md +238 -0
- package/dist/bin.cjs +3480 -0
- package/dist/bin.cjs.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +3451 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/commands/create.d.ts +2 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/domain.d.ts +2 -0
- package/dist/commands/domain.d.ts.map +1 -0
- package/dist/commands/feature.d.ts +2 -0
- package/dist/commands/feature.d.ts.map +1 -0
- package/dist/commands/httpHandler.d.ts +2 -0
- package/dist/commands/httpHandler.d.ts.map +1 -0
- package/dist/commands/import.d.ts +10 -0
- package/dist/commands/import.d.ts.map +1 -0
- package/dist/commands/infrastructure.d.ts +2 -0
- package/dist/commands/infrastructure.d.ts.map +1 -0
- package/dist/commands/injectable.d.ts +2 -0
- package/dist/commands/injectable.d.ts.map +1 -0
- package/dist/commands/interface.d.ts +2 -0
- package/dist/commands/interface.d.ts.map +1 -0
- package/dist/commands/menu.d.ts +2 -0
- package/dist/commands/menu.d.ts.map +1 -0
- package/dist/commands/usecase.d.ts +2 -0
- package/dist/commands/usecase.d.ts.map +1 -0
- package/dist/core/domainGenerator.d.ts +4 -0
- package/dist/core/domainGenerator.d.ts.map +1 -0
- package/dist/core/featureGenerator.d.ts +3 -0
- package/dist/core/featureGenerator.d.ts.map +1 -0
- package/dist/core/httpHandlerGenerator.d.ts +8 -0
- package/dist/core/httpHandlerGenerator.d.ts.map +1 -0
- package/dist/core/infraGenerator.d.ts +60 -0
- package/dist/core/infraGenerator.d.ts.map +1 -0
- package/dist/core/injectableGenerator.d.ts +4 -0
- package/dist/core/injectableGenerator.d.ts.map +1 -0
- package/dist/core/interfaceGenerator.d.ts +4 -0
- package/dist/core/interfaceGenerator.d.ts.map +1 -0
- package/dist/core/providerManager.d.ts +16 -0
- package/dist/core/providerManager.d.ts.map +1 -0
- package/dist/core/useCaseGenerator.d.ts +5 -0
- package/dist/core/useCaseGenerator.d.ts.map +1 -0
- package/dist/index.cjs +3545 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3444 -0
- package/dist/index.js.map +1 -0
- package/dist/templates/domain/class.hbs +17 -0
- package/dist/templates/domain/interface.hbs +5 -0
- package/dist/templates/domain/valueObject.hbs +15 -0
- package/dist/templates/domain.template.d.ts +4 -0
- package/dist/templates/domain.template.d.ts.map +1 -0
- package/dist/templates/engine.d.ts +20 -0
- package/dist/templates/engine.d.ts.map +1 -0
- package/dist/templates/express/index.hbs +1 -0
- package/dist/templates/expressIndex.template.d.ts +2 -0
- package/dist/templates/expressIndex.template.d.ts.map +1 -0
- package/dist/templates/httpHandler/handler.hbs +71 -0
- package/dist/templates/httpHandler.template.d.ts +2 -0
- package/dist/templates/httpHandler.template.d.ts.map +1 -0
- package/dist/templates/index.d.ts +10 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/infra/concrete.hbs +29 -0
- package/dist/templates/infra/stub.hbs +103 -0
- package/dist/templates/infra.template.d.ts +3 -0
- package/dist/templates/infra.template.d.ts.map +1 -0
- package/dist/templates/injectable/injectable.hbs +32 -0
- package/dist/templates/injectable/interface.hbs +3 -0
- package/dist/templates/injectable.template.d.ts +3 -0
- package/dist/templates/injectable.template.d.ts.map +1 -0
- package/dist/templates/interface/interface.hbs +19 -0
- package/dist/templates/interface.template.d.ts +2 -0
- package/dist/templates/interface.template.d.ts.map +1 -0
- package/dist/templates/provider/provider.hbs +13 -0
- package/dist/templates/provider.template.d.ts +2 -0
- package/dist/templates/provider.template.d.ts.map +1 -0
- package/dist/templates/useCase/useCase.hbs +57 -0
- package/dist/templates/useCase/useCaseTest.hbs +24 -0
- package/dist/templates/useCase.template.d.ts +3 -0
- package/dist/templates/useCase.template.d.ts.map +1 -0
- package/dist/types/index.d.ts +129 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/fileOperations.d.ts +8 -0
- package/dist/utils/fileOperations.d.ts.map +1 -0
- package/dist/utils/formatting.d.ts +43 -0
- package/dist/utils/formatting.d.ts.map +1 -0
- package/dist/utils/project.d.ts +37 -0
- package/dist/utils/project.d.ts.map +1 -0
- package/dist/utils/prompts.d.ts +14 -0
- package/dist/utils/prompts.d.ts.map +1 -0
- package/dist/utils/registry.d.ts +61 -0
- package/dist/utils/registry.d.ts.map +1 -0
- package/package.json +84 -0
- package/templates/domain/class.hbs +17 -0
- package/templates/domain/interface.hbs +5 -0
- package/templates/domain/valueObject.hbs +15 -0
- package/templates/express/index.hbs +1 -0
- package/templates/httpHandler/handler.hbs +71 -0
- package/templates/infra/concrete.hbs +29 -0
- package/templates/infra/stub.hbs +103 -0
- package/templates/injectable/injectable.hbs +32 -0
- package/templates/injectable/interface.hbs +3 -0
- package/templates/interface/interface.hbs +19 -0
- package/templates/provider/provider.hbs +13 -0
- package/templates/useCase/useCase.hbs +57 -0
- package/templates/useCase/useCaseTest.hbs +24 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Copyright (c) 2026 Solid Stack Digital
|
|
2
|
+
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
This software and its associated documentation files (the "Software") are
|
|
6
|
+
proprietary to Solid Stack Digital.
|
|
7
|
+
|
|
8
|
+
Strictly confidential. No part of this Software may be used, copied,
|
|
9
|
+
modified, merged, published, distributed, sublicensed, or sold in any form
|
|
10
|
+
or by any means without the prior written permission of the copyright owner.
|
|
11
|
+
|
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
13
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
14
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
15
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
16
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
17
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
18
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# @solid-stack/create
|
|
2
|
+
|
|
3
|
+
An interactive, type-safe CLI for scaffolding and bootstrapping everything in the **Solid Stack Clean Architecture** ecosystem. Built with **TypeScript**, **tsup**, **cac**, and **@clack/prompts**.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🏗️ Clean Architecture Principles
|
|
8
|
+
|
|
9
|
+
`@solid-stack/create` enforces the architectural conventions of Solid Stack services (`@solid-stack/agnos`, `@solid-stack/agnos-express`, and `@solid-stack/di`):
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
features/<feature>/
|
|
13
|
+
├── domain/ # Zero DI dependencies! Pure interfaces & entities
|
|
14
|
+
│ ├── <Entity>.ts # Domain entity model / value object
|
|
15
|
+
│ └── I<Entity>Repository.ts # Domain repository / service abstract class (DI token & type)
|
|
16
|
+
├── infrastructure/ # Implementations of domain interfaces (@MakeInjectable)
|
|
17
|
+
│ └── Stub<Entity>Repository.ts # In-memory stub with test helpers (clear, setError, etc.)
|
|
18
|
+
├── useCases/ # Business logic (@MakeInjectable)
|
|
19
|
+
│ ├── <UseCase>.ts # Use case class with typed input/output DTOs & execute()
|
|
20
|
+
│ └── <UseCase>.test.ts # Vitest unit test with DI container & mock stubs
|
|
21
|
+
├── pxExpress/ # Express presentation layer (@solid-stack/agnos-express)
|
|
22
|
+
│ ├── index.ts # Route prefix (export const path = "/<feature>")
|
|
23
|
+
│ └── handlers/ # Route handlers extending ExpressRoute
|
|
24
|
+
│ └── <Handler>Http.ts # HTTP endpoint with @MakeInjectable & Zod validation
|
|
25
|
+
└── diProvider.ts # Feature DI module registering domain interface -> infrastructure bindings
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 🚀 Installation & Quick Start
|
|
31
|
+
|
|
32
|
+
Run interactively via `npx` or `pnpm dlx`:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Launch interactive wizard
|
|
36
|
+
npx @solid-stack/create
|
|
37
|
+
|
|
38
|
+
# Or run specific commands directly
|
|
39
|
+
npx @solid-stack/create feature users
|
|
40
|
+
npx @solid-stack/create usecase CreateUser -f users
|
|
41
|
+
npx @solid-stack/create domain User -f users
|
|
42
|
+
npx @solid-stack/create infrastructure StubUserRepository -f users
|
|
43
|
+
npx @solid-stack/create interface IUserRepository -f users
|
|
44
|
+
npx @solid-stack/create httpHandler CreateUserHttp -f users
|
|
45
|
+
npx @solid-stack/create injectable PasswordHasher
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 🛠️ Commands Reference
|
|
51
|
+
|
|
52
|
+
### 1. `@solid-stack/create feature [name]`
|
|
53
|
+
Scaffolds a complete Clean Architecture vertical slice with domain models, interface abstract classes, infrastructure stubs, use cases, Express presentation routes, and a feature DI provider.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Interactive prompt for feature details
|
|
57
|
+
npx @solid-stack/create feature
|
|
58
|
+
|
|
59
|
+
# Specify feature name directly
|
|
60
|
+
npx @solid-stack/create feature billing
|
|
61
|
+
|
|
62
|
+
# Non-interactive mode with default choices
|
|
63
|
+
npx @solid-stack/create feature orders --yes
|
|
64
|
+
|
|
65
|
+
# Exclude Express presentation layer
|
|
66
|
+
npx @solid-stack/create feature auth --no-express
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Prompts:**
|
|
70
|
+
- Feature name (e.g. `users`, `auth`, `billing`)
|
|
71
|
+
- Target directory (defaults to `./features/<feature>`)
|
|
72
|
+
- Include Express presentation (`pxExpress`) and route prefix path
|
|
73
|
+
- Include initial Domain Entity
|
|
74
|
+
- Include initial Domain Interface
|
|
75
|
+
- Include initial Infrastructure Stub
|
|
76
|
+
- Include initial Use Case and Vitest test
|
|
77
|
+
- Include feature DI Provider (`diProvider.ts`)
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### 2. `@solid-stack/create usecase [name]`
|
|
82
|
+
Creates a business logic use case decorated with `@MakeInjectable`, typed input/output DTOs, constructor dependency injection via `DepsType`, and optional Vitest tests and HTTP route handlers.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npx @solid-stack/create usecase CreateUser -f users
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Prompts:**
|
|
89
|
+
- Target feature (scans existing features under `./features/`)
|
|
90
|
+
- Use Case name (e.g. `CreateUser`, `GetUser`, `CancelOrder`)
|
|
91
|
+
- Injected dependencies (scans existing domain interfaces `I*.ts` for multi-selection)
|
|
92
|
+
- Input DTO properties
|
|
93
|
+
- Output DTO properties
|
|
94
|
+
- Generate Vitest unit test (`<UseCase>.test.ts`)
|
|
95
|
+
- Generate matching Express HTTP handler in `pxExpress/handlers/`
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
### 3. `@solid-stack/create domain [name]`
|
|
100
|
+
Creates a domain entity, model, or value object. Enforces the strict rule: **zero DI dependence** (`@solid-stack/di` or `@MakeInjectable` are never imported into domain entities).
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npx @solid-stack/create domain User -f users
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Prompts:**
|
|
107
|
+
- Target feature
|
|
108
|
+
- Model name (e.g. `User`, `Invoice`, `CartItem`)
|
|
109
|
+
- Model type:
|
|
110
|
+
- `TypeScript Interface`: Lightweight data structure
|
|
111
|
+
- `Entity Class`: Class with constructor and typed properties
|
|
112
|
+
- `Value Object`: Immutable class with private constructor, static `create()`, and `equals()`
|
|
113
|
+
- Interactive property definitions (name, type, optional)
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
### 4. `@solid-stack/create interface [name]`
|
|
118
|
+
Creates a domain repository or service interface abstract class. In Solid Stack, abstract classes are preferred over plain interfaces because they exist at runtime and serve directly as type-safe DI tokens.
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
npx @solid-stack/create interface IUserRepository -f users
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Prompts:**
|
|
125
|
+
- Target feature
|
|
126
|
+
- Interface name (automatically formats to `I<Name>Repository` or `I<Name>Service`)
|
|
127
|
+
- Style: Abstract Class (recommended for DI) or TypeScript Interface
|
|
128
|
+
- Associated domain entity (scans existing entities in `domain/`)
|
|
129
|
+
- Method signature preset (Standard CRUD or custom)
|
|
130
|
+
- Auto-generate infrastructure Stub (`Stub<Name>`)
|
|
131
|
+
- Auto-register binding in `diProvider.ts`
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
### 5. `@solid-stack/create infrastructure [name]`
|
|
136
|
+
Creates an infrastructure adapter or in-memory stub implementing a domain interface.
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# In-memory stub with test helpers
|
|
140
|
+
npx @solid-stack/create infrastructure StubUserRepository -f users
|
|
141
|
+
|
|
142
|
+
# Concrete production adapter
|
|
143
|
+
npx @solid-stack/create infrastructure PostgresUserRepository -f users
|
|
144
|
+
|
|
145
|
+
# Global infrastructure (e.g. ConsoleLogger in infrastructure/)
|
|
146
|
+
npx @solid-stack/create infrastructure ConsoleLogger --global
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Prompts:**
|
|
150
|
+
- Scope: Feature-level (`features/<feature>/infrastructure`) or Global (`infrastructure/`)
|
|
151
|
+
- Target feature
|
|
152
|
+
- Class name (e.g. `StubUserRepository`, `PostgresUserRepository`)
|
|
153
|
+
- Implemented domain interface (scans `domain/I*.ts`)
|
|
154
|
+
- Kind: In-Memory Stub (with in-memory Map, test helper methods `clear()`, `setError()`, `getAll()`) or Concrete Adapter Skeleton
|
|
155
|
+
- Auto-register in feature `diProvider.ts`
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
### 6. `@solid-stack/create httpHandler [name]`
|
|
160
|
+
Creates an Express route handler extending `ExpressRoute` for `@solid-stack/agnos-express`, decorated with `@MakeInjectable` and exported as `default`. Automatically creates `pxExpress/index.ts` route prefix if missing.
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
npx @solid-stack/create httpHandler GetUserHttp -f users -m get -p /:id
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Prompts:**
|
|
167
|
+
- Target feature
|
|
168
|
+
- Handler class name (e.g. `CreateUserHttp`, `GetUserHttp`)
|
|
169
|
+
- HTTP method: `GET`, `POST`, `PUT`, `PATCH`, `DELETE`
|
|
170
|
+
- Route subpath (e.g. `/`, `/:id`)
|
|
171
|
+
- Connect to domain Use Case (scans existing use cases in the feature)
|
|
172
|
+
- Inbound validation with Zod (`req.body`, `req.query`, or `req.params`)
|
|
173
|
+
- Schema field definitions
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
### 7. `@solid-stack/create injectable [name]`
|
|
178
|
+
Creates a generic `@MakeInjectable` class for services, transformers, or utilities across the architecture.
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
npx @solid-stack/create injectable PasswordHasher
|
|
182
|
+
npx @solid-stack/create injectable UserTransformer -f users
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Prompts:**
|
|
186
|
+
- Class name
|
|
187
|
+
- Architectural location:
|
|
188
|
+
- Feature Service (`features/<feature>/services/`)
|
|
189
|
+
- Feature Transformer (`features/<feature>/pxExpress/transformers/`)
|
|
190
|
+
- Shared Service (`shared/<name>/`)
|
|
191
|
+
- Core Module (`modules/<name>/`)
|
|
192
|
+
- Custom path
|
|
193
|
+
- Injected dependencies
|
|
194
|
+
- Generate runtime abstract class interface / DI token
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## 💻 Programmatic Usage
|
|
199
|
+
|
|
200
|
+
You can import generators directly into scripts or build pipelines:
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
import {
|
|
204
|
+
generateFeature,
|
|
205
|
+
generateUseCase,
|
|
206
|
+
generateDomain,
|
|
207
|
+
generateInterface,
|
|
208
|
+
generateInfrastructure,
|
|
209
|
+
generateHttpHandler,
|
|
210
|
+
generateInjectable,
|
|
211
|
+
updateOrGenerateDiProvider,
|
|
212
|
+
} from "@solid-stack/create";
|
|
213
|
+
|
|
214
|
+
// Scaffold feature programmatically
|
|
215
|
+
const files = generateFeature({
|
|
216
|
+
name: "billing",
|
|
217
|
+
includeExpress: true,
|
|
218
|
+
includeTests: true,
|
|
219
|
+
});
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## 🏗️ Development & Scripts
|
|
225
|
+
|
|
226
|
+
| Command | Description |
|
|
227
|
+
| --- | --- |
|
|
228
|
+
| `pnpm dev` | Starts `tsup` in watch mode |
|
|
229
|
+
| `pnpm build` | Compiles ESM/CJS bundles and declaration files to `dist/` |
|
|
230
|
+
| `pnpm test` | Runs the full Vitest test suite |
|
|
231
|
+
| `pnpm typecheck` | Typechecks using TypeScript (`tsc --noEmit`) |
|
|
232
|
+
| `pnpm check` | Runs typecheck, tests, and build in sequence |
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## 📄 License
|
|
237
|
+
|
|
238
|
+
UNLICENSED © [Solid Stack Digital](https://github.com/solid-stack-digital)
|