(q,K)
| 1659 | Format: 2-12 words, match the user's style. Or nothing. |
| 1660 | |
| 1661 | Reply with ONLY the suggestion, no quotes or explanation.`,z_z;var zw6=y(()=>{v8();i$();m8();y8();nv();E8();i1();U1();AY();o1();k8();ZU();Yw6();z_z={user_intent:yN4,stated_intent:yN4}});import{basename as Y_z,extname as $_z,posix as hN4,sep as A_z}from"path";function CN4(q){let K=hN4.sep+q.split(A_z).join(hN4.sep).replace(/^\/+/,""),_=Y_z(q).toLowerCase(),z=$_z(q).toLowerCase();if(O_z.has(_))return!0;if(SN4.has(z))return!0;let Y=_.split(".");if(Y.length>2){let $="."+Y.slice(-2).join(".");if(SN4.has($))return!0}for(let $ of w_z)if(K.includes($))return!0;for(let $ of j_z)if($.test(_))return!0;return!1}var O_z,SN4,w_z,j_z;var bN4=y(()=>{O_z=new Set(["package-lock.json","yarn.lock","pnpm-lock.yaml","bun.lockb","bun.lock","composer.lock","gemfile.lock","cargo.lock","poetry.lock","pipfile.lock","shrinkwrap.json","npm-shrinkwrap.json"]),SN4=new Set([".lock",".min.js",".min.css",".min.html",".bundle.js",".bundle.css",".generated.ts",".generated.js",".d.ts"]),w_z=["/dist/","/build/","/out/","/output/","/node_modules/","/vendor/","/vendored/","/third_party/","/third-party/","/external/","/.next/","/.nuxt/","/.svelte-kit/","/coverage/","/__pycache__/","/.tox/","/venv/","/.venv/","/target/release/","/target/debug/"],j_z=[/^.*\.min\.[a-z]+$/i,/^.*-min\.[a-z]+$/i,/^.*\.bundle\.[a-z]+$/i,/^.*\.generated\.[a-z]+$/i,/^.*\.gen\.[a-z]+$/i,/^.*\.auto\.[a-z]+$/i,/^.*_generated\.[a-z]+$/i,/^.*_gen\.[a-z]+$/i,/^.*\.pb\.(go|js|ts|py|rb)$/i,/^.*_pb2?\.py$/i,/^.*\.pb\.h$/i,/^.*\.grpc\.[a-z]+$/i,/^.*\.swagger\.[a-z]+$/i,/^.*\.openapi\.[a-z]+$/i]});import{stat as H_z}from"fs/promises";import{isAbsolute as m5O,join as J_z,relative as p5O,sep as B5O}from"path";function vN8(){let q=Z8();return hY(q)??r1()}function IN4(){return Xo6==="internal"}function mN4(q){if(q.includes("opus-4-6"))return"claude-opus-4-6";if(q.includes("opus-4-5"))return"claude-opus-4-5";if(q.includes("opus-4-1"))return"claude-opus-4-1";if(q.includes("opus-4"))return"claude-opus-4";if(q.includes("sonnet-4-6"))return"claude-sonnet-4-6";if(q.includes("sonnet-4-5"))return"claude-sonnet-4-5";if(q.includes("sonnet-4"))return"claude-sonnet-4";if(q.includes("sonnet-3-7"))return"claude-sonnet-3-7";if(q.includes("haiku-4-5"))return"claude-haiku-4-5";if(q.includes("haiku-3-5"))return"claude-haiku-3-5";return"claude"}function X_z(){return process.env.CLAUDE_CODE_ENTRYPOINT??"cli"}function yV6(){return{fileStates:new Map,sessionBaselines:new Map,surface:X_z(),startingHeadSha:null,promptCount:0,promptCountAtLastCommit:0,permissionPromptCount:0,permissionPromptCountAtLastCommit:0,escapeCount:0,escapeCountAtLastCommit:0}}async function pN4(q,K){let _=vN8(),z=N8(),Y={},$=[],A=new Set,O={},w=0,j=0,H=new Map,J=new Map;for(let D of q){A.add(D.surface);let f=D.sessionBaselines instanceof Map?D.sessionBaselines:new Map(Object.entries(D.sessionBaselines??{}));for(let[Z,T]of f)if(!J.has(Z))J.set(Z,T);let G=D.fileStates instanceof Map?D.fileStates:new Map(Object.entries(D.fileStates??{}));for(let[Z,T]of G){let v=H.get(Z);if(v)H.set(Z,{...T,claudeContribution:v.claudeContribution+T.claudeContribution});else H.set(Z,T)}}let M=await Promise.all(K.map(async(D)=>{if(CN4(D))return{type:"generated",file:D};let f=J_z(_,D),G=H.get(D),Z=J.get(D),T=q[0].surface,v=0,V=0;if(await P_z(D))if(G)v=G.claudeContribution,V=0;else{let x=await xN4(D);V=x>0?x:100}else try{let x=await H_z(f);if(G)v=G.claudeContribution,V=0;else if(Z){let I=await xN4(D);V=I>0?I:x.size}else V=x.size}catch{return null}v=Math.max(0,v),V=Math.max(0,V);let S=v+V,R=S>0?Math.round(v/S*100):0;return{type:"file",file:D,claudeChars:v,humanChars:V,percent:R,surface:T}}));for(let D of M){if(!D)continue;if(D.type==="generated"){$.push(D.file);continue}Y[D.file]={claudeChars:D.claudeChars,humanChars:D.humanChars,percent:D.percent,surface:D.surface},w+=D.claudeChars,j+=D.humanChars,O[D.surface]=(O[D.surface]??0)+D.claudeChars}let X=w+j,P=X>0?Math.round(w/X*100):0,W={};for(let[D,f]of Object.entries(O)){let G=X>0?Math.round(f/X*100):0;W[D]={claudeChars:f,percent:G}}return{version:1,summary:{claudePercent:P,claudeChars:w,humanChars:j,surfaces:Array.from(A)},files:Y,surfaceBreakdown:W,excludedGenerated:$,sessions:[z]}}async function xN4(q){let K=vN8();try{let _=await S7(L7(),["diff","--cached","--stat","--",q],{cwd:K,timeout:5000});if(_.code!==0||!_.stdout)return 0;let z=_.stdout.split(` |
| 1662 | `).filter(Boolean),Y=0;for(let $ of z)if($.includes("file changed")||$.includes("files changed")){let A=$.match(/(\d+) insertions?/),O=$.match(/(\d+) deletions?/),w=A?parseInt(A[1],10):0,j=O?parseInt(O[1],10):0;Y+=(w+j)*40}return Y}catch{return 0}}async function P_z(q){let K=vN8();try{let _=await S7(L7(),["diff","--cached","--name-status","--",q],{cwd:K,timeout:5000});if(_.code===0&&_.stdout)return _.stdout.trim().startsWith("D\t")}catch{}return!1}var M_z,Xo6=null,uN4;var xr=y(()=>{v8();I7();_8();XK();e7();bN4();Hl();E5();E8();aq();M_z=["github.com:anthropics/claude-cli-internal","github.com/anthropics/claude-cli-internal","github.com:anthropics/anthropic","github.com/anthropics/anthropic","github.com:anthropics/apps","github.com/anthropics/apps","github.com:anthropics/casino","github.com/anthropics/casino","github.com:anthropics/dbt","github.com/anthropics/dbt","github.com:anthropics/dotfiles","github.com/anthropics/dotfiles","github.com:anthropics/terraform-config","github.com/anthropics/terraform-config","github.com:anthropics/hex-export","github.com/anthropics/hex-export","github.com:anthropics/feedback-v2","github.com/anthropics/feedback-v2","github.com:anthropics/labs","github.com/anthropics/labs","github.com:anthropics/argo-rollouts","github.com/anthropics/argo-rollouts","github.com:anthropics/starling-configs","github.com/anthropics/starling-configs","github.com:anthropics/ts-tools","github.com/anthropics/ts-tools","github.com:anthropics/ts-capsules","github.com/anthropics/ts-capsules","github.com:anthropics/feldspar-testing","github.com/anthropics/feldspar-testing","github.com:anthropics/trellis","github.com/anthropics/trellis","github.com:anthropics/claude-for-hiring","github.com/anthropics/claude-for-hiring","github.com:anthropics/forge-web","github.com/anthropics/forge-web","github.com:anthropics/infra-manifests","github.com/anthropics/infra-manifests","github.com:anthropics/mycro_manifests","github.com/anthropics/mycro_manifests","github.com:anthropics/mycro_configs","github.com/anthropics/mycro_configs","github.com:anthropics/mobile-apps","github.com/anthropics/mobile-apps"];uN4=TB(async()=>{if(Xo6!==null)return Xo6==="internal";let q=vN8(),K=await o$8(q);if(!K)return Xo6="none",!1;let _=M_z.some((z)=>K.includes(z));return Xo6=_?"internal":"external",_})});function $w6(){let q=(AY(),Eq(SV1)),K=q.isTeammate()&&q.isPlanModeRequired()?"plan":"default";return{settings:N7(),tasks:{},agentNameRegistry:new Map,verbose:!1,mainLoopModel:null,mainLoopModelForSession:null,statusLineText:void 0,expandedView:"none",isBriefOnly:!1,showTeammateMessagePreview:!1,selectedIPAgentIndex:-1,coordinatorTaskIndex:-1,viewSelectionMode:"none",footerSelection:null,kairosEnabled:!1,remoteSessionUrl:void 0,remoteConnectionStatus:"connecting",remoteBackgroundTaskCount:0,replBridgeEnabled:!1,replBridgeExplicit:!1,replBridgeOutboundOnly:!1,replBridgeConnected:!1,replBridgeSessionActive:!1,replBridgeReconnecting:!1,replBridgeConnectUrl:void 0,replBridgeSessionUrl:void 0,replBridgeEnvironmentId:void 0,replBridgeSessionId:void 0,replBridgeError:void 0,replBridgeInitialName:void 0,showRemoteCallout:!1,toolPermissionContext:{...MX(),mode:K},agent:void 0,agentDefinitions:{activeAgents:[],allAgents:[]},fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},attribution:yV6(),mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:0},plugins:{enabled:[],disabled:[],commands:[],errors:[],installationStatus:{marketplaces:[],plugins:[]},needsRefresh:!1},todos:{},remoteAgentTaskSuggestions:[],notifications:{current:null,queue:[]},elicitation:{queue:[]},thinkingEnabled:j76(),promptSuggestionEnabled:TN8(),sessionHooks:new Map,inbox:{messages:[]},workerSandboxPermissions:{queue:[],selectedIndex:0},pendingWorkerRequest:null,pendingSandboxRequest:null,promptSuggestion:{text:null,promptId:null,shownAt:0,acceptedAt:0,generationRequestId:null},speculation:Wq6,speculationSessionTimeSavedMs:0,skillImprovement:{suggestion:null},authVersion:0,initialMessage:null,effortValue:void 0,activeOverlays:new Set,fastMode:!1}}var Wq6;var EV6=y(()=>{zw6();Bq();xr();U1();WL();Wq6={status:"idle"}});import{randomBytes as W_z}from"crypto";function Z_z(){return W_z(8).toString("hex")}function Dq6(q,K){let _=new Map;if(!q.includes("<<"))return{processedCommand:q,heredocs:_};if(/\$['"]/.test(q))return{processedCommand:q,heredocs:_};let z=q.indexOf("<<");if(z>0&&q.slice(0,z).includes("`"))return{processedCommand:q,heredocs:_};if(z>0){let Z=q.slice(0,z),T=(Z.match(/\(\(/g)||[]).length,v=(Z.match(/\)\)/g)||[]).length;if(T>v)return{processedCommand:q,heredocs:_}}let Y=new RegExp(G_z.source,"g"),$=[],A=[],O,w=0,j=!1,H=!1,J=!1,M=!1,X=0,P=(Z)=>{for(let T=w;T<Z;T++){let v=q[T];if(v===` |
| 1663 | `)J=!1;if(j){if(v==="'")j=!1;continue}if(H){if(M){M=!1;continue}if(v==="\\"){M=!0;continue}if(v==='"')H=!1;continue}if(v==="\\"){X++;continue}let V=X%2===1;if(X=0,V)continue;if(v==="'")j=!0;else if(v==='"')H=!0;else if(!J&&v==="#")J=!0}w=Z};while((O=Y.exec(q))!==null){let Z=O.index;if(P(Z),j||H)continue;if(J)continue;if(X%2===1)continue;let T=!1;for(let j6 of A)if(Z>j6.contentStartIndex&&Z<j6.contentEndIndex){T=!0;break}if(T)continue;let v=O[0],V=O[1]==="-",E=O[3]||O[4],S=Z+v.length,R=O[2];if(R&&q[S-1]!==R)continue;let x=v.includes("\\"),I=!!R||x;if(S<q.length){let j6=q[S];if(!/^[ \t\n|&;()<>]$/.test(j6))continue}let B=-1;{let j6=!1,G6=!1;for(let w6=S;w6<q.length;w6++){let o=q[w6];if(j6){if(o==="'")j6=!1;continue}if(G6){if(o==="\\"){w6++;continue}if(o==='"')G6=!1;continue}if(o===` |
| 1664 | `){B=w6-S;break}let s=0;for(let a=w6-1;a>=S&&q[a]==="\\";a--)s++;if(s%2===1)continue;if(o==="'")j6=!0;else if(o==='"')G6=!0}}if(B===-1)continue;let p=q.slice(S,S+B),C=0;for(let j6=p.length-1;j6>=0;j6--)if(p[j6]==="\\")C++;else break;if(C%2===1)continue;let g=S+B,U=q.slice(g+1).split(` |
| 1665 | `),c=-1;for(let j6=0;j6<U.length;j6++){let G6=U[j6];if(V){if(G6.replace(/^\t*/,"")===E){c=j6;break}}else if(G6===E){c=j6;break}let w6=V?G6.replace(/^\t*/,""):G6;if(w6.length>E.length&&w6.startsWith(E)){let o=w6[E.length];if(/^[)}`|&;(<>]$/.test(o)){c=-1;break}}}if(K?.quotedOnly&&!I){let j6;if(c===-1)j6=q.length;else{let w6=U.slice(0,c+1).join(` |
| 1666 | `).length;j6=g+1+w6}A.push({contentStartIndex:g,contentEndIndex:j6});continue}if(c===-1)continue;let t=U.slice(0,c+1).join(` |
| 1667 | `).length,q6=g+1+t,e=!1;for(let j6 of A)if(g<j6.contentEndIndex&&j6.contentStartIndex<q6){e=!0;break}if(e)continue;let i=q.slice(Z,S),$6=q.slice(g,q6),M6=i+$6;$.push({fullText:M6,delimiter:E,operatorStartIndex:Z,operatorEndIndex:S,contentStartIndex:g,contentEndIndex:q6})}if($.length===0)return{processedCommand:q,heredocs:_};let W=$.filter((Z,T,v)=>{for(let V of v){if(Z===V)continue;if(Z.operatorStartIndex>V.contentStartIndex&&Z.operatorStartIndex<V.contentEndIndex)return!1}return!0});if(W.length===0)return{processedCommand:q,heredocs:_};if(new Set(W.map((Z)=>Z.contentStartIndex)).size<W.length)return{processedCommand:q,heredocs:_};W.sort((Z,T)=>T.contentEndIndex-Z.contentEndIndex);let f=Z_z(),G=q;return W.forEach((Z,T)=>{let v=W.length-1-T,V=`${D_z}${v}_${f}${f_z}`;_.set(V,Z),G=G.slice(0,Z.operatorStartIndex)+V+G.slice(Z.operatorEndIndex,Z.contentStartIndex)+G.slice(Z.contentEndIndex)}),{processedCommand:G,heredocs:_}}function T_z(q,K){let _=q;for(let[z,Y]of K)_=_.replaceAll(z,Y.fullText);return _}function Qm1(q,K){if(K.size===0)return q;return q.map((_)=>T_z(_,K))}var D_z="__HEREDOC_",f_z="__",G_z;var dm1=y(()=>{G_z=/(?<!<)<<(?!<)(-)?[ \t]*(?:(['"])(\\?\w+)\2|\\?(\w+))/});function cm1(q,K,_){switch(q.type){case"raw_string":K.raw.push([q.startIndex,q.endIndex]);return;case"ansi_c_string":K.ansiC.push([q.startIndex,q.endIndex]);return;case"string":if(!_)K.double.push([q.startIndex,q.endIndex]);for(let z of q.children)if(z)cm1(z,K,!0);return;case"heredoc_redirect":{let z=!1;for(let Y of q.children)if(Y&&Y.type==="heredoc_start"){let $=Y.text[0];z=$==="'"||$==='"'||$==="\\";break}if(z){K.heredoc.push([q.startIndex,q.endIndex]);return}break}}for(let z of q.children)if(z)cm1(z,K,_)}function v_z(q){let K=new Set;for(let[_,z]of q)for(let Y=_;Y<z;Y++)K.add(Y);return K}function BN4(q){return q.filter((K,_)=>!q.some((z,Y)=>Y!==_&&z[0]<=K[0]&&z[1]>=K[1]&&(z[0]<K[0]||z[1]>K[1])))}function k_z(q,K){if(K.length===0)return q;let _=BN4(K).sort((Y,$)=>$[0]-Y[0]),z=q;for(let[Y,$]of _)z=z.slice(0,Y)+z.slice($);return z}function V_z(q,K){if(K.length===0)return q;let _=BN4(K).sort((Y,$)=>$[0]-Y[0]),z=q;for(let[Y,$,A,O]of _)z=z.slice(0,Y)+A+O+z.slice($);return z}function N_z(q,K){let _={raw:[],ansiC:[],double:[],heredoc:[]};cm1(q,_,!1);let{raw:z,ansiC:Y,double:$,heredoc:A}=_,O=[...z,...Y,...$,...A],w=v_z([...z,...Y,...A]),j=new Set;for(let[P,W]of $)j.add(P),j.add(W-1);let H="";for(let P=0;P<K.length;P++){if(w.has(P))continue;if(j.has(P))continue;H+=K[P]}let J=k_z(K,O),M=[];for(let[P,W]of z)M.push([P,W,"'","'"]);for(let[P,W]of Y)M.push([P,W,"$'","'"]);for(let[P,W]of $)M.push([P,W,'"','"']);for(let[P,W]of A)M.push([P,W,"",""]);let X=V_z(K,M);return{withDoubleQuotes:H,fullyUnquoted:J,unquotedKeepQuoteChars:X}}function y_z(q,K){let _=q,z=[],Y=[],$=!1,A=!1,O=!1;function w(j){for(let H of j.children){if(!H)continue;if(H.type==="list")for(let J of H.children){if(!J)continue;if(J.type==="&&"||J.type==="||")z.push(J.type);else if(J.type==="list"||J.type==="redirected_statement")w({...j,children:[J]});else if(J.type==="pipeline")O=!0,Y.push(J.text);else if(J.type==="subshell")$=!0,Y.push(J.text);else if(J.type==="compound_statement")A=!0,Y.push(J.text);else Y.push(J.text)}else if(H.type===";")z.push(";");else if(H.type==="pipeline")O=!0,Y.push(H.text);else if(H.type==="subshell")$=!0,Y.push(H.text);else if(H.type==="compound_statement")A=!0,Y.push(H.text);else if(H.type==="command"||H.type==="declaration_command"||H.type==="variable_assignment")Y.push(H.text);else if(H.type==="redirected_statement"){let J=!1;for(let M of H.children){if(!M||M.type==="file_redirect")continue;J=!0,w({...H,children:[M]})}if(!J)Y.push(H.text)}else if(H.type==="negated_command")Y.push(H.text),w(H);else if(H.type==="if_statement"||H.type==="while_statement"||H.type==="for_statement"||H.type==="case_statement"||H.type==="function_definition")Y.push(H.text),w(H)}}if(w(_),Y.length===0)Y.push(K);return{hasCompoundOperators:z.length>0,hasPipeline:O,hasSubshell:$,hasCommandGroup:A,operators:z,segments:Y}}function E_z(q){let K=q;function _(z){if(z.type===";"||z.type==="&&"||z.type==="||")return!0;if(z.type==="list")return!0;for(let Y of z.children)if(Y&&_(Y))return!0;return!1}return _(K)}function L_z(q){let K=q,_=!1,z=!1,Y=!1,$=!1,A=!1;function O(w){switch(w.type){case"command_substitution":_=!0;break;case"process_substitution":z=!0;break;case"expansion":Y=!0;break;case"heredoc_redirect":$=!0;break;case"comment":A=!0;break}for(let j of w.children)if(j)O(j)}return O(K),{hasCommandSubstitution:_,hasProcessSubstitution:z,hasParameterExpansion:Y,hasHeredoc:$,hasComment:A}}function gN4(q,K){return{quoteContext:N_z(q,K),compoundStructure:y_z(q,K),hasActualOperatorNodes:E_z(q),dangerousPatterns:L_z(q)}}class UN4{originalCommand;constructor(q){this.originalCommand=q}toString(){return this.originalCommand}getPipeSegments(){try{let q=LV6(this.originalCommand),K=[],_=[];for(let z of q)if(z==="|"){if(_.length>0)K.push(_.join(" ")),_=[]}else _.push(z);if(_.length>0)K.push(_.join(" "));return K.length>0?K:[this.originalCommand]}catch{return[this.originalCommand]}}withoutOutputRedirections(){if(!this.originalCommand.includes(">"))return this.originalCommand;let{commandWithoutRedirections:q,redirections:K}=SL(this.originalCommand);return K.length>0?q:this.originalCommand}getOutputRedirections(){let{redirections:q}=SL(this.originalCommand);return q}getTreeSitterAnalysis(){return null}}function lm1(q,K){K(q);for(let _ of q.children)lm1(_,K)}function R_z(q){let K=[];return lm1(q,(_)=>{if(_.type==="pipeline"){for(let z of _.children)if(z.type==="|")K.push(z.startIndex)}}),K.sort((_,z)=>_-z)}function h_z(q){let K=[];return lm1(q,(_)=>{if(_.type==="file_redirect"){let z=_.children,Y=z.find((A)=>A.type===">"||A.type===">>"),$=z.find((A)=>A.type==="word");if(Y&&$)K.push({startIndex:_.startIndex,endIndex:_.endIndex,target:$.text,operator:Y.type})}}),K}class QN4{originalCommand;commandBytes;pipePositions;redirectionNodes;treeSitterAnalysis;constructor(q,K,_,z){this.originalCommand=q,this.commandBytes=Buffer.from(q,"utf8"),this.pipePositions=K,this.redirectionNodes=_,this.treeSitterAnalysis=z}toString(){return this.originalCommand}getPipeSegments(){if(this.pipePositions.length===0)return[this.originalCommand];let q=[],K=0;for(let z of this.pipePositions){let Y=this.commandBytes.subarray(K,z).toString("utf8").trim();if(Y)q.push(Y);K=z+1}let _=this.commandBytes.subarray(K).toString("utf8").trim();if(_)q.push(_);return q}withoutOutputRedirections(){if(this.redirectionNodes.length===0)return this.originalCommand;let q=[...this.redirectionNodes].sort((_,z)=>z.startIndex-_.startIndex),K=this.commandBytes;for(let _ of q)K=Buffer.concat([K.subarray(0,_.startIndex),K.subarray(_.endIndex)]);return K.toString("utf8").trim().replace(/\s+/g," ")}getOutputRedirections(){return this.redirectionNodes.map(({target:q,operator:K})=>({target:q,operator:K}))}getTreeSitterAnalysis(){return this.treeSitterAnalysis}}function nm1(q,K){let _=R_z(K),z=h_z(K),Y=gN4(K,q);return new QN4(q,_,z,Y)}async function C_z(q){if(!q)return null;if(await S_z())try{let{parseCommand:_}=await Promise.resolve().then(() => (qw6(),Tm1)),z=await _(q);if(z)return nm1(q,z.rootNode)}catch{}return new UN4(q)}var S_z,FN4,kN8,Aw6;var im1=y(()=>{F4();SG();S_z=_1(async()=>{try{let{parseCommand:q}=await Promise.resolve().then(() => (qw6(),Tm1));return await q("echo test")!==null}catch{return!1}});Aw6={parse(q){if(q===FN4&&kN8!==void 0)return kN8;return FN4=q,kN8=C_z(q),kN8}}});function dN4(q,K=!1){let _="",z="",Y="",$=!1,A=!1,O=!1;for(let w=0;w<q.length;w++){let j=q[w];if(O){if(O=!1,!$)_+=j;if(!$&&!A)z+=j;if(!$&&!A)Y+=j;continue}if(j==="\\"&&!$){if(O=!0,!$)_+=j;if(!$&&!A)z+=j;if(!$&&!A)Y+=j;continue}if(j==="'"&&!A){$=!$,Y+=j;continue}if(j==='"'&&!$){if(A=!A,Y+=j,!K)continue}if(!$)_+=j;if(!$&&!A)z+=j;if(!$&&!A)Y+=j}return{withDoubleQuotes:_,fullyUnquoted:z,unquotedKeepQuoteChars:Y}}function cN4(q){return q.replace(/\s+2\s*>&\s*1(?=\s|$)/g,"").replace(/[012]?\s*>\s*\/dev\/null(?=\s|$)/g,"").replace(/\s*<\s*\/dev\/null(?=\s|$)/g,"")}function I_z(q,K){if(K.length!==1)throw Error("hasUnescapedChar only works with single characters");let _=0;while(_<q.length){if(q[_]==="\\"&&_+1<q.length){_+=2;continue}if(q[_]===K)return!0;_++}return!1}function lN4(q){if(!q.originalCommand.trim())return{behavior:"allow",updatedInput:{command:q.originalCommand},decisionReason:{type:"other",reason:"Empty command is safe"}};return{behavior:"passthrough",message:"Command is not empty"}}function nN4(q){let{originalCommand:K}=q,_=K.trim();if(/^\s*\t/.test(K))return d("tengu_bash_security_check_triggered",{checkId:t9.INCOMPLETE_COMMANDS,subId:1}),{behavior:"ask",message:"Command appears to be an incomplete fragment (starts with tab)"};if(_.startsWith("-"))return d("tengu_bash_security_check_triggered",{checkId:t9.INCOMPLETE_COMMANDS,subId:2}),{behavior:"ask",message:"Command appears to be an incomplete fragment (starts with flags)"};if(/^\s*(&&|\|\||;|>>?|<)/.test(K))return d("tengu_bash_security_check_triggered",{checkId:t9.INCOMPLETE_COMMANDS,subId:3}),{behavior:"ask",message:"Command appears to be a continuation line (starts with operator)"};return{behavior:"passthrough",message:"Command appears complete"}}function u_z(q){if(!rm1.test(q))return!1;let K=/\$\(cat[ \t]*<<(-?)[ \t]*(?:'+([A-Za-z_]\w*)'+|\\([A-Za-z_]\w*))/g,_,z=[];while((_=K.exec(q))!==null){let w=_[2]||_[3];if(w)z.push({start:_.index,operatorEnd:_.index+_[0].length,delimiter:w,isDash:_[1]==="-"})}if(z.length===0)return!1;let Y=[];for(let{start:w,operatorEnd:j,delimiter:H,isDash:J}of z){let M=q.slice(j),X=M.indexOf(` |
| 1668 | `);if(X===-1)return!1;let P=M.slice(0,X);if(!/^[ \t]*$/.test(P))return!1;let W=j+X+1,f=q.slice(W).split(` |
| 1669 | `),G=-1,Z=-1,T=-1;for(let V=0;V<f.length;V++){let E=f[V],S=J?E.replace(/^\t*/,""):E;if(S===H){G=V;let R=f[V+1];if(R===void 0)return!1;let x=R.match(/^([ \t]*)\)/);if(!x)return!1;Z=V+1,T=x[1].length;break}if(S.startsWith(H)){let R=S.slice(H.length),x=R.match(/^([ \t]*)\)/);if(x){G=V,Z=V,T=(J?E.match(/^\t*/)?.[0]??"":"").length+H.length+x[1].length;break}if(/^[)}`|&;(<>]/.test(R))return!1}}if(G===-1)return!1;let v=W;for(let V=0;V<Z;V++)v+=f[V].length+1;v+=T+1,Y.push({start:w,end:v})}for(let w of Y)for(let j of Y){if(j===w)continue;if(j.start>w.start&&j.start<w.end)return!1}let $=[...Y].sort((w,j)=>j.start-w.start),A=q;for(let{start:w,end:j}of $)A=A.slice(0,w)+A.slice(j);if(A.trim().length>0){let w=Math.min(...Y.map((H)=>H.start));if(q.slice(0,w).trim().length===0)return!1}if(!/^[a-zA-Z0-9 \t"'.\-/_@=,:+~]*$/.test(A))return!1;if(Po6(A).behavior!=="passthrough")return!1;return!0}function iN4(q){if(!rm1.test(q))return null;let K=/\$\(cat[ \t]*<<(-?)[ \t]*(?:'+([A-Za-z_]\w*)'+|\\([A-Za-z_]\w*))/g,_=q,z=!1,Y,$=[];while((Y=K.exec(q))!==null){if(Y.index>0&&q[Y.index-1]==="\\")continue;let A=Y[2]||Y[3];if(!A)continue;let O=Y[1]==="-",w=Y.index+Y[0].length,j=q.slice(w),H=j.indexOf(` |
no test coverage detected