@deeeed/metamask-harness 0.46.0 → 0.47.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 (42) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +1 -1
  3. package/adapters/manifest.json +12 -4
  4. package/adapters/mobile/wait-for-bridge.cjs +550 -0
  5. package/adapters/mobile/wait-for-bridge.sh +11 -148
  6. package/bin/mm-harness +7 -2
  7. package/dist/adapters/mobile/prepare.js +26 -18
  8. package/dist/adapters/mobile/runtime-decision.js +1 -0
  9. package/dist/cli-commands.js +2 -0
  10. package/dist/command-contract.js +7 -0
  11. package/dist/commands/checklist.js +1 -0
  12. package/dist/commands/help.js +76 -0
  13. package/dist/commands/parse-args.js +2 -1
  14. package/dist/commands/recipe-quality.js +1 -1
  15. package/dist/commands/tutorial.js +46 -0
  16. package/dist/mm-harness-cli.js +45 -6
  17. package/docs/CONTRIBUTING.md +2 -0
  18. package/docs/QA.md +2 -2
  19. package/library/actions/mobile/perps/perps.mjs +1 -1
  20. package/package.json +2 -2
  21. package/scripts/site-contrast.mjs +6 -2
  22. package/site/assets/help-recipes.json +113 -0
  23. package/site/architecture.html +0 -497
  24. package/site/assets/metamask-fox.svg +0 -24
  25. package/site/assets/progress.mjs +0 -323
  26. package/site/assets/style.css +0 -1066
  27. package/site/cheatsheet.html +0 -307
  28. package/site/ecosystem.html +0 -162
  29. package/site/how-it-works.html +0 -692
  30. package/site/index.html +0 -184
  31. package/site/perps-advanced-orders-qa.html +0 -96
  32. package/site/perps.html +0 -265
  33. package/site/recipes.html +0 -423
  34. package/site/reviewers.html +0 -375
  35. package/site/tutorials/index.html +0 -181
  36. package/site/tutorials/v1.html +0 -212
  37. package/site/tutorials/v2.html +0 -207
  38. package/site/tutorials/v3.html +0 -258
  39. package/site/tutorials/v4.html +0 -196
  40. package/site/tutorials/v5.html +0 -164
  41. package/site/tutorials/v6.html +0 -166
  42. package/site/tutorials/v7.html +0 -185
@@ -1,212 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1">
6
- <title>V1 — Getting started with recipes</title>
7
- <meta name="description" content="Video one of the series: one CLI drives the wallet and proves what happened. With the same checklist as the How it works walkthrough.">
8
- <link rel="icon" href="../assets/metamask-fox.svg" type="image/svg+xml">
9
- <link rel="stylesheet" href="../assets/style.css?v=4">
10
- </head>
11
- <body data-progress-page="start">
12
- <a class="skip" href="#steps">Skip to the checklist</a>
13
-
14
- <header class="topbar">
15
- <div class="wrap topbar-inner">
16
- <a class="brand" href="../index.html">
17
- <img class="brand-mark" src="../assets/metamask-fox.svg" alt="" width="22" height="22">
18
- <span class="brand-name">recipes</span>
19
- </a>
20
- <nav class="nav" aria-label="Main">
21
- <a class="nav-cta" href="../index.html#prompt">Quick start</a>
22
- <a href="../how-it-works.html">How it works</a>
23
- <a href="../perps.html">Team / Perps</a>
24
- <a href="../cheatsheet.html">Cheatsheet</a>
25
- <a href="../architecture.html">Architecture</a>
26
- <a href="index.html" aria-current="page">Tutorials</a>
27
- </nav>
28
- </div>
29
- </header>
30
-
31
- <div class="progress-rail">
32
- <div class="wrap progress-inner">
33
- <div class="progress-track" role="progressbar" aria-label="Walkthrough progress" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
34
- <div class="progress-fill"></div>
35
- </div>
36
- <span class="progress-label">0/8 steps</span>
37
- <button type="button" class="progress-reset">Reset</button>
38
- </div>
39
- </div>
40
-
41
- <main>
42
- <section class="wrap hero" style="padding-bottom:1rem">
43
- <span class="eyebrow">Tutorial V1 · 5 minutes</span>
44
- <h1>Getting started with recipes</h1>
45
- <p class="lede">
46
- The promise in one sentence: one command-line tool drives a real MetaMask build, and then proves
47
- what it did. This is the first video in the series and the shortest path into everything else.
48
- </p>
49
- <div class="hero-meta">
50
- <span>no prerequisites</span>
51
- <span>checklist shared with How it works</span>
52
- </div>
53
- </section>
54
-
55
- <section class="wrap">
56
- <div class="vid-thumb" style="border-radius:var(--radius);border:1px solid var(--line);margin-bottom:1.5rem">
57
- <div style="text-align:center;padding:1rem">
58
- <div class="vid-id" style="font-size:2.6rem">V1</div>
59
- <p style="color:var(--text-dim);margin:.5rem 0 0;font-size:.92rem">Video recording in progress</p>
60
- </div>
61
- </div>
62
-
63
- <div class="note plain">
64
- <span class="note-title">The checklist below is the video</span>
65
- <p>
66
- Same eight steps, same commands, same expected output — it is genuinely useful before the
67
- recording exists, which is why it is here rather than a "coming soon" page. Your progress is
68
- shared with <a href="../how-it-works.html">How it works</a>: tick a step in either place and it is ticked
69
- in both. How it works carries the longer explanations and the full "if it fails" notes for each
70
- step.
71
- </p>
72
- </div>
73
-
74
- <h2>What the video covers</h2>
75
- <div class="table-scroll">
76
- <table>
77
- <thead><tr><th>Beat</th><th>What is on screen</th></tr></thead>
78
- <tbody>
79
- <tr><td><code>0:00</code></td><td>The promise — one CLI drives the wallet and proves what happened.</td></tr>
80
- <tr><td><code>0:30</code></td><td>Install into a clean checkout, then <code>doctor</code>. One failure gets fixed by following the error's own instruction — twenty seconds, no dwelling.</td></tr>
81
- <tr><td><code>1:15</code></td><td><code>launch</code> — the real app comes up under harness control.</td></tr>
82
- <tr><td><code>1:45</code></td><td><code>actions</code>, and the line that matters: you never guess capabilities, you discover them. Then two live <code>call</code>s — read the wallet state, then one UI action visibly moving the app.</td></tr>
83
- <tr><td><code>3:00</code></td><td>The same steps as a <em>recipe</em>: <code>run</code> executes the graph and adds assertions. This is the jump from driving to proving.</td></tr>
84
- <tr><td><code>4:00</code></td><td>Open the artifacts directory. <code>summary.json</code>, the trace, the screenshot.</td></tr>
85
- <tr><td><code>4:30</code></td><td>Close on the cheatsheet — everything just done, on one page.</td></tr>
86
- </tbody>
87
- </table>
88
- </div>
89
- <p style="font-size:.94rem;color:var(--text-dim)">
90
- Artifact you finish with: a green <code>summary.json</code> you produced yourself.
91
- </p>
92
- </section>
93
-
94
- <section class="wrap">
95
- <h2 id="steps">Follow along</h2>
96
-
97
- <ol class="steps">
98
-
99
- <li class="step" data-step="install">
100
- <div class="step-head">
101
- <input type="checkbox" class="step-check" id="v-install" aria-labelledby="tv-install">
102
- <h3 class="step-title" id="tv-install">Get the CLI</h3>
103
- </div>
104
- <p class="step-why">Install globally, confirm it resolved, then work from inside a product checkout.</p>
105
- <div class="cmd"><pre><code><span class="p">$ </span>npm i -g @deeeed/metamask-harness@latest
106
- <span class="p">$ </span>mm-harness --version</code></pre></div>
107
- <div class="out">0.34.x <span class="dim">— any 0.34 or newer</span></div>
108
- </li>
109
-
110
- <li class="step" data-step="doctor">
111
- <div class="step-head">
112
- <input type="checkbox" class="step-check" id="v-doctor" aria-labelledby="tv-doctor">
113
- <h3 class="step-title" id="tv-doctor">Run doctor, follow what it tells you</h3>
114
- </div>
115
- <p class="step-why">
116
- Read-only readiness check. Each finding names the exact command that fixes it — including,
117
- often, <code>doctor --fix</code> itself.
118
- </p>
119
- <div class="cmd"><pre><code><span class="p">$ </span>mm-harness doctor
120
- <span class="p">$ </span>mm-harness doctor --fix</code></pre></div>
121
- <div class="out"><span class="ok">pass</span> extension bridge present ready=true <span class="ok">fixed=[runtime-context]</span> failed=[]</div>
122
- </li>
123
-
124
- <li class="step" data-step="launch">
125
- <div class="step-head">
126
- <input type="checkbox" class="step-check" id="v-launch" aria-labelledby="tv-launch">
127
- <h3 class="step-title" id="tv-launch">Launch the app</h3>
128
- </div>
129
- <p class="step-why">Platform auto-detects. Mobile needs an explicit target; core is headless and says so.</p>
130
- <div class="cmd"><pre><code><span class="p">$ </span>mm-harness launch <span class="dim"># extension</span>
131
- <span class="p">$ </span>mm-harness launch ios <span class="dim"># mobile</span></code></pre></div>
132
- </li>
133
-
134
- <li class="step" data-step="actions">
135
- <div class="step-head">
136
- <input type="checkbox" class="step-check" id="v-actions" aria-labelledby="tv-actions">
137
- <h3 class="step-title" id="tv-actions">Discover the vocabulary</h3>
138
- </div>
139
- <p class="step-why">
140
- The line to remember: you never guess capabilities, you discover them. This list is the
141
- capability boundary, not a sample of one.
142
- </p>
143
- <div class="cmd"><pre><code><span class="p">$ </span>mm-harness actions --categories
144
- <span class="p">$ </span>mm-harness actions --category ui</code></pre></div>
145
- </li>
146
-
147
- <li class="step" data-step="call-read">
148
- <div class="step-head">
149
- <input type="checkbox" class="step-check" id="v-call-read" aria-labelledby="tv-call-read">
150
- <h3 class="step-title" id="tv-call-read">Drive it: read wallet state</h3>
151
- </div>
152
- <p class="step-why">One action through the real engine path. Reads first — they cannot break anything.</p>
153
- <div class="cmd"><pre><code><span class="p">$ </span>mm-harness call read_state</code></pre></div>
154
- </li>
155
-
156
- <li class="step" data-step="call-ui">
157
- <div class="step-head">
158
- <input type="checkbox" class="step-check" id="v-call-ui" aria-labelledby="tv-call-ui">
159
- <h3 class="step-title" id="tv-call-ui">Drive it: move the UI</h3>
160
- </div>
161
- <p class="step-why">Keep the app on screen. This is the beat where a terminal command visibly moves a real build.</p>
162
- <div class="cmd"><pre><code><span class="p">$ </span>mm-harness call navigate page=perps</code></pre></div>
163
- </li>
164
-
165
- <li class="step" data-step="run">
166
- <div class="step-head">
167
- <input type="checkbox" class="step-check" id="v-run" aria-labelledby="tv-run">
168
- <h3 class="step-title" id="tv-run">Prove it: run a recipe</h3>
169
- </div>
170
- <p class="step-why">
171
- The same operations composed into a graph with assertions. <code>--plan</code> validates first
172
- without touching anything.
173
- </p>
174
- <div class="cmd"><pre><code><span class="p">$ </span>mm-harness run --list
175
- <span class="p">$ </span>mm-harness run wallet.smoke --plan
176
- <span class="p">$ </span>mm-harness run wallet.smoke --artifacts-dir ./first-recipe-artifacts</code></pre></div>
177
- </li>
178
-
179
- <li class="step" data-step="evidence">
180
- <div class="step-head">
181
- <input type="checkbox" class="step-check" id="v-evidence" aria-labelledby="tv-evidence">
182
- <h3 class="step-title" id="tv-evidence">Open the evidence</h3>
183
- </div>
184
- <p class="step-why">
185
- The closing shot of the video, and the reason for all of it. Start with <code>report.md</code>,
186
- then the summary, then the trace when you want to know why.
187
- </p>
188
- <div class="cmd"><pre><code><span class="p">$ </span>cat first-recipe-artifacts/report.md
189
- <span class="p">$ </span>cat first-recipe-artifacts/summary.json</code></pre></div>
190
- </li>
191
-
192
- </ol>
193
-
194
- <hr class="sep">
195
- <div class="btn-row">
196
- <a class="btn btn-primary" href="../how-it-works.html#steps">Full walkthrough, with failure notes →</a>
197
- <a class="btn btn-ghost" href="../cheatsheet.html">The cheatsheet</a>
198
- <a class="btn btn-ghost" href="index.html">Back to the series</a>
199
- </div>
200
- </section>
201
- </main>
202
-
203
- <footer class="footer">
204
- <div class="wrap">
205
- <p>Internal getting-started guide for proving MetaMask changes with recipes. Not official MetaMask product documentation.</p>
206
- <p>Sample output moves between releases; trust your terminal over this page.</p>
207
- </div>
208
- </footer>
209
-
210
- <script type="module" src="../assets/progress.mjs?v=4"></script>
211
- </body>
212
- </html>
@@ -1,207 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1">
6
- <title>V2 — Reading the evidence</title>
7
- <meta name="description" content="Walk one finished run file by file, and learn the two rules that make a green verdict worth believing.">
8
- <link rel="icon" href="../assets/metamask-fox.svg" type="image/svg+xml">
9
- <link rel="stylesheet" href="../assets/style.css?v=4">
10
- </head>
11
- <body data-progress-page="v2">
12
- <a class="skip" href="#steps">Skip to the checklist</a>
13
-
14
- <header class="topbar">
15
- <div class="wrap topbar-inner">
16
- <a class="brand" href="../index.html">
17
- <img class="brand-mark" src="../assets/metamask-fox.svg" alt="" width="22" height="22">
18
- <span class="brand-name">recipes</span>
19
- </a>
20
- <nav class="nav" aria-label="Main">
21
- <a class="nav-cta" href="../index.html#prompt">Quick start</a>
22
- <a href="../how-it-works.html">How it works</a>
23
- <a href="../perps.html">Team / Perps</a>
24
- <a href="../cheatsheet.html">Cheatsheet</a>
25
- <a href="../architecture.html">Architecture</a>
26
- <a href="index.html" aria-current="page">Tutorials</a>
27
- </nav>
28
- </div>
29
- </header>
30
-
31
- <div class="progress-rail">
32
- <div class="wrap progress-inner">
33
- <div class="progress-track" role="progressbar" aria-label="Tutorial progress" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
34
- <div class="progress-fill"></div>
35
- </div>
36
- <span class="progress-label">0/5 steps</span>
37
- <button type="button" class="progress-reset">Reset</button>
38
- </div>
39
- </div>
40
-
41
- <main>
42
- <section class="wrap hero" style="padding-bottom:1rem">
43
- <span class="eyebrow">Tutorial V2 · 6 minutes</span>
44
- <h1>Reading the evidence</h1>
45
- <p class="lede">
46
- For reviewers and sceptics. A green run is a claim; this is how you check it.
47
- </p>
48
- <div class="hero-meta">
49
- <span>no prerequisites</span>
50
- <span>reference: <a href="../reviewers.html">For Reviewers</a></span>
51
- </div>
52
- </section>
53
-
54
- <section class="wrap">
55
- <div class="vid-thumb" style="border-radius:var(--radius);border:1px solid var(--line);margin-bottom:1.5rem">
56
- <div style="text-align:center;padding:1rem">
57
- <div class="vid-id" style="font-size:2.6rem">V2</div>
58
- <p style="color:var(--text-dim);margin:.5rem 0 0;font-size:.92rem">Video recording in progress</p>
59
- </div>
60
- </div>
61
-
62
- <div class="note plain">
63
- <span class="note-title">This page and the reviewer's guide</span>
64
- <p>
65
- This is the tour: what each file is for, in the order you open them. is the reference — a real bundle annotated line by line,
66
- including a screenshot that passed while recording that its capture had degraded. Read this first,
67
- keep that one open during a review.
68
- </p>
69
- </div>
70
-
71
- <h2>What the video covers</h2>
72
- <div class="table-scroll">
73
- <table>
74
- <thead><tr><th>Beat</th><th>On screen</th></tr></thead>
75
- <tbody>
76
- <tr><td><code>0:00</code></td><td>One finished run directory, opened cold.</td></tr>
77
- <tr><td><code>0:40</code></td><td><code>recipe.json</code> — the graph that executed. Each node's <code>intent</code> is the argument being made.</td></tr>
78
- <tr><td><code>1:40</code></td><td><code>trace.json</code> — per-node verdicts, timings, outputs. Counts come from here.</td></tr>
79
- <tr><td><code>2:50</code></td><td><code>summary.json</code> — the verdict, the totals, which libraries were in scope.</td></tr>
80
- <tr><td><code>3:30</code></td><td>Screenshots, plus full-run video on Extension and iOS.</td></tr>
81
- <tr><td><code>4:20</code></td><td><code>diagnostics.json</code> — application warnings, quarantined from the verdict.</td></tr>
82
- <tr><td><code>5:10</code></td><td>The two rules that make the whole thing worth reading.</td></tr>
83
- </tbody>
84
- </table>
85
- </div>
86
- </section>
87
-
88
- <section class="wrap">
89
- <h2 id="rules">The two rules</h2>
90
- <p>Both are enforced in code, not by convention.</p>
91
-
92
- <div class="doctrine">
93
- <p>
94
- <span class="k">Placeholders are refused, and a missing adapter throws.</span> The harness will not
95
- accept a static stand-in where a real observation belongs, and when the adapter that would perform
96
- an action is absent it raises instead of returning a plausible-looking object. A system that
97
- guessed would produce evidence indistinguishable from the real thing.
98
- </p>
99
- </div>
100
-
101
- <p>
102
- The practical consequence: a node that passed had a real adapter execute it. That is what makes
103
- <code>"ok": true</code> worth anything.
104
- </p>
105
-
106
- <div class="note blue">
107
- <span class="note-title">Capture is not symmetric</span>
108
- <p>
109
- Extension and iOS record full-run video through capture-helper; Android replay video is not
110
- implemented yet. <code>mm-harness doctor</code> reports what the current checkout can capture on its
111
- <code>capture:</code> line.
112
- </p>
113
- </div>
114
- </section>
115
-
116
- <section class="wrap">
117
- <h2 id="steps">Follow along</h2>
118
- <p>Use a bundle you produced in <a href="../how-it-works.html#steps">the walkthrough</a>, or any run directory.</p>
119
-
120
- <ol class="steps">
121
- <li class="step" data-step="open">
122
- <div class="step-head">
123
- <input type="checkbox" class="step-check" id="v2-open" aria-labelledby="t2-open">
124
- <h3 class="step-title" id="t2-open">Open a bundle</h3>
125
- </div>
126
- <p class="step-why"><code>last</code> prints the path of the most recent run for this checkout.</p>
127
- <div class="cmd"><pre><code><span class="p">$ </span>mm-harness last
128
- <span class="p">$ </span>ls first-recipe-artifacts</code></pre></div>
129
- </li>
130
-
131
- <li class="step" data-step="report">
132
- <div class="step-head">
133
- <input type="checkbox" class="step-check" id="v2-report" aria-labelledby="t2-report">
134
- <h3 class="step-title" id="t2-report">Skim report.md</h3>
135
- </div>
136
- <p class="step-why">The whole run on one page. If it disagrees with the pull request description, stop and ask.</p>
137
- <div class="cmd"><pre><code><span class="p">$ </span>cat first-recipe-artifacts/report.md</code></pre></div>
138
- </li>
139
-
140
- <li class="step" data-step="verdict">
141
- <div class="step-head">
142
- <input type="checkbox" class="step-check" id="v2-verdict" aria-labelledby="t2-verdict">
143
- <h3 class="step-title" id="t2-verdict">Check the verdict and the counts</h3>
144
- </div>
145
- <p class="step-why">Compare <code>total</code> against what the author claims was proven.</p>
146
- <div class="cmd"><pre><code><span class="p">$ </span>cat first-recipe-artifacts/summary.json</code></pre></div>
147
- <div class="out">{
148
- "status": <span class="ok">"pass"</span>,
149
- "total": 6,
150
- "passed": 6,
151
- "failed": 0
152
- }</div>
153
- </li>
154
-
155
- <li class="step" data-step="trace">
156
- <div class="step-head">
157
- <input type="checkbox" class="step-check" id="v2-trace" aria-labelledby="t2-trace">
158
- <h3 class="step-title" id="t2-trace">Read the intents in order</h3>
159
- </div>
160
- <p class="step-why">
161
- The per-node intents are the argument. If they do not add up to the claim, the bundle does not
162
- support it — however green it is.
163
- </p>
164
- <div class="cmd"><pre><code><span class="p">$ </span>cat first-recipe-artifacts/trace.json</code></pre></div>
165
- <p class="step-why">
166
- Triaging a failure: find the first node with <code>"ok": false</code>. Everything after it is
167
- consequence.
168
- </p>
169
- </li>
170
-
171
- <li class="step" data-step="artifacts">
172
- <div class="step-head">
173
- <input type="checkbox" class="step-check" id="v2-artifacts" aria-labelledby="t2-artifacts">
174
- <h3 class="step-title" id="t2-artifacts">Open the images, then the diagnostics</h3>
175
- </div>
176
- <p class="step-why">
177
- The trace says a PNG was registered and how it was captured. Only your eyes confirm it shows what
178
- the author says.
179
- </p>
180
- <div class="cmd"><pre><code><span class="p">$ </span>open first-recipe-artifacts/screenshots
181
- <span class="p">$ </span>cat first-recipe-artifacts/diagnostics.json</code></pre></div>
182
- <p class="step-why">
183
- <code>diagnostics.json</code> is bracketed to the run window, so <code>"status": "clean"</code>
184
- is a claim about this run rather than about the log file.
185
- </p>
186
- </li>
187
- </ol>
188
-
189
- <hr class="sep">
190
- <div class="btn-row">
191
- <a class="btn btn-primary" href="../reviewers.html">The annotated reference →</a>
192
- <a class="btn btn-ghost" href="v3.html">Next: skills setup</a>
193
- <a class="btn btn-ghost" href="index.html">Back to the series</a>
194
- </div>
195
- </section>
196
- </main>
197
-
198
- <footer class="footer">
199
- <div class="wrap">
200
- <p>Internal getting-started guide for proving MetaMask changes with recipes. Not official MetaMask product documentation.</p>
201
- <p>Sample output moves between releases; trust your terminal over this page.</p>
202
- </div>
203
- </footer>
204
-
205
- <script type="module" src="../assets/progress.mjs?v=4"></script>
206
- </body>
207
- </html>