- Add 60 new agents across all 10 categories (75 -> 135) - Add 95 new plugins with command files (25 -> 120) - Update all agents to use model: opus - Update README with complete plugin/agent tables - Update marketplace.json with all 120 plugins
42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
const { execFileSync } = require("child_process");
|
|
|
|
const input = JSON.parse(process.argv[2] || "{}");
|
|
const command = input.command || input.input || "";
|
|
|
|
if (!command.includes("git commit")) process.exit(0);
|
|
|
|
const msgMatch = command.match(/-m\s+["']([^"']+)["']/);
|
|
if (!msgMatch) process.exit(0);
|
|
|
|
const msg = msgMatch[1];
|
|
const errors = [];
|
|
|
|
const conventionalPattern = /^(feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert)(\(.+\))?!?:\s.+/;
|
|
if (!conventionalPattern.test(msg)) {
|
|
errors.push("Message does not follow conventional commit format: type(scope): description");
|
|
}
|
|
|
|
if (msg.length > 72) {
|
|
errors.push(`Subject line is ${msg.length} chars (max 72)`);
|
|
}
|
|
|
|
if (msg.endsWith(".")) {
|
|
errors.push("Subject line should not end with a period");
|
|
}
|
|
|
|
const firstChar = msg.replace(/^(feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert)(\(.+\))?!?:\s/, "")[0];
|
|
if (firstChar && firstChar === firstChar.toUpperCase()) {
|
|
errors.push("Description should start with lowercase letter");
|
|
}
|
|
|
|
if (errors.length > 0) {
|
|
console.log(
|
|
JSON.stringify({
|
|
decision: "block",
|
|
reason: "Commit message issues:\n" + errors.map((e) => " - " + e).join("\n"),
|
|
})
|
|
);
|
|
} else {
|
|
console.log(JSON.stringify({ decision: "allow", message: "Commit message looks good" }));
|
|
}
|