// src/actions/skills/lint.ts
import {
  existsSync,
  readdirSync,
  statSync
} from "node:fs";
import OS from "node:os";
import PATH from "node:path";
import chalk from "chalk";

// src/lib/initCwd.ts
function INIT_CWD() {
  return process.env.INIT_CWD ?? process.cwd();
}

// src/actions/skills/lint.ts
var listSkillDirs = (root) => {
  if (!existsSync(root)) return [];
  return readdirSync(root).filter(
    (f) => statSync(PATH.resolve(root, f)).isDirectory()
  );
};
var skillsLint = (options = {}) => {
  const projectDir = options.projectDir ?? PATH.resolve(INIT_CWD(), ".claude", "skills");
  const globalDir = options.globalDir ?? PATH.resolve(OS.homedir(), ".claude", "skills");
  const projectSkills = listSkillDirs(projectDir);
  const globalSkills = new Set(listSkillDirs(globalDir));
  const duplicates = projectSkills.filter((name) => globalSkills.has(name)).toSorted();
  if (duplicates.length === 0) {
    console.log(chalk.gray("skills: no project/global duplicates"));
    return 0;
  }
  for (const name of duplicates) {
    console.log(chalk.yellow(`skills: '${name}' is installed in both project and global scope`));
  }
  console.log(chalk.yellow(`skills: ${duplicates.length} duplicate(s) found`));
  return 1;
};
export {
  skillsLint
};
//# sourceMappingURL=lint.mjs.map
