agent-enderun 0.8.7 → 0.9.0
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.md → .enderun/ENDERUN.md} +5 -3
- package/.enderun/PROJECT_MEMORY.md +12 -53
- package/.enderun/STATUS.md +7 -8
- package/.enderun/agents/agent_army_schema.json +28 -6
- package/.enderun/agents/analyst.md +9 -18
- package/.enderun/agents/backend.md +22 -52
- package/.enderun/agents/devops.md +9 -19
- package/.enderun/agents/explorer.md +7 -16
- package/.enderun/agents/frontend.md +82 -84
- package/.enderun/agents/git.md +7 -16
- package/.enderun/agents/manager.md +34 -40
- package/.enderun/agents/mobile.md +7 -16
- package/.enderun/agents/native.md +7 -16
- package/.enderun/agents/orchestrator.md +16 -25
- package/.enderun/agents/qa.md +12 -24
- package/.enderun/agents/schema/agent-lifecycle-schema.json +29 -8
- package/.enderun/agents/security.md +9 -18
- package/.enderun/config.json +1 -1
- package/.enderun/knowledge/SHIM_TEMPLATE.md +25 -0
- package/.enderun/knowledge/eslint-standards.md +63 -0
- package/.enderun/knowledge/hermes_protocol.md +1 -1
- package/.enderun/knowledge/token_economy_and_memory.md +129 -0
- package/.enderun/mcp_config.json +9 -0
- package/.enderun/memory-graph/agent-contexts/analyst.json +1 -1
- package/.enderun/memory-graph/agent-contexts/backend.json +1 -1
- package/.enderun/memory-graph/agent-contexts/devops.json +1 -1
- package/.enderun/memory-graph/agent-contexts/explorer.json +1 -1
- package/.enderun/memory-graph/agent-contexts/frontend.json +1 -1
- package/.enderun/memory-graph/agent-contexts/git.json +1 -1
- package/.enderun/memory-graph/agent-contexts/manager.json +1 -1
- package/.enderun/memory-graph/agent-contexts/mobile.json +1 -1
- package/.enderun/memory-graph/agent-contexts/native.json +1 -1
- package/.enderun/memory-graph/agent-contexts/orchestrator.json +1 -1
- package/.enderun/memory-graph/agent-contexts/qa.json +1 -1
- package/.enderun/memory-graph/agent-contexts/security.json +1 -1
- package/.enderun/memory-graph/graph.json +123 -16
- package/.enderun/memory-graph/shared-facts.json +26 -32
- package/README.md +93 -295
- package/agent.md +25 -0
- package/bin/cli.js +9 -9
- package/bin/update-contract.js +34 -37
- package/bin/validate-agent-army.js +38 -13
- package/claude.md +14 -8
- package/docs/README.md +35 -16
- package/docs/roadmap.md +1 -1
- package/docs/tech-stack.md +30 -0
- package/eslint.config.js +68 -0
- package/framework-mcp/dist/index.js +184 -24
- package/framework-mcp/package.json +6 -33
- package/framework-mcp/tsconfig.json +3 -6
- package/gemini.md +12 -6
- package/grok.md +25 -0
- package/mcp.json +2 -2
- package/package.json +12 -6
- package/panda.config.ts +86 -86
- package/tsconfig.json +9 -0
- package/.enderun/claude.md +0 -19
- package/.enderun/cursor.md +0 -19
- package/.enderun/gemini.md +0 -19
- package/.enderun/logs/analyst.json +0 -1
- package/.enderun/logs/backend.json +0 -1
- package/.enderun/logs/devops.json +0 -1
- package/.enderun/logs/explorer.json +0 -1
- package/.enderun/logs/frontend.json +0 -1
- package/.enderun/logs/git.json +0 -1
- package/.enderun/logs/manager.json +0 -1
- package/.enderun/logs/mobile.json +0 -1
- package/.enderun/logs/native.json +0 -1
- package/.enderun/logs/orchestrator.json +0 -1
- package/.enderun/logs/qa.json +0 -1
- package/.enderun/logs/security.json +0 -1
- package/.env.example +0 -10
- package/cursor.md +0 -19
- package/framework-mcp/README.md +0 -55
- package/framework-mcp/dist/schemas.js +0 -118
- package/framework-mcp/dist/tools/codebase.js +0 -294
- package/framework-mcp/dist/tools/contract.js +0 -197
- package/framework-mcp/dist/tools/framework.js +0 -196
- package/framework-mcp/dist/tools/git.js +0 -51
- package/framework-mcp/dist/tools/governance.js +0 -696
- package/framework-mcp/dist/tools/index.js +0 -47
- package/framework-mcp/dist/tools/knowledge.js +0 -133
- package/framework-mcp/dist/tools/memory.js +0 -200
- package/framework-mcp/dist/tools/messages.js +0 -193
- package/framework-mcp/dist/tools/monitoring.js +0 -294
- package/framework-mcp/dist/tools/orchestration.js +0 -368
- package/framework-mcp/dist/tools/pipeline.js +0 -267
- package/framework-mcp/dist/tools/security.js +0 -137
- package/framework-mcp/dist/utils.js +0 -121
- package/framework-mcp/src/index.ts +0 -49
- package/framework-mcp/src/schemas.ts +0 -106
- package/framework-mcp/src/tools/codebase.ts +0 -284
- package/framework-mcp/src/tools/contract.ts +0 -221
- package/framework-mcp/src/tools/framework.ts +0 -192
- package/framework-mcp/src/tools/git.ts +0 -42
- package/framework-mcp/src/tools/governance.ts +0 -891
- package/framework-mcp/src/tools/index.ts +0 -50
- package/framework-mcp/src/tools/knowledge.ts +0 -141
- package/framework-mcp/src/tools/memory.ts +0 -207
- package/framework-mcp/src/tools/messages.ts +0 -213
- package/framework-mcp/src/tools/monitoring.ts +0 -351
- package/framework-mcp/src/tools/orchestration.ts +0 -440
- package/framework-mcp/src/tools/pipeline.ts +0 -353
- package/framework-mcp/src/tools/security.ts +0 -143
- package/framework-mcp/src/utils.ts +0 -130
- package/src/cli/index.ts +0 -2188
package/README.md
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
# 🏛️ Agent Enderun
|
|
2
|
-
|
|
3
|
-
**The Supreme AI Governance & Orchestration Framework for Enterprise Development**
|
|
4
|
-
|
|
5
|
-
**Author:** Yusuf BEKAR
|
|
6
|
-
**Version:** 0.8.7
|
|
7
|
-
**License:** MIT
|
|
1
|
+
# 🏛️ Agent Enderun — Supreme Enterprise AI Governance Framework (v0.9.0)
|
|
8
2
|
|
|
9
3
|
[English](#english) | [Türkçe](#türkçe)
|
|
10
4
|
|
|
@@ -12,334 +6,138 @@
|
|
|
12
6
|
|
|
13
7
|
# English
|
|
14
8
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
**Agent Enderun** is a production-grade constitutional governance and multi-agent orchestration framework designed for engineering teams that need to use AI assistants at scale while maintaining control, traceability, auditability, and professional discipline.
|
|
18
|
-
|
|
19
|
-
Most AI coding tools optimize for speed and generation volume. Agent Enderun optimizes for **risk-aware, auditable, and continuously improving software development processes**. It converts chaotic AI output into structured, enterprise-ready work through mandatory rules, specialized agents, persistent memory, and a living risk management system.
|
|
20
|
-
|
|
21
|
-
> [!NOTE]
|
|
22
|
-
> **v0.7.0 Strategic Consolidation:**
|
|
23
|
-
> The active runtime folder in user projects is `.enderun/`. The framework ships its templates from `.enderun/`. All specialist agent configurations live as strongly-typed `agent.json` under `.enderun/agents/{agent_name}.md`. Duplicate or staging structures have been retired.
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## 🎯 Core Philosophy & Key Concepts
|
|
28
|
-
|
|
29
|
-
Agent Enderun is built on a set of non-negotiable principles enforced by its core components.
|
|
30
|
-
|
|
31
|
-
### 1. The Constitution (`ENDERUN.md`)
|
|
32
|
-
This is the supreme law of the framework, dictating mandatory rules and protocols for all agents. Key principles include:
|
|
33
|
-
- **Single Point of Authority:** In enterprise projects, `@manager` is the only authorized entry point. No specialist agent may act without a formal briefing.
|
|
34
|
-
- **Contract-First Development:** The `@backend` agent MUST define and document API contracts and types before the `@frontend` agent begins implementation.
|
|
35
|
-
- **Zero UI Library & Zero Mock Policy:** The `@frontend` agent MUST build components from scratch using the project's design system (Panda CSS) and MUST NOT use mock data. This ensures originality and quality.
|
|
36
|
-
- **Procedural Continuity:** All agents MUST adhere to the existing architectural and stylistic patterns of the project.
|
|
37
|
-
|
|
38
|
-
### 2. Project Memory (`PROJECT_MEMORY.md`)
|
|
39
|
-
This file, located in `.enderun/`, is the **Single Source of Truth (SSOT)** for the project's state. It is a human-readable Markdown file that all agents read at the start of a session and update at the end. Its key sections are:
|
|
40
|
-
- **`CURRENT STATUS`:** Tracks the active phase, Trace ID, and any blockers.
|
|
41
|
-
- **`CRITICAL DECISIONS`:** A log of important architectural choices to ensure consistency.
|
|
42
|
-
- **`ACTIVE TASKS`:** A table of all ongoing tasks, their status, priority, and assigned agent.
|
|
43
|
-
- **`HISTORY`:** A persistent log of all actions taken by agents.
|
|
44
|
-
|
|
45
|
-
### 3. Traceability (Trace ID)
|
|
46
|
-
Every task or logical unit of work is assigned a unique **Trace ID** (a 26-character ULID). This ID is used in commit messages, logs, and task tables, providing an unbroken chain of traceability from the initial request to the final code.
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
## 🤖 The Agent Army & Core Folders
|
|
51
|
-
|
|
52
|
-
Each agent in the Enderun Army is governed by a strongly-typed `agent.json` definition that defines their precise rules, permitted directories, and capability ratings.
|
|
53
|
-
|
|
54
|
-
### Workspace Agent Path:
|
|
55
|
-
👉 `[project-root]/.enderun/agents/{agent_name}.md`
|
|
56
|
-
|
|
57
|
-
### Agent Army Overview (v1.0 - 12 Specialists):
|
|
58
|
-
|
|
59
|
-
| Tier | Agent | Capability | Role & Domain | Primary Specialization |
|
|
60
|
-
| :--- | :--- | :--- | :--- | :--- |
|
|
61
|
-
| **Core** | **@orchestrator** | **9.8/10** | Task Pipeline Engine | Parallel execution, stateful queue controls, DAG execution. |
|
|
62
|
-
| **Core** | **@manager** | **9.5/10** | Orchestration & Governance | Intent analysis, high-risk dynamic approval signing, escalation. |
|
|
63
|
-
| **Analysis** | **@analyst** | **9.6/10** | Verification & QA Gate | Vitest/Cypress verification, API contract drift checking, Zero-UI enforcer. |
|
|
64
|
-
| **Analysis** | **@explorer** | **9.4/10** | Research & Discovery | Pattern mapping, dependency graph discovery, onboarding analysis. |
|
|
65
|
-
| **Engineering** | **@backend** | **9.2/10** | Domain Logic & Databases | Fastify, Kysely queries, branded types, DomainError hierarchy. |
|
|
66
|
-
| **Engineering** | **@frontend** | **9.0/10** | Fluid Responsive UI | React 19, Panda CSS styling tokens, Zero-UI, WCAG 2.2 accessibility. |
|
|
67
|
-
| **Engineering** | **@native** | **8.9/10** | Native Capabilities | Tauri/Electron shell guards, Rust bridges, secure IPC contracts. |
|
|
68
|
-
| **Engineering** | **@mobile** | **8.8/10** | Cross-Platform Mobile | React Native/Expo fluid viewports, offline cache sync, safe areas. |
|
|
69
|
-
| **Operations** | **@security** | **9.3/10** | Security & Compliance | OWASP threat detection, AST scans for secrets, CSP rules auditor. |
|
|
70
|
-
| **Operations** | **@qa** | **9.1/10** | Quality Gate Enforcer | Unit/integration testing gates, coverage metrics check. |
|
|
71
|
-
| **Operations** | **@git** | **9.1/10** | Version Control | Semantic commits formatting, atomic commit segregation, phase snapshots. |
|
|
72
|
-
| **Operations** | **@devops** | **9.0/10** | Infrastructure | Deployment pipelines, container setups, environment variable validation. |
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
### 📂 Core Directories Analysis & Operational Purposes
|
|
9
|
+
**Agent Enderun** is not just a code generator; it is a high-discipline **AI Governance & Autonomous Command System** designed for complex, scalable, and fully auditable enterprise software projects.
|
|
77
10
|
|
|
78
|
-
|
|
11
|
+
With v0.9.0, the framework has evolved into a **"Living Engineering Organism"** that manages its own memory, performs surgical codebase modifications, and unifies diverse AI ecosystems under a single constitutional discipline.
|
|
79
12
|
|
|
80
|
-
|
|
81
|
-
* **`benchmarks/` (LLM Evaluation):** Dedicated folder for metrics, token consumption, and response accuracy logs comparing different LLM engines (e.g. Gemini 1.5 Pro vs Claude 3.5 Sonnet vs Codex). Helps evaluate the coding intelligence of the active army.
|
|
82
|
-
* **`knowledge/` (Intelligence Database):** central knowledge hub of the framework containing 43 robust guidelines enforcing strict laws on Panda CSS coding, Fastify RCSR, Kysely schema creation, dynamic signature validations, and domain error hierarchies.
|
|
83
|
-
* **`logs/` (Auditable Trails):** Active audit log repository. Every action performed by any agent is traceably logged in JSON format (`logs/{agent_name}.json`) with a specific timestamp and a unique 26-character Trace ID (ULID), satisfying enterprise compliance audits.
|
|
84
|
-
* **`monitoring/` (Operational Telemetry):** Telemetry directory integrated with monitoring tools (`get_army_health_dashboard`, `calculate_agent_performance_score`) to analyze agent bottleneck states and QA rejection cycles.
|
|
85
|
-
* **`queue/` (Asynchronous Task Engine):** File-based stateful task queue split into `pending/`, `processing/`, `completed/`, `failed/`, and `pipelines/` subdirectories. Feeds Orchestration MCP tools to schedule complex multi-agent assignments in parallel with complete rollback recovery.
|
|
13
|
+
## 💎 Strategic Platform Synergy (The Core Four)
|
|
86
14
|
|
|
87
|
-
|
|
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
|
-
|
|
102
|
-
## ⚡ Quick Start & Workflow
|
|
103
|
-
|
|
104
|
-
### 1. Installation
|
|
105
|
-
|
|
106
|
-
Install the package and initialize the framework inside your project folder:
|
|
107
|
-
|
|
108
|
-
```bash
|
|
109
|
-
# 1. Initialize the framework for Gemini CLI
|
|
110
|
-
npx agent-enderun init gemini
|
|
15
|
+
Agent Enderun integrates the world's most powerful AI ecosystems, mapping each to a specific strategic role within the project:
|
|
111
16
|
|
|
112
|
-
|
|
113
|
-
|
|
17
|
+
1. **🚀 Claude Code (Operational Surgery):** The project's **Field Engineer**. With unrivaled file-system speed and the `patch_file` tool, it manages autonomous code edits with surgical precision.
|
|
18
|
+
2. **♊ Gemini & Vertex AI (Strategic Brain):** The **Command Center**. Utilizing a 2M+ token context window, it analyzes the entire project history and architectural map simultaneously to make high-level decisions.
|
|
19
|
+
3. **🛸 Antigravity (Internal Discipline):** The **Military Academy**. A high-discipline, isolated environment designed to enforce internal project standards and rigorous AI training.
|
|
20
|
+
4. **🤖 Grok / X.ai (Reconnaissance Unit):** The **Autonomous Vision**. Used for testing futuristic agent protocols and pushing the boundaries of AI-native development.
|
|
114
21
|
|
|
115
|
-
|
|
116
|
-
npm run enderun:build
|
|
22
|
+
## 🛡️ The Five Pillars of Enderun Discipline
|
|
117
23
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
Here’s how to use Agent Enderun to develop a new feature:
|
|
24
|
+
1. **Absolute Traceability (Trace ID):** Every decision, commit, and line of code is stamped with a ULID-based Trace ID. Full enterprise auditability is achieved in seconds.
|
|
25
|
+
2. **Contract-First Law:** No implementation is permitted without verified type contracts. Type safety between `@backend` and `@frontend` is the project's supreme law.
|
|
26
|
+
3. **Surgical Edit Standard:** Overwriting entire files is prohibited. The system mandates `replace_text` and `patch_file` via MCP for precise, non-destructive modifications.
|
|
27
|
+
4. **Autonomous Memory Pruning:** `PROJECT_MEMORY.md` never bloats. Histories exceeding 10 entries are auto-archived to keep the context window fresh and cost-efficient.
|
|
28
|
+
5. **Constitutional SSOT:** All platforms (Claude, Gemini, etc.) are 100% loyal to a single source of truth: the `.enderun/ENDERUN.md` constitution.
|
|
125
29
|
|
|
126
|
-
|
|
127
|
-
Create a new file in your project's `docs/` folder (e.g., `docs/new-feature-request.md`) describing the feature you want.
|
|
30
|
+
## 🛠️ Installation & Deployment
|
|
128
31
|
|
|
129
|
-
|
|
130
|
-
Use the CLI to create a new task in `PROJECT_MEMORY.md`. This generates a unique Trace ID.
|
|
32
|
+
Initialize the framework for your preferred platform with a single command:
|
|
131
33
|
|
|
132
34
|
```bash
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
**Step 3: Agent Orchestration (Automatic)**
|
|
137
|
-
The `@manager` agent (the default AI persona) will:
|
|
138
|
-
1. Read `PROJECT_MEMORY.md` and see the new task.
|
|
139
|
-
2. Analyze the request from `docs/new-feature-request.md`.
|
|
140
|
-
3. Create a plan and issue formal "briefings" to specialist agents like `@explorer`, `@backend`, and `@frontend`.
|
|
35
|
+
# For Gemini CLI and Antigravity (Standard)
|
|
36
|
+
agent-enderun init gemini
|
|
141
37
|
|
|
142
|
-
|
|
143
|
-
-
|
|
144
|
-
- `@analyst` automatically verifies the work against project standards.
|
|
145
|
-
- `@git` creates atomic commits tagged with the Trace ID.
|
|
38
|
+
# For Claude Code (CLI & Desktop) — Optimized for Surgery
|
|
39
|
+
agent-enderun init claude
|
|
146
40
|
|
|
147
|
-
|
|
148
|
-
|
|
41
|
+
# For Antigravity IDE/CLI Independent Setup
|
|
42
|
+
agent-enderun init antigravity
|
|
149
43
|
|
|
150
|
-
|
|
151
|
-
|
|
44
|
+
# For Grok Build / X.ai Autonomous Agents
|
|
45
|
+
agent-enderun init grok
|
|
152
46
|
```
|
|
153
|
-
This will show the active phase, blockers, and the status of all active tasks.
|
|
154
47
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
## 🛠️ CLI Commands
|
|
158
|
-
|
|
159
|
-
Agent Enderun comes with a powerful set of CLI tools for managing the project.
|
|
48
|
+
## 📋 CLI Command Registry
|
|
160
49
|
|
|
161
50
|
| Command | Description |
|
|
162
51
|
| :--- | :--- |
|
|
163
|
-
| `
|
|
164
|
-
| `
|
|
165
|
-
| `
|
|
166
|
-
| `
|
|
167
|
-
| `
|
|
168
|
-
|
|
52
|
+
| `status` | Shows the active phase, Trace ID, and real-time agent health scores. |
|
|
53
|
+
| `check` | Audits system health, MCP connectivity, and constitutional integrity. |
|
|
54
|
+
| `trace:new` | Starts a new task chain with a unique ID and briefs the Army. |
|
|
55
|
+
| `create-app` | Generates an enterprise monorepo (Fastify/React) from natural language. |
|
|
56
|
+
| `verify-contract` | Seals the type alignment between backend and frontend modules. |
|
|
57
|
+
|
|
58
|
+
## 📂 Architecture Map
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
├── .enderun/ <-- The Framework Brain
|
|
62
|
+
│ ├── agents/ <-- 12 Specialist Directives (Manager, Architect, QA...)
|
|
63
|
+
│ ├── knowledge/ <-- Enterprise Standards (ESLint, API, Security)
|
|
64
|
+
│ ├── memory-graph/ <-- Shared Facts & Agent Private Contexts
|
|
65
|
+
│ ├── queue/ <-- Hermes Messaging & Task Queue
|
|
66
|
+
│ └── ENDERUN.md <-- The Supreme Constitution
|
|
67
|
+
├── apps/ <-- Enterprise Application Space
|
|
68
|
+
├── docs/ <-- Project Architectural Portal (ADRs, Tech-Stack)
|
|
69
|
+
└── framework-mcp/ <-- Autonomous Operations Server
|
|
70
|
+
```
|
|
169
71
|
|
|
170
72
|
---
|
|
171
73
|
|
|
172
74
|
# Türkçe
|
|
173
75
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
**Agent Enderun**, AI asistanlarını yüksek ölçekte kullanırken kontrolü, izlenebilirliği, denetlenebilirliği ve profesyonel disiplini korumak isteyen mühendislik ekipleri için tasarlanmış, **Anayasal Yönetişim** ve **Çoklu Ajan Orkestrasyonu** odaklı kurumsal düzeyde bir framework’tür.
|
|
76
|
+
**Agent Enderun**, sıradan bir kod üreticisi değil; karmaşık, ölçeklenebilir ve mutlak denetlenebilir kurumsal yazılım projeleri için tasarlanmış bir **Yapay Zeka Yönetişim ve Otonom Ordu Komuta Sistemidir**.
|
|
177
77
|
|
|
178
|
-
|
|
78
|
+
v0.9.0 sürümüyle birlikte sistem; kendi hafızasını yönetebilen, kod tabanına cerrahi müdahaleler yapabilen ve farklı YZ ekosistemlerini tek bir anayasal disiplin altında birleştiren **"Yaşayan bir Mühendislik Organizması"** haline gelmiştir.
|
|
179
79
|
|
|
180
|
-
|
|
181
|
-
> **v0.7.0 Stratejik Konsolidasyon:**
|
|
182
|
-
> Çalışma zamanı klasörü kullanıcı projelerinde `.enderun/` olarak oluşturulur. Ajan yapılandırmaları `.enderun/agents/{agent_name}.md` altında yer alır. Eski veya mükerrer yapılar tamamen kaldırılmıştır.
|
|
80
|
+
## 💎 Stratejik Platform Sinerjisi (Dörtlü Güç)
|
|
183
81
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
## 🎯 Temel Felsefe ve Anahtar Kavramlar
|
|
187
|
-
|
|
188
|
-
Agent Enderun, temel bileşenleri tarafından uygulanan, tavizsiz ilkeler üzerine kurulmuştur.
|
|
189
|
-
|
|
190
|
-
### 1. Anayasa (`ENDERUN.md`)
|
|
191
|
-
Bu, tüm ajanlar için zorunlu kuralları ve protokolleri dikte eden, çerçevenin en üst yasasıdır. Temel ilkeler şunları içerir:
|
|
192
|
-
- **Tek Yetki Noktası:** Kurumsal projelerde `@manager` tek yetkili giriş noktasıdır. Hiçbir uzman ajan, resmi bir brifing almadan kendi başına işlem yapamaz.
|
|
193
|
-
- **Önce Sözleşme (Contract-First) ile Geliştirme:** `@backend` ajanı, `@frontend` ajanı uygulamaya başlamadan ÖNCE API sözleşmelerini ve tiplerini tanımlamak ve belgelemek ZORUNDADIR.
|
|
194
|
-
- **Sıfır UI Kütüphanesi ve Sıfır Mock Veri Politikası:** `@frontend` ajanı, bileşenleri projenin tasarım sistemini (Panda CSS) kullanarak sıfırdan oluşturmalı ve mock (sahte) veri KULLANMAMALIDIR. Bu, özgünlüğü ve kaliteyi garanti eder.
|
|
195
|
-
- **Prosedürel Devamlılık:** Tüm ajanlar, projenin mevcut mimari ve stilistik kalıplarına uymak ZORUNDADIR.
|
|
196
|
-
|
|
197
|
-
### 2. Proje Hafızası (`PROJECT_MEMORY.md`)
|
|
198
|
-
`.enderun/` içinde bulunan bu dosya, projenin durumu için **Tek Doğruluk Kaynağıdır (SSOT)**. Tüm ajanların bir oturumun başında okuduğu ve sonunda güncellediği, insan tarafından okunabilir bir Markdown dosyasıdır. Ana bölümleri şunlardır:
|
|
199
|
-
- **`CURRENT STATUS`:** Aktif aşamayı, Trace ID'yi ve varsa engelleyicileri izler.
|
|
200
|
-
- **`CRITICAL DECISIONS`:** Tutarlılığı sağlamak için önemli mimari seçimlerin bir kaydı.
|
|
201
|
-
- **`ACTIVE TASKS`:** Devam eden tüm görevlerin, durumlarının, önceliklerinin ve atanan ajanın bir tablosu.
|
|
202
|
-
- **`HISTORY`:** Ajanlar tarafından gerçekleştirilen tüm eylemlerin kalıcı bir kaydı.
|
|
203
|
-
|
|
204
|
-
### 3. İzlenebilirlik (Trace ID)
|
|
205
|
-
Her göreve veya mantıksal iş birimine benzersiz bir **Trace ID** (26 karakterlik bir ULID) atanır. Bu kimlik, commit mesajlarında, loglarda ve görev tablolarında kullanılarak ilk talepten nihai koda kadar kesintisiz bir izlenebilirlik zinciri sağlar.
|
|
206
|
-
|
|
207
|
-
---
|
|
208
|
-
|
|
209
|
-
## 🤖 Ajan Ordusu
|
|
210
|
-
|
|
211
|
-
Enderun Ordusu'ndaki her ajan, kendilerine ait kuralları, izin verilen dizinleri ve yetenek derecelendirmelerini tanımlayan güçlü tipli bir `agent.json` dosyası tarafından yönetilir.
|
|
212
|
-
|
|
213
|
-
### Çalışma Alanı Ajan Yolu:
|
|
214
|
-
👉 `[proje-kök-dizini]/.enderun/agents/{agent_name}.md`
|
|
215
|
-
|
|
216
|
-
### Ajan Ordusuna Genel Bakış (v1.0 - 12 Uzman Ajan):
|
|
217
|
-
|
|
218
|
-
| Katman | Ajan | Yetenek | Rol & Alan | Ana Uzmanlık Alanı |
|
|
219
|
-
| :--- | :--- | :--- | :--- | :--- |
|
|
220
|
-
| **Core** | **@orchestrator** | **9.8/10** | Görev Kuyruğu Motoru | Paralel yürütme, stateful kuyruk kontrolleri, DAG yönetimi. |
|
|
221
|
-
| **Core** | **@manager** | **9.5/10** | Orkestrasyon & Yönetişim | Talep analizi, yüksek riskli dinamik imza kontrolü, onay mekanizması. |
|
|
222
|
-
| **Analiz** | **@analyst** | **9.6/10** | Kalite & Sözleşme Kapısı | Vitest/Cypress test denetimi, API kontrat sapma kontrolü, Sıfır-UI denetçisi. |
|
|
223
|
-
| **Analiz** | **@explorer** | **9.4/10** | Araştırma & Keşif | Kod yapısı desen eşleme, bağımlılık grafiği çıkarma, onboarding analizi. |
|
|
224
|
-
| **Geliştirme** | **@backend** | **9.2/10** | Domain Mantığı & DB | Fastify, Kysely veri tabanı sorguları, branded tipler, DomainError hiyerarşisi. |
|
|
225
|
-
| **Geliştirme** | **@frontend** | **9.0/10** | Akıcı Duyarlı Arayüz | React 19, Panda CSS stil token'ları, Sıfır-UI, WCAG 2.2 AA erişilebilirlik. |
|
|
226
|
-
| **Geliştirme** | **@native** | **8.9/10** | Native Yetenekler | Tauri/Electron kabuk koruması, Rust köprüleri, güvenli IPC kontratları. |
|
|
227
|
-
| **Geliştirme** | **@mobile** | **8.8/10** | Çoklu Platform Mobil | React Native/Expo akıcı görünümler, offline önbellek senkronizasyonu. |
|
|
228
|
-
| **Operasyon** | **@security** | **9.3/10** | Güvenlik & Uyum | OWASP tehdit tespiti, AST tabanlı statik sır taraması, CSP denetimi. |
|
|
229
|
-
| **Operasyon** | **@qa** | **9.1/10** | Kalite Güvence Kapısı | Birim/entegrasyon test kontrolü, kapsama metrikleri denetçisi. |
|
|
230
|
-
| **Operasyon** | **@git** | **9.1/10** | Versiyon Kontrolü | Semantik commit formatlama, atomik commit ayırma, faz snapshot'ları. |
|
|
231
|
-
| **Operasyon** | **@devops** | **9.0/10** | Altyapı & Deployment | Deployment boru hatları, konteyner kurulumları, ortam değişkenleri denetimi. |
|
|
232
|
-
|
|
233
|
-
---
|
|
234
|
-
|
|
235
|
-
## 🏛️ Agent Enderun: Detaylı Kod Tabanı Denetim Raporu (v0.8.7)
|
|
236
|
-
|
|
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:
|
|
238
|
-
|
|
239
|
-
### 📂 1. Kapsamlı Klasör ve Dosya Yapısı Analizi
|
|
240
|
-
|
|
241
|
-
* **🧠 Çekirdek Komuta Klasörü (`.enderun/`):**
|
|
242
|
-
* Ajanların şablon kaynak dosyalarının yer aldığı ve hedef projede `.enderun/` (veya `.claude/` / `.cursor/`) olarak yeniden adlandırılan ana zeka merkezidir.
|
|
243
|
-
* **`agents/` (Ajan Tanımları & SOP'lar)**: 12 uzman ajanın davranış kurallarını barındırır. Her ajanın altında bir `agent.json` ve prompt/SOP dosyaları (`prompt.md`) bulunur. Durum makinesi şeması `schema/agent-lifecycle-schema.json` ile yönetilir.
|
|
244
|
-
* **`knowledge/` (Bilgi Bankası)**: Projenin anayasasını, sıfır UI kütüphanesi politikasını ve veri tabanı/kod standartlarını içeren 26 adet Markdown kılavuzunu barındırır. `corporate-governance/` alt klasöründe onay mekanizmaları, branded types hukuku ve audit loglama standartları gibi kurumsal düzeydeki 17 katı yönetişim kılavuzu yer alır.
|
|
245
|
-
* **`memory-graph/` (Bellek Grafiği)**: Ajanların etkileşim ağını (`graph.json`), ortak paylaştıkları doğruları (`shared-facts.json`) ve her bir ajanın yerel bağlam belleklerini (`agent-contexts/`) saklar.
|
|
246
|
-
* **`queue/` (Dosya Tabanlı Görev Kuyruğu)**: Asenkron ve paralel görevlerin yönetildiği dizindir. `pending/`, `processing/`, `completed/` ve `failed/` alt dizinleri sayesinde Trace ID üzerinden asenkron görev takibi yapılır.
|
|
247
|
-
* **`logs/` (Aksiyon Günlükleri)**: Ajanların gerçekleştirdiği tüm mutasyonları Trace ID (ULID) ile damgalayarak JSON formatında saklar (Örn: `backend.json`, `analyst.json`).
|
|
248
|
-
|
|
249
|
-
* **🔌 Model Context Protocol (MCP) Katmanı (`framework-mcp/`):**
|
|
250
|
-
* Ajanların IDE (Gemini, Claude, Cursor) ile konuşmasını ve yerel sistemdeki dosyaları güvenle manipüle etmesini sağlayan ana entegrasyon paketidir.
|
|
251
|
-
* **`src/tools/`**: 13 adet çekirdek MCP araç modülünü (kod tabanı aramaları, bellek kilit protokolleri, kontrat doğrulamaları, statik AST analizli güvenlik taramaları vb.) barındırır.
|
|
252
|
-
* **`src/schemas.ts`**: MCP araçlarına gönderilen parametrelerin tip güvenliğini Zod şemalarıyla denetler (Gereksiz/pasif şemalar temizlenmiştir).
|
|
253
|
-
* **`src/index.ts`**: MCP sunucusunun stdio üzerinden IDE ile bağlantısını kuran ana giriş kapısıdır.
|
|
254
|
-
|
|
255
|
-
* **🚀 Çalıştırılabilir Dizin & CLI (`bin/` ve `src/cli/`):**
|
|
256
|
-
* **`bin/cli.js`**: `npx tsx src/cli/index.ts` komutunu sarmalayan çalıştırılabilir binary giriş noktasıdır.
|
|
257
|
-
* **`src/cli/index.ts`**: Projeyi platformlara göre (`gemini`, `claude`, `cursor`) scaffold eden ve sağlık kontrollerini (`check`, `status`) koordine eden çekirdek CLI motorudur.
|
|
258
|
-
* **`bin/hermes-sandbox.js`**: Ajanlar arası Yüksek Riskli İşlem ve dynamic onay (`managerApproval`) mesajlaşma akışını yerel olarak simüle eden test sandbox'ıdır.
|
|
259
|
-
|
|
260
|
-
### 🧹 2. Gerçekleştirilen v1.0 Kritik Temizlik ve Düzenlemeler
|
|
82
|
+
Agent Enderun, sektördeki en güçlü YZ ekosistemlerini bir araya getirerek her birini proje içinde stratejik bir rolle görevlendirir:
|
|
261
83
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
84
|
+
1. **🚀 Claude Code (Operasyonel Cerrahi):** Projenin **Saha Mühendisi**dir. Dosya sistemi üzerindeki rakipsiz hızı ve `patch_file` aracıyla otonom kod düzenlemelerini cerrahi hassasiyetle yönetir.
|
|
85
|
+
2. **♊ Gemini & Vertex AI (Stratejik Akıl):** Sistemin **Komuta Merkezi**dir. 2M+ token bağlam kapasitesiyle projenin tüm geçmişini ve mimari yapısını aynı anda analiz ederek üst düzey kararlar alır.
|
|
86
|
+
3. **🛸 Antigravity (İç Disiplin):** Projenin **Askeri Akademisi**dir. İç standartlarımızı korumak için tasarlanmış, dış dünyadan izole ve yüksek disiplinli geliştirme ortamıdır.
|
|
87
|
+
4. **🤖 Grok / X.ai (Keşif Birliği):** Projenin **Otonom Vizyonu**dur. Gelecek odaklı ajan protokollerini test etmek ve YZ tabanlı geliştirme sınırlarını zorlamak için kullanılır.
|
|
266
88
|
|
|
267
|
-
|
|
89
|
+
## 🛡️ Enderun Disiplininin Beş Sarsılmaz Sütunu
|
|
268
90
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
91
|
+
1. **Mutlak İzlenebilirlik (Trace ID):** Her karar, her commit ve her kod satırı ULID tabanlı bir Trace ID ile damgalanır. Kurumsal denetim (audit) saniyeler içinde yapılabilir.
|
|
92
|
+
2. **Önce Sözleşme (Contract-First):** Backend ve Frontend arasındaki veri kontratları mühürlenmeden kod yazılamaz. Tip güvenliği projenin kutsal yasasıdır.
|
|
93
|
+
3. **Cerrahi Düzenleme Standardı:** Dosyaların tamamını üzerine yazmak yasaktır. Sistem, sadece değişen satırları güncelleyen `replace_text` ve `patch_file` araçlarını zorunlu kılar.
|
|
94
|
+
4. **Otonom Hafıza Arşivleme (Auto-Prune):** `PROJECT_MEMORY.md` asla şişmez. 10 kayıt sınırını geçen tarihçeler otomatik arşivlenir; sistem her zaman taze ve ekonomik kalır.
|
|
95
|
+
5. **Anayasal SSOT:** Tüm platformlar (Claude, Gemini vb.) tek bir üst otoriteye, `.enderun/ENDERUN.md` anayasasına %100 sadakatle bağlıdır.
|
|
272
96
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
## ⚡ Hızlı Başlangıç ve İş Akışı
|
|
277
|
-
|
|
278
|
-
### 1. Kurulum
|
|
279
|
-
|
|
280
|
-
Framework'ü projenize kurmak ve başlatmak için aşağıdaki adımları takip edin:
|
|
281
|
-
|
|
282
|
-
```bash
|
|
283
|
-
# 1. Framework'ü Gemini CLI için başlatın
|
|
284
|
-
npx agent-enderun init gemini
|
|
285
|
-
|
|
286
|
-
# 2. Bağımlılıkları yükleyin (istendiği gibi)
|
|
287
|
-
npm install
|
|
288
|
-
|
|
289
|
-
# 3. Framework'ün dahili araçlarını derleyin (istendiği gibi)
|
|
290
|
-
npm run enderun:build
|
|
291
|
-
|
|
292
|
-
# 4. Kurulumu ve proje sağlığını doğrulayın
|
|
293
|
-
npx agent-enderun check
|
|
294
|
-
```
|
|
97
|
+
## 🛠️ Kurulum ve Dağıtım
|
|
295
98
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
Agent Enderun'u yeni bir özellik geliştirmek için nasıl kullanacağınız aşağıda açıklanmıştır:
|
|
299
|
-
|
|
300
|
-
**Adım 1: Görevi Tanımlayın**
|
|
301
|
-
Projenizin `docs/` klasöründe yeni bir dosya oluşturun (örn. `docs/yeni-ozellik-isteği.md`) ve istediğiniz özelliği tanımlayın.
|
|
302
|
-
|
|
303
|
-
**Adım 2: Yeni Bir İz (Trace) Oluşturun**
|
|
304
|
-
`PROJECT_MEMORY.md`'de yeni bir görev oluşturmak için CLI'yi kullanın. Bu, benzersiz bir Trace ID oluşturur.
|
|
99
|
+
Kullandığınız platforma göre tek komutla Agent Enderun'u başlatın:
|
|
305
100
|
|
|
306
101
|
```bash
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
**Adım 3: Ajan Orkestrasyonu (Otomatik)**
|
|
311
|
-
`@manager` ajanı (varsayılan AI kişiliği) şunları yapacaktır:
|
|
312
|
-
1. `PROJECT_MEMORY.md`'yi okuyacak ve yeni görevi görecektir.
|
|
313
|
-
2. `docs/yeni-ozellik-isteği.md`'deki talebi analiz edecektir.
|
|
314
|
-
3. Bir plan oluşturacak ve `@explorer`, `@backend` ve `@frontend` gibi uzman ajanlara resmi "brifingler" verecektir.
|
|
102
|
+
# Gemini CLI ve Antigravity için (Standart)
|
|
103
|
+
agent-enderun init gemini
|
|
315
104
|
|
|
316
|
-
|
|
317
|
-
-
|
|
318
|
-
- `@analyst`, yapılan işi proje standartlarına göre otomatik olarak doğrular.
|
|
319
|
-
- `@git`, Trace ID ile etiketlenmiş atomik `commit`'ler oluşturur.
|
|
105
|
+
# Claude Code (CLI & Desktop) için — Cerrahi Odaklı
|
|
106
|
+
agent-enderun init claude
|
|
320
107
|
|
|
321
|
-
|
|
322
|
-
|
|
108
|
+
# Antigravity IDE/CLI Bağımsız Kurulumu
|
|
109
|
+
agent-enderun init antigravity
|
|
323
110
|
|
|
324
|
-
|
|
325
|
-
|
|
111
|
+
# Grok Build / X.ai Otonom Ajanları İçin
|
|
112
|
+
agent-enderun init grok
|
|
326
113
|
```
|
|
327
|
-
Bu, aktif aşamayı, engelleri ve tüm aktif görevlerin durumunu gösterecektir.
|
|
328
114
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
## 🛠️ CLI Komutları
|
|
332
|
-
|
|
333
|
-
Agent Enderun, projeyi yönetmek için güçlü bir komut satırı araç seti ile birlikte gelir.
|
|
115
|
+
## 📋 CLI Komut Rehberi
|
|
334
116
|
|
|
335
117
|
| Komut | Açıklama |
|
|
336
118
|
| :--- | :--- |
|
|
337
|
-
| `
|
|
338
|
-
| `
|
|
339
|
-
| `
|
|
340
|
-
| `
|
|
341
|
-
| `
|
|
342
|
-
|
|
119
|
+
| `status` | Aktif fazı, Trace ID'yi ve ajanların anlık sağlık skorlarını gösterir. |
|
|
120
|
+
| `check` | Sistemin anayasal sağlığını ve dosya bütünlüğünü denetler. |
|
|
121
|
+
| `trace:new` | Yeni bir görev zinciri başlatır ve orduyu görevlendirir. |
|
|
122
|
+
| `create-app` | Doğal dilden kurumsal monorepo (Fastify/React) üretir. |
|
|
123
|
+
| `verify-contract` | Backend ve Frontend arasındaki tip uyumluluğunu mühürler. |
|
|
124
|
+
|
|
125
|
+
## 📂 Sistem Mimarisi
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
├── .enderun/ <-- Sistemin Beyni
|
|
129
|
+
│ ├── agents/ <-- 12 Uzman Ajan Direktifi (Manager, Architect, QA...)
|
|
130
|
+
│ ├── knowledge/ <-- Kurumsal Akıl (ESLint, API, Güvenlik Standartları)
|
|
131
|
+
│ ├── memory-graph/ <-- Ortak Hafıza ve Ajan Bağlamları
|
|
132
|
+
│ ├── queue/ <-- Hermes Mesajlaşma ve Görev Kuyruğu
|
|
133
|
+
│ └── ENDERUN.md <-- Proje Anayasası (Üst Yasa)
|
|
134
|
+
├── apps/ <-- Kurumsal Uygulama Alanı
|
|
135
|
+
├── docs/ <-- Proje Mimari Portalı (ADRs, Tech-Stack)
|
|
136
|
+
└── framework-mcp/ <-- Otonom Operasyon Sunucusu
|
|
137
|
+
```
|
|
138
|
+
|
|
343
139
|
---
|
|
344
140
|
|
|
345
|
-
**
|
|
141
|
+
**Geliştiren / Developed by:** Yusuf BEKAR
|
|
142
|
+
**Sürüm / Version:** v0.9.0
|
|
143
|
+
**Lisans / License:** MIT
|
package/agent.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Agent Enderun — Antigravity Adapter
|
|
2
|
+
|
|
3
|
+
This is the primary entry point when using Agent Enderun within the Antigravity (IDE & CLI) ecosystem.
|
|
4
|
+
|
|
5
|
+
The framework operates under a unified governance structure located in the `.enderun/` directory.
|
|
6
|
+
|
|
7
|
+
### Primary Constitution
|
|
8
|
+
All governance rules, agent checklists, and project memory live here:
|
|
9
|
+
|
|
10
|
+
👉 **[.enderun/ENDERUN.md](.enderun/ENDERUN.md)**
|
|
11
|
+
|
|
12
|
+
### 🤖 Agent Directive
|
|
13
|
+
You are operating under the Agent Enderun governance framework.
|
|
14
|
+
|
|
15
|
+
At the **start of every session**, before any work:
|
|
16
|
+
1. **Restore Memory:** Read `.enderun/PROJECT_MEMORY.md` to restore state, active Trace ID, and history.
|
|
17
|
+
2. **Load Identity:** Read the relevant agent definition under `.enderun/agents/{agent}.md` (default to `@manager`).
|
|
18
|
+
3. **Internalize Knowledge:** Reference the `.enderun/knowledge/` base for architectural and coding standards.
|
|
19
|
+
|
|
20
|
+
### 🛡️ Core Mandates
|
|
21
|
+
- **Surgical Edits:** Use `replace_text` or `patch_file` via MCP for precise changes.
|
|
22
|
+
- **Traceability:** Every action must inherit the active Trace ID from memory.
|
|
23
|
+
- **Contract First:** No implementation without verified types.
|
|
24
|
+
|
|
25
|
+
All paths and references inside the project must comply with the Supreme Constitution located at `.enderun/ENDERUN.md`.
|
package/bin/cli.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { spawn } from
|
|
3
|
-
import { fileURLToPath } from
|
|
4
|
-
import { dirname, join } from
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
5
|
|
|
6
6
|
const __filename = fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = dirname(__filename);
|
|
8
8
|
|
|
9
|
-
const cliPath = join(__dirname,
|
|
9
|
+
const cliPath = join(__dirname, "../src/cli/index.ts");
|
|
10
10
|
|
|
11
11
|
// shell: false kullanarak argümanların (tırnakların) bozulmasını önle
|
|
12
|
-
const child = spawn(
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const child = spawn("npx", ["tsx", cliPath, ...process.argv.slice(2)], {
|
|
13
|
+
stdio: "inherit",
|
|
14
|
+
shell: false
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
child.on(
|
|
18
|
-
|
|
17
|
+
child.on("exit", (code) => {
|
|
18
|
+
process.exit(code ?? 0);
|
|
19
19
|
});
|
package/bin/update-contract.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
/* global console, process */
|
|
4
|
-
/* eslint-disable no-console */
|
|
5
|
-
|
|
6
3
|
import fs from "fs";
|
|
7
4
|
import path from "path";
|
|
8
5
|
import crypto from "crypto";
|
|
@@ -16,51 +13,51 @@ const contractPath = path.join(projectRoot, "apps/backend/contract.version.json"
|
|
|
16
13
|
const sharedTypesDir = path.join(projectRoot, "apps/backend/src/types");
|
|
17
14
|
|
|
18
15
|
function collectTypeFiles(dir) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
17
|
+
const files = [];
|
|
18
|
+
|
|
19
|
+
for (const entry of entries) {
|
|
20
|
+
const fullPath = path.join(dir, entry.name);
|
|
21
|
+
if (entry.isDirectory()) {
|
|
22
|
+
files.push(...collectTypeFiles(fullPath));
|
|
23
|
+
} else if (entry.name.endsWith(".ts")) {
|
|
24
|
+
files.push(fullPath);
|
|
25
|
+
}
|
|
28
26
|
}
|
|
29
|
-
}
|
|
30
27
|
|
|
31
|
-
|
|
28
|
+
return files;
|
|
32
29
|
}
|
|
33
30
|
|
|
34
31
|
function calculateHash(dir) {
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
const hash = crypto.createHash("sha256");
|
|
33
|
+
const files = collectTypeFiles(dir).sort();
|
|
37
34
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
files.forEach(file => {
|
|
36
|
+
const content = fs.readFileSync(file);
|
|
37
|
+
hash.update(path.relative(projectRoot, file));
|
|
38
|
+
hash.update("\0");
|
|
39
|
+
hash.update(content);
|
|
40
|
+
hash.update("\0");
|
|
41
|
+
});
|
|
45
42
|
|
|
46
|
-
|
|
43
|
+
return hash.digest("hex");
|
|
47
44
|
}
|
|
48
45
|
|
|
49
46
|
try {
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
console.log("🔍 Calculating shared-types contract hash...");
|
|
48
|
+
const newHash = calculateHash(sharedTypesDir);
|
|
52
49
|
|
|
53
|
-
|
|
50
|
+
const contract = JSON.parse(fs.readFileSync(contractPath, "utf-8"));
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
if (contract.contract_hash === newHash) {
|
|
53
|
+
console.log("✅ Contract hash is already up to date.");
|
|
54
|
+
} else {
|
|
55
|
+
contract.contract_hash = newHash;
|
|
56
|
+
contract.last_updated = new Date().toISOString();
|
|
57
|
+
fs.writeFileSync(contractPath, JSON.stringify(contract, null, 2));
|
|
58
|
+
console.log(`🚀 Contract updated with new hash: ${newHash.slice(0, 10)}...`);
|
|
59
|
+
}
|
|
63
60
|
} catch (error) {
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
console.error("❌ Failed to update contract hash:", error.message);
|
|
62
|
+
process.exit(1);
|
|
66
63
|
}
|