For all functions that should exist in the diamond, it checks the current on-chain facet bytecode against the function's parent facet contract's current artifact bytecode. If there is a difference then the facet and given function are replaced in the diamond.
This is already done by virtue of how the upgrade mechanism works -> https://github.com/gemstation/gemforge/blob/master/src/shared/diamond.ts#L105
For all functions that should exist in the diamond, it checks the current on-chain facet bytecode against the function's parent facet contract's current artifact bytecode. If there is a difference then the facet and given function are replaced in the diamond.