Files
callstack__agent-device/scripts/sync-mcp-metadata.mjs
devin-ai-integration[bot] edca35d122 chore(deps): Renovate config, packageManager-derived pnpm in CI, repo-wide format (#1444)
* chore(deps): add Renovate config and enforce packageManager pnpm version in CI

Refs #1422

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* chore: bump pnpm to 11.17.0 and format the whole repo with oxfmt

format/format:check drop their hand-maintained path list: oxfmt already skips
node_modules and honors .gitignore, so the only exclusion list is
.oxfmtrc.json ignorePatterns.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(mutation): accept either quote style in the affected-lane path filter

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* chore(deps): keep fixture-app runtime deps as individual Renovate PRs

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-07-28 13:50:39 +02:00

61 lines
1.6 KiB
JavaScript

import fs from 'node:fs';
import path from 'node:path';
import process from 'node:process';
const root = process.cwd();
const checkOnly = process.argv.includes('--check');
const packagePath = path.join(root, 'package.json');
const serverPath = path.join(root, 'server.json');
const pkg = readJson(packagePath);
const server = readJson(serverPath);
const expectedName = pkg.mcpName;
const expectedVersion = pkg.version;
const registryDescriptionMaxLength = 100;
if (typeof expectedName !== 'string' || expectedName.length === 0) {
fail('package.json must define mcpName.');
}
if (typeof expectedVersion !== 'string' || expectedVersion.length === 0) {
fail('package.json must define version.');
}
if (
typeof server.description === 'string' &&
server.description.length > registryDescriptionMaxLength
) {
fail(`server.json description must be ${registryDescriptionMaxLength} characters or fewer.`);
}
server.name = expectedName;
server.version = expectedVersion;
if (Array.isArray(server.packages)) {
for (const packageEntry of server.packages) {
if (packageEntry?.identifier === pkg.name) {
packageEntry.version = expectedVersion;
}
}
}
const next = `${JSON.stringify(server, null, 2)}\n`;
const current = fs.readFileSync(serverPath, 'utf8');
if (checkOnly) {
if (next !== current) {
fail('server.json is out of sync. Run `pnpm sync:mcp-metadata`.');
}
process.exit(0);
}
if (next !== current) {
fs.writeFileSync(serverPath, next);
}
function readJson(filePath) {
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
}
function fail(message) {
process.stderr.write(`${message}\n`);
process.exit(1);
}