failproofai 1.0.0-beta.2 → 1.0.0-beta.21
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/app-path-routes-manifest.json +2 -1
- package/.next/standalone/.next/build-manifest.json +6 -6
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/required-server-files.json +1 -1
- package/.next/standalone/.next/routes-manifest.json +6 -0
- package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +3 -3
- 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 +3 -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 +3 -3
- 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 +3 -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 +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +15 -15
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +15 -15
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +10 -10
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/api/audit/invite/route.js +3 -2
- package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/run/route.js +4 -3
- package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/status/route.js +1 -1
- package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-request/route.js +3 -1
- package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-verify/route.js +3 -2
- package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/logout/route.js +3 -2
- package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/reminder/route.js +3 -2
- package/.next/standalone/.next/server/app/api/auth/reminder/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/status/route.js +3 -2
- package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js +1 -1
- package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/audit/page.js +5 -3
- package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +15 -15
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +15 -15
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +10 -10
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page.js +3 -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 +3 -3
- package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +30 -18
- package/.next/standalone/.next/server/app/policies/page.js +5 -3
- 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 +3 -3
- 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 +4 -2
- 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 +3 -3
- 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 +6 -4
- 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 +3 -3
- package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js +4 -2
- 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/app/settings/page/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/settings/page/build-manifest.json +18 -0
- package/.next/standalone/.next/server/app/settings/page/next-font-manifest.json +6 -0
- package/.next/standalone/.next/server/app/settings/page/react-loadable-manifest.json +1 -0
- package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +53 -0
- package/.next/standalone/.next/server/app/settings/page.js +18 -0
- package/.next/standalone/.next/server/app/settings/page.js.map +5 -0
- package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +3 -0
- package/.next/standalone/.next/server/app-paths-manifest.json +2 -1
- package/.next/standalone/.next/server/chunks/[externals]__0h9_83k._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[externals]__1nl3dvw._.js → [externals]__0r-zamh._.js} +2 -2
- package/.next/standalone/.next/server/chunks/[externals]__1ifpkx-._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0l4vuqm._.js → [root-of-the-server]__00ni9za._.js} +2 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__06hexd0._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__08y94xv._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__094p1f1._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_0xu5z._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ed01_d._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0-dh5jy._.js → [root-of-the-server]__0effm9m._.js} +2 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0g0vcwt._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__18d-9oi._.js → [root-of-the-server]__0ix8gm7._.js} +2 -2
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0h3lfmp._.js → [root-of-the-server]__0ji11a-._.js} +2 -2
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__10oa-v9._.js → [root-of-the-server]__0ojwjxl._.js} +2 -2
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__16le-kd._.js → [root-of-the-server]__0pbp9fe._.js} +2 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0q-v9z2._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0vb5fl2._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0sb_5m8._.js → [root-of-the-server]__131ebum._.js} +4 -4
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1ibjy5x._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1tvn4wf._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__20d06rh._.js +3 -0
- package/.next/standalone/.next/server/chunks/_0lxbzdq._.js +3 -0
- package/.next/standalone/.next/server/chunks/_1zuiiy3._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_telemetry_ts_0dctyyw._.js +3 -0
- package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_17k9e3w.js +5 -5
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oi._.js +2 -1
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_09z9-p7._.js +2 -1
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[externals]__1aq139v._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0-wfhrp._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__06bp_fg._.js +5 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__074qmkp._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1apb7k_._.js → [root-of-the-server]__0_1tiya._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__170799-._.js → [root-of-the-server]__0spkm68._.js} +11 -11
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0t281d4._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__17itmx-._.js +5 -0
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__01od0m6._.js → [root-of-the-server]__1n2vcv4._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1qapotl._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1rv-sc9._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1tlvv9a._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1u-wx42._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1v185mo._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0-yi74u._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0rjgfln._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0vo2qyt._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0xej-0e._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_10399ge._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_11_p9y8._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_149k9oy._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_1_hwp06._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_1ctse6u._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_1e19atl._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1mnhi_r._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_1ror7k9._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_1sdgprl._.js +5 -0
- package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0dwo94s.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuzn._.js +2 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_builtin-policies_ts_09j2ndl._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-config_ts_04t589g._.js +4 -0
- package/.next/standalone/.next/server/middleware-build-manifest.js +6 -6
- package/.next/standalone/.next/server/middleware.js +2 -2
- package/.next/standalone/.next/server/pages/404.html +1 -1
- 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 +74 -20
- package/.next/standalone/.next/static/chunks/{03fmihek9n986.js → 06zgzyh3wv1ig.js} +1 -1
- package/.next/standalone/.next/static/chunks/0km-jn9o5xyqs.css +2 -0
- package/.next/standalone/.next/static/chunks/{1hdhteui932bq.js → 0qmo2t50kpb30.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2sbelanzvxvv0.js → 113g8wtal6_c4.js} +22 -22
- package/.next/standalone/.next/static/chunks/16p68cybetr31.js +1 -0
- package/.next/standalone/.next/static/chunks/18wqn0_3mzylf.js +1 -0
- package/.next/standalone/.next/static/chunks/1v1gqvpjk62jm.js +1 -0
- package/.next/standalone/.next/static/chunks/{0fi645si-uiiq.js → 1xq1m8h14tnlj.js} +1 -1
- package/.next/standalone/.next/static/chunks/{3hp8ulqknybil.js → 1y3vwogqb88dx.js} +1 -1
- package/.next/standalone/.next/static/chunks/{3vs4ay36tjds_.js → 1zmh-b0ulrqu7.js} +1 -1
- package/.next/standalone/.next/static/chunks/23kev26by1e4f.js +1 -0
- package/.next/standalone/.next/static/chunks/299lhw60e8gr6.js +1 -0
- package/.next/standalone/.next/static/chunks/{18rvdw5v72364.js → 2adbpdaxp5ygq.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2j94uwkb4s3qr.js → 2kbqcw-6swmav.js} +1 -1
- package/.next/standalone/.next/static/chunks/2n9n5m0963pdg.js +6 -0
- package/.next/standalone/.next/static/chunks/2uvhw57mf9lg_.css +2 -0
- package/.next/standalone/.next/static/chunks/{31feojxhjyjpl.js → 30nrrpwymht5m.js} +1 -1
- package/.next/standalone/.next/static/chunks/31coz11ia5vc4.js +1 -0
- package/.next/standalone/.next/static/chunks/{turbopack-1lsv92x7klwrn.js → turbopack-3diub4ctvn1n0.js} +1 -1
- package/.next/standalone/SECURITY.md +8 -2
- package/.next/standalone/app/actions/get-active-pauses.ts +16 -0
- package/.next/standalone/app/actions/get-hooks-config.ts +2 -2
- package/.next/standalone/app/actions/get-scheduled-audit.ts +70 -0
- package/.next/standalone/app/actions/update-scheduled-audit.ts +44 -0
- package/.next/standalone/app/api/audit/run/route.ts +28 -0
- package/.next/standalone/app/api/audit/status/route.ts +13 -1
- package/.next/standalone/app/api/auth/status/route.ts +1 -1
- package/.next/standalone/app/audit/_components/audit-dashboard.tsx +1 -3
- package/.next/standalone/app/audit/_components/audit-progress-strip.tsx +1 -1
- package/.next/standalone/app/audit/_components/auth-dialog.css +159 -0
- package/.next/standalone/app/audit/_components/auth-dialog.tsx +3 -0
- package/.next/standalone/app/audit/_components/come-back-better-section.tsx +1 -1
- package/.next/standalone/app/audit/_components/empty-state.tsx +0 -1
- package/.next/standalone/app/audit/_components/how-to-improve-section.tsx +1 -1
- package/.next/standalone/app/audit/_components/quirks-section.tsx +0 -1
- package/.next/standalone/app/audit/_components/report-footer.tsx +0 -2
- package/.next/standalone/app/audit/_components/run-progress.tsx +1 -1
- package/.next/standalone/app/audit/_components/strengths-section.tsx +0 -1
- package/.next/standalone/app/audit/audit-styles.css +6 -149
- package/.next/standalone/app/components/pause-notices.tsx +111 -0
- package/.next/standalone/app/components/raw-log-viewer.tsx +1 -1
- package/.next/standalone/app/components/toast.tsx +1 -1
- package/.next/standalone/app/policies/hooks-client.tsx +84 -8
- package/.next/standalone/app/settings/page.tsx +31 -0
- package/.next/standalone/app/settings/settings-client.tsx +487 -0
- package/.next/standalone/components/navbar.tsx +2 -0
- package/.next/standalone/lib/auth/api-server-client.ts +2 -3
- package/.next/standalone/lib/auth/auth-store.ts +4 -5
- package/.next/standalone/lib/codex-sessions.ts +2 -1
- package/.next/standalone/lib/dashboard-host.ts +101 -0
- package/.next/standalone/lib/install-check.ts +22 -7
- package/.next/standalone/lib/pi-sessions.ts +99 -14
- package/.next/standalone/lib/telemetry-enabled.ts +54 -0
- package/.next/standalone/lib/telemetry-id.ts +52 -1
- package/.next/standalone/lib/telemetry.ts +8 -4
- 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 +3 -3
- 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 +4 -4
- package/.next/standalone/package.json +23 -12
- package/.next/standalone/proxy.ts +111 -1
- package/.next/standalone/server.js +1 -1
- package/bin/failproofai-worker.mjs +1 -1
- package/bin/failproofai.mjs +1041 -81
- package/bin/failproofaid-shim.mjs +4 -4
- package/dist/cli.mjs +18513 -10474
- package/dist/worker.mjs +1223 -299
- package/lib/auth/api-server-client.ts +2 -3
- package/lib/auth/auth-store.ts +4 -5
- package/lib/codex-sessions.ts +2 -1
- package/lib/dashboard-host.ts +101 -0
- package/lib/install-check.ts +22 -7
- package/lib/pi-sessions.ts +99 -14
- package/lib/telemetry-enabled.ts +54 -0
- package/lib/telemetry-id.ts +52 -1
- package/lib/telemetry.ts +8 -4
- package/package.json +23 -12
- package/scripts/build-daemon-packages.mjs +247 -0
- package/scripts/daemon-platforms.mjs +42 -0
- package/scripts/dev-hook.mjs +46 -5
- package/scripts/install-telemetry.mjs +8 -1
- package/scripts/launch.ts +25 -3
- package/scripts/parse-script-args.ts +27 -1
- package/scripts/prune-standalone.mjs +26 -0
- package/scripts/publish-aliases.mjs +62 -41
- package/scripts/repro-npm-install.sh +155 -0
- package/scripts/translate-docs/cache.ts +1 -1
- package/scripts/translate-docs/cli.ts +2 -2
- package/scripts/translate-docs/mintlify-nav.ts +1 -1
- package/scripts/translate-docs/readme-translator.ts +163 -4
- package/scripts/validate-mdx.ts +153 -13
- package/src/audit/audit-lock.ts +285 -0
- package/src/audit/audit-schedule.ts +111 -0
- package/src/audit/cache.ts +18 -5
- package/src/audit/cli-adapters/goose.ts +2 -1
- package/src/audit/cli-adapters/hermes.ts +28 -10
- package/src/audit/cli.ts +191 -35
- package/src/audit/dashboard-cache.ts +2 -3
- package/src/audit/report.ts +0 -1
- package/src/hooks/backfill-cli.ts +247 -0
- package/src/hooks/builtin-policies.ts +391 -3
- package/src/hooks/cloud-connection.ts +354 -0
- package/src/hooks/cloud-enrollment-cli.ts +439 -0
- package/src/hooks/cloud-enrollment.ts +284 -0
- package/src/hooks/cloud-introspect.ts +147 -0
- package/src/hooks/cloud-managed-policies.ts +206 -0
- package/src/hooks/collector-config.ts +218 -0
- package/src/hooks/configure-wizard.ts +1211 -233
- package/src/hooks/custom-hooks-loader.ts +243 -37
- package/src/hooks/daemon-client.ts +136 -33
- package/src/hooks/daemon-download.ts +264 -31
- package/src/hooks/daemon-service.ts +1124 -76
- package/src/hooks/first-run-gate.ts +50 -0
- package/src/hooks/flush-cli.ts +180 -0
- package/src/hooks/fp-config.ts +835 -0
- package/src/hooks/fp-home.ts +714 -0
- package/src/hooks/fp-reset.ts +1363 -0
- package/src/hooks/handler.ts +185 -6
- package/src/hooks/harness-cli.ts +386 -0
- package/src/hooks/hook-activity-store.ts +171 -24
- package/src/hooks/hook-logger.ts +2 -2
- package/src/hooks/hook-telemetry.ts +5 -1
- package/src/hooks/hooks-config.ts +4 -3
- package/src/hooks/integrations.ts +0 -1
- package/src/hooks/loader-utils.ts +172 -9
- package/src/hooks/manager.ts +41 -5
- package/src/hooks/migrations.ts +450 -0
- package/src/hooks/onboarding-attempt.ts +195 -0
- package/src/hooks/onboarding-lock.ts +118 -0
- package/src/hooks/policy-types.ts +28 -0
- package/src/hooks/session-pause-cli.ts +159 -0
- package/src/hooks/session-pause.ts +267 -0
- package/src/hooks/setup-state.ts +256 -0
- package/src/hooks/tui.ts +209 -9
- package/src/hooks/uninstall-cli.ts +418 -0
- package/src/hooks/worker-server.ts +134 -15
- package/.next/standalone/.next/server/chunks/[externals]__14odj07._.js +0 -3
- package/.next/standalone/.next/server/chunks/[externals]__1s61mel._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0id_xf7._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0longh-._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__17g9wh7._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__19120tr._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1fwl2mz._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1myjm-d._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1rhmvod._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[externals]__1_g_b3t._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0114ewg._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__02r5bgf._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0e8sjqm._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0lkzqax._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0nb0syg._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0qucxyj._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0u02miy._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0uno39i._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__14dd6h8._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ath6v_._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1psjybo._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1zqz4v8._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/_1m_p7pi._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/node_modules_html-to-image_es_index_0oy_-36.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_1ezd2jf._.js +0 -5
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_1tnuifj._.js +0 -5
- package/.next/standalone/.next/static/chunks/0h7auy7hzjyhw.js +0 -1
- package/.next/standalone/.next/static/chunks/0zbxssxh53n-3.js +0 -1
- package/.next/standalone/.next/static/chunks/2mazwb1qmur1p.js +0 -1
- package/.next/standalone/.next/static/chunks/2pujpnfx4pws6.css +0 -2
- package/.next/standalone/.next/static/chunks/33u59vf_8xpd-.js +0 -1
- package/.next/standalone/.next/static/chunks/3i27c3hcriawq.css +0 -1
- package/.next/standalone/.next/static/chunks/3s7myk_co0gbh.js +0 -1
- package/.next/standalone/.next/static/chunks/40k1_v4os4cw6.js +0 -6
- package/.next/standalone/Cargo.lock +0 -428
- package/.next/standalone/Cargo.toml +0 -9
- package/.next/standalone/crates/PROTOCOL.md +0 -122
- package/.next/standalone/crates/failproofaid/Cargo.toml +0 -18
- package/.next/standalone/crates/failproofaid/src/lock.rs +0 -81
- package/.next/standalone/crates/failproofaid/src/main.rs +0 -83
- package/.next/standalone/crates/failproofaid/src/paths.rs +0 -172
- package/.next/standalone/crates/failproofaid/src/server.rs +0 -502
- package/.next/standalone/crates/failproofaid/src/worker.rs +0 -400
- package/.next/standalone/crates/failproofaid/tests/daemon_e2e.rs +0 -241
- package/.next/standalone/crates/fpai-ipc/Cargo.toml +0 -16
- package/.next/standalone/crates/fpai-ipc/src/envelope.rs +0 -175
- package/.next/standalone/crates/fpai-ipc/src/framing.rs +0 -177
- package/.next/standalone/crates/fpai-ipc/src/lib.rs +0 -10
- package/.next/standalone/crates/fpai-ipc/src/peer.rs +0 -80
- package/.next/standalone/docker-hook-sync/Dockerfile +0 -79
- package/.next/standalone/docker-hook-sync/entrypoint.sh +0 -109
- package/.next/standalone/integration-suite/Dockerfile +0 -47
- package/.next/standalone/integration-suite/README.md +0 -129
- package/.next/standalone/integration-suite/canary-policies.mjs +0 -45
- package/.next/standalone/integration-suite/capture-tokens.sh +0 -48
- package/.next/standalone/integration-suite/ci-entrypoint.sh +0 -179
- package/.next/standalone/integration-suite/inject-tokens.sh +0 -44
- package/.next/standalone/integration-suite/install-clis.sh +0 -136
- package/.next/standalone/integration-suite/probe-cli.sh +0 -248
- package/.next/standalone/integration-suite/report.js +0 -120
- package/.next/standalone/integration-suite/run.sh +0 -159
- package/.next/standalone/openclaw-plugin/index.js +0 -223
- package/.next/standalone/openclaw-plugin/openclaw.plugin.json +0 -6
- package/.next/standalone/openclaw-plugin/package.json +0 -12
- package/.next/standalone/osv-scanner.toml +0 -17
- package/.next/standalone/pi-extension/index.ts +0 -524
- package/.next/standalone/pi-extension/package.json +0 -12
- package/.next/standalone/postcss.config.mjs +0 -8
- package/.next/standalone/readme-arch-hq.gif +0 -0
- package/.next/standalone/rust-toolchain.toml +0 -4
- package/src/auth/cli.ts +0 -371
- /package/.next/standalone/.next/static/{NWAjs0tHFyzk97gRGG09r → VjEdIL6W5uBsvEzknXqV9}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{NWAjs0tHFyzk97gRGG09r → VjEdIL6W5uBsvEzknXqV9}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{NWAjs0tHFyzk97gRGG09r → VjEdIL6W5uBsvEzknXqV9}/_ssgManifest.js +0 -0
package/src/hooks/tui.ts
CHANGED
|
@@ -34,6 +34,8 @@ export interface SelectChoice<T> {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export interface SelectOneOptions<T> {
|
|
37
|
+
/** Offer ← to go back a step. The caller must handle `BACK`. */
|
|
38
|
+
allowBack?: boolean;
|
|
37
39
|
message: string;
|
|
38
40
|
choices: SelectChoice<T>[];
|
|
39
41
|
/** Static info lines rendered under the question (e.g. a review summary). */
|
|
@@ -64,6 +66,24 @@ export interface MultiChoice<T> {
|
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
export interface MultiSelectOptions<T> {
|
|
69
|
+
/** Offer ← to go back a step. The caller must handle `BACK`. */
|
|
70
|
+
allowBack?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Called with what was ticked at the moment ← was pressed.
|
|
73
|
+
*
|
|
74
|
+
* `BACK` is a symbol, so it cannot carry a value, and the selection lives in a
|
|
75
|
+
* local array here rather than on the caller's choice objects — so a caller had
|
|
76
|
+
* no way to learn what a user had toggled before stepping back. The wizard's
|
|
77
|
+
* harness step needs exactly that: without it, deselecting a CLI and pressing ←
|
|
78
|
+
* discards the deselection, the step is redrawn from the detected defaults, and
|
|
79
|
+
* confirming re-enables hook installation for a CLI the user explicitly turned
|
|
80
|
+
* off.
|
|
81
|
+
*
|
|
82
|
+
* OPTIONAL and additive rather than a change to the return type: `BACK` is
|
|
83
|
+
* shared with `selectOne` and every other caller, and widening that contract to
|
|
84
|
+
* fix one step's state would be a much larger surface than the bug.
|
|
85
|
+
*/
|
|
86
|
+
onBack?: (checkedNow: T[]) => void;
|
|
67
87
|
message: string;
|
|
68
88
|
choices: MultiChoice<T>[];
|
|
69
89
|
minSelected?: number;
|
|
@@ -112,10 +132,10 @@ export function colorsEnabled(out: TTYOut): boolean {
|
|
|
112
132
|
|
|
113
133
|
/**
|
|
114
134
|
* The raw ANSI opening sequence for a brand role, for callers that assemble
|
|
115
|
-
* their own strings instead of using `paint()`'s wrappers (`src/audit/cli.ts
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
135
|
+
* their own strings instead of using `paint()`'s wrappers (`src/audit/cli.ts`).
|
|
136
|
+
* That file previously hardcoded its own 256-colour palette — a green and a
|
|
137
|
+
* blue that appear nowhere in the brand — so `audit` looked like a different
|
|
138
|
+
* product from `config`. Routing it here
|
|
119
139
|
* keeps HUES the single source of truth: change a hue once and every surface
|
|
120
140
|
* follows. Emits truecolor where the terminal advertises it, basic ANSI
|
|
121
141
|
* otherwise; the caller still decides *whether* to colour at all.
|
|
@@ -423,6 +443,10 @@ interface PromptSpec<R> {
|
|
|
423
443
|
renderRow: (index: number, active: boolean, budget: number) => string;
|
|
424
444
|
/** Extra line(s) above the footer (e.g. a min-selected warning). */
|
|
425
445
|
warnLine?: () => string | null;
|
|
446
|
+
/** When set, ← resolves `BACK` so the caller can step backwards. */
|
|
447
|
+
allowBack?: boolean;
|
|
448
|
+
/** Called just before ← resolves, so a caller can keep in-progress state. */
|
|
449
|
+
onBack?: () => void;
|
|
426
450
|
footer: string;
|
|
427
451
|
/** Handle non-navigation keys. `{done}` finishes, `"redraw"` repaints. */
|
|
428
452
|
onKey: (key: readline.Key, cursor: number) => { done: R } | "redraw" | undefined;
|
|
@@ -469,10 +493,21 @@ function runPrompt<R>(p: PromptSpec<R>): Promise<R | null> {
|
|
|
469
493
|
};
|
|
470
494
|
|
|
471
495
|
const collapse = (result: R | null): void => {
|
|
496
|
+
// BACK is handled HERE, not in each `summaryFor`, because it is not a value
|
|
497
|
+
// of `R` at all — it is a sentinel the shared key handler injects, so every
|
|
498
|
+
// prompt would otherwise have to know about a symbol it never declared.
|
|
499
|
+
//
|
|
500
|
+
// Both existing callers got it wrong in different ways, and one of them
|
|
501
|
+
// hung: `multiSelect`'s summary calls `values.includes(...)`, which throws
|
|
502
|
+
// `TypeError` on a symbol — and it throws INSIDE `finish`, before
|
|
503
|
+
// `resolve(result)`, so pressing ← never settled the promise and the wizard
|
|
504
|
+
// stopped responding entirely. `selectOne` fell through to `String(value)`
|
|
505
|
+
// and rendered the literal text `Symbol(failproofai.back)`.
|
|
506
|
+
const summary = (result as unknown) === BACK ? "back" : p.summaryFor(result);
|
|
472
507
|
repaint(stdout, region, [
|
|
473
508
|
c.dim(BAR),
|
|
474
509
|
`${c.dim(STEP_DONE)} ${p.message}`,
|
|
475
|
-
`${c.dim(BAR)} ${c.dim(
|
|
510
|
+
`${c.dim(BAR)} ${c.dim(summary)}`,
|
|
476
511
|
]);
|
|
477
512
|
};
|
|
478
513
|
|
|
@@ -500,6 +535,15 @@ function runPrompt<R>(p: PromptSpec<R>): Promise<R | null> {
|
|
|
500
535
|
if (!key) return;
|
|
501
536
|
if ((key.ctrl && (key.name === "c" || key.name === "d")) || key.name === "escape") {
|
|
502
537
|
finish(null);
|
|
538
|
+
} else if (key.name === "left" && p.allowBack) {
|
|
539
|
+
// Only when the caller opted in. A prompt with nowhere to go back TO
|
|
540
|
+
// must not appear to offer it.
|
|
541
|
+
//
|
|
542
|
+
// Reported BEFORE finishing, because `finish` collapses the prompt and
|
|
543
|
+
// resolves — after that the selection is gone and the caller is already
|
|
544
|
+
// running.
|
|
545
|
+
p.onBack?.();
|
|
546
|
+
finish(BACK as unknown as never);
|
|
503
547
|
} else if (key.name === "up") {
|
|
504
548
|
cursor = cursor > 0 ? cursor - 1 : choices.length - 1;
|
|
505
549
|
repaint(stdout, region, build());
|
|
@@ -519,7 +563,24 @@ function runPrompt<R>(p: PromptSpec<R>): Promise<R | null> {
|
|
|
519
563
|
|
|
520
564
|
// ── selectOne (radio) ─────────────────────────────────────────────────────────
|
|
521
565
|
|
|
522
|
-
|
|
566
|
+
/**
|
|
567
|
+
* Returned by a prompt when the user asked to go BACK a step, as distinct from
|
|
568
|
+
* cancelling. Both used to be `null`, which made "I picked the wrong scope" and
|
|
569
|
+
* "I want out" the same keystroke — so the only way to change an earlier answer
|
|
570
|
+
* was to abandon setup and start over.
|
|
571
|
+
*
|
|
572
|
+
* A symbol rather than a sentinel string because a caller's value type is its
|
|
573
|
+
* own: `selectOne<string>` could legitimately have "back" as a real choice.
|
|
574
|
+
*/
|
|
575
|
+
export const BACK: unique symbol = Symbol("failproofai.back");
|
|
576
|
+
export type Back = typeof BACK;
|
|
577
|
+
|
|
578
|
+
// Overloaded so `BACK` appears in the return type ONLY where it was asked for.
|
|
579
|
+
// Widening every caller to `T | Back | null` would make dozens of call sites
|
|
580
|
+
// handle a value they can never receive.
|
|
581
|
+
export function selectOne<T>(opts: SelectOneOptions<T> & { allowBack: true }): Promise<T | Back | null>;
|
|
582
|
+
export function selectOne<T>(opts: SelectOneOptions<T>): Promise<T | null>;
|
|
583
|
+
export function selectOne<T>(opts: SelectOneOptions<T>): Promise<T | Back | null> {
|
|
523
584
|
const stdin: TTYIn = opts.stdin ?? process.stdin;
|
|
524
585
|
const stdout: TTYOut = opts.stdout ?? process.stdout;
|
|
525
586
|
const choices = opts.choices;
|
|
@@ -550,7 +611,10 @@ export function selectOne<T>(opts: SelectOneOptions<T>): Promise<T | null> {
|
|
|
550
611
|
const hint = choice.hint ? ` ${c.dim(ellipsize(choice.hint, budget))}` : "";
|
|
551
612
|
return `${dot} ${label}${hint}`;
|
|
552
613
|
},
|
|
553
|
-
|
|
614
|
+
allowBack: opts.allowBack,
|
|
615
|
+
footer: opts.allowBack
|
|
616
|
+
? "↑/↓ navigate · enter to select · ← back · esc to cancel"
|
|
617
|
+
: "↑/↓ navigate · enter to select · esc to cancel",
|
|
554
618
|
onKey: (key, cursor) =>
|
|
555
619
|
key.name === "return" ? { done: choices[cursor].value } : undefined,
|
|
556
620
|
summaryFor: (value) =>
|
|
@@ -562,7 +626,9 @@ export function selectOne<T>(opts: SelectOneOptions<T>): Promise<T | null> {
|
|
|
562
626
|
|
|
563
627
|
// ── multiSelect (checklist) ────────────────────────────────────────────────────
|
|
564
628
|
|
|
565
|
-
export function multiSelect<T>(opts: MultiSelectOptions<T>): Promise<T[] | null
|
|
629
|
+
export function multiSelect<T>(opts: MultiSelectOptions<T> & { allowBack: true }): Promise<T[] | null | Back>;
|
|
630
|
+
export function multiSelect<T>(opts: MultiSelectOptions<T>): Promise<T[] | null>;
|
|
631
|
+
export function multiSelect<T>(opts: MultiSelectOptions<T>): Promise<T[] | null | Back> {
|
|
566
632
|
const stdin: TTYIn = opts.stdin ?? process.stdin;
|
|
567
633
|
const stdout: TTYOut = opts.stdout ?? process.stdout;
|
|
568
634
|
const choices = opts.choices;
|
|
@@ -604,7 +670,17 @@ export function multiSelect<T>(opts: MultiSelectOptions<T>): Promise<T[] | null>
|
|
|
604
670
|
return `${caret} ${box} ${label}${hint}`;
|
|
605
671
|
},
|
|
606
672
|
warnLine: () => (warn ? c.warn(`Select at least ${minSelected}.`) : null),
|
|
607
|
-
|
|
673
|
+
allowBack: opts.allowBack,
|
|
674
|
+
// Reads the SAME `checked` array the prompt is driving, so what the caller
|
|
675
|
+
// learns is exactly what was on screen when ← was pressed.
|
|
676
|
+
onBack: opts.onBack
|
|
677
|
+
? () => opts.onBack?.(choices.filter((_, i) => checked[i]).map((ch) => ch.value))
|
|
678
|
+
: undefined,
|
|
679
|
+
footer:
|
|
680
|
+
opts.hint ??
|
|
681
|
+
(opts.allowBack
|
|
682
|
+
? "↑/↓ move · space select · ctrl+a all · ← back · enter confirm"
|
|
683
|
+
: "↑/↓ move · space select · ctrl+a all · enter confirm"),
|
|
608
684
|
onKey: (key, cursor) => {
|
|
609
685
|
if (key.name === "space") {
|
|
610
686
|
if (choices[cursor]?.locked) return "redraw"; // always on — not a choice
|
|
@@ -643,3 +719,127 @@ export function multiSelect<T>(opts: MultiSelectOptions<T>): Promise<T[] | null>
|
|
|
643
719
|
),
|
|
644
720
|
});
|
|
645
721
|
}
|
|
722
|
+
|
|
723
|
+
// ── promptText (single line, optionally masked) ───────────────────────────────
|
|
724
|
+
|
|
725
|
+
export interface PromptTextOptions {
|
|
726
|
+
message: string;
|
|
727
|
+
/** Shown dimmed under the prompt. */
|
|
728
|
+
hint?: string;
|
|
729
|
+
/** Used when the user submits an empty line. */
|
|
730
|
+
defaultValue?: string;
|
|
731
|
+
/**
|
|
732
|
+
* Render `•` instead of the typed characters. For credentials: the wizard is
|
|
733
|
+
* routinely run while screen-sharing, and a pasted key would otherwise sit in
|
|
734
|
+
* the scrollback of every recording of that session.
|
|
735
|
+
*/
|
|
736
|
+
mask?: boolean;
|
|
737
|
+
/** Return an error string to reject and re-ask, or null to accept. */
|
|
738
|
+
validate?: (value: string) => string | null;
|
|
739
|
+
stdin?: TTYIn;
|
|
740
|
+
stdout?: TTYOut;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* Read one line. Resolves `null` on Ctrl-C / Escape, which every caller in the
|
|
745
|
+
* wizard treats as "cancel the whole run" — consistent with selectOne.
|
|
746
|
+
*
|
|
747
|
+
* Falls back to a plain non-TTY read so `failproofai config` still works when
|
|
748
|
+
* driven from a pipe or a test, the same way the other prompts do.
|
|
749
|
+
*/
|
|
750
|
+
export function promptText(opts: PromptTextOptions): Promise<string | null> {
|
|
751
|
+
const stdin: TTYIn = opts.stdin ?? process.stdin;
|
|
752
|
+
const stdout: TTYOut = opts.stdout ?? process.stdout;
|
|
753
|
+
const c = paint(colorsEnabled(stdout));
|
|
754
|
+
|
|
755
|
+
const accept = (raw: string): { ok: true; value: string } | { ok: false; error: string } => {
|
|
756
|
+
const value = raw.trim() || opts.defaultValue || "";
|
|
757
|
+
const error = opts.validate?.(value) ?? null;
|
|
758
|
+
return error ? { ok: false, error } : { ok: true, value };
|
|
759
|
+
};
|
|
760
|
+
|
|
761
|
+
if (!stdin.isTTY) {
|
|
762
|
+
// Non-TTY: read whatever is piped, validate once, no re-ask loop (there is
|
|
763
|
+
// no one to re-ask).
|
|
764
|
+
return new Promise((resolve) => {
|
|
765
|
+
let buf = "";
|
|
766
|
+
const onData = (chunk: Buffer | string) => {
|
|
767
|
+
buf += String(chunk);
|
|
768
|
+
if (buf.includes("\n")) done();
|
|
769
|
+
};
|
|
770
|
+
const done = () => {
|
|
771
|
+
stdin.removeListener("data", onData);
|
|
772
|
+
stdin.removeListener("end", done);
|
|
773
|
+
const r = accept(buf.split("\n")[0] ?? "");
|
|
774
|
+
resolve(r.ok ? r.value : null);
|
|
775
|
+
};
|
|
776
|
+
stdin.on("data", onData);
|
|
777
|
+
stdin.on("end", done);
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
return new Promise((resolve) => {
|
|
782
|
+
let value = "";
|
|
783
|
+
const draw = (error?: string) => {
|
|
784
|
+
const cols = stdout.columns || 80;
|
|
785
|
+
const shown = opts.mask ? "•".repeat(value.length) : value;
|
|
786
|
+
const hint = opts.hint ? ` ${c.dim(opts.hint)}` : "";
|
|
787
|
+
// Truncate to ONE physical row. `\r\x1b[2K` erases the row the cursor is
|
|
788
|
+
// on and nothing above it — so a line wider than the terminal wraps, the
|
|
789
|
+
// erase reaches only its last row, and every keystroke leaves the earlier
|
|
790
|
+
// rows behind. That is why pasting a 40-character API key printed 40
|
|
791
|
+
// stacked copies of the prompt: `API key for <host>` plus the masked
|
|
792
|
+
// value plus the `needs events:add · policies:pull …` hint is past 80
|
|
793
|
+
// columns before the key is even half typed.
|
|
794
|
+
const line = truncate(`${c.bold(opts.message)} ${shown}${hint}`, cols - 1);
|
|
795
|
+
const err = error ? `\n ${truncate(c.warn(error), cols - 3)}` : "";
|
|
796
|
+
stdout.write(`\r\x1b[2K${line}${err}`);
|
|
797
|
+
if (err) stdout.write("\x1b[1A");
|
|
798
|
+
};
|
|
799
|
+
draw();
|
|
800
|
+
|
|
801
|
+
readline.emitKeypressEvents(stdin);
|
|
802
|
+
const wasRaw = stdin.isRaw;
|
|
803
|
+
stdin.setRawMode?.(true);
|
|
804
|
+
stdin.resume();
|
|
805
|
+
|
|
806
|
+
const cleanup = () => {
|
|
807
|
+
stdin.removeListener("keypress", onKey);
|
|
808
|
+
stdin.setRawMode?.(wasRaw ?? false);
|
|
809
|
+
stdin.pause();
|
|
810
|
+
stdout.write("\n");
|
|
811
|
+
};
|
|
812
|
+
|
|
813
|
+
function onKey(str: string | undefined, key: readline.Key): void {
|
|
814
|
+
if (!key) return;
|
|
815
|
+
if ((key.ctrl && (key.name === "c" || key.name === "d")) || key.name === "escape") {
|
|
816
|
+
cleanup();
|
|
817
|
+
resolve(null);
|
|
818
|
+
return;
|
|
819
|
+
}
|
|
820
|
+
if (key.name === "return" || key.name === "enter") {
|
|
821
|
+
const r = accept(value);
|
|
822
|
+
if (r.ok) {
|
|
823
|
+
cleanup();
|
|
824
|
+
resolve(r.value);
|
|
825
|
+
} else {
|
|
826
|
+
draw(r.error);
|
|
827
|
+
}
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
if (key.name === "backspace") {
|
|
831
|
+
value = value.slice(0, -1);
|
|
832
|
+
draw();
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
// Ignore control keys; accept any printable character, including a
|
|
836
|
+
// bracketed paste arriving as one chunk.
|
|
837
|
+
if (str && !key.ctrl && !key.meta) {
|
|
838
|
+
value += str;
|
|
839
|
+
draw();
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
stdin.on("keypress", onKey);
|
|
844
|
+
});
|
|
845
|
+
}
|