pumuki-ast-hooks 6.3.1 → 6.3.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki-ast-hooks",
3
- "version": "6.3.1",
3
+ "version": "6.3.2",
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": {
@@ -61,3 +61,4 @@
61
61
  {"timestamp":"2026-01-26T14:48:05.609Z","level":"info","component":"AutoRecovery","event":"NotificationCenterService shutdown","data":{"totalEnqueued":0,"totalSent":0,"totalDeduplicated":0,"totalCooldownSkipped":0,"totalFailed":0,"totalRetries":0,"queueSize":0,"deduplication":{"size":0},"cooldowns":{"activeCooldowns":0}},"context":{}}
62
62
  {"timestamp":"2026-01-26T16:02:19.123Z","level":"info","component":"AutoRecovery","event":"NotificationCenterService shutdown","data":{"totalEnqueued":0,"totalSent":0,"totalDeduplicated":0,"totalCooldownSkipped":0,"totalFailed":0,"totalRetries":0,"queueSize":0,"deduplication":{"size":0},"cooldowns":{"activeCooldowns":0}},"context":{}}
63
63
  {"timestamp":"2026-01-26T16:20:32.268Z","level":"info","component":"AutoRecovery","event":"NotificationCenterService shutdown","data":{"totalEnqueued":0,"totalSent":0,"totalDeduplicated":0,"totalCooldownSkipped":0,"totalFailed":0,"totalRetries":0,"queueSize":0,"deduplication":{"size":0},"cooldowns":{"activeCooldowns":0}},"context":{}}
64
+ {"timestamp":"2026-01-26T19:01:57.880Z","level":"info","component":"AutoRecovery","event":"NotificationCenterService shutdown","data":{"totalEnqueued":0,"totalSent":0,"totalDeduplicated":0,"totalCooldownSkipped":0,"totalFailed":0,"totalRetries":0,"queueSize":0,"deduplication":{"size":0},"cooldowns":{"activeCooldowns":0}},"context":{}}
@@ -254,3 +254,7 @@
254
254
  {"timestamp":"2026-01-26T16:20:32.946Z","level":"info","component":"InstallWizard","event":"INSTALL_WIZARD_CONFIG_EXISTS","data":{"configPath":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system/.hook-system/config.json"},"context":{}}
255
255
  {"timestamp":"2026-01-26T16:20:32.946Z","level":"error","component":"InstallWizard","event":"INSTALL_WIZARD_SYMLINK_FAILED","data":{"error":"EEXIST: file already exists, symlink '/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system/scripts/hooks-system/bin/guard-supervisor.js' -> '/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system/.git/hooks/guard-supervisor'"},"context":{}}
256
256
  {"timestamp":"2026-01-26T16:20:32.946Z","level":"info","component":"InstallWizard","event":"INSTALL_WIZARD_COMPLETED","data":{},"context":{}}
257
+ {"timestamp":"2026-01-26T19:01:57.647Z","level":"info","component":"InstallWizard","event":"INSTALL_WIZARD_START","data":{"repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"},"context":{}}
258
+ {"timestamp":"2026-01-26T19:01:57.651Z","level":"info","component":"InstallWizard","event":"INSTALL_WIZARD_CONFIG_EXISTS","data":{"configPath":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system/.hook-system/config.json"},"context":{}}
259
+ {"timestamp":"2026-01-26T19:01:57.651Z","level":"error","component":"InstallWizard","event":"INSTALL_WIZARD_SYMLINK_FAILED","data":{"error":"EEXIST: file already exists, symlink '/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system/scripts/hooks-system/bin/guard-supervisor.js' -> '/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system/.git/hooks/guard-supervisor'"},"context":{}}
260
+ {"timestamp":"2026-01-26T19:01:57.651Z","level":"info","component":"InstallWizard","event":"INSTALL_WIZARD_COMPLETED","data":{},"context":{}}
@@ -1894,3 +1894,31 @@
1894
1894
  {"timestamp":1769444462348,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
1895
1895
  {"timestamp":1769444462348,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
1896
1896
  {"timestamp":1769444462348,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1897
+ {"timestamp":1769454117879,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1898
+ {"timestamp":1769454117879,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
1899
+ {"timestamp":1769454117879,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
1900
+ {"timestamp":1769454117879,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1901
+ {"timestamp":1769454117879,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1902
+ {"timestamp":1769454117880,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
1903
+ {"timestamp":1769454117880,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
1904
+ {"timestamp":1769454117880,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1905
+ {"timestamp":1769454117880,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1906
+ {"timestamp":1769454117880,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
1907
+ {"timestamp":1769454117880,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
1908
+ {"timestamp":1769454117880,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1909
+ {"timestamp":1769454117880,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1910
+ {"timestamp":1769454117880,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
1911
+ {"timestamp":1769454117880,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
1912
+ {"timestamp":1769454117880,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1913
+ {"timestamp":1769454117880,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1914
+ {"timestamp":1769454117880,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
1915
+ {"timestamp":1769454117880,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
1916
+ {"timestamp":1769454117880,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1917
+ {"timestamp":1769454117880,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1918
+ {"timestamp":1769454117880,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
1919
+ {"timestamp":1769454117880,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
1920
+ {"timestamp":1769454117880,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1921
+ {"timestamp":1769454140085,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1922
+ {"timestamp":1769454140085,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
1923
+ {"timestamp":1769454140085,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
1924
+ {"timestamp":1769454140085,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
@@ -200,7 +200,7 @@ describe('intelligent-audit', () => {
200
200
  }
201
201
  });
202
202
 
203
- it('should preserve protocol_3_questions and ai_gate violations on auto refresh when evidence is complete', async () => {
203
+ it('should preserve protocol_3_questions and ai_gate violations while updating gate status on auto refresh when evidence is complete', async () => {
204
204
  const evidencePath = path.join(process.cwd(), '.AI_EVIDENCE.json');
205
205
  const original = fs.existsSync(evidencePath) ? fs.readFileSync(evidencePath, 'utf8') : null;
206
206
  const previousTrigger = process.env.AUTO_EVIDENCE_TRIGGER;
@@ -270,6 +270,8 @@ describe('intelligent-audit', () => {
270
270
 
271
271
  expect(updated.protocol_3_questions).toEqual(preservedQuestions);
272
272
  expect(updated.ai_gate.violations).toEqual(preservedViolations);
273
+ expect(updated.ai_gate.status).toBe('BLOCKED');
274
+ expect(updated.severity_metrics.total_violations).toBe(1);
273
275
  expect(updated.timestamp).not.toBe(completeEvidence.timestamp);
274
276
  } finally {
275
277
  if (previousTrigger === undefined) {
@@ -727,12 +727,7 @@ async function updateAIEvidence(violations, gateResult, tokenUsage) {
727
727
 
728
728
  const autoEvidenceTrigger = String(env.get('AUTO_EVIDENCE_TRIGGER', process.env.AUTO_EVIDENCE_TRIGGER || '') || '').trim().toLowerCase();
729
729
  const isAutoEvidenceRefresh = autoEvidenceTrigger === 'auto';
730
- if (isAutoEvidenceRefresh && isEvidenceCompleteForAutoRefresh(evidence)) {
731
- evidence.timestamp = formatLocalTimestamp();
732
- fs.writeFileSync(evidencePath, JSON.stringify(evidence, null, 2));
733
- console.log('[Intelligent Audit] ✅ Auto refresh skipped full rewrite (evidence already complete)');
734
- return;
735
- }
730
+ const preserveAutoEvidence = isAutoEvidenceRefresh && isEvidenceCompleteForAutoRefresh(evidence);
736
731
 
737
732
  evidence.timestamp = formatLocalTimestamp();
738
733
 
@@ -858,6 +853,10 @@ async function updateAIEvidence(violations, gateResult, tokenUsage) {
858
853
  mandatory: true
859
854
  };
860
855
 
856
+ if (preserveAutoEvidence && existingGate && Array.isArray(existingGate.violations)) {
857
+ nextGate.violations = existingGate.violations;
858
+ }
859
+
861
860
  evidence.ai_gate = preserveExistingRepoGate ? existingGate : nextGate;
862
861
 
863
862
  const stagedFilesList = getStagedFiles();
@@ -868,19 +867,21 @@ async function updateAIEvidence(violations, gateResult, tokenUsage) {
868
867
  (v.ruleId || '').includes('architecture')
869
868
  );
870
869
 
871
- evidence.protocol_3_questions = {
872
- answered: true,
873
- question_1_file_type: stagedFilesList.length > 0
874
- ? `Staged files analyzed: ${stagedFilesList.length}. Platforms detected: ${detectedPlatformsForQuestions.join(', ') || 'none'}.`
875
- : 'No staged files detected for analysis.',
876
- question_2_similar_exists: violations.length > 0
877
- ? `Detected ${violations.length} rule violations; review existing patterns and rule matches.`
878
- : 'No rule violations detected; no similar patterns flagged.',
879
- question_3_clean_architecture: architectureViolations.length > 0
880
- ? `Found ${architectureViolations.length} Clean Architecture/SOLID-related violations that require review.`
881
- : 'No Clean Architecture or SOLID violations detected.',
882
- last_answered: formatLocalTimestamp()
883
- };
870
+ if (!preserveAutoEvidence) {
871
+ evidence.protocol_3_questions = {
872
+ answered: true,
873
+ question_1_file_type: stagedFilesList.length > 0
874
+ ? `Staged files analyzed: ${stagedFilesList.length}. Platforms detected: ${detectedPlatformsForQuestions.join(', ') || 'none'}.`
875
+ : 'No staged files detected for analysis.',
876
+ question_2_similar_exists: violations.length > 0
877
+ ? `Detected ${violations.length} rule violations; review existing patterns and rule matches.`
878
+ : 'No rule violations detected; no similar patterns flagged.',
879
+ question_3_clean_architecture: architectureViolations.length > 0
880
+ ? `Found ${architectureViolations.length} Clean Architecture/SOLID-related violations that require review.`
881
+ : 'No Clean Architecture or SOLID violations detected.',
882
+ last_answered: formatLocalTimestamp()
883
+ };
884
+ }
884
885
 
885
886
  const stagedFiles = getStagedFiles();
886
887
  const platformsEvidence = buildPlatformsEvidence(stagedFiles, violations);
@@ -187,3 +187,6 @@
187
187
  {"timestamp":"2026-01-26T16:20:36.258Z","level":"info","component":"TokenMonitor","event":"TOKEN_MONITOR_RESULT","data":{"level":"ok","percentUsed":10,"tokensUsed":100000,"maxTokens":1000000,"source":"realtime","stale":false},"context":{"message":"Result level=ok percent=10% used=100000/1000000 source=realtime"}}
188
188
  {"timestamp":"2026-01-26T16:20:36.262Z","level":"info","component":"TokenMonitor","event":"TOKEN_MONITOR_RESULT","data":{"level":"warning","percentUsed":91,"tokensUsed":910000,"maxTokens":1000000,"source":"fallback","stale":false},"context":{"message":"Result level=warning percent=91% used=910000/1000000 source=fallback"}}
189
189
  {"timestamp":"2026-01-26T16:20:36.264Z","level":"info","component":"TokenMonitor","event":"TOKEN_MONITOR_RESULT","data":{"level":"critical","percentUsed":98,"tokensUsed":980000,"maxTokens":1000000,"source":"realtime","stale":true},"context":{"message":"Result level=critical percent=98% used=980000/1000000 source=realtime (stale)"}}
190
+ {"timestamp":"2026-01-26T19:01:58.968Z","level":"info","component":"TokenMonitor","event":"TOKEN_MONITOR_RESULT","data":{"level":"ok","percentUsed":10,"tokensUsed":100000,"maxTokens":1000000,"source":"realtime","stale":false},"context":{"message":"Result level=ok percent=10% used=100000/1000000 source=realtime"}}
191
+ {"timestamp":"2026-01-26T19:01:58.970Z","level":"info","component":"TokenMonitor","event":"TOKEN_MONITOR_RESULT","data":{"level":"warning","percentUsed":91,"tokensUsed":910000,"maxTokens":1000000,"source":"fallback","stale":false},"context":{"message":"Result level=warning percent=91% used=910000/1000000 source=fallback"}}
192
+ {"timestamp":"2026-01-26T19:01:58.971Z","level":"info","component":"TokenMonitor","event":"TOKEN_MONITOR_RESULT","data":{"level":"critical","percentUsed":98,"tokensUsed":980000,"maxTokens":1000000,"source":"realtime","stale":true},"context":{"message":"Result level=critical percent=98% used=980000/1000000 source=realtime (stale)"}}