failproofai 0.0.6-beta.3 → 0.0.6-beta.4
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/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/required-server-files.json +7 -1
- 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/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/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/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/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/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/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0g72weg._.js +1 -1
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_0z7w.hh._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__092s1ta._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__09icjsf._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0g.lg8b._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h..k-e._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0okos0k._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0kyh86x._.js → [root-of-the-server]__0om-5pe._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0w6l33k._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__096k.db._.js → [root-of-the-server]__111.vxi._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11pa2ra._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12t-wym._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_10lm7or._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_0xerkr6._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_0q-m0y-._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_0mebn66._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- 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/{01pmw1-asbek~.js → 02dqjyv6_9mhq.js} +2 -2
- package/.next/standalone/.next/static/chunks/{051m32nx~n5yr.js → 070orfsl6.xal.js} +1 -1
- package/.next/standalone/.next/static/chunks/0mir9jdxn35~s.css +1 -0
- package/.next/standalone/.next/static/chunks/{0mazj-p-~2kc6.js → 0o547jv-k_k35.js} +1 -1
- package/.next/standalone/.next/static/chunks/0pk2h2.mjxy.m.js +6 -0
- package/.next/standalone/.next/static/chunks/{0l-mu4okl-cj1.js → 0rcwkbh24w38b.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0-dm_9a6nsc2l.js → 140xx_tfr~lm_.js} +1 -1
- package/.next/standalone/.next/static/chunks/{156zca6aewyr-.js → 169_e4dq~1~b6.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0a-yctdwn368y.js → 17ne4p.1sw1jy.js} +1 -1
- package/.next/standalone/next.config.ts +6 -0
- package/.next/standalone/package.json +2 -2
- package/.next/standalone/server.js +1 -1
- package/dist/cli.mjs +2 -2
- package/package.json +2 -2
- package/scripts/prune-standalone.mjs +128 -0
- package/.next/standalone/.claude/settings.json +0 -316
- package/.next/standalone/.failproofai/policies/review-policies.mjs +0 -113
- package/.next/standalone/.failproofai/policies/workflow-policies.mjs +0 -63
- package/.next/standalone/.failproofai/policies-config.json +0 -39
- package/.next/standalone/.next/static/chunks/0gu_a.a80ritd.css +0 -1
- package/.next/standalone/.next/static/chunks/0qakntsrpc~1j.js +0 -6
- package/.next/standalone/AGENTS.md +0 -80
- package/.next/standalone/CHANGELOG.md +0 -158
- package/.next/standalone/CLAUDE.md +0 -165
- package/.next/standalone/CONTRIBUTING.md +0 -76
- package/.next/standalone/Dockerfile.docs +0 -12
- package/.next/standalone/LICENSE +0 -42
- package/.next/standalone/README.md +0 -301
- package/.next/standalone/bin/failproofai.mjs +0 -439
- package/.next/standalone/bun.lock +0 -1119
- package/.next/standalone/components.json +0 -23
- package/.next/standalone/dist/cli.mjs +0 -4696
- package/.next/standalone/dist/index.js +0 -80
- package/.next/standalone/docs/ar/architecture.mdx +0 -334
- package/.next/standalone/docs/ar/built-in-policies.mdx +0 -574
- package/.next/standalone/docs/ar/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/ar/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/ar/cli/hook.mdx +0 -31
- package/.next/standalone/docs/ar/cli/install-policies.mdx +0 -48
- package/.next/standalone/docs/ar/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/ar/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/ar/cli/version.mdx +0 -13
- package/.next/standalone/docs/ar/configuration.mdx +0 -223
- package/.next/standalone/docs/ar/custom-policies.mdx +0 -354
- package/.next/standalone/docs/ar/dashboard.mdx +0 -142
- package/.next/standalone/docs/ar/examples.mdx +0 -307
- package/.next/standalone/docs/ar/for-agents.mdx +0 -39
- package/.next/standalone/docs/ar/getting-started.mdx +0 -187
- package/.next/standalone/docs/ar/introduction.mdx +0 -58
- package/.next/standalone/docs/ar/package-aliases.mdx +0 -82
- package/.next/standalone/docs/ar/testing.mdx +0 -261
- package/.next/standalone/docs/architecture.mdx +0 -332
- package/.next/standalone/docs/built-in-policies.mdx +0 -574
- package/.next/standalone/docs/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/cli/hook.mdx +0 -30
- package/.next/standalone/docs/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/cli/version.mdx +0 -12
- package/.next/standalone/docs/configuration.mdx +0 -222
- package/.next/standalone/docs/custom-policies.mdx +0 -353
- package/.next/standalone/docs/dashboard.mdx +0 -142
- package/.next/standalone/docs/de/architecture.mdx +0 -332
- package/.next/standalone/docs/de/built-in-policies.mdx +0 -574
- package/.next/standalone/docs/de/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/de/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/de/cli/hook.mdx +0 -30
- package/.next/standalone/docs/de/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/de/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/de/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/de/cli/version.mdx +0 -12
- package/.next/standalone/docs/de/configuration.mdx +0 -222
- package/.next/standalone/docs/de/custom-policies.mdx +0 -353
- package/.next/standalone/docs/de/dashboard.mdx +0 -142
- package/.next/standalone/docs/de/examples.mdx +0 -307
- package/.next/standalone/docs/de/for-agents.mdx +0 -38
- package/.next/standalone/docs/de/getting-started.mdx +0 -186
- package/.next/standalone/docs/de/introduction.mdx +0 -57
- package/.next/standalone/docs/de/package-aliases.mdx +0 -82
- package/.next/standalone/docs/de/testing.mdx +0 -260
- package/.next/standalone/docs/docs.json +0 -1002
- package/.next/standalone/docs/es/architecture.mdx +0 -332
- package/.next/standalone/docs/es/built-in-policies.mdx +0 -574
- package/.next/standalone/docs/es/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/es/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/es/cli/hook.mdx +0 -30
- package/.next/standalone/docs/es/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/es/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/es/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/es/cli/version.mdx +0 -12
- package/.next/standalone/docs/es/configuration.mdx +0 -222
- package/.next/standalone/docs/es/custom-policies.mdx +0 -353
- package/.next/standalone/docs/es/dashboard.mdx +0 -142
- package/.next/standalone/docs/es/examples.mdx +0 -307
- package/.next/standalone/docs/es/for-agents.mdx +0 -38
- package/.next/standalone/docs/es/getting-started.mdx +0 -186
- package/.next/standalone/docs/es/introduction.mdx +0 -57
- package/.next/standalone/docs/es/package-aliases.mdx +0 -82
- package/.next/standalone/docs/es/testing.mdx +0 -260
- package/.next/standalone/docs/examples.mdx +0 -307
- package/.next/standalone/docs/favicon.ico +0 -0
- package/.next/standalone/docs/for-agents.mdx +0 -38
- package/.next/standalone/docs/fr/architecture.mdx +0 -332
- package/.next/standalone/docs/fr/built-in-policies.mdx +0 -574
- package/.next/standalone/docs/fr/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/fr/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/fr/cli/hook.mdx +0 -30
- package/.next/standalone/docs/fr/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/fr/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/fr/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/fr/cli/version.mdx +0 -12
- package/.next/standalone/docs/fr/configuration.mdx +0 -222
- package/.next/standalone/docs/fr/custom-policies.mdx +0 -353
- package/.next/standalone/docs/fr/dashboard.mdx +0 -142
- package/.next/standalone/docs/fr/examples.mdx +0 -307
- package/.next/standalone/docs/fr/for-agents.mdx +0 -38
- package/.next/standalone/docs/fr/getting-started.mdx +0 -186
- package/.next/standalone/docs/fr/introduction.mdx +0 -57
- package/.next/standalone/docs/fr/package-aliases.mdx +0 -82
- package/.next/standalone/docs/fr/testing.mdx +0 -260
- package/.next/standalone/docs/getting-started.mdx +0 -186
- package/.next/standalone/docs/he/architecture.mdx +0 -333
- package/.next/standalone/docs/he/built-in-policies.mdx +0 -575
- package/.next/standalone/docs/he/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/he/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/he/cli/hook.mdx +0 -30
- package/.next/standalone/docs/he/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/he/cli/list-policies.mdx +0 -32
- package/.next/standalone/docs/he/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/he/cli/version.mdx +0 -12
- package/.next/standalone/docs/he/configuration.mdx +0 -223
- package/.next/standalone/docs/he/custom-policies.mdx +0 -353
- package/.next/standalone/docs/he/dashboard.mdx +0 -142
- package/.next/standalone/docs/he/examples.mdx +0 -307
- package/.next/standalone/docs/he/for-agents.mdx +0 -38
- package/.next/standalone/docs/he/getting-started.mdx +0 -186
- package/.next/standalone/docs/he/introduction.mdx +0 -57
- package/.next/standalone/docs/he/package-aliases.mdx +0 -82
- package/.next/standalone/docs/he/testing.mdx +0 -260
- package/.next/standalone/docs/hi/architecture.mdx +0 -334
- package/.next/standalone/docs/hi/built-in-policies.mdx +0 -572
- package/.next/standalone/docs/hi/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/hi/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/hi/cli/hook.mdx +0 -30
- package/.next/standalone/docs/hi/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/hi/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/hi/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/hi/cli/version.mdx +0 -12
- package/.next/standalone/docs/hi/configuration.mdx +0 -222
- package/.next/standalone/docs/hi/custom-policies.mdx +0 -354
- package/.next/standalone/docs/hi/dashboard.mdx +0 -142
- package/.next/standalone/docs/hi/examples.mdx +0 -309
- package/.next/standalone/docs/hi/for-agents.mdx +0 -38
- package/.next/standalone/docs/hi/getting-started.mdx +0 -187
- package/.next/standalone/docs/hi/introduction.mdx +0 -57
- package/.next/standalone/docs/hi/package-aliases.mdx +0 -82
- package/.next/standalone/docs/hi/testing.mdx +0 -260
- package/.next/standalone/docs/i18n/README.ar.md +0 -312
- package/.next/standalone/docs/i18n/README.de.md +0 -307
- package/.next/standalone/docs/i18n/README.es.md +0 -307
- package/.next/standalone/docs/i18n/README.fr.md +0 -307
- package/.next/standalone/docs/i18n/README.he.md +0 -312
- package/.next/standalone/docs/i18n/README.hi.md +0 -307
- package/.next/standalone/docs/i18n/README.it.md +0 -307
- package/.next/standalone/docs/i18n/README.ja.md +0 -307
- package/.next/standalone/docs/i18n/README.ko.md +0 -307
- package/.next/standalone/docs/i18n/README.pt-br.md +0 -307
- package/.next/standalone/docs/i18n/README.ru.md +0 -308
- package/.next/standalone/docs/i18n/README.tr.md +0 -307
- package/.next/standalone/docs/i18n/README.vi.md +0 -307
- package/.next/standalone/docs/i18n/README.zh.md +0 -307
- package/.next/standalone/docs/introduction.mdx +0 -57
- package/.next/standalone/docs/it/architecture.mdx +0 -334
- package/.next/standalone/docs/it/built-in-policies.mdx +0 -574
- package/.next/standalone/docs/it/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/it/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/it/cli/hook.mdx +0 -30
- package/.next/standalone/docs/it/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/it/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/it/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/it/cli/version.mdx +0 -12
- package/.next/standalone/docs/it/configuration.mdx +0 -222
- package/.next/standalone/docs/it/custom-policies.mdx +0 -353
- package/.next/standalone/docs/it/dashboard.mdx +0 -142
- package/.next/standalone/docs/it/examples.mdx +0 -307
- package/.next/standalone/docs/it/for-agents.mdx +0 -38
- package/.next/standalone/docs/it/getting-started.mdx +0 -186
- package/.next/standalone/docs/it/introduction.mdx +0 -57
- package/.next/standalone/docs/it/package-aliases.mdx +0 -82
- package/.next/standalone/docs/it/testing.mdx +0 -260
- package/.next/standalone/docs/ja/architecture.mdx +0 -332
- package/.next/standalone/docs/ja/built-in-policies.mdx +0 -572
- package/.next/standalone/docs/ja/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/ja/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/ja/cli/hook.mdx +0 -30
- package/.next/standalone/docs/ja/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/ja/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/ja/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/ja/cli/version.mdx +0 -12
- package/.next/standalone/docs/ja/configuration.mdx +0 -222
- package/.next/standalone/docs/ja/custom-policies.mdx +0 -353
- package/.next/standalone/docs/ja/dashboard.mdx +0 -142
- package/.next/standalone/docs/ja/examples.mdx +0 -307
- package/.next/standalone/docs/ja/for-agents.mdx +0 -38
- package/.next/standalone/docs/ja/getting-started.mdx +0 -186
- package/.next/standalone/docs/ja/introduction.mdx +0 -57
- package/.next/standalone/docs/ja/package-aliases.mdx +0 -82
- package/.next/standalone/docs/ja/testing.mdx +0 -260
- package/.next/standalone/docs/ko/architecture.mdx +0 -332
- package/.next/standalone/docs/ko/built-in-policies.mdx +0 -572
- package/.next/standalone/docs/ko/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/ko/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/ko/cli/hook.mdx +0 -30
- package/.next/standalone/docs/ko/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/ko/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/ko/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/ko/cli/version.mdx +0 -12
- package/.next/standalone/docs/ko/configuration.mdx +0 -222
- package/.next/standalone/docs/ko/custom-policies.mdx +0 -353
- package/.next/standalone/docs/ko/dashboard.mdx +0 -142
- package/.next/standalone/docs/ko/examples.mdx +0 -307
- package/.next/standalone/docs/ko/for-agents.mdx +0 -38
- package/.next/standalone/docs/ko/getting-started.mdx +0 -186
- package/.next/standalone/docs/ko/introduction.mdx +0 -57
- package/.next/standalone/docs/ko/package-aliases.mdx +0 -82
- package/.next/standalone/docs/ko/testing.mdx +0 -260
- package/.next/standalone/docs/logo/dark.svg +0 -21
- package/.next/standalone/docs/logo/exosphere-dark.png +0 -0
- package/.next/standalone/docs/logo/exosphere-light.png +0 -0
- package/.next/standalone/docs/logo/light.svg +0 -21
- package/.next/standalone/docs/package-aliases.mdx +0 -82
- package/.next/standalone/docs/pt-br/architecture.mdx +0 -332
- package/.next/standalone/docs/pt-br/built-in-policies.mdx +0 -574
- package/.next/standalone/docs/pt-br/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/pt-br/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/pt-br/cli/hook.mdx +0 -30
- package/.next/standalone/docs/pt-br/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/pt-br/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/pt-br/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/pt-br/cli/version.mdx +0 -12
- package/.next/standalone/docs/pt-br/configuration.mdx +0 -222
- package/.next/standalone/docs/pt-br/custom-policies.mdx +0 -353
- package/.next/standalone/docs/pt-br/dashboard.mdx +0 -142
- package/.next/standalone/docs/pt-br/examples.mdx +0 -307
- package/.next/standalone/docs/pt-br/for-agents.mdx +0 -38
- package/.next/standalone/docs/pt-br/getting-started.mdx +0 -186
- package/.next/standalone/docs/pt-br/introduction.mdx +0 -57
- package/.next/standalone/docs/pt-br/package-aliases.mdx +0 -82
- package/.next/standalone/docs/pt-br/testing.mdx +0 -260
- package/.next/standalone/docs/ru/architecture.mdx +0 -333
- package/.next/standalone/docs/ru/built-in-policies.mdx +0 -574
- package/.next/standalone/docs/ru/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/ru/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/ru/cli/hook.mdx +0 -30
- package/.next/standalone/docs/ru/cli/install-policies.mdx +0 -48
- package/.next/standalone/docs/ru/cli/list-policies.mdx +0 -32
- package/.next/standalone/docs/ru/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/ru/cli/version.mdx +0 -12
- package/.next/standalone/docs/ru/configuration.mdx +0 -222
- package/.next/standalone/docs/ru/custom-policies.mdx +0 -354
- package/.next/standalone/docs/ru/dashboard.mdx +0 -142
- package/.next/standalone/docs/ru/examples.mdx +0 -309
- package/.next/standalone/docs/ru/for-agents.mdx +0 -38
- package/.next/standalone/docs/ru/getting-started.mdx +0 -186
- package/.next/standalone/docs/ru/introduction.mdx +0 -57
- package/.next/standalone/docs/ru/package-aliases.mdx +0 -82
- package/.next/standalone/docs/ru/testing.mdx +0 -260
- package/.next/standalone/docs/testing.mdx +0 -260
- package/.next/standalone/docs/tr/architecture.mdx +0 -333
- package/.next/standalone/docs/tr/built-in-policies.mdx +0 -574
- package/.next/standalone/docs/tr/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/tr/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/tr/cli/hook.mdx +0 -30
- package/.next/standalone/docs/tr/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/tr/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/tr/cli/remove-policies.mdx +0 -44
- package/.next/standalone/docs/tr/cli/version.mdx +0 -12
- package/.next/standalone/docs/tr/configuration.mdx +0 -222
- package/.next/standalone/docs/tr/custom-policies.mdx +0 -353
- package/.next/standalone/docs/tr/dashboard.mdx +0 -142
- package/.next/standalone/docs/tr/examples.mdx +0 -308
- package/.next/standalone/docs/tr/for-agents.mdx +0 -38
- package/.next/standalone/docs/tr/getting-started.mdx +0 -186
- package/.next/standalone/docs/tr/introduction.mdx +0 -57
- package/.next/standalone/docs/tr/package-aliases.mdx +0 -82
- package/.next/standalone/docs/tr/testing.mdx +0 -260
- package/.next/standalone/docs/vi/architecture.mdx +0 -334
- package/.next/standalone/docs/vi/built-in-policies.mdx +0 -572
- package/.next/standalone/docs/vi/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/vi/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/vi/cli/hook.mdx +0 -30
- package/.next/standalone/docs/vi/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/vi/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/vi/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/vi/cli/version.mdx +0 -13
- package/.next/standalone/docs/vi/configuration.mdx +0 -222
- package/.next/standalone/docs/vi/custom-policies.mdx +0 -353
- package/.next/standalone/docs/vi/dashboard.mdx +0 -142
- package/.next/standalone/docs/vi/examples.mdx +0 -308
- package/.next/standalone/docs/vi/for-agents.mdx +0 -38
- package/.next/standalone/docs/vi/getting-started.mdx +0 -186
- package/.next/standalone/docs/vi/introduction.mdx +0 -57
- package/.next/standalone/docs/vi/package-aliases.mdx +0 -82
- package/.next/standalone/docs/vi/testing.mdx +0 -260
- package/.next/standalone/docs/zh/architecture.mdx +0 -332
- package/.next/standalone/docs/zh/built-in-policies.mdx +0 -570
- package/.next/standalone/docs/zh/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/zh/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/zh/cli/hook.mdx +0 -30
- package/.next/standalone/docs/zh/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/zh/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/zh/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/zh/cli/version.mdx +0 -12
- package/.next/standalone/docs/zh/configuration.mdx +0 -222
- package/.next/standalone/docs/zh/custom-policies.mdx +0 -353
- package/.next/standalone/docs/zh/dashboard.mdx +0 -142
- package/.next/standalone/docs/zh/examples.mdx +0 -307
- package/.next/standalone/docs/zh/for-agents.mdx +0 -38
- package/.next/standalone/docs/zh/getting-started.mdx +0 -186
- package/.next/standalone/docs/zh/introduction.mdx +0 -57
- package/.next/standalone/docs/zh/package-aliases.mdx +0 -82
- package/.next/standalone/docs/zh/testing.mdx +0 -260
- package/.next/standalone/eslint.config.mjs +0 -15
- package/.next/standalone/examples/convention-policies/security-policies.mjs +0 -40
- package/.next/standalone/examples/convention-policies/workflow-policies.mjs +0 -41
- package/.next/standalone/examples/policies-advanced/index.js +0 -103
- package/.next/standalone/examples/policies-advanced/utils.js +0 -35
- package/.next/standalone/examples/policies-basic.js +0 -77
- package/.next/standalone/examples/policies-notification.js +0 -104
- package/.next/standalone/node_modules/@img/colour/color.cjs +0 -1594
- package/.next/standalone/node_modules/@img/colour/index.cjs +0 -1
- package/.next/standalone/node_modules/@img/colour/package.json +0 -45
- package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/README.md +0 -46
- package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/glib-2.0/include/glibconfig.h +0 -221
- package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/index.js +0 -1
- package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.17.3 +0 -0
- package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/package.json +0 -42
- package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/versions.json +0 -30
- package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/README.md +0 -46
- package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/glib-2.0/include/glibconfig.h +0 -221
- package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/index.js +0 -1
- package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/libvips-cpp.so.8.17.3 +0 -0
- package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/package.json +0 -42
- package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/versions.json +0 -30
- package/.next/standalone/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64.node +0 -0
- package/.next/standalone/node_modules/@img/sharp-linux-x64/package.json +0 -46
- package/.next/standalone/node_modules/@img/sharp-linuxmusl-x64/lib/sharp-linuxmusl-x64.node +0 -0
- package/.next/standalone/node_modules/@img/sharp-linuxmusl-x64/package.json +0 -46
- package/.next/standalone/node_modules/detect-libc/lib/detect-libc.js +0 -313
- package/.next/standalone/node_modules/detect-libc/lib/elf.js +0 -39
- package/.next/standalone/node_modules/detect-libc/lib/filesystem.js +0 -51
- package/.next/standalone/node_modules/detect-libc/lib/process.js +0 -24
- package/.next/standalone/node_modules/detect-libc/package.json +0 -44
- package/.next/standalone/node_modules/sharp/lib/channel.js +0 -177
- package/.next/standalone/node_modules/sharp/lib/colour.js +0 -195
- package/.next/standalone/node_modules/sharp/lib/composite.js +0 -212
- package/.next/standalone/node_modules/sharp/lib/constructor.js +0 -499
- package/.next/standalone/node_modules/sharp/lib/index.js +0 -16
- package/.next/standalone/node_modules/sharp/lib/input.js +0 -809
- package/.next/standalone/node_modules/sharp/lib/is.js +0 -143
- package/.next/standalone/node_modules/sharp/lib/libvips.js +0 -207
- package/.next/standalone/node_modules/sharp/lib/operation.js +0 -1016
- package/.next/standalone/node_modules/sharp/lib/output.js +0 -1666
- package/.next/standalone/node_modules/sharp/lib/resize.js +0 -595
- package/.next/standalone/node_modules/sharp/lib/sharp.js +0 -121
- package/.next/standalone/node_modules/sharp/lib/utility.js +0 -291
- package/.next/standalone/node_modules/sharp/node_modules/semver/classes/comparator.js +0 -143
- package/.next/standalone/node_modules/sharp/node_modules/semver/classes/range.js +0 -557
- package/.next/standalone/node_modules/sharp/node_modules/semver/classes/semver.js +0 -333
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/cmp.js +0 -54
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/coerce.js +0 -62
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/compare.js +0 -7
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/eq.js +0 -5
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/gt.js +0 -5
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/gte.js +0 -5
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/lt.js +0 -5
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/lte.js +0 -5
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/neq.js +0 -5
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/parse.js +0 -18
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/satisfies.js +0 -12
- package/.next/standalone/node_modules/sharp/node_modules/semver/internal/constants.js +0 -37
- package/.next/standalone/node_modules/sharp/node_modules/semver/internal/debug.js +0 -11
- package/.next/standalone/node_modules/sharp/node_modules/semver/internal/identifiers.js +0 -29
- package/.next/standalone/node_modules/sharp/node_modules/semver/internal/lrucache.js +0 -42
- package/.next/standalone/node_modules/sharp/node_modules/semver/internal/parse-options.js +0 -17
- package/.next/standalone/node_modules/sharp/node_modules/semver/internal/re.js +0 -223
- package/.next/standalone/node_modules/sharp/node_modules/semver/package.json +0 -78
- package/.next/standalone/node_modules/sharp/package.json +0 -202
- package/.next/standalone/scripts/alias-proxy.js +0 -18
- package/.next/standalone/scripts/dev.ts +0 -3
- package/.next/standalone/scripts/install-telemetry.mjs +0 -108
- package/.next/standalone/scripts/launch.ts +0 -83
- package/.next/standalone/scripts/parse-script-args.ts +0 -87
- package/.next/standalone/scripts/postinstall.mjs +0 -121
- package/.next/standalone/scripts/preuninstall.mjs +0 -131
- package/.next/standalone/scripts/publish-aliases.mjs +0 -87
- package/.next/standalone/scripts/start.ts +0 -3
- package/.next/standalone/scripts/sync-hook-events-prompt.md +0 -60
- package/.next/standalone/scripts/translate-docs/cache.ts +0 -62
- package/.next/standalone/scripts/translate-docs/cli.ts +0 -357
- package/.next/standalone/scripts/translate-docs/config.ts +0 -248
- package/.next/standalone/scripts/translate-docs/mdx-translator.ts +0 -153
- package/.next/standalone/scripts/translate-docs/mintlify-nav.ts +0 -107
- package/.next/standalone/scripts/translate-docs/readme-translator.ts +0 -154
- package/.next/standalone/scripts/translate-docs/translator.ts +0 -68
- package/.next/standalone/scripts/translate-docs/types.ts +0 -43
- package/.next/standalone/src/auth/login.ts +0 -104
- package/.next/standalone/src/auth/logout.ts +0 -50
- package/.next/standalone/src/auth/token-store.ts +0 -64
- package/.next/standalone/src/cli-error.ts +0 -18
- package/.next/standalone/src/hooks/builtin-policies.ts +0 -1615
- package/.next/standalone/src/hooks/custom-hooks-loader.ts +0 -205
- package/.next/standalone/src/hooks/custom-hooks-registry.ts +0 -30
- package/.next/standalone/src/hooks/handler.ts +0 -222
- package/.next/standalone/src/hooks/hook-activity-store.ts +0 -349
- package/.next/standalone/src/hooks/hook-logger.ts +0 -133
- package/.next/standalone/src/hooks/hook-telemetry.ts +0 -43
- package/.next/standalone/src/hooks/hooks-config.ts +0 -166
- package/.next/standalone/src/hooks/install-prompt.ts +0 -357
- package/.next/standalone/src/hooks/llm-client.ts +0 -90
- package/.next/standalone/src/hooks/loader-utils.ts +0 -178
- package/.next/standalone/src/hooks/manager.ts +0 -692
- package/.next/standalone/src/hooks/policy-evaluator.ts +0 -224
- package/.next/standalone/src/hooks/policy-helpers.ts +0 -16
- package/.next/standalone/src/hooks/policy-registry.ts +0 -90
- package/.next/standalone/src/hooks/policy-types.ts +0 -77
- package/.next/standalone/src/hooks/types.ts +0 -63
- package/.next/standalone/src/index.ts +0 -19
- package/.next/standalone/src/posthog-key.ts +0 -5
- package/.next/standalone/src/relay/daemon.ts +0 -362
- package/.next/standalone/src/relay/pid.ts +0 -76
- package/.next/standalone/src/relay/queue.ts +0 -225
- package/.next/standalone/tailwind.config.ts +0 -11
- package/.next/standalone/tsconfig.json +0 -42
- package/.next/standalone/vitest.config.e2e.mts +0 -24
- package/.next/standalone/vitest.config.mts +0 -23
- /package/.next/standalone/.next/static/{r-wX0MuAfCjbhJm3phQc8 → wOkJXoch1UmRAmyIuKZWc}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{r-wX0MuAfCjbhJm3phQc8 → wOkJXoch1UmRAmyIuKZWc}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{r-wX0MuAfCjbhJm3phQc8 → wOkJXoch1UmRAmyIuKZWc}/_ssgManifest.js +0 -0
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared launch logic for dev.ts and start.ts.
|
|
3
|
-
*/
|
|
4
|
-
import { getDefaultClaudeProjectsPath } from "../lib/paths";
|
|
5
|
-
import { spawn } from "child_process";
|
|
6
|
-
import { realpathSync, existsSync } from "node:fs";
|
|
7
|
-
import { resolve, dirname } from "node:path";
|
|
8
|
-
import { fileURLToPath } from "node:url";
|
|
9
|
-
import { parseScriptArgs } from "./parse-script-args";
|
|
10
|
-
import { version } from "../package.json";
|
|
11
|
-
|
|
12
|
-
export function launch(mode: "dev" | "start"): void {
|
|
13
|
-
const { claudeProjectsPath: parsedPath, loggingLevel, disableTelemetry, allowedDevOrigins, remainingArgs } = parseScriptArgs(process.argv.slice(2));
|
|
14
|
-
|
|
15
|
-
console.log(`
|
|
16
|
-
______ _ __ ____ ___ ____
|
|
17
|
-
/ ____/___ _(_) /___ _________ ____ / __/ / | / _/
|
|
18
|
-
/ /_ / __ \`/ / / __ \\/ ___/ __ \\/ __ \\/ /_ / /| | / /
|
|
19
|
-
/ __/ / /_/ / / / /_/ / / / /_/ / /_/ / __/ / ___ |_/ /
|
|
20
|
-
/_/ \\__,_/_/_/ .___/_/ \\____/\\____/_/ /_/ |_/___/
|
|
21
|
-
/_/ v${version}
|
|
22
|
-
`);
|
|
23
|
-
console.log(` ⭐ Star us: https://github.com/exospherehost/failproofai`);
|
|
24
|
-
console.log(` 📖 Docs: https://befailproof.ai\n`);
|
|
25
|
-
|
|
26
|
-
let claudeProjectsPath = parsedPath;
|
|
27
|
-
|
|
28
|
-
if (!claudeProjectsPath) {
|
|
29
|
-
claudeProjectsPath = getDefaultClaudeProjectsPath();
|
|
30
|
-
console.log(`Using default .claude projects path: ${claudeProjectsPath}`);
|
|
31
|
-
} else {
|
|
32
|
-
console.log(`Using custom .claude projects path: ${claudeProjectsPath}`);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
process.env.CLAUDE_PROJECTS_PATH = claudeProjectsPath;
|
|
36
|
-
|
|
37
|
-
let cmd: string;
|
|
38
|
-
let cmdArgs: string[];
|
|
39
|
-
if (mode === "start") {
|
|
40
|
-
const portIdx = remainingArgs.indexOf("--port");
|
|
41
|
-
const port = portIdx >= 0 ? remainingArgs[portIdx + 1] : "8020";
|
|
42
|
-
process.env.PORT = port;
|
|
43
|
-
process.env.HOSTNAME = "0.0.0.0";
|
|
44
|
-
cmd = "node";
|
|
45
|
-
// Resolve the real package root via realpathSync so symlinked npm global binaries
|
|
46
|
-
// don't cause import.meta.url to point at the symlink dir instead of the package dir.
|
|
47
|
-
const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT
|
|
48
|
-
?? resolve(dirname(realpathSync(fileURLToPath(import.meta.url))), "..");
|
|
49
|
-
const serverJsPath = resolve(packageRoot, ".next/standalone/server.js");
|
|
50
|
-
if (!existsSync(serverJsPath)) {
|
|
51
|
-
console.error(
|
|
52
|
-
`\nError: Cannot find server.js at:\n ${serverJsPath}\n\n` +
|
|
53
|
-
`The package may be missing its build output.\n` +
|
|
54
|
-
`Try reinstalling:\n npm install -g failproofai@latest\n`
|
|
55
|
-
);
|
|
56
|
-
process.exit(1);
|
|
57
|
-
}
|
|
58
|
-
cmdArgs = [serverJsPath];
|
|
59
|
-
} else {
|
|
60
|
-
cmd = "bunx";
|
|
61
|
-
cmdArgs = ["--bun", "next", "dev", ...remainingArgs];
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const nextProcess = spawn(cmd, cmdArgs, {
|
|
65
|
-
stdio: "inherit",
|
|
66
|
-
env: {
|
|
67
|
-
...process.env,
|
|
68
|
-
CLAUDE_PROJECTS_PATH: claudeProjectsPath,
|
|
69
|
-
...(loggingLevel ? { FAILPROOFAI_LOG_LEVEL: loggingLevel } : {}),
|
|
70
|
-
...(disableTelemetry ? { FAILPROOFAI_TELEMETRY_DISABLED: "1" } : {}),
|
|
71
|
-
...(allowedDevOrigins ? { FAILPROOFAI_ALLOWED_DEV_ORIGINS: allowedDevOrigins.join(",") } : {}),
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
nextProcess.on("error", (error) => {
|
|
76
|
-
console.error("Error starting Next.js:", error);
|
|
77
|
-
process.exit(1);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
nextProcess.on("exit", (code) => {
|
|
81
|
-
process.exit(code || 0);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared CLI argument parser for scripts/dev.ts and scripts/start.ts.
|
|
3
|
-
*/
|
|
4
|
-
import { resolve } from "path";
|
|
5
|
-
|
|
6
|
-
export interface ParsedScriptArgs {
|
|
7
|
-
claudeProjectsPath: string | undefined;
|
|
8
|
-
loggingLevel: string | undefined;
|
|
9
|
-
disableTelemetry: boolean;
|
|
10
|
-
allowedDevOrigins: string[] | undefined;
|
|
11
|
-
remainingArgs: string[];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function parseStringFlag(
|
|
15
|
-
flagName: string,
|
|
16
|
-
errorLabel: string,
|
|
17
|
-
inlineValue: string | null,
|
|
18
|
-
args: string[],
|
|
19
|
-
index: number,
|
|
20
|
-
options?: { resolve?: boolean },
|
|
21
|
-
): { value: string; spliceCount: number } {
|
|
22
|
-
const raw = inlineValue ?? args[index + 1];
|
|
23
|
-
if (raw === undefined || (inlineValue === null && raw.startsWith("-"))) {
|
|
24
|
-
console.error(`Error: ${flagName} requires ${errorLabel}`);
|
|
25
|
-
process.exit(1);
|
|
26
|
-
}
|
|
27
|
-
const value = options?.resolve ? resolve(raw) : raw;
|
|
28
|
-
return { value, spliceCount: inlineValue !== null ? 1 : 2 };
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function parseScriptArgs(argv: string[]): ParsedScriptArgs {
|
|
32
|
-
const args = [...argv];
|
|
33
|
-
let claudeProjectsPath: string | undefined;
|
|
34
|
-
let loggingLevel: string | undefined;
|
|
35
|
-
let disableTelemetry = false;
|
|
36
|
-
let allowedDevOrigins: string[] | undefined;
|
|
37
|
-
|
|
38
|
-
for (let i = 0; i < args.length; i++) {
|
|
39
|
-
const arg = args[i];
|
|
40
|
-
|
|
41
|
-
const eqIdx = arg.indexOf("=");
|
|
42
|
-
const flag = eqIdx >= 0 ? arg.slice(0, eqIdx) : arg;
|
|
43
|
-
const inlineValue = eqIdx >= 0 ? arg.slice(eqIdx + 1) : null;
|
|
44
|
-
|
|
45
|
-
if (flag === "--projects-path" || flag === "-p") {
|
|
46
|
-
const { value, spliceCount } = parseStringFlag(flag, "a path argument", inlineValue, args, i);
|
|
47
|
-
claudeProjectsPath = value;
|
|
48
|
-
args.splice(i, spliceCount);
|
|
49
|
-
i--;
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (flag === "--logging") {
|
|
54
|
-
const raw = inlineValue ?? args[i + 1];
|
|
55
|
-
if (raw === undefined || (inlineValue === null && raw.startsWith("-"))) {
|
|
56
|
-
console.error("Error: --logging requires a level (info, warn, error)");
|
|
57
|
-
process.exit(1);
|
|
58
|
-
}
|
|
59
|
-
const val = raw.toLowerCase();
|
|
60
|
-
if (val !== "info" && val !== "warn" && val !== "error") {
|
|
61
|
-
console.error("Error: --logging must be one of: info, warn, error");
|
|
62
|
-
process.exit(1);
|
|
63
|
-
}
|
|
64
|
-
loggingLevel = val;
|
|
65
|
-
args.splice(i, inlineValue !== null ? 1 : 2);
|
|
66
|
-
i--;
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (flag === "--disable-telemetry") {
|
|
71
|
-
disableTelemetry = true;
|
|
72
|
-
args.splice(i, 1);
|
|
73
|
-
i--;
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (flag === "--allowed-origins") {
|
|
78
|
-
const { value, spliceCount } = parseStringFlag(flag, "a comma-separated list of origins", inlineValue, args, i);
|
|
79
|
-
allowedDevOrigins = value.split(",").map(s => s.trim()).filter(Boolean);
|
|
80
|
-
args.splice(i, spliceCount);
|
|
81
|
-
i--;
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return { claudeProjectsPath, loggingLevel, disableTelemetry, allowedDevOrigins, remainingArgs: args };
|
|
87
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* postinstall script for the failproofai package.
|
|
4
|
-
*
|
|
5
|
-
* 1. Warns if hooks config exists but hooks are missing from Claude Code settings.
|
|
6
|
-
* 2. Tracks a package_installed telemetry event.
|
|
7
|
-
*
|
|
8
|
-
* No external dependencies — Node.js built-ins only.
|
|
9
|
-
*/
|
|
10
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
11
|
-
import { resolve } from "node:path";
|
|
12
|
-
import { platform, arch, release, homedir, hostname } from "node:os";
|
|
13
|
-
import { createHmac } from "node:crypto";
|
|
14
|
-
import { trackInstallEvent } from "./install-telemetry.mjs";
|
|
15
|
-
|
|
16
|
-
// Skip when running in development context (e.g. `bun install` in the source repo).
|
|
17
|
-
// INIT_CWD is set by npm/bun to the directory where install was invoked; it differs
|
|
18
|
-
// from process.cwd() only when we are being installed as a dependency by someone else.
|
|
19
|
-
if (!process.env.INIT_CWD || process.env.INIT_CWD === process.cwd()) process.exit(0);
|
|
20
|
-
|
|
21
|
-
// Verify server.js exists — fail the install early if the dashboard build is missing.
|
|
22
|
-
const serverJsPath = resolve(process.cwd(), ".next", "standalone", "server.js");
|
|
23
|
-
if (!existsSync(serverJsPath)) {
|
|
24
|
-
console.error(
|
|
25
|
-
`\n[failproofai] Error: server.js not found at:\n ${serverJsPath}\n\n` +
|
|
26
|
-
` The package may not have been built correctly.\n` +
|
|
27
|
-
` Try reinstalling: npm install -g failproofai@latest\n`
|
|
28
|
-
);
|
|
29
|
-
process.exit(1);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const FAILPROOFAI_HOOK_MARKER = "__failproofai_hook__";
|
|
33
|
-
const NAMESPACE = "failproofai-telemetry-v1";
|
|
34
|
-
|
|
35
|
-
function hashToId(raw) {
|
|
36
|
-
return createHmac("sha256", NAMESPACE).update(raw).digest("hex");
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Returns the current hooks configuration state.
|
|
41
|
-
* @returns {{ configured: boolean, registered: boolean, policyCount: number }}
|
|
42
|
-
*/
|
|
43
|
-
function checkHooks() {
|
|
44
|
-
const hooksConfigPath = resolve(homedir(), ".failproofai", "policies-config.json");
|
|
45
|
-
if (!existsSync(hooksConfigPath)) {
|
|
46
|
-
return { configured: false, registered: false, policyCount: 0 };
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
let config;
|
|
50
|
-
try {
|
|
51
|
-
config = JSON.parse(readFileSync(hooksConfigPath, "utf8"));
|
|
52
|
-
} catch {
|
|
53
|
-
return { configured: false, registered: false, policyCount: 0 };
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (!Array.isArray(config.enabledPolicies) || config.enabledPolicies.length === 0) {
|
|
57
|
-
return { configured: false, registered: false, policyCount: 0 };
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const policyCount = config.enabledPolicies.length;
|
|
61
|
-
|
|
62
|
-
// Check if Claude Code settings have failproofai hooks
|
|
63
|
-
const settingsPath = resolve(homedir(), ".claude", "settings.json");
|
|
64
|
-
if (!existsSync(settingsPath)) {
|
|
65
|
-
printHooksWarning();
|
|
66
|
-
return { configured: true, registered: false, policyCount };
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
let settings;
|
|
70
|
-
try {
|
|
71
|
-
settings = JSON.parse(readFileSync(settingsPath, "utf8"));
|
|
72
|
-
} catch {
|
|
73
|
-
printHooksWarning();
|
|
74
|
-
return { configured: true, registered: false, policyCount };
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (!settings.hooks) {
|
|
78
|
-
printHooksWarning();
|
|
79
|
-
return { configured: true, registered: false, policyCount };
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Walk settings.hooks looking for failproofai entries
|
|
83
|
-
for (const matchers of Object.values(settings.hooks)) {
|
|
84
|
-
if (!Array.isArray(matchers)) continue;
|
|
85
|
-
for (const matcher of matchers) {
|
|
86
|
-
if (!matcher.hooks) continue;
|
|
87
|
-
if (matcher.hooks.some((h) => h[FAILPROOFAI_HOOK_MARKER] === true)) {
|
|
88
|
-
return { configured: true, registered: true, policyCount };
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
printHooksWarning();
|
|
94
|
-
return { configured: true, registered: false, policyCount };
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function printHooksWarning() {
|
|
98
|
-
console.log(
|
|
99
|
-
`\n[failproofai] Warning: hooks config exists with enabled policies, but hooks are not registered in Claude Code settings.\n` +
|
|
100
|
-
` To re-register hooks, run:\n` +
|
|
101
|
-
` failproofai policies --uninstall && failproofai policies --install\n`
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
let hooksResult = { configured: false, registered: false, policyCount: 0 };
|
|
106
|
-
try {
|
|
107
|
-
hooksResult = checkHooks();
|
|
108
|
-
} catch {
|
|
109
|
-
// Non-critical — don't fail the install
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Telemetry (best-effort, fire-and-forget)
|
|
113
|
-
trackInstallEvent("package_installed", {
|
|
114
|
-
platform: platform(),
|
|
115
|
-
arch: arch(),
|
|
116
|
-
os_release: release(),
|
|
117
|
-
hostname_hash: hashToId(hostname()),
|
|
118
|
-
hooks_configured: hooksResult.configured,
|
|
119
|
-
hooks_registered: hooksResult.registered,
|
|
120
|
-
enabled_policy_count: hooksResult.policyCount,
|
|
121
|
-
}).catch(() => {});
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* preuninstall script for the failproofai package.
|
|
4
|
-
*
|
|
5
|
-
* Removes failproofai hook entries from all reachable Claude Code settings files:
|
|
6
|
-
* - ~/.claude/settings.json (user scope — always attempted)
|
|
7
|
-
* - {cwd}/.claude/settings.json (project scope — if it exists)
|
|
8
|
-
* - {cwd}/.claude/settings.local.json (local scope — if it exists)
|
|
9
|
-
*
|
|
10
|
-
* Does NOT delete ~/.failproofai/ (preserves cache, hooks-config, instance-id).
|
|
11
|
-
*
|
|
12
|
-
* Never exits non-zero — uninstall must not be blocked by cleanup failures.
|
|
13
|
-
* No external dependencies — Node.js built-ins only.
|
|
14
|
-
*/
|
|
15
|
-
import { readFileSync, writeFileSync, existsSync } from "node:fs";
|
|
16
|
-
import { resolve } from "node:path";
|
|
17
|
-
import { homedir, platform, arch } from "node:os";
|
|
18
|
-
import { trackInstallEvent } from "./install-telemetry.mjs";
|
|
19
|
-
|
|
20
|
-
// Skip when running in development context (same guard as postinstall.mjs).
|
|
21
|
-
if (process.env.INIT_CWD && process.env.INIT_CWD === process.cwd()) process.exit(0);
|
|
22
|
-
|
|
23
|
-
const FAILPROOFAI_HOOK_MARKER = "__failproofai_hook__";
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Remove all failproofai-marked hook entries from a single settings file.
|
|
27
|
-
* Returns the number of hook entries removed.
|
|
28
|
-
* Writes the file only when at least one hook was removed.
|
|
29
|
-
*/
|
|
30
|
-
function removeHooksFromFile(settingsPath) {
|
|
31
|
-
if (!existsSync(settingsPath)) return 0;
|
|
32
|
-
|
|
33
|
-
let settings;
|
|
34
|
-
try {
|
|
35
|
-
settings = JSON.parse(readFileSync(settingsPath, "utf8"));
|
|
36
|
-
} catch {
|
|
37
|
-
return 0; // Corrupt or unreadable — nothing to do
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (!settings?.hooks) return 0;
|
|
41
|
-
|
|
42
|
-
let hooksRemoved = 0;
|
|
43
|
-
|
|
44
|
-
for (const eventType of Object.keys(settings.hooks)) {
|
|
45
|
-
const matchers = settings.hooks[eventType];
|
|
46
|
-
if (!Array.isArray(matchers)) continue;
|
|
47
|
-
|
|
48
|
-
for (let i = matchers.length - 1; i >= 0; i--) {
|
|
49
|
-
const matcher = matchers[i];
|
|
50
|
-
if (!matcher.hooks) continue;
|
|
51
|
-
|
|
52
|
-
const before = matcher.hooks.length;
|
|
53
|
-
matcher.hooks = matcher.hooks.filter((h) => {
|
|
54
|
-
if (h[FAILPROOFAI_HOOK_MARKER] === true) return false; // marked entry
|
|
55
|
-
// Fallback for legacy installs that predate the marker
|
|
56
|
-
const cmd = typeof h.command === "string" ? h.command : "";
|
|
57
|
-
if (cmd.includes("failproofai") && cmd.includes("--hook")) return false;
|
|
58
|
-
return true;
|
|
59
|
-
});
|
|
60
|
-
hooksRemoved += before - matcher.hooks.length;
|
|
61
|
-
|
|
62
|
-
// Remove now-empty matchers
|
|
63
|
-
if (matcher.hooks.length === 0) {
|
|
64
|
-
matchers.splice(i, 1);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Remove now-empty event type arrays
|
|
69
|
-
if (matchers.length === 0) {
|
|
70
|
-
delete settings.hooks[eventType];
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Remove now-empty hooks object
|
|
75
|
-
if (Object.keys(settings.hooks).length === 0) {
|
|
76
|
-
delete settings.hooks;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (hooksRemoved > 0) {
|
|
80
|
-
try {
|
|
81
|
-
writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n", "utf8");
|
|
82
|
-
} catch {
|
|
83
|
-
// Best-effort — don't block uninstall
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return hooksRemoved;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
let totalRemoved = 0;
|
|
91
|
-
|
|
92
|
-
try {
|
|
93
|
-
const home = homedir();
|
|
94
|
-
const projectCwd = process.cwd();
|
|
95
|
-
|
|
96
|
-
// Build list of settings files to clean, deduped in case cwd === home
|
|
97
|
-
const candidates = [
|
|
98
|
-
resolve(home, ".claude", "settings.json"), // user scope
|
|
99
|
-
resolve(projectCwd, ".claude", "settings.json"), // project scope
|
|
100
|
-
resolve(projectCwd, ".claude", "settings.local.json"), // local scope
|
|
101
|
-
];
|
|
102
|
-
const seen = new Set();
|
|
103
|
-
const settingsPaths = candidates.filter((p) => {
|
|
104
|
-
if (seen.has(p)) return false;
|
|
105
|
-
seen.add(p);
|
|
106
|
-
return true;
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
for (const settingsPath of settingsPaths) {
|
|
110
|
-
const removed = removeHooksFromFile(settingsPath);
|
|
111
|
-
if (removed > 0) {
|
|
112
|
-
console.log(`[failproofai] Removed ${removed} hook(s) from ${settingsPath}.`);
|
|
113
|
-
totalRemoved += removed;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (totalRemoved === 0) {
|
|
118
|
-
console.log("[failproofai] No hook entries found to remove.");
|
|
119
|
-
}
|
|
120
|
-
} catch {
|
|
121
|
-
// Never block uninstall
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// Telemetry — best-effort, awaited so the process stays alive long enough to send
|
|
125
|
-
try {
|
|
126
|
-
await trackInstallEvent("package_uninstalled", {
|
|
127
|
-
platform: platform(),
|
|
128
|
-
arch: arch(),
|
|
129
|
-
hooks_removed: totalRemoved,
|
|
130
|
-
});
|
|
131
|
-
} catch {}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { execSync } from 'child_process';
|
|
3
|
-
import { readFileSync, writeFileSync, mkdirSync, rmSync, cpSync } from 'fs';
|
|
4
|
-
import { join, dirname } from 'path';
|
|
5
|
-
import { fileURLToPath } from 'url';
|
|
6
|
-
|
|
7
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
-
const rootPkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf8'));
|
|
9
|
-
const VERSION = rootPkg.version;
|
|
10
|
-
const DRY_RUN = process.argv.includes('--dry-run');
|
|
11
|
-
const distTagIdx = process.argv.indexOf('--dist-tag');
|
|
12
|
-
const DIST_TAG = distTagIdx !== -1 ? process.argv[distTagIdx + 1] : (VERSION.includes('-') ? 'beta' : 'latest');
|
|
13
|
-
|
|
14
|
-
const ALIASES = [
|
|
15
|
-
// Formatting variants — no "ai", or hyphen/underscore separators
|
|
16
|
-
'failproof',
|
|
17
|
-
'failproof-ai',
|
|
18
|
-
'fail-proof-ai',
|
|
19
|
-
'failproof_ai',
|
|
20
|
-
'fail_proof_ai',
|
|
21
|
-
'fail-proofai',
|
|
22
|
-
// Missing one 'o' from "proof" — common single-char slip
|
|
23
|
-
'failprof',
|
|
24
|
-
'failprof-ai',
|
|
25
|
-
'failprofai',
|
|
26
|
-
'fail-prof-ai',
|
|
27
|
-
'failprof_ai',
|
|
28
|
-
// 'a'/'i' transposition — common keyboard slip
|
|
29
|
-
'faliproof',
|
|
30
|
-
'faliproof-ai',
|
|
31
|
-
'faliproofai',
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
const warnings = [];
|
|
35
|
-
|
|
36
|
-
for (const name of ALIASES) {
|
|
37
|
-
const tmpDir = join('/tmp', `npm-alias-${name}-${Date.now()}`);
|
|
38
|
-
const binDir = join(tmpDir, 'bin');
|
|
39
|
-
mkdirSync(binDir, { recursive: true });
|
|
40
|
-
|
|
41
|
-
const pkg = {
|
|
42
|
-
name,
|
|
43
|
-
version: VERSION,
|
|
44
|
-
description: `Alias for failproofai — installs if you typed '${name}' instead of 'failproofai'`,
|
|
45
|
-
bin: { [name]: './bin/proxy.js' },
|
|
46
|
-
files: ['bin/'],
|
|
47
|
-
dependencies: { failproofai: VERSION },
|
|
48
|
-
publishConfig: { access: 'public' },
|
|
49
|
-
repository: rootPkg.repository,
|
|
50
|
-
homepage: rootPkg.homepage,
|
|
51
|
-
bugs: rootPkg.bugs,
|
|
52
|
-
license: rootPkg.license,
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
writeFileSync(join(tmpDir, 'package.json'), JSON.stringify(pkg, null, 2) + '\n');
|
|
56
|
-
cpSync(join(__dirname, 'alias-proxy.js'), join(binDir, 'proxy.js'));
|
|
57
|
-
|
|
58
|
-
if (DRY_RUN) {
|
|
59
|
-
console.log(`[dry-run] Would publish ${name}@${VERSION} (tag: ${DIST_TAG})`);
|
|
60
|
-
console.log(JSON.stringify(pkg, null, 2));
|
|
61
|
-
console.log('---');
|
|
62
|
-
rmSync(tmpDir, { recursive: true, force: true });
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
console.log(`Publishing ${name}@${VERSION}...`);
|
|
67
|
-
try {
|
|
68
|
-
execSync(`npm publish --tag ${DIST_TAG}`, { cwd: tmpDir, stdio: 'pipe' });
|
|
69
|
-
console.log(`Done: ${name}`);
|
|
70
|
-
} catch (err) {
|
|
71
|
-
const output = (err.stdout?.toString() ?? '') + (err.stderr?.toString() ?? '');
|
|
72
|
-
if (output.includes('too similar')) {
|
|
73
|
-
warnings.push(`${name}: blocked by npm similarity check — request via npm support`);
|
|
74
|
-
} else if (output.includes('cannot publish over')) {
|
|
75
|
-
console.log(`[skip] ${name}: already published at ${VERSION}`);
|
|
76
|
-
} else {
|
|
77
|
-
warnings.push(`${name}: ${output.trim().split('\n').find(l => l.includes('npm error')) ?? 'unknown error'}`);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
rmSync(tmpDir, { recursive: true, force: true });
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (warnings.length > 0) {
|
|
85
|
-
console.log('\n::warning::Some alias packages were not published:');
|
|
86
|
-
for (const w of warnings) console.log(` - ${w}`);
|
|
87
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
You are an automated agent running in GitHub Actions to keep failproofai's hook
|
|
2
|
-
event types in sync with the official Claude Code documentation.
|
|
3
|
-
|
|
4
|
-
## Your task
|
|
5
|
-
|
|
6
|
-
1. Fetch the Claude Code hooks reference pages using WebFetch:
|
|
7
|
-
- https://code.claude.com/docs/en/hooks (full reference — has the complete event table)
|
|
8
|
-
- https://code.claude.com/docs/en/hooks-guide (guide — also has a summary event table)
|
|
9
|
-
Extract the complete list of all hook event type names (e.g. SessionStart,
|
|
10
|
-
PreToolUse, PostToolUse, etc.) from the event lifecycle/trigger table.
|
|
11
|
-
Use both pages; union the results if they differ. Prefer the reference page.
|
|
12
|
-
|
|
13
|
-
2. Read `src/hooks/types.ts` and extract the current `HOOK_EVENT_TYPES` array
|
|
14
|
-
(the TypeScript `as const` array of strings).
|
|
15
|
-
|
|
16
|
-
3. Diff the two lists:
|
|
17
|
-
- **added**: event types in the docs but NOT in our array
|
|
18
|
-
- **removed**: event types in our array but NOT in the docs
|
|
19
|
-
|
|
20
|
-
4. If there are NO differences:
|
|
21
|
-
Write the following JSON to `.sync-hook-events-output.json` in the repo root:
|
|
22
|
-
```json
|
|
23
|
-
{ "changed": false }
|
|
24
|
-
```
|
|
25
|
-
Then stop.
|
|
26
|
-
|
|
27
|
-
5. If there are differences:
|
|
28
|
-
|
|
29
|
-
a. Update `HOOK_EVENT_TYPES` in `src/hooks/types.ts`:
|
|
30
|
-
- Add new event types (append after the last existing entry, before `] as const`)
|
|
31
|
-
- Remove stale event types if any
|
|
32
|
-
|
|
33
|
-
b. Update `__tests__/hooks/manager.test.ts` — find the hardcoded event-type
|
|
34
|
-
counts and update them to the new total:
|
|
35
|
-
- The test description string matching `all N event types`
|
|
36
|
-
- The `toHaveLength(N)` assertion(s) that check `Object.keys(written.hooks)`
|
|
37
|
-
Search by the current count number to locate them.
|
|
38
|
-
|
|
39
|
-
c. Write the following JSON to `.sync-hook-events-output.json` in the repo root:
|
|
40
|
-
```json
|
|
41
|
-
{
|
|
42
|
-
"changed": true,
|
|
43
|
-
"added": ["EventA", "EventB"],
|
|
44
|
-
"removed": ["EventC"],
|
|
45
|
-
"prTitle": "[auto] sync hook event types with Claude Code docs",
|
|
46
|
-
"prBody": "..."
|
|
47
|
-
}
|
|
48
|
-
```
|
|
49
|
-
The `prBody` must be a Markdown string containing:
|
|
50
|
-
- List of **added** event types (or "none")
|
|
51
|
-
- List of **removed** event types (or "none")
|
|
52
|
-
- Source URLs used
|
|
53
|
-
- A note: "CI must pass and this PR must be reviewed before merging."
|
|
54
|
-
|
|
55
|
-
## Constraints
|
|
56
|
-
|
|
57
|
-
- **Only edit `src/hooks/types.ts`, `__tests__/hooks/manager.test.ts`, and
|
|
58
|
-
`.sync-hook-events-output.json`**. No other files.
|
|
59
|
-
- Do NOT run any shell commands (no git, no gh, no bun).
|
|
60
|
-
- Do NOT modify `policy-evaluator.ts`, `manager.ts`, or any other source file.
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
|
-
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
import type { CacheEntry, TranslationCache } from "./types";
|
|
6
|
-
|
|
7
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
-
const CACHE_FILE = join(__dirname, ".translation-cache.json");
|
|
9
|
-
|
|
10
|
-
export function contentHash(content: string): string {
|
|
11
|
-
return createHash("sha256").update(content).digest("hex").slice(0, 16);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function readCache(): TranslationCache {
|
|
15
|
-
if (!existsSync(CACHE_FILE)) {
|
|
16
|
-
return { sourceHash: "", lastUpdated: "", translations: {} };
|
|
17
|
-
}
|
|
18
|
-
try {
|
|
19
|
-
return JSON.parse(readFileSync(CACHE_FILE, "utf-8"));
|
|
20
|
-
} catch {
|
|
21
|
-
return { sourceHash: "", lastUpdated: "", translations: {} };
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function writeCache(cache: TranslationCache): void {
|
|
26
|
-
cache.lastUpdated = new Date().toISOString();
|
|
27
|
-
writeFileSync(CACHE_FILE, JSON.stringify(cache, null, 2));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function getCacheKey(sourcePath: string, lang: string): string {
|
|
31
|
-
return `${sourcePath}::${lang}`;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function isCached(
|
|
35
|
-
cache: TranslationCache,
|
|
36
|
-
sourcePath: string,
|
|
37
|
-
lang: string,
|
|
38
|
-
sourceContent: string,
|
|
39
|
-
): boolean {
|
|
40
|
-
const key = getCacheKey(sourcePath, lang);
|
|
41
|
-
const entry = cache.translations[key];
|
|
42
|
-
if (!entry) return false;
|
|
43
|
-
return entry.sourceHash === contentHash(sourceContent);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function setCacheEntry(
|
|
47
|
-
cache: TranslationCache,
|
|
48
|
-
sourcePath: string,
|
|
49
|
-
lang: string,
|
|
50
|
-
sourceContent: string,
|
|
51
|
-
inputTokens: number,
|
|
52
|
-
outputTokens: number,
|
|
53
|
-
): void {
|
|
54
|
-
const key = getCacheKey(sourcePath, lang);
|
|
55
|
-
cache.translations[key] = {
|
|
56
|
-
sourceHash: contentHash(sourceContent),
|
|
57
|
-
targetLang: lang,
|
|
58
|
-
translatedAt: new Date().toISOString(),
|
|
59
|
-
inputTokens,
|
|
60
|
-
outputTokens,
|
|
61
|
-
};
|
|
62
|
-
}
|