seedcord 0.17.0 → 0.17.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.
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as SEEDCORD_CONFIG_FILENAMES, t as version } from "./src-
|
|
1
|
+
import { n as SEEDCORD_CONFIG_FILENAMES, t as version } from "./src-DBLLLe00.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { Command } from "@commander-js/extra-typings";
|
|
4
4
|
import { LEVEL_COLOR, Logger, LoggerChannelRegistry, paint } from "@seedcord/logger";
|
|
@@ -516,12 +516,6 @@ function mapEmojis(emojiConfig) {
|
|
|
516
516
|
for (const [key, value] of Object.entries(emojiConfig)) emojis[key] = Array.isArray(value) ? "tuple" : "string";
|
|
517
517
|
return emojis;
|
|
518
518
|
}
|
|
519
|
-
/**
|
|
520
|
-
* Builds the generated augmentations from each command's `toJSON()` plus the emoji config. Chat-input
|
|
521
|
-
* commands become the slash-option tables, context-menu commands contribute their name to the user or
|
|
522
|
-
* message set, and each emoji key becomes a kind tag. Reads the builder back because djs erases option
|
|
523
|
-
* names at the type level.
|
|
524
|
-
*/
|
|
525
519
|
var AugmentationBuilder = class {
|
|
526
520
|
logger;
|
|
527
521
|
constructor(logger) {
|
|
@@ -626,10 +620,10 @@ function renderSlashRows(tables) {
|
|
|
626
620
|
return Object.entries(tables).sort(([first], [second]) => compare(first, second)).map(([route, options]) => ` ${renderKey(route)}: ${renderRow(options)};`).join("\n");
|
|
627
621
|
}
|
|
628
622
|
function renderContextMenuRows(names) {
|
|
629
|
-
return [...names].sort(compare).map((name) => ` ${
|
|
623
|
+
return [...names].sort(compare).map((name) => ` ${renderKey(name)}: true;`).join("\n");
|
|
630
624
|
}
|
|
631
625
|
function renderEmojiRows(emojis) {
|
|
632
|
-
return Object.entries(emojis).sort(([first], [second]) => compare(first, second)).map(([key, kind]) => ` ${
|
|
626
|
+
return Object.entries(emojis).sort(([first], [second]) => compare(first, second)).map(([key, kind]) => ` ${renderKey(key)}: '${kind === "tuple" ? "guild" : "application"}';`).join("\n");
|
|
633
627
|
}
|
|
634
628
|
function renderRow(options) {
|
|
635
629
|
const entries = Object.entries(options);
|
|
@@ -647,9 +641,6 @@ function renderChoice(value) {
|
|
|
647
641
|
if (typeof value !== "string") return String(value);
|
|
648
642
|
return `'${escapeLiteral(value)}'`;
|
|
649
643
|
}
|
|
650
|
-
function renderName(name) {
|
|
651
|
-
return IDENTIFIER.test(name) ? name : `'${escapeLiteral(name)}'`;
|
|
652
|
-
}
|
|
653
644
|
function renderKey(name) {
|
|
654
645
|
return IDENTIFIER.test(name) ? name : `'${escapeLiteral(name)}'`;
|
|
655
646
|
}
|
|
@@ -692,11 +683,6 @@ function botSpecifier(root, instance) {
|
|
|
692
683
|
const posix = relative(root, instance).split(sep).join("/").replace(ENTRY_EXTENSION, "");
|
|
693
684
|
return posix.startsWith(".") ? posix : `./${posix}`;
|
|
694
685
|
}
|
|
695
|
-
/**
|
|
696
|
-
* Orchestrates `seedcord codegen`. Locates and loads the CLI config, imports the user's Seedcord instance to
|
|
697
|
-
* read its commands directory and emoji config, scans and instantiates each command for its `toJSON()`, then
|
|
698
|
-
* renders the augmentations and either writes them or, under `--check`, diffs against the committed file.
|
|
699
|
-
*/
|
|
700
686
|
var CodegenRunner = class CodegenRunner {
|
|
701
687
|
locator;
|
|
702
688
|
configLoader;
|
|
@@ -854,9 +840,8 @@ function isInteractive(opts, hasActionFlags) {
|
|
|
854
840
|
//#endregion
|
|
855
841
|
//#region src/commands/commands/classify.ts
|
|
856
842
|
/**
|
|
857
|
-
* Selects which deployed guild commands `commands --clean` would delete. An overlap is a guild command
|
|
858
|
-
* name also exists globally, so it renders twice in the picker.
|
|
859
|
-
* Global commands are never passed in here, so they are never deleted.
|
|
843
|
+
* Selects which deployed guild commands `commands --clean` would delete. An overlap is a guild command
|
|
844
|
+
* whose name also exists globally, so it renders twice in the picker.
|
|
860
845
|
*/
|
|
861
846
|
function classifyGuildCommands(globalNames, guilds, purge) {
|
|
862
847
|
const flagged = [];
|
|
@@ -1006,10 +991,6 @@ function requireValue(value) {
|
|
|
1006
991
|
//#region src/core/prompts/pickFromList.ts
|
|
1007
992
|
const DEFAULT_MAX_ITEMS = 10;
|
|
1008
993
|
const SEARCH_THRESHOLD = 12;
|
|
1009
|
-
/**
|
|
1010
|
-
* Multi-pick from a set, sized to the list: a plain checkbox multiselect for a short list, search-as-you-type
|
|
1011
|
-
* for a long one. Returns the selected ids, or throws CliCancelled if the prompt is cancelled.
|
|
1012
|
-
*/
|
|
1013
994
|
async function pickFromList(opts) {
|
|
1014
995
|
const options = opts.items.map((item) => ({
|
|
1015
996
|
value: item.id,
|
|
@@ -1113,10 +1094,6 @@ async function readlineAsk(question) {
|
|
|
1113
1094
|
_usingCtx$1.d();
|
|
1114
1095
|
}
|
|
1115
1096
|
}
|
|
1116
|
-
/**
|
|
1117
|
-
* Gates a destructive delete behind typing the exact count, so a mistyped, empty, or non-numeric answer
|
|
1118
|
-
* aborts with nothing deleted.
|
|
1119
|
-
*/
|
|
1120
1097
|
async function confirmCount(count, logger, ask = readlineAsk) {
|
|
1121
1098
|
logger.warn(`About to delete ${count} guild command(s). This cannot be undone.`);
|
|
1122
1099
|
return (await ask(`Type ${count} to confirm (anything else aborts) `)).trim() === String(count);
|
|
@@ -1250,18 +1227,13 @@ var FlagPresenter = class {
|
|
|
1250
1227
|
//#endregion
|
|
1251
1228
|
//#region src/commands/commands/executeClean.ts
|
|
1252
1229
|
const LARGE_BOT_THRESHOLD = 200;
|
|
1253
|
-
/** Why a scan found nothing to delete, so the caller can explain it instead of a bare "nothing to clean". */
|
|
1254
1230
|
function emptyOutcome(scan, purge) {
|
|
1255
1231
|
if (scan.scannedGuildCount === 0 && scan.skipped.length > 0) return "all-skipped";
|
|
1256
1232
|
if (scan.scannedCommandCount === 0) return "no-commands";
|
|
1257
1233
|
if (!purge && scan.globalCommandCount === 0) return "no-globals";
|
|
1258
1234
|
return "no-overlaps";
|
|
1259
1235
|
}
|
|
1260
|
-
/**
|
|
1261
|
-
* The dry-run-then-confirm flow for `commands --clean`. Resolves targets, scans, previews, and only deletes
|
|
1262
|
-
* once `apply` is set and the presenter confirms. The presenter owns all output and the two confirmations,
|
|
1263
|
-
* so the wizard and the flag path share this flow with different presenters.
|
|
1264
|
-
*/
|
|
1236
|
+
/** The wizard and the flag path share this flow through different presenters, which own all output and both confirmations. */
|
|
1265
1237
|
async function executeClean(request) {
|
|
1266
1238
|
const { runner, scope, apply, token, presenter, knownGuilds } = request;
|
|
1267
1239
|
const { appId, guilds } = await presenter.status("Connecting to Discord…", () => runner.resolveTargets(scope, token), "Connected to Discord.");
|
|
@@ -1291,7 +1263,6 @@ function overlayNames(guilds, knownGuilds) {
|
|
|
1291
1263
|
|
|
1292
1264
|
//#endregion
|
|
1293
1265
|
//#region src/commands/commands/flagClean.ts
|
|
1294
|
-
/** Runs `seedcord commands --clean ...` headlessly from parsed flags, reproducing any wizard run. */
|
|
1295
1266
|
async function runCleanFromFlags(runner, flags, token, logger) {
|
|
1296
1267
|
await executeClean({
|
|
1297
1268
|
runner,
|