@mobb.ai/cli 0.0.1 → 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.
- package/.env +10 -0
- package/LICENSE +21 -0
- package/README.md +216 -0
- package/bin/cli.mjs +2 -0
- package/dist/args/commands/upload_ai_blame.d.mts +164 -0
- package/dist/args/commands/upload_ai_blame.mjs +6614 -0
- package/dist/hash_search/index.d.mts +10 -0
- package/dist/hash_search/index.mjs +112 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +29052 -0
- package/package.json +164 -5
- package/src/features/codeium_intellij/proto/buf/validate/validate.proto +504 -0
- package/src/features/codeium_intellij/proto/exa/auto_cascade_common_pb/auto_cascade_common.proto +81 -0
- package/src/features/codeium_intellij/proto/exa/bug_checker_pb/bug_checker.proto +24 -0
- package/src/features/codeium_intellij/proto/exa/cascade_plugins_pb/cascade_plugins.proto +108 -0
- package/src/features/codeium_intellij/proto/exa/chat_client_server_pb/chat_client_server.proto +56 -0
- package/src/features/codeium_intellij/proto/exa/chat_pb/chat.proto +457 -0
- package/src/features/codeium_intellij/proto/exa/code_edit/code_edit_pb/code_edit.proto +191 -0
- package/src/features/codeium_intellij/proto/exa/codeium_common_pb/codeium_common.proto +3783 -0
- package/src/features/codeium_intellij/proto/exa/context_module_pb/context_module.proto +172 -0
- package/src/features/codeium_intellij/proto/exa/cortex_pb/cortex.proto +3604 -0
- package/src/features/codeium_intellij/proto/exa/diff_action_pb/diff_action.proto +73 -0
- package/src/features/codeium_intellij/proto/exa/extension_server_pb/extension_server.proto +565 -0
- package/src/features/codeium_intellij/proto/exa/index_pb/index.proto +474 -0
- package/src/features/codeium_intellij/proto/exa/knowledge_base_pb/knowledge_base.proto +149 -0
- package/src/features/codeium_intellij/proto/exa/language_server_pb/language_server.proto +2504 -0
- package/src/features/codeium_intellij/proto/exa/opensearch_clients_pb/opensearch_clients.proto +505 -0
- package/src/features/codeium_intellij/proto/exa/product_analytics_pb/product_analytics.proto +31 -0
- package/src/features/codeium_intellij/proto/exa/reactive_component_pb/reactive_component.proto +104 -0
- package/src/features/codeium_intellij/proto/exa/seat_management_pb/seat_management.proto +2349 -0
- package/src/post_install/binary.mjs +89 -0
- package/src/post_install/constants.mjs +2 -0
- package/src/post_install/cx_install.mjs +72 -0
|
@@ -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,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
|
+
})
|