tweakcc 3.1.2 → 3.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/dist/index.js +92 -88
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{Box as m,Text as c,render as ct,useInput as de}from"ink";import{Command as dt}from"commander";import Q from"chalk";import*as te from"node:fs/promises";import ie from"node:fs/promises";import Ke,{Fragment as Ee,createContext as ut,useCallback as Nn,useContext as be,useEffect as xe,useState as O}from"react";import ht from"ink-link";import{Fragment as me,jsx as s,jsxs as g}from"react/jsx-runtime";import*as re from"node:path";import Bn from"node:path";import*as ye from"node:os";import{EOL as bn}from"node:os";import*as Ce from"node:fs";import Pe from"node:fs";import{globbySync as gt}from"globby";import ft from"node:process";import*as Me from"node:child_process";import{execSync as On}from"node:child_process";import*as An from"node:crypto";import Ge from"gray-matter";import Re from"node-lief";function mt({items:e,selectedIndex:t,onSelect:n,onSubmit:r}){return de((o,i)=>{i.upArrow?n(t>0?t-1:e.length-1):i.downArrow?n(t<e.length-1?t+1:0):i.return&&r(e[t].name)}),s(m,{flexDirection:"column",children:e.map((o,i)=>s(m,{children:g(c,{children:[g(c,{bold:i===t,color:i===t?"cyan":void 0,...i===t?o.selectedStyles??{}:o.styles??{},children:[i===t?"❯ ":" ",o.name]}),o.desc&&i===t&&g(c,{dimColor:!0,bold:!1,children:[" \x1B[0;2m","- ",o.desc]})]})},i))})}let J=function(e){return e.APPLY_CHANGES="*Apply customizations",e.THEMES="Themes",e.THINKING_VERBS="Thinking verbs",e.THINKING_STYLE="Thinking style",e.USER_MESSAGE_DISPLAY="User message display",e.MISC="Misc",e.TOOLSETS="Toolsets",e.VIEW_SYSTEM_PROMPTS="View system prompts",e.RESTORE_ORIGINAL="Restore original Claude Code (preserves config.json)",e.OPEN_CONFIG="Open config.json",e.OPEN_CLI="Open Claude Code's cli.js",e.EXIT="Exit",e}({});const Z={themes:[{name:"Dark mode",id:"dark",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(253,93,177)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(235,159,127)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(147,165,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(177,195,255)",permission:"rgb(177,185,249)",permissionShimmer:"rgb(207,215,255)",planMode:"rgb(72,150,140)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(177,185,249)",remember:"rgb(177,185,249)",background:"rgb(0,204,204)",success:"rgb(78,186,101)",error:"rgb(255,107,128)",warning:"rgb(255,193,7)",warningShimmer:"rgb(255,223,57)",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)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(177,185,249)",rate_limit_empty:"rgb(80,83,112)"}},{name:"Light mode",id:"light",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(255,0,135)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(245,149,117)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(87,105,247)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(117,135,255)",permission:"rgb(87,105,247)",permissionShimmer:"rgb(137,155,255)",planMode:"rgb(0,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(87,105,247)",remember:"rgb(0,0,255)",background:"rgb(0,153,153)",success:"rgb(44,122,57)",error:"rgb(171,43,63)",warning:"rgb(150,108,30)",warningShimmer:"rgb(200,158,80)",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)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(240, 240, 240)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(87,105,247)",rate_limit_empty:"rgb(39,47,111)"}},{name:"Light mode (ANSI colors only)",id:"light-ansi",colors:{autoAccept:"ansi:magenta",bashBorder:"ansi:magenta",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blue",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blue",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyan",ide:"ansi:blueBright",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:black",inverseText:"ansi:white",inactive:"ansi:blackBright",subtle:"ansi:blackBright",suggestion:"ansi:blue",remember:"ansi:blue",background:"ansi:cyan",success:"ansi:green",error:"ansi:red",warning:"ansi:yellow",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:red",blue_FOR_SUBAGENTS_ONLY:"ansi:blue",green_FOR_SUBAGENTS_ONLY:"ansi:green",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellow",purple_FOR_SUBAGENTS_ONLY:"ansi:magenta",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyan",professionalBlue:"ansi:blueBright",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:white",bashMessageBackgroundColor:"ansi:whiteBright",memoryBackgroundColor:"ansi:white",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:black"}},{name:"Dark mode (ANSI colors only)",id:"dark-ansi",colors:{autoAccept:"ansi:magentaBright",bashBorder:"ansi:magentaBright",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blueBright",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blueBright",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyanBright",ide:"ansi:blue",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:whiteBright",inverseText:"ansi:black",inactive:"ansi:white",subtle:"ansi:white",suggestion:"ansi:blueBright",remember:"ansi:blueBright",background:"ansi:cyanBright",success:"ansi:greenBright",error:"ansi:redBright",warning:"ansi:yellowBright",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:redBright",blue_FOR_SUBAGENTS_ONLY:"ansi:blueBright",green_FOR_SUBAGENTS_ONLY:"ansi:greenBright",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellowBright",purple_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyanBright",professionalBlue:"rgb(106,155,204)",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:blackBright",bashMessageBackgroundColor:"ansi:black",memoryBackgroundColor:"ansi:blackBright",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:white"}},{name:"Light mode (colorblind-friendly)",id:"light-daltonized",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(0,102,204)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(51,102,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(101,152,255)",permission:"rgb(51,102,255)",permissionShimmer:"rgb(101,152,255)",planMode:"rgb(51,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(51,102,255)",remember:"rgb(51,102,255)",background:"rgb(0,153,153)",success:"rgb(0,102,153)",error:"rgb(204,0,0)",warning:"rgb(255,153,0)",warningShimmer:"rgb(255,183,50)",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)",red_FOR_SUBAGENTS_ONLY:"rgb(204,0,0)",blue_FOR_SUBAGENTS_ONLY:"rgb(0,102,204)",green_FOR_SUBAGENTS_ONLY:"rgb(0,204,0)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,204,0)",purple_FOR_SUBAGENTS_ONLY:"rgb(128,0,128)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,128,0)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,102,178)",cyan_FOR_SUBAGENTS_ONLY:"rgb(0,178,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(220, 220, 220)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(51,102,255)",rate_limit_empty:"rgb(23,46,114)"}},{name:"Dark mode (colorblind-friendly)",id:"dark-daltonized",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(51,153,255)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(153,204,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(183,224,255)",permission:"rgb(153,204,255)",permissionShimmer:"rgb(183,224,255)",planMode:"rgb(102,153,153)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(153,204,255)",remember:"rgb(153,204,255)",background:"rgb(0,204,204)",success:"rgb(51,153,255)",error:"rgb(255,102,102)",warning:"rgb(255,204,0)",warningShimmer:"rgb(255,234,50)",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)",red_FOR_SUBAGENTS_ONLY:"rgb(255,102,102)",blue_FOR_SUBAGENTS_ONLY:"rgb(102,178,255)",green_FOR_SUBAGENTS_ONLY:"rgb(102,255,102)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,255,102)",purple_FOR_SUBAGENTS_ONLY:"rgb(178,102,255)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,178,102)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,153,204)",cyan_FOR_SUBAGENTS_ONLY:"rgb(102,204,204)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(153,204,255)",rate_limit_empty:"rgb(69,92,115)"}},{name:"Monochrome",id:"monochrome",colors:{autoAccept:"rgb(200,200,200)",bashBorder:"rgb(180,180,180)",claude:"rgb(255,255,255)",claudeShimmer:"rgb(230,230,230)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(200,200,200)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(220,220,220)",permission:"rgb(200,200,200)",permissionShimmer:"rgb(220,220,220)",planMode:"rgb(180,180,180)",ide:"rgb(190,190,190)",promptBorder:"rgb(160,160,160)",promptBorderShimmer:"rgb(180,180,180)",text:"rgb(255,255,255)",inverseText:"rgb(40,40,40)",inactive:"rgb(120,120,120)",subtle:"rgb(100,100,100)",suggestion:"rgb(200,200,200)",remember:"rgb(200,200,200)",background:"rgb(180,180,180)",success:"rgb(220,220,220)",error:"rgb(180,180,180)",warning:"rgb(200,200,200)",warningShimmer:"rgb(220,220,220)",diffAdded:"rgb(90,90,90)",diffRemoved:"rgb(60,60,60)",diffAddedDimmed:"rgb(110,110,110)",diffRemovedDimmed:"rgb(80,80,80)",diffAddedWord:"rgb(200,200,200)",diffRemovedWord:"rgb(80,80,80)",diffAddedWordDimmed:"rgb(160,160,160)",diffRemovedWordDimmed:"rgb(70,70,70)",red_FOR_SUBAGENTS_ONLY:"rgb(200,200,200)",blue_FOR_SUBAGENTS_ONLY:"rgb(180,180,180)",green_FOR_SUBAGENTS_ONLY:"rgb(210,210,210)",yellow_FOR_SUBAGENTS_ONLY:"rgb(190,190,190)",purple_FOR_SUBAGENTS_ONLY:"rgb(170,170,170)",orange_FOR_SUBAGENTS_ONLY:"rgb(195,195,195)",pink_FOR_SUBAGENTS_ONLY:"rgb(205,205,205)",cyan_FOR_SUBAGENTS_ONLY:"rgb(185,185,185)",professionalBlue:"rgb(190,190,190)",rainbow_red:"rgb(240,240,240)",rainbow_orange:"rgb(230,230,230)",rainbow_yellow:"rgb(220,220,220)",rainbow_green:"rgb(210,210,210)",rainbow_blue:"rgb(200,200,200)",rainbow_indigo:"rgb(190,190,190)",rainbow_violet:"rgb(180,180,180)",rainbow_red_shimmer:"rgb(255,255,255)",rainbow_orange_shimmer:"rgb(245,245,245)",rainbow_yellow_shimmer:"rgb(235,235,235)",rainbow_green_shimmer:"rgb(225,225,225)",rainbow_blue_shimmer:"rgb(215,215,215)",rainbow_indigo_shimmer:"rgb(205,205,205)",rainbow_violet_shimmer:"rgb(195,195,195)",clawd_body:"rgb(255,255,255)",clawd_background:"rgb(40,40,40)",userMessageBackground:"rgb(70,70,70)",bashMessageBackgroundColor:"rgb(65,65,65)",memoryBackgroundColor:"rgb(75,75,75)",rate_limit_fill:"rgb(200,200,200)",rate_limit_empty:"rgb(90,90,90)"}}],thinkingVerbs:{format:"{}… ",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","Ideating","Imagining","Incubating","Inferring","Manifesting","Marinating","Meandering","Moseying","Mulling","Musing","Mustering","Noodling","Percolating","Perusing","Philosophising","Pondering","Pontificating","Processing","Puttering","Puzzling","Reticulating","Ruminating","Scheming","Schlepping","Shimmying","Simmering","Smooshing","Spelunking","Spinning","Stewing","Sussing","Synthesizing","Thinking","Tinkering","Transmuting","Unfurling","Unravelling","Vibing","Wandering","Whirring","Wibbling","Wizarding","Working","Wrangling","Alchemizing","Animating","Architecting","Bamboozling","Beaming","Befuddling","Bewitching","Billowing","Bippity-bopping","Blanching","Boogieing","Boondoggling","Bootstrapping","Burrowing","Caching","Canoodling","Caramelizing","Cascading","Catapulting","Channeling","Choreographing","Compiling","Composing","Crystallizing","Cultivating","Deploying","Dilly-dallying","Discombobulating","Distilling","Doodling","Drizzling","Ebbing","Embellishing","Ensorcelling","Evaporating","Fermenting","Fiddle-faddling","Finagling","Flambéing","Flowing","Flummoxing","Fluttering","Frosting","Gallivanting","Galloping","Garnishing","Germinating","Gitifying","Grooving","Gusting","Harmonizing","Hashing","Hexing","Hibernating","Higgledy-piggleding","Hornswoggling","Hullaballooing","Hyperspacing","Illustrating","Improvising","Incanting","Indexing","Infusing","Ionizing","Jazzercising","Jiggery-pokerying","Jitterbugging","Julienning","Kerfuffling","Kneading","Leavening","Levitating","Linting","Lollygagging","Malarkeying","Metamorphosing","Migrating","Minifying","Misting","Moonwalking","Mystifying","Nebulizing","Nesting","Nucleating","Optimizing","Orbiting","Orchestrating","Osmosing","Parsing","Perambulating","Photosynthesizing","Pipelining","Poaching","Pollinating","Pouncing","Precipitating","Prestidigitating","Proofing","Propagating","Prowling","Quantumizing","Querying","Razzle-dazzling","Razzmatazzing","Recombobulating","Reducing","Refactoring","Rippling","Roosting","Sautéing","Scampering","Scurrying","Seasoning","Serializing","Shenaniganing","Skedaddling","Sketching","Skullduggering","Slithering","Sock-hopping","Spellbinding","Sprouting","Storyboarding","Sublimating","Swirling","Swooping","Symbioting","Syncopating","Teleporting","Tempering","Thaumaturging","Thundering","Tomfoolering","Topsy-turvying","Transfiguring","Transpiling","Twisting","Undulating","Validating","Vaporizing","Waddling","Warping","Whatchamacalliting","Whirlpooling","Whisking","Willy-nillying","Zesting","Zigzagging"]},thinkingStyle:{updateInterval:120,phases:process.env.TERM==="xterm-ghostty"?["·","✢","✳","✶","✻","*"]:process.platform==="darwin"?["·","✢","✳","✶","✻","✽"]:["·","✢","*","✶","✻","✽"],reverseMirror:!0},userMessageDisplay:{prefix:{format:">",styling:[],foreground_color:"rgb(0,0,0)",background_color:"rgb(0,0,0)"},message:{format:"{}",styling:[],foreground_color:"rgb(0,0,0)",background_color:"rgb(0,0,0)"}},inputBox:{removeBorder:!1},misc:{showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0},toolsets:[],defaultToolset:null},pt=()=>{const e=re.join(ye.homedir(),".tweakcc"),t=process.env.XDG_CONFIG_HOME;try{if(Ce.existsSync(e))return e}catch{}return t?re.join(t,"tweakcc"):e},ce=pt(),ae=re.join(ce,"config.json"),Ne=re.join(ce,"cli.js.backup"),ge=re.join(ce,"native-binary.backup"),Se=re.join(ce,"system-prompts"),wn=re.join(ce,"prompt-data-cache"),bt=()=>{const e=[],t=process.platform=="win32"?ye.homedir().replace(/\\/g,"/"):ye.homedir(),n="node_modules/@anthropic-ai/claude-code",r=(o,i=!1)=>{if(i){const a=gt(o,{onlyFiles:!1});e.push({pattern:o,isGlob:!0,expandedPaths:a})}else e.push({pattern:o,isGlob:!1,expandedPaths:[o]})};return r(`${ye.homedir()}/.claude/local/${n}`),process.env.NPM_PREFIX&&r(`${process.env.NPM_PREFIX}/lib/${n}`),process.env.N_PREFIX&&r(`${process.env.N_PREFIX}/lib/${n}`),process.env.VOLTA_HOME&&r(`${process.env.VOLTA_HOME}/lib/${n}`),process.env.FNM_DIR&&r(`${process.env.FNM_DIR}/lib/${n}`),process.env.NVM_DIR&&r(`${process.env.NVM_DIR}/lib/${n}`),process.env.NODENV_ROOT&&r(`${process.env.NODENV_ROOT}/versions/*/lib/${n}`,!0),process.env.NVS_HOME&&r(`${process.env.NVS_HOME}/node/*/*/lib/${n}`,!0),process.env.ASDF_DATA_DIR&&r(`${process.env.ASDF_DATA_DIR}/installs/nodejs/*/lib/${n}`,!0),process.platform=="win32"?(r(`${t}/AppData/Local/Volta/tools/image/packages/@anthropic-ai/claude-code/${n}`),r(`${t}/AppData/Roaming/npm/${n}`),r(`${t}/AppData/Roaming/nvm/*/${n}`,!0),r(`${t}/AppData/Local/Yarn/config/global/${n}`),r(`${t}/AppData/Local/pnpm/global/*/${n}`,!0),r(`C:/nvm4w/nodejs/${n}`),r(`${t}/n/versions/node/*/lib/${n}`,!0),r(`${t}/AppData/Roaming/Yarn/config/global/${n}`),r(`${t}/AppData/Roaming/pnpm-global/${n}`),r(`${t}/AppData/Roaming/pnpm-global/*/${n}`,!0),r(`${t}/.bun/install/global/${n}`),r(`${t}/AppData/Local/fnm_multishells/*/node_modules/${n}`,!0)):(process.platform=="darwin"&&(r(`${t}/Library/${n}`),r(`/opt/local/lib/${n}`)),r(`${t}/.local/lib/${n}`),r(`${t}/.local/share/${n}`),r(`${t}/.npm-global/lib/${n}`),r(`${t}/.npm-packages/lib/${n}`),r(`${t}/.npm/lib/${n}`),r(`${t}/npm/lib/${n}`),r(`/etc/${n}`),r(`/lib/${n}`),r(`/opt/node/lib/${n}`),r(`/usr/lib/${n}`),r(`/usr/local/lib/${n}`),r(`/usr/share/${n}`),r(`/var/lib/${n}`),r(`/opt/homebrew/lib/${n}`),r(`${t}/.linuxbrew/lib/${n}`),r(`${t}/.config/yarn/global/${n}`),r(`${t}/.yarn/global/${n}`),r(`${t}/.bun/install/global/${n}`),r(`${t}/.pnpm-global/${n}`),r(`${t}/.pnpm-global/*/${n}`,!0),r(`${t}/pnpm-global/${n}`),r(`${t}/pnpm-global/*/${n}`,!0),r(`${t}/.local/share/pnpm/global/${n}`),r(`${t}/.local/share/pnpm/global/*/${n}`,!0),r(`${t}/.bun/install/global/${n}`),r(`/usr/local/n/versions/node/*/lib/${n}`,!0),r(`${t}/n/versions/node/*/lib/${n}`,!0),r(`${t}/n/lib/${n}`),r(`${t}/.volta/tools/image/node/*/lib/${n}`,!0),r(`${t}/.fnm/node-versions/*/installation/lib/${n}`,!0),r(`${t}/.local/state/fnm_multishells/*/lib/${n}`,!0),r(`/usr/local/nvm/versions/node/*/lib/${n}`,!0),r(`/usr/local/share/nvm/versions/node/*/lib/${n}`,!0),r(`${t}/.nvm/versions/node/*/lib/${n}`,!0),r(`${t}/.nodenv/versions/*/lib/${n}`,!0),r(`${t}/.nvs/*/lib/${n}`,!0),r(`${t}/.asdf/installs/nodejs/*/lib/${n}`,!0),process.env.MISE_DATA_DIR&&r(`${process.env.MISE_DATA_DIR}/installs/node/*/lib/${n}`,!0),r(`${t}/.local/share/mise/installs/node/*/lib/${n}`,!0)),process.platform=="win32"&&e.forEach(o=>{o.pattern=o.pattern.replace(/\//g,"\\"),o.expandedPaths=o.expandedPaths.map(i=>i.replace(/\//g,"\\"))}),e},en=bt(),xn=en.flatMap(e=>e.expandedPaths),wt=({children:e,...t})=>g(c,{bold:!0,backgroundColor:"#ffd500",color:"#000",...t,children:[" ",e," "]});var pe=wt;const xt=[{name:J.THEMES,desc:"Modify Claude Code's built-in themes or create your own"},{name:J.THINKING_VERBS,desc:"Customize the list of verbs that Claude Code uses when it's working"},{name:J.THINKING_STYLE,desc:"Choose custom spinners"},{name:J.USER_MESSAGE_DISPLAY,desc:"Customize how user messages are displayed"},{name:J.MISC,desc:"Miscellaneous settings (input box border, etc.)"},{name:J.TOOLSETS,desc:"Manage toolsets to control which tools are available"},{name:J.VIEW_SYSTEM_PROMPTS,desc:"Opens the system prompts directory where you can customize Claude Code's system prompts"}],yn=[{name:J.RESTORE_ORIGINAL,desc:"Reverts your Claude Code install to its original state (your customizations are remembered and can be reapplied)"},{name:J.OPEN_CONFIG,desc:`Opens your tweakcc config file (${ae})`},{name:J.OPEN_CLI,desc:"Opens Claude Code's cli.js file"},{name:J.EXIT,desc:"Bye!"}];function yt({onSubmit:e,notification:t,isNativeInstallation:n}){const r=n?yn.filter(l=>l.name!==J.OPEN_CLI):yn,o=[...be(ue).changesApplied?[]:[{name:J.APPLY_CHANGES,desc:"Required: Updates Claude Code in-place with your changes",selectedStyles:{color:"green"}}],...xt,...r],[i,a]=O(0);return g(m,{flexDirection:"column",children:[s(m,{marginBottom:1,children:s(pe,{children:"Tweak Claude Code"})}),s(m,{marginBottom:1,children:g(c,{color:"gray",children:[s(c,{bold:!0,children:"Customize your Claude Code installation."})," ",s(c,{dimColor:!0,children:"Settings will be saved to a JSON file."})]})}),s(m,{marginBottom:1,children:g(c,{color:"yellow",children:["⭐ ",s(c,{bold:!0,children:"Star the repo at "}),s(ht,{url:"https://github.com/Piebald-AI/tweakcc",fallback:!1,children:s(c,{bold:!0,color:"cyan",children:"https://github.com/Piebald-AI/tweakcc"})}),s(c,{bold:!0,children:" if you find this useful!"})," ⭐"]})}),t&&s(m,{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:s(c,{color:t?.type==="success"?"green":t?.type==="error"?"red":t?.type==="info"?"blue":"yellow",children:t?.message})}),s(mt,{items:o,selectedIndex:i,onSelect:a,onSubmit:l=>e(l)})]})}async function rn(e){const t=re.join(wn,`prompts-${e}.json`);try{const r=await te.readFile(t,"utf-8");return JSON.parse(r)}catch{}const n=`https://raw.githubusercontent.com/Piebald-AI/tweakcc/refs/heads/main/data/prompts/prompts-${e}.json`;try{const r=await fetch(n);if(!r.ok){let i;throw r.status===429?i="Rate limit exceeded. GitHub has temporarily blocked requests. Please wait a few minutes and try again.":r.status===404?i=`Prompts file not found for Claude Code v${e}. This version was released within the past day or so and will be supported within a few hours.`:r.status>=500?i=`GitHub server error (${r.status}). Please try again later.`:i=`HTTP ${r.status}: ${r.statusText}`,new Error(i)}const o=await r.json();try{await te.mkdir(wn,{recursive:!0}),await te.writeFile(t,JSON.stringify(o,null,2),"utf-8")}catch(i){console.warn(`Failed to write to cache to ${t}: ${i}`)}return o}catch(r){if(r instanceof Error){if(r.message.includes("Rate limit")||r.message.includes("not found")||r.message.includes("server error")||r.message.includes("HTTP"))throw r;const o=`Failed to download prompts for version ${e}: ${r.message}`;throw new Error(o)}throw r}}const St="modulepreload",vt=function(e){return"/"+e},Sn={},$t=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let d=function(h){return Promise.all(h.map(f=>Promise.resolve(f).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};const a=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),u=l?.nonce||l?.getAttribute("nonce");o=d(n.map(h=>{if(h=vt(h,r),h in Sn)return;Sn[h]=!0;const f=h.endsWith(".css"),v=f?'[rel="stylesheet"]':"";if(!!r)for(let w=a.length-1;w>=0;w--){const x=a[w];if(x.href===h&&(!f||x.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${h}"]${v}`))return;const p=document.createElement("link");if(p.rel=f?"stylesheet":St,f||(p.as="script"),p.crossOrigin="",p.href=h,u&&p.setAttribute("nonce",u),document.head.appendChild(p),f)return new Promise((w,x)=>{p.addEventListener("load",w),p.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${h}`)))})}))}function i(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return o.then(a=>{for(const l of a||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},Pn=re.join(ce,"systemPromptOriginalHashes.json"),Dn=re.join(ce,"systemPromptAppliedHashes.json"),Ln=(e,t)=>`${e}-${t}`,We=e=>An.createHash("md5").update(e.trim(),"utf8").digest("hex"),Rn=async()=>{try{const e=await te.readFile(Pn,"utf8");return JSON.parse(e)}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return{};throw e}},_t=async e=>{await te.mkdir(ce,{recursive:!0});const t={},n=Object.keys(e).sort();for(const r of n)t[r]=e[r];await te.writeFile(Pn,JSON.stringify(t,null,2),"utf8")},It=async e=>{const t=await Rn();let n=0;for(const r of e.prompts){const o=Ln(r.id,r.version);if(!t[o]){const i=Fe(r.pieces,r.identifiers,r.identifierMap),a=We(i);t[o]=a,n++}}return await _t(t),n},Ct=async(e,t)=>{const n=await Rn(),r=Ln(e,t);return n[r]},on=async()=>{try{const e=await te.readFile(Dn,"utf8");return JSON.parse(e)}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return{};throw e}},Fn=async e=>{await te.mkdir(ce,{recursive:!0});const t={},n=Object.keys(e).sort();for(const r of n)t[r]=e[r];await te.writeFile(Dn,JSON.stringify(t,null,2),"utf8")},Et=async(e,t)=>{const n=await on();n[e]=t,await Fn(n)},kt=async()=>{const e=await on(),t={};for(const n of Object.keys(e))t[n]=null;await Fn(t)},Tt=async e=>{try{const t=await on();if(Object.keys(t).length===0)return!1;const r=(await te.readdir(e)).filter(o=>o.endsWith(".md"));for(const o of r){const i=o.replace(".md",""),a=t[i];if(a===void 0||a===null)continue;const l=re.join(e,o),u=await te.readFile(l,"utf8"),h=(await $t(()=>import("gray-matter"),[])).default(u,{delimiters:["<!--","-->"]});if(We(h.content)!==a)return!0}return!1}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return!1;throw t}},Vn=e=>{const t=Ge(e,{delimiters:["<!--","-->"]}),{name:n,description:r,ccVersion:o,variables:i}=t.data;return{name:n||"",description:r||"",ccVersion:o||"",variables:i||[],content:t.content.trim()}},vn=(e,t)=>{const n=t||Fe(e.pieces,e.identifiers,e.identifierMap),r=Object.keys(e.identifierMap).length>0?[...new Set(Object.values(e.identifierMap))]:void 0,o={name:e.name,description:e.description,ccVersion:e.version};return r&&r.length>0&&(o.variables=r),Ge.stringify(n,o,{delimiters:["<!--","-->"]})},Fe=(e,t,n)=>{let r="";for(let o=0;o<e.length;o++)if(r+=e[o],o<t.length){const i=t[o],a=n[String(i)]||`UNKNOWN_${i}`;r+=a}return r},Mt=(e,t)=>{const n=e.split(".").map(Number),r=t.split(".").map(Number);for(let o=0;o<Math.max(n.length,r.length);o++){const i=n[o]||0,a=r[o]||0;if(i<a)return-1;if(i>a)return 1}return 0},Ve=e=>re.join(Se,`${e}.md`),Nt=async e=>{try{return await te.access(Ve(e)),!0}catch{return!1}},Bt=async e=>{const t=Ve(e),n=await te.readFile(t,"utf-8");return Vn(n)},nn=async(e,t)=>{const n=Ve(e);await te.writeFile(n,t,"utf-8")},Ot=async(e,t)=>{const n=Ve(e),r=await te.readFile(n,"utf-8"),o=Ge(r,{delimiters:["<!--","-->"]}),i=Object.keys(t).length>0?[...new Set(Object.values(t))]:void 0,a={name:o.data.name,description:o.data.description,ccVersion:o.data.ccVersion};i&&i.length>0&&(a.variables=i);const l=Ge.stringify(o.content,a,{delimiters:["<!--","-->"]});await nn(e,l)},At=(e,t)=>{const n=w=>w.split(/(\s+)/),r=n(e),o=n(t),i=r.length,a=o.length,l=Array(i+1).fill(0).map(()=>Array(a+1).fill(0));for(let w=1;w<=i;w++)for(let x=1;x<=a;x++)r[w-1]===o[x-1]?l[w][x]=l[w-1][x-1]+1:l[w][x]=Math.max(l[w-1][x],l[w][x-1]);const u=Array(i).fill(!1),d=Array(a).fill(!1);let h=i,f=a;for(;h>0||f>0;)h>0&&f>0&&r[h-1]===o[f-1]?(h--,f--):f>0&&(h===0||l[h][f-1]>=l[h-1][f])?(d[f-1]=!0,f--):h>0&&(u[h-1]=!0,h--);const v=w=>w.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");let b="";for(let w=0;w<r.length;w++){const x=v(r[w]);b+=u[w]?`<mark>${x}</mark>`:x}let p="";for(let w=0;w<o.length;w++){const x=v(o[w]);p+=d[w]?`<mark>${x}</mark>`:x}return{oldHtml:b,newHtml:p}},$n=(e,t)=>{const n=e.length,r=t.length,o=Array(n+1).fill(0).map(()=>Array(r+1).fill(0));for(let d=1;d<=n;d++)for(let h=1;h<=r;h++)e[d-1]===t[h-1]?o[d][h]=o[d-1][h-1]+1:o[d][h]=Math.max(o[d-1][h],o[d][h-1]);const i=[];let a=n,l=r;const u=[];for(;a>0||l>0;)a>0&&l>0&&e[a-1]===t[l-1]?(u.unshift({type:"unchanged",line:e[a-1],oldLineNo:a,newLineNo:l}),a--,l--):l>0&&(a===0||o[a][l-1]>=o[a-1][l])?(u.unshift({type:"added",line:t[l-1],newLineNo:l}),l--):a>0&&(u.unshift({type:"removed",line:e[a-1],oldLineNo:a}),a--);for(let d=0;d<u.length;d++){const h=u[d],f=u[d+1];if(h.type==="removed"&&f?.type==="added"){const v=At(h.line,f.line);i.push({type:"modified",line:h.line,oldLineNo:h.oldLineNo,newLineNo:f.newLineNo,oldHtml:v.oldHtml,newHtml:v.newHtml}),d++}else i.push(h)}return i},Pt=async(e,t,n,r,o,i,a,l)=>{const u=n.split(`
|
|
3
|
-
`),
|
|
4
|
-
`),
|
|
5
|
-
`),
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
`}else if(
|
|
9
|
-
`}else
|
|
10
|
-
`}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
`}else if(
|
|
14
|
-
`}else
|
|
2
|
+
import{Box as m,Text as d,render as ct,useInput as de}from"ink";import{Command as dt}from"commander";import j from"chalk";import*as oe from"node:fs/promises";import ie from"node:fs/promises";import Ke,{Fragment as Ee,createContext as ut,useCallback as Nn,useContext as be,useEffect as xe,useState as A}from"react";import ht from"ink-link";import{Fragment as me,jsx as s,jsxs as g}from"react/jsx-runtime";import*as re from"node:path";import On from"node:path";import*as ye from"node:os";import{EOL as bn}from"node:os";import*as Ce from"node:fs";import Le from"node:fs";import{globbySync as gt}from"globby";import ft from"node:process";import*as Me from"node:child_process";import{execSync as Bn}from"node:child_process";import*as An from"node:crypto";import Ge from"gray-matter";import Fe from"node-lief";function mt({items:e,selectedIndex:t,onSelect:n,onSubmit:o}){return de((r,i)=>{i.upArrow?n(t>0?t-1:e.length-1):i.downArrow?n(t<e.length-1?t+1:0):i.return&&o(e[t].name)}),s(m,{flexDirection:"column",children:e.map((r,i)=>s(m,{children:g(d,{children:[g(d,{bold:i===t,color:i===t?"cyan":void 0,...i===t?r.selectedStyles??{}:r.styles??{},children:[i===t?"❯ ":" ",r.name]}),r.desc&&i===t&&g(d,{dimColor:!0,bold:!1,children:[" \x1B[0;2m","- ",r.desc]})]})},i))})}let Z=function(e){return e.APPLY_CHANGES="*Apply customizations",e.THEMES="Themes",e.THINKING_VERBS="Thinking verbs",e.THINKING_STYLE="Thinking style",e.USER_MESSAGE_DISPLAY="User message display",e.MISC="Misc",e.TOOLSETS="Toolsets",e.VIEW_SYSTEM_PROMPTS="View system prompts",e.RESTORE_ORIGINAL="Restore original Claude Code (preserves config.json)",e.OPEN_CONFIG="Open config.json",e.OPEN_CLI="Open Claude Code's cli.js",e.EXIT="Exit",e}({});const ee={themes:[{name:"Dark mode",id:"dark",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(253,93,177)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(235,159,127)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(147,165,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(177,195,255)",permission:"rgb(177,185,249)",permissionShimmer:"rgb(207,215,255)",planMode:"rgb(72,150,140)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(177,185,249)",remember:"rgb(177,185,249)",background:"rgb(0,204,204)",success:"rgb(78,186,101)",error:"rgb(255,107,128)",warning:"rgb(255,193,7)",warningShimmer:"rgb(255,223,57)",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)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(177,185,249)",rate_limit_empty:"rgb(80,83,112)"}},{name:"Light mode",id:"light",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(255,0,135)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(245,149,117)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(87,105,247)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(117,135,255)",permission:"rgb(87,105,247)",permissionShimmer:"rgb(137,155,255)",planMode:"rgb(0,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(87,105,247)",remember:"rgb(0,0,255)",background:"rgb(0,153,153)",success:"rgb(44,122,57)",error:"rgb(171,43,63)",warning:"rgb(150,108,30)",warningShimmer:"rgb(200,158,80)",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)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(240, 240, 240)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(87,105,247)",rate_limit_empty:"rgb(39,47,111)"}},{name:"Light mode (ANSI colors only)",id:"light-ansi",colors:{autoAccept:"ansi:magenta",bashBorder:"ansi:magenta",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blue",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blue",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyan",ide:"ansi:blueBright",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:black",inverseText:"ansi:white",inactive:"ansi:blackBright",subtle:"ansi:blackBright",suggestion:"ansi:blue",remember:"ansi:blue",background:"ansi:cyan",success:"ansi:green",error:"ansi:red",warning:"ansi:yellow",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:red",blue_FOR_SUBAGENTS_ONLY:"ansi:blue",green_FOR_SUBAGENTS_ONLY:"ansi:green",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellow",purple_FOR_SUBAGENTS_ONLY:"ansi:magenta",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyan",professionalBlue:"ansi:blueBright",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:white",bashMessageBackgroundColor:"ansi:whiteBright",memoryBackgroundColor:"ansi:white",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:black"}},{name:"Dark mode (ANSI colors only)",id:"dark-ansi",colors:{autoAccept:"ansi:magentaBright",bashBorder:"ansi:magentaBright",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blueBright",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blueBright",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyanBright",ide:"ansi:blue",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:whiteBright",inverseText:"ansi:black",inactive:"ansi:white",subtle:"ansi:white",suggestion:"ansi:blueBright",remember:"ansi:blueBright",background:"ansi:cyanBright",success:"ansi:greenBright",error:"ansi:redBright",warning:"ansi:yellowBright",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:redBright",blue_FOR_SUBAGENTS_ONLY:"ansi:blueBright",green_FOR_SUBAGENTS_ONLY:"ansi:greenBright",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellowBright",purple_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyanBright",professionalBlue:"rgb(106,155,204)",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:blackBright",bashMessageBackgroundColor:"ansi:black",memoryBackgroundColor:"ansi:blackBright",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:white"}},{name:"Light mode (colorblind-friendly)",id:"light-daltonized",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(0,102,204)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(51,102,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(101,152,255)",permission:"rgb(51,102,255)",permissionShimmer:"rgb(101,152,255)",planMode:"rgb(51,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(51,102,255)",remember:"rgb(51,102,255)",background:"rgb(0,153,153)",success:"rgb(0,102,153)",error:"rgb(204,0,0)",warning:"rgb(255,153,0)",warningShimmer:"rgb(255,183,50)",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)",red_FOR_SUBAGENTS_ONLY:"rgb(204,0,0)",blue_FOR_SUBAGENTS_ONLY:"rgb(0,102,204)",green_FOR_SUBAGENTS_ONLY:"rgb(0,204,0)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,204,0)",purple_FOR_SUBAGENTS_ONLY:"rgb(128,0,128)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,128,0)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,102,178)",cyan_FOR_SUBAGENTS_ONLY:"rgb(0,178,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(220, 220, 220)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(51,102,255)",rate_limit_empty:"rgb(23,46,114)"}},{name:"Dark mode (colorblind-friendly)",id:"dark-daltonized",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(51,153,255)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(153,204,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(183,224,255)",permission:"rgb(153,204,255)",permissionShimmer:"rgb(183,224,255)",planMode:"rgb(102,153,153)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(153,204,255)",remember:"rgb(153,204,255)",background:"rgb(0,204,204)",success:"rgb(51,153,255)",error:"rgb(255,102,102)",warning:"rgb(255,204,0)",warningShimmer:"rgb(255,234,50)",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)",red_FOR_SUBAGENTS_ONLY:"rgb(255,102,102)",blue_FOR_SUBAGENTS_ONLY:"rgb(102,178,255)",green_FOR_SUBAGENTS_ONLY:"rgb(102,255,102)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,255,102)",purple_FOR_SUBAGENTS_ONLY:"rgb(178,102,255)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,178,102)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,153,204)",cyan_FOR_SUBAGENTS_ONLY:"rgb(102,204,204)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(153,204,255)",rate_limit_empty:"rgb(69,92,115)"}},{name:"Monochrome",id:"monochrome",colors:{autoAccept:"rgb(200,200,200)",bashBorder:"rgb(180,180,180)",claude:"rgb(255,255,255)",claudeShimmer:"rgb(230,230,230)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(200,200,200)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(220,220,220)",permission:"rgb(200,200,200)",permissionShimmer:"rgb(220,220,220)",planMode:"rgb(180,180,180)",ide:"rgb(190,190,190)",promptBorder:"rgb(160,160,160)",promptBorderShimmer:"rgb(180,180,180)",text:"rgb(255,255,255)",inverseText:"rgb(40,40,40)",inactive:"rgb(120,120,120)",subtle:"rgb(100,100,100)",suggestion:"rgb(200,200,200)",remember:"rgb(200,200,200)",background:"rgb(180,180,180)",success:"rgb(220,220,220)",error:"rgb(180,180,180)",warning:"rgb(200,200,200)",warningShimmer:"rgb(220,220,220)",diffAdded:"rgb(90,90,90)",diffRemoved:"rgb(60,60,60)",diffAddedDimmed:"rgb(110,110,110)",diffRemovedDimmed:"rgb(80,80,80)",diffAddedWord:"rgb(200,200,200)",diffRemovedWord:"rgb(80,80,80)",diffAddedWordDimmed:"rgb(160,160,160)",diffRemovedWordDimmed:"rgb(70,70,70)",red_FOR_SUBAGENTS_ONLY:"rgb(200,200,200)",blue_FOR_SUBAGENTS_ONLY:"rgb(180,180,180)",green_FOR_SUBAGENTS_ONLY:"rgb(210,210,210)",yellow_FOR_SUBAGENTS_ONLY:"rgb(190,190,190)",purple_FOR_SUBAGENTS_ONLY:"rgb(170,170,170)",orange_FOR_SUBAGENTS_ONLY:"rgb(195,195,195)",pink_FOR_SUBAGENTS_ONLY:"rgb(205,205,205)",cyan_FOR_SUBAGENTS_ONLY:"rgb(185,185,185)",professionalBlue:"rgb(190,190,190)",rainbow_red:"rgb(240,240,240)",rainbow_orange:"rgb(230,230,230)",rainbow_yellow:"rgb(220,220,220)",rainbow_green:"rgb(210,210,210)",rainbow_blue:"rgb(200,200,200)",rainbow_indigo:"rgb(190,190,190)",rainbow_violet:"rgb(180,180,180)",rainbow_red_shimmer:"rgb(255,255,255)",rainbow_orange_shimmer:"rgb(245,245,245)",rainbow_yellow_shimmer:"rgb(235,235,235)",rainbow_green_shimmer:"rgb(225,225,225)",rainbow_blue_shimmer:"rgb(215,215,215)",rainbow_indigo_shimmer:"rgb(205,205,205)",rainbow_violet_shimmer:"rgb(195,195,195)",clawd_body:"rgb(255,255,255)",clawd_background:"rgb(40,40,40)",userMessageBackground:"rgb(70,70,70)",bashMessageBackgroundColor:"rgb(65,65,65)",memoryBackgroundColor:"rgb(75,75,75)",rate_limit_fill:"rgb(200,200,200)",rate_limit_empty:"rgb(90,90,90)"}}],thinkingVerbs:{format:"{}… ",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","Ideating","Imagining","Incubating","Inferring","Manifesting","Marinating","Meandering","Moseying","Mulling","Musing","Mustering","Noodling","Percolating","Perusing","Philosophising","Pondering","Pontificating","Processing","Puttering","Puzzling","Reticulating","Ruminating","Scheming","Schlepping","Shimmying","Simmering","Smooshing","Spelunking","Spinning","Stewing","Sussing","Synthesizing","Thinking","Tinkering","Transmuting","Unfurling","Unravelling","Vibing","Wandering","Whirring","Wibbling","Wizarding","Working","Wrangling","Alchemizing","Animating","Architecting","Bamboozling","Beaming","Befuddling","Bewitching","Billowing","Bippity-bopping","Blanching","Boogieing","Boondoggling","Bootstrapping","Burrowing","Caching","Canoodling","Caramelizing","Cascading","Catapulting","Channeling","Choreographing","Compiling","Composing","Crystallizing","Cultivating","Deploying","Dilly-dallying","Discombobulating","Distilling","Doodling","Drizzling","Ebbing","Embellishing","Ensorcelling","Evaporating","Fermenting","Fiddle-faddling","Finagling","Flambéing","Flowing","Flummoxing","Fluttering","Frosting","Gallivanting","Galloping","Garnishing","Germinating","Gitifying","Grooving","Gusting","Harmonizing","Hashing","Hexing","Hibernating","Higgledy-piggleding","Hornswoggling","Hullaballooing","Hyperspacing","Illustrating","Improvising","Incanting","Indexing","Infusing","Ionizing","Jazzercising","Jiggery-pokerying","Jitterbugging","Julienning","Kerfuffling","Kneading","Leavening","Levitating","Linting","Lollygagging","Malarkeying","Metamorphosing","Migrating","Minifying","Misting","Moonwalking","Mystifying","Nebulizing","Nesting","Nucleating","Optimizing","Orbiting","Orchestrating","Osmosing","Parsing","Perambulating","Photosynthesizing","Pipelining","Poaching","Pollinating","Pouncing","Precipitating","Prestidigitating","Proofing","Propagating","Prowling","Quantumizing","Querying","Razzle-dazzling","Razzmatazzing","Recombobulating","Reducing","Refactoring","Rippling","Roosting","Sautéing","Scampering","Scurrying","Seasoning","Serializing","Shenaniganing","Skedaddling","Sketching","Skullduggering","Slithering","Sock-hopping","Spellbinding","Sprouting","Storyboarding","Sublimating","Swirling","Swooping","Symbioting","Syncopating","Teleporting","Tempering","Thaumaturging","Thundering","Tomfoolering","Topsy-turvying","Transfiguring","Transpiling","Twisting","Undulating","Validating","Vaporizing","Waddling","Warping","Whatchamacalliting","Whirlpooling","Whisking","Willy-nillying","Zesting","Zigzagging"]},thinkingStyle:{updateInterval:120,phases:process.env.TERM==="xterm-ghostty"?["·","✢","✳","✶","✻","*"]:process.platform==="darwin"?["·","✢","✳","✶","✻","✽"]:["·","✢","*","✶","✻","✽"],reverseMirror:!0},userMessageDisplay:{prefix:{format:">",styling:[],foreground_color:"rgb(0,0,0)",background_color:"rgb(0,0,0)"},message:{format:"{}",styling:[],foreground_color:"rgb(0,0,0)",background_color:"rgb(0,0,0)"}},inputBox:{removeBorder:!1},misc:{showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0},toolsets:[],defaultToolset:null},pt=()=>{const e=re.join(ye.homedir(),".tweakcc"),t=process.env.XDG_CONFIG_HOME;try{if(Ce.existsSync(e))return e}catch{}return t?re.join(t,"tweakcc"):e},ce=pt(),ae=re.join(ce,"config.json"),Ne=re.join(ce,"cli.js.backup"),ge=re.join(ce,"native-binary.backup"),Se=re.join(ce,"system-prompts"),wn=re.join(ce,"prompt-data-cache"),bt=()=>{const e=[],t=process.platform=="win32"?ye.homedir().replace(/\\/g,"/"):ye.homedir(),n="node_modules/@anthropic-ai/claude-code",o=(r,i=!1)=>{if(i){const a=gt(r,{onlyFiles:!1});e.push({pattern:r,isGlob:!0,expandedPaths:a})}else e.push({pattern:r,isGlob:!1,expandedPaths:[r]})};return o(`${ye.homedir()}/.claude/local/${n}`),process.env.NPM_PREFIX&&o(`${process.env.NPM_PREFIX}/lib/${n}`),process.env.N_PREFIX&&o(`${process.env.N_PREFIX}/lib/${n}`),process.env.VOLTA_HOME&&o(`${process.env.VOLTA_HOME}/lib/${n}`),process.env.FNM_DIR&&o(`${process.env.FNM_DIR}/lib/${n}`),process.env.NVM_DIR&&o(`${process.env.NVM_DIR}/lib/${n}`),process.env.NODENV_ROOT&&o(`${process.env.NODENV_ROOT}/versions/*/lib/${n}`,!0),process.env.NVS_HOME&&o(`${process.env.NVS_HOME}/node/*/*/lib/${n}`,!0),process.env.ASDF_DATA_DIR&&o(`${process.env.ASDF_DATA_DIR}/installs/nodejs/*/lib/${n}`,!0),process.platform=="win32"?(o(`${t}/AppData/Local/Volta/tools/image/packages/@anthropic-ai/claude-code/${n}`),o(`${t}/AppData/Roaming/npm/${n}`),o(`${t}/AppData/Roaming/nvm/*/${n}`,!0),o(`${t}/AppData/Local/Yarn/config/global/${n}`),o(`${t}/AppData/Local/pnpm/global/*/${n}`,!0),o(`C:/nvm4w/nodejs/${n}`),o(`${t}/n/versions/node/*/lib/${n}`,!0),o(`${t}/AppData/Roaming/Yarn/config/global/${n}`),o(`${t}/AppData/Roaming/pnpm-global/${n}`),o(`${t}/AppData/Roaming/pnpm-global/*/${n}`,!0),o(`${t}/.bun/install/global/${n}`),o(`${t}/AppData/Local/fnm_multishells/*/node_modules/${n}`,!0)):(process.platform=="darwin"&&(o(`${t}/Library/${n}`),o(`/opt/local/lib/${n}`)),o(`${t}/.local/lib/${n}`),o(`${t}/.local/share/${n}`),o(`${t}/.npm-global/lib/${n}`),o(`${t}/.npm-packages/lib/${n}`),o(`${t}/.npm/lib/${n}`),o(`${t}/npm/lib/${n}`),o(`/etc/${n}`),o(`/lib/${n}`),o(`/opt/node/lib/${n}`),o(`/usr/lib/${n}`),o(`/usr/local/lib/${n}`),o(`/usr/share/${n}`),o(`/var/lib/${n}`),o(`/opt/homebrew/lib/${n}`),o(`${t}/.linuxbrew/lib/${n}`),o(`${t}/.config/yarn/global/${n}`),o(`${t}/.yarn/global/${n}`),o(`${t}/.bun/install/global/${n}`),o(`${t}/.pnpm-global/${n}`),o(`${t}/.pnpm-global/*/${n}`,!0),o(`${t}/pnpm-global/${n}`),o(`${t}/pnpm-global/*/${n}`,!0),o(`${t}/.local/share/pnpm/global/${n}`),o(`${t}/.local/share/pnpm/global/*/${n}`,!0),o(`${t}/.bun/install/global/${n}`),o(`/usr/local/n/versions/node/*/lib/${n}`,!0),o(`${t}/n/versions/node/*/lib/${n}`,!0),o(`${t}/n/lib/${n}`),o(`${t}/.volta/tools/image/node/*/lib/${n}`,!0),o(`${t}/.fnm/node-versions/*/installation/lib/${n}`,!0),o(`${t}/.local/state/fnm_multishells/*/lib/${n}`,!0),o(`/usr/local/nvm/versions/node/*/lib/${n}`,!0),o(`/usr/local/share/nvm/versions/node/*/lib/${n}`,!0),o(`${t}/.nvm/versions/node/*/lib/${n}`,!0),o(`${t}/.nodenv/versions/*/lib/${n}`,!0),o(`${t}/.nvs/*/lib/${n}`,!0),o(`${t}/.asdf/installs/nodejs/*/lib/${n}`,!0),process.env.MISE_DATA_DIR&&o(`${process.env.MISE_DATA_DIR}/installs/node/*/lib/${n}`,!0),o(`${t}/.local/share/mise/installs/node/*/lib/${n}`,!0),process.env.MISE_DATA_DIR&&o(`${process.env.MISE_DATA_DIR}/installs/npm-anthropic-ai-claude-code/*/lib/${n}`,!0),o(`${t}/.local/share/mise/installs/npm-anthropic-ai-claude-code/*/lib/${n}`,!0)),process.platform=="win32"&&e.forEach(r=>{r.pattern=r.pattern.replace(/\//g,"\\"),r.expandedPaths=r.expandedPaths.map(i=>i.replace(/\//g,"\\"))}),e},en=bt(),xn=en.flatMap(e=>e.expandedPaths),wt=({children:e,...t})=>g(d,{bold:!0,backgroundColor:"#ffd500",color:"#000",...t,children:[" ",e," "]});var pe=wt;const xt=[{name:Z.THEMES,desc:"Modify Claude Code's built-in themes or create your own"},{name:Z.THINKING_VERBS,desc:"Customize the list of verbs that Claude Code uses when it's working"},{name:Z.THINKING_STYLE,desc:"Choose custom spinners"},{name:Z.USER_MESSAGE_DISPLAY,desc:"Customize how user messages are displayed"},{name:Z.MISC,desc:"Miscellaneous settings (input box border, etc.)"},{name:Z.TOOLSETS,desc:"Manage toolsets to control which tools are available"},{name:Z.VIEW_SYSTEM_PROMPTS,desc:"Opens the system prompts directory where you can customize Claude Code's system prompts"}],yn=[{name:Z.RESTORE_ORIGINAL,desc:"Reverts your Claude Code install to its original state (your customizations are remembered and can be reapplied)"},{name:Z.OPEN_CONFIG,desc:`Opens your tweakcc config file (${ae})`},{name:Z.OPEN_CLI,desc:"Opens Claude Code's cli.js file"},{name:Z.EXIT,desc:"Bye!"}];function yt({onSubmit:e,notification:t,isNativeInstallation:n}){const o=n?yn.filter(l=>l.name!==Z.OPEN_CLI):yn,r=[...be(ue).changesApplied?[]:[{name:Z.APPLY_CHANGES,desc:"Required: Updates Claude Code in-place with your changes",selectedStyles:{color:"green"}}],...xt,...o],[i,a]=A(0);return g(m,{flexDirection:"column",children:[s(m,{marginBottom:1,children:s(pe,{children:"Tweak Claude Code"})}),s(m,{marginBottom:1,children:g(d,{color:"gray",children:[s(d,{bold:!0,children:"Customize your Claude Code installation."})," ",s(d,{dimColor:!0,children:"Settings will be saved to a JSON file."})]})}),s(m,{marginBottom:1,children:g(d,{color:"yellow",children:["⭐ ",s(d,{bold:!0,children:"Star the repo at "}),s(ht,{url:"https://github.com/Piebald-AI/tweakcc",fallback:!1,children:s(d,{bold:!0,color:"cyan",children:"https://github.com/Piebald-AI/tweakcc"})}),s(d,{bold:!0,children:" if you find this useful!"})," ⭐"]})}),t&&s(m,{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:s(d,{color:t?.type==="success"?"green":t?.type==="error"?"red":t?.type==="info"?"blue":"yellow",children:t?.message})}),s(mt,{items:r,selectedIndex:i,onSelect:a,onSubmit:l=>e(l)})]})}async function on(e){const t=re.join(wn,`prompts-${e}.json`);try{const o=await oe.readFile(t,"utf-8");return JSON.parse(o)}catch{}const n=`https://raw.githubusercontent.com/Piebald-AI/tweakcc/refs/heads/main/data/prompts/prompts-${e}.json`;try{const o=await fetch(n);if(!o.ok){let i;throw o.status===429?i="Rate limit exceeded. GitHub has temporarily blocked requests. Please wait a few minutes and try again.":o.status===404?i=`Prompts file not found for Claude Code v${e}. This version was released within the past day or so and will be supported within a few hours.`:o.status>=500?i=`GitHub server error (${o.status}). Please try again later.`:i=`HTTP ${o.status}: ${o.statusText}`,new Error(i)}const r=await o.json();try{await oe.mkdir(wn,{recursive:!0}),await oe.writeFile(t,JSON.stringify(r,null,2),"utf-8")}catch(i){console.warn(`Failed to write to cache to ${t}: ${i}`)}return r}catch(o){if(o instanceof Error){if(o.message.includes("Rate limit")||o.message.includes("not found")||o.message.includes("server error")||o.message.includes("HTTP"))throw o;const r=`Failed to download prompts for version ${e}: ${o.message}`;throw new Error(r)}throw o}}const St="modulepreload",vt=function(e){return"/"+e},Sn={},$t=function(t,n,o){let r=Promise.resolve();if(n&&n.length>0){let c=function(h){return Promise.all(h.map(f=>Promise.resolve(f).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};const a=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),u=l?.nonce||l?.getAttribute("nonce");r=c(n.map(h=>{if(h=vt(h,o),h in Sn)return;Sn[h]=!0;const f=h.endsWith(".css"),y=f?'[rel="stylesheet"]':"";if(!!o)for(let b=a.length-1;b>=0;b--){const x=a[b];if(x.href===h&&(!f||x.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${h}"]${y}`))return;const p=document.createElement("link");if(p.rel=f?"stylesheet":St,f||(p.as="script"),p.crossOrigin="",p.href=h,u&&p.setAttribute("nonce",u),document.head.appendChild(p),f)return new Promise((b,x)=>{p.addEventListener("load",b),p.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${h}`)))})}))}function i(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return r.then(a=>{for(const l of a||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},Pn=re.join(ce,"systemPromptOriginalHashes.json"),Ln=re.join(ce,"systemPromptAppliedHashes.json"),Dn=(e,t)=>`${e}-${t}`,We=e=>An.createHash("md5").update(e.trim(),"utf8").digest("hex"),Rn=async()=>{try{const e=await oe.readFile(Pn,"utf8");return JSON.parse(e)}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return{};throw e}},_t=async e=>{await oe.mkdir(ce,{recursive:!0});const t={},n=Object.keys(e).sort();for(const o of n)t[o]=e[o];await oe.writeFile(Pn,JSON.stringify(t,null,2),"utf8")},It=async e=>{const t=await Rn();let n=0;for(const o of e.prompts){const r=Dn(o.id,o.version);if(!t[r]){const i=Ve(o.pieces,o.identifiers,o.identifierMap),a=We(i);t[r]=a,n++}}return await _t(t),n},Ct=async(e,t)=>{const n=await Rn(),o=Dn(e,t);return n[o]},rn=async()=>{try{const e=await oe.readFile(Ln,"utf8");return JSON.parse(e)}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return{};throw e}},Fn=async e=>{await oe.mkdir(ce,{recursive:!0});const t={},n=Object.keys(e).sort();for(const o of n)t[o]=e[o];await oe.writeFile(Ln,JSON.stringify(t,null,2),"utf8")},Et=async(e,t)=>{const n=await rn();n[e]=t,await Fn(n)},kt=async()=>{const e=await rn(),t={};for(const n of Object.keys(e))t[n]=null;await Fn(t)},Tt=async e=>{try{const t=await rn();if(Object.keys(t).length===0)return!1;const o=(await oe.readdir(e)).filter(r=>r.endsWith(".md"));for(const r of o){const i=r.replace(".md",""),a=t[i];if(a===void 0||a===null)continue;const l=re.join(e,r),u=await oe.readFile(l,"utf8"),h=(await $t(()=>import("gray-matter"),[])).default(u,{delimiters:["<!--","-->"]});if(We(h.content)!==a)return!0}return!1}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return!1;throw t}},Vn=e=>{const t=Ge(e,{delimiters:["<!--","-->"]}),{name:n,description:o,ccVersion:r,variables:i}=t.data;let a=0;const l=e.indexOf(t.content);return l>=0&&(a=e.slice(0,l).split(`
|
|
3
|
+
`).length-1),{name:n||"",description:o||"",ccVersion:r||"",variables:i||[],content:t.content.trim(),contentLineOffset:a}},vn=(e,t)=>{const n=t||Ve(e.pieces,e.identifiers,e.identifierMap),o=Object.keys(e.identifierMap).length>0?[...new Set(Object.values(e.identifierMap))]:void 0,r={name:e.name,description:e.description,ccVersion:e.version};return o&&o.length>0&&(r.variables=o),Ge.stringify(n,r,{delimiters:["<!--","-->"]})},Ve=(e,t,n)=>{let o="";for(let r=0;r<e.length;r++)if(o+=e[r],r<t.length){const i=t[r],a=n[String(i)]||`UNKNOWN_${i}`;o+=a}return o},Mt=(e,t)=>{const n=e.split(".").map(Number),o=t.split(".").map(Number);for(let r=0;r<Math.max(n.length,o.length);r++){const i=n[r]||0,a=o[r]||0;if(i<a)return-1;if(i>a)return 1}return 0},Be=e=>re.join(Se,`${e}.md`),Nt=async e=>{try{return await oe.access(Be(e)),!0}catch{return!1}},Ot=async e=>{const t=Be(e),n=await oe.readFile(t,"utf-8");return Vn(n)},nn=async(e,t)=>{const n=Be(e);await oe.writeFile(n,t,"utf-8")},Bt=async(e,t)=>{const n=Be(e),o=await oe.readFile(n,"utf-8"),r=Ge(o,{delimiters:["<!--","-->"]}),i=Object.keys(t).length>0?[...new Set(Object.values(t))]:void 0,a={name:r.data.name,description:r.data.description,ccVersion:r.data.ccVersion};i&&i.length>0&&(a.variables=i);const l=Ge.stringify(r.content,a,{delimiters:["<!--","-->"]});await nn(e,l)},At=(e,t)=>{const n=b=>b.split(/(\s+)/),o=n(e),r=n(t),i=o.length,a=r.length,l=Array(i+1).fill(0).map(()=>Array(a+1).fill(0));for(let b=1;b<=i;b++)for(let x=1;x<=a;x++)o[b-1]===r[x-1]?l[b][x]=l[b-1][x-1]+1:l[b][x]=Math.max(l[b-1][x],l[b][x-1]);const u=Array(i).fill(!1),c=Array(a).fill(!1);let h=i,f=a;for(;h>0||f>0;)h>0&&f>0&&o[h-1]===r[f-1]?(h--,f--):f>0&&(h===0||l[h][f-1]>=l[h-1][f])?(c[f-1]=!0,f--):h>0&&(u[h-1]=!0,h--);const y=b=>b.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");let w="";for(let b=0;b<o.length;b++){const x=y(o[b]);w+=u[b]?`<mark>${x}</mark>`:x}let p="";for(let b=0;b<r.length;b++){const x=y(r[b]);p+=c[b]?`<mark>${x}</mark>`:x}return{oldHtml:w,newHtml:p}},$n=(e,t)=>{const n=e.length,o=t.length,r=Array(n+1).fill(0).map(()=>Array(o+1).fill(0));for(let c=1;c<=n;c++)for(let h=1;h<=o;h++)e[c-1]===t[h-1]?r[c][h]=r[c-1][h-1]+1:r[c][h]=Math.max(r[c-1][h],r[c][h-1]);const i=[];let a=n,l=o;const u=[];for(;a>0||l>0;)a>0&&l>0&&e[a-1]===t[l-1]?(u.unshift({type:"unchanged",line:e[a-1],oldLineNo:a,newLineNo:l}),a--,l--):l>0&&(a===0||r[a][l-1]>=r[a-1][l])?(u.unshift({type:"added",line:t[l-1],newLineNo:l}),l--):a>0&&(u.unshift({type:"removed",line:e[a-1],oldLineNo:a}),a--);for(let c=0;c<u.length;c++){const h=u[c],f=u[c+1];if(h.type==="removed"&&f?.type==="added"){const y=At(h.line,f.line);i.push({type:"modified",line:h.line,oldLineNo:h.oldLineNo,newLineNo:f.newLineNo,oldHtml:y.oldHtml,newHtml:y.newHtml}),c++}else i.push(h)}return i},Pt=async(e,t,n,o,r,i,a,l)=>{const u=n.split(`
|
|
4
|
+
`),c=o.split(`
|
|
5
|
+
`),h=r.split(`
|
|
6
|
+
`),f=$=>$.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),y=$n(u,c),w=$n(u,h);let p="";for(const $ of y){const k=f($.line);if($.type==="modified"){const D=$.oldLineNo?String($.oldLineNo).padStart(4," "):" ",N=$.newLineNo?String($.newLineNo).padStart(4," "):" ";p+=`<div class="line removed"><span class="line-num">${D}</span><span class="prefix">- </span>${$.oldHtml}</div>
|
|
7
|
+
`,p+=`<div class="line added"><span class="line-num">${N}</span><span class="prefix">+ </span>${$.newHtml}</div>
|
|
8
|
+
`}else if($.type==="removed"){const D=$.oldLineNo?String($.oldLineNo).padStart(4," "):" ";p+=`<div class="line removed"><span class="line-num">${D}</span><span class="prefix">- </span>${k}</div>
|
|
9
|
+
`}else if($.type==="added"){const D=$.newLineNo?String($.newLineNo).padStart(4," "):" ";p+=`<div class="line added"><span class="line-num">${D}</span><span class="prefix">+ </span>${k}</div>
|
|
10
|
+
`}else{const D=$.oldLineNo?String($.oldLineNo).padStart(4," "):" ",N=$.newLineNo?String($.newLineNo).padStart(4," "):" ";p+=`<div class="line unchanged"><span class="line-num">${D} ${N}</span><span class="prefix"> </span>${k}</div>
|
|
11
|
+
`}}let b="";for(const $ of w){const k=f($.line);if($.type==="modified"){const D=$.oldLineNo?String($.oldLineNo).padStart(4," "):" ",N=$.newLineNo?String($.newLineNo).padStart(4," "):" ";b+=`<div class="line removed"><span class="line-num">${D}</span><span class="prefix">- </span>${$.oldHtml}</div>
|
|
12
|
+
`,b+=`<div class="line added"><span class="line-num">${N}</span><span class="prefix">+ </span>${$.newHtml}</div>
|
|
13
|
+
`}else if($.type==="removed"){const D=$.oldLineNo?String($.oldLineNo).padStart(4," "):" ";b+=`<div class="line removed"><span class="line-num">${D}</span><span class="prefix">- </span>${k}</div>
|
|
14
|
+
`}else if($.type==="added"){const D=$.newLineNo?String($.newLineNo).padStart(4," "):" ";b+=`<div class="line added"><span class="line-num">${D}</span><span class="prefix">+ </span>${k}</div>
|
|
15
|
+
`}else{const D=$.oldLineNo?String($.oldLineNo).padStart(4," "):" ",N=$.newLineNo?String($.newLineNo).padStart(4," "):" ";b+=`<div class="line unchanged"><span class="line-num">${D} ${N}</span><span class="prefix"> </span>${k}</div>
|
|
15
16
|
`}}const x=`<!DOCTYPE html>
|
|
16
17
|
<html>
|
|
17
18
|
<head>
|
|
@@ -169,28 +170,31 @@ ${p} </div>
|
|
|
169
170
|
<div class="diff-container">
|
|
170
171
|
<div class="diff-header">Upstream Changes (v${f(i)} → v${f(a)})</div>
|
|
171
172
|
<div class="diff-content">
|
|
172
|
-
${
|
|
173
|
+
${b} </div>
|
|
173
174
|
</div>
|
|
174
175
|
</div>
|
|
175
176
|
</body>
|
|
176
|
-
</html>`,
|
|
177
|
+
</html>`,E=re.join(Se,`${e}.diff.html`);return await oe.writeFile(E,x,"utf-8"),E},Lt=async e=>{const t={id:e.id,name:e.name,description:e.description,action:"skipped",newVersion:e.version};if(!await Nt(e.id)){const r=vn(e);return await nn(e.id,r),t.action="created",t}const o=await Ot(e.id);if(t.oldVersion=o.ccVersion,await Bt(e.id,e.identifierMap),o.ccVersion&&e.version){const r=Mt(o.ccVersion,e.version);if(r===0)return t.action="skipped",t;if(r!=0){const i=await Ct(e.id,o.ccVersion),a=We(o.content);if(!i||i!==a){t.action="conflict";let u=o.content;try{const w=(await on(o.ccVersion)).prompts.find(p=>p.id===e.id);w&&(u=Ve(w.pieces,w.identifiers,w.identifierMap))}catch{console.log(j.yellow(`Warning: Could not fetch old version ${o.ccVersion} for comparison. Using current file as baseline.`))}const c=Ve(e.pieces,e.identifiers,e.identifierMap),h=Be(e.id),f=await Pt(e.id,e.name,u,o.content,c,o.ccVersion,e.version,h);t.diffHtmlPath=f}else{const u=vn(e);await nn(e.id,u),t.action="updated"}}}return t},Dt=async e=>{const t={ccVersion:e,results:[]},n=await on(e);await It(n),await oe.mkdir(Se,{recursive:!0});for(const o of n.prompts)try{const r=await Lt(o);t.results.push(r)}catch(r){throw console.log(j.red(`Failed to sync prompt ${o.id}:`)),r}return t};let ze=null,tn=null;const _n=async e=>{try{return ze=await on(e),tn=e,{success:!0}}catch(t){return ze=null,tn=null,t instanceof Error?{success:!1,errorMessage:t.message}:{success:!1,errorMessage:"Unknown error occurred while downloading system prompts"}}},Rt=e=>e.replace(/[^\x00-\x7F]/g,t=>{const o=`\\\\u${t.charCodeAt(0).toString(16).padStart(4,"0")}`;return`(?:${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}|${o})`}),Ft=e=>e.replace(/[^\x00-\x7F]/g,t=>`\\u${t.charCodeAt(0).toString(16).padStart(4,"0")}`),Vt=(e,t)=>{let n="";for(let o=0;o<e.length;o++){const i=e[o].replace(/<<CCVERSION>>/g,t).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=Rt(i);n+=a,o<e.length-1&&(n+="([\\w$]+)")}return n},jt=e=>{const t=new Map;let n=0,o=1,r=1;for(let i=0;i<e.length;i++,r++){const a=e[i];if(a===`
|
|
178
|
+
`){o++,r=0;continue}const l=e[i+1];if(a==="$"&&l==="{"){n++,i++,r++;continue}if(n){a==="{"?n++:a==="}"&&n--;continue}if(a==="`"&&e[i-1]!=="\\"){const u=t.get(o)??[];u.push(r),t.set(o,u)}}return t},Ut=(e,t,n,o)=>{const r=[],i=String(t),a=i.length,l=" ".repeat(a),u=o[0],c=o[o.length-1],h=30,f=30,y=u-1,w=n.length-c;let p=n,b=o,x="",E="",$=0;if(y>h||w>f){let C=0,G=n.length,Y=0;if(y>h){const Q=y-h;C=Q,Y=-Q;const J=`[${Q} chars] ...`;x=j.dim(J),$=J.length}if(w>f){const Q=w-f;G=n.length-Q,E=j.dim(`... [${Q} chars]`)}p=n.substring(C,G),b=o.map(Q=>Q+Y)}r.push(`${j.red.bold("error")}${j.bold(": system prompt file contains unescaped backtick")}`),r.push(`${j.blue.bold(" ".repeat(a)+" -->")} ${e}:${t}:${u}`),r.push(`${l} ${j.blue.bold("|")}`);const k=x+p+E;r.push(`${j.blue.bold(i)} ${j.blue.bold("|")} ${k}`);const D=$+b[0]-1,N=" ".repeat(D)+"^ unescaped backtick";r.push(`${l} ${j.blue.bold("|")} ${j.red.bold(N)}`),r.push(`${l} ${j.blue.bold("|")}`),r.push(`${j.cyan.bold("help")}: add \`\\\` before the backtick to escape it`),r.push(`${l} ${j.blue.bold("|")}`);const F=[];let K=0;for(const C of b)F.push(p.substring(K,C-1)),F.push(j.green("\\")+"`"),K=C;F.push(p.substring(K));const U=x+F.join("")+E;r.push(`${j.blue.bold(i)} ${j.blue.bold("|")} ${U}`);let O="",T=0;for(let C=0;C<b.length;C++){const G=b[C],Y=$+G-1+T;O=O.padEnd(Y," ")+"+",T++}return r.push(`${l} ${j.blue.bold("|")} ${j.green(O)}`),r.join(`
|
|
179
|
+
`)},Ht=(e,t,n,o,r,i=!1)=>{const a={};for(let c=0;c<o.length;c++){const h=o[c],f=String(t[c]),y=n[f];y&&(a[y]=h)}let l=e;const u=Object.entries(a).sort((c,h)=>h[0].length-c[0].length);for(const[c,h]of u){const f=new RegExp(`\\b${c}\\b`,"g");l=l.replace(f,h)}return l=l.replace(/<<CCVERSION>>/g,r),i&&(l=Ft(l)),l},Gt=async(e,t=!1)=>{if(!ze||tn!==e)return[];const n=ze,o=[];for(const r of n.prompts){const i=Vt(r.pieces,e),a=re.join(Se,`${r.id}.md`);let l;try{l=await oe.readFile(a,"utf8")}catch(h){console.error(`Failed to read markdown file ${a}:`,h);continue}const u=Vn(l),c=h=>{const f=h.slice(1);return Ht(u.content,r.identifiers,r.identifierMap,f,e,t)};o.push({promptId:r.id,prompt:u,regex:i,getInterpolatedContent:c,pieces:r.pieces,identifiers:r.identifiers,identifierMap:r.identifierMap})}return o},zt=e=>{const t=e.results.filter(i=>i.action==="created"),n=e.results.filter(i=>i.action==="updated"),o=e.results.filter(i=>i.action==="conflict"),r=e.results.filter(i=>i.action==="skipped");if((t.length>0||n.length>0||o.length>0)&&r.length>0&&(console.log(j.dim(`Skipped ${r.length} up-to-date file(s)`)),console.log()),t.length>0){console.log(j.bold.green(`Created ${t.length} new prompt file(s):`));for(const i of t)console.log(j.green(` ${Se}/${i.id}.md`)),console.log(j.green.dim(` ${i.description}`));console.log()}if(n.length>0){console.log(j.bold.blue(`Updated ${n.length} system prompt file(s):`));for(const i of n)i.oldVersion?console.log(j.blue(` ${i.id}.md (${i.oldVersion} → ${i.newVersion})`)):console.log(j.blue(` ${i.id}.md (→ ${i.newVersion})`));console.log()}if(o.length>0){console.log(j.bold.yellow(`WARNING: Conflicts detected for ${o.length} system prompt file(s)`));for(const i of o)console.log(j.yellow(` ${i.id}.md (${i.oldVersion} → ${i.newVersion})`)),console.log(j.yellow(` Open the diff in your browser: ${i.diffHtmlPath}`));console.log()}if(t.length>0&&(console.log(j.green.bold("New prompt files have been created; either more are now supported by tweakcc or Anthropic has added new ones.")),console.log(j.green(`You can now customize the markdown files at ${Se} in a text editor.`)),console.log(j.green('Then run tweakcc and select "apply" or use tweakcc --apply to update your system prompts')),console.log()),o.length>0){console.log(),console.log("Review conflicts:"),console.log(" 1. Open the diff HTML files in your browser"),console.log(" 2. Verify your customizations are still appropriate"),console.log(" 3. Update your markdown files if needed"),console.log(j.bold.cyan(" 4. Important: Update the ccVersion in your markdown files to the latest version of each prompt:"));for(const i of o)console.log(j.yellow(` ${i.id}.md → `)+j.bold.magenta(i.newVersion));console.log(" 5. Delete the diff HTML files"),console.log()}},le=Buffer.from(`
|
|
177
180
|
---- Bun! ----
|
|
178
|
-
`),Ie=32,
|
|
179
|
-
Please close all Claude instances and try again.`):i}}function Wn(e){const t=Buffer.allocUnsafe(4+e.length);return t.writeUInt32LE(e.length,0),e.copy(t,4),t}function
|
|
180
|
-
`)[0].trim();if(
|
|
181
|
+
`),Ie=32,Yt=8,Ye=4*Yt+4;function ve(e,t){return e.subarray(t.offset,t.offset+t.length)}function Te(e,t){return{offset:e.readUInt32LE(t),length:e.readUInt32LE(t+4)}}function jn(e){return e.endsWith("/claude")||e==="claude"||e.endsWith("/claude.exe")||e==="claude.exe"}function Un(e,t,n){const o=ve(e,t.modulesPtr),r=Math.floor(o.length/Ye);for(let i=0;i<r;i++){const a=i*Ye,l=Wt(o,a),u=ve(e,l.name).toString("utf-8"),c=n(l,u,i);if(c!==void 0)return c}}function Hn(e){let t=0;const n=e.readBigUInt64LE(t);t+=8;const o=Te(e,t);t+=8;const r=e.readUInt32LE(t);t+=4;const i=Te(e,t);return{byteCount:n,modulesPtr:o,entryPointId:r,compileExecArgvPtr:i}}function Wt(e,t){let n=t;const o=Te(e,n);n+=8;const r=Te(e,n);n+=8;const i=Te(e,n);n+=8;const a=Te(e,n);n+=8;const l=e.readUInt8(n);n+=1;const u=e.readUInt8(n);n+=1;const c=e.readUInt8(n);n+=1;const h=e.readUInt8(n);return{name:o,contents:r,sourcemap:i,bytecode:a,encoding:l,loader:u,moduleFormat:c,side:h}}function Jt(e){if(e.length<Ie+le.length)throw new Error("BUN data is too small to contain trailer and offsets");const t=e.length-le.length,n=e.subarray(t);if(M()&&(console.log(`parseBunDataBlob: Expected trailer: ${le.toString("hex")}`),console.log(`parseBunDataBlob: Got trailer: ${n.toString("hex")}`)),!n.equals(le))throw M()&&(console.log(`Expected: ${le.toString("hex")}`),console.log(`Got: ${n.toString("hex")}`)),new Error("BUN trailer bytes do not match trailer");const o=e.length-Ie-le.length,r=e.subarray(o,o+Ie);return{bunOffsets:Hn(r),bunData:e}}function Gn(e){if(e.length<4)throw new Error("Section data too small");M()&&console.log(`extractBunDataFromSection: sectionData.length=${e.length}`);const t=e.readUInt32LE(0);M()&&console.log(`extractBunDataFromSection: bunDataSize from header=${t}`);const n=e.subarray(4,4+t);M()&&console.log(`extractBunDataFromSection: bunDataContent.length=${n.length}`);const{bunOffsets:o,bunData:r}=Jt(n);return{bunOffsets:o,bunData:r}}function qt(e){if(!e.hasOverlay)throw new Error("ELF binary has no overlay data");const t=e.overlay;if(M()&&console.log(`extractBunDataFromELFOverlay: Overlay size=${t.length} bytes`),t.length<le.length+8+Ie)throw new Error("ELF overlay data is too small");const n=t.readBigUInt64LE(t.length-8);if(M()&&console.log(`extractBunDataFromELFOverlay: Total byte count from tail=${n}`),n<4096n||n>2n**32n-1n)throw new Error(`ELF total byte count is out of range: ${n}`);const o=t.length-8-le.length,r=t.subarray(o,t.length-8);if(M()&&(console.log(`extractBunDataFromELFOverlay: Expected trailer: ${le.toString("hex")}`),console.log(`extractBunDataFromELFOverlay: Got trailer: ${r.toString("hex")}`)),!r.equals(le))throw new Error("BUN trailer bytes do not match trailer");const i=t.length-8-le.length-Ie,a=t.subarray(i,t.length-8-le.length),l=Hn(a);M()&&console.log(`extractBunDataFromELFOverlay: Offsets.byteCount=${l.byteCount}`);const u=typeof l.byteCount=="bigint"?l.byteCount:BigInt(l.byteCount);if(u>=n)throw new Error("ELF total byte count is out of range");const c=8+le.length+Ie,h=t.length-c-Number(u),f=t.subarray(h,t.length-c);M()&&console.log(`extractBunDataFromELFOverlay: Extracted ${f.length} bytes of data`);const y=Buffer.concat([f,a,r]);return{bunOffsets:l,bunData:y}}function Kt(e){const t=e.getSegment("__BUN");if(!t)throw new Error("__BUN segment not found");const n=t.getSection("__bun");if(!n)throw new Error("__bun section not found");return Gn(n.content)}function Xt(e){const t=e.sections().find(n=>n.name===".bun");if(!t)throw new Error(".bun section not found");return Gn(t.content)}function zn(e){switch(M()&&console.log(`getBunData: Binary format detected as ${e.format}`),e.format){case"MachO":return Kt(e);case"PE":return Xt(e);case"ELF":return qt(e);default:throw new Error(`Unsupported binary format: ${e.format}`)}}function Yn(e){try{Fe.logging.disable();const t=Fe.parse(e),{bunOffsets:n,bunData:o}=zn(t);M()&&console.log(`extractClaudeJsFromNativeInstallation: Got bunData, size=${o.length} bytes`);const r=Un(o,n,(i,a,l)=>{if(M()&&console.log(`extractClaudeJsFromNativeInstallation: Module ${l}: ${a}`),!jn(a))return;const u=ve(o,i.contents);return M()&&console.log(`extractClaudeJsFromNativeInstallation: Found claude module, contents length=${u.length}`),u.length>0?u:void 0});return r||(M()&&console.log("extractClaudeJsFromNativeInstallation: claude module not found in any module"),null)}catch(t){return M()&&console.log("extractClaudeJsFromNativeInstallation: Error during extraction:",t),null}}function Zt(e,t,n){const o=[],r=[];Un(e,t,(k,D)=>{const N=ve(e,k.name);let F;n&&jn(D)?F=n:F=ve(e,k.contents);const K=ve(e,k.sourcemap),U=ve(e,k.bytecode);r.push({name:N,contents:F,sourcemap:K,bytecode:U,encoding:k.encoding,loader:k.loader,moduleFormat:k.moduleFormat,side:k.side}),o.push(N,F,K,U)});let i=0;const a=[];for(const k of o)a.push({offset:i,length:k.length}),i+=k.length+1;const l=i,u=r.length*Ye;i+=u;const c=ve(e,t.compileExecArgvPtr),h=i,f=c.length;i+=f+1;const y=i;i+=Ie;const w=i;i+=le.length;const p=Buffer.allocUnsafe(i);p.fill(0);let b=0;for(const{offset:k,length:D}of a)D>0&&o[b].copy(p,k,0,D),p[k+D]=0,b++;f>0&&(c.copy(p,h,0,f),p[h+f]=0);for(let k=0;k<r.length;k++){const D=r[k],N=k*4,F={name:{offset:a[N].offset,length:a[N].length},contents:{offset:a[N+1].offset,length:a[N+1].length},sourcemap:{offset:a[N+2].offset,length:a[N+2].length},bytecode:{offset:a[N+3].offset,length:a[N+3].length},encoding:D.encoding,loader:D.loader,moduleFormat:D.moduleFormat,side:D.side};let U=l+k*Ye;p.writeUInt32LE(F.name.offset,U),p.writeUInt32LE(F.name.length,U+4),U+=8,p.writeUInt32LE(F.contents.offset,U),p.writeUInt32LE(F.contents.length,U+4),U+=8,p.writeUInt32LE(F.sourcemap.offset,U),p.writeUInt32LE(F.sourcemap.length,U+4),U+=8,p.writeUInt32LE(F.bytecode.offset,U),p.writeUInt32LE(F.bytecode.length,U+4),U+=8,p.writeUInt8(F.encoding,U),p.writeUInt8(F.loader,U+1),p.writeUInt8(F.moduleFormat,U+2),p.writeUInt8(F.side,U+3)}const x={byteCount:y,modulesPtr:{offset:l,length:u},entryPointId:t.entryPointId,compileExecArgvPtr:{offset:h,length:f}};let E=y;const $=typeof x.byteCount=="bigint"?x.byteCount:BigInt(x.byteCount);return p.writeBigUInt64LE($,E),E+=8,p.writeUInt32LE(x.modulesPtr.offset,E),p.writeUInt32LE(x.modulesPtr.length,E+4),E+=8,p.writeUInt32LE(x.entryPointId,E),E+=4,p.writeUInt32LE(x.compileExecArgvPtr.offset,E),p.writeUInt32LE(x.compileExecArgvPtr.length,E+4),le.copy(p,w),p}function sn(e,t,n,o=!0){const r=t+".tmp";if(e.write(r),o){const i=Le.statSync(n);Le.chmodSync(r,i.mode)}try{Le.renameSync(r,t)}catch(i){try{Le.existsSync(r)&&Le.unlinkSync(r)}catch{}throw i instanceof Error&&"code"in i&&(i.code==="ETXTBSY"||i.code==="EBUSY"||i.code==="EPERM")?new Error(`Cannot update the Claude executable while it is running.
|
|
182
|
+
Please close all Claude instances and try again.`):i}}function Wn(e){const t=Buffer.allocUnsafe(4+e.length);return t.writeUInt32LE(e.length,0),e.copy(t,4),t}function Qt(e,t,n,o){try{M()&&console.log(`repackMachO: Has code signature: ${e.hasCodeSignature}`),e.hasCodeSignature&&(M()&&console.log("repackMachO: Removing code signature..."),e.removeSignature());const r=e.getSegment("__BUN");if(!r)throw new Error("__BUN segment not found");const i=r.getSection("__bun");if(!i)throw new Error("__bun section not found");const a=Wn(n);M()&&(console.log(`repackMachO: Original section size: ${i.size}`),console.log(`repackMachO: Original segment fileSize: ${r.fileSize}`),console.log(`repackMachO: Original segment virtualSize: ${r.virtualSize}`),console.log(`repackMachO: New data size: ${a.length}`));const l=a.length-Number(i.size);if(l>0){const u=e.header.cpuType===Fe.MachO.Header.CPU_TYPE.ARM64,c=u?16384:4096,h=Math.ceil(l/c)*c;M()&&(console.log(`repackMachO: CPU type: ${u?"ARM64":"x86_64"}`),console.log(`repackMachO: Page size: ${c} bytes`),console.log(`repackMachO: Need to expand by ${l} bytes`),console.log(`repackMachO: Rounding up to page-aligned: ${h} bytes`));const f=e.extendSegment(r,h);if(M()&&console.log(`repackMachO: extendSegment returned: ${f}`),!f)throw new Error("Failed to extend __BUN segment");M()&&(console.log(`repackMachO: Section size after extend: ${i.size}`),console.log(`repackMachO: Segment fileSize after extend: ${r.fileSize}`),console.log(`repackMachO: Segment virtualSize after extend: ${r.virtualSize}`))}i.content=a,i.size=BigInt(a.length),M()&&(console.log(`repackMachO: Final section size: ${i.size}`),console.log(`repackMachO: Writing modified binary to ${o}...`)),sn(e,o,t);try{M()&&console.log("repackMachO: Re-signing binary with ad-hoc signature..."),Bn(`codesign -s - -f "${o}"`,{stdio:M()?"inherit":"ignore"}),M()&&console.log("repackMachO: Code signing completed successfully")}catch(u){console.warn("Warning: Failed to re-sign binary. The binary may not run correctly on macOS:",u)}M()&&console.log("repackMachO: Write completed successfully")}catch(r){throw console.error("repackMachO failed:",r),r}}function eo(e,t,n,o){try{const r=e.sections().find(a=>a.name===".bun");if(!r)throw new Error(".bun section not found");const i=Wn(n);M()&&(console.log(`repackPE: Original section size: ${r.size}, virtual size: ${r.virtualSize}`),console.log(`repackPE: New data size: ${i.length}`)),r.content=i,r.virtualSize=BigInt(i.length),r.size=BigInt(i.length),M()&&console.log(`repackPE: Writing modified binary to ${o}...`),sn(e,o,t,!1),M()&&console.log("repackPE: Write completed successfully")}catch(r){throw console.error("repackPE failed:",r),r}}function no(e,t,n,o){try{const r=Buffer.allocUnsafe(n.length+8);n.copy(r,0),r.writeBigUInt64LE(BigInt(n.length),n.length),M()&&console.log(`repackELF: Setting overlay data (${r.length} bytes)`),e.overlay=r,M()&&console.log(`repackELF: Writing modified binary to ${o}...`),sn(e,o,t),M()&&console.log("repackELF: Write completed successfully")}catch(r){throw console.error("repackELF failed:",r),r}}function to(e,t,n){Fe.logging.disable();const o=Fe.parse(e),{bunOffsets:r,bunData:i}=zn(o),a=Zt(i,r,t);switch(o.format){case"MachO":Qt(o,e,a,n);break;case"PE":eo(o,e,a,n);break;case"ELF":no(o,e,a,n);break;default:throw new Error(`Unsupported binary format: ${o.format}`)}}const ln=async()=>{await ie.mkdir(ce,{recursive:!0}),await ie.mkdir(Se,{recursive:!0});const e=On.join(ce,".gitignore");try{await ie.stat(e)}catch(t){t instanceof Error&&"code"in t&&t.code==="ENOENT"&&await ie.writeFile(e,[".DS_Store","prompt-data-cache","cli.js.backup","native-binary.backup","native-claudejs-orig.js","native-claudejs-patched.js","systemPromptAppliedHashes.json","systemPromptOriginalHashes.json","system-prompts"].join(bn)+bn)}};let Re={settings:ee,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null};const an=async()=>{const e={ccVersion:"",ccInstallationDir:null,lastModified:new Date().toISOString(),changesApplied:!0,settings:ee};try{M()&&console.log(`Reading config at ${ae}`);const t=await ie.readFile(ae,"utf8"),n={...e,...JSON.parse(t)},o=n?.settings?.thinkingVerbs;o?.punctuation&&(o.format="{}"+o.punctuation,delete o.punctuation),n.settings.inputBox||(n.settings.inputBox=ee.inputBox),n.settings.toolsets||(n.settings.toolsets=ee.toolsets),Object.hasOwn(n.settings,"defaultToolset")||(n.settings.defaultToolset=ee.defaultToolset);for(const i of ee.themes){const a=n?.settings?.themes.find(l=>l.id===i.id||l.name===i.name);if(a){for(const[l,u]of Object.entries(i))l!=="colors"&&!Object.hasOwn(a,l)&&(a[l]=u);a.colors||(a.colors={});for(const[l,u]of Object.entries(i.colors))Object.hasOwn(a.colors,l)||(a.colors[l]=u)}}for(const i of n?.settings?.themes||[]){if(ee.themes.some(u=>u.id===i.id||u.name===i.name))continue;const l=ee.themes[0];i.colors||(i.colors={});for(const[u,c]of Object.entries(l.colors))Object.hasOwn(i.colors,u)||(i.colors[u]=c)}return n?.settings?.userMessageDisplay||(n.settings=n.settings||ee,n.settings.userMessageDisplay=ee.userMessageDisplay),delete n.settings.launchText,await Tt(Se)&&(n.changesApplied=!1),Re=n,n}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return e;throw t}},je=async e=>(M()&&console.log(`Updating config at ${ae}`),e(Re),Re.lastModified=new Date().toISOString(),await oo(Re),Re),oo=async e=>{try{e.lastModified=new Date().toISOString(),await ln(),await ie.writeFile(ae,JSON.stringify(e,null,2))}catch(t){throw console.error("Error saving config:",t),t}},Jn=async e=>{if(!e.cliPath)return M()&&console.log("restoreClijsFromBackup: Skipping for native installation (no cliPath)"),!1;M()&&console.log(`Restoring cli.js from backup to ${e.cliPath}`);const t=await ie.readFile(Ne);return await fn(e.cliPath,t,"restore"),await kt(),await je(n=>{n.changesApplied=!1}),!0},qn=async e=>{if(!e.nativeInstallationPath)return M()&&console.log("restoreNativeBinaryFromBackup: No native installation path, skipping"),!1;if(!await Oe(ge))return M()&&console.log("restoreNativeBinaryFromBackup: No backup file exists, skipping"),!1;M()&&console.log(`Restoring native binary from backup to ${e.nativeInstallationPath}`);const t=await ie.readFile(ge);return await fn(e.nativeInstallationPath,t,"restore"),!0};async function ro(){try{const t=process.platform==="win32"?"where claude.exe":"which claude";M()&&console.log(`Looking for claude executable using: ${t}`);const o=Bn(t,{encoding:"utf8"}).trim().split(`
|
|
183
|
+
`)[0].trim();if(o&&await Oe(o))try{const r=await ie.realpath(o);return M()&&(r!==o?(console.log(`Found claude executable at: ${o} (symlink)`),console.log(`Resolved to: ${r}`)):console.log(`Found claude executable at: ${o}`)),r}catch(r){return M()&&console.log("Could not resolve symlink, using original path:",r),o}}catch(e){M()&&console.log("Could not find claude executable on PATH:",e)}return null}function Kn(e){const t=/\bVERSION:"(\d+\.\d+\.\d+)"/g,n=new Map;let o;for(;(o=t.exec(e))!==null;){const a=o[1];n.set(a,(n.get(a)||0)+1)}if(n.size===0)return null;let r=0,i;for(const[a,l]of n.entries())M()&&console.log(`Found version ${a} with ${l} occurrences`),l>r&&(r=l,i=a);return M()&&i&&console.log(`Extracted version ${i} (${r} occurrences)`),i||null}async function Oe(e){try{return await ie.stat(e),!0}catch(t){if(t instanceof Error&&"code"in t&&(t.code==="ENOENT"||t.code==="ENOTDIR"))return!1;throw t}}async function io(e){const t=await ie.readFile(e,"utf8"),n=Kn(t);if(!n)throw new Error(`No VERSION strings found in JS file: ${e}`);return n}const so=async e=>{e.ccInstallationDir&&xn.unshift(e.ccInstallationDir);for(const n of xn)try{M()&&console.log(`Searching for Claude Code cli.js file at ${n}`);const o=On.join(n,"cli.js");if(!await Oe(o))continue;M()&&(console.log(`Found Claude Code cli.js file at ${n}; checking hash...`),console.log(`SHA256 hash: ${await Er(o)}`));const r=await io(o);return{cliPath:o,version:r}}catch(o){if(o instanceof Error&&"code"in o&&(o.code==="ENOENT"||o.code==="ENOTDIR"))continue;throw o}M()&&console.log("Could not find cli.js in standard locations, trying native installation method...");const t=await ro();if(M()&&console.log(`findClaudeExecutableOnPath() returned: ${t}`),t){M()&&console.log(`Attempting to extract claude.js from native installation: ${t}`);const n=Yn(t);if(n){const o=n.toString("utf8"),r=Kn(o);return r?(M()&&console.log(`Extracted version ${r} from native installation`),{version:r,nativeInstallationPath:t}):(M()&&console.log("Failed to extract version from native installation"),null)}}return null},In=async e=>{if(!e.cliPath){M()&&console.log("backupClijs: Skipping for native installation (no cliPath)");return}await ln(),M()&&console.log(`Backing up cli.js to ${Ne}`),await ie.copyFile(e.cliPath,Ne),await je(t=>{t.changesApplied=!1,t.ccVersion=e.version})},Cn=async e=>{e.nativeInstallationPath&&(await ln(),M()&&console.log(`Backing up native binary to ${ge}`),await ie.copyFile(e.nativeInstallationPath,ge),await je(t=>{t.changesApplied=!1,t.ccVersion=e.version}))};async function En(){const e=await an(),t=await so(e);if(!t)return null;if(t.version)try{const a=await Dt(t.version);zt(a)}catch{}const n=t.version,o=e.ccVersion;let r=!1;await Oe(Ne)||(M()&&console.log(`startupCheck: ${Ne} not found; backing up cli.js`),await In(t),r=!0);let i=!1;return t.nativeInstallationPath&&!await Oe(ge)&&(M()&&console.log(`startupCheck: ${ge} not found; backing up native binary`),await Cn(t),i=!0),n!==o?(r||(M()&&console.log(`startupCheck: real version (${n}) != backed up version (${o}); backing up cli.js`),await ie.unlink(Ne),await In(t)),t.nativeInstallationPath&&!i&&(M()&&console.log(`startupCheck: real version (${n}) != backed up version (${o}); backing up native binary`),await Oe(ge)&&await ie.unlink(ge),await Cn(t)),{wasUpdated:!0,oldVersion:o,newVersion:n,ccInstInfo:t}):{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:t}}const lo=e=>{const t=[],n=/visibleOptionCount:[\w$]+=(\d+)/g;let o;for(;(o=n.exec(e))!==null;){const r=o.index+o[0].indexOf("=")+1;t.push({startIndex:r,endIndex:r+o[1].length})}return t},ao=(e,t)=>{const n=lo(e);if(n.length===0)return console.error("patch: writeShowMoreItemsInSelectMenus: failed to find locations"),null;const o=n.sort((i,a)=>a.startIndex-i.startIndex);let r=e;for(const i of o){const a=t.toString(),l=r.slice(0,i.startIndex)+a+r.slice(i.endIndex);H(r,l,a,i.startIndex,i.endIndex),r=l}return r};function co(e){const 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;const o=/\[(?:\{label:"(?:Dark|Light).+?",value:".+?"\},?)+\]/,r=/return\{(?:[$\w]+?:"(?:Dark|Light).+?",?)+\}/,i=e.match(o),a=e.match(r);return!i||i.index==null?(console.error("patch: themes: failed to find objArrMatch"),null):!a||a.index==null?(console.error("patch: themes: failed to find objMatch"),null):{switchStatement:{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1].trim()]},objArr:{startIndex:i.index,endIndex:i.index+i[0].length},obj:{startIndex:a.index,endIndex:a.index+a[0].length}}}const uo=(e,t)=>{const n=co(e);if(!n)return null;if(t.length===0)return e;let o=e;const r="return"+JSON.stringify(Object.fromEntries(t.map(l=>[l.id,l.name])));o=o.slice(0,n.obj.startIndex)+r+o.slice(n.obj.endIndex),H(e,o,r,n.obj.startIndex,n.obj.endIndex),e=o;const i=JSON.stringify(t.map(l=>({label:l.name,value:l.id})));o=o.slice(0,n.objArr.startIndex)+i+o.slice(n.objArr.endIndex),H(e,o,i,n.objArr.startIndex,n.objArr.endIndex),e=o;let a=`switch(${n.switchStatement.identifiers?.[0]}){
|
|
181
184
|
`;return t.forEach(l=>{a+=`case"${l.id}":return${JSON.stringify(l.colors)};
|
|
182
185
|
`}),a+=`default:return${JSON.stringify(t[0].colors)};
|
|
183
|
-
}`,r=r.slice(0,n.switchStatement.startIndex)+a+r.slice(n.switchStatement.endIndex),V(e,r,a,n.switchStatement.startIndex,n.switchStatement.endIndex),r},cr=e=>{const t=/function ([$\w]+)\(([$\w]*)\)\{((?:if\([$\w]+\.includes\("\[1m\]"\)\)return 1e6;)?return 200000)\}/,n=e.match(t);return!n||n.index===void 0?(console.error("patch: context limit: failed to find match"),null):n.index+n[0].indexOf("{")+1},dr=e=>{const t=cr(e);if(!t)return null;const n="if(process.env.CLAUDE_CODE_CONTEXT_LIMIT)return Number(process.env.CLAUDE_CODE_CONTEXT_LIMIT);",r=e.slice(0,t)+n+e.slice(t);return V(e,r,n,t,t),r},ur=e=>{const t=e.indexOf('bash:"bashBorder"');if(t===-1)return console.error("patch: input border: failed to find bash pattern"),null;const n=e.slice(t,t+500),r=/borderStyle:"[^"]*"/,o=n.match(r);return!o||o.index===void 0?(console.error("patch: input border: failed to find border style pattern"),null):{startIndex:t+o.index,endIndex:t+o.index+o[0].length}},hr=(e,t)=>{const n=ur(e);if(!n)return null;if(t){const r="borderColor:undefined",o=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return V(e,o,r,n.startIndex,n.endIndex),o}else return e},gr=e=>{const t=/\b[$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},\d+\)/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: spinner no-freeze: failed to find wholeMatch"),null;const r=/if\(![$\w]+\)\{[$\w]+\(\d+\);return\}/,o=n[0].match(r);if(!o||o.index===void 0)return console.error("patch: spinner no-freeze: failed to find freeze condition"),null;const i=n.index+o.index,a=i+o[0].length;return{startIndex:i,endIndex:a}},fr=e=>{const t=gr(e);if(!t)return null;const n=e.slice(0,t.startIndex)+e.slice(t.endIndex);return V(e,n,"",t.startIndex,t.endIndex),n},mr=e=>{const 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;const r=e.slice(n.index,n.index+600),o=/([$\w]+)(=\(([^;]{1,200}?)\)\+"(?:…|\\u2026)")/,i=r.match(o);return!i||i.index==null?(console.error("patch: thinker format: failed to find formatMatch"),null):{startIndex:n.index+i.index+i[1].length,endIndex:n.index+i.index+i[1].length+i[2].length,identifiers:[i[3]]}},pr=(e,t)=>{const n=mr(e);if(!n)return null;const r=n,o=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),i=r.identifiers?.[0],l=`=${"`"+o.replace(/\{\}/g,"${"+i+"}")+"`"}`,u=e.slice(0,r.startIndex)+l+e.slice(r.endIndex);return V(e,u,l,r.startIndex,r.endIndex),u},br=e=>{const 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,identifiers:[n[1]]}},wr=(e,t)=>{const n=br(e);if(!n)return null;const r=n.identifiers?.[0],o=t?`=[...${r},...[...${r}].reverse()]`:`=[...${r}]`,i=e.slice(0,n.startIndex)+o+e.slice(n.endIndex);return V(e,i,o,n.startIndex,n.endIndex),i},xr=e=>{const t=[],n=/\["[·✢*✳✶✻✽]",\s*(?:"[·✢*✳✶✻✽]",?\s*)+\]/g;let r;for(;(r=n.exec(e))!==null;)t.push({startIndex:r.index,endIndex:r.index+r[0].length});return t},yr=(e,t)=>{const n=xr(e);if(n.length===0)return null;const r=JSON.stringify(t),o=n.sort((a,l)=>l.startIndex-a.startIndex);let i=e;for(let a=0;a<o.length;a++){const l=i.slice(0,o[a].startIndex)+r+i.slice(o[a].endIndex);V(i,l,r,o[a].startIndex,o[a].endIndex),i=l}return i},Sr=e=>{const 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;const r=n[0],o=n[1],i=r.lastIndexOf(o),a=n.index+i,l=a+o.length;return{startIndex:a,endIndex:l}},vr=(e,t)=>{const n=Sr(e);if(!n)return null;const r=JSON.stringify(t),o=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return V(e,o,r,n.startIndex,n.endIndex),o},$r=e=>{const 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}},_r=(e,t)=>{const n=$r(e);if(!n)return null;const r=`{flexWrap:"wrap",height:1,width:${t}}`,o=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return V(e,o,r,n.startIndex,n.endIndex),o},Ir=e=>{const t=/[, ]([$\w]+)=\{words:\[(?:"[^"{}()]+ing",)+"[^"{}()]+ing"\]\}/s,n=e.match(t);return!n||n.index==null?(console.error("patch: thinker verbs: failed to find verbsMatch"),null):{startIndex:n.index+1,endIndex:n.index+n[0].length,identifiers:[n[1]]}},Cr=e=>{const 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):{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1]]}},Er=(e,t)=>{const n=Ir(e);if(!n)return null;const r=n,o=r.identifiers?.[0],i=`${o}=${JSON.stringify({words:t})}`,a=e.slice(0,r.startIndex)+i+e.slice(r.endIndex);V(e,a,i,r.startIndex,r.endIndex);const l=Cr(a);if(!l)return null;const u=l,h=`function ${u.identifiers?.[0]}(){return ${o}.words}`,f=a.slice(0,u.startIndex)+h+a.slice(u.endIndex);return V(a,f,h,u.startIndex,u.endIndex),f},kr=e=>{const t=e.indexOf("No content found in user prompt message")-700;if(t===-1)return console.error("patch: userMessageDisplay: failed to find error message"),null;const n=Math.min(e.length,t+700),r=e.slice(t,n),o=/("> "),([$\w]+)/,i=r.match(o);if(!i)return{prefixLocation:null,messageLocation:null};const a=t+r.indexOf(i[1]),l=a+i[1].length,u=l+1,d=u+i[2].length;return{prefixLocation:{startIndex:a,endIndex:l},messageLocation:{startIndex:u,endIndex:d}}},Tr=(e,t,n,r,o=!1,i=!1,a=!1,l=!1,u=!1,d,h,f=!1,v=!1,b=!1,p=!1,w=!1)=>{const x=kr(e);if(!x)return console.error("patch: userMessageDisplay: getUserMessageDisplayLocation returned null"),null;if(!x.prefixLocation)return console.error("patch: userMessageDisplay: failed to find prefix location"),null;if(!x.messageLocation)return console.error("patch: userMessageDisplay: failed to find message location"),null;const C=dn(e);if(!C)return console.error("patch: userMessageDisplay: failed to find chalk variable"),null;const _=[],k=n==="rgb(0,0,0)"&&r==="rgb(0,0,0)",B=!k||(o||i||a||l||u),j=d==="rgb(0,0,0)"&&h==="rgb(0,0,0)",U=!j||(f||v||b||p||w);if(B){const M=Tn(C,k?null:n.match(/\d+/g)?.join(",")||null,k?null:r.match(/\d+/g)?.join(",")||null,o,i,a,l,u);_.push({startIndex:x.prefixLocation.startIndex,endIndex:x.prefixLocation.endIndex,newContent:`${M}("${t}")+" "`})}if(U){const M=Tn(C,j?null:d.match(/\d+/g)?.join(",")||null,j?null:h.match(/\d+/g)?.join(",")||null,f,v,b,p,w);_.push({startIndex:x.messageLocation.startIndex,endIndex:x.messageLocation.endIndex,newContent:e.slice(x.messageLocation.startIndex,x.messageLocation.endIndex).replace(/([$\w]+)/,`${M}($1)`)})}_.sort((M,E)=>E.startIndex-M.startIndex);let A=e;for(const M of _){const E=A;A=A.slice(0,M.startIndex)+M.newContent+A.slice(M.endIndex),V(E,A,M.newContent,M.startIndex,M.endIndex)}return A},Mr=e=>{const t=/createElement\([$\w]+,\{[^}]+spinnerTip[^}]+overrideMessage[^}]+\}/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: verbose: failed to find createElement with spinnerTip and overrideMessage"),null;const r=n[0],o=/verbose:[^,}]+/,i=r.match(o);if(!i||i.index===void 0)return console.error("patch: verbose: failed to find verbose property"),null;const a=n.index+i.index,l=a+i[0].length;return{startIndex:a,endIndex:l}},Nr=e=>{const t=Mr(e);if(!t)return null;const n="verbose:true",r=e.slice(0,t.startIndex)+n+e.slice(t.endIndex);return V(e,r,n,t.startIndex,t.endIndex),r},Br=e=>{const t=/function ([$\w]+)\(\{\s*streamMode:\s*([$\w]+)\s*\}\)\s*\{/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: thinkingVisibility: failed to find banner function pattern"),null;const[r]=n,o=n.index,i=o+r.length;return{startIndex:o,endIndex:i,identifiers:[n[1],n[2]]}},Or=e=>{const t=/(case"thinking":)if\(.+?\)return null;(.+?isTranscriptMode:).+?([},])/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: thinkingVisibility: failed to find thinking visibility pattern"),null;const r=n.index,o=r+n[0].length;return{startIndex:r,endIndex:o,identifiers:[n[1],n[2],n[3]]}},Ar=e=>{const t=Br(e);if(!t)return null;const n="return null;";let r=e.slice(0,t.endIndex)+n+e.slice(t.endIndex);V(e,r,n,t.endIndex,t.endIndex);const o=Or(r);if(!o)return null;const i=`${o.identifiers[0]}${o.identifiers[1]}true${o.identifiers[2]}`;return r=r.slice(0,o.startIndex)+i+r.slice(o.endIndex),V(e,r,i,o.startIndex,o.endIndex),r},Pr=e=>{const n=e.indexOf("}.VERSION} (Claude Code)");return n==-1?(console.error("patch: patchesAppliedIndication: failed to find versionIndex"),null):{startIndex:0,endIndex:n+24}},Dr=e=>{const t=/\b([$\w]+)\.createElement\(([$\w]+),\{bold:!0\},"Claude Code"\)," ",([$\w]+)\.createElement\(([$\w]+),\{dimColor:!0\},"v",[$\w]+\)/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find Claude Code version pattern"),null;const r=n.index+n[0].length;return{startIndex:r,endIndex:r}},Lr=(e,t,n,r,o,i)=>{const a=/alignItems:"center",minHeight:9,?/,l=e.match(a);if(!l||l.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find alignItems pattern for PATCH 4"),null;let u=e.slice(0,l.index)+"minHeight:9,"+e.slice(l.index+l[0].length);const d=Math.max(0,l.index-200),h=u.slice(d,l.index+12+2),f=/\b([$\w]+)\.createElement\(([$\w]+),(?:\w+|\{[^}]+\}),/g,v=Array.from(h.matchAll(f));if(v.length===0)return console.error("patch: patchesAppliedIndication: failed to find createElement for PATCH 4"),null;const b=v[v.length-1],p=d+b.index+b[0].length,w=`${n}.createElement(${o}, null, ${i}.blue.bold(" + tweakcc v${t}")),${n}.createElement(${r},{alignItems:"center",flexDirection:"column"},`,x=u;u=u.slice(0,p)+w+u.slice(p),V(x,u,w,p,p);let C=1,_=p+w.length,k=-1;for(;_<u.length;){const B=u[_];if(B==="(")C++;else if(B===")"){if(C===1){k=_;break}C--}_++}if(k===-1)return console.error("patch: patchesAppliedIndication: failed to find closing paren for PATCH 4"),null;const P=u;return u=u.slice(0,k)+"),"+u.slice(k),V(P,u,"),",k,k),{content:u,closingParenIndex:k+2}},Rr=(e,t,n,r,o,i,a)=>{let l=4,u=t,d=-1;for(;u<e.length;){const p=e[u];if(p==="(")l++;else if(p===")"){if(l===1){d=u;break}l--}u++}if(d===-1)return console.error("patch: patchesAppliedIndication: failed to find insertion point for PATCH 5"),null;const h=[];h.push(`,${n}.createElement(${r}, { flexDirection: "column" },`),h.push(`${n}.createElement(${r}, null, ${n}.createElement(${o}, {color: "success", bold: true}, "┃ "), ${n}.createElement(${o}, {color: "success", bold: true}, "✓ tweakcc patches are applied")),`);for(let p of a)p=p.replace("CHALK_VAR",i),h.push(`${n}.createElement(${r}, null, ${n}.createElement(${o}, {color: "success", bold: true}, "┃ "), ${n}.createElement(${o}, {dimColor: true}, \` * ${p}\`)),`);h.push("),");const f=h.join(""),v=e,b=e.slice(0,d)+f+e.slice(d);return V(v,b,f,d,d),b},Fr=e=>{const t=/\b([$\w]+)\.createElement\(([$\w]+),\{bold:!0\},"Claude Code"\)," ",([$\w]+)\.createElement\(([$\w]+),\{dimColor:!0\},"v",[$\w]+\)/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find Claude Code version pattern for patch 3"),null;const r=Math.max(0,n.index-500),o=e.slice(r,n.index),i=/\}function ([$\w]+)\(/g,a=Array.from(o.matchAll(i));if(a.length===0)return console.error("patch: patchesAppliedIndication: failed to find header component function"),null;const u=a[a.length-1][1],d=new RegExp(`\\b([$\\w]+)\\.createElement\\(${fe(u)},null\\),?`),h=e.match(d);if(!h||h.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find createElement call for header"),null;const f=h.index+h[0].length;return{startIndex:f,endIndex:f}},Vr=(e,t,n,r=!0,o=!0)=>{const i=Pr(e);if(!i)return console.error("patch: patchesAppliedIndication: failed to version output location"),null;const a=`\\n${t} (tweakcc)`;let l=e.slice(0,i.endIndex)+a+e.slice(i.endIndex);V(e,l,a,i.endIndex,i.endIndex);const u=dn(e);if(!u)return console.error("patch: patchesAppliedIndication: failed to find chalk variable"),null;const d=nt(e);if(!d)return console.error("patch: patchesAppliedIndication: failed to find text component"),null;const h=Je(e);if(!h)return console.error("patch: patchesAppliedIndication: failed to find React variable"),null;const f=tt(e);if(!f)return console.error("patch: patchesAppliedIndication: failed to find Box component"),null;if(r){const b=Dr(l);if(!b)return console.error("patch: patchesAppliedIndication: patch 2 failed"),null;const p=`, " ",${h}.createElement(${d}, null, ${u}.blue.bold('+ tweakcc v${t}'))`,w=l;l=l.slice(0,b.startIndex)+p+l.slice(b.endIndex),V(w,l,p,b.startIndex,b.endIndex)}if(o){const b=Fr(l);if(!b)return console.error("patch: patchesAppliedIndication: patch 3 failed"),null;const p=[];p.push(`${h}.createElement(${f}, { flexDirection: "column" },`),p.push(`${h}.createElement(${f}, null, ${h}.createElement(${d}, {color: "success", bold: true}, "┃ "), ${h}.createElement(${d}, {color: "success", bold: true}, "✓ tweakcc patches are applied")),`);for(let C of n)C=C.replace("CHALK_VAR",u),p.push(`${h}.createElement(${f}, null, ${h}.createElement(${d}, {color: "success", bold: true}, "┃ "), ${h}.createElement(${d}, {dimColor: true}, \` * ${C}\`)),`);p.push("),");const w=p.join(`
|
|
184
|
-
`),x=l;l=l.slice(0,
|
|
185
|
-
|
|
186
|
+
}`,o=o.slice(0,n.switchStatement.startIndex)+a+o.slice(n.switchStatement.endIndex),H(e,o,a,n.switchStatement.startIndex,n.switchStatement.endIndex),o},ho=e=>{const t=/function ([$\w]+)\(([$\w]*)\)\{((?:if\([$\w]+\.includes\("\[1m\]"\)\)return 1e6;)?return 200000)\}/,n=e.match(t);return!n||n.index===void 0?(console.error("patch: context limit: failed to find match"),null):n.index+n[0].indexOf("{")+1},go=e=>{const t=ho(e);if(!t)return null;const n="if(process.env.CLAUDE_CODE_CONTEXT_LIMIT)return Number(process.env.CLAUDE_CODE_CONTEXT_LIMIT);",o=e.slice(0,t)+n+e.slice(t);return H(e,o,n,t,t),o},fo=e=>{const t=e.indexOf('bash:"bashBorder"');if(t===-1)return console.error("patch: input border: failed to find bash pattern"),null;const n=e.slice(t,t+500),o=/borderStyle:"[^"]*"/,r=n.match(o);return!r||r.index===void 0?(console.error("patch: input border: failed to find border style pattern"),null):{startIndex:t+r.index,endIndex:t+r.index+r[0].length}},mo=(e,t)=>{const n=fo(e);if(!n)return null;if(t){const o="borderColor:undefined",r=e.slice(0,n.startIndex)+o+e.slice(n.endIndex);return H(e,r,o,n.startIndex,n.endIndex),r}else return e},po=e=>{const t=/\b[$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},\d+\)/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: spinner no-freeze: failed to find wholeMatch"),null;const o=/if\(![$\w]+\)\{[$\w]+\(\d+\);return\}/,r=n[0].match(o);if(!r||r.index===void 0)return console.error("patch: spinner no-freeze: failed to find freeze condition"),null;const i=n.index+r.index,a=i+r[0].length;return{startIndex:i,endIndex:a}},bo=e=>{const t=po(e);if(!t)return null;const n=e.slice(0,t.startIndex)+e.slice(t.endIndex);return H(e,n,"",t.startIndex,t.endIndex),n},wo=e=>{const 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;const o=e.slice(n.index,n.index+600),r=/([$\w]+)(=\(([^;]{1,200}?)\)\+"(?:…|\\u2026)")/,i=o.match(r);return!i||i.index==null?(console.error("patch: thinker format: failed to find formatMatch"),null):{startIndex:n.index+i.index+i[1].length,endIndex:n.index+i.index+i[1].length+i[2].length,identifiers:[i[3]]}},xo=(e,t)=>{const n=wo(e);if(!n)return null;const o=n,r=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),i=o.identifiers?.[0],l=`=${"`"+r.replace(/\{\}/g,"${"+i+"}")+"`"}`,u=e.slice(0,o.startIndex)+l+e.slice(o.endIndex);return H(e,u,l,o.startIndex,o.endIndex),u},yo=e=>{const 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,identifiers:[n[1]]}},So=(e,t)=>{const n=yo(e);if(!n)return null;const o=n.identifiers?.[0],r=t?`=[...${o},...[...${o}].reverse()]`:`=[...${o}]`,i=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return H(e,i,r,n.startIndex,n.endIndex),i},vo=e=>{const t=[],n=/\["[·✢*✳✶✻✽]",\s*(?:"[·✢*✳✶✻✽]",?\s*)+\]/g;let o;for(;(o=n.exec(e))!==null;)t.push({startIndex:o.index,endIndex:o.index+o[0].length});return t},$o=(e,t)=>{const n=vo(e);if(n.length===0)return null;const o=JSON.stringify(t),r=n.sort((a,l)=>l.startIndex-a.startIndex);let i=e;for(let a=0;a<r.length;a++){const l=i.slice(0,r[a].startIndex)+o+i.slice(r[a].endIndex);H(i,l,o,r[a].startIndex,r[a].endIndex),i=l}return i},_o=e=>{const 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;const o=n[0],r=n[1],i=o.lastIndexOf(r),a=n.index+i,l=a+r.length;return{startIndex:a,endIndex:l}},Io=(e,t)=>{const n=_o(e);if(!n)return null;const o=JSON.stringify(t),r=e.slice(0,n.startIndex)+o+e.slice(n.endIndex);return H(e,r,o,n.startIndex,n.endIndex),r},Co=e=>{const 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}},Eo=(e,t)=>{const n=Co(e);if(!n)return null;const o=`{flexWrap:"wrap",height:1,width:${t}}`,r=e.slice(0,n.startIndex)+o+e.slice(n.endIndex);return H(e,r,o,n.startIndex,n.endIndex),r},ko=e=>{const t=/[, ]([$\w]+)=\{words:\[(?:"[^"{}()]+ing",)+"[^"{}()]+ing"\]\}/s,n=e.match(t);return!n||n.index==null?(console.error("patch: thinker verbs: failed to find verbsMatch"),null):{startIndex:n.index+1,endIndex:n.index+n[0].length,identifiers:[n[1]]}},To=e=>{const 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):{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1]]}},Mo=(e,t)=>{const n=ko(e);if(!n)return null;const o=n,r=o.identifiers?.[0],i=`${r}=${JSON.stringify({words:t})}`,a=e.slice(0,o.startIndex)+i+e.slice(o.endIndex);H(e,a,i,o.startIndex,o.endIndex);const l=To(a);if(!l)return null;const u=l,h=`function ${u.identifiers?.[0]}(){return ${r}.words}`,f=a.slice(0,u.startIndex)+h+a.slice(u.endIndex);return H(a,f,h,u.startIndex,u.endIndex),f},No=e=>{const t=e.indexOf("No content found in user prompt message")-700;if(t===-1)return console.error("patch: userMessageDisplay: failed to find error message"),null;const n=Math.min(e.length,t+700),o=e.slice(t,n),r=/("> "),([$\w]+)/,i=o.match(r);if(!i)return{prefixLocation:null,messageLocation:null};const a=t+o.indexOf(i[1]),l=a+i[1].length,u=l+1,c=u+i[2].length;return{prefixLocation:{startIndex:a,endIndex:l},messageLocation:{startIndex:u,endIndex:c}}},Oo=(e,t,n,o,r=!1,i=!1,a=!1,l=!1,u=!1,c,h,f=!1,y=!1,w=!1,p=!1,b=!1)=>{const x=No(e);if(!x)return console.error("patch: userMessageDisplay: getUserMessageDisplayLocation returned null"),null;if(!x.prefixLocation)return console.error("patch: userMessageDisplay: failed to find prefix location"),null;if(!x.messageLocation)return console.error("patch: userMessageDisplay: failed to find message location"),null;const E=dn(e);if(!E)return console.error("patch: userMessageDisplay: failed to find chalk variable"),null;const $=[],k=n==="rgb(0,0,0)"&&o==="rgb(0,0,0)",N=!k||(r||i||a||l||u),F=c==="rgb(0,0,0)"&&h==="rgb(0,0,0)",U=!F||(f||y||w||p||b);if(N){const T=Tn(E,k?null:n.match(/\d+/g)?.join(",")||null,k?null:o.match(/\d+/g)?.join(",")||null,r,i,a,l,u);$.push({startIndex:x.prefixLocation.startIndex,endIndex:x.prefixLocation.endIndex,newContent:`${T}("${t}")+" "`})}if(U){const T=Tn(E,F?null:c.match(/\d+/g)?.join(",")||null,F?null:h.match(/\d+/g)?.join(",")||null,f,y,w,p,b);$.push({startIndex:x.messageLocation.startIndex,endIndex:x.messageLocation.endIndex,newContent:e.slice(x.messageLocation.startIndex,x.messageLocation.endIndex).replace(/([$\w]+)/,`${T}($1)`)})}$.sort((T,C)=>C.startIndex-T.startIndex);let O=e;for(const T of $){const C=O;O=O.slice(0,T.startIndex)+T.newContent+O.slice(T.endIndex),H(C,O,T.newContent,T.startIndex,T.endIndex)}return O},Bo=e=>{const t=/createElement\([$\w]+,\{[^}]+spinnerTip[^}]+overrideMessage[^}]+\}/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: verbose: failed to find createElement with spinnerTip and overrideMessage"),null;const o=n[0],r=/verbose:[^,}]+/,i=o.match(r);if(!i||i.index===void 0)return console.error("patch: verbose: failed to find verbose property"),null;const a=n.index+i.index,l=a+i[0].length;return{startIndex:a,endIndex:l}},Ao=e=>{const t=Bo(e);if(!t)return null;const n="verbose:true",o=e.slice(0,t.startIndex)+n+e.slice(t.endIndex);return H(e,o,n,t.startIndex,t.endIndex),o},Po=e=>{const t=/function ([$\w]+)\(\{\s*streamMode:\s*([$\w]+)\s*\}\)\s*\{/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: thinkingVisibility: failed to find banner function pattern"),null;const[o]=n,r=n.index,i=r+o.length;return{startIndex:r,endIndex:i,identifiers:[n[1],n[2]]}},Lo=e=>{const t=/(case"thinking":)if\(.+?\)return null;(.+?isTranscriptMode:).+?([},])/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: thinkingVisibility: failed to find thinking visibility pattern"),null;const o=n.index,r=o+n[0].length;return{startIndex:o,endIndex:r,identifiers:[n[1],n[2],n[3]]}},Do=e=>{const t=Po(e);if(!t)return null;const n="return null;";let o=e.slice(0,t.endIndex)+n+e.slice(t.endIndex);H(e,o,n,t.endIndex,t.endIndex);const r=Lo(o);if(!r)return null;const i=`${r.identifiers[0]}${r.identifiers[1]}true${r.identifiers[2]}`;return o=o.slice(0,r.startIndex)+i+o.slice(r.endIndex),H(e,o,i,r.startIndex,r.endIndex),o},Ro=e=>{const n=e.indexOf("}.VERSION} (Claude Code)");return n==-1?(console.error("patch: patchesAppliedIndication: failed to find versionIndex"),null):{startIndex:0,endIndex:n+24}},Fo=e=>{const t=/\b([$\w]+)\.createElement\(([$\w]+),\{bold:!0\},"Claude Code"\)," ",([$\w]+)\.createElement\(([$\w]+),\{dimColor:!0\},"v",[$\w]+\)/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find Claude Code version pattern"),null;const o=n.index+n[0].length;return{startIndex:o,endIndex:o}},Vo=(e,t,n,o,r,i)=>{const a=/alignItems:"center",minHeight:9,?/,l=e.match(a);if(!l||l.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find alignItems pattern for PATCH 4"),null;let u=e.slice(0,l.index)+"minHeight:9,"+e.slice(l.index+l[0].length);const c=Math.max(0,l.index-200),h=u.slice(c,l.index+12+2),f=/\b([$\w]+)\.createElement\(([$\w]+),(?:\w+|\{[^}]+\}),/g,y=Array.from(h.matchAll(f));if(y.length===0)return console.error("patch: patchesAppliedIndication: failed to find createElement for PATCH 4"),null;const w=y[y.length-1],p=c+w.index+w[0].length,b=`${n}.createElement(${r}, null, ${i}.blue.bold(" + tweakcc v${t}")),${n}.createElement(${o},{alignItems:"center",flexDirection:"column"},`,x=u;u=u.slice(0,p)+b+u.slice(p),H(x,u,b,p,p);let E=1,$=p+b.length,k=-1;for(;$<u.length;){const N=u[$];if(N==="(")E++;else if(N===")"){if(E===1){k=$;break}E--}$++}if(k===-1)return console.error("patch: patchesAppliedIndication: failed to find closing paren for PATCH 4"),null;const D=u;return u=u.slice(0,k)+"),"+u.slice(k),H(D,u,"),",k,k),{content:u,closingParenIndex:k+2}},jo=(e,t,n,o,r,i,a)=>{let l=4,u=t,c=-1;for(;u<e.length;){const p=e[u];if(p==="(")l++;else if(p===")"){if(l===1){c=u;break}l--}u++}if(c===-1)return console.error("patch: patchesAppliedIndication: failed to find insertion point for PATCH 5"),null;const h=[];h.push(`,${n}.createElement(${o}, { flexDirection: "column" },`),h.push(`${n}.createElement(${o}, null, ${n}.createElement(${r}, {color: "success", bold: true}, "┃ "), ${n}.createElement(${r}, {color: "success", bold: true}, "✓ tweakcc patches are applied")),`);for(let p of a)p=p.replace("CHALK_VAR",i),h.push(`${n}.createElement(${o}, null, ${n}.createElement(${r}, {color: "success", bold: true}, "┃ "), ${n}.createElement(${r}, {dimColor: true}, \` * ${p}\`)),`);h.push("),");const f=h.join(""),y=e,w=e.slice(0,c)+f+e.slice(c);return H(y,w,f,c,c),w},Uo=e=>{const t=/\b([$\w]+)\.createElement\(([$\w]+),\{bold:!0\},"Claude Code"\)," ",([$\w]+)\.createElement\(([$\w]+),\{dimColor:!0\},"v",[$\w]+\)/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find Claude Code version pattern for patch 3"),null;const o=Math.max(0,n.index-500),r=e.slice(o,n.index),i=/\}function ([$\w]+)\(/g,a=Array.from(r.matchAll(i));if(a.length===0)return console.error("patch: patchesAppliedIndication: failed to find header component function"),null;const u=a[a.length-1][1],c=new RegExp(`\\b([$\\w]+)\\.createElement\\(${fe(u)},null\\),?`),h=e.match(c);if(!h||h.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find createElement call for header"),null;const f=h.index+h[0].length;return{startIndex:f,endIndex:f}},Ho=(e,t,n,o=!0,r=!0)=>{const i=Ro(e);if(!i)return console.error("patch: patchesAppliedIndication: failed to version output location"),null;const a=`\\n${t} (tweakcc)`;let l=e.slice(0,i.endIndex)+a+e.slice(i.endIndex);H(e,l,a,i.endIndex,i.endIndex);const u=dn(e);if(!u)return console.error("patch: patchesAppliedIndication: failed to find chalk variable"),null;const c=nt(e);if(!c)return console.error("patch: patchesAppliedIndication: failed to find text component"),null;const h=Je(e);if(!h)return console.error("patch: patchesAppliedIndication: failed to find React variable"),null;const f=tt(e);if(!f)return console.error("patch: patchesAppliedIndication: failed to find Box component"),null;if(o){const w=Fo(l);if(!w)return console.error("patch: patchesAppliedIndication: patch 2 failed"),null;const p=`, " ",${h}.createElement(${c}, null, ${u}.blue.bold('+ tweakcc v${t}'))`,b=l;l=l.slice(0,w.startIndex)+p+l.slice(w.endIndex),H(b,l,p,w.startIndex,w.endIndex)}if(r){const w=Uo(l);if(!w)return console.error("patch: patchesAppliedIndication: patch 3 failed"),null;const p=[];p.push(`${h}.createElement(${f}, { flexDirection: "column" },`),p.push(`${h}.createElement(${f}, null, ${h}.createElement(${c}, {color: "success", bold: true}, "┃ "), ${h}.createElement(${c}, {color: "success", bold: true}, "✓ tweakcc patches are applied")),`);for(let E of n)E=E.replace("CHALK_VAR",u),p.push(`${h}.createElement(${f}, null, ${h}.createElement(${c}, {color: "success", bold: true}, "┃ "), ${h}.createElement(${c}, {dimColor: true}, \` * ${E}\`)),`);p.push("),");const b=p.join(`
|
|
187
|
+
`),x=l;l=l.slice(0,w.startIndex)+b+l.slice(w.endIndex),H(x,l,b,w.startIndex,w.endIndex)}let y=-1;if(o){const w=Vo(l,t,h,f,c,u);if(!w)return console.error("patch: patchesAppliedIndication: patch 4 failed"),null;l=w.content,y=w.closingParenIndex}if(r){if(y===-1){const p=/alignItems:"center",minHeight:9,?/,b=l.match(p);if(!b||b.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find reference point for PATCH 5"),null;y=b.index+b[0].length}const w=jo(l,y,h,f,c,u,n);if(!w)return console.error("patch: patchesAppliedIndication: patch 5 failed"),null;l=w}return l},Go=e=>/\\u[0-9a-fA-F]{4}/.test(e),zo=e=>{const t=e.toString(),n=JSON.stringify(t.substring(1,t.length-1)),o=JSON.stringify(t.match(/\/(\w*)$/)[1]);return`new RegExp(${n}, ${o})`},Yo=async(e,t,n)=>{const o=n??Go(e);M()&&o&&console.log("Detected Unicode escaping in cli.js - will escape non-ASCII characters in prompts");const r=await Gt(t,o);M()&&console.log(`Loaded ${r.length} system prompts with regexes`);let i=0,a=0;for(const{promptId:c,prompt:h,regex:f,getInterpolatedContent:y,pieces:w,identifiers:p,identifierMap:b}of r){const x=new RegExp(f,"si"),E=e.match(x);if(E&&E.index!==void 0){const $=y(E),k=jt($);if(k.size>0){const C=Be(c),G=h.content.split(`
|
|
188
|
+
`);for(const[Y,Q]of k){const J=Y+(h.contentLineOffset||0),I=G[Y-1]||"";console.log(Ut(C,J,I,Q)),console.log()}continue}const D=Ve(w,p,b).trim(),N=D.length,F=h.content.length;i+=N,a+=F,M()&&N!==F&&(console.log(`
|
|
189
|
+
Character count difference for ${h.name}:`),console.log(` Original baseline: ${N} chars`),console.log(` User's version: ${F} chars`),console.log(` Difference: ${N-F} chars`),Math.abs(N-F)<200&&(console.log(`
|
|
186
190
|
Original baseline content:
|
|
187
|
-
${
|
|
191
|
+
${D}`),console.log(`
|
|
188
192
|
User's content:
|
|
189
|
-
${h.content}`))),
|
|
190
|
-
Found match for prompt: ${h.name}`),console.log(` Match location: index ${
|
|
191
|
-
Debug info for ${h.name}:`),console.log(` Regex pattern (first 200 chars): ${f.substring(0,200)}...`),console.log(" Trying to match pattern in cli.js...");const
|
|
193
|
+
${h.content}`))),M()&&(console.log(`
|
|
194
|
+
Found match for prompt: ${h.name}`),console.log(` Match location: index ${E.index}, length ${E[0].length}`),console.log(` Original content (first 100 chars): ${E[0].substring(0,100)}...`),console.log(` Replacement content (first 100 chars): ${$.substring(0,100)}...`),console.log(` Captured variables: ${E.slice(1).join(", ")}`),console.log(` Content identical: ${E[0]===$}`));const K=e,U=E.index,O=E[0].length;e=e.replace(x,$);const T=We(h.content);await Et(c,T),M()&&H(K,e,$,U,U+O)}else if(console.log(j.yellow(`Could not find system prompt "${h.name}" in cli.js (using regex ${zo(x)})`)),M()){console.log(`
|
|
195
|
+
Debug info for ${h.name}:`),console.log(` Regex pattern (first 200 chars): ${f.substring(0,200)}...`),console.log(" Trying to match pattern in cli.js...");const $=e.match(new RegExp(f.substring(0,100)));console.log(` Partial match result: ${$?"found partial":"no match"}`)}}const l=[],u=i-a;return u>0?l.push(`system prompts: \${CHALK_VAR.green('${u} fewer chars')} than original`):u<0&&l.push(`system prompts: \${CHALK_VAR.red('${Math.abs(u)} more chars')} than original`),{newContent:e,items:l}},Wo=e=>{const t=/ensureServerStarted:([$\w]+)\b/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: fixLspSupport: failed to find ensureServerStarted"),null;const o=Math.max(0,n.index-50),r=Math.min(e.length,n.index+50),i=e.slice(o,r),a=/sendRequest:([$\w]+)[,}]/,l=i.match(a);if(!l)return console.error(`patch: fixLspSupport: failed to find sendRequest near ensureServerStarted, window=${JSON.stringify([o,r,i])}`),null;const u=l[1],c=Math.max(0,n.index-2e3),h=e.slice(c,n.index),f=new RegExp(`async function ${fe(u)}\\(([$\\w]+),`,"g");let y,w=null;for(;(y=f.exec(h))!==null;)w=y;if(!w)return console.error(`patch: fixLspSupport: failed to find async function ${u}`),null;const p=w[1],b=c+w.index,x=e.slice(b,n.index),E=/let ([$\w]+)=await [$\w]+\([$\w]+\);/,$=x.match(E);if(!$||$.index===void 0)return console.error("patch: fixLspSupport: failed to find second line of sendRequest"),null;const k=$[1],D=b+$.index+$[0].length,N=e.slice(D,n.index),F=new RegExp(`if\\(!${fe(k)}\\)return;`),K=N.match(F);if(!K||K.index===void 0)return console.error("patch: fixLspSupport: failed to find if(!serverVar)return; line"),null;const U=D+K.index+K[0].length;return{startIndex:U,endIndex:U,identifiers:[p,k]}},Jo=e=>{const t=/if\([$\w]+\.restartOnCrash!==void 0\)throw Error\(`LSP server '\$\{[$\w]+\}': restartOnCrash is not yet implemented\. Remove this field from the configuration\.`\);/g,n=/if\([$\w]+\.startupTimeout!==void 0\)throw Error\(`LSP server '\$\{[$\w]+\}': startupTimeout is not yet implemented\. Remove this field from the configuration\.`\);/g,o=/if\([$\w]+\.shutdownTimeout!==void 0\)throw Error\(`LSP server '\$\{[$\w]+\}': shutdownTimeout is not yet implemented\. Remove this field from the configuration\.`\);/g;let r=e;const i=r;r=r.replace(t,""),r!==i?H(i,r,"",0,0):console.warn("patch: fixLspSupport: restartOnCrash validation not found");const a=r;r=r.replace(n,""),r!==a?H(a,r,"",0,0):console.warn("patch: fixLspSupport: startupTimeout validation not found");const l=r;r=r.replace(o,""),r!==l?H(l,r,"",0,0):console.warn("patch: fixLspSupport: shutdownTimeout validation not found");const u=Wo(r);if(!u||!u.identifiers)return null;const[c,h]=u.identifiers,f=`
|
|
192
196
|
const path = await import('path');
|
|
193
|
-
const ext = path.extname(${
|
|
197
|
+
const ext = path.extname(${c}).toLowerCase();
|
|
194
198
|
const langMap = {
|
|
195
199
|
'.ts': 'typescript',
|
|
196
200
|
'.tsx': 'typescriptreact',
|
|
@@ -328,95 +332,95 @@ Found match for prompt: ${h.name}`),console.log(` Match location: index ${C.ind
|
|
|
328
332
|
const languageId = langMap[ext] || 'plaintext';
|
|
329
333
|
try {
|
|
330
334
|
const fs = await import('fs/promises');
|
|
331
|
-
const text = await fs.readFile(${
|
|
335
|
+
const text = await fs.readFile(${c}, 'utf8');
|
|
332
336
|
await ${h}.sendNotification('textDocument/didOpen', {
|
|
333
337
|
textDocument: {
|
|
334
|
-
uri: "file://" + ${
|
|
338
|
+
uri: "file://" + ${c},
|
|
335
339
|
languageId: languageId,
|
|
336
340
|
version: 1,
|
|
337
341
|
text: text
|
|
338
342
|
}
|
|
339
343
|
});
|
|
340
344
|
} catch (openErr) { }
|
|
341
|
-
`,
|
|
342
|
-
const toolsets = ${
|
|
343
|
-
if (toolsets.hasOwnProperty(${
|
|
344
|
-
const allowedTools = toolsets[${
|
|
345
|
+
`,y=r.slice(0,u.startIndex)+f+r.slice(u.endIndex);return H(r,y,f,u.startIndex,u.endIndex),y},Xn=e=>{const t=/=>\[([$a-zA-Z_][$\w]{1,2},){30}/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: findSlashCommandListEndPosition: failed to find arrayStartPattern"),null;const o=e.indexOf("[",n.index);if(o===-1)return console.error("patch: findSlashCommandListEndPosition: failed to find bracketIndex"),null;let r=1,i=o+1;for(;i<e.length&&r>0;){if(e[i]==="[")r++;else if(e[i]==="]"&&(r--,r===0))return i;i++}return console.error("patch: findSlashCommandListEndPosition: failed to find matching closing-bracket"),null},Zn=(e,t)=>{const n=Xn(e);if(n===null)return console.error("patch: writeSlashCommandDefinition: failed to find slash command array end position"),null;const o=e.slice(0,n)+t+e.slice(n);return H(e,o,t,n,n),o},qo=e=>{const t=/function ([$\w]+)\(\{(?:(?:isDisabled|hideIndexes|visibleOptionCount|highlightText|options|defaultValue|onCancel|onChange|onFocus|focusValue|layout|disableSelection):[$\w]+(?:=(?:[^,]+,|[^}]+\})|[,}]))+\)/g,n=Array.from(e.matchAll(t));if(n.length===0)return console.error("patch: findSelectComponentName: failed to find selectPattern"),null;let o=n[0];for(const r of n)r[0].length>o[0].length&&(o=r);return o[1]},Ko=e=>{const t=/function ([$\w]+)\(\{(?:(?:orientation|title|width|padding|titlePadding|titleColor|titleDimColor|dividerChar|dividerColor|dividerDimColor|boxProps):[$\w]+(?:=(?:[^,]+,|[^}]+\})|[,}]))+\)/g,n=Array.from(e.matchAll(t));if(n.length===0)return console.error("patch: findDividerComponentName: failed to find dividerPattern"),null;let o=n[0];for(const r of n)r[0].length>o[0].length&&(o=r);return o[1]},Qn=e=>{const t=/function ([$\w]+)\(\{(?:(?:commands|debug|initialPrompt|initialTools|initialMessages|initialCheckpoints|initialFileHistorySnapshots|mcpClients|dynamicMcpConfig|mcpCliEndpoint|autoConnectIdeFlag|strictMcpConfig|systemPrompt|appendSystemPrompt|onBeforeQuery|onTurnComplete|disabled):[$\w]+(?:=(?:[^,]+,|[^}]+\})|[,}]))+\)/g,o=Array.from(e.matchAll(t)).filter(i=>i[0].includes("commands:"));if(o.length===0)return console.error("patch: getMainAppComponentBodyStart: failed to find appComponentPattern"),null;let r=o[0];for(const i of o)i[0].length>r[0].length&&(r=i);return r.index===void 0?(console.error("patch: getMainAppComponentBodyStart: failed to find appComponentPattern longestMatch"),null):r.index+r[0].length},cn=e=>{const t=Qn(e);if(t===null)return console.error("patch: getAppStateVarAndGetterFunction: failed to find bodyStart"),null;const n=e.slice(t,t+20),o=/let\[([$\w]+),[$\w]+\]=([$\w]+)\(\)/,r=n.match(o);return r?{appStateVar:r[1],appStateGetterFunction:r[2]}:(console.error("patch: getAppStateVarAndGetterFunction: failed to find statePattern"),null)},Xo=e=>{const t=Qn(e);if(t===null)return console.error("patch: getToolFetchingUseMemoLocation: failed to find bodyStart"),null;const n=e.slice(t,t+2e3),o=/(?:let |,)([$\w]+)=([$\w]+)\.useMemo\(\(\)=>([$\w]+)\(([$\w]+)\),\[\4\]\)/,r=n.match(o);if(!r||r.index===void 0)return console.error("patch: getToolFetchingUseMemoLocation: failed to find useMemoPattern"),null;const i=t+r.index,a=i+r[0].length,u=r[0].startsWith(",");return{startIndex:i,endIndex:a,outputVarName:r[1],reactVarName:r[2],toolFilterFunction:r[3],toolPermissionContextVar:r[4],needsSemicolonPrefix:u}},Zo=e=>{const t=Xn(e);if(t===null)return console.error("patch: findTopLevelPositionBeforeSlashCommand: failed to find arrayEnd"),null;let n=1,o=t;for(;o>=0&&n>0;){if(e[o]==="}")n++;else if(e[o]==="{"&&(n--,n===0))break;o--}if(o<0)return console.error("patch: findTopLevelPositionBeforeSlashCommand: failed to find matching open-brace"),null;for(;o>=0&&e[o]!==";";)o--;return o<0?(console.error("patch: findTopLevelPositionBeforeSlashCommand: failed to find matching semicolon"),null):o+1},Qo=(e,t)=>{const n=/thinkingEnabled:([$\w]+)\(\)/g,o=Array.from(e.matchAll(n));if(o.length===0)return console.error("patch: toolsets: failed to find thinkingEnabled pattern"),null;const r=[];for(const u of o)if(u.index!==void 0){const c=u.index+u[0].length;r.push({index:c})}r.sort((u,c)=>c.index-u.index);let i=e;const l=`,toolset:${t?JSON.stringify(t):"undefined"}`;for(const u of r)i=i.slice(0,u.index)+l+i.slice(u.index);return i===e?(console.error("patch: toolsets: failed to modify app state initialization"),null):i},er=(e,t)=>{const n=Xo(e);if(!n)return console.error("patch: toolsets: failed to find tool fetching useMemo location"),null;const o=cn(e);if(!o)return console.error("patch: toolsets: failed to find app state info"),null;const{appStateVar:r}=o,{startIndex:i,endIndex:a,outputVarName:l,reactVarName:u,toolFilterFunction:c,toolPermissionContextVar:h,needsSemicolonPrefix:f}=n,y=JSON.stringify(Object.fromEntries(t.map(x=>[x.name,x.allowedTools==="*"?"*":x.allowedTools]))),p=`${f?";":""}let ${l} = ${u}.useMemo(() => {
|
|
346
|
+
const toolsets = ${y};
|
|
347
|
+
if (toolsets.hasOwnProperty(${r}.toolset)) {
|
|
348
|
+
const allowedTools = toolsets[${r}.toolset];
|
|
345
349
|
if (allowedTools === "*") {
|
|
346
|
-
return ${
|
|
350
|
+
return ${c}(${h});
|
|
347
351
|
} else {
|
|
348
|
-
return ${
|
|
352
|
+
return ${c}(${h}).filter(toolDef =>
|
|
349
353
|
allowedTools.includes(toolDef.name)
|
|
350
354
|
);
|
|
351
355
|
}
|
|
352
356
|
} else {
|
|
353
|
-
return ${
|
|
357
|
+
return ${c}(${h});
|
|
354
358
|
}
|
|
355
|
-
}, [${
|
|
359
|
+
}, [${c}, ${r}.toolset])`,b=e.slice(0,i)+p+e.slice(a);return H(e,b,p,i,a),b},nr=(e,t)=>{const n=Zo(e);if(n===null)return console.error("patch: toolsets: failed to find slash command insertion point"),null;const o=Je(e);if(!o)return console.error("patch: toolsets: failed to find React variable"),null;const r=tt(e);if(!r)return console.error("patch: toolsets: failed to find Box component"),null;const i=nt(e);if(!i)return console.error("patch: toolsets: failed to find Text component"),null;const a=qo(e);if(!a)return console.error("patch: toolsets: failed to find Select component"),null;const l=Ko(e);if(!l)return console.error("patch: toolsets: failed to find Divider component"),null;const u=cn(e);if(!u)return console.error("patch: toolsets: failed to find app state getter"),null;const c=dn(e);if(!c)return console.error("patch: toolsets: failed to find chalk variable"),null;const{appStateGetterFunction:h}=u,f=JSON.stringify(t.map(b=>b.name)),y=JSON.stringify(t.map(b=>({label:b.name,value:b.name,description:b.allowedTools==="*"?"All tools":b.allowedTools.length===0?"No tools":`${b.allowedTools.length} tool${b.allowedTools.length!==1?"s":""}: ${b.allowedTools.join(", ")}`}))),w=`const toolsetComp = ({ onExit, input }) => {
|
|
356
360
|
const [state, setState] = ${h}();
|
|
357
361
|
|
|
358
362
|
// Handle command-line argument
|
|
359
363
|
if (input !== "" && input != null) {
|
|
360
364
|
if (!${f}.includes(input)) {
|
|
361
|
-
onExit(${
|
|
365
|
+
onExit(${c}.red(\`\${${c}.bold(input)} is not a valid toolset. Valid toolsets: ${t.map(b=>b.name).join(", ")}\`));
|
|
362
366
|
return;
|
|
363
367
|
} else {
|
|
364
368
|
setState(prev => ({ ...prev, toolset: input }));
|
|
365
|
-
onExit(\`Toolset changed to \${${
|
|
369
|
+
onExit(\`Toolset changed to \${${c}.bold(input)}\`);
|
|
366
370
|
return;
|
|
367
371
|
}
|
|
368
372
|
}
|
|
369
373
|
|
|
370
374
|
// Render interactive UI
|
|
371
|
-
return ${
|
|
372
|
-
${
|
|
375
|
+
return ${o}.createElement(
|
|
376
|
+
${r},
|
|
373
377
|
{ flexDirection: "column" },
|
|
374
|
-
${
|
|
375
|
-
${
|
|
376
|
-
${
|
|
378
|
+
${o}.createElement(${l}, { dividerColor: "permission" }),
|
|
379
|
+
${o}.createElement(
|
|
380
|
+
${r},
|
|
377
381
|
{ paddingX: 1, marginBottom: 1, flexDirection: "column" },
|
|
378
|
-
${
|
|
379
|
-
${
|
|
382
|
+
${o}.createElement(${r}, null,
|
|
383
|
+
${o}.createElement(${i}, { bold: true, color: "remember" }, "Select toolset")
|
|
380
384
|
),
|
|
381
|
-
${
|
|
382
|
-
${
|
|
385
|
+
${o}.createElement(${r}, null,
|
|
386
|
+
${o}.createElement(${i}, { dimColor: true }, "A toolset is a collection of tools that Claude sees and is allowed to call.")
|
|
383
387
|
),
|
|
384
|
-
${
|
|
385
|
-
${
|
|
388
|
+
${o}.createElement(${r}, { marginBottom: 1 },
|
|
389
|
+
${o}.createElement(${i}, { dimColor: true }, "Claude cannot call tools that are not included in the selected toolset.")
|
|
386
390
|
),
|
|
387
|
-
${
|
|
388
|
-
${
|
|
391
|
+
${o}.createElement(${r}, null,
|
|
392
|
+
${o}.createElement(${i}, { color: "warning" }, "Note that Claude may hallucinate that it has access to tools outside of the toolset.")
|
|
389
393
|
),
|
|
390
|
-
${
|
|
391
|
-
${
|
|
394
|
+
${o}.createElement(${r}, { marginBottom: 1 },
|
|
395
|
+
${o}.createElement(${i}, { dimColor: true }, "If so, explicitly remind it what its tool list is, or tell it to check it itself.")
|
|
392
396
|
),
|
|
393
|
-
${
|
|
394
|
-
${
|
|
395
|
-
${
|
|
396
|
-
${
|
|
397
|
-
${
|
|
397
|
+
${o}.createElement(${r}, null,
|
|
398
|
+
${o}.createElement(${i}, { dimColor: true, bold: true }, "Toolsets are managed with tweakcc. "),
|
|
399
|
+
${o}.createElement(${i}, { dimColor: true }, "Run "),
|
|
400
|
+
${o}.createElement(${i}, { color: "permission" }, "npx tweakcc"),
|
|
401
|
+
${o}.createElement(${i}, { dimColor: true }, " to manage them.")
|
|
398
402
|
),
|
|
399
|
-
${
|
|
400
|
-
${
|
|
403
|
+
${o}.createElement(${r}, { marginBottom: 1 },
|
|
404
|
+
${o}.createElement(${i}, { color: "permission" }, "https://github.com/Piebald-AI/tweakcc")
|
|
401
405
|
),
|
|
402
|
-
${
|
|
403
|
-
${
|
|
404
|
-
${
|
|
406
|
+
${o}.createElement(${r}, { marginBottom: 1 },
|
|
407
|
+
${o}.createElement(${i}, null, "Current toolset: "),
|
|
408
|
+
${o}.createElement(${i}, { bold: true }, state.toolset || "undefined")
|
|
405
409
|
),
|
|
406
|
-
${
|
|
407
|
-
${
|
|
408
|
-
options: ${
|
|
410
|
+
${o}.createElement(${r}, { marginBottom: 1 },
|
|
411
|
+
${o}.createElement(${a}, {
|
|
412
|
+
options: ${y},
|
|
409
413
|
onChange: (input) => {
|
|
410
414
|
setState(prev => ({ ...prev, toolset: input }));
|
|
411
|
-
onExit(\`Toolset changed to \${${
|
|
415
|
+
onExit(\`Toolset changed to \${${c}.bold(input)}\`);
|
|
412
416
|
},
|
|
413
|
-
onCancel: () => onExit(\`Toolset not changed (left as \${${
|
|
417
|
+
onCancel: () => onExit(\`Toolset not changed (left as \${${c}.bold(state.toolset)})\`)
|
|
414
418
|
})
|
|
415
419
|
),
|
|
416
|
-
${
|
|
420
|
+
${o}.createElement(${i}, { dimColor: true, italic: true }, "Enter to confirm · Esc to exit")
|
|
417
421
|
)
|
|
418
422
|
);
|
|
419
|
-
};`,p=e.slice(0,n)+
|
|
423
|
+
};`,p=e.slice(0,n)+w+e.slice(n);return H(e,p,w,n,n),p},tr=e=>{const t=/\{color:"bashBorder"\},"! for bash mode"/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: toolsets: findShiftTabAppStateVarInsertionPoint: failed to find bash mode pattern"),null;const o=Math.max(0,n.index-500),r=e.slice(o,n.index),i=/function ([$\w]+)\(\{[^}]+\}\)\{/g,a=Array.from(r.matchAll(i));if(a.length===0)return console.error("patch: toolsets: findShiftTabAppStateVarInsertionPoint: failed to find function pattern"),null;const l=a[a.length-1];return l.index===void 0?(console.error("patch: toolsets: findShiftTabAppStateVarInsertionPoint: match has no index"),null):o+l.index+l[0].length},or=e=>{const t=tr(e);if(t===null)return console.error("patch: toolsets: insertShiftTabAppStateVar: failed to find insertion point"),null;const n=cn(e);if(!n)return console.error("patch: toolsets: insertShiftTabAppStateVar: failed to find app state getter"),null;const{appStateGetterFunction:o}=n,r=`let[state]=${o}();`,i=e.slice(0,t)+r+e.slice(t);return H(e,i,r,t,t),i},rr=e=>{const t=/([$\w]+)\((\w+)\)\.toLowerCase\(\)," on"/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: toolsets: appendToolsetToModeDisplay: failed to find mode display pattern"),null;const o=n[1],r=n[2],i=n[0],a=`${o}(${r}).toLowerCase()," on [",state.toolset||"undefined","]"`,l=e.replace(i,a);return l===e?(console.error("patch: toolsets: appendToolsetToModeDisplay: failed to modify mode display"),null):(H(e,l,a,n.index,n.index+i.length),l)},ir=e=>{const t=/"\? for shortcuts"/g,o=Array.from(e.matchAll(t)).at(-1);if(!o||o.index===void 0)return console.error("patch: toolsets: appendToolsetToShortcutsDisplay: could not find '? for shortcuts'"),null;const r=o[0],i='"? for shortcuts [",state.toolset||"undefined","]"',a=e.replace(r,i);return a===e?(console.error("patch: toolsets: appendToolsetToModeDisplay: failed to modify mode display"),null):(H(e,a,i,o.index,o.index+r.length),a)},sr=e=>{const t=Je(e);if(!t)return console.error("patch: toolsets: failed to find React variable"),null;const n=`, {
|
|
420
424
|
aliases: ["change-tools"],
|
|
421
425
|
type: "local-jsx",
|
|
422
426
|
name: "toolset",
|
|
@@ -430,7 +434,7 @@ Found match for prompt: ${h.name}`),console.log(` Match location: index ${C.ind
|
|
|
430
434
|
userFacingName() {
|
|
431
435
|
return "toolset";
|
|
432
436
|
}
|
|
433
|
-
}`;return Zn(e,n)},
|
|
437
|
+
}`;return Zn(e,n)},lr=(e,t,n)=>{if(!t||t.length===0)return null;let o=e;return o=Qo(o,n),o?(o=er(o,t),o?(o=nr(o,t),o?(o=sr(o),o?(o=or(o),o?(o=rr(o),o?(o=ir(o),o||(console.error("patch: toolsets: step 7 failed (appendToolsetToShortcutsDisplay)"),null)):(console.error("patch: toolsets: step 6 failed (appendToolsetToModeDisplay)"),null)):(console.error("patch: toolsets: step 5 failed (insertShiftTabAppStateVar)"),null)):(console.error("patch: toolsets: step 4 failed (writeSlashCommandDefinition)"),null)):(console.error("patch: toolsets: step 3 failed (writeToolsetComponentDefinition)"),null)):(console.error("patch: toolsets: step 2 failed (writeToolFetchingUseMemo)"),null)):(console.error("patch: toolsets: step 1 failed (writeToolsetFieldToAppState)"),null)},ar=e=>Je(e)?Zn(e,`, {
|
|
434
438
|
type: "local",
|
|
435
439
|
name: "title",
|
|
436
440
|
description: "Set the conversation title",
|
|
@@ -449,7 +453,7 @@ Found match for prompt: ${h.name}`),console.log(` Match location: index ${C.ind
|
|
|
449
453
|
userFacingName() {
|
|
450
454
|
return "title";
|
|
451
455
|
},
|
|
452
|
-
}`):(console.error("patch: conversationTitle: failed to find React variable"),null),
|
|
456
|
+
}`):(console.error("patch: conversationTitle: failed to find React variable"),null),cr=e=>{const t=/class ([$\w]+)\{summaries;(?:customTitles;)?messages;(?:checkpoints;)?fileHistorySnapshots;/,n=e.match(t);return!n||n.index===void 0?(console.error("patch: conversationTitle: findCustomNamingFunctionsLocation: failed to find class pattern"),null):n.index},dr=e=>{const t=cr(e);if(t===null)return console.error("patch: conversationTitle: failed to find custom naming functions location"),null;const n=un(e),o=`
|
|
453
457
|
function getTweakccBaseDir() {
|
|
454
458
|
const { join: pathJoin } = ${n}('path');
|
|
455
459
|
const { homedir: osHomedir } = ${n}('os');
|
|
@@ -619,11 +623,11 @@ function onNewMessage(projectDir, projectSlug, msg) {
|
|
|
619
623
|
}
|
|
620
624
|
}
|
|
621
625
|
|
|
622
|
-
`,
|
|
626
|
+
`,r=e.slice(0,t)+o+e.slice(t);return H(e,r,o,t,t),r},ur=e=>{const t=/(if\(![$\w]+\.has\(([$\w]+)\.uuid\)\)\{)if\([$\w]+\.appendFileSync\(/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: conversationTitle: findAppendEntryInterceptorLocation: failed to find pattern"),null;const o=n.index+n[1].length,r=n[2];return{location:o,messageVar:r}},hr=e=>{const t=ur(e);if(!t)return console.error("patch: conversationTitle: failed to find append entry interceptor location"),null;const n=un(e),{location:o,messageVar:r}=t,i=`const { dirname: pathDirname, basename: pathBasename } = ${n}('path');
|
|
623
627
|
const projectDir = pathDirname(this.sessionFile);
|
|
624
628
|
const projectSlug = pathBasename(projectDir);
|
|
625
|
-
onNewMessage(projectDir, projectSlug, ${
|
|
626
|
-
`,a=e.slice(0,
|
|
629
|
+
onNewMessage(projectDir, projectSlug, ${r});
|
|
630
|
+
`,a=e.slice(0,o)+i+e.slice(o);return H(e,a,i,o,o),a},gr=e=>{const t=/if\([$\w]+\.has\(([$\w]+)\.uuid\)\)continue;/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: conversationTitle: findTweakccSummaryCheckLocations: failed to find continue pattern"),null;const o=n[1],r=n.index+n[0].length-10,i=Math.max(0,n.index-200),a=e.substring(i,n.index),l=/for\(let [$\w]+ of ([$\w]+)\)try/,u=a.match(l);if(!u)return console.error("patch: conversationTitle: findTweakccSummaryCheckLocations: failed to find loop pattern"),null;const c=u[1],h=i+(u.index??0);return{orLocation:r,loopLocation:h,messageVar:o,fileListVar:c}},fr=e=>{const t=gr(e);if(!t)return console.error("patch: conversationTitle: failed to find tweakcc summary check locations"),null;const n=un(e),{orLocation:o,loopLocation:r,messageVar:i,fileListVar:a}=t;let l=e;const u=`const { readFileSync: fsReadFileSync } = ${n}('fs');
|
|
627
631
|
const tweakccSummaries = new Set();
|
|
628
632
|
for (const file of ${a}) {
|
|
629
633
|
const contents = fsReadFileSync(file, "utf8").trim();
|
|
@@ -638,21 +642,21 @@ for (const file of ${a}) {
|
|
|
638
642
|
if (obj.type != "summary" || !obj.hasOwnProperty("tweakcc")) continue;
|
|
639
643
|
tweakccSummaries.add(obj.leafUuid);
|
|
640
644
|
}
|
|
641
|
-
`;l=l.slice(0,
|
|
642
|
-
--- Diff ---`),console.log("OLD:",u+`\x1B[31m${
|
|
643
|
-
`))},fe=e=>e.replace(/\$/g,"\\$"),dn=e=>{const t=/\b([$\w]+)(?:\.(?:cyan|gray|green|red|yellow|ansi256|bgAnsi256|bgHex|bgRgb|hex|rgb|bold|dim|inverse|italic|strikethrough|underline)\b)+\(/g,n=Array.from(e.matchAll(t)),r={};for(const a of n){const l=a[1];r[l]=(r[l]||0)+1}let o,i=0;for(const[a,l]of Object.entries(r))l>i&&(i=l,o=a);return o},mo=e=>{const t=e.slice(0,1e3),n=/var ([$\w]+)=\([$\w]+,[$\w]+,[$\w]+\)=>\{/,r=t.match(n);if(!r){console.log("patch: getModuleLoaderFunction: failed to find module loader function");return}return r[1]},et=e=>{const t=/var ([$\w]+)=[$\w]+\(\([$\w]+\)=>\{var [$\w]+=Symbol\.for\("react\.element"\)/,n=e.match(t);if(!n){console.log("patch: getReactModuleNameNonBun: failed to find React module name");return}return n[1]},po=e=>{const t=et(e);if(!t){console.log("^ patch: getReactModuleFunctionBun: failed to find React module name (Bun)");return}const n=new RegExp(`var ([$\\w]+)=[$\\w]+\\(\\([$\\w]+,[$\\w]+\\)=>\\{[$\\w]+\\.exports=${fe(t)}\\(\\)`),r=e.match(n);if(!r){console.log(`patch: getReactModuleFunctionBun: failed to find React module function (Bun) (reactModuleNameNonBun=${t})`);return}return r[1]};let he=null,ke=null;const Je=e=>{if(he!=null)return he;const t=mo(e);if(!t){console.log("^ patch: getReactVar: failed to find moduleLoader"),he=void 0;return}const n=et(e);if(!n){console.log("^ patch: getReactVar: failed to find reactModuleVarNonBun"),he=void 0;return}const r=new RegExp(`\\b([$\\w]+)=${fe(t)}\\(${fe(n)}\\(\\),1\\)`),o=e.match(r);if(o)return he=o[1],he;const i=po(e);if(!i){console.log("^ patch: getReactVar: failed to find reactModuleFunctionBun"),he=void 0;return}const a=new RegExp(`\\b([$\\w]+)=${fe(t)}\\(${fe(i)}\\(\\),1\\)`),l=e.match(a);if(!l){console.log(`patch: getReactVar: failed to find bunPattern (moduleLoader=${t}, reactModuleVarNonBun=${n}, reactModuleFunctionBun=${i})`),he=void 0;return}return he=l[1],he},bo=e=>{const t=/import\{createRequire as ([$\w]+)\}from"node:module";/,n=e.match(t);if(!n)return;const r=n[1],o=new RegExp(`var ([$\\w]+)=${fe(r)}\\(import\\.meta\\.url\\)`),i=e.match(o);if(!i){console.log(`patch: findRequireFunc: failed to find require function variable (createRequireVar=${r})`);return}return i[1]},un=e=>{if(ke!=null)return ke;const t=bo(e);return t?(ke=t,ke):(ke="require",ke)},nt=e=>{const t=/\bfunction ([$\w]+)\(\{color:[$\w]+,backgroundColor:[$\w]+,dimColor:[$\w]+=![01],bold:[$\w]+=![01]/,n=e.match(t);if(!n){console.log("patch: findTextComponent: failed to find text component");return}return n[1]},tt=e=>{const t=/\b([$\w]+)\.displayName="Box"/,n=e.match(t);if(!n){console.error("patch: findBoxComponent: failed to find Box displayName");return}const r=n[1],o=new RegExp(`\\b([$\\w]+)=${fe(r)}[^$\\w]`),i=e.match(o);if(!i){console.error(`patch: findBoxComponent: failed to find Box component variable (boxOrigCompName=${r})`);return}return i[1]},rt=async(e,t)=>{let n;if(t.nativeInstallationPath){await qn(t);let u=!1;try{await te.stat(ge),u=!0}catch{}const d=u?ge:t.nativeInstallationPath;T()&&console.log(`Extracting claude.js from ${u?"backup":"native installation"}: ${d}`);const h=Yn(d);if(!h)throw new Error("Failed to extract claude.js from native installation");const f=re.join(ye.homedir(),".tweakcc"),v=re.join(f,"native-claudejs-orig.js");Ce.writeFileSync(v,h),T()&&console.log(`Saved original extracted JS from native to: ${v}`),n=h.toString("utf8")}else{if(await Jn(t),!t.cliPath)throw new Error("cliPath is required for NPM installations");n=await te.readFile(t.cliPath,{encoding:"utf8"})}const r=[],o=await Hr(n,t.version);n=o.newContent,r.push(...o.items);let i=null;e.settings.themes&&e.settings.themes.length>0&&(i=ar(n,e.settings.themes))&&(n=i),e.settings.thinkingVerbs&&((i=Er(n,e.settings.thinkingVerbs.verbs))&&(n=i),(i=pr(n,e.settings.thinkingVerbs.format))&&(n=i)),(i=yr(n,e.settings.thinkingStyle.phases))&&(n=i),(i=vr(n,e.settings.thinkingStyle.updateInterval))&&(n=i),(i=_r(n,Math.max(...e.settings.thinkingStyle.phases.map(u=>u.length))+1))&&(n=i),(i=wr(n,e.settings.thinkingStyle.reverseMirror))&&(n=i),e.settings.userMessageDisplay&&(i=Tr(n,e.settings.userMessageDisplay.prefix.format,e.settings.userMessageDisplay.prefix.foreground_color,e.settings.userMessageDisplay.prefix.background_color,e.settings.userMessageDisplay.prefix.styling.includes("bold"),e.settings.userMessageDisplay.prefix.styling.includes("italic"),e.settings.userMessageDisplay.prefix.styling.includes("underline"),e.settings.userMessageDisplay.prefix.styling.includes("strikethrough"),e.settings.userMessageDisplay.prefix.styling.includes("inverse"),e.settings.userMessageDisplay.message.foreground_color,e.settings.userMessageDisplay.message.background_color,e.settings.userMessageDisplay.message.styling.includes("bold"),e.settings.userMessageDisplay.message.styling.includes("italic"),e.settings.userMessageDisplay.message.styling.includes("underline"),e.settings.userMessageDisplay.message.styling.includes("strikethrough"),e.settings.userMessageDisplay.message.styling.includes("inverse")))&&(n=i),e.settings.inputBox&&typeof e.settings.inputBox.removeBorder=="boolean"&&(i=hr(n,e.settings.inputBox.removeBorder))&&(n=i),(i=Nr(n))&&(n=i),(i=fr(n))&&(n=i),(i=dr(n))&&(n=i),(i=yo(n))&&(n=i),(i=sr(n,25))&&(n=i),(i=Ar(n))&&(n=i);const a=e.settings.misc?.showTweakccVersion??!0,l=e.settings.misc?.showPatchesApplied??!0;if((i=Vr(n,"3.1.2",r,a,l))&&(n=i),(i=zr(n))&&(n=i),e.settings.toolsets&&e.settings.toolsets.length>0&&(i=oo(n,e.settings.toolsets,e.settings.defaultToolset))&&(n=i),(i=fo(n))&&(n=i),t.nativeInstallationPath){T()&&console.log(`Repacking modified claude.js into native installation: ${t.nativeInstallationPath}`);const u=re.join(ye.homedir(),".tweakcc"),d=re.join(u,"native-claudejs-patched.js");Ce.writeFileSync(d,n,"utf8"),T()&&console.log(`Saved patched JS from native to: ${d}`);const h=Buffer.from(n,"utf8");er(t.nativeInstallationPath,h,t.nativeInstallationPath)}else{if(!t.cliPath)throw new Error("cliPath is required for NPM installations");await fn(t.cliPath,n,"patch")}return await je(u=>{u.changesApplied=!0})},ot=[{label:"Opus 4.1",slug:"opus-4.1",internal:"claude-opus-4-1-20250805"},{label:"Opus 4",slug:"opus-4",internal:"claude-opus-4-20250514"},{label:"Sonnet 4",slug:"sonnet-4",internal:"claude-sonnet-4-20250514"},{label:"Sonnet 3.7",slug:"sonnet-3.7",internal:"claude-3-7-sonnet-20250219"},{label:"Sonnet 3.5 (October)",slug:"sonnet-3.5-october",internal:"claude-3-5-sonnet-20241022"},{label:"Sonnet 3.5 (June)",slug:"sonnet-3.5-june",internal:"claude-3-5-sonnet-20240620"},{label:"Haiku 3.5",slug:"haiku-3.5",internal:"claude-3-5-haiku-20241022"},{label:"Haiku 3",slug:"haiku-3",internal:"claude-3-haiku-20240307"},{label:"Opus 3",slug:"opus-3",internal:"claude-3-opus-20240229"}],wo=e=>{const t=e.indexOf("Switch between Claude models");if(t===-1)return console.error("patch: getModelSelectorInsertionPoint: failed to find labelIndex"),null;const n=Math.max(0,t-600),r=t,i=e.slice(n,r).match(/\[[$\w]+,\s*[$\w]+\]\s*=\s*[$\w]+\.useState\([^)]*\)\s*,\s*([$\w]+)=/);if(!i||i.index===void 0)return console.error("patch: getModelSelectorInsertionPoint: failed to find useState"),null;let l=n+i.index;for(;l<e.length&&e[l]!==";";)l++;if(l>=e.length)return console.error("patch: getModelSelectorInsertionPoint: failed to find semicolon"),null;const u=l+1,d=i[1];return{insertionIndex:u,optionsVar:d}},xo=e=>{const t=wo(e);if(!t)return null;const{insertionIndex:n,optionsVar:r}=t,o=ot.map(a=>{const l=JSON.stringify(a.label),u=JSON.stringify(a.slug);return`${r}.push({value:${u},label:${l}});`}).join(""),i=e.slice(0,n)+o+e.slice(n);return V(e,i,o,n,n),i},yo=e=>{let t=e;const n=xo(t);return n&&(t=n),t===e?null:t};let it=!1;const T=()=>it,So=()=>{it=!0};function hn(){try{const e=re.join(ye.homedir(),".claude.json");return JSON.parse(Ce.readFileSync(e,"utf8")).theme||"dark"}catch{}return"dark"}function vo(){try{const e=re.join(ye.homedir(),".claude",".credentials.json");switch(JSON.parse(Ce.readFileSync(e,"utf8"))?.claudeAiOauth?.subscriptionType||"unknown"){case"enterprise":return"Claude Enterprise";case"team":return"Claude Team";case"max":return"Claude Max";case"pro":return"Claude Pro"}}catch{}return"Claude API"}function $o(){try{const e=re.join(ye.homedir(),".claude","settings.json"),n=JSON.parse(Ce.readFileSync(e,"utf8"))?.model||"default";if(n==="opus")return"Opus 4.1";const r=ot.find(o=>o.slug===n);if(r)return r.label}catch{}return"Sonnet 4.5"}function _o(e){process.platform==="win32"?Me.spawn("explorer",[e],{detached:!0,stdio:"ignore"}).unref():process.platform==="darwin"?Me.spawn("open",[e],{detached:!0,stdio:"ignore"}).unref():Me.spawn("xdg-open",[e],{detached:!0,stdio:"ignore"}).unref()}function kn(e){if(process.platform==="win32")Me.spawn("explorer",["/select,",e],{detached:!0,stdio:"ignore"}).unref();else if(process.platform==="darwin")Me.spawn("open",["-R",e],{detached:!0,stdio:"ignore"}).unref();else{const t=re.dirname(e);Me.spawn("xdg-open",[t],{detached:!0,stdio:"ignore"}).unref()}}function gn(e){if(!e||typeof e!="string")return!1;const t=e.trim();if(/^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$/.test(t))return!0;if(/^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)$/.test(t)){const n=t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n){const[,r,o,i]=n;return parseInt(r)<=255&&parseInt(o)<=255&&parseInt(i)<=255}}if(/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(t)){const n=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(n){const[,r,o,i]=n;return parseInt(r)<=360&&parseInt(o)<=100&&parseInt(i)<=100}}return!1}function st(e){if(!gn(e))return e;const t=e.trim();if(t.startsWith("rgb("))return t;if(t.startsWith("#")){let n=t.slice(1);n.length===3&&(n=n.split("").map(a=>a+a).join(""));const r=parseInt(n.slice(0,2),16),o=parseInt(n.slice(2,4),16),i=parseInt(n.slice(4,6),16);return`rgb(${r},${o},${i})`}if(t.startsWith("hsl(")){const n=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(n){const r=parseInt(n[1])/360,o=parseInt(n[2])/100,i=parseInt(n[3])/100,a=(v,b,p)=>(p<0&&(p+=1),p>1&&(p-=1),p<1/6?v+(b-v)*6*p:p<1/2?b:p<2/3?v+(b-v)*(2/3-p)*6:v),l=i<.5?i*(1+o):i+o-i*o,u=2*i-l,d=Math.round(a(u,l,r+1/3)*255),h=Math.round(a(u,l,r)*255),f=Math.round(a(u,l,r-1/3)*255);return`rgb(${d},${h},${f})`}}return e}async function Io(e,t="sha256",n=64*1024){return new Promise((r,o)=>{const i=An.createHash(t),a=Ce.createReadStream(e,{highWaterMark:n});a.on("data",l=>{i.update(l)}),a.on("end",()=>{r(i.digest("hex"))}),a.on("error",l=>{o(l)})})}const Tn=(e,t,n,r,o,i,a,l)=>{let u=e;return t&&(u+=`.rgb(${t})`),n&&n!=="transparent"&&(u+=`.bgRgb(${n})`),r&&(u+=".bold"),o&&(u+=".italic"),i&&(u+=".underline"),a&&(u+=".strikethrough"),l&&(u+=".inverse"),u};async function fn(e,t,n="replace"){let r=493;try{r=(await te.stat(e)).mode,T()&&console.log(`[${n}] Original file mode for ${e}: ${(r&parseInt("777",8)).toString(8)}`)}catch(o){T()&&console.log(`[${n}] Could not stat ${e} (error: ${o}), using default mode 755`)}try{await te.unlink(e),T()&&console.log(`[${n}] Unlinked ${e} to break hard links`)}catch(o){T()&&console.log(`[${n}] Could not unlink ${e}: ${o}`)}await te.writeFile(e,t),await te.chmod(e,r),T()&&console.log(`[${n}] Restored permissions to ${(r&parseInt("777",8)).toString(8)}`)}function F({color:e,backgroundColor:t,bold:n,dimColor:r,children:o}){const i=e?.startsWith("ansi:"),a=t?.startsWith("ansi:");if(i||a){if(Ke.Children.toArray(o).some(f=>Ke.isValidElement(f)))return s(c,{children:o});let u=Q;if(i){const f=e.slice(5);u=u[f]||u}if(a){const f=t.slice(5),v=f.startsWith("bg")?f:`bg${f.charAt(0).toUpperCase()}${f.slice(1)}`;u=u[v]||u}n&&(u=u.bold),r&&(u=u.dim);const h=Ke.Children.toArray(o).map(f=>typeof f=="string"||typeof f=="number"?String(f):"").join("");return s(c,{children:u(h)})}return s(c,{color:e,backgroundColor:t,bold:n,dimColor:r,children:o})}function Co({text:e,nonShimmerColors:t,shimmerColors:n,shimmerWidth:r=3,updateDuration:o=50,restartPoint:i=10}){const[a,l]=O(0);return xe(()=>{const u=setInterval(()=>{l(d=>{const h=d+1;return h>=e.length+i?-r:h})},o);return()=>clearInterval(u)},[e.length,i,o]),t.length!==n.length?(console.error("UltrathinkRainbowShimmer: nonShimmerColors and shimmerColors must have the same length"),s(c,{children:e})):s(c,{children:e.split("").map((u,d)=>{const h=d>=a&&d<a+r&&a<e.length,f=d%t.length,v=h?n[f]:t[f];return s(c,{color:v,children:u},d)})})}const Eo=ft.cwd();function lt({theme:e}){const{ccVersion:t}=be(ue);return g(m,{flexDirection:"column",paddingLeft:1,children:[s(m,{marginBottom:1,children:g(c,{bold:!0,children:["Preview: ",e.name]})}),s(m,{borderStyle:"single",borderColor:"gray",paddingX:1,children:g(m,{flexDirection:"column",children:[g(m,{flexDirection:"column",children:[g(c,{children:[s(F,{color:e.colors.clawd_body,children:" ▐"}),s(c,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"▛███▜"}),g(c,{children:[s(F,{color:e.colors.clawd_body,children:"▌ "})," ",s(c,{bold:!0,children:"Claude Code"})," ",t?`v${t}`:"v2.0.14"]})]}),g(c,{children:[s(F,{color:e.colors.clawd_body,children:"▝▜"}),s(c,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"█████"}),s(F,{color:e.colors.clawd_body,children:"▛▘"})," ",$o()," · ",vo()]}),g(F,{color:e.colors.clawd_body,children:[" ","▘▘ ▝▝"," ",Eo]}),g(c,{children:[g(F,{color:e.colors.success,children:["Login successful. Press"," "]}),s(F,{bold:!0,color:e.colors.success,children:"Enter"}),g(F,{color:e.colors.success,children:[" ","to continue…"]})]})]}),s(c,{children:"╭─────────────────────────────────────────────╮"}),g(c,{children:["│ 1 function greet() ","{"," ","│"]}),g(c,{children:["│ 2"," ",s(F,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:'- console.log("'}),s(F,{backgroundColor:e.colors.diffRemovedWord,children:"Hello, World!"}),s(F,{backgroundColor:e.colors.diffRemoved,children:'");'})," ","│"]}),g(c,{children:["│ 2"," ",s(F,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:'+ console.log("'}),s(F,{backgroundColor:e.colors.diffAddedWord,children:"Hello, Claude!"}),s(F,{backgroundColor:e.colors.diffAdded,children:'");'})," ","│"]}),s(F,{color:e.colors.warning,children:"╭─────────────────────────────────────────────╮"}),g(F,{color:e.colors.warning,children:["│ Do you trust the files in this folder?"," ","│"]}),g(c,{children:[s(F,{color:e.colors.warning,children:"│ "}),s(c,{dimColor:!0,children:"Enter to confirm · Esc to exit"}),g(F,{color:e.colors.warning,children:[" ","│"]})]}),s(F,{color:e.colors.bashBorder,children:"───────────────────────────────────────────────"}),g(c,{children:[s(F,{color:e.colors.bashBorder,children:"!"}),s(c,{children:" ls"})]}),s(F,{color:e.colors.promptBorder,children:"───────────────────────────────────────────────"}),s(c,{children:g(c,{children:["> list the dir"," ",s(Co,{text:"ultrathink",nonShimmerColors:[e.colors.rainbow_red,e.colors.rainbow_orange,e.colors.rainbow_yellow,e.colors.rainbow_green,e.colors.rainbow_blue,e.colors.rainbow_indigo,e.colors.rainbow_violet],shimmerColors:[e.colors.rainbow_red_shimmer,e.colors.rainbow_orange_shimmer,e.colors.rainbow_yellow_shimmer,e.colors.rainbow_green_shimmer,e.colors.rainbow_blue_shimmer,e.colors.rainbow_indigo_shimmer,e.colors.rainbow_violet_shimmer],shimmerWidth:3,updateDuration:50,restartPoint:10})]})}),s(F,{color:e.colors.planMode,children:"╭─────────────────────────────────────────────╮"}),g(c,{children:[s(F,{color:e.colors.planMode,children:"│ "}),g(F,{color:e.colors.permission,children:["Ready to code?"," "]}),s(c,{children:"Here is Claude's plan:"}),g(F,{color:e.colors.planMode,children:[" ","│"]})]}),s(F,{color:e.colors.permission,children:"╭─────────────────────────────────────────────╮"}),g(c,{children:[s(F,{color:e.colors.permission,children:"│ "}),s(c,{bold:!0,children:"Permissions:"})," ",g(F,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[" ","Allow"," "]})," ","Deny"," ","Workspace"," ",s(F,{color:e.colors.permission,children:"│"})]}),s(c,{children:"> list the dir"}),g(c,{children:[s(F,{color:e.colors.error,children:"●"}),s(c,{children:" Update(__init__.py)"})]}),g(c,{children:[s(c,{children:" ⎿ "}),s(F,{color:e.colors.error,children:"User rejected update to __init__.py"})]}),g(c,{children:[" ","1"," ",g(F,{backgroundColor:e.colors.diffRemovedDimmed,children:["- import"," "]}),s(F,{backgroundColor:e.colors.diffRemovedWordDimmed,children:"os"})]}),g(c,{children:[" ","2"," ",g(F,{backgroundColor:e.colors.diffAddedDimmed,children:["+ import"," "]}),s(F,{backgroundColor:e.colors.diffAddedWordDimmed,children:"random"})]}),g(c,{children:[s(F,{color:e.colors.success,children:"●"}),s(c,{children:" List(.)"})]}),g(c,{children:[s(c,{children:"●"}),s(c,{children:" The directory "}),s(F,{color:e.colors.permission,children:"C:\\Users\\user"}),g(c,{children:[" ","contains ",s(c,{bold:!0,children:"123"})," files."]})]}),g(c,{children:[s(F,{color:e.colors.claude,children:"✻ Th"}),s(F,{color:e.colors.claudeShimmer,children:"ink"}),s(F,{color:e.colors.claude,children:"ing… "}),s(c,{children:"(esc to interrupt)"})]}),s(c,{children:s(F,{color:e.colors.autoAccept,children:"⏵⏵ accept edits on (shift+tab to cycle)"})}),s(c,{children:s(F,{color:e.colors.planMode,children:"⏸ plan mode on (shift+tab to cycle)"})}),s(c,{children:s(F,{color:e.colors.ide,children:"◯ IDE connected ⧉ 44 lines selected"})})]})})]})}function Xe({colorKey:e,theme:t,bold:n=!1}){const r=t.colors[e];return e==="inverseText"?s(F,{color:r,backgroundColor:t.colors.permission,bold:n,children:e}):e.startsWith("diff")?s(F,{backgroundColor:r,bold:n,color:t.colors.text,children:e}):s(F,{color:r,bold:n,children:e})}function at({initialValue:e,onColorChange:t,onExit:n,colorKey:r,theme:o}){const i=Qe(e)||{h:0,s:50,l:50},a=Ze(e)||{r:128,g:128,b:128},[l,u]=O(i),[d,h]=O(a),[f,v]=O("hsl"),[b,p]=O("h"),[w,x]=O(!1),[C,_]=O(!1);xe(()=>{const I=Qe(e),$=Ze(e);I&&$&&(x(!0),u(I),h($),x(!1))},[e]),xe(()=>{if(!w&&C){const I=`rgb(${d.r},${d.g},${d.b})`;t(I)}},[l,d,w,C]),xe(()=>{_(!0)},[]);const k=I=>{if(gn(I)){const $=st(I),S=Qe($),N=Ze($);S&&N&&(x(!0),u(S),h(N),x(!1))}};de((I,$)=>{if(I.length>1&&!$.ctrl&&!$.meta){k(I);return}if($.return)n();else if($.escape)n();else if($.ctrl&&I==="a")v(S=>S==="hsl"?"rgb":"hsl"),p(S=>f==="hsl"?S==="h"?"r":S==="s"?"g":"b":S==="r"?"h":S==="g"?"s":"l");else if($.upArrow)p(f==="hsl"?S=>S==="h"?"l":S==="s"?"h":"s":S=>S==="r"?"b":S==="g"?"r":"g");else if($.downArrow||$.tab)p(f==="hsl"?S=>S==="h"?"s":S==="s"?"l":"h":S=>S==="r"?"g":S==="g"?"b":"r");else if($.leftArrow){const S=$.shift||$.ctrl||$.meta?-10:-1;P(S)}else if($.rightArrow){const S=$.shift||$.ctrl||$.meta?10:1;P(S)}});const P=I=>{x(!0),f==="hsl"?u($=>{const S={...$};b==="h"?S.h=Math.max(0,Math.min(359,$.h+I)):b==="s"?S.s=Math.max(0,Math.min(100,$.s+I)):b==="l"&&(S.l=Math.max(0,Math.min(100,$.l+I)));const[N,y,D]=j(S.h,S.s,S.l);return h({r:N,g:y,b:D}),S}):h($=>{const S={...$};b==="r"?S.r=Math.max(0,Math.min(255,$.r+I)):b==="g"?S.g=Math.max(0,Math.min(255,$.g+I)):b==="b"&&(S.b=Math.max(0,Math.min(255,$.b+I)));const N=B(S.r,S.g,S.b);return u(N),S}),x(!1)},B=(I,$,S)=>{const N=I/255,y=$/255,D=S/255,z=Math.max(N,y,D),G=Math.min(N,y,D),ne=z-G,se=(z+G)/2;let $e=0;ne!==0&&($e=se>.5?ne/(2-z-G):ne/(z+G));let we=0;return ne!==0&&(z===N?we=((y-D)/ne+(y<D?6:0))/6:z===y?we=((D-N)/ne+2)/6:we=((N-y)/ne+4)/6),{h:Math.round(we*360),s:Math.round($e*100),l:Math.round(se*100)}},j=(I,$,S)=>{I/=360,$/=100,S/=100;const N=(1-Math.abs(2*S-1))*$,y=N*(1-Math.abs(I*6%2-1)),D=S-N/2;let z=0,G=0,ne=0;return 0<=I&&I<1/6?(z=N,G=y,ne=0):1/6<=I&&I<2/6?(z=y,G=N,ne=0):2/6<=I&&I<3/6?(z=0,G=N,ne=y):3/6<=I&&I<4/6?(z=0,G=y,ne=N):4/6<=I&&I<5/6?(z=y,G=0,ne=N):5/6<=I&&I<1&&(z=N,G=0,ne=y),[Math.round((z+D)*255),Math.round((G+D)*255),Math.round((ne+D)*255)]},q=()=>{const I=[],$=[[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 S=0;S<40;S++){const y=S/39*($.length-1),D=Math.floor(y),z=Math.ceil(y),G=y-D,[ne,se,$e]=$[D],[we,H,R]=$[z],L=Math.round(ne+(we-ne)*G),ee=Math.round(se+(H-se)*G),W=Math.round($e+(R-$e)*G);I.push(s(c,{backgroundColor:`rgb(${L},${ee},${W})`,children:" "},S))}return I},U=()=>{const I=[];for(let $=0;$<40;$++){const S=$/39*100,[N,y,D]=j(l.h,S,l.l);I.push(s(c,{backgroundColor:`rgb(${N},${y},${D})`,children:" "},$))}return I},A=()=>{const I=[];for(let $=0;$<40;$++){const S=$/39*100,[N,y,D]=j(l.h,l.s,S);I.push(s(c,{backgroundColor:`rgb(${N},${y},${D})`,children:" "},$))}return I},M=()=>{const[I,$,S]=j(l.h,l.s,l.l);return`rgb(${I},${$},${S})`},E=(I,$,S)=>{const N=y=>y.toString(16).padStart(2,"0");return`#${N(I)}${N($)}${N(S)}`},Y=()=>{const I=[];for(let $=0;$<40;$++){const S=Math.round($/39*255);I.push(s(c,{backgroundColor:`rgb(${S},${d.g},${d.b})`,children:" "},$))}return I},X=()=>{const I=[];for(let $=0;$<40;$++){const S=Math.round($/39*255);I.push(s(c,{backgroundColor:`rgb(${d.r},${S},${d.b})`,children:" "},$))}return I},oe=()=>{const I=[];for(let $=0;$<40;$++){const S=Math.round($/39*255);I.push(s(c,{backgroundColor:`rgb(${d.r},${d.g},${S})`,children:" "},$))}return I},K=(I,$)=>Math.round(I/$*39);return g(m,{flexDirection:"column",borderStyle:"single",borderColor:"white",padding:1,children:[g(m,{flexDirection:"column",children:[s(c,{bold:!0,children:"Color Picker"}),g(m,{marginBottom:1,flexDirection:"column",children:[s(c,{color:"gray",dimColor:!0,children:"←→ to adjust (shift/ctrl/cmd +10)"}),s(c,{color:"gray",dimColor:!0,children:"↑↓ to change bar"}),s(c,{color:"gray",dimColor:!0,children:"ctrl+a to switch rgb/hsl"}),s(c,{color:"gray",dimColor:!0,children:"paste color from clipboard"}),s(c,{color:"gray",dimColor:!0,children:"enter to exit (auto-saved)"}),s(c,{color:"gray",dimColor:!0,children:"esc to save and exit"})]})]}),f==="hsl"?g(me,{children:[g(m,{marginBottom:1,children:[s(m,{width:25,children:g(c,{color:b==="h"?"yellow":"white",children:[b==="h"?"❯ ":" ","Hue (",l.h,"°):"]})}),s(m,{children:q().map((I,$)=>s(Ee,{children:$===K(l.h,360)?s(c,{children:"|"}):I},$))})]}),g(m,{marginBottom:1,children:[s(m,{width:25,children:g(c,{color:b==="s"?"yellow":"white",children:[b==="s"?"❯ ":" ","Saturation (",l.s,"%):"]})}),s(m,{children:U().map((I,$)=>s(Ee,{children:$===K(l.s,100)?s(c,{children:"|"}):I},$))})]}),g(m,{marginBottom:1,children:[s(m,{width:25,children:g(c,{color:b==="l"?"yellow":"white",children:[b==="l"?"❯ ":" ","Lightness (",l.l,"%):"]})}),s(m,{children:A().map((I,$)=>s(Ee,{children:$===K(l.l,100)?s(c,{children:"|"}):I},$))})]})]}):g(me,{children:[g(m,{marginBottom:1,children:[s(m,{width:25,children:g(c,{color:b==="r"?"yellow":"white",children:[b==="r"?"❯ ":" ","Red (",d.r,"):"]})}),s(m,{children:Y().map((I,$)=>s(Ee,{children:$===K(d.r,255)?s(c,{children:"|"}):I},$))})]}),g(m,{marginBottom:1,children:[s(m,{width:25,children:g(c,{color:b==="g"?"yellow":"white",children:[b==="g"?"❯ ":" ","Green (",d.g,"):"]})}),s(m,{children:X().map((I,$)=>s(Ee,{children:$===K(d.g,255)?s(c,{children:"|"}):I},$))})]}),g(m,{marginBottom:1,children:[s(m,{width:25,children:g(c,{color:b==="b"?"yellow":"white",children:[b==="b"?"❯ ":" ","Blue (",d.b,"):"]})}),s(m,{children:oe().map((I,$)=>s(Ee,{children:$===K(d.b,255)?s(c,{children:"|"}):I},$))})]})]}),g(m,{marginBottom:1,children:[s(c,{children:"Current: "}),s(c,{backgroundColor:M(),children:" "})]}),g(m,{flexDirection:"row",justifyContent:"space-between",children:[g(m,{flexDirection:"column",children:[s(c,{dimColor:!0,children:"Hex "}),r?.startsWith("diff")?s(c,{backgroundColor:M(),color:o?.colors?.text||"white",bold:!0,children:E(d.r,d.g,d.b)}):r==="inverseText"?s(c,{color:M(),backgroundColor:o?.colors?.permission,bold:!0,children:E(d.r,d.g,d.b)}):s(c,{color:M(),bold:!0,children:E(d.r,d.g,d.b)})]}),g(m,{flexDirection:"column",children:[s(c,{dimColor:!0,children:"RGB "}),r?.startsWith("diff")?s(c,{backgroundColor:M(),color:o?.colors?.text||"white",bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):r==="inverseText"?s(c,{color:M(),backgroundColor:o?.colors?.permission,bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):s(c,{color:M(),bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`})]}),g(m,{flexDirection:"column",children:[s(c,{dimColor:!0,children:"HSL "}),r?.startsWith("diff")?s(c,{backgroundColor:M(),color:o?.colors?.text||"white",bold:!0,children:`hsl(${l.h}, ${l.s}%, ${l.l}%)`}):r==="inverseText"?s(c,{color:M(),backgroundColor:o?.colors?.permission,bold:!0,children:`hsl(${l.h}, ${l.s}%, ${l.l}%)`}):s(c,{color:M(),bold:!0,children:`hsl(${l.h}, ${l.s}%, ${l.l}%)`})]})]})]})}function Ze(e){const t=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t)return{r:parseInt(t[1]),g:parseInt(t[2]),b:parseInt(t[3])};const n=e.match(/^#([a-fA-F0-9]{6})$/);if(n){const r=n[1];return{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16)}}return null}function Qe(e){const t=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(t)return{h:parseInt(t[1]),s:parseInt(t[2]),l:parseInt(t[3])};const n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n){const o=parseInt(n[1])/255,i=parseInt(n[2])/255,a=parseInt(n[3])/255,l=Math.max(o,i,a),u=Math.min(o,i,a),d=l-u,h=(l+u)/2;let f=0;d!==0&&(f=h>.5?d/(2-l-u):d/(l+u));let v=0;return d!==0&&(l===o?v=((i-a)/d+(i<a?6:0))/6:l===i?v=((a-o)/d+2)/6:v=((o-i)/d+4)/6),{h:Math.round(v*360),s:Math.round(f*100),l:Math.round(h*100)}}const r=e.match(/^#([a-fA-F0-9]{6})$/);if(r){const o=r[1],i=parseInt(o.substr(0,2),16)/255,a=parseInt(o.substr(2,2),16)/255,l=parseInt(o.substr(4,2),16)/255,u=Math.max(i,a,l),d=Math.min(i,a,l),h=u-d,f=(u+d)/2;let v=0;h!==0&&(v=f>.5?h/(2-u-d):h/(u+d));let b=0;return h!==0&&(u===i?b=((a-l)/h+(a<l?6:0))/6:u===a?b=((l-i)/h+2)/6:b=((i-a)/h+4)/6),{h:Math.round(b*360),s:Math.round(v*100),l:Math.round(f*100)}}return{h:0,s:50,l:50}}function ko({onBack:e,themeId:t}){const{settings:{themes:n},updateSettings:r}=be(ue),[o,i]=O(t),a=n.find(A=>A.id===o)||n[0],[l,u]=O("rgb"),[d,h]=O(0),[f,v]=O(null),[b,p]=O(null),[w,x]=O(""),[C,_]=O(""),k=Nn(A=>{r(M=>{const E=M.themes.findIndex(Y=>Y.id===o);E!==-1&&A(M.themes[E])})},[o,r]),P=A=>{if(d>=2&&gn(A)){const M=st(A),E=d-2,Y=B[E];k(X=>{X.colors[Y]=M})}};de((A,M)=>{if(f===null&&b===null){if(A.length>1&&!M.ctrl&&!M.meta){P(A);return}if(M.escape)e();else if(M.ctrl&&A==="a")u(E=>E==="rgb"?"hex":E==="hex"?"hsl":"rgb");else if(M.upArrow)h(E=>Math.max(0,E-1));else if(M.downArrow)h(E=>Math.min(B.length+1,E+1));else if(M.return)if(d===0)p("name"),x(a.name),_(a.name);else if(d===1)p("id"),x(a.id),_(a.id);else{const E=d-2,Y=B[E],X=a.colors[Y];v(E),x(X),_(X)}}else if(f!==null)M.ctrl&&A==="a"&&u(E=>E==="rgb"?"hex":E==="hex"?"hsl":"rgb");else if(b!==null)if(M.return){if(b==="id"){const E=o;i(w),r(Y=>{const X=Y.themes.findIndex(oe=>oe.id===E);X!==-1&&(Y.themes[X].id=w)})}else k(E=>{E.name=w});p(null),x(""),_("")}else M.escape?(p(null),x(""),_("")):M.backspace||M.delete?x(E=>E.slice(0,-1)):A&&x(E=>E+A)});const B=Object.keys(a.colors),j=(A,M)=>{const E=A.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!E)return A;const Y=parseInt(E[1]),X=parseInt(E[2]),oe=parseInt(E[3]);switch(M){case"hex":{const K=I=>I.toString(16).padStart(2,"0");return`#${K(Y)}${K(X)}${K(oe)}`}case"hsl":{const K=Y/255,I=X/255,$=oe/255,S=Math.max(K,I,$),N=Math.min(K,I,$),y=S-N,D=(S+N)/2;let z=0;y!==0&&(z=D>.5?y/(2-S-N):y/(S+N));let G=0;return y!==0&&(S===K?G=((I-$)/y+(I<$?6:0))/6:S===I?G=(($-K)/y+2)/6:G=((K-I)/y+4)/6),`hsl(${Math.round(G*360)}, ${Math.round(z*100)}%, ${Math.round(D*100)}%)`}case"rgb":default:return A}},q=A=>({autoAccept:"Auto-accept edits mode indicator",bashBorder:"Bash command border",claude:"Claude branding color. Used for the Claude logo, the welcome message, and the thinking text.",claudeShimmer:"Color used for the shimmering effect on the thinking verb.",claudeBlue_FOR_SYSTEM_SPINNER:"System spinner color (blue variant)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"System spinner shimmer color (blue variant)",permission:"Permission prompt color",permissionShimmer:"Permission prompt shimmer color",planMode:"Plan mode indicator",ide:"Color used for IDE-related messages.",promptBorder:"Input prompt border color",promptBorderShimmer:"Input prompt border shimmer color",text:"Code color. Used in diffs.",inverseText:"Inverse text color. Used for the text of tabs, where the background is filled in.",inactive:"Inactive/dimmed text. Used for line numbers and less prominent text.",subtle:"Subtle text. Used for help text and secondary information.",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.",background:"Background color for certain UI elements",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",warningShimmer:"Warning shimmer color",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)",red_FOR_SUBAGENTS_ONLY:"Red color for sub agents",blue_FOR_SUBAGENTS_ONLY:"Blue color for sub agents",green_FOR_SUBAGENTS_ONLY:"Green color for sub agents",yellow_FOR_SUBAGENTS_ONLY:"Yellow color for sub agents",purple_FOR_SUBAGENTS_ONLY:"Purple color for sub agents",orange_FOR_SUBAGENTS_ONLY:"Orange color for sub agents",pink_FOR_SUBAGENTS_ONLY:"Pink color for sub agents",cyan_FOR_SUBAGENTS_ONLY:"Cyan color for sub agents",professionalBlue:"Professional blue color for business contexts?",rainbow_red:'"ultrathink" rainbow - red',rainbow_orange:'"ultrathink" rainbow - orange',rainbow_yellow:'"ultrathink" rainbow - yellow',rainbow_green:'"ultrathink" rainbow - green',rainbow_blue:'"ultrathink" rainbow - blue',rainbow_indigo:'"ultrathink" rainbow - indigo',rainbow_violet:'"ultrathink" rainbow - violet',rainbow_red_shimmer:'"ultrathink" rainbow (shimmer) - red',rainbow_orange_shimmer:'"ultrathink" rainbow (shimmer) - orange',rainbow_yellow_shimmer:'"ultrathink" rainbow (shimmer) - yellow',rainbow_green_shimmer:'"ultrathink" rainbow (shimmer) - green',rainbow_blue_shimmer:'"ultrathink" rainbow (shimmer) - blue',rainbow_indigo_shimmer:'"ultrathink" rainbow (shimmer) - indigo',rainbow_violet_shimmer:'"ultrathink" rainbow (shimmer) - violet',clawd_body:'"Clawd" character body color',clawd_background:'"Clawd" character background color',userMessageBackground:"Background color for user messages",bashMessageBackgroundColor:"Background color for bash command output",memoryBackgroundColor:"Background color for memory/context information",rate_limit_fill:"Rate limit indicator fill color",rate_limit_empty:"Rate limit indicator empty/background color"})[A]||"",U=Math.max(...B.map(A=>A.length));return g(m,{children:[g(m,{flexDirection:"column",width:"50%",children:[s(m,{children:g(pe,{children:["Editing theme “",a.name,"” (",a.id,")"]})}),f===null&&b===null?g(me,{children:[g(m,{marginBottom:1,flexDirection:"column",children:[s(c,{dimColor:!0,children:"enter to edit theme name, id, or color"}),s(c,{dimColor:!0,children:"ctrl+a to toggle rgb, hex, hsl"}),s(c,{dimColor:!0,children:"paste color from clipboard (when on color)"}),s(c,{dimColor:!0,children:"esc to go back"})]}),d<2?g(m,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:"yellow",flexDirection:"column",paddingLeft:1,children:[s(c,{bold:!0,children:d===0?"Theme Name":"Theme ID"}),s(c,{children:d===0?"The display name for this theme":"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):g(m,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:a.colors[B[d-2]],flexDirection:"column",paddingLeft:1,children:[s(Xe,{colorKey:B[d-2],theme:a,bold:!0}),s(c,{children:q(B[d-2])})]}),g(m,{flexDirection:"column",children:[g(m,{children:[s(c,{color:d===0?"yellow":"white",children:d===0?"❯ ":" "}),s(c,{bold:!0,children:"Name: "}),s(c,{children:a.name})]}),g(m,{marginBottom:1,children:[s(c,{color:d===1?"yellow":"white",children:d===1?"❯ ":" "}),s(c,{bold:!0,children:"ID: "}),s(c,{children:a.id})]}),(()=>{if(d<2){const K=B.slice(0,20);return g(me,{children:[K.map((I,$)=>{const S=$+2;return g(m,{children:[s(c,{color:d===S?"yellow":"white",children:d===S?"❯ ":" "}),s(m,{width:U+2,children:s(c,{children:s(Xe,{colorKey:I,theme:a,bold:!0})})}),s(F,{color:a.colors[I],children:j(a.colors[I],l)})]},I)}),B.length>20&&g(c,{color:"gray",dimColor:!0,children:[" ","↓ ",B.length-20," more below"]})]})}const M=d-2,E=Math.max(0,M-Math.floor(20/2)),Y=Math.min(B.length,E+20),X=Math.max(0,Y-20),oe=B.slice(X,Y);return g(me,{children:[X>0&&g(c,{color:"gray",dimColor:!0,children:[" ","↑ ",X," more above"]}),oe.map((K,I)=>{const S=X+I+2;return g(m,{children:[s(c,{color:d===S?"yellow":"white",children:d===S?"❯ ":" "}),s(m,{width:U+2,children:s(c,{children:s(Xe,{colorKey:K,theme:a,bold:!0})})}),s(F,{color:a.colors[K],children:j(a.colors[K],l)})]},K)}),Y<B.length&&g(c,{color:"gray",dimColor:!0,children:[" ","↓ ",B.length-Y," more below"]})]})})()]})]}):b?g(m,{flexDirection:"column",marginTop:1,children:[g(c,{children:["Editing ",b==="name"?"theme name":"theme ID",":"]}),s(m,{borderStyle:"round",borderColor:"yellow",paddingX:1,children:s(c,{children:w})}),s(c,{dimColor:!0,children:"enter to save, esc to cancel"})]}):s(at,{initialValue:C,colorKey:B[f],theme:a,onColorChange:A=>{x(A),k(M=>{M.colors[B[f]]=A})},onExit:()=>{k(A=>{A.colors[B[f]]=w}),v(null),x(""),_("")}})]}),s(m,{width:"50%",children:s(lt,{theme:a})})]})}function To(e){return e.map(t=>`${t.name} (${t.id})`)}function Mo({onBack:e}){const{settings:{themes:t},updateSettings:n}=be(ue),[r,o]=O(0),[i,a]=O(null),[l,u]=O(!0),d=()=>{const w={colors:{...(t[0]||Z.themes[0]).colors},name:"New Custom Theme",id:`custom-${Date.now()}`};n(x=>{x.themes.push(w)}),a(w.id),u(!1)},h=p=>{t.length<=1||(n(w=>{w.themes=w.themes.filter(x=>x.id!==p)}),r>=t.length-1&&o(Math.max(0,t.length-2)))},f=()=>{n(p=>{p.themes=[...Z.themes]}),o(0)};if(de((p,w)=>{if(w.escape)e();else if(w.upArrow)o(x=>Math.max(0,x-1));else if(w.downArrow)o(x=>Math.min(t.length-1,x+1));else if(w.return){const x=t[r];x&&(a(x.id),u(!1))}else if(p==="n")d();else if(p==="d"){const x=t[r];x&&h(x.id)}else w.ctrl&&p==="r"&&f()},{isActive:l}),i)return s(ko,{themeId:i,onBack:()=>{a(null),u(!0)}});const v=To(t),b=t.find(p=>v[r]?.includes(`(${p.id})`))||t[0];return t.length===0?s(m,{children:g(m,{flexDirection:"column",width:"100%",children:[s(pe,{children:"Themes"}),g(m,{marginBottom:1,flexDirection:"column",children:[s(c,{dimColor:!0,children:"n to create a new theme"}),s(c,{dimColor:!0,children:"esc to go back"})]}),s(c,{children:"No themes available!"})]})}):g(m,{children:[g(m,{flexDirection:"column",width:"50%",children:[s(pe,{children:"Themes"}),g(m,{marginBottom:1,flexDirection:"column",children:[s(c,{dimColor:!0,children:"n to create a new theme"}),s(c,{dimColor:!0,children:"d to delete a theme"}),s(c,{dimColor:!0,children:"ctrl+r to delete all themes and restore built-in"}),s(c,{dimColor:!0,children:"enter to edit theme"}),s(c,{dimColor:!0,children:"esc to go back"})]}),s(m,{flexDirection:"column",children:v.map((p,w)=>g(c,{color:r===w?"yellow":void 0,children:[r===w?"❯ ":" ",p]},w))})]}),s(m,{width:"50%",children:s(lt,{theme:b})})]})}function No({onBack:e}){const{settings:{thinkingVerbs:{format:t,verbs:n},themes:r},updateSettings:o}=be(ue),i=["format","verbs"],[a,l]=O(0),u=i[a],[d,h]=O(0),[f,v]=O(!1),[b,p]=O(""),[w,x]=O(!1),[C,_]=O(!1),[k,P]=O(t),B=hn(),q=(r.find(A=>A.id===B)||r.find(A=>A.id==="dark"))?.colors.claude||"rgb(215,119,87)";de((A,M)=>{if(C){M.return?(o(E=>{E.thinkingVerbs.format=k}),_(!1)):M.escape?(P(t),_(!1)):M.backspace||M.delete?P(E=>E.slice(0,-1)):A&&P(E=>E+A);return}if(f||w){M.return&&b.trim()?(w?(o(E=>{E.thinkingVerbs.verbs.push(b.trim())}),x(!1)):(o(E=>{E.thinkingVerbs.verbs[d]=b.trim()}),v(!1)),p("")):M.escape?(p(""),v(!1),x(!1)):M.backspace||M.delete?p(E=>E.slice(0,-1)):A&&p(E=>E+A);return}M.escape?e():M.return?u==="format"&&(P(t),_(!0)):M.tab?M.shift?l(E=>E===0?i.length-1:E-1):l(E=>E===i.length-1?0:E+1):M.upArrow?u==="verbs"&&n.length>0&&h(E=>E>0?E-1:n.length-1):M.downArrow?u==="verbs"&&n.length>0&&h(E=>E<n.length-1?E+1:0):A==="e"&&u==="verbs"?n.length>0&&(p(n[d]),v(!0)):A==="d"&&u==="verbs"?n.length>1&&(o(E=>{E.thinkingVerbs.verbs=E.thinkingVerbs.verbs.filter((Y,X)=>X!==d)}),d>=n.length-1&&h(Math.max(0,n.length-2))):A==="n"&&u==="verbs"?(x(!0),p("")):M.ctrl&&A==="r"&&u==="verbs"&&(o(E=>{E.thinkingVerbs.verbs=[...Z.thinkingVerbs.verbs]}),h(0))});const U=50;return g(m,{children:[g(m,{flexDirection:"column",width:`${100-U}%`,children:[g(m,{marginBottom:1,flexDirection:"column",children:[s(pe,{children:"Thinking Verbs"}),g(m,{flexDirection:"column",children:[s(c,{dimColor:!0,children:u==="format"?"enter to edit format":"changes auto-saved"}),s(c,{dimColor:!0,children:"esc to go back"}),s(c,{dimColor:!0,children:"tab to switch sections"})]})]}),s(m,{marginBottom:1,children:s(c,{dimColor:!0,children:"Customize the verbs shown during generation and their format."})}),g(m,{flexDirection:"column",children:[g(c,{children:[s(c,{color:u==="format"?"yellow":void 0,children:u==="format"?"❯ ":" "}),s(c,{bold:!0,color:u==="format"?"yellow":void 0,children:"Format"})]}),u==="format"&&(C?g(c,{dimColor:!0,children:[" ","enter to save"]}):g(c,{dimColor:!0,children:[" ","enter to edit"]}))]}),s(m,{marginLeft:2,marginBottom:1,children:s(m,{borderStyle:"round",borderColor:C?"yellow":"gray",children:s(c,{children:C?k:t})})}),s(m,{children:g(c,{children:[s(c,{color:u==="verbs"?"yellow":void 0,children:u==="verbs"?"❯ ":" "}),s(c,{bold:!0,color:u==="verbs"?"yellow":void 0,children:"Verbs"})]})}),u==="verbs"&&s(m,{flexDirection:"column",children:g(c,{dimColor:!0,children:[" ","e to edit · d to delete · n to add new · ctrl+r to reset"]})}),s(m,{marginLeft:2,marginBottom:1,children:g(m,{flexDirection:"column",children:[(()=>{const M=Math.max(0,d-Math.floor(4)),E=Math.min(n.length,M+8),Y=Math.max(0,E-8),X=n.slice(Y,E);return g(me,{children:[Y>0&&g(c,{color:"gray",dimColor:!0,children:[" ","↑ ",Y," more above"]}),X.map((oe,K)=>{const I=Y+K;return g(c,{color:u==="verbs"&&I===d?"cyan":void 0,children:[u==="verbs"&&I===d?"❯ ":" ",oe]},I)}),E<n.length&&g(c,{color:"gray",dimColor:!0,children:[" ","↓ ",n.length-E," more below"]})]})})(),w&&g(m,{alignItems:"center",children:[s(c,{color:"yellow",children:"❯ "}),s(m,{borderStyle:"round",borderColor:"yellow",children:s(c,{children:b})})]}),f&&g(m,{marginTop:1,alignItems:"center",children:[s(c,{children:"Editing: "}),s(m,{borderStyle:"round",borderColor:"yellow",children:s(c,{children:b})})]})]})})]}),g(m,{width:`${U}%`,flexDirection:"column",children:[s(m,{marginBottom:1,children:s(c,{bold:!0,children:"Preview"})}),s(m,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:g(c,{children:[g(c,{color:q,children:["✻ ",t.replace(/\{\}/g,n[d])," "]}),s(c,{children:"(esc to interrupt)"})]})})]})]})}const _e=[{name:"Default",phases:Z.thinkingStyle.phases,reverseMirror:Z.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 Bo({onBack:e}){const{settings:{thinkingStyle:{phases:t,updateInterval:n,reverseMirror:r},themes:o},updateSettings:i}=be(ue),a=["reverseMirror","updateInterval","phases","presets"],[l,u]=O(0),d=a[l],[h,f]=O(0),[v,b]=O(0),[p,w]=O(!1),[x,C]=O(""),[_,k]=O(!1),[P,B]=O(!1),[j,q]=O(n.toString()),[U,A]=O(0),M=hn(),Y=(o.find(S=>S.id===M)||o.find(S=>S.id==="dark"))?.colors.claude||"rgb(215,119,87)";xe(()=>{if(t.length>0){const S=r?[...t,...[...t].reverse().slice(1,-1)]:t,N=setInterval(()=>{A(y=>(y+1)%S.length)},n);return()=>clearInterval(N)}},[t,n,r]),de((S,N)=>{if(P){if(N.return){const y=parseInt(j);!isNaN(y)&&y>0&&i(D=>{D.thinkingStyle.updateInterval=y}),B(!1)}else N.escape?(q(n.toString()),B(!1)):N.backspace||N.delete?q(y=>y.slice(0,-1)):S&&S.match(/^[0-9]$/)&&q(y=>y+S);return}if(p||_){if(N.return&&x.length){const y=_?[...t,x]:t.map((D,z)=>z===h?x:D);i(D=>{D.thinkingStyle.phases=y}),w(!1),C("")}else N.escape?(C(""),w(!1),k(!1)):N.backspace||N.delete?C(y=>y.slice(0,-1)):S&&C(y=>y+S);return}if(N.escape)e();else if(N.return)if(d==="updateInterval")q(n.toString()),B(!0);else if(d==="presets"){const y=_e[v];i(D=>{D.thinkingStyle.phases=[...y.phases],D.thinkingStyle.reverseMirror=y.reverseMirror})}else d==="reverseMirror"&&i(y=>{y.thinkingStyle.reverseMirror=!y.thinkingStyle.reverseMirror});else if(N.tab)N.shift?u(y=>y===0?a.length-1:y-1):u(y=>y===a.length-1?0:y+1);else if(N.upArrow)d==="phases"&&t.length>0?f(y=>y>0?y-1:t.length-1):d==="presets"&&b(y=>y>0?y-1:_e.length-1);else if(N.downArrow)d==="phases"&&t.length>0?f(y=>y<t.length-1?y+1:0):d==="presets"&&b(y=>y<_e.length-1?y+1:0);else if(S===" ")d==="reverseMirror"&&i(y=>{y.thinkingStyle.reverseMirror=!y.thinkingStyle.reverseMirror});else if(S==="e"&&d==="phases")t.length>0&&(C(t[h]),w(!0));else if(S==="a"&&d==="phases")k(!0),C("");else if(S==="d"&&d==="phases")t.length>1&&(i(y=>{y.thinkingStyle.phases=t.filter((D,z)=>z!==h)}),h>=t.length&&f(Math.max(0,t.length-1)));else if(S==="w"&&d==="phases"){if(h>0){const y=[...t];[y[h-1],y[h]]=[y[h],y[h-1]],i(D=>{D.thinkingStyle.phases=y}),f(D=>D-1)}}else if(S==="s"&&d==="phases"){if(h<t.length-1){const y=[...t];[y[h],y[h+1]]=[y[h+1],y[h]],i(D=>{D.thinkingStyle.phases=y}),f(D=>D+1)}}else N.ctrl&&S==="r"&&(i(y=>{y.thinkingStyle=Z.thinkingStyle}),f(0),b(0))});const X=r?"●":"○",oe=50,I=r?[...t,...[...t].reverse().slice(1,-1)]:t,$=I.length>0?I[U]:"·";return s(m,{children:g(m,{flexDirection:"column",width:"100%",children:[g(m,{flexDirection:"row",width:"100%",children:[g(m,{marginBottom:1,flexDirection:"column",width:`${100-oe}%`,children:[s(pe,{children:"Thinking style"}),g(m,{flexDirection:"column",children:[g(c,{dimColor:!0,children:["enter to"," ",d==="updateInterval"?"edit interval":d==="presets"?"apply preset":"save"]}),s(c,{dimColor:!0,children:"esc to go back"}),s(c,{dimColor:!0,children:"tab to switch sections"})]})]}),g(m,{width:`${oe}%`,flexDirection:"column",children:[s(m,{children:s(c,{bold:!0,children:"Preview"})}),g(m,{borderStyle:"single",borderColor:"gray",paddingX:1,flexDirection:"row",children:[s(m,{width:($?.length??0)+1,children:s(c,{color:Y,children:$})}),g(c,{children:[s(c,{color:Y,children:"Thinking… "}),s(c,{children:"(esc to interrupt)"})]})]})]})]}),g(m,{flexDirection:"row",gap:4,children:[g(m,{flexDirection:"column",children:[g(c,{children:[s(c,{color:d==="reverseMirror"?"yellow":void 0,children:d==="reverseMirror"?"❯ ":" "}),s(c,{bold:!0,color:d==="reverseMirror"?"yellow":void 0,children:"Reverse-mirror phases"})]}),d==="reverseMirror"&&g(c,{dimColor:!0,children:[" ","space to toggle"]}),s(m,{marginLeft:2,marginBottom:1,children:g(c,{children:[X," ",r?"Enabled":"Disabled"]})})]}),g(m,{flexDirection:"column",children:[g(c,{children:[s(c,{color:d==="updateInterval"?"yellow":void 0,children:d==="updateInterval"?"❯ ":" "}),s(c,{bold:!0,color:d==="updateInterval"?"yellow":void 0,children:"Update interval (ms)"})]}),d==="updateInterval"&&(P?g(c,{dimColor:!0,children:[" ","enter to save"]}):g(c,{dimColor:!0,children:[" ","enter to edit"]})),s(m,{marginLeft:2,marginBottom:1,children:s(m,{borderStyle:"round",borderColor:P?"yellow":"gray",children:s(c,{children:P?j:n})})})]})]}),s(m,{children:g(c,{children:[s(c,{color:d==="phases"?"yellow":void 0,children:d==="phases"?"❯ ":" "}),s(c,{bold:!0,color:d==="phases"?"yellow":void 0,children:"Phases"})]})}),d==="phases"&&s(m,{marginBottom:1,flexDirection:"column",children:g(c,{dimColor:!0,children:[" ","[e]dit"," ","[a]dd"," ","[d]elete"," ","[w]move up"," ","[s]move down"]})}),s(m,{marginLeft:2,marginBottom:1,children:g(m,{flexDirection:"column",children:[(()=>{const N=Math.max(0,h-Math.floor(4)),y=Math.min(t.length,N+8),D=Math.max(0,y-8),z=t.slice(D,y);return g(me,{children:[D>0&&g(c,{color:"gray",dimColor:!0,children:[" ","↑ ",D," more above"]}),z.map((G,ne)=>{const se=D+ne;return g(c,{color:d==="phases"&&se===h?"cyan":void 0,children:[d==="phases"&&se===h?"❯ ":" ",G]},se)}),y<t.length&&g(c,{color:"gray",dimColor:!0,children:[" ","↓ ",t.length-y," more below"]})]})})(),_&&g(m,{children:[s(c,{color:"yellow",children:"❯ "}),s(m,{borderStyle:"round",borderColor:"yellow",children:s(c,{children:x})})]}),p&&g(m,{marginTop:1,children:[s(c,{children:"Editing: "}),s(m,{borderStyle:"round",borderColor:"yellow",children:s(c,{children:x})})]})]})}),s(m,{children:g(c,{children:[s(c,{color:d==="presets"?"yellow":void 0,children:d==="presets"?"❯ ":" "}),s(c,{bold:!0,color:d==="presets"?"yellow":void 0,children:"Presets"})]})}),d==="presets"&&g(c,{dimColor:!0,children:[" ","Selecting one will overwrite your choice of phases"]}),s(m,{marginLeft:2,marginBottom:1,children:s(m,{flexDirection:"column",children:(()=>{const N=Math.max(0,v-Math.floor(4)),y=Math.min(_e.length,N+8),D=Math.max(0,y-8),z=_e.slice(D,y);return g(me,{children:[D>0&&g(c,{color:"gray",dimColor:!0,children:[" ","↑ ",D," more above"]}),z.map((G,ne)=>{const se=D+ne;return g(c,{color:d==="presets"&&se===v?"cyan":void 0,children:[d==="presets"&&se===v?"❯ ":" ",G.name," ",G.phases.join("")]},se)}),y<_e.length&&g(c,{color:"gray",dimColor:!0,children:[" ","↓ ",_e.length-y," more below"]})]})})()})}),s(m,{marginTop:1,children:s(c,{dimColor:!0,children:"ctrl+r to reset all settings to default"})})]})})}const De=[{label:"bold",value:"bold"},{label:"italic",value:"italic"},{label:"underline",value:"underline"},{label:"strikethrough",value:"strikethrough"},{label:"inverse",value:"inverse"}];function Oo({onBack:e}){const{settings:t,updateSettings:n}=be(ue),[r,o]=O("prefix"),[i,a]=O(0),[l,u]=O(!1),[d,h]=O(()=>t.userMessageDisplay.prefix.format),[f,v]=O(0),[b,p]=O(()=>[...t.userMessageDisplay.prefix.styling]),[w,x]=O(()=>t.userMessageDisplay.prefix.foreground_color),[C,_]=O(()=>t.userMessageDisplay.prefix.background_color),[k,P]=O(0),[B,j]=O(0),[q,U]=O(()=>[...t.userMessageDisplay.message.styling]),[A,M]=O(()=>t.userMessageDisplay.message.foreground_color),[E,Y]=O(()=>t.userMessageDisplay.message.background_color),[X,oe]=O(null),[K,I]=O(""),$=hn(),S=t.themes?.find(H=>H.id===$)||t.themes?.[0],N=["format","styling","foreground","background"],y=["styling","foreground","background"],D=N[i],z=y[k],G=(H,R)=>{n(L=>{const ee=H==="prefix"?L.userMessageDisplay.prefix:L.userMessageDisplay.message;R(ee)})},ne=H=>{n(R=>{H==="prefix"?R.userMessageDisplay.prefix={...Z.userMessageDisplay.prefix}:R.userMessageDisplay.message={...Z.userMessageDisplay.message}}),H==="prefix"?(h(Z.userMessageDisplay.prefix.format),p([...Z.userMessageDisplay.prefix.styling]),x(Z.userMessageDisplay.prefix.foreground_color),_(Z.userMessageDisplay.prefix.background_color)):(U([...Z.userMessageDisplay.message.styling]),M(Z.userMessageDisplay.message.foreground_color),Y(Z.userMessageDisplay.message.background_color))};xe(()=>{const H=t.userMessageDisplay.prefix;h(H.format),p([...H.styling]),x(H.foreground_color),_(H.background_color);const R=t.userMessageDisplay.message;U([...R.styling]),M(R.foreground_color),Y(R.background_color)},[]),de((H,R)=>{if(l){if(R.return)G("prefix",L=>{L.format=d}),u(!1);else if(R.escape){const L=t.userMessageDisplay.prefix;h(L.format),u(!1)}else R.backspace||R.delete?h(L=>L.slice(0,-1)):H&&h(L=>L+H);return}if(X===null){if(R.escape)e();else if(R.ctrl&&H==="r")ne(r);else if(R.leftArrow||R.rightArrow)o(L=>L==="prefix"?"message":"prefix");else if(R.tab)r==="prefix"?R.shift?a(L=>L===0?N.length-1:L-1):a(L=>L===N.length-1?0:L+1):R.shift?P(L=>L===0?y.length-1:L-1):P(L=>L===y.length-1?0:L+1);else if(R.return)r==="prefix"?D==="format"?u(!0):D==="foreground"?(I(w),oe({column:"prefix",type:"foreground"})):D==="background"&&(I(C),oe({column:"prefix",type:"background"})):z==="foreground"?(I(A),oe({column:"message",type:"foreground"})):z==="background"&&(I(E),oe({column:"message",type:"background"}));else if(R.upArrow)r==="prefix"&&D==="styling"?v(L=>Math.max(0,L-1)):r==="message"&&z==="styling"&&j(L=>Math.max(0,L-1));else if(R.downArrow)r==="prefix"&&D==="styling"?v(L=>Math.min(De.length-1,L+1)):r==="message"&&z==="styling"&&j(L=>Math.min(De.length-1,L+1));else if(H===" "){if(r==="prefix"&&D==="styling"){const L=De[f].value,ee=b.indexOf(L)>=0?b.filter(W=>W!==L):[...b,L];p(ee),G("prefix",W=>{W.styling=[...ee]})}else if(r==="message"&&z==="styling"){const L=De[B].value,ee=q.indexOf(L)>=0?q.filter(W=>W!==L):[...q,L];U(ee),G("message",W=>{W.styling=[...ee]})}}}});const se=(H,R,L=!0)=>{const ee=L?R==="prefix"?b:q:[],W=L?R==="prefix"?w:A:"rgb(255,255,255)",Oe=L?R==="prefix"?C:E:"rgb(0,0,0)",Ae=W==="rgb(0,0,0)"&&Oe==="rgb(0,0,0)",Ue=ee.length>0;return Ae&&!Ue?s(c,{children:H}):s(c,{bold:ee.includes("bold"),italic:ee.includes("italic"),underline:ee.includes("underline"),strikethrough:ee.includes("strikethrough"),inverse:ee.includes("inverse"),color:Ae?void 0:W,backgroundColor:Ae?void 0:Oe,children:H})},$e=(H=!0)=>g(c,{children:[d&&g(me,{children:[se(d,"prefix",H)," "]}),se("list the dir","message",H)]}),we=H=>{const R=r===H,W=(H==="prefix"?N:y)[H==="prefix"?i:k],Oe=H==="prefix"?f:B,Ae=H==="prefix"?b:q,Ue=H==="prefix"?w:A,mn=H==="prefix"?C:E;return g(m,{flexDirection:"column",width:"45%",borderStyle:R?"round":"single",borderColor:R?"yellow":"gray",padding:1,children:[s(m,{marginBottom:1,children:g(c,{bold:!0,color:R?"yellow":void 0,children:[H.charAt(0).toUpperCase()+H.slice(1)," ","Configuration"]})}),H==="prefix"&&g(me,{children:[s(m,{children:g(c,{color:R&&W==="format"?"yellow":void 0,bold:R&&W==="format",children:[R&&W==="format"?"❯ ":" ","Prefix Text"]})}),R&&W==="format"&&s(m,{marginLeft:2,children:s(c,{dimColor:!0,children:l?"enter to save":"enter to edit (appears before message)"})}),s(m,{marginLeft:2,marginBottom:1,children:s(m,{borderStyle:"round",borderColor:l?"yellow":"gray",children:s(c,{children:d})})})]}),s(m,{children:g(c,{color:R&&W==="styling"?"yellow":void 0,bold:R&&W==="styling",children:[R&&W==="styling"?"❯ ":" ","Styling"]})}),R&&W==="styling"&&s(m,{marginLeft:2,children:s(c,{dimColor:!0,children:"up/down to navigate · space to toggle"})}),s(m,{marginLeft:2,marginBottom:1,flexDirection:"column",children:De.map((qe,pn)=>s(m,{children:g(c,{color:R&&W==="styling"&&Oe===pn?"cyan":void 0,children:[R&&W==="styling"&&Oe===pn?"❯ ":" ",Ae.includes(qe.value)?"●":"○"," ",qe.label]})},qe.value))}),s(m,{children:g(c,{color:R&&W==="foreground"?"yellow":void 0,bold:R&&W==="foreground",children:[R&&W==="foreground"?"❯ ":" ","Foreground color"]})}),R&&W==="foreground"&&s(m,{marginLeft:2,children:s(c,{dimColor:!0,children:"enter to open color picker"})}),s(m,{marginLeft:2,marginBottom:1,children:s(c,{color:Ue,children:Ue})}),s(m,{children:g(c,{color:R&&W==="background"?"yellow":void 0,bold:R&&W==="background",children:[R&&W==="background"?"❯ ":" ","Background color"]})}),R&&W==="background"&&s(m,{marginLeft:2,children:s(c,{dimColor:!0,children:"enter to open color picker"})}),s(m,{marginLeft:2,children:s(c,{backgroundColor:mn,children:mn})})]})};if(X){const{column:H,type:R}=X;return s(at,{initialValue:K,theme:S,onColorChange:L=>{H==="prefix"?R==="foreground"?(x(L),G("prefix",ee=>{ee.foreground_color=L})):(_(L),G("prefix",ee=>{ee.background_color=L})):R==="foreground"?(M(L),G("message",ee=>{ee.foreground_color=L})):(Y(L),G("message",ee=>{ee.background_color=L}))},onExit:()=>{oe(null),I("")}})}return g(m,{flexDirection:"column",children:[s(pe,{children:"Customize how user messages are displayed"}),g(m,{flexDirection:"column",marginBottom:1,children:[s(c,{dimColor:!0,children:"left/right arrows to switch columns · tab to navigate options"}),s(c,{dimColor:!0,children:"enter to edit · ctrl+r to reset active column · esc to go back"})]}),g(m,{flexDirection:"row",gap:1,children:[we("prefix"),we("message")]}),s(m,{borderStyle:"round",padding:1,marginTop:1,children:g(m,{flexDirection:"column",children:[s(m,{marginBottom:1,children:s(c,{bold:!0,children:"Preview"})}),g(m,{flexDirection:"row",gap:2,children:[g(m,{flexDirection:"column",width:"50%",children:[s(m,{marginBottom:1,children:s(c,{underline:!0,children:"Before (Claude Code default):"})}),s(m,{marginLeft:1,marginTop:1,children:g(c,{children:[s(c,{color:S?.colors?.inactive||"#888888",children:"●"}),s(c,{children:" The directory "}),s(c,{color:S?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),s(c,{children:" contains "}),s(c,{bold:!0,children:"123"}),s(c,{children:" files."})]})})]}),g(m,{flexDirection:"column",width:"50%",children:[s(m,{marginBottom:1,children:s(c,{underline:!0,children:"After (Your customization):"})}),s(m,{marginLeft:1,children:$e(!0)}),s(m,{marginLeft:1,marginTop:1,children:g(c,{children:[s(c,{color:S?.colors?.inactive||"#888888",children:"●"}),s(c,{children:" The directory "}),s(c,{color:S?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),s(c,{children:" contains "}),s(c,{bold:!0,children:"123"}),s(c,{children:" files."})]})})]})]})]})})]})}function Ao({onSubmit:e}){const{settings:t,updateSettings:n}=be(ue),[r,o]=O(0),i=()=>{n(b=>{b.inputBox||(b.inputBox={removeBorder:!1}),b.inputBox.removeBorder=!b.inputBox.removeBorder})},a=()=>{n(b=>{b.misc||(b.misc={showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0}),b.misc.showTweakccVersion=!b.misc.showTweakccVersion})},l=()=>{n(b=>{b.misc||(b.misc={showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0}),b.misc.showPatchesApplied=!b.misc.showPatchesApplied})},u=()=>{n(b=>{b.misc||(b.misc={showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0}),b.misc.expandThinkingBlocks=!b.misc.expandThinkingBlocks})};de((b,p)=>{p.return||p.escape?e():p.upArrow?o(w=>Math.max(0,w-1)):p.downArrow?o(w=>Math.min(3,w+1)):b===" "&&(r===0?i():r===1?a():r===2?l():r===3&&u())});const d=t.inputBox?.removeBorder?"☑":"☐",h=t.misc?.showTweakccVersion?"☑":"☐",f=t.misc?.showPatchesApplied?"☑":"☐",v=t.misc?.expandThinkingBlocks?"☑":"☐";return g(m,{flexDirection:"column",children:[s(m,{marginBottom:1,children:s(pe,{children:"Miscellaneous Settings"})}),s(m,{marginBottom:1,children:s(c,{color:"gray",children:s(c,{dimColor:!0,children:"Various tweaks and customizations. Press space to toggle settings, enter to go back."})})}),s(m,{children:g(c,{children:[s(c,{color:r===0?"cyan":void 0,children:r===0?"❯ ":" "}),s(c,{bold:!0,color:r===0?"cyan":void 0,children:"Remove input box border"})]})}),s(m,{flexDirection:"column",children:g(c,{dimColor:!0,children:[" ","Removes the rounded border around the input box for a cleaner look."]})}),s(m,{marginLeft:4,marginBottom:1,children:g(c,{children:[d," ",t.inputBox?.removeBorder?"Enabled":"Disabled"]})}),s(m,{children:g(c,{children:[s(c,{color:r===1?"cyan":void 0,children:r===1?"❯ ":" "}),s(c,{bold:!0,color:r===1?"cyan":void 0,children:"Show tweakcc version at startup"})]})}),s(m,{flexDirection:"column",children:g(c,{dimColor:!0,children:[" ",'Shows the blue "+ tweakcc v<VERSION>" message when starting Claude Code.']})}),s(m,{marginLeft:4,marginBottom:1,children:g(c,{children:[h," ",t.misc?.showTweakccVersion?"Enabled":"Disabled"]})}),s(m,{children:g(c,{children:[s(c,{color:r===2?"cyan":void 0,children:r===2?"❯ ":" "}),s(c,{bold:!0,color:r===2?"cyan":void 0,children:"Show patches applied indicator at startup"})]})}),s(m,{flexDirection:"column",children:g(c,{dimColor:!0,children:[" ",'Shows the green "tweakcc patches are applied" indicator when starting Claude Code.']})}),s(m,{marginLeft:4,marginBottom:1,children:g(c,{children:[f," ",t.misc?.showPatchesApplied?"Enabled":"Disabled"]})}),s(m,{children:g(c,{children:[s(c,{color:r===3?"cyan":void 0,children:r===3?"❯ ":" "}),s(c,{bold:!0,color:r===3?"cyan":void 0,children:"Expand thinking blocks"})]})}),s(m,{flexDirection:"column",children:g(c,{dimColor:!0,children:[" ","Makes thinking blocks always expanded by default instead of collapsed."]})}),s(m,{marginLeft:4,marginBottom:1,children:g(c,{children:[v," ",t.misc?.expandThinkingBlocks?"Enabled":"Disabled"]})})]})}const He=["Task","Bash","Glob","Grep","Read","Edit","Write","NotebookEdit","WebFetch","WebSearch","BashOutput","KillShell","TodoWrite","AskUserQuestion","Skill","SlashCommand","ExitPlanMode"];function Po({toolsetIndex:e,onBack:t}){const{settings:n,updateSettings:r}=be(ue),o=n.toolsets[e],[i,a]=O(o?.name||"New Toolset"),[l,u]=O(o?.allowedTools||[]),[d,h]=O(!1),[f,v]=O(0);xe(()=>{o&&r(C=>{C.toolsets[e].name=i,C.toolsets[e].allowedTools=l})},[i,l]);const b=C=>l==="*"?!0:l.includes(C),p=C=>{C==="All"?u("*"):C==="None"?u([]):l==="*"?u(He.filter(_=>_!==C)):l.includes(C)?u(l.filter(_=>_!==C)):u([...l,C])};if(de((C,_)=>{if(d){_.return?h(!1):_.escape?(a(o?.name||"New Toolset"),h(!1)):_.backspace||_.delete?a(k=>k.slice(0,-1)):C&&C.length===1&&a(k=>k+C);return}if(_.escape)t();else if(_.upArrow)v(k=>Math.max(0,k-1));else if(_.downArrow)v(k=>Math.min(He.length+1,k+1));else if(C===" "||_.return)if(f===0)p("All");else if(f===1)p("None");else{const k=He[f-2];k&&p(k)}else C==="n"&&h(!0)}),!o)return s(m,{flexDirection:"column",children:s(c,{color:"red",children:"Toolset not found"})});const w=l==="*",x=Array.isArray(l)&&l.length===0;return g(m,{flexDirection:"column",children:[s(pe,{children:"Edit Toolset"}),s(m,{marginBottom:1,flexDirection:"column",children:s(c,{dimColor:!0,children:"n to edit name · space/enter to toggle · esc to go back"})}),g(m,{marginBottom:1,flexDirection:"column",children:[s(c,{bold:!0,children:"Name:"}),s(m,{marginLeft:2,children:s(m,{borderStyle:"round",borderColor:d?"yellow":"gray",children:s(c,{children:i})})}),d&&s(m,{marginLeft:2,children:s(c,{dimColor:!0,children:"enter to save · esc to cancel"})})]}),g(m,{marginBottom:1,flexDirection:"column",children:[s(c,{bold:!0,children:"Allowed Tools:"}),s(m,{marginLeft:2,children:g(c,{color:f===0?"cyan":void 0,children:[f===0?"❯ ":" ",w?"●":"○"," All"]})}),s(m,{marginLeft:2,children:g(c,{color:f===1?"cyan":void 0,children:[f===1?"❯ ":" ",x?"●":"○"," None"]})}),He.map((C,_)=>{const k=_+2;return s(m,{marginLeft:2,children:g(c,{color:f===k?"cyan":void 0,children:[f===k?"❯ ":" ",b(C)?"◉":"○"," ",C]})},C)})]}),s(m,{borderStyle:"round",padding:1,marginTop:1,children:g(m,{flexDirection:"column",children:[s(c,{bold:!0,children:"Summary:"}),g(c,{children:["Name: ",s(c,{color:"cyan",children:i})]}),g(c,{children:["Tools:"," ",l==="*"?s(c,{color:"green",children:"All tools (*)"}):l.length===0?s(c,{color:"red",children:"No tools ([])"}):g(c,{color:"yellow",children:[l.length," selected"]})]})]})})]})}function Do({onBack:e}){const{settings:{toolsets:t,defaultToolset:n},updateSettings:r}=be(ue),[o,i]=O(0),[a,l]=O(null),[u,d]=O(!0),h=()=>{const p={name:"New Toolset",allowedTools:[]};r(w=>{w.toolsets.push(p)}),l(t.length),d(!1)},f=p=>{const w=t[p];r(x=>{x.toolsets.splice(p,1),x.defaultToolset===w.name&&(x.defaultToolset=null)}),o>=t.length-1&&i(Math.max(0,t.length-2))},v=p=>{const w=t[p];r(x=>{x.defaultToolset=w.name})};if(de((p,w)=>{w.escape?e():w.upArrow?i(x=>Math.max(0,x-1)):w.downArrow?i(x=>Math.min(t.length-1,x+1)):w.return&&t.length>0?(l(o),d(!1)):p==="n"?h():p==="d"&&t.length>0?f(o):p==="s"&&t.length>0&&v(o)},{isActive:u}),a!==null)return s(Po,{toolsetIndex:a,onBack:()=>{l(null),d(!0)}});const b=p=>p.allowedTools==="*"?"All tools":p.allowedTools.length===0?"No tools":`${p.allowedTools.length} tool${p.allowedTools.length===1?"":"s"}`;return g(m,{flexDirection:"column",children:[s(pe,{children:"Toolsets"}),g(m,{marginBottom:1,flexDirection:"column",children:[s(c,{dimColor:!0,children:"n to create a new toolset"}),t.length>0&&s(c,{dimColor:!0,children:"s to set as default toolset"}),t.length>0&&s(c,{dimColor:!0,children:"d to delete a toolset"}),t.length>0&&s(c,{dimColor:!0,children:"enter to edit toolset"}),s(c,{dimColor:!0,children:"esc to go back"})]}),t.length===0?s(c,{children:"No toolsets created yet. Press n to create one."}):s(m,{flexDirection:"column",children:t.map((p,w)=>{const x=p.name===n,C=o===w;return g(c,{color:C?"yellow":void 0,bold:x,children:[C?"❯ ":" ",p.name,x&&" [DEFAULT]"," (",b(p),")"]},w)})})]})}const ue=ut({settings:Z,updateSettings:e=>{},changesApplied:!1,ccVersion:""});function Lo({startupCheckInfo:e}){const[t,n]=O({settings:Z,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null});xe(()=>{(async()=>{n(await an())})()},[]);const r=Nn(h=>{const f=JSON.parse(JSON.stringify(t.settings));h(f),n(v=>({...v,settings:f,changesApplied:!1})),je(v=>{v.settings=f,v.changesApplied=!1})},[t.settings]),[o,i]=O(null),[a,l]=O(null);xe(()=>{e.wasUpdated&&e.oldVersion&&(l({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
|
|
645
|
+
`;l=l.slice(0,r)+u+l.slice(r),H(e,l,u,r,r);const c=o+u.length,h=`||tweakccSummaries.has(${i}.uuid)`,f=l.slice(0,c)+h+l.slice(c);return H(l,f,h,c,c),f},mr=e=>{const t=/description:"Rename the current conversation",isEnabled:\(\)=>!1,/,n=e.match(t);if(!n)return console.error("patch: conversationTitle: enableRenameConversationCommand: failed to find pattern"),null;if(n.index===void 0)return console.error("patch: conversationTitle: enableRenameConversationCommand: match.index is undefined"),null;const o='description:"Rename the current conversation",isEnabled:()=>!1,',r='description:"Rename the current conversation",isEnabled:()=>!0,',i=e.replace(o,r);return i===e?(console.error("patch: conversationTitle: enableRenameConversationCommand: replacement failed"),null):(H(e,i,r,n.index,n.index+63),i)},pr=e=>{let t=e;if(t=ar(t),!t)return console.error("patch: conversationTitle: step 1 failed (writeTitleSlashCommand)"),null;if(t=dr(t),!t)return console.error("patch: conversationTitle: step 2 failed (writeCustomNamingFunctions)"),null;if(t=hr(t),!t)return console.error("patch: conversationTitle: step 3 failed (writeAppendEntryInterceptor)"),null;if(t=fr(t),!t)return console.error("patch: conversationTitle: step 4 failed (writeTweakccSummaryCheck)"),null;const n=mr(t);return n?t=n:console.log("patch: conversationTitle: step 5 failed (enableRenameConversationCommand)"),t},H=(e,t,n,o,r)=>{if(!M())return;const i=Math.max(0,o-20),a=Math.min(e.length,r+20),l=Math.min(t.length,o+n.length+20),u=e.slice(i,o),c=e.slice(o,r),h=e.slice(r,a),f=t.slice(i,o),y=t.slice(o,o+n.length),w=t.slice(o+n.length,l);c!==y&&(console.log(`
|
|
646
|
+
--- Diff ---`),console.log("OLD:",u+`\x1B[31m${c}\x1B[0m`+h),console.log("NEW:",f+`\x1B[32m${y}\x1B[0m`+w),console.log(`--- End Diff ---
|
|
647
|
+
`))},fe=e=>e.replace(/\$/g,"\\$"),dn=e=>{const t=/\b([$\w]+)(?:\.(?:cyan|gray|green|red|yellow|ansi256|bgAnsi256|bgHex|bgRgb|hex|rgb|bold|dim|inverse|italic|strikethrough|underline)\b)+\(/g,n=Array.from(e.matchAll(t)),o={};for(const a of n){const l=a[1];o[l]=(o[l]||0)+1}let r,i=0;for(const[a,l]of Object.entries(o))l>i&&(i=l,r=a);return r},br=e=>{const t=e.slice(0,1e3),n=/var ([$\w]+)=\([$\w]+,[$\w]+,[$\w]+\)=>\{/,o=t.match(n);if(!o){console.log("patch: getModuleLoaderFunction: failed to find module loader function");return}return o[1]},et=e=>{const t=/var ([$\w]+)=[$\w]+\(\([$\w]+\)=>\{var [$\w]+=Symbol\.for\("react\.element"\)/,n=e.match(t);if(!n){console.log("patch: getReactModuleNameNonBun: failed to find React module name");return}return n[1]},wr=e=>{const t=et(e);if(!t){console.log("^ patch: getReactModuleFunctionBun: failed to find React module name (Bun)");return}const n=new RegExp(`var ([$\\w]+)=[$\\w]+\\(\\([$\\w]+,[$\\w]+\\)=>\\{[$\\w]+\\.exports=${fe(t)}\\(\\)`),o=e.match(n);if(!o){console.log(`patch: getReactModuleFunctionBun: failed to find React module function (Bun) (reactModuleNameNonBun=${t})`);return}return o[1]};let he=null,ke=null;const Je=e=>{if(he!=null)return he;const t=br(e);if(!t){console.log("^ patch: getReactVar: failed to find moduleLoader"),he=void 0;return}const n=et(e);if(!n){console.log("^ patch: getReactVar: failed to find reactModuleVarNonBun"),he=void 0;return}const o=new RegExp(`\\b([$\\w]+)=${fe(t)}\\(${fe(n)}\\(\\),1\\)`),r=e.match(o);if(r)return he=r[1],he;const i=wr(e);if(!i){console.log("^ patch: getReactVar: failed to find reactModuleFunctionBun"),he=void 0;return}const a=new RegExp(`\\b([$\\w]+)=${fe(t)}\\(${fe(i)}\\(\\),1\\)`),l=e.match(a);if(!l){console.log(`patch: getReactVar: failed to find bunPattern (moduleLoader=${t}, reactModuleVarNonBun=${n}, reactModuleFunctionBun=${i})`),he=void 0;return}return he=l[1],he},xr=e=>{const t=/import\{createRequire as ([$\w]+)\}from"node:module";/,n=e.match(t);if(!n)return;const o=n[1],r=new RegExp(`var ([$\\w]+)=${fe(o)}\\(import\\.meta\\.url\\)`),i=e.match(r);if(!i){console.log(`patch: findRequireFunc: failed to find require function variable (createRequireVar=${o})`);return}return i[1]},un=e=>{if(ke!=null)return ke;const t=xr(e);return t?(ke=t,ke):(ke="require",ke)},nt=e=>{const t=/\bfunction ([$\w]+)\(\{color:[$\w]+,backgroundColor:[$\w]+,dimColor:[$\w]+=![01],bold:[$\w]+=![01]/,n=e.match(t);if(!n){console.log("patch: findTextComponent: failed to find text component");return}return n[1]},tt=e=>{const t=/\b([$\w]+)\.displayName="Box"/,n=e.match(t);if(!n){console.error("patch: findBoxComponent: failed to find Box displayName");return}const o=n[1],r=new RegExp(`\\b([$\\w]+)=${fe(o)}[^$\\w]`),i=e.match(r);if(!i){console.error(`patch: findBoxComponent: failed to find Box component variable (boxOrigCompName=${o})`);return}return i[1]},ot=async(e,t)=>{let n;if(t.nativeInstallationPath){await qn(t);let u=!1;try{await oe.stat(ge),u=!0}catch{}const c=u?ge:t.nativeInstallationPath;M()&&console.log(`Extracting claude.js from ${u?"backup":"native installation"}: ${c}`);const h=Yn(c);if(!h)throw new Error("Failed to extract claude.js from native installation");const f=re.join(ye.homedir(),".tweakcc"),y=re.join(f,"native-claudejs-orig.js");Ce.writeFileSync(y,h),M()&&console.log(`Saved original extracted JS from native to: ${y}`),n=h.toString("utf8")}else{if(await Jn(t),!t.cliPath)throw new Error("cliPath is required for NPM installations");n=await oe.readFile(t.cliPath,{encoding:"utf8"})}const o=[],r=await Yo(n,t.version);n=r.newContent,o.push(...r.items);let i=null;e.settings.themes&&e.settings.themes.length>0&&(i=uo(n,e.settings.themes))&&(n=i),e.settings.thinkingVerbs&&((i=Mo(n,e.settings.thinkingVerbs.verbs))&&(n=i),(i=xo(n,e.settings.thinkingVerbs.format))&&(n=i)),(i=$o(n,e.settings.thinkingStyle.phases))&&(n=i),(i=Io(n,e.settings.thinkingStyle.updateInterval))&&(n=i),(i=Eo(n,Math.max(...e.settings.thinkingStyle.phases.map(u=>u.length))+1))&&(n=i),(i=So(n,e.settings.thinkingStyle.reverseMirror))&&(n=i),e.settings.userMessageDisplay&&(i=Oo(n,e.settings.userMessageDisplay.prefix.format,e.settings.userMessageDisplay.prefix.foreground_color,e.settings.userMessageDisplay.prefix.background_color,e.settings.userMessageDisplay.prefix.styling.includes("bold"),e.settings.userMessageDisplay.prefix.styling.includes("italic"),e.settings.userMessageDisplay.prefix.styling.includes("underline"),e.settings.userMessageDisplay.prefix.styling.includes("strikethrough"),e.settings.userMessageDisplay.prefix.styling.includes("inverse"),e.settings.userMessageDisplay.message.foreground_color,e.settings.userMessageDisplay.message.background_color,e.settings.userMessageDisplay.message.styling.includes("bold"),e.settings.userMessageDisplay.message.styling.includes("italic"),e.settings.userMessageDisplay.message.styling.includes("underline"),e.settings.userMessageDisplay.message.styling.includes("strikethrough"),e.settings.userMessageDisplay.message.styling.includes("inverse")))&&(n=i),e.settings.inputBox&&typeof e.settings.inputBox.removeBorder=="boolean"&&(i=mo(n,e.settings.inputBox.removeBorder))&&(n=i),(i=Ao(n))&&(n=i),(i=bo(n))&&(n=i),(i=go(n))&&(n=i),(i=vr(n))&&(n=i),(i=ao(n,25))&&(n=i),(i=Do(n))&&(n=i);const a=e.settings.misc?.showTweakccVersion??!0,l=e.settings.misc?.showPatchesApplied??!0;if((i=Ho(n,"3.1.3",o,a,l))&&(n=i),(i=Jo(n))&&(n=i),e.settings.toolsets&&e.settings.toolsets.length>0&&(i=lr(n,e.settings.toolsets,e.settings.defaultToolset))&&(n=i),(i=pr(n))&&(n=i),t.nativeInstallationPath){M()&&console.log(`Repacking modified claude.js into native installation: ${t.nativeInstallationPath}`);const u=re.join(ye.homedir(),".tweakcc"),c=re.join(u,"native-claudejs-patched.js");Ce.writeFileSync(c,n,"utf8"),M()&&console.log(`Saved patched JS from native to: ${c}`);const h=Buffer.from(n,"utf8");to(t.nativeInstallationPath,h,t.nativeInstallationPath)}else{if(!t.cliPath)throw new Error("cliPath is required for NPM installations");await fn(t.cliPath,n,"patch")}return await je(u=>{u.changesApplied=!0})},rt=[{label:"Opus 4.1",slug:"opus-4.1",internal:"claude-opus-4-1-20250805"},{label:"Opus 4",slug:"opus-4",internal:"claude-opus-4-20250514"},{label:"Sonnet 4",slug:"sonnet-4",internal:"claude-sonnet-4-20250514"},{label:"Sonnet 3.7",slug:"sonnet-3.7",internal:"claude-3-7-sonnet-20250219"},{label:"Sonnet 3.5 (October)",slug:"sonnet-3.5-october",internal:"claude-3-5-sonnet-20241022"},{label:"Sonnet 3.5 (June)",slug:"sonnet-3.5-june",internal:"claude-3-5-sonnet-20240620"},{label:"Haiku 3.5",slug:"haiku-3.5",internal:"claude-3-5-haiku-20241022"},{label:"Haiku 3",slug:"haiku-3",internal:"claude-3-haiku-20240307"},{label:"Opus 3",slug:"opus-3",internal:"claude-3-opus-20240229"}],yr=e=>{const t=e.indexOf("Switch between Claude models");if(t===-1)return console.error("patch: getModelSelectorInsertionPoint: failed to find labelIndex"),null;const n=Math.max(0,t-600),o=t,i=e.slice(n,o).match(/\[[$\w]+,\s*[$\w]+\]\s*=\s*[$\w]+\.useState\([^)]*\)\s*,\s*([$\w]+)=/);if(!i||i.index===void 0)return console.error("patch: getModelSelectorInsertionPoint: failed to find useState"),null;let l=n+i.index;for(;l<e.length&&e[l]!==";";)l++;if(l>=e.length)return console.error("patch: getModelSelectorInsertionPoint: failed to find semicolon"),null;const u=l+1,c=i[1];return{insertionIndex:u,optionsVar:c}},Sr=e=>{const t=yr(e);if(!t)return null;const{insertionIndex:n,optionsVar:o}=t,r=rt.map(a=>{const l=JSON.stringify(a.label),u=JSON.stringify(a.slug);return`${o}.push({value:${u},label:${l}});`}).join(""),i=e.slice(0,n)+r+e.slice(n);return H(e,i,r,n,n),i},vr=e=>{let t=e;const n=Sr(t);return n&&(t=n),t===e?null:t};let it=!1;const M=()=>it,$r=()=>{it=!0};function hn(){try{const e=re.join(ye.homedir(),".claude.json");return JSON.parse(Ce.readFileSync(e,"utf8")).theme||"dark"}catch{}return"dark"}function _r(){try{const e=re.join(ye.homedir(),".claude",".credentials.json");switch(JSON.parse(Ce.readFileSync(e,"utf8"))?.claudeAiOauth?.subscriptionType||"unknown"){case"enterprise":return"Claude Enterprise";case"team":return"Claude Team";case"max":return"Claude Max";case"pro":return"Claude Pro"}}catch{}return"Claude API"}function Ir(){try{const e=re.join(ye.homedir(),".claude","settings.json"),n=JSON.parse(Ce.readFileSync(e,"utf8"))?.model||"default";if(n==="opus")return"Opus 4.1";const o=rt.find(r=>r.slug===n);if(o)return o.label}catch{}return"Sonnet 4.5"}function Cr(e){process.platform==="win32"?Me.spawn("explorer",[e],{detached:!0,stdio:"ignore"}).unref():process.platform==="darwin"?Me.spawn("open",[e],{detached:!0,stdio:"ignore"}).unref():Me.spawn("xdg-open",[e],{detached:!0,stdio:"ignore"}).unref()}function kn(e){if(process.platform==="win32")Me.spawn("explorer",["/select,",e],{detached:!0,stdio:"ignore"}).unref();else if(process.platform==="darwin")Me.spawn("open",["-R",e],{detached:!0,stdio:"ignore"}).unref();else{const t=re.dirname(e);Me.spawn("xdg-open",[t],{detached:!0,stdio:"ignore"}).unref()}}function gn(e){if(!e||typeof e!="string")return!1;const t=e.trim();if(/^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$/.test(t))return!0;if(/^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)$/.test(t)){const n=t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n){const[,o,r,i]=n;return parseInt(o)<=255&&parseInt(r)<=255&&parseInt(i)<=255}}if(/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(t)){const n=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(n){const[,o,r,i]=n;return parseInt(o)<=360&&parseInt(r)<=100&&parseInt(i)<=100}}return!1}function st(e){if(!gn(e))return e;const t=e.trim();if(t.startsWith("rgb("))return t;if(t.startsWith("#")){let n=t.slice(1);n.length===3&&(n=n.split("").map(a=>a+a).join(""));const o=parseInt(n.slice(0,2),16),r=parseInt(n.slice(2,4),16),i=parseInt(n.slice(4,6),16);return`rgb(${o},${r},${i})`}if(t.startsWith("hsl(")){const n=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(n){const o=parseInt(n[1])/360,r=parseInt(n[2])/100,i=parseInt(n[3])/100,a=(y,w,p)=>(p<0&&(p+=1),p>1&&(p-=1),p<1/6?y+(w-y)*6*p:p<1/2?w:p<2/3?y+(w-y)*(2/3-p)*6:y),l=i<.5?i*(1+r):i+r-i*r,u=2*i-l,c=Math.round(a(u,l,o+1/3)*255),h=Math.round(a(u,l,o)*255),f=Math.round(a(u,l,o-1/3)*255);return`rgb(${c},${h},${f})`}}return e}async function Er(e,t="sha256",n=64*1024){return new Promise((o,r)=>{const i=An.createHash(t),a=Ce.createReadStream(e,{highWaterMark:n});a.on("data",l=>{i.update(l)}),a.on("end",()=>{o(i.digest("hex"))}),a.on("error",l=>{r(l)})})}const Tn=(e,t,n,o,r,i,a,l)=>{let u=e;return t&&(u+=`.rgb(${t})`),n&&n!=="transparent"&&(u+=`.bgRgb(${n})`),o&&(u+=".bold"),r&&(u+=".italic"),i&&(u+=".underline"),a&&(u+=".strikethrough"),l&&(u+=".inverse"),u};async function fn(e,t,n="replace"){let o=493;try{o=(await oe.stat(e)).mode,M()&&console.log(`[${n}] Original file mode for ${e}: ${(o&parseInt("777",8)).toString(8)}`)}catch(r){M()&&console.log(`[${n}] Could not stat ${e} (error: ${r}), using default mode 755`)}try{await oe.unlink(e),M()&&console.log(`[${n}] Unlinked ${e} to break hard links`)}catch(r){M()&&console.log(`[${n}] Could not unlink ${e}: ${r}`)}await oe.writeFile(e,t),await oe.chmod(e,o),M()&&console.log(`[${n}] Restored permissions to ${(o&parseInt("777",8)).toString(8)}`)}function V({color:e,backgroundColor:t,bold:n,dimColor:o,children:r}){const i=e?.startsWith("ansi:"),a=t?.startsWith("ansi:");if(i||a){if(Ke.Children.toArray(r).some(f=>Ke.isValidElement(f)))return s(d,{children:r});let u=j;if(i){const f=e.slice(5);u=u[f]||u}if(a){const f=t.slice(5),y=f.startsWith("bg")?f:`bg${f.charAt(0).toUpperCase()}${f.slice(1)}`;u=u[y]||u}n&&(u=u.bold),o&&(u=u.dim);const h=Ke.Children.toArray(r).map(f=>typeof f=="string"||typeof f=="number"?String(f):"").join("");return s(d,{children:u(h)})}return s(d,{color:e,backgroundColor:t,bold:n,dimColor:o,children:r})}function kr({text:e,nonShimmerColors:t,shimmerColors:n,shimmerWidth:o=3,updateDuration:r=50,restartPoint:i=10}){const[a,l]=A(0);return xe(()=>{const u=setInterval(()=>{l(c=>{const h=c+1;return h>=e.length+i?-o:h})},r);return()=>clearInterval(u)},[e.length,i,r]),t.length!==n.length?(console.error("UltrathinkRainbowShimmer: nonShimmerColors and shimmerColors must have the same length"),s(d,{children:e})):s(d,{children:e.split("").map((u,c)=>{const h=c>=a&&c<a+o&&a<e.length,f=c%t.length,y=h?n[f]:t[f];return s(d,{color:y,children:u},c)})})}const Tr=ft.cwd();function lt({theme:e}){const{ccVersion:t}=be(ue);return g(m,{flexDirection:"column",paddingLeft:1,children:[s(m,{marginBottom:1,children:g(d,{bold:!0,children:["Preview: ",e.name]})}),s(m,{borderStyle:"single",borderColor:"gray",paddingX:1,children:g(m,{flexDirection:"column",children:[g(m,{flexDirection:"column",children:[g(d,{children:[s(V,{color:e.colors.clawd_body,children:" ▐"}),s(d,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"▛███▜"}),g(d,{children:[s(V,{color:e.colors.clawd_body,children:"▌ "})," ",s(d,{bold:!0,children:"Claude Code"})," ",t?`v${t}`:"v2.0.14"]})]}),g(d,{children:[s(V,{color:e.colors.clawd_body,children:"▝▜"}),s(d,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"█████"}),s(V,{color:e.colors.clawd_body,children:"▛▘"})," ",Ir()," · ",_r()]}),g(V,{color:e.colors.clawd_body,children:[" ","▘▘ ▝▝"," ",Tr]}),g(d,{children:[g(V,{color:e.colors.success,children:["Login successful. Press"," "]}),s(V,{bold:!0,color:e.colors.success,children:"Enter"}),g(V,{color:e.colors.success,children:[" ","to continue…"]})]})]}),s(d,{children:"╭─────────────────────────────────────────────╮"}),g(d,{children:["│ 1 function greet() ","{"," ","│"]}),g(d,{children:["│ 2"," ",s(V,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:'- console.log("'}),s(V,{backgroundColor:e.colors.diffRemovedWord,children:"Hello, World!"}),s(V,{backgroundColor:e.colors.diffRemoved,children:'");'})," ","│"]}),g(d,{children:["│ 2"," ",s(V,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:'+ console.log("'}),s(V,{backgroundColor:e.colors.diffAddedWord,children:"Hello, Claude!"}),s(V,{backgroundColor:e.colors.diffAdded,children:'");'})," ","│"]}),s(V,{color:e.colors.warning,children:"╭─────────────────────────────────────────────╮"}),g(V,{color:e.colors.warning,children:["│ Do you trust the files in this folder?"," ","│"]}),g(d,{children:[s(V,{color:e.colors.warning,children:"│ "}),s(d,{dimColor:!0,children:"Enter to confirm · Esc to exit"}),g(V,{color:e.colors.warning,children:[" ","│"]})]}),s(V,{color:e.colors.bashBorder,children:"───────────────────────────────────────────────"}),g(d,{children:[s(V,{color:e.colors.bashBorder,children:"!"}),s(d,{children:" ls"})]}),s(V,{color:e.colors.promptBorder,children:"───────────────────────────────────────────────"}),s(d,{children:g(d,{children:["> list the dir"," ",s(kr,{text:"ultrathink",nonShimmerColors:[e.colors.rainbow_red,e.colors.rainbow_orange,e.colors.rainbow_yellow,e.colors.rainbow_green,e.colors.rainbow_blue,e.colors.rainbow_indigo,e.colors.rainbow_violet],shimmerColors:[e.colors.rainbow_red_shimmer,e.colors.rainbow_orange_shimmer,e.colors.rainbow_yellow_shimmer,e.colors.rainbow_green_shimmer,e.colors.rainbow_blue_shimmer,e.colors.rainbow_indigo_shimmer,e.colors.rainbow_violet_shimmer],shimmerWidth:3,updateDuration:50,restartPoint:10})]})}),s(V,{color:e.colors.planMode,children:"╭─────────────────────────────────────────────╮"}),g(d,{children:[s(V,{color:e.colors.planMode,children:"│ "}),g(V,{color:e.colors.permission,children:["Ready to code?"," "]}),s(d,{children:"Here is Claude's plan:"}),g(V,{color:e.colors.planMode,children:[" ","│"]})]}),s(V,{color:e.colors.permission,children:"╭─────────────────────────────────────────────╮"}),g(d,{children:[s(V,{color:e.colors.permission,children:"│ "}),s(d,{bold:!0,children:"Permissions:"})," ",g(V,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[" ","Allow"," "]})," ","Deny"," ","Workspace"," ",s(V,{color:e.colors.permission,children:"│"})]}),s(d,{children:"> list the dir"}),g(d,{children:[s(V,{color:e.colors.error,children:"●"}),s(d,{children:" Update(__init__.py)"})]}),g(d,{children:[s(d,{children:" ⎿ "}),s(V,{color:e.colors.error,children:"User rejected update to __init__.py"})]}),g(d,{children:[" ","1"," ",g(V,{backgroundColor:e.colors.diffRemovedDimmed,children:["- import"," "]}),s(V,{backgroundColor:e.colors.diffRemovedWordDimmed,children:"os"})]}),g(d,{children:[" ","2"," ",g(V,{backgroundColor:e.colors.diffAddedDimmed,children:["+ import"," "]}),s(V,{backgroundColor:e.colors.diffAddedWordDimmed,children:"random"})]}),g(d,{children:[s(V,{color:e.colors.success,children:"●"}),s(d,{children:" List(.)"})]}),g(d,{children:[s(d,{children:"●"}),s(d,{children:" The directory "}),s(V,{color:e.colors.permission,children:"C:\\Users\\user"}),g(d,{children:[" ","contains ",s(d,{bold:!0,children:"123"})," files."]})]}),g(d,{children:[s(V,{color:e.colors.claude,children:"✻ Th"}),s(V,{color:e.colors.claudeShimmer,children:"ink"}),s(V,{color:e.colors.claude,children:"ing… "}),s(d,{children:"(esc to interrupt)"})]}),s(d,{children:s(V,{color:e.colors.autoAccept,children:"⏵⏵ accept edits on (shift+tab to cycle)"})}),s(d,{children:s(V,{color:e.colors.planMode,children:"⏸ plan mode on (shift+tab to cycle)"})}),s(d,{children:s(V,{color:e.colors.ide,children:"◯ IDE connected ⧉ 44 lines selected"})})]})})]})}function Xe({colorKey:e,theme:t,bold:n=!1}){const o=t.colors[e];return e==="inverseText"?s(V,{color:o,backgroundColor:t.colors.permission,bold:n,children:e}):e.startsWith("diff")?s(V,{backgroundColor:o,bold:n,color:t.colors.text,children:e}):s(V,{color:o,bold:n,children:e})}function at({initialValue:e,onColorChange:t,onExit:n,colorKey:o,theme:r}){const i=Qe(e)||{h:0,s:50,l:50},a=Ze(e)||{r:128,g:128,b:128},[l,u]=A(i),[c,h]=A(a),[f,y]=A("hsl"),[w,p]=A("h"),[b,x]=A(!1),[E,$]=A(!1);xe(()=>{const I=Qe(e),_=Ze(e);I&&_&&(x(!0),u(I),h(_),x(!1))},[e]),xe(()=>{if(!b&&E){const I=`rgb(${c.r},${c.g},${c.b})`;t(I)}},[l,c,b,E]),xe(()=>{$(!0)},[]);const k=I=>{if(gn(I)){const _=st(I),v=Qe(_),B=Ze(_);v&&B&&(x(!0),u(v),h(B),x(!1))}};de((I,_)=>{if(I.length>1&&!_.ctrl&&!_.meta){k(I);return}if(_.return)n();else if(_.escape)n();else if(_.ctrl&&I==="a")y(v=>v==="hsl"?"rgb":"hsl"),p(v=>f==="hsl"?v==="h"?"r":v==="s"?"g":"b":v==="r"?"h":v==="g"?"s":"l");else if(_.upArrow)p(f==="hsl"?v=>v==="h"?"l":v==="s"?"h":"s":v=>v==="r"?"b":v==="g"?"r":"g");else if(_.downArrow||_.tab)p(f==="hsl"?v=>v==="h"?"s":v==="s"?"l":"h":v=>v==="r"?"g":v==="g"?"b":"r");else if(_.leftArrow){const v=_.shift||_.ctrl||_.meta?-10:-1;D(v)}else if(_.rightArrow){const v=_.shift||_.ctrl||_.meta?10:1;D(v)}});const D=I=>{x(!0),f==="hsl"?u(_=>{const v={..._};w==="h"?v.h=Math.max(0,Math.min(359,_.h+I)):w==="s"?v.s=Math.max(0,Math.min(100,_.s+I)):w==="l"&&(v.l=Math.max(0,Math.min(100,_.l+I)));const[B,S,P]=F(v.h,v.s,v.l);return h({r:B,g:S,b:P}),v}):h(_=>{const v={..._};w==="r"?v.r=Math.max(0,Math.min(255,_.r+I)):w==="g"?v.g=Math.max(0,Math.min(255,_.g+I)):w==="b"&&(v.b=Math.max(0,Math.min(255,_.b+I)));const B=N(v.r,v.g,v.b);return u(B),v}),x(!1)},N=(I,_,v)=>{const B=I/255,S=_/255,P=v/255,q=Math.max(B,S,P),W=Math.min(B,S,P),te=q-W,se=(q+W)/2;let $e=0;te!==0&&($e=se>.5?te/(2-q-W):te/(q+W));let we=0;return te!==0&&(q===B?we=((S-P)/te+(S<P?6:0))/6:q===S?we=((P-B)/te+2)/6:we=((B-S)/te+4)/6),{h:Math.round(we*360),s:Math.round($e*100),l:Math.round(se*100)}},F=(I,_,v)=>{I/=360,_/=100,v/=100;const B=(1-Math.abs(2*v-1))*_,S=B*(1-Math.abs(I*6%2-1)),P=v-B/2;let q=0,W=0,te=0;return 0<=I&&I<1/6?(q=B,W=S,te=0):1/6<=I&&I<2/6?(q=S,W=B,te=0):2/6<=I&&I<3/6?(q=0,W=B,te=S):3/6<=I&&I<4/6?(q=0,W=S,te=B):4/6<=I&&I<5/6?(q=S,W=0,te=B):5/6<=I&&I<1&&(q=B,W=0,te=S),[Math.round((q+P)*255),Math.round((W+P)*255),Math.round((te+P)*255)]},K=()=>{const I=[],_=[[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 v=0;v<40;v++){const S=v/39*(_.length-1),P=Math.floor(S),q=Math.ceil(S),W=S-P,[te,se,$e]=_[P],[we,z,R]=_[q],L=Math.round(te+(we-te)*W),ne=Math.round(se+(z-se)*W),X=Math.round($e+(R-$e)*W);I.push(s(d,{backgroundColor:`rgb(${L},${ne},${X})`,children:" "},v))}return I},U=()=>{const I=[];for(let _=0;_<40;_++){const v=_/39*100,[B,S,P]=F(l.h,v,l.l);I.push(s(d,{backgroundColor:`rgb(${B},${S},${P})`,children:" "},_))}return I},O=()=>{const I=[];for(let _=0;_<40;_++){const v=_/39*100,[B,S,P]=F(l.h,l.s,v);I.push(s(d,{backgroundColor:`rgb(${B},${S},${P})`,children:" "},_))}return I},T=()=>{const[I,_,v]=F(l.h,l.s,l.l);return`rgb(${I},${_},${v})`},C=(I,_,v)=>{const B=S=>S.toString(16).padStart(2,"0");return`#${B(I)}${B(_)}${B(v)}`},G=()=>{const I=[];for(let _=0;_<40;_++){const v=Math.round(_/39*255);I.push(s(d,{backgroundColor:`rgb(${v},${c.g},${c.b})`,children:" "},_))}return I},Y=()=>{const I=[];for(let _=0;_<40;_++){const v=Math.round(_/39*255);I.push(s(d,{backgroundColor:`rgb(${c.r},${v},${c.b})`,children:" "},_))}return I},Q=()=>{const I=[];for(let _=0;_<40;_++){const v=Math.round(_/39*255);I.push(s(d,{backgroundColor:`rgb(${c.r},${c.g},${v})`,children:" "},_))}return I},J=(I,_)=>Math.round(I/_*39);return g(m,{flexDirection:"column",borderStyle:"single",borderColor:"white",padding:1,children:[g(m,{flexDirection:"column",children:[s(d,{bold:!0,children:"Color Picker"}),g(m,{marginBottom:1,flexDirection:"column",children:[s(d,{color:"gray",dimColor:!0,children:"←→ to adjust (shift/ctrl/cmd +10)"}),s(d,{color:"gray",dimColor:!0,children:"↑↓ to change bar"}),s(d,{color:"gray",dimColor:!0,children:"ctrl+a to switch rgb/hsl"}),s(d,{color:"gray",dimColor:!0,children:"paste color from clipboard"}),s(d,{color:"gray",dimColor:!0,children:"enter to exit (auto-saved)"}),s(d,{color:"gray",dimColor:!0,children:"esc to save and exit"})]})]}),f==="hsl"?g(me,{children:[g(m,{marginBottom:1,children:[s(m,{width:25,children:g(d,{color:w==="h"?"yellow":"white",children:[w==="h"?"❯ ":" ","Hue (",l.h,"°):"]})}),s(m,{children:K().map((I,_)=>s(Ee,{children:_===J(l.h,360)?s(d,{children:"|"}):I},_))})]}),g(m,{marginBottom:1,children:[s(m,{width:25,children:g(d,{color:w==="s"?"yellow":"white",children:[w==="s"?"❯ ":" ","Saturation (",l.s,"%):"]})}),s(m,{children:U().map((I,_)=>s(Ee,{children:_===J(l.s,100)?s(d,{children:"|"}):I},_))})]}),g(m,{marginBottom:1,children:[s(m,{width:25,children:g(d,{color:w==="l"?"yellow":"white",children:[w==="l"?"❯ ":" ","Lightness (",l.l,"%):"]})}),s(m,{children:O().map((I,_)=>s(Ee,{children:_===J(l.l,100)?s(d,{children:"|"}):I},_))})]})]}):g(me,{children:[g(m,{marginBottom:1,children:[s(m,{width:25,children:g(d,{color:w==="r"?"yellow":"white",children:[w==="r"?"❯ ":" ","Red (",c.r,"):"]})}),s(m,{children:G().map((I,_)=>s(Ee,{children:_===J(c.r,255)?s(d,{children:"|"}):I},_))})]}),g(m,{marginBottom:1,children:[s(m,{width:25,children:g(d,{color:w==="g"?"yellow":"white",children:[w==="g"?"❯ ":" ","Green (",c.g,"):"]})}),s(m,{children:Y().map((I,_)=>s(Ee,{children:_===J(c.g,255)?s(d,{children:"|"}):I},_))})]}),g(m,{marginBottom:1,children:[s(m,{width:25,children:g(d,{color:w==="b"?"yellow":"white",children:[w==="b"?"❯ ":" ","Blue (",c.b,"):"]})}),s(m,{children:Q().map((I,_)=>s(Ee,{children:_===J(c.b,255)?s(d,{children:"|"}):I},_))})]})]}),g(m,{marginBottom:1,children:[s(d,{children:"Current: "}),s(d,{backgroundColor:T(),children:" "})]}),g(m,{flexDirection:"row",justifyContent:"space-between",children:[g(m,{flexDirection:"column",children:[s(d,{dimColor:!0,children:"Hex "}),o?.startsWith("diff")?s(d,{backgroundColor:T(),color:r?.colors?.text||"white",bold:!0,children:C(c.r,c.g,c.b)}):o==="inverseText"?s(d,{color:T(),backgroundColor:r?.colors?.permission,bold:!0,children:C(c.r,c.g,c.b)}):s(d,{color:T(),bold:!0,children:C(c.r,c.g,c.b)})]}),g(m,{flexDirection:"column",children:[s(d,{dimColor:!0,children:"RGB "}),o?.startsWith("diff")?s(d,{backgroundColor:T(),color:r?.colors?.text||"white",bold:!0,children:`rgb(${c.r}, ${c.g}, ${c.b})`}):o==="inverseText"?s(d,{color:T(),backgroundColor:r?.colors?.permission,bold:!0,children:`rgb(${c.r}, ${c.g}, ${c.b})`}):s(d,{color:T(),bold:!0,children:`rgb(${c.r}, ${c.g}, ${c.b})`})]}),g(m,{flexDirection:"column",children:[s(d,{dimColor:!0,children:"HSL "}),o?.startsWith("diff")?s(d,{backgroundColor:T(),color:r?.colors?.text||"white",bold:!0,children:`hsl(${l.h}, ${l.s}%, ${l.l}%)`}):o==="inverseText"?s(d,{color:T(),backgroundColor:r?.colors?.permission,bold:!0,children:`hsl(${l.h}, ${l.s}%, ${l.l}%)`}):s(d,{color:T(),bold:!0,children:`hsl(${l.h}, ${l.s}%, ${l.l}%)`})]})]})]})}function Ze(e){const t=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t)return{r:parseInt(t[1]),g:parseInt(t[2]),b:parseInt(t[3])};const n=e.match(/^#([a-fA-F0-9]{6})$/);if(n){const o=n[1];return{r:parseInt(o.substr(0,2),16),g:parseInt(o.substr(2,2),16),b:parseInt(o.substr(4,2),16)}}return null}function Qe(e){const t=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(t)return{h:parseInt(t[1]),s:parseInt(t[2]),l:parseInt(t[3])};const n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n){const r=parseInt(n[1])/255,i=parseInt(n[2])/255,a=parseInt(n[3])/255,l=Math.max(r,i,a),u=Math.min(r,i,a),c=l-u,h=(l+u)/2;let f=0;c!==0&&(f=h>.5?c/(2-l-u):c/(l+u));let y=0;return c!==0&&(l===r?y=((i-a)/c+(i<a?6:0))/6:l===i?y=((a-r)/c+2)/6:y=((r-i)/c+4)/6),{h:Math.round(y*360),s:Math.round(f*100),l:Math.round(h*100)}}const o=e.match(/^#([a-fA-F0-9]{6})$/);if(o){const r=o[1],i=parseInt(r.substr(0,2),16)/255,a=parseInt(r.substr(2,2),16)/255,l=parseInt(r.substr(4,2),16)/255,u=Math.max(i,a,l),c=Math.min(i,a,l),h=u-c,f=(u+c)/2;let y=0;h!==0&&(y=f>.5?h/(2-u-c):h/(u+c));let w=0;return h!==0&&(u===i?w=((a-l)/h+(a<l?6:0))/6:u===a?w=((l-i)/h+2)/6:w=((i-a)/h+4)/6),{h:Math.round(w*360),s:Math.round(y*100),l:Math.round(f*100)}}return{h:0,s:50,l:50}}function Mr({onBack:e,themeId:t}){const{settings:{themes:n},updateSettings:o}=be(ue),[r,i]=A(t),a=n.find(O=>O.id===r)||n[0],[l,u]=A("rgb"),[c,h]=A(0),[f,y]=A(null),[w,p]=A(null),[b,x]=A(""),[E,$]=A(""),k=Nn(O=>{o(T=>{const C=T.themes.findIndex(G=>G.id===r);C!==-1&&O(T.themes[C])})},[r,o]),D=O=>{if(c>=2&&gn(O)){const T=st(O),C=c-2,G=N[C];k(Y=>{Y.colors[G]=T})}};de((O,T)=>{if(f===null&&w===null){if(O.length>1&&!T.ctrl&&!T.meta){D(O);return}if(T.escape)e();else if(T.ctrl&&O==="a")u(C=>C==="rgb"?"hex":C==="hex"?"hsl":"rgb");else if(T.upArrow)h(C=>Math.max(0,C-1));else if(T.downArrow)h(C=>Math.min(N.length+1,C+1));else if(T.return)if(c===0)p("name"),x(a.name),$(a.name);else if(c===1)p("id"),x(a.id),$(a.id);else{const C=c-2,G=N[C],Y=a.colors[G];y(C),x(Y),$(Y)}}else if(f!==null)T.ctrl&&O==="a"&&u(C=>C==="rgb"?"hex":C==="hex"?"hsl":"rgb");else if(w!==null)if(T.return){if(w==="id"){const C=r;i(b),o(G=>{const Y=G.themes.findIndex(Q=>Q.id===C);Y!==-1&&(G.themes[Y].id=b)})}else k(C=>{C.name=b});p(null),x(""),$("")}else T.escape?(p(null),x(""),$("")):T.backspace||T.delete?x(C=>C.slice(0,-1)):O&&x(C=>C+O)});const N=Object.keys(a.colors),F=(O,T)=>{const C=O.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!C)return O;const G=parseInt(C[1]),Y=parseInt(C[2]),Q=parseInt(C[3]);switch(T){case"hex":{const J=I=>I.toString(16).padStart(2,"0");return`#${J(G)}${J(Y)}${J(Q)}`}case"hsl":{const J=G/255,I=Y/255,_=Q/255,v=Math.max(J,I,_),B=Math.min(J,I,_),S=v-B,P=(v+B)/2;let q=0;S!==0&&(q=P>.5?S/(2-v-B):S/(v+B));let W=0;return S!==0&&(v===J?W=((I-_)/S+(I<_?6:0))/6:v===I?W=((_-J)/S+2)/6:W=((J-I)/S+4)/6),`hsl(${Math.round(W*360)}, ${Math.round(q*100)}%, ${Math.round(P*100)}%)`}case"rgb":default:return O}},K=O=>({autoAccept:"Auto-accept edits mode indicator",bashBorder:"Bash command border",claude:"Claude branding color. Used for the Claude logo, the welcome message, and the thinking text.",claudeShimmer:"Color used for the shimmering effect on the thinking verb.",claudeBlue_FOR_SYSTEM_SPINNER:"System spinner color (blue variant)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"System spinner shimmer color (blue variant)",permission:"Permission prompt color",permissionShimmer:"Permission prompt shimmer color",planMode:"Plan mode indicator",ide:"Color used for IDE-related messages.",promptBorder:"Input prompt border color",promptBorderShimmer:"Input prompt border shimmer color",text:"Code color. Used in diffs.",inverseText:"Inverse text color. Used for the text of tabs, where the background is filled in.",inactive:"Inactive/dimmed text. Used for line numbers and less prominent text.",subtle:"Subtle text. Used for help text and secondary information.",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.",background:"Background color for certain UI elements",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",warningShimmer:"Warning shimmer color",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)",red_FOR_SUBAGENTS_ONLY:"Red color for sub agents",blue_FOR_SUBAGENTS_ONLY:"Blue color for sub agents",green_FOR_SUBAGENTS_ONLY:"Green color for sub agents",yellow_FOR_SUBAGENTS_ONLY:"Yellow color for sub agents",purple_FOR_SUBAGENTS_ONLY:"Purple color for sub agents",orange_FOR_SUBAGENTS_ONLY:"Orange color for sub agents",pink_FOR_SUBAGENTS_ONLY:"Pink color for sub agents",cyan_FOR_SUBAGENTS_ONLY:"Cyan color for sub agents",professionalBlue:"Professional blue color for business contexts?",rainbow_red:'"ultrathink" rainbow - red',rainbow_orange:'"ultrathink" rainbow - orange',rainbow_yellow:'"ultrathink" rainbow - yellow',rainbow_green:'"ultrathink" rainbow - green',rainbow_blue:'"ultrathink" rainbow - blue',rainbow_indigo:'"ultrathink" rainbow - indigo',rainbow_violet:'"ultrathink" rainbow - violet',rainbow_red_shimmer:'"ultrathink" rainbow (shimmer) - red',rainbow_orange_shimmer:'"ultrathink" rainbow (shimmer) - orange',rainbow_yellow_shimmer:'"ultrathink" rainbow (shimmer) - yellow',rainbow_green_shimmer:'"ultrathink" rainbow (shimmer) - green',rainbow_blue_shimmer:'"ultrathink" rainbow (shimmer) - blue',rainbow_indigo_shimmer:'"ultrathink" rainbow (shimmer) - indigo',rainbow_violet_shimmer:'"ultrathink" rainbow (shimmer) - violet',clawd_body:'"Clawd" character body color',clawd_background:'"Clawd" character background color',userMessageBackground:"Background color for user messages",bashMessageBackgroundColor:"Background color for bash command output",memoryBackgroundColor:"Background color for memory/context information",rate_limit_fill:"Rate limit indicator fill color",rate_limit_empty:"Rate limit indicator empty/background color"})[O]||"",U=Math.max(...N.map(O=>O.length));return g(m,{children:[g(m,{flexDirection:"column",width:"50%",children:[s(m,{children:g(pe,{children:["Editing theme “",a.name,"” (",a.id,")"]})}),f===null&&w===null?g(me,{children:[g(m,{marginBottom:1,flexDirection:"column",children:[s(d,{dimColor:!0,children:"enter to edit theme name, id, or color"}),s(d,{dimColor:!0,children:"ctrl+a to toggle rgb, hex, hsl"}),s(d,{dimColor:!0,children:"paste color from clipboard (when on color)"}),s(d,{dimColor:!0,children:"esc to go back"})]}),c<2?g(m,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:"yellow",flexDirection:"column",paddingLeft:1,children:[s(d,{bold:!0,children:c===0?"Theme Name":"Theme ID"}),s(d,{children:c===0?"The display name for this theme":"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):g(m,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:a.colors[N[c-2]],flexDirection:"column",paddingLeft:1,children:[s(Xe,{colorKey:N[c-2],theme:a,bold:!0}),s(d,{children:K(N[c-2])})]}),g(m,{flexDirection:"column",children:[g(m,{children:[s(d,{color:c===0?"yellow":"white",children:c===0?"❯ ":" "}),s(d,{bold:!0,children:"Name: "}),s(d,{children:a.name})]}),g(m,{marginBottom:1,children:[s(d,{color:c===1?"yellow":"white",children:c===1?"❯ ":" "}),s(d,{bold:!0,children:"ID: "}),s(d,{children:a.id})]}),(()=>{if(c<2){const J=N.slice(0,20);return g(me,{children:[J.map((I,_)=>{const v=_+2;return g(m,{children:[s(d,{color:c===v?"yellow":"white",children:c===v?"❯ ":" "}),s(m,{width:U+2,children:s(d,{children:s(Xe,{colorKey:I,theme:a,bold:!0})})}),s(V,{color:a.colors[I],children:F(a.colors[I],l)})]},I)}),N.length>20&&g(d,{color:"gray",dimColor:!0,children:[" ","↓ ",N.length-20," more below"]})]})}const T=c-2,C=Math.max(0,T-Math.floor(20/2)),G=Math.min(N.length,C+20),Y=Math.max(0,G-20),Q=N.slice(Y,G);return g(me,{children:[Y>0&&g(d,{color:"gray",dimColor:!0,children:[" ","↑ ",Y," more above"]}),Q.map((J,I)=>{const v=Y+I+2;return g(m,{children:[s(d,{color:c===v?"yellow":"white",children:c===v?"❯ ":" "}),s(m,{width:U+2,children:s(d,{children:s(Xe,{colorKey:J,theme:a,bold:!0})})}),s(V,{color:a.colors[J],children:F(a.colors[J],l)})]},J)}),G<N.length&&g(d,{color:"gray",dimColor:!0,children:[" ","↓ ",N.length-G," more below"]})]})})()]})]}):w?g(m,{flexDirection:"column",marginTop:1,children:[g(d,{children:["Editing ",w==="name"?"theme name":"theme ID",":"]}),s(m,{borderStyle:"round",borderColor:"yellow",paddingX:1,children:s(d,{children:b})}),s(d,{dimColor:!0,children:"enter to save, esc to cancel"})]}):s(at,{initialValue:E,colorKey:N[f],theme:a,onColorChange:O=>{x(O),k(T=>{T.colors[N[f]]=O})},onExit:()=>{k(O=>{O.colors[N[f]]=b}),y(null),x(""),$("")}})]}),s(m,{width:"50%",children:s(lt,{theme:a})})]})}function Nr(e){return e.map(t=>`${t.name} (${t.id})`)}function Or({onBack:e}){const{settings:{themes:t},updateSettings:n}=be(ue),[o,r]=A(0),[i,a]=A(null),[l,u]=A(!0),c=()=>{const b={colors:{...(t[0]||ee.themes[0]).colors},name:"New Custom Theme",id:`custom-${Date.now()}`};n(x=>{x.themes.push(b)}),a(b.id),u(!1)},h=p=>{t.length<=1||(n(b=>{b.themes=b.themes.filter(x=>x.id!==p)}),o>=t.length-1&&r(Math.max(0,t.length-2)))},f=()=>{n(p=>{p.themes=[...ee.themes]}),r(0)};if(de((p,b)=>{if(b.escape)e();else if(b.upArrow)r(x=>Math.max(0,x-1));else if(b.downArrow)r(x=>Math.min(t.length-1,x+1));else if(b.return){const x=t[o];x&&(a(x.id),u(!1))}else if(p==="n")c();else if(p==="d"){const x=t[o];x&&h(x.id)}else b.ctrl&&p==="r"&&f()},{isActive:l}),i)return s(Mr,{themeId:i,onBack:()=>{a(null),u(!0)}});const y=Nr(t),w=t.find(p=>y[o]?.includes(`(${p.id})`))||t[0];return t.length===0?s(m,{children:g(m,{flexDirection:"column",width:"100%",children:[s(pe,{children:"Themes"}),g(m,{marginBottom:1,flexDirection:"column",children:[s(d,{dimColor:!0,children:"n to create a new theme"}),s(d,{dimColor:!0,children:"esc to go back"})]}),s(d,{children:"No themes available!"})]})}):g(m,{children:[g(m,{flexDirection:"column",width:"50%",children:[s(pe,{children:"Themes"}),g(m,{marginBottom:1,flexDirection:"column",children:[s(d,{dimColor:!0,children:"n to create a new theme"}),s(d,{dimColor:!0,children:"d to delete a theme"}),s(d,{dimColor:!0,children:"ctrl+r to delete all themes and restore built-in"}),s(d,{dimColor:!0,children:"enter to edit theme"}),s(d,{dimColor:!0,children:"esc to go back"})]}),s(m,{flexDirection:"column",children:y.map((p,b)=>g(d,{color:o===b?"yellow":void 0,children:[o===b?"❯ ":" ",p]},b))})]}),s(m,{width:"50%",children:s(lt,{theme:w})})]})}function Br({onBack:e}){const{settings:{thinkingVerbs:{format:t,verbs:n},themes:o},updateSettings:r}=be(ue),i=["format","verbs"],[a,l]=A(0),u=i[a],[c,h]=A(0),[f,y]=A(!1),[w,p]=A(""),[b,x]=A(!1),[E,$]=A(!1),[k,D]=A(t),N=hn(),K=(o.find(O=>O.id===N)||o.find(O=>O.id==="dark"))?.colors.claude||"rgb(215,119,87)";de((O,T)=>{if(E){T.return?(r(C=>{C.thinkingVerbs.format=k}),$(!1)):T.escape?(D(t),$(!1)):T.backspace||T.delete?D(C=>C.slice(0,-1)):O&&D(C=>C+O);return}if(f||b){T.return&&w.trim()?(b?(r(C=>{C.thinkingVerbs.verbs.push(w.trim())}),x(!1)):(r(C=>{C.thinkingVerbs.verbs[c]=w.trim()}),y(!1)),p("")):T.escape?(p(""),y(!1),x(!1)):T.backspace||T.delete?p(C=>C.slice(0,-1)):O&&p(C=>C+O);return}T.escape?e():T.return?u==="format"&&(D(t),$(!0)):T.tab?T.shift?l(C=>C===0?i.length-1:C-1):l(C=>C===i.length-1?0:C+1):T.upArrow?u==="verbs"&&n.length>0&&h(C=>C>0?C-1:n.length-1):T.downArrow?u==="verbs"&&n.length>0&&h(C=>C<n.length-1?C+1:0):O==="e"&&u==="verbs"?n.length>0&&(p(n[c]),y(!0)):O==="d"&&u==="verbs"?n.length>1&&(r(C=>{C.thinkingVerbs.verbs=C.thinkingVerbs.verbs.filter((G,Y)=>Y!==c)}),c>=n.length-1&&h(Math.max(0,n.length-2))):O==="n"&&u==="verbs"?(x(!0),p("")):T.ctrl&&O==="r"&&u==="verbs"&&(r(C=>{C.thinkingVerbs.verbs=[...ee.thinkingVerbs.verbs]}),h(0))});const U=50;return g(m,{children:[g(m,{flexDirection:"column",width:`${100-U}%`,children:[g(m,{marginBottom:1,flexDirection:"column",children:[s(pe,{children:"Thinking Verbs"}),g(m,{flexDirection:"column",children:[s(d,{dimColor:!0,children:u==="format"?"enter to edit format":"changes auto-saved"}),s(d,{dimColor:!0,children:"esc to go back"}),s(d,{dimColor:!0,children:"tab to switch sections"})]})]}),s(m,{marginBottom:1,children:s(d,{dimColor:!0,children:"Customize the verbs shown during generation and their format."})}),g(m,{flexDirection:"column",children:[g(d,{children:[s(d,{color:u==="format"?"yellow":void 0,children:u==="format"?"❯ ":" "}),s(d,{bold:!0,color:u==="format"?"yellow":void 0,children:"Format"})]}),u==="format"&&(E?g(d,{dimColor:!0,children:[" ","enter to save"]}):g(d,{dimColor:!0,children:[" ","enter to edit"]}))]}),s(m,{marginLeft:2,marginBottom:1,children:s(m,{borderStyle:"round",borderColor:E?"yellow":"gray",children:s(d,{children:E?k:t})})}),s(m,{children:g(d,{children:[s(d,{color:u==="verbs"?"yellow":void 0,children:u==="verbs"?"❯ ":" "}),s(d,{bold:!0,color:u==="verbs"?"yellow":void 0,children:"Verbs"})]})}),u==="verbs"&&s(m,{flexDirection:"column",children:g(d,{dimColor:!0,children:[" ","e to edit · d to delete · n to add new · ctrl+r to reset"]})}),s(m,{marginLeft:2,marginBottom:1,children:g(m,{flexDirection:"column",children:[(()=>{const T=Math.max(0,c-Math.floor(4)),C=Math.min(n.length,T+8),G=Math.max(0,C-8),Y=n.slice(G,C);return g(me,{children:[G>0&&g(d,{color:"gray",dimColor:!0,children:[" ","↑ ",G," more above"]}),Y.map((Q,J)=>{const I=G+J;return g(d,{color:u==="verbs"&&I===c?"cyan":void 0,children:[u==="verbs"&&I===c?"❯ ":" ",Q]},I)}),C<n.length&&g(d,{color:"gray",dimColor:!0,children:[" ","↓ ",n.length-C," more below"]})]})})(),b&&g(m,{alignItems:"center",children:[s(d,{color:"yellow",children:"❯ "}),s(m,{borderStyle:"round",borderColor:"yellow",children:s(d,{children:w})})]}),f&&g(m,{marginTop:1,alignItems:"center",children:[s(d,{children:"Editing: "}),s(m,{borderStyle:"round",borderColor:"yellow",children:s(d,{children:w})})]})]})})]}),g(m,{width:`${U}%`,flexDirection:"column",children:[s(m,{marginBottom:1,children:s(d,{bold:!0,children:"Preview"})}),s(m,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:g(d,{children:[g(d,{color:K,children:["✻ ",t.replace(/\{\}/g,n[c])," "]}),s(d,{children:"(esc to interrupt)"})]})})]})]})}const _e=[{name:"Default",phases:ee.thinkingStyle.phases,reverseMirror:ee.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 Ar({onBack:e}){const{settings:{thinkingStyle:{phases:t,updateInterval:n,reverseMirror:o},themes:r},updateSettings:i}=be(ue),a=["reverseMirror","updateInterval","phases","presets"],[l,u]=A(0),c=a[l],[h,f]=A(0),[y,w]=A(0),[p,b]=A(!1),[x,E]=A(""),[$,k]=A(!1),[D,N]=A(!1),[F,K]=A(n.toString()),[U,O]=A(0),T=hn(),G=(r.find(v=>v.id===T)||r.find(v=>v.id==="dark"))?.colors.claude||"rgb(215,119,87)";xe(()=>{if(t.length>0){const v=o?[...t,...[...t].reverse().slice(1,-1)]:t,B=setInterval(()=>{O(S=>(S+1)%v.length)},n);return()=>clearInterval(B)}},[t,n,o]),de((v,B)=>{if(D){if(B.return){const S=parseInt(F);!isNaN(S)&&S>0&&i(P=>{P.thinkingStyle.updateInterval=S}),N(!1)}else B.escape?(K(n.toString()),N(!1)):B.backspace||B.delete?K(S=>S.slice(0,-1)):v&&v.match(/^[0-9]$/)&&K(S=>S+v);return}if(p||$){if(B.return&&x.length){const S=$?[...t,x]:t.map((P,q)=>q===h?x:P);i(P=>{P.thinkingStyle.phases=S}),b(!1),E("")}else B.escape?(E(""),b(!1),k(!1)):B.backspace||B.delete?E(S=>S.slice(0,-1)):v&&E(S=>S+v);return}if(B.escape)e();else if(B.return)if(c==="updateInterval")K(n.toString()),N(!0);else if(c==="presets"){const S=_e[y];i(P=>{P.thinkingStyle.phases=[...S.phases],P.thinkingStyle.reverseMirror=S.reverseMirror})}else c==="reverseMirror"&&i(S=>{S.thinkingStyle.reverseMirror=!S.thinkingStyle.reverseMirror});else if(B.tab)B.shift?u(S=>S===0?a.length-1:S-1):u(S=>S===a.length-1?0:S+1);else if(B.upArrow)c==="phases"&&t.length>0?f(S=>S>0?S-1:t.length-1):c==="presets"&&w(S=>S>0?S-1:_e.length-1);else if(B.downArrow)c==="phases"&&t.length>0?f(S=>S<t.length-1?S+1:0):c==="presets"&&w(S=>S<_e.length-1?S+1:0);else if(v===" ")c==="reverseMirror"&&i(S=>{S.thinkingStyle.reverseMirror=!S.thinkingStyle.reverseMirror});else if(v==="e"&&c==="phases")t.length>0&&(E(t[h]),b(!0));else if(v==="a"&&c==="phases")k(!0),E("");else if(v==="d"&&c==="phases")t.length>1&&(i(S=>{S.thinkingStyle.phases=t.filter((P,q)=>q!==h)}),h>=t.length&&f(Math.max(0,t.length-1)));else if(v==="w"&&c==="phases"){if(h>0){const S=[...t];[S[h-1],S[h]]=[S[h],S[h-1]],i(P=>{P.thinkingStyle.phases=S}),f(P=>P-1)}}else if(v==="s"&&c==="phases"){if(h<t.length-1){const S=[...t];[S[h],S[h+1]]=[S[h+1],S[h]],i(P=>{P.thinkingStyle.phases=S}),f(P=>P+1)}}else B.ctrl&&v==="r"&&(i(S=>{S.thinkingStyle=ee.thinkingStyle}),f(0),w(0))});const Y=o?"●":"○",Q=50,I=o?[...t,...[...t].reverse().slice(1,-1)]:t,_=I.length>0?I[U]:"·";return s(m,{children:g(m,{flexDirection:"column",width:"100%",children:[g(m,{flexDirection:"row",width:"100%",children:[g(m,{marginBottom:1,flexDirection:"column",width:`${100-Q}%`,children:[s(pe,{children:"Thinking style"}),g(m,{flexDirection:"column",children:[g(d,{dimColor:!0,children:["enter to"," ",c==="updateInterval"?"edit interval":c==="presets"?"apply preset":"save"]}),s(d,{dimColor:!0,children:"esc to go back"}),s(d,{dimColor:!0,children:"tab to switch sections"})]})]}),g(m,{width:`${Q}%`,flexDirection:"column",children:[s(m,{children:s(d,{bold:!0,children:"Preview"})}),g(m,{borderStyle:"single",borderColor:"gray",paddingX:1,flexDirection:"row",children:[s(m,{width:(_?.length??0)+1,children:s(d,{color:G,children:_})}),g(d,{children:[s(d,{color:G,children:"Thinking… "}),s(d,{children:"(esc to interrupt)"})]})]})]})]}),g(m,{flexDirection:"row",gap:4,children:[g(m,{flexDirection:"column",children:[g(d,{children:[s(d,{color:c==="reverseMirror"?"yellow":void 0,children:c==="reverseMirror"?"❯ ":" "}),s(d,{bold:!0,color:c==="reverseMirror"?"yellow":void 0,children:"Reverse-mirror phases"})]}),c==="reverseMirror"&&g(d,{dimColor:!0,children:[" ","space to toggle"]}),s(m,{marginLeft:2,marginBottom:1,children:g(d,{children:[Y," ",o?"Enabled":"Disabled"]})})]}),g(m,{flexDirection:"column",children:[g(d,{children:[s(d,{color:c==="updateInterval"?"yellow":void 0,children:c==="updateInterval"?"❯ ":" "}),s(d,{bold:!0,color:c==="updateInterval"?"yellow":void 0,children:"Update interval (ms)"})]}),c==="updateInterval"&&(D?g(d,{dimColor:!0,children:[" ","enter to save"]}):g(d,{dimColor:!0,children:[" ","enter to edit"]})),s(m,{marginLeft:2,marginBottom:1,children:s(m,{borderStyle:"round",borderColor:D?"yellow":"gray",children:s(d,{children:D?F:n})})})]})]}),s(m,{children:g(d,{children:[s(d,{color:c==="phases"?"yellow":void 0,children:c==="phases"?"❯ ":" "}),s(d,{bold:!0,color:c==="phases"?"yellow":void 0,children:"Phases"})]})}),c==="phases"&&s(m,{marginBottom:1,flexDirection:"column",children:g(d,{dimColor:!0,children:[" ","[e]dit"," ","[a]dd"," ","[d]elete"," ","[w]move up"," ","[s]move down"]})}),s(m,{marginLeft:2,marginBottom:1,children:g(m,{flexDirection:"column",children:[(()=>{const B=Math.max(0,h-Math.floor(4)),S=Math.min(t.length,B+8),P=Math.max(0,S-8),q=t.slice(P,S);return g(me,{children:[P>0&&g(d,{color:"gray",dimColor:!0,children:[" ","↑ ",P," more above"]}),q.map((W,te)=>{const se=P+te;return g(d,{color:c==="phases"&&se===h?"cyan":void 0,children:[c==="phases"&&se===h?"❯ ":" ",W]},se)}),S<t.length&&g(d,{color:"gray",dimColor:!0,children:[" ","↓ ",t.length-S," more below"]})]})})(),$&&g(m,{children:[s(d,{color:"yellow",children:"❯ "}),s(m,{borderStyle:"round",borderColor:"yellow",children:s(d,{children:x})})]}),p&&g(m,{marginTop:1,children:[s(d,{children:"Editing: "}),s(m,{borderStyle:"round",borderColor:"yellow",children:s(d,{children:x})})]})]})}),s(m,{children:g(d,{children:[s(d,{color:c==="presets"?"yellow":void 0,children:c==="presets"?"❯ ":" "}),s(d,{bold:!0,color:c==="presets"?"yellow":void 0,children:"Presets"})]})}),c==="presets"&&g(d,{dimColor:!0,children:[" ","Selecting one will overwrite your choice of phases"]}),s(m,{marginLeft:2,marginBottom:1,children:s(m,{flexDirection:"column",children:(()=>{const B=Math.max(0,y-Math.floor(4)),S=Math.min(_e.length,B+8),P=Math.max(0,S-8),q=_e.slice(P,S);return g(me,{children:[P>0&&g(d,{color:"gray",dimColor:!0,children:[" ","↑ ",P," more above"]}),q.map((W,te)=>{const se=P+te;return g(d,{color:c==="presets"&&se===y?"cyan":void 0,children:[c==="presets"&&se===y?"❯ ":" ",W.name," ",W.phases.join("")]},se)}),S<_e.length&&g(d,{color:"gray",dimColor:!0,children:[" ","↓ ",_e.length-S," more below"]})]})})()})}),s(m,{marginTop:1,children:s(d,{dimColor:!0,children:"ctrl+r to reset all settings to default"})})]})})}const De=[{label:"bold",value:"bold"},{label:"italic",value:"italic"},{label:"underline",value:"underline"},{label:"strikethrough",value:"strikethrough"},{label:"inverse",value:"inverse"}];function Pr({onBack:e}){const{settings:t,updateSettings:n}=be(ue),[o,r]=A("prefix"),[i,a]=A(0),[l,u]=A(!1),[c,h]=A(()=>t.userMessageDisplay.prefix.format),[f,y]=A(0),[w,p]=A(()=>[...t.userMessageDisplay.prefix.styling]),[b,x]=A(()=>t.userMessageDisplay.prefix.foreground_color),[E,$]=A(()=>t.userMessageDisplay.prefix.background_color),[k,D]=A(0),[N,F]=A(0),[K,U]=A(()=>[...t.userMessageDisplay.message.styling]),[O,T]=A(()=>t.userMessageDisplay.message.foreground_color),[C,G]=A(()=>t.userMessageDisplay.message.background_color),[Y,Q]=A(null),[J,I]=A(""),_=hn(),v=t.themes?.find(z=>z.id===_)||t.themes?.[0],B=["format","styling","foreground","background"],S=["styling","foreground","background"],P=B[i],q=S[k],W=(z,R)=>{n(L=>{const ne=z==="prefix"?L.userMessageDisplay.prefix:L.userMessageDisplay.message;R(ne)})},te=z=>{n(R=>{z==="prefix"?R.userMessageDisplay.prefix={...ee.userMessageDisplay.prefix}:R.userMessageDisplay.message={...ee.userMessageDisplay.message}}),z==="prefix"?(h(ee.userMessageDisplay.prefix.format),p([...ee.userMessageDisplay.prefix.styling]),x(ee.userMessageDisplay.prefix.foreground_color),$(ee.userMessageDisplay.prefix.background_color)):(U([...ee.userMessageDisplay.message.styling]),T(ee.userMessageDisplay.message.foreground_color),G(ee.userMessageDisplay.message.background_color))};xe(()=>{const z=t.userMessageDisplay.prefix;h(z.format),p([...z.styling]),x(z.foreground_color),$(z.background_color);const R=t.userMessageDisplay.message;U([...R.styling]),T(R.foreground_color),G(R.background_color)},[]),de((z,R)=>{if(l){if(R.return)W("prefix",L=>{L.format=c}),u(!1);else if(R.escape){const L=t.userMessageDisplay.prefix;h(L.format),u(!1)}else R.backspace||R.delete?h(L=>L.slice(0,-1)):z&&h(L=>L+z);return}if(Y===null){if(R.escape)e();else if(R.ctrl&&z==="r")te(o);else if(R.leftArrow||R.rightArrow)r(L=>L==="prefix"?"message":"prefix");else if(R.tab)o==="prefix"?R.shift?a(L=>L===0?B.length-1:L-1):a(L=>L===B.length-1?0:L+1):R.shift?D(L=>L===0?S.length-1:L-1):D(L=>L===S.length-1?0:L+1);else if(R.return)o==="prefix"?P==="format"?u(!0):P==="foreground"?(I(b),Q({column:"prefix",type:"foreground"})):P==="background"&&(I(E),Q({column:"prefix",type:"background"})):q==="foreground"?(I(O),Q({column:"message",type:"foreground"})):q==="background"&&(I(C),Q({column:"message",type:"background"}));else if(R.upArrow)o==="prefix"&&P==="styling"?y(L=>Math.max(0,L-1)):o==="message"&&q==="styling"&&F(L=>Math.max(0,L-1));else if(R.downArrow)o==="prefix"&&P==="styling"?y(L=>Math.min(De.length-1,L+1)):o==="message"&&q==="styling"&&F(L=>Math.min(De.length-1,L+1));else if(z===" "){if(o==="prefix"&&P==="styling"){const L=De[f].value,ne=w.indexOf(L)>=0?w.filter(X=>X!==L):[...w,L];p(ne),W("prefix",X=>{X.styling=[...ne]})}else if(o==="message"&&q==="styling"){const L=De[N].value,ne=K.indexOf(L)>=0?K.filter(X=>X!==L):[...K,L];U(ne),W("message",X=>{X.styling=[...ne]})}}}});const se=(z,R,L=!0)=>{const ne=L?R==="prefix"?w:K:[],X=L?R==="prefix"?b:O:"rgb(255,255,255)",Ae=L?R==="prefix"?E:C:"rgb(0,0,0)",Pe=X==="rgb(0,0,0)"&&Ae==="rgb(0,0,0)",Ue=ne.length>0;return Pe&&!Ue?s(d,{children:z}):s(d,{bold:ne.includes("bold"),italic:ne.includes("italic"),underline:ne.includes("underline"),strikethrough:ne.includes("strikethrough"),inverse:ne.includes("inverse"),color:Pe?void 0:X,backgroundColor:Pe?void 0:Ae,children:z})},$e=(z=!0)=>g(d,{children:[c&&g(me,{children:[se(c,"prefix",z)," "]}),se("list the dir","message",z)]}),we=z=>{const R=o===z,X=(z==="prefix"?B:S)[z==="prefix"?i:k],Ae=z==="prefix"?f:N,Pe=z==="prefix"?w:K,Ue=z==="prefix"?b:O,mn=z==="prefix"?E:C;return g(m,{flexDirection:"column",width:"45%",borderStyle:R?"round":"single",borderColor:R?"yellow":"gray",padding:1,children:[s(m,{marginBottom:1,children:g(d,{bold:!0,color:R?"yellow":void 0,children:[z.charAt(0).toUpperCase()+z.slice(1)," ","Configuration"]})}),z==="prefix"&&g(me,{children:[s(m,{children:g(d,{color:R&&X==="format"?"yellow":void 0,bold:R&&X==="format",children:[R&&X==="format"?"❯ ":" ","Prefix Text"]})}),R&&X==="format"&&s(m,{marginLeft:2,children:s(d,{dimColor:!0,children:l?"enter to save":"enter to edit (appears before message)"})}),s(m,{marginLeft:2,marginBottom:1,children:s(m,{borderStyle:"round",borderColor:l?"yellow":"gray",children:s(d,{children:c})})})]}),s(m,{children:g(d,{color:R&&X==="styling"?"yellow":void 0,bold:R&&X==="styling",children:[R&&X==="styling"?"❯ ":" ","Styling"]})}),R&&X==="styling"&&s(m,{marginLeft:2,children:s(d,{dimColor:!0,children:"up/down to navigate · space to toggle"})}),s(m,{marginLeft:2,marginBottom:1,flexDirection:"column",children:De.map((qe,pn)=>s(m,{children:g(d,{color:R&&X==="styling"&&Ae===pn?"cyan":void 0,children:[R&&X==="styling"&&Ae===pn?"❯ ":" ",Pe.includes(qe.value)?"●":"○"," ",qe.label]})},qe.value))}),s(m,{children:g(d,{color:R&&X==="foreground"?"yellow":void 0,bold:R&&X==="foreground",children:[R&&X==="foreground"?"❯ ":" ","Foreground color"]})}),R&&X==="foreground"&&s(m,{marginLeft:2,children:s(d,{dimColor:!0,children:"enter to open color picker"})}),s(m,{marginLeft:2,marginBottom:1,children:s(d,{color:Ue,children:Ue})}),s(m,{children:g(d,{color:R&&X==="background"?"yellow":void 0,bold:R&&X==="background",children:[R&&X==="background"?"❯ ":" ","Background color"]})}),R&&X==="background"&&s(m,{marginLeft:2,children:s(d,{dimColor:!0,children:"enter to open color picker"})}),s(m,{marginLeft:2,children:s(d,{backgroundColor:mn,children:mn})})]})};if(Y){const{column:z,type:R}=Y;return s(at,{initialValue:J,theme:v,onColorChange:L=>{z==="prefix"?R==="foreground"?(x(L),W("prefix",ne=>{ne.foreground_color=L})):($(L),W("prefix",ne=>{ne.background_color=L})):R==="foreground"?(T(L),W("message",ne=>{ne.foreground_color=L})):(G(L),W("message",ne=>{ne.background_color=L}))},onExit:()=>{Q(null),I("")}})}return g(m,{flexDirection:"column",children:[s(pe,{children:"Customize how user messages are displayed"}),g(m,{flexDirection:"column",marginBottom:1,children:[s(d,{dimColor:!0,children:"left/right arrows to switch columns · tab to navigate options"}),s(d,{dimColor:!0,children:"enter to edit · ctrl+r to reset active column · esc to go back"})]}),g(m,{flexDirection:"row",gap:1,children:[we("prefix"),we("message")]}),s(m,{borderStyle:"round",padding:1,marginTop:1,children:g(m,{flexDirection:"column",children:[s(m,{marginBottom:1,children:s(d,{bold:!0,children:"Preview"})}),g(m,{flexDirection:"row",gap:2,children:[g(m,{flexDirection:"column",width:"50%",children:[s(m,{marginBottom:1,children:s(d,{underline:!0,children:"Before (Claude Code default):"})}),s(m,{marginLeft:1,marginTop:1,children:g(d,{children:[s(d,{color:v?.colors?.inactive||"#888888",children:"●"}),s(d,{children:" The directory "}),s(d,{color:v?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),s(d,{children:" contains "}),s(d,{bold:!0,children:"123"}),s(d,{children:" files."})]})})]}),g(m,{flexDirection:"column",width:"50%",children:[s(m,{marginBottom:1,children:s(d,{underline:!0,children:"After (Your customization):"})}),s(m,{marginLeft:1,children:$e(!0)}),s(m,{marginLeft:1,marginTop:1,children:g(d,{children:[s(d,{color:v?.colors?.inactive||"#888888",children:"●"}),s(d,{children:" The directory "}),s(d,{color:v?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),s(d,{children:" contains "}),s(d,{bold:!0,children:"123"}),s(d,{children:" files."})]})})]})]})]})})]})}function Lr({onSubmit:e}){const{settings:t,updateSettings:n}=be(ue),[o,r]=A(0),i=()=>{n(w=>{w.inputBox||(w.inputBox={removeBorder:!1}),w.inputBox.removeBorder=!w.inputBox.removeBorder})},a=()=>{n(w=>{w.misc||(w.misc={showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0}),w.misc.showTweakccVersion=!w.misc.showTweakccVersion})},l=()=>{n(w=>{w.misc||(w.misc={showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0}),w.misc.showPatchesApplied=!w.misc.showPatchesApplied})},u=()=>{n(w=>{w.misc||(w.misc={showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0}),w.misc.expandThinkingBlocks=!w.misc.expandThinkingBlocks})};de((w,p)=>{p.return||p.escape?e():p.upArrow?r(b=>Math.max(0,b-1)):p.downArrow?r(b=>Math.min(3,b+1)):w===" "&&(o===0?i():o===1?a():o===2?l():o===3&&u())});const c=t.inputBox?.removeBorder?"☑":"☐",h=t.misc?.showTweakccVersion?"☑":"☐",f=t.misc?.showPatchesApplied?"☑":"☐",y=t.misc?.expandThinkingBlocks?"☑":"☐";return g(m,{flexDirection:"column",children:[s(m,{marginBottom:1,children:s(pe,{children:"Miscellaneous Settings"})}),s(m,{marginBottom:1,children:s(d,{color:"gray",children:s(d,{dimColor:!0,children:"Various tweaks and customizations. Press space to toggle settings, enter to go back."})})}),s(m,{children:g(d,{children:[s(d,{color:o===0?"cyan":void 0,children:o===0?"❯ ":" "}),s(d,{bold:!0,color:o===0?"cyan":void 0,children:"Remove input box border"})]})}),s(m,{flexDirection:"column",children:g(d,{dimColor:!0,children:[" ","Removes the rounded border around the input box for a cleaner look."]})}),s(m,{marginLeft:4,marginBottom:1,children:g(d,{children:[c," ",t.inputBox?.removeBorder?"Enabled":"Disabled"]})}),s(m,{children:g(d,{children:[s(d,{color:o===1?"cyan":void 0,children:o===1?"❯ ":" "}),s(d,{bold:!0,color:o===1?"cyan":void 0,children:"Show tweakcc version at startup"})]})}),s(m,{flexDirection:"column",children:g(d,{dimColor:!0,children:[" ",'Shows the blue "+ tweakcc v<VERSION>" message when starting Claude Code.']})}),s(m,{marginLeft:4,marginBottom:1,children:g(d,{children:[h," ",t.misc?.showTweakccVersion?"Enabled":"Disabled"]})}),s(m,{children:g(d,{children:[s(d,{color:o===2?"cyan":void 0,children:o===2?"❯ ":" "}),s(d,{bold:!0,color:o===2?"cyan":void 0,children:"Show patches applied indicator at startup"})]})}),s(m,{flexDirection:"column",children:g(d,{dimColor:!0,children:[" ",'Shows the green "tweakcc patches are applied" indicator when starting Claude Code.']})}),s(m,{marginLeft:4,marginBottom:1,children:g(d,{children:[f," ",t.misc?.showPatchesApplied?"Enabled":"Disabled"]})}),s(m,{children:g(d,{children:[s(d,{color:o===3?"cyan":void 0,children:o===3?"❯ ":" "}),s(d,{bold:!0,color:o===3?"cyan":void 0,children:"Expand thinking blocks"})]})}),s(m,{flexDirection:"column",children:g(d,{dimColor:!0,children:[" ","Makes thinking blocks always expanded by default instead of collapsed."]})}),s(m,{marginLeft:4,marginBottom:1,children:g(d,{children:[y," ",t.misc?.expandThinkingBlocks?"Enabled":"Disabled"]})})]})}const He=["Task","Bash","Glob","Grep","Read","Edit","Write","NotebookEdit","WebFetch","WebSearch","BashOutput","KillShell","TodoWrite","AskUserQuestion","Skill","SlashCommand","ExitPlanMode"];function Dr({toolsetIndex:e,onBack:t}){const{settings:n,updateSettings:o}=be(ue),r=n.toolsets[e],[i,a]=A(r?.name||"New Toolset"),[l,u]=A(r?.allowedTools||[]),[c,h]=A(!1),[f,y]=A(0);xe(()=>{r&&o(E=>{E.toolsets[e].name=i,E.toolsets[e].allowedTools=l})},[i,l]);const w=E=>l==="*"?!0:l.includes(E),p=E=>{E==="All"?u("*"):E==="None"?u([]):l==="*"?u(He.filter($=>$!==E)):l.includes(E)?u(l.filter($=>$!==E)):u([...l,E])};if(de((E,$)=>{if(c){$.return?h(!1):$.escape?(a(r?.name||"New Toolset"),h(!1)):$.backspace||$.delete?a(k=>k.slice(0,-1)):E&&E.length===1&&a(k=>k+E);return}if($.escape)t();else if($.upArrow)y(k=>Math.max(0,k-1));else if($.downArrow)y(k=>Math.min(He.length+1,k+1));else if(E===" "||$.return)if(f===0)p("All");else if(f===1)p("None");else{const k=He[f-2];k&&p(k)}else E==="n"&&h(!0)}),!r)return s(m,{flexDirection:"column",children:s(d,{color:"red",children:"Toolset not found"})});const b=l==="*",x=Array.isArray(l)&&l.length===0;return g(m,{flexDirection:"column",children:[s(pe,{children:"Edit Toolset"}),s(m,{marginBottom:1,flexDirection:"column",children:s(d,{dimColor:!0,children:"n to edit name · space/enter to toggle · esc to go back"})}),g(m,{marginBottom:1,flexDirection:"column",children:[s(d,{bold:!0,children:"Name:"}),s(m,{marginLeft:2,children:s(m,{borderStyle:"round",borderColor:c?"yellow":"gray",children:s(d,{children:i})})}),c&&s(m,{marginLeft:2,children:s(d,{dimColor:!0,children:"enter to save · esc to cancel"})})]}),g(m,{marginBottom:1,flexDirection:"column",children:[s(d,{bold:!0,children:"Allowed Tools:"}),s(m,{marginLeft:2,children:g(d,{color:f===0?"cyan":void 0,children:[f===0?"❯ ":" ",b?"●":"○"," All"]})}),s(m,{marginLeft:2,children:g(d,{color:f===1?"cyan":void 0,children:[f===1?"❯ ":" ",x?"●":"○"," None"]})}),He.map((E,$)=>{const k=$+2;return s(m,{marginLeft:2,children:g(d,{color:f===k?"cyan":void 0,children:[f===k?"❯ ":" ",w(E)?"◉":"○"," ",E]})},E)})]}),s(m,{borderStyle:"round",padding:1,marginTop:1,children:g(m,{flexDirection:"column",children:[s(d,{bold:!0,children:"Summary:"}),g(d,{children:["Name: ",s(d,{color:"cyan",children:i})]}),g(d,{children:["Tools:"," ",l==="*"?s(d,{color:"green",children:"All tools (*)"}):l.length===0?s(d,{color:"red",children:"No tools ([])"}):g(d,{color:"yellow",children:[l.length," selected"]})]})]})})]})}function Rr({onBack:e}){const{settings:{toolsets:t,defaultToolset:n},updateSettings:o}=be(ue),[r,i]=A(0),[a,l]=A(null),[u,c]=A(!0),h=()=>{const p={name:"New Toolset",allowedTools:[]};o(b=>{b.toolsets.push(p)}),l(t.length),c(!1)},f=p=>{const b=t[p];o(x=>{x.toolsets.splice(p,1),x.defaultToolset===b.name&&(x.defaultToolset=null)}),r>=t.length-1&&i(Math.max(0,t.length-2))},y=p=>{const b=t[p];o(x=>{x.defaultToolset=b.name})};if(de((p,b)=>{b.escape?e():b.upArrow?i(x=>Math.max(0,x-1)):b.downArrow?i(x=>Math.min(t.length-1,x+1)):b.return&&t.length>0?(l(r),c(!1)):p==="n"?h():p==="d"&&t.length>0?f(r):p==="s"&&t.length>0&&y(r)},{isActive:u}),a!==null)return s(Dr,{toolsetIndex:a,onBack:()=>{l(null),c(!0)}});const w=p=>p.allowedTools==="*"?"All tools":p.allowedTools.length===0?"No tools":`${p.allowedTools.length} tool${p.allowedTools.length===1?"":"s"}`;return g(m,{flexDirection:"column",children:[s(pe,{children:"Toolsets"}),g(m,{marginBottom:1,flexDirection:"column",children:[s(d,{dimColor:!0,children:"n to create a new toolset"}),t.length>0&&s(d,{dimColor:!0,children:"s to set as default toolset"}),t.length>0&&s(d,{dimColor:!0,children:"d to delete a toolset"}),t.length>0&&s(d,{dimColor:!0,children:"enter to edit toolset"}),s(d,{dimColor:!0,children:"esc to go back"})]}),t.length===0?s(d,{children:"No toolsets created yet. Press n to create one."}):s(m,{flexDirection:"column",children:t.map((p,b)=>{const x=p.name===n,E=r===b;return g(d,{color:E?"yellow":void 0,bold:x,children:[E?"❯ ":" ",p.name,x&&" [DEFAULT]"," (",w(p),")"]},b)})})]})}const ue=ut({settings:ee,updateSettings:e=>{},changesApplied:!1,ccVersion:""});function Fr({startupCheckInfo:e}){const[t,n]=A({settings:ee,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null});xe(()=>{(async()=>{n(await an())})()},[]);const o=Nn(h=>{const f=JSON.parse(JSON.stringify(t.settings));h(f),n(y=>({...y,settings:f,changesApplied:!1})),je(y=>{y.settings=f,y.changesApplied=!1})},[t.settings]),[r,i]=A(null),[a,l]=A(null);xe(()=>{e.wasUpdated&&e.oldVersion&&(l({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
|
|
644
648
|
(However, your customization are still remembered in ${ae}.)
|
|
645
|
-
Please reapply your changes below.`,type:"warning"}),
|
|
646
|
-
Also checked for 'claude' executable on PATH using '${process.platform==="win32"?"where claude.exe":"which claude"}'.`),process.exit(1)}
|
|
647
|
-
✖ Error downloading system prompts:`)),console.log(
|
|
648
|
-
⚠ System prompts not available - skipping system prompt customizations`))),console.log("Applying customizations..."),await
|
|
649
|
-
✖ Error downloading system prompts:`)),console.log(
|
|
650
|
-
`))),ct(s(
|
|
649
|
+
Please reapply your changes below.`,type:"warning"}),o(()=>{}))},[]),de((h,f)=>{(f.ctrl&&h==="c"||(h==="q"||f.escape)&&!r)&&process.exit(0)},{isActive:!r});const u=h=>{switch(l(null),h){case Z.APPLY_CHANGES:e.ccInstInfo&&(l({message:"Applying patches...",type:"info"}),ot(t,e.ccInstInfo).then(f=>{n(f),l({message:"Customization patches applied successfully!",type:"success"})}));break;case Z.THEMES:case Z.THINKING_VERBS:case Z.THINKING_STYLE:case Z.USER_MESSAGE_DISPLAY:case Z.MISC:case Z.TOOLSETS:i(h);break;case Z.VIEW_SYSTEM_PROMPTS:Cr(Se);break;case Z.RESTORE_ORIGINAL:e.ccInstInfo&&(e.ccInstInfo.nativeInstallationPath?qn(e.ccInstInfo):Jn(e.ccInstInfo)).then(()=>{l({message:"Original Claude Code restored successfully!",type:"success"}),o(()=>{})});break;case Z.OPEN_CONFIG:kn(ae);break;case Z.OPEN_CLI:e.ccInstInfo?.cliPath&&kn(e.ccInstInfo.cliPath);break;case Z.EXIT:process.exit(0)}},c=()=>{i(null)};return s(ue.Provider,{value:{settings:t.settings,updateSettings:o,changesApplied:t.changesApplied,ccVersion:e.ccInstInfo?.version||""},children:s(m,{flexDirection:"column",children:r===null?s(yt,{onSubmit:u,notification:a,isNativeInstallation:!!e.ccInstInfo?.nativeInstallationPath}):r===Z.THEMES?s(Or,{onBack:c}):r===Z.THINKING_VERBS?s(Br,{onBack:c}):r===Z.THINKING_STYLE?s(Ar,{onBack:c}):r===Z.USER_MESSAGE_DISPLAY?s(Pr,{onBack:c}):r===Z.MISC?s(Lr,{onSubmit:c}):r===Z.TOOLSETS?s(Rr,{onBack:c}):null})})}const Mn=async e=>{try{await ie.mkdir(ce,{recursive:!0});try{await ie.stat(ae)}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT"){const n={ccInstallationDir:e};await ie.writeFile(ae,JSON.stringify(n,null,2))}}}catch{}},Vr=async()=>{const e=new dt;e.name("tweakcc").description("Command-line tool to customize your Claude Code theme colors, thinking verbs and more.").version("3.1.3").option("-d, --debug","enable debug mode").option("-a, --apply","apply saved customizations without interactive UI"),e.parse();const t=e.opts();if(t.debug&&$r(),t.apply){console.log("Applying saved customizations to Claude Code..."),console.log(`Configuration saved at: ${ae}`);const o=await an();(!o.settings||Object.keys(o.settings).length===0)&&(console.error("No saved customizations found in "+ae),process.exit(1));const r=await En();if(!r||!r.ccInstInfo){const a=process.platform=="win32"?"C:\\absolute\\path\\to\\node_modules\\@anthropic-ai\\claude-code":"/absolute/path/to/node_modules/@anthropic-ai/claude-code";await Mn(a),console.error("Cannot find Claude Code's cli.js"),console.error("Searched for cli.js at the following locations:"),en.forEach(l=>{l.isGlob?l.expandedPaths.length===0?console.error(` - ${l.pattern} (no matches)`):(console.error(` - ${l.pattern}`),l.expandedPaths.forEach(u=>{console.error(` - ${u}`)})):console.error(` - ${l.pattern}`)}),console.error(`
|
|
650
|
+
Also checked for 'claude' executable on PATH using '${process.platform==="win32"?"where claude.exe":"which claude"}'.`),process.exit(1)}r.ccInstInfo.nativeInstallationPath?console.log(`Found Claude Code (native installation): ${r.ccInstInfo.nativeInstallationPath}`):console.log(`Found Claude Code at: ${r.ccInstInfo.cliPath}`),console.log(`Version: ${r.ccInstInfo.version}`),console.log("Loading system prompts...");const i=await _n(r.ccInstInfo.version);i.success||(console.log(j.red(`
|
|
651
|
+
✖ Error downloading system prompts:`)),console.log(j.red(` ${i.errorMessage}`)),console.log(j.yellow(`
|
|
652
|
+
⚠ System prompts not available - skipping system prompt customizations`))),console.log("Applying customizations..."),await ot(o,r.ccInstInfo),console.log("Customizations applied successfully!"),process.exit(0)}const n=await En();if(n){const o=await _n(n.ccInstInfo.version);o.success||(console.log(j.red(`
|
|
653
|
+
✖ Error downloading system prompts:`)),console.log(j.red(` ${o.errorMessage}`)),console.log(j.yellow(`⚠ System prompts not available - system prompt customizations will be skipped
|
|
654
|
+
`))),ct(s(Fr,{startupCheckInfo:n}))}else{const o=()=>en.map(i=>{if(i.isGlob){if(i.expandedPaths.length===0)return`- ${i.pattern} (no matches)`;{const a=[`- ${i.pattern}`];return i.expandedPaths.forEach(l=>{a.push(` - ${l}`)}),a.join(`
|
|
651
655
|
`)}}else return`- ${i.pattern}`}).join(`
|
|
652
|
-
`),
|
|
656
|
+
`),r=process.platform=="win32"?"C:\\absolute\\path\\to\\node_modules\\@anthropic-ai\\claude-code":"/absolute/path/to/node_modules/@anthropic-ai/claude-code";await Mn(r),console.error(`Cannot find Claude Code's cli.js -- do you have Claude Code installed?
|
|
653
657
|
|
|
654
658
|
Searched for cli.js at the following locations:
|
|
655
|
-
${
|
|
659
|
+
${o()}
|
|
656
660
|
|
|
657
661
|
Also checked for 'claude' executable on PATH using '${process.platform==="win32"?"where claude.exe":"which claude"}'.
|
|
658
662
|
|
|
@@ -662,7 +666,7 @@ to our search list and release an update today! And in the meantime, you can ge
|
|
|
662
666
|
by manually specifying that location in ${ae} with the "ccInstallationDir" property:
|
|
663
667
|
|
|
664
668
|
{
|
|
665
|
-
"ccInstallationDir": "${
|
|
669
|
+
"ccInstallationDir": "${r}"
|
|
666
670
|
}
|
|
667
671
|
|
|
668
672
|
Notes:
|
|
@@ -670,4 +674,4 @@ Notes:
|
|
|
670
674
|
- Don't specify the path to your Claude Code executable's directory. It needs to be the path
|
|
671
675
|
to the folder that contains **cli.js**.
|
|
672
676
|
- Please also open an issue so that we can add your path to the search list for all users!
|
|
673
|
-
`),process.exit(1)}};
|
|
677
|
+
`),process.exit(1)}};Vr();
|