@kolatts/pncli 1.10.0 → 1.10.1

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/dist/cli.js CHANGED
@@ -4366,6 +4366,11 @@ function registerConfigCommands(program2) {
4366
4366
  }
4367
4367
  });
4368
4368
  }
4369
+ function normalizeBaseUrl(raw) {
4370
+ const trimmed = raw.trim();
4371
+ if (!trimmed) return trimmed;
4372
+ return /^https?:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`;
4373
+ }
4369
4374
  async function initGlobalConfig(start) {
4370
4375
  process.stderr.write("pncli config init \u2014 Global configuration\n\n");
4371
4376
  process.stderr.write("\u2500\u2500 Identity \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n");
@@ -4379,7 +4384,7 @@ async function initGlobalConfig(start) {
4379
4384
  });
4380
4385
  process.stderr.write("\n\u2500\u2500 Jira \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n");
4381
4386
  const jiraBaseUrl = await input({
4382
- message: "Jira base URL (e.g. https://jira.your-company.com):",
4387
+ message: "Jira base URL (e.g. jira.your-company.com):",
4383
4388
  default: ""
4384
4389
  });
4385
4390
  const jiraApiToken = await password({
@@ -4387,7 +4392,7 @@ async function initGlobalConfig(start) {
4387
4392
  });
4388
4393
  process.stderr.write("\n\u2500\u2500 Bitbucket \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n");
4389
4394
  const bitbucketBaseUrl = await input({
4390
- message: "Bitbucket Server base URL (e.g. https://bitbucket.your-company.com):",
4395
+ message: "Bitbucket Server base URL (e.g. bitbucket.your-company.com):",
4391
4396
  default: ""
4392
4397
  });
4393
4398
  const bitbucketPat = await password({
@@ -4395,7 +4400,7 @@ async function initGlobalConfig(start) {
4395
4400
  });
4396
4401
  process.stderr.write("\n\u2500\u2500 Confluence \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n");
4397
4402
  const confluenceBaseUrl = await input({
4398
- message: "Confluence base URL (e.g. https://confluence.your-company.com):",
4403
+ message: "Confluence base URL (e.g. confluence.your-company.com):",
4399
4404
  default: ""
4400
4405
  });
4401
4406
  const confluenceApiToken = await password({
@@ -4413,7 +4418,7 @@ async function initGlobalConfig(start) {
4413
4418
  let mavenRepo = "";
4414
4419
  if (useArtifactory) {
4415
4420
  artifactoryBaseUrl = await input({
4416
- message: "Artifactory base URL (e.g. https://artifactory.company.com):",
4421
+ message: "Artifactory base URL (e.g. artifactory.company.com):",
4417
4422
  default: ""
4418
4423
  });
4419
4424
  artifactoryToken = await password({
@@ -4442,7 +4447,7 @@ async function initGlobalConfig(start) {
4442
4447
  let sonarToken = "";
4443
4448
  if (useSonar) {
4444
4449
  sonarBaseUrl = await input({
4445
- message: "SonarQube Server base URL (e.g. https://sonar.your-company.com):",
4450
+ message: "SonarQube Server base URL (e.g. sonar.your-company.com):",
4446
4451
  default: ""
4447
4452
  });
4448
4453
  sonarToken = await password({
@@ -4495,7 +4500,7 @@ async function initGlobalConfig(start) {
4495
4500
  let adoDiscoveredTypes = [];
4496
4501
  if (useAdo) {
4497
4502
  adoBaseUrl = await input({
4498
- message: "Azure DevOps Server base URL (e.g. https://tfs.company.com or https://devops.company.com/tfs):",
4503
+ message: "Azure DevOps Server base URL (e.g. tfs.company.com or devops.company.com/tfs):",
4499
4504
  default: ""
4500
4505
  });
4501
4506
  adoPat = await password({
@@ -4515,7 +4520,7 @@ async function initGlobalConfig(start) {
4515
4520
  const tempConfig = {
4516
4521
  ...loadConfig(),
4517
4522
  ado: {
4518
- baseUrl: adoBaseUrl,
4523
+ baseUrl: normalizeBaseUrl(adoBaseUrl),
4519
4524
  pat: adoPat || void 0,
4520
4525
  fieldAliases: {},
4521
4526
  discoveredFields: [],
@@ -4567,7 +4572,7 @@ async function initGlobalConfig(start) {
4567
4572
  let jenkinsApiToken = "";
4568
4573
  if (useJenkins) {
4569
4574
  jenkinsBaseUrl = await input({
4570
- message: "Jenkins base URL (e.g. https://jenkins.your-company.com):",
4575
+ message: "Jenkins base URL (e.g. jenkins.your-company.com):",
4571
4576
  default: ""
4572
4577
  });
4573
4578
  jenkinsUsername = await input({
@@ -4591,7 +4596,7 @@ async function initGlobalConfig(start) {
4591
4596
  let udeployDefaultEnv = "";
4592
4597
  if (useUdeploy) {
4593
4598
  udeployBaseUrl = await input({
4594
- message: "UDeploy base URL (e.g. https://ucd.company.com:8443):",
4599
+ message: "UDeploy base URL (e.g. ucd.company.com:8443):",
4595
4600
  default: ""
4596
4601
  });
4597
4602
  udeployUsername = await input({
@@ -4623,7 +4628,7 @@ async function initGlobalConfig(start) {
4623
4628
  const tempConfig = {
4624
4629
  ...loadConfig(),
4625
4630
  udeploy: {
4626
- baseUrl: udeployBaseUrl,
4631
+ baseUrl: normalizeBaseUrl(udeployBaseUrl),
4627
4632
  pat: udeployPat || void 0,
4628
4633
  username: udeployUsername || void 0,
4629
4634
  password: udeployPassword || void 0
@@ -4648,7 +4653,7 @@ async function initGlobalConfig(start) {
4648
4653
  let checkmarxPassword = "";
4649
4654
  if (useCheckmarx) {
4650
4655
  checkmarxBaseUrl = await input({
4651
- message: "Checkmarx base URL (e.g. https://cx.company.com):",
4656
+ message: "Checkmarx base URL (e.g. cx.company.com):",
4652
4657
  default: ""
4653
4658
  });
4654
4659
  checkmarxUsername = await input({
@@ -4665,7 +4670,7 @@ async function initGlobalConfig(start) {
4665
4670
  const tempConfig = {
4666
4671
  ...loadConfig(),
4667
4672
  checkmarx: {
4668
- baseUrl: checkmarxBaseUrl,
4673
+ baseUrl: normalizeBaseUrl(checkmarxBaseUrl),
4669
4674
  username: checkmarxUsername,
4670
4675
  password: checkmarxPassword
4671
4676
  }
@@ -4690,7 +4695,7 @@ async function initGlobalConfig(start) {
4690
4695
  let servicenowApiToken = "";
4691
4696
  if (useServiceNow) {
4692
4697
  servicenowBaseUrl = await input({
4693
- message: "ServiceNow instance URL (e.g. https://mycompany.service-now.com):",
4698
+ message: "ServiceNow instance URL (e.g. mycompany.service-now.com):",
4694
4699
  default: ""
4695
4700
  });
4696
4701
  servicenowUsername = await input({
@@ -4719,7 +4724,7 @@ async function initGlobalConfig(start) {
4719
4724
  const tempConfig = {
4720
4725
  ...loadConfig(),
4721
4726
  servicenow: {
4722
- baseUrl: servicenowBaseUrl,
4727
+ baseUrl: normalizeBaseUrl(servicenowBaseUrl),
4723
4728
  username: servicenowUsername,
4724
4729
  password: servicenowPassword || void 0,
4725
4730
  apiToken: servicenowApiToken || void 0
@@ -4745,7 +4750,7 @@ async function initGlobalConfig(start) {
4745
4750
  if (useSonatypeIq) {
4746
4751
  process.stderr.write(" User Token credentials are found in your IQ Server profile under User Token.\n");
4747
4752
  sonatypeIqBaseUrl = await input({
4748
- message: "Sonatype IQ Server base URL (e.g. https://iq.your-company.com):",
4753
+ message: "Sonatype IQ Server base URL (e.g. iq.your-company.com):",
4749
4754
  default: ""
4750
4755
  });
4751
4756
  sonatypeIqUserCode = await input({
@@ -4761,7 +4766,7 @@ async function initGlobalConfig(start) {
4761
4766
  const tempConfig = {
4762
4767
  ...loadConfig(),
4763
4768
  sonatypeiq: {
4764
- baseUrl: sonatypeIqBaseUrl,
4769
+ baseUrl: normalizeBaseUrl(sonatypeIqBaseUrl),
4765
4770
  userCode: sonatypeIqUserCode,
4766
4771
  passcode: sonatypeIqPasscode
4767
4772
  }
@@ -4812,7 +4817,7 @@ async function initGlobalConfig(start) {
4812
4817
  const tempConfig = {
4813
4818
  ...loadConfig(),
4814
4819
  contrast: {
4815
- baseUrl: contrastBaseUrl || void 0,
4820
+ baseUrl: normalizeBaseUrl(contrastBaseUrl) || void 0,
4816
4821
  orgUuid: contrastOrgUuid,
4817
4822
  username: contrastUsername,
4818
4823
  apiKey: contrastApiKey,
@@ -4857,22 +4862,22 @@ async function initGlobalConfig(start) {
4857
4862
  userId: userId || void 0
4858
4863
  },
4859
4864
  jira: {
4860
- baseUrl: jiraBaseUrl || void 0,
4865
+ baseUrl: normalizeBaseUrl(jiraBaseUrl) || void 0,
4861
4866
  apiToken: jiraApiToken || void 0
4862
4867
  },
4863
4868
  bitbucket: {
4864
- baseUrl: bitbucketBaseUrl || void 0,
4869
+ baseUrl: normalizeBaseUrl(bitbucketBaseUrl) || void 0,
4865
4870
  pat: bitbucketPat || void 0
4866
4871
  },
4867
4872
  ...confluenceBaseUrl || confluenceApiToken ? {
4868
4873
  confluence: {
4869
- baseUrl: confluenceBaseUrl || void 0,
4874
+ baseUrl: normalizeBaseUrl(confluenceBaseUrl) || void 0,
4870
4875
  apiToken: confluenceApiToken || void 0
4871
4876
  }
4872
4877
  } : {},
4873
4878
  ...useArtifactory ? {
4874
4879
  artifactory: {
4875
- baseUrl: artifactoryBaseUrl || void 0,
4880
+ baseUrl: normalizeBaseUrl(artifactoryBaseUrl) || void 0,
4876
4881
  token: artifactoryToken || void 0,
4877
4882
  npmRepo: npmRepo || void 0,
4878
4883
  nugetRepo: nugetRepo || void 0,
@@ -4881,7 +4886,7 @@ async function initGlobalConfig(start) {
4881
4886
  } : {},
4882
4887
  ...useSonar ? {
4883
4888
  sonar: {
4884
- baseUrl: sonarBaseUrl || void 0,
4889
+ baseUrl: normalizeBaseUrl(sonarBaseUrl) || void 0,
4885
4890
  token: sonarToken || void 0
4886
4891
  }
4887
4892
  } : {},
@@ -4892,7 +4897,7 @@ async function initGlobalConfig(start) {
4892
4897
  } : {},
4893
4898
  ...useAdo && adoBaseUrl ? {
4894
4899
  ado: {
4895
- baseUrl: adoBaseUrl,
4900
+ baseUrl: normalizeBaseUrl(adoBaseUrl),
4896
4901
  ...adoPat ? { pat: adoPat } : {},
4897
4902
  ...Object.keys(adoFieldAliases).length ? { fieldAliases: adoFieldAliases } : {},
4898
4903
  ...adoDiscoveredFields.length ? { discoveredFields: adoDiscoveredFields } : {},
@@ -4901,14 +4906,14 @@ async function initGlobalConfig(start) {
4901
4906
  } : {},
4902
4907
  ...useJenkins && jenkinsBaseUrl ? {
4903
4908
  jenkins: {
4904
- baseUrl: jenkinsBaseUrl,
4909
+ baseUrl: normalizeBaseUrl(jenkinsBaseUrl),
4905
4910
  ...jenkinsUsername ? { username: jenkinsUsername } : {},
4906
4911
  ...jenkinsApiToken ? { apiToken: jenkinsApiToken } : {}
4907
4912
  }
4908
4913
  } : {},
4909
4914
  ...useUdeploy && udeployBaseUrl ? {
4910
4915
  udeploy: {
4911
- baseUrl: udeployBaseUrl,
4916
+ baseUrl: normalizeBaseUrl(udeployBaseUrl),
4912
4917
  ...udeployPat ? { pat: udeployPat } : {},
4913
4918
  ...udeployUsername ? { username: udeployUsername } : {},
4914
4919
  ...udeployPassword ? { password: udeployPassword } : {}
@@ -4916,14 +4921,14 @@ async function initGlobalConfig(start) {
4916
4921
  } : {},
4917
4922
  ...useCheckmarx && checkmarxBaseUrl ? {
4918
4923
  checkmarx: {
4919
- baseUrl: checkmarxBaseUrl,
4924
+ baseUrl: normalizeBaseUrl(checkmarxBaseUrl),
4920
4925
  username: checkmarxUsername || void 0,
4921
4926
  password: checkmarxPassword || void 0
4922
4927
  }
4923
4928
  } : {},
4924
4929
  ...useServiceNow && servicenowBaseUrl ? {
4925
4930
  servicenow: {
4926
- baseUrl: servicenowBaseUrl,
4931
+ baseUrl: normalizeBaseUrl(servicenowBaseUrl),
4927
4932
  username: servicenowUsername || void 0,
4928
4933
  ...servicenowApiToken ? { apiToken: servicenowApiToken } : {},
4929
4934
  ...servicenowPassword ? { password: servicenowPassword } : {}
@@ -4931,7 +4936,7 @@ async function initGlobalConfig(start) {
4931
4936
  } : {},
4932
4937
  ...useContrast && contrastOrgUuid ? {
4933
4938
  contrast: {
4934
- ...contrastBaseUrl ? { baseUrl: contrastBaseUrl } : {},
4939
+ ...contrastBaseUrl ? { baseUrl: normalizeBaseUrl(contrastBaseUrl) } : {},
4935
4940
  orgUuid: contrastOrgUuid,
4936
4941
  username: contrastUsername || void 0,
4937
4942
  apiKey: contrastApiKey || void 0,
@@ -4940,7 +4945,7 @@ async function initGlobalConfig(start) {
4940
4945
  } : {},
4941
4946
  ...useSonatypeIq && sonatypeIqBaseUrl ? {
4942
4947
  sonatypeiq: {
4943
- baseUrl: sonatypeIqBaseUrl,
4948
+ baseUrl: normalizeBaseUrl(sonatypeIqBaseUrl),
4944
4949
  userCode: sonatypeIqUserCode || void 0,
4945
4950
  passcode: sonatypeIqPasscode || void 0
4946
4951
  }