@zigrivers/scaffold 3.22.0 → 3.24.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 (111) hide show
  1. package/README.md +44 -23
  2. package/content/knowledge/core/automated-review-tooling.md +3 -3
  3. package/content/knowledge/core/multi-model-review-dispatch.md +13 -4
  4. package/content/knowledge/data-science/README.md +23 -0
  5. package/content/knowledge/data-science/data-science-architecture.md +163 -0
  6. package/content/knowledge/data-science/data-science-conventions.md +233 -0
  7. package/content/knowledge/data-science/data-science-data-versioning.md +198 -0
  8. package/content/knowledge/data-science/data-science-dev-environment.md +159 -0
  9. package/content/knowledge/data-science/data-science-experiment-tracking.md +194 -0
  10. package/content/knowledge/data-science/data-science-model-evaluation.md +160 -0
  11. package/content/knowledge/data-science/data-science-notebook-discipline.md +170 -0
  12. package/content/knowledge/data-science/data-science-observability.md +161 -0
  13. package/content/knowledge/data-science/data-science-project-structure.md +178 -0
  14. package/content/knowledge/data-science/data-science-reproducibility.md +164 -0
  15. package/content/knowledge/data-science/data-science-requirements.md +151 -0
  16. package/content/knowledge/data-science/data-science-security.md +151 -0
  17. package/content/knowledge/data-science/data-science-testing.md +183 -0
  18. package/content/knowledge/ml/README.md +10 -0
  19. package/content/methodology/data-science-overlay.yml +39 -0
  20. package/content/pipeline/build/multi-agent-resume.md +7 -6
  21. package/content/pipeline/build/multi-agent-start.md +7 -6
  22. package/content/pipeline/build/single-agent-resume.md +7 -6
  23. package/content/pipeline/build/single-agent-start.md +7 -6
  24. package/content/pipeline/environment/automated-pr-review.md +79 -27
  25. package/content/skills/mmr/SKILL.md +72 -2
  26. package/content/skills/scaffold-runner/SKILL.md +65 -19
  27. package/content/tools/review-code.md +74 -16
  28. package/content/tools/review-pr.md +25 -6
  29. package/dist/cli/commands/check.d.ts.map +1 -1
  30. package/dist/cli/commands/check.js +28 -17
  31. package/dist/cli/commands/check.js.map +1 -1
  32. package/dist/config/schema.d.ts +672 -126
  33. package/dist/config/schema.d.ts.map +1 -1
  34. package/dist/config/schema.js +8 -0
  35. package/dist/config/schema.js.map +1 -1
  36. package/dist/config/schema.test.js +2 -2
  37. package/dist/config/schema.test.js.map +1 -1
  38. package/dist/config/validators/data-science.d.ts +4 -0
  39. package/dist/config/validators/data-science.d.ts.map +1 -0
  40. package/dist/config/validators/data-science.js +15 -0
  41. package/dist/config/validators/data-science.js.map +1 -0
  42. package/dist/config/validators/index.d.ts.map +1 -1
  43. package/dist/config/validators/index.js +2 -0
  44. package/dist/config/validators/index.js.map +1 -1
  45. package/dist/core/assembly/knowledge-loader.d.ts.map +1 -1
  46. package/dist/core/assembly/knowledge-loader.js +6 -0
  47. package/dist/core/assembly/knowledge-loader.js.map +1 -1
  48. package/dist/core/assembly/knowledge-loader.test.js +34 -0
  49. package/dist/core/assembly/knowledge-loader.test.js.map +1 -1
  50. package/dist/e2e/project-type-overlays.test.js +73 -0
  51. package/dist/e2e/project-type-overlays.test.js.map +1 -1
  52. package/dist/project/adopt.d.ts.map +1 -1
  53. package/dist/project/adopt.js +3 -1
  54. package/dist/project/adopt.js.map +1 -1
  55. package/dist/project/detectors/coverage.test.d.ts +2 -0
  56. package/dist/project/detectors/coverage.test.d.ts.map +1 -0
  57. package/dist/project/detectors/coverage.test.js +78 -0
  58. package/dist/project/detectors/coverage.test.js.map +1 -0
  59. package/dist/project/detectors/data-science.d.ts +4 -0
  60. package/dist/project/detectors/data-science.d.ts.map +1 -0
  61. package/dist/project/detectors/data-science.js +32 -0
  62. package/dist/project/detectors/data-science.js.map +1 -0
  63. package/dist/project/detectors/data-science.test.d.ts +2 -0
  64. package/dist/project/detectors/data-science.test.d.ts.map +1 -0
  65. package/dist/project/detectors/data-science.test.js +62 -0
  66. package/dist/project/detectors/data-science.test.js.map +1 -0
  67. package/dist/project/detectors/disambiguate.d.ts +2 -0
  68. package/dist/project/detectors/disambiguate.d.ts.map +1 -1
  69. package/dist/project/detectors/disambiguate.js +3 -2
  70. package/dist/project/detectors/disambiguate.js.map +1 -1
  71. package/dist/project/detectors/disambiguate.test.js +10 -1
  72. package/dist/project/detectors/disambiguate.test.js.map +1 -1
  73. package/dist/project/detectors/index.d.ts.map +1 -1
  74. package/dist/project/detectors/index.js +2 -0
  75. package/dist/project/detectors/index.js.map +1 -1
  76. package/dist/project/detectors/library.d.ts.map +1 -1
  77. package/dist/project/detectors/library.js +1 -0
  78. package/dist/project/detectors/library.js.map +1 -1
  79. package/dist/project/detectors/resolve-detection.test.js +31 -0
  80. package/dist/project/detectors/resolve-detection.test.js.map +1 -1
  81. package/dist/project/detectors/types.d.ts +6 -2
  82. package/dist/project/detectors/types.d.ts.map +1 -1
  83. package/dist/project/detectors/types.js.map +1 -1
  84. package/dist/types/config.d.ts +8 -1
  85. package/dist/types/config.d.ts.map +1 -1
  86. package/dist/wizard/copy/core.d.ts.map +1 -1
  87. package/dist/wizard/copy/core.js +4 -0
  88. package/dist/wizard/copy/core.js.map +1 -1
  89. package/dist/wizard/copy/data-science.d.ts +3 -0
  90. package/dist/wizard/copy/data-science.d.ts.map +1 -0
  91. package/dist/wizard/copy/data-science.js +15 -0
  92. package/dist/wizard/copy/data-science.js.map +1 -0
  93. package/dist/wizard/copy/index.d.ts.map +1 -1
  94. package/dist/wizard/copy/index.js +2 -0
  95. package/dist/wizard/copy/index.js.map +1 -1
  96. package/dist/wizard/copy/types.d.ts +5 -1
  97. package/dist/wizard/copy/types.d.ts.map +1 -1
  98. package/dist/wizard/copy/types.test-d.js +7 -0
  99. package/dist/wizard/copy/types.test-d.js.map +1 -1
  100. package/dist/wizard/questions.d.ts +2 -1
  101. package/dist/wizard/questions.d.ts.map +1 -1
  102. package/dist/wizard/questions.js +9 -1
  103. package/dist/wizard/questions.js.map +1 -1
  104. package/dist/wizard/questions.test.js +14 -0
  105. package/dist/wizard/questions.test.js.map +1 -1
  106. package/dist/wizard/wizard.d.ts.map +1 -1
  107. package/dist/wizard/wizard.js +1 -0
  108. package/dist/wizard/wizard.js.map +1 -1
  109. package/package.json +1 -1
  110. package/skills/mmr/SKILL.md +72 -2
  111. package/skills/scaffold-runner/SKILL.md +65 -19
@@ -14,10 +14,38 @@ Dispatch code reviews to multiple AI model CLIs, poll for results, and collect r
14
14
 
15
15
  ## Quick Reference
16
16
 
17
+ `mmr review` works for any review target — not just PRs. Pick the input mode
18
+ that matches what you want reviewed:
19
+
17
20
  ```bash
18
- # Dispatch a review for a PR
21
+ # GitHub PR (fetches diff via `gh pr diff`)
19
22
  mmr review --pr <number> --focus "description of what to focus on"
20
23
 
24
+ # Staged git changes (pre-commit review)
25
+ mmr review --staged --focus "..."
26
+
27
+ # All tracked uncommitted changes (staged + unstaged) — excludes untracked
28
+ # files; use `scaffold run review-code` for full-worktree coverage
29
+ git diff HEAD | mmr review --diff - --focus "..."
30
+
31
+ # Branch diff / ref range
32
+ mmr review --base main --head <branch> --focus "..."
33
+
34
+ # Changes to a specific tracked file since HEAD (pending edits only).
35
+ # If the file has no local changes this pipeline sends an empty diff
36
+ # and MMR will refuse with "no diff content"; use the next form instead
37
+ # to review the file's current contents regardless of git state.
38
+ git diff HEAD -- path/to/file.md | mmr review --diff - --focus "..."
39
+
40
+ # A file's current contents, regardless of git state (tracked-with-no-
41
+ # changes, untracked, or brand-new). Synthesizes an "all added" diff.
42
+ # `|| true` is required: diff exits 1 whenever files differ, which breaks
43
+ # pipelines under `set -o pipefail`.
44
+ (diff -u /dev/null path/to/file.md || true) | mmr review --diff - --focus "..."
45
+
46
+ # Existing patch or diff file
47
+ mmr review --diff path/to/changes.patch --focus "..."
48
+
21
49
  # Check progress
22
50
  mmr status <job-id>
23
51
 
@@ -28,7 +56,20 @@ mmr results <job-id>
28
56
  mmr config test
29
57
  ```
30
58
 
31
- ## After Creating a PR
59
+ All input modes accept `--focus`, `--sync`, `--format`, and `--fix-threshold`
60
+ the same way. The "3-channel review" is not PR-specific — it reviews whatever
61
+ diff you point it at.
62
+
63
+ **`--diff` contract:** the flag expects diff-format content (a path to a
64
+ `.patch`/`.diff` file, or `-` for stdin). It does not read raw document
65
+ content — wrap the target in a diff first (see the `git diff …` and
66
+ `(diff -u /dev/null … || true)` patterns above). The `|| true` guard is
67
+ required because `diff` exits 1 whenever files differ, which breaks
68
+ pipelines under `set -o pipefail`.
69
+
70
+ ## Common Workflows
71
+
72
+ **After creating a PR**
32
73
 
33
74
  1. Run `mmr review --pr <number>`
34
75
  2. Note the job ID from the output
@@ -38,6 +79,35 @@ mmr config test
38
79
  6. If gate failed: fix findings at or above the threshold severity
39
80
  7. If gate passed: proceed to merge
40
81
 
82
+ **Reviewing a document or arbitrary file**
83
+
84
+ Pick the case that matches what the user wants reviewed:
85
+
86
+ - **Just the pending edits** to a tracked file (what changed since last
87
+ commit): `git diff HEAD -- path/to/doc.md | mmr review --diff -
88
+ --focus "..."`. Fails with "no diff content" if the file has no
89
+ local changes.
90
+ - **The file's current contents**, whether it's tracked-with-no-
91
+ changes, untracked, or brand-new: wrap as a synthetic "all added"
92
+ diff first: `(diff -u /dev/null path/to/doc.md || true) |
93
+ mmr review --diff - --focus "..."`. The `|| true` guard avoids
94
+ `diff`'s exit-1-on-differences breaking the pipeline under
95
+ `set -o pipefail`.
96
+
97
+ Same dispatch / status / results flow as above.
98
+
99
+ **Reviewing uncommitted work before push**
100
+
101
+ 1. `git add` the files you want reviewed
102
+ 2. Run `mmr review --staged`
103
+ 3. Fix findings at or above the gate threshold, re-stage, re-run as needed
104
+
105
+ Prefer the wrapper tools (`scaffold run review-pr`, `scaffold run review-code`)
106
+ when they cover your target — they add auth checks, compensating passes, and
107
+ the agent-review channel on top of `mmr review`. Call `mmr review` directly
108
+ for targets the wrappers don't cover (docs, arbitrary diffs, ref ranges
109
+ outside `main`).
110
+
41
111
  ## Auth Failures
42
112
 
43
113
  If `mmr review` reports auth failures, follow the recovery instructions in the output:
@@ -202,9 +202,9 @@ When the user asks "what tools are available?", "what can I build?", or "show me
202
202
  | `scaffold run update` | Update scaffold to the latest version |
203
203
  | `scaffold run dashboard` | Open a visual progress dashboard in your browser |
204
204
  | `scaffold run prompt-pipeline` | Print the full pipeline reference table |
205
- | `scaffold run review-code` | Run all 3 code review channels on local code before commit or push |
206
- | `scaffold run review-pr` | Run all 3 code review channels (Codex CLI, Gemini CLI, Superpowers) on a PR |
207
- | `scaffold run post-implementation-review` | Full 3-channel codebase review after an AI agent completes all tasks |
205
+ | `scaffold run review-code` | Run all 3 CLI review channels (Codex CLI, Gemini CLI, Claude CLI) on tracked local code (committed branch diff + staged + unstaged — no untracked files) before commit or push, plus Superpowers code-reviewer as a complementary 4th channel |
206
+ | `scaffold run review-pr` | Run all 3 code review channels (Codex CLI, Gemini CLI, Claude CLI) on a PR, plus Superpowers code-reviewer as a complementary 4th channel |
207
+ | `scaffold run post-implementation-review` | Full codebase review (Codex CLI, Gemini CLI, Superpowers code-reviewer) after an AI agent completes all tasks |
208
208
  | `scaffold run session-analyzer` | Analyze Claude Code session logs for patterns and insights |
209
209
 
210
210
  **Display rules:**
@@ -240,7 +240,8 @@ Respond to these natural language requests:
240
240
  | "Is X applicable?" / "Do I need X?" | Run `scaffold check <step>` to detect platform and brownfield status |
241
241
  | "Set up memory" / "Configure AI memory" / "Add memory" | Run `scaffold run ai-memory-setup` — sets up modular rules, optional MCP memory server, and external context |
242
242
  | "Set up testing" / "Add Playwright" / "Add Maestro" | Run `scaffold run add-e2e-testing` — auto-detects web/mobile and configures the right framework(s) |
243
- | "Run multi-model review" / "Review stories with other models" | Run `scaffold run review-user-stories` at depth 5 (multi-model capabilities are now built into review-user-stories) |
243
+ | "Run multi-model review" / "Review X with all three models" | Route by target see [Multi-Model Review Routing](#multi-model-review-routing) |
244
+ | "Review stories with other models" | Run `scaffold run review-user-stories` at depth 5 (multi-model capabilities are built into review-user-stories) |
244
245
  | "Skip X" | Run `scaffold skip <step> --reason "<user's reason>"` |
245
246
  | "Skip X, Y, and Z" | Run `scaffold skip <step1> <step2> <step3> --reason "<reason>"` |
246
247
  | "What's left?" / "Show remaining" | Run `scaffold status --compact`, show only pending/in-progress steps |
@@ -338,28 +339,73 @@ scaffold check add-e2e-testing
338
339
 
339
340
  This is useful when the user asks "Do I need this step?" or when previewing which optional steps apply before running them.
340
341
 
342
+ ### Multi-Model Review Routing
343
+
344
+ When the user asks for a "multi-model review", "review this with all three models",
345
+ "run MMR on X", or similar — **do not assume the target is a PR**. Route based on
346
+ what the user is pointing at:
347
+
348
+ | Target | Command |
349
+ |---|---|
350
+ | GitHub PR (explicit number or current branch's PR) | `scaffold run review-pr [<PR#>]` |
351
+ | Local uncommitted / staged code, before commit or push | `scaffold run review-code` |
352
+ | Pending edits to a tracked file (changes since HEAD) | `git diff HEAD -- <path> \| mmr review --diff - --sync --format json` |
353
+ | Current contents of any file (tracked-with-no-changes, untracked, or brand-new) | `(diff -u /dev/null <path> \|\| true) \| mmr review --diff - --sync --format json` |
354
+ | A branch diff against main (or another ref) | `mmr review --base <ref> --head <ref> --sync --format json` |
355
+ | An existing patch or diff file | `mmr review --diff <path.patch> --sync --format json` |
356
+ | A diff piped from another command | `<cmd> \| mmr review --diff - --sync --format json` (stdin) |
357
+ | A user-story review specifically at depth 5 | `scaffold run review-user-stories` |
358
+
359
+ If the user's target is ambiguous ("review this with MMR"), ask once which of
360
+ the above applies — don't default to `review-pr` just because it's the most
361
+ common entry point. Doc reviews and uncommitted-work reviews are equally
362
+ first-class.
363
+
364
+ Pass `--focus "..."` to MMR when the user describes what to evaluate (clarity,
365
+ completeness, security, performance, etc.). See the `mmr` skill for all input
366
+ modes and flags.
367
+
368
+ **Note on `--diff`:** the flag requires diff-format content (path to a
369
+ `.patch`/`.diff` file, or `-` for stdin). To review a regular document or
370
+ source file, wrap it in a diff first using `git diff HEAD -- <path>`
371
+ (tracked) or `(diff -u /dev/null <path> || true)` (untracked — the
372
+ `|| true` guard is required because `diff` exits 1 whenever files
373
+ differ, which breaks pipelines under `set -o pipefail`) and pipe the
374
+ result into `mmr review --diff -`.
375
+
341
376
  ### Multi-Model Review at Depth 4-5
342
377
 
343
- All review and validation steps now support independent multi-model validation at depth 4-5 using Codex and/or Gemini CLIs. The `multi-model-dispatch` skill documents the correct invocation patterns:
378
+ All review and validation steps support independent multi-model validation at depth 4-5. Two distinct paths exist **never mix them** pick based on what step is running:
344
379
 
345
- - **Codex**: `codex exec --skip-git-repo-check -s read-only --ephemeral "prompt" 2>/dev/null` (NOT bare `codex`)
346
- - **Gemini**: `NO_BROWSER=true gemini -p "prompt" --output-format json --approval-mode yolo 2>/dev/null`
380
+ #### Path A: MMR-backed review (PREFERRED always use for these steps)
347
381
 
348
- **`NO_BROWSER=true` is required for all Gemini invocations** from Claude Code's Bash tool. Without it, Gemini's child process relaunch shows a consent prompt that hangs in non-TTY shells.
382
+ Applies to: `scaffold run review-pr`, `scaffold run review-code`, and any pipeline review step that invokes `mmr review` directly.
349
383
 
350
- **Auth verification is mandatory before dispatch.** CLI tokens expire mid-session. Before running any review at depth 4-5:
351
- 1. Check Codex auth: `codex login status`
352
- 2. Check Gemini auth: `NO_BROWSER=true gemini -p "respond with ok" -o json` (exit 41 = auth failure)
353
- 3. If auth fails, tell the user to re-authenticate: `! gemini -p "hello"` or `! codex login` (the `!` prefix runs it interactively with TTY access)
354
- 4. **Never silently skip a CLI due to auth failure** surface it to the user
384
+ - **Channel model:** three CLIs (Codex + Gemini + Claude) dispatched and reconciled by the MMR CLI; scaffold wrappers add the Superpowers code-reviewer agent as a complementary 4th channel reconciled into the same MMR job via `mmr reconcile`.
385
+ - **Note:** `scaffold run post-implementation-review` follows a different channel layout (raw-CLI dispatch of Codex + Gemini + Superpowers, with optional `mmr reconcile` injection if a prior `mmr review` job exists). Treat it as its own path — consult `content/tools/post-implementation-review.md` for specifics.
386
+ - **Invocation:** go through the wrapper (`scaffold run …`) or call `mmr review …` directly. Do NOT shell out to `codex`/`gemini`/`claude` yourself for these steps — MMR handles dispatch, parsing, compensating passes, and verdict.
387
+ - **Auth pre-flight:** run `mmr config test` once per session it probes all three CLIs and reports status in one call.
388
+ - **If auth fails** for any channel, surface recovery commands to the user: `! codex login`, `! gemini -p "hello"`, or `! claude login`. MMR will emit a compensating pass (via `claude -p`) for each missing external channel, labelled `[compensating: Codex-equivalent]` / `[compensating: Gemini-equivalent]`. Maximum achievable verdict in that case is `degraded-pass`.
389
+ - **Never silently skip a CLI due to auth failure** — surface it to the user.
390
+
391
+ #### Path B: Legacy / non-MMR direct dispatch
392
+
393
+ Applies to: some older depth-5 validation steps and any ad-hoc manual dispatch not routed through MMR. The `multi-model-dispatch` skill documents the raw invocation patterns:
394
+
395
+ - **Codex:** `codex exec --skip-git-repo-check -s read-only --ephemeral "prompt" 2>/dev/null` (NOT bare `codex`)
396
+ - **Gemini:** `NO_BROWSER=true gemini -p "prompt" --output-format json --approval-mode yolo 2>/dev/null`
397
+ - **Claude CLI:** `claude -p "prompt" --output-format json 2>/dev/null`
398
+
399
+ **`NO_BROWSER=true` is required for all Gemini invocations** from Claude Code's Bash tool. Without it, Gemini's child process relaunch shows a consent prompt that hangs in non-TTY shells.
355
400
 
356
- When running a review step at depth 4-5:
357
- 1. Check CLI availability before dispatching
358
- 2. If both available, run dual-model review for highest quality
359
- 3. If one available, run single-model external review
360
- 4. If neither available, fall back to Claude-only adversarial self-review
401
+ Auth pre-flight for Path B dispatch:
402
+ 1. Codex: `codex login status`
403
+ 2. Gemini: `NO_BROWSER=true gemini -p "respond with ok" -o json` (exit 41 = auth failure)
404
+ 3. Claude CLI: `claude -p "respond with ok"` (typically uses the active Claude Code session)
405
+ 4. If any fail: `! codex login`, `! gemini -p "hello"`, or `! claude login` (the `!` prefix runs it interactively with TTY access).
406
+ 5. **Never silently skip a CLI due to auth failure** — surface it to the user.
361
407
 
362
- The runner should surface the depth choice as a decision point for review steps, noting that depth 4-5 enables multi-model validation if CLIs are available.
408
+ The runner should surface the depth choice as a decision point for review steps, noting that depth 4-5 enables three-CLI multi-model validation when the CLIs are available.
363
409
 
364
410
  ## Batch Execution
365
411