@chengzhao-dev/dsh-cpp-workflow 0.7.9 → 0.7.11
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 +8 -7
- package/README.md +5 -4
- package/cordis.patch.yml +2 -2
- package/icon.svg +5 -5
- package/lib/client.js +542 -538
- package/lib/comment-policy.js +37 -33
- package/lib/workspace.js +8 -10
- package/locale/en.json +4 -4
- package/locale/zh.json +4 -4
- package/package.json +100 -100
- package/skills/building-cpp/SKILL.md +5 -5
- package/skills/building-cpp/assets/config/.clang-tidy +4 -5
- package/skills/building-cpp/assets/config/.clangd +5 -7
- package/skills/building-cpp/assets/config/.vscode/extensions.json +5 -5
- package/skills/building-cpp/assets/config/.vscode/settings.json +56 -58
- package/skills/building-cpp/examples/environment.md +13 -102
- package/skills/building-cpp/references/01-build-script.md +3 -3
- package/skills/building-cpp/references/02-environment.md +8 -8
- package/skills/building-cpp/scripts/checking-environment.mjs +424 -424
- package/skills/building-cpp/steps/01-build.md +10 -10
- package/skills/building-cpp/steps/02-tooling.md +6 -6
- package/skills/building-cpp/steps/03-check.md +2 -2
- package/skills/building-cpp/steps/04-vscode.md +4 -6
- package/skills/developing-cpp/SKILL.md +8 -9
- package/skills/developing-cpp/references/comments/01-comment-rules.md +50 -26
- package/skills/developing-cpp/references/comments/02-style.md +33 -25
- package/skills/developing-cpp/references/comments/examples/03-declaration-enum.md +14 -14
- package/skills/developing-cpp/references/comments/examples/04-declaration-file.md +12 -8
- package/skills/developing-cpp/references/comments/examples/05-declaration-function.md +20 -10
- package/skills/developing-cpp/references/comments/examples/06-declaration-member.md +4 -4
- package/skills/developing-cpp/references/comments/examples/07-declaration-predicate.md +2 -2
- package/skills/developing-cpp/references/comments/examples/08-declaration-struct.md +6 -6
- package/skills/developing-cpp/references/comments/examples/09-implementation-body.md +41 -41
- package/skills/developing-cpp/references/comments/glossary/01-comment-terms.md +17 -16
- package/skills/developing-cpp/references/design/01-project-design.md +21 -10
- package/skills/developing-cpp/references/design/02-raii.md +5 -4
- package/skills/developing-cpp/references/design/03-third-party.md +2 -2
- package/skills/developing-cpp/references/design/examples/02-coordinate-table.md +12 -12
- package/skills/developing-cpp/references/design/examples/03-header-place.md +1 -1
- package/skills/developing-cpp/references/design/examples/04-library-boundary.md +6 -6
- package/skills/developing-cpp/references/design/examples/06-move-result.md +29 -28
- package/skills/developing-cpp/references/design/examples/07-preview-read.md +24 -23
- package/skills/developing-cpp/references/design/examples/08-screen-enter-exit.md +19 -18
- package/skills/developing-cpp/references/design/examples/09-option-menu.md +6 -6
- package/skills/developing-cpp/references/design/session-layer.md +13 -22
- package/skills/developing-cpp/references/exceptions/01-exception-rules.md +57 -57
- package/skills/developing-cpp/references/exceptions/examples/01-throw-boundary.md +7 -20
- package/skills/developing-cpp/references/exceptions/examples/02-throw-build-mode.md +10 -11
- package/skills/developing-cpp/references/exceptions/examples/03-throw-catch.md +4 -4
- package/skills/developing-cpp/references/exceptions/examples/04-throw-destructor.md +9 -5
- package/skills/developing-cpp/references/exceptions/examples/07-throw-when.md +2 -2
- package/skills/developing-cpp/references/index.md +32 -35
- package/skills/developing-cpp/references/language/glossary/01-language-terms.md +3 -2
- package/skills/developing-cpp/references/language/language-basics/02-initialization.md +1 -1
- package/skills/developing-cpp/references/language/language-basics/05-expressions.md +9 -2
- package/skills/developing-cpp/references/language/language-basics/06-functions.md +2 -3
- package/skills/developing-cpp/references/language/language-basics/09-templates.md +3 -3
- package/skills/developing-cpp/references/language/language-basics/10-language-checklist.md +9 -9
- package/skills/developing-cpp/references/language/performance/03-memory.md +1 -1
- package/skills/developing-cpp/references/language/performance/07-checklist.md +6 -6
- package/skills/developing-cpp/references/language/standard-library/01-containers.md +4 -5
- package/skills/developing-cpp/references/language/standard-library/02-access.md +2 -5
- package/skills/developing-cpp/references/language/standard-library/05-string.md +1 -1
- package/skills/developing-cpp/references/language/standard-library/06-format.md +22 -20
- package/skills/developing-cpp/references/language/standard-library/{11-format-ecosystem.md → 07-format-ecosystem.md} +2 -11
- package/skills/developing-cpp/references/language/standard-library/{07-time.md → 08-time.md} +1 -1
- package/skills/developing-cpp/references/language/standard-library/{09-files.md → 10-files.md} +1 -1
- package/skills/developing-cpp/references/language/standard-library/11-library-checklist.md +8 -0
- package/skills/developing-cpp/references/language/value-types/02-signed.md +7 -7
- package/skills/developing-cpp/references/language/value-types/03-integer-roles.md +14 -2
- package/skills/developing-cpp/references/language/value-types/05-strong-type.md +2 -2
- package/skills/developing-cpp/references/language/value-types/06-const-method.md +5 -5
- package/skills/developing-cpp/references/language/value-types/07-nodiscard.md +1 -1
- package/skills/developing-cpp/references/language/value-types/08-comparison.md +1 -1
- package/skills/developing-cpp/references/language/value-types/09-subscript.md +1 -1
- package/skills/developing-cpp/references/language/value-types/11-checklist.md +7 -7
- package/skills/developing-cpp/references/layout/01-source-layout.md +13 -13
- package/skills/developing-cpp/references/layout/02-file-template.md +10 -10
- package/skills/developing-cpp/references/layout/03-declaration-order.md +83 -42
- package/skills/developing-cpp/references/naming/01-identifier-names.md +32 -30
- package/skills/developing-cpp/references/naming/examples/06-naming-lower-layer.md +15 -15
- package/skills/developing-cpp/references/naming/examples/07-naming-multiple-return.md +2 -2
- package/skills/developing-cpp/references/naming/examples/13-naming-state-change.md +24 -23
- package/skills/developing-cpp/references/naming/glossary/01-naming-terms.md +3 -3
- package/skills/developing-cpp/references/naming/glossary/02-position.md +9 -9
- package/skills/developing-cpp/references/naming/glossary/03-selection.md +5 -1
- package/skills/developing-cpp/references/naming/glossary/04-square.md +3 -3
- package/skills/developing-cpp/references/naming/glossary/05-scoring.md +2 -2
- package/skills/developing-cpp/references/naming/glossary/06-difficulty.md +7 -7
- package/skills/developing-cpp/references/naming/glossary/07-stream.md +1 -1
- package/skills/developing-cpp/references/style/01-google-cpp-style.md +13 -23
- package/skills/developing-cpp/scripts/checking-comments.mjs +961 -755
- package/skills/developing-cpp/scripts/checking-declaration-order.mjs +512 -515
- package/skills/developing-cpp/steps/01-behavior.md +0 -1
- package/skills/developing-cpp/steps/02-boundary.md +2 -3
- package/skills/developing-cpp/steps/03-declaration.md +9 -10
- package/skills/developing-cpp/steps/04-implementation.md +7 -8
- package/skills/engineering/SKILL.md +9 -10
- package/skills/engineering/references/cmake/assets/LinkSettings.cmake +1 -1
- package/skills/engineering/references/cmake/linking/02-rpath.md +5 -6
- package/skills/engineering/references/cmake/modules/01-functions.md +9 -9
- package/skills/engineering/references/cmake/standards/01-cxx-standard.md +6 -6
- package/skills/engineering/references/cmake/standards/index.md +8 -29
- package/skills/engineering/references/cmake/targets/01-target-rules.md +14 -13
- package/skills/engineering/references/cmake/targets/examples/01-rpath.md +1 -1
- package/skills/engineering/references/cmake/testing/01-ctest.md +3 -3
- package/skills/engineering/references/formatting/01-encoding.md +5 -5
- package/skills/engineering/references/formatting/02-clang-format.md +2 -2
- package/skills/engineering/references/formatting/03-clang-tidy.md +5 -5
- package/skills/engineering/references/formatting/04-clangd.md +32 -39
- package/skills/engineering/references/formatting/05-config-comments.md +88 -0
- package/skills/engineering/references/formatting/examples/02-clang-tidy.md +6 -6
- package/skills/engineering/references/formatting/examples/03-clangd.md +17 -17
- package/skills/engineering/references/index.md +5 -4
- package/skills/engineering/scripts/checking-encoding.mjs +369 -369
- package/skills/engineering/steps/01-targets.md +3 -3
- package/skills/engineering/steps/02-modules.md +1 -2
- package/skills/engineering/steps/03-check.md +2 -3
- package/templates/cpp-workflow-project/SKILL.md +1 -1
- package/templates/cpp-workflow-project/environment.json +4 -4
- package/skills/developing-cpp/references/design/examples/05-library-split.md +0 -8
- package/skills/developing-cpp/references/language/standard-library/10-library-checklist.md +0 -10
- package/skills/developing-cpp/references/naming/examples/02-naming-basic.md +0 -4
- package/skills/developing-cpp/references/naming/examples/10-naming-rename.md +0 -6
- package/skills/engineering/references/formatting/examples/04-config-comments.md +0 -70
- /package/skills/developing-cpp/references/language/standard-library/{08-random.md → 09-random.md} +0 -0
package/lib/comment-policy.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
* 注释标签策略:设置页的预览、技能快照与检查器参数共用这一份。
|
|
3
|
+
*
|
|
4
|
+
* 配置只描述「写注释时默认带哪些标签、声明用哪种注释符号」,不描述写法本身;
|
|
5
|
+
* 写法在 `skills/developing-cpp/references/comments/01-comment-rules.md`。设置页保存的值由宿主
|
|
6
|
+
* 写回插件 Config,服务端 `apply(ctx, config)` 用它生成本页快照与检查器参数。
|
|
7
|
+
*
|
|
8
|
+
* 这份文件被 `tsc` 编进 `lib/comment-policy.js`,打包客户端半侧时再内联进
|
|
9
|
+
* `lib/client.js`,所以只能依赖纯函数,不要引入 Node 或 React。
|
|
10
|
+
*/
|
|
11
11
|
/** 文件头标签。 */
|
|
12
12
|
export const HEADER_TAGS = ['brief', 'author', 'date', 'copyright', 'version'];
|
|
13
13
|
/** 函数声明标签:开关决定是否要求写出。 */
|
|
@@ -43,8 +43,8 @@ export const SAMPLE_BRIEF = '<一句话说明本文件>';
|
|
|
43
43
|
/** 预览里的示例文件名:只是占位符,不对应任何工程的真实文件。 */
|
|
44
44
|
export const SAMPLE_FILE = '<文件名>';
|
|
45
45
|
/**
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
* 出厂配置:声明用 `///`,除 @file 与函数体 // 外全部开启;空值仍不写文件头。
|
|
47
|
+
*/
|
|
48
48
|
export const DEFAULT_CONFIG = {
|
|
49
49
|
commentStyle: 'slash',
|
|
50
50
|
brief: { enabled: true, value: '' },
|
|
@@ -63,9 +63,9 @@ export const DEFAULT_CONFIG = {
|
|
|
63
63
|
retval: true,
|
|
64
64
|
};
|
|
65
65
|
/**
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
* 宿主把 volatile 字段交给插件时给的是可读写单元(`.get()`),设置页快照给的是普通值;
|
|
67
|
+
* 两种形状都要按同一个值读取。
|
|
68
|
+
*/
|
|
69
69
|
function unwrap(value) {
|
|
70
70
|
if (value !== null &&
|
|
71
71
|
typeof value === 'object' &&
|
|
@@ -87,8 +87,8 @@ export function commentStyleOf(raw) {
|
|
|
87
87
|
return unwrap(raw) === 'block' ? 'block' : 'slash';
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
* 把宿主给的值补齐成完整配置;缺字段、旧版本或手工改坏的配置都回到出厂值。
|
|
91
|
+
*/
|
|
92
92
|
export function normalizeConfig(raw) {
|
|
93
93
|
const source = raw && typeof raw === 'object' ? raw : {};
|
|
94
94
|
const config = { commentStyle: commentStyleOf(source.commentStyle) };
|
|
@@ -113,8 +113,8 @@ function separatorLine(style) {
|
|
|
113
113
|
return style === 'block' ? ' *' : '///';
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
* 按配置渲染文件头;`@file` 始终是传入的文件名,块注释按 Doxygen 结构分行。
|
|
117
|
+
*/
|
|
118
118
|
export function renderFileHeader(raw, fileName) {
|
|
119
119
|
const config = normalizeConfig(raw);
|
|
120
120
|
const name = text(fileName) || SAMPLE_FILE;
|
|
@@ -132,9 +132,9 @@ export function renderFileHeader(raw, fileName) {
|
|
|
132
132
|
return lines.map((line) => `/// ${line}`);
|
|
133
133
|
}
|
|
134
134
|
/**
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
* 设置页的预览:文件头 + 一段函数注释,只显示当前配置会写出的标签。
|
|
136
|
+
* 返回值里的 `header` 已按声明符号排好,`contract` 是每行标签的正文。
|
|
137
|
+
*/
|
|
138
138
|
export function previewParts(raw, sampleName) {
|
|
139
139
|
const config = normalizeConfig(raw);
|
|
140
140
|
const header = renderFileHeader(config, sampleName || SAMPLE_FILE);
|
|
@@ -155,9 +155,9 @@ export function previewParts(raw, sampleName) {
|
|
|
155
155
|
return { header, contract, declaration: '[[nodiscard]] bool Place(int row, int column);' };
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
* 设置页预览的纯文本形式;客户端半侧用同一份实现渲染 `<pre>`。
|
|
159
|
+
* 块注释的每个内容行前加 ` * `,首尾各占一行。
|
|
160
|
+
*/
|
|
161
161
|
export function previewText(raw, sampleName) {
|
|
162
162
|
const config = normalizeConfig(raw);
|
|
163
163
|
const { header, contract, declaration } = previewParts(config, sampleName);
|
|
@@ -177,9 +177,9 @@ export function previewText(raw, sampleName) {
|
|
|
177
177
|
return lines.join('\n');
|
|
178
178
|
}
|
|
179
179
|
/**
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
* 检查器参数:隐私标签要显式放行,@brief 被关掉时跳过摘要检查,
|
|
181
|
+
* 声明符号切到块注释时让检查器按块注释收口。
|
|
182
|
+
*/
|
|
183
183
|
export function checkerArgs(raw) {
|
|
184
184
|
const config = normalizeConfig(raw);
|
|
185
185
|
const args = [];
|
|
@@ -187,6 +187,10 @@ export function checkerArgs(raw) {
|
|
|
187
187
|
args.push('--comment-style', 'block');
|
|
188
188
|
if (!config.brief.enabled)
|
|
189
189
|
args.push('--no-brief');
|
|
190
|
+
if (!config.param)
|
|
191
|
+
args.push('--no-param');
|
|
192
|
+
if (!config.returns)
|
|
193
|
+
args.push('--no-return');
|
|
190
194
|
for (const tag of PRIVACY_TAGS) {
|
|
191
195
|
if (config[tag].enabled && config[tag].value)
|
|
192
196
|
args.push('--allow-tag', tag);
|
|
@@ -194,12 +198,12 @@ export function checkerArgs(raw) {
|
|
|
194
198
|
return args;
|
|
195
199
|
}
|
|
196
200
|
/**
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
* 技能快照:`get()` 把它接在技能正文末尾,让代理看到当前 profile 的标签开关。
|
|
202
|
+
* 只写一行,列出声明符号、开启与关闭的标签,避免正文膨胀。
|
|
203
|
+
* `@author` 等只认默认值的文件头标签开着却没填值时单列为「未填值」:这种标签
|
|
204
|
+
* 不会写进文件,与「关闭」不是一回事,代理据此既不会漏写,也不会补空标签。
|
|
205
|
+
* `@brief` 的正文按文件写,没有默认值也仍列为开启。
|
|
206
|
+
*/
|
|
203
207
|
export function snapshotText(raw) {
|
|
204
208
|
const config = normalizeConfig(raw);
|
|
205
209
|
const on = ['@file'];
|
package/lib/workspace.js
CHANGED
|
@@ -7,8 +7,6 @@ import { access } from 'node:fs/promises';
|
|
|
7
7
|
import path from 'node:path';
|
|
8
8
|
/** 项目技能目录名,按优先顺序排列;下划线与连字符两种写法等价,连字符是模板与文档的默认写法。 */
|
|
9
9
|
export const PROJECT_SKILL_DIRS = ['cpp_workflow_project', 'cpp-workflow-project'];
|
|
10
|
-
/** 首选标记文件;查找时按 `PROJECT_SKILL_MARKERS` 逐个尝试。 */
|
|
11
|
-
export const PROJECT_SKILL = path.join('.agents', 'skills', PROJECT_SKILL_DIRS[0], 'SKILL.md');
|
|
12
10
|
/** 所有可接受的标记文件,顺序同 `PROJECT_SKILL_DIRS`。 */
|
|
13
11
|
export const PROJECT_SKILL_MARKERS = PROJECT_SKILL_DIRS.map((name) => path.join('.agents', 'skills', name, 'SKILL.md'));
|
|
14
12
|
export const MAX_ASCENT = 64;
|
|
@@ -52,9 +50,9 @@ export async function findGitRoot(cwd) {
|
|
|
52
50
|
return undefined;
|
|
53
51
|
}
|
|
54
52
|
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
* 在 `cwd` 与 git 根之间(含两端)找最近的项目技能标记;根之上的标记不算。
|
|
54
|
+
* 同时返回标记所在目录供诊断,它不是仓库边界。
|
|
55
|
+
*/
|
|
58
56
|
export async function findProjectSkill(cwd, gitRoot) {
|
|
59
57
|
if (typeof cwd !== 'string' || cwd.trim() === '')
|
|
60
58
|
return undefined;
|
|
@@ -91,11 +89,11 @@ export async function findProjectSkill(cwd, gitRoot) {
|
|
|
91
89
|
return undefined;
|
|
92
90
|
}
|
|
93
91
|
/**
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
92
|
+
* 会话门禁:项目技能必须位于 `cwd` 与 git 根之间(含两端)。不要求 C++ 或
|
|
93
|
+
* CMake 证据:刚复制的模板仍需要工作流,空工程也可以合法地停在构建步骤。
|
|
94
|
+
*
|
|
95
|
+
* 没有 cwd、不在 git 检出内、标记只在 git 根之上或只在兄弟目录时返回 false。
|
|
96
|
+
*/
|
|
99
97
|
export async function isCppWorkflowWorkspace(cwd) {
|
|
100
98
|
const gitRoot = await findGitRoot(cwd);
|
|
101
99
|
if (!gitRoot)
|
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "C++ Workflow",
|
|
4
|
+
"description": "Write C++ sources, configure CMake, and build with Clang or GCC; /// Doxygen on declarations, // section notes in bodies, and configurable file-header tags."
|
|
5
|
+
}
|
|
6
6
|
}
|
package/locale/zh.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "C++ 工程流程",
|
|
4
|
+
"description": "写 C++ 源码、配 CMake、用 Clang 或 GCC 构建;头文件用 /// Doxygen 文档注释,函数体用 // 分段说明,文件头标签可在设置里改。"
|
|
5
|
+
}
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,107 +1,107 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
"files": [
|
|
14
|
-
"lib",
|
|
15
|
-
"skills",
|
|
16
|
-
"cordis.patch.yml",
|
|
17
|
-
"locale",
|
|
18
|
-
"icon.svg",
|
|
19
|
-
"README.md",
|
|
20
|
-
"README.en.md",
|
|
21
|
-
"LICENSE",
|
|
22
|
-
"templates"
|
|
23
|
-
],
|
|
24
|
-
"engines": {
|
|
25
|
-
"node": ">=22",
|
|
26
|
-
"dsh": ">=0.2.1-rc.1 <0.3.0-0"
|
|
27
|
-
},
|
|
28
|
-
"dsh": {
|
|
29
|
-
"bundle": {
|
|
30
|
-
"patch": "./cordis.patch.yml"
|
|
2
|
+
"name": "@chengzhao-dev/dsh-cpp-workflow",
|
|
3
|
+
"version": "0.7.11",
|
|
4
|
+
"description": "写 C++ 源码、配 CMake、用 Clang 或 GCC 构建;头文件用 /// Doxygen 文档注释,函数体用 // 分段说明,文件头标签可在设置里改。",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./lib/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./lib/index.js",
|
|
9
|
+
"./client": "./lib/client.js",
|
|
10
|
+
"./package.json": "./package.json",
|
|
11
|
+
"./cordis.patch.yml": "./cordis.patch.yml"
|
|
31
12
|
},
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
13
|
+
"files": [
|
|
14
|
+
"lib",
|
|
15
|
+
"skills",
|
|
16
|
+
"cordis.patch.yml",
|
|
17
|
+
"locale",
|
|
18
|
+
"icon.svg",
|
|
19
|
+
"README.md",
|
|
20
|
+
"README.en.md",
|
|
21
|
+
"LICENSE",
|
|
22
|
+
"templates"
|
|
23
|
+
],
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=22",
|
|
26
|
+
"dsh": ">=0.2.1-rc.1 <0.3.0-0"
|
|
39
27
|
},
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
28
|
+
"dsh": {
|
|
29
|
+
"bundle": {
|
|
30
|
+
"patch": "./cordis.patch.yml"
|
|
31
|
+
},
|
|
32
|
+
"client": {
|
|
33
|
+
"platform": "web",
|
|
34
|
+
"inject": [
|
|
35
|
+
"@deepseek-ai/dsh-client-ui-renderer",
|
|
36
|
+
"@deepseek-ai/dsh-client-ui-settings",
|
|
37
|
+
"@deepseek-ai/dsh-client-ui-plugin-manager"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"compatibility": {
|
|
41
|
+
"dshReleases": {
|
|
42
|
+
"0.2.1-rc.1": "compatible",
|
|
43
|
+
"0.2.1-rc.5": "compatible"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"catalog": {
|
|
47
|
+
"category": "skill",
|
|
48
|
+
"summary": {
|
|
49
|
+
"zh": "写 C++ 源码、配 CMake、用 Clang 或 GCC 构建;头文件用 /// Doxygen 文档注释,函数体用 // 分段说明,文件头标签可在设置里改。",
|
|
50
|
+
"en": "Write C++ sources, configure CMake, and build with Clang or GCC; /// Doxygen on declarations, // section notes in bodies, and configurable file-header tags."
|
|
51
|
+
},
|
|
52
|
+
"capabilities": [
|
|
53
|
+
"skills"
|
|
54
|
+
]
|
|
55
|
+
}
|
|
45
56
|
},
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
"icon": "./icon.svg",
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "tsc -p tsconfig.json && node scripts/building-client.mjs",
|
|
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",
|
|
61
|
+
"ci": "npm ci && npm run check:lib && npm test && npm run pack:check",
|
|
62
|
+
"ci:full": "npm run ci && npm run test:matrix",
|
|
63
|
+
"check:encoding": "node skills/engineering/scripts/checking-encoding.mjs",
|
|
64
|
+
"check:workflows": "node scripts/checking-github-workflows.mjs",
|
|
65
|
+
"test:matrix": "bash scripts/checking-standard-matrix.sh",
|
|
66
|
+
"pack:check": "npm pack --dry-run",
|
|
67
|
+
"check:lib": "node scripts/checking-lib.mjs"
|
|
68
|
+
},
|
|
69
|
+
"keywords": [
|
|
70
|
+
"dsh",
|
|
71
|
+
"dsh-plugin",
|
|
72
|
+
"deepseek-harness",
|
|
73
|
+
"cpp",
|
|
74
|
+
"c++",
|
|
75
|
+
"cplusplus",
|
|
76
|
+
"cmake",
|
|
77
|
+
"ninja",
|
|
78
|
+
"clang",
|
|
79
|
+
"gcc",
|
|
53
80
|
"skills"
|
|
54
|
-
|
|
81
|
+
],
|
|
82
|
+
"license": "MIT",
|
|
83
|
+
"repository": {
|
|
84
|
+
"type": "git",
|
|
85
|
+
"url": "git+https://github.com/chengzhao-dev/dsh-cpp-workflow.git"
|
|
86
|
+
},
|
|
87
|
+
"homepage": "https://github.com/chengzhao-dev/dsh-cpp-workflow#readme",
|
|
88
|
+
"bugs": {
|
|
89
|
+
"url": "https://github.com/chengzhao-dev/dsh-cpp-workflow/issues"
|
|
90
|
+
},
|
|
91
|
+
"publishConfig": {
|
|
92
|
+
"access": "public",
|
|
93
|
+
"provenance": true
|
|
94
|
+
},
|
|
95
|
+
"peerDependencies": {
|
|
96
|
+
"@deepseek-ai/dsh-skill": ">=0.2.1-rc.1 <0.3.0-0"
|
|
97
|
+
},
|
|
98
|
+
"dependencies": {
|
|
99
|
+
"@deepseek-ai/schemastery": "^3.18.5"
|
|
100
|
+
},
|
|
101
|
+
"devDependencies": {
|
|
102
|
+
"@deepseek-ai/dsh-skill": ">=0.2.1-rc.1 <0.3.0-0",
|
|
103
|
+
"@types/node": "^22.20.5",
|
|
104
|
+
"typescript": "^5.9.3",
|
|
105
|
+
"yaml": "^2.9.1"
|
|
55
106
|
}
|
|
56
|
-
},
|
|
57
|
-
"icon": "./icon.svg",
|
|
58
|
-
"scripts": {
|
|
59
|
-
"build": "tsc -p tsconfig.json && node scripts/building-client.mjs",
|
|
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",
|
|
61
|
-
"ci": "npm ci && npm test && npm run check:lib && npm run pack:check",
|
|
62
|
-
"ci:full": "npm run ci && npm run test:matrix",
|
|
63
|
-
"check:encoding": "node skills/engineering/scripts/checking-encoding.mjs",
|
|
64
|
-
"check:workflows": "node scripts/checking-github-workflows.mjs",
|
|
65
|
-
"test:matrix": "bash scripts/checking-standard-matrix.sh",
|
|
66
|
-
"pack:check": "npm pack --dry-run",
|
|
67
|
-
"check:lib": "node scripts/checking-lib.mjs"
|
|
68
|
-
},
|
|
69
|
-
"keywords": [
|
|
70
|
-
"dsh",
|
|
71
|
-
"dsh-plugin",
|
|
72
|
-
"deepseek-harness",
|
|
73
|
-
"cpp",
|
|
74
|
-
"c++",
|
|
75
|
-
"cplusplus",
|
|
76
|
-
"cmake",
|
|
77
|
-
"ninja",
|
|
78
|
-
"clang",
|
|
79
|
-
"gcc",
|
|
80
|
-
"skills"
|
|
81
|
-
],
|
|
82
|
-
"license": "MIT",
|
|
83
|
-
"repository": {
|
|
84
|
-
"type": "git",
|
|
85
|
-
"url": "git+https://github.com/chengzhao-dev/dsh-cpp-workflow.git"
|
|
86
|
-
},
|
|
87
|
-
"homepage": "https://github.com/chengzhao-dev/dsh-cpp-workflow#readme",
|
|
88
|
-
"bugs": {
|
|
89
|
-
"url": "https://github.com/chengzhao-dev/dsh-cpp-workflow/issues"
|
|
90
|
-
},
|
|
91
|
-
"publishConfig": {
|
|
92
|
-
"access": "public",
|
|
93
|
-
"provenance": true
|
|
94
|
-
},
|
|
95
|
-
"peerDependencies": {
|
|
96
|
-
"@deepseek-ai/dsh-skill": ">=0.2.1-rc.1 <0.3.0-0"
|
|
97
|
-
},
|
|
98
|
-
"dependencies": {
|
|
99
|
-
"@deepseek-ai/schemastery": "^3.18.5"
|
|
100
|
-
},
|
|
101
|
-
"devDependencies": {
|
|
102
|
-
"@deepseek-ai/dsh-skill": ">=0.2.1-rc.1 <0.3.0-0",
|
|
103
|
-
"@types/node": "^22.20.5",
|
|
104
|
-
"typescript": "^5.9.3",
|
|
105
|
-
"yaml": "^2.9.1"
|
|
106
|
-
}
|
|
107
107
|
}
|
|
@@ -14,9 +14,9 @@ metadata:
|
|
|
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`。声明非法时停在定构建,不猜 WSL、Clang 或构建目录;判定规则与取值见
|
|
17
|
+
- **前置**:存在项目技能 `cpp-workflow-project` 时先读它的 `SKILL.md`、`environment.json` 和 `stages/stage-table.md`。声明非法时停在定构建,不猜 WSL、Clang 或构建目录;判定规则与取值见 `references/02-environment.md`「合法组合」。
|
|
18
18
|
- **分因**:编译失败时先看诊断指向哪一层。函数体问题回 `developing-cpp` 的定实现;找不到头、链接失败、target 不存在或标准不对转 `engineering` 的对应步骤;没有编译数据库、format/tidy 不在 PATH 或配置不生效留在本技能的定工具配置。
|
|
19
|
-
- **编码**:源码与构建文件用 UTF-8 无 BOM、检出 LF,`.bat` / `.cmd` 用 CRLF
|
|
19
|
+
- **编码**:源码与构建文件用 UTF-8 无 BOM、检出 LF,`.bat` / `.cmd` 用 CRLF;机器规则以仓库根 `.gitattributes` 与 `.editorconfig` 为准。完整规则见 `../engineering/references/formatting/01-encoding.md`;MSVC 不是受支持的环境轴,`/utf-8` 只在 `engineering` 的编码一节写给外部工程看。
|
|
20
20
|
- **编辑器**:工程根已有 `.vscode/` 时按 `steps/04-vscode.md` 接线;从当前目录向上到工程根(含 `CMakeLists.txt` 的目录)都没有 `.vscode/` 时不打开、也不新建,外层仓库根或书根的 `.vscode/` 不算工程配置。配置、构建、运行和调试都从 CMake Tools 进入,构建仍以 `running-build.sh` 为准。
|
|
21
21
|
|
|
22
22
|
## 三种操作
|
|
@@ -30,7 +30,7 @@ metadata:
|
|
|
30
30
|
| 润色 | 只改诊断措辞或失败分流说明 | 第 3 步 |
|
|
31
31
|
|
|
32
32
|
- 不发明项目没有声明的环境轴、命令和 target;只改格式或配置时不改可观察行为。
|
|
33
|
-
-
|
|
33
|
+
- 不整份重写已有源码、`CMakeLists.txt` 和 `.clang-*`,只做与本任务相关的最小改动;不安装工具链;代理侧不写 `wsl` 或 `bash -lc`。
|
|
34
34
|
- 后一步发现前一步没做完,退回那一步;发现环境轴、编译器、构建目录或 target 契约需要改,整段退回并转 `engineering`。
|
|
35
35
|
|
|
36
36
|
## 步骤
|
|
@@ -61,7 +61,7 @@ metadata:
|
|
|
61
61
|
|
|
62
62
|
加载预算见 [budget.md](../shared/budget.md);building-cpp 的步骤固定 4 份。
|
|
63
63
|
|
|
64
|
-
环境检查跑本技能自己的 `scripts/checking-environment.mjs`,编码检查跑 `../engineering/scripts/checking-encoding.mjs
|
|
64
|
+
环境检查跑本技能自己的 `scripts/checking-environment.mjs`,编码检查跑 `../engineering/scripts/checking-encoding.mjs`;编码检查脚本从目标文件所在目录向上找 `.gitattributes` 与 `.editorconfig`,工程另有声明时以声明为准;环境检查脚本向上找项目技能的 `environment.json`。这些命令只覆盖各自那一段,完成判据还要求入口命令、CTest 与格式化检查,按 `steps/03-check.md` 的顺序跑完再停在这一步。入口脚本只做配置、构建、CTest 与最小运行;`clang-format` 与 `clang-tidy` 不进入口脚本,入口通过后按 `steps/03-check.md` 第 4 步手动跑。`environment.json` 的三个环境轴是唯一来源;取值与合法性见 `references/02-environment.md`「合法组合」,脚本行为见 `scripts/checking-environment.mjs`。
|
|
65
65
|
|
|
66
66
|
## 四类改动
|
|
67
67
|
|
|
@@ -80,6 +80,6 @@ metadata:
|
|
|
80
80
|
- [ ] 配置命令固定 Ninja 和单一编译器,`build/<compiler>/compile_commands.json` 存在;项目技能没有声明单一构建目录时,根 `build/compile_commands.json` 还要指向当前编译器。
|
|
81
81
|
- [ ] target 契约已经成立:程序 target(模板默认 `app`)、库 target、公共 include、标准与输出目录都已由 `engineering` 写好;本技能没有偷偷改 CMake 来绕过失败。
|
|
82
82
|
- [ ] `clang-format --dry-run --Werror` 与 `clang-tidy` 在项目源码上零告警;只扫描项目源码和项目头。
|
|
83
|
-
- [ ] CTest 全绿,程序从该编译器的构建目录启动;有测试时注册用 `gtest_discover_tests` 或项目既有机制,调用条件与参数以 `steps/03-check.md` 第 4
|
|
83
|
+
- [ ] CTest 全绿,程序从该编译器的构建目录启动;有测试时注册用 `gtest_discover_tests` 或项目既有机制,调用条件与参数以 `steps/03-check.md` 第 4 步为唯一出处,`references/01-build-script.md` 第 7 条只写脚本侧;失败时报告的是具体角色和原因。
|
|
84
84
|
- [ ] 没有改源码语义,没有覆盖已有工程文件,也没有安装或下载任何工具。
|
|
85
85
|
- [ ] 工程有 `.vscode/` 时,扩展与设置按 `steps/04-vscode.md` 接好;没有时不新建,也没有 `tasks.json` 或 `launch.json` 另起构建。
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
# 命名规则;不再整包启用 cppcoreguidelines-*,也不靠本地关闭项维持风格。
|
|
1
|
+
# 只启用 google-* 与命名检查。
|
|
3
2
|
InheritParentConfig: false
|
|
4
3
|
|
|
5
4
|
Checks: >
|
|
@@ -14,8 +13,8 @@ UseColor: true
|
|
|
14
13
|
|
|
15
14
|
CheckOptions:
|
|
16
15
|
# 命名按 Google:类型/函数 PascalCase,变量 snake_case,私有成员尾随 _,
|
|
17
|
-
#
|
|
18
|
-
#
|
|
16
|
+
# 编译期常量 k 前缀。本项目函数与访问器统一 PascalCase,但 FunctionCase
|
|
17
|
+
# 不设:这一项由命名规则与评审守住,clang-tidy 不重复配置。
|
|
19
18
|
- key: readability-identifier-naming.NamespaceCase
|
|
20
19
|
value: lower_case
|
|
21
20
|
- key: readability-identifier-naming.ClassCase
|
|
@@ -53,7 +52,7 @@ CheckOptions:
|
|
|
53
52
|
value: CamelCase
|
|
54
53
|
- key: readability-identifier-naming.GlobalConstantPrefix
|
|
55
54
|
value: 'k'
|
|
56
|
-
#
|
|
55
|
+
# 局部 const 与局部 constexpr 按变量命名;k 前缀只给编译期常量。
|
|
57
56
|
- key: readability-identifier-naming.LocalConstantCase
|
|
58
57
|
value: lower_case
|
|
59
58
|
- key: readability-identifier-naming.MacroDefinitionCase
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
#
|
|
2
|
-
# 否则 C++23 工程会被降成 .clangd 里的旧标准。
|
|
1
|
+
# 编译数据库目录;切换编译器时同步改。
|
|
3
2
|
CompileFlags:
|
|
4
|
-
|
|
3
|
+
CompilationDatabase: build/clang
|
|
5
4
|
Diagnostics:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
- pp_file_not_found
|
|
5
|
+
Suppress:
|
|
6
|
+
# 项目头由编译数据库提供;解析噪声不掩盖真实诊断。
|
|
7
|
+
- pp_file_not_found
|
|
@@ -1,60 +1,58 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"**/.cache": true
|
|
59
|
-
}
|
|
2
|
+
// 编译器驱动用绝对路径;GCC 模式改成真实 GCC 的路径(Linux 通常 /usr/bin/g++,macOS 用 Homebrew 的 gcc-14 等)。
|
|
3
|
+
// 只允许这一个驱动,不用 * 通配。
|
|
4
|
+
"clangd.arguments": [
|
|
5
|
+
"--query-driver=/usr/bin/clang++",
|
|
6
|
+
"--header-insertion=never",
|
|
7
|
+
"--background-index"
|
|
8
|
+
],
|
|
9
|
+
// 构建、运行和调试入口统一交给 CMake Tools。
|
|
10
|
+
"cmake.buildDirectory": "${workspaceFolder}/build/clang",
|
|
11
|
+
// 构建固定用 Ninja,与工程入口脚本一致;换生成器要同步脚本。
|
|
12
|
+
"cmake.generator": "Ninja",
|
|
13
|
+
// 打开工程时不自动配置,配置时机由入口脚本决定。
|
|
14
|
+
"cmake.configureOnOpen": false,
|
|
15
|
+
// 运行前先构建,避免跑到旧产物。
|
|
16
|
+
"cmake.buildBeforeRun": true,
|
|
17
|
+
// 生成 compile_commands.json,供 clangd 与 clang-tidy 读取。
|
|
18
|
+
"cmake.exportCompileCommandsFile": true,
|
|
19
|
+
// CMake Tools 的快速调试默认使用 C/C++ 扩展的 cppdbg 适配器;
|
|
20
|
+
// 这里只把它的调试后端改成 LLDB。GCC 模式改成 gdb + /usr/bin/gdb。
|
|
21
|
+
"cmake.debugConfig": {
|
|
22
|
+
"type": "cppdbg",
|
|
23
|
+
"request": "launch",
|
|
24
|
+
"MIMode": "lldb",
|
|
25
|
+
"miDebuggerPath": "/usr/bin/lldb",
|
|
26
|
+
"stopAtEntry": false,
|
|
27
|
+
"externalConsole": false
|
|
28
|
+
},
|
|
29
|
+
// IntelliSense 由 clangd 提供。
|
|
30
|
+
"C_Cpp.intelliSenseEngine": "disabled",
|
|
31
|
+
// 保存即格式化;实际排版交给 clangd,不在构建脚本里跑 clang-format -i。
|
|
32
|
+
"editor.formatOnSave": true,
|
|
33
|
+
// C/C++ 的默认格式化器都交给 clangd。
|
|
34
|
+
"[cpp]": {
|
|
35
|
+
"editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd"
|
|
36
|
+
},
|
|
37
|
+
"[c]": {
|
|
38
|
+
"editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd"
|
|
39
|
+
},
|
|
40
|
+
// 项目头文件统一按 C++ 解析,避免被当成 C。
|
|
41
|
+
"files.associations": {
|
|
42
|
+
"*.h": "cpp"
|
|
43
|
+
},
|
|
44
|
+
// 文件按 UTF-8 保存。
|
|
45
|
+
"files.encoding": "utf8",
|
|
46
|
+
// 行尾用 LF。
|
|
47
|
+
"files.eol": "\n",
|
|
48
|
+
// 构建产物与本地缓存不显示在资源管理器里。
|
|
49
|
+
"files.exclude": {
|
|
50
|
+
"**/build": true,
|
|
51
|
+
"**/.cache": true
|
|
52
|
+
},
|
|
53
|
+
// 同一批目录也不进入搜索结果。
|
|
54
|
+
"search.exclude": {
|
|
55
|
+
"**/build": true,
|
|
56
|
+
"**/.cache": true
|
|
57
|
+
}
|
|
60
58
|
}
|