> ## Documentation Index
> Fetch the complete documentation index at: https://exosphere-auto-translate-docs-20260623-1106.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# البدء السريع

> ثبّت failproofai، فعّل السياسات، واترك وكلاءك يعملون بموثوقية

## المتطلبات

* **Node.js** >= 20.9.0
* **Bun** >= 1.3.0 (اختياري - مطلوب فقط عند البناء من المصدر)

***

## التثبيت

<CodeGroup>
  ```bash npm theme={null}
  npm install -g failproofai
  ```

  ```bash bun theme={null}
  bun add -g failproofai
  ```
</CodeGroup>

***

## البدء السريع

<Steps>
  <Step title="فعّل السياسات">
    السياسات هي قواعد تعمل قبل وبعد كل استدعاء أداة للوكيل. تعترض الأوامر التدميرية وتسريب الأسرار وأوضاع الفشل الأخرى قبل أن تسبب ضررًا.

    ```bash theme={null}
    failproofai policies --install
    ```

    يكتب هذا إدخالات hooks في واجهات سطر الأوامر المثبتة للوكيل (ملف Claude Code `~/.claude/settings.json`، ملف OpenAI Codex `~/.codex/hooks.json`، ملف GitHub Copilot CLI `~/.copilot/hooks/failproofai.json`، ملف Cursor Agent `~/.cursor/hooks.json`، ملف المكون الإضافي المُنشأ من OpenCode في `~/.config/opencode/plugins/failproofai.mjs` بالإضافة إلى إدخال تسجيل في مصفوفة `plugin` الخاصة بـ `~/.config/opencode/opencode.json`، ملف Pi `~/.pi/agent/settings.json`، أو ملف Gemini CLI `~/.gemini/settings.json`). عندما يكون هناك أكثر من واحد، ستُطلب منك الخيارات؛ مرر `--cli claude codex copilot cursor opencode pi gemini` (أي مجموعة جزئية) لتخطي الطلب.

    دعم GitHub Copilot CLI و Cursor Agent و OpenCode و Pi و Gemini CLI هو **إصدار تجريبي** — ثبّت باستخدام `--cli copilot` أو `--cli cursor` أو `--cli opencode` أو `--cli pi` أو `--cli gemini`.

    ```bash theme={null}
    failproofai policies --install --scope project
    failproofai policies --install --cli codex --scope project
    failproofai policies --install --cli copilot --scope project
    failproofai policies --install --cli cursor --scope project
    failproofai policies --install --cli opencode --scope project
    failproofai policies --install --cli pi --scope project
    failproofai policies --install --cli gemini --scope project
    failproofai policies --install block-sudo block-rm-rf sanitize-api-keys
    ```
  </Step>

  <Step title="تحقق">
    ```bash theme={null}
    failproofai policies
    ```

    يعرض كل سياسة، وما إذا كانت مفعلة، وأي معاملات مُكوّنة.
  </Step>

  <Step title="شغّل لوحة المعلومات">
    ```bash theme={null}
    failproofai
    ```

    يفتح لوحة معلومات محلية على `http://localhost:8020` حيث يمكنك استعراض الجلسات وفحص استدعاءات الأدوات وإدارة السياسات.
  </Step>

  <Step title="شغّل وكيلك">
    شغّل Claude Code كالمعتاد. إذا حاول الوكيل فعل شيء محفوف بالمخاطر، فإن failproofai سيعترضه تلقائيًا. اتركه يعمل بدون مراقبة واستعرض ما حدث في لوحة المعلومات.
  </Step>
</Steps>

***

## كيف تعمل السياسات

في كل مرة يشغّل الوكيل أداة، يستدعي Claude Code failproofai كعملية فرعية:

```text theme={null}
Claude Code  →  failproofai --hook PreToolUse  →  reads stdin JSON
                                                 evaluates policies
                                                 writes decision to stdout
```

تُرجع كل سياسة واحدة من ثلاث قرارات:

* **allow** - يستمر الوكيل بشكل طبيعي
* **deny** - يتم حجب الإجراء، يُخبر الوكيل السبب
* **instruct** - يتم إضافة سياق إضافي إلى مطالبة الوكيل

<Note>
  تعمل السياسات في عمليتك المحلية. لا يتم إرسال أي شيء إلى خدمة بعيدة.
</Note>

***

## اضبط سياسات الفريق باستخدام السياسات المبنية على الاتفاقيات

أسرع طريقة لإنشاء معايير الجودة عبر فريقك هي اتفاقية `.failproofai/policies/`. أسقط ملفات السياسات في هذا المجلد وسيتم تحميلها تلقائيًا — لا أعلام، لا تغييرات في الإعدادات، لا أوامر تثبيت.

<Steps>
  <Step title="إنشاء مجلد السياسات">
    ```bash theme={null}
    mkdir -p .failproofai/policies
    ```
  </Step>

  <Step title="إضافة ملفات السياسات">
    انسخ الأمثلة الأولية أو اكتب ملفاتك الخاصة:

    ```bash theme={null}
    cp node_modules/failproofai/examples/convention-policies/*.mjs .failproofai/policies/
    ```

    أو أنشئ واحدة جديدة:

    ```js theme={null}
    // .failproofai/policies/team-policies.mjs
    import { customPolicies, allow, deny, instruct } from "failproofai";

    customPolicies.add({
      name: "test-before-commit",
      match: { events: ["PreToolUse"] },
      fn: async (ctx) => {
        if (ctx.toolName !== "Bash") return allow();
        if (/git\s+commit/.test(ctx.toolInput?.command ?? "")) {
          return instruct("Run tests before committing.");
        }
        return allow();
      },
    });
    ```
  </Step>

  <Step title="ارفع إلى git">
    ```bash theme={null}
    git add .failproofai/policies/
    git commit -m "Add team quality policies"
    ```

    كل عضو في الفريق لديه failproofai مثبتًا سيستقبل هذه السياسات تلقائيًا. لا توجد حاجة لإعداد لكل مطور.
  </Step>
</Steps>

<Tip>
  التزم بـ `.failproofai/policies/` في مستودعك حتى يشارك الفريق بأكمله نفس المعايير. مع اكتشاف فريقك لأوضاع فشل جديدة، أضف سياسات واضغط — سيحصل الجميع على التحديث في `git pull` التالي. بمرور الوقت، تصبح هذه السياسات معيارًا جودة حيًا يستمر في التحسن.
</Tip>

***

## تخزين البيانات

تبقى جميع الإعدادات والسجلات على جهازك:

| المسار                                    | ما يخزنه                            |
| ----------------------------------------- | ----------------------------------- |
| `~/.failproofai/policies-config.json`     | إعدادات السياسة العامة              |
| `~/.failproofai/hook-activity.jsonl`      | سجل تنفيذ Hook                      |
| `~/.failproofai/hook.log`                 | سجل تصحيح أخطاء أداة Hook المخصصة   |
| `.failproofai/policies-config.json`       | إعدادات كل مشروع (مرتكبة)           |
| `.failproofai/policies-config.local.json` | التجاوزات الشخصية (مُستثناة من git) |

***

## الإزالة

```bash theme={null}
failproofai policies --uninstall
```

يزيل إدخالات hooks من `~/.claude/settings.json`. يتم الاحتفاظ بملفات الإعدادات في `~/.failproofai/`.

***

## الخطوات التالية

<CardGroup cols={2}>
  <Card title="الإعدادات" icon="gear" href="/ar/configuration">
    النطاقات وتنسيق ملف الإعدادات
  </Card>

  <Card title="السياسات المدمجة" icon="shield" href="/ar/built-in-policies">
    جميع 26 سياسة مع المعاملات
  </Card>

  <Card title="السياسات المخصصة" icon="code" href="/ar/custom-policies">
    اكتب سياساتك الخاصة في JavaScript
  </Card>

  <Card title="مراقب الوكيل" icon="chart-line" href="/ar/dashboard">
    راقب الجلسات واستعرض نشاط السياسة
  </Card>
</CardGroup>
