fix: correct circular dep detection in pre-commit hook
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m30s

The generate-dependency-graph.js script was counting madge's
'Processed N files' info line as a circular chain. Fixed the
filter to only match lines starting with 'N)' pattern.
This commit is contained in:
2026-05-26 21:57:50 +02:00
parent 06c3fe4380
commit 2fa16c5749
3 changed files with 16 additions and 25 deletions
+6 -2
View File
@@ -86,9 +86,13 @@ try {
}
const lines = circularOutput.trim().split('\n').filter(Boolean);
// madge circular output starts with "Found N circular dependencies!"
// madge circular output format:
// "Found N circular dependencies!" (summary)
// "1) fileA > fileB > fileC" (chain lines start with number + ')')
// "Processed N files ..." (info line to ignore)
// "✔ No circular dependency found!" (clean result)
const circularLines = lines.filter(
(l) => !l.startsWith('Found') && !l.startsWith('✔') && l.trim()
(l) => /^\d+\)/.test(l.trim())
);
let content;