#!/usr/bin/env node
import {
  loadDefaultMappings,
  resolveSource
} from "../chunk-ZECXM7LP.js";
import "../chunk-T4EXUIBY.js";
import "../chunk-473YHDYQ.js";
import "../chunk-FVN5PFFY.js";
import {
  init_esm_shims
} from "../chunk-DHET7RCE.js";

// src/cli/hooks/init.ts
init_esm_shims();
var hook = async function(options) {
  const projectDir = process.cwd();
  let sourceFlag;
  const sourceArgIndex = options.argv.indexOf("--source");
  if (sourceArgIndex !== -1 && sourceArgIndex + 1 < options.argv.length) {
    sourceFlag = options.argv[sourceArgIndex + 1];
  } else {
    const sourceFlagWithEquals = options.argv.find((arg) => arg.startsWith("--source="));
    if (sourceFlagWithEquals) {
      sourceFlag = sourceFlagWithEquals.split("=")[1];
    }
  }
  const sArgIndex = options.argv.indexOf("-s");
  if (sArgIndex !== -1 && sArgIndex + 1 < options.argv.length) {
    sourceFlag = options.argv[sArgIndex + 1];
  }
  await loadDefaultMappings();
  try {
    const resolvedConfig = await resolveSource(sourceFlag, projectDir);
    options.config.sourceConfig = resolvedConfig;
  } catch (error) {
  }
};
var init_default = hook;
export {
  init_default as default
};
//# sourceMappingURL=init.js.map