@coana-tech/cli 14.12.94 → 14.12.95

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/cli.mjs CHANGED
@@ -244541,7 +244541,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
244541
244541
  }
244542
244542
 
244543
244543
  // dist/version.js
244544
- var version2 = "14.12.94";
244544
+ var version2 = "14.12.95";
244545
244545
 
244546
244546
  // dist/cli-core.js
244547
244547
  var { mapValues, omit, partition, pick } = import_lodash15.default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.12.94",
3
+ "version": "14.12.95",
4
4
  "description": "Coana CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -89804,6 +89804,31 @@ function evaluate(expression, project) {
89804
89804
 
89805
89805
  // dist/whole-program-code-aware-vulnerability-scanner/dotnet/dotnet-code-aware-vulnerability-scanner.js
89806
89806
  var { uniq: uniq2, uniqWith, isEqual } = import_lodash6.default;
89807
+ async function ensureDotnet6OrAbove() {
89808
+ const result = await execNeverFail(cmdt`dotnet --list-runtimes`);
89809
+ if (result.error)
89810
+ throw new Error(".NET runtime not found. Please install .NET 6 runtime or above.");
89811
+ const runtimesOutput = result.stdout ?? "";
89812
+ const runtimeLines = runtimesOutput.split("\n").map((line) => line.trim()).filter(Boolean);
89813
+ const netCoreRuntimes = runtimeLines.filter((line) => line.startsWith("Microsoft.NETCore.App")).map((line) => {
89814
+ const versionMatch = line.match(/Microsoft\.NETCore\.App\s+(\d+)(?:\.(\d+))?(?:\.(\d+))?/);
89815
+ if (versionMatch) {
89816
+ return {
89817
+ major: parseInt(versionMatch[1], 10),
89818
+ minor: versionMatch[2] ? parseInt(versionMatch[2], 10) : 0,
89819
+ patch: versionMatch[3] ? parseInt(versionMatch[3], 10) : 0
89820
+ };
89821
+ }
89822
+ return void 0;
89823
+ }).filter((v) => v !== void 0);
89824
+ if (netCoreRuntimes.length === 0)
89825
+ throw new Error(".NET runtime not found. Please install .NET 6 runtime or above.");
89826
+ const hasValidRuntime = netCoreRuntimes.some((version3) => version3.major >= 6);
89827
+ if (!hasValidRuntime) {
89828
+ const foundVersions = netCoreRuntimes.map((v) => `${v.major}.${v.minor}.${v.patch}`).join(", ");
89829
+ throw new Error(`.NET runtime versions found: ${foundVersions}. None are supported. Please install .NET 6 runtime or above.`);
89830
+ }
89831
+ }
89807
89832
  var DotnetCodeAwareVulnerabilityScanner = class _DotnetCodeAwareVulnerabilityScanner {
89808
89833
  apps;
89809
89834
  deps;
@@ -89909,6 +89934,11 @@ var DotnetCodeAwareVulnerabilityScanner = class _DotnetCodeAwareVulnerabilitySca
89909
89934
  }
89910
89935
  async runPhantomDependencyAnalysis() {
89911
89936
  return withTmpDirectory("dotnet-direct-dependency-analysis", async (tmpDir) => {
89937
+ try {
89938
+ await ensureDotnet6OrAbove();
89939
+ } catch {
89940
+ return void 0;
89941
+ }
89912
89942
  const options = {
89913
89943
  apps: this.apps,
89914
89944
  deps: this.deps,
@@ -89942,6 +89972,11 @@ var DotnetCodeAwareVulnerabilityScanner = class _DotnetCodeAwareVulnerabilitySca
89942
89972
  async actuallyRunAnalysis(vulnerabilityAccessPaths, filteredDeps) {
89943
89973
  this.statusUpdater?.("Running analysis...");
89944
89974
  return withTmpDirectory("dotnet-run-analysis", async (tmpDir) => {
89975
+ try {
89976
+ await ensureDotnet6OrAbove();
89977
+ } catch (e) {
89978
+ return { type: "error", message: e.message };
89979
+ }
89945
89980
  const options = {
89946
89981
  apps: this.apps,
89947
89982
  deps: filteredDeps ?? this.deps,
@@ -103749,6 +103784,21 @@ var treeSitterScalaPath = join13(COANA_REPOS_PATH(), "tree-sitter-scala");
103749
103784
  // dist/whole-program-code-aware-vulnerability-scanner/java/java-code-aware-vulnerability-scanner.js
103750
103785
  var import_picomatch2 = __toESM(require_picomatch4(), 1);
103751
103786
  var { uniq: uniq3, uniqWith: uniqWith2, isEqual: isEqual2 } = import_lodash8.default;
103787
+ async function ensureJdk8OrAbove() {
103788
+ const javapResult = await execNeverFail(cmdt`javap -version`);
103789
+ if (javapResult.error)
103790
+ throw new Error("JDK not found. Please install JDK 8 or above.");
103791
+ const javapOutput = javapResult.stdout.trim() || "";
103792
+ const versionMatch = javapOutput.match(/(\d+)(?:\.(\d+))?(?:\.(\d+))?/);
103793
+ if (!versionMatch)
103794
+ throw new Error("Could not determine Java version. Please ensure JDK 8 or above is installed.");
103795
+ const major = parseInt(versionMatch[1], 10);
103796
+ const minor = versionMatch[2] ? parseInt(versionMatch[2], 10) : 0;
103797
+ const isValid = major === 1 && minor >= 8 || major >= 8;
103798
+ if (!isValid) {
103799
+ throw new Error(`JDK version ${javapOutput} is not supported. Please install JDK 8 or above.`);
103800
+ }
103801
+ }
103752
103802
  var JavaCodeAwareVulnerabilityScanner = class _JavaCodeAwareVulnerabilityScanner {
103753
103803
  apps;
103754
103804
  deps;
@@ -103855,6 +103905,11 @@ var JavaCodeAwareVulnerabilityScanner = class _JavaCodeAwareVulnerabilityScanner
103855
103905
  }
103856
103906
  async runPhantomDependencyAnalysis() {
103857
103907
  return withTmpDirectory("java-direct-dependency-analysis", async (tmpDir) => {
103908
+ try {
103909
+ await ensureJdk8OrAbove();
103910
+ } catch {
103911
+ return void 0;
103912
+ }
103858
103913
  const options = {
103859
103914
  apps: this.apps,
103860
103915
  deps: this.deps,
@@ -103888,6 +103943,11 @@ var JavaCodeAwareVulnerabilityScanner = class _JavaCodeAwareVulnerabilityScanner
103888
103943
  async actuallyRunAnalysis(vulnerabilityAccessPaths, filteredDeps) {
103889
103944
  this.statusUpdater?.("Running analysis...");
103890
103945
  return withTmpDirectory("java-run-analysis", async (tmpDir) => {
103946
+ try {
103947
+ await ensureJdk8OrAbove();
103948
+ } catch (e) {
103949
+ return { type: "error", message: e.message };
103950
+ }
103891
103951
  const options = {
103892
103952
  apps: this.apps,
103893
103953
  deps: filteredDeps ?? this.deps,