@saidulbadhon/jssm-cli 1.6.7 → 1.8.0

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.
Files changed (2) hide show
  1. package/dist/index.js +191 -119
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3989,7 +3989,11 @@ import { join as join2 } from "path";
3989
3989
  import { homedir as homedir2 } from "os";
3990
3990
 
3991
3991
  // src/shared/constants.ts
3992
- var DEFAULT_HOST = "https://jssm-api.jutsu.ai/api";
3992
+ var PROD_HOST = "https://jssm-api.jutsu.ai/api";
3993
+ var DEV_HOST = "http://localhost:3000/api";
3994
+ function getHost() {
3995
+ return process.env.NODE_ENV === "development" ? DEV_HOST : PROD_HOST;
3996
+ }
3993
3997
  var DEFAULT_NAMESPACE = "jssm";
3994
3998
  var CONFIG_DIR = ".jssm";
3995
3999
  var CONFIG_FILE = "config";
@@ -4109,7 +4113,7 @@ async function resolveConfig() {
4109
4113
  }
4110
4114
  const resolved = {
4111
4115
  project: projectConfig.project,
4112
- host: projectConfig.host || globalConfig.host || DEFAULT_HOST,
4116
+ host: getHost(),
4113
4117
  namespace: projectConfig.namespace || globalConfig.namespace || DEFAULT_NAMESPACE,
4114
4118
  authToken
4115
4119
  };
@@ -4120,11 +4124,6 @@ function validateResolvedConfig(config) {
4120
4124
  if (!config.project) {
4121
4125
  errors.push("Project name is required");
4122
4126
  }
4123
- if (!config.host) {
4124
- errors.push(
4125
- "Host URL is required (set globally with: jssm config set host <url>)"
4126
- );
4127
- }
4128
4127
  if (!config.authToken) {
4129
4128
  errors.push("Not logged in. Run: jssm login");
4130
4129
  }
@@ -4365,13 +4364,7 @@ async function initCommand(args2) {
4365
4364
  }
4366
4365
  console.log(`\u2705 Logged in as ${authData.user.email}
4367
4366
  `);
4368
- const globalConfig = await loadGlobalConfig();
4369
- const host = flags.host || flags.h || globalConfig.host;
4370
- if (!host) {
4371
- console.error("\u274C Host URL is required");
4372
- console.error("\u{1F4A1} Set it globally: jssm config set host <url>");
4373
- process.exit(1);
4374
- }
4367
+ const host = getHost();
4375
4368
  const authToken = authData.token;
4376
4369
  console.log("\u{1F50D} Analyzing repository...");
4377
4370
  const cwd = process.cwd();
@@ -4527,12 +4520,10 @@ Upload to ${projectName}?`,
4527
4520
  }
4528
4521
  }
4529
4522
  }
4523
+ const globalConfig = await loadGlobalConfig();
4530
4524
  const projectConfig = {
4531
4525
  project: projectName
4532
4526
  };
4533
- if (flags.host && flags.host !== globalConfig.host) {
4534
- projectConfig.host = flags.host;
4535
- }
4536
4527
  if (flags.namespace && flags.namespace !== globalConfig.namespace) {
4537
4528
  projectConfig.namespace = flags.namespace;
4538
4529
  }
@@ -4559,9 +4550,28 @@ Upload to ${projectName}?`,
4559
4550
  }
4560
4551
 
4561
4552
  // src/commands/pull.ts
4562
- import { writeFile as writeFile3, mkdir as mkdir3 } from "fs/promises";
4553
+ import { writeFile as writeFile3, mkdir as mkdir3, readFile as readFile4 } from "fs/promises";
4563
4554
  import { join as join4, dirname } from "path";
4564
4555
  import { existsSync as existsSync2 } from "fs";
4556
+ function calculateLineDiff(oldContent, newContent) {
4557
+ if (!oldContent) {
4558
+ const lines = newContent.split("\n");
4559
+ const nonEmptyLines = lines.filter((line) => line.trim().length > 0).length;
4560
+ return { changedLines: nonEmptyLines, isNewFile: true };
4561
+ }
4562
+ const oldLines = oldContent.split("\n");
4563
+ const newLines = newContent.split("\n");
4564
+ const maxLength = Math.max(oldLines.length, newLines.length);
4565
+ let changedLines = 0;
4566
+ for (let i = 0; i < maxLength; i++) {
4567
+ const oldLine = i < oldLines.length ? oldLines[i] : "";
4568
+ const newLine = i < newLines.length ? newLines[i] : "";
4569
+ if (oldLine !== newLine) {
4570
+ changedLines++;
4571
+ }
4572
+ }
4573
+ return { changedLines, isNewFile: false };
4574
+ }
4565
4575
  async function pullCommand2(args2) {
4566
4576
  const flags = {};
4567
4577
  let pullAll = false;
@@ -4618,13 +4628,28 @@ async function pullCommand2(args2) {
4618
4628
  project,
4619
4629
  output
4620
4630
  );
4631
+ let existingContent = null;
4632
+ if (existsSync2(outputPath)) {
4633
+ try {
4634
+ existingContent = await readFile4(outputPath, "utf-8");
4635
+ } catch {
4636
+ existingContent = null;
4637
+ }
4638
+ }
4639
+ const { changedLines, isNewFile } = calculateLineDiff(
4640
+ existingContent,
4641
+ content
4642
+ );
4621
4643
  const dir = dirname(outputPath);
4622
4644
  if (dir !== process.cwd()) {
4623
4645
  await mkdir3(dir, { recursive: true });
4624
4646
  }
4625
4647
  await writeFile3(outputPath, content, "utf-8");
4626
4648
  const varCount = countVariables(content);
4627
- console.log(`\u2705 Wrote ${output} (${varCount} variables)`);
4649
+ const statusText = isNewFile ? "Created" : "Updated";
4650
+ console.log(
4651
+ `\u2705 ${statusText} ${output} (${varCount} variables, ${changedLines} line${changedLines !== 1 ? "s" : ""} changed)`
4652
+ );
4628
4653
  return;
4629
4654
  }
4630
4655
  console.log(`\u{1F4E5} Checking available files in ${project}...`);
@@ -4725,6 +4750,9 @@ async function pullCommand2(args2) {
4725
4750
  }
4726
4751
  let successCount = 0;
4727
4752
  let failCount = 0;
4753
+ let updatedFilesCount = 0;
4754
+ let newFilesCount = 0;
4755
+ let totalChangedLines = 0;
4728
4756
  for (const filename of selectedFiles) {
4729
4757
  try {
4730
4758
  const outputPath = join4(process.cwd(), filename);
@@ -4734,16 +4762,40 @@ async function pullCommand2(args2) {
4734
4762
  project,
4735
4763
  filename
4736
4764
  );
4765
+ let existingContent = null;
4766
+ if (existsSync2(outputPath)) {
4767
+ try {
4768
+ existingContent = await readFile4(outputPath, "utf-8");
4769
+ } catch {
4770
+ existingContent = null;
4771
+ }
4772
+ }
4773
+ const { changedLines, isNewFile } = calculateLineDiff(
4774
+ existingContent,
4775
+ content
4776
+ );
4737
4777
  const dir = dirname(outputPath);
4738
4778
  if (dir !== process.cwd()) {
4739
4779
  await mkdir3(dir, { recursive: true });
4740
4780
  }
4741
4781
  await writeFile3(outputPath, content, "utf-8");
4742
4782
  const varCount = countVariables(content);
4783
+ if (isNewFile) {
4784
+ newFilesCount++;
4785
+ } else {
4786
+ updatedFilesCount++;
4787
+ }
4788
+ totalChangedLines += changedLines;
4743
4789
  if (selectedFiles.length === 1) {
4744
- console.log(`\u2705 Wrote ${filename} (${varCount} variables)`);
4790
+ const statusText = isNewFile ? "Created" : "Updated";
4791
+ console.log(
4792
+ `\u2705 ${statusText} ${filename} (${varCount} variables, ${changedLines} line${changedLines !== 1 ? "s" : ""} changed)`
4793
+ );
4745
4794
  } else {
4746
- console.log(`\u2705 ${filename}: Pulled (${varCount} variables)`);
4795
+ const statusText = isNewFile ? "Created" : "Updated";
4796
+ console.log(
4797
+ `\u2705 ${filename}: ${statusText} (${varCount} variables, ${changedLines} line${changedLines !== 1 ? "s" : ""} changed)`
4798
+ );
4747
4799
  }
4748
4800
  successCount++;
4749
4801
  } catch (error) {
@@ -4758,9 +4810,29 @@ async function pullCommand2(args2) {
4758
4810
  if (successCount > 0) {
4759
4811
  console.log(` \u2705 Success: ${successCount} file(s)`);
4760
4812
  }
4813
+ if (newFilesCount > 0) {
4814
+ console.log(` \u{1F4C4} New files: ${newFilesCount}`);
4815
+ }
4816
+ if (updatedFilesCount > 0) {
4817
+ console.log(` \u{1F4DD} Updated files: ${updatedFilesCount}`);
4818
+ }
4819
+ if (totalChangedLines > 0) {
4820
+ console.log(` \u{1F4CF} Total lines changed: ${totalChangedLines}`);
4821
+ }
4761
4822
  if (failCount > 0) {
4762
4823
  console.log(` \u274C Failed: ${failCount} file(s)`);
4763
4824
  }
4825
+ } else if (successCount === 1) {
4826
+ if (newFilesCount > 0) {
4827
+ console.log(`
4828
+ \u{1F4CA} Summary: New file created`);
4829
+ } else if (updatedFilesCount > 0) {
4830
+ console.log(`
4831
+ \u{1F4CA} Summary: File updated`);
4832
+ }
4833
+ if (totalChangedLines > 0) {
4834
+ console.log(` \u{1F4CF} Lines changed: ${totalChangedLines}`);
4835
+ }
4764
4836
  }
4765
4837
  if (failCount > 0 && successCount === 0) {
4766
4838
  process.exit(1);
@@ -4779,8 +4851,27 @@ function countVariables(content) {
4779
4851
  }
4780
4852
 
4781
4853
  // src/commands/push.ts
4782
- import { readFile as readFile4 } from "fs/promises";
4854
+ import { readFile as readFile5 } from "fs/promises";
4783
4855
  import { join as join5 } from "path";
4856
+ function calculateLineDiff2(oldContent, newContent) {
4857
+ if (!oldContent) {
4858
+ const lines = newContent.split("\n");
4859
+ const nonEmptyLines = lines.filter((line) => line.trim().length > 0).length;
4860
+ return { changedLines: nonEmptyLines, isNewFile: true };
4861
+ }
4862
+ const oldLines = oldContent.split("\n");
4863
+ const newLines = newContent.split("\n");
4864
+ const maxLength = Math.max(oldLines.length, newLines.length);
4865
+ let changedLines = 0;
4866
+ for (let i = 0; i < maxLength; i++) {
4867
+ const oldLine = i < oldLines.length ? oldLines[i] : "";
4868
+ const newLine = i < newLines.length ? newLines[i] : "";
4869
+ if (oldLine !== newLine) {
4870
+ changedLines++;
4871
+ }
4872
+ }
4873
+ return { changedLines, isNewFile: false };
4874
+ }
4784
4875
  async function pushCommand2(args2) {
4785
4876
  const flags = {};
4786
4877
  for (let i = 0; i < args2.length; i++) {
@@ -4889,12 +4980,15 @@ async function pushCommand2(args2) {
4889
4980
  }
4890
4981
  let successCount = 0;
4891
4982
  let failCount = 0;
4983
+ let updatedFilesCount = 0;
4984
+ let newFilesCount = 0;
4985
+ let totalChangedLines = 0;
4892
4986
  for (const file of selectedFiles) {
4893
4987
  let fileContent = "";
4894
4988
  let fileSize = 0;
4895
4989
  try {
4896
4990
  const inputPath = join5(process.cwd(), file);
4897
- fileContent = await readFile4(inputPath, "utf-8");
4991
+ fileContent = await readFile5(inputPath, "utf-8");
4898
4992
  fileSize = Buffer.byteLength(fileContent, "utf-8");
4899
4993
  const variables = parseVariables(fileContent, file);
4900
4994
  if (variables.length === 0) {
@@ -4920,6 +5014,21 @@ async function pushCommand2(args2) {
4920
5014
  failCount++;
4921
5015
  continue;
4922
5016
  }
5017
+ let existingContent = null;
5018
+ try {
5019
+ existingContent = await pullEnvFile(
5020
+ config.host,
5021
+ config.authToken,
5022
+ project,
5023
+ file
5024
+ );
5025
+ } catch {
5026
+ existingContent = null;
5027
+ }
5028
+ const { changedLines, isNewFile } = calculateLineDiff2(
5029
+ existingContent,
5030
+ fileContent
5031
+ );
4923
5032
  const result = await pushEnvFile(
4924
5033
  config.host,
4925
5034
  config.authToken,
@@ -4929,19 +5038,35 @@ async function pushCommand2(args2) {
4929
5038
  // Use full relative path, not just filename
4930
5039
  );
4931
5040
  const tagInfo = result.environmentTag ? ` [${result.environmentTag}${result.tagSource === "auto" ? " auto" : ""}]` : "";
5041
+ if (isNewFile) {
5042
+ newFilesCount++;
5043
+ } else {
5044
+ updatedFilesCount++;
5045
+ }
5046
+ totalChangedLines += changedLines;
4932
5047
  if (selectedFiles.length === 1) {
5048
+ const statusText = isNewFile ? "Created" : "Updated";
4933
5049
  console.log(
4934
- `\u2705 Pushed ${file} (${variables.length} variables) to ${project}${tagInfo}`
5050
+ `\u2705 ${statusText} ${file} (${variables.length} variables, ${changedLines} line${changedLines !== 1 ? "s" : ""} changed) to ${project}${tagInfo}`
4935
5051
  );
4936
5052
  } else {
5053
+ const statusText = isNewFile ? "Created" : "Updated";
4937
5054
  console.log(
4938
- `\u2705 ${file}: Pushed (${variables.length} variables)${tagInfo}`
5055
+ `\u2705 ${file}: ${statusText} (${variables.length} variables, ${changedLines} line${changedLines !== 1 ? "s" : ""} changed)${tagInfo}`
4939
5056
  );
4940
5057
  }
4941
5058
  successCount++;
4942
5059
  } catch (error) {
4943
5060
  const message = error instanceof Error ? error.message : String(error);
4944
- console.error(`\u274C ${file}: Failed to push - ${message}`);
5061
+ let helpText = "";
5062
+ if (message.includes("Project") && message.includes("not found")) {
5063
+ helpText = `
5064
+ \u{1F4A1} Hint: Make sure the project '${project}' exists. You can create it with: jssm init -p ${project}`;
5065
+ } else if (message.includes("Insufficient permissions")) {
5066
+ helpText = `
5067
+ \u{1F4A1} Hint: You don't have write access to project '${project}'`;
5068
+ }
5069
+ console.error(`\u274C ${file}: Failed to push - ${message}${helpText}`);
4945
5070
  failCount++;
4946
5071
  }
4947
5072
  }
@@ -4949,9 +5074,29 @@ async function pushCommand2(args2) {
4949
5074
  console.log(`
4950
5075
  \u{1F4CA} Summary:`);
4951
5076
  console.log(` \u2705 Success: ${successCount} file(s)`);
5077
+ if (newFilesCount > 0) {
5078
+ console.log(` \u{1F4C4} New files: ${newFilesCount}`);
5079
+ }
5080
+ if (updatedFilesCount > 0) {
5081
+ console.log(` \u{1F4DD} Updated files: ${updatedFilesCount}`);
5082
+ }
5083
+ if (totalChangedLines > 0) {
5084
+ console.log(` \u{1F4CF} Total lines changed: ${totalChangedLines}`);
5085
+ }
4952
5086
  if (failCount > 0) {
4953
5087
  console.log(` \u274C Failed: ${failCount} file(s)`);
4954
5088
  }
5089
+ } else if (successCount === 1) {
5090
+ if (newFilesCount > 0) {
5091
+ console.log(`
5092
+ \u{1F4CA} Summary: New file created`);
5093
+ } else if (updatedFilesCount > 0) {
5094
+ console.log(`
5095
+ \u{1F4CA} Summary: File updated`);
5096
+ }
5097
+ if (totalChangedLines > 0) {
5098
+ console.log(` \u{1F4CF} Lines changed: ${totalChangedLines}`);
5099
+ }
4955
5100
  }
4956
5101
  if (failCount > 0) {
4957
5102
  process.exit(1);
@@ -5079,12 +5224,10 @@ async function createProjectCommand(args2) {
5079
5224
  }
5080
5225
  }
5081
5226
  const name = flags.n || flags.name || args2[0];
5082
- const host = flags.host;
5083
5227
  if (!name) {
5084
- console.error("Usage: jssm project create <name> [--host <api_url>]");
5228
+ console.error("Usage: jssm project create <name>");
5085
5229
  console.error("\nOptions:");
5086
5230
  console.error(" -n, --name Project name");
5087
- console.error(" --host API host URL (optional if config exists)");
5088
5231
  process.exit(1);
5089
5232
  }
5090
5233
  const authToken = await getAuthToken();
@@ -5093,17 +5236,10 @@ async function createProjectCommand(args2) {
5093
5236
  console.error("\u{1F4A1} Run: jssm login");
5094
5237
  process.exit(1);
5095
5238
  }
5096
- const globalConfig = await loadGlobalConfig();
5097
- const projectConfig = await loadProjectConfig();
5098
- const finalHost = host || projectConfig?.host || globalConfig.host;
5099
- if (!finalHost) {
5100
- console.error("\u274C Host is required");
5101
- console.error("\u{1F4A1} Set globally: jssm config set host <url>");
5102
- process.exit(1);
5103
- }
5239
+ const host = getHost();
5104
5240
  try {
5105
5241
  console.log(`\u{1F4E6} Creating project "${name}"...`);
5106
- const project = await createProject(finalHost, authToken, name);
5242
+ const project = await createProject(host, authToken, name);
5107
5243
  console.log(`\u2705 Project "${name}" created successfully`);
5108
5244
  console.log(` ID: ${project._id}`);
5109
5245
  console.log(` Created: ${new Date(project.createdAt).toLocaleString()}`);
@@ -5127,14 +5263,7 @@ async function listProjectsCommand() {
5127
5263
  console.error("\u{1F4A1} Run: jssm login");
5128
5264
  process.exit(1);
5129
5265
  }
5130
- const globalConfig = await loadGlobalConfig();
5131
- const projectConfig = await loadProjectConfig();
5132
- const host = projectConfig?.host || globalConfig.host;
5133
- if (!host) {
5134
- console.error("\u274C Host is required");
5135
- console.error("\u{1F4A1} Set globally: jssm config set host <url>");
5136
- process.exit(1);
5137
- }
5266
+ const host = getHost();
5138
5267
  try {
5139
5268
  console.log("\u{1F4E6} Fetching projects...\n");
5140
5269
  const projects = await getProjects(host, authToken);
@@ -5208,9 +5337,6 @@ async function statusCommand() {
5208
5337
  if (Object.keys(globalConfig).length === 0) {
5209
5338
  console.log(" (no global config set)");
5210
5339
  } else {
5211
- if (globalConfig.host) {
5212
- console.log(` Host: ${globalConfig.host}`);
5213
- }
5214
5340
  if (globalConfig.namespace) {
5215
5341
  console.log(` Namespace: ${globalConfig.namespace}`);
5216
5342
  }
@@ -5230,9 +5356,8 @@ async function statusCommand() {
5230
5356
  console.log("\u{1F4C2} Project Configuration");
5231
5357
  console.log(` Location: ${projectConfigPath}`);
5232
5358
  console.log(` Project: ${projectConfig.project}`);
5233
- console.log(` Environment: ${projectConfig.environment}`);
5234
- if (projectConfig.host) {
5235
- console.log(` Host: ${projectConfig.host} (override)`);
5359
+ if (projectConfig.environment) {
5360
+ console.log(` Environment: ${projectConfig.environment}`);
5236
5361
  }
5237
5362
  if (projectConfig.namespace) {
5238
5363
  console.log(` Namespace: ${projectConfig.namespace} (override)`);
@@ -5242,16 +5367,11 @@ async function statusCommand() {
5242
5367
  if (resolved) {
5243
5368
  console.log("\u{1F517} Resolved Configuration (merged)");
5244
5369
  console.log(` Project: ${resolved.project}`);
5245
- console.log(` Environment: ${resolved.environment}`);
5246
- console.log(` Host: ${resolved.host || "(not set)"}`);
5370
+ console.log(` Host: ${resolved.host} (hardcoded based on NODE_ENV)`);
5247
5371
  console.log(` Namespace: ${resolved.namespace}`);
5248
5372
  console.log(
5249
5373
  ` Auth: ${resolved.authToken ? "\u2705 Authenticated" : "\u274C Not authenticated"}`
5250
5374
  );
5251
- if (!resolved.host) {
5252
- console.log("\n\u26A0\uFE0F Host is not configured");
5253
- console.log(" Set globally: jssm config set host <url>");
5254
- }
5255
5375
  if (!resolved.authToken) {
5256
5376
  console.log("\n\u26A0\uFE0F Not logged in");
5257
5377
  console.log(" Run: jssm login");
@@ -5262,7 +5382,7 @@ async function statusCommand() {
5262
5382
  }
5263
5383
 
5264
5384
  // src/commands/config.ts
5265
- var VALID_KEYS = ["host", "namespace"];
5385
+ var VALID_KEYS = ["namespace"];
5266
5386
  async function configCommand(args2) {
5267
5387
  const subcommand = args2[0];
5268
5388
  switch (subcommand) {
@@ -5386,12 +5506,11 @@ Commands:
5386
5506
  path Show configuration file path
5387
5507
 
5388
5508
  Valid Keys:
5389
- host Default API server URL
5390
5509
  namespace Default SSM namespace (default: jssm)
5391
5510
 
5392
5511
  Examples:
5393
- jssm config set host http://localhost:3000
5394
- jssm config get host
5512
+ jssm config set namespace my-namespace
5513
+ jssm config get namespace
5395
5514
  jssm config list
5396
5515
 
5397
5516
  Note:
@@ -5410,13 +5529,7 @@ async function loginCommand() {
5410
5529
  console.log(`\u{1F4A1} Use 'jssm logout' to logout`);
5411
5530
  return;
5412
5531
  }
5413
- let globalConfig = await loadGlobalConfig();
5414
- let host = globalConfig.host;
5415
- if (!host) {
5416
- globalConfig.host = DEFAULT_HOST;
5417
- await saveGlobalConfig(globalConfig);
5418
- host = DEFAULT_HOST;
5419
- }
5532
+ const host = getHost();
5420
5533
  console.log("\u{1F510} Login to JSSM\n");
5421
5534
  try {
5422
5535
  const email = await dist_default4({
@@ -5450,22 +5563,6 @@ async function loginCommand() {
5450
5563
  } else {
5451
5564
  console.error(`
5452
5565
  \u274C Login failed: ${result.error}`);
5453
- if (result.isConnectionError && host !== DEFAULT_HOST) {
5454
- console.log(`
5455
- \u26A0\uFE0F Current host: ${host}`);
5456
- console.log(` Default host: ${DEFAULT_HOST}`);
5457
- const resetToDefault = await dist_default3({
5458
- message: "Would you like to reset the host to default?",
5459
- default: false
5460
- });
5461
- if (resetToDefault) {
5462
- globalConfig.host = DEFAULT_HOST;
5463
- await saveGlobalConfig(globalConfig);
5464
- console.log(`
5465
- \u2705 Host reset to default: ${DEFAULT_HOST}`);
5466
- console.log(`\u{1F4A1} Please try logging in again with 'jssm login'`);
5467
- }
5468
- }
5469
5566
  process.exit(1);
5470
5567
  }
5471
5568
  } catch (error) {
@@ -5490,13 +5587,7 @@ async function registerCommand() {
5490
5587
  );
5491
5588
  return;
5492
5589
  }
5493
- let globalConfig = await loadGlobalConfig();
5494
- let host = globalConfig.host;
5495
- if (!host) {
5496
- globalConfig.host = DEFAULT_HOST;
5497
- await saveGlobalConfig(globalConfig);
5498
- host = DEFAULT_HOST;
5499
- }
5590
+ const host = getHost();
5500
5591
  console.log("\u{1F4DD} Register for JSSM\n");
5501
5592
  try {
5502
5593
  const name = await dist_default4({
@@ -5550,22 +5641,6 @@ async function registerCommand() {
5550
5641
  } else {
5551
5642
  console.error(`
5552
5643
  \u274C Registration failed: ${result.error}`);
5553
- if (result.isConnectionError && host !== DEFAULT_HOST) {
5554
- console.log(`
5555
- \u26A0\uFE0F Current host: ${host}`);
5556
- console.log(` Default host: ${DEFAULT_HOST}`);
5557
- const resetToDefault = await dist_default3({
5558
- message: "Would you like to reset the host to default?",
5559
- default: false
5560
- });
5561
- if (resetToDefault) {
5562
- globalConfig.host = DEFAULT_HOST;
5563
- await saveGlobalConfig(globalConfig);
5564
- console.log(`
5565
- \u2705 Host reset to default: ${DEFAULT_HOST}`);
5566
- console.log(`\u{1F4A1} Please try registering again with 'jssm register'`);
5567
- }
5568
- }
5569
5644
  process.exit(1);
5570
5645
  }
5571
5646
  } catch (error) {
@@ -5596,8 +5671,7 @@ init_auth();
5596
5671
  var import_chalk = __toESM(require_source(), 1);
5597
5672
  async function createToken(args2) {
5598
5673
  const auth = await loadAuthData();
5599
- const globalConfig = await loadGlobalConfig();
5600
- const host = globalConfig.host || DEFAULT_HOST;
5674
+ const host = getHost();
5601
5675
  if (!auth) {
5602
5676
  console.error(import_chalk.default.red("Not logged in. Run: jssm login"));
5603
5677
  process.exit(1);
@@ -5693,8 +5767,7 @@ async function createToken(args2) {
5693
5767
  }
5694
5768
  async function listTokens(args2) {
5695
5769
  const auth = await loadAuthData();
5696
- const globalConfig = await loadGlobalConfig();
5697
- const host = globalConfig.host || DEFAULT_HOST;
5770
+ const host = getHost();
5698
5771
  if (!auth) {
5699
5772
  console.error(import_chalk.default.red("Not logged in. Run: jssm login"));
5700
5773
  process.exit(1);
@@ -5775,8 +5848,7 @@ Service tokens for ${project}/${environment}:
5775
5848
  }
5776
5849
  async function revokeToken(args2) {
5777
5850
  const auth = await loadAuthData();
5778
- const globalConfig = await loadGlobalConfig();
5779
- const host = globalConfig.host || DEFAULT_HOST;
5851
+ const host = getHost();
5780
5852
  if (!auth) {
5781
5853
  console.error(import_chalk.default.red("Not logged in. Run: jssm login"));
5782
5854
  process.exit(1);
@@ -5876,7 +5948,7 @@ ${import_chalk.default.bold("Usage in Docker:")}
5876
5948
 
5877
5949
  // src/utils/versionCheck.ts
5878
5950
  var PACKAGE_NAME = "@saidulbadhon/jssm-cli";
5879
- var CURRENT_VERSION = "1.6.7";
5951
+ var CURRENT_VERSION = "1.8.0";
5880
5952
  async function getLatestVersion() {
5881
5953
  try {
5882
5954
  const response = await fetch(`https://registry.npmjs.org/${PACKAGE_NAME}`);
@@ -6074,8 +6146,7 @@ Commands:
6074
6146
  --version Show CLI version
6075
6147
 
6076
6148
  Setup (recommended):
6077
- # 1. Set global host and login
6078
- jssm config set host http://localhost:3000
6149
+ # 1. Login (host is automatically configured based on NODE_ENV)
6079
6150
  jssm register # or: jssm login
6080
6151
 
6081
6152
  # 2. Initialize a project directory (creates .jssm file)
@@ -6093,7 +6164,7 @@ Quick Start (all-in-one):
6093
6164
  Advanced:
6094
6165
  # Manage global configuration
6095
6166
  jssm config list
6096
- jssm config set host http://api.example.com
6167
+ jssm config set namespace my-namespace
6097
6168
 
6098
6169
  # Create project
6099
6170
  jssm project create my-app
@@ -6113,7 +6184,8 @@ Container Secrets (Docker/ECS/EKS):
6113
6184
  CMD ["node", "app.js"]
6114
6185
 
6115
6186
  Note:
6116
- - Global config (~/.jssm/config) stores host and preferences
6187
+ - Host is automatically configured based on NODE_ENV (dev: localhost:3000, prod: jssm-api.jutsu.ai)
6188
+ - Global config (~/.jssm/config) stores preferences (namespace, etc.)
6117
6189
  - Auth data (~/.jssm/auth) stores your login session
6118
6190
  - Project config (.jssm) stores project name
6119
6191
  - Add .jssm to .gitignore (may contain sensitive overrides)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saidulbadhon/jssm-cli",
3
- "version": "1.6.7",
3
+ "version": "1.8.0",
4
4
  "private": false,
5
5
  "description": "CLI for JSSM - Simple environment variable manager",
6
6
  "author": "Saidul Badhon",