@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
@@ -99,65 +99,65 @@ const PACKS = [
99
99
  },
100
100
  ];
101
101
  function workflowWrapper(label, scaleCommand) {
102
- return `#!/usr/bin/env bash
103
- set -euo pipefail
104
-
105
- is_wsl() {
106
- grep -qiE "(microsoft|wsl)" /proc/version /proc/sys/kernel/osrelease 2>/dev/null
107
- }
108
-
109
- is_windows_npm_shim() {
110
- local command_path="$1"
111
- printf '%s' "$command_path" | grep -qiE '^/mnt/[a-z]/.*nodejs/[^/]+$'
112
- }
113
-
114
- run_scale() {
115
- local scale_path=""
116
- scale_path="$(command -v scale 2>/dev/null || true)"
117
- if [ -n "$scale_path" ]; then
118
- if is_wsl && is_windows_npm_shim "$scale_path"; then
119
- echo "[scale-engine] Windows npm scale was detected inside WSL: $scale_path" >&2
120
- echo "[scale-engine] Use the matching PowerShell wrapper (*.ps1), or install scale-engine inside WSL with a Linux Node.js toolchain." >&2
121
- return 2
122
- fi
123
- scale "$@"
124
- else
125
- local npx_path=""
126
- npx_path="$(command -v npx 2>/dev/null || true)"
127
- if [ -n "$npx_path" ] && is_wsl && is_windows_npm_shim "$npx_path"; then
128
- echo "[scale-engine] Windows npm npx was detected inside WSL: $npx_path" >&2
129
- echo "[scale-engine] Use the matching PowerShell wrapper (*.ps1), or install Node.js/npm inside WSL." >&2
130
- return 2
131
- fi
132
- npx @hongmaple0820/scale-engine@latest "$@"
133
- fi
134
- }
135
-
136
- echo "[scale-engine] compatibility wrapper: scripts/${label}.sh -> scale ${scaleCommand}" >&2
137
- run_scale ${scaleCommand} "$@"
102
+ return `#!/usr/bin/env bash
103
+ set -euo pipefail
104
+
105
+ is_wsl() {
106
+ grep -qiE "(microsoft|wsl)" /proc/version /proc/sys/kernel/osrelease 2>/dev/null
107
+ }
108
+
109
+ is_windows_npm_shim() {
110
+ local command_path="$1"
111
+ printf '%s' "$command_path" | grep -qiE '^/mnt/[a-z]/.*nodejs/[^/]+$'
112
+ }
113
+
114
+ run_scale() {
115
+ local scale_path=""
116
+ scale_path="$(command -v scale 2>/dev/null || true)"
117
+ if [ -n "$scale_path" ]; then
118
+ if is_wsl && is_windows_npm_shim "$scale_path"; then
119
+ echo "[scale-engine] Windows npm scale was detected inside WSL: $scale_path" >&2
120
+ echo "[scale-engine] Use the matching PowerShell wrapper (*.ps1), or install scale-engine inside WSL with a Linux Node.js toolchain." >&2
121
+ return 2
122
+ fi
123
+ scale "$@"
124
+ else
125
+ local npx_path=""
126
+ npx_path="$(command -v npx 2>/dev/null || true)"
127
+ if [ -n "$npx_path" ] && is_wsl && is_windows_npm_shim "$npx_path"; then
128
+ echo "[scale-engine] Windows npm npx was detected inside WSL: $npx_path" >&2
129
+ echo "[scale-engine] Use the matching PowerShell wrapper (*.ps1), or install Node.js/npm inside WSL." >&2
130
+ return 2
131
+ fi
132
+ npx @hongmaple0820/scale-engine@latest "$@"
133
+ fi
134
+ }
135
+
136
+ echo "[scale-engine] compatibility wrapper: scripts/${label}.sh -> scale ${scaleCommand}" >&2
137
+ run_scale ${scaleCommand} "$@"
138
138
  `;
139
139
  }
140
140
  function powershellWorkflowWrapper(label, scaleCommand) {
141
141
  const commandParts = scaleCommand.split(/\s+/).filter(Boolean);
142
142
  const psArgs = commandParts.map(part => `'${part.replace(/'/g, "''")}'`).join(', ');
143
- return `$ErrorActionPreference = 'Stop'
144
-
145
- function Invoke-Scale {
146
- param([string[]]$ScaleArgs)
147
-
148
- if (Get-Command scale -ErrorAction SilentlyContinue) {
149
- & scale @ScaleArgs
150
- if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
151
- return
152
- }
153
-
154
- & npx @hongmaple0820/scale-engine@latest @ScaleArgs
155
- if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
156
- }
157
-
158
- [Console]::Error.WriteLine("[scale-engine] compatibility wrapper: scripts/${label}.ps1 -> scale ${scaleCommand}")
159
- $scaleArgs = @(${psArgs}) + $args
160
- Invoke-Scale -ScaleArgs $scaleArgs
143
+ return `$ErrorActionPreference = 'Stop'
144
+
145
+ function Invoke-Scale {
146
+ param([string[]]$ScaleArgs)
147
+
148
+ if (Get-Command scale -ErrorAction SilentlyContinue) {
149
+ & scale @ScaleArgs
150
+ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
151
+ return
152
+ }
153
+
154
+ & npx @hongmaple0820/scale-engine@latest @ScaleArgs
155
+ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
156
+ }
157
+
158
+ [Console]::Error.WriteLine("[scale-engine] compatibility wrapper: scripts/${label}.ps1 -> scale ${scaleCommand}")
159
+ $scaleArgs = @(${psArgs}) + $args
160
+ Invoke-Scale -ScaleArgs $scaleArgs
161
161
  `;
162
162
  }
163
163
  function moeWorkspaceGuide() {
@@ -173,17 +173,17 @@ MOE workspaces are multi-repository engineering environments where the root chec
173
173
 
174
174
  ## Required Finish Checks
175
175
 
176
- Before deleting an agent worktree or reporting a task complete:
177
-
178
- 1. Run \`scale workspace map --json\` to confirm the expected repositories are known.
179
- 2. Run \`scale workspace finish --summary\` for the short blocker list; use \`--json\` only when full audit detail is needed.
180
- 3. Commit and push child repository work in each repository's own remote.
181
- 4. Review whether the root repository needs a submodule pointer, lock file, integration metadata, or documentation update.
182
- 5. Run service-aware verification for every touched service.
183
-
184
- \`scale ship <task-id>\` performs the same child-repository boundary check before creating a root commit. Dirty or unpushed child repositories block shipping; raw \`git add .\` bypasses this protection and is not allowed for governed MOE workspaces.
185
-
186
- ## Branch Naming
176
+ Before deleting an agent worktree or reporting a task complete:
177
+
178
+ 1. Run \`scale workspace map --json\` to confirm the expected repositories are known.
179
+ 2. Run \`scale workspace finish --summary\` for the short blocker list; use \`--json\` only when full audit detail is needed.
180
+ 3. Commit and push child repository work in each repository's own remote.
181
+ 4. Review whether the root repository needs a submodule pointer, lock file, integration metadata, or documentation update.
182
+ 5. Run service-aware verification for every touched service.
183
+
184
+ \`scale ship <task-id>\` performs the same child-repository boundary check before creating a root commit. Dirty or unpushed child repositories block shipping; raw \`git add .\` bypasses this protection and is not allowed for governed MOE workspaces.
185
+
186
+ ## Branch Naming
187
187
 
188
188
  Use readable branches with author/platform/scope/date context, for example:
189
189
 
@@ -197,73 +197,73 @@ Protected branches such as \`main\` and \`master\` require explicit human author
197
197
  `;
198
198
  }
199
199
  function resourceGovernanceGuide() {
200
- return `# Resource Governance
201
-
202
- This project uses SCALE resource governance to keep generated outputs, maintained documentation, task evidence, media, and temporary files from collapsing into one unmanaged document pile.
203
-
204
- ## Source Of Truth
205
-
206
- - \`.scale/resource-policy.json\`: asset classes, retention rules, owners, module mapping, and size limits.
207
- - \`.scale/assets.json\`: explicit long-lived resource catalog and source-of-truth declarations.
208
- - \`docs/modules/\`: maintained module-level product, architecture, API, and operations documentation.
209
- - \`docs/decisions/\`: ADRs and superseded architecture decisions.
210
-
211
- ## Default Git Policy
212
-
213
- | Resource | Default policy |
214
- | --- | --- |
215
- | Module docs, standards, ADRs, contracts, reusable scripts | Commit |
216
- | Task worklog artifacts | Review before commit |
217
- | E2E reports, coverage, screenshots, videos, logs | Ignore or external artifact storage |
218
- | Temporary scripts and scratch files | Ignore and delete after settlement |
219
- | Large media | Git LFS or external storage |
220
-
221
- ## Required Finish Behavior
222
-
223
- Before reporting a M/L/CRITICAL task complete:
224
-
225
- 1. Run \`scale assets scan --json\`.
226
- 2. Run \`scale assets doctor --json\`.
227
- 3. Run \`scale assets settle --task-id <task-id> --artifact-dir <task-dir>\`.
228
- 4. Promote final product or architecture truth into maintained docs.
229
- 5. Keep raw reports, screenshots, videos, and logs out of Git unless they are deliberately promoted.
230
- 6. Delete or archive expired temporary files.
200
+ return `# Resource Governance
201
+
202
+ This project uses SCALE resource governance to keep generated outputs, maintained documentation, task evidence, media, and temporary files from collapsing into one unmanaged document pile.
203
+
204
+ ## Source Of Truth
205
+
206
+ - \`.scale/resource-policy.json\`: asset classes, retention rules, owners, module mapping, and size limits.
207
+ - \`.scale/assets.json\`: explicit long-lived resource catalog and source-of-truth declarations.
208
+ - \`docs/modules/\`: maintained module-level product, architecture, API, and operations documentation.
209
+ - \`docs/decisions/\`: ADRs and superseded architecture decisions.
210
+
211
+ ## Default Git Policy
212
+
213
+ | Resource | Default policy |
214
+ | --- | --- |
215
+ | Module docs, standards, ADRs, contracts, reusable scripts | Commit |
216
+ | Task worklog artifacts | Review before commit |
217
+ | E2E reports, coverage, screenshots, videos, logs | Ignore or external artifact storage |
218
+ | Temporary scripts and scratch files | Ignore and delete after settlement |
219
+ | Large media | Git LFS or external storage |
220
+
221
+ ## Required Finish Behavior
222
+
223
+ Before reporting a M/L/CRITICAL task complete:
224
+
225
+ 1. Run \`scale assets scan --json\`.
226
+ 2. Run \`scale assets doctor --json\`.
227
+ 3. Run \`scale assets settle --task-id <task-id> --artifact-dir <task-dir>\`.
228
+ 4. Promote final product or architecture truth into maintained docs.
229
+ 5. Keep raw reports, screenshots, videos, and logs out of Git unless they are deliberately promoted.
230
+ 6. Delete or archive expired temporary files.
231
231
  `;
232
232
  }
233
233
  function moduleDocsIndex() {
234
- return `# Module Documentation
235
-
236
- Use one directory per maintained module:
237
-
238
- \`\`\`text
239
- docs/modules/<module>/
240
- ├── README.md
241
- ├── product.md
242
- ├── architecture.md
243
- ├── api.md
244
- └── operations.md
245
- \`\`\`
246
-
247
- Keep task-specific drafts in \`docs/worklog/tasks/\`. Promote only final, durable decisions and user-facing behavior into module documentation.
234
+ return `# Module Documentation
235
+
236
+ Use one directory per maintained module:
237
+
238
+ \`\`\`text
239
+ docs/modules/<module>/
240
+ ├── README.md
241
+ ├── product.md
242
+ ├── architecture.md
243
+ ├── api.md
244
+ └── operations.md
245
+ \`\`\`
246
+
247
+ Keep task-specific drafts in \`docs/worklog/tasks/\`. Promote only final, durable decisions and user-facing behavior into module documentation.
248
248
  `;
249
249
  }
250
250
  function resourceGitignoreExample() {
251
- return `# SCALE resource governance runtime outputs
252
- .scale/tmp/
253
- .scale/reports/
254
- .scale/resource-reports/
255
- tmp/
256
- temp/
257
- test-results/
258
- playwright-report/
259
- coverage/
260
-
261
- # Raw generated media should be promoted deliberately or stored externally
262
- *.webm
263
- *.mp4
264
- *.mov
265
- *.wav
266
- *.mp3
251
+ return `# SCALE resource governance runtime outputs
252
+ .scale/tmp/
253
+ .scale/reports/
254
+ .scale/resource-reports/
255
+ tmp/
256
+ temp/
257
+ test-results/
258
+ playwright-report/
259
+ coverage/
260
+
261
+ # Raw generated media should be promoted deliberately or stored externally
262
+ *.webm
263
+ *.mp4
264
+ *.mov
265
+ *.wav
266
+ *.mp3
267
267
  `;
268
268
  }
269
269
  //# sourceMappingURL=GovernanceTemplatePacks.js.map
@@ -1,7 +1,7 @@
1
1
  import { type GovernancePackId } from './GovernanceTemplatePacks.js';
2
2
  import type { VerificationService } from './VerificationProfile.js';
3
3
  export type GovernanceMode = 'minimal' | 'standard' | 'critical';
4
- export type GovernanceArtifactTemplateName = 'explore.md' | 'mini-prd.md' | 'skill-plan.md' | 'skill-evidence.md' | 'ui-spec.md' | 'visual-review.md' | 'api-contract.md' | 'docs-impact.md' | 'resource-impact.md' | 'standards-impact.md' | 'architecture-review.md' | 'security-review.md' | 'db-change-plan.md' | 'e2e-plan.md' | 'plan.md' | 'verification.md' | 'review.md' | 'summary.md';
4
+ export type GovernanceArtifactTemplateName = 'explore.md' | 'mini-prd.md' | 'skill-plan.md' | 'skill-evidence.md' | 'ui-spec.md' | 'visual-review.md' | 'api-contract.md' | 'docs-impact.md' | 'resource-impact.md' | 'standards-impact.md' | 'architecture-review.md' | 'security-review.md' | 'db-change-plan.md' | 'e2e-plan.md' | 'product-smoke.md' | 'plan.md' | 'verification.md' | 'review.md' | 'summary.md';
5
5
  export interface GovernanceTemplateOptions {
6
6
  mode?: GovernanceMode;
7
7
  projectName?: string;