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

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 (189) hide show
  1. package/README.en.md +23 -32
  2. package/README.md +24 -33
  3. package/cordis.patch.yml +6 -6
  4. package/lib/client.js +35 -23
  5. package/lib/comment-policy.js +15 -6
  6. package/lib/index.js +45 -37
  7. package/lib/workspace.js +10 -32
  8. package/package.json +7 -7
  9. package/skills/building-cpp/SKILL.md +24 -24
  10. package/skills/building-cpp/assets/templates/projects/common/running-build.sh +5 -1
  11. package/skills/building-cpp/project/vscode/01-extensions.md +6 -0
  12. package/skills/building-cpp/project/vscode/02-settings.md +7 -1
  13. package/skills/building-cpp/references/build-script.md +10 -3
  14. package/skills/building-cpp/references/environment.md +8 -1
  15. package/skills/building-cpp/scripts/checking-environment.mjs +11 -13
  16. package/skills/building-cpp/steps/01-build.md +5 -4
  17. package/skills/building-cpp/steps/02-tooling.md +10 -10
  18. package/skills/building-cpp/steps/03-check.md +13 -11
  19. package/skills/developing-cpp/SKILL.md +39 -40
  20. package/skills/developing-cpp/references/comments/comment-rules.md +195 -0
  21. package/skills/developing-cpp/references/comments/comment-style.md +76 -0
  22. package/skills/developing-cpp/references/comments/examples/declaration-class.md +65 -0
  23. package/skills/developing-cpp/references/comments/examples/declaration-constructor.md +22 -0
  24. package/skills/developing-cpp/references/comments/examples/declaration-enum.md +48 -0
  25. package/skills/developing-cpp/{source/07-comments → references/comments}/examples/declaration-file.md +5 -5
  26. package/skills/developing-cpp/references/comments/examples/declaration-function.md +135 -0
  27. package/skills/developing-cpp/references/comments/examples/declaration-member.md +23 -0
  28. package/skills/developing-cpp/{source/07-comments → references/comments}/examples/declaration-predicate.md +3 -2
  29. package/skills/developing-cpp/references/comments/examples/declaration-struct.md +18 -0
  30. package/skills/developing-cpp/references/comments/examples/implementation-body.md +81 -0
  31. package/skills/developing-cpp/references/comments/glossary/comment-terms.md +92 -0
  32. package/skills/developing-cpp/{source/03-design → references/design}/examples/coordinate-table.md +3 -3
  33. package/skills/developing-cpp/{source/03-design → references/design}/examples/header-place.md +1 -1
  34. package/skills/developing-cpp/references/design/examples/move-result.md +48 -0
  35. package/skills/developing-cpp/references/design/examples/preview-read.md +36 -0
  36. package/skills/developing-cpp/references/design/project-design.md +160 -0
  37. package/skills/developing-cpp/{source/01-editing → references/editing}/01-edit-operations.md +5 -3
  38. package/skills/developing-cpp/{source/01-editing → references/editing}/02-rule-priority.md +2 -2
  39. package/skills/developing-cpp/{source/08-exceptions → references/exceptions}/examples/throw-build-mode.md +4 -4
  40. package/skills/developing-cpp/{source/08-exceptions → references/exceptions}/examples/throw-message.md +10 -3
  41. package/skills/developing-cpp/references/exceptions/throw-rules.md +216 -0
  42. package/skills/developing-cpp/{source/05-language → references/language}/glossary/language-terms.md +2 -2
  43. package/skills/developing-cpp/{source/05-language/01-language-basics → references/language/language-basics}/01-objects.md +8 -2
  44. package/skills/developing-cpp/{source/05-language/01-language-basics → references/language/language-basics}/02-initialization.md +8 -1
  45. package/skills/developing-cpp/{source/05-language/01-language-basics → references/language/language-basics}/03-deduction.md +6 -0
  46. package/skills/developing-cpp/references/language/language-basics/04-const.md +25 -0
  47. package/skills/developing-cpp/references/language/language-basics/05-expressions.md +28 -0
  48. package/skills/developing-cpp/references/language/language-basics/06-functions.md +17 -0
  49. package/skills/developing-cpp/{source/05-language/01-language-basics → references/language/language-basics}/07-classes.md +7 -1
  50. package/skills/developing-cpp/references/language/language-basics/08-raii.md +15 -0
  51. package/skills/developing-cpp/{source/05-language/01-language-basics → references/language/language-basics}/09-templates.md +6 -0
  52. package/skills/developing-cpp/{source/05-language/01-language-basics → references/language/language-basics}/10-checklist.md +2 -1
  53. package/skills/developing-cpp/references/language/performance/01-measure.md +22 -0
  54. package/skills/developing-cpp/{source/05-language/04-performance → references/language/performance}/02-complexity.md +6 -0
  55. package/skills/developing-cpp/{source/05-language/04-performance → references/language/performance}/03-memory.md +7 -1
  56. package/skills/developing-cpp/{source/05-language/04-performance → references/language/performance}/04-undefined-behavior.md +9 -1
  57. package/skills/developing-cpp/{source/05-language/04-performance → references/language/performance}/05-pitfalls.md +6 -0
  58. package/skills/developing-cpp/references/language/performance/06-false-optimizations.md +13 -0
  59. package/skills/developing-cpp/{source/05-language/03-standard-library → references/language/standard-library}/01-containers.md +6 -0
  60. package/skills/developing-cpp/references/language/standard-library/02-access.md +14 -0
  61. package/skills/developing-cpp/{source/05-language/03-standard-library → references/language/standard-library}/03-iteration.md +6 -0
  62. package/skills/developing-cpp/{source/05-language/03-standard-library → references/language/standard-library}/04-algorithms.md +6 -0
  63. package/skills/developing-cpp/{source/05-language/03-standard-library → references/language/standard-library}/05-string.md +6 -0
  64. package/skills/developing-cpp/references/language/standard-library/06-format.md +114 -0
  65. package/skills/developing-cpp/references/language/standard-library/07-time.md +13 -0
  66. package/skills/developing-cpp/references/language/standard-library/08-random.md +13 -0
  67. package/skills/developing-cpp/references/language/standard-library/09-files.md +14 -0
  68. package/skills/developing-cpp/{source/05-language/02-value-types → references/language/value-types}/01-width.md +6 -0
  69. package/skills/developing-cpp/{source/05-language/02-value-types → references/language/value-types}/02-signed.md +7 -1
  70. package/skills/developing-cpp/references/language/value-types/03-integer-roles.md +38 -0
  71. package/skills/developing-cpp/references/language/value-types/04-enum.md +24 -0
  72. package/skills/developing-cpp/{source/05-language/02-value-types → references/language/value-types}/06-const-method.md +5 -0
  73. package/skills/developing-cpp/{source/05-language/02-value-types → references/language/value-types}/07-nodiscard.md +6 -0
  74. package/skills/developing-cpp/references/language/value-types/08-comparison.md +10 -0
  75. package/skills/developing-cpp/{source/05-language/02-value-types → references/language/value-types}/09-subscript.md +2 -1
  76. package/skills/developing-cpp/{source/05-language/02-value-types → references/language/value-types}/10-float-bool.md +6 -0
  77. package/skills/developing-cpp/{source/05-language/02-value-types → references/language/value-types}/11-checklist.md +1 -1
  78. package/skills/developing-cpp/{source/04-layout → references/layout}/01-source-layout.md +8 -3
  79. package/skills/developing-cpp/{source/04-layout → references/layout}/02-file-template.md +14 -8
  80. package/skills/developing-cpp/references/layout/03-declaration-order.md +141 -0
  81. package/skills/developing-cpp/references/naming/examples/naming-accessor.md +28 -0
  82. package/skills/developing-cpp/references/naming/examples/naming-basic.md +3 -0
  83. package/skills/developing-cpp/references/naming/examples/naming-local.md +45 -0
  84. package/skills/developing-cpp/{source/06-naming → references/naming}/examples/naming-lookup.md +1 -1
  85. package/skills/developing-cpp/references/naming/examples/naming-lower-layer.md +46 -0
  86. package/skills/developing-cpp/references/naming/examples/naming-player-value.md +15 -0
  87. package/skills/developing-cpp/{source/06-naming → references/naming}/examples/naming-predicate.md +1 -1
  88. package/skills/developing-cpp/{source/06-naming → references/naming}/examples/naming-role.md +1 -1
  89. package/skills/developing-cpp/references/naming/examples/naming-state-change.md +70 -0
  90. package/skills/developing-cpp/references/naming/glossary/naming-terms.md +23 -0
  91. package/skills/developing-cpp/references/naming/glossary/position.md +23 -0
  92. package/skills/developing-cpp/references/naming/glossary/square.md +47 -0
  93. package/skills/developing-cpp/references/naming/identifier-names.md +109 -0
  94. package/skills/developing-cpp/{source/02-style/01-google-cpp-style.md → references/style/google-cpp-style.md} +14 -13
  95. package/skills/developing-cpp/scripts/checking-comments.mjs +80 -15
  96. package/skills/developing-cpp/scripts/checking-declaration-order.mjs +383 -0
  97. package/skills/developing-cpp/steps/01-behavior.md +5 -5
  98. package/skills/developing-cpp/steps/02-boundary.md +9 -9
  99. package/skills/developing-cpp/steps/03-declaration.md +16 -14
  100. package/skills/developing-cpp/steps/04-implementation.md +22 -18
  101. package/skills/engineering/SKILL.md +43 -40
  102. package/skills/engineering/{cmake → references/cmake}/assets/CompileSettings.cmake +2 -0
  103. package/skills/engineering/{cmake → references/cmake}/linking/01-libraries.md +6 -0
  104. package/skills/engineering/references/cmake/linking/02-rpath.md +25 -0
  105. package/skills/engineering/{cmake → references/cmake}/linking/03-undefined-reference.md +7 -1
  106. package/skills/engineering/{cmake → references/cmake}/linking/04-inspect.md +6 -0
  107. package/skills/engineering/{cmake/02-modules/01-functions.md → references/cmake/modules/functions.md} +8 -5
  108. package/skills/engineering/{cmake/03-standard → references/cmake}/standards/README.md +12 -12
  109. package/skills/engineering/{cmake/03-standard → references/cmake}/standards/c++23/README.md +3 -3
  110. package/skills/engineering/{cmake/03-standard/01-cxx-standard.md → references/cmake/standards/cxx-standard.md} +8 -7
  111. package/skills/engineering/{cmake/01-targets → references/cmake/targets}/examples/target.md +2 -2
  112. package/skills/engineering/{cmake/01-targets/01-rules.md → references/cmake/targets/rules.md} +18 -11
  113. package/skills/engineering/{cmake → references/cmake}/testing/ctest.md +10 -3
  114. package/skills/engineering/{formatting → references/formatting}/01-encoding.md +1 -1
  115. package/skills/engineering/{formatting → references/formatting}/02-clang-format.md +7 -1
  116. package/skills/engineering/{formatting → references/formatting}/03-clang-tidy.md +7 -0
  117. package/skills/engineering/{formatting → references/formatting}/04-clangd.md +7 -0
  118. package/skills/engineering/references/formatting/examples/clang-format.md +38 -0
  119. package/skills/engineering/{formatting → references/formatting}/examples/clang-tidy.md +0 -21
  120. package/skills/engineering/{formatting → references/formatting}/scripts/checking-encoding.mjs +6 -7
  121. package/skills/engineering/{cmake/steps → steps}/01-targets.md +10 -9
  122. package/skills/engineering/{cmake/steps → steps}/02-modules.md +4 -4
  123. package/skills/engineering/{cmake/steps → steps}/03-check.md +5 -3
  124. package/skills/developing-cpp/source/03-design/01-project-design.md +0 -105
  125. package/skills/developing-cpp/source/03-design/examples/move-result.md +0 -39
  126. package/skills/developing-cpp/source/03-design/examples/preview-read.md +0 -40
  127. package/skills/developing-cpp/source/04-layout/03-declaration-order.md +0 -118
  128. package/skills/developing-cpp/source/05-language/01-language-basics/04-const.md +0 -15
  129. package/skills/developing-cpp/source/05-language/01-language-basics/05-expressions.md +0 -8
  130. package/skills/developing-cpp/source/05-language/01-language-basics/06-functions.md +0 -9
  131. package/skills/developing-cpp/source/05-language/01-language-basics/08-raii.md +0 -9
  132. package/skills/developing-cpp/source/05-language/02-value-types/03-integer-roles.md +0 -23
  133. package/skills/developing-cpp/source/05-language/02-value-types/04-enum.md +0 -17
  134. package/skills/developing-cpp/source/05-language/02-value-types/08-comparison.md +0 -4
  135. package/skills/developing-cpp/source/05-language/03-standard-library/02-access.md +0 -8
  136. package/skills/developing-cpp/source/05-language/03-standard-library/06-format.md +0 -44
  137. package/skills/developing-cpp/source/05-language/03-standard-library/07-time.md +0 -3
  138. package/skills/developing-cpp/source/05-language/03-standard-library/08-random.md +0 -3
  139. package/skills/developing-cpp/source/05-language/03-standard-library/09-files.md +0 -4
  140. package/skills/developing-cpp/source/05-language/04-performance/01-measure.md +0 -15
  141. package/skills/developing-cpp/source/05-language/04-performance/06-false-optimizations.md +0 -6
  142. package/skills/developing-cpp/source/06-naming/01-identifier-names.md +0 -78
  143. package/skills/developing-cpp/source/06-naming/examples/naming-accessor.md +0 -17
  144. package/skills/developing-cpp/source/06-naming/examples/naming-basic.md +0 -3
  145. package/skills/developing-cpp/source/06-naming/examples/naming-lower-layer.md +0 -39
  146. package/skills/developing-cpp/source/06-naming/examples/naming-player-mark.md +0 -17
  147. package/skills/developing-cpp/source/06-naming/examples/naming-state-change.md +0 -57
  148. package/skills/developing-cpp/source/07-comments/01-comment-rules.md +0 -239
  149. package/skills/developing-cpp/source/07-comments/examples/declaration-class.md +0 -44
  150. package/skills/developing-cpp/source/07-comments/examples/declaration-constructor.md +0 -22
  151. package/skills/developing-cpp/source/07-comments/examples/declaration-enum.md +0 -24
  152. package/skills/developing-cpp/source/07-comments/examples/declaration-function.md +0 -100
  153. package/skills/developing-cpp/source/07-comments/examples/declaration-member.md +0 -25
  154. package/skills/developing-cpp/source/07-comments/examples/declaration-struct.md +0 -18
  155. package/skills/developing-cpp/source/07-comments/examples/implementation-body.md +0 -42
  156. package/skills/developing-cpp/source/07-comments/glossary/comment-terms.md +0 -75
  157. package/skills/developing-cpp/source/08-exceptions/01-throw-rules.md +0 -160
  158. package/skills/engineering/cmake/linking/02-rpath.md +0 -17
  159. package/skills/engineering/formatting/examples/clang-format.md +0 -17
  160. /package/skills/developing-cpp/{source/07-comments → references/comments}/examples/implementation-todo.md +0 -0
  161. /package/skills/developing-cpp/{source/03-design → references/design}/examples/behavior-sentence.md +0 -0
  162. /package/skills/developing-cpp/{source/03-design → references/design}/examples/library-boundary.md +0 -0
  163. /package/skills/developing-cpp/{source/03-design → references/design}/examples/library-split.md +0 -0
  164. /package/skills/developing-cpp/{source/08-exceptions → references/exceptions}/examples/throw-boundary.md +0 -0
  165. /package/skills/developing-cpp/{source/08-exceptions → references/exceptions}/examples/throw-catch.md +0 -0
  166. /package/skills/developing-cpp/{source/08-exceptions → references/exceptions}/examples/throw-destructor.md +0 -0
  167. /package/skills/developing-cpp/{source/08-exceptions → references/exceptions}/examples/throw-format.md +0 -0
  168. /package/skills/developing-cpp/{source/08-exceptions → references/exceptions}/examples/throw-when.md +0 -0
  169. /package/skills/developing-cpp/{source/05-language/04-performance → references/language/performance}/07-checklist.md +0 -0
  170. /package/skills/developing-cpp/{source/05-language/03-standard-library → references/language/standard-library}/10-checklist.md +0 -0
  171. /package/skills/developing-cpp/{source/05-language/02-value-types → references/language/value-types}/05-strong-type.md +0 -0
  172. /package/skills/developing-cpp/{source/06-naming → references/naming}/examples/naming-current-prefix.md +0 -0
  173. /package/skills/developing-cpp/{source/06-naming → references/naming}/examples/naming-multiple-return.md +0 -0
  174. /package/skills/developing-cpp/{source/06-naming → references/naming}/examples/naming-rename.md +0 -0
  175. /package/skills/developing-cpp/{source/06-naming → references/naming}/examples/naming-responsibility.md +0 -0
  176. /package/skills/engineering/{cmake → references/cmake}/assets/LinkSettings.cmake +0 -0
  177. /package/skills/engineering/{cmake/03-standard → references/cmake}/standards/c++11/README.md +0 -0
  178. /package/skills/engineering/{cmake/03-standard → references/cmake}/standards/c++11/cmake-snippet.cmake +0 -0
  179. /package/skills/engineering/{cmake/03-standard → references/cmake}/standards/c++14/README.md +0 -0
  180. /package/skills/engineering/{cmake/03-standard → references/cmake}/standards/c++14/cmake-snippet.cmake +0 -0
  181. /package/skills/engineering/{cmake/03-standard → references/cmake}/standards/c++17/README.md +0 -0
  182. /package/skills/engineering/{cmake/03-standard → references/cmake}/standards/c++17/cmake-snippet.cmake +0 -0
  183. /package/skills/engineering/{cmake/03-standard → references/cmake}/standards/c++20/README.md +0 -0
  184. /package/skills/engineering/{cmake/03-standard → references/cmake}/standards/c++20/cmake-snippet.cmake +0 -0
  185. /package/skills/engineering/{cmake/03-standard → references/cmake}/standards/c++23/cmake-snippet.cmake +0 -0
  186. /package/skills/engineering/{cmake/03-standard → references/cmake/standards}/examples/standard.md +0 -0
  187. /package/skills/engineering/{cmake/01-targets → references/cmake/targets}/examples/glob.md +0 -0
  188. /package/skills/engineering/{cmake/01-targets → references/cmake/targets}/examples/rpath.md +0 -0
  189. /package/skills/engineering/{formatting → references/formatting}/examples/clangd.md +0 -0
package/README.en.md CHANGED
@@ -2,47 +2,53 @@
2
2
 
3
3
  [中文](README.md)
4
4
 
5
- Three skills for C++11–C++23 source, CMake, and build work; new projects default to C++23. The plugin registers a skill provider and a settings form; it does not register tools, compile, download a toolchain, or write project files.
5
+ Three skills for C++11–C++23 source, CMake, and build work; new projects default to C++23. The plugin registers a skill provider and a settings form; it does not register tools, compile, download a toolchain, or write project files; it keeps no runtime cache and writes no temporary files, and the host persists settings.
6
6
 
7
7
  ## What it provides
8
8
 
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
- | `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
- | `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 |
12
+ | `engineering` | Targets, modules, checks; CMakeLists.txt, `cmake/` functions and modules, target properties, C++11–C++23 standards, and configuration rules for `.clang-format`/`.clang-tidy`/`.clangd` | The change touches CMake targets, standards, link boundaries, functions, modules, or encoding and clang tooling configuration |
13
+ | `building-cpp` | Build setup, tool configuration, checks; Ninja, Clang config, build scripts, environment combinations, formatting configuration, and static analysis | The change touches build commands, tool configuration, or the environment declaration, or the project is first connected to a build |
14
14
 
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.
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 lists these skills.
16
16
 
17
17
  ## Install
18
18
 
19
- Pinned npm install:
19
+ Fixed-version npm install:
20
20
 
21
21
  ```bash
22
- dsh plugin --profile web add npm:@chengzhao-dev/dsh-cpp-workflow@0.6.20
22
+ dsh plugin --profile <profile> add npm:@chengzhao-dev/dsh-cpp-workflow@0.7.1
23
23
  ```
24
24
 
25
- The matching Git tag:
25
+ The latest published version is `0.7.1`; `0.7.3` exists only in the working tree and is not published yet, so use `0.7.1` above until it is released. After the working-tree version is published, switch the npm command to:
26
26
 
27
27
  ```bash
28
- dsh plugin --profile web add github:chengzhao-dev/dsh-cpp-workflow#v0.6.20
28
+ dsh plugin --profile <profile> add npm:@chengzhao-dev/dsh-cpp-workflow@0.7.3
29
29
  ```
30
30
 
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.
31
+ GitHub tag installs require the matching tag; once `v0.7.3` is created, the version in the address matches the tag:
32
+
33
+ ```bash
34
+ dsh plugin --profile <profile> add github:chengzhao-dev/dsh-cpp-workflow#v0.7.3
35
+ ```
36
+
37
+ 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.
32
38
 
33
39
  ### Settings
34
40
 
35
- The plugin page's "C++ Workflow" card is the only entry point and manages file-header tags only: `@file` is always the file name, and every file-header, type, and declaration tag is on by default except the fixed `//` body symbol; empty values are skipped. `@param` is required for every parameter; `@return` may be omitted when the condition is self-evident; `@throws` only when the function throws; `@pre`, `@post`, `@retval`, `@tparam`, `@note`, and `@see` are on by default and can be switched off individually. The preview follows the switches, saving takes effect on the next skill read, and existing sources are never rewritten. Settings navigation no longer duplicates the form.
41
+ The plugin page's "C++ Workflow" card is the only entry point and manages the comment symbol and file-header tags: the symbol is `///` or `/** ... */`, `@file` is always the file name, and every file-header, type, and declaration tag is on by default except the fixed `//` body symbol; empty values are skipped. `@param` is required for every parameter; `@return` may be omitted when the condition is self-evident; `@throws` only when the function throws; `@pre`, `@post`, `@retval`, `@tparam`, `@note`, and `@see` are on by default and can be switched off individually. The preview follows the switches, saving takes effect on the next skill read, and existing sources are never rewritten. The plugin page no longer duplicates navigation.
36
42
 
37
- If the page still reports that it is not connected to a configuration form after an upgrade, the window is still running the previous client bundle: restart DeepSeek Harness or select "Reload page" on the plugin page. The page retries the connection while open and switches to the editable form as soon as the host serves it; reinstalling is unnecessary. Discard changes, Restore defaults and Save are separate: discard returns to the last value read from the host, restore fills the draft, and only Save writes it.
43
+ If the page still reports that it is not connected to a configuration form after an upgrade, the window is still running the previous client bundle: restart DeepSeek Harness or select "Reload page" on the plugin page. The page retries the connection while open and switches to the editable form as soon as the host serves it; reinstalling is unnecessary. After a successful save, the status line shows the written `~/.dsh/profiles/<profile>/cordis.patch.yml`. Discard changes, Restore defaults and Save are separate: discard returns to the last value read from the host, restore fills the draft, and only Save writes it.
38
44
 
39
45
  ## Workspace gate
40
46
 
41
- Only one condition must hold before either skill appears: walking up from the current directory to the Git root, the path contains `.agents/skills/cpp-workflow-project/SKILL.md`.
47
+ Only one condition must hold before any of the three skills appears: walking up from the current directory to the Git root, the path contains `.agents/skills/cpp-workflow-project/SKILL.md`.
42
48
 
43
49
  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
50
 
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.
51
+ The packaged skills use rank 550. A project `.agents/skills` skill uses rank 200 and a user-level skill uses rank 500; both override a plugin skill with the same name, so do not copy `developing-cpp`, `engineering`, or `building-cpp` into either location.
46
52
 
47
53
  ## Project conventions
48
54
 
@@ -64,7 +70,7 @@ Keep one `environment.json` per repository. Its first three environment axes are
64
70
  | `compiler` | `clang`, `gcc` | One compiler per configuration |
65
71
  | `standard` | `c++11`, `c++14`, `c++17`, `c++20`, `c++23` | New projects default to `c++23`; one standard per project |
66
72
 
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).
73
+ 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/references/cmake/standards/README.md); the CMake two-layer declaration is in [cxx-standard.md](skills/engineering/references/cmake/standards/cxx-standard.md).
68
74
 
69
75
  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
76
 
@@ -81,24 +87,9 @@ The project root carries only `.vscode/extensions.json` and `settings.json`: cla
81
87
 
82
88
  ## Package layout
83
89
 
84
- ```text
85
- dsh-cpp-workflow/
86
- ├── lib/ # build output, shipped in the npm package
87
- ├── skills/ # developing-cpp, engineering, and building-cpp
88
- ├── templates/ # empty project template to copy
89
- ├── package.json
90
- ├── package-lock.json # repository only, used by npm ci
91
- ├── LICENSE
92
- ├── README.md
93
- ├── README.en.md
94
- ├── cordis.patch.yml # one insert row
95
- ├── locale/ # Chinese and English title/description
96
- └── icon.svg
97
- ```
98
-
99
- The repository also keeps `src/`, `scripts/`, `tests/` and `docs/` for development and review; they are not published. The whitelist lives in [docs/plugin-layout.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/plugin-layout.md).
90
+ The runtime closure is `lib/`, `skills/`, `templates/`, `locale/`, `cordis.patch.yml`, both READMEs, `LICENSE`, and `icon.svg`. The repository also keeps `src/`, `scripts/`, `tests/`, and `docs/` for development and review; they are not published. The authoritative whitelist and per-directory map live in [docs/plugin-layout.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/plugin-layout.md).
100
91
 
101
- Maintenance notes: flow and gate in [docs/plugin-flow.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/plugin-flow.md), skill layers and data flow in [docs/architecture.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/architecture.md), trigger matrix in [docs/triggering.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/triggering.md), directory and npm whitelist in [docs/plugin-layout.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/plugin-layout.md), version rules in [docs/versioning.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/versioning.md).
92
+ Maintenance notes: flow and gate in [docs/plugin-flow.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/plugin-flow.md), skill layers and data flow in [docs/architecture.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/architecture.md), trigger matrix in [docs/triggering.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/triggering.md), directory and npm whitelist in [docs/plugin-layout.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/plugin-layout.md), runtime disk and cache boundaries in [docs/plugin-storage.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/plugin-storage.md), version rules in [docs/versioning.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/versioning.md).
102
93
 
103
94
  ## Local development
104
95
 
@@ -106,7 +97,7 @@ Requires Node.js 22 or newer.
106
97
 
107
98
  ```bash
108
99
  npm ci
109
- npm test # build, three-skill structural check, gate/environment/schema/comment tests
100
+ npm test # build, structural/encoding/workflow checks, and 11 unit-test files
110
101
  npm run test:matrix # real build matrix: 4 templates x 5 standards
111
102
  npm run pack:check # inspect the npm package contents
112
103
  npm run ci # replay the Ubuntu CI job: install, test, package check
package/README.md CHANGED
@@ -2,47 +2,53 @@
2
2
 
3
3
  [English](README.en.md)
4
4
 
5
- 把 C++11–C++23 的源码、CMake 与构建工作收成三个技能,新工程默认 C++23。插件注册技能 provider 与设置面,不注册工具、不编译、不下载工具链、不写项目文件。
5
+ 把 C++11–C++23 的源码、CMake 与构建工作整理成三个技能,新工程默认 C++23。插件注册技能 provider 与设置面,不注册工具、不编译、不下载工具链、不写项目文件;运行时不建缓存、不写临时文件,设置由宿主保存。
6
6
 
7
7
  ## 提供什么
8
8
 
9
9
  | 技能 | 管什么 | 什么时候打开 |
10
10
  | --- | --- | --- |
11
11
  | `developing-cpp` | 定行为、定边界、定声明、定实现;`.h` / `.cpp` / `.cc` 的命名、异常和源码注释 | 用户点名源码,或需要新建/整段重构源码 |
12
- | `engineering` | 定 target、定模块、通过检查;CMakeLists.txt、`cmake/` 函数与模块、target 属性、C++11–C++23 标准,以及 `.clang-format`/`.clang-tidy`/`.clangd` 配置 | 改动落在 CMake target、标准、链接边界、函数或模块,或落在编码与 clang 工具配置上 |
13
- | `building-cpp` | 定构建、定工具配置、通过检查;Ninja、Clang 配置、构建脚本、环境组合、格式化与静态检查 | 改动落在构建命令、工具配置或环境声明上,或第一次接构建 |
12
+ | `engineering` | 定 target、定模块、通过检查;CMakeLists.txt、`cmake/` 函数与模块、target 属性、C++11–C++23 标准,以及 `.clang-format`/`.clang-tidy`/`.clangd` 的配置条文 | 改动落在 CMake target、标准、链接边界、函数或模块,或落在编码与 clang 工具配置上 |
13
+ | `building-cpp` | 定构建、定工具配置、通过检查;Ninja、Clang 配置、构建脚本、环境组合、排版工具的配置与检查 | 改动落在构建命令、工具配置或环境声明上,或第一次接构建 |
14
14
 
15
- 异常条文采用 C++ Core Guidelines 的 Error handling,只在开发阶段指导源码和示例;插件运行时不编译、不执行这些规则。三个技能都先读项目技能 `cpp-workflow-project`。没有项目技能时,门禁不会放出这三个名字。
15
+ 异常条文采用 C++ Core Guidelines 的 Error handling,只在开发阶段指导源码和示例;插件运行时不编译、不执行这些规则。三个技能都先读项目技能 `cpp-workflow-project`。没有项目技能时,门禁不会列出这三个技能。
16
16
 
17
17
  ## 安装
18
18
 
19
- npm 安装钉死版本:
19
+ npm 安装固定版本:
20
20
 
21
21
  ```bash
22
- dsh plugin --profile web add npm:@chengzhao-dev/dsh-cpp-workflow@0.6.20
22
+ dsh plugin --profile <profile> add npm:@chengzhao-dev/dsh-cpp-workflow@0.7.1
23
23
  ```
24
24
 
25
- 同版本的 Git 标签:
25
+ npm 当前最新发布是 `0.7.1`;仓库工作区里的 `0.7.3` 尚未发布,发布前请用上面的 0.7.1。工作区版本发布后,把 npm 命令换成:
26
26
 
27
27
  ```bash
28
- dsh plugin --profile web add github:chengzhao-dev/dsh-cpp-workflow#v0.6.20
28
+ dsh plugin --profile <profile> add npm:@chengzhao-dev/dsh-cpp-workflow@0.7.3
29
29
  ```
30
30
 
31
- 桌面应用独占 `desktop` profile。命令行 `add` 被拒绝时,在应用设置里添加插件,地址填同一个 npm 版本。Git 标签安装使用仓库内已构建的 `lib/`,不在目标机器上重新构建;包内也不含需要授权执行的安装脚本。
31
+ GitHub 标签安装要等 `v0.7.3` 创建后再用;标签创建后,地址中的版本号与标签同号:
32
+
33
+ ```bash
34
+ dsh plugin --profile <profile> add github:chengzhao-dev/dsh-cpp-workflow#v0.7.3
35
+ ```
36
+
37
+ `--profile` 换成你实际运行的那个 profile。桌面应用固定跑 `desktop` profile,且该 profile 由应用独占管理;命令行 `add` 被拒绝时,在应用设置里添加插件,地址填同一个 npm 版本。Git 标签安装使用仓库内已构建的 `lib/`,不在目标机器上重新构建;包内也不含需要授权执行的安装脚本。
32
38
 
33
39
  ### 设置
34
40
 
35
- 插件页的「C++ 工程流程」是唯一入口:注释符号可选 `///` 或 `/** ... */`,页面按注释符号、文件头、类型、函数声明与只读预览分块。`@file` 固定为文件名;除它和函数体 `//` 外,文件头、类型与函数声明标签的开关出厂全开,空值跳过。函数参数要求 `@param`,返回值要求 `@return`(成立条件自明时可省),会抛才要求 `@throws`;`@pre`、`@post`、`@retval` 与类型块的 `@tparam`、`@note`、`@see` 也出厂开启,需要时可逐项关掉。函数体固定用 `//`。预览随改动即时更新,保存后下一次读取技能即生效,已有源码不会被改写。设置导航不再重复放一份。
41
+ 插件页的「C++ 工程流程」是唯一入口:注释符号可选 `///` 或 `/** ... */`,页面按注释符号、文件头、类型、函数声明与只读预览分块。`@file` 固定为文件名;除它和函数体 `//` 外,文件头、类型与函数声明标签的开关出厂全开,空值跳过。函数参数要求 `@param`,返回值要求 `@return`(成立条件自明时可省),会抛才要求 `@throws`;`@pre`、`@post`、`@retval` 与类型块的 `@tparam`、`@note`、`@see` 也出厂开启,需要时可逐项关掉。函数体固定用 `//`。预览随改动即时更新,保存后下一次读取技能即生效,已有源码不会被改写。插件页不再重复列一份导航。
36
42
 
37
- 升级插件后如果这一页暂时只显示出厂值,说明当前窗口还挂着旧的前端产物:页脚会显示写入的 `~/.dsh/profiles/<profile>/cordis.patch.yml`,并提示重载;重启 DeepSeek Harness,或在插件页点“重新载入页面”即可编辑,不需要重装插件。页面会在打开后自动重试连接,拿到表单就切换为可编辑。保存、撤销修改与恢复默认值分三个按钮:撤销只回到最近一次读到的值,恢复默认值只填草稿,点保存才写盘。
43
+ 升级插件后如果这一页暂时只显示出厂值,说明当前窗口还挂着旧的前端产物:重启 DeepSeek Harness,或在插件页点“重新载入页面”即可编辑,不需要重装插件。页面会在打开后自动重试连接,拿到表单就切换为可编辑;保存成功后,状态行会显示写入的 `~/.dsh/profiles/<profile>/cordis.patch.yml`。保存、撤销修改与恢复默认值分三个按钮:撤销只回到最近一次读到的值,恢复默认值只填草稿,点保存才写盘。
38
44
 
39
45
  ## 工作区门禁
40
46
 
41
- 一个会话里只需要满足一件事,技能就会出现:从当前目录向上、停在 git 根,沿途有 `.agents/skills/cpp-workflow-project/SKILL.md`。
47
+ 会话满足一个条件,技能就会出现:从当前目录向上、停在 git 根,沿途有 `.agents/skills/cpp-workflow-project/SKILL.md`。
42
48
 
43
49
  项目技能标记就是仓库选择加入本工作流的声明。插件不再要求同一仓库里已经有第一方 `CMakeLists.txt` 或 C++ 源文件:纯文档仓库、只复制了模板、还没有任何源文件的仓库也会出现;环境轴为空时,源码四步仍能做,但定构建会停。没有标记就返回空列表,即使仓库里有 CMake 或 `.cpp`。扫描上限和边界情形见 [docs/plugin-boundaries.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/plugin-boundaries.md)。
44
50
 
45
- 插件技能 rank 550。项目自己的 `.agents/skills` 技能 rank 200,会以同名覆盖插件;不要在项目里复制 `developing-cpp`、`engineering` 或 `building-cpp`。
51
+ 插件技能 rank 550。项目自己的 `.agents/skills` 技能 rank 200、用户级技能 rank 500,两者都会以同名覆盖插件;不要在项目或用户目录里复制 `developing-cpp`、`engineering` 或 `building-cpp`。
46
52
 
47
53
  ## 项目级约定
48
54
 
@@ -64,7 +70,7 @@ dsh plugin --profile web add github:chengzhao-dev/dsh-cpp-workflow#v0.6.20
64
70
  | `compiler` | `clang`、`gcc` | 一次配置一个编译器 |
65
71
  | `standard` | `c++11`、`c++14`、`c++17`、`c++20`、`c++23` | 新工程默认 `c++23`;一个工程一个标准 |
66
72
 
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)。
73
+ 标准写在 `environment.json` 的 `standard`,并同步到 CMake target 和编译数据库;CMake 侧优先调用 `engineering` 提供的 `CompileSettings_SetCxxStandard` 函数。新工程默认 C++23;C++11–C++20 工程把 `standard`、`cxx_std_*`、`CXX_STANDARD` 和 `.clang-format` 的解析档位一起降级,不要只改一处。每档的设施、工具和降档表见 [标准目录](skills/engineering/references/cmake/standards/README.md),CMake 两层声明见 [cxx-standard.md](skills/engineering/references/cmake/standards/cxx-standard.md)。
68
74
 
69
75
  生成器固定 Ninja,构建目录是 `build/clang/` 与 `build/gcc/`,不共用 `build/`。诊断工具固定 `clang-format`、`clang-tidy`、`clangd`;GCC 模式也不换成别的分析器。
70
76
 
@@ -81,24 +87,9 @@ node "<skill-dir>/scripts/checking-environment.mjs" --project . --live
81
87
 
82
88
  ## 包结构
83
89
 
84
- ```text
85
- dsh-cpp-workflow/
86
- ├── lib/ # 构建产物,随 npm 包发布
87
- ├── skills/ # developing-cpp、engineering 与 building-cpp
88
- ├── templates/ # 复制到项目的空模板
89
- ├── package.json
90
- ├── package-lock.json # 只在仓库,供 npm ci
91
- ├── LICENSE
92
- ├── README.md
93
- ├── README.en.md
94
- ├── cordis.patch.yml # 只 insert 一行
95
- ├── locale/ # 中英文标题与描述
96
- └── icon.svg
97
- ```
98
-
99
- 仓库另有 `src/`、`scripts/`、`tests/` 与 `docs/`,只服务开发与评审,不进包;白名单见 [docs/plugin-layout.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/plugin-layout.md)。
90
+ 运行时闭包是 `lib/`、`skills/`、`templates/`、`locale/`、`cordis.patch.yml`、两个 README、`LICENSE` 与 `icon.svg`。仓库另有 `src/`、`scripts/`、`tests/` 与 `docs/`,只服务开发与评审,不进包。权威白名单与逐项目录见 [docs/plugin-layout.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/plugin-layout.md)。
100
91
 
101
- 边界与门禁的维护说明在 [docs/plugin-flow.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/plugin-flow.md),技能的层次与数据流在 [docs/architecture.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/architecture.md),触发矩阵在 [docs/triggering.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/triggering.md),目录和进包白名单在 [docs/plugin-layout.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/plugin-layout.md),版本规则在 [docs/versioning.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/versioning.md)。
92
+ 边界与门禁的维护说明在 [docs/plugin-flow.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/plugin-flow.md),技能的层次与数据流在 [docs/architecture.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/architecture.md),触发矩阵在 [docs/triggering.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/triggering.md),目录和进包白名单在 [docs/plugin-layout.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/plugin-layout.md),运行时磁盘与缓存边界在 [docs/plugin-storage.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/plugin-storage.md),版本规则在 [docs/versioning.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/versioning.md)。
102
93
 
103
94
  ## 本地开发
104
95
 
@@ -106,10 +97,10 @@ dsh-cpp-workflow/
106
97
 
107
98
  ```bash
108
99
  npm ci
109
- npm test # 构建、三技能结构检查、门禁/环境/schema/注释测试
100
+ npm test # 构建、结构/编码/工作流检查与 11 组单元测试
110
101
  npm run test:matrix # 四套模板 × 五档标准的真实构建矩阵
111
102
  npm run pack:check # 核对 npm 包内容
112
- npm run ci # 复现 Ubuntu CI:安装、测试、打包检查
103
+ npm run ci # 复现 Ubuntu CI:安装、测试、打包检查(不含标准矩阵)
113
104
  npm run ci:full # 在 ci 之上再跑标准矩阵,需 POSIX 宿主
114
105
  ```
115
106
 
package/cordis.patch.yml CHANGED
@@ -1,11 +1,11 @@
1
- # dsh-cpp-workflow bundle patch.
1
+ # dsh-cpp-workflow 的 bundle patch。
2
2
  #
3
- # Additive only: insert one host row. No official row is edited, disabled or
4
- # replaced. The row loads this package's `main` entry, which registers the
5
- # packaged developing-cpp and building-cpp skills through `ctx.skills`.
3
+ # 只做追加:插入一行宿主配置。不改写、不关闭、不替换任何官方行。这一行加载
4
+ # 本包的 `main` 入口,由它通过 `ctx.skills` 注册 developing-cpp、engineering 与
5
+ # building-cpp 三份技能。
6
6
  #
7
- # Install with `dsh plugin --profile <name> add <package>`. Pinned npm and Git
8
- # tag addresses are in the README's Install section.
7
+ # 用 `dsh plugin --profile <name> add <package>` 安装。固定到 npm 版本与 Git
8
+ # 标签的地址写在 README 的 Install 一节。
9
9
  - insert:
10
10
  - id: cpp-workflow
11
11
  name: "@chengzhao-dev/dsh-cpp-workflow"
package/lib/client.js CHANGED
@@ -9,7 +9,7 @@ window.__ModuleLoader__.load({
9
9
  * 注释标签策略:设置页的预览、技能快照与检查器参数共用这一份。
10
10
  *
11
11
  * 配置只描述「写注释时默认带哪些标签、声明用哪种注释符号」,不描述写法本身;
12
- * 写法在 `skills/developing-cpp/source/07-comments/01-comment-rules.md`。设置页保存的值由宿主
12
+ * 写法在 `skills/developing-cpp/references/comments/comment-rules.md`。设置页保存的值由宿主
13
13
  * 写回插件 Config,服务端 `apply(ctx, config)` 用它生成本页快照与检查器参数。
14
14
  *
15
15
  * 这份文件被 `tsc` 编进 `lib/comment-policy.js`,打包客户端半侧时再内联进
@@ -201,18 +201,27 @@ function checkerArgs(raw) {
201
201
  /**
202
202
  * 技能快照:`get()` 把它接在技能正文末尾,让代理看到当前 profile 的标签开关。
203
203
  * 只写一行,列出声明符号、开启与关闭的标签,避免正文膨胀。
204
+ * `@author` 等只认默认值的文件头标签开着却没填值时单列为「未填值」:这种标签
205
+ * 不会写进文件,与「关闭」不是一回事,代理据此既不会漏写,也不会补空标签。
206
+ * `@brief` 的正文按文件写,没有默认值也仍列为开启。
204
207
  */
205
208
  function snapshotText(raw) {
206
209
  const config = normalizeConfig(raw);
207
210
  const on = ['@file'];
211
+ const unset = [];
208
212
  const off = [];
209
213
  for (const tag of HEADER_TAGS) {
210
214
  const entry = config[tag];
211
- const label = entry.value ? `${TAG_LABEL[tag]} ${entry.value}` : TAG_LABEL[tag];
212
- if (entry.enabled)
213
- on.push(label);
214
- else
215
+ if (!entry.enabled) {
215
216
  off.push(TAG_LABEL[tag]);
217
+ }
218
+ else if (tag === 'brief' || entry.value) {
219
+ // @brief 的正文按文件写,没有默认值也仍要出现;其余文件头标签只认填了的默认值。
220
+ on.push(entry.value ? `${TAG_LABEL[tag]} ${entry.value}` : TAG_LABEL[tag]);
221
+ }
222
+ else {
223
+ unset.push(TAG_LABEL[tag]);
224
+ }
216
225
  }
217
226
  for (const tag of [...CONTRACT_TAGS, ...EXTRA_TAGS]) {
218
227
  if (config[tag])
@@ -221,14 +230,14 @@ function snapshotText(raw) {
221
230
  off.push(TAG_LABEL[tag]);
222
231
  }
223
232
  const style = config.commentStyle === 'block' ? '/** ... */' : '///';
224
- const line = `- 声明符号:${style}(函数体固定 //);开启 ${on.join('、')};关闭 ${off.join('、') || '无'}。`;
233
+ const line = `- 声明符号:${style}(函数体固定 //);开启 ${on.join('、')};未填值 ${unset.join('、') || '无'};关闭 ${off.join('、') || '无'}。`;
225
234
  return `## 当前注释配置(profile)\n\n${line}`;
226
235
  }
227
236
 
228
237
 
229
238
  // 客户端半侧:插件页的配置卡片(plugins.bundle.config),只此一个入口。
230
- // 标签策略在本文件上方内联(由 scripts/building-client.mjs 从 src/comment-policy.js
231
- // 拼进来),所以预览、默认值与服务端快照永远同源;这里只做表单与外观。
239
+ // 标签策略在本文件上方内联(由 scripts/building-client.mjs 读取
240
+ // lib/comment-policy.js 后拼进来),所以预览、默认值与服务端快照永远同源;这里只做表单与外观。
232
241
  const React = require('react')
233
242
  const h = React.createElement
234
243
 
@@ -613,9 +622,6 @@ function useFormSnapshot(form) {
613
622
 
614
623
  // 宿主组合包 cordis.patch.yml 插入的 profile 条目 id;设置服务按它定位表单。
615
624
  const ENTRY_ID = 'cpp-workflow'
616
- // configForms 可能晚于本插件挂载;页面在首次绘制后短暂重试,拿不到再给手动恢复入口。
617
- const FORM_RETRY_MS = 500
618
- const MAX_FORM_RETRIES = 20
619
625
 
620
626
  /** 文件头可填写标签的占位文字;顺序与 HEADER_TAGS 一致。 */
621
627
  const HEADER_PLACEHOLDER = {
@@ -642,17 +648,20 @@ const FLAG_PLACEHOLDER = {
642
648
  function ConfigPage(props) {
643
649
  const s = t()
644
650
  ensureStyles()
645
- // form 由挂点注入;resolveForm 兜住“服务晚到”的部署,拿到后下一次绘制自动接上。
646
- const form = props.form || (typeof props.resolveForm === 'function' ? props.resolveForm() : undefined)
651
+ // 宿主把 configForms 列为必需注入,挂载时取一次表单;之后沿用同一个 controller,
652
+ // 不在每次绘制里调用宿主服务。
653
+ const [form] = React.useState(
654
+ () => props.form || (typeof props.resolveForm === 'function' ? props.resolveForm() : undefined),
655
+ )
647
656
  const state = useFormSnapshot(form)
648
657
  const initial = React.useMemo(() => normalizeConfig(state.value), [])
649
658
  const [draft, setDraft] = React.useState(initial)
650
659
  const [base, setBase] = React.useState(initial)
651
660
  const [dirty, setDirty] = React.useState(false)
661
+ const [baseRevision, setBaseRevision] = React.useState(state.revision)
652
662
  const [busy, setBusy] = React.useState(false)
653
663
  const [message, setMessage] = React.useState('')
654
664
  const [tone, setTone] = React.useState('')
655
- const [attempt, setAttempt] = React.useState(0)
656
665
  const revision = state.revision
657
666
  // 快照只有 status / writable / revision;旧版本多出来的 mode 字段已不存在,
658
667
  // 再按它判断会把所有可写表单误判成只读。
@@ -664,15 +673,10 @@ function ConfigPage(props) {
664
673
  if (dirty || state.status !== 'ready') return
665
674
  const next = normalizeConfig(state.value)
666
675
  setBase(next)
676
+ setBaseRevision(state.revision)
667
677
  setDraft(next)
668
678
  }, [revision, status, dirty, form, state.value])
669
679
 
670
- React.useEffect(() => {
671
- if (form || attempt >= MAX_FORM_RETRIES || typeof setTimeout !== 'function') return undefined
672
- const timer = setTimeout(() => setAttempt((value) => value + 1), FORM_RETRY_MS)
673
- return () => clearTimeout(timer)
674
- }, [form, attempt])
675
-
676
680
  // 脏标记按与已保存值的差集算:把开关关了又开回原值时,页面不该再说“有未保存的改动”。
677
681
  const update = (patch) => {
678
682
  const next = { ...draft, ...patch }
@@ -711,8 +715,12 @@ function ConfigPage(props) {
711
715
  if (operations.length === 0) return
712
716
  setBusy(true)
713
717
  try {
714
- const accepted = await form.mutate(operations, revision)
718
+ // 基准 revision 与 base 同时记录:草稿期间外部若改过配置,这里传旧 revision,
719
+ // 宿主会拒绝,不会用新 revision 把旧草稿盖上去。
720
+ const accepted = await form.mutate(operations, baseRevision)
715
721
  if (accepted) {
722
+ const fresh = snapshotOf(form)
723
+ if (fresh && fresh.status === 'ready') setBaseRevision(fresh.revision)
716
724
  setBase(draft)
717
725
  setDirty(false)
718
726
  setMessage(s.saved)
@@ -720,7 +728,10 @@ function ConfigPage(props) {
720
728
  } else {
721
729
  // 被拒时宿主已刷新镜像;把基准对齐到新快照,撤销才不会回到过期值。
722
730
  const fresh = snapshotOf(form)
723
- if (fresh && fresh.status === 'ready') setBase(normalizeConfig(fresh.value))
731
+ if (fresh && fresh.status === 'ready') {
732
+ setBase(normalizeConfig(fresh.value))
733
+ setBaseRevision(fresh.revision)
734
+ }
724
735
  setMessage(s.rejected)
725
736
  setTone('warn')
726
737
  }
@@ -870,7 +881,8 @@ function apply(ctx) {
870
881
  if (ctx.configForms && typeof ctx.configForms.whileServed === 'function') {
871
882
  ctx.effect(() => ctx.configForms.whileServed([ENTRY_ID], mount), 'dsh-cpp-workflow: 配置挂点')
872
883
  } else {
873
- mount()
884
+ // 旧宿主没有 whileServed 时也交给效果作用域注销挂点,卸载后不留悬挂注册。
885
+ ctx.effect(() => mount(), 'dsh-cpp-workflow: 配置挂点')
874
886
  }
875
887
  }
876
888
 
@@ -2,7 +2,7 @@
2
2
  * 注释标签策略:设置页的预览、技能快照与检查器参数共用这一份。
3
3
  *
4
4
  * 配置只描述「写注释时默认带哪些标签、声明用哪种注释符号」,不描述写法本身;
5
- * 写法在 `skills/developing-cpp/source/07-comments/01-comment-rules.md`。设置页保存的值由宿主
5
+ * 写法在 `skills/developing-cpp/references/comments/comment-rules.md`。设置页保存的值由宿主
6
6
  * 写回插件 Config,服务端 `apply(ctx, config)` 用它生成本页快照与检查器参数。
7
7
  *
8
8
  * 这份文件被 `tsc` 编进 `lib/comment-policy.js`,打包客户端半侧时再内联进
@@ -194,18 +194,27 @@ export function checkerArgs(raw) {
194
194
  /**
195
195
  * 技能快照:`get()` 把它接在技能正文末尾,让代理看到当前 profile 的标签开关。
196
196
  * 只写一行,列出声明符号、开启与关闭的标签,避免正文膨胀。
197
+ * `@author` 等只认默认值的文件头标签开着却没填值时单列为「未填值」:这种标签
198
+ * 不会写进文件,与「关闭」不是一回事,代理据此既不会漏写,也不会补空标签。
199
+ * `@brief` 的正文按文件写,没有默认值也仍列为开启。
197
200
  */
198
201
  export function snapshotText(raw) {
199
202
  const config = normalizeConfig(raw);
200
203
  const on = ['@file'];
204
+ const unset = [];
201
205
  const off = [];
202
206
  for (const tag of HEADER_TAGS) {
203
207
  const entry = config[tag];
204
- const label = entry.value ? `${TAG_LABEL[tag]} ${entry.value}` : TAG_LABEL[tag];
205
- if (entry.enabled)
206
- on.push(label);
207
- else
208
+ if (!entry.enabled) {
208
209
  off.push(TAG_LABEL[tag]);
210
+ }
211
+ else if (tag === 'brief' || entry.value) {
212
+ // @brief 的正文按文件写,没有默认值也仍要出现;其余文件头标签只认填了的默认值。
213
+ on.push(entry.value ? `${TAG_LABEL[tag]} ${entry.value}` : TAG_LABEL[tag]);
214
+ }
215
+ else {
216
+ unset.push(TAG_LABEL[tag]);
217
+ }
209
218
  }
210
219
  for (const tag of [...CONTRACT_TAGS, ...EXTRA_TAGS]) {
211
220
  if (config[tag])
@@ -214,6 +223,6 @@ export function snapshotText(raw) {
214
223
  off.push(TAG_LABEL[tag]);
215
224
  }
216
225
  const style = config.commentStyle === 'block' ? '/** ... */' : '///';
217
- const line = `- 声明符号:${style}(函数体固定 //);开启 ${on.join('、')};关闭 ${off.join('、') || '无'}。`;
226
+ const line = `- 声明符号:${style}(函数体固定 //);开启 ${on.join('、')};未填值 ${unset.join('、') || '无'};关闭 ${off.join('、') || '无'}。`;
218
227
  return `## 当前注释配置(profile)\n\n${line}`;
219
228
  }
package/lib/index.js CHANGED
@@ -1,23 +1,17 @@
1
- // dsh-cpp-workflow bundle entry.
1
+ // dsh-cpp-workflow 包入口。
2
2
  //
3
- // Registers the three packaged skills as one bundle-scoped skill provider. The
4
- // provider is read-only and scans only `skills/<name>/SKILL.md`; each skill
5
- // directory becomes the resourceBase so relative steps, references, examples
6
- // and assets resolve from the installed package.
3
+ // 把打包的三份技能注册成一个技能提供方。提供方只读,只扫描
4
+ // `skills/<name>/SKILL.md`;每份技能目录作为 resourceBase,步骤、参考页、
5
+ // 示例与资产都由安装后的包内解析。
7
6
  //
8
- // The provider scopes itself to opted-in workspaces: `list()` returns nothing
9
- // unless the session cwd sits inside a git checkout that carries the explicit
10
- // `.agents/skills/cpp-workflow-project/SKILL.md` marker on the path to the git
11
- // root. C++ or CMake evidence is intentionally not part of the gate: a freshly
12
- // copied template has no sources yet, and an empty project legitimately stops
13
- // at the build step. A C++ sample outside an opted-in checkout never sees these
14
- // names; the marker lookup ignores sibling directories.
7
+ // 门禁只认显式启用的工作区:会话 cwd 到 git 根的路径上必须有
8
+ // `.agents/skills/cpp-workflow-project/SKILL.md`,否则 `list()` 返回空。
9
+ // C++ 或 CMake 证据刻意不参与:刚复制的模板还没有源码,空工程也可以停在
10
+ // 构建步骤;检出之外的 C++ 示例看不到这些技能名,标记查找也不进兄弟目录。
15
11
  //
16
- // Rank 550 is lower priority than project/user skills (project `.agents/skills`
17
- // 200, user `.agents/skills` 500) and higher priority than the bundled root
18
- // (600), so a project can override any packaged skill by name without editing
19
- // the package. The project skill itself (cpp-workflow-project, rank 200) is a
20
- // separate name and does not collide.
12
+ // 优先级 550:低于项目级(200)与用户级(500),高于包内根(600)。项目
13
+ // 可按名字覆盖任意打包技能,不必改包;项目技能 cpp-workflow-project(200)
14
+ // 是另一个名字,与此不冲突。
21
15
  import { readdir, readFile } from 'node:fs/promises';
22
16
  import path from 'node:path';
23
17
  import { fileURLToPath } from 'node:url';
@@ -62,11 +56,12 @@ const KNOWN_SKILLS = new Set(['building-cpp', 'engineering', 'developing-cpp']);
62
56
  const SKILL_NAME_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
63
57
  const PACKAGE_ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
64
58
  const SKILLS_ROOT = path.join(PACKAGE_ROOT, 'skills');
65
- /** Minimal YAML frontmatter reader for the keys SKILL.md actually uses. */
59
+ /** 读取 SKILL.md 用到的 YAML frontmatter;只支持这些键所需的最小语法。 */
66
60
  function parseFrontmatter(source) {
67
- const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?/.exec(source);
61
+ const text = source.charCodeAt(0) === 0xfeff ? source.slice(1) : source;
62
+ const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?/.exec(text);
68
63
  if (!match)
69
- return { data: {}, body: source };
64
+ return { data: {}, body: text };
70
65
  const data = {};
71
66
  const stack = [
72
67
  { indent: -1, target: data },
@@ -92,9 +87,15 @@ function parseFrontmatter(source) {
92
87
  }
93
88
  parent[key] = parseScalar(value);
94
89
  }
95
- return { data, body: source.slice(match[0].length) };
90
+ return { data, body: text.slice(match[0].length) };
96
91
  }
97
92
  function parseScalar(value) {
93
+ // 块标量、锚点与别名需要多行语法;本包只支持单行 frontmatter,遇到这些标记
94
+ // 直接判为不可解析,避免把 ">" 或 "|" 当成正文展示。
95
+ if (/^[>|&*]/.test(value))
96
+ return undefined;
97
+ if (!value.startsWith('"') && !value.startsWith("'"))
98
+ value = value.replace(/\s+#.*$/, '');
98
99
  if ((value.startsWith('"') && value.endsWith('"')) ||
99
100
  (value.startsWith("'") && value.endsWith("'"))) {
100
101
  const quote = value[0];
@@ -125,20 +126,24 @@ async function readCandidate(skillDir) {
125
126
  source = await readFile(skillFile, 'utf8');
126
127
  }
127
128
  catch {
128
- return undefined;
129
+ // 读不到正文是瞬时 IO 问题,不能把目录当成「已完整扫描」。
130
+ return { complete: false };
129
131
  }
130
132
  const { data } = parseFrontmatter(source);
131
133
  if (typeof data.name !== 'string' || !SKILL_NAME_RE.test(data.name))
132
- return undefined;
134
+ return { complete: true };
133
135
  if (!KNOWN_SKILLS.has(data.name))
134
- return undefined;
135
- if (typeof data.description !== 'string' || data.description.trim() === '')
136
- return undefined;
136
+ return { complete: true };
137
+ if (typeof data.description !== 'string')
138
+ return { complete: true };
139
+ const description = data.description.replace(/\s+/g, ' ').trim();
140
+ if (description === '')
141
+ return { complete: true };
137
142
  if (data.name !== path.basename(skillDir))
138
- return undefined;
143
+ return { complete: true };
139
144
  const candidate = {
140
145
  name: data.name,
141
- description: data.description.trim(),
146
+ description,
142
147
  invocation: { modelInvocable: true, userInvocable: true },
143
148
  source: 'bundled',
144
149
  provider: PROVIDER,
@@ -153,7 +158,7 @@ async function readCandidate(skillDir) {
153
158
  if (data.metadata && typeof data.metadata === 'object' && !Array.isArray(data.metadata)) {
154
159
  candidate.metadata = data.metadata;
155
160
  }
156
- return candidate;
161
+ return { candidate, complete: true };
157
162
  }
158
163
  async function listSkills(options = {}) {
159
164
  if (options.signal?.aborted)
@@ -167,29 +172,32 @@ async function listSkills(options = {}) {
167
172
  entries = await readdir(SKILLS_ROOT, { withFileTypes: true });
168
173
  }
169
174
  catch {
170
- return [];
175
+ // 目录暂时读不到时返回不完整观察,宿主不会把它当成完整空目录缓存。
176
+ return { candidates: [], complete: false };
171
177
  }
172
178
  const candidates = [];
179
+ let complete = true;
173
180
  for (const entry of entries) {
174
181
  if (!entry.isDirectory() || !KNOWN_SKILLS.has(entry.name))
175
182
  continue;
176
183
  if (options.signal?.aborted)
177
184
  return [];
178
- const candidate = await readCandidate(path.join(SKILLS_ROOT, entry.name));
179
- if (candidate)
180
- candidates.push(candidate);
185
+ const result = await readCandidate(path.join(SKILLS_ROOT, entry.name));
186
+ if (result.candidate)
187
+ candidates.push(result.candidate);
188
+ if (!result.complete)
189
+ complete = false;
181
190
  }
182
191
  candidates.sort((a, b) => a.name.localeCompare(b.name));
183
- return candidates;
192
+ return complete ? candidates : { candidates, complete: false };
184
193
  }
185
194
  async function getSkill(candidate, options = {}, commentConfig = undefined) {
186
195
  if (options.signal?.aborted)
187
196
  return undefined;
188
197
  if (!candidate || candidate.provider !== PROVIDER)
189
198
  return undefined;
190
- // A candidate can outlive a directory change in the same session. Re-check
191
- // only when the caller supplies a cwd; a plain `get()` keeps working for
192
- // candidates that were already discovered in this workspace.
199
+ // candidate 可能比同一会话中的目录变化活得久。只有调用方传了 cwd 时才重查门禁;
200
+ // 不带 cwd 的 get() 继续服务本工作区已发现的 candidate。
193
201
  if (options.cwd !== undefined && !(await isCppWorkflowWorkspace(options.cwd)))
194
202
  return undefined;
195
203
  if (!KNOWN_SKILLS.has(candidate.name))