| 664 | |
| 665 | function countHooksInConfig(config) { |
| 666 | if (!config || typeof config !== 'object') return 0; |
| 667 | if (Array.isArray(config.hooks)) return config.hooks.length; |
| 668 | if (!config.hooks || typeof config.hooks !== 'object') return 0; |
| 669 | |
| 670 | let total = 0; |
| 671 | for (const value of Object.values(config.hooks)) { |
| 672 | if (!Array.isArray(value)) continue; |
| 673 | for (const matcher of value) { |
| 674 | total += Array.isArray(matcher.hooks) ? matcher.hooks.length : 1; |
| 675 | } |
| 676 | } |
| 677 | return total; |
| 678 | } |
| 679 | |
| 680 | function readHealth(projectRoot) { |
| 681 | const today = new Date().toISOString().slice(0, 10); |
| 682 | const auditPath = path.join(projectRoot, '.planning', 'telemetry', 'audit.jsonl'); |