kld-sdd 2.6.12 → 2.6.14
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.md +29 -7
- package/kld-sdd-guide.html +428 -159
- package/lib/init.js +37 -7
- package/package.json +5 -2
- package/skywalk-sdd/index.cjs +2668 -415
- package/skywalk-sdd/metrics-v3.cjs +1153 -0
- package/skywalk-sdd/ontology/archive-package.cjs +120 -3
- package/skywalk-sdd/ontology/identity-index.cjs +9 -2
- package/skywalk-sdd/ontology/ontology-paths.cjs +73 -0
- package/skywalk-sdd/ontology/resolve-spec-root.cjs +20 -80
- package/skywalk-sdd/ontology/runtime.cjs +32 -22
- package/skywalk-sdd/ontology/structural-identity.cjs +11 -2
- package/skywalk-sdd/ontology/traceability-validator.cjs +16 -8
- package/skywalk-sdd/ontology/working-artifacts.cjs +4 -2
- package/skywalk-sdd/reporting/change-report-model.cjs +309 -0
- package/skywalk-sdd/reporting/change-report-renderer.cjs +425 -0
- package/skywalk-sdd/runtime-metadata.cjs +21 -0
- package/templates/hooks/claude/hooks/sdd-apply-test-gate.cjs +39 -9
- package/templates/hooks/claude/hooks/sdd-post-tool.cjs +87 -8
- package/templates/hooks/claude/hooks/sdd-prompt.cjs +3 -1
- package/templates/hooks/codebuddy/hooks/sdd-apply-test-gate.cjs +39 -9
- package/templates/hooks/codebuddy/hooks/sdd-post-tool.cjs +87 -9
- package/templates/hooks/codebuddy/hooks/sdd-prompt.cjs +3 -1
- package/templates/skills/kld-sdd/opsx-apply/SKILL.md +14 -13
- package/templates/skills/kld-sdd/opsx-apply/checklist.md +20 -20
- package/templates/skills/kld-sdd/opsx-apply/implementer-prompt.md +12 -12
- package/templates/skills/kld-sdd/opsx-apply/reference.md +32 -31
- package/templates/skills/kld-sdd/opsx-archive/SKILL.md +44 -6
- package/templates/skills/kld-sdd/opsx-archive/checklist.md +5 -2
- package/templates/skills/kld-sdd/opsx-check/SKILL.md +21 -13
- package/templates/skills/kld-sdd/opsx-check/checklist.md +8 -7
- package/templates/skills/kld-sdd/opsx-design/SKILL.md +1 -1
- package/templates/skills/kld-sdd/opsx-design/checklist.md +1 -1
- package/templates/skills/kld-sdd/opsx-kb-ingest/SKILL.md +14 -0
- package/templates/skills/kld-sdd/opsx-ontology-query/SKILL.md +31 -0
- package/templates/skills/kld-sdd/opsx-propose/SKILL.md +12 -4
- package/templates/skills/kld-sdd/opsx-propose/reference.md +29 -3
- package/templates/skills/kld-sdd/opsx-rules/reference.md +3 -1
- package/templates/skills/kld-sdd/opsx-spec/SKILL.md +2 -2
- package/templates/skills/kld-sdd/opsx-spec/checklist.md +1 -1
- package/templates/skills/kld-sdd/opsx-task/SKILL.md +10 -10
- package/templates/skills/kld-sdd/opsx-task/checklist.md +3 -3
- package/templates/skills/kld-sdd/opsx-task/reference.md +3 -3
- package/templates/skills/kld-sdd/opsx-test/SKILL.md +7 -5
- package/templates/skills/kld-sdd/{opsx-tdd-anti-patterns → tdd-anti-patterns}/SKILL.md +4 -4
- package/templates/skills/kld-sdd/{opsx-tdd-anti-patterns → tdd-anti-patterns}/reference.md +4 -4
- package/templates/skills/kld-sdd/{opsx-tdd-core → tdd-core}/SKILL.md +13 -13
- package/templates/skills/kld-sdd/{opsx-tdd-core → tdd-core}/checklist.md +5 -5
- package/templates/skills/kld-sdd/{opsx-tdd-core → tdd-core}/reference.md +12 -12
- package/templates/skills/kld-sdd/{opsx-tdd-metrics → tdd-metrics}/SKILL.md +3 -3
- package/templates/skills/kld-sdd/{opsx-tdd-metrics → tdd-metrics}/checklist.md +2 -2
- package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/SKILL.md +2 -2
- package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/general/parameterized-testing.md +1 -1
- package/templates/skills/kld-sdd/{opsx-tdd-review → tdd-review}/SKILL.md +5 -5
- package/templates/skills/kld-sdd/{opsx-tdd-review → tdd-review}/checklist.md +5 -5
- package/templates/skills/kld-sdd/{opsx-tdd-rules → tdd-rules}/SKILL.md +3 -3
- package/templates/skills/kld-sdd/{opsx-tdd-rules → tdd-rules}/rules/non-tdd-modules.md +1 -1
- package/templates/skills/kld-sdd/{opsx-tdd-rules → tdd-rules}/rules/refactor-checklist.md +1 -1
- package/templates/skills/kld-sdd/tdd-rules/rules/test-skeleton-telemetry.md +19 -0
- package/templates/skills/kld-sdd/opsx-tdd-rules/rules/test-skeleton-telemetry.md +0 -19
- /package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/general/cause-effect-clarity.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/general/clean-test-data.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/general/existing-test-awareness.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/general/given-when-then.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/general/good-test-qualities.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/general/mock-boundary.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/general/naming-conventions.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/general/no-logic-in-tests.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/general/one-test-one-scenario.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/general/prefer-public-apis.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/general/test-behaviors-not-methods.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/java/argument-matching.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/java/controller-test-rules.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/java/domain-service-rules.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/java/java-test-template.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/java/json-serialization.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/java/logging-rules.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/post-generation/compilation-verification.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/post-generation/execution-verification.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/python/py-test-template.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-quality → tdd-quality}/rules/typescript/ts-test-template.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-rules → tdd-rules}/rules/controller-strategy.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-rules → tdd-rules}/rules/dag-generation-rules.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-rules → tdd-rules}/rules/des-step-annotation.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-rules → tdd-rules}/rules/exception-path-coverage.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-rules → tdd-rules}/rules/green-scope-declaration.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-rules → tdd-rules}/rules/green-yagni-fence.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-rules → tdd-rules}/rules/multi-validation-split.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-rules → tdd-rules}/rules/task-type-definitions.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-rules → tdd-rules}/rules/tdd-strategy-selection.md +0 -0
- /package/templates/skills/kld-sdd/{opsx-tdd-rules → tdd-rules}/rules/test-execution-gate.md +0 -0
package/lib/init.js
CHANGED
|
@@ -822,6 +822,31 @@ function deployTelemetryDataDir(targetCwd = process.cwd()) {
|
|
|
822
822
|
console.log(` ⚠️ Telemetry CLI 源文件缺失: ${telemetrySrc}`);
|
|
823
823
|
}
|
|
824
824
|
|
|
825
|
+
const metricsV3Src = path.join(pkgPath, 'skywalk-sdd', 'metrics-v3.cjs');
|
|
826
|
+
const metricsV3Dst = path.join(dataDir, 'metrics-v3.cjs');
|
|
827
|
+
if (fs.existsSync(metricsV3Src)) {
|
|
828
|
+
fs.copyFileSync(metricsV3Src, metricsV3Dst);
|
|
829
|
+
console.log(' ✓ 部署 skywalk-sdd/metrics-v3.cjs(V3 指标运行时)');
|
|
830
|
+
} else {
|
|
831
|
+
console.log(` ⚠️ V3 指标模块源文件缺失: ${metricsV3Src}(report/metrics 可能无法加载 metrics-v3)`);
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
const packageVersion = require(path.join(pkgPath, 'package.json')).version;
|
|
835
|
+
const runtimeMetadataDst = path.join(dataDir, 'runtime-metadata.cjs');
|
|
836
|
+
fs.writeFileSync(
|
|
837
|
+
runtimeMetadataDst,
|
|
838
|
+
`'use strict';\nmodule.exports = { resolveRuntimeMetadata() { return { version: '${packageVersion}', producer: 'kld-sdd@${packageVersion}' }; } };\n`,
|
|
839
|
+
'utf8',
|
|
840
|
+
);
|
|
841
|
+
console.log(` ✓ 部署 kld-sdd 运行时身份(${packageVersion})`);
|
|
842
|
+
|
|
843
|
+
const reportingSrc = path.join(pkgPath, 'skywalk-sdd', 'reporting');
|
|
844
|
+
const reportingDst = path.join(dataDir, 'reporting');
|
|
845
|
+
if (fs.existsSync(reportingSrc)) {
|
|
846
|
+
copyDir(reportingSrc, reportingDst);
|
|
847
|
+
console.log(' ✓ 部署 skywalk-sdd/reporting/(V3 单次变更报告)');
|
|
848
|
+
}
|
|
849
|
+
|
|
825
850
|
const contextClientSrc = path.join(pkgPath, 'skywalk-sdd', 'context-client.cjs');
|
|
826
851
|
const contextClientDst = path.join(dataDir, 'context-client.cjs');
|
|
827
852
|
if (fs.existsSync(contextClientSrc)) {
|
|
@@ -858,6 +883,7 @@ function deployTelemetryDataDir(targetCwd = process.cwd()) {
|
|
|
858
883
|
console.log(' ✓ openspec: node skywalk-sdd/openspec-shim.cjs list(自动 cd 到 *-sdd-specs)');
|
|
859
884
|
console.log(' ✓ Spec Context: node skywalk-sdd/context-client.cjs --query="<自然语言需求>" --target-stage=spec');
|
|
860
885
|
console.log(' ✓ Apply worktree: record-base 在 §1.5;收尾 apply-worktree-finish.cjs --change=<name>');
|
|
886
|
+
console.log(' ℹ️ project-identity.json 将在首次配置 KB(opsx-ontology-query)时自动创建');
|
|
861
887
|
console.log('✅ Telemetry 已就绪(数据存储在 skywalk-sdd/,无需配置 MCP)');
|
|
862
888
|
return true;
|
|
863
889
|
}
|
|
@@ -873,16 +899,20 @@ function installGitHookShim(cwd, hookName, scriptPath, options = {}) {
|
|
|
873
899
|
// Git 把 commit-msg 文件路径放在 $1;--project 等额外参数必须跟在 "$@" 后面,
|
|
874
900
|
// 否则 trailer 脚本会把 --project=… 误当成 message 文件(argv[2])。
|
|
875
901
|
const extraArgs = options.extraArgs || '';
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
902
|
+
// Windows 反斜杠路径在 #!/bin/sh(Git for Windows MSYS2)中不被 [ -f ] 和 node 识别,
|
|
903
|
+
// 统一转为正斜杠,确保 hook shim 跨平台可执行。
|
|
904
|
+
const shScriptPath = scriptPath.replace(/\\/g, '/');
|
|
905
|
+
const shExtraArgs = extraArgs.replace(/\\/g, '/');
|
|
906
|
+
const nodeLine = shExtraArgs
|
|
907
|
+
? ` node "${shScriptPath}" "$@" ${shExtraArgs}`
|
|
908
|
+
: ` node "${shScriptPath}" "$@"`;
|
|
879
909
|
const shim = [
|
|
880
910
|
'#!/bin/sh',
|
|
881
911
|
`# ${marker}`,
|
|
882
|
-
`if [ -f "${
|
|
912
|
+
`if [ -f "${shScriptPath}" ]; then`,
|
|
883
913
|
nodeLine,
|
|
884
914
|
'else',
|
|
885
|
-
` echo "[kld-sdd] Hook 脚本不存在: ${
|
|
915
|
+
` echo "[kld-sdd] Hook 脚本不存在: ${shScriptPath}" >&2`,
|
|
886
916
|
' exit 1',
|
|
887
917
|
'fi',
|
|
888
918
|
'',
|
|
@@ -892,7 +922,7 @@ function installGitHookShim(cwd, hookName, scriptPath, options = {}) {
|
|
|
892
922
|
const existing = fs.readFileSync(hookPath, 'utf8');
|
|
893
923
|
if (existing.includes(marker)) {
|
|
894
924
|
// 已是 SDD shim:若指向路径变化(如改为引用 spec 仓),允许覆盖升级
|
|
895
|
-
if (existing.includes(
|
|
925
|
+
if (existing.includes(shScriptPath) && (!shExtraArgs || existing.includes(shExtraArgs.trim()))) {
|
|
896
926
|
console.log(` ✓ .git/hooks/${hookName} 已包含 SDD 质量门禁`);
|
|
897
927
|
return;
|
|
898
928
|
}
|
|
@@ -951,7 +981,7 @@ function installCodeRepoCommitMsgHook(codeRepoRoot, specRepoRoot, options = {})
|
|
|
951
981
|
return false;
|
|
952
982
|
}
|
|
953
983
|
installGitHookShim(cwd, 'commit-msg', ensured.scriptPath, {
|
|
954
|
-
extraArgs:
|
|
984
|
+
extraArgs: `"--project=${cwd}"`,
|
|
955
985
|
});
|
|
956
986
|
return true;
|
|
957
987
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kld-sdd",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.14",
|
|
4
4
|
"description": "KLD SDD OpenSpec 项目初始化工具 - 一键部署 SDD skills",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"kld-sdd-init": "bin/kld-sdd-init.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"test": "node test/external-key.cjs && node test/change-key.cjs && node test/modules-and-sdd-config.cjs && node test/active-changes.cjs && node test/hook-layouts.cjs && node test/spec-package-init.cjs && node test/workspace-layout.cjs && node test/ontology-release-blockers.cjs && node test/ontology-semantic-core.cjs && node test/ontology-identity-versioning.cjs && node test/ontology-identity-continuity.cjs && node test/ontology-state-transaction.cjs && node test/ontology-process-concurrency.cjs && node test/ontology-observer-convergence.cjs && node test/ontology-working-runtime.cjs && node test/ontology-stage-materialization.cjs && node test/ontology-template-contract.cjs && node test/ontology-cli-archive.cjs && node test/archive-package-producer.cjs && node test/validate-skills-bundle.cjs && node test/tool-profiles.cjs && node test/settings-merge.cjs && node test/command-bridge.cjs && node test/codebuddy-hooks.cjs && node test/skill-content-contract.cjs && node test/init-agent-profiles.cjs"
|
|
11
|
+
"test": "node test/external-key.cjs && node test/change-key.cjs && node test/modules-and-sdd-config.cjs && node test/active-changes.cjs && node test/hook-layouts.cjs && node test/spec-package-init.cjs && node test/workspace-layout.cjs && node test/ontology-release-blockers.cjs && node test/ontology-semantic-core.cjs && node test/ontology-identity-versioning.cjs && node test/ontology-identity-continuity.cjs && node test/ontology-state-transaction.cjs && node test/ontology-process-concurrency.cjs && node test/ontology-observer-convergence.cjs && node test/ontology-working-runtime.cjs && node test/ontology-stage-materialization.cjs && node test/ontology-template-contract.cjs && node test/ontology-cli-archive.cjs && node test/archive-package-producer.cjs && node --test test/change-report-correctness.cjs test/report-metrics-correctness.cjs test/change-report-model-ui.cjs && node test/validate-skills-bundle.cjs && node test/tool-profiles.cjs && node test/settings-merge.cjs && node test/command-bridge.cjs && node test/codebuddy-hooks.cjs && node test/skill-content-contract.cjs && node test/init-agent-profiles.cjs && node test/init-report-runtime.cjs"
|
|
12
12
|
},
|
|
13
13
|
"keywords": [
|
|
14
14
|
"kld",
|
|
@@ -32,6 +32,9 @@
|
|
|
32
32
|
"templates/",
|
|
33
33
|
"kld-sdd-guide.html",
|
|
34
34
|
"skywalk-sdd/index.cjs",
|
|
35
|
+
"skywalk-sdd/metrics-v3.cjs",
|
|
36
|
+
"skywalk-sdd/runtime-metadata.cjs",
|
|
37
|
+
"skywalk-sdd/reporting/",
|
|
35
38
|
"skywalk-sdd/context-client.cjs",
|
|
36
39
|
"skywalk-sdd/ontology/",
|
|
37
40
|
"skywalk-sdd/apply-worktree-finish.cjs",
|