@redpanda-data/docs-extensions-and-macros 4.12.6 → 4.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.adoc +33 -1064
- package/bin/doc-tools-mcp.js +720 -0
- package/bin/doc-tools.js +1050 -50
- package/bin/mcp-tools/antora.js +153 -0
- package/bin/mcp-tools/cache.js +89 -0
- package/bin/mcp-tools/cloud-regions.js +127 -0
- package/bin/mcp-tools/content-review.js +196 -0
- package/bin/mcp-tools/crd-docs.js +153 -0
- package/bin/mcp-tools/frontmatter.js +138 -0
- package/bin/mcp-tools/generated-docs-review.js +887 -0
- package/bin/mcp-tools/helm-docs.js +152 -0
- package/bin/mcp-tools/index.js +245 -0
- package/bin/mcp-tools/job-queue.js +468 -0
- package/bin/mcp-tools/mcp-validation.js +266 -0
- package/bin/mcp-tools/metrics-docs.js +146 -0
- package/bin/mcp-tools/openapi.js +174 -0
- package/bin/mcp-tools/prompt-discovery.js +283 -0
- package/bin/mcp-tools/property-docs.js +157 -0
- package/bin/mcp-tools/rpcn-docs.js +113 -0
- package/bin/mcp-tools/rpk-docs.js +141 -0
- package/bin/mcp-tools/telemetry.js +211 -0
- package/bin/mcp-tools/utils.js +131 -0
- package/bin/mcp-tools/versions.js +168 -0
- package/cli-utils/convert-doc-links.js +1 -1
- package/cli-utils/github-token.js +58 -0
- package/cli-utils/self-managed-docs-branch.js +2 -2
- package/cli-utils/setup-mcp.js +313 -0
- package/docker-compose/25.1/transactions.md +1 -1
- package/docker-compose/transactions.md +1 -1
- package/extensions/DEVELOPMENT.adoc +464 -0
- package/extensions/README.adoc +124 -0
- package/extensions/REFERENCE.adoc +768 -0
- package/extensions/USER_GUIDE.adoc +339 -0
- package/extensions/generate-rp-connect-info.js +3 -4
- package/extensions/version-fetcher/get-latest-console-version.js +38 -27
- package/extensions/version-fetcher/get-latest-redpanda-version.js +65 -54
- package/extensions/version-fetcher/retry-util.js +88 -0
- package/extensions/version-fetcher/set-latest-version.js +6 -3
- package/macros/DEVELOPMENT.adoc +377 -0
- package/macros/README.adoc +105 -0
- package/macros/REFERENCE.adoc +222 -0
- package/macros/USER_GUIDE.adoc +220 -0
- package/macros/rp-connect-components.js +6 -6
- package/package.json +12 -3
- package/tools/bundle-openapi.js +20 -10
- package/tools/cloud-regions/generate-cloud-regions.js +1 -1
- package/tools/fetch-from-github.js +18 -4
- package/tools/gen-rpk-ascii.py +3 -1
- package/tools/generate-cli-docs.js +325 -0
- package/tools/get-console-version.js +4 -2
- package/tools/get-redpanda-version.js +4 -2
- package/tools/metrics/metrics.py +19 -7
- package/tools/property-extractor/Makefile +7 -1
- package/tools/property-extractor/cloud_config.py +4 -4
- package/tools/property-extractor/constant_resolver.py +11 -11
- package/tools/property-extractor/property_extractor.py +18 -16
- package/tools/property-extractor/topic_property_extractor.py +2 -2
- package/tools/property-extractor/transformers.py +7 -7
- package/tools/property-extractor/type_definition_extractor.py +4 -4
- package/tools/redpanda-connect/README.adoc +1 -1
- package/tools/redpanda-connect/generate-rpcn-connector-docs.js +5 -3
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-platform MCP Server Setup Utility
|
|
3
|
+
*
|
|
4
|
+
* Configures the Redpanda Docs MCP server for Claude Code across
|
|
5
|
+
* macOS, Linux, and Windows platforms using the 'claude mcp add' command.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const os = require('os');
|
|
11
|
+
const chalk = require('chalk');
|
|
12
|
+
const { execSync } = require('child_process');
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Detect the operating system
|
|
16
|
+
*/
|
|
17
|
+
function detectOS() {
|
|
18
|
+
const platform = os.platform();
|
|
19
|
+
switch (platform) {
|
|
20
|
+
case 'darwin':
|
|
21
|
+
return 'macOS';
|
|
22
|
+
case 'linux':
|
|
23
|
+
return 'Linux';
|
|
24
|
+
case 'win32':
|
|
25
|
+
return 'Windows';
|
|
26
|
+
default:
|
|
27
|
+
return platform;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get Claude Code config file path
|
|
33
|
+
* Claude Code uses ~/.claude.json for configuration
|
|
34
|
+
*/
|
|
35
|
+
function getConfigPath() {
|
|
36
|
+
return path.join(os.homedir(), '.claude.json');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Check if config file exists
|
|
41
|
+
*/
|
|
42
|
+
function configExists() {
|
|
43
|
+
return fs.existsSync(getConfigPath());
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Read and parse JSON config file
|
|
48
|
+
*/
|
|
49
|
+
function readConfig(configPath) {
|
|
50
|
+
try {
|
|
51
|
+
const content = fs.readFileSync(configPath, 'utf8');
|
|
52
|
+
return JSON.parse(content);
|
|
53
|
+
} catch (err) {
|
|
54
|
+
throw new Error(`Failed to read config: ${err.message}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Check if MCP server is already configured
|
|
60
|
+
*/
|
|
61
|
+
function isMCPServerConfigured(config, serverName = 'redpanda-doc-tools-assistant') {
|
|
62
|
+
return config.mcpServers && config.mcpServers[serverName];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Get the absolute path to the MCP server script
|
|
67
|
+
*/
|
|
68
|
+
function getMCPServerPath() {
|
|
69
|
+
// Find repo root by looking for package.json
|
|
70
|
+
let currentDir = __dirname;
|
|
71
|
+
while (currentDir !== path.parse(currentDir).root) {
|
|
72
|
+
if (fs.existsSync(path.join(currentDir, 'package.json'))) {
|
|
73
|
+
const mcpServerPath = path.join(currentDir, 'bin', 'doc-tools-mcp.js');
|
|
74
|
+
if (fs.existsSync(mcpServerPath)) {
|
|
75
|
+
return mcpServerPath;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
currentDir = path.dirname(currentDir);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
throw new Error('Could not find doc-tools-mcp.js. Make sure you are running this from the docs-extensions-and-macros repository.');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Main setup function using 'claude mcp add' CLI command
|
|
86
|
+
*/
|
|
87
|
+
async function setupMCP(options = {}) {
|
|
88
|
+
const { force = false, target = 'auto', local = false } = options;
|
|
89
|
+
|
|
90
|
+
console.log(chalk.blue('\n🚀 Redpanda Doc Tools MCP Server Setup\n'));
|
|
91
|
+
console.log(chalk.gray(`Platform: ${detectOS()}`));
|
|
92
|
+
console.log(chalk.gray(`Node: ${process.version}\n`));
|
|
93
|
+
|
|
94
|
+
// Determine mode: local development or npx
|
|
95
|
+
let mode = 'npx';
|
|
96
|
+
let localPath = null;
|
|
97
|
+
const packageName = '@redpanda-data/docs-extensions-and-macros';
|
|
98
|
+
let packageVersion = 'unknown';
|
|
99
|
+
|
|
100
|
+
// Only check for local installation if --local flag is set
|
|
101
|
+
if (local) {
|
|
102
|
+
try {
|
|
103
|
+
const mcpServerPath = getMCPServerPath();
|
|
104
|
+
localPath = mcpServerPath;
|
|
105
|
+
const packageJsonPath = path.join(path.dirname(path.dirname(mcpServerPath)), 'package.json');
|
|
106
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
107
|
+
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
108
|
+
packageVersion = pkg.version;
|
|
109
|
+
}
|
|
110
|
+
mode = 'local';
|
|
111
|
+
} catch (err) {
|
|
112
|
+
console.error(chalk.red('✗') + ' --local flag requires running from docs-extensions-and-macros repository');
|
|
113
|
+
return { success: false, error: 'Not in local repository' };
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (mode === 'local') {
|
|
118
|
+
console.log(chalk.green('✓') + ` Mode: ${chalk.cyan('Local Development')}`);
|
|
119
|
+
console.log(chalk.gray(` Path: ${localPath}`));
|
|
120
|
+
console.log(chalk.gray(` Version: ${packageVersion}\n`));
|
|
121
|
+
} else {
|
|
122
|
+
console.log(chalk.green('✓') + ` Mode: ${chalk.cyan('NPX (Published Package)')}`);
|
|
123
|
+
console.log(chalk.gray(` Package: ${packageName}`));
|
|
124
|
+
console.log(chalk.gray(` Using npx to run from node_modules or npm\n`));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Check if MCP server is already configured
|
|
128
|
+
const configPath = getConfigPath();
|
|
129
|
+
let alreadyConfigured = false;
|
|
130
|
+
let needsUpdate = false;
|
|
131
|
+
|
|
132
|
+
if (configExists()) {
|
|
133
|
+
try {
|
|
134
|
+
const config = readConfig(configPath);
|
|
135
|
+
alreadyConfigured = isMCPServerConfigured(config);
|
|
136
|
+
|
|
137
|
+
if (alreadyConfigured) {
|
|
138
|
+
const existingConfig = config.mcpServers['redpanda-doc-tools-assistant'];
|
|
139
|
+
const existingCommand = existingConfig.command;
|
|
140
|
+
const existingArgs = existingConfig.args || [];
|
|
141
|
+
|
|
142
|
+
// Check if configuration matches desired mode
|
|
143
|
+
const isCorrectNpxConfig = mode === 'npx' && existingCommand === 'npx' &&
|
|
144
|
+
existingArgs.includes('doc-tools-mcp');
|
|
145
|
+
const isCorrectLocalConfig = mode === 'local' && existingCommand === 'node' &&
|
|
146
|
+
existingArgs[0] === localPath;
|
|
147
|
+
|
|
148
|
+
if (!isCorrectNpxConfig && !isCorrectLocalConfig) {
|
|
149
|
+
needsUpdate = true;
|
|
150
|
+
console.log(chalk.yellow('⚠ ') + ' MCP server configured but with different setup:');
|
|
151
|
+
console.log(chalk.gray(` Current: ${existingCommand} ${existingArgs.join(' ')}`));
|
|
152
|
+
const newSetup = mode === 'local' ? `node ${localPath}` : 'npx -y doc-tools-mcp';
|
|
153
|
+
console.log(chalk.gray(` New: ${newSetup}\n`));
|
|
154
|
+
} else {
|
|
155
|
+
console.log(chalk.green('✓') + ` MCP server already configured correctly\n`);
|
|
156
|
+
if (!force) {
|
|
157
|
+
return {
|
|
158
|
+
success: true,
|
|
159
|
+
configPath,
|
|
160
|
+
configType: 'Claude Code',
|
|
161
|
+
action: 'already-configured',
|
|
162
|
+
mode
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
} catch (err) {
|
|
168
|
+
console.log(chalk.yellow('⚠ ') + ` Could not read config: ${err.message}`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (alreadyConfigured && !needsUpdate && !force) {
|
|
173
|
+
console.log(chalk.blue('ℹ') + ' Use --force to reconfigure\n');
|
|
174
|
+
return {
|
|
175
|
+
success: true,
|
|
176
|
+
configPath,
|
|
177
|
+
configType: 'Claude Code',
|
|
178
|
+
action: 'already-configured',
|
|
179
|
+
mode
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Build the claude mcp add command
|
|
184
|
+
const serverName = 'redpanda-doc-tools-assistant';
|
|
185
|
+
|
|
186
|
+
// If server exists and we're updating, remove it first
|
|
187
|
+
if (alreadyConfigured && (needsUpdate || force)) {
|
|
188
|
+
try {
|
|
189
|
+
console.log(chalk.gray(`Removing existing MCP server: ${serverName}\n`));
|
|
190
|
+
execSync(`claude mcp remove --scope user ${serverName}`, { stdio: 'pipe' });
|
|
191
|
+
} catch (err) {
|
|
192
|
+
console.log(chalk.yellow('⚠ ') + ` Could not remove existing server (may not exist): ${err.message}`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
let command;
|
|
197
|
+
if (mode === 'local') {
|
|
198
|
+
command = `claude mcp add --transport stdio --scope user ${serverName} -- node ${localPath}`;
|
|
199
|
+
} else {
|
|
200
|
+
command = `claude mcp add --transport stdio --scope user ${serverName} -- npx -y doc-tools-mcp`;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Execute the command
|
|
204
|
+
try {
|
|
205
|
+
console.log(chalk.gray(`Running: ${command}\n`));
|
|
206
|
+
execSync(command, { stdio: 'inherit' });
|
|
207
|
+
|
|
208
|
+
console.log(chalk.green('✓') + ` MCP server ${alreadyConfigured ? 'updated' : 'added'}: ${chalk.cyan(serverName)}\n`);
|
|
209
|
+
|
|
210
|
+
return {
|
|
211
|
+
success: true,
|
|
212
|
+
configPath,
|
|
213
|
+
configType: 'Claude Code',
|
|
214
|
+
action: alreadyConfigured ? 'updated' : 'added',
|
|
215
|
+
mode
|
|
216
|
+
};
|
|
217
|
+
} catch (err) {
|
|
218
|
+
console.error(chalk.red('✗') + ` Failed to add MCP server: ${err.message}`);
|
|
219
|
+
return { success: false, error: err.message };
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Print next steps
|
|
225
|
+
*/
|
|
226
|
+
function printNextSteps(result) {
|
|
227
|
+
if (!result.success) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
console.log(chalk.bold('📋 Next Steps:\n'));
|
|
232
|
+
|
|
233
|
+
if (result.configType === 'Claude Desktop') {
|
|
234
|
+
console.log(' 1. Restart Claude Desktop');
|
|
235
|
+
console.log(' 2. The MCP server will be available automatically\n');
|
|
236
|
+
} else {
|
|
237
|
+
console.log(' 1. Restart Claude Code (if running)');
|
|
238
|
+
console.log(' 2. Navigate to any repository:');
|
|
239
|
+
console.log(chalk.gray(' cd ~/repos/docs'));
|
|
240
|
+
console.log(' 3. Start using the MCP server:\n');
|
|
241
|
+
console.log(chalk.cyan(' "Show me the Antora structure"'));
|
|
242
|
+
console.log(chalk.cyan(' "Generate property docs for v25.3.1"\n'));
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (result.mode === 'local') {
|
|
246
|
+
console.log(chalk.bold('📦 To Update (Local Mode):\n'));
|
|
247
|
+
console.log(' 1. Pull latest changes:');
|
|
248
|
+
console.log(chalk.gray(' cd /path/to/docs-extensions-and-macros'));
|
|
249
|
+
console.log(chalk.gray(' git pull'));
|
|
250
|
+
console.log(' 2. Install dependencies:');
|
|
251
|
+
console.log(chalk.gray(' npm install'));
|
|
252
|
+
console.log(' 3. Restart Claude Code');
|
|
253
|
+
console.log(chalk.gray(' Changes will be picked up automatically!\n'));
|
|
254
|
+
} else {
|
|
255
|
+
console.log(chalk.bold('📦 To Update (NPX Mode):\n'));
|
|
256
|
+
console.log(' 1. Update the package globally or in any repo:');
|
|
257
|
+
console.log(chalk.gray(' npm update -g @redpanda-data/docs-extensions-and-macros'));
|
|
258
|
+
console.log(' 2. Restart Claude Code');
|
|
259
|
+
console.log(chalk.gray(' That\'s it! npx will use the new version.\n'));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
console.log(chalk.bold('🎉 Setup complete!\n'));
|
|
263
|
+
console.log(chalk.gray('Documentation: mcp/USER_GUIDE.adoc\n'));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Show status of MCP server configuration
|
|
268
|
+
*/
|
|
269
|
+
function showStatus() {
|
|
270
|
+
console.log(chalk.blue('\n📊 MCP Server Configuration Status\n'));
|
|
271
|
+
console.log(chalk.gray(`Platform: ${detectOS()}\n`));
|
|
272
|
+
|
|
273
|
+
// Check Claude Code config
|
|
274
|
+
const configPath = getConfigPath();
|
|
275
|
+
|
|
276
|
+
if (configExists()) {
|
|
277
|
+
console.log(chalk.bold('Claude Code:'));
|
|
278
|
+
console.log(chalk.gray(` Config: ${configPath}`));
|
|
279
|
+
|
|
280
|
+
try {
|
|
281
|
+
const config = readConfig(configPath);
|
|
282
|
+
const configured = isMCPServerConfigured(config);
|
|
283
|
+
|
|
284
|
+
if (configured) {
|
|
285
|
+
const server = config.mcpServers['redpanda-docs-tool-assistant'];
|
|
286
|
+
const mode = server.command === 'node' ? 'Local Development' : 'NPX (Published Package)';
|
|
287
|
+
const details = server.command === 'node'
|
|
288
|
+
? `Path: ${server.args[0]}`
|
|
289
|
+
: `Package: ${server.args.join(' ')}`;
|
|
290
|
+
|
|
291
|
+
console.log(chalk.green(' ✓ MCP server configured'));
|
|
292
|
+
console.log(chalk.gray(` Mode: ${mode}`));
|
|
293
|
+
console.log(chalk.gray(` ${details}\n`));
|
|
294
|
+
} else {
|
|
295
|
+
console.log(chalk.yellow(' ✗ MCP server not configured\n'));
|
|
296
|
+
}
|
|
297
|
+
} catch (err) {
|
|
298
|
+
console.log(chalk.red(` ✗ Error reading config: ${err.message}\n`));
|
|
299
|
+
}
|
|
300
|
+
} else {
|
|
301
|
+
console.log(chalk.gray('Claude Code: Config not found\n'));
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
module.exports = {
|
|
306
|
+
setupMCP,
|
|
307
|
+
showStatus,
|
|
308
|
+
printNextSteps,
|
|
309
|
+
detectOS,
|
|
310
|
+
getConfigPath,
|
|
311
|
+
configExists,
|
|
312
|
+
getMCPServerPath
|
|
313
|
+
}
|
|
@@ -19,7 +19,7 @@ Each message in the `transactions` topic adheres to the following JSON schema:
|
|
|
19
19
|
|
|
20
20
|
- **email**: The email address of the user involved in the transaction.
|
|
21
21
|
- **index**: A numeric index associated with the transaction. This could represent the position or order of the transaction in a sequence.
|
|
22
|
-
- **price**: A string representing the price of the product. It includes a currency code (
|
|
22
|
+
- **price**: A string representing the price of the product. It includes a currency code (for example, "XXX") followed by the amount.
|
|
23
23
|
- **product_url**: A URL that points to the product involved in the transaction.
|
|
24
24
|
- **timestamp**: The timestamp of when the transaction occurred, formatted in ISO 8601.
|
|
25
25
|
- **user_id**: A numeric identifier for the user. This is typically a unique ID assigned to each user in the system.
|
|
@@ -19,7 +19,7 @@ Each message in the `transactions` topic adheres to the following JSON schema:
|
|
|
19
19
|
|
|
20
20
|
- **email**: The email address of the user involved in the transaction.
|
|
21
21
|
- **index**: A numeric index associated with the transaction. This could represent the position or order of the transaction in a sequence.
|
|
22
|
-
- **price**: A string representing the price of the product. It includes a currency code (
|
|
22
|
+
- **price**: A string representing the price of the product. It includes a currency code (for example, "XXX") followed by the amount.
|
|
23
23
|
- **product_url**: A URL that points to the product involved in the transaction.
|
|
24
24
|
- **timestamp**: The timestamp of when the transaction occurred, formatted in ISO 8601.
|
|
25
25
|
- **user_id**: A numeric identifier for the user. This is typically a unique ID assigned to each user in the system.
|