@deeeed/metamask-harness 0.17.0 → 0.17.2
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/CHANGELOG.md +34 -0
- package/README.md +90 -140
- package/adapters/core/cleanup.sh +0 -0
- package/adapters/core/inject.sh +0 -0
- package/adapters/extension/cleanup.mjs +0 -0
- package/adapters/extension/console-tail.mjs +51 -24
- package/adapters/extension/ensure-browser.sh +0 -0
- package/adapters/extension/inject.mjs +5 -9
- package/adapters/extension/launch-browser.cjs +0 -0
- package/adapters/extension/launch-webpack.cjs +83 -0
- package/adapters/extension/launch.sh +8 -11
- package/adapters/extension/live.sh +2 -0
- package/adapters/extension/readiness.mjs +0 -0
- package/adapters/extension/reattach.sh +1 -0
- package/adapters/extension/refresh-build.sh +0 -0
- package/adapters/extension/seed-fixture.sh +4 -12
- package/adapters/extension/sidepanel-toggle.sh +4 -1
- package/adapters/extension/snapshot-dist.sh +0 -0
- package/adapters/extension/stamp-runtime-title.cjs +49 -0
- package/adapters/extension/start-watch.sh +16 -4
- package/adapters/extension/stop-viewers.sh +1 -1
- package/adapters/extension/sync-webpack-dist.cjs +105 -0
- package/adapters/extension/verify.sh +1 -1
- package/adapters/extension/wallet-fixture-state.cjs +0 -0
- package/adapters/manifest.json +46 -38
- package/adapters/mobile/bridge-runtime/cdp-bridge.cjs +0 -0
- package/adapters/mobile/bridge-runtime/console-forwarder.cjs +1 -1
- package/adapters/mobile/bridge-runtime/lib/target-discovery.cjs +2 -3
- package/adapters/mobile/bridge-runtime/setup-wallet.sh +0 -0
- package/adapters/mobile/cleanup.sh +16 -176
- package/adapters/mobile/inject.sh +88 -671
- package/adapters/mobile/launch-console-forwarder.cjs +39 -0
- package/adapters/mobile/lib/metro-listener.sh +0 -0
- package/adapters/mobile/lib/tmux-viewer.sh +0 -0
- package/adapters/mobile/open-device.sh +0 -0
- package/adapters/mobile/prewarm-bundle.sh +0 -0
- package/adapters/mobile/start-console-forwarder.sh +70 -0
- package/adapters/mobile/start-metro.sh +0 -41
- package/adapters/mobile/stop-metro.sh +0 -0
- package/adapters/mobile/verify.sh +4 -61
- package/adapters/mobile/wait-for-bridge.sh +0 -0
- package/adapters/mobile/yarn-setup.sh +0 -0
- package/adapters/shared/activate-repo-node.sh +0 -0
- package/adapters/shared/activate-repo-ruby.sh +0 -0
- package/adapters/shared/cli-ux.sh +0 -0
- package/adapters/shared/ensure-runner-deps.sh +0 -0
- package/adapters/shared/harness-path.sh +0 -0
- package/adapters/shared/hash-helpers.sh +0 -0
- package/adapters/shared/install-repo-deps.sh +0 -0
- package/adapters/shared/json-field.sh +0 -0
- package/adapters/shared/open-debug.mjs +90 -36
- package/adapters/shared/open-log-window.sh +0 -0
- package/adapters/shared/reap-checkout-metros.sh +0 -0
- package/adapters/shared/resolve-slot-ports-core.mjs +0 -6
- package/adapters/shared/resolve-slot-ports.mjs +0 -0
- package/adapters/shared/resolve-slot-ports.sh +0 -5
- package/adapters/shared/sync-wallet-fixture.sh +0 -0
- package/adapters/shared/tmux-session.sh +0 -0
- package/adapters/shared/tmux-viewer.sh +0 -0
- package/adapters/shared/update-check-worker.mjs +37 -0
- package/dist/adapters/extension/console-capture.js +84 -0
- package/dist/adapters/extension/runtime-decision.js +14 -2
- package/dist/adapters/extension/surface.js +3 -2
- package/dist/adapters/mobile/prepare.js +22 -7
- package/dist/adapters/mobile/surface.js +1 -1
- package/dist/adapters/resolve-slot-ports.js +0 -2
- package/dist/adapters/slot-ports.js +8 -0
- package/dist/cli.js +3 -11
- package/dist/commands/call.js +9 -4
- package/dist/commands/debug.js +38 -31
- package/dist/commands/fixtures.js +18 -10
- package/dist/commands/launch/index.js +10 -0
- package/dist/commands/logs.js +8 -6
- package/dist/commands/manifest.js +5 -17
- package/dist/commands/run-engine.js +1 -32
- package/dist/commands/run-report.js +1 -1
- package/dist/commands/run.js +50 -3
- package/dist/commands/status-probe.js +1 -1
- package/dist/commands/update.js +15 -28
- package/dist/doctor.js +1 -4
- package/dist/harness.js +5 -123
- package/dist/live-adapter-contract.js +6 -20
- package/dist/mm-harness-cli.js +6 -43
- package/dist/paths.js +2 -5
- package/dist/run-diagnostics.js +35 -40
- package/dist/runtime-context.js +26 -8
- package/docs/CHEATSHEET.md +39 -52
- package/docs/CLI-ERGONOMICS-HUMAN-QA.md +48 -104
- package/docs/CODE-MAP.md +1 -1
- package/docs/VIDEO-DEMO-VALIDATION.md +62 -0
- package/docs/architecture.md +65 -375
- package/docs/live-adapter-contract.md +3 -1
- package/library/actions/core/perps/_controller.mjs +10 -55
- package/library/manifests/mobile.action-manifest.json +1 -1
- package/package.json +2 -2
- package/scripts/completions.sh +0 -0
- package/scripts/install-completions.sh +0 -0
- package/adapters/mobile/overlay/app/dev-tools/AgenticService/AgentStepHud.tsx.patch +0 -185
- package/adapters/mobile/overlay/app/dev-tools/AgenticService/AgenticService.ts.patch +0 -1662
- package/adapters/mobile/overlay/compat/README.md +0 -28
- package/adapters/mobile/overlay/compat/rn81-message-event-source.patch +0 -42
- package/adapters/shared/resolve-farmslot-ports-core.mjs +0 -3
- package/adapters/shared/resolve-farmslot-ports.mjs +0 -5
- package/adapters/shared/resolve-farmslot-ports.sh +0 -7
- package/docs/CLI-SPEC.md +0 -1142
- package/docs/MENTAL-MODEL.md +0 -295
package/docs/CHEATSHEET.md
CHANGED
|
@@ -1,61 +1,48 @@
|
|
|
1
|
-
# mm-harness
|
|
1
|
+
# mm-harness cheatsheet
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Run inside a MetaMask checkout. Product, slot, ports, and runtime paths are
|
|
4
|
+
auto-detected.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
## Operate
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
| Situation | Command |
|
|
8
|
+
| Need | Command |
|
|
10
9
|
|---|---|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
10
|
+
| Extension | `mm-harness launch` |
|
|
11
|
+
| Extension sidepanel | `mm-harness launch --sidepanel` |
|
|
12
|
+
| iOS / Android | `mm-harness launch ios` / `mm-harness launch android` |
|
|
13
|
+
| Clean rebuild | `mm-harness launch --build` |
|
|
14
|
+
| Runtime status | `mm-harness status` |
|
|
15
|
+
| Logs | `mm-harness logs` |
|
|
16
|
+
| Debugger | `mm-harness debug` |
|
|
17
|
+
| Apply wallet fixture | `mm-harness fixtures set` |
|
|
18
|
+
|
|
19
|
+
Extension log sources: `extension`, `dapp`, `webpack`, `watcher`, `rebuild`.
|
|
20
|
+
Mobile log sources: `app`, `metro`.
|
|
21
|
+
|
|
22
|
+
## Discover and prove
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
mm-harness actions positions
|
|
26
|
+
mm-harness actions --action metamask.wallet.ensure_unlocked
|
|
27
|
+
mm-harness call metamask.wallet.ensure_unlocked
|
|
28
|
+
mm-harness flows
|
|
29
|
+
mm-harness run recipe.json --plan
|
|
30
|
+
mm-harness run recipe.json --artifacts-dir temp/recipe-proof
|
|
30
31
|
```
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
| `mm-harness actions` | Action vocabulary for this adapter |
|
|
35
|
-
| `mm-harness call unlock` | One action through the real engine (fuzzy name ok) |
|
|
36
|
-
| `mm-harness flows` | Reusable flows (personal > team > canonical) |
|
|
37
|
-
| `mm-harness run recipe.json --plan` | Validate + print plan, no device touched; exit 5 if invalid |
|
|
38
|
-
| `mm-harness run recipe.json` | Execute + write evidence (summary / trace / artifacts) |
|
|
39
|
-
|
|
40
|
-
---
|
|
33
|
+
The run result prints diagnostics plus absolute evidence paths. Resume safely with
|
|
34
|
+
`mm-harness last --json`.
|
|
41
35
|
|
|
42
|
-
##
|
|
36
|
+
## Recover
|
|
43
37
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
## For agents and scripts
|
|
54
|
-
|
|
55
|
-
**`--json`** — machine-readable output on every command; includes `recovered[]`, `mutations[]`, `schemaVersion`.
|
|
56
|
-
|
|
57
|
-
**`--heal`** — `off` (fail fast, repro-preserving) · `infra-only` (heal transport, never wallet; `run`/`call` default) · `auto` (auto-ensure overlay + heal; `launch` default).
|
|
58
|
-
|
|
59
|
-
**Exit codes** — `0` success · `1` recipe/action failed · `2` bad args / missing target · `5` validation failure (fix recipe).
|
|
38
|
+
```bash
|
|
39
|
+
mm-harness doctor
|
|
40
|
+
mm-harness doctor --fix
|
|
41
|
+
mm-harness verify
|
|
42
|
+
mm-harness cleanup
|
|
43
|
+
mm-harness update
|
|
44
|
+
```
|
|
60
45
|
|
|
61
|
-
|
|
46
|
+
For automation, add `--json`. Use `--json-stream` for line-delimited run progress.
|
|
47
|
+
Bad input exits `2`; recipe/action failure exits `1`; recipe validation failure
|
|
48
|
+
exits `5`.
|
|
@@ -1,104 +1,48 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
# Extension
|
|
50
|
-
mm-harness launch --adapter extension --target "$TARGET"
|
|
51
|
-
|
|
52
|
-
# Mobile: choose the intended platform
|
|
53
|
-
mm-harness launch ios --target "$TARGET"
|
|
54
|
-
# mm-harness launch android --target "$TARGET"
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Expected: intent/progress appears immediately, long work continues to report progress, and the app becomes ready. Redirected or `--json` stdout stays decoration-free.
|
|
58
|
-
|
|
59
|
-
## 5. Lifecycle next step
|
|
60
|
-
|
|
61
|
-
For Extension:
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
mm-harness stop --adapter extension --target "$TARGET" --json | jq '{status, next}'
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Expected: `next` is a target-scoped launch command. Mobile `stop` intentionally omits `next` because Metro does not identify whether iOS or Android should be relaunched.
|
|
68
|
-
|
|
69
|
-
## 6. Resume after interruption
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
mm-harness last --target "$TARGET" --json | jq '.last | {command, args, verdict, evidencePaths, startedAt, finishedAt}'
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
Expected: the last operation can be reconstructed without rerunning it, including its arguments, verdict, evidence paths, and timestamps.
|
|
76
|
-
|
|
77
|
-
## 7. Recipe proof smoke
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
mm-harness run --list --adapter "$ADAPTER" --json | jq '{actions: .actions[0:5], flows: .flows[0:5]}'
|
|
81
|
-
export RECIPE=replace-with-a-safe-recipe-name-or-path
|
|
82
|
-
export ARTIFACTS_DIR="$(mktemp -d)"
|
|
83
|
-
mm-harness run "$RECIPE" --plan --adapter "$ADAPTER" --target "$TARGET" --json | jq '{status, plan}'
|
|
84
|
-
mm-harness run "$RECIPE" --adapter "$ADAPTER" --target "$TARGET" --artifacts-dir "$ARTIFACTS_DIR"
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
Expected: the plan validates before execution; the final result identifies evidence paths and `mm-harness last --json` records the run.
|
|
88
|
-
|
|
89
|
-
Optional JSONL check:
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
mm-harness run "$RECIPE" --adapter "$ADAPTER" --target "$TARGET" --artifacts-dir "$ARTIFACTS_DIR-stream" --json-stream | jq -c .
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
Expected: complete JSON objects arrive line by line while the run is active.
|
|
96
|
-
|
|
97
|
-
## Cleanup
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
[ "$ADAPTER" = core ] || mm-harness stop --adapter "$ADAPTER" --target "$TARGET"
|
|
101
|
-
mm-harness status --target "$TARGET" --json | jq .
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Record the harness version, checkout SHA, adapter/platform, failed command, exit code, and JSON envelope for any discrepancy.
|
|
1
|
+
# Human QA
|
|
2
|
+
|
|
3
|
+
Run this from each product checkout before a release. Verify the visible outcome,
|
|
4
|
+
not only the exit code.
|
|
5
|
+
|
|
6
|
+
## Common
|
|
7
|
+
|
|
8
|
+
- [ ] `mm-harness --version` prints the candidate version.
|
|
9
|
+
- [ ] `mm-harness doctor` detects the correct product and reports only current
|
|
10
|
+
configuration.
|
|
11
|
+
- [ ] A misspelled flag explains the error and gives a runnable next command.
|
|
12
|
+
- [ ] `mm-harness actions` and `mm-harness flows` return useful, bounded discovery.
|
|
13
|
+
- [ ] `mm-harness fixtures set` either applies the fixture or names the missing
|
|
14
|
+
file and exact recovery action.
|
|
15
|
+
- [ ] `mm-harness run <safe-recipe> --artifacts-dir temp/qa-proof` prints findings,
|
|
16
|
+
diagnostics, and absolute evidence paths.
|
|
17
|
+
- [ ] `mm-harness last --json` identifies that run without rerunning it.
|
|
18
|
+
- [ ] `mm-harness doctor --json` is one parseable document with no human decoration.
|
|
19
|
+
|
|
20
|
+
## Extension
|
|
21
|
+
|
|
22
|
+
- [ ] `mm-harness launch` opens/reuses the checkout's named Chrome profile.
|
|
23
|
+
- [ ] `mm-harness launch --sidepanel` opens the MetaMask sidepanel without extra
|
|
24
|
+
Extension tabs.
|
|
25
|
+
- [ ] `mm-harness debug` opens connected DevTools for the active MetaMask target.
|
|
26
|
+
- [ ] `mm-harness logs --source extension` shows Extension console events.
|
|
27
|
+
- [ ] `mm-harness logs --source dapp` shows dapp console events separately.
|
|
28
|
+
- [ ] Edit a visible source string twice, waiting for successful incremental
|
|
29
|
+
compilation after each edit; refresh the browser and confirm both changes.
|
|
30
|
+
- [ ] Revert the edit, confirm a third incremental compilation, and verify the
|
|
31
|
+
same watcher and Chrome process were reused.
|
|
32
|
+
|
|
33
|
+
## Mobile
|
|
34
|
+
|
|
35
|
+
- [ ] `mm-harness launch ios` boots/reuses the intended simulator and opens the app.
|
|
36
|
+
- [ ] `mm-harness launch android` targets the intended emulator/device.
|
|
37
|
+
- [ ] `mm-harness logs --source metro` and `--source app` show distinct streams.
|
|
38
|
+
- [ ] `mm-harness debug` opens the usable React Native developer surface.
|
|
39
|
+
- [ ] Change a visible JS string, confirm Metro rebuilds, reload the app, and see
|
|
40
|
+
the change without a native rebuild.
|
|
41
|
+
|
|
42
|
+
## Core
|
|
43
|
+
|
|
44
|
+
- [ ] `mm-harness status`, `doctor`, `actions`, `flows`, and a safe recipe run work
|
|
45
|
+
without browser/device assumptions.
|
|
46
|
+
|
|
47
|
+
Record the command, version, checkout SHA, visible mismatch, exit code, and JSON
|
|
48
|
+
error envelope for any failure.
|
package/docs/CODE-MAP.md
CHANGED
|
@@ -11,7 +11,7 @@ bin/mm-harness bash front door: MM_HARNESS_BIN dev/prod switch,
|
|
|
11
11
|
│ stale-dist warning), deps ensure
|
|
12
12
|
▼
|
|
13
13
|
src/mm-harness-cli.ts commander surface: grouped colored help, per-command
|
|
14
|
-
│ --help
|
|
14
|
+
│ --help and usage errors; delegates in-process
|
|
15
15
|
▼
|
|
16
16
|
src/cli.ts parse + dispatch ONLY — no verb logic lives here
|
|
17
17
|
│
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Video demo validation
|
|
2
|
+
|
|
3
|
+
Candidate: local packed `@deeeed/metamask-harness` 0.17.1 installed globally.
|
|
4
|
+
Run commands from the named checkout; product/ports are auto-detected.
|
|
5
|
+
|
|
6
|
+
## Common
|
|
7
|
+
|
|
8
|
+
- [x] `mm-harness --version` prints `0.17.1` from the global npm install.
|
|
9
|
+
- [x] `yarn check` passes.
|
|
10
|
+
- [x] No `package-lock.json`; Yarn state is valid.
|
|
11
|
+
- [x] Current source/docs contain no compatibility or removed-command paths.
|
|
12
|
+
- [x] `doctor` reports current runtime fields only.
|
|
13
|
+
- [x] Recipe results print diagnostics and absolute artifact paths inline.
|
|
14
|
+
|
|
15
|
+
## Extension (`mme-2`)
|
|
16
|
+
|
|
17
|
+
- [x] `mm-harness doctor` reports healthy CDP and active webpack watcher.
|
|
18
|
+
- [x] `mm-harness run runner.smoke --artifacts-dir temp/final-demo-smoke` passes.
|
|
19
|
+
- [x] Smoke prints six absolute evidence paths and `diagnostics: CLEAN`.
|
|
20
|
+
- [x] `mm-harness debug` connects native DevTools to the active slot target.
|
|
21
|
+
- [x] Fullscreen and sidepanel targets are selectable.
|
|
22
|
+
- [x] Two source edits plus revert compiled incrementally with the same watcher;
|
|
23
|
+
browser refresh showed each change without relaunch.
|
|
24
|
+
|
|
25
|
+
## Mobile (`mm-1`, iOS)
|
|
26
|
+
|
|
27
|
+
- [x] `mm-harness install` writes metadata only; product checkout remains clean.
|
|
28
|
+
- [x] `mm-harness fixtures set` reads the canonical fixture and unlocks `dev1`.
|
|
29
|
+
- [x] `mm-harness call metamask.wallet.ensure_unlocked` passes from the global package.
|
|
30
|
+
- [x] `mm-harness verify` passes after fixture setup.
|
|
31
|
+
- [x] `mm-harness status` reports `WalletView`, unlocked wallet, selected account,
|
|
32
|
+
and fixture `READY`.
|
|
33
|
+
- [ ] During the recording, visually confirm the expected simulator is foregrounded.
|
|
34
|
+
|
|
35
|
+
## Core (`core-1`)
|
|
36
|
+
|
|
37
|
+
- [x] `mm-harness doctor` reports the headless controller ready.
|
|
38
|
+
- [x] Canonical wallet fixture is present.
|
|
39
|
+
- [x] `mm-harness run perps.smoke --artifacts-dir temp/final-demo-smoke` passes.
|
|
40
|
+
- [x] Positions, orders, and account state are read through the controller.
|
|
41
|
+
- [x] Evidence prints absolute paths; diagnostics correctly reports `N/A` for headless Core.
|
|
42
|
+
|
|
43
|
+
## Recording sequence
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Extension
|
|
47
|
+
cd /Users/deeeed/farmslot/repos/mme-2
|
|
48
|
+
mm-harness doctor
|
|
49
|
+
mm-harness actions positions
|
|
50
|
+
mm-harness flows
|
|
51
|
+
mm-harness run runner.smoke --artifacts-dir temp/demo
|
|
52
|
+
|
|
53
|
+
# Mobile
|
|
54
|
+
cd /Users/deeeed/farmslot/repos/mm-1
|
|
55
|
+
mm-harness launch ios
|
|
56
|
+
mm-harness fixtures set
|
|
57
|
+
mm-harness call metamask.wallet.ensure_unlocked
|
|
58
|
+
|
|
59
|
+
# Core
|
|
60
|
+
cd /Users/deeeed/farmslot/repos/core-1
|
|
61
|
+
mm-harness run perps.smoke --artifacts-dir temp/demo
|
|
62
|
+
```
|