agent-enderun 0.6.1 → 0.6.6

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 (89) hide show
  1. package/.enderun/BRAIN_DASHBOARD.md +12 -12
  2. package/.enderun/PROJECT_MEMORY.md +17 -17
  3. package/.enderun/STATUS.md +11 -11
  4. package/.enderun/agents/README.md +40 -0
  5. package/.enderun/agents/analyst.md +238 -31
  6. package/.enderun/agents/backend.md +428 -18
  7. package/.enderun/agents/explorer.md +169 -31
  8. package/.enderun/agents/frontend.md +604 -76
  9. package/.enderun/agents/git.md +153 -62
  10. package/.enderun/agents/manager.md +433 -46
  11. package/.enderun/agents/mobile.md +143 -29
  12. package/.enderun/agents/native.md +191 -28
  13. package/.enderun/blueprints/README.md +82 -0
  14. package/.enderun/blueprints/backend/errors/config/meta.json +11 -0
  15. package/.enderun/blueprints/backend/errors/domain-error.ts +34 -55
  16. package/.enderun/docs/README.md +50 -0
  17. package/.enderun/docs/phase1-reference-app-execution-plan.md +177 -0
  18. package/.enderun/docs/structure-audit-2026-05-24.md +72 -0
  19. package/.enderun/knowledge/README.md +22 -0
  20. package/.enderun/knowledge/database_governance_guidelines.md +118 -0
  21. package/.enderun/knowledge/deployment_checklist.md +132 -6
  22. package/.enderun/knowledge/documentation_ownership.md +122 -0
  23. package/.enderun/knowledge/documentation_ownership_status.md +122 -0
  24. package/.enderun/knowledge/enterprise_capabilities_reference.md +149 -0
  25. package/.enderun/knowledge/enterprise_frontend_adaptation.md +232 -0
  26. package/.enderun/knowledge/enterprise_project_adaptation.md +168 -0
  27. package/.enderun/knowledge/framework_vs_user_project_boundary.md +52 -0
  28. package/.enderun/knowledge/frontend_professionalization_guidelines.md +111 -0
  29. package/.enderun/knowledge/frontend_real_battle_test_protocol.md +162 -0
  30. package/.enderun/knowledge/hermes_live_test_guidelines.md +90 -0
  31. package/.enderun/knowledge/manager_authority_audit_enforcement.md +104 -0
  32. package/.enderun/knowledge/project_scaffold_guidelines.md +99 -0
  33. package/.enderun/knowledge/reference_application_guidelines.md +90 -0
  34. package/ENDERUN.md +19 -5
  35. package/README.md +132 -657
  36. package/antigravity.md +15 -0
  37. package/bin/cli.js +92 -27
  38. package/bin/hermes-sandbox.js +136 -0
  39. package/docs/README.md +33 -3
  40. package/docs/action-plan-2026.md +119 -0
  41. package/docs/getting-started.md +271 -0
  42. package/docs/roadmap.md +142 -0
  43. package/framework-mcp/README.md +1 -1
  44. package/framework-mcp/dist/index.js +0 -0
  45. package/framework-mcp/dist/schemas.js +6 -0
  46. package/framework-mcp/dist/tools/academy.js +6 -8
  47. package/framework-mcp/dist/tools/codebase.js +6 -6
  48. package/framework-mcp/dist/tools/contract.js +94 -4
  49. package/framework-mcp/dist/tools/database.js +8 -3
  50. package/framework-mcp/dist/tools/framework.js +7 -11
  51. package/framework-mcp/dist/tools/git.js +2 -2
  52. package/framework-mcp/dist/tools/knowledge.js +5 -5
  53. package/framework-mcp/dist/tools/memory.js +5 -7
  54. package/framework-mcp/dist/tools/messages.js +76 -16
  55. package/framework-mcp/dist/tools/repository.js +4 -4
  56. package/framework-mcp/dist/tools/scaffold.js +6 -3
  57. package/framework-mcp/dist/tools/security.js +4 -4
  58. package/framework-mcp/dist/utils.js +2 -2
  59. package/framework-mcp/package.json +1 -1
  60. package/framework-mcp/src/schemas.ts +7 -0
  61. package/framework-mcp/src/tools/academy.ts +5 -9
  62. package/framework-mcp/src/tools/codebase.ts +6 -6
  63. package/framework-mcp/src/tools/contract.ts +114 -4
  64. package/framework-mcp/src/tools/database.ts +8 -3
  65. package/framework-mcp/src/tools/framework.ts +8 -11
  66. package/framework-mcp/src/tools/git.ts +2 -2
  67. package/framework-mcp/src/tools/knowledge.ts +6 -7
  68. package/framework-mcp/src/tools/memory.ts +5 -6
  69. package/framework-mcp/src/tools/messages.ts +94 -28
  70. package/framework-mcp/src/tools/repository.ts +5 -6
  71. package/framework-mcp/src/tools/scaffold.ts +9 -6
  72. package/framework-mcp/src/tools/security.ts +4 -4
  73. package/framework-mcp/src/utils.ts +19 -2
  74. package/framework-mcp/tsconfig.json +1 -1
  75. package/gemini.md +4 -4
  76. package/package.json +11 -7
  77. package/panda.config.ts +3 -1
  78. package/.enderun/benchmarks/.gitkeep +0 -0
  79. package/.enderun/blueprints/backend/middleware/error-handler.ts +0 -24
  80. package/.enderun/blueprints/backend/types/api.ts +0 -20
  81. package/.enderun/blueprints/backend/types/brands.ts +0 -12
  82. package/.enderun/blueprints/backend/types/constants.ts +0 -34
  83. package/.enderun/blueprints/backend/types/index.ts +0 -49
  84. package/.enderun/blueprints/backend/types/logs.ts +0 -16
  85. package/.enderun/blueprints/backend/types/models.ts +0 -65
  86. package/.enderun/blueprints/frontend/ui/Button.tsx +0 -60
  87. package/.enderun/blueprints/frontend/ui/Input.tsx +0 -43
  88. package/.enderun/monitoring/.gitkeep +0 -0
  89. package/gemini-extension.json +0 -13
@@ -0,0 +1,271 @@
1
+ # 🚀 Getting Started — Sıfırdan Agent Enderun ile Proje Kurma Rehberi / Quickstart Guide
2
+
3
+ [English](#english) | [Türkçe](#türkçe)
4
+
5
+ ---
6
+
7
+ # English
8
+
9
+ This guide is prepared for developers and engineering teams who want to set up Agent Enderun **from scratch** on a new project. It provides a step-by-step, practical walkthrough.
10
+
11
+ > **Primary recommended installation command from v0.6.6:** **`npx agent-enderun init` (generic framework setup)**
12
+
13
+ ---
14
+
15
+ ## 1. Introduction
16
+
17
+ Agent Enderun is a yapay zeka/AI governance framework that provides **control, discipline, and traceability** in software development processes.
18
+
19
+ By completing this guide, you will:
20
+ - Install the framework in your project
21
+ - Configure the basic components and environment
22
+ - Create your first tracked task and start working with specialist agents
23
+
24
+ ---
25
+
26
+ ## 2. Prerequisites
27
+
28
+ - **Node.js** 20+ (LTS recommended)
29
+ - **npm** 9+
30
+ - **Git** (must be initialized in the project directory)
31
+
32
+ To check your local environment:
33
+
34
+ ```bash
35
+ node --version
36
+ npm --version
37
+ git --version
38
+ ```
39
+
40
+ ---
41
+
42
+ ## 3. Step-by-Step Installation
43
+
44
+ ### Step 1: Create a New Project Directory
45
+
46
+ ```bash
47
+ mkdir my-new-project
48
+ cd my-new-project
49
+ git init
50
+ ```
51
+
52
+ ### Step 2: Initialize the Framework
53
+
54
+ To initialize the core framework cleanly (without hardcoding any AI/adapter-specific files before installation):
55
+
56
+ ```bash
57
+ npx agent-enderun init
58
+ ```
59
+
60
+ This command:
61
+ - Creates the `.enderun/` directory by default
62
+ - Installs all core governance files (`ENDERUN.md`, `PROJECT_MEMORY.md`, agents, knowledge, etc.)
63
+ - Adds the default framework configuration files
64
+
65
+ #### 💡 Optional: Installing with a Specific Adapter
66
+ If you want to configure the framework for a specific AI assistant or editor environment (e.g. Antigravity, Claude, Cursor, Codex, Gemini), you can specify it as an option:
67
+
68
+ ```bash
69
+ npx agent-enderun init antigravity
70
+ # or
71
+ npx agent-enderun init claude
72
+ # or
73
+ npx agent-enderun init cursor
74
+ # or
75
+ npx agent-enderun init codex
76
+ # or
77
+ npx agent-enderun init gemini
78
+ ```
79
+
80
+ - If you run `init antigravity`, it will create `.antigravitycli/` instead of `.enderun/` and place `antigravity.md` at the project root.
81
+ - If you run `init claude`, it will create `.claude/` and automatically configure the Claude Desktop MCP settings.
82
+ - If you run `init cursor`, it will create `.cursor/` and copy the cursor rules configuration.
83
+ - If you run `init gemini`, it will create `.gemini/` and place `gemini.md` at the project root.
84
+
85
+ ---
86
+
87
+ ### Step 3: Install Dependencies and Build
88
+
89
+ ```bash
90
+ npm install
91
+ npm run enderun:build
92
+ ```
93
+
94
+ ### Step 4: Verify the Installation
95
+
96
+ ```bash
97
+ npx agent-enderun check
98
+ ```
99
+
100
+ Expected output:
101
+
102
+ ```
103
+ ✅ Framework active (v0.6.6)
104
+ ✅ MCP Server ready
105
+ ✅ Shared types compiled
106
+ ✅ Agent logs initialized
107
+ ✅ PROJECT_MEMORY.md found
108
+ ```
109
+
110
+ ---
111
+
112
+ ## 4. Basic Configuration (Most Critical Step)
113
+
114
+ Once initialized, you **must** update the following files to describe your project. Ajanlar (agents) learn your technology stack and target domain from here.
115
+
116
+ ### 4.1 `docs/tech-stack.md`
117
+
118
+ This file is **mandatory**. Agents rely on it to make technical decisions.
119
+
120
+ Example:
121
+
122
+ ```markdown
123
+ # TECH STACK
124
+
125
+ ## Platform
126
+ - Web (React + Vite)
127
+ - Backend (Node.js + Fastify)
128
+
129
+ ## Database
130
+ - PostgreSQL + Kysely
131
+
132
+ ## Auth
133
+ - JWT + Refresh Token
134
+
135
+ ## Deployment
136
+ - Vercel (Frontend) + Railway (Backend)
137
+ ```
138
+
139
+ > **Warning:** If this file is empty, the agents will not be able to operate.
140
+
141
+ ### 4.2 `docs/project-docs.md`
142
+
143
+ Write your project's goals, business requirements, and primary features here.
144
+
145
+ ### 4.3 `.enderun/PROJECT_MEMORY.md`
146
+
147
+ Automatically created during initial setup. Review its content. *(Note: If you initialized with a custom adapter, this file will be located inside your adapter's folder, e.g., `.antigravitycli/PROJECT_MEMORY.md`)*.
148
+
149
+ ---
150
+
151
+ ## 5. Creating Your First Task
152
+
153
+ You are now ready to create your first real task:
154
+
155
+ ```bash
156
+ npx agent-enderun trace:new "User Registration and Login System" backend P1
157
+ ```
158
+
159
+ This command:
160
+ - Generates a unique Trace ID
161
+ - Updates the **ACTIVE TASKS** section in `PROJECT_MEMORY.md`
162
+ - Assigns the `@manager` agent to lead the task
163
+
164
+ ---
165
+
166
+ ## 6. Basics of Working with Agents
167
+
168
+ ### Automatic @manager Behavior
169
+
170
+ At the start of every session (when a conversation begins), agents will automatically:
171
+
172
+ 1. Read `ENDERUN.md`
173
+ 2. Read `PROJECT_MEMORY.md`
174
+ 3. Load the active phase and current Trace ID
175
+
176
+ ### How to Direct Specialist Agents
177
+
178
+ - Normally, **`@manager`** coordinates the process.
179
+ - If you need to address a specialist agent directly, include their tag:
180
+
181
+ ```markdown
182
+ @backend Implement the user model and auth services using Kysely.
183
+ ```
184
+
185
+ ### Critical Rules
186
+
187
+ - Keep `docs/tech-stack.md` updated at all times.
188
+ - When new key decisions are made, update the **CRITICAL DECISIONS** table in `PROJECT_MEMORY.md`.
189
+ - Use a unique Trace ID for every task.
190
+
191
+ ---
192
+
193
+ ## 7. First Real-World Scenario Example
194
+
195
+ Try this quick workflow:
196
+
197
+ 1. Populate `docs/tech-stack.md`
198
+ 2. Write a simple requirement in `docs/project-docs.md`
199
+ 3. Run the following command:
200
+
201
+ ```bash
202
+ npx agent-enderun trace:new "User Registration and Login" backend P1
203
+ ```
204
+
205
+ 4. Then write to the assistant:
206
+
207
+ > @manager Please analyze this requirement and propose the backend architecture.
208
+
209
+ The agents will automatically:
210
+ - Scan your codebase
211
+ - Propose type contracts
212
+ - Scaffold code using blueprints if necessary
213
+
214
+ ---
215
+
216
+ ## 8. Common Mistakes and Tips
217
+
218
+ | Mistake | Consequence | Solution |
219
+ | :--- | :--- | :--- |
220
+ | Leaving `docs/tech-stack.md` empty | Agents will not know how to proceed | Ensure it is populated immediately |
221
+ | Prompting for direct code generation | Messy and unmonitored code | Always have `@manager` plan first |
222
+ | Not using Trace ID | Chaos and lost traceability | Use `trace:new` for every new feature |
223
+ | Not updating `PROJECT_MEMORY.md` | Agents remember old state | Update memory with every key decision |
224
+
225
+ ---
226
+
227
+ ## 9. Next Steps
228
+
229
+ After completing the guide, explore:
230
+
231
+ - **Contract-First Development** → Check `apps/backend/src/types`
232
+ - **Blueprint Scaffolding** → Look inside `.enderun/blueprints/`
233
+ - **Security & Compliance** → Run `npx agent-enderun check:security`
234
+ - **Inter-Agent Communication** → Hermes protocol (`messages/` directory)
235
+
236
+ ---
237
+
238
+ ## 10. Help and Support
239
+
240
+ If you encounter issues:
241
+
242
+ 1. Run `npx agent-enderun status`
243
+ 2. Check `PROJECT_MEMORY.md`
244
+ 3. Inspect the error logs and the last 3 HISTORY entries
245
+
246
+ ---
247
+
248
+ **Congratulations!** You can now develop software with discipline, structure, and governance using Agent Enderun.
249
+
250
+ As a next step, we recommend defining **the core contracts of your first real project**.
251
+
252
+ ---
253
+
254
+ # Türkçe
255
+
256
+ Bu rehber, Agent Enderun'u **sıfırdan** yeni bir projeye kurmak isteyen geliştiriciler için hazırlanmıştır.
257
+
258
+ > **v0.6.6 itibarıyla önerilen birincil başlatma komutu:** `npx agent-enderun init`
259
+
260
+ Tüm teknik adımlar, ön gereksinimler, yapılandırma ve ajanlarla çalışma kuralları **İngilizce bölümde** detaylı olarak açıklanmıştır.
261
+
262
+ Türkçe kısa özet:
263
+
264
+ - `npx agent-enderun init` ile framework'ü kurun.
265
+ - `docs/tech-stack.md` ve `docs/project-docs.md` dosyalarını doldurun.
266
+ - `npx agent-enderun trace:new` ile ilk görevi oluşturun.
267
+ - Her oturumda @manager otomatik olarak yönetir.
268
+
269
+ Detaylı kurulum adımları, adaptör seçenekleri, hata önleme ipuçları ve örnek akışlar için lütfen İngilizce bölümü okuyun.
270
+
271
+ **Tebrikler!** Artık Agent Enderun ile disiplinli yazılım geliştirmeye başlayabilirsiniz.
@@ -0,0 +1,142 @@
1
+ # Agent Enderun — Development Roadmap (v0.6.6+) / Geliştirme Yol Haritası
2
+
3
+ **Last Updated / Son Güncelleme:** 23 May 2026 / 23 May 2026
4
+ **Owner / Sorumlu:** @manager
5
+
6
+ [English](#english) | [Türkçe](#türkçe)
7
+
8
+ ---
9
+
10
+ # English
11
+
12
+ This document outlines the development roadmap for the Agent Enderun framework **v0.6.6 and beyond**. All items are prioritized logically based on actual project needs and corporate governance principles.
13
+
14
+ ## Current Status (24 May 2026)
15
+
16
+ - **Version:** v0.6.6 (ready for npm release)
17
+ - **System Health:** 🟢 GREEN
18
+ - **Key Accomplishments:**
19
+ - Full support for the Antigravity adapter (primary recommended adapter)
20
+ - Gemini adapter completely removed
21
+ - Lint technical debt resolved (reduced from 43 to 0 issues)
22
+ - Published `docs/getting-started.md` guide
23
+ - Updated memory structures and workspace hygiene
24
+
25
+ - **Active Challenge:** Memory and task tracking need reinforcement (ACTIVE TASKS section is empty)
26
+
27
+ ---
28
+
29
+ ## Agent Maturity & Professionalization Program (Highest Strategic Initiative)
30
+
31
+ To make Agent Enderun truly production-grade for enterprise use, agents must be professionalized to meet the standards of senior software engineers.
32
+
33
+ This program systematically audits current agent maturity levels and runs structured improvements to elevate each agent to enterprise readiness.
34
+
35
+ ### Agent Maturity Targets
36
+
37
+ | Agent Persona | Current Level | Target Level | Priority / Risk Status |
38
+ | :--- | :--- | :--- | :--- |
39
+ | **@manager** | 8.0 | 9.5 | High / Stable. Leadership and project management capabilities are excellent. |
40
+ | **@backend** | 7.5 | 9.0 | High / Stable. Deeply understands Kysely and Fastify patterns; testing discipline needs reinforcement. |
41
+ | **@frontend** | 6.5 | 9.0 | **Critical / High Risk**. Needs major reinforcement in component slots, composition patterns, WCAG 2.2 accessibility, and performance engineering. |
42
+ | **@explorer** | 6.5 | 8.5 | High / Stable. Highly capable in dependency analysis and codebase intelligence. |
43
+ | **@analyst** | 6.5 | 8.5 | Medium / Stable. Handles system health metrics and compliance audits. |
44
+ | **@git** | 6.0 | 8.0 | Medium / Stable. Coordinates PRs, semantic commits, and version compliance. |
45
+ | **@mobile & @native** | 2.0 | 7.5 | Low / Dormant. Foundational blueprints and Hermes safety rules added. |
46
+
47
+ > **Note:** `@frontend` is currently the highest risk to enterprise onboarding and is the top priority.
48
+
49
+ ---
50
+
51
+ ## Roadmap Overview
52
+
53
+ | Phase | Timeline | Focus | Priority |
54
+ | :--- | :--- | :--- | :--- |
55
+ | **Agent Maturity Program** | 1–4 Months | Elevate all agents to professional enterprise-grade | **Highest** |
56
+ | **Phase 1** | 1–6 Weeks | Usability, automated configurations, and CLI tooling | High |
57
+ | **Phase 2** | 1–3 Months | Hermes messaging stability & multi-agent intelligence | High |
58
+ | **Phase 3** | 3+ Months | Scalability, performance benchmarks, and Reference Application | Medium |
59
+
60
+ ---
61
+
62
+ ## Agent Maturity Program — Phase 1 (Weeks 1–8)
63
+
64
+ ### 1. Professionalize @frontend Agent (Critical)
65
+ - Component Architecture (Compound Components, Slots, Composition Patterns)
66
+ - Accessibility (WCAG 2.2 AA compliance standards)
67
+ - Performance Engineering (Core Web Vitals, virtualization, code splitting)
68
+ - Testing Strategy (Hook + Component + Integration testing)
69
+ - Error Boundaries & Resilience
70
+ - Design System Governance
71
+
72
+ ### 2. Reinforce @backend Agent
73
+ - Production Testing Culture (Unit + Integration + Contract + E2E)
74
+ - Observability (Structured Logging + Metrics + Tracing)
75
+ - Resilience Patterns (Idempotency, Retry, Circuit Breaker)
76
+ - Query Optimization and Caching Strategy
77
+
78
+ ### 3. Elevate @manager Leadership
79
+ - Technical Debt Auditing & Escalation Register
80
+ - Risk Assessment Framework
81
+ - Capacity Planning & Sustainable Delivery
82
+ - Architecture Decision Records (ADR) Discipline
83
+
84
+ ---
85
+
86
+ ## Phase 1 — Short-Term (Weeks 1–6)
87
+
88
+ ### 1. Fully Automate Claude Configuration
89
+ - **Description:** Remove the manual `claude config add` step after running `init claude`. Automatically patch the Claude Desktop configuration file.
90
+ - **Complexity:** Medium
91
+ - **Status:** Pending
92
+
93
+ ### 2. Frontend Blueprint System
94
+ - **Description:** Carry the blueprint generator power of the backend over to the frontend. Establish structured React components, pages, and UI pattern blueprints.
95
+ - **Complexity:** Medium-High
96
+ - **Status:** Pending
97
+
98
+ ### 3. Expand Getting Started Documentation
99
+ - **Description:** Enrich the new guide based on developer feedback. Add more real-world scenarios, troubleshooting tips, and best practices.
100
+ - **Complexity:** Low-Medium
101
+ - **Status:** In Progress (Getting started guide updated to v0.6.6)
102
+
103
+ ---
104
+
105
+ ## Phase 2 — Mid-Term (Months 1–3)
106
+
107
+ ### 4. Fully Implement Hermes Messaging Protocol
108
+ - **Description:** Move inter-agent categorized, prioritized, and persistent messaging protocol from "defined on paper" to active code implementation.
109
+ - **Complexity:** High
110
+ - **Status:** Draft defined; implementation pending
111
+
112
+ ### 5. Reinforce Academy & Performance System
113
+ - **Description:** Aggregate success metrics, failure tracking, and structured feedback for all agents to report via dashboard.
114
+ - **Complexity:** Medium-High
115
+ - **Status:** Basic tools available; scaling required
116
+
117
+ ---
118
+
119
+ ## Phase 3 — Long-Term (Months 3+)
120
+
121
+ ### 6. Production-Grade Reference Application
122
+ - **Description:** Build a complete end-to-end reference application demonstrating normal CRUD + High-Risk Admin actions + Hermes messaging under Agent Enderun's governance.
123
+ - **Complexity:** Very High
124
+ - **Status:** Planned
125
+
126
+ ---
127
+
128
+ # Türkçe
129
+
130
+ Bu belge, Agent Enderun framework’ünün **v0.6.6 sonrası** geliştirme yol haritasını içerir.
131
+
132
+ ## Mevcut Durum (May 2026)
133
+
134
+ - **Versiyon:** v0.6.6
135
+ - **Sistem Sağlığı:** 🟢 GREEN (build ve test altyapısı onarım altında)
136
+ - **v0.6.6 Odak:** Tüm framework’ün profesyonel İngilizceye dönüştürülmesi ve yönetişim boşluklarının dürüstçe analiz edilmesi.
137
+
138
+ ## Özet
139
+
140
+ Ajan Olgunluk Programı devam etmektedir. @frontend en yüksek riskli ajan olmaya devam ediyor. Hermes protokolünün canlı test edilmesi ve referans uygulamanın üretilmesi önümüzdeki ana hedeflerdir.
141
+
142
+ Detaylı plan ve risk takibi İngilizce bölümde yer almaktadır.
@@ -1,4 +1,4 @@
1
- # AI-Enderun MCP Server (v0.3.4)
1
+ # AI-Enderun MCP Server (v0.6.6)
2
2
 
3
3
  English | [Türkçe](#türkçe)
4
4
 
File without changes
@@ -26,12 +26,18 @@ export const LOG_AGENT_ACTION_ARGS_SCHEMA = z.object({
26
26
  details: z.record(z.any()).default({}),
27
27
  });
28
28
  export const SEND_AGENT_MESSAGE_ARGS_SCHEMA = z.object({
29
+ from: z.string().min(1),
29
30
  to: z.string().min(1),
30
31
  message: z.string().min(1),
31
32
  traceId: z.string().min(1),
32
33
  category: z.enum(["ACTION", "DELEGATION", "INFO", "ALERT"]).default("INFO"),
33
34
  priority: z.enum(["LOW", "MEDIUM", "HIGH", "URGENT"]).default("MEDIUM"),
34
35
  });
36
+ export const UPDATE_AGENT_MESSAGE_STATUS_ARGS_SCHEMA = z.object({
37
+ agent: z.string().min(1),
38
+ traceId: z.string().min(1),
39
+ newStatus: z.enum(["ACKNOWLEDGED", "COMPLETED", "REJECTED"]),
40
+ });
35
41
  export const SEARCH_KNOWLEDGE_BASE_ARGS_SCHEMA = z.object({
36
42
  query: z.string().min(1),
37
43
  });
@@ -1,7 +1,7 @@
1
1
  import fs from "fs";
2
2
  import path from "path";
3
3
  import { getFrameworkDir } from "../utils.js";
4
- import { GET_ACADEMY_PERFORMANCE_ARGS_SCHEMA, GENERATE_ACADEMY_PROGRESS_REPORT_ARGS_SCHEMA, GET_AGENT_AUDIT_REPORT_ARGS_SCHEMA, LOG_AGENT_ACTION_ARGS_SCHEMA } from "../schemas.js";
4
+ import { GET_ACADEMY_PERFORMANCE_ARGS_SCHEMA, GET_AGENT_AUDIT_REPORT_ARGS_SCHEMA, LOG_AGENT_ACTION_ARGS_SCHEMA } from "../schemas.js";
5
5
  export const academyTools = [
6
6
  {
7
7
  name: "get_academy_performance",
@@ -101,7 +101,7 @@ export const academyHandlers = {
101
101
  }).filter(s => s.actions > 0);
102
102
  return { content: [{ type: "text", text: `### GLOBAL ACADEMY PERFORMANCE REPORT\n\n- **Analysis Period:** Last ${days} days\n- **Global Success Rate:** ${((totalSuccess / (totalActions || 1)) * 100).toFixed(1)}%\n\n**Agent Breakdown:**\n` + agentStats.map(s => `- **@${s.agent}:** ${s.actions} actions (${s.successRate.toFixed(1)}% success)`).join("\n") }] };
103
103
  }
104
- catch (error) {
104
+ catch {
105
105
  return { content: [{ type: "text", text: "Failed to generate global performance report." }] };
106
106
  }
107
107
  },
@@ -120,13 +120,11 @@ export const academyHandlers = {
120
120
  const successRate = (successCount / (totalActions || 1)) * 100;
121
121
  return { content: [{ type: "text", text: `# 🏛️ ACADEMY STRATEGIC BRIEFING\n\n- **Academy Health:** ${successRate.toFixed(1)}% Success Rate over ${totalActions} actions.\n**Status:** READY FOR PHASE_1 COMPLETION.` }] };
122
122
  }
123
- catch (error) {
123
+ catch {
124
124
  return { content: [{ type: "text", text: "Strategic briefing generation failed." }] };
125
125
  }
126
126
  },
127
127
  generate_academy_progress_report: async (args, projectRoot) => {
128
- const parsed = GENERATE_ACADEMY_PROGRESS_REPORT_ARGS_SCHEMA.safeParse(args ?? {});
129
- const days = parsed.success ? parsed.data.days : 7;
130
128
  try {
131
129
  const frameworkDir = getFrameworkDir(projectRoot);
132
130
  const memoryPath = path.join(projectRoot, frameworkDir, "PROJECT_MEMORY.md");
@@ -135,7 +133,7 @@ export const academyHandlers = {
135
133
  const milestones = Array.from(historySection.matchAll(/### (.*)\n\n- \*\*Agent:\*\* (.*)\n- \*\*Trace ID:\*\* (.*)\n- \*\*Action:\*\* (.*)/g)).slice(0, 5).map(m => `- [${m[1]}] **${m[2]}:** ${m[4]}`).join("\n");
136
134
  return { content: [{ type: "text", text: `# 🎓 AGENT ACADEMY PROGRESS REPORT\n\n## 🏆 Key Milestones Achieved\n${milestones}` }] };
137
135
  }
138
- catch (error) {
136
+ catch {
139
137
  return { content: [{ type: "text", text: "Failed to generate progress report." }] };
140
138
  }
141
139
  },
@@ -153,7 +151,7 @@ export const academyHandlers = {
153
151
  const successCount = logs.filter((l) => l.status === "SUCCESS").length;
154
152
  return { content: [{ type: "text", text: `### AGENT AUDIT REPORT: ${parsed.data.agent.toUpperCase()}\n\n- **Total Actions:** ${logs.length}\n- **Success Rate:** ${((successCount / (logs.length || 1)) * 100).toFixed(1)}%` }] };
155
153
  }
156
- catch (error) {
154
+ catch {
157
155
  return { content: [{ type: "text", text: "Failed to generate audit report." }] };
158
156
  }
159
157
  },
@@ -177,7 +175,7 @@ export const academyHandlers = {
177
175
  fs.writeFileSync(logPath, JSON.stringify(logs, null, 2));
178
176
  return { content: [{ type: "text", text: `SUCCESS: Logged action to ${parsed.data.agent}.json` }] };
179
177
  }
180
- catch (error) {
178
+ catch {
181
179
  return { content: [{ type: "text", text: "Failed to log action." }] };
182
180
  }
183
181
  },
@@ -135,7 +135,7 @@ export const codebaseHandlers = {
135
135
  try {
136
136
  queryRegex = new RegExp(query, "i");
137
137
  }
138
- catch (error) {
138
+ catch {
139
139
  return { content: [{ type: "text", text: "Invalid regex pattern in query." }] };
140
140
  }
141
141
  const matches = [];
@@ -157,7 +157,7 @@ export const codebaseHandlers = {
157
157
  }
158
158
  return { content: [{ type: "text", text: matches.join("\n") || "No matches found." }] };
159
159
  }
160
- catch (error) {
160
+ catch {
161
161
  return { content: [{ type: "text", text: "Search failed." }] };
162
162
  }
163
163
  },
@@ -223,7 +223,7 @@ export const codebaseHandlers = {
223
223
  }
224
224
  return { content: [{ type: "text", text: `### CODEBASE INTELLIGENCE REPORT\n\n**Complexity Spikes (>300 lines):**\n${complexitySpikes.length > 0 ? complexitySpikes.map(s => `- ${s}`).join("\n") : "- None detected"}\n\n**Potential Dead Code (Unused Exports):**\n${potentialDeadCode.length > 0 ? potentialDeadCode.map(d => `- ${d}`).join("\n") : "- None detected (within scanned scope)"}` }] };
225
225
  }
226
- catch (error) {
226
+ catch {
227
227
  return { content: [{ type: "text", text: "Intelligence scan failed." }] };
228
228
  }
229
229
  },
@@ -253,8 +253,8 @@ export const codebaseHandlers = {
253
253
  deviations.push("Reference uses 'get' prefix for functions, target does not.");
254
254
  return { content: [{ type: "text", text: deviations.length > 0 ? `### PROCEDURAL CONTINUITY DEVIATIONS\n\n${deviations.map(d => `- ${d}`).join("\n")}` : "No major structural or stylistic deviations detected based on reference." }] };
255
255
  }
256
- catch (error) {
257
- return { content: [{ type: "text", text: "Continuity analysis failed." }] };
256
+ catch {
257
+ return { content: [{ type: "text", text: "Dependency analysis failed." }] };
258
258
  }
259
259
  },
260
260
  generate_dependency_graph: async (args, projectRoot) => {
@@ -287,7 +287,7 @@ export const codebaseHandlers = {
287
287
  mermaid += uniqueEdges.join("\n");
288
288
  return { content: [{ type: "text", text: `### VISUAL ARCHITECTURE MAP: ${targetPath}\n\n\`\`\`mermaid\n${mermaid}\n\`\`\`\n\n**Total Nodes:** ${new Set(edges.flatMap(e => [e.from, e.to])).size} | **Total Edges:** ${uniqueEdges.length}` }] };
289
289
  }
290
- catch (error) {
290
+ catch {
291
291
  return { content: [{ type: "text", text: "Dependency graph generation failed." }] };
292
292
  }
293
293
  },
@@ -40,6 +40,23 @@ export const contractTools = [
40
40
  required: ["domain"],
41
41
  },
42
42
  },
43
+ {
44
+ name: "validate_frontend_api_contract",
45
+ description: "Scans frontend hooks for API calls and compares them against backend API documentation and contracts. Returns mismatches (missing endpoints, type issues, etc.).",
46
+ inputSchema: {
47
+ type: "object",
48
+ properties: {
49
+ frontendHooksPath: {
50
+ type: "string",
51
+ description: "Relative path to frontend hooks directory (default: apps/web/src/pages)",
52
+ },
53
+ backendApiDocsPath: {
54
+ type: "string",
55
+ description: "Relative path to backend API documentation (default: docs/api)",
56
+ },
57
+ },
58
+ },
59
+ },
43
60
  ];
44
61
  export const contractHandlers = {
45
62
  verify_api_contract: async (args, projectRoot) => {
@@ -52,8 +69,8 @@ export const contractHandlers = {
52
69
  const storedHash = JSON.parse(fs.readFileSync(contractJsonPath, "utf-8")).contract_hash;
53
70
  return { content: [{ type: "text", text: currentHash === storedHash ? "✅ MATCH: Contract is valid and synchronized." : `❌ MISMATCH: Current hash (${currentHash.slice(0, 8)}...) does not match stored hash (${storedHash.slice(0, 8)}...).` }] };
54
71
  }
55
- catch (error) {
56
- return { content: [{ type: "text", text: "Failed to verify contract." }] };
72
+ catch {
73
+ return { content: [{ type: "text", text: "Contract integrity check failed." }] };
57
74
  }
58
75
  },
59
76
  update_contract_hash: async (args, projectRoot) => {
@@ -72,7 +89,7 @@ export const contractHandlers = {
72
89
  fs.writeFileSync(contractJsonPath, JSON.stringify(contractJson, null, 2));
73
90
  return { content: [{ type: "text", text: `SUCCESS: Contract hash updated to ${currentHash}` }] };
74
91
  }
75
- catch (error) {
92
+ catch {
76
93
  return { content: [{ type: "text", text: "Failed to update contract hash." }] };
77
94
  }
78
95
  },
@@ -100,8 +117,81 @@ export const contractHandlers = {
100
117
  });
101
118
  return { content: [{ type: "text", text: `### CONTRACT INTEGRITY SHIELD: ${parsed.data.domain.toUpperCase()}\n\n` + `- **Missing/Undefined Types:** ${missingTypes.length > 0 ? `⚠️ ${missingTypes.join(", ")}` : "✅ All types synchronized"}\n\n` + `**Result:** ${missingTypes.length === 0 ? "PASSED" : "FAILED"}` }] };
102
119
  }
103
- catch (error) {
120
+ catch {
104
121
  return { content: [{ type: "text", text: "Contract verification failed." }] };
105
122
  }
106
123
  },
124
+ validate_frontend_api_contract: async (args, projectRoot) => {
125
+ const a = args;
126
+ const frontendPath = a?.frontendHooksPath || "apps/web/src/pages";
127
+ const backendDocsPath = a?.backendApiDocsPath || "docs/api";
128
+ try {
129
+ const fullFrontendPath = path.join(projectRoot, frontendPath);
130
+ const fullBackendDocsPath = path.join(projectRoot, backendDocsPath);
131
+ if (!fs.existsSync(fullFrontendPath)) {
132
+ return { content: [{ type: "text", text: `Frontend hooks path not found: ${frontendPath}` }] };
133
+ }
134
+ const hookFiles = collectFilesRecursively(fullFrontendPath, new Set(["ts", "tsx"]));
135
+ const apiCalls = [];
136
+ // Hook dosyalarındaki fetch çağrılarını ve response tiplerini çıkar
137
+ for (const file of hookFiles) {
138
+ const content = fs.readFileSync(file, "utf-8");
139
+ // Basit regex ile endpoint + response tipi yakala
140
+ const matches = content.matchAll(/(?:const\s+\w+\s*[:=]\s*await\s+)?fetch\(['"`](\/api\/[^'"`]+)['"`][^)]*\)\s*(?:\.then[^;]+)?(?:\s*as\s+([A-Z][a-zA-Z0-9]+)|:\s*([A-Z][a-zA-Z0-9]+))?/g);
141
+ for (const match of matches) {
142
+ const endpoint = match[1];
143
+ const responseType = match[2] || match[3];
144
+ apiCalls.push({ endpoint, responseType });
145
+ }
146
+ }
147
+ const uniqueEndpoints = Array.from(new Set(apiCalls.map(c => c.endpoint)));
148
+ if (!fs.existsSync(fullBackendDocsPath)) {
149
+ return { content: [{ type: "text", text: `Backend API docs path not found: ${backendDocsPath}` }] };
150
+ }
151
+ const backendDocFiles = collectFilesRecursively(fullBackendDocsPath, new Set(["md"]));
152
+ const documentedEndpoints = [];
153
+ for (const file of backendDocFiles) {
154
+ const content = fs.readFileSync(file, "utf-8");
155
+ const matches = content.matchAll(/`?(\/api\/[a-zA-Z0-9/_-]+)`?/g);
156
+ for (const match of matches) {
157
+ documentedEndpoints.push(match[1]);
158
+ }
159
+ }
160
+ const missingInDocs = uniqueEndpoints.filter(ep => !documentedEndpoints.some(d => ep.startsWith(d)));
161
+ const missingInHooks = documentedEndpoints.filter(d => !uniqueEndpoints.some(e => e.startsWith(d)));
162
+ let report = `### FRONTEND ↔ BACKEND CONTRACT VALIDATION REPORT\n\n`;
163
+ report += `**Scanned Frontend Hooks:** ${uniqueEndpoints.length} unique endpoints found\n`;
164
+ report += `**Scanned Backend API Docs:** ${documentedEndpoints.length} endpoints documented\n\n`;
165
+ if (missingInDocs.length > 0) {
166
+ report += `⚠️ **Endpoints called from frontend but NOT documented in backend:**\n${missingInDocs.map(e => `- ${e}`).join("\n")}\n\n`;
167
+ }
168
+ else {
169
+ report += `✅ All frontend-called endpoints are documented in backend.\n\n`;
170
+ }
171
+ if (missingInHooks.length > 0) {
172
+ report += `ℹ️ **Endpoints documented in backend but NOT used in scanned frontend hooks:**\n${missingInHooks.map(e => `- ${e}`).join("\n")}\n\n`;
173
+ }
174
+ // Basit tip karşılaştırması (eğer responseType varsa)
175
+ const typeMismatches = [];
176
+ for (const call of apiCalls) {
177
+ if (call.responseType) {
178
+ const docContent = backendDocFiles
179
+ .map(f => fs.readFileSync(f, "utf-8"))
180
+ .join("\n");
181
+ if (!docContent.includes(call.responseType)) {
182
+ typeMismatches.push(`${call.endpoint} → expected type "${call.responseType}" not found in docs`);
183
+ }
184
+ }
185
+ }
186
+ if (typeMismatches.length > 0) {
187
+ report += `⚠️ **Potential Type Mismatches:**\n${typeMismatches.map(m => `- ${m}`).join("\n")}\n\n`;
188
+ }
189
+ report += `**Result:** ${missingInDocs.length === 0 && typeMismatches.length === 0 ? "PASSED" : "FAILED (see mismatches above)"}`;
190
+ return { content: [{ type: "text", text: report }] };
191
+ }
192
+ catch (err) {
193
+ const message = err instanceof Error ? err.message : String(err);
194
+ return { content: [{ type: "text", text: `Validation failed: ${message}` }] };
195
+ }
196
+ },
107
197
  };