failproofai 0.0.2 → 0.0.4-beta.0
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/.claude/settings.json +316 -0
- package/.next/standalone/.failproofai/policies/workflow-policies.mjs +62 -0
- package/.next/standalone/.failproofai/policies-config.json +39 -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 +3 -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 +17 -17
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +17 -17
- 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 +11 -11
- 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 +2 -2
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +16 -16
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +16 -16
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +11 -11
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- 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 +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0kjo7d_._.js +1 -1
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_05pz9._._.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]__0qo8503._.js → [root-of-the-server]__0jqus-j._.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 +9 -9
- 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/{[root-of-the-server]__12kr5~_._.js → [root-of-the-server]__131id~1._.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/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0a_7sdg.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0ef3uwk.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0j79~gv.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0pbja1x.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0r6o0i2.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_11y81~_.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_12or2kf.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_0mebn66._.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/{0y~0creqvl5wx.js → 045lpk_isd5np.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0cvffh-pbsv5u.js → 065qrrpfkts8s.js} +1 -1
- package/.next/standalone/.next/static/chunks/{031pa5~qfzt~_.js → 09e7drilkf1sn.js} +1 -1
- package/.next/standalone/.next/static/chunks/0gu_a.a80ritd.css +1 -0
- package/.next/standalone/.next/static/chunks/{15wf7x-e.8ia3.js → 0je_~y72wv~~2.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0x-625~1vx1lu.js → 0rqcttnl9u32c.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0ov60i6md~37t.js → 0v2-.v07.zb9u.js} +2 -2
- package/.next/standalone/.next/static/chunks/{06og.7e9nkpjh.js → 0yye9-w._6rz~.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0_4y_t03jn2nq.js → 15proylk5ye2k.js} +1 -1
- package/.next/standalone/.next/static/chunks/174boqk9e~20i.js +6 -0
- package/.next/standalone/.next/static/chunks/{turbopack-0uc5y~g6h.n7-.js → turbopack-0r26pc8h0y_-e.js} +1 -1
- package/.next/standalone/CHANGELOG.md +108 -0
- package/.next/standalone/CLAUDE.md +28 -0
- package/.next/standalone/Dockerfile.docs +12 -0
- package/.next/standalone/README.md +95 -49
- package/.next/standalone/app/components/session-hooks-panel.tsx +14 -1
- package/.next/standalone/app/policies/hooks-client.tsx +14 -1
- package/.next/standalone/bin/failproofai.mjs +5 -0
- package/.next/standalone/bun.lock +76 -63
- package/.next/standalone/components/navbar.tsx +5 -0
- package/.next/standalone/dist/cli.mjs +535 -90
- package/.next/standalone/dist/index.js +2 -2
- package/.next/standalone/docs/ar/architecture.mdx +333 -0
- package/.next/standalone/docs/ar/built-in-policies.mdx +537 -0
- package/.next/standalone/docs/ar/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/ar/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/ar/cli/hook.mdx +31 -0
- package/.next/standalone/docs/ar/cli/install-policies.mdx +48 -0
- package/.next/standalone/docs/ar/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/ar/cli/remove-policies.mdx +43 -0
- package/.next/standalone/docs/ar/cli/version.mdx +13 -0
- package/.next/standalone/docs/ar/configuration.mdx +223 -0
- package/.next/standalone/docs/ar/custom-policies.mdx +359 -0
- package/.next/standalone/docs/ar/dashboard.mdx +142 -0
- package/.next/standalone/docs/ar/examples.mdx +254 -0
- package/.next/standalone/docs/ar/for-agents.mdx +39 -0
- package/.next/standalone/docs/ar/getting-started.mdx +134 -0
- package/.next/standalone/docs/ar/introduction.mdx +58 -0
- package/.next/standalone/docs/ar/package-aliases.mdx +82 -0
- package/.next/standalone/docs/ar/testing.mdx +261 -0
- package/.next/standalone/docs/{architecture.md → architecture.mdx} +40 -23
- package/.next/standalone/docs/{built-in-policies.md → built-in-policies.mdx} +126 -15
- package/.next/standalone/docs/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/cli/hook.mdx +30 -0
- package/.next/standalone/docs/cli/install-policies.mdx +47 -0
- package/.next/standalone/docs/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/cli/remove-policies.mdx +43 -0
- package/.next/standalone/docs/cli/version.mdx +12 -0
- package/.next/standalone/docs/{configuration.md → configuration.mdx} +62 -16
- package/.next/standalone/docs/custom-policies.mdx +357 -0
- package/.next/standalone/docs/{dashboard.md → dashboard.mdx} +26 -29
- package/.next/standalone/docs/de/architecture.mdx +332 -0
- package/.next/standalone/docs/de/built-in-policies.mdx +537 -0
- package/.next/standalone/docs/de/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/de/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/de/cli/hook.mdx +30 -0
- package/.next/standalone/docs/de/cli/install-policies.mdx +47 -0
- package/.next/standalone/docs/de/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/de/cli/remove-policies.mdx +43 -0
- package/.next/standalone/docs/de/cli/version.mdx +12 -0
- package/.next/standalone/docs/de/configuration.mdx +222 -0
- package/.next/standalone/docs/de/custom-policies.mdx +357 -0
- package/.next/standalone/docs/de/dashboard.mdx +142 -0
- package/.next/standalone/docs/de/examples.mdx +253 -0
- package/.next/standalone/docs/de/for-agents.mdx +38 -0
- package/.next/standalone/docs/de/getting-started.mdx +134 -0
- package/.next/standalone/docs/de/introduction.mdx +57 -0
- package/.next/standalone/docs/de/package-aliases.mdx +82 -0
- package/.next/standalone/docs/de/testing.mdx +260 -0
- package/.next/standalone/docs/docs.json +943 -24
- package/.next/standalone/docs/es/architecture.mdx +332 -0
- package/.next/standalone/docs/es/built-in-policies.mdx +537 -0
- package/.next/standalone/docs/es/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/es/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/es/cli/hook.mdx +30 -0
- package/.next/standalone/docs/es/cli/install-policies.mdx +47 -0
- package/.next/standalone/docs/es/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/es/cli/remove-policies.mdx +43 -0
- package/.next/standalone/docs/es/cli/version.mdx +12 -0
- package/.next/standalone/docs/es/configuration.mdx +222 -0
- package/.next/standalone/docs/es/custom-policies.mdx +357 -0
- package/.next/standalone/docs/es/dashboard.mdx +142 -0
- package/.next/standalone/docs/es/examples.mdx +253 -0
- package/.next/standalone/docs/es/for-agents.mdx +38 -0
- package/.next/standalone/docs/es/getting-started.mdx +134 -0
- package/.next/standalone/docs/es/introduction.mdx +57 -0
- package/.next/standalone/docs/es/package-aliases.mdx +82 -0
- package/.next/standalone/docs/es/testing.mdx +260 -0
- package/.next/standalone/docs/examples.mdx +253 -0
- package/.next/standalone/docs/for-agents.mdx +38 -0
- package/.next/standalone/docs/fr/architecture.mdx +332 -0
- package/.next/standalone/docs/fr/built-in-policies.mdx +537 -0
- package/.next/standalone/docs/fr/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/fr/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/fr/cli/hook.mdx +30 -0
- package/.next/standalone/docs/fr/cli/install-policies.mdx +47 -0
- package/.next/standalone/docs/fr/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/fr/cli/remove-policies.mdx +43 -0
- package/.next/standalone/docs/fr/cli/version.mdx +12 -0
- package/.next/standalone/docs/fr/configuration.mdx +222 -0
- package/.next/standalone/docs/fr/custom-policies.mdx +357 -0
- package/.next/standalone/docs/fr/dashboard.mdx +142 -0
- package/.next/standalone/docs/fr/examples.mdx +253 -0
- package/.next/standalone/docs/fr/for-agents.mdx +38 -0
- package/.next/standalone/docs/fr/getting-started.mdx +134 -0
- package/.next/standalone/docs/fr/introduction.mdx +57 -0
- package/.next/standalone/docs/fr/package-aliases.mdx +82 -0
- package/.next/standalone/docs/fr/testing.mdx +260 -0
- package/.next/standalone/docs/getting-started.mdx +134 -0
- package/.next/standalone/docs/he/architecture.mdx +333 -0
- package/.next/standalone/docs/he/built-in-policies.mdx +535 -0
- package/.next/standalone/docs/he/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/he/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/he/cli/hook.mdx +30 -0
- package/.next/standalone/docs/he/cli/install-policies.mdx +47 -0
- package/.next/standalone/docs/he/cli/list-policies.mdx +32 -0
- package/.next/standalone/docs/he/cli/remove-policies.mdx +43 -0
- package/.next/standalone/docs/he/cli/version.mdx +12 -0
- package/.next/standalone/docs/he/configuration.mdx +222 -0
- package/.next/standalone/docs/he/custom-policies.mdx +357 -0
- package/.next/standalone/docs/he/dashboard.mdx +142 -0
- package/.next/standalone/docs/he/examples.mdx +253 -0
- package/.next/standalone/docs/he/for-agents.mdx +38 -0
- package/.next/standalone/docs/he/getting-started.mdx +135 -0
- package/.next/standalone/docs/he/introduction.mdx +57 -0
- package/.next/standalone/docs/he/package-aliases.mdx +82 -0
- package/.next/standalone/docs/he/testing.mdx +260 -0
- package/.next/standalone/docs/hi/architecture.mdx +334 -0
- package/.next/standalone/docs/hi/built-in-policies.mdx +535 -0
- package/.next/standalone/docs/hi/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/hi/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/hi/cli/hook.mdx +30 -0
- package/.next/standalone/docs/hi/cli/install-policies.mdx +47 -0
- package/.next/standalone/docs/hi/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/hi/cli/remove-policies.mdx +43 -0
- package/.next/standalone/docs/hi/cli/version.mdx +12 -0
- package/.next/standalone/docs/hi/configuration.mdx +222 -0
- package/.next/standalone/docs/hi/custom-policies.mdx +357 -0
- package/.next/standalone/docs/hi/dashboard.mdx +142 -0
- package/.next/standalone/docs/hi/examples.mdx +255 -0
- package/.next/standalone/docs/hi/for-agents.mdx +38 -0
- package/.next/standalone/docs/hi/getting-started.mdx +134 -0
- package/.next/standalone/docs/hi/introduction.mdx +57 -0
- package/.next/standalone/docs/hi/package-aliases.mdx +82 -0
- package/.next/standalone/docs/hi/testing.mdx +260 -0
- package/.next/standalone/docs/i18n/README.ar.md +312 -0
- package/.next/standalone/docs/i18n/README.de.md +307 -0
- package/.next/standalone/docs/i18n/README.es.md +307 -0
- package/.next/standalone/docs/i18n/README.fr.md +307 -0
- package/.next/standalone/docs/i18n/README.he.md +312 -0
- package/.next/standalone/docs/i18n/README.hi.md +307 -0
- package/.next/standalone/docs/i18n/README.it.md +307 -0
- package/.next/standalone/docs/i18n/README.ja.md +307 -0
- package/.next/standalone/docs/i18n/README.ko.md +307 -0
- package/.next/standalone/docs/i18n/README.pt-br.md +307 -0
- package/.next/standalone/docs/i18n/README.ru.md +308 -0
- package/.next/standalone/docs/i18n/README.tr.md +308 -0
- package/.next/standalone/docs/i18n/README.vi.md +308 -0
- package/.next/standalone/docs/i18n/README.zh.md +307 -0
- package/.next/standalone/docs/introduction.mdx +57 -0
- package/.next/standalone/docs/it/architecture.mdx +333 -0
- package/.next/standalone/docs/it/built-in-policies.mdx +537 -0
- package/.next/standalone/docs/it/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/it/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/it/cli/hook.mdx +30 -0
- package/.next/standalone/docs/it/cli/install-policies.mdx +47 -0
- package/.next/standalone/docs/it/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/it/cli/remove-policies.mdx +43 -0
- package/.next/standalone/docs/it/cli/version.mdx +12 -0
- package/.next/standalone/docs/it/configuration.mdx +223 -0
- package/.next/standalone/docs/it/custom-policies.mdx +358 -0
- package/.next/standalone/docs/it/dashboard.mdx +142 -0
- package/.next/standalone/docs/it/examples.mdx +253 -0
- package/.next/standalone/docs/it/for-agents.mdx +38 -0
- package/.next/standalone/docs/it/getting-started.mdx +134 -0
- package/.next/standalone/docs/it/introduction.mdx +57 -0
- package/.next/standalone/docs/it/package-aliases.mdx +82 -0
- package/.next/standalone/docs/it/testing.mdx +260 -0
- package/.next/standalone/docs/ja/architecture.mdx +332 -0
- package/.next/standalone/docs/ja/built-in-policies.mdx +535 -0
- package/.next/standalone/docs/ja/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/ja/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/ja/cli/hook.mdx +30 -0
- package/.next/standalone/docs/ja/cli/install-policies.mdx +47 -0
- package/.next/standalone/docs/ja/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/ja/cli/remove-policies.mdx +43 -0
- package/.next/standalone/docs/ja/cli/version.mdx +12 -0
- package/.next/standalone/docs/ja/configuration.mdx +222 -0
- package/.next/standalone/docs/ja/custom-policies.mdx +357 -0
- package/.next/standalone/docs/ja/dashboard.mdx +142 -0
- package/.next/standalone/docs/ja/examples.mdx +253 -0
- package/.next/standalone/docs/ja/for-agents.mdx +38 -0
- package/.next/standalone/docs/ja/getting-started.mdx +134 -0
- package/.next/standalone/docs/ja/introduction.mdx +57 -0
- package/.next/standalone/docs/ja/package-aliases.mdx +82 -0
- package/.next/standalone/docs/ja/testing.mdx +260 -0
- package/.next/standalone/docs/ko/architecture.mdx +332 -0
- package/.next/standalone/docs/ko/built-in-policies.mdx +535 -0
- package/.next/standalone/docs/ko/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/ko/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/ko/cli/hook.mdx +30 -0
- package/.next/standalone/docs/ko/cli/install-policies.mdx +47 -0
- package/.next/standalone/docs/ko/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/ko/cli/remove-policies.mdx +43 -0
- package/.next/standalone/docs/ko/cli/version.mdx +12 -0
- package/.next/standalone/docs/ko/configuration.mdx +222 -0
- package/.next/standalone/docs/ko/custom-policies.mdx +357 -0
- package/.next/standalone/docs/ko/dashboard.mdx +142 -0
- package/.next/standalone/docs/ko/examples.mdx +253 -0
- package/.next/standalone/docs/ko/for-agents.mdx +38 -0
- package/.next/standalone/docs/ko/getting-started.mdx +134 -0
- package/.next/standalone/docs/ko/introduction.mdx +57 -0
- package/.next/standalone/docs/ko/package-aliases.mdx +82 -0
- package/.next/standalone/docs/ko/testing.mdx +260 -0
- package/.next/standalone/docs/logo/dark.svg +21 -0
- package/.next/standalone/docs/logo/light.svg +21 -0
- package/.next/standalone/docs/{package-aliases.md → package-aliases.mdx} +5 -5
- package/.next/standalone/docs/pt-br/architecture.mdx +332 -0
- package/.next/standalone/docs/pt-br/built-in-policies.mdx +537 -0
- package/.next/standalone/docs/pt-br/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/pt-br/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/pt-br/cli/hook.mdx +30 -0
- package/.next/standalone/docs/pt-br/cli/install-policies.mdx +47 -0
- package/.next/standalone/docs/pt-br/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/pt-br/cli/remove-policies.mdx +43 -0
- package/.next/standalone/docs/pt-br/cli/version.mdx +12 -0
- package/.next/standalone/docs/pt-br/configuration.mdx +222 -0
- package/.next/standalone/docs/pt-br/custom-policies.mdx +357 -0
- package/.next/standalone/docs/pt-br/dashboard.mdx +142 -0
- package/.next/standalone/docs/pt-br/examples.mdx +253 -0
- package/.next/standalone/docs/pt-br/for-agents.mdx +38 -0
- package/.next/standalone/docs/pt-br/getting-started.mdx +134 -0
- package/.next/standalone/docs/pt-br/introduction.mdx +57 -0
- package/.next/standalone/docs/pt-br/package-aliases.mdx +82 -0
- package/.next/standalone/docs/pt-br/testing.mdx +260 -0
- package/.next/standalone/docs/ru/architecture.mdx +334 -0
- package/.next/standalone/docs/ru/built-in-policies.mdx +537 -0
- package/.next/standalone/docs/ru/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/ru/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/ru/cli/hook.mdx +30 -0
- package/.next/standalone/docs/ru/cli/install-policies.mdx +48 -0
- package/.next/standalone/docs/ru/cli/list-policies.mdx +32 -0
- package/.next/standalone/docs/ru/cli/remove-policies.mdx +43 -0
- package/.next/standalone/docs/ru/cli/version.mdx +12 -0
- package/.next/standalone/docs/ru/configuration.mdx +223 -0
- package/.next/standalone/docs/ru/custom-policies.mdx +357 -0
- package/.next/standalone/docs/ru/dashboard.mdx +142 -0
- package/.next/standalone/docs/ru/examples.mdx +254 -0
- package/.next/standalone/docs/ru/for-agents.mdx +38 -0
- package/.next/standalone/docs/ru/getting-started.mdx +134 -0
- package/.next/standalone/docs/ru/introduction.mdx +57 -0
- package/.next/standalone/docs/ru/package-aliases.mdx +82 -0
- package/.next/standalone/docs/ru/testing.mdx +260 -0
- package/.next/standalone/docs/{testing.md → testing.mdx} +11 -11
- package/.next/standalone/docs/tr/architecture.mdx +333 -0
- package/.next/standalone/docs/tr/built-in-policies.mdx +537 -0
- package/.next/standalone/docs/tr/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/tr/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/tr/cli/hook.mdx +30 -0
- package/.next/standalone/docs/tr/cli/install-policies.mdx +47 -0
- package/.next/standalone/docs/tr/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/tr/cli/remove-policies.mdx +44 -0
- package/.next/standalone/docs/tr/cli/version.mdx +12 -0
- package/.next/standalone/docs/tr/configuration.mdx +223 -0
- package/.next/standalone/docs/tr/custom-policies.mdx +357 -0
- package/.next/standalone/docs/tr/dashboard.mdx +142 -0
- package/.next/standalone/docs/tr/examples.mdx +253 -0
- package/.next/standalone/docs/tr/for-agents.mdx +38 -0
- package/.next/standalone/docs/tr/getting-started.mdx +134 -0
- package/.next/standalone/docs/tr/introduction.mdx +57 -0
- package/.next/standalone/docs/tr/package-aliases.mdx +82 -0
- package/.next/standalone/docs/tr/testing.mdx +260 -0
- package/.next/standalone/docs/vi/architecture.mdx +333 -0
- package/.next/standalone/docs/vi/built-in-policies.mdx +537 -0
- package/.next/standalone/docs/vi/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/vi/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/vi/cli/hook.mdx +30 -0
- package/.next/standalone/docs/vi/cli/install-policies.mdx +47 -0
- package/.next/standalone/docs/vi/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/vi/cli/remove-policies.mdx +43 -0
- package/.next/standalone/docs/vi/cli/version.mdx +13 -0
- package/.next/standalone/docs/vi/configuration.mdx +222 -0
- package/.next/standalone/docs/vi/custom-policies.mdx +357 -0
- package/.next/standalone/docs/vi/dashboard.mdx +142 -0
- package/.next/standalone/docs/vi/examples.mdx +253 -0
- package/.next/standalone/docs/vi/for-agents.mdx +38 -0
- package/.next/standalone/docs/vi/getting-started.mdx +134 -0
- package/.next/standalone/docs/vi/introduction.mdx +57 -0
- package/.next/standalone/docs/vi/package-aliases.mdx +82 -0
- package/.next/standalone/docs/vi/testing.mdx +260 -0
- package/.next/standalone/docs/zh/architecture.mdx +332 -0
- package/.next/standalone/docs/zh/built-in-policies.mdx +535 -0
- package/.next/standalone/docs/zh/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/zh/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/zh/cli/hook.mdx +30 -0
- package/.next/standalone/docs/zh/cli/install-policies.mdx +47 -0
- package/.next/standalone/docs/zh/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/zh/cli/remove-policies.mdx +43 -0
- package/.next/standalone/docs/zh/cli/version.mdx +12 -0
- package/.next/standalone/docs/zh/configuration.mdx +222 -0
- package/.next/standalone/docs/zh/custom-policies.mdx +357 -0
- package/.next/standalone/docs/zh/dashboard.mdx +142 -0
- package/.next/standalone/docs/zh/examples.mdx +253 -0
- package/.next/standalone/docs/zh/for-agents.mdx +38 -0
- package/.next/standalone/docs/zh/getting-started.mdx +134 -0
- package/.next/standalone/docs/zh/introduction.mdx +57 -0
- package/.next/standalone/docs/zh/package-aliases.mdx +82 -0
- package/.next/standalone/docs/zh/testing.mdx +260 -0
- package/.next/standalone/examples/convention-policies/security-policies.mjs +40 -0
- package/.next/standalone/examples/convention-policies/workflow-policies.mjs +41 -0
- package/.next/standalone/next.config.ts +5 -3
- 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/jsonwebtoken/index.js +2 -2
- package/.next/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js +1 -1
- package/.next/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js +1 -1
- package/.next/standalone/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +1 -1
- package/.next/standalone/node_modules/next/dist/lib/patch-incorrect-lockfile.js +3 -3
- 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 +7 -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 +20 -19
- 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/node_modules/react/cjs/react.development.js +1 -1
- package/.next/standalone/node_modules/react/cjs/react.production.js +1 -1
- package/.next/standalone/node_modules/react/package.json +1 -1
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.js +1 -1
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.js +1 -1
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.production.js +3 -3
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server.edge.production.js +3 -3
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server.node.production.js +3 -3
- package/.next/standalone/node_modules/react-dom/cjs/react-dom.production.js +1 -1
- package/.next/standalone/node_modules/react-dom/package.json +2 -2
- package/.next/standalone/package.json +13 -10
- package/.next/standalone/scripts/translate-docs/cache.ts +62 -0
- package/.next/standalone/scripts/translate-docs/cli.ts +357 -0
- package/.next/standalone/scripts/translate-docs/config.ts +248 -0
- package/.next/standalone/scripts/translate-docs/mdx-translator.ts +153 -0
- package/.next/standalone/scripts/translate-docs/mintlify-nav.ts +107 -0
- package/.next/standalone/scripts/translate-docs/readme-translator.ts +154 -0
- package/.next/standalone/scripts/translate-docs/translator.ts +68 -0
- package/.next/standalone/scripts/translate-docs/types.ts +43 -0
- package/.next/standalone/server.js +1 -1
- package/.next/standalone/skills-lock.json +10 -0
- package/.next/standalone/src/hooks/builtin-policies.ts +401 -25
- package/.next/standalone/src/hooks/custom-hooks-loader.ts +165 -21
- package/.next/standalone/src/hooks/handler.ts +33 -6
- package/.next/standalone/src/hooks/hook-activity-store.ts +6 -1
- package/.next/standalone/src/hooks/hooks-config.ts +47 -2
- package/.next/standalone/src/hooks/llm-client.ts +2 -2
- package/.next/standalone/src/hooks/loader-utils.ts +4 -4
- package/.next/standalone/src/hooks/manager.ts +67 -16
- package/.next/standalone/src/hooks/policy-evaluator.ts +58 -19
- package/.next/standalone/src/hooks/policy-helpers.ts +2 -2
- package/.next/standalone/vitest.config.e2e.mts +3 -0
- package/.next/standalone/vitest.config.mts +3 -0
- package/README.md +95 -49
- package/bin/failproofai.mjs +5 -0
- package/dist/cli.mjs +535 -90
- package/dist/index.js +2 -2
- package/package.json +13 -10
- package/scripts/translate-docs/cache.ts +62 -0
- package/scripts/translate-docs/cli.ts +357 -0
- package/scripts/translate-docs/config.ts +248 -0
- package/scripts/translate-docs/mdx-translator.ts +153 -0
- package/scripts/translate-docs/mintlify-nav.ts +107 -0
- package/scripts/translate-docs/readme-translator.ts +154 -0
- package/scripts/translate-docs/translator.ts +68 -0
- package/scripts/translate-docs/types.ts +43 -0
- package/src/hooks/builtin-policies.ts +401 -25
- package/src/hooks/custom-hooks-loader.ts +165 -21
- package/src/hooks/handler.ts +33 -6
- package/src/hooks/hook-activity-store.ts +6 -1
- package/src/hooks/hooks-config.ts +47 -2
- package/src/hooks/llm-client.ts +2 -2
- package/src/hooks/loader-utils.ts +4 -4
- package/src/hooks/manager.ts +67 -16
- package/src/hooks/policy-evaluator.ts +58 -19
- package/src/hooks/policy-helpers.ts +2 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__02nt~6d._.js +0 -3
- package/.next/standalone/.next/static/chunks/0c_ljlxa._4lc.js +0 -6
- package/.next/standalone/.next/static/chunks/15jpradyu_531.css +0 -1
- package/.next/standalone/docs/cli-reference.md +0 -175
- package/.next/standalone/docs/custom-hooks.md +0 -261
- package/.next/standalone/docs/getting-started.md +0 -128
- package/.next/standalone/docs/introduction.md +0 -47
- /package/.next/standalone/.next/static/{WS-OQSqL1Lp1w_obXfjvl → WRbDp8A_ORPof197CezOZ}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{WS-OQSqL1Lp1w_obXfjvl → WRbDp8A_ORPof197CezOZ}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{WS-OQSqL1Lp1w_obXfjvl → WRbDp8A_ORPof197CezOZ}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Lister les politiques
|
|
3
|
+
description: "Voir quelles politiques sont activées, leurs paramètres, et les politiques personnalisées"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
failproofai policies
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Affiche toutes les politiques avec leur statut, leurs paramètres configurés, et les politiques personnalisées.
|
|
11
|
+
|
|
12
|
+
## Exemple de sortie
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
Failproof AI Hook Policies (user)
|
|
16
|
+
|
|
17
|
+
Status Name Description
|
|
18
|
+
────── ──────────────────────────────────────────────────────────────
|
|
19
|
+
✓ block-sudo Block sudo commands
|
|
20
|
+
allowPatterns: ["sudo systemctl status"]
|
|
21
|
+
✓ block-rm-rf Block recursive deletions
|
|
22
|
+
✗ block-curl-pipe-sh Block curl|bash patterns
|
|
23
|
+
✓ sanitize-api-keys Redact API keys from output
|
|
24
|
+
additionalPatterns: [{ regex: "MY_TOKEN_...", label: "..." }]
|
|
25
|
+
|
|
26
|
+
── Custom Policies (/home/alice/myproject/my-policies.js) ──────────────
|
|
27
|
+
✓ require-jira-ticket Block commits without ticket
|
|
28
|
+
✓ approval-gate Approval gate for destructive ops
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Les clés inconnues dans `policyParams` sont signalées ici afin que vous puissiez détecter les fautes de frappe rapidement.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Désinstaller les politiques
|
|
3
|
+
description: "Supprimer les entrées de hook des paramètres de Claude Code"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
failproofai policies --uninstall [policy-names...] [options]
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Supprime les entrées de hook failproofai du fichier `settings.json` de Claude Code.
|
|
11
|
+
|
|
12
|
+
Alias : `failproofai p -u`
|
|
13
|
+
|
|
14
|
+
## Options
|
|
15
|
+
|
|
16
|
+
| Indicateur | Description |
|
|
17
|
+
|------------|-------------|
|
|
18
|
+
| `--scope user` | Supprimer des paramètres globaux (par défaut) |
|
|
19
|
+
| `--scope project` | Supprimer des paramètres du projet |
|
|
20
|
+
| `--scope local` | Supprimer des paramètres locaux |
|
|
21
|
+
| `--scope all` | Supprimer de tous les scopes à la fois |
|
|
22
|
+
| `--custom` / `-c` | Effacer le `customPoliciesPath` de la configuration |
|
|
23
|
+
|
|
24
|
+
## Comportement
|
|
25
|
+
|
|
26
|
+
- **Aucun nom de politique** — supprime toutes les entrées de hook failproofai du fichier de paramètres
|
|
27
|
+
- **Noms spécifiques** — désactive ces politiques mais conserve les hooks installés
|
|
28
|
+
|
|
29
|
+
## Exemples
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Supprimer tous les hooks globalement
|
|
33
|
+
failproofai policies --uninstall
|
|
34
|
+
|
|
35
|
+
# Désactiver une politique spécifique (conserve les hooks installés)
|
|
36
|
+
failproofai policies --uninstall block-sudo
|
|
37
|
+
|
|
38
|
+
# Supprimer les hooks de tous les scopes
|
|
39
|
+
failproofai policies --uninstall --scope all
|
|
40
|
+
|
|
41
|
+
# Effacer le chemin des politiques personnalisées
|
|
42
|
+
failproofai policies --uninstall --custom
|
|
43
|
+
```
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Configuration
|
|
3
|
+
description: "Format du fichier de configuration, système à trois portées et règles de fusion"
|
|
4
|
+
icon: gear
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
failproofai utilise des fichiers de configuration JSON pour contrôler quelles politiques sont actives, leur comportement et l'emplacement des politiques personnalisées. La configuration est conçue pour être facilement partageable avec votre équipe — committez-la dans votre dépôt et chaque développeur bénéficie du même filet de sécurité pour l'agent.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Portées de configuration
|
|
12
|
+
|
|
13
|
+
Il existe trois portées de configuration, évaluées par ordre de priorité :
|
|
14
|
+
|
|
15
|
+
| Portée | Chemin du fichier | Objectif |
|
|
16
|
+
|--------|-------------------|----------|
|
|
17
|
+
| **project** | `.failproofai/policies-config.json` | Paramètres par dépôt, committés dans le contrôle de version |
|
|
18
|
+
| **local** | `.failproofai/policies-config.local.json` | Surcharges personnelles par dépôt, ignorées par git |
|
|
19
|
+
| **global** | `~/.failproofai/policies-config.json` | Paramètres par défaut au niveau utilisateur pour tous les projets |
|
|
20
|
+
|
|
21
|
+
Quand failproofai reçoit un événement de hook, il charge et fusionne les trois fichiers existants pour le répertoire de travail courant.
|
|
22
|
+
|
|
23
|
+
### Règles de fusion
|
|
24
|
+
|
|
25
|
+
**`enabledPolicies`** — union des trois portées. Une politique activée à n'importe quel niveau est active.
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
project: ["block-sudo"]
|
|
29
|
+
local: ["block-rm-rf"]
|
|
30
|
+
global: ["block-sudo", "sanitize-api-keys"]
|
|
31
|
+
|
|
32
|
+
resolved: ["block-sudo", "block-rm-rf", "sanitize-api-keys"] ← union dédupliquée
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**`policyParams`** — la première portée qui définit les paramètres d'une politique donnée l'emporte entièrement. Il n'y a pas de fusion profonde des valeurs au sein des paramètres d'une politique.
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
project: block-sudo → { allowPatterns: ["sudo apt-get update"] }
|
|
39
|
+
global: block-sudo → { allowPatterns: ["sudo systemctl status"] }
|
|
40
|
+
|
|
41
|
+
resolved: { allowPatterns: ["sudo apt-get update"] } ← project l'emporte, global ignoré
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
project: (aucune entrée block-sudo)
|
|
46
|
+
local: (aucune entrée block-sudo)
|
|
47
|
+
global: block-sudo → { allowPatterns: ["sudo systemctl status"] }
|
|
48
|
+
|
|
49
|
+
resolved: { allowPatterns: ["sudo systemctl status"] } ← retombe sur global
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**`customPoliciesPath`** — la première portée qui le définit l'emporte.
|
|
53
|
+
|
|
54
|
+
**`llm`** — la première portée qui le définit l'emporte.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Format du fichier de configuration
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"enabledPolicies": [
|
|
63
|
+
"block-sudo",
|
|
64
|
+
"block-rm-rf",
|
|
65
|
+
"block-push-master",
|
|
66
|
+
"sanitize-api-keys",
|
|
67
|
+
"sanitize-jwt",
|
|
68
|
+
"block-env-files",
|
|
69
|
+
"block-read-outside-cwd"
|
|
70
|
+
],
|
|
71
|
+
"policyParams": {
|
|
72
|
+
"block-sudo": {
|
|
73
|
+
"allowPatterns": ["sudo systemctl status", "sudo journalctl"]
|
|
74
|
+
},
|
|
75
|
+
"block-push-master": {
|
|
76
|
+
"protectedBranches": ["main", "release", "prod"]
|
|
77
|
+
},
|
|
78
|
+
"block-rm-rf": {
|
|
79
|
+
"allowPaths": ["/tmp"]
|
|
80
|
+
},
|
|
81
|
+
"block-read-outside-cwd": {
|
|
82
|
+
"allowPaths": ["/shared/data", "/opt/company"]
|
|
83
|
+
},
|
|
84
|
+
"sanitize-api-keys": {
|
|
85
|
+
"additionalPatterns": [
|
|
86
|
+
{ "regex": "myco_[A-Za-z0-9]{32}", "label": "MyCo API key" }
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
"warn-large-file-write": {
|
|
90
|
+
"thresholdKb": 512
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"customPoliciesPath": "/home/alice/myproject/my-policies.js"
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Référence des champs
|
|
100
|
+
|
|
101
|
+
### `enabledPolicies`
|
|
102
|
+
|
|
103
|
+
Type : `string[]`
|
|
104
|
+
|
|
105
|
+
Liste des noms de politiques à activer. Les noms doivent correspondre exactement aux identifiants de politique affichés par `failproofai policies`. Consultez [Politiques intégrées](/fr/built-in-policies) pour la liste complète.
|
|
106
|
+
|
|
107
|
+
Les politiques absentes de `enabledPolicies` sont inactives, même si elles ont des entrées dans `policyParams`.
|
|
108
|
+
|
|
109
|
+
### `policyParams`
|
|
110
|
+
|
|
111
|
+
Type : `Record<string, Record<string, unknown>>`
|
|
112
|
+
|
|
113
|
+
Surcharges de paramètres par politique. La clé externe est le nom de la politique ; les clés internes sont spécifiques à chaque politique. Chaque politique documente ses paramètres disponibles dans [Politiques intégrées](/fr/built-in-policies).
|
|
114
|
+
|
|
115
|
+
Si une politique possède des paramètres mais que vous ne les spécifiez pas, les valeurs par défaut intégrées de la politique sont utilisées. Les utilisateurs qui ne configurent pas `policyParams` du tout obtiennent un comportement identique aux versions précédentes.
|
|
116
|
+
|
|
117
|
+
Les clés inconnues dans le bloc de paramètres d'une politique sont silencieusement ignorées au moment du déclenchement du hook, mais signalées comme avertissements lors de l'exécution de `failproofai policies`.
|
|
118
|
+
|
|
119
|
+
#### `hint` (transversal)
|
|
120
|
+
|
|
121
|
+
Type : `string` (optionnel)
|
|
122
|
+
|
|
123
|
+
Un message ajouté à la raison lorsqu'une politique retourne `deny` ou `instruct`. Utilisez-le pour donner à Claude des indications exploitables sans modifier la politique elle-même.
|
|
124
|
+
|
|
125
|
+
Fonctionne avec n'importe quel type de politique — intégrée, personnalisée (`custom/`), convention de projet (`.failproofai-project/`), ou convention utilisateur (`.failproofai-user/`).
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"policyParams": {
|
|
130
|
+
"block-force-push": {
|
|
131
|
+
"hint": "Try creating a fresh branch instead."
|
|
132
|
+
},
|
|
133
|
+
"block-sudo": {
|
|
134
|
+
"allowPatterns": ["sudo apt-get"],
|
|
135
|
+
"hint": "Use apt-get directly without sudo."
|
|
136
|
+
},
|
|
137
|
+
"custom/my-policy": {
|
|
138
|
+
"hint": "Ask the user for approval first."
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Lorsque `block-force-push` refuse, Claude voit : *« Force-pushing is blocked. Try creating a fresh branch instead. »*
|
|
145
|
+
|
|
146
|
+
Les valeurs non-chaînes et les chaînes vides sont silencieusement ignorées. Si `hint` n'est pas défini, le comportement est inchangé (rétrocompatible).
|
|
147
|
+
|
|
148
|
+
### `customPoliciesPath`
|
|
149
|
+
|
|
150
|
+
Type : `string` (chemin absolu)
|
|
151
|
+
|
|
152
|
+
Chemin vers un fichier JavaScript contenant des politiques de hook personnalisées. Ce champ est défini automatiquement par `failproofai policies --install --custom <path>` (le chemin est résolu en chemin absolu avant d'être enregistré).
|
|
153
|
+
|
|
154
|
+
Le fichier est chargé à chaque événement de hook — il n'y a pas de mise en cache. Consultez [Politiques personnalisées](/fr/custom-policies) pour les détails de création.
|
|
155
|
+
|
|
156
|
+
### Politiques basées sur les conventions (v0.0.2-beta.7+)
|
|
157
|
+
|
|
158
|
+
En plus du `customPoliciesPath` explicite, failproofai découvre et charge automatiquement les fichiers de politiques depuis les répertoires `.failproofai/policies/` :
|
|
159
|
+
|
|
160
|
+
| Niveau | Répertoire | Portée |
|
|
161
|
+
|--------|-----------|--------|
|
|
162
|
+
| Projet | `.failproofai/policies/` | Partagé avec l'équipe via le contrôle de version |
|
|
163
|
+
| Utilisateur | `~/.failproofai/policies/` | Personnel, s'applique à tous les projets |
|
|
164
|
+
|
|
165
|
+
**Correspondance de fichiers :** Seuls les fichiers correspondant à `*policies.{js,mjs,ts}` sont chargés (par exemple `security-policies.mjs`, `workflow-policies.js`). Les autres fichiers du répertoire sont ignorés.
|
|
166
|
+
|
|
167
|
+
**Aucune configuration nécessaire :** Les politiques de convention ne nécessitent aucune entrée dans `policies-config.json`. Déposez simplement les fichiers dans le répertoire et ils seront pris en compte au prochain événement de hook.
|
|
168
|
+
|
|
169
|
+
**Chargement par union :** Les répertoires de convention du projet et de l'utilisateur sont tous deux analysés. Tous les fichiers correspondants des deux niveaux sont chargés (contrairement à `customPoliciesPath` qui utilise la règle du premier gagnant).
|
|
170
|
+
|
|
171
|
+
Consultez [Politiques personnalisées](/fr/custom-policies) pour plus de détails et des exemples.
|
|
172
|
+
|
|
173
|
+
### `llm`
|
|
174
|
+
|
|
175
|
+
Type : `object` (optionnel)
|
|
176
|
+
|
|
177
|
+
Configuration du client LLM pour les politiques qui effectuent des appels à l'IA. Non requis pour la plupart des configurations.
|
|
178
|
+
|
|
179
|
+
```json
|
|
180
|
+
{
|
|
181
|
+
"llm": {
|
|
182
|
+
"model": "claude-sonnet-4-6",
|
|
183
|
+
"apiKey": "sk-ant-..."
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Gestion de la configuration depuis l'interface en ligne de commande
|
|
191
|
+
|
|
192
|
+
Les commandes `policies --install` et `policies --uninstall` écrivent dans le fichier `settings.json` de Claude Code (les points d'entrée des hooks), tandis que `policies-config.json` est le fichier que vous gérez directement. Les deux sont distincts :
|
|
193
|
+
|
|
194
|
+
- **`settings.json`** — indique à Claude Code d'appeler `failproofai --hook <event>` à chaque utilisation d'outil
|
|
195
|
+
- **`policies-config.json`** — indique à failproofai quelles politiques évaluer et avec quels paramètres
|
|
196
|
+
|
|
197
|
+
Vous pouvez modifier `policies-config.json` directement à tout moment ; les modifications prennent effet immédiatement au prochain événement de hook, sans redémarrage nécessaire.
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Exemple : configuration au niveau projet avec les paramètres par défaut de l'équipe
|
|
202
|
+
|
|
203
|
+
Committez `.failproofai/policies-config.json` dans votre dépôt :
|
|
204
|
+
|
|
205
|
+
```json
|
|
206
|
+
{
|
|
207
|
+
"enabledPolicies": [
|
|
208
|
+
"block-sudo",
|
|
209
|
+
"block-rm-rf",
|
|
210
|
+
"block-push-master",
|
|
211
|
+
"sanitize-api-keys",
|
|
212
|
+
"block-env-files"
|
|
213
|
+
],
|
|
214
|
+
"policyParams": {
|
|
215
|
+
"block-push-master": {
|
|
216
|
+
"protectedBranches": ["main", "release", "hotfix"]
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Chaque développeur peut ensuite créer `.failproofai/policies-config.local.json` (ignoré par git) pour ses surcharges personnelles sans affecter ses coéquipiers.
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Politiques personnalisées
|
|
3
|
+
description: "Écrivez vos propres politiques en JavaScript — appliquez des conventions, prévenez la dérive, détectez les échecs, intégrez des systèmes externes"
|
|
4
|
+
icon: code
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Les politiques personnalisées vous permettent d'écrire des règles pour n'importe quel comportement d'agent : appliquer des conventions de projet, prévenir la dérive, bloquer les opérations destructrices, détecter les agents bloqués, ou s'intégrer avec Slack, des workflows d'approbation, et bien plus. Elles utilisent le même système d'événements hook et les mêmes décisions `allow`, `deny`, `instruct` que les politiques intégrées.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Exemple rapide
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
// my-policies.js
|
|
15
|
+
import { customPolicies, allow, deny, instruct } from "failproofai";
|
|
16
|
+
|
|
17
|
+
customPolicies.add({
|
|
18
|
+
name: "no-production-writes",
|
|
19
|
+
description: "Block writes to paths containing 'production'",
|
|
20
|
+
match: { events: ["PreToolUse"] },
|
|
21
|
+
fn: async (ctx) => {
|
|
22
|
+
if (ctx.toolName !== "Write" && ctx.toolName !== "Edit") return allow();
|
|
23
|
+
const path = ctx.toolInput?.file_path ?? "";
|
|
24
|
+
if (path.includes("production")) {
|
|
25
|
+
return deny("Writes to production paths are blocked");
|
|
26
|
+
}
|
|
27
|
+
return allow();
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Installez-le :
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
failproofai policies --install --custom ./my-policies.js
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Deux façons de charger des politiques personnalisées
|
|
41
|
+
|
|
42
|
+
### Option 1 : Par convention (recommandé, v0.0.2-beta.7+)
|
|
43
|
+
|
|
44
|
+
Déposez des fichiers `*policies.{js,mjs,ts}` dans `.failproofai/policies/` et ils sont chargés automatiquement — aucun indicateur ni changement de configuration requis. Cela fonctionne comme les git hooks : déposez un fichier, il est pris en compte immédiatement.
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
# Niveau projet — commité dans git, partagé avec l'équipe
|
|
48
|
+
.failproofai/policies/security-policies.mjs
|
|
49
|
+
.failproofai/policies/workflow-policies.mjs
|
|
50
|
+
|
|
51
|
+
# Niveau utilisateur — personnel, s'applique à tous les projets
|
|
52
|
+
~/.failproofai/policies/my-policies.mjs
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Comment ça fonctionne :**
|
|
56
|
+
- Les répertoires projet et utilisateur sont tous deux analysés (union — pas de priorité au premier scope)
|
|
57
|
+
- Les fichiers sont chargés alphabétiquement dans chaque répertoire. Préfixez avec `01-`, `02-` pour contrôler l'ordre
|
|
58
|
+
- Seuls les fichiers correspondant à `*policies.{js,mjs,ts}` sont chargés ; les autres fichiers sont ignorés
|
|
59
|
+
- Chaque fichier est chargé indépendamment (fail-open par fichier)
|
|
60
|
+
- Fonctionne en parallèle avec les indicateurs `--custom` explicites et les politiques intégrées
|
|
61
|
+
|
|
62
|
+
<Tip>
|
|
63
|
+
Les politiques par convention sont le moyen le plus simple de partager des politiques au sein d'une équipe. Commitez `.failproofai/policies/` dans git et chaque membre de l'équipe les reçoit automatiquement.
|
|
64
|
+
</Tip>
|
|
65
|
+
|
|
66
|
+
### Option 2 : Chemin de fichier explicite
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Installer avec un fichier de politiques personnalisées
|
|
70
|
+
failproofai policies --install --custom ./my-policies.js
|
|
71
|
+
|
|
72
|
+
# Remplacer le chemin du fichier de politiques
|
|
73
|
+
failproofai policies --install --custom ./new-policies.js
|
|
74
|
+
|
|
75
|
+
# Supprimer le chemin de politiques personnalisées de la configuration
|
|
76
|
+
failproofai policies --uninstall --custom
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Le chemin absolu résolu est stocké dans `policies-config.json` sous `customPoliciesPath`. Le fichier est chargé à nouveau à chaque événement hook — aucune mise en cache entre les événements.
|
|
80
|
+
|
|
81
|
+
### Utiliser les deux ensemble
|
|
82
|
+
|
|
83
|
+
Les politiques par convention et le fichier `--custom` explicite peuvent coexister. Ordre de chargement :
|
|
84
|
+
|
|
85
|
+
1. Fichier `customPoliciesPath` explicite (si configuré)
|
|
86
|
+
2. Fichiers de convention projet (`{cwd}/.failproofai/policies/`, alphabétique)
|
|
87
|
+
3. Fichiers de convention utilisateur (`~/.failproofai/policies/`, alphabétique)
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## API
|
|
92
|
+
|
|
93
|
+
### Import
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
import { customPolicies, allow, deny, instruct } from "failproofai";
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### `customPolicies.add(hook)`
|
|
100
|
+
|
|
101
|
+
Enregistre une politique. Appelez cette méthode autant de fois que nécessaire pour plusieurs politiques dans le même fichier.
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
customPolicies.add({
|
|
105
|
+
name: string; // obligatoire - identifiant unique
|
|
106
|
+
description?: string; // affiché dans la sortie de `failproofai policies`
|
|
107
|
+
match?: { events?: HookEventType[] }; // filtrer par type d'événement ; omettre pour tout correspondre
|
|
108
|
+
fn: (ctx: PolicyContext) => PolicyResult | Promise<PolicyResult>;
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Fonctions d'aide aux décisions
|
|
113
|
+
|
|
114
|
+
| Fonction | Effet | Utiliser quand |
|
|
115
|
+
|----------|--------|----------|
|
|
116
|
+
| `allow()` | Autorise l'opération silencieusement | L'action est sûre, aucun message nécessaire |
|
|
117
|
+
| `deny(message)` | Bloque l'opération | L'agent ne doit pas effectuer cette action |
|
|
118
|
+
| `instruct(message)` | Ajoute du contexte sans bloquer | Fournir à l'agent du contexte supplémentaire pour rester sur la bonne voie |
|
|
119
|
+
|
|
120
|
+
`deny(message)` — le message apparaît à Claude préfixé par `"Blocked by failproofai:"`. Un seul `deny` court-circuite toute évaluation ultérieure.
|
|
121
|
+
|
|
122
|
+
`instruct(message)` — le message est ajouté au contexte de Claude pour l'appel d'outil en cours. Tous les messages `instruct` sont accumulés et délivrés ensemble.
|
|
123
|
+
|
|
124
|
+
<Tip>
|
|
125
|
+
Vous pouvez ajouter des instructions supplémentaires à n'importe quel message `deny` ou `instruct` en ajoutant un champ `hint` dans `policyParams` — sans modifier le code. Cela fonctionne également pour les politiques personnalisées (`custom/`), par convention projet (`.failproofai-project/`) et par convention utilisateur (`.failproofai-user/`). Voir [Configuration → hint](/fr/configuration#hint-cross-cutting) pour les détails.
|
|
126
|
+
</Tip>
|
|
127
|
+
|
|
128
|
+
### Messages allow informationnels (bêta)
|
|
129
|
+
|
|
130
|
+
<Note>
|
|
131
|
+
`allow(message)` est une fonctionnalité bêta disponible depuis la v0.0.2-beta.3. L'API peut changer dans les versions futures. Les versions antérieures ne prennent en charge que `allow()` sans arguments.
|
|
132
|
+
</Note>
|
|
133
|
+
|
|
134
|
+
`allow(message)` autorise l'opération **et** envoie un message informationnel à Claude. Le message est délivré en tant que `additionalContext` dans la réponse stdout du gestionnaire de hook — le même mécanisme qu'`instruct`, mais sémantiquement différent : c'est une mise à jour de statut, pas un avertissement.
|
|
135
|
+
|
|
136
|
+
| Fonction | Effet | Utiliser quand |
|
|
137
|
+
|----------|--------|----------|
|
|
138
|
+
| `allow(message)` | Autorise et envoie du contexte à Claude | Confirmer qu'une vérification a réussi, ou expliquer pourquoi une vérification a été ignorée |
|
|
139
|
+
|
|
140
|
+
Cas d'utilisation :
|
|
141
|
+
- **Confirmations de statut :** `allow("All CI checks passed.")` — indique à Claude que tout est en ordre
|
|
142
|
+
- **Explications fail-open :** `allow("GitHub CLI not installed, skipping CI check.")` — indique à Claude pourquoi une vérification a été ignorée pour qu'il ait le contexte complet
|
|
143
|
+
- **Accumulation de messages multiples :** si plusieurs politiques retournent chacune `allow(message)`, tous les messages sont joints par des sauts de ligne et délivrés ensemble
|
|
144
|
+
|
|
145
|
+
```js
|
|
146
|
+
customPolicies.add({
|
|
147
|
+
name: "confirm-branch-status",
|
|
148
|
+
match: { events: ["Stop"] },
|
|
149
|
+
fn: async (ctx) => {
|
|
150
|
+
const cwd = ctx.session?.cwd;
|
|
151
|
+
if (!cwd) return allow("No working directory, skipping branch check.");
|
|
152
|
+
|
|
153
|
+
// ... check branch status ...
|
|
154
|
+
if (allPushed) {
|
|
155
|
+
return allow("Branch is up to date with remote.");
|
|
156
|
+
}
|
|
157
|
+
return deny("Unpushed changes detected.");
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Champs de `PolicyContext`
|
|
163
|
+
|
|
164
|
+
| Champ | Type | Description |
|
|
165
|
+
|-------|------|-------------|
|
|
166
|
+
| `eventType` | `string` | `"PreToolUse"`, `"PostToolUse"`, `"Notification"`, `"Stop"` |
|
|
167
|
+
| `toolName` | `string \| undefined` | L'outil appelé (ex. `"Bash"`, `"Write"`, `"Read"`) |
|
|
168
|
+
| `toolInput` | `Record<string, unknown> \| undefined` | Les paramètres d'entrée de l'outil |
|
|
169
|
+
| `payload` | `Record<string, unknown>` | Payload brut complet de l'événement provenant de Claude Code |
|
|
170
|
+
| `session` | `SessionMetadata \| undefined` | Contexte de session (voir ci-dessous) |
|
|
171
|
+
|
|
172
|
+
### Champs de `SessionMetadata`
|
|
173
|
+
|
|
174
|
+
| Champ | Type | Description |
|
|
175
|
+
|-------|------|-------------|
|
|
176
|
+
| `sessionId` | `string` | Identifiant de session Claude Code |
|
|
177
|
+
| `cwd` | `string` | Répertoire de travail de la session Claude Code |
|
|
178
|
+
| `transcriptPath` | `string` | Chemin vers le fichier de transcription JSONL de la session |
|
|
179
|
+
|
|
180
|
+
### Types d'événements
|
|
181
|
+
|
|
182
|
+
| Événement | Quand il se déclenche | Contenu de `toolInput` |
|
|
183
|
+
|-------|--------------|----------------------|
|
|
184
|
+
| `PreToolUse` | Avant que Claude exécute un outil | L'entrée de l'outil (ex. `{ command: "..." }` pour Bash) |
|
|
185
|
+
| `PostToolUse` | Après qu'un outil se termine | L'entrée de l'outil + `tool_result` (la sortie) |
|
|
186
|
+
| `Notification` | Quand Claude envoie une notification | `{ message: "...", notification_type: "idle" \| "permission_prompt" \| ... }` — les hooks doivent toujours retourner `allow()`, ils ne peuvent pas bloquer les notifications |
|
|
187
|
+
| `Stop` | Quand la session Claude se termine | Vide |
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Ordre d'évaluation
|
|
192
|
+
|
|
193
|
+
Les politiques sont évaluées dans cet ordre :
|
|
194
|
+
|
|
195
|
+
1. Politiques intégrées (dans l'ordre de définition)
|
|
196
|
+
2. Politiques personnalisées explicites de `customPoliciesPath` (dans l'ordre `.add()`)
|
|
197
|
+
3. Politiques de convention projet `.failproofai/policies/` (fichiers alphabétiques, ordre `.add()` à l'intérieur)
|
|
198
|
+
4. Politiques de convention utilisateur `~/.failproofai/policies/` (fichiers alphabétiques, ordre `.add()` à l'intérieur)
|
|
199
|
+
|
|
200
|
+
<Note>
|
|
201
|
+
Le premier `deny` court-circuite toutes les politiques suivantes. Tous les messages `instruct` sont accumulés et délivrés ensemble.
|
|
202
|
+
</Note>
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Imports transitifs
|
|
207
|
+
|
|
208
|
+
Les fichiers de politiques personnalisées peuvent importer des modules locaux en utilisant des chemins relatifs :
|
|
209
|
+
|
|
210
|
+
```js
|
|
211
|
+
// my-policies.js
|
|
212
|
+
import { isBlockedPath } from "./utils.js";
|
|
213
|
+
import { checkApproval } from "./approval-client.js";
|
|
214
|
+
|
|
215
|
+
customPolicies.add({
|
|
216
|
+
name: "approval-gate",
|
|
217
|
+
fn: async (ctx) => {
|
|
218
|
+
if (ctx.toolName !== "Bash") return allow();
|
|
219
|
+
const approved = await checkApproval(ctx.toolInput?.command, ctx.session?.sessionId);
|
|
220
|
+
return approved ? allow() : deny("Approval required for this command");
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Tous les imports relatifs accessibles depuis le fichier d'entrée sont résolus. Cela est implémenté en réécrivant les imports `from "failproofai"` vers le chemin dist réel et en créant des fichiers `.mjs` temporaires pour assurer la compatibilité ESM.
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Filtrage par type d'événement
|
|
230
|
+
|
|
231
|
+
Utilisez `match.events` pour limiter le déclenchement d'une politique :
|
|
232
|
+
|
|
233
|
+
```js
|
|
234
|
+
customPolicies.add({
|
|
235
|
+
name: "require-summary-on-stop",
|
|
236
|
+
match: { events: ["Stop"] },
|
|
237
|
+
fn: async (ctx) => {
|
|
238
|
+
// Ne se déclenche que lorsque la session se termine
|
|
239
|
+
// ctx.session.transcriptPath contient le journal complet de la session
|
|
240
|
+
return allow();
|
|
241
|
+
},
|
|
242
|
+
});
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Omettez `match` entièrement pour se déclencher sur chaque type d'événement.
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## Gestion des erreurs et modes de défaillance
|
|
250
|
+
|
|
251
|
+
Les politiques personnalisées sont **fail-open** : les erreurs ne bloquent jamais les politiques intégrées ni ne font planter le gestionnaire de hook.
|
|
252
|
+
|
|
253
|
+
| Défaillance | Comportement |
|
|
254
|
+
|---------|----------|
|
|
255
|
+
| `customPoliciesPath` non défini | Aucune politique personnalisée explicite ne s'exécute ; les politiques de convention et les politiques intégrées continuent normalement |
|
|
256
|
+
| Fichier introuvable | Avertissement consigné dans `~/.failproofai/hook.log` ; les politiques intégrées continuent |
|
|
257
|
+
| Erreur de syntaxe/import (explicite) | Erreur consignée dans `~/.failproofai/hook.log` ; politiques personnalisées explicites ignorées |
|
|
258
|
+
| Erreur de syntaxe/import (convention) | Erreur consignée ; ce fichier ignoré, les autres fichiers de convention se chargent quand même |
|
|
259
|
+
| `fn` lève une exception à l'exécution | Erreur consignée ; ce hook traité comme `allow` ; les autres hooks continuent |
|
|
260
|
+
| `fn` prend plus de 10s | Timeout consigné ; traité comme `allow` |
|
|
261
|
+
| Répertoire de convention manquant | Aucune politique de convention ne s'exécute ; aucune erreur |
|
|
262
|
+
|
|
263
|
+
<Tip>
|
|
264
|
+
Pour déboguer les erreurs de politiques personnalisées, surveillez le fichier journal :
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
tail -f ~/.failproofai/hook.log
|
|
268
|
+
```
|
|
269
|
+
</Tip>
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Exemple complet : plusieurs politiques
|
|
274
|
+
|
|
275
|
+
```js
|
|
276
|
+
// my-policies.js
|
|
277
|
+
import { customPolicies, allow, deny, instruct } from "failproofai";
|
|
278
|
+
|
|
279
|
+
// Prevent agent from writing to secrets/ directory
|
|
280
|
+
customPolicies.add({
|
|
281
|
+
name: "block-secrets-dir",
|
|
282
|
+
description: "Prevent agent from writing to secrets/ directory",
|
|
283
|
+
match: { events: ["PreToolUse"] },
|
|
284
|
+
fn: async (ctx) => {
|
|
285
|
+
if (!["Write", "Edit"].includes(ctx.toolName ?? "")) return allow();
|
|
286
|
+
const path = ctx.toolInput?.file_path ?? "";
|
|
287
|
+
if (path.includes("secrets/")) return deny("Writing to secrets/ is not permitted");
|
|
288
|
+
return allow();
|
|
289
|
+
},
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
// Keep the agent on track: verify tests before committing
|
|
293
|
+
customPolicies.add({
|
|
294
|
+
name: "remind-test-before-commit",
|
|
295
|
+
description: "Keep the agent on track: verify tests pass before committing",
|
|
296
|
+
match: { events: ["PreToolUse"] },
|
|
297
|
+
fn: async (ctx) => {
|
|
298
|
+
if (ctx.toolName !== "Bash") return allow();
|
|
299
|
+
const cmd = ctx.toolInput?.command ?? "";
|
|
300
|
+
if (/git\s+commit/.test(cmd)) {
|
|
301
|
+
return instruct("Verify all tests pass before committing. Run `bun test` if you haven't already.");
|
|
302
|
+
}
|
|
303
|
+
return allow();
|
|
304
|
+
},
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
// Prevent unplanned dependency changes during freeze
|
|
308
|
+
customPolicies.add({
|
|
309
|
+
name: "dependency-freeze",
|
|
310
|
+
description: "Prevent unplanned dependency changes during freeze period",
|
|
311
|
+
match: { events: ["PreToolUse"] },
|
|
312
|
+
fn: async (ctx) => {
|
|
313
|
+
if (ctx.toolName !== "Bash") return allow();
|
|
314
|
+
const cmd = ctx.toolInput?.command ?? "";
|
|
315
|
+
const isInstall = /^(npm install|yarn add|bun add|pnpm add)\s+\S/.test(cmd);
|
|
316
|
+
if (isInstall && process.env.DEPENDENCY_FREEZE === "1") {
|
|
317
|
+
return deny("Package installs are frozen. Unset DEPENDENCY_FREEZE to allow.");
|
|
318
|
+
}
|
|
319
|
+
return allow();
|
|
320
|
+
},
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
export { customPolicies };
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## Exemples
|
|
329
|
+
|
|
330
|
+
Le répertoire `examples/` contient des fichiers de politiques prêts à l'emploi :
|
|
331
|
+
|
|
332
|
+
| Fichier | Contenu |
|
|
333
|
+
|------|----------|
|
|
334
|
+
| `examples/policies-basic.js` | Cinq politiques de démarrage couvrant les modes d'échec courants des agents |
|
|
335
|
+
| `examples/policies-advanced/index.js` | Patterns avancés : imports transitifs, appels asynchrones, nettoyage de sortie et hooks de fin de session |
|
|
336
|
+
| `examples/convention-policies/security-policies.mjs` | Politiques de sécurité par convention (bloquer les écritures .env, empêcher la réécriture de l'historique git) |
|
|
337
|
+
| `examples/convention-policies/workflow-policies.mjs` | Politiques de workflow par convention (rappels de tests, audit des écritures de fichiers) |
|
|
338
|
+
|
|
339
|
+
### Utiliser les exemples de fichiers explicites
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
failproofai policies --install --custom ./examples/policies-basic.js
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### Utiliser les exemples par convention
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
# Copier au niveau projet
|
|
349
|
+
mkdir -p .failproofai/policies
|
|
350
|
+
cp examples/convention-policies/*.mjs .failproofai/policies/
|
|
351
|
+
|
|
352
|
+
# Ou copier au niveau utilisateur
|
|
353
|
+
mkdir -p ~/.failproofai/policies
|
|
354
|
+
cp examples/convention-policies/*.mjs ~/.failproofai/policies/
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
Aucune commande d'installation requise — les fichiers sont pris en compte automatiquement au prochain événement hook.
|