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.
@@ -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 from config file, .lux.json, or path detection
416
+ * Get credentials using the shared config system
416
417
  */
417
418
  function getCredentials(options) {
418
- const os = require('os');
419
- const configPath = path.join(os.homedir(), '.lux', 'config.json');
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
- try {
426
- const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
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
- return {
453
- apiKey: config.apiKey,
454
- orgId: config.orgId,
455
- projectId: projectId,
456
- apiUrl: config.apiUrl || 'https://v2.uselux.ai'
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "luxlabs",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "CLI tool for Lux - Upload and deploy interfaces from your terminal",
5
5
  "author": "Jason Henkel <jason@uselux.ai>",
6
6
  "license": "SEE LICENSE IN LICENSE",