Knitting Machine
Knitting machines were developed throughout the 20th century in order to speed up what was otherwise a very time-consuming process for producing clothing. Initially they improved upon an operation ostentibly involving two knitting needles, by using moving carriages past a row of small moveable hooks, and then allowed for those pins to be selected by a computer program. Each step represented an order of magnitude decrease in human labour-time needed to make a given garment.
Linear Knitting Machines
These are best suited for producing garments with large surface areas, especially with chiefly rectangular surfaces. For example, scarves are easily made in one job, and sections can be sewn together to produce sweaters.
Recently people have been hacking this type of knitting machine, one ones that were produced in the latter 20th century for use with early desktop computers, in order to make them programmable with modern computer hardware.
Circular Knitting Machines
These are more appropriate for producing garments that involve tube sections where a seam sewn along its length can cause discomfort, e.g. socks, stockings, winter hats and sleeves for other garments. Their utility, while arguably narrow, is very powerful since they can produce socks in minutes with a skilled operator, and socks/hosiery are generally the type of garments that wear out fastest.
Their theory of operation is relatively simple, but as far as I know there are no CNC designs in the public domain, although there is a lot of information to search through and many images of actual machines with long-expired patents - 4ndy.