tweakcc 4.3.0 → 4.3.1
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/dist/{config-D6a-CyPP.mjs → config-Bis1aJlB.mjs} +12 -12
- package/dist/{content-ChPvKckT.mjs → content-mytE8ZSF.mjs} +1 -1
- package/dist/index.mjs +2 -2
- package/dist/lib/index.mjs +1 -1
- package/dist/{nativeInstallation-Bo_Crunz.mjs → nativeInstallation-DmcOE3-o.mjs} +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e,D as t,S as n,c as r,d as i,et as a,f as o,l as s,m as c,n as l,r as u,tt as d,x as f}from"./config-
|
|
1
|
+
import{$ as e,D as t,S as n,c as r,d as i,et as a,f as o,l as s,m as c,n as l,r as u,tt as d,x as f}from"./config-Bis1aJlB.mjs";import{Box as p,Text as m,render as h,useInput as g}from"ink";import ee,{useState as te}from"react";import*as ne from"node:os";import _ from"node:os";import*as v from"node:fs/promises";import y from"node:fs/promises";import b from"path";import{jsx as x,jsxs as S}from"react/jsx-runtime";import C from"which";import{globbySync as w}from"globby";const T=(()=>{let e=[],t=process.platform==`win32`?_.homedir().replace(/\\/g,`/`):_.homedir(),n=`node_modules/@anthropic-ai/claude-code`,r=(t,n=!1)=>{if(n)try{let n=w(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`)?o(`Permission denied accessing: ${t} (${n.code})`):o(`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(`${_.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),E=(()=>{let e=process.platform===`win32`?_.homedir().replace(/\\/g,`/`):_.homedir(),t=[],n=(e,n=!1)=>{if(n)try{let n=w(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`)?o(`Permission denied accessing: ${e} (${n.code})`):o(`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]})};return n(`${e}/.local/bin/claude`),process.platform===`win32`&&n(`${e}/.local/bin/claude.exe`),n(`${e}/.local/share/claude/versions/*`,!0),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`}};const O=Buffer.from([127,69,76,70]),re=Buffer.from([254,237,250,206]),ie=Buffer.from([254,237,250,207]),ae=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 o(`detectFileTypeHeuristic: Detected JavaScript via shebang`),`javascript`;if(e.length>=4){let t=e.subarray(0,4);if(t.equals(O))return o(`detectFileTypeHeuristic: Detected ELF binary`),`binary`;if(t.equals(re)||t.equals(ie)||t.equals(ae)||t.equals(k)||t.equals(A))return o(`detectFileTypeHeuristic: Detected Mach-O binary`),`binary`}if(e.length>=2&&e.subarray(0,2).equals(j))return o(`detectFileTypeHeuristic: 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 o(`detectFileTypeHeuristic: Detected binary (${r} null bytes in first ${t} bytes)`),`binary`;let i=e.subarray(0,t).toString(`utf8`).trimStart().toLowerCase();if(i.startsWith(`@echo`)||i.startsWith(`echo `)||i.startsWith(`cmd `)||i.startsWith(`cmd.exe `)||i.startsWith(`rem `))return o(`detectFileTypeHeuristic: Ignoring command script wrapper`),null;let a=n/t;return a>.9?(o(`detectFileTypeHeuristic: Detected JavaScript via text heuristic (${Math.round(a*100)}% printable)`),`javascript`):(o(`detectFileTypeHeuristic: Unknown file type (${Math.round(a*100)}% printable)`),null)}async function N(e,t=4096){try{let n=await y.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 o(`Failed to read file prefix:`,e),null}}async function P(e){if(process.platform===`win32`)return e;let t=await d(e);return t?(o(`maybeResolveNixWrapper: resolved Nix wrapper ${e} -> ${t}`),t):e}async function F(e){try{let t=await y.realpath(e);o(`resolvePathToInstallationType: ${e} -> ${t}`);let n=await N(t);if(!n)return o(`resolvePathToInstallationType: Could not read file prefix`),null;o(`resolvePathToInstallationType: Using heuristic file type detection`);let r=M(n);return r===`javascript`?{kind:`npm-based`,resolvedPath:t}:r===`binary`?{kind:`native-binary`,resolvedPath:await P(t)}:(o(`resolvePathToInstallationType: Heuristic could not determine file type`),null)}catch(e){return o(`resolvePathToInstallationType: Error:`,e),null}}async function I(){o(`getClaudeFromPath: PATH = ${process.env.PATH}`),o(`getClaudeFromPath: PATHEXT = ${process.env.PATHEXT}`);try{let e=await C(`claude`);return o(`getClaudeFromPath: Found claude at ${e}`),e}catch{return o(`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())o(`Found version ${e} with ${t} occurrences`),t>i&&(i=t,a=e);return a&&o(`Extracted version ${a} (${i} occurrences)`),a||null}async function R(e){let t=L(await y.readFile(e,`utf8`));if(!t)throw Error(`No VERSION strings found in JS file: ${e}`);return t}async function z(t){let n=await e(t);if(!n)throw Error(`Could not extract JS from native binary: ${t}`);let r=L(n.toString(`utf8`));if(!r)throw Error(`No VERSION strings found in extracted JS from: ${t}`);return r}function B(e){let t=b.basename(e).match(/^(\d+\.\d+\.\d+)$/);return t?t[1]:null}async function V(e,t){let n=B(e);return n?(o(`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 T){let r=b.join(n,`cli.js`);if(!t.has(r))try{if(await c(r)){o(`collectCandidates: Found cli.js at ${r}`);let n=await R(r);e.push({path:r,kind:`npm-based`,version:n}),t.add(r)}}catch(e){o(`collectCandidates: Error checking ${r}:`,e)}}for(let n of E)if(!t.has(n))try{if(await c(n)){let r=await P(n);o(`collectCandidates: Found native binary at ${n}${r===n?``:` (resolved -> ${r})`}`);let i=await V(r,`native-binary`);e.push({path:r,kind:`native-binary`,version:i}),t.add(n)}}catch(e){o(`collectCandidates: Error checking ${n}:`,e)}return[...e].sort((e,t)=>i(e.version,t.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 (${u}):
|
|
4
4
|
|