@mobb.ai/cli 1.4.49 → 1.4.50

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 (35) hide show
  1. package/.env +10 -0
  2. package/LICENSE +21 -0
  3. package/README.md +210 -78
  4. package/bin/cli.mjs +2 -0
  5. package/dist/args/commands/upload_ai_blame.d.mts +164 -0
  6. package/dist/args/commands/upload_ai_blame.mjs +6614 -0
  7. package/dist/hash_search/index.d.mts +10 -0
  8. package/dist/hash_search/index.mjs +112 -0
  9. package/dist/index.d.mts +2 -0
  10. package/dist/index.mjs +29052 -0
  11. package/package.json +160 -19
  12. package/src/features/codeium_intellij/proto/buf/validate/validate.proto +504 -0
  13. package/src/features/codeium_intellij/proto/exa/auto_cascade_common_pb/auto_cascade_common.proto +81 -0
  14. package/src/features/codeium_intellij/proto/exa/bug_checker_pb/bug_checker.proto +24 -0
  15. package/src/features/codeium_intellij/proto/exa/cascade_plugins_pb/cascade_plugins.proto +108 -0
  16. package/src/features/codeium_intellij/proto/exa/chat_client_server_pb/chat_client_server.proto +56 -0
  17. package/src/features/codeium_intellij/proto/exa/chat_pb/chat.proto +457 -0
  18. package/src/features/codeium_intellij/proto/exa/code_edit/code_edit_pb/code_edit.proto +191 -0
  19. package/src/features/codeium_intellij/proto/exa/codeium_common_pb/codeium_common.proto +3783 -0
  20. package/src/features/codeium_intellij/proto/exa/context_module_pb/context_module.proto +172 -0
  21. package/src/features/codeium_intellij/proto/exa/cortex_pb/cortex.proto +3604 -0
  22. package/src/features/codeium_intellij/proto/exa/diff_action_pb/diff_action.proto +73 -0
  23. package/src/features/codeium_intellij/proto/exa/extension_server_pb/extension_server.proto +565 -0
  24. package/src/features/codeium_intellij/proto/exa/index_pb/index.proto +474 -0
  25. package/src/features/codeium_intellij/proto/exa/knowledge_base_pb/knowledge_base.proto +149 -0
  26. package/src/features/codeium_intellij/proto/exa/language_server_pb/language_server.proto +2504 -0
  27. package/src/features/codeium_intellij/proto/exa/opensearch_clients_pb/opensearch_clients.proto +505 -0
  28. package/src/features/codeium_intellij/proto/exa/product_analytics_pb/product_analytics.proto +31 -0
  29. package/src/features/codeium_intellij/proto/exa/reactive_component_pb/reactive_component.proto +104 -0
  30. package/src/features/codeium_intellij/proto/exa/seat_management_pb/seat_management.proto +2349 -0
  31. package/src/post_install/binary.mjs +89 -0
  32. package/src/post_install/constants.mjs +2 -0
  33. package/src/post_install/cx_install.mjs +72 -0
  34. package/bin/mobbdev.js +0 -10
  35. package/lib/binary.js +0 -52
@@ -0,0 +1,89 @@
1
+ // this file is based from 'binary-install' https://www.npmjs.com/package/binary-install
2
+ import AdmZip from 'adm-zip'
3
+ import axios from 'axios'
4
+ import { existsSync, mkdirSync } from 'fs'
5
+ import { arch as _arch, type as _type } from 'os'
6
+ import { join } from 'path'
7
+ import * as tar from 'tar'
8
+
9
+ /**
10
+ * Options for showing a installParams.
11
+ * @typedef {Object} InstallParams
12
+ * @property {string} installParams.binaryName
13
+ * @property {string} installParams.url
14
+ */
15
+
16
+ /**
17
+ * @param {string} url
18
+ * @returns {string}
19
+ */
20
+ function getArchiveType(url) {
21
+ if (url.endsWith('.zip')) {
22
+ return 'zip'
23
+ }
24
+ if (url.endsWith('.tar.gz')) {
25
+ return 'tar'
26
+ }
27
+ throw Error(`Unknown archive type for ${url}`)
28
+ }
29
+
30
+ /**
31
+ * @param {InstallParams} opts
32
+ * @returns {Promise<void>}
33
+ */
34
+
35
+ export async function install({ binaryName, url }) {
36
+ const installDirectory = join(process.cwd(), 'node_modules', '.bin')
37
+ const binaryPath = join(installDirectory, binaryName)
38
+ if (existsSync(binaryPath)) {
39
+ console.log(`${binaryName} is already installed, skipping installation.`)
40
+ return
41
+ }
42
+ const archiveType = getArchiveType(url)
43
+ mkdirSync(installDirectory, { recursive: true })
44
+ console.log(`Downloading release from ${url}`)
45
+ archiveType === 'zip'
46
+ ? await installZip({ binaryName, url, installDirectory })
47
+ : await installTar({ binaryName, url, installDirectory })
48
+
49
+ console.log(`${binaryName} has been installed!`)
50
+ }
51
+
52
+ /**
53
+ * @typedef {object} InstallDirectory
54
+ * @property {string} installDirectory
55
+ * @typedef {InstallParams & InstallDirectory} ArchiveInstallParams
56
+ **/
57
+
58
+ /**
59
+ * @param {ArchiveInstallParams} opts
60
+ * @returns {Promise<void>}
61
+ */
62
+ async function installTar({ binaryName, url, installDirectory }) {
63
+ const binaryStream = await axios({ url, responseType: 'stream' })
64
+ await new Promise((resolve, reject) => {
65
+ const sink = binaryStream.data.pipe(
66
+ tar.x({
67
+ filter(path) {
68
+ return path.startsWith(binaryName)
69
+ },
70
+ C: installDirectory,
71
+ })
72
+ )
73
+ sink.on('finish', () => resolve(null))
74
+ sink.on('error', (/** @type {Error} */ err) => reject(err))
75
+ })
76
+ }
77
+
78
+ /**
79
+ * @param {ArchiveInstallParams} opts
80
+ * @returns {Promise<void>}
81
+ */
82
+ async function installZip({ binaryName, url, installDirectory }) {
83
+ const body = await axios.get(url, {
84
+ responseType: 'arraybuffer',
85
+ })
86
+
87
+ var zip = new AdmZip(body.data)
88
+ zip.extractEntryTo(binaryName, installDirectory)
89
+ }
@@ -0,0 +1,2 @@
1
+ export const cxOperatingSystemSupportMessage = `Your operating system does not support checkmarx.
2
+ You can see the list of supported operating systems here: https://github.com/Checkmarx/ast-cli#releases`
@@ -0,0 +1,72 @@
1
+ import { arch as _arch, type as _type } from 'os'
2
+
3
+ import { install } from './binary.mjs'
4
+ import { cxOperatingSystemSupportMessage } from './constants.mjs'
5
+
6
+ const supportedPlatforms = [
7
+ {
8
+ type: 'Windows_NT',
9
+ architecture: 'x64',
10
+ target: 'windows_x64.zip',
11
+ },
12
+ {
13
+ type: 'Linux',
14
+ architecture: 'x64',
15
+ target: 'linux_x64.tar.gz',
16
+ },
17
+ {
18
+ type: 'Linux',
19
+ architecture: 'arm',
20
+ target: 'linux_arm6.tar.gz',
21
+ },
22
+ {
23
+ type: 'Linux',
24
+ architecture: 'arm64',
25
+ target: 'linux_arm64.tar.gz',
26
+ },
27
+ {
28
+ type: 'Darwin',
29
+ architecture: 'arm64',
30
+ target: 'darwin_x64.tar.gz',
31
+ },
32
+ ]
33
+
34
+ async function installBinary() {
35
+ const supportedPlatform = getPlatformMetadata()
36
+ if (!supportedPlatform) {
37
+ console.warn(cxOperatingSystemSupportMessage)
38
+ console.warn(
39
+ 'The checkmarx scanner is not available on your platform. The rest of Bugsy features and scanners will be available for use.'
40
+ )
41
+ return
42
+ }
43
+ const { target } = supportedPlatform
44
+
45
+ const url = `https://github.com/Checkmarx/ast-cli/releases/download/2.0.55/ast-cli_${target}`
46
+ const binaryName = supportedPlatform.type === 'Windows_NT' ? 'cx.exe' : 'cx'
47
+
48
+ await install({ binaryName, url })
49
+ }
50
+
51
+ export function getPlatformMetadata() {
52
+ const type = _type()
53
+ const architecture = _arch()
54
+
55
+ for (const supportedPlatform of supportedPlatforms) {
56
+ if (
57
+ type === supportedPlatform.type &&
58
+ architecture === supportedPlatform.architecture
59
+ ) {
60
+ return supportedPlatform
61
+ }
62
+ }
63
+
64
+ return null
65
+ }
66
+
67
+ installBinary().catch((err) => {
68
+ console.debug(err)
69
+ console.warn(
70
+ "Optional Checkmarx dependency was not installed. If you don't require this functionality, you can safely ignore this message."
71
+ )
72
+ })
package/bin/mobbdev.js DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict'
3
- const binary = require('../lib/binary')
4
-
5
- try {
6
- binary.run(process.argv.slice(2))
7
- } catch (err) {
8
- console.error(String((err && err.message) || err))
9
- process.exit(1)
10
- }
package/lib/binary.js DELETED
@@ -1,52 +0,0 @@
1
- 'use strict'
2
- // @mobb.ai/cli launcher: resolves the platform binary installed by npm via
3
- // optionalDependencies (@mobb.ai/cli-<os>-<cpu>, gated by os/cpu fields so
4
- // npm installs exactly one) and forwards all arguments to it.
5
- //
6
- // No downloads, no checksums: the binary arrives through npm like any other
7
- // dependency, so registry mirrors / lockfile integrity already cover it.
8
- //
9
- // Zero runtime dependencies. Must stay runnable on Node >= 14: no ESM,
10
- // no syntax newer than what Node 14 parses.
11
-
12
- const { spawnSync } = require('child_process')
13
-
14
- // npm package slug uses macos/win (org convention); process.platform is
15
- // darwin/win32. Keep in sync with scripts/gen_platform_pkg.js.
16
- function npmOs() {
17
- if (process.platform === 'darwin') return 'macos'
18
- if (process.platform === 'win32') return 'win'
19
- return process.platform
20
- }
21
-
22
- function getPlatformPackage() {
23
- return '@mobb.ai/cli-' + npmOs() + '-' + process.arch
24
- }
25
-
26
- function getBinaryPath() {
27
- const pkgName = getPlatformPackage()
28
- const binName = process.platform === 'win32' ? 'mobbdev.exe' : 'mobbdev'
29
- try {
30
- return require.resolve(pkgName + '/' + binName)
31
- } catch (e) {
32
- throw new Error(
33
- 'Could not find the mobbdev binary package "' +
34
- pkgName +
35
- '".\n' +
36
- 'Either this platform is not supported by the binary distribution,\n' +
37
- 'or optional dependencies were skipped (npm install --no-optional).\n' +
38
- 'Reinstall with optional dependencies enabled, or use the regular\n' +
39
- 'npm package instead: npm install mobbdev (requires a supported Node.js).'
40
- )
41
- }
42
- }
43
-
44
- function run(args) {
45
- const result = spawnSync(getBinaryPath(), args, { stdio: 'inherit' })
46
- if (result.error) {
47
- throw result.error
48
- }
49
- process.exit(result.status === null ? 1 : result.status)
50
- }
51
-
52
- module.exports = { run }