outrank-cli 0.5.0 → 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/README.md +317 -20
- package/SKILL.md +20 -2
- package/bin/outrank-mcp.js +3 -0
- package/package.json +21 -5
- package/src/adapters/cli/jsonInput.js +42 -0
- package/src/adapters/cli/parse.js +124 -0
- package/src/adapters/cli/run.js +139 -0
- package/src/adapters/mcp/constants.js +49 -0
- package/src/adapters/mcp/descriptions.js +87 -0
- package/src/adapters/mcp/help.js +34 -0
- package/src/adapters/mcp/input.js +195 -0
- package/src/adapters/mcp/instructions.js +139 -0
- package/src/adapters/mcp/logger.js +45 -0
- package/src/adapters/mcp/main.js +36 -0
- package/src/adapters/mcp/options.js +118 -0
- package/src/adapters/mcp/result.js +33 -0
- package/src/adapters/mcp/server.js +174 -0
- package/src/adapters/mcp/session.js +274 -0
- package/src/adapters/mcp/toolNotes.js +426 -0
- package/src/adapters/mcp/toolsets.js +106 -0
- package/src/commands/articles.js +285 -301
- package/src/commands/auth.js +204 -86
- package/src/commands/billing.js +102 -104
- package/src/commands/improvements.js +319 -211
- package/src/commands/index.js +22 -0
- package/src/commands/keywords.js +266 -249
- package/src/commands/marketplace/buyer.js +386 -0
- package/src/commands/marketplace/index.js +83 -0
- package/src/commands/marketplace/notifications.js +60 -0
- package/src/commands/marketplace/seller.js +595 -0
- package/src/commands/marketplace/shared.js +27 -0
- package/src/commands/products/backlinks.js +181 -0
- package/src/commands/products/core.js +149 -0
- package/src/commands/products/gsc.js +250 -0
- package/src/commands/products/index.js +174 -0
- package/src/commands/products/integrations.js +343 -0
- package/src/commands/products/linking.js +192 -0
- package/src/commands/products/shared.js +8 -0
- package/src/commands/registry.js +272 -0
- package/src/commands/subscription.js +20 -30
- package/src/commands/usage.js +17 -30
- package/src/core/config.js +243 -62
- package/src/core/constants.js +101 -0
- package/src/core/context.js +311 -0
- package/src/core/errors.js +39 -0
- package/src/core/execute.js +71 -0
- package/src/core/files.js +186 -0
- package/src/core/http.js +393 -0
- package/src/core/profileSelection.js +7 -0
- package/src/core/query.js +11 -0
- package/src/core/redact.js +27 -0
- package/src/core/schema.js +222 -0
- package/src/core/version.js +12 -0
- package/src/index.js +30 -58
- package/src/commands/marketplace.js +0 -740
- package/src/commands/products.js +0 -1185
- package/src/core/api.js +0 -82
- package/src/core/args.js +0 -144
package/src/commands/articles.js
CHANGED
|
@@ -1,301 +1,285 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
outrank-cli articles
|
|
17
|
-
outrank-cli articles
|
|
18
|
-
outrank-cli articles
|
|
19
|
-
outrank-cli articles
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
outrank-cli articles
|
|
26
|
-
outrank-cli articles
|
|
27
|
-
outrank-cli articles
|
|
28
|
-
outrank-cli articles
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
outrank-cli articles
|
|
35
|
-
outrank-cli articles
|
|
36
|
-
outrank-cli articles
|
|
37
|
-
outrank-cli articles
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
})
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
if (subcommand === 'update-content') return handleArticlesUpdateContent(parsed);
|
|
287
|
-
if (subcommand === 'replace') return handleArticlesReplace(parsed);
|
|
288
|
-
if (subcommand === 'bulk-replace') return handleArticlesBulkReplace(parsed);
|
|
289
|
-
if (subcommand === 'upload-image') return handleArticlesUploadImage(parsed);
|
|
290
|
-
if (subcommand === 'upload-featured-image') return handleArticlesUploadFeaturedImage(parsed);
|
|
291
|
-
if (subcommand === 'retry-publish') return handleArticlesRetryPublish(parsed);
|
|
292
|
-
if (subcommand === 'delete') return handleArticlesDelete(parsed);
|
|
293
|
-
if (subcommand === 'precreate') return handleArticlesPrecreate(parsed);
|
|
294
|
-
if (subcommand === 'generate') return handleArticlesGenerate(parsed);
|
|
295
|
-
|
|
296
|
-
throw Object.assign(new Error(`Unknown articles subcommand: ${subcommand}.`), {
|
|
297
|
-
cliCode: 'CLI_INVALID_USAGE',
|
|
298
|
-
guidance: 'Run `outrank-cli articles --help` to see available article commands.',
|
|
299
|
-
});
|
|
300
|
-
};
|
|
301
|
-
|
|
1
|
+
import { LIST_MAX_LIMIT, LIST_MIN_LIMIT, MIN_OFFSET, Surface } from '../core/constants.js';
|
|
2
|
+
import { MCP_USAGE_GUIDANCE, usageError } from '../core/errors.js';
|
|
3
|
+
import { image, int, string, uuid } from '../core/schema.js';
|
|
4
|
+
import { BodyMode, CommandKind, Toolset, defineCommand, defineGroup } from './registry.js';
|
|
5
|
+
|
|
6
|
+
export const ARTICLES_HELP = `Usage:
|
|
7
|
+
outrank-cli articles list [--product <product-id>] [--status generated|approved|published|failed|deleted] [--title <text>] [--keyword <text>] [--content <text>] [--slug <text>] [--created-from <date>] [--created-to <date>] [--scheduled-from <date>] [--scheduled-to <date>] [--sort-by created_at|status|title] [--sort-order asc|desc] [--limit <n>] [--offset <n>]
|
|
8
|
+
outrank-cli articles get <article-id>
|
|
9
|
+
outrank-cli articles get-content <article-id> [--format markdown|html]
|
|
10
|
+
outrank-cli articles update <article-id> --json <object>
|
|
11
|
+
outrank-cli articles update-content <article-id> --json <object>
|
|
12
|
+
outrank-cli articles replace <article-id> --json <object>
|
|
13
|
+
outrank-cli articles bulk-replace --json <object>
|
|
14
|
+
outrank-cli articles upload-image --file <path> [--article <article-id>] [--keyword <text>]
|
|
15
|
+
outrank-cli articles upload-featured-image <article-id> --file <path>
|
|
16
|
+
outrank-cli articles retry-publish <article-id>
|
|
17
|
+
outrank-cli articles delete <article-id>
|
|
18
|
+
outrank-cli articles precreate <keyword-id> # eligible future scheduled keyword only
|
|
19
|
+
outrank-cli articles generate <keyword-id> # scheduled for today only
|
|
20
|
+
|
|
21
|
+
JSON Input:
|
|
22
|
+
Use one of: --json '<object>', --json-file payload.json, or --json-stdin
|
|
23
|
+
|
|
24
|
+
Examples:
|
|
25
|
+
outrank-cli articles list --product 00000000-0000-0000-0000-000000000000 --status published --limit 20
|
|
26
|
+
outrank-cli articles get 00000000-0000-0000-0000-000000000000
|
|
27
|
+
outrank-cli articles get-content 00000000-0000-0000-0000-000000000000 --format html
|
|
28
|
+
outrank-cli articles update 00000000-0000-0000-0000-000000000000 --json '{"title":"New title"}'
|
|
29
|
+
outrank-cli articles update 00000000-0000-0000-0000-000000000000 --json '{"image_url":"https://example.com/featured.jpg"}'
|
|
30
|
+
outrank-cli articles update-content 00000000-0000-0000-0000-000000000000 --json-file article-content.json
|
|
31
|
+
outrank-cli articles replace 00000000-0000-0000-0000-000000000000 --json '{"find":"Old brand","replace_with":"New brand","preview_only":true}'
|
|
32
|
+
outrank-cli articles bulk-replace --json-file bulk-replace.json
|
|
33
|
+
outrank-cli articles upload-image --file .\\diagram.png --article 00000000-0000-0000-0000-000000000000
|
|
34
|
+
outrank-cli articles upload-featured-image 00000000-0000-0000-0000-000000000000 --file .\\hero.jpg
|
|
35
|
+
outrank-cli articles retry-publish 00000000-0000-0000-0000-000000000000
|
|
36
|
+
outrank-cli articles precreate 00000000-0000-0000-0000-000000000000
|
|
37
|
+
outrank-cli articles generate 00000000-0000-0000-0000-000000000000
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
const TOOLSETS = [Toolset.ARTICLES];
|
|
41
|
+
const ARTICLE_PATH = '/articles/{articleId}';
|
|
42
|
+
const ARTICLE_ID_CLI = { positionals: ['articleId'] };
|
|
43
|
+
const KEYWORD_ID_CLI = { positionals: ['keywordId'] };
|
|
44
|
+
const FILE_PLACEHOLDERS = { file: '<path>' };
|
|
45
|
+
const FILE_REQUIRED = { guidance: 'Pass a local image path with `--file <path>`.' };
|
|
46
|
+
const UPLOAD_TARGET_GUIDANCE =
|
|
47
|
+
'Pass `--article <article-id>` for an existing article editor-style upload, or `--keyword <text>` when you ' +
|
|
48
|
+
'want keyword-driven image metadata without an existing article.';
|
|
49
|
+
|
|
50
|
+
const articleIdInput = () => ({ articleId: uuid().required() });
|
|
51
|
+
const articleIdParams = (input) => ({ articleId: input.articleId });
|
|
52
|
+
|
|
53
|
+
const listCommand = defineCommand({
|
|
54
|
+
id: 'articles.list',
|
|
55
|
+
summary: 'List articles with optional filters, sorting and pagination.',
|
|
56
|
+
kind: CommandKind.READ,
|
|
57
|
+
toolsets: TOOLSETS,
|
|
58
|
+
input: {
|
|
59
|
+
productId: uuid(),
|
|
60
|
+
status: string(),
|
|
61
|
+
title: string(),
|
|
62
|
+
keyword: string(),
|
|
63
|
+
content: string(),
|
|
64
|
+
slug: string(),
|
|
65
|
+
createdFrom: string(),
|
|
66
|
+
createdTo: string(),
|
|
67
|
+
scheduledFrom: string(),
|
|
68
|
+
scheduledTo: string(),
|
|
69
|
+
sortBy: string(),
|
|
70
|
+
sortOrder: string(),
|
|
71
|
+
limit: int({ min: LIST_MIN_LIMIT, max: LIST_MAX_LIMIT }),
|
|
72
|
+
offset: int({ min: MIN_OFFSET }),
|
|
73
|
+
},
|
|
74
|
+
cli: { options: { product: 'productId' } },
|
|
75
|
+
run: (input, ctx) =>
|
|
76
|
+
ctx.http({
|
|
77
|
+
method: 'GET',
|
|
78
|
+
path: '/articles',
|
|
79
|
+
query: {
|
|
80
|
+
product_id: input.productId,
|
|
81
|
+
status: input.status,
|
|
82
|
+
title: input.title,
|
|
83
|
+
keyword: input.keyword,
|
|
84
|
+
content: input.content,
|
|
85
|
+
slug: input.slug,
|
|
86
|
+
created_from: input.createdFrom,
|
|
87
|
+
created_to: input.createdTo,
|
|
88
|
+
scheduled_from: input.scheduledFrom,
|
|
89
|
+
scheduled_to: input.scheduledTo,
|
|
90
|
+
sort_by: input.sortBy,
|
|
91
|
+
sort_order: input.sortOrder,
|
|
92
|
+
limit: input.limit,
|
|
93
|
+
offset: input.offset,
|
|
94
|
+
},
|
|
95
|
+
}),
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const getCommand = defineCommand({
|
|
99
|
+
id: 'articles.get',
|
|
100
|
+
summary: 'Get article metadata by id.',
|
|
101
|
+
kind: CommandKind.READ,
|
|
102
|
+
toolsets: TOOLSETS,
|
|
103
|
+
input: articleIdInput(),
|
|
104
|
+
cli: ARTICLE_ID_CLI,
|
|
105
|
+
run: (input, ctx) => ctx.http({ method: 'GET', path: ARTICLE_PATH, pathParams: articleIdParams(input) }),
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const getContentCommand = defineCommand({
|
|
109
|
+
id: 'articles.get-content',
|
|
110
|
+
summary: 'Get the article body as markdown or HTML.',
|
|
111
|
+
kind: CommandKind.READ,
|
|
112
|
+
toolsets: TOOLSETS,
|
|
113
|
+
input: { ...articleIdInput(), format: string() },
|
|
114
|
+
cli: ARTICLE_ID_CLI,
|
|
115
|
+
run: (input, ctx) =>
|
|
116
|
+
ctx.http({
|
|
117
|
+
method: 'GET',
|
|
118
|
+
path: `${ARTICLE_PATH}/content`,
|
|
119
|
+
pathParams: articleIdParams(input),
|
|
120
|
+
query: { format: input.format },
|
|
121
|
+
}),
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
const bodyCommand = ({ id, summary, kind, method, pathSuffix }) =>
|
|
125
|
+
defineCommand({
|
|
126
|
+
id,
|
|
127
|
+
summary,
|
|
128
|
+
kind,
|
|
129
|
+
toolsets: TOOLSETS,
|
|
130
|
+
input: articleIdInput(),
|
|
131
|
+
cli: ARTICLE_ID_CLI,
|
|
132
|
+
body: BodyMode.JSON,
|
|
133
|
+
run: (input, ctx) =>
|
|
134
|
+
ctx.http({ method, path: `${ARTICLE_PATH}${pathSuffix}`, pathParams: articleIdParams(input), body: input.body }),
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const updateCommand = bodyCommand({
|
|
138
|
+
id: 'articles.update',
|
|
139
|
+
summary: 'Update article metadata from a JSON body.',
|
|
140
|
+
kind: CommandKind.WRITE,
|
|
141
|
+
method: 'PATCH',
|
|
142
|
+
pathSuffix: '',
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
const updateContentCommand = bodyCommand({
|
|
146
|
+
id: 'articles.update-content',
|
|
147
|
+
summary: 'Replace the article body from a JSON body.',
|
|
148
|
+
kind: CommandKind.WRITE,
|
|
149
|
+
method: 'PUT',
|
|
150
|
+
pathSuffix: '/content',
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
const replaceCommand = bodyCommand({
|
|
154
|
+
id: 'articles.replace',
|
|
155
|
+
summary: 'Find and replace text inside one article.',
|
|
156
|
+
kind: CommandKind.WRITE,
|
|
157
|
+
method: 'POST',
|
|
158
|
+
pathSuffix: '/replace',
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
const bulkReplaceCommand = defineCommand({
|
|
162
|
+
id: 'articles.bulk-replace',
|
|
163
|
+
summary: 'Find and replace text across several articles from a JSON body.',
|
|
164
|
+
kind: CommandKind.WRITE,
|
|
165
|
+
toolsets: TOOLSETS,
|
|
166
|
+
body: BodyMode.JSON,
|
|
167
|
+
run: (input, ctx) => ctx.http({ method: 'POST', path: '/articles/bulk-replace', body: input.body }),
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
const uploadImageCommand = defineCommand({
|
|
171
|
+
id: 'articles.upload-image',
|
|
172
|
+
summary: 'Upload an image for an article or a keyword.',
|
|
173
|
+
kind: CommandKind.WRITE,
|
|
174
|
+
toolsets: TOOLSETS,
|
|
175
|
+
input: { file: image().required(FILE_REQUIRED), articleId: uuid(), keyword: string() },
|
|
176
|
+
cli: { options: { article: 'articleId' }, placeholders: FILE_PLACEHOLDERS },
|
|
177
|
+
refine: (input, ctx) => {
|
|
178
|
+
if (input.articleId || input.keyword) return;
|
|
179
|
+
if (ctx.surface === Surface.MCP) {
|
|
180
|
+
throw usageError('Provide at least one of: article_id or keyword.', MCP_USAGE_GUIDANCE);
|
|
181
|
+
}
|
|
182
|
+
throw usageError('Provide at least one of: --article <article-id> or --keyword <text>.', UPLOAD_TARGET_GUIDANCE);
|
|
183
|
+
},
|
|
184
|
+
run: (input, ctx) =>
|
|
185
|
+
ctx.http({
|
|
186
|
+
method: 'POST',
|
|
187
|
+
path: '/articles/images/upload',
|
|
188
|
+
body: {
|
|
189
|
+
...input.file,
|
|
190
|
+
...(input.articleId ? { article_id: input.articleId } : {}),
|
|
191
|
+
...(input.keyword ? { keyword: input.keyword } : {}),
|
|
192
|
+
},
|
|
193
|
+
}),
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
const uploadFeaturedImageCommand = defineCommand({
|
|
197
|
+
id: 'articles.upload-featured-image',
|
|
198
|
+
summary: 'Upload the featured image of an article.',
|
|
199
|
+
kind: CommandKind.WRITE,
|
|
200
|
+
toolsets: TOOLSETS,
|
|
201
|
+
input: { ...articleIdInput(), file: image().required(FILE_REQUIRED) },
|
|
202
|
+
cli: { ...ARTICLE_ID_CLI, placeholders: FILE_PLACEHOLDERS },
|
|
203
|
+
run: (input, ctx) =>
|
|
204
|
+
ctx.http({
|
|
205
|
+
method: 'POST',
|
|
206
|
+
path: `${ARTICLE_PATH}/featured-image/upload`,
|
|
207
|
+
pathParams: articleIdParams(input),
|
|
208
|
+
body: input.file,
|
|
209
|
+
}),
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
const retryPublishCommand = defineCommand({
|
|
213
|
+
id: 'articles.retry-publish',
|
|
214
|
+
summary: 'Retry publishing an article to its integration.',
|
|
215
|
+
kind: CommandKind.WRITE,
|
|
216
|
+
toolsets: TOOLSETS,
|
|
217
|
+
input: articleIdInput(),
|
|
218
|
+
cli: ARTICLE_ID_CLI,
|
|
219
|
+
longRunning: { pollTool: 'articles.get' },
|
|
220
|
+
run: (input, ctx) =>
|
|
221
|
+
ctx.http({ method: 'POST', path: `${ARTICLE_PATH}/retry-publish`, pathParams: articleIdParams(input) }),
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
const deleteCommand = defineCommand({
|
|
225
|
+
id: 'articles.delete',
|
|
226
|
+
summary: 'Delete an article.',
|
|
227
|
+
kind: CommandKind.DESTRUCTIVE,
|
|
228
|
+
toolsets: TOOLSETS,
|
|
229
|
+
input: articleIdInput(),
|
|
230
|
+
cli: ARTICLE_ID_CLI,
|
|
231
|
+
run: (input, ctx) => ctx.http({ method: 'DELETE', path: ARTICLE_PATH, pathParams: articleIdParams(input) }),
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
const keywordActionCommand = ({ id, summary, actionPath }) =>
|
|
235
|
+
defineCommand({
|
|
236
|
+
id,
|
|
237
|
+
summary,
|
|
238
|
+
kind: CommandKind.WRITE,
|
|
239
|
+
toolsets: TOOLSETS,
|
|
240
|
+
input: { keywordId: uuid().required() },
|
|
241
|
+
cli: KEYWORD_ID_CLI,
|
|
242
|
+
longRunning: { pollTool: 'articles.list' },
|
|
243
|
+
run: (input, ctx) => ctx.http({ method: 'POST', path: actionPath, body: { keyword_id: input.keywordId } }),
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
const precreateCommand = keywordActionCommand({
|
|
247
|
+
id: 'articles.precreate',
|
|
248
|
+
summary: 'Pre-create the article for an eligible future scheduled keyword.',
|
|
249
|
+
actionPath: '/articles/precreate',
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
const generateCommand = keywordActionCommand({
|
|
253
|
+
id: 'articles.generate',
|
|
254
|
+
summary: 'Generate the article for a keyword scheduled for today.',
|
|
255
|
+
actionPath: '/articles/generate',
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
export const articlesGroup = defineGroup({
|
|
259
|
+
id: 'articles',
|
|
260
|
+
help: {
|
|
261
|
+
usage: ARTICLES_HELP,
|
|
262
|
+
guidance:
|
|
263
|
+
'Choose one of: list, get, get-content, update, update-content, replace, bulk-replace, upload-image, ' +
|
|
264
|
+
'upload-featured-image, retry-publish, delete, precreate, generate.',
|
|
265
|
+
},
|
|
266
|
+
unknown: (word) => ({
|
|
267
|
+
message: `Unknown articles subcommand: ${word}.`,
|
|
268
|
+
guidance: 'Run `outrank-cli articles --help` to see available article commands.',
|
|
269
|
+
}),
|
|
270
|
+
children: [
|
|
271
|
+
listCommand,
|
|
272
|
+
getCommand,
|
|
273
|
+
getContentCommand,
|
|
274
|
+
updateCommand,
|
|
275
|
+
updateContentCommand,
|
|
276
|
+
replaceCommand,
|
|
277
|
+
bulkReplaceCommand,
|
|
278
|
+
uploadImageCommand,
|
|
279
|
+
uploadFeaturedImageCommand,
|
|
280
|
+
retryPublishCommand,
|
|
281
|
+
deleteCommand,
|
|
282
|
+
precreateCommand,
|
|
283
|
+
generateCommand,
|
|
284
|
+
],
|
|
285
|
+
});
|