@chengzhao-dev/dsh-cpp-workflow 0.7.10 → 0.7.12

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 (78) hide show
  1. package/README.en.md +3 -3
  2. package/README.md +3 -3
  3. package/lib/client.js +12 -11
  4. package/lib/comment-policy.js +12 -11
  5. package/lib/workspace.js +0 -2
  6. package/locale/en.json +1 -1
  7. package/locale/zh.json +1 -1
  8. package/package.json +4 -4
  9. package/skills/building-cpp/SKILL.md +2 -2
  10. package/skills/building-cpp/assets/config/.clang-tidy +4 -5
  11. package/skills/building-cpp/assets/config/.clangd +5 -7
  12. package/skills/building-cpp/assets/config/.vscode/settings.json +4 -6
  13. package/skills/building-cpp/references/01-build-script.md +2 -2
  14. package/skills/building-cpp/references/02-environment.md +4 -4
  15. package/skills/building-cpp/steps/01-build.md +1 -1
  16. package/skills/building-cpp/steps/02-tooling.md +3 -3
  17. package/skills/building-cpp/steps/03-check.md +2 -2
  18. package/skills/developing-cpp/SKILL.md +1 -1
  19. package/skills/developing-cpp/references/comments/01-comment-rules.md +39 -38
  20. package/skills/developing-cpp/references/comments/02-style.md +34 -20
  21. package/skills/developing-cpp/references/comments/examples/01-declaration-class.md +53 -7
  22. package/skills/developing-cpp/references/comments/examples/02-declaration-constructor.md +12 -3
  23. package/skills/developing-cpp/references/comments/examples/03-declaration-enum.md +9 -5
  24. package/skills/developing-cpp/references/comments/examples/04-declaration-file.md +19 -9
  25. package/skills/developing-cpp/references/comments/examples/05-declaration-function.md +22 -16
  26. package/skills/developing-cpp/references/comments/examples/06-declaration-member.md +2 -2
  27. package/skills/developing-cpp/references/comments/examples/07-declaration-predicate.md +5 -5
  28. package/skills/developing-cpp/references/comments/examples/09-implementation-body.md +9 -9
  29. package/skills/developing-cpp/references/comments/glossary/01-comment-terms.md +24 -23
  30. package/skills/developing-cpp/references/design/01-project-design.md +6 -6
  31. package/skills/developing-cpp/references/design/02-raii.md +2 -2
  32. package/skills/developing-cpp/references/design/examples/06-move-result.md +7 -6
  33. package/skills/developing-cpp/references/design/examples/07-preview-read.md +12 -11
  34. package/skills/developing-cpp/references/design/examples/08-screen-enter-exit.md +2 -1
  35. package/skills/developing-cpp/references/exceptions/01-exception-rules.md +33 -33
  36. package/skills/developing-cpp/references/exceptions/examples/02-throw-build-mode.md +8 -7
  37. package/skills/developing-cpp/references/exceptions/examples/04-throw-destructor.md +6 -2
  38. package/skills/developing-cpp/references/index.md +22 -22
  39. package/skills/developing-cpp/references/language/glossary/01-language-terms.md +1 -1
  40. package/skills/developing-cpp/references/language/language-basics/05-expressions.md +20 -5
  41. package/skills/developing-cpp/references/language/language-basics/06-functions.md +1 -1
  42. package/skills/developing-cpp/references/language/language-basics/10-language-checklist.md +3 -2
  43. package/skills/developing-cpp/references/language/performance/03-memory.md +1 -1
  44. package/skills/developing-cpp/references/language/standard-library/01-containers.md +1 -1
  45. package/skills/developing-cpp/references/language/standard-library/05-string.md +1 -1
  46. package/skills/developing-cpp/references/language/standard-library/06-format.md +10 -9
  47. package/skills/developing-cpp/references/language/standard-library/07-format-ecosystem.md +2 -2
  48. package/skills/developing-cpp/references/language/standard-library/08-time.md +1 -1
  49. package/skills/developing-cpp/references/language/value-types/03-integer-roles.md +13 -1
  50. package/skills/developing-cpp/references/language/value-types/09-subscript.md +1 -1
  51. package/skills/developing-cpp/references/layout/02-file-template.md +3 -5
  52. package/skills/developing-cpp/references/layout/03-declaration-order.md +38 -11
  53. package/skills/developing-cpp/references/naming/01-identifier-names.md +17 -16
  54. package/skills/developing-cpp/references/naming/examples/06-naming-lower-layer.md +1 -1
  55. package/skills/developing-cpp/references/naming/examples/13-naming-state-change.md +6 -5
  56. package/skills/developing-cpp/references/naming/glossary/01-naming-terms.md +1 -1
  57. package/skills/developing-cpp/references/naming/glossary/02-position.md +9 -9
  58. package/skills/developing-cpp/references/naming/glossary/03-selection.md +1 -1
  59. package/skills/developing-cpp/references/naming/glossary/04-square.md +3 -3
  60. package/skills/developing-cpp/references/naming/glossary/05-scoring.md +1 -1
  61. package/skills/developing-cpp/references/naming/glossary/06-difficulty.md +1 -1
  62. package/skills/developing-cpp/references/naming/glossary/07-stream.md +1 -1
  63. package/skills/developing-cpp/references/style/01-google-cpp-style.md +4 -4
  64. package/skills/developing-cpp/scripts/checking-comments.mjs +66 -11
  65. package/skills/developing-cpp/scripts/checking-declaration-order.mjs +24 -27
  66. package/skills/developing-cpp/steps/03-declaration.md +6 -6
  67. package/skills/developing-cpp/steps/04-implementation.md +7 -7
  68. package/skills/engineering/references/cmake/assets/LinkSettings.cmake +1 -1
  69. package/skills/engineering/references/cmake/linking/02-rpath.md +1 -1
  70. package/skills/engineering/references/cmake/standards/01-cxx-standard.md +5 -5
  71. package/skills/engineering/references/cmake/standards/index.md +1 -1
  72. package/skills/engineering/references/cmake/targets/01-target-rules.md +4 -4
  73. package/skills/engineering/references/formatting/01-encoding.md +3 -3
  74. package/skills/engineering/references/formatting/02-clang-format.md +1 -1
  75. package/skills/engineering/references/formatting/03-clang-tidy.md +3 -3
  76. package/skills/engineering/references/formatting/04-clangd.md +1 -1
  77. package/skills/engineering/references/formatting/05-config-comments.md +1 -1
  78. package/skills/engineering/steps/01-targets.md +1 -1
package/README.en.md CHANGED
@@ -19,7 +19,7 @@ The exception material follows the C++ Core Guidelines' Error handling section a
19
19
  Fixed-version npm install:
20
20
 
21
21
  ```bash
22
- dsh plugin --profile <profile> add npm:@chengzhao-dev/dsh-cpp-workflow@0.7.10
22
+ dsh plugin --profile <profile> add npm:@chengzhao-dev/dsh-cpp-workflow@0.7.12
23
23
  ```
24
24
 
25
25
  This page follows each release; run `npm view @chengzhao-dev/dsh-cpp-workflow version` if you need to confirm the current version on the registry.
@@ -27,7 +27,7 @@ This page follows each release; run `npm view @chengzhao-dev/dsh-cpp-workflow ve
27
27
  GitHub tag installs use the tag with the same version number:
28
28
 
29
29
  ```bash
30
- dsh plugin --profile <profile> add github:chengzhao-dev/dsh-cpp-workflow#v0.7.10
30
+ dsh plugin --profile <profile> add github:chengzhao-dev/dsh-cpp-workflow#v0.7.12
31
31
  ```
32
32
 
33
33
  Replace `--profile` with the profile you actually run. The desktop app always runs the `desktop` profile, and that profile is owned by the app; 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.
@@ -101,7 +101,7 @@ npm run ci # local replay: install, check:lib, test, package check (n
101
101
  npm run ci:full # ci plus the standard matrix; needs a POSIX host
102
102
  ```
103
103
 
104
- Source lives in `src/`; `npm run build` writes `lib/`. The structural check is `scripts/checking-skill-links.mjs`. Tests do not invoke a local compiler; the environment checks use fixed version strings. The standard matrix needs `cmake`, `ninja`, `perl`, and `clang++` (or the compiler named by `CXX`) on a POSIX host such as WSL, Linux, or macOS. On Windows, run `npm run ci` first, then run `npm run ci:full` from WSL inside the checkout.
104
+ Source lives in `src/`; `npm run build` writes `lib/`. The structural check is `scripts/checking-skill-links.mjs`. Tests do not invoke a local compiler; the environment checks use fixed version strings. The standard matrix needs `cmake`, `ninja`, `perl`, `node`, and `clang++` (or the compiler named by `CXX`) on a POSIX host such as WSL, Linux, or macOS. On Windows, run `npm run ci` first, then run `npm run ci:full` from WSL inside the checkout.
105
105
 
106
106
  ## License
107
107
 
package/README.md CHANGED
@@ -19,7 +19,7 @@
19
19
  npm 安装固定版本:
20
20
 
21
21
  ```bash
22
- dsh plugin --profile <profile> add npm:@chengzhao-dev/dsh-cpp-workflow@0.7.10
22
+ dsh plugin --profile <profile> add npm:@chengzhao-dev/dsh-cpp-workflow@0.7.12
23
23
  ```
24
24
 
25
25
  本页版本号随发布更新;安装前可用 `npm view @chengzhao-dev/dsh-cpp-workflow version` 确认 registry 上的最新版本。
@@ -27,7 +27,7 @@ dsh plugin --profile <profile> add npm:@chengzhao-dev/dsh-cpp-workflow@0.7.10
27
27
  GitHub 标签安装使用同一版本号的标签,地址中的版本与标签同号:
28
28
 
29
29
  ```bash
30
- dsh plugin --profile <profile> add github:chengzhao-dev/dsh-cpp-workflow#v0.7.10
30
+ dsh plugin --profile <profile> add github:chengzhao-dev/dsh-cpp-workflow#v0.7.12
31
31
  ```
32
32
 
33
33
  `--profile` 换成你实际运行的那个 profile。桌面应用固定跑 `desktop` profile,且该 profile 由应用独占管理;命令行 `add` 被拒绝时,在应用设置里添加插件,地址填同一个 npm 版本。Git 标签安装使用仓库内已构建的 `lib/`,不在目标机器上重新构建;包内也不含需要授权执行的安装脚本。
@@ -101,7 +101,7 @@ npm run ci # 本地复现:安装、比对 lib/、测试、打包检
101
101
  npm run ci:full # 在 ci 之上再跑标准矩阵,需 POSIX 宿主
102
102
  ```
103
103
 
104
- 源码在 `src/`,`npm run build` 生成 `lib/`。结构检查在 `scripts/checking-skill-links.mjs`;测试不调用本机编译器,环境检查用固定版本字符串。标准矩阵需要 POSIX 宿主上的 `cmake`、`ninja`、`perl` 和 `clang++`(或 `CXX` 指定的编译器),在 WSL/Linux/macOS 上运行。Windows 上先跑 `npm run ci`,再从 WSL 进入仓库跑 `npm run ci:full`。
104
+ 源码在 `src/`,`npm run build` 生成 `lib/`。结构检查在 `scripts/checking-skill-links.mjs`;测试不调用本机编译器,环境检查用固定版本字符串。标准矩阵需要 POSIX 宿主上的 `cmake`、`ninja`、`perl`、`node` 和 `clang++`(或 `CXX` 指定的编译器),在 WSL/Linux/macOS 上运行。Windows 上先跑 `npm run ci`,再从 WSL 进入仓库跑 `npm run ci:full`。
105
105
 
106
106
  ## 许可
107
107
 
package/lib/client.js CHANGED
@@ -126,17 +126,21 @@ function renderFileHeader(raw, fileName) {
126
126
  const config = normalizeConfig(raw);
127
127
  const name = text(fileName) || SAMPLE_FILE;
128
128
  const lines = [`@file ${name}`];
129
+ // 文件头分三段:@file、@brief 与元数据组,段间各留一行空注释。
129
130
  if (config.brief.enabled) {
130
- lines.push(config.brief.value ? `@brief ${config.brief.value}` : '@brief');
131
+ lines.push('', config.brief.value ? `@brief ${config.brief.value}` : '@brief');
131
132
  }
132
- for (const tag of ['author', 'date', 'copyright', 'version']) {
133
+ const metadata = [];
134
+ for (const tag of ['author', 'version', 'date', 'copyright']) {
133
135
  if (config[tag].enabled && config[tag].value)
134
- lines.push(`@${tag} ${config[tag].value}`);
136
+ metadata.push(`@${tag} ${config[tag].value}`);
135
137
  }
138
+ if (metadata.length > 0)
139
+ lines.push('', ...metadata);
136
140
  if (config.commentStyle === 'block') {
137
- return ['/**', ...lines.map((line) => ` * ${line}`), ' */'];
141
+ return ['/**', ...lines.map((line) => (line === '' ? separatorLine('block') : declarationLine('block', line))), ' */'];
138
142
  }
139
- return lines.map((line) => `/// ${line}`);
143
+ return lines.map((line) => (line === '' ? separatorLine('slash') : declarationLine('slash', line)));
140
144
  }
141
145
  /**
142
146
  * 设置页的预览:文件头 + 一段函数注释,只显示当前配置会写出的标签。
@@ -184,8 +188,9 @@ function previewText(raw, sampleName) {
184
188
  return lines.join('\n');
185
189
  }
186
190
  /**
187
- * 检查器参数:隐私标签要显式放行,@brief 被关掉时跳过摘要检查,
188
- * 声明符号切到块注释时让检查器按块注释收口。
191
+ * 检查器参数:@brief 被关掉时跳过摘要检查,声明符号切到块注释时让检查器按块注释收口。
192
+ * 文件头里的元数据默认放行,不再生成 `--allow-tag`;该参数仍可手工用来放行
193
+ * 写在函数或其他声明注释里的同名标签。
189
194
  */
190
195
  function checkerArgs(raw) {
191
196
  const config = normalizeConfig(raw);
@@ -198,10 +203,6 @@ function checkerArgs(raw) {
198
203
  args.push('--no-param');
199
204
  if (!config.returns)
200
205
  args.push('--no-return');
201
- for (const tag of PRIVACY_TAGS) {
202
- if (config[tag].enabled && config[tag].value)
203
- args.push('--allow-tag', tag);
204
- }
205
206
  return args;
206
207
  }
207
208
  /**
@@ -119,17 +119,21 @@ export function renderFileHeader(raw, fileName) {
119
119
  const config = normalizeConfig(raw);
120
120
  const name = text(fileName) || SAMPLE_FILE;
121
121
  const lines = [`@file ${name}`];
122
+ // 文件头分三段:@file、@brief 与元数据组,段间各留一行空注释。
122
123
  if (config.brief.enabled) {
123
- lines.push(config.brief.value ? `@brief ${config.brief.value}` : '@brief');
124
+ lines.push('', config.brief.value ? `@brief ${config.brief.value}` : '@brief');
124
125
  }
125
- for (const tag of ['author', 'date', 'copyright', 'version']) {
126
+ const metadata = [];
127
+ for (const tag of ['author', 'version', 'date', 'copyright']) {
126
128
  if (config[tag].enabled && config[tag].value)
127
- lines.push(`@${tag} ${config[tag].value}`);
129
+ metadata.push(`@${tag} ${config[tag].value}`);
128
130
  }
131
+ if (metadata.length > 0)
132
+ lines.push('', ...metadata);
129
133
  if (config.commentStyle === 'block') {
130
- return ['/**', ...lines.map((line) => ` * ${line}`), ' */'];
134
+ return ['/**', ...lines.map((line) => (line === '' ? separatorLine('block') : declarationLine('block', line))), ' */'];
131
135
  }
132
- return lines.map((line) => `/// ${line}`);
136
+ return lines.map((line) => (line === '' ? separatorLine('slash') : declarationLine('slash', line)));
133
137
  }
134
138
  /**
135
139
  * 设置页的预览:文件头 + 一段函数注释,只显示当前配置会写出的标签。
@@ -177,8 +181,9 @@ export function previewText(raw, sampleName) {
177
181
  return lines.join('\n');
178
182
  }
179
183
  /**
180
- * 检查器参数:隐私标签要显式放行,@brief 被关掉时跳过摘要检查,
181
- * 声明符号切到块注释时让检查器按块注释收口。
184
+ * 检查器参数:@brief 被关掉时跳过摘要检查,声明符号切到块注释时让检查器按块注释收口。
185
+ * 文件头里的元数据默认放行,不再生成 `--allow-tag`;该参数仍可手工用来放行
186
+ * 写在函数或其他声明注释里的同名标签。
182
187
  */
183
188
  export function checkerArgs(raw) {
184
189
  const config = normalizeConfig(raw);
@@ -191,10 +196,6 @@ export function checkerArgs(raw) {
191
196
  args.push('--no-param');
192
197
  if (!config.returns)
193
198
  args.push('--no-return');
194
- for (const tag of PRIVACY_TAGS) {
195
- if (config[tag].enabled && config[tag].value)
196
- args.push('--allow-tag', tag);
197
- }
198
199
  return args;
199
200
  }
200
201
  /**
package/lib/workspace.js CHANGED
@@ -7,8 +7,6 @@ import { access } from 'node:fs/promises';
7
7
  import path from 'node:path';
8
8
  /** 项目技能目录名,按优先顺序排列;下划线与连字符两种写法等价,连字符是模板与文档的默认写法。 */
9
9
  export const PROJECT_SKILL_DIRS = ['cpp_workflow_project', 'cpp-workflow-project'];
10
- /** 首选标记文件;查找时按 `PROJECT_SKILL_MARKERS` 逐个尝试。 */
11
- export const PROJECT_SKILL = path.join('.agents', 'skills', PROJECT_SKILL_DIRS[0], 'SKILL.md');
12
10
  /** 所有可接受的标记文件,顺序同 `PROJECT_SKILL_DIRS`。 */
13
11
  export const PROJECT_SKILL_MARKERS = PROJECT_SKILL_DIRS.map((name) => path.join('.agents', 'skills', name, 'SKILL.md'));
14
12
  export const MAX_ASCENT = 64;
package/locale/en.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "C++ Workflow",
4
- "description": "Write C++ sources, configure CMake, and build with Clang; /// Doxygen on declarations, // section notes in bodies, and configurable file-header tags."
4
+ "description": "Write C++ sources, configure CMake, and build with Clang or GCC; /// Doxygen on declarations, // section notes in bodies, and configurable file-header tags."
5
5
  }
6
6
  }
package/locale/zh.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "C++ 工程流程",
4
- "description": "写 C++ 源码、配 CMake、用 Clang 构建;头文件用 /// Doxygen 文档注释,函数体用 // 分段说明,文件头标签可在设置里改。"
4
+ "description": "写 C++ 源码、配 CMake、用 Clang 或 GCC 构建;头文件用 /// Doxygen 文档注释,函数体用 // 分段说明,文件头标签可在设置里改。"
5
5
  }
6
6
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chengzhao-dev/dsh-cpp-workflow",
3
- "version": "0.7.10",
4
- "description": "写 C++ 源码、配 CMake、用 Clang 构建;头文件用 /// Doxygen 文档注释,函数体用 // 分段说明,文件头标签可在设置里改。",
3
+ "version": "0.7.12",
4
+ "description": "写 C++ 源码、配 CMake、用 Clang 或 GCC 构建;头文件用 /// Doxygen 文档注释,函数体用 // 分段说明,文件头标签可在设置里改。",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
7
7
  "exports": {
@@ -46,8 +46,8 @@
46
46
  "catalog": {
47
47
  "category": "skill",
48
48
  "summary": {
49
- "zh": "写 C++ 源码、配 CMake、用 Clang 构建;头文件用 /// Doxygen 文档注释,函数体用 // 分段说明,文件头标签可在设置里改。",
50
- "en": "Write C++ sources, configure CMake, and build with Clang; /// Doxygen on declarations, // section notes in bodies, and configurable file-header tags."
49
+ "zh": "写 C++ 源码、配 CMake、用 Clang 或 GCC 构建;头文件用 /// Doxygen 文档注释,函数体用 // 分段说明,文件头标签可在设置里改。",
50
+ "en": "Write C++ sources, configure CMake, and build with Clang or GCC; /// Doxygen on declarations, // section notes in bodies, and configurable file-header tags."
51
51
  },
52
52
  "capabilities": [
53
53
  "skills"
@@ -16,7 +16,7 @@ metadata:
16
16
  - **交接**:一次改动同时碰到源码和构建文件时,先开 `developing-cpp` 定行为、边界与实现;需要新增或移动源文件、改库与程序的边界、补测试 target 时,转 `engineering` 把文件写进 CMake;最后回到本技能定工具配置并通过检查。只改函数体、命名、异常或注释且入口命令可运行时,定实现后只开本技能的通过检查。
17
17
  - **前置**:存在项目技能 `cpp-workflow-project` 时先读它的 `SKILL.md`、`environment.json` 和 `stages/stage-table.md`。声明非法时停在定构建,不猜 WSL、Clang 或构建目录;判定规则与取值见 `references/02-environment.md`「合法组合」。
18
18
  - **分因**:编译失败时先看诊断指向哪一层。函数体问题回 `developing-cpp` 的定实现;找不到头、链接失败、target 不存在或标准不对转 `engineering` 的对应步骤;没有编译数据库、format/tidy 不在 PATH 或配置不生效留在本技能的定工具配置。
19
- - **编码**:源码与构建文件用 UTF-8 无 BOM、检出 LF,`.bat` / `.cmd` 用 CRLF,`.clang-format` 写 `LineEnding: LF`;MSVC 不是受支持的环境轴;`/utf-8` 配方只留在资产注释里,当前构建仍用 clang/gcc。完整规则见 `../engineering/references/formatting/01-encoding.md`,机器规则以仓库根 `.gitattributes` 与 `.editorconfig` 为准。
19
+ - **编码**:源码与构建文件用 UTF-8 无 BOM、检出 LF,`.bat` / `.cmd` 用 CRLF;机器规则以仓库根 `.gitattributes` 与 `.editorconfig` 为准。完整规则见 `../engineering/references/formatting/01-encoding.md`;MSVC 不是受支持的环境轴,`/utf-8` 只在 `engineering` 的编码一节写给外部工程看。
20
20
  - **编辑器**:工程根已有 `.vscode/` 时按 `steps/04-vscode.md` 接线;从当前目录向上到工程根(含 `CMakeLists.txt` 的目录)都没有 `.vscode/` 时不打开、也不新建,外层仓库根或书根的 `.vscode/` 不算工程配置。配置、构建、运行和调试都从 CMake Tools 进入,构建仍以 `running-build.sh` 为准。
21
21
 
22
22
  ## 三种操作
@@ -61,7 +61,7 @@ metadata:
61
61
 
62
62
  加载预算见 [budget.md](../shared/budget.md);building-cpp 的步骤固定 4 份。
63
63
 
64
- 环境检查跑本技能自己的 `scripts/checking-environment.mjs`,编码检查跑 `../engineering/scripts/checking-encoding.mjs`;编码检查脚本从目标文件所在目录向上找 `.gitattributes` 与 `.editorconfig`,工程另有声明时以声明为准;环境检查脚本向上找项目技能的 `environment.json`。这些命令只覆盖各自那一段,完成判据还要求入口命令、CTest 与格式化检查,按 `steps/03-check.md` 的顺序跑完再停在这一步。入口脚本只做配置、构建、CTest 与最小运行;`clang-format` 与 `clang-tidy` 的手动检查留在定工具配置,不塞进入口脚本。`environment.json` 的三个环境轴是唯一来源;取值与合法性见 `references/02-environment.md`「合法组合」,脚本行为见 `scripts/checking-environment.mjs`。
64
+ 环境检查跑本技能自己的 `scripts/checking-environment.mjs`,编码检查跑 `../engineering/scripts/checking-encoding.mjs`;编码检查脚本从目标文件所在目录向上找 `.gitattributes` 与 `.editorconfig`,工程另有声明时以声明为准;环境检查脚本向上找项目技能的 `environment.json`。这些命令只覆盖各自那一段,完成判据还要求入口命令、CTest 与格式化检查,按 `steps/03-check.md` 的顺序跑完再停在这一步。入口脚本只做配置、构建、CTest 与最小运行;`clang-format` 与 `clang-tidy` 不进入口脚本,入口通过后按 `steps/03-check.md` 第 4 步手动跑。`environment.json` 的三个环境轴是唯一来源;取值与合法性见 `references/02-environment.md`「合法组合」,脚本行为见 `scripts/checking-environment.mjs`。
65
65
 
66
66
  ## 四类改动
67
67
 
@@ -1,5 +1,4 @@
1
- # Google C++ Style Guide 是唯一基线。这里只跑 google-* 检查族,再加一条
2
- # 命名规则;不再整包启用 cppcoreguidelines-*,也不靠本地关闭项维持风格。
1
+ # 只启用 google-* 与命名检查。
3
2
  InheritParentConfig: false
4
3
 
5
4
  Checks: >
@@ -14,8 +13,8 @@ UseColor: true
14
13
 
15
14
  CheckOptions:
16
15
  # 命名按 Google:类型/函数 PascalCase,变量 snake_case,私有成员尾随 _,
17
- # 常量 k 前缀。Google 允许访问器写成 count()/set_count(),因此不设
18
- # FunctionCase,避免把 snake_case 访问器误报。
16
+ # 编译期常量 k 前缀。本项目函数与访问器统一 PascalCase,但 FunctionCase
17
+ # 不设:这一项由命名规则与评审守住,clang-tidy 不重复配置。
19
18
  - key: readability-identifier-naming.NamespaceCase
20
19
  value: lower_case
21
20
  - key: readability-identifier-naming.ClassCase
@@ -53,7 +52,7 @@ CheckOptions:
53
52
  value: CamelCase
54
53
  - key: readability-identifier-naming.GlobalConstantPrefix
55
54
  value: 'k'
56
- # 局部常量按变量命名:Google 只给静态存储期的常量加 k 前缀。
55
+ # 局部 const 与局部 constexpr 按变量命名;k 前缀只给编译期常量。
57
56
  - key: readability-identifier-naming.LocalConstantCase
58
57
  value: lower_case
59
58
  - key: readability-identifier-naming.MacroDefinitionCase
@@ -1,9 +1,7 @@
1
- # 标准来自 build/clang/compile_commands.json,不要在这里写死 -std:
2
- # 否则 C++23 工程会被降成 .clangd 里的旧标准。
1
+ # 编译数据库目录;切换编译器时同步改。
3
2
  CompileFlags:
4
- CompilationDatabase: build/clang
3
+ CompilationDatabase: build/clang
5
4
  Diagnostics:
6
- # 静态检查规则只在 .clang-tidy 里维护;这里不复制检查列表。
7
- Suppress:
8
- # 项目头由编译数据库提供;解析噪声不掩盖真实诊断。
9
- - pp_file_not_found
5
+ Suppress:
6
+ # 项目头由编译数据库提供;解析噪声不掩盖真实诊断。
7
+ - pp_file_not_found
@@ -6,8 +6,7 @@
6
6
  "--header-insertion=never",
7
7
  "--background-index"
8
8
  ],
9
- // VSCode 的配置、构建、运行和调试入口都留在 CMake Tools。
10
- // 不另建 launch.json / tasks.json,避免出现第二套构建或启动路径。
9
+ // 构建、运行和调试入口统一交给 CMake Tools。
11
10
  "cmake.buildDirectory": "${workspaceFolder}/build/clang",
12
11
  // 构建固定用 Ninja,与工程入口脚本一致;换生成器要同步脚本。
13
12
  "cmake.generator": "Ninja",
@@ -27,8 +26,7 @@
27
26
  "stopAtEntry": false,
28
27
  "externalConsole": false
29
28
  },
30
- // cpptools 只作为 CMake 的调试后端,不再提供 IntelliSense;
31
- // 补全、跳转、诊断和格式化都由读取 compile_commands.json 的 clangd 负责。
29
+ // IntelliSense 由 clangd 提供。
32
30
  "C_Cpp.intelliSenseEngine": "disabled",
33
31
  // 保存即格式化;实际排版交给 clangd,不在构建脚本里跑 clang-format -i。
34
32
  "editor.formatOnSave": true,
@@ -43,9 +41,9 @@
43
41
  "files.associations": {
44
42
  "*.h": "cpp"
45
43
  },
46
- // 文件统一按 UTF-8 保存,与 .editorconfig 的 charset 一致。
44
+ // 文件按 UTF-8 保存。
47
45
  "files.encoding": "utf8",
48
- // 行尾统一 LF,与 .gitattributes 和 .clang-format 的 LineEnding 一致。
46
+ // 行尾用 LF。
49
47
  "files.eol": "\n",
50
48
  // 构建产物与本地缓存不显示在资源管理器里。
51
49
  "files.exclude": {
@@ -1,7 +1,7 @@
1
1
  <!-- 读取时机:写构建脚本时;读完能回答:构建脚本;预算:一次只开这一份(73 行),不自动串联。 -->
2
2
  # 构建脚本
3
3
 
4
- `assets/templates/projects/common/running-build.sh` 是 POSIX build-host 脚本,适用于 Linux、macOS 和 Windows + WSL。`host=windows` + `build_host=native` 不是本版本支持的组合:声明校验会直接拒绝,脚本也不会在原生 Windows 壳里运行。脚本只做配置、构建、CTest 与运行;格式化与静态检查在编辑时手动跑,不混进构建入口。
4
+ `assets/templates/projects/common/running-build.sh` 是 Bash 脚本,适用于 Linux、macOS 和 Windows + WSL 这几个 POSIX build host。`host=windows` + `build_host=native` 不是本版本支持的组合:声明校验会直接拒绝,脚本也不会在原生 Windows 壳里运行。脚本只做配置、构建、CTest 与运行;格式化与静态检查在编辑时手动跑,不混进构建入口。
5
5
 
6
6
  ## 格式化与静态检查
7
7
 
@@ -36,7 +36,7 @@
36
36
 
37
37
  ## 关键约束
38
38
 
39
- - 只用 POSIX shell + Bash 数组;不要依赖 `mapfile`(macOS 自带 Bash 3.2 没有)。
39
+ - 只用 Bash 3.2 兼容语法;不要依赖 `mapfile`(macOS 自带 Bash 3.2 没有)。
40
40
  - 路径含空格时全部加引号;`find -print0` 配 `read -d ''`。
41
41
  - `set -u` 下空数组展开会报错;先判 `${#sources[@]}` 再传给工具。
42
42
  - 不在脚本里设全局 `LD_LIBRARY_PATH`;共享库的运行时路径由 CMake 的 RPATH 设置。
@@ -1,7 +1,7 @@
1
1
  <!-- 读取时机:配环境或检查工具时;读完能回答:环境组合;预算:一次只开这一份(116 行),不自动串联。 -->
2
2
  # 环境组合
3
3
 
4
- 环境是**声明**,不是探测结果。项目技能 `cpp-workflow-project`(目录名也接受 `cpp_workflow_project`)的 `environment.json` 写清楚三个环境轴和一个语言标准;构建规则、工具配置和检查都按这个声明执行。声明为空或组合非法时,先修声明,不要靠猜。
4
+ 环境是**声明**,不是探测结果。项目技能 `cpp-workflow-project`(目录名也接受 `cpp_workflow_project`)的 `environment.json` 写清楚三个环境轴和一个语言标准;构建规则、工具配置和检查都按这个声明执行。声明为空或组合非法时,先修声明,不要靠猜;只有 `standard` 缺失按默认 `c++23` 处理(见「非法组合」)。
5
5
 
6
6
  ## 四个轴
7
7
 
@@ -40,7 +40,7 @@
40
40
  - `host=windows` + `build_host=native`:本版本不支持,静态校验直接返回失败。
41
41
  - `compiler=msvc`、`compiler=clang-cl`、`compiler=c`。
42
42
 
43
- `windows` + `native` 不再作为「合法但不能构建」的声明保留;CMake 资产里的 MSVC 分支不是受支持的环境,不能据此写 `compiler=msvc`。声明校验直接返回 `ok: false`,`issues` 只有一句「本版本不能在 Windows 原生壳里构建」;不要建议改 WSL,也不要临时写 PowerShell 脚本伪装成已支持。
43
+ `windows` + `native` 不再作为「合法但不能构建」的声明保留;CMake 资产里的 MSVC 分支不是受支持的环境,不能据此写 `compiler=msvc`。判定结果与错误文本见上一条;不要建议改 WSL,也不要临时写 PowerShell 脚本伪装成已支持。
44
44
 
45
45
  ## 工具角色
46
46
 
@@ -58,7 +58,7 @@
58
58
 
59
59
  ## 版本与能力
60
60
 
61
- - **标准**:新工程默认 C++23,可声明 `c++11`–`c++23`;编译器必须支持对应的 `-std=c++NN`。CMake ≥ 3.20;C++11/14 的 `cxx_std_*` 需要 CMake ≥ 3.1,但本工作流统一按 3.20 起步。`CXX_STANDARD_REQUIRED ON` 防止标准 decay;C++23 的库设施(如 `std::print`)以实际编译器/标准库为准。
61
+ - **标准**:新工程默认 C++23,可声明 `c++11`–`c++23`;编译器必须支持对应的 `-std=c++NN`。CMake ≥ 3.20;`cxx_std_11`–`cxx_std_17` 需要 CMake ≥ 3.8(3.8 才引入 meta-feature),`cxx_std_20` 3.12、`cxx_std_23` 3.20;本工作流统一按 3.20 起步。`CXX_STANDARD_REQUIRED ON` 防止标准 decay;C++23 的库设施(如 `std::print`)以实际编译器/标准库为准。
62
62
  - **clang-format / clang-tidy**:≥ 16。这是本工作流的工具基线;低于该版本时检查器报告具体角色和版本。
63
63
  - **clang 模式同版本**:`clang++`、`clang-format`、`clang-tidy`、`clangd` 必须是同一 LLVM 主版本。混装 17 的 clangd 与 18 的 clang-format 会出现诊断与格式化不一致。Apple Clang 也按这条核对;若工具版本对不上,报告的是具体角色和版本,不要为了通过而改声明。
64
64
  - **gcc 模式**:检查器不拿 GCC 的主版本去比 Clang 工具;`clang-format` / `clang-tidy` 仍要 ≥ 16,`clangd` 只要求可用。`g++` 必须是真的 GCC,不能是 Apple clang 的别名。GCC 需要自带 C++23 `<print>` / `std::expected` 的标准库;版本过旧时先升级工具链,或把项目标准降到实际可用的档位,不要改检查器绕过。
@@ -93,7 +93,7 @@ node "<skill-dir>/scripts/checking-environment.mjs" --project . --live
93
93
  约束:
94
94
 
95
95
  - 只读:不安装、不下载、不改 PATH、不写项目文件。
96
- - `--live` 在 `host=windows` + `build_host=native` 下不会继续:声明校验已经失败,错误是「本版本不能在 Windows 原生壳里构建」。
96
+ - `--live` 先做声明校验,声明失败即停。
97
97
  - WSL 模式要求当前进程在 WSL 内(`WSL_DISTRO_NAME` / `WSL_INTEROP` 或 `/proc/version` 含 Microsoft);只在 Linux 上但不在 WSL 时失败。
98
98
  - macOS 上声明 `compiler=gcc` 时,`g++ --version` 若显示 Apple clang,按「不是真正的 GCC」失败。
99
99
  - 没有 `--live` 时不做任何 PATH 探测,CI 和 Windows 开发机都能做声明校验。
@@ -56,7 +56,7 @@ GCC 模式把目录和编译器换成 `build/gcc`、`g++`(C 驱动换成 `gcc`
56
56
 
57
57
  ## 情况
58
58
 
59
- **新工程**:从 `../assets/templates/projects/` 选形态;把 `../assets/templates/projects/common/running-build.sh` 复制到工程根,`chmod +x` 并用 `bash -n` 验证语法;在 `.agents/skills/cpp-workflow-project/environment.json` 写出四个字段(`host`、`build_host`、`compiler`、`standard`),取值与组合见 `../references/02-environment.md`,不要替用户选。模板缺 target 时先转 `engineering`,target 齐了再 configure。
59
+ **新工程**:从 `../assets/templates/projects/` 选形态;把 `../assets/templates/projects/common/running-build.sh` 复制到工程根,`chmod +x` 并用 `bash -n` 验证语法;在 `.agents/skills/cpp-workflow-project/environment.json` 写出四个字段(`host`、`build_host`、`compiler`、`standard`),取值与组合见 `../references/02-environment.md`,不要替用户选。模板源文件只是最小可构建形状,不带 `/// @file` 文件头;复制进工程后按 `../../developing-cpp/references/layout/02-file-template.md` 槽位 1 补齐再跑注释检查。模板缺 target 时先转 `engineering`,target 齐了再 configure。
60
60
 
61
61
  **已有工程**:先读现有 `CMakeLists.txt`,只核对 target、标准与输出目录;不改与当前任务无关的 target,大改前先让现有构建跑通。
62
62
 
@@ -9,12 +9,12 @@
9
9
  - 工程拥有配置:`.clang-format`、`.clang-tidy`、`.clangd`、`.vscode/` 放在工程根;不要依赖用户主目录或插件目录里的同名文件。
10
10
  - 只复制缺失的文件。已有配置先读再改,不覆盖;需要合并时逐项说明理由。
11
11
  - 工具角色固定:`clang-format` 管排版,`clang-tidy` 管静态诊断,`clangd` 管补全/跳转/诊断;无论 `compiler` 是 clang 还是 gcc,这三件都用 Clang 工具链。
12
- - 版本要求见 `../references/02-environment.md`:Clang 模式要求 `clang++`、`clang-format`、`clang-tidy`、`clangd` 同一 LLVM 主版本;GCC 模式要求 `clang-format` / `clang-tidy` ≥ 16,`clangd` 只要求可用。
12
+ - 版本要求与模式组合见 `../references/02-environment.md`「版本与能力」:本步只按它核对,不在这里另立版本阈值。
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
  - 首次复制后按 `04-vscode.md` 的「复制后改三处」表替换 `cmake.buildDirectory`、`clangd.arguments` 的 `--query-driver` 与 `cmake.debugConfig`,再把 `.clangd` 的 `CompilationDatabase` 指到同一构建目录,合计四个键;只复制模板而不改这些键,GCC 模式会指向错误的数据库、驱动或调试器。原工程已有的 `.clangd` 不覆盖;要改先征得同意。
16
- - `.clang-format` 保留 `Language: Cpp`、`BasedOnStyle: Google`、`Standard` 和 `LineEnding: LF`:模板资产写 `Latest`;工程按 `environment.json` 声明 C++11–C++20 时,把 `Standard` 改成 `c++NN`(映射见 `../../engineering/references/cmake/standards/index.md`)。`Standard` 不接受 `c++23` 的旧工具会报 `unknown enumerated scalar`;C++23 工程统一写 `Latest`,由工具取它支持的最高标准。缩进与列宽默认 4 个空格、120 列,模板资产显式写 `UseTab: Never`、`TabWidth: 4`、`IndentWidth: 4`、`ContinuationIndentWidth: 8`、`AccessModifierOffset: -4` 与 `ColumnLimit: 120`;工程有自己配置时按工程值执行。包含分块保持 include 现有空行分组,组内顺序交给 Google 预设。需要新规则时先改 `../../developing-cpp/references/style/01-google-cpp-style.md` 并说明理由。
17
- - `.clang-tidy` 用 `Checks: '-*, google-*, readability-identifier-naming'`,保留 `WarningsAsErrors: '*'` 和 `FormatStyle: file`。`google-*` 覆盖 Google 风格能静态检查的部分;`readability-identifier-naming` 的命名项与取值以 `assets/config/.clang-tidy` 的 `CheckOptions` 为唯一清单;常用约定:类型/枚举/别名/模板参数 CamelCase,变量/参数/成员与局部常量 lower_case,私有成员尾随 `_`(对应 `PrivateMemberSuffix`)、公共与受保护成员不尾随,结构体成员不尾随,静态存储期与 `constexpr` 常量 `k` + CamelCase,命名空间 lower_case,宏 UPPER_CASE。不要设 `FunctionCase`,Google 允许 `count()` / `set_count()` 这类访问器;不要打开 `portability-avoid-pragma-once`,工程统一用 `#pragma once`,打开会把每个头文件报成问题;不要重新打开 `cppcoreguidelines-*` 整包。
16
+ - `.clang-format` 从 `../assets/config/.clang-format` 复制后,只改与本工程声明冲突的键:按 `environment.json` 的 `standard` 把模板资产的 `Standard: Latest` 改成 `c++NN`(映射见 `../../engineering/references/cmake/standards/index.md`;C++23 保持 `Latest`)。缩进、列宽、包含分块与 `IncludeBlocks: Preserve` 的键值以该资产为唯一清单;工程有自己配置时按工程值执行。需要新规则时先改 `../../developing-cpp/references/style/01-google-cpp-style.md` 并说明理由。
17
+ - `.clang-tidy` 从 `../assets/config/.clang-tidy` 复制:`Checks`、`WarningsAsErrors`、`FormatStyle` 与 `CheckOptions` 的取值以该资产为唯一清单,不按整族开关覆盖;命名项取值、逐项理由与关闭规则见 `../../engineering/references/formatting/03-clang-tidy.md`。
18
18
  - `.clang-tidy` 关闭项和例外必须写理由;不要借 `-*` 之后再打开 `cppcoreguidelines-*` 这类非 Google 整族检查。
19
19
  - `.vscode/extensions.json` 与 `settings.json` 从 `assets/config/.vscode/` 复制;扩展分工与键语义按 `../../engineering/references/formatting/04-clangd.md`,工程内落地与三处替换见 `04-vscode.md`。编辑器从 CMake Tools 进入,命令行与 CI 走 `running-build.sh`,两者共用同一构建目录;不写 `tasks.json` 或 `launch.json`。配置注释用 JSONC 的 `//`,贴在被解释的键上方。
20
20
  - 配置文件的键注释分两类:运行时配置用「对象:条件时,后果」,写清比较对象与执行者,不写含糊代词、不复述键名,也不写 `sed`/CI 这类实现细节,句式与正反例见 `../../engineering/references/formatting/05-config-comments.md`;固定值配置(`.clang-format`、`.clang-tidy`、`.clangd`、`.vscode/`)写一句简短说明,不套后果句式,措辞按 `../../developing-cpp/references/comments/02-style.md`。两类都不写策略说明段,也不指向文档路径;标题只在需要交代文件整体用途时写一行。
@@ -11,7 +11,7 @@
11
11
  1. **校验编码与行尾**:在仓库根跑编码检查。默认 UTF-8 无 BOM、LF;不是本工作流构建的 MSVC 源码库加 `--profile msvc`(本工作流拒绝 `windows + native`)。有问题先按 `../../engineering/references/formatting/01-encoding.md` 修正,不带着 BOM 或混用行尾继续;脚本退出码为 0 后再跑 `git diff --check`,有空白错误同样停在这里。
12
12
  2. **校验环境声明(不带 `--live`)**:读 `environment.json`,按 `../references/02-environment.md`「合法组合」的规则判定;非法时停在这里,不找可执行文件。
13
13
  3. **活动校验**:在声明的 build host 上跑 `--live`,核对 PATH 中的角色和版本。`windows` + `native` 在声明校验阶段就返回失败,不会进入这一步。
14
- 4. **跑项目入口命令**:项目技能里写的入口命令(如 `./running-build.sh clang`)。入口命令仍是 `<entry-command>` 或空白时,停在这里,不要猜命令;是真实命令才跑。入口内部依次 configure → build → ctest → run;每一步失败都保留原始输出。有 `tests/` 目录时,脚本里的 ctest 必须带 `--output-on-failure --no-tests=error`;缺参数时按 `ctest --test-dir <build-dir> --output-on-failure --no-tests=error` 补跑,并以补跑的退出码为准;没有测试目录时改用 `--no-tests=ignore`,0 条不算失败,也不补 `--no-tests=error`。入口通过后,再对项目源码跑 `clang-format --dry-run --Werror <源码根>/*.cpp <源码根>/*.h`(只列工程实际存在的源码根,目录不存在就不写这一项)与 `clang-tidy -p <build-dir> --header-filter="^$(pwd -P)/" --warnings-as-errors='*' <源码根>/*.cpp`(clang-tidy 必须显式列出源文件,否则报 no input files;过滤按工程根取,组件名不必逐个列,第三方头在根外自然排除);任一非零即失败,命令细节见 `../../engineering/references/formatting/02-clang-format.md` 与 `03-clang-tidy.md`。
14
+ 4. **跑项目入口命令**:项目技能里写的入口命令(如 `./running-build.sh clang`)。入口命令仍是 `<entry-command>` 或空白时,停在这里,不要猜命令;是真实命令才跑。入口内部依次 configure → build → ctest → run;每一步失败都保留原始输出。有 `tests/` 目录时,脚本里的 ctest 必须带 `--output-on-failure --no-tests=error`;缺参数时按 `ctest --test-dir <build-dir> --output-on-failure --no-tests=error` 补跑,并以补跑的退出码为准;没有测试目录时改用 `--no-tests=ignore`,0 条不算失败,也不补 `--no-tests=error`。入口通过后,再对项目源码跑 `clang-format --dry-run --Werror <源码根>/*.cpp <源码根>/*.h`(只列工程实际存在的源码根,目录不存在就不写这一项)与 `clang-tidy -p <build-dir> --header-filter="^$(pwd -P)/" --warnings-as-errors='*' <源码根>/*.cpp`(clang-tidy 必须显式列出源文件,否则报 no input files;`--header-filter` 默认按工程根取,根里还放第三方头时再收窄成源码根白名单,见 `../../engineering/references/formatting/03-clang-tidy.md`);任一非零即失败,命令细节见 `../../engineering/references/formatting/02-clang-format.md` 与 `03-clang-tidy.md`。
15
15
  5. **核对产物**:`<build-dir>/compile_commands.json` 存在(默认 `build/<compiler>`,项目声明单一目录时用该目录);没有声明单一目录时,`build/compile_commands.json` 还要指向当前数据库;入口 target(模板默认 `app`)的可执行文件在 `<build-dir>/bin`。对它跑 `file` 与 `ldd`(macOS 用 `otool -L`),`ldd` 不得出现 `not found`,并做一次最小启动;见 `../../engineering/references/cmake/linking/04-inspect.md`。
16
16
  6. **记录结果**:通过时记录编译器版本、构建目录、测试数量;失败时记录命令、退出码、第一条根因诊断。
17
17
 
@@ -53,7 +53,7 @@ node "<skill-dir>/scripts/checking-environment.mjs" --project . --live # 活
53
53
 
54
54
  **没有测试**:项目确实还没有测试时,CTest 显示 0 条不算构建失败;不要为了「全绿」造空测试。已有公开行为却没有任何用例时,按 `../../engineering/references/cmake/testing/01-ctest.md` 的「先决定测什么」补成功与拒绝各一条,再跑 `--no-tests=error` 确认它真的被注册。
55
55
 
56
- **Windows 原生**:本版本不支持 `host=windows` + `build_host=native`。声明校验会返回 `ok: false`,`issues` 只有一句「本版本不能在 Windows 原生壳里构建」。停在这里,不要伪造 PowerShell 脚本,不要建议改 WSL 来绕过,也不要让代理改 `environment.json` 过关。
56
+ **Windows 原生**:本版本不支持 `host=windows` + `build_host=native`,声明校验返回 `ok: false`;判定与错误文本见 `../references/02-environment.md`。停在这里,不要伪造 PowerShell 脚本,不要建议改 WSL 来绕过,也不要让代理改 `environment.json` 过关。
57
57
 
58
58
  **macOS**:`/usr/bin/clang++` 通常是 Apple Clang;`.clangd` 不写死 Homebrew 路径,clangd 要能经 xcrun 找到 SDK。`compiler=clang` 时 `--live` 按同一 LLVM 主版本核对 clang++、clang-format、clang-tidy、clangd;不要混用 Homebrew LLVM 与 Xcode 资源目录来凑版本,也不要为了通过而改 `environment.json` 的编译器。
59
59
 
@@ -89,7 +89,7 @@ metadata:
89
89
  - [ ] 第 1 步的行为句能被用户或测试验收;有阶段表时只覆盖对应行,没有时只覆盖用户点名的行为。
90
90
  - [ ] 第 2 步的库 target 不依赖终端、GUI 或脚本;程序 target 只做装配和输入输出;共享抽象有第二个真实使用方。
91
91
  - [ ] 超出标准库的能力用维护中的三方库完成,库只出现在直接使用它的 target,规则库不依赖终端、GUI 或库类型。
92
- - [ ] 第 3 步的公共头文件自包含,命名、声明顺序和异常声明符合 `references/` 的条文;类型注释只写本类型,纯值容器一句,初始状态归默认构造函数。
92
+ - [ ] 第 3 步的公共头文件自包含,命名、声明顺序和异常声明符合 `references/` 的条文;类型注释按类型写:`@brief` 一句名词短语;类、结构体、格式化器默认再加一段「表示…」;纯数据结构、枚举和纯值容器最多两句;初始状态归默认构造函数。
93
93
  - [ ] 第 4 步的实现只兑现声明;`.cpp` 定义顺序与头文件声明同序,参数类型、限定符与返回类型同声明一致;同一文件里的函数按同一套分段约定,需要分阶段的都有阶段注释与空行;资源由 RAII 管理;失败是正常结果时用返回值,函数无法完成任务时抛异常,不拿异常做正常分支。
94
94
  - [ ] 配对头文件类的 `.cpp` 定义顺序、签名与谓词位置检查通过:`node "<skill-dir>/scripts/checking-declaration-order.mjs" --root <项目根>` 退出码为 0;有乱序或签名不一致先修,不能跳过。自由函数与没有配对头文件的 `.cpp` 不在覆盖内。
95
95
  - [ ] 源码注释符合 `references/comments/01-comment-rules.md` 与 `02-style.md` 的规范,`node "<skill-dir>/scripts/checking-comments.mjs" --root <项目根>` 退出码为 0,末行是「注释检查通过:N 个文件。」。