fluncle 0.90.0 → 0.92.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 +73 -7
  2. package/package.json +1 -1
package/bin/fluncle.mjs CHANGED
@@ -497,14 +497,32 @@ var init_util = __esm(() => {
497
497
  });
498
498
 
499
499
  // src/output.ts
500
+ import { writeSync as writeSync2 } from "node:fs";
501
+ function writeStdoutSync2(text) {
502
+ const buf = Buffer.from(text, "utf8");
503
+ let offset = 0;
504
+ while (offset < buf.length) {
505
+ try {
506
+ offset += writeSync2(1, buf, offset);
507
+ } catch (error) {
508
+ if (error.code === "EAGAIN") {
509
+ Atomics.wait(EAGAIN_WAIT2, 0, 0, 1);
510
+ continue;
511
+ }
512
+ throw error;
513
+ }
514
+ }
515
+ }
500
516
  function isJsonFailure(value) {
501
517
  return typeof value === "object" && value !== null && typeof value.code === "string" && typeof value.message === "string";
502
518
  }
503
519
  function printJson2(value) {
504
- console.log(JSON.stringify(value, null, 2));
520
+ writeStdoutSync2(JSON.stringify(value, null, 2) + `
521
+ `);
505
522
  }
506
- var CliError2;
523
+ var EAGAIN_WAIT2, CliError2;
507
524
  var init_output = __esm(() => {
525
+ EAGAIN_WAIT2 = new Int32Array(new SharedArrayBuffer(4));
508
526
  CliError2 = class CliError2 extends Error {
509
527
  code;
510
528
  constructor(code, message) {
@@ -538,7 +556,7 @@ function parseVersion(version) {
538
556
  var currentVersion;
539
557
  var init_version = __esm(() => {
540
558
  init_output();
541
- currentVersion = "0.90.0".trim() ? "0.90.0".trim() : "0.1.0";
559
+ currentVersion = "0.92.0".trim() ? "0.92.0".trim() : "0.1.0";
542
560
  });
543
561
 
544
562
  // src/update-notifier.ts
@@ -2168,7 +2186,7 @@ function parseVersion2(version) {
2168
2186
  var currentVersion2, latestReleaseUrl = "https://api.github.com/repos/mauricekleine/fluncle/releases/latest";
2169
2187
  var init_version2 = __esm(() => {
2170
2188
  init_output();
2171
- currentVersion2 = "0.90.0".trim() ? "0.90.0".trim() : "0.1.0";
2189
+ currentVersion2 = "0.92.0".trim() ? "0.92.0".trim() : "0.1.0";
2172
2190
  });
2173
2191
 
2174
2192
  // ../../packages/registry/src/index.ts
@@ -2893,6 +2911,7 @@ __export(exports_track, {
2893
2911
  trackObserveCommand: () => trackObserveCommand,
2894
2912
  trackNoteCommand: () => trackNoteCommand,
2895
2913
  trackGetCommand: () => trackGetCommand,
2914
+ trackGetAdminCommand: () => trackGetAdminCommand,
2896
2915
  trackDraftCommand: () => trackDraftCommand,
2897
2916
  trackContextCommand: () => trackContextCommand,
2898
2917
  isPlatesOnlyUpload: () => isPlatesOnlyUpload,
@@ -2901,6 +2920,9 @@ __export(exports_track, {
2901
2920
  async function trackGetCommand(idOrLogId) {
2902
2921
  return publicApiGet(`/api/tracks/${encodeURIComponent(idOrLogId)}`);
2903
2922
  }
2923
+ async function trackGetAdminCommand(idOrLogId) {
2924
+ return adminApiGet(`/api/admin/tracks/${encodeURIComponent(idOrLogId)}`);
2925
+ }
2904
2926
  function isPlatesOnlyUpload(files) {
2905
2927
  const hasPlate = PLATE_FIELDS.some((option) => Boolean(files[option]));
2906
2928
  if (!hasPlate) {
@@ -7106,6 +7128,23 @@ var spotifyPlaylistUrl = "https://open.spotify.com/playlist/1m5LADqpLjiBERdtqrIi
7106
7128
  var telegramUrl = "https://t.me/fluncle";
7107
7129
 
7108
7130
  // src/output.ts
7131
+ import { writeSync } from "node:fs";
7132
+ var EAGAIN_WAIT = new Int32Array(new SharedArrayBuffer(4));
7133
+ function writeStdoutSync(text) {
7134
+ const buf = Buffer.from(text, "utf8");
7135
+ let offset = 0;
7136
+ while (offset < buf.length) {
7137
+ try {
7138
+ offset += writeSync(1, buf, offset);
7139
+ } catch (error) {
7140
+ if (error.code === "EAGAIN") {
7141
+ Atomics.wait(EAGAIN_WAIT, 0, 0, 1);
7142
+ continue;
7143
+ }
7144
+ throw error;
7145
+ }
7146
+ }
7147
+ }
7109
7148
  class CliError extends Error {
7110
7149
  code;
7111
7150
  constructor(code, message) {
@@ -7115,7 +7154,8 @@ class CliError extends Error {
7115
7154
  }
7116
7155
  }
7117
7156
  function printJson(value) {
7118
- console.log(JSON.stringify(value, null, 2));
7157
+ writeStdoutSync(JSON.stringify(value, null, 2) + `
7158
+ `);
7119
7159
  }
7120
7160
  function toJsonFailure(error) {
7121
7161
  if (error instanceof CliError) {
@@ -7275,7 +7315,7 @@ function addAdminCommands(program2) {
7275
7315
  const { queueCommand: queueCommand2 } = await Promise.resolve().then(() => (init_admin_tracks(), exports_admin_tracks));
7276
7316
  await runAdminQueue(options, queueCommand2);
7277
7317
  });
7278
- adminTracks.command("list").description("List findings, filterable by musical-key presence (--no-key / --has-key)").option("--limit <limit>", "Number of findings to show", "50").option("--no-key", "Only findings with NO stored musical key (the key-backfill backlog)").option("--has-key <bool>", "Filter by key presence: true (has key) or false (missing)").option("--order <order>", "Sort: asc (oldest first) or desc (newest first)", "desc").option("--json", "Print JSON", false).action(async (options) => {
7318
+ adminTracks.command("list").description("List findings, filterable by musical-key presence (--no-key / --has-key)").option("--limit <limit>", "Number of findings to show (1-100)", "50").option("--all", "Fetch the ENTIRE catalogue, paginating past the 100-row cap (overrides --limit)", false).option("--no-key", "Only findings with NO stored musical key (the key-backfill backlog)").option("--has-key <bool>", "Filter by key presence: true (has key) or false (missing)").option("--order <order>", "Sort: asc (oldest first) or desc (newest first)", "desc").option("--json", "Print JSON", false).action(async (options) => {
7279
7319
  const { listCommand: listCommand2 } = await Promise.resolve().then(() => (init_admin_tracks(), exports_admin_tracks));
7280
7320
  await runAdminTracksList(options, listCommand2);
7281
7321
  });
@@ -7293,6 +7333,10 @@ function addAdminCommands(program2) {
7293
7333
  await runAdminVehicles(options, vehiclesCommand2);
7294
7334
  });
7295
7335
  const adminTrack = adminTracks;
7336
+ adminTrack.command("get").description("Look up one finding by id or Log ID, with full admin fields").argument("[idOrLogId]").option("--json", "Print JSON", false).allowExcessArguments().action(async (idOrLogId, options) => {
7337
+ const { trackGetAdminCommand: trackGetAdminCommand2 } = await Promise.resolve().then(() => (init_track(), exports_track));
7338
+ await runTrackGetAdmin(idOrLogId, options, trackGetAdminCommand2);
7339
+ });
7296
7340
  adminTrack.command("update").description("Certify a track into the archive").argument("[trackId]").option("--bpm <number>", "Track BPM").option("--features <json>", "Audio feature JSON").option("--json", "Print JSON", false).option("--key <key>", "Musical key").option("--note <text>", "Operator note").option("--status <status>", "Enrichment status").option("--video-url <url>", "Rendered video URL").allowExcessArguments().action(async (trackId, options) => {
7297
7341
  const { trackUpdateCommand: trackUpdateCommand2 } = await Promise.resolve().then(() => (init_track(), exports_track));
7298
7342
  await runTrackUpdate(trackId, options, trackUpdateCommand2);
@@ -7869,6 +7913,28 @@ async function runTrackGet(idOrLogId, options, trackGetCommand2) {
7869
7913
  console.log(`Log: ${t.logPageUrl}`);
7870
7914
  }
7871
7915
  }
7916
+ async function runTrackGetAdmin(idOrLogId, options, trackGetAdminCommand2) {
7917
+ if (!idOrLogId) {
7918
+ throw new Error("Missing id. Usage: fluncle admin tracks get <track_id|log_id> [--json]");
7919
+ }
7920
+ const result = await trackGetAdminCommand2(idOrLogId);
7921
+ if (options.json) {
7922
+ printJson(result);
7923
+ return;
7924
+ }
7925
+ const t = result.track;
7926
+ console.log(`${t.logId ? `${t.logId} ` : ""}${t.artists.join(", ")} \u2014 ${t.title}`);
7927
+ console.log([t.bpm ? `${t.bpm} bpm` : undefined, t.key, t.label, t.enrichmentStatus].filter(Boolean).join(" \xB7 "));
7928
+ const placed = t.galaxy && t.vibeX !== undefined && t.vibeY !== undefined;
7929
+ console.log(`Placement: ${placed && t.galaxy ? `${t.galaxy.name} (${t.vibeX?.toFixed(2)}, ${t.vibeY?.toFixed(2)})` : "unplaced"}`);
7930
+ console.log(`Video: ${t.videoUrl ? [t.videoSquaredAt ? "squared master" : "linked", t.videoVehicle].filter(Boolean).join(" \xB7 ") : "none (in the render queue)"}`);
7931
+ console.log(`Observation: ${t.observationAudioUrl ? `voiced${t.observationDurationMs ? ` \xB7 ${Math.round(t.observationDurationMs / 1000)}s` : ""}` : "none"}`);
7932
+ console.log(`Note: ${t.note ? t.note : "none"}`);
7933
+ console.log(`Spotify: ${t.spotifyUrl}`);
7934
+ if (t.logPageUrl) {
7935
+ console.log(`Log: ${t.logPageUrl}`);
7936
+ }
7937
+ }
7872
7938
  async function runTrackUpdate(trackId, options, trackUpdateCommand2) {
7873
7939
  if (!trackId) {
7874
7940
  throw new Error("Missing track id. Usage: fluncle admin tracks update <track_id>");
@@ -8192,7 +8258,7 @@ function resolveHasKey(options) {
8192
8258
  return;
8193
8259
  }
8194
8260
  async function runAdminTracksList(options, listCommand2) {
8195
- const limit = parseListLimit(options.limit);
8261
+ const limit = options.all ? Number.POSITIVE_INFINITY : parseListLimit(options.limit);
8196
8262
  const order = options.order === "asc" ? "asc" : "desc";
8197
8263
  const hasKey = resolveHasKey(options);
8198
8264
  const tracks = await listCommand2({ hasKey, limit, order });
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.90.0"
34
+ "version": "0.92.0"
35
35
  }