PageSourceSearch

https://holostaff.ai/assets/cli-auth-BJMLW5Jk.js

js holostaff.ai collected 2026-10-05 12:02:19 UTC 10,214 bytes, 1 lines download raw bytes

1import{f as ee,D as te,au as ae,b as v,P as I,ai as b,_ as se,o as r,y as d,k as a,a as s,U as C,at as F,c as R,w as o,J as n,F as U,t as m,al as f,K as S,m as G,av as oe,aw as ne,ax as ie,r as le,B as re,C as ce,ay as ue,ao as de,az as me}from"./index-sEsPFBQ_.js";import{_ as pe}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{V as L}from"./VAlert-Pj3tY4Ul.js";import{a as T,V as N}from"./VCard-CD_qhowM.js";import{V as he,a as ve}from"./VAvatar-B3PDtCA_.js";import{V as fe}from"./VChip-CxVGu_8V.js";import"./createSimpleFunctional-C0WNriRo.js";var _e={VITE_BILLING_API_BASE_URL:"https://us-central1-holostaff-ai.cloudfunctions.net",VITE_STRIPE_PUBLISHABLE_KEY:"pk_live_51RRzMGRtupnKg4jFECrOD9hPoUHprZttaMRbxuAdF6laIfT6lV3dXex50N21dx8v2SmI5YYUCrNPNKM0ZPy18jqJ00DgzRV4aD",VITE_FIREBASE_DATABASE_URL:"https://holostaff-ai-default-rtdb.firebaseio.com",VITE_MICROSERVICE_URL:"https://holostaff-knowledge-service-1008066443043.us-central1.run.app",VITE_EMAIL_API_BASE_URL:"https://us-central1-holostaff-ai.cloudfunctions.net",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const c=A=>(re("data-v-c41e6c69"),A=A(),ce(),A),ye={class:"cli-auth-shell pa-6 pa-md-10"},ge={class:"cli-auth-card mx-auto"},xe={class:"text-center mb-6"},be=c(()=>a("h1",{class:"text-h4 font-weight-bold mb-2"},"Authorize Holostaff CLI",-1)),ke=c(()=>a("p",{class:"text-body-2 text-medium-emphasis mb-0"}," Your terminal asked for permission to connect to your workspace. ",-1)),we={key:0,class:"text-center py-6"},Ie=c(()=>a("strong",null,"This link is missing a code.",-1)),Ce=c(()=>a("code",null,"holostaff login",-1)),Re=c(()=>a("div",{class:"text-body-2 text-medium-emphasis"},"Code from your terminal",-1)),Se={class:"auth-code"},Ae=c(()=>a("p",{class:"text-body-2 text-medium-emphasis mb-4"}," Sign in to connect your terminal. New here? Your account and workspace are created in one step. ",-1)),Ve={class:"text-center text-body-2 text-medium-emphasis"},Ee=c(()=>a("div",{class:"d-flex align-center justify-space-between mb-1"},[a("span",{class:"text-body-2 text-medium-emphasis"},"Code from your terminal")],-1)),Ue={class:"auth-code"},Le=c(()=>a("div",{class:"text-caption text-medium-emphasis mt-2"}," Confirm this matches what you see in your terminal before authorizing. ",-1)),Te=c(()=>a("div",{class:"text-body-2 text-medium-emphasis mb-1"},"Approving as",-1)),Ne={class:"d-flex align-center"},Pe={class:"flex-grow-1 min-width-0"},ze={class:"text-body-1 font-weight-medium text-truncate"},Be={key:0,class:"text-caption text-medium-emphasis text-truncate"},$e=c(()=>a("div",{class:"text-caption text-medium-emphasis mt-2"}," This account will own the terminal session. On a shared computer, check it is yours. ",-1)),De={class:"text-body-2 text-medium-emphasis mb-1"},We={class:"d-flex align-center"},Oe={class:"text-body-1 font-weight-medium"},Me={key:0,class:"text-caption text-medium-emphasis mt-1"},je={key:1,class:"text-caption text-medium-emphasis mt-1"},Ye=c(()=>a("p",{class:"text-body-2 text-medium-emphasis mb-4"}," Authorizing connects your CLI to this workspace. The CLI will be able to scan your product, upload artifacts, and open instrumentation PRs on your behalf. ",-1)),Fe={class:"d-flex justify-end ga-2"},Ge={key:4,class:"text-center py-6"},He=c(()=>a("p",{class:"text-body-2 text-medium-emphasis mt-3 mb-0"},"Authorizing...",-1)),qe=c(()=>a("strong",null,"CLI authorized.",-1)),Je={class:"d-flex justify-end ga-2"},Ke=c(()=>a("strong",null,"Couldn't authorize:",-1)),Ze={class:"d-flex justify-end ga-2"}
1,Xe={__name:"cli-auth",setup(A){const H=ee(),P=te(),p=ae(),B=_e.VITE_BOWTIE_API_URL||"https://holostaff-vision-1008066443043.us-central1.run.app",i=v("loading"),z=v(null),_=v(null),k=v(null),y=I(()=>{const t=H.query.code;return typeof t=="string"?t:Array.isArray(t)?t[0]:null}),h=v(null),w=v(null),V=v(null),E=v(!1),g=I(()=>{const t=p.user||b.currentUser;return t?{email:t.email||"",name:t.displayName||"",photoURL:t.photoURL||""}:null}),$=I(()=>`/cli-auth?code=${encodeURIComponent(y.value||"")}`),x=I(()=>!h.value),q=I(()=>{var t;return((t=V.value)==null?void 0:t.suggestedWorkspaceName)||"My Workspace"});async function J(){try{const t=await fetch(`${B}/api/cli/auth/describe?code=${encodeURIComponent(y.value)}`);t.ok&&(V.value=await t.json())}catch{}}async function K(t){if(!t)return null;try{const e=await ue(de(me,`workspaces/${t}/name`)),u=e.exists()?e.val():null;return typeof u=="string"&&u.trim()?u.trim():null}catch{return null}}function D(){h.value=p.currentWorkspaceId||null,w.value=null,i.value="ready";const t=h.value;t&&K(t).then(e=>{h.value===t&&(w.value=e)})}async function Z(){E.value=!0;try{await p.logout()}catch{}finally{h.value=null,w.value=null,_.value=null,E.value=!1,i.value="signin"}}se(async()=>{if(!y.value){i.value="no_code";return}if(J(),p.authIsReady||await new Promise(t=>{const e=setInterval(()=>{p.authIsReady&&(clearInterval(e),t())},50)}),!p.user){i.value="signin";return}D()});async function W(t){_.value=null,k.value=t;try{await ie(b,t==="github"?oe:ne),b.currentUser&&await p.fetchCurrentUserDetails(b.currentUser.uid).catch(()=>{}),D()}catch(e){(e==null?void 0:e.code)==="auth/account-exists-with-different-credential"?_.value="An account already exists with this email. Sign in with the method you used before.":(e==null?void 0:e.code)==="auth/popup-closed-by-user"?_.value=null:_.value=(e==null?void 0:e.message)||"Sign-in failed. Please try again."}finally{k.value=null}}async function X(){if(y.value){i.value="confirming",z.value=null;try{const t=await b.currentUser.getIdToken(),e=await fetch(`${B}/api/cli/auth/confirm`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({code:y.value,workspaceId:h.value||void 0})}),u=await e.text();let l={};try{l=u?JSON.parse(u):{}}catch{l={error:u}}if(!e.ok)throw new Error(l.error||`${e.status} ${e.statusText}`);x.value&&b.currentUser&&(await p.fetchCurrentUserDetails(b.currentUser.uid).catch(()=>{}),h.value=l.workspaceId||p.currentWorkspaceId),i.value="approved"}catch(t){z.value=t.message,i.value="failed"}}}function Q(){P.push("/home")}return(t,e)=>{const u=le("RouterLink");return r(),d("section",ye,[a("div",ge,[a("div",xe,[s(C,{icon:"mdi-console-line",size:"48",color:"primary",class:"mb-3"}),be,ke]),i.value==="loading"?(r(),d("div",we,[s(F,{indeterminate:"",color:"primary"})])):i.value==="no_code"?(r(),R(L,{key:1,type:"error",variant:"tonal",class:"mb-4"},{default:o(()=>[Ie,n(" Try running "),Ce,n(" in your terminal again — it'll generate a fresh URL. ")]),_:1})):i.value==="signin"?(r(),d(U,{key:2},[s(N,{variant:"outlined",class:"mb-4"},{default:o(()=>[s(T,{class:"py-4"},{default:o(()=>[Re,a("div",Se,m(y.value),1)]),_:1})]),_:1}),Ae,s(f,{block:"",color:"#24292f",class:"mb-3 text-white",loading:k.value==="github",disabled:!!k.value,onClick:e[0]||(e[0]=l=>W("github"))},{default:o(()=>[s(C,{start:"",icon:"bxl-github"}),n(" Continue with GitHub ")]),_:1},8,["loading","disabled"]),s(f,{block:"",variant:"outlined",class:"mb-4",loading:k.value==="google",disabled:!!k.value,onClick:e[1]||(e[1]=l=>W("google"))},{default:o(()=>[s(C,{start:"",icon:"bxl-google"}),n(" Continue with Google ")]),_:1},8,["loading","disabled"]),_.value?(r(),R(L,{key:0,type:"error",variant:"tonal",class:"mb-4"},{default:o(()=>[n(m(_.value),1)]),_:1})):S("",!0),a("div",Ve,[n(" Prefer email? "),s(u,{to:{path:"/login",query:{to:$.value}}},{default:o(()=>[n("Sign in")]),_:1},8,["to"]),n(" · "),s(u,{to:{path:"/register",query:{to:$.value}}},{default:o(()=>[n("Create an account")]),_:1},8,["to"])])],64)):i.value==="ready"?(r(),d(U,{key:3},[s(N,{variant:"outlined",class:"mb-4"},{default:o(()=>[s(T,{class:"py-4"},{default:o(()=>[Ee,a("div",Ue,m(y.value),1),Le]),_:1})]),_:1}),Te,s(N,{variant:"outlined",class:"mb-4"},{default:o(()=>[s(T,{class:"py-3"},{default:o(()=>{var l,O,M,j;return[a("div",Ne,[s(he,{size:"32",class:"me-3",color:"primary",variant:"tonal"},{default:o(()=>{var Y;return[(Y=g.value)!=null&&Y.photoURL?(r(),R(ve,{key:0,src:g.value.photoURL},null,8,["src"])):(r(),R(C,{key:1,icon:"mdi-account"}))]}),_:1}),a("div",Pe,[a("div",ze,m(((l=g.value)==null?void 0:l.email)||((O=g.value)==null?void 0:O.name)||"Signed-in account"),1),(M=g.value)!=null&&M.name&&((j=g.value)!=null&&j.email)?(r(),d("div",Be,m(g.value.name),1)):S("",!0)]),s(f,{variant:"text",size:"small",loading:E.value,disabled:E.value,onClick:Z},{default:o(()=>[n(" Not you? Switch account ")]),_:1},8,["loading","disabled"])]),$e]}),_:1})]),_:1}),a("div",De,m(x.value?"Your new workspace":"Connecting to workspace"),1),s(N,{variant:"outlined",class:"mb-6"},{default:o(()=>[s(T,{class:"py-3"},{default:o(()=>{var l;return[a("div",We,[s(C,{icon:x.value?"mdi-domain-plus":"mdi-domain",class:"mr-2"},null,8,["icon"]),a("span",Oe,m(x.value?q.value:w.value||h.value),1),x.value?(r(),R(fe,{key:0,size:"x-small",color:"primary",class:"ml-2"},{default:o(()=>[n(" created on authorize ")]),_:1})):S("",!0)]),x.value&&((l=V.value)!=null&&l.repoName)?(r(),d("div",Me," Named after your repository: "+m(V.value.repoName),1)):!x.value&&w.value?(r(),d("div",je," Workspace id: "+m(h.value),1)):S("",!0)]}),_:1})]),_:1}),Ye,a("div",Fe,[s(f,{variant:"text",onClick:e[2]||(e[2]=l=>G(P).push("/"))},{default:o(()=>[n("Cancel")]),_:1}
1),s(f,{color:"primary","prepend-icon":"mdi-check",onClick:X},{default:o(()=>[n(" Authorize CLI ")]),_:1})])],64)):i.value==="confirming"?(r(),d("div",Ge,[s(F,{indeterminate:"",color:"primary"}),He])):i.value==="approved"?(r(),d(U,{key:5},[s(L,{type:"success",variant:"tonal",class:"mb-4"},{default:o(()=>[qe,n(" You can close this tab — your terminal should have picked up the credentials within a couple of seconds. ")]),_:1}),a("div",Je,[s(f,{variant:"text",onClick:Q},{default:o(()=>[n("Go to my workspace")]),_:1})])],64)):i.value==="failed"?(r(),d(U,{key:6},[s(L,{type:"error",variant:"tonal",class:"mb-4"},{default:o(()=>[Ke,n(" "+m(z.value),1)]),_:1}),a("div",Ze,[s(f,{variant:"text",onClick:e[3]||(e[3]=l=>G(P).push("/"))},{default:o(()=>[n("Cancel")]),_:1}),s(f,{color:"primary",onClick:e[4]||(e[4]=l=>i.value="ready")},{default:o(()=>[n("Try again")]),_:1})])],64)):S("",!0)])])}}},it=pe(Xe,[["__scopeId","data-v-c41e6c69"]]);export{it as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.