feat(plugin): 品牌图标用 deta.city logo(iconSmall/iconLarge + 契约守卫 E5),studio 0.3.12 / writer 0.1.3
CI / contract (push) Has been cancelled
CI / contract (push) Has been cancelled
plugin.json 的 interface 补 iconSmall/iconLarge = ./assets/logo.svg(与门户 favicon 同一份 brand 标),brandColor 由 #2F6F4E 改为 #333333 对齐品牌标与门店令牌色。契约校验新增 E5:图标必须是插件根内相对路径且文件存在(实测写坏能抓到)。
This commit is contained in:
@@ -69,6 +69,11 @@ const RULES = {
|
||||
what: '出现开发检出路径(~/Dev/ant/ant-copilot)',
|
||||
hint: '启动器应随包分发运行时;本机引擎包落地后本规则升级为 error',
|
||||
},
|
||||
E5: {
|
||||
level: 'error',
|
||||
what: '插件图标的路径不存在(interface.iconSmall / iconLarge 指向缺失文件或越出插件根)',
|
||||
hint: '图标必须是插件根下的相对路径(如 ./assets/logo.svg),且文件真实存在——品牌标用 deta.city 的 logo.svg',
|
||||
},
|
||||
};
|
||||
|
||||
const HEADING_BAN = /工具一览|工具清单|工具列表|工具汇总|可用工具|能力一览|能力清单/;
|
||||
@@ -145,6 +150,33 @@ for (const rel of ['.agents/plugins/marketplace.json', '.agents/plugins/api_mark
|
||||
}
|
||||
}
|
||||
|
||||
// E5:插件图标引用必须落在插件根内且真实存在(品牌标 = deta.city logo)
|
||||
for (const pluginDir of ['plugins/studio', 'plugins/writer']) {
|
||||
const manifest = join(ROOT, pluginDir, '.codex-plugin', 'plugin.json');
|
||||
if (!existsSync(manifest)) continue;
|
||||
let itf;
|
||||
try {
|
||||
itf = JSON.parse(readFileSync(manifest, 'utf8')).interface ?? {};
|
||||
} catch {
|
||||
continue; // 清单不合法由 validate_plugin.py 报
|
||||
}
|
||||
for (const key of ['iconSmall', 'iconLarge']) {
|
||||
const val = String(itf[key] ?? '');
|
||||
if (!val) {
|
||||
add('E5', manifest, 1, `interface.${key} 未设置(品牌标应指向 ./assets/logo.svg)`);
|
||||
continue;
|
||||
}
|
||||
if (/^https?:/i.test(val)) continue; // *Url 形态才是远端地址
|
||||
if (val.includes('..') || !val.startsWith('./')) {
|
||||
add('E5', manifest, 1, `${key} 必须是插件根内相对路径(收到 ${val})`);
|
||||
continue;
|
||||
}
|
||||
if (!existsSync(join(ROOT, pluginDir, val.replace(/^\.\//, '')))) {
|
||||
add('E5', manifest, 1, `${key} 指向的文件不存在:${val}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (process.argv.includes('--json')) {
|
||||
console.log(JSON.stringify({ findings, rules: RULES }, null, 2));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user