@chengzhao-dev/dsh-cpp-workflow 0.7.5 → 0.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +5 -9
- package/README.md +5 -9
- package/package.json +1 -1
- package/skills/building-cpp/assets/config/.clang-format +27 -3
- package/skills/building-cpp/assets/templates/projects/common/running-build.sh +45 -50
- package/skills/building-cpp/assets/templates/projects/multi/CMakeLists.txt +5 -5
- package/skills/building-cpp/assets/templates/projects/shared-library/CMakeLists.txt +8 -9
- package/skills/building-cpp/assets/templates/projects/shared-library/greeting/CMakeLists.txt +8 -8
- package/skills/building-cpp/assets/templates/projects/single/CMakeLists.txt +3 -3
- package/skills/building-cpp/assets/templates/projects/static-library/CMakeLists.txt +4 -4
- package/skills/building-cpp/assets/templates/projects/static-library/greeting/CMakeLists.txt +8 -8
- package/skills/building-cpp/references/01-build-script.md +1 -1
- package/skills/building-cpp/steps/02-tooling.md +2 -2
- package/skills/building-cpp/steps/04-vscode.md +1 -1
- package/skills/developing-cpp/SKILL.md +7 -3
- package/skills/developing-cpp/references/comments/01-comment-rules.md +15 -1
- package/skills/developing-cpp/references/comments/02-style.md +5 -5
- package/skills/developing-cpp/references/comments/examples/11-declaration-constant.md +26 -0
- package/skills/developing-cpp/references/design/02-raii.md +42 -0
- package/skills/developing-cpp/references/design/03-third-party.md +35 -0
- package/skills/developing-cpp/references/design/examples/09-option-menu.md +36 -0
- package/skills/developing-cpp/references/design/session-layer.md +16 -13
- package/skills/developing-cpp/references/index.md +7 -3
- package/skills/developing-cpp/references/language/language-basics/02-initialization.md +3 -3
- package/skills/developing-cpp/references/language/value-types/04-enum.md +3 -3
- package/skills/developing-cpp/references/layout/03-declaration-order.md +9 -1
- package/skills/developing-cpp/references/style/01-google-cpp-style.md +3 -3
- package/skills/developing-cpp/scripts/checking-comments.mjs +54 -4
- package/skills/developing-cpp/scripts/checking-declaration-order.mjs +214 -13
- package/skills/developing-cpp/steps/03-declaration.md +3 -3
- package/skills/developing-cpp/steps/04-implementation.md +2 -2
- package/skills/engineering/SKILL.md +6 -6
- package/skills/engineering/references/cmake/assets/CompileSettings.cmake +152 -123
- package/skills/engineering/references/cmake/assets/LinkSettings.cmake +62 -43
- package/skills/engineering/references/cmake/modules/01-functions.md +24 -15
- package/skills/engineering/references/cmake/standards/01-cxx-standard.md +2 -2
- package/skills/engineering/references/cmake/standards/c++11/cmake-snippet.cmake +3 -3
- package/skills/engineering/references/cmake/standards/c++14/cmake-snippet.cmake +3 -3
- package/skills/engineering/references/cmake/standards/c++17/cmake-snippet.cmake +3 -3
- package/skills/engineering/references/cmake/standards/c++20/cmake-snippet.cmake +3 -3
- package/skills/engineering/references/cmake/standards/c++23/cmake-snippet.cmake +3 -3
- package/skills/engineering/references/cmake/standards/examples/01-standard.md +1 -1
- package/skills/engineering/references/cmake/standards/index.md +3 -3
- package/skills/engineering/references/cmake/targets/01-target-rules.md +47 -33
- package/skills/engineering/references/cmake/targets/examples/01-rpath.md +1 -1
- package/skills/engineering/references/formatting/02-clang-format.md +4 -2
- package/skills/engineering/references/formatting/examples/01-clang-format.md +13 -4
- package/skills/engineering/references/index.md +4 -4
- package/skills/engineering/steps/01-targets.md +5 -5
- package/skills/engineering/steps/02-modules.md +8 -5
- package/skills/engineering/steps/03-check.md +2 -1
- package/templates/cpp-workflow-project/SKILL.md +1 -1
|
@@ -16,8 +16,11 @@
|
|
|
16
16
|
|
|
17
17
|
- 一个文件放一组语义相近的函数,不为每个函数建单独文件;文件过大或出现无关职责时再拆。
|
|
18
18
|
- 文件名用 UpperCamelCase,按职责命名,例如 `CompileSettings.cmake`、`LinkSettings.cmake`。
|
|
19
|
-
- 函数名用
|
|
20
|
-
|
|
19
|
+
- 函数名用 snake_case,按“动词 + 对象”直接描述动作,例如
|
|
20
|
+
`set_target_cxx_standard`、`set_target_warnings`、`set_output_directories`;
|
|
21
|
+
不要机械重复模块名。CMake 没有命名空间,函数全局可见;确有重名风险时
|
|
22
|
+
再加短项目前缀,而不是完整模块名。
|
|
23
|
+
- 工程自己新增、不准备回流的函数同样先取动作名;与外部模块可能冲突时再加短项目前缀,例如 `my_project_do_something`。
|
|
21
24
|
- 模块开头写 `include_guard(GLOBAL)`,避免重复导入时重定义函数。
|
|
22
25
|
|
|
23
26
|
## 导入
|
|
@@ -26,12 +29,12 @@
|
|
|
26
29
|
|
|
27
30
|
## 契约
|
|
28
31
|
|
|
29
|
-
-
|
|
32
|
+
- 公开函数上方写官方文档块:`#[=======================================================================[.rst:` 开头,模块名与 `---` 标题线,命令用 `.. command::`,签名用 `.. code-block:: cmake`,块内散文写中文。
|
|
30
33
|
- 完整写法见 `../references/cmake/targets/01-target-rules.md`;签名留在 `function()` 那一行。
|
|
31
34
|
- 签名、警告等级与错误消息以 `../references/cmake/assets/` 和 `../references/cmake/modules/01-functions.md` 为准;本步不复制第二份。
|
|
32
|
-
- 普通函数只改传入 target 的属性,不写全局变量、不读环境变量、不下载依赖;唯一例外是 `
|
|
35
|
+
- 普通函数只改传入 target 的属性,不写全局变量、不读环境变量、不下载依赖;唯一例外是 `fetch_googletest`,只在测试需要时调用。
|
|
33
36
|
- 先校验 target、可见性与标准,再调用 `target_*` 或 `set_target_properties`;失败用 `FATAL_ERROR`,消息带函数名与非法值。
|
|
34
37
|
|
|
35
38
|
## 退出
|
|
36
39
|
|
|
37
|
-
模块可被根文件导入且函数签名稳定后,进 `03-check.md` 跑 configure、构建与数据库核对。排版、
|
|
40
|
+
模块可被根文件导入且函数签名稳定后,进 `03-check.md` 跑 configure、构建与数据库核对。排版、tab(宽 4 列)、120 列与文档块形态按 `../references/cmake/targets/01-target-rules.md`。
|
|
@@ -23,7 +23,8 @@ GCC 模式把目录和编译器换成 `build/gcc`、`g++`。每次检查都重
|
|
|
23
23
|
- **标准**:读 `build/clang/compile_commands.json` 中每个 target 的 `-std=`;每个 target 只能有一条,必须与 `environment.json` 的 `standard` 一致,不能是 `gnu++NN` 或更高默认标准,不同值即失败。
|
|
24
24
|
- **没有全局污染**:全仓搜索 `include_directories`、`add_definitions`、`CMAKE_CXX_FLAGS`、`file(GLOB`,命中就回第 1 步。
|
|
25
25
|
- **模块导入**:根 `CMakeLists.txt` 只导入一次;函数名与文件名可追溯;删除旧模块后没有残留 `include()`。
|
|
26
|
-
- **排版**:`CMakeLists.txt` 与 `*.cmake`
|
|
26
|
+
- **排版**:`CMakeLists.txt` 与 `*.cmake` 缩进只用 tab(宽 4 列),行内对齐用空格,UTF-8 无 BOM、LF;抽查 120 列(中文按 2 列计)以上的行是否有必要。
|
|
27
|
+
- **文档块**:每个模块文件开头有 `#[=` 文档块与 `.. command::`,块内散文写中文,签名留在 `function()` 那一行。
|
|
27
28
|
- **产物位置**:可执行文件在 `build/<compiler>/bin`,库在 `build/<compiler>/lib`;源码目录没有新增构建产物。
|
|
28
29
|
- **产物可加载**:对 `build/<compiler>/bin/app` 跑 `file` 与 `ldd`(macOS 用 `otool -L`),不得出现 `not found`;出现缺失按 RPATH 回第 1 步。启动检查由 `building-cpp` 的入口命令负责。见 `../references/cmake/linking/04-inspect.md`。
|
|
29
30
|
|
|
@@ -39,7 +39,7 @@ metadata:
|
|
|
39
39
|
- CTest 在工程内注册并运行;仓库根不构建、不注册测试。
|
|
40
40
|
- 头文件用路径式包含守卫,不用 `#pragma once`。
|
|
41
41
|
- 命名按 Google C++ 风格与工程白名单执行;谓词用 `Is/Has/Can/Completes` 等肯定式。
|
|
42
|
-
- 标准与警告由 `cmake/CompileSettings.cmake` 的 `
|
|
42
|
+
- 标准与警告由 `cmake/CompileSettings.cmake` 的 `compile_settings_set_cxx_standard`、`compile_settings_set_warnings` 统一施加;`environment.json` 的 `standard` 与 `.clang-format` 同步。
|
|
43
43
|
- 每个可独立构建、运行的程序一个工程;共享库等第二个真实使用方出现、语义稳定后再抽。
|
|
44
44
|
- 阶段表、代码目录与文档章节保持对齐;没有阶段表时只写用户点名的行为。
|
|
45
45
|
|