pumuki-ast-hooks 5.3.19 → 5.3.20
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/docs/VIOLATIONS_RESOLUTION_PLAN.md +38 -34
- package/package.json +7 -1
- package/scripts/hooks-system/application/services/AutonomousOrchestrator.js +18 -0
- package/scripts/hooks-system/application/services/ContextDetectionEngine.js +58 -0
- package/scripts/hooks-system/application/services/DynamicRulesLoader.js +11 -0
- package/scripts/hooks-system/application/services/GitFlowService.js +80 -0
- package/scripts/hooks-system/application/services/GitTreeState.js +4 -0
- package/scripts/hooks-system/application/services/HookSystemScheduler.js +4 -0
- package/scripts/hooks-system/application/services/IntelligentCommitAnalyzer.js +25 -0
- package/scripts/hooks-system/application/services/IntelligentGitTreeMonitor.js +11 -0
- package/scripts/hooks-system/application/services/PlatformAnalysisService.js +19 -0
- package/scripts/hooks-system/application/services/PlatformDetectionService.js +19 -0
- package/scripts/hooks-system/application/services/PlaybookRunner.js +22 -1
- package/scripts/hooks-system/application/services/PredictiveHookAdvisor.js +19 -0
- package/scripts/hooks-system/application/services/RealtimeGuardPlugin.js +25 -0
- package/scripts/hooks-system/application/services/RealtimeGuardService.js +27 -0
- package/scripts/hooks-system/application/services/SmartDirtyTreeAnalyzer.js +11 -0
- package/scripts/hooks-system/application/services/commit/CommitMessageGenerator.js +11 -0
- package/scripts/hooks-system/application/services/commit/FeatureDetector.js +11 -0
- package/scripts/hooks-system/application/services/evidence/EvidenceContextManager.js +25 -0
- package/scripts/hooks-system/application/services/guard/GuardAutoManagerService.js +19 -0
- package/scripts/hooks-system/application/services/guard/GuardConfig.js +11 -0
- package/scripts/hooks-system/application/services/guard/GuardEventLogger.js +11 -0
- package/scripts/hooks-system/application/services/guard/GuardHealthReminder.js +26 -0
- package/scripts/hooks-system/application/services/guard/GuardHeartbeatMonitor.js +11 -0
- package/scripts/hooks-system/application/services/guard/GuardLockManager.js +11 -0
- package/scripts/hooks-system/application/services/guard/GuardMonitorLoop.js +25 -0
- package/scripts/hooks-system/application/services/guard/GuardNotificationHandler.js +11 -0
- package/scripts/hooks-system/application/services/guard/GuardProcessManager.js +11 -0
- package/scripts/hooks-system/application/services/guard/GuardRecoveryService.js +11 -0
- package/scripts/hooks-system/application/services/installation/ConfigurationGeneratorService.js +18 -0
- package/scripts/hooks-system/application/services/installation/FileSystemInstallerService.js +18 -0
- package/scripts/hooks-system/application/services/installation/GitEnvironmentService.js +18 -0
- package/scripts/hooks-system/application/services/installation/HookInstaller.js +19 -0
- package/scripts/hooks-system/application/services/installation/IdeIntegrationService.js +11 -0
- package/scripts/hooks-system/application/services/installation/InstallService.js +25 -1
- package/scripts/hooks-system/application/services/installation/McpConfigurator.js +18 -0
- package/scripts/hooks-system/application/services/installation/PlatformDetectorService.js +11 -0
- package/scripts/hooks-system/application/services/installation/VSCodeTaskConfigurator.js +11 -0
- package/scripts/hooks-system/application/services/logging/AuditLogger.js +4 -0
- package/scripts/hooks-system/application/services/logging/UnifiedLogger.js +11 -0
- package/scripts/hooks-system/application/services/monitoring/ActivityMonitor.js +33 -0
- package/scripts/hooks-system/application/services/monitoring/AstMonitor.js +27 -0
- package/scripts/hooks-system/application/services/monitoring/DevDocsMonitor.js +26 -0
- package/scripts/hooks-system/application/services/monitoring/EvidenceMonitor.js +18 -0
- package/scripts/hooks-system/application/services/monitoring/EvidenceMonitorService.js +25 -0
- package/scripts/hooks-system/application/services/monitoring/GitTreeMonitor.js +28 -0
- package/scripts/hooks-system/application/services/monitoring/GitTreeMonitorService.js +26 -0
- package/scripts/hooks-system/application/services/monitoring/HealthCheckProviders.js +4 -0
- package/scripts/hooks-system/application/services/monitoring/HealthCheckService.js +25 -0
- package/scripts/hooks-system/application/services/monitoring/HeartbeatMonitorService.js +26 -0
- package/scripts/hooks-system/application/services/monitoring/TokenMonitor.js +26 -0
- package/scripts/hooks-system/application/services/notification/MacNotificationSender.js +11 -0
- package/scripts/hooks-system/application/services/notification/NotificationCenterService.js +18 -0
- package/scripts/hooks-system/application/services/notification/NotificationDispatcher.js +11 -0
- package/scripts/hooks-system/application/services/notification/components/NotificationCooldownManager.js +18 -0
- package/scripts/hooks-system/application/services/notification/components/NotificationDeduplicator.js +18 -0
- package/scripts/hooks-system/application/services/notification/components/NotificationQueue.js +11 -0
- package/scripts/hooks-system/application/services/notification/components/NotificationRetryExecutor.js +20 -0
- package/scripts/hooks-system/application/services/platform/PlatformHeuristics.js +19 -0
- package/scripts/hooks-system/application/services/recovery/AutoRecoveryManager.js +19 -0
- package/scripts/hooks-system/application/services/smart-commit/CommitMessageSuggester.js +11 -0
- package/scripts/hooks-system/application/services/smart-commit/FileContextGrouper.js +19 -0
- package/scripts/hooks-system/application/services/smart-commit/SmartCommitSummaryBuilder.js +4 -0
- package/scripts/hooks-system/application/services/token/CursorTokenService.js +20 -0
- package/scripts/hooks-system/application/services/token/TokenMetricsService.js +11 -0
- package/scripts/hooks-system/application/services/token/TokenMonitorService.js +19 -0
- package/scripts/hooks-system/application/services/token/TokenStatusReporter.js +12 -0
- package/scripts/hooks-system/config/project.config.json +1 -1
- package/scripts/hooks-system/domain/events/index.js +25 -6
- package/scripts/hooks-system/domain/exceptions/index.js +87 -0
- package/scripts/hooks-system/infrastructure/ast/backend/ast-backend.js +7 -9
- package/scripts/hooks-system/infrastructure/config/config.js +5 -0
- package/scripts/hooks-system/infrastructure/shell/orchestrators/audit-orchestrator.sh +54 -92
- package/scripts/hooks-system/infrastructure/telemetry/metric-scope.js +98 -0
|
@@ -1,9 +1,20 @@
|
|
|
1
|
+
const {
|
|
2
|
+
createMetricScope: createMetricScope
|
|
3
|
+
} = require('../../../infrastructure/telemetry/metric-scope');
|
|
4
|
+
|
|
1
5
|
class GuardNotificationHandler {
|
|
2
6
|
constructor(notificationCenter, eventLogger, config) {
|
|
7
|
+
const m_constructor = createMetricScope({
|
|
8
|
+
hook: 'guard_notification_handler',
|
|
9
|
+
operation: 'constructor'
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
m_constructor.started();
|
|
3
13
|
this.notificationCenter = notificationCenter;
|
|
4
14
|
this.eventLogger = eventLogger;
|
|
5
15
|
this.config = config;
|
|
6
16
|
this.lastNotificationState = { reason: null, at: 0 };
|
|
17
|
+
m_constructor.success();
|
|
7
18
|
}
|
|
8
19
|
|
|
9
20
|
notify(message, level = 'info', options = {}) {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const { spawnSync } = require('child_process');
|
|
3
3
|
|
|
4
|
+
const {
|
|
5
|
+
createMetricScope: createMetricScope
|
|
6
|
+
} = require('../../../infrastructure/telemetry/metric-scope');
|
|
7
|
+
|
|
4
8
|
class GuardProcessManager {
|
|
5
9
|
constructor({
|
|
6
10
|
repoRoot = process.cwd(),
|
|
@@ -8,6 +12,12 @@ class GuardProcessManager {
|
|
|
8
12
|
fsModule = require('fs'),
|
|
9
13
|
childProcess = { spawnSync }
|
|
10
14
|
} = {}) {
|
|
15
|
+
const m_constructor = createMetricScope({
|
|
16
|
+
hook: 'guard_process_manager',
|
|
17
|
+
operation: 'constructor'
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
m_constructor.started();
|
|
11
21
|
this.repoRoot = repoRoot;
|
|
12
22
|
this.logger = logger;
|
|
13
23
|
this.fs = fsModule;
|
|
@@ -15,6 +25,7 @@ class GuardProcessManager {
|
|
|
15
25
|
|
|
16
26
|
this.supervisorPidFile = path.join(this.repoRoot, '.guard-supervisor.pid');
|
|
17
27
|
this.startScript = path.join(this.repoRoot, 'bin', 'start-guards.sh');
|
|
28
|
+
m_constructor.success();
|
|
18
29
|
}
|
|
19
30
|
|
|
20
31
|
isSupervisorRunning() {
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
const {
|
|
2
|
+
createMetricScope: createMetricScope
|
|
3
|
+
} = require('../../../infrastructure/telemetry/metric-scope');
|
|
4
|
+
|
|
1
5
|
class GuardRecoveryService {
|
|
2
6
|
constructor({
|
|
3
7
|
repoRoot,
|
|
@@ -6,12 +10,19 @@ class GuardRecoveryService {
|
|
|
6
10
|
notificationHandler,
|
|
7
11
|
restartCooldownMs = 2000
|
|
8
12
|
}) {
|
|
13
|
+
const m_constructor = createMetricScope({
|
|
14
|
+
hook: 'guard_recovery_service',
|
|
15
|
+
operation: 'constructor'
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
m_constructor.started();
|
|
9
19
|
this.repoRoot = repoRoot;
|
|
10
20
|
this.logger = logger;
|
|
11
21
|
this.startScript = startScript;
|
|
12
22
|
this.notificationHandler = notificationHandler;
|
|
13
23
|
this.restartCooldownMs = restartCooldownMs;
|
|
14
24
|
this.lastEnsure = 0;
|
|
25
|
+
m_constructor.success();
|
|
15
26
|
}
|
|
16
27
|
|
|
17
28
|
ensureSupervisor(reason, eventLogger) {
|
package/scripts/hooks-system/application/services/installation/ConfigurationGeneratorService.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
|
+
const {
|
|
5
|
+
createMetricScope: createMetricScope
|
|
6
|
+
} = require('../../../infrastructure/telemetry/metric-scope');
|
|
7
|
+
|
|
4
8
|
const COLORS = {
|
|
5
9
|
reset: '\x1b[0m',
|
|
6
10
|
green: '\x1b[32m',
|
|
@@ -10,11 +14,24 @@ const COLORS = {
|
|
|
10
14
|
|
|
11
15
|
class ConfigurationGeneratorService {
|
|
12
16
|
constructor(targetRoot, hookSystemRoot) {
|
|
17
|
+
const m_constructor = createMetricScope({
|
|
18
|
+
hook: 'configuration_generator_service',
|
|
19
|
+
operation: 'constructor'
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
m_constructor.started();
|
|
13
23
|
this.targetRoot = targetRoot || process.cwd();
|
|
14
24
|
this.hookSystemRoot = hookSystemRoot;
|
|
25
|
+
m_constructor.success();
|
|
15
26
|
}
|
|
16
27
|
|
|
17
28
|
createProjectConfig(platforms) {
|
|
29
|
+
const m_create_project_config = createMetricScope({
|
|
30
|
+
hook: 'configuration_generator_service',
|
|
31
|
+
operation: 'create_project_config'
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
m_create_project_config.started();
|
|
18
35
|
const config = {
|
|
19
36
|
version: '3.1.0',
|
|
20
37
|
project: {
|
|
@@ -73,6 +90,7 @@ class ConfigurationGeneratorService {
|
|
|
73
90
|
|
|
74
91
|
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
75
92
|
this.logSuccess('Configuration created');
|
|
93
|
+
m_create_project_config.success();
|
|
76
94
|
}
|
|
77
95
|
|
|
78
96
|
installESLintConfigs() {
|
package/scripts/hooks-system/application/services/installation/FileSystemInstallerService.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
|
+
const {
|
|
5
|
+
createMetricScope: createMetricScope
|
|
6
|
+
} = require('../../../infrastructure/telemetry/metric-scope');
|
|
7
|
+
|
|
4
8
|
const COLORS = {
|
|
5
9
|
reset: '\x1b[0m',
|
|
6
10
|
green: '\x1b[32m',
|
|
@@ -9,12 +13,25 @@ const COLORS = {
|
|
|
9
13
|
|
|
10
14
|
class FileSystemInstallerService {
|
|
11
15
|
constructor(targetRoot, hookSystemRoot, logger = null) {
|
|
16
|
+
const m_constructor = createMetricScope({
|
|
17
|
+
hook: 'file_system_installer_service',
|
|
18
|
+
operation: 'constructor'
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
m_constructor.started();
|
|
12
22
|
this.targetRoot = targetRoot || process.cwd();
|
|
13
23
|
this.hookSystemRoot = hookSystemRoot;
|
|
14
24
|
this.logger = logger;
|
|
25
|
+
m_constructor.success();
|
|
15
26
|
}
|
|
16
27
|
|
|
17
28
|
createDirectoryStructure() {
|
|
29
|
+
const m_create_directory_structure = createMetricScope({
|
|
30
|
+
hook: 'file_system_installer_service',
|
|
31
|
+
operation: 'create_directory_structure'
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
m_create_directory_structure.started();
|
|
18
35
|
const dirs = [
|
|
19
36
|
'scripts/hooks-system',
|
|
20
37
|
'scripts/hooks-system/docs',
|
|
@@ -29,6 +46,7 @@ class FileSystemInstallerService {
|
|
|
29
46
|
}
|
|
30
47
|
});
|
|
31
48
|
this.logSuccess('Directory structure created');
|
|
49
|
+
m_create_directory_structure.success();
|
|
32
50
|
}
|
|
33
51
|
|
|
34
52
|
copySystemFiles() {
|
|
@@ -2,6 +2,10 @@ const fs = require('fs');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const { execSync, spawnSync } = require('child_process');
|
|
4
4
|
|
|
5
|
+
const {
|
|
6
|
+
createMetricScope: createMetricScope
|
|
7
|
+
} = require('../../../infrastructure/telemetry/metric-scope');
|
|
8
|
+
|
|
5
9
|
const COLORS = {
|
|
6
10
|
reset: '\x1b[0m',
|
|
7
11
|
blue: '\x1b[34m',
|
|
@@ -13,8 +17,15 @@ const COLORS = {
|
|
|
13
17
|
|
|
14
18
|
class GitEnvironmentService {
|
|
15
19
|
constructor(targetRoot, version = 'unknown') {
|
|
20
|
+
const m_constructor = createMetricScope({
|
|
21
|
+
hook: 'git_environment_service',
|
|
22
|
+
operation: 'constructor'
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
m_constructor.started();
|
|
16
26
|
this.targetRoot = targetRoot || process.cwd();
|
|
17
27
|
this.version = version;
|
|
28
|
+
m_constructor.success();
|
|
18
29
|
}
|
|
19
30
|
|
|
20
31
|
checkGitRepository() {
|
|
@@ -88,6 +99,13 @@ class GitEnvironmentService {
|
|
|
88
99
|
}
|
|
89
100
|
|
|
90
101
|
getPreCommitHookContent() {
|
|
102
|
+
const m_get_pre_commit_hook_content = createMetricScope({
|
|
103
|
+
hook: 'git_environment_service',
|
|
104
|
+
operation: 'get_pre_commit_hook_content'
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
m_get_pre_commit_hook_content.started();
|
|
108
|
+
m_get_pre_commit_hook_content.success();
|
|
91
109
|
return `#!/bin/bash
|
|
92
110
|
# AST Intelligence Hooks - Pre-commit
|
|
93
111
|
# Auto-generated by pumuki-ast-hooks v${this.version}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
|
+
const {
|
|
5
|
+
createMetricScope: createMetricScope
|
|
6
|
+
} = require('../../../infrastructure/telemetry/metric-scope');
|
|
7
|
+
|
|
4
8
|
class HookInstaller {
|
|
5
9
|
constructor(targetRoot, hookSystemRoot, logger = null) {
|
|
10
|
+
const m_constructor = createMetricScope({
|
|
11
|
+
hook: 'hook_installer',
|
|
12
|
+
operation: 'constructor'
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
m_constructor.started();
|
|
6
16
|
this.targetRoot = targetRoot;
|
|
7
17
|
this.hookSystemRoot = hookSystemRoot;
|
|
8
18
|
this.logger = logger;
|
|
@@ -12,6 +22,7 @@ class HookInstaller {
|
|
|
12
22
|
yellow: '\x1b[33m',
|
|
13
23
|
cyan: '\x1b[36m'
|
|
14
24
|
};
|
|
25
|
+
m_constructor.success();
|
|
15
26
|
}
|
|
16
27
|
|
|
17
28
|
install(platforms) {
|
|
@@ -128,6 +139,12 @@ class HookInstaller {
|
|
|
128
139
|
}
|
|
129
140
|
|
|
130
141
|
getRelevantSkills(platforms) {
|
|
142
|
+
const m_get_relevant_skills = createMetricScope({
|
|
143
|
+
hook: 'hook_installer',
|
|
144
|
+
operation: 'get_relevant_skills'
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
m_get_relevant_skills.started();
|
|
131
148
|
const allSkills = ['backend-guidelines', 'frontend-guidelines', 'ios-guidelines', 'android-guidelines'];
|
|
132
149
|
const relevantSkills = [];
|
|
133
150
|
|
|
@@ -136,6 +153,8 @@ class HookInstaller {
|
|
|
136
153
|
if (platforms.includes('ios')) relevantSkills.push('ios-guidelines');
|
|
137
154
|
if (platforms.includes('android')) relevantSkills.push('android-guidelines');
|
|
138
155
|
|
|
156
|
+
m_get_relevant_skills.success();
|
|
157
|
+
|
|
139
158
|
return relevantSkills.length > 0 ? relevantSkills : allSkills;
|
|
140
159
|
}
|
|
141
160
|
|
|
@@ -2,6 +2,10 @@ const McpConfigurator = require('./McpConfigurator');
|
|
|
2
2
|
const HookInstaller = require('./HookInstaller');
|
|
3
3
|
const VSCodeTaskConfigurator = require('./VSCodeTaskConfigurator');
|
|
4
4
|
|
|
5
|
+
const {
|
|
6
|
+
createMetricScope: createMetricScope
|
|
7
|
+
} = require('../../../infrastructure/telemetry/metric-scope');
|
|
8
|
+
|
|
5
9
|
const COLORS = {
|
|
6
10
|
reset: '\x1b[0m',
|
|
7
11
|
green: '\x1b[32m',
|
|
@@ -11,6 +15,12 @@ const COLORS = {
|
|
|
11
15
|
|
|
12
16
|
class IdeIntegrationService {
|
|
13
17
|
constructor(targetRoot, hookSystemRoot, logger = null) {
|
|
18
|
+
const m_constructor = createMetricScope({
|
|
19
|
+
hook: 'ide_integration_service',
|
|
20
|
+
operation: 'constructor'
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
m_constructor.started();
|
|
14
24
|
this.targetRoot = targetRoot || process.cwd();
|
|
15
25
|
this.hookSystemRoot = hookSystemRoot;
|
|
16
26
|
this.logger = logger;
|
|
@@ -18,6 +28,7 @@ class IdeIntegrationService {
|
|
|
18
28
|
this.mcpConfigurator = new McpConfigurator(this.targetRoot, this.hookSystemRoot, this.logger);
|
|
19
29
|
this.hookInstaller = new HookInstaller(this.targetRoot, this.hookSystemRoot, this.logger);
|
|
20
30
|
this.vscodeConfigurator = new VSCodeTaskConfigurator(this.targetRoot, this.logger);
|
|
31
|
+
m_constructor.success();
|
|
21
32
|
}
|
|
22
33
|
|
|
23
34
|
installCursorHooks(platforms) {
|
|
@@ -8,6 +8,10 @@ const ConfigurationGeneratorService = require('./ConfigurationGeneratorService')
|
|
|
8
8
|
const IdeIntegrationService = require('./IdeIntegrationService');
|
|
9
9
|
const UnifiedLogger = require('../logging/UnifiedLogger');
|
|
10
10
|
|
|
11
|
+
const {
|
|
12
|
+
createMetricScope: createMetricScope
|
|
13
|
+
} = require('../../../infrastructure/telemetry/metric-scope');
|
|
14
|
+
|
|
11
15
|
const COLORS = {
|
|
12
16
|
reset: '\x1b[0m',
|
|
13
17
|
blue: '\x1b[34m',
|
|
@@ -19,6 +23,12 @@ const COLORS = {
|
|
|
19
23
|
|
|
20
24
|
class InstallService {
|
|
21
25
|
constructor() {
|
|
26
|
+
const m_constructor = createMetricScope({
|
|
27
|
+
hook: 'install_service',
|
|
28
|
+
operation: 'constructor'
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
m_constructor.started();
|
|
22
32
|
this.targetRoot = process.cwd();
|
|
23
33
|
// Assuming this script is located at scripts/hooks-system/application/services/installation/InstallService.js
|
|
24
34
|
this.hookSystemRoot = path.resolve(__dirname, '../../../');
|
|
@@ -30,7 +40,13 @@ class InstallService {
|
|
|
30
40
|
path.resolve(this.hookSystemRoot, '../package.json'),
|
|
31
41
|
path.resolve(this.hookSystemRoot, '../../package.json'),
|
|
32
42
|
(() => {
|
|
33
|
-
try {
|
|
43
|
+
try {
|
|
44
|
+
m_constructor.success();
|
|
45
|
+
return require.resolve('pumuki-ast-hooks/package.json');
|
|
46
|
+
} catch {
|
|
47
|
+
m_constructor.success();
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
34
50
|
})()
|
|
35
51
|
].filter(Boolean);
|
|
36
52
|
|
|
@@ -73,9 +89,16 @@ class InstallService {
|
|
|
73
89
|
this.fsInstaller = new FileSystemInstallerService(this.targetRoot, this.hookSystemRoot, this.logger);
|
|
74
90
|
this.configGenerator = new ConfigurationGeneratorService(this.targetRoot, this.hookSystemRoot);
|
|
75
91
|
this.ideIntegration = new IdeIntegrationService(this.targetRoot, this.hookSystemRoot, this.logger);
|
|
92
|
+
m_constructor.success();
|
|
76
93
|
}
|
|
77
94
|
|
|
78
95
|
async run() {
|
|
96
|
+
const m_run = createMetricScope({
|
|
97
|
+
hook: 'install_service',
|
|
98
|
+
operation: 'run'
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
m_run.started();
|
|
79
102
|
this.logger.info('INSTALLATION_STARTED', { targetRoot: this.targetRoot });
|
|
80
103
|
this.printHeader();
|
|
81
104
|
|
|
@@ -124,6 +147,7 @@ class InstallService {
|
|
|
124
147
|
|
|
125
148
|
this.logger.info('INSTALLATION_COMPLETED_SUCCESSFULLY');
|
|
126
149
|
this.printFooter();
|
|
150
|
+
m_run.success();
|
|
127
151
|
}
|
|
128
152
|
|
|
129
153
|
printHeader() {
|
|
@@ -4,6 +4,10 @@ const { execSync } = require('child_process');
|
|
|
4
4
|
const crypto = require('crypto');
|
|
5
5
|
const os = require('os');
|
|
6
6
|
|
|
7
|
+
const {
|
|
8
|
+
createMetricScope: createMetricScope
|
|
9
|
+
} = require('../../../infrastructure/telemetry/metric-scope');
|
|
10
|
+
|
|
7
11
|
const COLORS = {
|
|
8
12
|
reset: '\x1b[0m',
|
|
9
13
|
green: '\x1b[32m',
|
|
@@ -42,12 +46,26 @@ function computeServerIdForRepo(repoRoot) {
|
|
|
42
46
|
|
|
43
47
|
class McpConfigurator {
|
|
44
48
|
constructor(targetRoot, hookSystemRoot, logger = null) {
|
|
49
|
+
const m_constructor = createMetricScope({
|
|
50
|
+
hook: 'mcp_configurator',
|
|
51
|
+
operation: 'constructor'
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
m_constructor.started();
|
|
45
55
|
this.targetRoot = targetRoot;
|
|
46
56
|
this.hookSystemRoot = hookSystemRoot;
|
|
47
57
|
this.logger = logger;
|
|
58
|
+
m_constructor.success();
|
|
48
59
|
}
|
|
49
60
|
|
|
50
61
|
getGlobalWindsurfConfigPath() {
|
|
62
|
+
const m_get_global_windsurf_config_path = createMetricScope({
|
|
63
|
+
hook: 'mcp_configurator',
|
|
64
|
+
operation: 'get_global_windsurf_config_path'
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
m_get_global_windsurf_config_path.started();
|
|
68
|
+
m_get_global_windsurf_config_path.success();
|
|
51
69
|
return path.join(os.homedir(), '.codeium', 'windsurf', 'mcp_config.json');
|
|
52
70
|
}
|
|
53
71
|
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
const glob = require('glob');
|
|
2
2
|
|
|
3
|
+
const {
|
|
4
|
+
createMetricScope: createMetricScope
|
|
5
|
+
} = require('../../../infrastructure/telemetry/metric-scope');
|
|
6
|
+
|
|
3
7
|
class PlatformDetectorService {
|
|
4
8
|
constructor(targetRoot) {
|
|
9
|
+
const m_constructor = createMetricScope({
|
|
10
|
+
hook: 'platform_detector_service',
|
|
11
|
+
operation: 'constructor'
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
m_constructor.started();
|
|
5
15
|
this.targetRoot = targetRoot || process.cwd();
|
|
6
16
|
this.platforms = [];
|
|
17
|
+
m_constructor.success();
|
|
7
18
|
}
|
|
8
19
|
|
|
9
20
|
detect() {
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
|
+
const {
|
|
5
|
+
createMetricScope: createMetricScope
|
|
6
|
+
} = require('../../../infrastructure/telemetry/metric-scope');
|
|
7
|
+
|
|
4
8
|
class VSCodeTaskConfigurator {
|
|
5
9
|
constructor(targetRoot, logger = null) {
|
|
10
|
+
const m_constructor = createMetricScope({
|
|
11
|
+
hook: 'vscode_task_configurator',
|
|
12
|
+
operation: 'constructor'
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
m_constructor.started();
|
|
6
16
|
this.targetRoot = targetRoot;
|
|
7
17
|
this.logger = logger;
|
|
8
18
|
this.COLORS = {
|
|
@@ -11,6 +21,7 @@ class VSCodeTaskConfigurator {
|
|
|
11
21
|
yellow: '\x1b[33m',
|
|
12
22
|
cyan: '\x1b[36m'
|
|
13
23
|
};
|
|
24
|
+
m_constructor.success();
|
|
14
25
|
}
|
|
15
26
|
|
|
16
27
|
configure() {
|
|
@@ -4,6 +4,10 @@ const path = require('path');
|
|
|
4
4
|
// Import recordMetric for prometheus metrics
|
|
5
5
|
const { recordMetric } = require('../../../infrastructure/telemetry/metrics-logger');
|
|
6
6
|
|
|
7
|
+
const {
|
|
8
|
+
createMetricScope: createMetricScope
|
|
9
|
+
} = require('../../../infrastructure/telemetry/metric-scope');
|
|
10
|
+
|
|
7
11
|
class AuditLogger {
|
|
8
12
|
/**
|
|
9
13
|
* @param {Object} options
|
|
@@ -2,6 +2,10 @@ const fs = require('fs');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const { ConfigurationError } = require('../../../domain/errors');
|
|
4
4
|
|
|
5
|
+
const {
|
|
6
|
+
createMetricScope: createMetricScope
|
|
7
|
+
} = require('../../../infrastructure/telemetry/metric-scope');
|
|
8
|
+
|
|
5
9
|
class UnifiedLogger {
|
|
6
10
|
constructor({
|
|
7
11
|
component = 'HookSystem',
|
|
@@ -9,6 +13,12 @@ class UnifiedLogger {
|
|
|
9
13
|
file: fileConfig = { enabled: false },
|
|
10
14
|
defaultData = {}
|
|
11
15
|
} = {}) {
|
|
16
|
+
const m_constructor = createMetricScope({
|
|
17
|
+
hook: 'unified_logger',
|
|
18
|
+
operation: 'constructor'
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
m_constructor.started();
|
|
12
22
|
this.component = component;
|
|
13
23
|
this.consoleConfig = {
|
|
14
24
|
enabled: consoleConfig.enabled !== false,
|
|
@@ -41,6 +51,7 @@ class UnifiedLogger {
|
|
|
41
51
|
// Directory creation might fail if race condition, can be ignored as next write will retry or fail
|
|
42
52
|
}
|
|
43
53
|
}
|
|
54
|
+
m_constructor.success();
|
|
44
55
|
}
|
|
45
56
|
|
|
46
57
|
debug(event, data = {}, context = {}) {
|
|
@@ -1,22 +1,40 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
|
+
const {
|
|
5
|
+
createMetricScope: createMetricScope
|
|
6
|
+
} = require('../../../infrastructure/telemetry/metric-scope');
|
|
7
|
+
|
|
4
8
|
class ActivityMonitor {
|
|
5
9
|
constructor({
|
|
6
10
|
repoRoot = process.cwd(),
|
|
7
11
|
inactivityGraceMs = 420000, // 7 minutes
|
|
8
12
|
logger = console
|
|
9
13
|
} = {}) {
|
|
14
|
+
const m_constructor = createMetricScope({
|
|
15
|
+
hook: 'activity_monitor',
|
|
16
|
+
operation: 'constructor'
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
m_constructor.started();
|
|
10
20
|
this.repoRoot = repoRoot;
|
|
11
21
|
this.inactivityGraceMs = inactivityGraceMs;
|
|
12
22
|
this.logger = logger;
|
|
13
23
|
this.lastUserActivityAt = Date.now();
|
|
14
24
|
this.watcher = null;
|
|
15
25
|
this.debounceTimer = null;
|
|
26
|
+
m_constructor.success();
|
|
16
27
|
}
|
|
17
28
|
|
|
18
29
|
start() {
|
|
30
|
+
const m_start = createMetricScope({
|
|
31
|
+
hook: 'activity_monitor',
|
|
32
|
+
operation: 'start'
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
m_start.started();
|
|
19
36
|
if (this.watcher) {
|
|
37
|
+
m_start.success();
|
|
20
38
|
return;
|
|
21
39
|
}
|
|
22
40
|
|
|
@@ -42,9 +60,16 @@ class ActivityMonitor {
|
|
|
42
60
|
} catch (error) {
|
|
43
61
|
this.logger.error('[ActivityMonitor] Failed to start watcher:', { error: error.message });
|
|
44
62
|
}
|
|
63
|
+
m_start.success();
|
|
45
64
|
}
|
|
46
65
|
|
|
47
66
|
stop() {
|
|
67
|
+
const m_stop = createMetricScope({
|
|
68
|
+
hook: 'activity_monitor',
|
|
69
|
+
operation: 'stop'
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
m_stop.started();
|
|
48
73
|
if (this.watcher) {
|
|
49
74
|
this.watcher.close();
|
|
50
75
|
this.watcher = null;
|
|
@@ -53,6 +78,7 @@ class ActivityMonitor {
|
|
|
53
78
|
clearTimeout(this.debounceTimer);
|
|
54
79
|
this.debounceTimer = null;
|
|
55
80
|
}
|
|
81
|
+
m_stop.success();
|
|
56
82
|
}
|
|
57
83
|
|
|
58
84
|
recordActivity(source = 'unknown') {
|
|
@@ -73,6 +99,13 @@ class ActivityMonitor {
|
|
|
73
99
|
}
|
|
74
100
|
|
|
75
101
|
getLastActivityTime() {
|
|
102
|
+
const m_get_last_activity_time = createMetricScope({
|
|
103
|
+
hook: 'activity_monitor',
|
|
104
|
+
operation: 'get_last_activity_time'
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
m_get_last_activity_time.started();
|
|
108
|
+
m_get_last_activity_time.success();
|
|
76
109
|
return this.lastUserActivityAt;
|
|
77
110
|
}
|
|
78
111
|
}
|
|
@@ -2,6 +2,10 @@ const fs = require('fs');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const { spawn } = require('child_process');
|
|
4
4
|
|
|
5
|
+
const {
|
|
6
|
+
createMetricScope: createMetricScope
|
|
7
|
+
} = require('../../../infrastructure/telemetry/metric-scope');
|
|
8
|
+
|
|
5
9
|
class AstMonitor {
|
|
6
10
|
constructor({
|
|
7
11
|
repoRoot = process.cwd(),
|
|
@@ -11,6 +15,12 @@ class AstMonitor {
|
|
|
11
15
|
logger = console,
|
|
12
16
|
notificationService = null
|
|
13
17
|
} = {}) {
|
|
18
|
+
const m_constructor = createMetricScope({
|
|
19
|
+
hook: 'ast_monitor',
|
|
20
|
+
operation: 'constructor'
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
m_constructor.started();
|
|
14
24
|
this.repoRoot = repoRoot;
|
|
15
25
|
this.debounceMs = debounceMs;
|
|
16
26
|
this.cooldownMs = cooldownMs;
|
|
@@ -26,15 +36,24 @@ class AstMonitor {
|
|
|
26
36
|
this.evidencePath = path.join(repoRoot, '.AI_EVIDENCE.json');
|
|
27
37
|
this.tempDir = path.join(repoRoot, '.audit_tmp');
|
|
28
38
|
this.astScript = path.join(repoRoot, 'infrastructure', 'ast', 'ast-intelligence.js');
|
|
39
|
+
m_constructor.success();
|
|
29
40
|
}
|
|
30
41
|
|
|
31
42
|
start() {
|
|
43
|
+
const m_start = createMetricScope({
|
|
44
|
+
hook: 'ast_monitor',
|
|
45
|
+
operation: 'start'
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
m_start.started();
|
|
32
49
|
if (!this.enabled) {
|
|
33
50
|
this.logger.info('[AstMonitor] AST Watch disabled');
|
|
51
|
+
m_start.success();
|
|
34
52
|
return;
|
|
35
53
|
}
|
|
36
54
|
|
|
37
55
|
if (this.watcher) {
|
|
56
|
+
m_start.success();
|
|
38
57
|
return;
|
|
39
58
|
}
|
|
40
59
|
|
|
@@ -58,9 +77,16 @@ class AstMonitor {
|
|
|
58
77
|
} catch (error) {
|
|
59
78
|
this.logger.error('[AstMonitor] Failed to start watchers:', { error: error.message });
|
|
60
79
|
}
|
|
80
|
+
m_start.success();
|
|
61
81
|
}
|
|
62
82
|
|
|
63
83
|
stop() {
|
|
84
|
+
const m_stop = createMetricScope({
|
|
85
|
+
hook: 'ast_monitor',
|
|
86
|
+
operation: 'stop'
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
m_stop.started();
|
|
64
90
|
// fs.watch returns FSWatcher which has close().
|
|
65
91
|
// Since we might have multiple watchers (one per dir), we should track them if we want to close properly.
|
|
66
92
|
// For simplicity in this iteration, we assume the process exit handles it, or we rely on the debounce timer clear.
|
|
@@ -70,6 +96,7 @@ class AstMonitor {
|
|
|
70
96
|
this.timer = null;
|
|
71
97
|
}
|
|
72
98
|
// Ideally we would close all FSWatchers here
|
|
99
|
+
m_stop.success();
|
|
73
100
|
}
|
|
74
101
|
|
|
75
102
|
scheduleAnalysis() {
|