A new theory of shell-model effective interactions