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/index.js
CHANGED
|
@@ -1,28 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { readFileSync } from 'node:fs';
|
|
4
|
-
|
|
5
|
-
import { parseArgs } from './core/args.js';
|
|
6
3
|
import { emitAndExit } from './core/io.js';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import { handleMarketplaceCommand } from './commands/marketplace.js';
|
|
17
|
-
|
|
18
|
-
const getVersion = () => {
|
|
19
|
-
try {
|
|
20
|
-
const packageJson = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
21
|
-
return packageJson.version || 'unknown';
|
|
22
|
-
} catch {
|
|
23
|
-
return 'unknown';
|
|
24
|
-
}
|
|
25
|
-
};
|
|
4
|
+
import { cliSuccess, toErrorEnvelope, usageError } from './core/errors.js';
|
|
5
|
+
import { runRegistryCommand } from './adapters/cli/run.js';
|
|
6
|
+
import { MCP_COMMAND } from './adapters/mcp/constants.js';
|
|
7
|
+
import { MCP_HELP, MCP_HELP_GUIDANCE } from './adapters/mcp/help.js';
|
|
8
|
+
import { registry } from './commands/index.js';
|
|
9
|
+
import { getVersion } from './core/version.js';
|
|
10
|
+
|
|
11
|
+
const EXIT_FAILURE = 1;
|
|
12
|
+
const HELP_TOKENS = ['--help', '-h', 'help'];
|
|
26
13
|
|
|
27
14
|
const ROOT_HELP = `Outrank CLI
|
|
28
15
|
|
|
@@ -43,9 +30,13 @@ Groups:
|
|
|
43
30
|
usage Inspect current usage and quota consumption.
|
|
44
31
|
billing Product-slot purchase flows.
|
|
45
32
|
|
|
33
|
+
MCP Server:
|
|
34
|
+
outrank-cli mcp Start the Outrank MCP server on stdio (see outrank-cli mcp --help).
|
|
35
|
+
|
|
46
36
|
Global Auth Options:
|
|
47
37
|
--api-key <key> Override the API key for this command only.
|
|
48
38
|
--base-url <url> Override the Outrank base URL for this command only.
|
|
39
|
+
--profile <name> Use a stored profile for this command only (see auth --help).
|
|
49
40
|
|
|
50
41
|
JSON Input Conventions:
|
|
51
42
|
Complex write commands accept one of:
|
|
@@ -81,7 +72,6 @@ Examples:
|
|
|
81
72
|
|
|
82
73
|
const main = async () => {
|
|
83
74
|
const argv = process.argv.slice(2);
|
|
84
|
-
const parsed = parseArgs(argv);
|
|
85
75
|
const first = argv[0];
|
|
86
76
|
|
|
87
77
|
if (argv.length === 0 || first === '--help' || first === '-h' || first === 'help') {
|
|
@@ -108,44 +98,26 @@ const main = async () => {
|
|
|
108
98
|
return;
|
|
109
99
|
}
|
|
110
100
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
} else if (group === 'keywords') {
|
|
120
|
-
result = await handleKeywordsCommand(rest);
|
|
121
|
-
} else if (group === 'articles') {
|
|
122
|
-
result = await handleArticlesCommand(rest);
|
|
123
|
-
} else if (group === 'improvements') {
|
|
124
|
-
result = await handleImprovementsCommand(rest);
|
|
125
|
-
} else if (group === 'marketplace') {
|
|
126
|
-
result = await handleMarketplaceCommand(rest);
|
|
127
|
-
} else if (group === 'subscription') {
|
|
128
|
-
result = await handleSubscriptionCommand(rest);
|
|
129
|
-
} else if (group === 'usage') {
|
|
130
|
-
result = await handleUsageCommand(rest);
|
|
131
|
-
} else if (group === 'billing') {
|
|
132
|
-
result = await handleBillingCommand(rest);
|
|
133
|
-
} else {
|
|
134
|
-
throw Object.assign(new Error(`Unknown command group: ${group}.`), {
|
|
135
|
-
cliCode: 'CLI_INVALID_USAGE',
|
|
136
|
-
guidance: 'Run `outrank-cli --help` to see the available top-level groups.',
|
|
137
|
-
});
|
|
101
|
+
if (first === MCP_COMMAND) {
|
|
102
|
+
if (argv.slice(1).some((token) => HELP_TOKENS.includes(token))) {
|
|
103
|
+
emitAndExit(cliSuccess({ usage: MCP_HELP.trim() }, MCP_HELP_GUIDANCE));
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const { runMcpServer } = await import('./adapters/mcp/main.js');
|
|
107
|
+
await runMcpServer(argv.slice(1), { input: process.stdin });
|
|
108
|
+
return;
|
|
138
109
|
}
|
|
139
110
|
|
|
140
|
-
|
|
111
|
+
const registryOutcome = await runRegistryCommand(registry, argv);
|
|
112
|
+
if (!registryOutcome) {
|
|
113
|
+
throw usageError(
|
|
114
|
+
`Unknown command group: ${argv[0]}.`,
|
|
115
|
+
'Run `outrank-cli --help` to see the available top-level groups.',
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
emitAndExit(registryOutcome.envelope, registryOutcome.exitCode);
|
|
141
119
|
};
|
|
142
120
|
|
|
143
121
|
main().catch((error) => {
|
|
144
|
-
|
|
145
|
-
const code = error?.cliCode || 'CLI_UNEXPECTED_ERROR';
|
|
146
|
-
const guidance =
|
|
147
|
-
error?.guidance ||
|
|
148
|
-
'Retry with --help for usage details. If the command and inputs look correct, inspect the error details and try again.';
|
|
149
|
-
|
|
150
|
-
emitAndExit(cliError(code, message, guidance), 1);
|
|
122
|
+
emitAndExit(toErrorEnvelope(error), EXIT_FAILURE);
|
|
151
123
|
});
|