import{$w as w,Sr as b,Tr as I,ax as z,bx as F,cx as N}from"./cli-0.5.4-k5fz4zd3.mjs";import"./cli-0.5.4-wbqf44ym.mjs";import"./cli-0.5.4-9ewg9gfs.mjs";import"./cli-0.5.4-we3mspgg.mjs";import"./cli-0.5.4-jzhazry0.mjs";import"./cli-0.5.4-82sw3hrw.mjs";import"./cli-0.5.4-31v143kt.mjs";import"./cli-0.5.4-1cy7wd6s.mjs";import"./cli-0.5.4-5e0pk96f.mjs";import"./cli-0.5.4-z154a7bp.mjs";import"./cli-0.5.4-ng5p0zjs.mjs";import"./cli-0.5.4-5hp7ks3t.mjs";import"./cli-0.5.4-8hdwp78f.mjs";import"./cli-0.5.4-mr9aznxx.mjs";import"./cli-0.5.4-jevfk5q7.mjs";import"./cli-0.5.4-27dzbzdy.mjs";import"./cli-0.5.4-a5bkdqqb.mjs";import"./cli-0.5.4-j2hnw539.mjs";import"./cli-0.5.4-9w59nnw4.mjs";import"./cli-0.5.4-z5d3q8kh.mjs";import"./cli-0.5.4-c0r12dqp.mjs";import"./cli-0.5.4-kqh172jk.mjs";import"./cli-0.5.4-vv4jbgkc.mjs";import"./cli-0.5.4-s7k1f0wc.mjs";import"./cli-0.5.4-0h0yz2k5.mjs";import"./cli-0.5.4-942dm5q1.mjs";import"./cli-0.5.4-rcmp5h4y.mjs";import"./cli-0.5.4-xdcww3x8.mjs";import"./cli-0.5.4-fq32ny1h.mjs";import"./cli-0.5.4-h1m67ngp.mjs";import"./cli-0.5.4-49erze3e.mjs";import"./cli-0.5.4-jytjks37.mjs";import"./cli-0.5.4-mn22gk7g.mjs";import"./cli-0.5.4-5t3jj85n.mjs";import"./cli-0.5.4-5shjmmkz.mjs";import"./cli-0.5.4-zb412kkm.mjs";import"./cli-0.5.4-prfn3sxd.mjs";import"./cli-0.5.4-6xmgebmk.mjs";import"./cli-0.5.4-vjgejcrz.mjs";import{K1 as P,R1 as x,s1 as y}from"./cli-0.5.4-jqt00ywx.mjs";import"./cli-0.5.4-9e7rkd8e.mjs";import"./cli-0.5.4-jp4wtw87.mjs";import"./cli-0.5.4-hambpq58.mjs";import"./cli-0.5.4-syvgmg9g.mjs";import"./cli-0.5.4-w8ttefr5.mjs";import"./cli-0.5.4-j7kkqxv6.mjs";import"./cli-0.5.4-qrwczx7j.mjs";import"./cli-0.5.4-v2z6p9td.mjs";import{R$ as Q,T$ as k}from"./cli-0.5.4-cbq01zg3.mjs";import"./cli-0.5.4-37v5fhf1.mjs";import"./cli-0.5.4-7grzwf6q.mjs";import"./cli-0.5.4-9qmek5dq.mjs";import"./cli-0.5.4-9c6r1fjg.mjs";import"./cli-0.5.4-2dw33ms6.mjs";import"./cli-0.5.4-x1fzfxmm.mjs";import"./cli-0.5.4-e822fzaq.mjs";import"./cli-0.5.4-09dvrzcr.mjs";import{sfa as $,xfa as U}from"./cli-0.5.4-end8wj9r.mjs";import"./cli-0.5.4-4x206j04.mjs";import"./cli-0.5.4-yd3rd9qt.mjs";import{Gga as Z,Nga as T}from"./cli-0.5.4-sgcaw17t.mjs";import"./cli-0.5.4-jmc3bzbn.mjs";import"./cli-0.5.4-959vxhhb.mjs";import"./cli-0.5.4-aacw1src.mjs";T();x();N();k();I();U();function G(h){process.stdout.write($(h,null,2)+`
`)}var V=`Auto-mode classifier prompts are not bundled in this build.
Effective behavior at runtime: auto-allow for non-allowlisted tools.
Add prompt templates at src/utils/permissions/yolo-classifier-prompts/ and rebuild to enable.
`;function D(){if(!w()){process.stdout.write(V);return}G(z())}function E(){if(!w()){process.stdout.write(V);return}let h=Q(),j=z();G({allow:h?.allow?.length?h.allow:j.allow,soft_deny:h?.soft_deny?.length?h.soft_deny:j.soft_deny,environment:h?.environment?.length?h.environment:j.environment})}var m=`You are an expert reviewer of auto mode classifier rules for Claude Code.

Claude Code has an "auto mode" that uses an AI classifier to decide whether tool calls should be auto-approved or require user confirmation. Users can write custom rules in three categories:

- **allow**: Actions the classifier should auto-approve
- **soft_deny**: Actions the classifier should block (require user confirmation)
- **environment**: Context about the user's setup that helps the classifier make decisions

Your job is to critique the user's custom rules for clarity, completeness, and potential issues. The classifier is an LLM that reads these rules as part of its system prompt.

For each rule, evaluate:
1. **Clarity**: Is the rule unambiguous? Could the classifier misinterpret it?
2. **Completeness**: Are there gaps or edge cases the rule doesn't cover?
3. **Conflicts**: Do any of the rules conflict with each other?
4. **Actionability**: Is the rule specific enough for the classifier to act on?

Be concise and constructive. Only comment on rules that could be improved. If all rules look good, say so.`;async function M(h){if(!w()){process.stdout.write(V);return}let j=Q();if(!((j?.allow?.length??0)>0||(j?.soft_deny?.length??0)>0||(j?.environment?.length??0)>0)){process.stdout.write(`No custom auto mode rules found.

Add rules to your settings file under autoMode.{allow, soft_deny, environment}.
Run \`claude auto-mode defaults\` to see the default rules for reference.
`);return}let H=h.model?P(h.model):y(),q=z(),v=F(),O=K("allow",j?.allow??[],q.allow)+K("soft_deny",j?.soft_deny??[],q.soft_deny)+K("environment",j?.environment??[],q.environment);process.stdout.write(`Analyzing your auto mode rules…

`);let X;try{X=await b({querySource:"auto_mode_critique",model:H,system:m,max_tokens:4096,messages:[{role:"user",content:`Here is the full classifier system prompt that the auto mode classifier receives:

<classifier_system_prompt>
`+v+`
</classifier_system_prompt>

Here are the user's custom rules that REPLACE the corresponding default sections:

`+O+`
Please critique these custom rules.`}]})}catch(J){process.stderr.write("Failed to analyze rules: "+Z(J)+`
`),process.exitCode=1;return}let Y=X.content.find((J)=>J.type==="text");if(Y?.type==="text")process.stdout.write(Y.text+`
`);else process.stdout.write(`No critique was generated. Please try again.
`)}function K(h,j,W){if(j.length===0)return"";let H=j.map((v)=>"- "+v).join(`
`),q=W.map((v)=>"- "+v).join(`
`);return"## "+h+` (custom rules replacing defaults)
Custom:
`+H+`

Defaults being replaced:
`+q+`

`}export{D as autoModeDefaultsHandler,M as autoModeCritiqueHandler,E as autoModeConfigHandler};
