luban new
Scaffold a new C++ project.
Synopsis
luban new {app|lib} <name> [--at <dir>] [--no-build]
What you get
<name>/
├── CMakeLists.txt # 4 lines, user-owned
├── luban.cmake # luban-managed; GIT-TRACKED
├── vcpkg.json # {"name":"<name>","version":"0.1.0","dependencies":[]}
├── vcpkg-configuration.json # baseline pinned to specific vcpkg commit
├── CMakePresets.json # Ninja, with vcpkg toolchain when VCPKG_ROOT set
├── compile_commands.json # generated by initial build, used by clangd
├── .gitignore # build/, vcpkg_installed/, .cache/, .vs/
├── .clang-format
├── .clang-tidy
├── .vscode/
└── src/
└── <name>/
├── CMakeLists.txt # 2 lines: add_executable + luban_apply
└── main.cpp # std::println("hello from <name>!");
What luban new runs
- Validates the project name (lowercase, digits,
-,_; must start with a letter) - Copies the template tree to
<at>/<name>/, expanding{{name}}placeholders in both file names and contents - Auto-runs
luban buildonce unless--no-buildis passed. This producescompile_commands.jsonso clangd works the moment you open the project in Neovim or VS Code.
Flags
| Flag | Effect |
|---|---|
--at <dir> | Parent directory for the new project (default: cwd) |
--no-build | Skip the initial build (faster scaffold; clangd will be unhappy until you luban build manually) |
After luban new
cd <name>
nvim src/<name>/main.cpp # clangd attached, autocomplete works
For lib: same scaffold for now (we don't differentiate lib vs app extensively yet); luban target add lib mylib is the proper way to add a library target to an existing project.