npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@xernerx/commands

v0.2.8

Published

Xernerx Commands

Readme

Xernerx Banner

@xernerx/commands

Xernerx Commands (@xernerx/commands) is the official Jishaku (jsk)-inspired developer command extension for @xernerx/framework and the official SDK for synchronizing and managing Discord bot application commands on the Xernerx Suite API (https://api.xernerx.com/v1/bots/:id/commands).

Features

  • Jishaku (jsk)-Inspired Developer Suite: Built-in owner-restricted commands (xc!, evaluate, shell, git, source, haste, ping, debug, repeat, su, transpile, documentation) with automatic @mention prefix stripping and alias support.
  • Stateful JavaScript & TypeScript Evaluation: Evaluate code in live bot context with _ (last result), message (msg), client (bot), guild, channel, user (author), member, and Discord in scope, plus sub-modes for sh, git, and source.
  • Automatic Suite API Synchronization: Extracts slash and context menu commands from XernerxClient (or across XernerxShardClient clusters) and syncs their command bodies to POST /v1/bots/:id/commands on startup and optional intervals.
  • Standalone REST SDK (CommandsClient): Manage bot commands (get, post, sync, update, delete, clear) from any deployment script or service without a running Discord client.
  • Interactive Output Controls: Every developer command reply is formatted via embedify() with an owner-only delete button (✖️ / xc-delete-msg) and automatic Hastebin overflow links (View in browser).

Install

pnpm add @xernerx/commands

Setup

Extend XernerxClient and register XernerxCommands:

import { XernerxClient } from '@xernerx/framework';
import { XernerxCommands } from '@xernerx/commands';

export class Client extends XernerxClient {
	constructor() {
		super({
			intents: ['Guilds', 'GuildMessages', 'MessageContent'],
			token: process.env.DISCORD_BOT_TOKEN!,
			owners: ['YOUR_USER_ID'],
		});

		this.modules.extensionHandler.loadExtensions(
			new XernerxCommands(this, {
				token: process.env.XERNERX_TOKEN!,
				prefix: 'xc!',
				useEmbeds: true,
				cache: {
					messages: 1000,
				},
			})
		);

		this.connect();
	}
}

new Client();

Standalone API Client (CommandsClient)

Extend CommandsClient to fetch, post, sync, update, or delete commands on the Xernerx Suite API:

import { CommandsClient } from '@xernerx/commands';
import { Terminal } from '@xernerx/terminal';

export class Commands extends CommandsClient {
	private readonly console = new Terminal({ scope: 'XC' });

	constructor() {
		super({
			botId: 'YOUR_BOT_ID',
			token: process.env.XERNERX_API_TOKEN!,
		});
	}

	async run() {
		// Post or sync commands body to Xernerx Suite API
		await this.post([
			{
				name: 'ping',
				description: 'Replies with Pong!',
				type: 1,
			},
		]);

		await this.sync([
			{
				name: 'ping',
				description: 'Replies with Pong!',
				type: 1,
			},
		]);

		// Update stored commands on Xernerx Suite API
		await this.update([
			{
				name: 'ping',
				description: 'Replies with gateway latency!',
				type: 1,
			},
		]);

		// Fetch stored commands from Xernerx Suite API
		const list = await this.get();
		this.console.info(`Loaded ${list.length} commands from Xernerx Suite API`);

		// Delete a specific command by ID/name or clear all commands for the bot
		await this.delete('ping');
		await this.clear();
	}
}

new Commands();

Helper Functions & Models

@xernerx/commands exports lower-level utilities and models for custom command pipelines and developer tooling:

import { XernerxClient } from '@xernerx/framework';
import { Terminal } from '@xernerx/terminal';
import { post, serializeCommand, extractClientCommands, embedify, reply, haste, shell, source, resolveCommandSource, version } from '@xernerx/commands';
import type { Message } from 'discord.js';

export class CustomDeveloperTools extends XernerxClient {
	private readonly console = new Terminal({ scope: 'XC' });

	constructor() {
		super({
			intents: ['Guilds', 'GuildMessages', 'MessageContent'],
			token: process.env.DISCORD_BOT_TOKEN!,
			owners: ['YOUR_USER_ID'],
		});

		this.console.info(`Running @xernerx/commands v${version}`);
	}

	async syncAllCommands() {
		// Extract all slash & context commands from this XernerxClient instance
		const allCommands = extractClientCommands(this);

		// Serialize a single command builder or plain object into a CommandBody
		const firstSerialized = allCommands[0] ? serializeCommand(allCommands[0]) : null;
		if (firstSerialized) {
			this.console.info(`Prepared command: ${firstSerialized.name}`);
		}

		// Directly POST command payloads to https://api.xernerx.com/v1/bots/:id/commands
		await post({ id: this.user!.id, commands: allCommands }, process.env.XERNERX_API_TOKEN!);
	}

	async inspectMessage(message: Message) {
		// Upload text/code to a Hastebin-compatible service
		const hasteUrl = await haste("new Terminal({ scope: 'XC' }).info('Hello Xernerx!');");
		this.console.info(`Uploaded snippet to ${hasteUrl}`);

		// Format a command reply with an embed, Hastebin browser link button, and owner delete button (✖️)
		await embedify(message, '```ts\nconst ok = true;\n```', 'Evaluate', true);

		// Send a code-block reply with automatic Hastebin fallback for large payloads
		await reply(message, 'const x = 42;', true);

		// Execute a shell command or inspect command/expression source directly
		await shell(message, ['git', 'status']);
		await source(message, ['ping']);

		const rawSource = resolveCommandSource(this, 'ping');
		if (rawSource) {
			this.console.info(`Resolved source (${rawSource.length} chars)`);
		}
	}
}

XernerxCommandsOptions

| Name | Type | Default | Required | Description | | ------------------ | --------------------------------- | ------- | -------- | ----------------------------------------------------------------------------- | | token | string | "" | false | Xernerx Suite API token to automatically post/sync commands body on startup. | | url | string | auto | false | Custom Xernerx Suite API base URL (https://api.xernerx.com by default). | | dev | boolean | false | false | Use local development API URL (http://localhost:4001). | | interval | number | — | false | Optional interval in ms to periodically re-sync commands body. | | include | Array<CommandName> \| null | null | false | Only load the specified built-in developer commands. | | exclude | Array<CommandName> \| null | null | false | Exclude the specified built-in developer commands. | | prefix | Array<string> \| string \| null | 'xc!' | false | Prefix(es) for the built-in developer message commands. | | cache.messages | number | 1000 | false | Maximum number of messages cached per channel in Discord.js MessageManager. | | useEmbeds | boolean | true | false | Whether command responses should use Discord embeds when permitted. | | registerCommands | boolean | true | false | Whether to register the built-in developer message commands on the client. |

Built-in Developer Commands (Jishaku / jsk Inspired)

All built-in developer commands are owner-restricted (client.settings.owners) and reply via embedify() with interactive controls:

  • Delete Control (✖️ / xc-delete-msg): Owner-only danger button attached to every response that deletes the bot's output message on click.
  • Browser Overflow / Hastebin Link (View in browser): Automatically uploads command output to a Hastebin mirror (hst.sh, hastebin.com, etc.) and attaches a direct link button; outputs exceeding Discord's character limit automatically fall back to the browser view.

| Name | Aliases | Description | | --------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------- | | xc! | jsk, jishaku, status | Displays bot, process memory/PID, shard, cache, intent, and framework runtime information. | | evaluate | eval, ev, js, ts, py | Evaluates JS/TS code with _, message, client, guild, channel, Discord in scope. | | shell | sh | Executes a shell command and returns stdout/stderr. | | git | — | Shortcut for running git commands in the workspace shell (jsk git). | | source | src | Displays the source code of a registered bot command or JS expression (jsk source). | | haste | cat, tree | Lists directory trees or reads/uploads file source to a Hastebin service (jsk cat). | | ping | rtt | Displays WebSocket, API, and round-trip latency (jsk rtt). | | debug | dbg | Executes a command, timing its duration (ms) and catching thrown stack traces (jsk dbg). | | repeat | — | Repeats a command <count> times sequentially (jsk repeat, up to 25 times). | | su | sudo, in | Runs a command as another user (su), in another channel (in), or bypassing restrictions (sudo). | | transpile | t, tr | Pipes code into a specified language/engine runtime. | | documentation | docs | Queries the Xernerx Developer Documentation catalog (https://docs.xernerx.com). |

Documentation & API Reference

Full API documentation for @xernerx/commands is hosted on the @xernerx/commands Package Reference.

Classes

Interfaces

Functions

REST API Endpoints

Links & Support