pumuki-ast-hooks 5.3.29 → 5.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki-ast-hooks",
3
- "version": "5.3.29",
3
+ "version": "5.3.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": {
@@ -48,6 +48,45 @@ class McpConfigurator {
48
48
  this.logger = logger;
49
49
  }
50
50
 
51
+ resolveAutomationEntrypoint() {
52
+ // Prefer dependency-installed hook system (node_modules) to avoid requiring scripts/hooks-system in consumer repos
53
+ // Fallback to repo-local hook system if it exists.
54
+ const candidates = [
55
+ this.hookSystemRoot
56
+ ? path.join(this.hookSystemRoot, 'infrastructure', 'mcp', 'ast-intelligence-automation.js')
57
+ : null,
58
+ path.join(this.targetRoot, 'scripts', 'hooks-system', 'infrastructure', 'mcp', 'ast-intelligence-automation.js')
59
+ ].filter(Boolean);
60
+
61
+ for (const c of candidates) {
62
+ try {
63
+ if (fs.existsSync(c)) return c;
64
+ } catch {
65
+ // ignore
66
+ }
67
+ }
68
+
69
+ // Last resort: keep previous behaviour
70
+ return path.join(this.targetRoot, 'scripts/hooks-system/infrastructure/mcp/ast-intelligence-automation.js');
71
+ }
72
+
73
+ disableDuplicateServersForRepo(existing, currentServerId) {
74
+ if (!existing || !existing.mcpServers) return;
75
+
76
+ Object.entries(existing.mcpServers).forEach(([id, server]) => {
77
+ if (!server || id === currentServerId) return;
78
+ const envObj = server.env || {};
79
+ const repoRoot = envObj.REPO_ROOT;
80
+ if (repoRoot !== this.targetRoot) return;
81
+
82
+ const args0 = Array.isArray(server.args) ? String(server.args[0] || '') : '';
83
+ // Disable legacy server pointing to repo-local scripts/hooks-system when we already configure the canonical one
84
+ if (args0.includes('/scripts/hooks-system/') || args0.includes('\\scripts\\hooks-system\\')) {
85
+ server.disabled = true;
86
+ }
87
+ });
88
+ }
89
+
51
90
  getGlobalWindsurfConfigPath() {
52
91
  return path.join(os.homedir(), '.codeium', 'windsurf', 'mcp_config.json');
53
92
  }
@@ -65,12 +104,13 @@ class McpConfigurator {
65
104
  }
66
105
 
67
106
  const serverId = computeServerIdForRepo(this.targetRoot);
107
+ const entrypoint = this.resolveAutomationEntrypoint();
68
108
  const mcpConfig = {
69
109
  mcpServers: {
70
110
  [serverId]: {
71
111
  command: nodePath,
72
112
  args: [
73
- path.join(this.targetRoot, 'scripts/hooks-system/infrastructure/mcp/ast-intelligence-automation.js')
113
+ entrypoint
74
114
  ],
75
115
  env: {
76
116
  REPO_ROOT: this.targetRoot,
@@ -97,6 +137,9 @@ class McpConfigurator {
97
137
  const existing = JSON.parse(fs.readFileSync(globalConfigPath, 'utf8'));
98
138
  if (!existing.mcpServers) existing.mcpServers = {};
99
139
 
140
+ // Prevent duplicate MCP servers for the same repoRoot by disabling legacy entries.
141
+ this.disableDuplicateServersForRepo(existing, serverId);
142
+
100
143
  existing.mcpServers[serverId] = mcpConfig.mcpServers[serverId];
101
144
 
102
145
  fs.writeFileSync(globalConfigPath, JSON.stringify(existing, null, 2));