pumuki-ast-hooks 5.4.6 → 5.4.8
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 +1 -1
- package/scripts/hooks-system/application/services/evidence/EvidenceContextManager.js +1 -0
- package/scripts/hooks-system/application/services/token/CursorTokenService.js +2 -0
- package/scripts/hooks-system/infrastructure/mcp/ast-intelligence-automation.js +10 -8
- package/scripts/hooks-system/infrastructure/mcp/services/EvidenceService.js +2 -2
- package/scripts/hooks-system/infrastructure/mcp/services/McpProtocolHandler.js +1 -1
- package/scripts/hooks-system/infrastructure/reporting/report-generator.js +2 -0
- package/scripts/hooks-system/infrastructure/reporting/severity-tracker.js +2 -0
- package/scripts/hooks-system/infrastructure/severity/context/context-builder.js +2 -0
- package/scripts/hooks-system/infrastructure/watchdog/auto-recovery.js +1 -1
- package/scripts/hooks-system/infrastructure/watchdog/health-check.js +1 -1
- package/scripts/hooks-system/infrastructure/watchdog/token-monitor.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pumuki-ast-hooks",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.8",
|
|
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": {
|
|
@@ -40,6 +40,7 @@ class EvidenceContextManager {
|
|
|
40
40
|
this.autoPlatforms = Array.isArray(autoPlatforms) && autoPlatforms.length ? autoPlatforms : DEFAULT_PLATFORMS;
|
|
41
41
|
this.notificationCenter = notificationCenter;
|
|
42
42
|
this.logger = logger || console;
|
|
43
|
+
this.auditLogger = new AuditLogger({ repoRoot, logger: this.logger });
|
|
43
44
|
this.intervalMs = intervalMs;
|
|
44
45
|
this.timers = timers;
|
|
45
46
|
this.runCommand = runCommand;
|
|
@@ -12,6 +12,8 @@ class CursorTokenService {
|
|
|
12
12
|
logger = console
|
|
13
13
|
} = {}) {
|
|
14
14
|
this.logger = logger;
|
|
15
|
+
this.repoRoot = repoRoot;
|
|
16
|
+
this.auditLogger = new AuditLogger({ repoRoot, logger });
|
|
15
17
|
this.repository = cursorTokenRepository || new CursorTokenRepository({
|
|
16
18
|
repoRoot,
|
|
17
19
|
usageFile,
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
const fs = require('fs');
|
|
19
19
|
const path = require('path');
|
|
20
20
|
const { execSync } = require('child_process');
|
|
21
|
+
const crypto = require('crypto');
|
|
22
|
+
const os = require('os');
|
|
23
|
+
const env = require('../../config/env');
|
|
21
24
|
|
|
22
25
|
// Removed global requires for performance (Lazy Loading)
|
|
23
26
|
// const AutonomousOrchestrator = require('../../application/services/AutonomousOrchestrator');
|
|
@@ -43,7 +46,7 @@ function safeGitRoot(startDir) {
|
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
function resolveRepoRoot() {
|
|
46
|
-
const envRoot = (
|
|
49
|
+
const envRoot = (env.get('REPO_ROOT') || '').trim() || null;
|
|
47
50
|
const cwdRoot = safeGitRoot(process.cwd());
|
|
48
51
|
// Prefer explicit REPO_ROOT to avoid cross-repo bleed when MCP server is launched from another workspace
|
|
49
52
|
if (envRoot) return envRoot;
|
|
@@ -53,7 +56,10 @@ function resolveRepoRoot() {
|
|
|
53
56
|
|
|
54
57
|
const REPO_ROOT = resolveRepoRoot();
|
|
55
58
|
|
|
56
|
-
|
|
59
|
+
// Create unique lock per project using hash of REPO_ROOT
|
|
60
|
+
// This allows multiple projects to run MCP simultaneously
|
|
61
|
+
const repoHash = crypto.createHash('md5').update(REPO_ROOT).digest('hex').substring(0, 8);
|
|
62
|
+
const MCP_LOCK_DIR = path.join(os.tmpdir(), `mcp-ast-intelligence-${repoHash}.lock`);
|
|
57
63
|
const MCP_LOCK_PID = path.join(MCP_LOCK_DIR, 'pid');
|
|
58
64
|
|
|
59
65
|
let MCP_IS_PRIMARY = true;
|
|
@@ -64,7 +70,7 @@ function logMcpError(context, error) {
|
|
|
64
70
|
}
|
|
65
71
|
|
|
66
72
|
function logMcpDebug(message) {
|
|
67
|
-
if (
|
|
73
|
+
if (env.getBool('DEBUG', false)) {
|
|
68
74
|
process.stderr.write(`[MCP][DEBUG] ${message}\n`);
|
|
69
75
|
}
|
|
70
76
|
}
|
|
@@ -159,11 +165,7 @@ function installStdioExitHandlers() {
|
|
|
159
165
|
}
|
|
160
166
|
|
|
161
167
|
function acquireSingletonLock() {
|
|
162
|
-
|
|
163
|
-
fs.mkdirSync(path.join(REPO_ROOT, '.audit_tmp'), { recursive: true });
|
|
164
|
-
} catch (error) {
|
|
165
|
-
logMcpError('acquireSingletonLock (create .audit_tmp)', error);
|
|
166
|
-
}
|
|
168
|
+
// No need to create .audit_tmp since lock is in /tmp/
|
|
167
169
|
|
|
168
170
|
try {
|
|
169
171
|
fs.mkdirSync(MCP_LOCK_DIR);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const env = require('
|
|
2
|
-
const AuditLogger = require('
|
|
1
|
+
const env = require('../../../config/env');
|
|
2
|
+
const AuditLogger = require('../../../application/services/logging/AuditLogger');
|
|
3
3
|
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const MCP_VERSION = '2024-11-05';
|
|
2
|
-
const AuditLogger = require('
|
|
2
|
+
const AuditLogger = require('../../../application/services/logging/AuditLogger');
|
|
3
3
|
|
|
4
4
|
class McpProtocolHandler {
|
|
5
5
|
constructor(inputStream, outputStream, logger) {
|
|
@@ -5,12 +5,14 @@ const path = require('path');
|
|
|
5
5
|
const ReportPresenter = require('./ReportPresenter');
|
|
6
6
|
const ReportMetricsCalculator = require('./ReportMetricsCalculator');
|
|
7
7
|
const ReportImpactAnalyzer = require('./ReportImpactAnalyzer');
|
|
8
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
8
9
|
|
|
9
10
|
class ReportGenerator {
|
|
10
11
|
constructor() {
|
|
11
12
|
this.presenter = new ReportPresenter();
|
|
12
13
|
this.metricsCalculator = new ReportMetricsCalculator();
|
|
13
14
|
this.impactAnalyzer = new ReportImpactAnalyzer(this.metricsCalculator);
|
|
15
|
+
this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
/**
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const path = require('path');
|
|
4
|
+
const AuditLogger = require('../../application/services/logging/AuditLogger');
|
|
4
5
|
|
|
5
6
|
class SeverityTracker {
|
|
6
7
|
constructor(historyPath = '.audit_tmp/severity-history.jsonl') {
|
|
7
8
|
this.historyPath = historyPath;
|
|
9
|
+
this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
|
|
8
10
|
this.ensureHistoryFile();
|
|
9
11
|
}
|
|
10
12
|
|
|
@@ -3,6 +3,7 @@ const { CodeClassificationAnalyzer } = require('./analyzers/CodeClassificationAn
|
|
|
3
3
|
const { ImpactAnalyzer } = require('./analyzers/ImpactAnalyzer');
|
|
4
4
|
const { SafetyAnalyzer } = require('./analyzers/SafetyAnalyzer');
|
|
5
5
|
const { DataAnalyzer } = require('./analyzers/DataAnalyzer');
|
|
6
|
+
const AuditLogger = require('../../../application/services/logging/AuditLogger');
|
|
6
7
|
|
|
7
8
|
class ContextBuilder {
|
|
8
9
|
constructor() {
|
|
@@ -10,6 +11,7 @@ class ContextBuilder {
|
|
|
10
11
|
this.impactAnalyzer = new ImpactAnalyzer();
|
|
11
12
|
this.safetyAnalyzer = new SafetyAnalyzer();
|
|
12
13
|
this.dataAnalyzer = new DataAnalyzer();
|
|
14
|
+
this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
/**
|
|
@@ -7,7 +7,7 @@ const { createUnifiedLogger } = require('../logging/UnifiedLoggerFactory');
|
|
|
7
7
|
const NotificationCenterService = require('../../application/services/notification/NotificationCenterService');
|
|
8
8
|
const { AutoRecoveryManager } = require('../../application/services/recovery/AutoRecoveryManager');
|
|
9
9
|
|
|
10
|
-
const repoRoot =
|
|
10
|
+
const repoRoot = env.get('HOOKS_REPO_ROOT') ? path.resolve(env.get('HOOKS_REPO_ROOT')) : process.cwd();
|
|
11
11
|
const logger = createUnifiedLogger({
|
|
12
12
|
repoRoot,
|
|
13
13
|
component: 'AutoRecovery',
|
|
@@ -10,7 +10,7 @@ const path = require('path');
|
|
|
10
10
|
|
|
11
11
|
async function runHealthCheck({ repoRoot = null } = {}) {
|
|
12
12
|
const resolvedRepoRoot = repoRoot
|
|
13
|
-
|| (
|
|
13
|
+
|| (env.get('HOOKS_REPO_ROOT') ? path.resolve(env.get('HOOKS_REPO_ROOT')) : null)
|
|
14
14
|
|| process.cwd();
|
|
15
15
|
|
|
16
16
|
const logger = createUnifiedLogger({
|
|
@@ -12,7 +12,7 @@ async function runTokenMonitor({
|
|
|
12
12
|
logger = null,
|
|
13
13
|
service = null
|
|
14
14
|
} = {}) {
|
|
15
|
-
const envRoot =
|
|
15
|
+
const envRoot = env.get('HOOKS_REPO_ROOT') ? path.resolve(env.get('HOOKS_REPO_ROOT')) : null;
|
|
16
16
|
const resolvedRepoRoot = repoRoot || envRoot || path.resolve(__dirname, '../..');
|
|
17
17
|
|
|
18
18
|
const resolvedNotificationCenter = notificationCenter || new NotificationCenterService({
|