pumuki-ast-hooks 6.3.0 → 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 +2 -2
- package/scripts/hooks-system/.audit-reports/auto-recovery.log +3 -0
- package/scripts/hooks-system/.audit-reports/install-wizard.log +12 -0
- package/scripts/hooks-system/.audit_tmp/hook-metrics.jsonl +92 -0
- package/scripts/hooks-system/infrastructure/orchestration/__tests__/intelligent-audit.spec.js +100 -0
- package/scripts/hooks-system/infrastructure/orchestration/intelligent-audit.js +48 -13
- package/scripts/hooks-system/infrastructure/watchdog/__tests__/.audit-reports/token-monitor.log +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pumuki-ast-hooks",
|
|
3
|
-
"version": "6.3.
|
|
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": {
|
|
@@ -136,4 +136,4 @@
|
|
|
136
136
|
"./skills": "./skills/skill-rules.json",
|
|
137
137
|
"./hooks": "./hooks/index.js"
|
|
138
138
|
}
|
|
139
|
-
}
|
|
139
|
+
}
|
|
@@ -59,3 +59,6 @@
|
|
|
59
59
|
{"timestamp":"2026-01-26T14:41:41.374Z","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":{}}
|
|
60
60
|
{"timestamp":"2026-01-26T14:45:03.108Z","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":{}}
|
|
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
|
+
{"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
|
+
{"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":{}}
|
|
@@ -246,3 +246,15 @@
|
|
|
246
246
|
{"timestamp":"2026-01-26T14:48:05.698Z","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":{}}
|
|
247
247
|
{"timestamp":"2026-01-26T14:48:05.698Z","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":{}}
|
|
248
248
|
{"timestamp":"2026-01-26T14:48:05.698Z","level":"info","component":"InstallWizard","event":"INSTALL_WIZARD_COMPLETED","data":{},"context":{}}
|
|
249
|
+
{"timestamp":"2026-01-26T16:02:18.722Z","level":"info","component":"InstallWizard","event":"INSTALL_WIZARD_START","data":{"repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"},"context":{}}
|
|
250
|
+
{"timestamp":"2026-01-26T16:02:18.727Z","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":{}}
|
|
251
|
+
{"timestamp":"2026-01-26T16:02:18.728Z","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":{}}
|
|
252
|
+
{"timestamp":"2026-01-26T16:02:18.728Z","level":"info","component":"InstallWizard","event":"INSTALL_WIZARD_COMPLETED","data":{},"context":{}}
|
|
253
|
+
{"timestamp":"2026-01-26T16:20:32.938Z","level":"info","component":"InstallWizard","event":"INSTALL_WIZARD_START","data":{"repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"},"context":{}}
|
|
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
|
+
{"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
|
+
{"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":{}}
|
|
@@ -1830,3 +1830,95 @@
|
|
|
1830
1830
|
{"timestamp":1769439945298,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
|
|
1831
1831
|
{"timestamp":1769439945299,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
|
|
1832
1832
|
{"timestamp":1769439945299,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1833
|
+
{"timestamp":1769442400720,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1834
|
+
{"timestamp":1769442400720,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
|
|
1835
|
+
{"timestamp":1769442400720,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
|
|
1836
|
+
{"timestamp":1769442400720,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1837
|
+
{"timestamp":1769443339121,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1838
|
+
{"timestamp":1769443339122,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
|
|
1839
|
+
{"timestamp":1769443339122,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
|
|
1840
|
+
{"timestamp":1769443339122,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1841
|
+
{"timestamp":1769443339122,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1842
|
+
{"timestamp":1769443339122,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
|
|
1843
|
+
{"timestamp":1769443339122,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
|
|
1844
|
+
{"timestamp":1769443339122,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1845
|
+
{"timestamp":1769443339122,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1846
|
+
{"timestamp":1769443339122,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
|
|
1847
|
+
{"timestamp":1769443339122,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
|
|
1848
|
+
{"timestamp":1769443339122,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1849
|
+
{"timestamp":1769443339122,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1850
|
+
{"timestamp":1769443339122,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
|
|
1851
|
+
{"timestamp":1769443339122,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
|
|
1852
|
+
{"timestamp":1769443339122,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1853
|
+
{"timestamp":1769443339122,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1854
|
+
{"timestamp":1769443339122,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
|
|
1855
|
+
{"timestamp":1769443339122,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
|
|
1856
|
+
{"timestamp":1769443339122,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1857
|
+
{"timestamp":1769443339123,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1858
|
+
{"timestamp":1769443339123,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
|
|
1859
|
+
{"timestamp":1769443339123,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
|
|
1860
|
+
{"timestamp":1769443339123,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1861
|
+
{"timestamp":1769443362209,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1862
|
+
{"timestamp":1769443362209,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
|
|
1863
|
+
{"timestamp":1769443362209,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
|
|
1864
|
+
{"timestamp":1769443362209,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1865
|
+
{"timestamp":1769444271181,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1866
|
+
{"timestamp":1769444271181,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
|
|
1867
|
+
{"timestamp":1769444271181,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
|
|
1868
|
+
{"timestamp":1769444271181,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1869
|
+
{"timestamp":1769444432266,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1870
|
+
{"timestamp":1769444432267,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
|
|
1871
|
+
{"timestamp":1769444432267,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
|
|
1872
|
+
{"timestamp":1769444432267,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1873
|
+
{"timestamp":1769444432267,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1874
|
+
{"timestamp":1769444432267,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
|
|
1875
|
+
{"timestamp":1769444432267,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
|
|
1876
|
+
{"timestamp":1769444432267,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1877
|
+
{"timestamp":1769444432267,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1878
|
+
{"timestamp":1769444432267,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
|
|
1879
|
+
{"timestamp":1769444432267,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
|
|
1880
|
+
{"timestamp":1769444432267,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1881
|
+
{"timestamp":1769444432267,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1882
|
+
{"timestamp":1769444432267,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
|
|
1883
|
+
{"timestamp":1769444432268,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
|
|
1884
|
+
{"timestamp":1769444432268,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1885
|
+
{"timestamp":1769444432268,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1886
|
+
{"timestamp":1769444432268,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
|
|
1887
|
+
{"timestamp":1769444432268,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
|
|
1888
|
+
{"timestamp":1769444432268,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1889
|
+
{"timestamp":1769444432268,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1890
|
+
{"timestamp":1769444432268,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
|
|
1891
|
+
{"timestamp":1769444432268,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
|
|
1892
|
+
{"timestamp":1769444432268,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1893
|
+
{"timestamp":1769444462348,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
1894
|
+
{"timestamp":1769444462348,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
|
|
1895
|
+
{"timestamp":1769444462348,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
|
|
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"}
|
package/scripts/hooks-system/infrastructure/orchestration/__tests__/intelligent-audit.spec.js
CHANGED
|
@@ -200,6 +200,106 @@ describe('intelligent-audit', () => {
|
|
|
200
200
|
}
|
|
201
201
|
});
|
|
202
202
|
|
|
203
|
+
it('should preserve protocol_3_questions and ai_gate violations while updating gate status on auto refresh when evidence is complete', async () => {
|
|
204
|
+
const evidencePath = path.join(process.cwd(), '.AI_EVIDENCE.json');
|
|
205
|
+
const original = fs.existsSync(evidencePath) ? fs.readFileSync(evidencePath, 'utf8') : null;
|
|
206
|
+
const previousTrigger = process.env.AUTO_EVIDENCE_TRIGGER;
|
|
207
|
+
const previousReason = process.env.AUTO_EVIDENCE_REASON;
|
|
208
|
+
const previousSummary = process.env.AUTO_EVIDENCE_SUMMARY;
|
|
209
|
+
|
|
210
|
+
const preservedQuestions = {
|
|
211
|
+
answered: true,
|
|
212
|
+
question_1_file_type: 'Preserved question 1',
|
|
213
|
+
question_2_similar_exists: 'Preserved question 2',
|
|
214
|
+
question_3_clean_architecture: 'Preserved question 3',
|
|
215
|
+
last_answered: '2026-01-01T00:00:00.000Z'
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const preservedViolations = [
|
|
219
|
+
{
|
|
220
|
+
file: 'apps/backend/index.js',
|
|
221
|
+
line: 10,
|
|
222
|
+
severity: 'HIGH',
|
|
223
|
+
rule_id: 'backend.sample.rule',
|
|
224
|
+
message: 'Preserved violation',
|
|
225
|
+
category: 'backend.sample',
|
|
226
|
+
intelligent_evaluation: false,
|
|
227
|
+
severity_score: 10
|
|
228
|
+
}
|
|
229
|
+
];
|
|
230
|
+
|
|
231
|
+
const completeEvidence = {
|
|
232
|
+
timestamp: '2026-01-01T00:00:00.000Z',
|
|
233
|
+
rules_read: [{ file: 'rulesgold.mdc', sha256: 'abc', verified: true }],
|
|
234
|
+
protocol_3_questions: preservedQuestions,
|
|
235
|
+
ai_gate: {
|
|
236
|
+
status: 'ALLOWED',
|
|
237
|
+
scope: 'staging',
|
|
238
|
+
last_check: '2026-01-01T00:00:00.000Z',
|
|
239
|
+
violations: preservedViolations,
|
|
240
|
+
instruction: 'x',
|
|
241
|
+
mandatory: true
|
|
242
|
+
},
|
|
243
|
+
severity_metrics: {
|
|
244
|
+
last_updated: '2026-01-01T00:00:00.000Z',
|
|
245
|
+
total_violations: 1,
|
|
246
|
+
by_severity: { CRITICAL: 0, HIGH: 1, MEDIUM: 0, LOW: 0 }
|
|
247
|
+
},
|
|
248
|
+
token_usage: {
|
|
249
|
+
estimated: 100,
|
|
250
|
+
percent_used: 1,
|
|
251
|
+
remaining: 999
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
try {
|
|
256
|
+
process.env.AUTO_EVIDENCE_TRIGGER = 'auto';
|
|
257
|
+
process.env.AUTO_EVIDENCE_REASON = 'auto_refresh';
|
|
258
|
+
process.env.AUTO_EVIDENCE_SUMMARY = 'Automatic evidence refresh';
|
|
259
|
+
|
|
260
|
+
fs.writeFileSync(evidencePath, JSON.stringify(completeEvidence, null, 2));
|
|
261
|
+
|
|
262
|
+
const mod = require('../intelligent-audit');
|
|
263
|
+
const incomingViolations = [
|
|
264
|
+
{ severity: 'CRITICAL', ruleId: 'rule.critical', filePath: 'apps/a.ts', line: 1, message: 'c' }
|
|
265
|
+
];
|
|
266
|
+
|
|
267
|
+
await mod.updateAIEvidence(incomingViolations, { passed: false, blockedBy: 'critical' }, { estimated: 10, percentUsed: 10, remaining: 90 });
|
|
268
|
+
|
|
269
|
+
const updated = JSON.parse(fs.readFileSync(evidencePath, 'utf8'));
|
|
270
|
+
|
|
271
|
+
expect(updated.protocol_3_questions).toEqual(preservedQuestions);
|
|
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);
|
|
275
|
+
expect(updated.timestamp).not.toBe(completeEvidence.timestamp);
|
|
276
|
+
} finally {
|
|
277
|
+
if (previousTrigger === undefined) {
|
|
278
|
+
delete process.env.AUTO_EVIDENCE_TRIGGER;
|
|
279
|
+
} else {
|
|
280
|
+
process.env.AUTO_EVIDENCE_TRIGGER = previousTrigger;
|
|
281
|
+
}
|
|
282
|
+
if (previousReason === undefined) {
|
|
283
|
+
delete process.env.AUTO_EVIDENCE_REASON;
|
|
284
|
+
} else {
|
|
285
|
+
process.env.AUTO_EVIDENCE_REASON = previousReason;
|
|
286
|
+
}
|
|
287
|
+
if (previousSummary === undefined) {
|
|
288
|
+
delete process.env.AUTO_EVIDENCE_SUMMARY;
|
|
289
|
+
} else {
|
|
290
|
+
process.env.AUTO_EVIDENCE_SUMMARY = previousSummary;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (original === null) {
|
|
294
|
+
if (fs.existsSync(evidencePath)) {
|
|
295
|
+
fs.unlinkSync(evidencePath);
|
|
296
|
+
}
|
|
297
|
+
} else {
|
|
298
|
+
fs.writeFileSync(evidencePath, original);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
|
|
203
303
|
it('should refresh root timestamp when updating .AI_EVIDENCE.json', async () => {
|
|
204
304
|
const evidencePath = path.join(process.cwd(), '.AI_EVIDENCE.json');
|
|
205
305
|
const previous = {
|
|
@@ -175,6 +175,31 @@ function preserveOrInitHumanIntent(existingEvidence) {
|
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
+
function hasNonEmptyText(value) {
|
|
179
|
+
return typeof value === 'string' && value.trim().length > 0;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function isProtocolQuestionsComplete(protocol) {
|
|
183
|
+
if (!protocol || typeof protocol !== 'object') return false;
|
|
184
|
+
if (protocol.answered !== true) return false;
|
|
185
|
+
return hasNonEmptyText(protocol.question_1_file_type)
|
|
186
|
+
&& hasNonEmptyText(protocol.question_2_similar_exists)
|
|
187
|
+
&& hasNonEmptyText(protocol.question_3_clean_architecture);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function isEvidenceCompleteForAutoRefresh(evidence) {
|
|
191
|
+
if (!evidence || typeof evidence !== 'object') return false;
|
|
192
|
+
const rulesRead = evidence.rules_read;
|
|
193
|
+
const gate = evidence.ai_gate;
|
|
194
|
+
return isProtocolQuestionsComplete(evidence.protocol_3_questions)
|
|
195
|
+
&& Array.isArray(rulesRead)
|
|
196
|
+
&& rulesRead.length > 0
|
|
197
|
+
&& gate
|
|
198
|
+
&& typeof gate === 'object'
|
|
199
|
+
&& typeof gate.status === 'string'
|
|
200
|
+
&& Array.isArray(gate.violations);
|
|
201
|
+
}
|
|
202
|
+
|
|
178
203
|
function detectPlatformsFromStagedFiles(stagedFiles) {
|
|
179
204
|
const platforms = new Set();
|
|
180
205
|
const files = Array.isArray(stagedFiles) ? stagedFiles : [];
|
|
@@ -700,6 +725,10 @@ async function updateAIEvidence(violations, gateResult, tokenUsage) {
|
|
|
700
725
|
try {
|
|
701
726
|
const evidence = JSON.parse(fs.readFileSync(evidencePath, 'utf8'));
|
|
702
727
|
|
|
728
|
+
const autoEvidenceTrigger = String(env.get('AUTO_EVIDENCE_TRIGGER', process.env.AUTO_EVIDENCE_TRIGGER || '') || '').trim().toLowerCase();
|
|
729
|
+
const isAutoEvidenceRefresh = autoEvidenceTrigger === 'auto';
|
|
730
|
+
const preserveAutoEvidence = isAutoEvidenceRefresh && isEvidenceCompleteForAutoRefresh(evidence);
|
|
731
|
+
|
|
703
732
|
evidence.timestamp = formatLocalTimestamp();
|
|
704
733
|
|
|
705
734
|
const normSev = (s) => String(s || '').toUpperCase().trim();
|
|
@@ -824,6 +853,10 @@ async function updateAIEvidence(violations, gateResult, tokenUsage) {
|
|
|
824
853
|
mandatory: true
|
|
825
854
|
};
|
|
826
855
|
|
|
856
|
+
if (preserveAutoEvidence && existingGate && Array.isArray(existingGate.violations)) {
|
|
857
|
+
nextGate.violations = existingGate.violations;
|
|
858
|
+
}
|
|
859
|
+
|
|
827
860
|
evidence.ai_gate = preserveExistingRepoGate ? existingGate : nextGate;
|
|
828
861
|
|
|
829
862
|
const stagedFilesList = getStagedFiles();
|
|
@@ -834,19 +867,21 @@ async function updateAIEvidence(violations, gateResult, tokenUsage) {
|
|
|
834
867
|
(v.ruleId || '').includes('architecture')
|
|
835
868
|
);
|
|
836
869
|
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
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
|
+
}
|
|
850
885
|
|
|
851
886
|
const stagedFiles = getStagedFiles();
|
|
852
887
|
const platformsEvidence = buildPlatformsEvidence(stagedFiles, violations);
|
package/scripts/hooks-system/infrastructure/watchdog/__tests__/.audit-reports/token-monitor.log
CHANGED
|
@@ -181,3 +181,12 @@
|
|
|
181
181
|
{"timestamp":"2026-01-26T14:48:10.228Z","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"}}
|
|
182
182
|
{"timestamp":"2026-01-26T14:48:10.233Z","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"}}
|
|
183
183
|
{"timestamp":"2026-01-26T14:48:10.235Z","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)"}}
|
|
184
|
+
{"timestamp":"2026-01-26T16:02:19.651Z","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"}}
|
|
185
|
+
{"timestamp":"2026-01-26T16:02:19.653Z","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"}}
|
|
186
|
+
{"timestamp":"2026-01-26T16:02:19.654Z","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)"}}
|
|
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
|
+
{"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
|
+
{"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)"}}
|