pumuki-ast-hooks 5.4.5 → 5.4.6
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/package.json +2 -2
- package/scripts/hooks-system/application/services/AutonomousOrchestrator.js +2 -0
- package/scripts/hooks-system/application/services/ContextDetectionEngine.js +2 -0
- package/scripts/hooks-system/application/services/DynamicRulesLoader.js +3 -1
- package/scripts/hooks-system/application/services/GitFlowService.js +2 -0
- package/scripts/hooks-system/application/services/GitTreeState.js +1 -0
- package/scripts/hooks-system/application/services/HookSystemScheduler.js +2 -0
- package/scripts/hooks-system/application/services/IntelligentCommitAnalyzer.js +4 -1
- package/scripts/hooks-system/application/services/IntelligentGitTreeMonitor.js +2 -0
- package/scripts/hooks-system/application/services/PlatformAnalysisService.js +2 -0
- package/scripts/hooks-system/application/services/PlatformDetectionService.js +3 -1
- package/scripts/hooks-system/application/services/PlaybookRunner.js +3 -0
- package/scripts/hooks-system/application/services/PredictiveHookAdvisor.js +2 -0
- package/scripts/hooks-system/application/services/RealtimeGuardPlugin.js +2 -0
- package/scripts/hooks-system/application/services/SmartDirtyTreeAnalyzer.js +2 -0
- package/scripts/hooks-system/application/services/commit/CommitMessageGenerator.js +3 -1
- package/scripts/hooks-system/application/services/commit/FeatureDetector.js +5 -1
- package/scripts/hooks-system/application/services/evidence/EvidenceContextManager.js +1 -0
- package/scripts/hooks-system/application/services/guard/GuardAutoManagerService.js +1 -0
- package/scripts/hooks-system/application/services/guard/GuardConfig.js +3 -1
- package/scripts/hooks-system/application/services/guard/GuardEventLogger.js +2 -0
- package/scripts/hooks-system/application/services/guard/GuardHealthReminder.js +5 -1
- package/scripts/hooks-system/application/services/guard/GuardHeartbeatMonitor.js +2 -0
- package/scripts/hooks-system/application/services/guard/GuardLockManager.js +2 -0
- package/scripts/hooks-system/application/services/guard/GuardMonitorLoop.js +3 -1
- package/scripts/hooks-system/application/services/guard/GuardNotificationHandler.js +4 -0
- package/scripts/hooks-system/application/services/guard/GuardNotifier.js +3 -1
- package/scripts/hooks-system/application/services/guard/GuardProcessManager.js +2 -0
- package/scripts/hooks-system/application/services/guard/GuardRecoveryService.js +3 -0
- package/scripts/hooks-system/application/services/installation/ConfigurationGeneratorService.js +4 -0
- package/scripts/hooks-system/application/services/installation/FileSystemInstallerService.js +3 -0
- package/scripts/hooks-system/application/services/installation/GitEnvironmentService.js +3 -0
- package/scripts/hooks-system/application/services/installation/HookInstaller.js +4 -0
- package/scripts/hooks-system/application/services/installation/IdeIntegrationService.js +3 -0
- package/scripts/hooks-system/application/services/installation/InstallService.js +3 -0
- package/scripts/hooks-system/application/services/installation/McpConfigurator.js +1 -0
- package/scripts/hooks-system/application/services/installation/PlatformDetectorService.js +4 -0
- package/scripts/hooks-system/application/services/installation/VSCodeTaskConfigurator.js +4 -0
- package/scripts/hooks-system/application/services/logging/UnifiedLogger.js +2 -0
- package/scripts/hooks-system/application/services/monitoring/ActivityMonitor.js +2 -0
- package/scripts/hooks-system/application/services/monitoring/AstMonitor.js +2 -0
- package/scripts/hooks-system/application/services/monitoring/DevDocsMonitor.js +2 -0
- package/scripts/hooks-system/application/services/monitoring/EvidenceMonitor.js +2 -0
- package/scripts/hooks-system/application/services/monitoring/EvidenceMonitorService.js +1 -0
- package/scripts/hooks-system/application/services/monitoring/GitTreeMonitor.js +2 -0
- package/scripts/hooks-system/application/services/monitoring/GitTreeMonitorService.js +3 -0
- package/scripts/hooks-system/application/services/monitoring/HealthCheckService.js +2 -0
- package/scripts/hooks-system/application/services/monitoring/HeartbeatMonitorService.js +2 -0
- package/scripts/hooks-system/application/services/monitoring/TokenMonitor.js +2 -0
- package/scripts/hooks-system/application/services/notification/MacNotificationSender.js +2 -0
- package/scripts/hooks-system/application/services/notification/NotificationCenterService.js +2 -0
- package/scripts/hooks-system/application/services/notification/NotificationDispatcher.js +3 -0
- package/scripts/hooks-system/application/services/notification/components/NotificationCooldownManager.js +3 -0
- package/scripts/hooks-system/application/services/notification/components/NotificationDeduplicator.js +2 -0
- package/scripts/hooks-system/application/services/notification/components/NotificationQueue.js +3 -0
- package/scripts/hooks-system/application/services/notification/components/NotificationRetryExecutor.js +4 -0
- package/scripts/hooks-system/application/services/platform/PlatformHeuristics.js +2 -0
- package/scripts/hooks-system/application/services/recovery/AutoRecoveryManager.js +2 -0
- package/scripts/hooks-system/application/services/smart-commit/CommitMessageSuggester.js +4 -0
- package/scripts/hooks-system/application/services/smart-commit/FileContextGrouper.js +2 -0
- package/scripts/hooks-system/application/services/smart-commit/SmartCommitSummaryBuilder.js +6 -0
- package/scripts/hooks-system/application/services/token/CursorTokenService.js +1 -0
- package/scripts/hooks-system/application/services/token/TokenMetricsService.js +4 -0
- package/scripts/hooks-system/application/services/token/TokenMonitorService.js +1 -0
- package/scripts/hooks-system/application/services/token/TokenStatusReporter.js +2 -0
- package/scripts/hooks-system/application/state/HookSystemStateMachine.js +2 -0
- package/scripts/hooks-system/application/use-cases/AnalyzeCodebaseUseCase.js +2 -0
- package/scripts/hooks-system/application/use-cases/AnalyzeStagedFilesUseCase.js +2 -0
- package/scripts/hooks-system/application/use-cases/AutoExecuteAIStartUseCase.js +2 -0
- package/scripts/hooks-system/application/use-cases/BlockCommitUseCase.js +2 -0
- package/scripts/hooks-system/application/use-cases/GenerateAuditReportUseCase.js +3 -0
- package/scripts/hooks-system/bin/audit-library.js +5 -4
- package/scripts/hooks-system/bin/auto-fix-violations.js +1 -0
- package/scripts/hooks-system/bin/auto-restart-guards.js +3 -2
- package/scripts/hooks-system/bin/check-doc-drift.js +1 -0
- package/scripts/hooks-system/bin/check-version.js +26 -25
- package/scripts/hooks-system/bin/cli.js +1 -0
- package/scripts/hooks-system/bin/guard-auto-manager.js +1 -0
- package/scripts/hooks-system/bin/guard-supervisor.js +1 -0
- package/scripts/hooks-system/bin/hook-status.js +1 -0
- package/scripts/hooks-system/bin/install.js +1 -0
- package/scripts/hooks-system/bin/nightly-metrics-report.js +1 -0
- package/scripts/hooks-system/bin/plan-review.js +1 -0
- package/scripts/hooks-system/bin/predictive-hooks.js +1 -0
- package/scripts/hooks-system/bin/pumuki-audit.js +1 -0
- package/scripts/hooks-system/bin/pumuki-init.js +1 -0
- package/scripts/hooks-system/bin/pumuki-mcp.js +1 -0
- package/scripts/hooks-system/bin/pumuki-rules.js +1 -0
- package/scripts/hooks-system/bin/run-ast-adapter.js +2 -0
- package/scripts/hooks-system/bin/run-orchestrator.js +1 -0
- package/scripts/hooks-system/bin/run-playbook.js +1 -0
- package/scripts/hooks-system/bin/setup-eslint.js +1 -0
- package/scripts/hooks-system/bin/violations-api.js +1 -0
- package/scripts/hooks-system/bin/watch-hooks.js +1 -0
- package/scripts/hooks-system/domain/errors/index.js +2 -0
- package/scripts/hooks-system/domain/services/AuditAnalyzer.js +2 -0
- package/scripts/hooks-system/domain/services/AuditFilter.js +5 -0
- package/scripts/hooks-system/domain/services/AuditResultSerializer.js +5 -0
- package/scripts/hooks-system/domain/services/AuditScorer.js +6 -0
- package/scripts/hooks-system/infrastructure/adapters/AstAnalyzerAdapter.js +3 -0
- package/scripts/hooks-system/infrastructure/adapters/FileEvidenceAdapter.js +2 -0
- package/scripts/hooks-system/infrastructure/adapters/GitCliAdapter.js +4 -0
- package/scripts/hooks-system/infrastructure/adapters/GitCommandAdapter.js +4 -0
- package/scripts/hooks-system/infrastructure/adapters/GitHubCliAdapter.js +2 -0
- package/scripts/hooks-system/infrastructure/adapters/GitQueryAdapter.js +4 -0
- package/scripts/hooks-system/infrastructure/adapters/LegacyAnalyzerAdapter.js +2 -0
- package/scripts/hooks-system/infrastructure/adapters/MacOSNotificationAdapter.js +4 -0
- package/scripts/hooks-system/infrastructure/adapters/git/GitCommandRunner.js +2 -0
- package/scripts/hooks-system/infrastructure/adapters/git/GitCommandService.js +3 -0
- package/scripts/hooks-system/infrastructure/adapters/git/GitQueryService.js +3 -0
- package/scripts/hooks-system/infrastructure/ast/android/analyzers/AndroidASTIntelligentAnalyzer.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/android/analyzers/AndroidASTParser.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/android/analyzers/AndroidAnalysisOrchestrator.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/android/analyzers/AndroidArchitectureDetector.js +7 -5
- package/scripts/hooks-system/infrastructure/ast/android/analyzers/AndroidClassAnalyzer.js +3 -0
- package/scripts/hooks-system/infrastructure/ast/android/analyzers/AndroidForbiddenLiteralsAnalyzer.js +1 -0
- package/scripts/hooks-system/infrastructure/ast/android/analyzers/AndroidSOLIDAnalyzer.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/archive/ios-rules.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/archive/kotlin-analyzer.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/archive/kotlin-parser.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/archive/swift-analyzer.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/backend/analyzers/BackendArchitectureDetector.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/backend/analyzers/BackendPatternDetector.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/common/BDDTDDWorkflowRules.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/common/rules/BDDRules.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/common/rules/ImplementationRules.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/common/rules/TDDRules.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/common/rules/WorkflowRules.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/frontend/analyzers/FrontendArchitectureDetector.js +16 -14
- package/scripts/hooks-system/infrastructure/ast/frontend/analyzers/FrontendForbiddenLiteralsAnalyzer.js +5 -0
- package/scripts/hooks-system/infrastructure/ast/frontend/analyzers/FrontendSOLIDAnalyzer.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSASTIntelligentAnalyzer.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSArchitectureDetector.js +12 -10
- package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSArchitectureRules.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSCICDRules.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSEnterpriseAnalyzer.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSForbiddenLiteralsAnalyzer.js +1 -0
- package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSNetworkingAdvancedRules.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSPerformanceRules.js +3 -0
- package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSSPMRules.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSSwiftUIAdvancedRules.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSTestingAdvancedRules.js +2 -0
- package/scripts/hooks-system/infrastructure/ast/ios/native-bridge.js +1 -0
- package/scripts/hooks-system/infrastructure/ast/ios/parsers/SourceKittenParser.js +2 -0
- package/scripts/hooks-system/infrastructure/cli/install-wizard.js +1 -0
- package/scripts/hooks-system/infrastructure/mcp/ast-intelligence-automation.js +96 -41
- package/scripts/hooks-system/infrastructure/mcp/evidence-watcher.js +1 -0
- package/scripts/hooks-system/infrastructure/mcp/services/EvidenceService.js +4 -0
- package/scripts/hooks-system/infrastructure/mcp/services/McpProtocolHandler.js +2 -0
- package/scripts/hooks-system/infrastructure/orchestration/intelligent-audit.js +1 -1
- package/scripts/hooks-system/infrastructure/reporting/report-generator.js +2 -0
- package/scripts/hooks-system/infrastructure/repositories/CursorTokenRepository.js +4 -0
- package/scripts/hooks-system/infrastructure/repositories/FileFindingsRepository.js +2 -0
- package/scripts/hooks-system/infrastructure/repositories/datasources/CursorApiDataSource.js +4 -0
- package/scripts/hooks-system/infrastructure/repositories/datasources/CursorFileDataSource.js +2 -0
- package/scripts/hooks-system/infrastructure/severity/policies/gate-policies.js +1 -0
- package/scripts/hooks-system/infrastructure/severity/severity-evaluator.js +2 -0
- package/scripts/hooks-system/infrastructure/telemetry/TelemetryService.js +2 -0
- package/scripts/hooks-system/infrastructure/telemetry/metrics-logger.js +2 -0
- package/scripts/hooks-system/infrastructure/utils/token-manager.js +2 -0
- package/scripts/hooks-system/infrastructure/validators/detect-commit-language.js +1 -0
- package/scripts/hooks-system/infrastructure/watchdog/auto-recovery.js +1 -0
- package/scripts/hooks-system/infrastructure/watchdog/health-check.js +1 -0
- package/scripts/hooks-system/infrastructure/watchdog/token-monitor.js +2 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
const env = require('../config/env');
|
|
3
4
|
const ContextDetectionEngine = require('../application/services/ContextDetectionEngine');
|
|
4
5
|
const AutonomousOrchestrator = require('../application/services/AutonomousOrchestrator');
|
|
5
6
|
const PlatformDetectionService = require('../application/services/PlatformDetectionService');
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
const { ValidationError } = require('../errors');
|
|
2
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
2
3
|
|
|
3
4
|
class AuditAnalyzer {
|
|
4
5
|
constructor(scorer) {
|
|
5
6
|
this.scorer = scorer;
|
|
7
|
+
this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
getViolationsBySeverity(findings) {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
const AuditResult = require('../entities/AuditResult');
|
|
2
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
2
3
|
|
|
3
4
|
class AuditFilter {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
|
|
7
|
+
}
|
|
8
|
+
|
|
4
9
|
filterByPlatform(findings, platform) {
|
|
5
10
|
return findings.filter(f => f.belongsToPlatform(platform));
|
|
6
11
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
const Finding = require('../entities/Finding');
|
|
2
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
2
3
|
|
|
3
4
|
class AuditResultSerializer {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
|
|
7
|
+
}
|
|
8
|
+
|
|
4
9
|
toJSON(auditResult) {
|
|
5
10
|
return {
|
|
6
11
|
timestamp: auditResult.timestamp.toISOString(),
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
2
|
+
|
|
1
3
|
class AuditScorer {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
|
|
6
|
+
}
|
|
7
|
+
|
|
2
8
|
calculateTechnicalDebt(findings) {
|
|
3
9
|
return findings.reduce((total, finding) => {
|
|
4
10
|
// Assuming finding.severity is an instance of Severity or finding has access to getDebtHours
|
|
@@ -4,12 +4,15 @@
|
|
|
4
4
|
* Infrastructure adapter implementing IAstPort.
|
|
5
5
|
* Wraps the existing AST intelligence modules.
|
|
6
6
|
*/
|
|
7
|
+
const env = require('../../config/env');
|
|
7
8
|
const path = require('path');
|
|
8
9
|
const fs = require('fs');
|
|
10
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
9
11
|
|
|
10
12
|
class AstAnalyzerAdapter {
|
|
11
13
|
constructor(config = {}) {
|
|
12
14
|
this.repoRoot = config.repoRoot || process.cwd();
|
|
15
|
+
this.auditLogger = new AuditLogger({ repoRoot: this.repoRoot });
|
|
13
16
|
this.astModulesPath = config.astModulesPath || path.join(__dirname, '../ast');
|
|
14
17
|
|
|
15
18
|
this.ignoredPatterns = [
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Infrastructure adapter implementing IEvidencePort using file system.
|
|
5
5
|
*/
|
|
6
|
+
const env = require('../../config/env');
|
|
6
7
|
const fs = require('fs');
|
|
7
8
|
const path = require('path');
|
|
8
9
|
const { execSync } = require('child_process');
|
|
9
10
|
const { ConfigurationError } = require('../../domain/errors');
|
|
11
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
10
12
|
|
|
11
13
|
function resolveUpdateEvidenceScript(repoRoot) {
|
|
12
14
|
const candidates = [
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
const env = require('../../config/env');
|
|
2
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
3
|
+
|
|
1
4
|
const GitCommandRunner = require('./git/GitCommandRunner');
|
|
2
5
|
|
|
3
6
|
class GitCliAdapter {
|
|
4
7
|
constructor(config = {}) {
|
|
5
8
|
this.repoRoot = config.repoRoot || process.cwd();
|
|
6
9
|
this.logger = config.logger || console;
|
|
10
|
+
this.auditLogger = new AuditLogger({ repoRoot: this.repoRoot, logger: this.logger });
|
|
7
11
|
this.protectedBranches = config.protectedBranches || ['main', 'master', 'develop'];
|
|
8
12
|
this.runner = new GitCommandRunner(this.repoRoot, this.logger);
|
|
9
13
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
const env = require('../../config/env');
|
|
2
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
3
|
+
|
|
1
4
|
const IGitCommandPort = require('../../domain/ports/IGitCommandPort');
|
|
2
5
|
const GitCommandRunner = require('./git/GitCommandRunner');
|
|
3
6
|
const GitCommandService = require('./git/GitCommandService');
|
|
@@ -7,6 +10,7 @@ class GitCommandAdapter extends IGitCommandPort {
|
|
|
7
10
|
super();
|
|
8
11
|
this.repoRoot = config.repoRoot || process.cwd();
|
|
9
12
|
this.logger = config.logger || console;
|
|
13
|
+
this.auditLogger = new AuditLogger({ repoRoot: this.repoRoot, logger: this.logger });
|
|
10
14
|
|
|
11
15
|
this.runner = new GitCommandRunner(this.repoRoot, this.logger);
|
|
12
16
|
this.commandService = new GitCommandService(this.runner);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
const { execSync } = require('child_process');
|
|
2
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
2
3
|
|
|
3
4
|
class GitHubCliAdapter {
|
|
4
5
|
constructor(repoRoot, logger = console, options = {}) {
|
|
5
6
|
this.repoRoot = repoRoot;
|
|
6
7
|
this.logger = logger;
|
|
8
|
+
this.auditLogger = new AuditLogger({ repoRoot, logger });
|
|
7
9
|
this.options = {
|
|
8
10
|
timeout: options.timeout || 30000,
|
|
9
11
|
maxRetries: options.maxRetries || 3,
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
const env = require('../../config/env');
|
|
2
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
3
|
+
|
|
1
4
|
const IGitQueryPort = require('../../domain/ports/IGitQueryPort');
|
|
2
5
|
const GitCommandRunner = require('./git/GitCommandRunner');
|
|
3
6
|
const GitQueryService = require('./git/GitQueryService');
|
|
@@ -7,6 +10,7 @@ class GitQueryAdapter extends IGitQueryPort {
|
|
|
7
10
|
super();
|
|
8
11
|
this.repoRoot = config.repoRoot || process.cwd();
|
|
9
12
|
this.logger = config.logger || console;
|
|
13
|
+
this.auditLogger = new AuditLogger({ repoRoot: this.repoRoot, logger: this.logger });
|
|
10
14
|
this.protectedBranches = config.protectedBranches || ['main', 'master', 'develop'];
|
|
11
15
|
|
|
12
16
|
this.runner = new GitCommandRunner(this.repoRoot, this.logger);
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
const Finding = require('../../domain/entities/Finding');
|
|
3
3
|
const { createProject, listSourceFiles } = require('../ast/ast-core');
|
|
4
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
4
5
|
|
|
5
6
|
class LegacyAnalyzerAdapter {
|
|
6
7
|
constructor(legacyAnalyzerFunction, platform) {
|
|
7
8
|
this.legacyAnalyzerFunction = legacyAnalyzerFunction;
|
|
8
9
|
this.platform = platform;
|
|
10
|
+
this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
async analyze(targetPath, options = {}) {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
const env = require('../../config/env');
|
|
2
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
3
|
+
|
|
1
4
|
const { execSync } = require('child_process');
|
|
2
5
|
const fs = require('fs');
|
|
3
6
|
|
|
@@ -6,6 +9,7 @@ class MacOSNotificationAdapter {
|
|
|
6
9
|
this.enabled = config.enabled !== false;
|
|
7
10
|
this.defaultSound = config.defaultSound || 'Hero';
|
|
8
11
|
this.defaultTitle = config.defaultTitle || 'Hook-System Guard';
|
|
12
|
+
this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
|
|
9
13
|
this.terminalNotifierPath = this.resolveTerminalNotifier();
|
|
10
14
|
this.osascriptPath = '/usr/bin/osascript';
|
|
11
15
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const { execSync } = require('child_process');
|
|
2
2
|
const { ConfigurationError } = require('../../../domain/errors');
|
|
3
|
+
const AuditLogger = require('../../../application/services/logging/AuditLogger');
|
|
3
4
|
|
|
4
5
|
class GitCommandRunner {
|
|
5
6
|
constructor(repoRoot, logger = console, options = {}) {
|
|
6
7
|
this.repoRoot = repoRoot;
|
|
7
8
|
this.logger = logger;
|
|
9
|
+
this.auditLogger = new AuditLogger({ repoRoot, logger });
|
|
8
10
|
this.options = {
|
|
9
11
|
timeout: options.timeout || 30000, // 30s default timeout
|
|
10
12
|
maxRetries: options.maxRetries || 3,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
const AuditLogger = require('../../../application/services/logging/AuditLogger');
|
|
2
|
+
|
|
1
3
|
class GitCommandService {
|
|
2
4
|
constructor(commandRunner) {
|
|
3
5
|
this.runner = commandRunner;
|
|
6
|
+
this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
|
|
4
7
|
}
|
|
5
8
|
|
|
6
9
|
createBranch(branchName) {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
const AuditLogger = require('../../../application/services/logging/AuditLogger');
|
|
2
|
+
|
|
1
3
|
class GitQueryService {
|
|
2
4
|
constructor(commandRunner) {
|
|
3
5
|
this.runner = commandRunner;
|
|
6
|
+
this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
|
|
4
7
|
}
|
|
5
8
|
|
|
6
9
|
getCurrentBranch() {
|
package/scripts/hooks-system/infrastructure/ast/android/analyzers/AndroidASTIntelligentAnalyzer.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
const { AndroidAnalysisOrchestrator } = require('./AndroidAnalysisOrchestrator');
|
|
3
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
3
4
|
|
|
4
5
|
class AndroidASTIntelligentAnalyzer {
|
|
5
6
|
constructor(findings) {
|
|
6
7
|
this.findings = findings;
|
|
8
|
+
this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
|
|
7
9
|
this.orchestrator = new AndroidAnalysisOrchestrator(findings);
|
|
8
10
|
}
|
|
9
11
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
2
3
|
|
|
3
4
|
class AndroidASTParser {
|
|
4
5
|
constructor(filePath) {
|
|
5
6
|
this.filePath = filePath;
|
|
7
|
+
this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
|
|
6
8
|
this.content = '';
|
|
7
9
|
this.lines = [];
|
|
8
10
|
this.imports = [];
|
package/scripts/hooks-system/infrastructure/ast/android/analyzers/AndroidAnalysisOrchestrator.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const { AndroidASTParser } = require('./AndroidASTParser');
|
|
2
2
|
const { AndroidClassAnalyzer } = require('./AndroidClassAnalyzer');
|
|
3
3
|
const fs = require('fs');
|
|
4
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
4
5
|
|
|
5
6
|
class AndroidAnalysisOrchestrator {
|
|
6
7
|
constructor(findings) {
|
|
7
8
|
this.findings = findings;
|
|
9
|
+
this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
|
|
8
10
|
this.godClassCandidates = [];
|
|
9
11
|
this.godClassBaseline = null;
|
|
10
12
|
}
|
package/scripts/hooks-system/infrastructure/ast/android/analyzers/AndroidArchitectureDetector.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const glob = require('glob');
|
|
4
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
4
5
|
|
|
5
6
|
class AndroidArchitectureDetector {
|
|
6
7
|
constructor(projectRoot) {
|
|
7
8
|
this.projectRoot = projectRoot;
|
|
9
|
+
this.auditLogger = new AuditLogger({ repoRoot: projectRoot });
|
|
8
10
|
this.patterns = {
|
|
9
11
|
featureFirstClean: 0, // Feature-First + DDD + Clean Architecture
|
|
10
12
|
mvvm: 0,
|
|
@@ -230,10 +232,10 @@ class AndroidArchitectureDetector {
|
|
|
230
232
|
this.patterns.cleanArchitecture += 10;
|
|
231
233
|
}
|
|
232
234
|
|
|
233
|
-
const domainRepos = files.filter(f =>
|
|
235
|
+
const domainRepos = files.filter(f =>
|
|
234
236
|
f.includes('/domain/') && f.includes('Repository') && fs.readFileSync(path.join(this.projectRoot, f), 'utf-8').includes('interface ')
|
|
235
237
|
);
|
|
236
|
-
const dataRepos = files.filter(f =>
|
|
238
|
+
const dataRepos = files.filter(f =>
|
|
237
239
|
f.includes('/data/') && f.includes('Repository') && fs.readFileSync(path.join(this.projectRoot, f), 'utf-8').includes('class ')
|
|
238
240
|
);
|
|
239
241
|
|
|
@@ -253,14 +255,14 @@ class AndroidArchitectureDetector {
|
|
|
253
255
|
detectMVC(files) {
|
|
254
256
|
files.forEach(file => {
|
|
255
257
|
const content = this.readFile(file);
|
|
256
|
-
|
|
258
|
+
|
|
257
259
|
if ((file.includes('Activity.kt') || file.includes('Fragment.kt')) &&
|
|
258
|
-
|
|
260
|
+
(content.includes('RoomDatabase') || content.includes('SQLiteDatabase'))) {
|
|
259
261
|
this.patterns.mvc += 3;
|
|
260
262
|
}
|
|
261
263
|
|
|
262
264
|
if ((file.includes('Activity.kt') || file.includes('Fragment.kt')) &&
|
|
263
|
-
|
|
265
|
+
content.match(/fun\s+(calculate|process|validate|transform)/)) {
|
|
264
266
|
this.patterns.mvc += 2;
|
|
265
267
|
}
|
|
266
268
|
});
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
2
|
+
|
|
1
3
|
class AndroidClassAnalyzer {
|
|
2
4
|
constructor(parser, findings, godClassBaseline = null) {
|
|
3
5
|
this.parser = parser;
|
|
4
6
|
this.findings = findings;
|
|
7
|
+
this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
|
|
5
8
|
this.godClassBaseline = godClassBaseline;
|
|
6
9
|
}
|
|
7
10
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const { pushFinding, SyntaxKind } = require(path.join(__dirname, '../../ast-core'));
|
|
4
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* AndroidSOLIDAnalyzer
|
|
@@ -12,6 +13,7 @@ const { pushFinding, SyntaxKind } = require(path.join(__dirname, '../../ast-core
|
|
|
12
13
|
class AndroidSOLIDAnalyzer {
|
|
13
14
|
constructor() {
|
|
14
15
|
this.findings = [];
|
|
16
|
+
this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
/**
|
|
@@ -8,10 +8,12 @@
|
|
|
8
8
|
const SwiftParser = require('./swift-parser');
|
|
9
9
|
const fs = require('fs');
|
|
10
10
|
const path = require('path');
|
|
11
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
11
12
|
|
|
12
13
|
class iOSRules {
|
|
13
14
|
constructor() {
|
|
14
15
|
this.parser = null;
|
|
16
|
+
this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
|
|
15
17
|
try {
|
|
16
18
|
this.parser = new SwiftParser();
|
|
17
19
|
} catch (error) {
|
|
@@ -8,10 +8,12 @@
|
|
|
8
8
|
const { execSync } = require('child_process');
|
|
9
9
|
const fs = require('fs');
|
|
10
10
|
const path = require('path');
|
|
11
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
11
12
|
|
|
12
13
|
class KotlinAnalyzer {
|
|
13
14
|
constructor() {
|
|
14
15
|
this.findings = [];
|
|
16
|
+
this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
/**
|
|
@@ -10,9 +10,11 @@ const fs = require('fs');
|
|
|
10
10
|
const path = require('path');
|
|
11
11
|
const xml2js = require('xml2js');
|
|
12
12
|
const { ConfigurationError } = require('../../../domain/errors');
|
|
13
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
13
14
|
|
|
14
15
|
class KotlinParser {
|
|
15
16
|
constructor() {
|
|
17
|
+
this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
|
|
16
18
|
this.detektPath = '/opt/homebrew/bin/detekt';
|
|
17
19
|
this.checkAvailability();
|
|
18
20
|
}
|
|
@@ -8,10 +8,12 @@
|
|
|
8
8
|
const { execSync } = require('child_process');
|
|
9
9
|
const fs = require('fs');
|
|
10
10
|
const path = require('path');
|
|
11
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
11
12
|
|
|
12
13
|
class SwiftAnalyzer {
|
|
13
14
|
constructor() {
|
|
14
15
|
this.findings = [];
|
|
16
|
+
this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
/**
|
package/scripts/hooks-system/infrastructure/ast/backend/analyzers/BackendArchitectureDetector.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const glob = require('glob');
|
|
4
|
+
const AuditLogger = require('../../../application/services/logging/AuditLogger');
|
|
4
5
|
|
|
5
6
|
const { FeatureFirstCleanDetector } = require('./detectors/FeatureFirstCleanDetector');
|
|
6
7
|
const { CleanArchitectureDetector } = require('./detectors/CleanArchitectureDetector');
|
|
@@ -12,6 +13,7 @@ const { MVCDetector } = require('./detectors/MVCDetector');
|
|
|
12
13
|
class BackendArchitectureDetector {
|
|
13
14
|
constructor(projectRoot) {
|
|
14
15
|
this.projectRoot = projectRoot;
|
|
16
|
+
this.auditLogger = new AuditLogger({ repoRoot: projectRoot });
|
|
15
17
|
this.patterns = {
|
|
16
18
|
featureFirstClean: 0,
|
|
17
19
|
cleanArchitecture: 0,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const env = require('../../../../config/env');
|
|
4
|
+
const AuditLogger = require('../../../../application/services/logging/AuditLogger');
|
|
4
5
|
|
|
5
6
|
class BackendPatternDetector {
|
|
6
7
|
constructor(projectRoot) {
|
|
7
8
|
this.projectRoot = projectRoot;
|
|
9
|
+
this.auditLogger = new AuditLogger({ repoRoot: projectRoot });
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
readFile(relativePath) {
|
|
@@ -2,6 +2,7 @@ const BDDRules = require('./rules/BDDRules');
|
|
|
2
2
|
const TDDRules = require('./rules/TDDRules');
|
|
3
3
|
const ImplementationRules = require('./rules/ImplementationRules');
|
|
4
4
|
const WorkflowRules = require('./rules/WorkflowRules');
|
|
5
|
+
const AuditLogger = require('../../../application/services/logging/AuditLogger');
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* BDDTDDWorkflowRules
|
|
@@ -13,6 +14,7 @@ class BDDTDDWorkflowRules {
|
|
|
13
14
|
constructor(findings, projectRoot) {
|
|
14
15
|
this.findings = findings;
|
|
15
16
|
this.projectRoot = projectRoot;
|
|
17
|
+
this.auditLogger = new AuditLogger({ repoRoot: projectRoot });
|
|
16
18
|
|
|
17
19
|
this.bddRules = new BDDRules(projectRoot);
|
|
18
20
|
this.tddRules = new TDDRules(projectRoot);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const glob = require('glob');
|
|
3
3
|
const { pushFileFinding } = require('../../ast-core');
|
|
4
|
+
const AuditLogger = require('../../../application/services/logging/AuditLogger');
|
|
4
5
|
|
|
5
6
|
class BDDRules {
|
|
6
7
|
constructor(projectRoot) {
|
|
7
8
|
this.projectRoot = projectRoot;
|
|
9
|
+
this.auditLogger = new AuditLogger({ repoRoot: projectRoot });
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
analyze(findings) {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const glob = require('glob');
|
|
3
3
|
const { pushFileFinding } = require('../../ast-core');
|
|
4
|
+
const AuditLogger = require('../../../application/services/logging/AuditLogger');
|
|
4
5
|
|
|
5
6
|
class ImplementationRules {
|
|
6
7
|
constructor(projectRoot) {
|
|
7
8
|
this.projectRoot = projectRoot;
|
|
9
|
+
this.auditLogger = new AuditLogger({ repoRoot: projectRoot });
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
analyze(findings) {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const glob = require('glob');
|
|
3
3
|
const { pushFileFinding } = require('../../ast-core');
|
|
4
|
+
const AuditLogger = require('../../../application/services/logging/AuditLogger');
|
|
4
5
|
|
|
5
6
|
class TDDRules {
|
|
6
7
|
constructor(projectRoot) {
|
|
7
8
|
this.projectRoot = projectRoot;
|
|
9
|
+
this.auditLogger = new AuditLogger({ repoRoot: projectRoot });
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
analyze(findings) {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const glob = require('glob');
|
|
3
3
|
const { pushFileFinding } = require('../../ast-core');
|
|
4
|
+
const AuditLogger = require('../../../application/services/logging/AuditLogger');
|
|
4
5
|
|
|
5
6
|
class WorkflowRules {
|
|
6
7
|
constructor(projectRoot) {
|
|
7
8
|
this.projectRoot = projectRoot;
|
|
9
|
+
this.auditLogger = new AuditLogger({ repoRoot: projectRoot });
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
analyze(findings) {
|
package/scripts/hooks-system/infrastructure/ast/frontend/analyzers/FrontendArchitectureDetector.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const glob = require('glob');
|
|
4
|
+
const AuditLogger = require('../../../application/services/logging/AuditLogger');
|
|
4
5
|
|
|
5
6
|
class FrontendArchitectureDetector {
|
|
6
7
|
constructor(projectRoot) {
|
|
7
8
|
this.projectRoot = projectRoot;
|
|
9
|
+
this.auditLogger = new AuditLogger({ repoRoot: projectRoot });
|
|
8
10
|
this.patterns = {
|
|
9
11
|
featureFirstClean: 0, // Feature-First + DDD + Clean Architecture
|
|
10
12
|
componentBased: 0, // Component-Based Architecture
|
|
@@ -128,7 +130,7 @@ class FrontendArchitectureDetector {
|
|
|
128
130
|
|
|
129
131
|
detectComponentBased(files) {
|
|
130
132
|
const hasComponentsFolder = files.some(f => f.includes('/components/'));
|
|
131
|
-
|
|
133
|
+
|
|
132
134
|
if (hasComponentsFolder) {
|
|
133
135
|
this.patterns.componentBased += 10;
|
|
134
136
|
}
|
|
@@ -143,10 +145,10 @@ class FrontendArchitectureDetector {
|
|
|
143
145
|
|
|
144
146
|
files.forEach(file => {
|
|
145
147
|
if (!file.includes('/components/')) return;
|
|
146
|
-
|
|
148
|
+
|
|
147
149
|
const content = this.readFile(file);
|
|
148
150
|
const componentImports = content.match(/from\s+['"]\.\.\/components\//g) || [];
|
|
149
|
-
|
|
151
|
+
|
|
150
152
|
if (componentImports.length > 0) {
|
|
151
153
|
this.patterns.componentBased += componentImports.length;
|
|
152
154
|
}
|
|
@@ -155,7 +157,7 @@ class FrontendArchitectureDetector {
|
|
|
155
157
|
|
|
156
158
|
detectAtomicDesign(files) {
|
|
157
159
|
const atomicFolders = ['atoms', 'molecules', 'organisms', 'templates', 'pages'];
|
|
158
|
-
|
|
160
|
+
|
|
159
161
|
const foundFolders = atomicFolders.filter(folder => {
|
|
160
162
|
return files.some(f => f.includes(`/${folder}/`));
|
|
161
163
|
});
|
|
@@ -164,9 +166,9 @@ class FrontendArchitectureDetector {
|
|
|
164
166
|
this.patterns.atomicDesign += foundFolders.length * 5;
|
|
165
167
|
}
|
|
166
168
|
|
|
167
|
-
if (files.some(f => f.includes('/atoms/')) &&
|
|
168
|
-
|
|
169
|
-
|
|
169
|
+
if (files.some(f => f.includes('/atoms/')) &&
|
|
170
|
+
files.some(f => f.includes('/molecules/')) &&
|
|
171
|
+
files.some(f => f.includes('/organisms/'))) {
|
|
170
172
|
this.patterns.atomicDesign += 10;
|
|
171
173
|
}
|
|
172
174
|
}
|
|
@@ -179,8 +181,8 @@ class FrontendArchitectureDetector {
|
|
|
179
181
|
this.patterns.stateManagement += 5;
|
|
180
182
|
}
|
|
181
183
|
|
|
182
|
-
if (content.includes('redux') || content.includes('@reduxjs/toolkit') ||
|
|
183
|
-
|
|
184
|
+
if (content.includes('redux') || content.includes('@reduxjs/toolkit') ||
|
|
185
|
+
file.includes('slice') || file.includes('reducer')) {
|
|
184
186
|
this.patterns.stateManagement += 5;
|
|
185
187
|
}
|
|
186
188
|
|
|
@@ -197,17 +199,17 @@ class FrontendArchitectureDetector {
|
|
|
197
199
|
detectMVC(files) {
|
|
198
200
|
files.forEach(file => {
|
|
199
201
|
if (!file.includes('component') && !file.endsWith('.tsx') && !file.endsWith('.jsx')) return;
|
|
200
|
-
|
|
202
|
+
|
|
201
203
|
const content = this.readFile(file);
|
|
202
|
-
|
|
204
|
+
|
|
203
205
|
if (content.includes('fetch(') || content.includes('axios.') || content.includes('.get(')) {
|
|
204
|
-
const hasHook = files.some(f =>
|
|
206
|
+
const hasHook = files.some(f =>
|
|
205
207
|
f.includes('use') && f.endsWith('.ts') && !f.includes('component')
|
|
206
208
|
);
|
|
207
|
-
const hasService = files.some(f =>
|
|
209
|
+
const hasService = files.some(f =>
|
|
208
210
|
f.includes('service') || f.includes('api')
|
|
209
211
|
);
|
|
210
|
-
|
|
212
|
+
|
|
211
213
|
if (!hasHook && !hasService) {
|
|
212
214
|
this.patterns.mvc += 3;
|
|
213
215
|
}
|