@wwkit/harness 1.0.32 → 1.0.33
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 +186 -180
- package/agents/sprint.md +121 -118
- package/bin/index.js +226 -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/package.json +3 -3
- 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 +124 -124
- package/skills/blame-skill/SKILL.md +201 -201
- 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 +227 -227
- package/skills/new-skill/references/template.md +53 -53
- package/skills/new-skill/references/workflow-patterns.md +104 -104
- 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/src/config.js +29 -29
- package/src/config.json5 +19 -19
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
{
|
|
2
|
-
// 省略 $schema 字段,避免 bash -c "" 中 $ 展开问题
|
|
3
|
-
"title": "图集格式",
|
|
4
|
-
"description": "社交媒体图集(gallery)输出校验 schema(数组,至少 1 个 item)",
|
|
5
|
-
"type": "array",
|
|
6
|
-
"minItems": 1,
|
|
7
|
-
"items": {
|
|
8
|
-
"type": "object",
|
|
9
|
-
"properties": {
|
|
10
|
-
"title": {
|
|
11
|
-
"type": "string",
|
|
12
|
-
"description": "图集标题,10-30 字(cn_length)"
|
|
13
|
-
},
|
|
14
|
-
"images": {
|
|
15
|
-
"type": "array",
|
|
16
|
-
"description": "图片列表,1-50 张",
|
|
17
|
-
"minItems": 1,
|
|
18
|
-
"maxItems": 50,
|
|
19
|
-
"items": {
|
|
20
|
-
"type": "object",
|
|
21
|
-
"properties": {
|
|
22
|
-
"url": {
|
|
23
|
-
"type": "string",
|
|
24
|
-
"format": "uri",
|
|
25
|
-
"description": "图片地址"
|
|
26
|
-
},
|
|
27
|
-
"title": {
|
|
28
|
-
"type": "string",
|
|
29
|
-
"description": "图片标题/简短说明,10-30 字(cn_length)"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"required": ["url", "title"],
|
|
33
|
-
"additionalProperties": false
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"required": ["title", "images"],
|
|
38
|
-
"additionalProperties": false
|
|
39
|
-
}
|
|
40
|
-
}
|
|
1
|
+
{
|
|
2
|
+
// 省略 $schema 字段,避免 bash -c "" 中 $ 展开问题
|
|
3
|
+
"title": "图集格式",
|
|
4
|
+
"description": "社交媒体图集(gallery)输出校验 schema(数组,至少 1 个 item)",
|
|
5
|
+
"type": "array",
|
|
6
|
+
"minItems": 1,
|
|
7
|
+
"items": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"title": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "图集标题,10-30 字(cn_length)"
|
|
13
|
+
},
|
|
14
|
+
"images": {
|
|
15
|
+
"type": "array",
|
|
16
|
+
"description": "图片列表,1-50 张",
|
|
17
|
+
"minItems": 1,
|
|
18
|
+
"maxItems": 50,
|
|
19
|
+
"items": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"properties": {
|
|
22
|
+
"url": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"format": "uri",
|
|
25
|
+
"description": "图片地址"
|
|
26
|
+
},
|
|
27
|
+
"title": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "图片标题/简短说明,10-30 字(cn_length)"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"required": ["url", "title"],
|
|
33
|
+
"additionalProperties": false
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"required": ["title", "images"],
|
|
38
|
+
"additionalProperties": false
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
# 社交媒体风格问题(question)创作 Sprint
|
|
2
|
-
|
|
3
|
-
## Sprint Goal
|
|
4
|
-
|
|
5
|
-
产出 `{{count}}` 条适合社交媒体传播的问题内容,整体为 JSON 数组。
|
|
6
|
-
|
|
7
|
-
## Style(默认创作风格,可由 `style` 参数覆盖)
|
|
8
|
-
|
|
9
|
-
基于原始素材创作:
|
|
10
|
-
|
|
11
|
-
1. **标题尖锐**:有争议性、冲突点,能激发讨论欲和互动
|
|
12
|
-
2. **描述简洁**:说明背景,引出矛盾点,不要太长
|
|
13
|
-
|
|
14
|
-
## Format(输出契约,不可被 `style` 覆盖)
|
|
15
|
-
|
|
16
|
-
- **结构**:每 item = `title`(10-30 cn_length)+ `content`(20-500 cn_length)+ `images`(string[],≤5 张)
|
|
17
|
-
- **图片**:从素材提取图片地址,最多 5 张;素材无图片时为空数组
|
|
18
|
-
- **真实性**:从素材中提取核心矛盾点,不能凭空编造
|
|
19
|
-
- **输出形式**:整体为 JSON 数组,含 `{{count}}` 个 item;仅输出数组,不包含任何解释、思考过程或额外文本,禁止输出单个对象
|
|
20
|
-
|
|
21
|
-
> 字数计算采用 **cn_length** 规则:中文字符算 1,非中文字符(英文/数字/符号)算 0.5,结果向上取整。
|
|
22
|
-
|
|
23
|
-
示例:
|
|
24
|
-
|
|
25
|
-
```json
|
|
26
|
-
[
|
|
27
|
-
{
|
|
28
|
-
"title": "为什么同样的努力,有人成功有人失败?",
|
|
29
|
-
"content": "在职场中发现,同样勤奋的两个人,结局却天差地别。差距到底在哪里?",
|
|
30
|
-
"images": ["https://example.com/pic1.jpg"]
|
|
31
|
-
}
|
|
32
|
-
]
|
|
1
|
+
# 社交媒体风格问题(question)创作 Sprint
|
|
2
|
+
|
|
3
|
+
## Sprint Goal
|
|
4
|
+
|
|
5
|
+
产出 `{{count}}` 条适合社交媒体传播的问题内容,整体为 JSON 数组。
|
|
6
|
+
|
|
7
|
+
## Style(默认创作风格,可由 `style` 参数覆盖)
|
|
8
|
+
|
|
9
|
+
基于原始素材创作:
|
|
10
|
+
|
|
11
|
+
1. **标题尖锐**:有争议性、冲突点,能激发讨论欲和互动
|
|
12
|
+
2. **描述简洁**:说明背景,引出矛盾点,不要太长
|
|
13
|
+
|
|
14
|
+
## Format(输出契约,不可被 `style` 覆盖)
|
|
15
|
+
|
|
16
|
+
- **结构**:每 item = `title`(10-30 cn_length)+ `content`(20-500 cn_length)+ `images`(string[],≤5 张)
|
|
17
|
+
- **图片**:从素材提取图片地址,最多 5 张;素材无图片时为空数组
|
|
18
|
+
- **真实性**:从素材中提取核心矛盾点,不能凭空编造
|
|
19
|
+
- **输出形式**:整体为 JSON 数组,含 `{{count}}` 个 item;仅输出数组,不包含任何解释、思考过程或额外文本,禁止输出单个对象
|
|
20
|
+
|
|
21
|
+
> 字数计算采用 **cn_length** 规则:中文字符算 1,非中文字符(英文/数字/符号)算 0.5,结果向上取整。
|
|
22
|
+
|
|
23
|
+
示例:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
[
|
|
27
|
+
{
|
|
28
|
+
"title": "为什么同样的努力,有人成功有人失败?",
|
|
29
|
+
"content": "在职场中发现,同样勤奋的两个人,结局却天差地别。差距到底在哪里?",
|
|
30
|
+
"images": ["https://example.com/pic1.jpg"]
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
33
|
```
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
{
|
|
2
|
-
// 省略 $schema 字段,避免 bash -c "" 中 $ 展开问题
|
|
3
|
-
"title": "社交媒体问题格式",
|
|
4
|
-
"description": "社交媒体风格问题的输出校验 schema(数组,至少 1 个 item)",
|
|
5
|
-
"type": "array",
|
|
6
|
-
"minItems": 1,
|
|
7
|
-
"items": {
|
|
8
|
-
"type": "object",
|
|
9
|
-
"properties": {
|
|
10
|
-
"title": {
|
|
11
|
-
"type": "string",
|
|
12
|
-
"description": "问题标题,10-30 cn_length"
|
|
13
|
-
},
|
|
14
|
-
"content": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"description": "问题描述,20-500 cn_length"
|
|
17
|
-
},
|
|
18
|
-
"images": {
|
|
19
|
-
"type": "array",
|
|
20
|
-
"description": "问题图片地址列表,最多 5 张",
|
|
21
|
-
"items": {
|
|
22
|
-
"type": "string",
|
|
23
|
-
"format": "uri"
|
|
24
|
-
},
|
|
25
|
-
"maxItems": 5
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"required": ["title", "content", "images"],
|
|
29
|
-
"additionalProperties": false
|
|
30
|
-
}
|
|
31
|
-
}
|
|
1
|
+
{
|
|
2
|
+
// 省略 $schema 字段,避免 bash -c "" 中 $ 展开问题
|
|
3
|
+
"title": "社交媒体问题格式",
|
|
4
|
+
"description": "社交媒体风格问题的输出校验 schema(数组,至少 1 个 item)",
|
|
5
|
+
"type": "array",
|
|
6
|
+
"minItems": 1,
|
|
7
|
+
"items": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"title": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "问题标题,10-30 cn_length"
|
|
13
|
+
},
|
|
14
|
+
"content": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "问题描述,20-500 cn_length"
|
|
17
|
+
},
|
|
18
|
+
"images": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"description": "问题图片地址列表,最多 5 张",
|
|
21
|
+
"items": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"format": "uri"
|
|
24
|
+
},
|
|
25
|
+
"maxItems": 5
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"required": ["title", "content", "images"],
|
|
29
|
+
"additionalProperties": false
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
# 社交媒体动态(status)创作 Sprint
|
|
2
|
-
|
|
3
|
-
## Sprint Goal
|
|
4
|
-
|
|
5
|
-
产出 `{{count}}` 条适合社交媒体传播的动态内容,整体为 JSON 数组。
|
|
6
|
-
|
|
7
|
-
## Style(默认创作风格,可由 `style` 参数覆盖)
|
|
8
|
-
|
|
9
|
-
基于原始素材创作:
|
|
10
|
-
|
|
11
|
-
1. **正文精炼**:短平快,提炼核心信息,避免大段照抄原文
|
|
12
|
-
2. **有观点、易互动**:口语化表达,带个人观点或情绪,能引发讨论和转发
|
|
13
|
-
|
|
14
|
-
## Format(输出契约,不可被 `style` 覆盖)
|
|
15
|
-
|
|
16
|
-
- **结构**:每 item = `content`(20-500 cn_length)+ `images`(string[],≤5 张)
|
|
17
|
-
- **图片**:从素材中提取图片地址,最多 5 张;素材无图片时为空数组
|
|
18
|
-
- **真实性**:从素材中提炼要点,不能凭空编造
|
|
19
|
-
- **输出形式**:整体为 JSON 数组,含 `{{count}}` 个 item;仅输出数组,不包含任何解释、思考过程或额外文本,禁止输出单个对象
|
|
20
|
-
|
|
21
|
-
> 字数计算采用 **cn_length** 规则:中文字符算 1,非中文字符(英文/数字/符号)算 0.5,结果向上取整。
|
|
22
|
-
|
|
23
|
-
示例:
|
|
24
|
-
|
|
25
|
-
```json
|
|
26
|
-
[
|
|
27
|
-
{
|
|
28
|
-
"content": "三星二季度营业利润预计同比暴涨18倍,AI存储需求成最大推手,你怎么看?",
|
|
29
|
-
"images": ["https://example.com/pic1.jpg"]
|
|
30
|
-
}
|
|
31
|
-
]
|
|
1
|
+
# 社交媒体动态(status)创作 Sprint
|
|
2
|
+
|
|
3
|
+
## Sprint Goal
|
|
4
|
+
|
|
5
|
+
产出 `{{count}}` 条适合社交媒体传播的动态内容,整体为 JSON 数组。
|
|
6
|
+
|
|
7
|
+
## Style(默认创作风格,可由 `style` 参数覆盖)
|
|
8
|
+
|
|
9
|
+
基于原始素材创作:
|
|
10
|
+
|
|
11
|
+
1. **正文精炼**:短平快,提炼核心信息,避免大段照抄原文
|
|
12
|
+
2. **有观点、易互动**:口语化表达,带个人观点或情绪,能引发讨论和转发
|
|
13
|
+
|
|
14
|
+
## Format(输出契约,不可被 `style` 覆盖)
|
|
15
|
+
|
|
16
|
+
- **结构**:每 item = `content`(20-500 cn_length)+ `images`(string[],≤5 张)
|
|
17
|
+
- **图片**:从素材中提取图片地址,最多 5 张;素材无图片时为空数组
|
|
18
|
+
- **真实性**:从素材中提炼要点,不能凭空编造
|
|
19
|
+
- **输出形式**:整体为 JSON 数组,含 `{{count}}` 个 item;仅输出数组,不包含任何解释、思考过程或额外文本,禁止输出单个对象
|
|
20
|
+
|
|
21
|
+
> 字数计算采用 **cn_length** 规则:中文字符算 1,非中文字符(英文/数字/符号)算 0.5,结果向上取整。
|
|
22
|
+
|
|
23
|
+
示例:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
[
|
|
27
|
+
{
|
|
28
|
+
"content": "三星二季度营业利润预计同比暴涨18倍,AI存储需求成最大推手,你怎么看?",
|
|
29
|
+
"images": ["https://example.com/pic1.jpg"]
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
32
|
```
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
{
|
|
2
|
-
// 省略 $schema 字段,避免 bash -c "" 中 $ 展开问题
|
|
3
|
-
"title": "动态格式",
|
|
4
|
-
"description": "社交媒体动态(status)输出校验 schema(数组,至少 1 个 item)",
|
|
5
|
-
"type": "array",
|
|
6
|
-
"minItems": 1,
|
|
7
|
-
"items": {
|
|
8
|
-
"type": "object",
|
|
9
|
-
"properties": {
|
|
10
|
-
"content": {
|
|
11
|
-
"type": "string",
|
|
12
|
-
"description": "动态正文,20-500 cn_length"
|
|
13
|
-
},
|
|
14
|
-
"images": {
|
|
15
|
-
"type": "array",
|
|
16
|
-
"description": "动态配图地址列表,最多 5 张,素材无图片时可为空",
|
|
17
|
-
"items": {
|
|
18
|
-
"type": "string",
|
|
19
|
-
"format": "uri"
|
|
20
|
-
},
|
|
21
|
-
"maxItems": 5
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"required": ["content", "images"],
|
|
25
|
-
"additionalProperties": false
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
{
|
|
2
|
+
// 省略 $schema 字段,避免 bash -c "" 中 $ 展开问题
|
|
3
|
+
"title": "动态格式",
|
|
4
|
+
"description": "社交媒体动态(status)输出校验 schema(数组,至少 1 个 item)",
|
|
5
|
+
"type": "array",
|
|
6
|
+
"minItems": 1,
|
|
7
|
+
"items": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"content": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "动态正文,20-500 cn_length"
|
|
13
|
+
},
|
|
14
|
+
"images": {
|
|
15
|
+
"type": "array",
|
|
16
|
+
"description": "动态配图地址列表,最多 5 张,素材无图片时可为空",
|
|
17
|
+
"items": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"format": "uri"
|
|
20
|
+
},
|
|
21
|
+
"maxItems": 5
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": ["content", "images"],
|
|
25
|
+
"additionalProperties": false
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { fileURLToPath } from 'url';
|
|
2
|
-
import { readFileSync } from 'fs';
|
|
3
|
-
import Ajv from 'ajv';
|
|
4
|
-
import json5 from 'json5';
|
|
5
|
-
|
|
6
|
-
const ajv = new Ajv({ strict: false, validateFormats: true });
|
|
7
|
-
ajv.addFormat('uri', /^[a-z][a-z0-9+.-]*:(\/\/)?[^\s]*$/i);
|
|
8
|
-
|
|
9
|
-
export function validateSchema(data, schemaPath) {
|
|
10
|
-
const schemaContent = readFileSync(schemaPath, 'utf-8');
|
|
11
|
-
let schema;
|
|
12
|
-
try {
|
|
13
|
-
schema = JSON.parse(schemaContent);
|
|
14
|
-
} catch {
|
|
15
|
-
schema = json5.parse(schemaContent);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const validate = ajv.compile(schema);
|
|
19
|
-
const valid = validate(data);
|
|
20
|
-
|
|
21
|
-
if (valid) return { valid: true, message: 'VALID' };
|
|
22
|
-
return { valid: false, message: 'INVALID: ' + (validate.errors?.[0]?.message || 'unknown error') };
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function main() {
|
|
26
|
-
const chunks = [];
|
|
27
|
-
process.stdin.on('data', chunk => chunks.push(chunk));
|
|
28
|
-
process.stdin.on('end', () => {
|
|
29
|
-
try {
|
|
30
|
-
const input = JSON.parse(Buffer.concat(chunks).toString());
|
|
31
|
-
const result = validateSchema(input.data, input.schema_path);
|
|
32
|
-
console.log(result.message);
|
|
33
|
-
} catch (e) {
|
|
34
|
-
console.log('INVALID: ' + e.message);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export default validateSchema;
|
|
1
|
+
import { fileURLToPath } from 'url';
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
import Ajv from 'ajv';
|
|
4
|
+
import json5 from 'json5';
|
|
5
|
+
|
|
6
|
+
const ajv = new Ajv({ strict: false, validateFormats: true });
|
|
7
|
+
ajv.addFormat('uri', /^[a-z][a-z0-9+.-]*:(\/\/)?[^\s]*$/i);
|
|
8
|
+
|
|
9
|
+
export function validateSchema(data, schemaPath) {
|
|
10
|
+
const schemaContent = readFileSync(schemaPath, 'utf-8');
|
|
11
|
+
let schema;
|
|
12
|
+
try {
|
|
13
|
+
schema = JSON.parse(schemaContent);
|
|
14
|
+
} catch {
|
|
15
|
+
schema = json5.parse(schemaContent);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const validate = ajv.compile(schema);
|
|
19
|
+
const valid = validate(data);
|
|
20
|
+
|
|
21
|
+
if (valid) return { valid: true, message: 'VALID' };
|
|
22
|
+
return { valid: false, message: 'INVALID: ' + (validate.errors?.[0]?.message || 'unknown error') };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function main() {
|
|
26
|
+
const chunks = [];
|
|
27
|
+
process.stdin.on('data', chunk => chunks.push(chunk));
|
|
28
|
+
process.stdin.on('end', () => {
|
|
29
|
+
try {
|
|
30
|
+
const input = JSON.parse(Buffer.concat(chunks).toString());
|
|
31
|
+
const result = validateSchema(input.data, input.schema_path);
|
|
32
|
+
console.log(result.message);
|
|
33
|
+
} catch (e) {
|
|
34
|
+
console.log('INVALID: ' + e.message);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default validateSchema;
|
|
40
40
|
if (process.argv[1] === fileURLToPath(import.meta.url)) main();
|
package/src/config.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
// src/config.js — harness 配置加载(只读参考 + 初始化检测)
|
|
2
|
-
import path from 'node:path'
|
|
3
|
-
import { fileURLToPath } from 'node:url'
|
|
4
|
-
import { createConfigLoader, getXdgConfigDir } from '@wwkit/shared'
|
|
5
|
-
|
|
6
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
7
|
-
|
|
8
|
-
const _loader = createConfigLoader({
|
|
9
|
-
builtinConfigPath: path.join(__dirname, 'config.json5'),
|
|
10
|
-
userConfigDir: getXdgConfigDir('harness'),
|
|
11
|
-
envContentVar: 'HARNESS_CONFIG_CONTENT',
|
|
12
|
-
envDirVar: 'HARNESS_CONFIG_DIR',
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 获取用户配置文件路径
|
|
17
|
-
* @returns {string}
|
|
18
|
-
*/
|
|
19
|
-
export function getConfigPath() {
|
|
20
|
-
return _loader.userConfigPath
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* 合并内置配置到用户配置文件(追加缺失 key,不覆盖已有值)
|
|
25
|
-
* @returns {boolean} 是否写入了文件
|
|
26
|
-
*/
|
|
27
|
-
export function mergeBuiltinConfig() {
|
|
28
|
-
return _loader.mergeBuiltinConfig()
|
|
29
|
-
}
|
|
1
|
+
// src/config.js — harness 配置加载(只读参考 + 初始化检测)
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { fileURLToPath } from 'node:url'
|
|
4
|
+
import { createConfigLoader, getXdgConfigDir } from '@wwkit/shared'
|
|
5
|
+
|
|
6
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
7
|
+
|
|
8
|
+
const _loader = createConfigLoader({
|
|
9
|
+
builtinConfigPath: path.join(__dirname, 'config.json5'),
|
|
10
|
+
userConfigDir: getXdgConfigDir('harness'),
|
|
11
|
+
envContentVar: 'HARNESS_CONFIG_CONTENT',
|
|
12
|
+
envDirVar: 'HARNESS_CONFIG_DIR',
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 获取用户配置文件路径
|
|
17
|
+
* @returns {string}
|
|
18
|
+
*/
|
|
19
|
+
export function getConfigPath() {
|
|
20
|
+
return _loader.userConfigPath
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 合并内置配置到用户配置文件(追加缺失 key,不覆盖已有值)
|
|
25
|
+
* @returns {boolean} 是否写入了文件
|
|
26
|
+
*/
|
|
27
|
+
export function mergeBuiltinConfig() {
|
|
28
|
+
return _loader.mergeBuiltinConfig()
|
|
29
|
+
}
|
package/src/config.json5
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
// config.json5 — harness 内置配置(只读参考)
|
|
2
|
-
//
|
|
3
|
-
// 此文件为只读配置,由 postinstall 或首次运行时复制到
|
|
4
|
-
// ~/.config/harness/config.json5(或 $XDG_CONFIG_HOME/harness/config.json5)。
|
|
5
|
-
// 实际运行配置通过环境变量生效,此文件主要用于:
|
|
6
|
-
// 1. 配置初始化检测(existsSync 判断是否需要复制)
|
|
7
|
-
// 2. 文档参考(记录 harness 依赖的环境变量)
|
|
8
|
-
//
|
|
9
|
-
// 修改此文件不会影响运行时行为,请通过 shell profile 直接管理环境变量。
|
|
10
|
-
|
|
11
|
-
{
|
|
12
|
-
// 环境变量声明(只读 — 由 postinstall 通过 Shell.setEnvVar 自动设置)
|
|
13
|
-
env: {
|
|
14
|
-
// harness 包安装目录(agents/skills/commands 所在路径)
|
|
15
|
-
OPENCODE_CONFIG_DIR: "",
|
|
16
|
-
// 启用 opencode 实验性 LSP 工具
|
|
17
|
-
OPENCODE_EXPERIMENTAL_LSP_TOOL: "true",
|
|
18
|
-
},
|
|
19
|
-
}
|
|
1
|
+
// config.json5 — harness 内置配置(只读参考)
|
|
2
|
+
//
|
|
3
|
+
// 此文件为只读配置,由 postinstall 或首次运行时复制到
|
|
4
|
+
// ~/.config/harness/config.json5(或 $XDG_CONFIG_HOME/harness/config.json5)。
|
|
5
|
+
// 实际运行配置通过环境变量生效,此文件主要用于:
|
|
6
|
+
// 1. 配置初始化检测(existsSync 判断是否需要复制)
|
|
7
|
+
// 2. 文档参考(记录 harness 依赖的环境变量)
|
|
8
|
+
//
|
|
9
|
+
// 修改此文件不会影响运行时行为,请通过 shell profile 直接管理环境变量。
|
|
10
|
+
|
|
11
|
+
{
|
|
12
|
+
// 环境变量声明(只读 — 由 postinstall 通过 Shell.setEnvVar 自动设置)
|
|
13
|
+
env: {
|
|
14
|
+
// harness 包安装目录(agents/skills/commands 所在路径)
|
|
15
|
+
OPENCODE_CONFIG_DIR: "",
|
|
16
|
+
// 启用 opencode 实验性 LSP 工具
|
|
17
|
+
OPENCODE_EXPERIMENTAL_LSP_TOOL: "true",
|
|
18
|
+
},
|
|
19
|
+
}
|