pasika 0.10.100 → 0.10.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eslint/pasika/index.js +47 -0
- package/package.json +1 -1
|
@@ -3832,6 +3832,7 @@ var huskyHookRule = {
|
|
|
3832
3832
|
return;
|
|
3833
3833
|
}
|
|
3834
3834
|
const content = readFileSync6(hookPath, "utf8");
|
|
3835
|
+
const commands = content.replace(/^[ \t]*#[^\r\n]*$/gm, "");
|
|
3835
3836
|
const scripts = root.members.find((member) => memberName(member) === "scripts");
|
|
3836
3837
|
const scriptNames = new Set(scripts?.value.type === "Object" ? scripts.value.members.map(memberName) : []);
|
|
3837
3838
|
const requireNamedScript = (name) => {
|
|
@@ -3847,6 +3848,52 @@ var huskyHookRule = {
|
|
|
3847
3848
|
}
|
|
3848
3849
|
requireNamedScript("typecheck");
|
|
3849
3850
|
requireNamedScript("test:unit:coverage");
|
|
3851
|
+
const autoStageAll = /^\s*git\s+add\s+(?:--\s+)?(?:-A|--all|-u|\.)(?:\s*(?:#.*)?)?$/m.test(commands);
|
|
3852
|
+
const coverageIndex = commands.indexOf("npm run test:unit:coverage");
|
|
3853
|
+
const coverageGuard = /if\s+!\s+git\s+diff\s+--quiet\s+--\s+vitest\.config\.ts\s*;\s*then[\s\S]*?\bexit\s+1\b[\s\S]*?\bfi\b/.exec(
|
|
3854
|
+
commands
|
|
3855
|
+
);
|
|
3856
|
+
if (coverageIndex >= 0 && (!coverageGuard || coverageGuard.index <= coverageIndex)) {
|
|
3857
|
+
context.report({
|
|
3858
|
+
node,
|
|
3859
|
+
message: ".husky/pre-commit must reject unstaged vitest.config.ts changes after coverage."
|
|
3860
|
+
});
|
|
3861
|
+
}
|
|
3862
|
+
if (autoStageAll || /\bgit\s+add\s+(?:--\s+)?vitest\.config\.ts\b/.test(commands)) {
|
|
3863
|
+
context.report({ node, message: ".husky/pre-commit must not auto-stage vitest.config.ts." });
|
|
3864
|
+
}
|
|
3865
|
+
if (existsSync4(path30.join(context.cwd, "vulyk.config.ts"))) {
|
|
3866
|
+
const syncIndex = commands.search(/\bnpx\s+vulyk\s+sync\b/);
|
|
3867
|
+
const agentsIndex = commands.search(/\bnpx\s+vulyk\s+agents\b/);
|
|
3868
|
+
const stagedIndex = commands.indexOf("lint-staged");
|
|
3869
|
+
if (syncIndex < 0 || agentsIndex <= syncIndex || stagedIndex <= agentsIndex) {
|
|
3870
|
+
context.report({
|
|
3871
|
+
node,
|
|
3872
|
+
message: ".husky/pre-commit must run npx vulyk sync and npx vulyk agents before lint-staged."
|
|
3873
|
+
});
|
|
3874
|
+
}
|
|
3875
|
+
const vulykGuard = /if\s+!\s+git\s+diff\s+--quiet\s+--[\s\S]*?git\s+ls-files\s+--others\s+--exclude-standard\s+--[\s\S]*?\bexit\s+1\b[\s\S]*?\bfi\b/.exec(
|
|
3876
|
+
commands
|
|
3877
|
+
);
|
|
3878
|
+
const tracked = /git diff --quiet -- (?<paths>[^\r\n]*)/.exec(vulykGuard?.[0] ?? "")?.groups?.paths;
|
|
3879
|
+
const untracked = /git ls-files --others --exclude-standard -- (?<paths>[^\r\n)]*)/.exec(
|
|
3880
|
+
vulykGuard?.[0] ?? ""
|
|
3881
|
+
)?.groups?.paths;
|
|
3882
|
+
const outputPaths = ["AGENTS.md", "CLAUDE.md", "docs/managed"];
|
|
3883
|
+
const hasPaths = outputPaths.every((output) => tracked?.includes(output) && untracked?.includes(output));
|
|
3884
|
+
if (!hasPaths || !vulykGuard || vulykGuard.index <= agentsIndex || vulykGuard.index >= stagedIndex) {
|
|
3885
|
+
context.report({
|
|
3886
|
+
node,
|
|
3887
|
+
message: ".husky/pre-commit must reject unstaged and untracked Vulyk-generated files before lint-staged."
|
|
3888
|
+
});
|
|
3889
|
+
}
|
|
3890
|
+
if (autoStageAll || /\bgit\s+add\s+(?:-A\s+|--all\s+|--\s+)?(?:AGENTS\.md|CLAUDE\.md|docs\/managed)\b/.test(commands)) {
|
|
3891
|
+
context.report({
|
|
3892
|
+
node,
|
|
3893
|
+
message: ".husky/pre-commit must not auto-stage Vulyk-generated files."
|
|
3894
|
+
});
|
|
3895
|
+
}
|
|
3896
|
+
}
|
|
3850
3897
|
if (!content.includes("libyear --limit-major-individual=1")) {
|
|
3851
3898
|
context.report({ node, message: ".husky/pre-commit must run npx libyear --limit-major-individual=1." });
|
|
3852
3899
|
}
|