feat(plugin): custom SVG icons, market stats, submit link, and native locale scaffold (#170)
* feat(plugin): custom SVG icons, market stats, submit link, and native locale scaffold * chore(ci): allow spaces in PR model names and rename agent declaration to tool * fix(plugin): validate icon.svg size and markup during static scan
This commit is contained in:
33 files changed
+543
-72
No files matched your search
@@ -1,8 +1,11 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { pathToFileURL } from "node:url";
|
||||
|
||||
const MODEL_LINE_RE = /^ {0,3}model:[ \t]+[\p{L}\p{N}][\p{L}\p{N}_.+() -]*\/[\p{L}\p{N}][\p{L}\p{N}_.+() -]*$/u;
|
||||
const TOOL_LINE_RE = /^ {0,3}(?:tool|agent):[ \t]+[\p{L}\p{N}][\p{L}\p{N}_.+() /-]*$/u;
|
||||
|
||||
export function missingDeclarations(body) {
|
||||
const missing = new Set(["model", "agent"]);
|
||||
const missing = new Set(["model", "tool"]);
|
||||
if (typeof body !== "string") return [...missing];
|
||||
let fence = null;
|
||||
for (const line of body.replace(/<!--[^]*?(?:-->|$)/g, "").split(/\r?\n/)) {
|
||||
@@ -11,10 +14,13 @@ export function missingDeclarations(body) {
|
||||
if (delimiter && delimiter[1][0] === fence[0] && delimiter[1].length >= fence.length && !delimiter[2].trim()) fence = null;
|
||||
} else if (delimiter) {
|
||||
fence = delimiter[1];
|
||||
} else if (/^ {0,3}model:[ \t]+[\p{L}\p{N}_.-]+\/[\p{L}\p{N}_.-]+[ \t]*$/u.test(line)) {
|
||||
missing.delete("model");
|
||||
} else if (/^ {0,3}agent:[ \t]+[\p{L}\p{N}][\p{L}\p{N}_.+() /-]*$/u.test(line.trimEnd())) {
|
||||
missing.delete("agent");
|
||||
} else {
|
||||
const trimmed = line.trimEnd();
|
||||
if (MODEL_LINE_RE.test(trimmed)) {
|
||||
missing.delete("model");
|
||||
} else if (TOOL_LINE_RE.test(trimmed)) {
|
||||
missing.delete("tool");
|
||||
}
|
||||
}
|
||||
if (missing.size === 0) break;
|
||||
}
|
||||
@@ -52,7 +58,7 @@ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href)
|
||||
token: process.env.GITHUB_TOKEN,
|
||||
});
|
||||
if (result.status === "closed") {
|
||||
console.error(`::error::PR closed because its description is missing ${result.missing.join(" and ")}. Declare the actual model and agent used (format examples: model: deepseek/deepseek-R1 and agent: WorkBuddy).`);
|
||||
console.error(`::error::PR closed because its description is missing ${result.missing.join(" and ")}. Declare the actual model and coding tool used (format examples: model: deepseek/deepseek-R1 and tool: Cursor).`);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user