@wolfstar/cli 2.6.1 → 2.7.0-next-20261009115919
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 +6 -2
- package/dist/{_shared-CyzTojMA.js → _shared-Bqw7h4O0.js} +3 -3
- package/dist/{_shared-CyzTojMA.js.map → _shared-Bqw7h4O0.js.map} +1 -1
- package/dist/{bridge-Cbm0jX9h.js → bridge-DQ3dZ9pm.js} +2 -2
- package/dist/{bridge-Cbm0jX9h.js.map → bridge-DQ3dZ9pm.js.map} +1 -1
- package/dist/{build-BbIEbOu3.js → build-BYlgPxAE.js} +5 -5
- package/dist/{build-BbIEbOu3.js.map → build-BYlgPxAE.js.map} +1 -1
- package/dist/cli.js +1 -1
- package/dist/{codegen-C2PY7RXA.js → codegen-CiDXuBHu.js} +5 -5
- package/dist/{codegen-C2PY7RXA.js.map → codegen-CiDXuBHu.js.map} +1 -1
- package/dist/{commands-C-i3qYOz.js → commands-CURkZI0f.js} +5 -5
- package/dist/{commands-C-i3qYOz.js.map → commands-CURkZI0f.js.map} +1 -1
- package/dist/commands-Chpk8BR8.js +16 -0
- package/dist/{commands-D9i-ZgpA.js.map → commands-Chpk8BR8.js.map} +1 -1
- package/dist/commands-R2m3xweq.js +3 -0
- package/dist/{completions-DA-NZAcY.js → completions-DBipETDu.js} +3 -3
- package/dist/{completions-DA-NZAcY.js.map → completions-DBipETDu.js.map} +1 -1
- package/dist/{dev-BLlgQwl6.js → dev-GvuLQzWu.js} +10 -10
- package/dist/{dev-BLlgQwl6.js.map → dev-GvuLQzWu.js.map} +1 -1
- package/dist/{diagnostics-Dn3CXa8J.js → diagnostics-BKc--u_3.js} +5 -1
- package/dist/diagnostics-BKc--u_3.js.map +1 -0
- package/dist/{doctor-CMGfbXS5.js → doctor-C_lTMEjG.js} +28 -10
- package/dist/doctor-C_lTMEjG.js.map +1 -0
- package/dist/{hooks-D_RVS0ba.js → hooks-DqlScRZA.js} +29 -4
- package/dist/{hooks-D_RVS0ba.js.map → hooks-DqlScRZA.js.map} +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/{info-C_YDcVul.js → info-BX-As3qN.js} +5 -4
- package/dist/info-BX-As3qN.js.map +1 -0
- package/dist/{local-commands-CGBjc8KJ.js → local-commands-DkWl97zR.js} +4 -4
- package/dist/{local-commands-CGBjc8KJ.js.map → local-commands-DkWl97zR.js.map} +1 -1
- package/dist/{locales-BzyEMQnX.js → locales-CnVIXIip.js} +5 -5
- package/dist/{locales-BzyEMQnX.js.map → locales-CnVIXIip.js.map} +1 -1
- package/dist/{nitro-DufOgx8s.js → nitro-BWRIMUd8.js} +2 -2
- package/dist/{nitro-DufOgx8s.js.map → nitro-BWRIMUd8.js.map} +1 -1
- package/dist/{prepare-DKH0UIYA.js → prepare-6abxyJeD.js} +4 -4
- package/dist/{prepare-DKH0UIYA.js.map → prepare-6abxyJeD.js.map} +1 -1
- package/dist/{project-DBqQMFCk.js → project-EJyKro-M.js} +2 -2
- package/dist/{project-DBqQMFCk.js.map → project-EJyKro-M.js.map} +1 -1
- package/dist/{run-Bs6e9_6S.js → run-DlctD5rb.js} +2 -2
- package/dist/{run-Bs6e9_6S.js.map → run-DlctD5rb.js.map} +1 -1
- package/dist/{tsc-BArammxe.js → tsc-6su4cT6K.js} +3 -3
- package/dist/{tsc-BArammxe.js.map → tsc-6su4cT6K.js.map} +1 -1
- package/dist/tsc-DK53_ZWE.js +3 -0
- package/dist/{tsdown-2i5h88vT.js → tsdown-DP5VrWx4.js} +2 -2
- package/dist/{tsdown-2i5h88vT.js.map → tsdown-DP5VrWx4.js.map} +1 -1
- package/dist/{tui-BOkOx13K.js → tui-C8MjzsKS.js} +2 -2
- package/dist/{tui-BOkOx13K.js.map → tui-C8MjzsKS.js.map} +1 -1
- package/dist/{tunnel-BNV5cuJz.js → tunnel-D3WxypOt.js} +193 -93
- package/dist/tunnel-D3WxypOt.js.map +1 -0
- package/dist/{typecheck-p_2rj9lL.js → typecheck-BIscCUNQ.js} +5 -5
- package/dist/{typecheck-p_2rj9lL.js.map → typecheck-BIscCUNQ.js.map} +1 -1
- package/dist/{typechecker-C3UOI2LF.js → typechecker-zjnzC2L_.js} +4 -4
- package/dist/{typechecker-C3UOI2LF.js.map → typechecker-zjnzC2L_.js.map} +1 -1
- package/dist/{vite-C5CN3xUu.js → vite-9yEVMHY_.js} +2 -2
- package/dist/{vite-C5CN3xUu.js.map → vite-9yEVMHY_.js.map} +1 -1
- package/package.json +9 -5
- package/dist/commands-BfNA1-eZ.js +0 -3
- package/dist/commands-D9i-ZgpA.js +0 -16
- package/dist/diagnostics-Dn3CXa8J.js.map +0 -1
- package/dist/doctor-CMGfbXS5.js.map +0 -1
- package/dist/info-C_YDcVul.js.map +0 -1
- package/dist/tsc-9yHyx0L6.js +0 -3
- package/dist/tunnel-BNV5cuJz.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics-Dn3CXa8J.js","names":[],"sources":["../src/utils/diagnostics.ts"],"sourcesContent":["import { defineDiagnostics } from 'nostics';\n\n/**\n * Structured, stable diagnostic codes for everything `@wolfstar/cli` itself rejects (as opposed to `stars.config.*`\n * validation, which is `@wolfstar/http-framework`'s own {@link import('@wolfstar/schema').configDiagnostics}).\n *\n * `reporters` stays empty: `runMain` (`src/run.ts`) is the single place that renders a caught `Diagnostic` to the\n * terminal (`formatError`) and picks its exit code (`exitCodeOf`), so nothing here should print on its own — a\n * command that calls e.g. `runBuild` directly (as the test suite does) gets a plain thrown value instead of stray\n * console output.\n *\n * `why` and `fix` are always given the same, fully-typed params object, even when one of them ignores part of it or\n * neither takes any: a bare `() => value` next to a typed sibling loses nostics' param-type inference (a zero-arg\n * function widens to `unknown` params, erasing the sibling's fields from the merged type).\n */\nexport const cliDiagnostics = defineDiagnostics({\n\tdocsBase: (code) => `https://stars-components.js.org/docs/cli/errors#${code.toLowerCase()}`,\n\treporters: [],\n\tcodes: {\n\t\tPREPARE_OUTDATED: {\n\t\t\twhy: (_p: {}) => 'The generated project files are out of date, run `stars prepare` to update it.'\n\t\t},\n\t\tTSCONFIG_LEGACY_EXTENDS: {\n\t\t\twhy: (p: { file: string }) =>\n\t\t\t\t`${p.file} extends ./.stars/tsconfig.json, which \\`stars prepare\\` no longer writes from compatibility version 6`,\n\t\t\tfix: (_p: { file: string }) =>\n\t\t\t\t'Replace it with `{ \"files\": [], \"references\": [{ \"path\": \"./.stars/tsconfig.app.json\" }, { \"path\": \"./.stars/tsconfig.node.json\" }] }`, or set `future.compatibilityVersion` to 5.'\n\t\t},\n\t\tTYPECHECK_FAILED: {\n\t\t\twhy: (p: { projects: string }) => `Type errors in ${p.projects}`\n\t\t},\n\t\tTYPECHECK_NO_PROJECT: {\n\t\t\twhy: (p: { root: string }) => `No tsconfig to type-check in ${p.root}`,\n\t\t\tfix: (_p: { root: string }) => 'Create src/tsconfig.json or tsconfig.json, or set `dev.typecheck.tsconfig`.'\n\t\t},\n\t\tDISCORD_TOKEN_MISSING: {\n\t\t\twhy: (_p: {}) => 'DISCORD_TOKEN is not set',\n\t\t\tfix: (_p: {}) => 'Set DISCORD_TOKEN in the environment or in the project .env file.'\n\t\t},\n\t\tDISCORD_APPLICATION_ID_MISSING: {\n\t\t\twhy: (_p: {}) => 'The Discord application id is not set',\n\t\t\tfix: (_p: {}) => 'Set DISCORD_APPLICATION_ID (or APPLICATION_ID) in the environment or in the project .env file.'\n\t\t},\n\t\tDISCORD_REQUEST_FAILED: {\n\t\t\twhy: (p: { status: number; detail: string }) => `Discord answered ${p.status}${p.detail ? `: ${p.detail}` : ''}`,\n\t\t\tfix: (p: { status: number; detail: string }) =>\n\t\t\t\tp.status === 401 ? 'Check DISCORD_TOKEN.' : 'Check the application id and the bot permissions.'\n\t\t},\n\t\tBUILD_FAILED: {\n\t\t\twhy: (p: { message: string }) => `Build failed${p.message ? `: ${p.message}` : ''}`\n\t\t},\n\t\tCOMMAND_NOT_FOUND: {\n\t\t\twhy: (p: { names: string }) => `No deployed command is named ${p.names}`,\n\t\t\tfix: (_p: { names: string }) => 'Run `stars commands list` to see what is deployed.'\n\t\t},\n\t\tABORTED: {\n\t\t\twhy: (_p: {}) => 'Aborted'\n\t\t},\n\t\tCONFIRMATION_REQUIRED: {\n\t\t\twhy: (_p: {}) => 'Refusing to delete commands without a confirmation',\n\t\t\tfix: (_p: {}) => 'Pass --yes to delete them, or --name to pick one, from a script.'\n\t\t},\n\t\tDEPLOY_CONFIRMATION_REQUIRED: {\n\t\t\twhy: (_p: {}) => 'Refusing to overwrite the deployed commands without a confirmation',\n\t\t\tfix: (_p: {}) => 'Pass --yes to deploy from a script, or with --json.'\n\t\t},\n\t\tCOMMANDS_DIFFER: {\n\t\t\twhy: (p: { count: number }) => `${p.count} deployed command(s) differ from the ones the project defines`,\n\t\t\tfix: (_p: { count: number }) => 'Run `stars commands deploy` to deploy them.'\n\t\t},\n\t\tLOCAL_COMMANDS_UNAVAILABLE: {\n\t\t\twhy: (p: { reason: string; fix: string }) => `Could not read the commands the project defines: ${p.reason}`,\n\t\t\tfix: (p: { reason: string; fix: string }) => p.fix\n\t\t},\n\t\tDOCTOR_FAILED: {\n\t\t\twhy: (p: { count: number }) => `${p.count} check(s) failed`\n\t\t},\n\t\tUNKNOWN_SHELL: {\n\t\t\twhy: (p: { shell: string }) => `No completions for the shell \\`${p.shell}\\`.`,\n\t\t\tfix: (_p: { shell: string }) => 'Use one of: bash, zsh, fish.'\n\t\t},\n\t\tINVALID_THEME: {\n\t\t\twhy: (p: { theme: string; themes: string }) => `Unknown theme \\`${p.theme}\\`.`,\n\t\t\tfix: (p: { theme: string; themes: string }) => `Use one of: ${p.themes}.`\n\t\t},\n\t\tINVALID_OPTION: {\n\t\t\twhy: (p: { option: string; value: string; allowed: string }) => `Unknown value \\`${p.value}\\` for ${p.option}.`,\n\t\t\tfix: (p: { option: string; value: string; allowed: string }) => `Use one of: ${p.allowed}.`\n\t\t},\n\t\tCODEGEN_OUTDATED: {\n\t\t\twhy: (_p: {}) => 'Generated files are out of date, run `stars codegen` to update them.'\n\t\t},\n\t\tDEPENDENCY_MISSING: {\n\t\t\twhy: (p: { name: string; root: string; hint: string }) => `\"${p.name}\" is not installed in ${p.root}`,\n\t\t\tfix: (p: { name: string; root: string; hint: string }) => p.hint\n\t\t},\n\t\tMODULE_FAILED: {\n\t\t\twhy: (p: { module: string; reason: string; message: string }) => p.message,\n\t\t\tfix: (p: { module: string; reason: string; message: string }) => {\n\t\t\t\tswitch (p.reason) {\n\t\t\t\t\tcase 'MODULE_LOAD_FAILED':\n\t\t\t\t\t\treturn `Install \"${p.module}\" in the project, or fix its specifier in \\`modules\\` in stars.config.`;\n\t\t\t\t\tcase 'MODULE_INCOMPATIBLE':\n\t\t\t\t\t\treturn 'Update the module or @wolfstar/http-framework so their versions match.';\n\t\t\t\t\tcase 'MODULE_INVALID':\n\t\t\t\t\t\treturn 'Export the module with `defineModule` from @wolfstar/kit as the default export, and give its `meta` a `name` and, if it has a `configKey`, one that is not a built-in key of stars.config or used by another module.';\n\t\t\t\t\tcase 'MODULE_PLUGIN_INVALID':\n\t\t\t\t\t\treturn 'Pass `ctx.addPlugin` a package specifier, an absolute path or a `file:` URL, and JSON-serialisable options.';\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn 'Fix the error the module threw (see the cause), or remove it from `modules` in stars.config.';\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tMODULES_PRELOAD_REQUIRED: {\n\t\t\twhy: (p: { tool: string; plugins: string }) =>\n\t\t\t\t`The runtime plugins added by modules (${p.plugins}) are registered through \\`node --import\\` with build.tool \"${p.tool}\", which only \\`stars dev\\` does for you`,\n\t\t\tfix: (_p: { tool: string; plugins: string }) =>\n\t\t\t\t'Start the production bot with `node --import ./.stars/modules.mjs <entry>`; `stars prepare` (and `stars build`) writes that file.'\n\t\t},\n\t\tCODEGEN_FAILED: {\n\t\t\twhy: (p: { code: number | null; stderr: string }) => `i18next-type-generator exited with code ${p.code}${p.stderr ? `: ${p.stderr}` : ''}`\n\t\t}\n\t}\n});\n\nexport type CliDiagnosticCode = keyof typeof cliDiagnostics;\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAa,iBAAiB,kBAAkB;CAC/C,WAAW,SAAS,mDAAmD,KAAK,YAAY;CACxF,WAAW,CAAC;CACZ,OAAO;EACN,kBAAkB,EACjB,MAAM,OAAW,iFAClB;EACA,yBAAyB;GACxB,MAAM,MACL,GAAG,EAAE,KAAK;GACX,MAAM,OACL;EACF;EACA,kBAAkB,EACjB,MAAM,MAA4B,kBAAkB,EAAE,WACvD;EACA,sBAAsB;GACrB,MAAM,MAAwB,gCAAgC,EAAE;GAChE,MAAM,OAAyB;EAChC;EACA,uBAAuB;GACtB,MAAM,OAAW;GACjB,MAAM,OAAW;EAClB;EACA,gCAAgC;GAC/B,MAAM,OAAW;GACjB,MAAM,OAAW;EAClB;EACA,wBAAwB;GACvB,MAAM,MAA0C,oBAAoB,EAAE,SAAS,EAAE,SAAS,KAAK,EAAE,WAAW;GAC5G,MAAM,MACL,EAAE,WAAW,MAAM,yBAAyB;EAC9C;EACA,cAAc,EACb,MAAM,MAA2B,eAAe,EAAE,UAAU,KAAK,EAAE,YAAY,KAChF;EACA,mBAAmB;GAClB,MAAM,MAAyB,gCAAgC,EAAE;GACjE,MAAM,OAA0B;EACjC;EACA,SAAS,EACR,MAAM,OAAW,UAClB;EACA,uBAAuB;GACtB,MAAM,OAAW;GACjB,MAAM,OAAW;EAClB;EACA,8BAA8B;GAC7B,MAAM,OAAW;GACjB,MAAM,OAAW;EAClB;EACA,iBAAiB;GAChB,MAAM,MAAyB,GAAG,EAAE,MAAM;GAC1C,MAAM,OAA0B;EACjC;EACA,4BAA4B;GAC3B,MAAM,MAAuC,oDAAoD,EAAE;GACnG,MAAM,MAAuC,EAAE;EAChD;EACA,eAAe,EACd,MAAM,MAAyB,GAAG,EAAE,MAAM,kBAC3C;EACA,eAAe;GACd,MAAM,MAAyB,kCAAkC,EAAE,MAAM;GACzE,MAAM,OAA0B;EACjC;EACA,eAAe;GACd,MAAM,MAAyC,mBAAmB,EAAE,MAAM;GAC1E,MAAM,MAAyC,eAAe,EAAE,OAAO;EACxE;EACA,gBAAgB;GACf,MAAM,MAA0D,mBAAmB,EAAE,MAAM,SAAS,EAAE,OAAO;GAC7G,MAAM,MAA0D,eAAe,EAAE,QAAQ;EAC1F;EACA,kBAAkB,EACjB,MAAM,OAAW,uEAClB;EACA,oBAAoB;GACnB,MAAM,MAAoD,IAAI,EAAE,KAAK,wBAAwB,EAAE;GAC/F,MAAM,MAAoD,EAAE;EAC7D;EACA,eAAe;GACd,MAAM,MAA2D,EAAE;GACnE,MAAM,MAA2D;IAChE,QAAQ,EAAE,QAAV;KACC,KAAK,sBACJ,OAAO,YAAY,EAAE,OAAO;KAC7B,KAAK,uBACJ,OAAO;KACR,KAAK,kBACJ,OAAO;KACR,KAAK,yBACJ,OAAO;KACR,SACC,OAAO;IACT;GACD;EACD;EACA,0BAA0B;GACzB,MAAM,MACL,yCAAyC,EAAE,QAAQ,8DAA8D,EAAE,KAAK;GACzH,MAAM,OACL;EACF;EACA,gBAAgB,EACf,MAAM,MAA+C,2CAA2C,EAAE,OAAO,EAAE,SAAS,KAAK,EAAE,WAAW,KACvI;CACD;AACD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"doctor-CMGfbXS5.js","names":[],"sources":["../src/commands/doctor.ts"],"sourcesContent":["import { displayPath, type ResolvedStarsConfig } from '@wolfstar/schema';\nimport { defineCommand } from 'citty';\nimport { createColors } from 'colorette';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { createServer } from 'node:net';\nimport { delimiter, join } from 'node:path';\nimport { BRIDGE_FRAMEWORK_VERSION, isAtLeast } from '../dev/bridge.js';\nimport { endpointUrl, readDiscordCredentials } from '../dev/tunnel.js';\nimport { projectArgs, resolveCwd, type ProjectArgs } from '../utils/args.js';\nimport { cliDiagnostics } from '../utils/diagnostics.js';\nimport { loadProject, withProjectEnv, applyEnvOptions, type StarsHookable } from '../utils/hooks.js';\nimport { modulesPreloadWarning } from '../utils/modules.js';\nimport { shouldUseColor } from '../utils/output-mode.js';\nimport { findLegacyRootTsconfig } from '../utils/tsconfig.js';\nimport { readProjectEnv } from '../utils/project-env.js';\nimport { findInstalledVersion } from '../utils/project.js';\nimport { readOwnPackageJson } from '../utils/version.js';\nimport { prepareProject } from './_shared.js';\n\nexport type CheckStatus = 'ok' | 'info' | 'warn' | 'error';\n\nexport interface Check {\n\tname: string;\n\tstatus: CheckStatus;\n\tmessage: string;\n\t/** What to do about it. */\n\tfix?: string;\n}\n\nexport interface DoctorOptions extends ProjectArgs {\n\tjson?: boolean;\n\t/** Also asks Discord whether the token works and where the application's interactions go. */\n\tonline?: boolean;\n\tstdout?: NodeJS.WritableStream;\n\t/** Overrides for tests. */\n\tenv?: NodeJS.ProcessEnv;\n\tnodeVersion?: string;\n\tfetch?: typeof fetch;\n\tisPortFree?: (port: number, host: string) => Promise<boolean>;\n}\n\n/** The Node.js versions `@wolfstar/cli` runs on (`engines.node` of its `package.json`). */\nconst MINIMUM_NODE = 22;\n\n/**\n * Checks what a project needs before `stars dev` can do its job: the runtime, the framework, the credentials, the\n * interactions endpoint and the generated files. Each check says what is wrong and what to do about it; nothing is\n * changed.\n */\nexport async function collectChecks(config: ResolvedStarsConfig, hooks: StarsHookable, options: DoctorOptions = {}): Promise<Check[]> {\n\tconst env = options.env ?? process.env;\n\tconst checks: Check[] = [];\n\tconst show = (path: string) => displayPath(config.root, path);\n\n\tconst node = options.nodeVersion ?? process.version;\n\tconst major = Number.parseInt(node.replace(/^v/, ''), 10);\n\tchecks.push(\n\t\tmajor >= MINIMUM_NODE\n\t\t\t? { name: 'node', status: 'ok', message: `Node.js ${node}` }\n\t\t\t: { name: 'node', status: 'error', message: `Node.js ${node} is too old`, fix: `Use Node.js ${MINIMUM_NODE} or later.` }\n\t);\n\tconst wanted = readEnginesNode(config.root);\n\tconst minimum = wanted === null ? null : /^\\s*>=\\s*(\\d+)/.exec(wanted);\n\tif (minimum && major < Number(minimum[1])) {\n\t\tchecks.push({\n\t\t\tname: 'engines',\n\t\t\tstatus: 'warn',\n\t\t\tmessage: `The project asks for Node.js ${wanted}, this is ${node}`,\n\t\t\tfix: `Use Node.js ${wanted}.`\n\t\t});\n\t}\n\n\tchecks.push({ name: 'config', status: 'ok', message: config.configFile ? show(config.configFile) : 'no stars.config, running on defaults' });\n\tfor (const warning of [...config.warnings, modulesPreloadWarning(config)]) {\n\t\tif (warning) checks.push({ name: 'config', status: 'warn', message: warning.message, ...(warning.fix ? { fix: warning.fix } : {}) });\n\t}\n\n\tconst framework = findInstalledVersion(config.root, '@wolfstar/http-framework');\n\tif (framework === null) {\n\t\tchecks.push({\n\t\t\tname: 'framework',\n\t\t\tstatus: 'error',\n\t\t\tmessage: '@wolfstar/http-framework is not installed',\n\t\t\tfix: 'Install @wolfstar/http-framework in the project.'\n\t\t});\n\t} else if (isAtLeast(framework, BRIDGE_FRAMEWORK_VERSION)) {\n\t\tchecks.push({ name: 'framework', status: 'ok', message: `@wolfstar/http-framework v${framework}` });\n\t} else {\n\t\tchecks.push({\n\t\t\tname: 'framework',\n\t\t\tstatus: 'warn',\n\t\t\tmessage: `@wolfstar/http-framework v${framework} cannot report to the dev UI`,\n\t\t\tfix: `Update to ${BRIDGE_FRAMEWORK_VERSION} or later for the hmr, commands, interactions and http channels.`\n\t\t});\n\t}\n\n\tchecks.push({ name: 'entry', status: 'ok', message: `${show(config.entry)} (${config.build.tool})` });\n\tif (config.build.tool !== 'none' && !existsSync(config.build.output)) {\n\t\tchecks.push({\n\t\t\tname: 'build',\n\t\t\tstatus: 'info',\n\t\t\tmessage: `${show(config.build.output)} is not built yet`,\n\t\t\tfix: 'Run `stars build` (or `stars dev`).'\n\t\t});\n\t}\n\n\tconst values = { ...readProjectEnv(config), ...definedOnly(env), ...config.dev.env };\n\tconst credentials = readDiscordCredentials(config, env);\n\tchecks.push(\n\t\tcredentials\n\t\t\t? { name: 'token', status: 'ok', message: 'DISCORD_TOKEN is set' }\n\t\t\t: {\n\t\t\t\t\tname: 'token',\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'DISCORD_TOKEN is not set',\n\t\t\t\t\tfix: 'Set DISCORD_TOKEN in the environment or in the project .env file.'\n\t\t\t\t}\n\t);\n\tchecks.push(\n\t\tvalues.DISCORD_PUBLIC_KEY\n\t\t\t? { name: 'public key', status: 'ok', message: 'DISCORD_PUBLIC_KEY is set' }\n\t\t\t: {\n\t\t\t\t\tname: 'public key',\n\t\t\t\t\tstatus: 'warn',\n\t\t\t\t\tmessage: 'DISCORD_PUBLIC_KEY is not set',\n\t\t\t\t\tfix: 'Set it in the project .env file, unless the bot passes `discordPublicKey` to its Client.'\n\t\t\t\t}\n\t);\n\tif (credentials && !credentials.applicationId) {\n\t\tchecks.push({\n\t\t\tname: 'application',\n\t\t\tstatus: 'warn',\n\t\t\tmessage: 'The Discord application id is not set',\n\t\t\tfix: 'Set DISCORD_APPLICATION_ID for `stars commands`.'\n\t\t});\n\t}\n\n\tif (config.dev.url) {\n\t\tconst url = new URL(config.dev.url);\n\t\tconst port = Number(url.port || (url.protocol === 'https:' ? 443 : 80));\n\t\tconst free = await (options.isPortFree ?? isPortFree)(port, url.hostname);\n\t\tchecks.push(\n\t\t\tfree\n\t\t\t\t? { name: 'port', status: 'ok', message: `${config.dev.url} is free` }\n\t\t\t\t: {\n\t\t\t\t\t\tname: 'port',\n\t\t\t\t\t\tstatus: 'warn',\n\t\t\t\t\t\tmessage: `Something already listens on ${config.dev.url}`,\n\t\t\t\t\t\tfix: 'Stop it, or set another HTTP_PORT, unless it is this bot running.'\n\t\t\t\t\t}\n\t\t);\n\t}\n\n\tconst { tunnel } = config.dev;\n\tif (tunnel.mode === 'off') {\n\t\tchecks.push({\n\t\t\tname: 'tunnel',\n\t\t\tstatus: 'info',\n\t\t\tmessage: 'No tunnel: Discord cannot reach a bot on localhost',\n\t\t\tfix: 'Set `dev.tunnel: true` for a cloudflared quick tunnel, or press t in `stars dev`.'\n\t\t});\n\t} else if (tunnel.mode === 'quick') {\n\t\tchecks.push(\n\t\t\tfindOnPath('cloudflared', env)\n\t\t\t\t? { name: 'tunnel', status: 'ok', message: 'cloudflared quick tunnel' }\n\t\t\t\t: { name: 'tunnel', status: 'info', message: 'cloudflared is not on the PATH: it is downloaded the first time the tunnel opens' }\n\t\t);\n\t} else {\n\t\tchecks.push({ name: 'tunnel', status: 'ok', message: tunnel.url });\n\t}\n\n\ttry {\n\t\tconst prepared = await prepareProject(config, hooks, true);\n\t\tconst stale = [\n\t\t\t...prepared.tsconfigs.filter((file) => file.status === 'outdated').map((file) => show(file.path)),\n\t\t\tprepared.status === 'outdated' ? show(prepared.dts) : null,\n\t\t\tprepared.modules?.status === 'outdated' ? show(prepared.modules.path) : null\n\t\t].filter((path) => path !== null);\n\t\tchecks.push(\n\t\t\tstale.length === 0\n\t\t\t\t? { name: 'prepare', status: 'ok', message: 'The generated files are up to date' }\n\t\t\t\t: { name: 'prepare', status: 'warn', message: `Out of date: ${stale.join(', ')}`, fix: 'Run `stars prepare`.' }\n\t\t);\n\t\tconst legacy = await findLegacyRootTsconfig(config);\n\t\tif (legacy) checks.push({ name: 'tsconfig', status: 'warn', message: legacy.message, ...(legacy.fix ? { fix: legacy.fix } : {}) });\n\t} catch (error) {\n\t\tchecks.push({ name: 'prepare', status: 'error', message: error instanceof Error ? error.message : String(error) });\n\t}\n\n\tif (options.online && credentials) checks.push(await checkApplication(credentials.token, config, options.fetch ?? fetch));\n\treturn checks;\n}\n\n/** Asks Discord who the token belongs to and where it sends interactions: the one thing only Discord knows. */\nasync function checkApplication(token: string, config: ResolvedStarsConfig, request: typeof fetch): Promise<Check> {\n\ttry {\n\t\tconst response = await request('https://discord.com/api/v10/applications/@me', {\n\t\t\theaders: { authorization: `Bot ${token}` },\n\t\t\tsignal: AbortSignal.timeout(10_000)\n\t\t});\n\t\tif (!response.ok) {\n\t\t\treturn {\n\t\t\t\tname: 'discord',\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: `Discord answered ${response.status}`,\n\t\t\t\tfix: response.status === 401 ? 'Check DISCORD_TOKEN.' : 'Try again later.'\n\t\t\t};\n\t\t}\n\n\t\tconst application = (await response.json()) as { name?: string; interactions_endpoint_url?: string | null };\n\t\tconst endpoint = application.interactions_endpoint_url;\n\t\tconst name = application.name ?? 'the application';\n\t\tif (!endpoint) {\n\t\t\treturn {\n\t\t\t\tname: 'discord',\n\t\t\t\tstatus: 'warn',\n\t\t\t\tmessage: `${name} has no interactions endpoint URL`,\n\t\t\t\tfix: 'Set `dev.tunnel.updateEndpoint: true`, or set it in the Discord developer portal.'\n\t\t\t};\n\t\t}\n\n\t\tconst tunnel = config.dev.tunnel;\n\t\t// The whole endpoint: the same origin with another path, or a host that merely starts the same, is elsewhere.\n\t\tconst expected = tunnel.mode === 'url' ? endpointUrl(tunnel.url, tunnel.path) : null;\n\t\tif (expected !== null && normalizeUrl(endpoint) !== normalizeUrl(expected)) {\n\t\t\treturn {\n\t\t\t\tname: 'discord',\n\t\t\t\tstatus: 'warn',\n\t\t\t\tmessage: `${name} sends interactions to ${endpoint}, not to ${expected}`,\n\t\t\t\tfix: 'Set `dev.tunnel.updateEndpoint: true`, or update it in the Discord developer portal.'\n\t\t\t};\n\t\t}\n\n\t\treturn { name: 'discord', status: 'ok', message: `${name} sends interactions to ${endpoint}` };\n\t} catch (error) {\n\t\treturn { name: 'discord', status: 'warn', message: `Could not reach Discord: ${error instanceof Error ? error.message : String(error)}` };\n\t}\n}\n\n/** A URL without the difference a trailing slash makes, or the text itself when it is not one. */\nfunction normalizeUrl(url: string): string {\n\ttry {\n\t\tconst parsed = new URL(url);\n\t\treturn `${parsed.origin}${parsed.pathname.replace(/\\/+$/, '')}${parsed.search}`;\n\t} catch {\n\t\treturn url;\n\t}\n}\n\nfunction readEnginesNode(root: string): string | null {\n\ttry {\n\t\tconst parsed = JSON.parse(readFileSync(join(root, 'package.json'), 'utf-8')) as { engines?: { node?: unknown } };\n\t\treturn typeof parsed.engines?.node === 'string' ? parsed.engines.node : null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction definedOnly(env: NodeJS.ProcessEnv): Record<string, string> {\n\treturn Object.fromEntries(Object.entries(env).filter((entry): entry is [string, string] => entry[1] !== undefined));\n}\n\nfunction findOnPath(binary: string, env: NodeJS.ProcessEnv): boolean {\n\tconst extensions = process.platform === 'win32' ? ['.exe', '.cmd', ''] : [''];\n\treturn (env.PATH ?? '')\n\t\t.split(delimiter)\n\t\t.filter(Boolean)\n\t\t.some((directory) => extensions.some((extension) => existsSync(join(directory, `${binary}${extension}`))));\n}\n\n/** Whether nothing listens on `host:port`: the port is bound for an instant and released. */\nfunction isPortFree(port: number, host: string): Promise<boolean> {\n\treturn new Promise((resolve) => {\n\t\tconst server = createServer();\n\t\tserver.once('error', () => resolve(false));\n\t\tserver.listen({ port, host, exclusive: true }, () => server.close(() => resolve(true)));\n\t});\n}\n\nconst SYMBOLS: Record<CheckStatus, string> = { ok: '✔', info: 'ℹ', warn: '⚠', error: '✖' };\n\nexport function formatChecks(checks: readonly Check[], useColor: boolean): string {\n\tconst colors = createColors({ useColor });\n\tconst paint = { ok: colors.green, info: colors.cyan, warn: colors.yellow, error: colors.red };\n\tconst width = Math.max(...checks.map((check) => check.name.length));\n\tconst lines = checks.flatMap((check) => [\n\t\t` ${paint[check.status](SYMBOLS[check.status])} ${colors.dim(check.name.padEnd(width))} ${check.message}`,\n\t\t...(check.fix ? [` ${' '.repeat(width)} ${colors.dim(`→ ${check.fix}`)}`] : [])\n\t]);\n\tconst count = (status: CheckStatus) => checks.filter((check) => check.status === status).length;\n\tconst summary = count('error') > 0 ? colors.red(`${count('error')} error(s)`) : colors.green('no errors');\n\treturn [\n\t\tcolors.bold(`stars doctor ${colors.dim(`v${readOwnPackageJson().version}`)}`),\n\t\t...lines,\n\t\t'',\n\t\t` ${summary}, ${count('warn')} warning(s)`\n\t].join('\\n');\n}\n\nexport async function runDoctor(options: DoctorOptions): Promise<void> {\n\tconst stdout = options.stdout ?? process.stdout;\n\tconst project = await loadProject({ cwd: resolveCwd(options), configFile: options.config });\n\t// What `stars dev` would run with: `env:options` and varlock may change the port and the credentials.\n\tconst config = withProjectEnv(await applyEnvOptions(project.config, project.hooks));\n\tconst checks = await collectChecks(config, project.hooks, options);\n\tconst errors = checks.filter((check) => check.status === 'error').length;\n\n\tstdout.write(`${options.json ? JSON.stringify({ ok: errors === 0, checks }, null, 2) : formatChecks(checks, shouldUseColor())}\\n`);\n\tif (errors > 0) throw cliDiagnostics.DOCTOR_FAILED({ count: errors });\n}\n\nexport default defineCommand({\n\tmeta: {\n\t\tname: 'doctor',\n\t\tdescription: 'Check that the project is ready for `stars dev`: runtime, framework, credentials, endpoint, generated files'\n\t},\n\targs: {\n\t\t...projectArgs,\n\t\tjson: {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Print machine-readable JSON',\n\t\t\tdefault: false\n\t\t},\n\t\tonline: {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Also ask Discord whether the token works and where the application sends interactions',\n\t\t\tdefault: false\n\t\t}\n\t},\n\tasync run({ args }) {\n\t\tawait runDoctor({ config: args.config, cwd: args.cwd, json: args.json, online: args.online });\n\t}\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AA0CA,MAAM,eAAe;;;;;;AAOrB,eAAsB,cAAc,QAA6B,OAAsB,UAAyB,CAAC,GAAqB;CACrI,MAAM,MAAM,QAAQ,OAAO,QAAQ;CACnC,MAAM,SAAkB,CAAC;CACzB,MAAM,QAAQ,SAAiB,YAAY,OAAO,MAAM,IAAI;CAE5D,MAAM,OAAO,QAAQ,eAAe,QAAQ;CAC5C,MAAM,QAAQ,OAAO,SAAS,KAAK,QAAQ,MAAM,EAAE,GAAG,EAAE;CACxD,OAAO,KACN,SAAS,eACN;EA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,QAAQ,KAAK;EAAO,CAAC;CAC7F;AACD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"info-C_YDcVul.js","names":[],"sources":["../src/commands/info.ts"],"sourcesContent":["import { displayPath, type ResolvedStarsConfig, type StarsEnvSetupOptions } from '@wolfstar/schema';\nimport { defineCommand } from 'citty';\nimport { createColors } from 'colorette';\nimport { arch, platform } from 'node:os';\nimport { relative } from 'node:path';\nimport { projectArgs, resolveCwd, type ProjectArgs } from '../utils/args.js';\nimport { applyEnvOptions, loadProject } from '../utils/hooks.js';\nimport { modulesPreloadWarning } from '../utils/modules.js';\nimport { resolveOutputMode, shouldUseColor } from '../utils/output-mode.js';\nimport { findInstalledVersion } from '../utils/project.js';\nimport { readOwnPackageJson } from '../utils/version.js';\n\nexport interface InfoOptions extends ProjectArgs {\n\tjson?: boolean;\n\tstdout?: NodeJS.WritableStream;\n}\n\nexport interface ProjectInfo {\n\tcli: { version: string; node: string; platform: string; outputMode: 'tui' | 'plain' };\n\tproject: {\n\t\tcwd: string;\n\t\troot: string;\n\t\tconfigFile: string | null;\n\t\tname: string | null;\n\t\tversion: string | null;\n\t\tentry: string;\n\t\tframeworkVersion: string | null;\n\t};\n\tbuild: ResolvedStarsConfig['build'];\n\tdev: ResolvedStarsConfig['dev'];\n\tcodegen: ResolvedStarsConfig['codegen'];\n\timports: ResolvedStarsConfig['imports'];\n\texperimental: ResolvedStarsConfig['experimental'];\n\tfuture: ResolvedStarsConfig['future'];\n\tenv: ResolvedStarsConfig['env'];\n\t/** The names of the hooks registered in `stars.config`, flattened (`build:done`). */\n\thooks: string[];\n\t/** The installed modules, and the runtime plugins they registered (`module → export from package`). */\n\tmodules: { installed: string[]; plugins: string[] };\n\t/** Non-fatal configuration diagnostics, as `CODE: message`. */\n\twarnings: string[];\n\t/**\n\t * The option names set in the `tsdown`/`vite` blocks. Only the names: the values hold plugins and callbacks,\n\t * which neither serialize to JSON nor read usefully on a terminal.\n\t */\n\toptions: { tsdown: string[]; vite: string[] };\n}\n\nexport function collectInfo(config: ResolvedStarsConfig): ProjectInfo {\n\treturn {\n\t\tcli: {\n\t\t\tversion: readOwnPackageJson().version,\n\t\t\tnode: process.version,\n\t\t\tplatform: `${platform()} ${arch()}`,\n\t\t\toutputMode: resolveOutputMode()\n\t\t},\n\t\tproject: {\n\t\t\tcwd: config.cwd,\n\t\t\troot: config.root,\n\t\t\tconfigFile: config.configFile,\n\t\t\tname: config.packageJson?.name ?? null,\n\t\t\tversion: config.packageJson?.version ?? null,\n\t\t\tentry: config.entry,\n\t\t\tframeworkVersion: findInstalledVersion(config.root, '@wolfstar/http-framework')\n\t\t},\n\t\tbuild: config.build,\n\t\tdev: config.dev,\n\t\tcodegen: config.codegen,\n\t\timports: config.imports,\n\t\texperimental: config.experimental,\n\t\tfuture: config.future,\n\t\tenv: config.env,\n\t\thooks: Object.keys(config.hooks),\n\t\tmodules: {\n\t\t\tinstalled: (config.runtime?.modules ?? []).map((module) => module.name),\n\t\t\tplugins: (config.runtime?.plugins ?? []).map((plugin) => `${plugin.module} → ${plugin.export} from ${plugin.from}`)\n\t\t},\n\t\twarnings: [...config.warnings, modulesPreloadWarning(config)]\n\t\t\t.filter((warning) => warning !== null)\n\t\t\t.map((warning) => `${warning.code}: ${warning.message}`),\n\t\toptions: { tsdown: Object.keys(config.tsdown), vite: Object.keys(config.vite) }\n\t};\n}\n\nexport function formatInfo(info: ProjectInfo, useColor: boolean): string {\n\tconst colors = createColors({ useColor });\n\tconst { root } = info.project;\n\tconst show = (path: string | null) => (path === null ? colors.dim('none') : displayPath(root, path));\n\tconst row = (label: string, value: string) => ` ${colors.dim(label.padEnd(12))}${value}`;\n\tconst section = (title: string, rows: string[]) => [colors.bold(title), ...rows].join('\\n');\n\n\treturn [\n\t\tsection(`stars ${colors.green(`v${info.cli.version}`)}`, [\n\t\t\trow('node', info.cli.node),\n\t\t\trow('platform', info.cli.platform),\n\t\t\trow('output', info.cli.outputMode),\n\t\t\trow(\n\t\t\t\t'framework',\n\t\t\t\tinfo.project.frameworkVersion\n\t\t\t\t\t? `@wolfstar/http-framework v${info.project.frameworkVersion}`\n\t\t\t\t\t: colors.yellow('@wolfstar/http-framework not installed')\n\t\t\t)\n\t\t]),\n\t\tsection('Project', [\n\t\t\trow(\n\t\t\t\t'name',\n\t\t\t\tinfo.project.name\n\t\t\t\t\t? `${info.project.name}${info.project.version ? colors.dim(` v${info.project.version}`) : ''}`\n\t\t\t\t\t: colors.dim('unnamed')\n\t\t\t),\n\t\t\trow('root', root),\n\t\t\trow(\n\t\t\t\t'config',\n\t\t\t\tinfo.project.configFile ? relative(root, info.project.configFile) || info.project.configFile : colors.dim('none (defaults)')\n\t\t\t),\n\t\t\trow('entry', show(info.project.entry))\n\t\t]),\n\t\tsection('Build', [\n\t\t\trow('tool', info.build.tool),\n\t\t\t// Which file the build tool is configured from: its own, or this project's `stars.config`.\n\t\t\trow('config', info.build.configFile ? show(info.build.configFile) : colors.dim('stars.config')),\n\t\t\trow('options', describeOptions(info, colors)),\n\t\t\trow('outDir', show(info.build.outDir)),\n\t\t\trow('tsconfig', show(info.build.tsconfig)),\n\t\t\t// Everything `stars typecheck` checks: the generated app and node projects from compatibility version 6 (a `tsc`\n\t\t\t// or `none` project keeps its own tsconfig for the bot and gets the node one on top).\n\t\t\trow('typechecks', info.dev.typecheck.projects.length > 0 ? info.dev.typecheck.projects.map(show).join(', ') : colors.dim('none')),\n\t\t\trow('runs', show(info.build.output))\n\t\t]),\n\t\tsection('Dev', [\n\t\t\trow('watch', info.dev.watch.map(show).join(', ')),\n\t\t\trow('debounce', `${info.dev.debounce}ms`),\n\t\t\trow('node args', info.dev.nodeArgs.join(' ') || colors.dim('none')),\n\t\t\trow('args', info.dev.args.join(' ') || colors.dim('none')),\n\t\t\trow('url', info.dev.url ?? colors.dim('unknown, set dev.url or HTTP_PORT')),\n\t\t\trow('health', info.dev.health ?? colors.dim('none')),\n\t\t\trow(\n\t\t\t\t'typecheck',\n\t\t\t\tinfo.dev.typecheck.enabled ? `${info.dev.typecheck.checker} → ${show(info.dev.typecheck.tsconfig)}` : colors.dim('disabled')\n\t\t\t),\n\t\t\trow('tunnel', describeTunnel(info.dev.tunnel, colors)),\n\t\t\trow('log file', info.dev.logFile ? show(info.dev.logFile) : colors.dim('disabled')),\n\t\t\trow('log dir', info.dev.logs.dir ? `${show(info.dev.logs.dir)} (keeps ${info.dev.logs.keep})` : colors.dim('disabled')),\n\t\t\trow('layout', info.dev.layout),\n\t\t\trow('mouse', info.dev.mouse ? 'clickable dashboard' : colors.dim('left to the terminal')),\n\t\t\trow('channels', info.dev.logs.channels?.join(', ') ?? colors.dim('all')),\n\t\t\trow('levels', info.dev.logs.levels.join(', ')),\n\t\t\trow('commands', `refresh: ${info.dev.commands.refresh}`),\n\t\t\trow('hmr', info.dev.hmr ? 'left to the bot when it hot reloads' : colors.dim('always restart'))\n\t\t]),\n\t\tsection('Codegen', [\n\t\t\trow('i18n', info.codegen.i18n ? `${show(info.codegen.i18n.locales)} → ${show(info.codegen.i18n.output)}` : colors.dim('disabled')),\n\t\t\trow('commands', info.codegen.commands ? show(info.codegen.commands.output) : colors.dim('disabled'))\n\t\t]),\n\t\tsection('Future', [\n\t\t\trow('compat', `v${info.future.compatibilityVersion} defaults`),\n\t\t\t...info.warnings.map((warning) => row('warning', colors.yellow(warning)))\n\t\t]),\n\t\tsection('Env', [row('register', info.env.enabled ? colors.green(describeEnvOptions(info.env.options)) : colors.dim('disabled'))]),\n\t\tsection('Hooks', [row('registered', info.hooks.join(', ') || colors.dim('none'))]),\n\t\tsection('Modules', [\n\t\t\trow('installed', info.modules.installed.join(', ') || colors.dim('none')),\n\t\t\t...info.modules.plugins.map((plugin) => row('plugin', plugin))\n\t\t]),\n\t\tsection('Experimental', [\n\t\t\trow('vite', flag(info.experimental.enableVite, colors)),\n\t\t\trow('nitro', flag(info.experimental.enableNitro, colors)),\n\t\t\t...(info.experimental.enableNitro ? [row('nitro preset', info.experimental.nitro.preset)] : []),\n\t\t\trow('external', flag(info.experimental.enableExternalVite, colors))\n\t\t]),\n\t\tsection('Imports', [\n\t\t\trow('auto', info.imports.enabled ? colors.green('enabled') : colors.dim('disabled')),\n\t\t\trow('dirs', info.imports.dirs.map(show).join(', ')),\n\t\t\trow('presets', info.imports.presets.join(', ') || colors.dim('none')),\n\t\t\trow('dts', show(info.imports.dts))\n\t\t])\n\t].join('\\n\\n');\n}\n\nfunction describeOptions(info: ProjectInfo, colors: ReturnType<typeof createColors>): string {\n\tconst names = info.build.tool === 'vite' ? info.options.vite : info.options.tsdown;\n\treturn names.length > 0 ? names.join(', ') : colors.dim('none');\n}\n\nfunction describeEnvOptions(options: Readonly<StarsEnvSetupOptions>): string {\n\tconst entries = Object.entries(options).map(([key, value]) => `${key} ${String(value)}`);\n\treturn entries.length > 0 ? `enabled (${entries.join(', ')})` : 'enabled';\n}\n\nfunction flag(enabled: boolean, colors: ReturnType<typeof createColors>): string {\n\treturn enabled ? colors.green('enabled') : colors.dim('disabled');\n}\n\nfunction describeTunnel(tunnel: ResolvedStarsConfig['dev']['tunnel'], colors: ReturnType<typeof createColors>): string {\n\tswitch (tunnel.mode) {\n\t\tcase 'quick':\n\t\t\treturn 'cloudflared quick tunnel';\n\t\tcase 'url':\n\t\t\treturn tunnel.url;\n\t\tdefault:\n\t\t\treturn colors.dim('disabled');\n\t}\n}\n\nexport async function runInfo(options: InfoOptions): Promise<void> {\n\tconst stdout = options.stdout ?? process.stdout;\n\tconst project = await loadProject({ cwd: resolveCwd(options), configFile: options.config });\n\t// What the build would use: `env:options` may change the env files.\n\tconst config = await applyEnvOptions(project.config, project.hooks);\n\tconst info = collectInfo(config);\n\tstdout.write(`${options.json ? JSON.stringify(info, null, 2) : formatInfo(info, shouldUseColor())}\\n`);\n}\n\nexport default defineCommand({\n\tmeta: {\n\t\tname: 'info',\n\t\tdescription: 'Print the resolved project configuration and environment'\n\t},\n\targs: {\n\t\t...projectArgs,\n\t\tjson: {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Print machine-readable JSON',\n\t\t\tdefault: false\n\t\t}\n\t},\n\tasync run({ args }) {\n\t\tawait runInfo({ config: args.config, cwd: args.cwd, json: args.json });\n\t}\n});\n"],"mappings":";;;;;;;;;;;AAgDA,SAAgB,YAAY,QAA0C;CACrE,OAAO;EACN,KAAK;GACJ,SAAS,mBAAmB,CAAC,CAAC;GAC9B,MAAM,QAAQ;GACd,UAAU,GAAG,SAAS,EAAE,GAAG,KAAK;GAChC,YAAY,kBAAkB;EAC/B;EACA,SAAS;GACR,KAAK,OAAO;GACZ,MAAM,OAAO;GACb,YAAY,OAAO;GACnB,MAAM,OAAO,aAAa,QAAQ;GAClC,SAAS,OAAO,aAAa,WAAW;GACxC,OAAO,OAAO;GACd,kBAAkB,qBAAqB,OAAO,MAAM,0BAA0B;EAC/E;EACA,OAAO,OAAO;EACd,KAAK,OAAO;EACZ,SAAS,OAAO;EAChB,SAAS,OAAO;EAChB,cAAc,OAAO;EACrB,QAAQ,OAAO;EACf,KAAK,OAAO;EACZ,OAAO,OAAO,KAAK,OAAO,KAAK;EAC/B,SAAS;GACR,YAAY,OAAO,SAAS,WAAW,CAAC,EAAC,CAAE,KAAK,WAAW,OAAO,IAAI;GACtE,UAAU,OAAO,SAAS,WAAW,CAAC,EAAC,CAAE,KAAK,WAAW,GAAG,OAAO,OAAO,KAAK,OAAO,OAAO,QAAQ,OAAO,MAAM;EACnH;EACA,UAAU,CAAC,GAAG,OAAO,UAAU,sBAAsB,MAAM,CAAC,CAAC,CAC3D,QAAQ,YAAY,YAAY,IAAI,CAAC,CACrC,KAAK,YAAY,GAAG,QAAQ,KAAK,IAAI,QAAQ,SAAS;EACxD,SAAS;GAAE,QAAQ,OAAO,KAAK,OAAO,MAAM;GAAG,MAAM,OAAO,KAAK,OAAO,IAAI;EAAE;CAC/E;AACD;AAEA,SAAgB,WAAW,MAAmB,UAA2B;CACxE,MAAM,SAAS,aAAa,EAAE,SAAS,CAAC;CAC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zC,MAAM,UAAU,MAAM,YAAY;EAAE,KAAK,WAAW,OAAO;EAAG,YAAY,QAAQ;CAAO,CAAC;CAG1F,MAAM,OAAO,YAAY,MADJ,gBAAgB,QAAQ,QAAQ,QAAQ,KAAK,CACnC;CAC/B,OAAO,MAAM,GAAG,QAAQ,OAAO,KAAK,UAAU,MAAM,MAAM,CAAC,IAAI,WAAW,MAAM,eAAe,CAAC,EAAE,GAAG;AACtG;AAEA,mBAAe,cAAc;CAC5B,MAAM;EACL,MAAM;EACN,aAAa;CACd;CACA,MAAM;EACL,GAAG;EACH,MAAM;GACL,MAAM;GACN,aAAa;GACb,SAAS;EACV;CACD;CACA,MAAM,IAAI,EAAE,QAAQ;EACnB,MAAM,QAAQ;GAAE,QAAQ,KAAK;GAAQ,KAAK,KAAK;GAAK,MAAM,KAAK;EAAK,CAAC;CACtE;AACD,CAAC"}
|
package/dist/tsc-9yHyx0L6.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tunnel-BNV5cuJz.js","names":[],"sources":["../src/dev/tunnel.ts"],"sourcesContent":["import type { ResolvedStarsConfig, ResolvedTunnelConfig } from '@wolfstar/schema';\nimport { readProjectEnv } from '../utils/project-env.js';\nimport { EventEmitter } from 'node:events';\nimport { startTunnel, type Tunnel as UntunTunnel } from 'untun';\nimport type { LogLevel } from '../utils/log-buffer.js';\n\nexport type TunnelState = 'off' | 'starting' | 'up' | 'failed';\n\nconst SIGNALS = ['SIGINT', 'SIGTERM', 'SIGHUP'] as const;\n\nfunction isCloudflaredExit(reason: unknown): reason is Error {\n\treturn reason instanceof Error && reason.message.startsWith('cloudflared exited (');\n}\n\nexport interface TunnelEvents {\n\tlog: [level: LogLevel, text: string];\n\tstate: [state: TunnelState, url: string | null];\n}\n\nexport interface TunnelOptions {\n\t/** Override for tests. */\n\tstartTunnel?: typeof startTunnel;\n}\n\n/**\n * Exposes the bot's interactions endpoint publicly while `stars dev` runs.\n *\n * `dev.tunnel: true` opens a `cloudflared` quick tunnel via `untun` (it changes on every run); a configured https\n * URL is only probed, since the user already serves it. Writing the URL to the Discord application is opt-in\n * through `dev.tunnel.updateEndpoint`, because it edits a live application.\n */\nexport class Tunnel extends EventEmitter<TunnelEvents> {\n\t#startTunnel: typeof startTunnel;\n\t#tunnel: UntunTunnel | null = null;\n\t#state: TunnelState = 'off';\n\t#url: string | null = null;\n\t#wanted = false;\n\t#rejectionGuard: ((reason: unknown) => void) | null = null;\n\n\tpublic constructor(\n\t\tprivate readonly config: ResolvedStarsConfig,\n\t\toptions: TunnelOptions = {}\n\t) {\n\t\tsuper();\n\t\tthis.#startTunnel = options.startTunnel ?? startTunnel;\n\t}\n\n\tpublic get state(): TunnelState {\n\t\treturn this.#state;\n\t}\n\n\t/** The public URL of the interactions endpoint, `null` until the tunnel is up. */\n\tpublic get url(): string | null {\n\t\treturn this.#url;\n\t}\n\n\tpublic async start(forceQuick = false): Promise<void> {\n\t\tif (this.#state === 'starting' || this.#state === 'up') return;\n\t\tconst configured = this.config.dev.tunnel;\n\t\tconst tunnel: ResolvedTunnelConfig =\n\t\t\tforceQuick && configured.mode === 'off' ? { mode: 'quick', path: '/', updateEndpoint: false } : configured;\n\t\tif (tunnel.mode === 'off') return;\n\n\t\tthis.#wanted = true;\n\t\tthis.#setState('starting', null);\n\t\tconst url = tunnel.mode === 'url' ? await this.#useConfiguredUrl(tunnel) : await this.#openQuickTunnel();\n\t\tif (!url || !this.#wanted) return;\n\n\t\tthis.#setState('up', endpointUrl(url, tunnel.path));\n\t\tthis.emit('log', 'success', `Tunnel ready at ${this.#url}`);\n\t\tif (tunnel.updateEndpoint) await this.#updateInteractionsEndpoint(this.#url!);\n\t}\n\n\t/** Toggles the configured tunnel, opening a quick tunnel when the project did not configure one. */\n\tpublic toggle(): Promise<void> {\n\t\treturn this.#state === 'starting' || this.#state === 'up' ? this.close() : this.start(true);\n\t}\n\n\tpublic async close(): Promise<void> {\n\t\tthis.#wanted = false;\n\t\tconst tunnel = this.#tunnel;\n\t\tthis.#tunnel = null;\n\t\tthis.#setState('off', null);\n\t\t// Without a tunnel, `#openQuickTunnel` is still waiting for one and closes it (then releases the guard) when it arrives.\n\t\tif (!tunnel) return;\n\t\ttry {\n\t\t\tawait tunnel.close();\n\t\t} finally {\n\t\t\tthis.#releaseRejectionGuard();\n\t\t}\n\t}\n\n\tasync #useConfiguredUrl(tunnel: Extract<ResolvedTunnelConfig, { mode: 'url' }>): Promise<string | null> {\n\t\tconst reachable = await probe(endpointUrl(tunnel.url, tunnel.path));\n\t\tif (!reachable) {\n\t\t\tthis.emit('log', 'warn', `${tunnel.url} did not answer; make sure it forwards to ${this.config.dev.url ?? 'the bot'}`);\n\t\t}\n\n\t\treturn tunnel.url;\n\t}\n\n\tasync #openQuickTunnel(): Promise<string | null> {\n\t\tconst target = this.config.dev.url;\n\t\tif (!target) {\n\t\t\tthis.emit('log', 'error', 'A quick tunnel needs `dev.url` to know what to forward to');\n\t\t\tthis.#setState('failed', null);\n\t\t\treturn null;\n\t\t}\n\n\t\tthis.emit('log', 'info', 'Opening a cloudflared quick tunnel…');\n\t\tthis.#installRejectionGuard();\n\n\t\ttry {\n\t\t\tconst tunnel = await this.#startWithoutSignalHandlers(target);\n\t\t\tif (!this.#wanted) {\n\t\t\t\tawait tunnel?.close();\n\t\t\t\tthis.#releaseRejectionGuard();\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tif (!tunnel) {\n\t\t\t\tthis.emit('log', 'error', 'cloudflared setup was cancelled');\n\t\t\t\tthis.#setState('failed', null);\n\t\t\t\tthis.#releaseRejectionGuard();\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tthis.#tunnel = tunnel;\n\t\t\treturn await tunnel.getURL();\n\t\t} catch (error) {\n\t\t\tthis.#releaseRejectionGuard();\n\t\t\t// Closing the tunnel makes cloudflared exit, which `untun` reports as a failure: that is not one.\n\t\t\tif (!this.#wanted) return null;\n\t\t\tthis.emit('log', 'error', `cloudflared failed: ${error instanceof Error ? error.message : String(error)}`);\n\t\t\tthis.#setState('failed', null);\n\t\t\treturn null;\n\t\t}\n\t}\n\n\t/**\n\t * `untun` adds its own `SIGINT`/`SIGTERM`/`SIGHUP` listeners that call `process.exit()` once cloudflared is closed,\n\t * which races `stars dev`'s graceful shutdown (it closes the tunnel through {@link close} anyway), so they are removed.\n\t */\n\tasync #startWithoutSignalHandlers(target: string): Promise<UntunTunnel | undefined> {\n\t\tconst before = SIGNALS.map((signal) => new Set(process.listeners(signal)));\n\t\ttry {\n\t\t\treturn await this.#startTunnel({ url: target, acceptCloudflareNotice: true });\n\t\t} finally {\n\t\t\tSIGNALS.forEach((signal, index) => {\n\t\t\t\tfor (const listener of process.listeners(signal)) {\n\t\t\t\t\tif (!before[index]!.has(listener)) process.off(signal, listener);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * `untun` rejects a promise per connection when cloudflared exits and never handles it (and its location pattern\n\t * does not match lowercase codes such as `mxp03`, so that promise is never settled before), which Node reports as an\n\t * unhandled rejection that ends the process, whenever the tunnel closes. The guard swallows that one error for as\n\t * long as this tunnel exists; anything else it sees is thrown again, as if it was not installed.\n\t */\n\t#installRejectionGuard(): void {\n\t\tif (this.#rejectionGuard) return;\n\n\t\tconst guard = (reason: unknown): void => {\n\t\t\tif (!isCloudflaredExit(reason)) {\n\t\t\t\t// The guard is the only listener, so without this the rejection would be ignored instead of ending the process.\n\t\t\t\tif (process.listeners('unhandledRejection').length === 1) throw reason;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (this.#state !== 'up' || !this.#wanted) return;\n\t\t\tthis.#tunnel = null;\n\t\t\tthis.emit('log', 'error', `cloudflared stopped unexpectedly: ${reason.message}`);\n\t\t\tthis.#setState('failed', null);\n\t\t\tthis.#releaseRejectionGuard();\n\t\t};\n\n\t\tthis.#rejectionGuard = guard;\n\t\tprocess.on('unhandledRejection', guard);\n\t}\n\n\t/** Node reports an unhandled rejection after the microtasks that follow it, so the guard has to outlive them. */\n\t#releaseRejectionGuard(): void {\n\t\tconst guard = this.#rejectionGuard;\n\t\tthis.#rejectionGuard = null;\n\t\tif (guard) setImmediate(() => process.off('unhandledRejection', guard));\n\t}\n\n\t/**\n\t * Points the Discord application's interactions endpoint at the tunnel. Discord validates the endpoint with a\n\t * signed ping before accepting it, so the bot has to be up already — this runs after the first successful build.\n\t */\n\tasync #updateInteractionsEndpoint(url: string): Promise<void> {\n\t\tconst credentials = readDiscordCredentials(this.config);\n\t\tif (!credentials) {\n\t\t\tthis.emit('log', 'warn', 'Skipped the interactions endpoint update: DISCORD_TOKEN is not set');\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst response = await fetch('https://discord.com/api/v10/applications/@me', {\n\t\t\t\tmethod: 'PATCH',\n\t\t\t\theaders: { authorization: `Bot ${credentials.token}`, 'content-type': 'application/json' },\n\t\t\t\tbody: JSON.stringify({ interactions_endpoint_url: url }),\n\t\t\t\tsignal: AbortSignal.timeout(10_000)\n\t\t\t});\n\n\t\t\tif (response.ok) this.emit('log', 'success', `Interactions endpoint set to ${url}`);\n\t\t\telse\n\t\t\t\tthis.emit(\n\t\t\t\t\t'log',\n\t\t\t\t\t'error',\n\t\t\t\t\t`Discord rejected the interactions endpoint (${response.status}): ${(await response.text()).slice(0, 300)}`\n\t\t\t\t);\n\t\t} catch (error) {\n\t\t\tthis.emit('log', 'error', `Failed to update the interactions endpoint: ${error instanceof Error ? error.message : String(error)}`);\n\t\t}\n\t}\n\n\t#setState(state: TunnelState, url: string | null): void {\n\t\tthis.#state = state;\n\t\tthis.#url = url;\n\t\tthis.emit('state', state, url);\n\t}\n}\n\n/**\n * Joins the tunnel's origin with the path the interactions endpoint is served on.\n */\nexport function endpointUrl(origin: string, path: string): string {\n\treturn path === '/' ? origin : new URL(path, origin.endsWith('/') ? origin : `${origin}/`).href;\n}\n\nasync function probe(url: string): Promise<boolean> {\n\ttry {\n\t\tconst response = await fetch(url, { method: 'HEAD', signal: AbortSignal.timeout(5000) });\n\t\treturn response.status < 500;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport interface DiscordCredentials {\n\ttoken: string;\n\tapplicationId: string | null;\n}\n\n/**\n * Reads the Discord credentials the CLI needs from the environment, falling back to the project's `.env` files the\n * way the bot itself does once it starts.\n */\nexport function readDiscordCredentials(config: ResolvedStarsConfig, env: NodeJS.ProcessEnv = process.env): DiscordCredentials | null {\n\tconst fromFiles = readProjectEnvFilesCached(config);\n\tconst read = (...keys: string[]): string | null => {\n\t\tfor (const key of keys) {\n\t\t\tconst value = config.dev.env[key] ?? env[key] ?? fromFiles[key];\n\t\t\tif (value) return value;\n\t\t}\n\t\treturn null;\n\t};\n\n\tconst token = read('DISCORD_TOKEN', 'TOKEN');\n\tif (!token) return null;\n\n\treturn { token, applicationId: read('DISCORD_APPLICATION_ID', 'APPLICATION_ID', 'DISCORD_CLIENT_ID', 'CLIENT_ID') };\n}\n\nlet envFileCache: { key: string; values: Record<string, string> } | null = null;\n\n/** The variables the bot loads (see {@link readProjectEnv}), once per project and `env` options. */\nfunction readProjectEnvFilesCached(config: ResolvedStarsConfig): Record<string, string> {\n\tconst key = JSON.stringify([config.root, config.env.options]);\n\tif (envFileCache?.key !== key) envFileCache = { key, values: readProjectEnv(config) };\n\treturn envFileCache.values;\n}\n"],"mappings":";;;;;AAQA,MAAM,UAAU;CAAC;CAAU;CAAW;AAAQ;AAE9C,SAAS,kBAAkB,QAAkC;CAC5D,OAAO,kBAAkB,SAAS,OAAO,QAAQ,WAAW,sBAAsB;AACnF;;;;;;;;AAmBA,IAAa,SAAb,cAA4B,aAA2B;CASpC;CARlB;CACA,UAA8B;CAC9B,SAAsB;CACtB,OAAsB;CACtB,UAAU;CACV,kBAAsD;CAEtD,AAAO,YACN,AAAiB,QACjB,UAAyB,CAAC,GACzB;EACD,MAAM;EAHW;EAIjB,KAAK,eAAe,QAAQ,eAAe;CAC5C;CAEA,IAAW,QAAqB;EAC/B,OAAO,KAAK;CACb;;CAGA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