@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
|
@@ -1,28 +1 @@
|
|
|
1
|
-
import { readFileSync }
|
|
2
|
-
import { dirname, join } from 'path';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
-
const __dirname = dirname(__filename);
|
|
6
|
-
/**
|
|
7
|
-
* Read skill content from the skills directory.
|
|
8
|
-
* Skills are copied to build/skills/ during build via `cp -r src/skills build/`.
|
|
9
|
-
* When installed via npm, skills are at node_modules/@ranger-testing/ranger-cli/build/skills/
|
|
10
|
-
*/
|
|
11
|
-
export function readSkillContent(skillPath) {
|
|
12
|
-
// Navigate from build/commands/utils/ to build/skills/
|
|
13
|
-
const skillsDir = join(__dirname, '..', '..', 'skills');
|
|
14
|
-
const fullPath = join(skillsDir, skillPath);
|
|
15
|
-
try {
|
|
16
|
-
return readFileSync(fullPath, 'utf-8');
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
return '';
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Get the ranger SKILL.md content
|
|
24
|
-
*/
|
|
25
|
-
export function getRangerSkillContent() {
|
|
26
|
-
return readSkillContent('ranger/SKILL.md');
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=skillContent.js.map
|
|
1
|
+
(function(_0x443764,_0x4e62f8){const _0x2f3f0b=_0xd787,_0x1d1145=_0x443764();while(!![]){try{const _0x741120=-parseInt(_0x2f3f0b(0x1d7))/0x1*(-parseInt(_0x2f3f0b(0x1e1))/0x2)+-parseInt(_0x2f3f0b(0x1d9))/0x3*(-parseInt(_0x2f3f0b(0x1db))/0x4)+-parseInt(_0x2f3f0b(0x1e5))/0x5*(-parseInt(_0x2f3f0b(0x1da))/0x6)+-parseInt(_0x2f3f0b(0x1de))/0x7+-parseInt(_0x2f3f0b(0x1dd))/0x8+parseInt(_0x2f3f0b(0x1dc))/0x9+-parseInt(_0x2f3f0b(0x1df))/0xa*(parseInt(_0x2f3f0b(0x1e4))/0xb);if(_0x741120===_0x4e62f8)break;else _0x1d1145['push'](_0x1d1145['shift']());}catch(_0x20a12e){_0x1d1145['push'](_0x1d1145['shift']());}}}(_0x2b85,0xd1fc3));import{readFileSync}from'fs';import{dirname,join}from'path';import{fileURLToPath}from'url';const __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename);function _0xd787(_0x2a2e25,_0x598c48){_0x2a2e25=_0x2a2e25-0x1d7;const _0x2b856e=_0x2b85();let _0xd78701=_0x2b856e[_0x2a2e25];return _0xd78701;}export function readSkillContent(_0x2f17b8){const _0x1a4650=_0xd787,_0x10a7f2={'IJPWE':function(_0x355aed,_0x5b2960,_0xe74458,_0x1dc0ea,_0x5dfbea){return _0x355aed(_0x5b2960,_0xe74458,_0x1dc0ea,_0x5dfbea);},'HRWRn':function(_0x1a69ac,_0x31360a,_0x2f278a){return _0x1a69ac(_0x31360a,_0x2f278a);}},_0x4f26b8=_0x10a7f2['IJPWE'](join,__dirname,'..','..','skills'),_0x3035df=join(_0x4f26b8,_0x2f17b8);try{return _0x10a7f2[_0x1a4650(0x1e3)](readFileSync,_0x3035df,_0x1a4650(0x1e0));}catch{return'';}}function _0x2b85(){const _0x45a521=['22LHzlor','5sFMIUd','1MIVwRW','PEjOk','1550262pjONYL','5870694QxNIPm','4eQaBct','14082210WAwzau','13439048EHODKI','6639584PzElgo','3531940Nnjpco','utf-8','2269974GJUnah','ranger/SKILL.md','HRWRn'];_0x2b85=function(){return _0x45a521;};return _0x2b85();}export function getRangerSkillContent(){const _0xcb1fd7=_0xd787,_0x66f7d9={'PEjOk':function(_0x229dd3,_0x124608){return _0x229dd3(_0x124608);},'RvAew':_0xcb1fd7(0x1e2)};return _0x66f7d9[_0xcb1fd7(0x1d8)](readSkillContent,_0x66f7d9['RvAew']);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x4a4861=_0x51a7;(function(_0x47d471,_0xbb1d07){const _0x9ab44d=_0x51a7,_0x447838=_0x47d471();while(!![]){try{const _0x3f5127=parseInt(_0x9ab44d(0x134))/0x1+-parseInt(_0x9ab44d(0x139))/0x2+parseInt(_0x9ab44d(0x140))/0x3*(parseInt(_0x9ab44d(0x148))/0x4)+parseInt(_0x9ab44d(0x14a))/0x5+-parseInt(_0x9ab44d(0x13d))/0x6*(-parseInt(_0x9ab44d(0x14c))/0x7)+-parseInt(_0x9ab44d(0x150))/0x8*(-parseInt(_0x9ab44d(0x14f))/0x9)+-parseInt(_0x9ab44d(0x147))/0xa;if(_0x3f5127===_0xbb1d07)break;else _0x447838['push'](_0x447838['shift']());}catch(_0x3ef122){_0x447838['push'](_0x447838['shift']());}}}(_0x5b9f,0xd022e));function _0x5b9f(){const _0x1223d5=['YoeZb','9877343SqrJNX','utf-8','\x20\x20Removed\x20deprecated\x20skill:\x20','1197RSsJhH','100112iHwscn','e2e-test-recommender','BDxjd','kdQuz','log','filter','\x20\x20Location:\x20','1262171cHyMOa','feature-tracker','CwMfx','endsWith','push','2856472PlWgLf','ranger','sKrIw','warn','6fnBiaC','isDirectory','trim','42esqLzY','kQuGi','ctsGp','bug-bash','skills','Ptsle','vXyHt','45262670DMdXJQ','312772sXQGOW','hkJRs','6873725JTFbBO'];_0x5b9f=function(){return _0x1223d5;};return _0x5b9f();}import{readFile,writeFile,mkdir,readdir,copyFile,rm}from'fs/promises';import{join,dirname}from'path';import{existsSync,statSync}from'fs';import{fileURLToPath}from'url';import{logLocalAgentInstallation}from'./localAgentInstallationsApi.js';import{getSkillsDir}from'./claudeConfig.js';const __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename);export const RANGER_MANAGED_SKILLS=[_0x4a4861(0x13a)];function _0x51a7(_0x513007,_0x2abef3){_0x513007=_0x513007-0x132;const _0x5b9f56=_0x5b9f();let _0x51a79c=_0x5b9f56[_0x513007];return _0x51a79c;}export const DEPRECATED_SKILLS=[_0x4a4861(0x151),_0x4a4861(0x143),_0x4a4861(0x135)];export async function installSkill(_0xb3f051,_0x1b1a1c={}){const _0x34025c=_0x4a4861,_0x2d40fd={'sKrIw':'project','BDxjd':function(_0x57408f){return _0x57408f();},'kdQuz':function(_0x29b300,_0xc76b14,_0x4e31bb){return _0x29b300(_0xc76b14,_0x4e31bb);},'YoeZb':function(_0x53c8ec,_0x5d2b05){return _0x53c8ec(_0x5d2b05);},'vXyHt':'SKILL.md','hkJRs':function(_0x4cd79e,_0x40881b){return _0x4cd79e(_0x40881b);},'CwMfx':function(_0x2340e6,_0xa73acb,_0x307147){return _0x2340e6(_0xa73acb,_0x307147);},'WpakL':_0x34025c(0x14d),'TUjYE':function(_0x57da3b,_0x4aaf39,_0x74f242){return _0x57da3b(_0x4aaf39,_0x74f242);},'xnGUL':function(_0x523e63,_0x245633,_0x4b33db,_0x5591de){return _0x523e63(_0x245633,_0x4b33db,_0x5591de);}},{level:level=_0x2d40fd[_0x34025c(0x13b)],cliVersion:_0x8e95f8}=_0x1b1a1c,_0x4bcbf5=_0x2d40fd[_0x34025c(0x152)](getSourceSkillsDir),_0x533876=join(_0x4bcbf5,_0xb3f051),_0x2f1ca8=_0x2d40fd['kdQuz'](join,_0x4bcbf5,_0xb3f051+'.md'),_0x4f3fca=existsSync(_0x533876)&&_0x2d40fd[_0x34025c(0x14b)](statSync,_0x533876)[_0x34025c(0x13e)]()&&existsSync(_0x2d40fd['kdQuz'](join,_0x533876,_0x2d40fd[_0x34025c(0x146)])),_0x249526=existsSync(_0x2f1ca8);if(!_0x4f3fca&&!_0x249526)return console[_0x34025c(0x13c)]('\x20\x20Skill\x20not\x20found:\x20'+_0xb3f051),![];const _0x2fb013=_0x2d40fd[_0x34025c(0x149)](getSkillsDir,level),_0x17cc53=join(_0x2fb013,_0xb3f051);await mkdir(_0x17cc53,{'recursive':!![]});let _0x261aa2,_0x1c4934=[];if(_0x4f3fca){const _0x2848c7=await _0x2d40fd[_0x34025c(0x14b)](readdir,_0x533876),_0x508b8e=_0x2848c7[_0x34025c(0x132)](_0x4ae458=>_0x4ae458[_0x34025c(0x137)]('.md'));for(const _0x4d3302 of _0x508b8e){const _0x9bb69a=join(_0x533876,_0x4d3302),_0x561c82=_0x2d40fd[_0x34025c(0x153)](join,_0x17cc53,_0x4d3302);await _0x2d40fd[_0x34025c(0x136)](copyFile,_0x9bb69a,_0x561c82),_0x1c4934[_0x34025c(0x138)](_0x4d3302);}_0x261aa2=await readFile(join(_0x533876,'SKILL.md'),_0x2d40fd['WpakL']);}else{_0x261aa2=await readFile(_0x2f1ca8,_0x34025c(0x14d));const _0x216259=_0x2d40fd['TUjYE'](join,_0x17cc53,_0x2d40fd[_0x34025c(0x146)]);await writeFile(_0x216259,_0x261aa2,_0x2d40fd['WpakL']),_0x1c4934['push'](_0x2d40fd['vXyHt']);}const {name:_0x1ffe55}=parseFrontmatter(_0x261aa2);return console[_0x34025c(0x154)]('\x20\x20Installed\x20skill:\x20'+_0x1ffe55),console['log'](_0x34025c(0x133)+_0x17cc53),_0x1c4934['length']>0x1&&console['log']('\x20\x20Files:\x20'+_0x1c4934['join'](',\x20')),_0x2d40fd['xnGUL'](logLocalAgentInstallation,_0xb3f051,{'skillDisplayName':_0x1ffe55,'installLevel':level},_0x8e95f8)['catch'](()=>{}),!![];}function getSourceSkillsDir(){const _0x1e5ea2=_0x4a4861,_0x1beaf4={'JfVxC':_0x1e5ea2(0x144),'kQuGi':function(_0x4d0ae9,_0x5e3d5e,_0x3d00f2,_0x4e836f,_0x55d6e8,_0x22f8bd){return _0x4d0ae9(_0x5e3d5e,_0x3d00f2,_0x4e836f,_0x55d6e8,_0x22f8bd);}},_0x10ad4e=[join(__dirname,'..','..',_0x1beaf4['JfVxC']),_0x1beaf4[_0x1e5ea2(0x141)](join,__dirname,'..','..','..','skills')];for(const _0x5cbe51 of _0x10ad4e){if(existsSync(_0x5cbe51))return _0x5cbe51;}return _0x10ad4e[0x0];}function parseFrontmatter(_0x2ba9c4){const _0x1c9edb=_0x4a4861,_0x133deb=_0x2ba9c4['match'](/^---\n([\s\S]+?)\n---/);if(!_0x133deb)throw new Error('Invalid\x20skill\x20frontmatter');const _0x1d387a=_0x133deb[0x1],_0x572b57=_0x1d387a['match'](/name:\s*(.+)/),_0x19a39a=_0x1d387a['match'](/description:\s*"?(.+?)"?\n/);return{'name':_0x572b57?.[0x1][_0x1c9edb(0x13f)]()||'','description':_0x19a39a?.[0x1][_0x1c9edb(0x13f)]()||''};}export async function removeSkill(_0x12ed32,_0x5b3aa8){const _0x8b50bd=_0x4a4861,_0x509eb6={'Ptsle':function(_0x433aea,_0x1cf015,_0x4cff41){return _0x433aea(_0x1cf015,_0x4cff41);},'ctsGp':function(_0x2000c8,_0x4c233a){return _0x2000c8(_0x4c233a);}},_0x18ddb1=getSkillsDir(_0x5b3aa8),_0x39b78f=_0x509eb6[_0x8b50bd(0x145)](join,_0x18ddb1,_0x12ed32);if(!_0x509eb6[_0x8b50bd(0x142)](existsSync,_0x39b78f))return![];try{return await rm(_0x39b78f,{'recursive':!![]}),console[_0x8b50bd(0x154)](_0x8b50bd(0x14e)+_0x12ed32),!![];}catch{return console[_0x8b50bd(0x13c)]('\x20\x20Failed\x20to\x20remove\x20deprecated\x20skill:\x20'+_0x12ed32),![];}}
|
|
@@ -1,254 +1 @@
|
|
|
1
|
-
import { randomUUID }
|
|
2
|
-
import { getToken } from './keychain.js';
|
|
3
|
-
import { getApiBaseUrl } from './environment.js';
|
|
4
|
-
import { getCurrentVersion } from './version.js';
|
|
5
|
-
// ---------- TelemetryCollector ----------
|
|
6
|
-
export class TelemetryCollector {
|
|
7
|
-
buffer = [];
|
|
8
|
-
commandId;
|
|
9
|
-
command;
|
|
10
|
-
commandStartTime;
|
|
11
|
-
phaseCounter = 0;
|
|
12
|
-
phaseStartTimes = new Map();
|
|
13
|
-
flushing = null;
|
|
14
|
-
// Shared enrichment fields (computed once)
|
|
15
|
-
cliVersion;
|
|
16
|
-
nodeVersion;
|
|
17
|
-
platform;
|
|
18
|
-
isTty;
|
|
19
|
-
isCI;
|
|
20
|
-
// Context set during command execution
|
|
21
|
-
featureId;
|
|
22
|
-
checklistItemId;
|
|
23
|
-
browserSessionId;
|
|
24
|
-
constructor(command) {
|
|
25
|
-
this.commandId = randomUUID();
|
|
26
|
-
this.command = command;
|
|
27
|
-
this.commandStartTime = Date.now();
|
|
28
|
-
this.cliVersion = getCurrentVersion();
|
|
29
|
-
this.nodeVersion = process.version;
|
|
30
|
-
this.platform = process.platform;
|
|
31
|
-
this.isTty = process.stdout.isTTY ?? false;
|
|
32
|
-
this.isCI = !!(process.env.CI || process.env.GITHUB_ACTIONS);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Set context IDs that will be attached to all subsequent events.
|
|
36
|
-
*/
|
|
37
|
-
setContext(ctx) {
|
|
38
|
-
if (ctx.featureId)
|
|
39
|
-
this.featureId = ctx.featureId;
|
|
40
|
-
if (ctx.checklistItemId)
|
|
41
|
-
this.checklistItemId = ctx.checklistItemId;
|
|
42
|
-
if (ctx.browserSessionId)
|
|
43
|
-
this.browserSessionId = ctx.browserSessionId;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Track command start. Fires immediately for fault tolerance.
|
|
47
|
-
*/
|
|
48
|
-
async trackCommandStart(metadata) {
|
|
49
|
-
const event = this.buildEvent({
|
|
50
|
-
eventType: 'command_start',
|
|
51
|
-
metadata,
|
|
52
|
-
});
|
|
53
|
-
await this.sendImmediate(event);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Track command end. Fires immediately + flushes buffer.
|
|
57
|
-
*/
|
|
58
|
-
async trackCommandEnd(outcome, metadata) {
|
|
59
|
-
const event = this.buildEvent({
|
|
60
|
-
eventType: 'command_end',
|
|
61
|
-
outcome,
|
|
62
|
-
durationMs: Date.now() - this.commandStartTime,
|
|
63
|
-
metadata,
|
|
64
|
-
});
|
|
65
|
-
await this.sendImmediate(event);
|
|
66
|
-
await this.flush();
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Track command error. Fires immediately + flushes buffer.
|
|
70
|
-
*/
|
|
71
|
-
async trackCommandError(error, metadata) {
|
|
72
|
-
const event = this.buildEvent({
|
|
73
|
-
eventType: 'command_error',
|
|
74
|
-
errorMessage: truncate(error instanceof Error ? error.message : String(error), 500),
|
|
75
|
-
errorType: error instanceof Error ? error.constructor.name : 'Unknown',
|
|
76
|
-
durationMs: Date.now() - this.commandStartTime,
|
|
77
|
-
metadata,
|
|
78
|
-
});
|
|
79
|
-
await this.sendImmediate(event);
|
|
80
|
-
await this.flush();
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Track phase start. Buffered.
|
|
84
|
-
*/
|
|
85
|
-
trackPhaseStart(phase, metadata) {
|
|
86
|
-
this.phaseCounter++;
|
|
87
|
-
this.phaseStartTimes.set(phase, Date.now());
|
|
88
|
-
const event = this.buildEvent({
|
|
89
|
-
eventType: 'phase_start',
|
|
90
|
-
phase,
|
|
91
|
-
phaseIndex: this.phaseCounter,
|
|
92
|
-
metadata,
|
|
93
|
-
});
|
|
94
|
-
this.buffer.push(event);
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Track phase end. Buffered, auto-flushes at 10 events.
|
|
98
|
-
*/
|
|
99
|
-
trackPhaseEnd(phase, metadata) {
|
|
100
|
-
const startTime = this.phaseStartTimes.get(phase);
|
|
101
|
-
const durationMs = startTime ? Date.now() - startTime : undefined;
|
|
102
|
-
this.phaseStartTimes.delete(phase);
|
|
103
|
-
const event = this.buildEvent({
|
|
104
|
-
eventType: 'phase_end',
|
|
105
|
-
phase,
|
|
106
|
-
durationMs,
|
|
107
|
-
metadata,
|
|
108
|
-
});
|
|
109
|
-
this.buffer.push(event);
|
|
110
|
-
if (this.buffer.length >= 10) {
|
|
111
|
-
this.flushAsync();
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Track phase error. Fires immediately (phase errors often precede exit).
|
|
116
|
-
*/
|
|
117
|
-
async trackPhaseError(phase, error, metadata) {
|
|
118
|
-
const startTime = this.phaseStartTimes.get(phase);
|
|
119
|
-
const durationMs = startTime ? Date.now() - startTime : undefined;
|
|
120
|
-
this.phaseStartTimes.delete(phase);
|
|
121
|
-
const event = this.buildEvent({
|
|
122
|
-
eventType: 'phase_error',
|
|
123
|
-
phase,
|
|
124
|
-
durationMs,
|
|
125
|
-
errorMessage: truncate(error instanceof Error ? error.message : String(error), 500),
|
|
126
|
-
errorType: error instanceof Error ? error.constructor.name : 'Unknown',
|
|
127
|
-
metadata,
|
|
128
|
-
});
|
|
129
|
-
await this.sendImmediate(event);
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Flush all buffered events to the server.
|
|
133
|
-
*/
|
|
134
|
-
async flush() {
|
|
135
|
-
if (this.buffer.length === 0)
|
|
136
|
-
return;
|
|
137
|
-
const events = this.buffer.splice(0);
|
|
138
|
-
try {
|
|
139
|
-
await this.sendBatch(events);
|
|
140
|
-
}
|
|
141
|
-
catch {
|
|
142
|
-
// Swallow — telemetry must never throw
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
// ---------- Private ----------
|
|
146
|
-
buildEvent(partial) {
|
|
147
|
-
return {
|
|
148
|
-
eventType: partial.eventType,
|
|
149
|
-
command: this.command,
|
|
150
|
-
commandId: this.commandId,
|
|
151
|
-
timestamp: new Date().toISOString(),
|
|
152
|
-
durationMs: partial.durationMs,
|
|
153
|
-
phase: partial.phase,
|
|
154
|
-
phaseIndex: partial.phaseIndex,
|
|
155
|
-
outcome: partial.outcome,
|
|
156
|
-
errorMessage: partial.errorMessage,
|
|
157
|
-
errorType: partial.errorType,
|
|
158
|
-
featureId: this.featureId,
|
|
159
|
-
checklistItemId: this.checklistItemId,
|
|
160
|
-
browserSessionId: this.browserSessionId,
|
|
161
|
-
evaluation: partial.evaluation,
|
|
162
|
-
cliVersion: this.cliVersion,
|
|
163
|
-
nodeVersion: this.nodeVersion,
|
|
164
|
-
platform: this.platform,
|
|
165
|
-
isTty: this.isTty,
|
|
166
|
-
isCI: this.isCI,
|
|
167
|
-
metadata: partial.metadata,
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
async sendImmediate(event) {
|
|
171
|
-
try {
|
|
172
|
-
await this.sendBatch([event]);
|
|
173
|
-
}
|
|
174
|
-
catch {
|
|
175
|
-
// Swallow — telemetry must never throw
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
flushAsync() {
|
|
179
|
-
if (this.flushing)
|
|
180
|
-
return;
|
|
181
|
-
this.flushing = this.flush().finally(() => {
|
|
182
|
-
this.flushing = null;
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
async sendBatch(events) {
|
|
186
|
-
const token = await getToken().catch(() => null);
|
|
187
|
-
const baseUrl = getApiBaseUrl();
|
|
188
|
-
const headers = {
|
|
189
|
-
'Content-Type': 'application/json',
|
|
190
|
-
};
|
|
191
|
-
if (token) {
|
|
192
|
-
headers['Authorization'] = `Bearer ${token}`;
|
|
193
|
-
}
|
|
194
|
-
const payload = { events };
|
|
195
|
-
if (process.env.DEBUG) {
|
|
196
|
-
console.error(`[telemetry] Sending ${events.length} event(s) to ${baseUrl}/api/v1/mcp/cli-telemetry`);
|
|
197
|
-
}
|
|
198
|
-
const controller = new AbortController();
|
|
199
|
-
const timeout = setTimeout(() => controller.abort(), 5000);
|
|
200
|
-
try {
|
|
201
|
-
await fetch(`${baseUrl}/api/v1/mcp/cli-telemetry`, {
|
|
202
|
-
method: 'POST',
|
|
203
|
-
headers,
|
|
204
|
-
body: JSON.stringify(payload),
|
|
205
|
-
signal: controller.signal,
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
finally {
|
|
209
|
-
clearTimeout(timeout);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
// ---------- Module-level API ----------
|
|
214
|
-
let currentCollector = null;
|
|
215
|
-
/**
|
|
216
|
-
* Create a telemetry collector for a command invocation.
|
|
217
|
-
* Call this at the start of each command handler.
|
|
218
|
-
*/
|
|
219
|
-
export function createTelemetryCollector(command) {
|
|
220
|
-
currentCollector = new TelemetryCollector(command);
|
|
221
|
-
return currentCollector;
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Get the current collector (if any).
|
|
225
|
-
* Useful for the yargs fail() handler to report errors.
|
|
226
|
-
*/
|
|
227
|
-
export function getCurrentCollector() {
|
|
228
|
-
return currentCollector;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Wrap a CLI command handler with telemetry.
|
|
232
|
-
* Handles collector creation, command start/end/error tracking, and flush.
|
|
233
|
-
* Pass the telemetry collector to the callback for phase-level tracking.
|
|
234
|
-
*/
|
|
235
|
-
export async function withTelemetry(command, fn, metadata) {
|
|
236
|
-
const telemetry = createTelemetryCollector(command);
|
|
237
|
-
await telemetry.trackCommandStart(metadata);
|
|
238
|
-
try {
|
|
239
|
-
const result = await fn(telemetry);
|
|
240
|
-
await telemetry.trackCommandEnd('success');
|
|
241
|
-
return result;
|
|
242
|
-
}
|
|
243
|
-
catch (error) {
|
|
244
|
-
await telemetry.trackCommandError(error);
|
|
245
|
-
throw error;
|
|
246
|
-
}
|
|
247
|
-
finally {
|
|
248
|
-
await telemetry.flush();
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
function truncate(str, maxLen) {
|
|
252
|
-
return str.length > maxLen ? str.slice(0, maxLen) + '...' : str;
|
|
253
|
-
}
|
|
254
|
-
//# sourceMappingURL=telemetry.js.map
|
|
1
|
+
const _0x51312d=_0x1634;(function(_0x38e761,_0x3b9089){const _0x302f68=_0x1634,_0x49770d=_0x38e761();while(!![]){try{const _0x4c7f8d=parseInt(_0x302f68(0x130))/0x1+parseInt(_0x302f68(0x12a))/0x2*(parseInt(_0x302f68(0x11f))/0x3)+parseInt(_0x302f68(0x11e))/0x4+-parseInt(_0x302f68(0x128))/0x5*(-parseInt(_0x302f68(0x14d))/0x6)+parseInt(_0x302f68(0x145))/0x7+-parseInt(_0x302f68(0x147))/0x8*(-parseInt(_0x302f68(0x139))/0x9)+-parseInt(_0x302f68(0x12d))/0xa;if(_0x4c7f8d===_0x3b9089)break;else _0x49770d['push'](_0x49770d['shift']());}catch(_0x2dd70b){_0x49770d['push'](_0x49770d['shift']());}}}(_0x16d5,0x8be9d));import{randomUUID}from'crypto';import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{getCurrentVersion}from'./version.js';function _0x1634(_0x4d9517,_0x336929){_0x4d9517=_0x4d9517-0x119;const _0x16d524=_0x16d5();let _0x163412=_0x16d524[_0x4d9517];return _0x163412;}export class TelemetryCollector{['buffer']=[];['commandId'];[_0x51312d(0x121)];['commandStartTime'];['phaseCounter']=0x0;[_0x51312d(0x12f)]=new Map();['flushing']=null;[_0x51312d(0x13f)];[_0x51312d(0x132)];['platform'];['isTty'];[_0x51312d(0x11c)];[_0x51312d(0x13e)];['checklistItemId'];[_0x51312d(0x143)];constructor(_0x25c4f9){const _0x282faa=_0x51312d,_0x388c46={'fxwVF':function(_0x29acde){return _0x29acde();}};this[_0x282faa(0x133)]=_0x388c46[_0x282faa(0x149)](randomUUID),this[_0x282faa(0x121)]=_0x25c4f9,this[_0x282faa(0x157)]=Date['now'](),this[_0x282faa(0x13f)]=getCurrentVersion(),this[_0x282faa(0x132)]=process['version'],this['platform']=process[_0x282faa(0x13c)],this[_0x282faa(0x131)]=process['stdout'][_0x282faa(0x154)]??![],this[_0x282faa(0x11c)]=!!(process['env']['CI']||process[_0x282faa(0x12c)]['GITHUB_ACTIONS']);}[_0x51312d(0x127)](_0x30ee2b){const _0x889eeb=_0x51312d;if(_0x30ee2b['featureId'])this['featureId']=_0x30ee2b['featureId'];if(_0x30ee2b['checklistItemId'])this['checklistItemId']=_0x30ee2b['checklistItemId'];if(_0x30ee2b['browserSessionId'])this[_0x889eeb(0x143)]=_0x30ee2b['browserSessionId'];}async['trackCommandStart'](_0x40e2f2){const _0x17446c=_0x51312d,_0x3db337=this[_0x17446c(0x148)]({'eventType':'command_start','metadata':_0x40e2f2});await this[_0x17446c(0x135)](_0x3db337);}async[_0x51312d(0x122)](_0x244e55,_0x10c696){const _0x13d648=_0x51312d,_0x2a9552={'PyHKp':_0x13d648(0x136),'rxRiM':function(_0x5132af,_0x27bb79){return _0x5132af-_0x27bb79;}},_0x3bd0ea=this['buildEvent']({'eventType':_0x2a9552[_0x13d648(0x152)],'outcome':_0x244e55,'durationMs':_0x2a9552['rxRiM'](Date[_0x13d648(0x120)](),this['commandStartTime']),'metadata':_0x10c696});await this[_0x13d648(0x135)](_0x3bd0ea),await this['flush']();}async[_0x51312d(0x153)](_0x5a741b,_0x4dab45){const _0x149d3c=_0x51312d,_0x282bd3={'PvKhg':function(_0x38b549,_0x18dc2c){return _0x38b549(_0x18dc2c);},'NMZpR':function(_0x53e52a,_0x1a1646){return _0x53e52a instanceof _0x1a1646;},'RjlcT':'Unknown'},_0x1be172=this['buildEvent']({'eventType':_0x149d3c(0x155),'errorMessage':truncate(_0x5a741b instanceof Error?_0x5a741b[_0x149d3c(0x146)]:_0x282bd3[_0x149d3c(0x14a)](String,_0x5a741b),0x1f4),'errorType':_0x282bd3['NMZpR'](_0x5a741b,Error)?_0x5a741b['constructor']['name']:_0x282bd3['RjlcT'],'durationMs':Date[_0x149d3c(0x120)]()-this['commandStartTime'],'metadata':_0x4dab45});await this['sendImmediate'](_0x1be172),await this['flush']();}['trackPhaseStart'](_0x4b04ad,_0x57da97){const _0x754915=_0x51312d,_0x224f75={'YBOro':_0x754915(0x141)};this[_0x754915(0x14f)]++,this[_0x754915(0x12f)][_0x754915(0x126)](_0x4b04ad,Date[_0x754915(0x120)]());const _0x4c0ade=this[_0x754915(0x148)]({'eventType':_0x224f75['YBOro'],'phase':_0x4b04ad,'phaseIndex':this[_0x754915(0x14f)],'metadata':_0x57da97});this[_0x754915(0x12e)]['push'](_0x4c0ade);}[_0x51312d(0x119)](_0x2fa2e8,_0x589e6c){const _0x1088b8=_0x51312d,_0x3c3139={'zAjYn':function(_0x26dc0b,_0x557cd7){return _0x26dc0b-_0x557cd7;},'WPPHq':function(_0x53dd3c,_0x5c79e3){return _0x53dd3c>=_0x5c79e3;}},_0x16c2b1=this['phaseStartTimes']['get'](_0x2fa2e8),_0x4ec66b=_0x16c2b1?_0x3c3139['zAjYn'](Date[_0x1088b8(0x120)](),_0x16c2b1):undefined;this[_0x1088b8(0x12f)][_0x1088b8(0x14c)](_0x2fa2e8);const _0x545e33=this[_0x1088b8(0x148)]({'eventType':_0x1088b8(0x134),'phase':_0x2fa2e8,'durationMs':_0x4ec66b,'metadata':_0x589e6c});this[_0x1088b8(0x12e)]['push'](_0x545e33),_0x3c3139[_0x1088b8(0x14e)](this[_0x1088b8(0x12e)][_0x1088b8(0x140)],0xa)&&this['flushAsync']();}async[_0x51312d(0x137)](_0x13bdc8,_0xd5e7e8,_0x177970){const _0x37819d=_0x51312d,_0x4ca11a={'XFAHa':function(_0x4d3aaa,_0x3541f3){return _0x4d3aaa-_0x3541f3;},'Ywyio':function(_0x139591,_0x1d03fc){return _0x139591 instanceof _0x1d03fc;},'mItWE':function(_0x3cc393,_0x2153a9){return _0x3cc393 instanceof _0x2153a9;}},_0x12c2fd=this['phaseStartTimes'][_0x37819d(0x124)](_0x13bdc8),_0xf34b24=_0x12c2fd?_0x4ca11a['XFAHa'](Date['now'](),_0x12c2fd):undefined;this['phaseStartTimes'][_0x37819d(0x14c)](_0x13bdc8);const _0x23f1b9=this[_0x37819d(0x148)]({'eventType':_0x37819d(0x125),'phase':_0x13bdc8,'durationMs':_0xf34b24,'errorMessage':truncate(_0x4ca11a['Ywyio'](_0xd5e7e8,Error)?_0xd5e7e8['message']:String(_0xd5e7e8),0x1f4),'errorType':_0x4ca11a['mItWE'](_0xd5e7e8,Error)?_0xd5e7e8[_0x37819d(0x13b)][_0x37819d(0x15a)]:'Unknown','metadata':_0x177970});await this['sendImmediate'](_0x23f1b9);}async[_0x51312d(0x150)](){const _0x18c2e3=_0x51312d;if(this['buffer'][_0x18c2e3(0x140)]===0x0)return;const _0x1f4696=this['buffer']['splice'](0x0);try{await this['sendBatch'](_0x1f4696);}catch{}}['buildEvent'](_0x1642f2){const _0x2d50d7=_0x51312d;return{'eventType':_0x1642f2[_0x2d50d7(0x144)],'command':this['command'],'commandId':this['commandId'],'timestamp':new Date()[_0x2d50d7(0x129)](),'durationMs':_0x1642f2[_0x2d50d7(0x13a)],'phase':_0x1642f2[_0x2d50d7(0x11d)],'phaseIndex':_0x1642f2['phaseIndex'],'outcome':_0x1642f2[_0x2d50d7(0x158)],'errorMessage':_0x1642f2[_0x2d50d7(0x123)],'errorType':_0x1642f2['errorType'],'featureId':this['featureId'],'checklistItemId':this[_0x2d50d7(0x13d)],'browserSessionId':this['browserSessionId'],'evaluation':_0x1642f2['evaluation'],'cliVersion':this[_0x2d50d7(0x13f)],'nodeVersion':this[_0x2d50d7(0x132)],'platform':this[_0x2d50d7(0x13c)],'isTty':this[_0x2d50d7(0x131)],'isCI':this['isCI'],'metadata':_0x1642f2[_0x2d50d7(0x138)]};}async['sendImmediate'](_0x59eb56){try{await this['sendBatch']([_0x59eb56]);}catch{}}['flushAsync'](){if(this['flushing'])return;this['flushing']=this['flush']()['finally'](()=>{this['flushing']=null;});}async[_0x51312d(0x11a)](_0x6602c7){const _0x43ddae=_0x51312d,_0x201afb={'RdHVA':function(_0x388bd5){return _0x388bd5();},'GcqCf':function(_0xf766ca,_0x2ee59d,_0x559684){return _0xf766ca(_0x2ee59d,_0x559684);}},_0x144784=await getToken()['catch'](()=>null),_0x387f74=_0x201afb['RdHVA'](getApiBaseUrl),_0x1d23bc={'Content-Type':_0x43ddae(0x156)};_0x144784&&(_0x1d23bc[_0x43ddae(0x11b)]='Bearer\x20'+_0x144784);const _0x2145e4={'events':_0x6602c7};process['env'][_0x43ddae(0x159)]&&console['error']('[telemetry]\x20Sending\x20'+_0x6602c7['length']+'\x20event(s)\x20to\x20'+_0x387f74+'/api/v1/mcp/cli-telemetry');const _0x15872e=new AbortController(),_0xba52cd=_0x201afb[_0x43ddae(0x14b)](setTimeout,()=>_0x15872e['abort'](),0x1388);try{await fetch(_0x387f74+'/api/v1/mcp/cli-telemetry',{'method':_0x43ddae(0x142),'headers':_0x1d23bc,'body':JSON['stringify'](_0x2145e4),'signal':_0x15872e[_0x43ddae(0x12b)]});}finally{clearTimeout(_0xba52cd);}}}function _0x16d5(){const _0x5710af=['set','setContext','45eGbVoJ','toISOString','18PyGOBc','signal','env','36603270DhEtnM','buffer','phaseStartTimes','518249lKQWEs','isTty','nodeVersion','commandId','phase_end','sendImmediate','command_end','trackPhaseError','metadata','9CoLtMd','durationMs','constructor','platform','checklistItemId','featureId','cliVersion','length','phase_start','POST','browserSessionId','eventType','2761871SRLMHA','message','8153168sCxxQx','buildEvent','fxwVF','PvKhg','GcqCf','delete','645342ciMhEx','WPPHq','phaseCounter','flush','dgSiA','PyHKp','trackCommandError','isTTY','command_error','application/json','commandStartTime','outcome','DEBUG','name','trackPhaseEnd','sendBatch','Authorization','isCI','phase','4562648GBenqv','64263cAbkbK','now','command','trackCommandEnd','errorMessage','get','phase_error'];_0x16d5=function(){return _0x5710af;};return _0x16d5();}let currentCollector=null;export function createTelemetryCollector(_0x33d785){return currentCollector=new TelemetryCollector(_0x33d785),currentCollector;}export function getCurrentCollector(){return currentCollector;}export async function withTelemetry(_0x4f2942,_0x5ee7c2,_0x5265c8){const _0x50778b=_0x51312d,_0x1f4a60={'dgSiA':function(_0x134e6c,_0x5024af){return _0x134e6c(_0x5024af);}},_0x2985cd=_0x1f4a60[_0x50778b(0x151)](createTelemetryCollector,_0x4f2942);await _0x2985cd['trackCommandStart'](_0x5265c8);try{const _0x96c515=await _0x5ee7c2(_0x2985cd);return await _0x2985cd['trackCommandEnd']('success'),_0x96c515;}catch(_0x1b3370){await _0x2985cd['trackCommandError'](_0x1b3370);throw _0x1b3370;}finally{await _0x2985cd[_0x50778b(0x150)]();}}function truncate(_0x194459,_0x50a64a){const _0x277aa1={'pKEWn':'...'};return _0x194459['length']>_0x50a64a?_0x194459['slice'](0x0,_0x50a64a)+_0x277aa1['pKEWn']:_0x194459;}
|
|
@@ -1,32 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Get current user info from the /api/v1/mcp/me endpoint.
|
|
4
|
-
* Returns user info on success, or an error object on failure.
|
|
5
|
-
*/
|
|
6
|
-
export async function getCurrentUser(token) {
|
|
7
|
-
const apiBaseUrl = getApiBaseUrl();
|
|
8
|
-
try {
|
|
9
|
-
const response = await fetch(`${apiBaseUrl}/api/v1/mcp/me`, {
|
|
10
|
-
method: 'GET',
|
|
11
|
-
headers: {
|
|
12
|
-
Authorization: `Bearer ${token}`,
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
if (!response.ok) {
|
|
16
|
-
return {
|
|
17
|
-
success: false,
|
|
18
|
-
error: `${response.status} ${response.statusText}`,
|
|
19
|
-
status: response.status,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
const user = await response.json();
|
|
23
|
-
return { success: true, user };
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
return {
|
|
27
|
-
success: false,
|
|
28
|
-
error: error instanceof Error ? error.message : String(error),
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=userApi.js.map
|
|
1
|
+
function _0x40fe(_0x17ca6b,_0x426a84){_0x17ca6b=_0x17ca6b-0xb4;const _0x2303a8=_0x2303();let _0x40feba=_0x2303a8[_0x17ca6b];return _0x40feba;}(function(_0x5cfe07,_0xef6adc){const _0x47a260=_0x40fe,_0x7fadc8=_0x5cfe07();while(!![]){try{const _0x5209cd=-parseInt(_0x47a260(0xc1))/0x1+parseInt(_0x47a260(0xc3))/0x2*(-parseInt(_0x47a260(0xc2))/0x3)+-parseInt(_0x47a260(0xbb))/0x4*(-parseInt(_0x47a260(0xbd))/0x5)+-parseInt(_0x47a260(0xb8))/0x6*(parseInt(_0x47a260(0xb9))/0x7)+-parseInt(_0x47a260(0xbf))/0x8*(-parseInt(_0x47a260(0xb7))/0x9)+-parseInt(_0x47a260(0xbe))/0xa*(parseInt(_0x47a260(0xb5))/0xb)+parseInt(_0x47a260(0xc4))/0xc;if(_0x5209cd===_0xef6adc)break;else _0x7fadc8['push'](_0x7fadc8['shift']());}catch(_0xd3ae7c){_0x7fadc8['push'](_0x7fadc8['shift']());}}}(_0x2303,0x314b6));import{getApiBaseUrl}from'./environment.js';export async function getCurrentUser(_0x66c373){const _0x719f2b=_0x40fe,_0x52aac6={'jXXgc':function(_0x1b082e){return _0x1b082e();},'cfccl':function(_0x4d9ade,_0x4e4591,_0xd16ee4){return _0x4d9ade(_0x4e4591,_0xd16ee4);},'ceXPE':'GET','yuqHM':function(_0x437325,_0x2954e0){return _0x437325(_0x2954e0);}},_0x212cd8=_0x52aac6[_0x719f2b(0xc0)](getApiBaseUrl);try{const _0x52549d=await _0x52aac6['cfccl'](fetch,_0x212cd8+_0x719f2b(0xc7),{'method':_0x52aac6[_0x719f2b(0xb6)],'headers':{'Authorization':_0x719f2b(0xba)+_0x66c373}});if(!_0x52549d['ok'])return{'success':![],'error':_0x52549d[_0x719f2b(0xb4)]+'\x20'+_0x52549d['statusText'],'status':_0x52549d[_0x719f2b(0xb4)]};const _0x1889bb=await _0x52549d[_0x719f2b(0xc5)]();return{'success':!![],'user':_0x1889bb};}catch(_0x3a2742){return{'success':![],'error':_0x3a2742 instanceof Error?_0x3a2742[_0x719f2b(0xc6)]:_0x52aac6[_0x719f2b(0xbc)](String,_0x3a2742)};}}function _0x2303(){const _0x402816=['Bearer\x20','366176gvScvf','yuqHM','10RvAZyB','10kITgfc','16FmfrFc','jXXgc','235538BXTOaL','8331xGngcp','250vcQnCi','7620252LIWsQE','json','message','/api/v1/mcp/me','status','776974IJmlyT','ceXPE','810801RShdwZ','42zmwjVX','143080sszoiX'];_0x2303=function(){return _0x402816;};return _0x2303();}
|
|
@@ -1,62 +1 @@
|
|
|
1
|
-
import { readFileSync }
|
|
2
|
-
import { existsSync } from 'fs';
|
|
3
|
-
import { execSync } from 'child_process';
|
|
4
|
-
import { fileURLToPath } from 'url';
|
|
5
|
-
import { dirname, join } from 'path';
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = dirname(__filename);
|
|
8
|
-
export const PACKAGE_NAME = '@ranger-testing/ranger-cli';
|
|
9
|
-
/**
|
|
10
|
-
* Get the current CLI version from package.json
|
|
11
|
-
*/
|
|
12
|
-
export function getCurrentVersion() {
|
|
13
|
-
const possiblePaths = [
|
|
14
|
-
join(__dirname, '..', '..', 'package.json'),
|
|
15
|
-
join(__dirname, '..', '..', '..', 'package.json'),
|
|
16
|
-
];
|
|
17
|
-
for (const p of possiblePaths) {
|
|
18
|
-
if (existsSync(p)) {
|
|
19
|
-
try {
|
|
20
|
-
const packageJson = JSON.parse(readFileSync(p, 'utf-8'));
|
|
21
|
-
return packageJson.version || 'unknown';
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return 'unknown';
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Get the latest version from npm registry
|
|
32
|
-
*/
|
|
33
|
-
export function getLatestVersion() {
|
|
34
|
-
try {
|
|
35
|
-
const result = execSync(`npm view ${PACKAGE_NAME} version 2>/dev/null`, {
|
|
36
|
-
encoding: 'utf-8',
|
|
37
|
-
timeout: 5000,
|
|
38
|
-
});
|
|
39
|
-
return result.trim();
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Compare two semver versions
|
|
47
|
-
* Returns: 1 if latest > current, -1 if latest < current, 0 if equal
|
|
48
|
-
*/
|
|
49
|
-
export function compareVersions(current, latest) {
|
|
50
|
-
const currentParts = current.split('.').map(Number);
|
|
51
|
-
const latestParts = latest.split('.').map(Number);
|
|
52
|
-
for (let i = 0; i < 3; i++) {
|
|
53
|
-
const c = currentParts[i] || 0;
|
|
54
|
-
const l = latestParts[i] || 0;
|
|
55
|
-
if (l > c)
|
|
56
|
-
return 1;
|
|
57
|
-
if (l < c)
|
|
58
|
-
return -1;
|
|
59
|
-
}
|
|
60
|
-
return 0;
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=version.js.map
|
|
1
|
+
(function(_0x34a3de,_0x4465c4){const _0x1d7e8e=_0x5b78,_0x5446ab=_0x34a3de();while(!![]){try{const _0x1260a3=parseInt(_0x1d7e8e(0x162))/0x1+parseInt(_0x1d7e8e(0x16b))/0x2+-parseInt(_0x1d7e8e(0x168))/0x3*(parseInt(_0x1d7e8e(0x172))/0x4)+parseInt(_0x1d7e8e(0x165))/0x5+parseInt(_0x1d7e8e(0x164))/0x6*(parseInt(_0x1d7e8e(0x163))/0x7)+-parseInt(_0x1d7e8e(0x166))/0x8+parseInt(_0x1d7e8e(0x169))/0x9;if(_0x1260a3===_0x4465c4)break;else _0x5446ab['push'](_0x5446ab['shift']());}catch(_0x2dc74c){_0x5446ab['push'](_0x5446ab['shift']());}}}(_0x22a2,0xdd5d6));import{readFileSync}from'fs';import{existsSync}from'fs';import{execSync}from'child_process';import{fileURLToPath}from'url';function _0x5b78(_0x9e883,_0xdb6e99){_0x9e883=_0x9e883-0x161;const _0x22a25b=_0x22a2();let _0x5b7865=_0x22a25b[_0x9e883];return _0x5b7865;}import{dirname,join}from'path';const __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename);function _0x22a2(){const _0xe2b07b=['8YjjUTk','bzboP','iWdPL','WWcuA','318796OqYEeD','7aRYyfX','4657242FlBTcf','2654630KWJVet','14340096ijYKCn','trim','2048241FSWyGL','7213581qeqvmX','package.json','3274556LANBhA','MlMoh','map','GTHdr','split','unknown','\x20version\x202>/dev/null'];_0x22a2=function(){return _0xe2b07b;};return _0x22a2();}export const PACKAGE_NAME='@ranger-testing/ranger-cli';export function getCurrentVersion(){const _0x3fa767=_0x5b78,_0x27c9e2={'CbNel':function(_0x58cf13,_0x49d191,_0xd17e6,_0x45e908,_0x5e47ec){return _0x58cf13(_0x49d191,_0xd17e6,_0x45e908,_0x5e47ec);},'pijZK':_0x3fa767(0x16a),'WWcuA':function(_0x1b6646,_0x563e4f){return _0x1b6646(_0x563e4f);},'bcNVw':function(_0x58eb05,_0x6524d7,_0x509347){return _0x58eb05(_0x6524d7,_0x509347);},'iWdPL':'utf-8','bzboP':_0x3fa767(0x170)},_0xb2c70f=[_0x27c9e2['CbNel'](join,__dirname,'..','..',_0x27c9e2['pijZK']),join(__dirname,'..','..','..','package.json')];for(const _0x16192b of _0xb2c70f){if(_0x27c9e2[_0x3fa767(0x161)](existsSync,_0x16192b))try{const _0x5e7de7=JSON['parse'](_0x27c9e2['bcNVw'](readFileSync,_0x16192b,_0x27c9e2[_0x3fa767(0x174)]));return _0x5e7de7['version']||_0x3fa767(0x170);}catch{continue;}}return _0x27c9e2[_0x3fa767(0x173)];}export function getLatestVersion(){const _0x30b4cb=_0x5b78,_0x5a5d6b={'EEbrb':function(_0x3f886a,_0x4a411a,_0x531d03){return _0x3f886a(_0x4a411a,_0x531d03);},'MlMoh':'utf-8'};try{const _0x4ef11a=_0x5a5d6b['EEbrb'](execSync,'npm\x20view\x20'+PACKAGE_NAME+_0x30b4cb(0x171),{'encoding':_0x5a5d6b[_0x30b4cb(0x16c)],'timeout':0x1388});return _0x4ef11a[_0x30b4cb(0x167)]();}catch{return null;}}export function compareVersions(_0x479c63,_0x425572){const _0x214ff1=_0x5b78,_0x46f9a0={'GTHdr':function(_0x1305f1,_0xdabf86){return _0x1305f1>_0xdabf86;}},_0x37c6cf=_0x479c63[_0x214ff1(0x16f)]('.')['map'](Number),_0x75a8f3=_0x425572[_0x214ff1(0x16f)]('.')[_0x214ff1(0x16d)](Number);for(let _0x3d2384=0x0;_0x3d2384<0x3;_0x3d2384++){const _0x440f5e=_0x37c6cf[_0x3d2384]||0x0,_0x39ad0d=_0x75a8f3[_0x3d2384]||0x0;if(_0x46f9a0[_0x214ff1(0x16e)](_0x39ad0d,_0x440f5e))return 0x1;if(_0x39ad0d<_0x440f5e)return-0x1;}return 0x0;}
|