fluncle 0.127.0 → 0.128.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 -2
  2. package/package.json +1 -1
package/bin/fluncle.mjs CHANGED
@@ -561,7 +561,7 @@ function parseVersion(version) {
561
561
  var currentVersion;
562
562
  var init_version = __esm(() => {
563
563
  init_output();
564
- currentVersion = "0.127.0".trim() ? "0.127.0".trim() : "0.1.0";
564
+ currentVersion = "0.128.0".trim() ? "0.128.0".trim() : "0.1.0";
565
565
  });
566
566
 
567
567
  // src/update-notifier.ts
@@ -2189,7 +2189,7 @@ function parseVersion2(version) {
2189
2189
  var currentVersion2, latestReleaseUrl = "https://api.github.com/repos/mauricekleine/fluncle/releases/latest";
2190
2190
  var init_version2 = __esm(() => {
2191
2191
  init_output();
2192
- currentVersion2 = "0.127.0".trim() ? "0.127.0".trim() : "0.1.0";
2192
+ currentVersion2 = "0.128.0".trim() ? "0.128.0".trim() : "0.1.0";
2193
2193
  });
2194
2194
 
2195
2195
  // ../../packages/registry/src/index.ts
@@ -5295,6 +5295,29 @@ var init_auth_lastfm = __esm(() => {
5295
5295
  init_api();
5296
5296
  });
5297
5297
 
5298
+ // src/commands/admin-catalogue.ts
5299
+ var exports_admin_catalogue = {};
5300
+ __export(exports_admin_catalogue, {
5301
+ catalogueRankCommand: () => catalogueRankCommand,
5302
+ catalogueListCommand: () => catalogueListCommand
5303
+ });
5304
+ async function catalogueRankCommand(options) {
5305
+ const limit = options.limit ? Number.parseInt(options.limit, 10) : undefined;
5306
+ const response = await adminApiPost("/api/admin/catalogue/rank", limit ? { limit } : {});
5307
+ return response.summary;
5308
+ }
5309
+ async function catalogueListCommand(options) {
5310
+ const params = new URLSearchParams;
5311
+ params.set("lens", options.lens === "capture" ? "capture" : "ear");
5312
+ if (options.limit) {
5313
+ params.set("limit", options.limit);
5314
+ }
5315
+ return adminApiGet(`/api/admin/catalogue?${params.toString()}`);
5316
+ }
5317
+ var init_admin_catalogue = __esm(() => {
5318
+ init_api();
5319
+ });
5320
+
5298
5321
  // src/commands/admin-artists.ts
5299
5322
  var exports_admin_artists = {};
5300
5323
  __export(exports_admin_artists, {
@@ -8212,6 +8235,18 @@ function addAdminCommands(program2) {
8212
8235
  const { galaxyMapWriteCommand: galaxyMapWriteCommand2 } = await Promise.resolve().then(() => (init_galaxies(), exports_galaxies));
8213
8236
  await runGalaxyMapWrite(options, galaxyMapWriteCommand2);
8214
8237
  });
8238
+ const catalogue = configureCommand(admin.command("catalogue").description("The catalogue (uncertified tracks) + its ranking"));
8239
+ catalogue.action(() => {
8240
+ catalogue.outputHelp();
8241
+ });
8242
+ catalogue.command("rank").description("Run one tick of the ranking sweep (nearest finding + capture priority)").option("--limit <limit>", "Candidates per tick (default 250)").option("--json", "Print JSON", false).action(async (options) => {
8243
+ const { catalogueRankCommand: catalogueRankCommand2 } = await Promise.resolve().then(() => (init_admin_catalogue(), exports_admin_catalogue));
8244
+ await runCatalogueRank(options, catalogueRankCommand2);
8245
+ });
8246
+ catalogue.command("list").description("The ranked catalogue: closest to a finding (ear), or next to capture").option("--lens <lens>", "ear (default) or capture", "ear").option("--limit <limit>", "Rows (default 50, max 200)").option("--json", "Print JSON", false).action(async (options) => {
8247
+ const { catalogueListCommand: catalogueListCommand2 } = await Promise.resolve().then(() => (init_admin_catalogue(), exports_admin_catalogue));
8248
+ await runCatalogueList(options, catalogueListCommand2);
8249
+ });
8215
8250
  const backfill = configureCommand(admin.command("backfills").description("Backfill operator-only archives"));
8216
8251
  backfill.action(() => {
8217
8252
  backfill.outputHelp();
@@ -9314,6 +9349,41 @@ async function runGalaxies(slug, options, commands) {
9314
9349
  console.log(`${galaxy.name.padEnd(40)} ${String(galaxy.memberCount).padStart(3)} finding${galaxy.memberCount === 1 ? "" : "s"}`);
9315
9350
  }
9316
9351
  }
9352
+ async function runCatalogueRank(options, catalogueRankCommand2) {
9353
+ const summary = await catalogueRankCommand2({ limit: options.limit });
9354
+ if (options.json) {
9355
+ printJson({ ok: true, summary });
9356
+ return;
9357
+ }
9358
+ console.log(`Ranked ${summary.scored} against ${summary.embeddedFindings} embedded findings; prioritized ${summary.prioritized} for capture. ${summary.remaining} still stale.`);
9359
+ }
9360
+ async function runCatalogueList(options, catalogueListCommand2) {
9361
+ const { summary, tracks } = await catalogueListCommand2({
9362
+ lens: options.lens,
9363
+ limit: options.limit
9364
+ });
9365
+ if (options.json) {
9366
+ printJson({ ok: true, summary, tracks });
9367
+ return;
9368
+ }
9369
+ if (tracks.length === 0) {
9370
+ console.log("Nothing out there yet.");
9371
+ return;
9372
+ }
9373
+ for (const track of tracks) {
9374
+ const identity = `${track.artists.join(", ")} \u2014 ${track.title}`;
9375
+ if (options.lens === "capture") {
9376
+ const reason = track.captureReason;
9377
+ const why2 = reason?.kind === "artist" ? `${reason.name} is already in the archive` : reason?.kind === "label" ? `${reason.name} already carries a finding` : reason?.kind === "seed-label" ? `${reason.name} is a label the crawler digs from` : reason?.kind === "skipped-label" ? `${reason.name} is not your lane \u2014 ranked last, kept anyway` : "nothing ties it to the archive yet";
9378
+ console.log(`${String(track.capturePriority ?? 0)} ${identity.padEnd(52)} ${why2}`);
9379
+ continue;
9380
+ }
9381
+ const match = track.nearestFinding;
9382
+ const score = track.nearestFindingScore?.toFixed(2) ?? "\u2014";
9383
+ const why = match ? `closest to ${match.logId ? `${match.logId} ` : ""}${match.artists.join(", ")} \u2014 ${match.title}` : "nothing to compare it to yet";
9384
+ console.log(`${score} ${identity.padEnd(52)} ${why}`);
9385
+ }
9386
+ }
9317
9387
  async function runGalaxyMapRead(options, galaxyMapReadCommand2) {
9318
9388
  const galaxies = await galaxyMapReadCommand2();
9319
9389
  if (options.json) {
@@ -9878,6 +9948,7 @@ var stringOptions = new Set([
9878
9948
  "--key-confidence",
9879
9949
  "--key-source",
9880
9950
  "--kind",
9951
+ "--lens",
9881
9952
  "--limit",
9882
9953
  "--metrics",
9883
9954
  "--mime",
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.127.0"
34
+ "version": "0.128.0"
35
35
  }