@hongmaple0820/scale-engine 0.18.0 → 0.19.0

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.
Files changed (77) hide show
  1. package/README.en.md +296 -237
  2. package/README.md +157 -63
  3. package/dist/api/cli.js +448 -27
  4. package/dist/api/cli.js.map +1 -1
  5. package/dist/api/doctor.d.ts +4 -1
  6. package/dist/api/doctor.js +85 -1
  7. package/dist/api/doctor.js.map +1 -1
  8. package/dist/api/quickstart.d.ts +3 -0
  9. package/dist/api/quickstart.js +9 -4
  10. package/dist/api/quickstart.js.map +1 -1
  11. package/dist/cli/phaseCommands.js +7 -0
  12. package/dist/cli/phaseCommands.js.map +1 -1
  13. package/dist/index.d.ts +2 -0
  14. package/dist/index.js +4 -0
  15. package/dist/index.js.map +1 -1
  16. package/dist/memory/MemoryFabric.d.ts +118 -0
  17. package/dist/memory/MemoryFabric.js +281 -0
  18. package/dist/memory/MemoryFabric.js.map +1 -0
  19. package/dist/memory/MemoryLearning.d.ts +61 -0
  20. package/dist/memory/MemoryLearning.js +203 -0
  21. package/dist/memory/MemoryLearning.js.map +1 -0
  22. package/dist/memory/index.d.ts +2 -0
  23. package/dist/memory/index.js +3 -0
  24. package/dist/memory/index.js.map +1 -0
  25. package/dist/output/HTMLArtifactLayer.js +31 -31
  26. package/dist/prompts/VibeTemplateGallery.js +121 -121
  27. package/dist/runtime/FinalReportGuard.d.ts +16 -0
  28. package/dist/runtime/FinalReportGuard.js +14 -0
  29. package/dist/runtime/FinalReportGuard.js.map +1 -0
  30. package/dist/runtime/RuntimeDoctor.d.ts +23 -0
  31. package/dist/runtime/RuntimeDoctor.js +151 -0
  32. package/dist/runtime/RuntimeDoctor.js.map +1 -0
  33. package/dist/runtime/RuntimeEvidenceLedger.d.ts +50 -0
  34. package/dist/runtime/RuntimeEvidenceLedger.js +89 -0
  35. package/dist/runtime/RuntimeEvidenceLedger.js.map +1 -0
  36. package/dist/runtime/SessionLedger.d.ts +53 -0
  37. package/dist/runtime/SessionLedger.js +104 -0
  38. package/dist/runtime/SessionLedger.js.map +1 -0
  39. package/dist/runtime/index.d.ts +4 -0
  40. package/dist/runtime/index.js +5 -0
  41. package/dist/runtime/index.js.map +1 -0
  42. package/dist/workflow/EngineeringStandards.js +69 -66
  43. package/dist/workflow/EngineeringStandards.js.map +1 -1
  44. package/dist/workflow/GovernanceTemplatePacks.js +126 -126
  45. package/dist/workflow/GovernanceTemplates.d.ts +1 -1
  46. package/dist/workflow/GovernanceTemplates.js +489 -218
  47. package/dist/workflow/GovernanceTemplates.js.map +1 -1
  48. package/dist/workflow/ResourceGovernance.js +27 -18
  49. package/dist/workflow/ResourceGovernance.js.map +1 -1
  50. package/dist/workflow/VerificationCommands.d.ts +11 -0
  51. package/dist/workflow/VerificationCommands.js +2 -0
  52. package/dist/workflow/VerificationCommands.js.map +1 -1
  53. package/dist/workflow/VerificationProfile.d.ts +2 -1
  54. package/dist/workflow/VerificationProfile.js +3 -0
  55. package/dist/workflow/VerificationProfile.js.map +1 -1
  56. package/dist/workflow/WorkflowArtifactWriter.js +2 -1
  57. package/dist/workflow/WorkflowArtifactWriter.js.map +1 -1
  58. package/dist/workflow/WorkflowEngine.js +4 -1
  59. package/dist/workflow/WorkflowEngine.js.map +1 -1
  60. package/dist/workflow/WorkspaceSafety.d.ts +9 -0
  61. package/dist/workflow/WorkspaceSafety.js +49 -0
  62. package/dist/workflow/WorkspaceSafety.js.map +1 -0
  63. package/dist/workflow/gates/GateSystem.d.ts +12 -1
  64. package/dist/workflow/gates/GateSystem.js +106 -0
  65. package/dist/workflow/gates/GateSystem.js.map +1 -1
  66. package/dist/workflow/types.d.ts +1 -1
  67. package/docs/MEMORY_FABRIC.md +107 -0
  68. package/docs/README.md +68 -0
  69. package/docs/RUNTIME_EVIDENCE.md +101 -0
  70. package/docs/start/README.md +42 -0
  71. package/docs/start/agent-governance-demo.md +107 -0
  72. package/docs/start/quickstart.md +127 -0
  73. package/examples/demo-projects/agent-governance-demo/README.md +37 -0
  74. package/examples/demo-projects/agent-governance-demo/package.json +16 -0
  75. package/examples/demo-projects/agent-governance-demo/src/oauth-state.ts +39 -0
  76. package/examples/demo-projects/agent-governance-demo/tests/oauth-state.test.ts +52 -0
  77. package/package.json +8 -3
package/README.en.md CHANGED
@@ -1,237 +1,296 @@
1
- <p align="center">
2
- <img src="https://img.shields.io/badge/version-0.15.1-orange?style=flat-square" alt="version" />
3
- <img src="https://img.shields.io/badge/platforms-16-blue?style=flat-square" alt="platforms" />
4
- <img src="https://img.shields.io/badge/agents-12-blue?style=flat-square" alt="agents" />
5
- <img src="https://img.shields.io/badge/workflows-10-green?style=flat-square" alt="workflows" />
6
- <img src="https://img.shields.io/badge/detectors-19-red?style=flat-square" alt="detectors" />
7
- <img src="https://img.shields.io/badge/tests-822-passing-brightgreen?style=flat-square" alt="tests" />
8
- <img src="https://img.shields.io/badge/npm-0.15.1-cb3837?style=flat-square&logo=npm" alt="npm" />
9
- </p>
10
-
11
- # SCALE Engine v0.15.1
12
-
13
- SCALE Engine is an AI engineering workflow runtime for agentic coding tools. It turns prompt-level engineering rules into stateful workflow gates, persisted evidence, review records, and release checks.
14
-
15
- Repository: https://github.com/hongmaple0820/scale-engine
16
- Mirror: https://gitee.com/hongmaple/scale-engine
17
- npm: https://www.npmjs.com/package/@hongmaple0820/scale-engine
18
- Language: [English](README.en.md) | [Chinese](README.md)
19
-
20
- ## Why It Exists
21
-
22
- Prompt instructions are advisory. Production engineering needs mechanisms:
23
-
24
- - A model can claim tests passed; SCALE stores verification evidence.
25
- - A model can skip review; SCALE blocks `ship` without persisted review records.
26
- - A model can stage unrelated files; SCALE now stages only reviewed files.
27
- - A model can lose workflow state; SCALE stores artifacts and FSM transitions under `.scale`.
28
-
29
- ## Current Release
30
-
31
- v0.15.1 focuses on production-grade engineering governance templates:
32
-
33
- - Supports MOE and non-MOE workspace topology, child repository blockers, and temporary worktree cleanup candidates.
34
- - Adds resource asset governance for maintained docs, versioned outputs, task evidence, temporary files, and forbidden commit assets.
35
- - Adds engineering standards scans for noisy logs, sensitive data redaction, secure input handling, ORM/database usage, framework conventions, and test rigor.
36
- - Strengthens skill and tool orchestration with routing and evidence contracts for UI/UX, web research, browser E2E, desktop automation, and external Agent CLIs.
37
- - `scale init` / governance packs now generate service matrix, verification profile, artifact templates, metrics, resource policy, engineering standards, and tool orchestration rules.
38
-
39
- Historical v0.11.1 introduced four priority improvements:
40
-
41
- ### Phase Commands FSM Blocking
42
- - `canTransition` + `process.exit(1)` ensures FSM guard failures block execution, not continue
43
- - define/plan/build/verify phases add clear blocking prompts
44
-
45
- ### OWASP Top 10 Detector
46
- - New `OWASPDetector` covers SQL injection, XSS, path traversal, SSRF, Auth Bypass, weak crypto, CORS misconfiguration, CSRF, file upload, sensitive data exposure
47
- - 19 security detection patterns, auto-recognizes regex definitions to avoid false positives
48
-
49
- ### Browser QA Capability
50
- - `BrowserQACapability` wraps Playwright MCP tools
51
- - Supports navigation, click, screenshot, console check, E2E test flows
52
-
53
- ### L6 Evolution Self-Improve Loop
54
- - `LessonExtractor` extracts reusable lessons from session Defect events
55
- - `SelfImproveEngine` implements `Defect Lesson Rule → Hook` promotion pipeline
56
- - New CLI commands: `scale evolution extract/improve/report/hooks`
57
-
58
- ---
59
-
60
- **Complete phase-aligned delivery workflow**:
61
-
62
- - `define -> plan -> build -> verify -> review -> ship`
63
- - FSM-backed artifacts with blocking on guard failures
64
- - Persisted gate evidence and review records
65
- - Deterministic review scanner blocks empty `catch`, `@ts-ignore`, focused tests, dangerous shell/Git commands, and security-sensitive changes without G7 evidence
66
- - OWASP Top 10 security detector extends coverage
67
- - Built-in G7 security scanning records explainable file/line evidence, blocks CRITICAL by default, can block HIGH in strict mode
68
- - Optional strict TDD evidence gate with `--tdd-evidence` and `--tdd-strict`
69
- - `ship --no-commit` delivery reports
70
- - Review-gated release commits
71
- - 16 platform adapters, 12 professional agent profiles
72
- - Browser QA Capability (Playwright MCP)
73
- - Evolution self-improve loop
74
- - 499 Vitest tests passing
75
-
76
- ## Installation
77
-
78
- ```bash
79
- npm install -g @hongmaple0820/scale-engine
80
- scale --version
81
- ```
82
-
83
- Node.js 20 or newer is required.
84
-
85
- ## Phase Workflow
86
-
87
- ```bash
88
- scale define "Scoped release workflow" \
89
- --description "Implement a TypeScript CLI workflow with verification evidence, review records, rollback constraints, and release safety checks." \
90
- --success-criteria "verify evidence is persisted,review evidence is persisted,ship blocks unreviewed files"
91
-
92
- scale plan <spec-id> --rollback "Revert the release commit and remove generated artifacts"
93
- scale build <plan-id> --description "Implement scoped release workflow"
94
- scale verify <task-id>
95
- scale review <task-id>
96
- scale ship <task-id> --message "feat(workflow): add scoped release workflow"
97
- ```
98
-
99
- Use `scale ship <task-id> --no-commit` to generate the delivery report without creating a Git commit.
100
-
101
- Strict TDD evidence can be enforced when needed:
102
-
103
- ```bash
104
- scale verify <task-id> --tdd-strict --tdd-evidence .scale/tdd/<task-id>.json
105
- ```
106
-
107
- The TDD evidence JSON must include `red`, `green`, `refactor`, and `testFirst` set to `true`.
108
-
109
- ## Evolution Self-Improve Loop
110
-
111
- Extract lessons from session defects and promote to rules and hooks:
112
-
113
- ```bash
114
- # Extract Lessons from session
115
- scale evolution extract <session-id>
116
-
117
- # Run self-improve loop: Defect → Lesson → Rule → Hook
118
- scale evolution improve <session-id>
119
-
120
- # Show self-improve report
121
- scale evolution report <session-id>
122
-
123
- # View generated Hooks config
124
- scale evolution hooks <session-id> --json
125
- ```
126
-
127
- Thresholds:
128
- - Lesson → Rule: requires 3 verifications
129
- - Rule Active: requires 10 hits
130
- - Rule Hook: requires 20 hits
131
-
132
- ## Safety Model
133
-
134
- SCALE Engine uses multiple enforcement layers:
135
-
136
- | Layer | Purpose |
137
- | --- | --- |
138
- | FSM | Prevents invalid artifact lifecycle transitions |
139
- | GateSystem | Runs build, lint, test, coverage, and security gates |
140
- | EvidenceStore | Persists verification evidence for audit and release gating |
141
- | ReviewStore | Persists deterministic review records |
142
- | ReviewAnalyzer | Scans diffs for high-risk code, process debt, and missing security evidence |
143
- | Detectors | Detects brute retry, premature completion, blame shifting, busy loops, and related failure modes |
144
- | Ship gate | Requires passing verification and review evidence before release |
145
-
146
- The `ship` command no longer stages the whole workspace. It stages only files covered by passing review records and blocks if new reviewable files appear after review.
147
-
148
- G7 `SecurityGate` includes a lightweight built-in scan for hardcoded secrets, private keys, disabled TLS verification, `eval`/`Function`, raw HTML injection, dangerous shell commands, shell execution, and empty `catch` blocks. Compatibility mode blocks CRITICAL findings; strict mode also blocks HIGH findings.
149
-
150
- ## Supported Platforms
151
-
152
- SCALE Engine includes adapters for 16 agent platforms, including Claude Code, Codex CLI, OpenCode, Cursor, Gemini CLI, OpenClaw, Hermes, Trae, WorkBuddy, VS Code Copilot CLI, QCoder, DeepSeek-TUI, Aider, Windsurf, Kimi, and Doubao.
153
-
154
- It also includes 12 professional agent profiles:
155
-
156
- - frontend
157
- - backend
158
- - testing
159
- - UI design
160
- - operations
161
- - product
162
- - code review
163
- - security
164
- - database
165
- - performance
166
- - documentation
167
- - architecture
168
-
169
- ## Project Layout
170
-
171
- ```text
172
- src/api/cli.ts CLI entrypoint
173
- src/cli/phaseCommands.ts DEFINE/PLAN/BUILD/VERIFY/REVIEW/SHIP
174
- src/cli/evolutionCommands.ts L6 Evolution CLI commands
175
- src/workflow/gates/ Quality gates and persisted evidence
176
- src/workflow/ReviewAnalyzer.ts Deterministic review analysis
177
- src/workflow/ReviewStore.ts Review record persistence
178
- src/workflow/EvidenceStore.ts Gate evidence persistence
179
- src/workflow/evolution/ LessonExtractor + SelfImproveEngine
180
- src/workflow/qa/ BrowserQA + E2ETestRunner
181
- src/artifact/ Artifact store and FSM definitions
182
- src/guardrails/ Detector and gateway logic
183
- src/guardrails/OWASPDetector.ts OWASP Top 10 security detection
184
- src/capabilities/BrowserQACapability.ts Playwright MCP wrapper
185
- src/evolution/ Defect/Lesson/Rule/Hook evolution layer
186
- tests/ Vitest test suites (499 tests)
187
- ```
188
-
189
- ## Development
190
-
191
- ```bash
192
- npm install
193
- npm run build
194
- npx vitest run
195
- npm pack --dry-run
196
- ```
197
-
198
- Targeted workflow tests:
199
-
200
- ```bash
201
- npx vitest run tests/workflow/phaseCli.test.ts
202
- npx vitest run tests/workflow/reviewAnalyzer.test.ts tests/workflow/reviewStore.test.ts tests/workflow/gateSystem.test.ts
203
- ```
204
-
205
- ## Release Notes
206
-
207
- ### v0.11.1
208
-
209
- - Phase Commands FSM blocking: `canTransition` + `process.exit(1)` for guard failures
210
- - OWASP Top 10 Detector: 19 security detection patterns
211
- - Browser QA Capability: Playwright MCP wrapper for E2E testing
212
- - L6 Evolution: `Defect → Lesson → Rule → Hook` self-improve loop
213
- - Evolution CLI: `scale evolution extract/improve/report/hooks`
214
- - ReviewAnalyzer regex fix: avoid false positives on pattern definitions
215
- - 499 tests passing
216
-
217
- ### v0.10.1
218
-
219
- - Hardened `ship` so release commits stage only files covered by passing review records.
220
- - Added `ship --no-commit` delivery reports for reviewable output without creating a Git commit.
221
- - Added optional strict TDD evidence verification with `--tdd-evidence` and `--tdd-strict`.
222
- - Added richer command evidence metadata: working directory, timestamps, stdout/stderr tails, and output hashes.
223
- - Hardened deterministic review scanning for empty `catch`, `@ts-ignore`, focused tests, dangerous shell/Git commands, and security-sensitive changes without G7 evidence.
224
- - Hardened built-in G7 security scanning with explainable file/line evidence and compatibility vs strict blocking modes.
225
- - Added CLI/unit regression tests for `review -> ship`, unreviewed-file blocking, and security-scanner false-positive boundaries.
226
- - Verified `npm run build`, full Vitest suite, and `npm pack --dry-run` before release.
227
-
228
- ### v0.10.0
229
-
230
- - Added phase-aligned workflow commands with FSM integration.
231
- - Added persisted verification evidence and review records.
232
- - Published `@hongmaple0820/scale-engine@0.10.0`.
233
- - Verified `npm run build`, full Vitest suite, and `npm pack --dry-run` before release.
234
-
235
- ## License
236
-
237
- MIT
1
+ <p align="center">
2
+ <img src="https://img.shields.io/badge/version-0.18.0-orange?style=flat-square" alt="version" />
3
+ <img src="https://img.shields.io/badge/platforms-16-blue?style=flat-square" alt="platforms" />
4
+ <img src="https://img.shields.io/badge/agents-12-blue?style=flat-square" alt="agents" />
5
+ <img src="https://img.shields.io/badge/workflows-10-green?style=flat-square" alt="workflows" />
6
+ <img src="https://img.shields.io/badge/detectors-19-red?style=flat-square" alt="detectors" />
7
+ <img src="https://img.shields.io/badge/tests-verified-brightgreen?style=flat-square" alt="tests" />
8
+ <img src="https://img.shields.io/badge/npm-0.18.0-cb3837?style=flat-square&logo=npm" alt="npm" />
9
+ </p>
10
+
11
+ # SCALE Engine v0.18.0
12
+
13
+ SCALE Engine makes AI coding agents follow engineering rules through executable workflow gates, evidence files, and review constraints instead of relying on prompt discipline alone. It helps humans see what the agent explored, planned, verified, skipped, and why a task is or is not ready to ship.
14
+
15
+ Repository: https://github.com/hongmaple0820/scale-engine
16
+ Mirror: https://gitee.com/hongmaple/scale-engine
17
+ npm: https://www.npmjs.com/package/@hongmaple0820/scale-engine
18
+ Language: [English](README.en.md) | [Chinese](README.md)
19
+
20
+ ## What It Solves
21
+
22
+ AI coding becomes hard when agents must behave consistently across real teams and real repositories:
23
+
24
+ | Failure mode | SCALE mechanism |
25
+ | --- | --- |
26
+ | Agent says tests passed without running them | Verification profiles and evidence stores record actual commands and results |
27
+ | Agent skips discovery, design, TDD, or review | `scale context`, `scale diagnose`, `scale tdd`, and `scale status` produce required next actions |
28
+ | Agent stages unrelated files or edits the wrong repository | Review-gated shipping, MOE workspace rules, and child repository blockers control boundaries |
29
+ | Docs, screenshots, reports, scripts, and temporary files become unmaintainable | Resource governance classifies maintained assets, task evidence, temporary outputs, and forbidden commits |
30
+ | Noisy logs, secrets, ORM misuse, framework violations, or security risks slip through | Engineering standards and OWASP scans produce traceable findings |
31
+ | Long Markdown reports are not read | `scale artifact` renders traceable HTML reports from maintained Markdown sources |
32
+
33
+ ## See It In 3 Minutes
34
+
35
+ ```bash
36
+ npm install -g @hongmaple0820/scale-engine
37
+ mkdir scale-demo && cd scale-demo
38
+ scale init --governance-pack standard
39
+ scale preflight --preflight-profile quick
40
+ scale status
41
+ ```
42
+
43
+ This generates governance files you can commit to a project:
44
+
45
+ - `.scale/verification.json`: service matrix and verification profiles
46
+ - `.scale/skills.json`: skill routing and evidence requirements
47
+ - `.scale/tools.json`: CLI/MCP/browser/desktop orchestration policy
48
+ - `docs/workflow/templates/`: Mini-PRD, plan, verification, review, and summary templates
49
+ - `docs/standards/`: engineering, Git collaboration, and resource governance rules
50
+
51
+ Continue with a full workflow loop:
52
+
53
+ ```bash
54
+ scale context init --name "Scale Demo"
55
+ scale context grill --task-id 2026-05-18-oauth-hardening --task "Harden OAuth callback"
56
+ scale diagnose plan --task-id 2026-05-18-oauth-hardening --symptom "callback returns 500 when state expires"
57
+ scale tdd slice --task-id 2026-05-18-oauth-hardening --behavior "reject expired OAuth state" --public-interface "GET /oauth/callback" --failing-test "expired state returns 401" --test-file tests/oauth.test.ts --impl-files src/oauth.ts
58
+ scale artifact render --task-id 2026-05-18-oauth-hardening --artifact-dir docs/worklog/tasks/2026-05-18-oauth-hardening
59
+ scale artifact doctor --artifact-dir docs/worklog/tasks/2026-05-18-oauth-hardening
60
+ ```
61
+
62
+ Read [Quickstart](docs/start/quickstart.md) and [Agent Governance Demo](docs/start/agent-governance-demo.md) for the complete walkthrough.
63
+
64
+ ## Who It Is For
65
+
66
+ - Teams using Codex, Claude Code, Cursor, Gemini CLI, OpenCode, Aider, or similar agents on real projects.
67
+ - Teams with multi-service, multi-repository, MOE workspace, frontend/backend, or scaffold governance needs.
68
+ - Teams that want agents to actively use skills, MCPs, CLIs, browser automation, E2E checks, and HTML reports with safety boundaries.
69
+ - Project owners who feel AI code is fast but hard to review, verify, and maintain.
70
+
71
+ It is not optimized for toy projects that only want one minimal prompt file and do not need gates, collaboration rules, or long-term maintainability.
72
+
73
+ ## Core Capabilities
74
+
75
+ - Workflow Engine: `define -> plan -> build -> verify -> review -> ship` with persisted state.
76
+ - GateSystem: build, lint, test, coverage, security, TDD, review, and tool evidence gates.
77
+ - Governance Packs: `standard`, `project-scaffold`, `moe-workspace`, `resource-governance`, `go-service-matrix`, `node-library`, and `frontend-app`.
78
+ - Resource Governance: docs, media, reports, test scripts, temporary scripts, HTML artifacts, and local config lifecycle rules.
79
+ - Skill and Tool Orchestration: UI/UX, web research, browser E2E, Chrome DevTools MCP, desktop automation, and external agent CLIs.
80
+ - Engineering Standards: noisy logs, sensitive data, injection risks, ORM/database usage, framework boundaries, test rigor, and deployment risk.
81
+ - HTML Artifacts: Markdown remains the maintained source; HTML becomes the review, comparison, status, and release handoff layer.
82
+
83
+ ## Installation
84
+
85
+ ```bash
86
+ npm install -g @hongmaple0820/scale-engine
87
+ scale --version
88
+ ```
89
+
90
+ Node.js 20 or newer is required.
91
+
92
+ ## Governance Packs
93
+
94
+ Use `scale init` to install a governed workflow into an existing project:
95
+
96
+ ```bash
97
+ scale init --governance-pack standard
98
+ scale init --governance-pack project-scaffold
99
+ scale init --governance-pack moe-workspace
100
+ scale init --governance-pack resource-governance
101
+ scale init --governance-pack go-service-matrix
102
+ scale init --governance-pack node-library
103
+ scale init --governance-pack frontend-app
104
+ ```
105
+
106
+ Supported packs:
107
+
108
+ | Pack | Best fit |
109
+ | --- | --- |
110
+ | `standard` | General project governance with task artifacts, verification, metrics, resources, standards, and skills policy |
111
+ | `project-scaffold` | Reproducible engineering workflow scaffold and demo governance project |
112
+ | `moe-workspace` | Parent workspace with independent child repositories or MOE-style multi-repo development |
113
+ | `resource-governance` | Asset/document lifecycle policy for docs, reports, screenshots, scripts, media, and generated outputs |
114
+ | `go-service-matrix` | Go backend services with service-aware build/lint/test/security verification |
115
+ | `node-library` | Node/TypeScript package workflow, release, and verification governance |
116
+ | `frontend-app` | UI/UX, browser evidence, responsive checks, E2E, and visual review governance |
117
+
118
+ If you are unsure, start with `standard`. Use a specialized pack when the project shape is clear:
119
+
120
+ See [Getting Started](docs/start/README.md) for runnable tutorials and demo paths.
121
+
122
+ ## Phase Workflow
123
+
124
+ ```bash
125
+ scale define "Scoped release workflow" \
126
+ --description "Implement a TypeScript CLI workflow with verification evidence, review records, rollback constraints, and release safety checks." \
127
+ --success-criteria "verify evidence is persisted,review evidence is persisted,ship blocks unreviewed files"
128
+
129
+ scale plan <spec-id> --rollback "Revert the release commit and remove generated artifacts"
130
+ scale build <plan-id> --description "Implement scoped release workflow"
131
+ scale verify <task-id>
132
+ scale review <task-id>
133
+ scale ship <task-id> --message "feat(workflow): add scoped release workflow"
134
+ ```
135
+
136
+ Use `scale ship <task-id> --no-commit` to generate the delivery report without creating a Git commit.
137
+
138
+ Strict TDD evidence can be enforced when needed:
139
+
140
+ ```bash
141
+ scale verify <task-id> --tdd-strict --tdd-evidence .scale/tdd/<task-id>.json
142
+ ```
143
+
144
+ The TDD evidence JSON must include `red`, `green`, `refactor`, and `testFirst` set to `true`.
145
+
146
+ ## Evolution Self-Improve Loop
147
+
148
+ Extract lessons from session defects and promote to rules and hooks:
149
+
150
+ ```bash
151
+ # Extract Lessons from session
152
+ scale evolution extract <session-id>
153
+
154
+ # Run self-improve loop: Defect Lesson → Rule → Hook
155
+ scale evolution improve <session-id>
156
+
157
+ # Show self-improve report
158
+ scale evolution report <session-id>
159
+
160
+ # View generated Hooks config
161
+ scale evolution hooks <session-id> --json
162
+ ```
163
+
164
+ Thresholds:
165
+ - Lesson → Rule: requires 3 verifications
166
+ - Rule → Active: requires 10 hits
167
+ - Rule → Hook: requires 20 hits
168
+
169
+ ## Safety Model
170
+
171
+ SCALE Engine uses multiple enforcement layers:
172
+
173
+ | Layer | Purpose |
174
+ | --- | --- |
175
+ | FSM | Prevents invalid artifact lifecycle transitions |
176
+ | GateSystem | Runs build, lint, test, coverage, and security gates |
177
+ | EvidenceStore | Persists verification evidence for audit and release gating |
178
+ | ReviewStore | Persists deterministic review records |
179
+ | ReviewAnalyzer | Scans diffs for high-risk code, process debt, and missing security evidence |
180
+ | Detectors | Detects brute retry, premature completion, blame shifting, busy loops, and related failure modes |
181
+ | Ship gate | Requires passing verification and review evidence before release |
182
+
183
+ The `ship` command no longer stages the whole workspace. It stages only files covered by passing review records and blocks if new reviewable files appear after review.
184
+
185
+ G7 `SecurityGate` includes a lightweight built-in scan for hardcoded secrets, private keys, disabled TLS verification, `eval`/`Function`, raw HTML injection, dangerous shell commands, shell execution, and empty `catch` blocks. Compatibility mode blocks CRITICAL findings; strict mode also blocks HIGH findings.
186
+
187
+ ## Supported Platforms
188
+
189
+ SCALE Engine includes adapters for 16 agent platforms, including Claude Code, Codex CLI, OpenCode, Cursor, Gemini CLI, OpenClaw, Hermes, Trae, WorkBuddy, VS Code Copilot CLI, QCoder, DeepSeek-TUI, Aider, Windsurf, Kimi, and Doubao.
190
+
191
+ It also includes 12 professional agent profiles:
192
+
193
+ - frontend
194
+ - backend
195
+ - testing
196
+ - UI design
197
+ - operations
198
+ - product
199
+ - code review
200
+ - security
201
+ - database
202
+ - performance
203
+ - documentation
204
+ - architecture
205
+
206
+ ## Project Layout
207
+
208
+ ```text
209
+ src/api/cli.ts CLI entrypoint
210
+ src/cli/phaseCommands.ts DEFINE/PLAN/BUILD/VERIFY/REVIEW/SHIP
211
+ src/cli/evolutionCommands.ts L6 Evolution CLI commands
212
+ src/workflow/gates/ Quality gates and persisted evidence
213
+ src/workflow/ReviewAnalyzer.ts Deterministic review analysis
214
+ src/workflow/ReviewStore.ts Review record persistence
215
+ src/workflow/EvidenceStore.ts Gate evidence persistence
216
+ src/workflow/evolution/ LessonExtractor + SelfImproveEngine
217
+ src/workflow/qa/ BrowserQA + E2ETestRunner
218
+ src/artifact/ Artifact store and FSM definitions
219
+ src/guardrails/ Detector and gateway logic
220
+ src/guardrails/OWASPDetector.ts OWASP Top 10 security detection
221
+ src/capabilities/BrowserQACapability.ts Playwright MCP wrapper
222
+ src/evolution/ Defect/Lesson/Rule/Hook evolution layer
223
+ tests/ Vitest test suites
224
+ ```
225
+
226
+ ## Development
227
+
228
+ ```bash
229
+ npm install
230
+ npm run build
231
+ npx vitest run
232
+ npm pack --dry-run
233
+ ```
234
+
235
+ Targeted workflow tests:
236
+
237
+ ```bash
238
+ npx vitest run tests/workflow/phaseCli.test.ts
239
+ npx vitest run tests/workflow/reviewAnalyzer.test.ts tests/workflow/reviewStore.test.ts tests/workflow/gateSystem.test.ts
240
+ ```
241
+
242
+ ## Release Notes
243
+
244
+ ### v0.18.0
245
+
246
+ - Governed HTML artifacts: `scale artifact render/doctor/settle/open`.
247
+ - Markdown remains the editable source of truth; generated HTML is traceable task evidence.
248
+ - Governance packs now include output policy and HTML artifact resource classification.
249
+ - Added tests for HTML artifact rendering, safety checks, settlement evidence, and generated template output.
250
+
251
+ ### v0.17.0
252
+
253
+ - Added active workflow command gates: `scale context`, `scale diagnose`, `scale tdd`, and `scale status`.
254
+ - Added required next-action queues so agents cannot silently skip context, debugging, TDD, or verification work.
255
+
256
+ ### v0.16.0
257
+
258
+ - Added governed skill repository, skill recommendation, install-safety checks, visual Vibe templates, and leadership presets.
259
+ - Strengthened tool orchestration and resource/engineering standards governance.
260
+
261
+ ### v0.15.1
262
+
263
+ - Added UI/UX, web research, browser automation, desktop automation, and external Agent CLI routing contracts.
264
+ - Added resource governance and engineering standards governance for generated project packs.
265
+
266
+ ### v0.11.1
267
+
268
+ - Phase Commands FSM blocking: `canTransition` + `process.exit(1)` for guard failures
269
+ - OWASP Top 10 Detector: 19 security detection patterns
270
+ - Browser QA Capability: Playwright MCP wrapper for E2E testing
271
+ - L6 Evolution: `Defect → Lesson → Rule → Hook` self-improve loop
272
+ - Evolution CLI: `scale evolution extract/improve/report/hooks`
273
+ - ReviewAnalyzer regex fix: avoid false positives on pattern definitions
274
+ - Vitest suite covered in release verification
275
+
276
+ ### v0.10.1
277
+
278
+ - Hardened `ship` so release commits stage only files covered by passing review records.
279
+ - Added `ship --no-commit` delivery reports for reviewable output without creating a Git commit.
280
+ - Added optional strict TDD evidence verification with `--tdd-evidence` and `--tdd-strict`.
281
+ - Added richer command evidence metadata: working directory, timestamps, stdout/stderr tails, and output hashes.
282
+ - Hardened deterministic review scanning for empty `catch`, `@ts-ignore`, focused tests, dangerous shell/Git commands, and security-sensitive changes without G7 evidence.
283
+ - Hardened built-in G7 security scanning with explainable file/line evidence and compatibility vs strict blocking modes.
284
+ - Added CLI/unit regression tests for `review -> ship`, unreviewed-file blocking, and security-scanner false-positive boundaries.
285
+ - Verified `npm run build`, full Vitest suite, and `npm pack --dry-run` before release.
286
+
287
+ ### v0.10.0
288
+
289
+ - Added phase-aligned workflow commands with FSM integration.
290
+ - Added persisted verification evidence and review records.
291
+ - Published `@hongmaple0820/scale-engine@0.10.0`.
292
+ - Verified `npm run build`, full Vitest suite, and `npm pack --dry-run` before release.
293
+
294
+ ## License
295
+
296
+ MIT