Skip to content

Commit 2337460

Browse files
committed
feat(scaffold): 工具链脚手架(pnpm/prettier + schema 校验 + CI + .vscode)
package.json: pnpm + prettier + @nekosu/prettier-plugin-maafw-sort + prettier-plugin-multiline-arrays(pipeline JSON 排序格式化);scripts format/check:schema/check + ruff/pyright。 tools/sync-schema.mjs(移植,拉 MAA schema)+ tools/validate-schema.mjs(精简结构校验,不依赖 create-maa-project 元数据)。.prettierrc.mjs/.prettierignore/.node-version(24)。 .github/workflows/check.yml(CI: pnpm check + ruff + pyright)。.vscode/{extensions,settings,launch}.json(formatOnSave/jsonc/schema 映射/调试 custom/main.py)。 interface.json: 加 icon=logo.png,去注释(validate-schema 需 strict JSON)。pnpm-lock.yaml 锁定依赖。 故意暂不接 @nekosu/maa-tools/maatools.config.mjs/check-project.mjs(深度耦合 create-maa-project 元数据),留到里程碑6有真 pipeline 时再接。
1 parent d768b26 commit 2337460

15 files changed

Lines changed: 770 additions & 94 deletions

.github/workflows/check.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Check
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main, master]
7+
8+
jobs:
9+
check:
10+
permissions:
11+
contents: read
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-python@v5
16+
with:
17+
python-version: '3.13'
18+
- uses: astral-sh/setup-uv@v3
19+
- uses: pnpm/action-setup@v4
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 24
23+
cache: pnpm
24+
- run: pnpm install --frozen-lockfile
25+
- run: uv sync
26+
- run: pnpm check
27+
- run: pnpm check:py

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Node
2+
node_modules/
3+
14
# Python
25
__pycache__/
36
*.py[cod]

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
24

.prettierignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
node_modules/
2+
dist/
3+
build/
4+
.venv/
5+
.uv-cache/
6+
debug/
7+
logs/
8+
lib/
9+
reference/
10+
MaaCommonAssets/
11+
data/
12+
docs/
13+
pnpm-lock.yaml
14+
uv.lock
15+
16+
# generated OCR models
17+
resource/base/model/ocr/*.onnx
18+
19+
# synced MAA schemas (managed by tools/sync-schema.mjs)
20+
tools/schema/interface.schema.json
21+
tools/schema/interface_config.schema.json
22+
tools/schema/interface_import.schema.json
23+
tools/schema/pipeline.schema.json
24+
tools/schema/schema-manifest.json

.prettierrc.mjs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import * as maafwSort from '@nekosu/prettier-plugin-maafw-sort'
2+
import * as multilineArrays from 'prettier-plugin-multiline-arrays'
3+
4+
export default {
5+
semi: false,
6+
singleQuote: true,
7+
trailingComma: 'none',
8+
tabWidth: 4,
9+
printWidth: 100,
10+
multilineArraysWrapThreshold: 0,
11+
plugins: [
12+
maafwSort.patchPlugin(multilineArrays)
13+
],
14+
overrides: [
15+
{
16+
// MAA pipeline / interface JSON 允许注释(JSONC);用 jsonc parser 以保留注释。
17+
files: [
18+
'*.json'
19+
],
20+
options: {
21+
parser: 'jsonc',
22+
tabWidth: 4
23+
}
24+
},
25+
{
26+
files: [
27+
'*.jsonc'
28+
],
29+
options: {
30+
parser: 'jsonc',
31+
tabWidth: 4
32+
}
33+
}
34+
]
35+
}

.vscode/extensions.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"recommendations": [
3+
"nekosu.maa-support",
4+
"windsland52.maa-log-analyzer",
5+
"esbenp.prettier-vscode",
6+
"DavidAnson.vscode-markdownlint",
7+
"charliermarsh.ruff",
8+
"ms-python.debugpy",
9+
"ms-python.python",
10+
"ms-python.vscode-pylance"
11+
]
12+
}

.vscode/launch.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "AKOP: smoke (Win32)",
6+
"type": "debugpy",
7+
"request": "launch",
8+
"program": "${workspaceFolder}/custom/main.py",
9+
"args": ["--mode", "win32"],
10+
"cwd": "${workspaceFolder}",
11+
"console": "integratedTerminal",
12+
"justMyCode": false
13+
},
14+
{
15+
"name": "AKOP: smoke (ADB)",
16+
"type": "debugpy",
17+
"request": "launch",
18+
"program": "${workspaceFolder}/custom/main.py",
19+
"args": ["--mode", "adb"],
20+
"cwd": "${workspaceFolder}",
21+
"console": "integratedTerminal",
22+
"justMyCode": false
23+
}
24+
]
25+
}

.vscode/settings.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"[json]": {
3+
"editor.defaultFormatter": "esbenp.prettier-vscode"
4+
},
5+
"[jsonc]": {
6+
"editor.defaultFormatter": "esbenp.prettier-vscode"
7+
},
8+
"[python]": {
9+
"editor.defaultFormatter": "charliermarsh.ruff"
10+
},
11+
"editor.formatOnSave": true,
12+
"files.associations": {
13+
"*.json": "jsonc",
14+
"*.jsonc": "jsonc"
15+
},
16+
"files.eol": "\n",
17+
"json.schemas": [
18+
{
19+
"fileMatch": ["/interface.json"],
20+
"url": "./tools/schema/interface.schema.json"
21+
},
22+
{
23+
"fileMatch": ["/tasks/*.json"],
24+
"url": "./tools/schema/interface_import.schema.json"
25+
},
26+
{
27+
"fileMatch": [
28+
"/resource/*/default_pipeline.json",
29+
"/resource/*/pipeline/*.json",
30+
"/resource/*/pipeline/**/*.json"
31+
],
32+
"url": "./tools/schema/pipeline.schema.json"
33+
}
34+
],
35+
"python.defaultInterpreterPath": "${workspaceFolder}/.venv"
36+
}

examples/sample_1-7.json

Lines changed: 89 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,92 @@
11
{
2-
"settings": {
3-
"map_code": "1-7",
4-
"map_name": "1-7",
5-
"max_tick": 30,
6-
"initial_time": 0,
7-
"wait_time1": 0.05,
8-
"wait_time2": 0.1,
9-
"wait_time3": 0.2,
10-
"bullet_threshold": 10,
11-
"frame_threshold": 3
12-
},
13-
"actions": [
14-
{
15-
"cost": 15,
16-
"tick": 0,
17-
"action_type": "部署",
18-
"oper": "斑点",
19-
"pos": "D2",
20-
"direction": ""
2+
"settings": {
3+
"map_code": "1-7",
4+
"map_name": "1-7",
5+
"max_tick": 30,
6+
"initial_time": 0,
7+
"wait_time1": 0.05,
8+
"wait_time2": 0.1,
9+
"wait_time3": 0.2,
10+
"bullet_threshold": 10,
11+
"frame_threshold": 3
2112
},
22-
{
23-
"cost": 3,
24-
"tick": 0,
25-
"action_type": "部署",
26-
"oper": "Castle-3",
27-
"pos": "D5",
28-
"direction": ""
29-
},
30-
{
31-
"cost": 0,
32-
"tick": 0,
33-
"action_type": "撤退",
34-
"oper": "Castle-3"
35-
},
36-
{
37-
"cost": 13,
38-
"tick": 0,
39-
"action_type": "技能",
40-
"oper": "斑点"
41-
},
42-
{
43-
"cost": 20,
44-
"tick": 0,
45-
"action_type": "部署",
46-
"oper": "克洛丝",
47-
"pos": "E6",
48-
"direction": ""
49-
},
50-
{
51-
"cost": 11,
52-
"tick": 0,
53-
"action_type": "部署",
54-
"oper": "",
55-
"pos": "D6",
56-
"direction": ""
57-
},
58-
{
59-
"cost": 3,
60-
"tick": 0,
61-
"action_type": "部署",
62-
"oper": "Lancet-2",
63-
"pos": "C6",
64-
"direction": ""
65-
},
66-
{
67-
"cost": 1,
68-
"tick": 0,
69-
"action_type": "撤退",
70-
"oper": "克洛丝"
71-
},
72-
{
73-
"cost": 5,
74-
"tick": 0,
75-
"action_type": "撤退",
76-
"oper": ""
77-
},
78-
{
79-
"cost": 9,
80-
"tick": 0,
81-
"action_type": "撤退",
82-
"oper": "Lancet-2"
83-
},
84-
{
85-
"cost": 10,
86-
"tick": 0,
87-
"action_type": "技能",
88-
"oper": "装置",
89-
"pos": "D4"
90-
}
91-
]
13+
"actions": [
14+
{
15+
"cost": 15,
16+
"tick": 0,
17+
"action_type": "部署",
18+
"oper": "斑点",
19+
"pos": "D2",
20+
"direction": ""
21+
},
22+
{
23+
"cost": 3,
24+
"tick": 0,
25+
"action_type": "部署",
26+
"oper": "Castle-3",
27+
"pos": "D5",
28+
"direction": ""
29+
},
30+
{
31+
"cost": 0,
32+
"tick": 0,
33+
"action_type": "撤退",
34+
"oper": "Castle-3"
35+
},
36+
{
37+
"cost": 13,
38+
"tick": 0,
39+
"action_type": "技能",
40+
"oper": "斑点"
41+
},
42+
{
43+
"cost": 20,
44+
"tick": 0,
45+
"action_type": "部署",
46+
"oper": "克洛丝",
47+
"pos": "E6",
48+
"direction": ""
49+
},
50+
{
51+
"cost": 11,
52+
"tick": 0,
53+
"action_type": "部署",
54+
"oper": "",
55+
"pos": "D6",
56+
"direction": ""
57+
},
58+
{
59+
"cost": 3,
60+
"tick": 0,
61+
"action_type": "部署",
62+
"oper": "Lancet-2",
63+
"pos": "C6",
64+
"direction": ""
65+
},
66+
{
67+
"cost": 1,
68+
"tick": 0,
69+
"action_type": "撤退",
70+
"oper": "克洛丝"
71+
},
72+
{
73+
"cost": 5,
74+
"tick": 0,
75+
"action_type": "撤退",
76+
"oper": ""
77+
},
78+
{
79+
"cost": 9,
80+
"tick": 0,
81+
"action_type": "撤退",
82+
"oper": "Lancet-2"
83+
},
84+
{
85+
"cost": 10,
86+
"tick": 0,
87+
"action_type": "技能",
88+
"oper": "装置",
89+
"pos": "D4"
90+
}
91+
]
9292
}

interface.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
{
2-
// ProjectInterface v2 声明。Option B(自建集成应用,进程内 MAA)——不声明 agent 子进程。
3-
// 即使我们用自己的 UI 跑,本文件也是项目自描述 + 控制器/资源配置规范位置,且通用 UI 可据此加载。
42
"interface_version": 2,
53
"name": "arknights-auto-operator",
64
"label": "明日方舟自动凹图",
75
"version": "v0.1.0",
6+
"icon": "logo.png",
87
"description": "帧级自动凹图 + 费用条计时 + 打轴对轴(MaaFramework 方案二 + PySide6)",
98
"github": "https://github.com/Windsland52/ArknightsAutoOperator",
109
"controller": [
@@ -34,7 +33,5 @@
3433
"path": ["./resource/base"]
3534
}
3635
],
37-
"import": [
38-
"./tasks/farm.json"
39-
]
36+
"import": ["./tasks/farm.json"]
4037
}

0 commit comments

Comments
 (0)