@lukoweb/apitogo 0.1.115 → 0.1.118

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/dist/cli/cli.js CHANGED
@@ -5471,7 +5471,8 @@ function printWarningToConsole(message) {
5471
5471
  console.error(message);
5472
5472
  }
5473
5473
  async function printCriticalFailureToConsoleAndExit(message) {
5474
- console.error(colors.bold(colors.red(message)));
5474
+ const text = typeof message === "string" && message.trim() === "" ? "Command failed with no further details." : message;
5475
+ console.error(colors.bold(colors.red(text)));
5475
5476
  await Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {
5476
5477
  process.exit(1);
5477
5478
  });
@@ -5801,7 +5802,7 @@ import {
5801
5802
  // package.json
5802
5803
  var package_default = {
5803
5804
  name: "@lukoweb/apitogo",
5804
- version: "0.1.115",
5805
+ version: "0.1.118",
5805
5806
  type: "module",
5806
5807
  sideEffects: [
5807
5808
  "**/*.css",
@@ -10844,7 +10845,7 @@ async function parseErrorResponse(response) {
10844
10845
  } catch {
10845
10846
  bodyText = bodyText ?? await response.text().catch(() => void 0);
10846
10847
  }
10847
- const message = (problem ? formatProblemDetails(problem) : void 0) ?? bodyText?.trim() ?? `HTTP ${response.status} ${response.statusText}`;
10848
+ const message = (problem ? formatProblemDetails(problem) : void 0) || bodyText?.trim() || `HTTP ${response.status} ${response.statusText}`;
10848
10849
  return new PlatformApiError(message, response.status, problem);
10849
10850
  }
10850
10851
 
@@ -13249,7 +13250,15 @@ async function checkPublishReadiness(client, _config, args) {
13249
13250
  // src/cli/check/handler.ts
13250
13251
  async function check(argv) {
13251
13252
  const sourceDirectory = path41.resolve(process.cwd(), argv.dir);
13252
- const config2 = loadConfig();
13253
+ let config2;
13254
+ try {
13255
+ config2 = loadConfig();
13256
+ } catch (error) {
13257
+ await printCriticalFailureToConsoleAndExit(
13258
+ error instanceof Error ? error.message : String(error)
13259
+ );
13260
+ return;
13261
+ }
13253
13262
  const client = new PlatformApiClient(config2);
13254
13263
  let result;
13255
13264
  try {
@@ -16552,6 +16561,100 @@ var config_default = {
16552
16561
  // src/cli/apply/handler.ts
16553
16562
  import path63 from "node:path";
16554
16563
 
16564
+ // src/cli/platform/helpers/progress.ts
16565
+ var RECENT_JOB_MESSAGE_LIMIT = 5;
16566
+ function recentJobMessages(messages) {
16567
+ if (!messages?.length) {
16568
+ return [];
16569
+ }
16570
+ return messages.slice(-RECENT_JOB_MESSAGE_LIMIT);
16571
+ }
16572
+ function newMessagesSince(previousCount, messages) {
16573
+ if (!messages?.length || messages.length <= previousCount) {
16574
+ return [];
16575
+ }
16576
+ return messages.slice(previousCount);
16577
+ }
16578
+ function deriveCurrentStep(platformStatus, messages, stepLabel) {
16579
+ const latest = messages?.at(-1)?.message?.trim();
16580
+ if (latest) {
16581
+ return latest;
16582
+ }
16583
+ const normalized = platformStatus.toLowerCase();
16584
+ if (normalized === "pending" || normalized === "none") {
16585
+ return stepLabel ? `${stepLabel} queued` : "Queued";
16586
+ }
16587
+ if (normalized === "in_progress" || normalized === "running") {
16588
+ return stepLabel ? `${stepLabel} in progress` : "In progress";
16589
+ }
16590
+ if (normalized === "completed" || normalized === "healthy") {
16591
+ return stepLabel ? `${stepLabel} completed` : "Completed";
16592
+ }
16593
+ if (normalized === "failed" || normalized === "cancelled") {
16594
+ return stepLabel ? `${stepLabel} failed` : "Failed";
16595
+ }
16596
+ return stepLabel ?? platformStatus;
16597
+ }
16598
+ function buildProgressSummary(options) {
16599
+ return {
16600
+ stepsCompleted: options.stepLabel,
16601
+ lastMessage: options.messages?.at(-1)?.message ?? null,
16602
+ elapsedMs: Date.now() - options.startedAtMs,
16603
+ terminalStatus: options.terminalStatus
16604
+ };
16605
+ }
16606
+ function createConsoleProgressReporter(stream = process.stderr) {
16607
+ return createScopedConsoleProgressReporter(stream, void 0);
16608
+ }
16609
+ function createScopedConsoleProgressReporter(stream, stepLabel) {
16610
+ let lastMessageCount = 0;
16611
+ let lastLine;
16612
+ const reporter = {
16613
+ async onStep(step, detail) {
16614
+ const message = detail?.message ?? (detail?.platformStatus ? `${step}: ${detail.platformStatus}` : step);
16615
+ const line = stepLabel ? `[${stepLabel}] ${message}` : message;
16616
+ if (line === lastLine) return;
16617
+ lastLine = line;
16618
+ stream.write(`${line}
16619
+ `);
16620
+ },
16621
+ async onNewMessages(messages) {
16622
+ for (const entry of messages) {
16623
+ const line = stepLabel ? `[${stepLabel}] ${entry.message}` : entry.message;
16624
+ stream.write(`${line}
16625
+ `);
16626
+ }
16627
+ },
16628
+ isCancelled: () => false,
16629
+ child(label) {
16630
+ return createScopedConsoleProgressReporter(stream, label);
16631
+ }
16632
+ };
16633
+ const baseOnNewMessages = reporter.onNewMessages.bind(reporter);
16634
+ reporter.onNewMessages = async (messages) => {
16635
+ const delta = newMessagesSince(lastMessageCount, messages);
16636
+ lastMessageCount = messages.length;
16637
+ await baseOnNewMessages(delta);
16638
+ };
16639
+ return reporter;
16640
+ }
16641
+ async function reportPollProgress(progress, stepLabel, value) {
16642
+ if (!progress) {
16643
+ return;
16644
+ }
16645
+ if (progress.isCancelled()) {
16646
+ throw new Error("Operation cancelled.");
16647
+ }
16648
+ const latestMessage = value.messages?.at(-1)?.message;
16649
+ await progress.onStep(stepLabel, {
16650
+ platformStatus: value.status,
16651
+ message: latestMessage
16652
+ });
16653
+ if (value.messages?.length) {
16654
+ await progress.onNewMessages(value.messages);
16655
+ }
16656
+ }
16657
+
16555
16658
  // src/cli/platform/tools/dev-portal-publish.ts
16556
16659
  init_gateway_limits();
16557
16660
 
@@ -17164,59 +17267,6 @@ function resolveDevPortalUrls(project, backendFqdn, providerIds = [], platformSi
17164
17267
  };
17165
17268
  }
17166
17269
 
17167
- // src/cli/platform/helpers/progress.ts
17168
- var RECENT_JOB_MESSAGE_LIMIT = 5;
17169
- function recentJobMessages(messages) {
17170
- if (!messages?.length) {
17171
- return [];
17172
- }
17173
- return messages.slice(-RECENT_JOB_MESSAGE_LIMIT);
17174
- }
17175
- function deriveCurrentStep(platformStatus, messages, stepLabel) {
17176
- const latest = messages?.at(-1)?.message?.trim();
17177
- if (latest) {
17178
- return latest;
17179
- }
17180
- const normalized = platformStatus.toLowerCase();
17181
- if (normalized === "pending" || normalized === "none") {
17182
- return stepLabel ? `${stepLabel} queued` : "Queued";
17183
- }
17184
- if (normalized === "in_progress" || normalized === "running") {
17185
- return stepLabel ? `${stepLabel} in progress` : "In progress";
17186
- }
17187
- if (normalized === "completed" || normalized === "healthy") {
17188
- return stepLabel ? `${stepLabel} completed` : "Completed";
17189
- }
17190
- if (normalized === "failed" || normalized === "cancelled") {
17191
- return stepLabel ? `${stepLabel} failed` : "Failed";
17192
- }
17193
- return stepLabel ?? platformStatus;
17194
- }
17195
- function buildProgressSummary(options) {
17196
- return {
17197
- stepsCompleted: options.stepLabel,
17198
- lastMessage: options.messages?.at(-1)?.message ?? null,
17199
- elapsedMs: Date.now() - options.startedAtMs,
17200
- terminalStatus: options.terminalStatus
17201
- };
17202
- }
17203
- async function reportPollProgress(progress, stepLabel, value) {
17204
- if (!progress) {
17205
- return;
17206
- }
17207
- if (progress.isCancelled()) {
17208
- throw new Error("Operation cancelled.");
17209
- }
17210
- const latestMessage = value.messages?.at(-1)?.message;
17211
- await progress.onStep(stepLabel, {
17212
- platformStatus: value.status,
17213
- message: latestMessage
17214
- });
17215
- if (value.messages?.length) {
17216
- await progress.onNewMessages(value.messages);
17217
- }
17218
- }
17219
-
17220
17270
  // src/cli/platform/helpers/status.ts
17221
17271
  function normalizeInfrastructureStatus(platformStatus) {
17222
17272
  switch (platformStatus.toLowerCase()) {
@@ -21355,7 +21405,15 @@ function resultLooksFailed(payload) {
21355
21405
  }
21356
21406
  async function apply(argv) {
21357
21407
  const sourceDirectory = path63.resolve(process.cwd(), argv.dir);
21358
- const config2 = loadConfig();
21408
+ let config2;
21409
+ try {
21410
+ config2 = loadConfig();
21411
+ } catch (error) {
21412
+ await printCriticalFailureToConsoleAndExit(
21413
+ error instanceof Error ? error.message : String(error)
21414
+ );
21415
+ return;
21416
+ }
21359
21417
  const client = new PlatformApiClient(config2);
21360
21418
  let only;
21361
21419
  const onlyRaw = normalizeOnly(argv.only);
@@ -21370,16 +21428,22 @@ async function apply(argv) {
21370
21428
  }
21371
21429
  }
21372
21430
  const platformPlan = argv.platformPlan?.trim();
21373
- const runOnce = (plan) => runApplyFromSiteDirectory(client, config2, {
21374
- sourceDirectory,
21375
- projectId: argv.projectId?.trim(),
21376
- projectName: argv.projectName?.trim(),
21377
- platformPlan: plan,
21378
- only,
21379
- force: argv.force,
21380
- resumeFromStep: argv.resumeFrom?.trim(),
21381
- wait: argv.wait !== false
21382
- });
21431
+ const progress = createConsoleProgressReporter();
21432
+ const runOnce = (plan) => runApplyFromSiteDirectory(
21433
+ client,
21434
+ config2,
21435
+ {
21436
+ sourceDirectory,
21437
+ projectId: argv.projectId?.trim(),
21438
+ projectName: argv.projectName?.trim(),
21439
+ platformPlan: plan,
21440
+ only,
21441
+ force: argv.force,
21442
+ resumeFromStep: argv.resumeFrom?.trim(),
21443
+ wait: argv.wait !== false
21444
+ },
21445
+ progress
21446
+ );
21383
21447
  let result;
21384
21448
  try {
21385
21449
  result = await runOnce(platformPlan);
@@ -22330,18 +22394,31 @@ async function createProject(argv) {
22330
22394
  return;
22331
22395
  }
22332
22396
  const modules = (argv.modules ?? "apihub").split(",").map((m) => m.trim()).filter(Boolean);
22333
- const config2 = loadConfig();
22397
+ let config2;
22398
+ try {
22399
+ config2 = loadConfig();
22400
+ } catch (error) {
22401
+ await printCriticalFailureToConsoleAndExit(
22402
+ error instanceof Error ? error.message : String(error)
22403
+ );
22404
+ return;
22405
+ }
22334
22406
  const client = new PlatformApiClient(config2);
22335
22407
  let result;
22336
22408
  try {
22337
- result = await handleBootstrapProject(client, config2, {
22338
- name,
22339
- description: argv.description?.trim(),
22340
- modules: modules.length > 0 ? modules : ["apihub"],
22341
- selectFreePlan: false,
22342
- wait: argv.wait !== false,
22343
- configureGatewayBaseline: false
22344
- });
22409
+ result = await handleBootstrapProject(
22410
+ client,
22411
+ config2,
22412
+ {
22413
+ name,
22414
+ description: argv.description?.trim(),
22415
+ modules: modules.length > 0 ? modules : ["apihub"],
22416
+ selectFreePlan: false,
22417
+ wait: argv.wait !== false,
22418
+ configureGatewayBaseline: false
22419
+ },
22420
+ createConsoleProgressReporter()
22421
+ );
22345
22422
  } catch (error) {
22346
22423
  await printCriticalFailureToConsoleAndExit(
22347
22424
  error instanceof Error ? error.message : String(error)
@@ -22785,7 +22862,15 @@ var run_default = {
22785
22862
  import path70 from "node:path";
22786
22863
  async function status(argv) {
22787
22864
  const sourceDirectory = path70.resolve(process.cwd(), argv.dir);
22788
- const config2 = loadConfig();
22865
+ let config2;
22866
+ try {
22867
+ config2 = loadConfig();
22868
+ } catch (error) {
22869
+ await printCriticalFailureToConsoleAndExit(
22870
+ error instanceof Error ? error.message : String(error)
22871
+ );
22872
+ return;
22873
+ }
22789
22874
  const client = new PlatformApiClient(config2);
22790
22875
  let whoamiJson;
22791
22876
  try {
@@ -22881,7 +22966,15 @@ async function teardown(argv) {
22881
22966
  return;
22882
22967
  }
22883
22968
  const sourceDirectory = path71.resolve(process.cwd(), argv.dir);
22884
- const config2 = loadConfig();
22969
+ let config2;
22970
+ try {
22971
+ config2 = loadConfig();
22972
+ } catch (error) {
22973
+ await printCriticalFailureToConsoleAndExit(
22974
+ error instanceof Error ? error.message : String(error)
22975
+ );
22976
+ return;
22977
+ }
22885
22978
  const client = new PlatformApiClient(config2);
22886
22979
  let projectId = argv.projectId?.trim();
22887
22980
  if (!projectId) {
@@ -22896,10 +22989,15 @@ async function teardown(argv) {
22896
22989
  }
22897
22990
  let result;
22898
22991
  try {
22899
- result = await handleTeardownProject(client, config2, {
22900
- projectId,
22901
- wait: argv.wait !== false
22902
- });
22992
+ result = await handleTeardownProject(
22993
+ client,
22994
+ config2,
22995
+ {
22996
+ projectId,
22997
+ wait: argv.wait !== false
22998
+ },
22999
+ createConsoleProgressReporter()
23000
+ );
22903
23001
  } catch (error) {
22904
23002
  await printCriticalFailureToConsoleAndExit(
22905
23003
  error instanceof Error ? error.message : String(error)
@@ -38,6 +38,7 @@ export declare function buildProgressSummary(options: {
38
38
  terminalStatus: string;
39
39
  };
40
40
  export declare function createMcpProgressReporter(extra?: McpToolExtra): ProgressReporter;
41
+ export declare function createConsoleProgressReporter(stream?: NodeJS.WritableStream): ProgressReporter;
41
42
  export interface PollableJobValue {
42
43
  status: string;
43
44
  messages?: JobLogMessage[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukoweb/apitogo",
3
- "version": "0.1.115",
3
+ "version": "0.1.118",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "**/*.css",