pumuki-ast-hooks 5.5.58 → 5.5.65

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.
Files changed (27) hide show
  1. package/README.md +254 -1140
  2. package/docs/ARCHITECTURE.md +66 -1
  3. package/docs/TODO.md +41 -0
  4. package/docs/images/ast_intelligence_01.svg +40 -0
  5. package/docs/images/ast_intelligence_02.svg +39 -0
  6. package/docs/images/ast_intelligence_03.svg +55 -0
  7. package/docs/images/ast_intelligence_04.svg +39 -0
  8. package/docs/images/ast_intelligence_05.svg +45 -0
  9. package/docs/images/logo.png +0 -0
  10. package/package.json +2 -2
  11. package/scripts/hooks-system/.audit_tmp/hook-metrics.jsonl +16 -0
  12. package/scripts/hooks-system/application/DIValidationService.js +43 -0
  13. package/scripts/hooks-system/application/__tests__/DIValidationService.spec.js +81 -0
  14. package/scripts/hooks-system/application/services/installation/McpConfigurator.js +0 -3
  15. package/scripts/hooks-system/config/di-rules.json +42 -0
  16. package/scripts/hooks-system/domain/ports/FileSystemPort.js +19 -0
  17. package/scripts/hooks-system/domain/strategies/ConcreteDependencyStrategy.js +78 -0
  18. package/scripts/hooks-system/domain/strategies/DIStrategy.js +31 -0
  19. package/scripts/hooks-system/infrastructure/adapters/NodeFileSystemAdapter.js +28 -0
  20. package/scripts/hooks-system/infrastructure/ast/backend/ast-backend.js +16 -0
  21. package/scripts/hooks-system/infrastructure/ast/backend/detectors/god-class-detector.js +28 -8
  22. package/scripts/hooks-system/infrastructure/ast/common/ast-common.js +138 -0
  23. package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSASTIntelligentAnalyzer.js +3 -2
  24. package/scripts/hooks-system/infrastructure/ast/ios/ast-ios.js +1 -1
  25. package/scripts/hooks-system/infrastructure/ast/ios/detectors/ios-ast-intelligent-strategies.js +41 -40
  26. package/scripts/hooks-system/infrastructure/orchestration/intelligent-audit.js +87 -1
  27. package/scripts/hooks-system/infrastructure/registry/StrategyRegistry.js +63 -0
@@ -3,6 +3,8 @@
3
3
  ## Table of Contents
4
4
 
5
5
  - [High-Level Architecture](#high-level-architecture)
6
+ - [Framework Invariants](#framework-invariants)
7
+ - [Control Primitives](#control-primitives)
6
8
  - [Data Flow](#data-flow)
7
9
  - [Key Components](#key-components)
8
10
  - [Quality Gates](#quality-gates)
@@ -10,6 +12,57 @@
10
12
 
11
13
  ---
12
14
 
15
+ ## Framework Invariants
16
+
17
+ These invariants are non-negotiable. If any of them is violated, the framework is considered misconfigured.
18
+
19
+ - **Evidence is the source of truth**
20
+ `.AI_EVIDENCE.json` is the authoritative state for AI-assisted work. The framework treats chat history as untrusted.
21
+
22
+ - **Evidence freshness is mandatory**
23
+ Actions that rely on evidence must validate freshness (SLA) and surface stale conditions explicitly.
24
+
25
+ - **AI Gate is a hard control point**
26
+ The framework must be able to deterministically decide `ALLOWED` vs `BLOCKED` before risky actions.
27
+
28
+ - **Governance is Git-native**
29
+ Enforcement happens as early as possible (pre-commit / pre-push) to prevent invalid states from reaching CI/CD.
30
+
31
+ - **Dependencies must point inward**
32
+ Presentation and Infrastructure may depend on Domain and Application, but never the opposite.
33
+
34
+ ---
35
+
36
+ ## Control Primitives
37
+
38
+ Pumuki is a governance framework built around two primitives:
39
+
40
+ ### 1) AI Evidence (`.AI_EVIDENCE.json`)
41
+
42
+ Responsibilities:
43
+
44
+ - Persist project state for long-running work (multi-day, multi-chat)
45
+ - Store severity metrics, platform detection, session metadata, and workflow state
46
+ - Provide a stable input for AI clients and automation tools
47
+
48
+ Failure-mode expectations:
49
+
50
+ - If evidence cannot be read or parsed, the framework should fail safe (treat as missing) and emit a diagnosable signal (logs / guard debug log).
51
+
52
+ ### 2) AI Gate (Allow/Block)
53
+
54
+ Responsibilities:
55
+
56
+ - Provide deterministic control over AI-assisted actions
57
+ - Encode mandatory rules (by platform/scope)
58
+ - Enforce blocking thresholds (typically `CRITICAL`/`HIGH`)
59
+
60
+ Failure-mode expectations:
61
+
62
+ - If gate state cannot be loaded, the framework should fail safe and avoid proceeding with protected operations.
63
+
64
+ ---
65
+
13
66
  ## High-Level Architecture
14
67
 
15
68
  The system follows **strict Clean Architecture** with 4 well-defined layers:
@@ -128,6 +181,7 @@ flowchart LR
128
181
  ```
129
182
 
130
183
  **Pipeline Steps:**
184
+
131
185
  1. **AST Analysis**: Parse code and extract violations
132
186
  2. **Severity Evaluation**: Apply intelligent severity evaluation
133
187
  3. **Gate Policies**: Apply quality gates (CRITICAL/HIGH block)
@@ -221,6 +275,17 @@ flowchart TD
221
275
 
222
276
  ---
223
277
 
278
+ ## Integrations
279
+
280
+ Pumuki is designed to integrate into existing enterprise workflows without requiring changes to product code.
281
+
282
+ - **Git hooks**: pre-commit / pre-push enforcement
283
+ - **CI/CD**: run audits in pipelines to enforce the same gates as local development
284
+ - **IDE / agentic clients**: MCP servers for evidence, gate checks, and automation
285
+ - **Local developer tools**: CLI entrypoints for manual audits, troubleshooting, and operational flows
286
+
287
+ ---
288
+
224
289
  ## References
225
290
 
226
291
  For more details on the architecture:
@@ -233,4 +298,4 @@ For more details on the architecture:
233
298
 
234
299
  **Last updated**: 2025-01-13
235
300
  **Version**: 5.3.0
236
- 🐈💚 **Pumuki Team®** - Hook System Architecture
301
+ 🐈💚 **Pumuki Team®** - Hook System Architecture
package/docs/TODO.md ADDED
@@ -0,0 +1,41 @@
1
+ # Framework Work Tracking (TODO)
2
+
3
+ ## Scope
4
+
5
+ This document tracks the agreed improvements for **Pumuki AST Intelligence Framework**.
6
+
7
+ ## Done
8
+
9
+ - Refactor `README.md` to position the project as a framework (governance + lifecycle + commands).
10
+ - Add Git governance section documenting `ast:gitflow` and `ast:release` with options and flow.
11
+ - Add Developer Experience section (notifications + evidence freshness + git-tree guardrails).
12
+ - Make `docs/ARCHITECTURE.md` more normative by adding invariants + control primitives.
13
+
14
+ ## In Progress
15
+
16
+ - Standardize visuals in `docs/images/` to consistent, resolution-independent assets.
17
+
18
+ ## Next
19
+
20
+ ### Documentation
21
+
22
+ - Add README section explaining manual hook-system usage:
23
+ - interactive menu
24
+ - non-interactive usage via `AUDIT_OPTION`
25
+ - how `npx ast-hooks` maps to those flows
26
+ - Convert root `ARCHITECTURE.md` into **Conceptual Architecture** and link to `docs/ARCHITECTURE.md` as the contract.
27
+
28
+ ### Framework Features
29
+
30
+ - Add `human_intent` to both:
31
+ - `.AI_EVIDENCE.json` (source of truth)
32
+ - AI Gate output/state (must not drift)
33
+
34
+ ### Design Constraints
35
+
36
+ - Avoid drift: define a single canonical writer and a deterministic merge strategy.
37
+ - Ensure `expires_at` is enforced (ignore stale intent).
38
+
39
+ ## Notes
40
+
41
+ - README uses inline HTML (`<img>`) for GitHub-friendly full-width rendering.
@@ -0,0 +1,40 @@
1
+
2
+ <svg xmlns="http://www.w3.org/2000/svg" width="1600" height="900" viewBox="0 0 1600 900" role="img" aria-label="AST Intelligence System Overview">
3
+ <defs>
4
+ <style>
5
+ .bg { fill: #0b0f14; }
6
+ .panel { fill: #0f1620; stroke: #1f2a37; stroke-width: 2; }
7
+ .title { fill: #7dd3fc; font: 700 40px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
8
+ .sub { fill: #a7f3d0; font: 600 22px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
9
+ .txt { fill: #e5e7eb; font: 18px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
10
+ .muted { fill: #9ca3af; font: 18px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
11
+ .accent { fill: #fbbf24; font: 18px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
12
+ .ok { fill: #34d399; font: 18px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
13
+ .warn { fill: #f59e0b; font: 18px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
14
+ </style>
15
+ </defs>
16
+
17
+ <rect class="bg" x="0" y="0" width="1600" height="900" />
18
+ <rect class="panel" x="40" y="40" width="1520" height="820" rx="18" />
19
+
20
+ <text class="title" x="80" y="115">PUMUKI — Hook-System (run: npx ast-hooks)</text>
21
+ <text class="sub" x="80" y="160">AST Intelligence System Overview</text>
22
+
23
+ <text class="txt" x="80" y="230">1) Pattern checks</text>
24
+ <text class="txt" x="80" y="265">2) ESLint audits</text>
25
+ <text class="txt" x="80" y="300">3) AST Intelligence analysis</text>
26
+ <text class="txt" x="80" y="335">4) Intelligent Audit Gate (block/allow)</text>
27
+ <text class="txt" x="80" y="370">5) Evidence update (.AI_EVIDENCE.json)</text>
28
+
29
+ <text class="muted" x="80" y="435">Pipeline</text>
30
+ <text class="accent" x="80" y="470">Source files → AST analyzers → violations → severity evaluation → AI Gate verdict</text>
31
+
32
+ <text class="muted" x="80" y="535">Outputs</text>
33
+ <text class="txt" x="80" y="570">• .audit_tmp/ast-summary.json</text>
34
+ <text class="txt" x="80" y="605">• .audit_tmp/ast-summary-enhanced.json</text>
35
+ <text class="txt" x="80" y="640">• reports/ (json + text)</text>
36
+ <text class="txt" x="80" y="675">• .AI_EVIDENCE.json (ai_gate + metrics)</text>
37
+
38
+ <text class="warn" x="80" y="750">Rule: Fail fast, block early</text>
39
+ <text class="ok" x="80" y="785">Goal: deterministic governance across iOS / Android / Backend / Frontend</text>
40
+ </svg>
@@ -0,0 +1,39 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1600" height="900" viewBox="0 0 1600 900" role="img" aria-label="AST Intelligence Workflow">
2
+ <defs>
3
+ <style>
4
+ .bg { fill: #0b0f14; }
5
+ .panel { fill: #0f1620; stroke: #1f2a37; stroke-width: 2; }
6
+ .h { fill: #a7f3d0; font: 700 26px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
7
+ .t { fill: #e5e7eb; font: 18px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
8
+ .m { fill: #9ca3af; font: 18px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
9
+ .accent { fill: #fbbf24; font: 18px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
10
+ .warn { fill: #f59e0b; font: 18px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
11
+ </style>
12
+ </defs>
13
+
14
+ <rect class="bg" x="0" y="0" width="1600" height="900" />
15
+ <rect class="panel" x="40" y="40" width="1520" height="820" rx="18" />
16
+
17
+ <text class="h" x="80" y="120">QUICK SUMMARY</text>
18
+
19
+ <text class="t" x="80" y="190">Files scanned: 269</text>
20
+ <text class="t" x="80" y="220">Total violations: 69</text>
21
+ <text class="t" x="80" y="250">ESLint errors: 0</text>
22
+ <text class="t" x="80" y="280">Critical issues: 3</text>
23
+ <text class="t" x="80" y="310">High priority: 38</text>
24
+
25
+ <text class="warn" x="80" y="365">⚠ STATUS: ACTION REQUIRED</text>
26
+ <text class="accent" x="80" y="395">Critical or high-severity issues detected</text>
27
+
28
+ <text class="h" x="80" y="465">1) PATTERN CHECKS</text>
29
+ <text class="t" x="110" y="510">• TODO / FIXME: 4</text>
30
+ <text class="t" x="110" y="540">• CONSOLE_LOG: 205</text>
31
+ <text class="t" x="110" y="570">• ANY TYPE: 8</text>
32
+ <text class="t" x="110" y="600">• SQL_RAW: 3</text>
33
+
34
+ <text class="h" x="80" y="670">2) ESLINT AUDIT RESULTS</text>
35
+ <text class="t" x="110" y="715">ESLint: errors=0 warnings=0</text>
36
+
37
+ <text class="h" x="80" y="785">3) AST INTELLIGENCE — SEVERITY BREAKDOWN</text>
38
+ <text class="m" x="110" y="830">Staging Area: no staged files to analyze</text>
39
+ </svg>
@@ -0,0 +1,55 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1600" height="900" viewBox="0 0 1600 900" role="img" aria-label="AST Intelligence Audit - Part 1">
2
+ <defs>
3
+ <style>
4
+ .bg { fill: #0b0f14; }
5
+ .panel { fill: #0f1620; stroke: #1f2a37; stroke-width: 2; }
6
+ .h { fill: #a7f3d0; font: 700 24px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
7
+ .t { fill: #e5e7eb; font: 18px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
8
+ .muted { fill: #9ca3af; font: 18px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
9
+ .sevC { fill: #fb7185; }
10
+ .sevH { fill: #f59e0b; }
11
+ .sevM { fill: #fbbf24; }
12
+ .sevL { fill: #60a5fa; }
13
+ .dot { stroke: #1f2a37; stroke-width: 2; }
14
+ </style>
15
+ </defs>
16
+
17
+ <rect class="bg" x="0" y="0" width="1600" height="900" />
18
+ <rect class="panel" x="40" y="40" width="1520" height="820" rx="18" />
19
+
20
+ <text class="h" x="80" y="120">Platform: iOS</text>
21
+ <circle class="sevC dot" cx="95" cy="160" r="10" /><text class="t" x="120" y="166">CRITICAL: 2</text>
22
+ <circle class="sevH dot" cx="260" cy="160" r="10" /><text class="t" x="285" y="166">HIGH: 15</text>
23
+ <circle class="sevM dot" cx="395" cy="160" r="10" /><text class="t" x="420" y="166">MEDIUM: 6</text>
24
+ <circle class="sevL dot" cx="555" cy="160" r="10" /><text class="t" x="580" y="166">LOW: 13</text>
25
+
26
+ <text class="muted" x="80" y="210">Files affected: 1</text>
27
+ <text class="t" x="80" y="250">Top violations:</text>
28
+ <text class="t" x="110" y="285">ios.quality.long_function: 3</text>
29
+ <text class="t" x="110" y="315">ios.solid.isp.unused_dependency: 2</text>
30
+ <text class="t" x="110" y="345">ios.concurrency.missing_actor: 2</text>
31
+ <text class="t" x="110" y="375">ios.force_unwrapping: 2</text>
32
+ <text class="t" x="110" y="405">ios.uikit.viewmodel_delegation: 1</text>
33
+
34
+ <text class="h" x="80" y="500">Platform: Android</text>
35
+ <circle class="sevC dot" cx="95" cy="540" r="10" /><text class="t" x="120" y="546">CRITICAL: 0</text>
36
+ <circle class="sevH dot" cx="260" cy="540" r="10" /><text class="t" x="285" y="546">HIGH: 8</text>
37
+ <circle class="sevM dot" cx="395" cy="540" r="10" /><text class="t" x="420" y="546">MEDIUM: 8</text>
38
+ <circle class="sevL dot" cx="555" cy="540" r="10" /><text class="t" x="580" y="546">LOW: 1</text>
39
+
40
+ <text class="t" x="80" y="610">Top violations:</text>
41
+ <text class="t" x="110" y="645">android.asynctask: 2</text>
42
+ <text class="t" x="110" y="675">android.di.missing_android_entry_point: 1</text>
43
+ <text class="t" x="110" y="705">android.networking.missing_error_handling: 1</text>
44
+ <text class="t" x="110" y="735">android.coroutines.missing_lifecycle_scope: 1</text>
45
+
46
+ <text class="h" x="920" y="500">Platform: Other</text>
47
+ <circle class="sevC dot" cx="935" cy="540" r="10" /><text class="t" x="960" y="546">CRITICAL: 0</text>
48
+ <circle class="sevH dot" cx="1100" cy="540" r="10" /><text class="t" x="1125" y="546">HIGH: 2</text>
49
+ <circle class="sevM dot" cx="1235" cy="540" r="10" /><text class="t" x="1260" y="546">MEDIUM: 0</text>
50
+ <circle class="sevL dot" cx="1395" cy="540" r="10" /><text class="t" x="1420" y="546">LOW: 0</text>
51
+
52
+ <text class="t" x="920" y="610">Top violations:</text>
53
+ <text class="t" x="950" y="645">workflow.tdd.low_test_coverage: 1</text>
54
+ <text class="t" x="950" y="675">workflow.sequence.tests_lagging: 1</text>
55
+ </svg>
@@ -0,0 +1,39 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1600" height="900" viewBox="0 0 1600 900" role="img" aria-label="AST Intelligence Audit - Part 2">
2
+ <defs>
3
+ <style>
4
+ .bg { fill: #0b0f14; }
5
+ .panel { fill: #0f1620; stroke: #1f2a37; stroke-width: 2; }
6
+ .h { fill: #a7f3d0; font: 700 24px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
7
+ .t { fill: #e5e7eb; font: 18px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
8
+ .muted { fill: #9ca3af; font: 18px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
9
+ </style>
10
+ </defs>
11
+
12
+ <rect class="bg" x="0" y="0" width="1600" height="900" />
13
+ <rect class="panel" x="40" y="40" width="1520" height="820" rx="18" />
14
+
15
+ <text class="h" x="80" y="120">5) TOP VIOLATIONS &amp; REMEDIATION</text>
16
+
17
+ <text class="t" x="80" y="200">• common.types.any (8 violations)</text>
18
+ <text class="muted" x="110" y="235">→ Review and fix violations.</text>
19
+
20
+ <text class="t" x="80" y="285">• ios.quality.long_function (3 violations)</text>
21
+ <text class="muted" x="110" y="320">→ Review and fix violations.</text>
22
+
23
+ <text class="t" x="80" y="370">• android.asynctask (2 violations)</text>
24
+ <text class="muted" x="110" y="405">→ Review and fix violations.</text>
25
+
26
+ <text class="t" x="80" y="455">• common.network.missing_timeout (2 violations)</text>
27
+ <text class="muted" x="110" y="490">→ Review and fix violations.</text>
28
+
29
+ <text class="t" x="80" y="540">• common.network.missing_error_handling (2 violations)</text>
30
+ <text class="muted" x="110" y="575">→ Review and fix violations.</text>
31
+
32
+ <text class="t" x="80" y="625">• ios.solid.isp.unused_dependency (2 violations)</text>
33
+ <text class="muted" x="110" y="660">→ Review and fix violations.</text>
34
+
35
+ <text class="t" x="80" y="710">• ios.concurrency.missing_actor (2 violations)</text>
36
+ <text class="muted" x="110" y="745">→ Review and fix violations.</text>
37
+
38
+ <text class="h" x="80" y="830">6) EXECUTIVE SUMMARY</text>
39
+ </svg>
@@ -0,0 +1,45 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1600" height="900" viewBox="0 0 1600 900" role="img" aria-label="AST Intelligence Audit - Part 3">
2
+ <defs>
3
+ <style>
4
+ .bg { fill: #0b0f14; }
5
+ .panel { fill: #0f1620; stroke: #1f2a37; stroke-width: 2; }
6
+ .h { fill: #a7f3d0; font: 700 24px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
7
+ .t { fill: #e5e7eb; font: 18px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
8
+ .muted { fill: #9ca3af; font: 18px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
9
+ .errBox { fill: none; stroke: #fb7185; stroke-width: 3; }
10
+ .err { fill: #fb7185; font: 18px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
11
+ .sevC { fill: #fb7185; }
12
+ .sevH { fill: #f59e0b; }
13
+ .sevM { fill: #fbbf24; }
14
+ .sevL { fill: #60a5fa; }
15
+ .dot { stroke: #1f2a37; stroke-width: 2; }
16
+ </style>
17
+ </defs>
18
+
19
+ <rect class="bg" x="0" y="0" width="1600" height="900" />
20
+ <rect class="panel" x="40" y="40" width="1520" height="820" rx="18" />
21
+
22
+ <text class="h" x="80" y="120">METRICS</text>
23
+ <text class="t" x="80" y="170">Total violations detected: 69</text>
24
+ <text class="t" x="80" y="200">ESLint errors: 0</text>
25
+ <text class="t" x="80" y="230">Critical issues: 3</text>
26
+ <text class="t" x="80" y="260">High priority issues: 38</text>
27
+ <text class="t" x="80" y="290">Files scanned: 269</text>
28
+
29
+ <text class="muted" x="80" y="335">Code Health Score: 65% (Good)</text>
30
+
31
+ <rect class="errBox" x="80" y="370" width="1440" height="90" rx="10" />
32
+ <text class="err" x="110" y="425">ACTION REQUIRED: Critical or high-severity issues detected. Please review and fix before proceeding.</text>
33
+
34
+ <text class="h" x="80" y="520">FINAL SUMMARY — VIOLATIONS BY SEVERITY</text>
35
+
36
+ <circle class="sevC dot" cx="95" cy="565" r="10" /><text class="t" x="120" y="571">CRITICAL: 3</text>
37
+ <circle class="sevH dot" cx="95" cy="605" r="10" /><text class="t" x="120" y="611">HIGH: 38</text>
38
+ <circle class="sevM dot" cx="95" cy="645" r="10" /><text class="t" x="120" y="651">MEDIUM: 14</text>
39
+ <circle class="sevL dot" cx="95" cy="685" r="10" /><text class="t" x="120" y="691">LOW: 14</text>
40
+
41
+ <text class="muted" x="80" y="760">COMMIT BLOCKED — STRICT REPO+STAGING</text>
42
+ <text class="muted" x="80" y="795">Action: clean entire repository before committing.</text>
43
+
44
+ <text class="t" x="80" y="845">Generated by Pumuki — Hook-System</text>
45
+ </svg>
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki-ast-hooks",
3
- "version": "5.5.58",
3
+ "version": "5.5.65",
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": {
@@ -134,4 +134,4 @@
134
134
  "./skills": "./skills/skill-rules.json",
135
135
  "./hooks": "./hooks/index.js"
136
136
  }
137
- }
137
+ }
@@ -206,3 +206,19 @@
206
206
  {"timestamp":1767819338043,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
207
207
  {"timestamp":1767819338043,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
208
208
  {"timestamp":1767819338043,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
209
+ {"timestamp":1767963192762,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
210
+ {"timestamp":1767963192762,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
211
+ {"timestamp":1767963192762,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
212
+ {"timestamp":1767963192762,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
213
+ {"timestamp":1767963258796,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
214
+ {"timestamp":1767963258796,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
215
+ {"timestamp":1767963258796,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
216
+ {"timestamp":1767963258796,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
217
+ {"timestamp":1767963287588,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
218
+ {"timestamp":1767963287588,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
219
+ {"timestamp":1767963287588,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
220
+ {"timestamp":1767963287588,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
221
+ {"timestamp":1767963390612,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
222
+ {"timestamp":1767963390612,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
223
+ {"timestamp":1767963390612,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
224
+ {"timestamp":1767963390612,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
@@ -0,0 +1,43 @@
1
+ const path = require('path');
2
+ const StrategyRegistry = require('../infrastructure/registry/StrategyRegistry');
3
+ const NodeFileSystemAdapter = require('../infrastructure/adapters/NodeFileSystemAdapter');
4
+
5
+ class DIValidationService {
6
+ constructor() {
7
+ const fileSystemPort = new NodeFileSystemAdapter();
8
+ const configPath = path.join(__dirname, '../config/di-rules.json');
9
+ this.registry = new StrategyRegistry(fileSystemPort, configPath);
10
+ this.initialized = false;
11
+ }
12
+
13
+ async ensureInitialized() {
14
+ if (!this.initialized) {
15
+ await this.registry.loadStrategies();
16
+ this.initialized = true;
17
+ }
18
+ }
19
+
20
+ async validateDependencyInjection(analyzer, properties, filePath, className, line) {
21
+ await this.ensureInitialized();
22
+
23
+ const context = {
24
+ analyzer,
25
+ filePath,
26
+ className,
27
+ line,
28
+ properties
29
+ };
30
+
31
+ const strategies = this.registry.findStrategiesForNode(null, context);
32
+
33
+ for (const strategy of strategies) {
34
+ const violations = strategy.detect(null, context);
35
+
36
+ for (const violation of violations) {
37
+ strategy.report(violation, context);
38
+ }
39
+ }
40
+ }
41
+ }
42
+
43
+ module.exports = DIValidationService;
@@ -0,0 +1,81 @@
1
+ const DIValidationService = require('../../application/DIValidationService');
2
+ const NodeFileSystemAdapter = require('../../infrastructure/adapters/NodeFileSystemAdapter');
3
+
4
+ describe('DIValidationService', () => {
5
+ let diValidationService;
6
+ let mockAnalyzer;
7
+
8
+ beforeEach(() => {
9
+ diValidationService = new DIValidationService();
10
+ mockAnalyzer = {
11
+ pushFinding: jest.fn()
12
+ };
13
+ });
14
+
15
+ describe('validateDependencyInjection', () => {
16
+ it('should detect concrete dependency violations', async () => {
17
+ const properties = [
18
+ { 'key.name': 'apiClient', 'key.typename': 'APIClient' },
19
+ { 'key.name': 'repository', 'key.typename': 'UserRepository' }
20
+ ];
21
+
22
+ await diValidationService.validateDependencyInjection(
23
+ mockAnalyzer,
24
+ properties,
25
+ 'TestViewModel.swift',
26
+ 'TestViewModel',
27
+ 10
28
+ );
29
+
30
+ expect(mockAnalyzer.pushFinding).toHaveBeenCalledWith(
31
+ 'ios.solid.dip.concrete_dependency',
32
+ 'high',
33
+ 'TestViewModel.swift',
34
+ 10,
35
+ "'TestViewModel' depends on concrete 'APIClient' - use protocol"
36
+ );
37
+
38
+ expect(mockAnalyzer.pushFinding).toHaveBeenCalledWith(
39
+ 'ios.solid.dip.concrete_dependency',
40
+ 'high',
41
+ 'TestViewModel.swift',
42
+ 10,
43
+ "'TestViewModel' depends on concrete 'UserRepository' - use protocol"
44
+ );
45
+ });
46
+
47
+ it('should skip allowed types', async () => {
48
+ const properties = [
49
+ { 'key.name': 'name', 'key.typename': 'String' },
50
+ { 'key.name': 'count', 'key.typename': 'Int' }
51
+ ];
52
+
53
+ await diValidationService.validateDependencyInjection(
54
+ mockAnalyzer,
55
+ properties,
56
+ 'TestViewModel.swift',
57
+ 'TestViewModel',
58
+ 10
59
+ );
60
+
61
+ expect(mockAnalyzer.pushFinding).not.toHaveBeenCalled();
62
+ });
63
+
64
+ it('should skip protocol types', async () => {
65
+ const properties = [
66
+ { 'key.name': 'apiClient', 'key.typename': 'APIClientProtocol' },
67
+ { 'key.name': 'repository', 'key.typename': 'any UserRepositoryProtocol' }
68
+ ];
69
+
70
+ await diValidationService.validateDependencyInjection(
71
+ mockAnalyzer,
72
+ properties,
73
+ 'TestViewModel.swift',
74
+ 'TestViewModel',
75
+ 10
76
+ );
77
+
78
+ expect(mockAnalyzer.pushFinding).not.toHaveBeenCalled();
79
+ });
80
+ });
81
+ });
@@ -3,7 +3,6 @@ const path = require('path');
3
3
  const AuditLogger = require('../logging/AuditLogger');
4
4
  const McpServerConfigBuilder = require('./mcp/McpServerConfigBuilder');
5
5
  const McpProjectConfigWriter = require('./mcp/McpProjectConfigWriter');
6
- const McpGlobalConfigCleaner = require('./mcp/McpGlobalConfigCleaner');
7
6
 
8
7
  const COLORS = {
9
8
  reset: '\x1b[0m',
@@ -19,7 +18,6 @@ class McpConfigurator {
19
18
  this.logger = logger;
20
19
  this.serverConfigBuilder = new McpServerConfigBuilder(targetRoot, hookSystemRoot, logger);
21
20
  this.projectWriter = new McpProjectConfigWriter(targetRoot, logger, this.logSuccess.bind(this), this.logWarning.bind(this), this.logInfo.bind(this));
22
- this.globalCleaner = new McpGlobalConfigCleaner(targetRoot, logger, this.logInfo.bind(this));
23
21
  }
24
22
 
25
23
  configure() {
@@ -27,7 +25,6 @@ class McpConfigurator {
27
25
 
28
26
  const { serverId, mcpConfig } = this.serverConfigBuilder.build();
29
27
  this.projectWriter.configureProjectScoped(mcpConfig, serverId);
30
- this.globalCleaner.cleanupGlobalConfig(serverId);
31
28
  }
32
29
 
33
30
  detectIDEs() {
@@ -0,0 +1,42 @@
1
+ {
2
+ "dependencyInjection": {
3
+ "severity": "high",
4
+ "targetClasses": [
5
+ "ViewModel",
6
+ "Service",
7
+ "Repository",
8
+ "UseCase"
9
+ ],
10
+ "allowedTypes": [
11
+ "String",
12
+ "Int",
13
+ "Bool",
14
+ "Double",
15
+ "Float",
16
+ "Date",
17
+ "URL",
18
+ "Data"
19
+ ],
20
+ "concretePatterns": [
21
+ "Service$",
22
+ "Repository$",
23
+ "UseCase$",
24
+ "Client$"
25
+ ],
26
+ "protocolIndicators": [
27
+ "Protocol",
28
+ "any ",
29
+ "some "
30
+ ],
31
+ "genericTypePatterns": {
32
+ "singleLetter": true,
33
+ "camelCase": "^[A-Z][a-z]*$",
34
+ "excludeWithImpl": true,
35
+ "contextHints": [
36
+ "<",
37
+ "apiClient",
38
+ "client"
39
+ ]
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,19 @@
1
+ class FileSystemPort {
2
+ readDir(path) {
3
+ throw new Error('readDir must be implemented');
4
+ }
5
+
6
+ readFile(path, encoding) {
7
+ throw new Error('readFile must be implemented');
8
+ }
9
+
10
+ resolvePath(...paths) {
11
+ throw new Error('resolvePath must be implemented');
12
+ }
13
+
14
+ exists(path) {
15
+ throw new Error('exists must be implemented');
16
+ }
17
+ }
18
+
19
+ module.exports = FileSystemPort;