fluncle 0.44.0 → 0.46.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 +68 -41
  2. package/package.json +1 -1
package/bin/fluncle.mjs CHANGED
@@ -48,7 +48,7 @@ var __export = (target, all) => {
48
48
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
49
49
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
50
50
 
51
- // ../../node_modules/.bun/commander@14.0.3/node_modules/commander/lib/error.js
51
+ // ../../node_modules/commander/lib/error.js
52
52
  var require_error = __commonJS((exports) => {
53
53
  class CommanderError extends Error {
54
54
  constructor(exitCode, code, message) {
@@ -72,7 +72,7 @@ var require_error = __commonJS((exports) => {
72
72
  exports.InvalidArgumentError = InvalidArgumentError;
73
73
  });
74
74
 
75
- // ../../node_modules/.bun/commander@14.0.3/node_modules/commander/lib/argument.js
75
+ // ../../node_modules/commander/lib/argument.js
76
76
  var require_argument = __commonJS((exports) => {
77
77
  var { InvalidArgumentError } = require_error();
78
78
 
@@ -152,7 +152,7 @@ var require_argument = __commonJS((exports) => {
152
152
  exports.humanReadableArgName = humanReadableArgName;
153
153
  });
154
154
 
155
- // ../../node_modules/.bun/commander@14.0.3/node_modules/commander/lib/help.js
155
+ // ../../node_modules/commander/lib/help.js
156
156
  var require_help = __commonJS((exports) => {
157
157
  var { humanReadableArgName } = require_argument();
158
158
 
@@ -509,7 +509,7 @@ ${itemIndentStr}`);
509
509
  exports.stripColor = stripColor;
510
510
  });
511
511
 
512
- // ../../node_modules/.bun/commander@14.0.3/node_modules/commander/lib/option.js
512
+ // ../../node_modules/commander/lib/option.js
513
513
  var require_option = __commonJS((exports) => {
514
514
  var { InvalidArgumentError } = require_error();
515
515
 
@@ -693,7 +693,7 @@ var require_option = __commonJS((exports) => {
693
693
  exports.DualOptions = DualOptions;
694
694
  });
695
695
 
696
- // ../../node_modules/.bun/commander@14.0.3/node_modules/commander/lib/suggestSimilar.js
696
+ // ../../node_modules/commander/lib/suggestSimilar.js
697
697
  var require_suggestSimilar = __commonJS((exports) => {
698
698
  var maxDistance = 3;
699
699
  function editDistance(a, b) {
@@ -766,7 +766,7 @@ var require_suggestSimilar = __commonJS((exports) => {
766
766
  exports.suggestSimilar = suggestSimilar;
767
767
  });
768
768
 
769
- // ../../node_modules/.bun/commander@14.0.3/node_modules/commander/lib/command.js
769
+ // ../../node_modules/commander/lib/command.js
770
770
  var require_command = __commonJS((exports) => {
771
771
  var EventEmitter = __require("node:events").EventEmitter;
772
772
  var childProcess = __require("node:child_process");
@@ -2121,7 +2121,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2121
2121
  exports.useColor = useColor;
2122
2122
  });
2123
2123
 
2124
- // ../../node_modules/.bun/commander@14.0.3/node_modules/commander/index.js
2124
+ // ../../node_modules/commander/index.js
2125
2125
  var require_commander = __commonJS((exports) => {
2126
2126
  var { Argument } = require_argument();
2127
2127
  var { Command } = require_command();
@@ -2141,7 +2141,7 @@ var require_commander = __commonJS((exports) => {
2141
2141
  exports.InvalidOptionArgumentError = InvalidArgumentError;
2142
2142
  });
2143
2143
 
2144
- // ../../node_modules/.bun/dotenv@16.6.1/node_modules/dotenv/package.json
2144
+ // ../../node_modules/dotenv/package.json
2145
2145
  var require_package = __commonJS((exports, module) => {
2146
2146
  module.exports = {
2147
2147
  name: "dotenv",
@@ -2207,7 +2207,7 @@ var require_package = __commonJS((exports, module) => {
2207
2207
  };
2208
2208
  });
2209
2209
 
2210
- // ../../node_modules/.bun/dotenv@16.6.1/node_modules/dotenv/lib/main.js
2210
+ // ../../node_modules/dotenv/lib/main.js
2211
2211
  var require_main = __commonJS((exports, module) => {
2212
2212
  var fs = __require("fs");
2213
2213
  var path = __require("path");
@@ -2539,7 +2539,7 @@ function parseVersion(version) {
2539
2539
  var currentVersion;
2540
2540
  var init_version = __esm(() => {
2541
2541
  init_output();
2542
- currentVersion = "0.44.0".trim() ? "0.44.0".trim() : "0.1.0";
2542
+ currentVersion = "0.46.0".trim() ? "0.46.0".trim() : "0.1.0";
2543
2543
  });
2544
2544
 
2545
2545
  // src/update-notifier.ts
@@ -4001,7 +4001,7 @@ function parseVersion2(version) {
4001
4001
  var currentVersion2, latestReleaseUrl = "https://api.github.com/repos/mauricekleine/fluncle/releases/latest";
4002
4002
  var init_version2 = __esm(() => {
4003
4003
  init_output();
4004
- currentVersion2 = "0.44.0".trim() ? "0.44.0".trim() : "0.1.0";
4004
+ currentVersion2 = "0.46.0".trim() ? "0.46.0".trim() : "0.1.0";
4005
4005
  });
4006
4006
 
4007
4007
  // src/commands/track.ts
@@ -4216,7 +4216,7 @@ async function enrichQueueCommand(limit) {
4216
4216
  return fetchAdminTracks({ max: limit, order: "asc", status: "queue" });
4217
4217
  }
4218
4218
  async function enrichSweepCommand(limit) {
4219
- return adminApiPost(`/api/admin/enrich-sweep?limit=${limit}`);
4219
+ return adminApiPost(`/api/admin/tracks/enrich?limit=${limit}`);
4220
4220
  }
4221
4221
  async function backfillLastfmCommand(limit, dryRun, cursor) {
4222
4222
  const params = new URLSearchParams({ dryRun: String(dryRun), limit: String(limit) });
@@ -4631,8 +4631,12 @@ __export(exports_submissions, {
4631
4631
  approveSubmissionCommand: () => approveSubmissionCommand
4632
4632
  });
4633
4633
  import { createInterface as createInterface2 } from "node:readline/promises";
4634
- async function listSubmissionsCommand() {
4634
+ async function listSubmissionsCommand(options = {}) {
4635
4635
  const response = await adminApiGet("/api/admin/submissions");
4636
+ if (options.json) {
4637
+ printJson2({ ok: true, submissions: response.submissions });
4638
+ return;
4639
+ }
4636
4640
  if (response.submissions.length === 0) {
4637
4641
  console.log("No pending submissions.");
4638
4642
  return;
@@ -4641,30 +4645,45 @@ async function listSubmissionsCommand() {
4641
4645
 
4642
4646
  `));
4643
4647
  }
4644
- async function reviewSubmissionCommand(submissionId) {
4648
+ async function reviewSubmissionCommand(submissionId, options = {}) {
4645
4649
  const submission = await fetchSubmission(submissionId);
4650
+ if (options.json) {
4651
+ printJson2({ ok: true, submission });
4652
+ return;
4653
+ }
4646
4654
  console.log(formatSubmissionDetail(submission));
4647
4655
  }
4648
- async function rejectSubmissionCommand(submissionId) {
4656
+ async function rejectSubmissionCommand(submissionId, options = {}) {
4649
4657
  const response = await adminApiPost(`/api/admin/submissions/${encodeURIComponent(submissionId)}/reject`);
4658
+ if (options.json) {
4659
+ printJson2({ ok: true, submission: response.submission });
4660
+ return;
4661
+ }
4650
4662
  console.log(`Rejected ${formatTrackLine(response.submission)}.`);
4651
4663
  }
4652
- async function approveSubmissionCommand(submissionId) {
4664
+ async function approveSubmissionCommand(submissionId, options = {}) {
4653
4665
  const submission = await fetchSubmission(submissionId);
4654
- console.log(formatSubmissionDetail(submission));
4655
- console.log("");
4656
- await addCommand2(submission.spotifyUrl, {
4657
- dryRun: true
4658
- });
4659
- const confirmed = await confirm("Publish this submission? (Y/n) ");
4660
- if (!confirmed) {
4661
- console.log("Approval cancelled.");
4662
- return;
4666
+ if (!options.json) {
4667
+ console.log(formatSubmissionDetail(submission));
4668
+ console.log("");
4669
+ await addCommand2(submission.spotifyUrl, {
4670
+ dryRun: true
4671
+ });
4672
+ const confirmed = await confirm("Publish this submission? (Y/n) ");
4673
+ if (!confirmed) {
4674
+ console.log("Approval cancelled.");
4675
+ return;
4676
+ }
4663
4677
  }
4664
4678
  await addCommand2(submission.spotifyUrl, {
4679
+ json: options.json,
4665
4680
  note: submission.note
4666
4681
  });
4667
- await adminApiPost(`/api/admin/submissions/${encodeURIComponent(submission.id)}/approve`);
4682
+ const response = await adminApiPost(`/api/admin/submissions/${encodeURIComponent(submission.id)}/approve`);
4683
+ if (options.json) {
4684
+ printJson2({ ok: true, submission: response.submission });
4685
+ return;
4686
+ }
4668
4687
  console.log(`Approved ${formatTrackLine(submission)}.`);
4669
4688
  }
4670
4689
  async function fetchSubmission(submissionId) {
@@ -4673,7 +4692,7 @@ async function fetchSubmission(submissionId) {
4673
4692
  }
4674
4693
  async function confirm(label) {
4675
4694
  if (!process.stdin.isTTY || !process.stdout.isTTY) {
4676
- return false;
4695
+ throw new CliError2("not_interactive", "Approving publishes a submission and needs a yes. Run this in a terminal, or pass --json to approve without the prompt.");
4677
4696
  }
4678
4697
  const rl = createInterface2({
4679
4698
  input: process.stdin,
@@ -4713,6 +4732,7 @@ function formatTrackLine(submission) {
4713
4732
  }
4714
4733
  var init_submissions = __esm(() => {
4715
4734
  init_api();
4735
+ init_output();
4716
4736
  init_add2();
4717
4737
  });
4718
4738
 
@@ -5194,7 +5214,7 @@ var COORD_FALLBACK2 = "—";
5194
5214
  import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
5195
5215
  import path from "path";
5196
5216
 
5197
- // ../../node_modules/.bun/commander@14.0.3/node_modules/commander/esm.mjs
5217
+ // ../../node_modules/commander/esm.mjs
5198
5218
  var import__ = __toESM(require_commander(), 1);
5199
5219
  var {
5200
5220
  program,
@@ -5411,13 +5431,17 @@ function addAdminCommands(program2) {
5411
5431
  const { enrichQueueCommand: enrichQueueCommand2 } = await Promise.resolve().then(() => (init_admin_tracks(), exports_admin_tracks));
5412
5432
  await runAdminEnrichQueue(options, enrichQueueCommand2);
5413
5433
  });
5414
- adminTracks.command("enrich-sweep").description("Re-fire enrichment for everything in the enrich-queue (idempotent self-heal)").option("--limit <limit>", "Max findings to re-trigger", "25").option("--json", "Print JSON", false).action(async (options) => {
5434
+ adminTracks.command("enrich").description("Re-fire enrichment for everything in the enrich-queue (--all; idempotent self-heal)").option("--all", "Sweep the whole enrich-queue (required)", false).option("--limit <limit>", "Max findings to re-trigger", "25").option("--json", "Print JSON", false).action(async (options) => {
5415
5435
  const { enrichSweepCommand: enrichSweepCommand2 } = await Promise.resolve().then(() => (init_admin_tracks(), exports_admin_tracks));
5416
- await runAdminEnrichSweep(options, enrichSweepCommand2);
5436
+ await runAdminEnrich(options, enrichSweepCommand2);
5417
5437
  });
5418
- admin.command("enrich-sweep", { hidden: true }).description("Enrich sweep (alias of `admin tracks enrich-sweep`)").option("--limit <limit>", "Max findings to re-trigger", "25").option("--json", "Print JSON", false).action(async (options) => {
5438
+ adminTracks.command("enrich-sweep", { hidden: true }).description("Enrich sweep (alias of `admin tracks enrich --all`)").option("--limit <limit>", "Max findings to re-trigger", "25").option("--json", "Print JSON", false).action(async (options) => {
5419
5439
  const { enrichSweepCommand: enrichSweepCommand2 } = await Promise.resolve().then(() => (init_admin_tracks(), exports_admin_tracks));
5420
- await runAdminEnrichSweep(options, enrichSweepCommand2);
5440
+ await runAdminEnrich({ ...options, all: true }, enrichSweepCommand2);
5441
+ });
5442
+ admin.command("enrich-sweep", { hidden: true }).description("Enrich sweep (alias of `admin tracks enrich --all`)").option("--limit <limit>", "Max findings to re-trigger", "25").option("--json", "Print JSON", false).action(async (options) => {
5443
+ const { enrichSweepCommand: enrichSweepCommand2 } = await Promise.resolve().then(() => (init_admin_tracks(), exports_admin_tracks));
5444
+ await runAdminEnrich({ ...options, all: true }, enrichSweepCommand2);
5421
5445
  });
5422
5446
  adminTracks.command("vehicles").description("Recent video vehicles, newest first (the style ledger for diversity)").option("--limit <limit>", "Number of vehicles to show", "10").option("--json", "Print JSON", false).action(async (options) => {
5423
5447
  const { vehiclesCommand: vehiclesCommand2 } = await Promise.resolve().then(() => (init_admin_tracks(), exports_admin_tracks));
@@ -5493,30 +5517,30 @@ function addAdminCommands(program2) {
5493
5517
  await runMixtapePublishYoutube(idOrLogId, options, publishYoutubeCommand3);
5494
5518
  });
5495
5519
  const submissions = configureCommand(admin.command("submissions").description("Review listener submissions"));
5496
- submissions.action(async () => {
5520
+ submissions.option("--json", "Print JSON", false).action(async (options) => {
5497
5521
  const { listSubmissionsCommand: listSubmissionsCommand2 } = await Promise.resolve().then(() => (init_submissions(), exports_submissions));
5498
- await listSubmissionsCommand2();
5522
+ await listSubmissionsCommand2(options);
5499
5523
  });
5500
- submissions.command("review").description("Inspect one submission").argument("[submissionId]").action(async (submissionId) => {
5524
+ submissions.command("review").description("Inspect one submission").argument("[submissionId]").option("--json", "Print JSON", false).action(async (submissionId, options) => {
5501
5525
  if (!submissionId) {
5502
5526
  throw new Error("Missing submission id for: review");
5503
5527
  }
5504
5528
  const { reviewSubmissionCommand: reviewSubmissionCommand2 } = await Promise.resolve().then(() => (init_submissions(), exports_submissions));
5505
- await reviewSubmissionCommand2(submissionId);
5529
+ await reviewSubmissionCommand2(submissionId, options);
5506
5530
  });
5507
- submissions.command("reject").description("Reject a submission").argument("[submissionId]").action(async (submissionId) => {
5531
+ submissions.command("reject").description("Reject a submission").argument("[submissionId]").option("--json", "Print JSON", false).action(async (submissionId, options) => {
5508
5532
  if (!submissionId) {
5509
5533
  throw new Error("Missing submission id for: reject");
5510
5534
  }
5511
5535
  const { rejectSubmissionCommand: rejectSubmissionCommand2 } = await Promise.resolve().then(() => (init_submissions(), exports_submissions));
5512
- await rejectSubmissionCommand2(submissionId);
5536
+ await rejectSubmissionCommand2(submissionId, options);
5513
5537
  });
5514
- submissions.command("approve").description("Approve a submission").argument("[submissionId]").action(async (submissionId) => {
5538
+ submissions.command("approve").description("Approve a submission (--json approves without the confirm prompt)").argument("[submissionId]").option("--json", "Print JSON, skip the confirm prompt", false).action(async (submissionId, options) => {
5515
5539
  if (!submissionId) {
5516
5540
  throw new Error("Missing submission id for: approve");
5517
5541
  }
5518
5542
  const { approveSubmissionCommand: approveSubmissionCommand2 } = await Promise.resolve().then(() => (init_submissions(), exports_submissions));
5519
- await approveSubmissionCommand2(submissionId);
5543
+ await approveSubmissionCommand2(submissionId, options);
5520
5544
  });
5521
5545
  const auth = configureCommand(admin.command("auth").description("Authentication commands"));
5522
5546
  auth.command("spotify").description("Authorize Spotify access").action(async () => {
@@ -6089,7 +6113,10 @@ async function runAdminEnrichQueue(options, enrichQueueCommand2) {
6089
6113
  console.log(trackRows2(tracks).join(`
6090
6114
  `));
6091
6115
  }
6092
- async function runAdminEnrichSweep(options, enrichSweepCommand2) {
6116
+ async function runAdminEnrich(options, enrichSweepCommand2) {
6117
+ if (!options.all) {
6118
+ throw new Error("Usage: fluncle admin tracks enrich --all [--limit 25] [--json] (sweeps the whole enrich-queue)");
6119
+ }
6093
6120
  const limit = parseListLimit(options.limit);
6094
6121
  const result = await enrichSweepCommand2(limit);
6095
6122
  if (options.json) {
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.44.0"
34
+ "version": "0.46.0"
35
35
  }