<commit_before>import { Platform } from "../platforms/platform"
import { DangerDSLJSONType } from "../dsl/DangerDSL"
import { CliArgs } from "../dsl/cli-args"
import { CISource } from "../ci_source/ci_source"
import { emptyGitJSON } from "../platforms/github/GitHubGit"
import { CommanderStatic } from "commander"

export const jsonDSLGenerator = async (
  platform: Platform,
  source: CISource,
  program: CommanderStatic
): Promise<DangerDSLJSONType> => {
  const useSimpleDSL = platform.getPlatformReviewSimpleRepresentation && source.useEventDSL

  const git = useSimpleDSL ? emptyGitJSON() : await platform.getPlatformGitRepresentation()

  const getDSLFunc = useSimpleDSL
    ? platform.getPlatformReviewSimpleRepresentation
    : platform.getPlatformReviewDSLRepresentation

  const platformDSL = await getDSLFunc!()

  const cliArgs: CliArgs = {
    base: program.base,
    dangerfile: program.dangerfile,
    externalCiProvider: program.externalCiProvider,
    id: program.id,
    textOnly: program.textOnly,
    verbose: program.verbose,
  }

  const dslPlatformName = jsonDSLPlatformName(platform)

  return {
    git,
    [dslPlatformName]: platformDSL,
    settings: {
      github: {
        accessToken: process.env["DANGER_GITHUB_API_TOKEN"] || process.env["GITHUB_TOKEN"] || "NO_TOKEN",
        additionalHeaders: {},
        baseURL: process.env["DANGER_GITHUB_API_BASE_URL"] || process.env["GITHUB_URL"] || undefined,
      },
      cliArgs,
    },
  }
}

const jsonDSLPlatformName = (platform: Platform): string => {
  switch (platform.name) {<commit_msg>retrieve staging cli args runner side<commit_after>import { Platform } from "../platforms/platform"
import { DangerDSLJSONType } from "../dsl/DangerDSL"
import { CliArgs } from "../dsl/cli-args"
import { CISource } from "../ci_source/ci_source"
import { emptyGitJSON } from "../platforms/github/GitHubGit"
import { CommanderStatic } from "commander"

export const jsonDSLGenerator = async (
  platform: Platform,
  source: CISource,
  program: CommanderStatic
): Promise<DangerDSLJSONType> => {
  const useSimpleDSL = platform.getPlatformReviewSimpleRepresentation && source.useEventDSL

  const git = useSimpleDSL ? emptyGitJSON() : await platform.getPlatformGitRepresentation()

  const getDSLFunc = useSimpleDSL
    ? platform.getPlatformReviewSimpleRepresentation
    : platform.getPlatformReviewDSLRepresentation

  const platformDSL = await getDSLFunc!()

  const cliArgs: CliArgs = {
    base: program.base,
    dangerfile: program.dangerfile,
    externalCiProvider: program.externalCiProvider,
    id: program.id,
    textOnly: program.textOnly,
    verbose: program.verbose,
    staging: program.staging
  }

  const dslPlatformName = jsonDSLPlatformName(platform)

  return {
    git,
    [dslPlatformName]: platformDSL,
    settings: {
      github: {
        accessToken: process.env["DANGER_GITHUB_API_TOKEN"] || process.env["GITHUB_TOKEN"] || "NO_TOKEN",
        additionalHeaders: {},
        baseURL: process.env["DANGER_GITHUB_API_BASE_URL"] || process.env["GITHUB_URL"] || undefined,
      },
      cliArgs,
    },
  }
}

const jsonDSLPlatformName = (platform: Platform): string => {
  switch (platform.name) {
{'fraction_non_alphanumeric': 0.11107644305772231, 'fraction_numerical': 0.0, 'mean_word_length': 4.19611021069692, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5298829', 'n_tokens_mistral': 1014, 'n_tokens_neox': 978, 'n_words': 197}