@codacy/analysis-runner 0.24.0 → 0.25.0

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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AdapterDescriptor, ToolAdapter, CodacyConfig, CodacyToolConfig, Logger, OutputFormat, ProxyConfig, AnalysisResult, AnalysisError, PatternEntry, ConfigurationFileCheckResult, IssueSeverity, IssueCategory, Language, DiscoveryResult, Issue, PatternSummary, LogLevel, ImageScanPkgType, ImageScanSeverity, SbomFormat } from '@codacy/tooling';
1
+ import { AdapterDescriptor, ToolAdapter, CodacyConfig, CodacyToolConfig, Logger, OutputFormat, ProxyConfig, AnalysisResult, InstallationSource, AnalysisError, PatternEntry, ConfigurationFileCheckResult, IssueSeverity, IssueCategory, Language, DiscoveryResult, Issue, PatternSummary, LogLevel, ImageScanPkgType, ImageScanSeverity, SbomFormat } from '@codacy/tooling';
2
2
  export { AnalysisResult, OutputFormat, ProxyConfig, configureProxy, resolveProxyConfig } from '@codacy/tooling';
3
3
 
4
4
  /**
@@ -330,6 +330,65 @@ interface AnalyzeOptions {
330
330
  */
331
331
  declare function analyze(options: AnalyzeOptions): Promise<AnalysisResult>;
332
332
 
333
+ /**
334
+ * Installs tools without analysing anything — the library half of the
335
+ * `install` command.
336
+ *
337
+ * Its main consumer is an image build: the per-tool container contract runs
338
+ * with no network, so an image must carry its tools ahead of time, and running
339
+ * the very install `analyze --install-dependencies` would have run writes them
340
+ * to the same managed layout the analysis later resolves from. Reusing
341
+ * {@link installMissingTool} keeps the failure shapes identical to `analyze`.
342
+ */
343
+
344
+ /** Options for {@link installTools}. */
345
+ interface InstallToolsOptions {
346
+ /** Tool IDs (fuzzy-matched like `analyze --tool`). Ignored when `all` is set. */
347
+ tools?: string[];
348
+ /** Install every registered tool that has a local analyzer and supports this platform. */
349
+ all?: boolean;
350
+ logger?: Logger;
351
+ /** Progress callback forwarded to each adapter's install. */
352
+ onProgress?: (message: string) => void;
353
+ }
354
+ /** What happened to one tool. */
355
+ type ToolInstallStatus =
356
+ /** Already usable; nothing was installed. */
357
+ "present"
358
+ /** Installed and verified. */
359
+ | "installed"
360
+ /** The tool cannot self-install (e.g. a system package the user must provide). */
361
+ | "notSupported"
362
+ /** The tool does not run on this OS/architecture. */
363
+ | "unsupportedPlatform"
364
+ /** Install or verification failed. */
365
+ | "failed";
366
+ /** Per-tool outcome of {@link installTools}. */
367
+ interface ToolInstallReport {
368
+ toolId: string;
369
+ displayName: string;
370
+ status: ToolInstallStatus;
371
+ version?: string;
372
+ installation?: InstallationSource;
373
+ /** Failure or skip explanation. */
374
+ message?: string;
375
+ }
376
+ /** Result of {@link installTools}. */
377
+ interface InstallToolsResult {
378
+ tools: ToolInstallReport[];
379
+ /** Requested IDs that matched no registered local tool. */
380
+ unknown: string[];
381
+ }
382
+ /**
383
+ * Makes each selected tool available, installing it into the managed layout
384
+ * when `checkAvailability` says it is missing. Always runs with a `local`
385
+ * runner context: installing is exactly what container mode forbids, and an
386
+ * image build is not a container *run*. Sequential, like every other install
387
+ * path, because installs mutate `~/.codacy`. Never throws for a tool failure —
388
+ * each one is reported in the result.
389
+ */
390
+ declare function installTools(options: InstallToolsOptions): Promise<InstallToolsResult>;
391
+
333
392
  /**
334
393
  * Tool adapter registry — stores adapters for discovery by the runner.
335
394
  *
@@ -1645,4 +1704,4 @@ interface UploadImageSbomResult {
1645
1704
  */
1646
1705
  declare function uploadImageSbom(options: UploadImageSbomOptions): Promise<UploadImageSbomResult>;
1647
1706
 
1648
- export { type AdapterFactory, type AdapterLookup, type AnalyzeOptions, type AutoFilters, type CategoryFilter, type CodacyYamlConfig, type CodacyYamlEngineConfig, type Codacyrc, type CodacyrcParameter, type CodacyrcPattern, type CodacyrcResolution, type CodacyrcTool, type CodacyrcToolInput, type ConfigOperation, DEFAULT_IMAGE_SCAN_PKG_TYPES, DEFAULT_IMAGE_SCAN_SEVERITIES, type DiscoverOptions, type DiscoveryExcludes, type ExecutionMode, type IgnoredFilesResult, type InitAutoStats, type InitDefaultStats, type InitDiscoveryOptions, type InitLocalStats, type InitRemoteStats, type LoggerOptions, type MergeOptions, type NormalizedIssue, type PatternIdTranslator, type PatternMetadataLookup, type RemoteAuth, type ScanContainerImageOptions, type SeverityFilter, type UploadAuth, type UploadImageSbomOptions, type UploadImageSbomResult, type UploadOptions, type UploadResult, analyze, applyCodacyYamlExcludes, applyConfigOperation, buildCodacyrc, buildPatternTranslator, buildPayloads, buildToolConfig, clearAdapters, computePatternSummary, configureApiToken, createCodacyConfig, createLogger, createNullLogger, deleteCredentials, detectLanguages, diffConfigs, discover, formatOutput, formatTextSummary, getAdapter, getKnownDisplayNames, getRegisteredAdapters, getRegisteredDescriptors, initAutoConfig, initContainerConfig, initDefaultConfig, initLocalConfig, initRemoteConfig, intersectConfigs, listDiffFiles, listIgnoredFiles, listPrFiles, listStagedFiles, loadCredentials, mergeConfigs, parseAutoFilters, parseCodacyrc, parseReport, partitionContainerErrors, pruneEmptyTools, readBaselineConfig, readCodacyConfig, readCodacyYaml, readCodacyrc, registerAdapter, registerLazyAdapter, registerUnsupportedTool, registryLookup, relativizeLocalConfigPaths, resolveApiToken, resolveBaselinePath, resolveCodacyrc, resolveConfigPath, resolveDiscoveryExcludes, resolveEngineToAdapter, resolveHeadCommit, resolveLocalConfigPaths, resolveRemoteAuth, resolveRepositoryRoot, resolveResultsApiBaseUrl, resolveToolName, rotateLogFiles, saveCredentials, scanContainerImage, serializeCodacyrc, toEnginePatternId, updateConfigIncremental, uploadImageSbom, uploadReport, validateApiToken, writeBaselineConfig, writeCodacyConfig, writeCodacyConfigFile };
1707
+ export { type AdapterFactory, type AdapterLookup, type AnalyzeOptions, type AutoFilters, type CategoryFilter, type CodacyYamlConfig, type CodacyYamlEngineConfig, type Codacyrc, type CodacyrcParameter, type CodacyrcPattern, type CodacyrcResolution, type CodacyrcTool, type CodacyrcToolInput, type ConfigOperation, DEFAULT_IMAGE_SCAN_PKG_TYPES, DEFAULT_IMAGE_SCAN_SEVERITIES, type DiscoverOptions, type DiscoveryExcludes, type ExecutionMode, type IgnoredFilesResult, type InitAutoStats, type InitDefaultStats, type InitDiscoveryOptions, type InitLocalStats, type InitRemoteStats, type InstallToolsOptions, type InstallToolsResult, type LoggerOptions, type MergeOptions, type NormalizedIssue, type PatternIdTranslator, type PatternMetadataLookup, type RemoteAuth, type ScanContainerImageOptions, type SeverityFilter, type ToolInstallReport, type ToolInstallStatus, type UploadAuth, type UploadImageSbomOptions, type UploadImageSbomResult, type UploadOptions, type UploadResult, analyze, applyCodacyYamlExcludes, applyConfigOperation, buildCodacyrc, buildPatternTranslator, buildPayloads, buildToolConfig, clearAdapters, computePatternSummary, configureApiToken, createCodacyConfig, createLogger, createNullLogger, deleteCredentials, detectLanguages, diffConfigs, discover, formatOutput, formatTextSummary, getAdapter, getKnownDisplayNames, getRegisteredAdapters, getRegisteredDescriptors, initAutoConfig, initContainerConfig, initDefaultConfig, initLocalConfig, initRemoteConfig, installTools, intersectConfigs, listDiffFiles, listIgnoredFiles, listPrFiles, listStagedFiles, loadCredentials, mergeConfigs, parseAutoFilters, parseCodacyrc, parseReport, partitionContainerErrors, pruneEmptyTools, readBaselineConfig, readCodacyConfig, readCodacyYaml, readCodacyrc, registerAdapter, registerLazyAdapter, registerUnsupportedTool, registryLookup, relativizeLocalConfigPaths, resolveApiToken, resolveBaselinePath, resolveCodacyrc, resolveConfigPath, resolveDiscoveryExcludes, resolveEngineToAdapter, resolveHeadCommit, resolveLocalConfigPaths, resolveRemoteAuth, resolveRepositoryRoot, resolveResultsApiBaseUrl, resolveToolName, rotateLogFiles, saveCredentials, scanContainerImage, serializeCodacyrc, toEnginePatternId, updateConfigIncremental, uploadImageSbom, uploadReport, validateApiToken, writeBaselineConfig, writeCodacyConfig, writeCodacyConfigFile };
package/dist/index.js CHANGED
@@ -42,7 +42,7 @@ __export(index_exports, {
42
42
  clearAdapters: () => clearAdapters,
43
43
  computePatternSummary: () => computePatternSummary,
44
44
  configureApiToken: () => configureApiToken,
45
- configureProxy: () => import_tooling9.configureProxy,
45
+ configureProxy: () => import_tooling10.configureProxy,
46
46
  createCodacyConfig: () => createCodacyConfig,
47
47
  createLogger: () => createLogger,
48
48
  createNullLogger: () => createNullLogger,
@@ -61,6 +61,7 @@ __export(index_exports, {
61
61
  initDefaultConfig: () => initDefaultConfig,
62
62
  initLocalConfig: () => initLocalConfig,
63
63
  initRemoteConfig: () => initRemoteConfig,
64
+ installTools: () => installTools,
64
65
  intersectConfigs: () => intersectConfigs,
65
66
  listDiffFiles: () => listDiffFiles,
66
67
  listIgnoredFiles: () => listIgnoredFiles,
@@ -90,7 +91,7 @@ __export(index_exports, {
90
91
  resolveEngineToAdapter: () => resolveEngineToAdapter,
91
92
  resolveHeadCommit: () => resolveHeadCommit,
92
93
  resolveLocalConfigPaths: () => resolveLocalConfigPaths,
93
- resolveProxyConfig: () => import_tooling9.resolveProxyConfig,
94
+ resolveProxyConfig: () => import_tooling10.resolveProxyConfig,
94
95
  resolveRemoteAuth: () => resolveRemoteAuth,
95
96
  resolveRepositoryRoot: () => resolveRepositoryRoot,
96
97
  resolveResultsApiBaseUrl: () => resolveResultsApiBaseUrl,
@@ -1547,7 +1548,7 @@ async function analyze(options) {
1547
1548
  const requestedTools = options.tools ?? codacyConfig.tools.map((t) => t.toolId);
1548
1549
  const adapters = await getRegisteredAdapters(requestedTools);
1549
1550
  logger.info("Pipeline started", { mode, toolCount: adapters.length, parallelTools, toolTimeout });
1550
- const globalDir = import_path5.default.join(import_os2.default.homedir(), ".codacy");
1551
+ const globalDir = (0, import_tooling3.resolveGlobalDir)();
1551
1552
  const runnerEnv = options.runner ?? "local";
1552
1553
  const baseCtx = {
1553
1554
  repositoryRoot: options.repositoryRoot,
@@ -2058,7 +2059,7 @@ async function updateStaleManagedTools(capability, adapters, baseCtx, logger) {
2058
2059
  if (!adapter) continue;
2059
2060
  if (status.installation === "bundled") continue;
2060
2061
  if (status.version === adapter.preferredVersion) continue;
2061
- if (status.installation === "global") {
2062
+ if (status.installation === "global" || status.installation === "preinstalled") {
2062
2063
  status.expectedVersion = adapter.preferredVersion;
2063
2064
  logger.debug("System tool version differs from the pinned version", {
2064
2065
  toolId: adapter.id,
@@ -2205,9 +2206,81 @@ function buildResult(startedAt, repositoryRoot, mode, capability, issues, errors
2205
2206
  };
2206
2207
  }
2207
2208
 
2209
+ // src/install-tools.ts
2210
+ var import_os3 = __toESM(require("os"));
2211
+ var import_tooling4 = require("@codacy/tooling");
2212
+ function supportsThisPlatform(adapter) {
2213
+ return adapter.supportedOS.includes(import_os3.default.platform()) && adapter.supportedArch.includes(import_os3.default.arch());
2214
+ }
2215
+ async function installTools(options) {
2216
+ const logger = options.logger ?? createNullLogger();
2217
+ const unknown = [];
2218
+ let adapters;
2219
+ if (options.all) {
2220
+ adapters = await getRegisteredAdapters();
2221
+ } else {
2222
+ const requested = options.tools ?? [];
2223
+ for (const id of requested) {
2224
+ const match = getRegisteredDescriptors([id]);
2225
+ if (match.length === 0 || match[0].unsupported) unknown.push(id);
2226
+ }
2227
+ const known = requested.filter((id) => !unknown.includes(id));
2228
+ adapters = known.length > 0 ? await getRegisteredAdapters(known) : [];
2229
+ }
2230
+ const base = {
2231
+ repositoryRoot: process.cwd(),
2232
+ globalDir: (0, import_tooling4.resolveGlobalDir)(),
2233
+ platform: { os: import_os3.default.platform(), arch: import_os3.default.arch() },
2234
+ logger,
2235
+ runner: "local",
2236
+ ...options.onProgress ? { onProgress: options.onProgress } : {}
2237
+ };
2238
+ const tools = [];
2239
+ for (const adapter of adapters) {
2240
+ const report = {
2241
+ toolId: adapter.id,
2242
+ displayName: adapter.displayName,
2243
+ status: "failed"
2244
+ };
2245
+ tools.push(report);
2246
+ if (!supportsThisPlatform(adapter)) {
2247
+ report.status = "unsupportedPlatform";
2248
+ report.message = `${adapter.displayName} does not support ${import_os3.default.platform()}-${import_os3.default.arch()}`;
2249
+ continue;
2250
+ }
2251
+ const ctx = makeToolContext(base, adapter, []);
2252
+ try {
2253
+ const availability = await adapter.checkAvailability(ctx);
2254
+ if (availability.available) {
2255
+ report.status = "present";
2256
+ report.version = availability.version;
2257
+ report.installation = availability.installation;
2258
+ continue;
2259
+ }
2260
+ } catch (err) {
2261
+ logger.debug("Availability check threw before install", {
2262
+ toolId: adapter.id,
2263
+ error: err instanceof Error ? err.message : String(err)
2264
+ });
2265
+ }
2266
+ const outcome = await installMissingTool(adapter, ctx, logger);
2267
+ if (outcome.kind === "installed") {
2268
+ report.status = "installed";
2269
+ report.version = outcome.version;
2270
+ report.installation = outcome.installation;
2271
+ } else if (outcome.kind === "notSupported") {
2272
+ report.status = "notSupported";
2273
+ report.message = `${adapter.displayName} cannot be installed automatically; install it on PATH`;
2274
+ } else {
2275
+ report.message = outcome.error.message;
2276
+ }
2277
+ }
2278
+ return { tools, unknown };
2279
+ }
2280
+
2208
2281
  // src/format.ts
2209
2282
  var import_path6 = __toESM(require("path"));
2210
- var import_tooling4 = require("@codacy/tooling");
2283
+ var import_tooling5 = require("@codacy/tooling");
2211
2284
  var import_ansis = __toESM(require("ansis"));
2212
2285
  var import_cli_table3 = __toESM(require("cli-table3"));
2213
2286
  var MAX_SKIPPED_FILES_SHOWN = 5;
@@ -2349,7 +2422,7 @@ function formatContainer(result) {
2349
2422
  for (const issue of result.issues) {
2350
2423
  if (issue.line <= 0) {
2351
2424
  if (!fileErrors.has(issue.filePath)) {
2352
- fileErrors.set(issue.filePath, import_tooling4.LINE_NUMBERS_NOT_SUPPORTED);
2425
+ fileErrors.set(issue.filePath, import_tooling5.LINE_NUMBERS_NOT_SUPPORTED);
2353
2426
  }
2354
2427
  continue;
2355
2428
  }
@@ -2444,7 +2517,7 @@ function formatTextSummary(result, isInspect) {
2444
2517
  } else {
2445
2518
  const headerLine = `Analysis complete: ${totalIssues} issue${totalIssues !== 1 ? "s" : ""} found`;
2446
2519
  lines.push(totalIssues > 0 ? import_ansis.default.bold.red(headerLine) : import_ansis.default.bold(headerLine));
2447
- lines.push(`${toolCount} tool${toolCount !== 1 ? "s" : ""} ran in ${(0, import_tooling4.formatDuration)(duration)}`);
2520
+ lines.push(`${toolCount} tool${toolCount !== 1 ? "s" : ""} ran in ${(0, import_tooling5.formatDuration)(duration)}`);
2448
2521
  }
2449
2522
  if (totalErrors > 0) {
2450
2523
  lines.push(import_ansis.default.red(`${totalErrors} error${totalErrors !== 1 ? "s" : ""} occurred`));
@@ -2506,7 +2579,7 @@ function formatTextSummary(result, isInspect) {
2506
2579
  formatConfigCell(tool, result.metadata.repositoryRoot),
2507
2580
  filesCell,
2508
2581
  issueCount > 0 ? import_ansis.default.bold.red(String(issueCount)) : String(issueCount),
2509
- (0, import_tooling4.formatDuration)(durationMs)
2582
+ (0, import_tooling5.formatDuration)(durationMs)
2510
2583
  ]);
2511
2584
  }
2512
2585
  for (const tool of unavailableTools) {
@@ -2547,7 +2620,7 @@ function formatTextSummary(result, isInspect) {
2547
2620
  entries2.push(["Other", other]);
2548
2621
  }
2549
2622
  for (const [label, ms] of entries2) {
2550
- lines.push(` ${label.padEnd(22)} ${(0, import_tooling4.formatDuration)(ms)}`);
2623
+ lines.push(` ${label.padEnd(22)} ${(0, import_tooling5.formatDuration)(ms)}`);
2551
2624
  }
2552
2625
  }
2553
2626
  }
@@ -2664,7 +2737,7 @@ function formatMultilineIssue(output, issue) {
2664
2737
  }
2665
2738
  function formatInstallCell(tool) {
2666
2739
  if (!tool.expectedVersion) return tool.installation;
2667
- const mismatch = (0, import_tooling4.describeVersionMismatch)(tool.version, tool.expectedVersion);
2740
+ const mismatch = (0, import_tooling5.describeVersionMismatch)(tool.version, tool.expectedVersion);
2668
2741
  if (!mismatch) return tool.installation;
2669
2742
  return `${tool.installation} ${import_ansis.default.yellow(`(${mismatch})`)}`;
2670
2743
  }
@@ -2970,17 +3043,16 @@ function updateConfigIncremental(base, current, next) {
2970
3043
  }
2971
3044
 
2972
3045
  // src/init.ts
2973
- var import_os3 = __toESM(require("os"));
2974
3046
  var import_path9 = __toESM(require("path"));
2975
3047
  var import_child_process4 = require("child_process");
2976
- var import_tooling7 = require("@codacy/tooling");
3048
+ var import_tooling8 = require("@codacy/tooling");
2977
3049
 
2978
3050
  // src/discover/index.ts
2979
3051
  var import_promises3 = __toESM(require("fs/promises"));
2980
3052
  var import_path7 = __toESM(require("path"));
2981
3053
 
2982
3054
  // src/discover/classify.ts
2983
- var import_tooling6 = require("@codacy/tooling");
3055
+ var import_tooling7 = require("@codacy/tooling");
2984
3056
 
2985
3057
  // src/discover/ecosystems/npm.ts
2986
3058
  function parsePackageJson(content) {
@@ -4115,7 +4187,7 @@ function resolveManifest(filePath) {
4115
4187
  }
4116
4188
 
4117
4189
  // src/discover/signals.ts
4118
- var import_tooling5 = require("@codacy/tooling");
4190
+ var import_tooling6 = require("@codacy/tooling");
4119
4191
  function pathBasename(filePath) {
4120
4192
  return filePath.split("/").pop() ?? filePath;
4121
4193
  }
@@ -4316,7 +4388,7 @@ function detectFileSignals(files) {
4316
4388
  for (const rule of FILE_SIGNAL_RULES) {
4317
4389
  const hit = files.find((f) => rule.matches(f));
4318
4390
  if (!hit) continue;
4319
- const entity = import_tooling5.DEPENDENCY_ENTITIES[rule.entity];
4391
+ const entity = import_tooling6.DEPENDENCY_ENTITIES[rule.entity];
4320
4392
  result.push({
4321
4393
  name: rule.name,
4322
4394
  key: entity.key,
@@ -4340,7 +4412,7 @@ function detectPackageJsonSignals(content) {
4340
4412
  }
4341
4413
  const name = pkg && typeof pkg.name === "string" ? pkg.name : "";
4342
4414
  if (name && isEslintPluginName(name)) {
4343
- const entity = import_tooling5.DEPENDENCY_ENTITIES["eslint-plugin"];
4415
+ const entity = import_tooling6.DEPENDENCY_ENTITIES["eslint-plugin"];
4344
4416
  return [
4345
4417
  {
4346
4418
  name,
@@ -4368,14 +4440,14 @@ function telltaleIndex(ecosystem) {
4368
4440
  }
4369
4441
  function classifyDependency(name, ecosystem) {
4370
4442
  const exact = telltaleIndex(ecosystem).get(name);
4371
- if (exact) return import_tooling6.DEPENDENCY_ENTITIES[exact];
4443
+ if (exact) return import_tooling7.DEPENDENCY_ENTITIES[exact];
4372
4444
  for (const [prefix, entity] of getEcosystem(ecosystem).prefixes ?? []) {
4373
- if (name.startsWith(prefix)) return import_tooling6.DEPENDENCY_ENTITIES[entity];
4445
+ if (name.startsWith(prefix)) return import_tooling7.DEPENDENCY_ENTITIES[entity];
4374
4446
  }
4375
4447
  return void 0;
4376
4448
  }
4377
4449
  function getKnownDisplayNames() {
4378
- return new Set(Object.values(import_tooling6.DEPENDENCY_ENTITIES).map((entity) => entity.displayName));
4450
+ return new Set(Object.values(import_tooling7.DEPENDENCY_ENTITIES).map((entity) => entity.displayName));
4379
4451
  }
4380
4452
 
4381
4453
  // src/discover/notable-files.ts
@@ -8787,7 +8859,7 @@ async function detectLanguages(repositoryRoot, precomputedFiles, exclude) {
8787
8859
  for (const file of files) {
8788
8860
  const basename = import_path9.default.basename(file);
8789
8861
  const ext = import_path9.default.extname(file).toLowerCase();
8790
- for (const [lang, config] of Object.entries(import_tooling7.LANGUAGE_CONFIG)) {
8862
+ for (const [lang, config] of Object.entries(import_tooling8.LANGUAGE_CONFIG)) {
8791
8863
  if (config.extensions.includes(ext)) {
8792
8864
  detected.add(lang);
8793
8865
  } else if (config.files.includes(basename)) {
@@ -8804,8 +8876,8 @@ async function detectLocalConfigFiles(repositoryRoot, adapters) {
8804
8876
  const result = await adapter.checkLocalConfigurationFile({
8805
8877
  repositoryRoot,
8806
8878
  generatedConfigDir: import_path9.default.join(repositoryRoot, ".codacy", "generated"),
8807
- globalDir: import_path9.default.join(process.env.HOME ?? "~", ".codacy"),
8808
- toolInstallDir: import_path9.default.join(process.env.HOME ?? "~", ".codacy", "tools", adapter.id),
8879
+ globalDir: (0, import_tooling8.resolveGlobalDir)(),
8880
+ toolInstallDir: import_path9.default.join((0, import_tooling8.resolveGlobalDir)(), "tools", adapter.id),
8809
8881
  targetFiles: [],
8810
8882
  platform: { os: process.platform, arch: process.arch },
8811
8883
  logger: createNullLogger(),
@@ -9035,7 +9107,7 @@ async function initAutoConfig(repositoryRoot, adapters, descriptors, filters, on
9035
9107
  const discoveryResult = await discover(repositoryRoot, { exclude: excludes.global });
9036
9108
  onDiscoveryComplete?.(discoveryResult);
9037
9109
  const detectedKeys = /* @__PURE__ */ new Set();
9038
- for (const lang of discoveryResult.languages) detectedKeys.add((0, import_tooling7.languageKey)(lang));
9110
+ for (const lang of discoveryResult.languages) detectedKeys.add((0, import_tooling8.languageKey)(lang));
9039
9111
  for (const fw of discoveryResult.frameworks) detectedKeys.add(fw.key);
9040
9112
  for (const lib of discoveryResult.libraries) detectedKeys.add(lib.key);
9041
9113
  const repoLanguages = new Set(discoveryResult.languages);
@@ -9167,7 +9239,7 @@ async function applyAdapterConfigSuggestions(adapter, toolEntry, repositoryRoot,
9167
9239
  }
9168
9240
  };
9169
9241
  try {
9170
- const globalDir = import_path9.default.join(import_os3.default.homedir(), ".codacy");
9242
+ const globalDir = (0, import_tooling8.resolveGlobalDir)();
9171
9243
  const ctx = {
9172
9244
  repositoryRoot,
9173
9245
  generatedConfigDir: import_path9.default.join(repositoryRoot, ".codacy", "generated", adapter.id),
@@ -9433,7 +9505,7 @@ function parseAutoFilters(raw) {
9433
9505
  }
9434
9506
 
9435
9507
  // src/index.ts
9436
- var import_tooling9 = require("@codacy/tooling");
9508
+ var import_tooling10 = require("@codacy/tooling");
9437
9509
 
9438
9510
  // src/credentials.ts
9439
9511
  var import_crypto = __toESM(require("crypto"));
@@ -9768,23 +9840,23 @@ async function safeReadBody(res) {
9768
9840
  var import_promises7 = __toESM(require("fs/promises"));
9769
9841
  var import_os5 = __toESM(require("os"));
9770
9842
  var import_path11 = __toESM(require("path"));
9771
- var import_tooling8 = require("@codacy/tooling");
9843
+ var import_tooling9 = require("@codacy/tooling");
9772
9844
  var DEFAULT_IMAGE_SCAN_SEVERITIES = ["HIGH", "CRITICAL"];
9773
9845
  var DEFAULT_IMAGE_SCAN_PKG_TYPES = ["os"];
9774
9846
  var SBOM_UPLOAD_TIMEOUT_MS = 5 * 60 * 1e3;
9775
9847
  var PROVIDERS = ["gh", "gl", "bb"];
9776
9848
  async function scanContainerImage(options) {
9777
9849
  const startedAt = /* @__PURE__ */ new Date();
9778
- (0, import_tooling8.validateImageReference)(options.image);
9850
+ (0, import_tooling9.validateImageReference)(options.image);
9779
9851
  const severities = parseVocabulary(
9780
9852
  options.severities ?? DEFAULT_IMAGE_SCAN_SEVERITIES,
9781
- import_tooling8.IMAGE_SCAN_SEVERITIES,
9853
+ import_tooling9.IMAGE_SCAN_SEVERITIES,
9782
9854
  "severity",
9783
9855
  (v) => v.toUpperCase()
9784
9856
  );
9785
9857
  const pkgTypes = parseVocabulary(
9786
9858
  options.pkgTypes ?? DEFAULT_IMAGE_SCAN_PKG_TYPES,
9787
- import_tooling8.IMAGE_SCAN_PKG_TYPES,
9859
+ import_tooling9.IMAGE_SCAN_PKG_TYPES,
9788
9860
  "package type",
9789
9861
  (v) => v.toLowerCase()
9790
9862
  );
@@ -9825,7 +9897,7 @@ async function scanContainerImage(options) {
9825
9897
  );
9826
9898
  }
9827
9899
  async function uploadImageSbom2(options) {
9828
- const target = (0, import_tooling8.resolveImageTarget)(options.image, options.tag);
9900
+ const target = (0, import_tooling9.resolveImageTarget)(options.image, options.tag);
9829
9901
  const format = parseSbomFormat(options.format);
9830
9902
  if (!PROVIDERS.includes(options.provider)) {
9831
9903
  throw new Error(
@@ -9902,9 +9974,9 @@ function parseVocabulary(values, allowed, label, normalize) {
9902
9974
  return [...new Set(parsed)];
9903
9975
  }
9904
9976
  function parseSbomFormat(format) {
9905
- const value = format ?? import_tooling8.SBOM_FORMATS[0];
9906
- if (!import_tooling8.SBOM_FORMATS.includes(value)) {
9907
- throw new Error(`Invalid format "${value}": expected one of ${import_tooling8.SBOM_FORMATS.join(", ")}`);
9977
+ const value = format ?? import_tooling9.SBOM_FORMATS[0];
9978
+ if (!import_tooling9.SBOM_FORMATS.includes(value)) {
9979
+ throw new Error(`Invalid format "${value}": expected one of ${import_tooling9.SBOM_FORMATS.join(", ")}`);
9908
9980
  }
9909
9981
  return value;
9910
9982
  }
@@ -9923,7 +9995,7 @@ async function resolveImageAdapter() {
9923
9995
  function makeBaseContext(logger, signal) {
9924
9996
  return {
9925
9997
  repositoryRoot: process.cwd(),
9926
- globalDir: import_path11.default.join(import_os5.default.homedir(), ".codacy"),
9998
+ globalDir: (0, import_tooling9.resolveGlobalDir)(),
9927
9999
  platform: { os: import_os5.default.platform(), arch: import_os5.default.arch() },
9928
10000
  logger,
9929
10001
  runner: "local",
@@ -10068,6 +10140,7 @@ function describeUploadError(err) {
10068
10140
  initDefaultConfig,
10069
10141
  initLocalConfig,
10070
10142
  initRemoteConfig,
10143
+ installTools,
10071
10144
  intersectConfigs,
10072
10145
  listDiffFiles,
10073
10146
  listIgnoredFiles,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/analysis-runner",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "description": "Core orchestration engine for Codacy analysis",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -12,11 +12,11 @@
12
12
  "cli-table3": "^0.6",
13
13
  "minimatch": "10.2.4",
14
14
  "yaml": "^2.6.0",
15
- "@codacy/tooling": "0.24.0"
15
+ "@codacy/tooling": "0.25.0"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@codacy/openapi-typescript-codegen": "0.0.9",
19
- "@codacy/tools-dummy-1": "0.24.0"
19
+ "@codacy/tools-dummy-1": "0.25.0"
20
20
  },
21
21
  "license": "MIT",
22
22
  "author": "Codacy <support@codacy.com> (https://www.codacy.com)",