@pd4castr/cli 0.0.7 → 0.0.9

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 +54 -19
  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";
@@ -970,7 +983,7 @@ async function handleCreateModelFlow(options, app, spinner, ctx, authCtx) {
970
983
  await runModelIOTests(dockerImage, options, app, ctx);
971
984
  spinner.succeed("Model I/O test passed");
972
985
  }
973
- spinner.start("Publishing model...");
986
+ spinner.start("Publishing new model data...");
974
987
  const modelConfig = await getModelConfigFromProjectConfig(ctx);
975
988
  const model = await createModel(modelConfig, authCtx);
976
989
  await updateProjectConfig((config) => {
@@ -979,15 +992,20 @@ async function handleCreateModelFlow(options, app, spinner, ctx, authCtx) {
979
992
  config.$$revision = model.revision;
980
993
  config.$$dockerImage = model.dockerImage;
981
994
  });
995
+ spinner.succeed("Model data published successfully");
996
+ spinner.start(
997
+ "Pushing model image to registry - this may take a few minutes..."
998
+ );
982
999
  const pushCredentials = await getRegistryPushCredentials(model.id, authCtx);
983
1000
  await loginToDockerRegistry(pushCredentials);
984
1001
  await buildDockerImage(dockerImage, ctx);
985
1002
  await pushDockerImage(dockerImage, pushCredentials.ref);
1003
+ spinner.succeed("Model image pushed to registry successfully");
986
1004
  spinner.stopAndPersist({
987
1005
  symbol: "\u{1F680} ",
988
1006
  prefixText: "\n",
989
1007
  suffixText: "\n",
990
- text: chalk2.bold("Model published successfully")
1008
+ text: chalk2.bold(`${model.name} r${model.revision} published successfully`)
991
1009
  });
992
1010
  }
993
1011
 
@@ -1049,6 +1067,7 @@ async function handleModelRevisionCreateFlow(options, app, spinner, ctx, authCtx
1049
1067
  await runModelIOTests(dockerImage, options, app, ctx);
1050
1068
  spinner.succeed("Model I/O test passed");
1051
1069
  }
1070
+ spinner.start("Publishing new model revision data...");
1052
1071
  const modelConfig = await getModelConfigFromProjectConfig(ctx);
1053
1072
  const model = await createModel(modelConfig, authCtx);
1054
1073
  await updateProjectConfig((config) => {
@@ -1057,10 +1076,15 @@ async function handleModelRevisionCreateFlow(options, app, spinner, ctx, authCtx
1057
1076
  config.$$revision = model.revision;
1058
1077
  config.$$dockerImage = model.dockerImage;
1059
1078
  });
1079
+ spinner.succeed("Model revision data published successfully");
1080
+ spinner.start(
1081
+ "Pushing new model revision image to registry - this may take a few minutes..."
1082
+ );
1060
1083
  const pushCredentials = await getRegistryPushCredentials(model.id, authCtx);
1061
1084
  await loginToDockerRegistry(pushCredentials);
1062
1085
  await buildDockerImage(dockerImage, ctx);
1063
1086
  await pushDockerImage(dockerImage, pushCredentials.ref);
1087
+ spinner.succeed("New model revision image pushed to registry successfully");
1064
1088
  spinner.stopAndPersist({
1065
1089
  symbol: "\u{1F680} ",
1066
1090
  prefixText: "\n",
@@ -1106,6 +1130,7 @@ async function handleModelRevisionUpdateFlow(options, app, spinner, ctx, authCtx
1106
1130
  await runModelIOTests(dockerImage, options, app, ctx);
1107
1131
  spinner.succeed("Model I/O test passed");
1108
1132
  }
1133
+ spinner.start("Updating model revision data...");
1109
1134
  const modelConfig = await getModelConfigFromProjectConfig(ctx);
1110
1135
  const model = await updateModel(modelConfig, authCtx);
1111
1136
  await updateProjectConfig((config) => {
@@ -1114,10 +1139,15 @@ async function handleModelRevisionUpdateFlow(options, app, spinner, ctx, authCtx
1114
1139
  config.$$revision = model.revision;
1115
1140
  config.$$dockerImage = model.dockerImage;
1116
1141
  });
1142
+ spinner.succeed("Model revision data updated successfully");
1143
+ spinner.start(
1144
+ "Pushing updated model image to registry - this may take a few minutes..."
1145
+ );
1117
1146
  const pushCredentials = await getRegistryPushCredentials(model.id, authCtx);
1118
1147
  await loginToDockerRegistry(pushCredentials);
1119
1148
  await buildDockerImage(dockerImage, ctx);
1120
1149
  await pushDockerImage(dockerImage, pushCredentials.ref);
1150
+ spinner.succeed("Updated model image pushed to registry successfully");
1121
1151
  spinner.stopAndPersist({
1122
1152
  symbol: "\u{1F680} ",
1123
1153
  prefixText: "\n",
@@ -1177,9 +1207,11 @@ async function handleAction5(options) {
1177
1207
  spinner.fail(formatNestErrorMessage(errorResponse));
1178
1208
  } else if (error instanceof Error) {
1179
1209
  spinner.fail(error.message);
1180
- if (error.cause) {
1181
- console.error(error.cause);
1182
- }
1210
+ }
1211
+ if (error instanceof Error && error.cause instanceof ExecaError5) {
1212
+ console.error(error.cause.shortMessage);
1213
+ } else if (error instanceof Error && error.cause) {
1214
+ console.error(error.cause);
1183
1215
  }
1184
1216
  process.exit(1);
1185
1217
  }
@@ -1205,6 +1237,7 @@ function registerPublishCommand(program2) {
1205
1237
 
1206
1238
  // src/commands/test/handle-action.ts
1207
1239
  import path14 from "path";
1240
+ import { ExecaError as ExecaError6 } from "execa";
1208
1241
  import express3 from "express";
1209
1242
  import ora6 from "ora";
1210
1243
  import { ZodError as ZodError6 } from "zod";
@@ -1264,9 +1297,11 @@ ${clickHereLink} to view output (${fileLink})
1264
1297
  logZodIssues(error);
1265
1298
  } else if (error instanceof Error) {
1266
1299
  spinner.fail(error.message);
1267
- if (error.cause) {
1268
- console.error(error.cause);
1269
- }
1300
+ }
1301
+ if (error instanceof Error && error.cause instanceof ExecaError6) {
1302
+ console.error(error.cause.shortMessage);
1303
+ } else if (error instanceof Error && error.cause) {
1304
+ console.error(error.cause);
1270
1305
  }
1271
1306
  process.exit(1);
1272
1307
  }
@@ -1298,7 +1333,7 @@ import { Command } from "commander";
1298
1333
  // package.json
1299
1334
  var package_default = {
1300
1335
  name: "@pd4castr/cli",
1301
- version: "0.0.7",
1336
+ version: "0.0.9",
1302
1337
  description: "CLI tool for creating, testing, and publishing pd4castr models",
1303
1338
  main: "dist/index.js",
1304
1339
  type: "module",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pd4castr/cli",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "CLI tool for creating, testing, and publishing pd4castr models",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",