import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./figures-gfT9mM8P.js";import{F as i,Q as a,Rn as o,T as s,b as c,f as l,g as u,h as d,nt as f,t as p,tn as m,tt as h,v as g,x as _}from"./src-Di342QoJ.js";import{t as v}from"./jsx-runtime-D-D469L8.js";import{Cc as y,Mn as b,Vt as x,cn as S,on as C,yc as ee}from"./paths-Ci1iwL5Y.js";import{n as w,r as T}from"./analytics-DqMQntaB.js";import{l as E,v as te}from"./git-C0IuvuIy.js";import{r as ne,t as re}from"./execa-CGue6Z3n.js";import{o as ie,s as D}from"./log-DSV4Ht5l.js";import{r as ae,t as O}from"./execFileNoThrow-azCkYhmF.js";import{l as oe,o as se}from"./stringUtils-KZoO4GUd.js";import{$T as ce,By as le,DC as ue,EC as de,Hy as fe,Jy as pe,Ky as k,Vy as me,aS as he,dS as A,eE as ge,fS as j}from"./loadAgentsDir-C_wFhytF.js";import{n as _e,t as ve}from"./browser-Bt-ckCaU.js";import{t as M}from"./useKeybinding-DPOUuymz.js";import{t as N}from"./useTerminalSize-Du-EamDN.js";import{n as ye,t as be}from"./useExitOnCtrlCDWithKeybindings-BHi41Ku_.js";function xe(e){return e.pending?(0,F.jsxs)(c,{children:[`Press `,e.keyName,` again to exit`]}):(0,F.jsxs)(d,{children:[(0,F.jsx)(u,{shortcut:`↑↓`,action:`navigate`}),(0,F.jsx)(u,{shortcut:`Space`,action:`toggle`}),(0,F.jsx)(u,{shortcut:`Enter`,action:`confirm`}),(0,F.jsx)(de,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}function Se({onSubmit:e,defaultSelections:t}){let[n,r]=(0,P.useState)(!1),i=(0,P.useCallback)(t=>{if(t.length===0){r(!0);return}r(!1),e(t)},[e]),o=(0,P.useCallback)(()=>{r(!1)},[]),s=(0,P.useCallback)(()=>{r(!0)},[]);return(0,F.jsxs)(l,{title:`Select GitHub workflows to install`,subtitle:`We'll create a workflow file in your repository for each one you select.`,onCancel:s,inputGuide:xe,children:[(0,F.jsx)(_,{children:(0,F.jsxs)(c,{dimColor:!0,children:[`More workflow examples (issue triage, CI fixes, etc.) at:`,` `,(0,F.jsx)(a,{url:`https://github.com/anthropics/claude-code-action/blob/main/examples/`,children:`https://github.com/anthropics/claude-code-action/blob/main/examples/`})]})}),(0,F.jsx)(me,{options:Ce.map(e=>({label:e.label,value:e.value})),defaultValue:t,onSubmit:i,onChange:o,onCancel:s,hideIndexes:!0}),n&&(0,F.jsx)(_,{children:(0,F.jsx)(c,{color:`error`,children:`You must select at least one workflow to continue`})})]})}var P,F,Ce,we=e((()=>{P=t(o(),1),p(),ue(),fe(),F=v(),Ce=[{value:`claude`,label:`@Claude Code - Tag @claude in issues and PR comments`},{value:`claude-review`,label:`Claude Code Review - Automated code review on new PRs`}]})),Te,I,Ee,De,Oe,L=e((()=>{Te=`Add Claude Code GitHub Workflow`,I=`https://github.com/anthropics/claude-code-action/blob/main/docs/setup.md`,Ee=`name: Claude Code

on:
  issue_comment:
    types: [created]
  pull_request_review_comment:
    types: [created]
  issues:
    types: [opened, assigned]
  pull_request_review:
    types: [submitted]

jobs:
  claude:
    if: |
      (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
      (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
      (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
      (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: read
      issues: read
      id-token: write
      actions: read # Required for Claude to read CI results on PRs
    steps:
      - name: Checkout repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2, 2026-04-25
        with:
          fetch-depth: 1

      - name: Run Claude Code
        id: claude
        uses: anthropics/claude-code-action@567fe954a4527e81f132d87d1bdbcc94f7737434 # v1, 2026-04-25
        with:
          anthropic_api_key: \${{ secrets.ANTHROPIC_API_KEY }}

          # This is an optional setting that allows Claude to read CI results on PRs
          additional_permissions: |
            actions: read

          # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
          # prompt: 'Update the pull request description to include a summary of changes.'

          # Optional: Add claude_args to customize behavior and configuration
          # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
          # or https://code.claude.com/docs/en/cli-reference for available options
          # claude_args: '--allowed-tools Bash(gh pr:*)'

`,De=`## 🤖 Installing Claude Code GitHub App

This PR adds a GitHub Actions workflow that enables Claude Code integration in our repository.

### What is Claude Code?

[Claude Code](https://claude.com/claude-code) is an AI coding agent that can help with:
- Bug fixes and improvements  
- Documentation updates
- Implementing new features
- Code reviews and suggestions
- Writing tests
- And more!

### How it works

Once this PR is merged, we'll be able to interact with Claude by mentioning @claude in a pull request or issue comment.
Once the workflow is triggered, Claude will analyze the comment and surrounding context, and execute on the request in a GitHub action.

### Important Notes

- **This workflow won't take effect until this PR is merged**
- **@claude mentions won't work until after the merge is complete**
- The workflow runs automatically whenever Claude is mentioned in PR or issue comments
- Claude gets access to the entire PR or issue context including files, diffs, and previous comments

### Security

- Our Anthropic API key is securely stored as a GitHub Actions secret
- Only users with write access to the repository can trigger the workflow
- All Claude runs are stored in the GitHub Actions run history
- Claude's default tools are limited to reading/writing files and interacting with our repo by creating comments, branches, and commits.
- We can add more allowed tools by adding them to the workflow file like:

\`\`\`
allowed_tools: Bash(npm install),Bash(npm run build),Bash(npm run lint),Bash(npm run test)
\`\`\`

There's more information in the [Claude Code action repo](https://github.com/anthropics/claude-code-action).

After merging this PR, let's try mentioning @claude in a comment on any PR to get started!`,Oe=`name: Claude Code Review

on:
  pull_request:
    types: [opened, synchronize, ready_for_review, reopened]
    # Optional: Only run on specific file changes
    # paths:
    #   - "src/**/*.ts"
    #   - "src/**/*.tsx"
    #   - "src/**/*.js"
    #   - "src/**/*.jsx"

jobs:
  claude-review:
    # Optional: Filter by PR author
    # if: |
    #   github.event.pull_request.user.login == 'external-contributor' ||
    #   github.event.pull_request.user.login == 'new-developer' ||
    #   github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'

    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: read
      issues: read
      id-token: write

    steps:
      - name: Checkout repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2, 2026-04-25
        with:
          fetch-depth: 1

      - name: Run Claude Code Review
        id: claude-review
        uses: anthropics/claude-code-action@567fe954a4527e81f132d87d1bdbcc94f7737434 # v1, 2026-04-25
        with:
          anthropic_api_key: \${{ secrets.ANTHROPIC_API_KEY }}
          plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
          plugins: 'code-review@claude-code-plugins'
          prompt: '/code-review:code-review \${{ github.repository }}/pull/\${{ github.event.pull_request.number }}'
          # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
          # or https://code.claude.com/docs/en/cli-reference for available options

`}));function ke({existingApiKey:e,apiKeyOrOAuthToken:t,onApiKeyChange:n,onSubmit:r,onToggleUseExistingKey:a,onCreateOAuthToken:o,selectedOption:l=e?`existing`:o?`oauth`:`new`,onSelectOption:u}){let[d,p]=(0,R.useState)(0),m=i(),[h]=s(),v=(0,R.useCallback)(()=>{l===`new`&&o?u?.(`oauth`):l===`oauth`&&e&&(u?.(`existing`),a(!0))},[l,o,e,u,a]),y=(0,R.useCallback)(()=>{l===`existing`?(u?.(o?`oauth`:`new`),a(!1)):l===`oauth`&&u?.(`new`)},[l,o,u,a]),b=(0,R.useCallback)(()=>{l===`oauth`&&o?o():r()},[l,o,r]),x=l===`new`;return f({"confirm:previous":v,"confirm:next":y,"confirm:yes":b},{context:`Confirmation`,isActive:!x}),f({"confirm:previous":v,"confirm:next":y},{context:`Confirmation`,isActive:x}),(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(_,{flexDirection:`column`,borderStyle:`round`,paddingX:1,children:[(0,z.jsxs)(_,{flexDirection:`column`,marginBottom:1,children:[(0,z.jsx)(c,{bold:!0,children:`Install GitHub App`}),(0,z.jsx)(c,{dimColor:!0,children:`Choose API key`})]}),e&&(0,z.jsx)(_,{marginBottom:1,children:(0,z.jsxs)(c,{children:[l===`existing`?g(`success`,h)(`> `):`  `,`Use your existing Claude Code API key`]})}),o&&(0,z.jsx)(_,{marginBottom:1,children:(0,z.jsxs)(c,{children:[l===`oauth`?g(`success`,h)(`> `):`  `,`Create a long-lived token with your Claude subscription`]})}),(0,z.jsx)(_,{marginBottom:1,children:(0,z.jsxs)(c,{children:[l===`new`?g(`success`,h)(`> `):`  `,`Enter a new API key`]})}),l===`new`&&(0,z.jsx)(A,{value:t,onChange:n,onSubmit:r,onPaste:n,focus:!0,placeholder:`sk-ant… (Create a new key at https://platform.claude.com/settings/keys)`,mask:`*`,columns:m.columns,cursorOffset:d,onChangeCursorOffset:p,showCursor:!0})]}),(0,z.jsx)(_,{marginLeft:3,children:(0,z.jsx)(c,{dimColor:!0,children:`↑/↓ to select · Enter to continue`})})]})}var R,z,Ae=e((()=>{R=t(o(),1),j(),N(),p(),M(),z=v()}));function je({useExistingSecret:e,secretName:t,onToggleUseExistingSecret:n,onSecretNameChange:r,onSubmit:a}){let[o,l]=(0,B.useState)(0),u=i(),[d]=s(),p=(0,B.useCallback)(()=>n(!0),[n]),m=(0,B.useCallback)(()=>n(!1),[n]);return f({"confirm:previous":p,"confirm:next":m,"confirm:yes":a},{context:`Confirmation`,isActive:e}),f({"confirm:previous":p,"confirm:next":m},{context:`Confirmation`,isActive:!e}),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(_,{flexDirection:`column`,borderStyle:`round`,paddingX:1,children:[(0,V.jsxs)(_,{flexDirection:`column`,marginBottom:1,children:[(0,V.jsx)(c,{bold:!0,children:`Install GitHub App`}),(0,V.jsx)(c,{dimColor:!0,children:`Setup API key secret`})]}),(0,V.jsx)(_,{marginBottom:1,children:(0,V.jsx)(c,{color:`warning`,children:`ANTHROPIC_API_KEY already exists in repository secrets!`})}),(0,V.jsx)(_,{marginBottom:1,children:(0,V.jsx)(c,{children:`Would you like to:`})}),(0,V.jsx)(_,{marginBottom:1,children:(0,V.jsxs)(c,{children:[e?g(`success`,d)(`> `):`  `,`Use the existing API key`]})}),(0,V.jsx)(_,{marginBottom:1,children:(0,V.jsxs)(c,{children:[e?`  `:g(`success`,d)(`> `),`Create a new secret with a different name`]})}),!e&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(_,{marginBottom:1,children:(0,V.jsx)(c,{children:`Enter new secret name (alphanumeric with underscores):`})}),(0,V.jsx)(A,{value:t,onChange:r,onSubmit:a,focus:!0,placeholder:`e.g., CLAUDE_API_KEY`,columns:u.columns,cursorOffset:o,onChangeCursorOffset:l,showCursor:!0})]})]}),(0,V.jsx)(_,{marginLeft:3,children:(0,V.jsx)(c,{dimColor:!0,children:`↑/↓ to select · Enter to continue`})})]})}var B,V,Me=e((()=>{B=t(o(),1),j(),N(),p(),M(),V=v()}));function Ne(){return(0,Pe.jsx)(c,{children:`Checking GitHub CLI installation…`})}var Pe,Fe=e((()=>{p(),Pe=v()}));function Ie({currentRepo:e,useCurrentRepo:t,repoUrl:n,onRepoUrlChange:r,onSubmit:a,onToggleUseCurrentRepo:o}){let[s,l]=(0,H.useState)(0),[u,d]=(0,H.useState)(!1),p=i().columns,m=(0,H.useCallback)(()=>{if(!(t?e:n)?.trim()){d(!0);return}a()},[t,e,n,a]),h=!t||!e,g=(0,H.useCallback)(()=>{o(!0),d(!1)},[o]),v=(0,H.useCallback)(()=>{o(!1),d(!1)},[o]);return f({"confirm:previous":g,"confirm:next":v,"confirm:yes":m},{context:`Confirmation`,isActive:!h}),f({"confirm:previous":g,"confirm:next":v},{context:`Confirmation`,isActive:h}),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(_,{flexDirection:`column`,borderStyle:`round`,paddingX:1,children:[(0,U.jsxs)(_,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsx)(c,{bold:!0,children:`Install GitHub App`}),(0,U.jsx)(c,{dimColor:!0,children:`Select GitHub repository`})]}),e&&(0,U.jsx)(_,{marginBottom:1,children:(0,U.jsxs)(c,{bold:t,color:t?`permission`:void 0,children:[t?`> `:`  `,`Use current repository: `,e]})}),(0,U.jsx)(_,{marginBottom:1,children:(0,U.jsxs)(c,{bold:!t||!e,color:!t||!e?`permission`:void 0,children:[!t||!e?`> `:`  `,e?`Enter a different repository`:`Enter repository`]})}),(!t||!e)&&(0,U.jsx)(_,{marginLeft:2,marginBottom:1,children:(0,U.jsx)(A,{value:n,onChange:e=>{r(e),d(!1)},onSubmit:m,focus:!0,placeholder:`Enter a repo as owner/repo or https://github.com/owner/repo…`,columns:p,cursorOffset:s,onChangeCursorOffset:l,showCursor:!0})})]}),u&&(0,U.jsx)(_,{marginLeft:3,marginBottom:1,children:(0,U.jsx)(c,{color:`error`,children:`Please enter a repository name to continue`})}),(0,U.jsx)(_,{marginLeft:3,children:(0,U.jsxs)(c,{dimColor:!0,children:[e?`↑/↓ to select · `:``,`Enter to continue`]})})]})}var H,U,Le=e((()=>{H=t(o(),1),j(),N(),p(),M(),U=v()}));function Re({currentWorkflowInstallStep:e,secretExists:t,useExistingSecret:n,secretName:r,skipWorkflow:i=!1,selectedWorkflows:a}){let o=i?[`Getting repository information`,t&&n?`Using existing API key secret`:`Setting up ${r} secret`]:[`Getting repository information`,`Creating branch`,a.length>1?`Creating workflow files`:`Creating workflow file`,t&&n?`Using existing API key secret`:`Setting up ${r} secret`,`Opening pull request page`];return(0,W.jsx)(W.Fragment,{children:(0,W.jsxs)(_,{flexDirection:`column`,borderStyle:`round`,paddingX:1,children:[(0,W.jsxs)(_,{flexDirection:`column`,marginBottom:1,children:[(0,W.jsx)(c,{bold:!0,children:`Install GitHub App`}),(0,W.jsx)(c,{dimColor:!0,children:`Create GitHub Actions workflow`})]}),o.map((t,n)=>{let r=`pending`;return n<e?r=`completed`:n===e&&(r=`in-progress`),(0,W.jsx)(_,{children:(0,W.jsxs)(c,{color:r===`completed`?`success`:r===`in-progress`?`warning`:void 0,children:[r===`completed`?`✓ `:``,t,r===`in-progress`?`…`:``]})},n)})]})})}var W,ze=e((()=>{p(),W=v()}));function Be({error:e,errorReason:t,errorInstructions:n}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(_,{flexDirection:`column`,borderStyle:`round`,paddingX:1,children:[(0,G.jsx)(_,{flexDirection:`column`,marginBottom:1,children:(0,G.jsx)(c,{bold:!0,children:`Install GitHub App`})}),(0,G.jsxs)(c,{color:`error`,children:[`Error: `,e]}),t&&(0,G.jsx)(_,{marginTop:1,children:(0,G.jsxs)(c,{dimColor:!0,children:[`Reason: `,t]})}),n&&n.length>0&&(0,G.jsxs)(_,{flexDirection:`column`,marginTop:1,children:[(0,G.jsx)(c,{dimColor:!0,children:`How to fix:`}),n.map((e,t)=>(0,G.jsxs)(_,{marginLeft:2,children:[(0,G.jsx)(c,{dimColor:!0,children:`• `}),(0,G.jsx)(c,{children:e})]},t))]}),(0,G.jsx)(_,{marginTop:1,children:(0,G.jsxs)(c,{dimColor:!0,children:[`For manual setup instructions, see: `,(0,G.jsx)(c,{color:`claude`,children:I})]})})]}),(0,G.jsx)(_,{marginLeft:3,children:(0,G.jsx)(c,{dimColor:!0,children:`Press any key to exit`})})]})}var G,Ve=e((()=>{L(),p(),G=v()}));function He({repoName:e,onSelectAction:t}){return(0,K.jsxs)(_,{flexDirection:`column`,borderStyle:`round`,borderDimColor:!0,paddingX:1,children:[(0,K.jsxs)(_,{flexDirection:`column`,marginBottom:1,children:[(0,K.jsx)(c,{bold:!0,children:`Existing Workflow Found`}),(0,K.jsxs)(c,{dimColor:!0,children:[`Repository: `,e]})]}),(0,K.jsxs)(_,{flexDirection:`column`,marginBottom:1,children:[(0,K.jsxs)(c,{children:[`A Claude workflow file already exists at `,(0,K.jsx)(c,{color:`claude`,children:`.github/workflows/claude.yml`})]}),(0,K.jsx)(c,{dimColor:!0,children:`What would you like to do?`})]}),(0,K.jsx)(_,{flexDirection:`column`,children:(0,K.jsx)(he,{options:[{label:`Update workflow file with latest version`,value:`update`},{label:`Skip workflow update (configure secrets only)`,value:`skip`},{label:`Exit without making changes`,value:`exit`}],onChange:e=>{t(e)},onCancel:()=>{t(`exit`)}})}),(0,K.jsx)(_,{marginTop:1,children:(0,K.jsxs)(c,{dimColor:!0,children:[`View the latest workflow template at:`,` `,(0,K.jsx)(c,{color:`claude`,children:`https://github.com/anthropics/claude-code-action/blob/main/examples/claude.yml`})]})})]})}var K,Ue=e((()=>{le(),p(),K=v()}));function We({repoUrl:e,onSubmit:t}){return h(`confirm:yes`,t,{context:`Confirmation`}),(0,q.jsxs)(_,{flexDirection:`column`,borderStyle:`round`,borderDimColor:!0,paddingX:1,children:[(0,q.jsx)(_,{flexDirection:`column`,marginBottom:1,children:(0,q.jsx)(c,{bold:!0,children:`Install the Claude GitHub App`})}),(0,q.jsx)(_,{marginBottom:1,children:(0,q.jsx)(c,{children:`Opening browser to install the Claude GitHub App…`})}),(0,q.jsx)(_,{marginBottom:1,children:(0,q.jsx)(c,{children:`If your browser doesn't open automatically, visit:`})}),(0,q.jsx)(_,{marginBottom:1,children:(0,q.jsx)(c,{underline:!0,children:`https://github.com/apps/claude`})}),(0,q.jsx)(_,{marginBottom:1,children:(0,q.jsxs)(c,{children:[`Please install the app for repository: `,(0,q.jsx)(c,{bold:!0,children:e})]})}),(0,q.jsx)(_,{marginBottom:1,children:(0,q.jsx)(c,{dimColor:!0,children:`Important: Make sure to grant access to this specific repository`})}),(0,q.jsx)(_,{children:(0,q.jsxs)(c,{bold:!0,color:`permission`,children:[`Press Enter once you've installed the app`,r.ellipsis]})}),(0,q.jsx)(_,{marginTop:1,children:(0,q.jsxs)(c,{dimColor:!0,children:[`Having trouble? See manual setup instructions at: `,(0,q.jsx)(c,{color:`claude`,children:I})]})})]})}var q,Ge=e((()=>{n(),L(),p(),M(),q=v()}));function Ke({onSuccess:e,onCancel:t}){let[n,r]=(0,J.useState)({state:`starting`}),[o]=(0,J.useState)(()=>new ce),[s,l]=(0,J.useState)(``),[d,f]=(0,J.useState)(0),[p,h]=(0,J.useState)(!1),[g,v]=(0,J.useState)(!1),y=(0,J.useRef)(new Set),x=(0,J.useRef)(void 0),S=i(),C=Math.max(50,S.columns-30-4);function ee(e){n.state===`error`&&(e.preventDefault(),e.key===`return`&&n.toRetry?(l(``),f(0),r({state:`about_to_retry`,nextState:n.toRetry})):t())}async function w(e,t){try{let[n,i]=e.split(`#`);if(!n||!i){r({state:`error`,message:`Invalid code. Please make sure the full code was copied`,toRetry:{state:`waiting_for_login`,url:t}});return}T(`tengu_oauth_manual_entry`,{}),o.handleManualAuthCodeInput({authorizationCode:n,state:i})}catch(e){D(e),r({state:`error`,message:e.message,toRetry:{state:`waiting_for_login`,url:t}})}}let E=(0,J.useCallback)(async()=>{y.current.forEach(e=>clearTimeout(e)),y.current.clear();try{let t=await o.startOAuthFlow(async e=>{r({state:`waiting_for_login`,url:e});let t=setTimeout(h,3e3,!0);y.current.add(t)},{loginWithClaudeAi:!0,inferenceOnly:!0,expiresIn:365*24*60*60});r({state:`processing`}),b(t);let n=setTimeout((e,t,n,r)=>{e({state:`success`,token:t});let i=setTimeout(n,1e3,t);r.current.add(i)},100,r,t.accessToken,e,y);y.current.add(n)}catch(e){let t=e.message;r({state:`error`,message:t,toRetry:{state:`starting`}}),D(e),T(`tengu_oauth_error`,{error:t})}},[o,e]);(0,J.useEffect)(()=>{n.state===`starting`&&E()},[n.state,E]),(0,J.useEffect)(()=>{if(n.state===`about_to_retry`){let e=setTimeout((e,t,n)=>{t(e.state===`waiting_for_login`),n(e)},500,n.nextState,h,r);y.current.add(e)}},[n]),(0,J.useEffect)(()=>{s===`c`&&n.state===`waiting_for_login`&&p&&!g&&(m(n.url).then(e=>{e&&process.stdout.write(e),v(!0),clearTimeout(x.current),x.current=setTimeout(v,2e3,!1)}),l(``))},[s,n,p,g]),(0,J.useEffect)(()=>{let e=y.current;return()=>{o.cleanup(),e.forEach(e=>clearTimeout(e)),e.clear(),clearTimeout(x.current)}},[o]);function te(){switch(n.state){case`starting`:return(0,Y.jsxs)(_,{children:[(0,Y.jsx)(k,{}),(0,Y.jsx)(c,{children:`Starting authentication…`})]});case`waiting_for_login`:return(0,Y.jsxs)(_,{flexDirection:`column`,gap:1,children:[!p&&(0,Y.jsxs)(_,{children:[(0,Y.jsx)(k,{}),(0,Y.jsx)(c,{children:`Opening browser to sign in with your Claude account…`})]}),p&&(0,Y.jsxs)(_,{children:[(0,Y.jsx)(c,{children:qe}),(0,Y.jsx)(A,{value:s,onChange:l,onSubmit:e=>w(e,n.url),cursorOffset:d,onChangeCursorOffset:f,columns:C})]})]});case`processing`:return(0,Y.jsxs)(_,{children:[(0,Y.jsx)(k,{}),(0,Y.jsx)(c,{children:`Processing authentication…`})]});case`success`:return(0,Y.jsxs)(_,{flexDirection:`column`,gap:1,children:[(0,Y.jsx)(c,{color:`success`,children:`✓ Authentication token created successfully!`}),(0,Y.jsx)(c,{dimColor:!0,children:`Using token for GitHub Actions setup…`})]});case`error`:return(0,Y.jsxs)(_,{flexDirection:`column`,gap:1,children:[(0,Y.jsxs)(c,{color:`error`,children:[`OAuth error: `,n.message]}),n.toRetry?(0,Y.jsx)(c,{dimColor:!0,children:`Press Enter to try again, or any other key to cancel`}):(0,Y.jsx)(c,{dimColor:!0,children:`Press any key to return to API key selection`})]});case`about_to_retry`:return(0,Y.jsx)(_,{flexDirection:`column`,gap:1,children:(0,Y.jsx)(c,{color:`permission`,children:`Retrying…`})});default:return null}}return(0,Y.jsxs)(_,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:ee,children:[n.state===`starting`&&(0,Y.jsxs)(_,{flexDirection:`column`,gap:1,paddingBottom:1,children:[(0,Y.jsx)(c,{bold:!0,children:`Create Authentication Token`}),(0,Y.jsx)(c,{dimColor:!0,children:`Creating a long-lived token for GitHub Actions`})]}),n.state!==`success`&&n.state!==`starting`&&n.state!==`processing`&&(0,Y.jsxs)(_,{flexDirection:`column`,gap:1,paddingBottom:1,children:[(0,Y.jsx)(c,{bold:!0,children:`Create Authentication Token`}),(0,Y.jsx)(c,{dimColor:!0,children:`Creating a long-lived token for GitHub Actions`})]},`header`),n.state===`waiting_for_login`&&p&&(0,Y.jsxs)(_,{flexDirection:`column`,gap:1,paddingBottom:1,children:[(0,Y.jsxs)(_,{paddingX:1,children:[(0,Y.jsx)(c,{dimColor:!0,children:`Browser didn't open? Use the url below to sign in `}),g?(0,Y.jsx)(c,{color:`success`,children:`(Copied!)`}):(0,Y.jsx)(c,{dimColor:!0,children:(0,Y.jsx)(u,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,Y.jsx)(a,{url:n.url,children:(0,Y.jsx)(c,{dimColor:!0,children:n.url})})]},`urlToCopy`),(0,Y.jsx)(_,{paddingLeft:1,flexDirection:`column`,gap:1,children:te()})]})}var J,Y,qe,Je=e((()=>{J=t(o(),1),w(),p(),pe(),j(),N(),ge(),C(),ie(),Y=v(),qe=`Paste code here if prompted > `}));function Ye({secretExists:e,useExistingSecret:t,secretName:n,skipWorkflow:r=!1}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(_,{flexDirection:`column`,borderStyle:`round`,paddingX:1,children:[(0,X.jsxs)(_,{flexDirection:`column`,marginBottom:1,children:[(0,X.jsx)(c,{bold:!0,children:`Install GitHub App`}),(0,X.jsx)(c,{dimColor:!0,children:`Success`})]}),!r&&(0,X.jsx)(c,{color:`success`,children:`✓ GitHub Actions workflow created!`}),e&&t&&(0,X.jsx)(_,{marginTop:1,children:(0,X.jsx)(c,{color:`success`,children:`✓ Using existing ANTHROPIC_API_KEY secret`})}),(!e||!t)&&(0,X.jsx)(_,{marginTop:1,children:(0,X.jsxs)(c,{color:`success`,children:[`✓ API key saved as `,n,` secret`]})}),(0,X.jsx)(_,{marginTop:1,children:(0,X.jsx)(c,{children:`Next steps:`})}),r?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(c,{children:`1. Install the Claude GitHub App if you haven't already`}),(0,X.jsx)(c,{children:`2. Your workflow file was kept unchanged`}),(0,X.jsx)(c,{children:`3. API key is configured and ready to use`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(c,{children:`1. A pre-filled PR page has been created`}),(0,X.jsx)(c,{children:`2. Install the Claude GitHub App if you haven't already`}),(0,X.jsx)(c,{children:`3. Merge the PR to enable Claude PR assistance`})]})]}),(0,X.jsx)(_,{marginLeft:3,children:(0,X.jsx)(c,{dimColor:!0,children:`Press any key to exit`})})]})}var X,Xe=e((()=>{o(),p(),X=v()}));async function Ze(e,t,n,r,i,a,o){let s=await O(`gh`,[`api`,`repos/${e}/contents/${n}`,`--jq`,`.sha`]),c=null;s.code===0&&(c=s.stdout.trim());let l=r;i===`CLAUDE_CODE_OAUTH_TOKEN`?l=r.replace(/anthropic_api_key: \$\{\{ secrets\.ANTHROPIC_API_KEY \}\}/g,"claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}"):i!==`ANTHROPIC_API_KEY`&&(l=r.replace(/anthropic_api_key: \$\{\{ secrets\.ANTHROPIC_API_KEY \}\}/g,`anthropic_api_key: \${{ secrets.${i} }}`));let u=Buffer.from(l).toString(`base64`),d=[`api`,`--method`,`PUT`,`repos/${e}/contents/${n}`,`-f`,`message=${c?`"Update ${a}"`:`"${a}"`}`,`-f`,`content=${u}`,`-f`,`branch=${t}`];c&&d.push(`-f`,`sha=${c}`);let f=await O(`gh`,d);if(f.code!==0)throw f.stderr.includes(`422`)&&f.stderr.includes(`sha`)?(T(`tengu_setup_github_actions_failed`,{reason:`failed_to_create_workflow_file`,exit_code:f.code,...o}),Error(`Failed to create workflow file ${n}: A Claude workflow file already exists in this repository. Please remove it first or update it manually.`)):(T(`tengu_setup_github_actions_failed`,{reason:`failed_to_create_workflow_file`,exit_code:f.code,...o}),Error(`Failed to create workflow file ${n}: ${f.stderr}

Need help? Common issues:
· Permission denied → Run: gh auth refresh -h github.com -s repo,workflow
· Not authorized → Ensure you have admin access to the repository
· For manual setup → Visit: https://github.com/anthropics/claude-code-action`))}async function Qe(e,t,n,r,i=!1,a,o,s){try{T(`tengu_setup_github_actions_started`,{skip_workflow:i,has_api_key:!!t,using_default_secret_name:n===`ANTHROPIC_API_KEY`,selected_claude_workflow:a.includes(`claude`),selected_claude_review_workflow:a.includes(`claude-review`),...s});let c=await O(`gh`,[`api`,`repos/${e}`,`--jq`,`.id`]);if(c.code!==0)throw T(`tengu_setup_github_actions_failed`,{reason:`repo_not_found`,exit_code:c.code,...s}),Error(`Failed to access repository ${e}: ${c.stderr}`);let l=await O(`gh`,[`api`,`repos/${e}`,`--jq`,`.default_branch`]);if(l.code!==0)throw T(`tengu_setup_github_actions_failed`,{reason:`failed_to_get_default_branch`,exit_code:l.code,...s}),Error(`Failed to get default branch: ${l.stderr}`);let u=l.stdout.trim(),d=await O(`gh`,[`api`,`repos/${e}/git/ref/heads/${u}`,`--jq`,`.object.sha`]);if(d.code!==0)throw T(`tengu_setup_github_actions_failed`,{reason:`failed_to_get_branch_sha`,exit_code:d.code,...s}),Error(`Failed to get branch SHA: ${d.stderr}`);let f=d.stdout.trim(),p=null;if(!i){r(),p=`add-claude-github-actions-${Date.now()}`;let t=await O(`gh`,[`api`,`--method`,`POST`,`repos/${e}/git/refs`,`-f`,`ref=refs/heads/${p}`,`-f`,`sha=${f}`]);if(t.code!==0)throw T(`tengu_setup_github_actions_failed`,{reason:`failed_to_create_branch`,exit_code:t.code,...s}),Error(`Failed to create branch: ${t.stderr}`);r();let i=[];a.includes(`claude`)&&i.push({path:`.github/workflows/claude.yml`,content:Ee,message:`Claude PR Assistant workflow`}),a.includes(`claude-review`)&&i.push({path:`.github/workflows/claude-code-review.yml`,content:Oe,message:`Claude Code Review workflow`});for(let t of i)await Ze(e,p,t.path,t.content,n,t.message,s)}if(r(),t){let r=await O(`gh`,[`secret`,`set`,n,`--body`,t,`--repo`,e]);if(r.code!==0)throw T(`tengu_setup_github_actions_failed`,{reason:`failed_to_set_api_key_secret`,exit_code:r.code,...s}),Error(`Failed to set API key secret: ${r.stderr||`Unknown error`}

Need help? Common issues:
· Permission denied → Run: gh auth refresh -h github.com -s repo
· Not authorized → Ensure you have admin access to the repository
· For manual setup → Visit: https://github.com/anthropics/claude-code-action`)}!i&&p&&(r(),await _e(`https://github.com/${e}/compare/${u}...${p}?quick_pull=1&title=${encodeURIComponent(Te)}&body=${encodeURIComponent(De)}`)),T(`tengu_setup_github_actions_completed`,{skip_workflow:i,has_api_key:!!t,auth_type:o,using_default_secret_name:n===`ANTHROPIC_API_KEY`,selected_claude_workflow:a.includes(`claude`),selected_claude_review_workflow:a.includes(`claude-review`),...s}),y(e=>({...e,githubActionSetupCount:(e.githubActionSetupCount??0)+1}))}catch(e){throw(!e||!(e instanceof Error)||!e.message.includes(`Failed to`))&&T(`tengu_setup_github_actions_failed`,{reason:`unexpected_error`,...s}),e instanceof Error&&D(e),e}}var $e=e((()=>{w(),ee(),L(),ve(),ae(),ie()}));function et({warnings:e,onContinue:t}){return h(`confirm:yes`,t,{context:`Confirmation`}),(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsxs)(_,{flexDirection:`column`,borderStyle:`round`,paddingX:1,children:[(0,Z.jsxs)(_,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(c,{bold:!0,children:[r.warning,` Setup Warnings`]}),(0,Z.jsx)(c,{dimColor:!0,children:`We found some potential issues, but you can continue anyway`})]}),e.map((e,t)=>(0,Z.jsxs)(_,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(c,{color:`warning`,bold:!0,children:e.title}),(0,Z.jsx)(c,{children:e.message}),e.instructions.length>0&&(0,Z.jsx)(_,{flexDirection:`column`,marginLeft:2,marginTop:1,children:e.instructions.map((e,t)=>(0,Z.jsxs)(c,{dimColor:!0,children:[`• `,e]},t))})]},t)),(0,Z.jsx)(_,{marginTop:1,children:(0,Z.jsx)(c,{bold:!0,color:`permission`,children:`Press Enter to continue anyway, or Ctrl+C to exit and fix issues`})}),(0,Z.jsx)(_,{marginTop:1,children:(0,Z.jsxs)(c,{dimColor:!0,children:[`You can also try the manual setup steps if needed:`,` `,(0,Z.jsx)(c,{color:`claude`,children:I})]})})]})})}var Z,tt=e((()=>{n(),L(),p(),M(),Z=v()}));function nt(e){let[t]=(0,Q.useState)(()=>x()),[n,r]=(0,Q.useState)({...it,useExistingKey:!!t,selectedApiKeyOption:t?`existing`:S()?`oauth`:`new`});ye(),Q.useEffect(()=>{T(`tengu_install_github_app_started`,{})},[]);let i=(0,Q.useCallback)(async()=>{let e=[];(await re(`gh --version`,{shell:!0,reject:!1})).exitCode!==0&&e.push({title:`GitHub CLI not found`,message:`GitHub CLI (gh) does not appear to be installed or accessible.`,instructions:[`Install GitHub CLI from https://cli.github.com/`,`macOS: brew install gh`,`Windows: winget install --id GitHub.cli`,`Linux: See installation instructions at https://github.com/cli/cli#installation`]});let t=await re(`gh auth status -a`,{shell:!0,reject:!1});if(t.exitCode!==0)e.push({title:`GitHub CLI not authenticated`,message:`GitHub CLI does not appear to be authenticated.`,instructions:[`Run: gh auth login`,`Follow the prompts to authenticate with GitHub`,`Or set up authentication using environment variables or other methods`]});else{let e=t.stdout.match(/Token scopes:.*$/m);if(e){let t=e[0],n=[];if(t.includes(`repo`)||n.push(`repo`),t.includes(`workflow`)||n.push(`workflow`),n.length>0){r(e=>({...e,step:`error`,error:`GitHub CLI is missing required permissions: ${n.join(`, `)}.`,errorReason:`Missing required scopes`,errorInstructions:[`Your GitHub CLI authentication is missing the "${n.join(`" and "`)}" ${oe(n.length,`scope`)} needed to manage GitHub Actions and secrets.`,``,`To fix this, run:`,`  gh auth refresh -h github.com -s repo,workflow`,``,`This will add the necessary permissions to manage workflows and secrets.`]}));return}}}let n=await E()??``;T(`tengu_install_github_app_step_completed`,{step:`check-gh`}),r(t=>({...t,warnings:e,currentRepo:n,selectedRepoName:n,useCurrentRepo:!!n,step:e.length>0?`warnings`:`choose-repo`}))},[]);Q.useEffect(()=>{n.step===`check-gh`&&i()},[n.step,i]);let a=(0,Q.useCallback)(async(e,t)=>{r(e=>({...e,step:`creating`,currentWorkflowInstallStep:0}));try{await Qe(n.selectedRepoName,e,t,()=>{r(e=>({...e,currentWorkflowInstallStep:e.currentWorkflowInstallStep+1}))},n.workflowAction===`skip`,n.selectedWorkflows,n.authType,{useCurrentRepo:n.useCurrentRepo,workflowExists:n.workflowExists,secretExists:n.secretExists}),T(`tengu_install_github_app_step_completed`,{step:`creating`}),r(e=>({...e,step:`success`}))}catch(e){let t=e instanceof Error?e.message:`Failed to set up GitHub Actions`;t.includes(`workflow file already exists`)?(T(`tengu_install_github_app_error`,{reason:`workflow_file_exists`}),r(e=>({...e,step:`error`,error:`A Claude workflow file already exists in this repository.`,errorReason:`Workflow file conflict`,errorInstructions:[`The file .github/workflows/claude.yml already exists`,`You can either:`,`  1. Delete the existing file and run this command again`,`  2. Update the existing file manually using the template from:`,`     ${I}`]}))):(T(`tengu_install_github_app_error`,{reason:`setup_github_actions_failed`}),r(e=>({...e,step:`error`,error:t,errorReason:`GitHub Actions setup failed`,errorInstructions:[]})))}},[n.selectedRepoName,n.workflowAction,n.selectedWorkflows,n.useCurrentRepo,n.workflowExists,n.secretExists,n.authType]);async function o(){await _e(`https://github.com/apps/claude`)}async function s(e){try{let t=await O(`gh`,[`api`,`repos/${e}`,`--jq`,`.permissions.admin`]);return t.code===0?{hasAccess:t.stdout.trim()===`true`}:t.stderr.includes(`404`)||t.stderr.includes(`Not Found`)?{hasAccess:!1,error:`repository_not_found`}:{hasAccess:!1}}catch{return{hasAccess:!1}}}async function c(e){return(await O(`gh`,[`api`,`repos/${e}/contents/.github/workflows/claude.yml`,`--jq`,`.sha`])).code===0}async function l(){let e=await O(`gh`,[`secret`,`list`,`--app`,`actions`,`--repo`,n.selectedRepoName]);e.code===0&&e.stdout.split(`
`).some(e=>/^ANTHROPIC_API_KEY\s+/.test(e))?r(e=>({...e,secretExists:!0,step:`check-existing-secret`})):t?(r(e=>({...e,apiKeyOrOAuthToken:t,useExistingKey:!0})),await a(t,n.secretName)):r(e=>({...e,step:`api-key`}))}let u=async()=>{if(n.step===`warnings`)T(`tengu_install_github_app_step_completed`,{step:`warnings`}),r(e=>({...e,step:`install-app`})),setTimeout(o,0);else if(n.step===`choose-repo`){let e=n.useCurrentRepo?n.currentRepo:n.selectedRepoName;if(!e.trim())return;let t=[];if(e.includes(`github.com`)){let n=e.match(/github\.com[:/]([^/]+\/[^/]+)(\.git)?$/);n?e=n[1]?.replace(/\.git$/,``)||``:t.push({title:`Invalid GitHub URL format`,message:`The repository URL format appears to be invalid.`,instructions:[`Use format: owner/repo or https://github.com/owner/repo`,`Example: anthropics/claude-cli`]})}e.includes(`/`)||t.push({title:`Repository format warning`,message:`Repository should be in format "owner/repo"`,instructions:[`Use format: owner/repo`,`Example: anthropics/claude-cli`]});let i=await s(e);i.error===`repository_not_found`?t.push({title:`Repository not found`,message:`Repository ${e} was not found or you don't have access.`,instructions:[`Check that the repository name is correct: ${e}`,`Ensure you have access to this repository`,`For private repositories, make sure your GitHub token has the "repo" scope`,`You can add the repo scope with: gh auth refresh -h github.com -s repo,workflow`]}):i.hasAccess||t.push({title:`Admin permissions required`,message:`You might need admin permissions on ${e} to set up GitHub Actions.`,instructions:[`Repository admins can install GitHub Apps and set secrets`,`Ask a repository admin to run this command if setup fails`,`Alternatively, you can use the manual setup instructions`]});let a=await c(e);if(t.length>0){let i=[...n.warnings,...t];r(t=>({...t,selectedRepoName:e,workflowExists:a,warnings:i,step:`warnings`}))}else T(`tengu_install_github_app_step_completed`,{step:`choose-repo`}),r(t=>({...t,selectedRepoName:e,workflowExists:a,step:`install-app`})),setTimeout(o,0)}else if(n.step===`install-app`)T(`tengu_install_github_app_step_completed`,{step:`install-app`}),n.workflowExists?r(e=>({...e,step:`check-existing-workflow`})):r(e=>({...e,step:`select-workflows`}));else if(n.step===`check-existing-workflow`)return;else if(n.step===`select-workflows`)return;else if(n.step===`check-existing-secret`)T(`tengu_install_github_app_step_completed`,{step:`check-existing-secret`}),n.useExistingSecret?await a(null,n.secretName):await a(n.apiKeyOrOAuthToken,n.secretName);else if(n.step===`api-key`){if(n.selectedApiKeyOption===`oauth`)return;let e=n.selectedApiKeyOption===`existing`?t:n.apiKeyOrOAuthToken;if(!e){T(`tengu_install_github_app_error`,{reason:`api_key_missing`}),r(e=>({...e,step:`error`,error:`API key is required`}));return}r(t=>({...t,apiKeyOrOAuthToken:e,useExistingKey:n.selectedApiKeyOption===`existing`}));let i=await O(`gh`,[`secret`,`list`,`--app`,`actions`,`--repo`,n.selectedRepoName]);i.code===0&&i.stdout.split(`
`).some(e=>/^ANTHROPIC_API_KEY\s+/.test(e))?(T(`tengu_install_github_app_step_completed`,{step:`api-key`}),r(e=>({...e,secretExists:!0,step:`check-existing-secret`}))):(T(`tengu_install_github_app_step_completed`,{step:`api-key`}),await a(e,n.secretName))}},d=e=>{r(t=>({...t,selectedRepoName:e}))},f=e=>{r(t=>({...t,apiKeyOrOAuthToken:e}))},p=e=>{r(t=>({...t,selectedApiKeyOption:e}))},m=(0,Q.useCallback)(()=>{T(`tengu_install_github_app_step_completed`,{step:`api-key`}),r(e=>({...e,step:`oauth-flow`}))},[]),h=(0,Q.useCallback)(e=>{T(`tengu_install_github_app_step_completed`,{step:`oauth-flow`}),r(t=>({...t,apiKeyOrOAuthToken:e,useExistingKey:!1,secretName:`CLAUDE_CODE_OAUTH_TOKEN`,authType:`oauth_token`})),a(e,`CLAUDE_CODE_OAUTH_TOKEN`)},[a]),g=(0,Q.useCallback)(()=>{r(e=>({...e,step:`api-key`}))},[]),v=e=>{e&&!/^[a-zA-Z0-9_]+$/.test(e)||r(t=>({...t,secretName:e}))},y=e=>{r(t=>({...t,useCurrentRepo:e,selectedRepoName:e?t.currentRepo:``}))},b=e=>{r(t=>({...t,useExistingKey:e}))},C=e=>{r(t=>({...t,useExistingSecret:e,secretName:e?`ANTHROPIC_API_KEY`:``}))},ee=async n=>{if(n===`exit`){e.onDone(`Installation cancelled by user`);return}T(`tengu_install_github_app_step_completed`,{step:`check-existing-workflow`}),r(e=>({...e,workflowAction:n})),(n===`skip`||n===`update`)&&(t?await l():r(e=>({...e,step:`api-key`})))};function w(t){t.preventDefault(),n.step===`success`&&T(`tengu_install_github_app_completed`,{}),e.onDone(n.step===`success`?`GitHub Actions setup complete!`:n.error?`Couldn't install GitHub App: ${n.error}\nFor manual setup instructions, see: ${I}`:`GitHub App installation failed\nFor manual setup instructions, see: ${I}`)}switch(n.step){case`check-gh`:return(0,$.jsx)(Ne,{});case`warnings`:return(0,$.jsx)(et,{warnings:n.warnings,onContinue:u});case`choose-repo`:return(0,$.jsx)(Ie,{currentRepo:n.currentRepo,useCurrentRepo:n.useCurrentRepo,repoUrl:n.selectedRepoName,onRepoUrlChange:d,onToggleUseCurrentRepo:y,onSubmit:u});case`install-app`:return(0,$.jsx)(We,{repoUrl:n.selectedRepoName,onSubmit:u});case`check-existing-workflow`:return(0,$.jsx)(He,{repoName:n.selectedRepoName,onSelectAction:ee});case`check-existing-secret`:return(0,$.jsx)(je,{useExistingSecret:n.useExistingSecret,secretName:n.secretName,onToggleUseExistingSecret:C,onSecretNameChange:v,onSubmit:u});case`api-key`:return(0,$.jsx)(ke,{existingApiKey:t,useExistingKey:n.useExistingKey,apiKeyOrOAuthToken:n.apiKeyOrOAuthToken,onApiKeyChange:f,onToggleUseExistingKey:b,onSubmit:u,onCreateOAuthToken:S()?m:void 0,selectedOption:n.selectedApiKeyOption,onSelectOption:p});case`creating`:return(0,$.jsx)(Re,{currentWorkflowInstallStep:n.currentWorkflowInstallStep,secretExists:n.secretExists,useExistingSecret:n.useExistingSecret,secretName:n.secretName,skipWorkflow:n.workflowAction===`skip`,selectedWorkflows:n.selectedWorkflows});case`success`:return(0,$.jsx)(_,{tabIndex:0,autoFocus:!0,onKeyDown:w,children:(0,$.jsx)(Ye,{secretExists:n.secretExists,useExistingSecret:n.useExistingSecret,secretName:n.secretName,skipWorkflow:n.workflowAction===`skip`})});case`error`:return(0,$.jsx)(_,{tabIndex:0,autoFocus:!0,onKeyDown:w,children:(0,$.jsx)(Be,{error:n.error,errorReason:n.errorReason,errorInstructions:n.errorInstructions})});case`select-workflows`:return(0,$.jsx)(Se,{defaultSelections:n.selectedWorkflows,onSubmit:e=>{T(`tengu_install_github_app_step_completed`,{step:`select-workflows`}),r(t=>({...t,selectedWorkflows:e})),t?l():r(e=>({...e,step:`api-key`}))}});case`oauth-flow`:return(0,$.jsx)(Ke,{onSuccess:h,onCancel:g})}}async function rt(e){return(0,$.jsx)(nt,{onDone:e})}var Q,$,it;e((()=>{ne(),Q=t(o(),1),w(),we(),L(),be(),p(),C(),ve(),ae(),te(),se(),Ae(),Me(),Fe(),Le(),ze(),Ve(),Ue(),Ge(),Je(),Xe(),$e(),tt(),$=v(),it={step:`check-gh`,selectedRepoName:``,currentRepo:``,useCurrentRepo:!1,apiKeyOrOAuthToken:``,useExistingKey:!0,currentWorkflowInstallStep:0,warnings:[],secretExists:!1,secretName:`ANTHROPIC_API_KEY`,useExistingSecret:!0,workflowExists:!1,selectedWorkflows:[`claude`,`claude-review`],selectedApiKeyOption:`new`,authType:`api_key`}}))();export{rt as call};