feat: 初始化 SCALE OS 工程框架

- 添加 SCALE Engine 配置 (.scale/)
- 添加 OpenClaw Agent 配置 (.openclaw/)
- 添加知识文档 (AGENTS.md, TOOLS.md)
- 添加质量契约和工作流配置
- 添加 22 个工作流模板
- 添加验证脚本和门控脚本
- 添加 skills-registry 技能注册表
This commit is contained in:
2026-05-20 15:06:38 +08:00
parent 5f1c217853
commit 2f16c4762f
51 changed files with 2783 additions and 0 deletions

35
.openclaw/settings.json Normal file
View File

@@ -0,0 +1,35 @@
{
"hooks": {
"pre-exec": [
{
"matcher": "",
"command": "scale gate pre-tool Bash --args-json \"$ARGS\" --session-id \"$SESSION_ID\""
},
{
"matcher": "edit|write",
"command": "scale gate pre-tool Edit --args-json \"$ARGS\" --session-id \"$SESSION_ID\""
}
],
"post-exec": [
{
"matcher": "edit|write",
"command": "scale gate post-tool Edit --args-json \"$ARGS\" --exit-code \"$EXIT_CODE\" --session-id \"$SESSION_ID\""
},
{
"matcher": "",
"command": "scale gate post-tool Bash --args-json \"$ARGS\" --exit-code \"$EXIT_CODE\" --session-id \"$SESSION_ID\""
}
],
"before-stop": [
{
"matcher": "",
"command": "scale gate before-stop --session-id \"$SESSION_ID\""
}
]
},
"permissions": {
"allow": [
"scale:*"
]
}
}

7
.scale/.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
*.db
*.db-journal
events/
checkpoints/
evidence/
state/
hooks/*.sh

4
.scale/assets.json Normal file
View File

@@ -0,0 +1,4 @@
{
"version": 1,
"assets": []
}

View File

@@ -0,0 +1,6 @@
{
"version": 1,
"generatedAt": "",
"scope": "Legacy findings tracked separately. New findings and changed-file findings must still be fixed before completion.",
"findings": []
}

View File

@@ -0,0 +1,67 @@
{
"version": 1,
"mode": "warn",
"sourceDirectories": [
"src",
"app",
"packages",
"services",
"cmd",
"internal",
"pkg"
],
"ignoredDirectories": [
".git",
".scale",
"node_modules",
"dist",
"build",
"coverage",
"test-results",
"playwright-report",
"tmp",
"temp",
"docs",
"tests",
"__tests__",
"e2e"
],
"allowedConsoleDirectories": [
"src/api",
"src/cli",
"scripts"
],
"allowedConsoleFiles": [
"src/dashboard/DashboardServer.ts"
],
"maxFileLines": 500,
"logging": {
"approvedLoggers": [
"pino",
"winston",
"zap",
"zerolog",
"logrus",
"slog"
],
"sensitiveFields": [
"password",
"passwd",
"token",
"accessToken",
"refreshToken",
"secret",
"authorization",
"cookie",
"apiKey",
"credential",
"privateKey"
]
},
"architecture": {
"enforceLayering": true
},
"blockingRules": [],
"allowedFindingPatterns": [],
"baselineFindings": []
}

23
.scale/frameworks.json Normal file
View File

@@ -0,0 +1,23 @@
{
"version": 1,
"lastReviewedAt": "",
"reviewIntervalDays": 90,
"frameworks": [],
"orm": [],
"ui": {
"designSystem": "",
"componentLibrary": "",
"visualReviewRequired": true
},
"architecture": {
"layers": [
"api",
"service",
"domain",
"repository",
"infrastructure"
],
"dependencyRule": "outer layers depend inward through explicit interfaces"
},
"bannedImports": []
}

200
.scale/governance.lock.json Normal file
View File

@@ -0,0 +1,200 @@
{
"version": 1,
"scalePackage": "@hongmaple0820/scale-engine",
"scaleVersion": "0.0.0-dev",
"pack": "standard",
"packVersion": 1,
"generatedAt": "2026-05-20T06:59:28.689Z",
"files": [
{
"path": "docs/workflow/README.md",
"sha256": "95568223be7593850dd117af82c7a983bb361a19651884b7dd8a1240a4a37956",
"owned": true
},
{
"path": "docs/workflow/templates/explore.md",
"sha256": "e3845d0ecc4d85d11cbd2ac49de2a6fc3fad4debf071c31a4567c76fc44bceea",
"owned": true
},
{
"path": "docs/workflow/templates/mini-prd.md",
"sha256": "276bec99769152ed90c4ab56e789c4fd8756de4fb1794db260a70a6a5ef032b8",
"owned": true
},
{
"path": "docs/workflow/templates/skill-plan.md",
"sha256": "60f48a9d780bf0029bb7281a92d3ff9ca702e6cae1c49d9ca17fda790f04439e",
"owned": true
},
{
"path": "docs/workflow/templates/skill-evidence.md",
"sha256": "fa697a67437bae8b3372d620cfab4e64daff7a693a0603327389da362cf805d7",
"owned": true
},
{
"path": "docs/workflow/templates/runtime.md",
"sha256": "e1f4c575dec24c95e9b9f72d52d47badbd1bd0e8fb207193b671803a0c59fa9c",
"owned": true
},
{
"path": "docs/workflow/templates/reality-check.md",
"sha256": "11a9102b87b6f08b118a21edc5fcdda49f27741078e463a44a6e4dd904513d0b",
"owned": true
},
{
"path": "docs/workflow/templates/resource-cleanup.md",
"sha256": "ba2b343cbee04d3037638f3751f64cb14ad63c528529be364967bb49619cfa25",
"owned": true
},
{
"path": "docs/workflow/templates/ui-spec.md",
"sha256": "328022424df35d7a221ff18fb5c04840c74f327deabf1d49f7a7e739fe06290c",
"owned": true
},
{
"path": "docs/workflow/templates/visual-review.md",
"sha256": "7ebf7765969a7cf36b46aeb4d9f1c04f5513cefdd2e57256c1badc83722b00cc",
"owned": true
},
{
"path": "docs/workflow/templates/api-contract.md",
"sha256": "a9091cc5f6d7b8178589dcff2253afa366d188903b175dd5c69dbc6c955bace0",
"owned": true
},
{
"path": "docs/workflow/templates/docs-impact.md",
"sha256": "a4ff6c98539b71ff7f6df2cce8253b9073c6c134ee2ee9d1e1fc34b819b961a0",
"owned": true
},
{
"path": "docs/workflow/templates/resource-impact.md",
"sha256": "af37cb2d4d97cfe46243269225732dfc10180dd6eb1e58b3085abb6ee0e3cc5f",
"owned": true
},
{
"path": "docs/workflow/templates/standards-impact.md",
"sha256": "eed804359ca45b0b7d4436b305ea44f9872bccaa3c6e4fcf3dfbf0b1f422545f",
"owned": true
},
{
"path": "docs/workflow/templates/architecture-review.md",
"sha256": "819390550452c3bb65e5eff2fee44d3d5767a3f4e164fd64cdb10420fd3f40aa",
"owned": true
},
{
"path": "docs/workflow/templates/security-review.md",
"sha256": "542bb035a0e45dc954056d95652952717ec34765debe0de3649246fb6e1290a8",
"owned": true
},
{
"path": "docs/workflow/templates/db-change-plan.md",
"sha256": "9e76ec7d3efae5374373bc1ad11c94da74ff59927b3778a1fed557dba0c51458",
"owned": true
},
{
"path": "docs/workflow/templates/e2e-plan.md",
"sha256": "e77779e7f0f61610c9d1ef594a53565599d0777f2c6c12a9c6507f82b6fbfb26",
"owned": true
},
{
"path": "docs/workflow/templates/product-smoke.md",
"sha256": "5b4be8ecddc47d1b4f890bd83532ed5652a1444a0ab2d30c0c91015a46f648d4",
"owned": true
},
{
"path": "docs/workflow/templates/plan.md",
"sha256": "08100fe1bb88e801e11c13cd1ad6d26dbebe6117027b93b26c44ad3ef907ff81",
"owned": true
},
{
"path": "docs/workflow/templates/verification.md",
"sha256": "b9cbe1f287115a15b18b201e8e25e2c40a2dc3aa4b347098c21414c66ea0fb49",
"owned": true
},
{
"path": "docs/workflow/templates/review.md",
"sha256": "62e3bee211f9e4381bfb3fb7463edb78e74da708bc804c35f4acab9c5f65d010",
"owned": true
},
{
"path": "docs/workflow/templates/summary.md",
"sha256": "00c99d6236ca749e330eb3769c1c0a55082f64db58362b73944419e7ec7753cf",
"owned": true
},
{
"path": "docs/workflow/templates/github-actions-scale-preflight.yml",
"sha256": "a218c4a23251e6da42b807ebc490d363d17490abd5e8ec7bcb11377444571f33",
"owned": true
},
{
"path": "docs/workflow/templates/pre-push-scale-preflight.sh",
"sha256": "3b3a8e45ab3ac8774e54fbcbd5b44cddbf1df06a74aa671f535289b9629a3f7c",
"owned": true
},
{
"path": "docs/worklog/metrics.md",
"sha256": "66ced9a1d893b142e01d2e4aaf0e3d6509a8166d6274fbacfc4abee52874359b",
"owned": true
},
{
"path": "scripts/qa/product-smoke.ps1",
"sha256": "e5b0694cbb83dd3e722435b6133c45ea43eab576a3f013dc30e6bc5492f8d6fb",
"owned": true
},
{
"path": "scripts/qa/product-smoke.sh",
"sha256": "633ec087cc54081ca9aa52f4915274b427b0e2148cf1510a8dac56ce47a71c7e",
"owned": true
},
{
"path": ".scale/verification.json",
"sha256": "483e73923114628149c7f31a984526cb07bf60a4c237273beb68697078dc1941",
"owned": true
},
{
"path": ".scale/skills.json",
"sha256": "56228729c0fbb89ee31fee286b47a877002fc0972ea45db7f3153b7ec213d24e",
"owned": true
},
{
"path": ".scale/tools.json",
"sha256": "f204f9ef206a7b0f25b2064661bd0d5ff25980b36c0f9bda0bb973af206074ad",
"owned": true
},
{
"path": ".scale/resource-policy.json",
"sha256": "67d1e469d6cef5d68508ac3cc8bb5c9fd1eea33826f9c3f2fdf8e19cff10f6b9",
"owned": true
},
{
"path": ".scale/assets.json",
"sha256": "a8174f5941573d1acd5d5df5dee4bca235701e21c29685694d143512d3247acf",
"owned": true
},
{
"path": ".scale/output-policy.json",
"sha256": "c51b6f0b4ecc570f0b8a7738a1a3b0013cc76fb99dfb121c8ee9f51e7fa7c3bb",
"owned": true
},
{
"path": ".scale/product-smoke.json",
"sha256": "9b07dd0d9dd0d3a1689c497cd1f79b1f72b8324d4059b5172c1b503a9d82585f",
"owned": true
},
{
"path": ".scale/engineering-standards.json",
"sha256": "dd8a8bc0f0594f31ba9fd71120e73d4c78db84b7603aab50bdaf875401d78ad9",
"owned": true
},
{
"path": ".scale/engineering-standards-baseline.json",
"sha256": "14b1ebdb505038b5eba18297b4e76ae1185cd60c98a6f131001633498bed2cf7",
"owned": true
},
{
"path": ".scale/frameworks.json",
"sha256": "78158a49e9c1331e0222e6efa1bb3744c5fe2bdb043da66a5238855f433756cc",
"owned": true
}
]
}

72
.scale/output-policy.json Normal file
View File

@@ -0,0 +1,72 @@
{
"version": 1,
"sourceFormat": "markdown",
"artifactDirectory": "artifacts",
"manifestFile": "artifact-manifest.json",
"defaultTheme": "auto",
"defaultGitPolicy": "review",
"safety": {
"allowRemoteScripts": false,
"allowRemoteStyles": false,
"detectSecrets": true
},
"templates": {
"plan-comparison": {
"label": "Plan Comparison",
"sources": [
"mini-prd.md",
"explore.md",
"plan.md"
],
"description": "Compare candidate approaches, tradeoffs, open questions, and decision criteria."
},
"implementation-plan": {
"label": "Implementation Plan",
"sources": [
"plan.md",
"verification.md"
],
"description": "Convert the implementation plan and verification strategy into a scannable delivery surface."
},
"code-review": {
"label": "Code Review",
"sources": [
"review.md",
"security-review.md",
"standards-impact.md"
],
"description": "Summarize review findings, severity, evidence, and residual risks."
},
"status-report": {
"label": "Status Report",
"sources": [
"summary.md",
"verification.md",
"resource-impact.md",
"standards-impact.md"
],
"description": "Show current task status, proof, blockers, resource state, and follow-ups."
},
"incident-report": {
"label": "Incident Report",
"sources": [
"explore.md",
"plan.md",
"verification.md",
"review.md"
],
"description": "Explain incident context, diagnosis, fix, validation, and prevention work."
},
"release-report": {
"label": "Release Report",
"sources": [
"summary.md",
"verification.md",
"review.md",
"resource-impact.md",
"standards-impact.md"
],
"description": "Package final release evidence, risk state, unverified items, and sign-off readiness."
}
}
}

33
.scale/product-smoke.json Normal file
View File

@@ -0,0 +1,33 @@
{
"version": 1,
"gate": "warn",
"requiredForLevels": [
"M",
"L",
"CRITICAL"
],
"emptyProbeBehavior": "block",
"setupGuide": [
"Set probes[].enabled=true only after replacing the example command with a real product path.",
"Use a command that crosses the real boundary: client/UI -> gateway/router -> service -> persistence or observable result.",
"Run: scale preflight --profile productSmoke --json",
"Run: scale runtime final-check --level M --json"
],
"runtimeEvidence": {
"requiredKind": "command",
"requiredStatus": "passed",
"requireArtifacts": true
},
"probes": [
{
"id": "example-business-flow",
"enabled": false,
"description": "Replace with a real user/product path such as UI -> gateway -> service -> database/storage.",
"command": "curl -fsS http://127.0.0.1:3000/health",
"expected": {
"exitCode": 0,
"evidenceArtifact": ".agent/logs/product-smoke.json"
}
}
]
}

View File

@@ -0,0 +1,70 @@
{
"version": "1.0",
"project": "eskin-model-player",
"description": "E-Skin 传感器数据可视化工具质量契约",
"gates": {
"pre_commit": {
"enabled": true,
"checks": [
{
"name": "type_check",
"command": "cargo check",
"required": true,
"description": "类型检查"
},
{
"name": "lint",
"command": "cargo clippy -- -D warnings",
"required": true,
"description": "Clippy lint 检查"
},
{
"name": "test",
"command": "cargo test",
"required": true,
"description": "单元测试"
}
]
},
"pre_push": {
"enabled": true,
"checks": [
{
"name": "build_release",
"command": "cargo build --release",
"required": true,
"description": "Release 构建验证"
},
{
"name": "full_test",
"command": "cargo test --all",
"required": true,
"description": "完整测试套件"
}
]
},
"code_review": {
"enabled": true,
"checks": [
{
"name": "no_unwrap",
"pattern": "\\.unwrap\\(\\)",
"severity": "warning",
"description": "避免裸 unwrap(),使用 expect() 或 ? 运算符"
},
{
"name": "no_todo",
"pattern": "todo!\\(\\)|unimplemented!\\(\\)",
"severity": "warning",
"description": "生产代码不应包含 todo!/unimplemented!"
}
]
}
},
"quality_metrics": {
"max_complexity": 15,
"min_test_coverage": 0,
"max_file_lines": 500,
"max_function_lines": 80
}
}

View File

@@ -0,0 +1,39 @@
{
"version": 1,
"maxGitFileSizeBytes": 5242880,
"ignoredDirectories": [
".git",
"node_modules",
"dist",
"build",
"vendor",
".next",
".turbo"
],
"retainedRuntimeDirectories": [
".scale/tmp",
".scale/evidence",
".scale/reports",
".scale/resource-reports",
"tmp",
"temp",
"test-results",
"playwright-report",
"coverage"
],
"owners": {
"docs": "engineering",
"docs/standards": "engineering",
"docs/workflow": "engineering",
"docs/decisions": "architecture",
"docs/modules": "module-owner",
".planning": "engineering",
".scale": "engineering"
},
"modules": {
"example": {
"path": "src/example",
"owner": "team-or-owner"
}
}
}

View File

@@ -0,0 +1,82 @@
{
"version": "1.0",
"project": "eskin-model-player",
"skills": [
{
"name": "graphify",
"category": "knowledge",
"description": "代码知识图谱",
"install": "pip install graphifyy && graphify install",
"riskLevel": "LOW",
"status": "optional"
},
{
"name": "systematic-debugging",
"category": "debugging",
"description": "系统化调试方法论",
"riskLevel": "LOW",
"status": "active"
},
{
"name": "freeze-guard",
"category": "safety",
"description": "防止代码冻结/死锁",
"riskLevel": "LOW",
"status": "active"
},
{
"name": "tdd",
"category": "testing",
"description": "测试驱动开发",
"riskLevel": "LOW",
"status": "active"
},
{
"name": "verification",
"category": "quality",
"description": "验证检查",
"riskLevel": "LOW",
"status": "active"
},
{
"name": "review",
"category": "quality",
"description": "代码审查",
"riskLevel": "LOW",
"status": "active"
},
{
"name": "ce-compound",
"category": "workflow",
"description": "复合编辑",
"riskLevel": "LOW",
"status": "active"
},
{
"name": "ship",
"category": "workflow",
"description": "发布交付",
"riskLevel": "LOW",
"status": "active"
},
{
"name": "scale-methodology",
"category": "methodology",
"description": "SCALE 求是方法论",
"riskLevel": "LOW",
"status": "active"
},
{
"name": "codegraph",
"category": "knowledge",
"description": "代码图谱",
"riskLevel": "LOW",
"status": "active"
}
],
"riskFlags": {
"HIGH": "需要人工审查",
"MEDIUM": "自动审查",
"LOW": "自动信任"
}
}

630
.scale/skills.json Normal file
View File

@@ -0,0 +1,630 @@
{
"version": 1,
"policy": {
"mode": "warn",
"enforceLevels": [
"M",
"L",
"CRITICAL"
],
"requireSkillPlan": true
},
"domains": {
"ui": {
"detect": {
"files": [
"src/**/*.tsx",
"src/**/*.jsx",
"app/**/*.tsx",
"pages/**/*.tsx",
"components/**/*.tsx",
"**/*.css",
"**/*.scss"
],
"keywords": [
"ui",
"ux",
"frontend",
"component",
"page",
"layout",
"responsive",
"visual",
"界面",
"页面",
"交互",
"视觉",
"前端"
]
},
"requiredSkills": [
"frontend-design",
"ui-ux-pro-max"
],
"recommendedSkills": [
"awesome-design-md",
"webapp-testing",
"agent-browser",
"mcp-chrome-devtools",
"browser-testing-with-devtools",
"design-review"
],
"requiredArtifacts": [
"skill-plan.md",
"skill-evidence.md",
"mini-prd.md",
"ui-spec.md",
"visual-review.md"
],
"requiredVerification": [
"design-system",
"screenshot",
"responsive-check",
"browser-run",
"visual-review"
]
},
"webResearch": {
"detect": {
"files": [
"docs/research/**",
"docs/**/research.md",
"**/research.md"
],
"keywords": [
"web research",
"search online",
"online",
"latest",
"source citation",
"source citations",
"logged-in",
"login",
"dynamic web page",
"authenticated page",
"inspect page",
"web-access",
"network",
"web fetch"
]
},
"requiredSkills": [
"web-access"
],
"recommendedSkills": [
"agent-browser",
"mcp-chrome-devtools",
"source-driven-development",
"browser-use"
],
"requiredArtifacts": [
"skill-plan.md",
"skill-evidence.md",
"verification.md"
],
"requiredVerification": [
"source-citation",
"browser-evidence",
"network-console-check"
]
},
"browserAutomation": {
"detect": {
"files": [
"tests/e2e/**",
"e2e/**",
"playwright.config.*",
"**/*.spec.ts",
"**/*.e2e.ts"
],
"keywords": [
"browser automation",
"browser interaction",
"browser behavior",
"browser",
"playwright",
"agent-browser",
"chrome devtools",
"cdp",
"screenshot",
"console log",
"network request",
"e2e",
"end-to-end"
]
},
"recommendedSkills": [
"webapp-testing",
"agent-browser",
"web-access",
"mcp-chrome-devtools",
"playwright",
"playwright-interactive"
],
"requiredArtifacts": [
"skill-plan.md",
"skill-evidence.md",
"e2e-plan.md",
"verification.md"
],
"requiredVerification": [
"browser-run",
"screenshot",
"console-log",
"network-console-check"
]
},
"e2e": {
"detect": {
"files": [
"tests/e2e/**",
"e2e/**",
"playwright.config.*"
],
"keywords": [
"e2e",
"browser",
"playwright",
"end-to-end",
"端到端",
"浏览器"
]
},
"recommendedSkills": [
"webapp-testing",
"agent-browser",
"web-access",
"mcp-chrome-devtools",
"playwright",
"playwright-interactive"
],
"requiredArtifacts": [
"skill-plan.md",
"skill-evidence.md",
"e2e-plan.md"
],
"requiredVerification": [
"browser-run",
"screenshot",
"console-log"
]
},
"desktopAutomation": {
"detect": {
"files": [
"tests/desktop/**",
"desktop/**",
"e2e/desktop/**"
],
"keywords": [
"desktop automation",
"desktop app",
"computer use",
"cua",
"gui automation",
"operate desktop",
"windows desktop",
"wps",
"wechat",
"weixin",
"office app"
]
},
"requiredSkills": [
"turix-cua"
],
"recommendedSkills": [
"agent-browser",
"web-access",
"computer-use",
"opencli"
],
"requiredArtifacts": [
"skill-plan.md",
"skill-evidence.md",
"verification.md"
],
"requiredVerification": [
"desktop-screenshot",
"operator-safety",
"side-effect-boundary"
],
"blockLevels": [
"CRITICAL"
]
},
"externalCli": {
"detect": {
"files": [
"scripts/**",
".github/workflows/**"
],
"keywords": [
"external cli",
"agent cli",
"codex",
"codex cli",
"claude code",
"gemini cli",
"opencode",
"aider",
"cross-agent",
"subagent",
"wps cli",
"wechat automation"
]
},
"recommendedSkills": [
"codex-cli",
"gemini-cli",
"opencode-cli",
"git-workflow-and-versioning",
"code-reviewer"
],
"requiredArtifacts": [
"skill-plan.md",
"skill-evidence.md",
"verification.md"
],
"requiredVerification": [
"cli-version-check",
"command-output",
"dry-run-or-safe-mode",
"side-effect-boundary"
]
},
"api": {
"detect": {
"files": [
"**/api/**",
"**/routes/**",
"**/controller/**",
"**/*.api",
"**/*.proto"
],
"keywords": [
"api",
"endpoint",
"route",
"handler",
"接口",
"路由"
]
},
"recommendedSkills": [
"tdd-guide",
"code-review"
],
"requiredArtifacts": [
"skill-plan.md",
"mini-prd.md",
"api-contract.md"
],
"requiredVerification": [
"contract-check"
]
},
"db": {
"detect": {
"files": [
"**/migration/**",
"**/migrations/**",
"**/*.sql",
"**/schema.*",
"**/model/**"
],
"keywords": [
"database",
"db",
"migration",
"schema",
"sql",
"数据表",
"数据库",
"迁移"
]
},
"requiredSkills": [
"security-review"
],
"recommendedSkills": [
"systematic-debugging"
],
"requiredArtifacts": [
"skill-plan.md",
"db-change-plan.md",
"security-review.md"
],
"requiredVerification": [
"rollback-plan",
"migration-test"
]
},
"security": {
"detect": {
"files": [
"**/auth/**",
"**/permission/**",
"**/security/**",
"**/middleware/**"
],
"keywords": [
"auth",
"permission",
"tenant",
"token",
"credential",
"secret",
"rbac",
"鉴权",
"权限",
"租户",
"密钥"
]
},
"requiredSkills": [
"security-review"
],
"recommendedSkills": [
"code-review"
],
"requiredArtifacts": [
"skill-plan.md",
"security-review.md"
],
"requiredVerification": [
"threat-model",
"rollback-plan"
],
"blockLevels": [
"CRITICAL"
]
},
"docs": {
"detect": {
"files": [
"docs/**",
"**/*.md"
],
"keywords": [
"docs",
"documentation",
"document",
"readme",
"文档"
]
},
"recommendedSkills": [
"update-docs",
"workflow-guide"
],
"requiredArtifacts": [
"skill-plan.md",
"skill-evidence.md",
"docs-impact.md"
]
},
"resourceGovernance": {
"detect": {
"files": [
".scale/resource-policy.json",
".scale/assets.json",
"docs/modules/**",
"docs/decisions/**",
"docs/worklog/tasks/**",
"test-results/**",
"playwright-report/**",
"coverage/**",
"tmp/**",
"scripts/tmp/**",
"**/*.png",
"**/*.jpg",
"**/*.jpeg",
"**/*.webp",
"**/*.gif",
"**/*.mp4",
"**/*.webm",
"**/*.mov",
"**/*.wav",
"**/*.mp3"
],
"keywords": [
"asset",
"resource",
"artifact retention",
"lifecycle",
"temporary file",
"e2e report",
"screenshot",
"video",
"documentation drift",
"resource governance"
]
},
"recommendedSkills": [
"documentation-and-adrs",
"git-workflow-and-versioning",
"ai-slop-cleaner"
],
"requiredArtifacts": [
"skill-plan.md",
"skill-evidence.md",
"docs-impact.md",
"resource-impact.md"
],
"requiredVerification": [
"asset-scan",
"asset-doctor"
]
},
"engineeringStandards": {
"detect": {
"files": [
".scale/engineering-standards.json",
".scale/frameworks.json",
"docs/standards/**",
"src/**",
"app/**",
"packages/**",
"services/**",
"internal/**",
"pkg/**"
],
"keywords": [
"coding standard",
"engineering standard",
"logging",
"redaction",
"desensitization",
"orm",
"framework convention",
"architecture boundary",
"design pattern",
"test rigor",
"sql injection",
"xss",
"脱敏",
"日志",
"架构规范",
"编码规范",
"框架规范",
"联调",
"发版"
]
},
"recommendedSkills": [
"code-review-and-quality",
"security-and-hardening",
"documentation-and-adrs"
],
"requiredArtifacts": [
"skill-plan.md",
"skill-evidence.md",
"standards-impact.md",
"architecture-review.md",
"security-review.md"
],
"requiredVerification": [
"standards-scan",
"standards-doctor"
],
"blockLevels": [
"L",
"CRITICAL"
]
},
"review": {
"detect": {
"files": [
".github/PULL_REQUEST_TEMPLATE.md",
".github/pull_request_template.md"
],
"keywords": [
"review",
"code review",
"pull request",
"pr",
"merge request",
"changes reviewed",
"审查",
"评审"
]
},
"requiredSkills": [
"code-reviewer"
],
"recommendedSkills": [
"pr-creator"
],
"requiredArtifacts": [
"skill-plan.md",
"skill-evidence.md",
"review.md"
],
"requiredVerification": [
"review-evidence"
]
},
"release": {
"detect": {
"files": [
"CHANGELOG.md",
"package.json",
".github/workflows/**"
],
"keywords": [
"release",
"ship",
"publish",
"deploy",
"pull request",
"pr",
"发版",
"发布",
"部署"
]
},
"requiredSkills": [
"code-reviewer"
],
"recommendedSkills": [
"pr-creator",
"fix",
"verification",
"code-review"
],
"requiredArtifacts": [
"skill-plan.md",
"skill-evidence.md",
"review.md",
"summary.md"
],
"requiredVerification": [
"preflight"
]
},
"skillDiscovery": {
"detect": {
"keywords": [
"skill",
"capability",
"missing capability",
"install skill",
"find skill"
]
},
"recommendedSkills": [
"find-skills"
],
"requiredArtifacts": [
"skill-plan.md",
"skill-evidence.md"
]
},
"fullstackPrototype": {
"detect": {
"keywords": [
"fullstack",
"full-stack",
"mvp",
"prototype",
"next.js",
"react api",
"node api"
]
},
"recommendedSkills": [
"fullstack-developer"
],
"requiredArtifacts": [
"skill-plan.md",
"skill-evidence.md",
"mini-prd.md",
"api-contract.md"
],
"requiredVerification": [
"preflight"
]
}
}
}

118
.scale/tools.json Normal file
View File

@@ -0,0 +1,118 @@
{
"version": 1,
"mode": "evidence-required",
"tools": {
"web-access": {
"enabled": true,
"requiredFor": [
"webResearch"
],
"recommendedFor": [
"browserAutomation"
],
"destructiveActions": "block",
"evidenceRequired": true
},
"frontend-design": {
"enabled": true,
"requiredFor": [
"ui"
],
"destructiveActions": "block",
"evidenceRequired": true
},
"ui-ux-pro-max": {
"enabled": true,
"requiredFor": [
"ui"
],
"destructiveActions": "block",
"evidenceRequired": true
},
"agent-browser": {
"enabled": true,
"requiredFor": [
"browserAutomation"
],
"recommendedFor": [
"ui",
"e2e"
],
"allowedDomains": [
"localhost",
"127.0.0.1"
],
"destructiveActions": "confirm",
"command": "agent-browser",
"evidenceRequired": true
},
"playwright": {
"enabled": true,
"requiredFor": [
"e2e"
],
"recommendedFor": [
"browserAutomation",
"ui"
],
"destructiveActions": "confirm",
"command": "npx playwright",
"evidenceRequired": true
},
"mcp-chrome-devtools": {
"enabled": true,
"requiredFor": [
"browserAutomation"
],
"recommendedFor": [
"ui",
"e2e"
],
"destructiveActions": "confirm",
"mcpToolName": "chrome-devtools",
"evidenceRequired": true
},
"desktop-cua": {
"enabled": false,
"requiredFor": [
"desktopAutomation"
],
"destructiveActions": "block",
"command": "cua",
"evidenceRequired": true
},
"codex-cli": {
"enabled": false,
"requiredFor": [],
"recommendedFor": [
"externalCli",
"review"
],
"destructiveActions": "block",
"command": "codex",
"evidenceRequired": true
},
"gemini-cli": {
"enabled": false,
"requiredFor": [],
"recommendedFor": [
"externalCli",
"review"
],
"destructiveActions": "block",
"command": "gemini",
"evidenceRequired": true
},
"opencode-cli": {
"enabled": false,
"requiredFor": [],
"recommendedFor": [
"externalCli",
"review"
],
"destructiveActions": "block",
"command": "opencode",
"evidenceRequired": true
}
}
}

35
.scale/verification.json Normal file
View File

@@ -0,0 +1,35 @@
{
"version": 1,
"defaultProfile": "default",
"profiles": {
"default": {
"commands": {},
"services": []
},
"productSmoke": {
"commands": {
"smoke": "powershell -ExecutionPolicy Bypass -File scripts/qa/product-smoke.ps1"
},
"services": []
}
},
"services": [],
"exclude": [
"node_modules",
"dist",
"tmp",
"vendor"
],
"policy": {
"mode": "standard",
"optionalToolsWarnOnly": true,
"artifactGate": "warn",
"artifactGateLevels": [
"M",
"L",
"CRITICAL"
],
"engineeringStandardsGate": "block",
"productSmokeGate": "warn"
}
}

51
.scale/workflow.json Normal file
View File

@@ -0,0 +1,51 @@
{
"version": "1.0",
"project": "eskin-model-player",
"workflow": {
"phases": [
{
"name": "explore",
"description": "理解需求和现有代码",
"required": true,
"artifacts": ["docs/workflow/templates/explore.md"]
},
{
"name": "plan",
"description": "制定实现方案",
"required": true,
"artifacts": ["docs/workflow/templates/plan.md"]
},
{
"name": "implement",
"description": "编码实现",
"required": true,
"gates": ["type_check", "lint"]
},
{
"name": "test",
"description": "测试验证",
"required": true,
"gates": ["test"]
},
{
"name": "review",
"description": "代码审查",
"required": true,
"artifacts": ["docs/workflow/templates/review.md"]
},
{
"name": "ship",
"description": "提交发布",
"required": true,
"gates": ["build_release", "full_test"]
}
]
},
"skills_routing": {
"debug": "systematic-debugging",
"test": "tdd",
"review": "review",
"ship": "ship",
"graph": "graphify"
}
}

26
AGENTS.md Normal file
View File

@@ -0,0 +1,26 @@
# .
## SCALE Engine Integration (OpenClaw)
This project uses SCALE Engine for AI engineering governance via OpenClaw.
### Commands
- `scale create <type> <title>` — Create artifact
- `scale transition <id> <action>` — Transition artifact state
- `scale list --type Spec` — List artifacts
- `scale role activate <role>` — Switch role
- `scale doctor` — Health check
### Workflow
1. **Explore** → Role: explorer (Read/Grep only)
2. **Plan** → Create Spec → refine → approve (guard: ambiguity ≤ 0.2)
3. **Implement** → Role: implementer (Edit/Write/Bash unlocked)
4. **Verify** → Must run tests before claiming done
5. **Learn** → Defects → Lessons → Rules → Hooks
### Rules
- 🔴 Dangerous commands are physically blocked
- 🔴 Hardcoded secrets are blocked on Edit/Write
- 🟡 3 identical retries triggers brute-retry detection
- 🟡 Claiming done without running tests is blocked
- 🟢 All tool calls are tracked in .scale/events/

61
TOOLS.md Normal file
View File

@@ -0,0 +1,61 @@
# TOOLS.md — eskin-player 工具链文档
## 项目概述
**eskin-model-player** 是一个 Rust GUI 应用,用于 E-Skin 传感器数据的实时可视化。
- 框架eframe/egui + wgpuWebGPU
- 串口通信serialport crate
- 数据处理glam数学、bytemuck内存布局、crc校验
## 构建工具
| 工具 | 版本 | 用途 |
|------|------|------|
| Rust | 1.95.0+ | 主语言edition 2024 |
| Cargo | 1.95.0+ | 构建系统 |
| SCALE Engine | 0.21.2 | 工程约束与质量门控 |
## 项目命令
```bash
cargo build --release # 构建
cargo clippy # Lint
cargo test # 测试
cargo check # 类型检查
```
## 项目结构
```
eskin-player/
├── Cargo.toml # 依赖配置
├── src/
│ ├── main.rs # 入口
│ ├── app.rs # 应用逻辑
│ ├── ui.rs # UI 组件
│ ├── render.rs # 渲染
│ ├── connection.rs # 连接管理
│ ├── matrix.rs # 矩阵数据
│ ├── texture.rs # 纹理
│ ├── theme.rs # 主题
│ ├── utils.rs # 工具函数
│ ├── shader.wgsl # WebGPU shader
│ └── serial_core/ # 串口核心模块
│ ├── mod.rs
│ ├── serial.rs
│ ├── codec.rs
│ ├── codecs/
│ │ ├── mod.rs
│ │ └── tactile_a.rs
│ ├── frame.rs
│ ├── error.rs
│ └── utils.rs
├── static/ # 静态资源
├── .scale/ # SCALE Engine 配置
├── .openclaw/ # Agent 配置
├── AGENTS.md # Agent 知识文档
└── docs/workflow/ # 工作流模板
```
## 关键依赖
- **eframe 0.34.2** — 跨平台 GUI 框架wgpu 后端)
- **serialport 4.9.0** — 串口通信
- **glam 0.32.1** — 线性代数
- **crc 3.4.0** — CRC 校验
- **crossbeam-channel 0.5.15** — 无锁消息通道

View File

@@ -0,0 +1,35 @@
# 质量契约 (Quality Contract)
## 概述
本文档定义 eskin-model-player 项目的质量标准和交付要求。
## 门控检查
### Pre-commit提交前
| 检查项 | 命令 | 必须通过 |
|--------|------|----------|
| 类型检查 | `cargo check` | ✅ |
| Lint | `cargo clippy -- -D warnings` | ✅ |
| 单元测试 | `cargo test` | ✅ |
### Pre-push推送前
| 检查项 | 命令 | 必须通过 |
|--------|------|----------|
| Release 构建 | `cargo build --release` | ✅ |
| 完整测试 | `cargo test --all` | ✅ |
### 代码审查规则
- ❌ 禁止裸 `unwrap()` — 使用 `expect("原因")``?` 运算符
- ❌ 禁止 `todo!()` / `unimplemented!()` — 生产代码必须完整实现
## 质量指标
| 指标 | 标准 |
|------|------|
| 圈复杂度 | ≤ 15 |
| 文件行数 | ≤ 500 行 |
| 函数行数 | ≤ 80 行 |
## 交付承诺
1. **诚实交付**:所有验证必须真实运行,未验证项必须明确列出
2. **逐步验证**:每完成一步,运行相关验证命令
3. **知识沉淀**:将经验写入 AGENTS.md 和 TOOLS.md

187
docs/workflow/README.md Normal file
View File

@@ -0,0 +1,187 @@
# . Workflow
Governance mode: standard
Governance pack: standard
## Task Levels
| Level | Use for | Required artifacts |
| --- | --- | --- |
| S | typo, comments, small local edits | relevant validation only |
| M | bug fixes, new APIs, 2-5 files | explore, skill plan, plan, verification, review, summary |
| L | cross-module or architecture changes | full artifacts plus human confirmation |
| CRITICAL | auth, permissions, migrations, production config | rollback plan, security review, full verification |
## Standard Task Directory
```text
.planning/tasks/<yyyy-mm-dd>-<task-slug>/
├── explore.md
├── mini-prd.md
├── plan.md
├── runtime.md
├── reality-check.md
├── resource-cleanup.md
├── verification.md
├── review.md
├── summary.md
├── artifact-manifest.json
└── artifacts/
├── index.html
└── release-report.html
```
## Verification
Use service-aware verification when configured:
```bash
scale preflight --service all
scale preflight --service all --preflight-profile full
scale verify <task-id> --profile default
scale verify <task-id> --service <service-name>
scale verify <task-id> --artifact-gate warn
scale verify <task-id> --artifact-gate block
scale verify <task-id> --require-installed-skills
scale verify <task-id> --profile productSmoke
scale task-artifacts check --dir .planning/tasks/<task-dir> --level L
scale artifact render --task-id <task-dir> --type release-report
scale artifact doctor --task-id <task-dir>
```
Keep `.scale/verification.json` as the source of truth for profiles and service commands.
Keep `.scale/skills.json` as the source of truth for active skill routing policy.
Keep `.scale/output-policy.json` as the source of truth for derived HTML artifact types, source Markdown mapping, security policy, and Git retention behavior.
Keep `.scale/resource-policy.json` and `.scale/assets.json` as the source of truth for generated reports, temporary files, module documentation, media, reusable scripts, and Git retention policy.
Keep `.scale/engineering-standards.json` and `.scale/frameworks.json` as the source of truth for logging, security, ORM, architecture, framework, UI/UX, testing, and coding standard checks.
Keep `.scale/engineering-standards-baseline.json` as the temporary exception list for known legacy standards findings; it must not be used to hide new or changed-file problems.
Use `artifactGate: "warn"` while introducing the workflow, then move M/L/CRITICAL work to `"block"` once templates and local gates are stable.
## Workflow Upgrade
Do not rerun `scale init` as a blind upgrade command. Generated governance files may contain local project adaptations.
Use the guarded upgrade flow:
```bash
scale upgrade check --dir .
scale upgrade plan --dir . --html
scale upgrade apply --dir . --confirm
scale upgrade rollback --dir .
scale tools outdated --dir .
scale skill outdated --dir .
scale preflight --preflight-profile quick
```
Rules:
- `.scale/governance.lock.json` records generated file hashes and pack versions.
- Clean or missing generated files can be planned safely.
- Locally changed generated files require manual review before replacement or merge.
- `scale upgrade apply --confirm` only restores missing generated files and refreshes the lock after writing `.scale/backups/upgrade-*/manifest.json`.
- `scale upgrade rollback` only rolls back the latest SCALE-managed safe apply.
- Third-party skills, MCP servers, browser tools, desktop automation, and external CLI tools are never auto-installed by the upgrade flow.
- Community sources require source, install script, permission, and changelog review. Desktop automation is treated as high risk.
## HTML Artifacts
Markdown remains the editable source of truth for task artifacts. HTML artifacts are derived human-review surfaces for plan comparison, implementation plans, code reviews, status reports, incident reports, and release reports.
Use HTML when a human needs to compare, review, or sign off. Keep source Markdown, manifest metadata, and safety checks in place so the derived HTML stays traceable and does not leak secrets or remote scripts.
## Active Skill Routing
SCALE plans required skills from task description, service selection, and changed files. UI/API work requires a Mini-PRD plus domain evidence such as `ui-spec.md`, `visual-review.md`, or `api-contract.md`. Security and database work require explicit review or rollback artifacts.
Tool orchestration is part of the workflow contract:
- UI/UX work requires `frontend-design` and `ui-ux-pro-max`, and should consider `awesome-design-md`, browser screenshots, responsive checks, and visual review evidence.
- Web research, logged-in pages, and dynamic browser work require `web-access` evidence, source citations, and browser/network/console evidence when available.
- Browser E2E work should combine `webapp-testing`, Playwright, Agent Browser, web-access, or Chrome DevTools MCP according to the target and record screenshots plus console/network findings.
- Desktop or client-side GUI automation uses CUA/computer-use only with explicit operator-safety notes, desktop screenshots, and a side-effect boundary.
- External agent or CLI orchestration such as Codex, Gemini CLI, OpenCode, WPS, or WeChat automation must record version checks, exact commands, output summaries, and dry-run or safe-mode evidence.
When a task records `servicesTouched`, `scale verify <task-id>` uses those services automatically. You can still override selection with `--service all`, `--service api`, or `--service api,gateway`.
Before M/L work, check whether required workflow skills are physically installed:
```bash
scale skill doctor --json
scale skill check --require-installed --json
```
## Workspace Lifecycle
Before finishing an agent-created branch or deleting a temporary worktree, inspect root and child repository state:
```bash
scale workspace status --json
scale workspace finish --summary
scale workspace finish --json
scale workspace cleanup --dir <temporary-worktree> --dry-run --json
scale workspace cleanup --dir <temporary-worktree> --apply --confirm <branch-or-head> --json
```
Do not remove a temporary worktree while any submodule or nested repository has uncommitted or unpushed work. Child repositories must be committed and reviewed in their own remotes, then the root repository can record any required pointer or governance updates. Cleanup defaults to dry-run. Applying cleanup requires the reported confirmation token, normally the temporary branch name.
Use `scale ship <task-id>` for governed commits. It checks MOE/submodule child repository state before staging reviewed root files, so dirty or unpushed child work cannot be hidden inside a root commit. It also enforces the GitLab Flow branch lifecycle: work happens on short branches, merges target `dev`, production lands on `master`, and release publishing is triggered by user-created `vX.Y.Z` tags. Direct governed commits on `dev`, `master`, `main`, or detached HEAD are blocked. Raw `git add .` is outside the governed path and must not be used for MOE releases.
## Resource Governance
Use asset scanning before committing generated reports, media, temporary scripts, or long-lived documentation changes:
```bash
scale assets scan --json
scale assets doctor --json
scale assets settle --task-id <task-id> --artifact-dir .planning/tasks/<task-dir>
```
Default policy:
- maintained module docs, standards, contracts, ADRs, reusable scripts: commit and keep current.
- task planning, verification, runtime-contract, reality-check, and cleanup artifacts: keep in `.planning/tasks`; promote final truth to maintained docs when useful.
- screenshots, videos, E2E reports, coverage, temporary scripts, and runtime logs: keep out of Git unless explicitly promoted.
- large media: use Git LFS or external artifact storage instead of normal Git history.
## Engineering Standards
Use standards scanning before reviewing or shipping M/L/CRITICAL work:
```bash
scale standards scan --json
scale standards doctor --json
scale standards doctor --changed --json
scale standards doctor --changed-files src/example.ts,src/example.test.ts --json
scale standards baseline --write --artifact-dir .planning/tasks/<task-dir> --task-id <task-id> --json
scale standards settle --task-id <task-id> --artifact-dir .planning/tasks/<task-dir>
scale preflight --preflight-profile full --json
scale verify <task-id> --json
```
Default policy:
- ad-hoc console/output logging is allowed only for CLI/script paths.
- sensitive fields such as token, password, secret, authorization, cookie, and credentials must not be logged.
- hardcoded secret-like assignments are blocked before review or release.
- SQL must use parameterized queries, ORM bind parameters, or safe query builders.
- unsafe HTML sinks, dynamic code execution, empty catch blocks, and type suppressions require remediation before release.
- framework and architecture rules live in `.scale/frameworks.json` and module standards docs.
- `.scale/frameworks.json > bannedImports` blocks direct use of deprecated ORMs, unsafe SDKs, or off-system UI components.
- `.scale/frameworks.json > lastReviewedAt/reviewIntervalDays` warns when module framework decisions need review.
- `.scale/engineering-standards.json > blockingRules` promotes selected warning rule IDs to release-blocking findings.
- `.scale/engineering-standards.json > allowedFindingPatterns` allows narrow rule/path/evidence exceptions without hiding unrelated findings in the same file.
- `.scale/engineering-standards-baseline.json` may hold known legacy findings during rollout, but normal task gates should prefer `--changed` or `--changed-files` so new work is blocked without forcing a whole-repo cleanup.
- `.scale/verification.json > policy.engineeringStandardsGate` controls whether preflight and task verification treat standards as `off`, `warn`, or `block`.
- `.scale/product-smoke.json` defines real product-path probes. Use it to prove a routed user/business flow, not only build, unit tests, or `/health`.
- `.scale/verification.json > policy.productSmokeGate` controls whether missing or failed product smoke evidence warns or blocks M/L/CRITICAL delivery.
- Full standards scans are for release readiness, scheduled remediation, and architecture cleanup. Changed-file scans are the default for day-to-day feature and bug branches.
- Use `scale standards baseline --write` only during an explicit rollout or remediation planning task. It writes the machine-readable baseline and a `standards-legacy-debt.md` classification report for staged cleanup.
## Automation Templates
Optional automation templates are generated under `docs/workflow/templates/`:
- `github-actions-scale-preflight.yml`: CI workflow that runs `scale preflight --service all --preflight-profile ci`.
- `pre-push-scale-preflight.sh`: local pre-push hook template that runs the default quick preflight.
Keep these templates advisory until `scale preflight --service all --preflight-profile full` is reliable locally for the project.

View File

@@ -0,0 +1,29 @@
# API Contract
## Endpoint Or Interface
TBD
## Request
TBD
## Response
TBD
## Errors
TBD
## Permission Rules
TBD
## Compatibility Notes
TBD
## Acceptance Criteria
- [ ] TBD

View File

@@ -0,0 +1,23 @@
# Architecture Review
## Scope
- Modules touched:
- Public contracts touched:
- Data flow touched:
## Boundary Checks
- [ ] API/controller layer does not bypass service/usecase layer
- [ ] Domain layer is not coupled to infrastructure details
- [ ] Repository/ORM usage follows project conventions
- [ ] Shared framework components are reused instead of duplicated
- [ ] New abstractions remove real complexity
## Risks
- TBD
## Decision
- Approved/changes required:

View File

@@ -0,0 +1,20 @@
# DB Change Plan
## Schema Or Data Change
TBD
## Backward Compatibility
TBD
## Migration Steps
TBD
## Rollback Plan
TBD
## Verification
TBD

View File

@@ -0,0 +1,17 @@
# Docs Impact
## Code Changes Requiring Docs
- TBD
## Documentation Updated
- TBD
## No-Docs-Needed Rationale
TBD
## Links Checked
- TBD

View File

@@ -0,0 +1,20 @@
# E2E Plan
## User Paths
TBD
## Browser Coverage
TBD
## Test Data
TBD
## Assertions
TBD
## Evidence
TBD

View File

@@ -0,0 +1,20 @@
# Explore
## Files Read
- TBD
## Current Behavior
TBD
## Main Conflict
TBD
## Affected Modules
TBD
## Evidence
TBD

View File

@@ -0,0 +1,32 @@
name: SCALE Preflight
on:
pull_request:
push:
branches:
- main
- master
jobs:
preflight:
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: Install project dependencies when present
shell: bash
run: |
if [ -f package-lock.json ]; then
npm ci
elif [ -f package.json ]; then
npm install
fi
- name: Run SCALE preflight
run: npx @hongmaple0820/scale-engine@latest preflight --service all --preflight-profile ci

View File

@@ -0,0 +1,42 @@
# Mini-PRD
## Background
TBD
## Target Users
TBD
## Core Scenario
TBD
## Non-Goals
TBD
## User Path
TBD
## Permission Rules
TBD
## Data Impact
TBD
## Exception Scenarios
1. TBD
2. TBD
3. TBD
## Acceptance Criteria
- [ ] TBD
## Rollback Or Disable Strategy
TBD

View File

@@ -0,0 +1,28 @@
# Plan
## Approach
TBD
## Boundaries
TBD
## Exception Contract
1. TBD
2. TBD
3. TBD
## Rollback Plan
TBD
## Human Confirmation
- Required for L/CRITICAL tasks:
- Confirmation source:
- Execution boundary approved:
## Test Strategy
TBD

View File

@@ -0,0 +1,8 @@
#!/usr/bin/env sh
set -eu
if command -v scale >/dev/null 2>&1; then
scale preflight --service all
else
npx @hongmaple0820/scale-engine@latest preflight --service all
fi

View File

@@ -0,0 +1,61 @@
# Product Smoke
## Real Product Path
Describe the smallest end-to-end path that proves the change works through the real product boundary.
Example:
```text
UI or client -> gateway/router -> service -> database/storage/queue -> observable result
```
Do not use a green health endpoint as the only proof when the user-facing path depends on routing, authentication, storage, async tasks, browser behavior, or third-party integration.
## Quick Setup
1. Open `.scale/product-smoke.json`.
2. Replace the example command with one real product path command.
3. Set that probe's `enabled` field to `true`.
4. Run `scale preflight --profile productSmoke --json`.
5. Run `scale runtime final-check --level M --json`.
`status: "skipped"` means no real product path was exercised. It does not count as completion evidence.
## Setup
- Base URL:
- Test user or tenant:
- Required fixtures:
- Services that must be running:
## Smoke Commands
| Command | Expected Result | Evidence Artifact |
| --- | --- | --- |
| TBD | TBD | TBD |
## Runtime Evidence
Record at least one runtime evidence item:
```bash
scale runtime record \
--kind command \
--title "Product smoke: <flow>" \
--status passed \
--command "<exact smoke command>" \
--exit-code 0 \
--summary "<business result, task id, status, or observable output>" \
--artifacts ".agent/logs/<service>/<smoke>.json" \
--metadata-json '{"productSmoke":true,"realProductPath":true}'
```
## Assertions
- [ ] Request crossed the real product boundary, not only an isolated unit.
- [ ] Authentication or user identity path was exercised when relevant.
- [ ] Persistence/storage/queue side effect was verified when relevant.
- [ ] Async task or eventual state was polled to terminal status when relevant.
- [ ] Failure output is specific enough to diagnose the failing layer.
- [ ] Runtime artifacts are ignored or deliberately promoted according to resource governance.

View File

@@ -0,0 +1,25 @@
# Reality Check
## Confirmed
- TBD
## Not Verified
- TBD
## Stub / Fake / Partial
- TBD
## Credential-Gated
- TBD
## Environment-Gated
- TBD
## User-Visible Risk
- TBD

View File

@@ -0,0 +1,14 @@
# Resource Cleanup
## New Resources
| Resource | Location | Keep / Move / Delete | Reason |
| --- | --- | --- | --- |
| TBD | TBD | TBD | TBD |
## Docs Promotion
- Promote to docs:
- Keep in planning:
- Keep local/runtime only:
- Delete before handoff:

View File

@@ -0,0 +1,25 @@
# Resource Impact
## Resources Created
| Path | Type | Git Policy | Retention |
| --- | --- | --- | --- |
| TBD | canonical-doc/task-artifact/evidence-report/temporary/reusable-script/generated-media/contract/decision-record | commit/ignore/lfs/external/review | TBD |
## Resources Updated
- TBD
## Resources Promoted To Maintained Docs
- TBD
## Resources To Delete Or Archive Before Finish
- TBD
## Source Of Truth Updates
- [ ] .scale/resource-policy.json
- [ ] .scale/assets.json
- [ ] docs/modules/<module>/README.md

View File

@@ -0,0 +1,16 @@
# Review
## Code Review
TBD
## Security Review
TBD
## Same-Pattern Scan
TBD
## Residual Risks
TBD

View File

@@ -0,0 +1,21 @@
# Runtime Contract
## Configuration Source
- Source: TBD
- Environment/profile: TBD
- Runtime overrides: TBD
- Secrets boundary: TBD
## Service Topology
| Service | URL Or Command | Config Source | Auth Mode | Status |
| --- | --- | --- | --- | --- |
| TBD | TBD | TBD | TBD | Not checked |
## Verification Boundary
- Confirmed:
- Not covered:
- Credential-gated:
- Environment-gated:

View File

@@ -0,0 +1,26 @@
# Security Review
## Assets And Trust Boundaries
TBD
## Authorization Rules
TBD
## Abuse Cases
1. TBD
2. TBD
3. TBD
## Sensitive Data Impact
TBD
## Rollback Or Disable Strategy
TBD
## Final Verdict
TBD

View File

@@ -0,0 +1,33 @@
# Skill Evidence
## Planned Skills
- TBD
## Tool Selection Rationale
TBD
## Used Skills
| Skill | Phase | Trigger | Evidence | Status |
| --- | --- | --- | --- | --- |
| skill-id | plan/build/verify/review | why it was selected | command, screenshot, report, or artifact path | executed/skipped/fallback |
## Browser Or Web Evidence
| Tool | Target | Evidence | Result |
| --- | --- | --- | --- |
| web-access/agent-browser/Chrome DevTools MCP | URL or local target | screenshot, console log, network finding, source URL | passed/failed/skipped |
## Desktop Or External CLI Evidence
| Tool | Scope | Safety Boundary | Evidence | Result |
| --- | --- | --- | --- | --- |
| cua/codex/gemini/opencode/wps/wechat | command or app target | read-only/dry-run/test account/manual approval | output summary, screenshot, or report path | passed/failed/skipped |
## Skipped Skills
| Skill | Reason | Fallback Evidence |
| --- | --- | --- |
| skill-id | why it could not run | manual review, alternate command, or explicit risk |

View File

@@ -0,0 +1,39 @@
# Skill Plan
## Detected Intents
| Domain | Score | Evidence |
| --- | ---: | --- |
| | | |
## Required Skills
- TBD
## Recommended Skills
- TBD
## Required Artifacts
- TBD
## Required Verification Evidence
- TBD
## Tool Orchestration
| Capability | Primary Tool Or Skill | Fallback | Required Evidence |
| --- | --- | --- | --- |
| UI/UX design | frontend-design, ui-ux-pro-max | awesome-design-md | design-system, ui-spec.md, visual-review.md |
| Web research or logged-in pages | web-access | agent-browser, Chrome DevTools MCP | source citations, browser evidence |
| Browser E2E | webapp-testing, Playwright | agent-browser, web-access | screenshot, console, network evidence |
| Desktop GUI automation | CUA/computer-use | manual verification | desktop screenshot, operator-safety notes |
| External agent CLI | codex/gemini/opencode CLI | manual review | version check, exact command output |
## Skipped Skills
| Skill | Reason | Fallback Evidence |
| --- | --- | --- |
| | | |

View File

@@ -0,0 +1,28 @@
# Standards Impact
## Standards Checked
- [ ] Logging and redaction
- [ ] Architecture boundaries
- [ ] ORM/database access
- [ ] Framework/component conventions
- [ ] UI/UX acceptance where user-facing
- [ ] Test and verification rigor
- [ ] Security-sensitive inputs and outputs
## Findings
| Severity | Rule | Path | Decision |
| --- | --- | --- | --- |
| TBD | TBD | TBD | fix/accept/escalate |
## Policy Updates
- [ ] .scale/engineering-standards.json
- [ ] .scale/frameworks.json
- [ ] docs/standards/
## Settlement
- Standards scan:
- Standards doctor:

View File

@@ -0,0 +1,19 @@
# Summary
## Delivered Changes
TBD
## Remaining Risks
TBD
## Follow-Ups
TBD
## Metric Row
| Date | Task | Level | Services | Files Changed | First Verification Pass | Fix Iterations | Artifact Complete | Residual Risk | Final Gate |
| --- | --- | --- | --- | ---: | --- | ---: | --- | --- | --- |
| | | | | | | | | | |

View File

@@ -0,0 +1,29 @@
# UI Spec
## User Goal
TBD
## Primary Flow
TBD
## Interaction States
- Default:
- Loading:
- Empty:
- Error:
- Success:
## Responsive Behavior
TBD
## Accessibility Requirements
TBD
## Acceptance Criteria
- [ ] TBD

View File

@@ -0,0 +1,18 @@
# Verification
## Commands Run
| Command | Result | Notes |
| --- | --- | --- |
| | | |
## Output Summary
TBD
## Failures And Fixes
TBD
## Final Status
TBD

View File

@@ -0,0 +1,20 @@
# Visual Review
## Screenshots Or Evidence
TBD
## Layout And Responsiveness
TBD
## Text Fit And Overlap
TBD
## Accessibility Notes
TBD
## Final Verdict
TBD

28
docs/worklog/metrics.md Normal file
View File

@@ -0,0 +1,28 @@
# Workflow Metrics
<!-- SCALE_METRICS:START -->
| Date | Task | Level | Services | Files Changed | First Verification Pass | Fix Iterations | Rework Needed | Artifact Complete | Residual Risk | Final Gate |
| --- | --- | --- | --- | ---: | --- | ---: | --- | --- | --- | --- |
| | | | | | | | | | | |
<!-- SCALE_METRICS:END -->
## Monthly Review
### Repeated Failure Patterns
TBD
### Slowest Gates
TBD
### Documentation Gaps
TBD
### Product Design Misses
TBD
### Proposed Workflow Changes
TBD

54
scripts/gates/all.sh Executable file
View File

@@ -0,0 +1,54 @@
#!/bin/bash
# scripts/gates/all.sh — 运行所有门控检查
set -e
source ~/.cargo/env 2>/dev/null || true
cd "$(dirname "$0")/../.."
DRY_RUN=false
if [ "$1" = "--dry-run" ]; then
DRY_RUN=true
echo "🔒 门控检查 (dry-run 模式)"
else
echo "🔒 运行门控检查..."
fi
echo ""
run_gate() {
local name="$1"
local cmd="$2"
if [ "$DRY_RUN" = "true" ]; then
echo " ⏭️ $name (跳过, dry-run)"
return 0
fi
echo " 🔍 $name..."
if eval "$cmd" > /dev/null 2>&1; then
echo "$name 通过"
return 0
else
echo "$name 失败"
return 1
fi
}
FAILED=0
run_gate "类型检查 (cargo check)" "cargo check" || FAILED=$((FAILED + 1))
run_gate "Lint (cargo clippy)" "cargo clippy -- -D warnings" || FAILED=$((FAILED + 1))
run_gate "测试 (cargo test)" "cargo test" || FAILED=$((FAILED + 1))
if [ "$DRY_RUN" = "false" ]; then
run_gate "Release 构建" "cargo build --release" || FAILED=$((FAILED + 1))
fi
echo ""
echo "────────────────────────────────────"
if [ $FAILED -gt 0 ]; then
echo "$FAILED 个门控失败"
exit 1
else
echo "✅ 所有门控通过"
exit 0
fi

View File

@@ -0,0 +1,107 @@
# Product smoke probe runner generated by scale-engine.
$ErrorActionPreference = "Stop"
$Root = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).Path
$ConfigPath = Join-Path $Root ".scale\product-smoke.json"
$LogDir = Join-Path $Root ".agent\logs"
$LogPath = Join-Path $LogDir "product-smoke.json"
New-Item -ItemType Directory -Force -Path $LogDir | Out-Null
$NodeProgram = @'
const fs = require('fs');
const cp = require('child_process');
const path = require('path');
const configPath = process.argv[2];
const logPath = process.argv[3];
function writeReport(report) {
fs.mkdirSync(path.dirname(logPath), { recursive: true });
fs.writeFileSync(logPath, JSON.stringify(report, null, 2) + '\n', 'utf8');
process.stdout.write(JSON.stringify(report, null, 2) + '\n');
}
if (!fs.existsSync(configPath)) {
writeReport({
version: 1,
status: 'failed',
verifiedAt: new Date().toISOString(),
message: 'Missing .scale/product-smoke.json',
results: []
});
process.exit(1);
}
const config = JSON.parse(fs.readFileSync(configPath, 'utf8').replace(/^\uFEFF/, ''));
const probes = Array.isArray(config.probes) ? config.probes.filter(probe => probe && probe.enabled === true) : [];
if (probes.length === 0) {
const status = config.emptyProbeBehavior === 'block' ? 'failed' : 'skipped';
writeReport({
version: 1,
status,
verifiedAt: new Date().toISOString(),
message: 'No enabled product smoke probes. Enable probes in .scale/product-smoke.json after defining the real product path.',
results: []
});
process.exit(status === 'failed' ? 1 : 0);
}
const results = probes.map((probe) => {
const startedAt = new Date().toISOString();
const expectedExitCode = Number.isInteger(probe.expected && probe.expected.exitCode) ? probe.expected.exitCode : 0;
const command = String(probe.command || '');
if (!command.trim()) {
return {
id: String(probe.id || 'unnamed-probe'),
description: String(probe.description || ''),
command,
expectedExitCode,
exitCode: 1,
status: 'failed',
startedAt,
endedAt: new Date().toISOString(),
outputTail: 'Probe command is empty'
};
}
const result = cp.spawnSync(command, {
cwd: process.cwd(),
shell: true,
encoding: 'utf8',
timeout: Number(config.timeoutMs || 180000)
});
const output = String(result.stdout || '') + String(result.stderr || '') + String(result.error ? result.error.message : '');
const exitCode = typeof result.status === 'number' ? result.status : 1;
return {
id: String(probe.id || 'unnamed-probe'),
description: String(probe.description || ''),
command,
expectedExitCode,
exitCode,
status: exitCode === expectedExitCode ? 'passed' : 'failed',
startedAt,
endedAt: new Date().toISOString(),
outputTail: output.length > 2000 ? output.slice(-2000) : output
};
});
const failed = results.filter(result => result.status !== 'passed');
writeReport({
version: 1,
status: failed.length === 0 ? 'passed' : 'failed',
verifiedAt: new Date().toISOString(),
results
});
process.exit(failed.length === 0 ? 0 : 1);
'@
$TempFile = [System.IO.Path]::GetTempFileName() + ".js"
Set-Content -Path $TempFile -Value $NodeProgram -Encoding UTF8
try {
node $TempFile $ConfigPath $LogPath
exit $LASTEXITCODE
} finally {
Remove-Item -Force $TempFile -ErrorAction SilentlyContinue
}

98
scripts/qa/product-smoke.sh Executable file
View File

@@ -0,0 +1,98 @@
#!/usr/bin/env sh
set -eu
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
CONFIG_PATH="$ROOT/.scale/product-smoke.json"
LOG_DIR="$ROOT/.agent/logs"
LOG_PATH="$LOG_DIR/product-smoke.json"
mkdir -p "$LOG_DIR"
node - "$CONFIG_PATH" "$LOG_PATH" <<'NODE'
const fs = require('fs');
const cp = require('child_process');
const path = require('path');
const configPath = process.argv[2];
const logPath = process.argv[3];
function writeReport(report) {
fs.mkdirSync(path.dirname(logPath), { recursive: true });
fs.writeFileSync(logPath, JSON.stringify(report, null, 2) + '\n', 'utf8');
process.stdout.write(JSON.stringify(report, null, 2) + '\n');
}
if (!fs.existsSync(configPath)) {
writeReport({
version: 1,
status: 'failed',
verifiedAt: new Date().toISOString(),
message: 'Missing .scale/product-smoke.json',
results: []
});
process.exit(1);
}
const config = JSON.parse(fs.readFileSync(configPath, 'utf8').replace(/^\uFEFF/, ''));
const probes = Array.isArray(config.probes) ? config.probes.filter(probe => probe && probe.enabled === true) : [];
if (probes.length === 0) {
const status = config.emptyProbeBehavior === 'block' ? 'failed' : 'skipped';
writeReport({
version: 1,
status,
verifiedAt: new Date().toISOString(),
message: 'No enabled product smoke probes. Enable probes in .scale/product-smoke.json after defining the real product path.',
results: []
});
process.exit(status === 'failed' ? 1 : 0);
}
const results = probes.map((probe) => {
const startedAt = new Date().toISOString();
const expectedExitCode = Number.isInteger(probe.expected && probe.expected.exitCode) ? probe.expected.exitCode : 0;
const command = String(probe.command || '');
if (!command.trim()) {
return {
id: String(probe.id || 'unnamed-probe'),
description: String(probe.description || ''),
command,
expectedExitCode,
exitCode: 1,
status: 'failed',
startedAt,
endedAt: new Date().toISOString(),
outputTail: 'Probe command is empty'
};
}
const result = cp.spawnSync(command, {
cwd: process.cwd(),
shell: true,
encoding: 'utf8',
timeout: Number(config.timeoutMs || 180000)
});
const output = String(result.stdout || '') + String(result.stderr || '') + String(result.error ? result.error.message : '');
const exitCode = typeof result.status === 'number' ? result.status : 1;
return {
id: String(probe.id || 'unnamed-probe'),
description: String(probe.description || ''),
command,
expectedExitCode,
exitCode,
status: exitCode === expectedExitCode ? 'passed' : 'failed',
startedAt,
endedAt: new Date().toISOString(),
outputTail: output.length > 2000 ? output.slice(-2000) : output
};
});
const failed = results.filter(result => result.status !== 'passed');
writeReport({
version: 1,
status: failed.length === 0 ? 'passed' : 'failed',
verifiedAt: new Date().toISOString(),
results
});
process.exit(failed.length === 0 ? 0 : 1);
NODE

8
scripts/tests/run.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
# scripts/tests/run.sh — 运行测试
set -e
echo "🧪 运行测试..."
source ~/.cargo/env 2>/dev/null || true
cd "$(dirname "$0")/../.."
cargo test 2>&1
echo "✅ 测试完成"

65
scripts/validate-config.sh Executable file
View File

@@ -0,0 +1,65 @@
#!/bin/bash
# validate-config.sh — 验证 SCALE OS 配置完整性
set -e
echo "🔍 验证 SCALE OS 配置..."
echo ""
PASS=0
FAIL=0
WARN=0
check() {
local name="$1"
local path="$2"
local required="$3"
if [ -e "$path" ]; then
echo "$name"
PASS=$((PASS + 1))
elif [ "$required" = "true" ]; then
echo "$name (缺失: $path)"
FAIL=$((FAIL + 1))
else
echo " ⚠️ $name (可选, 缺失: $path)"
WARN=$((WARN + 1))
fi
}
echo "📁 项目级文件:"
check "AGENTS.md" "AGENTS.md" "true"
check "TOOLS.md" "TOOLS.md" "true"
check ".openclaw/settings.json" ".openclaw/settings.json" "true"
echo ""
echo "📁 SCALE 配置:"
check ".scale/ 目录" ".scale" "true"
check "workflow.json" ".scale/workflow.json" "true"
check "quality-contract.json" ".scale/quality-contract.json" "true"
check "skills-registry.json" ".scale/skills-registry.json" "true"
check "verification.json" ".scale/verification.json" "true"
check "skills.json" ".scale/skills.json" "true"
check "tools.json" ".scale/tools.json" "true"
check ".gitignore" ".scale/.gitignore" "true"
echo ""
echo "📁 工作流模板:"
check "docs/workflow/ 目录" "docs/workflow" "true"
check "QUALITY_CONTRACT.md" "docs/workflow/QUALITY_CONTRACT.md" "true"
echo ""
echo "📁 验证脚本:"
check "scripts/validate-config.sh" "scripts/validate-config.sh" "true"
check "scripts/qa/product-smoke.sh" "scripts/qa/product-smoke.sh" "true"
echo ""
echo "────────────────────────────────────"
echo "结果: ✅ $PASS 通过 | ❌ $FAIL 失败 | ⚠️ $WARN 警告"
if [ $FAIL -gt 0 ]; then
echo "❌ 配置验证失败"
exit 1
else
echo "✅ 配置验证通过"
exit 0
fi

29
scripts/workflow/verify.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/bash
# scripts/workflow/verify.sh — 验证工作流配置
set -e
cd "$(dirname "$0")/../.."
PROFILE="${1:-default}"
echo "📋 验证工作流 (profile: $PROFILE)..."
# 检查 workflow.json
if [ ! -f ".scale/workflow.json" ]; then
echo "❌ 缺少 .scale/workflow.json"
exit 1
fi
# 检查 quality-contract.json
if [ ! -f ".scale/quality-contract.json" ]; then
echo "❌ 缺少 .scale/quality-contract.json"
exit 1
fi
# 检查模板文件
TEMPLATE_COUNT=$(ls docs/workflow/templates/*.md 2>/dev/null | wc -l)
echo " 📄 工作流模板: $TEMPLATE_COUNT"
# 验证 JSON 格式
python3 -c "import json; json.load(open('.scale/workflow.json')); print(' ✅ workflow.json 格式正确')"
python3 -c "import json; json.load(open('.scale/quality-contract.json')); print(' ✅ quality-contract.json 格式正确')"
echo "✅ 工作流验证通过"