agent-enderun 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/.enderun/ENDERUN.md +1 -1
  2. package/.enderun/STATUS.md +2 -2
  3. package/.enderun/agents/analyst.json +4 -4
  4. package/.enderun/agents/backend.json +4 -4
  5. package/.enderun/agents/database.json +4 -4
  6. package/.enderun/agents/devops.json +4 -4
  7. package/.enderun/agents/explorer.json +4 -4
  8. package/.enderun/agents/frontend.json +4 -4
  9. package/.enderun/agents/git.json +4 -4
  10. package/.enderun/agents/manager.json +4 -6
  11. package/.enderun/agents/mobile.json +4 -4
  12. package/.enderun/agents/native.json +4 -4
  13. package/.enderun/agents/quality.json +4 -4
  14. package/.enderun/agents/security.json +4 -4
  15. package/.enderun/config.json +3 -2
  16. package/.enderun/logs/manager.json +26 -47
  17. package/.enderun/memory/PROJECT_MEMORY.md +42 -9
  18. package/CLAUDE.md +5 -4
  19. package/GEMINI.md +5 -4
  20. package/GROK.md +3 -3
  21. package/README.md +8 -8
  22. package/agent.md +6 -6
  23. package/bin/cli.js +3 -4
  24. package/bin/compile.js +22 -0
  25. package/bin/test-init-run.js +136 -0
  26. package/dist/framework-mcp/src/index.js +1 -1
  27. package/dist/framework-mcp/src/tools/definitions.js +3 -1
  28. package/dist/framework-mcp/src/tools/definitions.js.map +1 -1
  29. package/dist/framework-mcp/src/tools/file_system/read_file.js +20 -0
  30. package/dist/framework-mcp/src/tools/file_system/read_file.js.map +1 -1
  31. package/dist/framework-mcp/src/tools/messaging/send_message.js +37 -14
  32. package/dist/framework-mcp/src/tools/messaging/send_message.js.map +1 -1
  33. package/dist/src/cli/adapters.d.ts +3 -1
  34. package/dist/src/cli/adapters.js +13 -11
  35. package/dist/src/cli/adapters.js.map +1 -1
  36. package/dist/src/cli/commands/check.js +12 -1
  37. package/dist/src/cli/commands/check.js.map +1 -1
  38. package/dist/src/cli/commands/init.js +21 -11
  39. package/dist/src/cli/commands/init.js.map +1 -1
  40. package/dist/src/cli/commands/orchestrate.d.ts +15 -0
  41. package/dist/src/cli/commands/orchestrate.js +45 -1
  42. package/dist/src/cli/commands/orchestrate.js.map +1 -1
  43. package/dist/src/cli/index.js +84 -19
  44. package/dist/src/cli/index.js.map +1 -1
  45. package/dist/src/cli/utils/memory.js +4 -0
  46. package/dist/src/cli/utils/memory.js.map +1 -1
  47. package/dist/src/cli/utils/pkg.js +5 -1
  48. package/dist/src/cli/utils/pkg.js.map +1 -1
  49. package/dist/tests/adapter.test.js +10 -8
  50. package/dist/tests/adapter.test.js.map +1 -1
  51. package/dist/tests/gemini.test.js +8 -7
  52. package/dist/tests/gemini.test.js.map +1 -1
  53. package/dist/vitest.config.js +1 -1
  54. package/dist/vitest.config.js.map +1 -1
  55. package/docs/project_analysis_report.md +69 -0
  56. package/eslint.config.js +2 -2
  57. package/framework-mcp/dist/src/index.js +1 -1
  58. package/framework-mcp/dist/src/tools/definitions.js +3 -1
  59. package/framework-mcp/dist/src/tools/file_system/read_file.js +20 -0
  60. package/framework-mcp/package.json +2 -2
  61. package/framework-mcp/src/index.ts +1 -1
  62. package/framework-mcp/src/tools/definitions.ts +3 -1
  63. package/framework-mcp/src/tools/file_system/read_file.ts +24 -0
  64. package/package.json +10 -8
  65. package/src/cli/adapters.ts +13 -11
  66. package/src/cli/commands/check.ts +13 -1
  67. package/src/cli/commands/init.ts +20 -11
  68. package/src/cli/commands/orchestrate.ts +1 -1
  69. package/src/cli/utils/memory.ts +4 -0
  70. package/src/cli/utils/pkg.ts +5 -1
  71. package/tsconfig.json +0 -2
  72. package/.enderun/ARCHITECTURE.md +0 -1
  73. package/.enderun/SECURITY.md +0 -1
  74. package/bin/init-check.js +0 -86
  75. package/bin/update-contract.js +0 -93
  76. package/dist/apps/backend/src/types/index.d.ts +0 -9
  77. package/dist/apps/backend/src/types/index.js +0 -5
  78. package/dist/apps/backend/src/types/index.js.map +0 -1
  79. package/dist/apps/web/src/main.d.ts +0 -1
  80. package/dist/apps/web/src/main.js +0 -9
  81. package/dist/apps/web/src/main.js.map +0 -1
  82. package/dist/apps/web/vite.config.d.ts +0 -2
  83. package/dist/apps/web/vite.config.js +0 -6
  84. package/dist/apps/web/vite.config.js.map +0 -1
  85. package/dist/tests/framework-init-test/framework-mcp/src/index.d.ts +0 -1
  86. package/dist/tests/framework-init-test/framework-mcp/src/index.js +0 -71
  87. package/dist/tests/framework-init-test/framework-mcp/src/index.js.map +0 -1
  88. package/dist/tests/framework-init-test/framework-mcp/src/tools/definitions.d.ts +0 -2
  89. package/dist/tests/framework-init-test/framework-mcp/src/tools/definitions.js +0 -111
  90. package/dist/tests/framework-init-test/framework-mcp/src/tools/definitions.js.map +0 -1
  91. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/patch_file.d.ts +0 -2
  92. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/patch_file.js +0 -19
  93. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/patch_file.js.map +0 -1
  94. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/read_file.d.ts +0 -2
  95. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/read_file.js +0 -8
  96. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/read_file.js.map +0 -1
  97. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/replace_text.d.ts +0 -2
  98. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/replace_text.js +0 -32
  99. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/replace_text.js.map +0 -1
  100. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/write_file.d.ts +0 -2
  101. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/write_file.js +0 -10
  102. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/write_file.js.map +0 -1
  103. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/get_status.d.ts +0 -2
  104. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/get_status.js +0 -6
  105. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/get_status.js.map +0 -1
  106. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/orchestrate.d.ts +0 -2
  107. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/orchestrate.js +0 -6
  108. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/orchestrate.js.map +0 -1
  109. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/update_contract_hash.d.ts +0 -2
  110. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/update_contract_hash.js +0 -6
  111. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/update_contract_hash.js.map +0 -1
  112. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/update_memory.d.ts +0 -2
  113. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/update_memory.js +0 -9
  114. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/update_memory.js.map +0 -1
  115. package/dist/tests/framework-init-test/framework-mcp/src/tools/index.d.ts +0 -5
  116. package/dist/tests/framework-init-test/framework-mcp/src/tools/index.js +0 -26
  117. package/dist/tests/framework-init-test/framework-mcp/src/tools/index.js.map +0 -1
  118. package/dist/tests/framework-init-test/framework-mcp/src/tools/messaging/log_action.d.ts +0 -2
  119. package/dist/tests/framework-init-test/framework-mcp/src/tools/messaging/log_action.js +0 -23
  120. package/dist/tests/framework-init-test/framework-mcp/src/tools/messaging/log_action.js.map +0 -1
  121. package/dist/tests/framework-init-test/framework-mcp/src/tools/messaging/send_message.d.ts +0 -2
  122. package/dist/tests/framework-init-test/framework-mcp/src/tools/messaging/send_message.js +0 -24
  123. package/dist/tests/framework-init-test/framework-mcp/src/tools/messaging/send_message.js.map +0 -1
  124. package/dist/tests/framework-init-test/framework-mcp/src/tools/types.d.ts +0 -47
  125. package/dist/tests/framework-init-test/framework-mcp/src/tools/types.js +0 -2
  126. package/dist/tests/framework-init-test/framework-mcp/src/tools/types.js.map +0 -1
  127. package/dist/tests/framework-init-test/framework-mcp/src/utils/cli.d.ts +0 -5
  128. package/dist/tests/framework-init-test/framework-mcp/src/utils/cli.js +0 -21
  129. package/dist/tests/framework-init-test/framework-mcp/src/utils/cli.js.map +0 -1
  130. package/dist/tests/framework-init-test/framework-mcp/src/utils/security.d.ts +0 -12
  131. package/dist/tests/framework-init-test/framework-mcp/src/utils/security.js +0 -54
  132. package/dist/tests/framework-init-test/framework-mcp/src/utils/security.js.map +0 -1
  133. package/dist/tests/framework-init-test/framework-mcp/tests/tools/file_system/replace_text.test.d.ts +0 -1
  134. package/dist/tests/framework-init-test/framework-mcp/tests/tools/file_system/replace_text.test.js +0 -69
  135. package/dist/tests/framework-init-test/framework-mcp/tests/tools/file_system/replace_text.test.js.map +0 -1
  136. package/dist/tests/framework-init-test/panda.config.d.ts +0 -4
  137. package/dist/tests/framework-init-test/panda.config.js +0 -95
  138. package/dist/tests/framework-init-test/panda.config.js.map +0 -1
  139. package/dist/tests/framework-init-test/vitest.config.d.ts +0 -2
  140. package/dist/tests/framework-init-test/vitest.config.js +0 -19
  141. package/dist/tests/framework-init-test/vitest.config.js.map +0 -1
@@ -0,0 +1,69 @@
1
+ # Agent Enderun — Framework Analizi ve Proje Raporu
2
+
3
+ Bu rapor, **Agent Enderun Enterprise v1 (v1.1.2)** altyapısının genel mimari yapısını, orkestrasyon mekanizmasını, MCP araçlarını ve kurumsal proje geliştirme standartlarını incelemek amacıyla hazırlanmıştır.
4
+
5
+ Projenin `apps/` dizini kasıtlı olarak boş bırakılmıştır. Bu yapı, geliştiricilerin kendi yeteneklerini, hafıza haritalarını ve kurumsal iş mantıklarını sıfırdan ve temiz bir alanda inşa edebilmesi için tasarlanmış bir **"kurumsal proje geliştirme motoru" (development engine)** niteliğindedir.
6
+
7
+ ---
8
+
9
+ ## 🏛️ Mimari Yapı ve Temel Bileşenler
10
+
11
+ Agent Enderun, AI ajanlarının otonom olarak çalışabileceği ancak insan yapımı kurallarla (Anayasa) sıkı bir şekilde sınırlandırıldığı bir **AI Yönetişim Altyapısıdır (AI Governance Framework)**.
12
+
13
+ ```mermaid
14
+ graph TD
15
+ CLI[CLI: agent-enderun] -->|Komutlar & NL İstekleri| Manager[@manager - Commander]
16
+ Manager -->|Hermes Protokolü| MsgQueue[Mesaj Kuyruğu: .enderun/messages/]
17
+ MsgQueue -->|Durum Makinesi / AL| Agents[Ajan Ordusu: 12 Uzman Ajan]
18
+ Agents -->|MCP Araçları| Workspace[Proje Çalışma Alanı: apps/]
19
+ Agents -->|Loglama & Hafıza| Mem[Proje Hafızası: PROJECT_MEMORY.md]
20
+ ```
21
+
22
+ ### 1. Supreme Constitution (Üstün Yasa)
23
+ Tüm sistemin ve ajanların uymak zorunda olduğu kurallar bütününü içerir:
24
+ * **Ana Anayasa (`.enderun/ENDERUN.md`):** Ajanların operasyonel sınırlarını çizer. `replace_text` kullanımı zorunluluğu, `any` tipinin ve `console.log` kullanımının yasak olması, Zero Mock (Sahte Veri Yasağı) ve branded types standartları burada mühürlenmiştir.
25
+ * **Güvenlik Protokolleri (`docs/architecture/approval-flows.md`):** Yüksek riskli işlemler (toplu veri silme, veritabanı şema değişimi, credential rotasyonu) için `@manager` onayını ve insan-in-the-loop (`approve` komutu) imzasını zorunlu kılar.
26
+
27
+ ### 2. Ajan Ordusu (Agent Army - AL Compliant)
28
+ `.enderun/agents/` altında JSON şemalarıyla tanımlanmış 12 adet uzman ajan bulunur. Ajanların durumları **Agent Lifecycle (AL)** durum makinesine (`IDLE` ➔ `BRIEFED` ➔ `EXECUTING` ➔ `DONE`/`BLOCKED`) göre yönetilir:
29
+ * `@manager`: Supreme Orchestrator ve Team-Lead rolündedir. Her talebi analiz eder ve iş paketlerini delege eder.
30
+ * `@backend` & `@frontend`: Sunucu mantığı, Panda CSS tabanlı sıfır-kütüphane arayüz standartlarını yönetir.
31
+ * `@database` & `@devops`: Kysely tabanlı veri katmanını ve CI/CD süreçlerini yürütür.
32
+ * `@quality`: Kod standartlarını (ESLint) ve test kapsamını (%80 üzeri) denetleyen son onay kapısıdır.
33
+ * `@explorer`, `@git`, `@mobile`, `@native`, `@security`, `@analyst`: Diğer uzmanlık alanlarındaki görevleri icra eder.
34
+
35
+ ### 3. Hermes Mesajlaşma Kanalı
36
+ Ajanlar arası ve kullanıcı ile ajanlar arasındaki iletişim asenkron ve JSON formatında Hermes protokolü ile sağlanır:
37
+ * **İletişim Kanalı:** `.enderun/messages/` klasöründe yer alan JSON dosyalarıdır.
38
+ * **Kilit Mekanizması:** Çakışmaları önlemek için `.lock` dosyası ile Hermes kilit protokolü uygulanır (LLM zaman aşımları için 5 saniyelik stale lock kontrolü mevcuttur).
39
+ * **Trace ID:** Her işlem zinciri `trace:new` ile oluşturulan benzersiz bir Trace ID'yi miras alır ve tüm loglarda taşınır.
40
+
41
+ ---
42
+
43
+ ## 🛠️ CLI ve Geliştirici Komutları
44
+
45
+ Çalışma alanı kök dizinindeki `bin/cli.js` üzerinden `src/cli/` altındaki komutlar tetiklenir:
46
+ 1. `init [adapter]`: Altyapıyı hedef ortama (`gemini`, `claude`, `grok` vb.) göre uyarlar, kurallar ve yetenek şablonlarını oluşturur.
47
+ 2. `check`: Sistem sağlık taramasını gerçekleştirir ve ajan ordusunun şema uyumluluğunu doğrular.
48
+ 3. `status`: Aktif fazı, güncel Trace ID'yi ve ajanların anlık durumlarını gösterir.
49
+ 4. `trace:new`: Yeni bir iş zinciri başlatır.
50
+ 5. `orchestrate`: Bekleyen Hermes görevlerini sırasıyla ajanlara delege eder ve durumlarını günceller.
51
+ 6. `verify-contract` & `update-contract`: API veri tiplerinin ve kontratların frontend-backend arasında uyumlu olmasını güvence altına alır.
52
+
53
+ ---
54
+
55
+ ## 📡 Model Context Protocol (MCP) Server
56
+
57
+ `framework-mcp/` dizini altında bağımsız bir paket olarak geliştirilmiştir:
58
+ * **SDK Entegrasyonu:** `@modelcontextprotocol/sdk` kullanılarak tasarlanmıştır.
59
+ * **Dosya Yönetim Araçları:** Ajanların kod üzerinde cerrahi operasyon yapmasını sağlayan `replace_text`, `patch_file`, `write_file` ve `read_file` araçları sunulur.
60
+ * **Yönetim ve Mesajlaşma Araçları:** Proje hafızasını güncellemek için `update_project_memory`, mesaj göndermek için `send_agent_message` ve eylemleri kaydetmek için `log_agent_action` araçlarını içerir.
61
+
62
+ ---
63
+
64
+ ## 📈 Sonuç ve Öneriler
65
+
66
+ Proje, kurumsal seviyede çoklu ajan yönetimi ve kod kalitesi yönetişimi için mükemmel bir temel hazırlamıştır. `apps/` dizininin boş bırakılmış olması, geliştirilmek istenen özel kurumsal projeler için temiz bir sayfa sunar. Geliştirme sürecinde şunlara dikkat edilmelidir:
67
+ 1. **Hafıza Senkronizasyonu:** Her aşamada `.enderun/memory/PROJECT_MEMORY.md` ve `.enderun/logs/` güncellenmelidir.
68
+ 2. **Surgical Kodlama:** Dosyaları komple değiştirmek yerine MCP araçları ile nokta atışı (`replace_text`) düzenleme alışkanlığı sürdürülmelidir.
69
+ 3. **AL Uyumluluğu:** Ajan tanımlarında yapılan değişikliklerden sonra mutlaka `agent-enderun validate` komutu ile doğrulama yapılmalıdır.
package/eslint.config.js CHANGED
@@ -16,7 +16,7 @@ export default tseslint.config(
16
16
  "**/node_modules/**",
17
17
  "**/dist/**",
18
18
  "framework-mcp/dist/**",
19
- "apps/*/dist/**",
19
+
20
20
  ".agent/**",
21
21
  ".gemini/**",
22
22
  ".claude/**",
@@ -37,7 +37,7 @@ export default tseslint.config(
37
37
  ...globals.es2021,
38
38
  },
39
39
  parserOptions: {
40
- project: ["./tsconfig.json", "./apps/*/tsconfig.json", "./framework-mcp/tsconfig.json"],
40
+ project: ["./tsconfig.json", "./framework-mcp/tsconfig.json"],
41
41
  tsconfigRootDir: import.meta.dirname,
42
42
  },
43
43
 
@@ -5,7 +5,7 @@ import { TOOLS, toolHandlers } from "./tools/index.js";
5
5
  // ─── Server Setup ─────────────────────────────────────────────────
6
6
  const server = new Server({
7
7
  name: "@agent-enderun/mcp",
8
- version: "1.0.9",
8
+ version: "1.1.2",
9
9
  }, {
10
10
  capabilities: {
11
11
  tools: {},
@@ -1,11 +1,13 @@
1
1
  export const TOOLS = [
2
2
  {
3
3
  name: "read_file",
4
- description: "Read the content of a file within the project.",
4
+ description: "Read the content of a file within the project. Supports optional line range reading to prevent stream overload.",
5
5
  inputSchema: {
6
6
  type: "object",
7
7
  properties: {
8
8
  path: { type: "string", description: "Path to the file relative to project root" },
9
+ startLine: { type: "number", description: "Optional starting line number (1-indexed)" },
10
+ endLine: { type: "number", description: "Optional ending line number (inclusive)" },
9
11
  },
10
12
  required: ["path"],
11
13
  },
@@ -2,6 +2,26 @@ import fs from "fs";
2
2
  import { safePath } from "../../utils/security.js";
3
3
  export function handleReadFile(projectRoot, args) {
4
4
  const filePath = safePath(projectRoot, args.path);
5
+ const startLine = args.startLine !== undefined ? Number(args.startLine) : undefined;
6
+ const endLine = args.endLine !== undefined ? Number(args.endLine) : undefined;
5
7
  const content = fs.readFileSync(filePath, "utf8");
8
+ const lines = content.split(/\r?\n/);
9
+ if (startLine !== undefined || endLine !== undefined) {
10
+ const start = startLine !== undefined ? Math.max(1, startLine) - 1 : 0;
11
+ const end = endLine !== undefined ? Math.min(lines.length, endLine) : lines.length;
12
+ const sliced = lines.slice(start, end).join("\n");
13
+ return { content: [{ type: "text", text: sliced }] };
14
+ }
15
+ // Default protection limit: 1000 lines
16
+ const DEFAULT_MAX_LINES = 1000;
17
+ if (lines.length > DEFAULT_MAX_LINES) {
18
+ const sliced = lines.slice(0, DEFAULT_MAX_LINES).join("\n");
19
+ return {
20
+ content: [{
21
+ type: "text",
22
+ text: `${sliced}\n\n... [TRUNCATED - File is too long (${lines.length} lines). Only the first ${DEFAULT_MAX_LINES} lines are shown. Use startLine and endLine parameters to read other parts of the file.]`
23
+ }]
24
+ };
25
+ }
6
26
  return { content: [{ type: "text", text: content }] };
7
27
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-enderun/mcp",
3
- "version": "1.0.9",
3
+ "version": "1.1.2",
4
4
  "description": "Agent Enderun Model Context Protocol (MCP) Server",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -16,4 +16,4 @@
16
16
  "@types/node": "^25.9.1",
17
17
  "typescript": "^6.0.3"
18
18
  }
19
- }
19
+ }
@@ -14,7 +14,7 @@ import { TOOLS, toolHandlers } from "./tools/index.js";
14
14
  const server = new Server(
15
15
  {
16
16
  name: "@agent-enderun/mcp",
17
- version: "1.0.9",
17
+ version: "1.1.2",
18
18
  },
19
19
  {
20
20
  capabilities: {
@@ -3,11 +3,13 @@ import { ToolDefinition } from "../tools/types.js";
3
3
  export const TOOLS: ToolDefinition[] = [
4
4
  {
5
5
  name: "read_file",
6
- description: "Read the content of a file within the project.",
6
+ description: "Read the content of a file within the project. Supports optional line range reading to prevent stream overload.",
7
7
  inputSchema: {
8
8
  type: "object",
9
9
  properties: {
10
10
  path: { type: "string", description: "Path to the file relative to project root" },
11
+ startLine: { type: "number", description: "Optional starting line number (1-indexed)" },
12
+ endLine: { type: "number", description: "Optional ending line number (inclusive)" },
11
13
  },
12
14
  required: ["path"],
13
15
  },
@@ -4,6 +4,30 @@ import { ToolArgs, ToolResult } from "../types.js";
4
4
 
5
5
  export function handleReadFile(projectRoot: string, args: ToolArgs): ToolResult {
6
6
  const filePath = safePath(projectRoot, args.path as string);
7
+ const startLine = args.startLine !== undefined ? Number(args.startLine) : undefined;
8
+ const endLine = args.endLine !== undefined ? Number(args.endLine) : undefined;
9
+
7
10
  const content = fs.readFileSync(filePath, "utf8");
11
+ const lines = content.split(/\r?\n/);
12
+
13
+ if (startLine !== undefined || endLine !== undefined) {
14
+ const start = startLine !== undefined ? Math.max(1, startLine) - 1 : 0;
15
+ const end = endLine !== undefined ? Math.min(lines.length, endLine) : lines.length;
16
+ const sliced = lines.slice(start, end).join("\n");
17
+ return { content: [{ type: "text", text: sliced }] };
18
+ }
19
+
20
+ // Default protection limit: 1000 lines
21
+ const DEFAULT_MAX_LINES = 1000;
22
+ if (lines.length > DEFAULT_MAX_LINES) {
23
+ const sliced = lines.slice(0, DEFAULT_MAX_LINES).join("\n");
24
+ return {
25
+ content: [{
26
+ type: "text",
27
+ text: `${sliced}\n\n... [TRUNCATED - File is too long (${lines.length} lines). Only the first ${DEFAULT_MAX_LINES} lines are shown. Use startLine and endLine parameters to read other parts of the file.]`
28
+ }]
29
+ };
30
+ }
31
+
8
32
  return { content: [{ type: "text", text: content }] };
9
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-enderun",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "The Supreme AI Governance & Orchestration Framework for Enterprise Development",
5
5
  "author": "Yusuf BEKAR",
6
6
  "license": "MIT",
@@ -24,7 +24,6 @@
24
24
  "framework"
25
25
  ],
26
26
  "workspaces": [
27
- "apps/*",
28
27
  "framework-mcp"
29
28
  ],
30
29
  "bin": {
@@ -50,6 +49,7 @@
50
49
  "docs"
51
50
  ],
52
51
  "scripts": {
52
+ "build": "tsc && npm run build --prefix framework-mcp",
53
53
  "enderun:build": "npm run build --prefix framework-mcp",
54
54
  "enderun:test": "vitest run",
55
55
  "enderun:test:watch": "vitest",
@@ -58,10 +58,12 @@
58
58
  "enderun:verify": "agent-enderun verify-contract",
59
59
  "enderun:update-contract": "agent-enderun update-contract",
60
60
  "enderun:check": "agent-enderun check",
61
+ "test:init": "node dist/src/cli/index.js init",
62
+ "test:init:run": "node bin/test-init-run.js",
61
63
  "enderun:lint": "eslint .",
62
64
  "lint": "eslint .",
63
- "prepublishOnly": "npm run enderun:build",
64
- "clean": "rm -rf node_modules apps/*/node_modules framework-mcp/node_modules apps/*/dist framework-mcp/dist"
65
+ "prepublishOnly": "npm run build",
66
+ "clean": "rm -rf dist node_modules framework-mcp/node_modules framework-mcp/dist"
65
67
  },
66
68
  "publishConfig": {
67
69
  "access": "public"
@@ -79,12 +81,12 @@
79
81
  "typescript": "^6.0.3",
80
82
  "typescript-eslint": "^8.60.0",
81
83
  "vitest": "^4.1.7",
82
- "zod": "^3.24.2"
84
+ "zod": "^3.24.2",
85
+ "agent-enderun": "^1.1.2"
83
86
  },
84
87
  "enderun": {
85
- "version": "1.1.0",
86
- "initializedAt": "2026-05-31T09:58:25.773Z",
87
- "frameworkDir": ".enderun"
88
+ "version": "1.1.2",
89
+ "initializedAt": "2026-06-03T19:49:46.747Z"
88
90
  },
89
91
  "dependencies": {}
90
92
  }
@@ -22,14 +22,14 @@ export interface AdapterConfig {
22
22
  export const ADAPTERS: Record<AdapterId, AdapterConfig> = {
23
23
  gemini: {
24
24
  id: "gemini",
25
- frameworkDir: ".gemini",
26
- shimFile: "gemini.md",
25
+ frameworkDir: ".enderun",
26
+ shimFile: "GEMINI.md",
27
27
  templateDir: ".enderun",
28
28
  nestedDirs: ["agents", "skills", "knowledge"],
29
29
  },
30
30
  claude: {
31
31
  id: "claude",
32
- frameworkDir: ".claude",
32
+ frameworkDir: ".enderun",
33
33
  shimFile: "CLAUDE.md",
34
34
  templateDir: ".enderun",
35
35
  nestedDirs: ["agents", "skills", "knowledge"],
@@ -50,24 +50,24 @@ export const ADAPTERS: Record<AdapterId, AdapterConfig> = {
50
50
  },
51
51
  grok: {
52
52
  id: "grok",
53
- frameworkDir: ".grok",
54
- shimFile: "grok.md",
53
+ frameworkDir: ".enderun",
54
+ shimFile: "GROK.md",
55
55
  templateDir: ".enderun",
56
- nestedDirs: ["plugins", "agents", "knowledge"],
56
+ nestedDirs: ["agents", "skills", "knowledge"],
57
57
  },
58
58
  antigravity: {
59
59
  id: "antigravity",
60
- frameworkDir: ".agent",
60
+ frameworkDir: ".enderun",
61
61
  shimFile: "agent.md",
62
62
  templateDir: ".enderun",
63
- nestedDirs: ["skills", "workflows", "rules", "knowledge"],
63
+ nestedDirs: ["agents", "skills", "knowledge"],
64
64
  },
65
65
  "antigravity-cli": {
66
66
  id: "antigravity-cli",
67
- frameworkDir: ".gemini/antigravity-cli",
67
+ frameworkDir: ".enderun",
68
68
  shimFile: "agent.md",
69
69
  templateDir: ".enderun",
70
- nestedDirs: ["agents", "skills"],
70
+ nestedDirs: ["agents", "skills", "knowledge"],
71
71
  },
72
72
  };
73
73
 
@@ -209,7 +209,9 @@ export function buildMcpServerEntry(projectRoot: string) {
209
209
  return {
210
210
  command: "node",
211
211
  args: [path.join(projectRoot, "framework-mcp/dist/index.js")],
212
- env: {},
212
+ env: {
213
+ ENDERUN_PROJECT_ROOT: projectRoot,
214
+ },
213
215
  };
214
216
  }
215
217
 
@@ -41,7 +41,6 @@ export function checkCommand() {
41
41
  { name: "MCP Config (mcp.json)", path: "mcp.json" },
42
42
  { name: "ESLint Config (eslint.config.js)", path: "eslint.config.js" },
43
43
  { name: "ESLint Standards", path: path.join(frameworkDir, `${knowledgeDir}/eslint-standards.md`) },
44
- { name: "Backend Contract", path: path.join(pathsMap.backend, "contract.version.json") },
45
44
  { name: "MCP Server", path: "framework-mcp/package.json" },
46
45
  { name: "Panda CSS Config", path: "panda.config.ts" },
47
46
  { name: "Brain Dashboard", path: path.join(frameworkDir, "BRAIN_DASHBOARD.md") },
@@ -52,6 +51,11 @@ export function checkCommand() {
52
51
  { name: "Atomic Component Standards", path: path.join(pathsMap.docs, "frontend/component-patterns.md") },
53
52
  ];
54
53
 
54
+ // Optional app-level checks (only when apps/ has content)
55
+ const optionalChecks = [
56
+ { name: "Backend Contract", path: path.join(pathsMap.backend, "contract.version.json") },
57
+ ];
58
+
55
59
  for (const check of checks) {
56
60
  if (fs.existsSync(path.join(process.cwd(), check.path))) {
57
61
  console.warn(`✅ ${check.name} found.`);
@@ -61,6 +65,14 @@ export function checkCommand() {
61
65
  }
62
66
  }
63
67
 
68
+ for (const check of optionalChecks) {
69
+ if (fs.existsSync(path.join(process.cwd(), check.path))) {
70
+ console.warn(`✅ ${check.name} found.`);
71
+ } else {
72
+ console.warn(`ℹ️ ${check.name} not found (${check.path}) — created with 'create-app'.`);
73
+ }
74
+ }
75
+
64
76
  // Dependency Check
65
77
  const mcpNodeModules = path.join(process.cwd(), "framework-mcp/node_modules");
66
78
  const rootNodeModules = path.join(process.cwd(), "node_modules");
@@ -10,15 +10,14 @@ import {
10
10
  runAdapterPostInit,
11
11
  type AdapterConfig,
12
12
  } from "../adapters.js";
13
- import { mergePackageJson, deepCleanProtocols, sanitizeJson, getPackageVersion, getValidatorPath } from "../utils/pkg.js";
13
+ import { mergePackageJson, deepCleanProtocols, sanitizeJson, getPackageVersion, getValidatorPath, getPackageRoot } from "../utils/pkg.js";
14
14
  import { updateGitIgnore, ensureDir, writeJsonFile, copyDir, writeTextFile } from "../utils/fs.js";
15
15
  import { initializeMemory } from "../utils/memory.js";
16
16
  import { checkCommand } from "./check.js";
17
17
 
18
18
  const __filename = fileURLToPath(import.meta.url);
19
19
  const __dirname = path.dirname(__filename);
20
- const sourceDir = path.join(__dirname, "../../..");
21
- const targetDir = process.cwd();
20
+ const sourceDir = getPackageRoot();
22
21
 
23
22
  const FRAMEWORK_VERSION = getPackageVersion();
24
23
 
@@ -130,7 +129,7 @@ const allAgents = [
130
129
  }
131
130
  ];
132
131
 
133
- function scaffoldCoreAgents(agentsBaseDir: string, dryRun: boolean) {
132
+ function scaffoldCoreAgents(targetDir: string, agentsBaseDir: string, dryRun: boolean) {
134
133
  ensureDir(agentsBaseDir, dryRun);
135
134
  const agentSchemaDir = path.join(agentsBaseDir, "schema");
136
135
  ensureDir(agentSchemaDir, dryRun);
@@ -230,8 +229,11 @@ function buildDirsToCreate(adapter: AdapterConfig): string[] {
230
229
  const dirs = [
231
230
  adapter.frameworkDir,
232
231
  ...FRAMEWORK_SUBDIRS.map((d) => `${adapter.frameworkDir}/${d}`),
233
- "apps/web", "apps/backend", "docs", "framework-mcp", "tests",
232
+ "docs", "framework-mcp",
234
233
  ];
234
+ if (process.env.ENDERUN_SKIP_INSTALL !== "1") {
235
+ dirs.push("tests");
236
+ }
235
237
  if (adapter.nestedDirs) {
236
238
  for (const nested of adapter.nestedDirs) dirs.push(`${adapter.frameworkDir}/${nested}`);
237
239
  }
@@ -240,6 +242,7 @@ function buildDirsToCreate(adapter: AdapterConfig): string[] {
240
242
  }
241
243
 
242
244
  export async function initCommand(adapterInput?: string, dryRun = false) {
245
+ const targetDir = process.cwd();
243
246
  const adapter = resolveAdapter(adapterInput);
244
247
  const { frameworkDir, shimFile, templateDir } = adapter;
245
248
  const targetFrameworkDir = path.join(targetDir, frameworkDir);
@@ -252,11 +255,9 @@ export async function initCommand(adapterInput?: string, dryRun = false) {
252
255
 
253
256
  const filesToProcess = [...CORE_FILES, shimFile].filter(f => CORE_FILES.includes(f) || f === shimFile || fs.existsSync(path.join(sourceDir, f)));
254
257
 
255
- ensureDir(path.join(targetDir, "apps/backend"), dryRun);
256
- const initContractPath = path.join(targetDir, "apps/backend/contract.version.json");
257
- if (!fs.existsSync(initContractPath)) {
258
- writeJsonFile(initContractPath, { contract_hash: "initial_hash_placeholder", last_updated: new Date().toISOString() }, dryRun);
259
- }
258
+ // apps/ directory is intentionally left empty during init.
259
+ // Users create apps via `agent-enderun create-app` command.
260
+ // Contract file is created during app scaffolding, not init.
260
261
 
261
262
  let targetPkg: Record<string, unknown> = {};
262
263
  try {
@@ -324,7 +325,15 @@ export async function initCommand(adapterInput?: string, dryRun = false) {
324
325
  if (!dryRun) deepCleanProtocols(targetDir, targetScope);
325
326
 
326
327
  // Scaffold core agents under the central framework directory
327
- scaffoldCoreAgents(path.join(targetFrameworkDir, "agents"), dryRun);
328
+ let agentFolder = "agents";
329
+ if (frameworkDir !== ".enderun") {
330
+ if (adapter.id === "antigravity") {
331
+ agentFolder = "skills";
332
+ } else if (adapter.id === "grok") {
333
+ agentFolder = "plugins";
334
+ }
335
+ }
336
+ scaffoldCoreAgents(targetDir, path.join(targetFrameworkDir, agentFolder), dryRun);
328
337
 
329
338
  if (!fs.existsSync(path.join(targetDir, ".git")) && !dryRun) {
330
339
  try { execSync("git init", { cwd: targetDir, stdio: "ignore" }); } catch { /* ignore */ }
@@ -82,7 +82,7 @@ export async function orchestrateCommand() {
82
82
  }
83
83
 
84
84
  console.log("\n🤖 Görev Devredildi!");
85
- console.log(`👉 Lütfen ${to} agent talimatlarını (${frameworkDir}/${agentFolder}/${to.replace("@", "")}.md) okuyun ve görevi yerine getirin.`);
85
+ console.log(`👉 Lütfen ${to} agent talimatlarını (${frameworkDir}/${agentFolder}/${to.replace("@", "")}.json) okuyun ve görevi yerine getirin.`);
86
86
  console.log("\n💡 İpucu: İş bittiğinde, mesajı PROCESSED olarak işaretlemek ve ajanı boşa çıkarmak için:");
87
87
  console.log(" npx agent-enderun status komutuyla kontrol edin.");
88
88
  }
@@ -167,6 +167,10 @@ This file is the Single Source of Truth (SSOT) and the persistent memory of the
167
167
  if (dryRun) {
168
168
  console.warn(`[DRY RUN] Would initialize PROJECT_MEMORY.md at ${memoryPath}`);
169
169
  } else {
170
+ const parentDir = path.dirname(memoryPath);
171
+ if (!fs.existsSync(parentDir)) {
172
+ fs.mkdirSync(parentDir, { recursive: true });
173
+ }
170
174
  fs.writeFileSync(memoryPath, finalTemplate);
171
175
  console.warn(`✅ PROJECT_MEMORY.md initialized in ${targetBase}`);
172
176
  }
@@ -35,6 +35,10 @@ function findAgentEnderunPackageRoot(): string {
35
35
  let current = path.dirname(new URL(import.meta.url).pathname);
36
36
  const root = path.parse(current).root;
37
37
  while (current !== root) {
38
+ // Sandbox boundary guard: do not access parent paths outside the project workspace
39
+ if (!current.includes("agent-enderun")) {
40
+ break;
41
+ }
38
42
  const pkgPath = path.join(current, "package.json");
39
43
  if (fs.existsSync(pkgPath)) {
40
44
  try {
@@ -191,7 +195,7 @@ export function mergePackageJson(targetPath: string, sourcePath: string): void {
191
195
  if (!targetPkg.name) targetPkg.name = path.basename(process.cwd());
192
196
  if (!targetPkg.version) targetPkg.version = "0.1.0";
193
197
  if (!targetPkg.type) targetPkg.type = "module";
194
- if (!targetPkg.workspaces) targetPkg.workspaces = ["apps/*", "framework-mcp"];
198
+ if (!targetPkg.workspaces) targetPkg.workspaces = ["framework-mcp"];
195
199
 
196
200
  // Add metadata
197
201
  targetPkg.enderun = {
package/tsconfig.json CHANGED
@@ -15,8 +15,6 @@
15
15
  "include": [
16
16
  "src/**/*.ts",
17
17
  "tests/**/*.ts",
18
- "apps/**/*.ts",
19
- "apps/**/*.tsx",
20
18
  "framework-mcp/src/**/*.ts",
21
19
  "vitest.config.ts",
22
20
  "eslint.config.js"
@@ -1 +0,0 @@
1
- # Agent Enderun Architecture Rules
@@ -1 +0,0 @@
1
- # Agent Enderun Security Rules
package/bin/init-check.js DELETED
@@ -1,86 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Agent Enderun — Init Validation Helper
5
- *
6
- * 📌 Low-usage dev/reference script.
7
- * Not wired into main `agent-enderun` CLI commands.
8
- * Use for manual post-init validation during development or testing.
9
- * See `src/cli/commands/check.ts` and `bin/validate-agent-army.js` for primary paths.
10
- */
11
-
12
- import fs from "fs";
13
- import path from "path";
14
-
15
- const targetDir = process.cwd();
16
-
17
- const candidates = [
18
- ".gemini/antigravity",
19
- ".gemini/antigravity-cli",
20
- ".gemini",
21
- ".claude",
22
- ".grok",
23
- ".agent",
24
- ".enderun",
25
- ];
26
- let frameworkDir = ".enderun";
27
- for (const dir of candidates) {
28
- if (fs.existsSync(path.join(targetDir, dir))) {
29
- frameworkDir = dir;
30
- break;
31
- }
32
- }
33
-
34
- let backend = "apps/backend";
35
- let docs = "docs";
36
-
37
- try {
38
- const configPath = path.join(targetDir, frameworkDir, "config.json");
39
- if (fs.existsSync(configPath)) {
40
- const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
41
- if (config.paths) {
42
- if (config.paths.backend) backend = config.paths.backend;
43
- if (config.paths.docs) docs = config.paths.docs;
44
- }
45
- }
46
- } catch {
47
- // ignore
48
- }
49
-
50
- const CRITICAL_STRUCTURE = [
51
- `${frameworkDir}/agents`,
52
- `${frameworkDir}/knowledge`,
53
- `${frameworkDir}/memory-graph/agent-contexts`,
54
- `${frameworkDir}/logs`,
55
- `${frameworkDir}/queue`,
56
- `${frameworkDir}/PROJECT_MEMORY.md`,
57
- `${docs}/architecture/standards`,
58
- `${backend}/src/database`,
59
- `${backend}/src/seeds`,
60
- `${backend}/migrations`
61
- ];
62
-
63
- function checkIntegrity() {
64
- console.warn("🔍 Running Agent Enderun Framework Integrity Check...");
65
- let isHealthy = true;
66
-
67
- for (const item of CRITICAL_STRUCTURE) {
68
- const fullPath = path.join(targetDir, item);
69
- if (!fs.existsSync(fullPath)) {
70
- console.error(`❌ Missing critical component: ${item}`);
71
- isHealthy = false;
72
- } else {
73
- console.warn(`✅ Verified: ${item}`);
74
- }
75
- }
76
-
77
- if (isHealthy) {
78
- console.warn("\n✨ Framework integrity verified. System is healthy.");
79
- process.exit(0);
80
- } else {
81
- console.error("\n❌ Framework integrity check FAILED. Some components are missing.");
82
- process.exit(1);
83
- }
84
- }
85
-
86
- checkIntegrity();