create-seedcord 0.1.1 → 0.1.2-next.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.
package/README.md CHANGED
@@ -1,13 +1,31 @@
1
- <p align="center">
1
+ <div align="center">
2
2
  <picture>
3
3
  <source media="(prefers-color-scheme: dark)" srcset="https://cdn.seedcord.org/assets/wordmark-dark.webp" />
4
4
  <img src="https://cdn.seedcord.org/assets/wordmark-light.webp" alt="seedcord" width="440" />
5
5
  </picture>
6
- </p>
6
+ </div>
7
7
 
8
- # create-seedcord
8
+ <div align="center">
9
+ <h3>The whole Discord bot, wired and typed</h3>
10
+ <a href="https://seedcord.org">Website</a> ·
11
+ <a href="https://guide.seedcord.org">Guide</a> ·
12
+ <a href="https://docs.seedcord.org">Reference</a> ·
13
+ <a href="https://discord.gg/DzFxY58WXf">Discord</a>
14
+ </div>
9
15
 
10
- Scaffold a new seedcord bot project.
16
+ <br />
17
+
18
+ <div align="center">
19
+
20
+ [![npm](https://img.shields.io/npm/v/create-seedcord?style=flat-square&logo=npm&logoColor=c8341f&label=&labelColor=1f1f1f&color=c8341f)](https://www.npmjs.com/package/create-seedcord) [![node](https://img.shields.io/node/v/create-seedcord?style=flat-square&label=node&labelColor=1f1f1f&color=4d7d33)](https://nodejs.org) [![license](https://img.shields.io/npm/l/create-seedcord?style=flat-square&label=license&labelColor=1f1f1f&color=f8f6e8)](LICENSE)
21
+
22
+ </div>
23
+
24
+ ## About
25
+
26
+ `create-seedcord` scaffolds a new seedcord bot project.
27
+
28
+ Until v1.0.0, minor versions can break.
11
29
 
12
30
  ## Usage
13
31
 
@@ -19,7 +37,7 @@ yarn create seedcord my-bot
19
37
 
20
38
  It asks where the project goes, how Discord reaches your bot, what the bot should react to, your bot token, and an accent color. Then it writes the project, installs, formats, generates your command types, and makes the first commit.
21
39
 
22
- On Windows, run it from Windows Terminal. The prompts fall back to ASCII in `cmd.exe`, so the boxes draw as `T`, `|`, and `o`.
40
+ On Windows, run it from Windows Terminal. The prompts fall back to ASCII in `cmd.exe` making the boxes draw as `T`, `|`, and `o`.
23
41
 
24
42
  ## Flags
25
43
 
@@ -38,13 +56,6 @@ With no terminal to ask on, it reads the flags alone. It names the flag that wou
38
56
 
39
57
  ## What you get
40
58
 
41
- You get a TypeScript project with one slash command, its handler, a sample event handler (if you picked `gateway`), `seedcord.config.ts`, eslint, prettier, and a `.env` listing every key the framework reads.
59
+ A TypeScript project holding one slash command, its handler, a sample event handler (if you picked `gateway`), `seedcord.config.ts`, eslint, prettier, and a `.env` listing every key the framework reads.
42
60
 
43
61
  `pnpm dev` starts it with hot reload. On the http transport it also opens a cloudflared tunnel and sets it up, and Discord posts interactions to that URL.
44
-
45
- ## Docs
46
-
47
- - Guide: <https://guide.seedcord.org>
48
- - API reference: <https://docs.seedcord.org>
49
-
50
- Part of the [seedcord](https://github.com/seedcord/seedcord) framework. Until a major v1.0.0 release, expect breaking changes in minor versions.
package/dist/index.mjs CHANGED
@@ -1922,27 +1922,23 @@ const chalk = createChalk();
1922
1922
  const chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
1923
1923
 
1924
1924
  //#endregion
1925
- //#region ../../packages/errors/dist/SeedcordError-B5hcAoT3.mjs
1925
+ //#region ../../packages/errors/dist/SeedcordError-BLQ8_el7.mjs
1926
1926
  /**
1927
1927
  * All Seedcord error codes.
1928
1928
  */
1929
1929
  let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
1930
- /** DISCORD_BOT_TOKEN is not present in the environment. */
1931
- SeedcordErrorCode[SeedcordErrorCode["ConfigMissingDiscordToken"] = 1001] = "ConfigMissingDiscordToken";
1932
- /** DISCORD_BOT_TOKEN is present but fails validation. */
1933
- SeedcordErrorCode[SeedcordErrorCode["ConfigIncorrectDiscordToken"] = 1002] = "ConfigIncorrectDiscordToken";
1934
1930
  /** One or more configured emojis could not be resolved at startup. */
1935
- SeedcordErrorCode[SeedcordErrorCode["ConfigEmojiUnresolved"] = 1003] = "ConfigEmojiUnresolved";
1931
+ SeedcordErrorCode[SeedcordErrorCode["ConfigEmojiUnresolved"] = 1001] = "ConfigEmojiUnresolved";
1936
1932
  /** A webhook reporter's env var is set but fails webhook URL validation. */
1937
- SeedcordErrorCode[SeedcordErrorCode["ConfigWebhookUrlInvalid"] = 1004] = "ConfigWebhookUrlInvalid";
1933
+ SeedcordErrorCode[SeedcordErrorCode["ConfigWebhookUrlInvalid"] = 1002] = "ConfigWebhookUrlInvalid";
1938
1934
  /** A configured webhook does not exist on Discord (deleted, or a wrong id or token). */
1939
- SeedcordErrorCode[SeedcordErrorCode["ConfigWebhookNotFound"] = 1005] = "ConfigWebhookNotFound";
1940
- /** DISCORD_PUBLIC_KEY is not present in the environment. */
1941
- SeedcordErrorCode[SeedcordErrorCode["ConfigMissingPublicKey"] = 1006] = "ConfigMissingPublicKey";
1942
- /** DISCORD_PUBLIC_KEY is present but fails validation. */
1943
- SeedcordErrorCode[SeedcordErrorCode["ConfigIncorrectPublicKey"] = 1007] = "ConfigIncorrectPublicKey";
1935
+ SeedcordErrorCode[SeedcordErrorCode["ConfigWebhookNotFound"] = 1003] = "ConfigWebhookNotFound";
1944
1936
  /** The generated route manifest was imported before `seedcord build` generated it. */
1945
- SeedcordErrorCode[SeedcordErrorCode["ConfigManifestNotGenerated"] = 1008] = "ConfigManifestNotGenerated";
1937
+ SeedcordErrorCode[SeedcordErrorCode["ConfigManifestNotGenerated"] = 1004] = "ConfigManifestNotGenerated";
1938
+ /** A required environment variable is not present. */
1939
+ SeedcordErrorCode[SeedcordErrorCode["ConfigMissingEnv"] = 1005] = "ConfigMissingEnv";
1940
+ /** An environment variable is present and fails validation. */
1941
+ SeedcordErrorCode[SeedcordErrorCode["ConfigInvalidEnv"] = 1006] = "ConfigInvalidEnv";
1946
1942
  /** Attempted to add lifecycle tasks after startup already completed. */
1947
1943
  SeedcordErrorCode[SeedcordErrorCode["LifecycleAddAfterCompletion"] = 1101] = "LifecycleAddAfterCompletion";
1948
1944
  /** Attempted to add lifecycle tasks while startup is still running. */
@@ -1979,18 +1975,16 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
1979
1975
  SeedcordErrorCode[SeedcordErrorCode["CoreAccessorUnresolved"] = 1210] = "CoreAccessorUnresolved";
1980
1976
  /** Interaction middleware decorated with disallowed event filters. */
1981
1977
  SeedcordErrorCode[SeedcordErrorCode["DecoratorInteractionEventFilter"] = 1301] = "DecoratorInteractionEventFilter";
1982
- /** A decorator could not find the original method being decorated. */
1983
- SeedcordErrorCode[SeedcordErrorCode["DecoratorMethodNotFound"] = 1302] = "DecoratorMethodNotFound";
1984
1978
  /** A command decorator attempted to re-register an existing command scope. */
1985
- SeedcordErrorCode[SeedcordErrorCode["DecoratorCommandAlreadyRegistered"] = 1303] = "DecoratorCommandAlreadyRegistered";
1979
+ SeedcordErrorCode[SeedcordErrorCode["DecoratorCommandAlreadyRegistered"] = 1302] = "DecoratorCommandAlreadyRegistered";
1986
1980
  /** A global command decorator specified guild IDs, which is not allowed. */
1987
- SeedcordErrorCode[SeedcordErrorCode["DecoratorCommandGlobalWithGuilds"] = 1304] = "DecoratorCommandGlobalWithGuilds";
1981
+ SeedcordErrorCode[SeedcordErrorCode["DecoratorCommandGlobalWithGuilds"] = 1303] = "DecoratorCommandGlobalWithGuilds";
1988
1982
  /** A guild command decorator omitted the required guild ID list. */
1989
- SeedcordErrorCode[SeedcordErrorCode["DecoratorCommandGuildWithoutGuilds"] = 1305] = "DecoratorCommandGuildWithoutGuilds";
1983
+ SeedcordErrorCode[SeedcordErrorCode["DecoratorCommandGuildWithoutGuilds"] = 1304] = "DecoratorCommandGuildWithoutGuilds";
1990
1984
  /** Middleware priority provided by the decorator was not a finite number. */
1991
- SeedcordErrorCode[SeedcordErrorCode["DecoratorInvalidMiddlewarePriority"] = 1306] = "DecoratorInvalidMiddlewarePriority";
1985
+ SeedcordErrorCode[SeedcordErrorCode["DecoratorInvalidMiddlewarePriority"] = 1305] = "DecoratorInvalidMiddlewarePriority";
1992
1986
  /** A WebhookLog subclass is missing its `@WebhookUrl` decorator. */
1993
- SeedcordErrorCode[SeedcordErrorCode["DecoratorWebhookUrlMissing"] = 1307] = "DecoratorWebhookUrlMissing";
1987
+ SeedcordErrorCode[SeedcordErrorCode["DecoratorWebhookUrlMissing"] = 1306] = "DecoratorWebhookUrlMissing";
1994
1988
  /** Two interaction handlers registered the same route within a scope. */
1995
1989
  SeedcordErrorCode[SeedcordErrorCode["InteractionDuplicateRoute"] = 1401] = "InteractionDuplicateRoute";
1996
1990
  /** Two different interaction middleware classes share a class name. */
@@ -2055,6 +2049,8 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
2055
2049
  SeedcordErrorCode[SeedcordErrorCode["ColorOutOfRange"] = 1902] = "ColorOutOfRange";
2056
2050
  /** A plugin's constructor rejected its options through `rejectOptions`. */
2057
2051
  SeedcordErrorCode[SeedcordErrorCode["PluginOptionsRejected"] = 2001] = "PluginOptionsRejected";
2052
+ /** Two or more plugins threw while disposing. */
2053
+ SeedcordErrorCode[SeedcordErrorCode["PluginDisposeFailures"] = 2002] = "PluginDisposeFailures";
2058
2054
  /** Mongoose service class is missing the `@RegisterMongooseService` decorator. */
2059
2055
  SeedcordErrorCode[SeedcordErrorCode["PluginMongooseServiceDecoratorMissing"] = 2101] = "PluginMongooseServiceDecoratorMissing";
2060
2056
  /** Mongoose client failed to establish a connection. */
@@ -2095,76 +2091,54 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
2095
2091
  SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidExport"] = 3101] = "CliConfigInvalidExport";
2096
2092
  /** Config is missing the required instance string. */
2097
2093
  SeedcordErrorCode[SeedcordErrorCode["CliConfigMissingInstance"] = 3102] = "CliConfigMissingInstance";
2098
- /** Config root was provided but not a string. */
2099
- SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidRoot"] = 3103] = "CliConfigInvalidRoot";
2100
2094
  /** Unable to locate a Seedcord config file. */
2101
- SeedcordErrorCode[SeedcordErrorCode["CliConfigNotFound"] = 3104] = "CliConfigNotFound";
2095
+ SeedcordErrorCode[SeedcordErrorCode["CliConfigNotFound"] = 3103] = "CliConfigNotFound";
2102
2096
  /** CLI entry file does not exist. */
2103
- SeedcordErrorCode[SeedcordErrorCode["CliEntryNotFound"] = 3105] = "CliEntryNotFound";
2097
+ SeedcordErrorCode[SeedcordErrorCode["CliEntryNotFound"] = 3104] = "CliEntryNotFound";
2104
2098
  /** tsx failed to import the provided entry file. */
2105
- SeedcordErrorCode[SeedcordErrorCode["CliTsxImportFailed"] = 3106] = "CliTsxImportFailed";
2099
+ SeedcordErrorCode[SeedcordErrorCode["CliTsxImportFailed"] = 3105] = "CliTsxImportFailed";
2106
2100
  /** Native import and jiti fallback both failed. */
2107
- SeedcordErrorCode[SeedcordErrorCode["CliImportFailed"] = 3107] = "CliImportFailed";
2101
+ SeedcordErrorCode[SeedcordErrorCode["CliImportFailed"] = 3106] = "CliImportFailed";
2108
2102
  /** Seedcord instance export is missing a start() method. */
2109
- SeedcordErrorCode[SeedcordErrorCode["CliInstanceInvalid"] = 3108] = "CliInstanceInvalid";
2103
+ SeedcordErrorCode[SeedcordErrorCode["CliInstanceInvalid"] = 3107] = "CliInstanceInvalid";
2110
2104
  /** Seedcord instance threw during startup. */
2111
- SeedcordErrorCode[SeedcordErrorCode["CliStartFailed"] = 3109] = "CliStartFailed";
2105
+ SeedcordErrorCode[SeedcordErrorCode["CliStartFailed"] = 3108] = "CliStartFailed";
2112
2106
  /** Config is missing the required entry string. */
2113
- SeedcordErrorCode[SeedcordErrorCode["CliConfigMissingEntry"] = 3110] = "CliConfigMissingEntry";
2114
- /** Config build options must be an object when provided. */
2115
- SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidBuild"] = 3111] = "CliConfigInvalidBuild";
2116
- /** Config build outDir must be a string when provided. */
2117
- SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidBuildOutDir"] = 3112] = "CliConfigInvalidBuildOutDir";
2118
- /** Config build tsconfig must be a string when provided. */
2119
- SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidBuildTsconfig"] = 3113] = "CliConfigInvalidBuildTsconfig";
2120
- /** Config build bootstrap must be a string when provided. */
2121
- SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidBuildBootstrap"] = 3114] = "CliConfigInvalidBuildBootstrap";
2107
+ SeedcordErrorCode[SeedcordErrorCode["CliConfigMissingEntry"] = 3109] = "CliConfigMissingEntry";
2122
2108
  /** Entry file must be inside the configured root directory. */
2123
- SeedcordErrorCode[SeedcordErrorCode["CliConfigEntryOutsideRoot"] = 3115] = "CliConfigEntryOutsideRoot";
2109
+ SeedcordErrorCode[SeedcordErrorCode["CliConfigEntryOutsideRoot"] = 3110] = "CliConfigEntryOutsideRoot";
2124
2110
  /** Unable to locate a TypeScript config file for builds. */
2125
- SeedcordErrorCode[SeedcordErrorCode["CliBuildTsconfigNotFound"] = 3116] = "CliBuildTsconfigNotFound";
2111
+ SeedcordErrorCode[SeedcordErrorCode["CliBuildTsconfigNotFound"] = 3111] = "CliBuildTsconfigNotFound";
2126
2112
  /** TypeScript reported diagnostics during emit. */
2127
- SeedcordErrorCode[SeedcordErrorCode["CliBuildFailed"] = 3117] = "CliBuildFailed";
2113
+ SeedcordErrorCode[SeedcordErrorCode["CliBuildFailed"] = 3112] = "CliBuildFailed";
2128
2114
  /** Unable to write the generated bootstrap file. */
2129
- SeedcordErrorCode[SeedcordErrorCode["CliBootstrapWriteFailed"] = 3118] = "CliBootstrapWriteFailed";
2130
- /** Config hmr typecheck tsconfig must be a string when provided. */
2131
- SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidTsconfig"] = 3119] = "CliConfigInvalidTsconfig";
2132
- /** Config hmr options must be an object when provided. */
2133
- SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidHmr"] = 3120] = "CliConfigInvalidHmr";
2134
- /** Config hmr restart patterns must be an array of strings when provided. */
2135
- SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidHmrRestart"] = 3121] = "CliConfigInvalidHmrRestart";
2115
+ SeedcordErrorCode[SeedcordErrorCode["CliBootstrapWriteFailed"] = 3113] = "CliBootstrapWriteFailed";
2136
2116
  /** Two commands resolve to the same slash route during codegen. */
2137
- SeedcordErrorCode[SeedcordErrorCode["CliCodegenDuplicateRoute"] = 3122] = "CliCodegenDuplicateRoute";
2117
+ SeedcordErrorCode[SeedcordErrorCode["CliCodegenDuplicateRoute"] = 3114] = "CliCodegenDuplicateRoute";
2138
2118
  /** The commands directory could not be read during codegen. */
2139
- SeedcordErrorCode[SeedcordErrorCode["CliCodegenCommandsDirUnreadable"] = 3123] = "CliCodegenCommandsDirUnreadable";
2119
+ SeedcordErrorCode[SeedcordErrorCode["CliCodegenCommandsDirUnreadable"] = 3115] = "CliCodegenCommandsDirUnreadable";
2140
2120
  /** Two context-menu commands of the same kind share a name during codegen. */
2141
- SeedcordErrorCode[SeedcordErrorCode["CliCodegenDuplicateContextMenu"] = 3124] = "CliCodegenDuplicateContextMenu";
2121
+ SeedcordErrorCode[SeedcordErrorCode["CliCodegenDuplicateContextMenu"] = 3116] = "CliCodegenDuplicateContextMenu";
2142
2122
  /** Could not resolve the application from the bot token during `commands --clean`. */
2143
- SeedcordErrorCode[SeedcordErrorCode["CliCleanAppFetchFailed"] = 3125] = "CliCleanAppFetchFailed";
2123
+ SeedcordErrorCode[SeedcordErrorCode["CliCleanAppFetchFailed"] = 3117] = "CliCleanAppFetchFailed";
2144
2124
  /** `commands --clean` ran with neither --guild nor --all-guilds. */
2145
- SeedcordErrorCode[SeedcordErrorCode["CliCleanNoGuilds"] = 3126] = "CliCleanNoGuilds";
2125
+ SeedcordErrorCode[SeedcordErrorCode["CliCleanNoGuilds"] = 3118] = "CliCleanNoGuilds";
2146
2126
  /** `commands --clean` combined --purge with --all-guilds, which would wipe every guild. */
2147
- SeedcordErrorCode[SeedcordErrorCode["CliCleanPurgeAllGuilds"] = 3127] = "CliCleanPurgeAllGuilds";
2127
+ SeedcordErrorCode[SeedcordErrorCode["CliCleanPurgeAllGuilds"] = 3119] = "CliCleanPurgeAllGuilds";
2148
2128
  /** An interactive prompt was cancelled (Ctrl-C), so the command aborts without changes. */
2149
- SeedcordErrorCode[SeedcordErrorCode["CliCancelled"] = 3128] = "CliCancelled";
2129
+ SeedcordErrorCode[SeedcordErrorCode["CliCancelled"] = 3120] = "CliCancelled";
2150
2130
  /** `commands --clean --all-guilds` matched more guilds than the safety threshold without `--yes`. */
2151
- SeedcordErrorCode[SeedcordErrorCode["CliCleanLargeBotUnconfirmed"] = 3129] = "CliCleanLargeBotUnconfirmed";
2131
+ SeedcordErrorCode[SeedcordErrorCode["CliCleanLargeBotUnconfirmed"] = 3121] = "CliCleanLargeBotUnconfirmed";
2152
2132
  /** `commands --clean --apply` ran in a non-interactive environment without `--yes`, where it cannot prompt. */
2153
- SeedcordErrorCode[SeedcordErrorCode["CliCleanApplyNeedsYes"] = 3130] = "CliCleanApplyNeedsYes";
2154
- /** Config hmr rollback flag must be a boolean when provided. */
2155
- SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidHmrRollback"] = 3131] = "CliConfigInvalidHmrRollback";
2156
- /** Config tunnel must be a boolean or an https URL when provided. */
2157
- SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidTunnel"] = 3132] = "CliConfigInvalidTunnel";
2133
+ SeedcordErrorCode[SeedcordErrorCode["CliCleanApplyNeedsYes"] = 3122] = "CliCleanApplyNeedsYes";
2158
2134
  /** The cloudflared metrics server never reported a quick-tunnel hostname. */
2159
- SeedcordErrorCode[SeedcordErrorCode["CliTunnelUrlUnavailable"] = 3133] = "CliTunnelUrlUnavailable";
2135
+ SeedcordErrorCode[SeedcordErrorCode["CliTunnelUrlUnavailable"] = 3123] = "CliTunnelUrlUnavailable";
2160
2136
  /** Discord rejected the tunnel URL as an interactions endpoint. */
2161
- SeedcordErrorCode[SeedcordErrorCode["CliTunnelNotVerified"] = 3134] = "CliTunnelNotVerified";
2137
+ SeedcordErrorCode[SeedcordErrorCode["CliTunnelNotVerified"] = 3124] = "CliTunnelNotVerified";
2162
2138
  /** The tunnel URL never answered its health probe. */
2163
- SeedcordErrorCode[SeedcordErrorCode["CliTunnelUnreachable"] = 3135] = "CliTunnelUnreachable";
2164
- /** Config hmr typecheck flag must be a boolean or object when provided. */
2165
- SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidHmrTypecheck"] = 3136] = "CliConfigInvalidHmrTypecheck";
2166
- /** Config idleAnimation flag must be a boolean when provided. */
2167
- SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidIdleAnimation"] = 3137] = "CliConfigInvalidIdleAnimation";
2139
+ SeedcordErrorCode[SeedcordErrorCode["CliTunnelUnreachable"] = 3125] = "CliTunnelUnreachable";
2140
+ /** A config field is present with the wrong shape. */
2141
+ SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidField"] = 3126] = "CliConfigInvalidField";
2168
2142
  /** A create prompt was cancelled (Ctrl-C), and nothing has been written yet. */
2169
2143
  SeedcordErrorCode[SeedcordErrorCode["CreateCancelled"] = 3201] = "CreateCancelled";
2170
2144
  /** A flag supplied an answer for a question the earlier answers skip. */
@@ -2179,16 +2153,33 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
2179
2153
  SeedcordErrorCode[SeedcordErrorCode["CreateStepFailed"] = 3206] = "CreateStepFailed";
2180
2154
  return SeedcordErrorCode;
2181
2155
  }({});
2156
+ const BRAND = {
2157
+ flesh: "#f04e36",
2158
+ rind: "#6fab49",
2159
+ pith: "#f8f6e8"
2160
+ };
2161
+ const paint = {
2162
+ sky: chalk.hex("#8fc7ff"),
2163
+ iris: chalk.hex("#e29bff"),
2164
+ mint: chalk.hex("#66d98a"),
2165
+ amber: chalk.hex("#ffc061"),
2166
+ coral: chalk.hex("#ff6b85"),
2167
+ flesh: chalk.hex(BRAND.flesh),
2168
+ rind: chalk.hex(BRAND.rind),
2169
+ pith: chalk.hex(BRAND.pith),
2170
+ mute: chalk.dim,
2171
+ bold: chalk.bold,
2172
+ italic: chalk.italic,
2173
+ underline: chalk.underline
2174
+ };
2182
2175
  /** @internal */
2183
2176
  const messages = {
2184
- [1001]: () => "Missing DISCORD_BOT_TOKEN environment variable.",
2185
- [1002]: () => "Invalid DISCORD_BOT_TOKEN value.",
2186
- [1006]: () => "Missing DISCORD_PUBLIC_KEY environment variable.",
2187
- [1007]: () => "Invalid DISCORD_PUBLIC_KEY value. Expected 64 hex characters.",
2188
- [1008]: () => "The route manifest is generated by `seedcord build`. Run the build before importing it.",
2189
- [1004]: (envKey) => `${envKey} is not a well-formed Discord webhook url.`,
2190
- [1005]: (envKey) => `The webhook behind ${envKey} does not exist on Discord.`,
2191
- [1003]: (count, failures) => `Could not resolve ${count} configured emoji${count === 1 ? "" : "s"} at startup.\n${failures}`,
2177
+ [1005]: (name) => `Missing ${name} environment variable.`,
2178
+ [1006]: (name, expected) => expected ? `Invalid ${name} value. Expected ${expected}.` : `Invalid ${name} value.`,
2179
+ [1004]: () => "The route manifest is generated by `seedcord build`. Run the build before importing it.",
2180
+ [1002]: (envKey) => `${envKey} is not a well-formed Discord webhook url.`,
2181
+ [1003]: (envKey) => `The webhook behind ${envKey} does not exist on Discord.`,
2182
+ [1001]: (count, failures) => `Could not resolve ${count} configured emoji${count === 1 ? "" : "s"} at startup.\n${failures}`,
2192
2183
  [1101]: () => "Cannot add tasks after startup sequence has already completed.",
2193
2184
  [1102]: () => "Cannot add tasks while startup sequence is in progress.",
2194
2185
  [1103]: () => "Cannot remove tasks while startup sequence is in progress.",
@@ -2207,22 +2198,21 @@ const messages = {
2207
2198
  [1209]: () => "The bot's application id could not be resolved.",
2208
2199
  [1210]: (accessor, key) => `${accessor}.${key} has no value yet. ${accessor} fills during startup, and a read at the top of a file runs before that.`,
2209
2200
  [1301]: () => "Interaction middleware cannot specify event filters.",
2210
- [1302]: () => "Decorator could not locate the original method. Ensure the method exists before applying the decorator.",
2211
- [1303]: (commandName, existingScope, requestedScope) => `Command "${commandName}" is already registered as a "${existingScope}" command and cannot be re-registered as a "${requestedScope}" command.`,
2212
- [1304]: () => "RegisterCommand(\"global\") cannot have guilds specified.",
2213
- [1305]: () => "RegisterCommand(\"guild\") requires a non-empty guilds array.",
2214
- [1306]: () => "Middleware priority must be a finite number.",
2215
- [1307]: (className) => `${className} extends WebhookLog and needs a @WebhookUrl decorator naming its env var.`,
2201
+ [1302]: (commandName, existingScope, requestedScope) => `Command "${commandName}" is already registered as a "${existingScope}" command and cannot be re-registered as a "${requestedScope}" command.`,
2202
+ [1303]: () => "RegisterCommand(\"global\") cannot have guilds specified.",
2203
+ [1304]: () => "RegisterCommand(\"guild\") requires a non-empty guilds array.",
2204
+ [1305]: () => "Middleware priority must be a finite number.",
2205
+ [1306]: (className) => `${className} extends WebhookLog and needs a @WebhookUrl decorator naming its env var.`,
2216
2206
  [1401]: (route, first, second) => `Two interaction handlers resolve to the same route \`${route}\`. Registered by ${first} and ${second}. Rename one.`,
2217
2207
  [1402]: (name) => `Two different interaction middleware classes share the name \`${name}\`. Rename one so they do not collide.`,
2218
2208
  [1403]: (route, exportName, from) => `Route \`${route}\` loads \`${exportName}\` from ${from}, which exports no such name.`,
2219
2209
  [1404]: (keys, exportName, from) => `Subscriber row for \`${keys}\` loads \`${exportName}\` from ${from}, which does not extend Subscriber.`,
2220
2210
  [1405]: (route, from) => `Route \`${route}\` failed to import ${from}.`,
2221
- [1501]: (method, reason, alternative, routeId) => `${chalk.cyan(`${method}()`)} was called when ${reason}.\n${alternative} (route ${chalk.cyan(routeId)})`,
2222
- [1502]: (componentClass, index, detail, routeId) => `${chalk.cyan(componentClass)} at components[${index}] failed to serialize: ${detail.replace(/\.$/, "")}. (route ${chalk.cyan(routeId)})`,
2223
- [1503]: (method, targetId, routeId) => `${chalk.cyan(`${method}()`)} was passed message ${targetId}, which this interaction did not send.\nPass a message this interaction sent, returned by reply(), followUp(), edit(), or update(). (route ${chalk.cyan(routeId)})`,
2224
- [1504]: (method, routeId) => `${chalk.cyan(`${method}()`)} was called on a modal opened from a command, which has no source message.\nUse reply() or defer() instead. (route ${chalk.cyan(routeId)})`,
2225
- [1505]: (method, routeId) => `The interaction callback for ${chalk.cyan(`${method}()`)} returned no message. (route ${chalk.cyan(routeId)})`,
2211
+ [1501]: (method, reason, alternative, routeId) => `${paint.sky(`${method}()`)} was called when ${reason}.\n${alternative} (route ${paint.mute(routeId)})`,
2212
+ [1502]: (componentClass, index, detail, routeId) => `${paint.sky(componentClass)} at components[${index}] failed to serialize: ${detail.replace(/\.$/, "")}. (route ${paint.mute(routeId)})`,
2213
+ [1503]: (method, targetId, routeId) => `${paint.sky(`${method}()`)} was passed message ${targetId}, which this interaction did not send.\nPass a message this interaction sent, returned by reply(), followUp(), edit(), or update(). (route ${paint.mute(routeId)})`,
2214
+ [1504]: (method, routeId) => `${paint.sky(`${method}()`)} was called on a modal opened from a command, which has no source message.\nUse reply() or defer() instead. (route ${paint.mute(routeId)})`,
2215
+ [1505]: (method, routeId) => `The interaction callback for ${paint.sky(`${method}()`)} returned no message. (route ${paint.mute(routeId)})`,
2226
2216
  [1601]: (prefix) => `customId prefix ${JSON.stringify(prefix)} must be a non-empty string without a colon or control character.`,
2227
2217
  [1602]: (field) => `customId field name ${JSON.stringify(field)} is integer-like, which JS reorders. Use a non-numeric name.`,
2228
2218
  [1603]: (field) => `customId field ${JSON.stringify(field)} uses oneOf() with no choices.`,
@@ -2245,6 +2235,7 @@ const messages = {
2245
2235
  [1901]: (value) => `Cannot convert ${value} into a color.`,
2246
2236
  [1902]: () => "Color must be within the range 0 to 16777215 (0xffffff).",
2247
2237
  [2001]: (pluginName, reason) => `${pluginName} rejected its options, ${reason.replace(/\.$/, "")}.`,
2238
+ [2002]: (count) => `${count} plugins failed to dispose.`,
2248
2239
  [2101]: (className) => `Missing @RegisterMongooseService on ${className}.`,
2249
2240
  [2102]: (databaseName) => databaseName ? `Could not connect to MongoDB (${databaseName}).` : "Could not connect to MongoDB.",
2250
2241
  [2103]: () => "Failed to disconnect from MongoDB cleanly during shutdown.",
@@ -2265,41 +2256,30 @@ const messages = {
2265
2256
  [2212]: (databaseName) => `Failed to ensure database ${databaseName} exists.`,
2266
2257
  [3101]: () => "Config file must default export an object.",
2267
2258
  [3102]: () => "Config must include an `instance` string that points to your Seedcord default export.",
2268
- [3103]: () => "Config `root` must be a string when provided.",
2269
- [3104]: (baseDir, candidates) => `Unable to locate a Seedcord config in ${baseDir}. Searched for ${candidates.join(", ")}.`,
2270
- [3110]: () => "Config must include an `entry` string that points to your startup script.",
2271
- [3111]: () => "Config `build` must be an object when provided.",
2272
- [3112]: () => "Config `build.outDir` must be a string when provided.",
2273
- [3113]: () => "Config `build.tsconfig` must be a string when provided.",
2274
- [3114]: () => "Config `build.bootstrap` must be a string when provided.",
2275
- [3115]: (entryPath, root) => `Entry file ${entryPath} must reside inside configured root ${root}.`,
2276
- [3105]: (entryPath) => `Cannot find entry file at ${entryPath}.`,
2277
- [3106]: (entryPath, reason) => `Failed to import ${entryPath} via tsx: ${reason}`,
2278
- [3107]: (entryPath, nativeReason, fallbackReason) => `Failed to import ${entryPath}: ${nativeReason} (the jiti fallback also failed: ${fallbackReason})`,
2279
- [3108]: () => "Seedcord instance must default export an object with a start() method.",
2280
- [3109]: (instancePath, reason) => `Failed to start Seedcord from ${instancePath}: ${reason}`,
2281
- [3116]: (hint) => `Unable to resolve a tsconfig for builds (${hint}). Provide build.tsconfig or add tsconfig.build.json / tsconfig.json.`,
2282
- [3117]: (diagnostics) => `TypeScript build failed:\n${diagnostics}`,
2283
- [3118]: (targetPath, reason) => `Failed to write bootstrap file at ${targetPath}: ${reason}`,
2284
- [3119]: () => "Config `hmr.typecheck.tsconfig` must be a string when provided.",
2285
- [3120]: () => "Config `hmr` must be an object when provided.",
2286
- [3121]: () => "Config `hmr.restart` must be an array of strings when provided.",
2287
- [3131]: () => "Config `hmr.rollback` must be a boolean when provided.",
2288
- [3136]: () => "Config `hmr.typecheck` must be a boolean or an object when provided.",
2289
- [3137]: () => "Config `idleAnimation` must be a boolean when provided.",
2290
- [3122]: (route, firstFile, secondFile) => `Two commands resolve to the same slash route \`${route}\`. Defined in ${firstFile} and ${secondFile}. Rename one.`,
2291
- [3123]: (dir, reason) => `Could not read the commands directory ${dir} during codegen. ${reason}`,
2292
- [3124]: (kind, name, firstFile, secondFile) => `Two ${kind} context-menu commands share the name \`${name}\`. Defined in ${firstFile} and ${secondFile}. Rename one.`,
2293
- [3125]: (reason) => `Could not resolve the application from the bot token. ${reason}`,
2294
- [3126]: () => "No guilds given. Pass --guild <ids...> or --all-guilds. Global commands are never touched.",
2295
- [3127]: () => "--purge cannot be combined with --all-guilds. Use --guild <ids> to purge specific guilds.",
2296
- [3128]: () => "Cancelled.",
2297
- [3129]: (count) => `Refusing to scan ${count} guilds without confirmation. Re-run with --yes, or name specific guilds with --guild <ids>.`,
2298
- [3130]: () => "Refusing to delete without confirmation in a non-interactive environment. Re-run with --yes.",
2299
- [3132]: () => "Config `tunnel` must be a boolean or an https URL.",
2300
- [3133]: (seconds) => `cloudflared did not report a tunnel URL within ${seconds}s. Check that the binary runs and that the network allows it.`,
2301
- [3134]: (url) => `Discord rejected ${url} as an interactions endpoint.`,
2302
- [3135]: (url, seconds) => `${url} did not answer within ${seconds}s, so nothing was PATCHed to Discord.`,
2259
+ [3103]: (baseDir, candidates) => `Unable to locate a Seedcord config in ${baseDir}. Searched for ${candidates.join(", ")}.`,
2260
+ [3109]: () => "Config must include an `entry` string that points to your startup script.",
2261
+ [3110]: (entryPath, root) => `Entry file ${entryPath} must reside inside configured root ${root}.`,
2262
+ [3104]: (entryPath) => `Cannot find entry file at ${entryPath}.`,
2263
+ [3105]: (entryPath, reason) => `Failed to import ${entryPath} via tsx: ${reason}`,
2264
+ [3106]: (entryPath, nativeReason, fallbackReason) => `Failed to import ${entryPath}: ${nativeReason} (the jiti fallback also failed: ${fallbackReason})`,
2265
+ [3107]: () => "Seedcord instance must default export an object with a start() method.",
2266
+ [3108]: (instancePath, reason) => `Failed to start Seedcord from ${instancePath}: ${reason}`,
2267
+ [3111]: (hint) => `Unable to resolve a tsconfig for builds (${hint}). Provide build.tsconfig or add tsconfig.build.json / tsconfig.json.`,
2268
+ [3112]: (diagnostics) => `TypeScript build failed:\n${diagnostics}`,
2269
+ [3113]: (targetPath, reason) => `Failed to write bootstrap file at ${targetPath}: ${reason}`,
2270
+ [3114]: (route, firstFile, secondFile) => `Two commands resolve to the same slash route \`${route}\`. Defined in ${firstFile} and ${secondFile}. Rename one.`,
2271
+ [3115]: (dir, reason) => `Could not read the commands directory ${dir} during codegen. ${reason}`,
2272
+ [3116]: (kind, name, firstFile, secondFile) => `Two ${kind} context-menu commands share the name \`${name}\`. Defined in ${firstFile} and ${secondFile}. Rename one.`,
2273
+ [3117]: (reason) => `Could not resolve the application from the bot token. ${reason}`,
2274
+ [3118]: () => "No guilds given. Pass --guild <ids...> or --all-guilds. Global commands are never touched.",
2275
+ [3119]: () => "--purge cannot be combined with --all-guilds. Use --guild <ids> to purge specific guilds.",
2276
+ [3120]: () => "Cancelled.",
2277
+ [3121]: (count) => `Refusing to scan ${count} guilds without confirmation. Re-run with --yes, or name specific guilds with --guild <ids>.`,
2278
+ [3122]: () => "Refusing to delete without confirmation in a non-interactive environment. Re-run with --yes.",
2279
+ [3123]: (seconds) => `cloudflared did not report a tunnel URL within ${seconds}s. Check that the binary runs and that the network allows it.`,
2280
+ [3124]: (url) => `Discord rejected ${url} as an interactions endpoint.`,
2281
+ [3125]: (url, seconds) => `${url} did not answer within ${seconds}s, so nothing was PATCHed to Discord.`,
2282
+ [3126]: (field, expected) => `Config \`${field}\` must be ${expected} when provided.`,
2303
2283
  [3201]: () => "Cancelled.",
2304
2284
  [3202]: (flag) => `The --${flag} flag does not apply to the answers you gave.`,
2305
2285
  [3203]: (flag, reason) => `--${flag}: ${reason}`,
@@ -2330,117 +2310,117 @@ function resolveMessage(code, args) {
2330
2310
  return formatSeedcordErrorMessage(code, args);
2331
2311
  }
2332
2312
  function formatErrorName(name, _identifier, code) {
2333
- return `${chalk.bold.red(name)}[${chalk.gray(code)}]`;
2313
+ return `${paint.coral.bold(name)}[${paint.mute(code)}]`;
2314
+ }
2315
+ const kIdentifier = Symbol.for("seedcord.errors.identifier");
2316
+ const CODED = Symbol.for("seedcord.errors.coded");
2317
+ function brand(prototype) {
2318
+ Object.defineProperty(prototype, CODED, { value: true });
2319
+ }
2320
+ function isCoded(error) {
2321
+ return typeof error === "object" && error !== null && CODED in error;
2334
2322
  }
2335
- /**
2336
- * Base class for Seedcord errors.
2337
- */
2338
2323
  var SeedcordError = class extends Error {
2339
2324
  code;
2340
- identifier;
2325
+ [kIdentifier];
2341
2326
  type = "SeedcordError";
2342
2327
  constructor(code, ...rest) {
2343
2328
  const { args, options } = resolveCtorInputs(rest);
2344
2329
  const message = resolveMessage(code, args);
2345
2330
  super(message, options);
2346
2331
  this.code = code;
2347
- this.identifier = resolveIdentifier(code);
2348
- this.name = formatErrorName(new.target.name, this.identifier, this.code);
2332
+ this[kIdentifier] = resolveIdentifier(code);
2333
+ this.name = formatErrorName(new.target.name, this[kIdentifier], this.code);
2349
2334
  Object.setPrototypeOf(this, new.target.prototype);
2350
2335
  if (typeof Error.captureStackTrace === "function") Error.captureStackTrace(this, new.target);
2351
2336
  }
2352
2337
  };
2353
- /**
2354
- * TypeError class for Seedcord errors.
2355
- */
2338
+ brand(SeedcordError.prototype);
2356
2339
  var SeedcordTypeError = class extends TypeError {
2357
2340
  code;
2358
- identifier;
2341
+ [kIdentifier];
2359
2342
  type = "SeedcordTypeError";
2360
2343
  constructor(code, ...rest) {
2361
2344
  const { args, options } = resolveCtorInputs(rest);
2362
2345
  const message = resolveMessage(code, args);
2363
2346
  super(message, options);
2364
2347
  this.code = code;
2365
- this.identifier = resolveIdentifier(code);
2366
- this.name = formatErrorName(new.target.name, this.identifier, this.code);
2348
+ this[kIdentifier] = resolveIdentifier(code);
2349
+ this.name = formatErrorName(new.target.name, this[kIdentifier], this.code);
2367
2350
  Object.setPrototypeOf(this, new.target.prototype);
2368
2351
  if (typeof Error.captureStackTrace === "function") Error.captureStackTrace(this, new.target);
2369
2352
  }
2370
2353
  };
2371
- /**
2372
- * RangeError class for Seedcord errors.
2373
- */
2354
+ brand(SeedcordTypeError.prototype);
2374
2355
  var SeedcordRangeError = class extends RangeError {
2375
2356
  code;
2376
- identifier;
2357
+ [kIdentifier];
2377
2358
  type = "SeedcordRangeError";
2378
2359
  constructor(code, ...rest) {
2379
2360
  const { args, options } = resolveCtorInputs(rest);
2380
2361
  const message = resolveMessage(code, args);
2381
2362
  super(message, options);
2382
2363
  this.code = code;
2383
- this.identifier = resolveIdentifier(code);
2384
- this.name = formatErrorName(new.target.name, this.identifier, this.code);
2364
+ this[kIdentifier] = resolveIdentifier(code);
2365
+ this.name = formatErrorName(new.target.name, this[kIdentifier], this.code);
2366
+ Object.setPrototypeOf(this, new.target.prototype);
2367
+ if (typeof Error.captureStackTrace === "function") Error.captureStackTrace(this, new.target);
2368
+ }
2369
+ };
2370
+ brand(SeedcordRangeError.prototype);
2371
+ var SeedcordAggregateError = class extends AggregateError {
2372
+ code;
2373
+ [kIdentifier];
2374
+ type = "SeedcordAggregateError";
2375
+ constructor(code, errors, ...rest) {
2376
+ const { args, options } = resolveCtorInputs(rest);
2377
+ const message = resolveMessage(code, args);
2378
+ super(errors, message, options);
2379
+ this.code = code;
2380
+ this[kIdentifier] = resolveIdentifier(code);
2381
+ this.name = formatErrorName(new.target.name, this[kIdentifier], this.code);
2385
2382
  Object.setPrototypeOf(this, new.target.prototype);
2386
2383
  if (typeof Error.captureStackTrace === "function") Error.captureStackTrace(this, new.target);
2387
2384
  }
2388
2385
  };
2386
+ brand(SeedcordAggregateError.prototype);
2389
2387
  /**
2390
2388
  * Determines whether an unknown value is a Seedcord error, with optional narrowing by class and error code.
2391
2389
  *
2392
2390
  * @param error - The value to inspect.
2393
- * @param type - Optional error class discriminator (Error, TypeError, or RangeError).
2391
+ * @param type - Optional error class discriminator.
2394
2392
  * @param code - Optional {@link SeedcordErrorCode} discriminator to narrow by code.
2395
2393
  * @typeParam Type - What kind of {@link SeedcordErrorTypeString} to filter by.
2396
2394
  * @typeParam Code - The specific {@link SeedcordErrorCode} to filter by.
2397
2395
  */
2398
2396
  function isSeedcordError(error, type, code) {
2399
- const isSeedcordErrorInstance = error instanceof SeedcordError && error.type === "SeedcordError";
2400
- const isSeedcordTypeErrorInstance = error instanceof SeedcordTypeError && error.type === "SeedcordTypeError";
2401
- const isSeedcordRangeErrorInstance = error instanceof SeedcordRangeError && error.type === "SeedcordRangeError";
2402
- if (!isSeedcordErrorInstance && !isSeedcordTypeErrorInstance && !isSeedcordRangeErrorInstance) return false;
2403
- if (!(type ? type === "SeedcordError" && isSeedcordErrorInstance || type === "SeedcordTypeError" && isSeedcordTypeErrorInstance || type === "SeedcordRangeError" && isSeedcordRangeErrorInstance : true)) return false;
2397
+ if (!isCoded(error)) return false;
2398
+ if (type && error.type !== type) return false;
2404
2399
  if (code === void 0) return true;
2405
- return error.code === code;
2400
+ return error[kIdentifier] === resolveIdentifier(code);
2401
+ }
2402
+
2403
+ //#endregion
2404
+ //#region src/cli/banner.ts
2405
+ function banner(version = "0.1.2-next.0") {
2406
+ const wordmark = `${paint.flesh.bold("seed")}${paint.rind.bold("cord")}${paint.mute(" create")}`;
2407
+ if (version === void 0) return wordmark;
2408
+ return `${wordmark}${paint.pith(` • v${version}`)}`;
2406
2409
  }
2407
2410
 
2408
2411
  //#endregion
2409
2412
  //#region ../../packages/errors/dist/internal.index.mjs
2410
- const BRAND = {
2411
- flesh: "#f04e36",
2412
- rind: "#6fab49",
2413
- pith: "#f8f6e8"
2414
- };
2415
- const paint = {
2416
- sky: chalk.hex("#8fc7ff"),
2417
- iris: chalk.hex("#e29bff"),
2418
- mint: chalk.hex("#66d98a"),
2419
- amber: chalk.hex("#ffc061"),
2420
- coral: chalk.hex("#ff6b85"),
2421
- flesh: chalk.hex(BRAND.flesh),
2422
- rind: chalk.hex(BRAND.rind),
2423
- pith: chalk.hex(BRAND.pith),
2424
- mute: chalk.dim
2425
- };
2413
+ const ENV_NAME = "DISCORD_BOT_TOKEN";
2426
2414
  /** @internal */
2427
2415
  function validateDiscordToken(raw) {
2428
- if (raw === null || raw === void 0) throw new SeedcordError(1001);
2429
- if (typeof raw !== "string") throw new SeedcordError(1002);
2416
+ if (raw === null || raw === void 0) throw new SeedcordError(1005, [ENV_NAME]);
2417
+ if (typeof raw !== "string") throw new SeedcordError(1006, [ENV_NAME]);
2430
2418
  const value = raw.trim();
2431
- if (value === "") throw new SeedcordError(1001);
2432
- if (!/^[A-Za-z\d_-]{24,}\.[A-Za-z\d_-]{6,}\.[A-Za-z\d_-]{27,}$/.test(value)) throw new SeedcordError(1002);
2419
+ if (value === "") throw new SeedcordError(1005, [ENV_NAME]);
2420
+ if (!/^[A-Za-z\d_-]{24,}\.[A-Za-z\d_-]{6,}\.[A-Za-z\d_-]{27,}$/.test(value)) throw new SeedcordError(1006, [ENV_NAME]);
2433
2421
  return value;
2434
2422
  }
2435
2423
 
2436
- //#endregion
2437
- //#region src/cli/banner.ts
2438
- function banner(version = "0.1.1") {
2439
- const wordmark = `${paint.flesh.bold("seed")}${paint.rind.bold("cord")}`;
2440
- if (version === void 0) return wordmark;
2441
- return `${wordmark}${paint.pith(` • v${version}`)}`;
2442
- }
2443
-
2444
2424
  //#endregion
2445
2425
  //#region src/interview/steps/requireAnswer.ts
2446
2426
  function requireAnswer(value) {