xtra-cli 1.0.1 → 1.0.3

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.
@@ -14,6 +14,7 @@ exports.checkoutCommand = new commander_1.Command("checkout")
14
14
  .description("Switch the active branch context")
15
15
  .argument("[branchName]", "Branch name to switch to (optional - will show list if not provided)")
16
16
  .option("-p, --project <projectId>", "Project ID")
17
+ .option("-e, --env <environment>", "Set the active environment (e.g. development, staging, production)")
17
18
  .action(async (branchName, options) => {
18
19
  let { project } = options;
19
20
  // Try to get project from config if not provided
@@ -59,7 +60,13 @@ exports.checkoutCommand = new commander_1.Command("checkout")
59
60
  // Save to config
60
61
  (0, config_1.setConfig)("branch", selectedBranch);
61
62
  (0, config_1.setConfig)("project", project);
62
- console.log(chalk_1.default.green(`✔ Switched to branch '${selectedBranch}'`));
63
+ if (options.env) {
64
+ (0, config_1.setConfig)("env", options.env);
65
+ }
66
+ console.log(chalk_1.default.green(`\u2714 Switched to branch '${selectedBranch}'`));
67
+ if (options.env) {
68
+ console.log(chalk_1.default.green(`\u2714 Environment set to '${options.env}'`));
69
+ }
63
70
  }
64
71
  catch (error) {
65
72
  spinner.fail("Failed to fetch branches");
@@ -12,11 +12,13 @@ const config = new conf_1.default({
12
12
  apiUrl: PRODUCTION_API_URL,
13
13
  },
14
14
  });
15
- // Auto-heal: if an old localhost value was persisted, clear it so we use production.
15
+ // Auto-heal: if an old localhost or deprecated domain was persisted, clear it so we use production.
16
16
  // Users who intentionally want localhost should set XTRA_API_URL env var instead.
17
17
  const _storedApiUrl = config.get("apiUrl");
18
- if (_storedApiUrl && _storedApiUrl.includes("localhost") && !process.env.XTRA_API_URL) {
19
- config.set("apiUrl", PRODUCTION_API_URL);
18
+ if (_storedApiUrl && !process.env.XTRA_API_URL) {
19
+ if (_storedApiUrl.includes("localhost") || _storedApiUrl.includes("xtra-security.vercel.app")) {
20
+ config.set("apiUrl", PRODUCTION_API_URL);
21
+ }
20
22
  }
21
23
  const getConfig = () => ({
22
24
  ...config.store,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xtra-cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "CLI for XtraSecurity Platform",
5
5
  "main": "dist/index.js",
6
6
  "bin": {