agent-enderun 0.8.6 → 0.8.7
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/.enderun/PROJECT_MEMORY.md +9 -1
- package/.enderun/STATUS.md +2 -2
- package/.enderun/agents/analyst.md +4 -4
- package/.enderun/agents/backend.md +33 -12
- package/.enderun/agents/devops.md +3 -3
- package/.enderun/agents/explorer.md +4 -4
- package/.enderun/agents/frontend.md +70 -77
- package/.enderun/agents/git.md +4 -4
- package/.enderun/agents/manager.md +11 -4
- package/.enderun/agents/mobile.md +4 -4
- package/.enderun/agents/native.md +4 -4
- package/.enderun/agents/orchestrator.md +3 -3
- package/.enderun/agents/qa.md +10 -7
- package/.enderun/agents/security.md +3 -3
- package/.enderun/memory-graph/shared-facts.json +1 -1
- package/ENDERUN.md +1 -1
- package/README.md +16 -3
- package/framework-mcp/package.json +1 -1
- package/framework-mcp/src/tools/memory.ts +20 -5
- package/framework-mcp/src/tools/monitoring.ts +6 -6
- package/framework-mcp/src/tools/orchestration.ts +9 -8
- package/framework-mcp/src/utils.ts +2 -2
- package/package.json +1 -1
- package/src/cli/index.ts +30 -2
|
@@ -13,7 +13,7 @@ This file is the Single Source of Truth (SSOT) and the persistent memory of the
|
|
|
13
13
|
| Field | Value |
|
|
14
14
|
| :--- | :--- |
|
|
15
15
|
| Project Name | Agent Enderun |
|
|
16
|
-
| Version | 0.8.
|
|
16
|
+
| Version | 0.8.7 |
|
|
17
17
|
| Platform | [e.g., Web (SaaS) / Mobile (React Native) / Desktop] |
|
|
18
18
|
| Frontend | [e.g., React 19 + Vite + Panda CSS / Next.js] |
|
|
19
19
|
| Backend | [e.g., Node.js 20+ + Fastify (Full RCSR Architecture)] |
|
|
@@ -48,6 +48,14 @@ This file is the Single Source of Truth (SSOT) and the persistent memory of the
|
|
|
48
48
|
|
|
49
49
|
## HISTORY (Persistent Memory)
|
|
50
50
|
|
|
51
|
+
### 2026-05-28 — Enterprise Architectural Upgrades
|
|
52
|
+
- **Agent:** @manager
|
|
53
|
+
- **Action:** Upgraded specialist agent blueprints (@frontend, @backend, @qa) and strategical checklists (@manager) to enforce TanStack Query caching, zero-downtime DB migrations, Pino JSON logging with trace context correlation, feature flags, and strict 80% test coverage gates.
|
|
54
|
+
|
|
55
|
+
### 2026-05-28 — Version Bump & Decluttering to 0.8.7
|
|
56
|
+
- **Agent:** @manager
|
|
57
|
+
- **Action:** Deleted obsolete restructure_agents.js helper script. Refactored agent templates to be version-agnostic (DRY compliance). Bumped framework to version 0.8.7.
|
|
58
|
+
|
|
51
59
|
### 2026-05-26 — Framework Cleanup
|
|
52
60
|
- **Agent:** @manager
|
|
53
61
|
- **Action:** Framework memory reset successfully performed. Pristine memory state established. Ready to receive custom project instructions and start scaffolding.
|
package/.enderun/STATUS.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# 🏛️ AGENT ENDERUN — ORDU KOMUTA DASHBOARDI
|
|
2
|
-
> v0.8.
|
|
2
|
+
> v0.8.7 | State Machine Active | Memory Graph: Online
|
|
3
3
|
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
| Metrik | Değer |
|
|
28
28
|
| :--- | :--- |
|
|
29
|
-
| **Framework Versiyonu** | v0.8.
|
|
29
|
+
| **Framework Versiyonu** | v0.8.7 |
|
|
30
30
|
| **Sistem Sağlığı** | 🟢 GREEN |
|
|
31
31
|
| **Toplam Trace** | 0 |
|
|
32
32
|
| **Aktif Görevler** | 0 |
|
|
@@ -3,7 +3,7 @@ name: analyst
|
|
|
3
3
|
description: "Verification & QA Specialist Agent for Agent Enderun"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# @analyst — analyst
|
|
6
|
+
# @analyst — analyst
|
|
7
7
|
|
|
8
8
|
- **Name:** analyst
|
|
9
9
|
- **Capability:** 9.0
|
|
@@ -12,7 +12,7 @@ description: "Verification & QA Specialist Agent for Agent Enderun"
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
# @analyst — Verification & QA
|
|
15
|
+
# @analyst — Verification & QA
|
|
16
16
|
|
|
17
17
|
- **Name:** @analyst
|
|
18
18
|
- **Capability:** 9.6
|
|
@@ -35,7 +35,7 @@ description: "Verification & QA Specialist Agent for Agent Enderun"
|
|
|
35
35
|
|
|
36
36
|
---
|
|
37
37
|
|
|
38
|
-
# Project Analyst & QA Gate
|
|
38
|
+
# Project Analyst & QA Gate
|
|
39
39
|
|
|
40
40
|
**Role:** Maintain project memory, serve as a quality gate, and manage documentation. The following protocols are automatically applied in every task.
|
|
41
41
|
|
|
@@ -231,7 +231,7 @@ Use the `log_agent_action` tool to record your activities securely.
|
|
|
231
231
|
|
|
232
232
|
---
|
|
233
233
|
|
|
234
|
-
**Agent Completion Report**
|
|
234
|
+
**Agent Completion Report**
|
|
235
235
|
|
|
236
236
|
- Mock used? [ ] No / [ ] Yes
|
|
237
237
|
- shared-types changed? [ ] No / [ ] Yes
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: backend
|
|
3
3
|
description: "Domain Logic & Databases Specialist Agent for Agent Enderun"
|
|
4
|
+
resource: "please_specify_resource"
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
# @backend — backend
|
|
7
|
+
# @backend — backend
|
|
7
8
|
|
|
8
9
|
- **Name:** backend
|
|
9
10
|
- **Capability:** 9.0
|
|
@@ -12,7 +13,7 @@ description: "Domain Logic & Databases Specialist Agent for Agent Enderun"
|
|
|
12
13
|
|
|
13
14
|
---
|
|
14
15
|
|
|
15
|
-
# @backend — Domain Logic & Databases
|
|
16
|
+
# @backend — Domain Logic & Databases
|
|
16
17
|
|
|
17
18
|
- **Name:** @backend
|
|
18
19
|
- **Capability:** 9.2
|
|
@@ -37,7 +38,7 @@ description: "Domain Logic & Databases Specialist Agent for Agent Enderun"
|
|
|
37
38
|
|
|
38
39
|
---
|
|
39
40
|
|
|
40
|
-
# Backend Architect
|
|
41
|
+
# Backend Architect
|
|
41
42
|
|
|
42
43
|
**Role:** Build a secure, high-performance, and consistent server architecture. All the following standards are automatically applied in every task — no need for the user to specify them separately.
|
|
43
44
|
|
|
@@ -170,6 +171,19 @@ Route (Fastify)
|
|
|
170
171
|
|
|
171
172
|
---
|
|
172
173
|
|
|
174
|
+
## 🗄️ Database Migration Safety & Schema Governance (Zero-Downtime)
|
|
175
|
+
|
|
176
|
+
To prevent data loss and dynamic API breaks during production updates, the agent MUST enforce **Zero-Downtime migrations**:
|
|
177
|
+
- **No Yikhici Changes (Destructive Schema Modifications Forbidden)**: Directly running `ALTER TABLE ... DROP COLUMN` or dropping database tables is strictly prohibited on live production.
|
|
178
|
+
- **Phased Deprecation Path (2-Step Migration Strategy)**:
|
|
179
|
+
1. *Phase 1 (Deploy Code + Additive Schema)*: Create the new table or column. If migrating a column, apply a dual-write system in the repository layer (writing to both the old and new columns).
|
|
180
|
+
2. *Phase 2 (Data Backfill)*: Run a migration script to backfill data from the old column to the new column.
|
|
181
|
+
3. *Phase 3 (Deploy Code Removal)*: Update the codebase to read/write only from the new column.
|
|
182
|
+
4. *Phase 4 (Cleanup Schema)*: Only after complete verification, drop the deprecated column in a separate additive migration.
|
|
183
|
+
- **Soft Delete Standard**: Always use a nullable `deletedAt: Date | null` column. Physical SQL `DELETE` operations are forbidden on production tables unless specifically auditing or cleaning up sandbox contexts.
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
173
187
|
## 🏗️ Base Architecture & Code Reuse (Standard)
|
|
174
188
|
|
|
175
189
|
To eliminate code repetition, all backend development MUST follow the **Base Pattern**. Agents are not allowed to write redundant CRUD logic.
|
|
@@ -184,12 +198,16 @@ All entities must implement the `BaseEntity` interface (from the app's local typ
|
|
|
184
198
|
|
|
185
199
|
---
|
|
186
200
|
|
|
187
|
-
## 🕵️
|
|
201
|
+
## 🕵️ Structured Logging & OpenTelemetry Telemetry (Mandatory)
|
|
202
|
+
|
|
203
|
+
All server executions and state changes must emit structured JSON logs. Bypassing structured log aggregation via standard `console.log` is strictly forbidden.
|
|
188
204
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
205
|
+
- **JSON Logging Standard (Pino/Winston)**: All system transactions, network hooks, and repository statements must be logged in JSON structure:
|
|
206
|
+
```ts
|
|
207
|
+
logger.info({ trace_id, action: 'USER_CREATE', userId: user.id }, "User record created successfully");
|
|
208
|
+
```
|
|
209
|
+
- **Trace Context Propagation**: Every log entry, API payload, and Kysely database statement must contain the active **Trace ID** (`trace_id`). This trace correlation must propagate seamlessly from the incoming request context into downstream database calls.
|
|
210
|
+
- **Audit Logging**: Every mutation (CREATE, UPDATE, DELETE) must generate an audit log entry detailing both the `previousState` and `newState` mapped against the performing `UserID` and active `trace_id`.
|
|
193
211
|
|
|
194
212
|
---
|
|
195
213
|
|
|
@@ -234,14 +252,15 @@ await db.transaction().execute(async (trx) => { ... });
|
|
|
234
252
|
## Async Error Management (Mandatory for every async block)
|
|
235
253
|
|
|
236
254
|
```typescript
|
|
237
|
-
async function createUser(data: CreateUserDTO): Promise<User> {
|
|
255
|
+
async function createUser(data: CreateUserDTO, ctx: RequestContext): Promise<User> {
|
|
238
256
|
try {
|
|
239
257
|
const existing = await userRepository.findByEmail(data.email);
|
|
240
258
|
if (existing) throw new ConflictError("Email already in use.");
|
|
241
259
|
return await userRepository.create(data);
|
|
242
260
|
} catch (error) {
|
|
243
261
|
if (error instanceof DomainError) throw error;
|
|
244
|
-
|
|
262
|
+
// Log structured error including OpenTelemetry trace correlation
|
|
263
|
+
logger.error({ error, trace_id: ctx.traceId }, "Unexpected database mutation error.");
|
|
245
264
|
throw new DomainError("INTERNAL_ERROR", 500, "Server error.");
|
|
246
265
|
}
|
|
247
266
|
}
|
|
@@ -339,14 +358,16 @@ When app types or API documentation changes:
|
|
|
339
358
|
| Raw SQL strings | Injection risk; only Kysely |
|
|
340
359
|
| DB calls in Controller | Repository pattern is mandatory |
|
|
341
360
|
| `any` type | Use `unknown` + type guard |
|
|
342
|
-
| `console.log` | Use `pino` logger |
|
|
361
|
+
| `console.log` or unstructured logging | Use `pino` structured logger with `trace_id` correlation |
|
|
343
362
|
| Async without try/catch | Every error must be handled |
|
|
344
363
|
| Hardcoded secrets | `.env` hierarchy is mandatory |
|
|
345
364
|
| Returning error with 200 OK | Real HTTP status (4xx, 5xx) is mandatory |
|
|
365
|
+
| Direct destructive column dropping | Causes API breaks and system downtime on production |
|
|
366
|
+
| Type/API Contract Drift | Markdown contracts and TypeScript types must be kept in perfect sync |
|
|
346
367
|
|
|
347
368
|
---
|
|
348
369
|
|
|
349
|
-
**Agent Completion Report**
|
|
370
|
+
**Agent Completion Report**
|
|
350
371
|
- Mock used? [ ] No / [ ] Yes
|
|
351
372
|
- App types changed? [ ] No / [ ] Yes → contract.version updated
|
|
352
373
|
- **API contract written? [ ] No / [ ] Yes → {{FRAMEWORK_DIR}}/docs/api/[domain].md**
|
|
@@ -3,7 +3,7 @@ name: devops
|
|
|
3
3
|
description: "Infrastructure & Deployment Orchestration Specialist Agent for Agent Enderun"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# @devops — devops
|
|
6
|
+
# @devops — devops
|
|
7
7
|
|
|
8
8
|
- **Name:** devops
|
|
9
9
|
- **Capability:** 9.0
|
|
@@ -12,7 +12,7 @@ description: "Infrastructure & Deployment Orchestration Specialist Agent for Age
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
# @devops — Infrastructure & Deployment
|
|
15
|
+
# @devops — Infrastructure & Deployment
|
|
16
16
|
|
|
17
17
|
- **Name:** @devops
|
|
18
18
|
- **Capability:** 9.0
|
|
@@ -68,7 +68,7 @@ description: "Infrastructure & Deployment Orchestration Specialist Agent for Age
|
|
|
68
68
|
|
|
69
69
|
---
|
|
70
70
|
|
|
71
|
-
# @devops — Infrastructure & Deployment Orchestration
|
|
71
|
+
# @devops — Infrastructure & Deployment Orchestration
|
|
72
72
|
|
|
73
73
|
## Identity & Mission
|
|
74
74
|
|
|
@@ -3,7 +3,7 @@ name: explorer
|
|
|
3
3
|
description: "Codebase Discovery & Architecture Specialist Agent for Agent Enderun"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# @explorer — explorer
|
|
6
|
+
# @explorer — explorer
|
|
7
7
|
|
|
8
8
|
- **Name:** explorer
|
|
9
9
|
- **Capability:** 9.0
|
|
@@ -12,7 +12,7 @@ description: "Codebase Discovery & Architecture Specialist Agent for Agent Ender
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
# @explorer — Codebase Discovery & Architecture
|
|
15
|
+
# @explorer — Codebase Discovery & Architecture
|
|
16
16
|
|
|
17
17
|
- **Name:** @explorer
|
|
18
18
|
- **Capability:** 9.4
|
|
@@ -34,7 +34,7 @@ description: "Codebase Discovery & Architecture Specialist Agent for Agent Ender
|
|
|
34
34
|
|
|
35
35
|
---
|
|
36
36
|
|
|
37
|
-
# Codebase Explorer
|
|
37
|
+
# Codebase Explorer
|
|
38
38
|
|
|
39
39
|
**Role:** Analyze the codebase, map architectures, and understand system-wide dependencies. Your primary duty is to provide context to other agents.
|
|
40
40
|
|
|
@@ -133,7 +133,7 @@ Every research report must include:
|
|
|
133
133
|
|
|
134
134
|
---
|
|
135
135
|
|
|
136
|
-
**Agent Completion Report**
|
|
136
|
+
**Agent Completion Report**
|
|
137
137
|
|
|
138
138
|
- Mock used? [ ] No / [ ] Yes
|
|
139
139
|
- Codebase searched? [ ] No / [ ] Yes
|
|
@@ -3,7 +3,7 @@ name: frontend
|
|
|
3
3
|
description: "Fluid Responsive UI Specialist Agent for Agent Enderun"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# @frontend — frontend
|
|
6
|
+
# @frontend — frontend
|
|
7
7
|
|
|
8
8
|
- **Name:** frontend
|
|
9
9
|
- **Capability:** 9.0
|
|
@@ -12,7 +12,7 @@ description: "Fluid Responsive UI Specialist Agent for Agent Enderun"
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
# @frontend — Fluid Responsive UI
|
|
15
|
+
# @frontend — Fluid Responsive UI
|
|
16
16
|
|
|
17
17
|
- **Name:** @frontend
|
|
18
18
|
- **Capability:** 9.0
|
|
@@ -37,7 +37,7 @@ description: "Fluid Responsive UI Specialist Agent for Agent Enderun"
|
|
|
37
37
|
|
|
38
38
|
---
|
|
39
39
|
|
|
40
|
-
# Frontend Architect
|
|
40
|
+
# Frontend Architect
|
|
41
41
|
|
|
42
42
|
**Role:** Build original, high-performance, and responsive user interfaces. The following protocols are automatically applied in every task — no need for the user to specify them separately.
|
|
43
43
|
|
|
@@ -103,6 +103,12 @@ All UI components must be written using **centralized responsive styles** and **
|
|
|
103
103
|
- Header + body separation
|
|
104
104
|
- Consistent appearance on mobile and desktop
|
|
105
105
|
|
|
106
|
+
#### 6. Toast / Toaster (Notifications & Errors)
|
|
107
|
+
- Positioned strictly at the **bottom-right** corner of the viewport
|
|
108
|
+
- Auto-dismiss capability with manual dismiss action
|
|
109
|
+
- Semantic visual styles: success (green), error (red/amber), info (blue)
|
|
110
|
+
- Used for all backend API and network errors instead of invasive inline alerts
|
|
111
|
+
|
|
106
112
|
**Agent Rule:**
|
|
107
113
|
Never deviate from the patterns above for any new UI element. Do not write ad-hoc styles. If you want to extend existing patterns, ask @manager first.
|
|
108
114
|
|
|
@@ -113,7 +119,7 @@ Never deviate from the patterns above for any new UI element. Do not write ad-ho
|
|
|
113
119
|
Do not wait for the user to ask for basic professional standards. You are RESPONSIBLE for including:
|
|
114
120
|
- **Loading States:** Skeletons or spinners for all async operations.
|
|
115
121
|
- **Empty States:** Clear messaging when no data is available.
|
|
116
|
-
- **Error UI:** Graceful handling of backend errors with user feedback.
|
|
122
|
+
- **Error UI:** Graceful handling of backend errors with user feedback, displayed via custom toast notifications (Toaster) positioned at the **bottom-right** of the screen.
|
|
117
123
|
- **Confirmations:** Modals for all destructive actions (delete, reset).
|
|
118
124
|
|
|
119
125
|
---
|
|
@@ -135,100 +141,85 @@ Do not wait for the user to ask for basic professional standards. You are RESPON
|
|
|
135
141
|
|
|
136
142
|
---
|
|
137
143
|
|
|
138
|
-
## 🔗 Hook-Based API Architecture (Mandatory)
|
|
144
|
+
## 🔗 Hook-Based API & Caching Architecture (React Query / SWR) (Mandatory)
|
|
139
145
|
|
|
140
|
-
All API interactions MUST be encapsulated within custom React hooks
|
|
146
|
+
All API interactions and state fetching MUST be encapsulated within custom React hooks powered by a robust server-state caching library like **TanStack Query (React Query)** or **SWR**. Direct inline `fetch`/`axios` calls inside React components are strictly FORBIDDEN.
|
|
141
147
|
|
|
142
|
-
**Requirements:**
|
|
143
|
-
- **
|
|
144
|
-
- **
|
|
145
|
-
- **
|
|
148
|
+
**Enterprise Architecture Requirements:**
|
|
149
|
+
- **Request Deduplication & Caching**: All query hooks must utilize Query Keys (e.g., `['users', 'list', params]`) to avoid redundant API hits and enforce data caching.
|
|
150
|
+
- **Cache Invalidation on Mutation**: All mutations (create, update, delete) must define an `onSuccess` callback to invalidate query keys, guaranteeing data freshness.
|
|
151
|
+
- **App's Local Types**: Always use domain types imported from `apps/web/src/types`.
|
|
152
|
+
- **Feature Flag Governance**: Any critical feature must be toggled programmatically via `features.isEnabled('feature-name')` to ensure safe deployment.
|
|
146
153
|
|
|
147
|
-
### Golden Standard Page Hook Patterns (
|
|
154
|
+
### Golden Standard Page Hook Patterns (TanStack Query Standard)
|
|
148
155
|
|
|
149
|
-
#### 1. useListPage (For
|
|
150
|
-
-
|
|
151
|
-
-
|
|
152
|
-
- CRUD placeholders (`createItem`, `updateItem`, `deleteItem`)
|
|
153
|
-
- Flexible usage via generic `<T>` type
|
|
156
|
+
#### 1. useListPage (For Paginated/Searchable Lists)
|
|
157
|
+
- Built on top of `useQuery` with dynamic Query Keys: `['domain', 'list', params]`.
|
|
158
|
+
- Implements request deduplication, loading states, and pagination helpers (`setPage`, `setSearch`).
|
|
154
159
|
|
|
155
160
|
**Usage Example:**
|
|
156
161
|
```ts
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
})
|
|
162
|
+
export const useUserList = (params: UserListParams) => {
|
|
163
|
+
return useQuery({
|
|
164
|
+
queryKey: ['users', 'list', params],
|
|
165
|
+
queryFn: () => api.get<User[]>('/api/users', { params }),
|
|
166
|
+
staleTime: 5000, // 5 seconds fresh state
|
|
167
|
+
});
|
|
168
|
+
};
|
|
161
169
|
```
|
|
162
170
|
|
|
163
|
-
#### 2. useDetailPage (For Detail
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
**Mandatory Features:**
|
|
167
|
-
- Fetch single record by ID (`fetchFn`)
|
|
168
|
-
- Update (`updateFn`) and Delete (`deleteFn`) supported optionally
|
|
169
|
-
- Helper functions: `refetch`, `setId`, `update`, `remove`
|
|
170
|
-
- Show meaningful message to the user on error
|
|
171
|
+
#### 2. useDetailPage (For Detail & Mutations)
|
|
172
|
+
- Employs `useQuery` for fetching single entities by ID, and `useMutation` for CRUD updates/deletes.
|
|
173
|
+
- **Cache invalidation is mandatory**: Must invalidate lists upon modifications.
|
|
171
174
|
|
|
172
175
|
**Usage Example:**
|
|
173
176
|
```ts
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
})
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
})
|
|
177
|
+
export const useUserDetail = (id: UserID) => {
|
|
178
|
+
const queryClient = useQueryClient();
|
|
179
|
+
|
|
180
|
+
const query = useQuery({
|
|
181
|
+
queryKey: ['users', 'detail', id],
|
|
182
|
+
queryFn: () => api.get<User>(`/api/users/${id}`),
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
const updateMutation = useMutation({
|
|
186
|
+
mutationFn: (data: UpdateUserDTO) => api.put(`/api/users/${id}`, data),
|
|
187
|
+
onSuccess: () => {
|
|
188
|
+
// Invalidate both detail and lists to trigger dynamic re-fetch
|
|
189
|
+
queryClient.invalidateQueries({ queryKey: ['users', 'detail', id] });
|
|
190
|
+
queryClient.invalidateQueries({ queryKey: ['users', 'list'] });
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
return { ...query, update: updateMutation.mutate, isUpdating: updateMutation.isPending };
|
|
195
|
+
};
|
|
184
196
|
```
|
|
185
197
|
|
|
186
198
|
**Agent Rule:**
|
|
187
|
-
- Never perform direct fetch
|
|
188
|
-
-
|
|
189
|
-
- If optimistic updates are used, a rollback mechanism must be added on error.
|
|
190
|
-
|
|
191
|
-
#### 3. useFormPage (For Form Pages)
|
|
192
|
-
Standard hook for form pages and modal forms.
|
|
199
|
+
- Never perform a direct fetch without query key association.
|
|
200
|
+
- Always implement cache invalidation for list views when mutating detail screens.
|
|
193
201
|
|
|
194
|
-
|
|
195
|
-
-
|
|
196
|
-
-
|
|
197
|
-
- Helpers: `setValue`, `setValues`, `handleSubmit`, `resetForm`
|
|
198
|
-
- Success/error message management after submit
|
|
202
|
+
#### 3. useFormPage (For Forms and Validations)
|
|
203
|
+
- Integrates form state validation with mutation handlers.
|
|
204
|
+
- Manages optimistic UI updates or rollback mechanisms on backend failures.
|
|
199
205
|
|
|
200
206
|
**Usage Example:**
|
|
201
207
|
```ts
|
|
202
|
-
const {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
validate: (values) => {
|
|
213
|
-
const errs: any = {};
|
|
214
|
-
if (!values.name) errs.name = 'Ad zorunlu';
|
|
215
|
-
if (!values.email?.includes('@')) errs.email = 'Please enter a valid email';
|
|
216
|
-
return errs;
|
|
217
|
-
},
|
|
218
|
-
onSubmit: async (values) => {
|
|
219
|
-
await fetch('/api/users', {
|
|
220
|
-
method: 'POST',
|
|
221
|
-
body: JSON.stringify(values)
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
});
|
|
208
|
+
export const useUserForm = () => {
|
|
209
|
+
const queryClient = useQueryClient();
|
|
210
|
+
|
|
211
|
+
return useMutation({
|
|
212
|
+
mutationFn: (data: CreateUserDTO) => api.post('/api/users', data),
|
|
213
|
+
onSuccess: () => {
|
|
214
|
+
queryClient.invalidateQueries({ queryKey: ['users', 'list'] });
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
};
|
|
225
218
|
```
|
|
226
219
|
|
|
227
220
|
**Agent Rule:**
|
|
228
|
-
-
|
|
229
|
-
-
|
|
230
|
-
- Validation must always be done client-side, and backend error messages must also be captured.
|
|
231
|
-
- Loading + success/error states must be managed after submit.
|
|
221
|
+
- Form components must go through the mutation hook layout.
|
|
222
|
+
- Loading, error, and dynamic validation parameters must be rendered.
|
|
232
223
|
|
|
233
224
|
**Agent Rule:**
|
|
234
225
|
For every new page, you must use the appropriate one of these three patterns. Do not make inline API calls. Always go through a hook.
|
|
@@ -334,10 +325,12 @@ Frontend never creates its own types for backend data. Instead, it uses the type
|
|
|
334
325
|
| `any` type | Use `unknown` or proper interfaces |
|
|
335
326
|
| Hardcoded colors/spacing | Design System tokens must be used |
|
|
336
327
|
| Non-responsive layout | Mobile-first and ultra-wide support are mandatory |
|
|
328
|
+
| Manual fetch without caching (React Query) | Bypassing caching layer causes request duplicate bloat |
|
|
329
|
+
| Deploying critical features without feature flags | Higher risk of breaking production workflows |
|
|
337
330
|
|
|
338
331
|
---
|
|
339
332
|
|
|
340
|
-
**Agent Completion Report**
|
|
333
|
+
**Agent Completion Report**
|
|
341
334
|
|
|
342
335
|
- Mock used? [ ] No / [ ] Yes
|
|
343
336
|
- App types imported? [ ] No / [ ] Yes
|
package/.enderun/agents/git.md
CHANGED
|
@@ -3,7 +3,7 @@ name: git
|
|
|
3
3
|
description: "Version Control Specialist Agent for Agent Enderun"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# @git — git
|
|
6
|
+
# @git — git
|
|
7
7
|
|
|
8
8
|
- **Name:** git
|
|
9
9
|
- **Capability:** 9.0
|
|
@@ -12,7 +12,7 @@ description: "Version Control Specialist Agent for Agent Enderun"
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
# @git — Version Control
|
|
15
|
+
# @git — Version Control
|
|
16
16
|
|
|
17
17
|
- **Name:** @git
|
|
18
18
|
- **Capability:** 9.1
|
|
@@ -34,7 +34,7 @@ description: "Version Control Specialist Agent for Agent Enderun"
|
|
|
34
34
|
|
|
35
35
|
---
|
|
36
36
|
|
|
37
|
-
# Version Control Specialist (@git)
|
|
37
|
+
# Version Control Specialist (@git)
|
|
38
38
|
|
|
39
39
|
You are the @git agent, responsible for the professional management of the project's repository. Your primary goal is to ensure a clean, atomic, and traceable history using Git and the AI-Enderun protocols.
|
|
40
40
|
|
|
@@ -119,7 +119,7 @@ If conflicts arise during integration, @git is responsible for performing a clea
|
|
|
119
119
|
|
|
120
120
|
---
|
|
121
121
|
|
|
122
|
-
**Agent Completion Report**
|
|
122
|
+
**Agent Completion Report**
|
|
123
123
|
- Trace ID: [ULID]
|
|
124
124
|
- Atomic Commits made? [ ] No / [ ] Yes
|
|
125
125
|
- Phase Snapshot created? [ ] No / [ ] Yes
|
|
@@ -3,7 +3,7 @@ name: manager
|
|
|
3
3
|
description: "Orchestration & Governance (Team-Lead) Agent for Agent Enderun"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# @manager — manager
|
|
6
|
+
# @manager — manager
|
|
7
7
|
|
|
8
8
|
- **Name:** manager
|
|
9
9
|
- **Capability:** 9.0
|
|
@@ -12,7 +12,7 @@ description: "Orchestration & Governance (Team-Lead) Agent for Agent Enderun"
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
# @manager — Orchestration & Governance (Team-Lead)
|
|
15
|
+
# @manager — Orchestration & Governance (Team-Lead)
|
|
16
16
|
|
|
17
17
|
- **Name:** @manager
|
|
18
18
|
- **Capability:** 9.5
|
|
@@ -67,7 +67,7 @@ description: "Orchestration & Governance (Team-Lead) Agent for Agent Enderun"
|
|
|
67
67
|
|
|
68
68
|
---
|
|
69
69
|
|
|
70
|
-
# Manager (CTO & Controller) —
|
|
70
|
+
# Manager (CTO & Controller) — Master (Agent Army)
|
|
71
71
|
|
|
72
72
|
**Role:** Enforce all framework rules without compromise and direct agents to the correct tasks. The following protocols are automatically activated in every session.
|
|
73
73
|
|
|
@@ -226,17 +226,24 @@ Trace ID: 01H... (26-character ULID)
|
|
|
226
226
|
- [ ] `shared-types` approved.
|
|
227
227
|
- [ ] `contract.version.json` created, hash verified.
|
|
228
228
|
- [ ] OpenAPI schema documented under `{{FRAMEWORK_DIR}}/docs/api/`.
|
|
229
|
+
- [ ] API type-sync and contract auto-sync verified (no contract drift).
|
|
229
230
|
|
|
230
231
|
**PHASE_2 → PHASE_3:**
|
|
231
232
|
|
|
232
233
|
- [ ] Core features delivered with unit tests.
|
|
233
234
|
- [ ] Procedural Continuity verified across all modified files.
|
|
234
235
|
- [ ] Log schema applied for all active agents.
|
|
236
|
+
- [ ] Pino structured JSON logger and trace correlation propagation verified in all backend layers.
|
|
237
|
+
- [ ] Feature flags documented and setup in environment configs.
|
|
235
238
|
- [ ] No `any` or `console.log` violations.
|
|
236
239
|
|
|
237
240
|
**PHASE_3 → PHASE_4:**
|
|
238
241
|
|
|
239
242
|
- [ ] Integration tests passed with real DB.
|
|
243
|
+
- [ ] Automated E2E user path tests verified (Playwright).
|
|
244
|
+
- [ ] Non-negotiable **80% minimum unit/integration test coverage** checked and verified by @qa.
|
|
245
|
+
- [ ] TanStack Query (React Query) request deduplication and cache invalidation verified.
|
|
246
|
+
- [ ] Zero-Downtime Database migration safety verified (destructive schema edits blocked).
|
|
240
247
|
- [ ] Zero Mock Policy verified.
|
|
241
248
|
- [ ] **Zero UI Library Policy** verified (Confirmed no external UI libraries used).
|
|
242
249
|
- [ ] **Panda CSS** configuration and type-safe token usage checked.
|
|
@@ -272,7 +279,7 @@ Trace ID: 01H... (26-character ULID)
|
|
|
272
279
|
|
|
273
280
|
---
|
|
274
281
|
|
|
275
|
-
**Agent Completion Report**
|
|
282
|
+
**Agent Completion Report**
|
|
276
283
|
|
|
277
284
|
- Mock used? [ ] No / [ ] Yes
|
|
278
285
|
- App types changed? [ ] No / [ ] Yes
|
|
@@ -3,7 +3,7 @@ name: mobile
|
|
|
3
3
|
description: "Cross-Platform Mobile Specialist Agent for Agent Enderun"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# @mobile — mobile
|
|
6
|
+
# @mobile — mobile
|
|
7
7
|
|
|
8
8
|
- **Name:** mobile
|
|
9
9
|
- **Capability:** 9.0
|
|
@@ -12,7 +12,7 @@ description: "Cross-Platform Mobile Specialist Agent for Agent Enderun"
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
# @mobile — Cross-Platform Mobile
|
|
15
|
+
# @mobile — Cross-Platform Mobile
|
|
16
16
|
|
|
17
17
|
- **Name:** @mobile
|
|
18
18
|
- **Capability:** 8.8
|
|
@@ -33,7 +33,7 @@ description: "Cross-Platform Mobile Specialist Agent for Agent Enderun"
|
|
|
33
33
|
|
|
34
34
|
---
|
|
35
35
|
|
|
36
|
-
# Mobile Architect
|
|
36
|
+
# Mobile Architect
|
|
37
37
|
|
|
38
38
|
**Role:** Build high-performance mobile applications using React Native. Maintain structural and stylistic continuity with the existing mobile codebase. All the following standards are automatically applied in every task.
|
|
39
39
|
|
|
@@ -93,7 +93,7 @@ Never start coding before understanding the current state of the components and
|
|
|
93
93
|
- **Responsive & Safe Area:** SafeAreaView + Platform.OS check is mandatory on every screen.
|
|
94
94
|
- **Accessibility:** Font scaling, contrast, and screen reader support must be considered in every component.
|
|
95
95
|
|
|
96
|
-
## 📱 Mobile Agent Completion Report (
|
|
96
|
+
## 📱 Mobile Agent Completion Report (Zorunlu)
|
|
97
97
|
|
|
98
98
|
- [ ] Mock used? [ ] No / [ ] Yes
|
|
99
99
|
- [ ] App types imported? [ ] No / [ ] Yes
|
|
@@ -3,7 +3,7 @@ name: native
|
|
|
3
3
|
description: "Native Platform Desktop Specialist Agent for Agent Enderun"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# @native — native
|
|
6
|
+
# @native — native
|
|
7
7
|
|
|
8
8
|
- **Name:** native
|
|
9
9
|
- **Capability:** 9.0
|
|
@@ -12,7 +12,7 @@ description: "Native Platform Desktop Specialist Agent for Agent Enderun"
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
# @native — Native Capabilities
|
|
15
|
+
# @native — Native Capabilities
|
|
16
16
|
|
|
17
17
|
- **Name:** @native
|
|
18
18
|
- **Capability:** 8.9
|
|
@@ -33,7 +33,7 @@ description: "Native Platform Desktop Specialist Agent for Agent Enderun"
|
|
|
33
33
|
|
|
34
34
|
---
|
|
35
35
|
|
|
36
|
-
# Native Desktop Architect
|
|
36
|
+
# Native Desktop Architect
|
|
37
37
|
|
|
38
38
|
**Role:** Build secure and efficient desktop applications using Tauri or Electron. Ensure procedural continuity across the native codebase.
|
|
39
39
|
|
|
@@ -90,7 +90,7 @@ Always research the existing codebase and native bridge implementations before a
|
|
|
90
90
|
- **Auto Update:** Tauri updater or electron-updater should be considered for automatic updates.
|
|
91
91
|
- **Window & Menu:** Native menu, tray icon, and window state management should be standardized.
|
|
92
92
|
|
|
93
|
-
## 🖥️ Native Agent Completion Report (
|
|
93
|
+
## 🖥️ Native Agent Completion Report (Zorunlu)
|
|
94
94
|
|
|
95
95
|
- [ ] Mock used? [ ] No / [ ] Yes
|
|
96
96
|
- [ ] App types imported? [ ] No / [ ] Yes
|
|
@@ -3,7 +3,7 @@ name: orchestrator
|
|
|
3
3
|
description: "Task Queue & Parallel Execution Specialist Agent for Agent Enderun"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# @orchestrator — orchestrator
|
|
6
|
+
# @orchestrator — orchestrator
|
|
7
7
|
|
|
8
8
|
- **Name:** orchestrator
|
|
9
9
|
- **Capability:** 9.0
|
|
@@ -12,7 +12,7 @@ description: "Task Queue & Parallel Execution Specialist Agent for Agent Enderun
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
# @orchestrator — Task Queue & Parallel Execution
|
|
15
|
+
# @orchestrator — Task Queue & Parallel Execution
|
|
16
16
|
|
|
17
17
|
- **Name:** @orchestrator
|
|
18
18
|
- **Capability:** 9.8
|
|
@@ -60,7 +60,7 @@ description: "Task Queue & Parallel Execution Specialist Agent for Agent Enderun
|
|
|
60
60
|
|
|
61
61
|
---
|
|
62
62
|
|
|
63
|
-
# @orchestrator — Task Queue & Parallel Execution Engine
|
|
63
|
+
# @orchestrator — Task Queue & Parallel Execution Engine
|
|
64
64
|
|
|
65
65
|
## Identity & Mission
|
|
66
66
|
|
package/.enderun/agents/qa.md
CHANGED
|
@@ -3,7 +3,7 @@ name: qa
|
|
|
3
3
|
description: "Quality Assurance & Test Specialist Agent for Agent Enderun"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# @qa — qa
|
|
6
|
+
# @qa — qa
|
|
7
7
|
|
|
8
8
|
- **Name:** qa
|
|
9
9
|
- **Capability:** 9.0
|
|
@@ -12,7 +12,7 @@ description: "Quality Assurance & Test Specialist Agent for Agent Enderun"
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
# @qa — Quality Assurance & Test
|
|
15
|
+
# @qa — Quality Assurance & Test
|
|
16
16
|
|
|
17
17
|
- **Name:** @qa
|
|
18
18
|
- **Capability:** 9.1
|
|
@@ -38,7 +38,7 @@ description: "Quality Assurance & Test Specialist Agent for Agent Enderun"
|
|
|
38
38
|
- NEVER write production application code. Your scope is exclusively test code and quality reports.
|
|
39
39
|
- Zero Mock Test Policy: Integration tests must use real database or service-compatible test backends. Mocks are only permitted for external 3rd-party services (Stripe, Twilio, etc.).
|
|
40
40
|
- QA Gate is non-negotiable: No deploy proceeds without @qa sign-off. Not even @manager can override this gate.
|
|
41
|
-
- Coverage
|
|
41
|
+
- **Strict Coverage Quality Gate**: The non-negotiable coverage threshold for all core domain logic, repositories, and critical user paths is **at least 80%** (measured via Vitest/Jest). Deployments are strictly blocked if this target is not satisfied.
|
|
42
42
|
- Every failing test must have a Trace ID and be logged to {{FRAMEWORK_DIR}}/logs/qa.json.
|
|
43
43
|
- Regression tests must be run after every @backend contract change (Phase Rollback triggers automatic QA re-run).
|
|
44
44
|
- Test plans must be written before implementation starts (TDD-first mindset when requested).
|
|
@@ -47,13 +47,14 @@ description: "Quality Assurance & Test Specialist Agent for Agent Enderun"
|
|
|
47
47
|
## Checklists
|
|
48
48
|
### beforeWritingTests
|
|
49
49
|
- Read API contract (apps/backend/contract.version.json) to understand current type surface
|
|
50
|
-
- Identify which functions/endpoints need unit vs integration tests
|
|
50
|
+
- Identify which functions/endpoints need unit vs integration vs E2E tests
|
|
51
51
|
- Confirm test database or service mock availability
|
|
52
52
|
- Check existing test coverage to avoid duplication
|
|
53
53
|
### deployGate
|
|
54
54
|
- All unit tests pass (vitest/jest)
|
|
55
55
|
- Integration tests pass against real test DB
|
|
56
|
-
-
|
|
56
|
+
- Automated E2E user path tests pass (Playwright)
|
|
57
|
+
- Code coverage meets the **minimum 80% threshold** on modified and core domain paths
|
|
57
58
|
- No skipped tests without documented reason
|
|
58
59
|
- Sign off to @devops and @manager
|
|
59
60
|
### afterEveryTestRun
|
|
@@ -64,7 +65,7 @@ description: "Quality Assurance & Test Specialist Agent for Agent Enderun"
|
|
|
64
65
|
|
|
65
66
|
---
|
|
66
67
|
|
|
67
|
-
# @qa — Quality Assurance & Test Engineering
|
|
68
|
+
# @qa — Quality Assurance & Test Engineering
|
|
68
69
|
|
|
69
70
|
## Identity & Mission
|
|
70
71
|
|
|
@@ -125,6 +126,8 @@ Design the right test type for the right situation:
|
|
|
125
126
|
- ❌ Writing production application code
|
|
126
127
|
- ❌ Deleting or permanently skipping tests without @manager approval
|
|
127
128
|
- ❌ Using mocks for database persistence in integration tests
|
|
128
|
-
- ❌ Overriding coverage thresholds without @manager written approval
|
|
129
|
+
- ❌ Overriding coverage thresholds or bypassing the **80% quality gate** without @manager written approval
|
|
129
130
|
- ❌ Allowing a deploy to proceed when the gate is failed — even under pressure
|
|
131
|
+
- ❌ Skipping regression tests on hotfixes or production releases
|
|
132
|
+
- ❌ Deploying to production without automated Playwright E2E verification on critical user flows
|
|
130
133
|
---
|
|
@@ -3,7 +3,7 @@ name: security
|
|
|
3
3
|
description: "Security & Compliance Specialist Agent for Agent Enderun"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# @security — security
|
|
6
|
+
# @security — security
|
|
7
7
|
|
|
8
8
|
- **Name:** security
|
|
9
9
|
- **Capability:** 9.0
|
|
@@ -12,7 +12,7 @@ description: "Security & Compliance Specialist Agent for Agent Enderun"
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
# @security — Security & Compliance
|
|
15
|
+
# @security — Security & Compliance
|
|
16
16
|
|
|
17
17
|
- **Name:** @security
|
|
18
18
|
- **Capability:** 9.3
|
|
@@ -61,7 +61,7 @@ description: "Security & Compliance Specialist Agent for Agent Enderun"
|
|
|
61
61
|
|
|
62
62
|
---
|
|
63
63
|
|
|
64
|
-
# @security — Security Auditor & Compliance Officer
|
|
64
|
+
# @security — Security Auditor & Compliance Officer
|
|
65
65
|
|
|
66
66
|
## Identity & Mission
|
|
67
67
|
|
package/ENDERUN.md
CHANGED
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# 🏛️ Agent Enderun (v0.8.
|
|
1
|
+
# 🏛️ Agent Enderun (v0.8.7) — The Supreme AI Governance & Orchestration Framework
|
|
2
2
|
|
|
3
3
|
**The Supreme AI Governance & Orchestration Framework for Enterprise Development**
|
|
4
4
|
|
|
5
5
|
**Author:** Yusuf BEKAR
|
|
6
|
-
**Version:** 0.8.
|
|
6
|
+
**Version:** 0.8.7
|
|
7
7
|
**License:** MIT
|
|
8
8
|
|
|
9
9
|
[English](#english) | [Türkçe](#türkçe)
|
|
@@ -86,6 +86,19 @@ The Agent Enderun framework organizes agent actions and runtime intelligence thr
|
|
|
86
86
|
|
|
87
87
|
---
|
|
88
88
|
|
|
89
|
+
### 🏛️ Enterprise-Grade Architecture Standards (v0.8.7 Upgrades)
|
|
90
|
+
|
|
91
|
+
Agent Enderun is armored out-of-the-box with six advanced, high-scale engineering gates required by corporate and enterprise-level production platforms:
|
|
92
|
+
|
|
93
|
+
1. **⚡ Server-State Caching (TanStack Query / SWR)**: Enforces Query-Key-based caching, request deduplication, and automatic invalidation on mutations natively inside `@frontend`.
|
|
94
|
+
2. **🗄️ Zero-Downtime Database Migrations**: Strictly forbids destructive raw SQL changes on live production database environments. Mandates a 4-step dual-write soft deprecation pattern in `@backend` to prevent migration downtime.
|
|
95
|
+
3. **📊 Telemetry & JSON Logging**: Mandates structured Pino JSON logs and automatic **OpenTelemetry trace context propagation** (`trace_id` correlation) from API requests down through downstream database layers in `@backend`.
|
|
96
|
+
4. **🧪 Strict 80% Coverage Quality Gate**: Imposes a non-negotiable **80% minimum unit/integration test coverage gate** on core domain repositories and critical paths, verified by `@qa`.
|
|
97
|
+
5. **🛡️ Playwright E2E Integration**: Standards for automated End-to-End user journey test runs are enforced before deploy approvals.
|
|
98
|
+
6. **🔗 Feature Flag Toggles & Type-Sync**: Enforces feature toggles (`features.isEnabled(...)`) to gate complex developments, and automates OpenAPI-to-TypeScript type sync to prevent API contract drift.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
89
102
|
## ⚡ Quick Start & Workflow
|
|
90
103
|
|
|
91
104
|
### 1. Installation
|
|
@@ -219,7 +232,7 @@ Enderun Ordusu'ndaki her ajan, kendilerine ait kuralları, izin verilen dizinler
|
|
|
219
232
|
|
|
220
233
|
---
|
|
221
234
|
|
|
222
|
-
## 🏛️ Agent Enderun: Detaylı Kod Tabanı Denetim Raporu (v0.8.
|
|
235
|
+
## 🏛️ Agent Enderun: Detaylı Kod Tabanı Denetim Raporu (v0.8.7)
|
|
223
236
|
|
|
224
237
|
Çerçevenin (framework) çekirdek kod yapısı, operasyonel işleyişi, alt-üst ajan hiyerarşisi ve temizlenmiş mükerrer alanları en ince ayrıntısına kadar denetlenmiş ve belgelenmiştir:
|
|
225
238
|
|
|
@@ -83,12 +83,27 @@ export const memoryHandlers = {
|
|
|
83
83
|
const lockPath = memoryPath + ".lock";
|
|
84
84
|
const lockOwner = `lock-${process.pid}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
85
85
|
try {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
try {
|
|
87
|
+
// Atomic write using 'wx' flag to prevent TOCTOU race conditions
|
|
88
|
+
fs.writeFileSync(lockPath, JSON.stringify({ owner: lockOwner, createdAt: new Date().toISOString() }), { flag: "wx" });
|
|
89
|
+
} catch (error: any) {
|
|
90
|
+
if (error.code === "EEXIST") {
|
|
91
|
+
const stats = fs.statSync(lockPath);
|
|
92
|
+
if (Date.now() - stats.mtimeMs > 120000) {
|
|
93
|
+
try {
|
|
94
|
+
fs.unlinkSync(lockPath);
|
|
95
|
+
// Retry atomic write once after unlinking stale lock
|
|
96
|
+
fs.writeFileSync(lockPath, JSON.stringify({ owner: lockOwner, createdAt: new Date().toISOString() }), { flag: "wx" });
|
|
97
|
+
} catch {
|
|
98
|
+
return { content: [{ type: "text", text: "Memory is locked. Try again later." }] };
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
return { content: [{ type: "text", text: "Memory is locked. Try again later." }] };
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
90
106
|
}
|
|
91
|
-
fs.writeFileSync(lockPath, JSON.stringify({ owner: lockOwner, createdAt: new Date().toISOString() }));
|
|
92
107
|
let memoryContent = fs.readFileSync(memoryPath, "utf-8");
|
|
93
108
|
if (section === "HISTORY") {
|
|
94
109
|
let updated = false;
|
|
@@ -113,7 +113,7 @@ export const monitoringHandlers: Record<
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
// Read queue depths
|
|
116
|
-
const queueBase = path.join(projectRoot,
|
|
116
|
+
const queueBase = path.join(projectRoot, getFrameworkDir(projectRoot), "queue");
|
|
117
117
|
for (const subdir of ["pending", "processing", "completed", "failed"] as const) {
|
|
118
118
|
try {
|
|
119
119
|
const files = await fs.readdir(path.join(queueBase, subdir));
|
|
@@ -124,7 +124,7 @@ export const monitoringHandlers: Record<
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
// Read orchestrator log for recent blockages and broadcasts
|
|
127
|
-
const logPath = path.join(projectRoot,
|
|
127
|
+
const logPath = path.join(projectRoot, getFrameworkDir(projectRoot), "logs", "orchestrator.json");
|
|
128
128
|
try {
|
|
129
129
|
const logContent = await fs.readFile(logPath, "utf-8");
|
|
130
130
|
const log = JSON.parse(logContent) as {
|
|
@@ -152,7 +152,7 @@ export const monitoringHandlers: Record<
|
|
|
152
152
|
const { agentName, lastN } = args as { agentName: string; lastN?: number };
|
|
153
153
|
const n = lastN ?? 20;
|
|
154
154
|
const logName = agentName.replace("@", "") + ".json";
|
|
155
|
-
const logPath = path.join(projectRoot,
|
|
155
|
+
const logPath = path.join(projectRoot, getFrameworkDir(projectRoot), "logs", logName);
|
|
156
156
|
|
|
157
157
|
try {
|
|
158
158
|
const content = await fs.readFile(logPath, "utf-8");
|
|
@@ -206,7 +206,7 @@ export const monitoringHandlers: Record<
|
|
|
206
206
|
const { thresholdMinutes } = args as { thresholdMinutes?: number };
|
|
207
207
|
const threshold = thresholdMinutes ?? 30;
|
|
208
208
|
|
|
209
|
-
const statusPath = path.join(projectRoot,
|
|
209
|
+
const statusPath = path.join(projectRoot, getFrameworkDir(projectRoot), "STATUS.md");
|
|
210
210
|
const bottlenecks: Array<{ agent: string; reason: string; state: string; severity: string }> = [];
|
|
211
211
|
|
|
212
212
|
try {
|
|
@@ -308,7 +308,7 @@ export const monitoringHandlers: Record<
|
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
// Queue snapshot
|
|
311
|
-
const queueBase = path.join(projectRoot,
|
|
311
|
+
const queueBase = path.join(projectRoot, getFrameworkDir(projectRoot), "queue");
|
|
312
312
|
const snapshot: Record<string, number> = {};
|
|
313
313
|
for (const dir of ["pending", "processing", "completed", "failed"]) {
|
|
314
314
|
try {
|
|
@@ -321,7 +321,7 @@ export const monitoringHandlers: Record<
|
|
|
321
321
|
report.queueSnapshot = snapshot;
|
|
322
322
|
|
|
323
323
|
// Recent blockages
|
|
324
|
-
const logPath = path.join(projectRoot,
|
|
324
|
+
const logPath = path.join(projectRoot, getFrameworkDir(projectRoot), "logs", "orchestrator.json");
|
|
325
325
|
try {
|
|
326
326
|
const logContent = await fs.readFile(logPath, "utf-8");
|
|
327
327
|
const log = JSON.parse(logContent) as { blockages?: unknown[] };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
2
2
|
import { promises as fs } from "fs";
|
|
3
3
|
import path from "path";
|
|
4
|
+
import { getFrameworkDir } from "../utils.js";
|
|
4
5
|
|
|
5
6
|
// ─── Tool Definitions ─────────────────────────────────────────────────────────
|
|
6
7
|
|
|
@@ -208,7 +209,7 @@ export const orchestrationHandlers: Record<
|
|
|
208
209
|
};
|
|
209
210
|
|
|
210
211
|
// Persist to queue
|
|
211
|
-
const queueDir = path.join(projectRoot,
|
|
212
|
+
const queueDir = path.join(projectRoot, getFrameworkDir(projectRoot), "queue", "pending");
|
|
212
213
|
await fs.mkdir(queueDir, { recursive: true });
|
|
213
214
|
await fs.writeFile(
|
|
214
215
|
path.join(queueDir, `${traceId}-dag.json`),
|
|
@@ -230,7 +231,7 @@ export const orchestrationHandlers: Record<
|
|
|
230
231
|
// Try to load capability roster from shared-facts.json (dynamic — fixes KRITIK-3)
|
|
231
232
|
let agentCapabilityRoster: Array<{ agent: string; primaryDomain: string; capability: number }> = [];
|
|
232
233
|
try {
|
|
233
|
-
const sharedFactsPath = path.join(projectRoot,
|
|
234
|
+
const sharedFactsPath = path.join(projectRoot, getFrameworkDir(projectRoot), "memory-graph", "shared-facts.json");
|
|
234
235
|
const content = await fs.readFile(sharedFactsPath, "utf-8");
|
|
235
236
|
const facts = JSON.parse(content) as { agentCapabilityRoster?: typeof agentCapabilityRoster };
|
|
236
237
|
agentCapabilityRoster = facts.agentCapabilityRoster ?? [];
|
|
@@ -294,7 +295,7 @@ export const orchestrationHandlers: Record<
|
|
|
294
295
|
};
|
|
295
296
|
|
|
296
297
|
// Write assignment log
|
|
297
|
-
const logPath = path.join(projectRoot,
|
|
298
|
+
const logPath = path.join(projectRoot, getFrameworkDir(projectRoot), "logs", "orchestrator.json");
|
|
298
299
|
let log: { assignments: unknown[] } = { assignments: [] };
|
|
299
300
|
try {
|
|
300
301
|
const existing = await fs.readFile(logPath, "utf-8");
|
|
@@ -310,7 +311,7 @@ export const orchestrationHandlers: Record<
|
|
|
310
311
|
},
|
|
311
312
|
|
|
312
313
|
async get_agent_workload(_args, projectRoot) {
|
|
313
|
-
const statusPath = path.join(projectRoot,
|
|
314
|
+
const statusPath = path.join(projectRoot, getFrameworkDir(projectRoot), "STATUS.md");
|
|
314
315
|
let statusContent: string;
|
|
315
316
|
try {
|
|
316
317
|
statusContent = await fs.readFile(statusPath, "utf-8");
|
|
@@ -356,7 +357,7 @@ export const orchestrationHandlers: Record<
|
|
|
356
357
|
};
|
|
357
358
|
|
|
358
359
|
// Log blockage
|
|
359
|
-
const logPath = path.join(projectRoot,
|
|
360
|
+
const logPath = path.join(projectRoot, getFrameworkDir(projectRoot), "logs", "orchestrator.json");
|
|
360
361
|
let log: { assignments: unknown[]; blockages: unknown[] } = { assignments: [], blockages: [] };
|
|
361
362
|
try {
|
|
362
363
|
const existing = await fs.readFile(logPath, "utf-8");
|
|
@@ -370,7 +371,7 @@ export const orchestrationHandlers: Record<
|
|
|
370
371
|
await fs.writeFile(logPath, JSON.stringify(log, null, 2), "utf-8");
|
|
371
372
|
|
|
372
373
|
// Write a message to @manager's inbox via messages folder
|
|
373
|
-
const messagesDir = path.join(projectRoot,
|
|
374
|
+
const messagesDir = path.join(projectRoot, getFrameworkDir(projectRoot), "messages");
|
|
374
375
|
await fs.mkdir(messagesDir, { recursive: true });
|
|
375
376
|
const messageFile = path.join(messagesDir, `BLOCKAGE-${traceId}-${Date.now()}.json`);
|
|
376
377
|
await fs.writeFile(
|
|
@@ -409,7 +410,7 @@ export const orchestrationHandlers: Record<
|
|
|
409
410
|
};
|
|
410
411
|
|
|
411
412
|
// Write to messages folder for all agents
|
|
412
|
-
const messagesDir = path.join(projectRoot,
|
|
413
|
+
const messagesDir = path.join(projectRoot, getFrameworkDir(projectRoot), "messages");
|
|
413
414
|
await fs.mkdir(messagesDir, { recursive: true });
|
|
414
415
|
await fs.writeFile(
|
|
415
416
|
path.join(messagesDir, `${broadcast.id}.json`),
|
|
@@ -418,7 +419,7 @@ export const orchestrationHandlers: Record<
|
|
|
418
419
|
);
|
|
419
420
|
|
|
420
421
|
// Log broadcast
|
|
421
|
-
const logPath = path.join(projectRoot,
|
|
422
|
+
const logPath = path.join(projectRoot, getFrameworkDir(projectRoot), "logs", "orchestrator.json");
|
|
422
423
|
let log: { assignments: unknown[]; blockages: unknown[]; broadcasts: unknown[] } = {
|
|
423
424
|
assignments: [],
|
|
424
425
|
blockages: [],
|
|
@@ -10,12 +10,12 @@ const getPackageVersion = (): string => {
|
|
|
10
10
|
const pkgPath = path.join(__dirname, "../package.json");
|
|
11
11
|
if (fs.existsSync(pkgPath)) {
|
|
12
12
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
13
|
-
return pkg.version || "0.8.
|
|
13
|
+
return pkg.version || "0.8.7";
|
|
14
14
|
}
|
|
15
15
|
} catch {
|
|
16
16
|
// fallback
|
|
17
17
|
}
|
|
18
|
-
return "0.8.
|
|
18
|
+
return "0.8.7";
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export const FRAMEWORK_VERSION = getPackageVersion();
|
package/package.json
CHANGED
package/src/cli/index.ts
CHANGED
|
@@ -998,16 +998,44 @@ function complianceCheckCommand(targetPath) {
|
|
|
998
998
|
console.warn(`📜 Checking Constitution Compliance: ${targetPath}...`);
|
|
999
999
|
const violations = [];
|
|
1000
1000
|
const forbidden = ["@shadcn", "mui", "@chakra-ui", "tailwindcss"];
|
|
1001
|
+
|
|
1002
|
+
// 1. package.json scan (Blind Spot 5)
|
|
1003
|
+
const pkgJsonPath = path.join(targetDir, "package.json");
|
|
1004
|
+
if (fs.existsSync(pkgJsonPath)) {
|
|
1005
|
+
try {
|
|
1006
|
+
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8"));
|
|
1007
|
+
const allDeps = { ...(pkg.dependencies || {}), ...(pkg.devDependencies || {}) };
|
|
1008
|
+
forbidden.forEach(lib => {
|
|
1009
|
+
if (allDeps[lib] || Object.keys(allDeps).some(d => d.toLowerCase().includes(lib.toLowerCase()))) {
|
|
1010
|
+
violations.push(`package.json: Forbidden library dependency '${lib}' found in package.json.`);
|
|
1011
|
+
}
|
|
1012
|
+
});
|
|
1013
|
+
} catch {
|
|
1014
|
+
// ignore
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
// 2. Source files scan
|
|
1001
1019
|
const files = collectFiles(path.join(targetDir, targetPath), [".ts", ".tsx", ".js", ".jsx", ".md"]);
|
|
1002
1020
|
files.forEach(f => {
|
|
1021
|
+
const isTypesFile = f.includes("brands.ts") || f.includes("brands.js") || f.includes("brands.tsx") || f.includes("src/types/brands");
|
|
1022
|
+
|
|
1003
1023
|
const content = fs.readFileSync(f, "utf8");
|
|
1004
1024
|
forbidden.forEach(lib => {
|
|
1005
1025
|
if (content.includes(lib)) violations.push(`${path.relative(targetDir, f)}: Forbidden library '${lib}' found.`);
|
|
1006
1026
|
});
|
|
1007
|
-
|
|
1008
|
-
|
|
1027
|
+
|
|
1028
|
+
// Robust Branded Types validation (Blind Spot 4)
|
|
1029
|
+
if ((f.endsWith(".ts") || f.endsWith(".tsx")) && !isTypesFile && content.includes("interface")) {
|
|
1030
|
+
const plainIdMatches = content.match(/\b\w*(?:id|Id|ID)\??\s*:\s*(?:string|number)\b/g);
|
|
1031
|
+
if (plainIdMatches) {
|
|
1032
|
+
plainIdMatches.forEach(match => {
|
|
1033
|
+
violations.push(`${path.relative(targetDir, f)}: Potential Branded Types violation (plain identifier '${match.trim()}' found inside interface).`);
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1009
1036
|
}
|
|
1010
1037
|
});
|
|
1038
|
+
|
|
1011
1039
|
if (violations.length === 0) {
|
|
1012
1040
|
console.warn("✅ All systems compliant with ENDERUN.md.");
|
|
1013
1041
|
} else {
|