@tera-system/core 0.1.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/LICENSE.md +13 -0
- package/MANIFEST.json +24 -0
- package/README.md +67 -0
- package/RELEASES.md +28 -0
- package/WELCOME.md +35 -0
- package/agents/application-blueprint.md +407 -0
- package/agents/auditor.md +665 -0
- package/agents/design-reviewer.md +392 -0
- package/agents/domain-expert-agent.md +510 -0
- package/agents/domain-research-agent.md +360 -0
- package/agents/engineering-agent-dotnet.md +218 -0
- package/agents/engineering-agent-phaser.md +275 -0
- package/agents/engineering-agent-typescript.md +300 -0
- package/agents/engineering-agent.md +143 -0
- package/agents/monitor.md +395 -0
- package/agents/production-erp-expert.md +506 -0
- package/agents/project-knowledge-agent.md +271 -0
- package/agents/qa-agent.md +498 -0
- package/agents/tera-business-transformation-consultant.md +290 -0
- package/agents/tera-client-engagement.md +891 -0
- package/agents/tera-software-designer.md +237 -0
- package/agents/tera-strategic-advisor.md +325 -0
- package/agents/tera-system-evolution.md +759 -0
- package/agents/tera.md +520 -0
- package/agents/ui-designer.md +426 -0
- package/commands/tera-approve.md +34 -0
- package/commands/tera-diagnose.md +47 -0
- package/commands/tera-gate.md +40 -0
- package/commands/tera-help.md +41 -0
- package/commands/tera-new-project.md +35 -0
- package/commands/tera-plan.md +34 -0
- package/commands/tera-request-build.md +45 -0
- package/commands/tera-resume.md +34 -0
- package/commands/tera-review.md +52 -0
- package/commands/tera-status.md +38 -0
- package/commands/tera-update.md +48 -0
- package/core/project-control/templates/TASK_TEMPLATE.md +146 -0
- package/core/tera-system/AGENT_ACTIVATION_MATRIX.md +285 -0
- package/core/tera-system/AGENT_DEPENDENCY_MAP.md +117 -0
- package/core/tera-system/AGENT_GENERATION_TEMPLATE.md +312 -0
- package/core/tera-system/AGENT_PERMISSION_MODEL.md +343 -0
- package/core/tera-system/AIS_PROTOCOL.md +191 -0
- package/core/tera-system/TERA_AGENT_CONDUCT.md +102 -0
- package/core/tera-system/TERA_CONTINUOUS_IMPROVEMENT_POLICY.md +111 -0
- package/core/tera-system/TERA_DISTRIBUTION_POLICY.md +291 -0
- package/core/tera-system/TERA_PROJECT_DECISION.md +281 -0
- package/core/tera-system/TERA_USER_GUIDE.md +462 -0
- package/core/tera-system/TOOLING_AND_MCP_POLICY.md +285 -0
- package/core/tera-system/TeraApplicationQuestionBank.md +362 -0
- package/core/tera-system/TeraArchitectureMap.md +91 -0
- package/core/tera-system/TeraClientPolicy.md +366 -0
- package/core/tera-system/TeraHelperAgents.md +970 -0
- package/core/tera-system/TeraPolicyMap.md +131 -0
- package/core/tera-system/TeraPreExecutionGate.md +818 -0
- package/core/tera-system/TeraPreparationDocumentationGovernance.md +370 -0
- package/core/tera-system/TeraPricingPolicy.md +674 -0
- package/core/tera-system/TeraProjectIntakePolicy.md +164 -0
- package/core/tera-system/TeraScenarioStressTests.md +168 -0
- package/core/tera-system/TeraSubAgents.md +854 -0
- package/core/tera-system/TeraSystemMaintenanceChecklist.md +80 -0
- package/core/tera-system/TeraTokenPolicy.md +362 -0
- package/core/tera-system/Tera_Project_Preparation_Files.md +1045 -0
- package/core/tera-system/agent-helpers/application-blueprint-details.md +177 -0
- package/core/tera-system/client-helpers/tera-client-engagement-discovery-domains.md +99 -0
- package/core/tera-system/client-helpers/tera-client-engagement-gates.md +258 -0
- package/core/tera-system/client-helpers/tera-client-engagement-pricing.md +341 -0
- package/core/tera-system/client-helpers/tera-client-engagement-protocols.md +692 -0
- package/core/tera-system/consulting-helpers/BTCA_METHODOLOGY_FRAMEWORK.md +195 -0
- package/core/tera-system/consulting-helpers/BTCA_REPORT_TEMPLATES.md +266 -0
- package/core/tera-system/design-system/ACCESSIBILITY_RULES.md +31 -0
- package/core/tera-system/design-system/COMPONENT_LIBRARY_SCHEMA.md +46 -0
- package/core/tera-system/design-system/DESIGN_MD_INTEGRATION.md +59 -0
- package/core/tera-system/design-system/DESIGN_REVIEW_STANDARDS.md +241 -0
- package/core/tera-system/design-system/DESIGN_SOURCE_PROTOCOL.md +61 -0
- package/core/tera-system/design-system/DESIGN_SYSTEM_OVERVIEW.md +66 -0
- package/core/tera-system/design-system/DESIGN_TOKENS_SCHEMA.md +66 -0
- package/core/tera-system/design-system/EXTERNAL_REFERENCE_ANALYSIS.md +52 -0
- package/core/tera-system/design-system/FIGMA_INTEGRATION.md +138 -0
- package/core/tera-system/design-system/INTERNAL_KITS_INDEX.md +26 -0
- package/core/tera-system/design-system/LAYOUT_PATTERNS.md +52 -0
- package/core/tera-system/design-system/MOBILE_UI_UX_STANDARDS.md +342 -0
- package/core/tera-system/design-system/RTL_LTR_RULES.md +39 -0
- package/core/tera-system/design-system/UI_ACCEPTANCE_GATE.md +80 -0
- package/core/tera-system/design-system/kits/KIT_ADMIN_DASHBOARD.md +102 -0
- package/core/tera-system/engineering-governance/ENGINEERING_AGENT_RESPONSIBILITIES.md +210 -0
- package/core/tera-system/engineering-governance/ENGINEERING_BEST_PRACTICES.md +468 -0
- package/core/tera-system/engineering-governance/ENGINEERING_GOVERNANCE_GATE.md +131 -0
- package/core/tera-system/engineering-governance/ENGINEERING_REVIEW_CHECKLIST.md +129 -0
- package/core/tera-system/engineering-governance/QUALITY_GATE_THRESHOLDS.md +159 -0
- package/core/tera-system/engineering-helpers/engineering-agent-core.md +171 -0
- package/core/tera-system/knowledge-base/OPENHANDS_ARCHITECTURE_REFERENCE.md +243 -0
- package/core/tera-system/knowledge-base/manufacturing/00_INDEX.md +32 -0
- package/core/tera-system/knowledge-base/manufacturing/01_MANUFACTURING_ERP_CORE_CONCEPTS.md +7 -0
- package/core/tera-system/knowledge-base/manufacturing/02_SAP_MANUFACTURING_RESEARCH.md +7 -0
- package/core/tera-system/knowledge-base/manufacturing/03_DYNAMICS_365_MANUFACTURING_RESEARCH.md +7 -0
- package/core/tera-system/knowledge-base/manufacturing/04_ORACLE_MANUFACTURING_RESEARCH.md +7 -0
- package/core/tera-system/knowledge-base/manufacturing/05_ODOO_MANUFACTURING_RESEARCH.md +7 -0
- package/core/tera-system/knowledge-base/manufacturing/06_ERPNEXT_MANUFACTURING_RESEARCH.md +7 -0
- package/core/tera-system/knowledge-base/manufacturing/07_MANUFACTURING_COSTING_GUIDE.md +7 -0
- package/core/tera-system/knowledge-base/manufacturing/08_PRODUCTION_DISCOVERY_QUESTIONS.md +7 -0
- package/core/tera-system/knowledge-base/manufacturing/09_MANUFACTURING_BLUEPRINT_CHECKLIST.md +7 -0
- package/core/tera-system/knowledge-base/manufacturing/10_PRODUCTION_TEST_SCENARIOS.md +7 -0
- package/core/tera-system/knowledge-base/manufacturing/11_QUALITY_REWORK_AND_SCRAP_GUIDE.md +7 -0
- package/core/tera-system/knowledge-base/manufacturing/12_MRP_AND_PLANNING_GUIDE.md +7 -0
- package/core/tera-system/knowledge-base/manufacturing/13_LOCAL_AND_REGIONAL_MANUFACTURING_CONTEXT.md +7 -0
- package/core/tera-system/knowledge-base/manufacturing/14_VENDOR_COMPARISON_MATRIX.md +7 -0
- package/core/tera-system/product-standards/maintenance-apps/BEST_PRACTICES_DOMAIN.md +325 -0
- package/core/tera-system/product-standards/maintenance-apps/STANDARD_DEFINITION.md +142 -0
- package/core/tera-system/profiles/PROFILES_INDEX.md +57 -0
- package/core/tera-system/profiles/TEMPLATE.md +47 -0
- package/core/tera-system/profiles/dotnet-blazor-ef.md +76 -0
- package/core/tera-system/profiles/dotnet-razorpages-adonet.md +137 -0
- package/core/tera-system/profiles/dotnet-wpf-sqlite.md +159 -0
- package/core/tera-system/profiles/effect-bun-opencode.md +109 -0
- package/core/tera-system/profiles/flutter-mobile.md +369 -0
- package/core/tera-system/profiles/nextjs-prisma.md +110 -0
- package/core/tera-system/profiles/phaser-react-node.md +302 -0
- package/core/tera-system/profiles/react-pwa.md +97 -0
- package/core/tera-system/runtime/CLIENT_DISCOVERY_PROTOCOL.md +145 -0
- package/core/tera-system/runtime/DOMAIN_INTELLIGENCE_PROTOCOL.md +124 -0
- package/core/tera-system/runtime/MVP_DEFINITION_PROTOCOL.md +176 -0
- package/core/tera-system/runtime/TERA_RUNTIME_CHECKLISTS.md +646 -0
- package/core/tera-system/runtime/TERA_RUNTIME_PROTOCOLS.md +50 -0
- package/core/tera-system/runtime/TERA_RUNTIME_PROTOCOLS_CLIENT.md +355 -0
- package/core/tera-system/runtime/TERA_RUNTIME_PROTOCOLS_CORE.md +799 -0
- package/core/tera-system/runtime/TERA_RUNTIME_TEMPLATES.md +908 -0
- package/core/tera-system/runtime/TERA_RUNTIME_TEMPLATES_DELIVERY.md +584 -0
- package/core/tera-system/runtime/TERA_RUNTIME_TEMPLATES_PREPARATION.md +376 -0
- package/core/tera-system/runtime/TERA_SOLUTION_PREPARATION_PROTOCOL.md +335 -0
- package/core/tera-system/runtime/TERA_SOLUTION_PREPARATION_TEMPLATES.md +397 -0
- package/core/tera-system/runtime/VERSION_LIFECYCLE_PROTOCOL.md +296 -0
- package/core/tera-system/semgrep-rules/README.md +32 -0
- package/core/tera-system/semgrep-rules/tera-security.yml +66 -0
- package/core/tera-system/semgrep-rules/tera-standards.yml +49 -0
- package/core/tera-system/teranoo-ui/README.md +48 -0
- package/core/tera-system/teranoo-ui/components/button.tsx +51 -0
- package/core/tera-system/teranoo-ui/components/card.tsx +49 -0
- package/core/tera-system/teranoo-ui/components/dashboard-layout.tsx +36 -0
- package/core/tera-system/teranoo-ui/components/data-table.tsx +146 -0
- package/core/tera-system/teranoo-ui/components/empty-state.tsx +31 -0
- package/core/tera-system/teranoo-ui/components/kpi-card.tsx +42 -0
- package/core/tera-system/teranoo-ui/components/page-header.tsx +25 -0
- package/core/tera-system/teranoo-ui/components/search-input.tsx +40 -0
- package/core/tera-system/teranoo-ui/components/sidebar.tsx +66 -0
- package/core/tera-system/teranoo-ui/components/stats-card.tsx +37 -0
- package/core/tera-system/teranoo-ui/registry.json +77 -0
- package/core/tera-system/teranoo-ui/styles/teranoo-theme.css +61 -0
- package/opencode.tera.example.json +30 -0
- package/package.json +37 -0
- package/scripts/build.mjs +110 -0
- package/scripts/install.js +244 -0
- package/scripts/lib/license.mjs +90 -0
- package/scripts/lib/public-key.pem +3 -0
- package/scripts/tera-license.mjs +63 -0
- package/tools/tera-clean.ps1 +97 -0
- package/tools/tera-fetch.ps1 +165 -0
- package/tools/tera-release.ps1 +96 -0
- package/tools/tera-schedule.ps1 +59 -0
- package/tools/tera-update.ps1 +472 -0
- package/tools/tera-watch.ps1 +154 -0
- package/tools/update-client-repositories.ps1 +92 -0
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
# Technology Profile: phaser-react-node
|
|
2
|
+
|
|
3
|
+
> **Status:** ✅ **Approved** — معتمد من Majed (2026-07-29)
|
|
4
|
+
> **تاريخ:** 2026-07-29
|
|
5
|
+
> **المشروع المستهدف:** مشروع تجريبي سابق — لعبة Web 2D (أُزيل من clients/ 2026-08-15)
|
|
6
|
+
> **Source:** `clients/CLIENT-NAMAAGAMES/applications/APP-FARM-WEB/project-preparation/08_TECHNICAL_ARCHITECTURE.md`
|
|
7
|
+
> **ملاحظة (2026-08-15):** المشروع المصدر كان تجريبياً وأُزيل من `clients/` — المسار أعلاه إسناد تاريخي فقط، والمحتوى الأصلي محفوظ في Git history. البروفايل نفسه ساري المفعول كنمط تقني معتمد.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 1. Profile Identity
|
|
12
|
+
|
|
13
|
+
| البند | القيمة |
|
|
14
|
+
|-------|--------|
|
|
15
|
+
| Profile ID | `phaser-react-node` |
|
|
16
|
+
| Language | TypeScript (عبر المشروع كاملاً) |
|
|
17
|
+
| Game Engine | Phaser 4 (via `phaserjs/template-react-ts`) |
|
|
18
|
+
| UI Framework | React 18+ + TypeScript |
|
|
19
|
+
| State Management | Zustand + TanStack Query |
|
|
20
|
+
| Backend | Node.js + TypeScript (Express.js مُوصى به) |
|
|
21
|
+
| Database | PostgreSQL |
|
|
22
|
+
| ORM | Prisma (مُوصى به) / Drizzle |
|
|
23
|
+
| Validation | Zod (مشترك بين Client و Server) |
|
|
24
|
+
| Build Tool | Vite |
|
|
25
|
+
| Testing | Vitest |
|
|
26
|
+
| Auth | JWT (`jsonwebtoken` + `bcrypt`) |
|
|
27
|
+
| API Protocol | REST |
|
|
28
|
+
| Maps Editor | Tiled Map Editor (JSON → Phaser) |
|
|
29
|
+
| PWA | نعم (Vite PWA plugin) |
|
|
30
|
+
| Package Manager | npm |
|
|
31
|
+
| Code Quality | ESLint + Prettier |
|
|
32
|
+
| UI Component Library | shadcn/ui (لمكونات React) |
|
|
33
|
+
| Integration Pattern | `phaserjs/template-react-ts` (Same-DOM + DOM Overlays + EventBus) |
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 2. Applicability
|
|
38
|
+
|
|
39
|
+
Web Game projects باستخدام **Phaser 3** (Canvas 2D rendering) + **React UI Shell** (قوائم وقوالب فوق اللعبة) + **Node.js Backend** (REST API) + **PostgreSQL**.
|
|
40
|
+
|
|
41
|
+
**نمط اللعبة:** 2D Top-Down Pixel Art — ألعاب إدارة/محاكاة/زراعة.
|
|
42
|
+
|
|
43
|
+
**لا ينطبق على:**
|
|
44
|
+
- ألعاب 3D (Unity, Three.js, Unreal)
|
|
45
|
+
- ألعاب Isometric (زاوية مختلفة، تحتاج محرك مختلف)
|
|
46
|
+
- ألعاب MOBA/MMO (تحتاج WebSockets/Real-time)
|
|
47
|
+
- تطبيقات ويب بدون محرك ألعاب (استخدم `nextjs-prisma` أو `dotnet-blazor-ef`)
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 3. Default Execution Order
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
Phase 1A — Vertical Slice (2-3 months)
|
|
55
|
+
└─ 1. Scaffold: phaserjs/template-react-ts + إضافة المكتبات
|
|
56
|
+
└─ 2. Backend scaffold: Express + TypeScript + Prisma + PostgreSQL
|
|
57
|
+
└─ 3. Vertical Slice: محصول واحد (قمح) + حقل + متجر + حسابات + تجربة لعب أساسية
|
|
58
|
+
|
|
59
|
+
Phase 1B — MVP Batches
|
|
60
|
+
└─ Batch 1: 5 محاصيل + حقل + نظام نمو
|
|
61
|
+
└─ Batch 2: حيوانات (2) + حظائر
|
|
62
|
+
└─ Batch 3: مصانع (2) + وصفات
|
|
63
|
+
└─ Batch 4: مخزون (Zustand + TanStack Query) + طلبات
|
|
64
|
+
└─ Batch 5: مستويات (15-20) + XP
|
|
65
|
+
└─ Batch 6: Rules Engine + مهام (20-30 قالب)
|
|
66
|
+
└─ Batch 7: توسعة أرض (2-3)
|
|
67
|
+
└─ Batch 8: Admin Panel (CRUD كامل)
|
|
68
|
+
└─ Batch 9: إشعارات داخل اللعبة
|
|
69
|
+
└─ Batch 10: Server-Authoritative كامل + Rate Limiting
|
|
70
|
+
└─ Batch 11: اختبارات + إصلاحات + توثيق
|
|
71
|
+
|
|
72
|
+
Phase 2 (Post-Launch)
|
|
73
|
+
└─ دفع حقيقي، Social Login، أحداث موسمية
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 4. First Task Rule
|
|
79
|
+
|
|
80
|
+
**أول مهمة:** Vertical Slice Foundation — تهيئة المشروع بأكمله وتجربة زراعة محصول واحد كاملة.
|
|
81
|
+
|
|
82
|
+
النطاق:
|
|
83
|
+
1. استنساخ `phaserjs/template-react-ts` ← تسمية `farm-game`
|
|
84
|
+
2. إضافة: `zustand`, `@tanstack/react-query`, `zod`, `react-router-dom`, `lucide-react`
|
|
85
|
+
3. إنشاء Backend: `server/` مع Express + TypeScript + Prisma + PostgreSQL
|
|
86
|
+
4. Prisma schema: Crop, Player, Farm, LandPlot, Field, Inventory, Item, Session
|
|
87
|
+
5. بيانات أولية (Seed): محصول قمح (4 مراحل نمو، duration 60s للتطوير)
|
|
88
|
+
6. Phaser Scene أساسية: FarmScene مع TileMap مبسط + حقل واحد
|
|
89
|
+
7. عمليات: زراعة (POST /api/farm/plant) ← حصاد (POST /api/farm/harvest) ← تخزين
|
|
90
|
+
8. React UI: تسجيل/دخول + متجر (شراء بذور قمح) + مخزون (عرض القمح)
|
|
91
|
+
9. PWA: تفعيل عبر `vite-plugin-pwa`
|
|
92
|
+
10. اختبار: Vitest + API test (supertest)
|
|
93
|
+
|
|
94
|
+
**معيار النجاح:** اللاعب يستطيع تسجيل حساب ← شراء بذور ← زراعة ← انتظار ← حصاد ← رؤية القمح في المخزون.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 5. Scaffold Rules
|
|
99
|
+
|
|
100
|
+
### Phaser + React Client
|
|
101
|
+
```bash
|
|
102
|
+
git clone https://github.com/phaserjs/template-react-ts.git farm-game
|
|
103
|
+
cd farm-game
|
|
104
|
+
npm install
|
|
105
|
+
npm install zustand @tanstack/react-query react-router-dom zod lucide-react
|
|
106
|
+
npm install -D vite-plugin-pwa
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Backend Server
|
|
110
|
+
```bash
|
|
111
|
+
mkdir server && cd server
|
|
112
|
+
npm init -y
|
|
113
|
+
npm install express typescript @types/node @types/express
|
|
114
|
+
npm install prisma @prisma/client
|
|
115
|
+
npm install jsonwebtoken bcrypt zod express-rate-limit cors
|
|
116
|
+
npm install -D ts-node nodemon vitest supertest @types/jest
|
|
117
|
+
npx tsc --init
|
|
118
|
+
npx prisma init
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Shared Types
|
|
122
|
+
```bash
|
|
123
|
+
mkdir shared
|
|
124
|
+
# shared/types/ – API contracts, game types (مشتركة مع client عبر tsconfig paths)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Integration
|
|
128
|
+
```bash
|
|
129
|
+
# PhaserGame.tsx ← قالب من phaserjs/template-react-ts
|
|
130
|
+
# EventBus.ts ← Phaser.Events.EventEmitter (4 أسطر)
|
|
131
|
+
# استخدام "Same-DOM + DOM Overlays" — انظر 08_TECHNICAL_ARCHITECTURE §13
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**معامل الأمان:**
|
|
135
|
+
- لا تخزين JWT في localStorage (استخدم httpOnly cookie أو in-memory)
|
|
136
|
+
- Prisma DATABASE_URL في .env (ليس في الكود)
|
|
137
|
+
- CORS: تقييد بـ origin التطبيق فقط
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## 6. ORM / Database Rules
|
|
142
|
+
|
|
143
|
+
### Prisma Schema — الكيانات الأساسية
|
|
144
|
+
|
|
145
|
+
```prisma
|
|
146
|
+
// Game Data (Data-Driven)
|
|
147
|
+
model Crop {
|
|
148
|
+
id String @id @default(cuid())
|
|
149
|
+
name String
|
|
150
|
+
nameAr String
|
|
151
|
+
stages Int // 4-5 مراحل نمو
|
|
152
|
+
durationSec Int // وقت النمو بالثواني
|
|
153
|
+
seedCost Int // سعر البذور
|
|
154
|
+
sellPrice Int // سعر البيع
|
|
155
|
+
unlockLevel Int // مستوى الفتح
|
|
156
|
+
spriteKey String
|
|
157
|
+
isActive Boolean @default(true)
|
|
158
|
+
createdAt DateTime @default(now())
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
model Animal { /* name, nameAr, feedConsumed, productionDuration, productType, price, unlockLevel, spriteKey */ }
|
|
162
|
+
model Product { /* name, nameAr, type, sellPrice */ }
|
|
163
|
+
model Recipe { /* inputProducts (JSON), outputProductId, durationSec, factoryType */ }
|
|
164
|
+
model Order { /* productId, quantity, rewardCoins, rewardXp, unlockLevel, isActive */ }
|
|
165
|
+
model QuestTemplate { /* name, description, objectiveType, objectiveTarget, rewards (JSON), questType, unlockLevel, isDaily */ }
|
|
166
|
+
model Reward { /* type, value, quantity, probability */ }
|
|
167
|
+
|
|
168
|
+
// Player Data
|
|
169
|
+
model Player { /* id, email, passwordHash, createdAt, lastLoginAt */ }
|
|
170
|
+
model Farm { /* id, playerId, coins, xp, level */ }
|
|
171
|
+
model LandPlot { /* id, farmId, plotIndex, isUnlocked, unlockCost, unlockLevel, plotType */ }
|
|
172
|
+
model Field { /* id, landPlotId, currentCrop, plantedAt, harvestAt, isReady */ }
|
|
173
|
+
model Barn { /* id, landPlotId, animalType, lastFedAt, lastCollectedAt, animalCount */ }
|
|
174
|
+
model Factory { /* id, landPlotId, factoryType, currentRecipe, startedAt, completedAt */ }
|
|
175
|
+
model Inventory { /* id, farmId, capacity */ }
|
|
176
|
+
model Item { /* id, inventoryId, itemType, itemId, quantity */ }
|
|
177
|
+
model PlayerProgress { /* id, playerId, level, xp, unlockedContent (JSON) */ }
|
|
178
|
+
model PlayerQuest { /* id, playerId, questTemplateId, progress, isCompleted, isClaimed, expiresAt */ }
|
|
179
|
+
model Session { /* id, playerId, token, expiresAt */ }
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Migration Rules
|
|
183
|
+
- `npx prisma migrate dev --name <name>` ← للتطوير فقط
|
|
184
|
+
- `npx prisma migrate deploy` ← للإنتاج
|
|
185
|
+
- `npx prisma generate` ← بعد كل تغيير في schema
|
|
186
|
+
- لا تطبق migration على قاعدة بيانات إنتاج دون مراجعة
|
|
187
|
+
|
|
188
|
+
### Seed Data
|
|
189
|
+
```bash
|
|
190
|
+
npx prisma db seed
|
|
191
|
+
# prisma/seed.ts ← بيانات المحاصيل والحيوانات والمنتجات والوصفات والمهام
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## 7. CLI Side Effects
|
|
197
|
+
|
|
198
|
+
| الأمر | التأثير |
|
|
199
|
+
|-------|---------|
|
|
200
|
+
| `npx prisma migrate dev` | يعدّل قاعدة البيانات |
|
|
201
|
+
| `npx prisma generate` | يجدد Prisma Client |
|
|
202
|
+
| `npx prisma db seed` | يُدخل البيانات الأولية |
|
|
203
|
+
| `npm install <pkg>` | يضيف مكتبات |
|
|
204
|
+
| `npm run dev` | يشغل خوادم التطوير (Vite + Express) |
|
|
205
|
+
| `npx vitest run` | يشغل الاختبارات |
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## 8. Forbidden Defaults
|
|
210
|
+
|
|
211
|
+
| البند | السبب |
|
|
212
|
+
|:------|:------|
|
|
213
|
+
| ❌ **WebSockets / Socket.io** | تعقيد غير مبرر لـ v1. REST + TanStack Query polling كافٍ |
|
|
214
|
+
| ❌ **Redux Toolkit** | TanStack Query + Zustand يغطيان كل الحالات |
|
|
215
|
+
| ❌ **Physics Engine (Matter.js)** | Top-Down pixel art لا تحتاج فيزياء — يزيد حجم الحزمة |
|
|
216
|
+
| ❌ **Three.js / 3D** | خارج نطاق اللعبة 2D pixel art |
|
|
217
|
+
| ❌ **CSS Framework غير Tailwind** | Tailwind CSS v4 هو المعيار مع shadcn/ui |
|
|
218
|
+
| ❌ **Cron / Timer خارجي** | Time Lazy Evaluation (server_timestamp + duration) — لا Cron |
|
|
219
|
+
| ❌ **AI توليدي للمهام** | Rules Engine فقط — قرار العميل رقم 15 |
|
|
220
|
+
| ❌ **تخزين JWT مباشر** | httpOnly cookie أو in-memory — لا localStorage |
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## 9. Pre-Execution Gate Additions
|
|
225
|
+
|
|
226
|
+
بالإضافة إلى `TeraPreExecutionGate.md` العام، أضف:
|
|
227
|
+
|
|
228
|
+
- [ ] **Phaser config**: هل Phaser.Game config متوافقة مع حجم الشاشة المطلوب؟
|
|
229
|
+
- [ ] **Prisma schema**: هل schema متوافقة مع 06_DATA_MODEL_PREPARATION.md؟
|
|
230
|
+
- [ ] **Dev server**: هل Vite dev server & Express dev server يشتغلان معاً (proxy)؟
|
|
231
|
+
- [ ] **Seed data**: هل البيانات الأولية (محصول واحد على الأقل) جاهزة للاختبار؟
|
|
232
|
+
- [ ] **JWT secret**: هل هو متغير بيئي (وليس hardcoded)؟
|
|
233
|
+
- [ ] **Asset pipeline**: هل الأصول الفنية (CC0) موجودة في مسار `client/src/game/assets/`؟
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## 10. Acceptance Criteria Patterns
|
|
238
|
+
|
|
239
|
+
| النوع | معيار القبول |
|
|
240
|
+
|:------|:------------|
|
|
241
|
+
| **Phaser Scene** | ✅ تظهر بدون أخطاء Console، التفاعل (نقر/زراعة) يعمل |
|
|
242
|
+
| **Game Loop** | ✅ زراعة → انتظار → حصاد → تخزين → رؤية في المخزون |
|
|
243
|
+
| **REST API** | ✅ POST/GET مع JWT → 200, بدون JWT → 401, invalid → 400 |
|
|
244
|
+
| **React UI** | ✅ تعرض البيانات الصحيحة من API، Skeleton Loading، Toast, Empty States |
|
|
245
|
+
| **Server-Auth** | ✅ لا يمكن تزوير طلب (coins, items, time) |
|
|
246
|
+
| **PWA** | ✅ يمكن تثبيتها من المتصفح (manifest + service worker) |
|
|
247
|
+
| **Test** | ✅ `vitest run` يمر بدون فشل |
|
|
248
|
+
| **Rules Engine** | ✅ مهام مناسبة للمستوى، لا تكرار، جوائز من قائمة محددة |
|
|
249
|
+
| **Admin Panel** | ✅ CRUD لكل كيان Game Data، تعديل أسعار/أوقات |
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## 11. Technology Stack Diagram
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
┌─────────────────────────────────────────────────┐
|
|
257
|
+
│ CLIENT (Browser) │
|
|
258
|
+
│ ┌───────────────────┐ ┌──────────────────────┐ │
|
|
259
|
+
│ │ Phaser 3 Canvas │ │ React UI Shell │ │
|
|
260
|
+
│ │ (Game Loop, │ │ (Inventory, Shop, │ │
|
|
261
|
+
│ │ TileMap, Sprites)│ │ Quests, Admin) │ │
|
|
262
|
+
│ └─────────┬─────────┘ └──────────┬───────────┘ │
|
|
263
|
+
│ └──────────┬─────────────┘ │
|
|
264
|
+
│ Zustand + TanStack Query │
|
|
265
|
+
│ │ REST + JWT │
|
|
266
|
+
└───────────────────────┼──────────────────────────┘
|
|
267
|
+
│
|
|
268
|
+
┌───────────────────────┼──────────────────────────┐
|
|
269
|
+
│ ┌────────▼────────┐ │
|
|
270
|
+
│ │ Node.js + TS │ │
|
|
271
|
+
│ │ Express.js │ │
|
|
272
|
+
│ │ Server-Auth │ │
|
|
273
|
+
│ │ Rules Engine │ │
|
|
274
|
+
│ └────────┬────────┘ │
|
|
275
|
+
│ │ Prisma ORM │
|
|
276
|
+
│ ┌────────▼────────┐ │
|
|
277
|
+
│ │ PostgreSQL │ │
|
|
278
|
+
│ │ (Game + Player)│ │
|
|
279
|
+
│ └─────────────────┘ │
|
|
280
|
+
└──────────────────────────────────────────────────┘
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## 12. Agent Routing for this Profile
|
|
286
|
+
|
|
287
|
+
| Task Type | Agent |
|
|
288
|
+
|:----------|:------|
|
|
289
|
+
| Phaser 3 game scenes, entities, systems, sprites, tilemaps, physics | `engineering-agent-phaser` |
|
|
290
|
+
| React UI (functional: hooks, state, API, Zustand stores, TanStack Query) | `engineering-agent-typescript` |
|
|
291
|
+
| Backend API (Express routes, middleware, Prisma, JWT, validation) | `engineering-agent-typescript` |
|
|
292
|
+
| Shared types, Zod schemas, API contracts | `engineering-agent-typescript` |
|
|
293
|
+
| React↔Phaser integration bridge (EventBus, state sync) | `engineering-agent-typescript` |
|
|
294
|
+
| Visual UI design (Tailwind, shadcn/ui, RTL, responsive) | `ui-designer` |
|
|
295
|
+
| .NET / C# | `engineering-agent-dotnet` |
|
|
296
|
+
| General (fallback — no specialist matches) | `engineering-agent` |
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
> **Draft v1 — 2026-07-29**
|
|
301
|
+
> **الحالة:** 🟡 Draft — بانتظار اعتماد Majed
|
|
302
|
+
> **المصدر:** 08_TECHNICAL_ARCHITECTURE.md + PROFILES_INDEX.md + TEMPLATE.md
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Technology Profile: react-pwa
|
|
2
|
+
|
|
3
|
+
> **الحالة:** ✅ **Approved — Active** (PREP-D-002 مسودة → PREP-D-016 تفعيل 2026-08-01)
|
|
4
|
+
> **المشروع المرجعي:** مشروع تجريبي سابق (أُزيل من clients/ 2026-08-15) — PWA محلي عربي (RTL)
|
|
5
|
+
> **المرجع الحاكم للمحتوى التقني:** `project-preparation/08_TECHNICAL_ARCHITECTURE.md` (Module Baseline Approved)
|
|
6
|
+
|
|
7
|
+
## 1. Profile Identity
|
|
8
|
+
|
|
9
|
+
- Profile ID: `react-pwa`
|
|
10
|
+
- Language: TypeScript (strict)
|
|
11
|
+
- Framework: React 18 + Vite (SPA)
|
|
12
|
+
- Database: IndexedDB عبر مكتبة `idb`
|
|
13
|
+
- ORM: لا ORM — `idb` raw فوق IndexedDB (لا Dexie إلا عند ضرورة موثقة)
|
|
14
|
+
- Package Manager / CLI: npm + Vite CLI
|
|
15
|
+
- Default Project Type: Web PWA (SPA) — Offline Standalone محلي
|
|
16
|
+
|
|
17
|
+
## 2. Applicability
|
|
18
|
+
|
|
19
|
+
يُستخدم لهذا النوع من التطبيقات:
|
|
20
|
+
|
|
21
|
+
- PWA محلية (Offline Standalone) تعمل دون إنترنت بعد التثبيت.
|
|
22
|
+
- تطبيقات قراءة/محتوى عربية RTL (كتاب/دليل/مرجع) ببيانات محلية IndexedDB.
|
|
23
|
+
- تطبيقات بدون Backend وبدون خدمة مركزية (لا مصادقة خادم، لا مزامنة سحابية).
|
|
24
|
+
- توزيع الكود: dist ثابت يُخدم عبر خادم محلي localhost أو استضافة HTTPS.
|
|
25
|
+
- ⚠️ لا يُدعم فتح `index.html` مباشرة (`file://`) — PWA وService Worker يتطلبان localhost/HTTPS.
|
|
26
|
+
|
|
27
|
+
## 3. Default Execution Order
|
|
28
|
+
|
|
29
|
+
1. الإقلاع والبنية: Vite scaffold + TypeScript + Tailwind CSS (RTL) + React Router.
|
|
30
|
+
2. طبقة التخزين: `db/` — idb schema (13 مخزناً) + ترقية الإصدار.
|
|
31
|
+
3. الترخيص أولاً: WebCrypto verify (RSA-PSS 4096, SHA-256) — شاشة S-01.
|
|
32
|
+
4. حزم المحتوى: تحقق التوقيع + Hash كل ملف قبل الكتابة (S-14).
|
|
33
|
+
5. الوحدات الوظيفية: Reading → Search (Fuse.js + تطبيع عربي) → Bookmarks/Notes → Quizzes → Flashcards → Quick-Ref → Settings → PWA.
|
|
34
|
+
6. إثباتات Technical Proofs P1–P5 تُنفَّذ **أول** قبل بناء الوحدات الكاملة (§10 في 08).
|
|
35
|
+
7. البناء النهائي: dist ثابت (PWA) + فحص الحجم.
|
|
36
|
+
|
|
37
|
+
## 4. First Task Rule
|
|
38
|
+
|
|
39
|
+
أول مهمة تنفيذ آمنة: **إثبات تقني رقم P1/P2 (البحث العربي + عرض MD RTL)** ضمن Technical Proofs — نطاق مصغّر يثبت المخاطر التقنية الأعلى (تطبيع عربي، تخطيط RTL، عرض MD) قبل أي بناء واسع للوحدات.
|
|
40
|
+
|
|
41
|
+
> لا يبدأ أي TASK-COD كامل للوحدات قبل اجتياز P1–P5 الموثق (DG-07) وإغلاق بوابات الجاهزية.
|
|
42
|
+
|
|
43
|
+
## 5. Scaffold Rules
|
|
44
|
+
|
|
45
|
+
- Scaffold: `npm create vite@latest <app> -- --template react-ts`.
|
|
46
|
+
- إضافات مرخّصة: `tailwindcss` (v3+)، `react-router-dom`، `zustand`، `idb`، `fuse.js`، `vite-plugin-pwa`، `remark`/`rehype` (unified)، `crypto-js` غير مرخص — التحقق عبر `crypto.subtle` فقط.
|
|
47
|
+
- الافتراضي الصارم: لا مكتبات UI ثقيلة (MUI/Ant)؛ التوكينز من `28_UI_UX_GUIDELINES.md` كـ CSS Variables.
|
|
48
|
+
- الإعدادات: `dir="rtl"` و `lang="ar"` على الجذر؛ Tailwind مع توكينز المشروع.
|
|
49
|
+
- لا يُستخدم سكربت توليد تلقائي يعدّل ملفات الحوكمة خارج نطاق المهمة.
|
|
50
|
+
|
|
51
|
+
## 6. ORM / Database Rules
|
|
52
|
+
|
|
53
|
+
- قاعدة البيانات: IndexedDB عبر `idb`.
|
|
54
|
+
- المخازن (13) وفق `06_DATA_MODEL_PREPARATION.md` §1.3 و 08 §11 — لا إضافة/حذف بدون تحديث موثق للـ schema.
|
|
55
|
+
- الترقية: `onupgradeneeded` بإصدار schema (versioned migrations) — increment فقط.
|
|
56
|
+
- الاتساق: Zustand store هو المصدر الحي؛ الكتابة إلى idb عبر write-through subscription.
|
|
57
|
+
- محتوى القراءة فقط (contentTree/searchIndex/quizBank/flashcards) لا يُكتب إلا أثناء تثبيت الحزمة (transaction واحد).
|
|
58
|
+
- لا ORM علائقي، لا SQL، لا خادم قاعدة بيانات.
|
|
59
|
+
|
|
60
|
+
## 7. CLI Side Effects
|
|
61
|
+
|
|
62
|
+
أوامر تُنشئ ملفات/تُعدّل config أو state:
|
|
63
|
+
|
|
64
|
+
- `npm create vite` (scaffold) — ينشئ المشروع.
|
|
65
|
+
- `npm install <pkg>` — يعدّل package.json/package-lock.
|
|
66
|
+
- `vite build` / `npm run build` — ينتج dist/ + precache SW.
|
|
67
|
+
- `npx serve dist` / خادم static محلي — تشغيل PWA عبر localhost (لا `file://`).
|
|
68
|
+
- `docker run nginx` (اختياري) — استضافة ثابتة للحزمة.
|
|
69
|
+
- `node tools/tera-tool build-package` — بناء حزمة محتوى موقّعة (لدى Tera فقط، لا يُوزَّع).
|
|
70
|
+
|
|
71
|
+
## 8. Forbidden Defaults
|
|
72
|
+
|
|
73
|
+
- ❌ لا Backend/API خادم، لا مزامنة سحابية، لا تحديث مركزي (القيد §5 من الـ Amendment).
|
|
74
|
+
- ❌ لا Runtime rebuild لحزم المحتوى في v1.
|
|
75
|
+
- ❌ لا تضمين `private.pem` أو `tools/tera-tool` في نسخة العميل.
|
|
76
|
+
- ❌ لا Device Binding صارم في MVP (الترخيص لكل عميل — PREP-D-013).
|
|
77
|
+
- ❌ لا إلغاء ترخيص عن بعد، لا خدمة ترخيص مركزية.
|
|
78
|
+
- ❌ لا مكتبات UI ثقيلة أو CSS Modules خام افتراضياً.
|
|
79
|
+
- ❌ لا `file://` كطريقة تشغيل.
|
|
80
|
+
|
|
81
|
+
## 9. Pre-Execution Gate Additions
|
|
82
|
+
|
|
83
|
+
إضافات محددة للبوابة (مع `tera-system/TeraPreExecutionGate.md`):
|
|
84
|
+
|
|
85
|
+
- [ ] المهمة ضمن نطاق ملفات Baseline معتمدة (08 وما بعدها).
|
|
86
|
+
- [ ] Active Technology Profile `react-pwa` محمّل.
|
|
87
|
+
- [ ] لا كتابة خارج النطاق المصرح به في المهمة.
|
|
88
|
+
- [ ] إثباتات P1–P5 (إن طُبّقت) موثقة النتائج قبل بناء الوحدات الكاملة.
|
|
89
|
+
- [ ] أي تغيير على المحتوى المجمد (Content Freeze v1) = Change Request أولاً.
|
|
90
|
+
|
|
91
|
+
## 10. Acceptance Criteria Patterns
|
|
92
|
+
|
|
93
|
+
- الواجهة تعمل RTL صحيحاً من 360px إلى 1920px دون كسر تخطيط.
|
|
94
|
+
- PWA تُثبَّت وتعمل Offline (F8.1/F8.2/F8.3) عبر localhost/HTTPS.
|
|
95
|
+
- البحث العربي يعيد نتائج صحيحة لتطبيع الهمزات/التشكيل/التاء المربوطة خلال < 300ms.
|
|
96
|
+
- الترخيص: مفتاح صالح يفتح، منتهٍ يعرض تجديد، مرفوض يعرض رسالة — دون قفل قاسٍ.
|
|
97
|
+
- كل شاشة S-01..S-14 مطابقة لـ `07_SCREENS_AND_UI_STRUCTURE.md` وتوكينز `28_UI_UX_GUIDELINES.md`.
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# Client Discovery and Smart Interview Protocol
|
|
2
|
+
|
|
3
|
+
Guide the preparation agent (ApplicationBlueprintAgent / مُهندس — SCP-2026-07-28-118) through the complete pre-intake and intake process — from first client conversation through structured questioning to confirmed understanding — before any formal preparation or implementation begins.
|
|
4
|
+
|
|
5
|
+
**Process overview:**
|
|
6
|
+
```text
|
|
7
|
+
Client Discovery Mode → Open conversation, understanding, confirmation
|
|
8
|
+
↓
|
|
9
|
+
Project Intake Gate → Readiness check (TeraProjectIntakePolicy.md)
|
|
10
|
+
↓
|
|
11
|
+
Smart Interview (if needed) → Structured adaptive questioning
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Stage 1: Client Discovery Mode
|
|
17
|
+
|
|
18
|
+
This is the **first conversation** with the client. A dialogue, not a questionnaire.
|
|
19
|
+
|
|
20
|
+
### Phase 0: Open Listening
|
|
21
|
+
Start with a simple open question — do not interrupt or launch into structured questions. Let the client explain freely. Tera listens and notes: core idea, problem, expected users, specific requirements, constraints, technical references.
|
|
22
|
+
|
|
23
|
+
### Phase 1: Understanding Summary
|
|
24
|
+
After the client finishes, produce a concise summary and ask: "هل هذا فهمي صحيح؟". **Do not proceed until the client confirms or corrects the summary.**
|
|
25
|
+
|
|
26
|
+
### Decision: Proceed or Discovery Continues
|
|
27
|
+
- **Clear enough** → Proceed to **Project Intake Gate**
|
|
28
|
+
- **Major gaps** → Proceed to **Smart Interview** (Stage 2)
|
|
29
|
+
- **Client unsure** → Smart Interview, starting with essential questions
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Stage 2: Smart Interview (Structured Adaptive Questioning)
|
|
34
|
+
|
|
35
|
+
Reference source: `tera-system/TeraApplicationQuestionBank.md`
|
|
36
|
+
Domain structure: `tera-system/client-helpers/tera-client-engagement-discovery-domains.md`
|
|
37
|
+
|
|
38
|
+
### Phase 2: Opening Round
|
|
39
|
+
Start with essential questions from core domains: Business & Goals, Users Roles & Access, Data & Content. Keep to 5–7 focused questions.
|
|
40
|
+
|
|
41
|
+
### Phase 3: Analysis
|
|
42
|
+
After each round, determine: which domains are covered, which have gaps, any unexpected topics needing follow-up.
|
|
43
|
+
|
|
44
|
+
### Phase 4: Adaptive Rounds
|
|
45
|
+
Select next batch from Question Bank based on analysis. Cover biggest gaps first. Keep each batch small (3–6 questions). Alternate domains to avoid fatigue.
|
|
46
|
+
|
|
47
|
+
Continue Question → Analyze → Select cycle until all relevant domains are sufficiently covered.
|
|
48
|
+
|
|
49
|
+
### Phase 5: Final Summary + Confirmation
|
|
50
|
+
Produce comprehensive understanding summary. Present for user confirmation. Document in `project-inputs/`.
|
|
51
|
+
|
|
52
|
+
### Phase 6: Suggestions and Improvements
|
|
53
|
+
After confirmed understanding, Tera may propose features, technologies, simplifications, or deferrals. Each must be classified:
|
|
54
|
+
|
|
55
|
+
- `Recommended — Include now`
|
|
56
|
+
- `Recommended — Consider for later phase`
|
|
57
|
+
- `Informational — For awareness only`
|
|
58
|
+
- `Deferred — Not needed for MVP`
|
|
59
|
+
- `Out of scope — Does not align with goals`
|
|
60
|
+
|
|
61
|
+
Suggestions must be clearly separated from confirmed requirements.
|
|
62
|
+
|
|
63
|
+
### Phase 7: Proposal Generation (Client Output)
|
|
64
|
+
After understanding is confirmed, generate the **Application Proposal** (template: `tera-workshop/client-templates/commercial/APPLICATION_PROPOSAL_TEMPLATE.md`). Captures: understanding, users & roles, scope (Core MVP + Out of Scope), requirements, assumptions, roadmap, approval section.
|
|
65
|
+
|
|
66
|
+
Generate under `clients/.../client-approval/` for external projects, `project-inputs/` for internal. **Do not proceed to formal preparation until client approves.**
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Assumption Handling
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
When the client does not know an answer, Tera does not stop.
|
|
74
|
+
Tera proposes a reasonable default — but records it as an assumption,
|
|
75
|
+
not as a final decision.
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
| Scenario | Tera's action |
|
|
79
|
+
|---|---|
|
|
80
|
+
| Client: "لا أعرف" | Propose suitable default with reasoning |
|
|
81
|
+
| Client: "ليس الآن" | Classify as `Deferred — Future consideration` |
|
|
82
|
+
| Client: "ما عندي فكرة" | Suggest common approach, flag as assumption |
|
|
83
|
+
| Client: "لا يوجد وقت" | Propose, document as `Recommended default — needs confirmation` |
|
|
84
|
+
|
|
85
|
+
Format:
|
|
86
|
+
```text
|
|
87
|
+
| المجال | السؤال | الافتراض المقترح | الحالة | تاريخ المراجعة |
|
|
88
|
+
|--------|--------|-----------------|--------|----------------|
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Output: Small projects → inside `project-inputs/01_APPLICATION_IDEA.md`. Medium/large → separate `ASSUMPTIONS_AND_OPEN_QUESTIONS.md`. External clients → referenced in `SCOPE_OF_WORK.md`.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Smart Selection Rules
|
|
96
|
+
|
|
97
|
+
| If the user... | Then prioritize... |
|
|
98
|
+
|---|---|
|
|
99
|
+
| Has clear technical preferences | Domain 4 (Technical) deep dive |
|
|
100
|
+
| Is unsure about technology | Start with Domain 2 (Functional), defer Technical |
|
|
101
|
+
| Mentions data-heavy features | Domain 3 (Data and Reporting) |
|
|
102
|
+
| Mentions visual design or brand | Domain 5 (Design and UX) |
|
|
103
|
+
| Mentions sensitive data or multiple roles | Domain 6 (Security and Permissions) |
|
|
104
|
+
| Has specific hosting/deployment needs | Domain 7 (Operational and Deployment) |
|
|
105
|
+
| Has existing system being replaced | Deep dive into Domain 2 (migration workflows) |
|
|
106
|
+
| Is an external client | Start with Domain 1 (client context), then standard flow |
|
|
107
|
+
|
|
108
|
+
### Batch Size by User Type
|
|
109
|
+
|
|
110
|
+
| User type | Batch size |
|
|
111
|
+
|---|---|
|
|
112
|
+
| Internal (Majed) | 5–7 questions per round |
|
|
113
|
+
| External client (via Majed) | 3–5 questions per round |
|
|
114
|
+
| Busy or impatient user | 3–4 questions per round |
|
|
115
|
+
|
|
116
|
+
### Adaptive Depth by Project Size
|
|
117
|
+
|
|
118
|
+
| Size | Approximate length |
|
|
119
|
+
|---|---|
|
|
120
|
+
| Simple / small app | 10–15 questions total |
|
|
121
|
+
| Medium app | 20–35 questions |
|
|
122
|
+
| Complex / ERP / SaaS | Multiple rounds, deeper per domain |
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Documentation Rules
|
|
127
|
+
|
|
128
|
+
- Document each answer immediately in `project-inputs/` as the interview proceeds.
|
|
129
|
+
- Do not leave materially important answers only in chat history.
|
|
130
|
+
- For external clients, document also in `clients/.../CLIENT_PROFILE.md`.
|
|
131
|
+
- At the end: `project-inputs/01_APPLICATION_IDEA.md` reflects the full picture.
|
|
132
|
+
- Assumptions must be separately tracked.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Relationship to Other Protocols
|
|
137
|
+
|
|
138
|
+
- This protocol runs **before** formal preparation.
|
|
139
|
+
- After proposal approval → `TeraProjectIntakePolicy.md` readiness checks apply.
|
|
140
|
+
- `Application Discovery Protocol` runs **after** proposal approval.
|
|
141
|
+
- `Client Approval Workflow Protocol` (in TeraClientPolicy.md) remains unchanged.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
*هذا الملف مقتبس من §18 من `TERA_RUNTIME_PROTOCOLS_CLIENT.md` (النسخة الأصلية) مع اختصار الأجزاء المكررة والإحالة لملفات السياسات.*
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Domain Intelligence and Research Protocol
|
|
2
|
+
|
|
3
|
+
Domain Intelligence is a conditional layer for source-grounded business/domain understanding. It covers all research activities — during Client Discovery, during the Smart Interview, before formal preparation, and at any point when Tera or the user needs external information.
|
|
4
|
+
|
|
5
|
+
**Core rule:**
|
|
6
|
+
```text
|
|
7
|
+
Research informs. Domain analysis recommends. Tera decides.
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 1. Advisory-Only Rules
|
|
13
|
+
|
|
14
|
+
- Domain research is advisory, not scope.
|
|
15
|
+
- Domain analysis is advisory, not requirements.
|
|
16
|
+
- External references are not automatic project scope.
|
|
17
|
+
- No external source overrides `PROJECT_RULES.md` or approved project decisions.
|
|
18
|
+
- Tera remains the final decision owner.
|
|
19
|
+
- Research findings must be source-grounded and source-tiered.
|
|
20
|
+
- **No recommendation may be presented as fact without a source or cited reference.**
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 2. The No-Guessing Rule
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
When Tera does not have reliable, source-grounded knowledge about a topic,
|
|
28
|
+
Tera must search before assuming.
|
|
29
|
+
|
|
30
|
+
A "reasonable default" without research is acceptable only for:
|
|
31
|
+
- Trivial, well-known, universally established patterns (e.g., email/password login)
|
|
32
|
+
- The client's own stated preference
|
|
33
|
+
- When the user explicitly says "اختر أنت" or "افترض أنسب"
|
|
34
|
+
|
|
35
|
+
For everything else: SEARCH FIRST, THEN RECOMMEND.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
If research is unavailable or inconclusive: document the limitation clearly, present as `Unknown — needs client decision`, never present an unresearched opinion as a reliable recommendation.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 3. Research Depth Levels
|
|
43
|
+
|
|
44
|
+
| Level | When to use | Typical output |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| **Quick Search** | Real-time during discovery; simple fact-finding | 2–4 sentence summary with source |
|
|
47
|
+
| **Focused Research** | Specific question with multiple options | Comparison table, pros/cons, source tiers |
|
|
48
|
+
| **Deep Research** | Full domain analysis (ERP, compliance, complex domain) | Research Brief + DomainExpertAgent report |
|
|
49
|
+
|
|
50
|
+
Use the smallest sufficient research depth. Escalate only when justified.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 4. Research Triggers
|
|
55
|
+
|
|
56
|
+
- **During Client Discovery:** when client mentions unfamiliar topic → real-time Quick Search
|
|
57
|
+
- **During Smart Interview:** when Question Bank marks `[Research recommended]`
|
|
58
|
+
- **On-demand:** Majed explicitly asks for research
|
|
59
|
+
- **Before Formal Preparation:** DomainResearchAgent + DomainExpertAgent pipeline for significant domain complexity
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 5. Source Policy
|
|
64
|
+
|
|
65
|
+
| Tier | Type | Usage |
|
|
66
|
+
|---|---|---|
|
|
67
|
+
| Tier 1 | Official documentation, standards, authoritative sources | Primary reference |
|
|
68
|
+
| Tier 2 | Books, whitepapers, reputable professional material | Supporting reference |
|
|
69
|
+
| Tier 3 | General blogs and community examples | Supplementary only |
|
|
70
|
+
| Forbidden | Unverifiable, weak, copied, unclear, or marketing-only content | Never use |
|
|
71
|
+
|
|
72
|
+
Reference-system rule: SAP / Oracle / Odoo / Dynamics may be used as reference sources, not mandatory blueprints.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 6. Research Brief Rule
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
No open-ended domain research without a Research Brief.
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Exception: Quick Search during Client Discovery does not need a formal brief — but must still cite sources.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 7. Mode Detection
|
|
87
|
+
|
|
88
|
+
| If task comes from... | Mode | Pipeline |
|
|
89
|
+
|---|---|---|
|
|
90
|
+
| TeraAgent | **Software Mode** | DomainResearchAgent → DomainExpertAgent → classification by MVP/later/scope |
|
|
91
|
+
| TCEA (مستشار) | **Consulting Mode** | DomainResearchAgent → DomainExpertAgent → [Research Hint] → Majed confirms scope |
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 8. Agent Boundaries
|
|
96
|
+
|
|
97
|
+
**DomainResearchAgent:**
|
|
98
|
+
- Collects and summarizes source-grounded information; must cite sources and source tiers.
|
|
99
|
+
- Must not decide scope, create tasks, or modify project files.
|
|
100
|
+
- For details: see `.opencode/agents/domain-research-agent.md` §6 (How This Agent Works).
|
|
101
|
+
|
|
102
|
+
**DomainExpertAgent:**
|
|
103
|
+
- Analyzes research, converts into practical business concepts, workflows, risks, and options.
|
|
104
|
+
- Must classify recommendations by MVP/later/out-of-scope/decision-needed.
|
|
105
|
+
- Must not expand MVP or override project rules.
|
|
106
|
+
- For details: see `.opencode/agents/domain-expert-agent.md` §6 (How This Agent Works).
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## 9. Documentation of Research-Backed Recommendations
|
|
111
|
+
|
|
112
|
+
Every research-backed recommendation must include:
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
المصدر: [اسم المصدر + رابط]
|
|
116
|
+
مستوى المصدر: Tier 1 / 2 / 3
|
|
117
|
+
الملخص: [ما وجدته]
|
|
118
|
+
سبب الاختيار: مناسب / غير مناسب (سبب: ...)
|
|
119
|
+
التصنيف: [Include now / Recommended / Defer / Out of Scope / Needs User Decision]
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
*هذا الملف مقتبس من §12 من `TERA_RUNTIME_PROTOCOLS_CLIENT.md` (النسخة الأصلية) بعد اختصار الإجراءات التفصيلية والإحالة لتعريفات العملاء.*
|