Improve MCP startup flow and repo automation

This commit is contained in:
winlifes
2026-04-16 17:45:35 +08:00
parent 140d6295a8
commit be53f3c56c
7 changed files with 234 additions and 16 deletions
+74
View File
@@ -0,0 +1,74 @@
name: CI
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Validate repository metadata
run: |
python - <<'PY'
import json
import pathlib
import sys
root = pathlib.Path('.')
errors = []
package_path = root / 'package.json'
try:
package = json.loads(package_path.read_text(encoding='utf-8'))
except Exception as exc:
errors.append(f"package.json is not valid JSON: {exc}")
else:
for key in ('name', 'version', 'main', 'package_version'):
if key not in package or package[key] in (None, ''):
errors.append(f"package.json is missing required key: {key}")
required_docs = [
'README.md',
'README_CN.md',
'LICENSE',
'CHANGELOG.md',
'CONTRIBUTING.md',
]
for relative in required_docs:
if not (root / relative).exists():
errors.append(f"Missing required repository file: {relative}")
forbidden_paths = []
for path in root.rglob('*'):
if '.git' in path.parts:
continue
if path.name == '.DS_Store' or '.idea' in path.parts or 'library' in path.parts or 'Library' in path.parts:
forbidden_paths.append(str(path))
if forbidden_paths:
errors.append('Repository contains local junk files:\n- ' + '\n- '.join(sorted(forbidden_paths)))
if errors:
print('Validation failed:\n')
for error in errors:
print(f'- {error}')
sys.exit(1)
print('Repository validation passed.')
PY
- name: Run syntax checks
run: npm run check