Coupled-cluster method in Fock space. I. General formalism.