pumuki-ast-hooks 5.3.2 → 5.3.3
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 +1 -1
- package/scripts/hooks-system/.AI_TOKEN_STATUS.txt +1 -1
- package/scripts/hooks-system/.audit-reports/notifications.log +11 -0
- package/scripts/hooks-system/.audit-reports/token-monitor.log +33 -0
- package/scripts/hooks-system/infrastructure/mcp/ast-intelligence-automation.js +49 -41
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pumuki-ast-hooks",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.3",
|
|
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": {
|
|
@@ -481,3 +481,14 @@
|
|
|
481
481
|
{"timestamp":"2025-12-29T13:54:39.211Z","level":"debug","component":"NotificationCenter","event":"Notification enqueued","data":{"id":"7e2ce29d-3424-4af6-b835-c22cd6e493f1","type":"token_ok"},"context":{}}
|
|
482
482
|
{"timestamp":"2025-12-29T13:57:39.324Z","level":"debug","component":"NotificationCenter","event":"Notification enqueued","data":{"id":"6d7c9c64-81ca-4e79-b063-24bcc30eee7d","type":"token_ok"},"context":{}}
|
|
483
483
|
{"timestamp":"2025-12-29T14:00:39.438Z","level":"debug","component":"NotificationCenter","event":"Notification enqueued","data":{"id":"c7c94007-deae-40d7-bea1-479394e06bb2","type":"token_ok"},"context":{}}
|
|
484
|
+
{"timestamp":"2025-12-29T14:03:39.550Z","level":"debug","component":"NotificationCenter","event":"Notification enqueued","data":{"id":"1e2e518f-08c1-481e-87c8-8c8bc7ae41af","type":"token_ok"},"context":{}}
|
|
485
|
+
{"timestamp":"2025-12-29T14:06:39.659Z","level":"debug","component":"NotificationCenter","event":"Notification enqueued","data":{"id":"10803c2c-c480-4a97-b9fd-a3aa62024da2","type":"token_ok"},"context":{}}
|
|
486
|
+
{"timestamp":"2025-12-29T14:09:39.755Z","level":"debug","component":"NotificationCenter","event":"Notification enqueued","data":{"id":"4ef7cd3a-8698-4f92-8a2b-7fed6186850f","type":"token_ok"},"context":{}}
|
|
487
|
+
{"timestamp":"2025-12-29T14:12:39.863Z","level":"debug","component":"NotificationCenter","event":"Notification enqueued","data":{"id":"5b8049b8-709c-4a78-8b86-1626fc33ec6b","type":"token_ok"},"context":{}}
|
|
488
|
+
{"timestamp":"2025-12-29T14:15:39.971Z","level":"debug","component":"NotificationCenter","event":"Notification enqueued","data":{"id":"dae0457b-df54-4e9c-bf3a-d56c3adb562d","type":"token_ok"},"context":{}}
|
|
489
|
+
{"timestamp":"2025-12-29T14:18:40.089Z","level":"debug","component":"NotificationCenter","event":"Notification enqueued","data":{"id":"b1d5d23f-4a73-4886-8ec7-4f3adb5a65bc","type":"token_ok"},"context":{}}
|
|
490
|
+
{"timestamp":"2025-12-29T14:21:40.200Z","level":"debug","component":"NotificationCenter","event":"Notification enqueued","data":{"id":"da584244-c009-40c6-b353-5ce27b4bd134","type":"token_ok"},"context":{}}
|
|
491
|
+
{"timestamp":"2025-12-29T14:24:40.314Z","level":"debug","component":"NotificationCenter","event":"Notification enqueued","data":{"id":"af92a572-3663-49c3-b220-f95d1d996055","type":"token_ok"},"context":{}}
|
|
492
|
+
{"timestamp":"2025-12-29T14:27:40.425Z","level":"debug","component":"NotificationCenter","event":"Notification enqueued","data":{"id":"377d5821-ea01-4d97-909f-54b6a16b16b9","type":"token_ok"},"context":{}}
|
|
493
|
+
{"timestamp":"2025-12-29T14:30:40.543Z","level":"debug","component":"NotificationCenter","event":"Notification enqueued","data":{"id":"67147292-fe08-44c1-80e7-cfab39ed1f72","type":"token_ok"},"context":{}}
|
|
494
|
+
{"timestamp":"2025-12-29T14:33:40.651Z","level":"debug","component":"NotificationCenter","event":"Notification enqueued","data":{"id":"7f800d7b-29ca-474c-bd11-d2408767ce77","type":"token_ok"},"context":{}}
|
|
@@ -1447,3 +1447,36 @@
|
|
|
1447
1447
|
{"timestamp":"2025-12-29T14:00:39.428Z","level":"debug","component":"TokenMonitor","event":"CURSOR_SERVICE_USING_FILE","data":{"usage":{"tokensUsed":0,"maxTokens":1000000,"percentUsed":55.519975,"timestamp":"2025-12-25T22:29:39.685Z","source":"file","untrusted":false}},"context":{}}
|
|
1448
1448
|
{"timestamp":"2025-12-29T14:00:39.429Z","level":"debug","component":"TokenMonitor","event":"TOKEN_MONITOR_METRICS","data":{"timestamp":"2025-12-25T22:29:39.685Z","tokensUsed":0,"maxTokens":1000000,"percentUsed":0,"remainingTokens":1000000,"level":"ok","source":"file","stale":true,"untrusted":false},"context":{}}
|
|
1449
1449
|
{"timestamp":"2025-12-29T14:00:39.438Z","level":"info","component":"TokenMonitor","event":"TOKEN_MONITOR_RESULT","data":{"level":"ok","percentUsed":0,"tokensUsed":0,"maxTokens":1000000,"source":"file","stale":true,"untrusted":false},"context":{"message":"Result level=ok percent=0% used=0/1000000 source=file (stale)"}}
|
|
1450
|
+
{"timestamp":"2025-12-29T14:03:39.541Z","level":"debug","component":"TokenMonitor","event":"CURSOR_SERVICE_USING_FILE","data":{"usage":{"tokensUsed":0,"maxTokens":1000000,"percentUsed":55.519975,"timestamp":"2025-12-25T22:29:39.685Z","source":"file","untrusted":false}},"context":{}}
|
|
1451
|
+
{"timestamp":"2025-12-29T14:03:39.542Z","level":"debug","component":"TokenMonitor","event":"TOKEN_MONITOR_METRICS","data":{"timestamp":"2025-12-25T22:29:39.685Z","tokensUsed":0,"maxTokens":1000000,"percentUsed":0,"remainingTokens":1000000,"level":"ok","source":"file","stale":true,"untrusted":false},"context":{}}
|
|
1452
|
+
{"timestamp":"2025-12-29T14:03:39.551Z","level":"info","component":"TokenMonitor","event":"TOKEN_MONITOR_RESULT","data":{"level":"ok","percentUsed":0,"tokensUsed":0,"maxTokens":1000000,"source":"file","stale":true,"untrusted":false},"context":{"message":"Result level=ok percent=0% used=0/1000000 source=file (stale)"}}
|
|
1453
|
+
{"timestamp":"2025-12-29T14:06:39.649Z","level":"debug","component":"TokenMonitor","event":"CURSOR_SERVICE_USING_FILE","data":{"usage":{"tokensUsed":0,"maxTokens":1000000,"percentUsed":55.519975,"timestamp":"2025-12-25T22:29:39.685Z","source":"file","untrusted":false}},"context":{}}
|
|
1454
|
+
{"timestamp":"2025-12-29T14:06:39.650Z","level":"debug","component":"TokenMonitor","event":"TOKEN_MONITOR_METRICS","data":{"timestamp":"2025-12-25T22:29:39.685Z","tokensUsed":0,"maxTokens":1000000,"percentUsed":0,"remainingTokens":1000000,"level":"ok","source":"file","stale":true,"untrusted":false},"context":{}}
|
|
1455
|
+
{"timestamp":"2025-12-29T14:06:39.659Z","level":"info","component":"TokenMonitor","event":"TOKEN_MONITOR_RESULT","data":{"level":"ok","percentUsed":0,"tokensUsed":0,"maxTokens":1000000,"source":"file","stale":true,"untrusted":false},"context":{"message":"Result level=ok percent=0% used=0/1000000 source=file (stale)"}}
|
|
1456
|
+
{"timestamp":"2025-12-29T14:09:39.744Z","level":"debug","component":"TokenMonitor","event":"CURSOR_SERVICE_USING_FILE","data":{"usage":{"tokensUsed":0,"maxTokens":1000000,"percentUsed":55.519975,"timestamp":"2025-12-25T22:29:39.685Z","source":"file","untrusted":false}},"context":{}}
|
|
1457
|
+
{"timestamp":"2025-12-29T14:09:39.745Z","level":"debug","component":"TokenMonitor","event":"TOKEN_MONITOR_METRICS","data":{"timestamp":"2025-12-25T22:29:39.685Z","tokensUsed":0,"maxTokens":1000000,"percentUsed":0,"remainingTokens":1000000,"level":"ok","source":"file","stale":true,"untrusted":false},"context":{}}
|
|
1458
|
+
{"timestamp":"2025-12-29T14:09:39.755Z","level":"info","component":"TokenMonitor","event":"TOKEN_MONITOR_RESULT","data":{"level":"ok","percentUsed":0,"tokensUsed":0,"maxTokens":1000000,"source":"file","stale":true,"untrusted":false},"context":{"message":"Result level=ok percent=0% used=0/1000000 source=file (stale)"}}
|
|
1459
|
+
{"timestamp":"2025-12-29T14:12:39.852Z","level":"debug","component":"TokenMonitor","event":"CURSOR_SERVICE_USING_FILE","data":{"usage":{"tokensUsed":0,"maxTokens":1000000,"percentUsed":55.519975,"timestamp":"2025-12-25T22:29:39.685Z","source":"file","untrusted":false}},"context":{}}
|
|
1460
|
+
{"timestamp":"2025-12-29T14:12:39.853Z","level":"debug","component":"TokenMonitor","event":"TOKEN_MONITOR_METRICS","data":{"timestamp":"2025-12-25T22:29:39.685Z","tokensUsed":0,"maxTokens":1000000,"percentUsed":0,"remainingTokens":1000000,"level":"ok","source":"file","stale":true,"untrusted":false},"context":{}}
|
|
1461
|
+
{"timestamp":"2025-12-29T14:12:39.864Z","level":"info","component":"TokenMonitor","event":"TOKEN_MONITOR_RESULT","data":{"level":"ok","percentUsed":0,"tokensUsed":0,"maxTokens":1000000,"source":"file","stale":true,"untrusted":false},"context":{"message":"Result level=ok percent=0% used=0/1000000 source=file (stale)"}}
|
|
1462
|
+
{"timestamp":"2025-12-29T14:15:39.960Z","level":"debug","component":"TokenMonitor","event":"CURSOR_SERVICE_USING_FILE","data":{"usage":{"tokensUsed":0,"maxTokens":1000000,"percentUsed":55.519975,"timestamp":"2025-12-25T22:29:39.685Z","source":"file","untrusted":false}},"context":{}}
|
|
1463
|
+
{"timestamp":"2025-12-29T14:15:39.961Z","level":"debug","component":"TokenMonitor","event":"TOKEN_MONITOR_METRICS","data":{"timestamp":"2025-12-25T22:29:39.685Z","tokensUsed":0,"maxTokens":1000000,"percentUsed":0,"remainingTokens":1000000,"level":"ok","source":"file","stale":true,"untrusted":false},"context":{}}
|
|
1464
|
+
{"timestamp":"2025-12-29T14:15:39.972Z","level":"info","component":"TokenMonitor","event":"TOKEN_MONITOR_RESULT","data":{"level":"ok","percentUsed":0,"tokensUsed":0,"maxTokens":1000000,"source":"file","stale":true,"untrusted":false},"context":{"message":"Result level=ok percent=0% used=0/1000000 source=file (stale)"}}
|
|
1465
|
+
{"timestamp":"2025-12-29T14:18:40.079Z","level":"debug","component":"TokenMonitor","event":"CURSOR_SERVICE_USING_FILE","data":{"usage":{"tokensUsed":0,"maxTokens":1000000,"percentUsed":55.519975,"timestamp":"2025-12-25T22:29:39.685Z","source":"file","untrusted":false}},"context":{}}
|
|
1466
|
+
{"timestamp":"2025-12-29T14:18:40.080Z","level":"debug","component":"TokenMonitor","event":"TOKEN_MONITOR_METRICS","data":{"timestamp":"2025-12-25T22:29:39.685Z","tokensUsed":0,"maxTokens":1000000,"percentUsed":0,"remainingTokens":1000000,"level":"ok","source":"file","stale":true,"untrusted":false},"context":{}}
|
|
1467
|
+
{"timestamp":"2025-12-29T14:18:40.089Z","level":"info","component":"TokenMonitor","event":"TOKEN_MONITOR_RESULT","data":{"level":"ok","percentUsed":0,"tokensUsed":0,"maxTokens":1000000,"source":"file","stale":true,"untrusted":false},"context":{"message":"Result level=ok percent=0% used=0/1000000 source=file (stale)"}}
|
|
1468
|
+
{"timestamp":"2025-12-29T14:21:40.190Z","level":"debug","component":"TokenMonitor","event":"CURSOR_SERVICE_USING_FILE","data":{"usage":{"tokensUsed":0,"maxTokens":1000000,"percentUsed":55.519975,"timestamp":"2025-12-25T22:29:39.685Z","source":"file","untrusted":false}},"context":{}}
|
|
1469
|
+
{"timestamp":"2025-12-29T14:21:40.191Z","level":"debug","component":"TokenMonitor","event":"TOKEN_MONITOR_METRICS","data":{"timestamp":"2025-12-25T22:29:39.685Z","tokensUsed":0,"maxTokens":1000000,"percentUsed":0,"remainingTokens":1000000,"level":"ok","source":"file","stale":true,"untrusted":false},"context":{}}
|
|
1470
|
+
{"timestamp":"2025-12-29T14:21:40.201Z","level":"info","component":"TokenMonitor","event":"TOKEN_MONITOR_RESULT","data":{"level":"ok","percentUsed":0,"tokensUsed":0,"maxTokens":1000000,"source":"file","stale":true,"untrusted":false},"context":{"message":"Result level=ok percent=0% used=0/1000000 source=file (stale)"}}
|
|
1471
|
+
{"timestamp":"2025-12-29T14:24:40.304Z","level":"debug","component":"TokenMonitor","event":"CURSOR_SERVICE_USING_FILE","data":{"usage":{"tokensUsed":0,"maxTokens":1000000,"percentUsed":55.519975,"timestamp":"2025-12-25T22:29:39.685Z","source":"file","untrusted":false}},"context":{}}
|
|
1472
|
+
{"timestamp":"2025-12-29T14:24:40.305Z","level":"debug","component":"TokenMonitor","event":"TOKEN_MONITOR_METRICS","data":{"timestamp":"2025-12-25T22:29:39.685Z","tokensUsed":0,"maxTokens":1000000,"percentUsed":0,"remainingTokens":1000000,"level":"ok","source":"file","stale":true,"untrusted":false},"context":{}}
|
|
1473
|
+
{"timestamp":"2025-12-29T14:24:40.314Z","level":"info","component":"TokenMonitor","event":"TOKEN_MONITOR_RESULT","data":{"level":"ok","percentUsed":0,"tokensUsed":0,"maxTokens":1000000,"source":"file","stale":true,"untrusted":false},"context":{"message":"Result level=ok percent=0% used=0/1000000 source=file (stale)"}}
|
|
1474
|
+
{"timestamp":"2025-12-29T14:27:40.415Z","level":"debug","component":"TokenMonitor","event":"CURSOR_SERVICE_USING_FILE","data":{"usage":{"tokensUsed":0,"maxTokens":1000000,"percentUsed":55.519975,"timestamp":"2025-12-25T22:29:39.685Z","source":"file","untrusted":false}},"context":{}}
|
|
1475
|
+
{"timestamp":"2025-12-29T14:27:40.416Z","level":"debug","component":"TokenMonitor","event":"TOKEN_MONITOR_METRICS","data":{"timestamp":"2025-12-25T22:29:39.685Z","tokensUsed":0,"maxTokens":1000000,"percentUsed":0,"remainingTokens":1000000,"level":"ok","source":"file","stale":true,"untrusted":false},"context":{}}
|
|
1476
|
+
{"timestamp":"2025-12-29T14:27:40.425Z","level":"info","component":"TokenMonitor","event":"TOKEN_MONITOR_RESULT","data":{"level":"ok","percentUsed":0,"tokensUsed":0,"maxTokens":1000000,"source":"file","stale":true,"untrusted":false},"context":{"message":"Result level=ok percent=0% used=0/1000000 source=file (stale)"}}
|
|
1477
|
+
{"timestamp":"2025-12-29T14:30:40.533Z","level":"debug","component":"TokenMonitor","event":"CURSOR_SERVICE_USING_FILE","data":{"usage":{"tokensUsed":0,"maxTokens":1000000,"percentUsed":55.519975,"timestamp":"2025-12-25T22:29:39.685Z","source":"file","untrusted":false}},"context":{}}
|
|
1478
|
+
{"timestamp":"2025-12-29T14:30:40.534Z","level":"debug","component":"TokenMonitor","event":"TOKEN_MONITOR_METRICS","data":{"timestamp":"2025-12-25T22:29:39.685Z","tokensUsed":0,"maxTokens":1000000,"percentUsed":0,"remainingTokens":1000000,"level":"ok","source":"file","stale":true,"untrusted":false},"context":{}}
|
|
1479
|
+
{"timestamp":"2025-12-29T14:30:40.543Z","level":"info","component":"TokenMonitor","event":"TOKEN_MONITOR_RESULT","data":{"level":"ok","percentUsed":0,"tokensUsed":0,"maxTokens":1000000,"source":"file","stale":true,"untrusted":false},"context":{"message":"Result level=ok percent=0% used=0/1000000 source=file (stale)"}}
|
|
1480
|
+
{"timestamp":"2025-12-29T14:33:40.642Z","level":"debug","component":"TokenMonitor","event":"CURSOR_SERVICE_USING_FILE","data":{"usage":{"tokensUsed":0,"maxTokens":1000000,"percentUsed":55.519975,"timestamp":"2025-12-25T22:29:39.685Z","source":"file","untrusted":false}},"context":{}}
|
|
1481
|
+
{"timestamp":"2025-12-29T14:33:40.643Z","level":"debug","component":"TokenMonitor","event":"TOKEN_MONITOR_METRICS","data":{"timestamp":"2025-12-25T22:29:39.685Z","tokensUsed":0,"maxTokens":1000000,"percentUsed":0,"remainingTokens":1000000,"level":"ok","source":"file","stale":true,"untrusted":false},"context":{}}
|
|
1482
|
+
{"timestamp":"2025-12-29T14:33:40.652Z","level":"info","component":"TokenMonitor","event":"TOKEN_MONITOR_RESULT","data":{"level":"ok","percentUsed":0,"tokensUsed":0,"maxTokens":1000000,"source":"file","stale":true,"untrusted":false},"context":{"message":"Result level=ok percent=0% used=0/1000000 source=file (stale)"}}
|
|
@@ -27,11 +27,18 @@ const { execSync } = require('child_process');
|
|
|
27
27
|
|
|
28
28
|
const MCP_VERSION = '2024-11-05';
|
|
29
29
|
|
|
30
|
-
// Configuration
|
|
31
|
-
const CompositionRoot = require('../../application/CompositionRoot');
|
|
32
|
-
|
|
30
|
+
// Configuration - LAZY LOADING to avoid blocking MCP initialization
|
|
33
31
|
const REPO_ROOT = process.env.REPO_ROOT || process.cwd();
|
|
34
|
-
|
|
32
|
+
|
|
33
|
+
// Lazy-loaded CompositionRoot - only initialized when first needed
|
|
34
|
+
let _compositionRoot = null;
|
|
35
|
+
function getCompositionRoot() {
|
|
36
|
+
if (!_compositionRoot) {
|
|
37
|
+
const CompositionRoot = require('../../application/CompositionRoot');
|
|
38
|
+
_compositionRoot = CompositionRoot.createForProduction(REPO_ROOT);
|
|
39
|
+
}
|
|
40
|
+
return _compositionRoot;
|
|
41
|
+
}
|
|
35
42
|
|
|
36
43
|
const EVIDENCE_FILE = path.join(REPO_ROOT, '.AI_EVIDENCE.json');
|
|
37
44
|
const GITFLOW_STATE_FILE = path.join(REPO_ROOT, '.git', 'gitflow-state.json');
|
|
@@ -154,15 +161,15 @@ function resolveUpdateEvidenceScript() {
|
|
|
154
161
|
|
|
155
162
|
// Lazy Loading Services
|
|
156
163
|
function getContextEngine() {
|
|
157
|
-
return
|
|
164
|
+
return getCompositionRoot().getContextDetectionEngine();
|
|
158
165
|
}
|
|
159
166
|
|
|
160
167
|
function getOrchestrator() {
|
|
161
|
-
return
|
|
168
|
+
return getCompositionRoot().getOrchestrator();
|
|
162
169
|
}
|
|
163
170
|
|
|
164
171
|
function getNotificationAdapter() {
|
|
165
|
-
return
|
|
172
|
+
return getCompositionRoot().getNotificationService();
|
|
166
173
|
}
|
|
167
174
|
|
|
168
175
|
// Polling state
|
|
@@ -183,7 +190,7 @@ const AUTO_PR_ENABLED = process.env.AUTO_PR_ENABLED === 'true';
|
|
|
183
190
|
* Helper: Send macOS notification via centralized adapter
|
|
184
191
|
*/
|
|
185
192
|
function sendNotification(title, message, sound = 'Hero') {
|
|
186
|
-
|
|
193
|
+
getCompositionRoot().getNotificationService().notify({
|
|
187
194
|
type: 'mcp_automation',
|
|
188
195
|
level: 'info',
|
|
189
196
|
title,
|
|
@@ -196,9 +203,9 @@ function sendNotification(title, message, sound = 'Hero') {
|
|
|
196
203
|
* Check evidence status
|
|
197
204
|
*/
|
|
198
205
|
function checkEvidence() {
|
|
199
|
-
const monitor =
|
|
206
|
+
const monitor = getCompositionRoot().getEvidenceMonitor();
|
|
200
207
|
const isStale = monitor.isStale();
|
|
201
|
-
const gitFlow =
|
|
208
|
+
const gitFlow = getCompositionRoot().getGitFlowService();
|
|
202
209
|
const currentBranch = gitFlow.getCurrentBranch();
|
|
203
210
|
|
|
204
211
|
if (isStale) {
|
|
@@ -217,7 +224,7 @@ function checkEvidence() {
|
|
|
217
224
|
* Auto-complete Git Flow cycle
|
|
218
225
|
*/
|
|
219
226
|
async function autoCompleteGitFlow(params) {
|
|
220
|
-
const gitFlowService =
|
|
227
|
+
const gitFlowService = getCompositionRoot().getGitFlowService();
|
|
221
228
|
const results = [];
|
|
222
229
|
const currentBranch = gitFlowService.getCurrentBranch();
|
|
223
230
|
const baseBranch = process.env.AST_BASE_BRANCH || 'develop';
|
|
@@ -235,7 +242,7 @@ async function autoCompleteGitFlow(params) {
|
|
|
235
242
|
|
|
236
243
|
if (!gitFlowService.isClean()) {
|
|
237
244
|
results.push('⚠️ Uncommitted changes detected, committing...');
|
|
238
|
-
const gitCommand =
|
|
245
|
+
const gitCommand = getCompositionRoot().getGitCommandAdapter();
|
|
239
246
|
gitCommand.addAll();
|
|
240
247
|
const message = params.commitMessage || `chore: auto-commit changes on ${currentBranch}`;
|
|
241
248
|
gitCommand.commit(message);
|
|
@@ -245,7 +252,7 @@ async function autoCompleteGitFlow(params) {
|
|
|
245
252
|
}
|
|
246
253
|
|
|
247
254
|
results.push('Pushing to origin...');
|
|
248
|
-
const gitCommand =
|
|
255
|
+
const gitCommand = getCompositionRoot().getGitCommandAdapter();
|
|
249
256
|
gitCommand.push('origin', currentBranch, { setUpstream: true });
|
|
250
257
|
results.push('✅ Pushed to origin');
|
|
251
258
|
|
|
@@ -260,7 +267,7 @@ async function autoCompleteGitFlow(params) {
|
|
|
260
267
|
|
|
261
268
|
if (params.autoMerge) {
|
|
262
269
|
results.push('Auto-merging PR...');
|
|
263
|
-
const github =
|
|
270
|
+
const github = getCompositionRoot().getGitHubAdapter();
|
|
264
271
|
github.mergePullRequest(prUrl);
|
|
265
272
|
results.push(`✅ PR merged and branch deleted`);
|
|
266
273
|
|
|
@@ -295,7 +302,7 @@ async function autoCompleteGitFlow(params) {
|
|
|
295
302
|
* Sync branches (develop ↔ main)
|
|
296
303
|
*/
|
|
297
304
|
function syncBranches(params) {
|
|
298
|
-
const gitFlowService =
|
|
305
|
+
const gitFlowService = getCompositionRoot().getGitFlowService();
|
|
299
306
|
const result = gitFlowService.syncBranches();
|
|
300
307
|
|
|
301
308
|
return {
|
|
@@ -309,11 +316,11 @@ function syncBranches(params) {
|
|
|
309
316
|
* Cleanup stale branches (local + remote)
|
|
310
317
|
*/
|
|
311
318
|
function cleanupStaleBranches(params) {
|
|
312
|
-
const gitFlowService =
|
|
319
|
+
const gitFlowService = getCompositionRoot().getGitFlowService();
|
|
313
320
|
const baseBranch = process.env.AST_BASE_BRANCH || 'develop';
|
|
314
|
-
const gitQuery =
|
|
315
|
-
const gitCommand =
|
|
316
|
-
const github =
|
|
321
|
+
const gitQuery = getCompositionRoot().getGitQueryAdapter();
|
|
322
|
+
const gitCommand = getCompositionRoot().getGitCommandAdapter();
|
|
323
|
+
const github = getCompositionRoot().getGitHubAdapter();
|
|
317
324
|
|
|
318
325
|
const results = [];
|
|
319
326
|
|
|
@@ -367,7 +374,7 @@ function cleanupStaleBranches(params) {
|
|
|
367
374
|
* Auto-execute ai-start when code files detected
|
|
368
375
|
*/
|
|
369
376
|
async function autoExecuteAIStart(params) {
|
|
370
|
-
const useCase =
|
|
377
|
+
const useCase = getCompositionRoot().getAutoExecuteAIStartUseCase();
|
|
371
378
|
|
|
372
379
|
try {
|
|
373
380
|
const result = await useCase.execute({
|
|
@@ -503,8 +510,8 @@ function checkBranchChangesCoherence(branchName, uncommittedChanges) {
|
|
|
503
510
|
* Returns BLOCKED or ALLOWED status with auto-fixes applied
|
|
504
511
|
*/
|
|
505
512
|
async function aiGateCheck() {
|
|
506
|
-
const gitFlowService =
|
|
507
|
-
const gitQuery =
|
|
513
|
+
const gitFlowService = getCompositionRoot().getGitFlowService();
|
|
514
|
+
const gitQuery = getCompositionRoot().getGitQueryAdapter();
|
|
508
515
|
const currentBranch = getCurrentGitBranch(REPO_ROOT);
|
|
509
516
|
const isProtectedBranch = ['main', 'master', 'develop'].includes(currentBranch);
|
|
510
517
|
|
|
@@ -516,7 +523,7 @@ async function aiGateCheck() {
|
|
|
516
523
|
const autoFixes = [];
|
|
517
524
|
|
|
518
525
|
// 1. Evidence Freshness Check (Auto-fix included)
|
|
519
|
-
const evidenceMonitor =
|
|
526
|
+
const evidenceMonitor = getCompositionRoot().getEvidenceMonitor();
|
|
520
527
|
if (evidenceMonitor.isStale()) {
|
|
521
528
|
try {
|
|
522
529
|
await evidenceMonitor.refresh();
|
|
@@ -541,8 +548,8 @@ async function aiGateCheck() {
|
|
|
541
548
|
}
|
|
542
549
|
|
|
543
550
|
// 3. Block Commit Use Case Integration
|
|
544
|
-
const blockCommitUseCase =
|
|
545
|
-
const astAdapter =
|
|
551
|
+
const blockCommitUseCase = getCompositionRoot().getBlockCommitUseCase();
|
|
552
|
+
const astAdapter = getCompositionRoot().getAstAdapter();
|
|
546
553
|
|
|
547
554
|
try {
|
|
548
555
|
const auditResult = await astAdapter.analyzeStagedFiles();
|
|
@@ -581,10 +588,10 @@ async function aiGateCheck() {
|
|
|
581
588
|
async function validateAndFix(params) {
|
|
582
589
|
const results = [];
|
|
583
590
|
const issues = [];
|
|
584
|
-
const gitFlowService =
|
|
585
|
-
const gitQuery =
|
|
586
|
-
const gitCommand =
|
|
587
|
-
const evidenceMonitor =
|
|
591
|
+
const gitFlowService = getCompositionRoot().getGitFlowService();
|
|
592
|
+
const gitQuery = getCompositionRoot().getGitQueryAdapter();
|
|
593
|
+
const gitCommand = getCompositionRoot().getGitCommandAdapter();
|
|
594
|
+
const evidenceMonitor = getCompositionRoot().getEvidenceMonitor();
|
|
588
595
|
|
|
589
596
|
try {
|
|
590
597
|
if (evidenceMonitor.isStale()) {
|
|
@@ -633,9 +640,10 @@ async function validateAndFix(params) {
|
|
|
633
640
|
}
|
|
634
641
|
|
|
635
642
|
/**
|
|
636
|
-
* MCP Protocol Handler
|
|
643
|
+
* MCP Protocol Handler - Direct instantiation to avoid blocking on CompositionRoot
|
|
637
644
|
*/
|
|
638
|
-
const
|
|
645
|
+
const McpProtocolHandler = require('./services/McpProtocolHandler');
|
|
646
|
+
const protocolHandler = new McpProtocolHandler(process.stdin, process.stdout);
|
|
639
647
|
|
|
640
648
|
async function handleMcpMessage(message) {
|
|
641
649
|
try {
|
|
@@ -749,8 +757,8 @@ async function handleMcpMessage(message) {
|
|
|
749
757
|
}
|
|
750
758
|
|
|
751
759
|
if (uri === 'gitflow://state') {
|
|
752
|
-
const gitFlow =
|
|
753
|
-
const gitQuery =
|
|
760
|
+
const gitFlow = getCompositionRoot().getGitFlowService();
|
|
761
|
+
const gitQuery = getCompositionRoot().getGitQueryAdapter();
|
|
754
762
|
const currentBranch = getCurrentGitBranch(REPO_ROOT);
|
|
755
763
|
const branchState = getBranchStateSafe(gitQuery, REPO_ROOT, currentBranch);
|
|
756
764
|
|
|
@@ -776,7 +784,7 @@ async function handleMcpMessage(message) {
|
|
|
776
784
|
}
|
|
777
785
|
|
|
778
786
|
if (uri === 'context://active') {
|
|
779
|
-
const orchestrator =
|
|
787
|
+
const orchestrator = getCompositionRoot().getOrchestrator();
|
|
780
788
|
try {
|
|
781
789
|
const decision = await orchestrator.analyzeContext();
|
|
782
790
|
return {
|
|
@@ -938,10 +946,10 @@ protocolHandler.start(handleMcpMessage);
|
|
|
938
946
|
setInterval(async () => {
|
|
939
947
|
try {
|
|
940
948
|
const now = Date.now();
|
|
941
|
-
const gitFlowService =
|
|
942
|
-
const gitQuery =
|
|
943
|
-
const evidenceMonitor =
|
|
944
|
-
const orchestrator =
|
|
949
|
+
const gitFlowService = getCompositionRoot().getGitFlowService();
|
|
950
|
+
const gitQuery = getCompositionRoot().getGitQueryAdapter();
|
|
951
|
+
const evidenceMonitor = getCompositionRoot().getEvidenceMonitor();
|
|
952
|
+
const orchestrator = getCompositionRoot().getOrchestrator();
|
|
945
953
|
|
|
946
954
|
const currentBranch = gitFlowService.getCurrentBranch();
|
|
947
955
|
const baseBranch = process.env.AST_BASE_BRANCH || 'develop';
|
|
@@ -1002,9 +1010,9 @@ setInterval(async () => {
|
|
|
1002
1010
|
if (now - lastAutoCommitTime < AUTO_COMMIT_INTERVAL) return;
|
|
1003
1011
|
|
|
1004
1012
|
try {
|
|
1005
|
-
const gitFlowService =
|
|
1006
|
-
const gitQuery =
|
|
1007
|
-
const gitCommand =
|
|
1013
|
+
const gitFlowService = getCompositionRoot().getGitFlowService();
|
|
1014
|
+
const gitQuery = getCompositionRoot().getGitQueryAdapter();
|
|
1015
|
+
const gitCommand = getCompositionRoot().getGitCommandAdapter();
|
|
1008
1016
|
|
|
1009
1017
|
const currentBranch = gitFlowService.getCurrentBranch();
|
|
1010
1018
|
const isFeatureBranch = currentBranch.match(/^(feature|fix|hotfix)\//);
|