tweakcc-fixed 2.7.36 → 2.7.38

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/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  [![npm](https://img.shields.io/npm/v/tweakcc-fixed?color=cb3837&label=npm&logo=npm&style=flat-square)](https://www.npmjs.com/package/tweakcc-fixed)
8
8
  [![downloads](https://img.shields.io/npm/dt/tweakcc-fixed?color=cb3837&style=flat-square)](https://www.npmjs.com/package/tweakcc-fixed)
9
- [![Claude Code](https://img.shields.io/badge/Claude%20Code-2.0.98%20%E2%86%92%202.1.239-d97757?style=flat-square)](https://github.com/anthropics/claude-code)
9
+ [![Claude Code](https://img.shields.io/badge/Claude%20Code-2.0.98%20%E2%86%92%202.1.241-d97757?style=flat-square)](https://github.com/anthropics/claude-code)
10
10
  [![license](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](#credit--license)
11
11
 
12
12
  **[Install](#install) · [Customize](#what-you-can-customize) · [The fork](#what-this-fork-adds) · [How it works](#how-it-works)**
@@ -57,7 +57,7 @@ The biggest difference is coverage. Its extractor pulls over four times the prom
57
57
 
58
58
  | | tweakcc-fixed | upstream |
59
59
  | ---------------------------- | :-----------: | :-------: |
60
- | Prompt sites (CC 2.1.239) | **5,069** | 695 |
60
+ | Prompt sites (CC 2.1.241) | **5,069** | 695 |
61
61
  | Unique prompt IDs | **4,528** | 690 |
62
62
  | Patches | **61** | 45 |
63
63
  | Overrides on native installs | **yes** | gated off |
@@ -1,4 +1,4 @@
1
- import{createRequire as e}from"node:module";import t from"chalk";import*as n from"node:os";import r,{EOL as i}from"node:os";import*as a from"node:fs/promises";import o from"node:fs/promises";import*as s from"node:fs";import c,{createReadStream as l}from"node:fs";import*as u from"node:path";import d from"node:path";import*as f from"fs";import*as p from"path";import*as m from"os";import*as h from"child_process";import*as g from"crypto";import{spawnSync as _}from"node:child_process";import v from"gray-matter";import{fileURLToPath as y}from"node:url";import{Worker as b}from"node:worker_threads";import{diffWordsWithSpace as x}from"diff";import*as S from"node:crypto";let C=null;async function w(){if(C!==null)return C;try{return await import(`node-lief`),C=await import(`./nativeInstallation-ByYYdX4K.mjs`),C}catch(e){return q(`Error loading native installation module: ${e instanceof Error?e.message:String(e)}`),e instanceof Error&&q(e),null}}async function T(e,t){let n=await w();return n?n.extractClaudeJsFromNativeInstallation(e,t):{data:null,clearBytecode:!1,error:`node-lief native module unavailable on this platform/runtime (cannot extract from native installs)`}}async function E(e,t,n,r){let i=await w();if(!i)throw Error("`repackNativeInstallation()` called but `node-lief` is not available. This is unexpected - `extractClaudeJsFromNativeInstallation()` should have been called first.");i.repackNativeInstallation(e,t,n,r)}async function D(e){let t=await w();return t?t.resolveNixBinaryWrapper(e):null}const O=`You are a difficulty router for an AI coding agent. Each turn you get a compact running SUMMARY of the session, a CONTEXT block (the model in use and the level you assigned last turn), the most recent exchange (the previous user message and the assistant reply), and the user NEW message. Do two things and output ONLY a JSON object with the keys level and summary - no prose, no code fence.
1
+ import{createRequire as e}from"node:module";import t from"chalk";import*as n from"node:os";import r,{EOL as i}from"node:os";import*as a from"node:fs/promises";import o from"node:fs/promises";import*as s from"node:fs";import c,{createReadStream as l}from"node:fs";import*as u from"node:path";import d from"node:path";import*as f from"fs";import*as p from"path";import*as m from"os";import*as h from"child_process";import*as g from"crypto";import{spawnSync as _}from"node:child_process";import v from"gray-matter";import{fileURLToPath as y}from"node:url";import{Worker as b}from"node:worker_threads";import{diffWordsWithSpace as x}from"diff";import*as S from"node:crypto";let C=null;async function w(){if(C!==null)return C;try{return await import(`node-lief`),C=await import(`./nativeInstallation-BrGdwPlR.mjs`),C}catch(e){return q(`Error loading native installation module: ${e instanceof Error?e.message:String(e)}`),e instanceof Error&&q(e),null}}async function T(e,t){let n=await w();return n?n.extractClaudeJsFromNativeInstallation(e,t):{data:null,clearBytecode:!1,error:`node-lief native module unavailable on this platform/runtime (cannot extract from native installs)`}}async function E(e,t,n,r){let i=await w();if(!i)throw Error("`repackNativeInstallation()` called but `node-lief` is not available. This is unexpected - `extractClaudeJsFromNativeInstallation()` should have been called first.");i.repackNativeInstallation(e,t,n,r)}async function D(e){let t=await w();return t?t.resolveNixBinaryWrapper(e):null}const O=`You are a difficulty router for an AI coding agent. Each turn you get a compact running SUMMARY of the session, a CONTEXT block (the model in use and the level you assigned last turn), the most recent exchange (the previous user message and the assistant reply), and the user NEW message. Do two things and output ONLY a JSON object with the keys level and summary - no prose, no code fence.
2
2
 
3
3
  # level
4
4
  Pick the integer effort level (0 = least effort, {MAX} = most) for the NEW message, judged IN CONTEXT of the summary, the context block, and the recent exchange:
@@ -53,7 +53,7 @@ No human input has been received since the last genuine user message in this con
53
53
  {{content}}`,apply(e,t,n){let r=e.match(/([$\w]+)=`\$\{"\[SYSTEM NOTIFICATION - NOT USER INPUT\]"\}\nThis is an automated background-task event, NOT a message from the user\.\nDo NOT interpret this as user acknowledgement, confirmation, or response to any pending question\.\n[^`]*`/);if(r&&r.index!==void 0){let i=n?``:t.replace(/\$\{H\}/g,``),a=`${r[1]}=\`${i}\``,o=e.slice(0,r.index)+a+e.slice(r.index+r[0].length);return H(e,o,a,r.index,r.index+r[0].length),o}return P(e,/(case"task-notification":return|function [$\w]+\([$\w]+\)\{return)`\[SYSTEM NOTIFICATION - NOT USER INPUT\]\nThis is an automated background-task event, NOT a message from the user\.\nDo NOT interpret this as user acknowledgement, confirmation, or response to any pending question\.\n\n\$\{([$\w]+)\}`(;|\})/,e=>{let[,r,i,a]=e;return n?`${r}\`\${${i}}\`${a}`:`${r}\`${t.replace(/\$\{H\}/g,`\${${i}}`)}\`${a}`},`task-notification-framing`,e=>/case"task-notification":return`\$\{[$\w]+\}`;/.test(e))}},{id:`user-sent-new-message`,name:`User-sent-new-message wrapper`,description:`Wraps a user message that arrives mid-turn. Carries the "This is how Claude Code surfaces messages the user sends mid-turn … Address the message above as you continue this turn" framing (reworded in CC 2.1.205 from the old imperative "IMPORTANT: … you MUST address … Do not ignore it"). Empty .md = no wrapping (just the message text).`,shadows:[`system-reminder-mid-turn-user-message-surfacing`],placeholders:{message:"${H}"},defaultBody:`The user sent a new message while you were working:
54
54
  {{message}}
55
55
 
56
- This is how Claude Code surfaces messages the user sends mid-turn — within the running turn, often alongside the next tool result, rather than as a separate conversation turn. Address the message above as you continue this turn.`,apply(e,t,n){return P(e,/((?:case"auto-continuation":)?case"human":case void 0:(?:default:)?)return`(?:The user sent a new message while you were working:\n|\$\{[$\w]+\})\$\{([$\w]+)\}\n\n(?:This is how Claude Code surfaces messages the user sends mid-turn \\u2014 within the running turn, often alongside the next tool result, rather than as a separate conversation turn\. Address the message above as you continue this turn\.|IMPORTANT: After completing your current task, you MUST address the user's message above\. Do not ignore it\.)`/,e=>{let[,r,i]=e;return n?`${r}return\`\${${i}}\``:`${r}return\`${t.replace(/\$\{H\}/g,`\${${i}}`)}\``},`user-sent-new-message`,e=>/(?:case"auto-continuation":)?case"human":case void 0:(?:default:)?return`\$\{[$\w]+\}`/.test(e))}},{id:`stop-hook-session-goal`,name:`Stop-hook session-goal reminder`,description:`Fires when /goal sets a session-scoped stop hook. Carries the "do not pause to ask" framing. Empty .md = silent goal activation (just the condition value used internally).`,placeholders:{condition:"${H}"},defaultBody:'A session-scoped Stop hook is now active with condition: "{{condition}}". Briefly acknowledge the goal, then immediately start (or continue) working toward it — treat the condition itself as your directive and do not pause to ask the user what to do. The hook will block stopping until the condition holds. It auto-clears once the condition is met — do not tell the user to run `/goal clear` after success; that\'s only for clearing a goal early.',apply(e,t,n){return P(e,/([$\w]+)=\(([$\w]+)\)=>`A session-scoped Stop hook is now active with condition: "\$\{\2\}"\. Briefly acknowledge the goal, then immediately start \(or continue\) working toward it[\s\S]*?after success; that's only for clearing a goal early\.`/,e=>{let[,r,i]=e;return n?`${r}=(${i})=>""`:`${r}=(${i})=>\`${t.replace(/\$\{H\}/g,`\${${i}}`)}\``},`stop-hook-session-goal`,e=>/[$\w]+=\([$\w]+\)=>""/.test(e))}},{id:`mcp-per-server-router`,name:`MCP per-server instruction router`,description:`Patches CC's MCP instruction assembly to consult ~/.tweakcc/system-reminders/mcp-<server-name>.md at runtime. Empty body in that file drops the server's block. Body containing {{server_instructions}} resolves to the server's pristine instructions. Custom body replaces. THIS .md does nothing on its own — it just enables per-server .md files. Empty body = disable this routing (servers use pristine instructions verbatim).`,placeholders:{},defaultBody:`This file is a marker that enables per-MCP-server overrides. Edit per-server content in mcp-<server-name>.md alongside this file. Leave this file with content (any content) to enable routing; empty it to disable.`,apply(e,t,n){if(n)return e;let r=e.match(/for\(let ([$\w]+) of ([$\w]+)\)if\(\1\.instructions\)([$\w]+)\.set\(\1\.name,`## \$\{\1\.name\}\n\$\{\1\.instructions\}`\)((?:,[$\w]+\.set\((?:[^()]|\([^()]*\))*\))*);/);if(!r||r.index===void 0)return e.includes(`__tweakccMcpOverride`)?e:(console.error(`patch: reminder mcp-per-server-router: failed to find MCP assembly loop`),null);let[i,a,o,s,c]=r,l=`function __tweakccMcpOverride(_n,_d){try{let _f=require('fs'),_p=require('os').homedir()+'/.tweakcc/system-reminders/mcp-'+_n+'.md';let _r=_f.readFileSync(_p,'utf8');let _m=_r.match(/-->\\s*([\\s\\S]*?)\\s*\$/);if(!_m)return _d;let _b=_m[1].trim();if(_b==='')return null;return _b.replace(/\\{\\{server_instructions\\}\\}/g,_d||'')}catch{return _d}}for(let ${a} of ${o}){let _c=__tweakccMcpOverride(${a}.name,${a}.instructions);if(_c){${s}.set(${a}.name,\`## \${${a}.name}\n\${_c}\`)${[...(c||``).matchAll(/[$\w]+\.set\((?:[^()]|\([^()]*\))*\)/g)].map(e=>`;`+e[0].split(`${a}.instructions`).join(`_c`)).join(``)}}}`,u=e.slice(0,r.index)+l+e.slice(r.index+i.length);return H(e,u,l,r.index,r.index+i.length),u}}],Tt=async()=>{let e=[u.join(n.homedir(),`.claude.json`),u.join(n.homedir(),`.claude`,`mcp.json`)];for(let t of e)try{let e=await a.readFile(t,`utf8`),n=JSON.parse(e);if(n.mcpServers&&typeof n.mcpServers==`object`)return Object.keys(n.mcpServers)}catch{}return[]},Et=async(e,t)=>{let n=[],r=e,i=await Tt();for(let e of i)await pt(`mcp-${e}`,`MCP server: ${e}`,`Instructions block content for MCP server "${e}". {{server_instructions}} expands at runtime to the server's pristine instructions. Empty body drops the server's block from the model's context. Custom body replaces it.`,t,[`server_instructions`],`{{server_instructions}}`);for(let e of wt){let i=await pt(e.id,e.name,e.description,t,Object.keys(e.placeholders),e.defaultBody),a=await ft(e.id);if(!a){n.push({id:e.id,name:e.name,description:e.description,state:`default`,applied:!1,failed:!1,skipped:!0,details:`override file missing after ensure (unexpected)`});continue}let{result:o,errors:s}=mt(a.body,e.placeholders);if(s.length>0){n.push({id:e.id,name:e.name,description:e.description,state:`override`,applied:!1,failed:!0,skipped:!1,details:s.join(`; `)});continue}let c=e.apply(r,o,a.isSuppressed);if(c===null){n.push({id:e.id,name:e.name,description:e.description,state:a.isSuppressed?`suppressed`:`override`,applied:!1,failed:!0,skipped:!1,details:`patch function returned null`});continue}let l=c!==r;r=c;let u;u=a.isSuppressed?`suppressed`:a.body===e.defaultBody.trim()?`default`:`override`,n.push({id:e.id,name:e.name,description:e.description,state:u,applied:l,failed:!1,skipped:!1,details:i?`seeded default file`:void 0})}return{content:r,results:n}};let Dt=null;const Ot=async()=>{if(Dt)return Dt;let e=new Set,t=[Q,Cc];for(let n of t){let t;try{t=await a.readdir(n)}catch{continue}if(Array.isArray(t))for(let r of t){if(!r.endsWith(`.md`))continue;let t;try{t=await a.readFile(p.join(n,r),`utf8`)}catch{continue}let i=v(t,{delimiters:[`<!--`,`-->`]}).data?.shadows;if(Array.isArray(i))for(let t of i)typeof t==`string`&&t&&e.add(t)}}for(let t of wt)if(Array.isArray(t.shadows))for(let n of t.shadows)typeof n==`string`&&n&&e.add(n);return Dt=e,e};let kt=null;const At=async()=>{if(kt)return kt;let e=new Set,t=qe();if(t){let n;try{n=await a.readdir(t)}catch{n=[]}for(let r of n)if(!(!r.startsWith(`prompts-`)||!r.endsWith(`.json`)))try{let n=await a.readFile(p.join(t,r),`utf8`),i=JSON.parse(n);for(let t of i.prompts??[])for(let n of Object.values(t.identifierMap??{}))n&&e.add(n)}catch{continue}}if(e.size===0)try{let t=await import(`./identifierUnion-D_nDIGbh.mjs`);for(let n of t.IDENTIFIER_UNION)e.add(n)}catch{}return kt=e,e},jt=e=>{let t=v(e,{delimiters:[`<!--`,`-->`]}),{name:n,description:r,ccVersion:i,variables:a}=t.data,o=0,s=e.indexOf(t.content);return s>=0&&(o=e.slice(0,s).split(`
56
+ This is how Claude Code surfaces messages the user sends mid-turn — within the running turn, often alongside the next tool result, rather than as a separate conversation turn. Address the message above as you continue this turn.`,apply(e,t,n){return P(e,/((?:case"auto-continuation":)?case"human":case void 0:(?:default:)?)return`(?:The user sent a new message while you were working:\n|\$\{[$\w]+\})\$\{([$\w]+)\}\n\n(?:This is how Claude Code surfaces messages the user sends mid-turn \\u2014 within the running turn, often alongside the next tool result, rather than as a separate conversation turn\. Address the message above as you continue this turn\.|IMPORTANT: After completing your current task, you MUST address the user's message above\. Do not ignore it\.)`/,e=>{let[,r,i]=e;return n?`${r}return\`\${${i}}\``:`${r}return\`${t.replace(/\$\{H\}/g,`\${${i}}`)}\``},`user-sent-new-message`,e=>/(?:case"auto-continuation":)?case"human":case void 0:(?:default:)?return`\$\{[$\w]+\}`/.test(e))}},{id:`stop-hook-session-goal`,name:`Stop-hook session-goal reminder`,description:`Fires when /goal sets a session-scoped stop hook. Carries the "do not pause to ask" framing. Empty .md = silent goal activation (just the condition value used internally).`,placeholders:{condition:"${H}"},defaultBody:'A session-scoped Stop hook is now active with condition: "{{condition}}". Briefly acknowledge the goal, then immediately start (or continue) working toward it — treat the condition itself as your directive and do not pause to ask the user what to do. The hook will block stopping until the condition holds. It auto-clears once the condition is met — do not tell the user to run `/goal clear` after success; that\'s only for clearing a goal early.',apply(e,t,n){return P(e,/([$\w]+)=\(([$\w]+)\)=>`A session-scoped Stop hook is now active with condition: "\$\{\2\}"\. Briefly acknowledge the goal, then immediately start \(or continue\) working toward it[\s\S]*?after success; that's only for clearing a goal early\.`/,e=>{let[,r,i]=e;return n?`${r}=(${i})=>""`:`${r}=(${i})=>\`${t.replace(/\$\{H\}/g,`\${${i}}`)}\``},`stop-hook-session-goal`,e=>/[$\w]+=\([$\w]+\)=>""/.test(e))}},{id:`mcp-per-server-router`,name:`MCP per-server instruction router`,description:`Patches CC's MCP instruction assembly to consult ~/.tweakcc/system-reminders/mcp-<server-name>.md at runtime. Empty body in that file drops the server's block. Body containing {{server_instructions}} resolves to the server's pristine instructions. Custom body replaces. THIS .md does nothing on its own — it just enables per-server .md files. Empty body = disable this routing (servers use pristine instructions verbatim).`,placeholders:{},defaultBody:`This file is a marker that enables per-MCP-server overrides. Edit per-server content in mcp-<server-name>.md alongside this file. Leave this file with content (any content) to enable routing; empty it to disable.`,apply(e,t,n){if(n)return e;let r=e.match(/for\(let ([$\w]+) of ([$\w]+)\)if\(\1\.instructions\)([$\w]+)\.set\(\1\.name,`## \$\{\1\.name\}\n\$\{\1\.instructions\}`\)((?:,[$\w]+\.set\((?:[^()]|\([^()]*\))*\))*);/);if(!r||r.index===void 0)return e.includes(`__tweakccMcpOverride`)?e:(console.error(`patch: reminder mcp-per-server-router: failed to find MCP assembly loop`),null);let[i,a,o,s,c]=r,l=`function __tweakccMcpOverride(_n,_d){try{let _f=require('fs'),_p=require('os').homedir()+'/.tweakcc/system-reminders/mcp-'+_n+'.md';let _r=_f.readFileSync(_p,'utf8');let _m=_r.match(/-->\\s*([\\s\\S]*?)\\s*\$/);if(!_m)return _d;let _b=_m[1].trim();if(_b==='')return null;return _b.replace(/\\{\\{server_instructions\\}\\}/g,_d||'')}catch{return _d}}for(let ${a} of ${o}){let _c=__tweakccMcpOverride(${a}.name,${a}.instructions);if(_c){${s}.set(${a}.name,\`## \${${a}.name}\n\${_c}\`)${[...(c||``).matchAll(/[$\w]+\.set\((?:[^()]|\([^()]*\))*\)/g)].map(e=>`;`+e[0].split(`${a}.instructions`).join(`_c`)).join(``)}}}`,u=e.slice(0,r.index)+l+e.slice(r.index+i.length);return H(e,u,l,r.index,r.index+i.length),u}}],Tt=async()=>{let e=[u.join(n.homedir(),`.claude.json`),u.join(n.homedir(),`.claude`,`mcp.json`)];for(let t of e)try{let e=await a.readFile(t,`utf8`),n=JSON.parse(e);if(n.mcpServers&&typeof n.mcpServers==`object`)return Object.keys(n.mcpServers)}catch{}return[]},Et=async(e,t)=>{let n=[],r=e,i=await Tt();for(let e of i)await pt(`mcp-${e}`,`MCP server: ${e}`,`Instructions block content for MCP server "${e}". {{server_instructions}} expands at runtime to the server's pristine instructions. Empty body drops the server's block from the model's context. Custom body replaces it.`,t,[`server_instructions`],`{{server_instructions}}`);for(let e of wt){let i=await pt(e.id,e.name,e.description,t,Object.keys(e.placeholders),e.defaultBody),a=await ft(e.id);if(!a){n.push({id:e.id,name:e.name,description:e.description,state:`default`,applied:!1,failed:!1,skipped:!0,details:`override file missing after ensure (unexpected)`});continue}let{result:o,errors:s}=mt(a.body,e.placeholders);if(s.length>0){n.push({id:e.id,name:e.name,description:e.description,state:`override`,applied:!1,failed:!0,skipped:!1,details:s.join(`; `)});continue}let c=e.apply(r,o,a.isSuppressed);if(c===null){n.push({id:e.id,name:e.name,description:e.description,state:a.isSuppressed?`suppressed`:`override`,applied:!1,failed:!0,skipped:!1,details:`patch function returned null`});continue}let l=c!==r;r=c;let u;u=a.isSuppressed?`suppressed`:a.body===e.defaultBody.trim()?`default`:`override`,n.push({id:e.id,name:e.name,description:e.description,state:u,applied:l,failed:!1,skipped:!1,details:i?`seeded default file`:void 0})}return{content:r,results:n}};let Dt=null;const Ot=async()=>{if(Dt)return Dt;let e=new Set,t=[Q,Cc];for(let n of t){let t;try{t=await a.readdir(n)}catch{continue}if(Array.isArray(t))for(let r of t){if(!r.endsWith(`.md`))continue;let t;try{t=await a.readFile(p.join(n,r),`utf8`)}catch{continue}let i=v(t,{delimiters:[`<!--`,`-->`]}).data?.shadows;if(Array.isArray(i))for(let t of i)typeof t==`string`&&t&&e.add(t)}}for(let t of wt)if(Array.isArray(t.shadows))for(let n of t.shadows)typeof n==`string`&&n&&e.add(n);return Dt=e,e};let kt=null;const At=async()=>{if(kt)return kt;let e=new Set,t=qe();if(t){let n;try{n=await a.readdir(t)}catch{n=[]}for(let r of n)if(!(!r.startsWith(`prompts-`)||!r.endsWith(`.json`)))try{let n=await a.readFile(p.join(t,r),`utf8`),i=JSON.parse(n);for(let t of i.prompts??[])for(let n of Object.values(t.identifierMap??{}))n&&e.add(n)}catch{continue}}if(e.size===0)try{let t=await import(`./identifierUnion-BgzUd_JP.mjs`);for(let n of t.IDENTIFIER_UNION)e.add(n)}catch{}return kt=e,e},jt=e=>{let t=v(e,{delimiters:[`<!--`,`-->`]}),{name:n,description:r,ccVersion:i,variables:a}=t.data,o=0,s=e.indexOf(t.content);return s>=0&&(o=e.slice(0,s).split(`
57
57
  `).length-1),{name:n||``,description:r||``,ccVersion:i||``,variables:a||[],content:t.content,contentLineOffset:o}},Mt=(e,t)=>v.stringify(``,t,{delimiters:[`<!--`,`-->`]}).replace(/\n$/,``)+(e.endsWith(`
58
58
  `)?e:e+`
59
59
  `),Nt=(e,t,n)=>{let r=t||I(e.pieces,e.identifiers,e.identifierMap),i=Object.keys(e.identifierMap).length>0?[...new Set(Object.values(e.identifierMap))]:void 0,a={name:e.name,description:e.description,ccVersion:e.version};if(i&&i.length>0&&(a.variables=i),n)for(let[e,t]of Object.entries(n))e in a||(a[e]=t);return Mt(r,a)},Pt=async e=>{let t={};try{let n=It(e),r=v(await a.readFile(n,`utf8`),{delimiters:[`<!--`,`-->`]}),i=new Set([`name`,`description`,`ccVersion`,`variables`]);for(let[e,n]of Object.entries(r.data))i.has(e)||(t[e]=n)}catch{}return t},I=(e,t,n)=>{let r=``;for(let i=0;i<e.length;i++)if(r+=e[i],i<t.length){let e=t[i],a=n[String(e)]||`UNKNOWN_${e}`;r+=a}return r},Ft=(e,t)=>{let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);for(let e=0;e<Math.max(n.length,r.length);e++){let t=n[e]||0,i=r[e]||0;if(t<i)return-1;if(t>i)return 1}return 0},It=e=>p.join(Q,`${e}.md`),Lt=async e=>{try{return await a.access(It(e)),!0}catch{return!1}},Rt=async e=>{let t=It(e);return jt(await a.readFile(t,`utf-8`))},zt=async(e,t)=>{let n=It(e);await a.writeFile(n,t,`utf-8`)},Bt=async(e,t)=>{let n=It(e),r=await a.readFile(n,`utf-8`),i=v(r,{delimiters:[`<!--`,`-->`]}),o=Object.keys(t).length>0?[...new Set(Object.values(t))]:void 0,s=new Set([`name`,`description`,`ccVersion`,`variables`]),c={name:i.data.name,description:i.data.description,ccVersion:i.data.ccVersion};o&&o.length>0&&(c.variables=o);for(let[e,t]of Object.entries(i.data))s.has(e)||(c[e]=t);let l=Mt(i.content,c);l!==r&&await zt(e,l)},Vt=(e,t)=>{let n=e=>e.split(/(\s+)/),r=n(e),i=n(t),a=r.length,o=i.length,s=Array(a+1).fill(0).map(()=>Array(o+1).fill(0));for(let e=1;e<=a;e++)for(let t=1;t<=o;t++)r[e-1]===i[t-1]?s[e][t]=s[e-1][t-1]+1:s[e][t]=Math.max(s[e-1][t],s[e][t-1]);let c=Array(a).fill(!1),l=Array(o).fill(!1),u=a,d=o;for(;u>0||d>0;)u>0&&d>0&&r[u-1]===i[d-1]?(u--,d--):d>0&&(u===0||s[u][d-1]>=s[u-1][d])?(l[d-1]=!0,d--):u>0&&(c[u-1]=!0,u--);let f=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#039;`),p=``;for(let e=0;e<r.length;e++){let t=f(r[e]);p+=c[e]?`<mark>${t}</mark>`:t}let m=``;for(let e=0;e<i.length;e++){let t=f(i[e]);m+=l[e]?`<mark>${t}</mark>`:t}return{oldHtml:p,newHtml:m}},Ht=(e,t)=>{let n=e.length,r=t.length,i=Array(n+1).fill(0).map(()=>Array(r+1).fill(0));for(let a=1;a<=n;a++)for(let n=1;n<=r;n++)e[a-1]===t[n-1]?i[a][n]=i[a-1][n-1]+1:i[a][n]=Math.max(i[a-1][n],i[a][n-1]);let a=[],o=n,s=r,c=[];for(;o>0||s>0;)o>0&&s>0&&e[o-1]===t[s-1]?(c.unshift({type:`unchanged`,line:e[o-1],oldLineNo:o,newLineNo:s}),o--,s--):s>0&&(o===0||i[o][s-1]>=i[o-1][s])?(c.unshift({type:`added`,line:t[s-1],newLineNo:s}),s--):o>0&&(c.unshift({type:`removed`,line:e[o-1],oldLineNo:o}),o--);for(let e=0;e<c.length;e++){let t=c[e],n=c[e+1];if(t.type===`removed`&&n?.type===`added`){let r=Vt(t.line,n.line);a.push({type:`modified`,line:t.line,oldLineNo:t.oldLineNo,newLineNo:n.newLineNo,oldHtml:r.oldHtml,newHtml:r.newHtml}),e++}else a.push(t)}return a},Ut=async(e,t,n,r,i,o,s,c)=>{let l=n.split(`
@@ -1,4 +1,4 @@
1
- import{A as e,C as t,ct as n,f as r,h as i,l as a,lt as o,n as s,p as c,r as l,u,ut as ee,w as d}from"./config-D7qPRqrI.mjs";import{Box as f,Text as p,render as m,useInput as h}from"ink";import g,{useState as _}from"react";import*as te from"node:os";import v from"node:os";import*as y from"node:fs/promises";import b from"node:fs/promises";import x from"path";import{jsx as S,jsxs as C}from"react/jsx-runtime";import w from"which";import{globbySync as T}from"globby";const E=(()=>{let e=[],t=process.platform==`win32`?v.homedir().replace(/\\/g,`/`):v.homedir(),n=`node_modules/@anthropic-ai/claude-code`,r=(t,n=!1)=>{if(n)try{let n=T(t,{onlyFiles:!1});e.push({pattern:t,isGlob:!0,expandedPaths:n})}catch(n){n instanceof Error&&`code`in n&&(n.code===`EACCES`||n.code===`EPERM`)?c(`Permission denied accessing: ${t} (${n.code})`):c(`Error expanding glob pattern "${t}": ${n instanceof Error?n.message:String(n)}`),e.push({pattern:t,isGlob:!0,expandedPaths:[]})}else e.push({pattern:t,isGlob:!1,expandedPaths:[t]})};return r(`${v.homedir()}/.claude/local/${n}`),process.env.NPM_PREFIX&&r(`${process.env.NPM_PREFIX}/lib/${n}`),process.env.N_PREFIX&&r(`${process.env.N_PREFIX}/lib/${n}`),process.env.VOLTA_HOME&&r(`${process.env.VOLTA_HOME}/lib/${n}`),process.env.FNM_DIR&&r(`${process.env.FNM_DIR}/lib/${n}`),process.env.NVM_DIR&&r(`${process.env.NVM_DIR}/lib/${n}`),process.env.NODENV_ROOT&&r(`${process.env.NODENV_ROOT}/versions/*/lib/${n}`,!0),process.env.NVS_HOME&&r(`${process.env.NVS_HOME}/node/*/*/lib/${n}`,!0),process.env.ASDF_DATA_DIR&&r(`${process.env.ASDF_DATA_DIR}/installs/nodejs/*/lib/${n}`,!0),process.platform==`win32`?(r(`${t}/AppData/Local/Volta/tools/image/packages/@anthropic-ai/claude-code/${n}`),r(`${t}/AppData/Roaming/npm/${n}`),r(`${t}/AppData/Roaming/nvm/*/${n}`,!0),r(`${t}/AppData/Local/Yarn/config/global/${n}`),r(`${t}/AppData/Local/pnpm/global/*/${n}`,!0),r(`C:/nvm4w/nodejs/${n}`),r(`${t}/n/versions/node/*/lib/${n}`,!0),r(`${t}/AppData/Roaming/Yarn/config/global/${n}`),r(`${t}/AppData/Roaming/pnpm-global/${n}`),r(`${t}/AppData/Roaming/pnpm-global/*/${n}`,!0),r(`${t}/.bun/install/global/${n}`),r(`${t}/.bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0),r(`${t}/AppData/Local/Bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0),r(`${t}/AppData/Local/fnm_multishells/*/node_modules/${n}`,!0),r(`${t}/AppData/Local/mise/installs/node/*/${n}`,!0),r(`${t}/AppData/Local/mise/installs/npm-anthropic-ai-claude-code/*/${n}`,!0)):(process.platform==`darwin`&&(r(`${t}/Library/${n}`),r(`/opt/local/lib/${n}`),r(`${t}/.bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0),r(`${t}/Library/Caches/bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0)),r(`${t}/.local/lib/${n}`),r(`${t}/.local/share/${n}`),r(`${t}/.npm-global/lib/${n}`),r(`${t}/.npm-packages/lib/${n}`),r(`${t}/.npm/lib/${n}`),r(`${t}/npm/lib/${n}`),r(`/etc/${n}`),r(`/lib/${n}`),r(`/opt/node/lib/${n}`),r(`/usr/lib/${n}`),r(`/usr/local/lib/${n}`),r(`/usr/share/${n}`),r(`/var/lib/${n}`),r(`/opt/homebrew/lib/${n}`),r(`${t}/.linuxbrew/lib/${n}`),r(`${t}/.config/yarn/global/${n}`),r(`${t}/.yarn/global/${n}`),r(`${t}/.bun/install/global/${n}`),r(`${t}/.pnpm-global/${n}`),r(`${t}/.pnpm-global/*/${n}`,!0),r(`${t}/pnpm-global/${n}`),r(`${t}/pnpm-global/*/${n}`,!0),r(`${t}/.local/share/pnpm/global/${n}`),r(`${t}/.local/share/pnpm/global/*/${n}`,!0),r(`${t}/.bun/install/global/${n}`),r(`${t}/.bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0),r(`${t}/.local/share/bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0),r(`/usr/local/n/versions/node/*/lib/${n}`,!0),r(`${t}/n/versions/node/*/lib/${n}`,!0),r(`${t}/n/lib/${n}`),r(`${t}/.volta/tools/image/node/*/lib/${n}`,!0),r(`${t}/.fnm/node-versions/*/installation/lib/${n}`,!0),r(`${t}/.local/state/fnm_multishells/*/lib/${n}`,!0),r(`/usr/local/nvm/versions/node/*/lib/${n}`,!0),r(`/usr/local/share/nvm/versions/node/*/lib/${n}`,!0),r(`${t}/.nvm/versions/node/*/lib/${n}`,!0),r(`${t}/.nodenv/versions/*/lib/${n}`,!0),r(`${t}/.nvs/*/lib/${n}`,!0),r(`${t}/.asdf/installs/nodejs/*/lib/${n}`,!0),process.env.MISE_DATA_DIR&&r(`${process.env.MISE_DATA_DIR}/installs/node/*/lib/${n}`,!0),r(`${t}/.local/share/mise/installs/node/*/lib/${n}`,!0),process.env.MISE_DATA_DIR&&r(`${process.env.MISE_DATA_DIR}/installs/npm-anthropic-ai-claude-code/*/lib/${n}`,!0),r(`${t}/.local/share/mise/installs/npm-anthropic-ai-claude-code/*/lib/${n}`,!0)),process.platform==`win32`&&e.forEach(e=>{e.pattern=e.pattern.replace(/\//g,`\\`),e.expandedPaths=e.expandedPaths.map(e=>e.replace(/\//g,`\\`))}),e})().flatMap(e=>e.expandedPaths),ne=(()=>{let e=process.platform===`win32`?v.homedir().replace(/\\/g,`/`):v.homedir(),t=[],n=(e,n=!1)=>{if(n)try{let n=T(e,{onlyFiles:!0});t.push({pattern:e,isGlob:!0,expandedPaths:n})}catch(n){n instanceof Error&&`code`in n&&(n.code===`EACCES`||n.code===`EPERM`)?c(`Permission denied accessing: ${e} (${n.code})`):c(`Error expanding glob pattern "${e}": ${n instanceof Error?n.message:String(n)}`),t.push({pattern:e,isGlob:!0,expandedPaths:[]})}else t.push({pattern:e,isGlob:!1,expandedPaths:[e]})};if(n(`${e}/.local/bin/claude`),process.platform===`win32`&&(n(`${e}/.nvm/versions/node/v22.21.1/lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe`),n(`${e}/.local/bin/claude.exe`)),n(`${e}/.local/share/claude/versions/*`,!0),process.platform!==`win32`){let t=`lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe`,r=process.env.MISE_DATA_DIR||`${e}/.local/share/mise`;n(`${r}/installs/node/*/${t}`,!0),n(`${r}/installs/npm-anthropic-ai-claude-code/*/${t}`,!0)}return process.platform===`win32`&&t.forEach(e=>{e.pattern=e.pattern.replace(/\//g,`\\`),e.expandedPaths=e.expandedPaths.map(e=>e.replace(/\//g,`\\`))}),t})().flatMap(e=>e.expandedPaths);var D=class extends Error{constructor(e){super(e),this.name=`InstallationDetectionError`}};let O=null;async function re(){return O||=(async()=>{try{let{WASMagic:e}=await import(`wasmagic`);return await e.create()}catch(e){return c(`WASMagic initialization failed (likely SIMD unsupported on this CPU):`,e),c(`Using fallback file type detection`),null}})(),O}const ie=Buffer.from([127,69,76,70]),ae=Buffer.from([254,237,250,206]),oe=Buffer.from([254,237,250,207]),se=Buffer.from([206,250,237,254]),k=Buffer.from([207,250,237,254]),A=Buffer.from([202,254,186,190]),j=Buffer.from([77,90]);function M(e){if(e.length===0)return null;if(e[0]===35&&e[1]===33&&e.subarray(0,Math.min(256,e.length)).toString(`utf8`).split(`
1
+ import{A as e,C as t,ct as n,f as r,h as i,l as a,lt as o,n as s,p as c,r as l,u,ut as ee,w as d}from"./config-Be6dX3XI.mjs";import{Box as f,Text as p,render as m,useInput as h}from"ink";import g,{useState as _}from"react";import*as te from"node:os";import v from"node:os";import*as y from"node:fs/promises";import b from"node:fs/promises";import x from"path";import{jsx as S,jsxs as C}from"react/jsx-runtime";import w from"which";import{globbySync as T}from"globby";const E=(()=>{let e=[],t=process.platform==`win32`?v.homedir().replace(/\\/g,`/`):v.homedir(),n=`node_modules/@anthropic-ai/claude-code`,r=(t,n=!1)=>{if(n)try{let n=T(t,{onlyFiles:!1});e.push({pattern:t,isGlob:!0,expandedPaths:n})}catch(n){n instanceof Error&&`code`in n&&(n.code===`EACCES`||n.code===`EPERM`)?c(`Permission denied accessing: ${t} (${n.code})`):c(`Error expanding glob pattern "${t}": ${n instanceof Error?n.message:String(n)}`),e.push({pattern:t,isGlob:!0,expandedPaths:[]})}else e.push({pattern:t,isGlob:!1,expandedPaths:[t]})};return r(`${v.homedir()}/.claude/local/${n}`),process.env.NPM_PREFIX&&r(`${process.env.NPM_PREFIX}/lib/${n}`),process.env.N_PREFIX&&r(`${process.env.N_PREFIX}/lib/${n}`),process.env.VOLTA_HOME&&r(`${process.env.VOLTA_HOME}/lib/${n}`),process.env.FNM_DIR&&r(`${process.env.FNM_DIR}/lib/${n}`),process.env.NVM_DIR&&r(`${process.env.NVM_DIR}/lib/${n}`),process.env.NODENV_ROOT&&r(`${process.env.NODENV_ROOT}/versions/*/lib/${n}`,!0),process.env.NVS_HOME&&r(`${process.env.NVS_HOME}/node/*/*/lib/${n}`,!0),process.env.ASDF_DATA_DIR&&r(`${process.env.ASDF_DATA_DIR}/installs/nodejs/*/lib/${n}`,!0),process.platform==`win32`?(r(`${t}/AppData/Local/Volta/tools/image/packages/@anthropic-ai/claude-code/${n}`),r(`${t}/AppData/Roaming/npm/${n}`),r(`${t}/AppData/Roaming/nvm/*/${n}`,!0),r(`${t}/AppData/Local/Yarn/config/global/${n}`),r(`${t}/AppData/Local/pnpm/global/*/${n}`,!0),r(`C:/nvm4w/nodejs/${n}`),r(`${t}/n/versions/node/*/lib/${n}`,!0),r(`${t}/AppData/Roaming/Yarn/config/global/${n}`),r(`${t}/AppData/Roaming/pnpm-global/${n}`),r(`${t}/AppData/Roaming/pnpm-global/*/${n}`,!0),r(`${t}/.bun/install/global/${n}`),r(`${t}/.bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0),r(`${t}/AppData/Local/Bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0),r(`${t}/AppData/Local/fnm_multishells/*/node_modules/${n}`,!0),r(`${t}/AppData/Local/mise/installs/node/*/${n}`,!0),r(`${t}/AppData/Local/mise/installs/npm-anthropic-ai-claude-code/*/${n}`,!0)):(process.platform==`darwin`&&(r(`${t}/Library/${n}`),r(`/opt/local/lib/${n}`),r(`${t}/.bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0),r(`${t}/Library/Caches/bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0)),r(`${t}/.local/lib/${n}`),r(`${t}/.local/share/${n}`),r(`${t}/.npm-global/lib/${n}`),r(`${t}/.npm-packages/lib/${n}`),r(`${t}/.npm/lib/${n}`),r(`${t}/npm/lib/${n}`),r(`/etc/${n}`),r(`/lib/${n}`),r(`/opt/node/lib/${n}`),r(`/usr/lib/${n}`),r(`/usr/local/lib/${n}`),r(`/usr/share/${n}`),r(`/var/lib/${n}`),r(`/opt/homebrew/lib/${n}`),r(`${t}/.linuxbrew/lib/${n}`),r(`${t}/.config/yarn/global/${n}`),r(`${t}/.yarn/global/${n}`),r(`${t}/.bun/install/global/${n}`),r(`${t}/.pnpm-global/${n}`),r(`${t}/.pnpm-global/*/${n}`,!0),r(`${t}/pnpm-global/${n}`),r(`${t}/pnpm-global/*/${n}`,!0),r(`${t}/.local/share/pnpm/global/${n}`),r(`${t}/.local/share/pnpm/global/*/${n}`,!0),r(`${t}/.bun/install/global/${n}`),r(`${t}/.bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0),r(`${t}/.local/share/bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0),r(`/usr/local/n/versions/node/*/lib/${n}`,!0),r(`${t}/n/versions/node/*/lib/${n}`,!0),r(`${t}/n/lib/${n}`),r(`${t}/.volta/tools/image/node/*/lib/${n}`,!0),r(`${t}/.fnm/node-versions/*/installation/lib/${n}`,!0),r(`${t}/.local/state/fnm_multishells/*/lib/${n}`,!0),r(`/usr/local/nvm/versions/node/*/lib/${n}`,!0),r(`/usr/local/share/nvm/versions/node/*/lib/${n}`,!0),r(`${t}/.nvm/versions/node/*/lib/${n}`,!0),r(`${t}/.nodenv/versions/*/lib/${n}`,!0),r(`${t}/.nvs/*/lib/${n}`,!0),r(`${t}/.asdf/installs/nodejs/*/lib/${n}`,!0),process.env.MISE_DATA_DIR&&r(`${process.env.MISE_DATA_DIR}/installs/node/*/lib/${n}`,!0),r(`${t}/.local/share/mise/installs/node/*/lib/${n}`,!0),process.env.MISE_DATA_DIR&&r(`${process.env.MISE_DATA_DIR}/installs/npm-anthropic-ai-claude-code/*/lib/${n}`,!0),r(`${t}/.local/share/mise/installs/npm-anthropic-ai-claude-code/*/lib/${n}`,!0)),process.platform==`win32`&&e.forEach(e=>{e.pattern=e.pattern.replace(/\//g,`\\`),e.expandedPaths=e.expandedPaths.map(e=>e.replace(/\//g,`\\`))}),e})().flatMap(e=>e.expandedPaths),ne=(()=>{let e=process.platform===`win32`?v.homedir().replace(/\\/g,`/`):v.homedir(),t=[],n=(e,n=!1)=>{if(n)try{let n=T(e,{onlyFiles:!0});t.push({pattern:e,isGlob:!0,expandedPaths:n})}catch(n){n instanceof Error&&`code`in n&&(n.code===`EACCES`||n.code===`EPERM`)?c(`Permission denied accessing: ${e} (${n.code})`):c(`Error expanding glob pattern "${e}": ${n instanceof Error?n.message:String(n)}`),t.push({pattern:e,isGlob:!0,expandedPaths:[]})}else t.push({pattern:e,isGlob:!1,expandedPaths:[e]})};if(n(`${e}/.local/bin/claude`),process.platform===`win32`&&(n(`${e}/.nvm/versions/node/v22.21.1/lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe`),n(`${e}/.local/bin/claude.exe`)),n(`${e}/.local/share/claude/versions/*`,!0),process.platform!==`win32`){let t=`lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe`,r=process.env.MISE_DATA_DIR||`${e}/.local/share/mise`;n(`${r}/installs/node/*/${t}`,!0),n(`${r}/installs/npm-anthropic-ai-claude-code/*/${t}`,!0)}return process.platform===`win32`&&t.forEach(e=>{e.pattern=e.pattern.replace(/\//g,`\\`),e.expandedPaths=e.expandedPaths.map(e=>e.replace(/\//g,`\\`))}),t})().flatMap(e=>e.expandedPaths);var D=class extends Error{constructor(e){super(e),this.name=`InstallationDetectionError`}};let O=null;async function re(){return O||=(async()=>{try{let{WASMagic:e}=await import(`wasmagic`);return await e.create()}catch(e){return c(`WASMagic initialization failed (likely SIMD unsupported on this CPU):`,e),c(`Using fallback file type detection`),null}})(),O}const ie=Buffer.from([127,69,76,70]),ae=Buffer.from([254,237,250,206]),oe=Buffer.from([254,237,250,207]),se=Buffer.from([206,250,237,254]),k=Buffer.from([207,250,237,254]),A=Buffer.from([202,254,186,190]),j=Buffer.from([77,90]);function M(e){if(e.length===0)return null;if(e[0]===35&&e[1]===33&&e.subarray(0,Math.min(256,e.length)).toString(`utf8`).split(`
2
2
  `)[0].includes(`node`))return c(`detectFileTypeFallback: Detected JavaScript via shebang`),`javascript`;if(e.length>=4){let t=e.subarray(0,4);if(t.equals(ie))return c(`detectFileTypeFallback: Detected ELF binary`),`binary`;if(t.equals(ae)||t.equals(oe)||t.equals(se)||t.equals(k)||t.equals(A))return c(`detectFileTypeFallback: Detected Mach-O binary`),`binary`}if(e.length>=2&&e.subarray(0,2).equals(j))return c(`detectFileTypeFallback: Detected PE binary`),`binary`;let t=Math.min(512,e.length),n=0,r=0;for(let i=0;i<t;i++){let t=e[i];(t>=32&&t<=126||t===9||t===10||t===13)&&n++,t===0&&r++}if(r>0)return c(`detectFileTypeFallback: Detected binary (${r} null bytes in first ${t} bytes)`),`binary`;let i=n/t;return i>.9?(c(`detectFileTypeFallback: Detected JavaScript via text heuristic (${Math.round(i*100)}% printable)`),`javascript`):(c(`detectFileTypeFallback: Unknown file type (${Math.round(i*100)}% printable)`),null)}async function N(e,t=4096){try{let n=await b.open(e,`r`);try{let e=Buffer.allocUnsafe(t),{bytesRead:r}=await n.read({buffer:e,position:0,length:t});return r<=0?null:e.subarray(0,r)}finally{await n.close()}}catch(e){return c(`Failed to read file prefix:`,e),null}}async function P(e){if(process.platform===`win32`)return e;let t=await ee(e);return t?(c(`maybeResolveNixWrapper: resolved Nix wrapper ${e} -> ${t}`),t):e}async function F(e){try{let t=await b.realpath(e);c(`resolvePathToInstallationType: ${e} -> ${t}`);let n=await N(t);if(!n)return c(`resolvePathToInstallationType: Could not read file prefix`),null;let r=await re();if(r&&typeof r.detect==`function`){let e=r.detect(n)||null;if(e){let n=e.toLowerCase();return c(`resolvePathToInstallationType: Detected mime type: ${n}`),n.includes(`javascript`)?{kind:`npm-based`,resolvedPath:t}:n.startsWith(`text/`)?(c(`resolvePathToInstallationType: Unrecognized file type`),null):{kind:`native-binary`,resolvedPath:await P(t)}}}c(`resolvePathToInstallationType: Using fallback file type detection`);let i=M(n);return i===`javascript`?{kind:`npm-based`,resolvedPath:t}:i===`binary`?{kind:`native-binary`,resolvedPath:await P(t)}:(c(`resolvePathToInstallationType: Fallback could not determine file type`),null)}catch(e){return c(`resolvePathToInstallationType: Error:`,e),null}}async function I(){c(`getClaudeFromPath: PATH = ${process.env.PATH}`),c(`getClaudeFromPath: PATHEXT = ${process.env.PATHEXT}`);try{let e=await w(`claude`);return c(`getClaudeFromPath: Found claude at ${e}`),e}catch{return c(`getClaudeFromPath: claude not found on PATH`),null}}function L(e){let t=/\bVERSION:"(\d+\.\d+\.\d+)"/g,n=new Map,r;for(;(r=t.exec(e))!==null;){let e=r[1];n.set(e,(n.get(e)||0)+1)}if(n.size===0)return null;let i=0,a;for(let[e,t]of n.entries())c(`Found version ${e} with ${t} occurrences`),t>i&&(i=t,a=e);return a&&c(`Extracted version ${a} (${i} occurrences)`),a||null}async function R(e){let t=L(await b.readFile(e,`utf8`));if(!t)throw Error(`No VERSION strings found in JS file: ${e}`);return t}async function z(e){let{data:t,error:r}=await n(e);if(!t)throw Error(`Could not extract JS from native binary: ${e}${r?` (${r})`:``}`);let i=L(t.toString(`utf8`));if(!i)throw Error(`No VERSION strings found in extracted JS from: ${e}`);return i}function B(e){let t=x.basename(e).match(/^(\d+\.\d+\.\d+)$/);return t?t[1]:null}async function V(e,t){let n=B(e);return n?(c(`extractVersion: Got version ${n} from filename`),n):t===`npm-based`?R(e):z(e)}async function H(){let e=[],t=new Set;for(let n of E){let r=x.join(n,`cli.js`);try{if(await i(r)){let n=await b.realpath(r).catch(()=>r);if(t.has(n))continue;t.add(n),c(`collectCandidates: Found cli.js at ${n}`);let i=await R(n);e.push({path:n,kind:`npm-based`,version:i})}}catch(e){c(`collectCandidates: Error checking ${r}:`,e)}}for(let n of ne)try{if(await i(n)){let r=await b.realpath(n).catch(()=>n);if(t.has(r))continue;t.add(r);let i=await P(r);c(`collectCandidates: Found native binary at ${r}${i===r?``:` (resolved -> ${i})`}`);let a=await V(i,`native-binary`);e.push({path:i,kind:`native-binary`,version:a})}}catch(e){c(`collectCandidates: Error checking ${n}:`,e)}return[...e].sort((e,t)=>r(t.version,e.version))}function U(e){return e.map(e=>` • ${e.path} (${e.kind}, v${e.version})`).join(`
3
3
  `)}function W(e){return` 2. Set ccInstallationPath in your config file (${l}):
4
4