@deeeed/metamask-harness 0.5.0 → 0.6.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/CHANGELOG.md +51 -20
- package/adapters/core/inject.sh +1 -0
- package/adapters/extension/cleanup.mjs +1 -1
- package/adapters/extension/inject.mjs +4 -1
- package/adapters/extension/launch-browser.cjs +18 -4
- package/adapters/extension/live.sh +14 -2
- package/adapters/extension/refresh-build.sh +2 -2
- package/adapters/extension/sidepanel-toggle.sh +33 -12
- package/adapters/extension/start-watch.sh +2 -2
- package/adapters/extension/wallet-fixture-state.cjs +38 -24
- package/adapters/manifest.json +32 -3
- package/adapters/mobile/inject.sh +1 -0
- package/adapters/mobile/start-metro.sh +1 -1
- package/adapters/mobile/stop-metro.sh +20 -0
- package/adapters/mobile/verify.sh +1 -1
- package/adapters/shared/activate-repo-node.sh +1 -1
- package/adapters/shared/cli-ux.sh +44 -25
- package/adapters/shared/ensure-runner-deps.sh +30 -0
- package/adapters/shared/log-tui.mjs +4 -4
- package/adapters/shared/open-debug.mjs +1 -1
- package/adapters/shared/reap-checkout-metros.sh +53 -0
- package/adapters/shared/recipe-harness-root.mjs +23 -0
- package/adapters/shared/resolve-farmslot-ports-core.mjs +205 -0
- package/adapters/shared/resolve-farmslot-ports.mjs +20 -0
- package/adapters/shared/resolve-farmslot-ports.sh +19 -126
- package/bin/mm-harness +45 -4
- package/dist/adapters/extension/runtime.js +3 -1
- package/dist/adapters/mobile/provision.js +34 -1
- package/dist/adapters/mobile/runtime-decision.js +3 -1
- package/dist/adapters/resolve-farmslot-ports.js +22 -0
- package/dist/adapters/slot-ports.js +18 -29
- package/dist/cli.js +32 -1463
- package/dist/commands/call.js +183 -0
- package/dist/commands/completion-candidates.js +58 -0
- package/dist/commands/doctor.js +101 -0
- package/dist/commands/ensure-ready.js +24 -0
- package/dist/commands/flows.js +62 -0
- package/dist/commands/launch/extension.js +40 -0
- package/dist/commands/{launch.js → launch/index.js} +15 -47
- package/dist/commands/launch/mobile.js +10 -0
- package/dist/commands/manifest.js +72 -0
- package/dist/commands/parse-args.js +189 -0
- package/dist/commands/provision.js +136 -0
- package/dist/commands/resolve-extension.js +23 -0
- package/dist/commands/run-engine.js +341 -0
- package/dist/commands/run.js +217 -0
- package/dist/commands/runtime-decision.js +58 -0
- package/dist/commands/runtime-health.js +25 -0
- package/dist/commands/runtime-launch.js +139 -0
- package/dist/commands/self-test.js +52 -0
- package/dist/commands/stop.js +52 -0
- package/dist/harness.js +8 -48
- package/dist/mm-harness-cli.js +13 -8
- package/docs/CLI-SPEC.md +1 -1
- package/docs/CODE-MAP.md +62 -0
- package/library/README.md +14 -0
- package/library/actions/core/perps/_controller.mjs +1 -1
- package/library/actions/extension/platform/cdp.mjs +2 -2
- package/library/actions/extension/wallet/ensure_unlocked.mjs +7 -1
- package/library/actions/harness-exports.mjs +27 -0
- package/library/actions/mobile/wallet/ensure_unlocked.mjs +14 -2
- package/library/actions/mobile/wallet/setup.mjs +1 -1
- package/package.json +6 -7
- package/src/adapters/core/surface.ts +0 -71
- package/src/adapters/extension/ensure-ready.ts +0 -185
- package/src/adapters/extension/extension-id.ts +0 -107
- package/src/adapters/extension/runtime-decision.ts +0 -445
- package/src/adapters/extension/runtime.ts +0 -407
- package/src/adapters/extension/surface.ts +0 -88
- package/src/adapters/mobile/deps-markers.ts +0 -21
- package/src/adapters/mobile/prepare.ts +0 -246
- package/src/adapters/mobile/provision.ts +0 -594
- package/src/adapters/mobile/runtime-decision.ts +0 -459
- package/src/adapters/mobile/surface.ts +0 -71
- package/src/adapters/slot-ports.ts +0 -165
- package/src/adapters/surface.ts +0 -117
- package/src/adapters.ts +0 -601
- package/src/cli-color.ts +0 -92
- package/src/cli-commands.ts +0 -250
- package/src/cli-version.ts +0 -141
- package/src/cli.ts +0 -2091
- package/src/commands/debug.ts +0 -65
- package/src/commands/fixtures.ts +0 -198
- package/src/commands/launch.ts +0 -470
- package/src/commands/logs.ts +0 -99
- package/src/commands/shared.ts +0 -235
- package/src/commands/update.ts +0 -316
- package/src/completions-cache.ts +0 -86
- package/src/doctor.ts +0 -215
- package/src/harness.ts +0 -797
- package/src/heal-bounds.ts +0 -198
- package/src/index.ts +0 -15
- package/src/leaf-invoke.ts +0 -28
- package/src/live-adapter-contract.ts +0 -274
- package/src/manifest.ts +0 -47
- package/src/mm-harness-cli.ts +0 -655
- package/src/paths.ts +0 -198
- package/src/progress.ts +0 -117
- package/src/recording-target.ts +0 -147
- package/src/run-recording.ts +0 -329
- package/src/runner.ts +0 -108
- package/src/types.ts +0 -57
package/src/adapters/surface.ts
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
// The per-platform surface: one interface every command resolves platform
|
|
2
|
-
// behavior through, so no command hand-rolls `if (adapter === …)` for behavior a
|
|
3
|
-
// platform owns. A command NEVER branches on adapter for behavior this interface
|
|
4
|
-
// owns; a new platform behavior extends the surface (a new member here + its
|
|
5
|
-
// three implementations), not the command. This is the enforcement mechanism for
|
|
6
|
-
// UX-PRINCIPLES.md principle 1 (context-aware by default). See
|
|
7
|
-
// docs/ADAPTER-SURFACE.md.
|
|
8
|
-
|
|
9
|
-
import type { MetaMaskRecipeAdapter } from '../types.ts';
|
|
10
|
-
import { coreSurface } from './core/surface.ts';
|
|
11
|
-
import { extensionSurface } from './extension/surface.ts';
|
|
12
|
-
import { mobileSurface } from './mobile/surface.ts';
|
|
13
|
-
|
|
14
|
-
// Read-only runtime readiness, normalized across platforms so `doctor` renders
|
|
15
|
-
// one line the same way regardless of adapter. Device platforms fill deps +
|
|
16
|
-
// devServer; core (headless) reports deps presence only (no devServer).
|
|
17
|
-
export interface AdapterRuntimeStatus {
|
|
18
|
-
decision: string;
|
|
19
|
-
reasonCode?: string;
|
|
20
|
-
reasons: string[];
|
|
21
|
-
deps?: string;
|
|
22
|
-
// The platform's dev server (Metro for mobile, webpack watcher for extension),
|
|
23
|
-
// labelled so the render names the right thing. Absent for headless core.
|
|
24
|
-
devServer?: { label: string; status: string };
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// One log file a platform writes, most-relevant first. `logs` tails the first
|
|
28
|
-
// candidate that exists.
|
|
29
|
-
export interface AdapterLogSource {
|
|
30
|
-
label: string;
|
|
31
|
-
path: string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Result of stopping the platform's dev server. `headless` is the core case —
|
|
35
|
-
// there is nothing to stop, so `stop` teaches instead. `stopped` carries the
|
|
36
|
-
// exit status plus, when the platform counts them, how many processes were
|
|
37
|
-
// signalled and the raw leaf output for the --json envelope.
|
|
38
|
-
export type AdapterDevServerStop =
|
|
39
|
-
| { kind: 'headless'; message: string; userAction: string }
|
|
40
|
-
| { kind: 'stopped'; status: number; summary: string; signalled?: number; output?: string };
|
|
41
|
-
|
|
42
|
-
export interface AdapterDevServer {
|
|
43
|
-
// One noun for the dev server this platform runs ("Metro", "webpack watcher").
|
|
44
|
-
describe(): string;
|
|
45
|
-
// Stop the dev server this checkout owns, port/pid-scoped. Idempotent:
|
|
46
|
-
// nothing-to-stop is success, never an error.
|
|
47
|
-
stop(target: string): AdapterDevServerStop;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Platform-phrased Next: hints so no command prints another platform's vocabulary.
|
|
51
|
-
// `launch` (re)starts the app + dev server; `relaunch` rebuilds first (the
|
|
52
|
-
// fixtures-set retry). core has no app, so its hints teach the headless path.
|
|
53
|
-
export interface AdapterHints {
|
|
54
|
-
launch: string;
|
|
55
|
-
relaunch: string;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface AdapterRunwayProvisionOptions {
|
|
59
|
-
json?: boolean;
|
|
60
|
-
platform?: string;
|
|
61
|
-
branch?: string;
|
|
62
|
-
defaultBranch?: string;
|
|
63
|
-
run?: string;
|
|
64
|
-
cacheRoot?: string;
|
|
65
|
-
simulator?: string;
|
|
66
|
-
runtime?: string;
|
|
67
|
-
deviceType?: string;
|
|
68
|
-
slot?: string;
|
|
69
|
-
watcherPort?: string;
|
|
70
|
-
runtimeDir?: string;
|
|
71
|
-
force?: boolean;
|
|
72
|
-
resolveOnly?: boolean;
|
|
73
|
-
rerunCommand: string;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface AdapterRunwayProvisionResult {
|
|
77
|
-
schemaVersion: 1;
|
|
78
|
-
command: 'provision';
|
|
79
|
-
adapter: MetaMaskRecipeAdapter;
|
|
80
|
-
target: string;
|
|
81
|
-
platform?: string;
|
|
82
|
-
status: 'pass' | 'fail';
|
|
83
|
-
exitCode: number;
|
|
84
|
-
error?: { code: string; message: string; userAction: string };
|
|
85
|
-
[key: string]: unknown;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export interface AdapterRunwayProvision {
|
|
89
|
-
run(target: string, options: AdapterRunwayProvisionOptions): Promise<AdapterRunwayProvisionResult>;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export interface AdapterSurface {
|
|
93
|
-
readonly adapter: MetaMaskRecipeAdapter;
|
|
94
|
-
// core runs no app/dev server; device adapters (mobile/extension) do. Commands
|
|
95
|
-
// ask this instead of testing `adapter === 'core'`.
|
|
96
|
-
readonly headless: boolean;
|
|
97
|
-
// Resolve slot ports/device into the environment (checkout context > pool >
|
|
98
|
-
// formula). No-op for core.
|
|
99
|
-
resolveSlotPorts(target: string): void;
|
|
100
|
-
// Read-only readiness for `doctor`. Never launches or mutates.
|
|
101
|
-
runtimeStatus(target: string): Promise<AdapterRuntimeStatus>;
|
|
102
|
-
devServer: AdapterDevServer;
|
|
103
|
-
runwayProvision: AdapterRunwayProvision;
|
|
104
|
-
// Ordered candidate log files for `logs`. Empty for core.
|
|
105
|
-
logSources(target: string): AdapterLogSource[];
|
|
106
|
-
hints: AdapterHints;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const SURFACES: Record<MetaMaskRecipeAdapter, AdapterSurface> = {
|
|
110
|
-
mobile: mobileSurface,
|
|
111
|
-
extension: extensionSurface,
|
|
112
|
-
core: coreSurface,
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export function getAdapterSurface(adapter: MetaMaskRecipeAdapter): AdapterSurface {
|
|
116
|
-
return SURFACES[adapter];
|
|
117
|
-
}
|