How to hook into dbt model DAG for utility scripts

Hi, I want to build a github action / precommit script (in say a python script) that can verify some properties about my DAG for testing purposes.

Say I want to create a test that ensures that a certain dbt model has only 1 dependency.
How can I plug into the dbt DAG in some way to do this? Is there some library that can give me the DAG in some data structure that I can then use to verify properties about it?

If not, then it seems like my only option is to run some regex to check that a model has only 1 dependency.

you can setup precommit and use the check-model-parents-and-childs test available in dbt-checkpoint package.

please go through this for more info