Registry / database / koishi-plugin-database-console

koishi-plugin-database-console

JSON →
library0.2.3jsnpmunverified

koishi-plugin-database-console is a Koishi plugin designed to extend the Koishi Console with a graphical user interface for managing data stored via Minato, Koishi's universal database abstraction layer. It enables bot administrators to view and potentially manipulate their bot's underlying data directly within the Koishi web interface, abstracting away the need for external database management tools. Currently at version 0.2.3, this plugin operates within the active Koishi ecosystem, which generally sees frequent minor updates and periodic major version releases. Its primary differentiator is the seamless integration into the existing Koishi Console, offering a centralized management experience for chatbot operations and data. This allows for easier debugging, data inspection, and simplified administration, especially for those less familiar with direct database interaction.

npm install koishi-plugin-database-console
INSTALL
IMPORT
SIG · KOISHI-PLUGIN-DATA
K
koishi-plugin-database-console
databasejavascriptv0.2.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

apply
import { apply } from 'koishi-plugin-database-console'
import KoishiDatabaseConsole from 'koishi-plugin-database-console'
Koishi plugins typically export an `apply` function (or a `Config` object) for registration, not a default export.
Config
import { Config } from 'koishi-plugin-database-console'
Imports the plugin's configuration schema for type safety and console configuration.
koishiPluginDatabaseConsole
const koishiPluginDatabaseConsole = require('koishi-plugin-database-console')
const { apply } = require('koishi-plugin-database-console')
While Koishi supports CJS, plugins usually export `apply` via named export in ESM, making `require` without destructuring the entire module object more robust for CJS. For configuration, typically `koishi.config.ts` (ESM) is used.

This quickstart demonstrates how to apply the koishi-plugin-database-console within a Koishi application and shows basic interaction with Koishi's Minato database layer. It assumes an existing Koishi project with a database configured.

import { Context, Schema } from 'koishi'; import { apply, Config } from 'koishi-plugin-database-console'; interface MyConfig extends Config { // Add any specific configurations for koishi-plugin-database-console here // For example, if it had a specific endpoint or permissions. // This plugin usually doesn't require explicit configuration beyond enabling it. } export const name = 'my-koishi-app'; export function apply(ctx: Context, config: MyConfig) { // Apply the database console plugin. // It automatically registers itself with the Koishi console. ctx.plugin(apply, config); ctx.logger('app').info('Koishi Database Console plugin applied!'); // Example of using Koishi's database context (Minato) // This part is for demonstrating Minato, not directly the plugin. ctx.model.extend('user', { exampleData: { type: 'string' } }); ctx.on('ready', async () => { const user = await ctx.model.User.create({ id: '123', exampleData: 'Hello Minato!' }); ctx.logger('app').info(`Created example user: ${user.id} with data: ${user.exampleData}`); }); // Register a simple command to show the bot is active ctx.command('db.test', 'Test database console functionality (indirectly)') .action(async ({ session }) => { const user = await session.user.get(); return `Your exampleData in database: ${user.exampleData || 'N/A'}. Check the Koishi console for database views.`; }); } export const Config: Schema<MyConfig> = Schema.object({});
Debug
Known issues
breakingMajor version upgrades of the Koishi framework (e.g., Koishi v3 to v4) or its core console plugin (@koishijs/plugin-console) may introduce breaking changes requiring updates to this plugin. Always consult Koishi's official release notes.
fix
Refer to the Koishi official documentation and the plugin's GitHub repository for specific migration guides or updated versions. Ensure all peer dependencies match the required Koishi ecosystem versions.
affects: >=0.1.0
gotchaThis plugin requires a correctly configured and running Koishi console (`@koishijs/plugin-console`) to function. Without the console, the database UI will not be accessible.
fix
Ensure `@koishijs/plugin-console` is installed and enabled in your Koishi configuration. Access the Koishi console through your browser, usually at `http://localhost:8080` by default.
affects: >=0.1.0
gotchaCompatibility with the underlying database driver (e.g., `@minatojs/driver-sqlite`) and `minato` itself is crucial. Mismatched versions can lead to database connection errors or unexpected behavior.
fix
Verify that your `minato` and database driver versions satisfy the peer dependency requirements of `koishi` and `koishi-plugin-database-console`. Update dependencies if necessary.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Plugin 'koishi-plugin-database-console' requires @koishijs/plugin-console@^5.29.4, got 5.x.x
Peer dependency mismatch for `@koishijs/plugin-console`.
fix
Update your `@koishijs/plugin-console` package to match the required version using `npm install @koishijs/plugin-console@^5.29.4` or `yarn add @koishijs/plugin-console@^5.29.4`.
Cannot find module 'koishi-plugin-database-console' or its corresponding type declarations.
The package is not installed or the import path is incorrect.
fix
Ensure the package is installed: `npm install koishi-plugin-database-console` or `yarn add koishi-plugin-database-console`. Verify the import statement is `import { apply } from 'koishi-plugin-database-console'`.
TypeError: ctx.console is undefined (or similar error when accessing console features)
The `@koishijs/plugin-console` plugin is not properly loaded or initialized in your Koishi application.
fix
Add `@koishijs/plugin-console` to your Koishi configuration file (e.g., `koishi.yml` or `koishi.config.ts`) and ensure it loads before `koishi-plugin-database-console` if there's an explicit ordering. Example in `koishi.config.ts`: `ctx.plugin(require('@koishijs/plugin-console'));`
Upgrade
Version history
0.2.3latest on npm
Audit
Dependencies
@koishijs/plugin-consolerequiredProvides the web console environment and services for plugin integration.
koishirequiredThe core Koishi framework that this plugin extends.
minatorequiredKoishi's universal database abstraction layer, whose data this plugin helps manage.
Agent activity
18 hits · last 30 days
node
16
Resources
koishi-plugin-database-console — npm install koishi-plugin-database-console · libregistry