@tryghost/ghst 0.12.0 → 0.13.0
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 +24 -9
- package/dist/index.js +651 -235
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -1271,11 +1271,30 @@ function getGlobalOptions(command) {
|
|
|
1271
1271
|
site: options.site,
|
|
1272
1272
|
url: options.url,
|
|
1273
1273
|
staffToken: options.staffToken,
|
|
1274
|
+
enableDestructiveActions: options.enableDestructiveActions,
|
|
1274
1275
|
debug: options.debug,
|
|
1275
1276
|
color: options.color !== false && !noColorFromEnv
|
|
1276
1277
|
};
|
|
1277
1278
|
}
|
|
1278
1279
|
|
|
1280
|
+
// src/lib/destructive-actions.ts
|
|
1281
|
+
function assertDestructiveActionsEnabled(global, action = "this operation") {
|
|
1282
|
+
if (global.enableDestructiveActions) {
|
|
1283
|
+
return;
|
|
1284
|
+
}
|
|
1285
|
+
throw new GhstError(
|
|
1286
|
+
`Destructive actions are disabled for ${action}. Re-run with --enable-destructive-actions to continue.`,
|
|
1287
|
+
{
|
|
1288
|
+
code: "DESTRUCTIVE_ACTIONS_DISABLED",
|
|
1289
|
+
exitCode: 2 /* USAGE_ERROR */
|
|
1290
|
+
}
|
|
1291
|
+
);
|
|
1292
|
+
}
|
|
1293
|
+
function isReadOnlyHttpMethod(method) {
|
|
1294
|
+
const normalized = (method ?? "GET").toUpperCase();
|
|
1295
|
+
return normalized === "GET" || normalized === "HEAD" || normalized === "OPTIONS";
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1279
1298
|
// src/lib/output.ts
|
|
1280
1299
|
import process2 from "process";
|
|
1281
1300
|
import chalk from "chalk";
|
|
@@ -2392,6 +2411,9 @@ function registerApiCommands(program) {
|
|
|
2392
2411
|
const requestApi = options.contentApi ? "content" : "admin";
|
|
2393
2412
|
const normalizedEndpointPath = normalizeGhostApiPath(endpointPath, requestApi);
|
|
2394
2413
|
const global = getGlobalOptions(command);
|
|
2414
|
+
if (!isReadOnlyHttpMethod(options.method)) {
|
|
2415
|
+
assertDestructiveActionsEnabled(global, "raw API write request");
|
|
2416
|
+
}
|
|
2395
2417
|
const connection = await resolveConnectionConfig(global);
|
|
2396
2418
|
const client = new GhostClient({
|
|
2397
2419
|
url: connection.url,
|
|
@@ -2559,16 +2581,16 @@ Reason: ${reason}`;
|
|
|
2559
2581
|
console.error(useColor ? chalk2.yellow(warning) : warning);
|
|
2560
2582
|
}
|
|
2561
2583
|
async function openGhostAdminForLogin(adminOrigin, useColor) {
|
|
2562
|
-
const
|
|
2563
|
-
const preflight = `Opening Ghost Admin in your browser: ${
|
|
2584
|
+
const staffProfileUrl = getGhostStaffProfileUrl(adminOrigin);
|
|
2585
|
+
const preflight = `Opening Ghost Admin in your browser: ${staffProfileUrl}`;
|
|
2564
2586
|
console.log("");
|
|
2565
2587
|
console.log(useColor ? chalk2.cyan(preflight) : preflight);
|
|
2566
2588
|
console.log("");
|
|
2567
2589
|
try {
|
|
2568
|
-
await openUrlFn(
|
|
2590
|
+
await openUrlFn(staffProfileUrl);
|
|
2569
2591
|
} catch (error) {
|
|
2570
2592
|
const detail = formatOpenError(error);
|
|
2571
|
-
printOpenWarning(
|
|
2593
|
+
printOpenWarning(staffProfileUrl, useColor, detail);
|
|
2572
2594
|
}
|
|
2573
2595
|
}
|
|
2574
2596
|
var promptFn = prompt;
|
|
@@ -2614,9 +2636,9 @@ function getGhostAdminEntryUrl(url) {
|
|
|
2614
2636
|
const normalizedUrl = normalizeGhostUrl(url);
|
|
2615
2637
|
return `${normalizedUrl}/ghost`;
|
|
2616
2638
|
}
|
|
2617
|
-
function
|
|
2639
|
+
function getGhostStaffProfileUrl(url) {
|
|
2618
2640
|
const normalizedUrl = normalizeGhostUrl(url);
|
|
2619
|
-
return `${normalizedUrl}/ghost/#/
|
|
2641
|
+
return `${normalizedUrl}/ghost/#/my-profile`;
|
|
2620
2642
|
}
|
|
2621
2643
|
function formatConfiguredSiteDisplay(alias, sites) {
|
|
2622
2644
|
if (!alias) {
|
|
@@ -2964,6 +2986,7 @@ function registerAuthCommands(program) {
|
|
|
2964
2986
|
code: "SITE_NOT_FOUND"
|
|
2965
2987
|
});
|
|
2966
2988
|
}
|
|
2989
|
+
assertDestructiveActionsEnabled(global, "logout site");
|
|
2967
2990
|
if (site.credentialRef) {
|
|
2968
2991
|
await store.delete(site.credentialRef).catch(() => void 0);
|
|
2969
2992
|
}
|
|
@@ -2975,6 +2998,7 @@ function registerAuthCommands(program) {
|
|
|
2975
2998
|
console.log(`Removed site '${targetSite}'.`);
|
|
2976
2999
|
return;
|
|
2977
3000
|
}
|
|
3001
|
+
assertDestructiveActionsEnabled(global, "logout all sites");
|
|
2978
3002
|
if (!options.yes) {
|
|
2979
3003
|
if (isNonInteractive()) {
|
|
2980
3004
|
throw new GhstError("Removing all sites in non-interactive mode requires --yes.", {
|
|
@@ -3021,6 +3045,7 @@ function registerAuthCommands(program) {
|
|
|
3021
3045
|
const projectConfig = await readProjectConfig();
|
|
3022
3046
|
const projectConfigCwd = await resolveProjectConfigCwd();
|
|
3023
3047
|
if (projectConfig && projectConfig.site !== siteAlias) {
|
|
3048
|
+
assertDestructiveActionsEnabled(global, "replace project link");
|
|
3024
3049
|
if (!options.yes) {
|
|
3025
3050
|
if (isNonInteractive()) {
|
|
3026
3051
|
throw new GhstError(
|
|
@@ -3431,6 +3456,7 @@ function registerCommentCommands(program) {
|
|
|
3431
3456
|
if (!parsed.success) {
|
|
3432
3457
|
throwValidationError(parsed.error);
|
|
3433
3458
|
}
|
|
3459
|
+
assertDestructiveActionsEnabled(global, "delete comment");
|
|
3434
3460
|
if (!parsed.data.yes) {
|
|
3435
3461
|
if (isNonInteractive()) {
|
|
3436
3462
|
throw new GhstError("Deleting in non-interactive mode requires --yes.", {
|
|
@@ -4062,6 +4088,7 @@ function registerLabelCommands(program) {
|
|
|
4062
4088
|
if (!parsed.success) {
|
|
4063
4089
|
throwValidationError3(parsed.error);
|
|
4064
4090
|
}
|
|
4091
|
+
assertDestructiveActionsEnabled(global, "delete label");
|
|
4065
4092
|
if (!parsed.data.yes) {
|
|
4066
4093
|
if (isNonInteractive()) {
|
|
4067
4094
|
throw new GhstError("Deleting in non-interactive mode requires --yes.", {
|
|
@@ -4100,6 +4127,9 @@ function registerLabelCommands(program) {
|
|
|
4100
4127
|
if (!parsed.success) {
|
|
4101
4128
|
throwValidationError3(parsed.error);
|
|
4102
4129
|
}
|
|
4130
|
+
if (parsed.data.action === "delete") {
|
|
4131
|
+
assertDestructiveActionsEnabled(global, "bulk delete labels");
|
|
4132
|
+
}
|
|
4103
4133
|
const payload = await bulkLabels(global, {
|
|
4104
4134
|
filter: parsed.data.filter,
|
|
4105
4135
|
delete: parsed.data.action === "delete",
|
|
@@ -7022,6 +7052,66 @@ var MCP_TOOL_GROUPS = [
|
|
|
7022
7052
|
"socialweb",
|
|
7023
7053
|
"stats"
|
|
7024
7054
|
];
|
|
7055
|
+
var MCP_TOOL_GROUP_METADATA = {
|
|
7056
|
+
posts: { title: "Posts" },
|
|
7057
|
+
pages: { title: "Pages" },
|
|
7058
|
+
tags: { title: "Tags" },
|
|
7059
|
+
members: { title: "Members" },
|
|
7060
|
+
comments: { title: "Comments" },
|
|
7061
|
+
site: { title: "Site" },
|
|
7062
|
+
settings: { title: "Settings" },
|
|
7063
|
+
users: { title: "Users" },
|
|
7064
|
+
api: { title: "API" },
|
|
7065
|
+
search: { title: "Search" },
|
|
7066
|
+
socialweb: { title: "Social web" },
|
|
7067
|
+
stats: { title: "Stats" }
|
|
7068
|
+
};
|
|
7069
|
+
var mcpSiteArgSchema = SiteAliasSchema.optional();
|
|
7070
|
+
var mcpSiteSchema = z6.object({
|
|
7071
|
+
site: mcpSiteArgSchema
|
|
7072
|
+
});
|
|
7073
|
+
var mcpOptionalSiteOnlySchema = z6.union([mcpSiteSchema, z6.undefined()]).transform((value) => value ?? {});
|
|
7074
|
+
function withMcpSiteSchema(inputSchema) {
|
|
7075
|
+
if (!inputSchema) {
|
|
7076
|
+
return mcpOptionalSiteOnlySchema;
|
|
7077
|
+
}
|
|
7078
|
+
const objectSchema = inputSchema;
|
|
7079
|
+
const siteShape = { site: mcpSiteArgSchema };
|
|
7080
|
+
if (typeof objectSchema.safeExtend === "function") {
|
|
7081
|
+
return objectSchema.safeExtend(siteShape);
|
|
7082
|
+
}
|
|
7083
|
+
if (typeof objectSchema.extend === "function") {
|
|
7084
|
+
return objectSchema.extend(siteShape);
|
|
7085
|
+
}
|
|
7086
|
+
return z6.intersection(inputSchema, mcpSiteSchema);
|
|
7087
|
+
}
|
|
7088
|
+
function scopedGlobalForTool(global, args) {
|
|
7089
|
+
return args.site ? { ...global, site: args.site } : global;
|
|
7090
|
+
}
|
|
7091
|
+
function argsWithoutSite(args) {
|
|
7092
|
+
const { site: _site, ...rest } = args;
|
|
7093
|
+
return rest;
|
|
7094
|
+
}
|
|
7095
|
+
function registerGroupedTool(server, global, group, name, config, handler) {
|
|
7096
|
+
const metadata = MCP_TOOL_GROUP_METADATA[group];
|
|
7097
|
+
const groupedConfig = {
|
|
7098
|
+
...config,
|
|
7099
|
+
inputSchema: withMcpSiteSchema(config.inputSchema),
|
|
7100
|
+
_meta: {
|
|
7101
|
+
...config._meta,
|
|
7102
|
+
"ghst/toolGroup": group,
|
|
7103
|
+
"ghst/toolGroupTitle": metadata.title
|
|
7104
|
+
}
|
|
7105
|
+
};
|
|
7106
|
+
const groupedHandler = async (args) => {
|
|
7107
|
+
const mcpArgs = args;
|
|
7108
|
+
return await handler(
|
|
7109
|
+
scopedGlobalForTool(global, mcpArgs),
|
|
7110
|
+
argsWithoutSite(mcpArgs)
|
|
7111
|
+
);
|
|
7112
|
+
};
|
|
7113
|
+
server.registerTool(name, groupedConfig, groupedHandler);
|
|
7114
|
+
}
|
|
7025
7115
|
var statsRangeArgs = {
|
|
7026
7116
|
range: z6.enum(["7d", "30d", "90d", "365d", "all"]).optional(),
|
|
7027
7117
|
from: z6.string().optional(),
|
|
@@ -7194,6 +7284,9 @@ async function runSearch(global, query, limit) {
|
|
|
7194
7284
|
};
|
|
7195
7285
|
}
|
|
7196
7286
|
async function callApi(global, options) {
|
|
7287
|
+
if (!isReadOnlyHttpMethod(options.method)) {
|
|
7288
|
+
assertDestructiveActionsEnabled(global, "raw API write request");
|
|
7289
|
+
}
|
|
7197
7290
|
const connection = await resolveConnectionConfig(global);
|
|
7198
7291
|
const client = new GhostClient({
|
|
7199
7292
|
url: connection.url,
|
|
@@ -7212,9 +7305,22 @@ async function callApi(global, options) {
|
|
|
7212
7305
|
);
|
|
7213
7306
|
return payload;
|
|
7214
7307
|
}
|
|
7308
|
+
async function listConfiguredSites() {
|
|
7309
|
+
const config = await readUserConfig();
|
|
7310
|
+
const sites = Object.entries(config.sites).map(([alias, site]) => ({
|
|
7311
|
+
alias,
|
|
7312
|
+
url: site.url,
|
|
7313
|
+
apiVersion: site.apiVersion,
|
|
7314
|
+
active: config.active === alias
|
|
7315
|
+
}));
|
|
7316
|
+
return { sites };
|
|
7317
|
+
}
|
|
7215
7318
|
function registerCoreTools(server, global, enabledGroups) {
|
|
7216
7319
|
if (enabledGroups.has("posts")) {
|
|
7217
|
-
|
|
7320
|
+
registerGroupedTool(
|
|
7321
|
+
server,
|
|
7322
|
+
global,
|
|
7323
|
+
"posts",
|
|
7218
7324
|
"ghost_post_list",
|
|
7219
7325
|
{
|
|
7220
7326
|
description: "List Ghost posts.",
|
|
@@ -7226,12 +7332,15 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7226
7332
|
include: z6.string().optional()
|
|
7227
7333
|
})
|
|
7228
7334
|
},
|
|
7229
|
-
async (args) => {
|
|
7230
|
-
const payload = await listPosts(
|
|
7335
|
+
async (global2, args) => {
|
|
7336
|
+
const payload = await listPosts(global2, { ...args }, false);
|
|
7231
7337
|
return toolResult(payload);
|
|
7232
7338
|
}
|
|
7233
7339
|
);
|
|
7234
|
-
|
|
7340
|
+
registerGroupedTool(
|
|
7341
|
+
server,
|
|
7342
|
+
global,
|
|
7343
|
+
"posts",
|
|
7235
7344
|
"ghost_post_get",
|
|
7236
7345
|
{
|
|
7237
7346
|
description: "Get a Ghost post by id or slug.",
|
|
@@ -7241,8 +7350,8 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7241
7350
|
include: z6.string().optional()
|
|
7242
7351
|
})
|
|
7243
7352
|
},
|
|
7244
|
-
async (args) => {
|
|
7245
|
-
const payload = await getPost(
|
|
7353
|
+
async (global2, args) => {
|
|
7354
|
+
const payload = await getPost(global2, args.slug ?? args.id ?? "", {
|
|
7246
7355
|
bySlug: Boolean(args.slug),
|
|
7247
7356
|
params: {
|
|
7248
7357
|
include: args.include
|
|
@@ -7251,7 +7360,10 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7251
7360
|
return toolResult(payload);
|
|
7252
7361
|
}
|
|
7253
7362
|
);
|
|
7254
|
-
|
|
7363
|
+
registerGroupedTool(
|
|
7364
|
+
server,
|
|
7365
|
+
global,
|
|
7366
|
+
"posts",
|
|
7255
7367
|
"ghost_post_create",
|
|
7256
7368
|
{
|
|
7257
7369
|
description: "Create a Ghost post.",
|
|
@@ -7264,9 +7376,9 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7264
7376
|
visibility: z6.enum(["public", "members", "paid", "tiers"]).optional()
|
|
7265
7377
|
})
|
|
7266
7378
|
},
|
|
7267
|
-
async (args) => {
|
|
7379
|
+
async (global2, args) => {
|
|
7268
7380
|
const payload = await createPost(
|
|
7269
|
-
|
|
7381
|
+
global2,
|
|
7270
7382
|
{
|
|
7271
7383
|
title: args.title,
|
|
7272
7384
|
html: args.html,
|
|
@@ -7280,7 +7392,10 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7280
7392
|
return toolResult(payload);
|
|
7281
7393
|
}
|
|
7282
7394
|
);
|
|
7283
|
-
|
|
7395
|
+
registerGroupedTool(
|
|
7396
|
+
server,
|
|
7397
|
+
global,
|
|
7398
|
+
"posts",
|
|
7284
7399
|
"ghost_post_update",
|
|
7285
7400
|
{
|
|
7286
7401
|
description: "Update a Ghost post by id or slug.",
|
|
@@ -7295,8 +7410,8 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7295
7410
|
visibility: z6.enum(["public", "members", "paid", "tiers"]).optional()
|
|
7296
7411
|
})
|
|
7297
7412
|
},
|
|
7298
|
-
async (args) => {
|
|
7299
|
-
const payload = await updatePost(
|
|
7413
|
+
async (global2, args) => {
|
|
7414
|
+
const payload = await updatePost(global2, {
|
|
7300
7415
|
id: args.id,
|
|
7301
7416
|
slug: args.slug,
|
|
7302
7417
|
patch: {
|
|
@@ -7312,7 +7427,10 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7312
7427
|
return toolResult(payload);
|
|
7313
7428
|
}
|
|
7314
7429
|
);
|
|
7315
|
-
|
|
7430
|
+
registerGroupedTool(
|
|
7431
|
+
server,
|
|
7432
|
+
global,
|
|
7433
|
+
"posts",
|
|
7316
7434
|
"ghost_post_delete",
|
|
7317
7435
|
{
|
|
7318
7436
|
description: "Delete a Ghost post.",
|
|
@@ -7321,12 +7439,16 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7321
7439
|
confirm: z6.literal(true)
|
|
7322
7440
|
})
|
|
7323
7441
|
},
|
|
7324
|
-
async (args) => {
|
|
7325
|
-
|
|
7442
|
+
async (global2, args) => {
|
|
7443
|
+
assertDestructiveActionsEnabled(global2, "delete post");
|
|
7444
|
+
const payload = await deletePost(global2, args.id);
|
|
7326
7445
|
return toolResult(payload);
|
|
7327
7446
|
}
|
|
7328
7447
|
);
|
|
7329
|
-
|
|
7448
|
+
registerGroupedTool(
|
|
7449
|
+
server,
|
|
7450
|
+
global,
|
|
7451
|
+
"posts",
|
|
7330
7452
|
"ghost_post_publish",
|
|
7331
7453
|
{
|
|
7332
7454
|
description: "Publish a Ghost post.",
|
|
@@ -7334,12 +7456,15 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7334
7456
|
id: z6.string()
|
|
7335
7457
|
})
|
|
7336
7458
|
},
|
|
7337
|
-
async (args) => {
|
|
7338
|
-
const payload = await publishPost(
|
|
7459
|
+
async (global2, args) => {
|
|
7460
|
+
const payload = await publishPost(global2, args.id);
|
|
7339
7461
|
return toolResult(payload);
|
|
7340
7462
|
}
|
|
7341
7463
|
);
|
|
7342
|
-
|
|
7464
|
+
registerGroupedTool(
|
|
7465
|
+
server,
|
|
7466
|
+
global,
|
|
7467
|
+
"posts",
|
|
7343
7468
|
"ghost_post_schedule",
|
|
7344
7469
|
{
|
|
7345
7470
|
description: "Schedule a Ghost post, with optional email delivery settings.",
|
|
@@ -7351,8 +7476,8 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7351
7476
|
email_segment: z6.string().optional()
|
|
7352
7477
|
})
|
|
7353
7478
|
},
|
|
7354
|
-
async (args) => {
|
|
7355
|
-
const payload = await schedulePost(
|
|
7479
|
+
async (global2, args) => {
|
|
7480
|
+
const payload = await schedulePost(global2, args.id, args.at, {
|
|
7356
7481
|
newsletter: args.newsletter,
|
|
7357
7482
|
email_only: args.email_only,
|
|
7358
7483
|
email_segment: args.email_segment
|
|
@@ -7360,7 +7485,10 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7360
7485
|
return toolResult(payload);
|
|
7361
7486
|
}
|
|
7362
7487
|
);
|
|
7363
|
-
|
|
7488
|
+
registerGroupedTool(
|
|
7489
|
+
server,
|
|
7490
|
+
global,
|
|
7491
|
+
"posts",
|
|
7364
7492
|
"ghost_image_upload",
|
|
7365
7493
|
{
|
|
7366
7494
|
description: "Upload an image and return the uploaded image payload.",
|
|
@@ -7370,8 +7498,8 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7370
7498
|
ref: z6.string().optional()
|
|
7371
7499
|
})
|
|
7372
7500
|
},
|
|
7373
|
-
async (args) => toolResult(
|
|
7374
|
-
await uploadImage(
|
|
7501
|
+
async (global2, args) => toolResult(
|
|
7502
|
+
await uploadImage(global2, {
|
|
7375
7503
|
filePath: args.file_path,
|
|
7376
7504
|
purpose: args.purpose,
|
|
7377
7505
|
ref: args.ref
|
|
@@ -7380,7 +7508,10 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7380
7508
|
);
|
|
7381
7509
|
}
|
|
7382
7510
|
if (enabledGroups.has("pages")) {
|
|
7383
|
-
|
|
7511
|
+
registerGroupedTool(
|
|
7512
|
+
server,
|
|
7513
|
+
global,
|
|
7514
|
+
"pages",
|
|
7384
7515
|
"ghost_page_list",
|
|
7385
7516
|
{
|
|
7386
7517
|
description: "List Ghost pages.",
|
|
@@ -7392,12 +7523,15 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7392
7523
|
include: z6.string().optional()
|
|
7393
7524
|
})
|
|
7394
7525
|
},
|
|
7395
|
-
async (args) => {
|
|
7396
|
-
const payload = await listPages(
|
|
7526
|
+
async (global2, args) => {
|
|
7527
|
+
const payload = await listPages(global2, { ...args }, false);
|
|
7397
7528
|
return toolResult(payload);
|
|
7398
7529
|
}
|
|
7399
7530
|
);
|
|
7400
|
-
|
|
7531
|
+
registerGroupedTool(
|
|
7532
|
+
server,
|
|
7533
|
+
global,
|
|
7534
|
+
"pages",
|
|
7401
7535
|
"ghost_page_get",
|
|
7402
7536
|
{
|
|
7403
7537
|
description: "Get a Ghost page by id or slug.",
|
|
@@ -7407,8 +7541,8 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7407
7541
|
include: z6.string().optional()
|
|
7408
7542
|
})
|
|
7409
7543
|
},
|
|
7410
|
-
async (args) => {
|
|
7411
|
-
const payload = await getPage(
|
|
7544
|
+
async (global2, args) => {
|
|
7545
|
+
const payload = await getPage(global2, args.slug ?? args.id ?? "", {
|
|
7412
7546
|
bySlug: Boolean(args.slug),
|
|
7413
7547
|
params: {
|
|
7414
7548
|
include: args.include
|
|
@@ -7417,7 +7551,10 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7417
7551
|
return toolResult(payload);
|
|
7418
7552
|
}
|
|
7419
7553
|
);
|
|
7420
|
-
|
|
7554
|
+
registerGroupedTool(
|
|
7555
|
+
server,
|
|
7556
|
+
global,
|
|
7557
|
+
"pages",
|
|
7421
7558
|
"ghost_page_create",
|
|
7422
7559
|
{
|
|
7423
7560
|
description: "Create a Ghost page.",
|
|
@@ -7429,9 +7566,9 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7429
7566
|
visibility: z6.enum(["public", "members", "paid", "tiers"]).optional()
|
|
7430
7567
|
})
|
|
7431
7568
|
},
|
|
7432
|
-
async (args) => {
|
|
7569
|
+
async (global2, args) => {
|
|
7433
7570
|
const payload = await createPage(
|
|
7434
|
-
|
|
7571
|
+
global2,
|
|
7435
7572
|
{
|
|
7436
7573
|
title: args.title,
|
|
7437
7574
|
html: args.html,
|
|
@@ -7444,7 +7581,10 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7444
7581
|
return toolResult(payload);
|
|
7445
7582
|
}
|
|
7446
7583
|
);
|
|
7447
|
-
|
|
7584
|
+
registerGroupedTool(
|
|
7585
|
+
server,
|
|
7586
|
+
global,
|
|
7587
|
+
"pages",
|
|
7448
7588
|
"ghost_page_update",
|
|
7449
7589
|
{
|
|
7450
7590
|
description: "Update a Ghost page by id or slug.",
|
|
@@ -7458,8 +7598,8 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7458
7598
|
visibility: z6.enum(["public", "members", "paid", "tiers"]).optional()
|
|
7459
7599
|
})
|
|
7460
7600
|
},
|
|
7461
|
-
async (args) => {
|
|
7462
|
-
const payload = await updatePage(
|
|
7601
|
+
async (global2, args) => {
|
|
7602
|
+
const payload = await updatePage(global2, {
|
|
7463
7603
|
id: args.id,
|
|
7464
7604
|
slug: args.slug,
|
|
7465
7605
|
patch: {
|
|
@@ -7474,7 +7614,10 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7474
7614
|
return toolResult(payload);
|
|
7475
7615
|
}
|
|
7476
7616
|
);
|
|
7477
|
-
|
|
7617
|
+
registerGroupedTool(
|
|
7618
|
+
server,
|
|
7619
|
+
global,
|
|
7620
|
+
"pages",
|
|
7478
7621
|
"ghost_page_delete",
|
|
7479
7622
|
{
|
|
7480
7623
|
description: "Delete a Ghost page.",
|
|
@@ -7483,14 +7626,18 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7483
7626
|
confirm: z6.literal(true)
|
|
7484
7627
|
})
|
|
7485
7628
|
},
|
|
7486
|
-
async (args) => {
|
|
7487
|
-
|
|
7629
|
+
async (global2, args) => {
|
|
7630
|
+
assertDestructiveActionsEnabled(global2, "delete page");
|
|
7631
|
+
const payload = await deletePage(global2, args.id);
|
|
7488
7632
|
return toolResult(payload);
|
|
7489
7633
|
}
|
|
7490
7634
|
);
|
|
7491
7635
|
}
|
|
7492
7636
|
if (enabledGroups.has("tags")) {
|
|
7493
|
-
|
|
7637
|
+
registerGroupedTool(
|
|
7638
|
+
server,
|
|
7639
|
+
global,
|
|
7640
|
+
"tags",
|
|
7494
7641
|
"ghost_tag_list",
|
|
7495
7642
|
{
|
|
7496
7643
|
description: "List Ghost tags.",
|
|
@@ -7500,9 +7647,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7500
7647
|
filter: z6.string().optional()
|
|
7501
7648
|
})
|
|
7502
7649
|
},
|
|
7503
|
-
async (args) => toolResult(await listTags(
|
|
7650
|
+
async (global2, args) => toolResult(await listTags(global2, { ...args }, false))
|
|
7504
7651
|
);
|
|
7505
|
-
|
|
7652
|
+
registerGroupedTool(
|
|
7653
|
+
server,
|
|
7654
|
+
global,
|
|
7655
|
+
"tags",
|
|
7506
7656
|
"ghost_tag_get",
|
|
7507
7657
|
{
|
|
7508
7658
|
description: "Get a Ghost tag by id or slug.",
|
|
@@ -7511,13 +7661,16 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7511
7661
|
slug: z6.string().optional()
|
|
7512
7662
|
})
|
|
7513
7663
|
},
|
|
7514
|
-
async (args) => toolResult(
|
|
7515
|
-
await getTag(
|
|
7664
|
+
async (global2, args) => toolResult(
|
|
7665
|
+
await getTag(global2, args.slug ?? args.id ?? "", {
|
|
7516
7666
|
bySlug: Boolean(args.slug)
|
|
7517
7667
|
})
|
|
7518
7668
|
)
|
|
7519
7669
|
);
|
|
7520
|
-
|
|
7670
|
+
registerGroupedTool(
|
|
7671
|
+
server,
|
|
7672
|
+
global,
|
|
7673
|
+
"tags",
|
|
7521
7674
|
"ghost_tag_create",
|
|
7522
7675
|
{
|
|
7523
7676
|
description: "Create a Ghost tag.",
|
|
@@ -7527,9 +7680,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7527
7680
|
description: z6.string().optional()
|
|
7528
7681
|
})
|
|
7529
7682
|
},
|
|
7530
|
-
async (args) => toolResult(await createTag(
|
|
7683
|
+
async (global2, args) => toolResult(await createTag(global2, args))
|
|
7531
7684
|
);
|
|
7532
|
-
|
|
7685
|
+
registerGroupedTool(
|
|
7686
|
+
server,
|
|
7687
|
+
global,
|
|
7688
|
+
"tags",
|
|
7533
7689
|
"ghost_tag_update",
|
|
7534
7690
|
{
|
|
7535
7691
|
description: "Update a Ghost tag.",
|
|
@@ -7540,8 +7696,8 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7540
7696
|
description: z6.string().optional()
|
|
7541
7697
|
})
|
|
7542
7698
|
},
|
|
7543
|
-
async (args) => toolResult(
|
|
7544
|
-
await updateTag(
|
|
7699
|
+
async (global2, args) => toolResult(
|
|
7700
|
+
await updateTag(global2, {
|
|
7545
7701
|
id: args.id,
|
|
7546
7702
|
slug: args.slug,
|
|
7547
7703
|
patch: {
|
|
@@ -7551,7 +7707,10 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7551
7707
|
})
|
|
7552
7708
|
)
|
|
7553
7709
|
);
|
|
7554
|
-
|
|
7710
|
+
registerGroupedTool(
|
|
7711
|
+
server,
|
|
7712
|
+
global,
|
|
7713
|
+
"tags",
|
|
7555
7714
|
"ghost_tag_delete",
|
|
7556
7715
|
{
|
|
7557
7716
|
description: "Delete a Ghost tag.",
|
|
@@ -7560,11 +7719,17 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7560
7719
|
confirm: z6.literal(true)
|
|
7561
7720
|
})
|
|
7562
7721
|
},
|
|
7563
|
-
async (args) =>
|
|
7722
|
+
async (global2, args) => {
|
|
7723
|
+
assertDestructiveActionsEnabled(global2, "delete tag");
|
|
7724
|
+
return toolResult(await deleteTag(global2, args.id));
|
|
7725
|
+
}
|
|
7564
7726
|
);
|
|
7565
7727
|
}
|
|
7566
7728
|
if (enabledGroups.has("members")) {
|
|
7567
|
-
|
|
7729
|
+
registerGroupedTool(
|
|
7730
|
+
server,
|
|
7731
|
+
global,
|
|
7732
|
+
"members",
|
|
7568
7733
|
"ghost_member_list",
|
|
7569
7734
|
{
|
|
7570
7735
|
description: "List Ghost members.",
|
|
@@ -7575,9 +7740,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7575
7740
|
search: z6.string().optional()
|
|
7576
7741
|
})
|
|
7577
7742
|
},
|
|
7578
|
-
async (args) => toolResult(await listMembers(
|
|
7743
|
+
async (global2, args) => toolResult(await listMembers(global2, { ...args }, false))
|
|
7579
7744
|
);
|
|
7580
|
-
|
|
7745
|
+
registerGroupedTool(
|
|
7746
|
+
server,
|
|
7747
|
+
global,
|
|
7748
|
+
"members",
|
|
7581
7749
|
"ghost_member_get",
|
|
7582
7750
|
{
|
|
7583
7751
|
description: "Get Ghost member by id or email.",
|
|
@@ -7586,14 +7754,17 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7586
7754
|
email: z6.string().optional()
|
|
7587
7755
|
})
|
|
7588
7756
|
},
|
|
7589
|
-
async (args) => toolResult(
|
|
7590
|
-
await getMember(
|
|
7757
|
+
async (global2, args) => toolResult(
|
|
7758
|
+
await getMember(global2, {
|
|
7591
7759
|
id: args.id,
|
|
7592
7760
|
email: args.email
|
|
7593
7761
|
})
|
|
7594
7762
|
)
|
|
7595
7763
|
);
|
|
7596
|
-
|
|
7764
|
+
registerGroupedTool(
|
|
7765
|
+
server,
|
|
7766
|
+
global,
|
|
7767
|
+
"members",
|
|
7597
7768
|
"ghost_member_create",
|
|
7598
7769
|
{
|
|
7599
7770
|
description: "Create Ghost member.",
|
|
@@ -7604,8 +7775,8 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7604
7775
|
newsletters: z6.array(z6.string()).optional()
|
|
7605
7776
|
})
|
|
7606
7777
|
},
|
|
7607
|
-
async (args) => toolResult(
|
|
7608
|
-
await createMember(
|
|
7778
|
+
async (global2, args) => toolResult(
|
|
7779
|
+
await createMember(global2, {
|
|
7609
7780
|
email: args.email,
|
|
7610
7781
|
name: args.name,
|
|
7611
7782
|
labels: args.labels,
|
|
@@ -7613,7 +7784,10 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7613
7784
|
})
|
|
7614
7785
|
)
|
|
7615
7786
|
);
|
|
7616
|
-
|
|
7787
|
+
registerGroupedTool(
|
|
7788
|
+
server,
|
|
7789
|
+
global,
|
|
7790
|
+
"members",
|
|
7617
7791
|
"ghost_member_update",
|
|
7618
7792
|
{
|
|
7619
7793
|
description: "Update Ghost member.",
|
|
@@ -7624,8 +7798,8 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7624
7798
|
note: z6.string().optional()
|
|
7625
7799
|
})
|
|
7626
7800
|
},
|
|
7627
|
-
async (args) => toolResult(
|
|
7628
|
-
await updateMember(
|
|
7801
|
+
async (global2, args) => toolResult(
|
|
7802
|
+
await updateMember(global2, {
|
|
7629
7803
|
id: args.id,
|
|
7630
7804
|
email: args.email,
|
|
7631
7805
|
patch: {
|
|
@@ -7635,7 +7809,10 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7635
7809
|
})
|
|
7636
7810
|
)
|
|
7637
7811
|
);
|
|
7638
|
-
|
|
7812
|
+
registerGroupedTool(
|
|
7813
|
+
server,
|
|
7814
|
+
global,
|
|
7815
|
+
"members",
|
|
7639
7816
|
"ghost_member_delete",
|
|
7640
7817
|
{
|
|
7641
7818
|
description: "Delete Ghost member.",
|
|
@@ -7644,9 +7821,15 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7644
7821
|
confirm: z6.literal(true)
|
|
7645
7822
|
})
|
|
7646
7823
|
},
|
|
7647
|
-
async (args) =>
|
|
7824
|
+
async (global2, args) => {
|
|
7825
|
+
assertDestructiveActionsEnabled(global2, "delete member");
|
|
7826
|
+
return toolResult(await deleteMember(global2, args.id));
|
|
7827
|
+
}
|
|
7648
7828
|
);
|
|
7649
|
-
|
|
7829
|
+
registerGroupedTool(
|
|
7830
|
+
server,
|
|
7831
|
+
global,
|
|
7832
|
+
"members",
|
|
7650
7833
|
"ghost_member_import",
|
|
7651
7834
|
{
|
|
7652
7835
|
description: "Import members from a CSV file path.",
|
|
@@ -7655,14 +7838,17 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7655
7838
|
labels: z6.array(z6.string()).optional()
|
|
7656
7839
|
})
|
|
7657
7840
|
},
|
|
7658
|
-
async (args) => toolResult(
|
|
7659
|
-
await importMembersCsv(
|
|
7841
|
+
async (global2, args) => toolResult(
|
|
7842
|
+
await importMembersCsv(global2, {
|
|
7660
7843
|
filePath: args.file_path,
|
|
7661
7844
|
labels: args.labels
|
|
7662
7845
|
})
|
|
7663
7846
|
)
|
|
7664
7847
|
);
|
|
7665
|
-
|
|
7848
|
+
registerGroupedTool(
|
|
7849
|
+
server,
|
|
7850
|
+
global,
|
|
7851
|
+
"members",
|
|
7666
7852
|
"ghost_newsletter_list",
|
|
7667
7853
|
{
|
|
7668
7854
|
description: "List Ghost newsletters.",
|
|
@@ -7672,9 +7858,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7672
7858
|
filter: z6.string().optional()
|
|
7673
7859
|
})
|
|
7674
7860
|
},
|
|
7675
|
-
async (args) => toolResult(await listNewsletters(
|
|
7861
|
+
async (global2, args) => toolResult(await listNewsletters(global2, { ...args }, false))
|
|
7676
7862
|
);
|
|
7677
|
-
|
|
7863
|
+
registerGroupedTool(
|
|
7864
|
+
server,
|
|
7865
|
+
global,
|
|
7866
|
+
"members",
|
|
7678
7867
|
"ghost_tier_list",
|
|
7679
7868
|
{
|
|
7680
7869
|
description: "List Ghost tiers.",
|
|
@@ -7684,9 +7873,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7684
7873
|
filter: z6.string().optional()
|
|
7685
7874
|
})
|
|
7686
7875
|
},
|
|
7687
|
-
async (args) => toolResult(await listTiers(
|
|
7876
|
+
async (global2, args) => toolResult(await listTiers(global2, { ...args }, false))
|
|
7688
7877
|
);
|
|
7689
|
-
|
|
7878
|
+
registerGroupedTool(
|
|
7879
|
+
server,
|
|
7880
|
+
global,
|
|
7881
|
+
"members",
|
|
7690
7882
|
"ghost_offer_list",
|
|
7691
7883
|
{
|
|
7692
7884
|
description: "List Ghost offers.",
|
|
@@ -7696,11 +7888,14 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7696
7888
|
filter: z6.string().optional()
|
|
7697
7889
|
})
|
|
7698
7890
|
},
|
|
7699
|
-
async (args) => toolResult(await listOffers(
|
|
7891
|
+
async (global2, args) => toolResult(await listOffers(global2, { ...args }, false))
|
|
7700
7892
|
);
|
|
7701
7893
|
}
|
|
7702
7894
|
if (enabledGroups.has("comments")) {
|
|
7703
|
-
|
|
7895
|
+
registerGroupedTool(
|
|
7896
|
+
server,
|
|
7897
|
+
global,
|
|
7898
|
+
"comments",
|
|
7704
7899
|
"ghost_comment_list",
|
|
7705
7900
|
{
|
|
7706
7901
|
description: "List Ghost comments from the Admin moderation view.",
|
|
@@ -7710,9 +7905,9 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7710
7905
|
top_level_only: z6.boolean().optional()
|
|
7711
7906
|
})
|
|
7712
7907
|
},
|
|
7713
|
-
async (args) => toolResult(
|
|
7908
|
+
async (global2, args) => toolResult(
|
|
7714
7909
|
await listComments(
|
|
7715
|
-
|
|
7910
|
+
global2,
|
|
7716
7911
|
{
|
|
7717
7912
|
limit: args.limit,
|
|
7718
7913
|
page: args.page,
|
|
@@ -7724,7 +7919,10 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7724
7919
|
)
|
|
7725
7920
|
)
|
|
7726
7921
|
);
|
|
7727
|
-
|
|
7922
|
+
registerGroupedTool(
|
|
7923
|
+
server,
|
|
7924
|
+
global,
|
|
7925
|
+
"comments",
|
|
7728
7926
|
"ghost_comment_get",
|
|
7729
7927
|
{
|
|
7730
7928
|
description: "Get a Ghost comment with Admin moderation fields.",
|
|
@@ -7732,9 +7930,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7732
7930
|
id: z6.string()
|
|
7733
7931
|
})
|
|
7734
7932
|
},
|
|
7735
|
-
async (args) => toolResult(await getComment(
|
|
7933
|
+
async (global2, args) => toolResult(await getComment(global2, args.id))
|
|
7736
7934
|
);
|
|
7737
|
-
|
|
7935
|
+
registerGroupedTool(
|
|
7936
|
+
server,
|
|
7937
|
+
global,
|
|
7938
|
+
"comments",
|
|
7738
7939
|
"ghost_comment_thread",
|
|
7739
7940
|
{
|
|
7740
7941
|
description: "Get a Ghost comment thread using the Admin moderation thread view.",
|
|
@@ -7742,9 +7943,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7742
7943
|
id: z6.string()
|
|
7743
7944
|
})
|
|
7744
7945
|
},
|
|
7745
|
-
async (args) => toolResult(await getCommentThread(
|
|
7946
|
+
async (global2, args) => toolResult(await getCommentThread(global2, args.id))
|
|
7746
7947
|
);
|
|
7747
|
-
|
|
7948
|
+
registerGroupedTool(
|
|
7949
|
+
server,
|
|
7950
|
+
global,
|
|
7951
|
+
"comments",
|
|
7748
7952
|
"ghost_comment_replies",
|
|
7749
7953
|
{
|
|
7750
7954
|
description: "List replies for a Ghost comment using the raw replies endpoint.",
|
|
@@ -7753,9 +7957,9 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7753
7957
|
...commentBrowseArgs
|
|
7754
7958
|
})
|
|
7755
7959
|
},
|
|
7756
|
-
async (args) => toolResult(
|
|
7960
|
+
async (global2, args) => toolResult(
|
|
7757
7961
|
await listCommentReplies(
|
|
7758
|
-
|
|
7962
|
+
global2,
|
|
7759
7963
|
args.id,
|
|
7760
7964
|
{
|
|
7761
7965
|
limit: args.limit,
|
|
@@ -7766,7 +7970,10 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7766
7970
|
)
|
|
7767
7971
|
)
|
|
7768
7972
|
);
|
|
7769
|
-
|
|
7973
|
+
registerGroupedTool(
|
|
7974
|
+
server,
|
|
7975
|
+
global,
|
|
7976
|
+
"comments",
|
|
7770
7977
|
"ghost_comment_likes",
|
|
7771
7978
|
{
|
|
7772
7979
|
description: "List likes for a Ghost comment.",
|
|
@@ -7776,9 +7983,9 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7776
7983
|
page: z6.number().int().positive().optional()
|
|
7777
7984
|
})
|
|
7778
7985
|
},
|
|
7779
|
-
async (args) => toolResult(
|
|
7986
|
+
async (global2, args) => toolResult(
|
|
7780
7987
|
await listCommentLikes(
|
|
7781
|
-
|
|
7988
|
+
global2,
|
|
7782
7989
|
args.id,
|
|
7783
7990
|
{
|
|
7784
7991
|
limit: args.limit,
|
|
@@ -7788,7 +7995,10 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7788
7995
|
)
|
|
7789
7996
|
)
|
|
7790
7997
|
);
|
|
7791
|
-
|
|
7998
|
+
registerGroupedTool(
|
|
7999
|
+
server,
|
|
8000
|
+
global,
|
|
8001
|
+
"comments",
|
|
7792
8002
|
"ghost_comment_reports",
|
|
7793
8003
|
{
|
|
7794
8004
|
description: "List reports for a Ghost comment.",
|
|
@@ -7798,9 +8008,9 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7798
8008
|
page: z6.number().int().positive().optional()
|
|
7799
8009
|
})
|
|
7800
8010
|
},
|
|
7801
|
-
async (args) => toolResult(
|
|
8011
|
+
async (global2, args) => toolResult(
|
|
7802
8012
|
await listCommentReports(
|
|
7803
|
-
|
|
8013
|
+
global2,
|
|
7804
8014
|
args.id,
|
|
7805
8015
|
{
|
|
7806
8016
|
limit: args.limit,
|
|
@@ -7810,7 +8020,10 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7810
8020
|
)
|
|
7811
8021
|
)
|
|
7812
8022
|
);
|
|
7813
|
-
|
|
8023
|
+
registerGroupedTool(
|
|
8024
|
+
server,
|
|
8025
|
+
global,
|
|
8026
|
+
"comments",
|
|
7814
8027
|
"ghost_comment_hide",
|
|
7815
8028
|
{
|
|
7816
8029
|
description: "Hide a Ghost comment.",
|
|
@@ -7818,9 +8031,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7818
8031
|
id: z6.string()
|
|
7819
8032
|
})
|
|
7820
8033
|
},
|
|
7821
|
-
async (args) => toolResult(await setCommentStatus(
|
|
8034
|
+
async (global2, args) => toolResult(await setCommentStatus(global2, args.id, "hidden"))
|
|
7822
8035
|
);
|
|
7823
|
-
|
|
8036
|
+
registerGroupedTool(
|
|
8037
|
+
server,
|
|
8038
|
+
global,
|
|
8039
|
+
"comments",
|
|
7824
8040
|
"ghost_comment_show",
|
|
7825
8041
|
{
|
|
7826
8042
|
description: "Show a previously hidden Ghost comment.",
|
|
@@ -7828,9 +8044,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7828
8044
|
id: z6.string()
|
|
7829
8045
|
})
|
|
7830
8046
|
},
|
|
7831
|
-
async (args) => toolResult(await setCommentStatus(
|
|
8047
|
+
async (global2, args) => toolResult(await setCommentStatus(global2, args.id, "published"))
|
|
7832
8048
|
);
|
|
7833
|
-
|
|
8049
|
+
registerGroupedTool(
|
|
8050
|
+
server,
|
|
8051
|
+
global,
|
|
8052
|
+
"comments",
|
|
7834
8053
|
"ghost_comment_delete",
|
|
7835
8054
|
{
|
|
7836
8055
|
description: "Soft-delete a Ghost comment.",
|
|
@@ -7839,18 +8058,37 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7839
8058
|
confirm: z6.literal(true)
|
|
7840
8059
|
})
|
|
7841
8060
|
},
|
|
7842
|
-
async (args) =>
|
|
8061
|
+
async (global2, args) => {
|
|
8062
|
+
assertDestructiveActionsEnabled(global2, "delete comment");
|
|
8063
|
+
return toolResult(await setCommentStatus(global2, args.id, "deleted"));
|
|
8064
|
+
}
|
|
7843
8065
|
);
|
|
7844
8066
|
}
|
|
7845
8067
|
if (enabledGroups.has("site")) {
|
|
7846
|
-
|
|
8068
|
+
registerGroupedTool(
|
|
8069
|
+
server,
|
|
8070
|
+
global,
|
|
8071
|
+
"site",
|
|
7847
8072
|
"ghost_site_info",
|
|
7848
8073
|
{
|
|
7849
8074
|
description: "Get Ghost site metadata."
|
|
7850
8075
|
},
|
|
7851
|
-
async () => toolResult(await getSiteInfo(
|
|
8076
|
+
async (global2) => toolResult(await getSiteInfo(global2))
|
|
8077
|
+
);
|
|
8078
|
+
registerGroupedTool(
|
|
8079
|
+
server,
|
|
8080
|
+
global,
|
|
8081
|
+
"site",
|
|
8082
|
+
"ghost_site_list",
|
|
8083
|
+
{
|
|
8084
|
+
description: "List configured Ghost site aliases without credentials."
|
|
8085
|
+
},
|
|
8086
|
+
async () => toolResult(await listConfiguredSites())
|
|
7852
8087
|
);
|
|
7853
|
-
|
|
8088
|
+
registerGroupedTool(
|
|
8089
|
+
server,
|
|
8090
|
+
global,
|
|
8091
|
+
"site",
|
|
7854
8092
|
"ghost_theme_upload",
|
|
7855
8093
|
{
|
|
7856
8094
|
description: "Upload a Ghost theme zip path and optionally activate it.",
|
|
@@ -7859,20 +8097,23 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7859
8097
|
activate: z6.boolean().optional()
|
|
7860
8098
|
})
|
|
7861
8099
|
},
|
|
7862
|
-
async (args) => {
|
|
7863
|
-
const payload = await uploadTheme(
|
|
8100
|
+
async (global2, args) => {
|
|
8101
|
+
const payload = await uploadTheme(global2, args.file_path);
|
|
7864
8102
|
let resultPayload = payload;
|
|
7865
8103
|
if (args.activate) {
|
|
7866
8104
|
const name = getUploadedThemeName(payload);
|
|
7867
8105
|
if (!name) {
|
|
7868
8106
|
throw new Error("Theme uploaded, but activation could not determine the theme name.");
|
|
7869
8107
|
}
|
|
7870
|
-
resultPayload = await activateTheme(
|
|
8108
|
+
resultPayload = await activateTheme(global2, name);
|
|
7871
8109
|
}
|
|
7872
8110
|
return toolResult(resultPayload);
|
|
7873
8111
|
}
|
|
7874
8112
|
);
|
|
7875
|
-
|
|
8113
|
+
registerGroupedTool(
|
|
8114
|
+
server,
|
|
8115
|
+
global,
|
|
8116
|
+
"site",
|
|
7876
8117
|
"ghost_webhook_create",
|
|
7877
8118
|
{
|
|
7878
8119
|
description: "Create a Ghost webhook.",
|
|
@@ -7884,8 +8125,8 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7884
8125
|
api_version: z6.string().optional()
|
|
7885
8126
|
})
|
|
7886
8127
|
},
|
|
7887
|
-
async (args) => toolResult(
|
|
7888
|
-
await createWebhook(
|
|
8128
|
+
async (global2, args) => toolResult(
|
|
8129
|
+
await createWebhook(global2, {
|
|
7889
8130
|
event: args.event,
|
|
7890
8131
|
target_url: args.target_url,
|
|
7891
8132
|
name: args.name,
|
|
@@ -7896,14 +8137,20 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7896
8137
|
);
|
|
7897
8138
|
}
|
|
7898
8139
|
if (enabledGroups.has("settings")) {
|
|
7899
|
-
|
|
8140
|
+
registerGroupedTool(
|
|
8141
|
+
server,
|
|
8142
|
+
global,
|
|
8143
|
+
"settings",
|
|
7900
8144
|
"ghost_setting_list",
|
|
7901
8145
|
{
|
|
7902
8146
|
description: "List Ghost settings."
|
|
7903
8147
|
},
|
|
7904
|
-
async () => toolResult(await listSettings(
|
|
8148
|
+
async (global2) => toolResult(await listSettings(global2))
|
|
7905
8149
|
);
|
|
7906
|
-
|
|
8150
|
+
registerGroupedTool(
|
|
8151
|
+
server,
|
|
8152
|
+
global,
|
|
8153
|
+
"settings",
|
|
7907
8154
|
"ghost_setting_get",
|
|
7908
8155
|
{
|
|
7909
8156
|
description: "Get a Ghost setting by key.",
|
|
@@ -7911,9 +8158,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7911
8158
|
key: z6.string()
|
|
7912
8159
|
})
|
|
7913
8160
|
},
|
|
7914
|
-
async (args) => toolResult(await getSetting(
|
|
8161
|
+
async (global2, args) => toolResult(await getSetting(global2, args.key))
|
|
7915
8162
|
);
|
|
7916
|
-
|
|
8163
|
+
registerGroupedTool(
|
|
8164
|
+
server,
|
|
8165
|
+
global,
|
|
8166
|
+
"settings",
|
|
7917
8167
|
"ghost_setting_set",
|
|
7918
8168
|
{
|
|
7919
8169
|
description: "Set a Ghost setting by key.",
|
|
@@ -7922,11 +8172,14 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7922
8172
|
value: z6.union([z6.string(), z6.number(), z6.boolean(), z6.null()])
|
|
7923
8173
|
})
|
|
7924
8174
|
},
|
|
7925
|
-
async (args) => toolResult(await setSetting(
|
|
8175
|
+
async (global2, args) => toolResult(await setSetting(global2, args.key, args.value))
|
|
7926
8176
|
);
|
|
7927
8177
|
}
|
|
7928
8178
|
if (enabledGroups.has("users")) {
|
|
7929
|
-
|
|
8179
|
+
registerGroupedTool(
|
|
8180
|
+
server,
|
|
8181
|
+
global,
|
|
8182
|
+
"users",
|
|
7930
8183
|
"ghost_user_list",
|
|
7931
8184
|
{
|
|
7932
8185
|
description: "List Ghost staff users.",
|
|
@@ -7935,11 +8188,14 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7935
8188
|
page: z6.number().int().positive().optional()
|
|
7936
8189
|
})
|
|
7937
8190
|
},
|
|
7938
|
-
async (args) => toolResult(await listUsers(
|
|
8191
|
+
async (global2, args) => toolResult(await listUsers(global2, { ...args }, false))
|
|
7939
8192
|
);
|
|
7940
8193
|
}
|
|
7941
8194
|
if (enabledGroups.has("api")) {
|
|
7942
|
-
|
|
8195
|
+
registerGroupedTool(
|
|
8196
|
+
server,
|
|
8197
|
+
global,
|
|
8198
|
+
"api",
|
|
7943
8199
|
"ghost_api_request",
|
|
7944
8200
|
{
|
|
7945
8201
|
description: "Run a raw Ghost API request.",
|
|
@@ -7951,8 +8207,8 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7951
8207
|
content_api: z6.boolean().optional()
|
|
7952
8208
|
})
|
|
7953
8209
|
},
|
|
7954
|
-
async (args) => toolResult(
|
|
7955
|
-
await callApi(
|
|
8210
|
+
async (global2, args) => toolResult(
|
|
8211
|
+
await callApi(global2, {
|
|
7956
8212
|
path: args.path,
|
|
7957
8213
|
method: args.method,
|
|
7958
8214
|
body: args.body,
|
|
@@ -7963,7 +8219,10 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7963
8219
|
);
|
|
7964
8220
|
}
|
|
7965
8221
|
if (enabledGroups.has("search")) {
|
|
7966
|
-
|
|
8222
|
+
registerGroupedTool(
|
|
8223
|
+
server,
|
|
8224
|
+
global,
|
|
8225
|
+
"search",
|
|
7967
8226
|
"ghost_search",
|
|
7968
8227
|
{
|
|
7969
8228
|
description: "Search posts, pages, tags and members.",
|
|
@@ -7972,32 +8231,44 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
7972
8231
|
limit: z6.number().int().positive().max(50).optional()
|
|
7973
8232
|
})
|
|
7974
8233
|
},
|
|
7975
|
-
async (args) => toolResult(await runSearch(
|
|
8234
|
+
async (global2, args) => toolResult(await runSearch(global2, args.query, args.limit ?? 10))
|
|
7976
8235
|
);
|
|
7977
8236
|
}
|
|
7978
8237
|
if (enabledGroups.has("socialweb")) {
|
|
7979
|
-
|
|
8238
|
+
registerGroupedTool(
|
|
8239
|
+
server,
|
|
8240
|
+
global,
|
|
8241
|
+
"socialweb",
|
|
7980
8242
|
"ghost_socialweb_status",
|
|
7981
8243
|
{
|
|
7982
8244
|
description: "Show Ghost social web settings and connectivity status."
|
|
7983
8245
|
},
|
|
7984
|
-
async () => toolResult(await getSocialWebStatus(
|
|
8246
|
+
async (global2) => toolResult(await getSocialWebStatus(global2))
|
|
7985
8247
|
);
|
|
7986
|
-
|
|
8248
|
+
registerGroupedTool(
|
|
8249
|
+
server,
|
|
8250
|
+
global,
|
|
8251
|
+
"socialweb",
|
|
7987
8252
|
"ghost_socialweb_enable",
|
|
7988
8253
|
{
|
|
7989
8254
|
description: "Enable Ghost social web and return the resulting status."
|
|
7990
8255
|
},
|
|
7991
|
-
async () => toolResult(await enableSocialWeb(
|
|
8256
|
+
async (global2) => toolResult(await enableSocialWeb(global2))
|
|
7992
8257
|
);
|
|
7993
|
-
|
|
8258
|
+
registerGroupedTool(
|
|
8259
|
+
server,
|
|
8260
|
+
global,
|
|
8261
|
+
"socialweb",
|
|
7994
8262
|
"ghost_socialweb_disable",
|
|
7995
8263
|
{
|
|
7996
8264
|
description: "Disable Ghost social web and return the resulting status."
|
|
7997
8265
|
},
|
|
7998
|
-
async () => toolResult(await disableSocialWeb(
|
|
8266
|
+
async (global2) => toolResult(await disableSocialWeb(global2))
|
|
7999
8267
|
);
|
|
8000
|
-
|
|
8268
|
+
registerGroupedTool(
|
|
8269
|
+
server,
|
|
8270
|
+
global,
|
|
8271
|
+
"socialweb",
|
|
8001
8272
|
"ghost_socialweb_profile",
|
|
8002
8273
|
{
|
|
8003
8274
|
description: "Get a social web profile by federated handle or me.",
|
|
@@ -8005,16 +8276,19 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8005
8276
|
handle: socialWebHandleSchema.optional()
|
|
8006
8277
|
})
|
|
8007
8278
|
},
|
|
8008
|
-
async (args) => toolResult(await getSocialWebProfile(
|
|
8279
|
+
async (global2, args) => toolResult(await getSocialWebProfile(global2, args.handle ?? "me"))
|
|
8009
8280
|
);
|
|
8010
|
-
|
|
8281
|
+
registerGroupedTool(
|
|
8282
|
+
server,
|
|
8283
|
+
global,
|
|
8284
|
+
"socialweb",
|
|
8011
8285
|
"ghost_socialweb_profile_update",
|
|
8012
8286
|
{
|
|
8013
8287
|
description: "Update the current social web profile.",
|
|
8014
8288
|
inputSchema: socialWebProfileUpdateSchema
|
|
8015
8289
|
},
|
|
8016
|
-
async (args) => toolResult(
|
|
8017
|
-
await updateSocialWebProfile(
|
|
8290
|
+
async (global2, args) => toolResult(
|
|
8291
|
+
await updateSocialWebProfile(global2, {
|
|
8018
8292
|
name: args.name,
|
|
8019
8293
|
username: args.username,
|
|
8020
8294
|
bio: args.bio,
|
|
@@ -8023,7 +8297,10 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8023
8297
|
})
|
|
8024
8298
|
)
|
|
8025
8299
|
);
|
|
8026
|
-
|
|
8300
|
+
registerGroupedTool(
|
|
8301
|
+
server,
|
|
8302
|
+
global,
|
|
8303
|
+
"socialweb",
|
|
8027
8304
|
"ghost_socialweb_search",
|
|
8028
8305
|
{
|
|
8029
8306
|
description: "Search social web accounts.",
|
|
@@ -8031,59 +8308,74 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8031
8308
|
query: z6.string().min(1)
|
|
8032
8309
|
})
|
|
8033
8310
|
},
|
|
8034
|
-
async (args) => toolResult(await searchSocialWeb(
|
|
8311
|
+
async (global2, args) => toolResult(await searchSocialWeb(global2, args.query))
|
|
8035
8312
|
);
|
|
8036
|
-
|
|
8313
|
+
registerGroupedTool(
|
|
8314
|
+
server,
|
|
8315
|
+
global,
|
|
8316
|
+
"socialweb",
|
|
8037
8317
|
"ghost_socialweb_notes",
|
|
8038
8318
|
{
|
|
8039
8319
|
description: "List the social web note feed.",
|
|
8040
8320
|
inputSchema: socialWebPaginationSchema
|
|
8041
8321
|
},
|
|
8042
|
-
async (args) => {
|
|
8322
|
+
async (global2, args) => {
|
|
8043
8323
|
const pagination = mapSocialWebPaginationArgs(args);
|
|
8044
|
-
return toolResult(await listNotes(
|
|
8324
|
+
return toolResult(await listNotes(global2, pagination.params, pagination.allPages));
|
|
8045
8325
|
}
|
|
8046
8326
|
);
|
|
8047
|
-
|
|
8327
|
+
registerGroupedTool(
|
|
8328
|
+
server,
|
|
8329
|
+
global,
|
|
8330
|
+
"socialweb",
|
|
8048
8331
|
"ghost_socialweb_reader",
|
|
8049
8332
|
{
|
|
8050
8333
|
description: "List the social web reader feed.",
|
|
8051
8334
|
inputSchema: socialWebPaginationSchema
|
|
8052
8335
|
},
|
|
8053
|
-
async (args) => {
|
|
8336
|
+
async (global2, args) => {
|
|
8054
8337
|
const pagination = mapSocialWebPaginationArgs(args);
|
|
8055
|
-
return toolResult(await listReader(
|
|
8338
|
+
return toolResult(await listReader(global2, pagination.params, pagination.allPages));
|
|
8056
8339
|
}
|
|
8057
8340
|
);
|
|
8058
|
-
|
|
8341
|
+
registerGroupedTool(
|
|
8342
|
+
server,
|
|
8343
|
+
global,
|
|
8344
|
+
"socialweb",
|
|
8059
8345
|
"ghost_socialweb_notifications",
|
|
8060
8346
|
{
|
|
8061
8347
|
description: "List social web notifications.",
|
|
8062
8348
|
inputSchema: socialWebPaginationSchema
|
|
8063
8349
|
},
|
|
8064
|
-
async (args) => {
|
|
8350
|
+
async (global2, args) => {
|
|
8065
8351
|
const pagination = mapSocialWebPaginationArgs(args);
|
|
8066
|
-
return toolResult(await listNotifications(
|
|
8352
|
+
return toolResult(await listNotifications(global2, pagination.params, pagination.allPages));
|
|
8067
8353
|
}
|
|
8068
8354
|
);
|
|
8069
|
-
|
|
8355
|
+
registerGroupedTool(
|
|
8356
|
+
server,
|
|
8357
|
+
global,
|
|
8358
|
+
"socialweb",
|
|
8070
8359
|
"ghost_socialweb_notifications_count",
|
|
8071
8360
|
{
|
|
8072
8361
|
description: "Get the unread social web notification count."
|
|
8073
8362
|
},
|
|
8074
|
-
async () => toolResult(await getNotificationsCount(
|
|
8363
|
+
async (global2) => toolResult(await getNotificationsCount(global2))
|
|
8075
8364
|
);
|
|
8076
|
-
|
|
8365
|
+
registerGroupedTool(
|
|
8366
|
+
server,
|
|
8367
|
+
global,
|
|
8368
|
+
"socialweb",
|
|
8077
8369
|
"ghost_socialweb_posts",
|
|
8078
8370
|
{
|
|
8079
8371
|
description: "List posts for a social web account.",
|
|
8080
8372
|
inputSchema: socialWebHandlePaginationSchema
|
|
8081
8373
|
},
|
|
8082
|
-
async (args) => {
|
|
8374
|
+
async (global2, args) => {
|
|
8083
8375
|
const pagination = mapSocialWebPaginationArgs(args);
|
|
8084
8376
|
return toolResult(
|
|
8085
8377
|
await listSocialWebPosts(
|
|
8086
|
-
|
|
8378
|
+
global2,
|
|
8087
8379
|
args.handle ?? "me",
|
|
8088
8380
|
pagination.params,
|
|
8089
8381
|
pagination.allPages
|
|
@@ -8091,44 +8383,56 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8091
8383
|
);
|
|
8092
8384
|
}
|
|
8093
8385
|
);
|
|
8094
|
-
|
|
8386
|
+
registerGroupedTool(
|
|
8387
|
+
server,
|
|
8388
|
+
global,
|
|
8389
|
+
"socialweb",
|
|
8095
8390
|
"ghost_socialweb_likes",
|
|
8096
8391
|
{
|
|
8097
8392
|
description: "List posts liked by the current social web account.",
|
|
8098
8393
|
inputSchema: socialWebPaginationSchema
|
|
8099
8394
|
},
|
|
8100
|
-
async (args) => {
|
|
8395
|
+
async (global2, args) => {
|
|
8101
8396
|
const pagination = mapSocialWebPaginationArgs(args);
|
|
8102
|
-
return toolResult(await listSocialWebLikes(
|
|
8397
|
+
return toolResult(await listSocialWebLikes(global2, pagination.params, pagination.allPages));
|
|
8103
8398
|
}
|
|
8104
8399
|
);
|
|
8105
|
-
|
|
8400
|
+
registerGroupedTool(
|
|
8401
|
+
server,
|
|
8402
|
+
global,
|
|
8403
|
+
"socialweb",
|
|
8106
8404
|
"ghost_socialweb_followers",
|
|
8107
8405
|
{
|
|
8108
8406
|
description: "List followers for a social web account.",
|
|
8109
8407
|
inputSchema: socialWebHandlePaginationSchema
|
|
8110
8408
|
},
|
|
8111
|
-
async (args) => {
|
|
8409
|
+
async (global2, args) => {
|
|
8112
8410
|
const pagination = mapSocialWebPaginationArgs(args);
|
|
8113
8411
|
return toolResult(
|
|
8114
|
-
await listFollowers(
|
|
8412
|
+
await listFollowers(global2, args.handle ?? "me", pagination.params, pagination.allPages)
|
|
8115
8413
|
);
|
|
8116
8414
|
}
|
|
8117
8415
|
);
|
|
8118
|
-
|
|
8416
|
+
registerGroupedTool(
|
|
8417
|
+
server,
|
|
8418
|
+
global,
|
|
8419
|
+
"socialweb",
|
|
8119
8420
|
"ghost_socialweb_following",
|
|
8120
8421
|
{
|
|
8121
8422
|
description: "List followed accounts for a social web account.",
|
|
8122
8423
|
inputSchema: socialWebHandlePaginationSchema
|
|
8123
8424
|
},
|
|
8124
|
-
async (args) => {
|
|
8425
|
+
async (global2, args) => {
|
|
8125
8426
|
const pagination = mapSocialWebPaginationArgs(args);
|
|
8126
8427
|
return toolResult(
|
|
8127
|
-
await listFollowing(
|
|
8428
|
+
await listFollowing(global2, args.handle ?? "me", pagination.params, pagination.allPages)
|
|
8128
8429
|
);
|
|
8129
8430
|
}
|
|
8130
8431
|
);
|
|
8131
|
-
|
|
8432
|
+
registerGroupedTool(
|
|
8433
|
+
server,
|
|
8434
|
+
global,
|
|
8435
|
+
"socialweb",
|
|
8132
8436
|
"ghost_socialweb_post",
|
|
8133
8437
|
{
|
|
8134
8438
|
description: "Get a social web post by ActivityPub id.",
|
|
@@ -8136,9 +8440,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8136
8440
|
id: socialWebUrlSchema
|
|
8137
8441
|
})
|
|
8138
8442
|
},
|
|
8139
|
-
async (args) => toolResult(await getSocialWebPost(
|
|
8443
|
+
async (global2, args) => toolResult(await getSocialWebPost(global2, args.id))
|
|
8140
8444
|
);
|
|
8141
|
-
|
|
8445
|
+
registerGroupedTool(
|
|
8446
|
+
server,
|
|
8447
|
+
global,
|
|
8448
|
+
"socialweb",
|
|
8142
8449
|
"ghost_socialweb_thread",
|
|
8143
8450
|
{
|
|
8144
8451
|
description: "Get a social web thread by ActivityPub id.",
|
|
@@ -8146,9 +8453,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8146
8453
|
id: socialWebUrlSchema
|
|
8147
8454
|
})
|
|
8148
8455
|
},
|
|
8149
|
-
async (args) => toolResult(await getSocialWebThread(
|
|
8456
|
+
async (global2, args) => toolResult(await getSocialWebThread(global2, args.id))
|
|
8150
8457
|
);
|
|
8151
|
-
|
|
8458
|
+
registerGroupedTool(
|
|
8459
|
+
server,
|
|
8460
|
+
global,
|
|
8461
|
+
"socialweb",
|
|
8152
8462
|
"ghost_socialweb_follow",
|
|
8153
8463
|
{
|
|
8154
8464
|
description: "Follow a federated social web account.",
|
|
@@ -8156,9 +8466,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8156
8466
|
handle: socialWebRemoteHandleSchema
|
|
8157
8467
|
})
|
|
8158
8468
|
},
|
|
8159
|
-
async (args) => toolResult(await followAccount(
|
|
8469
|
+
async (global2, args) => toolResult(await followAccount(global2, args.handle))
|
|
8160
8470
|
);
|
|
8161
|
-
|
|
8471
|
+
registerGroupedTool(
|
|
8472
|
+
server,
|
|
8473
|
+
global,
|
|
8474
|
+
"socialweb",
|
|
8162
8475
|
"ghost_socialweb_unfollow",
|
|
8163
8476
|
{
|
|
8164
8477
|
description: "Unfollow a federated social web account.",
|
|
@@ -8166,9 +8479,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8166
8479
|
handle: socialWebRemoteHandleSchema
|
|
8167
8480
|
})
|
|
8168
8481
|
},
|
|
8169
|
-
async (args) => toolResult(await unfollowAccount(
|
|
8482
|
+
async (global2, args) => toolResult(await unfollowAccount(global2, args.handle))
|
|
8170
8483
|
);
|
|
8171
|
-
|
|
8484
|
+
registerGroupedTool(
|
|
8485
|
+
server,
|
|
8486
|
+
global,
|
|
8487
|
+
"socialweb",
|
|
8172
8488
|
"ghost_socialweb_like",
|
|
8173
8489
|
{
|
|
8174
8490
|
description: "Like a social web post.",
|
|
@@ -8176,9 +8492,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8176
8492
|
id: socialWebUrlSchema
|
|
8177
8493
|
})
|
|
8178
8494
|
},
|
|
8179
|
-
async (args) => toolResult(await likePost(
|
|
8495
|
+
async (global2, args) => toolResult(await likePost(global2, args.id))
|
|
8180
8496
|
);
|
|
8181
|
-
|
|
8497
|
+
registerGroupedTool(
|
|
8498
|
+
server,
|
|
8499
|
+
global,
|
|
8500
|
+
"socialweb",
|
|
8182
8501
|
"ghost_socialweb_unlike",
|
|
8183
8502
|
{
|
|
8184
8503
|
description: "Unlike a social web post.",
|
|
@@ -8186,9 +8505,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8186
8505
|
id: socialWebUrlSchema
|
|
8187
8506
|
})
|
|
8188
8507
|
},
|
|
8189
|
-
async (args) => toolResult(await unlikePost(
|
|
8508
|
+
async (global2, args) => toolResult(await unlikePost(global2, args.id))
|
|
8190
8509
|
);
|
|
8191
|
-
|
|
8510
|
+
registerGroupedTool(
|
|
8511
|
+
server,
|
|
8512
|
+
global,
|
|
8513
|
+
"socialweb",
|
|
8192
8514
|
"ghost_socialweb_repost",
|
|
8193
8515
|
{
|
|
8194
8516
|
description: "Repost a social web post.",
|
|
@@ -8196,9 +8518,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8196
8518
|
id: socialWebUrlSchema
|
|
8197
8519
|
})
|
|
8198
8520
|
},
|
|
8199
|
-
async (args) => toolResult(await repostPost(
|
|
8521
|
+
async (global2, args) => toolResult(await repostPost(global2, args.id))
|
|
8200
8522
|
);
|
|
8201
|
-
|
|
8523
|
+
registerGroupedTool(
|
|
8524
|
+
server,
|
|
8525
|
+
global,
|
|
8526
|
+
"socialweb",
|
|
8202
8527
|
"ghost_socialweb_derepost",
|
|
8203
8528
|
{
|
|
8204
8529
|
description: "Undo a repost on a social web post.",
|
|
@@ -8206,26 +8531,36 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8206
8531
|
id: socialWebUrlSchema
|
|
8207
8532
|
})
|
|
8208
8533
|
},
|
|
8209
|
-
async (args) => toolResult(await derepostPost(
|
|
8534
|
+
async (global2, args) => toolResult(await derepostPost(global2, args.id))
|
|
8210
8535
|
);
|
|
8211
|
-
|
|
8536
|
+
registerGroupedTool(
|
|
8537
|
+
server,
|
|
8538
|
+
global,
|
|
8539
|
+
"socialweb",
|
|
8212
8540
|
"ghost_socialweb_delete",
|
|
8213
8541
|
{
|
|
8214
8542
|
description: "Delete a social web post authored by the current account.",
|
|
8215
8543
|
inputSchema: z6.object({
|
|
8216
|
-
id: socialWebUrlSchema
|
|
8544
|
+
id: socialWebUrlSchema,
|
|
8545
|
+
confirm: z6.literal(true)
|
|
8217
8546
|
})
|
|
8218
8547
|
},
|
|
8219
|
-
async (args) =>
|
|
8548
|
+
async (global2, args) => {
|
|
8549
|
+
assertDestructiveActionsEnabled(global2, "delete social web post");
|
|
8550
|
+
return toolResult(await deleteSocialWebPost(global2, args.id));
|
|
8551
|
+
}
|
|
8220
8552
|
);
|
|
8221
|
-
|
|
8553
|
+
registerGroupedTool(
|
|
8554
|
+
server,
|
|
8555
|
+
global,
|
|
8556
|
+
"socialweb",
|
|
8222
8557
|
"ghost_socialweb_note",
|
|
8223
8558
|
{
|
|
8224
8559
|
description: "Create a new social web note.",
|
|
8225
8560
|
inputSchema: socialWebContentSchema
|
|
8226
8561
|
},
|
|
8227
|
-
async (args) => toolResult(
|
|
8228
|
-
await createNote(
|
|
8562
|
+
async (global2, args) => toolResult(
|
|
8563
|
+
await createNote(global2, {
|
|
8229
8564
|
content: args.content,
|
|
8230
8565
|
imageFile: args.image_file,
|
|
8231
8566
|
imageUrl: args.image_url,
|
|
@@ -8233,7 +8568,10 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8233
8568
|
})
|
|
8234
8569
|
)
|
|
8235
8570
|
);
|
|
8236
|
-
|
|
8571
|
+
registerGroupedTool(
|
|
8572
|
+
server,
|
|
8573
|
+
global,
|
|
8574
|
+
"socialweb",
|
|
8237
8575
|
"ghost_socialweb_reply",
|
|
8238
8576
|
{
|
|
8239
8577
|
description: "Reply to a social web post.",
|
|
@@ -8241,8 +8579,8 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8241
8579
|
id: socialWebUrlSchema
|
|
8242
8580
|
})
|
|
8243
8581
|
},
|
|
8244
|
-
async (args) => toolResult(
|
|
8245
|
-
await replyToPost(
|
|
8582
|
+
async (global2, args) => toolResult(
|
|
8583
|
+
await replyToPost(global2, args.id, {
|
|
8246
8584
|
content: args.content,
|
|
8247
8585
|
imageFile: args.image_file,
|
|
8248
8586
|
imageUrl: args.image_url,
|
|
@@ -8250,31 +8588,40 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8250
8588
|
})
|
|
8251
8589
|
)
|
|
8252
8590
|
);
|
|
8253
|
-
|
|
8591
|
+
registerGroupedTool(
|
|
8592
|
+
server,
|
|
8593
|
+
global,
|
|
8594
|
+
"socialweb",
|
|
8254
8595
|
"ghost_socialweb_blocked_accounts",
|
|
8255
8596
|
{
|
|
8256
8597
|
description: "List blocked social web accounts.",
|
|
8257
8598
|
inputSchema: socialWebPaginationSchema
|
|
8258
8599
|
},
|
|
8259
|
-
async (args) => {
|
|
8600
|
+
async (global2, args) => {
|
|
8260
8601
|
const pagination = mapSocialWebPaginationArgs(args);
|
|
8261
8602
|
return toolResult(
|
|
8262
|
-
await listBlockedAccounts(
|
|
8603
|
+
await listBlockedAccounts(global2, pagination.params, pagination.allPages)
|
|
8263
8604
|
);
|
|
8264
8605
|
}
|
|
8265
8606
|
);
|
|
8266
|
-
|
|
8607
|
+
registerGroupedTool(
|
|
8608
|
+
server,
|
|
8609
|
+
global,
|
|
8610
|
+
"socialweb",
|
|
8267
8611
|
"ghost_socialweb_blocked_domains",
|
|
8268
8612
|
{
|
|
8269
8613
|
description: "List blocked social web domains.",
|
|
8270
8614
|
inputSchema: socialWebPaginationSchema
|
|
8271
8615
|
},
|
|
8272
|
-
async (args) => {
|
|
8616
|
+
async (global2, args) => {
|
|
8273
8617
|
const pagination = mapSocialWebPaginationArgs(args);
|
|
8274
|
-
return toolResult(await listBlockedDomains(
|
|
8618
|
+
return toolResult(await listBlockedDomains(global2, pagination.params, pagination.allPages));
|
|
8275
8619
|
}
|
|
8276
8620
|
);
|
|
8277
|
-
|
|
8621
|
+
registerGroupedTool(
|
|
8622
|
+
server,
|
|
8623
|
+
global,
|
|
8624
|
+
"socialweb",
|
|
8278
8625
|
"ghost_socialweb_block",
|
|
8279
8626
|
{
|
|
8280
8627
|
description: "Block a social web account by ActivityPub id.",
|
|
@@ -8282,9 +8629,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8282
8629
|
id: socialWebUrlSchema
|
|
8283
8630
|
})
|
|
8284
8631
|
},
|
|
8285
|
-
async (args) => toolResult(await blockAccount(
|
|
8632
|
+
async (global2, args) => toolResult(await blockAccount(global2, args.id))
|
|
8286
8633
|
);
|
|
8287
|
-
|
|
8634
|
+
registerGroupedTool(
|
|
8635
|
+
server,
|
|
8636
|
+
global,
|
|
8637
|
+
"socialweb",
|
|
8288
8638
|
"ghost_socialweb_unblock",
|
|
8289
8639
|
{
|
|
8290
8640
|
description: "Unblock a social web account by ActivityPub id.",
|
|
@@ -8292,9 +8642,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8292
8642
|
id: socialWebUrlSchema
|
|
8293
8643
|
})
|
|
8294
8644
|
},
|
|
8295
|
-
async (args) => toolResult(await unblockAccount(
|
|
8645
|
+
async (global2, args) => toolResult(await unblockAccount(global2, args.id))
|
|
8296
8646
|
);
|
|
8297
|
-
|
|
8647
|
+
registerGroupedTool(
|
|
8648
|
+
server,
|
|
8649
|
+
global,
|
|
8650
|
+
"socialweb",
|
|
8298
8651
|
"ghost_socialweb_block_domain",
|
|
8299
8652
|
{
|
|
8300
8653
|
description: "Block a social web domain.",
|
|
@@ -8302,9 +8655,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8302
8655
|
url: socialWebUrlSchema
|
|
8303
8656
|
})
|
|
8304
8657
|
},
|
|
8305
|
-
async (args) => toolResult(await blockDomain(
|
|
8658
|
+
async (global2, args) => toolResult(await blockDomain(global2, args.url))
|
|
8306
8659
|
);
|
|
8307
|
-
|
|
8660
|
+
registerGroupedTool(
|
|
8661
|
+
server,
|
|
8662
|
+
global,
|
|
8663
|
+
"socialweb",
|
|
8308
8664
|
"ghost_socialweb_unblock_domain",
|
|
8309
8665
|
{
|
|
8310
8666
|
description: "Unblock a social web domain.",
|
|
@@ -8312,9 +8668,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8312
8668
|
url: socialWebUrlSchema
|
|
8313
8669
|
})
|
|
8314
8670
|
},
|
|
8315
|
-
async (args) => toolResult(await unblockDomain(
|
|
8671
|
+
async (global2, args) => toolResult(await unblockDomain(global2, args.url))
|
|
8316
8672
|
);
|
|
8317
|
-
|
|
8673
|
+
registerGroupedTool(
|
|
8674
|
+
server,
|
|
8675
|
+
global,
|
|
8676
|
+
"socialweb",
|
|
8318
8677
|
"ghost_socialweb_upload",
|
|
8319
8678
|
{
|
|
8320
8679
|
description: "Upload an image for social web notes and replies.",
|
|
@@ -8322,11 +8681,14 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8322
8681
|
file_path: z6.string().min(1)
|
|
8323
8682
|
})
|
|
8324
8683
|
},
|
|
8325
|
-
async (args) => toolResult(await uploadSocialWebImage(
|
|
8684
|
+
async (global2, args) => toolResult(await uploadSocialWebImage(global2, args.file_path))
|
|
8326
8685
|
);
|
|
8327
8686
|
}
|
|
8328
8687
|
if (enabledGroups.has("stats")) {
|
|
8329
|
-
|
|
8688
|
+
registerGroupedTool(
|
|
8689
|
+
server,
|
|
8690
|
+
global,
|
|
8691
|
+
"stats",
|
|
8330
8692
|
"ghost_stats_overview",
|
|
8331
8693
|
{
|
|
8332
8694
|
description: "Get the Ghost analytics overview report.",
|
|
@@ -8334,9 +8696,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8334
8696
|
...statsRangeArgs
|
|
8335
8697
|
})
|
|
8336
8698
|
},
|
|
8337
|
-
async (args) => toolResult(await getStatsOverview(
|
|
8699
|
+
async (global2, args) => toolResult(await getStatsOverview(global2, mapStatsRangeArgs(args)))
|
|
8338
8700
|
);
|
|
8339
|
-
|
|
8701
|
+
registerGroupedTool(
|
|
8702
|
+
server,
|
|
8703
|
+
global,
|
|
8704
|
+
"stats",
|
|
8340
8705
|
"ghost_stats_web",
|
|
8341
8706
|
{
|
|
8342
8707
|
description: "Get the Ghost web analytics report.",
|
|
@@ -8344,9 +8709,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8344
8709
|
...statsWebArgs
|
|
8345
8710
|
})
|
|
8346
8711
|
},
|
|
8347
|
-
async (args) => toolResult(await getStatsWeb(
|
|
8712
|
+
async (global2, args) => toolResult(await getStatsWeb(global2, mapStatsWebArgs(args)))
|
|
8348
8713
|
);
|
|
8349
|
-
|
|
8714
|
+
registerGroupedTool(
|
|
8715
|
+
server,
|
|
8716
|
+
global,
|
|
8717
|
+
"stats",
|
|
8350
8718
|
"ghost_stats_web_table",
|
|
8351
8719
|
{
|
|
8352
8720
|
description: "Get a focused Ghost web analytics table view.",
|
|
@@ -8355,14 +8723,17 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8355
8723
|
...statsWebArgs
|
|
8356
8724
|
})
|
|
8357
8725
|
},
|
|
8358
|
-
async (args) => toolResult(
|
|
8359
|
-
await getStatsWebTable(
|
|
8726
|
+
async (global2, args) => toolResult(
|
|
8727
|
+
await getStatsWebTable(global2, args.view, {
|
|
8360
8728
|
...mapStatsWebArgs(args),
|
|
8361
8729
|
limit: args.limit ?? 10
|
|
8362
8730
|
})
|
|
8363
8731
|
)
|
|
8364
8732
|
);
|
|
8365
|
-
|
|
8733
|
+
registerGroupedTool(
|
|
8734
|
+
server,
|
|
8735
|
+
global,
|
|
8736
|
+
"stats",
|
|
8366
8737
|
"ghost_stats_growth",
|
|
8367
8738
|
{
|
|
8368
8739
|
description: "Get Ghost member and revenue growth analytics.",
|
|
@@ -8371,11 +8742,14 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8371
8742
|
limit: z6.number().int().positive().max(100).optional()
|
|
8372
8743
|
})
|
|
8373
8744
|
},
|
|
8374
|
-
async (args) => toolResult(
|
|
8375
|
-
await getStatsGrowth(
|
|
8745
|
+
async (global2, args) => toolResult(
|
|
8746
|
+
await getStatsGrowth(global2, { ...mapStatsRangeArgs(args), limit: args.limit ?? 5 })
|
|
8376
8747
|
)
|
|
8377
8748
|
);
|
|
8378
|
-
|
|
8749
|
+
registerGroupedTool(
|
|
8750
|
+
server,
|
|
8751
|
+
global,
|
|
8752
|
+
"stats",
|
|
8379
8753
|
"ghost_stats_posts",
|
|
8380
8754
|
{
|
|
8381
8755
|
description: "Get top Ghost posts by views.",
|
|
@@ -8384,11 +8758,14 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8384
8758
|
limit: z6.number().int().positive().max(100).optional()
|
|
8385
8759
|
})
|
|
8386
8760
|
},
|
|
8387
|
-
async (args) => toolResult(
|
|
8388
|
-
await getStatsPosts(
|
|
8761
|
+
async (global2, args) => toolResult(
|
|
8762
|
+
await getStatsPosts(global2, { ...mapStatsRangeArgs(args), limit: args.limit ?? 5 })
|
|
8389
8763
|
)
|
|
8390
8764
|
);
|
|
8391
|
-
|
|
8765
|
+
registerGroupedTool(
|
|
8766
|
+
server,
|
|
8767
|
+
global,
|
|
8768
|
+
"stats",
|
|
8392
8769
|
"ghost_stats_email",
|
|
8393
8770
|
{
|
|
8394
8771
|
description: "Get Ghost email analytics grouped by newsletter.",
|
|
@@ -8398,15 +8775,18 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8398
8775
|
limit: z6.number().int().positive().max(100).optional()
|
|
8399
8776
|
})
|
|
8400
8777
|
},
|
|
8401
|
-
async (args) => toolResult(
|
|
8402
|
-
await getStatsNewsletters(
|
|
8778
|
+
async (global2, args) => toolResult(
|
|
8779
|
+
await getStatsNewsletters(global2, {
|
|
8403
8780
|
...mapStatsRangeArgs(args),
|
|
8404
8781
|
newsletterId: args.newsletter_id,
|
|
8405
8782
|
limit: args.limit ?? 10
|
|
8406
8783
|
})
|
|
8407
8784
|
)
|
|
8408
8785
|
);
|
|
8409
|
-
|
|
8786
|
+
registerGroupedTool(
|
|
8787
|
+
server,
|
|
8788
|
+
global,
|
|
8789
|
+
"stats",
|
|
8410
8790
|
"ghost_stats_email_clicks",
|
|
8411
8791
|
{
|
|
8412
8792
|
description: "Get Ghost email click analytics for a newsletter, optionally filtered by post ids.",
|
|
@@ -8417,8 +8797,8 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8417
8797
|
limit: z6.number().int().positive().max(100).optional()
|
|
8418
8798
|
})
|
|
8419
8799
|
},
|
|
8420
|
-
async (args) => toolResult(
|
|
8421
|
-
await getStatsNewsletterClicks(
|
|
8800
|
+
async (global2, args) => toolResult(
|
|
8801
|
+
await getStatsNewsletterClicks(global2, {
|
|
8422
8802
|
...mapStatsRangeArgs(args),
|
|
8423
8803
|
newsletterId: args.newsletter_id,
|
|
8424
8804
|
postIds: args.post_ids,
|
|
@@ -8426,7 +8806,10 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8426
8806
|
})
|
|
8427
8807
|
)
|
|
8428
8808
|
);
|
|
8429
|
-
|
|
8809
|
+
registerGroupedTool(
|
|
8810
|
+
server,
|
|
8811
|
+
global,
|
|
8812
|
+
"stats",
|
|
8430
8813
|
"ghost_stats_email_subscribers",
|
|
8431
8814
|
{
|
|
8432
8815
|
description: "Get Ghost newsletter subscriber analytics.",
|
|
@@ -8435,14 +8818,17 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8435
8818
|
newsletter_id: z6.string().optional()
|
|
8436
8819
|
})
|
|
8437
8820
|
},
|
|
8438
|
-
async (args) => toolResult(
|
|
8439
|
-
await getStatsNewsletterSubscribers(
|
|
8821
|
+
async (global2, args) => toolResult(
|
|
8822
|
+
await getStatsNewsletterSubscribers(global2, {
|
|
8440
8823
|
...mapStatsRangeArgs(args),
|
|
8441
8824
|
newsletterId: args.newsletter_id
|
|
8442
8825
|
})
|
|
8443
8826
|
)
|
|
8444
8827
|
);
|
|
8445
|
-
|
|
8828
|
+
registerGroupedTool(
|
|
8829
|
+
server,
|
|
8830
|
+
global,
|
|
8831
|
+
"stats",
|
|
8446
8832
|
"ghost_stats_post",
|
|
8447
8833
|
{
|
|
8448
8834
|
description: "Get Ghost analytics for a single post.",
|
|
@@ -8451,9 +8837,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8451
8837
|
...statsRangeArgs
|
|
8452
8838
|
})
|
|
8453
8839
|
},
|
|
8454
|
-
async (args) => toolResult(await getStatsPost(
|
|
8840
|
+
async (global2, args) => toolResult(await getStatsPost(global2, { ...mapStatsRangeArgs(args), id: args.id }))
|
|
8455
8841
|
);
|
|
8456
|
-
|
|
8842
|
+
registerGroupedTool(
|
|
8843
|
+
server,
|
|
8844
|
+
global,
|
|
8845
|
+
"stats",
|
|
8457
8846
|
"ghost_stats_post_web",
|
|
8458
8847
|
{
|
|
8459
8848
|
description: "Get Ghost web analytics for a single post.",
|
|
@@ -8462,9 +8851,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8462
8851
|
...statsWebArgs
|
|
8463
8852
|
})
|
|
8464
8853
|
},
|
|
8465
|
-
async (args) => toolResult(await getStatsPostWeb(
|
|
8854
|
+
async (global2, args) => toolResult(await getStatsPostWeb(global2, { ...mapStatsWebArgs(args), id: args.id }))
|
|
8466
8855
|
);
|
|
8467
|
-
|
|
8856
|
+
registerGroupedTool(
|
|
8857
|
+
server,
|
|
8858
|
+
global,
|
|
8859
|
+
"stats",
|
|
8468
8860
|
"ghost_stats_post_growth",
|
|
8469
8861
|
{
|
|
8470
8862
|
description: "Get Ghost growth analytics for a single post.",
|
|
@@ -8473,9 +8865,12 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8473
8865
|
...statsRangeArgs
|
|
8474
8866
|
})
|
|
8475
8867
|
},
|
|
8476
|
-
async (args) => toolResult(await getStatsPostGrowth(
|
|
8868
|
+
async (global2, args) => toolResult(await getStatsPostGrowth(global2, { ...mapStatsRangeArgs(args), id: args.id }))
|
|
8477
8869
|
);
|
|
8478
|
-
|
|
8870
|
+
registerGroupedTool(
|
|
8871
|
+
server,
|
|
8872
|
+
global,
|
|
8873
|
+
"stats",
|
|
8479
8874
|
"ghost_stats_post_newsletter",
|
|
8480
8875
|
{
|
|
8481
8876
|
description: "Get Ghost email performance analytics for a single post.",
|
|
@@ -8484,11 +8879,14 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8484
8879
|
...statsRangeArgs
|
|
8485
8880
|
})
|
|
8486
8881
|
},
|
|
8487
|
-
async (args) => toolResult(
|
|
8488
|
-
await getStatsPostNewsletter(
|
|
8882
|
+
async (global2, args) => toolResult(
|
|
8883
|
+
await getStatsPostNewsletter(global2, { ...mapStatsRangeArgs(args), id: args.id })
|
|
8489
8884
|
)
|
|
8490
8885
|
);
|
|
8491
|
-
|
|
8886
|
+
registerGroupedTool(
|
|
8887
|
+
server,
|
|
8888
|
+
global,
|
|
8889
|
+
"stats",
|
|
8492
8890
|
"ghost_stats_post_referrers",
|
|
8493
8891
|
{
|
|
8494
8892
|
description: "Get Ghost referrer analytics for a single post.",
|
|
@@ -8498,8 +8896,8 @@ function registerCoreTools(server, global, enabledGroups) {
|
|
|
8498
8896
|
limit: z6.number().int().positive().max(100).optional()
|
|
8499
8897
|
})
|
|
8500
8898
|
},
|
|
8501
|
-
async (args) => toolResult(
|
|
8502
|
-
await getStatsPostReferrers(
|
|
8899
|
+
async (global2, args) => toolResult(
|
|
8900
|
+
await getStatsPostReferrers(global2, {
|
|
8503
8901
|
...mapStatsRangeArgs(args),
|
|
8504
8902
|
id: args.id,
|
|
8505
8903
|
limit: args.limit ?? 10
|
|
@@ -9168,6 +9566,7 @@ function registerMemberCommands(program) {
|
|
|
9168
9566
|
if (!parsed.success) {
|
|
9169
9567
|
throwValidationError4(parsed.error);
|
|
9170
9568
|
}
|
|
9569
|
+
assertDestructiveActionsEnabled(global, "delete member");
|
|
9171
9570
|
if (!parsed.data.yes) {
|
|
9172
9571
|
if (isNonInteractive()) {
|
|
9173
9572
|
throw new GhstError("Deleting in non-interactive mode requires --yes.", {
|
|
@@ -9270,6 +9669,9 @@ function registerMemberCommands(program) {
|
|
|
9270
9669
|
throwValidationError4(parsed.error);
|
|
9271
9670
|
}
|
|
9272
9671
|
const resolvedAction = parsed.data.update ? "update-labels" : parsed.data.delete ? "delete" : parsed.data.action;
|
|
9672
|
+
if (resolvedAction === "delete") {
|
|
9673
|
+
assertDestructiveActionsEnabled(global, "bulk delete members");
|
|
9674
|
+
}
|
|
9273
9675
|
const payload = await bulkMembers(global, {
|
|
9274
9676
|
action: resolvedAction ?? "unsubscribe",
|
|
9275
9677
|
all: parsed.data.all,
|
|
@@ -10551,6 +10953,7 @@ function registerPageCommands(program) {
|
|
|
10551
10953
|
if (!parsed.success) {
|
|
10552
10954
|
throwValidationError8(parsed.error);
|
|
10553
10955
|
}
|
|
10956
|
+
assertDestructiveActionsEnabled(global, "delete page");
|
|
10554
10957
|
if (!parsed.data.yes) {
|
|
10555
10958
|
if (isNonInteractive()) {
|
|
10556
10959
|
throw new GhstError("Deleting in non-interactive mode requires --yes.", {
|
|
@@ -10602,6 +11005,9 @@ function registerPageCommands(program) {
|
|
|
10602
11005
|
if (!parsed.success) {
|
|
10603
11006
|
throwValidationError8(parsed.error);
|
|
10604
11007
|
}
|
|
11008
|
+
if (parsed.data.action === "delete") {
|
|
11009
|
+
assertDestructiveActionsEnabled(global, "bulk delete pages");
|
|
11010
|
+
}
|
|
10605
11011
|
const payload = await bulkPages(global, {
|
|
10606
11012
|
filter: parsed.data.filter,
|
|
10607
11013
|
delete: parsed.data.action === "delete",
|
|
@@ -11119,6 +11525,7 @@ function registerPostCommands(program) {
|
|
|
11119
11525
|
if (!parsed.success) {
|
|
11120
11526
|
throwValidationError9(parsed.error);
|
|
11121
11527
|
}
|
|
11528
|
+
assertDestructiveActionsEnabled(global, "delete post");
|
|
11122
11529
|
if (!parsed.data.yes) {
|
|
11123
11530
|
if (isNonInteractive()) {
|
|
11124
11531
|
throw new GhstError("Deleting in non-interactive mode requires --yes.", {
|
|
@@ -11252,6 +11659,9 @@ function registerPostCommands(program) {
|
|
|
11252
11659
|
throwValidationError9(parsed.error);
|
|
11253
11660
|
}
|
|
11254
11661
|
const action = parsed.data.action ?? (parsed.data.delete ? "delete" : "update");
|
|
11662
|
+
if (action === "delete") {
|
|
11663
|
+
assertDestructiveActionsEnabled(global, "bulk delete posts");
|
|
11664
|
+
}
|
|
11255
11665
|
const payload = await bulkPosts(global, {
|
|
11256
11666
|
filter: parsed.data.filter,
|
|
11257
11667
|
delete: action === "delete",
|
|
@@ -11763,6 +12173,7 @@ function registerSocialWebCommands(program) {
|
|
|
11763
12173
|
if (!parsed.success) {
|
|
11764
12174
|
throwValidationError11(parsed.error);
|
|
11765
12175
|
}
|
|
12176
|
+
assertDestructiveActionsEnabled(global, "delete social web post");
|
|
11766
12177
|
if (!parsed.data.yes) {
|
|
11767
12178
|
if (isNonInteractive()) {
|
|
11768
12179
|
throw new GhstError("Deleting in non-interactive mode requires --yes.", {
|
|
@@ -12788,6 +13199,7 @@ function registerTagCommands(program) {
|
|
|
12788
13199
|
if (!parsed.success) {
|
|
12789
13200
|
throwValidationError13(parsed.error);
|
|
12790
13201
|
}
|
|
13202
|
+
assertDestructiveActionsEnabled(global, "delete tag");
|
|
12791
13203
|
if (!parsed.data.yes) {
|
|
12792
13204
|
if (isNonInteractive()) {
|
|
12793
13205
|
throw new GhstError("Deleting in non-interactive mode requires --yes.", {
|
|
@@ -12826,6 +13238,9 @@ function registerTagCommands(program) {
|
|
|
12826
13238
|
if (!parsed.success) {
|
|
12827
13239
|
throwValidationError13(parsed.error);
|
|
12828
13240
|
}
|
|
13241
|
+
if (parsed.data.action === "delete") {
|
|
13242
|
+
assertDestructiveActionsEnabled(global, "bulk delete tags");
|
|
13243
|
+
}
|
|
12829
13244
|
const payload = await bulkTags(global, {
|
|
12830
13245
|
filter: parsed.data.filter,
|
|
12831
13246
|
delete: parsed.data.action === "delete",
|
|
@@ -13990,6 +14405,7 @@ function registerWebhookCommands(program) {
|
|
|
13990
14405
|
if (!parsed.success) {
|
|
13991
14406
|
throwValidationError17(parsed.error);
|
|
13992
14407
|
}
|
|
14408
|
+
assertDestructiveActionsEnabled(global, "delete webhook");
|
|
13993
14409
|
if (!parsed.data.yes) {
|
|
13994
14410
|
if (isNonInteractive()) {
|
|
13995
14411
|
throw new GhstError("Deleting in non-interactive mode requires --yes.", {
|
|
@@ -14094,7 +14510,7 @@ function registerWebhookCommands(program) {
|
|
|
14094
14510
|
// src/index.ts
|
|
14095
14511
|
function buildProgram() {
|
|
14096
14512
|
const program = new Command();
|
|
14097
|
-
program.name("ghst").description("A modern CLI for Ghost CMS").showHelpAfterError().showSuggestionAfterError(true).option("--json", "Output JSON").option("--jq <filter>", "Apply jq-style field extraction to JSON output").option("--site <site>", "Configured site alias").option("--url <url>", "Ghost site URL override").option("--staff-token <token>", "Ghost staff access token override").option("--debug [level]", "Enable debug output").option("--no-color", "Disable color output");
|
|
14513
|
+
program.name("ghst").description("A modern CLI for Ghost CMS").showHelpAfterError().showSuggestionAfterError(true).option("--json", "Output JSON").option("--jq <filter>", "Apply jq-style field extraction to JSON output").option("--site <site>", "Configured site alias").option("--url <url>", "Ghost site URL override").option("--staff-token <token>", "Ghost staff access token override").option("--enable-destructive-actions", "Allow destructive operations such as deletes").option("--debug [level]", "Enable debug output").option("--no-color", "Disable color output");
|
|
14098
14514
|
registerAuthCommands(program);
|
|
14099
14515
|
registerCommentCommands(program);
|
|
14100
14516
|
registerPostCommands(program);
|