pumuki-ast-hooks 6.1.6 → 6.1.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/README.md CHANGED
@@ -16,9 +16,10 @@ Portable, project‑agnostic, multi‑platform enterprise framework to govern AI
16
16
  ## Quick Start (30–60s)
17
17
 
18
18
  ```bash
19
+ git init
19
20
  npm install --save-dev pumuki-ast-hooks
20
- npm run install-hooks
21
- npx ast-hooks
21
+ npx ast-install
22
+ npx ast-hooks audit
22
23
  ```
23
24
 
24
25
  Default installation mode is `npm-runtime`.
@@ -26,7 +27,7 @@ Default installation mode is `npm-runtime`.
26
27
  To opt into an embedded runtime copy (`vendored` mode):
27
28
 
28
29
  ```bash
29
- HOOK_INSTALL_MODE=vendored npm run install-hooks
30
+ HOOK_INSTALL_MODE=vendored npx ast-install
30
31
  ```
31
32
 
32
33
  ---
package/bin/uninstall.js CHANGED
File without changes
@@ -84,11 +84,11 @@ The installer will detect if Git is missing and show a clear warning:
84
84
  ### Option 1: Local Installation (Recommended)
85
85
 
86
86
  ```bash
87
- # Install as development dependency
87
+ # Install as dev dependency
88
88
  npm install --save-dev pumuki-ast-hooks
89
89
 
90
90
  # Configure hooks
91
- npm run install-hooks
91
+ npx ast-install
92
92
  ```
93
93
 
94
94
  By default, the installer uses npm-runtime mode (no embedded copy of `scripts/hooks-system` into your project). To use the vendored mode (embedded runtime), run the installer with `HOOK_INSTALL_MODE=vendored`.
package/docs/USAGE.md CHANGED
@@ -17,8 +17,9 @@
17
17
  ### Step 1: Install
18
18
 
19
19
  ```bash
20
+ git init
20
21
  npm install --save-dev pumuki-ast-hooks
21
- npm run install-hooks
22
+ npx ast-install
22
23
  ```
23
24
 
24
25
  ### Step 2: Make a commit
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki-ast-hooks",
3
- "version": "6.1.6",
3
+ "version": "6.1.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": {
@@ -39,3 +39,4 @@
39
39
  {"timestamp":"2026-01-14T22:23:58.130Z","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":{}}
40
40
  {"timestamp":"2026-01-15T07:43:05.309Z","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":{}}
41
41
  {"timestamp":"2026-01-15T07:49:00.777Z","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":{}}
42
+ {"timestamp":"2026-01-15T09:57:40.478Z","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":{}}
@@ -166,3 +166,7 @@
166
166
  {"timestamp":"2026-01-15T07:49:00.931Z","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":{}}
167
167
  {"timestamp":"2026-01-15T07:49:00.931Z","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":{}}
168
168
  {"timestamp":"2026-01-15T07:49:00.931Z","level":"info","component":"InstallWizard","event":"INSTALL_WIZARD_COMPLETED","data":{},"context":{}}
169
+ {"timestamp":"2026-01-15T09:57:40.584Z","level":"info","component":"InstallWizard","event":"INSTALL_WIZARD_START","data":{"repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"},"context":{}}
170
+ {"timestamp":"2026-01-15T09:57:40.597Z","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":{}}
171
+ {"timestamp":"2026-01-15T09:57:40.598Z","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":{}}
172
+ {"timestamp":"2026-01-15T09:57:40.598Z","level":"info","component":"InstallWizard","event":"INSTALL_WIZARD_COMPLETED","data":{},"context":{}}
@@ -1250,3 +1250,27 @@
1250
1250
  {"timestamp":1768463340777,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
1251
1251
  {"timestamp":1768463340777,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
1252
1252
  {"timestamp":1768463340777,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1253
+ {"timestamp":1768471060475,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1254
+ {"timestamp":1768471060475,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
1255
+ {"timestamp":1768471060475,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
1256
+ {"timestamp":1768471060475,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1257
+ {"timestamp":1768471060476,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1258
+ {"timestamp":1768471060476,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
1259
+ {"timestamp":1768471060476,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
1260
+ {"timestamp":1768471060476,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1261
+ {"timestamp":1768471060476,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1262
+ {"timestamp":1768471060476,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
1263
+ {"timestamp":1768471060476,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
1264
+ {"timestamp":1768471060476,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1265
+ {"timestamp":1768471060476,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1266
+ {"timestamp":1768471060476,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
1267
+ {"timestamp":1768471060476,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
1268
+ {"timestamp":1768471060476,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1269
+ {"timestamp":1768471060476,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1270
+ {"timestamp":1768471060476,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
1271
+ {"timestamp":1768471060477,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
1272
+ {"timestamp":1768471060477,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1273
+ {"timestamp":1768471060477,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
1274
+ {"timestamp":1768471060477,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
1275
+ {"timestamp":1768471060477,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
1276
+ {"timestamp":1768471060477,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
@@ -118,15 +118,15 @@ class ConfigurationGeneratorService {
118
118
  ? 'scripts/hooks-system'
119
119
  : 'node_modules/pumuki-ast-hooks/scripts/hooks-system';
120
120
 
121
- packageJson.scripts['ast:refresh'] = `node ${base}/bin/update-evidence.sh`;
122
- packageJson.scripts['ast:audit'] = `node ${base}/infrastructure/ast/ast-intelligence.js`;
123
- packageJson.scripts['ast:guard:start'] = `bash ${base}/bin/evidence-guard start`;
124
- packageJson.scripts['ast:guard:stop'] = `bash ${base}/bin/evidence-guard stop`;
125
- packageJson.scripts['ast:guard:restart'] = `bash ${base}/bin/evidence-guard restart`;
126
- packageJson.scripts['ast:guard:status'] = `bash ${base}/bin/evidence-guard status`;
127
- packageJson.scripts['ast:guard:logs'] = `bash ${base}/bin/evidence-guard logs`;
128
- packageJson.scripts['ast:check-version'] = `node ${base}/bin/check-version.js`;
129
- packageJson.scripts['ast:gitflow'] = `node ${base}/bin/gitflow-cycle.js`;
121
+ packageJson.scripts['ast:refresh'] = `node "${base}/bin/update-evidence.sh"`;
122
+ packageJson.scripts['ast:audit'] = `node "${base}/infrastructure/ast/ast-intelligence.js"`;
123
+ packageJson.scripts['ast:guard:start'] = `bash "${base}/bin/evidence-guard" start`;
124
+ packageJson.scripts['ast:guard:stop'] = `bash "${base}/bin/evidence-guard" stop`;
125
+ packageJson.scripts['ast:guard:restart'] = `bash "${base}/bin/evidence-guard" restart`;
126
+ packageJson.scripts['ast:guard:status'] = `bash "${base}/bin/evidence-guard" status`;
127
+ packageJson.scripts['ast:guard:logs'] = `bash "${base}/bin/evidence-guard" logs`;
128
+ packageJson.scripts['ast:check-version'] = `node "${base}/bin/check-version.js"`;
129
+ packageJson.scripts['ast:gitflow'] = `node "${base}/bin/gitflow-cycle.js"`;
130
130
 
131
131
  fs.writeFileSync(projectPackageJsonPath, JSON.stringify(packageJson, null, 2));
132
132
  this.logSuccess('npm scripts added');
@@ -0,0 +1,43 @@
1
+ const { execFileSync } = require('child_process');
2
+ const fs = require('fs');
3
+ const os = require('os');
4
+ const path = require('path');
5
+
6
+ function makeSUT() {
7
+ const workspaceRoot = path.resolve(__dirname, '../../../..');
8
+ const guardScriptPath = path.join(workspaceRoot, 'scripts', 'hooks-system', 'bin', 'evidence-guard');
9
+
10
+ const projectRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'pumuki evidence guard project '));
11
+ fs.writeFileSync(path.join(projectRoot, 'package.json'), JSON.stringify({ name: 'tmp', version: '0.0.0' }));
12
+
13
+ const pidFilePath = path.join(projectRoot, '.evidence-guard.pid');
14
+ fs.writeFileSync(pidFilePath, String(process.pid));
15
+
16
+ return { guardScriptPath, projectRoot, pidFilePath };
17
+ }
18
+
19
+ describe('evidence-guard wrapper', () => {
20
+ it('should resolve project root from cwd (supports paths with spaces)', () => {
21
+ const { guardScriptPath, projectRoot } = makeSUT();
22
+
23
+ const output = execFileSync('bash', [guardScriptPath, 'status'], {
24
+ cwd: projectRoot,
25
+ encoding: 'utf8'
26
+ });
27
+
28
+ expect(output).toContain('Evidence guard is running');
29
+ });
30
+
31
+ it('should find PID file in project root with spaces in path', () => {
32
+ const { guardScriptPath, projectRoot, pidFilePath } = makeSUT();
33
+
34
+ expect(fs.existsSync(pidFilePath)).toBe(true);
35
+
36
+ const output = execFileSync('bash', [guardScriptPath, 'status'], {
37
+ cwd: projectRoot,
38
+ encoding: 'utf8'
39
+ });
40
+
41
+ expect(output).toContain(`PID: ${process.pid}`);
42
+ });
43
+ });
@@ -1,7 +1,15 @@
1
1
  #!/bin/bash
2
2
 
3
3
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
4
- PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
4
+
5
+ PROJECT_ROOT="$(pwd)"
6
+ while [ "$PROJECT_ROOT" != "/" ] && [ ! -f "$PROJECT_ROOT/package.json" ]; do
7
+ PROJECT_ROOT="$(dirname "$PROJECT_ROOT")"
8
+ done
9
+ if [ ! -f "$PROJECT_ROOT/package.json" ]; then
10
+ PROJECT_ROOT="$(pwd)"
11
+ fi
12
+
5
13
  GUARD_SCRIPT="$SCRIPT_DIR/../infrastructure/daemons/evidence-guard.js"
6
14
  PID_FILE="$PROJECT_ROOT/.evidence-guard.pid"
7
15
  LOG_FILE="$PROJECT_ROOT/.evidence-guard.log"
@@ -121,3 +121,6 @@
121
121
  {"timestamp":"2026-01-15T07:49:02.751Z","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"}}
122
122
  {"timestamp":"2026-01-15T07:49:02.752Z","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"}}
123
123
  {"timestamp":"2026-01-15T07:49:02.753Z","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)"}}
124
+ {"timestamp":"2026-01-15T09:57:43.821Z","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"}}
125
+ {"timestamp":"2026-01-15T09:57:43.823Z","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"}}
126
+ {"timestamp":"2026-01-15T09:57:43.823Z","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)"}}