failproofai 0.0.6-beta.0 → 0.0.6-beta.2
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 +113 -0
- 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]__0a.nuas._.js → [root-of-the-server]__05akje6._.js} +2 -2
- 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]__0.~fd7s._.js → [root-of-the-server]__0i5kvry._.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]__0w6l33k._.js +6 -6
- 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/{0teq8wdh3po1n.js → 00j0rr7rh8ef8.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0maq.q1t.ri85.js → 05j1px0r8yzh6.js} +2 -2
- package/.next/standalone/.next/static/chunks/0badv41uxa56..js +4 -0
- package/.next/standalone/.next/static/chunks/{0hplx-8c-4vpv.js → 0ijk_kek9_wyx.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0uc0um_uz51m_.js → 0npb~873.wvg3.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0hctoh28rg838.js → 0xpl.oscrakvx.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0.z51twd.0l5z.js → 1052sguyd-.ka.js} +1 -1
- package/.next/standalone/.next/static/chunks/{09e7drilkf1sn.js → 12simlrcfk3g2.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0ul6fk-z.6k-0.js → 14cl9poem30dq.js} +1 -1
- package/.next/standalone/.next/static/chunks/{turbopack-0r26pc8h0y_-e.js → turbopack-0o7k.hakttp4k.js} +1 -1
- package/.next/standalone/CHANGELOG.md +19 -0
- package/.next/standalone/README.md +2 -2
- package/.next/standalone/bun.lock +43 -85
- package/.next/standalone/dist/cli.mjs +91 -4
- package/.next/standalone/docs/ar/built-in-policies.mdx +124 -87
- package/.next/standalone/docs/ar/custom-policies.mdx +72 -72
- package/.next/standalone/docs/ar/examples.mdx +86 -33
- package/.next/standalone/docs/ar/getting-started.mdx +82 -29
- package/.next/standalone/docs/built-in-policies.mdx +38 -1
- package/.next/standalone/docs/custom-policies.mdx +1 -1
- package/.next/standalone/docs/de/built-in-policies.mdx +93 -56
- package/.next/standalone/docs/de/custom-policies.mdx +56 -56
- package/.next/standalone/docs/de/examples.mdx +72 -18
- package/.next/standalone/docs/de/getting-started.mdx +72 -20
- package/.next/standalone/docs/es/built-in-policies.mdx +115 -78
- package/.next/standalone/docs/es/custom-policies.mdx +55 -55
- package/.next/standalone/docs/es/examples.mdx +73 -19
- package/.next/standalone/docs/es/getting-started.mdx +72 -20
- package/.next/standalone/docs/examples.mdx +54 -0
- package/.next/standalone/docs/fr/built-in-policies.mdx +83 -46
- package/.next/standalone/docs/fr/custom-policies.mdx +51 -51
- package/.next/standalone/docs/fr/examples.mdx +78 -24
- package/.next/standalone/docs/fr/getting-started.mdx +65 -13
- package/.next/standalone/docs/getting-started.mdx +52 -0
- package/.next/standalone/docs/he/built-in-policies.mdx +156 -117
- package/.next/standalone/docs/he/custom-policies.mdx +75 -75
- package/.next/standalone/docs/he/examples.mdx +87 -33
- package/.next/standalone/docs/he/getting-started.mdx +84 -33
- package/.next/standalone/docs/hi/built-in-policies.mdx +101 -60
- package/.next/standalone/docs/hi/custom-policies.mdx +71 -70
- package/.next/standalone/docs/hi/examples.mdx +90 -36
- package/.next/standalone/docs/hi/getting-started.mdx +80 -27
- package/.next/standalone/docs/i18n/README.ar.md +69 -69
- package/.next/standalone/docs/i18n/README.de.md +46 -46
- package/.next/standalone/docs/i18n/README.es.md +42 -42
- package/.next/standalone/docs/i18n/README.fr.md +39 -39
- package/.next/standalone/docs/i18n/README.he.md +83 -83
- package/.next/standalone/docs/i18n/README.hi.md +69 -69
- package/.next/standalone/docs/i18n/README.it.md +72 -72
- package/.next/standalone/docs/i18n/README.ja.md +71 -71
- package/.next/standalone/docs/i18n/README.ko.md +52 -52
- package/.next/standalone/docs/i18n/README.pt-br.md +44 -44
- package/.next/standalone/docs/i18n/README.ru.md +66 -66
- package/.next/standalone/docs/i18n/README.tr.md +82 -83
- package/.next/standalone/docs/i18n/README.vi.md +70 -71
- package/.next/standalone/docs/i18n/README.zh.md +51 -51
- package/.next/standalone/docs/it/built-in-policies.mdx +118 -81
- package/.next/standalone/docs/it/custom-policies.mdx +69 -69
- package/.next/standalone/docs/it/examples.mdx +93 -39
- package/.next/standalone/docs/it/getting-started.mdx +73 -21
- package/.next/standalone/docs/ja/built-in-policies.mdx +98 -61
- package/.next/standalone/docs/ja/custom-policies.mdx +71 -71
- package/.next/standalone/docs/ja/examples.mdx +76 -22
- package/.next/standalone/docs/ja/getting-started.mdx +65 -13
- package/.next/standalone/docs/ko/built-in-policies.mdx +137 -100
- package/.next/standalone/docs/ko/custom-policies.mdx +67 -67
- package/.next/standalone/docs/ko/examples.mdx +87 -33
- package/.next/standalone/docs/ko/getting-started.mdx +61 -9
- package/.next/standalone/docs/pt-br/built-in-policies.mdx +94 -57
- package/.next/standalone/docs/pt-br/custom-policies.mdx +56 -56
- package/.next/standalone/docs/pt-br/examples.mdx +78 -24
- package/.next/standalone/docs/pt-br/getting-started.mdx +64 -12
- package/.next/standalone/docs/ru/built-in-policies.mdx +142 -105
- package/.next/standalone/docs/ru/custom-policies.mdx +82 -81
- package/.next/standalone/docs/ru/examples.mdx +77 -22
- package/.next/standalone/docs/ru/getting-started.mdx +74 -22
- package/.next/standalone/docs/tr/built-in-policies.mdx +104 -67
- package/.next/standalone/docs/tr/custom-policies.mdx +59 -60
- package/.next/standalone/docs/tr/examples.mdx +97 -42
- package/.next/standalone/docs/tr/getting-started.mdx +75 -23
- package/.next/standalone/docs/vi/built-in-policies.mdx +110 -72
- package/.next/standalone/docs/vi/custom-policies.mdx +68 -68
- package/.next/standalone/docs/vi/examples.mdx +93 -38
- package/.next/standalone/docs/vi/getting-started.mdx +74 -22
- package/.next/standalone/docs/zh/built-in-policies.mdx +132 -95
- package/.next/standalone/docs/zh/custom-policies.mdx +49 -49
- package/.next/standalone/docs/zh/examples.mdx +90 -36
- package/.next/standalone/docs/zh/getting-started.mdx +73 -21
- 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 +106 -1
- package/README.md +2 -2
- package/dist/cli.mjs +91 -4
- package/package.json +2 -2
- package/src/hooks/builtin-policies.ts +106 -1
- package/.next/standalone/.next/static/chunks/0w9lwqy0-v1dk.js +0 -4
- /package/.next/standalone/.next/static/{8mygPGI5bzrtWK36ZYO59 → A9pNTZdoYJTVyPAYwQMx5}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{8mygPGI5bzrtWK36ZYO59 → A9pNTZdoYJTVyPAYwQMx5}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{8mygPGI5bzrtWK36ZYO59 → A9pNTZdoYJTVyPAYwQMx5}/_ssgManifest.js +0 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
---
|
|
3
2
|
title: Özel İlkeler
|
|
4
|
-
description: "JavaScript'te kendi ilkelerinizi yazın - kuralları uygulayın,
|
|
3
|
+
description: "JavaScript'te kendi ilkelerinizi yazın - kuralları uygulayın, sapmaları önleyin, hataları tespit edin, dış sistemlerle entegre olun"
|
|
5
4
|
icon: code
|
|
6
5
|
---
|
|
7
6
|
|
|
8
|
-
Özel ilkeler, herhangi bir agent davranışı için kurallar
|
|
7
|
+
Özel ilkeler, herhangi bir agent davranışı için kurallar yazmanızı sağlar: proje kurallarını uygulayın, sapmaları önleyin, yıkıcı işlemleri kontrol edin, takılı kalmış aracıları tespit edin veya Slack, onay iş akışları ve daha fazlası ile entegre olun. Yerleşik ilkeler ile aynı hook event sistemini ve `allow`, `deny`, `instruct` kararlarını kullanırlar.
|
|
9
8
|
|
|
10
9
|
---
|
|
11
10
|
|
|
@@ -40,34 +39,34 @@ failproofai policies --install --custom ./my-policies.js
|
|
|
40
39
|
|
|
41
40
|
## Özel ilkeleri yüklemenin iki yolu
|
|
42
41
|
|
|
43
|
-
### Seçenek 1: Kural tabanlı (
|
|
42
|
+
### Seçenek 1: Kural tabanlı (önerilen)
|
|
44
43
|
|
|
45
|
-
`*policies.{js,mjs,ts}` dosyalarını `.failproofai/policies/`
|
|
44
|
+
`*policies.{js,mjs,ts}` dosyalarını `.failproofai/policies/` klasörüne koyun ve otomatik olarak yüklenir — hiçbir bayrak veya yapılandırma değişikliği gerekmez. Bu git hooks gibi çalışır: dosyayı koyun, işte bu kadar.
|
|
46
45
|
|
|
47
46
|
```
|
|
48
|
-
# Proje düzeyi — git'e kaydedilir,
|
|
47
|
+
# Proje düzeyi — git'e kaydedilir, takım ile paylaşılır
|
|
49
48
|
.failproofai/policies/security-policies.mjs
|
|
50
49
|
.failproofai/policies/workflow-policies.mjs
|
|
51
50
|
|
|
52
|
-
# Kullanıcı düzeyi — kişisel, tüm
|
|
51
|
+
# Kullanıcı düzeyi — kişisel, tüm projeler için geçerli
|
|
53
52
|
~/.failproofai/policies/my-policies.mjs
|
|
54
53
|
```
|
|
55
54
|
|
|
56
55
|
**Nasıl çalışır:**
|
|
57
|
-
- Hem proje hem de kullanıcı dizinleri taranır (birleşim — ilk kapsam
|
|
58
|
-
- Dosyalar her
|
|
59
|
-
-
|
|
56
|
+
- Hem proje hem de kullanıcı dizinleri taranır (birleşim — ilk kapsam kazanması değil)
|
|
57
|
+
- Dosyalar her klasöre alfabetik olarak yüklenir. Sırayı kontrol etmek için `01-`, `02-` ön ekini kullanın
|
|
58
|
+
- Sadece `*policies.{js,mjs,ts}` ile eşleşen dosyalar yüklenir; diğer dosyalar göz ardı edilir
|
|
60
59
|
- Her dosya bağımsız olarak yüklenir (dosya başına açık başarısızlık)
|
|
61
|
-
- Açık `--custom` ve yerleşik
|
|
60
|
+
- Açık `--custom` ve yerleşik ilkeler ile yan yana çalışır
|
|
62
61
|
|
|
63
62
|
<Tip>
|
|
64
|
-
Kural tabanlı ilkeler,
|
|
63
|
+
Kural tabanlı ilkeler, kuruluşunuz için bir kalite standardı oluşturmanın en kolay yoludur. `.failproofai/policies/` git'e kaydedin ve her takım üyesi otomatik olarak aynı kuralları alır — geliştirici başına kurulum gerekmez. Takımınız yeni hata modları keşfettikçe, bir ilke ekleyin ve gönderin. Zaman içinde bu, her katkıyla iyileşen canlı bir kalite standardı haline gelir.
|
|
65
64
|
</Tip>
|
|
66
65
|
|
|
67
66
|
### Seçenek 2: Açık dosya yolu
|
|
68
67
|
|
|
69
68
|
```bash
|
|
70
|
-
# Özel ilkeler
|
|
69
|
+
# Özel ilkeler dosyası ile yükleyin
|
|
71
70
|
failproofai policies --install --custom ./my-policies.js
|
|
72
71
|
|
|
73
72
|
# İlkeler dosya yolunu değiştirin
|
|
@@ -77,13 +76,13 @@ failproofai policies --install --custom ./new-policies.js
|
|
|
77
76
|
failproofai policies --uninstall --custom
|
|
78
77
|
```
|
|
79
78
|
|
|
80
|
-
Çözümlenen mutlak yol, `policies-config.json`
|
|
79
|
+
Çözümlenen mutlak yol, `policies-config.json` içinde `customPoliciesPath` olarak depolanır. Dosya her hook eventinde yeniden yüklenir - eventler arasında önbellekleme yoktur.
|
|
81
80
|
|
|
82
81
|
### Her ikisini birlikte kullanma
|
|
83
82
|
|
|
84
|
-
Kural tabanlı ilkeler ve açık `--custom` dosyası
|
|
83
|
+
Kural tabanlı ilkeler ve açık `--custom` dosyası birlikte var olabilir. Yükleme sırası:
|
|
85
84
|
|
|
86
|
-
1. Açık `customPoliciesPath` dosyası (
|
|
85
|
+
1. Açık `customPoliciesPath` dosyası (yapılandırıldıysa)
|
|
87
86
|
2. Proje kural tabanlı dosyaları (`{cwd}/.failproofai/policies/`, alfabetik)
|
|
88
87
|
3. Kullanıcı kural tabanlı dosyaları (`~/.failproofai/policies/`, alfabetik)
|
|
89
88
|
|
|
@@ -91,7 +90,7 @@ Kural tabanlı ilkeler ve açık `--custom` dosyası bir arada bulunabilir. Yük
|
|
|
91
90
|
|
|
92
91
|
## API
|
|
93
92
|
|
|
94
|
-
### İçe
|
|
93
|
+
### İçe aktar
|
|
95
94
|
|
|
96
95
|
```js
|
|
97
96
|
import { customPolicies, allow, deny, instruct } from "failproofai";
|
|
@@ -103,9 +102,9 @@ Bir ilkeyi kaydeder. Aynı dosyada birden fazla ilke için gerektiği kadar ça
|
|
|
103
102
|
|
|
104
103
|
```ts
|
|
105
104
|
customPolicies.add({
|
|
106
|
-
name: string; //
|
|
107
|
-
description?: string; // `failproofai policies`
|
|
108
|
-
match?: { events?: HookEventType[] }; //
|
|
105
|
+
name: string; // required - unique identifier
|
|
106
|
+
description?: string; // shown in `failproofai policies` output
|
|
107
|
+
match?: { events?: HookEventType[] }; // filter by event type; omit to match all
|
|
109
108
|
fn: (ctx: PolicyContext) => PolicyResult | Promise<PolicyResult>;
|
|
110
109
|
});
|
|
111
110
|
```
|
|
@@ -114,30 +113,30 @@ customPolicies.add({
|
|
|
114
113
|
|
|
115
114
|
| İşlev | Etki | Ne zaman kullanılır |
|
|
116
115
|
|----------|--------|----------|
|
|
117
|
-
| `allow()` |
|
|
116
|
+
| `allow()` | İşlemi sessizce izin ver | İşlem güvenli, mesaj gerekmez |
|
|
118
117
|
| `deny(message)` | İşlemi engelle | Agent bu işlemi yapmamalı |
|
|
119
|
-
| `instruct(message)` |
|
|
118
|
+
| `instruct(message)` | Bloklama olmaksızın bağlam ekle | Agent'a yolda kalmak için ek bağlam ver |
|
|
120
119
|
|
|
121
|
-
`deny(message)` - ileti Claude'a `"Blocked by failproofai:"` ön ekiyle görünür. Tek bir `deny
|
|
120
|
+
`deny(message)` - ileti Claude'a `"Blocked by failproofai:"` ön ekiyle görünür. Tek bir `deny` tüm diğer değerlendirmeleri kısa devre yapar.
|
|
122
121
|
|
|
123
|
-
`instruct(message)` - ileti
|
|
122
|
+
`instruct(message)` - ileti Claude'un geçerli araç çağrısı için bağlamına eklenir. Tüm `instruct` iletileri birlikte biriktirilir ve gönderilir.
|
|
124
123
|
|
|
125
124
|
<Tip>
|
|
126
|
-
Kod
|
|
125
|
+
Kod değişikliği gerekmeksizin `deny` veya `instruct` iletisine ekstra rehberlik ekleyebilirsiniz — `policyParams` içine bir `hint` alanı ekleyerek. Bu özel (`custom/`), proje kural tabanlı (`.failproofai-project/`) ve kullanıcı kural tabanlı (`.failproofai-user/`) ilkeler için de çalışır. Ayrıntılar için [Yapılandırma → hint](/tr/configuration#hint-cross-cutting) bölümüne bakın.
|
|
127
126
|
</Tip>
|
|
128
127
|
|
|
129
|
-
###
|
|
128
|
+
### Bilgilendirme amaçlı izin iletileri
|
|
130
129
|
|
|
131
|
-
`allow(message)`
|
|
130
|
+
`allow(message)` işlemi izin verir **ve** Claude'a bilgilendirici bir ileti geri gönderir. İleti, hook işleyicisinin stdout yanıtında `additionalContext` olarak gönderilir — `instruct` ile aynı mekanizma kullanılır, ancak semantik olarak farklıdır: bu bir uyarı değil, durum güncellemesidir.
|
|
132
131
|
|
|
133
132
|
| İşlev | Etki | Ne zaman kullanılır |
|
|
134
133
|
|----------|--------|----------|
|
|
135
|
-
| `allow(message)` | İzin ver ve Claude'a bağlam gönder | Bir
|
|
134
|
+
| `allow(message)` | İzin ver ve Claude'a bağlam gönder | Bir kontrol başarılı olduğunu onaylayın veya kontrol atlanışını açıklayın |
|
|
136
135
|
|
|
137
136
|
Kullanım durumları:
|
|
138
137
|
- **Durum onayları:** `allow("All CI checks passed.")` — Claude'a her şeyin yeşil olduğunu söyler
|
|
139
|
-
- **Açık başarısızlık açıklamaları:** `allow("GitHub CLI not installed, skipping CI check.")` — Claude'a
|
|
140
|
-
- **Birden fazla ileti birikir:**
|
|
138
|
+
- **Açık başarısızlık açıklamaları:** `allow("GitHub CLI not installed, skipping CI check.")` — Claude'a kontrol atlanışını açıklar, böylece tam bağlama sahip olur
|
|
139
|
+
- **Birden fazla ileti birikir:** birden fazla ilke her biri `allow(message)` döndürürse, tüm iletiler satırbaşı ile birleştirilir ve birlikte gönderilir
|
|
141
140
|
|
|
142
141
|
```js
|
|
143
142
|
customPolicies.add({
|
|
@@ -163,7 +162,7 @@ customPolicies.add({
|
|
|
163
162
|
| `eventType` | `string` | `"PreToolUse"`, `"PostToolUse"`, `"Notification"`, `"Stop"` |
|
|
164
163
|
| `toolName` | `string \| undefined` | Çağrılan araç (ör. `"Bash"`, `"Write"`, `"Read"`) |
|
|
165
164
|
| `toolInput` | `Record<string, unknown> \| undefined` | Aracın giriş parametreleri |
|
|
166
|
-
| `payload` | `Record<string, unknown>` | Claude Code'dan tam ham event payload |
|
|
165
|
+
| `payload` | `Record<string, unknown>` | Claude Code'dan gelen tam ham event payload'ı |
|
|
167
166
|
| `session` | `SessionMetadata \| undefined` | Oturum bağlamı (aşağıya bakın) |
|
|
168
167
|
|
|
169
168
|
### `SessionMetadata` alanları
|
|
@@ -172,13 +171,13 @@ customPolicies.add({
|
|
|
172
171
|
|-------|------|-------------|
|
|
173
172
|
| `sessionId` | `string` | Claude Code oturum tanımlayıcısı |
|
|
174
173
|
| `cwd` | `string` | Claude Code oturumunun çalışma dizini |
|
|
175
|
-
| `transcriptPath` | `string` | Oturumun JSONL
|
|
174
|
+
| `transcriptPath` | `string` | Oturumun JSONL transkript dosyası yolu |
|
|
176
175
|
|
|
177
176
|
### Event türleri
|
|
178
177
|
|
|
179
|
-
| Event | Ne zaman
|
|
178
|
+
| Event | Ne zaman tetiklenir | `toolInput` içeriği |
|
|
180
179
|
|-------|--------------|----------------------|
|
|
181
|
-
| `PreToolUse` | Claude bir
|
|
180
|
+
| `PreToolUse` | Claude bir araç çalıştırmadan önce | Aracın girdisi (ör. Bash için `{ command: "..." }`) |
|
|
182
181
|
| `PostToolUse` | Bir araç tamamlandıktan sonra | Aracın girdisi + `tool_result` (çıktı) |
|
|
183
182
|
| `Notification` | Claude bir bildirim gönderdiğinde | `{ message: "...", notification_type: "idle" \| "permission_prompt" \| ... }` - hook'lar her zaman `allow()` döndürmelidir, bildirimleri engelleyemezler |
|
|
184
183
|
| `Stop` | Claude oturumu sona erdiğinde | Boş |
|
|
@@ -187,15 +186,15 @@ customPolicies.add({
|
|
|
187
186
|
|
|
188
187
|
## Değerlendirme sırası
|
|
189
188
|
|
|
190
|
-
İlkeler şu
|
|
189
|
+
İlkeler şu sırada değerlendirilir:
|
|
191
190
|
|
|
192
191
|
1. Yerleşik ilkeler (tanım sırasında)
|
|
193
|
-
2. `customPoliciesPath`
|
|
194
|
-
3. Proje `.failproofai/policies/`
|
|
195
|
-
4. Kullanıcı `~/.failproofai/policies/`
|
|
192
|
+
2. `customPoliciesPath` adresinden açık özel ilkeler (`.add()` sırasında)
|
|
193
|
+
3. Proje `.failproofai/policies/` adresinden kural tabanlı ilkeler (dosyalar alfabetik, içinde `.add()` sırası)
|
|
194
|
+
4. Kullanıcı `~/.failproofai/policies/` adresinden kural tabanlı ilkeler (dosyalar alfabetik, içinde `.add()` sırası)
|
|
196
195
|
|
|
197
196
|
<Note>
|
|
198
|
-
İlk `deny
|
|
197
|
+
İlk `deny` tüm sonraki ilkeleri kısa devre yapar. Tüm `instruct` iletileri biriktirilir ve birlikte gönderilir.
|
|
199
198
|
</Note>
|
|
200
199
|
|
|
201
200
|
---
|
|
@@ -219,43 +218,43 @@ customPolicies.add({
|
|
|
219
218
|
});
|
|
220
219
|
```
|
|
221
220
|
|
|
222
|
-
Giriş dosyasından
|
|
221
|
+
Giriş dosyasından erişilebilen tüm göreceli içe aktarmalar çözümlenir. Bu, `from "failproofai"` içe aktarmalarını gerçek dist yoluna yeniden yazarak ve ESM uyumluluğu sağlamak için geçici `.mjs` dosyaları oluşturarak uygulanır.
|
|
223
222
|
|
|
224
223
|
---
|
|
225
224
|
|
|
226
225
|
## Event türü filtrelemesi
|
|
227
226
|
|
|
228
|
-
Bir ilkenin ne zaman
|
|
227
|
+
Bir ilkenin ne zaman tetiklendiğini sınırlandırmak için `match.events` kullanın:
|
|
229
228
|
|
|
230
229
|
```js
|
|
231
230
|
customPolicies.add({
|
|
232
231
|
name: "require-summary-on-stop",
|
|
233
232
|
match: { events: ["Stop"] },
|
|
234
233
|
fn: async (ctx) => {
|
|
235
|
-
//
|
|
234
|
+
// Sadece oturum sona erdiğinde tetiklenir
|
|
236
235
|
// ctx.session.transcriptPath tam oturum günlüğünü içerir
|
|
237
236
|
return allow();
|
|
238
237
|
},
|
|
239
238
|
});
|
|
240
239
|
```
|
|
241
240
|
|
|
242
|
-
Her event türüne
|
|
241
|
+
Her event türüne tetiklenmek için `match` tamamen atlayın.
|
|
243
242
|
|
|
244
243
|
---
|
|
245
244
|
|
|
246
245
|
## Hata işleme ve başarısızlık modları
|
|
247
246
|
|
|
248
|
-
Özel ilkeler **açık
|
|
247
|
+
Özel ilkeler **açık başarısızlık** modundadır: hatalar yerleşik ilkeleri hiçbir zaman engelleme veya hook işleyiciyi kilitlemez.
|
|
249
248
|
|
|
250
249
|
| Başarısızlık | Davranış |
|
|
251
250
|
|---------|----------|
|
|
252
|
-
| `customPoliciesPath`
|
|
253
|
-
| Dosya bulunamadı | `~/.failproofai/hook.log`
|
|
254
|
-
| Söz dizimi/içe aktarma hatası (açık) |
|
|
255
|
-
| Söz dizimi/içe aktarma hatası (kural) | Hata
|
|
256
|
-
| `fn` çalışma zamanında
|
|
257
|
-
| `fn`
|
|
258
|
-
| Kural
|
|
251
|
+
| `customPoliciesPath` ayarlanmamış | Açık özel ilke çalışmaz; kural tabanlı ve yerleşik ilkeler normal şekilde devam eder |
|
|
252
|
+
| Dosya bulunamadı | `~/.failproofai/hook.log` adresine uyarı yazılır; yerleşik ilkeler devam eder |
|
|
253
|
+
| Söz dizimi/içe aktarma hatası (açık) | `~/.failproofai/hook.log` adresine hata yazılır; açık özel ilkeler atlanır |
|
|
254
|
+
| Söz dizimi/içe aktarma hatası (kural tabanlı) | Hata yazılır; bu dosya atlanır, diğer kural tabanlı dosyalar yüklenir |
|
|
255
|
+
| `fn` çalışma zamanında hatanın atılması | Hata yazılır; bu hook `allow` olarak işlem görür; diğer hook'lar devam eder |
|
|
256
|
+
| `fn` 10 saniyeden uzun süre alması | Zaman aşımı yazılır; `allow` olarak işlem görür |
|
|
257
|
+
| Kural tabanlı dizin eksik | Kural tabanlı ilke çalışmaz; hata yok |
|
|
259
258
|
|
|
260
259
|
<Tip>
|
|
261
260
|
Özel ilke hatalarını ayıklamak için günlük dosyasını izleyin:
|
|
@@ -273,7 +272,7 @@ tail -f ~/.failproofai/hook.log
|
|
|
273
272
|
// my-policies.js
|
|
274
273
|
import { customPolicies, allow, deny, instruct } from "failproofai";
|
|
275
274
|
|
|
276
|
-
// Agent'
|
|
275
|
+
// Agent'ın secrets/ dizinine yazmasını engelle
|
|
277
276
|
customPolicies.add({
|
|
278
277
|
name: "block-secrets-dir",
|
|
279
278
|
description: "Prevent agent from writing to secrets/ directory",
|
|
@@ -286,7 +285,7 @@ customPolicies.add({
|
|
|
286
285
|
},
|
|
287
286
|
});
|
|
288
287
|
|
|
289
|
-
// Agent'ı
|
|
288
|
+
// Agent'ı yolda tut: commit etmeden önce testleri doğrula
|
|
290
289
|
customPolicies.add({
|
|
291
290
|
name: "remind-test-before-commit",
|
|
292
291
|
description: "Keep the agent on track: verify tests pass before committing",
|
|
@@ -301,7 +300,7 @@ customPolicies.add({
|
|
|
301
300
|
},
|
|
302
301
|
});
|
|
303
302
|
|
|
304
|
-
//
|
|
303
|
+
// Donma döneminde planlanmamış bağımlılık değişikliklerini engelle
|
|
305
304
|
customPolicies.add({
|
|
306
305
|
name: "dependency-freeze",
|
|
307
306
|
description: "Prevent unplanned dependency changes during freeze period",
|
|
@@ -324,14 +323,14 @@ export { customPolicies };
|
|
|
324
323
|
|
|
325
324
|
## Örnekler
|
|
326
325
|
|
|
327
|
-
`examples/` dizini
|
|
326
|
+
`examples/` dizini çalıştırmaya hazır ilke dosyaları içerir:
|
|
328
327
|
|
|
329
328
|
| Dosya | İçerik |
|
|
330
329
|
|------|----------|
|
|
331
|
-
| `examples/policies-basic.js` | Yaygın agent
|
|
332
|
-
| `examples/policies-advanced/index.js` |
|
|
333
|
-
| `examples/convention-policies/security-policies.mjs` | Kural tabanlı güvenlik ilkeleri (.env
|
|
334
|
-
| `examples/convention-policies/workflow-policies.mjs` | Kural tabanlı iş akışı ilkeleri (test anımsatıcıları, denetim
|
|
330
|
+
| `examples/policies-basic.js` | Yaygın agent hata modlarını kapsayan beş başlatıcı ilke |
|
|
331
|
+
| `examples/policies-advanced/index.js` | Gelişmiş desenler: geçişli içe aktarmalar, zaman uyumsuz çağrılar, çıktı kazıyıcıları ve oturum sonu hook'ları |
|
|
332
|
+
| `examples/convention-policies/security-policies.mjs` | Kural tabanlı güvenlik ilkeleri (.env yazımları engelle, git geçmişi yeniden yazımını önle) |
|
|
333
|
+
| `examples/convention-policies/workflow-policies.mjs` | Kural tabanlı iş akışı ilkeleri (test anımsatıcıları, denetim dosya yazımları) |
|
|
335
334
|
|
|
336
335
|
### Açık dosya örneklerini kullanma
|
|
337
336
|
|
|
@@ -351,4 +350,4 @@ mkdir -p ~/.failproofai/policies
|
|
|
351
350
|
cp examples/convention-policies/*.mjs ~/.failproofai/policies/
|
|
352
351
|
```
|
|
353
352
|
|
|
354
|
-
Yükleme komutu gerekmez — dosyalar sonraki hook
|
|
353
|
+
Yükleme komutu gerekmez — dosyalar bir sonraki hook olayında otomatik olarak seçilir.
|
|
@@ -1,65 +1,66 @@
|
|
|
1
1
|
---
|
|
2
|
+
---
|
|
2
3
|
title: Örnekler
|
|
3
|
-
description: "Claude Code ve Agents SDK için hook'
|
|
4
|
+
description: "Claude Code ve Agents SDK için hook'lar nasıl ayarlanır"
|
|
4
5
|
icon: book-open
|
|
5
6
|
---
|
|
6
7
|
|
|
7
|
-
Yaygın senaryolar için kullanıma hazır örnekler. Her biri
|
|
8
|
+
Yaygın senaryolar için kullanıma hazır örnekler. Her biri nasıl yüklenileceğini ve ne beklenebileceğini gösterir.
|
|
8
9
|
|
|
9
10
|
---
|
|
10
11
|
|
|
11
|
-
## Claude Code için hook'
|
|
12
|
+
## Claude Code için hook'lar ayarlama
|
|
12
13
|
|
|
13
|
-
Failproof AI, Claude Code ile [hook'lar sistemi](https://docs.anthropic.com/en/docs/claude-code/hooks) aracılığıyla entegre olur. `failproofai policies --install` komutunu çalıştırdığınızda, Claude Code'un `settings.json` dosyasında her araç çağrısında
|
|
14
|
+
Failproof AI, Claude Code ile [hook'lar sistemi](https://docs.anthropic.com/en/docs/claude-code/hooks) aracılığıyla entegre olur. `failproofai policies --install` komutunu çalıştırdığınızda, Claude Code'un `settings.json` dosyasında her araç çağrısında çalışan hook komutları kaydedilir.
|
|
14
15
|
|
|
15
16
|
<Steps>
|
|
16
|
-
<Step title="failproofai
|
|
17
|
+
<Step title="failproofai yükle">
|
|
17
18
|
```bash
|
|
18
19
|
npm install -g failproofai
|
|
19
20
|
```
|
|
20
21
|
</Step>
|
|
21
|
-
<Step title="Tüm yerleşik politikaları
|
|
22
|
+
<Step title="Tüm yerleşik politikaları etkinleştir">
|
|
22
23
|
```bash
|
|
23
24
|
failproofai policies --install
|
|
24
25
|
```
|
|
25
26
|
</Step>
|
|
26
|
-
<Step title="Hook'ların
|
|
27
|
+
<Step title="Hook'ların kaydedildiğini doğrula">
|
|
27
28
|
```bash
|
|
28
29
|
cat ~/.claude/settings.json | grep failproofai
|
|
29
30
|
```
|
|
30
31
|
|
|
31
32
|
`PreToolUse`, `PostToolUse`, `Notification` ve `Stop` olayları için hook girdilerini görmelisiniz.
|
|
32
33
|
</Step>
|
|
33
|
-
<Step title="Claude Code'u
|
|
34
|
+
<Step title="Claude Code'u çalıştır">
|
|
34
35
|
```bash
|
|
35
36
|
claude
|
|
36
37
|
```
|
|
37
38
|
|
|
38
|
-
Politikalar
|
|
39
|
+
Politikalar artık her araç çağrısında otomatik olarak çalışır. Claude'dan `sudo rm -rf /` çalıştırmasını istemeyi deneyin - engellenir.
|
|
39
40
|
</Step>
|
|
40
41
|
</Steps>
|
|
41
42
|
|
|
42
43
|
---
|
|
43
44
|
|
|
44
|
-
## Agents SDK için hook'
|
|
45
|
+
## Agents SDK için hook'lar ayarlama
|
|
45
46
|
|
|
46
|
-
[Agents SDK](https://docs.anthropic.com/en/docs/agents-sdk) ile
|
|
47
|
+
[Agents SDK](https://docs.anthropic.com/en/docs/agents-sdk) ile geliştiriyorsanız, aynı hook sistemini programlı olarak kullanabilirsiniz.
|
|
47
48
|
|
|
48
49
|
<Steps>
|
|
49
|
-
<Step title="failproofai'
|
|
50
|
+
<Step title="failproofai'ı projenize yükle">
|
|
50
51
|
```bash
|
|
51
52
|
npm install failproofai
|
|
52
53
|
```
|
|
53
54
|
</Step>
|
|
54
|
-
<Step title="
|
|
55
|
-
Aracı işlemi oluştururken hook komutlarını geçin. Hook'lar Claude Code'
|
|
55
|
+
<Step title="Hook'ları aracınızda yapılandır">
|
|
56
|
+
Aracı işlemi oluştururken hook komutlarını geçin. Hook'lar Claude Code'dakiyle aynı şekilde çalışır - stdin/stdout JSON aracılığıyla:
|
|
56
57
|
|
|
57
58
|
```bash
|
|
58
|
-
failproofai --hook PreToolUse # her araçtan önce
|
|
59
|
-
failproofai --hook PostToolUse # her araçtan sonra
|
|
59
|
+
failproofai --hook PreToolUse # her araçtan önce çalışır
|
|
60
|
+
failproofai --hook PostToolUse # her araçtan sonra çalışır
|
|
60
61
|
```
|
|
61
62
|
</Step>
|
|
62
|
-
<Step title="Aracınız için özel
|
|
63
|
+
<Step title="Aracınız için özel politika yaz">
|
|
63
64
|
```javascript
|
|
64
65
|
import { customPolicies, allow, deny } from "failproofai";
|
|
65
66
|
|
|
@@ -77,7 +78,7 @@ Failproof AI, Claude Code ile [hook'lar sistemi](https://docs.anthropic.com/en/d
|
|
|
77
78
|
});
|
|
78
79
|
```
|
|
79
80
|
</Step>
|
|
80
|
-
<Step title="Özel politikayı
|
|
81
|
+
<Step title="Özel politikayı yükle">
|
|
81
82
|
```bash
|
|
82
83
|
failproofai policies --install --custom ./my-agent-policies.js
|
|
83
84
|
```
|
|
@@ -86,37 +87,37 @@ Failproof AI, Claude Code ile [hook'lar sistemi](https://docs.anthropic.com/en/d
|
|
|
86
87
|
|
|
87
88
|
---
|
|
88
89
|
|
|
89
|
-
## Yıkıcı komutları
|
|
90
|
+
## Yıkıcı komutları engelle
|
|
90
91
|
|
|
91
|
-
En yaygın kurulum -
|
|
92
|
+
En yaygın kurulum - aracıların geri döndürülemez hasarlar vermesini önle.
|
|
92
93
|
|
|
93
94
|
```bash
|
|
94
95
|
failproofai policies --install block-sudo block-rm-rf block-force-push block-curl-pipe-sh
|
|
95
96
|
```
|
|
96
97
|
|
|
97
|
-
Bunu yapar:
|
|
98
|
+
Bunu ne yapar:
|
|
98
99
|
- `block-sudo` - tüm `sudo` komutlarını engeller
|
|
99
100
|
- `block-rm-rf` - özyinelemeli dosya silmeyi engeller
|
|
100
|
-
- `block-force-push` - `git push --force`
|
|
101
|
-
- `block-curl-pipe-sh` - uzak
|
|
101
|
+
- `block-force-push` - `git push --force` komutunu engeller
|
|
102
|
+
- `block-curl-pipe-sh` - uzak betikleri shell'e aktarmayı engeller
|
|
102
103
|
|
|
103
104
|
---
|
|
104
105
|
|
|
105
|
-
##
|
|
106
|
+
## Sır sızıntısını önle
|
|
106
107
|
|
|
107
|
-
|
|
108
|
+
Aracıların kimlik bilgilerini görmesini veya araç çıktısında sızıntısını yapmasını engelle.
|
|
108
109
|
|
|
109
110
|
```bash
|
|
110
111
|
failproofai policies --install sanitize-api-keys sanitize-jwt sanitize-connection-strings sanitize-bearer-tokens
|
|
111
112
|
```
|
|
112
113
|
|
|
113
|
-
Bunlar `PostToolUse`
|
|
114
|
+
Bunlar `PostToolUse` üzerine çalışır - bir araç çalıştıktan sonra, aracı görmeden önce çıktıyı temizlerler.
|
|
114
115
|
|
|
115
116
|
---
|
|
116
117
|
|
|
117
|
-
##
|
|
118
|
+
## Aracılara dikkat edilmesine gerek duyulduğunda Slack uyarıları al
|
|
118
119
|
|
|
119
|
-
|
|
120
|
+
Boş uyarılarını Slack'a iletmek için bildirim hook'unu kullan.
|
|
120
121
|
|
|
121
122
|
```javascript
|
|
122
123
|
import { customPolicies, allow, instruct } from "failproofai";
|
|
@@ -150,7 +151,7 @@ customPolicies.add({
|
|
|
150
151
|
});
|
|
151
152
|
```
|
|
152
153
|
|
|
153
|
-
|
|
154
|
+
Yükle:
|
|
154
155
|
|
|
155
156
|
```bash
|
|
156
157
|
SLACK_WEBHOOK_URL=https://hooks.slack.com/... failproofai policies --install --custom ./slack-alerts.js
|
|
@@ -158,9 +159,9 @@ SLACK_WEBHOOK_URL=https://hooks.slack.com/... failproofai policies --install --c
|
|
|
158
159
|
|
|
159
160
|
---
|
|
160
161
|
|
|
161
|
-
##
|
|
162
|
+
## Aracıları bir dal üzerinde tut
|
|
162
163
|
|
|
163
|
-
|
|
164
|
+
Aracıların dal değiştirmesini veya korunan dallara push yapmasını engelle.
|
|
164
165
|
|
|
165
166
|
```javascript
|
|
166
167
|
import { customPolicies, allow, deny } from "failproofai";
|
|
@@ -182,9 +183,9 @@ customPolicies.add({
|
|
|
182
183
|
|
|
183
184
|
---
|
|
184
185
|
|
|
185
|
-
## Commit'ten önce testler
|
|
186
|
+
## Commit'ten önce testler iste
|
|
186
187
|
|
|
187
|
-
|
|
188
|
+
Aracıları commit'ten önce testleri çalıştırmaya hatırlat.
|
|
188
189
|
|
|
189
190
|
```javascript
|
|
190
191
|
import { customPolicies, allow, instruct } from "failproofai";
|
|
@@ -208,9 +209,9 @@ customPolicies.add({
|
|
|
208
209
|
|
|
209
210
|
## Üretim deposunu kilitle
|
|
210
211
|
|
|
211
|
-
|
|
212
|
+
Proje seviyesi config'i işle et, böylece ekibindeki her geliştirici aynı politikaları alır.
|
|
212
213
|
|
|
213
|
-
|
|
214
|
+
Reponuzda `.failproofai/policies-config.json` oluştur:
|
|
214
215
|
|
|
215
216
|
```json
|
|
216
217
|
{
|
|
@@ -231,23 +232,77 @@ Deponuzda `.failproofai/policies-config.json` dosyasını oluşturun:
|
|
|
231
232
|
}
|
|
232
233
|
```
|
|
233
234
|
|
|
234
|
-
Sonra
|
|
235
|
+
Sonra işle et:
|
|
235
236
|
|
|
236
237
|
```bash
|
|
237
238
|
git add .failproofai/policies-config.json
|
|
238
239
|
git commit -m "Add failproofai team policies"
|
|
239
240
|
```
|
|
240
241
|
|
|
241
|
-
failproofai
|
|
242
|
+
failproofai yüklü olan her ekip üyesi otomatik olarak bu kuralları alır.
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Convention politikaları ile kuruluş çapında bir kalite standardı oluştur
|
|
247
|
+
|
|
248
|
+
En etkili kurulum: reponuza `.failproofai/policies/` işle et ve projenize uyarlanmış politikalar ekle. Her ekip üyesi onları otomatik olarak alır — yükleme komutları yok, yapılandırma değişiklikleri yok.
|
|
249
|
+
|
|
250
|
+
<Steps>
|
|
251
|
+
<Step title="Dizini oluştur ve politikalar ekle">
|
|
252
|
+
```bash
|
|
253
|
+
mkdir -p .failproofai/policies
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
```js
|
|
257
|
+
// .failproofai/policies/team-policies.mjs
|
|
258
|
+
import { customPolicies, allow, deny, instruct } from "failproofai";
|
|
259
|
+
|
|
260
|
+
// Enforce your team's preferred package manager
|
|
261
|
+
// (or enable the built-in prefer-package-manager policy instead)
|
|
262
|
+
customPolicies.add({
|
|
263
|
+
name: "enforce-bun",
|
|
264
|
+
match: { events: ["PreToolUse"] },
|
|
265
|
+
fn: async (ctx) => {
|
|
266
|
+
if (ctx.toolName !== "Bash") return allow();
|
|
267
|
+
const cmd = String(ctx.toolInput?.command ?? "");
|
|
268
|
+
if (/\bnpm\b/.test(cmd)) return deny("Use bun instead of npm.");
|
|
269
|
+
return allow();
|
|
270
|
+
},
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
// Remind the agent to run tests before committing
|
|
274
|
+
customPolicies.add({
|
|
275
|
+
name: "test-before-commit",
|
|
276
|
+
match: { events: ["PreToolUse"] },
|
|
277
|
+
fn: async (ctx) => {
|
|
278
|
+
if (ctx.toolName !== "Bash") return allow();
|
|
279
|
+
if (/git\s+commit/.test(ctx.toolInput?.command ?? "")) {
|
|
280
|
+
return instruct("Run tests before committing.");
|
|
281
|
+
}
|
|
282
|
+
return allow();
|
|
283
|
+
},
|
|
284
|
+
});
|
|
285
|
+
```
|
|
286
|
+
</Step>
|
|
287
|
+
<Step title="Git'e işle et">
|
|
288
|
+
```bash
|
|
289
|
+
git add .failproofai/policies/
|
|
290
|
+
git commit -m "Add team quality policies"
|
|
291
|
+
```
|
|
292
|
+
</Step>
|
|
293
|
+
<Step title="İyileştirmeye devam et">
|
|
294
|
+
Ekibiniz yeni hata modlarıyla karşılaştıkça, politikalar ekle ve push et. Herkes sonraki `git pull` işleminde güncellemeyi alır. Bu politikalar, ekibinizle birlikte gelişen canlı bir kalite standardı haline gelir.
|
|
295
|
+
</Step>
|
|
296
|
+
</Steps>
|
|
242
297
|
|
|
243
298
|
---
|
|
244
299
|
|
|
245
300
|
## Daha fazla örnek
|
|
246
301
|
|
|
247
|
-
|
|
302
|
+
Repodaki [`examples/`](https://github.com/exospherehost/failproofai/tree/main/examples) dizini şunları içerir:
|
|
248
303
|
|
|
249
|
-
| Dosya |
|
|
304
|
+
| Dosya | Ne gösterir |
|
|
250
305
|
|------|---------------|
|
|
251
|
-
| `policies-basic.js` | Başlangıç politikaları - üretim
|
|
252
|
-
| `policies-notification.js` |
|
|
253
|
-
| `policies-advanced/index.js` | Geçişli
|
|
306
|
+
| `policies-basic.js` | Başlangıç politikaları - üretim yazılarını, force-push'u, boru hattı betiklerini engelle |
|
|
307
|
+
| `policies-notification.js` | Boş bildirimler ve oturum sonu için Slack uyarıları |
|
|
308
|
+
| `policies-advanced/index.js` | Geçişli importlar, eşzamansız hook'lar, PostToolUse çıktısı temizliği, Stop olayı işleme |
|