@geekmidas/cli 1.10.20 → 1.10.21
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/CHANGELOG.md +6 -0
- package/dist/index.cjs +69 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +69 -37
- package/dist/index.mjs.map +1 -1
- package/dist/{openapi-kvwpKbNe.mjs → openapi-DnIYqDH3.mjs} +5 -3
- package/dist/openapi-DnIYqDH3.mjs.map +1 -0
- package/dist/{openapi-CsCNpSf8.cjs → openapi-N_iCUhJU.cjs} +5 -3
- package/dist/openapi-N_iCUhJU.cjs.map +1 -0
- package/dist/openapi.cjs +1 -1
- package/dist/openapi.mjs +1 -1
- package/package.json +3 -3
- package/src/credentials/index.ts +2 -5
- package/src/debug.ts +68 -0
- package/src/dev/index.ts +5 -1
- package/src/generators/Generator.ts +6 -4
- package/src/index.ts +36 -52
- package/src/init/versions.ts +2 -2
- package/dist/openapi-CsCNpSf8.cjs.map +0 -1
- package/dist/openapi-kvwpKbNe.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @geekmidas/cli
|
|
2
2
|
|
|
3
|
+
## 1.10.21
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ✨ [`9b56519`](https://github.com/geekmidas/toolbox/commit/9b5651989ccd1ca55c8b7150647c850eda056213) Thanks [@geekmidas](https://github.com/geekmidas)! - Add debugging and complete traces
|
|
8
|
+
|
|
3
9
|
## 1.10.20
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ const require_workspace = require('./workspace-4SP3Gx4Y.cjs');
|
|
|
4
4
|
const require_config = require('./config-D3ORuiUs.cjs');
|
|
5
5
|
const require_credentials = require('./credentials-C8DWtnMY.cjs');
|
|
6
6
|
const require_storage = require('./storage-DLEb8Dkd.cjs');
|
|
7
|
-
const require_openapi = require('./openapi-
|
|
7
|
+
const require_openapi = require('./openapi-N_iCUhJU.cjs');
|
|
8
8
|
const require_dokploy_api = require('./dokploy-api-DLgvEQlr.cjs');
|
|
9
9
|
const require_encryption = require('./encryption-BE0UOb8j.cjs');
|
|
10
10
|
const require_CachedStateProvider = require('./CachedStateProvider-D73dCqfH.cjs');
|
|
@@ -35,7 +35,7 @@ const prompts = require_chunk.__toESM(require("prompts"));
|
|
|
35
35
|
|
|
36
36
|
//#region package.json
|
|
37
37
|
var name = "@geekmidas/cli";
|
|
38
|
-
var version = "1.10.
|
|
38
|
+
var version = "1.10.20";
|
|
39
39
|
var description = "CLI tools for building Lambda handlers, server applications, and generating OpenAPI specs";
|
|
40
40
|
var private$1 = false;
|
|
41
41
|
var type = "module";
|
|
@@ -740,8 +740,7 @@ async function prepareEntryCredentials(options) {
|
|
|
740
740
|
workspaceAppPort = appInfo.app.port;
|
|
741
741
|
secretsRoot = appInfo.workspaceRoot;
|
|
742
742
|
appName = appInfo.appName;
|
|
743
|
-
} catch
|
|
744
|
-
logger$13.log(`⚠️ Could not load workspace config: ${error.message}`);
|
|
743
|
+
} catch {
|
|
745
744
|
secretsRoot = findSecretsRoot(cwd);
|
|
746
745
|
appName = require_config.getAppNameFromCwd(cwd) ?? void 0;
|
|
747
746
|
}
|
|
@@ -1398,7 +1397,9 @@ async function devCommand(options) {
|
|
|
1398
1397
|
logger$11.log("✅ Rebuild complete, restarting server...");
|
|
1399
1398
|
await devServer.restart();
|
|
1400
1399
|
} catch (error) {
|
|
1401
|
-
|
|
1400
|
+
const err = error;
|
|
1401
|
+
logger$11.error(`❌ Rebuild failed: ${err.message}`);
|
|
1402
|
+
if (err.stack) logger$11.error(err.stack);
|
|
1402
1403
|
}
|
|
1403
1404
|
}, 300);
|
|
1404
1405
|
});
|
|
@@ -2410,6 +2411,34 @@ function assembleManifestField(infos, constructs) {
|
|
|
2410
2411
|
return groupInfosByPartition(infos, constructs);
|
|
2411
2412
|
}
|
|
2412
2413
|
|
|
2414
|
+
//#endregion
|
|
2415
|
+
//#region src/debug.ts
|
|
2416
|
+
let _debug = false;
|
|
2417
|
+
/**
|
|
2418
|
+
* Enable debug mode globally.
|
|
2419
|
+
* When enabled, verbose error details are shown everywhere.
|
|
2420
|
+
*/
|
|
2421
|
+
function enableDebug() {
|
|
2422
|
+
_debug = true;
|
|
2423
|
+
}
|
|
2424
|
+
/**
|
|
2425
|
+
* Format a fatal error for display.
|
|
2426
|
+
* Always includes the full stack trace since these are process-ending errors.
|
|
2427
|
+
*/
|
|
2428
|
+
function formatError(error) {
|
|
2429
|
+
if (!(error instanceof Error)) return String(error);
|
|
2430
|
+
let output$2 = error.stack ?? error.message;
|
|
2431
|
+
let cause = error.cause;
|
|
2432
|
+
while (cause) if (cause instanceof Error) {
|
|
2433
|
+
output$2 += `\n\nCaused by: ${cause.stack ?? cause.message}`;
|
|
2434
|
+
cause = cause.cause;
|
|
2435
|
+
} else {
|
|
2436
|
+
output$2 += `\n\nCaused by: ${String(cause)}`;
|
|
2437
|
+
break;
|
|
2438
|
+
}
|
|
2439
|
+
return output$2;
|
|
2440
|
+
}
|
|
2441
|
+
|
|
2413
2442
|
//#endregion
|
|
2414
2443
|
//#region src/deploy/state.ts
|
|
2415
2444
|
/**
|
|
@@ -6799,9 +6828,9 @@ const GEEKMIDAS_VERSIONS = {
|
|
|
6799
6828
|
"@geekmidas/audit": "~2.0.0",
|
|
6800
6829
|
"@geekmidas/auth": "~2.0.0",
|
|
6801
6830
|
"@geekmidas/cache": "~1.1.0",
|
|
6802
|
-
"@geekmidas/client": "~4.0.
|
|
6831
|
+
"@geekmidas/client": "~4.0.1",
|
|
6803
6832
|
"@geekmidas/cloud": "~1.0.0",
|
|
6804
|
-
"@geekmidas/constructs": "~3.0.
|
|
6833
|
+
"@geekmidas/constructs": "~3.0.3",
|
|
6805
6834
|
"@geekmidas/db": "~1.0.1",
|
|
6806
6835
|
"@geekmidas/emailkit": "~1.0.0",
|
|
6807
6836
|
"@geekmidas/envkit": "~1.0.4",
|
|
@@ -12151,14 +12180,17 @@ function executeUpgrade(upgradable, pm, cwd) {
|
|
|
12151
12180
|
//#endregion
|
|
12152
12181
|
//#region src/index.ts
|
|
12153
12182
|
const program = new commander.Command();
|
|
12154
|
-
program.name("gkm").description("GeekMidas backend framework CLI").version(package_default.version).option("--cwd <path>", "Change working directory")
|
|
12183
|
+
program.name("gkm").description("GeekMidas backend framework CLI").version(package_default.version).option("--cwd <path>", "Change working directory").option("--debug", "Enable debug mode (verbose errors with stack traces)").hook("preAction", () => {
|
|
12184
|
+
const opts = program.opts();
|
|
12185
|
+
if (opts.debug) enableDebug();
|
|
12186
|
+
});
|
|
12155
12187
|
program.command("init").description("Scaffold a new project").argument("[name]", "Project name").option("--template <template>", "Project template (minimal, api, serverless, worker)").option("--skip-install", "Skip dependency installation", false).option("-y, --yes", "Skip prompts, use defaults", false).option("--monorepo", "Setup as monorepo with packages/models", false).option("--api-path <path>", "API app path in monorepo (default: apps/api)").option("--pm <manager>", "Package manager (pnpm, npm, yarn, bun)").action(async (name$1, options) => {
|
|
12156
12188
|
try {
|
|
12157
12189
|
const globalOptions = program.opts();
|
|
12158
12190
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
12159
12191
|
await initCommand(name$1, options);
|
|
12160
12192
|
} catch (error) {
|
|
12161
|
-
console.error(error
|
|
12193
|
+
console.error(formatError(error));
|
|
12162
12194
|
process.exit(1);
|
|
12163
12195
|
}
|
|
12164
12196
|
});
|
|
@@ -12168,7 +12200,7 @@ program.command("setup").description("Setup development environment (secrets, Do
|
|
|
12168
12200
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
12169
12201
|
await setupCommand(options);
|
|
12170
12202
|
} catch (error) {
|
|
12171
|
-
console.error(error
|
|
12203
|
+
console.error(formatError(error));
|
|
12172
12204
|
process.exit(1);
|
|
12173
12205
|
}
|
|
12174
12206
|
});
|
|
@@ -12201,7 +12233,7 @@ program.command("build").description("Build handlers from endpoints, functions,
|
|
|
12201
12233
|
stage: options.stage
|
|
12202
12234
|
});
|
|
12203
12235
|
} catch (error) {
|
|
12204
|
-
console.error(error
|
|
12236
|
+
console.error(formatError(error));
|
|
12205
12237
|
process.exit(1);
|
|
12206
12238
|
}
|
|
12207
12239
|
});
|
|
@@ -12217,7 +12249,7 @@ program.command("dev").description("Start development server with automatic relo
|
|
|
12217
12249
|
watch: options.watch
|
|
12218
12250
|
});
|
|
12219
12251
|
} catch (error) {
|
|
12220
|
-
console.error(error
|
|
12252
|
+
console.error(formatError(error));
|
|
12221
12253
|
process.exit(1);
|
|
12222
12254
|
}
|
|
12223
12255
|
});
|
|
@@ -12227,7 +12259,7 @@ program.command("exec").description("Run a command with secrets injected into Cr
|
|
|
12227
12259
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
12228
12260
|
await execCommand(commandArgs);
|
|
12229
12261
|
} catch (error) {
|
|
12230
|
-
console.error(error
|
|
12262
|
+
console.error(formatError(error));
|
|
12231
12263
|
process.exit(1);
|
|
12232
12264
|
}
|
|
12233
12265
|
});
|
|
@@ -12240,7 +12272,7 @@ program.command("test").description("Run tests with secrets loaded from environm
|
|
|
12240
12272
|
pattern
|
|
12241
12273
|
});
|
|
12242
12274
|
} catch (error) {
|
|
12243
|
-
console.error(error
|
|
12275
|
+
console.error(formatError(error));
|
|
12244
12276
|
process.exit(1);
|
|
12245
12277
|
}
|
|
12246
12278
|
});
|
|
@@ -12265,7 +12297,7 @@ program.command("openapi").description("Generate OpenAPI specification from endp
|
|
|
12265
12297
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
12266
12298
|
await require_openapi.openapiCommand({});
|
|
12267
12299
|
} catch (error) {
|
|
12268
|
-
console.error(error
|
|
12300
|
+
console.error(formatError(error));
|
|
12269
12301
|
process.exit(1);
|
|
12270
12302
|
}
|
|
12271
12303
|
});
|
|
@@ -12275,7 +12307,7 @@ program.command("generate:react-query").description("Generate React Query hooks
|
|
|
12275
12307
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
12276
12308
|
await require_openapi_react_query.generateReactQueryCommand(options);
|
|
12277
12309
|
} catch (error) {
|
|
12278
|
-
console.error(error
|
|
12310
|
+
console.error(formatError(error));
|
|
12279
12311
|
process.exit(1);
|
|
12280
12312
|
}
|
|
12281
12313
|
});
|
|
@@ -12285,7 +12317,7 @@ program.command("docker").description("Generate Docker deployment files").option
|
|
|
12285
12317
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
12286
12318
|
await dockerCommand(options);
|
|
12287
12319
|
} catch (error) {
|
|
12288
|
-
console.error(error
|
|
12320
|
+
console.error(formatError(error));
|
|
12289
12321
|
process.exit(1);
|
|
12290
12322
|
}
|
|
12291
12323
|
});
|
|
@@ -12314,7 +12346,7 @@ program.command("prepack").description("Generate Docker files for production dep
|
|
|
12314
12346
|
const _imageRef = registry ? `${registry}/api:${tag}` : `api:${tag}`;
|
|
12315
12347
|
}
|
|
12316
12348
|
} catch (error) {
|
|
12317
|
-
console.error(error
|
|
12349
|
+
console.error(formatError(error));
|
|
12318
12350
|
process.exit(1);
|
|
12319
12351
|
}
|
|
12320
12352
|
});
|
|
@@ -12324,7 +12356,7 @@ program.command("secrets:init").description("Initialize secrets for a deployment
|
|
|
12324
12356
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
12325
12357
|
await secretsInitCommand(options);
|
|
12326
12358
|
} catch (error) {
|
|
12327
|
-
console.error(error
|
|
12359
|
+
console.error(formatError(error));
|
|
12328
12360
|
process.exit(1);
|
|
12329
12361
|
}
|
|
12330
12362
|
});
|
|
@@ -12334,7 +12366,7 @@ program.command("secrets:set").description("Set a custom secret for a stage").ar
|
|
|
12334
12366
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
12335
12367
|
await secretsSetCommand(key, value, options);
|
|
12336
12368
|
} catch (error) {
|
|
12337
|
-
console.error(error
|
|
12369
|
+
console.error(formatError(error));
|
|
12338
12370
|
process.exit(1);
|
|
12339
12371
|
}
|
|
12340
12372
|
});
|
|
@@ -12344,7 +12376,7 @@ program.command("secrets:show").description("Show secrets for a stage").required
|
|
|
12344
12376
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
12345
12377
|
await secretsShowCommand(options);
|
|
12346
12378
|
} catch (error) {
|
|
12347
|
-
console.error(error
|
|
12379
|
+
console.error(formatError(error));
|
|
12348
12380
|
process.exit(1);
|
|
12349
12381
|
}
|
|
12350
12382
|
});
|
|
@@ -12354,7 +12386,7 @@ program.command("secrets:rotate").description("Rotate service passwords").requir
|
|
|
12354
12386
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
12355
12387
|
await secretsRotateCommand(options);
|
|
12356
12388
|
} catch (error) {
|
|
12357
|
-
console.error(error
|
|
12389
|
+
console.error(formatError(error));
|
|
12358
12390
|
process.exit(1);
|
|
12359
12391
|
}
|
|
12360
12392
|
});
|
|
@@ -12364,7 +12396,7 @@ program.command("secrets:import").description("Import secrets from a JSON file")
|
|
|
12364
12396
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
12365
12397
|
await secretsImportCommand(file, options);
|
|
12366
12398
|
} catch (error) {
|
|
12367
|
-
console.error(error
|
|
12399
|
+
console.error(formatError(error));
|
|
12368
12400
|
process.exit(1);
|
|
12369
12401
|
}
|
|
12370
12402
|
});
|
|
@@ -12389,7 +12421,7 @@ program.command("secrets:push").description("Push secrets to remote provider (SS
|
|
|
12389
12421
|
await pushSecrets$1(options.stage, workspace);
|
|
12390
12422
|
console.log(`\n✓ Secrets pushed for stage "${options.stage}"`);
|
|
12391
12423
|
} catch (error) {
|
|
12392
|
-
console.error(error
|
|
12424
|
+
console.error(formatError(error));
|
|
12393
12425
|
process.exit(1);
|
|
12394
12426
|
}
|
|
12395
12427
|
});
|
|
@@ -12416,7 +12448,7 @@ program.command("secrets:pull").description("Pull secrets from remote provider (
|
|
|
12416
12448
|
await writeStageSecrets$1(secrets, workspace.root);
|
|
12417
12449
|
console.log(`\n✓ Secrets pulled for stage "${options.stage}"`);
|
|
12418
12450
|
} catch (error) {
|
|
12419
|
-
console.error(error
|
|
12451
|
+
console.error(formatError(error));
|
|
12420
12452
|
process.exit(1);
|
|
12421
12453
|
}
|
|
12422
12454
|
});
|
|
@@ -12442,7 +12474,7 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
|
|
|
12442
12474
|
console.log(`\n✓ Reconciled ${result.addedKeys.length} missing secret(s) for stage "${options.stage}":`);
|
|
12443
12475
|
for (const key of result.addedKeys) console.log(` + ${key}`);
|
|
12444
12476
|
} catch (error) {
|
|
12445
|
-
console.error(error
|
|
12477
|
+
console.error(formatError(error));
|
|
12446
12478
|
process.exit(1);
|
|
12447
12479
|
}
|
|
12448
12480
|
});
|
|
@@ -12467,7 +12499,7 @@ program.command("deploy").description("Deploy application to a provider").requir
|
|
|
12467
12499
|
skipBuild: options.skipBuild
|
|
12468
12500
|
});
|
|
12469
12501
|
} catch (error) {
|
|
12470
|
-
console.error(error
|
|
12502
|
+
console.error(formatError(error));
|
|
12471
12503
|
process.exit(1);
|
|
12472
12504
|
}
|
|
12473
12505
|
});
|
|
@@ -12483,7 +12515,7 @@ program.command("deploy:init").description("Initialize Dokploy deployment (creat
|
|
|
12483
12515
|
registryId: options.registryId
|
|
12484
12516
|
});
|
|
12485
12517
|
} catch (error) {
|
|
12486
|
-
console.error(error
|
|
12518
|
+
console.error(formatError(error));
|
|
12487
12519
|
process.exit(1);
|
|
12488
12520
|
}
|
|
12489
12521
|
});
|
|
@@ -12510,7 +12542,7 @@ program.command("deploy:list").description("List Dokploy resources (projects, re
|
|
|
12510
12542
|
});
|
|
12511
12543
|
}
|
|
12512
12544
|
} catch (error) {
|
|
12513
|
-
console.error(error
|
|
12545
|
+
console.error(formatError(error));
|
|
12514
12546
|
process.exit(1);
|
|
12515
12547
|
}
|
|
12516
12548
|
});
|
|
@@ -12528,7 +12560,7 @@ program.command("login").description("Authenticate with a deployment service").o
|
|
|
12528
12560
|
endpoint: options.endpoint
|
|
12529
12561
|
});
|
|
12530
12562
|
} catch (error) {
|
|
12531
|
-
console.error(error
|
|
12563
|
+
console.error(formatError(error));
|
|
12532
12564
|
process.exit(1);
|
|
12533
12565
|
}
|
|
12534
12566
|
});
|
|
@@ -12538,7 +12570,7 @@ program.command("logout").description("Remove stored credentials").option("--ser
|
|
|
12538
12570
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
12539
12571
|
await logoutCommand({ service: options.service });
|
|
12540
12572
|
} catch (error) {
|
|
12541
|
-
console.error(error
|
|
12573
|
+
console.error(formatError(error));
|
|
12542
12574
|
process.exit(1);
|
|
12543
12575
|
}
|
|
12544
12576
|
});
|
|
@@ -12548,7 +12580,7 @@ program.command("whoami").description("Show current authentication status").acti
|
|
|
12548
12580
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
12549
12581
|
await whoamiCommand();
|
|
12550
12582
|
} catch (error) {
|
|
12551
|
-
console.error(error
|
|
12583
|
+
console.error(formatError(error));
|
|
12552
12584
|
process.exit(1);
|
|
12553
12585
|
}
|
|
12554
12586
|
});
|
|
@@ -12558,7 +12590,7 @@ program.command("state:pull").description("Pull deployment state from remote to
|
|
|
12558
12590
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
12559
12591
|
await statePullCommand(options);
|
|
12560
12592
|
} catch (error) {
|
|
12561
|
-
console.error(error
|
|
12593
|
+
console.error(formatError(error));
|
|
12562
12594
|
process.exit(1);
|
|
12563
12595
|
}
|
|
12564
12596
|
});
|
|
@@ -12568,7 +12600,7 @@ program.command("state:push").description("Push deployment state from local to r
|
|
|
12568
12600
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
12569
12601
|
await statePushCommand(options);
|
|
12570
12602
|
} catch (error) {
|
|
12571
|
-
console.error(error
|
|
12603
|
+
console.error(formatError(error));
|
|
12572
12604
|
process.exit(1);
|
|
12573
12605
|
}
|
|
12574
12606
|
});
|
|
@@ -12578,7 +12610,7 @@ program.command("state:show").description("Show deployment state for a stage").r
|
|
|
12578
12610
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
12579
12611
|
await stateShowCommand(options);
|
|
12580
12612
|
} catch (error) {
|
|
12581
|
-
console.error(error
|
|
12613
|
+
console.error(formatError(error));
|
|
12582
12614
|
process.exit(1);
|
|
12583
12615
|
}
|
|
12584
12616
|
});
|
|
@@ -12588,7 +12620,7 @@ program.command("state:diff").description("Compare local and remote deployment s
|
|
|
12588
12620
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
12589
12621
|
await stateDiffCommand(options);
|
|
12590
12622
|
} catch (error) {
|
|
12591
|
-
console.error(error
|
|
12623
|
+
console.error(formatError(error));
|
|
12592
12624
|
process.exit(1);
|
|
12593
12625
|
}
|
|
12594
12626
|
});
|
|
@@ -12598,7 +12630,7 @@ program.command("upgrade").description("Upgrade all @geekmidas packages to their
|
|
|
12598
12630
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
12599
12631
|
await upgradeCommand(options);
|
|
12600
12632
|
} catch (error) {
|
|
12601
|
-
console.error(error
|
|
12633
|
+
console.error(formatError(error));
|
|
12602
12634
|
process.exit(1);
|
|
12603
12635
|
}
|
|
12604
12636
|
});
|