Need help for my Figma plugin

#ask Hello everyone, I was creating a plugin which converts figma designs such that similar looking groups is made into a component with proper auto layout. Is there any way I can find out similar looking groups or designs in the page and make a component out of it and for all the other places which is looking the same, I use an instance of that component. Please help me out.