go-duck-cli 1.1.1 → 1.1.13

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/README.md CHANGED
@@ -149,44 +149,118 @@ go-duck import-gdl new-entities.gdl -o my-existing-app
149
149
 
150
150
  ## GoDuck Definition Language (GDL)
151
151
 
152
- GDL is a simple language for defining your application's entities, fields, and relationships.
152
+ GDL is a clean DSL for defining your application's entities, enums, fields, nested document structures, relationships, and public/auth boundaries.
153
153
 
154
154
  **Example (`app.gdl`):**
155
155
 
156
156
  ```gdl
157
- entity Author {
158
- name String required
159
- email String unique
157
+ // ==============================================================================
158
+ // 🦆 GO-DUCK ELITE DEALERSHIP BLUEPRINT
159
+ // ==============================================================================
160
+
161
+ /**
162
+ * Car: Relational Entity stored in PostgreSQL.
163
+ * @Searchable: Enable Spring-style fuzzy search on make/model.
164
+ * @Federated: Synchronize history across all dealership siloes.
165
+ * @Audited: Track every modification with Zero-Trust Keycloak IDs.
166
+ */
167
+ @Searchable @Federated @Audited
168
+ entity Car {
169
+ string(100) make required
170
+ string(100) model required
171
+ int(32) year required
172
+ bigdecimal price
173
+ string(50) vin unique
174
+ jsonb metadata
160
175
  }
161
176
 
162
- entity Book {
163
- title String required
164
- publishedDate LocalDate
177
+ /**
178
+ * Patient: MongoDB Document Entity.
179
+ * @Document: Stored in MongoDB instead of PostgreSQL.
180
+ */
181
+ @Document
182
+ entity Patient {
183
+ string name required
184
+ clinicalData {
185
+ vitals {
186
+ int bpm
187
+ float temp
188
+ }
189
+ history [String]
190
+ }
165
191
  }
166
192
 
193
+ /**
194
+ * ArticleStatus: Native Enum Support.
195
+ * GO-DUCK generates Go Enums, GraphQL Enums, and Proto definitions.
196
+ */
197
+ enum ArticleStatus {
198
+ DRAFT, PUBLISHED, ARCHIVED
199
+ }
200
+
201
+ // 🦆 RELATIONSHIPS: Build the Graph
167
202
  relationship OneToMany {
168
- Author{books} to Book{author}
203
+ Customer{car} to Car{owner}
169
204
  }
205
+
206
+ // 🦆 SECURITY: Define Public/Auth Access
207
+ open Car(read)
170
208
  ```
171
209
 
172
210
  ## Configuration (`config.yaml`)
173
211
 
174
- The `config.yaml` file contains the configuration for your generated application.
212
+ The `config.yaml` file configures the scaffolding engine and generated Go bootstrap files. It must start with the top-level `go-duck` block.
175
213
 
176
214
  ```yaml
177
- app:
178
- name: my-app
215
+ go-duck:
216
+ name: "my-app"
217
+ version: "1.0.0"
218
+ description: "GO-DUCK Scaffolded Microservice"
219
+
220
+ # --- Network & Server Layer ---
221
+ server:
222
+ port: 8080
223
+ grpc:
224
+ addr: ":9000"
225
+ network: "tcp"
226
+ timeout: "1s"
227
+ cors:
228
+ allow-origins: ["*"]
229
+ allow-methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]
230
+ allow-headers: ["Origin", "Content-Type", "Accept", "Authorization", "X-Tenant-ID"]
231
+
232
+ # --- Persistence Layer (Hybrid Store) ---
179
233
  datasource:
180
- host: localhost
234
+ # PostgreSQL (Relational Registry & Entity Store)
235
+ host: "localhost"
181
236
  port: 5432
182
- username: user
183
- password: password
184
- database: my_app_db
237
+ username: "postgres"
238
+ password: "password"
239
+ database: "my_app_db"
240
+ ssl-mode: "disable"
241
+ # MongoDB (Document Entity Store)
242
+ mongodb:
243
+ enabled: true
244
+ uri: "mongodb://localhost:27017"
245
+ database: "my_app_mongo"
246
+
247
+ # --- Security & Identity (Keycloak/OIDC) ---
248
+ security:
249
+ keycloak-host: "http://localhost:8080"
250
+ keycloak-realm: "my-realm"
251
+ keycloak-app-client-id: "my-app"
252
+ keycloak-service-client-id: "my-service"
253
+ keycloak-service-secret: "service-secret-123"
254
+ super-admin-role: "admin"
255
+ confidential-mode: true
256
+ rate-limit:
257
+ rps: 100
258
+ burst: 200
259
+
260
+ # --- Federated Multi-Tenancy ---
185
261
  multitenancy:
186
262
  enabled: true
187
- security:
188
- jwt:
189
- secret: "your-jwt-secret"
263
+ hide-silo-names: false
190
264
  ```
191
265
 
192
266
  ## License
@@ -141,7 +141,7 @@ services:
141
141
  - go-duck-net
142
142
 
143
143
  keycloak:
144
- image: quay.io/keycloak/keycloak:23.0.7
144
+ image: quay.io/keycloak/keycloak:26.2.3
145
145
  container_name: ${appName}-keycloak
146
146
  command: start-dev --import-realm
147
147
  environment:
package/index.js CHANGED
@@ -474,6 +474,15 @@ program
474
474
  const config = await loadConfig(path.resolve(process.cwd(), configPath));
475
475
  console.log(chalk.green(`✅ Config loaded for app: ${config.name}`));
476
476
 
477
+ // Copy configuration file to the generated project .go-duck folder
478
+ const sourceConfigResolved = path.resolve(process.cwd(), configPath);
479
+ const targetConfigResolved = path.resolve(absoluteOutputDir, '.go-duck/config.yaml');
480
+ if (sourceConfigResolved !== targetConfigResolved) {
481
+ await fs.ensureDir(path.dirname(targetConfigResolved));
482
+ await fs.copy(sourceConfigResolved, targetConfigResolved);
483
+ console.log(chalk.green(`📝 Config file copied to: ${path.relative(process.cwd(), targetConfigResolved)}`));
484
+ }
485
+
477
486
  // Cleanup legacy files if they exist in the root
478
487
  const legacyFiles = ['Dockerfile', 'docker-compose.yml'];
479
488
  const legacyDirs = ['k8s', 'realm-config'];
@@ -605,7 +614,10 @@ program
605
614
  const absoluteOutputDir = path.resolve(process.cwd(), options.output);
606
615
  console.log(chalk.blue(`📥 Importing GDL from ${gdlPath}...`));
607
616
 
608
- let configPath = path.resolve(process.cwd(), './CONFIG/config.yaml');
617
+ let configPath = path.resolve(process.cwd(), './.go-duck/config.yaml');
618
+ if (!await fs.pathExists(configPath)) {
619
+ configPath = path.resolve(process.cwd(), './CONFIG/config.yaml');
620
+ }
609
621
  if (!await fs.pathExists(configPath)) {
610
622
  configPath = path.resolve(process.cwd(), '../CONFIG/config.yaml');
611
623
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "go-duck-cli",
3
- "version": "1.1.1",
3
+ "version": "1.1.13",
4
4
  "description": "The Ultimate Evolutionary Go Microservice Scaffolder.",
5
5
  "main": "index.js",
6
6
  "type": "module",