@chengzhao-dev/dsh-cpp-workflow 0.6.16 → 0.6.20

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.
Files changed (156) hide show
  1. package/README.en.md +7 -7
  2. package/README.md +7 -7
  3. package/lib/client.js +1 -1
  4. package/lib/comment-policy.js +1 -1
  5. package/lib/index.js +1 -1
  6. package/package.json +3 -3
  7. package/skills/building-cpp/SKILL.md +29 -16
  8. package/skills/building-cpp/project/vscode/01-extensions.md +22 -0
  9. package/skills/building-cpp/project/vscode/02-settings.md +33 -0
  10. package/skills/building-cpp/references/build-script.md +6 -6
  11. package/skills/building-cpp/references/environment.md +1 -1
  12. package/skills/building-cpp/steps/01-build.md +6 -6
  13. package/skills/building-cpp/steps/02-tooling.md +16 -8
  14. package/skills/building-cpp/steps/03-check.md +6 -6
  15. package/skills/developing-cpp/SKILL.md +37 -13
  16. package/skills/developing-cpp/scripts/checking-comments.mjs +33 -6
  17. package/skills/developing-cpp/{references/change-model.md → source/01-editing/01-edit-operations.md} +27 -9
  18. package/skills/developing-cpp/{references/priority.md → source/01-editing/02-rule-priority.md} +1 -1
  19. package/skills/developing-cpp/{references/google-cpp-style.md → source/02-style/01-google-cpp-style.md} +10 -9
  20. package/skills/developing-cpp/{references/project-design.md → source/03-design/01-project-design.md} +12 -5
  21. package/skills/developing-cpp/source/03-design/examples/behavior-sentence.md +14 -0
  22. package/skills/developing-cpp/source/03-design/examples/coordinate-table.md +31 -0
  23. package/skills/developing-cpp/source/03-design/examples/header-place.md +26 -0
  24. package/skills/developing-cpp/source/03-design/examples/library-boundary.md +30 -0
  25. package/skills/developing-cpp/source/03-design/examples/library-split.md +7 -0
  26. package/skills/developing-cpp/source/03-design/examples/move-result.md +39 -0
  27. package/skills/developing-cpp/source/03-design/examples/preview-read.md +40 -0
  28. package/skills/developing-cpp/{references/layout.md → source/04-layout/01-source-layout.md} +4 -4
  29. package/skills/developing-cpp/{references/file-template.md → source/04-layout/02-file-template.md} +2 -2
  30. package/skills/developing-cpp/{references/declaration-order.md → source/04-layout/03-declaration-order.md} +4 -4
  31. package/skills/developing-cpp/source/05-language/01-language-basics/01-objects.md +9 -0
  32. package/skills/developing-cpp/source/05-language/01-language-basics/02-initialization.md +19 -0
  33. package/skills/developing-cpp/source/05-language/01-language-basics/03-deduction.md +6 -0
  34. package/skills/developing-cpp/source/05-language/01-language-basics/04-const.md +15 -0
  35. package/skills/developing-cpp/source/05-language/01-language-basics/05-expressions.md +8 -0
  36. package/skills/developing-cpp/source/05-language/01-language-basics/06-functions.md +9 -0
  37. package/skills/developing-cpp/source/05-language/01-language-basics/07-classes.md +9 -0
  38. package/skills/developing-cpp/source/05-language/01-language-basics/08-raii.md +9 -0
  39. package/skills/developing-cpp/source/05-language/01-language-basics/09-templates.md +20 -0
  40. package/skills/developing-cpp/source/05-language/01-language-basics/10-checklist.md +9 -0
  41. package/skills/developing-cpp/source/05-language/02-value-types/01-width.md +11 -0
  42. package/skills/developing-cpp/source/05-language/02-value-types/02-signed.md +20 -0
  43. package/skills/developing-cpp/source/05-language/02-value-types/03-integer-roles.md +23 -0
  44. package/skills/developing-cpp/source/05-language/02-value-types/04-enum.md +17 -0
  45. package/skills/developing-cpp/source/05-language/02-value-types/05-strong-type.md +17 -0
  46. package/skills/developing-cpp/source/05-language/02-value-types/06-const-method.md +17 -0
  47. package/skills/developing-cpp/source/05-language/02-value-types/07-nodiscard.md +9 -0
  48. package/skills/developing-cpp/source/05-language/02-value-types/08-comparison.md +4 -0
  49. package/skills/developing-cpp/source/05-language/02-value-types/09-subscript.md +14 -0
  50. package/skills/developing-cpp/source/05-language/02-value-types/10-float-bool.md +7 -0
  51. package/skills/developing-cpp/source/05-language/02-value-types/11-checklist.md +8 -0
  52. package/skills/developing-cpp/source/05-language/03-standard-library/01-containers.md +23 -0
  53. package/skills/developing-cpp/source/05-language/03-standard-library/02-access.md +8 -0
  54. package/skills/developing-cpp/source/05-language/03-standard-library/03-iteration.md +12 -0
  55. package/skills/developing-cpp/source/05-language/03-standard-library/04-algorithms.md +20 -0
  56. package/skills/developing-cpp/source/05-language/03-standard-library/05-string.md +7 -0
  57. package/skills/developing-cpp/source/05-language/03-standard-library/06-format.md +44 -0
  58. package/skills/developing-cpp/source/05-language/03-standard-library/07-time.md +3 -0
  59. package/skills/developing-cpp/source/05-language/03-standard-library/08-random.md +3 -0
  60. package/skills/developing-cpp/source/05-language/03-standard-library/09-files.md +4 -0
  61. package/skills/developing-cpp/source/05-language/03-standard-library/10-checklist.md +9 -0
  62. package/skills/developing-cpp/source/05-language/04-performance/01-measure.md +15 -0
  63. package/skills/developing-cpp/source/05-language/04-performance/02-complexity.md +7 -0
  64. package/skills/developing-cpp/source/05-language/04-performance/03-memory.md +8 -0
  65. package/skills/developing-cpp/source/05-language/04-performance/04-undefined-behavior.md +20 -0
  66. package/skills/developing-cpp/source/05-language/04-performance/05-pitfalls.md +11 -0
  67. package/skills/developing-cpp/source/05-language/04-performance/06-false-optimizations.md +6 -0
  68. package/skills/developing-cpp/source/05-language/04-performance/07-checklist.md +8 -0
  69. package/skills/developing-cpp/{references/glossary.md → source/05-language/glossary/language-terms.md} +2 -2
  70. package/skills/developing-cpp/{references/naming.md → source/06-naming/01-identifier-names.md} +8 -3
  71. package/skills/developing-cpp/source/06-naming/examples/naming-accessor.md +17 -0
  72. package/skills/developing-cpp/source/06-naming/examples/naming-basic.md +3 -0
  73. package/skills/developing-cpp/source/06-naming/examples/naming-current-prefix.md +19 -0
  74. package/skills/developing-cpp/source/06-naming/examples/naming-lookup.md +18 -0
  75. package/skills/developing-cpp/source/06-naming/examples/naming-lower-layer.md +39 -0
  76. package/skills/developing-cpp/source/06-naming/examples/naming-multiple-return.md +20 -0
  77. package/skills/developing-cpp/source/06-naming/examples/naming-player-mark.md +17 -0
  78. package/skills/developing-cpp/source/06-naming/examples/naming-predicate.md +18 -0
  79. package/skills/developing-cpp/source/06-naming/examples/naming-rename.md +5 -0
  80. package/skills/developing-cpp/source/06-naming/examples/naming-responsibility.md +19 -0
  81. package/skills/developing-cpp/source/06-naming/examples/naming-role.md +21 -0
  82. package/skills/developing-cpp/source/06-naming/examples/naming-state-change.md +57 -0
  83. package/skills/developing-cpp/{references/comments.md → source/07-comments/01-comment-rules.md} +55 -32
  84. package/skills/developing-cpp/source/07-comments/examples/declaration-class.md +44 -0
  85. package/skills/developing-cpp/source/07-comments/examples/declaration-constructor.md +22 -0
  86. package/skills/developing-cpp/source/07-comments/examples/declaration-enum.md +24 -0
  87. package/skills/developing-cpp/source/07-comments/examples/declaration-file.md +66 -0
  88. package/skills/developing-cpp/source/07-comments/examples/declaration-function.md +100 -0
  89. package/skills/developing-cpp/source/07-comments/examples/declaration-member.md +25 -0
  90. package/skills/developing-cpp/source/07-comments/examples/declaration-predicate.md +13 -0
  91. package/skills/developing-cpp/source/07-comments/examples/declaration-struct.md +18 -0
  92. package/skills/developing-cpp/source/07-comments/examples/implementation-body.md +42 -0
  93. package/skills/developing-cpp/source/07-comments/examples/implementation-todo.md +16 -0
  94. package/skills/developing-cpp/source/07-comments/glossary/comment-terms.md +75 -0
  95. package/skills/developing-cpp/{references/exceptions.md → source/08-exceptions/01-throw-rules.md} +46 -8
  96. package/skills/developing-cpp/source/08-exceptions/examples/throw-boundary.md +28 -0
  97. package/skills/developing-cpp/source/08-exceptions/examples/throw-build-mode.md +38 -0
  98. package/skills/developing-cpp/source/08-exceptions/examples/throw-catch.md +21 -0
  99. package/skills/developing-cpp/source/08-exceptions/examples/throw-destructor.md +21 -0
  100. package/skills/developing-cpp/source/08-exceptions/examples/throw-format.md +13 -0
  101. package/skills/developing-cpp/source/08-exceptions/examples/throw-message.md +17 -0
  102. package/skills/developing-cpp/source/08-exceptions/examples/throw-when.md +27 -0
  103. package/skills/developing-cpp/steps/01-behavior.md +5 -5
  104. package/skills/developing-cpp/steps/02-boundary.md +9 -9
  105. package/skills/developing-cpp/steps/03-declaration.md +11 -10
  106. package/skills/developing-cpp/steps/04-implementation.md +15 -13
  107. package/skills/engineering/SKILL.md +84 -0
  108. package/skills/{configuring-cmake/references/cmake.md → engineering/cmake/01-targets/01-rules.md} +3 -3
  109. package/skills/engineering/cmake/01-targets/examples/glob.md +22 -0
  110. package/skills/engineering/cmake/01-targets/examples/rpath.md +24 -0
  111. package/skills/{configuring-cmake/examples/cmake.md → engineering/cmake/01-targets/examples/target.md} +1 -69
  112. package/skills/{configuring-cmake/references/modules.md → engineering/cmake/02-modules/01-functions.md} +2 -2
  113. package/skills/{configuring-cmake/references/cxx-standard.md → engineering/cmake/03-standard/01-cxx-standard.md} +1 -1
  114. package/skills/engineering/cmake/03-standard/examples/standard.md +19 -0
  115. package/skills/{building-cpp/references → engineering/cmake/03-standard}/standards/README.md +6 -6
  116. package/skills/{building-cpp/references → engineering/cmake/03-standard}/standards/c++20/README.md +1 -1
  117. package/skills/{building-cpp/references/linking.md → engineering/cmake/linking/01-libraries.md} +1 -48
  118. package/skills/engineering/cmake/linking/02-rpath.md +17 -0
  119. package/skills/engineering/cmake/linking/03-undefined-reference.md +14 -0
  120. package/skills/engineering/cmake/linking/04-inspect.md +15 -0
  121. package/skills/{configuring-cmake → engineering/cmake}/steps/01-targets.md +3 -3
  122. package/skills/{configuring-cmake → engineering/cmake}/steps/02-modules.md +2 -2
  123. package/skills/{configuring-cmake → engineering/cmake}/steps/03-check.md +2 -2
  124. package/skills/{building-cpp/references/testing.md → engineering/cmake/testing/ctest.md} +3 -3
  125. package/skills/engineering/formatting/02-clang-format.md +14 -0
  126. package/skills/engineering/formatting/03-clang-tidy.md +51 -0
  127. package/skills/engineering/formatting/04-clangd.md +83 -0
  128. package/skills/engineering/formatting/examples/clang-format.md +17 -0
  129. package/skills/engineering/formatting/examples/clang-tidy.md +64 -0
  130. package/skills/{building-cpp/examples/tooling.md → engineering/formatting/examples/clangd.md} +1 -80
  131. package/templates/cpp-workflow-project/SKILL.md +34 -4
  132. package/skills/building-cpp/references/static-analysis.md +0 -148
  133. package/skills/configuring-cmake/SKILL.md +0 -68
  134. package/skills/developing-cpp/examples/comments-declaration.md +0 -313
  135. package/skills/developing-cpp/examples/comments-implementation.md +0 -66
  136. package/skills/developing-cpp/examples/exceptions.md +0 -173
  137. package/skills/developing-cpp/examples/naming.md +0 -150
  138. package/skills/developing-cpp/examples/structure.md +0 -155
  139. package/skills/developing-cpp/references/comment-terms.md +0 -65
  140. package/skills/developing-cpp/references/language.md +0 -121
  141. package/skills/developing-cpp/references/performance.md +0 -83
  142. package/skills/developing-cpp/references/standard-library.md +0 -101
  143. package/skills/developing-cpp/references/types.md +0 -154
  144. /package/skills/{building-cpp/references → engineering/cmake/03-standard}/standards/c++11/README.md +0 -0
  145. /package/skills/{building-cpp/references → engineering/cmake/03-standard}/standards/c++11/cmake-snippet.cmake +0 -0
  146. /package/skills/{building-cpp/references → engineering/cmake/03-standard}/standards/c++14/README.md +0 -0
  147. /package/skills/{building-cpp/references → engineering/cmake/03-standard}/standards/c++14/cmake-snippet.cmake +0 -0
  148. /package/skills/{building-cpp/references → engineering/cmake/03-standard}/standards/c++17/README.md +0 -0
  149. /package/skills/{building-cpp/references → engineering/cmake/03-standard}/standards/c++17/cmake-snippet.cmake +0 -0
  150. /package/skills/{building-cpp/references → engineering/cmake/03-standard}/standards/c++20/cmake-snippet.cmake +0 -0
  151. /package/skills/{building-cpp/references → engineering/cmake/03-standard}/standards/c++23/README.md +0 -0
  152. /package/skills/{building-cpp/references → engineering/cmake/03-standard}/standards/c++23/cmake-snippet.cmake +0 -0
  153. /package/skills/{configuring-cmake/assets/cmake → engineering/cmake/assets}/CompileSettings.cmake +0 -0
  154. /package/skills/{configuring-cmake/assets/cmake → engineering/cmake/assets}/LinkSettings.cmake +0 -0
  155. /package/skills/{building-cpp/references/encoding.md → engineering/formatting/01-encoding.md} +0 -0
  156. /package/skills/{building-cpp → engineering/formatting}/scripts/checking-encoding.mjs +0 -0
package/README.en.md CHANGED
@@ -9,7 +9,7 @@ Three skills for C++11–C++23 source, CMake, and build work; new projects defau
9
9
  | Skill | Covers | Open it when |
10
10
  | --- | --- | --- |
11
11
  | `developing-cpp` | Behavior, boundaries, declarations, implementation; naming, exceptions, and source comments in `.h` / `.cpp` / `.cc` | The user names source code, or the work is a new project or whole-stage refactor |
12
- | `configuring-cmake` | Targets, modules, checks; CMakeLists.txt, `cmake/` functions and modules, target properties, C++11–C++23 standards, 2-space layout | The change touches CMake targets, standards, link boundaries, functions, or modules |
12
+ | `engineering` | Targets, modules, checks; CMakeLists.txt, `cmake/` functions and modules, target properties, C++11–C++23 standards, and `.clang-format`/`.clang-tidy`/`.clangd` configuration | The change touches CMake targets, standards, link boundaries, functions, modules, or encoding and clang tooling configuration |
13
13
  | `building-cpp` | Build setup, tool configuration, checks; Ninja, Clang config, build scripts, environment combinations, formatting, and static analysis | The change touches build commands, tool config, or the environment declaration, or the project is first connected to a build |
14
14
 
15
15
  The exception material follows the C++ Core Guidelines' Error handling section and guides source and examples only during development; the plugin runtime never compiles or executes those rules. All three skills read the project skill `cpp-workflow-project` first. Without it, the workspace gate never exposes these names.
@@ -19,13 +19,13 @@ The exception material follows the C++ Core Guidelines' Error handling section a
19
19
  Pinned npm install:
20
20
 
21
21
  ```bash
22
- dsh plugin --profile web add npm:@chengzhao-dev/dsh-cpp-workflow@0.6.16
22
+ dsh plugin --profile web add npm:@chengzhao-dev/dsh-cpp-workflow@0.6.20
23
23
  ```
24
24
 
25
25
  The matching Git tag:
26
26
 
27
27
  ```bash
28
- dsh plugin --profile web add github:chengzhao-dev/dsh-cpp-workflow#v0.6.16
28
+ dsh plugin --profile web add github:chengzhao-dev/dsh-cpp-workflow#v0.6.20
29
29
  ```
30
30
 
31
31
  The desktop app owns the `desktop` profile. If the command-line `add` is rejected, add the plugin in the app settings and use the same pinned npm version. A Git tag install uses the prebuilt `lib/` committed in the repository and runs no build on the target machine; the package has no install script that needs approval.
@@ -42,11 +42,11 @@ Only one condition must hold before either skill appears: walking up from the cu
42
42
 
43
43
  The project skill marker is the repository's opt-in declaration. The plugin no longer requires a first-party `CMakeLists.txt` or C++ source file in the same repository: a docs-only repository, a repository that only copied the template, or a repository with no source files yet still matches; with an empty environment axis, the four source steps still work but build setup stops. Without the marker the list is empty, even when the repository contains CMake or `.cpp` files. Scan limits and boundary cases are in [docs/plugin-boundaries.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/plugin-boundaries.md).
44
44
 
45
- The packaged skills use rank 550. A project `.agents/skills` skill uses rank 200 and overrides a plugin skill with the same name; do not copy `developing-cpp`, `configuring-cmake`, or `building-cpp` into a project.
45
+ The packaged skills use rank 550. A project `.agents/skills` skill uses rank 200 and overrides a plugin skill with the same name; do not copy `developing-cpp`, `engineering`, or `building-cpp` into a project.
46
46
 
47
47
  ## Project conventions
48
48
 
49
- Copy [templates/cpp-workflow-project](templates/cpp-workflow-project) into the target repository's `.agents/skills/` directory, keeping the `cpp-workflow-project` directory name. Add only files that do not exist; do not overwrite existing source, `CMakeLists.txt`, or `.clang-*` files. The project skill records only facts that cannot be inferred from the source:
49
+ Copy [templates/cpp-workflow-project](templates/cpp-workflow-project) into the target repository's `.agents/skills/` directory, keeping the `cpp-workflow-project` directory name. Add only files that do not exist; do not overwrite existing source, `CMakeLists.txt`, or `.clang-*` files. The project skill records project-specific facts; the template's "common workflow conventions" carry the shared workflow, editor, and completion rules, so the project skill does not repeat them:
50
50
 
51
51
  - project and component names, source root;
52
52
  - library/program boundary and public header location;
@@ -64,7 +64,7 @@ Keep one `environment.json` per repository. Its first three environment axes are
64
64
  | `compiler` | `clang`, `gcc` | One compiler per configuration |
65
65
  | `standard` | `c++11`, `c++14`, `c++17`, `c++20`, `c++23` | New projects default to `c++23`; one standard per project |
66
66
 
67
- The standard lives in `environment.json` as `standard` and must match the CMake target and compile database; on the CMake side, prefer `configuring-cmake`'s `CompileSettings_SetCxxStandard` function. New projects default to C++23; for C++11–C++20, lower `standard`, `cxx_std_*`, `CXX_STANDARD`, and the `.clang-format` parsing level together, not one at a time. Per-standard facilities, tooling, and downgrade tables are in the [standard directory](skills/building-cpp/references/standards/README.md); the CMake two-layer declaration is in [cxx-standard.md](skills/configuring-cmake/references/cxx-standard.md).
67
+ The standard lives in `environment.json` as `standard` and must match the CMake target and compile database; on the CMake side, prefer `engineering`'s `CompileSettings_SetCxxStandard` function. New projects default to C++23; for C++11–C++20, lower `standard`, `cxx_std_*`, `CXX_STANDARD`, and the `.clang-format` parsing level together, not one at a time. Per-standard facilities, tooling, and downgrade tables are in the [standard directory](skills/engineering/cmake/03-standard/standards/README.md); the CMake two-layer declaration is in [cxx-standard.md](skills/engineering/cmake/03-standard/01-cxx-standard.md).
68
68
 
69
69
  The generator is always Ninja. Build directories are `build/clang/` and `build/gcc/`; they are never shared. Analysis tools are always `clang-format`, `clang-tidy`, and `clangd`; GCC mode does not switch to another analyzer.
70
70
 
@@ -84,7 +84,7 @@ The project root carries only `.vscode/extensions.json` and `settings.json`: cla
84
84
  ```text
85
85
  dsh-cpp-workflow/
86
86
  ├── lib/ # build output, shipped in the npm package
87
- ├── skills/ # developing-cpp, configuring-cmake, and building-cpp
87
+ ├── skills/ # developing-cpp, engineering, and building-cpp
88
88
  ├── templates/ # empty project template to copy
89
89
  ├── package.json
90
90
  ├── package-lock.json # repository only, used by npm ci
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  | 技能 | 管什么 | 什么时候打开 |
10
10
  | --- | --- | --- |
11
11
  | `developing-cpp` | 定行为、定边界、定声明、定实现;`.h` / `.cpp` / `.cc` 的命名、异常和源码注释 | 用户点名源码,或需要新建/整段重构源码 |
12
- | `configuring-cmake` | 定 target、定模块、通过检查;CMakeLists.txt、`cmake/` 函数与模块、target 属性、C++11–C++23 标准、2 空格排版 | 改动落在 CMake target、标准、链接边界、函数或模块上 |
12
+ | `engineering` | 定 target、定模块、通过检查;CMakeLists.txt、`cmake/` 函数与模块、target 属性、C++11–C++23 标准,以及 `.clang-format`/`.clang-tidy`/`.clangd` 配置 | 改动落在 CMake target、标准、链接边界、函数或模块,或落在编码与 clang 工具配置上 |
13
13
  | `building-cpp` | 定构建、定工具配置、通过检查;Ninja、Clang 配置、构建脚本、环境组合、格式化与静态检查 | 改动落在构建命令、工具配置或环境声明上,或第一次接构建 |
14
14
 
15
15
  异常条文采用 C++ Core Guidelines 的 Error handling,只在开发阶段指导源码和示例;插件运行时不编译、不执行这些规则。三个技能都先读项目技能 `cpp-workflow-project`。没有项目技能时,门禁不会放出这三个名字。
@@ -19,13 +19,13 @@
19
19
  npm 安装钉死版本:
20
20
 
21
21
  ```bash
22
- dsh plugin --profile web add npm:@chengzhao-dev/dsh-cpp-workflow@0.6.16
22
+ dsh plugin --profile web add npm:@chengzhao-dev/dsh-cpp-workflow@0.6.20
23
23
  ```
24
24
 
25
25
  同版本的 Git 标签:
26
26
 
27
27
  ```bash
28
- dsh plugin --profile web add github:chengzhao-dev/dsh-cpp-workflow#v0.6.16
28
+ dsh plugin --profile web add github:chengzhao-dev/dsh-cpp-workflow#v0.6.20
29
29
  ```
30
30
 
31
31
  桌面应用独占 `desktop` profile。命令行 `add` 被拒绝时,在应用设置里添加插件,地址填同一个 npm 版本。Git 标签安装使用仓库内已构建的 `lib/`,不在目标机器上重新构建;包内也不含需要授权执行的安装脚本。
@@ -42,11 +42,11 @@ dsh plugin --profile web add github:chengzhao-dev/dsh-cpp-workflow#v0.6.16
42
42
 
43
43
  项目技能标记就是仓库选择加入本工作流的声明。插件不再要求同一仓库里已经有第一方 `CMakeLists.txt` 或 C++ 源文件:纯文档仓库、只复制了模板、还没有任何源文件的仓库也会出现;环境轴为空时,源码四步仍能做,但定构建会停。没有标记就返回空列表,即使仓库里有 CMake 或 `.cpp`。扫描上限和边界情形见 [docs/plugin-boundaries.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/plugin-boundaries.md)。
44
44
 
45
- 插件技能 rank 550。项目自己的 `.agents/skills` 技能 rank 200,会以同名覆盖插件;不要在项目里复制 `developing-cpp`、`configuring-cmake` 或 `building-cpp`。
45
+ 插件技能 rank 550。项目自己的 `.agents/skills` 技能 rank 200,会以同名覆盖插件;不要在项目里复制 `developing-cpp`、`engineering` 或 `building-cpp`。
46
46
 
47
47
  ## 项目级约定
48
48
 
49
- 把 [templates/cpp-workflow-project](templates/cpp-workflow-project) 整个复制到目标仓库的 `.agents/skills/` 下,目录名保持 `cpp-workflow-project`;只补还不存在的文件,不覆盖已有的源码、`CMakeLists.txt` 或 `.clang-*`。项目技能只写本工程特有的事实:
49
+ 把 [templates/cpp-workflow-project](templates/cpp-workflow-project) 整个复制到目标仓库的 `.agents/skills/` 下,目录名保持 `cpp-workflow-project`;只补还不存在的文件,不覆盖已有的源码、`CMakeLists.txt` 或 `.clang-*`。项目技能写本工程特有的事实;通用工作流、编辑器与完成判据由模板的「通用工作流约定」承担,不在项目技能里重复:
50
50
 
51
51
  - 工程名、组件名和源码根;
52
52
  - 库与程序的边界、公共头位置;
@@ -64,7 +64,7 @@ dsh plugin --profile web add github:chengzhao-dev/dsh-cpp-workflow#v0.6.16
64
64
  | `compiler` | `clang`、`gcc` | 一次配置一个编译器 |
65
65
  | `standard` | `c++11`、`c++14`、`c++17`、`c++20`、`c++23` | 新工程默认 `c++23`;一个工程一个标准 |
66
66
 
67
- 标准写在 `environment.json` 的 `standard`,并同步到 CMake target 和编译数据库;CMake 侧优先调用 `configuring-cmake` 提供的 `CompileSettings_SetCxxStandard` 函数。新工程默认 C++23;C++11–C++20 工程把 `standard`、`cxx_std_*`、`CXX_STANDARD` 和 `.clang-format` 的解析档位一起降级,不要只改一处。每档的设施、工具和降档表见 [标准目录](skills/building-cpp/references/standards/README.md),CMake 两层声明见 [cxx-standard.md](skills/configuring-cmake/references/cxx-standard.md)。
67
+ 标准写在 `environment.json` 的 `standard`,并同步到 CMake target 和编译数据库;CMake 侧优先调用 `engineering` 提供的 `CompileSettings_SetCxxStandard` 函数。新工程默认 C++23;C++11–C++20 工程把 `standard`、`cxx_std_*`、`CXX_STANDARD` 和 `.clang-format` 的解析档位一起降级,不要只改一处。每档的设施、工具和降档表见 [标准目录](skills/engineering/cmake/03-standard/standards/README.md),CMake 两层声明见 [cxx-standard.md](skills/engineering/cmake/03-standard/01-cxx-standard.md)。
68
68
 
69
69
  生成器固定 Ninja,构建目录是 `build/clang/` 与 `build/gcc/`,不共用 `build/`。诊断工具固定 `clang-format`、`clang-tidy`、`clangd`;GCC 模式也不换成别的分析器。
70
70
 
@@ -84,7 +84,7 @@ node "<skill-dir>/scripts/checking-environment.mjs" --project . --live
84
84
  ```text
85
85
  dsh-cpp-workflow/
86
86
  ├── lib/ # 构建产物,随 npm 包发布
87
- ├── skills/ # developing-cpp、configuring-cmake 与 building-cpp
87
+ ├── skills/ # developing-cpp、engineering 与 building-cpp
88
88
  ├── templates/ # 复制到项目的空模板
89
89
  ├── package.json
90
90
  ├── package-lock.json # 只在仓库,供 npm ci
package/lib/client.js CHANGED
@@ -9,7 +9,7 @@ window.__ModuleLoader__.load({
9
9
  * 注释标签策略:设置页的预览、技能快照与检查器参数共用这一份。
10
10
  *
11
11
  * 配置只描述「写注释时默认带哪些标签、声明用哪种注释符号」,不描述写法本身;
12
- * 写法在 `skills/developing-cpp/references/comments.md`。设置页保存的值由宿主
12
+ * 写法在 `skills/developing-cpp/source/07-comments/01-comment-rules.md`。设置页保存的值由宿主
13
13
  * 写回插件 Config,服务端 `apply(ctx, config)` 用它生成本页快照与检查器参数。
14
14
  *
15
15
  * 这份文件被 `tsc` 编进 `lib/comment-policy.js`,打包客户端半侧时再内联进
@@ -2,7 +2,7 @@
2
2
  * 注释标签策略:设置页的预览、技能快照与检查器参数共用这一份。
3
3
  *
4
4
  * 配置只描述「写注释时默认带哪些标签、声明用哪种注释符号」,不描述写法本身;
5
- * 写法在 `skills/developing-cpp/references/comments.md`。设置页保存的值由宿主
5
+ * 写法在 `skills/developing-cpp/source/07-comments/01-comment-rules.md`。设置页保存的值由宿主
6
6
  * 写回插件 Config,服务端 `apply(ctx, config)` 用它生成本页快照与检查器参数。
7
7
  *
8
8
  * 这份文件被 `tsc` 编进 `lib/comment-policy.js`,打包客户端半侧时再内联进
package/lib/index.js CHANGED
@@ -58,7 +58,7 @@ export const Config = Schema.object({
58
58
  });
59
59
  const PROVIDER = 'dsh-cpp-workflow';
60
60
  const RANK = 550;
61
- const KNOWN_SKILLS = new Set(['building-cpp', 'configuring-cmake', 'developing-cpp']);
61
+ const KNOWN_SKILLS = new Set(['building-cpp', 'engineering', 'developing-cpp']);
62
62
  const SKILL_NAME_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
63
63
  const PACKAGE_ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
64
64
  const SKILLS_ROOT = path.join(PACKAGE_ROOT, 'skills');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chengzhao-dev/dsh-cpp-workflow",
3
- "version": "0.6.16",
3
+ "version": "0.6.20",
4
4
  "description": "写 C++ 源码、配 CMake、用 Clang 构建;头文件用 /// Doxygen 文档注释,函数体用 // 分段说明,文件头标签可在设置里改。",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -51,10 +51,10 @@
51
51
  "icon": "./icon.svg",
52
52
  "scripts": {
53
53
  "build": "tsc -p tsconfig.json && node scripts/building-client.mjs",
54
- "test": "npm run build && node scripts/building-client.mjs --check && node scripts/checking-skill-links.mjs && node skills/building-cpp/scripts/checking-encoding.mjs --quiet && node scripts/checking-github-workflows.mjs && node --test tests/*.test.mjs",
54
+ "test": "npm run build && node scripts/building-client.mjs --check && node scripts/checking-skill-links.mjs && node skills/engineering/formatting/scripts/checking-encoding.mjs --quiet && node scripts/checking-github-workflows.mjs && node --test tests/*.test.mjs",
55
55
  "ci": "npm ci && npm test && npm run pack:check",
56
56
  "ci:full": "npm run ci && npm run test:matrix",
57
- "check:encoding": "node skills/building-cpp/scripts/checking-encoding.mjs",
57
+ "check:encoding": "node skills/engineering/formatting/scripts/checking-encoding.mjs",
58
58
  "check:workflows": "node scripts/checking-github-workflows.mjs",
59
59
  "test:matrix": "bash scripts/checking-standard-matrix.sh",
60
60
  "pack:check": "npm pack --dry-run"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: building-cpp
3
- description: 在已写好 CMake 的 C++11–C++23 工程上配置、构建和检查时使用:Ninja、compile_commands.json、clang-format、clang-tidy、clangd、environment.json 与 running-build.sh。不用于只改源码语义、文档、Python 或与 C++ 无关的文件。
3
+ description: 在已写好 CMake 的 C++11–C++23 工程上配置、构建和检查时使用:Ninja、compile_commands.json、clang-format、clang-tidy、clangd、environment.json、running-build.sh 与工程内已有的 `.vscode/` 接线。不用于只改源码语义、文档、Python 或与 C++ 无关的文件。
4
4
  metadata:
5
5
  short-description: C++11–C++23 构建三步
6
6
  ---
@@ -9,19 +9,21 @@ metadata:
9
9
 
10
10
  ## 适用场景
11
11
 
12
- 本技能处理环境声明、构建入口与工具配置:`environment.json`、`running-build.sh`、`.clang-format`、`.clang-tidy`、`.clangd`、`.vscode/`、构建命令、编译数据库、CTest 和运行。`CMakeLists.txt` 与 `cmake/` 下的 target、属性、标准和模块由 `configuring-cmake` 负责;本技能只读它们来配置和检查,不在这一步改 target 图。函数体、类型、命名、异常和源码注释只开 `developing-cpp`。
12
+ 本技能处理环境声明、构建入口与工具配置:`environment.json`、`running-build.sh`、`.clang-format`、`.clang-tidy`、`.clangd`、`.vscode/`、构建命令、编译数据库、CTest 和运行。`CMakeLists.txt` 与 `cmake/` 下的 target、属性、标准和模块由 `engineering` 负责;本技能只读它们来配置和检查,不在这一步改 target 图。函数体、类型、命名、异常和源码注释只开 `developing-cpp`。
13
13
 
14
- 一次改动同时碰到源码和构建文件时,先打开 `developing-cpp` 定行为、边界与实现;需要新增或移动源文件、改库与程序的边界、补测试 target 时,转到 `configuring-cmake` 把文件写进 CMake;最后回到本技能做定工具配置与通过检查。只改函数体、命名、异常或注释且入口命令可运行时,定实现后只开本技能的「通过检查」。
14
+ 一次改动同时碰到源码和构建文件时,先打开 `developing-cpp` 定行为、边界与实现;需要新增或移动源文件、改库与程序的边界、补测试 target 时,转到 `engineering` 把文件写进 CMake;最后回到本技能做定工具配置与通过检查。只改函数体、命名、异常或注释且入口命令可运行时,定实现后只开本技能的「通过检查」。
15
15
 
16
16
  存在项目技能 `cpp-workflow-project` 时先读它的 `SKILL.md`、`environment.json` 和 `stages/stage-table.md`。三个环境轴为空、`standard` 非法或组合非法时停在定构建,不猜 WSL、Clang 或构建目录;`windows` + `native` 直接拒绝,提示「本版本不能在 Windows 原生壳里构建」,不要给出补 PowerShell 的路线。
17
17
 
18
- 编译失败先分因:诊断指向函数体,回 `developing-cpp` 的定实现;诊断是找不到头、链接失败、target 不存在或标准不对,转 `configuring-cmake` 的对应步骤;诊断是没有编译数据库、format/tidy 不在 PATH 或配置不生效,留在本技能的定工具配置。
18
+ 编译失败先分因:诊断指向函数体,回 `developing-cpp` 的定实现;诊断是找不到头、链接失败、target 不存在或标准不对,转 `engineering` 的对应步骤;诊断是没有编译数据库、format/tidy 不在 PATH 或配置不生效,留在本技能的定工具配置。
19
19
 
20
- 源码和构建文件用 UTF-8 无 BOM、检出 LF;`.bat` / `.cmd` 用 CRLF;`.clang-format` 写 `LineEnding: LF`。MSVC 原生构建优先加 `/utf-8`,不要靠 BOM 过关。完整规则见 `references/encoding.md`,检查脚本是 `scripts/checking-encoding.mjs`,机器规则以仓库根 `.gitattributes` 与 `.editorconfig` 为准。
20
+ 源码和构建文件用 UTF-8 无 BOM、检出 LF;`.bat` / `.cmd` 用 CRLF;`.clang-format` 写 `LineEnding: LF`。MSVC 原生构建优先加 `/utf-8`,不要靠 BOM 过关。完整规则见 `../engineering/formatting/01-encoding.md`,检查脚本是 `../engineering/formatting/scripts/checking-encoding.mjs`,机器规则以仓库根 `.gitattributes` 与 `.editorconfig` 为准。
21
+
22
+ 工程根已有 `.vscode/` 时,扩展与设置按 `project/vscode/` 两页接线;从当前目录向上到 git 根都没有 `.vscode/` 时,不打开、也不新建。编辑器的配置、构建、运行和调试都从 CMake Tools 进入,构建仍以 `running-build.sh` 为准。
21
23
 
22
24
  ## 三种操作
23
25
 
24
- 一次只选一种,范围(单点、整段)是任务属性。操作与域的判据、边界和交接见 `../developing-cpp/references/change-model.md`;四类改动是域,不是操作。
26
+ 一次只选一种,范围(单点、整段)是任务属性。操作与域的判据、边界和交接见 `../developing-cpp/source/01-editing/01-edit-operations.md`;四类改动是域,不是操作。
25
27
 
26
28
  | 操作 | 什么时候用 | 从哪步进 |
27
29
  | --- | --- | --- |
@@ -29,7 +31,7 @@ metadata:
29
31
  | 改写 | 环境轴与 target 契约不变,工具配置位置或流程顺序不对 | 从第 2 步重走,可到第 3 步 |
30
32
  | 润色 | 只改诊断措辞或失败分流说明 | 第 3 步 |
31
33
 
32
- 三种操作共用这些约束:不发明项目没有声明的环境轴、命令和 target;只改格式或配置时不改可观察行为;不覆盖已有源码、`CMakeLists.txt` 和 `.clang-*`;不安装工具链;代理侧不写 `wsl` 或 `bash -lc`。后一步发现前一步没做完,退回那一步。拿不准先用单点修正;发现环境轴、编译器、构建目录或 target 契约需要改,退回整段,并转 `configuring-cmake`。
34
+ 三种操作共用这些约束:不发明项目没有声明的环境轴、命令和 target;只改格式或配置时不改可观察行为;不覆盖已有源码、`CMakeLists.txt` 和 `.clang-*`;不安装工具链;代理侧不写 `wsl` 或 `bash -lc`。后一步发现前一步没做完,退回那一步。拿不准先用单点修正;发现环境轴、编译器、构建目录或 target 契约需要改,退回整段,并转 `engineering`。
33
35
 
34
36
  ## 步骤
35
37
 
@@ -39,34 +41,45 @@ metadata:
39
41
  | 2 | 定工具配置 | `steps/02-tooling.md` | 格式化、静态检查、clangd 各管一段,互不越界 |
40
42
  | 3 | 通过检查 | `steps/03-check.md` | 按编码 → 声明校验 → 活动校验 → 项目入口的次序跑,前一步失败就停 |
41
43
 
42
- 每步只打开同号的一个步骤文件。判不准才打开 `examples/` 里与该步对应的案例;`references/` 保存完整条文,只在排错、整目录重构,或步骤里明确指向某一条文时按需打开。链接、rpath 与产物布局读 `references/linking.md`;测试设计、断言与 CTest 注册读 `references/testing.md`;CMake 的 target、标准和函数写法读 `../configuring-cmake/references/`,可复用片段在 `../configuring-cmake/assets/cmake/`。
44
+ ### 入口表
45
+
46
+ | 要做的事 | 打开 |
47
+ | --- | --- |
48
+ | 读环境轴、配置与构建 | `steps/01-build.md`;条文 `references/environment.md`;案例 `examples/environment.md` |
49
+ | 配 `.clang-format`、`.clang-tidy`、`.clangd` | `steps/02-tooling.md`;条文在 `../engineering/formatting/`,一次一份 |
50
+ | 工程已有 `.vscode/`,接扩展与设置 | `project/vscode/01-extensions.md` 或 `02-settings.md`;没有 `.vscode/` 不打开也不新建 |
51
+ | 编码、声明校验、活动校验与入口命令 | `steps/03-check.md`;条文 `references/build-script.md` |
52
+ | 新工程模板与可复制配置 | `assets/templates/projects/`、`assets/config/` |
53
+
54
+ 每步只打开同号的一个步骤文件。判不准才打开 `examples/` 里与该步对应的案例;`references/` 保存完整条文,只在排错、整目录重构,或步骤里明确指向某一条文时按需打开。链接、rpath 与产物布局读 `../engineering/cmake/linking/01-libraries.md`;测试设计、断言与 CTest 注册读 `../engineering/cmake/testing/ctest.md`;CMake 的 target、标准和函数写法读 `../engineering/cmake/`,可复用片段在 `../engineering/cmake/assets/`。
43
55
 
44
56
  入口脚本只做配置、构建、CTest 与最小运行;`clang-format` 与 `clang-tidy` 的手动检查留在定工具配置,不塞进入口脚本。`environment.json` 的三个环境轴与 `standard` 是唯一来源,缺项就停。
45
57
 
46
58
  本轮激活按三条上限走:
47
59
 
48
- - 只开当前步对应的一个步骤文件;同一改动域内不同时展开两个技能的步骤。跨域按 `源码 → configuring-cmake → building-cpp` 的顺序逐段进入,前一段结论落下再开下一段。
60
+ - 只开当前步对应的一个步骤文件;同一改动域内不同时展开两个技能的步骤。跨域按 `源码 → engineering → building-cpp` 的顺序逐段进入,前一段结论落下再开下一段。
49
61
  - 条文只开该步点名的一份;同号案例留到下一次激活。
50
62
  - 标准档只打开项目技能声明的那一档,没有声明时用本技能已有的新工程默认,不把其余标准档读进来。
51
63
 
52
- 项目技能列出了检查命令时只跑那一条,没有时跑本技能自己的 `scripts/checking-environment.mjs` 与 `scripts/checking-encoding.mjs`;退出码为 0 后在同一轮结束 goal,不再继续走没有失败的步骤。
64
+ 项目技能列出了检查命令时只跑那一条,没有时跑本技能自己的 `scripts/checking-environment.mjs` 与 `../engineering/formatting/scripts/checking-encoding.mjs`;退出码为 0 后在同一轮结束 goal,不再继续走没有失败的步骤。
53
65
 
54
66
  ### 四类改动
55
67
 
56
- 四类改动是操作内部的域:操作定入口,域定层次。四域的定义、边界与次序见 `../developing-cpp/references/change-model.md`;一次改动混了两类时,按「写作 → 布局 → 排版 → 润色」拆开做,前一类落定并经检查再进下一类。
68
+ 四类改动是操作内部的域:操作定入口,域定层次。四域的定义、边界与次序见 `../developing-cpp/source/01-editing/01-edit-operations.md`;一次改动混了两类时,按「内容 → 结构 → 版式 → 措辞」拆开做,前一类落定并经检查再进下一类。
57
69
 
58
70
  | 类型 | 典型请求 | 入口步骤 |
59
71
  | --- | --- | --- |
60
- | 写作 | 改环境轴、入口脚本或构建流程 | `steps/01-build.md` |
61
- | 布局 | 移动工具配置文件、补 `.vscode/` | `steps/02-tooling.md` |
62
- | 排版 | 只改编码、行尾或 clang-format | `steps/02-tooling.md` |
63
- | 润色 | 只改诊断措辞、失败分流说明 | `steps/03-check.md` |
72
+ | 内容 | 改环境轴、入口脚本或构建流程 | `steps/01-build.md` |
73
+ | 结构 | 移动工具配置文件、接 `.vscode/` 扩展与设置 | `steps/02-tooling.md` |
74
+ | 版式 | 只改编码、行尾或 clang-format | `steps/02-tooling.md` |
75
+ | 措辞 | 只改诊断措辞、失败分流说明 | `steps/03-check.md` |
64
76
 
65
77
  ## 完成判据
66
78
 
67
79
  - [ ] 项目 `environment.json` 的三个环境轴齐全且是合法组合,`standard` 在 `c++11`–`c++23` 内;新工程默认 `c++23`,没有靠猜。
68
80
  - [ ] 配置命令固定 Ninja 和单一编译器,`build/<compiler>/compile_commands.json` 存在,根 `build/compile_commands.json` 指向当前编译器。
69
- - [ ] target 契约已经成立:程序 `app`、库 target、公共 include、标准与输出目录都已由 `configuring-cmake` 写好;本技能没有偷偷改 CMake 来绕过失败。
81
+ - [ ] target 契约已经成立:程序 `app`、库 target、公共 include、标准与输出目录都已由 `engineering` 写好;本技能没有偷偷改 CMake 来绕过失败。
70
82
  - [ ] `clang-format --dry-run --Werror` 与 `clang-tidy` 在项目源码上零告警;只扫描项目源码和项目头。
71
83
  - [ ] CTest 全绿,程序从该编译器的构建目录启动;有测试时注册用 `gtest_discover_tests` 或项目既有机制,运行带 `--output-on-failure --no-tests=error`,失败时报告的是具体角色和原因。
72
84
  - [ ] 没有改源码语义,没有覆盖已有工程文件,也没有安装或下载任何工具。
85
+ - [ ] 工程有 `.vscode/` 时,扩展与设置按 `project/vscode/` 接好;没有时不新建,也没有 `tasks.json` 或 `launch.json` 另起构建。
@@ -0,0 +1,22 @@
1
+ # 推荐扩展
2
+
3
+ 只在工程已经有 `.vscode/` 时读本页;从当前目录向上到 git 根都没有 `.vscode/` 时,不打开本页,也不新建目录。新工程从 `../../assets/config/.vscode/extensions.json` 复制时除外。
4
+
5
+ ## 三个角色
6
+
7
+ | 扩展 | 负责 | 不负责 |
8
+ | --- | --- | --- |
9
+ | `llvm-vs-code-extensions.vscode-clangd` | 补全、跳转、诊断、格式化 | 配置与构建 |
10
+ | `ms-vscode.cmake-tools` | 配置、构建、运行、调试入口 | 语言服务 |
11
+ | `ms-vscode.cpptools` | 只作为 `CMake: Debug` 的调试后端 | IntelliSense 与格式化(关闭) |
12
+
13
+ 不要同时开两套语言服务;C/C++ 扩展的 IntelliSense 必须关闭,否则会和 clangd 抢编译数据库。
14
+
15
+ ## 对照现有文件
16
+
17
+ 1. 读工程根 `.vscode/extensions.json`;已有推荐只补缺,不重排、不删除。
18
+ 2. 旧工程只写了 C/C++ 扩展时,加 clangd 与 CMake Tools,并在设置里关掉 IntelliSense,理由写在提交说明里。
19
+ 3. 不写 `tasks.json` 或 `launch.json`;配置、构建、运行和调试都从 CMake Tools 进入,构建命令仍以 `running-build.sh` 为准。
20
+ 4. 模板在 `../../assets/config/.vscode/extensions.json`,只作为新工程的起点;工程已有文件时不复制整份覆盖。
21
+
22
+ 下一步:扩展对齐后,读 [02-settings.md](02-settings.md) 接线设置。
@@ -0,0 +1,33 @@
1
+ # 设置接线
2
+
3
+ ## 什么时候打开
4
+
5
+ 工程已经有 `.vscode/` 时,格式、静态检查与 clangd 的选择落定后再读本页;没有 `.vscode/` 时不打开,也不新建。模板在 `../../assets/config/.vscode/settings.json`。
6
+
7
+ ## 复制后改三处
8
+
9
+ | 键 | clang 模式 | gcc 模式 |
10
+ | --- | --- | --- |
11
+ | `cmake.buildDirectory` | `${workspaceFolder}/build/clang` | `${workspaceFolder}/build/gcc` |
12
+ | `clangd.arguments` 的 `--query-driver` | `/usr/bin/clang++` | `/usr/bin/g++` |
13
+ | `cmake.debugConfig` | `MIMode: lldb`、`miDebuggerPath: /usr/bin/lldb` | `MIMode: gdb`、`miDebuggerPath: /usr/bin/gdb` |
14
+
15
+ 只改与 `environment.json` 冲突的键;其余保持工程原值。`.clangd` 的 `CompilationDatabase` 也随编译器改,见 `../../../engineering/formatting/04-clangd.md`。
16
+
17
+ ## 各键分工
18
+
19
+ - `cmake.buildDirectory`:与定构建的 `build/<compiler>` 一致;不要在 CMake Tools 里再选第二个构建目录。
20
+ - `cmake.generator: Ninja`、`cmake.configureOnOpen: false`、`cmake.buildBeforeRun: true`、`cmake.exportCompileCommandsFile: true`:构建仍由入口脚本和 CMake 决定,编辑器只消费同一份数据库。
21
+ - `clangd.arguments`:`--query-driver` 写绝对路径且只列一个驱动,不用 `*`;`--header-insertion=never` 与 `--background-index` 沿用模板。
22
+ - `cmake.debugConfig`:只改调试后端;`type` 仍是 `cppdbg`。
23
+ - `C_Cpp.intelliSenseEngine: "disabled"`:把语言服务让给 clangd;不要把 C/C++ 扩展再配一套 include 路径。
24
+ - `editor.formatOnSave` 与 `[cpp]` / `[c]` 的默认格式化器:都指向 clangd;是否开启保存即格式化由工程决定,不在构建脚本里跑 `clang-format -i`。
25
+
26
+ ## 不写什么
27
+
28
+ - 不写 `tasks.json`、`launch.json`,不另起构建或启动路径。
29
+ - 不把标准写死在设置里,也不靠 `.clangd` 的 `-std` 覆盖编译数据库。
30
+ - 不在设置里堆 `-I` / `-D` 或系统头路径;这些从 `compile_commands.json` 来。
31
+ - 注释用 JSONC 的 `//`,只写为什么这样设。
32
+
33
+ 下一步:设置与扩展对齐后,回到 [定工具配置](../../steps/02-tooling.md) 收尾,再进 [通过检查](../../steps/03-check.md)。
@@ -12,7 +12,7 @@
12
12
  clang-format --dry-run --Werror src/*.cpp include/*.h
13
13
  ```
14
14
 
15
- 需要修复时单独运行 `clang-format -i`,再回看 diff。`clang-format` 只排版,不会把行尾注释搬到上一行;数据成员注释位置按 `developing-cpp/references/comments.md` 的规则和 `checking-comments.mjs` 检查。
15
+ 需要修复时单独运行 `clang-format -i`,再回看 diff。`clang-format` 只排版,不会把行尾注释搬到上一行;数据成员注释位置按 `developing-cpp/source/07-comments/01-comment-rules.md` 的规则和 `checking-comments.mjs` 检查。
16
16
 
17
17
  ## 用法
18
18
 
@@ -58,18 +58,18 @@ clang-format --dry-run --Werror src/*.cpp include/*.h
58
58
  - `Check`:两种模式都在条件不成立时打印诊断并终止。
59
59
  - `DebugCheck`:只在 Debug 生效,`NDEBUG` 后展开为空,参数不能带副作用。
60
60
 
61
- 不要写成 Debug 抛异常、Release 返回 false 的模式分支;这会把调用方逼成两套逻辑。规则详见 `developing-cpp/references/exceptions.md`。
61
+ 不要写成 Debug 抛异常、Release 返回 false 的模式分支;这会把调用方逼成两套逻辑。规则详见 `developing-cpp/source/08-exceptions/01-throw-rules.md`。
62
62
 
63
63
  ## 失败分诊
64
64
 
65
65
  | 输出 | 先看 | 回到 |
66
66
  | --- | --- | --- |
67
67
  | `CMake Error ... CXX compiler` | `environment.json`、`--live` | `building-cpp` 的定构建 / 通过检查 |
68
- | `ninja: error: ... missing and no known rule` | 源文件是否在 CMake 中列出 | `configuring-cmake` 的 target 源文件清单 |
69
- | `fatal error: ... No such file` | `target_include_directories` | `configuring-cmake` 的包含边界 |
70
- | `undefined reference` | `target_link_libraries`、库 target 名 | `configuring-cmake` 的链接边界 |
68
+ | `ninja: error: ... missing and no known rule` | 源文件是否在 CMake 中列出 | `engineering` 的 target 源文件清单 |
69
+ | `fatal error: ... No such file` | `target_include_directories` | `engineering` 的包含边界 |
70
+ | `undefined reference` | `target_link_libraries`、库 target 名 | `engineering` 的链接边界 |
71
71
  | `CTest` 失败 | 测试断言、行为句 | `developing-cpp` 的定行为 / 定实现 |
72
- | 运行时报找不到 `.so` | RPATH / `LD_LIBRARY_PATH` | `configuring-cmake` 的链接边界与 RPATH |
72
+ | 运行时报找不到 `.so` | RPATH / `LD_LIBRARY_PATH` | `engineering` 的链接边界与 RPATH |
73
73
 
74
74
  ## 验收
75
75
 
@@ -105,4 +105,4 @@ node "<skill-dir>/scripts/checking-environment.mjs" --project . --live
105
105
  | 3 | 活动校验失败:不在声明的 build host、角色缺失、版本不符 |
106
106
  | 1 | 脚本自身错误:参数错误或内部异常 |
107
107
 
108
- 各标准对应的编译器、库设施和工具档位见 [standards/README.md](standards/README.md)。
108
+ 各标准对应的编译器、库设施和工具档位见 [../../engineering/cmake/03-standard/standards/README.md](../../engineering/cmake/03-standard/standards/README.md)。
@@ -15,7 +15,7 @@ build/
15
15
 
16
16
  ## 前置
17
17
 
18
- 先读项目技能与 `environment.json`,再确认 `configuring-cmake` 已经把 target 图、公共 include、语言标准和输出目录写进 CMake。target 缺失、标准不对、include 或链接边界没写时,停止本步,转 `configuring-cmake` 的定 target 与标准;不要在这里用全局变量或临时 `-std` 绕过。
18
+ 先读项目技能与 `environment.json`,再确认 `engineering` 已经把 target 图、公共 include、语言标准和输出目录写进 CMake。target 缺失、标准不对、include 或链接边界没写时,停止本步,转 `engineering` 的定 target 与标准;不要在这里用全局变量或临时 `-std` 绕过。 只在需要核对时打开 `../../engineering/cmake/01-targets/01-rules.md` 或 `../../engineering/cmake/03-standard/01-cxx-standard.md` 被点名的一份;CMake 的写改仍由 `engineering` 落笔。
19
19
 
20
20
  ## 环境
21
21
 
@@ -32,10 +32,10 @@ build/
32
32
 
33
33
  - 生成器固定单配置 Ninja,不用 Ninja Multi-Config:同一源文件会写多条命令,clangd 默认只取第一条,容易读错数据库;构建目录固定 `build/clang` 或 `build/gcc`。
34
34
  - 一个 configure 只用一个编译器:`-DCMAKE_CXX_COMPILER=clang++` 或 `g++`;确有 C 源时 C 编译器与 C++ 编译器同属一套。
35
- - `set(CMAKE_EXPORT_COMPILE_COMMANDS ON)` 由 `configuring-cmake` 写在顶层;Ninja 下产出 `compile_commands.json`。
36
- - 输出目录由 `configuring-cmake` 统一设到 `build/<compiler>/bin` 与 `build/<compiler>/lib`;本步只核对,不重复设。
35
+ - `set(CMAKE_EXPORT_COMPILE_COMMANDS ON)` 由 `engineering` 写在顶层;Ninja 下产出 `compile_commands.json`。
36
+ - 输出目录由 `engineering` 统一设到 `build/<compiler>/bin` 与 `build/<compiler>/lib`;本步只核对,不重复设。
37
37
  - 配置后把 `build/<compiler>/compile_commands.json` 符号链接到 `build/compile_commands.json`,让 clangd 默认能找到当前数据库;换编译器时重建链接。
38
- - 不写全局 `CMAKE_CXX_FLAGS`、`include_directories()` 或 `add_definitions()`;这些属于 target 契约,发现就转 `configuring-cmake`。
38
+ - 不写全局 `CMAKE_CXX_FLAGS`、`include_directories()` 或 `add_definitions()`;这些属于 target 契约,发现就转 `engineering`。
39
39
  - 配置阶段不隐式下载依赖;测试框架由项目显式选择固定版本、带哈希的 `FetchContent`,或使用项目自带模块。
40
40
 
41
41
  ## 命令
@@ -54,11 +54,11 @@ GCC 模式把目录和编译器换成 `build/gcc`、`g++`。每次构建都重
54
54
 
55
55
  ## 情况
56
56
 
57
- **新工程**:从 `../assets/templates/projects/` 选形态;模板缺 target 时先转 `configuring-cmake`,target 齐了再 configure。
57
+ **新工程**:从 `../assets/templates/projects/` 选形态;模板缺 target 时先转 `engineering`,target 齐了再 configure。
58
58
 
59
59
  **已有工程**:先读现有 `CMakeLists.txt`,只核对 target、标准与输出目录;不改与当前任务无关的 target,大改前先让现有构建跑通。
60
60
 
61
- **测试**:`enable_testing()` 与 `add_subdirectory(tests)` 的顺序由 `configuring-cmake` 定;本步只跑 CTest,不在没有测试时加空测试。
61
+ **测试**:`enable_testing()` 与 `add_subdirectory(tests)` 的顺序由 `engineering` 定;本步只跑 CTest,不在没有测试时加空测试。
62
62
 
63
63
  **CMakePresets**:如果项目使用 preset,名称固定 `clang` / `gcc`,与构建目录一致;没有 preset 时直接用上面的命令。
64
64
 
@@ -13,19 +13,26 @@
13
13
  - `.clangd` 的 `CompilationDatabase` 指向 `build/<compiler>`;切换编译器时同步改,不能留旧目录。**不要写 `-std`**:它会覆盖 `compile_commands.json`,把 C++23 工程降成旧标准;标准只由构建声明和编译数据库决定。
14
14
  - `--query-driver` 是 clangd 的命令行参数,写在 `.vscode/settings.json` 的 `clangd.arguments` 里,不是 `.clangd` 的 YAML 键。它告诉 clangd 允许执行哪个编译器驱动来取系统头路径;路径写绝对路径,并与 `environment.json` 的编译器一致。
15
15
  - 首次复制时按轴替换三处:`compiler=clang` 用 `CompilationDatabase: build/clang`、`--query-driver=/usr/bin/clang++` 和 `cmake.debugConfig` 的 `MIMode: lldb` / `miDebuggerPath: /usr/bin/lldb`;`compiler=gcc` 用 `build/gcc`、`/usr/bin/g++` 和 `MIMode: gdb` / `/usr/bin/gdb`。只复制模板而不改这三处,GCC 模式会指向错误的数据库、驱动或调试器。原工程已有的 `.clangd` 不覆盖;要改先征得同意。
16
- - `.clang-format` 保留 `Language: Cpp`、`BasedOnStyle: Google` 和 `Standard`:模板资产写 `Latest`;工程按 `environment.json` 声明 C++11–C++20 时,把 `Standard` 改成 `c++NN`(映射见 `references/standards/README.md`)。clang-format 21/22 的 `Standard` 不接受 `c++23`,所以 C++23 工程仍写 `Latest`。列宽、缩进与包含顺序以工程根 `.clang-format` 为准;工程显式写 `ColumnLimit` 时按工程值执行,模板资产不写 `ColumnLimit`。需要新规则时先改 `references/google-cpp-style.md` 并说明理由。
16
+ - `.clang-format` 保留 `Language: Cpp`、`BasedOnStyle: Google` 和 `Standard`:模板资产写 `Latest`;工程按 `environment.json` 声明 C++11–C++20 时,把 `Standard` 改成 `c++NN`(映射见 `../../engineering/cmake/03-standard/standards/README.md`)。clang-format 21/22 的 `Standard` 不接受 `c++23`,所以 C++23 工程仍写 `Latest`。列宽、缩进与包含顺序以工程根 `.clang-format` 为准;工程显式写 `ColumnLimit` 时按工程值执行,模板资产不写 `ColumnLimit`。需要新规则时先改 `source/02-style/01-google-cpp-style.md` 并说明理由。
17
17
  - `.clang-tidy` 用 `Checks: '-*, google-*, portability-avoid-pragma-once, readability-identifier-naming'`,保留 `WarningsAsErrors: '*'` 和 `FormatStyle: file`。`google-*` 覆盖 Google 风格能静态检查的部分;`readability-identifier-naming` 只配项目确实统一的命名项:类型/枚举/别名/模板参数 PascalCase,变量/参数/成员 snake_case,类成员尾随 `_`,结构体成员不尾随,常量 `k` + PascalCase。不要设 `FunctionCase`,Google 允许 `count()` / `set_count()` 这类访问器;`portability-avoid-pragma-once` 要打开,因为工程统一用路径式守卫;不要重新打开 `cppcoreguidelines-*` 整包。
18
18
  - `.clang-tidy` 关闭项和例外必须写理由;不要借 `-*` 之后再打开 `cppcoreguidelines-*` 这类非 Google 整族检查。
19
19
  - `.vscode/extensions.json` 推荐 clangd、CMake Tools 与 C/C++ 扩展;`.vscode/settings.json` 固定 clangd 参数、CMake 构建目录和 `cmake.debugConfig`。配置、构建、运行和调试只从 CMake Tools 进入,不写 `tasks.json` 或 `launch.json`;C/C++ 扩展只作为 CMake 快速调试的后端,IntelliSense 关闭,避免和 clangd 并行。配置注释用 JSONC 的 `//`,贴在被解释的键上方。
20
20
  - 配置注释写「为什么这样设」,不写「这一项是什么」;不写策略头、不指向文档路径。
21
21
  - 格式化与静态检查只扫描项目源码:`src/`、`include/`、`apps/`、`tests/` 等实际存在的源码根;不扫描 `build/`、第三方目录、生成文件。
22
22
  - `clang-tidy` 用 `-p build/<compiler>` 读取编译数据库,`--header-filter` 只列项目根下的顶层目录,避免把第三方头纳入;不要加 `--system-headers`,也不要用 clang-tidy 19 才加入、16 没有的 `--exclude-header-filter`。
23
- - 格式化用 `--dry-run --Werror` 做检查;需要自动修复时单独运行 `-i`,不要让构建脚本悄悄改源码。`clang-format` 只排版,不会把行尾注释搬到上一行;数据成员注释位置按 `developing-cpp/references/comments.md` 检查。
23
+ - 格式化用 `--dry-run --Werror` 做检查;需要自动修复时单独运行 `-i`,不要让构建脚本悄悄改源码。`clang-format` 只排版,不会把行尾注释搬到上一行;数据成员注释位置按 `developing-cpp/source/07-comments/01-comment-rules.md` 检查。
24
24
  - 工程模板里不预置 `compile_commands.json`;它由定构建的 configure 生成,是构建产物。
25
25
 
26
+ ## 编辑器接线
27
+
28
+ - 只在工程根(当前目录到 git 根)已经有 `.vscode/` 时读 `../project/vscode/01-extensions.md` 或 `../project/vscode/02-settings.md`;没有 `.vscode/` 时不打开,也不新建目录。
29
+ - 顺序:先定 `.clang-format`、`.clang-tidy`、`.clangd`,再对照现有 `.vscode/extensions.json` 与 `settings.json` 只补缺、只改与 `environment.json` 冲突的项。
30
+ - 一次只读 `../project/vscode/` 里被点名的一页;扩展与设置不要同时展开。工具条文一次只开 `../../engineering/formatting/` 里被点名的一份,其余留到下一次激活。
31
+ - 不写 `tasks.json` 或 `launch.json`,构建与运行仍走 `running-build.sh`。
32
+
26
33
  ## 情况
27
34
 
28
- **新工程**:从 `assets/config/` 复制 `.clang-format`、`.clang-tidy`、`.clangd` 和 `.vscode/` 下的 `extensions.json`、`settings.json`,按编译器的映射改 `.clangd` 的编译数据库目录、`.vscode/settings.json` 的 `--query-driver` 路径和 `cmake.debugConfig` 的调试后端。不要复制 `build/`。
35
+ **新工程**:从 `assets/config/` 复制 `.clang-format`、`.clang-tidy`、`.clangd` 和 `.vscode/` 下的 `extensions.json`、`settings.json`,按编译器的映射改 `.clangd` 的编译数据库目录、`.vscode/settings.json` 的 `--query-driver` 路径和 `cmake.debugConfig` 的调试后端。新工程模板自带 `.vscode/` 时按 `../project/vscode/` 两页接线;已有工程没有 `.vscode/` 时不新建。不要复制 `build/`。
29
36
 
30
37
  **已有工程**:新工程默认 C++23;已有工程按 `environment.json` 的 `standard` 对齐 CMake target 与 `.clang-format`,不要只改一处。先跑一次 `clang-format --dry-run --Werror` 和 `clang-tidy`,看现有配置实际报什么;只改导致当前失败或与声明环境冲突的项。不要借机重排全工程格式。
31
38
 
@@ -33,11 +40,12 @@
33
40
 
34
41
  **GCC 模式**:`clangd` 仍可工作,但系统头来自 GCC;`--query-driver` 指向 `g++`。`clang-format` / `clang-tidy` 仍是 Clang 工具,版本要求不因编译器是 GCC 而降低。
35
42
 
36
- **共享库**:静态检查不因链接方式改变;运行时库路径由 `configuring-cmake` 的 target 设置负责,见其 `references/cmake.md`,不写进 clang 配置。
43
+ **共享库**:静态检查不因链接方式改变;运行时库路径由 `engineering` 的 target 设置负责,见其 `cmake/01-targets/01-rules.md`,不写进 clang 配置。
37
44
 
38
45
  ## 正反例指针
39
46
 
40
- - `.clangd` 指错编译数据库、`query-driver` 写进 YAML:`examples/tooling.md`。
41
- - 配置文件堆策略头、关闭检查不写理由:`examples/tooling.md`「配置注释」。
42
- - 工具调用与头文件过滤:`references/static-analysis.md`。
43
- - 每个标准对应的 clang-format 档位与 `.clangd` 读库规则:`references/standards/README.md`。
47
+ - `.clangd` 指错编译数据库、`query-driver` 写进 YAML:`../../engineering/formatting/examples/clangd.md`。
48
+ - 配置文件堆策略头、关闭检查不写理由:`../../engineering/formatting/examples/clang-tidy.md`「配置注释」。
49
+ - 工具调用与头文件过滤:`../../engineering/formatting/03-clang-tidy.md`。
50
+ - 每个标准对应的 clang-format 档位与 `.clangd` 读库规则:`../../engineering/cmake/03-standard/standards/README.md`。
51
+ - 编辑器扩展与设置:`../project/vscode/01-extensions.md`、`../project/vscode/02-settings.md`。
@@ -8,7 +8,7 @@
8
8
 
9
9
  按固定顺序跑,前一步失败就停,不要带着失败继续:
10
10
 
11
- 1. **校验编码与行尾**:在仓库根跑编码检查。默认 UTF-8 无 BOM、LF;MSVC 原生工程加 `--profile msvc`。有问题先按 `references/encoding.md` 修正,不带着 BOM 或混用行尾继续。
11
+ 1. **校验编码与行尾**:在仓库根跑编码检查。默认 UTF-8 无 BOM、LF;MSVC 原生工程加 `--profile msvc`。有问题先按 `../../engineering/formatting/01-encoding.md` 修正,不带着 BOM 或混用行尾继续。
12
12
  2. **校验环境声明(不带 `--live`)**:读 `environment.json`,检查三个环境轴、`standard` 和组合是否合法。环境轴为空、`standard` 非法或组合非法时,停在这里,不找可执行文件。
13
13
  3. **活动校验**:在声明的 build host 上跑 `--live`,核对 PATH 中的角色和版本。`windows` + `native` 在声明校验阶段就返回失败,不会进入这一步。
14
14
  4. **跑项目入口命令**:项目技能里写的入口命令(如 `./running-build.sh clang`)。入口命令仍是 `<entry-command>` 或空白时,停在这里,不要猜命令;是真实命令才跑。入口内部依次 configure → build → ctest → run;每一步失败都保留原始输出。
@@ -30,12 +30,12 @@ node "<skill-dir>/scripts/checking-environment.mjs" --project . --live # 活
30
30
  | 现象 | 先看 | 回到 |
31
31
  | --- | --- | --- |
32
32
  | 轴为空、组合非法、版本不匹配 | `environment.json`、`--live` 输出 | 定构建,先修声明 |
33
- | 找不到头文件、链接失败、target 不存在 | `CMakeLists.txt`、`target_include_directories`、`target_link_libraries` | `configuring-cmake` 的定 target;修完回定构建 |
34
- | 没有 `compile_commands.json` | 顶层 `CMAKE_EXPORT_COMPILE_COMMANDS` 是否由 target 图声明 | `configuring-cmake` 的定 target;生成器与目录回定构建 |
33
+ | 找不到头文件、链接失败、target 不存在 | `CMakeLists.txt`、`target_include_directories`、`target_link_libraries` | `engineering` 的定 target;修完回定构建 |
34
+ | 没有 `compile_commands.json` | 顶层 `CMAKE_EXPORT_COMPILE_COMMANDS` 是否由 target 图声明 | `engineering` 的定 target;生成器与目录回定构建 |
35
35
  | clangd 跳转失败、数据库指向旧编译器 | `.clangd` 的 `CompilationDatabase`、`build/compile_commands.json` 链接 | 定工具配置 |
36
36
  | 编译错误指向函数体 | 实现 | `developing-cpp` 的定实现;先修语义,再重跑 |
37
37
  | CTest 失败 | 测试断言、行为句 | `developing-cpp` 的定行为 / 定实现 |
38
- | `app` 启动失败、找不到共享库 | 输出目录、RPATH / 运行时库路径 | `configuring-cmake` 的定 target(输出目录与 RPATH) |
38
+ | `app` 启动失败、找不到共享库 | 输出目录、RPATH / 运行时库路径 | `engineering` 的定 target(输出目录与 RPATH) |
39
39
 
40
40
  分诊只定位,不自动改。一次只改一类问题;改完从失败的那一步重跑,只有行为或边界也变了才回到定行为。
41
41
 
@@ -47,7 +47,7 @@ node "<skill-dir>/scripts/checking-environment.mjs" --project . --live # 活
47
47
 
48
48
  **只改配置**:至少跑一次完整构建 + CTest;配置错误常常在链接或测试阶段才暴露。
49
49
 
50
- **没有测试**:项目确实还没有测试时,CTest 显示 0 条不算构建失败;不要为了「全绿」造空测试。已有公开行为却没有任何用例时,按 `references/testing.md` 的「先决定测什么」补成功与拒绝各一条,再跑 `--no-tests=error` 确认它真的被注册。
50
+ **没有测试**:项目确实还没有测试时,CTest 显示 0 条不算构建失败;不要为了「全绿」造空测试。已有公开行为却没有任何用例时,按 `../../engineering/cmake/testing/ctest.md` 的「先决定测什么」补成功与拒绝各一条,再跑 `--no-tests=error` 确认它真的被注册。
51
51
 
52
52
  **Windows 原生**:本版本不支持 `host=windows` + `build_host=native`。声明校验会返回 `ok: false`,`issues` 只有一句「本版本不能在 Windows 原生壳里构建」。停在这里,不要伪造 PowerShell 脚本,不要建议改 WSL 来绕过,也不要让代理改 `environment.json` 过关。
53
53
 
@@ -57,4 +57,4 @@ node "<skill-dir>/scripts/checking-environment.mjs" --project . --live # 活
57
57
 
58
58
  - 环境组合与 `--live` 输出:`examples/environment.md`。
59
59
  - 失败分诊的具体命令:`references/build-script.md`「失败分诊」。
60
- - 工具调用细节:`references/static-analysis.md`。
60
+ - 工具调用细节:`../../engineering/formatting/03-clang-tidy.md`。