@wwkit/harness 1.0.31 → 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 +8 -7
- package/plugin.js +19 -19
- package/readme/development.md +39 -39
- package/readme/publish.md +41 -41
- package/readme/testing.md +44 -36
- 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,65 +1,65 @@
|
|
|
1
|
-
import { existsSync, readdirSync, statSync } from 'fs';
|
|
2
|
-
import { join, extname } from 'path';
|
|
3
|
-
|
|
4
|
-
const JSTS_EXTENSIONS = new Set(['.js', '.jsx', '.ts', '.tsx', '.vue', '.mjs', '.cjs']);
|
|
5
|
-
const PY_EXTENSIONS = new Set(['.py']);
|
|
6
|
-
const MAX_SCAN_DEPTH = 10;
|
|
7
|
-
const EXCLUDE_DIRS = new Set([
|
|
8
|
-
'node_modules', 'dist', 'build', '.git', '__pycache__',
|
|
9
|
-
'.venv', 'venv', '.webwork', 'reports', 'coverage',
|
|
10
|
-
'.next', '.nuxt', '.output', 'eggs', '.eggs',
|
|
11
|
-
]);
|
|
12
|
-
|
|
13
|
-
export function detectLanguage(rootDir) {
|
|
14
|
-
if (existsSync(join(rootDir, 'package.json'))) {
|
|
15
|
-
return 'jsts';
|
|
16
|
-
}
|
|
17
|
-
if (existsSync(join(rootDir, 'pyproject.toml')) || existsSync(join(rootDir, 'setup.py'))) {
|
|
18
|
-
return 'python';
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const counts = { jsts: 0, python: 0 };
|
|
22
|
-
_countFiles(rootDir, counts, 0);
|
|
23
|
-
|
|
24
|
-
if (counts.jsts === 0 && counts.python === 0) {
|
|
25
|
-
throw new Error(
|
|
26
|
-
'No lintable source files found: no package.json, pyproject.toml, or .js/.ts/.py files detected'
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return counts.jsts >= counts.python ? 'jsts' : 'python';
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function _countFiles(dir, counts, depth) {
|
|
34
|
-
if (depth > MAX_SCAN_DEPTH) return;
|
|
35
|
-
|
|
36
|
-
let entries;
|
|
37
|
-
try {
|
|
38
|
-
entries = readdirSync(dir);
|
|
39
|
-
} catch {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
for (const entry of entries) {
|
|
44
|
-
const fullPath = join(dir, entry);
|
|
45
|
-
let stat;
|
|
46
|
-
try {
|
|
47
|
-
stat = statSync(fullPath);
|
|
48
|
-
} catch {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (stat.isDirectory()) {
|
|
53
|
-
if (!EXCLUDE_DIRS.has(entry)) {
|
|
54
|
-
_countFiles(fullPath, counts, depth + 1);
|
|
55
|
-
}
|
|
56
|
-
} else {
|
|
57
|
-
const ext = extname(entry).toLowerCase();
|
|
58
|
-
if (JSTS_EXTENSIONS.has(ext)) {
|
|
59
|
-
counts.jsts++;
|
|
60
|
-
} else if (PY_EXTENSIONS.has(ext)) {
|
|
61
|
-
counts.python++;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
1
|
+
import { existsSync, readdirSync, statSync } from 'fs';
|
|
2
|
+
import { join, extname } from 'path';
|
|
3
|
+
|
|
4
|
+
const JSTS_EXTENSIONS = new Set(['.js', '.jsx', '.ts', '.tsx', '.vue', '.mjs', '.cjs']);
|
|
5
|
+
const PY_EXTENSIONS = new Set(['.py']);
|
|
6
|
+
const MAX_SCAN_DEPTH = 10;
|
|
7
|
+
const EXCLUDE_DIRS = new Set([
|
|
8
|
+
'node_modules', 'dist', 'build', '.git', '__pycache__',
|
|
9
|
+
'.venv', 'venv', '.webwork', 'reports', 'coverage',
|
|
10
|
+
'.next', '.nuxt', '.output', 'eggs', '.eggs',
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
export function detectLanguage(rootDir) {
|
|
14
|
+
if (existsSync(join(rootDir, 'package.json'))) {
|
|
15
|
+
return 'jsts';
|
|
16
|
+
}
|
|
17
|
+
if (existsSync(join(rootDir, 'pyproject.toml')) || existsSync(join(rootDir, 'setup.py'))) {
|
|
18
|
+
return 'python';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const counts = { jsts: 0, python: 0 };
|
|
22
|
+
_countFiles(rootDir, counts, 0);
|
|
23
|
+
|
|
24
|
+
if (counts.jsts === 0 && counts.python === 0) {
|
|
25
|
+
throw new Error(
|
|
26
|
+
'No lintable source files found: no package.json, pyproject.toml, or .js/.ts/.py files detected'
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return counts.jsts >= counts.python ? 'jsts' : 'python';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function _countFiles(dir, counts, depth) {
|
|
34
|
+
if (depth > MAX_SCAN_DEPTH) return;
|
|
35
|
+
|
|
36
|
+
let entries;
|
|
37
|
+
try {
|
|
38
|
+
entries = readdirSync(dir);
|
|
39
|
+
} catch {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
for (const entry of entries) {
|
|
44
|
+
const fullPath = join(dir, entry);
|
|
45
|
+
let stat;
|
|
46
|
+
try {
|
|
47
|
+
stat = statSync(fullPath);
|
|
48
|
+
} catch {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (stat.isDirectory()) {
|
|
53
|
+
if (!EXCLUDE_DIRS.has(entry)) {
|
|
54
|
+
_countFiles(fullPath, counts, depth + 1);
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
const ext = extname(entry).toLowerCase();
|
|
58
|
+
if (JSTS_EXTENSIONS.has(ext)) {
|
|
59
|
+
counts.jsts++;
|
|
60
|
+
} else if (PY_EXTENSIONS.has(ext)) {
|
|
61
|
+
counts.python++;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
> **原 skill**: `lint-env-ensure`(已合并入 lint)
|
|
2
|
-
> **适用**: lint agent 的环境检查阶段,在配置生成和规则分析前确保工具可用。
|
|
3
|
-
> **不适用**: 非 lint 场景的环境检查、系统级工具安装。
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Lint 环境检查
|
|
8
|
-
|
|
9
|
-
## 工作流模式
|
|
10
|
-
|
|
11
|
-
顺序执行,4 个阶段。
|
|
12
|
-
|
|
13
|
-
## 输入
|
|
14
|
-
|
|
15
|
-
| 参数 | 必填 | 类型 | 说明 |
|
|
16
|
-
|------|------|------|------|
|
|
17
|
-
| root_dir | 是 | string | 工程根目录路径 |
|
|
18
|
-
| primary_language | 是 | string | 主语言(`jsts` 或 `python`) |
|
|
19
|
-
|
|
20
|
-
## 输出
|
|
21
|
-
|
|
22
|
-
- `linter_name`:linter 名称(`eslint` 或 `ruff`)
|
|
23
|
-
- `linter_version`:linter 版本号
|
|
24
|
-
- `linter_installed`:是否已安装且可用(bool)
|
|
25
|
-
- `config`:从 config.md 加载的配置对象
|
|
26
|
-
|
|
27
|
-
## 阶段一:检查工具可用性
|
|
28
|
-
|
|
29
|
-
按 `primary_language` 检查对应 linter:
|
|
30
|
-
|
|
31
|
-
| 主语言 | linter | 检查命令 |
|
|
32
|
-
|--------|--------|---------|
|
|
33
|
-
| jsts | eslint | `npx eslint --version` |
|
|
34
|
-
| python | ruff | `ruff --version` |
|
|
35
|
-
|
|
36
|
-
## 阶段二:自动安装(工具缺失时)
|
|
37
|
-
|
|
38
|
-
工具不可用时,在项目内安装:
|
|
39
|
-
|
|
40
|
-
| 主语言 | 安装命令 | 备注 |
|
|
41
|
-
|--------|---------|------|
|
|
42
|
-
| jsts | `cd {root_dir} && npm install -D eslint` | TS 项目额外安装 `@typescript-eslint/parser @typescript-eslint/eslint-plugin` |
|
|
43
|
-
| python | `cd {root_dir} && pip install ruff` 或 `cd {root_dir} && uv add --dev ruff` | 优先用 uv,回退到 pip |
|
|
44
|
-
|
|
45
|
-
安装失败时重试,最多 3 次(`install_retry` 来自 config)。
|
|
46
|
-
|
|
47
|
-
## 阶段三:安装验证
|
|
48
|
-
|
|
49
|
-
重新执行阶段一的检查命令,确认安装成功。
|
|
50
|
-
|
|
51
|
-
| 条件 | 动作 |
|
|
52
|
-
|------|------|
|
|
53
|
-
| 工具可用 | 输出 linter_name/version/installed=true,继续 |
|
|
54
|
-
| 工具仍不可用 | 输出 installed=false,agent 退出 |
|
|
55
|
-
|
|
56
|
-
## 阶段四:加载配置
|
|
57
|
-
|
|
58
|
-
读取 `config.md`,输出配置对象供后续 skill 使用。
|
|
59
|
-
|
|
60
|
-
## 决策
|
|
61
|
-
|
|
62
|
-
| 条件 | 动作 |
|
|
63
|
-
|------|------|
|
|
64
|
-
| 工具已安装 | 输出结果,流程结束 |
|
|
65
|
-
| 工具缺失,安装成功 | 输出结果,流程结束 |
|
|
66
|
-
| 工具缺失,安装失败 | 输出 installed=false,agent 退出 |
|
|
67
|
-
|
|
68
|
-
## 失败处理
|
|
69
|
-
|
|
70
|
-
| 场景 | 处理方式 |
|
|
71
|
-
|------|---------|
|
|
72
|
-
| 检查命令执行失败 | 认为工具未安装,进入安装流程 |
|
|
73
|
-
| npm install 失败 | 重试最多 3 次 |
|
|
74
|
-
| pip install 失败 | 尝试 uv add,再失败则重试 |
|
|
75
|
-
| 重试 3 次仍失败 | 输出 installed=false |
|
|
76
|
-
|
|
77
|
-
## 一定要做
|
|
78
|
-
|
|
79
|
-
1. 在项目内安装(`npm install -D`),不安装全局
|
|
80
|
-
2. 安装后必须重新验证工具可用性
|
|
81
|
-
3. 加载 config.md 配置供后续 skill 共享
|
|
82
|
-
4. TS 项目检查是否需要 @typescript-eslint 插件
|
|
83
|
-
|
|
84
|
-
## 一定不要做
|
|
85
|
-
|
|
86
|
-
1. 不要全局安装工具(`npm install -g`)
|
|
87
|
-
2. 不要跳过安装验证步骤
|
|
88
|
-
3. 不要修改项目配置文件(package.json 等)
|
|
1
|
+
> **原 skill**: `lint-env-ensure`(已合并入 lint)
|
|
2
|
+
> **适用**: lint agent 的环境检查阶段,在配置生成和规则分析前确保工具可用。
|
|
3
|
+
> **不适用**: 非 lint 场景的环境检查、系统级工具安装。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Lint 环境检查
|
|
8
|
+
|
|
9
|
+
## 工作流模式
|
|
10
|
+
|
|
11
|
+
顺序执行,4 个阶段。
|
|
12
|
+
|
|
13
|
+
## 输入
|
|
14
|
+
|
|
15
|
+
| 参数 | 必填 | 类型 | 说明 |
|
|
16
|
+
|------|------|------|------|
|
|
17
|
+
| root_dir | 是 | string | 工程根目录路径 |
|
|
18
|
+
| primary_language | 是 | string | 主语言(`jsts` 或 `python`) |
|
|
19
|
+
|
|
20
|
+
## 输出
|
|
21
|
+
|
|
22
|
+
- `linter_name`:linter 名称(`eslint` 或 `ruff`)
|
|
23
|
+
- `linter_version`:linter 版本号
|
|
24
|
+
- `linter_installed`:是否已安装且可用(bool)
|
|
25
|
+
- `config`:从 config.md 加载的配置对象
|
|
26
|
+
|
|
27
|
+
## 阶段一:检查工具可用性
|
|
28
|
+
|
|
29
|
+
按 `primary_language` 检查对应 linter:
|
|
30
|
+
|
|
31
|
+
| 主语言 | linter | 检查命令 |
|
|
32
|
+
|--------|--------|---------|
|
|
33
|
+
| jsts | eslint | `npx eslint --version` |
|
|
34
|
+
| python | ruff | `ruff --version` |
|
|
35
|
+
|
|
36
|
+
## 阶段二:自动安装(工具缺失时)
|
|
37
|
+
|
|
38
|
+
工具不可用时,在项目内安装:
|
|
39
|
+
|
|
40
|
+
| 主语言 | 安装命令 | 备注 |
|
|
41
|
+
|--------|---------|------|
|
|
42
|
+
| jsts | `cd {root_dir} && npm install -D eslint` | TS 项目额外安装 `@typescript-eslint/parser @typescript-eslint/eslint-plugin` |
|
|
43
|
+
| python | `cd {root_dir} && pip install ruff` 或 `cd {root_dir} && uv add --dev ruff` | 优先用 uv,回退到 pip |
|
|
44
|
+
|
|
45
|
+
安装失败时重试,最多 3 次(`install_retry` 来自 config)。
|
|
46
|
+
|
|
47
|
+
## 阶段三:安装验证
|
|
48
|
+
|
|
49
|
+
重新执行阶段一的检查命令,确认安装成功。
|
|
50
|
+
|
|
51
|
+
| 条件 | 动作 |
|
|
52
|
+
|------|------|
|
|
53
|
+
| 工具可用 | 输出 linter_name/version/installed=true,继续 |
|
|
54
|
+
| 工具仍不可用 | 输出 installed=false,agent 退出 |
|
|
55
|
+
|
|
56
|
+
## 阶段四:加载配置
|
|
57
|
+
|
|
58
|
+
读取 `config.md`,输出配置对象供后续 skill 使用。
|
|
59
|
+
|
|
60
|
+
## 决策
|
|
61
|
+
|
|
62
|
+
| 条件 | 动作 |
|
|
63
|
+
|------|------|
|
|
64
|
+
| 工具已安装 | 输出结果,流程结束 |
|
|
65
|
+
| 工具缺失,安装成功 | 输出结果,流程结束 |
|
|
66
|
+
| 工具缺失,安装失败 | 输出 installed=false,agent 退出 |
|
|
67
|
+
|
|
68
|
+
## 失败处理
|
|
69
|
+
|
|
70
|
+
| 场景 | 处理方式 |
|
|
71
|
+
|------|---------|
|
|
72
|
+
| 检查命令执行失败 | 认为工具未安装,进入安装流程 |
|
|
73
|
+
| npm install 失败 | 重试最多 3 次 |
|
|
74
|
+
| pip install 失败 | 尝试 uv add,再失败则重试 |
|
|
75
|
+
| 重试 3 次仍失败 | 输出 installed=false |
|
|
76
|
+
|
|
77
|
+
## 一定要做
|
|
78
|
+
|
|
79
|
+
1. 在项目内安装(`npm install -D`),不安装全局
|
|
80
|
+
2. 安装后必须重新验证工具可用性
|
|
81
|
+
3. 加载 config.md 配置供后续 skill 共享
|
|
82
|
+
4. TS 项目检查是否需要 @typescript-eslint 插件
|
|
83
|
+
|
|
84
|
+
## 一定不要做
|
|
85
|
+
|
|
86
|
+
1. 不要全局安装工具(`npm install -g`)
|
|
87
|
+
2. 不要跳过安装验证步骤
|
|
88
|
+
3. 不要修改项目配置文件(package.json 等)
|
|
89
89
|
4. 不要使用 webfetch 下载工具,仅通过包管理器(npm/pip/uv)安装
|
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
> **原 skill**: `lint-language-detect`(已合并入 lint)
|
|
2
|
-
> **适用**: lint agent 的语言探测阶段,在环境检查和配置生成前确定主语言。
|
|
3
|
-
> **不适用**: 非 lint 场景的语言检测、混合语言项目(v1 按主语言处理,不支持混合)。
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# 主语言探测
|
|
8
|
-
|
|
9
|
-
## 工作流模式
|
|
10
|
-
|
|
11
|
-
顺序执行,2 个阶段。
|
|
12
|
-
|
|
13
|
-
## 输入
|
|
14
|
-
|
|
15
|
-
| 参数 | 必填 | 类型 | 说明 |
|
|
16
|
-
|------|------|------|------|
|
|
17
|
-
| root_dir | 是 | string | 工程根目录路径 |
|
|
18
|
-
|
|
19
|
-
## 输出
|
|
20
|
-
|
|
21
|
-
- `primary_language`:主语言标识(`jsts` 或 `python`)
|
|
22
|
-
- `detection_method`:检测方式(`manifest` 或 `file_count`)
|
|
23
|
-
- `file_counts`:各语言源码文件计数(仅 `file_count` 方式时有值)
|
|
24
|
-
|
|
25
|
-
## 阶段一:Manifest 检测
|
|
26
|
-
|
|
27
|
-
检查 `root_dir` 下的 manifest 文件:
|
|
28
|
-
|
|
29
|
-
| 检查项 | 命中结果 |
|
|
30
|
-
|--------|---------|
|
|
31
|
-
| `package.json` 存在 | `primary_language = jsts`,`detection_method = manifest` |
|
|
32
|
-
| `pyproject.toml` 存在 | `primary_language = python`,`detection_method = manifest` |
|
|
33
|
-
| `setup.py` 存在 | `primary_language = python`,`detection_method = manifest` |
|
|
34
|
-
|
|
35
|
-
若 manifest 命中,直接输出结果,跳过阶段二。
|
|
36
|
-
|
|
37
|
-
## 阶段二:文件计数检测
|
|
38
|
-
|
|
39
|
-
无 manifest 时,调用 `detect-language.js` 的 `detectLanguage(rootDir)` 函数扫描源码文件:
|
|
40
|
-
|
|
41
|
-
1. 递归扫描 `root_dir`(最大深度 10 层)
|
|
42
|
-
2. 排除目录:`node_modules/`、`dist/`、`build/`、`.git/`、`__pycache__/`、`.venv/`、`venv/`、`.webwork/`、`reports/`、`coverage/`
|
|
43
|
-
3. 按扩展名分类计数:
|
|
44
|
-
- jsts:`.js`、`.jsx`、`.ts`、`.tsx`、`.vue`、`.mjs`、`.cjs`
|
|
45
|
-
- python:`.py`
|
|
46
|
-
4. 文件数多者为主语言;两者都为 0 → 报错
|
|
47
|
-
|
|
48
|
-
## 决策
|
|
49
|
-
|
|
50
|
-
| 条件 | 动作 |
|
|
51
|
-
|------|------|
|
|
52
|
-
| manifest 命中 | 输出主语言,流程结束 |
|
|
53
|
-
| 无 manifest,源码文件 > 0 | 输出计数多者为主语言 |
|
|
54
|
-
| 无 manifest,源码文件 = 0 | 报错退出 |
|
|
55
|
-
|
|
56
|
-
## 失败处理
|
|
57
|
-
|
|
58
|
-
| 场景 | 处理方式 |
|
|
59
|
-
|------|---------|
|
|
60
|
-
| root_dir 不存在 | 报错"工程根目录不存在" |
|
|
61
|
-
| 无 manifest 且无源码文件 | 报错"无法检测项目主语言" |
|
|
62
|
-
| 扫描权限不足 | 跳过不可读目录,继续扫描 |
|
|
63
|
-
|
|
64
|
-
## 一定要做
|
|
65
|
-
|
|
66
|
-
1. 优先检查 manifest 文件,避免全量扫描
|
|
67
|
-
2. JS/TS 统一视为 `jsts` 一种语言
|
|
68
|
-
3. 排除常见的非源码目录
|
|
69
|
-
4. 无 manifest 时必须扫描文件计数
|
|
70
|
-
|
|
71
|
-
## 一定不要做
|
|
72
|
-
|
|
73
|
-
1. 不要返回多个语言(v1 只返回主语言)
|
|
74
|
-
2. 不要扫描 `node_modules/` 等依赖目录
|
|
75
|
-
3. 不要修改任何文件
|
|
1
|
+
> **原 skill**: `lint-language-detect`(已合并入 lint)
|
|
2
|
+
> **适用**: lint agent 的语言探测阶段,在环境检查和配置生成前确定主语言。
|
|
3
|
+
> **不适用**: 非 lint 场景的语言检测、混合语言项目(v1 按主语言处理,不支持混合)。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 主语言探测
|
|
8
|
+
|
|
9
|
+
## 工作流模式
|
|
10
|
+
|
|
11
|
+
顺序执行,2 个阶段。
|
|
12
|
+
|
|
13
|
+
## 输入
|
|
14
|
+
|
|
15
|
+
| 参数 | 必填 | 类型 | 说明 |
|
|
16
|
+
|------|------|------|------|
|
|
17
|
+
| root_dir | 是 | string | 工程根目录路径 |
|
|
18
|
+
|
|
19
|
+
## 输出
|
|
20
|
+
|
|
21
|
+
- `primary_language`:主语言标识(`jsts` 或 `python`)
|
|
22
|
+
- `detection_method`:检测方式(`manifest` 或 `file_count`)
|
|
23
|
+
- `file_counts`:各语言源码文件计数(仅 `file_count` 方式时有值)
|
|
24
|
+
|
|
25
|
+
## 阶段一:Manifest 检测
|
|
26
|
+
|
|
27
|
+
检查 `root_dir` 下的 manifest 文件:
|
|
28
|
+
|
|
29
|
+
| 检查项 | 命中结果 |
|
|
30
|
+
|--------|---------|
|
|
31
|
+
| `package.json` 存在 | `primary_language = jsts`,`detection_method = manifest` |
|
|
32
|
+
| `pyproject.toml` 存在 | `primary_language = python`,`detection_method = manifest` |
|
|
33
|
+
| `setup.py` 存在 | `primary_language = python`,`detection_method = manifest` |
|
|
34
|
+
|
|
35
|
+
若 manifest 命中,直接输出结果,跳过阶段二。
|
|
36
|
+
|
|
37
|
+
## 阶段二:文件计数检测
|
|
38
|
+
|
|
39
|
+
无 manifest 时,调用 `detect-language.js` 的 `detectLanguage(rootDir)` 函数扫描源码文件:
|
|
40
|
+
|
|
41
|
+
1. 递归扫描 `root_dir`(最大深度 10 层)
|
|
42
|
+
2. 排除目录:`node_modules/`、`dist/`、`build/`、`.git/`、`__pycache__/`、`.venv/`、`venv/`、`.webwork/`、`reports/`、`coverage/`
|
|
43
|
+
3. 按扩展名分类计数:
|
|
44
|
+
- jsts:`.js`、`.jsx`、`.ts`、`.tsx`、`.vue`、`.mjs`、`.cjs`
|
|
45
|
+
- python:`.py`
|
|
46
|
+
4. 文件数多者为主语言;两者都为 0 → 报错
|
|
47
|
+
|
|
48
|
+
## 决策
|
|
49
|
+
|
|
50
|
+
| 条件 | 动作 |
|
|
51
|
+
|------|------|
|
|
52
|
+
| manifest 命中 | 输出主语言,流程结束 |
|
|
53
|
+
| 无 manifest,源码文件 > 0 | 输出计数多者为主语言 |
|
|
54
|
+
| 无 manifest,源码文件 = 0 | 报错退出 |
|
|
55
|
+
|
|
56
|
+
## 失败处理
|
|
57
|
+
|
|
58
|
+
| 场景 | 处理方式 |
|
|
59
|
+
|------|---------|
|
|
60
|
+
| root_dir 不存在 | 报错"工程根目录不存在" |
|
|
61
|
+
| 无 manifest 且无源码文件 | 报错"无法检测项目主语言" |
|
|
62
|
+
| 扫描权限不足 | 跳过不可读目录,继续扫描 |
|
|
63
|
+
|
|
64
|
+
## 一定要做
|
|
65
|
+
|
|
66
|
+
1. 优先检查 manifest 文件,避免全量扫描
|
|
67
|
+
2. JS/TS 统一视为 `jsts` 一种语言
|
|
68
|
+
3. 排除常见的非源码目录
|
|
69
|
+
4. 无 manifest 时必须扫描文件计数
|
|
70
|
+
|
|
71
|
+
## 一定不要做
|
|
72
|
+
|
|
73
|
+
1. 不要返回多个语言(v1 只返回主语言)
|
|
74
|
+
2. 不要扫描 `node_modules/` 等依赖目录
|
|
75
|
+
3. 不要修改任何文件
|
|
76
76
|
4. 不要执行网络请求
|