tweakcc 4.0.7 → 4.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -2
- package/dist/config-C5h_ncCn.mjs +669 -0
- package/dist/content-UKHa3BXT.mjs +29 -0
- package/dist/index.mjs +2 -2
- package/dist/lib/index.mjs +1 -1
- package/dist/nativeInstallation-N5ddObOc.mjs +4 -0
- package/package.json +1 -1
- package/dist/config-DgwUVWSR.mjs +0 -669
- package/dist/content-BXv52A0Y.mjs +0 -29
- package/dist/nativeInstallation-Bvj6S6Xh.mjs +0 -4
|
@@ -0,0 +1,669 @@
|
|
|
1
|
+
import e from"chalk";import t,{EOL as n}from"node:os";import*as r from"node:fs/promises";import i from"node:fs/promises";import*as a from"node:fs";import o from"node:fs";import*as s from"node:path";import c from"node:path";import*as l from"fs";import*as u from"path";import*as d from"os";import*as f from"child_process";import*as p from"crypto";import m from"gray-matter";import{diffWordsWithSpace as h}from"diff";let g=null;async function _(){if(g!==null)return g;try{return await import(`node-lief`),g=await import(`./nativeInstallation-N5ddObOc.mjs`),g}catch(e){return W(`Error loading native installation module: ${e instanceof Error?e.message:String(e)}`),e instanceof Error&&W(e),null}}async function v(e){let t=await _();return t?t.extractClaudeJsFromNativeInstallation(e):null}async function y(e,t,n){let r=await _();if(!r)throw Error("`repackNativeInstallation()` called but `node-lief` is not available. This is unexpected - `extractClaudeJsFromNativeInstallation()` should have been called first.");r.repackNativeInstallation(e,t,n)}async function b(e){let t=await _();return t?t.resolveNixBinaryWrapper(e):null}const x={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.Architecting.Baking.Beaming.Beboppin'.Befuddling.Billowing.Blanching.Bloviating.Boogieing.Boondoggling.Booping.Bootstrapping.Brewing.Burrowing.Calculating.Canoodling.Caramelizing.Cascading.Catapulting.Cerebrating.Channeling.Channelling.Choreographing.Churning.Clauding.Coalescing.Cogitating.Combobulating.Composing.Computing.Concocting.Considering.Contemplating.Cooking.Crafting.Creating.Crunching.Crystallizing.Cultivating.Deciphering.Deliberating.Determining.Dilly-dallying.Discombobulating.Doing.Doodling.Drizzling.Ebbing.Effecting.Elucidating.Embellishing.Enchanting.Envisioning.Evaporating.Fermenting.Fiddle-faddling.Finagling.Flambéing.Flibbertigibbeting.Flowing.Flummoxing.Fluttering.Forging.Forming.Frolicking.Frosting.Gallivanting.Galloping.Garnishing.Generating.Germinating.Gitifying.Grooving.Gusting.Harmonizing.Hashing.Hatching.Herding.Honking.Hullaballooing.Hyperspacing.Ideating.Imagining.Improvising.Incubating.Inferring.Infusing.Ionizing.Jitterbugging.Julienning.Kneading.Leavening.Levitating.Lollygagging.Manifesting.Marinating.Meandering.Metamorphosing.Misting.Moonwalking.Moseying.Mulling.Mustering.Musing.Nebulizing.Nesting.Newspapering.Noodling.Nucleating.Orbiting.Orchestrating.Osmosing.Perambulating.Percolating.Perusing.Philosophising.Photosynthesizing.Pollinating.Pondering.Pontificating.Pouncing.Precipitating.Prestidigitating.Processing.Proofing.Propagating.Puttering.Puzzling.Quantumizing.Razzle-dazzling.Razzmatazzing.Recombobulating.Reticulating.Roosting.Ruminating.Sautéing.Scampering.Schlepping.Scurrying.Seasoning.Shenaniganing.Shimmying.Simmering.Skedaddling.Sketching.Slithering.Smooshing.Sock-hopping.Spelunking.Spinning.Sprouting.Stewing.Sublimating.Swirling.Swooping.Symbioting.Synthesizing.Tempering.Thinking.Thundering.Tinkering.Tomfoolering.Topsy-turvying.Transfiguring.Transmuting.Twisting.Undulating.Unfurling.Unravelling.Vibing.Waddling.Wandering.Warping.Whatchamacalliting.Whirlpooling.Whirring.Whisking.Wibbling.Working.Wrangling.Zesting.Zigzagging`.split(`.`)},thinkingStyle:{updateInterval:120,phases:process.env.TERM===`xterm-ghostty`?[`·`,`✢`,`✳`,`✶`,`✻`,`*`]:process.platform===`darwin`?[`·`,`✢`,`✳`,`✶`,`✻`,`✽`]:[`·`,`✢`,`*`,`✶`,`✻`,`✽`],reverseMirror:!0},userMessageDisplay:{format:` > {} `,styling:[],foregroundColor:`default`,backgroundColor:null,borderStyle:`none`,borderColor:`rgb(255,255,255)`,paddingX:0,paddingY:0,fitBoxToContent:!1},inputBox:{removeBorder:!1},misc:{showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0,enableConversationTitle:!0,hideStartupBanner:!1,hideCtrlGToEdit:!1,hideStartupClawd:!1,increaseFileReadLimit:!1,suppressLineNumbers:!1,suppressRateLimitOptions:!1,mcpConnectionNonBlocking:!0,mcpServerBatchSize:null,statuslineThrottleMs:null,statuslineUseFixedInterval:!1,tableFormat:`default`,enableSwarmMode:!0,enableSessionMemory:!0,enableRememberSkill:!1,tokenCountRounding:null,autoAcceptPlanMode:!1,allowBypassPermissionsInSudo:!1,suppressNativeInstallerWarning:!1,filterScrollEscapeSequences:!1,enableWorktreeMode:!0},toolsets:[],defaultToolset:null,planModeToolset:null,subagentModels:{plan:null,explore:null,generalPurpose:null},inputPatternHighlighters:[],inputPatternHighlightersTestText:`Type test text here to see highlighting`,claudeMdAltNames:[`AGENTS.md`,`GEMINI.md`,`CRUSH.md`,`QWEN.md`,`IFLOW.md`,`WARP.md`,`copilot-instructions.md`]},S={name:`Unnamed Highlighter`,regex:``,regexFlags:`g`,format:`{MATCH}`,styling:[],foregroundColor:null,backgroundColor:null,enabled:!0},C={name:`Unnamed Toolset`,allowedTools:`*`},w=x.themes[0],ee=e=>{let t=[],n=/visibleOptionCount:[\w$]+=(\d+)/g,r;for(;(r=n.exec(e))!==null;){let e=r.index+r[0].indexOf(`=`)+1;t.push({startIndex:e,endIndex:e+r[1].length})}return t},te=(e,t)=>{let n=ee(e);if(n.length===0)return console.error(`patch: writeShowMoreItemsInSelectMenus: failed to find locations`),null;let r=n.sort((e,t)=>t.startIndex-e.startIndex),i=e;for(let e of r){let n=t.toString(),r=i.slice(0,e.startIndex)+n+i.slice(e.endIndex);F(i,r,n,e.startIndex,e.endIndex),i=r}return i};function ne(e){let t=e.match(/switch\s*\(([^)]+)\)\s*\{[^}]*case\s*["']light["'][^}]+\}/s);if(!t||t.index==null)return console.error(`patch: themes: failed to find switchMatch`),null;let n=/\[(?:\{label:"(?:Dark|Light).+?",value:".+?"\},?)+\]/,r=/return\{(?:[$\w]+?:"(?:Dark|Light).+?",?)+\}/,i=e.match(n),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:t.index,endIndex:t.index+t[0].length,identifiers:[t[1].trim()]},objArr:{startIndex:i.index,endIndex:i.index+i[0].length},obj:{startIndex:a.index,endIndex:a.index+a[0].length}}}const re=(e,t)=>{let n=ne(e);if(!n)return null;if(t.length===0)return e;let r=e,i=`return`+JSON.stringify(Object.fromEntries(t.map(e=>[e.id,e.name])));r=r.slice(0,n.obj.startIndex)+i+r.slice(n.obj.endIndex),F(e,r,i,n.obj.startIndex,n.obj.endIndex),e=r;let a=JSON.stringify(t.map(e=>({label:e.name,value:e.id})));r=r.slice(0,n.objArr.startIndex)+a+r.slice(n.objArr.endIndex),F(e,r,a,n.objArr.startIndex,n.objArr.endIndex),e=r;let o=`switch(${n.switchStatement.identifiers?.[0]}){\n`;return t.forEach(e=>{o+=`case"${e.id}":return${JSON.stringify(e.colors)};\n`}),o+=`default:return${JSON.stringify(t[0].colors)};\n}`,r=r.slice(0,n.switchStatement.startIndex)+o+r.slice(n.switchStatement.endIndex),F(e,r,o,n.switchStatement.startIndex,n.switchStatement.endIndex),r},ie=e=>I(e,/\b200000\b/,`process.env.CLAUDE_CODE_CONTEXT_LIMIT`),ae=e=>{let t=e.indexOf(`bash:"bashBorder"`);if(t===-1)return console.error(`patch: input border: failed to find bash pattern`),null;let n=e.slice(t,t+500).match(/borderStyle:"[^"]*"/);return!n||n.index===void 0?(console.error(`patch: input border: failed to find border style pattern`),null):{startIndex:t+n.index,endIndex:t+n.index+n[0].length}},oe=(e,t)=>{let n=ae(e);if(!n)return null;if(t){let t=`borderColor:undefined`,r=e.slice(0,n.startIndex)+t+e.slice(n.endIndex);return F(e,r,t,n.startIndex,n.endIndex),r}else return e},T=e=>{let t=e.match(/spinnerTip:[$\w]+,(?:[$\w]+:[$\w]+,)*overrideMessage:[$\w]+,.{300}/);if(!t||t.index==null)return console.error(`patch: thinker format: failed to find approxAreaMatch`),null;let n=e.slice(t.index,t.index+1e4),r=n.match(/,([$\w]+)(=\(([^;]{1,200}?)\)\+"(?:…|\\u2026)")/);if(r&&r.index!=null)return{startIndex:t.index+r.index+r[1].length+1,endIndex:t.index+r.index+r[1].length+r[2].length+1,identifiers:[r[3]]};let i=n.match(/,([$\w]+)(=(\([$\w]+&&![$\w]+\.isIdle\?[$\w]+\.spinnerVerb\?\?[$\w]+:[$\w]+\))\+"(?:…|\\u2026)")/);return i&&i.index!=null?{startIndex:t.index+i.index+i[1].length+1,endIndex:t.index+i.index+i[1].length+i[2].length+1,identifiers:[i[3]]}:(console.error(`patch: thinker format: failed to find formatMatch`),null)},E=(e,t)=>{let n=T(e);if(!n)return null;let r=n,i=t.replace(/\\/g,`\\\\`).replace(/`/g,"\\`"),a=r.identifiers?.[0],o=`=${"`"+i.replace(/\{\}/g,"${"+a+`}`)+"`"}`,s=e.slice(0,r.startIndex)+o+e.slice(r.endIndex);return F(e,s,o,r.startIndex,r.endIndex),s},se=e=>{let t=e.match(/=\s*\[\.\.\.([$\w]+),\s*\.\.\.?\[\.\.\.\1\]\.reverse\(\)\]/);return!t||t.index==null?(console.error(`patch: thinker symbol mirror option: failed to find match`),null):{startIndex:t.index,endIndex:t.index+t[0].length,identifiers:[t[1]]}},ce=(e,t)=>{let n=se(e);if(!n)return null;let r=n.identifiers?.[0],i=t?`=[...${r},...[...${r}].reverse()]`:`=[...${r}]`,a=e.slice(0,n.startIndex)+i+e.slice(n.endIndex);return F(e,a,i,n.startIndex,n.endIndex),a},le=(e,t)=>{let n=[],r=/\["(?:[·✢*✳✶✻✽]|\\u00b7|\\xb7|\\u2722|\\x2a|\\u002a|\\u2733|\\u2736|\\u273b|\\u273d)",\s*(?:"(?:[·✢*✳✶✻✽]|\\u00b7|\\xb7|\\u2722|\\x2a|\\u002a|\\u2733|\\u2736|\\u273b|\\u273d)",?\s*)+\]/gi,i;for(;(i=r.exec(e))!==null;)n.push({startIndex:i.index,endIndex:i.index+i[0].length});if(n.length===0)return console.error(`patch: thinkerSymbolChars: could not find any thinker symbol char arrays`),null;let a=JSON.stringify(t),o=n.sort((e,t)=>t.startIndex-e.startIndex),s=e;for(let e=0;e<o.length;e++){let t=s.slice(0,o[e].startIndex)+a+s.slice(o[e].endIndex);F(s,t,a,o[e].startIndex,o[e].endIndex),s=t}return s},ue=(e,t)=>{let n=e.match(/(if\(![$\w]+\)\{[$\w]+\(4\);return\})(.{0,200})120\)/);if(!n||n.index===void 0)return console.error(`patch: thinkerSymbolSpeed: failed to find thinker symbol speed pattern`),null;let r=n[2]+t+`)`,i=n.index,a=i+n[0].length,o=e.slice(0,i)+r+e.slice(a);return F(e,o,r,i,a),o},de=e=>{let t=e.match(/\{flexWrap:"wrap",height:1,width:2\}/);return!t||t.index==null?(console.error(`patch: thinker symbol width: failed to find match`),null):{startIndex:t.index,endIndex:t.index+t[0].length}},fe=(e,t)=>{let n=de(e);if(!n)return null;let r=`{flexWrap:"wrap",height:1,width:${t}}`,i=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return F(e,i,r,n.startIndex,n.endIndex),i},pe=(e,t)=>{let n=e.match(/\[("[A-Z][a-z'é\-\\xA-F0-9]+in[g']",?){50,}\]/);if(!n||n.index===void 0)return console.error(`patch: thinkingVerbs: failed to find present tense verbs pattern`),null;let r=JSON.stringify(t),i=n.index,a=i+n[0].length,o=e.slice(0,i)+r+e.slice(a);return F(e,o,r,i,a),o},me=(e,t)=>{let n=e.match(/\[("[A-Z][a-z'é\-\\xA-F0-9]+ed",?){5,}\]/);if(!n||n.index===void 0)return console.error(`patch: thinkingVerbs: failed to find past tense verbs pattern`),null;let r=t.map(e=>e.replace(/ing$/,`ed`)),i=JSON.stringify(r),a=n.index,o=a+n[0].length,s=e.slice(0,a)+i+e.slice(o);return F(e,s,i,a,o),s},he=(e,t)=>{let n=pe(e,t);if(n===null)return null;let r=me(n,t);return r===null?null:r},ge=(e,t)=>{let n=V(e);if(!n)return console.error(`patch: userMessageDisplay: failed to find Text component`),null;let r=or(e);if(!r)return console.error(`patch: userMessageDisplay: failed to find Box component`),null;let i=L(e);if(!i)return console.error(`patch: userMessageDisplay: failed to find chalk variable`),null;let a=e.match(/(No content found in user prompt message.{0,150}?\b)([$\w]+(?:\.default)?\.createElement.{0,30}\b[$\w]+(?:\.default)?\.createElement.{0,40}">.+?)?(([$\w]+(?:\.default)?\.createElement).{0,100})(\([$\w]+,(?:\{[^{}]+wrap:"wrap"\},([$\w]+)(?:\.trim\(\))?\)\)|\{text:([$\w]+)(?:,thinkingMetadata:[$\w]+)?\}\)\)?))/);if(!a||a.index===void 0)return console.error(`patch: userMessageDisplay: failed to find user message display pattern`),null;let o=a[4],s=a[6]??a[7],c=[],l=t.borderStyle.startsWith(`topBottom`);if(t.borderStyle!==`none`){if(l){let e=``;t.borderStyle===`topBottomSingle`?e=`{top:"─",bottom:"─",left:" ",right:" ",topLeft:" ",topRight:" ",bottomLeft:" ",bottomRight:" "}`:t.borderStyle===`topBottomDouble`?e=`{top:"═",bottom:"═",left:" ",right:" ",topLeft:" ",topRight:" ",bottomLeft:" ",bottomRight:" "}`:t.borderStyle===`topBottomBold`&&(e=`{top:"━",bottom:"━",left:" ",right:" ",topLeft:" ",topRight:" ",bottomLeft:" ",bottomRight:" "}`),c.push(`borderStyle:${e}`)}else c.push(`borderStyle:"${t.borderStyle}"`);let e=t.borderColor.match(/\d+/g);e&&c.push(`borderColor:"rgb(${e.join(`,`)})"`)}t.paddingX>0&&c.push(`paddingX:${t.paddingX}`),t.paddingY>0&&c.push(`paddingY:${t.paddingY}`),t.fitBoxToContent&&c.push(`alignSelf:"flex-start"`);let u=c.length>0?`{${c.join(`,`)}}`:`null`,d=i;if(t.foregroundColor!==`default`){let e=t.foregroundColor.match(/\d+/g);e&&(d+=`.rgb(${e.join(`,`)})`)}if(t.backgroundColor!==`default`&&t.backgroundColor!==null){let e=t.backgroundColor.match(/\d+/g);e&&(d+=`.bgRgb(${e.join(`,`)})`)}t.styling.includes(`bold`)&&(d+=`.bold`),t.styling.includes(`italic`)&&(d+=`.italic`),t.styling.includes(`underline`)&&(d+=`.underline`),t.styling.includes(`strikethrough`)&&(d+=`.strikethrough`),t.styling.includes(`inverse`)&&(d+=`.inverse`);let f="`"+t.format.replace(/\{\}/g,"${"+s+`}`)+"`",p=`${d}(${f})`,m=a[1]+`${o}(${r},${u},${o}(${n},null,${p}))`,h=a.index,g=h+a[0].length,_=e.slice(0,h)+m+e.slice(g);return F(e,_,m,h,g),_},_e=(e,t)=>{let n=e;if(t.foregroundColor){let e=t.foregroundColor.match(/\d+/g);e&&(n+=`.rgb(${e.join(`,`)})`)}if(t.backgroundColor){let e=t.backgroundColor.match(/\d+/g);e&&(n+=`.bgRgb(${e.join(`,`)})`)}return t.styling.includes(`bold`)&&(n+=`.bold`),t.styling.includes(`italic`)&&(n+=`.italic`),t.styling.includes(`underline`)&&(n+=`.underline`),t.styling.includes(`strikethrough`)&&(n+=`.strikethrough`),t.styling.includes(`inverse`)&&(n+=`.inverse`),n},ve=e=>{let t=e.match(/(if\(([$\w]+)\.highlight\?\.color\))((return [$\w]+\.createElement\([$\w]+,\{key:[$\w]+),color:[$\w]+\.highlight\.color(\},[$\w]+\.createElement\([$\w]+,null,)([$\w]+\.text)(\)\)));/);if(!t||t.index===void 0)return console.error(`patch: inputPatternHighlighters: failed to find highlight?.color renderer pattern`),null;let n=`${t[2]}.highlight.color(${t[6]})`,r=t[1]+`{if(typeof ${t[2]}.highlight.color==='function')`+t[4]+t[5]+n+t[7]+`;else `+t[3]+`}`,i=e.slice(0,t.index)+r+e.slice(t.index+t[0].length);return F(e,i,r,t.index,t.index+t[0].length),i},ye=(e,t,n)=>{let r=e.match(/(,[$\w]+=[$\w]+\.useMemo\(\(\)=>\{let [$\w]+=\[\];)(if\([$\w]+&&[$\w]+&&![$\w]+\)([$\w]+)\.push\(\{start:[$\w]+,end:[$\w]+\+[$\w]+\.length,color:"warning",priority:\d+\})/);if(!r||r.index===void 0)return console.error(`patch: inputPatternHighlighters: failed to find useMemo/push pattern`),null;let i=r[3],a=r[1].match(/[^$\w]([$\w]+(?:\.default)?)\.useMemo\(/);if(!a)return console.error(`patch: inputPatternHighlighters: failed to extract React var from useMemo`),null;let o=a[1],s=Math.max(0,r.index-4e3),c=e.slice(s,r.index).match(/\binput:([$\w]+),/);if(!c)return console.error(`patch: inputPatternHighlighters: failed to find input variable pattern`),null;let l=c[1],u=``;for(let e=0;e<n.length;e++){let t=n[e],r=t.regexFlags;r.includes(`g`)||(r+=`g`);let i=Ir(new RegExp(t.regex,r));u+=`,matchedTweakccReplacements${e}=${o}.useMemo(()=>{return[...${l}.matchAll(${i})].map(m=>({start:m.index,end:m.index+m[0].length}))},[${l}])`}let d=``;for(let e=0;e<n.length;e++){let r=n[e],a=_e(t,r),o=JSON.stringify(r.format).replace(/\{MATCH\}/g,`"+x+"`);d+=`for(let matchedTweakccReplacement of matchedTweakccReplacements${e}){${i}.push({start:matchedTweakccReplacement.start,end:matchedTweakccReplacement.end,color:x=>${a}(${o}),priority:100})}`}let f=r[1]+d+r[2],p=e.slice(0,r.index),m=e.slice(r.index+r[0].length),h=p+u+f+m;return F(e,h,u+f,r.index,r.index+r[0].length),h},be=(e,t)=>{let n=t.filter(e=>e.enabled);if(n.length===0)return null;let r=L(e);if(!r)return console.error(`^ patch: inputPatternHighlighters: failed to find chalk variable`),null;let i;return i=ve(e),i?(i=ye(i,r,n),i||(console.error(`^ patch: inputPatternHighlighters: writeCustomHighlighterCreation failed`),null)):(console.error(`^ patch: inputPatternHighlighters: writeCustomHighlighterImpl failed`),null)},xe=e=>{let t=e.match(/createElement\([$\w]+,\{[^}]+spinnerTip[^}]+overrideMessage[^}]+\}/);if(!t||t.index===void 0)return console.error(`patch: verbose: failed to find createElement with spinnerTip and overrideMessage`),null;let n=t[0].match(/verbose:[^,}]+/);if(!n||n.index===void 0)return console.error(`patch: verbose: failed to find verbose property`),null;let r=t.index+n.index;return{startIndex:r,endIndex:r+n[0].length}},Se=e=>{let t=xe(e);if(!t)return null;let n=`verbose:true`,r=e.slice(0,t.startIndex)+n+e.slice(t.endIndex);return F(e,r,n,t.startIndex,t.endIndex),r},Ce=e=>{let t=e.match(/if\s*\(\s*([$\w]+)\(\)\s*===\s*"opusplan"\s*&&\s*([$\w]+)\s*===\s*"plan"\s*&&\s*!([$\w]+)\s*\)\s*return\s*([$\w]+)\(\);/);if(!t||t.index===void 0)return console.error(`patch: opusplan1m: patchModeSwitchingFunction: failed to find mode switching pattern`),null;let[n,r,i,a,o]=t,s=`if((${r}()==="opusplan"||${r}()==="opusplan[1m]")&&${i}==="plan"&&!${a})return ${o}();`,c=e.slice(0,t.index)+s+e.slice(t.index+n.length);return F(e,c,s,t.index,t.index+n.length),c},we=e=>{let t=e.match(/(\["sonnet","opus","haiku",(?:"best",)?"sonnet\[1m\]",(?:"opus\[1m\]",)?"opusplan")/);if(!t||t.index===void 0)return console.error(`patch: opusplan1m: patchModelAliasesList: failed to find model aliases list`),null;let n=t[0]+`,"opusplan[1m]"`,r=e.slice(0,t.index)+n+e.slice(t.index+t[0].length);return F(e,r,n,t.index,t.index+t[0].length),r},Te=e=>{let t=e.match(/(if\s*\(\s*([$\w]+)\s*===\s*"opusplan"\s*\)\s*return\s*"Opus .{0,20} in plan mode, else Sonnet .{0,20}";)/);if(!t||t.index===void 0)return console.error(`patch: opusplan1m: patchDescriptionFunction: failed to find description pattern`),null;let[n,,r]=t,i=n+`if(${r}==="opusplan[1m]")return"Opus 4.5 in plan mode, else Sonnet 4.5 (1M context)";`,a=e.slice(0,t.index)+i+e.slice(t.index+n.length);return F(e,a,i,t.index,t.index+n.length),a},Ee=e=>{let t=e.match(/(if\s*\(\s*([$\w]+)\s*===\s*"opusplan"\s*\)\s*return\s*"Opus Plan";)/);if(!t||t.index===void 0)return console.error(`patch: opusplan1m: patchLabelFunction: failed to find label pattern`),null;let[n,,r]=t,i=n+`if(${r}==="opusplan[1m]")return"Opus Plan 1M";`,a=e.slice(0,t.index)+i+e.slice(t.index+n.length);return F(e,a,i,t.index,t.index+n.length),a},De=e=>{let t=e.match(/(if\s*\(\s*([$\w]+)\s*===\s*"opusplan"\s*\)\s*return\s*(?:[$\w]+\()?\[\s*\.\.\.([$\w]+)\s*,\s*([$\w]+)\(\)\s*\]\)?;)/);if(!t||t.index===void 0)return console.error(`patch: opusplan1m: patchModelSelectorOptions: failed to find model selector pattern`),null;let[n,,r,i]=t,a=n+`if(${r}==="opusplan[1m]")return[...${i},{value:"opusplan[1m]",label:"Opus Plan Mode 1M",description:"Use Opus 4.5 in plan mode, Sonnet 4.5 (1M context) otherwise"}];`,o=e.slice(0,t.index)+a+e.slice(t.index+n.length);return F(e,o,a,t.index,t.index+n.length),o},Oe=e=>{let t=e.match(/(if\s*\(\s*[$\w]+\s*===\s*null\s*\|\|\s*([$\w]+)\.some\s*\(\s*\(\s*[$\w]+\s*\)\s*=>\s*[$\w]+\.value\s*===\s*[$\w]+\s*\)\s*\)\s*return\s*(?:[$\w]+\()?[$\w]+\)?\s*;)/);if(!t||t.index===void 0)return console.error(`patch: opusplan1m: patchAlwaysShowInModelSelector: failed to find model list check pattern`),null;let[,,n]=t,r=`${n}.push({value:"opusplan",label:"Opus Plan Mode",description:"Use Opus 4.5 in plan mode, Sonnet 4.5 otherwise"});${n}.push({value:"opusplan[1m]",label:"Opus Plan Mode 1M",description:"Use Opus 4.5 in plan mode, Sonnet 4.5 (1M context) otherwise"});`,i=e.slice(0,t.index)+r+e.slice(t.index);return F(e,i,r,t.index,t.index),i},ke=e=>{let t=e,n=Ce(t);if(n)t=n;else return console.error(`patch: opusplan1m: failed to apply mode switching patch`),null;if(n=we(t),n)t=n;else return console.error(`patch: opusplan1m: failed to apply model aliases list patch`),null;if(n=Te(t),n)t=n;else return console.error(`patch: opusplan1m: failed to apply description function patch`),null;if(n=Ee(t),n)t=n;else return console.error(`patch: opusplan1m: failed to apply label function patch`),null;if(n=De(t),n)t=n;else return console.error(`patch: opusplan1m: failed to apply model selector options patch`),null;if(n=Oe(t),n)t=n;else return console.error(`patch: opusplan1m: failed to apply always-show-in-selector patch`),null;return t},Ae=e=>{let t=e.match(/(case"thinking":\{?)(if\(.+?\)return null;)(.{0,400}isTranscriptMode:).+?,/);if(!t||t.index===void 0)return console.error(`patch: thinkingVisibility: failed to find thinking visibility pattern`),null;let n=t[1]+t[3]+`true,`,r=t.index,i=r+t[0].length,a=e.slice(0,r)+n+e.slice(i);return F(e,a,n,r,i),a},je=(e,t)=>{let n=e.match(/(agentType\s*:\s*"Plan"\s*,[\s\S]{1,2500}?\bmodel\s*:\s*")[^"]+(")/);if(!n||n.index===void 0)return console.error(`patch: subagentModels: failed to find Plan agent pattern`),null;let r=n[1]+t+n[2],i=n.index,a=i+n[0].length,o=e.slice(0,i)+r+e.slice(a);return F(e,o,r,i,a),o},Me=(e,t)=>{let n=e.match(/(\{agentType\s*:\s*"Explore"\s*,[\s\S]{1,2500}?\bmodel\s*:\s*")[^"]+(")/);if(!n||n.index===void 0)return console.error(`patch: subagentModels: failed to find Explore agent pattern`),null;let r=n[1]+t+n[2],i=n.index,a=i+n[0].length,o=e.slice(0,i)+r+e.slice(a);return F(e,o,r,i,a),o},Ne=(e,t)=>{let n=e.match(/([^$\w][$\w]+\s*=\s*\{agentType\s*:\s*"general-purpose"[\s\S]{0,2500}?)(\})/);if(!n||n.index===void 0)return console.error(`patch: subagentModels: failed to find general-purpose agent pattern`),null;let r=n[1],i=n[2],a;a=r.includes(`model:`)?r.replace(/(model\s*:\s*")[^"]+(")/,`$1${t}$2`)+i:r+`${r.trim().endsWith(`,`)?``:`,`}model:"${t}"`+i;let o=n.index,s=o+n[0].length,c=e.slice(0,o)+a+e.slice(s);return F(e,c,a,o,s),c},Pe=(e,t)=>{let n=e;if(t.plan){let e=je(n,t.plan);if(e===null)return null;n=e}if(t.explore){let e=Me(n,t.explore);if(e===null)return null;n=e}if(t.generalPurpose){let e=Ne(n,t.generalPurpose);if(e===null)return null;n=e}return n},Fe=e=>{let t=e.indexOf(`}.VERSION} (Claude Code)`);return t==-1?(console.error(`patch: patchesAppliedIndication: failed to find versionIndex`),null):{startIndex:0,endIndex:t+24}},Ie=e=>{let t=e.match(/[^$\w]([$\w]+)\.createElement\(([$\w]+),\{bold:!0\},"Claude Code"\)," ",([$\w]+)\.createElement\(([$\w]+),\{dimColor:!0\},"v",[$\w]+\)/);if(!t||t.index===void 0)return console.error(`patch: patchesAppliedIndication: failed to find Claude Code version pattern`),null;let n=t.index+t[0].length;return{startIndex:n,endIndex:n}},Le=(e,t,n,r,i,a)=>{let o=e.match(/alignItems:"center",minHeight:([$\w]+\?\d+:\d+|\d+),?/);if(!o||o.index===void 0)return console.error(`patch: patchesAppliedIndication: failed to find alignItems pattern for PATCH 4`),null;let s=o[1],c=e.slice(0,o.index)+`minHeight:${s},`+e.slice(o.index+o[0].length),l=Math.max(0,o.index-200),u=c.slice(l,o.index+12+2),d=Array.from(u.matchAll(/[^$\w]([$\w]+)\.createElement\(([$\w]+),(?:\w+|\{[^}]+\}),/g));if(d.length===0)return console.error(`patch: patchesAppliedIndication: failed to find createElement for PATCH 4`),null;let f=d[d.length-1],p=l+f.index+f[0].length,m=`${n}.createElement(${i}, null, ${a}.blue.bold(" + tweakcc v${t}")),${n}.createElement(${r},{alignItems:"center",flexDirection:"column"},`,h=c;c=c.slice(0,p)+m+c.slice(p),F(h,c,m,p,p);let g=1,_=p+m.length,v=-1;for(;_<c.length;){let e=c[_];if(e===`(`)g++;else if(e===`)`){if(g===1){v=_;break}g--}_++}if(v===-1)return console.error(`patch: patchesAppliedIndication: failed to find closing paren for PATCH 4`),null;let y=c;return c=c.slice(0,v)+`),`+c.slice(v),F(y,c,`),`,v,v),{content:c,closingParenIndex:v+2}},Re=(e,t,n,r,i,a,o)=>{let s=4,c=t,l=-1;for(;c<e.length;){let t=e[c];if(t===`(`)s++;else if(t===`)`){if(s===1){l=c;break}s--}c++}if(l===-1)return console.error(`patch: patchesAppliedIndication: failed to find insertion point for PATCH 5`),null;let u=[];u.push(`,${n}.createElement(${r}, { flexDirection: "column" },`),u.push(`${n}.createElement(${r}, null, ${n}.createElement(${i}, {color: "success", bold: true}, "┃ "), ${n}.createElement(${i}, {color: "success", bold: true}, "✓ tweakcc patches are applied")),`);for(let e of o)e=e.replace(`CHALK_VAR`,a),u.push(`${n}.createElement(${r}, null, ${n}.createElement(${i}, {color: "success", bold: true}, "┃ "), ${n}.createElement(${i}, {dimColor: true}, \` * ${e}\`)),`);u.push(`),`);let d=u.join(``),f=e,p=e.slice(0,l)+d+e.slice(l);return F(f,p,d,l,l),p},ze=e=>{let t=e.match(/[^$\w]([$\w]+)\.createElement\(([$\w]+),\{bold:!0\},"Claude Code"\)," ",([$\w]+)\.createElement\(([$\w]+),\{dimColor:!0\},"v",[$\w]+\)/);if(!t||t.index===void 0)return console.error(`patch: patchesAppliedIndication: failed to find Claude Code version pattern for patch 3`),null;let n=Math.max(0,t.index-1500),r=e.slice(n,t.index),i=Array.from(r.matchAll(/\}function ([$\w]+)\(/g));if(i.length===0)return console.error(`patch: patchesAppliedIndication: failed to find header component function`),null;let a=i[i.length-1][1],o=RegExp(`[^$\\w]([$\\w]+)\\.createElement\\(${U(a)},null\\),?`),s=e.match(o);if(!s||s.index===void 0)return console.error(`patch: patchesAppliedIndication: failed to find createElement call for header`),null;let c=s.index+s[0].length;return{startIndex:c,endIndex:c}},Be=(e,t,n,r=!0,i=!0)=>{let a=Fe(e);if(!a)return console.error(`patch: patchesAppliedIndication: failed to version output location`),null;let o=`\\n${t} (tweakcc)`,s=e.slice(0,a.endIndex)+o+e.slice(a.endIndex);F(e,s,o,a.endIndex,a.endIndex);let c=L(e);if(!c)return console.error(`patch: patchesAppliedIndication: failed to find chalk variable`),null;let l=V(e);if(!l)return console.error(`patch: patchesAppliedIndication: failed to find text component`),null;let u=B(e);if(!u)return console.error(`patch: patchesAppliedIndication: failed to find React variable`),null;let d=or(e);if(!d)return console.error(`patch: patchesAppliedIndication: failed to find Box component`),null;if(r){let e=Ie(s);if(!e)return console.error(`patch: patchesAppliedIndication: patch 2 failed`),null;let n=`, " ",${u}.createElement(${l}, null, ${c}.blue.bold('+ tweakcc v${t}'))`,r=s;s=s.slice(0,e.startIndex)+n+s.slice(e.endIndex),F(r,s,n,e.startIndex,e.endIndex)}if(i){let e=ze(s);if(!e)return console.error(`patch: patchesAppliedIndication: patch 3 failed`),null;let t=[];t.push(`${u}.createElement(${d}, { flexDirection: "column" },`),t.push(`${u}.createElement(${d}, null, ${u}.createElement(${l}, {color: "success", bold: true}, "┃ "), ${u}.createElement(${l}, {color: "success", bold: true}, "✓ tweakcc patches are applied")),`);for(let e of n)e=e.replace(`CHALK_VAR`,c),t.push(`${u}.createElement(${d}, null, ${u}.createElement(${l}, {color: "success", bold: true}, "┃ "), ${u}.createElement(${l}, {dimColor: true}, \` * ${e}\`)),`);t.push(`),`);let r=t.join(`
|
|
2
|
+
`),i=s;s=s.slice(0,e.startIndex)+r+s.slice(e.endIndex),F(i,s,r,e.startIndex,e.endIndex)}let f=-1;if(r){let e=Le(s,t,u,d,l,c);if(!e)return console.error(`patch: patchesAppliedIndication: patch 4 failed`),null;s=e.content,f=e.closingParenIndex}if(i){if(f===-1){let e=s.match(/alignItems:"center",minHeight:([$\w]+\?\d+:\d+|\d+),?/);if(!e||e.index===void 0)return console.error(`patch: patchesAppliedIndication: failed to find reference point for PATCH 5`),null;f=e.index+e[0].length}let e=Re(s,f,u,d,l,c,n);if(!e)return console.error(`patch: patchesAppliedIndication: patch 5 failed`),null;s=e}return s};async function Ve(e){let t=u.join(Hr,`prompts-${e}.json`);try{let e=await r.readFile(t,`utf-8`);return JSON.parse(e)}catch{}let n=`https://raw.githubusercontent.com/Piebald-AI/tweakcc/refs/heads/main/data/prompts/prompts-${e}.json`;try{let i=await fetch(n);if(!i.ok){let t;throw t=i.status===429?`Rate limit exceeded. GitHub has temporarily blocked requests. Please wait a few minutes and try again.`:i.status===404?`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.`:i.status>=500?`GitHub server error (${i.status}). Please try again later.`:`HTTP ${i.status}: ${i.statusText}`,Error(t)}let a=await i.json();try{await r.mkdir(Hr,{recursive:!0}),await r.writeFile(t,JSON.stringify(a,null,2),`utf-8`)}catch(e){console.warn(`Failed to write to cache to ${t}: ${e}`)}return a}catch(t){if(t instanceof Error){if(t.message.includes(`Rate limit`)||t.message.includes(`not found`)||t.message.includes(`server error`)||t.message.includes(`HTTP`))throw t;let n=`Failed to download prompts for version ${e}: ${t.message}`;throw Error(n)}throw t}}const He=()=>u.join(q,`systemPromptOriginalHashes.json`),Ue=()=>u.join(q,`systemPromptAppliedHashes.json`),We=(e,t)=>`${e}-${t}`,Ge=e=>p.createHash(`md5`).update(e.trim(),`utf8`).digest(`hex`),Ke=async()=>{try{let e=await r.readFile(He(),`utf8`);return JSON.parse(e)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return{};throw e}},qe=async e=>{await r.mkdir(q,{recursive:!0});let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];await r.writeFile(He(),JSON.stringify(t,null,2),`utf8`)},Je=async e=>{let t=await Ke(),n=0;for(let r of e.prompts){let e=We(r.id,r.version);t[e]||(t[e]=Ge(D(r.pieces,r.identifiers,r.identifierMap)),n++)}return await qe(t),n},Ye=async(e,t)=>(await Ke())[We(e,t)],Xe=async()=>{try{let e=await r.readFile(Ue(),`utf8`);return JSON.parse(e)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return{};throw e}},Ze=async e=>{await r.mkdir(q,{recursive:!0});let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];await r.writeFile(Ue(),JSON.stringify(t,null,2),`utf8`)},Qe=async(e,t)=>{let n=await Xe();n[e]=t,await Ze(n)},$e=async()=>{let e=await Xe(),t={};for(let n of Object.keys(e))t[n]=null;await Ze(t)},et=async e=>{try{let t=await Xe();if(Object.keys(t).length===0)return!1;let n=(await r.readdir(e)).filter(e=>e.endsWith(`.md`));for(let i of n){let n=t[i.replace(`.md`,``)];if(n==null)continue;let a=u.join(e,i),o=await r.readFile(a,`utf8`);if(Ge((await import(`gray-matter`)).default(o,{delimiters:[`<!--`,`-->`]}).content)!==n)return!0}return!1}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return!1;throw e}},tt=e=>{let t=m(e,{delimiters:[`<!--`,`-->`]}),{name:n,description:r,ccVersion:i,variables:a}=t.data,o=0,s=e.indexOf(t.content);return s>=0&&(o=e.slice(0,s).split(`
|
|
3
|
+
`).length-1),{name:n||``,description:r||``,ccVersion:i||``,variables:a||[],content:t.content,contentLineOffset:o}},nt=(e,t)=>{let n=t||D(e.pieces,e.identifiers,e.identifierMap),r=Object.keys(e.identifierMap).length>0?[...new Set(Object.values(e.identifierMap))]:void 0,i={name:e.name,description:e.description,ccVersion:e.version};return r&&r.length>0&&(i.variables=r),m.stringify(n,i,{delimiters:[`<!--`,`-->`]})},D=(e,t,n)=>{let r=``;for(let i=0;i<e.length;i++)if(r+=e[i],i<t.length){let e=t[i],a=n[String(e)]||`UNKNOWN_${e}`;r+=a}return r},O=(e,t)=>{let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);for(let e=0;e<Math.max(n.length,r.length);e++){let t=n[e]||0,i=r[e]||0;if(t<i)return-1;if(t>i)return 1}return 0},k=e=>u.join(X,`${e}.md`),rt=async e=>{try{return await r.access(k(e)),!0}catch{return!1}},it=async e=>{let t=k(e);return tt(await r.readFile(t,`utf-8`))},at=async(e,t)=>{let n=k(e);await r.writeFile(n,t,`utf-8`)},ot=async(e,t)=>{let n=k(e),i=m(await r.readFile(n,`utf-8`),{delimiters:[`<!--`,`-->`]}),a=Object.keys(t).length>0?[...new Set(Object.values(t))]:void 0,o={name:i.data.name,description:i.data.description,ccVersion:i.data.ccVersion};a&&a.length>0&&(o.variables=a),await at(e,m.stringify(i.content,o,{delimiters:[`<!--`,`-->`]}))},st=(e,t)=>{let n=e=>e.split(/(\s+)/),r=n(e),i=n(t),a=r.length,o=i.length,s=Array(a+1).fill(0).map(()=>Array(o+1).fill(0));for(let e=1;e<=a;e++)for(let t=1;t<=o;t++)r[e-1]===i[t-1]?s[e][t]=s[e-1][t-1]+1:s[e][t]=Math.max(s[e-1][t],s[e][t-1]);let c=Array(a).fill(!1),l=Array(o).fill(!1),u=a,d=o;for(;u>0||d>0;)u>0&&d>0&&r[u-1]===i[d-1]?(u--,d--):d>0&&(u===0||s[u][d-1]>=s[u-1][d])?(l[d-1]=!0,d--):u>0&&(c[u-1]=!0,u--);let f=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`),p=``;for(let e=0;e<r.length;e++){let t=f(r[e]);p+=c[e]?`<mark>${t}</mark>`:t}let m=``;for(let e=0;e<i.length;e++){let t=f(i[e]);m+=l[e]?`<mark>${t}</mark>`:t}return{oldHtml:p,newHtml:m}},ct=(e,t)=>{let n=e.length,r=t.length,i=Array(n+1).fill(0).map(()=>Array(r+1).fill(0));for(let a=1;a<=n;a++)for(let n=1;n<=r;n++)e[a-1]===t[n-1]?i[a][n]=i[a-1][n-1]+1:i[a][n]=Math.max(i[a-1][n],i[a][n-1]);let a=[],o=n,s=r,c=[];for(;o>0||s>0;)o>0&&s>0&&e[o-1]===t[s-1]?(c.unshift({type:`unchanged`,line:e[o-1],oldLineNo:o,newLineNo:s}),o--,s--):s>0&&(o===0||i[o][s-1]>=i[o-1][s])?(c.unshift({type:`added`,line:t[s-1],newLineNo:s}),s--):o>0&&(c.unshift({type:`removed`,line:e[o-1],oldLineNo:o}),o--);for(let e=0;e<c.length;e++){let t=c[e],n=c[e+1];if(t.type===`removed`&&n?.type===`added`){let r=st(t.line,n.line);a.push({type:`modified`,line:t.line,oldLineNo:t.oldLineNo,newLineNo:n.newLineNo,oldHtml:r.oldHtml,newHtml:r.newHtml}),e++}else a.push(t)}return a},lt=async(e,t,n,i,a,o,s,c)=>{let l=n.split(`
|
|
4
|
+
`),d=i.split(`
|
|
5
|
+
`),f=a.split(`
|
|
6
|
+
`),p=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`),m=ct(l,d),h=ct(l,f),g=``;for(let e of m){let t=p(e.line);if(e.type===`modified`){let t=e.oldLineNo?String(e.oldLineNo).padStart(4,` `):` `,n=e.newLineNo?String(e.newLineNo).padStart(4,` `):` `;g+=`<div class="line removed"><span class="line-num">${t}</span><span class="prefix">- </span>${e.oldHtml}</div>\n`,g+=`<div class="line added"><span class="line-num">${n}</span><span class="prefix">+ </span>${e.newHtml}</div>\n`}else if(e.type===`removed`){let n=e.oldLineNo?String(e.oldLineNo).padStart(4,` `):` `;g+=`<div class="line removed"><span class="line-num">${n}</span><span class="prefix">- </span>${t}</div>\n`}else if(e.type===`added`){let n=e.newLineNo?String(e.newLineNo).padStart(4,` `):` `;g+=`<div class="line added"><span class="line-num">${n}</span><span class="prefix">+ </span>${t}</div>\n`}else{let n=e.oldLineNo?String(e.oldLineNo).padStart(4,` `):` `,r=e.newLineNo?String(e.newLineNo).padStart(4,` `):` `;g+=`<div class="line unchanged"><span class="line-num">${n} ${r}</span><span class="prefix"> </span>${t}</div>\n`}}let _=``;for(let e of h){let t=p(e.line);if(e.type===`modified`){let t=e.oldLineNo?String(e.oldLineNo).padStart(4,` `):` `,n=e.newLineNo?String(e.newLineNo).padStart(4,` `):` `;_+=`<div class="line removed"><span class="line-num">${t}</span><span class="prefix">- </span>${e.oldHtml}</div>\n`,_+=`<div class="line added"><span class="line-num">${n}</span><span class="prefix">+ </span>${e.newHtml}</div>\n`}else if(e.type===`removed`){let n=e.oldLineNo?String(e.oldLineNo).padStart(4,` `):` `;_+=`<div class="line removed"><span class="line-num">${n}</span><span class="prefix">- </span>${t}</div>\n`}else if(e.type===`added`){let n=e.newLineNo?String(e.newLineNo).padStart(4,` `):` `;_+=`<div class="line added"><span class="line-num">${n}</span><span class="prefix">+ </span>${t}</div>\n`}else{let n=e.oldLineNo?String(e.oldLineNo).padStart(4,` `):` `,r=e.newLineNo?String(e.newLineNo).padStart(4,` `):` `;_+=`<div class="line unchanged"><span class="line-num">${n} ${r}</span><span class="prefix"> </span>${t}</div>\n`}}let v=`<!DOCTYPE html>
|
|
7
|
+
<html>
|
|
8
|
+
<head>
|
|
9
|
+
<meta charset="UTF-8">
|
|
10
|
+
<title>Diff: ${p(t)} (${p(e)})</title>
|
|
11
|
+
<style>
|
|
12
|
+
body {
|
|
13
|
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
14
|
+
margin: 0;
|
|
15
|
+
padding: 20px;
|
|
16
|
+
background: #f5f5f5;
|
|
17
|
+
}
|
|
18
|
+
.header {
|
|
19
|
+
background: white;
|
|
20
|
+
padding: 20px;
|
|
21
|
+
border-radius: 8px;
|
|
22
|
+
margin-bottom: 20px;
|
|
23
|
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
24
|
+
}
|
|
25
|
+
h1 {
|
|
26
|
+
margin: 0 0 10px 0;
|
|
27
|
+
color: #333;
|
|
28
|
+
}
|
|
29
|
+
.version-info {
|
|
30
|
+
color: #666;
|
|
31
|
+
font-size: 14px;
|
|
32
|
+
}
|
|
33
|
+
.warning {
|
|
34
|
+
background: #fff3cd;
|
|
35
|
+
border-left: 4px solid #ffc107;
|
|
36
|
+
padding: 15px;
|
|
37
|
+
margin-bottom: 20px;
|
|
38
|
+
border-radius: 4px;
|
|
39
|
+
}
|
|
40
|
+
.warning code {
|
|
41
|
+
background: rgba(0,0,0,0.1);
|
|
42
|
+
padding: 2px 6px;
|
|
43
|
+
border-radius: 3px;
|
|
44
|
+
font-family: 'Consolas', 'Monaco', monospace;
|
|
45
|
+
font-size: 13px;
|
|
46
|
+
}
|
|
47
|
+
.diff-panels {
|
|
48
|
+
display: grid;
|
|
49
|
+
grid-template-columns: 1fr 1fr;
|
|
50
|
+
gap: 20px;
|
|
51
|
+
margin-bottom: 20px;
|
|
52
|
+
}
|
|
53
|
+
.diff-container {
|
|
54
|
+
background: white;
|
|
55
|
+
border-radius: 8px;
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
58
|
+
}
|
|
59
|
+
.diff-header {
|
|
60
|
+
background: #f8f9fa;
|
|
61
|
+
padding: 12px 15px;
|
|
62
|
+
font-weight: bold;
|
|
63
|
+
border-bottom: 2px solid #dee2e6;
|
|
64
|
+
font-family: 'Consolas', 'Monaco', monospace;
|
|
65
|
+
font-size: 14px;
|
|
66
|
+
}
|
|
67
|
+
.diff-content {
|
|
68
|
+
padding: 0;
|
|
69
|
+
font-family: 'Consolas', 'Monaco', monospace;
|
|
70
|
+
font-size: 13px;
|
|
71
|
+
line-height: 1.5;
|
|
72
|
+
overflow-x: auto;
|
|
73
|
+
max-height: 600px;
|
|
74
|
+
overflow-y: auto;
|
|
75
|
+
}
|
|
76
|
+
.line {
|
|
77
|
+
padding: 2px 10px;
|
|
78
|
+
white-space: pre-wrap;
|
|
79
|
+
word-wrap: break-word;
|
|
80
|
+
}
|
|
81
|
+
.line .line-num {
|
|
82
|
+
display: inline-block;
|
|
83
|
+
min-width: 50px;
|
|
84
|
+
margin-right: 10px;
|
|
85
|
+
color: #6a737d;
|
|
86
|
+
text-align: right;
|
|
87
|
+
user-select: none;
|
|
88
|
+
font-size: 12px;
|
|
89
|
+
}
|
|
90
|
+
.line .prefix {
|
|
91
|
+
display: inline-block;
|
|
92
|
+
width: 20px;
|
|
93
|
+
font-weight: bold;
|
|
94
|
+
user-select: none;
|
|
95
|
+
}
|
|
96
|
+
.removed {
|
|
97
|
+
background: #ffebe9;
|
|
98
|
+
color: #24292e;
|
|
99
|
+
}
|
|
100
|
+
.removed .prefix {
|
|
101
|
+
color: #d73a49;
|
|
102
|
+
}
|
|
103
|
+
.added {
|
|
104
|
+
background: #e6ffed;
|
|
105
|
+
color: #24292e;
|
|
106
|
+
}
|
|
107
|
+
.added .prefix {
|
|
108
|
+
color: #22863a;
|
|
109
|
+
}
|
|
110
|
+
.unchanged {
|
|
111
|
+
background: #ffffff;
|
|
112
|
+
color: #24292e;
|
|
113
|
+
}
|
|
114
|
+
.unchanged .prefix {
|
|
115
|
+
color: #6a737d;
|
|
116
|
+
}
|
|
117
|
+
mark {
|
|
118
|
+
background: rgba(255, 200, 0, 0.4);
|
|
119
|
+
padding: 0;
|
|
120
|
+
border-radius: 2px;
|
|
121
|
+
}
|
|
122
|
+
.removed mark {
|
|
123
|
+
background: rgba(215, 58, 73, 0.3);
|
|
124
|
+
}
|
|
125
|
+
.added mark {
|
|
126
|
+
background: rgba(34, 134, 58, 0.3);
|
|
127
|
+
}
|
|
128
|
+
@media (max-width: 1200px) {
|
|
129
|
+
.diff-panels {
|
|
130
|
+
grid-template-columns: 1fr;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
</style>
|
|
134
|
+
</head>
|
|
135
|
+
<body>
|
|
136
|
+
<div class="header">
|
|
137
|
+
<h1>${p(t)}</h1>
|
|
138
|
+
<div class="version-info">
|
|
139
|
+
<strong>Old Version:</strong> ${p(o)} →
|
|
140
|
+
<strong>New Version:</strong> ${p(s)}
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<div class="warning">
|
|
145
|
+
<strong>⚠️ Version Mismatch Warning</strong><br>
|
|
146
|
+
Your customized prompt file is based on version ${p(o)},
|
|
147
|
+
but Claude Code is now using version ${p(s)}.
|
|
148
|
+
Review the differences below to understand both your customizations and the upstream changes.<br><br>
|
|
149
|
+
<strong>File:</strong> <code>${p(c)}</code><br><br>
|
|
150
|
+
When you're done reviewing, update the <code>ccVersion</code> in the file to <strong>${p(s)}</strong>.
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
<div class="diff-panels">
|
|
154
|
+
<div class="diff-container">
|
|
155
|
+
<div class="diff-header">Your Customizations (v${p(o)} → User)</div>
|
|
156
|
+
<div class="diff-content">
|
|
157
|
+
${g} </div>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<div class="diff-container">
|
|
161
|
+
<div class="diff-header">Upstream Changes (v${p(o)} → v${p(s)})</div>
|
|
162
|
+
<div class="diff-content">
|
|
163
|
+
${_} </div>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
</body>
|
|
167
|
+
</html>`,y=u.join(X,`${e}.diff.html`);return await r.writeFile(y,v,`utf-8`),y},ut=async t=>{let n={id:t.id,name:t.name,description:t.description,action:`skipped`,newVersion:t.version};if(!await rt(t.id)){let e=nt(t);return await at(t.id,e),n.action=`created`,n}let r=await it(t.id);if(n.oldVersion=r.ccVersion,await ot(t.id,t.identifierMap),r.ccVersion&&t.version){let i=O(r.ccVersion,t.version);if(i===0)return n.action=`skipped`,n;if(i!=0){let i=await Ye(t.id,r.ccVersion),a=Ge(r.content);if(!i||i!==a){n.action=`conflict`;let i=r.content;try{let e=(await Ve(r.ccVersion)).prompts.find(e=>e.id===t.id);e&&(i=D(e.pieces,e.identifiers,e.identifierMap))}catch{console.log(e.yellow(`Warning: Could not fetch old version ${r.ccVersion} for comparison. Using current file as baseline.`))}let a=D(t.pieces,t.identifiers,t.identifierMap),o=k(t.id);n.diffHtmlPath=await lt(t.id,t.name,i,r.content,a,r.ccVersion,t.version,o)}else{let e=nt(t);await at(t.id,e),n.action=`updated`}}}return n},dt=async t=>{let n={ccVersion:t,results:[]},i=await Ve(t);await Je(i),await r.mkdir(X,{recursive:!0});for(let t of i.prompts)try{let e=await ut(t);n.results.push(e)}catch(n){throw console.log(e.red(`Failed to sync prompt ${t.id}:`)),n}return n};let A=null,ft=null;const pt=async e=>{try{return A=await Ve(e),ft=e,{success:!0}}catch(e){return A=null,ft=null,e instanceof Error?{success:!1,errorMessage:e.message}:{success:!1,errorMessage:`Unknown error occurred while downloading system prompts`}}},mt=()=>A?A.prompts.map(e=>({id:e.id,name:e.name,description:e.description})):null,ht=e=>e.replace(/[^\x00-\x7F]/g,e=>{let t=`\\\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`;return`(?:${e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}|${t})`}),gt=e=>e.replace(/[^\x00-\x7F]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`),_t=(e,t,n)=>{let r=``;for(let i=0;i<e.length;i++){let a=e[i].replace(/<<CCVERSION>>/g,t);n&&(a=a.replace(/<<BUILD_TIME>>/g,n));let o=ht(a.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).replace(/\n/g,`(?:
|
|
168
|
+
|\\\\n)`);r+=o,i<e.length-1&&(r+=`([\\w$]+)`)}return r},vt=e=>{let t=new Map,n=0,r=1,i=1;for(let a=0;a<e.length;a++,i++){let o=e[a];if(o===`
|
|
169
|
+
`){r++,i=0;continue}let s=e[a+1];if(o===`$`&&s===`{`){n++,a++,i++;continue}if(n){o===`{`?n++:o===`}`&&n--;continue}if(o==="`"&&e[a-1]!==`\\`){let e=t.get(r)??[];e.push(i),t.set(r,e)}}return t},yt=(t,n,r,i)=>{let a=[],o=String(n),s=o.length,c=` `.repeat(s),l=i[0],u=i[i.length-1],d=l-1,f=r.length-u,p=r,m=i,h=``,g=``,_=0;if(d>30||f>30){let t=0,n=r.length,a=0;if(d>30){let n=d-30;t=n,a=-n;let r=`[${n} chars] ...`;h=e.dim(r),_=r.length}if(f>30){let t=f-30;n=r.length-t,g=e.dim(`... [${t} chars]`)}p=r.substring(t,n),m=i.map(e=>e+a)}a.push(`${e.red.bold(`error`)}${e.bold(`: system prompt file contains unescaped backtick`)}`),a.push(`${e.blue.bold(` `.repeat(s)+` -->`)} ${t}:${n}:${l}`),a.push(`${c} ${e.blue.bold(`|`)}`);let v=h+p+g;a.push(`${e.blue.bold(o)} ${e.blue.bold(`|`)} ${v}`);let y=_+m[0]-1,b=` `.repeat(y)+`^ unescaped backtick`;a.push(`${c} ${e.blue.bold(`|`)} ${e.red.bold(b)}`),a.push(`${c} ${e.blue.bold(`|`)}`),a.push(`${e.cyan.bold(`help`)}: add \`\\\` before the backtick to escape it`),a.push(`${c} ${e.blue.bold(`|`)}`);let x=[],S=0;for(let t of m)x.push(p.substring(S,t-1)),x.push(e.green(`\\`)+"`"),S=t;x.push(p.substring(S));let C=h+x.join(``)+g;a.push(`${e.blue.bold(o)} ${e.blue.bold(`|`)} ${C}`);let w=``,ee=0;for(let e=0;e<m.length;e++){let t=m[e],n=_+t-1+ee;w=w.padEnd(n,` `)+`+`,ee++}return a.push(`${c} ${e.blue.bold(`|`)} ${e.green(w)}`),a.join(`
|
|
170
|
+
`)},bt=e=>{if(e.length===0)return{leading:``,trailing:``};let t=e[0].match(/^(\s*)/),n=t?t[1]:``,r=e[e.length-1].match(/(\s*)$/);return{leading:n,trailing:r?r[1]:``}},xt=(e,t)=>{if(e.trim()===``)return``;let n=e.trim();return t.leading+n+t.trailing},St=(e,t,n,r,i,a=!1,o,s)=>{let c={};for(let e=0;e<r.length;e++){let i=r[e],a=n[String(t[e])];a&&(c[a]=i)}let l=e,u=Object.entries(c).sort((e,t)=>t[0].length-e[0].length);for(let[e,t]of u){let n=RegExp(`\\b${e}\\b`,`g`);l=l.replace(n,()=>t)}if(l=l.replace(/<<CCVERSION>>/g,i),o&&(l=l.replace(/<<BUILD_TIME>>/g,o)),a&&(l=gt(l)),s&&s.length>0){let e=bt(s);l=xt(l,e)}return l},Ct=async(e,t=!1,n)=>{if(!A||ft!==e)return[];let i=A,a=[];for(let o of i.prompts){let i=_t(o.pieces,e,n),s=u.join(X,`${o.id}.md`),c;try{c=await r.readFile(s,`utf8`)}catch(e){console.error(`Failed to read markdown file ${s}:`,e);continue}let l=tt(c);a.push({promptId:o.id,prompt:l,regex:i,getInterpolatedContent:r=>{let i=r.slice(1);return St(l.content,o.identifiers,o.identifierMap,i,e,t,n,o.pieces)},pieces:o.pieces,identifiers:o.identifiers,identifierMap:o.identifierMap})}return a},wt=t=>{let n=t.results.filter(e=>e.action===`created`),r=t.results.filter(e=>e.action===`updated`),i=t.results.filter(e=>e.action===`conflict`),a=t.results.filter(e=>e.action===`skipped`);if((n.length>0||r.length>0||i.length>0)&&a.length>0&&(console.log(e.dim(`Skipped ${a.length} up-to-date file(s)`)),console.log()),n.length>0){console.log(e.bold.green(`Created ${n.length} new prompt file(s):`));for(let t of n)console.log(e.green(` ${X}/${t.id}.md`)),console.log(e.green.dim(` ${t.description}`));console.log()}if(r.length>0){console.log(e.bold.blue(`Updated ${r.length} system prompt file(s):`));for(let t of r)t.oldVersion?console.log(e.blue(` ${t.id}.md (${t.oldVersion} → ${t.newVersion})`)):console.log(e.blue(` ${t.id}.md (→ ${t.newVersion})`));console.log()}if(i.length>0){console.log(e.bold.yellow(`WARNING: Conflicts detected for ${i.length} system prompt file(s)`));for(let t of i)console.log(e.yellow(` ${t.id}.md (${t.oldVersion} → ${t.newVersion})`)),console.log(e.yellow(` Open the diff in your browser: ${t.diffHtmlPath}`));console.log()}if(n.length>0&&(console.log(e.green.bold(`New prompt files have been created; either more are now supported by tweakcc or Anthropic has added new ones.`)),console.log(e.green(`You can now customize the markdown files at ${X} in a text editor.`)),console.log(e.green(`Then run tweakcc and select "apply" or use tweakcc --apply to update your system prompts`)),console.log()),i.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(e.bold.cyan(` 4. Important: Update the ccVersion in your markdown files to the latest version of each prompt:`));for(let t of i)console.log(e.yellow(` ${t.id}.md → `)+e.bold.magenta(t.newVersion));console.log(` 5. Delete the diff HTML files`),console.log()}},Tt=e=>/\\u[0-9a-fA-F]{4}/.test(e),Et=e=>{let t=e.match(/\bBUILD_TIME:"(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z)"/);return t?t[1]:void 0},Dt=async(t,n,r,i)=>{let a=r??Tt(t);a&&W(`Detected Unicode escaping in cli.js - will escape non-ASCII characters in prompts`);let o=Et(t);o&&W(`Extracted BUILD_TIME from cli.js: ${o}`);let s=await Ct(n,a,o);W(`Loaded ${s.length} system prompts with regexes`);let c=[];for(let{promptId:n,prompt:r,regex:a,getInterpolatedContent:o,pieces:l,identifiers:u,identifierMap:d}of s){if(i&&!i.includes(n)){c.push({id:n,name:r.name,group:H.SYSTEM_PROMPTS,applied:!1,skipped:!0});continue}W(`Applying system prompt: ${r.name}`);let s=new RegExp(a,`si`),f=t.match(s);if(f&&f.index!==void 0){let i=o(f),a=f.index,p=a>0?t[a-1]:``;if(p==="`"){let e=vt(i);if(e.size>0){let t=k(n),i=r.content.split(`
|
|
171
|
+
`);for(let[n,a]of e){let e=n+(r.contentLineOffset||0),o=i[n-1]||``;console.log(yt(t,e,o,a)),console.log()}continue}}let m=D(l,u,d).trim().length,h=r.content.trim().length,g=t,_=f[0].length,v=i;p===`"`?(v=v.replace(/\n/g,`\\n`),v=v.replace(/"/g,`\\"`)):p===`'`&&(v=v.replace(/\n/g,`\\n`),v=v.replace(/'/g,`\\'`)),t=t.replace(s,()=>v),await Qe(n,Ge(r.content)),F(g,t,v,a,a+_);let y=m-h,b=y!==0,x;x=y>0?e.green(`${y} fewer chars`):y<0?e.red(`${Math.abs(y)} more chars`):`unchanged`,c.push({id:n,name:r.name,group:H.SYSTEM_PROMPTS,applied:b,details:x})}else{!r.name.startsWith(`Data:`)&&r.name!==`Skill: Build with Claude API`&&console.log(e.yellow(`Could not find system prompt "${r.name}" in cli.js (using regex ${Ir(s)})`)),G(`\n Debug info for ${r.name}:`),G(` Regex pattern (first 200 chars): ${a.substring(0,200).replace(/\n/g,`\\n`)}...`),G(` Trying to match pattern in cli.js...`);try{G(` Partial match result: ${t.match(new RegExp(a.substring(0,100)))?`found partial`:`no match`}`)}catch{G(` Partial match failed (regex truncation issue)`)}}}return{newContent:t,results:c}},Ot=e=>{let t=e.match(/ensureServerStarted:([$\w]+)/);if(!t||t.index===void 0)return console.error(`patch: fixLspSupport: failed to find ensureServerStarted`),null;let n=Math.max(0,t.index-50),r=Math.min(e.length,t.index+50),i=e.slice(n,r),a=i.match(/sendRequest:([$\w]+)[,}]/);if(!a)return console.error(`patch: fixLspSupport: failed to find sendRequest near ensureServerStarted, window=${JSON.stringify([n,r,i])}`),null;let o=a[1],s=Math.max(0,t.index-2e3),c=e.slice(s,t.index),l=RegExp(`async function ${U(o)}\\(([$\\w]+),`,`g`),u,d=null;for(;(u=l.exec(c))!==null;)d=u;if(!d)return console.error(`patch: fixLspSupport: failed to find async function ${o}`),null;let f=d[1],p=s+d.index,m=e.slice(p,t.index).match(/let ([$\w]+)=await [$\w]+\([$\w]+\);/);if(!m||m.index===void 0)return console.error(`patch: fixLspSupport: failed to find second line of sendRequest`),null;let h=m[1],g=p+m.index+m[0].length,_=e.slice(g,t.index),v=RegExp(`if\\(!${U(h)}\\)return;`),y=_.match(v);if(!y||y.index===void 0)return console.error(`patch: fixLspSupport: failed to find if(!serverVar)return; line`),null;let b=g+y.index+y[0].length;return{startIndex:b,endIndex:b,identifiers:[f,h]}},kt=e=>{let 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,r=/if\([$\w]+\.shutdownTimeout!==void 0\)throw Error\(`LSP server '\$\{[$\w]+\}': shutdownTimeout is not yet implemented\. Remove this field from the configuration\.`\);/g,i=e;i=I(i,t,``),i=I(i,n,``),i=I(i,r,``);let a=Ot(i);if(!a||!a.identifiers)return null;let[o,s]=a.identifiers,c=`
|
|
172
|
+
const path = await import('path');
|
|
173
|
+
const ext = path.extname(${o}).toLowerCase();
|
|
174
|
+
const langMap = {
|
|
175
|
+
'.ts': 'typescript',
|
|
176
|
+
'.tsx': 'typescriptreact',
|
|
177
|
+
'.js': 'javascript',
|
|
178
|
+
'.jsx': 'javascriptreact',
|
|
179
|
+
'.mjs': 'javascript',
|
|
180
|
+
'.cjs': 'javascript',
|
|
181
|
+
'.mts': 'typescript',
|
|
182
|
+
'.cts': 'typescript',
|
|
183
|
+
'.py': 'python',
|
|
184
|
+
'.pyi': 'python',
|
|
185
|
+
'.pyw': 'python',
|
|
186
|
+
'.rs': 'rust',
|
|
187
|
+
'.go': 'go',
|
|
188
|
+
'.java': 'java',
|
|
189
|
+
'.kt': 'kotlin',
|
|
190
|
+
'.kts': 'kotlin',
|
|
191
|
+
'.scala': 'scala',
|
|
192
|
+
'.sc': 'scala',
|
|
193
|
+
'.groovy': 'groovy',
|
|
194
|
+
'.c': 'c',
|
|
195
|
+
'.cpp': 'cpp',
|
|
196
|
+
'.cc': 'cpp',
|
|
197
|
+
'.cxx': 'cpp',
|
|
198
|
+
'.c++': 'cpp',
|
|
199
|
+
'.h': 'c',
|
|
200
|
+
'.hpp': 'cpp',
|
|
201
|
+
'.hh': 'cpp',
|
|
202
|
+
'.hxx': 'cpp',
|
|
203
|
+
'.h++': 'cpp',
|
|
204
|
+
'.cs': 'csharp',
|
|
205
|
+
'.csx': 'csharp',
|
|
206
|
+
'.html': 'html',
|
|
207
|
+
'.htm': 'html',
|
|
208
|
+
'.css': 'css',
|
|
209
|
+
'.scss': 'scss',
|
|
210
|
+
'.sass': 'sass',
|
|
211
|
+
'.less': 'less',
|
|
212
|
+
'.php': 'php',
|
|
213
|
+
'.phtml': 'php',
|
|
214
|
+
'.php3': 'php',
|
|
215
|
+
'.php4': 'php',
|
|
216
|
+
'.php5': 'php',
|
|
217
|
+
'.phps': 'php',
|
|
218
|
+
'.rb': 'ruby',
|
|
219
|
+
'.rbw': 'ruby',
|
|
220
|
+
'.rake': 'ruby',
|
|
221
|
+
'.gemspec': 'ruby',
|
|
222
|
+
'.sh': 'shellscript',
|
|
223
|
+
'.bash': 'shellscript',
|
|
224
|
+
'.zsh': 'shellscript',
|
|
225
|
+
'.fish': 'fish',
|
|
226
|
+
'.swift': 'swift',
|
|
227
|
+
'.m': 'objective-c',
|
|
228
|
+
'.mm': 'objective-cpp',
|
|
229
|
+
'.lua': 'lua',
|
|
230
|
+
'.pl': 'perl',
|
|
231
|
+
'.pm': 'perl',
|
|
232
|
+
'.t': 'perl',
|
|
233
|
+
'.pod': 'perl',
|
|
234
|
+
'.r': 'r',
|
|
235
|
+
'.R': 'r',
|
|
236
|
+
'.rmd': 'rmd',
|
|
237
|
+
'.Rmd': 'rmd',
|
|
238
|
+
'.ex': 'elixir',
|
|
239
|
+
'.exs': 'elixir',
|
|
240
|
+
'.erl': 'erlang',
|
|
241
|
+
'.hrl': 'erlang',
|
|
242
|
+
'.hs': 'haskell',
|
|
243
|
+
'.lhs': 'haskell',
|
|
244
|
+
'.ml': 'ocaml',
|
|
245
|
+
'.mli': 'ocaml',
|
|
246
|
+
'.clj': 'clojure',
|
|
247
|
+
'.cljs': 'clojure',
|
|
248
|
+
'.cljc': 'clojure',
|
|
249
|
+
'.edn': 'clojure',
|
|
250
|
+
'.json': 'json',
|
|
251
|
+
'.jsonc': 'jsonc',
|
|
252
|
+
'.xml': 'xml',
|
|
253
|
+
'.yaml': 'yaml',
|
|
254
|
+
'.yml': 'yaml',
|
|
255
|
+
'.toml': 'toml',
|
|
256
|
+
'.ini': 'ini',
|
|
257
|
+
'.cfg': 'ini',
|
|
258
|
+
'.conf': 'conf',
|
|
259
|
+
'.md': 'markdown',
|
|
260
|
+
'.markdown': 'markdown',
|
|
261
|
+
'.mdown': 'markdown',
|
|
262
|
+
'.rst': 'restructuredtext',
|
|
263
|
+
'.tex': 'latex',
|
|
264
|
+
'.sql': 'sql',
|
|
265
|
+
'.graphql': 'graphql',
|
|
266
|
+
'.gql': 'graphql',
|
|
267
|
+
'.dart': 'dart',
|
|
268
|
+
'.jl': 'julia',
|
|
269
|
+
'.zig': 'zig',
|
|
270
|
+
'.nim': 'nim',
|
|
271
|
+
'.nims': 'nim',
|
|
272
|
+
'.cr': 'crystal',
|
|
273
|
+
'.d': 'd',
|
|
274
|
+
'.di': 'd',
|
|
275
|
+
'.fs': 'fsharp',
|
|
276
|
+
'.fsx': 'fsharp',
|
|
277
|
+
'.fsi': 'fsharp',
|
|
278
|
+
'.ps1': 'powershell',
|
|
279
|
+
'.psm1': 'powershell',
|
|
280
|
+
'.psd1': 'powershell',
|
|
281
|
+
'.bat': 'bat',
|
|
282
|
+
'.cmd': 'bat',
|
|
283
|
+
'.mk': 'makefile',
|
|
284
|
+
'.dockerfile': 'dockerfile',
|
|
285
|
+
'.proto': 'proto',
|
|
286
|
+
'.vhd': 'vhdl',
|
|
287
|
+
'.vhdl': 'vhdl',
|
|
288
|
+
'.v': 'verilog',
|
|
289
|
+
'.sv': 'systemverilog',
|
|
290
|
+
'.asm': 'asm',
|
|
291
|
+
'.s': 'asm',
|
|
292
|
+
'.f': 'fortran',
|
|
293
|
+
'.f90': 'fortran',
|
|
294
|
+
'.f95': 'fortran',
|
|
295
|
+
'.cob': 'cobol',
|
|
296
|
+
'.cbl': 'cobol',
|
|
297
|
+
'.ada': 'ada',
|
|
298
|
+
'.adb': 'ada',
|
|
299
|
+
'.ads': 'ada',
|
|
300
|
+
'.sol': 'solidity',
|
|
301
|
+
'.vue': 'vue',
|
|
302
|
+
'.svelte': 'svelte',
|
|
303
|
+
'.astro': 'astro',
|
|
304
|
+
'.tf': 'terraform',
|
|
305
|
+
'.tfvars': 'terraform',
|
|
306
|
+
'.prisma': 'prisma'
|
|
307
|
+
};
|
|
308
|
+
const languageId = langMap[ext] || 'plaintext';
|
|
309
|
+
try {
|
|
310
|
+
const fs = await import('fs/promises');
|
|
311
|
+
const text = await fs.readFile(${o}, 'utf8');
|
|
312
|
+
await ${s}.sendNotification('textDocument/didOpen', {
|
|
313
|
+
textDocument: {
|
|
314
|
+
uri: "file://" + ${o},
|
|
315
|
+
languageId: languageId,
|
|
316
|
+
version: 1,
|
|
317
|
+
text: text
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
} catch (openErr) { }
|
|
321
|
+
`,l=i.slice(0,a.startIndex)+c+i.slice(a.endIndex);return F(i,l,c,a.startIndex,a.endIndex),l},At=e=>{let t=e.match(/=>\[([$a-zA-Z_][$\w]{1,2},){30}/);if(!t||t.index===void 0)return console.error(`patch: findSlashCommandListEndPosition: failed to find arrayStartPattern`),null;let n=e.indexOf(`[`,t.index);if(n===-1)return console.error(`patch: findSlashCommandListEndPosition: failed to find bracketIndex`),null;let r=1,i=n+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},jt=(e,t)=>{let n=At(e);if(n===null)return console.error(`patch: writeSlashCommandDefinition: failed to find slash command array end position`),null;let r=e.slice(0,n)+t+e.slice(n);return F(e,r,t,n,n),r},Mt=e=>{let t=e.match(/\.createElement\(([$\w]+),.{0,100}"Yes, use recommended settings"/);return t?t[1]:(console.error(`patch: findSelectComponentName: failed to find selectPattern`),null)},Nt=e=>{let t=Array.from(e.matchAll(/function ([$\w]+)(?:\([$\w]+\)\{let [$\w]+=[$\w]+\(\d+\),\{(?:(?:orientation|title|width|padding|titlePadding|titleColor|titleDimColor|dividerChar|dividerColor|dividerDimColor|boxProps):[$\w]+,?)+\}=|\(\{(?:(?:orientation|title|width|padding|titlePadding|titleColor|titleDimColor|dividerChar|dividerColor|dividerDimColor|boxProps):[$\w]+(?:=(?:[^,]+,|[^}]+\})|[,}]))+\))/g));if(t.length===0)return console.error(`patch: findDividerComponentName: failed to find dividerPattern`),null;let n=t[0];for(let e of t)e[0].length>n[0].length&&(n=e);return n[1]},j=e=>{let t=e.match(/function ([$\w]+)\(.{0,110}`Your selector in.{0,1000}?function ([$\w]+)\(\)\{return [$\w]+\(\)\.setState\}/);return t?{appStateUseSelectorFn:t[1],appStateSetState:t[2]}:(console.error(`patch: getAppStateSelectorAndUseState: failed to find pattern`),null)},Pt=e=>{let t=At(e);if(t===null)return console.error(`patch: findTopLevelPositionBeforeSlashCommand: failed to find arrayEnd`),null;let n=1,r=t;for(;r>=0&&n>0;){if(e[r]===`}`)n++;else if(e[r]===`{`&&(n--,n===0))break;r--}if(r<0)return console.error(`patch: findTopLevelPositionBeforeSlashCommand: failed to find matching open-brace`),null;for(;r>=0&&e[r]!==`;`;)r--;return r<0?(console.error(`patch: findTopLevelPositionBeforeSlashCommand: failed to find matching semicolon`),null):r+1},Ft=(e,t)=>{let n=Array.from(e.matchAll(/thinkingEnabled:([$\w]+)\(\)/g));if(n.length===0)return console.error(`patch: toolsets: failed to find thinkingEnabled pattern`),null;let r=[];for(let e of n)if(e.index!==void 0){let t=e.index+e[0].length;r.push({index:t})}r.sort((e,t)=>t.index-e.index);let i=e,a=`,toolset:${t?JSON.stringify(t):`undefined`}`;for(let e of r)i=i.slice(0,e.index)+a+i.slice(e.index);if(i===e)return console.error(`patch: toolsets: failed to modify app state initialization`),null;let o=r[r.length-1];return F(e,i,a,o.index,o.index),i},It=(e,t)=>{let n=j(e);if(!n)return console.error(`patch: toolsets: toolFetchingMemo: failed to find app state info`),null;let{appStateUseSelectorFn:r}=n,i=e.match(/let ([$\w]+)=([$\w]+\([$\w]+,[$\w]+\.tools,[$\w]+\)),/);if(!i||i.index===void 0)return console.error(`patch: toolsets: failed to find tool aggregation pattern`),null;let a=i[1],o=i[2],s=`let currentToolset = ${r}(state => state.toolset);
|
|
322
|
+
let ${a} = undefined;
|
|
323
|
+
const toolsets = ${JSON.stringify(Object.fromEntries(t.map(e=>[e.name,e.allowedTools===`*`?`*`:e.allowedTools])))};
|
|
324
|
+
if (toolsets.hasOwnProperty(currentToolset)) {
|
|
325
|
+
const allowedTools = toolsets[currentToolset];
|
|
326
|
+
if (allowedTools === "*") {
|
|
327
|
+
${a} = ${o};
|
|
328
|
+
} else {
|
|
329
|
+
${a} = ${o}.filter((toolDef) => allowedTools.includes(toolDef.name));
|
|
330
|
+
}
|
|
331
|
+
} else {
|
|
332
|
+
${a} = ${o};
|
|
333
|
+
}let `,c=i.index,l=c+i[0].length,u=e.slice(0,c)+s+e.slice(l);return F(e,u,s,c,l),u},Lt=(e,t)=>{let n=Pt(e);if(n===null)return console.error(`patch: toolsets: failed to find slash command insertion point`),null;let r=B(e);if(!r)return console.error(`patch: toolsets: failed to find React variable`),null;let i=or(e);if(!i)return console.error(`patch: toolsets: failed to find Box component`),null;let a=V(e);if(!a)return console.error(`patch: toolsets: failed to find Text component`),null;let o=Mt(e);if(!o)return console.error(`patch: toolsets: failed to find Select component`),null;let s=Nt(e);if(!s)return console.error(`patch: toolsets: failed to find Divider component`),null;let c=j(e);if(!c)return console.error(`patch: toolsets: failed to find app state getter`),null;let l=L(e);if(!l)return console.error(`patch: toolsets: failed to find chalk variable`),null;let{appStateUseSelectorFn:u,appStateSetState:d}=c,f=JSON.stringify(t.map(e=>e.name)),p=JSON.stringify(t.map(e=>({label:e.name,value:e.name,description:e.allowedTools===`*`?`All tools`:e.allowedTools.length===0?`No tools`:`${e.allowedTools.length} tool${e.allowedTools.length===1?``:`s`}: ${e.allowedTools.join(`, `)}`}))),m=`const toolsetComp = ({ onExit, input }) => {
|
|
334
|
+
const currentToolset = ${u}(state => state.toolset);
|
|
335
|
+
|
|
336
|
+
const setState = ${d}();
|
|
337
|
+
|
|
338
|
+
// Handle command-line argument
|
|
339
|
+
if (input !== "" && input != null) {
|
|
340
|
+
if (!${f}.includes(input)) {
|
|
341
|
+
onExit(${l}.red(\`\${${l}.bold(input)} is not a valid toolset. Valid toolsets: ${t.map(e=>e.name).join(`, `)}\`));
|
|
342
|
+
return;
|
|
343
|
+
} else {
|
|
344
|
+
setState(prev => ({ ...prev, toolset: input }));
|
|
345
|
+
onExit(\`Toolset changed to \${${l}.bold(input)}\`);
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// Render interactive UI
|
|
351
|
+
return ${r}.createElement(
|
|
352
|
+
${i},
|
|
353
|
+
{ flexDirection: "column" },
|
|
354
|
+
${r}.createElement(${s}, { dividerColor: "permission" }),
|
|
355
|
+
${r}.createElement(
|
|
356
|
+
${i},
|
|
357
|
+
{ paddingX: 1, marginBottom: 1, flexDirection: "column" },
|
|
358
|
+
${r}.createElement(${i}, null,
|
|
359
|
+
${r}.createElement(${a}, { bold: true, color: "remember" }, "Select toolset")
|
|
360
|
+
),
|
|
361
|
+
${r}.createElement(${i}, null,
|
|
362
|
+
${r}.createElement(${a}, { dimColor: true }, "A toolset is a collection of tools that Claude sees and is allowed to call.")
|
|
363
|
+
),
|
|
364
|
+
${r}.createElement(${i}, { marginBottom: 1 },
|
|
365
|
+
${r}.createElement(${a}, { dimColor: true }, "Claude cannot call tools that are not included in the selected toolset.")
|
|
366
|
+
),
|
|
367
|
+
${r}.createElement(${i}, null,
|
|
368
|
+
${r}.createElement(${a}, { color: "warning" }, "Note that Claude may hallucinate that it has access to tools outside of the toolset.")
|
|
369
|
+
),
|
|
370
|
+
${r}.createElement(${i}, { marginBottom: 1 },
|
|
371
|
+
${r}.createElement(${a}, { dimColor: true }, "If so, explicitly remind it what its tool list is, or tell it to check it itself.")
|
|
372
|
+
),
|
|
373
|
+
${r}.createElement(${i}, null,
|
|
374
|
+
${r}.createElement(${a}, { dimColor: true, bold: true }, "Toolsets are managed with tweakcc. "),
|
|
375
|
+
${r}.createElement(${a}, { dimColor: true }, "Run "),
|
|
376
|
+
${r}.createElement(${a}, { color: "permission" }, "npx tweakcc"),
|
|
377
|
+
${r}.createElement(${a}, { dimColor: true }, " to manage them.")
|
|
378
|
+
),
|
|
379
|
+
${r}.createElement(${i}, { marginBottom: 1 },
|
|
380
|
+
${r}.createElement(${a}, { color: "permission" }, "https://github.com/Piebald-AI/tweakcc")
|
|
381
|
+
),
|
|
382
|
+
${r}.createElement(${i}, { marginBottom: 1 },
|
|
383
|
+
${r}.createElement(${a}, null, "Current toolset: "),
|
|
384
|
+
${r}.createElement(${a}, { bold: true }, currentToolset || "undefined")
|
|
385
|
+
),
|
|
386
|
+
${r}.createElement(${i}, { marginBottom: 1 },
|
|
387
|
+
${r}.createElement(${o}, {
|
|
388
|
+
options: ${p},
|
|
389
|
+
onChange: (input) => {
|
|
390
|
+
setState(prev => ({ ...prev, toolset: input }));
|
|
391
|
+
onExit(\`Toolset changed to \${${l}.bold(input)}\`);
|
|
392
|
+
},
|
|
393
|
+
onCancel: () => onExit(\`Toolset not changed (left as \${${l}.bold(currentToolset)})\`)
|
|
394
|
+
})
|
|
395
|
+
),
|
|
396
|
+
${r}.createElement(${a}, { dimColor: true, italic: true }, "Enter to confirm · Esc to exit")
|
|
397
|
+
)
|
|
398
|
+
);
|
|
399
|
+
};`,h=e.slice(0,n)+m+e.slice(n);return F(e,h,m,n,n),h},Rt=e=>{let t=e.match(/\{color:"bashBorder"\},"! for bash mode"/);if(!t||t.index===void 0)return console.error(`patch: toolsets: findShiftTabAppStateVarInsertionPoint: failed to find bash mode pattern`),null;let n=Math.max(0,t.index-1e4),r=e.slice(n,t.index),i=Array.from(r.matchAll(/function ([$\w]+)\((?:\{[^}]+\}|[$\w]+)\)\{/g));if(i.length===0)return console.error(`patch: toolsets: findShiftTabAppStateVarInsertionPoint: failed to find function pattern`),null;let a=i[i.length-1];return a.index===void 0?(console.error(`patch: toolsets: findShiftTabAppStateVarInsertionPoint: match has no index`),null):n+a.index+a[0].length},zt=e=>{let t=Rt(e);if(t===null)return console.error(`patch: toolsets: insertShiftTabAppStateVar: failed to find insertion point`),null;let n=j(e);if(!n)return console.error(`patch: toolsets: insertShiftTabAppStateVar: failed to find app state getter`),null;let{appStateUseSelectorFn:r}=n,i=`let currentToolset=${r}(state => state.toolset);`,a=e.slice(0,t)+i+e.slice(t);return F(e,a,i,t,t),a},Bt=e=>{let t=e.match(/([$\w]+)\((\w+)\)\.toLowerCase\(\)," on"/);if(!t||t.index===void 0)return console.error(`patch: toolsets: appendToolsetToModeDisplay: failed to find mode display pattern`),null;let n=t[1],r=t[2],i=t[0],a=`${n}(${r}).toLowerCase(),currentToolset?\` on [\${currentToolset}]\`:""`,o=e.replace(i,a);return o===e?(console.error(`patch: toolsets: appendToolsetToModeDisplay: failed to modify mode display`),null):(F(e,o,a,t.index,t.index+i.length),o)},Vt=e=>{let t=Array.from(e.matchAll(/"\? for shortcuts"/g)).at(-1);if(!t||t.index===void 0)return console.error(`patch: toolsets: appendToolsetToShortcutsDisplay: could not find '? for shortcuts'`),null;let n=t[0],r='currentToolset?`? for shortcuts [${currentToolset}]`:"? for shortcuts"',i=e.replace(n,r);return i===e?(console.error(`patch: toolsets: appendToolsetToModeDisplay: failed to modify mode display`),null):(F(e,i,r,t.index,t.index+n.length),i)},Ht=e=>{let t=B(e);return t?jt(e,`, {
|
|
400
|
+
aliases: ["change-tools"],
|
|
401
|
+
type: "local-jsx",
|
|
402
|
+
name: "toolset",
|
|
403
|
+
description: "Select a toolset (managed by tweakcc)",
|
|
404
|
+
argumentHint: "[toolset-name]",
|
|
405
|
+
isEnabled: () => true,
|
|
406
|
+
isHidden: false,
|
|
407
|
+
load: () => Promise.resolve().then(() => ({call: (onExit, ctx, input) => {
|
|
408
|
+
return ${t}.createElement(toolsetComp, { onExit, input });
|
|
409
|
+
}})),
|
|
410
|
+
userFacingName() {
|
|
411
|
+
return "toolset";
|
|
412
|
+
}
|
|
413
|
+
}`):(console.error(`patch: toolsets: failed to find React variable`),null)},Ut=e=>{let t=e.match(/[\w$]+\([\w$]+,function\([\w$]+\)\{[\w$]+\("tengu_ext_at_mentioned",\{\}\);/);return!t||t.index===void 0?(console.error(`patch: findToolChangeComponentScope: failed to find tool change component scope`),null):t.index},Wt=e=>{let t=Ut(e);if(t===null)return null;let n=j(e);if(!n)return console.error(`patch: addCurrentToolsetAtToolChangeComponentScope: failed to get app state getter function`),null;let{appStateUseSelectorFn:r}=n,i=`const currentToolset = ${r}(state => state.toolset);`,a=e.slice(0,t)+i+e.slice(t);return F(e,a,i,t,t),a},Gt=e=>{let t=e.match(/if\(([$\w]+)\(\([$\w]+\)=>\(\{\.\.\.[$\w]+,toolPermissionContext.{0,200}?mode:([$\w]+)/);return!t||t.index===void 0?(console.error(`patch: findModeChange: failed to find mode change location`),null):{index:t.index,modeVar:t[2],setStateVar:t[1]}},Kt=(e,t,n)=>{let r=Gt(e);if(!r)return null;let{index:i,modeVar:a,setStateVar:o}=r,s=`if(${a}==="plan"){${o}((prev)=>({...prev,toolset:${JSON.stringify(t)}}));}else{${o}((prev)=>({...prev,toolset:${JSON.stringify(n)}}));}`,c=e.slice(0,i)+s+e.slice(i);return F(e,c,s,i,i),c},qt=(e,t,n,r)=>{if(!t||t.length===0)return e;let i=e;if(i=Ft(i,n),!i)return console.error(`patch: toolsets: step 1 failed (writeToolsetFieldToAppState)`),null;if(i=It(i,t),!i)return console.error(`patch: toolsets: step 2 failed (writeToolFetchingUseMemo)`),null;if(i=Lt(i,t),!i)return console.error(`patch: toolsets: step 3 failed (writeToolsetComponentDefinition)`),null;if(i=Ht(i),!i)return console.error(`patch: toolsets: step 4 failed (writeSlashCommandDefinition)`),null;if(i=zt(i),!i)return console.error(`patch: toolsets: step 5 failed (insertShiftTabAppStateVar)`),null;if(i=Bt(i),!i)return console.error(`patch: toolsets: step 6 failed (appendToolsetToModeDisplay)`),null;if(i=Vt(i),!i)return console.error(`patch: toolsets: step 7 failed (appendToolsetToShortcutsDisplay)`),null;if(r&&n){if(i=Wt(i),!i)return console.error(`patch: toolsets: step 8a failed (addCurrentToolsetAtToolChangeComponentScope)`),null;if(i=Kt(i,r,n),!i)return console.error(`patch: toolsets: step 8b failed (writeModeChangeUpdateToolset)`),null}return i},M=/\{top:\["┌","─","┬","┐"\],middle:\["├","─","┼","┤"\],bottom:\["└","─","┴","┘"\]\}/,N=/top:\["\\u250C","\\u2500","\\u252C","\\u2510"\],middle:\["\\u251C","\\u2500","\\u253C","\\u2524"\],bottom:\["\\u2514","\\u2500","\\u2534","\\u2518"\]/,P=/top: \["┌", "─", "┬", "┐"\],\s+middle: \["├", "─", "┼", "┤"\],\s+bottom: \["└", "─", "┴", "┘"\]/,Jt=/if\(([$\w]+)\.push\(\.\.\.([$\w]+)\(([$\w]+),!1\)\),([$\w]+)<([$\w]+)\.rows\.length-1\)([$\w]+)\.push\(([$\w]+)\("middle"\)\)/g,Yt=/if\s*\(\s*\(\s*([$\w]+)\.push\(\.\.\.([$\w]+)\(([$\w]+)\s*,\s*!1\)\)\s*,\s*([$\w]+)\s*<\s*([$\w]+)\.rows\.length\s*-\s*1\s*\)\s*\)\s*([$\w]+)\.push\(([$\w]+)\("middle"\)\)\s*;?/g,Xt=/([$\w]+)\.push\(([$\w]+)\("top"\)\),/g,Zt=/,([$\w]+)\.push\(([$\w]+)\("bottom"\)\),/g,Qt=/([$\w]+)\.push\(\s*([$\w]+)\(\s*"top"\s*\)\s*\)\s*,\s*/g,$t=/,\s*([$\w]+)\.push\(\s*([$\w]+)\(\s*"bottom"\s*\)\s*\)\s*,/g;function en(e){let t=e,n=!1,r=t;t=t.replace(Jt,`$1.push(...$2($3,!1))`),t!==r&&(n=!0);let i=t;return t=t.replace(Yt,`$1.push(...$2($3,!1))`),t!==i&&(n=!0),{result:t,success:n}}function tn(e){let t=e,n=!1,r=t;t=t.replace(Xt,``),t!==r&&(n=!0);let i=t;t=t.replace(Qt,``),t!==i&&(n=!0);let a=t;t=t.replace(Zt,`,`),t!==a&&(n=!0);let o=t;return t=t.replace($t,`,`),t!==o&&(n=!0),{result:t,success:n}}const nn=(e,t)=>{if(t===`default`)return W(`Table format is "default", no patching needed`),null;let n=e,r=0;if(t===`ascii`){if(M.test(n)){let e=n;n=n.replace(M,`{top:["","","",""],middle:["|","-","|","|"],bottom:["","","",""]}`),n!==e&&(r++,W(`Patched table border definition object (minified format)`))}else if(N.test(n)){let e=n;n=n.replace(N,`top:["","","",""],middle:["|","-","|","|"],bottom:["","","",""]`),n!==e&&(r++,W(`Patched table border definition object (native Unicode format)`))}else if(P.test(n)){let e=n;n=n.replace(P,`top: ["", "", "", ""],
|
|
414
|
+
middle: ["|", "-", "|", "|"],bottom: ["", "", "", ""]`),n!==e&&(r++,W(`Patched table border definition object (spaced format)`))}else G(`Could not find table border definition pattern - CLI may have changed`);{let e=n;n=n.replace(/let\s+([$\w]+)\s*=\s*"\\u2502";/g,`let $1="|";`),n=n.replace(/" \\u2502"/g,`" |"`),n=n.replace(/"\\u2502"/g,`"|"`),n=n.replace(/let\s+([$\w]+)\s*=\s*"│";/g,`let $1 = "|";`),n=n.replace(/"\s*│"/g,`" |"`),n!==e&&(r++,W(`Patched vertical border characters`))}{let e=n;n=n.replace(/"─"\.repeat\(/g,`"-".repeat(`),n=n.replace(/"\\u2500"\.repeat\(/g,`"-".repeat(`),n!==e&&(r++,W(`Patched horizontal separator characters`))}{let{result:e,success:t}=en(n);t&&(n=e,r++,W(`Removed inter-row separators`))}{let{result:e,success:t}=tn(n);t&&(n=e,r++,W(`Removed top/bottom border pushes`))}}else if(t===`clean`){if(M.test(n)){let e=n;n=n.replace(M,`{top:["","","",""],middle:["├","─","┼","┤"],bottom:["","","",""]}`),n!==e&&(r++,W(`Patched table border definition for clean format (minified format)`))}else if(N.test(n)){let e=n;n=n.replace(N,`top:["","","",""],middle:["\\u251C","\\u2500","\\u253C","\\u2524"],bottom:["","","",""]`),n!==e&&(r++,W(`Patched table border definition for clean format (native Unicode format)`))}else if(P.test(n)){let e=n;n=n.replace(P,`top: ["", "", "", ""],
|
|
415
|
+
middle: ["├", "─", "┼", "┤"],
|
|
416
|
+
bottom: ["", "", "", ""]`),n!==e&&(r++,W(`Patched table border definition for clean format (spaced format)`))}else G(`Could not find table border definition pattern - CLI may have changed`);{let{result:e,success:t}=en(n);t&&(n=e,r++,W(`Removed inter-row separators`))}{let{result:e,success:t}=tn(n);t&&(n=e,r++,W(`Removed top/bottom border pushes`))}}else if(t===`clean-top-bottom`){let{result:e,success:t}=en(n);t&&(n=e,r++,W(`Removed inter-row separators (keeping top/bottom borders)`))}else return W(`Unknown table format "${t}", skipping`),null;if(r===0)return G(`No table format patches were applied - patterns may not have matched`),null;W(`[Table format patch: ${r} modifications for ${t} style]`);let i=rn(e,n);if(i!==-1){let{oldEnd:t,newEnd:r}=an(e,n,i),a=n.slice(i,r);F(e,n,a,i,t)}return W(`Table format patch applied: ${r} changes, file size ${e.length} -> ${n.length}`),n};function rn(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return e.length===t.length?-1:n}function an(e,t,n){let r=e.length-1,i=t.length-1;for(;r>=n&&i>=n&&e[r]===t[i];)r--,i--;return{oldEnd:r+1,newEnd:i+1}}const on=e=>B(e)?jt(e,`, {
|
|
417
|
+
type: "local",
|
|
418
|
+
name: "title",
|
|
419
|
+
description: "Set the conversation title",
|
|
420
|
+
isEnabled: () => !0,
|
|
421
|
+
isHidden: !1,
|
|
422
|
+
async call(A, B, I) {
|
|
423
|
+
if (!A)
|
|
424
|
+
throw new Error("Please specify a conversation title.");
|
|
425
|
+
CUR_CONVERSATION_TITLE = A;
|
|
426
|
+
setTerminalTitleOverride(A);
|
|
427
|
+
return {
|
|
428
|
+
type: "text",
|
|
429
|
+
value: \`Conversation title set to \\x1b[1m\${A}\\x1b[0m\`,
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
userFacingName() {
|
|
433
|
+
return "title";
|
|
434
|
+
},
|
|
435
|
+
}`):(console.error(`patch: conversationTitle: failed to find React variable`),null),sn=e=>{let t=e.match(/class ([$\w]+)\{summaries;(?:customTitles;)?messages;(?:checkpoints;)?fileHistorySnapshots;/);return!t||t.index===void 0?(console.error(`patch: conversationTitle: findCustomNamingFunctionsLocation: failed to find class pattern`),null):t.index},cn=e=>{let t=sn(e);if(t===null)return console.error(`patch: conversationTitle: failed to find custom naming functions location`),null;let n=rr(e),r=`
|
|
436
|
+
function getTweakccBaseDir() {
|
|
437
|
+
const { join: pathJoin } = ${n}('path');
|
|
438
|
+
const { homedir: osHomedir } = ${n}('os');
|
|
439
|
+
const { statSync: fsStatSync, mkdirSync: fsMkdirSync } = ${n}('fs');
|
|
440
|
+
// Prioritize ~/.tweakcc which is the original and default. Only respect
|
|
441
|
+
// XDG_CONFIG_HOME if it doesn't exist.
|
|
442
|
+
let dir;
|
|
443
|
+
let homedirTweakcc = pathJoin(osHomedir(), ".tweakcc");
|
|
444
|
+
try {
|
|
445
|
+
if (fsStatSync(homedirTweakcc).isDirectory()) {
|
|
446
|
+
dir = homedirTweakcc;
|
|
447
|
+
}
|
|
448
|
+
} catch (e) {
|
|
449
|
+
if (e.code == "ENOENT") {
|
|
450
|
+
// Doesn't exist. Move on and see if the XDG one exists.
|
|
451
|
+
} else {
|
|
452
|
+
throw new Error('cannot stat ' + homedirTweakcc + ': ' + e);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
// Try XDG.
|
|
457
|
+
if (process.env.XDG_CONFIG_HOME) {
|
|
458
|
+
// XDG_CONFIG_HOME is set. If it's set and ~/.tweakcc doesn't exist, prefer it.
|
|
459
|
+
const xdgTweakcc = pathJoin(process.env.XDG_CONFIG_HOME, "tweakcc");
|
|
460
|
+
dir = xdgTweakcc;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// Create the dir.
|
|
464
|
+
fsMkdirSync(dir, { recursive: true });
|
|
465
|
+
return dir;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
const findSummaryEntryForLeafUuid = (filePath, messageUuid) => {
|
|
469
|
+
const { readFileSync: fsReadFileSync, statSync: fsStatSync } = ${n}('fs');
|
|
470
|
+
// Optimization: skip files that are certain to not be tweakcc summary files (which only contain 1 small line).
|
|
471
|
+
if (fsStatSync(filePath).size > 1000) {
|
|
472
|
+
return null;
|
|
473
|
+
}
|
|
474
|
+
const lines = fsReadFileSync(filePath, "utf8")
|
|
475
|
+
.split("\\n")
|
|
476
|
+
.map((l) => JSON.parse(l.trim()));
|
|
477
|
+
for (const line of lines) {
|
|
478
|
+
if (line.type == "summary" && line.uuid == messageUuid) {
|
|
479
|
+
return line;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
return null;
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
const getSummaryFileForLeafMessage = (
|
|
486
|
+
projectDirectory,
|
|
487
|
+
projectSlug,
|
|
488
|
+
messageUuid
|
|
489
|
+
) => {
|
|
490
|
+
const { join: pathJoin } = ${n}('path');
|
|
491
|
+
const { readFileSync: fsReadFileSync, readdirSync: fsReaddirSync } = ${n}('fs');
|
|
492
|
+
try {
|
|
493
|
+
// File contains the uuid
|
|
494
|
+
const summaryFileId = fsReadFileSync(
|
|
495
|
+
pathJoin(getTweakccBaseDir(), "named-sessions", projectSlug, messageUuid),
|
|
496
|
+
"utf8"
|
|
497
|
+
).trim();
|
|
498
|
+
return pathJoin(projectDirectory, summaryFileId + '.jsonl');
|
|
499
|
+
} catch (e) {
|
|
500
|
+
// File not found or can't be accessed, etc. Ignore.
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
// Just read each file and try to find it.
|
|
504
|
+
for (const file of fsReaddirSync(projectDirectory)) {
|
|
505
|
+
try {
|
|
506
|
+
const pth = pathJoin(projectDirectory, file);
|
|
507
|
+
const summaryObj = findSummaryEntryForLeafUuid(pth);
|
|
508
|
+
if (summaryObj != null && summaryObj.tweakcc != null) {
|
|
509
|
+
// It needs to be a tweakcc one.
|
|
510
|
+
return pth;
|
|
511
|
+
}
|
|
512
|
+
} catch {}
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
// It doesn't exist.
|
|
516
|
+
return null;
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
const setTerminalTitleOverride = (title) => {
|
|
520
|
+
process.env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE = 1;
|
|
521
|
+
if (process.platform === "win32") process.title = 'Claude: ' + title;
|
|
522
|
+
else process.stdout.write('\\x1B]0;Claude: ' + title + '\\x07');
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
let CUR_CONVERSATION_TITLE = "";
|
|
526
|
+
function onNewMessage(projectDir, projectSlug, msg) {
|
|
527
|
+
const { join: pathJoin } = ${n}('path');
|
|
528
|
+
const { readFileSync: fsReadFileSync, writeFileSync: fsWriteFileSync, mkdirSync: fsMkdirSync, renameSync: fsRenameSync } = ${n}('fs');
|
|
529
|
+
const { randomUUID: cryptoRandomUUID } = ${n}('crypto');
|
|
530
|
+
const tweakcc = getTweakccBaseDir();
|
|
531
|
+
|
|
532
|
+
if (msg.parentUuid) {
|
|
533
|
+
const path = getSummaryFileForLeafMessage(
|
|
534
|
+
projectDir,
|
|
535
|
+
projectSlug,
|
|
536
|
+
msg.parentUuid
|
|
537
|
+
);
|
|
538
|
+
if (path) {
|
|
539
|
+
// There's an old file. Update it to the new file.
|
|
540
|
+
const summaryObj = findSummaryEntryForLeafUuid(path);
|
|
541
|
+
summaryObj.leafUuid = msg.uuid;
|
|
542
|
+
if (CUR_CONVERSATION_TITLE != "") {
|
|
543
|
+
summaryObj.summary = CUR_CONVERSATION_TITLE;
|
|
544
|
+
} else {
|
|
545
|
+
CUR_CONVERSATION_TITLE = summaryObj.summary;
|
|
546
|
+
}
|
|
547
|
+
setTerminalTitleOverride(CUR_CONVERSATION_TITLE);
|
|
548
|
+
fsWriteFileSync(path, JSON.stringify(summaryObj));
|
|
549
|
+
|
|
550
|
+
// Update the cache; it points from message ID to summary file ID.
|
|
551
|
+
fsMkdirSync(pathJoin(tweakcc, "named-sessions", projectSlug), {
|
|
552
|
+
recursive: true,
|
|
553
|
+
});
|
|
554
|
+
const oldPath = pathJoin(
|
|
555
|
+
tweakcc,
|
|
556
|
+
"named-sessions",
|
|
557
|
+
projectSlug,
|
|
558
|
+
msg.parentUuid
|
|
559
|
+
);
|
|
560
|
+
const newPath = pathJoin(
|
|
561
|
+
tweakcc,
|
|
562
|
+
"named-sessions",
|
|
563
|
+
projectSlug,
|
|
564
|
+
msg.uuid
|
|
565
|
+
);
|
|
566
|
+
try {
|
|
567
|
+
fsRenameSync(oldPath, newPath);
|
|
568
|
+
return;
|
|
569
|
+
} catch (e) {
|
|
570
|
+
if (e.code == "ENOENT") {
|
|
571
|
+
// named-sessions/{projectSlug} exists, so the error is because the old named-session doesn't exist.
|
|
572
|
+
// So we need to create the new file later.
|
|
573
|
+
// DO NOT return.
|
|
574
|
+
} else {
|
|
575
|
+
throw new Error('cannot rename ' + oldPath + ' -> ' + newPath + ': ' + e);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
// Only create our summary entry if a custom title has been set. Because we want the auto
|
|
582
|
+
// title generation to kick in if the user hasn't set a title, and the auto title generation
|
|
583
|
+
// won't generate titles for sessions older than the most recently
|
|
584
|
+
if (CUR_CONVERSATION_TITLE != "") {
|
|
585
|
+
setTerminalTitleOverride(CUR_CONVERSATION_TITLE);
|
|
586
|
+
const uuid = cryptoRandomUUID();
|
|
587
|
+
|
|
588
|
+
// Create the summary file.
|
|
589
|
+
const newFilePath = pathJoin(projectDir, uuid + '.jsonl');
|
|
590
|
+
const summaryObj = {
|
|
591
|
+
type: "summary",
|
|
592
|
+
summary: CUR_CONVERSATION_TITLE,
|
|
593
|
+
leafUuid: msg.uuid,
|
|
594
|
+
// This is important.
|
|
595
|
+
tweakcc: null,
|
|
596
|
+
};
|
|
597
|
+
fsWriteFileSync(newFilePath, JSON.stringify(summaryObj));
|
|
598
|
+
|
|
599
|
+
fsMkdirSync(pathJoin(tweakcc, "named-sessions", projectSlug), {
|
|
600
|
+
recursive: true,
|
|
601
|
+
});
|
|
602
|
+
fsWriteFileSync(
|
|
603
|
+
pathJoin(tweakcc, "named-sessions", projectSlug, msg.uuid),
|
|
604
|
+
uuid
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
`,i=e.slice(0,t)+r+e.slice(t);return F(e,i,r,t,t),i},ln=e=>{let t=e.match(/(if\(![$\w]+\.has\(([$\w]+)\.uuid\)\)\{)if\([$\w]+\.appendFileSync\(/);return!t||t.index===void 0?(console.error(`patch: conversationTitle: findAppendEntryInterceptorLocation: failed to find pattern`),null):{location:t.index+t[1].length,messageVar:t[2]}},un=e=>{let t=ln(e);if(!t)return console.error(`patch: conversationTitle: failed to find append entry interceptor location`),null;let n=rr(e),{location:r,messageVar:i}=t,a=`const { dirname: pathDirname, basename: pathBasename } = ${n}('path');
|
|
610
|
+
const projectDir = pathDirname(this.sessionFile);
|
|
611
|
+
const projectSlug = pathBasename(projectDir);
|
|
612
|
+
onNewMessage(projectDir, projectSlug, ${i});
|
|
613
|
+
`,o=e.slice(0,r)+a+e.slice(r);return F(e,o,a,r,r),o},dn=e=>{let t=e.match(/if\([$\w]+\.has\(([$\w]+)\.uuid\)\)continue;/);if(!t||t.index===void 0)return console.error(`patch: conversationTitle: findTweakccSummaryCheckLocations: failed to find continue pattern`),null;let n=t[1],r=t.index+t[0].length-10,i=Math.max(0,t.index-200),a=e.substring(i,t.index).match(/for\(let [$\w]+ of ([$\w]+)\)try/);if(!a)return console.error(`patch: conversationTitle: findTweakccSummaryCheckLocations: failed to find loop pattern`),null;let o=a[1];return{orLocation:r,loopLocation:i+(a.index??0),messageVar:n,fileListVar:o}},fn=e=>{let t=dn(e);if(!t)return console.error(`patch: conversationTitle: failed to find tweakcc summary check locations`),null;let n=rr(e),{orLocation:r,loopLocation:i,messageVar:a,fileListVar:o}=t,s=e,c=`const { readFileSync: fsReadFileSync } = ${n}('fs');
|
|
614
|
+
const tweakccSummaries = new Set();
|
|
615
|
+
for (const file of ${o}) {
|
|
616
|
+
const contents = fsReadFileSync(file, "utf8").trim();
|
|
617
|
+
if (contents.includes("\\n")) continue;
|
|
618
|
+
let obj;
|
|
619
|
+
try {
|
|
620
|
+
obj = JSON.parse(contents);
|
|
621
|
+
} catch {
|
|
622
|
+
// Skip invalid files.
|
|
623
|
+
continue;
|
|
624
|
+
}
|
|
625
|
+
if (obj.type != "summary" || !obj.hasOwnProperty("tweakcc")) continue;
|
|
626
|
+
tweakccSummaries.add(obj.leafUuid);
|
|
627
|
+
}
|
|
628
|
+
`;s=s.slice(0,i)+c+s.slice(i),F(e,s,c,i,i);let l=r+c.length,u=`||tweakccSummaries.has(${a}.uuid)`,d=s.slice(0,l)+u+s.slice(l);return F(s,d,u,l,l),d},pn=e=>{let t=e.match(/description:"Rename the current conversation",isEnabled:\(\)=>!1,/);if(!t)return console.error(`patch: conversationTitle: enableRenameConversationCommand: failed to find pattern`),null;if(t.index===void 0)return console.error(`patch: conversationTitle: enableRenameConversationCommand: match.index is undefined`),null;let n=`description:"Rename the current conversation",isEnabled:()=>!0,`,r=e.replace(`description:"Rename the current conversation",isEnabled:()=>!1,`,n);return r===e?(console.error(`patch: conversationTitle: enableRenameConversationCommand: replacement failed`),null):(F(e,r,n,t.index,t.index+63),r)},mn=e=>{let t=e;if(t=on(t),!t)return console.error(`patch: conversationTitle: step 1 failed (writeTitleSlashCommand)`),null;if(t=cn(t),!t)return console.error(`patch: conversationTitle: step 2 failed (writeCustomNamingFunctions)`),null;if(t=un(t),!t)return console.error(`patch: conversationTitle: step 3 failed (writeAppendEntryInterceptor)`),null;if(t=fn(t),!t)return console.error(`patch: conversationTitle: step 4 failed (writeTweakccSummaryCheck)`),null;let n=pn(t);return n?t=n:console.log(`patch: conversationTitle: step 5 failed (enableRenameConversationCommand)`),t},hn=e=>{let t=e.match(/,[$\w]+\.createElement\([$\w]+,\{isBeforeFirstMessage:!1\}\),/);return!t||t.index===void 0?(console.error(`patch: hideStartupBanner: failed to find startup banner createElement`),null):{startIndex:t.index,endIndex:t.index+t[0].length}},gn=e=>{let t=hn(e);if(!t)return null;let n=e.slice(0,t.startIndex)+`,`+e.slice(t.endIndex);return F(e,n,`,`,t.startIndex,t.endIndex),n},_n=e=>{let t=e.match(/if\(([$\w]+&&[$\w]+)\)[$\w]+\("tengu_external_editor_hint_shown",/);if(!t||t.index===void 0)return console.error(`patch: hideCtrlGToEdit: failed to find tengu_external_editor_hint_shown pattern`),null;let n=t[1],r=t.index+3;return{startIndex:r,endIndex:r+n.length,identifiers:[]}},vn=e=>{let t=_n(e);if(!t)return null;let n=`false`,r=e.slice(0,t.startIndex)+n+e.slice(t.endIndex);return F(e,r,n,t.startIndex,t.endIndex),r},yn=e=>{let t=[],n=/▛███▜|\\u259B\\u2588\\u2588\\u2588\\u259C/gi,r;for(;(r=n.exec(e))!==null;){let n=r.index,i=Math.max(0,n-2e3),a=e.slice(i,n),o=/function [$\w]+\(\)\{/g,s=null,c;for(;(c=o.exec(a))!==null;)s=c;if(s){let e=i+s.index+s[0].length;t.push(e)}else console.error(`patch: hideStartupClawd: failed to find function pattern before Clawd at position ${n}`)}return t},bn=e=>{let t=yn(e);if(t.length===0)return console.error(`patch: hideStartupClawd: no Clawd components found`),null;let n=[...t].sort((e,t)=>t-e),r=`return null;`,i=e;for(let e of n)i=i.slice(0,e)+r+i.slice(e);if(n.length>0){let t=n[n.length-1];F(e,i,r,t,t)}return i},xn=e=>{let t=e.match(/=25000,([\s\S]{0,100})<system-reminder>/);if(!t||t.index===void 0)return console.error(`patch: increaseFileReadLimit: failed to find 25000 token limit near system-reminder`),null;let n=t.index+1;return{startIndex:n,endIndex:n+5}},Sn=e=>{let t=xn(e);if(!t)return null;let n=`1000000`,r=e.slice(0,t.startIndex)+n+e.slice(t.endIndex);return F(e,r,n,t.startIndex,t.endIndex),r},Cn=e=>{let t=e.match(/if\(([$\w]+)\.length>=\d+\)return`\$\{\1\}(?:→|\\u2192)\$\{([$\w]+)\}`;return`\$\{\1\.padStart\(\d+," "\)\}(?:→|\\u2192)\$\{\2\}`/);return!t||t.index===void 0?(console.error(`patch: suppressLineNumbers: failed to find line number formatter pattern`),null):{startIndex:t.index,endIndex:t.index+t[0].length,identifiers:[t[1],t[2]]}},wn=e=>{let t=Cn(e);if(!t)return null;let n=t.identifiers?.[1];if(!n)return console.error(`patch: suppressLineNumbers: content variable not captured`),null;let r=`return ${n}`,i=e.slice(0,t.startIndex)+r+e.slice(t.endIndex);return F(e,i,r,t.startIndex,t.endIndex),i},Tn=e=>{let t=e.match(/\.createElement.{0,500},showAllInTranscript:[$\w]+,agentDefinitions:[$\w]+,onOpenRateLimitOptions:([$\w]+)/);if(!t||t.index===void 0)return console.error(`patch: suppressRateLimitOptions: failed to find onOpenRateLimitOptions pattern`),null;let n=t[1],r=t.index+t[0].length-n.length,i=r+n.length,a=`()=>{}`,o=e.slice(0,r)+a+e.slice(i);return F(e,o,a,r,i),o},En=e=>{let t=e.match(/function [$\w]+\(\)\{return [$\w]+\("tengu_session_memory"/);if(!t||t.index===void 0)return console.error(`patch: sessionMemory: failed to find extraction gate`),null;let n=t.index+t[0].indexOf(`{`)+1,r=`return true;`,i=e.slice(0,n)+r+e.slice(n);return F(e,i,r,n,n),i},Dn=e=>{let t=e.match(/if\([$\w]+\("tengu_coral_fern",!1\)\)\{/);if(t&&t.index!==void 0){let n=`if(true){`,r=e.slice(0,t.index)+n+e.slice(t.index+t[0].length);return F(e,r,n,t.index,t.index+t[0].length),r}let n=e.match(/if\(![$\w]+\("tengu_coral_fern",!1\)\)return null;/);if(n&&n.index!==void 0){let t=e.slice(0,n.index)+e.slice(n.index+n[0].length);return F(e,t,``,n.index,n.index+n[0].length),t}return console.error(`patch: sessionMemory: failed to find past sessions gate`),null},On=e=>{let t=e.match(/(=)2000((?:.|\n){0,15}?=)12000((?:.|\n){0,20}# Session Title)/);if(!t||t.index===void 0)return console.error(`patch: sessionMemory: failed to find token limits pattern`),null;let n=t[1]+`Number(process.env.CC_SM_PER_SECTION_TOKENS??2000)`+t[2]+`Number(process.env.CM_SM_TOTAL_FILE_LIMIT??12000)`+t[3],r=t.index,i=r+t[0].length,a=e.slice(0,r)+n+e.slice(i);return F(e,a,n,r,i),a},kn=e=>{let t=e;return t=I(t,/minimumMessageTokensToInit:1e4\b/g,`minimumMessageTokensToInit:Number(process.env.CC_SM_MINIMUM_MESSAGE_TOKENS_TO_INIT??1e4)`),t=I(t,/minimumTokensBetweenUpdate:5000\b/g,`minimumTokensBetweenUpdate:Number(process.env.CC_SM_MINIMUM_TOKENS_BETWEEN_UPDATE??5000)`),t=I(t,/toolCallsBetweenUpdates:3\b/g,`toolCallsBetweenUpdates:Number(process.env.CC_SM_TOOL_CALLS_BETWEEN_UPDATES??3)`),t===e?(console.error(`patch: sessionMemory: failed to find update thresholds patterns`),null):t},An=e=>{let t=En(e);return!t||(t=Dn(t),!t)||(t=On(t),!t)?null:(t=kn(t),t)},jn=e=>{let t=e.match(/\{([$\w]+)\(\{name:"claude-in-chrome"/);return t?t[1]:(console.error(`patch: rememberSkill: failed to find skill registration function`),null)},Mn=e=>{let t=jn(e);if(!t)return null;let n=e.match(/(function ([$\w]+)\(.{0,500}\}function [$\w]+\(\)\{)return(\}.{0,10}[, ]([$\w]+)=`# Remember Skill)/);if(!n||n.index===void 0)return console.error(`patch: rememberSkill: failed to find injection point pattern`),null;let[r,i,a,o,s]=n,c=i+`
|
|
629
|
+
${t}({
|
|
630
|
+
name: "remember",
|
|
631
|
+
description: "Review session memories and update CLAUDE.local.md with learnings",
|
|
632
|
+
whenToUse: "When the user wants to save learnings from past sessions",
|
|
633
|
+
userInvocable: true,
|
|
634
|
+
isEnabled: () => true,
|
|
635
|
+
async getPromptForCommand(A) {
|
|
636
|
+
let content = ${s};
|
|
637
|
+
let sessionMemFiles = ${a}(null);
|
|
638
|
+
content += "\\n\\n## Session Memory Files to Review\\n\\n" + (sessionMemFiles.length ? sessionMemFiles.join("\\n") : "None found");
|
|
639
|
+
if (A) content += "\\n\\n## User Arguments\\n\\n" + A;
|
|
640
|
+
return [{ type: "text", text: content }];
|
|
641
|
+
},
|
|
642
|
+
});
|
|
643
|
+
return`+o,l=n.index,u=l+r.length,d=e.slice(0,l)+c+e.slice(u);return F(e,d,c,l,u),d},Nn=e=>{let t=V(e);if(!t)return console.error(`patch: thinkingBlockStyling: failed to find Text component`),null;let n=e.match(/\{thinking:([$\w]+)\}.{0,400}(?:∴|\\u2234) Thinking.{0,700}(?:…|\\u2026).{0,200}\b[$\w]+(?:\.default)?\.createElement\(([$\w]+,null),\1\)/);if(!n||n.index===void 0)return console.error(`patch: thinkingBlockStyling: failed to find thinking label pattern`),null;let r=n[0].replace(n[2],`${t},{dimColor:true,italic:true}`),i=n.index,a=i+n[0].length,o=e.slice(0,i)+r+e.slice(a);return F(e,o,r,i,a),o},Pn=e=>{let t=e.match(/![$\w]+\(process\.env\.MCP_CONNECTION_NONBLOCKING\)/);return!t||t.index===void 0?(console.error(`patch: mcpStartup: failed to find MCP_CONNECTION_NONBLOCKING check`),null):{startIndex:t.index,endIndex:t.index+t[0].length}},Fn=e=>{let t=e.match(/MCP_SERVER_CONNECTION_BATCH_SIZE\|\|"",10\)\|\|(\d+)/);if(!t||t.index===void 0)return console.error(`patch: mcpStartup: failed to find MCP_SERVER_CONNECTION_BATCH_SIZE default`),null;let n=t[0],r=t[1],i=n.lastIndexOf(r),a=t.index+i;return{startIndex:a,endIndex:a+r.length}},In=e=>{let t=Pn(e);if(!t)return null;let n=`false`,r=e.slice(0,t.startIndex)+n+e.slice(t.endIndex);return F(e,r,n,t.startIndex,t.endIndex),r},Ln=(e,t)=>{let n=Fn(e);if(!n)return null;let r=String(t),i=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return F(e,i,r,n.startIndex,n.endIndex),i},Rn=(e,t=300,n=!1)=>{let r=e.match(/(,([$\w]+)=([$\w]+(?:\.default)?)\.useCallback.{0,1000}statusLineText.{0,200}?),([$\w]+)=([$\w.]+\(\(\)=>(\2\(([$\w]+)\)),300\)|[$\w]+\(\2,300\)|.{0,100}\{[$\w]+\.current=void 0,\2\(\)\},300\)\},\[\2\]\))/);if(!r||r.index===void 0)return console.error(`patch: statuslineUpdateThrottle: failed to find statusline update throttle pattern`),null;let i=r[1],a=r[2],o=r[3],s=r[4],c=r[6]??`${a}()`,l=r[7],u=l?`${a}, ${l}`:a,d=a,f;f=n?l?i+`,argRef=${o}.useRef(${l}),unused1=${o}.useEffect(()=>{argRef.current=${l};},[${l}]),unused2=${o}.useEffect(()=>{const id=setInterval(()=>${a}(argRef.current),${t});return()=>clearInterval(id);},[${d}]),${s}=${o}.useCallback(()=>{},[])`:i+`,unused1=${o}.useEffect(()=>{const id=setInterval(()=>${c},${t});return()=>clearInterval(id);},[${d}]),${s}=${o}.useCallback(()=>{},[])`:i+`,lastCall=${o}.useRef(0),${s}=${o}.useCallback(()=>{let now=Date.now();if(now-lastCall.current>=${t}){lastCall.current=now;${c};}},[${u}])`;let p=r.index,m=p+r[0].length,h=e.slice(0,p)+f+e.slice(m);return F(e,h,f,p,m),h},zn=(e,t)=>{let n,r,i,a,o,s=e.match(/(overrideMessage:.{0,10000},([$\w]+)=[$\w]+\()(.+?)(\),.{0,1000}key:"tokens".{0,200},\2," tokens")/);if(s&&s.index!==void 0)[n,r,,i,a]=s,o=s.index;else{let t=e.match(/(overrideMessage:.{0,10000},key:"tokens".{0,200}[$\w]+\()(Math\.round\(.+?\))(\))/);if(t&&t.index!==void 0)[n,r,i,a]=t,o=t.index;else return console.error(`patch: tokenCountRounding: cannot find token count pattern in either newer or older CC format`),null}let c=`${r}Math.round((${i})/${t})*${t}${a}`,l=o+n.length,u=e.slice(0,o)+c+e.slice(l);return F(e,u,c,o,l),u},Bn=(e,t)=>{let n=e.match(/function ([$\w]+)\(([$\w]+),([$\w]+)\)(?:.|\n){0,500}Skipping non-text file in @include(?:.|\n){0,500}\{path:[$\w]+,.{0,20}?content:[$\w]+/);if(!n||n.index===void 0)return console.error(`patch: agentsMd: failed to find CLAUDE.md reading function`),null;let r=n[1],i=n[2],a=n[3],o=n.index,s=n[0].match(/([$\w]+(?:\(\))?)\.(?:readFileSync|existsSync|statSync)/);if(!s)return console.error(`patch: agentsMd: failed to find fs expression in function`),null;let c=s[1],l=JSON.stringify(t),u=()=>`if(${i}.endsWith("/CLAUDE.md")||${i}.endsWith("\\\\CLAUDE.md")){for(let alt of ${l}){let altPath=${i}.slice(0,-9)+alt;if(${c}.existsSync(altPath)&&${c}.statSync(altPath).isFile())return ${r}(altPath,${a});}}return null;`,d=e.slice(o).match(/(if\(![$\w]+\.existsSync\([$\w]+\)\|\|![$\w]+\.statSync\([$\w]+\)\.isFile\(\)\))return null;/);if(d&&d.index!==void 0){let t=u(),n=d[1]+`{`+t+`}`,r=o+d.index,i=r+d[0].length,a=e.slice(0,r)+n+e.slice(i);return F(e,a,n,r,i),a}let f=e.slice(o).match(/(\})(}catch)/);if(f&&f.index!==void 0){let t=`else if(${i}.endsWith("/CLAUDE.md")||${i}.endsWith("\\\\CLAUDE.md")){for(let alt of ${l}){let altPath=${i}.slice(0,-9)+alt;if(${c}.existsSync(altPath)&&${c}.statSync(altPath).isFile())return ${r}(altPath,${a});}}`,n=f[1]+t+f[2],s=o+f.index,u=s+f[0].length,d=e.slice(0,s)+n+e.slice(u);return F(e,d,n,s,u),d}return console.error(`patch: agentsMd: failed to find insertion point in function body`),null},Vn=e=>{let t=e.indexOf(`title:"Ready to code?"`);if(t===-1)return console.error(`patch: autoAcceptPlanMode: failed to find "Ready to code?" title`),null;let n=e.slice(t,t+3e3).match(/onChange:\([$\w]+\)=>([$\w]+)\([$\w]+\),onCancel/);if(!n)return console.error(`patch: autoAcceptPlanMode: failed to find onChange handler`),null;let r=n[1];if(RegExp(`[$\\w]+\\("yes-accept-edits"\\);return null;return`).test(e))return e;let i=e.match(/(\}\}\)\)\)\);)(return [$\w]+\.default\.createElement\([$\w]+\.default\.Fragment,null,[$\w]+\.default\.createElement\([$\w]+,\{color:"planMode",title:"Ready to code\?")/);if(!i||i.index===void 0)return console.error(`patch: autoAcceptPlanMode: failed to find "Ready to code?" return pattern`),null;let a=`${r}("yes-accept-edits");return null;`,o=i[1]+a+i[2],s=i.index,c=s+i[0].length,l=e.slice(0,s)+o+e.slice(c);return F(e,l,o,s,c),l},Hn=e=>{let t=e.match(/console\.error\("--dangerously-skip-permissions cannot be used with root\/sudo privileges for security reasons"\),process\.exit\(1\)/);if(!t||t.index===void 0)return console.error(`patch: allowBypassPermsInSudo: failed to find pattern`),null;let n=t.index,r=n+t[0].length,i=e.slice(0,n)+`{}`+e.slice(r);return F(e,i,`{}`,n,r),i},Un=e=>{let t=e.match(/Claude Code has switched from npm to native installer\. Run `claude install` or see https:\/\/docs\.anthropic\.com\/en\/docs\/claude-code\/getting-started for more options\./);if(!t||t.index===void 0)return console.warn(`patch: suppressNativeInstallerWarning: failed to find pattern`),null;let n=t.index,r=n+t[0].length,i=e.slice(0,n)+e.slice(r);return F(e,i,``,n,r),i},Wn=e=>{let t=e.split(`
|
|
644
|
+
`),n=0;for(let e=0;e<t.length;e++){let r=t[e];if(!r.startsWith(`#!`)&&!(r.startsWith(`//`)&&(r.includes(`Version`)||r.includes(`(c)`)))&&!(r.trim()===``&&e<5)){n=e;break}}return n>0?t.slice(0,n).join(`
|
|
645
|
+
`).length:0},Gn=e=>{let t=Wn(e),n=`// SCROLLING FIX PATCH START
|
|
646
|
+
const _origStdoutWrite=process.stdout.write;
|
|
647
|
+
process.stdout.write=function(chunk,encoding,cb){
|
|
648
|
+
if(typeof chunk!=='string'){
|
|
649
|
+
return _origStdoutWrite.call(process.stdout,chunk,encoding,cb);
|
|
650
|
+
}
|
|
651
|
+
const filtered=chunk
|
|
652
|
+
.replace(/\\x1b\\[(?:\\d+;?\\d*)?H/g,'')
|
|
653
|
+
.replace(/\\x1b\\[\\d*A/g,'');
|
|
654
|
+
return _origStdoutWrite.call(process.stdout,filtered,encoding,cb);
|
|
655
|
+
};
|
|
656
|
+
// SCROLLING FIX PATCH END
|
|
657
|
+
`,r=e.slice(0,t)+n+e.slice(t);return F(e,r,n,t,t),r},Kn=e=>{let t=e.match(/function [$\w]+\(\)\{return [$\w]+\("tengu_worktree_mode"/);if(!t||t.index===void 0)return console.error(`patch: worktreeMode: failed to find worktree gate function pattern`),null;let n=t.index+t[0].indexOf(`{`)+1,r=`return !0;`,i=e.slice(0,n)+r+e.slice(n);return F(e,i,r,n,n),i},qn=async e=>{if(!e.cliPath){W(`backupClijs: Skipping for native installation (no cliPath)`);return}await Z(),W(`Backing up cli.js to ${Vr}`),await i.copyFile(e.cliPath,Vr),await $(t=>{t.changesApplied=!1,t.ccVersion=e.version})},Jn=async e=>{e.nativeInstallationPath&&(await Z(),W(`Backing up native binary to ${Y}`),await i.copyFile(e.nativeInstallationPath,Y),await $(t=>{t.changesApplied=!1,t.ccVersion=e.version}))},Yn=async e=>{if(!e.cliPath)return W(`restoreClijsFromBackup: Skipping for native installation (no cliPath)`),!1;W(`Restoring cli.js from backup to ${e.cliPath}`);let t=await i.readFile(Vr);return await Mr(e.cliPath,t,`restore`),await $e(),await $(e=>{e.changesApplied=!1}),!0},Xn=async e=>{if(!e.nativeInstallationPath)return W(`restoreNativeBinaryFromBackup: No native installation path, skipping`),!1;if(!await Nr(Y))return W(`restoreNativeBinaryFromBackup: No backup file exists, skipping`),!1;W(`Restoring native binary from backup to ${e.nativeInstallationPath}`);let t=await i.readFile(Y);return await Mr(e.nativeInstallationPath,t,`restore`),!0},Zn=e=>e.replace(/\\u([0-9a-fA-F]{4})/g,(e,t)=>String.fromCharCode(parseInt(t,16))),F=(t,n,r,i,a,o=40)=>{if(!vr())return;let s=Math.max(0,i-o),c=Math.min(t.length,a+o),l=Math.min(n.length,i+r.length+o),u=t.slice(s,c),d=n.slice(s,l),f=Zn(u),p=Zn(d);if(f===p){yr()&&(G(`
|
|
658
|
+
--- Diff ---`),G(e.blue(`UNCHANGED: `)+e.dim(f)),G(`--- End Diff ---
|
|
659
|
+
`));return}let m=h(f,p),g=0,_=0,v=-1,y=-1,b=-1,x=-1,S=0,C=0;for(let e of m)e.added?(b===-1&&(b=_,v=g),x=_+e.value.length,y=g,S=g,C=_+e.value.length,_+=e.value.length):e.removed?(v===-1&&(v=g,b=_),y=g+e.value.length,x=_,S=g+e.value.length,C=_,g+=e.value.length):(g+=e.value.length,_+=e.value.length);v===-1&&(v=0),b===-1&&(b=0),y===-1&&(y=f.length),x===-1&&(x=p.length);let w=f.length-S,ee=p.length-C,te=Math.min(w,ee,o),ne=Math.max(0,v-o),re=Math.min(f.length,S+te),ie=Math.max(0,b-o),ae=Math.min(p.length,C+te),oe=h(f.slice(ne,re),p.slice(ie,ae)),T=``;for(let t of oe)if(!t.added)if(t.removed)if(t.value.includes(`
|
|
660
|
+
`)){let n=t.value.split(`
|
|
661
|
+
`);n.forEach((t,r)=>{t&&(T+=e.bgRed.white(t)),r<n.length-1&&(T+=e.bgRed.dim(`\\n`)+`
|
|
662
|
+
`)})}else T+=e.bgRed.white(t.value);else T+=e.dim(t.value);let E=``;for(let t of oe)if(t.added)if(t.value.includes(`
|
|
663
|
+
`)){let n=t.value.split(`
|
|
664
|
+
`);n.forEach((t,r)=>{t&&(E+=e.bgGreen.black(t)),r<n.length-1&&(E+=e.bgGreen.dim(`\\n`)+`
|
|
665
|
+
`)})}else E+=e.bgGreen.black(t.value);else t.removed||(E+=e.dim(t.value));G(`
|
|
666
|
+
--- Diff ---`),G(e.red(`OLD: `)+T),G(e.green(`NEW: `)+E),G(`--- End Diff ---
|
|
667
|
+
`)},I=(e,t,n)=>{let r=[],i=t.global?t:new RegExp(t.source,t.flags+`g`),a;for(;(a=i.exec(e))!==null;)r.push({index:a.index,length:a[0].length});let o=new RegExp(t.source,t.flags.replace(`g`,``)),s=e;for(let e=r.length-1;e>=0;e--){let{index:t,length:i}=r[e],a=s,c=s.slice(t,t+i).replace(o,n);s=s.slice(0,t)+c+s.slice(t+i),F(a,s,c,t,t+i)}return s},L=e=>{let t=Array.from(e.matchAll(/[^$\w]([$\w]+)(?:\.(?:cyan|gray|green|red|yellow|ansi256|bgAnsi256|bgHex|bgRgb|hex|rgb|bold|dim|inverse|italic|strikethrough|underline)\b)+\(/g)),n={};for(let e of t){let t=e[1];n[t]=(n[t]||0)+1}let r,i=0;for(let[e,t]of Object.entries(n))t>i&&(i=t,r=e);return r},Qn=e=>{let t=e.slice(0,2e3).match(/[,;]([$\w]+)=\([$\w]+,[$\w]+,[$\w]+\)=>\{[$\w]+=[$\w]+!=null\?/);if(t)return t[1];let n=e.slice(0,1e3).match(/(?:var |,)([$\w]+)=\([$\w]+,[$\w]+,[$\w]+\)=>\{/);if(n)return n[1];console.log(`patch: getModuleLoaderFunction: failed to find module loader function`)},$n=e=>{let t=e.match(/var ([$\w]+)=[$\w]+\(\([$\w]+\)=>\{var [$\w]+=Symbol\.for\("react\.(transitional\.)?element"\)/);if(!t){console.log(`patch: getReactModuleNameNonBun: failed to find React module name`);return}return t[1]},er=e=>{let t=$n(e);if(!t){console.log(`^ patch: getReactModuleFunctionBun: failed to find React module name (Bun)`);return}let n=RegExp(`var ([$\\w]+)=[$\\w]+\\(\\([$\\w]+,[$\\w]+\\)=>\\{[$\\w]+\\.exports=${U(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 R=null,z=null;const B=e=>{if(R!=null)return R;let t=Qn(e);if(!t){console.log(`^ patch: getReactVar: failed to find moduleLoader`),R=void 0;return}let n=$n(e);if(!n){console.log(`^ patch: getReactVar: failed to find reactModuleVarNonBun`),R=void 0;return}let r=RegExp(`[^$\\w]([$\\w]+)=${U(t)}\\(${U(n)}\\(\\),1\\)`),i=e.match(r);if(i)return R=i[1],R;let a=er(e);if(!a){console.log(`^ patch: getReactVar: failed to find reactModuleFunctionBun`),R=void 0;return}let o=RegExp(`[^$\\w]([$\\w]+)=${U(t)}\\(${U(a)}\\(\\),1\\)`),s=e.match(o);if(!s){console.log(`patch: getReactVar: failed to find bunPattern (moduleLoader=${t}, reactModuleVarNonBun=${n}, reactModuleFunctionBun=${a})`),R=void 0;return}return R=s[1],R},tr=()=>{R=null},nr=e=>{let t=e.match(/import\{createRequire as ([$\w]+)\}from"node:module";/);if(!t)return;let n=t[1],r=RegExp(`var ([$\\w]+)=${U(n)}\\(import\\.meta\\.url\\)`),i=e.match(r);if(!i){console.log(`patch: findRequireFunc: failed to find require function variable (createRequireVar=${n})`);return}return i[1]},rr=e=>{if(z!=null)return z;let t=nr(e);return t?(z=t,z):(z=`require`,z)},ir=()=>{z=null},ar=()=>{tr(),ir()},V=e=>{let t=e.match(/\bfunction ([$\w]+).{0,20}color:[$\w]+,backgroundColor:[$\w]+,dimColor:[$\w]+(?:=![01])?,bold:[$\w]+(?:=![01])?/);if(!t){console.log(`patch: findTextComponent: failed to find text component`);return}return t[1]},or=e=>{let t=e.match(/function ([$\w]+)\(.{0,2000}[^$\w]([$\w]+)=[$\w]+(?:\.default)?\.createElement\("ink-box".{0,200}?return \2/);if(t)return t[1];let n=e.match(/function ([$\w]+)\(\{children:[$\w]+,flexWrap:[$\w]+.{0,2000}?\.createElement\("ink-box"/);if(n)return n[1];let r=e.match(/[^$\w]([$\w]+)\.displayName="Box"/);if(r)return r[1];console.error(`patch: findBoxComponent: failed to find Box component (neither ink-box createElement nor displayName found)`)};let H=function(e){return e.SYSTEM_PROMPTS=`System Prompts`,e.ALWAYS_APPLIED=`Always Applied`,e.MISC_CONFIGURABLE=`Misc Configurable`,e.FEATURES=`Features`,e}({});const sr=[{id:`verbose-property`,name:`Verbose property`,group:H.ALWAYS_APPLIED,description:`Token counter will show (2s · ↓ 169 tokens · thinking)`},{id:`context-limit`,name:`Context limit`,group:H.ALWAYS_APPLIED,description:`Set the CLAUDE_CODE_CONTEXT_LIMIT env var to change 200k max for custom models`},{id:`model-customizations`,name:`Model customizations`,group:H.ALWAYS_APPLIED,description:`Access all Claude models with /model, not just latest 3`},{id:`opusplan1m`,name:`Opusplan[1m] support`,group:H.ALWAYS_APPLIED,description:`Use the "Opus Plan 1M" model: Opus for planning, Sonnet 1M context for building`},{id:`show-more-items-in-select-menus`,name:`Show more items in select menus`,group:H.ALWAYS_APPLIED,description:`Show 25 items in select menus instead of default 5`},{id:`thinking-block-styling`,name:`Thinking block styling`,group:H.ALWAYS_APPLIED,description:`Restore dim/gray + italic styling for thinking blocks`},{id:`fix-lsp-support`,name:`Fix LSP support`,group:H.ALWAYS_APPLIED,description:`Enable/fix nascent LSP support`},{id:`statusline-update-throttle`,name:`Statusline update throttling correction`,group:H.ALWAYS_APPLIED,description:`Statusline updates will be properly throttled instead of queued (or debounced)`},{id:`patches-applied-indication`,name:`Patches applied indication`,group:H.MISC_CONFIGURABLE,description:`Show "tweakcc patches applied" and tweakcc version inside CC`},{id:`table-format`,name:`Table format`,group:H.MISC_CONFIGURABLE,description:`Tables generated by Claude will be rendered more compactly`},{id:`themes`,name:`Themes`,group:H.MISC_CONFIGURABLE,description:`Your custom themes will be available via /theme`},{id:`thinking-verbs`,name:`Thinking verbs`,group:H.MISC_CONFIGURABLE,description:`Your custom list of thinking verbs will be cycled through`},{id:`thinker-format`,name:`Thinker format`,group:H.MISC_CONFIGURABLE,description:`Your custom format string that thinking verbs are wrapped in will be applied`},{id:`thinker-symbol-chars`,name:`Thinker symbol chars`,group:H.MISC_CONFIGURABLE,description:`Your custom thinking spinner will be rendered`},{id:`thinker-symbol-speed`,name:`Thinker symbol speed`,group:H.MISC_CONFIGURABLE,description:`The thinking spinner will play at a custom FPS`},{id:`thinker-symbol-width`,name:`Thinker symbol width`,group:H.MISC_CONFIGURABLE,description:`The thinking spinner will be in a box of custom width`},{id:`thinker-symbol-mirror`,name:`Thinker symbol mirror`,group:H.MISC_CONFIGURABLE,description:`The thinking spinner will reverse or restart when it finishes`},{id:`input-box-border`,name:`Input box border`,group:H.MISC_CONFIGURABLE,description:`Your custom styles to the main input box's border will be applied`},{id:`subagent-models`,name:`Subagent models`,group:H.MISC_CONFIGURABLE,description:`Use custom models for Plan, Explore, and General subagents`},{id:`thinking-visibility`,name:`Thinking block visibility`,group:H.MISC_CONFIGURABLE,description:`Thinking blocks outputted by the model will show without Ctrl+O`},{id:`hide-startup-banner`,name:`Hide startup banner`,group:H.MISC_CONFIGURABLE,description:`CC's startup banner with "Clawd" and release notes will be hidden`},{id:`hide-ctrl-g-to-edit`,name:`Hide Ctrl+G to edit`,group:H.MISC_CONFIGURABLE,description:`Note about using Ctrl+G to edit prompt will be hidden`},{id:`hide-startup-clawd`,name:`Hide startup Clawd`,group:H.MISC_CONFIGURABLE,description:`The "Clawd" icon on startup will be hidden for a cleaner look`},{id:`increase-file-read-limit`,name:`Increase file read limit`,group:H.MISC_CONFIGURABLE,description:`Max tokens Claude can read from a file at once will be increased`},{id:`suppress-line-numbers`,name:`Suppress line numbers`,group:H.MISC_CONFIGURABLE,description:`"1→" "2→" etc. prefixes for each line of Read output will be omitted`},{id:`suppress-rate-limit-options`,name:`Suppress rate limit options`,group:H.MISC_CONFIGURABLE,description:`/rate-limit-options won't be injected when limits are reached`},{id:`token-count-rounding`,name:`Token count rounding`,group:H.MISC_CONFIGURABLE,description:`Round displayed token counts to the nearest multiple of chosen value`},{id:`remember-skill`,name:`Remember skill`,group:H.MISC_CONFIGURABLE,description:`Register the built-in "/remember" skill to review session memories and update CLAUDE.local.md`},{id:`agents-md`,name:`AGENTS.md (and others)`,group:H.MISC_CONFIGURABLE,description:`Support AGENTS.md and others in addition to CLAUDE.md`},{id:`auto-accept-plan-mode`,name:`Auto-accept plan mode`,group:H.MISC_CONFIGURABLE,description:`Automatically accept plans without the "Ready to code?" confirmation prompt`},{id:`allow-sudo-bypass-permissions`,name:`Allow bypassing permissions with --dangerously-skip-permissions in sudo`,group:H.MISC_CONFIGURABLE,description:`Allow bypassing permissions with --dangerously-skip-permissions even when running with root/sudo privileges`},{id:`suppress-native-installer-warning`,name:`Suppress native installer warning`,group:H.MISC_CONFIGURABLE,description:`Suppress the native installer warning message at startup`},{id:`filter-scroll-escape-sequences`,name:`Filter scroll escape sequences`,group:H.MISC_CONFIGURABLE,description:`Filter out terminal escape sequences that cause unwanted scrolling`},{id:`worktree-mode`,name:`Worktree mode`,group:H.FEATURES,description:`Enable the EnterWorktree tool for isolated git worktree sessions`},{id:`session-memory`,name:`Session memory`,group:H.FEATURES,description:`Enable session memory (auto-extraction + past session search)`},{id:`toolsets`,name:`Toolsets`,group:H.FEATURES,description:`Custom toolsets will be registered`},{id:`mcp-non-blocking`,name:`MCP non-blocking`,group:H.FEATURES,description:`If you have MCP servers, CC startup will be much faster`},{id:`mcp-batch-size`,name:`MCP batch size`,group:H.FEATURES,description:`Change the number of MCP servers started in parallel`},{id:`user-message-display`,name:`User message display`,group:H.FEATURES,description:`User messages in the chat history will be styled`},{id:`input-pattern-highlighters`,name:`Input pattern highlighters`,group:H.FEATURES,description:`Custom input highlighters will be registered`},{id:`conversation-title`,name:`Conversation title`,group:H.FEATURES,description:`/title command will be created & enabled`}],cr=()=>[...sr],U=e=>e.replace(/\$/g,`\\$`),lr=(e,t,n)=>{let r=[];for(let i of sr){let a=t[i.id];if(n&&!n.includes(i.id)){r.push({id:i.id,name:i.name,group:i.group,applied:!1,skipped:!0,description:i.description});continue}if(a.condition===!1){r.push({id:i.id,name:i.name,group:i.group,applied:!1,skipped:!0,description:i.description});continue}W(`Applying patch: ${i.name}`);let o=a.fn(e),s=o===null,c=!s&&o!==e;s||(e=o),r.push({id:i.id,name:i.name,group:i.group,applied:c,failed:s,description:i.description})}return{content:e,results:r}},ur=async(e,t,n)=>{let i;if(t.nativeInstallationPath){await Xn(t);let e=!1;try{await r.stat(Y),e=!0}catch{}let n=e?Y:t.nativeInstallationPath;W(`Extracting claude.js from ${e?`backup`:`native installation`}: ${n}`);let o=await v(n);if(!o)throw Error(`Failed to extract claude.js from native installation`);let c=s.join(q,`native-claudejs-orig.js`);a.writeFileSync(c,o),W(`Saved original extracted JS from native to: ${c}`),i=o.toString(`utf8`)}else{if(await Yn(t),!t.cliPath)throw Error(`cliPath is required for NPM installations`);i=await r.readFile(t.cliPath,{encoding:`utf8`})}let o=[],c=await Dt(i,t.version,void 0,n);i=c.newContent;let l=[...c.results].sort((e,t)=>e.name.localeCompare(t.name));o.push(...l);let u=e=>e.replace(/\\/g,`\\\\`).replace(/`/g,"\\`").replace(/\$/g,`\\$`),d=l.filter(e=>e.applied&&e.details).map(e=>u(`${e.name}: ${e.details}`)),f=e.settings.misc?.tableFormat??`default`,p=e.settings.misc?.showTweakccVersion??!0,m=e.settings.misc?.showPatchesApplied??!0,h={"verbose-property":{fn:e=>Se(e)},"context-limit":{fn:e=>ie(e)},"model-customizations":{fn:e=>pr(e)},opusplan1m:{fn:e=>ke(e)},"show-more-items-in-select-menus":{fn:e=>te(e,25)},"thinking-block-styling":{fn:e=>Nn(e),condition:t.version==null||O(t.version,`2.1.26`)<0},"fix-lsp-support":{fn:e=>kt(e)},"statusline-update-throttle":{fn:t=>Rn(t,e.settings.misc?.statuslineThrottleMs??300,e.settings.misc?.statuslineUseFixedInterval??!1),condition:e.settings.misc?.statuslineThrottleMs!=null},"patches-applied-indication":{fn:e=>Be(e,`4.0.9`,d,p,m)},"table-format":{fn:e=>nn(e,f),condition:f!==`default`},themes:{fn:t=>re(t,e.settings.themes),condition:!!(e.settings.themes&&e.settings.themes.length>0&&JSON.stringify(e.settings.themes)!==JSON.stringify(x.themes))},"thinking-verbs":{fn:t=>he(t,e.settings.thinkingVerbs.verbs),condition:!!e.settings.thinkingVerbs},"thinker-format":{fn:t=>E(t,e.settings.thinkingVerbs.format),condition:!!e.settings.thinkingVerbs},"thinker-symbol-chars":{fn:t=>le(t,e.settings.thinkingStyle.phases),condition:JSON.stringify(e.settings.thinkingStyle.phases)!==JSON.stringify(x.thinkingStyle.phases)},"thinker-symbol-speed":{fn:t=>ue(t,e.settings.thinkingStyle.updateInterval),condition:e.settings.thinkingStyle.updateInterval!==x.thinkingStyle.updateInterval&&(t.version==null||O(t.version,`2.1.27`)<0)},"thinker-symbol-width":{fn:t=>fe(t,Math.max(...e.settings.thinkingStyle.phases.map(e=>e.length))+1),condition:JSON.stringify(e.settings.thinkingStyle.phases)!==JSON.stringify(x.thinkingStyle.phases)},"thinker-symbol-mirror":{fn:t=>ce(t,e.settings.thinkingStyle.reverseMirror),condition:e.settings.thinkingStyle.reverseMirror!==x.thinkingStyle.reverseMirror},"input-box-border":{fn:t=>oe(t,e.settings.inputBox.removeBorder),condition:!!(e.settings.inputBox&&typeof e.settings.inputBox.removeBorder==`boolean`)},"subagent-models":{fn:t=>Pe(t,e.settings.subagentModels),condition:!!e.settings.subagentModels},"thinking-visibility":{fn:e=>Ae(e),condition:e.settings.misc?.expandThinkingBlocks??!0},"hide-startup-banner":{fn:e=>gn(e),condition:!!e.settings.misc?.hideStartupBanner},"hide-ctrl-g-to-edit":{fn:e=>vn(e),condition:!!e.settings.misc?.hideCtrlGToEdit},"hide-startup-clawd":{fn:e=>bn(e),condition:!!e.settings.misc?.hideStartupClawd},"increase-file-read-limit":{fn:e=>Sn(e),condition:!!e.settings.misc?.increaseFileReadLimit},"suppress-line-numbers":{fn:e=>wn(e),condition:!!e.settings.misc?.suppressLineNumbers},"suppress-rate-limit-options":{fn:e=>Tn(e),condition:!!e.settings.misc?.suppressRateLimitOptions},"token-count-rounding":{fn:t=>zn(t,e.settings.misc.tokenCountRounding),condition:!!e.settings.misc?.tokenCountRounding},"remember-skill":{fn:e=>Mn(e),condition:!!e.settings.misc?.enableRememberSkill&&!!t.version&&O(t.version,`2.1.42`)<0},"agents-md":{fn:t=>Bn(t,e.settings.claudeMdAltNames),condition:!!(e.settings.claudeMdAltNames&&e.settings.claudeMdAltNames.length>0)},"auto-accept-plan-mode":{fn:e=>Vn(e),condition:!!e.settings.misc?.autoAcceptPlanMode},"allow-sudo-bypass-permissions":{fn:e=>Hn(e),condition:!!e.settings.misc?.allowBypassPermissionsInSudo},"suppress-native-installer-warning":{fn:e=>Un(e),condition:!!e.settings.misc?.suppressNativeInstallerWarning},"filter-scroll-escape-sequences":{fn:e=>Gn(e),condition:!!e.settings.misc?.filterScrollEscapeSequences},"worktree-mode":{fn:e=>Kn(e),condition:!!e.settings.misc?.enableWorktreeMode&&!!t.version&&O(t.version,`2.1.51`)<0},"session-memory":{fn:e=>An(e),condition:!!e.settings.misc?.enableSessionMemory},toolsets:{fn:t=>qt(t,e.settings.toolsets,e.settings.defaultToolset,e.settings.planModeToolset),condition:!!(e.settings.toolsets&&e.settings.toolsets.length>0)},"mcp-non-blocking":{fn:e=>In(e),condition:!!e.settings.misc?.mcpConnectionNonBlocking},"mcp-batch-size":{fn:t=>Ln(t,e.settings.misc.mcpServerBatchSize),condition:!!e.settings.misc?.mcpServerBatchSize},"user-message-display":{fn:t=>ge(t,e.settings.userMessageDisplay),condition:!!e.settings.userMessageDisplay},"input-pattern-highlighters":{fn:t=>be(t,e.settings.inputPatternHighlighters),condition:!!(e.settings.inputPatternHighlighters&&e.settings.inputPatternHighlighters.length>0)},"conversation-title":{fn:e=>mn(e),condition:(e.settings.misc?.enableConversationTitle??!0)&&!!(t.version&&O(t.version,`2.0.64`)<0)}},{content:g,results:_}=lr(i,h,n);if(i=g,o.push(..._),t.nativeInstallationPath){W(`Repacking modified claude.js into native installation: ${t.nativeInstallationPath}`);let e=s.join(q,`native-claudejs-patched.js`);a.writeFileSync(e,i,`utf8`),W(`Saved patched JS from native to: ${e}`);let n=Buffer.from(i,`utf8`);await y(t.nativeInstallationPath,n,t.nativeInstallationPath)}else{if(!t.cliPath)throw Error(`cliPath is required for NPM installations`);await Mr(t.cliPath,i,`patch`)}return{config:await $(e=>{e.changesApplied=!0}),results:o}},dr=[{value:`claude-opus-4-6`,label:`Opus 4.6`,description:`Claude Opus 4.6 (February 2026)`},{value:`claude-opus-4-5-20251101`,label:`Opus 4.5`,description:`Claude Opus 4.5 (November 2025)`},{value:`claude-sonnet-4-5-20250929`,label:`Sonnet 4.5`,description:`Claude Sonnet 4.5 (September 2025)`},{value:`claude-opus-4-1-20250805`,label:`Opus 4.1`,description:`Claude Opus 4.1 (August 2025)`},{value:`claude-opus-4-20250514`,label:`Opus 4`,description:`Claude Opus 4 (May 2025)`},{value:`claude-sonnet-4-20250514`,label:`Sonnet 4`,description:`Claude Sonnet 4 (May 2025)`},{value:`claude-3-7-sonnet-20250219`,label:`Sonnet 3.7`,description:`Claude 3.7 Sonnet (February 2025)`},{value:`claude-3-5-sonnet-20241022`,label:`Sonnet 3.5 (October)`,description:`Claude 3.5 Sonnet (October 2024)`},{value:`claude-3-5-haiku-20241022`,label:`Haiku 3.5`,description:`Claude 3.5 Haiku (October 2024)`},{value:`claude-3-5-sonnet-20240620`,label:`Sonnet 3.5 (June)`,description:`Claude 3.5 Sonnet (June 2024)`},{value:`claude-3-haiku-20240307`,label:`Haiku 3`,description:`Claude 3 Haiku (March 2024)`},{value:`claude-3-opus-20240229`,label:`Opus 3`,description:`Claude 3 Opus (February 2024)`}],fr=e=>{let t=e.match(/ ([$\w]+)\.push\(\{value:[$\w]+,label:[$\w]+,description:"Custom model"\}\)/);if(!t||t.index===void 0)return console.error(`patch: findCustomModelListInsertionPoint: failed to find custom model push`),null;let n=t[1],r=Math.max(0,t.index-600),i=e.slice(r,t.index),a=RegExp(`function [$\\w]+\\([^)]*\\)\\{let ${U(n)}=.+?;`,`g`),o=null,s;for(;(s=a.exec(i))!==null;)o=s;return o?{insertionIndex:r+o.index+o[0].length,modelListVar:n}:(console.error(`patch: findCustomModelListInsertionPoint: failed to find function with let ${n}`),null)},pr=e=>{let t=fr(e);if(!t)return null;let{insertionIndex:n,modelListVar:r}=t,i=dr.map(e=>`${r}.push(${JSON.stringify(e)});`).join(``),a=e.slice(0,n)+i+e.slice(n);return F(e,a,i,n,n),a};let mr=!1,hr=!1,gr=!1;const _r=()=>mr,vr=()=>hr,yr=()=>gr,br=()=>{mr=!0},xr=()=>{hr=!0,mr=!0},Sr=()=>{gr=!0},W=(e,...t)=>{_r()&&console.log(e,...t)},G=(e,...t)=>{vr()&&console.log(e,...t)};function Cr(){try{let e=u.join(d.homedir(),`.claude.json`);return JSON.parse(l.readFileSync(e,`utf8`)).theme||`dark`}catch{}return`dark`}function wr(e){try{let t=u.join(d.homedir(),`.claude.json`),n=JSON.parse(l.readFileSync(t,`utf8`));n.theme=e,l.writeFileSync(t,JSON.stringify(n,null,2))}catch{}}function Tr(){try{let e=u.join(d.homedir(),`.claude`,`.credentials.json`);switch(JSON.parse(l.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 Er(){try{let e=u.join(d.homedir(),`.claude`,`settings.json`),t=JSON.parse(l.readFileSync(e,`utf8`))?.model||`default`;if(t===`opus`)return`Opus 4.5`;let n=dr.find(e=>e.value===t);if(n)return n.label}catch{}return`Opus 4.5`}function Dr(e){process.platform===`win32`?f.spawn(`explorer`,[e],{detached:!0,stdio:`ignore`}).unref():process.platform===`darwin`?f.spawn(`open`,[e],{detached:!0,stdio:`ignore`}).unref():f.spawn(`xdg-open`,[e],{detached:!0,stdio:`ignore`}).unref()}function Or(e){if(process.platform===`win32`)f.spawn(`explorer`,[`/select,`,e],{detached:!0,stdio:`ignore`}).unref();else if(process.platform===`darwin`)f.spawn(`open`,[`-R`,e],{detached:!0,stdio:`ignore`}).unref();else{let t=u.dirname(e);f.spawn(`xdg-open`,[t],{detached:!0,stdio:`ignore`}).unref()}}function kr(e){if(!e||typeof e!=`string`)return!1;let 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)){let e=t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(e){let[,t,n,r]=e;return parseInt(t)<=255&&parseInt(n)<=255&&parseInt(r)<=255}}if(/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(t)){let e=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(e){let[,t,n,r]=e;return parseInt(t)<=360&&parseInt(n)<=100&&parseInt(r)<=100}}return!1}function Ar(e){if(!kr(e))return e;let t=e.trim();if(t.startsWith(`rgb(`))return t;if(t.startsWith(`#`)){let e=t.slice(1);return e.length===3&&(e=e.split(``).map(e=>e+e).join(``)),`rgb(${parseInt(e.slice(0,2),16)},${parseInt(e.slice(2,4),16)},${parseInt(e.slice(4,6),16)})`}if(t.startsWith(`hsl(`)){let e=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(e){let t=parseInt(e[1])/360,n=parseInt(e[2])/100,r=parseInt(e[3])/100,i=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),a=r<.5?r*(1+n):r+n-r*n,o=2*r-a;return`rgb(${Math.round(i(o,a,t+1/3)*255)},${Math.round(i(o,a,t)*255)},${Math.round(i(o,a,t-1/3)*255)})`}}return e}async function jr(e,t=`sha256`,n=64*1024){return new Promise((r,i)=>{let a=p.createHash(t),o=l.createReadStream(e,{highWaterMark:n});o.on(`data`,e=>{a.update(e)}),o.on(`end`,()=>{r(a.digest(`hex`))}),o.on(`error`,e=>{i(e)})})}async function Mr(e,t,n=`replace`){let r=493;try{r=(await i.stat(e)).mode,W(`[${n}] Original file mode for ${e}: ${(r&511).toString(8)}`)}catch(t){W(`[${n}] Could not stat ${e} (error: ${t}), using default mode 755`)}try{await i.unlink(e),W(`[${n}] Unlinked ${e} to break hard links`)}catch(t){W(`[${n}] Could not unlink ${e}: ${t}`)}await i.writeFile(e,t),await i.chmod(e,r),W(`[${n}] Restored permissions to ${(r&511).toString(8)}`)}async function Nr(e){try{return await i.stat(e),!0}catch(e){if(e instanceof Error&&`code`in e&&(e.code===`ENOENT`||e.code===`ENOTDIR`||e.code===`EACCES`||e.code===`EPERM`))return!1;throw e}}const Pr=e=>e.startsWith(`~`)?u.join(d.homedir(),e.slice(1)):e,Fr=(e,t)=>{let n=e=>{let t=e.split(`.`).map(Number);return[t[0]||0,t[1]||0,t[2]||0]},r=n(e),i=n(t);return r[0]===i[0]?r[1]===i[1]?r[2]-i[2]:r[1]-i[1]:r[0]-i[0]},Ir=e=>{let t=e.toString(),n=t.lastIndexOf(`/`);return`new RegExp(${JSON.stringify(t.substring(1,n))}, ${JSON.stringify(t.substring(n+1))})`};function K(e,t){if(e==null)return t;if(typeof t!=`object`||!t)return e;if(Array.isArray(t))return Array.isArray(e)?e:t;let n={...e};for(let e of Object.keys(t)){let r=t[e];e in n?typeof r==`object`&&r&&!Array.isArray(r)&&(n[e]=K(n[e],r)):n[e]=r}return n}const Lr=e=>{let t=e?.settings?.userMessageDisplay;if(t?.prefix){let n=t;e.settings.userMessageDisplay={format:(n.prefix?.format||``)+(n.message?.format||`{}`),styling:[...n.prefix?.styling||[],...n.message?.styling||[]],foregroundColor:n.message?.foregroundColor===`rgb(0,0,0)`?`default`:n.message?.foregroundColor||n.prefix?.foregroundColor||`default`,backgroundColor:n.message?.backgroundColor===`rgb(0,0,0)`?null:n.message?.backgroundColor||n.prefix?.backgroundColor||null,borderStyle:`none`,borderColor:`rgb(255,255,255)`,paddingX:0,paddingY:0,fitBoxToContent:!1}}t&&!(`borderStyle`in t)&&(e.settings.userMessageDisplay.borderStyle=`none`,e.settings.userMessageDisplay.borderColor=`rgb(255,255,255)`,e.settings.userMessageDisplay.paddingX=0,e.settings.userMessageDisplay.paddingY=0,e.settings.userMessageDisplay.fitBoxToContent=!1),t&&`padding`in t&&!(`paddingX`in t)&&(e.settings.userMessageDisplay.paddingX=t.padding||0,e.settings.userMessageDisplay.paddingY=0,delete t.padding),t&&!(`fitBoxToContent`in t)&&(e.settings.userMessageDisplay.fitBoxToContent=!1)},Rr=e=>{let t=e?.settings?.misc;t&&`hideCtrlGToEditPrompt`in t&&(t.hideCtrlGToEdit=t.hideCtrlGToEditPrompt,delete t.hideCtrlGToEditPrompt)};async function zr(){try{let e=await i.readFile(J,`utf8`),t=JSON.parse(e);return Object.hasOwn(t,`ccInstallationDir`)?(t.ccInstallationDir&&!t.ccInstallationPath&&(t.ccInstallationPath=c.join(t.ccInstallationDir,`cli.js`)),delete t.ccInstallationDir,t.lastModified=new Date().toISOString(),await Z(),await i.writeFile(J,JSON.stringify(t,null,2)),!0):!1}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return!1;throw e}}const Br=()=>{let e=process.env.TWEAKCC_CONFIG_DIR?.trim();if(e&&e.length>0)return Pr(e);let n=c.join(t.homedir(),`.tweakcc`),r=c.join(t.homedir(),`.claude`,`tweakcc`),i=process.env.XDG_CONFIG_HOME;try{if(o.existsSync(n))return n}catch(e){W(`Failed to check if ${n} exists: ${e}`)}try{if(o.existsSync(r))return r}catch(e){W(`Failed to check if ${r} exists: ${e}`)}return i?c.join(i,`tweakcc`):n},q=Br(),J=c.join(q,`config.json`),Vr=c.join(q,`cli.js.backup`),Y=c.join(q,`native-binary.backup`),X=c.join(q,`system-prompts`),Hr=c.join(q,`prompt-data-cache`),Ur=()=>{let n=q,r=t.homedir(),i=[c.join(r,`.tweakcc`),c.join(r,`.claude`,`tweakcc`),process.env.XDG_CONFIG_HOME?c.join(process.env.XDG_CONFIG_HOME,`tweakcc`):null].filter(e=>e!==null).filter(e=>{try{return o.existsSync(e)&&e!==n}catch{return!1}});i.length>0&&(console.warn(e.yellow(`
|
|
668
|
+
Multiple configuration locations detected:`)),console.warn(e.gray(` Active: ${n}`)),console.warn(e.gray(` Other existing locations:`)),i.forEach(t=>{console.warn(e.gray(` - ${t}`))}),console.warn(e.gray(` Only the active location is used. To switch locations,`)),console.warn(e.gray(` move your config.json to the desired directory.
|
|
669
|
+
`)))},Z=async()=>{await i.mkdir(q,{recursive:!0}),await i.mkdir(X,{recursive:!0});let e=c.join(q,`.gitignore`);try{await i.stat(e)}catch(t){t instanceof Error&&`code`in t&&t.code===`ENOENT`&&await i.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/*.diff.html`].join(n)+n)}};let Q=null;const Wr=()=>({ccVersion:``,ccInstallationPath:null,lastModified:new Date().toISOString(),changesApplied:!0,settings:x}),Gr=e=>{let t=e?.settings?.thinkingVerbs;t?.punctuation&&(t.format=`{}`+t.punctuation,delete t.punctuation),e.settings=K(e.settings,x),e.settings.inputPatternHighlighters&&(e.settings.inputPatternHighlighters=e.settings.inputPatternHighlighters.map(e=>K(e,S))),e.settings.toolsets&&(e.settings.toolsets=e.settings.toolsets.map(e=>K(e,C))),e.settings.themes&&(e.settings.themes=e.settings.themes.map(e=>K(e,w))),Lr(e),Rr(e),delete e.settings.launchText},Kr=async()=>{let e=Wr();try{W(`Reading config at ${J}`),Ur();let t=await i.readFile(J,`utf8`),n={...e,...JSON.parse(t)},r=JSON.stringify(n);Gr(n);let a=await et(X);return a&&(n.changesApplied=!1),(JSON.stringify(n)!==r||a)&&await qr(n),Q=n,n}catch(t){if(t instanceof Error&&`code`in t&&t.code===`ENOENT`)return e;throw t}},$=async e=>(W(`Updating config at ${J}`),Q||=await Kr(),e(Q),Q.lastModified=new Date().toISOString(),await qr(Q),Q),qr=async e=>{try{e.lastModified=new Date().toISOString(),await Z(),await i.writeFile(J,JSON.stringify(e,null,2))}catch(e){throw console.error(`Error saving config:`,e),e}},Jr=async e=>{W(`Fetching config from URL: ${e}`);let t;try{t=new URL(e)}catch{throw Error(`Invalid URL format: ${e}\n Expected a valid URL like https://example.com/config.json`)}if(![`http:`,`https:`].includes(t.protocol))throw Error(`Unsupported URL protocol: ${t.protocol}\n Only http:// and https:// URLs are supported`);let n;try{let e=await i.readFile(J,`utf8`);n=JSON.parse(e)}catch{n=Wr()}let r;try{r=await fetch(e,{headers:{Accept:`application/json`,"User-Agent":`tweakcc`}})}catch(t){let n=t instanceof Error?t.message:String(t);throw Error(`Failed to fetch config from ${e}\n Network error: ${n}\n Please check your internet connection and try again.`)}if(!r.ok)throw Error(`Failed to fetch config from ${e}\n HTTP ${r.status}: ${r.statusText}\n Please check that the URL is correct and accessible.`);let a;try{let e=await r.text();a=JSON.parse(e)}catch(t){let n=t instanceof Error?t.message:String(t);throw Error(`Failed to parse config from ${e}\n JSON parse error: ${n}\n Please ensure the URL returns valid JSON.`)}let o={sourceUrl:e,dateFetched:new Date().toISOString(),settings:a};await $(e=>{e.remoteConfig=o});let s={...Wr(),ccVersion:n.ccVersion||``,ccInstallationPath:n.ccInstallationPath||null,settings:{...x,...a},remoteConfig:o};return Gr(s),W(`Successfully fetched and parsed config from ${e}`),s};export{b as $,ur as A,F as B,kr as C,Or as D,Mr as E,V as F,wt as G,Jn as H,Qn as I,dt as J,mt as K,B as L,ar as M,or as N,wr as O,L as P,y as Q,rr as R,yr as S,Dr as T,Yn as U,qn as V,Xn as W,x as X,$e as Y,v as Z,Tr as _,X as a,jr as b,Kr as c,Fr as d,W as f,xr as g,Sr as h,Y as i,cr as j,H as k,$ as l,br as m,q as n,Jr as o,Nr as p,pt as q,J as r,Br as s,Vr as t,zr as u,Cr as v,Ar as w,_r as x,Er as y,I as z};
|