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.
- package/.next/standalone/.failproofai/policies/review-policies.mjs +112 -0
- package/.next/standalone/.failproofai/policies/workflow-policies.mjs +2 -1
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +5 -5
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/required-server-files.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +2 -2
- package/.next/standalone/.next/server/app/_not-found.rsc +15 -15
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +15 -15
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +10 -10
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +15 -15
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +15 -15
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +10 -10
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/policies/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +8 -8
- package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0g72weg._.js +1 -1
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_0z7w.hh._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__092s1ta._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__09icjsf._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0g.lg8b._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h..k-e._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0okos0k._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0a~g15g._.js → [root-of-the-server]__0rh.18_._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0w6l33k._.js +6 -6
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0qn95h3._.js → [root-of-the-server]__0~kmh8w._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11pa2ra._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12t-wym._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_10lm7or._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_0xerkr6._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_0q-m0y-._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +5 -5
- package/.next/standalone/.next/server/pages/404.html +2 -2
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +9 -9
- package/.next/standalone/.next/static/chunks/{0sme4lkv.tgn-.js → 01b~z8f1ws0rk.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0lgbwkfqmnsmc.js → 03rz6ykw-a2xi.js} +1 -1
- package/.next/standalone/.next/static/chunks/{17manv47o-~wp.js → 08t08igdql9yt.js} +1 -1
- package/.next/standalone/.next/static/chunks/09_k80d~cq2wg.js +4 -0
- package/.next/standalone/.next/static/chunks/{0ksdlt_1hucdm.js → 0bvhsa6zva2o..js} +1 -1
- package/.next/standalone/.next/static/chunks/{09ikntpt2-o9b.js → 0gbf4cphy8ksq.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0yumumfzx_f27.js → 0v.yd0kg_ld3r.js} +1 -1
- package/.next/standalone/.next/static/chunks/{13juklu.vksks.js → 0wlyoif4_kj_t.js} +1 -1
- package/.next/standalone/.next/static/chunks/{09e7drilkf1sn.js → 12simlrcfk3g2.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0em7tspi4kylh.js → 12~yi9oj8av8p.js} +2 -2
- package/.next/standalone/.next/static/chunks/{turbopack-0r26pc8h0y_-e.js → turbopack-0o7k.hakttp4k.js} +1 -1
- package/.next/standalone/CHANGELOG.md +13 -0
- package/.next/standalone/README.md +2 -2
- package/.next/standalone/bun.lock +43 -85
- package/.next/standalone/dist/cli.mjs +107 -3
- package/.next/standalone/docs/ar/architecture.mdx +65 -64
- package/.next/standalone/docs/ar/configuration.mdx +42 -42
- package/.next/standalone/docs/ar/custom-policies.mdx +62 -64
- package/.next/standalone/docs/built-in-policies.mdx +37 -0
- package/.next/standalone/docs/custom-policies.mdx +1 -1
- package/.next/standalone/docs/de/architecture.mdx +92 -92
- package/.next/standalone/docs/de/configuration.mdx +34 -34
- package/.next/standalone/docs/de/custom-policies.mdx +49 -50
- package/.next/standalone/docs/es/architecture.mdx +72 -72
- package/.next/standalone/docs/es/configuration.mdx +25 -25
- package/.next/standalone/docs/es/custom-policies.mdx +48 -49
- package/.next/standalone/docs/examples.mdx +54 -0
- package/.next/standalone/docs/fr/architecture.mdx +53 -53
- package/.next/standalone/docs/fr/configuration.mdx +25 -25
- package/.next/standalone/docs/fr/custom-policies.mdx +42 -43
- package/.next/standalone/docs/getting-started.mdx +52 -0
- package/.next/standalone/docs/he/architecture.mdx +66 -66
- package/.next/standalone/docs/he/configuration.mdx +53 -52
- package/.next/standalone/docs/he/custom-policies.mdx +72 -73
- package/.next/standalone/docs/hi/architecture.mdx +106 -106
- package/.next/standalone/docs/hi/configuration.mdx +39 -39
- package/.next/standalone/docs/hi/custom-policies.mdx +75 -76
- package/.next/standalone/docs/i18n/README.ar.md +66 -66
- package/.next/standalone/docs/i18n/README.de.md +38 -38
- package/.next/standalone/docs/i18n/README.es.md +38 -38
- package/.next/standalone/docs/i18n/README.fr.md +42 -42
- package/.next/standalone/docs/i18n/README.he.md +67 -67
- package/.next/standalone/docs/i18n/README.hi.md +70 -70
- package/.next/standalone/docs/i18n/README.it.md +62 -62
- package/.next/standalone/docs/i18n/README.ja.md +54 -54
- package/.next/standalone/docs/i18n/README.ko.md +58 -58
- package/.next/standalone/docs/i18n/README.pt-br.md +43 -43
- package/.next/standalone/docs/i18n/README.ru.md +69 -69
- package/.next/standalone/docs/i18n/README.tr.md +76 -76
- package/.next/standalone/docs/i18n/README.vi.md +70 -70
- package/.next/standalone/docs/i18n/README.zh.md +52 -52
- package/.next/standalone/docs/it/architecture.mdx +54 -53
- package/.next/standalone/docs/it/configuration.mdx +44 -45
- package/.next/standalone/docs/it/custom-policies.mdx +76 -78
- package/.next/standalone/docs/ja/architecture.mdx +93 -93
- package/.next/standalone/docs/ja/configuration.mdx +47 -47
- package/.next/standalone/docs/ja/custom-policies.mdx +62 -63
- package/.next/standalone/docs/ko/architecture.mdx +66 -66
- package/.next/standalone/docs/ko/configuration.mdx +35 -35
- package/.next/standalone/docs/ko/custom-policies.mdx +71 -72
- package/.next/standalone/docs/pt-br/architecture.mdx +55 -55
- package/.next/standalone/docs/pt-br/configuration.mdx +35 -35
- package/.next/standalone/docs/pt-br/custom-policies.mdx +60 -61
- package/.next/standalone/docs/ru/architecture.mdx +59 -60
- package/.next/standalone/docs/ru/configuration.mdx +52 -53
- package/.next/standalone/docs/ru/custom-policies.mdx +68 -69
- package/.next/standalone/docs/tr/architecture.mdx +124 -124
- package/.next/standalone/docs/tr/configuration.mdx +45 -46
- package/.next/standalone/docs/tr/custom-policies.mdx +75 -75
- package/.next/standalone/docs/vi/architecture.mdx +65 -64
- package/.next/standalone/docs/vi/configuration.mdx +41 -41
- package/.next/standalone/docs/vi/custom-policies.mdx +68 -69
- package/.next/standalone/docs/zh/architecture.mdx +67 -67
- package/.next/standalone/docs/zh/configuration.mdx +34 -34
- package/.next/standalone/docs/zh/custom-policies.mdx +53 -54
- package/.next/standalone/node_modules/@next/env/package.json +1 -1
- package/.next/standalone/node_modules/next/dist/build/swc/index.js +1 -1
- package/.next/standalone/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +7 -7
- package/.next/standalone/node_modules/next/dist/lib/patch-incorrect-lockfile.js +3 -3
- package/.next/standalone/node_modules/next/dist/server/config-schema.js +10 -2
- package/.next/standalone/node_modules/next/dist/server/config.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +2 -2
- package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/lib/app-info-log.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/lib/start-server.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/render.js +27 -20
- package/.next/standalone/node_modules/next/dist/shared/lib/errors/canary-only-config-error.js +1 -1
- package/.next/standalone/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
- package/.next/standalone/node_modules/next/dist/telemetry/events/swc-load-failure.js +1 -1
- package/.next/standalone/node_modules/next/dist/telemetry/events/version.js +2 -2
- package/.next/standalone/node_modules/next/package.json +15 -15
- package/.next/standalone/package.json +2 -2
- package/.next/standalone/server.js +1 -1
- package/.next/standalone/src/hooks/builtin-policies.ts +131 -0
- package/README.md +2 -2
- package/dist/cli.mjs +107 -3
- package/package.json +2 -2
- package/src/hooks/builtin-policies.ts +131 -0
- package/.next/standalone/.next/static/chunks/0_yayar~bpphd.js +0 -4
- /package/.next/standalone/.next/static/{hYQM6iCWnF1W5XDpsIRhV → CkmOT-ZvDN-sVULinGVKT}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{hYQM6iCWnF1W5XDpsIRhV → CkmOT-ZvDN-sVULinGVKT}/_clientMiddlewareManifest.js +0 -0
- /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: "اكتب سياساتك الخاصة
|
|
4
|
+
description: "اكتب سياساتك الخاصة بلغة JavaScript - فرض الاتفاقيات، منع الانجراف، اكتشاف الأعطال، التكامل مع الأنظمة الخارجية"
|
|
6
5
|
icon: code
|
|
7
6
|
---
|
|
8
7
|
|
|
9
|
-
تتيح لك السياسات المخصصة كتابة قواعد لأي سلوك وكيل: فرض اتفاقيات المشروع، منع الانجراف،
|
|
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
|
-
|
|
45
|
+
ضع ملفات `*policies.{js,mjs,ts}` في `.failproofai/policies/` وسيتم تحميلها تلقائياً — لا توجد علامات أو تغييرات في الإعدادات المطلوبة. يعمل هذا مثل خطافات git: ضع ملفاً، وسيعمل فقط.
|
|
47
46
|
|
|
48
47
|
```
|
|
49
|
-
#
|
|
48
|
+
# مستوى المشروع — يتم الالتزام به في git، مشترك مع الفريق
|
|
50
49
|
.failproofai/policies/security-policies.mjs
|
|
51
50
|
.failproofai/policies/workflow-policies.mjs
|
|
52
51
|
|
|
53
|
-
#
|
|
52
|
+
# مستوى المستخدم — شخصي، ينطبق على جميع المشاريع
|
|
54
53
|
~/.failproofai/policies/my-policies.mjs
|
|
55
54
|
```
|
|
56
55
|
|
|
57
|
-
|
|
58
|
-
- يتم فحص
|
|
59
|
-
- يتم تحميل الملفات أبجدياً
|
|
60
|
-
- يتم تحميل الملفات المطابقة `*policies.{js,mjs,ts}
|
|
61
|
-
- يتم تحميل كل ملف بشكل مستقل (
|
|
56
|
+
**كيف يعمل:**
|
|
57
|
+
- يتم فحص كل من مجلدات المشروع والمستخدم (الاتحاد — وليس السيطرة الأولى)
|
|
58
|
+
- يتم تحميل الملفات أبجدياً داخل كل مجلد. البادئة مع `01-`، `02-` للتحكم في الترتيب
|
|
59
|
+
- يتم تحميل الملفات المطابقة فقط `*policies.{js,mjs,ts}`؛ يتم تجاهل الملفات الأخرى
|
|
60
|
+
- يتم تحميل كل ملف بشكل مستقل (فتح بفشل لكل ملف)
|
|
62
61
|
- يعمل جنباً إلى جنب مع السياسات الصريحة `--custom` والمدمجة
|
|
63
62
|
|
|
64
63
|
<Tip>
|
|
65
|
-
سياسات الاتفاقية هي أسهل طريقة لمشاركة السياسات عبر الفريق. التزم `.failproofai/policies/`
|
|
64
|
+
سياسات الاتفاقية هي أسهل طريقة لمشاركة السياسات عبر الفريق. التزم بـ `.failproofai/policies/` إلى git وسيحصل كل عضو فريق عليها تلقائياً.
|
|
66
65
|
</Tip>
|
|
67
66
|
|
|
68
67
|
### الخيار 2: مسار الملف الصريح
|
|
69
68
|
|
|
70
69
|
```bash
|
|
71
|
-
#
|
|
70
|
+
# التثبيت مع ملف سياسات مخصص
|
|
72
71
|
failproofai policies --install --custom ./my-policies.js
|
|
73
72
|
|
|
74
|
-
#
|
|
73
|
+
# استبدل مسار ملف السياسات
|
|
75
74
|
failproofai policies --install --custom ./new-policies.js
|
|
76
75
|
|
|
77
|
-
#
|
|
76
|
+
# إزالة مسار السياسات المخصصة من الإعدادات
|
|
78
77
|
failproofai policies --uninstall --custom
|
|
79
78
|
```
|
|
80
79
|
|
|
81
|
-
يتم
|
|
80
|
+
يتم تخزين المسار المطلق المحل في `policies-config.json` كـ `customPoliciesPath`. يتم تحميل الملف بشكل جديد في كل حدث خطاف - لا يوجد تخزين مؤقت بين الأحداث.
|
|
82
81
|
|
|
83
82
|
### استخدام كليهما معاً
|
|
84
83
|
|
|
85
|
-
يمكن
|
|
84
|
+
يمكن أن تتعايش سياسات الاتفاقية وملف `--custom` الصريح. ترتيب التحميل:
|
|
86
85
|
|
|
87
86
|
1. ملف `customPoliciesPath` الصريح (إذا تم تكوينه)
|
|
88
|
-
2. ملفات
|
|
89
|
-
3. ملفات
|
|
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)` - تظهر الرسالة
|
|
121
|
+
`deny(message)` - تظهر الرسالة لـ Claude مع البادئة `"Blocked by failproofai:"`. يؤدي `deny` واحد إلى اختصار جميع التقييمات الإضافية.
|
|
123
122
|
|
|
124
|
-
`instruct(message)` - يتم إلحاق الرسالة بسياق Claude
|
|
123
|
+
`instruct(message)` - يتم إلحاق الرسالة بسياق Claude للاستدعاء الحالي للأداة. يتم تجميع جميع رسائل `instruct` وتسليمها معاً.
|
|
125
124
|
|
|
126
125
|
<Tip>
|
|
127
|
-
يمكنك إلحاق إرشادات إضافية بأي رسالة `deny` أو `instruct` بإضافة حقل `hint` في `policyParams`
|
|
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.")`
|
|
141
|
-
-
|
|
142
|
-
- **تراكم
|
|
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>` | حمل الحدث الخام
|
|
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` |
|
|
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
|
-
| الحدث | متى
|
|
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/`
|
|
197
|
-
4. سياسات الاتفاقية من `~/.failproofai/policies/`
|
|
194
|
+
3. سياسات الاتفاقية من مشروع `.failproofai/policies/` (الملفات أبجدياً، ترتيب `.add()` بداخلها)
|
|
195
|
+
4. سياسات الاتفاقية من مستخدم `~/.failproofai/policies/` (الملفات أبجدياً، ترتيب `.add()` بداخلها)
|
|
198
196
|
|
|
199
197
|
<Note>
|
|
200
|
-
|
|
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
|
-
يتم حل جميع الواردات النسبية
|
|
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
|
-
|
|
242
|
+
احذف `match` تماماً لتطلق على كل نوع حدث.
|
|
245
243
|
|
|
246
244
|
---
|
|
247
245
|
|
|
248
246
|
## معالجة الأخطاء وأوضاع الفشل
|
|
249
247
|
|
|
250
|
-
السياسات المخصصة
|
|
248
|
+
السياسات المخصصة **تفتح الفشل**: لا تحجب الأخطاء أبداً السياسات المدمجة أو تحطم معالج الخطاف.
|
|
251
249
|
|
|
252
250
|
| الفشل | السلوك |
|
|
253
251
|
|---------|----------|
|
|
254
|
-
| `customPoliciesPath` لم
|
|
255
|
-
|
|
|
256
|
-
| خطأ
|
|
257
|
-
| خطأ
|
|
258
|
-
| `fn`
|
|
259
|
-
| `fn` يستغرق
|
|
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
|
-
يحتوي
|
|
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` | سياسات الأمان
|
|
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
|
|
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
|