mobbdev 1.0.36 → 1.0.38

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.mjs +62 -13
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1582,6 +1582,7 @@ var VUL_REPORT_DIGEST_TIMEOUT_MS = 1e3 * 60 * 30;
1582
1582
  // src/features/analysis/index.ts
1583
1583
  import fs4 from "node:fs";
1584
1584
  import path7 from "node:path";
1585
+ import { env as env2 } from "node:process";
1585
1586
  import { pipeline } from "node:stream/promises";
1586
1587
 
1587
1588
  // src/utils/index.ts
@@ -1627,13 +1628,35 @@ async function keypress() {
1627
1628
  import {
1628
1629
  createSpinner as _createSpinner
1629
1630
  } from "nanospinner";
1631
+ function printToStdError(opts) {
1632
+ if (opts?.text)
1633
+ console.error(opts.text);
1634
+ }
1630
1635
  var mockSpinner = {
1631
- success: () => mockSpinner,
1632
- error: () => mockSpinner,
1633
- warn: () => mockSpinner,
1634
- stop: () => mockSpinner,
1635
- start: () => mockSpinner,
1636
- update: () => mockSpinner,
1636
+ success: (opts) => {
1637
+ printToStdError(opts);
1638
+ return mockSpinner;
1639
+ },
1640
+ error: (opts) => {
1641
+ printToStdError(opts);
1642
+ return mockSpinner;
1643
+ },
1644
+ warn: (opts) => {
1645
+ printToStdError(opts);
1646
+ return mockSpinner;
1647
+ },
1648
+ stop: (opts) => {
1649
+ printToStdError(opts);
1650
+ return mockSpinner;
1651
+ },
1652
+ start: (opts) => {
1653
+ printToStdError(opts);
1654
+ return mockSpinner;
1655
+ },
1656
+ update: (opts) => {
1657
+ printToStdError(opts);
1658
+ return mockSpinner;
1659
+ },
1637
1660
  reset: () => mockSpinner,
1638
1661
  clear: () => mockSpinner,
1639
1662
  spin: () => mockSpinner
@@ -3797,9 +3820,17 @@ import { z as z15 } from "zod";
3797
3820
  var EnvVariablesZod = z15.object({
3798
3821
  GITLAB_API_TOKEN: z15.string().optional(),
3799
3822
  GITHUB_API_TOKEN: z15.string().optional(),
3823
+ GIT_COMMITTER_EMAIL: z15.string().optional(),
3824
+ GIT_COMMITTER_NAME: z15.string().optional(),
3800
3825
  GIT_PROXY_HOST: z15.string()
3801
3826
  });
3802
- var { GITLAB_API_TOKEN, GITHUB_API_TOKEN, GIT_PROXY_HOST } = EnvVariablesZod.parse(process.env);
3827
+ var {
3828
+ GITLAB_API_TOKEN,
3829
+ GITHUB_API_TOKEN,
3830
+ GIT_PROXY_HOST,
3831
+ GIT_COMMITTER_EMAIL,
3832
+ GIT_COMMITTER_NAME
3833
+ } = EnvVariablesZod.parse(process.env);
3803
3834
 
3804
3835
  // src/features/analysis/scm/utils/index.ts
3805
3836
  import { z as z16 } from "zod";
@@ -7520,13 +7551,14 @@ var GQLClient = class {
7520
7551
  }
7521
7552
  async verifyToken() {
7522
7553
  await this.createCommunityUser();
7554
+ let info;
7523
7555
  try {
7524
- await this.getUserInfo();
7556
+ info = await this.getUserInfo();
7525
7557
  } catch (e) {
7526
7558
  debug11("verify token failed %o", e);
7527
7559
  return false;
7528
7560
  }
7529
- return true;
7561
+ return info?.email || true;
7530
7562
  }
7531
7563
  async getOrgAndProjectId(params = {}) {
7532
7564
  const { projectName, userDefinedOrganizationId } = params;
@@ -8179,6 +8211,19 @@ var { CliError: CliError2, Spinner: Spinner2 } = utils_exports;
8179
8211
  function _getScanSource(command) {
8180
8212
  if (command === "review")
8181
8213
  return "AUTO_FIXER" /* AutoFixer */;
8214
+ const envToCi = [
8215
+ ["GITLAB_CI", "CI_GITLAB" /* CiGitlab */],
8216
+ ["GITHUB_ACTIONS", "CI_GITHUB" /* CiGithub */],
8217
+ ["JENKINS_URL", "CI_JENKINS" /* CiJenkins */],
8218
+ ["CIRCLECI", "CI_CIRCLECI" /* CiCircleci */],
8219
+ ["TF_BUILD", "CI_AZURE" /* CiAzure */],
8220
+ ["bamboo_buildKey", "CI_BAMBOO" /* CiBamboo */]
8221
+ ];
8222
+ for (const [envKey, source] of envToCi) {
8223
+ if (env2[envKey]) {
8224
+ return source;
8225
+ }
8226
+ }
8182
8227
  return "CLI" /* Cli */;
8183
8228
  }
8184
8229
  async function downloadRepo({
@@ -8869,9 +8914,10 @@ async function handleMobbLogin({
8869
8914
  skipPrompts
8870
8915
  }) {
8871
8916
  const { createSpinner: createSpinner5 } = Spinner({ ci: skipPrompts });
8872
- if (await inGqlClient.verifyToken()) {
8917
+ const userVerify = await inGqlClient.verifyToken();
8918
+ if (userVerify) {
8873
8919
  createSpinner5().start().success({
8874
- text: "\u{1F513} Login to Mobb succeeded"
8920
+ text: `\u{1F513} Login to Mobb succeeded. ${typeof userVerify === "string" ? `Logged in as ${userVerify}` : ""}`
8875
8921
  });
8876
8922
  return inGqlClient;
8877
8923
  } else if (apiKey) {
@@ -8922,10 +8968,13 @@ async function handleMobbLogin({
8922
8968
  throw new CliError();
8923
8969
  }
8924
8970
  const newGqlClient = new GQLClient({ apiKey: newApiToken, type: "apiKey" });
8925
- if (await newGqlClient.verifyToken()) {
8971
+ const loginSuccess = await newGqlClient.verifyToken();
8972
+ if (loginSuccess) {
8926
8973
  debug17("set api token %s", newApiToken);
8927
8974
  config3.set("apiToken", newApiToken);
8928
- loginSpinner.success({ text: "\u{1F513} Login to Mobb successful!" });
8975
+ loginSpinner.success({
8976
+ text: `\u{1F513} Login to Mobb successful! ${typeof loginSpinner === "string" ? `Logged in as ${loginSuccess}` : ""}`
8977
+ });
8929
8978
  } else {
8930
8979
  loginSpinner.error({
8931
8980
  text: "Something went wrong, API token is invalid."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobbdev",
3
- "version": "1.0.36",
3
+ "version": "1.0.38",
4
4
  "description": "Automated secure code remediation tool",
5
5
  "repository": "git+https://github.com/mobb-dev/bugsy.git",
6
6
  "main": "dist/index.js",