@ranger-testing/ranger-cli 2.0.5 → 2.0.6
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/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 +1 -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 _0x5b47(_0x179e3e,_0x385e8d){_0x179e3e=_0x179e3e-0x188;const _0x3c4c2c=_0x3c4c();let _0x5b47d1=_0x3c4c2c[_0x179e3e];return _0x5b47d1;}function _0x3c4c(){const _0x1938f2=['Warning:\x20Profile\x20created,\x20but\x20failed\x20to\x20mark\x20it\x20as\x20active.','Removed\x20existing\x20profile\x20at\x20','close','cRRAh','FGewY','✓\x20Auth\x20state\x20saved\x20to:\x20','fetch\x20failed','\x0a📋\x20Authentication\x20Setup','Enter\x20a\x20different\x20URL','10IwUheu','\x22\x20already\x20exists.\x20Overwrite?','GfEIL','Missing\x20API\x20token;\x20aborting\x20CI\x20profile\x20creation.','abort','test','TypeError','plnkV','BjaNl','cOyFG','root\x20(.ranger/)','What\x20is\x20the\x20URL\x20of\x20your\x20running\x20app?','jvgoh','What\x20would\x20you\x20like\x20to\x20do?','26376FOfkkH','vSUhN','path','IEKeS','input','\x20\x20\x20When\x20you\x20are\x20done\x20logging\x20in,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','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','legacy','DGhBK','nSvTy','confirm','jGEWb','config_write','mIgeb','hqroS','\x0a\x20\x20Could\x20not\x20reach\x20','baseUrl','\x20\x20\x20Creating\x20it\x20in\x20','2OXabiE','retry','url_setup','browser_auth','error','1421945KoIHlL','launch','newPage','location','HTTP\x20','status','mvEkw','log','action','\x22\x20already\x20exists\x20in\x20','CEOPh','settings.json','\x20\x20Ranger\x20will\x20open\x20it\x20in\x20a\x20browser\x20so\x20you\x20can\x20log\x20in\x20and\x20save\x20your\x20session.\x0a','\x20\x20Make\x20sure\x20your\x20app\x20is\x20running\x20locally\x20before\x20continuing.','561642LmTYbK','12719564GJgjqR','trackPhaseEnd','668318KJVrTp','146616TsWjVT','Warning:\x20Could\x20not\x20remove\x20old\x20profile\x20backup\x20at\x20','skNxd','✓\x20Encrypted\x20auth\x20saved\x20to:\x20','\x0a\x20\x20Profile\x20\x22','Use\x20','HEAD','4552029dNGrRV','bxcCR','\x22\x20configured','overwrite','goto','urduY','use_suggestion','isProtocolError','cDZNZ','Yeuls','prompt','trackPhaseStart','\x0a\x20\x20Still\x20could\x20not\x20reach\x20','30GHIzBd','123VKJayT','Iowsc','newContext','jaDRY','\x20\x20You\x20can\x20safely\x20commit\x20this\x20file\x20to\x20git.'];_0x3c4c=function(){return _0x1938f2;};return _0x3c4c();}(function(_0x1e4ac,_0x5b23bc){const _0x3a8cb6=_0x5b47,_0x1b8054=_0x1e4ac();while(!![]){try{const _0x27b6e6=parseInt(_0x3a8cb6(0x1ce))/0x1*(-parseInt(_0x3a8cb6(0x1b8))/0x2)+parseInt(_0x3a8cb6(0x18a))/0x3*(parseInt(_0x3a8cb6(0x1a6))/0x4)+parseInt(_0x3a8cb6(0x189))/0x5*(-parseInt(_0x3a8cb6(0x1cb))/0x6)+-parseInt(_0x3a8cb6(0x1bd))/0x7+-parseInt(_0x3a8cb6(0x1cf))/0x8+parseInt(_0x3a8cb6(0x1d6))/0x9*(parseInt(_0x3a8cb6(0x198))/0xa)+parseInt(_0x3a8cb6(0x1cc))/0xb;if(_0x27b6e6===_0x5b23bc)break;else _0x1b8054['push'](_0x1b8054['shift']());}catch(_0x32dd4f){_0x1b8054['push'](_0x1b8054['shift']());}}}(_0x3c4c,0x7570d));import{mkdir,writeFile,readFile,unlink,rm,mkdtemp,rename}from'fs/promises';import{join}from'path';import _0x448104 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';import{writeActiveProfileName}from'./utils/activeProfile.js';import{addProfileSetupBanner}from'./utils/profileSetupBanner.js';async function checkUrlReachability(_0x5a36e5){const _0x38cad2=_0x5b47,_0x285f69={'cOyFG':function(_0x12262c,_0x11f5a5,_0xc1a84c){return _0x12262c(_0x11f5a5,_0xc1a84c);},'mvEkw':'manual','cDZNZ':function(_0x26079b,_0x4e0365){return _0x26079b(_0x4e0365);},'nSvTy':function(_0x1f3651,_0x4449cb){return _0x1f3651<_0x4449cb;},'jGEWb':'Invalid\x20URL','MigMk':function(_0xb63160,_0x47fabc){return _0xb63160===_0x47fabc;}};try{const _0x235de1=new AbortController(),_0x4f9ef9=_0x285f69[_0x38cad2(0x1a1)](setTimeout,()=>_0x235de1[_0x38cad2(0x19c)](),0x1388),_0x275449=await _0x285f69['cOyFG'](fetch,_0x5a36e5,{'method':_0x38cad2(0x1d5),'signal':_0x235de1['signal'],'redirect':_0x285f69[_0x38cad2(0x1c3)]});_0x285f69[_0x38cad2(0x1de)](clearTimeout,_0x4f9ef9);if(_0x285f69[_0x38cad2(0x1af)](_0x275449[_0x38cad2(0x1c2)],0x190))return{'ok':!![]};return{'ok':![],'error':_0x38cad2(0x1c1)+_0x275449['status']};}catch(_0x1438a9){const _0x49cd2d=_0x1438a9,_0x50f299=_0x49cd2d['message']||_0x285f69[_0x38cad2(0x1de)](String,_0x1438a9),_0x171c79=_0x50f299['includes'](_0x285f69[_0x38cad2(0x1b1)])||_0x285f69['MigMk'](_0x49cd2d['name'],_0x38cad2(0x19e))||_0x50f299['includes'](_0x38cad2(0x195));return{'ok':![],'error':_0x50f299,'isProtocolError':_0x171c79};}}export async function addEnv(_0x4e7507,_0x321c0c={},_0x5ee040){const _0x717aab=_0x5b47,_0x4f6373={'KbeTb':function(_0x3f4430,_0xe86f3f,_0x5444ec,_0x309482){return _0x3f4430(_0xe86f3f,_0x5444ec,_0x309482);},'dXwDK':function(_0x5a28f1){return _0x5a28f1();},'WLSVc':function(_0x460072,_0x3bc6a7){return _0x460072(_0x3bc6a7);},'uJjjV':function(_0x536b4f,_0x5b12d5){return _0x536b4f===_0x5b12d5;},'BjaNl':_0x717aab(0x1d9),'RGLzm':function(_0x1e8b8c,_0x4fe824){return _0x1e8b8c===_0x4fe824;},'aRnoC':'shouldReplace','BPmLZ':'Aborted.','Iowsc':_0x717aab(0x1ca),'Yeuls':_0x717aab(0x1a3),'vSUhN':function(_0x58c905,_0x3959bf){return _0x58c905||_0x3959bf;},'NJKcP':'http://localhost:3000','Dmbqj':function(_0x270abf,_0x46e7c9){return _0x270abf(_0x46e7c9);},'AqpCI':'list','KrQbV':_0x717aab(0x1c5),'Frvus':_0x717aab(0x1a5),'FGewY':'use_suggestion','LgzzM':_0x717aab(0x197),'mIgeb':'continue','GfEIL':function(_0x5b4c30,_0x3c5e20){return _0x5b4c30===_0x3c5e20;},'JHifQ':_0x717aab(0x1ba),'jaDRY':function(_0xffb2e0,_0x29e5cc,_0x5ca005){return _0xffb2e0(_0x29e5cc,_0x5ca005);},'UoYVv':function(_0x1b43b7,_0x1dcceb){return _0x1b43b7(_0x1dcceb);},'DGhBK':'auth.json','cRRAh':_0x717aab(0x196),'RtwkV':function(_0x10b1a3,_0x4c6708){return _0x10b1a3(_0x4c6708);},'skNxd':'utf-8','TOiYn':'\x20\x20Could\x20not\x20encrypt:\x20No\x20API\x20token\x20found.\x20Run:\x20ranger\x20setup\x20[token]','CEOPh':function(_0x11ec6a,_0x541da3,_0x35887d){return _0x11ec6a(_0x541da3,_0x35887d);},'hqroS':_0x717aab(0x18e),'urduY':_0x717aab(0x1bb),'plnkV':_0x717aab(0x1b2),'jvgoh':_0x717aab(0x1c8),'KZqcX':function(_0x66c9cd,_0x31e32f,_0x13f942){return _0x66c9cd(_0x31e32f,_0x13f942);},'hkZkl':function(_0x11ac8d,_0x15a105){return _0x11ac8d(_0x15a105);},'IEKeS':_0x717aab(0x18f),'bxcCR':function(_0x20dffd,_0x2c66ce,_0x5dc2b1){return _0x20dffd(_0x2c66ce,_0x5dc2b1);}},_0x5e25f5=_0x321c0c['ci']??![],_0x816b98=_0x5e25f5?'ci':'local',_0x54ebed=_0x4f6373['KbeTb'](join,getRangerDir(),_0x816b98,_0x4e7507),_0xadf273=join(_0x4f6373['dXwDK'](getRangerDir),_0x816b98),_0x49f7f2=!_0x321c0c['skipAuth'],_0x56473f=process['stdin']['isTTY']&&process['stdout']['isTTY'];if(!_0x56473f&&_0x49f7f2)throw new Error(_0x717aab(0x1ac));const _0x5f3ea2=_0x4f6373['WLSVc'](findExistingEnv,_0x4e7507);let _0x22c9d5=null;if(_0x5f3ea2){if(_0x4f6373['uJjjV'](_0x5f3ea2[_0x717aab(0x1c0)],_0x816b98)){const {overwrite:_0x1f040a}=await _0x448104['prompt']([{'type':_0x717aab(0x1b0),'name':_0x4f6373[_0x717aab(0x1a0)],'message':'Profile\x20\x22'+_0x4e7507+_0x717aab(0x199),'default':![]}]);if(!_0x1f040a){console[_0x717aab(0x1c4)]('Aborted.');return;}_0x22c9d5=_0x5f3ea2;}else{const _0x36e6e5=_0x4f6373['RGLzm'](_0x5f3ea2[_0x717aab(0x1c0)],_0x717aab(0x1ad))?_0x717aab(0x1a2):_0x5f3ea2[_0x717aab(0x1c0)];console['error']('\x0a⚠️\x20\x20Profile\x20\x22'+_0x4e7507+_0x717aab(0x1c6)+_0x36e6e5+':\x20'+_0x5f3ea2['path']),console['error'](_0x717aab(0x1b7)+_0x816b98+'\x20would\x20shadow\x20the\x20existing\x20profile.');const {shouldReplace:_0x3a8588}=await _0x448104['prompt']([{'type':_0x717aab(0x1b0),'name':_0x4f6373['aRnoC'],'message':'Delete\x20existing\x20and\x20create\x20new\x20in\x20'+_0x816b98+'?','default':![]}]);if(!_0x3a8588){console[_0x717aab(0x1c4)](_0x4f6373['BPmLZ']);return;}_0x22c9d5=_0x5f3ea2;}}_0x5ee040?.[_0x717aab(0x1e1)]('url_setup'),console['log']('\x0a🌐\x20Profile\x20Setup\x0a'),console['log'](_0x4f6373[_0x717aab(0x18b)]),console['log'](_0x717aab(0x1c9));let _0x426f2e='',_0x4201aa=![];while(!![]){const _0xc96152=await _0x448104[_0x717aab(0x1e0)]([{'type':_0x717aab(0x1aa),'name':'baseUrl','message':_0x4201aa?'Enter\x20a\x20new\x20URL\x20(or\x20press\x20enter\x20to\x20keep\x20current):':_0x4f6373[_0x717aab(0x1df)],'default':_0x4f6373[_0x717aab(0x1a7)](_0x426f2e,_0x4f6373['NJKcP'])}]);_0x426f2e=_0xc96152[_0x717aab(0x1b6)];const _0x5ca1fa=await _0x4f6373['Dmbqj'](checkUrlReachability,_0x426f2e);if(_0x5ca1fa['ok'])break;const _0x22e2ea=/^[a-zA-Z][\w+.-]*:\/\//[_0x717aab(0x19d)](_0x426f2e),_0x161714=_0x5ca1fa[_0x717aab(0x1dd)]&&!_0x22e2ea,_0x212452=_0x161714?'http://'+_0x426f2e:null;_0x4201aa=!![],console['log'](_0x717aab(0x1b5)+_0x426f2e+':\x20'+_0x5ca1fa[_0x717aab(0x1bc)]);_0x212452&&console['log']('\x20\x20Did\x20you\x20mean\x20'+_0x212452+'?');const {action:_0x26e89c}=await _0x448104['prompt']([{'type':_0x4f6373['AqpCI'],'name':_0x4f6373['KrQbV'],'message':_0x4f6373['Frvus'],'choices':[..._0x212452?[{'name':_0x717aab(0x1d4)+_0x212452,'value':_0x4f6373[_0x717aab(0x193)]}]:[],{'name':_0x4f6373['LgzzM'],'value':_0x717aab(0x1b9)},{'name':'Continue\x20anyway','value':_0x4f6373[_0x717aab(0x1b3)]}]}]);if(_0x4f6373[_0x717aab(0x19a)](_0x26e89c,_0x717aab(0x1dc))&&_0x212452){_0x426f2e=_0x212452;const _0xb9b8c2=await checkUrlReachability(_0x426f2e);if(_0xb9b8c2['ok'])break;console['log'](_0x717aab(0x188)+_0x426f2e+':\x20'+_0xb9b8c2['error']);}else{if(_0x26e89c==='continue')break;}}_0x5ee040?.[_0x717aab(0x1cd)](_0x4f6373['JHifQ']),await _0x4f6373[_0x717aab(0x18d)](mkdir,_0xadf273,{'recursive':!![]});const _0x488802=await _0x4f6373['UoYVv'](mkdtemp,join(_0xadf273,'.tmp-'+_0x4e7507+'-')),_0x2c2b09=join(_0x488802,_0x4f6373[_0x717aab(0x1ae)]);try{if(_0x49f7f2){_0x5ee040?.[_0x717aab(0x1e1)]('browser_auth'),console[_0x717aab(0x1c4)](_0x4f6373[_0x717aab(0x192)]),console['log']('\x20\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20to\x20the\x20profile\x20you\x20want\x20to\x20test\x20so\x20Ranger\x20can\x20access\x20it.'),console['log'](_0x717aab(0x1ab)),await new Promise(_0x5ded84=>setTimeout(_0x5ded84,0xbb8));const _0x22a10b=await chromium[_0x717aab(0x1be)]({'headless':![]});try{const _0x2c9609=await _0x22a10b[_0x717aab(0x18c)]();await _0x4f6373['RtwkV'](addProfileSetupBanner,_0x2c9609);const _0x26bd4a=await _0x2c9609[_0x717aab(0x1bf)]();await _0x26bd4a[_0x717aab(0x1da)](_0x426f2e||'about:blank'),await new Promise(_0x4a514f=>{_0x26bd4a['on']('close',async()=>{try{console['log']('Saving\x20authentication\x20state...'),await _0x2c9609['storageState']({'path':_0x2c2b09});}catch{}_0x4a514f();});});}finally{await _0x22a10b[_0x717aab(0x191)]()['catch'](()=>{});}if(_0x5e25f5){const _0xa2ce58=await _0x4f6373['jaDRY'](readFile,_0x2c2b09,_0x4f6373[_0x717aab(0x1d1)]),_0x2b20f6=await getToken();if(!_0x2b20f6){console['error'](_0x4f6373['TOiYn']),await unlink(_0x2c2b09)['catch'](()=>{});throw new Error(_0x717aab(0x19b));}else{const _0x3590cf=encrypt(_0xa2ce58,_0x2b20f6);await _0x4f6373[_0x717aab(0x1c7)](writeFile,_0x2c2b09+'.enc',_0x3590cf),await unlink(_0x2c2b09),console[_0x717aab(0x1c4)](_0x717aab(0x1d2)+_0x2c2b09+'.enc'),console[_0x717aab(0x1c4)](_0x4f6373[_0x717aab(0x1b4)]),console[_0x717aab(0x1c4)]('\x20\x20Run\x20ranger\x20setup\x20in\x20CI\x20to\x20decrypt\x20at\x20runtime.');}}else console['log'](_0x717aab(0x194)+_0x2c2b09);_0x5ee040?.[_0x717aab(0x1cd)](_0x4f6373[_0x717aab(0x1db)]);}_0x5ee040?.['trackPhaseStart'](_0x4f6373[_0x717aab(0x19f)]);const _0x1a213a={};_0x426f2e&&(_0x1a213a[_0x717aab(0x1b6)]=_0x426f2e);await _0x4f6373['CEOPh'](writeFile,join(_0x488802,_0x4f6373[_0x717aab(0x1a4)]),JSON['stringify'](_0x1a213a,null,0x2)),console[_0x717aab(0x1c4)]('✓\x20Created\x20settings:\x20'+_0x4f6373['KZqcX'](join,_0x54ebed,_0x4f6373[_0x717aab(0x1a4)]));if(_0x22c9d5?.['location']===_0x816b98){const _0x5519f0=_0x22c9d5[_0x717aab(0x1a8)]+'.backup-'+Date['now']();await rename(_0x22c9d5[_0x717aab(0x1a8)],_0x5519f0);try{await _0x4f6373[_0x717aab(0x18d)](rename,_0x488802,_0x54ebed);}catch(_0x269c45){await rename(_0x5519f0,_0x22c9d5[_0x717aab(0x1a8)]);throw _0x269c45;}try{await rm(_0x5519f0,{'recursive':!![]});}catch{console[_0x717aab(0x1c4)](_0x717aab(0x1d0)+_0x5519f0);}}else{await rename(_0x488802,_0x54ebed);if(_0x22c9d5)try{await rm(_0x22c9d5[_0x717aab(0x1a8)],{'recursive':!![]}),console[_0x717aab(0x1c4)](_0x717aab(0x190)+_0x22c9d5['path']);}catch{console[_0x717aab(0x1c4)]('Warning:\x20Could\x20not\x20remove\x20old\x20profile\x20at\x20'+_0x22c9d5[_0x717aab(0x1a8)]);}}try{await _0x4f6373['hkZkl'](writeActiveProfileName,_0x4e7507),console[_0x717aab(0x1c4)]('\x20\x20Set\x20active\x20profile:\x20'+_0x4e7507);}catch{console['log'](_0x4f6373[_0x717aab(0x1a9)]);}_0x5ee040?.[_0x717aab(0x1cd)](_0x4f6373[_0x717aab(0x19f)]),console['log'](_0x717aab(0x1d3)+_0x4e7507+_0x717aab(0x1d8));}catch(_0x110c82){await _0x4f6373[_0x717aab(0x1d7)](rm,_0x488802,{'recursive':!![],'force':!![]});throw _0x110c82;}}
|
|
@@ -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(_0x23a7b5,_0x391ee3){const _0x3ecf6b=_0x5e81,_0x3ed4dc=_0x23a7b5();while(!![]){try{const _0x479278=-parseInt(_0x3ecf6b(0x192))/0x1+-parseInt(_0x3ecf6b(0x18c))/0x2*(parseInt(_0x3ecf6b(0x189))/0x3)+-parseInt(_0x3ecf6b(0x185))/0x4*(-parseInt(_0x3ecf6b(0x194))/0x5)+-parseInt(_0x3ecf6b(0x19b))/0x6*(parseInt(_0x3ecf6b(0x195))/0x7)+-parseInt(_0x3ecf6b(0x186))/0x8*(parseInt(_0x3ecf6b(0x184))/0x9)+parseInt(_0x3ecf6b(0x18b))/0xa*(-parseInt(_0x3ecf6b(0x191))/0xb)+parseInt(_0x3ecf6b(0x19a))/0xc*(parseInt(_0x3ecf6b(0x18a))/0xd);if(_0x479278===_0x391ee3)break;else _0x3ed4dc['push'](_0x3ed4dc['shift']());}catch(_0x4c57){_0x3ed4dc['push'](_0x3ed4dc['shift']());}}}(_0x231f,0xed5c0));function _0x5e81(_0x16cc33,_0xc2d33a){_0x16cc33=_0x16cc33-0x184;const _0x231f89=_0x231f();let _0x5e81eb=_0x231f89[_0x16cc33];return _0x5e81eb;}import{readFile,writeFile}from'fs/promises';import{join}from'path';import{existsSync}from'fs';function _0x231f(){const _0x3c5bdb=['.\x20Run\x20first:\x20ranger\x20profile\x20add\x20with\x20authentication,\x20or\x20ranger\x20profile\x20update','11KUNVnh','1874423JQHPvM','No\x20API\x20token\x20found.\x20Run:\x20ranger\x20setup\x20[token]','696020CmjLap','80213izqMxV','No\x20auth.json\x20found\x20at\x20','\x20\x20You\x20can\x20safely\x20commit\x20this\x20file\x20to\x20git.','auth.json','RQMue','684fvtfPJ','60JOHRiZ','1989720TTzJBW','4pgKaDy','16ptxgUs','\x20\x20Run\x20ranger\x20setup\x20in\x20CI\x20to\x20decrypt\x20at\x20runtime.','xsYGg','12UPskpb','980733XycObF','3554480rFQfvp','340248FwjDAv','GRREd','Profile\x20\x22','log'];_0x231f=function(){return _0x3c5bdb;};return _0x231f();}import{encrypt}from'./utils/crypto.js';import{getToken}from'./utils/keychain.js';import{getEnvDir}from'./utils/settings.js';export async function authEncrypt(_0x2aed24){const _0x457b9f=_0x5e81,_0x555a1b={'xsYGg':function(_0x29a401,_0xaa3365,_0x5a6335){return _0x29a401(_0xaa3365,_0x5a6335);},'LJSHV':function(_0x52cf78){return _0x52cf78();},'nOpIZ':_0x457b9f(0x193),'GRREd':'utf-8','RQMue':function(_0x157360,_0x4bbacf){return _0x157360(_0x4bbacf);}},_0x1347c8=getEnvDir(_0x2aed24),_0x5d1d60=_0x555a1b[_0x457b9f(0x188)](join,_0x1347c8,_0x457b9f(0x198)),_0x50cb53=_0x5d1d60+'.enc';if(!existsSync(_0x1347c8))throw new Error(_0x457b9f(0x18e)+_0x2aed24+'\x22\x20not\x20found.\x20Run\x20first:\x20ranger\x20profile\x20add\x20'+_0x2aed24);if(!existsSync(_0x5d1d60))throw new Error(_0x457b9f(0x196)+_0x5d1d60+_0x457b9f(0x190));const _0x124565=await _0x555a1b['LJSHV'](getToken);if(!_0x124565)throw new Error(_0x555a1b['nOpIZ']);const _0x52b120=await readFile(_0x5d1d60,_0x555a1b[_0x457b9f(0x18d)]),_0x26c5bc=_0x555a1b[_0x457b9f(0x188)](encrypt,_0x52b120,_0x124565);await writeFile(_0x50cb53,_0x26c5bc),console['log']('\x0a✓\x20Encrypted\x20auth\x20saved\x20to:\x20'+_0x50cb53),console['log'](_0x457b9f(0x197)),console[_0x457b9f(0x18f)](_0x457b9f(0x187)),_0x555a1b[_0x457b9f(0x199)](existsSync,_0x50cb53)&&(console['log']('\x0a\x20\x20The\x20plaintext\x20auth.json\x20is\x20gitignored\x20for\x20security.'),console[_0x457b9f(0x18f)]('\x20\x20The\x20encrypted\x20auth.json.enc\x20can\x20be\x20committed.'));}
|
package/build/commands/clean.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function _0x2d45(){const _0x5598bc=['NqHWt','8xwhWkD','sGDoq','feature-tracker','pipe','TMiHA','YQgcK','2369070unyVTg','sywya','project','close','uninstall','ranger','\x0a✅\x20Cleanup\x20complete!\x0a','✓\x20Removed\x20stored\x20credentials','\x0a🧹\x20Cleaning\x20up\x20Ranger\x20artifacts...\x0a','✓\x20Removed\x20user\x20skill:\x20','win32','OnGjT','nZZSe','16025110qObzdy','1302017jVlFNZ','9AmuEHz','QWAeP','✓\x20Uninstalled\x20Claude\x20plugin\x20(project\x20scope)','1049778eSelFK','--scope','✓\x20Removed\x20project\x20skill:\x20','19470RcieeO','✓\x20Removed\x20trailhead\x20marketplace','4066064iuxeCj','error','claude','vEhnG','Thkfb','✓\x20Uninstalled\x20Claude\x20plugin\x20(user\x20scope)','LGvSb','1145QSOzra','3225957tWeAVl','log'];_0x2d45=function(){return _0x5598bc;};return _0x2d45();}(function(_0x3805df,_0x512679){const _0x1db490=_0x1a14,_0x22a011=_0x3805df();while(!![]){try{const _0x46ebeb=-parseInt(_0x1db490(0xa9))/0x1+parseInt(_0x1db490(0x9b))/0x2+-parseInt(_0x1db490(0xad))/0x3*(-parseInt(_0x1db490(0xbd))/0x4)+parseInt(_0x1db490(0xb9))/0x5*(parseInt(_0x1db490(0xb0))/0x6)+parseInt(_0x1db490(0xba))/0x7+-parseInt(_0x1db490(0xb2))/0x8*(-parseInt(_0x1db490(0xaa))/0x9)+-parseInt(_0x1db490(0xa8))/0xa;if(_0x46ebeb===_0x512679)break;else _0x22a011['push'](_0x22a011['shift']());}catch(_0x2c8c31){_0x22a011['push'](_0x22a011['shift']());}}}(_0x2d45,0xa8f69));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';import{getRangerDir}from'./utils/rangerRoot.js';function _0x1a14(_0x142849,_0x4497b2){_0x142849=_0x142849-0x99;const _0x2d45af=_0x2d45();let _0x1a1402=_0x2d45af[_0x142849];return _0x1a1402;}import{getCacheFile}from'./utils/sessionCache.js';async function uninstallClaudePlugin(_0x3cde91){const _0x234bc7=_0x1a14,_0x31de6f={'nZZSe':function(_0x189bdc,_0x5a25bb){return _0x189bdc(_0x5a25bb);},'kDZNW':function(_0x443499,_0x447898){return _0x443499(_0x447898);},'URaRf':'plugin','qHGyK':_0x234bc7(0xc0),'LGvSb':'win32','YQgcK':'close','OnGjT':_0x234bc7(0xb3)};return new Promise(_0x267bae=>{const _0x1de3ba=_0x234bc7,_0x3d733f={'GGxAB':function(_0x49316b,_0x40c5d8){return _0x31de6f['kDZNW'](_0x49316b,_0x40c5d8);}},_0x1ca4ff=[_0x31de6f['URaRf'],_0x1de3ba(0x9f),'ranger@trailhead'];_0x3cde91&&_0x1ca4ff['push'](_0x1de3ba(0xae),_0x3cde91);const _0x4ae385=spawn('claude',_0x1ca4ff,{'stdio':_0x31de6f['qHGyK'],'shell':process['platform']===_0x31de6f[_0x1de3ba(0xb8)]});_0x4ae385['on'](_0x31de6f[_0x1de3ba(0x9a)],_0x189400=>{const _0x5d9455=_0x1de3ba;_0x31de6f[_0x5d9455(0xa7)](_0x267bae,_0x189400===0x0);}),_0x4ae385['on'](_0x31de6f[_0x1de3ba(0xa6)],()=>{_0x3d733f['GGxAB'](_0x267bae,![]);});});}async function removeMarketplace(){const _0x3ec7f6=_0x1a14,_0x3ba164={'Thkfb':'marketplace','DHhyc':'trailhead','MvuWu':_0x3ec7f6(0xc0),'TMiHA':function(_0x1c4631,_0x4d75cb){return _0x1c4631===_0x4d75cb;},'QWAeP':_0x3ec7f6(0xa5)};return new Promise(_0xd04c9d=>{const _0x2c5021=_0x3ec7f6,_0x23c2ee=spawn(_0x2c5021(0xb4),['plugin',_0x3ba164[_0x2c5021(0xb6)],'remove',_0x3ba164['DHhyc']],{'stdio':_0x3ba164['MvuWu'],'shell':_0x3ba164[_0x2c5021(0x99)](process['platform'],_0x3ba164[_0x2c5021(0xab)])});_0x23c2ee['on'](_0x2c5021(0x9e),_0x52aa43=>{_0xd04c9d(_0x52aa43===0x0);}),_0x23c2ee['on']('error',()=>{_0xd04c9d(![]);});});}export async function clean(){const _0x302907=_0x1a14,_0x18c251={'txxml':_0x302907(0xa3),'sGDoq':function(_0x32ccc7){return _0x32ccc7();},'wZYzv':function(_0x3dc745,_0x4a537d){return _0x3dc745(_0x4a537d);},'NqHWt':'bug-bash','sywya':'e2e-test-recommender','vEhnG':function(_0x34417b,_0x3ed6aa,_0x38011e){return _0x34417b(_0x3ed6aa,_0x38011e);},'VbVjL':function(_0x25e1c5){return _0x25e1c5();},'daMip':function(_0x2aebdf,_0x2af59c,_0x55834b){return _0x2aebdf(_0x2af59c,_0x55834b);},'ifyFr':_0x302907(0xb7),'VwfjW':_0x302907(0xb1),'wUIQc':'Nothing\x20to\x20clean\x20up.\x0a'};console['log'](_0x18c251['txxml']);let _0x2728cf=![];try{await deleteAllCredentials(),console['log'](_0x302907(0xa2)),_0x2728cf=!![];}catch{}const _0x2b3da3=_0x18c251[_0x302907(0xbe)](getCacheFile);_0x18c251['wZYzv'](existsSync,_0x2b3da3)&&(await rm(_0x2b3da3),_0x2728cf=!![]);const _0x1253cb=getRangerDir();_0x18c251['wZYzv'](existsSync,_0x1253cb)&&(await rm(_0x1253cb,{'recursive':!![]}),console['log']('✓\x20Removed\x20.ranger/\x20directory'),_0x2728cf=!![]);const _0x549eda=[_0x302907(0xa0),_0x302907(0xbf),_0x18c251[_0x302907(0xbc)],_0x18c251[_0x302907(0x9c)]],_0x2be90c=getProjectSkillsDir();for(const _0x50d6d9 of _0x549eda){const _0x3f2ee7=_0x18c251[_0x302907(0xb5)](join,_0x2be90c,_0x50d6d9);existsSync(_0x3f2ee7)&&(await _0x18c251[_0x302907(0xb5)](rm,_0x3f2ee7,{'recursive':!![]}),console['log'](_0x302907(0xaf)+_0x50d6d9),_0x2728cf=!![]);}const _0xd8058c=_0x18c251['VbVjL'](getUserSkillsDir);for(const _0x41e0fd of _0x549eda){const _0x6a52af=_0x18c251[_0x302907(0xb5)](join,_0xd8058c,_0x41e0fd);existsSync(_0x6a52af)&&(await _0x18c251['daMip'](rm,_0x6a52af,{'recursive':!![]}),console['log'](_0x302907(0xa4)+_0x41e0fd),_0x2728cf=!![]);}const _0x33f98c=await uninstallClaudePlugin();_0x33f98c&&(console[_0x302907(0xbb)](_0x18c251['ifyFr']),_0x2728cf=!![]);const _0x2d95ce=await uninstallClaudePlugin(_0x302907(0x9d));_0x2d95ce&&(console['log'](_0x302907(0xac)),_0x2728cf=!![]);const _0x1f13e6=await removeMarketplace();_0x1f13e6&&(console[_0x302907(0xbb)](_0x18c251['VwfjW']),_0x2728cf=!![]),_0x2728cf?console['log'](_0x302907(0xa1)):console[_0x302907(0xbb)](_0x18c251['wUIQc']);}
|
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
|
+
const _0x540680=_0x2059;(function(_0x3c289b,_0x327a9c){const _0x541180=_0x2059,_0x1cc13d=_0x3c289b();while(!![]){try{const _0x347e77=parseInt(_0x541180(0x98))/0x1+-parseInt(_0x541180(0x9d))/0x2*(parseInt(_0x541180(0x91))/0x3)+-parseInt(_0x541180(0x97))/0x4*(parseInt(_0x541180(0x92))/0x5)+parseInt(_0x541180(0x95))/0x6+parseInt(_0x541180(0xa4))/0x7+parseInt(_0x541180(0x99))/0x8*(-parseInt(_0x541180(0xa2))/0x9)+parseInt(_0x541180(0xa0))/0xa;if(_0x347e77===_0x327a9c)break;else _0x1cc13d['push'](_0x1cc13d['shift']());}catch(_0x1040cd){_0x1cc13d['push'](_0x1cc13d['shift']());}}}(_0xc94f,0xcc986));import{existsSync}from'fs';import{loadSettings,saveSettings,getNestedValue,setNestedValue,deleteNestedValue,formatSettings,getSettingsPath,getEnvDir}from'./utils/settings.js';const BOOLEAN_KEYS=[_0x540680(0x94)];function parseValue(_0x173e6c,_0x289abe){const _0x2df054=_0x540680;if(BOOLEAN_KEYS[_0x2df054(0x9b)](_0x173e6c)){if(_0x289abe===_0x2df054(0x9e))return!![];if(_0x289abe===_0x2df054(0xa5))return![];throw new Error('Invalid\x20value\x20for\x20'+_0x173e6c+':\x20expected\x20\x22true\x22\x20or\x20\x22false\x22');}return _0x289abe;}export async function configSet(_0x27997b,_0x2f727f,_0x15c36e){const _0x18f704=_0x540680,_0x45ef44={'zbyvY':function(_0x4d4875,_0xdd9526){return _0x4d4875(_0xdd9526);},'IKZfO':function(_0x4fe7e6,_0x56d9df,_0x5b4ed5){return _0x4fe7e6(_0x56d9df,_0x5b4ed5);}},_0x2a3311=getEnvDir(_0x27997b);if(!existsSync(_0x2a3311))throw new Error('Profile\x20\x22'+_0x27997b+'\x22\x20does\x20not\x20exist.\x20Run:\x20ranger\x20profile\x20add\x20'+_0x27997b);const _0x3d3238=await _0x45ef44[_0x18f704(0x9a)](loadSettings,_0x27997b),_0x331e41=parseValue(_0x2f727f,_0x15c36e);setNestedValue(_0x3d3238,_0x2f727f,_0x331e41),await _0x45ef44[_0x18f704(0x8f)](saveSettings,_0x27997b,_0x3d3238),console[_0x18f704(0x96)](_0x18f704(0x9f)+_0x2f727f+_0x18f704(0xa1)+_0x331e41);}export async function configGet(_0x5eaf0b,_0x3b4b93){const _0x48b9f1=_0x540680,_0x172786={'rqVIp':function(_0x77c1d6,_0x379a7e){return _0x77c1d6(_0x379a7e);},'LLTmS':function(_0x5a6d2f,_0xd10c05){return _0x5a6d2f(_0xd10c05);},'QTsVO':function(_0x235997,_0x3c77d1,_0x3ee500){return _0x235997(_0x3c77d1,_0x3ee500);},'SpRZb':'object'},_0x28a32d=_0x172786['rqVIp'](getEnvDir,_0x5eaf0b);if(!_0x172786['LLTmS'](existsSync,_0x28a32d))throw new Error('Profile\x20\x22'+_0x5eaf0b+_0x48b9f1(0x8c));const _0xf36d2=await loadSettings(_0x5eaf0b),_0x1baa37=_0x172786['QTsVO'](getNestedValue,_0xf36d2,_0x3b4b93);if(_0x1baa37===undefined)console[_0x48b9f1(0x96)]('(not\x20set)');else typeof _0x1baa37===_0x172786[_0x48b9f1(0x90)]?console['log'](JSON['stringify'](_0x1baa37,null,0x2)):console['log'](_0x1baa37);}export async function configList(_0x3c1b1c){const _0x404a62=_0x540680,_0x1a829e={'FQMoj':function(_0x41fcc0,_0x3fee3d){return _0x41fcc0(_0x3fee3d);},'ETPmI':function(_0x500b54,_0x55bc97){return _0x500b54(_0x55bc97);},'JSInS':function(_0x1bac86,_0x57199c){return _0x1bac86(_0x57199c);},'WyFeO':function(_0x597c7e,_0x342c08){return _0x597c7e(_0x342c08);}},_0x14f41d=getSettingsPath(_0x3c1b1c);if(!_0x1a829e['FQMoj'](existsSync,_0x14f41d)){const _0x77e593=_0x1a829e[_0x404a62(0xa3)](getEnvDir,_0x3c1b1c);if(!_0x1a829e['JSInS'](existsSync,_0x77e593))throw new Error(_0x404a62(0x8d)+_0x3c1b1c+'\x22\x20does\x20not\x20exist.');console['log'](_0x404a62(0x93)+_0x3c1b1c+'\x22');return;}const _0x525e17=await _0x1a829e['WyFeO'](loadSettings,_0x3c1b1c),_0x1ca68d=formatSettings(_0x525e17);!_0x1ca68d?console[_0x404a62(0x96)]('No\x20configuration\x20set\x20for\x20\x22'+_0x3c1b1c+'\x22'):console[_0x404a62(0x96)](_0x1ca68d);}function _0x2059(_0x2354c5,_0x45ce61){_0x2354c5=_0x2354c5-0x8c;const _0xc94ff0=_0xc94f();let _0x20597c=_0xc94ff0[_0x2354c5];return _0x20597c;}export async function configUnset(_0x56d374,_0x1515ca){const _0x428595=_0x540680,_0x320a1b={'fsxmW':function(_0x2bdd26,_0x462a1a){return _0x2bdd26(_0x462a1a);},'LknDW':function(_0xed8089,_0x5ee2a4){return _0xed8089(_0x5ee2a4);},'mmzTy':function(_0x55689b,_0x2a7ecc,_0x398a2d){return _0x55689b(_0x2a7ecc,_0x398a2d);}},_0x3a34bf=getEnvDir(_0x56d374);if(!_0x320a1b['fsxmW'](existsSync,_0x3a34bf))throw new Error(_0x428595(0x8d)+_0x56d374+'\x22\x20does\x20not\x20exist.');const _0x29ddfe=await _0x320a1b[_0x428595(0x8e)](loadSettings,_0x56d374),_0x2bb68e=deleteNestedValue(_0x29ddfe,_0x1515ca);_0x2bb68e?(await _0x320a1b['mmzTy'](saveSettings,_0x56d374,_0x29ddfe),console['log']('Removed\x20'+_0x1515ca)):console['log']('Key\x20\x22'+_0x1515ca+_0x428595(0x9c));}function _0xc94f(){const _0x4615cc=['2028664rBUgVw','479293IUuPIz','8KpuXcK','zbyvY','includes','\x22\x20not\x20found','4wksCqe','true','Set\x20','17453140eZyeGr','\x20=\x20','9013563YcHAmJ','ETPmI','3906322PMxEMB','false','\x22\x20does\x20not\x20exist.','Profile\x20\x22','LknDW','IKZfO','SpRZb','2066151RBMVYg','5apFyZI','No\x20configuration\x20set\x20for\x20\x22','headless','5648856ajcXLz','log'];_0xc94f=function(){return _0x4615cc;};return _0xc94f();}
|
package/build/commands/env.js
CHANGED
|
@@ -1,98 +1 @@
|
|
|
1
|
-
import { readdir, stat }
|
|
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
|
+
const _0x2355c4=_0x1a95;(function(_0xa53e0b,_0x13b469){const _0x355f8e=_0x1a95,_0x33e483=_0xa53e0b();while(!![]){try{const _0x2be37f=parseInt(_0x355f8e(0xdf))/0x1*(parseInt(_0x355f8e(0xcf))/0x2)+-parseInt(_0x355f8e(0xc1))/0x3*(-parseInt(_0x355f8e(0xc0))/0x4)+parseInt(_0x355f8e(0xc8))/0x5+parseInt(_0x355f8e(0xdd))/0x6*(-parseInt(_0x355f8e(0xd5))/0x7)+-parseInt(_0x355f8e(0xd4))/0x8*(-parseInt(_0x355f8e(0xc2))/0x9)+parseInt(_0x355f8e(0xd7))/0xa+-parseInt(_0x355f8e(0xcd))/0xb*(parseInt(_0x355f8e(0xdb))/0xc);if(_0x2be37f===_0x13b469)break;else _0x33e483['push'](_0x33e483['shift']());}catch(_0x57796d){_0x33e483['push'](_0x33e483['shift']());}}}(_0x454f,0x98572));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';function _0x1a95(_0x38f848,_0x57dde7){_0x38f848=_0x38f848-0xbf;const _0x454f41=_0x454f();let _0x1a9503=_0x454f41[_0x38f848];return _0x1a9503;}import{readActiveProfileName}from'./utils/activeProfile.js';const NON_ENV_DIRS=[_0x2355c4(0xc5),'bug-bashes','reports',_0x2355c4(0xc7),'ci'];export async function getEnvNames(){const _0x1bcd19=_0x2355c4,_0x3afb42={'gzgvb':function(_0x2d186f){return _0x2d186f();},'hmlcm':function(_0x42276c,_0x32989e,_0x3668db){return _0x42276c(_0x32989e,_0x3668db);},'DFyVJ':function(_0x28ea36,_0x1915e6){return _0x28ea36(_0x1915e6);},'oAdWe':function(_0x4eead8,_0x23e3ee,_0x2e7910){return _0x4eead8(_0x23e3ee,_0x2e7910);},'zbwAv':function(_0x2e778b,_0x5a0644){return _0x2e778b(_0x5a0644);},'DpsPW':'local','wBdch':function(_0x5371e6,_0x3fe8d5,_0x94f55e){return _0x5371e6(_0x3fe8d5,_0x94f55e);},'dMFlY':function(_0x17f056,_0x53c99c){return _0x17f056(_0x53c99c);},'egbjx':function(_0x597922,_0x4545bf){return _0x597922(_0x4545bf);},'XvofR':function(_0x422793,_0x307194,_0x4b569f){return _0x422793(_0x307194,_0x4b569f);}},_0x594a74=_0x3afb42['gzgvb'](getRangerDir);if(!existsSync(_0x594a74))return{'envNames':[],'activeEnv':null,'envTypes':{}};const _0x4fc366=await _0x3afb42['gzgvb'](readActiveProfileName),_0x1d0fb9=[],_0x42a5d2={},_0x97cda0=_0x3afb42[_0x1bcd19(0xc9)](join,_0x594a74,'local');if(_0x3afb42['DFyVJ'](existsSync,_0x97cda0)){const _0x27d49f=await readdir(_0x97cda0);for(const _0x3a06d8 of _0x27d49f){const _0x2da9ec=_0x3afb42[_0x1bcd19(0xd8)](join,_0x97cda0,_0x3a06d8),_0x20633e=await _0x3afb42['zbwAv'](stat,_0x2da9ec);_0x20633e['isDirectory']()&&(_0x1d0fb9[_0x1bcd19(0xbf)](_0x3a06d8),_0x42a5d2[_0x3a06d8]=_0x3afb42[_0x1bcd19(0xd3)]);}}const _0x972319=_0x3afb42[_0x1bcd19(0xdc)](join,_0x594a74,'ci');if(_0x3afb42[_0x1bcd19(0xd2)](existsSync,_0x972319)){const _0x350d3e=await _0x3afb42[_0x1bcd19(0xcb)](readdir,_0x972319);for(const _0x36608d of _0x350d3e){const _0x223e7c=join(_0x972319,_0x36608d),_0x1a61e7=await stat(_0x223e7c);_0x1a61e7['isDirectory']()&&(_0x1d0fb9['push'](_0x36608d),_0x42a5d2[_0x36608d]='ci');}}const _0x33caaf=await readdir(_0x594a74);for(const _0x3bf370 of _0x33caaf){if(NON_ENV_DIRS['includes'](_0x3bf370))continue;if(_0x3bf370['startsWith']('.'))continue;if(_0x3bf370[_0x1bcd19(0xd6)]('.txt'))continue;const _0xaaa716=_0x3afb42[_0x1bcd19(0xd8)](join,_0x594a74,_0x3bf370),_0x367266=await stat(_0xaaa716);_0x367266[_0x1bcd19(0xcc)]()&&_0x3afb42[_0x1bcd19(0xd0)](existsSync,_0x3afb42['XvofR'](join,_0xaaa716,'settings.json'))&&(!_0x1d0fb9[_0x1bcd19(0xc3)](_0x3bf370)&&(_0x1d0fb9['push'](_0x3bf370),_0x42a5d2[_0x3bf370]=_0x1bcd19(0xda)));}return{'envNames':_0x1d0fb9,'activeEnv':_0x4fc366,'envTypes':_0x42a5d2};}export async function envList(){const _0x1ebd5f=_0x2355c4,_0x3cee61={'RqIDP':function(_0x4dcf2e){return _0x4dcf2e();},'MiuiO':_0x1ebd5f(0xd1),'pgjJf':function(_0x26883e,_0x2ea8f5){return _0x26883e===_0x2ea8f5;},'EBhCz':function(_0x4bc5e6,_0x21391c){return _0x4bc5e6(_0x21391c);},'AYSHM':function(_0x1ae525,_0x269daf){return _0x1ae525===_0x269daf;},'gaAGU':'legacy'},{envNames:_0x43e763,activeEnv:_0x605efd,envTypes:_0x35ee72}=await _0x3cee61[_0x1ebd5f(0xca)](getEnvNames);if(_0x43e763['length']===0x0){console['log'](_0x3cee61['MiuiO']),console[_0x1ebd5f(0xc6)]('Run:\x20ranger\x20profile\x20add\x20<profile-name>');return;}console['log']('\x0aProfiles:');for(const _0x1d88e9 of _0x43e763[_0x1ebd5f(0xc4)]()){const _0x55951a=_0x3cee61[_0x1ebd5f(0xce)](_0x1d88e9,_0x605efd),_0x216355=_0x35ee72[_0x1d88e9]||'local',_0x57d19c=await _0x3cee61['EBhCz'](loadSettings,_0x1d88e9),_0x40aab5=_0x3cee61['AYSHM'](_0x216355,_0x3cee61['gaAGU'])?'':'\x20['+_0x216355+']';console[_0x1ebd5f(0xc6)]('\x20\x20'+(_0x55951a?'*\x20':'\x20\x20')+_0x1d88e9+_0x40aab5),_0x57d19c[_0x1ebd5f(0xd9)]&&console[_0x1ebd5f(0xc6)](_0x1ebd5f(0xde)+_0x57d19c['baseUrl']),_0x57d19c['environmentDetails']&&console[_0x1ebd5f(0xc6)]('\x20\x20\x20\x20\x20\x20Details:\x20'+_0x57d19c['environmentDetails']);}_0x605efd&&console[_0x1ebd5f(0xc6)]('\x0a*\x20=\x20active\x20profile');}function _0x454f(){const _0x2354fe=['sort','sessions','log','local','26235kPFDvg','hmlcm','RqIDP','DFyVJ','isDirectory','11RVmMqk','pgjJf','4206hYBKbr','egbjx','\x0aNo\x20profiles\x20found.','dMFlY','DpsPW','56344FhoIRR','7oWPBKi','endsWith','3272170MOcrtC','oAdWe','baseUrl','legacy','10453764tLYWpN','wBdch','3849852ldzSKx','\x20\x20\x20\x20\x20\x20URL:\x20','334CMYMXl','push','4cChezQ','1615407rlDxZA','720KjhJdC','includes'];_0x454f=function(){return _0x2354fe;};return _0x454f();}
|