pumuki-ast-hooks 5.5.28 → 5.5.30

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.
@@ -597,7 +597,7 @@ The library includes a version checker to detect if updates are available:
597
597
 
598
598
  ```bash
599
599
  # Using npm script
600
- npm run check-version
600
+ npm run ast:check-version
601
601
 
602
602
  # Or using CLI directly
603
603
  npx ast-check-version
@@ -666,7 +666,7 @@ This ensures:
666
666
 
667
667
  ```bash
668
668
  # Check version
669
- npm run check-version
669
+ npm run ast:check-version
670
670
 
671
671
  # Verify hooks work
672
672
  git commit --allow-empty -m "test: verify hooks after update"
@@ -678,7 +678,7 @@ You can check for updates periodically:
678
678
 
679
679
  ```bash
680
680
  # Add to your workflow (weekly/monthly)
681
- npm run check-version
681
+ npm run ast:check-version
682
682
  ```
683
683
 
684
684
  ### For Local Development Installations
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki-ast-hooks",
3
- "version": "5.5.28",
3
+ "version": "5.5.30",
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": {
@@ -21,27 +21,33 @@ const COLORS = {
21
21
 
22
22
  function getInstalledVersion() {
23
23
  const projectRoot = process.cwd();
24
+ const packageNames = ['@pumuki/ast-intelligence-hooks', 'pumuki-ast-hooks'];
25
+
26
+ for (const packageName of packageNames) {
27
+ try {
28
+ const packageJsonPath = require.resolve(`${packageName}/package.json`);
29
+ const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
30
+ const packageRoot = path.dirname(path.dirname(packageJsonPath));
31
+
32
+ const projectPkgPath = path.join(projectRoot, 'package.json');
33
+ if (fs.existsSync(projectPkgPath)) {
34
+ const projectPkg = JSON.parse(fs.readFileSync(projectPkgPath, 'utf-8'));
35
+ const deps = { ...projectPkg.dependencies, ...projectPkg.devDependencies };
36
+ const depVersion = deps[packageName];
37
+
38
+ if (depVersion && depVersion.startsWith('file:')) {
39
+ return { version: pkg.version, type: 'local', path: packageRoot, packageName };
40
+ }
41
+ }
24
42
 
25
- try {
26
- const packageJsonPath = require.resolve('@pumuki/ast-intelligence-hooks/package.json');
27
- const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
28
- const packageRoot = path.dirname(path.dirname(packageJsonPath));
29
-
30
- const projectPkgPath = path.join(projectRoot, 'package.json');
31
- if (fs.existsSync(projectPkgPath)) {
32
- const projectPkg = JSON.parse(fs.readFileSync(projectPkgPath, 'utf-8'));
33
- const deps = { ...projectPkg.dependencies, ...projectPkg.devDependencies };
34
- const depVersion = deps['@pumuki/ast-intelligence-hooks'];
35
-
36
- if (depVersion && depVersion.startsWith('file:')) {
37
- return { version: pkg.version, type: 'local', path: packageRoot };
43
+ return { version: pkg.version, type: 'npm', path: packageRoot, packageName };
44
+ } catch (err) {
45
+ // Try next package name
46
+ const error = err && err.message ? err.message : String(err);
47
+ if (process.env.DEBUG) {
48
+ console.warn(`[check-version] Failed to resolve ${packageName}: ${error}`);
38
49
  }
39
50
  }
40
-
41
- return { version: pkg.version, type: 'npm', path: packageRoot };
42
- } catch (err) {
43
- err = null;
44
- // Fallback: continue with local project dependency checks
45
51
  }
46
52
 
47
53
  const projectPkgPath = path.join(projectRoot, 'package.json');
@@ -49,33 +55,43 @@ function getInstalledVersion() {
49
55
  const projectPkg = JSON.parse(fs.readFileSync(projectPkgPath, 'utf-8'));
50
56
  const deps = { ...projectPkg.dependencies, ...projectPkg.devDependencies };
51
57
 
52
- if (deps['@pumuki/ast-intelligence-hooks']) {
53
- let version = deps['@pumuki/ast-intelligence-hooks'];
58
+ for (const packageName of packageNames) {
59
+ if (deps[packageName]) {
60
+ let version = deps[packageName];
61
+
62
+ if (version.startsWith('file:')) {
63
+ const libPath = path.resolve(projectRoot, version.replace('file:', ''));
64
+ const libPackageJson = path.join(libPath, 'package.json');
65
+ if (fs.existsSync(libPackageJson)) {
66
+ const libPkg = JSON.parse(fs.readFileSync(libPackageJson, 'utf-8'));
67
+ return { version: libPkg.version, type: 'local', path: libPath, packageName };
68
+ }
69
+ return { version: 'unknown (local)', type: 'local', path: libPath, packageName };
70
+ }
54
71
 
55
- if (version.startsWith('file:')) {
56
- const libPath = path.resolve(projectRoot, version.replace('file:', ''));
57
- const libPackageJson = path.join(libPath, 'package.json');
58
- if (fs.existsSync(libPackageJson)) {
59
- const libPkg = JSON.parse(fs.readFileSync(libPackageJson, 'utf-8'));
60
- return { version: libPkg.version, type: 'local', path: libPath };
72
+ const nodeModulesPath = packageName.startsWith('@')
73
+ ? path.join(projectRoot, 'node_modules', packageName.replace('/', path.sep), 'package.json')
74
+ : path.join(projectRoot, 'node_modules', packageName, 'package.json');
75
+
76
+ if (fs.existsSync(nodeModulesPath)) {
77
+ const installedPkg = JSON.parse(fs.readFileSync(nodeModulesPath, 'utf-8'));
78
+ return { version: installedPkg.version, type: 'npm', declaredVersion: version, packageName };
61
79
  }
62
- return { version: 'unknown (local)', type: 'local', path: libPath };
63
- }
64
80
 
65
- const nodeModulesPath = path.join(projectRoot, 'node_modules', '@pumuki', 'ast-intelligence-hooks', 'package.json');
66
- if (fs.existsSync(nodeModulesPath)) {
67
- const installedPkg = JSON.parse(fs.readFileSync(nodeModulesPath, 'utf-8'));
68
- return { version: installedPkg.version, type: 'npm', declaredVersion: version };
81
+ return { version: version.replace(/^[\^~]/, ''), type: 'npm', declaredVersion: version, packageName };
69
82
  }
70
-
71
- return { version: version.replace(/^[\^~]/, ''), type: 'npm', declaredVersion: version };
72
83
  }
73
84
  }
74
85
 
75
- const nodeModulesPath = path.join(projectRoot, 'node_modules', '@pumuki', 'ast-intelligence-hooks', 'package.json');
76
- if (fs.existsSync(nodeModulesPath)) {
77
- const pkg = JSON.parse(fs.readFileSync(nodeModulesPath, 'utf-8'));
78
- return { version: pkg.version, type: 'npm' };
86
+ for (const packageName of packageNames) {
87
+ const nodeModulesPath = packageName.startsWith('@')
88
+ ? path.join(projectRoot, 'node_modules', packageName.replace('/', path.sep), 'package.json')
89
+ : path.join(projectRoot, 'node_modules', packageName, 'package.json');
90
+
91
+ if (fs.existsSync(nodeModulesPath)) {
92
+ const pkg = JSON.parse(fs.readFileSync(nodeModulesPath, 'utf-8'));
93
+ return { version: pkg.version, type: 'npm', packageName };
94
+ }
79
95
  }
80
96
 
81
97
  const scriptsPath = path.join(projectRoot, 'scripts', 'hooks-system');
@@ -44,6 +44,10 @@ class KotlinParser {
44
44
  { encoding: 'utf-8', stdio: 'pipe' }
45
45
  );
46
46
  } catch (error) {
47
+ const errorMsg = error && error.message ? error.message : String(error);
48
+ if (process.env.DEBUG) {
49
+ console.warn(`[kotlin-parser] Detekt execution failed for ${filePath}: ${errorMsg}`);
50
+ }
47
51
  }
48
52
 
49
53
  if (!fs.existsSync(tmpXml)) {
@@ -570,7 +570,10 @@ function sendAuditNotification(totalViolations, levelTotals) {
570
570
  level
571
571
  });
572
572
  } catch (error) {
573
- // Silent fail - notifications are optional
573
+ const errorMsg = error && error.message ? error.message : String(error);
574
+ if (process.env.DEBUG) {
575
+ console.warn(`[ast-intelligence] Notification failed (optional): ${errorMsg}`);
576
+ }
574
577
  }
575
578
  }
576
579
 
@@ -157,7 +157,10 @@ function getBranchStateSafe(gitQuery, repoRoot, branch) {
157
157
  try {
158
158
  return gitQuery.getBranchState(branch);
159
159
  } catch (error) {
160
- // Fall through to CLI-based state
160
+ const errorMsg = error && error.message ? error.message : String(error);
161
+ if (process.env.DEBUG) {
162
+ console.warn(`[ast-intelligence-automation] gitQuery.getBranchState failed, falling through to CLI: ${errorMsg}`);
163
+ }
161
164
  }
162
165
  }
163
166