Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

1.0 KB
Raw Blame
import { NUMERIC_TEXT_CLASSES } from '../styles/generated/token-mappings';
import { type ClassValue, clsx } from 'clsx';
import { extendTailwindMerge } from 'tailwind-merge';

const customTwMerge = extendTailwindMerge({
  extend: {
    classGroups: {
      'font-size': [
        {
          text: NUMERIC_TEXT_CLASSES,
        },
      ],
    },
  },
});

export function cn(...inputs: ClassValue[]) {
  return customTwMerge(clsx(inputs));
}

/**
 * basename — strip directory components from a filesystem path.
 *
 * Cross-platform: handles both POSIX (`/`) and Windows (`\`) separators in
 * the same string, since paths arriving from the Agent SDK / IPC layer can
 * be either flavour. Returns the input unchanged when no separator is found.
 *
 * Renderer-side helper — the equivalent Node `path.basename` is only
 * available in the main process.
 */
export function basename(filePath: string): string {
  if (!filePath) return filePath;
  const parts = filePath.split(/[\\/]/);
  return parts[parts.length - 1] || filePath;
}