fluncle 0.47.0 → 0.48.0

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/bin/fluncle.mjs +43 -29
  2. package/package.json +1 -1
package/bin/fluncle.mjs CHANGED
@@ -2497,7 +2497,24 @@ var require_main = __commonJS((exports, module) => {
2497
2497
  module.exports = DotenvModule;
2498
2498
  });
2499
2499
 
2500
+ // ../../packages/contracts/src/util.ts
2501
+ function formatDuration(durationMs) {
2502
+ const totalSeconds = Math.round(durationMs / 1000);
2503
+ const minutes = Math.floor(totalSeconds / 60);
2504
+ const seconds = totalSeconds % 60;
2505
+ return `${minutes}:${seconds.toString().padStart(2, "0")}`;
2506
+ }
2507
+ function formatError(error) {
2508
+ if (error instanceof Error) {
2509
+ return error.message;
2510
+ }
2511
+ return String(error);
2512
+ }
2513
+
2500
2514
  // src/output.ts
2515
+ function isJsonFailure(value) {
2516
+ return typeof value === "object" && value !== null && typeof value.code === "string" && typeof value.message === "string";
2517
+ }
2501
2518
  function printJson2(value) {
2502
2519
  console.log(JSON.stringify(value, null, 2));
2503
2520
  }
@@ -2539,7 +2556,7 @@ function parseVersion(version) {
2539
2556
  var currentVersion;
2540
2557
  var init_version = __esm(() => {
2541
2558
  init_output();
2542
- currentVersion = "0.47.0".trim() ? "0.47.0".trim() : "0.1.0";
2559
+ currentVersion = "0.48.0".trim() ? "0.48.0".trim() : "0.1.0";
2543
2560
  });
2544
2561
 
2545
2562
  // src/update-notifier.ts
@@ -2727,11 +2744,20 @@ import { homedir as homedir2 } from "node:os";
2727
2744
  import { join as join2 } from "node:path";
2728
2745
  function loadEnv(keys) {
2729
2746
  loadConfig();
2730
- const missing = keys.filter((key) => !process.env[key]);
2747
+ const result = {};
2748
+ const missing = [];
2749
+ for (const key of keys) {
2750
+ const value = process.env[key];
2751
+ if (value === undefined) {
2752
+ missing.push(key);
2753
+ continue;
2754
+ }
2755
+ result[key] = value;
2756
+ }
2731
2757
  if (missing.length > 0) {
2732
2758
  throw new Error(`Missing required env vars: ${missing.join(", ")}`);
2733
2759
  }
2734
- return Object.fromEntries(keys.map((key) => [key, process.env[key]]));
2760
+ return result;
2735
2761
  }
2736
2762
  function getApiBaseUrl() {
2737
2763
  loadConfig();
@@ -2833,7 +2859,7 @@ async function apiRequest(path, init = {}) {
2833
2859
  const text = await response.text();
2834
2860
  const data = parseJson(text);
2835
2861
  if (!response.ok) {
2836
- const failure = data;
2862
+ const failure = isJsonFailure(data) ? data : undefined;
2837
2863
  throw new CliError2(failure?.code ?? `http_${response.status}`, failure?.message ?? `${response.status} ${response.statusText}`);
2838
2864
  }
2839
2865
  return data;
@@ -3485,6 +3511,7 @@ function artistTitle(track) {
3485
3511
  return `${track.artists.join(", ")} — ${track.title}`;
3486
3512
  }
3487
3513
  var COORD_FALLBACK = "—";
3514
+ var init_format = () => {};
3488
3515
 
3489
3516
  // src/interactive.ts
3490
3517
  import { createInterface } from "node:readline/promises";
@@ -3732,6 +3759,7 @@ function buildSelectorLines(tracks, selectedIndex, columns) {
3732
3759
  }
3733
3760
  var TELEGRAM_APP_URI = "tg://resolve?domain=fluncle", SPOTIFY_PLAYLIST_OPEN_URL, SELECT_NON_INTERACTIVE_MESSAGE = "fluncle open requires an interactive terminal. Use fluncle recent to list tracks.";
3734
3761
  var init_open = __esm(() => {
3762
+ init_format();
3735
3763
  init_interactive();
3736
3764
  init_output();
3737
3765
  init_recent2();
@@ -4001,7 +4029,7 @@ function parseVersion2(version) {
4001
4029
  var currentVersion2, latestReleaseUrl = "https://api.github.com/repos/mauricekleine/fluncle/releases/latest";
4002
4030
  var init_version2 = __esm(() => {
4003
4031
  init_output();
4004
- currentVersion2 = "0.47.0".trim() ? "0.47.0".trim() : "0.1.0";
4032
+ currentVersion2 = "0.48.0".trim() ? "0.48.0".trim() : "0.1.0";
4005
4033
  });
4006
4034
 
4007
4035
  // src/commands/track.ts
@@ -5221,12 +5249,6 @@ function vehicleRows(rows) {
5221
5249
  return `${coordinate2(row).padEnd(coordWidth)} ${foundDate(row.addedAt)} ${row.vehicle ?? COORD_FALLBACK2}`;
5222
5250
  });
5223
5251
  }
5224
- function formatDuration(durationMs) {
5225
- const totalSeconds = Math.round(durationMs / 1000);
5226
- const minutes = Math.floor(totalSeconds / 60);
5227
- const seconds = totalSeconds % 60;
5228
- return `${minutes}:${seconds.toString().padStart(2, "0")}`;
5229
- }
5230
5252
  function trackDetailLines(track) {
5231
5253
  const lines = [`${coordinate2(track)} ${artistTitle2(track)}`];
5232
5254
  const meta = [];
@@ -5242,6 +5264,7 @@ function trackDetailLines(track) {
5242
5264
  return lines;
5243
5265
  }
5244
5266
  var COORD_FALLBACK2 = "—";
5267
+ var init_format2 = () => {};
5245
5268
 
5246
5269
  // src/cli.ts
5247
5270
  import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
@@ -5325,15 +5348,6 @@ function toJsonFailure(error) {
5325
5348
  ok: false
5326
5349
  };
5327
5350
  }
5328
-
5329
- // src/retry.ts
5330
- function formatError(error) {
5331
- if (error instanceof Error) {
5332
- return error.message;
5333
- }
5334
- return String(error);
5335
- }
5336
-
5337
5351
  // src/cli.ts
5338
5352
  function createProgram() {
5339
5353
  const program2 = configureCommand(new Command);
@@ -6088,7 +6102,7 @@ async function runRecent(options, recentCommand3) {
6088
6102
  if (options.limit === undefined && !options.json && process.stdout.isTTY === true && process.stdin.isTTY === true) {
6089
6103
  const { fetchRecentPage: fetchRecentPage2 } = await Promise.resolve().then(() => (init_recent(), exports_recent));
6090
6104
  const { paginateWithKeyboard: paginateWithKeyboard2 } = await Promise.resolve().then(() => (init_interactive2(), exports_interactive));
6091
- const { trackRows: trackRows3 } = await Promise.resolve().then(() => exports_format);
6105
+ const { trackRows: trackRows3 } = await Promise.resolve().then(() => (init_format2(), exports_format));
6092
6106
  await paginateWithKeyboard2({
6093
6107
  emptyMessage: "No findings logged yet.",
6094
6108
  fetchPage: async (cursor) => {
@@ -6116,7 +6130,7 @@ async function runRecent(options, recentCommand3) {
6116
6130
  console.log("No findings logged yet.");
6117
6131
  return;
6118
6132
  }
6119
- const { trackRows: trackRows2 } = await Promise.resolve().then(() => exports_format);
6133
+ const { trackRows: trackRows2 } = await Promise.resolve().then(() => (init_format2(), exports_format));
6120
6134
  console.log(trackRows2(tracks).join(`
6121
6135
  `));
6122
6136
  }
@@ -6130,7 +6144,7 @@ async function runMixtapes(options, mixtapesCommand2) {
6130
6144
  console.log("No mixtapes logged yet.");
6131
6145
  return;
6132
6146
  }
6133
- const { trackRows: trackRows2 } = await Promise.resolve().then(() => exports_format);
6147
+ const { trackRows: trackRows2 } = await Promise.resolve().then(() => (init_format2(), exports_format));
6134
6148
  console.log(trackRows2(mixtapes).join(`
6135
6149
  `));
6136
6150
  }
@@ -6158,7 +6172,7 @@ async function runAdminQueue(options, queueCommand2) {
6158
6172
  console.log("Every finding has a video. Nothing in the render queue.");
6159
6173
  return;
6160
6174
  }
6161
- const { trackRows: trackRows2 } = await Promise.resolve().then(() => exports_format);
6175
+ const { trackRows: trackRows2 } = await Promise.resolve().then(() => (init_format2(), exports_format));
6162
6176
  const noun = tracks.length === 1 ? "finding" : "findings";
6163
6177
  console.log(`${tracks.length} ${noun} awaiting a video, oldest first:`);
6164
6178
  console.log(trackRows2(tracks).join(`
@@ -6178,7 +6192,7 @@ async function runAdminContextQueue(options, contextQueueCommand2) {
6178
6192
  console.log("Every finding has its field notes. Nothing waiting on context.");
6179
6193
  return;
6180
6194
  }
6181
- const { trackRows: trackRows2 } = await Promise.resolve().then(() => exports_format);
6195
+ const { trackRows: trackRows2 } = await Promise.resolve().then(() => (init_format2(), exports_format));
6182
6196
  const noun = tracks.length === 1 ? "finding" : "findings";
6183
6197
  console.log(`${tracks.length} ${noun} missing field notes, oldest first:`);
6184
6198
  console.log(trackRows2(tracks).join(`
@@ -6198,7 +6212,7 @@ async function runAdminObserveQueue(options, observeQueueCommand2) {
6198
6212
  console.log("Every finding with notes has its observation. Nothing waiting on a voice.");
6199
6213
  return;
6200
6214
  }
6201
- const { trackRows: trackRows2 } = await Promise.resolve().then(() => exports_format);
6215
+ const { trackRows: trackRows2 } = await Promise.resolve().then(() => (init_format2(), exports_format));
6202
6216
  const noun = tracks.length === 1 ? "finding" : "findings";
6203
6217
  console.log(`${tracks.length} ${noun} awaiting an observation, oldest first:`);
6204
6218
  console.log(trackRows2(tracks).join(`
@@ -6218,7 +6232,7 @@ async function runAdminEnrichQueue(options, enrichQueueCommand2) {
6218
6232
  console.log("Nothing awaiting enrichment. Every finding is enriched.");
6219
6233
  return;
6220
6234
  }
6221
- const { trackRows: trackRows2 } = await Promise.resolve().then(() => exports_format);
6235
+ const { trackRows: trackRows2 } = await Promise.resolve().then(() => (init_format2(), exports_format));
6222
6236
  const noun = tracks.length === 1 ? "finding" : "findings";
6223
6237
  console.log(`${tracks.length} ${noun} needing (re-)enrichment, oldest first:`);
6224
6238
  console.log(trackRows2(tracks).join(`
@@ -6267,7 +6281,7 @@ async function runAdminVehicles(options, vehiclesCommand2) {
6267
6281
  console.log("No videos rendered yet.");
6268
6282
  return;
6269
6283
  }
6270
- const { vehicleRows: vehicleRows2 } = await Promise.resolve().then(() => exports_format);
6284
+ const { vehicleRows: vehicleRows2 } = await Promise.resolve().then(() => (init_format2(), exports_format));
6271
6285
  console.log("Recent video vehicles, newest first:");
6272
6286
  console.log(vehicleRows2(vehicles).join(`
6273
6287
  `));
@@ -6309,7 +6323,7 @@ async function runRandom(options, randomCommand2) {
6309
6323
  });
6310
6324
  return;
6311
6325
  }
6312
- const { trackDetailLines: trackDetailLines2 } = await Promise.resolve().then(() => exports_format);
6326
+ const { trackDetailLines: trackDetailLines2 } = await Promise.resolve().then(() => (init_format2(), exports_format));
6313
6327
  console.log(trackDetailLines2(track).join(`
6314
6328
  `));
6315
6329
  if (track.note) {
package/package.json CHANGED
@@ -31,5 +31,5 @@
31
31
  "url": "git+https://github.com/mauricekleine/fluncle.git"
32
32
  },
33
33
  "type": "module",
34
- "version": "0.47.0"
34
+ "version": "0.48.0"
35
35
  }