@omacode/micromanager 0.0.0-stage → 1.0.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.
- package/LICENSE +201 -0
- package/README.md +30 -2
- package/THIRD_PARTY.md +100 -0
- package/decider/.python-version +1 -0
- package/decider/README.md +35 -0
- package/decider/decider/__init__.py +1 -0
- package/decider/decider/server.py +327 -0
- package/decider/pyproject.toml +34 -0
- package/decider/uv.lock +1255 -0
- package/dist/agenda.js +51 -0
- package/dist/agents.js +58 -0
- package/dist/artifact/handoff.js +281 -0
- package/dist/ask.js +200 -0
- package/dist/backends.js +219 -0
- package/dist/backlog.js +414 -0
- package/dist/bench.js +427 -0
- package/dist/board.js +1 -0
- package/dist/brief.js +202 -0
- package/dist/browser.js +679 -0
- package/dist/budget.js +61 -0
- package/dist/catalog.js +187 -0
- package/dist/checkchange.js +145 -0
- package/dist/checkpoint.js +94 -0
- package/dist/cli.js +764 -0
- package/dist/comfy-gate.js +258 -0
- package/dist/compact.js +142 -0
- package/dist/config.js +344 -0
- package/dist/context/capture.js +1 -0
- package/dist/context/digest.js +1 -0
- package/dist/context/embed.js +1 -0
- package/dist/context/index.js +2 -0
- package/dist/context/ledger.js +1 -0
- package/dist/context/manager.js +1 -0
- package/dist/context/memory.js +1 -0
- package/dist/context/policy.js +1 -0
- package/dist/context/prices.js +1 -0
- package/dist/context/recall.js +1 -0
- package/dist/context/rules.js +1 -0
- package/dist/context/search.js +1 -0
- package/dist/context/status.js +1 -0
- package/dist/context/store.js +1 -0
- package/dist/context/summary.js +1 -0
- package/dist/context/tokens.js +1 -0
- package/dist/context/tools.js +1 -0
- package/dist/continuation.js +184 -0
- package/dist/contract.js +294 -0
- package/dist/contractround.js +178 -0
- package/dist/control.js +1 -0
- package/dist/creative-tools.js +237 -0
- package/dist/dataset.js +175 -0
- package/dist/decide.js +676 -0
- package/dist/decider.js +171 -0
- package/dist/design-shell.js +448 -0
- package/dist/design.js +1410 -0
- package/dist/desktop.js +44 -0
- package/dist/egress.js +156 -0
- package/dist/eval.js +60 -0
- package/dist/evolver.js +302 -0
- package/dist/features.js +193 -0
- package/dist/followups.js +32 -0
- package/dist/forms.js +195 -0
- package/dist/gate.js +108 -0
- package/dist/gatebox.js +46 -0
- package/dist/grants.js +189 -0
- package/dist/graph.js +65 -0
- package/dist/guard/index.js +1 -0
- package/dist/guard/wire.js +1 -0
- package/dist/helpers.js +85 -0
- package/dist/hooks.js +158 -0
- package/dist/image-models.js +117 -0
- package/dist/integration.js +3 -0
- package/dist/journal.js +1 -0
- package/dist/look.js +363 -0
- package/dist/memory.js +1 -0
- package/dist/mode.js +97 -0
- package/dist/native.js +3348 -0
- package/dist/nogit.js +259 -0
- package/dist/outcomes.js +148 -0
- package/dist/permission.js +35 -0
- package/dist/pick.js +89 -0
- package/dist/pipelines.js +262 -0
- package/dist/plan.js +641 -0
- package/dist/plandoc.js +211 -0
- package/dist/plugin.js +4736 -0
- package/dist/policy.js +58 -0
- package/dist/pools.js +1 -0
- package/dist/preview.js +274 -0
- package/dist/profile.js +165 -0
- package/dist/progress.js +1 -0
- package/dist/promote.js +313 -0
- package/dist/redact.js +1 -0
- package/dist/registry.js +179 -0
- package/dist/riskscore.js +126 -0
- package/dist/roles.js +1 -0
- package/dist/routing.js +1 -0
- package/dist/runner.js +1892 -0
- package/dist/sandbox.js +3 -0
- package/dist/sandboxgate.js +90 -0
- package/dist/scheduler.js +170 -0
- package/dist/services-main.js +131 -0
- package/dist/services.js +265 -0
- package/dist/session.js +241 -0
- package/dist/setup.js +423 -0
- package/dist/shell/decide.js +1 -0
- package/dist/shell/index.js +2 -0
- package/dist/shell/sandbox.js +1 -0
- package/dist/shell/wire.js +1 -0
- package/dist/skills.js +103 -0
- package/dist/state.js +1 -0
- package/dist/store.js +1 -0
- package/dist/switcher.js +1 -0
- package/dist/synth.js +418 -0
- package/dist/tools.js +477 -0
- package/dist/trials.js +223 -0
- package/dist/usage.js +1 -0
- package/dist/wait.js +167 -0
- package/dist/watchdog.js +476 -0
- package/dist/web-guidance.js +43 -0
- package/dist/which.js +20 -0
- package/dist/worktree/git.js +545 -0
- package/dist/writeguard.js +311 -0
- package/evolver/mm_evolve/__init__.py +1 -0
- package/evolver/mm_evolve/entry.py +3 -0
- package/evolver/mm_evolve/evaluator.py +119 -0
- package/evolver/mm_evolve/llm.py +76 -0
- package/evolver/mm_evolve/run.py +89 -0
- package/evolver/mm_evolve/spec.py +62 -0
- package/evolver/pyproject.toml +21 -0
- package/evolver/uv.lock +772 -0
- package/package.json +74 -4
- package/skills/THIRD_PARTY.md +58 -0
- package/skills/code-review/SKILL.md +46 -0
- package/skills/deck/SKILL.md +98 -0
- package/skills/deliberate/SKILL.md +39 -0
- package/skills/design/SKILL.md +150 -0
- package/skills/diagnosing-bugs/SKILL.md +75 -0
- package/skills/image/SKILL.md +66 -0
- package/skills/orchestrator/SKILL.md +107 -0
- package/skills/receiving-code-review/SKILL.md +36 -0
- package/skills/research/SKILL.md +18 -0
- package/skills/tdd/SKILL.md +56 -0
- package/skills/tdd/mocking.md +59 -0
- package/skills/tdd/tests.md +77 -0
- package/skills/verification-before-completion/SKILL.md +50 -0
- package/skills/video/SKILL.md +97 -0
- package/skills/web/SKILL.md +60 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: orchestrator
|
|
3
|
+
description: Run a pure multi-agent orchestration session using the 7 research-backed agent patterns, complexity-tiered model routing, background parallel lanes, and optional post-green optimization. Use when the user invokes /orchestrator, asks you to work strictly as orchestrator, or wants exploration, planning, building, optimization, and verification delegated across subagents.
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
metadata:
|
|
6
|
+
source: own
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Orchestrator
|
|
10
|
+
|
|
11
|
+
You are the architect and coordinator, not the builder. Every line of reading, writing, testing and reviewing you
|
|
12
|
+
do yourself is context lost from the one job that needs the whole picture: deciding what runs, on what model, in
|
|
13
|
+
what shape. The sections below are the workflow: role discipline, model routing, task-to-topology patterns.
|
|
14
|
+
|
|
15
|
+
## 1. Pure orchestrator role & non-blocking discipline
|
|
16
|
+
|
|
17
|
+
- Delegate, never do: exploration, research, planning, implementation, optimization and verification all go to
|
|
18
|
+
subagents. No bulk file reads, edits, or test runs in the main session; your context holds the task graph, the
|
|
19
|
+
worker reports, and the decisions.
|
|
20
|
+
- Before dispatching any writer, read the repo's pre-existing state through a quick `explore` worker: `git status`,
|
|
21
|
+
uncommitted changes, unfamiliar edits. Never overwrite or revert user changes you did not cause — route around
|
|
22
|
+
them and say so in the briefs.
|
|
23
|
+
- Launch parallel and long-running subagents with `background: true` so the user's TUI stays responsive and the
|
|
24
|
+
user can steer mid-run.
|
|
25
|
+
- Never poll, sleep, or re-check a running background worker, and never duplicate a running worker's work in your
|
|
26
|
+
own context. After dispatching, end the turn concisely and wait for the completion notifications.
|
|
27
|
+
|
|
28
|
+
## 2. Complexity-tiered model routing
|
|
29
|
+
|
|
30
|
+
- Look up exact `providerID/modelID` strings once via `tools.opencode.models` when uncertain; never guess model IDs.
|
|
31
|
+
- **Standard / affordable pool** — `opencode-go` Flash & mid-tier; the default for 80–90% of subagents:
|
|
32
|
+
- Low–medium work (`explore`, `research`, mechanical edits, docs, test runs, verification):
|
|
33
|
+
`opencode-go/deepseek-v4.1-flash`, `opencode-go/minimax-m3.1-flash`, `opencode-go/glm-5.3-flash`,
|
|
34
|
+
`opencode-go/mimo-v2.6-flash`.
|
|
35
|
+
- Medium work (`tui`/TSX, multi-file logic, refactors, audits):
|
|
36
|
+
`opencode-go/qwen3.8-flash`, `opencode-go/mimo-v2.6-pro`, `opencode-go/deepseek-v4-pro`,
|
|
37
|
+
`opencode-go/qwen3.7-plus`.
|
|
38
|
+
- **Excluded expensive `opencode-go` models** — never select unless the user explicitly asks:
|
|
39
|
+
`opencode-go/kimi-k3.1-pro`, `opencode-go/kimi-k3`, `opencode-go/qwen4-max`, `opencode-go/step-5`,
|
|
40
|
+
`opencode-go/gemini-4-argon`, `opencode-go/grok-4.7`, `opencode-go/glm-5.4`.
|
|
41
|
+
- **Frontier / heavy reserve** — ONLY for tricky concurrency, complex state machines, subtle invariants, or
|
|
42
|
+
Frontier Plan Councils where Flash models are unreliable: `kimi-code-plan-global/k3.1-pro` (`kimi.ai` coding
|
|
43
|
+
plan) and `google/gemini-4-carbon`. If one hits a rate or quota limit, fall back cleanly to the other.
|
|
44
|
+
|
|
45
|
+
## 3. Task-to-topology routing: the 7 research-backed patterns
|
|
46
|
+
|
|
47
|
+
**Guardrail — avoid the sequential penalty and over-fragmentation.** Never split a small bug fix (1–2 files) or a
|
|
48
|
+
tightly coupled sequential chain (step N+1 mutates step N's code) across multiple chained builders: serial handoffs
|
|
49
|
+
degrade accuracy by −39% to −70%. Coalesce coupled sequential steps into **one cohesive worker lane**; one
|
|
50
|
+
capable worker beats a pipeline of fragments.
|
|
51
|
+
|
|
52
|
+
**Pattern 1 — Separate builder and verifier.** Never rely on same-session self-review for non-trivial changes.
|
|
53
|
+
Dispatch a read-only verifier subagent in a **fresh context** and a **different model family** than the builder —
|
|
54
|
+
that is what defeats self-preference bias. Skip LLM review rituals when the change is tiny and deterministic
|
|
55
|
+
tests/typechecks already prove correctness.
|
|
56
|
+
|
|
57
|
+
**Pattern 2 — Split work into parallel lanes with strictly disjoint `files[]`.** Fan out parallel `background:
|
|
58
|
+
true` writers **only** along provably non-overlapping file lists, and state the boundary in each brief:
|
|
59
|
+
`You MAY ONLY edit: [...]`. Define shared types and schemas first so lanes converge without touching each other's
|
|
60
|
+
files — overlapping edits drop success ~30%. If two lanes share a file, they are not parallel: coalesce or chain
|
|
61
|
+
them.
|
|
62
|
+
|
|
63
|
+
**Pattern 3 — Best of N with automated evals.** On a hard algorithmic bug or tricky implementation **that has a
|
|
64
|
+
fast, objective test or benchmark**: spawn 2–3 diverse cheap Flash workers in isolated worktrees or temp dirs,
|
|
65
|
+
run the automated check, pick the winner, discard the rest. Never run Best-of-N without an objective evaluator —
|
|
66
|
+
without one there is no basis to pick, and the loop just costs N×.
|
|
67
|
+
|
|
68
|
+
**Pattern 4 — Council of models (pool-selectable).** When **no automated test exists yet** (system architecture,
|
|
69
|
+
design trade-offs, UX):
|
|
70
|
+
|
|
71
|
+
1. *Scout once* with 1 cheap Flash `explore` worker to gather the repo facts, so each proposer does not pay N×
|
|
72
|
+
tool-exploration overhead.
|
|
73
|
+
2. *Propose in parallel* across 2–3 **distinct model families** from the active pool: Frontier families when the
|
|
74
|
+
decision is high-stakes and available; diverse Flash families when budget-constrained. Give every proposer the
|
|
75
|
+
identical scout brief.
|
|
76
|
+
3. *Synthesize blind*: present the proposals as `Proposal A / B / C` without model labels, compare on merit, and
|
|
77
|
+
merge into one crisp plan with disjoint `files[]` lanes before dispatching any builder. When scoring or
|
|
78
|
+
evaluating existing artifacts (rather than proposing), a 3-family Flash jury is >7× cheaper and sufficient.
|
|
79
|
+
|
|
80
|
+
**Pattern 5 — Team of specialist reviewers.** For complex or multi-dimensional diffs, run 2–3 parallel read-only
|
|
81
|
+
Flash reviewers, each with **one orthogonal lens** — *Correctness & state invariants*, *Security / sandbox /
|
|
82
|
+
secrets*, *Simplicity & hot-path performance*, *UX* — instead of handing duplicates the same generic checklist.
|
|
83
|
+
Orthogonal lenses find ~35% more defects.
|
|
84
|
+
|
|
85
|
+
**Pattern 6 — Pass instructions verbatim + structured handoffs.** Every worker brief carries a
|
|
86
|
+
`User constraints (verbatim):` block — the user's own wording, exclusions, and placeholders (`PERSON_n`,
|
|
87
|
+
`SECRET_n`, …) untouched; paraphrase is where constraints die. Below it, hand over the concrete upstream results:
|
|
88
|
+
`FILES` (paths with line refs), `INTERFACES` (types and signatures already decided), `DECISIONS` (settled
|
|
89
|
+
trade-offs). Workers must never burn turns re-reading the repo you already explored.
|
|
90
|
+
|
|
91
|
+
**Pattern 7 — Super Team loop (+ optional post-green optimization step).** Reserve the full loop — *Scout → Blind
|
|
92
|
+
Council → Parallel Lanes + Verifier → Optional Post-Green Optimizer → Specialist Reviewers* — for high-complexity
|
|
93
|
+
builds, and no smaller task. Cap it at **max 2 review-fix iterations**, each driven by concrete stopping criteria
|
|
94
|
+
(`file:line` findings or named failing tests); after the cap, escalate to the user instead of looping.
|
|
95
|
+
|
|
96
|
+
- **Optional post-green optimization pass:** once the functional checks are green and optimization is desired, run
|
|
97
|
+
a dedicated optimizer worker against the green state: eliminate redundant passes, quadratic (O(n²)) scans,
|
|
98
|
+
needless allocations, or dead code. Accept its change **only if all tests and typechecks remain green and
|
|
99
|
+
complexity or latency measurably improved**; discard it cleanly and keep the green state if not.
|
|
100
|
+
|
|
101
|
+
## Picking a topology
|
|
102
|
+
|
|
103
|
+
- Tiny, deterministic fix → one worker plus the tests; no ceremony.
|
|
104
|
+
- Multi-file build with independent pieces → Pattern 2 lanes + Pattern 1 verifier.
|
|
105
|
+
- Hard problem with an objective evaluator → Pattern 3.
|
|
106
|
+
- Hard decision with no test → Pattern 4, then dispatch by Pattern 2.
|
|
107
|
+
- High-complexity build → Pattern 7, which contains the others.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: receiving-code-review
|
|
3
|
+
description: Use when a micromanager fix round brings review findings, before changing anything - requires checking each finding against the code, not blind implementation or performative agreement.
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
source: https://github.com/obra/superpowers/blob/8ca22dba9a94f28898bbce59f2537ff4d87c747d/skills/receiving-code-review/SKILL.md
|
|
7
|
+
adapted: for a micromanager worker; findings come from a reviewer of another model family through the plugin
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Receiving Code Review
|
|
11
|
+
|
|
12
|
+
Review findings ask for technical evaluation, not agreement. Verify before implementing.
|
|
13
|
+
|
|
14
|
+
## For each finding
|
|
15
|
+
|
|
16
|
+
1. **Read** all findings first; they may be related.
|
|
17
|
+
2. **Restate** what each one asks for, in your own words.
|
|
18
|
+
3. **Verify** it against the code: is it true here? Run the input or command it names.
|
|
19
|
+
4. **Decide**: correct for this codebase, or wrong? The reviewer saw only the diff and the task.
|
|
20
|
+
5. **Fix** the correct ones one at a time, blocking issues first, then simple fixes, then complex ones; run the
|
|
21
|
+
checks after each.
|
|
22
|
+
|
|
23
|
+
## When a finding is wrong
|
|
24
|
+
|
|
25
|
+
Do not implement it. Say why in your report under `OPEN`, with evidence: the command, the line, the reason
|
|
26
|
+
(it breaks existing behaviour, the reviewer lacks context, the feature is unused, it contradicts a decision in the
|
|
27
|
+
brief). If you cannot tell whether a finding is right, say what you would need to check it.
|
|
28
|
+
|
|
29
|
+
## When it is unclear
|
|
30
|
+
|
|
31
|
+
If a finding is unclear, fix nothing that depends on it and report `STATUS: NEEDS_CONTEXT` naming the unclear
|
|
32
|
+
items. Partial understanding means a wrong fix.
|
|
33
|
+
|
|
34
|
+
## No performance
|
|
35
|
+
|
|
36
|
+
No "You're absolutely right!", no thanks, no praise. State what you changed and where, or why you did not.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: research
|
|
3
|
+
description: Answer a research question from primary sources and cite every claim. Use when a micromanager task asks you to research something, or a note starts with "[micromanager] research for task".
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
source: https://github.com/mattpocock/skills/blob/24fe0ef7737efae15c87225755e9f6f5965e4888/skills/engineering/research/SKILL.md
|
|
7
|
+
adapted: for a micromanager worker, which reads itself instead of starting a background agent
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Research
|
|
11
|
+
|
|
12
|
+
You are one reader of a research task. Do the reading yourself; never start other agents.
|
|
13
|
+
|
|
14
|
+
1. Investigate the question against **primary sources**: official docs, source code, specs, first-party APIs, the
|
|
15
|
+
paper itself. Not a secondary write-up of them. Follow every claim back to the source that owns it.
|
|
16
|
+
2. Give the URL for every finding, the exact page, not the site's home page. A finding without a URL is left out.
|
|
17
|
+
3. Say what stayed unclear or where the sources disagree, with both URLs.
|
|
18
|
+
4. Change no files. If the brief says you are one of several readers, keep to your angle; the others cover the rest.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tdd
|
|
3
|
+
description: Test-driven development. Use when a micromanager task is built test-first, the brief mentions frozen tests or a red stage, or you fix a bug and need a regression test.
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
source: https://github.com/mattpocock/skills/blob/24fe0ef7737efae15c87225755e9f6f5965e4888/skills/engineering/tdd/SKILL.md
|
|
7
|
+
adapted: for a micromanager worker; the seams come from the brief, nobody is asked; tests.md and mocking.md unchanged
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Test-Driven Development
|
|
11
|
+
|
|
12
|
+
TDD is the red → green loop. This skill is the reference that makes that loop produce tests worth keeping: what a good
|
|
13
|
+
test is, where tests go, the anti-patterns, and the rules of the loop. Consult every section before and during the
|
|
14
|
+
loop, not after.
|
|
15
|
+
|
|
16
|
+
When exploring the codebase, read `GLOSSARY.md` (if it exists) so test names and interface vocabulary match the
|
|
17
|
+
project's domain language, and respect ADRs in the area you're touching.
|
|
18
|
+
|
|
19
|
+
## What a good test is
|
|
20
|
+
|
|
21
|
+
Tests verify behavior through public interfaces, not implementation details. Code can change entirely; tests
|
|
22
|
+
shouldn't. A good test reads like a specification: "user can checkout with valid cart" tells you exactly what
|
|
23
|
+
capability exists, and it survives refactors because it doesn't care about internal structure.
|
|
24
|
+
|
|
25
|
+
See [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.
|
|
26
|
+
|
|
27
|
+
## Seams: where tests go
|
|
28
|
+
|
|
29
|
+
A **seam** is the public boundary you test at: the interface where you observe behavior without reaching inside.
|
|
30
|
+
Tests live at seams, never against internals.
|
|
31
|
+
|
|
32
|
+
**Test only at the seams the brief names.** The task's acceptance points and its description say what the public
|
|
33
|
+
interface is. Test there. If the brief names no seam and the interface is unclear, do not invent one: report
|
|
34
|
+
`STATUS: NEEDS_CONTEXT` and say which seam you would need decided.
|
|
35
|
+
|
|
36
|
+
## Anti-patterns
|
|
37
|
+
|
|
38
|
+
- **Implementation-coupled**: mocks internal collaborators, tests private methods, or verifies through a side
|
|
39
|
+
channel (querying the database instead of using the interface). The tell: the test breaks when you refactor but
|
|
40
|
+
behavior hasn't changed.
|
|
41
|
+
- **Tautological**: the assertion recomputes the expected value the way the code does (`expect(add(a, b)).toBe(a + b)`,
|
|
42
|
+
a snapshot derived by hand the same way, a constant asserted equal to itself), so it passes by construction and
|
|
43
|
+
can never disagree with the code. Expected values must come from an independent source of truth: a known-good
|
|
44
|
+
literal, a worked example, the spec.
|
|
45
|
+
- **Imagined behavior**: tests for things the acceptance points do not ask for. Test what the task promises, nothing
|
|
46
|
+
speculative.
|
|
47
|
+
|
|
48
|
+
## Rules of the loop
|
|
49
|
+
|
|
50
|
+
- **Red before green.** Write the failing test first, run it, and see it fail for the right reason: the missing
|
|
51
|
+
behavior, not a typo or an import error. Then write only enough code to pass it.
|
|
52
|
+
- **Frozen tests stay frozen.** When the brief says tests are frozen, the plugin checks their content: make them
|
|
53
|
+
pass by changing the code, never the tests. If a frozen test is wrong, report it (`STATUS: BLOCKED`) instead of
|
|
54
|
+
editing it.
|
|
55
|
+
- **One slice at a time.** One seam, one test, one minimal implementation per cycle.
|
|
56
|
+
- **Refactoring is not part of the loop.** It belongs to the review stage, not the red → green cycle.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# When to Mock
|
|
2
|
+
|
|
3
|
+
Mock at **system boundaries** only:
|
|
4
|
+
|
|
5
|
+
- External APIs (payment, email, etc.)
|
|
6
|
+
- Databases (sometimes - prefer test DB)
|
|
7
|
+
- Time/randomness
|
|
8
|
+
- File system (sometimes)
|
|
9
|
+
|
|
10
|
+
Don't mock:
|
|
11
|
+
|
|
12
|
+
- Your own classes/modules
|
|
13
|
+
- Internal collaborators
|
|
14
|
+
- Anything you control
|
|
15
|
+
|
|
16
|
+
## Designing for Mockability
|
|
17
|
+
|
|
18
|
+
At system boundaries, design interfaces that are easy to mock:
|
|
19
|
+
|
|
20
|
+
**1. Use dependency injection**
|
|
21
|
+
|
|
22
|
+
Pass external dependencies in rather than creating them internally:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
// Easy to mock
|
|
26
|
+
function processPayment(order, paymentClient) {
|
|
27
|
+
return paymentClient.charge(order.total);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Hard to mock
|
|
31
|
+
function processPayment(order) {
|
|
32
|
+
const client = new StripeClient(process.env.STRIPE_KEY);
|
|
33
|
+
return client.charge(order.total);
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**2. Prefer SDK-style interfaces over generic fetchers**
|
|
38
|
+
|
|
39
|
+
Create specific functions for each external operation instead of one generic function with conditional logic:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
// GOOD: Each function is independently mockable
|
|
43
|
+
const api = {
|
|
44
|
+
getUser: (id) => fetch(`/users/${id}`),
|
|
45
|
+
getOrders: (userId) => fetch(`/users/${userId}/orders`),
|
|
46
|
+
createOrder: (data) => fetch('/orders', { method: 'POST', body: data }),
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// BAD: Mocking requires conditional logic inside the mock
|
|
50
|
+
const api = {
|
|
51
|
+
fetch: (endpoint, options) => fetch(endpoint, options),
|
|
52
|
+
};
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The SDK approach means:
|
|
56
|
+
- Each mock returns one specific shape
|
|
57
|
+
- No conditional logic in test setup
|
|
58
|
+
- Easier to see which endpoints a test exercises
|
|
59
|
+
- Type safety per endpoint
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Good and Bad Tests
|
|
2
|
+
|
|
3
|
+
## Good Tests
|
|
4
|
+
|
|
5
|
+
**Integration-style**: Test through real interfaces, not mocks of internal parts.
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
// GOOD: Tests observable behavior
|
|
9
|
+
test("user can checkout with valid cart", async () => {
|
|
10
|
+
const cart = createCart();
|
|
11
|
+
cart.add(product);
|
|
12
|
+
const result = await checkout(cart, paymentMethod);
|
|
13
|
+
expect(result.status).toBe("confirmed");
|
|
14
|
+
});
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Characteristics:
|
|
18
|
+
|
|
19
|
+
- Tests behavior users/callers care about
|
|
20
|
+
- Uses public API only
|
|
21
|
+
- Survives internal refactors
|
|
22
|
+
- Describes WHAT, not HOW
|
|
23
|
+
- One logical assertion per test
|
|
24
|
+
|
|
25
|
+
## Bad Tests
|
|
26
|
+
|
|
27
|
+
**Implementation-detail tests**: Coupled to internal structure.
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
// BAD: Tests implementation details
|
|
31
|
+
test("checkout calls paymentService.process", async () => {
|
|
32
|
+
const mockPayment = jest.mock(paymentService);
|
|
33
|
+
await checkout(cart, payment);
|
|
34
|
+
expect(mockPayment.process).toHaveBeenCalledWith(cart.total);
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Red flags:
|
|
39
|
+
|
|
40
|
+
- Mocking internal collaborators
|
|
41
|
+
- Testing private methods
|
|
42
|
+
- Asserting on call counts/order
|
|
43
|
+
- Test breaks when refactoring without behavior change
|
|
44
|
+
- Test name describes HOW not WHAT
|
|
45
|
+
- Verifying through external means instead of interface
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
// BAD: Bypasses interface to verify
|
|
49
|
+
test("createUser saves to database", async () => {
|
|
50
|
+
await createUser({ name: "Alice" });
|
|
51
|
+
const row = await db.query("SELECT * FROM users WHERE name = ?", ["Alice"]);
|
|
52
|
+
expect(row).toBeDefined();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// GOOD: Verifies through interface
|
|
56
|
+
test("createUser makes user retrievable", async () => {
|
|
57
|
+
const user = await createUser({ name: "Alice" });
|
|
58
|
+
const retrieved = await getUser(user.id);
|
|
59
|
+
expect(retrieved.name).toBe("Alice");
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Tautological tests**: Expected value restates the implementation, so the test passes by construction.
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
// BAD: Expected value is recomputed the way the code computes it
|
|
67
|
+
test("calculateTotal sums line items", () => {
|
|
68
|
+
const items = [{ price: 10 }, { price: 5 }];
|
|
69
|
+
const expected = items.reduce((sum, i) => sum + i.price, 0);
|
|
70
|
+
expect(calculateTotal(items)).toBe(expected);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// GOOD: Expected value is an independent, known literal
|
|
74
|
+
test("calculateTotal sums line items", () => {
|
|
75
|
+
expect(calculateTotal([{ price: 10 }, { price: 5 }])).toBe(15);
|
|
76
|
+
});
|
|
77
|
+
```
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verification-before-completion
|
|
3
|
+
description: Use when about to report a micromanager task as done, fixed or passing - requires running the verification commands and reading their output before any success claim; evidence before assertions always.
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
source: https://github.com/obra/superpowers/blob/8ca22dba9a94f28898bbce59f2537ff4d87c747d/skills/verification-before-completion/SKILL.md
|
|
7
|
+
adapted: for a micromanager worker; the evidence goes into the report's EVIDENCE line
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Verification Before Completion
|
|
11
|
+
|
|
12
|
+
**Core principle:** evidence before claims, always. The plugin runs the task's checks after you anyway; a report that
|
|
13
|
+
claims more than you ran costs a fix round.
|
|
14
|
+
|
|
15
|
+
## The Iron Law
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
If you haven't run the verification command in this answer, you cannot claim it passes.
|
|
22
|
+
|
|
23
|
+
## The gate
|
|
24
|
+
|
|
25
|
+
Before `STATUS: DONE` or any claim of success:
|
|
26
|
+
1. **Identify** the command that proves the claim (the acceptance point's "checked with" command, if it has one).
|
|
27
|
+
2. **Run** the full command, fresh.
|
|
28
|
+
3. **Read** the full output: exit code, number of failures.
|
|
29
|
+
4. **Verify**: does the output confirm the claim? If not, report the actual state with the evidence.
|
|
30
|
+
5. Only then claim it, and put the command and its result in `EVIDENCE`.
|
|
31
|
+
|
|
32
|
+
## What a claim needs
|
|
33
|
+
|
|
34
|
+
| Claim | Requires | Not sufficient |
|
|
35
|
+
|-------|----------|----------------|
|
|
36
|
+
| Tests pass | test output: 0 failures | an earlier run, "should pass" |
|
|
37
|
+
| Linter clean | linter output: 0 errors | a partial check |
|
|
38
|
+
| Build succeeds | build command: exit 0 | linter passing |
|
|
39
|
+
| Bug fixed | the original symptom tested: passes | code changed, assumed fixed |
|
|
40
|
+
| Regression test works | red-green cycle seen | it passes once |
|
|
41
|
+
| Acceptance met | each point checked, one by one | tests passing |
|
|
42
|
+
|
|
43
|
+
## Red flags: stop
|
|
44
|
+
|
|
45
|
+
- "should", "probably", "seems to";
|
|
46
|
+
- satisfaction before verification ("Done!", "Perfect!");
|
|
47
|
+
- a partial check taken for the whole;
|
|
48
|
+
- any wording that implies success without a command you ran in this answer.
|
|
49
|
+
|
|
50
|
+
If you cannot run the command (no shell in this task), say so in `EVIDENCE` and use `DONE_WITH_CONCERNS`.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: video
|
|
3
|
+
description: Build and check a short video with the video adapter (HyperFrames), including math animations made with Manim. Use when a task produces a video, an explainer clip, an animation for a website or a talk, or when a video has to pass its checks.
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
metadata:
|
|
6
|
+
source: own
|
|
7
|
+
verified_against: hyperframes 0.9.54 (render, check, lint, snapshot), manim 0.22.1, packages/artifact/src/adapters/video.ts
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Video
|
|
11
|
+
|
|
12
|
+
A video is data first: a `VideoSpec` (version 2) of scenes, each a few seconds long. The video adapter writes it as a
|
|
13
|
+
HyperFrames project, renders it to one file, and checks the file's frames and sound. Your job is the spec and the
|
|
14
|
+
material the scenes show (pictures, clips, Manim animations), not the HTML.
|
|
15
|
+
|
|
16
|
+
## What the spec says
|
|
17
|
+
|
|
18
|
+
A complete `video.json`; every field below except `audio` and `output` is required:
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"kind": "video",
|
|
23
|
+
"version": 2,
|
|
24
|
+
"job": "pythagoras",
|
|
25
|
+
"brief": "A 12-second explainer of the Pythagorean theorem for the project website",
|
|
26
|
+
"engine": "hyperframes",
|
|
27
|
+
"fps": 30,
|
|
28
|
+
"size": { "width": 1280, "height": 720 },
|
|
29
|
+
"scenes": [
|
|
30
|
+
{ "id": "intro", "title": "Pythagoras", "duration": 3, "captions": ["Why a² + b² = c²"] },
|
|
31
|
+
{ "id": "proof", "title": "The squares", "duration": 6, "asset": "clips/Squares.mp4", "captions": ["Rearrange the four triangles"] },
|
|
32
|
+
{ "id": "outro", "title": "That's it", "duration": 3, "captions": ["a² + b² = c²"] }
|
|
33
|
+
],
|
|
34
|
+
"output": { "format": "mp4", "quality": "medium" }
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
- `scenes[]`: `id` (letters, digits, `.`, `_`, `-`; unique), `duration` in seconds (> 0), and optionally `title`,
|
|
39
|
+
`captions` (lines shown on screen, in the pixels, not a subtitle track), `asset` (a picture or a clip, relative to
|
|
40
|
+
the job directory: `.mp4`, `.webm`, `.mov` play muted in a loop, anything else is shown as an image) and
|
|
41
|
+
`acceptance` (one line each: what the scene has to show, for the review).
|
|
42
|
+
- The film lasts exactly as long as the scenes together. A clip starts with its scene; one longer than its scene is
|
|
43
|
+
cut, a shorter one holds its last frame until the scene ends. A clip plays muted (the film's sound is `audio`).
|
|
44
|
+
- `audio`: `{ "src": "music/bed.mp3", "volume": 0.6 }`, one bed under the whole film (0 to 1).
|
|
45
|
+
- `output.format`: `webm` (the default, no patent questions) or `mp4` (plays everywhere, also in Safari);
|
|
46
|
+
`quality`: `low`, `medium` or `high`. The file is `video.webm` or `video.mp4` in the job directory.
|
|
47
|
+
- Every asset and the audio bed must exist before the build: a missing file is a refusal, not a placeholder.
|
|
48
|
+
- The render runs offline: system fonts only, nothing fetched.
|
|
49
|
+
|
|
50
|
+
Build with `make_artifact` (`spec: video.json`). The video needs HyperFrames and ffmpeg; if one is missing the tool says
|
|
51
|
+
so: offer `install_feature` for HyperFrames, and give the user the terminal command for ffmpeg (it needs sudo).
|
|
52
|
+
|
|
53
|
+
## Math animations with Manim
|
|
54
|
+
|
|
55
|
+
Manim makes the clip, the video adapter puts it in a scene. Render into the job directory, then name the file as the
|
|
56
|
+
scene's `asset`:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
manim render -qm --media_dir media scenes.py Squares # -ql while trying, -qh for the final
|
|
60
|
+
mkdir -p clips && cp media/videos/scenes/720p30/Squares.mp4 clips/
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- `-ql` 480p15, `-qm` 720p30, `-qh` 1080p60: match the video's `size` and `fps` where you can.
|
|
64
|
+
- LaTeX is not installed: `Tex` and `MathTex` fail. Use `Text` (Unicode works: `Text("a² + b² = c²")`), shapes and
|
|
65
|
+
`MathTex`-free animations, or tell the user LaTeX is needed (`sudo pacman -S texlive-core` or their distribution's
|
|
66
|
+
equivalent) before you use it.
|
|
67
|
+
- Keep a Manim scene about as long as the video scene it fills: a longer clip is cut, a shorter one holds its last
|
|
68
|
+
frame.
|
|
69
|
+
- Set the Manim background to the video's (`self.camera.background_color = "#101014"` in `construct`), so the clip
|
|
70
|
+
does not sit in a black box.
|
|
71
|
+
- If `manim` is not found, offer `install_feature` with part `manim`.
|
|
72
|
+
|
|
73
|
+
## What the video must survive
|
|
74
|
+
|
|
75
|
+
- **count, duration** — every scene is in the project, and the file lasts as long as the scenes together.
|
|
76
|
+
- **lint, runtime** — the engine's lint finds no error, the page logs no console error.
|
|
77
|
+
- **snapshot** — one frame per scene, taken from its middle.
|
|
78
|
+
- **black, freeze, flash** — no run of black frames, no cut that shows the previous frame again, no frame much
|
|
79
|
+
brighter than both neighbours (a flash).
|
|
80
|
+
- **silence** — skipped for a film without an audio bed (nothing to measure), checked with one.
|
|
81
|
+
- **transcript, vlm** — skipped: no local speech or vision model is configured, and a cloud model is not called for a
|
|
82
|
+
check. Say so in the report; a skip is never a pass.
|
|
83
|
+
|
|
84
|
+
Fix the spec or the material when a check fails, never the check. Look at the snapshots before you call it done.
|
|
85
|
+
|
|
86
|
+
## A video on a website
|
|
87
|
+
|
|
88
|
+
Build the video first, then copy the file into the site and point at it (see the web skill):
|
|
89
|
+
|
|
90
|
+
```html
|
|
91
|
+
<video src="media/pythagoras.mp4" poster="media/pythagoras.jpg" controls preload="none" playsinline width="1280" height="720">
|
|
92
|
+
A short explainer of the Pythagorean theorem.
|
|
93
|
+
</video>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`preload="none"` and a `poster` keep the page inside its weight budget (the browser loads the film only on play); use
|
|
97
|
+
`mp4` for a site, which every browser plays. A poster can be one of the video's snapshots.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: web
|
|
3
|
+
description: Build and check a website with the site adapter. Use when a task produces a web page, a landing page, a small site or a web app's static pages, or when a site has to pass its checks before it is shown.
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
metadata:
|
|
6
|
+
source: own
|
|
7
|
+
verified_against: playwright-core 1.64, axe-core 4.14, Chromium 155
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Website
|
|
11
|
+
|
|
12
|
+
A site is data first: a `SiteSpec` (version 2) names the pages, where the site lives and how it is built. The site
|
|
13
|
+
adapter serves it from its own directory, opens every page in a real browser at three widths and runs axe on it. Your
|
|
14
|
+
job is the pages and the spec, not the checks.
|
|
15
|
+
|
|
16
|
+
## What the spec says
|
|
17
|
+
|
|
18
|
+
- `pages[]`, each with `path` (relative to what is served, e.g. `index.html`, `docs/intro.html`) and `title`.
|
|
19
|
+
- `root`: the directory with the site's sources, relative to the job; without it the job directory itself.
|
|
20
|
+
- `build` (only for a built site): `script`, the npm script that builds it (`build`, not a command line), and `out`, the
|
|
21
|
+
directory it writes, relative to `root`. Install the packages before the checks: the build runs without a network.
|
|
22
|
+
- `budget.kb`: the most a page may weigh with everything it loads; 1500 KB without one.
|
|
23
|
+
- `brand.colors` (hex) and `brand.fonts`: what a reviewer holds the pages against.
|
|
24
|
+
|
|
25
|
+
Start static: plain HTML, CSS and a little JavaScript need no build and are checked exactly like a built site.
|
|
26
|
+
|
|
27
|
+
**How to write the HTML, CSS and JavaScript:** when the `modern-web-guidance` skill is available, search its guides
|
|
28
|
+
before you write a component, a layout, a form, a dialog or an animation, and follow what they say. Aim for features
|
|
29
|
+
that are Baseline widely available; when a guide says a feature is new, use its fallback. Without the skill, the user
|
|
30
|
+
can add it with `/setup` (Modern Web Guidance).
|
|
31
|
+
|
|
32
|
+
## Videos and animations in a page
|
|
33
|
+
|
|
34
|
+
A film or a Manim animation is made first with the video skill (`make_artifact` with a `video.json`), then copied into
|
|
35
|
+
the site (e.g. `media/`) and embedded with `<video src="media/clip.mp4" poster="media/clip.jpg" controls
|
|
36
|
+
preload="none" playsinline>` plus a sentence of fallback text. `preload="none"` with a poster keeps the page inside its
|
|
37
|
+
weight budget: the browser fetches the film only when it is played. Use mp4 for a site (every browser plays it), give
|
|
38
|
+
the element a width and height so the layout does not jump, and never autoplay with sound. A short muted loop
|
|
39
|
+
(`muted autoplay loop playsinline`) is fine for a small decorative animation, but then its full size counts against
|
|
40
|
+
the budget.
|
|
41
|
+
|
|
42
|
+
## What the site must survive
|
|
43
|
+
|
|
44
|
+
- **pages** — every page in the spec exists.
|
|
45
|
+
- **links** — every local `href`, `src` and `srcset` lands on a file (`about` may mean `about.html`, a directory means
|
|
46
|
+
its `index.html`). Links to other sites are listed, not followed: the checks run offline.
|
|
47
|
+
- **build** — `npm run <script>` exits zero.
|
|
48
|
+
- **load, console, requests** — each page loads at 390, 768 and 1280 px, throws nothing, logs no error, and everything
|
|
49
|
+
it asks for is there. A font or script from a CDN fails offline: ship it with the site.
|
|
50
|
+
- **overflow** — nothing is wider than the window; the phone width is where this fails.
|
|
51
|
+
- **a11y** — axe finds nothing `serious` or `critical`: alt text on images, labels on inputs, enough contrast, a
|
|
52
|
+
`lang` on `<html>`. `moderate` findings are reported in the passing text; fix them when they are cheap.
|
|
53
|
+
- **weight** — each page stays inside its budget.
|
|
54
|
+
- **snapshot, blank** — a screenshot of every page at every width, and none of them empty.
|
|
55
|
+
|
|
56
|
+
## When something fails
|
|
57
|
+
|
|
58
|
+
Fix the page, not the check. An overflow wants a layout that wraps (`max-width: 100%`, `flex-wrap`, no fixed widths),
|
|
59
|
+
not `overflow: hidden` on `body`; a contrast failure wants darker text, not a bigger font. If a check is `skipped` or
|
|
60
|
+
fails because no browser could run, say so in the report: an absence is never a pass.
|