pumuki-ast-hooks 5.5.23 → 5.5.25

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/README.md CHANGED
@@ -1065,6 +1065,24 @@ For coding standards, see [CODE_STANDARDS.md](./docs/CODE_STANDARDS.md).
1065
1065
 
1066
1066
  ## 📝 Recent Changes
1067
1067
 
1068
+ ### Version 5.5.25 (2026-01-04)
1069
+
1070
+ **⚡ Performance Fix:**
1071
+ - Removed slow full AST analysis (35 minutes) from evidence guard refresh loop
1072
+ - Evidence guard now uses fast `update-evidence.sh` (seconds) instead of `intelligent-audit.js`
1073
+ - Evidence refreshes every 3 minutes as intended, notifications work correctly
1074
+
1075
+ ---
1076
+
1077
+ ### Version 5.5.24 (2026-01-04)
1078
+
1079
+ **🔔 Notifications Fix:**
1080
+ - Replaced empty catch blocks with proper error handling via `MacNotificationSender`
1081
+ - macOS notifications now sent on every evidence update with proper error management
1082
+ - Notifications show "AI Evidence has been refreshed automatically" or "AI Gate BLOCKED"
1083
+
1084
+ ---
1085
+
1068
1086
  ### Version 5.5.22 (2026-01-04)
1069
1087
 
1070
1088
  **🔴 CRITICAL Fix:**
@@ -1,3 +1,104 @@
1
+ # Release Notes - v5.5.25
2
+
3
+ **Release Date**: January 4, 2026
4
+ **Type**: Performance Patch Release
5
+ **Compatibility**: Fully backward compatible with 5.5.x
6
+
7
+ ---
8
+
9
+ ## ⚡ Performance Fix
10
+
11
+ ### Problem
12
+
13
+ The evidence guard daemon was running full AST analysis on every refresh (every 3 minutes), causing:
14
+
15
+ - **35-minute delays** between evidence updates
16
+ - **Notifications not appearing** until analysis completed
17
+ - **High CPU usage** during full repository scans
18
+
19
+ ### Root Cause
20
+
21
+ Evidence guard was calling `intelligent-audit.js` directly:
22
+
23
+ ```javascript
24
+ const astScript = 'node_modules/pumuki-ast-hooks/scripts/hooks-system/infrastructure/orchestration/intelligent-audit.js';
25
+ spawn('node', [astScript], { stdio: 'ignore' });
26
+ ```
27
+
28
+ This script performs a full repository scan (1687 files, 11356 violations) which takes 35 minutes.
29
+
30
+ ### Solution
31
+
32
+ Use `update-evidence.sh` which performs incremental analysis on staged files only:
33
+
34
+ ```javascript
35
+ spawn('bash', [this.updateScript, '--auto'], { stdio: 'ignore' });
36
+ ```
37
+
38
+ ### Impact
39
+
40
+ - **Before**: Evidence refresh takes 35 minutes, notifications delayed
41
+ - **After**: Evidence refresh takes seconds, notifications appear immediately
42
+ - Refresh interval remains 180 seconds but now completes in seconds instead of minutes
43
+
44
+ ---
45
+
46
+ ## 📦 Installation / Upgrade
47
+ ```bash
48
+ npm install --save-dev pumuki-ast-hooks@5.5.25
49
+ npm run install-hooks
50
+ npm run ast:guard:restart
51
+ ```
52
+
53
+ ---
54
+
55
+ # Release Notes - v5.5.24
56
+
57
+ **Release Date**: January 4, 2026
58
+ **Type**: Patch Release
59
+ **Compatibility**: Fully backward compatible with 5.5.x
60
+
61
+ ---
62
+
63
+ ## 🔔 Notifications Fix
64
+
65
+ ### Problem
66
+
67
+ macOS notifications had empty catch blocks that silently failed:
68
+
69
+ ```javascript
70
+ try {
71
+ execSync('osascript ...');
72
+ } catch (e) {
73
+ }
74
+ ```
75
+
76
+ ### Solution
77
+
78
+ Use `MacNotificationSender` service with proper error handling:
79
+
80
+ ```javascript
81
+ const MacNotificationSender = require('../../application/services/notification/MacNotificationSender');
82
+ const notificationSender = new MacNotificationSender(null);
83
+ notificationSender.send({ message: notifMsg, level });
84
+ ```
85
+
86
+ ### Impact
87
+
88
+ - Notifications now appear on every evidence update
89
+ - Proper error logging when notifications fail
90
+ - Consistent behavior across all notification types
91
+
92
+ ---
93
+
94
+ ## 📦 Installation / Upgrade
95
+ ```bash
96
+ npm install --save-dev pumuki-ast-hooks@5.5.24
97
+ npm run install-hooks
98
+ ```
99
+
100
+ ---
101
+
1
102
  # Release Notes - v5.5.22
2
103
 
3
104
  **Release Date**: January 4, 2026
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki-ast-hooks",
3
- "version": "5.5.23",
3
+ "version": "5.5.25",
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": {
@@ -80,61 +80,26 @@ class EvidenceGuard {
80
80
 
81
81
  async refreshEvidence() {
82
82
  return new Promise((resolve) => {
83
- const astScript = path.join(
84
- this.projectRoot,
85
- 'node_modules/pumuki-ast-hooks/scripts/hooks-system/infrastructure/orchestration/intelligent-audit.js'
86
- );
87
-
88
- if (fs.existsSync(astScript)) {
89
- console.log('[EvidenceGuard] Running full AST analysis...');
90
- const child = spawn('node', [astScript], {
91
- cwd: this.projectRoot,
92
- stdio: 'ignore',
93
- detached: false,
94
- env: {
95
- ...process.env,
96
- REPO_ROOT: this.projectRoot,
97
- AUTO_EVIDENCE_TRIGGER: 'auto',
98
- AUTO_EVIDENCE_REASON: 'evidence_guard_refresh',
99
- AUTO_EVIDENCE_SUMMARY: 'Automatic refresh by evidence guard'
100
- }
101
- });
102
-
103
- child.on('close', (code) => {
104
- if (code === 0) {
105
- console.log(`[EvidenceGuard] Full AST analysis completed at ${new Date().toISOString()}`);
106
- } else {
107
- console.error(`[EvidenceGuard] AST analysis failed with code ${code}`);
108
- }
109
- resolve();
110
- });
111
-
112
- child.on('error', (error) => {
113
- console.error('[EvidenceGuard] Failed to spawn AST analysis:', error.message);
114
- resolve();
115
- });
116
- } else {
117
- console.warn('[EvidenceGuard] intelligent-audit.js not found, falling back to update-evidence.sh');
118
- const child = spawn('bash', [this.updateScript, '--auto'], {
119
- cwd: this.projectRoot,
120
- stdio: 'ignore',
121
- detached: false
122
- });
123
-
124
- child.on('close', (code) => {
125
- if (code === 0) {
126
- console.log(`[EvidenceGuard] Evidence refreshed (fallback) at ${new Date().toISOString()}`);
127
- } else {
128
- console.error(`[EvidenceGuard] Refresh failed with code ${code}`);
129
- }
130
- resolve();
131
- });
132
-
133
- child.on('error', (error) => {
134
- console.error('[EvidenceGuard] Refresh error:', error.message);
135
- resolve();
136
- });
137
- }
83
+ console.log('[EvidenceGuard] Running evidence update...');
84
+ const child = spawn('bash', [this.updateScript, '--auto'], {
85
+ cwd: this.projectRoot,
86
+ stdio: 'ignore',
87
+ detached: false
88
+ });
89
+
90
+ child.on('close', (code) => {
91
+ if (code === 0) {
92
+ console.log(`[EvidenceGuard] Evidence refreshed at ${new Date().toISOString()}`);
93
+ } else {
94
+ console.error(`[EvidenceGuard] Refresh failed with code ${code}`);
95
+ }
96
+ resolve();
97
+ });
98
+
99
+ child.on('error', (error) => {
100
+ console.error('[EvidenceGuard] Refresh error:', error.message);
101
+ resolve();
102
+ });
138
103
  });
139
104
  }
140
105
 
@@ -391,15 +391,15 @@ function updateAIEvidence(violations, gateResult, tokenUsage) {
391
391
  fs.writeFileSync(evidencePath, JSON.stringify(evidence, null, 2));
392
392
  console.log('[Intelligent Audit] ✅ .AI_EVIDENCE.json updated with complete format (ai_gate, severity_metrics, token_usage, git_flow, watchers)');
393
393
 
394
- try {
395
- const gateStatus = evidence.ai_gate.status;
396
- const violationCount = evidence.severity_metrics.total_violations;
397
- const notifTitle = gateStatus === 'BLOCKED' ? '🚨 AI Gate BLOCKED' : '✅ Evidence Updated';
398
- const notifMsg = `Gate: ${gateStatus} | Violations: ${violationCount} | Tokens: ${tokenPercent}%`;
399
- execSync(`osascript -e 'display notification "${notifMsg}" with title "${notifTitle}" sound name "Glass"'`, { stdio: 'ignore' });
400
- } catch (notifErr) {
401
- // Silent fail for non-macOS
402
- }
394
+ const MacNotificationSender = require('../../application/services/notification/MacNotificationSender');
395
+ const notificationSender = new MacNotificationSender(null);
396
+ const gateStatus = evidence.ai_gate.status;
397
+ const violationCount = evidence.severity_metrics.total_violations;
398
+ const level = gateStatus === 'BLOCKED' ? 'error' : 'info';
399
+ const notifMsg = gateStatus === 'BLOCKED'
400
+ ? `AI Gate BLOCKED - ${violationCount} violations need fixing`
401
+ : `AI Evidence has been refreshed automatically`;
402
+ notificationSender.send({ message: notifMsg, level });
403
403
 
404
404
  } catch (evidenceFileUpdateError) {
405
405
  process.stderr.write(`[Intelligent Audit] ⚠️ Evidence update failed: ${toErrorMessage(evidenceFileUpdateError)}\n`);