failproofai 0.0.8 → 0.0.9-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.codex/hooks.json +77 -0
- 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 +1 -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 +1 -1
- 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 +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 +1 -1
- 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/node_modules_posthog-node_dist_entrypoints_index_node_mjs_05pz9._._.js +1 -1
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_0z7w.hh._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0m72uj7._.js → [root-of-the-server]__03rd.z8._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__092s1ta._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__09icjsf._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0h3orxc._.js → [root-of-the-server]__0ca1zru._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0e74wa-._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ea22pr._.js +3 -0
- 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 → [root-of-the-server]__0vu.o-3._.js} +3 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0w6l33k._.js +7 -7
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0of~riu._.js → [root-of-the-server]__0zqcovi._.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/_07a1g.3._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0uy6m~m._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0zaq1hm._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_10lm7or._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_11rg2a_._.js +3 -0
- 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 +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_0h9llsw._.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/0.rk1iwdt1d7c.css +1 -0
- package/.next/standalone/.next/static/chunks/00b5h4r1el.6f.js +1 -0
- package/.next/standalone/.next/static/chunks/{151bdxm9n-pry.js → 03lsndql_yml5.js} +1 -1
- package/.next/standalone/.next/static/chunks/0amfi~vb_gfgo.js +1 -0
- package/.next/standalone/.next/static/chunks/0fw2h.g66c0h3.js +1 -0
- package/.next/standalone/.next/static/chunks/{0mbc8hyeqe2c4.js → 0jce49ygr4fdv.js} +1 -1
- package/.next/standalone/.next/static/chunks/0mungg3~jpwe7.js +1 -0
- package/.next/standalone/.next/static/chunks/{175-vim0.ztb2.js → 0uq_5p-p7myfe.js} +2 -2
- package/.next/standalone/.next/static/chunks/0v.xuf4ynzp~~.js +6 -0
- package/.next/standalone/.next/static/chunks/{0eowehbf5egcz.js → 0vb8xxj_v2tz8.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0vlk_pv4somht.js → 0vwqucikost_q.js} +1 -1
- package/.next/standalone/.next/static/chunks/0~mroziiwl1m5.js +1 -0
- package/.next/standalone/app/actions/install-hooks-web.ts +21 -5
- package/.next/standalone/app/policies/hooks-client.tsx +23 -0
- package/.next/standalone/assets/logos/claude.svg +1 -0
- package/.next/standalone/assets/logos/openai-dark.svg +1 -0
- package/.next/standalone/assets/logos/openai-light.svg +1 -0
- package/.next/standalone/package.json +2 -2
- package/.next/standalone/server.js +1 -1
- package/README.md +22 -3
- package/bin/failproofai.mjs +89 -9
- package/dist/cli.mjs +1039 -281
- package/package.json +2 -2
- package/src/hooks/builtin-policies.ts +29 -6
- package/src/hooks/handler.ts +39 -10
- package/src/hooks/hook-activity-store.ts +2 -0
- package/src/hooks/install-prompt.ts +69 -0
- package/src/hooks/integrations.ts +373 -0
- package/src/hooks/manager.ts +96 -171
- package/src/hooks/policy-evaluator.ts +28 -1
- package/src/hooks/policy-types.ts +3 -1
- package/src/hooks/resolve-permission-mode.ts +147 -0
- package/src/hooks/types.ts +30 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0_rr1ty._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0dj-tbi._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_0h21oar._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_0i~.gk_._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_0q3h.2s._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_0x..fj-._.js +0 -3
- package/.next/standalone/.next/static/chunks/096~b1zwv69ph.js +0 -1
- package/.next/standalone/.next/static/chunks/0bkir2pd22ski.js +0 -1
- package/.next/standalone/.next/static/chunks/0ksdlt_1hucdm.js +0 -1
- package/.next/standalone/.next/static/chunks/0lua3p__elu_..js +0 -6
- package/.next/standalone/.next/static/chunks/0mir9jdxn35~s.css +0 -1
- package/.next/standalone/.next/static/chunks/0s_18.dox44e9.js +0 -1
- package/.next/standalone/.next/static/chunks/0t3euwspxi_zg.js +0 -1
- /package/.next/standalone/.next/static/{RYld7TSCDXm2_WhJq20rD → oUO8u4z9JvtTzS_2RJoGo}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{RYld7TSCDXm2_WhJq20rD → oUO8u4z9JvtTzS_2RJoGo}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{RYld7TSCDXm2_WhJq20rD → oUO8u4z9JvtTzS_2RJoGo}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,20087,30005,55436,85898,e=>{"use strict";e.s(["FILTER_PRESETS",0,[{value:"all",label:"All"},{value:"last-hour",label:"Last Hour"},{value:"today",label:"Today"},{value:"last-7-days",label:"Last 7 Days"},{value:"last-30-days",label:"Last 30 Days"}],"ITEMS_PER_PAGE",0,25,"filterByDate",0,function(e,t,r){if("all"===t)return e;if("custom"===t){let t,a,n=r.from?((t=new Date(r.from)).setHours(0,0,0,0),t):null,l=r.to?((a=new Date(r.to)).setHours(23,59,59,999),a):null;return e.filter(e=>(!n||!(e.lastModified<n))&&(!l||!(e.lastModified>l)))}let a=function(e){let t=new Date;switch(e){case"last-hour":return new Date(t.getTime()-36e5);case"today":return new Date(t.getFullYear(),t.getMonth(),t.getDate());case"last-7-days":return new Date(t.getTime()-6048e5);case"last-30-days":return new Date(t.getTime()-2592e6);default:return null}}(t);return a?e.filter(e=>e.lastModified>=a):e},"rehydrateDates",0,function(e){return e.map(e=>({...e,lastModified:e.lastModified instanceof Date?e.lastModified:new Date(e.lastModified)}))}],20087);var t=e.i(71645);e.s(["useFilterState",0,function(e=[],r){let[a,n]=(0,t.useState)(r?.filterPreset??"all"),[l,s]=(0,t.useState)(r?.dateRange??{from:null,to:null}),[o,i]=(0,t.useState)(r?.currentPage??1),d=`${a}|${JSON.stringify(l)}|${JSON.stringify(e)}`,[c,u]=(0,t.useState)(d);d!==c&&(u(d),i(1));let m=(0,t.useCallback)(e=>{n(e),"custom"!==e&&s({from:null,to:null})},[]);return{filterPreset:a,dateRange:l,currentPage:o,setCurrentPage:i,handlePresetChange:m,handleDateRangeChange:(0,t.useCallback)((e,t)=>{n("custom"),s(r=>({...r,[e]:t?new Date(t):null}))},[]),clearFilters:(0,t.useCallback)(()=>{n("all"),s({from:null,to:null})},[])}}],30005);var r=e.i(75254);let a=(0,r.default)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);e.s(["Search",0,a],55436);var n=e.i(43476);let l=(0,r.default)("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);e.s(["default",0,function({id:e,value:t,stringValue:r,onChange:a,"aria-label":s}){let o=null!=r?r:t?t.toISOString().split("T")[0]:"";return(0,n.jsxs)("div",{className:"relative group",children:[(0,n.jsx)("input",{type:"date",id:e,value:o,onChange:e=>a(e.target.value),"aria-label":s,className:"date-input px-3 py-2 pr-8 text-sm bg-input border border-border rounded-md text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent transition-all hover:border-primary/50 w-[200px]"}),(0,n.jsx)("label",{htmlFor:e,className:"absolute right-2.5 top-1/2 -translate-y-1/2 cursor-pointer pointer-events-auto z-10 p-1 rounded hover:bg-muted/50 transition-colors",onClick:t=>{t.preventDefault();let r=document.getElementById(e);r&&"function"==typeof r.showPicker?r.showPicker():r?.click()},children:(0,n.jsx)(l,{className:"w-4 h-4 text-primary group-hover:text-primary/80 transition-colors"})})]})}],85898)},73375,e=>{"use strict";let t=(0,e.i(75254).default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);e.s(["ChevronLeft",0,t],73375)},63059,e=>{"use strict";let t=(0,e.i(75254).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",0,t],63059)},73520,e=>{"use strict";var t=e.i(43476),r=e.i(73375),a=e.i(63059);e.s(["default",0,function({currentPage:e,totalPages:n,onPageChange:l}){if(n<=1)return null;let s=e=>`px-3 py-2 text-sm rounded-md transition-colors flex items-center gap-1 bg-muted text-muted-foreground ${e?"opacity-50 cursor-not-allowed":"hover:bg-muted/80"}`;return(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 py-4",children:[(0,t.jsxs)("button",{onClick:()=>l(e-1),disabled:1===e,className:s(1===e),"aria-label":"Previous page",children:[(0,t.jsx)(r.ChevronLeft,{className:"w-4 h-4"}),(0,t.jsx)("span",{className:"hidden sm:inline",children:"Previous"})]}),(0,t.jsx)("div",{className:"flex items-center gap-1",children:(()=>{if(n<=7)return Array.from({length:n},(e,t)=>t+1);let t=[1],r=Math.max(2,e-1),a=Math.min(n-1,e+1);e<=3&&(a=Math.min(5,n-1)),e>=n-2&&(r=Math.max(2,n-4)),r>2&&t.push("ellipsis-start");for(let e=r;e<=a;e++)t.push(e);return a<n-1&&t.push("ellipsis-end"),t.push(n),t})().map(r=>"string"==typeof r?(0,t.jsx)("span",{className:"px-2 text-muted-foreground",children:"..."},r):(0,t.jsx)("button",{onClick:()=>l(r),className:`min-w-[2.5rem] px-3 py-2 text-sm rounded-md transition-colors ${e===r?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted/80"}`,"aria-label":`Page ${r}`,"aria-current":e===r?"page":void 0,children:r},r))}),(0,t.jsxs)("button",{onClick:()=>l(e+1),disabled:e===n,className:s(e===n),"aria-label":"Next page",children:[(0,t.jsx)("span",{className:"hidden sm:inline",children:"Next"}),(0,t.jsx)(a.ChevronRight,{className:"w-4 h-4"})]})]})}])},80060,2711,e=>{"use strict";var t=e.i(18566),r=e.i(71645);function a(e){let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${a}`}function n(e){var t;if(!e||(t=e,!/^\d{4}-\d{2}-\d{2}$/.test(t)||isNaN(Date.parse(t))))return null;let[r,a,n]=e.split("-").map(Number);return new Date(r,a-1,n,12,0,0)}e.s(["useUrlParams",0,function(){let e=(0,t.useSearchParams)(),a=(0,t.useRouter)(),n=(0,t.usePathname)(),l=(0,r.useRef)(null),s=(0,r.useCallback)(t=>e.get(t),[e]),o=(0,r.useCallback)(()=>new URLSearchParams(e.toString()),[e]),i=(0,r.useCallback)(t=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{let r=new URLSearchParams(e.toString());for(let[e,a]of Object.entries(t))void 0===a||""===a?r.delete(e):r.set(e,a);let l=r.toString(),s=l?`${n}?${l}`:n;a.replace(s,{scroll:!1})},150)},[e,n,a]);return(0,r.useEffect)(()=>()=>{l.current&&clearTimeout(l.current)},[]),{get:s,getAll:o,setAll:i}}],80060),e.s(["dateRangeToParams",0,function(e){let t={};return e.from&&(t.from=a(e.from)),e.to&&(t.to=a(e.to)),t},"keywordsToParam",0,function(e){if(0!==e.length)return e.map(e=>encodeURIComponent(e)).join(",")},"pageToParam",0,function(e){return e<=1?void 0:String(e)},"paramToKeywords",0,function(e){return e?e.split(",").map(e=>decodeURIComponent(e.trim())).filter(e=>e.length>0):[]},"paramToPage",0,function(e){if(!e)return 1;let t=parseInt(e,10);return Number.isFinite(t)&&t>=1?t:1},"paramToPreset",0,function(e){return e&&["all","last-hour","today","last-7-days","last-30-days","custom"].includes(e)?e:"all"},"paramsToDateRange",0,function(e,t){return{from:n(e),to:n(t)}},"presetToParam",0,function(e){return"all"===e?void 0:e}],2711)},37727,e=>{"use strict";let t=(0,e.i(75254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["X",0,t],37727)},45425,(e,t,r)=>{var a;"u">typeof __nccwpck_require__&&(__nccwpck_require__.ab="/ROOT/node_modules/next/dist/compiled/os-browserify/"),(a={}).endianness=function(){return"LE"},a.hostname=function(){return"u">typeof location?location.hostname:""},a.loadavg=function(){return[]},a.uptime=function(){return 0},a.freemem=function(){return Number.MAX_VALUE},a.totalmem=function(){return Number.MAX_VALUE},a.cpus=function(){return[]},a.type=function(){return"Browser"},a.release=function(){return"u">typeof navigator?navigator.appVersion:""},a.networkInterfaces=a.getNetworkInterfaces=function(){return{}},a.arch=function(){return"javascript"},a.platform=function(){return"browser"},a.tmpdir=a.tmpDir=function(){return"/tmp"},a.EOL="\n",a.homedir=function(){return"/"},t.exports=a},41790,(e,t,r)=>{!function(){"use strict";var e={114:function(e){function t(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function r(e,t){for(var r,a="",n=0,l=-1,s=0,o=0;o<=e.length;++o){if(o<e.length)r=e.charCodeAt(o);else if(47===r)break;else r=47;if(47===r){if(l===o-1||1===s);else if(l!==o-1&&2===s){if(a.length<2||2!==n||46!==a.charCodeAt(a.length-1)||46!==a.charCodeAt(a.length-2)){if(a.length>2){var i=a.lastIndexOf("/");if(i!==a.length-1){-1===i?(a="",n=0):n=(a=a.slice(0,i)).length-1-a.lastIndexOf("/"),l=o,s=0;continue}}else if(2===a.length||1===a.length){a="",n=0,l=o,s=0;continue}}t&&(a.length>0?a+="/..":a="..",n=2)}else a.length>0?a+="/"+e.slice(l+1,o):a=e.slice(l+1,o),n=o-l-1;l=o,s=0}else 46===r&&-1!==s?++s:s=-1}return a}var a={resolve:function(){for(var e,a,n="",l=!1,s=arguments.length-1;s>=-1&&!l;s--)s>=0?a=arguments[s]:(void 0===e&&(e=""),a=e),t(a),0!==a.length&&(n=a+"/"+n,l=47===a.charCodeAt(0));if(n=r(n,!l),l)if(n.length>0)return"/"+n;else return"/";return n.length>0?n:"."},normalize:function(e){if(t(e),0===e.length)return".";var a=47===e.charCodeAt(0),n=47===e.charCodeAt(e.length-1);return(0!==(e=r(e,!a)).length||a||(e="."),e.length>0&&n&&(e+="/"),a)?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0==arguments.length)return".";for(var e,r=0;r<arguments.length;++r){var n=arguments[r];t(n),n.length>0&&(void 0===e?e=n:e+="/"+n)}return void 0===e?".":a.normalize(e)},relative:function(e,r){if(t(e),t(r),e===r||(e=a.resolve(e))===(r=a.resolve(r)))return"";for(var n=1;n<e.length&&47===e.charCodeAt(n);++n);for(var l=e.length,s=l-n,o=1;o<r.length&&47===r.charCodeAt(o);++o);for(var i=r.length-o,d=s<i?s:i,c=-1,u=0;u<=d;++u){if(u===d){if(i>d){if(47===r.charCodeAt(o+u))return r.slice(o+u+1);else if(0===u)return r.slice(o+u)}else s>d&&(47===e.charCodeAt(n+u)?c=u:0===u&&(c=0));break}var m=e.charCodeAt(n+u);if(m!==r.charCodeAt(o+u))break;47===m&&(c=u)}var f="";for(u=n+c+1;u<=l;++u)(u===l||47===e.charCodeAt(u))&&(0===f.length?f+="..":f+="/..");return f.length>0?f+r.slice(o+c):(o+=c,47===r.charCodeAt(o)&&++o,r.slice(o))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),a=47===r,n=-1,l=!0,s=e.length-1;s>=1;--s)if(47===(r=e.charCodeAt(s))){if(!l){n=s;break}}else l=!1;return -1===n?a?"/":".":a&&1===n?"//":e.slice(0,n)},basename:function(e,r){if(void 0!==r&&"string"!=typeof r)throw TypeError('"ext" argument must be a string');t(e);var a,n=0,l=-1,s=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var o=r.length-1,i=-1;for(a=e.length-1;a>=0;--a){var d=e.charCodeAt(a);if(47===d){if(!s){n=a+1;break}}else -1===i&&(s=!1,i=a+1),o>=0&&(d===r.charCodeAt(o)?-1==--o&&(l=a):(o=-1,l=i))}return n===l?l=i:-1===l&&(l=e.length),e.slice(n,l)}for(a=e.length-1;a>=0;--a)if(47===e.charCodeAt(a)){if(!s){n=a+1;break}}else -1===l&&(s=!1,l=a+1);return -1===l?"":e.slice(n,l)},extname:function(e){t(e);for(var r=-1,a=0,n=-1,l=!0,s=0,o=e.length-1;o>=0;--o){var i=e.charCodeAt(o);if(47===i){if(!l){a=o+1;break}continue}-1===n&&(l=!1,n=o+1),46===i?-1===r?r=o:1!==s&&(s=1):-1!==r&&(s=-1)}return -1===r||-1===n||0===s||1===s&&r===n-1&&r===a+1?"":e.slice(r,n)},format:function(e){var t,r;if(null===e||"object"!=typeof e)throw TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return t=e.dir||e.root,r=e.base||(e.name||"")+(e.ext||""),t?t===e.root?t+r:t+"/"+r:r},parse:function(e){t(e);var r,a={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return a;var n=e.charCodeAt(0),l=47===n;l?(a.root="/",r=1):r=0;for(var s=-1,o=0,i=-1,d=!0,c=e.length-1,u=0;c>=r;--c){if(47===(n=e.charCodeAt(c))){if(!d){o=c+1;break}continue}-1===i&&(d=!1,i=c+1),46===n?-1===s?s=c:1!==u&&(u=1):-1!==s&&(u=-1)}return -1===s||-1===i||0===u||1===u&&s===i-1&&s===o+1?-1!==i&&(0===o&&l?a.base=a.name=e.slice(1,i):a.base=a.name=e.slice(o,i)):(0===o&&l?(a.name=e.slice(1,s),a.base=e.slice(1,i)):(a.name=e.slice(o,s),a.base=e.slice(o,i)),a.ext=e.slice(s,i)),o>0?a.dir=e.slice(0,o-1):l&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};a.posix=a,e.exports=a}},r={};function a(t){var n=r[t];if(void 0!==n)return n.exports;var l=r[t]={exports:{}},s=!0;try{e[t](l,l.exports,a),s=!1}finally{s&&delete r[t]}return l.exports}a.ab="/ROOT/node_modules/next/dist/compiled/path-browserify/",t.exports=a(114)}()},62481,e=>{"use strict";var t=e.i(43476),r=e.i(71645);e.i(47167),e.i(45425),e.i(41790);var a=e.i(47163),n=e.i(20087),l=e.i(30005),s=e.i(80060),o=e.i(2711);let i=(0,e.i(75254).default)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);var d=e.i(55436),c=e.i(37727),u=e.i(22016),m=e.i(73520),f=e.i(85898);function h({date:e,formatted:r}){return(0,t.jsx)("span",{children:r||(0,a.formatDate)(e)})}e.s(["default",0,function({folders:e}){let a=(0,s.useUrlParams)(),g=(0,r.useRef)(!1),[p,x]=(0,r.useState)(()=>(0,o.paramToKeywords)(a.get("q"))),[b,v]=(0,r.useState)(""),{filterPreset:y,dateRange:j,currentPage:N,setCurrentPage:w,handlePresetChange:C,handleDateRangeChange:k,clearFilters:P}=(0,l.useFilterState)(p,{filterPreset:(0,o.paramToPreset)(a.get("preset")),dateRange:(0,o.paramsToDateRange)(a.get("from"),a.get("to")),currentPage:(0,o.paramToPage)(a.get("page"))});(0,r.useEffect)(()=>{if(!g.current){g.current=!0;return}a.setAll({preset:(0,o.presetToParam)(y),...(0,o.dateRangeToParams)(j),q:(0,o.keywordsToParam)(p),page:(0,o.pageToParam)(N)})},[y,j,p,N]);let T=e=>{let t=e.trim();t&&!p.includes(t)&&(x([...p,t]),v(""))},A=()=>{x([]),v("")},S=(0,r.useMemo)(()=>(0,n.rehydrateDates)(e),[e]),M=(0,r.useMemo)(()=>{let e=(0,n.filterByDate)(S,y,j);return p.length>0&&(e=e.filter(e=>{let t=e.name.toLowerCase();return p.every(e=>{let r=e.trim().toLowerCase().replace(/\//g,"-");return 0===r.length||t.includes(r)})})),e.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime())},[S,y,j,p]),R=Math.max(1,Math.ceil(M.length/n.ITEMS_PER_PAGE));(0,r.useEffect)(()=>{N>R&&w(R)},[N,R,w]);let E=(N-1)*n.ITEMS_PER_PAGE,D=Math.min(E+n.ITEMS_PER_PAGE,M.length),_=M.slice(E,D);return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("div",{className:"bg-card border border-border rounded-lg p-4",children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Filter by:"}),n.FILTER_PRESETS.map(e=>(0,t.jsx)("button",{onClick:()=>C(e.value),className:`px-3 py-1.5 text-sm rounded-md transition-colors ${y===e.value?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted/80"}`,children:e.label},e.value))]}),(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(d.Search,{className:"w-4 h-4 text-muted-foreground"}),(0,t.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Search Keywords:"})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("input",{type:"text",value:b,onChange:e=>v(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),T(b))},placeholder:"Enter keyword and press Enter",className:"px-3 py-2 text-sm bg-input border border-border rounded-md text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent transition-all hover:border-primary/50 w-[250px]","aria-label":"Add keyword"}),(0,t.jsx)("button",{onClick:()=>T(b),className:"px-3 py-2 text-sm bg-muted text-muted-foreground hover:bg-muted/80 rounded-md transition-colors","aria-label":"Add keyword",children:"Add"})]}),p.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p.map((e,r)=>(0,t.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 bg-muted text-muted-foreground rounded-md text-sm",children:[(0,t.jsx)("span",{children:e}),(0,t.jsx)("button",{onClick:()=>{x(p.filter((e,t)=>t!==r))},className:"hover:text-foreground transition-colors p-0.5 rounded hover:bg-muted/80","aria-label":`Remove keyword ${e}`,children:(0,t.jsx)(c.X,{className:"w-3.5 h-3.5"})})]},r)),(0,t.jsx)("button",{onClick:A,className:"px-2 py-1.5 text-xs bg-muted text-muted-foreground hover:bg-muted/80 rounded-md transition-colors","aria-label":"Clear all keywords",children:"Clear all"})]})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Custom Range:"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(f.default,{id:"date-from",value:j.from,onChange:e=>k("from",e),"aria-label":"Filter from date"}),(0,t.jsx)("span",{className:"text-muted-foreground",children:"to"}),(0,t.jsx)(f.default,{id:"date-to",value:j.to,onChange:e=>k("to",e),"aria-label":"Filter to date"})]}),("all"!==y||null!==j.from||null!==j.to||p.length>0)&&(0,t.jsx)("button",{onClick:()=>{P(),A()},className:"px-3 py-2 text-sm bg-muted text-muted-foreground hover:bg-muted/80 rounded-md transition-colors",children:"Clear"})]}),(0,t.jsx)("div",{className:"text-sm text-muted-foreground",children:0===M.length?(0,t.jsx)(t.Fragment,{children:"No projects found"}):(0,t.jsxs)(t.Fragment,{children:["Showing ",E+1,"-",D," of ",M.length," projects",M.length!==S.length&&(0,t.jsxs)("span",{className:"ml-1",children:["(filtered from ",S.length," total)"]}),p.length>0&&(0,t.jsxs)("span",{className:"ml-1",children:["with ",p.length," keyword",1!==p.length?"s":""]})]})})]})}),(0,t.jsxs)("div",{className:"bg-card border border-border rounded-lg overflow-hidden",children:[(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"border-b border-border bg-muted/50",children:[(0,t.jsx)("th",{scope:"col",className:"px-4 py-3 text-left text-sm font-semibold text-foreground w-12",children:(0,t.jsx)("span",{className:"sr-only",children:"Icon"})}),(0,t.jsx)("th",{scope:"col",className:"px-4 py-3 text-left text-sm font-semibold text-foreground max-w-md",children:"Agent Root"}),(0,t.jsx)("th",{scope:"col",className:"px-4 py-3 text-left text-sm font-semibold text-foreground hidden md:table-cell",children:"Path"}),(0,t.jsx)("th",{scope:"col",className:"px-4 py-3 text-left text-sm font-semibold text-foreground",children:"Last Modified"})]})}),(0,t.jsx)("tbody",{children:0===_.length?(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:4,className:"px-4 py-8 text-center text-muted-foreground",children:"No projects found matching the selected filter."})}):_.map(e=>{var r;return(0,t.jsxs)("tr",{className:"border-b border-border hover:bg-muted/50 transition-colors",children:[(0,t.jsx)("td",{className:"px-4 py-3",children:(0,t.jsx)(i,{className:"w-5 h-5 text-primary"})}),(0,t.jsx)("td",{className:"px-4 py-3 max-w-md",children:(0,t.jsx)(u.default,{href:`/project/${encodeURIComponent(e.name)}`,className:"font-semibold text-foreground hover:text-primary transition-colors break-words break-all inline-block max-w-full",children:(r=e.name,/^[A-Za-z]--/.test(r)?r[0]+":/"+r.slice(3).replace(/-/g,"/"):r.replace(/-/g,"/"))})}),(0,t.jsx)("td",{className:"px-4 py-3 text-sm text-muted-foreground hidden md:table-cell truncate max-w-md",children:e.path}),(0,t.jsx)("td",{className:"px-4 py-3 text-sm text-muted-foreground",children:(0,t.jsx)(h,{date:e.lastModified,formatted:e.lastModifiedFormatted})})]},e.name)})})]})}),M.length>0&&(0,t.jsx)(m.default,{currentPage:N,totalPages:R,onPageChange:w})]})]})}],62481)}]);
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,20087,30005,66595,85898,e=>{"use strict";e.s(["FILTER_PRESETS",0,[{value:"all",label:"All"},{value:"last-hour",label:"Last Hour"},{value:"today",label:"Today"},{value:"last-7-days",label:"Last 7 Days"},{value:"last-30-days",label:"Last 30 Days"}],"ITEMS_PER_PAGE",0,25,"filterByDate",0,function(e,t,r){if("all"===t)return e;if("custom"===t){let t,a,n=r.from?((t=new Date(r.from)).setHours(0,0,0,0),t):null,l=r.to?((a=new Date(r.to)).setHours(23,59,59,999),a):null;return e.filter(e=>(!n||!(e.lastModified<n))&&(!l||!(e.lastModified>l)))}let a=function(e){let t=new Date;switch(e){case"last-hour":return new Date(t.getTime()-36e5);case"today":return new Date(t.getFullYear(),t.getMonth(),t.getDate());case"last-7-days":return new Date(t.getTime()-6048e5);case"last-30-days":return new Date(t.getTime()-2592e6);default:return null}}(t);return a?e.filter(e=>e.lastModified>=a):e},"rehydrateDates",0,function(e){return e.map(e=>({...e,lastModified:e.lastModified instanceof Date?e.lastModified:new Date(e.lastModified)}))}],20087);var t=e.i(71645);e.s(["useFilterState",0,function(e=[],r){let[a,n]=(0,t.useState)(r?.filterPreset??"all"),[l,s]=(0,t.useState)(r?.dateRange??{from:null,to:null}),[o,i]=(0,t.useState)(r?.currentPage??1),d=`${a}|${JSON.stringify(l)}|${JSON.stringify(e)}`,[c,u]=(0,t.useState)(d);d!==c&&(u(d),i(1));let m=(0,t.useCallback)(e=>{n(e),"custom"!==e&&s({from:null,to:null})},[]);return{filterPreset:a,dateRange:l,currentPage:o,setCurrentPage:i,handlePresetChange:m,handleDateRangeChange:(0,t.useCallback)((e,t)=>{n("custom"),s(r=>({...r,[e]:t?new Date(t):null}))},[]),clearFilters:(0,t.useCallback)(()=>{n("all"),s({from:null,to:null})},[])}}],30005);var r=e.i(56420);let a=(0,r.default)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);e.s(["Search",0,a],66595);var n=e.i(43476);let l=(0,r.default)("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);e.s(["default",0,function({id:e,value:t,stringValue:r,onChange:a,"aria-label":s}){let o=null!=r?r:t?t.toISOString().split("T")[0]:"";return(0,n.jsxs)("div",{className:"relative group",children:[(0,n.jsx)("input",{type:"date",id:e,value:o,onChange:e=>a(e.target.value),"aria-label":s,className:"date-input px-3 py-2 pr-8 text-sm bg-input border border-border rounded-md text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent transition-all hover:border-primary/50 w-[200px]"}),(0,n.jsx)("label",{htmlFor:e,className:"absolute right-2.5 top-1/2 -translate-y-1/2 cursor-pointer pointer-events-auto z-10 p-1 rounded hover:bg-muted/50 transition-colors",onClick:t=>{t.preventDefault();let r=document.getElementById(e);r&&"function"==typeof r.showPicker?r.showPicker():r?.click()},children:(0,n.jsx)(l,{className:"w-4 h-4 text-primary group-hover:text-primary/80 transition-colors"})})]})}],85898)},24071,e=>{"use strict";let t=(0,e.i(56420).default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);e.s(["ChevronLeft",0,t],24071)},67927,e=>{"use strict";let t=(0,e.i(56420).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",0,t],67927)},73520,e=>{"use strict";var t=e.i(43476),r=e.i(24071),a=e.i(67927);e.s(["default",0,function({currentPage:e,totalPages:n,onPageChange:l}){if(n<=1)return null;let s=e=>`px-3 py-2 text-sm rounded-md transition-colors flex items-center gap-1 bg-muted text-muted-foreground ${e?"opacity-50 cursor-not-allowed":"hover:bg-muted/80"}`;return(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 py-4",children:[(0,t.jsxs)("button",{onClick:()=>l(e-1),disabled:1===e,className:s(1===e),"aria-label":"Previous page",children:[(0,t.jsx)(r.ChevronLeft,{className:"w-4 h-4"}),(0,t.jsx)("span",{className:"hidden sm:inline",children:"Previous"})]}),(0,t.jsx)("div",{className:"flex items-center gap-1",children:(()=>{if(n<=7)return Array.from({length:n},(e,t)=>t+1);let t=[1],r=Math.max(2,e-1),a=Math.min(n-1,e+1);e<=3&&(a=Math.min(5,n-1)),e>=n-2&&(r=Math.max(2,n-4)),r>2&&t.push("ellipsis-start");for(let e=r;e<=a;e++)t.push(e);return a<n-1&&t.push("ellipsis-end"),t.push(n),t})().map(r=>"string"==typeof r?(0,t.jsx)("span",{className:"px-2 text-muted-foreground",children:"..."},r):(0,t.jsx)("button",{onClick:()=>l(r),className:`min-w-[2.5rem] px-3 py-2 text-sm rounded-md transition-colors ${e===r?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted/80"}`,"aria-label":`Page ${r}`,"aria-current":e===r?"page":void 0,children:r},r))}),(0,t.jsxs)("button",{onClick:()=>l(e+1),disabled:e===n,className:s(e===n),"aria-label":"Next page",children:[(0,t.jsx)("span",{className:"hidden sm:inline",children:"Next"}),(0,t.jsx)(a.ChevronRight,{className:"w-4 h-4"})]})]})}])},80060,2711,e=>{"use strict";var t=e.i(18566),r=e.i(71645);function a(e){let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${a}`}function n(e){var t;if(!e||(t=e,!/^\d{4}-\d{2}-\d{2}$/.test(t)||isNaN(Date.parse(t))))return null;let[r,a,n]=e.split("-").map(Number);return new Date(r,a-1,n,12,0,0)}e.s(["useUrlParams",0,function(){let e=(0,t.useSearchParams)(),a=(0,t.useRouter)(),n=(0,t.usePathname)(),l=(0,r.useRef)(null),s=(0,r.useCallback)(t=>e.get(t),[e]),o=(0,r.useCallback)(()=>new URLSearchParams(e.toString()),[e]),i=(0,r.useCallback)(t=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{let r=new URLSearchParams(e.toString());for(let[e,a]of Object.entries(t))void 0===a||""===a?r.delete(e):r.set(e,a);let l=r.toString(),s=l?`${n}?${l}`:n;a.replace(s,{scroll:!1})},150)},[e,n,a]);return(0,r.useEffect)(()=>()=>{l.current&&clearTimeout(l.current)},[]),{get:s,getAll:o,setAll:i}}],80060),e.s(["dateRangeToParams",0,function(e){let t={};return e.from&&(t.from=a(e.from)),e.to&&(t.to=a(e.to)),t},"keywordsToParam",0,function(e){if(0!==e.length)return e.map(e=>encodeURIComponent(e)).join(",")},"pageToParam",0,function(e){return e<=1?void 0:String(e)},"paramToKeywords",0,function(e){return e?e.split(",").map(e=>decodeURIComponent(e.trim())).filter(e=>e.length>0):[]},"paramToPage",0,function(e){if(!e)return 1;let t=parseInt(e,10);return Number.isFinite(t)&&t>=1?t:1},"paramToPreset",0,function(e){return e&&["all","last-hour","today","last-7-days","last-30-days","custom"].includes(e)?e:"all"},"paramsToDateRange",0,function(e,t){return{from:n(e),to:n(t)}},"presetToParam",0,function(e){return"all"===e?void 0:e}],2711)},63676,e=>{"use strict";let t=(0,e.i(56420).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["X",0,t],63676)},45425,(e,t,r)=>{var a;"u">typeof __nccwpck_require__&&(__nccwpck_require__.ab="/ROOT/node_modules/next/dist/compiled/os-browserify/"),(a={}).endianness=function(){return"LE"},a.hostname=function(){return"u">typeof location?location.hostname:""},a.loadavg=function(){return[]},a.uptime=function(){return 0},a.freemem=function(){return Number.MAX_VALUE},a.totalmem=function(){return Number.MAX_VALUE},a.cpus=function(){return[]},a.type=function(){return"Browser"},a.release=function(){return"u">typeof navigator?navigator.appVersion:""},a.networkInterfaces=a.getNetworkInterfaces=function(){return{}},a.arch=function(){return"javascript"},a.platform=function(){return"browser"},a.tmpdir=a.tmpDir=function(){return"/tmp"},a.EOL="\n",a.homedir=function(){return"/"},t.exports=a},41790,(e,t,r)=>{!function(){"use strict";var e={114:function(e){function t(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function r(e,t){for(var r,a="",n=0,l=-1,s=0,o=0;o<=e.length;++o){if(o<e.length)r=e.charCodeAt(o);else if(47===r)break;else r=47;if(47===r){if(l===o-1||1===s);else if(l!==o-1&&2===s){if(a.length<2||2!==n||46!==a.charCodeAt(a.length-1)||46!==a.charCodeAt(a.length-2)){if(a.length>2){var i=a.lastIndexOf("/");if(i!==a.length-1){-1===i?(a="",n=0):n=(a=a.slice(0,i)).length-1-a.lastIndexOf("/"),l=o,s=0;continue}}else if(2===a.length||1===a.length){a="",n=0,l=o,s=0;continue}}t&&(a.length>0?a+="/..":a="..",n=2)}else a.length>0?a+="/"+e.slice(l+1,o):a=e.slice(l+1,o),n=o-l-1;l=o,s=0}else 46===r&&-1!==s?++s:s=-1}return a}var a={resolve:function(){for(var e,a,n="",l=!1,s=arguments.length-1;s>=-1&&!l;s--)s>=0?a=arguments[s]:(void 0===e&&(e=""),a=e),t(a),0!==a.length&&(n=a+"/"+n,l=47===a.charCodeAt(0));if(n=r(n,!l),l)if(n.length>0)return"/"+n;else return"/";return n.length>0?n:"."},normalize:function(e){if(t(e),0===e.length)return".";var a=47===e.charCodeAt(0),n=47===e.charCodeAt(e.length-1);return(0!==(e=r(e,!a)).length||a||(e="."),e.length>0&&n&&(e+="/"),a)?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0==arguments.length)return".";for(var e,r=0;r<arguments.length;++r){var n=arguments[r];t(n),n.length>0&&(void 0===e?e=n:e+="/"+n)}return void 0===e?".":a.normalize(e)},relative:function(e,r){if(t(e),t(r),e===r||(e=a.resolve(e))===(r=a.resolve(r)))return"";for(var n=1;n<e.length&&47===e.charCodeAt(n);++n);for(var l=e.length,s=l-n,o=1;o<r.length&&47===r.charCodeAt(o);++o);for(var i=r.length-o,d=s<i?s:i,c=-1,u=0;u<=d;++u){if(u===d){if(i>d){if(47===r.charCodeAt(o+u))return r.slice(o+u+1);else if(0===u)return r.slice(o+u)}else s>d&&(47===e.charCodeAt(n+u)?c=u:0===u&&(c=0));break}var m=e.charCodeAt(n+u);if(m!==r.charCodeAt(o+u))break;47===m&&(c=u)}var f="";for(u=n+c+1;u<=l;++u)(u===l||47===e.charCodeAt(u))&&(0===f.length?f+="..":f+="/..");return f.length>0?f+r.slice(o+c):(o+=c,47===r.charCodeAt(o)&&++o,r.slice(o))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),a=47===r,n=-1,l=!0,s=e.length-1;s>=1;--s)if(47===(r=e.charCodeAt(s))){if(!l){n=s;break}}else l=!1;return -1===n?a?"/":".":a&&1===n?"//":e.slice(0,n)},basename:function(e,r){if(void 0!==r&&"string"!=typeof r)throw TypeError('"ext" argument must be a string');t(e);var a,n=0,l=-1,s=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var o=r.length-1,i=-1;for(a=e.length-1;a>=0;--a){var d=e.charCodeAt(a);if(47===d){if(!s){n=a+1;break}}else -1===i&&(s=!1,i=a+1),o>=0&&(d===r.charCodeAt(o)?-1==--o&&(l=a):(o=-1,l=i))}return n===l?l=i:-1===l&&(l=e.length),e.slice(n,l)}for(a=e.length-1;a>=0;--a)if(47===e.charCodeAt(a)){if(!s){n=a+1;break}}else -1===l&&(s=!1,l=a+1);return -1===l?"":e.slice(n,l)},extname:function(e){t(e);for(var r=-1,a=0,n=-1,l=!0,s=0,o=e.length-1;o>=0;--o){var i=e.charCodeAt(o);if(47===i){if(!l){a=o+1;break}continue}-1===n&&(l=!1,n=o+1),46===i?-1===r?r=o:1!==s&&(s=1):-1!==r&&(s=-1)}return -1===r||-1===n||0===s||1===s&&r===n-1&&r===a+1?"":e.slice(r,n)},format:function(e){var t,r;if(null===e||"object"!=typeof e)throw TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return t=e.dir||e.root,r=e.base||(e.name||"")+(e.ext||""),t?t===e.root?t+r:t+"/"+r:r},parse:function(e){t(e);var r,a={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return a;var n=e.charCodeAt(0),l=47===n;l?(a.root="/",r=1):r=0;for(var s=-1,o=0,i=-1,d=!0,c=e.length-1,u=0;c>=r;--c){if(47===(n=e.charCodeAt(c))){if(!d){o=c+1;break}continue}-1===i&&(d=!1,i=c+1),46===n?-1===s?s=c:1!==u&&(u=1):-1!==s&&(u=-1)}return -1===s||-1===i||0===u||1===u&&s===i-1&&s===o+1?-1!==i&&(0===o&&l?a.base=a.name=e.slice(1,i):a.base=a.name=e.slice(o,i)):(0===o&&l?(a.name=e.slice(1,s),a.base=e.slice(1,i)):(a.name=e.slice(o,s),a.base=e.slice(o,i)),a.ext=e.slice(s,i)),o>0?a.dir=e.slice(0,o-1):l&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};a.posix=a,e.exports=a}},r={};function a(t){var n=r[t];if(void 0!==n)return n.exports;var l=r[t]={exports:{}},s=!0;try{e[t](l,l.exports,a),s=!1}finally{s&&delete r[t]}return l.exports}a.ab="/ROOT/node_modules/next/dist/compiled/path-browserify/",t.exports=a(114)}()},62481,e=>{"use strict";var t=e.i(43476),r=e.i(71645);e.i(47167),e.i(45425),e.i(41790);var a=e.i(47163),n=e.i(20087),l=e.i(30005),s=e.i(80060),o=e.i(2711);let i=(0,e.i(56420).default)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);var d=e.i(66595),c=e.i(63676),u=e.i(22016),m=e.i(73520),f=e.i(85898);function h({date:e,formatted:r}){return(0,t.jsx)("span",{children:r||(0,a.formatDate)(e)})}e.s(["default",0,function({folders:e}){let a=(0,s.useUrlParams)(),g=(0,r.useRef)(!1),[p,x]=(0,r.useState)(()=>(0,o.paramToKeywords)(a.get("q"))),[b,v]=(0,r.useState)(""),{filterPreset:y,dateRange:j,currentPage:N,setCurrentPage:w,handlePresetChange:C,handleDateRangeChange:k,clearFilters:P}=(0,l.useFilterState)(p,{filterPreset:(0,o.paramToPreset)(a.get("preset")),dateRange:(0,o.paramsToDateRange)(a.get("from"),a.get("to")),currentPage:(0,o.paramToPage)(a.get("page"))});(0,r.useEffect)(()=>{if(!g.current){g.current=!0;return}a.setAll({preset:(0,o.presetToParam)(y),...(0,o.dateRangeToParams)(j),q:(0,o.keywordsToParam)(p),page:(0,o.pageToParam)(N)})},[y,j,p,N]);let T=e=>{let t=e.trim();t&&!p.includes(t)&&(x([...p,t]),v(""))},A=()=>{x([]),v("")},S=(0,r.useMemo)(()=>(0,n.rehydrateDates)(e),[e]),M=(0,r.useMemo)(()=>{let e=(0,n.filterByDate)(S,y,j);return p.length>0&&(e=e.filter(e=>{let t=e.name.toLowerCase();return p.every(e=>{let r=e.trim().toLowerCase().replace(/\//g,"-");return 0===r.length||t.includes(r)})})),e.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime())},[S,y,j,p]),R=Math.max(1,Math.ceil(M.length/n.ITEMS_PER_PAGE));(0,r.useEffect)(()=>{N>R&&w(R)},[N,R,w]);let E=(N-1)*n.ITEMS_PER_PAGE,D=Math.min(E+n.ITEMS_PER_PAGE,M.length),_=M.slice(E,D);return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("div",{className:"bg-card border border-border rounded-lg p-4",children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Filter by:"}),n.FILTER_PRESETS.map(e=>(0,t.jsx)("button",{onClick:()=>C(e.value),className:`px-3 py-1.5 text-sm rounded-md transition-colors ${y===e.value?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted/80"}`,children:e.label},e.value))]}),(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(d.Search,{className:"w-4 h-4 text-muted-foreground"}),(0,t.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Search Keywords:"})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("input",{type:"text",value:b,onChange:e=>v(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),T(b))},placeholder:"Enter keyword and press Enter",className:"px-3 py-2 text-sm bg-input border border-border rounded-md text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent transition-all hover:border-primary/50 w-[250px]","aria-label":"Add keyword"}),(0,t.jsx)("button",{onClick:()=>T(b),className:"px-3 py-2 text-sm bg-muted text-muted-foreground hover:bg-muted/80 rounded-md transition-colors","aria-label":"Add keyword",children:"Add"})]}),p.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p.map((e,r)=>(0,t.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 bg-muted text-muted-foreground rounded-md text-sm",children:[(0,t.jsx)("span",{children:e}),(0,t.jsx)("button",{onClick:()=>{x(p.filter((e,t)=>t!==r))},className:"hover:text-foreground transition-colors p-0.5 rounded hover:bg-muted/80","aria-label":`Remove keyword ${e}`,children:(0,t.jsx)(c.X,{className:"w-3.5 h-3.5"})})]},r)),(0,t.jsx)("button",{onClick:A,className:"px-2 py-1.5 text-xs bg-muted text-muted-foreground hover:bg-muted/80 rounded-md transition-colors","aria-label":"Clear all keywords",children:"Clear all"})]})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Custom Range:"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(f.default,{id:"date-from",value:j.from,onChange:e=>k("from",e),"aria-label":"Filter from date"}),(0,t.jsx)("span",{className:"text-muted-foreground",children:"to"}),(0,t.jsx)(f.default,{id:"date-to",value:j.to,onChange:e=>k("to",e),"aria-label":"Filter to date"})]}),("all"!==y||null!==j.from||null!==j.to||p.length>0)&&(0,t.jsx)("button",{onClick:()=>{P(),A()},className:"px-3 py-2 text-sm bg-muted text-muted-foreground hover:bg-muted/80 rounded-md transition-colors",children:"Clear"})]}),(0,t.jsx)("div",{className:"text-sm text-muted-foreground",children:0===M.length?(0,t.jsx)(t.Fragment,{children:"No projects found"}):(0,t.jsxs)(t.Fragment,{children:["Showing ",E+1,"-",D," of ",M.length," projects",M.length!==S.length&&(0,t.jsxs)("span",{className:"ml-1",children:["(filtered from ",S.length," total)"]}),p.length>0&&(0,t.jsxs)("span",{className:"ml-1",children:["with ",p.length," keyword",1!==p.length?"s":""]})]})})]})}),(0,t.jsxs)("div",{className:"bg-card border border-border rounded-lg overflow-hidden",children:[(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"border-b border-border bg-muted/50",children:[(0,t.jsx)("th",{scope:"col",className:"px-4 py-3 text-left text-sm font-semibold text-foreground w-12",children:(0,t.jsx)("span",{className:"sr-only",children:"Icon"})}),(0,t.jsx)("th",{scope:"col",className:"px-4 py-3 text-left text-sm font-semibold text-foreground max-w-md",children:"Agent Root"}),(0,t.jsx)("th",{scope:"col",className:"px-4 py-3 text-left text-sm font-semibold text-foreground hidden md:table-cell",children:"Path"}),(0,t.jsx)("th",{scope:"col",className:"px-4 py-3 text-left text-sm font-semibold text-foreground",children:"Last Modified"})]})}),(0,t.jsx)("tbody",{children:0===_.length?(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:4,className:"px-4 py-8 text-center text-muted-foreground",children:"No projects found matching the selected filter."})}):_.map(e=>{var r;return(0,t.jsxs)("tr",{className:"border-b border-border hover:bg-muted/50 transition-colors",children:[(0,t.jsx)("td",{className:"px-4 py-3",children:(0,t.jsx)(i,{className:"w-5 h-5 text-primary"})}),(0,t.jsx)("td",{className:"px-4 py-3 max-w-md",children:(0,t.jsx)(u.default,{href:`/project/${encodeURIComponent(e.name)}`,className:"font-semibold text-foreground hover:text-primary transition-colors break-words break-all inline-block max-w-full",children:(r=e.name,/^[A-Za-z]--/.test(r)?r[0]+":/"+r.slice(3).replace(/-/g,"/"):r.replace(/-/g,"/"))})}),(0,t.jsx)("td",{className:"px-4 py-3 text-sm text-muted-foreground hidden md:table-cell truncate max-w-md",children:e.path}),(0,t.jsx)("td",{className:"px-4 py-3 text-sm text-muted-foreground",children:(0,t.jsx)(h,{date:e.lastModified,formatted:e.lastModifiedFormatted})})]},e.name)})})]})}),M.length>0&&(0,t.jsx)(m.default,{currentPage:N,totalPages:R,onPageChange:w})]})]})}],62481)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,67927,e=>{"use strict";let t=(0,e.i(56420).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",0,t],67927)},24071,e=>{"use strict";let t=(0,e.i(56420).default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);e.s(["ChevronLeft",0,t],24071)},73520,e=>{"use strict";var t=e.i(43476),a=e.i(24071),r=e.i(67927);e.s(["default",0,function({currentPage:e,totalPages:i,onPageChange:s}){if(i<=1)return null;let l=e=>`px-3 py-2 text-sm rounded-md transition-colors flex items-center gap-1 bg-muted text-muted-foreground ${e?"opacity-50 cursor-not-allowed":"hover:bg-muted/80"}`;return(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 py-4",children:[(0,t.jsxs)("button",{onClick:()=>s(e-1),disabled:1===e,className:l(1===e),"aria-label":"Previous page",children:[(0,t.jsx)(a.ChevronLeft,{className:"w-4 h-4"}),(0,t.jsx)("span",{className:"hidden sm:inline",children:"Previous"})]}),(0,t.jsx)("div",{className:"flex items-center gap-1",children:(()=>{if(i<=7)return Array.from({length:i},(e,t)=>t+1);let t=[1],a=Math.max(2,e-1),r=Math.min(i-1,e+1);e<=3&&(r=Math.min(5,i-1)),e>=i-2&&(a=Math.max(2,i-4)),a>2&&t.push("ellipsis-start");for(let e=a;e<=r;e++)t.push(e);return r<i-1&&t.push("ellipsis-end"),t.push(i),t})().map(a=>"string"==typeof a?(0,t.jsx)("span",{className:"px-2 text-muted-foreground",children:"..."},a):(0,t.jsx)("button",{onClick:()=>s(a),className:`min-w-[2.5rem] px-3 py-2 text-sm rounded-md transition-colors ${e===a?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted/80"}`,"aria-label":`Page ${a}`,"aria-current":e===a?"page":void 0,children:a},a))}),(0,t.jsxs)("button",{onClick:()=>s(e+1),disabled:e===i,className:l(e===i),"aria-label":"Next page",children:[(0,t.jsx)("span",{className:"hidden sm:inline",children:"Next"}),(0,t.jsx)(r.ChevronRight,{className:"w-4 h-4"})]})]})}])},34713,e=>{"use strict";e.s(["formatDuration",0,function(e){if(e<1e3)return`${e}ms`;let t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;let a=Math.floor(t/60);if(a>=60){let e=Math.floor(a/60);return`${e}h ${a%60}m`}let r=(t%60).toFixed(0);return`${a}m ${r}s`},"formatRelativeTime",0,function(e){let t=Date.now()-e;return t<6e4?`${Math.max(1,Math.floor(t/1e3))}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}])},66794,8143,e=>{"use strict";let t=(0,e.i(56420).default)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);e.s(["Settings",0,t],66794);var a=e.i(95187);let r=(0,a.createServerReference)("60497a2493bce8a648e2631a59a53c15f4bdb0ab05",a.callServer,void 0,a.findSourceMapURL,"searchHookActivityAction");e.s(["searchHookActivityAction",0,r],8143)},84026,29407,16306,e=>{"use strict";var t=e.i(56420);let a=(0,t.default)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);e.s(["ShieldCheck",0,a],84026);let r=(0,t.default)("shield-x",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);e.s(["ShieldX",0,r],29407);let i=(0,t.default)("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);e.s(["ShieldAlert",0,i],16306)}]);
|
|
@@ -3,9 +3,13 @@
|
|
|
3
3
|
import { installHooks, removeHooks } from "@/src/hooks/manager";
|
|
4
4
|
import { readHooksConfig } from "@/src/hooks/hooks-config";
|
|
5
5
|
import { BUILTIN_POLICIES } from "@/src/hooks/builtin-policies";
|
|
6
|
-
import
|
|
6
|
+
import { detectInstalledClis } from "@/src/hooks/integrations";
|
|
7
|
+
import type { HookScope, IntegrationType } from "@/src/hooks/types";
|
|
7
8
|
|
|
8
|
-
export async function installHooksWebAction(
|
|
9
|
+
export async function installHooksWebAction(
|
|
10
|
+
scope: HookScope = "user",
|
|
11
|
+
cli?: IntegrationType[],
|
|
12
|
+
): Promise<void> {
|
|
9
13
|
const config = readHooksConfig();
|
|
10
14
|
// On first install (no config yet), default to all defaultEnabled non-beta policies.
|
|
11
15
|
// Always pass an explicit array so installHooks never triggers the interactive TUI.
|
|
@@ -13,9 +17,21 @@ export async function installHooksWebAction(scope: HookScope = "user"): Promise<
|
|
|
13
17
|
config.enabledPolicies.length > 0
|
|
14
18
|
? config.enabledPolicies
|
|
15
19
|
: BUILTIN_POLICIES.filter((p) => p.defaultEnabled && !p.beta).map((p) => p.name);
|
|
16
|
-
|
|
20
|
+
// When the dashboard doesn't pass an explicit cli list, default to detected CLIs;
|
|
21
|
+
// if none are detected (rare on a server-rendered dashboard), fall back to claude.
|
|
22
|
+
const target = cli && cli.length > 0 ? cli : detectInstalledClis();
|
|
23
|
+
const finalCli: IntegrationType[] = target.length > 0 ? target : ["claude"];
|
|
24
|
+
await installHooks(policies, scope, undefined, false, "web", undefined, false, finalCli);
|
|
17
25
|
}
|
|
18
26
|
|
|
19
|
-
export async function removeHooksWebAction(
|
|
20
|
-
|
|
27
|
+
export async function removeHooksWebAction(
|
|
28
|
+
scope: HookScope | "all" = "user",
|
|
29
|
+
cli?: IntegrationType[],
|
|
30
|
+
): Promise<void> {
|
|
31
|
+
// Mirror the install-side resolution: if the dashboard didn't pin a CLI,
|
|
32
|
+
// remove from every detected CLI so an uninstall doesn't silently leave
|
|
33
|
+
// hooks behind for the other agent.
|
|
34
|
+
const target = cli && cli.length > 0 ? cli : detectInstalledClis();
|
|
35
|
+
const finalCli: IntegrationType[] = target.length > 0 ? target : ["claude"];
|
|
36
|
+
await removeHooks(undefined, scope, undefined, { source: "web", cli: finalCli });
|
|
21
37
|
}
|
|
@@ -116,6 +116,25 @@ function EventTypeBadge({ eventType }: { eventType: string }) {
|
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
function IntegrationBadge({ integration }: { integration?: string }) {
|
|
120
|
+
if (!integration) return null;
|
|
121
|
+
const label =
|
|
122
|
+
integration === "claude" ? "Claude Code" : integration === "codex" ? "OpenAI Codex" : integration;
|
|
123
|
+
const isCodex = integration === "codex";
|
|
124
|
+
return (
|
|
125
|
+
<span
|
|
126
|
+
className={`inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium border ${
|
|
127
|
+
isCodex
|
|
128
|
+
? "bg-purple-500/10 text-purple-400 border-purple-500/20"
|
|
129
|
+
: "bg-orange-500/10 text-orange-400 border-orange-500/20"
|
|
130
|
+
}`}
|
|
131
|
+
title={`Agent CLI: ${label}`}
|
|
132
|
+
>
|
|
133
|
+
{label}
|
|
134
|
+
</span>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
119
138
|
function ModeBadge({ mode }: { mode: string }) {
|
|
120
139
|
const isDefault = mode === "default";
|
|
121
140
|
return (
|
|
@@ -461,6 +480,7 @@ function ActivityTab({
|
|
|
461
480
|
<th className="px-4 py-2.5 font-medium w-6" />
|
|
462
481
|
<th className="px-3 py-2.5 font-medium">Decision</th>
|
|
463
482
|
<th className="px-3 py-2.5 font-medium">Event</th>
|
|
483
|
+
<th className="px-3 py-2.5 font-medium">CLI</th>
|
|
464
484
|
<th className="px-3 py-2.5 font-medium">Tool</th>
|
|
465
485
|
<th className="px-3 py-2.5 font-medium">Policy</th>
|
|
466
486
|
<th className="px-3 py-2.5 font-medium">Reason</th>
|
|
@@ -502,6 +522,9 @@ function ActivityTab({
|
|
|
502
522
|
<td className="px-3 py-2">
|
|
503
523
|
<EventTypeBadge eventType={item.eventType} />
|
|
504
524
|
</td>
|
|
525
|
+
<td className="px-3 py-2">
|
|
526
|
+
<IntegrationBadge integration={item.integration} />
|
|
527
|
+
</td>
|
|
505
528
|
<td className="px-3 py-2 font-mono text-foreground">
|
|
506
529
|
{item.toolName ?? "\u2014"}
|
|
507
530
|
</td>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="#D97757"><title>Claude</title><path d="m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="#FFFFFF"><title>OpenAI</title><path d="M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="#000000"><title>OpenAI</title><path d="M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"/></svg>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "failproofai",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9-beta.0",
|
|
4
4
|
"description": "The easiest way to manage policies that keep your AI agents reliable, on-task, and running autonomously — for Claude Code & the Agents SDK",
|
|
5
5
|
"bin": {
|
|
6
6
|
"failproofai": "./dist/cli.mjs"
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"tailwind-merge": "^3.4.0",
|
|
91
91
|
"tailwindcss": "^4.1.18",
|
|
92
92
|
"typescript": "^6.0.2",
|
|
93
|
-
"@anthropic-ai/sdk": "^0.
|
|
93
|
+
"@anthropic-ai/sdk": "^0.91.1",
|
|
94
94
|
"vitest": "^4.0.18"
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
@@ -9,7 +9,7 @@ const currentPort = parseInt(process.env.PORT, 10) || 3000
|
|
|
9
9
|
const hostname = process.env.HOSTNAME || '0.0.0.0'
|
|
10
10
|
|
|
11
11
|
let keepAliveTimeout = parseInt(process.env.KEEP_ALIVE_TIMEOUT, 10)
|
|
12
|
-
const nextConfig = {"env":{"NEXT_PUBLIC_APP_VERSION":"0.0.
|
|
12
|
+
const nextConfig = {"env":{"NEXT_PUBLIC_APP_VERSION":"0.0.9-beta.0"},"typescript":{"ignoreBuildErrors":false},"typedRoutes":false,"distDir":"./.next","cleanDistDir":true,"assetPrefix":"","cacheMaxMemorySize":52428800,"configOrigin":"next.config.ts","useFileSystemPublicRoutes":true,"generateEtags":true,"pageExtensions":["tsx","ts","jsx","js"],"poweredByHeader":true,"compress":true,"images":{"deviceSizes":[640,750,828,1080,1200,1920,2048,3840],"imageSizes":[32,48,64,96,128,256,384],"path":"/_next/image","loader":"default","loaderFile":"","domains":[],"disableStaticImages":false,"minimumCacheTTL":14400,"formats":["image/webp"],"maximumRedirects":3,"maximumResponseBody":50000000,"dangerouslyAllowLocalIP":false,"dangerouslyAllowSVG":false,"contentSecurityPolicy":"script-src 'none'; frame-src 'none'; sandbox;","contentDispositionType":"attachment","localPatterns":[{"pathname":"**","search":""}],"remotePatterns":[],"qualities":[75],"unoptimized":true,"customCacheHandler":false},"devIndicators":{"position":"bottom-left"},"onDemandEntries":{"maxInactiveAge":60000,"pagesBufferLength":5},"basePath":"","sassOptions":{},"trailingSlash":false,"i18n":null,"productionBrowserSourceMaps":false,"excludeDefaultMomentLocales":true,"reactProductionProfiling":false,"reactStrictMode":null,"reactMaxHeadersLength":6000,"httpAgentOptions":{"keepAlive":true},"logging":{"serverFunctions":true,"browserToTerminal":"warn"},"compiler":{},"expireTime":31536000,"staticPageGenerationTimeout":60,"output":"standalone","modularizeImports":{"@mui/icons-material":{"transform":"@mui/icons-material/{{member}}"},"lodash":{"transform":"lodash/{{member}}"}},"outputFileTracingRoot":"/home/runner/work/failproofai/failproofai","cacheComponents":false,"cacheLife":{"default":{"stale":300,"revalidate":900,"expire":4294967294},"seconds":{"stale":30,"revalidate":1,"expire":60},"minutes":{"stale":300,"revalidate":60,"expire":3600},"hours":{"stale":300,"revalidate":3600,"expire":86400},"days":{"stale":300,"revalidate":86400,"expire":604800},"weeks":{"stale":300,"revalidate":604800,"expire":2592000},"max":{"stale":300,"revalidate":2592000,"expire":31536000}},"cacheHandlers":{},"experimental":{"appNewScrollHandler":false,"useSkewCookie":false,"cssChunking":true,"multiZoneDraftMode":false,"appNavFailHandling":false,"prerenderEarlyExit":true,"serverMinification":true,"linkNoTouchStart":false,"caseSensitiveRoutes":false,"cachedNavigations":false,"partialFallbacks":false,"dynamicOnHover":false,"varyParams":false,"prefetchInlining":false,"preloadEntriesOnStart":true,"clientRouterFilter":true,"clientRouterFilterRedirects":false,"fetchCacheKeyPrefix":"","proxyPrefetch":"flexible","optimisticClientCache":true,"manualClientBasePath":false,"cpus":3,"memoryBasedWorkersCount":false,"imgOptConcurrency":null,"imgOptTimeoutInSeconds":7,"imgOptMaxInputPixels":268402689,"imgOptSequentialRead":null,"imgOptSkipMetadata":null,"isrFlushToDisk":true,"workerThreads":false,"optimizeCss":false,"nextScriptWorkers":false,"scrollRestoration":false,"externalDir":false,"disableOptimizedLoading":false,"gzipSize":true,"craCompat":false,"esmExternals":true,"fullySpecified":false,"swcTraceProfiling":false,"forceSwcTransforms":false,"largePageDataBytes":128000,"typedEnv":false,"parallelServerCompiles":false,"parallelServerBuildTraces":false,"ppr":false,"authInterrupts":false,"webpackMemoryOptimizations":false,"optimizeServerReact":true,"strictRouteTypes":false,"viewTransition":false,"removeUncaughtErrorAndRejectionListeners":false,"validateRSCRequestHeaders":false,"staleTimes":{"dynamic":0,"static":300},"reactDebugChannel":true,"serverComponentsHmrCache":true,"staticGenerationMaxConcurrency":8,"staticGenerationMinPagesPerWorker":25,"transitionIndicator":false,"gestureTransition":false,"inlineCss":false,"useCache":false,"globalNotFound":false,"browserDebugInfoInTerminal":"warn","lockDistDir":true,"proxyClientMaxBodySize":10485760,"hideLogsAfterAbort":false,"mcpServer":true,"turbopackFileSystemCacheForDev":true,"turbopackFileSystemCacheForBuild":false,"turbopackInferModuleSideEffects":true,"turbopackPluginRuntimeStrategy":"childProcesses","optimizePackageImports":["lucide-react","date-fns","lodash-es","ramda","antd","react-bootstrap","ahooks","@ant-design/icons","@headlessui/react","@headlessui-float/react","@heroicons/react/20/solid","@heroicons/react/24/solid","@heroicons/react/24/outline","@visx/visx","@tremor/react","rxjs","@mui/material","@mui/icons-material","recharts","react-use","effect","@effect/schema","@effect/platform","@effect/platform-node","@effect/platform-browser","@effect/platform-bun","@effect/sql","@effect/sql-mssql","@effect/sql-mysql2","@effect/sql-pg","@effect/sql-sqlite-node","@effect/sql-sqlite-bun","@effect/sql-sqlite-wasm","@effect/sql-sqlite-react-native","@effect/rpc","@effect/rpc-http","@effect/typeclass","@effect/experimental","@effect/opentelemetry","@material-ui/core","@material-ui/icons","@tabler/icons-react","mui-core","react-icons/ai","react-icons/bi","react-icons/bs","react-icons/cg","react-icons/ci","react-icons/di","react-icons/fa","react-icons/fa6","react-icons/fc","react-icons/fi","react-icons/gi","react-icons/go","react-icons/gr","react-icons/hi","react-icons/hi2","react-icons/im","react-icons/io","react-icons/io5","react-icons/lia","react-icons/lib","react-icons/lu","react-icons/md","react-icons/pi","react-icons/ri","react-icons/rx","react-icons/si","react-icons/sl","react-icons/tb","react-icons/tfi","react-icons/ti","react-icons/vsc","react-icons/wi"],"trustHostHeader":false,"isExperimentalCompile":false},"htmlLimitedBots":"[\\w-]+-Google|Google-[\\w-]+|Chrome-Lighthouse|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|Yeti|googleweblight","bundlePagesRouterDependencies":false,"configFileName":"next.config.ts","outputFileTracingExcludes":{"*":["node_modules/@img/**","node_modules/sharp/**"]},"turbopack":{"root":"/home/runner/work/failproofai/failproofai"},"distDirRoot":".next"}
|
|
13
13
|
|
|
14
14
|
process.env.__NEXT_PRIVATE_STANDALONE_CONFIG = JSON.stringify(nextConfig)
|
|
15
15
|
|
package/README.md
CHANGED
|
@@ -17,13 +17,32 @@
|
|
|
17
17
|
|
|
18
18
|
**Translations**: [简体中文](docs/i18n/README.zh.md) | [日本語](docs/i18n/README.ja.md) | [한국어](docs/i18n/README.ko.md) | [Español](docs/i18n/README.es.md) | [Português](docs/i18n/README.pt-br.md) | [Deutsch](docs/i18n/README.de.md) | [Français](docs/i18n/README.fr.md) | [Русский](docs/i18n/README.ru.md) | [हिन्दी](docs/i18n/README.hi.md) | [Türkçe](docs/i18n/README.tr.md) | [Tiếng Việt](docs/i18n/README.vi.md) | [Italiano](docs/i18n/README.it.md) | [العربية](docs/i18n/README.ar.md) | [עברית](docs/i18n/README.he.md)
|
|
19
19
|
|
|
20
|
-
The easiest way to manage policies that keep your AI agents reliable, on-task, and running autonomously - for **Claude Code** & the **Agents SDK**.
|
|
20
|
+
The easiest way to manage policies that keep your AI agents reliable, on-task, and running autonomously - for **Claude Code**, **OpenAI Codex** & the **Agents SDK**.
|
|
21
21
|
|
|
22
22
|
<p align="center">
|
|
23
23
|
<img src="failproofai-hq.gif" alt="Failproof AI in action" width="800" />
|
|
24
24
|
</p>
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
## Supported agent CLIs
|
|
27
|
+
|
|
28
|
+
<p align="center">
|
|
29
|
+
<a href="https://claude.com/claude-code" title="Claude Code">
|
|
30
|
+
<img src="assets/logos/claude.svg" alt="Claude Code" width="64" height="64" />
|
|
31
|
+
</a>
|
|
32
|
+
|
|
33
|
+
<a href="https://developers.openai.com/codex" title="OpenAI Codex">
|
|
34
|
+
<picture>
|
|
35
|
+
<source media="(prefers-color-scheme: dark)" srcset="assets/logos/openai-dark.svg" />
|
|
36
|
+
<img src="assets/logos/openai-light.svg" alt="OpenAI Codex" width="64" height="64" />
|
|
37
|
+
</picture>
|
|
38
|
+
</a>
|
|
39
|
+
|
|
40
|
+
<strong>+ more coming soon</strong>
|
|
41
|
+
</p>
|
|
42
|
+
|
|
43
|
+
> Install hooks for one or both: `failproofai policies --install --cli codex` (or `--cli claude codex`). Omit `--cli` to auto-detect installed CLIs and prompt.
|
|
44
|
+
|
|
45
|
+
- **39 Built-in Policies** - Catch common agent failure modes out of the box. Block destructive commands, prevent secret leakage, keep agents inside project boundaries, detect loops, and more.
|
|
27
46
|
- **Custom Policies** - Write your own reliability rules in JavaScript. Use the `allow`/`deny`/`instruct` API to enforce conventions, prevent drift, gate operations, or integrate with external systems.
|
|
28
47
|
- **Easy Configuration** - Tune any policy without writing code. Set allowlists, protected branches, thresholds per-project or globally. Three-scope config merges automatically.
|
|
29
48
|
- **Agent Monitor** - See what your agents did while you were away. Browse sessions, inspect every tool call, and review exactly where policies fired.
|
|
@@ -258,7 +277,7 @@ FAILPROOFAI_TELEMETRY_DISABLED=1 failproofai
|
|
|
258
277
|
| Guide | Description |
|
|
259
278
|
|-------|-------------|
|
|
260
279
|
| [Getting Started](docs/getting-started.mdx) | Installation and first steps |
|
|
261
|
-
| [Built-in Policies](docs/built-in-policies.mdx) | All
|
|
280
|
+
| [Built-in Policies](docs/built-in-policies.mdx) | All 39 built-in policies with parameters |
|
|
262
281
|
| [Custom Policies](docs/custom-policies.mdx) | Write your own policies |
|
|
263
282
|
| [Configuration](docs/configuration.mdx) | Config file format and scope merging |
|
|
264
283
|
| [Dashboard](docs/dashboard.mdx) | Monitor sessions and review policy activity |
|
package/bin/failproofai.mjs
CHANGED
|
@@ -37,18 +37,24 @@ const args = process.argv.slice(2);
|
|
|
37
37
|
// Normalize 'p' → 'policies' (shorthand alias)
|
|
38
38
|
if (args[0] === "p") args[0] = "policies";
|
|
39
39
|
|
|
40
|
-
// --hook <event> — called by
|
|
41
|
-
// because it has its own exit code contract with
|
|
40
|
+
// --hook <event> [--cli <name>] — called by an agent CLI hook; fast path, outside
|
|
41
|
+
// runCli() because it has its own exit code contract with the calling agent.
|
|
42
42
|
const hookIdx = args.indexOf("--hook");
|
|
43
43
|
if (hookIdx >= 0) {
|
|
44
44
|
if (!args[hookIdx + 1]) {
|
|
45
45
|
console.error("Error: Missing event type after --hook");
|
|
46
|
-
console.error("Usage: failproofai --hook <event>
|
|
46
|
+
console.error("Usage: failproofai --hook <event> [--cli <claude|codex>]");
|
|
47
47
|
process.exit(1);
|
|
48
48
|
}
|
|
49
|
+
const eventType = args[hookIdx + 1];
|
|
50
|
+
const cliIdx = args.indexOf("--cli");
|
|
51
|
+
const cliArg = cliIdx >= 0 ? args[cliIdx + 1] : undefined;
|
|
52
|
+
// Default cli=claude preserves back-compat for hooks installed before
|
|
53
|
+
// multi-CLI support landed.
|
|
54
|
+
const cli = cliArg && (cliArg === "claude" || cliArg === "codex") ? cliArg : "claude";
|
|
49
55
|
try {
|
|
50
56
|
const { handleHookEvent } = await import("../src/hooks/handler");
|
|
51
|
-
const exitCode = await handleHookEvent(
|
|
57
|
+
const exitCode = await handleHookEvent(eventType, cli);
|
|
52
58
|
process.exit(exitCode);
|
|
53
59
|
} catch (err) {
|
|
54
60
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -94,14 +100,19 @@ COMMANDS
|
|
|
94
100
|
(no args) Launch the policy dashboard
|
|
95
101
|
|
|
96
102
|
policies, p List all available policies and their status
|
|
97
|
-
policies --install, -i Enable policies in
|
|
103
|
+
policies --install, -i Enable policies in agent CLI settings
|
|
98
104
|
[names...] Specific policy names to enable
|
|
105
|
+
--cli claude|codex Agent CLI(s) to install for; space-separated
|
|
106
|
+
(e.g. --cli claude codex) or repeated.
|
|
107
|
+
Default: detect installed CLIs and prompt.
|
|
99
108
|
--scope user|project|local Config scope to write to (default: user)
|
|
109
|
+
(Codex supports user|project only)
|
|
100
110
|
--beta Include beta policies
|
|
101
111
|
--custom, -c <path> Path to a JS file of custom policies
|
|
102
112
|
|
|
103
113
|
policies --uninstall, -u Disable policies or remove hooks
|
|
104
114
|
[names...] Specific policy names to disable
|
|
115
|
+
--cli claude|codex Agent CLI(s) to uninstall from
|
|
105
116
|
--scope user|project|local|all Config scope to remove from (default: user)
|
|
106
117
|
--beta Remove only beta policies
|
|
107
118
|
--custom, -c Clear the customPoliciesPath from config
|
|
@@ -126,9 +137,12 @@ EXAMPLES
|
|
|
126
137
|
failproofai policies
|
|
127
138
|
failproofai policies --install
|
|
128
139
|
failproofai policies --install block-sudo sanitize-api-keys --scope project
|
|
140
|
+
failproofai policies --install --cli codex --scope project
|
|
141
|
+
failproofai policies --install --cli claude codex
|
|
129
142
|
failproofai policies --install --custom ./my-policies.js
|
|
130
143
|
failproofai policies -i -c ./my-policies.js
|
|
131
144
|
failproofai policies --uninstall block-sudo
|
|
145
|
+
failproofai policies --uninstall --cli codex
|
|
132
146
|
failproofai policies --uninstall --custom
|
|
133
147
|
|
|
134
148
|
LINKS
|
|
@@ -167,13 +181,19 @@ USAGE
|
|
|
167
181
|
|
|
168
182
|
OPTIONS (install)
|
|
169
183
|
[names...] Specific policy names to enable (omit for interactive)
|
|
184
|
+
--cli claude|codex Agent CLI(s) to install for; space-separated
|
|
185
|
+
(e.g. --cli claude codex) or repeated. Omit to
|
|
186
|
+
detect installed CLIs and prompt (or auto-pick
|
|
187
|
+
if only one is found).
|
|
170
188
|
--scope user|project|local Config scope to write to (default: user)
|
|
189
|
+
(Codex supports user|project only)
|
|
171
190
|
--beta Include beta policies
|
|
172
191
|
--custom, -c <path> Path to a JS file of custom policies
|
|
173
192
|
(skips interactive prompt; validates file first)
|
|
174
193
|
|
|
175
194
|
OPTIONS (uninstall)
|
|
176
195
|
[names...] Specific policy names to disable (omit to remove hooks)
|
|
196
|
+
--cli claude|codex Agent CLI(s) to uninstall from
|
|
177
197
|
--scope user|project|local|all Config scope to remove from (default: user)
|
|
178
198
|
--beta Remove only beta policies
|
|
179
199
|
--custom, -c Clear the customPoliciesPath from config
|
|
@@ -182,9 +202,12 @@ EXAMPLES
|
|
|
182
202
|
failproofai policies
|
|
183
203
|
failproofai policies --install
|
|
184
204
|
failproofai policies --install block-sudo sanitize-api-keys
|
|
205
|
+
failproofai policies --install --cli codex --scope project
|
|
206
|
+
failproofai policies --install --cli claude codex
|
|
185
207
|
failproofai policies --install --custom ./my-policies.js
|
|
186
208
|
failproofai policies -i -c ./my-policies.js
|
|
187
209
|
failproofai policies --uninstall block-sudo
|
|
210
|
+
failproofai policies --uninstall --cli codex
|
|
188
211
|
failproofai policies -u
|
|
189
212
|
failproofai policies --uninstall --custom
|
|
190
213
|
`.trimStart());
|
|
@@ -193,6 +216,7 @@ EXAMPLES
|
|
|
193
216
|
|
|
194
217
|
if (isInstall) {
|
|
195
218
|
const { installHooks } = await import("../src/hooks/manager");
|
|
219
|
+
const { resolveTargetClis } = await import("../src/hooks/install-prompt");
|
|
196
220
|
|
|
197
221
|
const scopeIdx = subArgs.indexOf("--scope");
|
|
198
222
|
const scope = scopeIdx >= 0 ? subArgs[scopeIdx + 1] : "user";
|
|
@@ -211,15 +235,41 @@ EXAMPLES
|
|
|
211
235
|
throw new CliError("Missing path after --custom/-c\nUsage: --custom <path> (e.g. --custom ./my-policies.js)");
|
|
212
236
|
}
|
|
213
237
|
|
|
238
|
+
// --cli accepts one or more space-separated values, optionally repeated:
|
|
239
|
+
// --cli claude codex
|
|
240
|
+
// --cli claude --cli codex
|
|
241
|
+
// Values are consumed greedily until the next flag or end of argv.
|
|
242
|
+
const VALID_CLIS = new Set(["claude", "codex"]);
|
|
243
|
+
const cliFlagValues = [];
|
|
244
|
+
const cliConsumedIdxs = new Set();
|
|
245
|
+
const cliFlagIdxs = subArgs.map((a, i) => (a === "--cli" ? i : -1)).filter((i) => i >= 0);
|
|
246
|
+
for (const idx of cliFlagIdxs) {
|
|
247
|
+
let consumed = 0;
|
|
248
|
+
for (let j = idx + 1; j < subArgs.length; j++) {
|
|
249
|
+
const v = subArgs[j];
|
|
250
|
+
if (v.startsWith("-")) break;
|
|
251
|
+
// Stop at the first non-CLI token so a policy name following --cli
|
|
252
|
+
// (e.g. `--cli claude block-sudo`) is not mis-consumed as a CLI.
|
|
253
|
+
if (!VALID_CLIS.has(v)) break;
|
|
254
|
+
cliFlagValues.push(v);
|
|
255
|
+
cliConsumedIdxs.add(j);
|
|
256
|
+
consumed++;
|
|
257
|
+
}
|
|
258
|
+
if (consumed === 0) {
|
|
259
|
+
throw new CliError("Missing value(s) for --cli. Usage: --cli claude codex (or any subset)");
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
214
263
|
const includeBeta = subArgs.includes("--beta");
|
|
215
264
|
|
|
216
265
|
// Collect positional policy names — args that don't start with - and aren't
|
|
217
|
-
// values consumed by --scope
|
|
266
|
+
// values consumed by --scope, --custom/-c, or --cli (tracked by index, not value,
|
|
218
267
|
// so a policy named "user" isn't incorrectly dropped by the default scope).
|
|
219
268
|
const consumedIdxs = new Set();
|
|
220
269
|
if (scopeIdx >= 0) consumedIdxs.add(scopeIdx + 1);
|
|
221
270
|
if (customIdx >= 0) consumedIdxs.add(customIdx + 1);
|
|
222
|
-
const
|
|
271
|
+
for (const i of cliConsumedIdxs) consumedIdxs.add(i);
|
|
272
|
+
const flags = new Set(["--install", "-i", "--scope", "--beta", "--custom", "-c", "--cli"]);
|
|
223
273
|
const unknownInstallFlag = subArgs.find((a) => a.startsWith("-") && !flags.has(a));
|
|
224
274
|
if (unknownInstallFlag) {
|
|
225
275
|
throw new CliError(`Unknown flag: ${unknownInstallFlag}\nRun \`failproofai policies --help\` for usage.`);
|
|
@@ -237,6 +287,8 @@ EXAMPLES
|
|
|
237
287
|
: customPoliciesPath !== undefined ? []
|
|
238
288
|
: undefined;
|
|
239
289
|
|
|
290
|
+
const cli = await resolveTargetClis(cliFlagValues.length > 0 ? cliFlagValues : undefined);
|
|
291
|
+
|
|
240
292
|
await installHooks(
|
|
241
293
|
policyNames,
|
|
242
294
|
scope,
|
|
@@ -244,12 +296,15 @@ EXAMPLES
|
|
|
244
296
|
includeBeta,
|
|
245
297
|
undefined,
|
|
246
298
|
customPoliciesPath,
|
|
299
|
+
false,
|
|
300
|
+
cli,
|
|
247
301
|
);
|
|
248
302
|
process.exit(0);
|
|
249
303
|
}
|
|
250
304
|
|
|
251
305
|
if (isUninstall) {
|
|
252
306
|
const { removeHooks } = await import("../src/hooks/manager");
|
|
307
|
+
const { resolveTargetClis } = await import("../src/hooks/install-prompt");
|
|
253
308
|
|
|
254
309
|
const scopeIdx = subArgs.indexOf("--scope");
|
|
255
310
|
const scope = scopeIdx >= 0 ? subArgs[scopeIdx + 1] : "user";
|
|
@@ -260,12 +315,35 @@ EXAMPLES
|
|
|
260
315
|
throw new CliError(`Invalid scope: ${scope}. Valid values: user, project, local, all`);
|
|
261
316
|
}
|
|
262
317
|
|
|
318
|
+
// --cli accepts one or more space-separated values; same parser as install.
|
|
319
|
+
const VALID_CLIS = new Set(["claude", "codex"]);
|
|
320
|
+
const cliFlagValues = [];
|
|
321
|
+
const cliConsumedIdxs = new Set();
|
|
322
|
+
const cliFlagIdxs = subArgs.map((a, i) => (a === "--cli" ? i : -1)).filter((i) => i >= 0);
|
|
323
|
+
for (const idx of cliFlagIdxs) {
|
|
324
|
+
let consumed = 0;
|
|
325
|
+
for (let j = idx + 1; j < subArgs.length; j++) {
|
|
326
|
+
const v = subArgs[j];
|
|
327
|
+
if (v.startsWith("-")) break;
|
|
328
|
+
// Stop at the first non-CLI token so a policy name following --cli
|
|
329
|
+
// (e.g. `--cli claude block-sudo`) is not mis-consumed as a CLI.
|
|
330
|
+
if (!VALID_CLIS.has(v)) break;
|
|
331
|
+
cliFlagValues.push(v);
|
|
332
|
+
cliConsumedIdxs.add(j);
|
|
333
|
+
consumed++;
|
|
334
|
+
}
|
|
335
|
+
if (consumed === 0) {
|
|
336
|
+
throw new CliError("Missing value(s) for --cli. Usage: --cli claude codex (or any subset)");
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
263
340
|
const betaOnly = subArgs.includes("--beta");
|
|
264
341
|
const removeCustomHooks = subArgs.includes("--custom") || subArgs.includes("-c");
|
|
265
342
|
|
|
266
343
|
const consumedIdxs = new Set();
|
|
267
344
|
if (scopeIdx >= 0) consumedIdxs.add(scopeIdx + 1);
|
|
268
|
-
const
|
|
345
|
+
for (const i of cliConsumedIdxs) consumedIdxs.add(i);
|
|
346
|
+
const flags = new Set(["--uninstall", "-u", "--scope", "--beta", "--custom", "-c", "--cli"]);
|
|
269
347
|
const unknownUninstallFlag = subArgs.find((a) => a.startsWith("-") && !flags.has(a));
|
|
270
348
|
if (unknownUninstallFlag) {
|
|
271
349
|
throw new CliError(`Unknown flag: ${unknownUninstallFlag}\nRun \`failproofai policies --help\` for usage.`);
|
|
@@ -275,11 +353,13 @@ EXAMPLES
|
|
|
275
353
|
(a, idx) => !a.startsWith("-") && !consumedIdxs.has(idx)
|
|
276
354
|
);
|
|
277
355
|
|
|
356
|
+
const cli = await resolveTargetClis(cliFlagValues.length > 0 ? cliFlagValues : undefined);
|
|
357
|
+
|
|
278
358
|
await removeHooks(
|
|
279
359
|
policyNames.length > 0 ? policyNames : undefined,
|
|
280
360
|
scope,
|
|
281
361
|
undefined,
|
|
282
|
-
{ betaOnly, removeCustomHooks },
|
|
362
|
+
{ betaOnly, removeCustomHooks, cli },
|
|
283
363
|
);
|
|
284
364
|
process.exit(0);
|
|
285
365
|
}
|