@jclvsh/dropspace 2.0.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 +273 -0
- package/dist/cli-utils.d.ts +4 -0
- package/dist/cli-utils.js +31 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +31 -0
- package/dist/client.d.ts +11 -0
- package/dist/client.js +110 -0
- package/dist/commands/connections.d.ts +3 -0
- package/dist/commands/connections.js +23 -0
- package/dist/commands/dropspace.d.ts +3 -0
- package/dist/commands/dropspace.js +15 -0
- package/dist/commands/keys.d.ts +3 -0
- package/dist/commands/keys.js +70 -0
- package/dist/commands/launches.d.ts +3 -0
- package/dist/commands/launches.js +263 -0
- package/dist/commands/personas.d.ts +3 -0
- package/dist/commands/personas.js +116 -0
- package/dist/commands/usage.d.ts +3 -0
- package/dist/commands/usage.js +15 -0
- package/dist/commands/webhooks.d.ts +3 -0
- package/dist/commands/webhooks.js +108 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +25 -0
- package/dist/tools/connections.d.ts +3 -0
- package/dist/tools/connections.js +30 -0
- package/dist/tools/dropspace.d.ts +3 -0
- package/dist/tools/dropspace.js +21 -0
- package/dist/tools/keys.d.ts +3 -0
- package/dist/tools/keys.js +107 -0
- package/dist/tools/launches.d.ts +3 -0
- package/dist/tools/launches.js +492 -0
- package/dist/tools/personas.d.ts +3 -0
- package/dist/tools/personas.js +152 -0
- package/dist/tools/usage.d.ts +3 -0
- package/dist/tools/usage.js +21 -0
- package/dist/tools/webhooks.d.ts +3 -0
- package/dist/tools/webhooks.js +183 -0
- package/dist/types.d.ts +257 -0
- package/dist/types.js +1 -0
- package/package.json +33 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { formatOutput, handleError, getFormat, parseList } from "../cli-utils.js";
|
|
2
|
+
export function registerLaunchCommands(program, client) {
|
|
3
|
+
const launches = program.command("launches").alias("l").description("manage launches");
|
|
4
|
+
launches
|
|
5
|
+
.command("list")
|
|
6
|
+
.description("list launches with pagination")
|
|
7
|
+
.option("-p, --page <n>", "page number", "1")
|
|
8
|
+
.option("-s, --page-size <n>", "items per page (max 100)", "50")
|
|
9
|
+
.action(async (opts) => {
|
|
10
|
+
try {
|
|
11
|
+
const params = {};
|
|
12
|
+
if (opts.page)
|
|
13
|
+
params.page = opts.page;
|
|
14
|
+
if (opts.pageSize)
|
|
15
|
+
params.page_size = opts.pageSize;
|
|
16
|
+
const result = await client.get("/launches", params);
|
|
17
|
+
formatOutput(result, getFormat(program.opts()));
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
handleError(error);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
launches
|
|
24
|
+
.command("create")
|
|
25
|
+
.description("create a new launch")
|
|
26
|
+
.requiredOption("-t, --title <title>", "launch title")
|
|
27
|
+
.option("-d, --description <text>", "product description")
|
|
28
|
+
.option("--platforms <list>", "comma-separated platforms", parseList)
|
|
29
|
+
.option("--url <url>", "product URL")
|
|
30
|
+
.option("--schedule <datetime>", "ISO 8601 schedule datetime")
|
|
31
|
+
.option("--persona <id>", "persona ID for tone/style")
|
|
32
|
+
.option("--dropspace-platforms <list>", "platforms for official dropspace accounts", parseList)
|
|
33
|
+
.option("--media-mode <mode>", "media mode: images or video")
|
|
34
|
+
.option("--platform-contents <json>", "per-platform content as JSON string")
|
|
35
|
+
.option("--custom-content <text>", "single content string for all platforms")
|
|
36
|
+
.option("--reddit-title <title>", "reddit title (with custom-content)")
|
|
37
|
+
.option("--user-accounts <json>", "platform-to-token_id map as JSON string")
|
|
38
|
+
.option("--publish", "immediately publish after creation")
|
|
39
|
+
.option("--wait", "wait for publishing to complete (requires --publish)")
|
|
40
|
+
.action(async (opts) => {
|
|
41
|
+
try {
|
|
42
|
+
const body = { title: opts.title };
|
|
43
|
+
if (opts.description)
|
|
44
|
+
body.product_description = opts.description;
|
|
45
|
+
if (opts.platforms)
|
|
46
|
+
body.platforms = opts.platforms;
|
|
47
|
+
if (opts.url)
|
|
48
|
+
body.product_url = opts.url;
|
|
49
|
+
if (opts.schedule)
|
|
50
|
+
body.scheduled_date = opts.schedule;
|
|
51
|
+
if (opts.persona)
|
|
52
|
+
body.persona_id = opts.persona;
|
|
53
|
+
if (opts.dropspacePlatforms)
|
|
54
|
+
body.dropspace_platforms = opts.dropspacePlatforms;
|
|
55
|
+
if (opts.mediaMode)
|
|
56
|
+
body.media_mode = opts.mediaMode;
|
|
57
|
+
if (opts.platformContents)
|
|
58
|
+
body.platform_contents = JSON.parse(opts.platformContents);
|
|
59
|
+
if (opts.customContent)
|
|
60
|
+
body.custom_content = opts.customContent;
|
|
61
|
+
if (opts.redditTitle)
|
|
62
|
+
body.custom_content_reddit_title = opts.redditTitle;
|
|
63
|
+
if (opts.userAccounts)
|
|
64
|
+
body.user_platform_accounts = JSON.parse(opts.userAccounts);
|
|
65
|
+
if (opts.publish)
|
|
66
|
+
body.publish = true;
|
|
67
|
+
if (opts.wait)
|
|
68
|
+
body.wait = true;
|
|
69
|
+
const result = await client.post("/launches", body);
|
|
70
|
+
formatOutput(result, getFormat(program.opts()));
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
handleError(error);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
launches
|
|
77
|
+
.command("get <id>")
|
|
78
|
+
.description("get a launch by ID")
|
|
79
|
+
.action(async (id) => {
|
|
80
|
+
try {
|
|
81
|
+
const result = await client.get(`/launches/${id}`);
|
|
82
|
+
formatOutput(result, getFormat(program.opts()));
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
handleError(error);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
launches
|
|
89
|
+
.command("update <id>")
|
|
90
|
+
.description("update a launch")
|
|
91
|
+
.option("-n, --name <name>", "launch name")
|
|
92
|
+
.option("-d, --description <text>", "product description")
|
|
93
|
+
.option("--platforms <list>", "comma-separated platforms", parseList)
|
|
94
|
+
.option("--url <url>", "product URL")
|
|
95
|
+
.option("--schedule <datetime>", "ISO 8601 schedule datetime (empty to clear)")
|
|
96
|
+
.option("--status <status>", "status: draft, manual, trigger, scheduled, cancelled")
|
|
97
|
+
.option("--persona <id>", "persona ID (empty to clear)")
|
|
98
|
+
.option("--platform-contents <json>", "per-platform content as JSON string")
|
|
99
|
+
.option("--dropspace-platforms <list>", "official dropspace account platforms", parseList)
|
|
100
|
+
.option("--user-accounts <json>", "platform-to-token_id map as JSON string")
|
|
101
|
+
.option("--media-mode <mode>", "media mode: images or video")
|
|
102
|
+
.action(async (id, opts) => {
|
|
103
|
+
try {
|
|
104
|
+
const body = {};
|
|
105
|
+
if (opts.name)
|
|
106
|
+
body.name = opts.name;
|
|
107
|
+
if (opts.description)
|
|
108
|
+
body.product_description = opts.description;
|
|
109
|
+
if (opts.platforms)
|
|
110
|
+
body.platforms = opts.platforms;
|
|
111
|
+
if (opts.url !== undefined)
|
|
112
|
+
body.product_url = opts.url || "";
|
|
113
|
+
if (opts.schedule !== undefined)
|
|
114
|
+
body.scheduled_date = opts.schedule || null;
|
|
115
|
+
if (opts.status)
|
|
116
|
+
body.status = opts.status;
|
|
117
|
+
if (opts.persona !== undefined)
|
|
118
|
+
body.persona_id = opts.persona || null;
|
|
119
|
+
if (opts.platformContents)
|
|
120
|
+
body.platform_contents = JSON.parse(opts.platformContents);
|
|
121
|
+
if (opts.dropspacePlatforms)
|
|
122
|
+
body.dropspace_platforms = opts.dropspacePlatforms;
|
|
123
|
+
if (opts.userAccounts)
|
|
124
|
+
body.user_platform_accounts = JSON.parse(opts.userAccounts);
|
|
125
|
+
if (opts.mediaMode)
|
|
126
|
+
body.media_mode = opts.mediaMode;
|
|
127
|
+
const result = await client.patch(`/launches/${id}`, body);
|
|
128
|
+
formatOutput(result, getFormat(program.opts()));
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
handleError(error);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
launches
|
|
135
|
+
.command("delete <id>")
|
|
136
|
+
.description("delete a launch")
|
|
137
|
+
.action(async (id) => {
|
|
138
|
+
try {
|
|
139
|
+
await client.delete(`/launches/${id}`);
|
|
140
|
+
console.log("launch deleted");
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
handleError(error);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
launches
|
|
147
|
+
.command("publish <id>")
|
|
148
|
+
.description("publish a launch to all configured platforms")
|
|
149
|
+
.action(async (id) => {
|
|
150
|
+
try {
|
|
151
|
+
const result = await client.post(`/launches/${id}/publish`);
|
|
152
|
+
formatOutput(result, getFormat(program.opts()));
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
handleError(error);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
launches
|
|
159
|
+
.command("retry <id>")
|
|
160
|
+
.description("retry failed platforms for a launch")
|
|
161
|
+
.action(async (id) => {
|
|
162
|
+
try {
|
|
163
|
+
const result = await client.post(`/launches/${id}/retry`);
|
|
164
|
+
formatOutput(result, getFormat(program.opts()));
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
handleError(error);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
launches
|
|
171
|
+
.command("generate <id>")
|
|
172
|
+
.description("generate AI content for a launch")
|
|
173
|
+
.option("--platforms <list>", "specific platforms to generate for", parseList)
|
|
174
|
+
.action(async (id, opts) => {
|
|
175
|
+
try {
|
|
176
|
+
const body = {};
|
|
177
|
+
if (opts.platforms)
|
|
178
|
+
body.platforms = opts.platforms;
|
|
179
|
+
const result = await client.post(`/launches/${id}/generate-content`, body);
|
|
180
|
+
formatOutput(result, getFormat(program.opts()));
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
handleError(error);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
launches
|
|
187
|
+
.command("retry-content <id>")
|
|
188
|
+
.description("retry AI content generation for failed platforms")
|
|
189
|
+
.option("--platforms <list>", "specific platforms to retry", parseList)
|
|
190
|
+
.action(async (id, opts) => {
|
|
191
|
+
try {
|
|
192
|
+
const body = {};
|
|
193
|
+
if (opts.platforms)
|
|
194
|
+
body.platforms = opts.platforms;
|
|
195
|
+
const result = await client.post(`/launches/${id}/retry-content`, body);
|
|
196
|
+
formatOutput(result, getFormat(program.opts()));
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
handleError(error);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
launches
|
|
203
|
+
.command("analytics <id>")
|
|
204
|
+
.description("get launch analytics with per-post engagement metrics")
|
|
205
|
+
.action(async (id) => {
|
|
206
|
+
try {
|
|
207
|
+
const result = await client.get(`/launches/${id}/analytics`);
|
|
208
|
+
formatOutput(result, getFormat(program.opts()));
|
|
209
|
+
}
|
|
210
|
+
catch (error) {
|
|
211
|
+
handleError(error);
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
launches
|
|
215
|
+
.command("batch-analytics")
|
|
216
|
+
.description("get cached analytics for multiple launches")
|
|
217
|
+
.requiredOption("--ids <list>", "comma-separated launch IDs", parseList)
|
|
218
|
+
.action(async (opts) => {
|
|
219
|
+
try {
|
|
220
|
+
const result = await client.get("/launches/analytics", { ids: opts.ids.join(",") });
|
|
221
|
+
formatOutput(result, getFormat(program.opts()));
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
handleError(error);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
launches
|
|
228
|
+
.command("status <id>")
|
|
229
|
+
.description("get detailed posting status with per-platform logs")
|
|
230
|
+
.action(async (id) => {
|
|
231
|
+
try {
|
|
232
|
+
const result = await client.get(`/launches/${id}/status`);
|
|
233
|
+
formatOutput(result, getFormat(program.opts()));
|
|
234
|
+
}
|
|
235
|
+
catch (error) {
|
|
236
|
+
handleError(error);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
launches
|
|
240
|
+
.command("delete-post <launch-id> <posting-log-id>")
|
|
241
|
+
.description("delete a single published post from its platform")
|
|
242
|
+
.action(async (launchId, postingLogId) => {
|
|
243
|
+
try {
|
|
244
|
+
await client.delete(`/launches/${launchId}/posts/${postingLogId}`);
|
|
245
|
+
console.log("post deleted");
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
handleError(error);
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
launches
|
|
252
|
+
.command("delete-posts <id>")
|
|
253
|
+
.description("delete all published posts for a launch")
|
|
254
|
+
.action(async (id) => {
|
|
255
|
+
try {
|
|
256
|
+
await client.delete(`/launches/${id}/posts`);
|
|
257
|
+
console.log("all posts deleted");
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
handleError(error);
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { formatOutput, handleError, getFormat, parseList } from "../cli-utils.js";
|
|
2
|
+
export function registerPersonaCommands(program, client) {
|
|
3
|
+
const personas = program.command("personas").alias("p").description("manage personas");
|
|
4
|
+
personas
|
|
5
|
+
.command("list")
|
|
6
|
+
.description("list personas with pagination")
|
|
7
|
+
.option("-p, --page <n>", "page number", "1")
|
|
8
|
+
.option("-s, --page-size <n>", "items per page (max 100)", "50")
|
|
9
|
+
.action(async (opts) => {
|
|
10
|
+
try {
|
|
11
|
+
const params = {};
|
|
12
|
+
if (opts.page)
|
|
13
|
+
params.page = opts.page;
|
|
14
|
+
if (opts.pageSize)
|
|
15
|
+
params.page_size = opts.pageSize;
|
|
16
|
+
const result = await client.get("/personas", params);
|
|
17
|
+
formatOutput(result, getFormat(program.opts()));
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
handleError(error);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
personas
|
|
24
|
+
.command("create")
|
|
25
|
+
.description("create a new persona")
|
|
26
|
+
.requiredOption("-n, --name <name>", "persona name")
|
|
27
|
+
.action(async (opts) => {
|
|
28
|
+
try {
|
|
29
|
+
const result = await client.post("/personas", { name: opts.name });
|
|
30
|
+
formatOutput(result, getFormat(program.opts()));
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
handleError(error);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
personas
|
|
37
|
+
.command("get <id>")
|
|
38
|
+
.description("get a persona by ID")
|
|
39
|
+
.action(async (id) => {
|
|
40
|
+
try {
|
|
41
|
+
const result = await client.get(`/personas/${id}`);
|
|
42
|
+
formatOutput(result, getFormat(program.opts()));
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
handleError(error);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
personas
|
|
49
|
+
.command("update <id>")
|
|
50
|
+
.description("update a persona")
|
|
51
|
+
.option("-n, --name <name>", "new persona name")
|
|
52
|
+
.option("--custom-samples <json>", "custom writing samples as JSON array")
|
|
53
|
+
.option("--twitter-samples <json>", "twitter writing samples as JSON array")
|
|
54
|
+
.option("--reddit-samples <json>", "reddit writing samples as JSON array")
|
|
55
|
+
.option("--facebook-samples <json>", "facebook writing samples as JSON array")
|
|
56
|
+
.option("--instagram-samples <json>", "instagram writing samples as JSON array")
|
|
57
|
+
.option("--tiktok-samples <json>", "tiktok writing samples as JSON array")
|
|
58
|
+
.option("--linkedin-samples <json>", "linkedin writing samples as JSON array")
|
|
59
|
+
.action(async (id, opts) => {
|
|
60
|
+
try {
|
|
61
|
+
const body = {};
|
|
62
|
+
if (opts.name)
|
|
63
|
+
body.name = opts.name;
|
|
64
|
+
if (opts.customSamples)
|
|
65
|
+
body.custom_samples = JSON.parse(opts.customSamples);
|
|
66
|
+
if (opts.twitterSamples)
|
|
67
|
+
body.twitter_samples = JSON.parse(opts.twitterSamples);
|
|
68
|
+
if (opts.redditSamples)
|
|
69
|
+
body.reddit_samples = JSON.parse(opts.redditSamples);
|
|
70
|
+
if (opts.facebookSamples)
|
|
71
|
+
body.facebook_samples = JSON.parse(opts.facebookSamples);
|
|
72
|
+
if (opts.instagramSamples)
|
|
73
|
+
body.instagram_samples = JSON.parse(opts.instagramSamples);
|
|
74
|
+
if (opts.tiktokSamples)
|
|
75
|
+
body.tiktok_samples = JSON.parse(opts.tiktokSamples);
|
|
76
|
+
if (opts.linkedinSamples)
|
|
77
|
+
body.linkedin_samples = JSON.parse(opts.linkedinSamples);
|
|
78
|
+
const result = await client.patch(`/personas/${id}`, body);
|
|
79
|
+
formatOutput(result, getFormat(program.opts()));
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
handleError(error);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
personas
|
|
86
|
+
.command("delete <id>")
|
|
87
|
+
.description("delete a persona")
|
|
88
|
+
.action(async (id) => {
|
|
89
|
+
try {
|
|
90
|
+
await client.delete(`/personas/${id}`);
|
|
91
|
+
console.log("persona deleted");
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
handleError(error);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
personas
|
|
98
|
+
.command("analyze <id>")
|
|
99
|
+
.description("trigger AI analysis of a persona's writing style")
|
|
100
|
+
.option("--platforms <list>", "specific platforms to analyze", parseList)
|
|
101
|
+
.option("--include-custom", "include custom writing samples")
|
|
102
|
+
.action(async (id, opts) => {
|
|
103
|
+
try {
|
|
104
|
+
const body = {};
|
|
105
|
+
if (opts.platforms)
|
|
106
|
+
body.platforms = opts.platforms;
|
|
107
|
+
if (opts.includeCustom)
|
|
108
|
+
body.include_custom_samples = true;
|
|
109
|
+
const result = await client.post(`/personas/${id}/analyze`, body);
|
|
110
|
+
formatOutput(result, getFormat(program.opts()));
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
handleError(error);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { formatOutput, handleError, getFormat } from "../cli-utils.js";
|
|
2
|
+
export function registerUsageCommands(program, client) {
|
|
3
|
+
program
|
|
4
|
+
.command("usage")
|
|
5
|
+
.description("get current plan, usage limits, and billing period")
|
|
6
|
+
.action(async () => {
|
|
7
|
+
try {
|
|
8
|
+
const result = await client.get("/usage");
|
|
9
|
+
formatOutput(result, getFormat(program.opts()));
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
handleError(error);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { formatOutput, handleError, getFormat, parseList } from "../cli-utils.js";
|
|
2
|
+
export function registerWebhookCommands(program, client) {
|
|
3
|
+
const webhooks = program.command("webhooks").alias("w").description("manage webhooks");
|
|
4
|
+
webhooks
|
|
5
|
+
.command("list")
|
|
6
|
+
.description("list webhooks (requires admin scope)")
|
|
7
|
+
.action(async () => {
|
|
8
|
+
try {
|
|
9
|
+
const result = await client.get("/webhooks");
|
|
10
|
+
formatOutput(result, getFormat(program.opts()));
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
handleError(error);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
webhooks
|
|
17
|
+
.command("create")
|
|
18
|
+
.description("create a webhook endpoint (requires admin scope)")
|
|
19
|
+
.requiredOption("-u, --url <url>", "HTTPS webhook URL")
|
|
20
|
+
.requiredOption("-e, --events <list>", "comma-separated events: launch.completed,launch.failed,launch.partial,media.ready,persona.analyzed,post.deleted", parseList)
|
|
21
|
+
.action(async (opts) => {
|
|
22
|
+
try {
|
|
23
|
+
const result = await client.post("/webhooks", { url: opts.url, events: opts.events });
|
|
24
|
+
formatOutput(result, getFormat(program.opts()));
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
handleError(error);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
webhooks
|
|
31
|
+
.command("get <id>")
|
|
32
|
+
.description("get a webhook by ID (requires admin scope)")
|
|
33
|
+
.action(async (id) => {
|
|
34
|
+
try {
|
|
35
|
+
const result = await client.get(`/webhooks/${id}`);
|
|
36
|
+
formatOutput(result, getFormat(program.opts()));
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
handleError(error);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
webhooks
|
|
43
|
+
.command("update <id>")
|
|
44
|
+
.description("update a webhook (requires admin scope)")
|
|
45
|
+
.option("-u, --url <url>", "new HTTPS webhook URL")
|
|
46
|
+
.option("-e, --events <list>", "new events to subscribe to", parseList)
|
|
47
|
+
.option("--active", "enable the webhook")
|
|
48
|
+
.option("--no-active", "disable the webhook")
|
|
49
|
+
.action(async (id, opts) => {
|
|
50
|
+
try {
|
|
51
|
+
const body = {};
|
|
52
|
+
if (opts.url)
|
|
53
|
+
body.url = opts.url;
|
|
54
|
+
if (opts.events)
|
|
55
|
+
body.events = opts.events;
|
|
56
|
+
if (opts.active !== undefined)
|
|
57
|
+
body.active = opts.active;
|
|
58
|
+
const result = await client.patch(`/webhooks/${id}`, body);
|
|
59
|
+
formatOutput(result, getFormat(program.opts()));
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
handleError(error);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
webhooks
|
|
66
|
+
.command("delete <id>")
|
|
67
|
+
.description("delete a webhook (requires admin scope)")
|
|
68
|
+
.action(async (id) => {
|
|
69
|
+
try {
|
|
70
|
+
await client.delete(`/webhooks/${id}`);
|
|
71
|
+
console.log("webhook deleted");
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
handleError(error);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
webhooks
|
|
78
|
+
.command("rotate-secret <id>")
|
|
79
|
+
.description("rotate a webhook's signing secret (requires admin scope)")
|
|
80
|
+
.action(async (id) => {
|
|
81
|
+
try {
|
|
82
|
+
const result = await client.post(`/webhooks/${id}/rotate-secret`);
|
|
83
|
+
formatOutput(result, getFormat(program.opts()));
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
handleError(error);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
webhooks
|
|
90
|
+
.command("deliveries <id>")
|
|
91
|
+
.description("list delivery attempts for a webhook (requires admin scope)")
|
|
92
|
+
.option("-p, --page <n>", "page number", "1")
|
|
93
|
+
.option("-s, --page-size <n>", "items per page (max 100)", "50")
|
|
94
|
+
.action(async (id, opts) => {
|
|
95
|
+
try {
|
|
96
|
+
const params = {};
|
|
97
|
+
if (opts.page)
|
|
98
|
+
params.page = opts.page;
|
|
99
|
+
if (opts.pageSize)
|
|
100
|
+
params.page_size = opts.pageSize;
|
|
101
|
+
const result = await client.get(`/webhooks/${id}/deliveries`, params);
|
|
102
|
+
formatOutput(result, getFormat(program.opts()));
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
handleError(error);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { DropspaceClient } from "./client.js";
|
|
5
|
+
import { registerLaunchTools } from "./tools/launches.js";
|
|
6
|
+
import { registerPersonaTools } from "./tools/personas.js";
|
|
7
|
+
import { registerConnectionTools } from "./tools/connections.js";
|
|
8
|
+
import { registerKeyTools } from "./tools/keys.js";
|
|
9
|
+
import { registerWebhookTools } from "./tools/webhooks.js";
|
|
10
|
+
import { registerDropspaceTools } from "./tools/dropspace.js";
|
|
11
|
+
import { registerUsageTools } from "./tools/usage.js";
|
|
12
|
+
const server = new McpServer({
|
|
13
|
+
name: "dropspace",
|
|
14
|
+
version: "2.0.0",
|
|
15
|
+
});
|
|
16
|
+
const client = new DropspaceClient();
|
|
17
|
+
registerLaunchTools(server, client);
|
|
18
|
+
registerPersonaTools(server, client);
|
|
19
|
+
registerConnectionTools(server, client);
|
|
20
|
+
registerKeyTools(server, client);
|
|
21
|
+
registerWebhookTools(server, client);
|
|
22
|
+
registerDropspaceTools(server, client);
|
|
23
|
+
registerUsageTools(server, client);
|
|
24
|
+
const transport = new StdioServerTransport();
|
|
25
|
+
await server.connect(transport);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export function registerConnectionTools(server, client) {
|
|
3
|
+
server.tool("list_connections", "list your connected social media accounts", {
|
|
4
|
+
page: z.number().int().positive().optional().describe("page number (default: 1)"),
|
|
5
|
+
page_size: z.number().int().min(1).max(100).optional().describe("items per page (default: 50, max: 100)"),
|
|
6
|
+
}, async ({ page, page_size }) => {
|
|
7
|
+
try {
|
|
8
|
+
const params = {};
|
|
9
|
+
if (page !== undefined)
|
|
10
|
+
params.page = String(page);
|
|
11
|
+
if (page_size !== undefined)
|
|
12
|
+
params.page_size = String(page_size);
|
|
13
|
+
const result = await client.get("/connections", params);
|
|
14
|
+
return {
|
|
15
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
return {
|
|
20
|
+
content: [
|
|
21
|
+
{
|
|
22
|
+
type: "text",
|
|
23
|
+
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
isError: true,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function registerDropspaceTools(server, client) {
|
|
2
|
+
server.tool("get_dropspace_status", "check which platforms have a connected dropspace official account (requires read scope)", {}, async () => {
|
|
3
|
+
try {
|
|
4
|
+
const result = await client.get("/dropspace/status");
|
|
5
|
+
return {
|
|
6
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
catch (error) {
|
|
10
|
+
return {
|
|
11
|
+
content: [
|
|
12
|
+
{
|
|
13
|
+
type: "text",
|
|
14
|
+
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
isError: true,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|