@chengzhao-dev/dsh-cpp-workflow 0.6.19 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +11 -26
- package/README.md +13 -28
- package/cordis.patch.yml +1 -1
- package/lib/client.js +33 -21
- package/lib/comment-policy.js +15 -6
- package/lib/index.js +1 -1
- package/lib/workspace.js +0 -15
- package/package.json +7 -7
- package/skills/building-cpp/SKILL.md +34 -21
- package/skills/building-cpp/assets/templates/projects/common/running-build.sh +5 -1
- package/skills/building-cpp/project/vscode/01-extensions.md +28 -0
- package/skills/building-cpp/project/vscode/02-settings.md +39 -0
- package/skills/building-cpp/references/build-script.md +14 -7
- package/skills/building-cpp/references/environment.md +8 -1
- package/skills/building-cpp/steps/01-build.md +8 -8
- package/skills/building-cpp/steps/02-tooling.md +17 -9
- package/skills/building-cpp/steps/03-check.md +16 -14
- package/skills/developing-cpp/SKILL.md +37 -25
- package/skills/developing-cpp/references/comments/comment-rules.md +181 -0
- package/skills/developing-cpp/references/comments/comment-style.md +80 -0
- package/skills/developing-cpp/references/comments/examples/declaration-class.md +66 -0
- package/skills/developing-cpp/references/comments/examples/declaration-constructor.md +22 -0
- package/skills/developing-cpp/references/comments/examples/declaration-enum.md +48 -0
- package/skills/developing-cpp/references/comments/examples/declaration-file.md +66 -0
- package/skills/developing-cpp/references/comments/examples/declaration-function.md +127 -0
- package/skills/developing-cpp/references/comments/examples/declaration-member.md +23 -0
- package/skills/developing-cpp/references/comments/examples/declaration-predicate.md +14 -0
- package/skills/developing-cpp/references/comments/examples/declaration-struct.md +18 -0
- package/skills/developing-cpp/references/comments/examples/implementation-body.md +64 -0
- package/skills/developing-cpp/references/comments/examples/implementation-todo.md +16 -0
- package/skills/developing-cpp/references/comments/glossary/comment-terms.md +93 -0
- package/skills/developing-cpp/references/design/examples/behavior-sentence.md +14 -0
- package/skills/developing-cpp/references/design/examples/coordinate-table.md +31 -0
- package/skills/developing-cpp/references/design/examples/header-place.md +26 -0
- package/skills/developing-cpp/references/design/examples/library-boundary.md +30 -0
- package/skills/developing-cpp/references/design/examples/library-split.md +7 -0
- package/skills/developing-cpp/references/design/examples/move-result.md +39 -0
- package/skills/developing-cpp/references/design/examples/preview-read.md +40 -0
- package/skills/developing-cpp/references/{project-design.md → design/project-design.md} +57 -5
- package/skills/developing-cpp/references/{change-model.md → editing/01-edit-operations.md} +5 -3
- package/skills/developing-cpp/references/{priority.md → editing/02-rule-priority.md} +2 -2
- package/skills/developing-cpp/references/exceptions/examples/throw-boundary.md +28 -0
- package/skills/developing-cpp/references/exceptions/examples/throw-build-mode.md +38 -0
- package/skills/developing-cpp/references/exceptions/examples/throw-catch.md +21 -0
- package/skills/developing-cpp/references/exceptions/examples/throw-destructor.md +21 -0
- package/skills/developing-cpp/references/exceptions/examples/throw-format.md +13 -0
- package/skills/developing-cpp/references/exceptions/examples/throw-message.md +16 -0
- package/skills/developing-cpp/references/exceptions/examples/throw-when.md +27 -0
- package/skills/developing-cpp/references/{exceptions.md → exceptions/throw-rules.md} +78 -23
- package/skills/developing-cpp/references/{glossary.md → language/glossary/language-terms.md} +2 -2
- package/skills/developing-cpp/references/language/language-basics/01-objects.md +15 -0
- package/skills/developing-cpp/references/language/language-basics/02-initialization.md +26 -0
- package/skills/developing-cpp/references/language/language-basics/03-deduction.md +12 -0
- package/skills/developing-cpp/references/language/language-basics/04-const.md +25 -0
- package/skills/developing-cpp/references/language/language-basics/05-expressions.md +23 -0
- package/skills/developing-cpp/references/language/language-basics/06-functions.md +15 -0
- package/skills/developing-cpp/references/language/language-basics/07-classes.md +15 -0
- package/skills/developing-cpp/references/language/language-basics/08-raii.md +15 -0
- package/skills/developing-cpp/references/language/language-basics/09-templates.md +26 -0
- package/skills/developing-cpp/references/language/language-basics/10-checklist.md +10 -0
- package/skills/developing-cpp/references/language/performance/01-measure.md +22 -0
- package/skills/developing-cpp/references/language/performance/02-complexity.md +13 -0
- package/skills/developing-cpp/references/language/performance/03-memory.md +14 -0
- package/skills/developing-cpp/references/language/performance/04-undefined-behavior.md +28 -0
- package/skills/developing-cpp/references/language/performance/05-pitfalls.md +17 -0
- package/skills/developing-cpp/references/language/performance/06-false-optimizations.md +13 -0
- package/skills/developing-cpp/references/language/performance/07-checklist.md +8 -0
- package/skills/developing-cpp/references/language/standard-library/01-containers.md +29 -0
- package/skills/developing-cpp/references/language/standard-library/02-access.md +14 -0
- package/skills/developing-cpp/references/language/standard-library/03-iteration.md +18 -0
- package/skills/developing-cpp/references/language/standard-library/04-algorithms.md +26 -0
- package/skills/developing-cpp/references/language/standard-library/05-string.md +13 -0
- package/skills/developing-cpp/references/language/standard-library/06-format.md +106 -0
- package/skills/developing-cpp/references/language/standard-library/07-time.md +13 -0
- package/skills/developing-cpp/references/language/standard-library/08-random.md +13 -0
- package/skills/developing-cpp/references/language/standard-library/09-files.md +14 -0
- package/skills/developing-cpp/references/language/standard-library/10-checklist.md +9 -0
- package/skills/developing-cpp/references/language/value-types/01-width.md +17 -0
- package/skills/developing-cpp/references/language/value-types/02-signed.md +26 -0
- package/skills/developing-cpp/references/language/value-types/03-integer-roles.md +38 -0
- package/skills/developing-cpp/references/language/value-types/04-enum.md +24 -0
- package/skills/developing-cpp/references/language/value-types/05-strong-type.md +17 -0
- package/skills/developing-cpp/references/language/value-types/06-const-method.md +22 -0
- package/skills/developing-cpp/references/language/value-types/07-nodiscard.md +15 -0
- package/skills/developing-cpp/references/language/value-types/08-comparison.md +10 -0
- package/skills/developing-cpp/references/language/value-types/09-subscript.md +15 -0
- package/skills/developing-cpp/references/language/value-types/10-float-bool.md +13 -0
- package/skills/developing-cpp/references/language/value-types/11-checklist.md +8 -0
- package/skills/developing-cpp/references/{layout.md → layout/01-source-layout.md} +10 -4
- package/skills/developing-cpp/references/{file-template.md → layout/02-file-template.md} +10 -4
- package/skills/developing-cpp/references/layout/03-declaration-order.md +138 -0
- package/skills/developing-cpp/references/naming/examples/naming-accessor.md +17 -0
- package/skills/developing-cpp/references/naming/examples/naming-basic.md +3 -0
- package/skills/developing-cpp/references/naming/examples/naming-current-prefix.md +19 -0
- package/skills/developing-cpp/references/naming/examples/naming-lookup.md +18 -0
- package/skills/developing-cpp/references/naming/examples/naming-lower-layer.md +39 -0
- package/skills/developing-cpp/references/naming/examples/naming-multiple-return.md +20 -0
- package/skills/developing-cpp/references/naming/examples/naming-player-value.md +16 -0
- package/skills/developing-cpp/references/naming/examples/naming-predicate.md +18 -0
- package/skills/developing-cpp/references/naming/examples/naming-rename.md +5 -0
- package/skills/developing-cpp/references/naming/examples/naming-responsibility.md +19 -0
- package/skills/developing-cpp/references/naming/examples/naming-role.md +21 -0
- package/skills/developing-cpp/references/naming/examples/naming-state-change.md +57 -0
- package/skills/developing-cpp/references/{naming.md → naming/identifier-names.md} +37 -9
- package/skills/developing-cpp/references/{google-cpp-style.md → style/google-cpp-style.md} +11 -10
- package/skills/developing-cpp/scripts/checking-comments.mjs +71 -14
- package/skills/developing-cpp/scripts/checking-declaration-order.mjs +357 -0
- package/skills/developing-cpp/steps/01-behavior.md +5 -5
- package/skills/developing-cpp/steps/02-boundary.md +10 -10
- package/skills/developing-cpp/steps/03-declaration.md +16 -14
- package/skills/developing-cpp/steps/04-implementation.md +21 -17
- package/skills/engineering/SKILL.md +87 -0
- package/skills/{configuring-cmake/assets/cmake → engineering/references/cmake/assets}/CompileSettings.cmake +2 -0
- package/skills/{building-cpp/references/linking.md → engineering/references/cmake/linking/01-libraries.md} +7 -48
- package/skills/engineering/references/cmake/linking/02-rpath.md +25 -0
- package/skills/engineering/references/cmake/linking/03-undefined-reference.md +20 -0
- package/skills/engineering/references/cmake/linking/04-inspect.md +21 -0
- package/skills/{configuring-cmake/references/modules.md → engineering/references/cmake/modules/functions.md} +8 -5
- package/skills/{configuring-cmake/references → engineering/references/cmake/standard}/cxx-standard.md +5 -4
- package/skills/engineering/references/cmake/standard/examples/standard.md +19 -0
- package/skills/{building-cpp/references → engineering/references/cmake/standard}/standards/README.md +9 -9
- package/skills/{building-cpp/references → engineering/references/cmake/standard}/standards/c++20/README.md +1 -1
- package/skills/engineering/references/cmake/targets/examples/glob.md +22 -0
- package/skills/engineering/references/cmake/targets/examples/rpath.md +24 -0
- package/skills/{configuring-cmake/examples/cmake.md → engineering/references/cmake/targets/examples/target.md} +2 -70
- package/skills/{configuring-cmake/references/cmake.md → engineering/references/cmake/targets/rules.md} +18 -11
- package/skills/{building-cpp/references/testing.md → engineering/references/cmake/testing/ctest.md} +11 -4
- package/skills/{building-cpp/references/encoding.md → engineering/references/formatting/01-encoding.md} +1 -1
- package/skills/engineering/references/formatting/02-clang-format.md +20 -0
- package/skills/engineering/references/formatting/03-clang-tidy.md +58 -0
- package/skills/engineering/references/formatting/04-clangd.md +90 -0
- package/skills/engineering/references/formatting/examples/clang-format.md +38 -0
- package/skills/engineering/references/formatting/examples/clang-tidy.md +43 -0
- package/skills/{building-cpp/examples/tooling.md → engineering/references/formatting/examples/clangd.md} +1 -80
- package/skills/{configuring-cmake → engineering}/steps/01-targets.md +6 -6
- package/skills/{configuring-cmake → engineering}/steps/02-modules.md +4 -4
- package/skills/{configuring-cmake → engineering}/steps/03-check.md +3 -2
- package/templates/cpp-workflow-project/SKILL.md +1 -1
- package/skills/building-cpp/references/static-analysis.md +0 -148
- package/skills/configuring-cmake/SKILL.md +0 -68
- package/skills/developing-cpp/examples/comments-declaration.md +0 -313
- package/skills/developing-cpp/examples/comments-implementation.md +0 -66
- package/skills/developing-cpp/examples/exceptions.md +0 -173
- package/skills/developing-cpp/examples/naming.md +0 -168
- package/skills/developing-cpp/examples/structure.md +0 -194
- package/skills/developing-cpp/references/comment-terms.md +0 -75
- package/skills/developing-cpp/references/comments.md +0 -223
- package/skills/developing-cpp/references/declaration-order.md +0 -118
- package/skills/developing-cpp/references/language.md +0 -123
- package/skills/developing-cpp/references/performance.md +0 -83
- package/skills/developing-cpp/references/standard-library.md +0 -138
- package/skills/developing-cpp/references/types.md +0 -154
- /package/skills/{configuring-cmake/assets/cmake → engineering/references/cmake/assets}/LinkSettings.cmake +0 -0
- /package/skills/{building-cpp/references → engineering/references/cmake/standard}/standards/c++11/README.md +0 -0
- /package/skills/{building-cpp/references → engineering/references/cmake/standard}/standards/c++11/cmake-snippet.cmake +0 -0
- /package/skills/{building-cpp/references → engineering/references/cmake/standard}/standards/c++14/README.md +0 -0
- /package/skills/{building-cpp/references → engineering/references/cmake/standard}/standards/c++14/cmake-snippet.cmake +0 -0
- /package/skills/{building-cpp/references → engineering/references/cmake/standard}/standards/c++17/README.md +0 -0
- /package/skills/{building-cpp/references → engineering/references/cmake/standard}/standards/c++17/cmake-snippet.cmake +0 -0
- /package/skills/{building-cpp/references → engineering/references/cmake/standard}/standards/c++20/cmake-snippet.cmake +0 -0
- /package/skills/{building-cpp/references → engineering/references/cmake/standard}/standards/c++23/README.md +0 -0
- /package/skills/{building-cpp/references → engineering/references/cmake/standard}/standards/c++23/cmake-snippet.cmake +0 -0
- /package/skills/{building-cpp → engineering/references/formatting}/scripts/checking-encoding.mjs +0 -0
package/README.en.md
CHANGED
|
@@ -9,30 +9,30 @@ 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
|
-
| `
|
|
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
|
|
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
|
|
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
|
-
|
|
19
|
+
Fixed-version npm install:
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
dsh plugin --profile
|
|
22
|
+
dsh plugin --profile <profile> add npm:@chengzhao-dev/dsh-cpp-workflow@0.7.1
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
The matching Git tag:
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
dsh plugin --profile
|
|
28
|
+
dsh plugin --profile <profile> add github:chengzhao-dev/dsh-cpp-workflow#v0.7.1
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
The desktop app
|
|
31
|
+
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
32
|
|
|
33
33
|
### Settings
|
|
34
34
|
|
|
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.
|
|
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. The settings page no longer duplicates navigation.
|
|
36
36
|
|
|
37
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.
|
|
38
38
|
|
|
@@ -42,7 +42,7 @@ 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`, `
|
|
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
|
|
|
@@ -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 `
|
|
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/references/cmake/standard/standards/README.md); the CMake two-layer declaration is in [cxx-standard.md](skills/engineering/references/cmake/standard/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
|
|
|
@@ -81,22 +81,7 @@ The project root carries only `.vscode/extensions.json` and `settings.json`: cla
|
|
|
81
81
|
|
|
82
82
|
## Package layout
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
dsh-cpp-workflow/
|
|
86
|
-
├── lib/ # build output, shipped in the npm package
|
|
87
|
-
├── skills/ # developing-cpp, configuring-cmake, 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).
|
|
84
|
+
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
85
|
|
|
101
86
|
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).
|
|
102
87
|
|
package/README.md
CHANGED
|
@@ -2,47 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.en.md)
|
|
4
4
|
|
|
5
|
-
把 C++11–C++23 的源码、CMake
|
|
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
|
-
| `
|
|
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
|
|
22
|
+
dsh plugin --profile <profile> add npm:@chengzhao-dev/dsh-cpp-workflow@0.7.1
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
同版本的 Git 标签:
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
dsh plugin --profile
|
|
28
|
+
dsh plugin --profile <profile> add github:chengzhao-dev/dsh-cpp-workflow#v0.7.1
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
`--profile` 换成你实际运行的那个 profile。桌面应用固定跑 `desktop` profile,且该 profile 由应用独占管理;命令行 `add` 被拒绝时,在应用设置里添加插件,地址填同一个 npm 版本。Git 标签安装使用仓库内已构建的 `lib/`,不在目标机器上重新构建;包内也不含需要授权执行的安装脚本。
|
|
32
32
|
|
|
33
33
|
### 设置
|
|
34
34
|
|
|
35
|
-
插件页的「C++ 工程流程」是唯一入口:注释符号可选 `///` 或 `/** ... */`,页面按注释符号、文件头、类型、函数声明与只读预览分块。`@file` 固定为文件名;除它和函数体 `//` 外,文件头、类型与函数声明标签的开关出厂全开,空值跳过。函数参数要求 `@param`,返回值要求 `@return`(成立条件自明时可省),会抛才要求 `@throws`;`@pre`、`@post`、`@retval` 与类型块的 `@tparam`、`@note`、`@see` 也出厂开启,需要时可逐项关掉。函数体固定用
|
|
35
|
+
插件页的「C++ 工程流程」是唯一入口:注释符号可选 `///` 或 `/** ... */`,页面按注释符号、文件头、类型、函数声明与只读预览分块。`@file` 固定为文件名;除它和函数体 `//` 外,文件头、类型与函数声明标签的开关出厂全开,空值跳过。函数参数要求 `@param`,返回值要求 `@return`(成立条件自明时可省),会抛才要求 `@throws`;`@pre`、`@post`、`@retval` 与类型块的 `@tparam`、`@note`、`@see` 也出厂开启,需要时可逐项关掉。函数体固定用 `//`。预览随改动即时更新,保存后下一次读取技能即生效,已有源码不会被改写。设置页不再重复列一份导航。
|
|
36
36
|
|
|
37
37
|
升级插件后如果这一页暂时只显示出厂值,说明当前窗口还挂着旧的前端产物:页脚会显示写入的 `~/.dsh/profiles/<profile>/cordis.patch.yml`,并提示重载;重启 DeepSeek Harness,或在插件页点“重新载入页面”即可编辑,不需要重装插件。页面会在打开后自动重试连接,拿到表单就切换为可编辑。保存、撤销修改与恢复默认值分三个按钮:撤销只回到最近一次读到的值,恢复默认值只填草稿,点保存才写盘。
|
|
38
38
|
|
|
39
39
|
## 工作区门禁
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
会话满足一个条件,技能就会出现:从当前目录向上、停在 git 根,沿途有 `.agents/skills/cpp-workflow-project/SKILL.md`。
|
|
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`、`
|
|
45
|
+
插件技能 rank 550。项目自己的 `.agents/skills` 技能 rank 200,会以同名覆盖插件;不要在项目里复制 `developing-cpp`、`engineering` 或 `building-cpp`。
|
|
46
46
|
|
|
47
47
|
## 项目级约定
|
|
48
48
|
|
|
@@ -64,7 +64,7 @@ dsh plugin --profile web add github:chengzhao-dev/dsh-cpp-workflow#v0.6.19
|
|
|
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 侧优先调用 `
|
|
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/references/cmake/standard/standards/README.md),CMake 两层声明见 [cxx-standard.md](skills/engineering/references/cmake/standard/cxx-standard.md)。
|
|
68
68
|
|
|
69
69
|
生成器固定 Ninja,构建目录是 `build/clang/` 与 `build/gcc/`,不共用 `build/`。诊断工具固定 `clang-format`、`clang-tidy`、`clangd`;GCC 模式也不换成别的分析器。
|
|
70
70
|
|
|
@@ -81,22 +81,7 @@ node "<skill-dir>/scripts/checking-environment.mjs" --project . --live
|
|
|
81
81
|
|
|
82
82
|
## 包结构
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
dsh-cpp-workflow/
|
|
86
|
-
├── lib/ # 构建产物,随 npm 包发布
|
|
87
|
-
├── skills/ # developing-cpp、configuring-cmake 与 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)。
|
|
84
|
+
运行时闭包是 `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
85
|
|
|
101
86
|
边界与门禁的维护说明在 [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)。
|
|
102
87
|
|
package/cordis.patch.yml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
#
|
|
3
3
|
# Additive only: insert one host row. No official row is edited, disabled or
|
|
4
4
|
# replaced. The row loads this package's `main` entry, which registers the
|
|
5
|
-
# packaged developing-cpp and building-cpp skills through `ctx.skills`.
|
|
5
|
+
# packaged developing-cpp, engineering and building-cpp skills through `ctx.skills`.
|
|
6
6
|
#
|
|
7
7
|
# Install with `dsh plugin --profile <name> add <package>`. Pinned npm and Git
|
|
8
8
|
# tag addresses are in the README's Install section.
|
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/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
|
-
|
|
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,7 +230,7 @@ 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
|
|
|
@@ -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
|
-
//
|
|
646
|
-
|
|
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
|
-
|
|
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')
|
|
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
|
-
|
|
884
|
+
// 旧宿主没有 whileServed 时也交给效果作用域注销挂点,卸载后不留悬挂注册。
|
|
885
|
+
ctx.effect(() => mount(), 'dsh-cpp-workflow: 配置挂点')
|
|
874
886
|
}
|
|
875
887
|
}
|
|
876
888
|
|
package/lib/comment-policy.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 注释标签策略:设置页的预览、技能快照与检查器参数共用这一份。
|
|
3
3
|
*
|
|
4
4
|
* 配置只描述「写注释时默认带哪些标签、声明用哪种注释符号」,不描述写法本身;
|
|
5
|
-
* 写法在 `skills/developing-cpp/references/comments.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
|
-
|
|
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
|
@@ -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', '
|
|
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/lib/workspace.js
CHANGED
|
@@ -10,17 +10,6 @@ import { access } from 'node:fs/promises';
|
|
|
10
10
|
import path from 'node:path';
|
|
11
11
|
export const PROJECT_SKILL = path.join('.agents', 'skills', 'cpp-workflow-project', 'SKILL.md');
|
|
12
12
|
export const MAX_ASCENT = 64;
|
|
13
|
-
const SKIPPED_DIRS = new Set([
|
|
14
|
-
'.git',
|
|
15
|
-
'node_modules',
|
|
16
|
-
'vendor',
|
|
17
|
-
'third_party',
|
|
18
|
-
'templates',
|
|
19
|
-
'build',
|
|
20
|
-
'temp',
|
|
21
|
-
'.cache',
|
|
22
|
-
]);
|
|
23
|
-
export const CPP_BUILD_FILES = new Set(['CMakeLists.txt']);
|
|
24
13
|
async function exists(target) {
|
|
25
14
|
try {
|
|
26
15
|
await access(target);
|
|
@@ -91,10 +80,6 @@ export async function findProjectSkill(cwd, gitRoot) {
|
|
|
91
80
|
}
|
|
92
81
|
return undefined;
|
|
93
82
|
}
|
|
94
|
-
/** Boolean form of {@link findProjectSkill}. */
|
|
95
|
-
export async function hasProjectSkill(cwd, gitRoot) {
|
|
96
|
-
return (await findProjectSkill(cwd, gitRoot)) !== undefined;
|
|
97
|
-
}
|
|
98
83
|
/**
|
|
99
84
|
* Session gate. The project skill must sit between `cwd` and the git root
|
|
100
85
|
* (inclusive). First-party C++ or CMake evidence is deliberately not required:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chengzhao-dev/dsh-cpp-workflow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "写 C++ 源码、配 CMake、用 Clang 构建;头文件用 /// Doxygen 文档注释,函数体用 // 分段说明,文件头标签可在设置里改。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
],
|
|
24
24
|
"engines": {
|
|
25
25
|
"node": ">=22",
|
|
26
|
-
"dsh": ">=0.2.
|
|
26
|
+
"dsh": ">=0.2.1-rc.1 <0.3.0-0"
|
|
27
27
|
},
|
|
28
28
|
"dsh": {
|
|
29
29
|
"bundle": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"client": {
|
|
33
33
|
"platform": "web",
|
|
34
34
|
"inject": [
|
|
35
|
-
"@deepseek-ai/dsh-client-ui-
|
|
35
|
+
"@deepseek-ai/dsh-client-ui-renderer",
|
|
36
36
|
"@deepseek-ai/dsh-client-ui-settings",
|
|
37
37
|
"@deepseek-ai/dsh-client-ui-plugin-manager"
|
|
38
38
|
]
|
|
@@ -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": "
|
|
54
|
+
"test": "node scripts/building-client.mjs --check && npm run build && node scripts/checking-skill-links.mjs && node skills/engineering/references/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/
|
|
57
|
+
"check:encoding": "node skills/engineering/references/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"
|
|
@@ -86,13 +86,13 @@
|
|
|
86
86
|
"provenance": true
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
|
-
"@deepseek-ai/dsh-skill": ">=0.2.
|
|
89
|
+
"@deepseek-ai/dsh-skill": ">=0.2.1-rc.1 <0.3.0-0"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
92
|
"@deepseek-ai/schemastery": "^3.18.5"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
|
-
"@deepseek-ai/dsh-skill": ">=0.2.
|
|
95
|
+
"@deepseek-ai/dsh-skill": ">=0.2.1-rc.1 <0.3.0-0",
|
|
96
96
|
"@types/node": "^22.20.5",
|
|
97
97
|
"typescript": "^5.9.3",
|
|
98
98
|
"yaml": "^2.9.1"
|
|
@@ -1,27 +1,27 @@
|
|
|
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
|
|
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
|
---
|
|
7
7
|
|
|
8
8
|
# building-cpp
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
本技能处理环境声明、构建入口与工具配置:`environment.json`、`running-build.sh`、`.clang-format`、`.clang-tidy`、`.clangd`、`.vscode/`、构建命令、编译数据库、CTest 和运行。`CMakeLists.txt` 与 `cmake/` 下的 target、属性、标准和模块由 `configuring-cmake` 负责;本技能只读它们来配置和检查,不在这一步改 target 图。函数体、类型、命名、异常和源码注释只开 `developing-cpp`。
|
|
13
|
-
|
|
14
|
-
一次改动同时碰到源码和构建文件时,先打开 `developing-cpp` 定行为、边界与实现;需要新增或移动源文件、改库与程序的边界、补测试 target 时,转到 `configuring-cmake` 把文件写进 CMake;最后回到本技能做定工具配置与通过检查。只改函数体、命名、异常或注释且入口命令可运行时,定实现后只开本技能的「通过检查」。
|
|
15
|
-
|
|
16
|
-
存在项目技能 `cpp-workflow-project` 时先读它的 `SKILL.md`、`environment.json` 和 `stages/stage-table.md`。三个环境轴为空、`standard` 非法或组合非法时停在定构建,不猜 WSL、Clang 或构建目录;`windows` + `native` 直接拒绝,提示「本版本不能在 Windows 原生壳里构建」,不要给出补 PowerShell 的路线。
|
|
10
|
+
本技能处理环境声明、构建入口与工具配置:`environment.json`、`running-build.sh`、`.clang-format`、`.clang-tidy`、`.clangd`、`.vscode/`、构建命令、编译数据库、CTest 与运行。
|
|
17
11
|
|
|
18
|
-
|
|
12
|
+
## 适用场景
|
|
19
13
|
|
|
20
|
-
|
|
14
|
+
- **负责**:环境四轴与构建入口;工具配置的选定与检查;编码、声明校验、活动校验、项目入口命令的次序。
|
|
15
|
+
- **不负责**:`CMakeLists.txt` 与 `cmake/` 下的 target、属性、标准与模块开 `engineering`,本技能只读它们来配置和检查,不在这一步改 target 图;函数体、类型、命名、异常与源码注释开 `developing-cpp`。
|
|
16
|
+
- **交接**:一次改动同时碰到源码和构建文件时,先开 `developing-cpp` 定行为、边界与实现;需要新增或移动源文件、改库与程序的边界、补测试 target 时,转 `engineering` 把文件写进 CMake;最后回到本技能定工具配置并通过检查。只改函数体、命名、异常或注释且入口命令可运行时,定实现后只开本技能的通过检查。
|
|
17
|
+
- **前置**:存在项目技能 `cpp-workflow-project` 时先读它的 `SKILL.md`、`environment.json` 和 `stages/stage-table.md`。三个环境轴为空、`standard` 非法或组合非法时停在定构建,不猜 WSL、Clang 或构建目录;`windows` + `native` 直接拒绝,提示「本版本不能在 Windows 原生壳里构建」,不给补 PowerShell 的路线。
|
|
18
|
+
- **分因**:编译失败时先看诊断指向哪一层。函数体问题回 `developing-cpp` 的定实现;找不到头、链接失败、target 不存在或标准不对转 `engineering` 的对应步骤;没有编译数据库、format/tidy 不在 PATH 或配置不生效留在本技能的定工具配置。
|
|
19
|
+
- **编码**:源码与构建文件用 UTF-8 无 BOM、检出 LF,`.bat` / `.cmd` 用 CRLF,`.clang-format` 写 `LineEnding: LF`;MSVC 原生构建优先加 `/utf-8`,不靠 BOM 过关。完整规则见 `../engineering/references/formatting/01-encoding.md`,机器规则以仓库根 `.gitattributes` 与 `.editorconfig` 为准。
|
|
20
|
+
- **编辑器**:工程根已有 `.vscode/` 时按 `project/vscode/` 两页接线;从当前目录向上到 git 根都没有 `.vscode/` 时不打开、也不新建。配置、构建、运行和调试都从 CMake Tools 进入,构建仍以 `running-build.sh` 为准。
|
|
21
21
|
|
|
22
22
|
## 三种操作
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
一次只选一种,范围(单点、整段)是任务属性;判据、边界与交接见 `../developing-cpp/references/editing/01-edit-operations.md`。四类改动是域,不是操作。
|
|
25
25
|
|
|
26
26
|
| 操作 | 什么时候用 | 从哪步进 |
|
|
27
27
|
| --- | --- | --- |
|
|
@@ -29,7 +29,9 @@ metadata:
|
|
|
29
29
|
| 改写 | 环境轴与 target 契约不变,工具配置位置或流程顺序不对 | 从第 2 步重走,可到第 3 步 |
|
|
30
30
|
| 润色 | 只改诊断措辞或失败分流说明 | 第 3 步 |
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
- 不发明项目没有声明的环境轴、命令和 target;只改格式或配置时不改可观察行为。
|
|
33
|
+
- 不覆盖已有源码、`CMakeLists.txt` 和 `.clang-*`;不安装工具链;代理侧不写 `wsl` 或 `bash -lc`。
|
|
34
|
+
- 后一步发现前一步没做完,退回那一步;发现环境轴、编译器、构建目录或 target 契约需要改,整段退回并转 `engineering`。
|
|
33
35
|
|
|
34
36
|
## 步骤
|
|
35
37
|
|
|
@@ -39,26 +41,36 @@ metadata:
|
|
|
39
41
|
| 2 | 定工具配置 | `steps/02-tooling.md` | 格式化、静态检查、clangd 各管一段,互不越界 |
|
|
40
42
|
| 3 | 通过检查 | `steps/03-check.md` | 按编码 → 声明校验 → 活动校验 → 项目入口的次序跑,前一步失败就停 |
|
|
41
43
|
|
|
42
|
-
每步只打开同号的一个步骤文件。判不准才打开 `examples/` 里与该步对应的案例;`references/`
|
|
44
|
+
每步只打开同号的一个步骤文件。判不准才打开 `examples/` 里与该步对应的案例;`references/` 保存完整条文,只在排错、整目录重构,或步骤里明确指向某一条时打开。
|
|
45
|
+
|
|
46
|
+
## 入口表
|
|
47
|
+
|
|
48
|
+
| 要做的事 | 打开 |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| 读环境轴、配置与构建 | `steps/01-build.md`;条文 `references/environment.md`;案例 `examples/environment.md` |
|
|
51
|
+
| 配 `.clang-format`、`.clang-tidy`、`.clangd` | `steps/02-tooling.md`;条文在 `../engineering/references/formatting/`,一次一份 |
|
|
52
|
+
| 工程已有 `.vscode/`,接扩展与设置 | `project/vscode/01-extensions.md` 或 `02-settings.md`;没有 `.vscode/` 不打开也不新建 |
|
|
53
|
+
| 编码、声明校验、活动校验与入口命令 | `steps/03-check.md`;条文 `references/build-script.md` |
|
|
54
|
+
| 新工程模板与可复制配置 | `assets/templates/projects/`、`assets/config/` |
|
|
43
55
|
|
|
44
|
-
|
|
56
|
+
链接、rpath 与产物布局读 `../engineering/references/cmake/linking/01-libraries.md`;测试设计、断言与 CTest 注册读 `../engineering/references/cmake/testing/ctest.md`;CMake 的 target、标准与函数写法读 `../engineering/references/cmake/`,可复用片段在 `../engineering/references/cmake/assets/`。
|
|
45
57
|
|
|
46
|
-
|
|
58
|
+
## 加载预算
|
|
47
59
|
|
|
48
|
-
-
|
|
60
|
+
- 只开当前步对应的一个步骤文件;同一改动域内不同时展开两个技能的步骤。
|
|
49
61
|
- 条文只开该步点名的一份;同号案例留到下一次激活。
|
|
50
62
|
- 标准档只打开项目技能声明的那一档,没有声明时用本技能已有的新工程默认,不把其余标准档读进来。
|
|
51
63
|
|
|
52
|
-
项目技能列出了检查命令时只跑那一条,没有时跑本技能自己的 `scripts/checking-environment.mjs` 与
|
|
64
|
+
项目技能列出了检查命令时只跑那一条,没有时跑本技能自己的 `scripts/checking-environment.mjs` 与 `../engineering/references/formatting/scripts/checking-encoding.mjs`;退出码为 0 后停在这一步,不再继续走没有失败的步骤。入口脚本只做配置、构建、CTest 与最小运行;`clang-format` 与 `clang-tidy` 的手动检查留在定工具配置,不塞进入口脚本。`environment.json` 的三个环境轴与 `standard` 是唯一来源,缺项就停。
|
|
53
65
|
|
|
54
|
-
|
|
66
|
+
## 四类改动
|
|
55
67
|
|
|
56
|
-
四类改动是操作内部的域:操作定入口,域定层次。四域的定义、边界与次序见 `../developing-cpp/references/
|
|
68
|
+
四类改动是操作内部的域:操作定入口,域定层次。四域的定义、边界与次序见 `../developing-cpp/references/editing/01-edit-operations.md`;一次改动混了两类时,按「内容 → 结构 → 版式 → 措辞」拆开做,前一类落定并经检查再进下一类。
|
|
57
69
|
|
|
58
70
|
| 类型 | 典型请求 | 入口步骤 |
|
|
59
71
|
| --- | --- | --- |
|
|
60
72
|
| 内容 | 改环境轴、入口脚本或构建流程 | `steps/01-build.md` |
|
|
61
|
-
| 结构 |
|
|
73
|
+
| 结构 | 移动工具配置文件、接 `.vscode/` 扩展与设置 | `steps/02-tooling.md` |
|
|
62
74
|
| 版式 | 只改编码、行尾或 clang-format | `steps/02-tooling.md` |
|
|
63
75
|
| 措辞 | 只改诊断措辞、失败分流说明 | `steps/03-check.md` |
|
|
64
76
|
|
|
@@ -66,7 +78,8 @@ metadata:
|
|
|
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、标准与输出目录都已由 `
|
|
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` 另起构建。
|
|
@@ -70,7 +70,11 @@ main() {
|
|
|
70
70
|
"${BUILD_ROOT}/compile_commands.json"
|
|
71
71
|
|
|
72
72
|
header "测试"
|
|
73
|
-
|
|
73
|
+
if [ -d tests ]; then
|
|
74
|
+
ctest --test-dir "${BUILD_DIR}" --output-on-failure --no-tests=error
|
|
75
|
+
else
|
|
76
|
+
ctest --test-dir "${BUILD_DIR}" --output-on-failure
|
|
77
|
+
fi
|
|
74
78
|
|
|
75
79
|
header "运行 ${APP_NAME}"
|
|
76
80
|
(
|