@ranger-testing/ranger-cli 2.0.5 → 2.0.7
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/build/cli.js +1 -914
- package/build/commands/addEnv.js +1 -1
- package/build/commands/authEncrypt.js +1 -36
- package/build/commands/clean.js +1 -1
- package/build/commands/config.js +1 -93
- package/build/commands/env.js +1 -98
- package/build/commands/feature.js +1 -653
- package/build/commands/hook.js +1 -33
- package/build/commands/hooks/autoPrompt.js +1 -32
- package/build/commands/hooks/disable.js +1 -33
- package/build/commands/hooks/enable.js +1 -58
- package/build/commands/hooks/exitPlanMode.js +1 -35
- package/build/commands/hooks/index.js +1 -12
- package/build/commands/hooks/output.js +1 -71
- package/build/commands/hooks/planReminder.js +1 -46
- package/build/commands/hooks/planStart.js +1 -30
- package/build/commands/hooks/postEdit.js +1 -43
- package/build/commands/hooks/preCompact.js +1 -30
- package/build/commands/hooks/sessionEnd.js +1 -25
- package/build/commands/hooks/sessionStart.js +1 -93
- package/build/commands/hooks/stopHook.js +1 -155
- package/build/commands/index.js +1 -12
- package/build/commands/login.js +1 -26
- package/build/commands/setupCi.js +1 -189
- package/build/commands/skillup.js +1 -80
- package/build/commands/start.js +1 -1
- package/build/commands/status.js +1 -198
- package/build/commands/update.js +1 -182
- package/build/commands/updateEnv.js +1 -1
- package/build/commands/useEnv.js +1 -1
- package/build/commands/utils/activeProfile.js +1 -76
- package/build/commands/utils/browserSessionsApi.js +1 -1
- package/build/commands/utils/claudeConfig.js +1 -73
- package/build/commands/utils/claudePlugin.js +1 -85
- package/build/commands/utils/crypto.js +1 -42
- package/build/commands/utils/desirePathLog.js +1 -139
- package/build/commands/utils/deviceAuth.js +1 -232
- package/build/commands/utils/environment.js +1 -65
- package/build/commands/utils/featureApi.js +1 -371
- package/build/commands/utils/featureReportGenerator.js +1 -204
- package/build/commands/utils/fixWebmDuration.js +1 -0
- package/build/commands/utils/git.js +1 -44
- package/build/commands/utils/keychain.js +1 -1
- package/build/commands/utils/localAgentInstallationsApi.js +1 -1
- package/build/commands/utils/profileMessages.js +1 -8
- package/build/commands/utils/profileSetupBanner.js +1 -167
- package/build/commands/utils/rangerRoot.js +1 -60
- package/build/commands/utils/reportGenerator.js +1 -130
- package/build/commands/utils/retry.js +1 -25
- package/build/commands/utils/sessionCache.js +1 -299
- package/build/commands/utils/settings.js +1 -313
- package/build/commands/utils/skillContent.js +1 -28
- package/build/commands/utils/skills.js +1 -1
- package/build/commands/utils/telemetry.js +1 -254
- package/build/commands/utils/userApi.js +1 -32
- package/build/commands/utils/version.js +1 -62
- package/build/commands/verifyFeature.js +1 -1343
- package/build/commands/verifyInBrowser.js +1 -1
- package/package.json +4 -1
- package/build/cli.js.map +0 -1
- package/build/commands/addEnv.js.map +0 -1
- package/build/commands/authEncrypt.js.map +0 -1
- package/build/commands/clean.js.map +0 -1
- package/build/commands/config.js.map +0 -1
- package/build/commands/env.js.map +0 -1
- package/build/commands/feature.js.map +0 -1
- package/build/commands/hook.js.map +0 -1
- package/build/commands/hooks/autoPrompt.js.map +0 -1
- package/build/commands/hooks/disable.js.map +0 -1
- package/build/commands/hooks/enable.js.map +0 -1
- package/build/commands/hooks/exitPlanMode.js.map +0 -1
- package/build/commands/hooks/index.js.map +0 -1
- package/build/commands/hooks/output.js.map +0 -1
- package/build/commands/hooks/planReminder.js.map +0 -1
- package/build/commands/hooks/planStart.js.map +0 -1
- package/build/commands/hooks/postEdit.js.map +0 -1
- package/build/commands/hooks/preCompact.js.map +0 -1
- package/build/commands/hooks/sessionEnd.js.map +0 -1
- package/build/commands/hooks/sessionStart.js.map +0 -1
- package/build/commands/hooks/stopHook.js.map +0 -1
- package/build/commands/index.js.map +0 -1
- package/build/commands/login.js.map +0 -1
- package/build/commands/setupCi.js.map +0 -1
- package/build/commands/skillup.js.map +0 -1
- package/build/commands/start.js.map +0 -1
- package/build/commands/status.js.map +0 -1
- package/build/commands/update.js.map +0 -1
- package/build/commands/updateEnv.js.map +0 -1
- package/build/commands/useEnv.js.map +0 -1
- package/build/commands/utils/activeProfile.js.map +0 -1
- package/build/commands/utils/browserSessionsApi.js.map +0 -1
- package/build/commands/utils/claudeConfig.js.map +0 -1
- package/build/commands/utils/claudePlugin.js.map +0 -1
- package/build/commands/utils/crypto.js.map +0 -1
- package/build/commands/utils/desirePathLog.js.map +0 -1
- package/build/commands/utils/deviceAuth.js.map +0 -1
- package/build/commands/utils/environment.js.map +0 -1
- package/build/commands/utils/featureApi.js.map +0 -1
- package/build/commands/utils/featureReportGenerator.js.map +0 -1
- package/build/commands/utils/git.js.map +0 -1
- package/build/commands/utils/keychain.js.map +0 -1
- package/build/commands/utils/localAgentInstallationsApi.js.map +0 -1
- package/build/commands/utils/profileMessages.js.map +0 -1
- package/build/commands/utils/profileSetupBanner.js.map +0 -1
- package/build/commands/utils/rangerRoot.js.map +0 -1
- package/build/commands/utils/reportGenerator.js.map +0 -1
- package/build/commands/utils/retry.js.map +0 -1
- package/build/commands/utils/sessionCache.js.map +0 -1
- package/build/commands/utils/settings.js.map +0 -1
- package/build/commands/utils/skillContent.js.map +0 -1
- package/build/commands/utils/skills.js.map +0 -1
- package/build/commands/utils/telemetry.js.map +0 -1
- package/build/commands/utils/userApi.js.map +0 -1
- package/build/commands/utils/version.js.map +0 -1
- package/build/commands/verifyFeature.js.map +0 -1
- package/build/commands/verifyInBrowser.js.map +0 -1
package/build/commands/addEnv.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function _0x44f7(_0x3fefca,_0x11e1d1){_0x3fefca=_0x3fefca-0x11b;const _0x33d6d9=_0x33d6();let _0x44f73a=_0x33d6d9[_0x3fefca];return _0x44f73a;}(function(_0x393990,_0xc164e7){const _0x2ac753=_0x44f7,_0x593af3=_0x393990();while(!![]){try{const _0x275046=-parseInt(_0x2ac753(0x123))/0x1*(parseInt(_0x2ac753(0x166))/0x2)+parseInt(_0x2ac753(0x157))/0x3*(-parseInt(_0x2ac753(0x16a))/0x4)+-parseInt(_0x2ac753(0x135))/0x5+-parseInt(_0x2ac753(0x133))/0x6+-parseInt(_0x2ac753(0x152))/0x7*(parseInt(_0x2ac753(0x141))/0x8)+-parseInt(_0x2ac753(0x162))/0x9+parseInt(_0x2ac753(0x148))/0xa;if(_0x275046===_0xc164e7)break;else _0x593af3['push'](_0x593af3['shift']());}catch(_0x41a3bd){_0x593af3['push'](_0x593af3['shift']());}}}(_0x33d6,0x7b311));import{mkdir,writeFile,readFile,unlink,rm,mkdtemp,rename}from'fs/promises';import{join}from'path';import _0x4c945f from'inquirer';import{chromium}from'playwright';import{findExistingEnv}from'./utils/settings.js';function _0x33d6(){const _0x28256b=['config_write','Kdoch','103100jjXmhV','retry','\x20\x20\x20When\x20you\x20are\x20done\x20logging\x20in,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','JanhE','DcZje','RlxVk','name','mFQyB','\x22\x20already\x20exists.\x20Overwrite?','error','status','HAggY','settings.json','CtFZO','shzHX','928093hAlyOz','\x0a⚠️\x20\x20Profile\x20\x22','What\x20is\x20the\x20URL\x20of\x20your\x20running\x20app?','close','JxWAj','OlJtt','\x0a🌐\x20Profile\x20Setup\x0a','Warning:\x20Profile\x20created,\x20but\x20failed\x20to\x20mark\x20it\x20as\x20active.','Removed\x20existing\x20profile\x20at\x20','✓\x20Created\x20settings:\x20','path','trackPhaseStart','What\x20would\x20you\x20like\x20to\x20do?','url_setup','\x20\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20to\x20the\x20profile\x20you\x20want\x20to\x20test\x20so\x20Ranger\x20can\x20access\x20it.','bVEGf','2904558WaJlbt','trackPhaseEnd','3973640UFpIcf','manual','Delete\x20existing\x20and\x20create\x20new\x20in\x20','Enter\x20a\x20different\x20URL','input','stdin','\x0a📋\x20Authentication\x20Setup','\x20\x20Make\x20sure\x20your\x20app\x20is\x20running\x20locally\x20before\x20continuing.','\x20\x20Ranger\x20will\x20open\x20it\x20in\x20a\x20browser\x20so\x20you\x20can\x20log\x20in\x20and\x20save\x20your\x20session.\x0a','local','Non-interactive\x20mode\x20detected.\x0aThe\x20\x22ranger\x20profile\x20add\x22\x20command\x20requires\x20interactive\x20browser\x20authentication\x20and\x20cannot\x20be\x20run\x20in\x20non-TTY\x20environments\x20(CI,\x20scripts,\x20Claude\x20Code).\x0aTo\x20configure\x20profiles\x20non-interactively:\x0a\x20\x201.\x20Run\x20\x22ranger\x20profile\x20add\x20<name>\x20--ci\x22\x20in\x20an\x20interactive\x20terminal\x20first\x0a\x20\x202.\x20Commit\x20the\x20encrypted\x20auth\x20file\x20(.ranger/ci/<profile>/auth.json.enc)\x20to\x20git\x0a\x20\x203.\x20Use\x20\x22ranger\x20setup\x20[token]\x22\x20in\x20CI\x20to\x20decrypt\x20at\x20runtime','Ekdes','48lHscJJ','\x22\x20already\x20exists\x20in\x20','browser_auth','log','\x20\x20Did\x20you\x20mean\x20','NjMvZ','isTTY','36706330RDBtaR','FEhpR','includes','Invalid\x20URL','XqduD','\x0a\x20\x20Still\x20could\x20not\x20reach\x20','gXRCS','.enc','MJWYF','vTRqr','136199HtAWkH','overwrite','baseUrl','GAwYT','\x0a\x20\x20Could\x20not\x20reach\x20','75XAhghS','Profile\x20\x22','mwrxZ','stdout','HTTP\x20','hctpF','oyteW','confirm','mxugt','Rzvlm','root\x20(.ranger/)','1782081ZGcatR','TtaKW','location','HEAD','2iSBXlJ','utf-8'];_0x33d6=function(){return _0x28256b;};return _0x33d6();}import{encrypt}from'./utils/crypto.js';import{getToken}from'./utils/keychain.js';import{getRangerDir}from'./utils/rangerRoot.js';import{writeActiveProfileName}from'./utils/activeProfile.js';import{addProfileSetupBanner}from'./utils/profileSetupBanner.js';async function checkUrlReachability(_0x426e5a){const _0x19fb14=_0x44f7,_0x1c659b={'ElFCR':function(_0x3914fb,_0x59ab0a,_0x121fb1){return _0x3914fb(_0x59ab0a,_0x121fb1);},'nDUVE':_0x19fb14(0x165),'NIjBO':_0x19fb14(0x136),'OEcNa':_0x19fb14(0x14b),'ubRul':'TypeError'};try{const _0x3fabba=new AbortController(),_0x23f787=setTimeout(()=>_0x3fabba['abort'](),0x1388),_0x2f3ebc=await _0x1c659b['ElFCR'](fetch,_0x426e5a,{'method':_0x1c659b['nDUVE'],'signal':_0x3fabba['signal'],'redirect':_0x1c659b['NIjBO']});clearTimeout(_0x23f787);if(_0x2f3ebc[_0x19fb14(0x11e)]<0x190)return{'ok':!![]};return{'ok':![],'error':_0x19fb14(0x15b)+_0x2f3ebc['status']};}catch(_0x1809b3){const _0x2c2aa1=_0x1809b3,_0x3304e6=_0x2c2aa1['message']||String(_0x1809b3),_0x4f6f20=_0x3304e6[_0x19fb14(0x14a)](_0x1c659b['OEcNa'])||_0x2c2aa1[_0x19fb14(0x170)]===_0x1c659b['ubRul']||_0x3304e6[_0x19fb14(0x14a)]('fetch\x20failed');return{'ok':![],'error':_0x3304e6,'isProtocolError':_0x4f6f20};}}export async function addEnv(_0x25aaca,_0x7b5c83={},_0x47d71a){const _0x2ed86d=_0x44f7,_0x310b21={'ZYwrA':function(_0x4c3e45){return _0x4c3e45();},'WNVsc':_0x2ed86d(0x126),'RlxVk':_0x2ed86d(0x13e),'mxugt':function(_0x29b9e6,_0x6b57cd,_0x4e75d1,_0x2b635c){return _0x29b9e6(_0x6b57cd,_0x4e75d1,_0x2b635c);},'gjqVT':_0x2ed86d(0x13f),'gXRCS':function(_0x1226f3,_0x22b8f5){return _0x1226f3===_0x22b8f5;},'JxWAj':_0x2ed86d(0x15e),'shzHX':_0x2ed86d(0x153),'CtFZO':'Aborted.','GAwYT':'legacy','lIAfq':_0x2ed86d(0x161),'Rzvlm':'shouldReplace','oZFAR':_0x2ed86d(0x130),'SNztt':_0x2ed86d(0x13d),'vTRqr':_0x2ed86d(0x139),'FEhpR':_0x2ed86d(0x154),'JanhE':'Enter\x20a\x20new\x20URL\x20(or\x20press\x20enter\x20to\x20keep\x20current):','DcZje':_0x2ed86d(0x125),'Ekdes':function(_0x403e14,_0x40890d){return _0x403e14(_0x40890d);},'XqduD':'use_suggestion','jaTLL':_0x2ed86d(0x138),'cpIyg':'Continue\x20anyway','bVEGf':function(_0x35fe07,_0x4c7225,_0x41c021){return _0x35fe07(_0x4c7225,_0x41c021);},'oyteW':'auth.json','HAggY':function(_0x4e654b,_0x349157){return _0x4e654b||_0x349157;},'mwrxZ':'about:blank','mCcWm':function(_0xc23b13){return _0xc23b13();},'TtaKW':'\x20\x20Could\x20not\x20encrypt:\x20No\x20API\x20token\x20found.\x20Run:\x20ranger\x20setup\x20[token]','NjMvZ':'Missing\x20API\x20token;\x20aborting\x20CI\x20profile\x20creation.','OlJtt':function(_0x16deeb,_0xa1e28b){return _0x16deeb+_0xa1e28b;},'MJWYF':'\x20\x20Run\x20ranger\x20setup\x20in\x20CI\x20to\x20decrypt\x20at\x20runtime.','kmwFe':_0x2ed86d(0x143),'mFQyB':function(_0x251ac9,_0xa57b00,_0x1d08cb){return _0x251ac9(_0xa57b00,_0x1d08cb);},'OixYZ':_0x2ed86d(0x120),'Kdoch':function(_0x3adb9b,_0x1b7180,_0x1bf473){return _0x3adb9b(_0x1b7180,_0x1bf473);},'hctpF':_0x2ed86d(0x12a)},_0x3bd217=_0x7b5c83['ci']??![],_0x5613ba=_0x3bd217?'ci':_0x310b21[_0x2ed86d(0x16f)],_0x5893b0=_0x310b21[_0x2ed86d(0x15f)](join,_0x310b21['ZYwrA'](getRangerDir),_0x5613ba,_0x25aaca),_0x400667=join(getRangerDir(),_0x5613ba),_0x40e750=!_0x7b5c83['skipAuth'],_0x25e2cf=process[_0x2ed86d(0x13a)][_0x2ed86d(0x147)]&&process[_0x2ed86d(0x15a)][_0x2ed86d(0x147)];if(!_0x25e2cf&&_0x40e750)throw new Error(_0x310b21['gjqVT']);const _0x115c29=findExistingEnv(_0x25aaca);let _0x39a561=null;if(_0x115c29){if(_0x310b21['gXRCS'](_0x115c29['location'],_0x5613ba)){const {overwrite:_0x1c9675}=await _0x4c945f['prompt']([{'type':_0x310b21['JxWAj'],'name':_0x310b21[_0x2ed86d(0x122)],'message':_0x2ed86d(0x158)+_0x25aaca+_0x2ed86d(0x11c),'default':![]}]);if(!_0x1c9675){console['log'](_0x310b21[_0x2ed86d(0x121)]);return;}_0x39a561=_0x115c29;}else{const _0xf67e9f=_0x310b21[_0x2ed86d(0x14e)](_0x115c29['location'],_0x310b21[_0x2ed86d(0x155)])?_0x310b21['lIAfq']:_0x115c29[_0x2ed86d(0x164)];console[_0x2ed86d(0x11d)](_0x2ed86d(0x124)+_0x25aaca+_0x2ed86d(0x142)+_0xf67e9f+':\x20'+_0x115c29['path']),console[_0x2ed86d(0x11d)]('\x20\x20\x20Creating\x20it\x20in\x20'+_0x5613ba+'\x20would\x20shadow\x20the\x20existing\x20profile.');const {shouldReplace:_0x20cc61}=await _0x4c945f['prompt']([{'type':_0x310b21[_0x2ed86d(0x127)],'name':_0x310b21[_0x2ed86d(0x160)],'message':_0x2ed86d(0x137)+_0x5613ba+'?','default':![]}]);if(!_0x20cc61){console['log'](_0x310b21['CtFZO']);return;}_0x39a561=_0x115c29;}}_0x47d71a?.['trackPhaseStart'](_0x310b21['oZFAR']),console[_0x2ed86d(0x144)](_0x2ed86d(0x129)),console['log'](_0x2ed86d(0x13c)),console[_0x2ed86d(0x144)](_0x310b21['SNztt']);let _0x4790fc='',_0xffa8d8=![];while(!![]){const _0x57bb5d=await _0x4c945f['prompt']([{'type':_0x310b21[_0x2ed86d(0x151)],'name':_0x310b21[_0x2ed86d(0x149)],'message':_0xffa8d8?_0x310b21[_0x2ed86d(0x16d)]:_0x310b21[_0x2ed86d(0x16e)],'default':_0x4790fc||'http://localhost:3000'}]);_0x4790fc=_0x57bb5d['baseUrl'];const _0x5bbc15=await _0x310b21[_0x2ed86d(0x140)](checkUrlReachability,_0x4790fc);if(_0x5bbc15['ok'])break;const _0x40e6a6=/^[a-zA-Z][\w+.-]*:\/\//['test'](_0x4790fc),_0x125b7a=_0x5bbc15['isProtocolError']&&!_0x40e6a6,_0x4883e2=_0x125b7a?'http://'+_0x4790fc:null;_0xffa8d8=!![],console['log'](_0x2ed86d(0x156)+_0x4790fc+':\x20'+_0x5bbc15['error']);_0x4883e2&&console[_0x2ed86d(0x144)](_0x2ed86d(0x145)+_0x4883e2+'?');const {action:_0xcfd600}=await _0x4c945f['prompt']([{'type':'list','name':'action','message':_0x2ed86d(0x12f),'choices':[..._0x4883e2?[{'name':'Use\x20'+_0x4883e2,'value':_0x310b21[_0x2ed86d(0x14c)]}]:[],{'name':_0x310b21['jaTLL'],'value':_0x2ed86d(0x16b)},{'name':_0x310b21['cpIyg'],'value':'continue'}]}]);if(_0x310b21['gXRCS'](_0xcfd600,_0x310b21[_0x2ed86d(0x14c)])&&_0x4883e2){_0x4790fc=_0x4883e2;const _0x2d81c2=await checkUrlReachability(_0x4790fc);if(_0x2d81c2['ok'])break;console[_0x2ed86d(0x144)](_0x2ed86d(0x14d)+_0x4790fc+':\x20'+_0x2d81c2[_0x2ed86d(0x11d)]);}else{if(_0xcfd600==='continue')break;}}_0x47d71a?.[_0x2ed86d(0x134)](_0x310b21['oZFAR']),await mkdir(_0x400667,{'recursive':!![]});const _0x549130=await _0x310b21[_0x2ed86d(0x140)](mkdtemp,join(_0x400667,'.tmp-'+_0x25aaca+'-')),_0x4dde86=_0x310b21['bVEGf'](join,_0x549130,_0x310b21[_0x2ed86d(0x15d)]);try{if(_0x40e750){_0x47d71a?.[_0x2ed86d(0x12e)]('browser_auth'),console['log'](_0x2ed86d(0x13b)),console['log'](_0x2ed86d(0x131)),console[_0x2ed86d(0x144)](_0x2ed86d(0x16c)),await new Promise(_0x4a8068=>setTimeout(_0x4a8068,0xbb8));const _0x121ee8=await chromium['launch']({'headless':![]});try{const _0x211b8b=await _0x121ee8['newContext']();await addProfileSetupBanner(_0x211b8b);const _0x56263d=await _0x211b8b['newPage']();await _0x56263d['goto'](_0x310b21[_0x2ed86d(0x11f)](_0x4790fc,_0x310b21[_0x2ed86d(0x159)])),await new Promise(_0x49b76e=>{_0x56263d['on'](_0x310b21['WNVsc'],async()=>{const _0x52b719=_0x44f7;try{console[_0x52b719(0x144)]('Saving\x20authentication\x20state...'),await _0x211b8b['storageState']({'path':_0x4dde86});}catch{}_0x310b21['ZYwrA'](_0x49b76e);});});}finally{await _0x121ee8['close']()['catch'](()=>{});}if(_0x3bd217){const _0x54b990=await readFile(_0x4dde86,_0x2ed86d(0x167)),_0x3f7530=await _0x310b21['mCcWm'](getToken);if(!_0x3f7530){console['error'](_0x310b21[_0x2ed86d(0x163)]),await unlink(_0x4dde86)['catch'](()=>{});throw new Error(_0x310b21[_0x2ed86d(0x146)]);}else{const _0xe010df=_0x310b21[_0x2ed86d(0x132)](encrypt,_0x54b990,_0x3f7530);await writeFile(_0x310b21[_0x2ed86d(0x128)](_0x4dde86,_0x2ed86d(0x14f)),_0xe010df),await unlink(_0x4dde86),console[_0x2ed86d(0x144)]('✓\x20Encrypted\x20auth\x20saved\x20to:\x20'+_0x4dde86+_0x2ed86d(0x14f)),console['log']('\x20\x20You\x20can\x20safely\x20commit\x20this\x20file\x20to\x20git.'),console['log'](_0x310b21[_0x2ed86d(0x150)]);}}else console['log']('✓\x20Auth\x20state\x20saved\x20to:\x20'+_0x4dde86);_0x47d71a?.[_0x2ed86d(0x134)](_0x310b21['kmwFe']);}_0x47d71a?.[_0x2ed86d(0x12e)](_0x2ed86d(0x168));const _0x3eded1={};_0x4790fc&&(_0x3eded1[_0x2ed86d(0x154)]=_0x4790fc);await writeFile(_0x310b21[_0x2ed86d(0x11b)](join,_0x549130,'settings.json'),JSON['stringify'](_0x3eded1,null,0x2)),console['log'](_0x2ed86d(0x12c)+join(_0x5893b0,_0x310b21['OixYZ']));if(_0x39a561?.[_0x2ed86d(0x164)]===_0x5613ba){const _0x48cc8b=_0x39a561[_0x2ed86d(0x12d)]+'.backup-'+Date['now']();await rename(_0x39a561[_0x2ed86d(0x12d)],_0x48cc8b);try{await _0x310b21['Kdoch'](rename,_0x549130,_0x5893b0);}catch(_0x16f1c8){await _0x310b21[_0x2ed86d(0x169)](rename,_0x48cc8b,_0x39a561[_0x2ed86d(0x12d)]);throw _0x16f1c8;}try{await _0x310b21['Kdoch'](rm,_0x48cc8b,{'recursive':!![]});}catch{console['log']('Warning:\x20Could\x20not\x20remove\x20old\x20profile\x20backup\x20at\x20'+_0x48cc8b);}}else{await rename(_0x549130,_0x5893b0);if(_0x39a561)try{await rm(_0x39a561[_0x2ed86d(0x12d)],{'recursive':!![]}),console[_0x2ed86d(0x144)](_0x2ed86d(0x12b)+_0x39a561[_0x2ed86d(0x12d)]);}catch{console['log']('Warning:\x20Could\x20not\x20remove\x20old\x20profile\x20at\x20'+_0x39a561[_0x2ed86d(0x12d)]);}}try{await _0x310b21['Ekdes'](writeActiveProfileName,_0x25aaca),console['log']('\x20\x20Set\x20active\x20profile:\x20'+_0x25aaca);}catch{console[_0x2ed86d(0x144)](_0x310b21[_0x2ed86d(0x15c)]);}_0x47d71a?.['trackPhaseEnd']('config_write'),console['log']('\x0a\x20\x20Profile\x20\x22'+_0x25aaca+'\x22\x20configured');}catch(_0x1050c6){await rm(_0x549130,{'recursive':!![],'force':!![]});throw _0x1050c6;}}
|
|
1
|
+
(function(_0x39d141,_0x1020b7){const _0x4c8b7b=_0x1701,_0x3406cf=_0x39d141();while(!![]){try{const _0x310797=parseInt(_0x4c8b7b(0x10e))/0x1+-parseInt(_0x4c8b7b(0xed))/0x2*(parseInt(_0x4c8b7b(0x12e))/0x3)+parseInt(_0x4c8b7b(0x13a))/0x4*(parseInt(_0x4c8b7b(0x117))/0x5)+parseInt(_0x4c8b7b(0xf6))/0x6+parseInt(_0x4c8b7b(0xee))/0x7*(parseInt(_0x4c8b7b(0x134))/0x8)+-parseInt(_0x4c8b7b(0x125))/0x9+-parseInt(_0x4c8b7b(0x144))/0xa;if(_0x310797===_0x1020b7)break;else _0x3406cf['push'](_0x3406cf['shift']());}catch(_0x1d6b7e){_0x3406cf['push'](_0x3406cf['shift']());}}}(_0x1091,0x1acb0));function _0x1701(_0x4e1555,_0x402f40){_0x4e1555=_0x4e1555-0xe8;const _0x10910c=_0x1091();let _0x1701e8=_0x10910c[_0x4e1555];return _0x1701e8;}import{mkdir,writeFile,readFile,unlink,rm,mkdtemp,rename}from'fs/promises';import{join}from'path';import _0x143fad from'inquirer';import{chromium}from'playwright';import{findExistingEnv}from'./utils/settings.js';import{encrypt}from'./utils/crypto.js';import{getToken}from'./utils/keychain.js';import{getRangerDir}from'./utils/rangerRoot.js';function _0x1091(){const _0x545923=['--url\x20and\x20--cdp-endpoint\x20are\x20mutually\x20exclusive.\x20Use\x20--url\x20for\x20web\x20apps\x20or\x20--cdp-endpoint\x20for\x20Electron/CDP\x20apps,\x20not\x20both.','hAWXH','QelmK','431988iuJcBY','mPWSc','UfXYM','nJeZs','stdout','location','UQVVB','\x20\x20Set\x20active\x20profile:\x20','input','trackPhaseEnd','1849200LkiAey','Missing\x20API\x20token;\x20aborting\x20CI\x20profile\x20creation.','Aborted.','giPbR','jUlvS','.tmp-','http://','browser_auth','stdin','\x20\x20\x20If\x20you\x20are\x20an\x20agent,\x20background\x20this\x20process\x20and\x20let\x20your\x20user\x20know\x20they\x20need\x20to\x20complete\x20browser\x20authentication.\x0a','newContext','2924OakiGg','1153873IfefKx','Warning:\x20Could\x20not\x20remove\x20old\x20profile\x20backup\x20at\x20','fetch\x20failed','force','\x0aMake\x20sure\x20your\x20app\x20is\x20running,\x20then\x20try\x20again.\x20To\x20skip\x20this\x20check,\x20pass\x20--force.','Enter\x20a\x20new\x20URL\x20(or\x20press\x20enter\x20to\x20keep\x20current):','trim','LwNxF','595818PJEEEj','Please\x20provide\x20--url\x20when\x20running\x20in\x20non-interactive\x20mode.\x0aMake\x20sure\x20the\x20service\x20is\x20running\x20on\x20that\x20port\x20before\x20retrying.\x0aExample:\x20ranger\x20profile\x20add\x20local\x20--url\x20http://localhost:3000','legacy','vyCnf','\x0a\x20\x20Profile\x20\x22','\x20\x20You\x20can\x20safely\x20commit\x20this\x20file\x20to\x20git.','isElectron','list','✓\x20Encrypted\x20auth\x20saved\x20to:\x20','TcKDZ','prompt','http://localhost:3000','\x20\x20Run\x20ranger\x20setup\x20in\x20CI\x20to\x20decrypt\x20at\x20runtime.','\x20(continuing\x20with\x20--force)','local','\x22\x20already\x20exists\x20in\x20','Could\x20not\x20reach\x20','Delete\x20existing\x20and\x20create\x20new\x20in\x20','VRWwm','\x20\x20Did\x20you\x20mean\x20','IRKHs','ByjeW','\x0a\x20\x20\x20⚠\x20This\x20step\x20requires\x20human\x20interaction\x20in\x20a\x20browser.','OzcTc','88464gqWPoz','GuAPC','path','IwekV','trackPhaseStart','\x20\x20Could\x20not\x20encrypt:\x20No\x20API\x20token\x20found.\x20Run:\x20ranger\x20setup\x20[token]','url','now','baseUrl','5wXuwBj','LBsVe','action','IxbnE','cdpEndpoint','LZKEu','⚠\x20Could\x20not\x20reach\x20','YMckm','nudRM','.enc','\x22\x20already\x20exists.\x20Overwrite?','fwZzd','mkJaE','JiaHU','1322397ghcLPl','goto','log','oascq','error','auth.json','✓\x20Created\x20settings:\x20','status','url_setup','39MoeVGd','close','mTPer','\x22\x20configured','Use\x20','catch','8zbjyoP','TypeError','mxEHF'];_0x1091=function(){return _0x545923;};return _0x1091();}import{writeActiveProfileName}from'./utils/activeProfile.js';import{addProfileSetupBanner}from'./utils/profileSetupBanner.js';async function checkUrlReachability(_0x2a004c){const _0x5aef8d=_0x1701,_0x31a4cb={'fWqmk':'HEAD','AyimP':function(_0x204965,_0x456231){return _0x204965<_0x456231;},'IxbnE':function(_0x27060e,_0x46e8d5){return _0x27060e(_0x46e8d5);},'nudRM':_0x5aef8d(0x135)};try{const _0x39204a=new AbortController(),_0x57813a=setTimeout(()=>_0x39204a['abort'](),0x1388),_0x39fe85=await fetch(_0x2a004c,{'method':_0x31a4cb['fWqmk'],'signal':_0x39204a['signal'],'redirect':'manual'});clearTimeout(_0x57813a);if(_0x31a4cb['AyimP'](_0x39fe85['status'],0x190))return{'ok':!![]};return{'ok':![],'error':'HTTP\x20'+_0x39fe85[_0x5aef8d(0x12c)]};}catch(_0x207da7){const _0x4d52d9=_0x207da7,_0x4136a7=_0x4d52d9['message']||_0x31a4cb[_0x5aef8d(0x11a)](String,_0x207da7),_0x2be2cb=_0x4136a7['includes']('Invalid\x20URL')||_0x4d52d9['name']===_0x31a4cb[_0x5aef8d(0x11f)]||_0x4136a7['includes'](_0x5aef8d(0xf0));return{'ok':![],'error':_0x4136a7,'isProtocolError':_0x2be2cb};}}export async function addEnv(_0x320b96,_0x59a037={},_0x47cf9c){const _0x9c0cd7=_0x1701,_0x2cf9cb={'VRWwm':function(_0x2dc734){return _0x2dc734();},'mPWSc':function(_0x592551,_0x448313,_0x219f07,_0x3a4499){return _0x592551(_0x448313,_0x219f07,_0x3a4499);},'LwNxF':function(_0x1105e1){return _0x1105e1();},'gkzQG':function(_0x43a02a,_0x55448c,_0x2241fe){return _0x43a02a(_0x55448c,_0x2241fe);},'oascq':function(_0x2c9eea,_0x202d5b){return _0x2c9eea!==_0x202d5b;},'giPbR':'--cdp-endpoint\x20must\x20not\x20be\x20empty.\x20Provide\x20the\x20CDP\x20URL,\x20e.g.\x20--cdp-endpoint\x20http://localhost:9222','dDZlO':_0x9c0cd7(0x137),'xDPee':'confirm','ucjfv':'overwrite','NibwX':_0x9c0cd7(0xf8),'IwekV':_0x9c0cd7(0x12d),'mkJaE':'\x0a🔌\x20CDP\x20Profile\x20Setup\x0a','jbyOD':'\x0a🌐\x20Profile\x20Setup\x0a','OzcTc':_0x9c0cd7(0x142),'UQVVB':_0x9c0cd7(0xf3),'PQyBI':'What\x20is\x20the\x20URL\x20of\x20your\x20running\x20app?','UfXYM':function(_0x2ff4ae,_0x2b8111){return _0x2ff4ae||_0x2b8111;},'ByjeW':function(_0x12ec14,_0x3534a2){return _0x12ec14(_0x3534a2);},'txwHg':_0x9c0cd7(0x119),'EnFmw':'What\x20would\x20you\x20like\x20to\x20do?','YMckm':'continue','IRKHs':function(_0x349cab,_0x4e1424){return _0x349cab===_0x4e1424;},'nJeZs':function(_0x48f258,_0x4edbd0,_0x36833d){return _0x48f258(_0x4edbd0,_0x36833d);},'JiaHU':function(_0x4bf62d,_0x41159a,_0x564944){return _0x4bf62d(_0x41159a,_0x564944);},'kMcHU':_0x9c0cd7(0x12a),'jUlvS':_0x9c0cd7(0xe9),'LBsVe':'\x20\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20to\x20the\x20profile\x20you\x20want\x20to\x20test\x20so\x20Ranger\x20can\x20access\x20it.','XDfaY':_0x9c0cd7(0x10c),'GPhIz':'about:blank','LZKEu':'utf-8','vyCnf':_0x9c0cd7(0x113),'QelmK':_0x9c0cd7(0x145),'fwZzd':function(_0x49bfe9,_0x4eb730,_0x2619b5){return _0x49bfe9(_0x4eb730,_0x2619b5);},'gHmtB':function(_0x3f9109,_0x222651){return _0x3f9109+_0x222651;},'ONpkL':_0x9c0cd7(0x120),'hAWXH':_0x9c0cd7(0xfb),'ivdUM':_0x9c0cd7(0x102),'GuAPC':'config_write','mxEHF':'settings.json','widpb':function(_0x862f04,_0x2c3e3b){return _0x862f04===_0x2c3e3b;},'TcKDZ':function(_0x364696,_0x532cdc,_0x508f2e){return _0x364696(_0x532cdc,_0x508f2e);},'LZPFm':function(_0x5f1763,_0xdc467a,_0x559811){return _0x5f1763(_0xdc467a,_0x559811);},'jqjYF':function(_0x2c2292,_0x1ead44){return _0x2c2292(_0x1ead44);},'mTPer':'Warning:\x20Profile\x20created,\x20but\x20failed\x20to\x20mark\x20it\x20as\x20active.'},_0x2d0464=_0x59a037['ci']??![],_0x4bd187=_0x2d0464?'ci':_0x9c0cd7(0x104),_0x2f4e3a=_0x2cf9cb[_0x9c0cd7(0x13b)](join,_0x2cf9cb[_0x9c0cd7(0xf5)](getRangerDir),_0x4bd187,_0x320b96),_0x1e7ce7=_0x2cf9cb['gkzQG'](join,_0x2cf9cb[_0x9c0cd7(0xf5)](getRangerDir),_0x4bd187);if(_0x2cf9cb[_0x9c0cd7(0x128)](_0x59a037['cdpEndpoint'],undefined)&&_0x59a037['cdpEndpoint'][_0x9c0cd7(0xf4)]()==='')throw new Error(_0x2cf9cb[_0x9c0cd7(0x147)]);if(_0x59a037['cdpEndpoint']&&_0x59a037[_0x9c0cd7(0x114)])throw new Error(_0x2cf9cb['dDZlO']);if(_0x59a037['cdpEndpoint']&&_0x59a037['ci'])throw new Error('--ci\x20and\x20--cdp-endpoint\x20cannot\x20be\x20used\x20together.\x20Electron/CDP\x20profiles\x20only\x20work\x20with\x20a\x20locally\x20running\x20app\x20and\x20are\x20not\x20supported\x20in\x20CI.');const _0x2e4304=Boolean(_0x59a037[_0x9c0cd7(0x11b)]),_0x51f660=!_0x59a037['skipAuth']&&!_0x2e4304,_0x34bd5d=process[_0x9c0cd7(0xea)]['isTTY']&&process[_0x9c0cd7(0x13e)]['isTTY'];if(!_0x34bd5d&&!_0x59a037['url']&&!_0x2e4304)throw new Error(_0x9c0cd7(0xf7));const _0x45a5dd=findExistingEnv(_0x320b96);let _0x47d948=null;if(_0x45a5dd){if(!_0x34bd5d)_0x47d948=_0x45a5dd;else{if(_0x45a5dd['location']===_0x4bd187){const {overwrite:_0x2f0f40}=await _0x143fad['prompt']([{'type':_0x2cf9cb['xDPee'],'name':_0x2cf9cb['ucjfv'],'message':'Profile\x20\x22'+_0x320b96+_0x9c0cd7(0x121),'default':![]}]);if(!_0x2f0f40){console[_0x9c0cd7(0x127)](_0x9c0cd7(0x146));return;}_0x47d948=_0x45a5dd;}else{const _0x2eda86=_0x45a5dd['location']===_0x2cf9cb['NibwX']?'root\x20(.ranger/)':_0x45a5dd[_0x9c0cd7(0x13f)];console['error']('\x0a⚠️\x20\x20Profile\x20\x22'+_0x320b96+_0x9c0cd7(0x105)+_0x2eda86+':\x20'+_0x45a5dd[_0x9c0cd7(0x110)]),console[_0x9c0cd7(0x129)]('\x20\x20\x20Creating\x20it\x20in\x20'+_0x4bd187+'\x20would\x20shadow\x20the\x20existing\x20profile.');const {shouldReplace:_0x4f9d13}=await _0x143fad['prompt']([{'type':'confirm','name':'shouldReplace','message':_0x9c0cd7(0x107)+_0x4bd187+'?','default':![]}]);if(!_0x4f9d13){console[_0x9c0cd7(0x127)]('Aborted.');return;}_0x47d948=_0x45a5dd;}}}_0x47cf9c?.['trackPhaseStart'](_0x2cf9cb[_0x9c0cd7(0x111)]);let _0x1794f6='';if(_0x2e4304)console['log'](_0x2cf9cb[_0x9c0cd7(0x123)]),console['log']('\x20\x20Configuring\x20Ranger\x20to\x20connect\x20to:\x20'+_0x59a037['cdpEndpoint']),console[_0x9c0cd7(0x127)]('\x20\x20Make\x20sure\x20your\x20Electron\x20app\x20(or\x20browser)\x20is\x20running\x20with\x20remote\x20debugging\x20enabled.\x0a');else{if(_0x59a037[_0x9c0cd7(0x114)]){_0x1794f6=_0x59a037[_0x9c0cd7(0x114)];const _0x4d23bd=await checkUrlReachability(_0x1794f6);if(!_0x4d23bd['ok']&&!_0x59a037['force'])throw new Error(_0x9c0cd7(0x106)+_0x1794f6+':\x20'+_0x4d23bd[_0x9c0cd7(0x129)]+_0x9c0cd7(0xf2));!_0x4d23bd['ok']&&_0x59a037[_0x9c0cd7(0xf1)]&&console[_0x9c0cd7(0x127)](_0x9c0cd7(0x11d)+_0x1794f6+':\x20'+_0x4d23bd['error']+_0x9c0cd7(0x103));}else{console[_0x9c0cd7(0x127)](_0x2cf9cb['jbyOD']),console[_0x9c0cd7(0x127)]('\x20\x20Make\x20sure\x20your\x20app\x20is\x20running\x20locally\x20before\x20continuing.'),console[_0x9c0cd7(0x127)]('\x20\x20Ranger\x20will\x20open\x20it\x20in\x20a\x20browser\x20so\x20you\x20can\x20log\x20in\x20and\x20save\x20your\x20session.\x0a');let _0x1f0013=![];while(!![]){const _0x327efa=await _0x143fad['prompt']([{'type':_0x2cf9cb[_0x9c0cd7(0x10d)],'name':'baseUrl','message':_0x1f0013?_0x2cf9cb[_0x9c0cd7(0x140)]:_0x2cf9cb['PQyBI'],'default':_0x2cf9cb['UfXYM'](_0x1794f6,_0x9c0cd7(0x101))}]);_0x1794f6=_0x327efa['baseUrl'];const _0x30aa22=await _0x2cf9cb[_0x9c0cd7(0x10b)](checkUrlReachability,_0x1794f6);if(_0x30aa22['ok'])break;const _0x35b926=/^[a-zA-Z][\w+.-]*:\/\//['test'](_0x1794f6),_0x140f4e=_0x30aa22['isProtocolError']&&!_0x35b926,_0x2c0a8a=_0x140f4e?_0x9c0cd7(0xe8)+_0x1794f6:null;_0x1f0013=!![],console[_0x9c0cd7(0x127)]('\x0a\x20\x20Could\x20not\x20reach\x20'+_0x1794f6+':\x20'+_0x30aa22['error']);_0x2c0a8a&&console[_0x9c0cd7(0x127)](_0x9c0cd7(0x109)+_0x2c0a8a+'?');const {action:_0xbca668}=await _0x143fad[_0x9c0cd7(0x100)]([{'type':_0x9c0cd7(0xfd),'name':_0x2cf9cb['txwHg'],'message':_0x2cf9cb['EnFmw'],'choices':[..._0x2c0a8a?[{'name':_0x9c0cd7(0x132)+_0x2c0a8a,'value':'use_suggestion'}]:[],{'name':'Enter\x20a\x20different\x20URL','value':'retry'},{'name':'Continue\x20anyway','value':_0x2cf9cb[_0x9c0cd7(0x11e)]}]}]);if(_0x2cf9cb[_0x9c0cd7(0x10a)](_0xbca668,'use_suggestion')&&_0x2c0a8a){_0x1794f6=_0x2c0a8a;const _0x415a0b=await checkUrlReachability(_0x1794f6);if(_0x415a0b['ok'])break;console[_0x9c0cd7(0x127)]('\x0a\x20\x20Still\x20could\x20not\x20reach\x20'+_0x1794f6+':\x20'+_0x415a0b['error']);}else{if(_0xbca668==='continue')break;}}}}_0x47cf9c?.[_0x9c0cd7(0x143)](_0x9c0cd7(0x12d)),await _0x2cf9cb[_0x9c0cd7(0x13d)](mkdir,_0x1e7ce7,{'recursive':!![]});const _0x4aa6d5=await mkdtemp(join(_0x1e7ce7,_0x9c0cd7(0x149)+_0x320b96+'-')),_0x15b3cc=_0x2cf9cb[_0x9c0cd7(0x124)](join,_0x4aa6d5,_0x2cf9cb['kMcHU']);try{if(_0x51f660){_0x47cf9c?.['trackPhaseStart'](_0x2cf9cb[_0x9c0cd7(0x148)]),console['log']('\x0a📋\x20Authentication\x20Setup'),console['log'](_0x2cf9cb[_0x9c0cd7(0x118)]),console[_0x9c0cd7(0x127)]('\x20\x20\x20When\x20done\x20logging\x20in,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.');!_0x34bd5d?(console[_0x9c0cd7(0x127)](_0x2cf9cb['XDfaY']),console['log'](_0x9c0cd7(0xeb))):console['log']('');await new Promise(_0x4b92ff=>setTimeout(_0x4b92ff,0xbb8));const _0x4282cc=await chromium['launch']({'headless':![]});try{const _0xc4e2aa=await _0x4282cc[_0x9c0cd7(0xec)]();await _0x2cf9cb[_0x9c0cd7(0x10b)](addProfileSetupBanner,_0xc4e2aa);const _0x564c65=await _0xc4e2aa['newPage']();await _0x564c65[_0x9c0cd7(0x126)](_0x2cf9cb[_0x9c0cd7(0x13c)](_0x1794f6,_0x2cf9cb['GPhIz'])),await new Promise(_0x4116a3=>{const _0x357781=_0x9c0cd7,_0x37f949={'uKiga':function(_0x89d0db){return _0x2cf9cb['VRWwm'](_0x89d0db);}};_0x564c65['on'](_0x357781(0x12f),async()=>{try{console['log']('Saving\x20authentication\x20state...'),await _0xc4e2aa['storageState']({'path':_0x15b3cc});}catch{}_0x37f949['uKiga'](_0x4116a3);});});}finally{await _0x4282cc[_0x9c0cd7(0x12f)]()[_0x9c0cd7(0x133)](()=>{});}if(_0x2d0464){const _0x2b9496=await _0x2cf9cb['nJeZs'](readFile,_0x15b3cc,_0x2cf9cb[_0x9c0cd7(0x11c)]),_0x52ae50=await _0x2cf9cb[_0x9c0cd7(0x108)](getToken);if(!_0x52ae50){console['error'](_0x2cf9cb[_0x9c0cd7(0xf9)]),await unlink(_0x15b3cc)['catch'](()=>{});throw new Error(_0x2cf9cb[_0x9c0cd7(0x139)]);}else{const _0x35942c=_0x2cf9cb[_0x9c0cd7(0x122)](encrypt,_0x2b9496,_0x52ae50);await _0x2cf9cb['fwZzd'](writeFile,_0x2cf9cb['gHmtB'](_0x15b3cc,_0x2cf9cb['ONpkL']),_0x35942c),await unlink(_0x15b3cc),console[_0x9c0cd7(0x127)](_0x9c0cd7(0xfe)+_0x15b3cc+_0x9c0cd7(0x120)),console[_0x9c0cd7(0x127)](_0x2cf9cb[_0x9c0cd7(0x138)]),console['log'](_0x2cf9cb['ivdUM']);}}else console[_0x9c0cd7(0x127)]('✓\x20Auth\x20state\x20saved\x20to:\x20'+_0x15b3cc);_0x47cf9c?.[_0x9c0cd7(0x143)](_0x2cf9cb[_0x9c0cd7(0x148)]);}_0x47cf9c?.[_0x9c0cd7(0x112)](_0x2cf9cb[_0x9c0cd7(0x10f)]);const _0x382d73={};_0x1794f6&&(_0x382d73[_0x9c0cd7(0x116)]=_0x1794f6);_0x59a037['cdpEndpoint']&&(_0x382d73[_0x9c0cd7(0x11b)]=_0x59a037['cdpEndpoint'],_0x382d73[_0x9c0cd7(0xfc)]=!![]);await writeFile(_0x2cf9cb[_0x9c0cd7(0x13d)](join,_0x4aa6d5,'settings.json'),JSON['stringify'](_0x382d73,null,0x2)),console['log'](_0x9c0cd7(0x12b)+join(_0x2f4e3a,_0x2cf9cb[_0x9c0cd7(0x136)]));if(_0x2cf9cb['widpb'](_0x47d948?.['location'],_0x4bd187)){const _0x1491ca=_0x47d948[_0x9c0cd7(0x110)]+'.backup-'+Date[_0x9c0cd7(0x115)]();await _0x2cf9cb[_0x9c0cd7(0x124)](rename,_0x47d948[_0x9c0cd7(0x110)],_0x1491ca);try{await _0x2cf9cb[_0x9c0cd7(0xff)](rename,_0x4aa6d5,_0x2f4e3a);}catch(_0x6aebe6){await _0x2cf9cb['LZPFm'](rename,_0x1491ca,_0x47d948['path']);throw _0x6aebe6;}try{await rm(_0x1491ca,{'recursive':!![]});}catch{console['log'](_0x9c0cd7(0xef)+_0x1491ca);}}else{await rename(_0x4aa6d5,_0x2f4e3a);if(_0x47d948)try{await rm(_0x47d948['path'],{'recursive':!![]}),console['log']('Removed\x20existing\x20profile\x20at\x20'+_0x47d948[_0x9c0cd7(0x110)]);}catch{console[_0x9c0cd7(0x127)]('Warning:\x20Could\x20not\x20remove\x20old\x20profile\x20at\x20'+_0x47d948['path']);}}try{await _0x2cf9cb['jqjYF'](writeActiveProfileName,_0x320b96),console[_0x9c0cd7(0x127)](_0x9c0cd7(0x141)+_0x320b96);}catch{console['log'](_0x2cf9cb[_0x9c0cd7(0x130)]);}_0x47cf9c?.['trackPhaseEnd'](_0x2cf9cb[_0x9c0cd7(0x10f)]),console[_0x9c0cd7(0x127)](_0x9c0cd7(0xfa)+_0x320b96+_0x9c0cd7(0x131));}catch(_0x1dd11a){await rm(_0x4aa6d5,{'recursive':!![],'force':!![]});throw _0x1dd11a;}}
|
|
@@ -1,36 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { join } from 'path';
|
|
3
|
-
import { existsSync } from 'fs';
|
|
4
|
-
import { encrypt } from './utils/crypto.js';
|
|
5
|
-
import { getToken } from './utils/keychain.js';
|
|
6
|
-
import { getEnvDir } from './utils/settings.js';
|
|
7
|
-
export async function authEncrypt(envName) {
|
|
8
|
-
const envDir = getEnvDir(envName);
|
|
9
|
-
const authPath = join(envDir, 'auth.json');
|
|
10
|
-
const encryptedPath = authPath + '.enc';
|
|
11
|
-
// Check if profile exists
|
|
12
|
-
if (!existsSync(envDir)) {
|
|
13
|
-
throw new Error(`Profile "${envName}" not found. Run first: ranger profile add ${envName}`);
|
|
14
|
-
}
|
|
15
|
-
// Check if auth.json exists
|
|
16
|
-
if (!existsSync(authPath)) {
|
|
17
|
-
throw new Error(`No auth.json found at ${authPath}. Run first: ranger profile add with authentication, or ranger profile update`);
|
|
18
|
-
}
|
|
19
|
-
// Get token (checks env var first, then ~/.ranger/cli.txt)
|
|
20
|
-
const token = await getToken();
|
|
21
|
-
if (!token) {
|
|
22
|
-
throw new Error('No API token found. Run: ranger setup [token]');
|
|
23
|
-
}
|
|
24
|
-
// Read and encrypt
|
|
25
|
-
const authContent = await readFile(authPath, 'utf-8');
|
|
26
|
-
const encrypted = encrypt(authContent, token);
|
|
27
|
-
await writeFile(encryptedPath, encrypted);
|
|
28
|
-
console.log(`\n✓ Encrypted auth saved to: ${encryptedPath}`);
|
|
29
|
-
console.log(' You can safely commit this file to git.');
|
|
30
|
-
console.log(' Run ranger setup in CI to decrypt at runtime.');
|
|
31
|
-
if (existsSync(encryptedPath)) {
|
|
32
|
-
console.log(`\n The plaintext auth.json is gitignored for security.`);
|
|
33
|
-
console.log(` The encrypted auth.json.enc can be committed.`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=authEncrypt.js.map
|
|
1
|
+
(function(_0x5e0716,_0x1a5c98){const _0x2380fc=_0x432c,_0x2cf13e=_0x5e0716();while(!![]){try{const _0x8b4d71=parseInt(_0x2380fc(0x88))/0x1+parseInt(_0x2380fc(0x95))/0x2*(parseInt(_0x2380fc(0x92))/0x3)+-parseInt(_0x2380fc(0x96))/0x4+parseInt(_0x2380fc(0x93))/0x5+parseInt(_0x2380fc(0x84))/0x6*(parseInt(_0x2380fc(0x97))/0x7)+parseInt(_0x2380fc(0x8a))/0x8*(-parseInt(_0x2380fc(0x8c))/0x9)+-parseInt(_0x2380fc(0x89))/0xa;if(_0x8b4d71===_0x1a5c98)break;else _0x2cf13e['push'](_0x2cf13e['shift']());}catch(_0x1b0015){_0x2cf13e['push'](_0x2cf13e['shift']());}}}(_0x22c7,0xa6086));import{readFile,writeFile}from'fs/promises';import{join}from'path';import{existsSync}from'fs';function _0x432c(_0x53cfd7,_0x2c530e){_0x53cfd7=_0x53cfd7-0x83;const _0x22c778=_0x22c7();let _0x432cbe=_0x22c778[_0x53cfd7];return _0x432cbe;}import{encrypt}from'./utils/crypto.js';import{getToken}from'./utils/keychain.js';import{getEnvDir}from'./utils/settings.js';export async function authEncrypt(_0x4dd3d7){const _0x5131c2=_0x432c,_0x7549f9={'bUUbv':function(_0x148375,_0x531e97,_0x1fec85){return _0x148375(_0x531e97,_0x1fec85);},'gDgAb':function(_0x49a427,_0x22d8b9){return _0x49a427+_0x22d8b9;},'RNmOA':_0x5131c2(0x91),'eLpys':function(_0x88da94,_0x401c6e){return _0x88da94(_0x401c6e);},'IHEcn':function(_0x3e868d){return _0x3e868d();},'HBeFP':function(_0x46f0a0,_0xe3a2ba,_0x2d80e8){return _0x46f0a0(_0xe3a2ba,_0x2d80e8);},'anWzf':function(_0x301413,_0x4dfe54,_0x4733cd){return _0x301413(_0x4dfe54,_0x4733cd);},'ixhEx':function(_0x96b5b9,_0x5449d6,_0xaafeba){return _0x96b5b9(_0x5449d6,_0xaafeba);},'Enwkk':_0x5131c2(0x94)},_0x58a23e=getEnvDir(_0x4dd3d7),_0x3d58c5=_0x7549f9[_0x5131c2(0x87)](join,_0x58a23e,'auth.json'),_0x100840=_0x7549f9['gDgAb'](_0x3d58c5,_0x7549f9[_0x5131c2(0x90)]);if(!_0x7549f9[_0x5131c2(0x85)](existsSync,_0x58a23e))throw new Error(_0x5131c2(0x83)+_0x4dd3d7+'\x22\x20not\x20found.\x20Run\x20first:\x20ranger\x20profile\x20add\x20'+_0x4dd3d7);if(!_0x7549f9[_0x5131c2(0x85)](existsSync,_0x3d58c5))throw new Error('No\x20auth.json\x20found\x20at\x20'+_0x3d58c5+_0x5131c2(0x8b));const _0x55a0c6=await _0x7549f9['IHEcn'](getToken);if(!_0x55a0c6)throw new Error('No\x20API\x20token\x20found.\x20Run:\x20ranger\x20setup\x20[token]');const _0x3d73df=await _0x7549f9['HBeFP'](readFile,_0x3d58c5,_0x5131c2(0x8e)),_0xe7fb=_0x7549f9['anWzf'](encrypt,_0x3d73df,_0x55a0c6);await _0x7549f9[_0x5131c2(0x8f)](writeFile,_0x100840,_0xe7fb),console['log'](_0x5131c2(0x86)+_0x100840),console['log']('\x20\x20You\x20can\x20safely\x20commit\x20this\x20file\x20to\x20git.'),console['log'](_0x7549f9['Enwkk']),existsSync(_0x100840)&&(console[_0x5131c2(0x8d)]('\x0a\x20\x20The\x20plaintext\x20auth.json\x20is\x20gitignored\x20for\x20security.'),console['log'](_0x5131c2(0x98)));}function _0x22c7(){const _0x4be605=['ixhEx','RNmOA','.enc','15969WJYHdZ','1156675VubWBS','\x20\x20Run\x20ranger\x20setup\x20in\x20CI\x20to\x20decrypt\x20at\x20runtime.','102VSCSlg','2849520ZUeVUz','90671dXAnbx','\x20\x20The\x20encrypted\x20auth.json.enc\x20can\x20be\x20committed.','Profile\x20\x22','606GtKQbU','eLpys','\x0a✓\x20Encrypted\x20auth\x20saved\x20to:\x20','bUUbv','866163dgHJXt','5161930ndmyYL','9416Dhrtxn','.\x20Run\x20first:\x20ranger\x20profile\x20add\x20with\x20authentication,\x20or\x20ranger\x20profile\x20update','5877UJVdMs','log','utf-8'];_0x22c7=function(){return _0x4be605;};return _0x22c7();}
|
package/build/commands/clean.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function _0x77ba(_0x222f93,_0x5cf13){_0x222f93=_0x222f93-0x132;const _0x476ebf=_0x476e();let _0x77baa=_0x476ebf[_0x222f93];return _0x77baa;}(function(_0x29faed,_0x477202){const _0x1a4cd9=_0x77ba,_0x5a515e=_0x29faed();while(!![]){try{const _0x432f7f=parseInt(_0x1a4cd9(0x149))/0x1*(-parseInt(_0x1a4cd9(0x141))/0x2)+-parseInt(_0x1a4cd9(0x14a))/0x3*(-parseInt(_0x1a4cd9(0x14e))/0x4)+-parseInt(_0x1a4cd9(0x142))/0x5+parseInt(_0x1a4cd9(0x137))/0x6*(parseInt(_0x1a4cd9(0x148))/0x7)+-parseInt(_0x1a4cd9(0x138))/0x8*(parseInt(_0x1a4cd9(0x157))/0x9)+parseInt(_0x1a4cd9(0x143))/0xa*(-parseInt(_0x1a4cd9(0x14c))/0xb)+-parseInt(_0x1a4cd9(0x147))/0xc*(-parseInt(_0x1a4cd9(0x158))/0xd);if(_0x432f7f===_0x477202)break;else _0x5a515e['push'](_0x5a515e['shift']());}catch(_0x1c766e){_0x5a515e['push'](_0x5a515e['shift']());}}}(_0x476e,0xf06bc));import{rm}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import{spawn}from'child_process';import{deleteAllCredentials}from'./utils/keychain.js';import{getProjectSkillsDir,getUserSkillsDir}from'./utils/claudeConfig.js';function _0x476e(){const _0x34548c=['aPZro','✓\x20Removed\x20project\x20skill:\x20','FIhSP','YXcNc','ZPzGO','BbfIS','72iHMsJi','911651fkljlg','uninstall','uafWM','SJDch','remove','HwXey','538152vYchJz','1498376wWYrnf','win32','KaYHW','✓\x20Uninstalled\x20Claude\x20plugin\x20(user\x20scope)','marketplace','sVucw','platform','QUJOi','auPAf','40kPkTRY','7330370FGMUvJ','187550iMUuDT','FWPHm','VkfWg','dlxUT','816Vehvhd','133eeveJM','80887jXrSgL','1839975lqRbdR','feature-tracker','891iRAYdY','HtoEE','4uAmcup','QmLej','log'];_0x476e=function(){return _0x34548c;};return _0x476e();}import{getRangerDir}from'./utils/rangerRoot.js';import{getCacheFile}from'./utils/sessionCache.js';async function uninstallClaudePlugin(_0x58ee2f){const _0x2b8384=_0x77ba,_0x23c8b0={'HwXey':function(_0x2c1664,_0x4a7b86){return _0x2c1664(_0x4a7b86);},'jAhpO':function(_0x460ce5,_0x16113f){return _0x460ce5===_0x16113f;},'ZxuYr':_0x2b8384(0x132),'ZPzGO':'--scope','ckzfJ':function(_0x2f5ae2,_0x128cc0,_0xafdc18,_0x434ff3){return _0x2f5ae2(_0x128cc0,_0xafdc18,_0x434ff3);},'vUxbl':'claude','SJDch':function(_0x5779b8,_0x5d54ea){return _0x5779b8===_0x5d54ea;},'KaYHW':_0x2b8384(0x139)};return new Promise(_0x3842df=>{const _0x3faf5b=_0x2b8384,_0x19c594=['plugin',_0x23c8b0['ZxuYr'],'ranger@trailhead'];_0x58ee2f&&_0x19c594['push'](_0x23c8b0[_0x3faf5b(0x155)],_0x58ee2f);const _0x30d975=_0x23c8b0['ckzfJ'](spawn,_0x23c8b0['vUxbl'],_0x19c594,{'stdio':'pipe','shell':_0x23c8b0[_0x3faf5b(0x134)](process['platform'],_0x23c8b0[_0x3faf5b(0x13a)])});_0x30d975['on']('close',_0xba80ea=>{const _0x6551c3=_0x3faf5b;_0x23c8b0[_0x6551c3(0x136)](_0x3842df,_0x23c8b0['jAhpO'](_0xba80ea,0x0));}),_0x30d975['on']('error',()=>{_0x3842df(![]);});});}async function removeMarketplace(){const _0x1c0561=_0x77ba,_0x1fff7d={'sVucw':function(_0x1b5c0c,_0x3790ea){return _0x1b5c0c(_0x3790ea);},'xwGTG':function(_0x5a5307,_0x546a30,_0x47a3a0,_0x51a2c9){return _0x5a5307(_0x546a30,_0x47a3a0,_0x51a2c9);},'BbfIS':'claude','PPSAi':_0x1c0561(0x135),'QUJOi':function(_0x54eb31,_0x36ef69){return _0x54eb31===_0x36ef69;},'ZHium':_0x1c0561(0x139),'RlPwF':'close','VkfWg':'error'};return new Promise(_0x1f971c=>{const _0x59fe82=_0x1c0561,_0xf00cd={'QQyez':function(_0x19deea,_0x268447){return _0x19deea===_0x268447;},'aPZro':function(_0x1b1718,_0x505cd1){const _0x3fc1d7=_0x77ba;return _0x1fff7d[_0x3fc1d7(0x13d)](_0x1b1718,_0x505cd1);}},_0x2b14e4=_0x1fff7d['xwGTG'](spawn,_0x1fff7d[_0x59fe82(0x156)],['plugin',_0x59fe82(0x13c),_0x1fff7d['PPSAi'],'trailhead'],{'stdio':'pipe','shell':_0x1fff7d[_0x59fe82(0x13f)](process[_0x59fe82(0x13e)],_0x1fff7d['ZHium'])});_0x2b14e4['on'](_0x1fff7d['RlPwF'],_0x106bf3=>{_0x1f971c(_0xf00cd['QQyez'](_0x106bf3,0x0));}),_0x2b14e4['on'](_0x1fff7d[_0x59fe82(0x145)],()=>{const _0x3839a4=_0x59fe82;_0xf00cd[_0x3839a4(0x151)](_0x1f971c,![]);});});}export async function clean(){const _0x231440=_0x77ba,_0x693215={'FWPHm':'\x0a🧹\x20Cleaning\x20up\x20Ranger\x20artifacts...\x0a','EuPwU':'✓\x20Removed\x20stored\x20credentials','dlxUT':function(_0x244af1,_0x1926ee){return _0x244af1(_0x1926ee);},'FIhSP':function(_0x5b1935){return _0x5b1935();},'YDFmg':function(_0x5ecf4e,_0x32989c){return _0x5ecf4e(_0x32989c);},'uafWM':function(_0x36ac41,_0x2df61f,_0x28c279){return _0x36ac41(_0x2df61f,_0x28c279);},'juBxJ':'✓\x20Removed\x20.ranger/\x20directory','sPIJS':'ranger','BNfdW':function(_0x3f959b,_0x47b0fc,_0x22652d){return _0x3f959b(_0x47b0fc,_0x22652d);},'YXcNc':function(_0x194fb5,_0x54c60f,_0x143462){return _0x194fb5(_0x54c60f,_0x143462);},'wrTBC':_0x231440(0x13b),'auPAf':function(_0x46378d){return _0x46378d();},'mqPKA':'✓\x20Removed\x20trailhead\x20marketplace','QmLej':'\x0a✅\x20Cleanup\x20complete!\x0a','HtoEE':'Nothing\x20to\x20clean\x20up.\x0a'};console[_0x231440(0x150)](_0x693215[_0x231440(0x144)]);let _0x2479e2=![];try{await deleteAllCredentials(),console['log'](_0x693215['EuPwU']),_0x2479e2=!![];}catch{}const _0x492cbf=getCacheFile();_0x693215[_0x231440(0x146)](existsSync,_0x492cbf)&&(await rm(_0x492cbf),_0x2479e2=!![]);const _0x23d2cd=_0x693215['FIhSP'](getRangerDir);_0x693215['YDFmg'](existsSync,_0x23d2cd)&&(await _0x693215[_0x231440(0x133)](rm,_0x23d2cd,{'recursive':!![]}),console['log'](_0x693215['juBxJ']),_0x2479e2=!![]);const _0x24e566=[_0x693215['sPIJS'],_0x231440(0x14b),'bug-bash','e2e-test-recommender'],_0x2a967a=getProjectSkillsDir();for(const _0x5bd743 of _0x24e566){const _0x5450f8=_0x693215['BNfdW'](join,_0x2a967a,_0x5bd743);existsSync(_0x5450f8)&&(await rm(_0x5450f8,{'recursive':!![]}),console[_0x231440(0x150)](_0x231440(0x152)+_0x5bd743),_0x2479e2=!![]);}const _0x3717f4=_0x693215[_0x231440(0x153)](getUserSkillsDir);for(const _0x6c7090 of _0x24e566){const _0x5286e3=join(_0x3717f4,_0x6c7090);_0x693215['YDFmg'](existsSync,_0x5286e3)&&(await _0x693215[_0x231440(0x154)](rm,_0x5286e3,{'recursive':!![]}),console['log']('✓\x20Removed\x20user\x20skill:\x20'+_0x6c7090),_0x2479e2=!![]);}const _0x489fc5=await uninstallClaudePlugin();_0x489fc5&&(console['log'](_0x693215['wrTBC']),_0x2479e2=!![]);const _0x2e90cb=await uninstallClaudePlugin('project');_0x2e90cb&&(console['log']('✓\x20Uninstalled\x20Claude\x20plugin\x20(project\x20scope)'),_0x2479e2=!![]);const _0x294c1d=await _0x693215[_0x231440(0x140)](removeMarketplace);_0x294c1d&&(console['log'](_0x693215['mqPKA']),_0x2479e2=!![]),_0x2479e2?console[_0x231440(0x150)](_0x693215[_0x231440(0x14f)]):console['log'](_0x693215[_0x231440(0x14d)]);}
|
package/build/commands/config.js
CHANGED
|
@@ -1,93 +1 @@
|
|
|
1
|
-
import { existsSync }
|
|
2
|
-
import { loadSettings, saveSettings, getNestedValue, setNestedValue, deleteNestedValue, formatSettings, getSettingsPath, getEnvDir, } from './utils/settings.js';
|
|
3
|
-
// Keys that should be stored as booleans
|
|
4
|
-
const BOOLEAN_KEYS = ['headless'];
|
|
5
|
-
/**
|
|
6
|
-
* Parse a value string to its appropriate type
|
|
7
|
-
*/
|
|
8
|
-
function parseValue(key, value) {
|
|
9
|
-
// Check if this key should be a boolean
|
|
10
|
-
if (BOOLEAN_KEYS.includes(key)) {
|
|
11
|
-
if (value === 'true')
|
|
12
|
-
return true;
|
|
13
|
-
if (value === 'false')
|
|
14
|
-
return false;
|
|
15
|
-
throw new Error(`Invalid value for ${key}: expected "true" or "false"`);
|
|
16
|
-
}
|
|
17
|
-
return value;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Set a config value for a profile
|
|
21
|
-
*/
|
|
22
|
-
export async function configSet(env, key, value) {
|
|
23
|
-
const envDir = getEnvDir(env);
|
|
24
|
-
if (!existsSync(envDir)) {
|
|
25
|
-
throw new Error(`Profile "${env}" does not exist. Run: ranger profile add ${env}`);
|
|
26
|
-
}
|
|
27
|
-
const settings = await loadSettings(env);
|
|
28
|
-
const parsedValue = parseValue(key, value);
|
|
29
|
-
setNestedValue(settings, key, parsedValue);
|
|
30
|
-
await saveSettings(env, settings);
|
|
31
|
-
console.log(`Set ${key} = ${parsedValue}`);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Get a config value for a profile
|
|
35
|
-
*/
|
|
36
|
-
export async function configGet(env, key) {
|
|
37
|
-
const envDir = getEnvDir(env);
|
|
38
|
-
if (!existsSync(envDir)) {
|
|
39
|
-
throw new Error(`Profile "${env}" does not exist.`);
|
|
40
|
-
}
|
|
41
|
-
const settings = await loadSettings(env);
|
|
42
|
-
const value = getNestedValue(settings, key);
|
|
43
|
-
if (value === undefined) {
|
|
44
|
-
console.log(`(not set)`);
|
|
45
|
-
}
|
|
46
|
-
else if (typeof value === 'object') {
|
|
47
|
-
console.log(JSON.stringify(value, null, 2));
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
console.log(value);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* List all config for a profile
|
|
55
|
-
*/
|
|
56
|
-
export async function configList(env) {
|
|
57
|
-
const settingsPath = getSettingsPath(env);
|
|
58
|
-
if (!existsSync(settingsPath)) {
|
|
59
|
-
const envDir = getEnvDir(env);
|
|
60
|
-
if (!existsSync(envDir)) {
|
|
61
|
-
throw new Error(`Profile "${env}" does not exist.`);
|
|
62
|
-
}
|
|
63
|
-
console.log(`No configuration set for "${env}"`);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const settings = await loadSettings(env);
|
|
67
|
-
const formatted = formatSettings(settings);
|
|
68
|
-
if (!formatted) {
|
|
69
|
-
console.log(`No configuration set for "${env}"`);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
console.log(formatted);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Remove a config value for a profile
|
|
77
|
-
*/
|
|
78
|
-
export async function configUnset(env, key) {
|
|
79
|
-
const envDir = getEnvDir(env);
|
|
80
|
-
if (!existsSync(envDir)) {
|
|
81
|
-
throw new Error(`Profile "${env}" does not exist.`);
|
|
82
|
-
}
|
|
83
|
-
const settings = await loadSettings(env);
|
|
84
|
-
const deleted = deleteNestedValue(settings, key);
|
|
85
|
-
if (deleted) {
|
|
86
|
-
await saveSettings(env, settings);
|
|
87
|
-
console.log(`Removed ${key}`);
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
console.log(`Key "${key}" not found`);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
//# sourceMappingURL=config.js.map
|
|
1
|
+
(function(_0x2f4043,_0x6c6c0e){const _0x1bf2fc=_0x3bfd,_0x59aadf=_0x2f4043();while(!![]){try{const _0x2c2f62=parseInt(_0x1bf2fc(0x1af))/0x1*(parseInt(_0x1bf2fc(0x1bf))/0x2)+-parseInt(_0x1bf2fc(0x1a1))/0x3*(parseInt(_0x1bf2fc(0x1a8))/0x4)+-parseInt(_0x1bf2fc(0x1b3))/0x5+-parseInt(_0x1bf2fc(0x1b2))/0x6*(parseInt(_0x1bf2fc(0x1ba))/0x7)+parseInt(_0x1bf2fc(0x1ad))/0x8+-parseInt(_0x1bf2fc(0x1b8))/0x9*(-parseInt(_0x1bf2fc(0x1bd))/0xa)+parseInt(_0x1bf2fc(0x1be))/0xb;if(_0x2c2f62===_0x6c6c0e)break;else _0x59aadf['push'](_0x59aadf['shift']());}catch(_0x596968){_0x59aadf['push'](_0x59aadf['shift']());}}}(_0x4086,0x8d3a0));import{existsSync}from'fs';import{loadSettings,saveSettings,getNestedValue,setNestedValue,deleteNestedValue,formatSettings,getSettingsPath,getEnvDir}from'./utils/settings.js';function _0x4086(){const _0x348fa5=['\x20=\x20','mVQyd','SazNQ','hGCKG','4408632jKuAvo','true','216754Uutvqk',':\x20expected\x20\x22true\x22\x20or\x20\x22false\x22','Removed\x20','10074rSpett','1353540VOitBm','pyXcO','false','Set\x20','poUCh','1179KhKKhT','No\x20configuration\x20set\x20for\x20\x22','2149UIUIxO','\x22\x20does\x20not\x20exist.\x20Run:\x20ranger\x20profile\x20add\x20','igCJn','58010BDfdMV','5604995bdeBqH','4JPfXWh','dbQNw','3jrNfrK','\x22\x20not\x20found','BvcZi','object','Profile\x20\x22','\x22\x20does\x20not\x20exist.','log','3557752LCUggI'];_0x4086=function(){return _0x348fa5;};return _0x4086();}function _0x3bfd(_0x3b794a,_0x127c1b){_0x3b794a=_0x3b794a-0x1a0;const _0x40863c=_0x4086();let _0x3bfd24=_0x40863c[_0x3b794a];return _0x3bfd24;}const BOOLEAN_KEYS=['headless'];function parseValue(_0x231bde,_0x1d13a9){const _0x7fe4c1=_0x3bfd,_0x2d8d5d={'moZFL':function(_0x56bb51,_0x5ddec7){return _0x56bb51===_0x5ddec7;},'igCJn':_0x7fe4c1(0x1b5)};if(BOOLEAN_KEYS['includes'](_0x231bde)){if(_0x1d13a9===_0x7fe4c1(0x1ae))return!![];if(_0x2d8d5d['moZFL'](_0x1d13a9,_0x2d8d5d[_0x7fe4c1(0x1bc)]))return![];throw new Error('Invalid\x20value\x20for\x20'+_0x231bde+_0x7fe4c1(0x1b0));}return _0x1d13a9;}export async function configSet(_0x19df88,_0xe59783,_0x162744){const _0x1f15cb=_0x3bfd,_0x2dc8ed={'dbQNw':function(_0x25aeae,_0x3175a9){return _0x25aeae(_0x3175a9);},'SazNQ':function(_0x13802d,_0x50a892,_0x3b165e){return _0x13802d(_0x50a892,_0x3b165e);},'YXDwv':function(_0x357b75,_0xac509e,_0x2e8054,_0x4525fb){return _0x357b75(_0xac509e,_0x2e8054,_0x4525fb);}},_0x572cad=_0x2dc8ed[_0x1f15cb(0x1a0)](getEnvDir,_0x19df88);if(!existsSync(_0x572cad))throw new Error(_0x1f15cb(0x1a5)+_0x19df88+_0x1f15cb(0x1bb)+_0x19df88);const _0x1c16c8=await loadSettings(_0x19df88),_0x4ec9b1=_0x2dc8ed['SazNQ'](parseValue,_0xe59783,_0x162744);_0x2dc8ed['YXDwv'](setNestedValue,_0x1c16c8,_0xe59783,_0x4ec9b1),await _0x2dc8ed[_0x1f15cb(0x1ab)](saveSettings,_0x19df88,_0x1c16c8),console['log'](_0x1f15cb(0x1b6)+_0xe59783+_0x1f15cb(0x1a9)+_0x4ec9b1);}export async function configGet(_0x169de7,_0x2c65fb){const _0x10e409=_0x3bfd,_0x1712f6={'hGCKG':function(_0x52cbd1,_0x18457b){return _0x52cbd1(_0x18457b);},'pyXcO':function(_0x51be59,_0x26b82e){return _0x51be59(_0x26b82e);},'mVQyd':function(_0xf40a08,_0xce6bd7,_0x1b688e){return _0xf40a08(_0xce6bd7,_0x1b688e);},'zVhsR':_0x10e409(0x1a4)},_0x2c29b4=_0x1712f6[_0x10e409(0x1ac)](getEnvDir,_0x169de7);if(!_0x1712f6[_0x10e409(0x1b4)](existsSync,_0x2c29b4))throw new Error(_0x10e409(0x1a5)+_0x169de7+'\x22\x20does\x20not\x20exist.');const _0x4b91fe=await loadSettings(_0x169de7),_0x24741f=_0x1712f6[_0x10e409(0x1aa)](getNestedValue,_0x4b91fe,_0x2c65fb);if(_0x24741f===undefined)console[_0x10e409(0x1a7)]('(not\x20set)');else typeof _0x24741f===_0x1712f6['zVhsR']?console[_0x10e409(0x1a7)](JSON['stringify'](_0x24741f,null,0x2)):console['log'](_0x24741f);}export async function configList(_0x34e6e1){const _0x238569=_0x3bfd,_0x3910be={'BvcZi':function(_0x45a8c8,_0x507a07){return _0x45a8c8(_0x507a07);}},_0x5f17ef=_0x3910be['BvcZi'](getSettingsPath,_0x34e6e1);if(!existsSync(_0x5f17ef)){const _0x29f5c3=getEnvDir(_0x34e6e1);if(!_0x3910be[_0x238569(0x1a3)](existsSync,_0x29f5c3))throw new Error(_0x238569(0x1a5)+_0x34e6e1+'\x22\x20does\x20not\x20exist.');console['log'](_0x238569(0x1b9)+_0x34e6e1+'\x22');return;}const _0x23763c=await _0x3910be['BvcZi'](loadSettings,_0x34e6e1),_0x3d4f68=formatSettings(_0x23763c);!_0x3d4f68?console['log'](_0x238569(0x1b9)+_0x34e6e1+'\x22'):console['log'](_0x3d4f68);}export async function configUnset(_0x69c9db,_0x53ec99){const _0x2e4761=_0x3bfd,_0xd0c10={'poUCh':function(_0xee73a6,_0x31b39b,_0x3a200d){return _0xee73a6(_0x31b39b,_0x3a200d);}},_0x226194=getEnvDir(_0x69c9db);if(!existsSync(_0x226194))throw new Error('Profile\x20\x22'+_0x69c9db+_0x2e4761(0x1a6));const _0x5c6fa1=await loadSettings(_0x69c9db),_0x33cf86=_0xd0c10[_0x2e4761(0x1b7)](deleteNestedValue,_0x5c6fa1,_0x53ec99);_0x33cf86?(await saveSettings(_0x69c9db,_0x5c6fa1),console['log'](_0x2e4761(0x1b1)+_0x53ec99)):console['log']('Key\x20\x22'+_0x53ec99+_0x2e4761(0x1a2));}
|
package/build/commands/env.js
CHANGED
|
@@ -1,98 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { join } from 'path';
|
|
3
|
-
import { existsSync } from 'fs';
|
|
4
|
-
import { getRangerDir } from './utils/rangerRoot.js';
|
|
5
|
-
import { loadSettings } from './utils/settings.js';
|
|
6
|
-
import { readActiveProfileName } from './utils/activeProfile.js';
|
|
7
|
-
// Directories that are not environments (used for legacy scanning)
|
|
8
|
-
const NON_ENV_DIRS = ['sessions', 'bug-bashes', 'reports', 'local', 'ci'];
|
|
9
|
-
/**
|
|
10
|
-
* Get list of profile names, their types, and active profile from .ranger directory.
|
|
11
|
-
* Scans local/, ci/ subdirectories and legacy root-level environments for backward compatibility.
|
|
12
|
-
*/
|
|
13
|
-
export async function getEnvNames() {
|
|
14
|
-
const rangerDir = getRangerDir();
|
|
15
|
-
if (!existsSync(rangerDir)) {
|
|
16
|
-
return { envNames: [], activeEnv: null, envTypes: {} };
|
|
17
|
-
}
|
|
18
|
-
// Get active profile
|
|
19
|
-
const activeEnv = await readActiveProfileName();
|
|
20
|
-
const envNames = [];
|
|
21
|
-
const envTypes = {};
|
|
22
|
-
// Scan local/ directory
|
|
23
|
-
const localDir = join(rangerDir, 'local');
|
|
24
|
-
if (existsSync(localDir)) {
|
|
25
|
-
const localEntries = await readdir(localDir);
|
|
26
|
-
for (const entry of localEntries) {
|
|
27
|
-
const entryPath = join(localDir, entry);
|
|
28
|
-
const entryStat = await stat(entryPath);
|
|
29
|
-
if (entryStat.isDirectory()) {
|
|
30
|
-
envNames.push(entry);
|
|
31
|
-
envTypes[entry] = 'local';
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
// Scan ci/ directory
|
|
36
|
-
const ciDir = join(rangerDir, 'ci');
|
|
37
|
-
if (existsSync(ciDir)) {
|
|
38
|
-
const ciEntries = await readdir(ciDir);
|
|
39
|
-
for (const entry of ciEntries) {
|
|
40
|
-
const entryPath = join(ciDir, entry);
|
|
41
|
-
const entryStat = await stat(entryPath);
|
|
42
|
-
if (entryStat.isDirectory()) {
|
|
43
|
-
envNames.push(entry);
|
|
44
|
-
envTypes[entry] = 'ci';
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
// Scan root .ranger/ for legacy environments (backward compatibility)
|
|
49
|
-
const rootEntries = await readdir(rangerDir);
|
|
50
|
-
for (const entry of rootEntries) {
|
|
51
|
-
// Skip known non-environment directories and files
|
|
52
|
-
if (NON_ENV_DIRS.includes(entry))
|
|
53
|
-
continue;
|
|
54
|
-
if (entry.startsWith('.'))
|
|
55
|
-
continue; // Skip dotfiles like .gitignore
|
|
56
|
-
if (entry.endsWith('.txt'))
|
|
57
|
-
continue; // Skip files like active-profile.txt
|
|
58
|
-
const entryPath = join(rangerDir, entry);
|
|
59
|
-
const entryStat = await stat(entryPath);
|
|
60
|
-
// Only include directories that have settings.json (actual environments)
|
|
61
|
-
if (entryStat.isDirectory() &&
|
|
62
|
-
existsSync(join(entryPath, 'settings.json'))) {
|
|
63
|
-
// Don't add if already found in local/ or ci/
|
|
64
|
-
if (!envNames.includes(entry)) {
|
|
65
|
-
envNames.push(entry);
|
|
66
|
-
envTypes[entry] = 'legacy';
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return { envNames, activeEnv, envTypes };
|
|
71
|
-
}
|
|
72
|
-
export async function envList() {
|
|
73
|
-
const { envNames, activeEnv, envTypes } = await getEnvNames();
|
|
74
|
-
if (envNames.length === 0) {
|
|
75
|
-
console.log('\nNo profiles found.');
|
|
76
|
-
console.log('Run: ranger profile add <profile-name>');
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
console.log('\nProfiles:');
|
|
80
|
-
for (const env of envNames.sort()) {
|
|
81
|
-
const isActive = env === activeEnv;
|
|
82
|
-
const envType = envTypes[env] || 'local';
|
|
83
|
-
const settings = await loadSettings(env);
|
|
84
|
-
// Only show type tag for local/ci, not legacy
|
|
85
|
-
const typeTag = envType === 'legacy' ? '' : ` [${envType}]`;
|
|
86
|
-
console.log(` ${isActive ? '* ' : ' '}${env}${typeTag}`);
|
|
87
|
-
if (settings.baseUrl) {
|
|
88
|
-
console.log(` URL: ${settings.baseUrl}`);
|
|
89
|
-
}
|
|
90
|
-
if (settings.environmentDetails) {
|
|
91
|
-
console.log(` Details: ${settings.environmentDetails}`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
if (activeEnv) {
|
|
95
|
-
console.log(`\n* = active profile`);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
//# sourceMappingURL=env.js.map
|
|
1
|
+
function _0x37eb(_0x3d39d1,_0x431246){_0x3d39d1=_0x3d39d1-0x1ad;const _0x48297b=_0x4829();let _0x37ebbd=_0x48297b[_0x3d39d1];return _0x37ebbd;}const _0x595bb2=_0x37eb;function _0x4829(){const _0x2f3bdc=['\x0aProfiles:','XOWeW','380308KJVilV','nMaeD','487784xhKiLH','479760qJqmla','dmgjM','environmentDetails','bug-bashes','.txt','pQYBA','isDirectory','push','eIvgO','local','892367WTPnTf','308195sCmFlc','940722ZFuLPe','\x20\x20\x20\x20\x20\x20Details:\x20','legacy','IhzZW','239157OMWzkQ','ywjcd','includes','cLHbY','5ImQxOU','JozlM','log','baseUrl','settings.json','88dQgPPl'];_0x4829=function(){return _0x2f3bdc;};return _0x4829();}(function(_0x43f830,_0x2ecd96){const _0x3a4873=_0x37eb,_0xcb3aa4=_0x43f830();while(!![]){try{const _0x39c8a1=-parseInt(_0x3a4873(0x1b5))/0x1+parseInt(_0x3a4873(0x1c6))/0x2+-parseInt(_0x3a4873(0x1c9))/0x3+-parseInt(_0x3a4873(0x1c8))/0x4+-parseInt(_0x3a4873(0x1be))/0x5*(-parseInt(_0x3a4873(0x1b6))/0x6)+parseInt(_0x3a4873(0x1b4))/0x7+parseInt(_0x3a4873(0x1c3))/0x8*(parseInt(_0x3a4873(0x1ba))/0x9);if(_0x39c8a1===_0x2ecd96)break;else _0xcb3aa4['push'](_0xcb3aa4['shift']());}catch(_0x56516d){_0xcb3aa4['push'](_0xcb3aa4['shift']());}}}(_0x4829,0x2b218));import{readdir,stat}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import{getRangerDir}from'./utils/rangerRoot.js';import{loadSettings}from'./utils/settings.js';import{readActiveProfileName}from'./utils/activeProfile.js';const NON_ENV_DIRS=['sessions',_0x595bb2(0x1ad),'reports',_0x595bb2(0x1b3),'ci'];export async function getEnvNames(){const _0x57f034=_0x595bb2,_0x534fca={'ySLLn':function(_0x45c90f){return _0x45c90f();},'cLHbY':function(_0x22a404,_0x13f957){return _0x22a404(_0x13f957);},'YUdTz':function(_0x326620,_0x2475bf,_0xe14ee5){return _0x326620(_0x2475bf,_0xe14ee5);},'JozlM':function(_0x2e8cb3,_0x4c2388){return _0x2e8cb3(_0x4c2388);},'KwfUY':function(_0x30c7f7,_0x54e21,_0x21ebc6){return _0x30c7f7(_0x54e21,_0x21ebc6);},'nMaeD':function(_0x9f4327,_0x7ae24a){return _0x9f4327(_0x7ae24a);},'ywjcd':function(_0x24deae,_0x4c8092){return _0x24deae(_0x4c8092);},'dmgjM':function(_0x491e5e,_0x2b39d0){return _0x491e5e(_0x2b39d0);},'Leuxy':function(_0x38bb8c,_0x572dad,_0x4368a8){return _0x38bb8c(_0x572dad,_0x4368a8);},'lrEPY':_0x57f034(0x1b8)},_0x5f27db=_0x534fca['ySLLn'](getRangerDir);if(!_0x534fca[_0x57f034(0x1bd)](existsSync,_0x5f27db))return{'envNames':[],'activeEnv':null,'envTypes':{}};const _0x52591d=await readActiveProfileName(),_0x12b520=[],_0x364f1c={},_0x1a7715=_0x534fca['YUdTz'](join,_0x5f27db,_0x57f034(0x1b3));if(_0x534fca[_0x57f034(0x1bf)](existsSync,_0x1a7715)){const _0x4be1b6=await readdir(_0x1a7715);for(const _0xa16d9c of _0x4be1b6){const _0x5dcc75=_0x534fca['KwfUY'](join,_0x1a7715,_0xa16d9c),_0x3d0fee=await _0x534fca[_0x57f034(0x1bd)](stat,_0x5dcc75);_0x3d0fee['isDirectory']()&&(_0x12b520['push'](_0xa16d9c),_0x364f1c[_0xa16d9c]=_0x57f034(0x1b3));}}const _0x460bc2=join(_0x5f27db,'ci');if(_0x534fca[_0x57f034(0x1c7)](existsSync,_0x460bc2)){const _0x2dc7d4=await _0x534fca[_0x57f034(0x1c7)](readdir,_0x460bc2);for(const _0x192a84 of _0x2dc7d4){const _0x3b69b8=join(_0x460bc2,_0x192a84),_0x534c16=await _0x534fca[_0x57f034(0x1bb)](stat,_0x3b69b8);_0x534c16[_0x57f034(0x1b0)]()&&(_0x12b520[_0x57f034(0x1b1)](_0x192a84),_0x364f1c[_0x192a84]='ci');}}const _0x3cd289=await _0x534fca[_0x57f034(0x1ca)](readdir,_0x5f27db);for(const _0x27fc7b of _0x3cd289){if(NON_ENV_DIRS[_0x57f034(0x1bc)](_0x27fc7b))continue;if(_0x27fc7b['startsWith']('.'))continue;if(_0x27fc7b['endsWith'](_0x57f034(0x1ae)))continue;const _0x2faf0d=_0x534fca['Leuxy'](join,_0x5f27db,_0x27fc7b),_0x35c2a3=await stat(_0x2faf0d);_0x35c2a3['isDirectory']()&&_0x534fca[_0x57f034(0x1ca)](existsSync,_0x534fca['YUdTz'](join,_0x2faf0d,_0x57f034(0x1c2)))&&(!_0x12b520[_0x57f034(0x1bc)](_0x27fc7b)&&(_0x12b520['push'](_0x27fc7b),_0x364f1c[_0x27fc7b]=_0x534fca['lrEPY']));}return{'envNames':_0x12b520,'activeEnv':_0x52591d,'envTypes':_0x364f1c};}export async function envList(){const _0x4950b4=_0x595bb2,_0x343742={'BFedi':function(_0x267dc6,_0x63a072){return _0x267dc6===_0x63a072;},'iTbqB':'\x0aNo\x20profiles\x20found.','eIvgO':'Run:\x20ranger\x20profile\x20add\x20<profile-name>','XOWeW':_0x4950b4(0x1c4),'pQYBA':function(_0x1b31da,_0x2e5386){return _0x1b31da===_0x2e5386;},'tDWLN':_0x4950b4(0x1b3),'IhzZW':function(_0x151a4e,_0x76f2be){return _0x151a4e(_0x76f2be);}},{envNames:_0x581141,activeEnv:_0x22933e,envTypes:_0x3fa59c}=await getEnvNames();if(_0x343742['BFedi'](_0x581141['length'],0x0)){console['log'](_0x343742['iTbqB']),console[_0x4950b4(0x1c0)](_0x343742[_0x4950b4(0x1b2)]);return;}console['log'](_0x343742[_0x4950b4(0x1c5)]);for(const _0x1ea8c9 of _0x581141['sort']()){const _0x17066b=_0x343742[_0x4950b4(0x1af)](_0x1ea8c9,_0x22933e),_0x4da66c=_0x3fa59c[_0x1ea8c9]||_0x343742['tDWLN'],_0x33a713=await _0x343742[_0x4950b4(0x1b9)](loadSettings,_0x1ea8c9),_0x528abb=_0x343742[_0x4950b4(0x1af)](_0x4da66c,_0x4950b4(0x1b8))?'':'\x20['+_0x4da66c+']';console['log']('\x20\x20'+(_0x17066b?'*\x20':'\x20\x20')+_0x1ea8c9+_0x528abb),_0x33a713['baseUrl']&&console[_0x4950b4(0x1c0)]('\x20\x20\x20\x20\x20\x20URL:\x20'+_0x33a713[_0x4950b4(0x1c1)]),_0x33a713[_0x4950b4(0x1cb)]&&console[_0x4950b4(0x1c0)](_0x4950b4(0x1b7)+_0x33a713[_0x4950b4(0x1cb)]);}_0x22933e&&console['log']('\x0a*\x20=\x20active\x20profile');}
|