import a from './index5.mjs';
import { f as fsParadigm } from '../shared/ccjk.wLJHO0Af.mjs';
import '../shared/ccjk.BAGoDD49.mjs';
import 'node:fs';
import 'tinyglobby';
import '../shared/ccjk.bQ7Dh1g4.mjs';

async function paradigmCommand(options = {}) {
  console.log(a.cyan.bold("\n\u{1F3D7}\uFE0F  Detecting Project Paradigm...\n"));
  const structure = await fsParadigm.detect(process.cwd());
  const paradigm = fsParadigm.getParadigm(structure.paradigm);
  if (paradigm) {
    console.log(a.white.bold(`Type: ${paradigm.name}`));
    console.log(a.gray(`Description: ${paradigm.description}`));
    console.log(a.gray(`Confidence: ${structure.confidence}%`));
    console.log();
  }
  console.log(a.cyan.bold("\u{1F4C1} Conventions:"));
  if (structure.conventions.sourceDir) {
    console.log(a.white(`  Source:  ${structure.conventions.sourceDir}`));
  }
  if (structure.conventions.testDir) {
    console.log(a.white(`  Test:    ${structure.conventions.testDir}`));
  }
  if (structure.conventions.configDir) {
    console.log(a.white(`  Config:  ${structure.conventions.configDir}`));
  }
  if (structure.conventions.buildDir) {
    console.log(a.white(`  Build:   ${structure.conventions.buildDir}`));
  }
  console.log();
  if (options.role) {
    const role = options.role;
    const files = fsParadigm.getFilesByRole(structure, role);
    console.log(a.cyan.bold(`\u{1F4C4} ${role.toUpperCase()} Files (${files.length}):
`));
    if (files.length === 0) {
      console.log(a.gray("  No files found for this role\n"));
    } else {
      for (const file of files.slice(0, 20)) {
        console.log(a.white(`  \u2022 ${file.replace(process.cwd(), "")}`));
      }
      if (files.length > 20) {
        console.log(a.gray(`  ... and ${files.length - 20} more`));
      }
      console.log();
    }
  } else {
    console.log(a.cyan.bold("\u{1F4CA} File Map:"));
    const roles = ["source", "test", "config", "types", "docs", "assets"];
    for (const role of roles) {
      const files = fsParadigm.getFilesByRole(structure, role);
      if (files.length > 0) {
        console.log(a.white(`  ${role.padEnd(10)} ${files.length} files`));
      }
    }
    console.log();
    if (options.verbose) {
      console.log(a.gray("Use --role <role> to see specific files"));
      console.log(a.gray("Available roles: source, test, config, types, docs, assets"));
      console.log();
    }
  }
  if (options.verbose && paradigm) {
    console.log(a.cyan.bold("\u{1F50D} Patterns:"));
    for (const pattern of paradigm.patterns) {
      console.log(a.white(`  ${pattern.role.padEnd(10)} ${pattern.pattern}`));
      console.log(a.gray(`             ${pattern.description}`));
    }
    console.log();
  }
}

export { paradigmCommand };
