luxlabs 1.0.12 → 1.0.13
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/commands/ab-tests.js +13 -40
- package/package.json +1 -1
package/commands/ab-tests.js
CHANGED
|
@@ -20,6 +20,7 @@ const chalk = require('chalk');
|
|
|
20
20
|
const fs = require('fs');
|
|
21
21
|
const path = require('path');
|
|
22
22
|
const ora = require('ora');
|
|
23
|
+
const { loadConfig, getProjectId, getStudioApiUrl } = require('../lib/config');
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* Show help for ab-tests commands
|
|
@@ -412,52 +413,24 @@ function parseOptions(args) {
|
|
|
412
413
|
}
|
|
413
414
|
|
|
414
415
|
/**
|
|
415
|
-
* Get credentials
|
|
416
|
+
* Get credentials using the shared config system
|
|
416
417
|
*/
|
|
417
418
|
function getCredentials(options) {
|
|
418
|
-
|
|
419
|
-
const
|
|
420
|
-
|
|
421
|
-
if (!fs.existsSync(configPath)) {
|
|
419
|
+
// Use the shared config system from lib/config.js
|
|
420
|
+
const config = loadConfig();
|
|
421
|
+
if (!config || !config.apiKey || !config.orgId) {
|
|
422
422
|
return null;
|
|
423
423
|
}
|
|
424
424
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
// Get projectId from options, .lux.json, config, or path detection
|
|
429
|
-
let projectId = options?.project || config.projectId;
|
|
430
|
-
|
|
431
|
-
// Try to get projectId from .lux.json if not in config
|
|
432
|
-
if (!projectId) {
|
|
433
|
-
const luxConfigPath = path.join(process.cwd(), '.lux.json');
|
|
434
|
-
if (fs.existsSync(luxConfigPath)) {
|
|
435
|
-
try {
|
|
436
|
-
const luxConfig = JSON.parse(fs.readFileSync(luxConfigPath, 'utf-8'));
|
|
437
|
-
projectId = luxConfig.projectId;
|
|
438
|
-
} catch (e) { /* ignore */ }
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
// Try to extract projectId from current working directory path
|
|
443
|
-
// Path format: .lux-studio/<orgId>/projects/<projectId>/interfaces/<interfaceId>/repo/
|
|
444
|
-
if (!projectId) {
|
|
445
|
-
const cwd = process.cwd();
|
|
446
|
-
const projectsMatch = cwd.match(/\/projects\/([^/]+)/);
|
|
447
|
-
if (projectsMatch) {
|
|
448
|
-
projectId = projectsMatch[1];
|
|
449
|
-
}
|
|
450
|
-
}
|
|
425
|
+
// Get projectId from options or the shared config system
|
|
426
|
+
let projectId = options?.project || getProjectId();
|
|
451
427
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
} catch (e) {
|
|
459
|
-
return null;
|
|
460
|
-
}
|
|
428
|
+
return {
|
|
429
|
+
apiKey: config.apiKey,
|
|
430
|
+
orgId: config.orgId,
|
|
431
|
+
projectId: projectId,
|
|
432
|
+
apiUrl: getStudioApiUrl()
|
|
433
|
+
};
|
|
461
434
|
}
|
|
462
435
|
|
|
463
436
|
/**
|
package/package.json
CHANGED