Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* `plugins list` — print every installed plugin row across all tenants
|
||||
* (or filtered to one).
|
||||
*/
|
||||
import { defineCommand } from "citty";
|
||||
import consola from "consola";
|
||||
|
||||
export const pluginsListCommand = defineCommand({
|
||||
meta: {
|
||||
name: "list",
|
||||
description: "List installed plugins.",
|
||||
},
|
||||
args: {
|
||||
tenantId: {
|
||||
type: "string",
|
||||
description: "Filter to a single tenant.",
|
||||
},
|
||||
enabled: {
|
||||
type: "string",
|
||||
description: "Filter: 'true' for enabled only, 'false' for disabled only.",
|
||||
},
|
||||
},
|
||||
async run({ args }) {
|
||||
const { getDbClient } = await import("@toolctrl/db/client.server");
|
||||
const prisma = getDbClient();
|
||||
const where: Record<string, unknown> = {};
|
||||
if (typeof args.tenantId === "string" && args.tenantId.length > 0) {
|
||||
where.tenantId = args.tenantId;
|
||||
}
|
||||
if (args.enabled === "true") where.enabled = true;
|
||||
if (args.enabled === "false") where.enabled = false;
|
||||
const rows = await prisma.plugin.findMany({
|
||||
where: where as never,
|
||||
orderBy: [{ tenantId: "asc" }, { pluginId: "asc" }],
|
||||
select: {
|
||||
id: true,
|
||||
tenantId: true,
|
||||
pluginId: true,
|
||||
version: true,
|
||||
enabled: true,
|
||||
installedAt: true,
|
||||
},
|
||||
});
|
||||
if (rows.length === 0) {
|
||||
consola.info("No installed plugins matched the filter.");
|
||||
return;
|
||||
}
|
||||
for (const row of rows) {
|
||||
const state = row.enabled ? "ON " : "OFF";
|
||||
consola.log(`${state} ${row.tenantId.padEnd(28)} ${row.pluginId.padEnd(36)} v${row.version}`);
|
||||
}
|
||||
consola.success(`${rows.length} plugin row(s) listed.`);
|
||||
},
|
||||
});
|
||||
Reference in new issue
Block a user