Skip to main content
Glama

Scan project for HeroUI v2

scan_project

Scans directories to identify files containing legacy HeroUI/NextUI components for migration to HeroUI v3 beta.

Instructions

Recursively scans a directory for files using legacy HeroUI/NextUI components.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directoryYes

Implementation Reference

  • The `scanProject` function implements the logic to scan a project directory for legacy components (based on `KNOWN_V2_IMPORTS`), calculate a priority level for each file, and maintain a scan cache.
    export async function scanProject(directory: string, options: { force?: boolean } = {}) {
      const { force = false } = options;
      const patterns = ["**/*.{ts,tsx,js,jsx}"];
      const files = await fg(patterns, {
        cwd: directory,
        absolute: true,
        onlyFiles: true,
        ignore: ["**/node_modules/**", "**/dist/**", "**/.next/**"]
      });
    
      const report: { file: string, components: string[]; priority?: string }[] = [];
      const v2Keys = Object.keys(KNOWN_V2_IMPORTS);
      const joint = v2Keys.map(k => k.replace(/[.*+?^${}()|[\\]\\]/g, '\\$&')).join("|");
      const quick = new RegExp(joint);
    
      // simple cache stored at repo root
      const cacheFile = path.join(process.cwd(), '.scan-cache.json');
      let cache: Record<string, { mtime: number; components: string[] }> = {};
      if (!force) {
        try { cache = JSON.parse(await fs.readFile(cacheFile, 'utf8')); } catch { };
      }
    
      for (const file of files) {
        const rel = path.relative(directory, file);
        const stat = await fs.stat(file);
        const m = stat.mtimeMs;
    
        if (!force && cache[rel] && cache[rel].mtime === m) {
          if (cache[rel].components.length) {
            report.push({ file: rel, components: cache[rel].components });
          }
          continue;
        }
    
        const content = await fs.readFile(file, "utf8");
        if (!quick.test(content)) {
          cache[rel] = { mtime: m, components: [] };
          continue;
        }
        const found: string[] = [];
        for (const key of v2Keys) {
          if (content.includes(key)) {
            found.push(key);
          }
        }
        if (found.length > 0) {
          // assign priority: P0 if any component is structural or manual-only
          const pri = found.some(key => {
            const cat = getTransformationCategory(key);
            if (cat !== 'safe_rename') return true;
            const suggestion = KNOWN_V2_IMPORTS[key] || '';
            if (suggestion.includes('legacy') || suggestion.startsWith('NOT IN')) return true;
            return false;
          }) ? 'P0' : 'P1';
          report.push({ file: rel, components: found, priority: pri });
        }
        cache[rel] = { mtime: m, components: found };
      }
    
      try {
        await fs.writeFile(cacheFile, JSON.stringify(cache, null, 2));
      } catch { /* ignore */ }
    
      return {
        content: [],
        structuredContent: { report, totalFiles: files.length, affectedFiles: report.length }
      };
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description carries full burden due to missing annotations. It discloses the recursive traversal behavior but omits critical safety information (read-only vs. destructive), output format/structure, and performance characteristics for large directories. It does not contradict any annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence with zero waste. 'Recursively' modifies the action, 'legacy HeroUI/NextUI components' specifies the target pattern, and 'directory' indicates the input scope. Perfectly front-loaded and appropriately sized.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given zero schema descriptions, missing annotations, and no output schema, the description is minimally adequate but incomplete. It fails to describe what the tool returns (file list? count? locations?) or how results are structured, which is essential information for an agent to use the output effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema coverage, the description must compensate. It mentions 'scans a directory' which semantically maps to the 'directory' parameter, but provides no explicit parameter documentation, path format guidance (absolute vs. relative), or examples. Baseline assistance provided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description provides a specific verb ('recursively scans'), resource ('directory'), and scope ('files using legacy HeroUI/NextUI components'). The term 'legacy' and title's 'HeroUI v2' context effectively distinguish this as a migration detection tool versus siblings like analyze_file or rewrite_file, though it doesn't explicitly state these distinctions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description lacks explicit guidance on when to use this tool versus alternatives. While 'recursively scans a directory' implicitly contrasts with analyze_file (likely single-file), there are no explicit when/when-not statements or prerequisites mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sctg-development/heroui-migration-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server