@wwkit/harness 1.0.33 → 1.0.34
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/LICENSE +21 -21
- package/README.md +128 -128
- package/agents/scrum.md +206 -186
- package/agents/sprint.md +130 -121
- package/bin/index.js +291 -226
- package/commands/fix.md +87 -87
- package/commands/git-sync.md +217 -217
- package/commands/net-port.md +364 -364
- package/commands/pytest.md +10 -10
- package/commands/resume.md +104 -104
- package/commands/tl.md +11 -11
- package/commands/tsl.md +12 -0
- package/package.json +5 -4
- package/plugin.js +19 -19
- package/readme/development.md +39 -39
- package/readme/publish.md +41 -41
- package/readme/testing.md +44 -44
- package/scripts/postinstall.js +58 -58
- package/skills/better-skill/SKILL.md +192 -124
- package/skills/blame-skill/SKILL.md +148 -201
- package/skills/blame-skill/references/scoring-rules.md +190 -0
- package/skills/blame-sprint-agent/SKILL.md +167 -0
- package/skills/blame-sprint-agent/references/scoring-rules.md +113 -0
- package/skills/blame-sprint-skill/SKILL.md +154 -0
- package/skills/blame-sprint-skill/references/scoring-rules.md +101 -0
- package/skills/extract/SKILL.md +119 -119
- package/skills/extract/references/build-xpath.js +30 -30
- package/skills/extract/references/clean-html.js +90 -90
- package/skills/extract/references/detail.md +54 -54
- package/skills/extract/references/detail.schema.json5 +48 -48
- package/skills/extract/references/extract-detail.js +71 -71
- package/skills/extract/references/extract-regex.js +81 -81
- package/skills/extract/references/extract-sample.js +48 -48
- package/skills/extract/references/list-rule-gen.md +109 -109
- package/skills/extract/references/list.md +134 -134
- package/skills/extract/references/list.schema.json5 +33 -33
- package/skills/extract/references/navi.md +44 -44
- package/skills/extract/references/navi.schema.json5 +23 -23
- package/skills/extract/references/text.md +40 -40
- package/skills/extract/references/text.schema.json5 +21 -21
- package/skills/extract/references/to-text.js +20 -20
- package/skills/extract/references/validate-schema.js +39 -39
- package/skills/jstest/SKILL.md +561 -561
- package/skills/jstest/references/case-create.md +327 -327
- package/skills/jstest/references/case-fix.md +273 -273
- package/skills/jstest/references/config.md +148 -148
- package/skills/jstest/references/coverage-analyze.md +247 -247
- package/skills/jstest/references/env-ensure.md +210 -210
- package/skills/jstest/references/execute.md +168 -168
- package/skills/jstest/references/sample.md +166 -166
- package/skills/jstest/references/scoring-rules.md +75 -75
- package/skills/jstest/references/src/jstest-sample/Calculator.js +80 -80
- package/skills/jstest/references/src/jstest-sample/ConfigManager.js +72 -72
- package/skills/jstest/references/src/jstest-sample/FileProcessor.js +57 -57
- package/skills/jstest/references/src/jstest-sample/OrderService.js +98 -98
- package/skills/jstest/references/src/jstest-sample/TokenGenerator.js +60 -60
- package/skills/jstest/references/src/jstest-sample/UserService.js +56 -56
- package/skills/jstest/references/src/jstest-sample/index.js +6 -6
- package/skills/jstest/references/suitability-check.md +232 -232
- package/skills/jstest/references/test-standards.md +288 -288
- package/skills/lint/SKILL.md +440 -440
- package/skills/lint/references/ai-fix.md +137 -137
- package/skills/lint/references/config-setup.md +102 -102
- package/skills/lint/references/config.md +65 -65
- package/skills/lint/references/detect-language.js +65 -65
- package/skills/lint/references/env-ensure.md +88 -88
- package/skills/lint/references/language-detect.md +75 -75
- package/skills/lint/references/languages/js.md +110 -110
- package/skills/lint/references/languages/py.md +89 -89
- package/skills/lint/references/rules-analyze.md +125 -125
- package/skills/lint/references/suitability-check.md +81 -81
- package/skills/lint/references/tool-fix.md +90 -90
- package/skills/new-skill/SKILL.md +193 -227
- package/skills/pytest/SKILL.md +555 -555
- package/skills/pytest/references/case-create.md +324 -324
- package/skills/pytest/references/case-fix.md +271 -271
- package/skills/pytest/references/config.md +145 -145
- package/skills/pytest/references/coverage-analyze.md +223 -223
- package/skills/pytest/references/env-ensure.md +195 -195
- package/skills/pytest/references/execute.md +152 -152
- package/skills/pytest/references/sample.md +159 -159
- package/skills/pytest/references/scoring-rules.md +57 -57
- package/skills/pytest/references/src/pytest-sample/Calculator.py +67 -67
- package/skills/pytest/references/src/pytest-sample/ConfigManager.py +68 -68
- package/skills/pytest/references/src/pytest-sample/FileProcessor.py +53 -53
- package/skills/pytest/references/src/pytest-sample/OrderService.py +82 -82
- package/skills/pytest/references/src/pytest-sample/TokenGenerator.py +50 -50
- package/skills/pytest/references/src/pytest-sample/UserService.py +45 -45
- package/skills/pytest/references/suitability-check.md +220 -220
- package/skills/pytest/references/test-standards.md +244 -244
- package/skills/query/SKILL.md +71 -71
- package/skills/read-docs/SKILL.md +134 -134
- package/skills/read-docs/references/opencode/agents/cases.md +206 -206
- package/skills/read-docs/references/opencode/agents/design-pattern.md +47 -47
- package/skills/read-docs/references/opencode/agents/detail.md +191 -191
- package/skills/read-docs/references/opencode/agents/examples.md +100 -100
- package/skills/read-docs/references/opencode/agents/index.md +309 -309
- package/skills/read-docs/references/opencode/agents/parallel-dispatch.md +149 -149
- package/skills/read-docs/references/opencode/agents/subagent-internals.md +217 -217
- package/skills/read-docs/references/opencode/agents/workflow.md +161 -161
- package/skills/read-docs/references/opencode/cli/commands/acp.md +31 -31
- package/skills/read-docs/references/opencode/cli/commands/agent.md +16 -16
- package/skills/read-docs/references/opencode/cli/commands/attach.md +20 -20
- package/skills/read-docs/references/opencode/cli/commands/mcp.md +37 -37
- package/skills/read-docs/references/opencode/cli/commands/others.md +48 -48
- package/skills/read-docs/references/opencode/cli/commands/plugin.md +12 -12
- package/skills/read-docs/references/opencode/cli/commands/provider.md +43 -43
- package/skills/read-docs/references/opencode/cli/commands/run.md +81 -81
- package/skills/read-docs/references/opencode/cli/commands/serve.md +84 -84
- package/skills/read-docs/references/opencode/cli/commands/session.md +37 -37
- package/skills/read-docs/references/opencode/cli/commands/web.md +14 -14
- package/skills/read-docs/references/opencode/cli/env.md +38 -38
- package/skills/read-docs/references/opencode/cli/index.md +18 -18
- package/skills/read-docs/references/opencode/cli/tui.md +35 -35
- package/skills/read-docs/references/opencode/commands/examples.md +42 -42
- package/skills/read-docs/references/opencode/commands/index.md +185 -185
- package/skills/read-docs/references/opencode/config/provider.md +151 -151
- package/skills/read-docs/references/opencode/formatter/index.md +70 -70
- package/skills/read-docs/references/opencode/guide/config.md +419 -419
- package/skills/read-docs/references/opencode/guide/formatters.md +70 -70
- package/skills/read-docs/references/opencode/guide/index.md +37 -37
- package/skills/read-docs/references/opencode/guide/providers.md +31 -31
- package/skills/read-docs/references/opencode/guide/rules.md +63 -63
- package/skills/read-docs/references/opencode/plugins/examples.md +75 -75
- package/skills/read-docs/references/opencode/plugins/index.md +188 -188
- package/skills/read-docs/references/opencode/reference/index.md +118 -118
- package/skills/read-docs/references/opencode/rule/index.md +77 -77
- package/skills/read-docs/references/opencode/skills/detail.md +113 -113
- package/skills/read-docs/references/opencode/skills/examples.md +141 -141
- package/skills/read-docs/references/opencode/skills/index.md +126 -126
- package/skills/read-docs/references/opencode/skills/workflow.md +146 -146
- package/skills/read-docs/references/opencode/tests/agent.md +9 -9
- package/skills/read-docs/references/opencode/tests/config.md +59 -59
- package/skills/read-docs/references/opencode/tests/file.md +11 -11
- package/skills/read-docs/references/opencode/tests/serve.md +17 -17
- package/skills/read-docs/references/opencode/tests/session.md +30 -30
- package/skills/read-docs/references/opencode/tests/web.md +16 -16
- package/skills/read-docs/references/opencode/tools/arguments.md +305 -305
- package/skills/read-docs/references/opencode/tools/context.md +17 -17
- package/skills/read-docs/references/opencode/tools/custom.md +110 -110
- package/skills/read-docs/references/opencode/tools/detail.md +104 -104
- package/skills/read-docs/references/opencode/tools/examples.md +71 -71
- package/skills/read-docs/references/opencode/tools/index.md +56 -56
- package/skills/read-docs/references/opencode/tools/lsp.md +25 -25
- package/skills/read-docs/references/opencode/tools/mcp.md +132 -132
- package/skills/read-docs/references/opencode/train/README.md +134 -134
- package/skills/read-docs/references/opencode/train/agent-basic.md +771 -771
- package/skills/read-docs/references/opencode/train/command-basic.md +667 -667
- package/skills/read-docs/references/opencode/train/config-basic.md +508 -508
- package/skills/read-docs/references/opencode/train/index.md +163 -163
- package/skills/read-docs/references/opencode/train/practice.md +872 -872
- package/skills/read-docs/references/opencode/train/skill-basic.md +607 -607
- package/skills/read-docs/references/opencode/tui/commands/config.md +31 -31
- package/skills/read-docs/references/opencode/tui/commands/editor.md +46 -46
- package/skills/read-docs/references/opencode/tui/commands/index.md +124 -124
- package/skills/read-docs/references/opencode/tui/commands/init.md +4 -4
- package/skills/read-docs/references/opencode/tui/index.md +26 -26
- package/skills/read-docs/references/superpowers/bootstrap.md +107 -107
- package/skills/read-docs/references/superpowers/comparison.md +77 -77
- package/skills/read-docs/references/superpowers/context.md +71 -71
- package/skills/read-docs/references/superpowers/index.md +58 -58
- package/skills/read-docs/references/superpowers/parallel.md +49 -49
- package/skills/read-docs/references/superpowers/sdd.md +183 -183
- package/skills/read-docs/references/superpowers/skills.md +68 -68
- package/skills/read-docs/references/superpowers/workflow.md +83 -83
- package/skills/revise/SKILL.md +121 -121
- package/skills/revise/references/article.md +36 -36
- package/skills/revise/references/article.schema.json5 +40 -40
- package/skills/revise/references/gallery.md +34 -34
- package/skills/revise/references/gallery.schema.json5 +40 -40
- package/skills/revise/references/question.md +32 -32
- package/skills/revise/references/question.schema.json5 +31 -31
- package/skills/revise/references/status.md +31 -31
- package/skills/revise/references/status.schema.json5 +27 -27
- package/skills/revise/references/validate-schema.js +39 -39
- package/skills/step-extract/SKILL.md +205 -0
- package/skills/tsl/SKILL.md +393 -0
- package/skills/tsl/package.json +10 -0
- package/skills/tsl/references/global-review-rules.md +25 -0
- package/skills/tsl/references/prepare-prompt.md +150 -0
- package/skills/tsl/references/terminology-rules.md +93 -0
- package/skills/tsl/references/translation-guide.md +23 -0
- package/skills/tsl/references/translation-prompt.md +115 -0
- package/skills/tsl/references/translation-rules.md +48 -0
- package/skills/tsl/references/verification-rules.md +58 -0
- package/skills/tsl/scripts/check-boundaries.js +140 -0
- package/skills/tsl/scripts/chunk-text.js +144 -0
- package/skills/tsl/scripts/clean-text.js +121 -0
- package/skills/tsl/scripts/cleanup-glossary.js +160 -0
- package/skills/tsl/scripts/extract-pdf.js +94 -0
- package/skills/tsl/scripts/generate-review.js +179 -0
- package/skills/tsl/scripts/merge-result.js +164 -0
- package/skills/tsl/scripts/verify-chunk.js +170 -0
- package/skills/tsl-format/SKILL.md +298 -0
- package/skills/tsl-format/references/format-prompt.md +103 -0
- package/skills/tsl-format/references/format-rules.md +58 -0
- package/skills/tsl-format/scripts/chunk-bilingual.js +96 -0
- package/skills/tsl-format/scripts/merge-format.js +105 -0
- package/src/config.js +29 -29
- package/src/config.json5 +19 -19
- package/skills/new-skill/references/template.md +0 -53
- package/skills/new-skill/references/workflow-patterns.md +0 -104
package/scripts/postinstall.js
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* postinstall: 设置 opencode 所需的系统环境变量
|
|
4
|
-
*
|
|
5
|
-
* OPENCODE_CONFIG_DIR = harness 包安装目录(agents/skills/commands 所在)
|
|
6
|
-
* OPENCODE_EXPERIMENTAL_LSP_TOOL = true
|
|
7
|
-
*
|
|
8
|
-
* 通过 @wwkit/shared 的 Shell.setEnvVar 实现跨平台持久化写入:
|
|
9
|
-
* Unix → shell profile(.zshrc / .bashrc / .profile)
|
|
10
|
-
* Windows → setx(用户级注册表)
|
|
11
|
-
*/
|
|
12
|
-
import fs from 'node:fs'
|
|
13
|
-
import path from 'node:path'
|
|
14
|
-
import { fileURLToPath } from 'node:url'
|
|
15
|
-
import { Shell } from '@wwkit/shared'
|
|
16
|
-
|
|
17
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
18
|
-
const pkgRoot = path.resolve(__dirname, '..')
|
|
19
|
-
|
|
20
|
-
// 防御性:确保 bin/index.js 有执行位。
|
|
21
|
-
// git 历史曾因源码模式位 100644 导致全局安装后 bin 软链接目标不可执行(permission denied);
|
|
22
|
-
// 任何重写该文件而不保留模式的操作(编辑器通过软链接保存、cp、fs.copyFile 等)会回退到 0644。
|
|
23
|
-
// postinstall 在每次 install/upgrade 时运行,此处兜底恢复执行位。
|
|
24
|
-
try {
|
|
25
|
-
const binPath = path.join(pkgRoot, 'bin', 'index.js')
|
|
26
|
-
if (fs.existsSync(binPath)) {
|
|
27
|
-
const mode = fs.statSync(binPath).mode & 0o777
|
|
28
|
-
if (!(mode & 0o111)) {
|
|
29
|
-
fs.chmodSync(binPath, 0o755)
|
|
30
|
-
console.log(`harness: restored exec permission on bin/index.js (was 0${mode.toString(8)})`)
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
} catch (e) {
|
|
34
|
-
console.warn(`harness: failed to ensure bin exec permission — ${e.message}`)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const shell = new Shell()
|
|
38
|
-
|
|
39
|
-
try {
|
|
40
|
-
const wrote1 = shell.setEnvVar('OPENCODE_CONFIG_DIR', pkgRoot)
|
|
41
|
-
console.log(
|
|
42
|
-
wrote1
|
|
43
|
-
? `harness: set OPENCODE_CONFIG_DIR=${pkgRoot}`
|
|
44
|
-
: `harness: OPENCODE_CONFIG_DIR already set to ${pkgRoot}`
|
|
45
|
-
)
|
|
46
|
-
} catch (e) {
|
|
47
|
-
console.warn(`harness: failed to set OPENCODE_CONFIG_DIR — ${e.message}`)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
try {
|
|
51
|
-
const wrote2 = shell.setEnvVar('OPENCODE_EXPERIMENTAL_LSP_TOOL', 'true')
|
|
52
|
-
console.log(
|
|
53
|
-
wrote2
|
|
54
|
-
? 'harness: set OPENCODE_EXPERIMENTAL_LSP_TOOL=true'
|
|
55
|
-
: 'harness: OPENCODE_EXPERIMENTAL_LSP_TOOL already set to true'
|
|
56
|
-
)
|
|
57
|
-
} catch (e) {
|
|
58
|
-
console.warn(`harness: failed to set OPENCODE_EXPERIMENTAL_LSP_TOOL — ${e.message}`)
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* postinstall: 设置 opencode 所需的系统环境变量
|
|
4
|
+
*
|
|
5
|
+
* OPENCODE_CONFIG_DIR = harness 包安装目录(agents/skills/commands 所在)
|
|
6
|
+
* OPENCODE_EXPERIMENTAL_LSP_TOOL = true
|
|
7
|
+
*
|
|
8
|
+
* 通过 @wwkit/shared 的 Shell.setEnvVar 实现跨平台持久化写入:
|
|
9
|
+
* Unix → shell profile(.zshrc / .bashrc / .profile)
|
|
10
|
+
* Windows → setx(用户级注册表)
|
|
11
|
+
*/
|
|
12
|
+
import fs from 'node:fs'
|
|
13
|
+
import path from 'node:path'
|
|
14
|
+
import { fileURLToPath } from 'node:url'
|
|
15
|
+
import { Shell } from '@wwkit/shared'
|
|
16
|
+
|
|
17
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
18
|
+
const pkgRoot = path.resolve(__dirname, '..')
|
|
19
|
+
|
|
20
|
+
// 防御性:确保 bin/index.js 有执行位。
|
|
21
|
+
// git 历史曾因源码模式位 100644 导致全局安装后 bin 软链接目标不可执行(permission denied);
|
|
22
|
+
// 任何重写该文件而不保留模式的操作(编辑器通过软链接保存、cp、fs.copyFile 等)会回退到 0644。
|
|
23
|
+
// postinstall 在每次 install/upgrade 时运行,此处兜底恢复执行位。
|
|
24
|
+
try {
|
|
25
|
+
const binPath = path.join(pkgRoot, 'bin', 'index.js')
|
|
26
|
+
if (fs.existsSync(binPath)) {
|
|
27
|
+
const mode = fs.statSync(binPath).mode & 0o777
|
|
28
|
+
if (!(mode & 0o111)) {
|
|
29
|
+
fs.chmodSync(binPath, 0o755)
|
|
30
|
+
console.log(`harness: restored exec permission on bin/index.js (was 0${mode.toString(8)})`)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
} catch (e) {
|
|
34
|
+
console.warn(`harness: failed to ensure bin exec permission — ${e.message}`)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const shell = new Shell()
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
const wrote1 = shell.setEnvVar('OPENCODE_CONFIG_DIR', pkgRoot)
|
|
41
|
+
console.log(
|
|
42
|
+
wrote1
|
|
43
|
+
? `harness: set OPENCODE_CONFIG_DIR=${pkgRoot}`
|
|
44
|
+
: `harness: OPENCODE_CONFIG_DIR already set to ${pkgRoot}`
|
|
45
|
+
)
|
|
46
|
+
} catch (e) {
|
|
47
|
+
console.warn(`harness: failed to set OPENCODE_CONFIG_DIR — ${e.message}`)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
const wrote2 = shell.setEnvVar('OPENCODE_EXPERIMENTAL_LSP_TOOL', 'true')
|
|
52
|
+
console.log(
|
|
53
|
+
wrote2
|
|
54
|
+
? 'harness: set OPENCODE_EXPERIMENTAL_LSP_TOOL=true'
|
|
55
|
+
: 'harness: OPENCODE_EXPERIMENTAL_LSP_TOOL already set to true'
|
|
56
|
+
)
|
|
57
|
+
} catch (e) {
|
|
58
|
+
console.warn(`harness: failed to set OPENCODE_EXPERIMENTAL_LSP_TOOL — ${e.message}`)
|
|
59
59
|
}
|
|
@@ -1,124 +1,192 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: better-skill
|
|
3
|
-
description:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
1.
|
|
18
|
-
2.
|
|
19
|
-
3.
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
|
123
|
-
|
|
124
|
-
|
|
|
1
|
+
---
|
|
2
|
+
name: better-skill
|
|
3
|
+
description: Use when improving a skill to pass both blame-skill (general quality) and blame-sprint-skill (Sprint paradigm structure) audits at A grade (90+). Triggers on: skill optimization, skill quality improvement, skill scoring loop, blame-skill score below 90, blame-sprint-skill score below 90. Runs a score-improve-rescore loop with dual evaluators until both pass or max 3 rounds.
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
workflow: sequential
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# better-skill 技能(固定 Sprint 冲刺)
|
|
10
|
+
|
|
11
|
+
自包含 Skill 双评分迭代优化器:输入 skill 名称,同时用 blame-skill(通用质量 7 类 100 分)和 blame-sprint-skill(Sprint 范式 4 类 100 分)两套评分规则评分,按 gap 分析→改进→重评 loop 迭代,直到两项均≥90(A 级)或轮次耗尽(≤3 轮)。调用方直接传原始任务消息即可,无需预处理。
|
|
12
|
+
|
|
13
|
+
## 执行范式
|
|
14
|
+
|
|
15
|
+
每次调用 = 一个固定 Sprint,三个事件:
|
|
16
|
+
|
|
17
|
+
1. **Sprint Planning**:解析入参 → 定义 Sprint Goal → todowrite 落固定 5 项 Sprint Backlog(每项带 DoD)
|
|
18
|
+
2. **Sprint Execution**:逐项执行,每项 = 执行 → 验证 DoD → todowrite 勾单 Done。其中 Item 3-4 构成改进-重评 loop(≤3 轮)
|
|
19
|
+
3. **Sprint Review**:对照 Sprint Goal 验证 Increment(优化报告)及输出格式
|
|
20
|
+
|
|
21
|
+
**Sprint Goal** = `对目标 skill 完成 blame-skill + blame-sprint-skill 双评分,迭代改进至两项均≥90 或轮次耗尽,输出优化报告`。
|
|
22
|
+
|
|
23
|
+
## 输入参数
|
|
24
|
+
|
|
25
|
+
入参为调用方传入的**原始任务消息**,可为 JSON 对象、key=value 或自然语言等任意形态,agent 依据字段语义自主提取。字段清单:
|
|
26
|
+
|
|
27
|
+
| 字段 | 类型 | 必填 | 说明 |
|
|
28
|
+
|---|---|---|---|
|
|
29
|
+
| `skill_name` | string | ✅ | 要优化的 skill 名称或目录路径(如 `extract`、`tsl`、`skills/tsl/`) |
|
|
30
|
+
| `target_score` | number | ❌ | 目标分数,默认 90(A 级) |
|
|
31
|
+
| `max_rounds` | number | ❌ | 最大改进轮次,默认 3 |
|
|
32
|
+
|
|
33
|
+
## Skill 加载路径
|
|
34
|
+
|
|
35
|
+
如果入参是目录路径(以 `/` 结尾或包含 `/`),直接读取 `<dir>/SKILL.md`。否则按以下顺序查找目标 Skill 的 SKILL.md 文件,找到即停止:
|
|
36
|
+
|
|
37
|
+
1. **项目级**:`.opencode/skills/<skill_name>/SKILL.md`(从当前目录向上遍历至 git worktree)
|
|
38
|
+
2. **OPENCODE_CONFIG_DIR**:`$OPENCODE_CONFIG_DIR/skills/<skill_name>/SKILL.md`
|
|
39
|
+
3. **全局**:`~/.config/opencode/skills/<skill_name>/SKILL.md`
|
|
40
|
+
|
|
41
|
+
## 固定 Sprint Backlog(todowrite 落单,覆盖历史 todos)
|
|
42
|
+
|
|
43
|
+
1. 基线双评分 | DoD: 通过 skill 工具调用 blame-skill 获取评分报告、通过 skill 工具调用 blame-sprint-skill 获取评分报告、目标 SKILL.md 已读取全文、两项基线得分(分项+总分+等级)已记录
|
|
44
|
+
2. Gap 分析 + 改进方案 | DoD: 两项评分中所有未满分项已列出(标注来源 blame-skill/blame-sprint-skill + 扣分原因 + 分值)、改进优先级已排序(先改高分值扣分项)、每项改进方案已制定
|
|
45
|
+
3. 改进执行(Round 1/3) | DoD: 按优先级用 edit 工具修改目标 SKILL.md、本轮改进项已记录(改了什么+为什么)
|
|
46
|
+
4. 重评验证(Round 1/3) | DoD: 两项重评得分已记录、达标判断已完成(两项均≥target_score → 标记 3-4 completed 进入 5;未达标且 round<3 → 更新 3-4 文本为 Round N+1/3 并重置状态继续 loop;未达标且 round=3 → 标记 3-4 completed 进入 5)
|
|
47
|
+
5. 输出报告 | DoD: 报告含基线→最终得分对比表、两项分项明细、改进历程(每轮改了什么+得分变化)、未解决项及后续建议
|
|
48
|
+
|
|
49
|
+
## Sprint Execution
|
|
50
|
+
|
|
51
|
+
按固定 5 项逐项执行(勾单机制见执行范式)。
|
|
52
|
+
|
|
53
|
+
### Item 1:基线双评分
|
|
54
|
+
|
|
55
|
+
从原始任务消息中提取 `skill_name`、`target_score`(缺省 90)、`max_rounds`(缺省 3)。
|
|
56
|
+
|
|
57
|
+
**短路规则(命中即结束):**
|
|
58
|
+
|
|
59
|
+
1. `skill_name` 为空或仅含空白 → stderr 报错结束
|
|
60
|
+
2. 按加载路径查找目标 SKILL.md,均未找到 → stderr 报错结束
|
|
61
|
+
|
|
62
|
+
未短路时:
|
|
63
|
+
1. `read` 目标 SKILL.md 全文
|
|
64
|
+
2. `bash ls` 目标 skill 目录检查 references/ 子目录
|
|
65
|
+
3. 通过 `skill` 工具调用 `blame-skill`(传入 `skill_name`)→ 获取通用质量评分报告 → 记录 `score_general`(分项+总分+等级)
|
|
66
|
+
4. 通过 `skill` 工具调用 `blame-sprint-skill`(传入 `skill_name`)→ 获取 Sprint 范式评分报告 → 记录 `score_sprint`(分项+总分+等级)
|
|
67
|
+
|
|
68
|
+
**提前退出**:如果两项基线得分均已 ≥ target_score → 标记 Item 2-4 为 cancelled,直接进入 Item 5。
|
|
69
|
+
|
|
70
|
+
### Item 2:Gap 分析 + 改进方案
|
|
71
|
+
|
|
72
|
+
合并两项评分中所有未满分项,形成统一 gap 清单:
|
|
73
|
+
|
|
74
|
+
| 来源 | 项目 | 扣分 | 原因 | 改进方案 |
|
|
75
|
+
|---|---|---|---|---|
|
|
76
|
+
| blame-skill | [项目名] | X | [现状] | [具体方案] |
|
|
77
|
+
| blame-sprint-skill | [项目名] | X | [现状] | [具体方案] |
|
|
78
|
+
|
|
79
|
+
**优先级排序原则**:
|
|
80
|
+
1. 先改高分值扣分项(8 分项 > 3 分项)
|
|
81
|
+
2. 同分值先改结构性缺失(整节缺失 > 内容不完整)
|
|
82
|
+
3. 同结构先改 blame-sprint-skill 项(Sprint 范式是骨架,先立骨架再填内容)
|
|
83
|
+
|
|
84
|
+
**改进原则**:
|
|
85
|
+
- 只优化结构和质量,不改变 skill 的核心功能语义
|
|
86
|
+
- 改进方案必须具体可操作("在 X 节添加 Y 内容",不是"改善 X")
|
|
87
|
+
- 如果两个 blame 对同一问题有不同要求,取更严格的要求
|
|
88
|
+
|
|
89
|
+
### Item 3:改进执行(Round N/max_rounds)
|
|
90
|
+
|
|
91
|
+
按 Item 2 的优先级顺序,用 `edit` 工具修改目标 SKILL.md:
|
|
92
|
+
|
|
93
|
+
1. 逐项应用改进方案
|
|
94
|
+
2. 每项改进记录:改了什么(before → after)、对应哪个 gap
|
|
95
|
+
3. 本轮改进完成后进入 Item 4 重评
|
|
96
|
+
|
|
97
|
+
**改进常见模式**:
|
|
98
|
+
|
|
99
|
+
| Gap 类型 | 改进操作 |
|
|
100
|
+
|---|---|
|
|
101
|
+
| description 不符合 Use when 格式 | 改写为 "Use when [触发条件]. Triggers on: [关键词]." |
|
|
102
|
+
| 缺执行范式节 | 添加"## 执行范式"节,声明固定 Sprint + 三事件 |
|
|
103
|
+
| 缺固定 Sprint Backlog | 添加"## 固定 Sprint Backlog"节,列出 N 项 + DoD |
|
|
104
|
+
| DoD 格式不统一 | 统一为 `<任务> \| DoD: <标准>` 格式 |
|
|
105
|
+
| 缺 todowrite 指导 | 在 Backlog 节添加"todowrite 落单,覆盖历史 todos" |
|
|
106
|
+
| 缺短路规则 | 在 Item 1 详解中添加短路规则(空输入/未找到即结束) |
|
|
107
|
+
| 缺 Sprint Review | 添加"## Sprint Review"节,对照 Sprint Goal 验证 |
|
|
108
|
+
| 缺无状态声明 | 在 Sprint Review 节添加"无状态独立 Sprint,故不进行 Retrospective" |
|
|
109
|
+
| Item 详解不完整 | 为每个 Backlog Item 添加 `### Item N` 详解节 |
|
|
110
|
+
| 缺 When to Use / When NOT to Use | 添加适用/不适用场景说明 |
|
|
111
|
+
|
|
112
|
+
### Item 4:重评验证(Round N/max_rounds)
|
|
113
|
+
|
|
114
|
+
通过 `skill` 工具重新调用两个 blame 技能获取重评报告:
|
|
115
|
+
|
|
116
|
+
1. 通过 `skill` 工具调用 `blame-skill`(传入 `skill_name`)→ 获取重评报告 → 记录 `score_general_new`
|
|
117
|
+
2. 通过 `skill` 工具调用 `blame-sprint-skill`(传入 `skill_name`)→ 获取重评报告 → 记录 `score_sprint_new`
|
|
118
|
+
3. 与上轮得分对比,记录变化
|
|
119
|
+
|
|
120
|
+
**退出条件判断**:
|
|
121
|
+
|
|
122
|
+
| 条件 | 动作 |
|
|
123
|
+
|---|---|
|
|
124
|
+
| 两项均 ≥ target_score | 标记 Item 3-4 completed,进入 Item 5 |
|
|
125
|
+
| 未达标且 round < max_rounds | 更新 Item 3 文本为 `改进执行(Round {N+1}/{max_rounds})`并重置 in_progress;更新 Item 4 文本为 `重评验证(Round {N+1}/{max_rounds})`并重置 pending。回到 Item 2 重新分析 gap(基于本轮重评结果) |
|
|
126
|
+
| 未达标且 round = max_rounds | 标记 Item 3-4 completed,进入 Item 5 |
|
|
127
|
+
|
|
128
|
+
**分数下降保护**:如果某项改进导致分数下降,回滚该改进(git checkout 或手动恢复),跳过该项,继续下一优先级。
|
|
129
|
+
|
|
130
|
+
### Item 5:输出报告
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
## Skill 优化报告:[skill-name]
|
|
134
|
+
|
|
135
|
+
### 最终得分
|
|
136
|
+
|
|
137
|
+
| 评估器 | 基线 | 最终 | 变化 | 等级 |
|
|
138
|
+
|---|---|---|---|---|
|
|
139
|
+
| blame-skill(通用质量) | XX | XX | +X | X |
|
|
140
|
+
| blame-sprint-skill(Sprint 范式) | XX | XX | +X | X |
|
|
141
|
+
|
|
142
|
+
### 迭代历程
|
|
143
|
+
|
|
144
|
+
| 轮次 | blame-skill | blame-sprint-skill | 主要改进项 |
|
|
145
|
+
|---|---|---|---|
|
|
146
|
+
| 基线 | XX | XX | — |
|
|
147
|
+
| Round 1 | XX | XX | [改进项1], [改进项2] |
|
|
148
|
+
| Round 2 | XX | XX | [改进项3], [改进项4] |
|
|
149
|
+
| ... | ... | ... | ... |
|
|
150
|
+
|
|
151
|
+
### 分项得分明细
|
|
152
|
+
|
|
153
|
+
#### blame-skill(XX / 100)
|
|
154
|
+
|
|
155
|
+
| 类别 | 基线 | 最终 |
|
|
156
|
+
|---|---|---|
|
|
157
|
+
| Description 与可发现性 | XX | XX |
|
|
158
|
+
| 正文结构 | XX | XX |
|
|
159
|
+
| ... | ... | ... |
|
|
160
|
+
|
|
161
|
+
#### blame-sprint-skill(XX / 100)
|
|
162
|
+
|
|
163
|
+
| 维度 | 基线 | 最终 |
|
|
164
|
+
|---|---|---|
|
|
165
|
+
| 执行范式声明 | XX | XX |
|
|
166
|
+
| 固定 Sprint Backlog | XX | XX |
|
|
167
|
+
| Sprint Execution | XX | XX |
|
|
168
|
+
| Sprint Review | XX | XX |
|
|
169
|
+
|
|
170
|
+
### 未解决项(如有)
|
|
171
|
+
|
|
172
|
+
- [ ] **[项目名]**(来源:[blame-skill/blame-sprint-skill],扣 X 分)
|
|
173
|
+
- 现状:[当前情况]
|
|
174
|
+
- 原因:[为什么未解决]
|
|
175
|
+
- 建议:[后续手动改进方向]
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Sprint Review
|
|
179
|
+
|
|
180
|
+
本 skill 每次调用 = 无状态独立 Sprint,无跨轮次状态,故不进行 Retrospective。所有 Backlog Items 完成后:
|
|
181
|
+
|
|
182
|
+
- **对照 Sprint Goal 验证**:两项评分是否完整?改进 loop 是否正确执行?达标判断是否准确?输出格式是否正确?
|
|
183
|
+
- **展示 Increment**:输出优化报告。
|
|
184
|
+
|
|
185
|
+
## 约束
|
|
186
|
+
|
|
187
|
+
- 只处理已声明字段(`skill_name`/`target_score`/`max_rounds`),忽略所有其他传入参数。
|
|
188
|
+
- **禁止使用 WebFetch 或任何网络请求**。
|
|
189
|
+
- 读文件用 `read` 工具;修改文件用 `edit` 工具;列目录用 `bash ls`。
|
|
190
|
+
- 只优化结构和质量,不改变 skill 的核心功能语义。
|
|
191
|
+
- 不修改 blame-skill 或 blame-sprint-skill 的评分规则。
|
|
192
|
+
- 分数下降时回滚该改进,不强行推进。
|