superdesign_check_files
Verify file changes by comparing current files to a manifest for gallery refresh integration. Input workspace path and manifest to detect modifications.
Instructions
Check for file changes by comparing current files with a manifest (for gallery refresh integration)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| manifest | Yes | File manifest to compare against | |
| workspace_path | No | Workspace path (defaults to current directory) |
Implementation Reference
- src/index.ts:2516-2539 (handler)MCP tool handler for 'superdesign_check_files' that parses input, calls the checkFileChanges function, and returns the result as JSON.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 }) }], }; } }
- src/index.ts:298-331 (helper)Core implementation that compares current files in 'design_iterations' against the manifest to detect changes (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 }; }
- src/index.ts:66-73 (schema)Zod schema for validating input parameters: optional workspace_path and required manifest array of file stats.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:2047-2070 (registration)Tool registration in the MCP tools list, including name, description, and input schema.{ 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"], }, },