Repository: denoland/deno
File: cli/main.rs (Rust)

Code before:
    DenoSubcommand::Cache(cache_flags) => spawn_subcommand(async move {
      tools::installer::install_from_entrypoints(flags, &cache_flags.files).await
    }),
    DenoSubcommand::Check(check_flags) => spawn_subcommand(async move {
      tools::check::check(flags, check_flags).await
    }),
    DenoSubcommand::Clean => spawn_subcommand(async move {
      tools::clean::clean()
    }),
    DenoSubcommand::Compile(compile_flags) => spawn_subcommand(async {
      tools::compile::compile(flags, compile_flags).await
    }),
    DenoSubcommand::Coverage(coverage_flags) => spawn_subcommand(async {
      tools::coverage::cover_files(flags, coverage_flags)
    }),
    DenoSubcommand::Fmt(fmt_flags) => {
      spawn_subcommand(
        async move { tools::fmt::format(flags, fmt_flags).await },
      )
    }
    DenoSubcommand::Init(init_flags) => {
      if let Some(dir) = &init_flags.dir {
        if dir.starts_with("jsr:") {
          bail!("Initializing project from a jsr package is currently not supported.");
        } else if dir.starts_with("npm:") {
          // TODO: do prompt
          let script_name = format!("npm:create-{}", dir.strip_prefix("npm:").unwrap());

          let new_flags = Flags {
            permissions: PermissionFlags {
              allow_all: true,
              ..Default::default()
            },
            allow_scripts: PackagesAllowedScripts::All,
            // TODO:
            argv: vec![],
            subcommand: DenoSubcommand::Run(RunFlags {
                script: script_name,
                ..Default::default()
            }),
            ..Default::default()
          };
          let result = tools::run::run_script(WorkerExecutionMode::Run, new_flags.into(), None).await;
          return result;
        }
      }

      spawn_subcommand(async {
        // make compiler happy since init_project is sync
        tokio::task::yield_now().await;
        tools::init::init_project(init_flags)

Review comment (security):
BLOCKER FOR LANDING:

Do the confirmation prompt if user wants to allow all permissions and post-install scripts.



Code after:
      tools::check::check(flags, check_flags).await
    }),
    DenoSubcommand::Clean => spawn_subcommand(async move {
      tools::clean::clean()
    }),
    DenoSubcommand::Compile(compile_flags) => spawn_subcommand(async {
      tools::compile::compile(flags, compile_flags).await
    }),
    DenoSubcommand::Coverage(coverage_flags) => spawn_subcommand(async {
      tools::coverage::cover_files(flags, coverage_flags)
    }),
    DenoSubcommand::Fmt(fmt_flags) => {
      spawn_subcommand(
        async move { tools::fmt::format(flags, fmt_flags).await },
      )
    }
    DenoSubcommand::Init(init_flags) => {
      spawn_subcommand(async {
        tools::init::init_project(init_flags).await
      })
    }
    DenoSubcommand::Info(info_flags) => {
      spawn_subcommand(async { tools::info::info(flags, info_flags).await })
    }
    DenoSubcommand::Install(install_flags) => spawn_subcommand(async {
      tools::installer::install_command(flags, install_flags).await
    }),
    DenoSubcommand::JSONReference(json_reference) => spawn_subcommand(async move {
      display::write_to_stdout_ignore_sigpipe(&deno_core::serde_json::to_vec_pretty(&json_reference.json).unwrap())
    }),
    DenoSubcommand::Jupyter(jupyter_flags) => spawn_subcommand(async {
      tools::jupyter::kernel(flags, jupyter_flags).await
    }),
    DenoSubcommand::Uninstall(uninstall_flags) => spawn_subcommand(async {
      tools::installer::uninstall(flags, uninstall_flags).await
    }),
    DenoSubcommand::Lsp => spawn_subcommand(async {
      if std::io::stderr().is_terminal() {
        log::warn!(
          "{} command is intended to be run by text editors and IDEs and shouldn't be run manually.

  Visit https://docs.deno.com/runtime/getting_started/setup_your_environment/ for instruction
  how to setup your favorite text editor.

  Press Ctrl+C to exit.
        ", colors::cyan("deno lsp"));
      }
      lsp::start().await
    }),
    DenoSubcommand::Lint(lint_flags) => spawn_subcommand(async {
      if lint_flags.rules {