@tera-system/core 0.2.9 → 0.2.12

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 (37) hide show
  1. package/MANIFEST.json +9 -9
  2. package/RELEASES.md +43 -0
  3. package/agents/auditor.md +1 -1
  4. package/agents/domain-research-agent.md +25 -4
  5. package/agents/red-team-agent.md +334 -0
  6. package/agents/security-auditor.md +281 -0
  7. package/agents/security-observer.md +241 -0
  8. package/assets/architecture/README.md +30 -0
  9. package/assets/structurizr-mcp/README.md +134 -0
  10. package/assets/structurizr-mcp/pyproject.toml +19 -0
  11. package/assets/structurizr-mcp/src/structurizr_mcp/__init__.py +0 -0
  12. package/assets/structurizr-mcp/src/structurizr_mcp/config.py +59 -0
  13. package/assets/structurizr-mcp/src/structurizr_mcp/server.py +101 -0
  14. package/assets/structurizr-mcp/src/structurizr_mcp/tools/__init__.py +0 -0
  15. package/assets/structurizr-mcp/src/structurizr_mcp/tools/api.py +63 -0
  16. package/assets/structurizr-mcp/src/structurizr_mcp/tools/dsl.py +36 -0
  17. package/assets/structurizr-mcp/src/structurizr_mcp/tools/export.py +258 -0
  18. package/assets/structurizr-mcp/src/structurizr_mcp/tools/validate.py +43 -0
  19. package/assets/structurizr-mcp/uv.lock +770 -0
  20. package/core/tera-system/AGENT_ACTIVATION_MATRIX.md +4 -1
  21. package/core/tera-system/AGENT_DEPENDENCY_MAP.md +6 -0
  22. package/core/tera-system/AGENT_PERMISSION_MODEL.md +17 -4
  23. package/core/tera-system/TERA_DISTRIBUTION_POLICY.md +26 -5
  24. package/core/tera-system/TOOLING_AND_MCP_POLICY.md +66 -1
  25. package/core/tera-system/TeraArchitectureMap.md +4 -1
  26. package/core/tera-system/TeraClientPolicy.md +1 -1
  27. package/core/tera-system/TeraHelperAgents.md +17 -1
  28. package/core/tera-system/TeraPolicyMap.md +8 -3
  29. package/core/tera-system/TeraPricingPolicy.md +16 -0
  30. package/core/tera-system/TeraSubAgents.md +27 -7
  31. package/core/tera-system/TeraSystemMaintenanceChecklist.md +8 -0
  32. package/core/tera-system/client-helpers/tera-client-engagement-pricing.md +1 -1
  33. package/core/tera-system/runtime/DOMAIN_INTELLIGENCE_PROTOCOL.md +42 -0
  34. package/core/tera-system/runtime/TERA_RUNTIME_CHECKLISTS.md +10 -0
  35. package/opencode.tera.example.json +3 -3
  36. package/package.json +1 -1
  37. package/tools/tera-tooling.ps1 +221 -0
@@ -76,7 +76,10 @@
76
76
  | PlanComplianceReviewAgent | `PLAN_COMPLIANCE_REVIEW_AGENT` | `REVIEW_NEEDED`: نهاية Phase، أو بعد دفعة مهام رئيسية، أو قبل قبول MVP | 5–6–7 | إذا كان التنفيذ متوافقًا بوضوح مع الخطة ولا توجد انحرافات ظاهرة | `PROJECT_MASTER_PLAN.md` + `TASK_REGISTRY.md` |
77
77
  | DomainResearchAgent | `DOMAIN_RESEARCH_AGENT` | `COMPLEXITY_SIGNAL / USER_REQUEST`: مجال غير مألوف، أو حاجة بحث خارجي | 1–2–3 | إذا كان المجال معروفًا بالكامل أو المستخدم قدم جميع المعلومات المطلوبة | Domain Research Brief من Tera |
78
78
  | DomainExpertAgent | `DOMAIN_EXPERT_AGENT` | `COMPLEXITY_SIGNAL`: بعد اكتمال Domain Research، أو عند الحاجة لتحليل متقدم | 2–3–4 | إذا لم يُظهر Domain Research نتائج تستدعي تحليلًا إضافيًا | Domain Research Report + Domain Research Brief |
79
- | ProductionERPExpert | `PRODUCTION_ERP_EXPERT` | `COMPLEXITY_SIGNAL / USER_REQUEST`: موديول تصنيع/إنتاج ERP، أو حاجة لتحليل BOM/Routing/MRP/WIP/Costing/Quality/Rework/Scrap أو مراجعة Production Blueprint | 1–5 | إذا كان المشروع لا يحتوي تصنيع/إنتاج، أو كانت الأسئلة CRUD عامة لا تحتاج خبرة Production ERP | Production context + ملفات discovery/blueprint ذات الصلة + KB index عند الحاجة |
79
+ | ProductionERPExpert | `PRODUCTION_ERP_EXPERT` | `COMPLEXITY_SIGNAL / USER_REQUEST`: موديول تصنيع/إنتاج ERP، أو حاجة لتحليل BOM/Routing/MRP/WIP/Costing/Quality/Rework/Scrap أو مراجعة Production Blueprint | 1–5 | إذا كان المشروع لا يحتوي تصنيع/إنتاج، أو كانت الأسئلة CRUD عامة لا تحتاج خبرة Production ERP | Production context + ملفات discovery/blueprint ذات الصلة + KB index عند الحاجة |
80
+ | RedTeamAgent (الشبح) 🆕 | `RED_TEAM_AGENT` | `PHASE_7_GATE`: بوابة الأمن قبل التسليم — أو `USER_REQUEST` من Majed: "اختبر أمان التطبيق" | 7 (أو بطلب Majed) | لا يُفعّل تلقائياً في Phases 1–6؛ لا يُفعّل على Production بلا تفويض مكتوب؛ لا يُفعّل لأطراف ثالثة | `00_AUTHORIZATION.md` (التفويض والنطاق) + URL/البيئة + Commit SHA + الحدود |
81
+ | SecurityObserver (العين) 🆕 | `SECURITY_OBSERVER` | بالتزامن مع تفعيل Red Team — `PHASE_7_GATE / USER_REQUEST` | 7 (بالتزامن) | لا يُفعّل وحده بلا جولة Red Team ليراقبها | Round ID + سجلات التطبيق + Canary baseline + Test IDs من الشبح |
82
+ | SecurityAuditor (القاضي) 🆕 | `SECURITY_AUDITOR` | بعد اكتمال: Red Team + Observer + Engineering Fixes + Retest — `PHASE_7_GATE / USER_REQUEST` | 7 (بعد الجولة) | لا يُفعّل قبل اكتمال الجولة والأدلة؛ لا يصدر PASS مع Critical/High مفتوحة | تقرير الشبح + تقرير العين + الأدلة + المصفوفات + سجلات الإصلاح وإعادة الاختبار |
80
83
 
81
84
  ---
82
85
 
@@ -32,6 +32,9 @@
32
32
  | **auditor.md** | `tera.md`؛ و`monitor.md` فقط عند طلب Majed | يراجع مخرجات `tera.md`, `engineering-agent.md`؛ يحيل findings إلى `SecurityAgent`, `DesignReviewer`, `QAAndAcceptanceAgent`, أو `ProjectControlAgent` عبر الوكيل المستدعي | `project-control/*.md`, `project-control/audit-reports/`, `tera-system/engineering-governance/*.md`, الملفات المعدلة |
33
33
  | **monitor.md** | — (مستقل — يستدعيه Majed) | يراجع مخرجات `tera.md`, `engineering-agent.md`; قد يستدعي `auditor.md` فقط عندما يطلب Majed تحدي/تحقق جودة مستقل | `project-control/*.md`, `tera-system/*.md` |
34
34
  | **qa-agent.md** (الاسم المنطقي: QAAndAcceptanceAgent) | `tera.md` (يُفعّله Tera) | لا يستدعي عملاء آخرين | ملفات التحضير، ملفات المهمة، logs، مخرجات CLI، `project-control/test-reports/` |
35
+ | **red-team-agent.md** 🆕 (الشبح — SCP-2026-09-02-001) | `tera.md` (Phase 7 Security Gate)؛ Majed مباشرة | `security-observer.md` (العين يراقبه بالتزامن)، `security-auditor.md` (القاضي يدقق أدلته)؛ يستلم `defense-handoff.md` من الدرع عبر Tera | `security-reports/[ROUND-ID]/`, البروتوكول الأمني v2.0, `tera-system/TOOLING_AND_MCP_POLICY.md` |
36
+ | **security-observer.md** 🆕 (العين — SCP-2026-09-02-001) | `tera.md` (بالتزامن مع Red Team)؛ Majed مباشرة | يراقب أثر `red-team-agent.md` (الشبح) — لا يهاجم ولا يصلح | `security-reports/[ROUND-ID]/`, سجلات التطبيق والموارد، تقرير الشبح |
37
+ | **security-auditor.md** 🆕 (القاضي — SCP-2026-09-02-001) | `tera.md` (بعد Red Team + Observer + Retest)؛ Majed مباشرة | يدقق أدلة `red-team-agent.md` (الشبح) + تقرير `security-observer.md` (العين) — يرفض الادعاءات بلا دليل | `security-reports/[ROUND-ID]/audit/`, ASVS 5.0 L2, WSTG, تقارير الشبح والعين |
35
38
  | **tera-business-transformation-consultant.md** | — (مستقل — يُستدعى من TCEA عبر Majed عند Track C) | `domain-research-agent.md`, `domain-expert-agent.md` (للبحث عن معايير الصناعة وأفضل الممارسات) | `tera-system/consulting-helpers/BTCA_METHODOLOGY_FRAMEWORK.md`, `BTCA_REPORT_TEMPLATES.md` |
36
39
 
37
40
  ---
@@ -98,6 +101,9 @@ ui-designer.md
98
101
  | `.opencode/agents/tera-business-transformation-consultant.md` | 290 | 🟢 < 700 — عميل SCP-2026-07-29-002 |
99
102
  | `tera-system/consulting-helpers/BTCA_METHODOLOGY_FRAMEWORK.md` | 195 | 🟢 < 700 — منهجية الأدلة ومراحل العمل |
100
103
  | `tera-system/consulting-helpers/BTCA_REPORT_TEMPLATES.md` | 266 | 🟢 < 700 — قوالب التقارير العشرة |
104
+ | `.opencode/agents/red-team-agent.md` 🆕 | ~150 | 🟢 < 700 — الشبح — SCP-2026-09-02-001 |
105
+ | `.opencode/agents/security-observer.md` 🆕 | ~120 | 🟢 < 700 — العين — SCP-2026-09-02-001 |
106
+ | `.opencode/agents/security-auditor.md` 🆕 | ~140 | 🟢 < 700 — القاضي — SCP-2026-09-02-001 |
101
107
 
102
108
  **ملاحظة (تحديث 2026-08-01 — INS-01):** تمت إعادة حساب جميع الأحجام الفعلية وتصحيح الجدول. الملفات 🔴 (>1000) تحتاج خطط تقسيم (انظر INS-02). الملفات 🟡 (700–1000) قيد المراقبة.
103
109
 
@@ -225,7 +225,10 @@
225
225
 
226
226
  | العميل | المعرف | الصلاحية الافتراضية | هل يمكن رفعها؟ | ملاحظة |
227
227
  |---|---|---|---|---|
228
- | SecurityAgent | `SECURITY_AGENT` | `READ_ONLY` | إلى `WRITE_DOCS` عند توثيق findings | لا يكتب كودًا أبدًا |
228
+ | SecurityAgent (الدرع) | `SECURITY_AGENT` | `READ_ONLY` | إلى `WRITE_DOCS` عند توثيق findings + كتابة `defense-handoff.md` و`fix-review.md` في security-reports | لا يكتب كودًا أبدًا. دفاعي فقط — لا ينفذ هجمات (SCP-2026-09-02-001) |
229
+ | RedTeamAgent (الشبح) 🆕 | `RED_TEAM_AGENT` | `EXECUTE_ATTACKS` (ضمن تفويض مكتوب) + `WRITE_EVIDENCE` في security-reports فقط | لا يُرفع — التفويض يحدد النطاق، لا الصلاحية | يهاجم فقط ما فُوّض له كتابياً؛ لا يكتب كوداً؛ لا يصلح الثغرات أثناء الجولة (SCP-2026-09-02-001) |
230
+ | SecurityObserver (العين) 🆕 | `SECURITY_OBSERVER` | `READ_ONLY` | إلى `WRITE_DOCS` عند كتابة تقرير المراقب في security-reports/observer | يراقب فقط — لا يهاجم، لا يصلح، لا يحكم (SCP-2026-09-02-001) |
231
+ | SecurityAuditor (القاضي) 🆕 | `SECURITY_AUDITOR` | `READ_ONLY` | إلى `WRITE_DOCS` عند كتابة تقرير التدقيق + قرار البوابة في security-reports/audit | يدقق فقط — لا يهاجم، لا يصلح، لا يثق بالادعاءات بلا دليل (SCP-2026-09-02-001) |
229
232
  | IntegrationAgent | `INTEGRATION_AGENT` | `WRITE_DOCS` | إلى `WRITE_CODE` لتعديل كود التكامل فقط إذا فوضه Tera صراحة | يوثق التكاملات |
230
233
  | DevOpsDeploymentAgent | `DEVOPS_DEPLOYMENT_AGENT` | `WRITE_CODE` | إلى `DEPLOY_WITH_APPROVAL` عند النشر | يتطلب موافقة لكل نشر |
231
234
  | PerformanceAgent | `PERFORMANCE_AGENT` | `READ_ONLY` | إلى `WRITE_DOCS` عند توثيق التوصيات | يحلل فقط |
@@ -236,9 +239,9 @@
236
239
  | tera-software-designer (SoftwareDesignerAgent) | `SOFTWARE_DESIGNER_AGENT` | `WRITE_DOCS` | إلى `PLAN_ONLY` إذا ما زالت الخطة غير ناضجة | يجهز Technical Specification للمهام فقط |
237
240
  | QualityReviewCoordinatorAgent | `QUALITY_REVIEW_COORDINATOR_AGENT` | `READ_ONLY` | إلى `WRITE_DOCS` عند تسليم تقرير فقط | ينسق المراجعة فقط |
238
241
  | PlanComplianceReviewAgent | `PLAN_COMPLIANCE_REVIEW_AGENT` | `READ_ONLY` | إلى `WRITE_DOCS` عند تسليم التقرير فقط | يراجع توافق الخطة فقط |
239
- | DomainResearchAgent | `DOMAIN_RESEARCH_AGENT` | `READ_ONLY` | إلى `WRITE_DOCS` عند تسليم التقرير | يبحث فقط |
240
- | DomainExpertAgent | `DOMAIN_EXPERT_AGENT` | `READ_ONLY` | إلى `WRITE_DOCS` عند تسليم التحليل | يحلل فقط |
241
- | ProductionERPExpert | `PRODUCTION_ERP_EXPERT` | `READ_ONLY` | إلى `WRITE_DOCS` عند تسليم تحليل أو أسئلة أو مراجعة Blueprint ضمن Allowed Write Targets | مستشار Production ERP؛ لا يكتب كوداً ولا يقرر النطاق أو التكلفة النهائية |
242
+ | DomainResearchAgent | `DOMAIN_RESEARCH_AGENT` | `READ_ONLY` | إلى `WRITE_DOCS` عند تسليم التقرير + حفظ DRAFT في `../Teranoo-Research/{domain}/` عند Score≥3 (SCP-2026-08-31-001) | يبحث فقط + يقرأ `../Teranoo-Research/00_INDEX.md` (Reuse-First) |
243
+ | DomainExpertAgent | `DOMAIN_EXPERT_AGENT` | `READ_ONLY` | إلى `WRITE_DOCS` عند تسليم التحليل | يحلل فقط + يقرأ `../Teranoo-Research/00_INDEX.md` عند الحاجة |
244
+ | ProductionERPExpert | `PRODUCTION_ERP_EXPERT` | `READ_ONLY` | إلى `WRITE_DOCS` عند تسليم تحليل أو أسئلة أو مراجعة Blueprint ضمن Allowed Write Targets | مستشار Production ERP؛ لا يكتب كوداً ولا يقرر النطاق أو التكلفة النهائية — يقرأ `../Teranoo-Research/00_INDEX.md` عند الحاجة |
242
245
 
243
246
  ### 3.3 عملاء التعامل مع العملاء الخارجيين
244
247
 
@@ -333,6 +336,16 @@ EngineeringAgent يُستخدم لمراجعة كود فقط → يخفض إلى
333
336
  يمكن رفعه إلى `WRITE_DOCS` فقط لتسليم التقرير.
334
337
  ```
335
338
 
339
+ ### 5.6 صلاحية المكتبة البحثية (SCP-2026-08-31-001)
340
+
341
+ ```
342
+ المسار `../Teranoo-Research/**` (خارج Teranoo-System):
343
+ - القراءة: مسموحة لـ DomainResearchAgent / DomainExpertAgent / ProductionERPExpert (Reuse-First)
344
+ - الكتابة: مسموحة فقط لـ DomainResearchAgent لحفظ DRAFT عند Score≥3 في `../Teranoo-Research/{domain}/`
345
+ - الترقية DRAFT→READY: بيد Majed فقط (تعديل 00_INDEX.md)
346
+ - لا يُوزع للزبائن — مستثنى من core-bundle
347
+ ```
348
+
336
349
  ---
337
350
 
338
351
  ## 6. الملخص — قاعدة الصلاحية الذهبية
@@ -59,7 +59,28 @@ Release Package (ملفات Tera-managed + SHA256SUMS + TERA_RELEASE_MANIFEST.js
59
59
  | التثبيت | كل عميل يُثبَّت على Tag محدد بوعي؛ عميل يبقى على `tera-v2.0.0` وآخر ينتقل لـ `tera-v2.5.0` |
60
60
  | المنع المطلق | **لا تتبع تلقائي لـ `main` أو `develop` في أي مستودع عميل** |
61
61
 
62
- ### 2.2 Lockfile — `.tera/lock.json`
62
+ ### 2.2 الحزم الرسمية (npm) — المصدر الموثوق للحزم
63
+
64
+ | الحزمة | الاسم (npm) | الإصدار الحالي | الوصف | الملفات الموزعة ضمن الحزمة |
65
+ |---|---|---|---|---|
66
+ | core | `@tera-system/core` | 0.2.10 | OpenCode Plugin — core governance (20 agents, 11 commands, distribution tools) | `agents/`, `commands/`, `core/`, `assets/`, `tools/`, `scripts/` |
67
+ | pro | `@tera-system/pro` | 0.2.14 | Commercial edition — signed bundle + license gate + heartbeat | `scripts/`, `core/project-control`, `MANIFEST.json`, `opencode.tera.example.json`, `WELCOME.md`, `README.md` |
68
+
69
+ **المستودع الرسمي:** `https://github.com/Alabasi1980/Teranoo-System` — هو `RepositoryUrl` الوحيد المعتمد لـ `tera-fetch.ps1` و `tera-schedule.ps1`
70
+ **Tags:** `tera-vX.Y.Z` — الـ Lockfile يحفظ `Commit SHA` كحقيقة، والقنوات `stable`/`beta`
71
+ > **قاعدة الحزم:** أي تعديل على ملفات `Tera-managed` (`.opencode/`, `tera-system/`, `tera-workshop/tools`) يتطلب Tag جديد + bundle + `npm publish` (core/pro) — وإلا يبقى الزبائن على النسخة القديمة. تعديلات `Teranoo-Research/` أو `project-control/` أو `clients/` لا تتطلب bump.
72
+
73
+ ### 2.3 موقع المنظومة ومنصة النشر (TeraWebsite + Coolify) — SCP-2026-08-31-003
74
+
75
+ | البند | القيمة |
76
+ |---|---|
77
+ | مستودع الموقع | `https://github.com/Alabasi1980/TeraWebsite` (خاص — أول عميل إنتاجي، `book/20_DISTRIBUTION.md` §20.6) |
78
+ | الدومين | `https://teranoo.com` — يقدّم `GET /api/tera-system/bundle` (الحزمة الموقعة) + `POST /api/license/*` (verify/activate) |
79
+ | منصة النشر | `https://coolify.teranoo.com/` — لوحة تحكم نشر/تحديث الموقع (Coolify) — وصول للتعديل والنشر |
80
+ | دور الموقع | 1) ترويج وشرح المنظومة 2) مساعد إصدار الحزم (استضافة bundle + واجهة ترخيص) |
81
+ | العلاقة بالحزم | `tera-sync` و `tera-license` تتصل بـ `teranoo.com` افتراضياً — أي bundle جديد يُنشر على الموقع عبر Coolify ثم يُسحب عبر `tera-sync` |
82
+
83
+ ### 2.4 Lockfile — `.tera/lock.json`
63
84
 
64
85
  في جذر كل مستودع عميل:
65
86
 
@@ -122,13 +143,13 @@ Release Package (ملفات Tera-managed + SHA256SUMS + TERA_RELEASE_MANIFEST.js
122
143
 
123
144
  ```powershell
124
145
  # عرض الإصدارات المتاحة في المستودع الأصلي
125
- pwsh .\tools\tera-fetch.ps1 -RepositoryUrl "https://github.com/Alabasi1980/TeraSystem" -List
146
+ pwsh .\tools\tera-fetch.ps1 -RepositoryUrl "https://github.com/Alabasi1980/Teranoo-System" -List
126
147
 
127
148
  # فحص: هل يوجد إصدار أحدث من المثبت حالياً؟ (قراءة فقط — لا يعدّل شيئاً)
128
- pwsh .\tools\tera-fetch.ps1 -RepositoryUrl "https://github.com/Alabasi1980/TeraSystem" -Check -RepoPath "D:\My Projects\TeraWebsite"
149
+ pwsh .\tools\tera-fetch.ps1 -RepositoryUrl "https://github.com/Alabasi1980/Teranoo-System" -Check -RepoPath "D:\My Projects\TeraWebsite"
129
150
 
130
151
  # بناء حزمة إصدار موثقة من المستودع الأصلي
131
- pwsh .\tools\tera-fetch.ps1 -RepositoryUrl "https://github.com/Alabasi1980/TeraSystem" -Version tera-v2.5.0 -Channel stable -OutPath "C:\TeraReleases\tera-v2.5.0"
152
+ pwsh .\tools\tera-fetch.ps1 -RepositoryUrl "https://github.com/Alabasi1980/Teranoo-System" -Version tera-v2.5.0 -Channel stable -OutPath "C:\TeraReleases\tera-v2.5.0"
132
153
  ```
133
154
 
134
155
  **وضع Check:** يقارن الإصدار المثبت في `lock.json` بأحدث إصدار في الأصل، ويخبرك بما يلي:
@@ -145,7 +166,7 @@ pwsh .\tools\tera-fetch.ps1 -RepositoryUrl "https://github.com/Alabasi1980/TeraS
145
166
  ```powershell
146
167
  # تسجيل مهمة Windows Task Scheduler (عند تسجيل الدخول + كل 6 ساعات)
147
168
  pwsh .\tools\tera-schedule.ps1 `
148
- -RepositoryUrl "https://github.com/Alabasi1980/TeraSystem.git" `
169
+ -RepositoryUrl "https://github.com/Alabasi1980/Teranoo-System.git" `
149
170
  -RepoPath "D:\My Projects\TeraWebsite"
150
171
 
151
172
  # إزالة المهمة
@@ -176,6 +176,71 @@ docker run -d --rm -p 8081:8080 -v "%CD%\architecture:/usr/local/structurizr" st
176
176
 
177
177
  ---
178
178
 
179
+ ### 3.6 المعيار الخماسي والتزويد (SCP-2026-08-29-012)
180
+
181
+ | الأداة | الشكل | ضمان التوفر |
182
+ |---|---|---|
183
+ | **Playwright** | MCP (`npx @playwright/mcp`) | يُفعَّل تلقائياً في `opencode.json` — المتصفحات: `npx playwright install chromium` |
184
+ | **Semgrep** | MCP + CLI | `pip install semgrep` — قواعد Tera في `tera-system/semgrep-rules/` |
185
+ | **Structurizr** | MCP (uv + Docker) | `structurizr-mcp/` يُشحن مع الحزمة — يتطلب uv + Docker (بدونه: قراءة/كتابة DSL فقط) |
186
+ | **Gitleaks** | CLI | `winget install Gitleaks.Gitleaks` |
187
+ | **Trivy** | CLI | `winget install AquaSecurity.Trivy` |
188
+
189
+ **التزويد — في أي مستودع، قبل بدء العمل:**
190
+ ```powershell
191
+ powershell -ExecutionPolicy Bypass -File .\tools\tera-tooling.ps1 -Install
192
+ ```
193
+
194
+ **القواعد:**
195
+ 1. لا يُقبل `SKIPPED (tool not installed)` بعد التزويد إلا بسبب موثق في handback (نقص إنترنت/صلاحيات).
196
+ 2. بعد تثبيت winget: أعد فتح الشل (PATH) — وDocker يتطلب إعادة تشغيل الجهاز.
197
+ 3. غياب Docker لا يعطل structurizr كلياً — القراءة/الكتابة تعمل، والتصدير/التحقق يتوقفان فقط.
198
+
199
+ ---
200
+
201
+ ### 3.7 الأدوات الهجومية لفريق الحماية (SCP-2026-09-02-001)
202
+
203
+ تُستخدم فقط بواسطة عملاء فريق الحماية (الشبح/العين/القاضي) ضمن تفويض مكتوب — في بيئة Local/Staging معزولة ببيانات وهمية. لا تُستخدم على Production ولا على أطراف ثالثة.
204
+
205
+ | الأداة | الشكل | الاستخدام | ضمان التوفر |
206
+ |---|---|---|---|
207
+ | **Burp Suite Pro v2026.1.5** | JAR خارجي (Java) | الالتقاط + Repeater + Intruder — الأداة الهجومية الرئيسية | `java -jar <path>/burpsuite_pro_v2026.1.5.jar` — لا تُضمَّن ملفات الترخيص في المستودع |
208
+ | **OWASP ZAP** | تطبيق (Java) | DAST/Fuzzer احتياطي | تنزيل من zaproxy.org — بديل كامل لـ Burp مجاناً |
209
+ | **Nmap** | CLI | اكتشاف المنافذ والخدمات | `winget install Insecure.Nmap` |
210
+ | **ffuf** | CLI (Go) | Fuzzing المسارات والمعاملات | تنزيل من GitHub releases |
211
+ | **Nuclei** | CLI (Go) | قوالب الثغرات المعروفة | تنزيل من GitHub releases (projectdiscovery) |
212
+ | **sqlmap** | CLI (Python) | أتمتة SQL Injection | `pip install sqlmap` |
213
+ | **dalfox** | CLI (Go) | أتمتة XSS | تنزيل من GitHub releases (hahwul) |
214
+ | **Hydra** | CLI | Brute Force (ضمن حدود التفويض) | build من GitHub — إن لم يعمل على Windows: ZAP Fuzzer بديل |
215
+ | **Metasploit** | Framework | إثبات الاستغلال | مثبّت Rapid7 (Windows — محدود) + Docker/Kali كاحتياط كامل |
216
+ | **John the Ripper** | CLI | كسر الهاشات | تنزيل من GitHub (Jumbo build) |
217
+ | **Wireshark** | CLI/GUI | تحليل الحزم (العين) | `winget install WiresharkFoundation.Wireshark` |
218
+ | **k6** | CLI (Go) | اختبار التحمل (§15 البروتوكول) | `winget install GrafanaLabs.k6` — أُلغي تأجيله من §4 |
219
+
220
+ **قواعد الاستخدام الهجومي:**
221
+ 1. لا هجوم بلا `00_AUTHORIZATION.md` مكتمل في `security-reports/[ROUND-ID]/`.
222
+ 2. جميع الأدوات CLI — لا MCPs جديدة (لا استهلاك توكنز دائم).
223
+ 3. النتائج تُحفظ كأدلة في `security-reports/[ROUND-ID]/evidence/`.
224
+ 4. توقّف فوري عند مؤشرات الإيقاف (البروتوكول §18).
225
+ 5. Burp Suite Pro أداة تجارية — مسؤولية الترخيص على المالك؛ لا تُضمَّن ملفات تفعيل في المستودع.
226
+
227
+ ---
228
+
229
+ ### 3.8 خطة Cloud المرجعية — DigitalOcean (SCP-2026-09-02-001 — بلا تثبيت الآن)
230
+
231
+ عند أول رفع تطبيق على DigitalOcean، تُفعَّل هذه الحزمة في جلسة واحدة (Anti-Bloat: لا تثبيت قبل الحاجة):
232
+
233
+ | الأداة | الشكل | الاستخدام | التزويد |
234
+ |---|---|---|---|
235
+ | **doctl** | CLI رسمي من DO | إدارة/قراءة موارد DO (Droplets, Firewalls, Spaces, DNS...) | `winget install DigitalOcean.Doctl` |
236
+ | **compliancekit** | CLI مفتوح المصدر | 144 فحصاً لـ DO + 119 فحص CIS Linux — ينتج حزمة أدلة جاهزة للتدقيق | تنزيل من GitHub (darpanzope/compliancekit) + `DO_API_TOKEN` (read scope) |
237
+ | **DO CSPM** | مدمج في لوحة التحكم | فحص وضعية سحابي agentless (مجاني للقاعدة) | بلا أدوات — من لوحة DO |
238
+ | **Lynis** | CLI | تدقيق تصلب Linux على الـ Droplets | عبر SSH على الخادم |
239
+
240
+ **قاعدة:** تُفعَّل عند أول تطبيق Production على DO — لا قبلها.
241
+
242
+ ---
243
+
179
244
  ## 4. MCPs المؤجلة (ليست الآن)
180
245
 
181
246
  | الأداة | السبب | وقت التفعيل المقترح |
@@ -191,7 +256,7 @@ docker run -d --rm -p 8081:8080 -v "%CD%\architecture:/usr/local/structurizr" st
191
256
  | **Monitoring / Logging MCPs** | غير ضرورية قبل وجود تطبيق قيد التشغيل الفعلي. | عند وجود تطبيق في Production يحتاج مراقبة. |
192
257
  | **SonarQube** | بوابة جودة مركزية قوية لكنها تحتاج خادماً + CI. Semgrep + Trivy + Gitleaks تغطي احتياجنا الحالي. | عند اعتماد CI/CD رسمي أو مشروع كبير يحتاج قياساً مستمراً للتغطية/التكرار. |
193
258
  | **Sentry MCP** | مراقبة الأخطاء — مفيدة فقط عند وجود تطبيق في Production. حالياً Sentry SDK قاعدة FLAG في التسليم. | عند أول تطبيق Production فعلي. |
194
- | **k6** | اختبارات أداء/ضغط — لا يوجد اشتراط أداء في عتبات القبول حالياً. | عند أول متطلب أداء (p95, concurrency) في تسليم عميل. |
259
+ | **k6** | ~~اختبارات أداء/ضغط~~ — **انتقل إلى §3.7 الأدوات الهجومية (SCP-2026-09-02-001)** — اختبار تحمل ضمن بروتوكول الأمن قبل التسليم | ✅ فُعّل 2026-09-02 |
195
260
 
196
261
  ---
197
262
 
@@ -25,7 +25,8 @@ It is a map, not a policy source. Rules remain in the files listed in `TeraPolic
25
25
  | Sub-agent lifecycle | Defines, generates, narrows, activates, and reviews specialized agents | `TeraSubAgents.md`, `AGENT_GENERATION_TEMPLATE.md`, `generated-agents/` |
26
26
  | Delivery, handoff, and closure | Produces final delivery readiness, release notes, client handover material, acceptance records, and closure reports | `project-control/DELIVERY_READINESS_REPORT.md`, `project-control/PROJECT_CLOSURE_REPORT.md`, `clients/.../delivery/` |
27
27
  | Project implementation knowledge | Maintains concise current-state operational knowledge per screen/module/service | `project-knowledge/` داخل كل تطبيق |
28
- | Tera distribution and versioning | Builds releases and distributes Tera to client repositories in a versioned, verifiable way; clients derive updates from the origin repository (RepositoryUrl) via fetch + verified release packages (Tag + Manifest + SHA lockfile + updater tools); ownership contract separates Tera-managed from client-owned files | `tera-system/TERA_DISTRIBUTION_POLICY.md`, `tera-workshop/tools/tera-fetch.ps1`, `tera-workshop/tools/tera-release.ps1`, `tera-workshop/tools/tera-update.ps1`, `.tera/lock.json` داخل مستودعات العملاء |
28
+ | Tera distribution and versioning | Builds releases and distributes Tera to client repositories in a versioned, verifiable way; clients derive updates from the origin repository (`https://github.com/Alabasi1980/Teranoo-System`) via fetch + verified release packages (Tag `tera-vX.Y.Z` + Manifest + SHA lockfile + updater tools); npm packages `@tera-system/core 0.2.10` + `@tera-system/pro 0.2.14`; website `https://github.com/Alabasi1980/TeraWebsite` hosts bundle at `https://teranoo.com` and is deployed via `https://coolify.teranoo.com/`; ownership contract separates Tera-managed from client-owned files | `tera-system/TERA_DISTRIBUTION_POLICY.md` (§2.2 الحزم + §2.3 الموقع + §2.0 الأصالة), `tera-workshop/tools/tera-fetch.ps1`, `tera-workshop/tools/tera-release.ps1`, `tera-workshop/tools/tera-update.ps1`, `.tera/lock.json` داخل مستودعات العملاء |
29
+ | Security Team (فريق الحماية) | Adversarial security validation before delivery: الدرع (defensive review during dev) → الشبح (Red Team — authorized attacks, Black Box then Gray/White Box) → العين (concurrent observer) → القاضي (independent audit + gate decision). Activated only at Phase 7 security gate or by Majed request. Outputs under `security-reports/` (same repo, outside the application folder). SCP-2026-09-02-001 | `.opencode/agents/red-team-agent.md`, `.opencode/agents/security-observer.md`, `.opencode/agents/security-auditor.md`, `tera-system/TeraHelperAgents.md` §6.1, `security-reports/`, adversarial protocol v2.0 (outside repo) |
29
30
 
30
31
  ## 3. Folder Roles
31
32
 
@@ -45,7 +46,9 @@ It is a map, not a policy source. Rules remain in the files listed in `TeraPolic
45
46
  | `tera-workshop/` | System development and tooling files | Core policy or project files |
46
47
  | `tera-workshop/tools/` | Official Tera updater tooling (tera-update.ps1 + batch updater) used to pin/upgrade Tera in client repositories | Client application code; replacing client-owned files |
47
48
  | `book/` | Comprehensive user-facing documentation and guides (Quick Start, Vision, Quality, Policies) | Runtime operational files; per-project records |
49
+ | `book-pro-user-guide/` | دليل المشتري العملي لـ Pro — من التثبيت إلى التسليم (Onboarding) — 13 فصل + مولد HTML | Runtime operational files; per-project records |
48
50
  | `architecture/` | Structurizr C4 workspace (`.dsl` source of truth + exported diagrams) | Application code; client project files |
51
+ | `security-reports/` | Adversarial security validation outputs (authorization, attack surface, evidence, findings, observer/audit reports, gate decisions) — same repo, outside the application folder (SCP-2026-09-02-001) | Application code; client-owned files; system policy files |
49
52
 
50
53
  ## 4. Core Flow
51
54
 
@@ -214,7 +214,7 @@ If a file is not applicable to a very small project, Tera must still create an e
214
214
  | Gate 3: Flow Approval | The client confirms the main user and business flows. |
215
215
  | Gate 4: Screen Approval | The client confirms the screen list and screen purposes. |
216
216
  | Gate 5: Design Direction Approval | The client confirms visual direction, tone, and references. |
217
- | Gate 6: Prototype Approval | The client confirms the prototype or prototype plan when applicable. |
217
+ | Gate 6: Prototype Approval | The client confirms the actual prototype via a formal approval letter. Mandatory for all applications; only a documented Majed waiver (WAIVED_BY_MAJED) can exempt it. The prototype is a **priced, included line item**: 10% of the final price, auto-calculated in the pricing calculator, shown as a separate line in the quotation, and waived to 0% only when both parties agree the prototype is not needed at all (WAIVED_BY_MAJED + client consent — SCP-2026-09-01-001). Rejection of a built prototype does not cancel its cost; it is handled via the existing Fix / Change Request mechanism. |
218
218
  | Gate 7: Execution Authorization | The client authorizes moving into implementation. |
219
219
 
220
220
  ### Approval Record
@@ -37,13 +37,15 @@
37
37
 
38
38
  ---
39
39
 
40
- ## 6.1 SecurityAgent
40
+ ## 6.1 SecurityAgent — اللقب: الدرع 🛡️
41
41
 
42
42
  | البند | القيمة |
43
43
  |---|---|
44
44
  | المعرّف | `SECURITY_AGENT` |
45
+ | اللقب | **الدرع (The Shield)** |
45
46
  | الفئة | مشروط |
46
47
  | شرط الاستدعاء | بيانات حساسة، أسرار، Auth، Permissions، Middleware، Config، صلاحيات متقدمة، مدفوعات، إنترنت عام، حسابات إدارية مهمة |
48
+ | دوره في الفريق | **الدفاع** — عضو فريق الحماية (SCP-2026-09-02-001): يحمي أثناء البناء، يحضّر ملفات الهجوم، يراجع الإصلاحات |
47
49
 
48
50
  ### يقرأ
49
51
 
@@ -57,6 +59,7 @@ project-control/PROJECT_ACTIVITY_LOG.md عند الحاجة
57
59
  project-control/ISSUES_AND_GAPS.md عند وجود حادثة أو فجوة أمنية
58
60
  project-control/DECISIONS_LOG.md عند الحاجة
59
61
  project-control/TERA_ACTIVE_CONTEXT.md إذا كان موجودًا وطلبه Tera
62
+ security-reports/[ROUND-ID]/findings/ عند مراجعة الإصلاحات بعد جولة Red Team
60
63
  ```
61
64
 
62
65
  ### يساهم في
@@ -65,14 +68,27 @@ project-control/TERA_ACTIVE_CONTEXT.md إذا كان موجودًا وطلبه T
65
68
  15_SECURITY_AND_ACCESS_CONTROL.md
66
69
  16_AUDIT_LOG_AND_ACTIVITY_TRACKING.md
67
70
  21_VALIDATION_AND_ERROR_HANDLING.md
71
+ security-reports/[ROUND-ID]/defense-handoff.md ← ملف الدفاع المُسلَّم للـ Red Team
72
+ security-reports/[ROUND-ID]/fix-review.md ← مراجعة الإصلاحات بعد Findings
68
73
  ```
69
74
 
75
+ ### دوره في فريق الحماية (SCP-2026-09-02-001)
76
+
77
+ الدرع **عضو دفاعي** في فريق الحماية — لا يهاجم أبداً (فصل الأدوار ملزم بالبروتوكول §2):
78
+
79
+ 1. **أثناء التطوير:** مراجعة أمنية دفاعية — يقرأ الكود، يحلل الصلاحيات والجلسات والأسرار، يوثق findings.
80
+ 2. **قبل جولة Red Team:** يحضّر `defense-handoff.md` — البنية، الأدوار، مصفوفة الصلاحيات، مناطق الخطر المعروفة (يسلّمها Tera للشبح ضمن White Box).
81
+ 3. **بعد Findings:** يراجع الإصلاحات التي نفذها Engineering — `fix-review.md` — ويتأكد أنها أصلحت الجذر وليس العرض.
82
+ 4. **استشارياً:** يجيب عن أسئلة أمنية أثناء التطوير (Auth, JWT, Cookies, Middleware, Secrets).
83
+
70
84
  ### حدوده
71
85
 
72
86
  - لا يستبدل QA.
73
87
  - لا يغير UX إلا إذا وُجد خطر أمني.
74
88
  - لا يقرر تعطيل ميزة دون رفع القرار لتيرا.
75
89
  - لا يقبل المهمة بنفسه؛ يسلّم نتيجة المراجعة إلى Tera فقط.
90
+ - **لا ينفذ هجمات فعلية** — ذلك دور الشبح (Red Team Agent). الدرع لا يختبر ما قرأ أسراره — وإلا انكسرت Black Box.
91
+ - **لا يصدر قرار التسليم الأمني النهائي** — ذلك دور القاضي (Security Auditor).
76
92
  - عند مراجعة السجلات أو ملفات المهمة، يجب أن يراجع أيضًا النصوص التي أنشأها Tera نفسه، وليس فقط ملفات الكود التي أنشأها EngineeringAgent.
77
93
  - عند توثيق أي حادثة Secret Exposure أو ملاحظة أمنية، يجب استخدام `[REDACTED]` فقط وعدم إعادة كتابة القيمة المسرّبة.
78
94
 
@@ -57,13 +57,16 @@ Project files record project-specific decisions.
57
57
  | Runtime protocols | `tera-system/runtime/TERA_RUNTIME_PROTOCOLS_CORE.md` + `TERA_RUNTIME_PROTOCOLS_CLIENT.md` | `.opencode/agents/tera.md` | Detailed operational behavior. Split INS-02 continuation: core (1–11) + client (12–18) + knowledge (19). |
58
58
  | Client Discovery protocol | `tera-system/runtime/CLIENT_DISCOVERY_PROTOCOL.md` | `TERA_RUNTIME_PROTOCOLS_CLIENT.md` (Section 18 → reference) | Extracted from §18 of Runtime Protocols; covers full Discovery and Smart Interview. |
59
59
  | Domain Intelligence protocol | `tera-system/runtime/DOMAIN_INTELLIGENCE_PROTOCOL.md` | `TERA_RUNTIME_PROTOCOLS_CLIENT.md` (Section 12 → reference) | Extracted from §12 of Runtime Protocols; covers research, No-Guessing Rule, Source Policy. |
60
+ | Reusable Research Library | `Teranoo-Research/00_INDEX.md` (الفهرس — مصدر الحقيقة) + `tera-system/runtime/DOMAIN_INTELLIGENCE_PROTOCOL.md` §10 (السلوك) | `.opencode/agents/domain-research-agent.md` §6.2 / §7 + `tera-system/AGENT_PERMISSION_MODEL.md` §5.6 | مكتبة بحوث مركزية مستقلة (Private Repo خارج Teranoo-System) — Reuse-First + تقييم Score≥3 → DRAFT → ترقية بيد Majed لـ READY. مستثناة من core-bundle. SCP-2026-08-31-001. |
60
61
  | Runtime templates | `tera-system/runtime/TERA_RUNTIME_TEMPLATES.md` | Not applicable | Formal output formats only. |
61
62
  | Runtime checklists | `tera-system/runtime/TERA_RUNTIME_CHECKLISTS.md` | `.opencode/agents/tera.md` | Checklists stay outside runtime. |
62
63
  | MVP classification | `tera-system/runtime/MVP_DEFINITION_PROTOCOL.md` | `.opencode/agents/tera.md` | Runtime references when to load it. |
63
64
  | Technology profiles | `tera-system/profiles/` | `.opencode/agents/tera.md` | Stack-specific rules stay in profiles. |
64
65
  | Design governance layer | `tera-system/design-system/` | `.opencode/agents/tera.md`, `TERA_RUNTIME_CHECKLISTS.md`, `TERA_RUNTIME_PROTOCOLS_CORE.md` | Governs Design Source Decision, DESIGN.md integration, internal kits, design tokens, component rules, and UI Acceptance Gate. |
65
66
  | Monitor audit framework | `.opencode/agents/monitor.md` | `ENGINEERING_AGENT_RESPONSIBILITIES.md` | Governs the 7 immutable audit rules, reference hierarchy, plan rejection authority, and cumulative audit for plan-compliance checking. |
66
- | Auditor audit framework | `.opencode/agents/auditor.md` | `ENGINEERING_AGENT_RESPONSIBILITIES.md` | Governs Auditor as a Tera-managed quality gate sub-agent, including diff-first scope, evidence model, QUAUD reporting, and authorized invocation by Tera/Monitor. |
67
+ | Auditor audit framework | `.opencode/agents/auditor.md` | `ENGINEERING_AGENT_RESPONSIBILITIES.md` | Governs Auditor as a Tera-managed quality gate sub-agent, including diff-first scope, evidence model, QUAUD reporting, and authorized invocation by Tera/Monitor. |
68
+ | Security Team (فريق الحماية) — SCP-2026-09-02-001 | `.opencode/agents/red-team-agent.md` (الشبح) + `.opencode/agents/security-observer.md` (العين) + `.opencode/agents/security-auditor.md` (القاضي) + `tera-system/TeraHelperAgents.md` §6.1 (الدرع) | `security-reports/` في المستودع + البروتوكول الأمني v2.0 (خارج المستودع) | فريق أمني رباعي الأدوار: الدرع (دفاعي أثناء التطوير) + الشبح (هجومي — Phase 7 أو طلب Majed) + العين (مراقب متزامن) + القاضي (تدقيق مستقل وقرار البوابة). فصل الأدوار ملزم بالبروتوكول §2. التفعيل: Phase 7 أو طلب Majed فقط. المخرجات في `security-reports/` خارج مجلد التطبيق. |
69
+ | Adversarial Security Protocol | `F:\Teranoo Work\OnGoing\Security test\WEB_APPLICATION_SECURITY_TEST_PLAN_AR.md` (v2.0 — خارج المستودع) | `.opencode/agents/red-team-agent.md` | بروتوكول تيرانو للتحقق الهجومي من أمن تطبيقات الويب — OWASP ASVS 5.0 Level 2 + WSTG + API Top 10. ينفذه الشبح، يراقبه العين، يدققه القاضي. |
67
70
  | Quality gate thresholds | `tera-system/engineering-governance/QUALITY_GATE_THRESHOLDS.md` | `.opencode/agents/auditor.md`, `.opencode/agents/tera.md` | Compact reference for Auditor rule classes, evidence requirements, P1/P2 checks, and default heuristics. |
68
71
  | Project UI/UX executable guide | `project-preparation/28_UI_UX_GUIDELINES.md` using `TERA_RUNTIME_TEMPLATES_DELIVERY.md` Section 33 | `TASK_TEMPLATE.md`, `TeraPreExecutionGate.md` | Final executable visual design rules for EngineeringAgent; raw sources stay in `project-preparation/design-source/`. Split notice INS-02: Section 33 moved to DELIVERY file. |
69
72
  | Application proposal template | `tera-workshop/client-templates/commercial/APPLICATION_PROPOSAL_TEMPLATE.md` | `TERA_RUNTIME_TEMPLATES.md` (Section 26) | Formal proposal document. Generated after Client Discovery before formal preparation. |
@@ -104,10 +107,12 @@ Project files record project-specific decisions.
104
107
  | Business Transformation Consultant (BTCA) | `.opencode/agents/tera-business-transformation-consultant.md` | `tera-system/consulting-helpers/BTCA_METHODOLOGY_FRAMEWORK.md`, `BTCA_REPORT_TEMPLATES.md` | عميل مستقل للاستشارات الإدارية والتنظيمية غير البرمجية — Track C. SCP-2026-07-29-002. |
105
108
  | BTCA — Methodology Framework | `tera-system/consulting-helpers/BTCA_METHODOLOGY_FRAMEWORK.md` | `.opencode/agents/tera-business-transformation-consultant.md` | إطار المنهجية: تصنيف الأدلة الخماسي، مراحل العمل، دليل المقابلات، هيكل التقرير النهائي. |
106
109
  | BTCA — Report Templates | `tera-system/consulting-helpers/BTCA_REPORT_TEMPLATES.md` | `.opencode/agents/tera-business-transformation-consultant.md` | قوالب التقارير العشرة الأساسية + التقرير التنفيذي. |
107
- | Tera distribution (versioned) | `tera-system/TERA_DISTRIBUTION_POLICY.md` | `.tera/lock.json` في مستودعات العملاء | توزيع Tera المُروّس على مستودعات العملاء: استمداد من المستودع الأصلي (`tera-fetch.ps1` + RepositoryUrl)، إصدارات (Tag+SHA)، عقد ملكية، أدوات `tera-workshop/tools/`. SCP-2026-08-15-009. |
110
+ | Tera distribution (versioned) | `tera-system/TERA_DISTRIBUTION_POLICY.md` (§2.2 الحزم + §2.3 الموقع + §2.0 الأصالة) | `.tera/lock.json` في مستودعات العملاء | توزيع Tera المُروّس: **RepositoryUrl `https://github.com/Alabasi1980/Teranoo-System`** + الحزم `@tera-system/core 0.2.10` / `@tera-system/pro 0.2.14` + **الموقع `https://github.com/Alabasi1980/TeraWebsite` + `https://teranoo.com` + منصة النشر `https://coolify.teranoo.com/`** + إصدارات (Tag+SHA) + عقد ملكية + أدوات `tera-workshop/tools/`. أي تعديل على ملفات Tera-managed يتطلب Tag+bundle+npm publish. SCP-2026-08-15-009 + SCP-2026-08-31-002 + SCP-2026-08-31-003. |
108
111
  | Source code ownership & pricing | `tera-system/TeraPricingPolicy.md` (§31) + `tera-system/TeraClientPolicy.md` (§9.5) | `tera-workshop/client-templates/contractual/SOURCE_CODE_PURCHASE_ADDENDUM_TEMPLATE.md`، `SOFTWARE_SERVICES_AGREEMENT` §12 | ملكية السورس افتراضياً لـ Tera (لا يُسلَّم للزبون) + خيارا L1 (40%) / L2 (max(3×، 1,000 JOD)) عبر ملحق تعاقدي + L3 (إعادة بيع) مرفوض افتراضياً. SCP-2026-08-29-004. |
112
+ | Prototype pricing mandate | `tera-system/TeraPricingPolicy.md` (§17.5) + `tera-system/TeraClientPolicy.md` (Gate 6) | `tera-workshop/client-templates/commercial/QUOTATION_TEMPLATE.md`, `project-control/TeraPricingCalculator.xlsx` | البروتوتايب التصميمي إلزامي لكل التطبيقات (SCP-2026-08-28-001) وهو **بند مسعّر مشمول**: 10% من السعر النهائي (B57) — يُحتسب تلقائياً في الحاسبة — يُعرض كبند منفصل في العرض — يُلغى إلى 0% فقط باتفاق الطرفين (WAIVED_BY_MAJED + موافقة الزبون). رفض البروتوتايب المعروض لا يُلغي تكلفته (Fix/CR). SCP-2026-09-01-001. |
109
113
  | Client letter numbering | `tera-system/TeraClientPolicy.md` (§9.6) + `project-control/CLIENT_CODES.md` | `client-approval/LETTER_LOG.md` في مستودع العميل | ترميز موحد `{كود-العميل}-{النوع}-{السنة}-{التسلسل}` — كود العميل يخصّصه Majed فقط (سجل مركزي) — الأنواع LET/CON/ADD/PAL/DOC/TPL (قابلة للزيادة). SCP-2026-08-29-005. |
110
- | Payment/Receipt vouchers | `tera-workshop/client-templates/financial/VOUCHER_DESIGN_SPEC.md` + `tera-system/TeraPricingPolicy.md` (§21) | `VOUCHER_RECEIPT_TEMPLATE.html` + `VOUCHER_PAYMENT_TEMPLATE.html` | سند قبض + سند صرف مستقلان (210×156مم، سند واحد في كل ملف، صورة الترويسة كاملة بعرض 210مم وارتفاعها الطبيعي) — `V2.png` للقبض و`V1.png` للصرف — ترقيم مالي مستقل `{السنة}-{تسلسل}` + حقل مرجع يربط بترميز خطابات العميل. SCP-2026-08-29-006/007/008/009/010/011. |
114
+ | Payment/Receipt vouchers | `tera-workshop/client-templates/financial/VOUCHER_DESIGN_SPEC.md` + `tera-system/TeraPricingPolicy.md` (§21) | `VOUCHER_RECEIPT_TEMPLATE.html` + `VOUCHER_PAYMENT_TEMPLATE.html` | سند قبض + سند صرف مستقلان (210×156مم، سند واحد في كل ملف، صورة الترويسة كاملة بعرض 210مم وارتفاعها الطبيعي) — `V2.png` للقبض و`V1.png` للصرف — ترقيم مالي مستقل `{السنة}-{تسلسل}` + حقل مرجع يربط بترميز خطابات العميل. SCP-2026-08-29-006/007/008/009/010/011. |
115
+ | Pro User Guide (Onboarding) | `book-pro-user-guide/` (13 فصل + فهرس + مولد HTML) | `WELCOME.md` في الحزم (ملخص) | دليل المشتري العملي لـ `@tera-system/pro` — من `npm install` إلى التسليم. مكمل لـ `book/` الداخلي. لغة عربية + مصطلحات إنجليزية. SCP-2026-08-30-003. |
111
116
 
112
117
  ## 4. Duplication Policy
113
118
 
@@ -447,6 +447,22 @@ Minimum Profitable Price = Estimated Hours × Internal Hourly Rate
447
447
 
448
448
  ---
449
449
 
450
+ ## 17.5 البروتوتايب التصميمي — بند تسعير إلزامي (SCP-2026-09-01-001)
451
+
452
+ البروتوتايب التصميمي إلزامي لكل التطبيقات (SCP-2026-08-28-001) وهو **بند مسعّر مشمول في عرض السعر** — لا يُبنى خارج التسعير ولا يُترك ضمنياً داخل ساعات الواجهات.
453
+
454
+ | البند | القاعدة |
455
+ |---|---|
456
+ | **الإلزامية** | كل تطبيق (خارجي أو داخلي) يتطلب بروتوتايب تصميمي معتمد قبل التنفيذ — الاستثناء الوحيد: `WAIVED_BY_MAJED` (SCP-2026-08-28-001) |
457
+ | **النسبة** | 10% من **السعر النهائي** (B57 — بعد كل تعديلات Platform/Language/Add-ons/Risk/Rush وقبل الإجمالي النهائي) — قابلة للتعديل اليدوي في الحاسبة بقرار Majed فقط (الافتراضي 10%) |
458
+ | **الاحتساب** | تلقائي في `TeraPricingCalculator.xlsx` — `قيمة البروتوتايب = IF(مطلوب="نعم", ROUND(السعر_النهائي × النسبة, 0), 0)` |
459
+ | **العرض** | بند ظاهر منفصل في `DRAFT_QUOTATION.md` و`QUOTATION_TEMPLATE`: "البروتوتايب التصميمي — 10% من قيمة التطوير = X JOD" — السعر الإجمالي = السعر النهائي + قيمة البروتوتايب |
460
+ | **الإلغاء الوحيد** | اتفاق الطرفين (الزبون + Tera) على عدم الحاجة للبروتوتايب **أصلاً** — عبر `WAIVED_BY_MAJED` + موافقة الزبون — عندها النسبة = 0% تلقائياً ولا يُسعّر أي بروتوتايب |
461
+ | **رفض البروتوتايب المعروض** | رفض الزبون للبروتوتايب الذي **بُني وعُرض** (لم يُعجبه) لا يُلغي التكلفة — الجهد بُذل فعلاً؛ يُعالج عبر الآلية القائمة: تعديلات غير مؤثرة = Fix، مؤثرة = Change Request مسعّر (Gate 6 / SCP-2026-08-28-001) |
462
+ | **ساعات البروتوتايب** | تُقدَّر ضمن "واجهات وشاشات UI" في HoursEstimator — لا تُضاف كبند ساعات مستقل (لا تداخل) |
463
+
464
+ ---
465
+
450
466
  ## 18. الحد الأدنى المطلق
451
467
 
452
468
  ```text
@@ -155,13 +155,33 @@ Auditor (مُدقق) هو عميل جودة فرعي، وليس عميلاً ر
155
155
 
156
156
  `Model Capability Gate` is a Tera-side assessment only.
157
157
 
158
- It does not replace:
159
-
160
- - `SoftwareDesignerAgent`
161
- - `SecurityAgent`
162
- - `QAAndAcceptanceAgent`
163
- - `ProjectControlAgent`
164
- - `Post-Execution Review Gate`
158
+ It does not replace:
159
+
160
+ - `SoftwareDesignerAgent`
161
+ - `SecurityAgent`
162
+ - `QAAndAcceptanceAgent`
163
+ - `ProjectControlAgent`
164
+ - `Post-Execution Review Gate`
165
+
166
+ ### 3.2.3 Security Team (فريق الحماية — SCP-2026-09-02-001)
167
+
168
+ فريق أمني رباعي الأدوار للتحقق الهجومي قبل التسليم:
169
+
170
+ | الدور | اللقب | الملف | الوظيفة |
171
+ |---|---|---|---|
172
+ | دفاعي | الدرع | `TeraHelperAgents.md` §6.1 | مراجعة أمنية أثناء التطوير + تحضير ملفات الدفاع + مراجعة الإصلاحات |
173
+ | هجومي | الشبح | `.opencode/agents/red-team-agent.md` | اختبار هجومي فعلي (Black Box ثم Gray/White Box) |
174
+ | مراقب | العين | `.opencode/agents/security-observer.md` | مراقبة متزامنة للسجلات والموارد والـ Canary |
175
+ | مدقق | القاضي | `.opencode/agents/security-auditor.md` | تدقيق الأدلة + قرار بوابة الأمن (PASS/CONDITIONAL/FAIL/INCOMPLETE) |
176
+
177
+ قواعد الفريق:
178
+
179
+ - **فصل الأدوار ملزم** (البروتوكول §2): من نفّذ الهجوم لا يدقق. من راقب لا يحكم.
180
+ - **التفعيل:** Phase 7 (بوابة التسليم) أو طلب Majed الصريح فقط — لا تفعيل تلقائي في Phases 1–6.
181
+ - **المخرجات:** `security-reports/` في نفس المستودع خارج مجلد التطبيق.
182
+ - **التفويض:** لا هجوم بلا `00_AUTHORIZATION.md` مكتمل (نطاق + بيئة + حدود + مؤشرات إيقاف).
183
+ - **الأدلة:** لا PASS بلا Request/Response فعلي أو Artifact موثق — غياب الثغرة من Scanner ليس نجاحاً.
184
+ - **قرار التسليم:** القاضي وحده يصدر قرار بوابة الأمن — بعد Red Team + Observer + Fixes + Retest.
165
185
 
166
186
  Its role is to help Tera decide whether the current model is sufficient, sufficient with safeguards, needs escalation, or whether the task should be split first.
167
187
 
@@ -17,6 +17,7 @@ Check:
17
17
  - Will this affect `.opencode/agents/tera.md` runtime behavior?
18
18
  - Will agent roles or relationships documented in `book/` change? If yes, plan a `book/` sync pass in the same batch (SCP-2026-08-28-002).
19
19
  - Does this require updating `TeraPolicyMap.md` or `TeraArchitectureMap.md`?
20
+ - Does this change touch Tera-managed distributed files (`.opencode/`, `tera-system/`, `tera-workshop/tools`)? If yes → plan package bump: new Tag `tera-vX.Y.Z` + bundle + `npm publish` for `@tera-system/core` / `@tera-system/pro` (see `TERA_DISTRIBUTION_POLICY.md` §2.2). If only `Teranoo-Research/` or `project-control/` → no bump needed.
20
21
 
21
22
  ## 3. During Editing
22
23
 
@@ -47,6 +48,13 @@ Sync `.opencode/agents/tera.md` only if the change affects:
47
48
 
48
49
  If synced, update `Last Synced` in `.opencode/agents/tera.md`.
49
50
 
51
+ ## 4.1 Package Version Bump Check (SCP-2026-08-31-002)
52
+
53
+ Check if package bump is needed (see `TERA_DISTRIBUTION_POLICY.md` §2.2):
54
+
55
+ - **Needs bump:** any change to Tera-managed distributed files (`.opencode/`, `tera-system/`, `tera-workshop/tools`) → plan Tag `tera-vX.Y.Z` + bundle + `npm publish` (`@tera-system/core` / `@tera-system/pro`) — batch multiple changes into one release when possible.
56
+ - **No bump:** changes only to `Teranoo-Research/`, `project-control/` (logs), `clients/`, `project-preparation/`, `book/` (if not in `files` list) → no publish needed.
57
+
50
58
  ## 5. Anti-Bloat Check
51
59
 
52
60
  Before finishing, verify:
@@ -98,7 +98,7 @@ description: TCEA pricing workflow, tools, reference sources, and client documen
98
98
  5. **اختر المضاعفات** — المنصة (Web/Mobile/PWA)، اللغة، هامش المخاطر، بدل الاستعجال
99
99
  6. **أضف الإضافات** — حدد مستوى كل Add-on. ⚠️ قاعدة التناسب: مجموع Add-ons ≤ 50% من Base Price
100
100
  7. **أدخل الساعات المقدرة** — السعر المعتمد لا يقل عن: الساعات × 4 JOD
101
- 8. **اقرأ النتيجة** — السعر المعتمد النهائي + فحص التناسب + تصنيف السعر
101
+ 8. **اقرأ النتيجة** — السعر المعتمد النهائي + فحص التناسب + تصنيف السعر + **بند البروتوتايب** (اقرأ القيمة التلقائية من الخلية B67 — 10% من السعر النهائي — والإجمالي شامل البروتوتايب من B68 — SCP-2026-09-01-001). إذا كانت B65 = "لا (WAIVED)" (اتفاق الطرفين على عدم الحاجة أصلاً) → القيمة 0 وتُحذف من العرض.
102
102
  9. **استخدم قائمة الاعتماد** — TeraPricingPolicy.md §29 (14 سؤالاً) — جميع الإجابات "نعم" إلزامياً
103
103
  10. **املأ قالب الخطاب الرسمي** — `letterhead-master-fixed-print.html` معبأ ببيانات المشروع والسعر
104
104
 
@@ -121,4 +121,46 @@ Every research-backed recommendation must include:
121
121
 
122
122
  ---
123
123
 
124
+ ---
125
+
126
+ ## 10. Reusable Research Library Protocol — بروتوكول المكتبة البحثية القابلة لإعادة الاستخدام (SCP-2026-08-31-001)
127
+
128
+ **المستودع:** `Teranoo-Research` (Private — خارج `Teranoo-System`، مستثنى من حزمة التوزيع)
129
+ **الفهرس:** `Teranoo-Research/00_INDEX.md` — مصدر الحقيقة الوحيد
130
+ **القالب:** `Teranoo-Research/_templates/RESEARCH_ENTRY_TEMPLATE.md`
131
+
132
+ ### 10.1 Reuse-First Rule
133
+
134
+ ```text
135
+ قبل أي websearch، يجب على DomainResearchAgent فحص الفهرس أولاً.
136
+ إذا وجد بحث مطابق (نفس Topic + Status READY + غير منتهي Expiry + Tier1/2) → يستخدمه مباشرة.
137
+ إذا المسار غير موجود محلياً → يتجاوز الخطوة ويبحث مباشرة (لا يفشل).
138
+ ```
139
+
140
+ البحث مطابق = نفس الكلمات المفتاحية الرئيسية أو نفس Domain + Topic.
141
+
142
+ ### 10.2 تقييم قابلية إعادة الاستخدام (إلزامي بعد كل بحث)
143
+
144
+ | السؤال | نعم=1 / لا=0 |
145
+ |---|---|
146
+ | 1. قابل للاستخدام في مشروعين مختلفين على الأقل؟ | |
147
+ | 2. المصادر Tier1 أو Tier2؟ | |
148
+ | 3. معلومة عامة وليست سر زبون؟ | |
149
+ | 4. بحث مكتمل (ليس Gap Notice)؟ | |
150
+
151
+ - **Score ≥3 → يحفظ تلقائياً كـ DRAFT** في `Teranoo-Research/{domain}/YYYY-MM-DD_Topic_TierX.md` + يسجل في `00_INDEX.md` (Status DRAFT, Expiry +6-12 شهر)
152
+ - **Score ≤2 → لا يحفظ في المكتبة** (يبقى في `project-preparation/` فقط)
153
+
154
+ ### 10.3 التسمية والتصنيف
155
+
156
+ - **التسمية:** `YYYY-MM-DD_Topic_TierX.md` — تولد تلقائياً
157
+ - **المجلدات المسموحة:** `erp/`, `payments/`, `ai-automation/`, `ecommerce/`, `manufacturing/`, `general/` — أي دومين جديد يقترح بوسم `[New Domain Proposal]` ولا يُنشأ دون موافقة Majed
158
+ - **الحالة:** `DRAFT` (يحفظه الباحث) → `READY` (ترقية بيد Majed فقط) → `DEPRECATED` (بعد Expiry)
159
+
160
+ ### 10.4 قاعدة السرية
161
+
162
+ لا يُحفظ أي بحث يحتوي سر زبون أو بيانات حساسة — حتى لو Score≥3.
163
+
164
+ ---
165
+
124
166
  *هذا الملف مقتبس من §12 من `TERA_RUNTIME_PROTOCOLS_CLIENT.md` (النسخة الأصلية) بعد اختصار الإجراءات التفصيلية والإحالة لتعريفات العملاء.*
@@ -172,6 +172,16 @@ Exit Gate:
172
172
  - [ ] Deferred Items documented.
173
173
  - [ ] Final closure decision recorded in `PROJECT_ACTIVITY_LOG.md` and `PROJECT_STATE.md`.
174
174
 
175
+ **Security Gate (SCP-2026-09-02-001 — Team Security):**
176
+
177
+ - [ ] Tera decided: `SECURITY_TEST_REQUIRED` / `SECURITY_TEST_WAIVED_BY_MAJED` (with documented reason) for this delivery.
178
+ - [ ] If required: Red Team (الشبح) engagement completed → `security-reports/[ROUND-ID]/` contains authorization, attack surface, evidence, findings.
179
+ - [ ] Observer (العين) report completed concurrently.
180
+ - [ ] All Critical/High findings fixed (or accepted in writing by Majed) and retested by الشبح.
181
+ - [ ] القاضي (Security Auditor) issued final gate decision: **PASS / CONDITIONAL PASS / FAIL / INCOMPLETE**.
182
+ - [ ] Delivery is BLOCKED until gate = PASS or CONDITIONAL PASS (accepted Medium/Low only).
183
+ - [ ] For small internal projects: Majed may waive the full engagement (`SECURITY_TEST_WAIVED_BY_MAJED`) but the gate decision must still be recorded.
184
+
175
185
  If Phase 7 finds a blocking issue:
176
186
 
177
187
  1. Do not fix it inside Phase 7.
@@ -20,9 +20,9 @@
20
20
  "structurizr-mcp",
21
21
  "structurizr-mcp"
22
22
  ],
23
- "enabled": false,
24
- "env": {
25
- "STRUCTURIZR_WORKSPACE_DIR": "../architecture",
23
+ "enabled": true,
24
+ "environment": {
25
+ "STRUCTURIZR_WORKSPACE_DIR": "architecture",
26
26
  "STRUCTURIZR_URL": "http://localhost:8081"
27
27
  }
28
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tera-system/core",
3
- "version": "0.2.9",
3
+ "version": "0.2.12",
4
4
  "description": "Tera System OpenCode Plugin أ¢â‚¬â€‌ governance core, 20 agents, 11 commands, distribution tools (personal edition)",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "type": "module",