castor-mcp 0.6.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/LICENSE +21 -0
- package/README.md +77 -0
- package/build/api-catalog.d.ts +27 -0
- package/build/api-catalog.js +76 -0
- package/build/api-catalog.js.map +1 -0
- package/build/confluence-client.d.ts +33 -0
- package/build/confluence-client.js +65 -0
- package/build/confluence-client.js.map +1 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +137 -0
- package/build/index.js.map +1 -0
- package/build/resource-definitions.d.ts +10 -0
- package/build/resource-definitions.js +75 -0
- package/build/resource-definitions.js.map +1 -0
- package/build/tool-definitions.d.ts +19 -0
- package/build/tool-definitions.js +1811 -0
- package/build/tool-definitions.js.map +1 -0
- package/build/tools/admin-users-groups.d.ts +114 -0
- package/build/tools/admin-users-groups.js +150 -0
- package/build/tools/admin-users-groups.js.map +1 -0
- package/build/tools/admin.d.ts +12 -0
- package/build/tools/admin.js +30 -0
- package/build/tools/admin.js.map +1 -0
- package/build/tools/args.d.ts +2 -0
- package/build/tools/args.js +12 -0
- package/build/tools/args.js.map +1 -0
- package/build/tools/attachments.d.ts +138 -0
- package/build/tools/attachments.js +170 -0
- package/build/tools/attachments.js.map +1 -0
- package/build/tools/backup-restore.d.ts +144 -0
- package/build/tools/backup-restore.js +223 -0
- package/build/tools/backup-restore.js.map +1 -0
- package/build/tools/bulk-pages.d.ts +103 -0
- package/build/tools/bulk-pages.js +111 -0
- package/build/tools/bulk-pages.js.map +1 -0
- package/build/tools/color-schemes.d.ts +72 -0
- package/build/tools/color-schemes.js +121 -0
- package/build/tools/color-schemes.js.map +1 -0
- package/build/tools/content-structure.d.ts +164 -0
- package/build/tools/content-structure.js +220 -0
- package/build/tools/content-structure.js.map +1 -0
- package/build/tools/content.d.ts +194 -0
- package/build/tools/content.js +246 -0
- package/build/tools/content.js.map +1 -0
- package/build/tools/errors.d.ts +3 -0
- package/build/tools/errors.js +55 -0
- package/build/tools/errors.js.map +1 -0
- package/build/tools/index-management.d.ts +30 -0
- package/build/tools/index-management.js +64 -0
- package/build/tools/index-management.js.map +1 -0
- package/build/tools/labels.d.ts +108 -0
- package/build/tools/labels.js +160 -0
- package/build/tools/labels.js.map +1 -0
- package/build/tools/permissions.d.ts +554 -0
- package/build/tools/permissions.js +194 -0
- package/build/tools/permissions.js.map +1 -0
- package/build/tools/spaces-admin.d.ts +225 -0
- package/build/tools/spaces-admin.js +288 -0
- package/build/tools/spaces-admin.js.map +1 -0
- package/build/tools/spaces-pages.d.ts +103 -0
- package/build/tools/spaces-pages.js +150 -0
- package/build/tools/spaces-pages.js.map +1 -0
- package/build/tools/system.d.ts +42 -0
- package/build/tools/system.js +101 -0
- package/build/tools/system.js.map +1 -0
- package/build/tools/users-groups.d.ts +216 -0
- package/build/tools/users-groups.js +274 -0
- package/build/tools/users-groups.js.map +1 -0
- package/build/tools/webhooks.d.ts +105 -0
- package/build/tools/webhooks.js +124 -0
- package/build/tools/webhooks.js.map +1 -0
- package/build/version.d.ts +7 -0
- package/build/version.js +17 -0
- package/build/version.js.map +1 -0
- package/docs/api-catalog.yaml +2388 -0
- package/package.json +59 -0
- package/skills/content.md +85 -0
- package/skills/instance-maintenance.md +59 -0
- package/skills/permissions.md +47 -0
- package/skills/spaces-admin.md +59 -0
- package/skills/spaces-pages.md +24 -0
- package/skills/system.md +34 -0
- package/skills/users-groups.md +55 -0
- package/skills/webhooks.md +25 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { withConfluenceErrorHandling } from "./errors.js";
|
|
3
|
+
import { jsonDetailBlock } from "./spaces-pages.js";
|
|
4
|
+
const MULTIPART_UPLOAD_HEADERS = { "X-Atlassian-Token": "no-check", "Content-Type": undefined };
|
|
5
|
+
// Backup files can be many megabytes — never embed one wholesale in a tool response. Below this
|
|
6
|
+
// size, inline it as base64 (same convention as attachment upload/download elsewhere in this
|
|
7
|
+
// project); above it, report metadata only and let the caller retrieve it another way.
|
|
8
|
+
const MAX_INLINE_DOWNLOAD_BYTES = 200_000;
|
|
9
|
+
export const AdminCreateSiteBackupJobArgsSchema = z.object({
|
|
10
|
+
skipAttachments: z.boolean().optional(),
|
|
11
|
+
keepPermanently: z.boolean().optional(),
|
|
12
|
+
fileNamePrefix: z.string().optional(),
|
|
13
|
+
});
|
|
14
|
+
export async function adminCreateSiteBackupJob(client, args) {
|
|
15
|
+
return withConfluenceErrorHandling(async () => {
|
|
16
|
+
const response = await client.post("/rest/api/backup-restore/backup/site", {
|
|
17
|
+
skipAttachments: args.skipAttachments,
|
|
18
|
+
keepPermanently: args.keepPermanently,
|
|
19
|
+
fileNamePrefix: args.fileNamePrefix,
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
content: [
|
|
23
|
+
{ type: "text", text: "✅ Site backup job submitted" },
|
|
24
|
+
jsonDetailBlock(response.data),
|
|
25
|
+
],
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export const AdminCreateSpaceBackupJobArgsSchema = z.object({
|
|
30
|
+
spaceKeys: z.array(z.string()).min(1),
|
|
31
|
+
keepPermanently: z.boolean().optional(),
|
|
32
|
+
fileNamePrefix: z.string().optional(),
|
|
33
|
+
});
|
|
34
|
+
export async function adminCreateSpaceBackupJob(client, args) {
|
|
35
|
+
return withConfluenceErrorHandling(async () => {
|
|
36
|
+
const response = await client.post("/rest/api/backup-restore/backup/space", {
|
|
37
|
+
spaceKeys: args.spaceKeys,
|
|
38
|
+
keepPermanently: args.keepPermanently,
|
|
39
|
+
fileNamePrefix: args.fileNamePrefix,
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
42
|
+
content: [
|
|
43
|
+
{ type: "text", text: `✅ Space backup job submitted for ${args.spaceKeys.join(", ")}` },
|
|
44
|
+
jsonDetailBlock(response.data),
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
export const AdminFindBackupRestoreJobsArgsSchema = z.object({
|
|
50
|
+
owner: z.string().optional(),
|
|
51
|
+
spaceKey: z.string().optional(),
|
|
52
|
+
jobScope: z.string().optional().describe('"SITE" or "SPACE".'),
|
|
53
|
+
jobOperation: z.string().optional().describe('"BACKUP" or "RESTORE".'),
|
|
54
|
+
});
|
|
55
|
+
// Confirmed live (2026-08-20): with no filters at all, this returns an empty array even when real
|
|
56
|
+
// jobs exist (verified against a real completed job, findable by ID via admin_get_backup_restore_job
|
|
57
|
+
// but absent from an unfiltered list). Either jobScope or jobOperation alone is enough to make real
|
|
58
|
+
// jobs appear — the description below steers callers accordingly rather than letting an empty
|
|
59
|
+
// result read as "no jobs have ever run."
|
|
60
|
+
export async function adminFindBackupRestoreJobs(client, args) {
|
|
61
|
+
return withConfluenceErrorHandling(async () => {
|
|
62
|
+
const response = await client.get("/rest/api/backup-restore/jobs", {
|
|
63
|
+
owner: args.owner,
|
|
64
|
+
spaceKey: args.spaceKey,
|
|
65
|
+
jobScope: args.jobScope,
|
|
66
|
+
jobOperation: args.jobOperation,
|
|
67
|
+
});
|
|
68
|
+
const jobs = response.data.results ?? [];
|
|
69
|
+
return {
|
|
70
|
+
content: [
|
|
71
|
+
{ type: "text", text: `✅ ${jobs.length} job(s) found` },
|
|
72
|
+
jsonDetailBlock(jobs),
|
|
73
|
+
],
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
export const AdminGetBackupRestoreJobArgsSchema = z.object({ jobId: z.string().min(1) });
|
|
78
|
+
export async function adminGetBackupRestoreJob(client, args) {
|
|
79
|
+
return withConfluenceErrorHandling(async () => {
|
|
80
|
+
const response = await client.get(`/rest/api/backup-restore/jobs/${encodeURIComponent(args.jobId)}`);
|
|
81
|
+
return {
|
|
82
|
+
content: [
|
|
83
|
+
{ type: "text", text: `✅ Job ${args.jobId} retrieved` },
|
|
84
|
+
jsonDetailBlock(response.data),
|
|
85
|
+
],
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
export const AdminCancelBackupRestoreJobArgsSchema = z.object({ jobId: z.string().min(1) });
|
|
90
|
+
export async function adminCancelBackupRestoreJob(client, args) {
|
|
91
|
+
return withConfluenceErrorHandling(async () => {
|
|
92
|
+
await client.put(`/rest/api/backup-restore/jobs/${encodeURIComponent(args.jobId)}/cancel`);
|
|
93
|
+
return { content: [{ type: "text", text: `✅ Job ${args.jobId} cancelled` }] };
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
export const AdminDownloadBackupFileArgsSchema = z.object({ jobId: z.string().min(1) });
|
|
97
|
+
export async function adminDownloadBackupFile(client, args) {
|
|
98
|
+
return withConfluenceErrorHandling(async () => {
|
|
99
|
+
const response = await client.get(`/rest/api/backup-restore/jobs/${encodeURIComponent(args.jobId)}/download`, undefined, "arraybuffer");
|
|
100
|
+
const bytes = Buffer.from(response.data);
|
|
101
|
+
const contentType = response.headers?.["content-type"] ?? "application/octet-stream";
|
|
102
|
+
if (bytes.length > MAX_INLINE_DOWNLOAD_BYTES) {
|
|
103
|
+
return {
|
|
104
|
+
content: [
|
|
105
|
+
{
|
|
106
|
+
type: "text",
|
|
107
|
+
text: `✅ Backup file for job ${args.jobId}: ${bytes.length} bytes, too large to inline (limit ${MAX_INLINE_DOWNLOAD_BYTES})`,
|
|
108
|
+
},
|
|
109
|
+
jsonDetailBlock({ sizeBytes: bytes.length, contentType }),
|
|
110
|
+
],
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
content: [
|
|
115
|
+
{ type: "text", text: `✅ Backup file for job ${args.jobId} retrieved (${bytes.length} bytes)` },
|
|
116
|
+
jsonDetailBlock({ sizeBytes: bytes.length, contentType, contentBase64: bytes.toString("base64") }),
|
|
117
|
+
],
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
export const AdminCancelAllQueuedBackupRestoreJobsArgsSchema = z.object({});
|
|
122
|
+
export async function adminCancelAllQueuedBackupRestoreJobs(client, _args) {
|
|
123
|
+
return withConfluenceErrorHandling(async () => {
|
|
124
|
+
await client.put("/rest/api/backup-restore/jobs/clear-queue");
|
|
125
|
+
return { content: [{ type: "text", text: "✅ All queued backup/restore jobs cancelled" }] };
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
export const AdminListRestoreFilesArgsSchema = z.object({
|
|
129
|
+
jobScope: z.string().optional().describe('"SITE" or "SPACE".'),
|
|
130
|
+
});
|
|
131
|
+
export async function adminListRestoreFiles(client, args) {
|
|
132
|
+
return withConfluenceErrorHandling(async () => {
|
|
133
|
+
const response = await client.get("/rest/api/backup-restore/restore/files", { jobScope: args.jobScope });
|
|
134
|
+
const files = response.data.results ?? [];
|
|
135
|
+
return {
|
|
136
|
+
content: [
|
|
137
|
+
{ type: "text", text: `✅ ${files.length} file(s) available in the restore directory` },
|
|
138
|
+
jsonDetailBlock(files),
|
|
139
|
+
],
|
|
140
|
+
};
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
const DESTRUCTIVE_RESTORE_NOTE = "DESTRUCTIVE — replaces live content with the backup's contents. There is no undo short of " +
|
|
144
|
+
"restoring a more recent backup.";
|
|
145
|
+
export const AdminCreateSiteRestoreJobArgsSchema = z.object({
|
|
146
|
+
fileName: z.string().min(1).describe("A filename already present in the restore directory (see admin_list_restore_files)."),
|
|
147
|
+
skipReindex: z.boolean().optional(),
|
|
148
|
+
});
|
|
149
|
+
export async function adminCreateSiteRestoreJob(client, args) {
|
|
150
|
+
return withConfluenceErrorHandling(async () => {
|
|
151
|
+
const response = await client.post("/rest/api/backup-restore/restore/site", {
|
|
152
|
+
fileName: args.fileName,
|
|
153
|
+
skipReindex: args.skipReindex,
|
|
154
|
+
});
|
|
155
|
+
return {
|
|
156
|
+
content: [
|
|
157
|
+
{ type: "text", text: `✅ Site restore job submitted from "${args.fileName}". ${DESTRUCTIVE_RESTORE_NOTE}` },
|
|
158
|
+
jsonDetailBlock(response.data),
|
|
159
|
+
],
|
|
160
|
+
};
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
export const AdminCreateSpaceRestoreJobArgsSchema = z.object({
|
|
164
|
+
fileName: z.string().min(1).describe("A filename already present in the restore directory (see admin_list_restore_files)."),
|
|
165
|
+
skipReindex: z.boolean().optional(),
|
|
166
|
+
});
|
|
167
|
+
export async function adminCreateSpaceRestoreJob(client, args) {
|
|
168
|
+
return withConfluenceErrorHandling(async () => {
|
|
169
|
+
const response = await client.post("/rest/api/backup-restore/restore/space", {
|
|
170
|
+
fileName: args.fileName,
|
|
171
|
+
skipReindex: args.skipReindex,
|
|
172
|
+
});
|
|
173
|
+
return {
|
|
174
|
+
content: [
|
|
175
|
+
{ type: "text", text: `✅ Space restore job submitted from "${args.fileName}". ${DESTRUCTIVE_RESTORE_NOTE}` },
|
|
176
|
+
jsonDetailBlock(response.data),
|
|
177
|
+
],
|
|
178
|
+
};
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
export const AdminCreateSiteRestoreJobFromUploadArgsSchema = z.object({
|
|
182
|
+
filename: z.string().min(1),
|
|
183
|
+
contentBase64: z.string().min(1).describe("Backup zip content, base64-encoded."),
|
|
184
|
+
skipReindex: z.boolean().optional(),
|
|
185
|
+
});
|
|
186
|
+
export async function adminCreateSiteRestoreJobFromUpload(client, args) {
|
|
187
|
+
return withConfluenceErrorHandling(async () => {
|
|
188
|
+
const bytes = Buffer.from(args.contentBase64, "base64");
|
|
189
|
+
const form = new FormData();
|
|
190
|
+
form.append("file", new Blob([bytes], { type: "application/zip" }), args.filename);
|
|
191
|
+
if (args.skipReindex !== undefined)
|
|
192
|
+
form.append("skipReindex", String(args.skipReindex));
|
|
193
|
+
const response = await client.post("/rest/api/backup-restore/restore/site/upload", form, MULTIPART_UPLOAD_HEADERS);
|
|
194
|
+
return {
|
|
195
|
+
content: [
|
|
196
|
+
{ type: "text", text: `✅ Site restore job submitted from uploaded file "${args.filename}". ${DESTRUCTIVE_RESTORE_NOTE}` },
|
|
197
|
+
jsonDetailBlock(response.data),
|
|
198
|
+
],
|
|
199
|
+
};
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
export const AdminCreateSpaceRestoreJobFromUploadArgsSchema = z.object({
|
|
203
|
+
filename: z.string().min(1),
|
|
204
|
+
contentBase64: z.string().min(1).describe("Backup zip content, base64-encoded."),
|
|
205
|
+
skipReindex: z.boolean().optional(),
|
|
206
|
+
});
|
|
207
|
+
export async function adminCreateSpaceRestoreJobFromUpload(client, args) {
|
|
208
|
+
return withConfluenceErrorHandling(async () => {
|
|
209
|
+
const bytes = Buffer.from(args.contentBase64, "base64");
|
|
210
|
+
const form = new FormData();
|
|
211
|
+
form.append("file", new Blob([bytes], { type: "application/zip" }), args.filename);
|
|
212
|
+
if (args.skipReindex !== undefined)
|
|
213
|
+
form.append("skipReindex", String(args.skipReindex));
|
|
214
|
+
const response = await client.post("/rest/api/backup-restore/restore/space/upload", form, MULTIPART_UPLOAD_HEADERS);
|
|
215
|
+
return {
|
|
216
|
+
content: [
|
|
217
|
+
{ type: "text", text: `✅ Space restore job submitted from uploaded file "${args.filename}". ${DESTRUCTIVE_RESTORE_NOTE}` },
|
|
218
|
+
jsonDetailBlock(response.data),
|
|
219
|
+
],
|
|
220
|
+
};
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=backup-restore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backup-restore.js","sourceRoot":"","sources":["../../src/tools/backup-restore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAc,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEhE,MAAM,wBAAwB,GAAG,EAAE,mBAAmB,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,CAAC;AAEhG,gGAAgG;AAChG,6FAA6F;AAC7F,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,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,+CAA+C,EAAE,IAAI,EAAE,wBAAwB,CAAC,CAAC;QACpH,OAAO;YACL,OAAO,EAAE;gBACP,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,qDAAqD,IAAI,CAAC,QAAQ,MAAM,wBAAwB,EAAE,EAAE;gBAC1H,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC;aAC/B;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ConfluenceClient } from "../confluence-client.js";
|
|
3
|
+
import { ToolResult } from "./spaces-pages.js";
|
|
4
|
+
export declare const GetBulkPageChildrenArgsSchema: z.ZodObject<{
|
|
5
|
+
pageId: z.ZodString;
|
|
6
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
7
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
pageId: string;
|
|
10
|
+
limit?: number | undefined;
|
|
11
|
+
cursor?: string | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
pageId: string;
|
|
14
|
+
limit?: number | undefined;
|
|
15
|
+
cursor?: string | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
export type GetBulkPageChildrenArgs = z.infer<typeof GetBulkPageChildrenArgsSchema>;
|
|
18
|
+
export declare function getBulkPageChildren(client: ConfluenceClient, args: GetBulkPageChildrenArgs): Promise<ToolResult>;
|
|
19
|
+
export declare const BulkDeletePagesArgsSchema: z.ZodObject<{
|
|
20
|
+
pages: z.ZodArray<z.ZodObject<{
|
|
21
|
+
contentId: z.ZodString;
|
|
22
|
+
deleteAllDescendants: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
excludedDescendantIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
contentId: string;
|
|
26
|
+
deleteAllDescendants?: boolean | undefined;
|
|
27
|
+
excludedDescendantIds?: string[] | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
contentId: string;
|
|
30
|
+
deleteAllDescendants?: boolean | undefined;
|
|
31
|
+
excludedDescendantIds?: string[] | undefined;
|
|
32
|
+
}>, "many">;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
pages: {
|
|
35
|
+
contentId: string;
|
|
36
|
+
deleteAllDescendants?: boolean | undefined;
|
|
37
|
+
excludedDescendantIds?: string[] | undefined;
|
|
38
|
+
}[];
|
|
39
|
+
}, {
|
|
40
|
+
pages: {
|
|
41
|
+
contentId: string;
|
|
42
|
+
deleteAllDescendants?: boolean | undefined;
|
|
43
|
+
excludedDescendantIds?: string[] | undefined;
|
|
44
|
+
}[];
|
|
45
|
+
}>;
|
|
46
|
+
export type BulkDeletePagesArgs = z.infer<typeof BulkDeletePagesArgsSchema>;
|
|
47
|
+
export declare function bulkDeletePages(client: ConfluenceClient, args: BulkDeletePagesArgs): Promise<ToolResult>;
|
|
48
|
+
export declare const GetDeletableDescendantCountsArgsSchema: z.ZodObject<{
|
|
49
|
+
pageIds: z.ZodArray<z.ZodNumber, "many">;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
pageIds: number[];
|
|
52
|
+
}, {
|
|
53
|
+
pageIds: number[];
|
|
54
|
+
}>;
|
|
55
|
+
export type GetDeletableDescendantCountsArgs = z.infer<typeof GetDeletableDescendantCountsArgsSchema>;
|
|
56
|
+
export declare function getDeletableDescendantCounts(client: ConfluenceClient, args: GetDeletableDescendantCountsArgs): Promise<ToolResult>;
|
|
57
|
+
export declare const GetBulkDeleteLimitsArgsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
58
|
+
export type GetBulkDeleteLimitsArgs = z.infer<typeof GetBulkDeleteLimitsArgsSchema>;
|
|
59
|
+
export declare function getBulkDeleteLimits(client: ConfluenceClient, _args: GetBulkDeleteLimitsArgs): Promise<ToolResult>;
|
|
60
|
+
export declare const PreviewBulkDeleteArgsSchema: z.ZodObject<{
|
|
61
|
+
pages: z.ZodArray<z.ZodObject<{
|
|
62
|
+
contentId: z.ZodString;
|
|
63
|
+
deleteAllDescendants: z.ZodOptional<z.ZodBoolean>;
|
|
64
|
+
excludedDescendantIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
contentId: string;
|
|
67
|
+
deleteAllDescendants?: boolean | undefined;
|
|
68
|
+
excludedDescendantIds?: string[] | undefined;
|
|
69
|
+
}, {
|
|
70
|
+
contentId: string;
|
|
71
|
+
deleteAllDescendants?: boolean | undefined;
|
|
72
|
+
excludedDescendantIds?: string[] | undefined;
|
|
73
|
+
}>, "many">;
|
|
74
|
+
}, "strip", z.ZodTypeAny, {
|
|
75
|
+
pages: {
|
|
76
|
+
contentId: string;
|
|
77
|
+
deleteAllDescendants?: boolean | undefined;
|
|
78
|
+
excludedDescendantIds?: string[] | undefined;
|
|
79
|
+
}[];
|
|
80
|
+
}, {
|
|
81
|
+
pages: {
|
|
82
|
+
contentId: string;
|
|
83
|
+
deleteAllDescendants?: boolean | undefined;
|
|
84
|
+
excludedDescendantIds?: string[] | undefined;
|
|
85
|
+
}[];
|
|
86
|
+
}>;
|
|
87
|
+
export type PreviewBulkDeleteArgs = z.infer<typeof PreviewBulkDeleteArgsSchema>;
|
|
88
|
+
export declare function previewBulkDelete(client: ConfluenceClient, args: PreviewBulkDeleteArgs): Promise<ToolResult>;
|
|
89
|
+
export declare const GetSpaceRootPagesArgsSchema: z.ZodObject<{
|
|
90
|
+
spaceKey: z.ZodString;
|
|
91
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
92
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
spaceKey: string;
|
|
95
|
+
limit?: number | undefined;
|
|
96
|
+
cursor?: string | undefined;
|
|
97
|
+
}, {
|
|
98
|
+
spaceKey: string;
|
|
99
|
+
limit?: number | undefined;
|
|
100
|
+
cursor?: string | undefined;
|
|
101
|
+
}>;
|
|
102
|
+
export type GetSpaceRootPagesArgs = z.infer<typeof GetSpaceRootPagesArgsSchema>;
|
|
103
|
+
export declare function getSpaceRootPages(client: ConfluenceClient, args: GetSpaceRootPagesArgs): Promise<ToolResult>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { withConfluenceErrorHandling } from "./errors.js";
|
|
3
|
+
import { jsonDetailBlock } from "./spaces-pages.js";
|
|
4
|
+
export const GetBulkPageChildrenArgsSchema = z.object({
|
|
5
|
+
pageId: z.string().min(1),
|
|
6
|
+
cursor: z.string().optional(),
|
|
7
|
+
limit: z.number().int().positive().optional(),
|
|
8
|
+
});
|
|
9
|
+
export async function getBulkPageChildren(client, args) {
|
|
10
|
+
return withConfluenceErrorHandling(async () => {
|
|
11
|
+
const response = await client.get(`/rest/api/content/bulk/page/${encodeURIComponent(args.pageId)}/children`, {
|
|
12
|
+
cursor: args.cursor,
|
|
13
|
+
limit: args.limit,
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
content: [
|
|
17
|
+
{ type: "text", text: `✅ Bulk children of page ${args.pageId} retrieved` },
|
|
18
|
+
jsonDetailBlock(response.data),
|
|
19
|
+
],
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const BulkDeleteEntrySchema = z.object({
|
|
24
|
+
contentId: z.string().min(1),
|
|
25
|
+
deleteAllDescendants: z.boolean().optional(),
|
|
26
|
+
excludedDescendantIds: z.array(z.string()).optional(),
|
|
27
|
+
});
|
|
28
|
+
export const BulkDeletePagesArgsSchema = z.object({
|
|
29
|
+
pages: z.array(BulkDeleteEntrySchema).min(1),
|
|
30
|
+
});
|
|
31
|
+
export async function bulkDeletePages(client, args) {
|
|
32
|
+
return withConfluenceErrorHandling(async () => {
|
|
33
|
+
const response = await client.post("/rest/api/content/bulk/page/delete", args.pages.map((p) => ({
|
|
34
|
+
contentId: p.contentId,
|
|
35
|
+
deleteAllDescendants: p.deleteAllDescendants ?? false,
|
|
36
|
+
...(p.excludedDescendantIds ? { excludedDescendantIds: p.excludedDescendantIds } : {}),
|
|
37
|
+
})));
|
|
38
|
+
return {
|
|
39
|
+
content: [
|
|
40
|
+
{ type: "text", text: `✅ Bulk delete submitted for ${args.pages.length} page(s)` },
|
|
41
|
+
jsonDetailBlock(response.data),
|
|
42
|
+
],
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export const GetDeletableDescendantCountsArgsSchema = z.object({
|
|
47
|
+
pageIds: z.array(z.number().int().positive()).min(1),
|
|
48
|
+
});
|
|
49
|
+
export async function getDeletableDescendantCounts(client, args) {
|
|
50
|
+
return withConfluenceErrorHandling(async () => {
|
|
51
|
+
const response = await client.post("/rest/api/content/bulk/page/delete/deletableDescendantCounts", {
|
|
52
|
+
pageIds: args.pageIds,
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
content: [
|
|
56
|
+
{ type: "text", text: `✅ Deletable descendant counts retrieved for ${args.pageIds.length} page(s)` },
|
|
57
|
+
jsonDetailBlock(response.data),
|
|
58
|
+
],
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
export const GetBulkDeleteLimitsArgsSchema = z.object({});
|
|
63
|
+
export async function getBulkDeleteLimits(client, _args) {
|
|
64
|
+
return withConfluenceErrorHandling(async () => {
|
|
65
|
+
const response = await client.get("/rest/api/content/bulk/page/delete/limits");
|
|
66
|
+
return {
|
|
67
|
+
content: [
|
|
68
|
+
{ type: "text", text: "✅ Bulk delete limits retrieved" },
|
|
69
|
+
jsonDetailBlock(response.data),
|
|
70
|
+
],
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
export const PreviewBulkDeleteArgsSchema = z.object({
|
|
75
|
+
pages: z.array(BulkDeleteEntrySchema).min(1),
|
|
76
|
+
});
|
|
77
|
+
export async function previewBulkDelete(client, args) {
|
|
78
|
+
return withConfluenceErrorHandling(async () => {
|
|
79
|
+
const response = await client.post("/rest/api/content/bulk/page/delete/preview", args.pages.map((p) => ({
|
|
80
|
+
contentId: p.contentId,
|
|
81
|
+
deleteAllDescendants: p.deleteAllDescendants ?? false,
|
|
82
|
+
...(p.excludedDescendantIds ? { excludedDescendantIds: p.excludedDescendantIds } : {}),
|
|
83
|
+
})));
|
|
84
|
+
return {
|
|
85
|
+
content: [
|
|
86
|
+
{ type: "text", text: `✅ Bulk delete preview for ${args.pages.length} page(s) — nothing was deleted` },
|
|
87
|
+
jsonDetailBlock(response.data),
|
|
88
|
+
],
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
export const GetSpaceRootPagesArgsSchema = z.object({
|
|
93
|
+
spaceKey: z.string().min(1),
|
|
94
|
+
cursor: z.string().optional(),
|
|
95
|
+
limit: z.number().int().positive().optional(),
|
|
96
|
+
});
|
|
97
|
+
export async function getSpaceRootPages(client, args) {
|
|
98
|
+
return withConfluenceErrorHandling(async () => {
|
|
99
|
+
const response = await client.get(`/rest/api/content/bulk/page/space/${encodeURIComponent(args.spaceKey)}/root`, {
|
|
100
|
+
cursor: args.cursor,
|
|
101
|
+
limit: args.limit,
|
|
102
|
+
});
|
|
103
|
+
return {
|
|
104
|
+
content: [
|
|
105
|
+
{ type: "text", text: `✅ Root pages for space ${args.spaceKey} retrieved` },
|
|
106
|
+
jsonDetailBlock(response.data),
|
|
107
|
+
],
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=bulk-pages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bulk-pages.js","sourceRoot":"","sources":["../../src/tools/bulk-pages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE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CAAC,QAAQ,YAAY,EAAE;gBAC3E,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC;aAC/B;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ConfluenceClient } from "../confluence-client.js";
|
|
3
|
+
import { ToolResult } from "./spaces-pages.js";
|
|
4
|
+
export declare const GetGlobalColorSchemeArgsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
5
|
+
export type GetGlobalColorSchemeArgs = z.infer<typeof GetGlobalColorSchemeArgsSchema>;
|
|
6
|
+
export declare function getGlobalColorScheme(client: ConfluenceClient, _args: GetGlobalColorSchemeArgs): Promise<ToolResult>;
|
|
7
|
+
export declare const UpdateGlobalColorSchemeArgsSchema: z.ZodObject<{
|
|
8
|
+
scheme: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
scheme: Record<string, unknown>;
|
|
11
|
+
}, {
|
|
12
|
+
scheme: Record<string, unknown>;
|
|
13
|
+
}>;
|
|
14
|
+
export type UpdateGlobalColorSchemeArgs = z.infer<typeof UpdateGlobalColorSchemeArgsSchema>;
|
|
15
|
+
export declare function updateGlobalColorScheme(client: ConfluenceClient, args: UpdateGlobalColorSchemeArgs): Promise<ToolResult>;
|
|
16
|
+
export declare const GetDefaultGlobalColorSchemeArgsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
17
|
+
export type GetDefaultGlobalColorSchemeArgs = z.infer<typeof GetDefaultGlobalColorSchemeArgsSchema>;
|
|
18
|
+
export declare function getDefaultGlobalColorScheme(client: ConfluenceClient, _args: GetDefaultGlobalColorSchemeArgs): Promise<ToolResult>;
|
|
19
|
+
export declare const ResetGlobalColorSchemeArgsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
20
|
+
export type ResetGlobalColorSchemeArgs = z.infer<typeof ResetGlobalColorSchemeArgsSchema>;
|
|
21
|
+
export declare function resetGlobalColorScheme(client: ConfluenceClient, _args: ResetGlobalColorSchemeArgs): Promise<ToolResult>;
|
|
22
|
+
export declare const GetSpaceColorSchemeArgsSchema: z.ZodObject<{
|
|
23
|
+
spaceKey: z.ZodString;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
spaceKey: string;
|
|
26
|
+
}, {
|
|
27
|
+
spaceKey: string;
|
|
28
|
+
}>;
|
|
29
|
+
export type GetSpaceColorSchemeArgs = z.infer<typeof GetSpaceColorSchemeArgsSchema>;
|
|
30
|
+
export declare function getSpaceColorScheme(client: ConfluenceClient, args: GetSpaceColorSchemeArgs): Promise<ToolResult>;
|
|
31
|
+
export declare const UpdateSpaceColorSchemeArgsSchema: z.ZodObject<{
|
|
32
|
+
spaceKey: z.ZodString;
|
|
33
|
+
scheme: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
spaceKey: string;
|
|
36
|
+
scheme: Record<string, unknown>;
|
|
37
|
+
}, {
|
|
38
|
+
spaceKey: string;
|
|
39
|
+
scheme: Record<string, unknown>;
|
|
40
|
+
}>;
|
|
41
|
+
export type UpdateSpaceColorSchemeArgs = z.infer<typeof UpdateSpaceColorSchemeArgsSchema>;
|
|
42
|
+
export declare function updateSpaceColorScheme(client: ConfluenceClient, args: UpdateSpaceColorSchemeArgs): Promise<ToolResult>;
|
|
43
|
+
export declare const ResetSpaceColorSchemeArgsSchema: z.ZodObject<{
|
|
44
|
+
spaceKey: z.ZodString;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
spaceKey: string;
|
|
47
|
+
}, {
|
|
48
|
+
spaceKey: string;
|
|
49
|
+
}>;
|
|
50
|
+
export type ResetSpaceColorSchemeArgs = z.infer<typeof ResetSpaceColorSchemeArgsSchema>;
|
|
51
|
+
export declare function resetSpaceColorScheme(client: ConfluenceClient, args: ResetSpaceColorSchemeArgs): Promise<ToolResult>;
|
|
52
|
+
export declare const GetSpaceColorSchemeTypeArgsSchema: z.ZodObject<{
|
|
53
|
+
spaceKey: z.ZodString;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
spaceKey: string;
|
|
56
|
+
}, {
|
|
57
|
+
spaceKey: string;
|
|
58
|
+
}>;
|
|
59
|
+
export type GetSpaceColorSchemeTypeArgs = z.infer<typeof GetSpaceColorSchemeTypeArgsSchema>;
|
|
60
|
+
export declare function getSpaceColorSchemeType(client: ConfluenceClient, args: GetSpaceColorSchemeTypeArgs): Promise<ToolResult>;
|
|
61
|
+
export declare const UpdateSpaceColorSchemeTypeArgsSchema: z.ZodObject<{
|
|
62
|
+
spaceKey: z.ZodString;
|
|
63
|
+
type: z.ZodString;
|
|
64
|
+
}, "strip", z.ZodTypeAny, {
|
|
65
|
+
type: string;
|
|
66
|
+
spaceKey: string;
|
|
67
|
+
}, {
|
|
68
|
+
type: string;
|
|
69
|
+
spaceKey: string;
|
|
70
|
+
}>;
|
|
71
|
+
export type UpdateSpaceColorSchemeTypeArgs = z.infer<typeof UpdateSpaceColorSchemeTypeArgsSchema>;
|
|
72
|
+
export declare function updateSpaceColorSchemeType(client: ConfluenceClient, args: UpdateSpaceColorSchemeTypeArgs): Promise<ToolResult>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { withConfluenceErrorHandling } from "./errors.js";
|
|
3
|
+
import { jsonDetailBlock } from "./spaces-pages.js";
|
|
4
|
+
// Color scheme objects have many theme-specific hex-color fields (light/dark variants) — accepted
|
|
5
|
+
// and returned as an opaque JSON object rather than an exhaustively-typed schema, same pattern as
|
|
6
|
+
// this project's other settings-blob tools (e.g. content/space properties).
|
|
7
|
+
const SchemeArgSchema = z.record(z.string(), z.unknown());
|
|
8
|
+
export const GetGlobalColorSchemeArgsSchema = z.object({});
|
|
9
|
+
export async function getGlobalColorScheme(client, _args) {
|
|
10
|
+
return withConfluenceErrorHandling(async () => {
|
|
11
|
+
const response = await client.get("/rest/api/color-scheme");
|
|
12
|
+
return {
|
|
13
|
+
content: [
|
|
14
|
+
{ type: "text", text: "✅ Global color scheme retrieved" },
|
|
15
|
+
jsonDetailBlock(response.data),
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export const UpdateGlobalColorSchemeArgsSchema = z.object({ scheme: SchemeArgSchema });
|
|
21
|
+
export async function updateGlobalColorScheme(client, args) {
|
|
22
|
+
return withConfluenceErrorHandling(async () => {
|
|
23
|
+
const response = await client.put("/rest/api/color-scheme", args.scheme);
|
|
24
|
+
return {
|
|
25
|
+
content: [
|
|
26
|
+
{ type: "text", text: "✅ Global color scheme updated" },
|
|
27
|
+
jsonDetailBlock(response.data),
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export const GetDefaultGlobalColorSchemeArgsSchema = z.object({});
|
|
33
|
+
export async function getDefaultGlobalColorScheme(client, _args) {
|
|
34
|
+
return withConfluenceErrorHandling(async () => {
|
|
35
|
+
const response = await client.get("/rest/api/color-scheme/default");
|
|
36
|
+
return {
|
|
37
|
+
content: [
|
|
38
|
+
{ type: "text", text: "✅ Default global color scheme retrieved" },
|
|
39
|
+
jsonDetailBlock(response.data),
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
export const ResetGlobalColorSchemeArgsSchema = z.object({});
|
|
45
|
+
export async function resetGlobalColorScheme(client, _args) {
|
|
46
|
+
return withConfluenceErrorHandling(async () => {
|
|
47
|
+
const response = await client.put("/rest/api/color-scheme/reset");
|
|
48
|
+
return {
|
|
49
|
+
content: [
|
|
50
|
+
{ type: "text", text: "✅ Global color scheme reset to default" },
|
|
51
|
+
jsonDetailBlock(response.data),
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
export const GetSpaceColorSchemeArgsSchema = z.object({ spaceKey: z.string().min(1) });
|
|
57
|
+
export async function getSpaceColorScheme(client, args) {
|
|
58
|
+
return withConfluenceErrorHandling(async () => {
|
|
59
|
+
const response = await client.get(`/rest/api/space/${encodeURIComponent(args.spaceKey)}/color-scheme`);
|
|
60
|
+
return {
|
|
61
|
+
content: [
|
|
62
|
+
{ type: "text", text: `✅ Color scheme for space ${args.spaceKey} retrieved` },
|
|
63
|
+
jsonDetailBlock(response.data),
|
|
64
|
+
],
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
export const UpdateSpaceColorSchemeArgsSchema = z.object({ spaceKey: z.string().min(1), scheme: SchemeArgSchema });
|
|
69
|
+
export async function updateSpaceColorScheme(client, args) {
|
|
70
|
+
return withConfluenceErrorHandling(async () => {
|
|
71
|
+
const response = await client.put(`/rest/api/space/${encodeURIComponent(args.spaceKey)}/color-scheme`, args.scheme);
|
|
72
|
+
return {
|
|
73
|
+
content: [
|
|
74
|
+
{ type: "text", text: `✅ Color scheme for space ${args.spaceKey} updated` },
|
|
75
|
+
jsonDetailBlock(response.data),
|
|
76
|
+
],
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
export const ResetSpaceColorSchemeArgsSchema = z.object({ spaceKey: z.string().min(1) });
|
|
81
|
+
export async function resetSpaceColorScheme(client, args) {
|
|
82
|
+
return withConfluenceErrorHandling(async () => {
|
|
83
|
+
const response = await client.put(`/rest/api/space/${encodeURIComponent(args.spaceKey)}/color-scheme/reset`);
|
|
84
|
+
return {
|
|
85
|
+
content: [
|
|
86
|
+
{ type: "text", text: `✅ Color scheme for space ${args.spaceKey} reset to default` },
|
|
87
|
+
jsonDetailBlock(response.data),
|
|
88
|
+
],
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
export const GetSpaceColorSchemeTypeArgsSchema = z.object({ spaceKey: z.string().min(1) });
|
|
93
|
+
export async function getSpaceColorSchemeType(client, args) {
|
|
94
|
+
return withConfluenceErrorHandling(async () => {
|
|
95
|
+
const response = await client.get(`/rest/api/space/${encodeURIComponent(args.spaceKey)}/color-scheme/type`);
|
|
96
|
+
return {
|
|
97
|
+
content: [
|
|
98
|
+
{ type: "text", text: `✅ Color scheme type for space ${args.spaceKey}: "${response.data.type}"` },
|
|
99
|
+
jsonDetailBlock(response.data),
|
|
100
|
+
],
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
export const UpdateSpaceColorSchemeTypeArgsSchema = z.object({
|
|
105
|
+
spaceKey: z.string().min(1),
|
|
106
|
+
type: z.string().describe('e.g. "global" (inherit instance default) or "custom".'),
|
|
107
|
+
});
|
|
108
|
+
export async function updateSpaceColorSchemeType(client, args) {
|
|
109
|
+
return withConfluenceErrorHandling(async () => {
|
|
110
|
+
const response = await client.put(`/rest/api/space/${encodeURIComponent(args.spaceKey)}/color-scheme/type`, {
|
|
111
|
+
type: args.type,
|
|
112
|
+
});
|
|
113
|
+
return {
|
|
114
|
+
content: [
|
|
115
|
+
{ type: "text", text: `✅ Color scheme type for space ${args.spaceKey} set to "${response.data.type}"` },
|
|
116
|
+
jsonDetailBlock(response.data),
|
|
117
|
+
],
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=color-schemes.js.map
|