Skip to content

Commit df7cd3d

Browse files
Bold Create AgentSF3922-Shreedhar
andcommitted
Validator: allow Apache-2.0 for community plugins, check it against the vendor LICENSE, and require a declared NOTICE
Co-authored-by: SF3922-Shreedhar <186544798+SF3922-Shreedhar@users.noreply.github.com> Bold-Create-Session: https://staging.boldcreate.ai/agent/chat/?threadId=1d0e49bb-8e29-465a-a8b2-929800c40c9d
1 parent 783c4f1 commit df7cd3d

4 files changed

Lines changed: 42 additions & 4 deletions

File tree

‎schemas/boldcreate-plugin.schema.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
"path": { "type": "string", "description": "Plugin folder inside the source repository." },
3737
"commit": { "type": "string", "pattern": "^[0-9a-f]{7,40}$" },
3838
"author": { "type": "string", "description": "Author named in the source manifest." },
39-
"license": { "type": "string" }
39+
"license": { "type": "string" },
40+
"notice": { "type": "boolean", "description": "True when the vendor repository has a NOTICE file. Apache-2.0 requires carrying it, so the plugin folder must then contain NOTICE." }
4041
}
4142
},
4243
"rollout": {

‎schemas/boldcreate.schema.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
"path": { "type": "string", "description": "Plugin folder inside the source repository." },
3636
"commit": { "type": "string", "pattern": "^[0-9a-f]{7,40}$" },
3737
"author": { "type": "string", "description": "Author named in the source manifest." },
38-
"license": { "type": "string" }
38+
"license": { "type": "string" },
39+
"notice": { "type": "boolean", "description": "True when the vendor repository has a NOTICE file. Apache-2.0 requires carrying it, so the plugin folder must then contain NOTICE." }
3940
}
4041
},
4142
"endpointCheck": {

‎scripts/check-kit.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ export function checkCommunity(dir) {
246246

247247
const known = new Set([
248248
".boldcreate-plugin", ".claude-plugin", ".cursor-plugin", "boldcreate.json",
249-
"skills", "agents", "rules", "hooks", "assets", "README.md", "CHANGELOG.md", "LICENSE",
249+
"skills", "agents", "rules", "hooks", "assets", "README.md", "CHANGELOG.md", "LICENSE", "NOTICE",
250250
]);
251251
const extra = readdirSync(base).filter((e) => !known.has(e));
252252
if (extra.length) warnings.push(`${dir}: BoldCreate Connect does not deliver plugin-level files (${extra.join(", ")})`);

‎scripts/validate.mjs‎

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,42 @@ function validate(kind, file) {
4848
const VAR_REF = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
4949
const SEMVER = /^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/;
5050

51+
52+
// Licences. Syncfusion's own plugins and MCP plugins are MIT, like cursor/plugins. A community
53+
// plugin copies another vendor's files, so its manifest must name the vendor's real licence:
54+
// MIT or Apache-2.0, matching the LICENSE file kept in the plugin folder and the licence recorded
55+
// in boldcreate.json under "upstream". Apache-2.0 also requires carrying the vendor's NOTICE file.
56+
const COMMUNITY_LICENSES = new Set(["MIT", "Apache-2.0"]);
57+
function detectLicense(text) {
58+
const head = text.slice(0, 4000).replace(/\s+/g, " ");
59+
if (/Apache License/i.test(head) && /Version 2\.0/i.test(head)) return "Apache-2.0";
60+
if (/MIT License|Permission is hereby granted, free of charge/i.test(head)) return "MIT";
61+
return null;
62+
}
63+
function checkLicense(base, manifest, meta) {
64+
const community = base.startsWith("third_party/") && meta?.upstream;
65+
if (!community) {
66+
if (manifest.license !== "MIT") fail(`${base}: license must be set (MIT, like cursor/plugins)`);
67+
return;
68+
}
69+
if (!COMMUNITY_LICENSES.has(manifest.license)) {
70+
fail(`${base}: license "${manifest.license}" is not allowed for a community plugin (use MIT or Apache-2.0)`);
71+
return;
72+
}
73+
if (meta.upstream.license !== manifest.license) {
74+
fail(`${base}: boldcreate.json upstream.license "${meta.upstream.license}" must match the manifest license "${manifest.license}"`);
75+
}
76+
const file = join(root, base, "LICENSE");
77+
if (!existsSync(file)) return; // the missing file is reported with the other required files
78+
const found = detectLicense(readFileSync(file, "utf-8"));
79+
if (found !== manifest.license) {
80+
fail(`${base}: the LICENSE file reads as ${found ?? "an unrecognised licence"}, but the manifest says ${manifest.license}`);
81+
}
82+
if (manifest.license === "Apache-2.0" && !existsSync(join(root, base, "NOTICE")) && meta.upstream.notice === true) {
83+
fail(`${base}: boldcreate.json says the vendor has a NOTICE file, but NOTICE is missing from the plugin folder`);
84+
}
85+
}
86+
5187
const plugins = listPlugins();
5288
const summaries = [];
5389
for (const { name, dir: base } of plugins) {
@@ -58,7 +94,7 @@ for (const { name, dir: base } of plugins) {
5894
if (manifest.name !== name) fail(`${base}: manifest name "${manifest.name}" must be "${name}"`);
5995
if (!SEMVER.test(manifest.version ?? "")) fail(`${base}: version "${manifest.version}" is not semver`);
6096

61-
if (manifest.license !== "MIT") fail(`${base}: license must be set (MIT, like cursor/plugins)`);
97+
checkLicense(base, manifest, meta);
6298
if (!manifest.logo) fail(`${base}: logo must be set, e.g. "assets/logo.svg"`);
6399
else if (!/^assets\/[^/]+\.(svg|png)$/.test(manifest.logo)) fail(`${base}: logo must be an .svg or .png under assets/`);
64100
else if (!existsSync(join(root, base, manifest.logo))) fail(`${base}/${manifest.logo} does not exist`);

0 commit comments

Comments
 (0)