faustwave 0.97.1 → 0.98.1

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.
@@ -8058,9 +8058,11 @@ __export(hub_exports, {
8058
8058
  HUB_OPERATIONS: () => HUB_OPERATIONS,
8059
8059
  hubCall: () => hubCall,
8060
8060
  hubCommand: () => hubCommand,
8061
+ signedInAsAdmin: () => signedInAsAdmin,
8061
8062
  zipFolder: () => zipFolder
8062
8063
  });
8063
8064
  import fs3 from "node:fs";
8065
+ import { gunzipSync } from "node:zlib";
8064
8066
  import path5 from "node:path";
8065
8067
  import { crc32, deflateRawSync } from "node:zlib";
8066
8068
  async function tokenCall(fields) {
@@ -8091,6 +8093,7 @@ async function login() {
8091
8093
  if (typeof t.refresh_token !== "string") throw new Error("Logto gave no refresh token (is offline_access allowed for the app?)");
8092
8094
  writeLogin({ refreshToken: t.refresh_token });
8093
8095
  const me = await hub("GET", "/users/me");
8096
+ rememberAdmin(me.role === "admin");
8094
8097
  return `signed in to ${HUB} as ${me.username ?? me.displayName}${me.role === "admin" ? " (admin)" : ""}`;
8095
8098
  }
8096
8099
  throw new Error("the code expired \u2014 run faustwave login again");
@@ -8105,6 +8108,7 @@ async function accessToken() {
8105
8108
  throw new Error(`the sign-in to ${HUB} has expired \u2014 run faustwave login`);
8106
8109
  }
8107
8110
  writeLogin({
8111
+ admin: login2.admin,
8108
8112
  refreshToken: typeof t.refresh_token === "string" ? t.refresh_token : login2.refreshToken,
8109
8113
  accessToken: t.access_token,
8110
8114
  expiresAt: Date.now() + Number(t.expires_in ?? 3600) * 1e3
@@ -8160,7 +8164,7 @@ async function hub(method, route, body) {
8160
8164
  const problems = Array.isArray(json?.problems) ? `
8161
8165
  - ${json.problems.join("\n - ")}` : "";
8162
8166
  const message = Array.isArray(json?.message) ? json.message.join("; ") : json?.message ?? res.statusText;
8163
- throw new Error(`${method} ${route}: ${res.status} ${message}${problems}`);
8167
+ throw new Error(res.status >= 500 || !json?.message ? `${method} ${route}: ${res.status} ${message}${problems}` : `${message}${problems}`);
8164
8168
  }
8165
8169
  return json;
8166
8170
  }
@@ -8211,6 +8215,39 @@ function zipFolder(dir) {
8211
8215
  end.writeUInt32LE(offset, 16);
8212
8216
  return Buffer.concat([...locals, cd, end]);
8213
8217
  }
8218
+ async function waiting(slug) {
8219
+ const all = await hub("GET", "/review");
8220
+ const version2 = all.find((r) => r.app.slug === slug)?.version;
8221
+ if (!version2) throw new Error(`${slug}: no release of it waits \u2014 faustwave review lists what does`);
8222
+ return version2;
8223
+ }
8224
+ function pluginSays(file2) {
8225
+ let tar;
8226
+ try {
8227
+ tar = gunzipSync(file2);
8228
+ } catch {
8229
+ throw new Error("push takes a plugin package (.wclap.tar.gz, as faustwave build plugin makes it) or a player folder");
8230
+ }
8231
+ for (let at = 0; at + 512 <= tar.length; ) {
8232
+ const name = tar.toString("utf8", at, at + 100).replace(/\0.*$/, "");
8233
+ if (!name) break;
8234
+ const size = parseInt(tar.toString("ascii", at + 124, at + 136), 8) || 0;
8235
+ if (name === "plugin.json" || name === "./plugin.json") {
8236
+ const p = JSON.parse(tar.toString("utf8", at + 512, at + 512 + size));
8237
+ if (!p.name || !p.version) break;
8238
+ return { title: p.name, version: p.version, type: p.instrument ? "instrument" : "effect", channel: "wclap" };
8239
+ }
8240
+ at += 512 + Math.ceil(size / 512) * 512;
8241
+ }
8242
+ throw new Error("the package does not say its name and version (plugin.json) \u2014 build it with faustwave build plugin");
8243
+ }
8244
+ function playerSays(dir) {
8245
+ const file2 = path5.join(dir, "faustwave.json");
8246
+ if (!fs3.existsSync(file2)) throw new Error(`${dir} holds no faustwave.json \u2014 push a player folder as FaustWave exports it, or a plugin package`);
8247
+ const m = JSON.parse(fs3.readFileSync(file2, "utf8"));
8248
+ if (!m.name || !m.version || !m.type) throw new Error("faustwave.json does not say name, version and type");
8249
+ return { title: m.name, version: m.version, type: m.type, channel: "web" };
8250
+ }
8214
8251
  async function hubCommand(command2, args) {
8215
8252
  const enc = encodeURIComponent;
8216
8253
  switch (command2) {
@@ -8220,11 +8257,6 @@ async function hubCommand(command2, args) {
8220
8257
  writeLogin(null);
8221
8258
  return `signed out of ${HUB}`;
8222
8259
  case "app": {
8223
- if (args[0] === "create") {
8224
- const [, slug, type, ...title] = need(args, 4, "app create <slug> <type> <title>");
8225
- await hub("POST", "/apps", { slug, type, title: title.join(" ") });
8226
- return `app ${slug} made \u2014 a draft, seen by you only: describe it, give it a picture, push a build (faustwave push ${slug} <version> <channel> <file>), then faustwave submit ${slug} <version> \u2014 the admin reviews it and makes it public`;
8227
- }
8228
8260
  if (args[0] === "visibility") {
8229
8261
  const [, slug, visibility] = need(args, 3, "app visibility <slug> <draft | unlisted | public>");
8230
8262
  await hub("PATCH", `/apps/${enc(slug)}`, { visibility });
@@ -8237,91 +8269,118 @@ async function hubCommand(command2, args) {
8237
8269
  await hub("PATCH", `/apps/${enc(slug)}`, { description });
8238
8270
  return `app ${slug}: description set (${description.length} characters)`;
8239
8271
  }
8240
- if (args[0] === "items") {
8241
- const [, slug] = need(args, 3, "app items <slug> <item\u2026| none>");
8242
- const items = args[2] === "none" ? [] : args.slice(2);
8243
- await hub("PATCH", `/apps/${enc(slug)}`, { items });
8244
- return items.length ? `app ${slug} presents ${items.join(", ")} \u2014 its page offers them` : `app ${slug} presents nothing for sale`;
8245
- }
8246
8272
  if (args[0] === "cover") {
8247
- const [, slug, file] = need(args, 3, "app cover <slug> <picture file>");
8248
- const bytes = fs3.readFileSync(file);
8273
+ const [, slug, file2] = need(args, 3, "app cover <slug> <picture file>");
8274
+ const bytes = fs3.readFileSync(file2);
8249
8275
  const body = new FormData();
8250
- body.append("file", new Blob([new Uint8Array(bytes)]), path5.basename(file));
8276
+ body.append("file", new Blob([new Uint8Array(bytes)]), path5.basename(file2));
8251
8277
  await hub("PUT", `/apps/${enc(slug)}/cover`, body);
8252
8278
  return `app ${slug}: picture set (${(bytes.length / 1024).toFixed(0)} KB)`;
8253
8279
  }
8254
- throw new Error("usage: faustwave app create <slug> <type> <title> | app visibility <slug> <draft | unlisted | public> | app describe <slug> <text | file> | app cover <slug> <picture file> | app items <slug> <item\u2026| none>");
8255
- }
8256
- case "item": {
8257
- if (args[0] === "create") {
8258
- const [, slug, ...title] = need(args, 3, "item create <slug> <title>");
8259
- await hub("POST", "/items", { slug, title: title.join(" ") });
8260
- return `item ${slug} made \u2014 not for sale until it has a price (faustwave item price ${slug} <pri_\u2026>)`;
8261
- }
8262
- if (args[0] === "price") {
8263
- const [, slug, price] = need(args, 3, "item price <slug> <pri_\u2026 | free | none>");
8264
- const body = price === "free" ? { free: true } : price === "none" ? { free: false, paddlePriceId: null } : { paddlePriceId: price };
8265
- await hub("PATCH", `/items/${enc(slug)}`, body);
8266
- if (price === "free") return `item ${slug} is free \u2014 taken with a license, on the website`;
8267
- return price === "none" ? `item ${slug} is not to have` : `item ${slug} sells at Paddle price ${price} (who took it free keeps it)`;
8268
- }
8269
- if (args[0] === "file") {
8270
- const [, slug, file] = need(args, 3, "item file <slug> <file>");
8271
- const bytes = fs3.readFileSync(file);
8272
- const body = new FormData();
8273
- body.append("file", new Blob([new Uint8Array(bytes)]), path5.basename(file));
8274
- const item = await hub("PUT", `/items/${enc(slug)}/file`, body);
8275
- return `item ${slug}: file set (${(bytes.length / 1024).toFixed(0)} KB) \u2014 its buyers download ${item.fileName ?? path5.basename(file)}`;
8276
- }
8277
- throw new Error("usage: faustwave item create <slug> <title> | item price <slug> <pri_\u2026 | free | none> | item file <slug> <file>");
8278
- }
8279
- case "purchases": {
8280
- const [slug] = need(args, 1, "purchases <item>");
8281
- const rows = await hub("GET", `/items/${enc(slug)}/purchases`);
8282
- if (!rows.length) return `${slug}: no purchases`;
8283
- return rows.map((p) => `${p.id} ${p.status.padEnd(8)} ${p.purchasedAt.slice(0, 10)} ${p.buyer} (${p.transactionId})`).join("\n");
8284
- }
8285
- case "refund": {
8286
- const [id, ...reason] = need(args, 1, "refund <purchase-id> [reason]");
8287
- const r = await hub("POST", `/purchases/${enc(id)}/refund`, reason.length ? { reason: reason.join(" ") } : {});
8288
- return `refund asked of Paddle: ${r.transactionId} (${r.adjustmentId}, ${r.status}) \u2014 the purchase is revoked once Paddle reports it`;
8289
- }
8290
- case "reconcile": {
8291
- const days = args[0] ? Number(args[0]) : void 0;
8292
- const r = await hub("POST", "/shop/reconcile", days ? { days } : {});
8293
- return `reconciled: ${r.transactions} transaction(s) at Paddle, ${r.added} purchase(s) added, ${r.changed} changed`;
8280
+ throw new Error("usage: faustwave app describe <slug> <text | file> | app cover <slug> <picture file> | app visibility <slug> <draft | unlisted | public>");
8294
8281
  }
8295
8282
  case "push": {
8296
- const [slug, version2, channel, source] = need(args, 4, "push <slug> <version> <channel> <folder | file>");
8283
+ const [source, named] = need(args, 1, "push <plugin.wclap.tar.gz | player folder> [slug]");
8297
8284
  const stat = fs3.statSync(source);
8298
- const file = stat.isDirectory() ? zipFolder(source) : fs3.readFileSync(source);
8285
+ const file2 = stat.isDirectory() ? zipFolder(source) : fs3.readFileSync(source);
8299
8286
  const name = stat.isDirectory() ? `${path5.basename(path5.resolve(source))}.zip` : path5.basename(source);
8287
+ const says = stat.isDirectory() ? playerSays(source) : pluginSays(file2);
8288
+ const slug = named ?? says.title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
8289
+ const mine = await hub("GET", "/users/me/apps");
8290
+ const made = !mine.some((a) => a.slug === slug);
8291
+ if (made) await hub("POST", "/apps", { slug, type: says.type, title: says.title });
8300
8292
  const body = new FormData();
8301
- body.append("file", new Blob([new Uint8Array(file)]), name);
8302
- const build2 = await hub("PUT", `/apps/${enc(slug)}/releases/${enc(version2)}/builds/${enc(channel)}`, body);
8303
- return `pushed ${name} (${(file.length / 1024).toFixed(0)} KB) as ${slug} ${version2} ${build2.channel ?? channel} \u2014 when it is ready: faustwave submit ${slug} ${version2} (the admin reviews and publishes it)`;
8293
+ body.append("file", new Blob([new Uint8Array(file2)]), name);
8294
+ await hub("PUT", `/apps/${enc(slug)}/releases/${enc(says.version)}/builds/${says.channel}`, body);
8295
+ return [
8296
+ `pushed ${name} (${(file2.length / 1024).toFixed(0)} KB) as ${slug} ${says.version}${made ? " \u2014 a new app" : ""}: a draft, seen by you only`,
8297
+ ` play it: ${SITE}/${says.channel === "wclap" ? "plugins" : "apps"}/${slug} (signed in there as you)`,
8298
+ ...made ? [` describe: faustwave app describe ${slug} <text | file> and its picture: faustwave app cover ${slug} <picture file>`] : [],
8299
+ ` ready: faustwave submit ${slug} \u2014 the admin reviews it`
8300
+ ].join("\n");
8304
8301
  }
8305
8302
  case "submit": {
8306
- const [slug, version2] = need(args, 2, "submit <slug> <version>");
8303
+ const [slug] = need(args, 1, "submit <slug>");
8304
+ const mine = await hub("GET", "/users/me/apps");
8305
+ const app = mine.find((a) => a.slug === slug);
8306
+ const version2 = app?.releases.find((r) => r.status === "draft" || r.status === "rejected")?.version;
8307
+ if (!version2)
8308
+ throw new Error(
8309
+ app?.releases.length ? `${slug}: nothing to submit \u2014 ${app.releases[0].version} is ${app.releases[0].status}; a new version: faustwave push <file>` : `${slug}: nothing of yours to submit \u2014 faustwave push <file> first (yours: faustwave me)`
8310
+ );
8307
8311
  await hub("POST", `/apps/${enc(slug)}/releases/${enc(version2)}/submit`);
8308
- return `${slug} ${version2} submitted \u2014 the admin reviews it (faustwave review) and publishes it`;
8312
+ const lacks = [
8313
+ ...app?.description ? [] : [` it has no description yet: faustwave app describe ${slug} <text | file>`],
8314
+ ...app?.coverArtifactId ? [] : [` it has no picture yet: faustwave app cover ${slug} <picture file>`]
8315
+ ];
8316
+ return [`${slug} ${version2} submitted \u2014 the admin reviews it: published, it is out and in the catalog (nothing more to do); rejected, faustwave me says why`, ...lacks].join("\n");
8309
8317
  }
8310
8318
  case "review": {
8311
8319
  const asked = await request("GET", "/review");
8312
- if (asked.status === 403) throw new Error("only the admin reviews \u2014 your own releases: faustwave releases <slug>");
8320
+ if (asked.status === 403) throw new Error("only the admin reviews \u2014 your own releases: faustwave me");
8313
8321
  if (asked.status >= 400) throw new Error(`GET /review: ${asked.status} ${String(asked.json?.message ?? asked.statusText)}`);
8314
- const waiting = asked.json;
8315
- if (!waiting.length) return "nothing to review";
8316
- return waiting.flatMap((r) => [
8317
- ` ${r.app.slug.padEnd(24)} ${r.version.padEnd(12)} ${r.app.type.padEnd(10)} ${r.channels.join(", ").padEnd(16)} by ${r.app.owner ?? r.app.ownerId}, ${(r.submittedAt ?? "").slice(0, 16).replace("T", " ")}`,
8318
- ` ${r.app.title} \u2014 publish with: faustwave publish ${r.app.slug} ${r.version}`
8319
- ]).join("\n");
8322
+ const waiting2 = asked.json;
8323
+ const asking = await hub("GET", "/users/publishing/requests");
8324
+ if (!waiting2.length && !asking.length) return "nothing to review";
8325
+ return [
8326
+ ...waiting2.flatMap((r) => [
8327
+ ` ${r.app.slug.padEnd(24)} ${r.version.padEnd(12)} ${r.app.type.padEnd(10)} ${r.channels.join(", ").padEnd(16)} by ${r.app.owner ?? r.app.ownerId}, ${(r.submittedAt ?? "").slice(0, 16).replace("T", " ")}`,
8328
+ ...r.lacks?.length ? [` its page has no ${r.lacks.join(" and no ")} yet`] : [],
8329
+ ` ${r.app.title} \u2014 faustwave publish ${r.app.slug} | faustwave reject ${r.app.slug} <reason>`
8330
+ ]),
8331
+ ...asking.flatMap((u) => [
8332
+ ` ${(u.username ?? u.id).padEnd(24)} asks to publish, ${(u.askedAt ?? "").slice(0, 16).replace("T", " ")}: ${u.ask}`,
8333
+ ` ${u.displayName} \u2014 faustwave allow ${u.username ?? u.id} | faustwave decline ${u.username ?? u.id} <reason>`
8334
+ ])
8335
+ ].join("\n");
8336
+ }
8337
+ case "reject": {
8338
+ const [slug, ...reason] = need(args, 2, "reject <slug> <reason>");
8339
+ const version2 = await waiting(slug);
8340
+ await hub("POST", `/apps/${enc(slug)}/releases/${enc(version2)}/reject`, { reason: reason.join(" ") });
8341
+ return `${slug} ${version2} rejected \u2014 its publisher reads the reason and submits it again`;
8342
+ }
8343
+ case "me": {
8344
+ if (args[0] === "ask") {
8345
+ const words = args.slice(1).join(" ");
8346
+ if (!words) throw new Error("usage: faustwave me ask <what you want to publish> \u2014 a sentence or two, the admin reads it");
8347
+ await hub("POST", "/users/me/publishing", { words });
8348
+ return "asked \u2014 the admin answers; how it stands: faustwave me";
8349
+ }
8350
+ const who = await hub("GET", "/users/me");
8351
+ rememberAdmin(who.role === "admin");
8352
+ const publishing = who.role === "admin" ? "you are the admin \u2014 you publish" : who.publishing === "allowed" ? "you may publish" : who.publishing === "asked" ? `your request waits for the admin: ${who.publishingAsk ?? ""}` : who.publishing === "declined" ? `your request was declined: ${who.publishingNote ?? ""}
8353
+ ask again: faustwave me ask <what you want to publish>` : "you cannot publish yet \u2014 ask for it: faustwave me ask <what you want to publish>";
8354
+ const apps = await hub("GET", "/users/me/apps");
8355
+ return [
8356
+ `${who.username ?? who.displayName} (${who.role})`,
8357
+ `publishing: ${publishing}`,
8358
+ "apps:",
8359
+ ...apps.length ? apps.flatMap((p) => [
8360
+ // (whether the catalog shows it — not its releases' state — and what its page still lacks)
8361
+ ` ${p.title} (${p.slug}, ${p.type}) \u2014 ${p.visibility === "public" ? "in the catalog" : p.visibility === "unlisted" ? "unlisted: by its link only" : "not in the catalog yet"}${p.description ? "" : ", no description"}${p.coverArtifactId ? "" : ", no picture"}`,
8362
+ ` ${SITE}/${p.releases[0]?.channels.includes("wclap") ? "plugins" : "apps"}/${p.slug}`,
8363
+ ...(p.releases.length ? p.releases : [null]).flatMap(
8364
+ (r) => r ? [` ${r.version.padEnd(16)} ${r.status.padEnd(10)} ${r.channels.join(", ")}`, ...r.rejectReason ? [` rejected: ${r.rejectReason}`] : []] : [" no releases"]
8365
+ )
8366
+ ]) : [who.role === "admin" || who.publishing === "allowed" ? " none \u2014 faustwave push <file>, then faustwave submit <slug>" : " none"]
8367
+ ].join("\n");
8368
+ }
8369
+ case "allow": {
8370
+ const [who] = need(args, 1, "allow <user>");
8371
+ await hub("POST", `/users/${enc(who)}/publishing/allow`);
8372
+ return `${who} may publish`;
8373
+ }
8374
+ case "decline": {
8375
+ const [who, ...reason] = need(args, 2, "decline <user> <reason>");
8376
+ await hub("POST", `/users/${enc(who)}/publishing/decline`, { reason: reason.join(" ") });
8377
+ return `${who} declined \u2014 they read the reason and may ask again`;
8320
8378
  }
8321
8379
  case "publish": {
8322
- const [slug, version2] = need(args, 2, "publish <slug> <version>");
8380
+ const [slug] = need(args, 1, "publish <slug>");
8381
+ const version2 = await waiting(slug);
8323
8382
  await hub("POST", `/apps/${enc(slug)}/releases/${enc(version2)}/publish`);
8324
- return `${slug} ${version2} published`;
8383
+ return `${slug} ${version2} published \u2014 out, and in the catalog`;
8325
8384
  }
8326
8385
  case "yank": {
8327
8386
  const [slug, version2] = need(args, 2, "yank <slug> <version>");
@@ -8332,20 +8391,22 @@ async function hubCommand(command2, args) {
8332
8391
  const [slug] = need(args, 1, "releases <slug>");
8333
8392
  const app = await hub("GET", `/apps/${enc(slug)}`);
8334
8393
  const releases = await hub("GET", `/apps/${enc(slug)}/releases`);
8335
- const lines = releases.map((r) => ` ${r.version.padEnd(16)} ${r.status.padEnd(10)} ${r.channels.join(", ")}`);
8394
+ const lines = releases.map((r) => ` ${r.version.padEnd(16)} ${r.status.padEnd(10)} ${r.channels.join(", ")}${r.rejectReason ? `
8395
+ rejected: ${r.rejectReason}` : ""}`);
8336
8396
  return [`${app.title} (${slug}, ${app.type}, ${app.visibility}) \u2014 latest: ${app.latestVersion ?? "none published"}`, ...lines.length ? lines : [" no releases"]].join("\n");
8337
8397
  }
8338
8398
  default:
8339
8399
  throw new Error(`unknown command ${command2}`);
8340
8400
  }
8341
8401
  }
8342
- var HUB, LOGTO, RESOURCE, clientId, loginFile, readLogins, writeLogin, form, HUB_OPERATIONS, need;
8402
+ var HUB, LOGTO, SITE, RESOURCE, clientId, loginFile, readLogins, writeLogin, form, signedInAsAdmin, rememberAdmin, HUB_OPERATIONS, need;
8343
8403
  var init_hub = __esm({
8344
8404
  "src/hub.ts"() {
8345
8405
  "use strict";
8346
8406
  init_pipe();
8347
8407
  HUB = (process.env.FW_HUB_URL ?? "https://api.faustwave.io").replace(/\/$/, "");
8348
8408
  LOGTO = (process.env.FW_LOGTO_ENDPOINT ?? "https://auth.faustwave.io").replace(/\/$/, "");
8409
+ SITE = (process.env.FW_SITE_URL ?? "https://faustwave.io").replace(/\/$/, "");
8349
8410
  RESOURCE = "https://api.faustwave.app";
8350
8411
  clientId = () => process.env.FW_LOGTO_CLI_APP_ID ?? "3lv6swtkqexu0opygy136";
8351
8412
  loginFile = () => path5.join(userData(), "hub-login.json");
@@ -8368,6 +8429,11 @@ var init_hub = __esm({
8368
8429
  headers: { "content-type": "application/x-www-form-urlencoded" },
8369
8430
  body: new URLSearchParams(fields)
8370
8431
  });
8432
+ signedInAsAdmin = () => readLogins()[HUB]?.admin === true;
8433
+ rememberAdmin = (admin) => {
8434
+ const login2 = readLogins()[HUB];
8435
+ if (login2 && login2.admin !== admin) writeLogin({ ...login2, admin });
8436
+ };
8371
8437
  HUB_OPERATIONS = {
8372
8438
  getApp: { method: "GET", route: "/apps/{slug}" },
8373
8439
  createApp: { method: "POST", route: "/apps" },
@@ -8377,8 +8443,8 @@ var init_hub = __esm({
8377
8443
  submitRelease: { method: "POST", route: "/apps/{slug}/releases/{version}/submit" },
8378
8444
  publishRelease: { method: "POST", route: "/apps/{slug}/releases/{version}/publish" }
8379
8445
  };
8380
- need = (args, n, usage) => {
8381
- if (args.length < n || args.slice(0, n).some((a) => !a)) throw new Error(`usage: faustwave ${usage}`);
8446
+ need = (args, n, usage2) => {
8447
+ if (args.length < n || args.slice(0, n).some((a) => !a)) throw new Error(`usage: faustwave ${usage2}`);
8382
8448
  return args;
8383
8449
  };
8384
8450
  }
@@ -8416,14 +8482,14 @@ function answerOf(lines) {
8416
8482
  return lines.next().then((r) => r.done ? null : !/^\s*(s|n|stop|no)\s*$/i.test(r.value));
8417
8483
  }
8418
8484
  function fileOf(what) {
8419
- const [file, inFile] = what.split("#");
8420
- const bundled = new URL(`../workflows/${file}.arazzo.yaml`, import.meta.url);
8421
- return [/^[a-z0-9-]+$/.test(file) && fs4.existsSync(bundled) ? fileURLToPath(bundled) : file, inFile];
8485
+ const [file2, inFile] = what.split("#");
8486
+ const bundled = new URL(`../workflows/${file2}.arazzo.yaml`, import.meta.url);
8487
+ return [/^[a-z0-9-]+$/.test(file2) && fs4.existsSync(bundled) ? fileURLToPath(bundled) : file2, inFile];
8422
8488
  }
8423
8489
  function overHub(what) {
8424
8490
  if (!what) return false;
8425
- const [file] = fileOf(what);
8426
- return /\.ya?ml$/i.test(file) && fs4.existsSync(file) && /url:\s*['"]?faustwave:hub\b/.test(fs4.readFileSync(file, "utf8"));
8491
+ const [file2] = fileOf(what);
8492
+ return /\.ya?ml$/i.test(file2) && fs4.existsSync(file2) && /url:\s*['"]?faustwave:hub\b/.test(fs4.readFileSync(file2, "utf8"));
8427
8493
  }
8428
8494
  async function workflow(args, out = (l) => process.stdout.write(l + "\n")) {
8429
8495
  const [sub, what, inputs] = args;
@@ -8435,10 +8501,10 @@ async function workflow(args, out = (l) => process.stdout.write(l + "\n")) {
8435
8501
  out("faustwave workflow list\nfaustwave workflow run <id | file.arazzo.yaml[#workflowId]> [inputs: json | file]\nfaustwave workflow run publish-plugin | review-release <inputs> (over the Hub \u2014 no IDE needed)");
8436
8502
  return 2;
8437
8503
  }
8438
- const [file, inFile] = fileOf(what);
8439
- const given = /\.ya?ml$/i.test(file) && fs4.existsSync(file);
8440
- if (overHub(what)) return runOnHub(fs4.readFileSync(file, "utf8"), inFile, inputs, out);
8441
- const input = given ? { source: fs4.readFileSync(file, "utf8"), ...inFile ? { workflow: inFile } : {} } : { workflow: what };
8504
+ const [file2, inFile] = fileOf(what);
8505
+ const given = /\.ya?ml$/i.test(file2) && fs4.existsSync(file2);
8506
+ if (overHub(what)) return runOnHub(fs4.readFileSync(file2, "utf8"), inFile, inputs, out);
8507
+ const input = given ? { source: fs4.readFileSync(file2, "utf8"), ...inFile ? { workflow: inFile } : {} } : { workflow: what };
8442
8508
  if (inputs) input.inputs = JSON.parse(fs4.existsSync(inputs) ? fs4.readFileSync(inputs, "utf8") : inputs);
8443
8509
  let run2 = await call("workflow.start", input);
8444
8510
  out(`${run2.title ?? run2.id}`);
@@ -8529,9 +8595,11 @@ function deviceMeta(...trees) {
8529
8595
  const faders = /* @__PURE__ */ new Set();
8530
8596
  const cols = /* @__PURE__ */ new Map();
8531
8597
  const monitors = [];
8532
- const walk = (items) => {
8598
+ const steps = [];
8599
+ const rowAt = /* @__PURE__ */ new Map();
8600
+ const walk = (items, group, path8) => {
8533
8601
  for (const it of items ?? []) {
8534
- if (it.items) walk(it.items);
8602
+ if (it.items) walk(it.items, groupName(it.label), `${path8}/${it.label ?? ""}`);
8535
8603
  if (!it.address) continue;
8536
8604
  const says = (it.meta ?? []).filter((m) => typeof m.device === "string").map((m) => m.device.trim());
8537
8605
  if (says.includes("big")) big.add(it.address);
@@ -8546,13 +8614,30 @@ function deviceMeta(...trees) {
8546
8614
  if (!m.addresses.includes(it.address)) m.addresses.push(it.address);
8547
8615
  if (col && !m.col) m.col = Number(col);
8548
8616
  }
8617
+ const st = says.map((s) => /^steps(?::(.+))?$/.exec(s)).find(Boolean);
8618
+ if (st && it.type !== "button") {
8619
+ const name = (st[1] ?? "steps").trim();
8620
+ let g = steps.find((x) => x.name === name);
8621
+ if (!g) steps.push(g = { name, rows: [] });
8622
+ if (isBargraph(it)) g.marker ??= it.address;
8623
+ else if (it.type !== "checkbox") g.length ??= it.address;
8624
+ else {
8625
+ const at = `${name}\0${path8}`;
8626
+ let row = rowAt.get(at);
8627
+ if (!row) {
8628
+ g.rows.push(row = { name: group, addresses: [] });
8629
+ rowAt.set(at, row);
8630
+ }
8631
+ if (!row.addresses.includes(it.address)) row.addresses.push(it.address);
8632
+ }
8633
+ }
8549
8634
  }
8550
8635
  };
8551
- for (const t of trees) walk(t);
8552
- return { big, faders, cols, monitors };
8636
+ for (const t of trees) walk(t, "", "");
8637
+ return { big, faders, cols, monitors, steps: steps.filter((g) => g.rows.length) };
8553
8638
  }
8554
8639
  function laysOut(meta2) {
8555
- return meta2.big.size > 0 || meta2.cols.size > 0 || meta2.monitors.length > 0;
8640
+ return meta2.big.size > 0 || meta2.cols.size > 0 || meta2.monitors.length > 0 || meta2.steps.length > 0;
8556
8641
  }
8557
8642
  function merged(trees) {
8558
8643
  const merge2 = (into, items) => {
@@ -8565,21 +8650,38 @@ function merged(trees) {
8565
8650
  };
8566
8651
  return trees.reduce((all, t) => merge2(all, t), []);
8567
8652
  }
8568
- function deviceLayout(trees, meta2) {
8569
- const monitorOf = new Map(meta2.monitors.flatMap((m) => m.addresses.map((a) => [a, m])));
8653
+ function deviceLayout(trees, meta2, dense = false) {
8654
+ const monitorOf = new Map(meta2.monitors.flatMap((m2) => m2.addresses.map((a) => [a, m2])));
8655
+ const stepsOf = new Map(meta2.steps.flatMap((g) => [...g.rows.flatMap((r) => r.addresses), ...g.marker ? [g.marker] : []].map((a) => [a, g])));
8656
+ const rowOf = (it) => {
8657
+ const held = it.items ?? [];
8658
+ return isGroup(it) && held.length > 0 && held.every((x) => x.address && stepsOf.has(x.address)) ? stepsOf.get(held[0].address) : void 0;
8659
+ };
8660
+ const stood = /* @__PURE__ */ new Set();
8570
8661
  const isBig = (it) => !!it.address && meta2.big.has(it.address);
8571
8662
  const sectionsOf = (items, path8) => {
8572
8663
  const own2 = (items ?? []).filter((it) => !isGroup(it));
8573
8664
  const monitors = [...new Set(own2.flatMap((it) => it.address && monitorOf.get(it.address) || []))];
8574
- const controls = own2.filter((it) => !(it.address && monitorOf.has(it.address)));
8665
+ const steps = [...new Set((items ?? []).flatMap((it) => rowOf(it) ?? (it.address ? stepsOf.get(it.address) : void 0) ?? []))].filter((g) => !stood.has(g));
8666
+ for (const g of steps) stood.add(g);
8667
+ const controls = own2.filter((it) => !(it.address && (monitorOf.has(it.address) || stepsOf.has(it.address))));
8575
8668
  const name = path8.join(" / ");
8576
8669
  const out = [];
8577
8670
  if (controls.some(isBig)) out.push({ kind: "section", name, items: controls.filter(isBig), big: true });
8578
8671
  const rest2 = controls.filter((it) => !isBig(it));
8579
- if (rest2.length || monitors.length) out.push({ kind: "section", name, items: rest2, big: false, ...monitors.length ? { monitors } : {} });
8580
- for (const it of items ?? []) if (isGroup(it)) out.push(...sectionsOf(it.items, [...path8, groupName(it.label)]));
8672
+ if (rest2.length || monitors.length || steps.length)
8673
+ out.push({ kind: "section", name, items: rest2, big: false, ...monitors.length ? { monitors } : {}, ...steps.length ? { steps } : {} });
8674
+ for (const it of items ?? []) if (isGroup(it) && !rowOf(it)) out.push(...sectionsOf(it.items, [...path8, groupName(it.label)]));
8581
8675
  return out;
8582
8676
  };
8677
+ const isRow = (it) => isGroup(it) && (it.items ?? []).some((x) => isGroup(x) && !rowOf(x));
8678
+ const isStack = (it) => it.type === "vgroup" && (it.items ?? []).length > 0 && (it.items ?? []).every(isRow);
8679
+ const placesOf = (items) => [
8680
+ ...sectionsOf((items ?? []).filter((it) => !isGroup(it) || rowOf(it)), []),
8681
+ ...(items ?? []).flatMap(
8682
+ (it) => !isGroup(it) || rowOf(it) ? [] : isStack(it) ? [{ kind: "stack", name: groupName(it.label), rows: (it.items ?? []).map((r) => ({ name: groupName(r.label), places: placesOf(r.items).map((place) => ({ place, cells: 0 })) })) }] : sectionsOf(it.items, [groupName(it.label)])
8683
+ )
8684
+ ];
8583
8685
  const rows = [];
8584
8686
  let loose = [];
8585
8687
  const flush = () => {
@@ -8587,53 +8689,64 @@ function deviceLayout(trees, meta2) {
8587
8689
  loose = [];
8588
8690
  };
8589
8691
  for (const top of merged(trees)) {
8590
- const items = isGroup(top) ? top.items ?? [] : [top];
8591
- loose.push(...sectionsOf(items.filter((it) => !isGroup(it)), []));
8592
- for (const g of items.filter(isGroup)) {
8692
+ const items = (isGroup(top) ? top.items ?? [] : [top]).flatMap((it) => isGroup(top) && isGroup(it) && groupName(it.label) === groupName(top.label) ? it.items ?? [] : [it]);
8693
+ loose.push(...sectionsOf(items.filter((it) => !isGroup(it) || rowOf(it)), []));
8694
+ for (const g of items.filter((it) => isGroup(it) && !rowOf(it))) {
8593
8695
  const name = groupName(g.label);
8594
- if ((g.items ?? []).some(isGroup)) {
8696
+ if (isRow(g)) {
8595
8697
  flush();
8596
- rows.push({ name, places: sectionsOf(g.items, []) });
8698
+ rows.push({ name, places: placesOf(g.items) });
8597
8699
  } else loose.push(...sectionsOf(g.items, [name]));
8598
8700
  }
8599
8701
  flush();
8600
8702
  }
8601
- const controlsWidth = (p) => p.items.reduce((n, it) => n + cellsOf(it, meta2), 0);
8602
- const widthOf = (p) => Math.max(p.monitors?.length ? MONITOR_CELLS : PLACE_CELLS, controlsWidth(p));
8703
+ const m = DEVICE_METRICS[dense ? "dense" : "normal"];
8704
+ const controlsWidth = (p) => p.items.reduce((n, it) => n + cellsOf(it, meta2, dense), 0);
8705
+ const stepsWidth = (p) => Math.max(0, ...(p.steps ?? []).map((g) => Math.ceil((stepsSize(g, m).width + 2 * m.pad + m.gap) / m.cell)));
8706
+ const widthOf = (p) => p.kind === "stack" ? Math.max(0, ...p.rows.map((r) => r.places.reduce((n, c) => n + (c.cells = widthOf(c.place)), 0))) : Math.max(p.monitors?.length ? MONITOR_CELLS : PLACE_CELLS, controlsWidth(p), stepsWidth(p));
8603
8707
  const laid = rows.filter((r) => r.places.length).map((r) => ({ name: r.name, places: r.places.map((place) => ({ place, cells: widthOf(place) })) }));
8604
8708
  const cells = Math.max(0, ...laid.map((r) => r.places.reduce((n, c) => n + c.cells, 0)));
8605
- for (const r of laid) {
8709
+ const fill2 = (r, wide) => {
8606
8710
  const used = r.places.reduce((n, c) => n + c.cells, 0);
8607
- const wide = r.places.find((c) => c.place.monitors?.length);
8608
- if (wide && used < cells) wide.cells += cells - used;
8609
- }
8711
+ const screen = r.places.find((c) => c.place.kind === "section" && c.place.monitors?.length);
8712
+ if (screen && used < wide) screen.cells += wide - used;
8713
+ for (const c of r.places) if (c.place.kind === "stack") for (const sub of c.place.rows) fill2(sub, c.cells);
8714
+ };
8715
+ for (const r of laid) fill2(r, cells);
8610
8716
  return { rows: laid, cells };
8611
8717
  }
8612
8718
  function deviceSize(layout, meta2, dense = false) {
8613
8719
  const m = DEVICE_METRICS[dense ? "dense" : "normal"];
8614
8720
  const width = layout.cells * m.cell;
8615
- const tall = (p) => (p.items.length ? p.items.some((it) => it.address && meta2.big.has(it.address)) ? m.bigRow : m.row : 0) + (p.monitors?.length ? m.screen : 0);
8616
- const rowHeight = (r) => m.title + 2 * m.pad + m.gap + Math.max(...r.places.map((c) => tall(c.place)));
8721
+ const tall = (p) => (p.items.length ? p.items.some((it) => it.address && meta2.big.has(it.address)) ? m.bigRow : m.row : 0) + (p.monitors?.length ? m.screen : 0) + (p.steps ?? []).reduce((h, g) => h + stepsSize(g, m).height + 4, 0);
8722
+ const rowHeight = (r) => Math.max(...r.places.map((c) => c.place.kind === "stack" ? c.place.rows.reduce((h, sub) => h + rowHeight(sub), 0) : m.title + 2 * m.pad + m.gap + tall(c.place)));
8617
8723
  return { width: Math.ceil(width), height: Math.ceil(layout.rows.reduce((h, r) => h + rowHeight(r), 0)) };
8618
8724
  }
8619
- var isGroup, isBargraph, groupName, radioOptions, cellsOf, PLACE_CELLS, MONITOR_CELLS, DEVICE_METRICS;
8725
+ var isGroup, isBargraph, groupName, radioCells, cellsOf, PLACE_CELLS, MONITOR_CELLS, stepsSize, DEVICE_METRICS;
8620
8726
  var init_device = __esm({
8621
8727
  "../faustwave-svelte/src/faust/device.ts"() {
8622
8728
  "use strict";
8623
8729
  isGroup = (it) => it.type === "vgroup" || it.type === "hgroup" || it.type === "tgroup";
8624
8730
  isBargraph = (it) => it.type === "hbargraph" || it.type === "vbargraph";
8625
8731
  groupName = (label) => (label ?? "").replace(/\[[^\]]*\]/g, "").trim();
8626
- radioOptions = (it) => {
8732
+ radioCells = (it, dense) => {
8627
8733
  const style = (it.meta ?? []).find((m2) => typeof m2.style === "string")?.style ?? "";
8628
8734
  const m = /^\s*radio\s*\{(.*)\}\s*$/.exec(style);
8629
- return m ? m[1].split(";").filter((s) => s.trim()).length : 0;
8735
+ if (!m) return 0;
8736
+ const names = m[1].split(";").filter((s) => s.trim()).map((s) => s.split(":")[0].trim().replace(/^'|'$/g, ""));
8737
+ const letters = groupName(it.label).length + names.reduce((n, x) => n + x.length, 0);
8738
+ return Math.max(names.length, Math.ceil((7 * letters + 18 * names.length + 12) / DEVICE_METRICS[dense ? "dense" : "normal"].cell));
8630
8739
  };
8631
- cellsOf = (it, meta2) => it.address && meta2.big.has(it.address) ? 1.5 : Math.max(1, radioOptions(it));
8740
+ cellsOf = (it, meta2, dense = false) => it.address && meta2.big.has(it.address) ? 1.5 : Math.max(1, radioCells(it, dense));
8632
8741
  PLACE_CELLS = 2;
8633
8742
  MONITOR_CELLS = 4;
8743
+ stepsSize = (g, m) => ({
8744
+ width: m.stepName + Math.max(0, ...g.rows.map((r) => r.addresses.length)) * m.step,
8745
+ height: (g.rows.length + 1) * m.step
8746
+ });
8634
8747
  DEVICE_METRICS = {
8635
- normal: { cell: 64, row: 96, bigRow: 120, title: 22, pad: 8, gap: 8, screen: 64 },
8636
- dense: { cell: 52, row: 78, bigRow: 98, title: 18, pad: 6, gap: 6, screen: 48 }
8748
+ normal: { cell: 64, row: 96, bigRow: 120, title: 22, pad: 8, gap: 8, screen: 64, step: 20, stepName: 36 },
8749
+ dense: { cell: 52, row: 78, bigRow: 98, title: 18, pad: 6, gap: 6, screen: 48, step: 16, stepName: 30 }
8637
8750
  };
8638
8751
  }
8639
8752
  });
@@ -8652,7 +8765,7 @@ function sizeOfControls(ui, dense = false, presets = false) {
8652
8765
  const meta2 = deviceMeta(ui);
8653
8766
  const clamp = (v, lo, hi) => Math.round(Math.min(hi, Math.max(lo, v)));
8654
8767
  if (laysOut(meta2)) {
8655
- const size = deviceSize(deviceLayout([ui], meta2), meta2, dense);
8768
+ const size = deviceSize(deviceLayout([ui], meta2, dense), meta2, dense);
8656
8769
  return { width: clamp(size.width + 24, 360, 1400), height: clamp(size.height + 24 + bar, 200, 900) };
8657
8770
  }
8658
8771
  return { width: clamp(Math.min(n, 8) * 84 + 64, 360, 960), height: clamp(80 + Math.ceil(n / 8) * 110 + bar, 200, 800) };
@@ -8678,13 +8791,13 @@ function licenceOf(source, name) {
8678
8791
  return [name, author && `by ${author}`, said && `Licence: ${said}`].filter(Boolean).join("\n") + "\n";
8679
8792
  }
8680
8793
  function controlsUi(trees, description) {
8681
- const keep = new Set([...description.params.filter((p) => !p.hidden), ...description.bargraphs.filter((b) => !b.hidden)].map((p) => p.address));
8794
+ const keep2 = new Set([...description.params.filter((p) => !p.hidden), ...description.bargraphs.filter((b) => !b.hidden)].map((p) => p.address));
8682
8795
  const cut = (items) => items.flatMap((it) => {
8683
8796
  if ("items" in it && Array.isArray(it.items)) {
8684
8797
  const inner = cut(it.items);
8685
8798
  return inner.length ? [{ ...it, items: inner }] : [];
8686
8799
  }
8687
- return "address" in it && keep.has(it.address) ? [it] : [];
8800
+ return "address" in it && keep2.has(it.address) ? [it] : [];
8688
8801
  });
8689
8802
  return trees.flatMap((tree) => cut(Array.isArray(tree) ? tree : []));
8690
8803
  }
@@ -8702,7 +8815,12 @@ function pluginFiles(page, p) {
8702
8815
  }
8703
8816
  function deviceTags(ui) {
8704
8817
  const meta2 = deviceMeta(ui);
8705
- return { big: meta2.big.size, cols: [...new Set(meta2.cols.values())].sort(), monitors: meta2.monitors.map((m) => m.name), faders: meta2.faders.size };
8818
+ const rowsOf = (rs, under) => rs.flatMap((r) => [
8819
+ { name: r.name, sections: r.places.flatMap((c) => c.place.kind === "section" ? [c.place.name] : []), ...under ? { under } : {} },
8820
+ ...r.places.flatMap((c) => c.place.kind === "stack" ? rowsOf(c.place.rows, [under, r.name, c.place.name].filter(Boolean).join(" / ")) : [])
8821
+ ]);
8822
+ const rows = laysOut(meta2) ? rowsOf(deviceLayout([ui], meta2).rows) : [];
8823
+ return { big: meta2.big.size, cols: [...new Set(meta2.cols.values())].sort(), monitors: meta2.monitors.map((m) => m.name), steps: meta2.steps.map((g) => ({ name: g.name, rows: g.rows.length, steps: Math.max(...g.rows.map((r) => r.addresses.length)) })), faders: meta2.faders.size, rows };
8706
8824
  }
8707
8825
  var FAUST_ARGS, PRESET_BAR, idPart, declaredOf, packageFileName;
8708
8826
  var init_src2 = __esm({
@@ -8750,9 +8868,9 @@ function convertArgs(args) {
8750
8868
  }
8751
8869
  async function convert(args) {
8752
8870
  const o = convertArgs(args);
8753
- const file = path6.resolve(o.file);
8754
- if (!fs5.existsSync(file)) throw new Error(`No such patch: ${file}`);
8755
- const source = fs5.readFileSync(file, "utf8");
8871
+ const file2 = path6.resolve(o.file);
8872
+ if (!fs5.existsSync(file2)) throw new Error(`No such patch: ${file2}`);
8873
+ const source = fs5.readFileSync(file2, "utf8");
8756
8874
  const req = requireAt(import.meta.url);
8757
8875
  let fwDir, wclapDist;
8758
8876
  try {
@@ -8772,13 +8890,17 @@ async function convert(args) {
8772
8890
  const pageDir = path6.dirname(pageList);
8773
8891
  const page = new Map(JSON.parse(fs5.readFileSync(pageList, "utf8")).map((f) => [f, new Uint8Array(fs5.readFileSync(path6.join(pageDir, f)))]));
8774
8892
  const css = o.css === void 0 ? "" : fs5.readFileSync(path6.resolve(o.css), "utf8");
8893
+ const stderr = console.error.bind(console);
8894
+ console.error = (...said) => {
8895
+ if (!/^Aborted\(/.test(String(said[0]))) stderr(...said);
8896
+ };
8775
8897
  const faustwasm = await import(pathToFileURL(path6.join(fwDir, "dist/esm/index.js")).href);
8776
8898
  const wclap = await import(pathToFileURL(path6.join(wclapDist, "index.js")).href);
8777
8899
  const compiler = new faustwasm.FaustCompiler(
8778
8900
  new faustwasm.LibFaust(await faustwasm.instantiateFaustModuleFromFile(path6.join(fwDir, "libfaust-wasm/libfaust-wasm.js")))
8779
8901
  );
8780
8902
  const adapter = new Uint8Array(fs5.readFileSync(path6.join(wclapDist, "faustwasm-webclap-double.wasm")));
8781
- const presetsFile = wclap.presetsFileOf(file);
8903
+ const presetsFile = wclap.presetsFileOf(file2);
8782
8904
  let presets = [];
8783
8905
  if (fs5.existsSync(presetsFile))
8784
8906
  try {
@@ -8786,29 +8908,37 @@ async function convert(args) {
8786
8908
  } catch (e) {
8787
8909
  throw new Error(`${path6.basename(presetsFile)}: ${e instanceof Error ? e.message : String(e)}`);
8788
8910
  }
8789
- const info = pluginInfo(source, { fallbackName: path6.basename(file).replace(/\.dsp$/i, ""), name: o.name, id: o.id, version: o.version, presets, density: o.density });
8911
+ const info = pluginInfo(source, { fallbackName: path6.basename(file2).replace(/\.dsp$/i, ""), name: o.name, id: o.id, version: o.version, presets, density: o.density });
8790
8912
  const built = await wclap.compilePlugin(faustwasm, compiler, adapter, source, info, { args: FAUST_ARGS }).catch((e) => {
8791
8913
  const said = e instanceof Error ? e.message : String(e);
8792
- if (/no such sound was given/.test(said)) throw new Error("The patch plays soundfiles \u2014 build it in the IDE (project.build, starter wclap): it loads them.");
8914
+ if (/no such sound was given/.test(said)) throw new Error("The patch plays soundfiles \u2014 faustwave build plugin loads none: a patch that makes its sounds itself builds.");
8793
8915
  if (/^preset "/.test(said)) throw new Error(`${path6.basename(presetsFile)}: ${said}`);
8794
8916
  throw new Error(`The patch does not compile: ${said}`);
8795
8917
  });
8796
8918
  const notices = new Uint8Array(fs5.readFileSync(path6.join(wclapDist, "THIRD-PARTY-NOTICES.md")));
8797
8919
  const ui = controlsUi([built.faust.ui, built.effect.ui], built.description);
8798
- const sources = o.sources ? new Map([[path6.basename(file), new Uint8Array(fs5.readFileSync(file))], ...fs5.existsSync(presetsFile) ? [[path6.basename(presetsFile), new Uint8Array(fs5.readFileSync(presetsFile))]] : []]) : void 0;
8920
+ const sources = o.sources ? new Map([[path6.basename(file2), new Uint8Array(fs5.readFileSync(file2))], ...fs5.existsSync(presetsFile) ? [[path6.basename(presetsFile), new Uint8Array(fs5.readFileSync(presetsFile))]] : []]) : void 0;
8799
8921
  const files = wclap.pluginPackage(built.module, licenceOf(source, info.name), pluginFiles(page, { description: built.description, ui, look: o.look, css, density: o.density, presets, notices, sources }));
8800
- const out = path6.resolve(o.out ?? path6.dirname(file));
8922
+ const out = path6.resolve(o.out ?? path6.dirname(file2));
8801
8923
  fs5.mkdirSync(out, { recursive: true });
8802
8924
  const to = path6.join(out, packageFileName(info.name));
8803
8925
  const archive = gzipSync(wclap.tar(files));
8804
8926
  fs5.writeFileSync(to, archive);
8805
- const what = built.voices ? `an instrument of ${built.voices} voices` : "an effect";
8806
- const tail = built.tail < 0 ? "it may sound on endlessly after its end" : `it sounds on ${built.tail.toFixed(2)} s after its end`;
8927
+ const itself = !built.voices && built.faust.inputs === 0;
8928
+ const what = built.voices ? `an instrument of ${built.voices} voices` : itself ? `an instrument that plays by itself (${/\[\s*midi\s*:\s*key\b/.test(source) ? "and by its [midi:key] controls" : "no notes"})` : "an effect";
8929
+ const ended = itself ? "it has stopped" : "its input or last note has ended";
8930
+ const tail = built.tail < 0 ? `its sound may never die away once ${ended}` : `its sound dies away ${built.tail.toFixed(2)} s after ${ended}`;
8807
8931
  const tags = deviceTags(ui);
8808
- const laid = tags.big || tags.cols.length || tags.monitors.length ? `laid out by its tags: ${[tags.big && `${tags.big} big`, tags.cols.length && `column ${tags.cols.join(", ")}`, tags.monitors.length && `monitor ${tags.monitors.join(", ")}`].filter(Boolean).join("; ")}` : "no [device:*] tags \u2014 as Faust groups the controls";
8932
+ const laid = tags.big || tags.cols.length || tags.monitors.length || tags.steps.length ? `laid out by its tags: ${[tags.big && `${tags.big} big knob${tags.big === 1 ? "" : "s"}`, tags.cols.length && `column ${tags.cols.join(", ")}`, tags.monitors.length && `monitor ${tags.monitors.join(", ")}`, ...tags.steps.map((g) => `steps ${g.name} ${g.rows} \xD7 ${g.steps}`)].filter(Boolean).join("; ")}` : "no [device:*] tags \u2014 as Faust groups the controls";
8809
8933
  const withPresets = presets.length ? `, ${presets.length} preset${presets.length === 1 ? "" : "s"}` : "";
8810
- return `${to}: "${info.name}" (${info.id}) ${info.version}, ${what}${withPresets}, ${sources ? "with its sources, " : ""}with its page (${built.info.ui ? `${built.info.ui.width} \xD7 ${built.info.ui.height}, ` : ""}${laid}), ${(archive.length / 1024).toFixed(0)} KB; ${tail}.
8811
- Import it into a WebCLAP host (openDAW: Load Plugin \u2192 from disk)` + (true ? "." : ` \u2014 or publish it on the Hub as version ${info.version}: faustwave workflow run publish-plugin <inputs>.`);
8934
+ const there = { row: tags.rows.map((r) => r.name), group: tags.rows.flatMap((r) => r.sections), monitor: tags.monitors, steps: tags.steps.map((g) => g.name) };
8935
+ const lost = [...css.replace(/\/\*[\s\S]*?\*\//g, "").matchAll(/\[data-(row|group|monitor|steps)\s*=\s*["']?([^"'\]]+?)["']?\s*\]/g)].filter(([, kind, name]) => !there[kind].includes(name)).map(([sel]) => sel);
8936
+ const withCss = o.css === void 0 ? "" : `with your CSS (${path6.basename(o.css)}${lost.length ? ` \u2014 but ${[...new Set(lost)].join(", ")} find${new Set(lost).size === 1 ? "s" : ""} nothing on the page` : ""})`;
8937
+ const rows = tags.rows.length ? `
8938
+ Its page, top to bottom: ${tags.rows.map((r) => `${r.under ? `in ${r.under}: ` : ""}${r.name || "a row"} [${[...new Set(r.sections)].join(", ")}]`).join(" \u2014 ")}${withCss && `; ${withCss}`}.` : withCss && `
8939
+ Its page: ${withCss}.`;
8940
+ return `${to}: "${info.name}" (${info.id}) ${info.version}, ${what}${withPresets}, ${sources ? "with its sources, " : ""}with its page (${built.info.ui ? `${built.info.ui.width} \xD7 ${built.info.ui.height}, ` : ""}${laid}), ${(archive.length / 1024).toFixed(0)} KB; ${tail}.${rows}
8941
+ Import it into a WebCLAP host \u2014 or publish it on faustwave.io: faustwave push ${/\s/.test(to) ? `"${to}"` : to} (faustwave me says whether you may)`;
8812
8942
  }
8813
8943
  var PLUGIN_HELP, THEMES, wrong;
8814
8944
  var init_convert = __esm({
@@ -8826,24 +8956,80 @@ Options:
8826
8956
  --id <id> its CLAP id (default: io.faustwave.<name>)
8827
8957
  --version <x.y.z> its version (default: the patch's declare version, else the day)
8828
8958
  --theme <theme> its page's colours: studio, amber (default: FaustWave's)
8829
- --css <file> a CSS file of your own over the theme
8959
+ --css <file> a look of your own: a CSS file over the theme (below: what it can set)
8830
8960
  --density compact smaller knobs, tighter panels (as a host's own devices sit)
8831
8961
  --sources pack the patch and its presets file with it, under src/ \u2014 who has the plugin can read them
8832
8962
  -h, --help this
8833
8963
 
8964
+ An effect or an instrument: a patch with inputs is an effect. One that plays notes is an instrument \u2014 it takes
8965
+ freq (or key), gain and gate as Faust's MIDI convention has them, and says its voices:
8966
+ declare options "[midi:on][nvoices:8]";
8967
+ freq = hslider("freq", 440, 20, 20000, 0.01); gain = hslider("gain", 0.5, 0, 1, 0.01); gate = button("gate");
8968
+
8834
8969
  Examples:
8835
8970
  faustwave build plugin tremolo.dsp
8836
8971
  faustwave build plugin synth.dsp --theme studio --out plugins/
8837
8972
  faustwave build plugin synth.dsp --name "My Synth" --version 1.0.0 --sources
8838
8973
 
8839
- Its page lays the controls out as Faust groups them (v:Synth/h:sound/h:osc A/\u2026 \u2014 a group of groups is a row, its
8840
- groups the sections). Tags in a control's label shape it:
8841
- [device:big] a big knob (the macros)
8842
- [device:fader] a fader
8843
- [device:col:<n>] its column
8844
- [device:monitor:<name>] on a bargraph: a line drawn of it, under its group's controls
8974
+ Its page lays the controls out as the patch's Faust groups say, once ONE control carries a [device:\u2026] tag (without
8975
+ any, the controls stand as Faust nests them \u2014 no rows, no sections). Two levels: a group is a row, the groups in it are
8976
+ the row's sections, each control a knob in its section. Faust sorts groups and controls by name; a number in front
8977
+ keeps your order:
8978
+ cutoff = hslider("h:[1]sound/h:[2]filter/[1]cutoff[unit:Hz][scale:log][device:big]", 1800, 80, 12000, 1);
8979
+ attack = hslider("h:[2]shape/h:[1]env/[1]attack[unit:s]", 0.02, 0.001, 2, 0.001);
8980
+ gives two rows, sound over shape, with the sections filter and env. Tags in a control's label:
8981
+ [device:big] a big knob (a section's big knobs stand in a section of their own, before its others)
8982
+ [device:monitor:<name>] on bargraphs: a screen in their section, a line drawn through them
8983
+ [unit:Hz] [scale:log] Faust's own: the unit beside the value, the knob's curve
8984
+ The build says the rows and sections it made \u2014 read it: a section that is missing or named "a / b" is a group too deep.
8985
+ A patch whose controls ALL lie in one top group has that group as itself, not as a row (Faust wraps a patch in a group
8986
+ of its name only when more than one thing stands at its top): a second group beside it makes both rows.
8987
+
8988
+ A monitor's line goes through ALL the bargraphs of its name, left to right \u2014 each bargraph one point; a single
8989
+ bargraph is a flat line. A signal over the last second, 32 points, the newest on the right:
8990
+ history(every, sig) = par(j, 32, at(31 - j))
8991
+ with { tick = (ba.time % every) == 0; at(0) = ba.sAndH(tick, sig); at(n) = ba.sAndH(tick, at(n - 1)'); };
8992
+ scope = history(1500, env) : par(k, 32, hbargraph("h:[2]shape/h:[2]out/s%2k[device:monitor:scope]", 0, 1)) :> _;
8993
+ process = attach(voice, scope) <: _, _;
8845
8994
 
8846
- Import the package into a WebCLAP host (openDAW: Load Plugin \u2192 from disk), or try a patch first in the browser:
8995
+ A step sequencer: [device:steps:<name>] on checkboxes draws them as ONE grid \u2014 each group of them a row under the
8996
+ group's name, a square a step; on a bargraph it is the grid's running step (1 the first, 0: none), on a slider its length (the steps past it are
8997
+ drawn faint). A click turns a step on or off, a stroke over more steps gives them the same. The patch plays the
8998
+ steps itself, on the host's clock \u2014 Faust's MIDI sync controls, which the host's transport plays (no hand turns them):
8999
+ play = checkbox("h:sync/play[midi:start][midi:stop]"); // 1 while the host plays
9000
+ clock = checkbox("h:sync/clock[midi:clock]"); // toggles 24 times a quarter note
9001
+ songpos = hslider("h:sync/songpos[midi:songpos]", 0, 0, 1e9, 0.0001); // the song's place, in sixteenths
9002
+ onStep = (clock != clock') * play * (abs(songpos - rint(songpos)) < 0.01);
9003
+ step = int(floor(songpos + 0.01)) % 16;
9004
+ bd = par(i, 16, checkbox("v:[1]pattern/h:[1]BD/%2i[device:steps:pattern]")) : ba.selectn(16, step) : *(onStep);
9005
+ marker = (step + 1) * play : hbargraph("v:[1]pattern/step[device:steps:pattern]", 0, 16);
9006
+ bd is 1 on the sample its step begins when its box is on \u2014 a trigger for a drum; attach the marker to the sound.
9007
+ A patch without notes and without inputs is an instrument that plays by itself.
9008
+ Rows of knobs BESIDE a tall grid: a VERTICAL group (v:) in the grid's row whose groups are rows themselves stands as a
9009
+ stack (the sync controls above are the second thing at the patch's top, so "top" is a row) \u2014
9010
+ "h:[1]top/v:[1]pattern/h:[01]BD/%2i[device:steps:pattern]" the grid, left
9011
+ "h:[1]top/v:[2]knobs/h:[1]main/h:[1]play/[1]length" right of it: the row main, its section play
9012
+ "h:[1]top/v:[2]knobs/h:[2]drums/h:[1]BD/[1]level" under main: the row drums, its section BD
9013
+
9014
+ A look of your own (--css <file>): the file's CSS goes over the theme, inside the controls' frame. The file is the
9015
+ inside of one CSS rule: declarations at its top (they hold for the whole frame), rules for its parts below them.
9016
+ --bg: #05020a; the frame's ground
9017
+ --card: #12061f; --card-2: #1b0a2e; the sections' grounds
9018
+ --border: #3a1466; the lines
9019
+ --text: #f3e9ff; --text-2: #c9a7ff; --text-3: #9a6fe0; values; labels and titles; units
9020
+ --action: #ff2bd6; --focus: #ff2bd6; the knobs' arcs; the ring round the one in use
9021
+ --signal-audio: #2bf0ff; a monitor's line
9022
+ font-family: Georgia, serif; (any CSS property)
9023
+ [data-group="filter"] { background: linear-gradient(160deg, #2a0a3f, #12061f); border-radius: 18px; --action: #2bf0ff; }
9024
+ a section by its group's name \u2014 any CSS, and the colours again for it alone
9025
+ [data-row="sound"] { \u2026 } a row by its group's name
9026
+ [data-monitor="<name>"] svg { background: #020908; border-color: #3a1466; }
9027
+ a monitor's screen by its tag's name
9028
+ The knobs: the arc is --action, the track behind it --border-2, the pointer --text-2.
9029
+ The themes: FaustWave's (dark, teal), studio (light grey, orange), amber (black, amber). The window round the frame
9030
+ and the preset bar keep the theme's colours \u2014 choose the theme nearest to your look and put the CSS over it.
9031
+
9032
+ Import the package into a WebCLAP host, or try a patch first in the browser:
8847
9033
  https://faustwave.io/webclap`;
8848
9034
  THEMES = ["studio", "amber"];
8849
9035
  wrong = (said) => new Error(`${said}
@@ -8856,6 +9042,7 @@ var update_exports = {};
8856
9042
  __export(update_exports, {
8857
9043
  hint: () => hint,
8858
9044
  newer: () => newer,
9045
+ todo: () => todo,
8859
9046
  update: () => update
8860
9047
  });
8861
9048
  import { spawn } from "node:child_process";
@@ -8869,55 +9056,104 @@ function newer(a, b) {
8869
9056
  }
8870
9057
  async function latest() {
8871
9058
  try {
8872
- const res = await fetch(`https://registry.npmjs.org/${NAME}/latest`, { signal: AbortSignal.timeout(2e3) });
8873
- const version2 = res.ok ? (await res.json()).version : void 0;
9059
+ const { get } = await import("node:https");
9060
+ const body = await new Promise((resolve, reject) => {
9061
+ const req = get(`https://registry.npmjs.org/${NAME}/latest`, { agent: false, timeout: 2e3 }, (res) => {
9062
+ if (res.statusCode !== 200) return res.resume(), resolve("{}");
9063
+ let text2 = "";
9064
+ res.setEncoding("utf8");
9065
+ res.on("data", (chunk) => text2 += chunk).on("end", () => resolve(text2));
9066
+ });
9067
+ req.on("timeout", () => req.destroy(new Error("timeout"))).on("error", reject);
9068
+ });
9069
+ const version2 = JSON.parse(body).version;
8874
9070
  return version2 && /^\d+\.\d+\.\d+(-[\w.]+)?$/.test(version2) ? version2 : null;
8875
9071
  } catch {
8876
9072
  return null;
8877
9073
  }
8878
9074
  }
8879
- async function update() {
9075
+ function install(version2, quiet = false) {
9076
+ return new Promise((resolve) => {
9077
+ const child = spawn(`npm install --global ${NAME}@${version2}`, { stdio: quiet ? "ignore" : ["ignore", 2, 2], shell: true });
9078
+ child.on("close", (c) => resolve(c ?? 1));
9079
+ child.on("error", () => resolve(1));
9080
+ });
9081
+ }
9082
+ function read() {
9083
+ try {
9084
+ return JSON.parse(fs6.readFileSync(file(), "utf8"));
9085
+ } catch {
9086
+ return {};
9087
+ }
9088
+ }
9089
+ function keep(seen) {
9090
+ fs6.mkdirSync(path7.dirname(file()), { recursive: true });
9091
+ fs6.writeFileSync(file(), JSON.stringify(seen));
9092
+ }
9093
+ async function update(args = []) {
8880
9094
  if (!VERSION2) throw new Error("faustwave update is the npm package's (npm i -g faustwave) \u2014 this faustwave updates with the IDE or with git.");
9095
+ if (args.length) {
9096
+ const [flag, to] = args;
9097
+ if (flag !== "--auto" || to !== "on" && to !== "off" || args.length > 2) throw new Error("faustwave update [--auto on|off]");
9098
+ keep({ ...read(), auto: to === "on" });
9099
+ return to === "on" ? "faustwave updates by itself from now on, after a command when there is a newer one" : "faustwave says when there is a newer one \u2014 faustwave update installs it";
9100
+ }
8881
9101
  const l = await latest();
8882
9102
  if (!l) throw new Error("npm gave no faustwave (not reached, or not published yet) \u2014 later again, or: npm i -g faustwave@latest");
8883
9103
  if (!newer(l, VERSION2)) return `faustwave ${VERSION2} is the newest`;
8884
- const code = await new Promise((resolve) => {
8885
- const child = spawn(`npm install --global ${NAME}@${l}`, { stdio: "inherit", shell: true });
8886
- child.on("close", (c) => resolve(c ?? 1));
8887
- child.on("error", () => resolve(1));
8888
- });
9104
+ const code = await install(l);
8889
9105
  if (code) throw new Error(`npm install failed (${code}) \u2014 by hand: npm i -g faustwave@latest`);
8890
9106
  return `faustwave ${VERSION2} \u2192 ${l}`;
8891
9107
  }
9108
+ function todo(seen, version2, tty) {
9109
+ if (!seen.latest || !newer(seen.latest, version2)) return "nothing";
9110
+ if (seen.auto) return "install";
9111
+ if (!tty.out) return "nothing";
9112
+ return seen.auto === void 0 && tty.in ? "ask" : "tell";
9113
+ }
8892
9114
  async function hint() {
8893
- if (!VERSION2 || !process.stderr.isTTY) return;
9115
+ if (!VERSION2) return;
8894
9116
  try {
8895
- const file = path7.join(userData(), "cli-update.json");
8896
- let seen = {};
8897
- try {
8898
- seen = JSON.parse(fs6.readFileSync(file, "utf8"));
8899
- } catch {
8900
- }
9117
+ let seen = read();
8901
9118
  if (!seen.checked || Date.now() - seen.checked > DAY) {
8902
- seen = { checked: Date.now(), latest: await latest() };
8903
- fs6.mkdirSync(path7.dirname(file), { recursive: true });
8904
- fs6.writeFileSync(file, JSON.stringify(seen));
8905
- }
8906
- if (seen.latest && newer(seen.latest, VERSION2))
8907
- process.stderr.write(`
8908
- faustwave ${seen.latest} is out (this is ${VERSION2}) \u2014 faustwave update
9119
+ seen = { ...seen, checked: Date.now(), latest: await latest() };
9120
+ keep(seen);
9121
+ }
9122
+ const tty = { out: !!process.stderr.isTTY, in: !!process.stdin.isTTY };
9123
+ let what = todo(seen, VERSION2, tty);
9124
+ if (what === "nothing") return;
9125
+ const l = seen.latest;
9126
+ if (what === "ask") {
9127
+ const { createInterface } = await import("node:readline/promises");
9128
+ const rl = createInterface({ input: process.stdin, output: process.stderr });
9129
+ const yes = /^y/i.test((await rl.question(`
9130
+ faustwave ${l} is out (this is ${VERSION2}). Update now, and by itself from now on? [y/n] `)).trim());
9131
+ rl.close();
9132
+ keep({ ...seen, auto: yes });
9133
+ if (!yes) process.stderr.write("Then it says when there is a newer one: faustwave update installs it (by itself after all: faustwave update --auto on).\n");
9134
+ what = yes ? "install" : "nothing";
9135
+ }
9136
+ if (what === "tell") process.stderr.write(`
9137
+ faustwave ${l} is out (this is ${VERSION2}) \u2014 faustwave update
9138
+ `);
9139
+ if (what === "install") {
9140
+ const code = await install(l, !tty.out);
9141
+ if (tty.out) process.stderr.write(code ? `faustwave ${l} could not be installed (npm ended ${code}) \u2014 by hand: npm i -g faustwave@latest
9142
+ ` : `faustwave ${VERSION2} \u2192 ${l} (by itself; off: faustwave update --auto off)
8909
9143
  `);
9144
+ }
8910
9145
  } catch {
8911
9146
  }
8912
9147
  }
8913
- var VERSION2, NAME, DAY;
9148
+ var VERSION2, NAME, DAY, file;
8914
9149
  var init_update = __esm({
8915
9150
  "src/update.ts"() {
8916
9151
  "use strict";
8917
9152
  init_pipe();
8918
- VERSION2 = false ? null : "0.97.1";
9153
+ VERSION2 = false ? null : "0.98.1";
8919
9154
  NAME = "faustwave";
8920
9155
  DAY = 24 * 60 * 60 * 1e3;
9156
+ file = () => path7.join(userData(), "cli-update.json");
8921
9157
  }
8922
9158
  });
8923
9159
 
@@ -31162,7 +31398,7 @@ init_pipe();
31162
31398
  // package.json
31163
31399
  var package_default = {
31164
31400
  name: "faustwave",
31165
- version: "0.97.1",
31401
+ version: "0.98.1",
31166
31402
  description: "The FaustWave CLI \u2014 a Faust patch as a WebCLAP plugin with its page, from a terminal or a script.",
31167
31403
  keywords: [
31168
31404
  "faust",
@@ -31326,8 +31562,8 @@ async function mcp() {
31326
31562
  init_pipe();
31327
31563
  var STUDIO = false;
31328
31564
  var STUDIO_COMMANDS = ["mcp", "run", "shot", "quit"];
31329
- var HUB2 = false;
31330
31565
  var USAGE_STUDIO = `
31566
+ With the running IDE:
31331
31567
  mcp the MCP server an AI client starts (stdio) \u2014 it asks the running IDE
31332
31568
  run <action> [json | file] run an action (palette.run) \u2014 its input as JSON, or a JSON file (a large source)
31333
31569
  shot <module_id> [file] a stage's picture (stage.picture, JPEG), to a file
@@ -31338,38 +31574,33 @@ var USAGE_STUDIO = `
31338
31574
  `;
31339
31575
  var USAGE_HUB = `
31340
31576
 
31341
- The Hub (FW_HUB_URL, FW_LOGTO_ENDPOINT, FW_LOGTO_CLI_APP_ID) \u2014 no IDE needed:
31577
+ Publish on faustwave.io:
31342
31578
  login sign in \u2014 a code to confirm in the browser
31343
31579
  logout forget the sign-in
31344
- app create <slug> <type> <title>
31345
- a new app (instrument, effect, game, tool) \u2014 a draft, seen by you only
31580
+ me whether you may publish, and your apps: each release and how it stands
31581
+ me ask <words> ask to publish (once, before your first push): what you want to publish, a sentence
31582
+ or two \u2014 the admin answers
31583
+ push <file | folder> [slug] upload a build: a plugin package (.wclap.tar.gz) or a player folder. Its name and
31584
+ version are read from it; the first push makes the app \u2014 a draft, seen by you only
31346
31585
  app describe <slug> <text | file>
31347
- its description on the app page (the first paragraph: the catalog's teaser)
31586
+ its description on its page: plain text, paragraphs by an empty line (the first
31587
+ paragraph: the catalog's teaser)
31348
31588
  app cover <slug> <picture file>
31349
- its picture on the website (PNG, JPEG or WebP, at most 5 MB)
31350
- app items <slug> <item\u2026| none>
31351
- the shop's items it presents for sale, in this order \u2014 its page offers them
31352
- app visibility <slug> <draft | unlisted | public>
31353
- push <slug> <version> <channel> <folder | file>
31354
- a build of a release (a folder is zipped from its content; web needs index.html
31355
- and faustwave.json at its root) \u2014 a draft release until published
31356
- submit <slug> <version> your release is ready \u2014 the admin reviews it (a push after: a draft again)
31357
- review (the admin) the releases submitted for review, the oldest first
31358
- publish <slug> <version> (the admin) publish a release \u2014 from then on it never changes
31359
- yank <slug> <version> (the admin) withdraw a published release
31360
- releases <slug> an app's releases, their channels and the latest version
31361
- workflow run publish-plugin <inputs> a publisher's way over the Hub: app, words, picture, build, submitted
31362
- workflow run review-release <inputs> the admin's: the release published, the app public
31363
- item create <slug> <title> what is sold \u2014 a thing of its own (a plugin, a preset pack), not an app
31364
- item price <slug> <pri_\u2026 | free | none>
31365
- its Paddle price; free: given away with a license; none: not to have
31366
- item file <slug> <file> what its buyers download (a plugin's .wclap.tar.gz \u2026), at most 50 MB
31367
- purchases <item> an item's purchases: id, status, date, buyer, Paddle transaction
31368
- refund <purchase-id> [reason]
31369
- refund the purchase's transaction in full through Paddle; revoked once Paddle reports it
31370
- reconcile [days] the Hub against Paddle: purchases whose notification was lost, refunds, chargebacks`;
31371
- var VERSION3 = false ? null : "0.97.1";
31372
- var USAGE = `faustwave \u2014 Faust patches as WebCLAP plugins, from the command line
31589
+ its picture (PNG, JPEG or WebP, at most 5 MB; shown 16:9, e.g. 1600 \xD7 900)
31590
+ submit <slug> your release that is not out yet is ready \u2014 the admin reviews it`;
31591
+ var USAGE_ADMIN = `
31592
+
31593
+ The admin:
31594
+ review what waits: the releases submitted, and who asked to publish
31595
+ publish <slug> the release that waits: out, and its app in the catalog \u2014 it never changes again
31596
+ reject <slug> <reason> the release that waits: back to its publisher, with the reason
31597
+ allow <user> a user may publish
31598
+ decline <user> <reason> a request to publish declined, with the reason
31599
+ yank <slug> <version> withdraw a published release
31600
+ releases <slug> any app's releases
31601
+ app visibility <slug> <draft | unlisted | public>`;
31602
+ var VERSION3 = false ? null : "0.98.1";
31603
+ var usage = (admin) => `faustwave \u2014 build WebCLAP plugins from Faust patches and publish them on faustwave.io
31373
31604
 
31374
31605
  faustwave <command> [options]
31375
31606
 
@@ -31377,13 +31608,15 @@ ${STUDIO ? "No IDE needed:" : "Commands:"}
31377
31608
  build plugin <patch.dsp> a Faust patch as a WebCLAP plugin with its page: <name>.wclap.tar.gz
31378
31609
  (faustwave build plugin --help: its options, examples, the layout tags)
31379
31610
  update the newest faustwave (the npm package: npm i -g faustwave@latest)
31611
+ update --auto on|off whether faustwave updates by itself when there is a newer one (asked once)
31380
31612
  help this (also: -h, --help)
31381
31613
  version which faustwave this is (also: -v, --version)
31382
- ${STUDIO ? USAGE_STUDIO : ""}${HUB2 ? USAGE_HUB : ""}
31614
+ ${STUDIO ? USAGE_STUDIO : ""}${USAGE_HUB}${admin ? USAGE_ADMIN : ""}
31615
+
31383
31616
  Start here:
31384
- faustwave build plugin tremolo.dsp then import tremolo.wclap.tar.gz into a WebCLAP host (openDAW: Load Plugin)
31617
+ faustwave build plugin tremolo.dsp then import tremolo.wclap.tar.gz into a WebCLAP host
31385
31618
  https://faustwave.io/webclap write and hear a patch in the browser first`;
31386
- var HUB_COMMANDS = ["login", "logout", "app", "item", "purchases", "refund", "reconcile", "push", "submit", "review", "publish", "yank", "releases"];
31619
+ var HUB_COMMANDS = ["login", "logout", "app", "push", "submit", "review", "publish", "reject", "me", "allow", "decline", "yank", "releases"];
31387
31620
  var run = async (action, input = {}) => {
31388
31621
  const r = await askWaking({ op: "call", name: "palette.run", input: { action_id: action, input } });
31389
31622
  return typeof r === "string" ? r : JSON.stringify(r);
@@ -31397,11 +31630,9 @@ var done = () => process.stdout.write("", () => process.exit(0));
31397
31630
  try {
31398
31631
  if (!STUDIO && (STUDIO_COMMANDS.includes(command) || command === "workflow" && !(await Promise.resolve().then(() => (init_workflow(), workflow_exports))).overHub(rest[1])))
31399
31632
  throw new Error(`faustwave ${command} plays the FaustWave studio \u2014 it comes with a later update (faustwave update).`);
31400
- if (!HUB2 && (HUB_COMMANDS.includes(command) || command === "workflow"))
31401
- throw new Error(`faustwave ${command} works with the FaustWave Hub \u2014 it comes with a later update (faustwave update).`);
31402
31633
  if (pluginHelp) process.stdout.write(`${(await Promise.resolve().then(() => (init_convert(), convert_exports))).PLUGIN_HELP}
31403
31634
  `);
31404
- else if (command === void 0 || HELP.includes(command) || rest.includes("--help") || rest.includes("-h")) process.stdout.write(`${USAGE}
31635
+ else if (command === void 0 || HELP.includes(command) || rest.includes("--help") || rest.includes("-h")) process.stdout.write(`${usage((await Promise.resolve().then(() => (init_hub(), hub_exports))).signedInAsAdmin())}
31405
31636
  `);
31406
31637
  else if (["version", "--version", "-v"].includes(command)) process.stdout.write(`faustwave ${VERSION3 ?? "(a development checkout \u2014 it has no version of its own)"}
31407
31638
  `);
@@ -31436,7 +31667,7 @@ try {
31436
31667
  `);
31437
31668
  else if (command === "update") {
31438
31669
  endsByItself = !process.versions.electron;
31439
- process.stdout.write(`${await (await Promise.resolve().then(() => (init_update(), update_exports))).update()}
31670
+ process.stdout.write(`${await (await Promise.resolve().then(() => (init_update(), update_exports))).update(rest)}
31440
31671
  `);
31441
31672
  } else {
31442
31673
  process.stderr.write(`faustwave ${command}: no such command \u2014 faustwave help lists them.