  We present a general method for the computation of tree-level superpotentials
for the world-volume theory of B-type D-branes. This includes quiver gauge
theories in the case that the D-brane is marginally stable. The technique
involves analyzing the A-infinity structure inherent in the derived category of
coherent sheaves. This effectively gives a practical method of computing
correlation functions in holomorphic Chern-Simons theory. As an example, we
give a more rigorous proof of previous results concerning 3-branes on certain
singularities including conifolds. We also provide a new example.
