@hongmaple0820/scale-engine 0.14.0 → 0.15.1

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 (67) hide show
  1. package/README.en.md +13 -5
  2. package/README.md +13 -5
  3. package/dist/adapters/AiderAdapter.js +52 -52
  4. package/dist/adapters/ClaudeCodeAdapter.js +5 -5
  5. package/dist/adapters/DeepSeekTuiAdapter.js +5 -5
  6. package/dist/adapters/DoubaoAdapter.js +33 -33
  7. package/dist/adapters/KimiAdapter.js +32 -32
  8. package/dist/adapters/KiroAdapter.js +26 -26
  9. package/dist/adapters/WindsurfAdapter.js +32 -32
  10. package/dist/api/cli.js +296 -3
  11. package/dist/api/cli.js.map +1 -1
  12. package/dist/api/doctor.d.ts +2 -0
  13. package/dist/api/doctor.js +83 -0
  14. package/dist/api/doctor.js.map +1 -1
  15. package/dist/api/mcp.js +2 -1
  16. package/dist/api/mcp.js.map +1 -1
  17. package/dist/capabilities/InstalledSkillsIntegration.d.ts +3 -0
  18. package/dist/capabilities/InstalledSkillsIntegration.js +41 -17
  19. package/dist/capabilities/InstalledSkillsIntegration.js.map +1 -1
  20. package/dist/cli/phaseCommands.js +63 -5
  21. package/dist/cli/phaseCommands.js.map +1 -1
  22. package/dist/core/logger.d.ts +2 -0
  23. package/dist/core/logger.js +33 -1
  24. package/dist/core/logger.js.map +1 -1
  25. package/dist/output/HTMLDocumentRenderer.js +3 -2
  26. package/dist/output/HTMLDocumentRenderer.js.map +1 -1
  27. package/dist/skills/ExternalSkills.js +9 -4
  28. package/dist/skills/ExternalSkills.js.map +1 -1
  29. package/dist/skills/SkillDiscovery.js +5 -3
  30. package/dist/skills/SkillDiscovery.js.map +1 -1
  31. package/dist/skills/SkillDoctor.js +178 -1
  32. package/dist/skills/SkillDoctor.js.map +1 -1
  33. package/dist/skills/SkillInstaller.js +5 -0
  34. package/dist/skills/SkillInstaller.js.map +1 -1
  35. package/dist/skills/routing/SkillPlanner.js +40 -40
  36. package/dist/skills/routing/SkillPolicy.js +168 -5
  37. package/dist/skills/routing/SkillPolicy.js.map +1 -1
  38. package/dist/version.d.ts +3 -0
  39. package/dist/version.js +15 -0
  40. package/dist/version.js.map +1 -0
  41. package/dist/workflow/EngineeringStandards.d.ts +143 -0
  42. package/dist/workflow/EngineeringStandards.js +679 -0
  43. package/dist/workflow/EngineeringStandards.js.map +1 -0
  44. package/dist/workflow/GovernanceTemplatePacks.d.ts +1 -1
  45. package/dist/workflow/GovernanceTemplatePacks.js +136 -10
  46. package/dist/workflow/GovernanceTemplatePacks.js.map +1 -1
  47. package/dist/workflow/GovernanceTemplates.d.ts +1 -1
  48. package/dist/workflow/GovernanceTemplates.js +606 -429
  49. package/dist/workflow/GovernanceTemplates.js.map +1 -1
  50. package/dist/workflow/ResourceGovernance.d.ts +120 -0
  51. package/dist/workflow/ResourceGovernance.js +512 -0
  52. package/dist/workflow/ResourceGovernance.js.map +1 -0
  53. package/dist/workflow/TaskArtifactScaffolder.js +13 -10
  54. package/dist/workflow/TaskArtifactScaffolder.js.map +1 -1
  55. package/dist/workflow/VerificationProfile.d.ts +2 -0
  56. package/dist/workflow/VerificationProfile.js +7 -0
  57. package/dist/workflow/VerificationProfile.js.map +1 -1
  58. package/dist/workflow/WorkspaceLifecycle.d.ts +2 -0
  59. package/dist/workflow/WorkspaceLifecycle.js +34 -8
  60. package/dist/workflow/WorkspaceLifecycle.js.map +1 -1
  61. package/dist/workflow/WorkspaceTopology.d.ts +49 -0
  62. package/dist/workflow/WorkspaceTopology.js +125 -0
  63. package/dist/workflow/WorkspaceTopology.js.map +1 -0
  64. package/dist/workflow/index.d.ts +3 -0
  65. package/dist/workflow/index.js +3 -0
  66. package/dist/workflow/index.js.map +1 -1
  67. package/package.json +2 -2
@@ -3,6 +3,8 @@ import { join } from 'node:path';
3
3
  import { skillRoutingPolicyTemplate } from '../skills/routing/SkillPolicy.js';
4
4
  import { readGovernanceLock, writeGovernanceLock } from './GovernanceLock.js';
5
5
  import { resolveGovernanceTemplatePack, } from './GovernanceTemplatePacks.js';
6
+ import { engineeringStandardsPolicyTemplate, frameworksCatalogTemplate } from './EngineeringStandards.js';
7
+ import { resourceManifestTemplate, resourcePolicyTemplate } from './ResourceGovernance.js';
6
8
  export function writeGovernanceTemplates(projectDir = process.cwd(), options = {}) {
7
9
  const mode = options.mode ?? 'standard';
8
10
  const projectName = options.projectName ?? 'Project';
@@ -24,6 +26,9 @@ export function writeGovernanceTemplates(projectDir = process.cwd(), options = {
24
26
  writeTracked(result, lockFiles, projectDir, 'docs/workflow/templates/visual-review.md', governanceTemplateContent('visual-review.md'));
25
27
  writeTracked(result, lockFiles, projectDir, 'docs/workflow/templates/api-contract.md', governanceTemplateContent('api-contract.md'));
26
28
  writeTracked(result, lockFiles, projectDir, 'docs/workflow/templates/docs-impact.md', governanceTemplateContent('docs-impact.md'));
29
+ writeTracked(result, lockFiles, projectDir, 'docs/workflow/templates/resource-impact.md', governanceTemplateContent('resource-impact.md'));
30
+ writeTracked(result, lockFiles, projectDir, 'docs/workflow/templates/standards-impact.md', governanceTemplateContent('standards-impact.md'));
31
+ writeTracked(result, lockFiles, projectDir, 'docs/workflow/templates/architecture-review.md', governanceTemplateContent('architecture-review.md'));
27
32
  writeTracked(result, lockFiles, projectDir, 'docs/workflow/templates/security-review.md', governanceTemplateContent('security-review.md'));
28
33
  writeTracked(result, lockFiles, projectDir, 'docs/workflow/templates/db-change-plan.md', governanceTemplateContent('db-change-plan.md'));
29
34
  writeTracked(result, lockFiles, projectDir, 'docs/workflow/templates/e2e-plan.md', governanceTemplateContent('e2e-plan.md'));
@@ -40,6 +45,10 @@ export function writeGovernanceTemplates(projectDir = process.cwd(), options = {
40
45
  artifactGate: packMode.artifactGate,
41
46
  }));
42
47
  writeTracked(result, lockFiles, projectDir, '.scale/skills.json', skillRoutingPolicyTemplate(mode));
48
+ writeTracked(result, lockFiles, projectDir, '.scale/resource-policy.json', resourcePolicyTemplate());
49
+ writeTracked(result, lockFiles, projectDir, '.scale/assets.json', resourceManifestTemplate());
50
+ writeTracked(result, lockFiles, projectDir, '.scale/engineering-standards.json', engineeringStandardsPolicyTemplate());
51
+ writeTracked(result, lockFiles, projectDir, '.scale/frameworks.json', frameworksCatalogTemplate());
43
52
  for (const file of pack.generatedFiles) {
44
53
  writePackGeneratedFile(result, lockFiles, projectDir, pack.id, pack.version, file);
45
54
  }
@@ -63,6 +72,9 @@ export function governanceTemplateContent(name) {
63
72
  case 'visual-review.md': return visualReviewTemplate();
64
73
  case 'api-contract.md': return apiContractTemplate();
65
74
  case 'docs-impact.md': return docsImpactTemplate();
75
+ case 'resource-impact.md': return resourceImpactTemplate();
76
+ case 'standards-impact.md': return standardsImpactTemplate();
77
+ case 'architecture-review.md': return architectureReviewTemplate();
66
78
  case 'security-review.md': return securityReviewTemplate();
67
79
  case 'db-change-plan.md': return dbChangePlanTemplate();
68
80
  case 'e2e-plan.md': return e2ePlanTemplate();
@@ -101,511 +113,675 @@ function shouldUseGeneratedHeader(file) {
101
113
  return file.kind === 'doc' || file.kind === 'template' || file.kind === 'script';
102
114
  }
103
115
  function generatedHeader(packId, packVersion) {
104
- return `# Generated by scale-engine governance pack: ${packId}@${packVersion}
105
- # Edit policy: prefer editing the pack in scale-engine; local overrides should be documented.
106
-
116
+ return `# Generated by scale-engine governance pack: ${packId}@${packVersion}
117
+ # Edit policy: prefer editing the pack in scale-engine; local overrides should be documented.
118
+
107
119
  `;
108
120
  }
109
121
  function workflowReadme(projectName, mode, packId = 'standard') {
110
- return `# ${projectName} Workflow
111
-
112
- Governance mode: ${mode}
113
- Governance pack: ${packId}
114
-
115
- ## Task Levels
116
-
117
- | Level | Use for | Required artifacts |
118
- | --- | --- | --- |
119
- | S | typo, comments, small local edits | relevant validation only |
120
- | M | bug fixes, new APIs, 2-5 files | explore, skill plan, plan, verification, review, summary |
121
- | L | cross-module or architecture changes | full artifacts plus human confirmation |
122
- | CRITICAL | auth, permissions, migrations, production config | rollback plan, security review, full verification |
123
-
124
- ## Standard Task Directory
125
-
126
- \`\`\`text
127
- docs/worklog/tasks/<yyyy-mm-dd>-<task-slug>/
128
- ├── explore.md
129
- ├── mini-prd.md
130
- ├── plan.md
131
- ├── verification.md
132
- ├── review.md
133
- └── summary.md
134
- \`\`\`
135
-
136
- ## Verification
137
-
138
- Use service-aware verification when configured:
139
-
140
- \`\`\`bash
141
- scale preflight --service all
142
- scale preflight --service all --preflight-profile full
143
- scale verify <task-id> --profile default
144
- scale verify <task-id> --service <service-name>
145
- scale verify <task-id> --artifact-gate warn
146
- scale verify <task-id> --artifact-gate block
147
- scale verify <task-id> --require-installed-skills
148
- scale task-artifacts check --dir docs/worklog/tasks/<task-dir> --level L
149
- \`\`\`
150
-
122
+ return `# ${projectName} Workflow
123
+
124
+ Governance mode: ${mode}
125
+ Governance pack: ${packId}
126
+
127
+ ## Task Levels
128
+
129
+ | Level | Use for | Required artifacts |
130
+ | --- | --- | --- |
131
+ | S | typo, comments, small local edits | relevant validation only |
132
+ | M | bug fixes, new APIs, 2-5 files | explore, skill plan, plan, verification, review, summary |
133
+ | L | cross-module or architecture changes | full artifacts plus human confirmation |
134
+ | CRITICAL | auth, permissions, migrations, production config | rollback plan, security review, full verification |
135
+
136
+ ## Standard Task Directory
137
+
138
+ \`\`\`text
139
+ docs/worklog/tasks/<yyyy-mm-dd>-<task-slug>/
140
+ ├── explore.md
141
+ ├── mini-prd.md
142
+ ├── plan.md
143
+ ├── verification.md
144
+ ├── review.md
145
+ └── summary.md
146
+ \`\`\`
147
+
148
+ ## Verification
149
+
150
+ Use service-aware verification when configured:
151
+
152
+ \`\`\`bash
153
+ scale preflight --service all
154
+ scale preflight --service all --preflight-profile full
155
+ scale verify <task-id> --profile default
156
+ scale verify <task-id> --service <service-name>
157
+ scale verify <task-id> --artifact-gate warn
158
+ scale verify <task-id> --artifact-gate block
159
+ scale verify <task-id> --require-installed-skills
160
+ scale task-artifacts check --dir docs/worklog/tasks/<task-dir> --level L
161
+ \`\`\`
162
+
151
163
  Keep \`.scale/verification.json\` as the source of truth for profiles and service commands.
152
164
  Keep \`.scale/skills.json\` as the source of truth for active skill routing policy.
165
+ 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.
166
+ 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.
153
167
  Use \`artifactGate: "warn"\` while introducing the workflow, then move M/L/CRITICAL work to \`"block"\` once templates and local gates are stable.
154
-
168
+
155
169
  ## Active Skill Routing
156
170
 
157
171
  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.
158
172
 
159
- 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\`.
160
-
161
- Before M/L work, check whether required workflow skills are physically installed:
162
-
163
- \`\`\`bash
164
- scale skill doctor --json
165
- scale skill check --require-installed --json
166
- \`\`\`
167
-
168
- ## Workspace Lifecycle
173
+ Tool orchestration is part of the workflow contract:
169
174
 
170
- Before finishing an agent-created branch or deleting a temporary worktree, inspect root and child repository state:
175
+ - 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.
176
+ - Web research, logged-in pages, and dynamic browser work require \`web-access\` evidence, source citations, and browser/network/console evidence when available.
177
+ - 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.
178
+ - Desktop or client-side GUI automation uses CUA/computer-use only with explicit operator-safety notes, desktop screenshots, and a side-effect boundary.
179
+ - 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.
171
180
 
172
- \`\`\`bash
173
- scale workspace status --json
174
- scale workspace finish --json
175
- scale workspace cleanup --dir <temporary-worktree> --dry-run --json
181
+ 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\`.
182
+
183
+ Before M/L work, check whether required workflow skills are physically installed:
184
+
185
+ \`\`\`bash
186
+ scale skill doctor --json
187
+ scale skill check --require-installed --json
188
+ \`\`\`
189
+
190
+ ## Workspace Lifecycle
191
+
192
+ Before finishing an agent-created branch or deleting a temporary worktree, inspect root and child repository state:
193
+
194
+ \`\`\`bash
195
+ scale workspace status --json
196
+ scale workspace finish --json
197
+ scale workspace cleanup --dir <temporary-worktree> --dry-run --json
176
198
  scale workspace cleanup --dir <temporary-worktree> --apply --confirm <branch-or-head> --json
177
199
  \`\`\`
178
200
 
179
201
  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.
180
202
 
181
- ## Automation Templates
182
-
183
- Optional automation templates are generated under \`docs/workflow/templates/\`:
203
+ ## Resource Governance
184
204
 
185
- - \`github-actions-scale-preflight.yml\`: CI workflow that runs \`scale preflight --service all --preflight-profile ci\`.
186
- - \`pre-push-scale-preflight.sh\`: local pre-push hook template that runs the default quick preflight.
187
-
188
- Keep these templates advisory until \`scale preflight --service all --preflight-profile full\` is reliable locally for the project.
189
- `;
190
- }
191
- function exploreTemplate() {
192
- return `# Explore
205
+ Use asset scanning before committing generated reports, media, temporary scripts, or long-lived documentation changes:
193
206
 
194
- ## Files Read
207
+ \`\`\`bash
208
+ scale assets scan --json
209
+ scale assets doctor --json
210
+ scale assets settle --task-id <task-id> --artifact-dir docs/worklog/tasks/<task-dir>
211
+ \`\`\`
195
212
 
196
- - TBD
213
+ Default policy:
197
214
 
198
- ## Current Behavior
215
+ - maintained module docs, standards, contracts, ADRs, reusable scripts: commit and keep current.
216
+ - task worklog artifacts: review before commit; promote final truth to maintained docs when useful.
217
+ - screenshots, videos, E2E reports, coverage, temporary scripts, and runtime logs: keep out of Git unless explicitly promoted.
218
+ - large media: use Git LFS or external artifact storage instead of normal Git history.
199
219
 
200
- TBD
220
+ ## Engineering Standards
201
221
 
202
- ## Main Conflict
222
+ Use standards scanning before reviewing or shipping M/L/CRITICAL work:
203
223
 
204
- TBD
224
+ \`\`\`bash
225
+ scale standards scan --json
226
+ scale standards doctor --json
227
+ scale standards settle --task-id <task-id> --artifact-dir docs/worklog/tasks/<task-dir>
228
+ scale preflight --preflight-profile full --json
229
+ scale verify <task-id> --json
230
+ \`\`\`
205
231
 
206
- ## Affected Modules
232
+ Default policy:
207
233
 
208
- TBD
234
+ - ad-hoc console/output logging is allowed only for CLI/script paths.
235
+ - sensitive fields such as token, password, secret, authorization, cookie, and credentials must not be logged.
236
+ - hardcoded secret-like assignments are blocked before review or release.
237
+ - SQL must use parameterized queries, ORM bind parameters, or safe query builders.
238
+ - unsafe HTML sinks, dynamic code execution, empty catch blocks, and type suppressions require remediation before release.
239
+ - framework and architecture rules live in \`.scale/frameworks.json\` and module standards docs.
240
+ - \`.scale/frameworks.json > bannedImports\` blocks direct use of deprecated ORMs, unsafe SDKs, or off-system UI components.
241
+ - \`.scale/frameworks.json > lastReviewedAt/reviewIntervalDays\` warns when module framework decisions need review.
242
+ - \`.scale/engineering-standards.json > blockingRules\` promotes selected warning rule IDs to release-blocking findings.
243
+ - \`.scale/engineering-standards.json > allowedFindingPatterns\` allows narrow rule/path/evidence exceptions without hiding unrelated findings in the same file.
244
+ - \`.scale/verification.json > policy.engineeringStandardsGate\` controls whether preflight and task verification treat standards as \`off\`, \`warn\`, or \`block\`.
209
245
 
210
- ## Evidence
211
- TBD
246
+ ## Automation Templates
247
+
248
+ Optional automation templates are generated under \`docs/workflow/templates/\`:
249
+
250
+ - \`github-actions-scale-preflight.yml\`: CI workflow that runs \`scale preflight --service all --preflight-profile ci\`.
251
+ - \`pre-push-scale-preflight.sh\`: local pre-push hook template that runs the default quick preflight.
252
+
253
+ Keep these templates advisory until \`scale preflight --service all --preflight-profile full\` is reliable locally for the project.
254
+ `;
255
+ }
256
+ function exploreTemplate() {
257
+ return `# Explore
258
+
259
+ ## Files Read
260
+
261
+ - TBD
262
+
263
+ ## Current Behavior
264
+
265
+ TBD
266
+
267
+ ## Main Conflict
268
+
269
+ TBD
270
+
271
+ ## Affected Modules
272
+
273
+ TBD
274
+
275
+ ## Evidence
276
+ TBD
212
277
  `;
213
278
  }
214
279
  function miniPrdTemplate() {
215
- return `# Mini-PRD
216
-
217
- ## Background
218
-
219
- TBD
220
-
221
- ## Target Users
222
-
223
- TBD
224
-
225
- ## Core Scenario
226
-
227
- TBD
228
-
229
- ## Non-Goals
230
-
231
- TBD
232
-
233
- ## User Path
234
-
235
- TBD
236
-
237
- ## Permission Rules
238
-
239
- TBD
240
-
241
- ## Data Impact
242
-
243
- TBD
244
-
245
- ## Exception Scenarios
246
-
247
- 1. TBD
248
- 2. TBD
249
- 3. TBD
250
-
251
- ## Acceptance Criteria
252
-
253
- - [ ] TBD
254
-
255
- ## Rollback Or Disable Strategy
256
- TBD
280
+ return `# Mini-PRD
281
+
282
+ ## Background
283
+
284
+ TBD
285
+
286
+ ## Target Users
287
+
288
+ TBD
289
+
290
+ ## Core Scenario
291
+
292
+ TBD
293
+
294
+ ## Non-Goals
295
+
296
+ TBD
297
+
298
+ ## User Path
299
+
300
+ TBD
301
+
302
+ ## Permission Rules
303
+
304
+ TBD
305
+
306
+ ## Data Impact
307
+
308
+ TBD
309
+
310
+ ## Exception Scenarios
311
+
312
+ 1. TBD
313
+ 2. TBD
314
+ 3. TBD
315
+
316
+ ## Acceptance Criteria
317
+
318
+ - [ ] TBD
319
+
320
+ ## Rollback Or Disable Strategy
321
+ TBD
257
322
  `;
258
323
  }
259
324
  function skillPlanTemplate() {
260
- return `# Skill Plan
261
-
262
- ## Detected Intents
263
-
264
- | Domain | Score | Evidence |
265
- | --- | ---: | --- |
266
- | | | |
267
-
268
- ## Required Skills
269
-
270
- - TBD
271
-
272
- ## Recommended Skills
273
-
274
- - TBD
275
-
276
- ## Required Artifacts
325
+ return `# Skill Plan
326
+
327
+ ## Detected Intents
328
+
329
+ | Domain | Score | Evidence |
330
+ | --- | ---: | --- |
331
+ | | | |
332
+
333
+ ## Required Skills
334
+
335
+ - TBD
336
+
337
+ ## Recommended Skills
338
+
339
+ - TBD
340
+
341
+ ## Required Artifacts
342
+
343
+ - TBD
344
+
345
+ ## Required Verification Evidence
277
346
 
278
347
  - TBD
279
348
 
280
- ## Required Verification Evidence
349
+ ## Tool Orchestration
281
350
 
282
- - TBD
351
+ | Capability | Primary Tool Or Skill | Fallback | Required Evidence |
352
+ | --- | --- | --- | --- |
353
+ | UI/UX design | frontend-design, ui-ux-pro-max | awesome-design-md | design-system, ui-spec.md, visual-review.md |
354
+ | Web research or logged-in pages | web-access | agent-browser, Chrome DevTools MCP | source citations, browser evidence |
355
+ | Browser E2E | webapp-testing, Playwright | agent-browser, web-access | screenshot, console, network evidence |
356
+ | Desktop GUI automation | CUA/computer-use | manual verification | desktop screenshot, operator-safety notes |
357
+ | External agent CLI | codex/gemini/opencode CLI | manual review | version check, exact command output |
283
358
 
284
359
  ## Skipped Skills
285
360
 
286
361
  | Skill | Reason | Fallback Evidence |
287
- | --- | --- | --- |
288
- | | | |
362
+ | --- | --- | --- |
363
+ | | | |
289
364
  `;
290
365
  }
291
366
  function skillEvidenceTemplate() {
292
- return `# Skill Evidence
293
-
367
+ return `# Skill Evidence
368
+
294
369
  ## Planned Skills
295
370
 
296
371
  - TBD
297
372
 
373
+ ## Tool Selection Rationale
374
+
375
+ TBD
376
+
298
377
  ## Used Skills
299
378
 
300
379
  | Skill | Phase | Trigger | Evidence | Status |
301
380
  | --- | --- | --- | --- | --- |
302
381
  | skill-id | plan/build/verify/review | why it was selected | command, screenshot, report, or artifact path | executed/skipped/fallback |
303
382
 
304
- ## Skipped Skills
305
-
306
- | Skill | Reason | Fallback Evidence |
307
- | --- | --- | --- |
308
- | skill-id | why it could not run | manual review, alternate command, or explicit risk |
309
- `;
310
- }
311
- function uiSpecTemplate() {
312
- return `# UI Spec
313
-
314
- ## User Goal
315
-
316
- TBD
317
-
318
- ## Primary Flow
319
-
320
- TBD
321
-
322
- ## Interaction States
323
-
324
- - Default:
325
- - Loading:
326
- - Empty:
327
- - Error:
328
- - Success:
329
-
330
- ## Responsive Behavior
383
+ ## Browser Or Web Evidence
331
384
 
332
- TBD
385
+ | Tool | Target | Evidence | Result |
386
+ | --- | --- | --- | --- |
387
+ | web-access/agent-browser/Chrome DevTools MCP | URL or local target | screenshot, console log, network finding, source URL | passed/failed/skipped |
333
388
 
334
- ## Accessibility Requirements
389
+ ## Desktop Or External CLI Evidence
335
390
 
336
- TBD
391
+ | Tool | Scope | Safety Boundary | Evidence | Result |
392
+ | --- | --- | --- | --- | --- |
393
+ | 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 |
337
394
 
338
- ## Acceptance Criteria
395
+ ## Skipped Skills
339
396
 
340
- - [ ] TBD
397
+ | Skill | Reason | Fallback Evidence |
398
+ | --- | --- | --- |
399
+ | skill-id | why it could not run | manual review, alternate command, or explicit risk |
400
+ `;
401
+ }
402
+ function uiSpecTemplate() {
403
+ return `# UI Spec
404
+
405
+ ## User Goal
406
+
407
+ TBD
408
+
409
+ ## Primary Flow
410
+
411
+ TBD
412
+
413
+ ## Interaction States
414
+
415
+ - Default:
416
+ - Loading:
417
+ - Empty:
418
+ - Error:
419
+ - Success:
420
+
421
+ ## Responsive Behavior
422
+
423
+ TBD
424
+
425
+ ## Accessibility Requirements
426
+
427
+ TBD
428
+
429
+ ## Acceptance Criteria
430
+
431
+ - [ ] TBD
341
432
  `;
342
433
  }
343
434
  function visualReviewTemplate() {
344
- return `# Visual Review
345
-
346
- ## Screenshots Or Evidence
347
-
348
- TBD
349
-
350
- ## Layout And Responsiveness
351
-
352
- TBD
353
-
354
- ## Text Fit And Overlap
355
-
356
- TBD
357
-
358
- ## Accessibility Notes
359
-
360
- TBD
361
-
362
- ## Final Verdict
363
- TBD
435
+ return `# Visual Review
436
+
437
+ ## Screenshots Or Evidence
438
+
439
+ TBD
440
+
441
+ ## Layout And Responsiveness
442
+
443
+ TBD
444
+
445
+ ## Text Fit And Overlap
446
+
447
+ TBD
448
+
449
+ ## Accessibility Notes
450
+
451
+ TBD
452
+
453
+ ## Final Verdict
454
+ TBD
364
455
  `;
365
456
  }
366
457
  function apiContractTemplate() {
367
- return `# API Contract
368
-
369
- ## Endpoint Or Interface
370
-
371
- TBD
372
-
373
- ## Request
374
-
375
- TBD
376
-
377
- ## Response
378
-
379
- TBD
380
-
381
- ## Errors
382
-
383
- TBD
384
-
385
- ## Permission Rules
386
-
387
- TBD
388
-
389
- ## Compatibility Notes
390
-
391
- TBD
392
-
393
- ## Acceptance Criteria
394
-
395
- - [ ] TBD
458
+ return `# API Contract
459
+
460
+ ## Endpoint Or Interface
461
+
462
+ TBD
463
+
464
+ ## Request
465
+
466
+ TBD
467
+
468
+ ## Response
469
+
470
+ TBD
471
+
472
+ ## Errors
473
+
474
+ TBD
475
+
476
+ ## Permission Rules
477
+
478
+ TBD
479
+
480
+ ## Compatibility Notes
481
+
482
+ TBD
483
+
484
+ ## Acceptance Criteria
485
+
486
+ - [ ] TBD
396
487
  `;
397
488
  }
398
489
  function docsImpactTemplate() {
399
- return `# Docs Impact
490
+ return `# Docs Impact
491
+
492
+ ## Code Changes Requiring Docs
493
+
494
+ - TBD
495
+
496
+ ## Documentation Updated
497
+
498
+ - TBD
499
+
500
+ ## No-Docs-Needed Rationale
501
+
502
+ TBD
503
+
504
+ ## Links Checked
505
+
506
+ - TBD
507
+ `;
508
+ }
509
+ function resourceImpactTemplate() {
510
+ return `# Resource Impact
400
511
 
401
- ## Code Changes Requiring Docs
512
+ ## Resources Created
402
513
 
403
- - TBD
514
+ | Path | Type | Git Policy | Retention |
515
+ | --- | --- | --- | --- |
516
+ | TBD | canonical-doc/task-artifact/evidence-report/temporary/reusable-script/generated-media/contract/decision-record | commit/ignore/lfs/external/review | TBD |
404
517
 
405
- ## Documentation Updated
518
+ ## Resources Updated
406
519
 
407
520
  - TBD
408
521
 
409
- ## No-Docs-Needed Rationale
522
+ ## Resources Promoted To Maintained Docs
410
523
 
411
- TBD
524
+ - TBD
412
525
 
413
- ## Links Checked
526
+ ## Resources To Delete Or Archive Before Finish
414
527
 
415
528
  - TBD
416
- `;
417
- }
418
- function securityReviewTemplate() {
419
- return `# Security Review
420
529
 
421
- ## Assets And Trust Boundaries
530
+ ## Source Of Truth Updates
422
531
 
423
- TBD
532
+ - [ ] .scale/resource-policy.json
533
+ - [ ] .scale/assets.json
534
+ - [ ] docs/modules/<module>/README.md
535
+ `;
536
+ }
537
+ function standardsImpactTemplate() {
538
+ return `# Standards Impact
424
539
 
425
- ## Authorization Rules
540
+ ## Standards Checked
426
541
 
427
- TBD
542
+ - [ ] Logging and redaction
543
+ - [ ] Architecture boundaries
544
+ - [ ] ORM/database access
545
+ - [ ] Framework/component conventions
546
+ - [ ] UI/UX acceptance where user-facing
547
+ - [ ] Test and verification rigor
548
+ - [ ] Security-sensitive inputs and outputs
428
549
 
429
- ## Abuse Cases
550
+ ## Findings
430
551
 
431
- 1. TBD
432
- 2. TBD
433
- 3. TBD
552
+ | Severity | Rule | Path | Decision |
553
+ | --- | --- | --- | --- |
554
+ | TBD | TBD | TBD | fix/accept/escalate |
434
555
 
435
- ## Sensitive Data Impact
556
+ ## Policy Updates
436
557
 
437
- TBD
438
-
439
- ## Rollback Or Disable Strategy
558
+ - [ ] .scale/engineering-standards.json
559
+ - [ ] .scale/frameworks.json
560
+ - [ ] docs/standards/
440
561
 
441
- TBD
562
+ ## Settlement
442
563
 
443
- ## Final Verdict
444
- TBD
564
+ - Standards scan:
565
+ - Standards doctor:
445
566
  `;
446
567
  }
447
- function dbChangePlanTemplate() {
448
- return `# DB Change Plan
568
+ function architectureReviewTemplate() {
569
+ return `# Architecture Review
449
570
 
450
- ## Schema Or Data Change
451
-
452
- TBD
571
+ ## Scope
453
572
 
454
- ## Backward Compatibility
573
+ - Modules touched:
574
+ - Public contracts touched:
575
+ - Data flow touched:
455
576
 
456
- TBD
577
+ ## Boundary Checks
457
578
 
458
- ## Migration Steps
579
+ - [ ] API/controller layer does not bypass service/usecase layer
580
+ - [ ] Domain layer is not coupled to infrastructure details
581
+ - [ ] Repository/ORM usage follows project conventions
582
+ - [ ] Shared framework components are reused instead of duplicated
583
+ - [ ] New abstractions remove real complexity
459
584
 
460
- TBD
585
+ ## Risks
461
586
 
462
- ## Rollback Plan
587
+ - TBD
463
588
 
464
- TBD
589
+ ## Decision
465
590
 
466
- ## Verification
467
- TBD
591
+ - Approved/changes required:
592
+ `;
593
+ }
594
+ function securityReviewTemplate() {
595
+ return `# Security Review
596
+
597
+ ## Assets And Trust Boundaries
598
+
599
+ TBD
600
+
601
+ ## Authorization Rules
602
+
603
+ TBD
604
+
605
+ ## Abuse Cases
606
+
607
+ 1. TBD
608
+ 2. TBD
609
+ 3. TBD
610
+
611
+ ## Sensitive Data Impact
612
+
613
+ TBD
614
+
615
+ ## Rollback Or Disable Strategy
616
+
617
+ TBD
618
+
619
+ ## Final Verdict
620
+ TBD
621
+ `;
622
+ }
623
+ function dbChangePlanTemplate() {
624
+ return `# DB Change Plan
625
+
626
+ ## Schema Or Data Change
627
+
628
+ TBD
629
+
630
+ ## Backward Compatibility
631
+
632
+ TBD
633
+
634
+ ## Migration Steps
635
+
636
+ TBD
637
+
638
+ ## Rollback Plan
639
+
640
+ TBD
641
+
642
+ ## Verification
643
+ TBD
468
644
  `;
469
645
  }
470
646
  function e2ePlanTemplate() {
471
- return `# E2E Plan
472
-
473
- ## User Paths
474
-
475
- TBD
476
-
477
- ## Browser Coverage
478
-
479
- TBD
480
-
481
- ## Test Data
482
-
483
- TBD
484
-
485
- ## Assertions
486
-
487
- TBD
488
-
489
- ## Evidence
490
- TBD
647
+ return `# E2E Plan
648
+
649
+ ## User Paths
650
+
651
+ TBD
652
+
653
+ ## Browser Coverage
654
+
655
+ TBD
656
+
657
+ ## Test Data
658
+
659
+ TBD
660
+
661
+ ## Assertions
662
+
663
+ TBD
664
+
665
+ ## Evidence
666
+ TBD
491
667
  `;
492
668
  }
493
669
  function planTemplate() {
494
- return `# Plan
495
-
496
- ## Approach
497
-
498
- TBD
499
-
500
- ## Boundaries
501
-
502
- TBD
503
-
504
- ## Exception Contract
505
-
506
- 1. TBD
507
- 2. TBD
508
- 3. TBD
509
-
510
- ## Rollback Plan
511
-
512
- TBD
513
-
514
- ## Test Strategy
515
- TBD
670
+ return `# Plan
671
+
672
+ ## Approach
673
+
674
+ TBD
675
+
676
+ ## Boundaries
677
+
678
+ TBD
679
+
680
+ ## Exception Contract
681
+
682
+ 1. TBD
683
+ 2. TBD
684
+ 3. TBD
685
+
686
+ ## Rollback Plan
687
+
688
+ TBD
689
+
690
+ ## Test Strategy
691
+ TBD
516
692
  `;
517
693
  }
518
694
  function verificationTemplate() {
519
- return `# Verification
520
-
521
- ## Commands Run
522
-
523
- | Command | Result | Notes |
524
- | --- | --- | --- |
525
- | | | |
526
-
527
- ## Output Summary
528
-
529
- TBD
530
-
531
- ## Failures And Fixes
532
-
533
- TBD
534
-
535
- ## Final Status
536
- TBD
695
+ return `# Verification
696
+
697
+ ## Commands Run
698
+
699
+ | Command | Result | Notes |
700
+ | --- | --- | --- |
701
+ | | | |
702
+
703
+ ## Output Summary
704
+
705
+ TBD
706
+
707
+ ## Failures And Fixes
708
+
709
+ TBD
710
+
711
+ ## Final Status
712
+ TBD
537
713
  `;
538
714
  }
539
715
  function reviewTemplate() {
540
- return `# Review
541
-
542
- ## Code Review
543
-
544
- TBD
545
-
546
- ## Security Review
547
-
548
- TBD
549
-
550
- ## Same-Pattern Scan
551
-
552
- TBD
553
-
554
- ## Residual Risks
555
- TBD
716
+ return `# Review
717
+
718
+ ## Code Review
719
+
720
+ TBD
721
+
722
+ ## Security Review
723
+
724
+ TBD
725
+
726
+ ## Same-Pattern Scan
727
+
728
+ TBD
729
+
730
+ ## Residual Risks
731
+ TBD
556
732
  `;
557
733
  }
558
734
  function summaryTemplate() {
559
- return `# Summary
560
-
561
- ## Delivered Changes
562
-
563
- TBD
564
-
565
- ## Remaining Risks
566
-
567
- TBD
568
-
569
- ## Follow-Ups
570
-
571
- TBD
572
-
573
- ## Metric Row
574
-
575
- | Date | Task | Level | Services | Files Changed | First Verification Pass | Fix Iterations | Artifact Complete | Residual Risk | Final Gate |
576
- | --- | --- | --- | --- | ---: | --- | ---: | --- | --- | --- |
577
- | | | | | | | | | | |
735
+ return `# Summary
736
+
737
+ ## Delivered Changes
738
+
739
+ TBD
740
+
741
+ ## Remaining Risks
742
+
743
+ TBD
744
+
745
+ ## Follow-Ups
746
+
747
+ TBD
748
+
749
+ ## Metric Row
750
+
751
+ | Date | Task | Level | Services | Files Changed | First Verification Pass | Fix Iterations | Artifact Complete | Residual Risk | Final Gate |
752
+ | --- | --- | --- | --- | ---: | --- | ---: | --- | --- | --- |
753
+ | | | | | | | | | | |
578
754
  `;
579
755
  }
580
756
  function metricsTemplate() {
581
- return `# Workflow Metrics
582
-
583
- <!-- SCALE_METRICS:START -->
584
- | Date | Task | Level | Services | Files Changed | First Verification Pass | Fix Iterations | Rework Needed | Artifact Complete | Residual Risk | Final Gate |
585
- | --- | --- | --- | --- | ---: | --- | ---: | --- | --- | --- | --- |
586
- | | | | | | | | | | | |
587
- <!-- SCALE_METRICS:END -->
588
-
589
- ## Monthly Review
590
-
591
- ### Repeated Failure Patterns
592
-
593
- TBD
594
-
595
- ### Slowest Gates
596
-
597
- TBD
598
-
599
- ### Documentation Gaps
600
-
601
- TBD
602
-
603
- ### Product Design Misses
604
-
605
- TBD
606
-
607
- ### Proposed Workflow Changes
608
- TBD
757
+ return `# Workflow Metrics
758
+
759
+ <!-- SCALE_METRICS:START -->
760
+ | Date | Task | Level | Services | Files Changed | First Verification Pass | Fix Iterations | Rework Needed | Artifact Complete | Residual Risk | Final Gate |
761
+ | --- | --- | --- | --- | ---: | --- | ---: | --- | --- | --- | --- |
762
+ | | | | | | | | | | | |
763
+ <!-- SCALE_METRICS:END -->
764
+
765
+ ## Monthly Review
766
+
767
+ ### Repeated Failure Patterns
768
+
769
+ TBD
770
+
771
+ ### Slowest Gates
772
+
773
+ TBD
774
+
775
+ ### Documentation Gaps
776
+
777
+ TBD
778
+
779
+ ### Product Design Misses
780
+
781
+ TBD
782
+
783
+ ### Proposed Workflow Changes
784
+ TBD
609
785
  `;
610
786
  }
611
787
  function verificationMatrixTemplate(mode, options = {}) {
@@ -625,6 +801,7 @@ function verificationMatrixTemplate(mode, options = {}) {
625
801
  optionalToolsWarnOnly: true,
626
802
  artifactGate: options.artifactGate ?? (mode === 'critical' ? 'block' : 'warn'),
627
803
  artifactGateLevels: ['M', 'L', 'CRITICAL'],
804
+ engineeringStandardsGate: mode === 'minimal' ? 'warn' : 'block',
628
805
  },
629
806
  }, null, 2) + '\n';
630
807
  }
@@ -638,49 +815,49 @@ function packageVersion() {
638
815
  }
639
816
  }
640
817
  function githubActionsPreflightTemplate() {
641
- return `name: SCALE Preflight
642
-
643
- on:
644
- pull_request:
645
- push:
646
- branches:
647
- - main
648
- - master
649
-
650
- jobs:
651
- preflight:
652
- runs-on: ubuntu-latest
653
- steps:
654
- - name: Checkout
655
- uses: actions/checkout@v4
656
-
657
- - name: Setup Node.js
658
- uses: actions/setup-node@v4
659
- with:
660
- node-version: '20'
661
-
662
- - name: Install project dependencies when present
663
- shell: bash
664
- run: |
665
- if [ -f package-lock.json ]; then
666
- npm ci
667
- elif [ -f package.json ]; then
668
- npm install
669
- fi
670
-
671
- - name: Run SCALE preflight
672
- run: npx @hongmaple0820/scale-engine@latest preflight --service all --preflight-profile ci
818
+ return `name: SCALE Preflight
819
+
820
+ on:
821
+ pull_request:
822
+ push:
823
+ branches:
824
+ - main
825
+ - master
826
+
827
+ jobs:
828
+ preflight:
829
+ runs-on: ubuntu-latest
830
+ steps:
831
+ - name: Checkout
832
+ uses: actions/checkout@v4
833
+
834
+ - name: Setup Node.js
835
+ uses: actions/setup-node@v4
836
+ with:
837
+ node-version: '20'
838
+
839
+ - name: Install project dependencies when present
840
+ shell: bash
841
+ run: |
842
+ if [ -f package-lock.json ]; then
843
+ npm ci
844
+ elif [ -f package.json ]; then
845
+ npm install
846
+ fi
847
+
848
+ - name: Run SCALE preflight
849
+ run: npx @hongmaple0820/scale-engine@latest preflight --service all --preflight-profile ci
673
850
  `;
674
851
  }
675
852
  function prePushPreflightTemplate() {
676
- return `#!/usr/bin/env sh
677
- set -eu
678
-
679
- if command -v scale >/dev/null 2>&1; then
680
- scale preflight --service all
681
- else
682
- npx @hongmaple0820/scale-engine@latest preflight --service all
683
- fi
853
+ return `#!/usr/bin/env sh
854
+ set -eu
855
+
856
+ if command -v scale >/dev/null 2>&1; then
857
+ scale preflight --service all
858
+ else
859
+ npx @hongmaple0820/scale-engine@latest preflight --service all
860
+ fi
684
861
  `;
685
862
  }
686
863
  //# sourceMappingURL=GovernanceTemplates.js.map