@pd4castr/cli 0.0.6 → 0.0.8

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 (2) hide show
  1. package/dist/index.js +44 -22
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -63,6 +63,7 @@ var WSL_NETWORK_INTERFACE_DEFAULT = "eth0";
63
63
 
64
64
  // src/commands/fetch/handle-action.ts
65
65
  import path5 from "path";
66
+ import { ExecaError } from "execa";
66
67
  import { HTTPError } from "ky";
67
68
  import ora from "ora";
68
69
  import { ZodError as ZodError2 } from "zod";
@@ -347,9 +348,11 @@ ${link} to view fetched data
347
348
  spinner.fail(formatNestErrorMessage(errorResponse));
348
349
  } else if (error instanceof Error) {
349
350
  spinner.fail(error.message);
350
- if (error.cause) {
351
- console.error(error.cause);
352
- }
351
+ }
352
+ if (error instanceof Error && error.cause instanceof ExecaError) {
353
+ console.error(error.cause.shortMessage);
354
+ } else if (error instanceof Error && error.cause) {
355
+ console.error(error.cause);
353
356
  }
354
357
  process.exit(1);
355
358
  }
@@ -367,6 +370,7 @@ function registerFetchCommand(program2) {
367
370
  // src/commands/init/handle-action.ts
368
371
  import path6 from "path";
369
372
  import * as inquirer from "@inquirer/prompts";
373
+ import { ExecaError as ExecaError2 } from "execa";
370
374
  import ora2 from "ora";
371
375
  import tiged from "tiged";
372
376
 
@@ -418,7 +422,9 @@ async function handleAction2() {
418
422
  spinner.succeed("Template fetched successfully");
419
423
  } catch (error) {
420
424
  spinner.fail("Error fetching template");
421
- if (error instanceof Error && error.cause) {
425
+ if (error instanceof Error && error.cause instanceof ExecaError2) {
426
+ console.error(error.cause.shortMessage);
427
+ } else if (error instanceof Error && error.cause) {
422
428
  console.error(error.cause);
423
429
  }
424
430
  process.exit(1);
@@ -440,6 +446,7 @@ function registerInitCommand(program2) {
440
446
  }
441
447
 
442
448
  // src/commands/login/handle-action.ts
449
+ import { ExecaError as ExecaError3 } from "execa";
443
450
  import ora3 from "ora";
444
451
  import { ZodError as ZodError3 } from "zod";
445
452
 
@@ -545,9 +552,11 @@ async function handleAction3() {
545
552
  logZodIssues(error);
546
553
  } else if (error instanceof Error) {
547
554
  spinner.fail(error.message);
548
- if (error.cause) {
549
- console.error(error.cause);
550
- }
555
+ }
556
+ if (error instanceof Error && error.cause instanceof ExecaError3) {
557
+ console.error(error.cause.shortMessage);
558
+ } else if (error instanceof Error && error.cause) {
559
+ console.error(error.cause);
551
560
  }
552
561
  process.exit(1);
553
562
  }
@@ -559,6 +568,7 @@ function registerLoginCommand(program2) {
559
568
  }
560
569
 
561
570
  // src/commands/logout/handle-action.ts
571
+ import { ExecaError as ExecaError4 } from "execa";
562
572
  import ora4 from "ora";
563
573
  import { ZodError as ZodError4 } from "zod";
564
574
  async function handleAction4() {
@@ -580,9 +590,11 @@ async function handleAction4() {
580
590
  logZodIssues(error);
581
591
  } else if (error instanceof Error) {
582
592
  spinner.fail(error.message);
583
- if (error.cause) {
584
- console.error(error.cause);
585
- }
593
+ }
594
+ if (error instanceof Error && error.cause instanceof ExecaError4) {
595
+ console.error(error.cause.shortMessage);
596
+ } else if (error instanceof Error && error.cause) {
597
+ console.error(error.cause);
586
598
  }
587
599
  process.exit(1);
588
600
  }
@@ -594,6 +606,7 @@ function registerLogoutCommand(program2) {
594
606
  }
595
607
 
596
608
  // src/commands/publish/handle-action.ts
609
+ import { ExecaError as ExecaError5 } from "execa";
597
610
  import express2 from "express";
598
611
  import { HTTPError as HTTPError3 } from "ky";
599
612
  import ora5 from "ora";
@@ -798,16 +811,18 @@ async function runModelContainer(dockerImage, webserverPort, ctx) {
798
811
  const outputEnv = `OUTPUT_URL=${webserverURL}/output`;
799
812
  const envs = [...inputEnvs, outputEnv];
800
813
  try {
814
+ const extraRunArgs = [];
815
+ if (env.isWSL) {
816
+ const ip = getWSLMachineIP();
817
+ extraRunArgs.push("--add-host", `${DOCKER_HOSTNAME_WSL}:${ip}`);
818
+ }
801
819
  const args = [
802
820
  "run",
803
821
  "--rm",
822
+ ...extraRunArgs,
804
823
  ...envs.flatMap((env2) => ["--env", env2]),
805
824
  dockerImage
806
825
  ];
807
- if (env.isWSL) {
808
- const ip = getWSLMachineIP();
809
- args.push("--add-host", `${DOCKER_HOSTNAME_WSL}:${ip}`);
810
- }
811
826
  await execa4("docker", args, {
812
827
  cwd: ctx.projectRoot,
813
828
  stdio: "pipe"
@@ -968,7 +983,7 @@ async function handleCreateModelFlow(options, app, spinner, ctx, authCtx) {
968
983
  await runModelIOTests(dockerImage, options, app, ctx);
969
984
  spinner.succeed("Model I/O test passed");
970
985
  }
971
- spinner.start("Publishing model...");
986
+ spinner.start("Publishing new model...");
972
987
  const modelConfig = await getModelConfigFromProjectConfig(ctx);
973
988
  const model = await createModel(modelConfig, authCtx);
974
989
  await updateProjectConfig((config) => {
@@ -1047,6 +1062,7 @@ async function handleModelRevisionCreateFlow(options, app, spinner, ctx, authCtx
1047
1062
  await runModelIOTests(dockerImage, options, app, ctx);
1048
1063
  spinner.succeed("Model I/O test passed");
1049
1064
  }
1065
+ spinner.start("Publishing new model revision...");
1050
1066
  const modelConfig = await getModelConfigFromProjectConfig(ctx);
1051
1067
  const model = await createModel(modelConfig, authCtx);
1052
1068
  await updateProjectConfig((config) => {
@@ -1104,6 +1120,7 @@ async function handleModelRevisionUpdateFlow(options, app, spinner, ctx, authCtx
1104
1120
  await runModelIOTests(dockerImage, options, app, ctx);
1105
1121
  spinner.succeed("Model I/O test passed");
1106
1122
  }
1123
+ spinner.start("Updating model revision...");
1107
1124
  const modelConfig = await getModelConfigFromProjectConfig(ctx);
1108
1125
  const model = await updateModel(modelConfig, authCtx);
1109
1126
  await updateProjectConfig((config) => {
@@ -1175,9 +1192,11 @@ async function handleAction5(options) {
1175
1192
  spinner.fail(formatNestErrorMessage(errorResponse));
1176
1193
  } else if (error instanceof Error) {
1177
1194
  spinner.fail(error.message);
1178
- if (error.cause) {
1179
- console.error(error.cause);
1180
- }
1195
+ }
1196
+ if (error instanceof Error && error.cause instanceof ExecaError5) {
1197
+ console.error(error.cause.shortMessage);
1198
+ } else if (error instanceof Error && error.cause) {
1199
+ console.error(error.cause);
1181
1200
  }
1182
1201
  process.exit(1);
1183
1202
  }
@@ -1203,6 +1222,7 @@ function registerPublishCommand(program2) {
1203
1222
 
1204
1223
  // src/commands/test/handle-action.ts
1205
1224
  import path14 from "path";
1225
+ import { ExecaError as ExecaError6 } from "execa";
1206
1226
  import express3 from "express";
1207
1227
  import ora6 from "ora";
1208
1228
  import { ZodError as ZodError6 } from "zod";
@@ -1262,9 +1282,11 @@ ${clickHereLink} to view output (${fileLink})
1262
1282
  logZodIssues(error);
1263
1283
  } else if (error instanceof Error) {
1264
1284
  spinner.fail(error.message);
1265
- if (error.cause) {
1266
- console.error(error.cause);
1267
- }
1285
+ }
1286
+ if (error instanceof Error && error.cause instanceof ExecaError6) {
1287
+ console.error(error.cause.shortMessage);
1288
+ } else if (error instanceof Error && error.cause) {
1289
+ console.error(error.cause);
1268
1290
  }
1269
1291
  process.exit(1);
1270
1292
  }
@@ -1296,7 +1318,7 @@ import { Command } from "commander";
1296
1318
  // package.json
1297
1319
  var package_default = {
1298
1320
  name: "@pd4castr/cli",
1299
- version: "0.0.6",
1321
+ version: "0.0.8",
1300
1322
  description: "CLI tool for creating, testing, and publishing pd4castr models",
1301
1323
  main: "dist/index.js",
1302
1324
  type: "module",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pd4castr/cli",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "CLI tool for creating, testing, and publishing pd4castr models",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",