@geekmidas/cli 0.0.4 → 0.0.6

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 ADDED
@@ -0,0 +1,667 @@
1
+ # @geekmidas/cli
2
+
3
+ A powerful CLI tool for building and managing TypeScript-based backend APIs with serverless deployment support. Generate AWS Lambda handlers, OpenAPI documentation, and server applications from your endpoint definitions.
4
+
5
+ ## Features
6
+
7
+ - **Multi-Provider Support**: Generate handlers for AWS Lambda (API Gateway v1/v2) and server applications
8
+ - **OpenAPI Generation**: Auto-generate OpenAPI 3.0 specifications from your endpoints
9
+ - **Type-Safe Configuration**: Configuration with TypeScript support and validation
10
+ - **Endpoint Auto-Discovery**: Automatically find and load endpoints from your codebase
11
+ - **Flexible Routing**: Support for glob patterns to discover route files
12
+ - **Environment Integration**: Seamless integration with @geekmidas/envkit for configuration
13
+ - **Logger Integration**: Built-in logging configuration and integration
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install @geekmidas/cli
19
+ ```
20
+
21
+ ### Global Installation
22
+
23
+ ```bash
24
+ npm install -g @geekmidas/cli
25
+ ```
26
+
27
+ ## Quick Start
28
+
29
+ ### 1. Create Configuration
30
+
31
+ Create a `gkm.config.ts` file in your project root:
32
+
33
+ ```typescript
34
+ import type { GkmConfig } from '@geekmidas/cli';
35
+
36
+ const config: GkmConfig = {
37
+ // Glob pattern to find endpoint files
38
+ routes: 'src/routes/**/*.ts',
39
+
40
+ // Environment parser configuration
41
+ envParser: './src/env.ts#envParser',
42
+
43
+ // Logger configuration
44
+ logger: './src/logger.ts#logger',
45
+ };
46
+
47
+ export default config;
48
+ ```
49
+
50
+ ### 2. Set Up Environment Parser
51
+
52
+ Create `src/env.ts`:
53
+
54
+ ```typescript
55
+ import { EnvironmentParser } from '@geekmidas/envkit';
56
+
57
+ export const envParser = new EnvironmentParser(process.env)
58
+ .create((get) => ({
59
+ database: {
60
+ url: get('DATABASE_URL').string().url(),
61
+ },
62
+ api: {
63
+ port: get('PORT').string().transform(Number).default('3000'),
64
+ },
65
+ aws: {
66
+ region: get('AWS_REGION').string().default('us-east-1'),
67
+ },
68
+ }))
69
+ .parse();
70
+ ```
71
+
72
+ ### 3. Set Up Logger
73
+
74
+ Create `src/logger.ts`:
75
+
76
+ ```typescript
77
+ import { ConsoleLogger } from '@geekmidas/api/logger';
78
+
79
+ export const logger = new ConsoleLogger({
80
+ level: process.env.LOG_LEVEL || 'info',
81
+ pretty: process.env.NODE_ENV !== 'production',
82
+ });
83
+ ```
84
+
85
+ ### 4. Create Endpoints
86
+
87
+ Create endpoint files in `src/routes/`:
88
+
89
+ ```typescript
90
+ // src/routes/users.ts
91
+ import { e } from '@geekmidas/api/server';
92
+ import { z } from 'zod';
93
+
94
+ export const getUsers = e
95
+ .get('/users')
96
+ .output(z.array(z.object({ id: z.string(), name: z.string() })))
97
+ .handle(async () => {
98
+ return [{ id: '1', name: 'John Doe' }];
99
+ });
100
+
101
+ export const createUser = e
102
+ .post('/users')
103
+ .body(z.object({ name: z.string() }))
104
+ .output(z.object({ id: z.string(), name: z.string() }))
105
+ .handle(async ({ body }) => {
106
+ return { id: '2', name: body.name };
107
+ });
108
+ ```
109
+
110
+ ### 5. Build Handlers
111
+
112
+ ```bash
113
+ # Generate AWS Lambda handlers
114
+ npx gkm build --provider aws-apigatewayv1
115
+
116
+ # Generate server application
117
+ npx gkm build --provider server
118
+
119
+ # Generate OpenAPI specification
120
+ npx gkm openapi --output api-docs.json
121
+ ```
122
+
123
+ ## CLI Commands
124
+
125
+ ### `gkm build`
126
+
127
+ Generate handlers from your endpoints.
128
+
129
+ ```bash
130
+ gkm build [options]
131
+ ```
132
+
133
+ **Options:**
134
+ - `--provider <provider>`: Target provider (default: `aws-apigatewayv1`)
135
+ - `aws-apigatewayv1`: AWS API Gateway v1 Lambda handlers
136
+ - `aws-apigatewayv2`: AWS API Gateway v2 Lambda handlers
137
+ - `server`: Server application with Hono
138
+
139
+ **Example:**
140
+ ```bash
141
+ # Generate AWS Lambda handlers
142
+ gkm build --provider aws-apigatewayv1
143
+
144
+ # Generate server application
145
+ gkm build --provider server
146
+ ```
147
+
148
+ ### `gkm openapi`
149
+
150
+ Generate OpenAPI 3.0 specification from your endpoints.
151
+
152
+ ```bash
153
+ gkm openapi [options]
154
+ ```
155
+
156
+ **Options:**
157
+ - `--output <path>`: Output file path (default: `openapi.json`)
158
+
159
+ **Example:**
160
+ ```bash
161
+ # Generate OpenAPI spec
162
+ gkm openapi --output docs/api.json
163
+ ```
164
+
165
+ ### Future Commands
166
+
167
+ The following commands are planned for future releases:
168
+
169
+ - `gkm cron`: Manage cron jobs
170
+ - `gkm function`: Manage serverless functions
171
+ - `gkm api`: Manage REST API endpoints
172
+
173
+ ## Configuration
174
+
175
+ ### Configuration File
176
+
177
+ The `gkm.config.ts` file defines how the CLI discovers and processes your endpoints:
178
+
179
+ ```typescript
180
+ interface GkmConfig {
181
+ routes: string | string[]; // Glob patterns for endpoint files
182
+ envParser: string; // Path to environment parser
183
+ logger: string; // Path to logger configuration
184
+ }
185
+ ```
186
+
187
+ ### Configuration Options
188
+
189
+ #### `routes`
190
+
191
+ Glob pattern(s) to discover endpoint files. Can be a single pattern or array of patterns.
192
+
193
+ ```typescript
194
+ // Single pattern
195
+ routes: 'src/routes/**/*.ts'
196
+
197
+ // Multiple patterns
198
+ routes: [
199
+ 'src/routes/**/*.ts',
200
+ 'src/api/**/*.ts',
201
+ 'src/handlers/**/*.ts'
202
+ ]
203
+ ```
204
+
205
+ #### `envParser`
206
+
207
+ Path to your environment parser configuration. Supports both default and named exports.
208
+
209
+ ```typescript
210
+ // Default export
211
+ envParser: './src/env.ts'
212
+
213
+ // Named export
214
+ envParser: './src/env.ts#envParser'
215
+
216
+ // Renamed export
217
+ envParser: './src/config.ts#environmentConfig'
218
+ ```
219
+
220
+ #### `logger`
221
+
222
+ Path to your logger configuration. Supports both default and named exports.
223
+
224
+ ```typescript
225
+ // Default export
226
+ logger: './src/logger.ts'
227
+
228
+ // Named export
229
+ logger: './src/logger.ts#logger'
230
+
231
+ // Renamed export
232
+ logger: './src/utils.ts#appLogger'
233
+ ```
234
+
235
+ ## Providers
236
+
237
+ ### AWS API Gateway v1
238
+
239
+ Generates Lambda handlers compatible with AWS API Gateway v1 (REST API).
240
+
241
+ ```bash
242
+ gkm build --provider aws-apigatewayv1
243
+ ```
244
+
245
+ **Generated Handler:**
246
+ ```typescript
247
+ import { AmazonApiGatewayV1Endpoint } from '@geekmidas/api/aws-apigateway';
248
+ import { myEndpoint } from '../src/routes/example.js';
249
+ import { envParser } from '../src/env.js';
250
+
251
+ const adapter = new AmazonApiGatewayV1Endpoint(envParser, myEndpoint);
252
+
253
+ export const handler = adapter.handler;
254
+ ```
255
+
256
+ ### AWS API Gateway v2
257
+
258
+ Generates Lambda handlers compatible with AWS API Gateway v2 (HTTP API).
259
+
260
+ ```bash
261
+ gkm build --provider aws-apigatewayv2
262
+ ```
263
+
264
+ **Generated Handler:**
265
+ ```typescript
266
+ import { AmazonApiGatewayV2Endpoint } from '@geekmidas/api/aws-apigateway';
267
+ import { myEndpoint } from '../src/routes/example.js';
268
+ import { envParser } from '../src/env.js';
269
+
270
+ const adapter = new AmazonApiGatewayV2Endpoint(envParser, myEndpoint);
271
+
272
+ export const handler = adapter.handler;
273
+ ```
274
+
275
+ ### Server
276
+
277
+ Generates a server application using Hono that can be deployed to any Node.js environment.
278
+
279
+ ```bash
280
+ gkm build --provider server
281
+ ```
282
+
283
+ **Generated Server:**
284
+ ```typescript
285
+ import { HonoEndpoint } from '@geekmidas/api/hono';
286
+ import { HermodServiceDiscovery } from '@geekmidas/api/services';
287
+ import { Hono } from 'hono';
288
+ import { envParser } from '../src/env.js';
289
+ import { logger } from '../src/logger.js';
290
+ import { getUsers, createUser } from '../src/routes/users.js';
291
+
292
+ export function createApp(app?: Hono): Hono {
293
+ const honoApp = app || new Hono();
294
+
295
+ const endpoints = [getUsers, createUser];
296
+
297
+ const serviceDiscovery = HermodServiceDiscovery.getInstance(
298
+ logger,
299
+ envParser
300
+ );
301
+
302
+ HonoEndpoint.addRoutes(endpoints, serviceDiscovery, honoApp);
303
+
304
+ return honoApp;
305
+ }
306
+
307
+ export default createApp;
308
+ ```
309
+
310
+ ## Output Structure
311
+
312
+ The CLI generates files in the `.gkm/<provider>` directory:
313
+
314
+ ```
315
+ .gkm/
316
+ ├── aws-apigatewayv1/
317
+ │ ├── getUsers.ts # Individual Lambda handler
318
+ │ ├── createUser.ts # Individual Lambda handler
319
+ │ └── routes.json # Routes manifest
320
+ ├── server/
321
+ │ ├── app.ts # Server application
322
+ │ └── routes.json # Routes manifest
323
+ └── openapi.json # OpenAPI specification
324
+ ```
325
+
326
+ ### Routes Manifest
327
+
328
+ Each provider generates a `routes.json` file with routing information:
329
+
330
+ ```json
331
+ {
332
+ "routes": [
333
+ {
334
+ "path": "/users",
335
+ "method": "GET",
336
+ "handler": ".gkm/aws-apigatewayv1/getUsers.handler"
337
+ },
338
+ {
339
+ "path": "/users",
340
+ "method": "POST",
341
+ "handler": ".gkm/aws-apigatewayv1/createUser.handler"
342
+ }
343
+ ]
344
+ }
345
+ ```
346
+
347
+ ## OpenAPI Generation
348
+
349
+ The CLI automatically generates OpenAPI 3.0 specifications from your endpoints:
350
+
351
+ ```bash
352
+ gkm openapi --output api-docs.json
353
+ ```
354
+
355
+ **Generated OpenAPI:**
356
+ ```json
357
+ {
358
+ "openapi": "3.0.0",
359
+ "info": {
360
+ "title": "API Documentation",
361
+ "version": "1.0.0",
362
+ "description": "Auto-generated API documentation from endpoints"
363
+ },
364
+ "paths": {
365
+ "/users": {
366
+ "get": {
367
+ "summary": "Get Users",
368
+ "responses": {
369
+ "200": {
370
+ "description": "Success",
371
+ "content": {
372
+ "application/json": {
373
+ "schema": {
374
+ "type": "array",
375
+ "items": {
376
+ "type": "object",
377
+ "properties": {
378
+ "id": { "type": "string" },
379
+ "name": { "type": "string" }
380
+ }
381
+ }
382
+ }
383
+ }
384
+ }
385
+ }
386
+ }
387
+ }
388
+ }
389
+ }
390
+ }
391
+ ```
392
+
393
+ ## Deployment Examples
394
+
395
+ ### AWS Lambda with Serverless Framework
396
+
397
+ ```yaml
398
+ # serverless.yml
399
+ service: my-api
400
+
401
+ provider:
402
+ name: aws
403
+ runtime: nodejs18.x
404
+
405
+ functions:
406
+ getUsers:
407
+ handler: .gkm/aws-apigatewayv1/getUsers.handler
408
+ events:
409
+ - http:
410
+ path: users
411
+ method: get
412
+
413
+ createUser:
414
+ handler: .gkm/aws-apigatewayv1/createUser.handler
415
+ events:
416
+ - http:
417
+ path: users
418
+ method: post
419
+ ```
420
+
421
+ ### Server Deployment
422
+
423
+ ```typescript
424
+ // server.ts
425
+ import { createApp } from './.gkm/server/app.js';
426
+
427
+ const app = createApp();
428
+
429
+ const port = process.env.PORT || 3000;
430
+ app.listen(port, () => {
431
+ console.log(`Server running on port ${port}`);
432
+ });
433
+ ```
434
+
435
+ ### Docker Deployment
436
+
437
+ ```dockerfile
438
+ FROM node:18-alpine
439
+
440
+ WORKDIR /app
441
+ COPY package*.json ./
442
+ RUN npm ci --only=production
443
+
444
+ COPY . .
445
+ RUN npm run build
446
+
447
+ EXPOSE 3000
448
+
449
+ CMD ["node", "server.js"]
450
+ ```
451
+
452
+ ## Advanced Usage
453
+
454
+ ### Custom Environment Parser
455
+
456
+ Create complex environment configurations:
457
+
458
+ ```typescript
459
+ // src/env.ts
460
+ import { EnvironmentParser } from '@geekmidas/envkit';
461
+
462
+ export const envParser = new EnvironmentParser(process.env)
463
+ .create((get) => ({
464
+ database: {
465
+ url: get('DATABASE_URL').string().url(),
466
+ ssl: get('DATABASE_SSL').string().transform(Boolean).default('false'),
467
+ maxConnections: get('DB_MAX_CONNECTIONS')
468
+ .string()
469
+ .transform(Number)
470
+ .default('10'),
471
+ },
472
+
473
+ redis: {
474
+ url: get('REDIS_URL').string().url(),
475
+ password: get('REDIS_PASSWORD').string().optional(),
476
+ },
477
+
478
+ aws: {
479
+ region: get('AWS_REGION').string().default('us-east-1'),
480
+ accessKeyId: get('AWS_ACCESS_KEY_ID').string().optional(),
481
+ secretAccessKey: get('AWS_SECRET_ACCESS_KEY').string().optional(),
482
+ },
483
+
484
+ auth: {
485
+ jwtSecret: get('JWT_SECRET').string(),
486
+ jwtExpiry: get('JWT_EXPIRY').string().default('24h'),
487
+ },
488
+ }))
489
+ .parse();
490
+ ```
491
+
492
+ ### Custom Logger Configuration
493
+
494
+ Set up structured logging with different levels:
495
+
496
+ ```typescript
497
+ // src/logger.ts
498
+ import { ConsoleLogger } from '@geekmidas/api/logger';
499
+
500
+ export const logger = new ConsoleLogger({
501
+ level: process.env.LOG_LEVEL || 'info',
502
+ pretty: process.env.NODE_ENV !== 'production',
503
+ context: {
504
+ service: 'my-api',
505
+ version: process.env.npm_package_version,
506
+ },
507
+ });
508
+
509
+ // Add custom log methods
510
+ logger.addMethod('audit', (message: string, data?: any) => {
511
+ logger.info(message, { type: 'audit', ...data });
512
+ });
513
+ ```
514
+
515
+ ### Multiple Route Patterns
516
+
517
+ Configure multiple patterns for complex project structures:
518
+
519
+ ```typescript
520
+ // gkm.config.ts
521
+ const config: GkmConfig = {
522
+ routes: [
523
+ 'src/routes/**/*.ts',
524
+ 'src/api/v1/**/*.ts',
525
+ 'src/api/v2/**/*.ts',
526
+ 'src/handlers/**/*.ts',
527
+ ],
528
+ envParser: './src/env.ts#envParser',
529
+ logger: './src/logger.ts#logger',
530
+ };
531
+ ```
532
+
533
+ ## Error Handling
534
+
535
+ The CLI provides detailed error messages for common issues:
536
+
537
+ ### Configuration Errors
538
+
539
+ ```bash
540
+ # Missing config file
541
+ Error: gkm.config.ts not found. Please create a configuration file.
542
+
543
+ # Invalid config
544
+ Error: Failed to load gkm.config.ts: Invalid configuration
545
+ ```
546
+
547
+ ### Build Errors
548
+
549
+ ```bash
550
+ # No endpoints found
551
+ No endpoints found to process
552
+
553
+ # Invalid provider
554
+ Error: Unsupported provider: invalid-provider
555
+ ```
556
+
557
+ ### OpenAPI Errors
558
+
559
+ ```bash
560
+ # Generation failure
561
+ Error: OpenAPI generation failed: Invalid endpoint schema
562
+ ```
563
+
564
+ ## Integration with Development Workflow
565
+
566
+ ### Package.json Scripts
567
+
568
+ ```json
569
+ {
570
+ "scripts": {
571
+ "build": "gkm build",
572
+ "build:lambda": "gkm build --provider aws-apigatewayv1",
573
+ "build:server": "gkm build --provider server",
574
+ "docs": "gkm openapi --output docs/api.json",
575
+ "dev": "npm run build:server && node server.js"
576
+ }
577
+ }
578
+ ```
579
+
580
+ ### CI/CD Pipeline
581
+
582
+ ```yaml
583
+ # .github/workflows/deploy.yml
584
+ name: Deploy API
585
+
586
+ on:
587
+ push:
588
+ branches: [main]
589
+
590
+ jobs:
591
+ deploy:
592
+ runs-on: ubuntu-latest
593
+
594
+ steps:
595
+ - uses: actions/checkout@v3
596
+
597
+ - name: Setup Node.js
598
+ uses: actions/setup-node@v3
599
+ with:
600
+ node-version: '18'
601
+
602
+ - name: Install dependencies
603
+ run: npm ci
604
+
605
+ - name: Build handlers
606
+ run: npm run build:lambda
607
+
608
+ - name: Deploy to AWS
609
+ run: npx serverless deploy
610
+ ```
611
+
612
+ ## Troubleshooting
613
+
614
+ ### Common Issues
615
+
616
+ 1. **Configuration not found**: Ensure `gkm.config.ts` is in your project root
617
+ 2. **No endpoints found**: Check your glob patterns in the config
618
+ 3. **Import errors**: Verify your environment parser and logger paths are correct
619
+ 4. **TypeScript errors**: Ensure your endpoints are properly typed
620
+
621
+ ### Debug Mode
622
+
623
+ Enable verbose logging by setting the environment variable:
624
+
625
+ ```bash
626
+ DEBUG=gkm:* npx gkm build
627
+ ```
628
+
629
+ ## API Reference
630
+
631
+ ### Types
632
+
633
+ ```typescript
634
+ // Provider options
635
+ type Provider = 'server' | 'aws-apigatewayv1' | 'aws-apigatewayv2';
636
+
637
+ // Configuration interface
638
+ interface GkmConfig {
639
+ routes: string | string[];
640
+ envParser: string;
641
+ logger: string;
642
+ }
643
+
644
+ // Build options
645
+ interface BuildOptions {
646
+ provider: Provider;
647
+ }
648
+
649
+ // Route information
650
+ interface RouteInfo {
651
+ path: string;
652
+ method: string;
653
+ handler: string;
654
+ }
655
+ ```
656
+
657
+ ## Contributing
658
+
659
+ 1. Follow the existing code style (2 spaces, single quotes, semicolons)
660
+ 2. Add tests for new features
661
+ 3. Update documentation for API changes
662
+ 4. Use semantic commit messages
663
+ 5. Ensure all commands work across different providers
664
+
665
+ ## License
666
+
667
+ MIT License - see the LICENSE file for details.
@@ -1,4 +1,4 @@
1
- import { loadConfig } from "./config-Bzzc89wR.mjs";
1
+ import { loadConfig } from "./config-DV1Lwdkx.mjs";
2
2
  import { loadEndpoints } from "./loadEndpoints-BL8q2rTO.mjs";
3
3
  import { mkdir, writeFile } from "node:fs/promises";
4
4
  import { dirname, join, relative } from "path";
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_config = require('./config-B-D8cs7V.cjs');
2
+ const require_config = require('./config-D8AyiwBU.cjs');
3
3
  const require_loadEndpoints = require('./loadEndpoints-CYFwuPZr.cjs');
4
4
  const node_fs_promises = require_chunk.__toESM(require("node:fs/promises"));
5
5
  const path = require_chunk.__toESM(require("path"));
package/dist/build.cjs CHANGED
@@ -1,5 +1,5 @@
1
- require('./config-B-D8cs7V.cjs');
1
+ require('./config-D8AyiwBU.cjs');
2
2
  require('./loadEndpoints-CYFwuPZr.cjs');
3
- const require_build = require('./build-DNUd8HBL.cjs');
3
+ const require_build = require('./build-D-BARm12.cjs');
4
4
 
5
5
  exports.buildCommand = require_build.buildCommand;
package/dist/build.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import "./config-Bzzc89wR.mjs";
1
+ import "./config-DV1Lwdkx.mjs";
2
2
  import "./loadEndpoints-BL8q2rTO.mjs";
3
- import { buildCommand } from "./build-SdnSQPW7.mjs";
3
+ import { buildCommand } from "./build-9GDXFoAL.mjs";
4
4
 
5
5
  export { buildCommand };
@@ -1,5 +1,5 @@
1
- import { buildCommand } from "./build-SdnSQPW7.mjs";
2
- import { openapiCommand } from "./openapi-DLix_iqn.mjs";
1
+ import { buildCommand } from "./build-9GDXFoAL.mjs";
2
+ import { openapiCommand } from "./openapi-CVu3aUU8.mjs";
3
3
  import { Command } from "commander";
4
4
 
5
5
  //#region src/cli.ts
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_build = require('./build-DNUd8HBL.cjs');
3
- const require_openapi = require('./openapi-BKjcm03Q.cjs');
2
+ const require_build = require('./build-D-BARm12.cjs');
3
+ const require_openapi = require('./openapi-DD-MfKrj.cjs');
4
4
  const commander = require_chunk.__toESM(require("commander"));
5
5
 
6
6
  //#region src/cli.ts
package/dist/cli.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- require('./config-B-D8cs7V.cjs');
2
+ require('./config-D8AyiwBU.cjs');
3
3
  require('./loadEndpoints-CYFwuPZr.cjs');
4
- require('./build-DNUd8HBL.cjs');
5
- require('./openapi-BKjcm03Q.cjs');
6
- require('./cli-DkqbpY0m.cjs');
4
+ require('./build-D-BARm12.cjs');
5
+ require('./openapi-DD-MfKrj.cjs');
6
+ require('./cli-Ds4QRE7D.cjs');
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import "./config-Bzzc89wR.mjs";
2
+ import "./config-DV1Lwdkx.mjs";
3
3
  import "./loadEndpoints-BL8q2rTO.mjs";
4
- import "./build-SdnSQPW7.mjs";
5
- import "./openapi-DLix_iqn.mjs";
6
- import "./cli-CfgR8d0p.mjs";
4
+ import "./build-9GDXFoAL.mjs";
5
+ import "./openapi-CVu3aUU8.mjs";
6
+ import "./cli-BHw52b-8.mjs";
@@ -4,8 +4,8 @@ const fs = require_chunk.__toESM(require("fs"));
4
4
 
5
5
  //#region src/config.ts
6
6
  async function loadConfig() {
7
- const configPath = (0, path.join)(process.cwd(), "gkm.config.ts");
8
- if (!(0, fs.existsSync)(configPath)) throw new Error("gkm.config.ts not found. Please create a configuration file.");
7
+ const configPath = (0, path.join)(process.cwd(), "gkm.config.json");
8
+ if (!(0, fs.existsSync)(configPath)) throw new Error("gkm.config.json not found. Please create a configuration file.");
9
9
  try {
10
10
  const config = await import(configPath);
11
11
  return config.default || config;
@@ -3,8 +3,8 @@ import { existsSync } from "fs";
3
3
 
4
4
  //#region src/config.ts
5
5
  async function loadConfig() {
6
- const configPath = join(process.cwd(), "gkm.config.ts");
7
- if (!existsSync(configPath)) throw new Error("gkm.config.ts not found. Please create a configuration file.");
6
+ const configPath = join(process.cwd(), "gkm.config.json");
7
+ if (!existsSync(configPath)) throw new Error("gkm.config.json not found. Please create a configuration file.");
8
8
  try {
9
9
  const config = await import(configPath);
10
10
  return config.default || config;
package/dist/config.cjs CHANGED
@@ -1,3 +1,3 @@
1
- const require_config = require('./config-B-D8cs7V.cjs');
1
+ const require_config = require('./config-D8AyiwBU.cjs');
2
2
 
3
3
  exports.loadConfig = require_config.loadConfig;
package/dist/config.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { loadConfig } from "./config-Bzzc89wR.mjs";
1
+ import { loadConfig } from "./config-DV1Lwdkx.mjs";
2
2
 
3
3
  export { loadConfig };
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env -S npx tsx
2
- require('./config-B-D8cs7V.cjs');
2
+ require('./config-D8AyiwBU.cjs');
3
3
  require('./loadEndpoints-CYFwuPZr.cjs');
4
- require('./build-DNUd8HBL.cjs');
5
- require('./openapi-BKjcm03Q.cjs');
6
- require('./cli-DkqbpY0m.cjs');
4
+ require('./build-D-BARm12.cjs');
5
+ require('./openapi-DD-MfKrj.cjs');
6
+ require('./cli-Ds4QRE7D.cjs');
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env -S npx tsx
2
- import "./config-Bzzc89wR.mjs";
2
+ import "./config-DV1Lwdkx.mjs";
3
3
  import "./loadEndpoints-BL8q2rTO.mjs";
4
- import "./build-SdnSQPW7.mjs";
5
- import "./openapi-DLix_iqn.mjs";
6
- import "./cli-CfgR8d0p.mjs";
4
+ import "./build-9GDXFoAL.mjs";
5
+ import "./openapi-CVu3aUU8.mjs";
6
+ import "./cli-BHw52b-8.mjs";
@@ -1,4 +1,4 @@
1
- import { loadConfig } from "./config-Bzzc89wR.mjs";
1
+ import { loadConfig } from "./config-DV1Lwdkx.mjs";
2
2
  import { loadEndpoints } from "./loadEndpoints-BL8q2rTO.mjs";
3
3
  import { mkdir, writeFile } from "node:fs/promises";
4
4
  import { Endpoint } from "@geekmidas/api/server";
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_config = require('./config-B-D8cs7V.cjs');
2
+ const require_config = require('./config-D8AyiwBU.cjs');
3
3
  const require_loadEndpoints = require('./loadEndpoints-CYFwuPZr.cjs');
4
4
  const node_fs_promises = require_chunk.__toESM(require("node:fs/promises"));
5
5
  const __geekmidas_api_server = require_chunk.__toESM(require("@geekmidas/api/server"));
package/dist/openapi.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env -S npx tsx
2
- require('./config-B-D8cs7V.cjs');
2
+ require('./config-D8AyiwBU.cjs');
3
3
  require('./loadEndpoints-CYFwuPZr.cjs');
4
- const require_openapi = require('./openapi-BKjcm03Q.cjs');
4
+ const require_openapi = require('./openapi-DD-MfKrj.cjs');
5
5
 
6
6
  exports.openapiCommand = require_openapi.openapiCommand;
package/dist/openapi.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env -S npx tsx
2
- import "./config-Bzzc89wR.mjs";
2
+ import "./config-DV1Lwdkx.mjs";
3
3
  import "./loadEndpoints-BL8q2rTO.mjs";
4
- import { openapiCommand } from "./openapi-DLix_iqn.mjs";
4
+ import { openapiCommand } from "./openapi-CVu3aUU8.mjs";
5
5
 
6
6
  export { openapiCommand };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@geekmidas/cli",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
7
- "gkm": "./dist/index.mjs"
7
+ "gkm": "./src/index.ts"
8
8
  },
9
9
  "exports": {
10
10
  ".": {
@@ -23,7 +23,7 @@
23
23
  "lodash.set": "~4.3.2",
24
24
  "zod": "~3.25.67",
25
25
  "fast-glob": "~3.3.3",
26
- "@geekmidas/api": "0.0.5"
26
+ "@geekmidas/api": "0.0.16"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/lodash.get": "~4.4.9",
package/src/config.ts CHANGED
@@ -3,11 +3,11 @@ import { join } from 'path';
3
3
  import type { GkmConfig } from './types.js';
4
4
 
5
5
  export async function loadConfig(): Promise<GkmConfig> {
6
- const configPath = join(process.cwd(), 'gkm.config.ts');
6
+ const configPath = join(process.cwd(), 'gkm.config.json');
7
7
 
8
8
  if (!existsSync(configPath)) {
9
9
  throw new Error(
10
- 'gkm.config.ts not found. Please create a configuration file.',
10
+ 'gkm.config.json not found. Please create a configuration file.',
11
11
  );
12
12
  }
13
13
 
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env -S npx tsx
2
2
 
3
- import './cli.js';
3
+ import './cli.ts';
4
4
 
5
5
  // Export types for user configuration
6
- export type { GkmConfig, Provider, BuildOptions } from './types.js';
6
+ export type { GkmConfig, Provider, BuildOptions } from './types.ts';