Skip to content

docs: generate api docs #275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ git checkout -b your-feature-or-bugfix
2. Make your changes. Please make sure to use the [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extension for consistent formatting and comments wherever necessary.

3. Ensure that your changes don't break any existing functionality. You can test the functionality of your code depending on where you've made changes:

1. If you've made changes to the CommandKit package, you can use the "apps/test-bot" project to test your own bot. Just make sure to create a new `.env` file with the template from the `.env.example` file provided. This also requires you to build the commandkit package locally (after you make your changes) because it's symlinked with pnpm workspaces.
2. If you've made changes to the docs, you can run `pnpm dev` inside "apps/website" to spin up a local development server.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## AppCommandHandler

<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="150" packageName="commandkit" />
<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="149" packageName="commandkit" />

Handles application commands for CommandKit, including loading, registration, and execution.
Manages both slash commands and message commands with middleware support.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## CommandKit

<GenerationInfo sourceFile="packages/commandkit/src/CommandKit.ts" sourceLine="92" packageName="commandkit" />
<GenerationInfo sourceFile="packages/commandkit/src/CommandKit.ts" sourceLine="94" packageName="commandkit" />

The commandkit class that serves as the main entry point for the CommandKit framework.

Expand All @@ -22,10 +22,11 @@ class CommandKit extends EventEmitter {
public eventInterceptor!: EventInterceptor;
public static readonly createElement = createElement;
public static readonly Fragment = Fragment;
public readonly config: CommandKitConfiguration = {
public readonly appConfig: CommandKitConfiguration = {
defaultLocale: Locale.EnglishUS,
getMessageCommandPrefix: () => '!',
};
public config: ResolvedCommandKitConfig = getConfig();
public readonly store = new Map<string, any>();
public readonly flags = new FlagStore();
public commandsRouter!: CommandsRouter;
Expand Down Expand Up @@ -73,11 +74,16 @@ The static createElement function to create jsx elements
<MemberInfo kind="property" type={``} />

The static Fragment component to create jsx fragments
### config
### appConfig

<MemberInfo kind="property" type={`<a href='/docs/next/api-reference/commandkit/interfaces/command-kit-configuration#commandkitconfiguration'>CommandKitConfiguration</a>`} />

The configuration for the CommandKit instance.
### config

<MemberInfo kind="property" type={`<a href='/docs/next/api-reference/commandkit/types/resolved-command-kit-config#resolvedcommandkitconfig'>ResolvedCommandKitConfig</a>`} />

The configuration for the CommandKit environment.
### store

<MemberInfo kind="property" type={``} />
Expand Down
62 changes: 62 additions & 0 deletions apps/website/docs/api-reference/commandkit/classes/noop-logger.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: "NoopLogger"
isDefaultIndex: false
generated: true
---

import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';

<!-- This file was generated from the CommandKit source. Do not modify. Instead, re-run the "docgen" script -->


## NoopLogger

<GenerationInfo sourceFile="packages/commandkit/src/logger/NoopLogger.ts" sourceLine="6" packageName="commandkit" />

Noop logger implementation that does nothing.

```ts title="Signature"
class NoopLogger implements ILogger {
debug(args: any[]) => void;
error(args: any[]) => void;
log(args: any[]) => void;
info(args: any[]) => void;
warn(args: any[]) => void;
}
```
* Implements: <code><a href='/docs/next/api-reference/commandkit/interfaces/ilogger#ilogger'>ILogger</a></code>



<div className="members-wrapper">

### debug

<MemberInfo kind="method" type={`(args: any[]) => void`} />

Logs a debug message.
### error

<MemberInfo kind="method" type={`(args: any[]) => void`} />

Logs an error message.
### log

<MemberInfo kind="method" type={`(args: any[]) => void`} />

Logs a default message.
### info

<MemberInfo kind="method" type={`(args: any[]) => void`} />

Logs an info message.
### warn

<MemberInfo kind="method" type={`(args: any[]) => void`} />

Logs a warning message.


</div>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## onApplicationBootstrap

<GenerationInfo sourceFile="packages/commandkit/src/CommandKit.ts" sourceLine="83" packageName="commandkit" />
<GenerationInfo sourceFile="packages/commandkit/src/CommandKit.ts" sourceLine="85" packageName="commandkit" />

Registers a bootstrap hook that will be called when the CommandKit instance is created.
This is useful for plugins that need to run some code after the CommandKit instance is fully initialized.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## onBootstrap

<GenerationInfo sourceFile="packages/commandkit/src/CommandKit.ts" sourceLine="67" packageName="commandkit" />
<GenerationInfo sourceFile="packages/commandkit/src/CommandKit.ts" sourceLine="69" packageName="commandkit" />

Registers a bootstrap hook that will be called when the CommandKit instance is created.
This is useful for plugins that need to run some code after the CommandKit instance is fully initialized.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ interface CommandKitConfig {
};
typedCommands?: boolean;
disablePrefixCommands?: boolean;
showUnknownPrefixCommandsWarning?: boolean;
}
```

Expand Down Expand Up @@ -110,6 +111,11 @@ Whether or not to enable the typed commands.
<MemberInfo kind="property" type={`boolean`} default={`false`} />

Whether or not to disable the prefix commands.
### showUnknownPrefixCommandsWarning

<MemberInfo kind="property" type={`boolean`} default={`true`} />

Whether or not to show a warning when a prefix command is not found. This only affects development mode.


</div>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## CommandKitConfiguration

<GenerationInfo sourceFile="packages/commandkit/src/CommandKit.ts" sourceLine="28" packageName="commandkit" />
<GenerationInfo sourceFile="packages/commandkit/src/CommandKit.ts" sourceLine="30" packageName="commandkit" />

Configurations for the CommandKit instance.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## CustomAppCommandProps

<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="53" packageName="commandkit" />
<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="52" packageName="commandkit" />

Custom properties that can be added to an AppCommand.
This allows for additional metadata or configuration to be associated with a command.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## LoadedCommand

<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="75" packageName="commandkit" />
<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="74" packageName="commandkit" />

Represents a loaded command with its metadata and configuration.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## PreparedAppCommandExecution

<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="103" packageName="commandkit" />
<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="102" packageName="commandkit" />

Represents a prepared command execution with all necessary data and middleware.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## AppCommand

<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="61" packageName="commandkit" />
<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="60" packageName="commandkit" />

Represents a command in the CommandKit application, including its metadata and handlers.
This type extends the native command structure with additional properties.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## BootstrapFunction

<GenerationInfo sourceFile="packages/commandkit/src/CommandKit.ts" sourceLine="46" packageName="commandkit" />
<GenerationInfo sourceFile="packages/commandkit/src/CommandKit.ts" sourceLine="48" packageName="commandkit" />

Represents the function executed during the bootstrap phase of CommandKit.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## CommandBuilderLike

<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="112" packageName="commandkit" />
<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="111" packageName="commandkit" />

Type representing command builder objects supported by CommandKit.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## CommandDataSchemaKey

<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="134" packageName="commandkit" />
<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="133" packageName="commandkit" />



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## CommandDataSchemaValue

<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="135" packageName="commandkit" />
<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="134" packageName="commandkit" />



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## CommandDataSchema

<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="133" packageName="commandkit" />
<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="132" packageName="commandkit" />



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type CommandData = Prettify<
Omit<RESTPostAPIApplicationCommandsJSONBody, 'description'> & {
description?: string;
guilds?: string[];
aliases?: string[];
}
>
```
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## CommandTypeData

<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="84" packageName="commandkit" />
<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="83" packageName="commandkit" />

Type representing command data identifier.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## ResolvableCommand

<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="89" packageName="commandkit" />
<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="88" packageName="commandkit" />

Type for commands that can be resolved by the handler.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## commandkit

<GenerationInfo sourceFile="packages/commandkit/src/CommandKit.ts" sourceLine="478" packageName="commandkit" />
<GenerationInfo sourceFile="packages/commandkit/src/CommandKit.ts" sourceLine="488" packageName="commandkit" />

The singleton instance of CommandKit.

Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ export default defineConfig({
1. **Type Safety**: Always use `commandkit.config.ts` for better type checking and IDE support.
2. **Security**: Always store sensitive information in `.env` file and make sure it is not committed to your version control system.
3. **Plugin Management**:

- Only include necessary plugins to keep build times fast
- Plugins have full access to your discord bot. So always be careful when installing the plugins.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,11 @@ npx commandkit create event ready
## Best Practices

1. **Development Workflow**:

- Use `commandkit dev` during development for instant feedback
- Enable debug mode when troubleshooting issues
- Keep your `.env` file updated with all required variables

2. **Production Deployment**:

- Always run `commandkit build` before deploying
- Test the production build locally before deployment
- Use environment variables for sensitive data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,11 @@ When you call this function multiple times with the same `userId`, it will only
CommandKit's caching system works by:

1. **Generating a Cache Key**: Each cached function call generates a unique key based on:

- The function's identity
- The arguments passed to the function
- A build ID for stability

2. **Storing Results**: When a function is called:

- If the result isn't cached, the function executes and stores its result
- If the result is cached, it's returned immediately without executing the function

Expand Down Expand Up @@ -107,19 +105,16 @@ async function fetchUserData(userId: string) {
## Best Practices

1. **Choose What to Cache**:

- Cache expensive operations (API calls, database queries)
- Cache data that doesn't change frequently
- Don't cache sensitive or frequently changing data

2. **Set Appropriate TTL**:

- Use shorter TTL for frequently changing data
- Use longer TTL for static data
- Consider your data's update frequency

3. **Use Tags for Revalidation**:

- Add meaningful tags to your cache entries
- Group related cache entries with the same tag
- Use tags for targeted cache invalidation
Expand Down
2 changes: 0 additions & 2 deletions apps/website/docs/guide/04-caching/02-cacheTag-function.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,11 @@ await revalidateTag('user:123');
## Best Practices

1. **Use Consistent Naming**:

- Follow a consistent pattern (e.g., `type:id`)
- Make tags descriptive and meaningful
- Use hierarchical tags when appropriate

2. **Group Related Data**:

- Tag related cache entries with the same tag
- Use multiple tags for cross-category entries
- Consider data relationships when tagging
Expand Down
2 changes: 0 additions & 2 deletions apps/website/docs/guide/04-caching/03-cacheLife-function.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,11 @@ async function fetchData(type: 'frequent' | 'rare') {
## Best Practices

1. **Choose Appropriate Duration**:

- Use shorter TTL for frequently changing data
- Use longer TTL for static content
- Consider your data update patterns

2. **Balance Freshness and Performance**:

- Don't cache too long if data changes often
- Don't cache too short if data is static
- Consider your application's needs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,11 @@ setInterval(
## Best Practices

1. **Strategic Invalidation**:

- Invalidate only what needs to be refreshed
- Use specific tags for targeted invalidation
- Consider the impact on performance

2. **Timing**:

- Invalidate after data changes
- Consider using scheduled revalidation
- Balance freshness and performance
Expand Down
2 changes: 0 additions & 2 deletions apps/website/docs/guide/04-caching/06-cleanup-function.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,11 @@ async function performConservativeCleanup() {
## Best Practices

1. **Choose Appropriate Time Period**:

- Consider your application's memory constraints
- Balance between memory usage and cache effectiveness
- Monitor cache hit rates

2. **Schedule Regular Cleanup**:

- Set up automated cleanup tasks
- Choose appropriate intervals
- Handle cleanup errors gracefully
Expand Down
Loading
Loading