cps (C Project Scaffold) is a VS Code extension for scaffolding C projects, generating project structures, and creating C source and header files templates.
Requirements
The extension runs in VS Code and is not limited to Linux. The generated project's
Makefile requires make, gcc with C11 support, and a Unix-like shell because it
uses commands such as mkdir -p and rm -rf. These are commonly available on
Linux and macOS. On Windows, use WSL or a compatible environment such as MSYS2
with the required tools installed.
Commands
Open the Command Palette and run one of these commands:
CPS: Initialize C Project creates src/main.c, include/, build/, a C11 Makefile, and .gitignore in the active workspace folder. If any target already exists, choose Overwrite, Merge, or cancel. Merge keeps existing files and adds the required build/ and app ignore entries when needed.
CPS: Create Source File creates src/<name>.c.
CPS: Create Header File creates include/<name>.h with an include guard.
CPS: Create Source & Header Pair creates both files and includes the header by filename in the source.
CPS: Switch Source / Header opens the matching counterpart when it exists.
Names may include the expected .c or .h extension. File paths and traversal names are rejected. Creating a file that already exists prompts before replacing it.
Development
Run the focused unit tests with npm test. The extension uses the VS Code API and Node.js built-in modules at runtime, with no external runtime dependencies. The tests use Node's built-in test runner.