tweakcc 1.0.0
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/LICENSE +21 -0
- package/README.md +53 -0
- package/dist/index.js +36 -0
- package/package.json +63 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Piebald LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# tweakcc
|
|
2
|
+
|
|
3
|
+
Customize your Claude Code installations styles.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npx tweakcc
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Create custom themes, change the list of verbs shown during generation (when Haiku generation is turned off), change the spinner animation, and the banner text shown when you sign in. More options are coming soon, such as adding elements to the footer, customizing the generation status line, and modifying prompts used in generation.
|
|
10
|
+
|
|
11
|
+
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.
|
|
12
|
+
|
|
13
|
+
Works with Claude Code 1.0.60.
|
|
14
|
+
|
|
15
|
+
## Running
|
|
16
|
+
|
|
17
|
+
Use `npx tweakcc` or build and run it locally:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
git clone https://github.com/Piebald-AI/tweakcc.git
|
|
21
|
+
cd tweakcc
|
|
22
|
+
pnpm i
|
|
23
|
+
pnpm build
|
|
24
|
+
node dist/index.js
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Demo
|
|
28
|
+
|
|
29
|
+
Edit themes:
|
|
30
|
+
|
|
31
|
+
<img alt="tweakcc theme edit view" src="https://raw.githubusercontent.com/Piebald-AI/tweakcc/main/assets/theme_1.png" width="600">
|
|
32
|
+
|
|
33
|
+
Built-in color picker:
|
|
34
|
+
|
|
35
|
+
<img alt="tweakcc theme color edit view" src="https://raw.githubusercontent.com/Piebald-AI/tweakcc/main/assets/theme_2.png" width="600">
|
|
36
|
+
|
|
37
|
+
Edit the thinking spinner:
|
|
38
|
+
|
|
39
|
+
<img alt="tweakcc thinking styles edit view" src="https://raw.githubusercontent.com/Piebald-AI/tweakcc/main/assets/thinking_styles.png" width="600">
|
|
40
|
+
|
|
41
|
+
Apply your changes:
|
|
42
|
+
|
|
43
|
+
<img alt="tweakcc launch screen" src="https://raw.githubusercontent.com/Piebald-AI/tweakcc/main/assets/startup.png" width="600">
|
|
44
|
+
|
|
45
|
+
Run Claude Code!
|
|
46
|
+
|
|
47
|
+
<img alt="Customized Claude Code demo" src="https://raw.githubusercontent.com/Piebald-AI/tweakcc/main/assets/claude_demo.png" width="600">
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
[MIT](https://github.com/Piebald-AI/tweakcc/blob/main/LICENSE)
|
|
52
|
+
|
|
53
|
+
Copyright © 2025 [Piebald LLC](https://piebald.ai).
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{Fragment as e,createContext as t,useCallback as n,useContext as r,useEffect as i,useState as a}from"react";import{Box as o,Text as s,render as c,useInput as l,useStdout as u}from"ink";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";import*as m from"node:path";import h from"node:path";import*as g from"node:os";import _ from"figlet";import*as v from"node:fs";import*as y from"node:child_process";import*as b from"node:fs/promises";import x from"node:fs/promises";function S({items:e,selectedIndex:t,onSelect:n,onSubmit:r}){return l((i,a)=>{a.upArrow?n(t>0?t-1:e.length-1):a.downArrow?n(t<e.length-1?t+1:0):a.return&&r(e[t].name)}),f(o,{flexDirection:`column`,children:e.map((e,n)=>f(o,{children:p(s,{children:[p(s,{bold:n===t,color:n===t?`cyan`:void 0,...n===t?e.selectedStyles??{}:e.styles??{},children:[n===t?`❯ `:` `,e.name]}),e.desc&&n===t&&p(s,{dimColor:!0,bold:!1,children:[` \x1B[0;2m`,`- `,e.desc]})]})},n))})}let C=function(e){return e.THEMES=`Themes`,e.LAUNCH_TEXT=`Launch text`,e.THINKING_VERBS=`Thinking verbs`,e.THINKING_STYLE=`Thinking style`,e.APPLY_CHANGES=`*Apply customizations to cli.js`,e.RESTORE_ORIGINAL=`Restore original Claude Code (preserves tweakcc.json)`,e.OPEN_CONFIG=`Open tweakcc.json`,e.OPEN_CLI=`Open Claude Code's cli.js`,e.EXIT=`Exit`,e}({});const w={themes:[{name:`Dark mode`,id:`dark`,colors:{autoAccept:`rgb(175,135,255)`,bashBorder:`rgb(253,93,177)`,claude:`rgb(215,119,87)`,permission:`rgb(177,185,249)`,planMode:`rgb(72,150,140)`,secondaryBorder:`rgb(136,136,136)`,text:`rgb(255,255,255)`,inverseText:`rgb(0,0,0)`,secondaryText:`rgb(153,153,153)`,suggestion:`rgb(177,185,249)`,remember:`rgb(177,185,249)`,success:`rgb(78,186,101)`,error:`rgb(255,107,128)`,warning:`rgb(255,193,7)`,diffAdded:`rgb(34,92,43)`,diffRemoved:`rgb(122,41,54)`,diffAddedDimmed:`rgb(71,88,74)`,diffRemovedDimmed:`rgb(105,72,77)`,diffAddedWord:`rgb(56,166,96)`,diffRemovedWord:`rgb(179,89,107)`,diffAddedWordDimmed:`rgb(46,107,58)`,diffRemovedWordDimmed:`rgb(139,57,69)`}},{name:`Light mode`,id:`light`,colors:{autoAccept:`rgb(135,0,255)`,bashBorder:`rgb(255,0,135)`,claude:`rgb(215,119,87)`,permission:`rgb(87,105,247)`,planMode:`rgb(0,102,102)`,secondaryBorder:`rgb(153,153,153)`,text:`rgb(0,0,0)`,inverseText:`rgb(255,255,255)`,secondaryText:`rgb(102,102,102)`,suggestion:`rgb(87,105,247)`,remember:`rgb(0,0,255)`,success:`rgb(44,122,57)`,error:`rgb(171,43,63)`,warning:`rgb(150,108,30)`,diffAdded:`rgb(105,219,124)`,diffRemoved:`rgb(255,168,180)`,diffAddedDimmed:`rgb(199,225,203)`,diffRemovedDimmed:`rgb(253,210,216)`,diffAddedWord:`rgb(47,157,68)`,diffRemovedWord:`rgb(209,69,75)`,diffAddedWordDimmed:`rgb(144,194,156)`,diffRemovedWordDimmed:`rgb(232,165,173)`}},{name:`Light mode (ANSI colors only)`,id:`light-ansi`,colors:{autoAccept:`#cd00cd`,bashBorder:`#cd00cd`,claude:`#cdcd00`,permission:`#0000ee`,planMode:`#00cdcd`,secondaryBorder:`#e5e5e5`,text:`#000000`,inverseText:`#ffffff`,secondaryText:`#7f7f7f`,suggestion:`#0000ee`,remember:`#0000ee`,success:`#00cd00`,error:`#cd0000`,warning:`#cdcd00`,diffAdded:`#00cd00`,diffRemoved:`#cd0000`,diffAddedDimmed:`#00cd00`,diffRemovedDimmed:`#cd0000`,diffAddedWord:`#00ff00`,diffRemovedWord:`#ff0000`,diffAddedWordDimmed:`#00cd00`,diffRemovedWordDimmed:`#cd0000`}},{name:`Dark mode (ANSI colors only)`,id:`dark-ansi`,colors:{autoAccept:`#ff00ff`,bashBorder:`#ff00ff`,claude:`#cdcd00`,permission:`#5c5cff`,planMode:`#00ffff`,secondaryBorder:`#e5e5e5`,text:`#ffffff`,inverseText:`#000000`,secondaryText:`#e5e5e5`,suggestion:`#5c5cff`,remember:`#5c5cff`,success:`#00ff00`,error:`#ff0000`,warning:`#ffff00`,diffAdded:`#00cd00`,diffRemoved:`#cd0000`,diffAddedDimmed:`#00cd00`,diffRemovedDimmed:`#cd0000`,diffAddedWord:`#00ff00`,diffRemovedWord:`#ff0000`,diffAddedWordDimmed:`#00cd00`,diffRemovedWordDimmed:`#cd0000`}},{name:`Light mode (colorblind-friendly)`,id:`light-daltonized`,colors:{autoAccept:`rgb(135,0,255)`,bashBorder:`rgb(0,102,204)`,claude:`rgb(255,153,51)`,permission:`rgb(51,102,255)`,planMode:`rgb(51,102,102)`,secondaryBorder:`rgb(153,153,153)`,text:`rgb(0,0,0)`,inverseText:`rgb(255,255,255)`,secondaryText:`rgb(102,102,102)`,suggestion:`rgb(51,102,255)`,remember:`rgb(51,102,255)`,success:`rgb(0,102,153)`,error:`rgb(204,0,0)`,warning:`rgb(255,153,0)`,diffAdded:`rgb(153,204,255)`,diffRemoved:`rgb(255,204,204)`,diffAddedDimmed:`rgb(209,231,253)`,diffRemovedDimmed:`rgb(255,233,233)`,diffAddedWord:`rgb(51,102,204)`,diffRemovedWord:`rgb(153,51,51)`,diffAddedWordDimmed:`rgb(102,153,204)`,diffRemovedWordDimmed:`rgb(204,153,153)`}},{name:`Dark mode (colorblind-friendly)`,id:`dark-daltonized`,colors:{autoAccept:`rgb(175,135,255)`,bashBorder:`rgb(51,153,255)`,claude:`rgb(255,153,51)`,permission:`rgb(153,204,255)`,planMode:`rgb(102,153,153)`,secondaryBorder:`rgb(136,136,136)`,text:`rgb(255,255,255)`,inverseText:`rgb(0,0,0)`,secondaryText:`rgb(153,153,153)`,suggestion:`rgb(153,204,255)`,remember:`rgb(153,204,255)`,success:`rgb(51,153,255)`,error:`rgb(255,102,102)`,warning:`rgb(255,204,0)`,diffAdded:`rgb(0,68,102)`,diffRemoved:`rgb(102,0,0)`,diffAddedDimmed:`rgb(62,81,91)`,diffRemovedDimmed:`rgb(62,44,44)`,diffAddedWord:`rgb(0,119,179)`,diffRemovedWord:`rgb(179,0,0)`,diffAddedWordDimmed:`rgb(26,99,128)`,diffRemovedWordDimmed:`rgb(128,21,21)`}}],launchText:{method:`figlet`,figletText:`Claude Code`,figletFont:`ANSI Shadow`,customText:``},thinkingVerbs:{useHaikuGenerated:!0,punctuation:`…`,verbs:`Accomplishing.Actioning.Actualizing.Baking.Booping.Brewing.Calculating.Cerebrating.Channelling.Churning.Clauding.Coalescing.Cogitating.Combobulating.Computing.Concocting.Conjuring.Considering.Contemplating.Cooking.Crafting.Creating.Crunching.Deciphering.Deliberating.Determining.Discombobulating.Divining.Doing.Effecting.Elucidating.Enchanting.Envisioning.Finagling.Flibbertigibbeting.Forging.Forming.Frolicking.Generating.Germinating.Hatching.Herding.Honking.Hustling.Ideating.Imagining.Incubating.Inferring.Jiving.Manifesting.Marinating.Meandering.Moseying.Mulling.Musing.Mustering.Noodling.Percolating.Perusing.Philosophising.Pondering.Pontificating.Processing.Puttering.Puzzling.Reticulating.Ruminating.Scheming.Schlepping.Shimmying.Shucking.Simmering.Smooshing.Spelunking.Spinning.Stewing.Sussing.Synthesizing.Thinking.Tinkering.Transmuting.Unfurling.Unravelling.Vibing.Wandering.Whirring.Wibbling.Wizarding.Working.Wrangling`.split(`.`)},thinkingStyle:{updateInterval:120,phases:{}.TERM===`xterm-ghostty`?[`·`,`✢`,`✳`,`✶`,`✻`,`*`]:process.platform===`darwin`?[`·`,`✢`,`✳`,`✶`,`✻`,`✽`]:[`·`,`✢`,`*`,`✶`,`✻`,`✽`],reverseMirror:!0}},T=m.join(g.homedir(),`.tweakcc`),E=m.join(T,`config.json`),D=m.join(T,`cli.js.backup`),O=[m.join(g.homedir(),`AppData`,`Local`,`Volta`,`tools`,`image`,`packages`,`@anthropic-ai`,`claude-code`,`node_modules`,`@anthropic-ai`,`claude-code`),m.join(g.homedir(),`AppData`,`Roaming`,`npm`,`node_modules`,`@anthropic-ai`,`claude-code`),m.join(g.homedir(),`AppData`,`Local`,`Yarn`,`config`,`global`,`node_modules`,`@anthropic-ai`,`claude-code`),m.join(g.homedir(),`AppData`,`Local`,`pnpm`,`global`,`5`,`node_modules`,`@anthropic-ai`,`claude-code`)];({}).N_PREFIX&&O.push(m.join({}.N_PREFIX,`lib`,`node_modules`,`@anthropic-ai`,`claude-code`)),process.platform!=`win32`&&O.push(m.join(`/usr`,`local`,`lib`,`node_modules`,`@anthropic-ai`,`claude-code`));const k=[{name:C.THEMES,desc:`Modify Claude Code's built-in themes or create your own`},{name:C.LAUNCH_TEXT,desc:`Change the "CLAUDE CODE" banner text that's shown when you sign in to Claude Code`},{name:C.THINKING_VERBS,desc:`Customize the list of verbs that Claude Code uses when it's working`},{name:C.THINKING_STYLE,desc:`Choose custom spinners`}],A=[{name:C.RESTORE_ORIGINAL,desc:`Reverts your Claude Code install to its original state (your customizations are remembered and can be reapplied)`},{name:C.OPEN_CONFIG,desc:`Opens your tweack cc config file (${E})`},{name:C.OPEN_CLI,desc:`Opens Claude Code's cli.js file`},{name:C.EXIT,desc:`Bye!`}];function j({onSubmit:e,notification:t}){let n=[...r($).changesApplied?[]:[{name:C.APPLY_CHANGES,desc:`Required: Updates Claude Code's cli.js in-place with your changes`,selectedStyles:{color:`green`}}],...k,...A],[i,c]=a(0);return p(o,{flexDirection:`column`,children:[f(o,{marginBottom:1,children:p(s,{bold:!0,backgroundColor:`#ffd500`,color:`black`,children:[` `,`Tweak Claude Code`,` `]})}),f(o,{marginBottom:1,children:p(s,{color:`gray`,children:[f(s,{bold:!0,children:`Customize your Claude Code installation.`}),` `,f(s,{dimColor:!0,children:`Settings will be saved to a JSON file.`})]})}),t&&f(o,{marginBottom:1,borderLeft:!0,borderRight:!1,borderTop:!1,borderBottom:!1,borderStyle:`bold`,borderColor:t?.type===`success`?`green`:t?.type===`error`?`red`:t?.type===`info`?`blue`:`yellow`,paddingLeft:1,flexDirection:`column`,children:f(s,{color:t?.type===`success`?`green`:t?.type===`error`?`red`:t?.type===`info`?`blue`:`yellow`,children:t?.message})}),f(S,{items:n,selectedIndex:i,onSelect:c,onSubmit:t=>e(t)})]})}function M({theme:e}){return p(o,{flexDirection:`column`,paddingLeft:1,children:[f(o,{marginBottom:1,children:p(s,{bold:!0,children:[`Preview: `,e.name]})}),f(o,{borderStyle:`single`,borderColor:`gray`,padding:1,children:p(o,{flexDirection:`column`,children:[f(s,{children:`╭─────────────────────────────────────────────╮`}),p(s,{children:[`│ `,f(s,{color:e.colors.secondaryText,children:`1`}),` `,p(s,{color:e.colors.text,children:[`function greet() `,`{`]}),` `,`│`]}),p(s,{children:[`│ `,f(s,{color:e.colors.secondaryText,children:`2`}),` `,p(s,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:[`- console.log("`,f(s,{backgroundColor:e.colors.diffRemovedWord,children:`Hello, World!`}),`");`]}),` `,`│`]}),p(s,{children:[`│ `,f(s,{color:e.colors.secondaryText,children:`2`}),` `,p(s,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:[`+ console.log("`,f(s,{backgroundColor:e.colors.diffAddedWord,children:`Hello, Claude!`}),`");`]}),` `,`│`]}),f(s,{color:e.colors.warning,children:`╭─────────────────────────────────────────────╮`}),p(s,{color:e.colors.warning,children:[`│ Do you trust the files in this folder?`,` `,`│`]}),p(s,{children:[f(s,{color:e.colors.warning,children:`│ `}),f(s,{color:`white`,dimColor:!0,children:`Enter to confirm · Esc to exit`}),p(s,{color:e.colors.warning,children:[` `,`│`]})]}),f(s,{color:e.colors.claude,children:`╭─────────────────────────────────────────────╮`}),p(s,{children:[f(s,{color:e.colors.claude,children:`│ `}),f(s,{color:e.colors.claude,children:`✻`}),f(s,{children:` Welcome to Tweak Claude Code!`}),p(s,{color:e.colors.claude,children:[` `,`│`]})]}),p(s,{children:[f(s,{color:e.colors.claude,children:`│`}),p(s,{color:e.colors.secondaryText,italic:!0,children:[` `,`/help for help, /status for your current set`]}),f(s,{color:e.colors.claude,children:`│`})]}),p(s,{color:e.colors.success,children:[`Login successful. Press `,f(s,{bold:!0,children:`Enter`}),` to continue…`]}),f(s,{color:e.colors.bashBorder,children:`╭─────────────────────────────────────────────╮`}),p(s,{children:[f(s,{color:e.colors.bashBorder,children:`│ !`}),p(s,{color:`white`,children:[` `,`ls`,` `]}),f(s,{color:e.colors.bashBorder,children:`│`})]}),f(s,{color:e.colors.planMode,children:`╭─────────────────────────────────────────────╮`}),p(s,{children:[f(s,{color:e.colors.planMode,children:`│ `}),f(s,{color:e.colors.permission,children:`Ready to code?`}),p(s,{color:e.colors.planMode,children:[` `,`│`]})]}),p(s,{children:[f(s,{color:e.colors.planMode,children:`│ `}),f(s,{children:`Here is Claude's plan:`}),p(s,{color:e.colors.planMode,children:[` `,`│`]})]}),f(s,{color:e.colors.secondaryBorder,children:`╭─────────────────────────────────────────────╮`}),p(s,{children:[f(s,{color:e.colors.secondaryBorder,children:`│`}),` `,p(s,{color:e.colors.secondaryText,children:[`> Try “refactor <filepath>”`,` `,`│`]})]}),f(s,{color:e.colors.permission,children:`╭─────────────────────────────────────────────╮`}),p(s,{children:[p(s,{color:e.colors.permission,children:[`│ `,f(s,{bold:!0,children:`Permissions:`})]}),` `,p(s,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[` `,`Allow`,` `]}),` `,`Deny`,` `,`Workspace`,` `,f(s,{color:e.colors.permission,children:`│`})]}),f(s,{color:e.colors.secondaryText,children:`> list the dir`}),p(s,{children:[f(s,{color:e.colors.error,children:`●`}),f(s,{color:`white`,children:` Update(__init__.py)`})]}),p(s,{children:[f(s,{children:` ⎿ `}),f(s,{color:e.colors.error,children:`User rejected update to __init__.py`})]}),p(s,{color:`white`,children:[` `,f(s,{color:e.colors.secondaryText,children:`1`}),` `,p(s,{backgroundColor:e.colors.diffRemovedDimmed,color:e.colors.text,children:[`- import`,` `,f(s,{backgroundColor:e.colors.diffRemovedWordDimmed,color:e.colors.text,children:`os`})]})]}),p(s,{color:`white`,children:[` `,f(s,{color:e.colors.secondaryText,children:`2`}),` `,p(s,{backgroundColor:e.colors.diffAddedDimmed,color:e.colors.text,children:[`+ import`,` `,f(s,{backgroundColor:e.colors.diffAddedWordDimmed,color:e.colors.text,children:`random`})]})]}),p(s,{children:[f(s,{color:e.colors.success,children:`●`}),f(s,{color:`white`,children:` List(.)`})]}),f(s,{color:`white`,children:` ⎿ Listed 123 paths (ctrl+r to expand)`}),p(s,{children:[f(s,{color:e.colors.secondaryText,children:`●`}),f(s,{color:`white`,children:` The directory `}),f(s,{color:e.colors.permission,children:`C:\\Users\\user`}),f(s,{color:`white`,children:` contains **123** files.`})]}),p(s,{children:[f(s,{color:e.colors.claude,children:`✻ Thinking… `}),f(s,{color:e.colors.secondaryText,children:`(10s · ↑ 456 tokens · esc to interrupt)`})]}),p(s,{children:[p(s,{color:e.colors.autoAccept,children:[`⏵⏵ auto-accept edits on`,` `]}),f(s,{color:e.colors.secondaryText,dimColor:!0,children:`(shift+tab to cycle)`})]}),p(s,{children:[f(s,{color:e.colors.planMode,children:`⏸ plan mode on `}),f(s,{color:e.colors.secondaryText,dimColor:!0,children:`(shift+tab to cycle)`})]})]})})]})}function N({colorKey:e,theme:t,bold:n=!1}){let r=t.colors[e];return e===`inverseText`?f(s,{color:r,backgroundColor:t.colors.permission,bold:n,children:e}):e.startsWith(`diff`)?f(s,{backgroundColor:r,bold:n,color:t.colors.text,children:e}):f(s,{color:r,bold:n,children:e})}function P({initialValue:t,onColorChange:n,onExit:r,onCancel:c,colorKey:u,theme:m}){let h=I(t)||{h:0,s:50,l:50},g=F(t)||{r:128,g:128,b:128},[_,v]=a(h),[y,b]=a(g),[x,S]=a(`hsl`),[C,w]=a(`h`),[T,E]=a(!1);i(()=>{let e=I(t),n=F(t);e&&n&&(E(!0),v(e),b(n),E(!1))},[t]),i(()=>{if(!T){let e=`rgb(${y.r},${y.g},${y.b})`;n(e)}},[_,y,T]),l((e,t)=>{if(t.return)r();else if(t.escape)c();else if(t.ctrl&&e===`a`)S(e=>e===`hsl`?`rgb`:`hsl`),w(e=>x===`hsl`?e===`h`?`r`:e===`s`?`g`:`b`:e===`r`?`h`:e===`g`?`s`:`l`);else if(t.upArrow)w(x===`hsl`?e=>e===`h`?`l`:e===`s`?`h`:`s`:e=>e===`r`?`b`:e===`g`?`r`:`g`);else if(t.downArrow||t.tab)w(x===`hsl`?e=>e===`h`?`s`:e===`s`?`l`:`h`:e=>e===`r`?`g`:e===`g`?`b`:`r`);else if(t.leftArrow){let e=t.shift||t.ctrl||t.meta?-10:-1;D(e)}else if(t.rightArrow){let e=t.shift||t.ctrl||t.meta?10:1;D(e)}});let D=e=>{E(!0),x===`hsl`?v(t=>{let n={...t};C===`h`?n.h=Math.max(0,Math.min(360,t.h+e)):C===`s`?n.s=Math.max(0,Math.min(100,t.s+e)):C===`l`&&(n.l=Math.max(0,Math.min(100,t.l+e)));let[r,i,a]=k(n.h,n.s,n.l);return b({r,g:i,b:a}),n}):b(t=>{let n={...t};C===`r`?n.r=Math.max(0,Math.min(255,t.r+e)):C===`g`?n.g=Math.max(0,Math.min(255,t.g+e)):C===`b`&&(n.b=Math.max(0,Math.min(255,t.b+e)));let r=O(n.r,n.g,n.b);return v(r),n}),E(!1)},O=(e,t,n)=>{let r=e/255,i=t/255,a=n/255,o=Math.max(r,i,a),s=Math.min(r,i,a),c=o-s,l=(o+s)/2,u=0;c!==0&&(u=l>.5?c/(2-o-s):c/(o+s));let d=0;return c!==0&&(d=o===r?((i-a)/c+(i<a?6:0))/6:o===i?((a-r)/c+2)/6:((r-i)/c+4)/6),{h:Math.round(d*360),s:Math.round(u*100),l:Math.round(l*100)}},k=(e,t,n)=>{e/=360,t/=100,n/=100;let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e*6%2-1)),a=n-r/2,o=0,s=0,c=0;return 0<=e&&e<1/6?(o=r,s=i,c=0):1/6<=e&&e<2/6?(o=i,s=r,c=0):2/6<=e&&e<3/6?(o=0,s=r,c=i):3/6<=e&&e<4/6?(o=0,s=i,c=r):4/6<=e&&e<5/6?(o=i,s=0,c=r):5/6<=e&&e<1&&(o=r,s=0,c=i),[Math.round((o+a)*255),Math.round((s+a)*255),Math.round((c+a)*255)]},A=()=>{let e=[],t=[[255,0,0],[255,127,0],[255,255,0],[127,255,0],[0,255,0],[0,255,127],[0,255,255],[0,127,255],[0,0,255],[127,0,255],[255,0,255],[255,0,127],[255,0,0]];for(let n=0;n<40;n++){let r=n/39,i=r*(t.length-1),a=Math.floor(i),o=Math.ceil(i),c=i-a,[l,u,d]=t[a],[p,m,h]=t[o],g=Math.round(l+(p-l)*c),_=Math.round(u+(m-u)*c),v=Math.round(d+(h-d)*c);e.push(f(s,{backgroundColor:`rgb(${g},${_},${v})`,children:` `},n))}return e},j=()=>{let e=[];for(let t=0;t<40;t++){let n=t/39*100,[r,i,a]=k(_.h,n,_.l);e.push(f(s,{backgroundColor:`rgb(${r},${i},${a})`,children:` `},t))}return e},M=()=>{let e=[];for(let t=0;t<40;t++){let n=t/39*100,[r,i,a]=k(_.h,_.s,n);e.push(f(s,{backgroundColor:`rgb(${r},${i},${a})`,children:` `},t))}return e},N=()=>{let[e,t,n]=k(_.h,_.s,_.l);return`rgb(${e},${t},${n})`},P=(e,t,n)=>{let r=e=>e.toString(16).padStart(2,`0`);return`#${r(e)}${r(t)}${r(n)}`},L=()=>{let e=[];for(let t=0;t<40;t++){let n=Math.round(t/39*255);e.push(f(s,{backgroundColor:`rgb(${n},${y.g},${y.b})`,children:` `},t))}return e},R=()=>{let e=[];for(let t=0;t<40;t++){let n=Math.round(t/39*255);e.push(f(s,{backgroundColor:`rgb(${y.r},${n},${y.b})`,children:` `},t))}return e},z=()=>{let e=[];for(let t=0;t<40;t++){let n=Math.round(t/39*255);e.push(f(s,{backgroundColor:`rgb(${y.r},${y.g},${n})`,children:` `},t))}return e},B=(e,t)=>Math.round(e/t*39);return p(o,{flexDirection:`column`,borderStyle:`single`,borderColor:`white`,padding:1,children:[p(o,{flexDirection:`column`,children:[f(s,{bold:!0,children:`Color Picker`}),p(o,{marginBottom:1,flexDirection:`column`,children:[f(s,{color:`gray`,dimColor:!0,children:`←→ to adjust (shift/ctrl/cmd +10)`}),f(s,{color:`gray`,dimColor:!0,children:`↑↓ to change bar`}),f(s,{color:`gray`,dimColor:!0,children:`ctrl+a to switch rgb/hsl`}),f(s,{color:`gray`,dimColor:!0,children:`enter to exit (auto-saved)`}),f(s,{color:`gray`,dimColor:!0,children:`esc to cancel changes`})]})]}),x===`hsl`?p(d,{children:[p(o,{marginBottom:1,children:[f(o,{width:25,children:p(s,{color:C===`h`?`yellow`:`white`,children:[C===`h`?`❯ `:` `,`Hue (`,_.h,`°):`]})}),f(o,{children:A().map((t,n)=>f(e,{children:n===B(_.h,360)?f(s,{children:`|`}):t},n))})]}),p(o,{marginBottom:1,children:[f(o,{width:25,children:p(s,{color:C===`s`?`yellow`:`white`,children:[C===`s`?`❯ `:` `,`Saturation (`,_.s,`%):`]})}),f(o,{children:j().map((t,n)=>f(e,{children:n===B(_.s,100)?f(s,{children:`|`}):t},n))})]}),p(o,{marginBottom:1,children:[f(o,{width:25,children:p(s,{color:C===`l`?`yellow`:`white`,children:[C===`l`?`❯ `:` `,`Lightness (`,_.l,`%):`]})}),f(o,{children:M().map((t,n)=>f(e,{children:n===B(_.l,100)?f(s,{children:`|`}):t},n))})]})]}):p(d,{children:[p(o,{marginBottom:1,children:[f(o,{width:25,children:p(s,{color:C===`r`?`yellow`:`white`,children:[C===`r`?`❯ `:` `,`Red (`,y.r,`):`]})}),f(o,{children:L().map((t,n)=>f(e,{children:n===B(y.r,255)?f(s,{children:`|`}):t},n))})]}),p(o,{marginBottom:1,children:[f(o,{width:25,children:p(s,{color:C===`g`?`yellow`:`white`,children:[C===`g`?`❯ `:` `,`Green (`,y.g,`):`]})}),f(o,{children:R().map((t,n)=>f(e,{children:n===B(y.g,255)?f(s,{children:`|`}):t},n))})]}),p(o,{marginBottom:1,children:[f(o,{width:25,children:p(s,{color:C===`b`?`yellow`:`white`,children:[C===`b`?`❯ `:` `,`Blue (`,y.b,`):`]})}),f(o,{children:z().map((t,n)=>f(e,{children:n===B(y.b,255)?f(s,{children:`|`}):t},n))})]})]}),p(o,{marginBottom:1,children:[f(s,{children:`Current: `}),f(s,{backgroundColor:N(),children:` `})]}),p(o,{flexDirection:`row`,justifyContent:`space-between`,children:[p(o,{flexDirection:`column`,children:[f(s,{dimColor:!0,children:`Hex `}),u?.startsWith(`diff`)?f(s,{backgroundColor:N(),color:m?.colors?.text||`white`,bold:!0,children:P(y.r,y.g,y.b)}):u===`inverseText`?f(s,{color:N(),backgroundColor:m?.colors?.permission,bold:!0,children:P(y.r,y.g,y.b)}):f(s,{color:N(),bold:!0,children:P(y.r,y.g,y.b)})]}),p(o,{flexDirection:`column`,children:[f(s,{dimColor:!0,children:`RGB `}),u?.startsWith(`diff`)?f(s,{backgroundColor:N(),color:m?.colors?.text||`white`,bold:!0,children:`rgb(${y.r}, ${y.g}, ${y.b})`}):u===`inverseText`?f(s,{color:N(),backgroundColor:m?.colors?.permission,bold:!0,children:`rgb(${y.r}, ${y.g}, ${y.b})`}):f(s,{color:N(),bold:!0,children:`rgb(${y.r}, ${y.g}, ${y.b})`})]}),p(o,{flexDirection:`column`,children:[f(s,{dimColor:!0,children:`HSL `}),u?.startsWith(`diff`)?f(s,{backgroundColor:N(),color:m?.colors?.text||`white`,bold:!0,children:`hsl(${_.h}, ${_.s}%, ${_.l}%)`}):u===`inverseText`?f(s,{color:N(),backgroundColor:m?.colors?.permission,bold:!0,children:`hsl(${_.h}, ${_.s}%, ${_.l}%)`}):f(s,{color:N(),bold:!0,children:`hsl(${_.h}, ${_.s}%, ${_.l}%)`})]})]})]})}function F(e){let t=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t)return{r:parseInt(t[1]),g:parseInt(t[2]),b:parseInt(t[3])};let n=e.match(/^#([a-fA-F0-9]{6})$/);if(n){let e=n[1];return{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16)}}return null}function I(e){let t=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(t)return{h:parseInt(t[1]),s:parseInt(t[2]),l:parseInt(t[3])};let n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n){let e=parseInt(n[1])/255,t=parseInt(n[2])/255,r=parseInt(n[3])/255,i=Math.max(e,t,r),a=Math.min(e,t,r),o=i-a,s=(i+a)/2,c=0;o!==0&&(c=s>.5?o/(2-i-a):o/(i+a));let l=0;return o!==0&&(l=i===e?((t-r)/o+(t<r?6:0))/6:i===t?((r-e)/o+2)/6:((e-t)/o+4)/6),{h:Math.round(l*360),s:Math.round(c*100),l:Math.round(s*100)}}let r=e.match(/^#([a-fA-F0-9]{6})$/);if(r){let e=r[1],t=parseInt(e.substr(0,2),16)/255,n=parseInt(e.substr(2,2),16)/255,i=parseInt(e.substr(4,2),16)/255,a=Math.max(t,n,i),o=Math.min(t,n,i),s=a-o,c=(a+o)/2,l=0;s!==0&&(l=c>.5?s/(2-a-o):s/(a+o));let u=0;return s!==0&&(u=a===t?((n-i)/s+(n<i?6:0))/6:a===n?((i-t)/s+2)/6:((t-n)/s+4)/6),{h:Math.round(u*360),s:Math.round(l*100),l:Math.round(c*100)}}return{h:0,s:50,l:50}}function L({onBack:e,themeId:t}){let{settings:{themes:i},updateSettings:c}=r($),[u,m]=a(t),h=i.find(e=>e.id===u)||i[0],[g,_]=a(`rgb`),[v,y]=a(0),[b,x]=a(null),[S,C]=a(null),[w,T]=a(``),[E,D]=a(``),O=n(e=>{c(t=>{let n=t.themes.findIndex(e=>e.id===u);n!==-1&&e(t.themes[n])})},[u,c]);l((t,n)=>{if(b===null&&S===null){if(n.escape)e();else if(n.ctrl&&t===`a`)_(e=>e===`rgb`?`hex`:e===`hex`?`hsl`:`rgb`);else if(n.upArrow)y(e=>Math.max(0,e-1));else if(n.downArrow)y(e=>Math.min(k.length+1,e+1));else if(n.return)if(v===0)C(`name`),T(h.name),D(h.name);else if(v===1)C(`id`),T(h.id),D(h.id);else{let e=v-2,t=k[e],n=h.colors[t];x(e),T(n),D(n)}}else if(b!==null)n.ctrl&&t===`a`&&_(e=>e===`rgb`?`hex`:e===`hex`?`hsl`:`rgb`);else if(S!==null)if(n.return){if(S===`id`){let e=u;m(w),c(t=>{let n=t.themes.findIndex(t=>t.id===e);n!==-1&&(t.themes[n].id=w)})}else O(e=>{e.name=w});C(null),T(``),D(``)}else n.escape?(C(null),T(``),D(``)):n.backspace||n.delete?T(e=>e.slice(0,-1)):t&&T(e=>e+t)});let k=Object.keys(h.colors),A=(e,t)=>{let n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!n)return e;let r=parseInt(n[1]),i=parseInt(n[2]),a=parseInt(n[3]);switch(t){case`hex`:{let e=e=>e.toString(16).padStart(2,`0`);return`#${e(r)}${e(i)}${e(a)}`}case`hsl`:{let e=r/255,t=i/255,n=a/255,o=Math.max(e,t,n),s=Math.min(e,t,n),c=o-s,l=(o+s)/2,u=0;c!==0&&(u=l>.5?c/(2-o-s):c/(o+s));let d=0;return c!==0&&(d=o===e?((t-n)/c+(t<n?6:0))/6:o===t?((n-e)/c+2)/6:((e-t)/c+4)/6),`hsl(${Math.round(d*360)}, ${Math.round(u*100)}%, ${Math.round(l*100)}%)`}case`rgb`:default:return e}},j=e=>{let t={claude:`Claude branding color. Used for the Claude logo, the welcome message, and the thinking text.`,text:`Code color. Used in diffs.`,inverseText:`Inverse text color. Used for the text of tabs, where the background is filled in.`,secondaryText:`Secondary/dimmed text. Used for keyboard shortcuts and other help text.`,secondaryBorder:`Secondary border color. Used for various boxes.`,suggestion:`Suggestion text color. Used for suggestions for theme names and various other things.`,remember:`Remember/note color. Used for various text relating to memories.`,success:`Success indicator. Used for the bullet on successful tool calls, and various success messages (such as sign in successful).`,error:`Error indicator`,warning:`Warning indicator`,autoAccept:`Auto-accept mode indicator`,bashBorder:`Bash command border`,permission:`Permission prompt color`,planMode:`Plan mode indicator`,diffAdded:`Added diff background`,diffRemoved:`Removed diff background`,diffAddedDimmed:`Added diff background (dimmed)`,diffRemovedDimmed:`Removed diff background (dimmed)`,diffAddedWord:`Added word highlight`,diffRemovedWord:`Removed word highlight`,diffAddedWordDimmed:`Added word highlight (dimmed)`,diffRemovedWordDimmed:`Removed word highlight (dimmed)`};return t[e]||``},F=Math.max(...k.map(e=>e.length));return p(o,{children:[p(o,{flexDirection:`column`,width:`50%`,children:[f(o,{children:p(s,{backgroundColor:`#ffd500`,color:`black`,bold:!0,children:[` `,`Editing theme “`,h.name,`” (`,h.id,`)`,` `]})}),b===null&&S===null?p(d,{children:[p(o,{marginBottom:1,flexDirection:`column`,children:[f(s,{dimColor:!0,children:`enter to edit theme name, id, or color`}),f(s,{dimColor:!0,children:`ctrl+a to toggle rgb, hex, hsl`}),f(s,{dimColor:!0,children:`esc to go back`})]}),v<2?p(o,{marginBottom:1,borderStyle:`single`,borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:`yellow`,flexDirection:`column`,paddingLeft:1,children:[f(s,{bold:!0,children:v===0?`Theme Name`:`Theme ID`}),f(s,{children:v===0?`The display name for this theme`:"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):p(o,{marginBottom:1,borderStyle:`single`,borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:h.colors[k[v-2]],flexDirection:`column`,paddingLeft:1,children:[f(N,{colorKey:k[v-2],theme:h,bold:!0}),f(s,{children:j(k[v-2])})]}),p(o,{flexDirection:`column`,children:[p(o,{children:[f(s,{color:v===0?`yellow`:`white`,children:v===0?`❯ `:` `}),f(s,{bold:!0,children:`Name: `}),f(s,{children:h.name})]}),p(o,{marginBottom:1,children:[f(s,{color:v===1?`yellow`:`white`,children:v===1?`❯ `:` `}),f(s,{bold:!0,children:`ID: `}),f(s,{children:h.id})]}),k.map((e,t)=>{let n=t+2;return p(o,{children:[f(s,{color:v===n?`yellow`:`white`,children:v===n?`❯ `:` `}),f(o,{width:F+2,children:f(s,{children:f(N,{colorKey:e,theme:h,bold:!0})})}),f(s,{color:h.colors[e],children:A(h.colors[e],g)})]},e)})]})]}):S?p(o,{flexDirection:`column`,marginTop:1,children:[p(s,{children:[`Editing `,S===`name`?`theme name`:`theme ID`,`:`]}),f(o,{borderStyle:`round`,borderColor:`yellow`,paddingX:1,children:f(s,{children:w})}),f(s,{dimColor:!0,children:`enter to save, esc to cancel`})]}):f(P,{initialValue:E,colorKey:k[b],theme:h,onColorChange:e=>{T(e),O(t=>{t.colors[k[b]]=e})},onExit:()=>{O(e=>{e.colors[k[b]]=w}),x(null),T(``),D(``)},onCancel:()=>{O(e=>{e.colors[k[b]]=E}),x(null),T(``),D(``)}})]}),f(o,{width:`50%`,children:f(M,{theme:h})})]})}function R(e){return e.map(e=>`${e.name} (${e.id})`)}function z({onBack:e}){let{settings:{themes:t},updateSettings:n}=r($),[i,c]=a(0),[u,d]=a(null),[m,h]=a(!0),g=()=>{let e=t[0]||w.themes[0],r={...e,name:`New Custom Theme`,id:`custom-${Date.now()}`};n(e=>{e.themes.push(r)}),d(r.id),h(!1)},_=e=>{t.length<=1||(n(t=>{t.themes=t.themes.filter(t=>t.id!==e)}),i>=t.length-1&&c(Math.max(0,t.length-2)))},v=()=>{n(e=>{e.themes=[...w.themes]}),c(0)};if(l((n,r)=>{if(r.escape)e();else if(r.upArrow)c(e=>Math.max(0,e-1));else if(r.downArrow)c(e=>Math.min(t.length-1,e+1));else if(r.return){let e=t[i];e&&(d(e.id),h(!1))}else if(n===`n`)g();else if(n===`d`){let e=t[i];e&&_(e.id)}else r.ctrl&&n===`r`&&v()},{isActive:m}),u)return f(L,{themeId:u,onBack:()=>{d(null),h(!0)}});let y=R(t),b=t.find(e=>y[i]?.includes(`(${e.id})`))||t[0];return t.length===0?f(o,{children:p(o,{flexDirection:`column`,width:`100%`,children:[p(s,{bold:!0,backgroundColor:`#ffd500`,color:`black`,children:[` `,`Themes`,` `]}),p(o,{marginBottom:1,flexDirection:`column`,children:[f(s,{dimColor:!0,children:`n to create a new theme`}),f(s,{dimColor:!0,children:`esc to go back`})]}),f(s,{children:`No themes available!`})]})}):p(o,{children:[p(o,{flexDirection:`column`,width:`50%`,children:[p(s,{bold:!0,backgroundColor:`#ffd500`,color:`black`,children:[` `,`Themes`,` `]}),p(o,{marginBottom:1,flexDirection:`column`,children:[f(s,{dimColor:!0,children:`n to create a new theme`}),f(s,{dimColor:!0,children:`d to delete a theme`}),f(s,{dimColor:!0,children:`ctrl+r to delete all themes and restore built-in`}),f(s,{dimColor:!0,children:`enter to edit theme`}),f(s,{dimColor:!0,children:`esc to go back`})]}),f(o,{flexDirection:`column`,children:y.map((e,t)=>p(s,{color:i===t?`yellow`:void 0,children:[i===t?`❯ `:` `,e]},t))})]}),f(o,{width:`50%`,children:f(M,{theme:b})})]})}function B(){try{let e=m.join(g.homedir(),`.claude.json`),t=JSON.parse(v.readFileSync(e,`utf8`));return t.theme||`dark`}catch{}return`dark`}function V(e){if(process.platform===`win32`)y.spawn(`explorer`,[`/select,`,e],{detached:!0,stdio:`ignore`}).unref();else if(process.platform===`darwin`)y.spawn(`open`,[`-R`,e],{detached:!0,stdio:`ignore`}).unref();else{let t=m.dirname(e);y.spawn(`xdg-open`,[t],{detached:!0,stdio:`ignore`}).unref()}}let H=[`ANSI Shadow`];function U({onBack:e}){let{stdout:t}=u(),n=t?.columns||120,{settings:{launchText:{method:c,figletText:m,figletFont:h,customText:g},themes:v},updateSettings:y}=r($),b=c===`figlet`?[`method`,`text`,`font`]:[`method`,`text`],[x,S]=a(0),C=b[x],[w,T]=a(c===`figlet`?0:1),[E,D]=a(H),[O,k]=a(H),[A,j]=a(``),[M,N]=a(!1),[P,F]=a(0),[I,L]=a(``),[R,z]=a(50),[V,U]=a(!1),[W,G]=a(c===`figlet`?m:g),K=B(),q=v.find(e=>e.id===K)||v.find(e=>e.id===`dark`),J=q?.colors.claude||`rgb(215,119,87)`;i(()=>{_.fonts((e,t)=>{if(!e&&t){let e=t.sort();D(e),k(e),H=e;let n=e.indexOf(h);F(n>=0?n:e.indexOf(`ANSI Shadow`)||0)}})},[]),i(()=>{Y()},[c,m,h,g,W,V]);let Y=()=>{if(c===`figlet`)try{let e=V?W:m,t=_.textSync(e.replace(`
|
|
3
|
+
`,` `),{font:h}),r=Math.floor(n*.7),i=t.split(`
|
|
4
|
+
`),a=i.map(e=>e.length>r?e.substring(0,r-3)+`…`:e),o=a.join(`
|
|
5
|
+
`);L(o);let s=Math.max(...a.map(e=>e.length)),c=Math.min(75,Math.max(50,Math.ceil(s/n*100)));z(c+5)}catch{L(`Error generating figlet text`),z(50)}else{let e=Math.floor(n*.6),t=V?W:g,r=t.split(`
|
|
6
|
+
`),i=r.map(t=>t.length>e?t.substring(0,e-3)+`...`:t),a=i.join(`
|
|
7
|
+
`);L(a);let o=Math.max(...i.map(e=>e.length)),s=Math.min(75,Math.max(50,Math.ceil(o/n*100)));z(s+5)}};return i(()=>{if(A){let e=E.filter(e=>e.toLowerCase().includes(A.toLowerCase()));k(e),F(0)}else{k(E);let e=E.indexOf(h);F(e>=0?e:0)}},[A,E]),i(()=>{if(!M){let e=O.indexOf(h);e>=0&&F(e)}},[h,O,M]),l((t,n)=>{if(V){n.return?(y(c===`figlet`?e=>{e.launchText.figletText=W}:e=>{e.launchText.customText=W}),U(!1)):n.escape?(G(c===`figlet`?m:g),U(!1)):n.backspace||n.delete?G(e=>e.slice(0,-1)):t&&G(e=>e+t);return}if(M){if(n.return)O.length>0&&y(e=>{e.launchText.figletFont=O[P]}),N(!1),j(``);else if(n.escape)N(!1),j(``);else if(n.backspace||n.delete)j(e=>e.slice(0,-1));else if(n.upArrow){let e=P>0?P-1:O.length-1;F(e),O.length>0&&y(t=>{t.launchText.figletFont=O[e]})}else if(n.downArrow){let e=P<O.length-1?P+1:0;F(e),O.length>0&&y(t=>{t.launchText.figletFont=O[e]})}else t&&t.match(/^[a-zA-Z0-9\s\-_]$/)&&j(e=>e+t);return}if(n.escape)e();else if(n.return)C===`text`&&(G(c===`figlet`?m:g),U(!0));else if(n.tab)n.shift?S(e=>e===0?b.length-1:e-1):S(e=>e===b.length-1?0:e+1);else if(n.upArrow){if(C===`method`){let e=w>0?w-1:1;T(e),y(t=>{t.launchText.method=e===0?`figlet`:`custom`})}else if(C===`font`&&c===`figlet`){let e=P>0?P-1:O.length-1;F(e),y(t=>{t.launchText.figletFont=O[e]})}}else if(n.downArrow){if(C===`method`){let e=w<1?w+1:0;T(e),y(t=>{t.launchText.method=e===0?`figlet`:`custom`})}else if(C===`font`&&c===`figlet`){let e=P<O.length-1?P+1:0;F(e),y(t=>{t.launchText.figletFont=O[e]})}}else t&&C===`font`&&c===`figlet`&&t.match(/^[a-zA-Z0-9]$/)&&(N(!0),j(t))}),p(o,{children:[p(o,{flexDirection:`column`,width:`${100-R}%`,children:[p(o,{marginBottom:1,flexDirection:`column`,children:[p(s,{bold:!0,backgroundColor:`#ffd500`,color:`black`,children:[` `,`Setup banner`,` `]}),f(o,{children:p(s,{dimColor:!0,children:[`enter to `,C===`text`?`edit text`:`save`]})}),f(o,{children:f(s,{dimColor:!0,children:`esc to go back`})})]}),f(o,{children:p(s,{children:[f(s,{color:C===`method`?`yellow`:void 0,children:C===`method`?`❯ `:` `}),f(s,{bold:!0,color:C===`method`?`yellow`:void 0,children:`Method`})]})}),C===`method`&&p(s,{dimColor:!0,children:[` `,`select one of `,O.length,` Figlet fonts or enter your own text`]}),f(o,{marginLeft:2,marginBottom:1,children:p(o,{flexDirection:`column`,children:[p(s,{color:w===0?`cyan`:`white`,children:[w===0?`❯ `:` `,`Figlet`]}),p(s,{color:w===1?`cyan`:`white`,children:[w===1?`❯ `:` `,`Custom`]})]})}),p(o,{flexDirection:`column`,children:[p(s,{children:[f(s,{color:C===`text`?`yellow`:void 0,children:C===`text`?`❯ `:` `}),f(s,{bold:!0,color:C===`text`?`yellow`:void 0,children:`Text`})]}),C===`text`&&(V?p(s,{dimColor:!0,children:[` `,`esc to save`]}):p(s,{dimColor:!0,children:[` `,`enter to edit`]}))]}),f(o,{marginLeft:2,marginBottom:1,children:f(o,{borderStyle:`round`,borderColor:V?`yellow`:`gray`,children:f(s,{children:V?W:c===`figlet`?m:g})})}),c===`figlet`&&p(d,{children:[f(o,{children:p(o,{flexDirection:`column`,children:[p(s,{children:[f(s,{color:C===`font`?`yellow`:void 0,children:C===`font`?`❯ `:` `}),f(s,{bold:!0,color:C===`font`?`yellow`:void 0,children:`Font`})]}),C===`font`&&p(s,{dimColor:!0,children:[` `,`type to filter`]}),f(s,{children:M&&p(s,{color:`gray`,dimColor:!0,children:[` `,`(filtering: “`,A,`”)`]})})]})}),f(o,{marginLeft:2,marginBottom:1,children:f(o,{flexDirection:`column`,children:(()=>{let e=8,t=Math.max(0,P-Math.floor(e/2)),n=Math.min(O.length,t+e),r=Math.max(0,n-e),i=O.slice(r,n);return p(d,{children:[r>0&&p(s,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,t)=>{let n=r+t;return p(s,{color:P===n?`cyan`:void 0,children:[P===n?`❯ `:` `,e]},e)}),n<O.length&&p(s,{color:`gray`,dimColor:!0,children:[` `,`↓ `,O.length-n,` more below`]})]})})()})})]})]}),p(o,{width:`${R}%`,flexDirection:`column`,children:[f(o,{marginBottom:1,children:f(s,{bold:!0,children:`Preview`})}),p(o,{borderStyle:`single`,borderColor:`gray`,padding:1,flexDirection:`column`,children:[p(o,{flexDirection:`column`,marginBottom:1,children:[f(s,{color:J,children:`╭──────────────────────────╮`}),p(s,{children:[f(s,{color:J,children:`│ ✻`}),` Welcome to Claude Code`,` `,f(s,{color:J,children:`│`})]}),f(s,{color:J,children:`╰──────────────────────────╯`})]}),I.split(`
|
|
8
|
+
`).map((e,t)=>f(s,{color:J,children:e},t)),f(o,{marginTop:1,children:f(s,{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 W({onBack:e}){let{settings:{thinkingVerbs:{useHaikuGenerated:t,punctuation:n,verbs:i},themes:c},updateSettings:u}=r($),m=t?[`useHaikuGenerated`]:[`useHaikuGenerated`,`punctuation`,`verbs`],[h,g]=a(0),_=m[h],[v,y]=a(0),[b,x]=a(!1),[S,C]=a(``),[T,E]=a(!1),[D,O]=a(!1),[k,A]=a(n),j=B(),M=c.find(e=>e.id===j)||c.find(e=>e.id===`dark`),N=M?.colors.claude||`rgb(215,119,87)`;l((r,a)=>{if(D){a.return?(u(e=>{e.thinkingVerbs.punctuation=k}),O(!1)):a.escape?(A(n),O(!1)):a.backspace||a.delete?A(e=>e.slice(0,-1)):r&&A(e=>e+r);return}if(b||T){a.return&&S.trim()?(T?(u(e=>{e.thinkingVerbs.verbs.push(S.trim())}),E(!1)):(u(e=>{e.thinkingVerbs.verbs[v]=S.trim()}),x(!1)),C(``)):a.escape?(C(``),x(!1),E(!1)):a.backspace||a.delete?C(e=>e.slice(0,-1)):r&&C(e=>e+r);return}a.escape?e():a.return?_===`punctuation`&&(A(n),O(!0)):a.tab?a.shift?g(e=>e===0?m.length-1:e-1):g(e=>e===m.length-1?0:e+1):a.upArrow?_===`verbs`&&!t&&i.length>0&&y(e=>e>0?e-1:i.length-1):a.downArrow?_===`verbs`&&!t&&i.length>0&&y(e=>e<i.length-1?e+1:0):r===` `?_===`useHaikuGenerated`&&(u(e=>{e.thinkingVerbs.useHaikuGenerated=!e.thinkingVerbs.useHaikuGenerated}),g(0)):r===`e`&&_===`verbs`&&!t?i.length>0&&(C(i[v]),x(!0)):r===`d`&&_===`verbs`&&!t?i.length>1&&(u(e=>{e.thinkingVerbs.verbs=e.thinkingVerbs.verbs.filter((e,t)=>t!==v)}),v>=i.length-1&&y(Math.max(0,i.length-2))):r===`n`&&_===`verbs`&&!t?(E(!0),C(``)):a.ctrl&&r===`r`&&_===`verbs`&&!t&&(u(e=>{e.thinkingVerbs.verbs=[...w.thinkingVerbs.verbs]}),y(0))});let P=t?`x`:` `,F=t?0:50;return p(o,{children:[p(o,{flexDirection:`column`,width:t?`100%`:`${100-F}%`,children:[p(o,{marginBottom:1,flexDirection:`column`,children:[p(s,{bold:!0,backgroundColor:`#ffd500`,color:`black`,children:[` `,`Thinking verbs`,` `]}),f(o,{children:f(s,{dimColor:!0,children:_===`punctuation`?`enter to edit punctuation`:`changes auto-saved`})}),f(o,{children:f(s,{dimColor:!0,children:`esc to go back`})})]}),f(o,{children:p(s,{children:[f(s,{color:_===`useHaikuGenerated`?`yellow`:void 0,children:_===`useHaikuGenerated`?`❯ `:` `}),f(s,{bold:!0,color:_===`useHaikuGenerated`?`yellow`:void 0,children:`Use Haiku-generated verbs`})]})}),_===`useHaikuGenerated`&&p(s,{dimColor:!0,children:[` `,`space to toggle`]}),f(o,{marginLeft:2,marginBottom:1,children:p(s,{children:[`[`,P,`] `,t?`Enabled`:`Disabled`]})}),t?f(o,{marginLeft:2,marginBottom:1,children:f(s,{dimColor:!0,children:`Claude Code will automatically generate verbs using Claude Haiku 3.5 based on your session.`})}):p(d,{children:[f(o,{marginLeft:2,marginBottom:1,children:f(s,{dimColor:!0,children:`A hard-coded selection of verbs will be used, defined below.`})}),p(o,{flexDirection:`column`,children:[p(s,{children:[f(s,{color:_===`punctuation`?`yellow`:void 0,children:_===`punctuation`?`❯ `:` `}),f(s,{bold:!0,color:_===`punctuation`?`yellow`:void 0,children:`Punctuation`})]}),_===`punctuation`&&(D?p(s,{dimColor:!0,children:[` `,`enter to save`]}):p(s,{dimColor:!0,children:[` `,`enter to edit`]}))]}),f(o,{marginLeft:2,marginBottom:1,children:f(o,{borderStyle:`round`,borderColor:D?`yellow`:`gray`,children:f(s,{children:D?k:n})})}),f(o,{children:p(s,{children:[f(s,{color:_===`verbs`?`yellow`:void 0,children:_===`verbs`?`❯ `:` `}),f(s,{bold:!0,color:_===`verbs`?`yellow`:void 0,children:`Verbs`})]})}),_===`verbs`&&f(o,{flexDirection:`column`,children:p(s,{dimColor:!0,children:[` `,`e to edit · d to delete · n to add new · ctrl+r to reset`]})}),f(o,{marginLeft:2,marginBottom:1,children:p(o,{flexDirection:`column`,children:[(()=>{let e=8,t=Math.max(0,v-Math.floor(e/2)),n=Math.min(i.length,t+e),r=Math.max(0,n-e),a=i.slice(r,n);return p(d,{children:[r>0&&p(s,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),a.map((e,t)=>{let n=r+t;return p(s,{color:_===`verbs`&&n===v?`cyan`:void 0,children:[_===`verbs`&&n===v?`❯ `:` `,e]},n)}),n<i.length&&p(s,{color:`gray`,dimColor:!0,children:[` `,`↓ `,i.length-n,` more below`]})]})})(),T&&p(o,{alignItems:`center`,children:[f(s,{color:`yellow`,children:`❯ `}),f(o,{borderStyle:`round`,borderColor:`yellow`,children:f(s,{children:S})})]}),b&&p(o,{marginTop:1,alignItems:`center`,children:[f(s,{children:`Editing: `}),f(o,{borderStyle:`round`,borderColor:`yellow`,children:f(s,{children:S})})]})]})})]})]}),!t&&p(o,{width:`${F}%`,flexDirection:`column`,children:[f(o,{marginBottom:1,children:f(s,{bold:!0,children:`Preview`})}),f(o,{borderStyle:`single`,borderColor:`gray`,padding:1,flexDirection:`column`,children:p(s,{children:[p(s,{color:N,children:[`✻ `,i[v],n,` `]}),f(s,{color:M?.colors.secondaryText,children:`(10s · ↑ 456 tokens · esc to interrupt)`})]})})]})]})}const G=[{name:`Default`,phases:w.thinkingStyle.phases,reverseMirror:w.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 K({onBack:e}){let{settings:{thinkingStyle:{phases:t,updateInterval:n,reverseMirror:c},themes:u},updateSettings:m}=r($),h=[`reverseMirror`,`updateInterval`,`phases`,`presets`],[g,_]=a(0),v=h[g],[y,b]=a(0),[x,S]=a(0),[C,T]=a(!1),[E,D]=a(``),[O,k]=a(!1),[A,j]=a(!1),[M,N]=a(n.toString()),[P,F]=a(0),I=B(),L=u.find(e=>e.id===I)||u.find(e=>e.id===`dark`),R=L?.colors.claude||`rgb(215,119,87)`;i(()=>{if(t.length>0){let e=c?[...t,...[...t].reverse().slice(1,-1)]:t,r=setInterval(()=>{F(t=>(t+1)%e.length)},n);return()=>clearInterval(r)}},[t,n,c]),l((r,i)=>{if(A){if(i.return){let e=parseInt(M);!isNaN(e)&&e>0&&m(t=>{t.thinkingStyle.updateInterval=e}),j(!1)}else i.escape?(N(n.toString()),j(!1)):i.backspace||i.delete?N(e=>e.slice(0,-1)):r&&r.match(/^[0-9]$/)&&N(e=>e+r);return}if(C||O){if(i.return&&E.trim()){let e=O?[...t,E.trim()]:t.map((e,t)=>t===y?E.trim():e);m(t=>{t.thinkingStyle.phases=e}),T(!1),D(``)}else i.escape?(D(``),T(!1),k(!1)):i.backspace||i.delete?D(e=>e.slice(0,-1)):r&&D(e=>e+r);return}if(i.escape)e();else if(i.return)if(v===`updateInterval`)N(n.toString()),j(!0);else if(v===`presets`){let e=G[x];m(t=>{t.thinkingStyle.phases=[...e.phases],t.thinkingStyle.reverseMirror=e.reverseMirror})}else v===`reverseMirror`&&m(e=>{e.thinkingStyle.reverseMirror=!e.thinkingStyle.reverseMirror});else if(i.tab)i.shift?_(e=>e===0?h.length-1:e-1):_(e=>e===h.length-1?0:e+1);else if(i.upArrow)v===`phases`&&t.length>0?b(e=>e>0?e-1:t.length-1):v===`presets`&&S(e=>e>0?e-1:G.length-1);else if(i.downArrow)v===`phases`&&t.length>0?b(e=>e<t.length-1?e+1:0):v===`presets`&&S(e=>e<G.length-1?e+1:0);else if(r===` `)v===`reverseMirror`&&m(e=>{e.thinkingStyle.reverseMirror=!e.thinkingStyle.reverseMirror});else if(r===`e`&&v===`phases`)t.length>0&&(D(t[y]),T(!0));else if(r===`a`&&v===`phases`)k(!0),D(``);else if(r===`d`&&v===`phases`)t.length>1&&(m(e=>{e.thinkingStyle.phases=t.filter((e,t)=>t!==y)}),y>=t.length&&b(Math.max(0,t.length-1)));else if(r===`w`&&v===`phases`){if(y>0){let e=[...t];[e[y-1],e[y]]=[e[y],e[y-1]],m(t=>{t.thinkingStyle.phases=e}),b(e=>e-1)}}else if(r===`s`&&v===`phases`){if(y<t.length-1){let e=[...t];[e[y],e[y+1]]=[e[y+1],e[y]],m(t=>{t.thinkingStyle.phases=e}),b(e=>e+1)}}else i.ctrl&&r===`r`&&(m(e=>{e.thinkingStyle=w.thinkingStyle}),b(0),S(0))});let z=c?`x`:` `,V=50,H=()=>c?[...t,...[...t].reverse().slice(1,-1)]:t,U=H(),W=U.length>0?U[P]:`·`;return p(o,{children:[p(o,{flexDirection:`column`,width:`${100-V}%`,children:[p(o,{marginBottom:1,flexDirection:`column`,children:[p(s,{bold:!0,backgroundColor:`#ffd500`,color:`black`,children:[` `,`Thinking style`,` `]}),f(o,{children:p(s,{dimColor:!0,children:[`enter to`,` `,v===`updateInterval`?`edit interval`:v===`presets`?`apply preset`:`save`]})}),f(o,{children:f(s,{dimColor:!0,children:`esc to go back`})})]}),f(o,{children:p(s,{children:[f(s,{color:v===`reverseMirror`?`yellow`:void 0,children:v===`reverseMirror`?`❯ `:` `}),f(s,{bold:!0,color:v===`reverseMirror`?`yellow`:void 0,children:`Reverse-mirror phases`})]})}),v===`reverseMirror`&&p(s,{dimColor:!0,children:[` `,`space to toggle`]}),f(o,{marginLeft:2,marginBottom:1,children:p(s,{children:[`[`,z,`] `,c?`Enabled`:`Disabled`]})}),p(o,{flexDirection:`column`,children:[p(s,{children:[f(s,{color:v===`updateInterval`?`yellow`:void 0,children:v===`updateInterval`?`❯ `:` `}),f(s,{bold:!0,color:v===`updateInterval`?`yellow`:void 0,children:`Update interval (ms)`})]}),v===`updateInterval`&&(A?p(s,{dimColor:!0,children:[` `,`enter to save`]}):p(s,{dimColor:!0,children:[` `,`enter to edit`]}))]}),f(o,{marginLeft:2,marginBottom:1,children:f(o,{borderStyle:`round`,borderColor:A?`yellow`:`gray`,children:f(s,{children:A?M:n})})}),f(o,{children:p(s,{children:[f(s,{color:v===`phases`?`yellow`:void 0,children:v===`phases`?`❯ `:` `}),f(s,{bold:!0,color:v===`phases`?`yellow`:void 0,children:`Phases`})]})}),v===`phases`&&f(o,{marginBottom:1,flexDirection:`column`,children:p(s,{dimColor:!0,children:[` `,`e to edit · a to add · d to delete · w to move up · s to move down`]})}),f(o,{marginLeft:2,marginBottom:1,children:p(o,{flexDirection:`column`,children:[(()=>{let e=8,n=Math.max(0,y-Math.floor(e/2)),r=Math.min(t.length,n+e),i=Math.max(0,r-e),a=t.slice(i,r);return p(d,{children:[i>0&&p(s,{color:`gray`,dimColor:!0,children:[` `,`↑ `,i,` more above`]}),a.map((e,t)=>{let n=i+t;return p(s,{color:v===`phases`&&n===y?`cyan`:void 0,children:[v===`phases`&&n===y?`❯ `:` `,e]},n)}),r<t.length&&p(s,{color:`gray`,dimColor:!0,children:[` `,`↓ `,t.length-r,` more below`]})]})})(),O&&p(o,{children:[f(s,{color:`yellow`,children:`❯ `}),f(o,{borderStyle:`round`,borderColor:`yellow`,children:f(s,{children:E})})]}),C&&p(o,{marginTop:1,children:[f(s,{children:`Editing: `}),f(o,{borderStyle:`round`,borderColor:`yellow`,children:f(s,{children:E})})]})]})}),f(o,{children:p(s,{children:[f(s,{color:v===`presets`?`yellow`:void 0,children:v===`presets`?`❯ `:` `}),f(s,{bold:!0,color:v===`presets`?`yellow`:void 0,children:`Presets`})]})}),v===`presets`&&p(s,{dimColor:!0,children:[` `,`Selecting one will overwrite your choice of phases`]}),f(o,{marginLeft:2,marginBottom:1,children:f(o,{flexDirection:`column`,children:(()=>{let e=8,t=Math.max(0,x-Math.floor(e/2)),n=Math.min(G.length,t+e),r=Math.max(0,n-e),i=G.slice(r,n);return p(d,{children:[r>0&&p(s,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,t)=>{let n=r+t;return p(s,{color:v===`presets`&&n===x?`cyan`:void 0,children:[v===`presets`&&n===x?`❯ `:` `,e.name,` `,e.phases.join(``)]},n)}),n<G.length&&p(s,{color:`gray`,dimColor:!0,children:[` `,`↓ `,G.length-n,` more below`]})]})})()})}),f(o,{marginTop:1,children:f(s,{dimColor:!0,children:`ctrl+r to reset all settings to default`})})]}),p(o,{width:`${V}%`,flexDirection:`column`,children:[f(o,{marginBottom:1,children:f(s,{bold:!0,children:`Preview`})}),p(o,{borderStyle:`single`,borderColor:`gray`,padding:1,flexDirection:`column`,children:[p(s,{children:[p(s,{color:R,children:[W,` Thinking… `]}),f(s,{color:L?.colors.secondaryText,children:`(10s · ↑ 456 tokens · esc to interrupt)`})]}),p(o,{marginTop:1,flexDirection:`column`,children:[p(s,{dimColor:!0,children:[`Phases: `,t.join(``)]}),p(s,{dimColor:!0,children:[`Reverse-mirror: `,c?`Yes`:`No`]}),p(s,{dimColor:!0,children:[`Update interval: `,n,`ms`]})]})]})]})]})}const q=async()=>{await x.mkdir(T,{recursive:!0})},J=async()=>{let e={ccVersion:``,ccInstallationDir:null,lastModified:new Date().toISOString(),changesApplied:!0,settings:w};try{let t=await x.readFile(E,`utf8`);return{...e,...JSON.parse(t)}}catch(t){if(t instanceof Error&&`code`in t&&t.code===`ENOENT`)return e;throw t}},Y=async e=>{let t=await J();return e(t),t.lastModified=new Date().toISOString(),await ee(t),t},ee=async e=>{try{e.lastModified=new Date().toISOString(),await q(),await x.writeFile(E,JSON.stringify(e,null,2))}catch(e){throw console.error(`Error saving config:`,e),e}},X=async e=>(await x.copyFile(D,e.cliPath),await Y(e=>{e.changesApplied=!1}),!0),Z=async e=>{if(e.ccInstallationDir)return{cliPath:h.join(e.ccInstallationDir,`cli.js`),packageJsonPath:h.join(e.ccInstallationDir,`package.json`),version:e.ccVersion};for(let e of O)try{let t=h.join(e,`cli.js`),n=h.join(e,`package.json`),r=JSON.parse(await x.readFile(n,`utf8`));return{cliPath:t,packageJsonPath:n,version:r.version}}catch{continue}console.error(`Cannot find Claude Code's cli.js -- do you have Claude Code installed?
|
|
9
|
+
|
|
10
|
+
Searched at the following locations:
|
|
11
|
+
${O.map(e=>`- `+e).join(`
|
|
12
|
+
`)}
|
|
13
|
+
|
|
14
|
+
If you have it installed but it's in a location not listed above, please open an issue at
|
|
15
|
+
https://github.com/piebald-ai/tweakcc/issues and tell us where you have it--we'll add that
|
|
16
|
+
location to our search list and release an update today! Or you can specify the path to its
|
|
17
|
+
\`cli.js\` file in ${E}:
|
|
18
|
+
{
|
|
19
|
+
"ccInstallationDir": "${process.platform==`win32`?`C:\\absolute\\path\\to\\@anthropic-ai\\claude-code`:`/absolute/path/to/@anthropic-ai/claude-code`}"
|
|
20
|
+
}
|
|
21
|
+
(Note: don't include cli.js in the path.)
|
|
22
|
+
`),process.exit(1)},te=async e=>{await q(),await x.copyFile(e.cliPath,D),await Y(t=>{t.changesApplied=!1,t.ccVersion=e.version})};async function ne(e){try{return await x.stat(e),!0}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return!1;throw e}}async function re(){let e=await J(),t=await Z(e),n=t.version,r=e.ccVersion;return await ne(D)||await te(t),n===r?{wasUpdated:!1,oldVersion:null,newVersion:null}:(await x.unlink(D),await te(t),{wasUpdated:!0,oldVersion:r,newVersion:n})}function ie(e){let t=` ██████╗██╗ █████╗ ██╗ ██╗██████╗ ███████╗
|
|
23
|
+
██╔════╝██║ ██╔══██╗██║ ██║██╔══██╗██╔════╝
|
|
24
|
+
██║ ██║ ███████║██║ ██║██║ ██║█████╗
|
|
25
|
+
██║ ██║ ██╔══██║██║ ██║██║ ██║██╔══╝
|
|
26
|
+
╚██████╗███████╗██║ ██║╚██████╔╝██████╔╝███████╗
|
|
27
|
+
╚═════╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝
|
|
28
|
+
██████╗ ██████╗ ██████╗ ███████╗
|
|
29
|
+
██╔════╝██╔═══██╗██╔══██╗██╔════╝
|
|
30
|
+
██║ ██║ ██║██║ ██║█████╗
|
|
31
|
+
██║ ██║ ██║██║ ██║██╔══╝
|
|
32
|
+
╚██████╗╚██████╔╝██████╔╝███████╗
|
|
33
|
+
╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝`,n=e.indexOf(t);return n===-1?null:{startIndex:n-1,endIndex:n+t.length+1}}function ae(e,t){let n=ie(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 oe(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 se=(e,t)=>{let n=oe(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},ce=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},le=(e,t)=>{let n=ce(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},ue=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}},de=(e,t)=>{let n=ue(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},fe=e=>{let t=/process\.env\.DISABLE_NON_ESSENTIAL_MODEL_CALLS/,n=e.match(t);return!n||n.index==null?(console.error(`patch: use haiku verbs: failed to find match`),null):{startIndex:n.index,endIndex:n.index+n[0].length}},pe=(e,t)=>{let n=fe(e);if(!n)return null;let r=t?`"0"`:`"1"`,i=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return Q(e,i,r,n.startIndex,n.endIndex),i},me=e=>{let t=/=\[\s*(?:"[A-Z][a-z]+ing",?\s*)+\]/s,n=e.match(t);return!n||n.index==null?(console.error(`patch: thinker verbs: failed to find okayMatch`),null):{okayVerbs:{startIndex:n.index,endIndex:n.index+n[0].length}}},he=(e,t)=>{let n=me(e);if(!n)return null;let r=`=`+JSON.stringify(t),i=e.slice(0,n.okayVerbs.startIndex)+r+e.slice(n.okayVerbs.endIndex);return Q(e,i,r,n.okayVerbs.startIndex,n.okayVerbs.endIndex),i},ge=e=>{let t=/[\w$]+\.createElement\([\w$]+,\{color:[\w$]+\},[\w$]+,"… "\)/,n=e.match(t);if(!n||n.index==null)return console.error(`patch: thinker punctuation: failed to find match`),null;let r=n.index+n[0].indexOf(`"… "`),i=r+4;return{startIndex:r,endIndex:i}},_e=(e,t)=>{let n=ge(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},ve=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]}},ye=(e,t)=>{let n=ve(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};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);e.slice(a,r),e.slice(r,i),e.slice(i,o),t.slice(a,r),t.slice(r,r+n.length),t.slice(r+n.length,s)}const be=async(e,t)=>{await X(t);let n=await b.readFile(t.cliPath,{encoding:`utf8`}),r=null;if(e.settings.themes&&e.settings.themes.length>0&&(r=se(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=>_.text(t.figletText.replace(`
|
|
34
|
+
`,` `),t.figletFont,(t,n)=>{t?(console.error(`patch: figlet: failed to generate text`,t),e(``)):e(n||``)}))),(r=ae(n,i))&&(n=r)}return e.settings.thinkingVerbs&&((r=pe(n,e.settings.thinkingVerbs.useHaikuGenerated))&&(n=r),(r=he(n,e.settings.thinkingVerbs.verbs))&&(n=r),(r=_e(n,e.settings.thinkingVerbs.punctuation))&&(n=r)),(r=le(n,e.settings.thinkingStyle.phases))&&(n=r),(r=de(n,e.settings.thinkingStyle.updateInterval))&&(n=r),(r=ye(n,e.settings.thinkingStyle.reverseMirror))&&(n=r),await b.writeFile(t.cliPath,n),await Y(e=>{e.changesApplied=!0})},$=t({settings:w,updateSettings:e=>{},changesApplied:!1});function xe(){let[e,t]=a({settings:w,changesApplied:!1,ccVersion:``,lastModified:``,ccInstallationDir:null});i(()=>{let e=async()=>{t(await J())};e()},[]);let[r,s]=a(null);i(()=>{let t=async()=>{s(await Z(e))};t()},[e]);let c=n(n=>{n(e.settings),Y(t=>{t.settings=e.settings,t.changesApplied=!1}).then(e=>{t(e)})},[e]),[u,d]=a(null),[p,m]=a(null);i(()=>{let e=async()=>{let e=await re();e.wasUpdated&&(m({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
|
|
35
|
+
(However, your customization are still remembered in ${E}.)
|
|
36
|
+
Please reapply your changes below.`,type:`warning`}),c(()=>{}))};e()},[]),l((e,t)=>{(t.ctrl&&e===`c`||(e===`q`||t.escape)&&!u)&&process.exit(0)});let h=n=>{switch(m(null),n){case C.THEMES:case C.LAUNCH_TEXT:case C.THINKING_VERBS:case C.THINKING_STYLE:d(n);break;case C.APPLY_CHANGES:r&&(m({message:`Applying patches...`,type:`info`}),be(e,r).then(e=>{t(e),m({message:`Customization patches applied successfully!`,type:`success`})}));break;case C.RESTORE_ORIGINAL:r&&X(r).then(()=>{m({message:`Original Claude Code restored successfully!`,type:`success`}),c(()=>{})});break;case C.OPEN_CONFIG:V(E);break;case C.OPEN_CLI:r&&V(r.cliPath);break;case C.EXIT:process.exit(0)}},g=()=>{d(null)};return f($.Provider,{value:{settings:e.settings,updateSettings:c,changesApplied:e.changesApplied},children:f(o,{flexDirection:`column`,children:u===null?f(j,{onSubmit:h,notification:p}):u===C.THEMES?f(z,{onBack:g}):u===C.LAUNCH_TEXT?f(U,{onBack:g}):u===C.THINKING_VERBS?f(W,{onBack:g}):u===C.THINKING_STYLE?f(K,{onBack:g}):null})})}c(f(xe,{}));
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tweakcc",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Command-line tool to customize your Claude Code installation",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"tweakcc": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"cli",
|
|
12
|
+
"terminal",
|
|
13
|
+
"ink",
|
|
14
|
+
"react",
|
|
15
|
+
"typescript",
|
|
16
|
+
"claude",
|
|
17
|
+
"claude-code",
|
|
18
|
+
"customize",
|
|
19
|
+
"installation",
|
|
20
|
+
"theme",
|
|
21
|
+
"claude-code-theme",
|
|
22
|
+
"figlet"
|
|
23
|
+
],
|
|
24
|
+
"author": {
|
|
25
|
+
"name": "Piebald LLC",
|
|
26
|
+
"email": "support@piebald.ai",
|
|
27
|
+
"url": "https://piebald.ai"
|
|
28
|
+
},
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/Piebald-AI/tweakcc.git"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@eslint/js": "^9.31.0",
|
|
36
|
+
"@types/node": "^20.0.0",
|
|
37
|
+
"@types/react": "^18.0.0",
|
|
38
|
+
"@vitejs/plugin-react-oxc": "^0.3.0",
|
|
39
|
+
"eslint": "^9.31.0",
|
|
40
|
+
"eslint-plugin-react": "^7.37.5",
|
|
41
|
+
"globals": "^16.3.0",
|
|
42
|
+
"prettier": "^3.6.2",
|
|
43
|
+
"rollup-plugin-node-externals": "^8.0.1",
|
|
44
|
+
"tsx": "^4.0.0",
|
|
45
|
+
"typescript": "^5.0.0",
|
|
46
|
+
"typescript-eslint": "^8.38.0",
|
|
47
|
+
"vite": "npm:rolldown-vite@latest"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@types/figlet": "^1.7.0",
|
|
51
|
+
"chalk": "^5.4.1",
|
|
52
|
+
"figlet": "^1.8.2",
|
|
53
|
+
"ink": "^4.4.1",
|
|
54
|
+
"react": "^18.2.0"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "tsc -b && vite build",
|
|
58
|
+
"watch": "vite build --watch --mode development",
|
|
59
|
+
"start": "node dist/index.js",
|
|
60
|
+
"lint": "tsc --noEmit && eslint src",
|
|
61
|
+
"format": "prettier --write src"
|
|
62
|
+
}
|
|
63
|
+
}
|