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); 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( const circularLines = lines.filter(
(l) => !l.startsWith('Found') && !l.startsWith('✔') && l.trim() (l) => /^\d+\)/.test(l.trim())
); );
let content; let content;
+2 -16
View File
@@ -1,18 +1,4 @@
# Circular Dependencies # Circular Dependencies
Generated: $(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ") Generated: 2026-05-26T19:57:33.588Z
Found: 0 circular chain(s) — clean!
## Status No circular dependencies found. ✅
All 7 previously-known circular dependency chains have been resolved:
1. ✅ effects/discipline-effects.ts > stores/discipline-slice.ts > stores/combatStore.ts > stores/combat-actions.ts
- Fixed by: discipline-slice.ts uses callbacks instead of directly importing combatStore
2. ✅ utils/floor-utils.ts > utils/room-utils.ts > utils/enemy-utils.ts
- Fixed by: removed re-export of getDodgeChance from floor-utils.ts
3. ✅ utils/floor-utils.ts > utils/room-utils.ts
- Fixed by: same as above
4. ✅ stores/gameStore.ts > stores/gameActions.ts
- Fixed by: extracted GameCoordinatorState to gameStore.types.ts
5. ✅ stores/gameStore.ts > stores/gameLoopActions.ts
- Fixed by: extracted GameCoordinatorState to gameStore.types.ts
6. ✅ stores/gameStore.ts > stores/tick-pipeline.ts
- Fixed by: extracted GameCoordinatorState to gameStore.types.ts
+8 -7
View File
@@ -1,6 +1,6 @@
{ {
"_meta": { "_meta": {
"generated": "2026-05-26T19:43:50.116Z", "generated": "2026-05-26T19:57:31.715Z",
"description": "Import dependency graph for src/lib/game. Keys are files, values are arrays of files they import.", "description": "Import dependency graph for src/lib/game. Keys are files, values are arrays of files they import.",
"usage": "To find what a file affects, search for its path in the VALUES. To find what a file depends on, look at its KEY entry." "usage": "To find what a file affects, search for its path in the VALUES. To find what a file depends on, look at its KEY entry."
}, },
@@ -489,7 +489,6 @@
"data/disciplines/enchanter.ts", "data/disciplines/enchanter.ts",
"data/disciplines/fabricator.ts", "data/disciplines/fabricator.ts",
"data/disciplines/invoker.ts", "data/disciplines/invoker.ts",
"stores/combatStore.ts",
"types.ts", "types.ts",
"types/disciplines.ts", "types/disciplines.ts",
"utils/discipline-math.ts", "utils/discipline-math.ts",
@@ -498,7 +497,7 @@
"stores/gameActions.ts": [ "stores/gameActions.ts": [
"effects/discipline-effects.ts", "effects/discipline-effects.ts",
"stores/combatStore.ts", "stores/combatStore.ts",
"stores/gameStore.ts", "stores/gameStore.types.ts",
"stores/manaStore.ts", "stores/manaStore.ts",
"stores/prestigeStore.ts", "stores/prestigeStore.ts",
"stores/uiStore.ts", "stores/uiStore.ts",
@@ -518,7 +517,7 @@
"constants.ts", "constants.ts",
"effects/discipline-effects.ts", "effects/discipline-effects.ts",
"stores/combatStore.ts", "stores/combatStore.ts",
"stores/gameStore.ts", "stores/gameStore.types.ts",
"stores/manaStore.ts", "stores/manaStore.ts",
"stores/prestigeStore.ts", "stores/prestigeStore.ts",
"stores/uiStore.ts", "stores/uiStore.ts",
@@ -538,6 +537,7 @@
"stores/discipline-slice.ts", "stores/discipline-slice.ts",
"stores/gameActions.ts", "stores/gameActions.ts",
"stores/gameLoopActions.ts", "stores/gameLoopActions.ts",
"stores/gameStore.types.ts",
"stores/manaStore.ts", "stores/manaStore.ts",
"stores/prestigeStore.ts", "stores/prestigeStore.ts",
"stores/tick-pipeline.ts", "stores/tick-pipeline.ts",
@@ -545,6 +545,7 @@
"utils/index.ts", "utils/index.ts",
"utils/safe-persist.ts" "utils/safe-persist.ts"
], ],
"stores/gameStore.types.ts": [],
"stores/index.ts": [ "stores/index.ts": [
"constants.ts", "constants.ts",
"stores/attunementStore.ts", "stores/attunementStore.ts",
@@ -555,6 +556,7 @@
"stores/discipline-slice.ts", "stores/discipline-slice.ts",
"stores/gameHooks.ts", "stores/gameHooks.ts",
"stores/gameStore.ts", "stores/gameStore.ts",
"stores/gameStore.types.ts",
"stores/manaStore.ts", "stores/manaStore.ts",
"stores/prestigeStore.ts", "stores/prestigeStore.ts",
"stores/uiStore.ts", "stores/uiStore.ts",
@@ -578,7 +580,7 @@
"stores/combat-state.types.ts", "stores/combat-state.types.ts",
"stores/craftingStore.types.ts", "stores/craftingStore.types.ts",
"stores/discipline-slice.ts", "stores/discipline-slice.ts",
"stores/gameStore.ts", "stores/gameStore.types.ts",
"stores/manaStore.ts", "stores/manaStore.ts",
"stores/prestigeStore.ts", "stores/prestigeStore.ts",
"stores/uiStore.ts" "stores/uiStore.ts"
@@ -645,8 +647,7 @@
], ],
"utils/floor-utils.ts": [ "utils/floor-utils.ts": [
"constants.ts", "constants.ts",
"data/guardian-encounters.ts", "data/guardian-encounters.ts"
"utils/room-utils.ts"
], ],
"utils/formatting.ts": [], "utils/formatting.ts": [],
"utils/index.ts": [ "utils/index.ts": [