agent-enderun 0.5.8 → 0.5.9

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 (53) hide show
  1. package/.enderun/PROJECT_MEMORY.md +10 -130
  2. package/.enderun/agents/analyst.md +11 -5
  3. package/.enderun/agents/backend.md +46 -39
  4. package/.enderun/agents/explorer.md +14 -2
  5. package/.enderun/agents/frontend.md +41 -7
  6. package/.enderun/agents/git.md +1 -1
  7. package/.enderun/agents/manager.md +1 -1
  8. package/.enderun/agents/mobile.md +1 -1
  9. package/.enderun/agents/native.md +1 -1
  10. package/.enderun/blueprints/backend/errors/domain-error.ts +84 -0
  11. package/.enderun/blueprints/backend/middleware/error-handler.ts +24 -0
  12. package/.enderun/blueprints/frontend/ui/Button.tsx +60 -0
  13. package/.enderun/blueprints/frontend/ui/Input.tsx +43 -0
  14. package/.enderun/logs/manager.json +1 -18
  15. package/ENDERUN.md +24 -1
  16. package/README.md +7 -2
  17. package/bin/update-contract.js +3 -0
  18. package/package.json +2 -2
  19. package/packages/framework-mcp/dist/tools/contract.js +12 -6
  20. package/packages/framework-mcp/dist/tools/framework.js +2 -1
  21. package/packages/framework-mcp/dist/tools/knowledge.js +1 -1
  22. package/packages/framework-mcp/dist/utils.js +1 -1
  23. package/packages/framework-mcp/package.json +4 -1
  24. package/packages/framework-mcp/src/tools/contract.ts +18 -5
  25. package/packages/framework-mcp/src/tools/framework.ts +3 -2
  26. package/packages/framework-mcp/src/tools/knowledge.ts +6 -6
  27. package/packages/framework-mcp/src/utils.ts +1 -1
  28. package/packages/shared-types/dist/api.d.ts +18 -0
  29. package/packages/shared-types/dist/api.js +2 -0
  30. package/packages/shared-types/dist/api.js.map +1 -0
  31. package/packages/shared-types/dist/brands.d.ts +13 -0
  32. package/packages/shared-types/dist/brands.js +2 -0
  33. package/packages/shared-types/dist/brands.js.map +1 -0
  34. package/packages/shared-types/dist/constants.d.ts +27 -0
  35. package/packages/shared-types/dist/constants.js +22 -0
  36. package/packages/shared-types/dist/constants.js.map +1 -0
  37. package/packages/shared-types/dist/index.d.ts +7 -88
  38. package/packages/shared-types/dist/index.js +7 -3
  39. package/packages/shared-types/dist/index.js.map +1 -1
  40. package/packages/shared-types/dist/logs.d.ts +15 -0
  41. package/packages/shared-types/dist/logs.js +2 -0
  42. package/packages/shared-types/dist/logs.js.map +1 -0
  43. package/packages/shared-types/dist/models.d.ts +60 -0
  44. package/packages/shared-types/dist/models.js +2 -0
  45. package/packages/shared-types/dist/models.js.map +1 -0
  46. package/packages/shared-types/package.json +4 -1
  47. package/packages/shared-types/src/api.ts +20 -0
  48. package/packages/shared-types/src/brands.ts +12 -0
  49. package/packages/shared-types/src/constants.ts +34 -0
  50. package/packages/shared-types/src/index.ts +7 -97
  51. package/packages/shared-types/src/logs.ts +16 -0
  52. package/packages/shared-types/src/models.ts +66 -0
  53. package/panda.config.ts +79 -5
@@ -6,19 +6,19 @@ This file is the Single Source of Truth (SSOT) and the persistent memory of the
6
6
 
7
7
  | Active Phase | Profile | Last Update | Active Trace ID | Blockers |
8
8
  | :----------- | :------ | :---------- | :-------------- | :------- |
9
- | PHASE_0 | Lightweight | 2026-05-16 | 01KR6EJA6GG3RPS849097KS37Q | NONE |
9
+ | PHASE_0 | Lightweight | 2026-05-20 | 01KR6EJA6GG3RPS849097KS37Q | NONE |
10
10
 
11
11
  ## PROJECT DEFINITION
12
12
 
13
- - **Name:** Agent Enderun
14
- - **Version:** v0.5.8
13
+ - **Name:** KENTİM
14
+ - **Version:** v1.0.0
15
15
  | Field | Value |
16
16
  | :--- | :--- |
17
- | Project Name | agent-enderun |
18
- | Platform | Not defined |
17
+ | Project Name | kentim |
18
+ | Platform | Multi-Tenant SaaS |
19
19
  | Frontend | React 19 + Vite + Panda CSS |
20
20
  | Backend | Node.js 20+ + Fastify |
21
- | DB | PostgreSQL |
21
+ | DB | PostgreSQL + PostGIS + RLS |
22
22
 
23
23
  ## DOD STATUS
24
24
 
@@ -34,8 +34,7 @@ This file is the Single Source of Truth (SSOT) and the persistent memory of the
34
34
 
35
35
  | Date | Decision | Rationale | Agent |
36
36
  | :--- | :--- | :--- | :--- |
37
- | 2026-05-12 | Framework Unified to v0.4.5 | Inclusion of missing adapter files and installation fix | @manager |
38
- | 2026-05-09 | Project Initialized | Framework setup via CLI | @manager |
37
+ | 2026-05-20 | Project Initialized | Fresh setup for KENTİM project | @manager |
39
38
 
40
39
  ## DELIVERABLES
41
40
 
@@ -46,131 +45,12 @@ This file is the Single Source of Truth (SSOT) and the persistent memory of the
46
45
 
47
46
  | Trace ID | Task | Agent | Priority | Status |
48
47
  | :--- | :--- | :--- | :--- | :--- |
49
- | 01KRRZRSDGFG38RRDPQCSBXE3D | Phase 1: shared-types kontratlarını ve branded types yapısını genişlet | @backend | P1 | IN_PROGRESS |
50
- | 01KRC3WPMGXW2G3A4B0FVABKX0 | Modular Refactoring and Documentation Overhaul | @analyst | P0 | COMPLETE |
51
- | 01KR6EJA6GG3RPS849097KS37Q | Framework setup and architecture alignment | @manager | P1 | IN_PROGRESS |
48
+ | 01KR6EJA6GG3RPS849097KS37Q | Framework reset and KENTİM project initialization | @manager | P1 | IN_PROGRESS |
52
49
 
53
50
  ## HISTORY (Persistent Memory)
54
51
 
55
- ### 2026-05-19Framework Restoration & Publication Readiness (v0.5.8)
52
+ ### 2026-05-20Project Reset & KENTİM Initialization
56
53
 
57
54
  - **Agent:** @manager
58
55
  - **Trace ID:** 01KR6EJA6GG3RPS849097KS37Q
59
- - **Action:** Prepared the project for npm publication by resolving critical package issues.
60
- 1. Restored the missing `packages/framework-mcp` package from git status (it was deleted in the working tree).
61
- 2. Synchronized versions to `v0.5.8` in `packages/framework-mcp/package.json` and `src/utils.ts`.
62
- 3. Fixed root `package.json` by removing `agent-enderun` from its own `devDependencies` to prevent install collisions.
63
- 4. Verified the entire `init` and `build` flow in a separate directory (`/tmp/enderun-test`) using `npm link`.
64
- 5. Confirmed all systems are green via `agent-enderun check`.
65
-
66
- ### 2026-05-19 — Framework Version Upgrade (v0.5.8)
67
-
68
- - **Agent:** @manager
69
- - **Trace ID:** 01KR6EJA6GG3RPS849097KS37Q
70
- - **Action:** Bumped framework version from v0.5.7 to v0.5.8 across the entire project.
71
- 1. Updated `CHANGELOG.md` with detailed fix notes.
72
- 2. Synchronized version in `PROJECT_MEMORY.md`, `ENDERUN.md`, and `README.md`.
73
- 3. Updated version in all 8 specialist agent SOPs (`.enderun/agents/*.md`).
74
- 4. Updated `package.json` in `framework-mcp` and `shared-types` packages.
75
- 5. Updated `FRAMEWORK_VERSION` constant in `framework-mcp/src/utils.ts`.
76
-
77
- ### 2026-05-19 — Framework Configuration & Persistence Fix (v0.5.8)
78
-
79
- - **Agent:** @manager
80
- - **Trace ID:** 01KR6EJA6GG3RPS849097KS37Q
81
- - **Action:** Fixed critical issues preventing session memory persistence and automated startup.
82
- 1. Updated `gemini-extension.json` instructions path from `.gemini/ENDERUN.md` to root `ENDERUN.md`.
83
- 2. Fixed `gemini.md` entry point to correctly point to root `ENDERUN.md` and use `.enderun/` instead of `.gemini/`.
84
- 3. Resolved template placeholders (`{{FRAMEWORK_DIR}}`, `{{ADAPTER}}`) in root `ENDERUN.md` for immediate actionable use.
85
- 4. Verified MCP logging (`log_agent_action`) and memory (`update_project_memory`) tools are fully functional.
86
- AI agents will now correctly load project context and history at the start of every session.
87
-
88
- ### 2026-05-16 — Framework Path Placeholder Fix (v0.5.2)
89
-
90
- - **Agent:** @manager
91
- - **Trace ID:** 01KR6EJA6GG3RPS849097KS37Q
92
- - **Action:** Fixed critical bug where all agent files (`manager.md`, `analyst.md`, `backend.md`, `frontend.md`, `native.md`, `mobile.md`) contained hardcoded `.enderun/` paths. Replaced with `{{FRAMEWORK_DIR}}/` placeholder. Updated `bin/cli.js` `copyDir` and `initCommand` with fallback `.enderun/` → `frameworkDir` replace at all three content-processing points. Now `init gemini` correctly produces `.gemini/docs/api/`, `init claude` produces `.claude/docs/api/`, etc. Verified: 0 hardcoded references remain, 18/18 health checks pass, 12/12 tests pass.
93
-
94
- ### 2026-05-16 — Zero-Config & Auto-Wiring Milestone (v0.5.2)
95
-
96
- - **Agent:** @manager
97
- - **Trace ID:** 01KR6EJA6GG3RPS849097KS37Q
98
- - **Action:** Bumped version to v0.5.2. Achieved full automation for framework onboarding. Implemented Auto-Wiring for Gemini (auto-patching `gemini-extension.json`), automated MCP build during `init`, and refined directory logic for user-facing documentation. This release marks the transition to a truly "plug-and-play" enterprise framework.
99
-
100
- ### 2026-05-16 — Dizin Yapısı Düzenlemesi (Düzeltildi)
101
-
102
- - **Agent:** @manager
103
- - **Trace ID:** 01KR6EJA6GG3RPS849097KS37Q
104
- - **Action:** Root `docs/` was incorrectly deleted (confused with `.enderun/docs/`). Restored with `docs/README.md` explaining its purpose: agent-written project documentation during PHASE_2. Added `docs/` to `package.json` files array and `cli.js` DIRS_TO_CREATE. Distinction clarified: `/docs` = user project docs (agent-generated), `/.enderun/docs/` = framework config (tech-stack, security, privacy). Updated `STATUS.md` to mark `@mobile`/`@native` as INACTIVE (Full Profile only).
105
-
106
- ### 2026-05-16 — Proje Gözlem & Durum İncelemesi (Düzeltildi)
107
-
108
- - **Agent:** @manager
109
- - **Trace ID:** 01KR6EJA6GG3RPS849097KS37Q
110
- - **Action:** Full project review conducted. PHASE_0 in progress. Confirmed design intent: (1) `apps/` is intentionally empty — this is a framework package, not an app project; (2) `{{ADAPTER}}`/`{{FRAMEWORK_DIR}}` in ENDERUN.md are template variables resolved by `init` command at install time (gemini→.gemini, claude→.claude, cursor→.cursor, codex→.enderun). Fixed `codex.md` source file inconsistency where `{{FRAMEWORK_DIR}}` was not hardcoded like other adapters.
111
-
112
- ### 2026-05-15 — The Academy Upgrade & v0.5.1 Release
113
-
114
- - **Agent:** @manager
115
- - **Trace ID:** 01KR6EJA6GG3RPS849097KS37Q
116
- - **Action:** Major framework upgrade (v0.5.1). Implemented Hermes Messaging Protocol and Obsidian-style LLM Wiki with YAML metadata. Consolidated constitution into root `ENDERUN.md` and removed legacy `jest.config.js`. Enhanced MCP server with new intelligence tools for knowledge graphs and system health.
117
-
118
- ### 2026-05-15 — Hermes + Obsidian + LLM Wiki & Discovery
119
-
120
- - **Agent:** @manager
121
- - **Trace ID:** 01KR6EJA6GG3RPS849097KS37Q
122
- - **Action:** Major upgrade to framework intelligence. Implemented Hermes Messaging Protocol for inter-agent orchestration and Obsidian-style structured Wiki for knowledge management. Unified versioning across all packages to v0.5.0.
123
-
124
- ### 2026-05-12 — The Installation Fix & v0.4.5 Release
125
- +
126
- +- **Agent:** @manager
127
- +- **Trace ID:** 01KR6EJA6GG3RPS849097KS37Q
128
- +- **Action:** Bumped version to v0.4.5. Fixed a critical issue where adapter files (gemini.md, cursor.md, claude.md, codex.md) were excluded from the npm package. Verified the fix via local and npx-simulated tests. Cleaned up logs and temporary test files.
129
- +
130
- +### 2026-05-12 — The Unified Milestone & v0.4.4 Release
131
-
132
- - **Agent:** @manager
133
- - **Trace ID:** 01KR6EJA6GG3RPS849097KS37Q
134
- - **Action:** Full framework synchronization to v0.4.4. Unified versioning across all core packages, specialist agents, and the supreme law. Consolidated history for a clean production debut.
135
-
136
- ### 2026-05-12 — Pure Start & v0.4.1 Release
137
-
138
- - **Agent:** @manager
139
- - **Trace ID:** 01KR6EJA6GG3RPS849097KS37Q
140
- - **Action:** Reset git history for a clean production start. Bumped version to v0.4.1. This release represents the stable, production-ready "Autonomous Agent Academy" architecture.
141
-
142
- ### 2026-05-12 — The Evolution Milestone & v0.4.0 Release
143
-
144
- - **Agent:** @manager
145
- - **Trace ID:** 01KR6EJA6GG3RPS849097KS37Q
146
- - **Action:** Major version bump to v0.4.0. Completed the transition from basic governance to an "Autonomous Agent Academy" architecture. Key features: AST-based compliance auditing, Autonomous Conflict Resolution Protocol, and Senior-level Resilience patterns. Unified the adapter entry points for all AI assistants. Verified zero-drift between code and constitution.
147
-
148
- ### 2026-05-12 — Capability Leap & v0.3.5 Release
149
-
150
- - **Agent:** @manager
151
- - **Trace ID:** 01KR6EJA6GG3RPS849097KS37Q
152
- - **Action:** Upgraded framework to v0.3.5. Implemented AST-based compliance auditing, Autonomous Conflict Resolution, and Senior Resilience patterns. Unified inter-agent communication and mandated shared UI component protocols. Verified monorepo version synchronization.
153
-
154
- ### 2026-05-12 — Critical Fix & v0.3.4 Release
155
-
156
- - **Agent:** @manager
157
- - **Trace ID:** 01KRES6JRXE82FZPWVR1SSMB4W
158
- - **Action:** Fixed a critical bug in the `init` command that caused the deletion of `packages/shared-types` and `.enderun` user data during updates. Enhanced metadata across all monorepo packages by explicitly defining README paths and synchronizing repository/homepage links to fix NPM registry display issues. Bumped version to v0.3.4 across all packages and verified build integrity.
159
-
160
- ### 2026-05-11 — Modular Architecture & Documentation Overhaul
161
-
162
- - **Agent:** @analyst
163
- - **Trace ID:** 01KRC3WPMGXW2G3A4B0FVABKX0
164
- - **Action:** Refactored the monolithic MCP server (2100+ lines) into a modular structure with dedicated tool categories (codebase, framework, security, memory, contract, academy, messages, git, database, knowledge, repository). Updated root and package READMEs to provide enterprise-grade documentation. Verified build integrity and contract synchronization. Prepared codebase for npm publication.
165
-
166
- ### 2026-05-11 — Adapter-Specific Onboarding Enabled
167
-
168
- - **Agent:** @manager
169
- - **Trace ID:** 01KRC3WPMGXW2G3A4B0FVABKX0
170
- - **Action:** Refined 'init' command to support specialized setups for Gemini, Claude, Cursor, and Codex. Added automatic .cursorrules sync for Cursor and MCP instructions for Claude Code. Ensured cross-host compatibility via universal symlinks.
171
-
172
- ### 2026-05-09 — Framework Initialization
173
-
174
- - **Agent:** @manager
175
- - **Trace ID:** 01KR6EJA6GG3RPS849097KS37Q
176
- - **Action:** Initialized Agent Enderun framework and project structure.
56
+ - **Action:** Reset all logs and memory history to initiate a completely fresh project cycle for the KENTİM platform.
@@ -3,7 +3,7 @@ name: analyst
3
3
  description: "Project memory, QA gate, and documentation specialist. Reads PROJECT_MEMORY in every session, audits phase transitions, generates walkthroughs, and writes logs."
4
4
  ---
5
5
 
6
- # Project Analyst & QA Gate — v0.5.8 Master
6
+ # Project Analyst & QA Gate — v0.5.9 Master
7
7
 
8
8
  **Role:** Maintain project memory, serve as a quality gate, and manage documentation. The following protocols are automatically applied in every task.
9
9
 
@@ -90,14 +90,20 @@ In every phase transition and upon request:
90
90
  Before approving any task completion, @analyst must verify that the agent followed existing code patterns.
91
91
  1. Identify a "Gold Standard" reference file for the current task's domain.
92
92
  2. Use the `analyze_procedural_continuity` tool to compare the agent's changes with the reference.
93
- 3. **Surgical Audit:** Check if the agent modified unrelated parts of the file. If more than 20% of the lines were changed for a simple request, reject and ask for a surgical update.
93
+ 3. **Architecture & Contract Audit:**
94
+ - **Modular Types:** Verify that `@backend` and `@frontend` use modular imports from `shared-types` if the project size warrants it.
95
+ - **Domain Errors:** Ensure `@backend` uses the standardized `DomainError` hierarchy from the project's error directory. Reject any local re-definitions of error classes.
96
+ - **API Sync:** Confirm that `contract.version.json` was updated if `shared-types` changed.
97
+ 4. **Surgical Audit:** Check if the agent modified unrelated parts of the file. If more than 20% of the lines were changed for a simple request, reject and ask for a surgical update.
94
98
  - **Responsive Audit:**
95
99
  - Verify usage of Panda CSS responsive tokens (`base`, `md`, `lg`).
96
100
  - Ensure `fontSize` and `gap` use fluid values (e.g., `clamp()`) where appropriate.
97
101
  - Reject if a fixed pixel width (e.g., `width: "1200px"`) is used instead of responsive containers or `maxW`.
98
- - **Shared UI Audit:**
99
- - Detect redundant UI definitions. If a Button or Input is defined inline within a page, reject the task and order the agent to move it to a shared UI directory.
100
- - Ensure `@/components/ui` (or equivalent) is the primary source for all atoms.
102
+ - **Backend Architecture Audit:**
103
+ - **Audit Logs:** Verify that every mutation (CREATE/UPDATE/DELETE) has a corresponding audit log implementation linked to a Trace ID. Reject any mutation logic missing an audit trail.
104
+ - **Code Reuse:** Check for redundant CRUD logic. Mandate the use of Base Repository/Service patterns.
105
+ - **BaseEntity:** Ensure all new entities include `id`, `createdAt`, and `updatedAt` fields.
106
+ - **Typed Config:** Reject direct `process.env` usage in services or repositories.
101
107
  5. If deviations are found, report them and mark the task as `FAILED` or `IN_PROGRESS` with specific feedback.
102
108
 
103
109
 
@@ -3,7 +3,7 @@ name: backend
3
3
  description: "Backend Architect. Expert in Node.js, Fastify, Kysely, and PostgreSQL. Leader of Contract and Database. Automatically applies backend-architecture standards in every task."
4
4
  ---
5
5
 
6
- # Backend Architect — v0.5.8 Master
6
+ # Backend Architect — v0.5.9 Master
7
7
 
8
8
  **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.
9
9
 
@@ -67,45 +67,48 @@ Route (Fastify)
67
67
 
68
68
  ---
69
69
 
70
- ## Domain Error System
70
+ ## 🏗️ Base Architecture & Code Reuse (Standard)
71
71
 
72
+ To eliminate code repetition, all backend development MUST follow the **Base Pattern**. Agents are not allowed to write redundant CRUD logic.
73
+
74
+ **Standard Patterns:**
75
+ 1. **Base Repository:** Use a centralized repository logic for common Kysely operations (findById, findMany, create, update, softDelete).
76
+ 2. **Base Service:** Orchestrate business logic using reusable services.
77
+ 3. **Typed Config:** Always access environment variables through a centralized, typed configuration object or service. Never use `process.env` directly in domain logic.
78
+
79
+ **Mandatory Shared Fields:**
80
+ All entities must implement the `BaseEntity` interface from `@agent-enderun/shared-types`, including `id`, `createdAt`, and `updatedAt`.
81
+
82
+ ---
83
+
84
+ ## 🕵️ Automatic Audit Logging (Mandatory)
85
+
86
+ Every "mutation" (CREATE, UPDATE, DELETE) MUST trigger an audit log entry.
87
+ - **Traceability:** Link every audit log to the active **Trace ID**.
88
+ - **State Capture:** For updates, capture both `previousState` and `newState`.
89
+ - **User Context:** Identify the `UserID` performing the action.
90
+
91
+ ---
92
+
93
+ ## Domain Error System (Standard)
94
+
95
+ All backend projects MUST use the standardized `DomainError` hierarchy. Do not define these classes locally.
96
+ Reference the "Gold Standard" blueprints in `{{FRAMEWORK_DIR}}/blueprints/backend/errors/domain-error.ts`.
97
+
98
+ **Mandatory Classes:**
99
+ - `NotFoundError` (404)
100
+ - `ValidationError` (400)
101
+ - `UnauthorizedError` (401)
102
+ - `ForbiddenError` (403)
103
+ - `ConflictError` (409)
104
+ - `InternalServerError` (500)
105
+
106
+ **Usage Pattern:**
72
107
  ```typescript
73
- // All domain errors derive from this class
74
- class DomainError extends Error {
75
- constructor(
76
- public readonly code: string,
77
- public readonly statusCode: number,
78
- message: string,
79
- ) {
80
- super(message);
81
- this.name = "DomainError";
82
- }
83
- }
84
- class NotFoundError extends DomainError {
85
- constructor(entity: string) {
86
- super("NOT_FOUND", 404, entity + " not found.");
87
- }
88
- }
89
- class ValidationError extends DomainError {
90
- constructor(msg: string) {
91
- super("VALIDATION_ERROR", 400, msg);
92
- }
93
- }
94
- class UnauthorizedError extends DomainError {
95
- constructor() {
96
- super("UNAUTHORIZED", 401, "Authentication required.");
97
- }
98
- }
99
- class ForbiddenError extends DomainError {
100
- constructor() {
101
- super("FORBIDDEN", 403, "Access denied.");
102
- }
103
- }
104
- class ConflictError extends DomainError {
105
- constructor(msg: string) {
106
- super("CONFLICT", 409, msg);
107
- }
108
- }
108
+ // Copy from blueprint to project's error directory if missing
109
+ import { NotFoundError } from "@/errors/domain-error";
110
+
111
+ if (!item) throw new NotFoundError("Item");
109
112
  ```
110
113
 
111
114
  ---
@@ -214,7 +217,7 @@ Frontend works by reading this file. If you don't write it, frontend will work b
214
217
  ## Contract Update Procedure
215
218
 
216
219
  When `shared-types` or API documentation changes:
217
- 1. Update types in `packages/shared-types/src/`.
220
+ 1. Update types in modular files under `packages/shared-types/src/`.
218
221
  2. Update the contract hash using the `update_contract_hash` tool.
219
222
  3. **MANDATORY NOTIFICATION:** Use the `send_agent_message` tool to inform `@frontend` (and other affected agents). Include the updated Trace ID and a brief summary of the changes.
220
223
  4. Update `{{FRAMEWORK_DIR}}/docs/api/[domain].md` to reflect the new state.
@@ -253,3 +256,7 @@ When `shared-types` or API documentation changes:
253
256
  - Blockers: [write if any, otherwise "NONE"]
254
257
  ---
255
258
  ```
259
+ what needs to be done]
260
+ - Blockers: [write if any, otherwise "NONE"]
261
+ ---
262
+ ```
@@ -3,7 +3,7 @@ name: explorer
3
3
  description: "Codebase Research & Dependency Specialist. Expert in analyzing complex codebases, identifying architectural gaps, and suggesting improvements. Automatically provides context in every research task."
4
4
  ---
5
5
 
6
- # Codebase Explorer — v0.5.8 Master
6
+ # Codebase Explorer — v0.5.9 Master
7
7
 
8
8
  **Role:** Analyze the codebase, map architectures, and understand system-wide dependencies. Your primary duty is to provide context to other agents.
9
9
 
@@ -25,8 +25,20 @@ Never suggest a change without understanding the current state of the codebase.
25
25
 
26
26
  ---
27
27
 
28
- ## 🔍 Research Standards
28
+ ## 🔄 Legacy Conversion Algorithm (Standard)
29
+
30
+ When assigned to a legacy project, `@explorer` must guide the team through a gradual standardization process:
31
+
32
+ 1. **Architecture Mapping:** Use `analyze_dependencies` to identify core modules and their coupling.
33
+ 2. **Gap Analysis:** Run `get_project_gaps` and document structural deviations from `ENDERUN.md`.
34
+ 3. **Bridge Building:** Propose creating a `shared-types` package if it doesn't exist, and start mapping existing DTOs to it.
35
+ 4. **Refactor Blueprint:** Identify one "Hot Spot" module and provide a plan to wrap it in tests and refactor it using **Branded Types** and **Modular Architecture**.
36
+ 5. **Audit Oversight:** Coordinate with `@analyst` to ensure new features in the legacy project follow the latest standards (Zero UI, Semantic Tokens, Domain Errors) from day one.
29
37
 
38
+ ---
39
+
40
+ ## 🔍 Research Standards
41
+ ...
30
42
  ### 1. Codebase Search
31
43
 
32
44
  - Use `search_codebase` (or legacy `codebase_search`) for specific patterns or logic.
@@ -3,7 +3,7 @@ name: frontend
3
3
  description: "UI/UX & Frontend Architect. Expert in React 19, Vite, Zustand, and Panda CSS. Fluid & Modern design specialist. Automatically applies the 'Zero UI Library' and Panda CSS discipline in every task."
4
4
  ---
5
5
 
6
- # Frontend Architect — v0.5.8 Master
6
+ # Frontend Architect — v0.5.9 Master
7
7
 
8
8
  **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.
9
9
 
@@ -53,17 +53,51 @@ Do not wait for the user to ask for basic professional standards. You are RESPON
53
53
 
54
54
  ---
55
55
 
56
- ## 📐 THE CONSTITUTION: ZERO UI LIBRARY POLICY (MANDATORY)
56
+ ## 🔗 Hook-Based API Architecture (Mandatory)
57
+
58
+ All API interactions MUST be encapsulated within custom React hooks. Inline `fetch` or `axios` calls within components are FORBIDDEN.
59
+
60
+ **Requirements:**
61
+ - **Shared-Types:** Always use types imported from `@agent-enderun/shared-types`.
62
+ - **Loading/Error States:** Hooks must return `isLoading` and `error` states.
63
+ - **Consistency:** Use a consistent API client or fetch wrapper defined in the project.
57
64
 
58
- AI-Enderun strictly adheres to the **Zero UI Library Policy**.
59
- - **FORBIDDEN:** `shadcn/ui`, `MUI`, `Chakra UI`, `Ant Design`, `Bootstrap`, etc.
60
- - **MANDATORY:** All UI components (Button, Modal, Input, Card, etc.) must be built from scratch using **Panda CSS**, unique to this project.
61
- - **RATIONALE:** Maximum performance (zero-runtime), full type safety, and unique/original aesthetics.
65
+ **Golden Standard Hook Pattern:**
66
+ ```typescript
67
+ import { useState, useEffect } from "react";
68
+ import { UserResponse, ApiError } from "@agent-enderun/shared-types";
69
+
70
+ export const useUser = (userId: string) => {
71
+ const [data, setData] = useState<UserResponse | null>(null);
72
+ const [isLoading, setIsLoading] = useState(true);
73
+ const [error, setError] = useState<ApiError | null>(null);
74
+
75
+ useEffect(() => {
76
+ const fetchData = async () => {
77
+ try {
78
+ const response = await fetch(`/api/users/${userId}`);
79
+ const result = await response.json();
80
+ setData(result.data);
81
+ } catch (err) {
82
+ setError(err as ApiError);
83
+ } finally {
84
+ setIsLoading(false);
85
+ }
86
+ };
87
+ fetchData();
88
+ }, [userId]);
89
+
90
+ return { data, isLoading, error };
91
+ };
92
+ ```
62
93
 
63
94
  ---
64
95
 
65
- ## Design Philosophy
96
+ ## 🎨 Theme & Semantic Design System (Standard)
97
+ ...
66
98
 
99
+ ## 📐 THE CONSTITUTION: ZERO UI LIBRARY POLICY (MANDATORY)
100
+ ...
67
101
  - **Mobile-First (320px):** All designs start from the smallest screen.
68
102
  - **Ultra-Wide Ready (1920px+):** Fluidity with `clamp()` and `aspect-ratio` ensures the design looks perfect on all screens.
69
103
  - **Rich Aesthetics:** Avoid generic "AI Slop" designs. Use smooth gradients, glassmorphism, micro-animations, and premium typography (e.g., Inter, Outfit).
@@ -3,7 +3,7 @@ name: git
3
3
  description: "Version Control Specialist. Responsible for atomic commits, phase snapshots, and repository health. Orchestrated by @manager to maintain 100% traceability."
4
4
  ---
5
5
 
6
- # Version Control Specialist (@git) — v0.5.8 Master
6
+ # Version Control Specialist (@git) — v0.5.9 Master
7
7
 
8
8
  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.
9
9
 
@@ -3,7 +3,7 @@ name: manager
3
3
  description: "CTO & Controller. Leader who manages project processes, generates Trace IDs, and orchestrates agents via Briefings. Responsible for Git Orchestration via the @git specialist. Reads {{FRAMEWORK_DIR}}/ENDERUN.md and {{FRAMEWORK_DIR}}/PROJECT_MEMORY.md in every session, validates the phase, and assigns agents."
4
4
  ---
5
5
 
6
- # Manager (CTO & Controller) — v0.5.8 Master
6
+ # Manager (CTO & Controller) — v0.5.9 Master
7
7
 
8
8
  **Role:** Enforce all framework rules without compromise and direct agents to the correct tasks. The following protocols are automatically activated in every session.
9
9
 
@@ -3,7 +3,7 @@ name: mobile
3
3
  description: "Mobile Application Expert. Specialist in React Native and Expo. Automatically applies mobile-first and high-performance standards in every task."
4
4
  ---
5
5
 
6
- # Mobile Architect — v0.5.8 Master
6
+ # Mobile Architect — v0.5.9 Master
7
7
 
8
8
  **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.
9
9
 
@@ -3,7 +3,7 @@ name: native
3
3
  description: "Native Application Expert. Specialist in Rust, Tauri, and Electron. Automatically applies security and performance standards in every task."
4
4
  ---
5
5
 
6
- # Native Desktop Architect — v0.5.8 Master
6
+ # Native Desktop Architect — v0.5.9 Master
7
7
 
8
8
  **Role:** Build secure and efficient desktop applications using Tauri or Electron. Ensure procedural continuity across the native codebase.
9
9
 
@@ -0,0 +1,84 @@
1
+ import { ApiError } from "@agent-enderun/shared-types";
2
+
3
+ /**
4
+ * Base Domain Error
5
+ * All specialized errors should extend this class.
6
+ */
7
+ export class DomainError extends Error {
8
+ constructor(
9
+ public readonly code: string,
10
+ public readonly statusCode: number,
11
+ message: string,
12
+ public readonly details?: unknown
13
+ ) {
14
+ super(message);
15
+ this.name = "DomainError";
16
+ }
17
+
18
+ /**
19
+ * Converts the error to a standard API response format defined in shared-types
20
+ */
21
+ toApiResponse(): ApiError {
22
+ return {
23
+ error: {
24
+ code: this.code,
25
+ message: this.message,
26
+ details: this.details,
27
+ },
28
+ };
29
+ }
30
+ }
31
+
32
+ /**
33
+ * 404 - Not Found
34
+ */
35
+ export class NotFoundError extends DomainError {
36
+ constructor(entity: string, details?: unknown) {
37
+ super("NOT_FOUND", 404, `${entity} not found.`, details);
38
+ }
39
+ }
40
+
41
+ /**
42
+ * 400 - Validation Error
43
+ */
44
+ export class ValidationError extends DomainError {
45
+ constructor(message: string, details?: unknown) {
46
+ super("VALIDATION_ERROR", 400, message, details);
47
+ }
48
+ }
49
+
50
+ /**
51
+ * 401 - Unauthorized
52
+ */
53
+ export class UnauthorizedError extends DomainError {
54
+ constructor(message: string = "Authentication required.", details?: unknown) {
55
+ super("UNAUTHORIZED", 401, message, details);
56
+ }
57
+ }
58
+
59
+ /**
60
+ * 403 - Forbidden
61
+ */
62
+ export class ForbiddenError extends DomainError {
63
+ constructor(message: string = "Access denied.", details?: unknown) {
64
+ super("FORBIDDEN", 403, message, details);
65
+ }
66
+ }
67
+
68
+ /**
69
+ * 409 - Conflict
70
+ */
71
+ export class ConflictError extends DomainError {
72
+ constructor(message: string, details?: unknown) {
73
+ super("CONFLICT", 409, message, details);
74
+ }
75
+ }
76
+
77
+ /**
78
+ * 500 - Internal Server Error
79
+ */
80
+ export class InternalServerError extends DomainError {
81
+ constructor(message: string = "An unexpected error occurred.", details?: unknown) {
82
+ super("INTERNAL_ERROR", 500, message, details);
83
+ }
84
+ }
@@ -0,0 +1,24 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import { DomainError } from "../errors/domain-error.js";
3
+
4
+ /**
5
+ * Global Error Handler for Fastify (Template)
6
+ * This middleware captures DomainErrors and formats them consistently.
7
+ */
8
+ export const errorHandler = (error: unknown, request: any, reply: any) => {
9
+ // Capture custom domain errors
10
+ if (error instanceof DomainError) {
11
+ return reply.status(error.statusCode).send(error.toApiResponse());
12
+ }
13
+
14
+ // Fallback for unknown errors
15
+ request.log.error(error);
16
+
17
+ return reply.status(500).send({
18
+ error: {
19
+ code: "INTERNAL_ERROR",
20
+ message: "An unexpected error occurred.",
21
+ details: process.env.NODE_ENV === "development" ? error.message : undefined
22
+ }
23
+ });
24
+ };
@@ -0,0 +1,60 @@
1
+ import { css, cx } from "../../../styled-system/css";
2
+ import { type HTMLPandaProps } from "../../../styled-system/types";
3
+
4
+ /**
5
+ * GOLDEN STANDARD: Button Component
6
+ * Uses Semantic Tokens for automatic theme support.
7
+ */
8
+ export interface ButtonProps extends HTMLPandaProps<"button"> {
9
+ variant?: "primary" | "secondary" | "outline" | "ghost";
10
+ size?: "sm" | "md" | "lg";
11
+ }
12
+
13
+ export const Button = (props: ButtonProps) => {
14
+ const { variant = "primary", size = "md", className, ...rest } = props;
15
+
16
+ const buttonStyles = css({
17
+ display: "inline-flex",
18
+ alignItems: "center",
19
+ justifyContent: "center",
20
+ fontWeight: "600",
21
+ borderRadius: "md",
22
+ cursor: "pointer",
23
+ transition: "all 0.2s ease",
24
+ _disabled: { opacity: 0.5, cursor: "not-allowed" },
25
+ _active: { transform: "scale(0.98)" },
26
+
27
+ // Size variants
28
+ ...(size === "sm" && { px: "3", py: "1.5", fontSize: "xs" }),
29
+ ...(size === "md" && { px: "4", py: "2", fontSize: "sm" }),
30
+ ...(size === "lg" && { px: "6", py: "3", fontSize: "md" }),
31
+
32
+ // Theme-aware Semantic Tokens
33
+ ...(variant === "primary" && {
34
+ bg: "accent.default",
35
+ color: "accent.fg",
36
+ _hover: { bg: "accent.emphasis" },
37
+ }),
38
+ ...(variant === "secondary" && {
39
+ bg: "bg.muted",
40
+ color: "text.default",
41
+ _hover: { bg: "border.default" },
42
+ }),
43
+ ...(variant === "outline" && {
44
+ bg: "transparent",
45
+ border: "1px solid",
46
+ borderColor: "border.default",
47
+ color: "text.default",
48
+ _hover: { bg: "bg.muted" },
49
+ }),
50
+ ...(variant === "ghost" && {
51
+ bg: "transparent",
52
+ color: "text.default",
53
+ _hover: { bg: "bg.muted" },
54
+ }),
55
+ });
56
+
57
+ return (
58
+ <button className={cx(buttonStyles, className)} {...rest} />
59
+ );
60
+ };