tweakcc 1.1.2 → 1.1.3

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
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![tweakcc on npm](https://img.shields.io/npm/v/tweakcc?color=yellow")](https://www.npmjs.com/package/tweakcc)
4
4
  [![Mentioned in Awesome Claude Code](https://awesome.re/mentioned-badge.svg)](https://github.com/hesreallyhim/awesome-claude-code)
5
+ [![ClaudeLog - A comprehensive knowledge base for Claude.](https://claudelog.com/img/claude_log_badge.svg)](https://claudelog.com/)
5
6
 
6
7
  `tweakcc` is a lightweight, interactive CLI tool that lets you personalize your Claude Code interface.
7
8
 
@@ -30,7 +31,7 @@ Demo:
30
31
 
31
32
  `tweakcc` works by patching the Claude Code's minified `cli.js` file. When you update your Claude Code installation, your customizations will be overwritten, but they're remembered in your `~/.tweakcc/config.js` configuration file, so they can be reapplied by just rerunning the tool.
32
33
 
33
- Works with Claude Code 1.0.83.
34
+ Works with Claude Code 1.0.88
34
35
 
35
36
  ## Running
36
37
 
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import{Box as e,Text as t,render as n,useInput as r,useStdout as i}from"ink";imp
5
5
  `);R(a);let s=Math.max(...i.map(e=>e.length)),l=Math.min(75,Math.max(50,Math.ceil(s/o*100)));B(l+5)}catch{R(`Error generating figlet text`),B(50)}else{let e=Math.floor(o*.6),t=V?U:g,n=t.split(`
6
6
  `),r=n.map(t=>t.length>e?t.substring(0,e-3)+`...`:t),i=r.join(`
7
7
  `);R(i);let a=Math.max(...r.map(e=>e.length)),s=Math.min(75,Math.max(50,Math.ceil(a/o*100)));B(s+5)}};return u(()=>{if(A){let e=E.filter(e=>e.toLowerCase().includes(A.toLowerCase()));k(e),I(0)}else{k(E);let e=E.indexOf(h);I(e>=0?e:0)}},[A,E]),u(()=>{if(!M){let e=O.indexOf(h);e>=0&&I(e)}},[h,O,M]),r((e,t)=>{if(V){t.return?(v(s===`figlet`?e=>{e.launchText.figletText=U}:e=>{e.launchText.customText=U}),H(!1)):t.escape?(W(s===`figlet`?c:g),H(!1)):t.backspace||t.delete?W(e=>e.slice(0,-1)):e&&W(t=>t+e);return}if(M){if(t.return)O.length>0&&v(e=>{e.launchText.figletFont=O[F]}),N(!1),j(``);else if(t.escape)N(!1),j(``);else if(t.backspace||t.delete)j(e=>e.slice(0,-1));else if(t.upArrow){let e=F>0?F-1:O.length-1;I(e),O.length>0&&v(t=>{t.launchText.figletFont=O[e]})}else if(t.downArrow){let e=F<O.length-1?F+1:0;I(e),O.length>0&&v(t=>{t.launchText.figletFont=O[e]})}else e&&e.match(/^[a-zA-Z0-9\s\-_]$/)&&j(t=>t+e);return}if(t.escape)n();else if(t.return)C===`text`&&(W(s===`figlet`?c:g),H(!0));else if(t.tab)t.shift?x(e=>e===0?y.length-1:e-1):x(e=>e===y.length-1?0:e+1);else if(t.upArrow){if(C===`method`){let e=w>0?w-1:1;T(e),v(t=>{t.launchText.method=e===0?`figlet`:`custom`})}else if(C===`font`&&s===`figlet`){let e=F>0?F-1:O.length-1;I(e),v(t=>{t.launchText.figletFont=O[e]})}}else if(t.downArrow){if(C===`method`){let e=w<1?w+1:0;T(e),v(t=>{t.launchText.method=e===0?`figlet`:`custom`})}else if(C===`font`&&s===`figlet`){let e=F<O.length-1?F+1:0;I(e),v(t=>{t.launchText.figletFont=O[e]})}}else e&&C===`font`&&s===`figlet`&&e.match(/^[a-zA-Z0-9]$/)&&(N(!0),j(e))}),m(e,{children:[m(e,{flexDirection:`column`,width:`${100-z}%`,children:[m(e,{marginBottom:1,flexDirection:`column`,children:[p(P,{children:`Setup banner`}),m(e,{flexDirection:`column`,children:[m(t,{dimColor:!0,children:[`enter to `,C===`text`?`edit text`:`save`]}),p(t,{dimColor:!0,children:`esc to go back`}),p(t,{dimColor:!0,children:`tab to switch sections`})]})]}),p(e,{children:m(t,{children:[p(t,{color:C===`method`?`yellow`:void 0,children:C===`method`?`❯ `:` `}),p(t,{bold:!0,color:C===`method`?`yellow`:void 0,children:`Method`})]})}),C===`method`&&m(t,{dimColor:!0,children:[` `,`select one of `,O.length,` Figlet fonts or enter your own text`]}),p(e,{marginLeft:2,marginBottom:1,children:m(e,{flexDirection:`column`,children:[m(t,{color:w===0?`cyan`:`white`,children:[w===0?`❯ `:` `,`Figlet`]}),m(t,{color:w===1?`cyan`:`white`,children:[w===1?`❯ `:` `,`Custom`]})]})}),m(e,{flexDirection:`column`,children:[m(t,{children:[p(t,{color:C===`text`?`yellow`:void 0,children:C===`text`?`❯ `:` `}),p(t,{bold:!0,color:C===`text`?`yellow`:void 0,children:`Text`})]}),C===`text`&&(V?m(t,{dimColor:!0,children:[` `,`esc to save`]}):m(t,{dimColor:!0,children:[` `,`enter to edit`]}))]}),p(e,{marginLeft:2,marginBottom:1,children:p(e,{borderStyle:`round`,borderColor:V?`yellow`:`gray`,children:p(t,{children:V?U:s===`figlet`?c:g})})}),s===`figlet`&&m(f,{children:[p(e,{children:m(e,{flexDirection:`column`,children:[m(t,{children:[p(t,{color:C===`font`?`yellow`:void 0,children:C===`font`?`❯ `:` `}),p(t,{bold:!0,color:C===`font`?`yellow`:void 0,children:`Font`})]}),C===`font`&&m(t,{dimColor:!0,children:[` `,`type to filter`]}),p(t,{children:M&&m(t,{color:`gray`,dimColor:!0,children:[` `,`(filtering: “`,A,`”)`]})})]})}),p(e,{marginLeft:2,marginBottom:1,children:p(e,{flexDirection:`column`,children:(()=>{let e=Math.max(0,F-4),n=Math.min(O.length,e+8),r=Math.max(0,n-8),i=O.slice(r,n);return m(f,{children:[r>0&&m(t,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,n)=>{let i=r+n;return m(t,{color:F===i?`cyan`:void 0,children:[F===i?`❯ `:` `,e]},e)}),n<O.length&&m(t,{color:`gray`,dimColor:!0,children:[` `,`↓ `,O.length-n,` more below`]})]})})()})})]})]}),m(e,{width:`${z}%`,flexDirection:`column`,children:[p(e,{marginBottom:1,children:p(t,{bold:!0,children:`Preview`})}),m(e,{borderStyle:`single`,borderColor:`gray`,padding:1,flexDirection:`column`,children:[m(e,{flexDirection:`column`,marginBottom:1,children:[p(t,{color:G,children:`╭──────────────────────────╮`}),m(t,{children:[p(t,{color:G,children:`│ ✻`}),` Welcome to Claude Code`,` `,p(t,{color:G,children:`│`})]}),p(t,{color:G,children:`╰──────────────────────────╯`})]}),L.split(`
8
- `).map((e,n)=>p(t,{color:G,children:e},n)),p(e,{marginTop:1,children:p(t,{wrap:`truncate-end`,children:`Claude Code can now be used with your Claude subscription or billed based on API usage through your Console account.`})})]})]})]})}function se({onBack:n}){let{settings:{thinkingVerbs:{format:i,verbs:a},themes:o},updateSettings:s}=l($),c=[`format`,`verbs`],[u,h]=d(0),g=c[u],[_,v]=d(0),[y,b]=d(!1),[x,S]=d(``),[C,w]=d(!1),[T,E]=d(!1),[O,k]=d(i),A=ee(),j=o.find(e=>e.id===A)||o.find(e=>e.id===`dark`),M=j?.colors.claude||`rgb(215,119,87)`;return r((e,t)=>{if(T){t.return?(s(e=>{e.thinkingVerbs.format=O}),E(!1)):t.escape?(k(i),E(!1)):t.backspace||t.delete?k(e=>e.slice(0,-1)):e&&k(t=>t+e);return}if(y||C){t.return&&x.trim()?(C?(s(e=>{e.thinkingVerbs.verbs.push(x.trim())}),w(!1)):(s(e=>{e.thinkingVerbs.verbs[_]=x.trim()}),b(!1)),S(``)):t.escape?(S(``),b(!1),w(!1)):t.backspace||t.delete?S(e=>e.slice(0,-1)):e&&S(t=>t+e);return}t.escape?n():t.return?g===`format`&&(k(i),E(!0)):t.tab?t.shift?h(e=>e===0?c.length-1:e-1):h(e=>e===c.length-1?0:e+1):t.upArrow?g===`verbs`&&a.length>0&&v(e=>e>0?e-1:a.length-1):t.downArrow?g===`verbs`&&a.length>0&&v(e=>e<a.length-1?e+1:0):e===`e`&&g===`verbs`?a.length>0&&(S(a[_]),b(!0)):e===`d`&&g===`verbs`?a.length>1&&(s(e=>{e.thinkingVerbs.verbs=e.thinkingVerbs.verbs.filter((e,t)=>t!==_)}),_>=a.length-1&&v(Math.max(0,a.length-2))):e===`n`&&g===`verbs`?(w(!0),S(``)):t.ctrl&&e===`r`&&g===`verbs`&&(s(e=>{e.thinkingVerbs.verbs=[...D.thinkingVerbs.verbs]}),v(0))}),m(e,{children:[m(e,{flexDirection:`column`,width:`50%`,children:[m(e,{marginBottom:1,flexDirection:`column`,children:[p(P,{children:`Thinking Verbs`}),m(e,{flexDirection:`column`,children:[p(t,{dimColor:!0,children:g===`format`?`enter to edit format`:`changes auto-saved`}),p(t,{dimColor:!0,children:`esc to go back`}),p(t,{dimColor:!0,children:`tab to switch sections`})]})]}),p(e,{marginBottom:1,children:p(t,{dimColor:!0,children:`Customize the verbs shown during generation and their format.`})}),m(e,{flexDirection:`column`,children:[m(t,{children:[p(t,{color:g===`format`?`yellow`:void 0,children:g===`format`?`❯ `:` `}),p(t,{bold:!0,color:g===`format`?`yellow`:void 0,children:`Format`})]}),g===`format`&&(T?m(t,{dimColor:!0,children:[` `,`enter to save`]}):m(t,{dimColor:!0,children:[` `,`enter to edit`]}))]}),p(e,{marginLeft:2,marginBottom:1,children:p(e,{borderStyle:`round`,borderColor:T?`yellow`:`gray`,children:p(t,{children:T?O:i})})}),p(e,{children:m(t,{children:[p(t,{color:g===`verbs`?`yellow`:void 0,children:g===`verbs`?`❯ `:` `}),p(t,{bold:!0,color:g===`verbs`?`yellow`:void 0,children:`Verbs`})]})}),g===`verbs`&&p(e,{flexDirection:`column`,children:m(t,{dimColor:!0,children:[` `,`e to edit · d to delete · n to add new · ctrl+r to reset`]})}),p(e,{marginLeft:2,marginBottom:1,children:m(e,{flexDirection:`column`,children:[(()=>{let e=Math.max(0,_-4),n=Math.min(a.length,e+8),r=Math.max(0,n-8),i=a.slice(r,n);return m(f,{children:[r>0&&m(t,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,n)=>{let i=r+n;return m(t,{color:g===`verbs`&&i===_?`cyan`:void 0,children:[g===`verbs`&&i===_?`❯ `:` `,e]},i)}),n<a.length&&m(t,{color:`gray`,dimColor:!0,children:[` `,`↓ `,a.length-n,` more below`]})]})})(),C&&m(e,{alignItems:`center`,children:[p(t,{color:`yellow`,children:`❯ `}),p(e,{borderStyle:`round`,borderColor:`yellow`,children:p(t,{children:x})})]}),y&&m(e,{marginTop:1,alignItems:`center`,children:[p(t,{children:`Editing: `}),p(e,{borderStyle:`round`,borderColor:`yellow`,children:p(t,{children:x})})]})]})})]}),m(e,{width:`50%`,flexDirection:`column`,children:[p(e,{marginBottom:1,children:p(t,{bold:!0,children:`Preview`})}),p(e,{borderStyle:`single`,borderColor:`gray`,padding:1,flexDirection:`column`,children:m(t,{children:[m(t,{color:M,children:[`✻ `,i.replace(/\{\}/g,a[_]),` `]}),p(t,{color:j?.colors.secondaryText,children:`(10s · ↑ 456 tokens · esc to interrupt)`})]})})]})]})}const Y=[{name:`Default`,phases:D.thinkingStyle.phases,reverseMirror:D.thinkingStyle.reverseMirror},{name:`Basic`,phases:[`|`,`/`,`-`,`\\`],reverseMirror:!1},{name:`Braille`,phases:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`],reverseMirror:!1},{name:`Circle`,phases:[`◐`,`◓`,`◑`,`◒`],reverseMirror:!1},{name:`Wave`,phases:[`▁`,`▃`,`▄`,`▅`,`▆`,`▇`,`█`],reverseMirror:!0},{name:`Glow`,phases:[`░`,`▒`,`▓`,`█`],reverseMirror:!0},{name:`Partial block`,phases:[`▏`,`▎`,`▍`,`▌`,`▋`,`▊`,`▉`,`█`],reverseMirror:!0},{name:`Clock`,phases:[`🕛`,`🕐`,`🕑`,`🕒`,`🕓`,`🕔`,`🕕`,`🕖`,`🕗`,`🕘`,`🕙`,`🕚`],reverseMirror:!1},{name:`Globe`,phases:[`🌍`,`🌎`,`🌏`],reverseMirror:!1},{name:`Arc`,phases:[`◜`,`◠`,`◝`,`◞`,`◡`,`◟`],reverseMirror:!1},{name:`Triangle`,phases:[`◤`,`◥`,`◢`,`◣`],reverseMirror:!1},{name:`Bouncing`,phases:[`⠁`,`⠂`,`⠄`,`⡀`,`⢀`,`⠠`,`⠐`,`⠈`],reverseMirror:!1},{name:`Dots`,phases:[`.`,`..`,`...`],reverseMirror:!1},{name:`Colors`,phases:[`🔴`,`🟠`,`🟡`,`🟢`,`🔵`,`🟣`],reverseMirror:!1}];function ce({onBack:n}){let{settings:{thinkingStyle:{phases:i,updateInterval:a,reverseMirror:o},themes:s},updateSettings:c}=l($),h=[`reverseMirror`,`updateInterval`,`phases`,`presets`],[g,_]=d(0),v=h[g],[y,b]=d(0),[x,S]=d(0),[C,w]=d(!1),[T,E]=d(``),[O,k]=d(!1),[A,j]=d(!1),[M,N]=d(a.toString()),[F,I]=d(0),L=ee(),R=s.find(e=>e.id===L)||s.find(e=>e.id===`dark`),z=R?.colors.claude||`rgb(215,119,87)`;u(()=>{if(i.length>0){let e=o?[...i,...[...i].reverse().slice(1,-1)]:i,t=setInterval(()=>{I(t=>(t+1)%e.length)},a);return()=>clearInterval(t)}},[i,a,o]),r((e,t)=>{if(A){if(t.return){let e=parseInt(M);!isNaN(e)&&e>0&&c(t=>{t.thinkingStyle.updateInterval=e}),j(!1)}else t.escape?(N(a.toString()),j(!1)):t.backspace||t.delete?N(e=>e.slice(0,-1)):e&&e.match(/^[0-9]$/)&&N(t=>t+e);return}if(C||O){if(t.return&&T.length){let e=O?[...i,T]:i.map((e,t)=>t===y?T:e);c(t=>{t.thinkingStyle.phases=e}),w(!1),E(``)}else t.escape?(E(``),w(!1),k(!1)):t.backspace||t.delete?E(e=>e.slice(0,-1)):e&&E(t=>t+e);return}if(t.escape)n();else if(t.return)if(v===`updateInterval`)N(a.toString()),j(!0);else if(v===`presets`){let e=Y[x];c(t=>{t.thinkingStyle.phases=[...e.phases],t.thinkingStyle.reverseMirror=e.reverseMirror})}else v===`reverseMirror`&&c(e=>{e.thinkingStyle.reverseMirror=!e.thinkingStyle.reverseMirror});else if(t.tab)t.shift?_(e=>e===0?h.length-1:e-1):_(e=>e===h.length-1?0:e+1);else if(t.upArrow)v===`phases`&&i.length>0?b(e=>e>0?e-1:i.length-1):v===`presets`&&S(e=>e>0?e-1:Y.length-1);else if(t.downArrow)v===`phases`&&i.length>0?b(e=>e<i.length-1?e+1:0):v===`presets`&&S(e=>e<Y.length-1?e+1:0);else if(e===` `)v===`reverseMirror`&&c(e=>{e.thinkingStyle.reverseMirror=!e.thinkingStyle.reverseMirror});else if(e===`e`&&v===`phases`)i.length>0&&(E(i[y]),w(!0));else if(e===`a`&&v===`phases`)k(!0),E(``);else if(e===`d`&&v===`phases`)i.length>1&&(c(e=>{e.thinkingStyle.phases=i.filter((e,t)=>t!==y)}),y>=i.length&&b(Math.max(0,i.length-1)));else if(e===`w`&&v===`phases`){if(y>0){let e=[...i];[e[y-1],e[y]]=[e[y],e[y-1]],c(t=>{t.thinkingStyle.phases=e}),b(e=>e-1)}}else if(e===`s`&&v===`phases`){if(y<i.length-1){let e=[...i];[e[y],e[y+1]]=[e[y+1],e[y]],c(t=>{t.thinkingStyle.phases=e}),b(e=>e+1)}}else t.ctrl&&e===`r`&&(c(e=>{e.thinkingStyle=D.thinkingStyle}),b(0),S(0))});let B=o?`●`:`○`,V=()=>o?[...i,...[...i].reverse().slice(1,-1)]:i,H=V(),U=H.length>0?H[F]:`·`;return p(e,{children:m(e,{flexDirection:`column`,width:`100%`,children:[m(e,{flexDirection:`row`,width:`100%`,children:[m(e,{marginBottom:1,flexDirection:`column`,width:`50%`,children:[p(P,{children:`Thinking style`}),m(e,{flexDirection:`column`,children:[m(t,{dimColor:!0,children:[`enter to`,` `,v===`updateInterval`?`edit interval`:v===`presets`?`apply preset`:`save`]}),p(t,{dimColor:!0,children:`esc to go back`}),p(t,{dimColor:!0,children:`tab to switch sections`})]})]}),m(e,{width:`50%`,flexDirection:`column`,children:[p(e,{children:p(t,{bold:!0,children:`Preview`})}),m(e,{borderStyle:`single`,borderColor:`gray`,paddingX:1,flexDirection:`row`,children:[p(e,{width:(U?.length??0)+1,children:p(t,{color:z,children:U})}),m(t,{children:[p(t,{color:z,children:`Thinking… `}),p(t,{color:R?.colors.secondaryText,children:`(esc to interrupt)`})]})]})]})]}),m(e,{flexDirection:`row`,gap:4,children:[m(e,{flexDirection:`column`,children:[m(t,{children:[p(t,{color:v===`reverseMirror`?`yellow`:void 0,children:v===`reverseMirror`?`❯ `:` `}),p(t,{bold:!0,color:v===`reverseMirror`?`yellow`:void 0,children:`Reverse-mirror phases`})]}),v===`reverseMirror`&&m(t,{dimColor:!0,children:[` `,`space to toggle`]}),p(e,{marginLeft:2,marginBottom:1,children:m(t,{children:[B,` `,o?`Enabled`:`Disabled`]})})]}),m(e,{flexDirection:`column`,children:[m(t,{children:[p(t,{color:v===`updateInterval`?`yellow`:void 0,children:v===`updateInterval`?`❯ `:` `}),p(t,{bold:!0,color:v===`updateInterval`?`yellow`:void 0,children:`Update interval (ms)`})]}),v===`updateInterval`&&(A?m(t,{dimColor:!0,children:[` `,`enter to save`]}):m(t,{dimColor:!0,children:[` `,`enter to edit`]})),p(e,{marginLeft:2,marginBottom:1,children:p(e,{borderStyle:`round`,borderColor:A?`yellow`:`gray`,children:p(t,{children:A?M:a})})})]})]}),p(e,{children:m(t,{children:[p(t,{color:v===`phases`?`yellow`:void 0,children:v===`phases`?`❯ `:` `}),p(t,{bold:!0,color:v===`phases`?`yellow`:void 0,children:`Phases`})]})}),v===`phases`&&p(e,{marginBottom:1,flexDirection:`column`,children:m(t,{dimColor:!0,children:[` `,`[e]dit`,` `,`[a]dd`,` `,`[d]elete`,` `,`[w]move up`,` `,`[s]move down`]})}),p(e,{marginLeft:2,marginBottom:1,children:m(e,{flexDirection:`column`,children:[(()=>{let e=Math.max(0,y-4),n=Math.min(i.length,e+8),r=Math.max(0,n-8),a=i.slice(r,n);return m(f,{children:[r>0&&m(t,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),a.map((e,n)=>{let i=r+n;return m(t,{color:v===`phases`&&i===y?`cyan`:void 0,children:[v===`phases`&&i===y?`❯ `:` `,e]},i)}),n<i.length&&m(t,{color:`gray`,dimColor:!0,children:[` `,`↓ `,i.length-n,` more below`]})]})})(),O&&m(e,{children:[p(t,{color:`yellow`,children:`❯ `}),p(e,{borderStyle:`round`,borderColor:`yellow`,children:p(t,{children:T})})]}),C&&m(e,{marginTop:1,children:[p(t,{children:`Editing: `}),p(e,{borderStyle:`round`,borderColor:`yellow`,children:p(t,{children:T})})]})]})}),p(e,{children:m(t,{children:[p(t,{color:v===`presets`?`yellow`:void 0,children:v===`presets`?`❯ `:` `}),p(t,{bold:!0,color:v===`presets`?`yellow`:void 0,children:`Presets`})]})}),v===`presets`&&m(t,{dimColor:!0,children:[` `,`Selecting one will overwrite your choice of phases`]}),p(e,{marginLeft:2,marginBottom:1,children:p(e,{flexDirection:`column`,children:(()=>{let e=Math.max(0,x-4),n=Math.min(Y.length,e+8),r=Math.max(0,n-8),i=Y.slice(r,n);return m(f,{children:[r>0&&m(t,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,n)=>{let i=r+n;return m(t,{color:v===`presets`&&i===x?`cyan`:void 0,children:[v===`presets`&&i===x?`❯ `:` `,e.name,` `,e.phases.join(``)]},i)}),n<Y.length&&m(t,{color:`gray`,dimColor:!0,children:[` `,`↓ `,Y.length-n,` more below`]})]})})()})}),p(e,{marginTop:1,children:p(t,{dimColor:!0,children:`ctrl+r to reset all settings to default`})})]})})}const le=async()=>{await w.mkdir(O,{recursive:!0})},ue=async()=>{let e={ccVersion:``,ccInstallationDir:null,lastModified:new Date().toISOString(),changesApplied:!0,settings:D};try{V()&&console.log(`Reading config at ${k}`);let t=await w.readFile(k,`utf8`),n={...e,...JSON.parse(t)},r=n?.settings?.thinkingVerbs;r?.punctuation&&(r.format=`{}`+r.punctuation,delete r.punctuation);for(let e of D.themes){let t=n?.settings?.themes.find(t=>t.id===e.id||t.name===e.name);if(t)for(let[n,r]of Object.entries(e))Object.hasOwn(t,n)||(t[n]=r)}return n}catch(t){if(t instanceof Error&&`code`in t&&t.code===`ENOENT`)return e;throw t}},X={settings:D,changesApplied:!1,ccVersion:``,lastModified:``,ccInstallationDir:null},Z=async e=>(V()&&console.log(`Updating config at ${k}`),e(X),X.lastModified=new Date().toISOString(),await de(X),X),de=async e=>{try{e.lastModified=new Date().toISOString(),await le(),await w.writeFile(k,JSON.stringify(e,null,2))}catch(e){throw console.error(`Error saving config:`,e),e}},fe=async e=>(V()&&console.log(`Restoring cli.js from backup to ${e.cliPath}`),await w.copyFile(A,e.cliPath),await Z(e=>{e.changesApplied=!1}),!0),pe=async e=>{e.ccInstallationDir&&M.unshift(e.ccInstallationDir);for(let e of M)try{V()&&console.log(`Searching for Claude Code cli.js file at ${e}`);let t=g.join(e,`cli.js`),n=g.join(e,`package.json`),r=JSON.parse(await w.readFile(n,`utf8`));return V()&&(console.log(`Found Claude Code cli.js file at ${e}; checking hash...`),console.log(`SHA256 hash: ${await ne(t)}`)),{cliPath:t,packageJsonPath:n,version:r.version}}catch{continue}return null},me=async e=>{await le(),V()&&console.log(`Backing up cli.js to ${A}`),await w.copyFile(e.cliPath,A),await Z(t=>{t.changesApplied=!1,t.ccVersion=e.version})};async function he(e){try{return await w.stat(e),!0}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return!1;throw e}}async function ge(){let e=await ue(),t=await pe(e);if(!t)return null;let n=t.version,r=e.ccVersion;return await he(A)||await me(t),r&&n!==r?(await w.unlink(A),await me(t),{wasUpdated:!0,oldVersion:r,newVersion:n,ccInstInfo:t}):{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:t}}function _e(e){let t=e.indexOf(` ██████╗██╗ █████╗ ██╗ ██╗██████╗ ███████╗
8
+ `).map((e,n)=>p(t,{color:G,children:e},n)),p(e,{marginTop:1,children:p(t,{wrap:`truncate-end`,children:`Claude Code can now be used with your Claude subscription or billed based on API usage through your Console account.`})})]})]})]})}function se({onBack:n}){let{settings:{thinkingVerbs:{format:i,verbs:a},themes:o},updateSettings:s}=l($),c=[`format`,`verbs`],[u,h]=d(0),g=c[u],[_,v]=d(0),[y,b]=d(!1),[x,S]=d(``),[C,w]=d(!1),[T,E]=d(!1),[O,k]=d(i),A=ee(),j=o.find(e=>e.id===A)||o.find(e=>e.id===`dark`),M=j?.colors.claude||`rgb(215,119,87)`;return r((e,t)=>{if(T){t.return?(s(e=>{e.thinkingVerbs.format=O}),E(!1)):t.escape?(k(i),E(!1)):t.backspace||t.delete?k(e=>e.slice(0,-1)):e&&k(t=>t+e);return}if(y||C){t.return&&x.trim()?(C?(s(e=>{e.thinkingVerbs.verbs.push(x.trim())}),w(!1)):(s(e=>{e.thinkingVerbs.verbs[_]=x.trim()}),b(!1)),S(``)):t.escape?(S(``),b(!1),w(!1)):t.backspace||t.delete?S(e=>e.slice(0,-1)):e&&S(t=>t+e);return}t.escape?n():t.return?g===`format`&&(k(i),E(!0)):t.tab?t.shift?h(e=>e===0?c.length-1:e-1):h(e=>e===c.length-1?0:e+1):t.upArrow?g===`verbs`&&a.length>0&&v(e=>e>0?e-1:a.length-1):t.downArrow?g===`verbs`&&a.length>0&&v(e=>e<a.length-1?e+1:0):e===`e`&&g===`verbs`?a.length>0&&(S(a[_]),b(!0)):e===`d`&&g===`verbs`?a.length>1&&(s(e=>{e.thinkingVerbs.verbs=e.thinkingVerbs.verbs.filter((e,t)=>t!==_)}),_>=a.length-1&&v(Math.max(0,a.length-2))):e===`n`&&g===`verbs`?(w(!0),S(``)):t.ctrl&&e===`r`&&g===`verbs`&&(s(e=>{e.thinkingVerbs.verbs=[...D.thinkingVerbs.verbs]}),v(0))}),m(e,{children:[m(e,{flexDirection:`column`,width:`50%`,children:[m(e,{marginBottom:1,flexDirection:`column`,children:[p(P,{children:`Thinking Verbs`}),m(e,{flexDirection:`column`,children:[p(t,{dimColor:!0,children:g===`format`?`enter to edit format`:`changes auto-saved`}),p(t,{dimColor:!0,children:`esc to go back`}),p(t,{dimColor:!0,children:`tab to switch sections`})]})]}),p(e,{marginBottom:1,children:p(t,{dimColor:!0,children:`Customize the verbs shown during generation and their format.`})}),m(e,{flexDirection:`column`,children:[m(t,{children:[p(t,{color:g===`format`?`yellow`:void 0,children:g===`format`?`❯ `:` `}),p(t,{bold:!0,color:g===`format`?`yellow`:void 0,children:`Format`})]}),g===`format`&&(T?m(t,{dimColor:!0,children:[` `,`enter to save`]}):m(t,{dimColor:!0,children:[` `,`enter to edit`]}))]}),p(e,{marginLeft:2,marginBottom:1,children:p(e,{borderStyle:`round`,borderColor:T?`yellow`:`gray`,children:p(t,{children:T?O:i})})}),p(e,{children:m(t,{children:[p(t,{color:g===`verbs`?`yellow`:void 0,children:g===`verbs`?`❯ `:` `}),p(t,{bold:!0,color:g===`verbs`?`yellow`:void 0,children:`Verbs`})]})}),g===`verbs`&&p(e,{flexDirection:`column`,children:m(t,{dimColor:!0,children:[` `,`e to edit · d to delete · n to add new · ctrl+r to reset`]})}),p(e,{marginLeft:2,marginBottom:1,children:m(e,{flexDirection:`column`,children:[(()=>{let e=Math.max(0,_-4),n=Math.min(a.length,e+8),r=Math.max(0,n-8),i=a.slice(r,n);return m(f,{children:[r>0&&m(t,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,n)=>{let i=r+n;return m(t,{color:g===`verbs`&&i===_?`cyan`:void 0,children:[g===`verbs`&&i===_?`❯ `:` `,e]},i)}),n<a.length&&m(t,{color:`gray`,dimColor:!0,children:[` `,`↓ `,a.length-n,` more below`]})]})})(),C&&m(e,{alignItems:`center`,children:[p(t,{color:`yellow`,children:`❯ `}),p(e,{borderStyle:`round`,borderColor:`yellow`,children:p(t,{children:x})})]}),y&&m(e,{marginTop:1,alignItems:`center`,children:[p(t,{children:`Editing: `}),p(e,{borderStyle:`round`,borderColor:`yellow`,children:p(t,{children:x})})]})]})})]}),m(e,{width:`50%`,flexDirection:`column`,children:[p(e,{marginBottom:1,children:p(t,{bold:!0,children:`Preview`})}),p(e,{borderStyle:`single`,borderColor:`gray`,padding:1,flexDirection:`column`,children:m(t,{children:[m(t,{color:M,children:[`✻ `,i.replace(/\{\}/g,a[_]),` `]}),p(t,{color:j?.colors.secondaryText,children:`(10s · ↑ 456 tokens · esc to interrupt)`})]})})]})]})}const Y=[{name:`Default`,phases:D.thinkingStyle.phases,reverseMirror:D.thinkingStyle.reverseMirror},{name:`Basic`,phases:[`|`,`/`,`-`,`\\`],reverseMirror:!1},{name:`Braille`,phases:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`],reverseMirror:!1},{name:`Circle`,phases:[`◐`,`◓`,`◑`,`◒`],reverseMirror:!1},{name:`Wave`,phases:[`▁`,`▃`,`▄`,`▅`,`▆`,`▇`,`█`],reverseMirror:!0},{name:`Glow`,phases:[`░`,`▒`,`▓`,`█`],reverseMirror:!0},{name:`Partial block`,phases:[`▏`,`▎`,`▍`,`▌`,`▋`,`▊`,`▉`,`█`],reverseMirror:!0},{name:`Clock`,phases:[`🕛`,`🕐`,`🕑`,`🕒`,`🕓`,`🕔`,`🕕`,`🕖`,`🕗`,`🕘`,`🕙`,`🕚`],reverseMirror:!1},{name:`Globe`,phases:[`🌍`,`🌎`,`🌏`],reverseMirror:!1},{name:`Arc`,phases:[`◜`,`◠`,`◝`,`◞`,`◡`,`◟`],reverseMirror:!1},{name:`Triangle`,phases:[`◤`,`◥`,`◢`,`◣`],reverseMirror:!1},{name:`Bouncing`,phases:[`⠁`,`⠂`,`⠄`,`⡀`,`⢀`,`⠠`,`⠐`,`⠈`],reverseMirror:!1},{name:`Dots`,phases:[`.`,`..`,`...`],reverseMirror:!1},{name:`Colors`,phases:[`🔴`,`🟠`,`🟡`,`🟢`,`🔵`,`🟣`],reverseMirror:!1}];function ce({onBack:n}){let{settings:{thinkingStyle:{phases:i,updateInterval:a,reverseMirror:o},themes:s},updateSettings:c}=l($),h=[`reverseMirror`,`updateInterval`,`phases`,`presets`],[g,_]=d(0),v=h[g],[y,b]=d(0),[x,S]=d(0),[C,w]=d(!1),[T,E]=d(``),[O,k]=d(!1),[A,j]=d(!1),[M,N]=d(a.toString()),[F,I]=d(0),L=ee(),R=s.find(e=>e.id===L)||s.find(e=>e.id===`dark`),z=R?.colors.claude||`rgb(215,119,87)`;u(()=>{if(i.length>0){let e=o?[...i,...[...i].reverse().slice(1,-1)]:i,t=setInterval(()=>{I(t=>(t+1)%e.length)},a);return()=>clearInterval(t)}},[i,a,o]),r((e,t)=>{if(A){if(t.return){let e=parseInt(M);!isNaN(e)&&e>0&&c(t=>{t.thinkingStyle.updateInterval=e}),j(!1)}else t.escape?(N(a.toString()),j(!1)):t.backspace||t.delete?N(e=>e.slice(0,-1)):e&&e.match(/^[0-9]$/)&&N(t=>t+e);return}if(C||O){if(t.return&&T.length){let e=O?[...i,T]:i.map((e,t)=>t===y?T:e);c(t=>{t.thinkingStyle.phases=e}),w(!1),E(``)}else t.escape?(E(``),w(!1),k(!1)):t.backspace||t.delete?E(e=>e.slice(0,-1)):e&&E(t=>t+e);return}if(t.escape)n();else if(t.return)if(v===`updateInterval`)N(a.toString()),j(!0);else if(v===`presets`){let e=Y[x];c(t=>{t.thinkingStyle.phases=[...e.phases],t.thinkingStyle.reverseMirror=e.reverseMirror})}else v===`reverseMirror`&&c(e=>{e.thinkingStyle.reverseMirror=!e.thinkingStyle.reverseMirror});else if(t.tab)t.shift?_(e=>e===0?h.length-1:e-1):_(e=>e===h.length-1?0:e+1);else if(t.upArrow)v===`phases`&&i.length>0?b(e=>e>0?e-1:i.length-1):v===`presets`&&S(e=>e>0?e-1:Y.length-1);else if(t.downArrow)v===`phases`&&i.length>0?b(e=>e<i.length-1?e+1:0):v===`presets`&&S(e=>e<Y.length-1?e+1:0);else if(e===` `)v===`reverseMirror`&&c(e=>{e.thinkingStyle.reverseMirror=!e.thinkingStyle.reverseMirror});else if(e===`e`&&v===`phases`)i.length>0&&(E(i[y]),w(!0));else if(e===`a`&&v===`phases`)k(!0),E(``);else if(e===`d`&&v===`phases`)i.length>1&&(c(e=>{e.thinkingStyle.phases=i.filter((e,t)=>t!==y)}),y>=i.length&&b(Math.max(0,i.length-1)));else if(e===`w`&&v===`phases`){if(y>0){let e=[...i];[e[y-1],e[y]]=[e[y],e[y-1]],c(t=>{t.thinkingStyle.phases=e}),b(e=>e-1)}}else if(e===`s`&&v===`phases`){if(y<i.length-1){let e=[...i];[e[y],e[y+1]]=[e[y+1],e[y]],c(t=>{t.thinkingStyle.phases=e}),b(e=>e+1)}}else t.ctrl&&e===`r`&&(c(e=>{e.thinkingStyle=D.thinkingStyle}),b(0),S(0))});let B=o?`●`:`○`,V=()=>o?[...i,...[...i].reverse().slice(1,-1)]:i,H=V(),U=H.length>0?H[F]:`·`;return p(e,{children:m(e,{flexDirection:`column`,width:`100%`,children:[m(e,{flexDirection:`row`,width:`100%`,children:[m(e,{marginBottom:1,flexDirection:`column`,width:`50%`,children:[p(P,{children:`Thinking style`}),m(e,{flexDirection:`column`,children:[m(t,{dimColor:!0,children:[`enter to`,` `,v===`updateInterval`?`edit interval`:v===`presets`?`apply preset`:`save`]}),p(t,{dimColor:!0,children:`esc to go back`}),p(t,{dimColor:!0,children:`tab to switch sections`})]})]}),m(e,{width:`50%`,flexDirection:`column`,children:[p(e,{children:p(t,{bold:!0,children:`Preview`})}),m(e,{borderStyle:`single`,borderColor:`gray`,paddingX:1,flexDirection:`row`,children:[p(e,{width:(U?.length??0)+1,children:p(t,{color:z,children:U})}),m(t,{children:[p(t,{color:z,children:`Thinking… `}),p(t,{color:R?.colors.secondaryText,children:`(esc to interrupt)`})]})]})]})]}),m(e,{flexDirection:`row`,gap:4,children:[m(e,{flexDirection:`column`,children:[m(t,{children:[p(t,{color:v===`reverseMirror`?`yellow`:void 0,children:v===`reverseMirror`?`❯ `:` `}),p(t,{bold:!0,color:v===`reverseMirror`?`yellow`:void 0,children:`Reverse-mirror phases`})]}),v===`reverseMirror`&&m(t,{dimColor:!0,children:[` `,`space to toggle`]}),p(e,{marginLeft:2,marginBottom:1,children:m(t,{children:[B,` `,o?`Enabled`:`Disabled`]})})]}),m(e,{flexDirection:`column`,children:[m(t,{children:[p(t,{color:v===`updateInterval`?`yellow`:void 0,children:v===`updateInterval`?`❯ `:` `}),p(t,{bold:!0,color:v===`updateInterval`?`yellow`:void 0,children:`Update interval (ms)`})]}),v===`updateInterval`&&(A?m(t,{dimColor:!0,children:[` `,`enter to save`]}):m(t,{dimColor:!0,children:[` `,`enter to edit`]})),p(e,{marginLeft:2,marginBottom:1,children:p(e,{borderStyle:`round`,borderColor:A?`yellow`:`gray`,children:p(t,{children:A?M:a})})})]})]}),p(e,{children:m(t,{children:[p(t,{color:v===`phases`?`yellow`:void 0,children:v===`phases`?`❯ `:` `}),p(t,{bold:!0,color:v===`phases`?`yellow`:void 0,children:`Phases`})]})}),v===`phases`&&p(e,{marginBottom:1,flexDirection:`column`,children:m(t,{dimColor:!0,children:[` `,`[e]dit`,` `,`[a]dd`,` `,`[d]elete`,` `,`[w]move up`,` `,`[s]move down`]})}),p(e,{marginLeft:2,marginBottom:1,children:m(e,{flexDirection:`column`,children:[(()=>{let e=Math.max(0,y-4),n=Math.min(i.length,e+8),r=Math.max(0,n-8),a=i.slice(r,n);return m(f,{children:[r>0&&m(t,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),a.map((e,n)=>{let i=r+n;return m(t,{color:v===`phases`&&i===y?`cyan`:void 0,children:[v===`phases`&&i===y?`❯ `:` `,e]},i)}),n<i.length&&m(t,{color:`gray`,dimColor:!0,children:[` `,`↓ `,i.length-n,` more below`]})]})})(),O&&m(e,{children:[p(t,{color:`yellow`,children:`❯ `}),p(e,{borderStyle:`round`,borderColor:`yellow`,children:p(t,{children:T})})]}),C&&m(e,{marginTop:1,children:[p(t,{children:`Editing: `}),p(e,{borderStyle:`round`,borderColor:`yellow`,children:p(t,{children:T})})]})]})}),p(e,{children:m(t,{children:[p(t,{color:v===`presets`?`yellow`:void 0,children:v===`presets`?`❯ `:` `}),p(t,{bold:!0,color:v===`presets`?`yellow`:void 0,children:`Presets`})]})}),v===`presets`&&m(t,{dimColor:!0,children:[` `,`Selecting one will overwrite your choice of phases`]}),p(e,{marginLeft:2,marginBottom:1,children:p(e,{flexDirection:`column`,children:(()=>{let e=Math.max(0,x-4),n=Math.min(Y.length,e+8),r=Math.max(0,n-8),i=Y.slice(r,n);return m(f,{children:[r>0&&m(t,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,n)=>{let i=r+n;return m(t,{color:v===`presets`&&i===x?`cyan`:void 0,children:[v===`presets`&&i===x?`❯ `:` `,e.name,` `,e.phases.join(``)]},i)}),n<Y.length&&m(t,{color:`gray`,dimColor:!0,children:[` `,`↓ `,Y.length-n,` more below`]})]})})()})}),p(e,{marginTop:1,children:p(t,{dimColor:!0,children:`ctrl+r to reset all settings to default`})})]})})}const le=async()=>{await w.mkdir(O,{recursive:!0})};let X={settings:D,changesApplied:!1,ccVersion:``,lastModified:``,ccInstallationDir:null};const ue=async()=>{let e={ccVersion:``,ccInstallationDir:null,lastModified:new Date().toISOString(),changesApplied:!0,settings:D};try{V()&&console.log(`Reading config at ${k}`);let t=await w.readFile(k,`utf8`),n={...e,...JSON.parse(t)},r=n?.settings?.thinkingVerbs;r?.punctuation&&(r.format=`{}`+r.punctuation,delete r.punctuation);for(let e of D.themes){let t=n?.settings?.themes.find(t=>t.id===e.id||t.name===e.name);if(t)for(let[n,r]of Object.entries(e))Object.hasOwn(t,n)||(t[n]=r)}return X=n,n}catch(t){if(t instanceof Error&&`code`in t&&t.code===`ENOENT`)return e;throw t}},Z=async e=>(V()&&console.log(`Updating config at ${k}`),e(X),X.lastModified=new Date().toISOString(),await de(X),X),de=async e=>{try{e.lastModified=new Date().toISOString(),await le(),await w.writeFile(k,JSON.stringify(e,null,2))}catch(e){throw console.error(`Error saving config:`,e),e}},fe=async e=>(V()&&console.log(`Restoring cli.js from backup to ${e.cliPath}`),await w.copyFile(A,e.cliPath),await Z(e=>{e.changesApplied=!1}),!0),pe=async e=>{e.ccInstallationDir&&M.unshift(e.ccInstallationDir);for(let e of M)try{V()&&console.log(`Searching for Claude Code cli.js file at ${e}`);let t=g.join(e,`cli.js`),n=g.join(e,`package.json`),r=JSON.parse(await w.readFile(n,`utf8`));return V()&&(console.log(`Found Claude Code cli.js file at ${e}; checking hash...`),console.log(`SHA256 hash: ${await ne(t)}`)),{cliPath:t,packageJsonPath:n,version:r.version}}catch{continue}return null},me=async e=>{await le(),V()&&console.log(`Backing up cli.js to ${A}`),await w.copyFile(e.cliPath,A),await Z(t=>{t.changesApplied=!1,t.ccVersion=e.version})};async function he(e){try{return await w.stat(e),!0}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return!1;throw e}}async function ge(){let e=await ue(),t=await pe(e);if(!t)return null;let n=t.version,r=e.ccVersion,i=!1;return await he(A)||(V()&&console.log(`startupCheck: ${A} not found; backing up cli.js`),await me(t),i=!0),n===r?{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:t}:(i||(V()&&console.log(`startupCheck: real version (${n}) != backed up version (${r}); backing up cli.js`),await w.unlink(A),await me(t)),{wasUpdated:!0,oldVersion:r,newVersion:n,ccInstInfo:t})}function _e(e){let t=e.indexOf(` ██████╗██╗ █████╗ ██╗ ██╗██████╗ ███████╗
9
9
  ██╔════╝██║ ██╔══██╗██║ ██║██╔══██╗██╔════╝
10
10
  ██║ ██║ ███████║██║ ██║██║ ██║█████╗
11
11
  ██║ ██║ ██╔══██║██║ ██║██║ ██║██╔══╝
@@ -19,9 +19,9 @@ import{Box as e,Text as t,render as n,useInput as r,useStdout as i}from"ink";imp
19
19
  ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝`);return t===-1?null:{startIndex:t-1,endIndex:t+495+1}}function ve(e,t){let n=_e(e);if(!n)return e;let r=JSON.stringify(t),i=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return Q(e,i,r,n.startIndex,n.endIndex),i}function ye(e){let t=/switch\s*\(([^)]+)\)\s*\{[^}]*case\s*["']light["'][^}]+\}/s,n=e.match(t);if(!n||n.index==null)return console.error(`patch: themes: failed to find switchMatch`),null;let r=/\[(?:\{label:"(?:Dark|Light).+?",value:".+?"\},?)+\]/,i=/return\{(?:[\w$]+?:"(?:Dark|Light).+?",?)+\}/,a=e.match(r),o=e.match(i);return!a||a.index==null?(console.error(`patch: themes: failed to find objArrMatch`),null):!o||o.index==null?(console.error(`patch: themes: failed to find objMatch`),null):{switchStatement:{startIndex:n.index,endIndex:n.index+n[0].length,variableName:n[1].trim()},objArr:{startIndex:a.index,endIndex:a.index+a[0].length},obj:{startIndex:o.index,endIndex:o.index+o[0].length}}}const be=(e,t)=>{let n=ye(e);if(!n)return null;if(t.length===0)return e;let r=e,i=`return`+JSON.stringify(Object.fromEntries(t.map(e=>[e.id,e.name])));r=r.slice(0,n.obj.startIndex)+i+r.slice(n.obj.endIndex),Q(e,r,i,n.obj.startIndex,n.obj.endIndex),e=r;let a=JSON.stringify(t.map(e=>({label:e.name,value:e.id})));r=r.slice(0,n.objArr.startIndex)+a+r.slice(n.objArr.endIndex),Q(e,r,a,n.objArr.startIndex,n.objArr.endIndex),e=r;let o=`switch(${n.switchStatement.variableName}){\n`;return t.forEach(e=>{o+=`case"${e.id}":return${JSON.stringify(e.colors)};\n`}),o+=`default:return${JSON.stringify(t[0].colors)};\n}`,r=r.slice(0,n.switchStatement.startIndex)+o+r.slice(n.switchStatement.endIndex),Q(e,r,o,n.switchStatement.startIndex,n.switchStatement.endIndex),r},xe=e=>{let t=[],n=/\["[·✢*✳✶✻✽]",\s*(?:"[·✢*✳✶✻✽]",?\s*)+\]/g,r;for(;(r=n.exec(e))!==null;)t.push({startIndex:r.index,endIndex:r.index+r[0].length});return t},Se=(e,t)=>{let n=xe(e);if(n.length===0)return null;let r=JSON.stringify(t),i=n.sort((e,t)=>t.startIndex-e.startIndex),a=e;for(let e=0;e<i.length;e++){let t=a.slice(0,i[e].startIndex)+r+a.slice(i[e].endIndex);Q(a,t,r,i[e].startIndex,i[e].endIndex),a=t}return a},Ce=e=>{let t=/[\w$]+\(\(\)=>\{if\(![\w$]+\)\{[\w$]+\(\d+\);return\}[\w$]+\(\([^)]+\)=>[^)]+\+1\)\},(\d+)\)/,n=e.match(t);if(!n||n.index==null)return console.error(`patch: thinker symbol speed: failed to find match`),null;let r=n[0],i=n[1],a=r.lastIndexOf(i),o=n.index+a,s=o+i.length;return{startIndex:o,endIndex:s}},we=(e,t)=>{let n=Ce(e);if(!n)return null;let r=JSON.stringify(t),i=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return Q(e,i,r,n.startIndex,n.endIndex),i},Te=e=>{let t=/\b([$\w]+)=\{words:\[(?:"[^"{}()]+ing",)+"[^"{}()]+ing"\]\}/s,n=e.match(t);return!n||n.index==null?(console.error(`patch: thinker verbs: failed to find verbsMatch`),null):{verbsLocation:{startIndex:n.index,endIndex:n.index+n[0].length},varName:n[1]}},Ee=e=>{let t=/function (\w+)\(\)\{return \w+\("tengu_spinner_words",\w+\)\.words\}/,n=e.match(t);return!n||n.index==null?(console.error(`patch: thinker verbs: failed to find match`),null):{useLocation:{startIndex:n.index,endIndex:n.index+n[0].length},funcName:n[1]}},De=(e,t)=>{let n=Te(e);if(!n)return null;let{verbsLocation:r,varName:i}=n,a=`${i}=${JSON.stringify({words:t})}`,o=e.slice(0,r.startIndex)+a+e.slice(r.endIndex);Q(e,o,a,r.startIndex,r.endIndex);let s=Ee(o);if(!s)return null;let{useLocation:c,funcName:l}=s,u=`function ${l}(){return ${i}.words}`,d=o.slice(0,c.startIndex)+u+o.slice(c.endIndex);return Q(o,d,u,c.startIndex,c.endIndex),d},Oe=e=>{let t=/spinnerTip:\w+,(?:\w+:\w+,)*overrideMessage:\w+,.{300}/,n=e.match(t);if(!n||n.index==null)return console.error(`patch: thinker format: failed to find approxAreaMatch`),null;let r=e.slice(n.index,n.index+300),i=/[$\w]+=([^=]+?)\+"…"/,a=r.match(i);if(!a||a.index==null)return console.error(`patch: thinker format: failed to find formatMatch`),null;let o=r.indexOf(`=`,a.index)+1;return{fmtLocation:{startIndex:n.index+o,endIndex:n.index+a.index+a[0].length},curVerb:a[1]}},ke=(e,t)=>{let n=Oe(e);if(!n)return null;let{fmtLocation:r,curVerb:i}=n,a="`"+t.replace(/\\/g,`\\\\`).replace(/`/g,"\\`").replace(/\{\}/g,"${"+i+`}`)+"`",o=e.slice(0,r.startIndex)+a+e.slice(r.endIndex);return Q(e,o,a,r.startIndex,r.endIndex),o},Ae=e=>{let t=/=\s*\[\.\.\.(\w+),\s*\.\.\.?\[\.\.\.\1\]\.reverse\(\)\]/,n=e.match(t);return!n||n.index==null?(console.error(`patch: thinker symbol mirror option: failed to find match`),null):{startIndex:n.index,endIndex:n.index+n[0].length,variableName:n[1]}},je=(e,t)=>{let n=Ae(e);if(!n)return null;let r=n.variableName,i=t?`=[...${r},...[...${r}].reverse()]`:`=[...${r}]`,a=e.slice(0,n.startIndex)+i+e.slice(n.endIndex);return Q(e,a,i,n.startIndex,n.endIndex),a},Me=e=>{let t=/\{flexWrap:"wrap",height:1,width:2\}/,n=e.match(t);return!n||n.index==null?(console.error(`patch: thinker symbol width: failed to find match`),null):{startIndex:n.index,endIndex:n.index+n[0].length}},Ne=(e,t)=>{let n=Me(e);if(!n)return null;let r=`{flexWrap:"wrap",height:1,width:${t}}`,i=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return Q(e,i,r,n.startIndex,n.endIndex),i};function Q(e,t,n,r,i){let a=Math.max(0,r-20),o=Math.min(e.length,i+20),s=Math.min(t.length,r+n.length+20),c=e.slice(a,r),l=e.slice(r,i),u=e.slice(i,o),d=t.slice(a,r),f=t.slice(r,r+n.length),p=t.slice(r+n.length,s);V()&&(console.log(`
20
20
  --- Diff ---`),console.log(`OLD:`,c+`\x1b[31m${l}\x1b[0m`+u),console.log(`NEW:`,d+`\x1b[32m${f}\x1b[0m`+p),console.log(`--- End Diff ---
21
21
  `))}const Pe=async(e,t)=>{await fe(t);let n=await C.readFile(t.cliPath,{encoding:`utf8`}),r=null;if(e.settings.themes&&e.settings.themes.length>0&&(r=be(n,e.settings.themes))&&(n=r),e.settings.launchText){let t=e.settings.launchText,i=``;t.method===`custom`&&t.customText?i=t.customText:t.method===`figlet`&&t.figletText&&(i=await new Promise(e=>S.text(t.figletText.replace(`
22
- `,` `),t.figletFont,(t,n)=>{t?(console.error(`patch: figlet: failed to generate text`,t),e(``)):e(n||``)}))),(r=ve(n,i))&&(n=r)}return e.settings.thinkingVerbs&&((r=De(n,e.settings.thinkingVerbs.verbs))&&(n=r),(r=ke(n,e.settings.thinkingVerbs.format))&&(n=r)),(r=Se(n,e.settings.thinkingStyle.phases))&&(n=r),(r=we(n,e.settings.thinkingStyle.updateInterval))&&(n=r),(r=Ne(n,Math.max(...e.settings.thinkingStyle.phases.map(e=>e.length))+1))&&(n=r),(r=je(n,e.settings.thinkingStyle.reverseMirror))&&(n=r),await C.writeFile(t.cliPath,n),await Z(e=>{e.changesApplied=!0})},$=s({settings:D,updateSettings:e=>{},changesApplied:!1});function Fe({startupCheckInfo:t}){let[n,i]=d({settings:D,changesApplied:!1,ccVersion:``,lastModified:``,ccInstallationDir:null});u(()=>{let e=async()=>{i(await ue())};e()},[]);let a=c(e=>{e(n.settings),Z(e=>{e.settings=n.settings,e.changesApplied=!1}).then(e=>{i(e)})},[n]),[o,s]=d(null),[l,f]=d(null);u(()=>{t.wasUpdated&&(f({message:`Your Claude Code installation was updated from ${t.oldVersion} to ${t.newVersion}, and the patching was likely overwritten
22
+ `,` `),t.figletFont,(t,n)=>{t?(console.error(`patch: figlet: failed to generate text`,t),e(``)):e(n||``)}))),(r=ve(n,i))&&(n=r)}return e.settings.thinkingVerbs&&((r=De(n,e.settings.thinkingVerbs.verbs))&&(n=r),(r=ke(n,e.settings.thinkingVerbs.format))&&(n=r)),(r=Se(n,e.settings.thinkingStyle.phases))&&(n=r),(r=we(n,e.settings.thinkingStyle.updateInterval))&&(n=r),(r=Ne(n,Math.max(...e.settings.thinkingStyle.phases.map(e=>e.length))+1))&&(n=r),(r=je(n,e.settings.thinkingStyle.reverseMirror))&&(n=r),await C.writeFile(t.cliPath,n),await Z(e=>{e.changesApplied=!0})},$=s({settings:D,updateSettings:e=>{},changesApplied:!1});function Fe({startupCheckInfo:t}){let[n,i]=d({settings:D,changesApplied:!1,ccVersion:``,lastModified:``,ccInstallationDir:null});u(()=>{let e=async()=>{i(await ue())};e()},[]);let a=c(e=>{e(n.settings),Z(e=>{e.settings=n.settings,e.changesApplied=!1}).then(e=>{i(e)})},[n]),[o,s]=d(null),[l,f]=d(null);u(()=>{t.wasUpdated&&t.oldVersion&&(f({message:`Your Claude Code installation was updated from ${t.oldVersion} to ${t.newVersion}, and the patching was likely overwritten
23
23
  (However, your customization are still remembered in ${k}.)
24
- Please reapply your changes below.`,type:`warning`}),a(()=>{}))},[]),r((e,t)=>{(t.ctrl&&e===`c`||(e===`q`||t.escape)&&!o)&&process.exit(0)});let m=e=>{switch(f(null),e){case E.THEMES:case E.LAUNCH_TEXT:case E.THINKING_VERBS:case E.THINKING_STYLE:s(e);break;case E.APPLY_CHANGES:t.ccInstInfo&&(f({message:`Applying patches...`,type:`info`}),Pe(n,t.ccInstInfo).then(e=>{i(e),f({message:`Customization patches applied successfully!`,type:`success`})}));break;case E.RESTORE_ORIGINAL:t.ccInstInfo&&fe(t.ccInstInfo).then(()=>{f({message:`Original Claude Code restored successfully!`,type:`success`}),a(()=>{})});break;case E.OPEN_CONFIG:U(k);break;case E.OPEN_CLI:t.ccInstInfo&&U(t.ccInstInfo.cliPath);break;case E.EXIT:process.exit(0)}},h=()=>{s(null)};return p($.Provider,{value:{settings:n.settings,updateSettings:a,changesApplied:n.changesApplied},children:p(e,{flexDirection:`column`,children:o===null?p(L,{onSubmit:m,notification:l}):o===E.THEMES?p(ae,{onBack:h}):o===E.LAUNCH_TEXT?p(oe,{onBack:h}):o===E.THINKING_VERBS?p(se,{onBack:h}):o===E.THINKING_STYLE?p(ce,{onBack:h}):null})})}const Ie=async()=>{let e=new a;e.name(`tweakcc`).description(`Command-line tool to customize your Claude Code theme colors, thinking verbs and more.`).version(`1.1.2`).option(`-d, --debug`,`enable debug mode`),e.parse();let t=e.opts();t.debug&&H();let r=await ge();r?n(p(Fe,{startupCheckInfo:r})):(console.error(`\x1b[31mCannot find Claude Code's cli.js -- do you have Claude Code installed?
24
+ Please reapply your changes below.`,type:`warning`}),a(()=>{}))},[]),r((e,t)=>{(t.ctrl&&e===`c`||(e===`q`||t.escape)&&!o)&&process.exit(0)});let m=e=>{switch(f(null),e){case E.THEMES:case E.LAUNCH_TEXT:case E.THINKING_VERBS:case E.THINKING_STYLE:s(e);break;case E.APPLY_CHANGES:t.ccInstInfo&&(f({message:`Applying patches...`,type:`info`}),Pe(n,t.ccInstInfo).then(e=>{i(e),f({message:`Customization patches applied successfully!`,type:`success`})}));break;case E.RESTORE_ORIGINAL:t.ccInstInfo&&fe(t.ccInstInfo).then(()=>{f({message:`Original Claude Code restored successfully!`,type:`success`}),a(()=>{})});break;case E.OPEN_CONFIG:U(k);break;case E.OPEN_CLI:t.ccInstInfo&&U(t.ccInstInfo.cliPath);break;case E.EXIT:process.exit(0)}},h=()=>{s(null)};return p($.Provider,{value:{settings:n.settings,updateSettings:a,changesApplied:n.changesApplied},children:p(e,{flexDirection:`column`,children:o===null?p(L,{onSubmit:m,notification:l}):o===E.THEMES?p(ae,{onBack:h}):o===E.LAUNCH_TEXT?p(oe,{onBack:h}):o===E.THINKING_VERBS?p(se,{onBack:h}):o===E.THINKING_STYLE?p(ce,{onBack:h}):null})})}const Ie=async()=>{let e=new a;e.name(`tweakcc`).description(`Command-line tool to customize your Claude Code theme colors, thinking verbs and more.`).version(`1.1.3`).option(`-d, --debug`,`enable debug mode`),e.parse();let t=e.opts();t.debug&&H();let r=await ge();r?n(p(Fe,{startupCheckInfo:r})):(console.error(`\x1b[31mCannot find Claude Code's cli.js -- do you have Claude Code installed?
25
25
 
26
26
  Searched at the following locations:
27
27
  ${M.map(e=>`- `+e).join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tweakcc",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "type": "module",
5
5
  "description": "Command-line tool to customize your Claude Code theme colors, thinking verbs and more.",
6
6
  "main": "dist/index.js",