Sellers are responsible for disclosing any code violations and/or open permits (if any) … and for closing them out.
Buyers are responsible for doing their own due dilligence (within the times stated in the contract), and for researching and uncovering any open permits and code violations (if any).
Open permits and code violations usually come to light during the title search. But because the terms of a purchase agreement may necessitate checking before that, here’s a link that may be helpful. It may not give you everything you need with regard to researching open permits, but it’s a starting point: EWM PERMIT SEARCH .
Other options are: the Building and Zoning Department in the town or municipality you’re moving to, your attorney’s office, or contacting a local permit closing company.