pumuki-ast-hooks 5.4.5 → 5.4.7

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.
Files changed (166) hide show
  1. package/package.json +2 -2
  2. package/scripts/hooks-system/application/services/AutonomousOrchestrator.js +2 -0
  3. package/scripts/hooks-system/application/services/ContextDetectionEngine.js +2 -0
  4. package/scripts/hooks-system/application/services/DynamicRulesLoader.js +3 -1
  5. package/scripts/hooks-system/application/services/GitFlowService.js +2 -0
  6. package/scripts/hooks-system/application/services/GitTreeState.js +1 -0
  7. package/scripts/hooks-system/application/services/HookSystemScheduler.js +2 -0
  8. package/scripts/hooks-system/application/services/IntelligentCommitAnalyzer.js +4 -1
  9. package/scripts/hooks-system/application/services/IntelligentGitTreeMonitor.js +2 -0
  10. package/scripts/hooks-system/application/services/PlatformAnalysisService.js +2 -0
  11. package/scripts/hooks-system/application/services/PlatformDetectionService.js +3 -1
  12. package/scripts/hooks-system/application/services/PlaybookRunner.js +3 -0
  13. package/scripts/hooks-system/application/services/PredictiveHookAdvisor.js +2 -0
  14. package/scripts/hooks-system/application/services/RealtimeGuardPlugin.js +2 -0
  15. package/scripts/hooks-system/application/services/SmartDirtyTreeAnalyzer.js +2 -0
  16. package/scripts/hooks-system/application/services/commit/CommitMessageGenerator.js +3 -1
  17. package/scripts/hooks-system/application/services/commit/FeatureDetector.js +5 -1
  18. package/scripts/hooks-system/application/services/evidence/EvidenceContextManager.js +2 -0
  19. package/scripts/hooks-system/application/services/guard/GuardAutoManagerService.js +1 -0
  20. package/scripts/hooks-system/application/services/guard/GuardConfig.js +3 -1
  21. package/scripts/hooks-system/application/services/guard/GuardEventLogger.js +2 -0
  22. package/scripts/hooks-system/application/services/guard/GuardHealthReminder.js +5 -1
  23. package/scripts/hooks-system/application/services/guard/GuardHeartbeatMonitor.js +2 -0
  24. package/scripts/hooks-system/application/services/guard/GuardLockManager.js +2 -0
  25. package/scripts/hooks-system/application/services/guard/GuardMonitorLoop.js +3 -1
  26. package/scripts/hooks-system/application/services/guard/GuardNotificationHandler.js +4 -0
  27. package/scripts/hooks-system/application/services/guard/GuardNotifier.js +3 -1
  28. package/scripts/hooks-system/application/services/guard/GuardProcessManager.js +2 -0
  29. package/scripts/hooks-system/application/services/guard/GuardRecoveryService.js +3 -0
  30. package/scripts/hooks-system/application/services/installation/ConfigurationGeneratorService.js +4 -0
  31. package/scripts/hooks-system/application/services/installation/FileSystemInstallerService.js +3 -0
  32. package/scripts/hooks-system/application/services/installation/GitEnvironmentService.js +3 -0
  33. package/scripts/hooks-system/application/services/installation/HookInstaller.js +4 -0
  34. package/scripts/hooks-system/application/services/installation/IdeIntegrationService.js +3 -0
  35. package/scripts/hooks-system/application/services/installation/InstallService.js +3 -0
  36. package/scripts/hooks-system/application/services/installation/McpConfigurator.js +1 -0
  37. package/scripts/hooks-system/application/services/installation/PlatformDetectorService.js +4 -0
  38. package/scripts/hooks-system/application/services/installation/VSCodeTaskConfigurator.js +4 -0
  39. package/scripts/hooks-system/application/services/logging/UnifiedLogger.js +2 -0
  40. package/scripts/hooks-system/application/services/monitoring/ActivityMonitor.js +2 -0
  41. package/scripts/hooks-system/application/services/monitoring/AstMonitor.js +2 -0
  42. package/scripts/hooks-system/application/services/monitoring/DevDocsMonitor.js +2 -0
  43. package/scripts/hooks-system/application/services/monitoring/EvidenceMonitor.js +2 -0
  44. package/scripts/hooks-system/application/services/monitoring/EvidenceMonitorService.js +1 -0
  45. package/scripts/hooks-system/application/services/monitoring/GitTreeMonitor.js +2 -0
  46. package/scripts/hooks-system/application/services/monitoring/GitTreeMonitorService.js +3 -0
  47. package/scripts/hooks-system/application/services/monitoring/HealthCheckService.js +2 -0
  48. package/scripts/hooks-system/application/services/monitoring/HeartbeatMonitorService.js +2 -0
  49. package/scripts/hooks-system/application/services/monitoring/TokenMonitor.js +2 -0
  50. package/scripts/hooks-system/application/services/notification/MacNotificationSender.js +2 -0
  51. package/scripts/hooks-system/application/services/notification/NotificationCenterService.js +2 -0
  52. package/scripts/hooks-system/application/services/notification/NotificationDispatcher.js +3 -0
  53. package/scripts/hooks-system/application/services/notification/components/NotificationCooldownManager.js +3 -0
  54. package/scripts/hooks-system/application/services/notification/components/NotificationDeduplicator.js +2 -0
  55. package/scripts/hooks-system/application/services/notification/components/NotificationQueue.js +3 -0
  56. package/scripts/hooks-system/application/services/notification/components/NotificationRetryExecutor.js +4 -0
  57. package/scripts/hooks-system/application/services/platform/PlatformHeuristics.js +2 -0
  58. package/scripts/hooks-system/application/services/recovery/AutoRecoveryManager.js +2 -0
  59. package/scripts/hooks-system/application/services/smart-commit/CommitMessageSuggester.js +4 -0
  60. package/scripts/hooks-system/application/services/smart-commit/FileContextGrouper.js +2 -0
  61. package/scripts/hooks-system/application/services/smart-commit/SmartCommitSummaryBuilder.js +6 -0
  62. package/scripts/hooks-system/application/services/token/CursorTokenService.js +3 -0
  63. package/scripts/hooks-system/application/services/token/TokenMetricsService.js +4 -0
  64. package/scripts/hooks-system/application/services/token/TokenMonitorService.js +1 -0
  65. package/scripts/hooks-system/application/services/token/TokenStatusReporter.js +2 -0
  66. package/scripts/hooks-system/application/state/HookSystemStateMachine.js +2 -0
  67. package/scripts/hooks-system/application/use-cases/AnalyzeCodebaseUseCase.js +2 -0
  68. package/scripts/hooks-system/application/use-cases/AnalyzeStagedFilesUseCase.js +2 -0
  69. package/scripts/hooks-system/application/use-cases/AutoExecuteAIStartUseCase.js +2 -0
  70. package/scripts/hooks-system/application/use-cases/BlockCommitUseCase.js +2 -0
  71. package/scripts/hooks-system/application/use-cases/GenerateAuditReportUseCase.js +3 -0
  72. package/scripts/hooks-system/bin/audit-library.js +5 -4
  73. package/scripts/hooks-system/bin/auto-fix-violations.js +1 -0
  74. package/scripts/hooks-system/bin/auto-restart-guards.js +3 -2
  75. package/scripts/hooks-system/bin/check-doc-drift.js +1 -0
  76. package/scripts/hooks-system/bin/check-version.js +26 -25
  77. package/scripts/hooks-system/bin/cli.js +1 -0
  78. package/scripts/hooks-system/bin/guard-auto-manager.js +1 -0
  79. package/scripts/hooks-system/bin/guard-supervisor.js +1 -0
  80. package/scripts/hooks-system/bin/hook-status.js +1 -0
  81. package/scripts/hooks-system/bin/install.js +1 -0
  82. package/scripts/hooks-system/bin/nightly-metrics-report.js +1 -0
  83. package/scripts/hooks-system/bin/plan-review.js +1 -0
  84. package/scripts/hooks-system/bin/predictive-hooks.js +1 -0
  85. package/scripts/hooks-system/bin/pumuki-audit.js +1 -0
  86. package/scripts/hooks-system/bin/pumuki-init.js +1 -0
  87. package/scripts/hooks-system/bin/pumuki-mcp.js +1 -0
  88. package/scripts/hooks-system/bin/pumuki-rules.js +1 -0
  89. package/scripts/hooks-system/bin/run-ast-adapter.js +2 -0
  90. package/scripts/hooks-system/bin/run-orchestrator.js +1 -0
  91. package/scripts/hooks-system/bin/run-playbook.js +1 -0
  92. package/scripts/hooks-system/bin/setup-eslint.js +1 -0
  93. package/scripts/hooks-system/bin/violations-api.js +1 -0
  94. package/scripts/hooks-system/bin/watch-hooks.js +1 -0
  95. package/scripts/hooks-system/domain/errors/index.js +2 -0
  96. package/scripts/hooks-system/domain/services/AuditAnalyzer.js +2 -0
  97. package/scripts/hooks-system/domain/services/AuditFilter.js +5 -0
  98. package/scripts/hooks-system/domain/services/AuditResultSerializer.js +5 -0
  99. package/scripts/hooks-system/domain/services/AuditScorer.js +6 -0
  100. package/scripts/hooks-system/infrastructure/adapters/AstAnalyzerAdapter.js +3 -0
  101. package/scripts/hooks-system/infrastructure/adapters/FileEvidenceAdapter.js +2 -0
  102. package/scripts/hooks-system/infrastructure/adapters/GitCliAdapter.js +4 -0
  103. package/scripts/hooks-system/infrastructure/adapters/GitCommandAdapter.js +4 -0
  104. package/scripts/hooks-system/infrastructure/adapters/GitHubCliAdapter.js +2 -0
  105. package/scripts/hooks-system/infrastructure/adapters/GitQueryAdapter.js +4 -0
  106. package/scripts/hooks-system/infrastructure/adapters/LegacyAnalyzerAdapter.js +2 -0
  107. package/scripts/hooks-system/infrastructure/adapters/MacOSNotificationAdapter.js +4 -0
  108. package/scripts/hooks-system/infrastructure/adapters/git/GitCommandRunner.js +2 -0
  109. package/scripts/hooks-system/infrastructure/adapters/git/GitCommandService.js +3 -0
  110. package/scripts/hooks-system/infrastructure/adapters/git/GitQueryService.js +3 -0
  111. package/scripts/hooks-system/infrastructure/ast/android/analyzers/AndroidASTIntelligentAnalyzer.js +2 -0
  112. package/scripts/hooks-system/infrastructure/ast/android/analyzers/AndroidASTParser.js +2 -0
  113. package/scripts/hooks-system/infrastructure/ast/android/analyzers/AndroidAnalysisOrchestrator.js +2 -0
  114. package/scripts/hooks-system/infrastructure/ast/android/analyzers/AndroidArchitectureDetector.js +7 -5
  115. package/scripts/hooks-system/infrastructure/ast/android/analyzers/AndroidClassAnalyzer.js +3 -0
  116. package/scripts/hooks-system/infrastructure/ast/android/analyzers/AndroidForbiddenLiteralsAnalyzer.js +1 -0
  117. package/scripts/hooks-system/infrastructure/ast/android/analyzers/AndroidSOLIDAnalyzer.js +2 -0
  118. package/scripts/hooks-system/infrastructure/ast/archive/ios-rules.js +2 -0
  119. package/scripts/hooks-system/infrastructure/ast/archive/kotlin-analyzer.js +2 -0
  120. package/scripts/hooks-system/infrastructure/ast/archive/kotlin-parser.js +2 -0
  121. package/scripts/hooks-system/infrastructure/ast/archive/swift-analyzer.js +2 -0
  122. package/scripts/hooks-system/infrastructure/ast/backend/analyzers/BackendArchitectureDetector.js +2 -0
  123. package/scripts/hooks-system/infrastructure/ast/backend/analyzers/BackendPatternDetector.js +2 -0
  124. package/scripts/hooks-system/infrastructure/ast/common/BDDTDDWorkflowRules.js +2 -0
  125. package/scripts/hooks-system/infrastructure/ast/common/rules/BDDRules.js +2 -0
  126. package/scripts/hooks-system/infrastructure/ast/common/rules/ImplementationRules.js +2 -0
  127. package/scripts/hooks-system/infrastructure/ast/common/rules/TDDRules.js +2 -0
  128. package/scripts/hooks-system/infrastructure/ast/common/rules/WorkflowRules.js +2 -0
  129. package/scripts/hooks-system/infrastructure/ast/frontend/analyzers/FrontendArchitectureDetector.js +16 -14
  130. package/scripts/hooks-system/infrastructure/ast/frontend/analyzers/FrontendForbiddenLiteralsAnalyzer.js +5 -0
  131. package/scripts/hooks-system/infrastructure/ast/frontend/analyzers/FrontendSOLIDAnalyzer.js +2 -0
  132. package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSASTIntelligentAnalyzer.js +2 -0
  133. package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSArchitectureDetector.js +12 -10
  134. package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSArchitectureRules.js +2 -0
  135. package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSCICDRules.js +2 -0
  136. package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSEnterpriseAnalyzer.js +2 -0
  137. package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSForbiddenLiteralsAnalyzer.js +1 -0
  138. package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSNetworkingAdvancedRules.js +2 -0
  139. package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSPerformanceRules.js +3 -0
  140. package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSSPMRules.js +2 -0
  141. package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSSwiftUIAdvancedRules.js +2 -0
  142. package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSTestingAdvancedRules.js +2 -0
  143. package/scripts/hooks-system/infrastructure/ast/ios/native-bridge.js +1 -0
  144. package/scripts/hooks-system/infrastructure/ast/ios/parsers/SourceKittenParser.js +2 -0
  145. package/scripts/hooks-system/infrastructure/cli/install-wizard.js +1 -0
  146. package/scripts/hooks-system/infrastructure/mcp/ast-intelligence-automation.js +98 -42
  147. package/scripts/hooks-system/infrastructure/mcp/evidence-watcher.js +1 -0
  148. package/scripts/hooks-system/infrastructure/mcp/services/EvidenceService.js +4 -0
  149. package/scripts/hooks-system/infrastructure/mcp/services/McpProtocolHandler.js +2 -0
  150. package/scripts/hooks-system/infrastructure/orchestration/intelligent-audit.js +1 -1
  151. package/scripts/hooks-system/infrastructure/reporting/report-generator.js +4 -0
  152. package/scripts/hooks-system/infrastructure/reporting/severity-tracker.js +2 -0
  153. package/scripts/hooks-system/infrastructure/repositories/CursorTokenRepository.js +4 -0
  154. package/scripts/hooks-system/infrastructure/repositories/FileFindingsRepository.js +2 -0
  155. package/scripts/hooks-system/infrastructure/repositories/datasources/CursorApiDataSource.js +4 -0
  156. package/scripts/hooks-system/infrastructure/repositories/datasources/CursorFileDataSource.js +2 -0
  157. package/scripts/hooks-system/infrastructure/severity/context/context-builder.js +2 -0
  158. package/scripts/hooks-system/infrastructure/severity/policies/gate-policies.js +1 -0
  159. package/scripts/hooks-system/infrastructure/severity/severity-evaluator.js +2 -0
  160. package/scripts/hooks-system/infrastructure/telemetry/TelemetryService.js +2 -0
  161. package/scripts/hooks-system/infrastructure/telemetry/metrics-logger.js +2 -0
  162. package/scripts/hooks-system/infrastructure/utils/token-manager.js +2 -0
  163. package/scripts/hooks-system/infrastructure/validators/detect-commit-language.js +1 -0
  164. package/scripts/hooks-system/infrastructure/watchdog/auto-recovery.js +2 -1
  165. package/scripts/hooks-system/infrastructure/watchdog/health-check.js +2 -1
  166. package/scripts/hooks-system/infrastructure/watchdog/token-monitor.js +3 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki-ast-hooks",
3
- "version": "5.4.5",
3
+ "version": "5.4.7",
4
4
  "description": "Enterprise-grade AST Intelligence System with multi-platform support (iOS, Android, Backend, Frontend) and Feature-First + DDD + Clean Architecture enforcement. Includes dynamic violations API for intelligent querying.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -123,4 +123,4 @@
123
123
  "./skills": "./skills/skill-rules.json",
124
124
  "./hooks": "./hooks/index.js"
125
125
  }
126
- }
126
+ }
@@ -2,6 +2,7 @@ const PlatformDetectionService = require('./PlatformDetectionService');
2
2
  const { execSync } = require('child_process');
3
3
  const path = require('path');
4
4
  const UnifiedLogger = require('./logging/UnifiedLogger');
5
+ const AuditLogger = require('./logging/AuditLogger');
5
6
 
6
7
  class AutonomousOrchestrator {
7
8
  constructor(contextEngine, platformDetector, rulesLoader, logger = new UnifiedLogger()) {
@@ -9,6 +10,7 @@ class AutonomousOrchestrator {
9
10
  this.platformDetector = platformDetector || new PlatformDetectionService();
10
11
  this.rulesLoader = rulesLoader;
11
12
  this.logger = logger;
13
+ this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
12
14
  this.confidenceThresholds = {
13
15
  autoExecute: 30,
14
16
  ignore: 0
@@ -1,4 +1,5 @@
1
1
  const crypto = require('crypto');
2
+ const AuditLogger = require('./logging/AuditLogger');
2
3
 
3
4
  class ContextDetectionEngine {
4
5
  constructor(repoRootOrGitPort = null, logger = console) {
@@ -11,6 +12,7 @@ class ContextDetectionEngine {
11
12
  }
12
13
 
13
14
  this.logger = logger;
15
+ this.auditLogger = new AuditLogger({ repoRoot: this.repoRoot, logger });
14
16
  this.cache = {
15
17
  context: null,
16
18
  timestamp: 0,
@@ -1,11 +1,13 @@
1
1
  const fs = require('fs').promises;
2
2
  const path = require('path');
3
- const env = require('../config/env');
3
+ const env = require('../../config/env');
4
+ const AuditLogger = require('./logging/AuditLogger');
4
5
 
5
6
  class DynamicRulesLoader {
6
7
  constructor(rulesDirectory, logger = console) {
7
8
  this.rulesDirectory = rulesDirectory || null;
8
9
  this.logger = logger;
10
+ this.auditLogger = new AuditLogger({ repoRoot: process.cwd(), logger });
9
11
  this.rulesDirectories = this.resolveRulesDirectories();
10
12
  this.rulesMap = {
11
13
  backend: 'rulesbackend.mdc',
@@ -1,10 +1,12 @@
1
1
  const { execSync, spawnSync } = require('child_process');
2
2
  const { ConfigurationError } = require('../../domain/errors');
3
+ const AuditLogger = require('./logging/AuditLogger');
3
4
 
4
5
  class GitFlowService {
5
6
  constructor(repoRoot, options = {}, logger = console, gitQuery = null, gitCommand = null, githubAdapter = null) {
6
7
  this.repoRoot = repoRoot;
7
8
  this.logger = logger;
9
+ this.auditLogger = new AuditLogger({ repoRoot, logger });
8
10
  this.gitQuery = gitQuery;
9
11
  this.gitCommand = gitCommand || (gitQuery && gitQuery.commandAdapter ? gitQuery : null);
10
12
  this.github = githubAdapter;
@@ -1,5 +1,6 @@
1
1
  const { execSync } = require('child_process');
2
2
  const path = require('path');
3
+ const AuditLogger = require('./logging/AuditLogger');
3
4
 
4
5
  // Import recordMetric for prometheus metrics
5
6
  const { recordMetric } = require(path.join(__dirname, '..', '..', 'infrastructure', 'telemetry', 'metrics-logger'));
@@ -1,5 +1,6 @@
1
1
  const { recordMetric } = require('../../infrastructure/telemetry/metrics-logger');
2
2
  const HookSystemStateMachine = require('../state/HookSystemStateMachine');
3
+ const AuditLogger = require('./logging/AuditLogger');
3
4
 
4
5
  class HookSystemScheduler {
5
6
  constructor({ orchestrator, contextEngine, intervalMs = 30000 }) {
@@ -13,6 +14,7 @@ class HookSystemScheduler {
13
14
  this.orchestrator = orchestrator;
14
15
  this.contextEngine = contextEngine;
15
16
  this.intervalMs = intervalMs;
17
+ this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
16
18
  this.stateMachine = new HookSystemStateMachine();
17
19
  this.timer = null;
18
20
 
@@ -1,14 +1,17 @@
1
1
  const { execSync } = require('child_process');
2
- const path = require('path');
3
2
  const fs = require('fs');
3
+ const path = require('path');
4
+ const env = require('../../config/env');
4
5
  const FeatureDetector = require('./commit/FeatureDetector');
5
6
  const CommitMessageGenerator = require('./commit/CommitMessageGenerator');
6
7
  const UnifiedLogger = require('./logging/UnifiedLogger');
8
+ const AuditLogger = require('./logging/AuditLogger');
7
9
 
8
10
  class IntelligentCommitAnalyzer {
9
11
  constructor({ repoRoot = process.cwd(), logger = null } = {}) {
10
12
  this.repoRoot = repoRoot;
11
13
  this.logger = logger || console;
14
+ this.auditLogger = new AuditLogger({ repoRoot, logger });
12
15
  this.featureDetector = new FeatureDetector(this.logger);
13
16
  this.messageGenerator = new CommitMessageGenerator(this.logger);
14
17
  }
@@ -1,5 +1,6 @@
1
1
  const IntelligentCommitAnalyzer = require('./IntelligentCommitAnalyzer');
2
2
  const { getGitTreeState } = require('./GitTreeState');
3
+ const AuditLogger = require('./logging/AuditLogger');
3
4
 
4
5
  class IntelligentGitTreeMonitor {
5
6
  constructor({
@@ -8,6 +9,7 @@ class IntelligentGitTreeMonitor {
8
9
  logger = console,
9
10
  autoCommitEnabled = false
10
11
  } = {}) {
12
+ this.auditLogger = new AuditLogger({ repoRoot, logger });
11
13
  this.repoRoot = repoRoot;
12
14
  this.notifier = notifier;
13
15
  this.logger = logger;
@@ -1,11 +1,13 @@
1
1
  const path = require('path');
2
2
  const fs = require('fs');
3
3
  const PlatformHeuristics = require('./platform/PlatformHeuristics');
4
+ const AuditLogger = require('./logging/AuditLogger');
4
5
 
5
6
  class PlatformAnalysisService {
6
7
  constructor(platformDetector) {
7
8
  this.platformDetector = platformDetector;
8
9
  this.heuristics = new PlatformHeuristics(platformDetector);
10
+ this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
9
11
  }
10
12
 
11
13
  /**
@@ -1,9 +1,11 @@
1
-
2
1
  const fs = require('fs').promises;
3
2
  const path = require('path');
3
+ const env = require('../../config/env');
4
+ const AuditLogger = require('./logging/AuditLogger');
4
5
 
5
6
  class PlatformDetectionService {
6
7
  constructor() {
8
+ this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
7
9
  this.cache = {
8
10
  detections: new Map(),
9
11
  timestamp: 0,
@@ -1,12 +1,15 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
+ const env = require('../../config/env');
3
4
  const { spawnSync } = require('child_process');
4
5
  const { DomainError, NotFoundError } = require('../../domain/errors');
6
+ const AuditLogger = require('./logging/AuditLogger');
5
7
 
6
8
  const PLAYBOOKS_PATH = path.join(process.cwd(), 'scripts', 'hooks-system', 'config', 'playbooks.json');
7
9
 
8
10
  class PlaybookRunner {
9
11
  constructor(options = {}) {
12
+ this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
10
13
  this.cwd = options.cwd || process.cwd();
11
14
  this.playbooks = JSON.parse(fs.readFileSync(PLAYBOOKS_PATH, 'utf8'));
12
15
  }
@@ -1,11 +1,13 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
+ const AuditLogger = require('./logging/AuditLogger');
3
4
 
4
5
  const METRICS_FILE = path.join(process.cwd(), '.audit_tmp', 'hook-metrics.jsonl');
5
6
 
6
7
  class PredictiveHookAdvisor {
7
8
  constructor({ windowSize = 200 } = {}) {
8
9
  this.windowSize = windowSize;
10
+ this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
9
11
  }
10
12
 
11
13
  loadMetrics() {
@@ -1,4 +1,5 @@
1
1
  const EvidenceMonitorService = require('./monitoring/EvidenceMonitorService');
2
+ const AuditLogger = require('./logging/AuditLogger');
2
3
 
3
4
  class EvidenceRealtimeGuardPlugin {
4
5
  constructor({
@@ -8,6 +9,7 @@ class EvidenceRealtimeGuardPlugin {
8
9
  evidenceMonitor = null
9
10
  } = {}) {
10
11
  this.repoRoot = repoRoot;
12
+ this.auditLogger = new AuditLogger({ repoRoot, logger });
11
13
  this.notificationCenter = notificationCenter;
12
14
  this.logger = logger || console;
13
15
 
@@ -2,6 +2,7 @@ const FeatureDetector = require('./commit/FeatureDetector');
2
2
  const FileContextGrouper = require('./smart-commit/FileContextGrouper');
3
3
  const CommitMessageSuggester = require('./smart-commit/CommitMessageSuggester');
4
4
  const SmartCommitSummaryBuilder = require('./smart-commit/SmartCommitSummaryBuilder');
5
+ const AuditLogger = require('./logging/AuditLogger');
5
6
 
6
7
  class SmartDirtyTreeAnalyzer {
7
8
  constructor({
@@ -11,6 +12,7 @@ class SmartDirtyTreeAnalyzer {
11
12
  } = {}) {
12
13
  this.repoRoot = repoRoot;
13
14
  this.logger = logger;
15
+ this.auditLogger = new AuditLogger({ repoRoot, logger });
14
16
 
15
17
  this.featureDetector = new FeatureDetector(logger);
16
18
  this.grouper = new FileContextGrouper(this.featureDetector, platformDetector);
@@ -1,6 +1,8 @@
1
+ const AuditLogger = require('../logging/AuditLogger');
1
2
  class CommitMessageGenerator {
2
3
  constructor(logger = console) {
3
- this.logger = logger;
4
+
5
+ this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });this.logger = logger;
4
6
  }
5
7
 
6
8
  /**
@@ -1,6 +1,10 @@
1
+ const env = require('../../../config/env');
2
+ const AuditLogger = require('../logging/AuditLogger');
3
+
1
4
  class FeatureDetector {
2
5
  constructor(logger = console) {
3
- this.logger = logger;
6
+
7
+ this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });this.logger = logger;
4
8
  }
5
9
 
6
10
  /**
@@ -2,6 +2,7 @@ const fs = require('fs');
2
2
  const path = require('path');
3
3
  const { spawnSync } = require('child_process');
4
4
  const { DomainError } = require('../../../domain/errors');
5
+ const AuditLogger = require('../logging/AuditLogger');
5
6
 
6
7
  const DEFAULT_PLATFORMS = ['1', '2', '3', '4'];
7
8
 
@@ -39,6 +40,7 @@ class EvidenceContextManager {
39
40
  this.autoPlatforms = Array.isArray(autoPlatforms) && autoPlatforms.length ? autoPlatforms : DEFAULT_PLATFORMS;
40
41
  this.notificationCenter = notificationCenter;
41
42
  this.logger = logger || console;
43
+ this.auditLogger = new AuditLogger({ repoRoot, logger: this.logger });
42
44
  this.intervalMs = intervalMs;
43
45
  this.timers = timers;
44
46
  this.runCommand = runCommand;
@@ -1,6 +1,7 @@
1
1
  const fs = require('fs');
2
2
  const { spawnSync } = require('child_process');
3
3
  const { toErrorMessage } = require('../../../infrastructure/utils/error-utils');
4
+ const env = require('../../../config/env');
4
5
  const GuardHeartbeatMonitor = require('./GuardHeartbeatMonitor');
5
6
  const GuardLockManager = require('./GuardLockManager');
6
7
  const GuardProcessManager = require('./GuardProcessManager');
@@ -1,8 +1,10 @@
1
1
  const envHelper = require('../../../config/env.js');
2
+ const AuditLogger = require('../logging/AuditLogger');
2
3
 
3
4
  class GuardConfig {
4
5
  constructor(env = envHelper) {
5
- const getNumber = (name, def) =>
6
+
7
+ this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });const getNumber = (name, def) =>
6
8
  typeof env.getNumber === 'function' ? env.getNumber(name, def) : Number(env[name] || def);
7
9
  const getBool = (name, def) =>
8
10
  typeof env.getBool === 'function' ? env.getBool(name, def) : (env[name] !== 'false');
@@ -1,5 +1,6 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
+ const AuditLogger = require('../logging/AuditLogger');
3
4
 
4
5
  class GuardEventLogger {
5
6
  constructor({
@@ -9,6 +10,7 @@ class GuardEventLogger {
9
10
  } = {}) {
10
11
  this.repoRoot = repoRoot;
11
12
  this.logger = logger;
13
+ this.auditLogger = new AuditLogger({ repoRoot, logger });
12
14
  this.fs = fsModule;
13
15
 
14
16
  this.tmpDir = path.join(this.repoRoot, '.audit_tmp');
@@ -1,6 +1,10 @@
1
+ const env = require('../../../config/env');
2
+ const AuditLogger = require('../logging/AuditLogger');
3
+
1
4
  class GuardHealthReminder {
2
5
  constructor(timers, notificationHandler, config) {
3
- this.timers = timers;
6
+
7
+ this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });this.timers = timers;
4
8
  this.notificationHandler = notificationHandler;
5
9
  this.config = config;
6
10
  this.timer = null;
@@ -1,6 +1,7 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
3
  const env = require('../../../config/env.js');
4
+ const AuditLogger = require('../logging/AuditLogger');
4
5
 
5
6
  class GuardHeartbeatMonitor {
6
7
  constructor({
@@ -10,6 +11,7 @@ class GuardHeartbeatMonitor {
10
11
  } = {}) {
11
12
  this.repoRoot = repoRoot;
12
13
  this.logger = logger;
14
+ this.auditLogger = new AuditLogger({ repoRoot, logger });
13
15
  this.fs = fsModule;
14
16
  const heartbeatRelative = env.get('HOOK_GUARD_HEARTBEAT_PATH', path.join('.audit_tmp', 'guard-heartbeat.json'));
15
17
  this.heartbeatPath = path.isAbsolute(heartbeatRelative)
@@ -1,5 +1,6 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
+ const AuditLogger = require('../logging/AuditLogger');
3
4
 
4
5
  class GuardLockManager {
5
6
  constructor({
@@ -9,6 +10,7 @@ class GuardLockManager {
9
10
  } = {}) {
10
11
  this.repoRoot = repoRoot;
11
12
  this.logger = logger;
13
+ this.auditLogger = new AuditLogger({ repoRoot, logger });
12
14
  this.fs = fsModule;
13
15
 
14
16
  this.tmpDir = path.join(this.repoRoot, '.audit_tmp');
@@ -1,6 +1,8 @@
1
+ const AuditLogger = require('../logging/AuditLogger');
1
2
  class GuardMonitorLoop {
2
3
  constructor(timers, intervalMs, tickCallback, logger) {
3
- this.timers = timers;
4
+
5
+ this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });this.timers = timers;
4
6
  this.intervalMs = intervalMs;
5
7
  this.tickCallback = tickCallback;
6
8
  this.logger = logger;
@@ -1,8 +1,12 @@
1
+ const env = require('../../../config/env');
2
+ const AuditLogger = require('../logging/AuditLogger');
3
+
1
4
  class GuardNotificationHandler {
2
5
  constructor(notificationCenter, eventLogger, config) {
3
6
  this.notificationCenter = notificationCenter;
4
7
  this.eventLogger = eventLogger;
5
8
  this.config = config;
9
+ this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
6
10
  this.lastNotificationState = { reason: null, at: 0 };
7
11
  }
8
12
 
@@ -1,9 +1,11 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
+ const AuditLogger = require('../logging/AuditLogger');
3
4
 
4
5
  class GuardNotifier {
5
6
  constructor(logger, notificationService, notifier = null, notificationsEnabled = true) {
6
- this.logger = logger;
7
+
8
+ this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });this.logger = logger;
7
9
  this.notificationService = notificationService;
8
10
  this.notifier = typeof notifier === 'function' ? notifier : null;
9
11
  this.notificationsEnabled = notificationsEnabled;
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { spawnSync } = require('child_process');
3
+ const AuditLogger = require('../logging/AuditLogger');
3
4
 
4
5
  class GuardProcessManager {
5
6
  constructor({
@@ -8,6 +9,7 @@ class GuardProcessManager {
8
9
  fsModule = require('fs'),
9
10
  childProcess = { spawnSync }
10
11
  } = {}) {
12
+ this.auditLogger = new AuditLogger({ repoRoot, logger });
11
13
  this.repoRoot = repoRoot;
12
14
  this.logger = logger;
13
15
  this.fs = fsModule;
@@ -1,3 +1,5 @@
1
+ const AuditLogger = require('../logging/AuditLogger');
2
+
1
3
  class GuardRecoveryService {
2
4
  constructor({
3
5
  repoRoot,
@@ -8,6 +10,7 @@ class GuardRecoveryService {
8
10
  }) {
9
11
  this.repoRoot = repoRoot;
10
12
  this.logger = logger;
13
+ this.auditLogger = new AuditLogger({ repoRoot, logger });
11
14
  this.startScript = startScript;
12
15
  this.notificationHandler = notificationHandler;
13
16
  this.restartCooldownMs = restartCooldownMs;
@@ -1,3 +1,6 @@
1
+ const env = require('../../config/env');
2
+ const AuditLogger = require('../logging/AuditLogger');
3
+
1
4
  const fs = require('fs');
2
5
  const path = require('path');
3
6
 
@@ -11,6 +14,7 @@ const COLORS = {
11
14
  class ConfigurationGeneratorService {
12
15
  constructor(targetRoot, hookSystemRoot) {
13
16
  this.targetRoot = targetRoot || process.cwd();
17
+ this.auditLogger = new AuditLogger({ repoRoot: this.targetRoot });
14
18
  this.hookSystemRoot = hookSystemRoot;
15
19
  }
16
20
 
@@ -1,3 +1,6 @@
1
+ const env = require('../../config/env');
2
+ const AuditLogger = require('../logging/AuditLogger');
3
+
1
4
  const fs = require('fs');
2
5
  const path = require('path');
3
6
 
@@ -1,6 +1,7 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
3
  const { execSync, spawnSync } = require('child_process');
4
+ const AuditLogger = require('../logging/AuditLogger');
4
5
 
5
6
  const COLORS = {
6
7
  reset: '\x1b[0m',
@@ -13,6 +14,8 @@ const COLORS = {
13
14
 
14
15
  class GitEnvironmentService {
15
16
  constructor(targetRoot, version = 'unknown') {
17
+ this.targetRoot = targetRoot || process.cwd();
18
+ this.auditLogger = new AuditLogger({ repoRoot: this.targetRoot });
16
19
  this.targetRoot = targetRoot || process.cwd();
17
20
  this.version = version;
18
21
  }
@@ -1,3 +1,6 @@
1
+ const env = require('../../config/env');
2
+ const AuditLogger = require('../logging/AuditLogger');
3
+
1
4
  const fs = require('fs');
2
5
  const path = require('path');
3
6
 
@@ -6,6 +9,7 @@ class HookInstaller {
6
9
  this.targetRoot = targetRoot;
7
10
  this.hookSystemRoot = hookSystemRoot;
8
11
  this.logger = logger;
12
+ this.auditLogger = new AuditLogger({ repoRoot: targetRoot, logger });
9
13
  this.COLORS = {
10
14
  reset: '\x1b[0m',
11
15
  green: '\x1b[32m',
@@ -1,3 +1,6 @@
1
+ const env = require('../../config/env');
2
+ const AuditLogger = require('../logging/AuditLogger');
3
+
1
4
  const McpConfigurator = require('./McpConfigurator');
2
5
  const HookInstaller = require('./HookInstaller');
3
6
  const VSCodeTaskConfigurator = require('./VSCodeTaskConfigurator');
@@ -1,3 +1,6 @@
1
+ const env = require('../../config/env');
2
+ const AuditLogger = require('../logging/AuditLogger');
3
+
1
4
  const path = require('path');
2
5
  const fs = require('fs');
3
6
 
@@ -4,6 +4,7 @@ const { execSync } = require('child_process');
4
4
  const crypto = require('crypto');
5
5
  const os = require('os');
6
6
  const env = require('../../../config/env.js');
7
+ const AuditLogger = require('../logging/AuditLogger');
7
8
 
8
9
  const COLORS = {
9
10
  reset: '\x1b[0m',
@@ -1,9 +1,13 @@
1
+ const env = require('../../config/env');
2
+ const AuditLogger = require('../logging/AuditLogger');
3
+
1
4
  const glob = require('glob');
2
5
 
3
6
  class PlatformDetectorService {
4
7
  constructor(targetRoot) {
5
8
  this.targetRoot = targetRoot || process.cwd();
6
9
  this.platforms = [];
10
+ this.auditLogger = new AuditLogger({ repoRoot: this.targetRoot });
7
11
  }
8
12
 
9
13
  detect() {
@@ -1,3 +1,6 @@
1
+ const env = require('../../config/env');
2
+ const AuditLogger = require('../logging/AuditLogger');
3
+
1
4
  const fs = require('fs');
2
5
  const path = require('path');
3
6
 
@@ -5,6 +8,7 @@ class VSCodeTaskConfigurator {
5
8
  constructor(targetRoot, logger = null) {
6
9
  this.targetRoot = targetRoot;
7
10
  this.logger = logger;
11
+ this.auditLogger = new AuditLogger({ repoRoot: targetRoot, logger });
8
12
  this.COLORS = {
9
13
  reset: '\x1b[0m',
10
14
  green: '\x1b[32m',
@@ -1,3 +1,5 @@
1
+ const env = require('../../config/env');
2
+
1
3
  const fs = require('fs');
2
4
  const path = require('path');
3
5
  const { ConfigurationError } = require('../../../domain/errors');
@@ -1,5 +1,6 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
+ const AuditLogger = require('../logging/AuditLogger');
3
4
 
4
5
  class ActivityMonitor {
5
6
  constructor({
@@ -8,6 +9,7 @@ class ActivityMonitor {
8
9
  logger = console
9
10
  } = {}) {
10
11
  this.repoRoot = repoRoot;
12
+ this.auditLogger = new AuditLogger({ repoRoot, logger });
11
13
  this.inactivityGraceMs = inactivityGraceMs;
12
14
  this.logger = logger;
13
15
  this.lastUserActivityAt = Date.now();
@@ -1,6 +1,7 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
3
  const { spawn } = require('child_process');
4
+ const AuditLogger = require('../logging/AuditLogger');
4
5
 
5
6
  class AstMonitor {
6
7
  constructor({
@@ -12,6 +13,7 @@ class AstMonitor {
12
13
  notificationService = null
13
14
  } = {}) {
14
15
  this.repoRoot = repoRoot;
16
+ this.auditLogger = new AuditLogger({ repoRoot, logger });
15
17
  this.debounceMs = debounceMs;
16
18
  this.cooldownMs = cooldownMs;
17
19
  this.enabled = enabled;
@@ -1,5 +1,6 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
+ const AuditLogger = require('../logging/AuditLogger');
3
4
 
4
5
  class DevDocsMonitor {
5
6
  constructor({
@@ -11,6 +12,7 @@ class DevDocsMonitor {
11
12
  notificationService = null
12
13
  } = {}) {
13
14
  this.repoRoot = repoRoot;
15
+ this.auditLogger = new AuditLogger({ repoRoot, logger });
14
16
  this.checkIntervalMs = checkIntervalMs;
15
17
  this.staleThresholdMs = staleThresholdMs;
16
18
  this.autoRefreshEnabled = autoRefreshEnabled;
@@ -2,10 +2,12 @@ const fs = require('fs');
2
2
  const path = require('path');
3
3
  const { execSync } = require('child_process');
4
4
  const { ConfigurationError, DomainError } = require('../../../domain/errors');
5
+ const AuditLogger = require('../logging/AuditLogger');
5
6
 
6
7
  class EvidenceMonitor {
7
8
  constructor(repoRoot, options = {}) {
8
9
  this.repoRoot = repoRoot;
10
+ this.auditLogger = new AuditLogger({ repoRoot });
9
11
  this.staleThresholdMs = options.staleThresholdMs || 180000;
10
12
  this.pollIntervalMs = options.pollIntervalMs || 30000;
11
13
  this.reminderIntervalMs = options.reminderIntervalMs || 60000;
@@ -2,6 +2,7 @@ const fs = require('fs');
2
2
  const path = require('path');
3
3
  const { execSync } = require('child_process');
4
4
  const env = require('../../../config/env.js');
5
+ const AuditLogger = require('../logging/AuditLogger');
5
6
 
6
7
  function resolveUpdateEvidenceScript(repoRoot) {
7
8
  const candidates = [
@@ -1,10 +1,12 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
3
  const { execSync } = require('child_process');
4
+ const AuditLogger = require('../logging/AuditLogger');
4
5
 
5
6
  class GitTreeMonitor {
6
7
  constructor(repoRoot, options = {}) {
7
8
  this.repoRoot = repoRoot;
9
+ this.auditLogger = new AuditLogger({ repoRoot });
8
10
  this.stagedThreshold = options.stagedThreshold || 10;
9
11
  this.unstagedThreshold = options.unstagedThreshold || 15;
10
12
  this.totalThreshold = options.totalThreshold || 20;
@@ -1,3 +1,5 @@
1
+ const AuditLogger = require('../logging/AuditLogger');
2
+
1
3
  class GitTreeMonitorService {
2
4
  constructor({
3
5
  repoRoot = process.cwd(),
@@ -11,6 +13,7 @@ class GitTreeMonitorService {
11
13
  debugLogger = null
12
14
  } = {}) {
13
15
  this.repoRoot = repoRoot;
16
+ this.auditLogger = new AuditLogger({ repoRoot, logger });
14
17
  this.limit = limit;
15
18
  this.warning = warning;
16
19
  this.reminderMs = reminderMs;