failproofai 0.0.5 → 0.0.6-beta.1

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 (179) hide show
  1. package/.next/standalone/.failproofai/policies/review-policies.mjs +112 -0
  2. package/.next/standalone/.failproofai/policies/workflow-policies.mjs +2 -1
  3. package/.next/standalone/.next/BUILD_ID +1 -1
  4. package/.next/standalone/.next/build-manifest.json +5 -5
  5. package/.next/standalone/.next/prerender-manifest.json +3 -3
  6. package/.next/standalone/.next/required-server-files.json +1 -1
  7. package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +2 -2
  8. package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
  9. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  10. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  12. package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
  13. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
  14. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
  15. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
  16. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
  17. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  18. package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +2 -2
  19. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  20. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  21. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  22. package/.next/standalone/.next/server/app/_not-found.html +2 -2
  23. package/.next/standalone/.next/server/app/_not-found.rsc +15 -15
  24. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +15 -15
  25. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  26. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +10 -10
  27. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  28. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  29. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  30. package/.next/standalone/.next/server/app/index.html +1 -1
  31. package/.next/standalone/.next/server/app/index.rsc +15 -15
  32. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  33. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +15 -15
  34. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
  35. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +10 -10
  36. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  37. package/.next/standalone/.next/server/app/page/build-manifest.json +2 -2
  38. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
  39. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  41. package/.next/standalone/.next/server/app/policies/page/build-manifest.json +2 -2
  42. package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +8 -8
  43. package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
  45. package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +2 -2
  46. package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
  47. package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
  49. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +2 -2
  50. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
  51. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
  52. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
  53. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  54. package/.next/standalone/.next/server/app/projects/page/build-manifest.json +2 -2
  55. package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
  56. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  57. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  58. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0g72weg._.js +1 -1
  59. package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_0z7w.hh._.js +1 -1
  60. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__092s1ta._.js +2 -2
  61. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__09icjsf._.js +2 -2
  62. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0g.lg8b._.js +2 -2
  63. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h..k-e._.js +2 -2
  64. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0okos0k._.js +2 -2
  65. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0a~g15g._.js → [root-of-the-server]__0rh.18_._.js} +2 -2
  66. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0w6l33k._.js +6 -6
  67. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0qn95h3._.js → [root-of-the-server]__0~kmh8w._.js} +2 -2
  68. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11pa2ra._.js +2 -2
  69. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12t-wym._.js +2 -2
  70. package/.next/standalone/.next/server/chunks/ssr/_10lm7or._.js +2 -2
  71. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_0xerkr6._.js +1 -1
  72. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_0q-m0y-._.js +1 -1
  73. package/.next/standalone/.next/server/middleware-build-manifest.js +5 -5
  74. package/.next/standalone/.next/server/pages/404.html +2 -2
  75. package/.next/standalone/.next/server/pages/500.html +1 -1
  76. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  77. package/.next/standalone/.next/server/server-reference-manifest.json +9 -9
  78. package/.next/standalone/.next/static/chunks/{0sme4lkv.tgn-.js → 01b~z8f1ws0rk.js} +1 -1
  79. package/.next/standalone/.next/static/chunks/{0lgbwkfqmnsmc.js → 03rz6ykw-a2xi.js} +1 -1
  80. package/.next/standalone/.next/static/chunks/{17manv47o-~wp.js → 08t08igdql9yt.js} +1 -1
  81. package/.next/standalone/.next/static/chunks/09_k80d~cq2wg.js +4 -0
  82. package/.next/standalone/.next/static/chunks/{0ksdlt_1hucdm.js → 0bvhsa6zva2o..js} +1 -1
  83. package/.next/standalone/.next/static/chunks/{09ikntpt2-o9b.js → 0gbf4cphy8ksq.js} +1 -1
  84. package/.next/standalone/.next/static/chunks/{0yumumfzx_f27.js → 0v.yd0kg_ld3r.js} +1 -1
  85. package/.next/standalone/.next/static/chunks/{13juklu.vksks.js → 0wlyoif4_kj_t.js} +1 -1
  86. package/.next/standalone/.next/static/chunks/{09e7drilkf1sn.js → 12simlrcfk3g2.js} +1 -1
  87. package/.next/standalone/.next/static/chunks/{0em7tspi4kylh.js → 12~yi9oj8av8p.js} +2 -2
  88. package/.next/standalone/.next/static/chunks/{turbopack-0r26pc8h0y_-e.js → turbopack-0o7k.hakttp4k.js} +1 -1
  89. package/.next/standalone/CHANGELOG.md +13 -0
  90. package/.next/standalone/README.md +2 -2
  91. package/.next/standalone/bun.lock +43 -85
  92. package/.next/standalone/dist/cli.mjs +107 -3
  93. package/.next/standalone/docs/ar/architecture.mdx +65 -64
  94. package/.next/standalone/docs/ar/configuration.mdx +42 -42
  95. package/.next/standalone/docs/ar/custom-policies.mdx +62 -64
  96. package/.next/standalone/docs/built-in-policies.mdx +37 -0
  97. package/.next/standalone/docs/custom-policies.mdx +1 -1
  98. package/.next/standalone/docs/de/architecture.mdx +92 -92
  99. package/.next/standalone/docs/de/configuration.mdx +34 -34
  100. package/.next/standalone/docs/de/custom-policies.mdx +49 -50
  101. package/.next/standalone/docs/es/architecture.mdx +72 -72
  102. package/.next/standalone/docs/es/configuration.mdx +25 -25
  103. package/.next/standalone/docs/es/custom-policies.mdx +48 -49
  104. package/.next/standalone/docs/examples.mdx +54 -0
  105. package/.next/standalone/docs/fr/architecture.mdx +53 -53
  106. package/.next/standalone/docs/fr/configuration.mdx +25 -25
  107. package/.next/standalone/docs/fr/custom-policies.mdx +42 -43
  108. package/.next/standalone/docs/getting-started.mdx +52 -0
  109. package/.next/standalone/docs/he/architecture.mdx +66 -66
  110. package/.next/standalone/docs/he/configuration.mdx +53 -52
  111. package/.next/standalone/docs/he/custom-policies.mdx +72 -73
  112. package/.next/standalone/docs/hi/architecture.mdx +106 -106
  113. package/.next/standalone/docs/hi/configuration.mdx +39 -39
  114. package/.next/standalone/docs/hi/custom-policies.mdx +75 -76
  115. package/.next/standalone/docs/i18n/README.ar.md +66 -66
  116. package/.next/standalone/docs/i18n/README.de.md +38 -38
  117. package/.next/standalone/docs/i18n/README.es.md +38 -38
  118. package/.next/standalone/docs/i18n/README.fr.md +42 -42
  119. package/.next/standalone/docs/i18n/README.he.md +67 -67
  120. package/.next/standalone/docs/i18n/README.hi.md +70 -70
  121. package/.next/standalone/docs/i18n/README.it.md +62 -62
  122. package/.next/standalone/docs/i18n/README.ja.md +54 -54
  123. package/.next/standalone/docs/i18n/README.ko.md +58 -58
  124. package/.next/standalone/docs/i18n/README.pt-br.md +43 -43
  125. package/.next/standalone/docs/i18n/README.ru.md +69 -69
  126. package/.next/standalone/docs/i18n/README.tr.md +76 -76
  127. package/.next/standalone/docs/i18n/README.vi.md +70 -70
  128. package/.next/standalone/docs/i18n/README.zh.md +52 -52
  129. package/.next/standalone/docs/it/architecture.mdx +54 -53
  130. package/.next/standalone/docs/it/configuration.mdx +44 -45
  131. package/.next/standalone/docs/it/custom-policies.mdx +76 -78
  132. package/.next/standalone/docs/ja/architecture.mdx +93 -93
  133. package/.next/standalone/docs/ja/configuration.mdx +47 -47
  134. package/.next/standalone/docs/ja/custom-policies.mdx +62 -63
  135. package/.next/standalone/docs/ko/architecture.mdx +66 -66
  136. package/.next/standalone/docs/ko/configuration.mdx +35 -35
  137. package/.next/standalone/docs/ko/custom-policies.mdx +71 -72
  138. package/.next/standalone/docs/pt-br/architecture.mdx +55 -55
  139. package/.next/standalone/docs/pt-br/configuration.mdx +35 -35
  140. package/.next/standalone/docs/pt-br/custom-policies.mdx +60 -61
  141. package/.next/standalone/docs/ru/architecture.mdx +59 -60
  142. package/.next/standalone/docs/ru/configuration.mdx +52 -53
  143. package/.next/standalone/docs/ru/custom-policies.mdx +68 -69
  144. package/.next/standalone/docs/tr/architecture.mdx +124 -124
  145. package/.next/standalone/docs/tr/configuration.mdx +45 -46
  146. package/.next/standalone/docs/tr/custom-policies.mdx +75 -75
  147. package/.next/standalone/docs/vi/architecture.mdx +65 -64
  148. package/.next/standalone/docs/vi/configuration.mdx +41 -41
  149. package/.next/standalone/docs/vi/custom-policies.mdx +68 -69
  150. package/.next/standalone/docs/zh/architecture.mdx +67 -67
  151. package/.next/standalone/docs/zh/configuration.mdx +34 -34
  152. package/.next/standalone/docs/zh/custom-policies.mdx +53 -54
  153. package/.next/standalone/node_modules/@next/env/package.json +1 -1
  154. package/.next/standalone/node_modules/next/dist/build/swc/index.js +1 -1
  155. package/.next/standalone/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +7 -7
  156. package/.next/standalone/node_modules/next/dist/lib/patch-incorrect-lockfile.js +3 -3
  157. package/.next/standalone/node_modules/next/dist/server/config-schema.js +10 -2
  158. package/.next/standalone/node_modules/next/dist/server/config.js +1 -1
  159. package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +2 -2
  160. package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-webpack.js +1 -1
  161. package/.next/standalone/node_modules/next/dist/server/lib/app-info-log.js +1 -1
  162. package/.next/standalone/node_modules/next/dist/server/lib/start-server.js +1 -1
  163. package/.next/standalone/node_modules/next/dist/server/render.js +27 -20
  164. package/.next/standalone/node_modules/next/dist/shared/lib/errors/canary-only-config-error.js +1 -1
  165. package/.next/standalone/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
  166. package/.next/standalone/node_modules/next/dist/telemetry/events/swc-load-failure.js +1 -1
  167. package/.next/standalone/node_modules/next/dist/telemetry/events/version.js +2 -2
  168. package/.next/standalone/node_modules/next/package.json +15 -15
  169. package/.next/standalone/package.json +2 -2
  170. package/.next/standalone/server.js +1 -1
  171. package/.next/standalone/src/hooks/builtin-policies.ts +131 -0
  172. package/README.md +2 -2
  173. package/dist/cli.mjs +107 -3
  174. package/package.json +2 -2
  175. package/src/hooks/builtin-policies.ts +131 -0
  176. package/.next/standalone/.next/static/chunks/0_yayar~bpphd.js +0 -4
  177. /package/.next/standalone/.next/static/{hYQM6iCWnF1W5XDpsIRhV → CkmOT-ZvDN-sVULinGVKT}/_buildManifest.js +0 -0
  178. /package/.next/standalone/.next/static/{hYQM6iCWnF1W5XDpsIRhV → CkmOT-ZvDN-sVULinGVKT}/_clientMiddlewareManifest.js +0 -0
  179. /package/.next/standalone/.next/static/{hYQM6iCWnF1W5XDpsIRhV → CkmOT-ZvDN-sVULinGVKT}/_ssgManifest.js +0 -0
@@ -1,12 +1,11 @@
1
1
  ---
2
-
3
2
  ---
4
3
  title: السياسات المخصصة
5
- description: "اكتب سياساتك الخاصة في JavaScript - فرض الاتفاقيات، منع الانجراف، الكشف عن الأعطال، التكامل مع الأنظمة الخارجية"
4
+ description: "اكتب سياساتك الخاصة بلغة JavaScript - فرض الاتفاقيات، منع الانجراف، اكتشاف الأعطال، التكامل مع الأنظمة الخارجية"
6
5
  icon: code
7
6
  ---
8
7
 
9
- تتيح لك السياسات المخصصة كتابة قواعد لأي سلوك وكيل: فرض اتفاقيات المشروع، منع الانجراف، التحكم في العمليات الضارة، الكشف عن الوكلاء المعلقة، أو التكامل مع Slack وسير العمل الموافقات والمزيد. تستخدم نفس نظام حدث الخطاف وقرارات `allow` و `deny` و `instruct` كما هو الحال في السياسات المدمجة.
8
+ تتيح لك السياسات المخصصة كتابة قواعد لأي سلوك وكيل: فرض اتفاقيات المشروع، منع الانجراف، حماية العمليات المدمرة، كشف الوكلاء العالقين، أو التكامل مع Slack وسير العمل الموافقة والمزيد. تستخدم نفس نظام أحداث الخطاف وقرارات `allow` و `deny` و `instruct` مثل السياسات المدمجة.
10
9
 
11
10
  ---
12
11
 
@@ -31,7 +30,7 @@ customPolicies.add({
31
30
  });
32
31
  ```
33
32
 
34
- تثبيتها:
33
+ قم بتثبيته:
35
34
 
36
35
  ```bash
37
36
  failproofai policies --install --custom ./my-policies.js
@@ -41,56 +40,56 @@ failproofai policies --install --custom ./my-policies.js
41
40
 
42
41
  ## طريقتان لتحميل السياسات المخصصة
43
42
 
44
- ### الخيار 1: المبنية على الاتفاقية (موصى به)
43
+ ### الخيار 1: قائم على الاتفاقية (موصى به)
45
44
 
46
- أسقط ملفات `*policies.{js,mjs,ts}` في `.failproofai/policies/` وسيتم تحميلها تلقائياً - لا تحتاج إلى أعلام أو تغييرات في الإعدادات. يعمل هذا مثل خطافات git: أسقط ملفاً، وهو يعمل فقط.
45
+ ضع ملفات `*policies.{js,mjs,ts}` في `.failproofai/policies/` وسيتم تحميلها تلقائياً لا توجد علامات أو تغييرات في الإعدادات المطلوبة. يعمل هذا مثل خطافات git: ضع ملفاً، وسيعمل فقط.
47
46
 
48
47
  ```
49
- # Project levelcommitted to git, shared with the team
48
+ # مستوى المشروعيتم الالتزام به في git، مشترك مع الفريق
50
49
  .failproofai/policies/security-policies.mjs
51
50
  .failproofai/policies/workflow-policies.mjs
52
51
 
53
- # User levelpersonal, applies to all projects
52
+ # مستوى المستخدمشخصي، ينطبق على جميع المشاريع
54
53
  ~/.failproofai/policies/my-policies.mjs
55
54
  ```
56
55
 
57
- **كيفية عمله:**
58
- - يتم فحص كلا المجلدات (المشروع والمستخدم) (الاتحاد - وليس first-scope-wins)
59
- - يتم تحميل الملفات أبجدياً في كل مجلد. اجعل البادئة `01-` أو `02-` للتحكم في الترتيب
60
- - يتم تحميل الملفات المطابقة `*policies.{js,mjs,ts}` فقط؛ يتم تجاهل الملفات الأخرى
61
- - يتم تحميل كل ملف بشكل مستقل (fail-open لكل ملف)
56
+ **كيف يعمل:**
57
+ - يتم فحص كل من مجلدات المشروع والمستخدم (الاتحاد وليس السيطرة الأولى)
58
+ - يتم تحميل الملفات أبجدياً داخل كل مجلد. البادئة مع `01-`، `02-` للتحكم في الترتيب
59
+ - يتم تحميل الملفات المطابقة فقط `*policies.{js,mjs,ts} يتم تجاهل الملفات الأخرى
60
+ - يتم تحميل كل ملف بشكل مستقل (فتح بفشل لكل ملف)
62
61
  - يعمل جنباً إلى جنب مع السياسات الصريحة `--custom` والمدمجة
63
62
 
64
63
  <Tip>
65
- سياسات الاتفاقية هي أسهل طريقة لمشاركة السياسات عبر الفريق. التزم `.failproofai/policies/` بـ git ويحصل كل عضو في الفريق عليها تلقائياً.
64
+ سياسات الاتفاقية هي أسهل طريقة لمشاركة السياسات عبر الفريق. التزم بـ `.failproofai/policies/` إلى git وسيحصل كل عضو فريق عليها تلقائياً.
66
65
  </Tip>
67
66
 
68
67
  ### الخيار 2: مسار الملف الصريح
69
68
 
70
69
  ```bash
71
- # Install with a custom policies file
70
+ # التثبيت مع ملف سياسات مخصص
72
71
  failproofai policies --install --custom ./my-policies.js
73
72
 
74
- # Replace the policies file path
73
+ # استبدل مسار ملف السياسات
75
74
  failproofai policies --install --custom ./new-policies.js
76
75
 
77
- # Remove the custom policies path from config
76
+ # إزالة مسار السياسات المخصصة من الإعدادات
78
77
  failproofai policies --uninstall --custom
79
78
  ```
80
79
 
81
- يتم حفظ المسار المطلق المُحل في `policies-config.json` كـ `customPoliciesPath`. يتم تحميل الملف بشكل جديد في كل حدث خطاف - لا يوجد تخزين مؤقت بين الأحداث.
80
+ يتم تخزين المسار المطلق المحل في `policies-config.json` كـ `customPoliciesPath`. يتم تحميل الملف بشكل جديد في كل حدث خطاف - لا يوجد تخزين مؤقت بين الأحداث.
82
81
 
83
82
  ### استخدام كليهما معاً
84
83
 
85
- يمكن لسياسات الاتفاقية والملف الصريح `--custom` أن يتعايشا. ترتيب التحميل:
84
+ يمكن أن تتعايش سياسات الاتفاقية وملف `--custom` الصريح. ترتيب التحميل:
86
85
 
87
86
  1. ملف `customPoliciesPath` الصريح (إذا تم تكوينه)
88
- 2. ملفات اتفاقية المشروع (`{cwd}/.failproofai/policies/`، أبجدياً)
89
- 3. ملفات اتفاقية المستخدم (`~/.failproofai/policies/`، أبجدياً)
87
+ 2. ملفات الاتفاقية للمشروع (`{cwd}/.failproofai/policies/`، أبجدياً)
88
+ 3. ملفات الاتفاقية للمستخدم (`~/.failproofai/policies/`، أبجدياً)
90
89
 
91
90
  ---
92
91
 
93
- ## واجهة برمجية التطبيقات
92
+ ## API
94
93
 
95
94
  ### الاستيراد
96
95
 
@@ -100,7 +99,7 @@ import { customPolicies, allow, deny, instruct } from "failproofai";
100
99
 
101
100
  ### `customPolicies.add(hook)`
102
101
 
103
- تسجيل سياسة. اتصل بها عدة مرات حسب الحاجة لسياسات متعددة في نفس الملف.
102
+ تسجيل سياسة. استدعِ هذا عدة مرات حسب الحاجة لسياسات متعددة في نفس الملف.
104
103
 
105
104
  ```ts
106
105
  customPolicies.add({
@@ -116,30 +115,29 @@ customPolicies.add({
116
115
  | الدالة | التأثير | استخدم عندما |
117
116
  |----------|--------|----------|
118
117
  | `allow()` | السماح بالعملية بصمت | الإجراء آمن، لا توجد رسالة مطلوبة |
119
- | `deny(message)` | حظر العملية | يجب ألا يتخذ الوكيل هذا الإجراء |
120
- | `instruct(message)` | إضافة سياق دون حظر | إعطاء الوكيل سياق إضافي للبقاء على المسار |
118
+ | `deny(message)` | منع العملية | لا يجب أن يقوم الوكيل بهذا الإجراء |
119
+ | `instruct(message)` | إضافة سياق بدون حجب | أعط الوكيل سياق إضافي للبقاء على المسار |
121
120
 
122
- `deny(message)` - تظهر الرسالة إلى Claude بسابقة `"Blocked by failproofai:"`. يقطع `deny` واحد كل تقييم آخر.
121
+ `deny(message)` - تظهر الرسالة لـ Claude مع البادئة `"Blocked by failproofai:"`. يؤدي `deny` واحد إلى اختصار جميع التقييمات الإضافية.
123
122
 
124
- `instruct(message)` - يتم إلحاق الرسالة بسياق Claude لاستدعاء الأداة الحالي. يتم تجميع جميع رسائل `instruct` وتسليمها معاً.
123
+ `instruct(message)` - يتم إلحاق الرسالة بسياق Claude للاستدعاء الحالي للأداة. يتم تجميع جميع رسائل `instruct` وتسليمها معاً.
125
124
 
126
125
  <Tip>
127
- يمكنك إلحاق إرشادات إضافية بأي رسالة `deny` أو `instruct` بإضافة حقل `hint` في `policyParams` - لا حاجة لتغيير الرمز. يعمل هذا أيضاً للسياسات المخصصة (`custom/`)، واتفاقية المشروع (`.failproofai-project/`)، واتفاقية المستخدم (`.failproofai-user/`). انظر [التكوين → hint](/ar/configuration#hint-cross-cutting) للتفاصيل.
126
+ يمكنك إلحاق إرشادات إضافية بأي رسالة `deny` أو `instruct` بإضافة حقل `hint` في `policyParams` لا يلزم تغيير الكود. يعمل هذا أيضاً مع السياسات المخصصة (`custom/`) وسياسات اتفاقية المشروع (`.failproofai-project/`) وسياسات اتفاقية المستخدم (`.failproofai-user/`). راجع [التكوين → hint](/ar/configuration#hint-cross-cutting) للتفاصيل.
128
127
  </Tip>
129
128
 
130
129
  ### رسائل السماح المعلوماتية
131
130
 
132
-
133
- `allow(message)` يسمح بالعملية **و** يرسل رسالة معلومات مرة أخرى إلى Claude. يتم تسليم الرسالة كـ `additionalContext` في استجابة stdout لمعالج الخطاف - نفس الآلية المستخدمة من قبل `instruct`، لكن مختلفة من الناحية الدلالية: إنها تحديث حالة وليست تحذير.
131
+ `allow(message)` يسمح بالعملية **و** يرسل رسالة معلوماتية مرة أخرى إلى Claude. يتم تسليم الرسالة كـ `additionalContext` في استجابة stdout معالج الخطاف — نفس الآلية المستخدمة بواسطة `instruct`، لكن بمعنى مختلف: إنها تحديث الحالة، وليست تحذيراً.
134
132
 
135
133
  | الدالة | التأثير | استخدم عندما |
136
134
  |----------|--------|----------|
137
- | `allow(message)` | السماح وإرسال السياق إلى Claude | تأكيد نجاح الفحص، أو شرح سبب تخطي الفحص |
135
+ | `allow(message)` | السماح وإرسال السياق إلى Claude | تأكيد اجتياز الفحص، أو شرح سبب تخطي الفحص |
138
136
 
139
137
  حالات الاستخدام:
140
- - **تأكيدات الحالة:** `allow("All CI checks passed.")` - يخبر Claude أن كل شيء أخضر
141
- - **شروحات fail-open:** `allow("GitHub CLI not installed, skipping CI check.")` - يخبر Claude سبب تخطي الفحص حتى يكون لديه السياق الكامل
142
- - **تراكم الرسائل المتعددة:** إذا أرجعت عدة سياسات `allow(message)`، يتم ربط جميع الرسائل بخطوط جديدة وتسليمها معاً
138
+ - **تأكيدات الحالة:** `allow("All CI checks passed.")` يخبر Claude بأن كل شيء أخضر
139
+ - **شرح الفتح الفاشل:** `allow("GitHub CLI not installed, skipping CI check.")` يخبر Claude لماذا تم تخطي الفحص حتى يكون لديه سياق كامل
140
+ - **تراكم رسائل متعددة:** إذا أرجعت عدة سياسات `allow(message)`، يتم ربط جميع الرسائل بأسطر جديدة وتسليمها معاً
143
141
 
144
142
  ```js
145
143
  customPolicies.add({
@@ -165,25 +163,25 @@ customPolicies.add({
165
163
  | `eventType` | `string` | `"PreToolUse"`، `"PostToolUse"`، `"Notification"`، `"Stop"` |
166
164
  | `toolName` | `string \| undefined` | الأداة التي يتم استدعاؤها (مثل `"Bash"`، `"Write"`، `"Read"`) |
167
165
  | `toolInput` | `Record<string, unknown> \| undefined` | معاملات إدخال الأداة |
168
- | `payload` | `Record<string, unknown>` | حمل الحدث الخام الكامل من Claude Code |
166
+ | `payload` | `Record<string, unknown>` | حمل الحدث الكامل الخام من Claude Code |
169
167
  | `session` | `SessionMetadata \| undefined` | سياق الجلسة (انظر أدناه) |
170
168
 
171
169
  ### حقول `SessionMetadata`
172
170
 
173
171
  | الحقل | النوع | الوصف |
174
172
  |-------|------|-------------|
175
- | `sessionId` | `string` | معرّف جلسة Claude Code |
173
+ | `sessionId` | `string` | معرف جلسة Claude Code |
176
174
  | `cwd` | `string` | دليل العمل لجلسة Claude Code |
177
- | `transcriptPath` | `string` | المسار إلى ملف النسخة JSONL الخاص بالجلسة |
175
+ | `transcriptPath` | `string` | المسار إلى ملف النسخة المكتوبة JSONL للجلسة |
178
176
 
179
177
  ### أنواع الأحداث
180
178
 
181
- | الحدث | متى يتم تشغيله | محتويات `toolInput` |
182
- |-------|--------------|----------------------|
179
+ | الحدث | متى يطلق | محتويات `toolInput` |
180
+ |------|--------------|----------------------|
183
181
  | `PreToolUse` | قبل تشغيل Claude لأداة | إدخال الأداة (مثل `{ command: "..." }` لـ Bash) |
184
182
  | `PostToolUse` | بعد اكتمال الأداة | إدخال الأداة + `tool_result` (الإخراج) |
185
- | `Notification` | عندما يرسل Claude إشعاراً | `{ message: "...", notification_type: "idle" \| "permission_prompt" \| ... }` - يجب أن تعيد الخطافات دائماً `allow()`، فلا يمكنها حظر الإشعارات |
186
- | `Stop` | عند انتهاء جلسة Claude | فارغة |
183
+ | `Notification` | عندما يرسل Claude إشعاراً | `{ message: "...", notification_type: "idle" \| "permission_prompt" \| ... }` - يجب أن تعيد الخطافات دائماً `allow()`، لا يمكنها حجب الإشعارات |
184
+ | `Stop` | عند انتهاء جلسة Claude | فارغ |
187
185
 
188
186
  ---
189
187
 
@@ -193,18 +191,18 @@ customPolicies.add({
193
191
 
194
192
  1. السياسات المدمجة (بترتيب التعريف)
195
193
  2. السياسات المخصصة الصريحة من `customPoliciesPath` (بترتيب `.add()`)
196
- 3. سياسات الاتفاقية من `.failproofai/policies/` للمشروع (ملفات أبجدياً، ترتيب `.add()` بداخلها)
197
- 4. سياسات الاتفاقية من `~/.failproofai/policies/` للمستخدم (ملفات أبجدياً، ترتيب `.add()` بداخلها)
194
+ 3. سياسات الاتفاقية من مشروع `.failproofai/policies/` (الملفات أبجدياً، ترتيب `.add()` بداخلها)
195
+ 4. سياسات الاتفاقية من مستخدم `~/.failproofai/policies/` (الملفات أبجدياً، ترتيب `.add()` بداخلها)
198
196
 
199
197
  <Note>
200
- يقطع أول `deny` جميع السياسات اللاحقة. يتم تجميع جميع رسائل `instruct` وتسليمها معاً.
198
+ يؤدي أول `deny` إلى اختصار جميع السياسات اللاحقة. يتم تجميع جميع رسائل `instruct` وتسليمها معاً.
201
199
  </Note>
202
200
 
203
201
  ---
204
202
 
205
203
  ## الواردات المتعدية
206
204
 
207
- يمكن لملفات السياسة المخصصة استيراد الوحدات المحلية باستخدام المسارات النسبية:
205
+ يمكن لملفات السياسات المخصصة استيراد الوحدات المحلية باستخدام المسارات النسبية:
208
206
 
209
207
  ```js
210
208
  // my-policies.js
@@ -221,13 +219,13 @@ customPolicies.add({
221
219
  });
222
220
  ```
223
221
 
224
- يتم حل جميع الواردات النسبية الممكنة من ملف الإدخال. يتم تطبيق هذا بإعادة كتابة واردات `from "failproofai"` إلى مسار dist الفعلي وإنشاء ملفات `.mjs` مؤقتة لضمان توافق ESM.
222
+ يتم حل جميع الواردات النسبية التي يمكن الوصول إليها من ملف الإدخال. يتم تنفيذ هذا بإعادة كتابة استيراد `from "failproofai"` إلى مسار dist الفعلي وإنشاء ملفات `.mjs` مؤقتة لضمان توافق ESM.
225
223
 
226
224
  ---
227
225
 
228
226
  ## تصفية نوع الحدث
229
227
 
230
- استخدم `match.events` لتحديد متى يتم تشغيل سياسة:
228
+ استخدم `match.events` لتحديد متى تطلق السياسة:
231
229
 
232
230
  ```js
233
231
  customPolicies.add({
@@ -241,26 +239,26 @@ customPolicies.add({
241
239
  });
242
240
  ```
243
241
 
244
- حذف `match` بالكامل للتشغيل في كل نوع حدث.
242
+ احذف `match` تماماً لتطلق على كل نوع حدث.
245
243
 
246
244
  ---
247
245
 
248
246
  ## معالجة الأخطاء وأوضاع الفشل
249
247
 
250
- السياسات المخصصة هي **fail-open**: الأخطاء لا تحظر السياسات المدمجة أو تعطل معالج الخطاف.
248
+ السياسات المخصصة **تفتح الفشل**: لا تحجب الأخطاء أبداً السياسات المدمجة أو تحطم معالج الخطاف.
251
249
 
252
250
  | الفشل | السلوك |
253
251
  |---------|----------|
254
- | `customPoliciesPath` لم تُعيّن | لا تعمل السياسات المخصصة الصريحة؛ سياسات الاتفاقية والمدمجة تستمر بشكل طبيعي |
255
- | ملف غير موجود | تم تسجيل تحذير في `~/.failproofai/hook.log`؛ المدمجة تستمر |
256
- | خطأ في الصيغة/الاستيراد (صريح) | تم تسجيل الخطأ في `~/.failproofai/hook.log`؛ سياسات مخصصة صريحة تم تخطيها |
257
- | خطأ في الصيغة/الاستيراد (اتفاقية) | تم تسجيل الخطأ؛ هذا الملف تم تخطيه، ملفات اتفاقية أخرى لا تزال تحمل |
258
- | `fn` رمي في وقت التشغيل | تم تسجيل الخطأ؛ تم التعامل مع الخطاف كـ `allow`؛ الخطافات الأخرى تستمر |
259
- | `fn` يستغرق أكثر من 10 ثوان | تم تسجيل المهلة الزمنية؛ تم التعامل معها كـ `allow` |
252
+ | `customPoliciesPath` لم يتم تعيينه | لا تعمل سياسات مخصصة صريحة؛ تستمر السياسات والمدمجات الاتفاقية بشكل طبيعي |
253
+ | لم يتم العثور على الملف | تحذير مسجل في `~/.failproofai/hook.log`؛ تستمر المدمجات |
254
+ | خطأ الصيغة/الاستيراد (صريح) | خطأ مسجل في `~/.failproofai/hook.log`؛ تم تخطي السياسات المخصصة الصريحة |
255
+ | خطأ الصيغة/الاستيراد (الاتفاقية) | خطأ مسجل؛ هذا الملف مخطي، لكن ملفات الاتفاقية الأخرى تحمل لا تزال |
256
+ | `fn` يرمي في وقت التشغيل | خطأ مسجل؛ يتم التعامل مع الخطاف كـ `allow`؛ تستمر الخطافات الأخرى |
257
+ | `fn` يستغرق أطول من 10 ثوانٍ | انتهاء المهلة الزمنية المسجلة؛ يتم التعامل معها كـ `allow` |
260
258
  | مجلد الاتفاقية مفقود | لا تعمل سياسات الاتفاقية؛ لا خطأ |
261
259
 
262
260
  <Tip>
263
- لتصحيح أخطاء السياسة المخصصة، راقب ملف السجل:
261
+ لتصحيح أخطاء السياسات المخصصة، شاهد ملف السجل:
264
262
 
265
263
  ```bash
266
264
  tail -f ~/.failproofai/hook.log
@@ -326,14 +324,14 @@ export { customPolicies };
326
324
 
327
325
  ## أمثلة
328
326
 
329
- يحتوي دليل `examples/` على ملفات السياسات الجاهزة للتشغيل:
327
+ يحتوي مجلد `examples/` على ملفات السياسات الجاهزة للتشغيل:
330
328
 
331
- | الملف | المحتوى |
329
+ | الملف | المحتويات |
332
330
  |------|----------|
333
- | `examples/policies-basic.js` | خمس سياسات للمبتدئين تغطي أوضاع فشل الوكيل الشائعة |
334
- | `examples/policies-advanced/index.js` | أنماط متقدمة: واردات متعدية، استدعاءات غير متزامنة، تنقية الإخراج، وخطافات نهاية الجلسة |
335
- | `examples/convention-policies/security-policies.mjs` | سياسات الأمان المبنية على الاتفاقية (حظر كتابة .env، منع إعادة كتابة سجل git) |
336
- | `examples/convention-policies/workflow-policies.mjs` | سياسات سير العمل المبنية على الاتفاقية (تذكيرات الاختبار، ملفات التدقيق) |
331
+ | `examples/policies-basic.js` | خمس سياسات للمبتدئين تغطي أنماط أعطال الوكيل الشائعة |
332
+ | `examples/policies-advanced/index.js` | أنماط متقدمة: واردات متعدية، استدعاءات غير متزامنة، كشط الإخراج، خطافات نهاية الجلسة |
333
+ | `examples/convention-policies/security-policies.mjs` | سياسات الأمان القائمة على الاتفاقية (منع كتابات .env، منع إعادة كتابة سجل git) |
334
+ | `examples/convention-policies/workflow-policies.mjs` | سياسات سير العمل القائمة على الاتفاقية (تذكيرات الاختبار، ملفات الكتابة بالتدقيق) |
337
335
 
338
336
  ### استخدام أمثلة الملفات الصريحة
339
337
 
@@ -341,7 +339,7 @@ export { customPolicies };
341
339
  failproofai policies --install --custom ./examples/policies-basic.js
342
340
  ```
343
341
 
344
- ### استخدام أمثلة الاتفاقية
342
+ ### استخدام أمثلة قائمة على الاتفاقية
345
343
 
346
344
  ```bash
347
345
  # Copy to project level
@@ -353,4 +351,4 @@ mkdir -p ~/.failproofai/policies
353
351
  cp examples/convention-policies/*.mjs ~/.failproofai/policies/
354
352
  ```
355
353
 
356
- لا حاجة لأمر التثبيت - يتم اختيار الملفات تلقائياً عند حدث الخطاف التالي.
354
+ لا يلزم أمر التثبيت يتم التقاط الملفات تلقائياً في حدث الخطاف التالي.
@@ -21,6 +21,7 @@ Policies are grouped into categories:
21
21
  | [Git](#git) | block-push-master, block-work-on-main, block-force-push, warn-git-amend, warn-git-stash-drop, warn-all-files-staged | PreToolUse |
22
22
  | [Database](#database) | warn-destructive-sql, warn-schema-alteration | PreToolUse |
23
23
  | [Warnings](#warnings) | warn-large-file-write, warn-package-publish, warn-background-process, warn-global-package-install | PreToolUse |
24
+ | [Package managers](#package-managers) | prefer-package-manager | PreToolUse |
24
25
  | [Workflow](#workflow) | require-commit-before-stop, require-push-before-stop, require-pr-before-stop, require-ci-green-before-stop | Stop |
25
26
 
26
27
  - **`block-`** — stop the agent from proceeding.
@@ -436,6 +437,42 @@ No parameters.
436
437
 
437
438
  ---
438
439
 
440
+ ## Package managers
441
+
442
+ Enforce which package managers the agent is allowed to use.
443
+
444
+ ### `prefer-package-manager`
445
+
446
+ **Event:** PreToolUse (Bash)
447
+ **Default:** Disabled. When enabled, blocks any package manager command not in the `allowed` list and tells Claude to rewrite the command using an allowed manager.
448
+
449
+ Detects: pip, pip3, python -m pip, npm, npx, yarn, pnpm, pnpx, bun, bunx, uv, poetry, pipenv, conda, cargo.
450
+
451
+ | Parameter | Type | Default | Description |
452
+ |-----------|------|---------|-------------|
453
+ | `allowed` | string[] | `[]` | Allowed package manager names. Any detected manager not in this list is blocked. When empty, the policy is a no-op. |
454
+ | `blocked` | string[] | `[]` | Additional manager names to block beyond the built-in list (e.g. `['pdm', 'pipx']`). |
455
+
456
+ The built-in block list covers: pip, pip3, npm, npx, yarn, pnpm, pnpx, bun, bunx, uv, poetry, pipenv, conda, cargo. Use `blocked` to append managers not in this list.
457
+
458
+ **Example configuration:**
459
+
460
+ ```json
461
+ {
462
+ "enabledPolicies": ["prefer-package-manager"],
463
+ "policyParams": {
464
+ "prefer-package-manager": {
465
+ "allowed": ["uv", "bun"],
466
+ "blocked": ["pdm", "pipx"]
467
+ }
468
+ }
469
+ }
470
+ ```
471
+
472
+ With this config, `pip install flask` and `pdm install flask` are both denied with a message telling Claude to use `uv` or `bun` instead. Commands like `uv pip install flask` are allowed because `uv` is in the allowlist and is checked first.
473
+
474
+ ---
475
+
439
476
  ## AI behavior
440
477
 
441
478
  Detect when agents get stuck or behave unexpectedly.
@@ -60,7 +60,7 @@ Drop `*policies.{js,mjs,ts}` files into `.failproofai/policies/` and they're aut
60
60
  - Works alongside explicit `--custom` and built-in policies
61
61
 
62
62
  <Tip>
63
- Convention policies are the easiest way to share policies across a team. Commit `.failproofai/policies/` to git and every team member gets them automatically.
63
+ Convention policies are the easiest way to build a quality standard for your org. Commit `.failproofai/policies/` to git and every team member gets the same rules automatically — no per-developer setup needed. As your team discovers new failure modes, add a policy and push. Over time these become a living quality standard that keeps improving with every contribution.
64
64
  </Tip>
65
65
 
66
66
  ### Option 2: Explicit file path