@chengzhao-dev/dsh-cpp-workflow 0.7.1 → 0.7.4
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 +16 -10
- package/README.md +16 -10
- package/cordis.patch.yml +6 -6
- package/lib/client.js +3 -3
- package/lib/comment-policy.js +1 -1
- package/lib/index.js +45 -37
- package/lib/workspace.js +10 -17
- package/package.json +9 -3
- package/skills/building-cpp/SKILL.md +17 -17
- package/skills/building-cpp/assets/templates/projects/common/running-build.sh +0 -0
- package/skills/building-cpp/examples/environment.md +4 -3
- package/skills/building-cpp/references/{build-script.md → 01-build-script.md} +4 -3
- package/skills/building-cpp/references/{environment.md → 02-environment.md} +3 -2
- package/skills/building-cpp/scripts/checking-environment.mjs +11 -13
- package/skills/building-cpp/steps/01-build.md +4 -3
- package/skills/building-cpp/steps/02-tooling.md +12 -12
- package/skills/building-cpp/steps/03-check.md +5 -5
- package/skills/building-cpp/{project/vscode/02-settings.md → steps/04-vscode.md} +24 -6
- package/skills/developing-cpp/SKILL.md +21 -18
- package/skills/developing-cpp/references/comments/{comment-rules.md → 01-comment-rules.md} +81 -64
- package/skills/developing-cpp/references/comments/{comment-style.md → 02-style.md} +16 -18
- package/skills/developing-cpp/references/comments/examples/{declaration-class.md → 01-declaration-class.md} +16 -16
- package/skills/developing-cpp/references/comments/examples/{declaration-constructor.md → 02-declaration-constructor.md} +3 -2
- package/skills/developing-cpp/references/comments/examples/03-declaration-enum.md +48 -0
- package/skills/developing-cpp/references/comments/examples/{declaration-file.md → 04-declaration-file.md} +6 -5
- package/skills/developing-cpp/references/comments/examples/05-declaration-function.md +116 -0
- package/skills/developing-cpp/references/comments/examples/{declaration-member.md → 06-declaration-member.md} +4 -3
- package/skills/developing-cpp/references/comments/examples/07-declaration-predicate.md +15 -0
- package/skills/developing-cpp/references/comments/examples/{declaration-struct.md → 08-declaration-struct.md} +4 -3
- package/skills/developing-cpp/references/comments/examples/09-implementation-body.md +95 -0
- package/skills/developing-cpp/references/comments/examples/10-implementation-todo.md +17 -0
- package/skills/developing-cpp/references/comments/glossary/01-comment-terms.md +93 -0
- package/skills/developing-cpp/references/design/{project-design.md → 01-project-design.md} +21 -17
- package/skills/developing-cpp/references/design/examples/{behavior-sentence.md → 01-behavior-sentence.md} +1 -0
- package/skills/developing-cpp/references/design/examples/{coordinate-table.md → 02-coordinate-table.md} +4 -3
- package/skills/developing-cpp/references/design/examples/{header-place.md → 03-header-place.md} +2 -1
- package/skills/developing-cpp/references/design/examples/{library-boundary.md → 04-library-boundary.md} +1 -0
- package/skills/developing-cpp/references/design/examples/{library-split.md → 05-library-split.md} +1 -0
- package/skills/developing-cpp/references/design/examples/06-move-result.md +42 -0
- package/skills/developing-cpp/references/design/examples/07-preview-read.md +37 -0
- package/skills/developing-cpp/references/design/session-layer.md +89 -0
- package/skills/developing-cpp/references/exceptions/{throw-rules.md → 01-exception-rules.md} +56 -61
- package/skills/developing-cpp/references/exceptions/examples/{throw-boundary.md → 01-throw-boundary.md} +1 -0
- package/skills/developing-cpp/references/exceptions/examples/{throw-build-mode.md → 02-throw-build-mode.md} +5 -4
- package/skills/developing-cpp/references/exceptions/examples/{throw-catch.md → 03-throw-catch.md} +1 -0
- package/skills/developing-cpp/references/exceptions/examples/{throw-destructor.md → 04-throw-destructor.md} +1 -0
- package/skills/developing-cpp/references/exceptions/examples/{throw-format.md → 05-throw-format.md} +1 -0
- package/skills/developing-cpp/references/exceptions/examples/{throw-message.md → 06-throw-message.md} +10 -1
- package/skills/developing-cpp/references/exceptions/examples/{throw-when.md → 07-throw-when.md} +1 -0
- package/skills/developing-cpp/references/index.md +132 -0
- package/skills/developing-cpp/references/language/glossary/{language-terms.md → 01-language-terms.md} +3 -2
- package/skills/developing-cpp/references/language/language-basics/01-objects.md +2 -1
- package/skills/developing-cpp/references/language/language-basics/02-initialization.md +2 -1
- package/skills/developing-cpp/references/language/language-basics/03-deduction.md +1 -0
- package/skills/developing-cpp/references/language/language-basics/04-const.md +5 -4
- package/skills/developing-cpp/references/language/language-basics/05-expressions.md +13 -4
- package/skills/developing-cpp/references/language/language-basics/06-functions.md +4 -1
- package/skills/developing-cpp/references/language/language-basics/07-classes.md +1 -0
- package/skills/developing-cpp/references/language/language-basics/08-raii.md +1 -0
- package/skills/developing-cpp/references/language/language-basics/09-templates.md +1 -0
- package/skills/developing-cpp/references/language/language-basics/{10-checklist.md → 10-language-checklist.md} +2 -0
- package/skills/developing-cpp/references/language/performance/01-measure.md +1 -0
- package/skills/developing-cpp/references/language/performance/02-complexity.md +1 -0
- package/skills/developing-cpp/references/language/performance/03-memory.md +1 -0
- package/skills/developing-cpp/references/language/performance/04-undefined-behavior.md +1 -0
- package/skills/developing-cpp/references/language/performance/05-pitfalls.md +1 -0
- package/skills/developing-cpp/references/language/performance/06-false-optimizations.md +1 -0
- package/skills/developing-cpp/references/language/performance/07-checklist.md +1 -0
- package/skills/developing-cpp/references/language/standard-library/01-containers.md +1 -0
- package/skills/developing-cpp/references/language/standard-library/02-access.md +2 -1
- package/skills/developing-cpp/references/language/standard-library/03-iteration.md +1 -0
- package/skills/developing-cpp/references/language/standard-library/04-algorithms.md +1 -0
- package/skills/developing-cpp/references/language/standard-library/05-string.md +1 -0
- package/skills/developing-cpp/references/language/standard-library/06-format.md +17 -6
- package/skills/developing-cpp/references/language/standard-library/07-time.md +1 -0
- package/skills/developing-cpp/references/language/standard-library/08-random.md +2 -0
- package/skills/developing-cpp/references/language/standard-library/09-files.md +1 -0
- package/skills/developing-cpp/references/language/standard-library/{10-checklist.md → 10-library-checklist.md} +1 -0
- package/skills/developing-cpp/references/language/value-types/01-width.md +1 -0
- package/skills/developing-cpp/references/language/value-types/02-signed.md +1 -0
- package/skills/developing-cpp/references/language/value-types/03-integer-roles.md +1 -0
- package/skills/developing-cpp/references/language/value-types/04-enum.md +3 -2
- package/skills/developing-cpp/references/language/value-types/05-strong-type.md +1 -0
- package/skills/developing-cpp/references/language/value-types/06-const-method.md +1 -0
- package/skills/developing-cpp/references/language/value-types/07-nodiscard.md +2 -1
- package/skills/developing-cpp/references/language/value-types/08-comparison.md +2 -1
- package/skills/developing-cpp/references/language/value-types/09-subscript.md +2 -1
- package/skills/developing-cpp/references/language/value-types/10-float-bool.md +1 -0
- package/skills/developing-cpp/references/language/value-types/11-checklist.md +1 -0
- package/skills/developing-cpp/references/layout/01-source-layout.md +3 -3
- package/skills/developing-cpp/references/layout/02-file-template.md +10 -9
- package/skills/developing-cpp/references/layout/03-declaration-order.md +25 -12
- package/skills/developing-cpp/references/naming/01-identifier-names.md +128 -0
- package/skills/developing-cpp/references/naming/examples/01-naming-accessor.md +29 -0
- package/skills/developing-cpp/references/naming/examples/02-naming-basic.md +4 -0
- package/skills/developing-cpp/references/naming/examples/{naming-current-prefix.md → 03-naming-current-prefix.md} +1 -0
- package/skills/developing-cpp/references/naming/examples/04-naming-local.md +46 -0
- package/skills/developing-cpp/references/naming/examples/{naming-lookup.md → 05-naming-lookup.md} +2 -1
- package/skills/developing-cpp/references/naming/examples/06-naming-lower-layer.md +46 -0
- package/skills/developing-cpp/references/naming/examples/{naming-multiple-return.md → 07-naming-multiple-return.md} +1 -0
- package/skills/developing-cpp/references/naming/examples/08-naming-player-value.md +16 -0
- package/skills/developing-cpp/references/naming/examples/09-naming-predicate.md +19 -0
- package/skills/developing-cpp/references/naming/examples/{naming-rename.md → 10-naming-rename.md} +1 -0
- package/skills/developing-cpp/references/naming/examples/{naming-responsibility.md → 11-naming-responsibility.md} +1 -0
- package/skills/developing-cpp/references/naming/examples/{naming-role.md → 12-naming-role.md} +2 -1
- package/skills/developing-cpp/references/naming/examples/13-naming-state-change.md +70 -0
- package/skills/developing-cpp/references/naming/glossary/01-naming-terms.md +27 -0
- package/skills/developing-cpp/references/naming/glossary/02-position.md +24 -0
- package/skills/developing-cpp/references/naming/glossary/03-selection.md +23 -0
- package/skills/developing-cpp/references/naming/glossary/04-square.md +48 -0
- package/skills/developing-cpp/references/naming/glossary/05-scoring.md +27 -0
- package/skills/developing-cpp/references/naming/glossary/06-difficulty.md +26 -0
- package/skills/developing-cpp/references/style/{google-cpp-style.md → 01-google-cpp-style.md} +16 -9
- package/skills/developing-cpp/scripts/checking-comments.mjs +116 -9
- package/skills/developing-cpp/scripts/checking-declaration-order.mjs +27 -1
- package/skills/developing-cpp/steps/01-behavior.md +5 -5
- package/skills/developing-cpp/steps/02-boundary.md +6 -6
- package/skills/developing-cpp/steps/03-declaration.md +7 -7
- package/skills/developing-cpp/steps/04-implementation.md +16 -16
- package/skills/engineering/SKILL.md +19 -19
- package/skills/engineering/references/cmake/linking/01-libraries.md +7 -4
- package/skills/engineering/references/cmake/linking/02-rpath.md +1 -0
- package/skills/engineering/references/cmake/linking/03-undefined-reference.md +3 -2
- package/skills/engineering/references/cmake/linking/04-inspect.md +1 -1
- package/skills/engineering/references/cmake/modules/{functions.md → 01-functions.md} +4 -3
- package/skills/engineering/references/cmake/{standard/cxx-standard.md → standards/01-cxx-standard.md} +2 -1
- package/skills/engineering/references/cmake/{standard/examples/standard.md → standards/examples/01-standard.md} +2 -1
- package/skills/engineering/references/cmake/{standard/standards/README.md → standards/index.md} +22 -21
- package/skills/engineering/references/cmake/standards/versions.md +44 -0
- package/skills/engineering/references/cmake/targets/{rules.md → 01-target-rules.md} +34 -5
- package/skills/engineering/references/cmake/targets/examples/{rpath.md → 01-rpath.md} +1 -0
- package/skills/engineering/references/cmake/testing/{ctest.md → 01-ctest.md} +4 -3
- package/skills/engineering/references/formatting/01-encoding.md +2 -1
- package/skills/engineering/references/formatting/02-clang-format.md +4 -3
- package/skills/engineering/references/formatting/03-clang-tidy.md +3 -2
- package/skills/engineering/references/formatting/04-clangd.md +2 -0
- package/skills/engineering/references/formatting/examples/{clang-format.md → 01-clang-format.md} +2 -1
- package/skills/engineering/references/formatting/examples/{clang-tidy.md → 02-clang-tidy.md} +1 -0
- package/skills/engineering/references/formatting/examples/{clangd.md → 03-clangd.md} +1 -0
- package/skills/engineering/references/index.md +32 -0
- package/skills/engineering/{references/formatting/scripts → scripts}/checking-encoding.mjs +6 -7
- package/skills/engineering/steps/01-targets.md +5 -4
- package/skills/engineering/steps/02-modules.md +3 -3
- package/skills/engineering/steps/03-check.md +3 -2
- package/skills/shared/budget.md +20 -0
- package/skills/{developing-cpp/references/editing/01-edit-operations.md → shared/operations.md} +8 -4
- package/skills/{developing-cpp/references/editing/02-rule-priority.md → shared/rule-priority.md} +2 -1
- package/skills/building-cpp/project/vscode/01-extensions.md +0 -28
- package/skills/developing-cpp/references/comments/examples/declaration-enum.md +0 -48
- package/skills/developing-cpp/references/comments/examples/declaration-function.md +0 -127
- package/skills/developing-cpp/references/comments/examples/declaration-predicate.md +0 -14
- package/skills/developing-cpp/references/comments/examples/implementation-body.md +0 -64
- package/skills/developing-cpp/references/comments/examples/implementation-todo.md +0 -16
- package/skills/developing-cpp/references/comments/glossary/comment-terms.md +0 -93
- package/skills/developing-cpp/references/design/examples/move-result.md +0 -39
- package/skills/developing-cpp/references/design/examples/preview-read.md +0 -40
- package/skills/developing-cpp/references/naming/examples/naming-accessor.md +0 -17
- package/skills/developing-cpp/references/naming/examples/naming-basic.md +0 -3
- package/skills/developing-cpp/references/naming/examples/naming-lower-layer.md +0 -39
- package/skills/developing-cpp/references/naming/examples/naming-player-value.md +0 -16
- package/skills/developing-cpp/references/naming/examples/naming-predicate.md +0 -18
- package/skills/developing-cpp/references/naming/examples/naming-state-change.md +0 -57
- package/skills/developing-cpp/references/naming/identifier-names.md +0 -104
- package/skills/engineering/references/cmake/standard/standards/c++11/README.md +0 -50
- package/skills/engineering/references/cmake/standard/standards/c++14/README.md +0 -48
- package/skills/engineering/references/cmake/standard/standards/c++17/README.md +0 -50
- package/skills/engineering/references/cmake/standard/standards/c++20/README.md +0 -50
- package/skills/engineering/references/cmake/standard/standards/c++23/README.md +0 -50
- package/skills/engineering/references/cmake/targets/examples/glob.md +0 -22
- package/skills/engineering/references/cmake/targets/examples/target.md +0 -156
- /package/skills/engineering/references/cmake/{standard/standards → standards}/c++11/cmake-snippet.cmake +0 -0
- /package/skills/engineering/references/cmake/{standard/standards → standards}/c++14/cmake-snippet.cmake +0 -0
- /package/skills/engineering/references/cmake/{standard/standards → standards}/c++17/cmake-snippet.cmake +0 -0
- /package/skills/engineering/references/cmake/{standard/standards → standards}/c++20/cmake-snippet.cmake +0 -0
- /package/skills/engineering/references/cmake/{standard/standards → standards}/c++23/cmake-snippet.cmake +0 -0
package/README.en.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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
|
|
|
@@ -22,27 +22,33 @@ Fixed-version npm install:
|
|
|
22
22
|
dsh plugin --profile <profile> add npm:@chengzhao-dev/dsh-cpp-workflow@0.7.1
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
The
|
|
25
|
+
The latest published version is `0.7.1`; `0.7.4` exists only in the working tree and is not published yet, so use `0.7.1` above until it is released. `0.7.3` is skipped and will not be published. After the working-tree version is published, switch the npm command to:
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
dsh plugin --profile <profile> add
|
|
28
|
+
dsh plugin --profile <profile> add npm:@chengzhao-dev/dsh-cpp-workflow@0.7.4
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
GitHub tag installs require the matching tag; once `v0.7.4` 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.4
|
|
29
35
|
```
|
|
30
36
|
|
|
31
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
|
|
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
|
|
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
|
|
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/references/cmake/
|
|
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/index.md); the CMake two-layer declaration is in [01-cxx-standard.md](skills/engineering/references/cmake/standards/01-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
|
|
|
@@ -83,7 +89,7 @@ The project root carries only `.vscode/extensions.json` and `settings.json`: cla
|
|
|
83
89
|
|
|
84
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).
|
|
85
91
|
|
|
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).
|
|
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), design principles in [docs/design-principles.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/design-principles.md), comment and naming source-research process in [docs/comment-sources.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/comment-sources.md), version rules in [docs/versioning.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/versioning.md).
|
|
87
93
|
|
|
88
94
|
## Local development
|
|
89
95
|
|
|
@@ -91,7 +97,7 @@ Requires Node.js 22 or newer.
|
|
|
91
97
|
|
|
92
98
|
```bash
|
|
93
99
|
npm ci
|
|
94
|
-
npm test #
|
|
100
|
+
npm test # main pre-commit gate: build, structural/encoding/workflow checks, and unit tests
|
|
95
101
|
npm run test:matrix # real build matrix: 4 templates x 5 standards
|
|
96
102
|
npm run pack:check # inspect the npm package contents
|
|
97
103
|
npm run ci # replay the Ubuntu CI job: install, test, package check
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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
|
|
|
@@ -22,19 +22,25 @@ npm 安装固定版本:
|
|
|
22
22
|
dsh plugin --profile <profile> add npm:@chengzhao-dev/dsh-cpp-workflow@0.7.1
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
npm 当前最新发布是 `0.7.1`;仓库工作区里的 `0.7.4` 尚未发布,发布前请用上面的 0.7.1。`0.7.3` 已跳过、不再发布。工作区版本发布后,把 npm 命令换成:
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
dsh plugin --profile <profile> add
|
|
28
|
+
dsh plugin --profile <profile> add npm:@chengzhao-dev/dsh-cpp-workflow@0.7.4
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
GitHub 标签安装要等 `v0.7.4` 创建后再用;标签创建后,地址中的版本号与标签同号:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
dsh plugin --profile <profile> add github:chengzhao-dev/dsh-cpp-workflow#v0.7.4
|
|
29
35
|
```
|
|
30
36
|
|
|
31
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
|
-
|
|
43
|
+
升级插件后如果这一页暂时只显示出厂值,说明当前窗口还挂着旧的前端产物:重启 DeepSeek Harness,或在插件页点“重新载入页面”即可编辑,不需要重装插件。页面会在打开后自动重试连接,拿到表单就切换为可编辑;保存成功后,状态行会显示写入的 `~/.dsh/profiles/<profile>/cordis.patch.yml`。保存、撤销修改与恢复默认值分三个按钮:撤销只回到最近一次读到的值,恢复默认值只填草稿,点保存才写盘。
|
|
38
44
|
|
|
39
45
|
## 工作区门禁
|
|
40
46
|
|
|
@@ -42,7 +48,7 @@ dsh plugin --profile <profile> add github:chengzhao-dev/dsh-cpp-workflow#v0.7.1
|
|
|
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
|
|
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 <profile> add github:chengzhao-dev/dsh-cpp-workflow#v0.7.1
|
|
|
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/references/cmake/
|
|
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/index.md),CMake 两层声明见 [01-cxx-standard.md](skills/engineering/references/cmake/standards/01-cxx-standard.md)。
|
|
68
74
|
|
|
69
75
|
生成器固定 Ninja,构建目录是 `build/clang/` 与 `build/gcc/`,不共用 `build/`。诊断工具固定 `clang-format`、`clang-tidy`、`clangd`;GCC 模式也不换成别的分析器。
|
|
70
76
|
|
|
@@ -83,7 +89,7 @@ node "<skill-dir>/scripts/checking-environment.mjs" --project . --live
|
|
|
83
89
|
|
|
84
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)。
|
|
85
91
|
|
|
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)。
|
|
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/design-principles.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/design-principles.md),注释与命名资料检索流程在 [docs/comment-sources.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/comment-sources.md),版本规则在 [docs/versioning.md](https://github.com/chengzhao-dev/dsh-cpp-workflow/blob/main/docs/versioning.md)。
|
|
87
93
|
|
|
88
94
|
## 本地开发
|
|
89
95
|
|
|
@@ -91,10 +97,10 @@ node "<skill-dir>/scripts/checking-environment.mjs" --project . --live
|
|
|
91
97
|
|
|
92
98
|
```bash
|
|
93
99
|
npm ci
|
|
94
|
-
npm test #
|
|
100
|
+
npm test # 提交前主门:构建、结构/编码/工作流检查与单元测试
|
|
95
101
|
npm run test:matrix # 四套模板 × 五档标准的真实构建矩阵
|
|
96
102
|
npm run pack:check # 核对 npm 包内容
|
|
97
|
-
npm run ci # 复现 Ubuntu CI
|
|
103
|
+
npm run ci # 复现 Ubuntu CI:安装、测试、打包检查(不含标准矩阵)
|
|
98
104
|
npm run ci:full # 在 ci 之上再跑标准矩阵,需 POSIX 宿主
|
|
99
105
|
```
|
|
100
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
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
3
|
+
# 只做追加:插入一行宿主配置。不改写、不关闭、不替换任何官方行。这一行加载
|
|
4
|
+
# 本包的 `main` 入口,由它通过 `ctx.skills` 注册 developing-cpp、engineering 与
|
|
5
|
+
# building-cpp 三份技能。
|
|
6
6
|
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
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/references/comments/
|
|
12
|
+
* 写法在 `skills/developing-cpp/references/comments/01-rules.md`。设置页保存的值由宿主
|
|
13
13
|
* 写回插件 Config,服务端 `apply(ctx, config)` 用它生成本页快照与检查器参数。
|
|
14
14
|
*
|
|
15
15
|
* 这份文件被 `tsc` 编进 `lib/comment-policy.js`,打包客户端半侧时再内联进
|
|
@@ -236,8 +236,8 @@ function snapshotText(raw) {
|
|
|
236
236
|
|
|
237
237
|
|
|
238
238
|
// 客户端半侧:插件页的配置卡片(plugins.bundle.config),只此一个入口。
|
|
239
|
-
// 标签策略在本文件上方内联(由 scripts/building-client.mjs
|
|
240
|
-
//
|
|
239
|
+
// 标签策略在本文件上方内联(由 scripts/building-client.mjs 读取
|
|
240
|
+
// lib/comment-policy.js 后拼进来),所以预览、默认值与服务端快照永远同源;这里只做表单与外观。
|
|
241
241
|
const React = require('react')
|
|
242
242
|
const h = React.createElement
|
|
243
243
|
|
package/lib/comment-policy.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 注释标签策略:设置页的预览、技能快照与检查器参数共用这一份。
|
|
3
3
|
*
|
|
4
4
|
* 配置只描述「写注释时默认带哪些标签、声明用哪种注释符号」,不描述写法本身;
|
|
5
|
-
* 写法在 `skills/developing-cpp/references/comments/
|
|
5
|
+
* 写法在 `skills/developing-cpp/references/comments/01-rules.md`。设置页保存的值由宿主
|
|
6
6
|
* 写回插件 Config,服务端 `apply(ctx, config)` 用它生成本页快照与检查器参数。
|
|
7
7
|
*
|
|
8
8
|
* 这份文件被 `tsc` 编进 `lib/comment-policy.js`,打包客户端半侧时再内联进
|
package/lib/index.js
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
// dsh-cpp-workflow
|
|
1
|
+
// dsh-cpp-workflow 包入口。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
// and assets resolve from the installed package.
|
|
3
|
+
// 把打包的三份技能注册成一个技能提供方。提供方只读,只扫描
|
|
4
|
+
// `skills/<name>/SKILL.md`;每份技能目录作为 resourceBase,步骤、参考页、
|
|
5
|
+
// 示例与资产都由安装后的包内解析。
|
|
7
6
|
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
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
|
-
//
|
|
17
|
-
// 200
|
|
18
|
-
//
|
|
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
|
-
/**
|
|
59
|
+
/** 读取 SKILL.md 用到的 YAML frontmatter;只支持这些键所需的最小语法。 */
|
|
66
60
|
function parseFrontmatter(source) {
|
|
67
|
-
const
|
|
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:
|
|
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:
|
|
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
|
-
|
|
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
|
|
134
|
+
return { complete: true };
|
|
133
135
|
if (!KNOWN_SKILLS.has(data.name))
|
|
134
|
-
return
|
|
135
|
-
if (typeof data.description !== 'string'
|
|
136
|
-
return
|
|
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
|
|
143
|
+
return { complete: true };
|
|
139
144
|
const candidate = {
|
|
140
145
|
name: data.name,
|
|
141
|
-
description
|
|
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
|
-
|
|
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
|
|
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
|
-
//
|
|
191
|
-
//
|
|
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))
|
package/lib/workspace.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
//
|
|
1
|
+
// dsh-cpp-workflow 的工作区判定。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
// freshly copied template still sees the workflow. The git root is the
|
|
7
|
-
// repository boundary: marker lookup ignores sibling directories and never
|
|
8
|
-
// searches above the root.
|
|
3
|
+
// 仓库只有在「cwd 到 git 根的路径上带着项目技能」时才视为主动启用。标记文件
|
|
4
|
+
// 就是启用声明;C++ 或 CMake 证据刻意不参与,刚复制的模板照样能看到工作流。
|
|
5
|
+
// git 根是仓库边界:标记查找不进兄弟目录,也不向根之上继续。
|
|
9
6
|
import { access } from 'node:fs/promises';
|
|
10
7
|
import path from 'node:path';
|
|
11
8
|
export const PROJECT_SKILL = path.join('.agents', 'skills', 'cpp-workflow-project', 'SKILL.md');
|
|
@@ -19,7 +16,7 @@ async function exists(target) {
|
|
|
19
16
|
return false;
|
|
20
17
|
}
|
|
21
18
|
}
|
|
22
|
-
/**
|
|
19
|
+
/** 最近的上级 git 检出;worktree 的 `.git` 文件也算。 */
|
|
23
20
|
export async function findGitRoot(cwd) {
|
|
24
21
|
if (typeof cwd !== 'string' || cwd.trim() === '')
|
|
25
22
|
return undefined;
|
|
@@ -41,9 +38,8 @@ export async function findGitRoot(cwd) {
|
|
|
41
38
|
return undefined;
|
|
42
39
|
}
|
|
43
40
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* is also returned for diagnostics; it is not the repository boundary.
|
|
41
|
+
* 在 `cwd` 与 git 根之间(含两端)找最近的项目技能标记;根之上的标记不算。
|
|
42
|
+
* 同时返回标记所在目录供诊断,它不是仓库边界。
|
|
47
43
|
*/
|
|
48
44
|
export async function findProjectSkill(cwd, gitRoot) {
|
|
49
45
|
if (typeof cwd !== 'string' || cwd.trim() === '')
|
|
@@ -81,13 +77,10 @@ export async function findProjectSkill(cwd, gitRoot) {
|
|
|
81
77
|
return undefined;
|
|
82
78
|
}
|
|
83
79
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* a freshly copied template still needs the workflow, and an empty project
|
|
87
|
-
* legitimately stops at the build step.
|
|
80
|
+
* 会话门禁:项目技能必须位于 `cwd` 与 git 根之间(含两端)。不要求 C++ 或
|
|
81
|
+
* CMake 证据:刚复制的模板仍需要工作流,空工程也可以合法地停在构建步骤。
|
|
88
82
|
*
|
|
89
|
-
*
|
|
90
|
-
* sibling directory returns false.
|
|
83
|
+
* 没有 cwd、不在 git 检出内、标记只在 git 根之上或只在兄弟目录时返回 false。
|
|
91
84
|
*/
|
|
92
85
|
export async function isCppWorkflowWorkspace(cwd) {
|
|
93
86
|
const gitRoot = await findGitRoot(cwd);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chengzhao-dev/dsh-cpp-workflow",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"description": "写 C++ 源码、配 CMake、用 Clang 构建;头文件用 /// Doxygen 文档注释,函数体用 // 分段说明,文件头标签可在设置里改。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -37,6 +37,12 @@
|
|
|
37
37
|
"@deepseek-ai/dsh-client-ui-plugin-manager"
|
|
38
38
|
]
|
|
39
39
|
},
|
|
40
|
+
"compatibility": {
|
|
41
|
+
"dshReleases": {
|
|
42
|
+
"0.2.1-rc.1": "compatible",
|
|
43
|
+
"0.2.1-rc.5": "compatible"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
40
46
|
"catalog": {
|
|
41
47
|
"category": "skill",
|
|
42
48
|
"summary": {
|
|
@@ -51,10 +57,10 @@
|
|
|
51
57
|
"icon": "./icon.svg",
|
|
52
58
|
"scripts": {
|
|
53
59
|
"build": "tsc -p tsconfig.json && node scripts/building-client.mjs",
|
|
54
|
-
"test": "node scripts/building-client.mjs --check && npm run build && node scripts/checking-skill-links.mjs && node skills/engineering/
|
|
60
|
+
"test": "node scripts/building-client.mjs --check && npm run build && node scripts/checking-skill-links.mjs && node skills/engineering/scripts/checking-encoding.mjs --quiet && node scripts/checking-github-workflows.mjs && node --test tests/*.test.mjs",
|
|
55
61
|
"ci": "npm ci && npm test && npm run pack:check",
|
|
56
62
|
"ci:full": "npm run ci && npm run test:matrix",
|
|
57
|
-
"check:encoding": "node skills/engineering/
|
|
63
|
+
"check:encoding": "node skills/engineering/scripts/checking-encoding.mjs",
|
|
58
64
|
"check:workflows": "node scripts/checking-github-workflows.mjs",
|
|
59
65
|
"test:matrix": "bash scripts/checking-standard-matrix.sh",
|
|
60
66
|
"pack:check": "npm pack --dry-run"
|
|
@@ -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、running-build.sh 与工程内已有的 `.vscode/` 接线。不用于只改源码语义、文档、Python 或与 C++ 无关的文件。
|
|
3
|
+
description: 在已写好 CMake 的 C++11–C++23 工程上配置、构建和检查时使用:Ninja、compile_commands.json、CTest 失败、clang-format、clang-tidy、clangd、environment.json、running-build.sh 与工程内已有的 `.vscode/` 接线。不用于只改源码语义、文档、Python 或与 C++ 无关的文件。
|
|
4
4
|
metadata:
|
|
5
|
-
short-description: C++11–C++23
|
|
5
|
+
short-description: C++11–C++23 构建流程
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# building-cpp
|
|
9
9
|
|
|
10
|
-
本技能处理环境声明、构建入口与工具配置:`environment.json`、`running-build.sh`、`.clang-format`、`.clang-tidy`、`.clangd`、`.vscode/`、构建命令、编译数据库、CTest
|
|
10
|
+
本技能处理环境声明、构建入口与工具配置:`environment.json`、`running-build.sh`、`.clang-format`、`.clang-tidy`、`.clangd`、`.vscode/`、构建命令、编译数据库、CTest 与运行。加载顺序与层表见 [budget.md](../shared/budget.md)。
|
|
11
11
|
|
|
12
12
|
## 适用场景
|
|
13
13
|
|
|
14
|
-
-
|
|
14
|
+
- **负责**:环境四轴与构建入口;工具配置的复制、落地与检查(规则条文归 `engineering`);编码、声明校验、活动校验、项目入口命令的次序。
|
|
15
15
|
- **不负责**:`CMakeLists.txt` 与 `cmake/` 下的 target、属性、标准与模块开 `engineering`,本技能只读它们来配置和检查,不在这一步改 target 图;函数体、类型、命名、异常与源码注释开 `developing-cpp`。
|
|
16
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 的路线。
|
|
17
|
+
- **前置**:存在项目技能 `cpp-workflow-project` 时先读它的 `SKILL.md`、`environment.json` 和 `stages/stage-table.md`。三个环境轴为空、`standard` 非法或组合非法时停在定构建,不猜 WSL、Clang 或构建目录;`standard` 缺失或为空时按默认 `c++23` 继续并提示声明升级;`windows` + `native` 直接拒绝,提示「本版本不能在 Windows 原生壳里构建」,不给补 PowerShell 的路线。
|
|
18
18
|
- **分因**:编译失败时先看诊断指向哪一层。函数体问题回 `developing-cpp` 的定实现;找不到头、链接失败、target 不存在或标准不对转 `engineering` 的对应步骤;没有编译数据库、format/tidy 不在 PATH 或配置不生效留在本技能的定工具配置。
|
|
19
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/` 时按 `
|
|
20
|
+
- **编辑器**:工程根已有 `.vscode/` 时按 `steps/04-vscode.md` 接线;从当前目录向上到 git 根都没有 `.vscode/` 时不打开、也不新建。配置、构建、运行和调试都从 CMake Tools 进入,构建仍以 `running-build.sh` 为准。
|
|
21
21
|
|
|
22
22
|
## 三种操作
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
一次只选一种操作,范围(单点、整段)是任务属性;判据、边界与交接见共用入口 [operations.md](../shared/operations.md)。本技能从 [01-build.md](steps/01-build.md) 进;四类改动是域,不是操作。
|
|
25
25
|
|
|
26
26
|
| 操作 | 什么时候用 | 从哪步进 |
|
|
27
27
|
| --- | --- | --- |
|
|
@@ -40,6 +40,7 @@ metadata:
|
|
|
40
40
|
| 1 | 定构建 | `steps/01-build.md` | 读环境声明,固定 Ninja 与单一编译器,产出编译数据库 |
|
|
41
41
|
| 2 | 定工具配置 | `steps/02-tooling.md` | 格式化、静态检查、clangd 各管一段,互不越界 |
|
|
42
42
|
| 3 | 通过检查 | `steps/03-check.md` | 按编码 → 声明校验 → 活动校验 → 项目入口的次序跑,前一步失败就停 |
|
|
43
|
+
| 4 | VS Code 接线 | `steps/04-vscode.md` | 工程已有 `.vscode/` 时接扩展与设置,没有时不新建 |
|
|
43
44
|
|
|
44
45
|
每步只打开同号的一个步骤文件。判不准才打开 `examples/` 里与该步对应的案例;`references/` 保存完整条文,只在排错、整目录重构,或步骤里明确指向某一条时打开。
|
|
45
46
|
|
|
@@ -47,25 +48,24 @@ metadata:
|
|
|
47
48
|
|
|
48
49
|
| 要做的事 | 打开 |
|
|
49
50
|
| --- | --- |
|
|
50
|
-
| 读环境轴、配置与构建 | `steps/01-build.md`;条文 `references/environment.md`;案例 `examples/environment.md` |
|
|
51
|
+
| 读环境轴、配置与构建 | `steps/01-build.md`;条文 `references/02-environment.md`;案例 `examples/environment.md` |
|
|
51
52
|
| 配 `.clang-format`、`.clang-tidy`、`.clangd` | `steps/02-tooling.md`;条文在 `../engineering/references/formatting/`,一次一份 |
|
|
52
|
-
| 工程已有 `.vscode/`,接扩展与设置 | `
|
|
53
|
-
| 编码、声明校验、活动校验与入口命令 | `steps/03-check.md`;条文 `references/build-script.md` |
|
|
53
|
+
| 工程已有 `.vscode/`,接扩展与设置 | `steps/04-vscode.md`;没有 `.vscode/` 不打开也不新建 |
|
|
54
|
+
| 编码、声明校验、活动校验与入口命令 | `steps/03-check.md`;条文 `references/01-build-script.md` |
|
|
54
55
|
| 新工程模板与可复制配置 | `assets/templates/projects/`、`assets/config/` |
|
|
56
|
+
| 操作判不准、规则冲突 | `../shared/operations.md`、`../shared/rule-priority.md` |
|
|
55
57
|
|
|
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/`。
|
|
58
|
+
链接、rpath 与产物布局读 `../engineering/references/cmake/linking/01-libraries.md`;测试设计、断言与 CTest 注册读 `../engineering/references/cmake/testing/01-ctest.md`;CMake 的 target、标准与函数写法读 `../engineering/references/cmake/`,可复用片段在 `../engineering/references/cmake/assets/`。
|
|
57
59
|
|
|
58
60
|
## 加载预算
|
|
59
61
|
|
|
60
|
-
-
|
|
61
|
-
- 条文只开该步点名的一份;同号案例留到下一次激活。
|
|
62
|
-
- 标准档只打开项目技能声明的那一档,没有声明时用本技能已有的新工程默认,不把其余标准档读进来。
|
|
62
|
+
加载预算见 [budget.md](../shared/budget.md);building-cpp 的步骤固定 4 份。
|
|
63
63
|
|
|
64
|
-
项目技能列出了检查命令时只跑那一条,没有时跑本技能自己的 `scripts/checking-environment.mjs` 与 `../engineering/
|
|
64
|
+
项目技能列出了检查命令时只跑那一条,没有时跑本技能自己的 `scripts/checking-environment.mjs` 与 `../engineering/scripts/checking-encoding.mjs`;退出码为 0 后停在这一步,不再继续走没有失败的步骤。入口脚本只做配置、构建、CTest 与最小运行;`clang-format` 与 `clang-tidy` 的手动检查留在定工具配置,不塞进入口脚本。`environment.json` 的三个环境轴与 `standard` 是唯一来源,缺项就停。
|
|
65
65
|
|
|
66
66
|
## 四类改动
|
|
67
67
|
|
|
68
|
-
四类改动是操作内部的域:操作定入口,域定层次。四域的定义、边界与次序见
|
|
68
|
+
四类改动是操作内部的域:操作定入口,域定层次。四域的定义、边界与次序见 [operations.md](../shared/operations.md);building-cpp 的一次改动混了两类时,按「内容 → 结构 → 版式 → 措辞」拆开做,前一类落定并经检查再进下一类。
|
|
69
69
|
|
|
70
70
|
| 类型 | 典型请求 | 入口步骤 |
|
|
71
71
|
| --- | --- | --- |
|
|
@@ -82,4 +82,4 @@ metadata:
|
|
|
82
82
|
- [ ] `clang-format --dry-run --Werror` 与 `clang-tidy` 在项目源码上零告警;只扫描项目源码和项目头。
|
|
83
83
|
- [ ] CTest 全绿,程序从该编译器的构建目录启动;有测试时注册用 `gtest_discover_tests` 或项目既有机制,运行带 `--output-on-failure --no-tests=error`,失败时报告的是具体角色和原因。
|
|
84
84
|
- [ ] 没有改源码语义,没有覆盖已有工程文件,也没有安装或下载任何工具。
|
|
85
|
-
- [ ] 工程有 `.vscode/` 时,扩展与设置按 `
|
|
85
|
+
- [ ] 工程有 `.vscode/` 时,扩展与设置按 `steps/04-vscode.md` 接好;没有时不新建,也没有 `tasks.json` 或 `launch.json` 另起构建。
|
|
File without changes
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
{
|
|
7
7
|
"host": "windows",
|
|
8
8
|
"build_host": "wsl",
|
|
9
|
-
"compiler": "clang"
|
|
9
|
+
"compiler": "clang",
|
|
10
|
+
"standard": "c++23"
|
|
10
11
|
}
|
|
11
12
|
```
|
|
12
13
|
|
|
@@ -117,10 +118,10 @@ clang 模式要求四者同主版本;这里 18 与 16 不一致,`--live` 失
|
|
|
117
118
|
|
|
118
119
|
```bash
|
|
119
120
|
# CI / Windows 开发机:只读声明,不需要工具链
|
|
120
|
-
node scripts/checking-environment.mjs --project .
|
|
121
|
+
node "<skill-dir>/scripts/checking-environment.mjs" --project .
|
|
121
122
|
|
|
122
123
|
# build host 上:核对构建宿主、PATH 和版本
|
|
123
|
-
node scripts/checking-environment.mjs --project . --live
|
|
124
|
+
node "<skill-dir>/scripts/checking-environment.mjs" --project . --live
|
|
124
125
|
```
|
|
125
126
|
|
|
126
127
|
不带 `--live` 时永远不探测 PATH;不要把活动校验塞进每次构建,构建脚本已经隐含了工具存在性。
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
<!-- 读取时机:写构建脚本时;读完能回答:构建脚本;预算:一次只开这一份(88 行),不自动串联。 -->
|
|
1
2
|
# 构建脚本
|
|
2
3
|
|
|
3
4
|
`assets/templates/projects/common/running-build.sh` 是 POSIX build-host 脚本,适用于 Linux、macOS 和 Windows + WSL。`host=windows` + `build_host=native` 不是本版本支持的组合:声明校验会直接拒绝,脚本也不会在原生 Windows 壳里运行。脚本只做配置、构建、CTest 与运行;格式化与静态检查在编辑时手动跑,不混进构建入口。
|
|
@@ -6,13 +7,13 @@
|
|
|
6
7
|
|
|
7
8
|
不在 `running-build.sh` 里跑。构建脚本只做配置、构建、CTest 与运行;格式化是编辑时动作,不能让构建顺手改动源码。检查放在编辑器保存时或 CI 的独立步骤里。
|
|
8
9
|
|
|
9
|
-
检查(按工程实际源码根替换 `src/`、`include/`、`
|
|
10
|
+
检查(按工程实际源码根替换 `src/`、`include/`、`app/`、`tests/`):
|
|
10
11
|
|
|
11
12
|
```bash
|
|
12
13
|
clang-format --dry-run --Werror src/*.cpp include/*.h
|
|
13
14
|
```
|
|
14
15
|
|
|
15
|
-
需要修复时单独运行 `clang-format -i`,再回看 diff。`clang-format` 只排版,不会把行尾注释搬到上一行;数据成员注释位置按
|
|
16
|
+
需要修复时单独运行 `clang-format -i`,再回看 diff。`clang-format` 只排版,不会把行尾注释搬到上一行;数据成员注释位置按 `../../developing-cpp/references/comments/01-comment-rules.md` 的规则和 `checking-comments.mjs` 检查。
|
|
16
17
|
|
|
17
18
|
## 用法
|
|
18
19
|
|
|
@@ -58,7 +59,7 @@ clang-format --dry-run --Werror src/*.cpp include/*.h
|
|
|
58
59
|
- `Check`:两种模式都在条件不成立时打印诊断并终止。
|
|
59
60
|
- `DebugCheck`:只在 Debug 生效,`NDEBUG` 后展开为空,参数不能带副作用。
|
|
60
61
|
|
|
61
|
-
不要写成 Debug 抛异常、Release 返回 false 的模式分支;这会把调用方逼成两套逻辑。规则详见
|
|
62
|
+
不要写成 Debug 抛异常、Release 返回 false 的模式分支;这会把调用方逼成两套逻辑。规则详见 `../../developing-cpp/references/exceptions/01-exception-rules.md`。
|
|
62
63
|
|
|
63
64
|
## 失败分诊
|
|
64
65
|
|