const TEXT_EXTENSIONS = [
  '.bash',
  '.c',
  '.cjs',
  '.cpp',
  '.css',
  '.csv',
  '.go',
  '.gradle',
  '.groovy',
  '.h',
  '.hpp',
  '.htm',
  '.html',
  '.ini',
  '.java',
  '.js',
  '.json',
  '.jsx',
  '.kt',
  '.kts',
  '.markdown',
  '.md',
  '.mjs',
  '.properties',
  '.py',
  '.rb',
  '.rs',
  '.sh',
  '.sql',
  '.toml',
  '.ts',
  '.tsv',
  '.tsx',
  '.txt',
  '.xml',
  '.yaml',
  '.yml',
  '.zsh',
] as const;

/** 按 M18 规范判断目标路径的持久化表示。 */
export function isSkillPathText(path: string) {
  const normalized = path.toLowerCase();
  const topDirectory = normalized.split('/', 1)[0];
  if (topDirectory === 'scripts') return true;
  if (topDirectory === 'assets') return false;
  return TEXT_EXTENSIONS.some((extension) => normalized.endsWith(extension));
}
