Skip to main content
Glama

superdesign_check_files

Detect file changes by comparing current workspace files against a provided manifest, enabling gallery refresh integration for design workflows.

Instructions

Check for file changes by comparing current files with a manifest (for gallery refresh integration)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspace_pathNoWorkspace path (defaults to current directory)
manifestYesFile manifest to compare against

Implementation Reference

  • Input schema definition for the superdesign_check_files tool
    const CheckFilesSchema = z.object({
      workspace_path: z.string().optional().describe("Workspace path (defaults to current directory)"),
      manifest: z.array(z.object({
        name: z.string(),
        size: z.number(),
        modified: z.number()
      })).describe("File manifest to compare against")
    });
  • src/index.ts:2048-2069 (registration)
    Registration of the superdesign_check_files tool in the list of available tools
    name: "superdesign_check_files",
    description: "Check for file changes by comparing current files with a manifest (for gallery refresh integration)",
    inputSchema: {
      type: "object",
      properties: {
        workspace_path: { type: "string", description: "Workspace path (defaults to current directory)" },
        manifest: {
          type: "array",
          items: {
            type: "object",
            properties: {
              name: { type: "string" },
              size: { type: "number" },
              modified: { type: "number" }
            },
            required: ["name", "size", "modified"]
          },
          description: "File manifest to compare against"
        }
      },
      required: ["manifest"],
    },
  • Handler that processes superdesign_check_files tool calls: validates input with CheckFilesSchema, computes changes using checkFileChanges, returns JSON with hasChanges and changes list
    case "superdesign_check_files": {
      const { workspace_path, manifest } = CheckFilesSchema.parse(args);
      
      try {
        const superdesignDir = getSuperdeignDirectory(workspace_path);
        const designIterationsDir = path.join(superdesignDir, 'design_iterations');
        
        if (!existsSync(designIterationsDir)) {
          return {
            content: [{ type: "text", text: JSON.stringify({ hasChanges: false, changes: [], error: "No design iterations directory found" }) }],
          };
        }
        
        const result = checkFileChanges(superdesignDir, manifest);
        
        return {
          content: [{ type: "text", text: JSON.stringify(result) }],
        };
      } catch (error: any) {
        return {
          content: [{ type: "text", text: JSON.stringify({ hasChanges: false, changes: [], error: error.message }) }],
        };
      }
    }
  • Core logic that scans current design files (*.html, *.svg), compares against manifest by name/size/mtime, detects and categorizes changes as added/modified/deleted
    function checkFileChanges(superdesignDir: string, manifest: Array<{name: string; size: number; modified: number}>): {hasChanges: boolean; changes: Array<{file: string; type: 'added' | 'modified' | 'deleted'}>} {
      const designIterationsDir = path.join(superdesignDir, 'design_iterations');
      const currentFiles = glob.sync('*.{html,svg}', { cwd: designIterationsDir });
      const changes: Array<{file: string; type: 'added' | 'modified' | 'deleted'}> = [];
      
      // Check for new or modified files
      currentFiles.forEach(file => {
        const filePath = path.join(designIterationsDir, file);
        if (existsSync(filePath)) {
          const stats = statSync(filePath);
          const manifestEntry = manifest.find(m => m.name === file);
          
          if (!manifestEntry) {
            // New file
            changes.push({ file, type: 'added' });
          } else if (stats.size !== manifestEntry.size || stats.mtime.getTime() !== manifestEntry.modified) {
            // Modified file
            changes.push({ file, type: 'modified' });
          }
        }
      });
      
      // Check for deleted files
      manifest.forEach(manifestEntry => {
        if (!currentFiles.includes(manifestEntry.name)) {
          changes.push({ file: manifestEntry.name, type: 'deleted' });
        }
      });
      
      return {
        hasChanges: changes.length > 0,
        changes
      };
    }

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/jonthebeef/superdesign-mcp-claude-code'

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