@deeeed/metamask-harness 0.79.0 → 0.81.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 +73 -0
- package/README.md +1 -1
- package/adapters/extension/ensure-browser.sh +2 -2
- package/adapters/extension/inject.mjs +0 -1
- package/adapters/extension/launch-browser.cjs +39 -613
- package/adapters/extension/readiness.mjs +2 -5
- package/adapters/extension/reattach.sh +2 -2
- package/adapters/extension/stamp-runtime-title.cjs +1 -1
- package/adapters/manifest.json +16 -64
- package/adapters/mobile/bridge-runtime/cdp-bridge.cjs +57 -1358
- package/adapters/mobile/bridge-runtime/teaching.cjs +20 -0
- package/adapters/mobile/inject.sh +16 -0
- package/adapters/mobile/launch-console-forwarder.cjs +1 -2
- package/adapters/mobile/open-device.sh +2 -2
- package/adapters/mobile/reload-app.mjs +4 -4
- package/adapters/mobile/reset-app-data.sh +1 -1
- package/adapters/mobile/start-console-forwarder.sh +3 -2
- package/adapters/mobile/start-metro.sh +17 -12
- package/adapters/mobile/wait-for-bridge.cjs +2 -2
- package/adapters/shared/harness-source-fingerprint.mjs +13 -8
- package/adapters/shared/open-debug.mjs +2 -2
- package/adapters/shared/sync-wallet-fixture.sh +8 -5
- package/adapters/terminal/cleanup.mjs +2 -1
- package/adapters/terminal/inject.mjs +2 -1
- package/adapters/terminal/launch.mjs +17 -13
- package/adapters/terminal/lib/mainnet-guard.mjs +9 -0
- package/adapters/terminal/lib/readiness.mjs +20 -12
- package/adapters/terminal/policy.mjs +35 -0
- package/adapters/terminal/verify.mjs +10 -3
- package/adapters/terminal/wallet-host.mjs +43 -225
- package/bin/mm-harness +9 -28
- package/dist/adapters/checkout-files.js +16 -0
- package/dist/adapters/console-capture.js +14 -1
- package/dist/adapters/core/actions.js +8 -4
- package/dist/adapters/core/overlay.js +1 -1
- package/dist/adapters/core/readiness.js +28 -1
- package/dist/adapters/core/run.js +2 -2
- package/dist/adapters/core/surface.js +16 -1
- package/dist/adapters/extension/actions.js +6 -2
- package/dist/adapters/extension/browser-pid.js +56 -0
- package/dist/adapters/extension/console-capture.js +1 -1
- package/dist/adapters/extension/doctor-checks.js +1 -1
- package/dist/adapters/extension/ensure-ready.js +5 -4
- package/dist/adapters/extension/extension-id.js +1 -1
- package/dist/adapters/extension/feature-flags.js +1 -1
- package/dist/adapters/extension/fixtures.js +1 -2
- package/dist/adapters/extension/launch.js +4 -5
- package/dist/adapters/extension/launched-browser.js +1 -2
- package/dist/adapters/extension/network-observer.js +14 -1
- package/dist/adapters/extension/overlay.js +1 -1
- package/dist/adapters/extension/product-config.js +1 -1
- package/dist/adapters/extension/readiness.js +1 -1
- package/dist/adapters/extension/reload.js +1 -1
- package/dist/adapters/extension/run.js +135 -14
- package/dist/adapters/extension/runtime-decision.js +2 -1
- package/dist/adapters/extension/runtime.js +9 -5
- package/dist/adapters/extension/surface.js +15 -2
- package/dist/adapters/extension/verify.js +2 -2
- package/dist/adapters/harness-freshness.js +2 -1
- package/dist/adapters/mobile/actions.js +4 -1
- package/dist/adapters/mobile/android-gfxinfo-performance.js +1 -3
- package/dist/adapters/mobile/app-identity.js +10 -0
- package/dist/adapters/mobile/doctor-checks.js +1 -1
- package/dist/adapters/mobile/fixtures.js +1 -1
- package/dist/adapters/mobile/launch.js +27 -28
- package/dist/adapters/mobile/lifecycle.js +1 -1
- package/dist/adapters/mobile/metro-env.js +9 -59
- package/dist/adapters/mobile/network-observer.js +68 -0
- package/dist/adapters/mobile/performance-observer.js +2 -4
- package/dist/adapters/mobile/prepare-target.js +1 -1
- package/dist/adapters/mobile/prepare.js +3 -4
- package/dist/adapters/mobile/provision.js +1 -1
- package/dist/adapters/mobile/readiness.js +1 -1
- package/dist/adapters/mobile/recording-target.js +15 -0
- package/dist/adapters/mobile/release-artifact-state.js +1 -1
- package/dist/adapters/mobile/reload.js +1 -1
- package/dist/adapters/mobile/run.js +39 -15
- package/dist/adapters/mobile/runtime-decision.js +2 -4
- package/dist/adapters/mobile/source-freshness.js +22 -126
- package/dist/adapters/mobile/surface.js +26 -3
- package/dist/adapters/mobile/ui.js +16 -5
- package/dist/adapters/mobile/verify.js +2 -3
- package/dist/adapters/performance/cdp-trace.js +1 -1
- package/dist/adapters/performance/device-platform.js +1 -1
- package/dist/adapters/perps-order-inputs.js +36 -0
- package/dist/adapters/proof-failure.js +11 -0
- package/dist/adapters/slot-ports.js +1 -1
- package/dist/adapters/surface.js +1 -0
- package/dist/adapters/terminal/actions.js +4 -1
- package/dist/adapters/terminal/console-capture.js +1 -1
- package/dist/adapters/terminal/doctor-checks.js +2 -0
- package/dist/adapters/terminal/launch.js +4 -1
- package/dist/adapters/terminal/overlay.js +8 -1
- package/dist/adapters/terminal/run.js +33 -5
- package/dist/adapters/terminal/surface.js +9 -1
- package/dist/adapters.js +27 -7
- package/dist/advisor-policy.js +1 -1
- package/dist/checkout-view.js +1 -2
- package/dist/cli.js +59 -21
- package/dist/command-contract.js +1 -26
- package/dist/commands/check.js +33 -10
- package/dist/commands/checklist.js +1 -1
- package/dist/commands/completion-candidates.js +6 -14
- package/dist/commands/config.js +2 -2
- package/dist/commands/core-readiness.js +12 -7
- package/dist/commands/debug.js +3 -3
- package/dist/commands/device-target.js +5 -5
- package/dist/commands/doctor.js +2 -14
- package/dist/commands/domain.js +2 -2
- package/dist/commands/ensure-ready.js +1 -7
- package/dist/commands/fixtures.js +5 -6
- package/dist/commands/help.js +3 -4
- package/dist/commands/launch/device.js +10 -17
- package/dist/commands/launch/extension.js +2 -8
- package/dist/commands/launch/mobile.js +1 -1
- package/dist/commands/logs.js +3 -3
- package/dist/commands/mobile-device-view.js +4 -2
- package/dist/commands/overlay.js +110 -0
- package/dist/commands/pin.js +1 -1
- package/dist/commands/pr-body.js +2 -2
- package/dist/commands/prepare.js +4 -9
- package/dist/commands/provision.js +3 -12
- package/dist/commands/recipe-advice.js +1 -2
- package/dist/commands/recipe-quality.js +2 -3
- package/dist/commands/resolve-extension.js +1 -7
- package/dist/commands/review.js +4 -4
- package/dist/commands/runtime-decision.js +1 -6
- package/dist/commands/runtime-health.js +1 -7
- package/dist/commands/runtime-launch.js +1 -13
- package/dist/commands/self-test.js +5 -8
- package/dist/commands/status-watch.js +1 -2
- package/dist/commands/status.js +2 -5
- package/dist/commands/task-init.js +2 -3
- package/dist/commands/tutorial.js +2 -2
- package/dist/commands/update.js +1 -1
- package/dist/completions-cache.js +1 -1
- package/dist/console-classifier.js +19 -0
- package/dist/doctor.js +2 -3
- package/dist/engine.js +57 -0
- package/dist/funding-execution-context.js +96 -1
- package/dist/host.js +32 -0
- package/dist/index.js +1 -6
- package/dist/live-tsx.js +49 -0
- package/dist/mm-harness-cli.js +4 -6
- package/dist/paths.js +34 -64
- package/dist/performance-observation.js +3 -5
- package/dist/progress.js +1 -1
- package/dist/recipe-assistance-context.js +6 -9
- package/dist/recipe-security.js +2 -59
- package/dist/review/knowledge.js +2 -2
- package/dist/runner.js +7 -4
- package/dist/runtime-context.js +1 -1
- package/dist/task-view.js +2 -3
- package/docs/CONTRIBUTING.md +5 -3
- package/docs/RECIPES.md +31 -3
- package/docs/cli-contract.md +2 -2
- package/docs/feature-guard.md +90 -0
- package/library/README.md +3 -1
- package/library/actions/core/perps/_controller.mjs +153 -134
- package/library/actions/core/perps/_rewards.mjs +186 -0
- package/library/actions/core/perps/close_positions.mjs +1 -1
- package/library/actions/core/perps/place_order.mjs +167 -45
- package/library/actions/core/perps/quote_fees.mjs +61 -0
- package/library/actions/core/wallet/list_accounts.mjs +14 -57
- package/library/actions/extension/feature_flags/state.mjs +1 -1
- package/library/actions/extension/perps/close_visible_position.mjs +5 -0
- package/library/actions/extension/perps/edit_margin.mjs +4 -0
- package/library/actions/extension/perps/mutation-receipt.mjs +95 -3
- package/library/actions/extension/perps/perps.mjs +320 -3
- package/library/actions/extension/perps/place_order.mjs +3 -1
- package/library/actions/extension/perps/update_position_tpsl.mjs +4 -0
- package/library/actions/extension/platform/cdp.mjs +73 -11
- package/library/actions/harness-exports.mjs +1 -6
- package/library/actions/mobile/app/network-control.mjs +6 -8
- package/library/actions/mobile/perps/perps.mjs +216 -11
- package/library/actions/mobile/perps/place_order.mjs +3 -1
- package/library/actions/mobile/perps/prepare_local_snapshot_endpoint.mjs +1 -1
- package/library/actions/mobile/platform/bridge.mjs +8 -8
- package/library/actions/mobile/platform/native-session-name.mjs +21 -1
- package/library/actions/mobile/platform/native-session.mjs +3 -4
- package/library/actions/mobile/platform/observe-ui.mjs +12 -6
- package/library/actions/mobile/ui/native-navigation.mjs +4 -3
- package/library/actions/mobile/wallet/native-ui.mjs +3 -2
- package/library/actions/shared/analytics/_adapter.mjs +1 -1
- package/library/actions/shared/console-findings.mjs +1 -1
- package/library/actions/shared/perps/order-policy.mjs +177 -0
- package/library/actions/shared/wallet/fixture-accounts.mjs +84 -0
- package/library/actions/terminal/app/launch.mjs +3 -2
- package/library/actions/terminal/platform/hud.mjs +2 -1
- package/library/actions/terminal/platform/page.mjs +2 -1
- package/library/actions/terminal/platform/runtime.mjs +2 -1
- package/library/actions/terminal/wallet/_signature-log.mjs +40 -161
- package/library/actions/terminal/wallet/assert_signatures.mjs +6 -12
- package/library/actions/terminal/wallet/read_signatures.mjs +10 -9
- package/library/manifests/core.action-manifest.json +87 -13
- package/library/manifests/extension.action-manifest.json +4 -0
- package/library/manifests/mobile.action-manifest.json +12 -0
- package/package.json +8 -9
- package/site/assets/help-recipes.json +1 -0
- package/adapters/extension/lib/slot-title.cjs +0 -292
- package/adapters/mobile/bridge-runtime/console-forwarder.cjs +0 -472
- package/adapters/mobile/bridge-runtime/lib/bridge-errors.cjs +0 -125
- package/adapters/mobile/bridge-runtime/lib/cdp-broker.cjs +0 -1055
- package/adapters/mobile/bridge-runtime/lib/cdp-eval.cjs +0 -110
- package/adapters/mobile/bridge-runtime/lib/config.cjs +0 -61
- package/adapters/mobile/bridge-runtime/lib/console-format.cjs +0 -53
- package/adapters/mobile/bridge-runtime/lib/devtools-proxy.cjs +0 -177
- package/adapters/mobile/bridge-runtime/lib/issue-capture.cjs +0 -446
- package/adapters/mobile/bridge-runtime/lib/match-bridge-target.cjs +0 -84
- package/adapters/mobile/bridge-runtime/lib/target-discovery.cjs +0 -403
- package/adapters/mobile/bridge-runtime/lib/ws-client.cjs +0 -116
- package/adapters/mobile/coalesce-metro-log.cjs +0 -24
- package/adapters/mobile/launch-metro.cjs +0 -77
- package/adapters/mobile/metro-config.cjs +0 -98
- package/adapters/mobile/metro-log-generation.cjs +0 -106
- package/adapters/terminal/lib/origin.mjs +0 -30
- package/adapters/terminal/lib/page-script.mjs +0 -246
- package/adapters/terminal/lib/strict-wallet.mjs +0 -138
- package/dist/adapters/mobile/frame-metrics.js +0 -118
- package/dist/adapters/mobile/video-recorder.js +0 -289
- package/dist/artifact-files.js +0 -92
- package/dist/checkout-lock.js +0 -149
- package/dist/cli-color.js +0 -98
- package/dist/command-journal.js +0 -308
- package/dist/commands/call.js +0 -685
- package/dist/commands/last.js +0 -60
- package/dist/commands/launch/index.js +0 -109
- package/dist/commands/list-executables.js +0 -247
- package/dist/commands/manifest.js +0 -488
- package/dist/commands/parse-args.js +0 -279
- package/dist/commands/reload.js +0 -41
- package/dist/commands/run-engine.js +0 -1340
- package/dist/commands/run-report.js +0 -241
- package/dist/commands/run.js +0 -751
- package/dist/commands/shared.js +0 -323
- package/dist/commands/stop.js +0 -60
- package/dist/devices.js +0 -100
- package/dist/discovery.js +0 -15
- package/dist/execution-provenance.js +0 -332
- package/dist/harness.js +0 -451
- package/dist/heal-bounds.js +0 -137
- package/dist/json-stream.js +0 -60
- package/dist/leaf-invoke.js +0 -19
- package/dist/library-provenance.js +0 -33
- package/dist/live-adapter-contract.js +0 -380
- package/dist/metamask-action-validation.js +0 -68
- package/dist/network-observation.js +0 -290
- package/dist/recording-target.js +0 -120
- package/dist/run-diagnostics.js +0 -364
- package/dist/run-recording.js +0 -481
- package/dist/runtime-proof.js +0 -90
- package/library/actions/mobile/platform/tool-paths.mjs +0 -123
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
|
+
import "./host.js";
|
|
2
|
+
import "./adapters/surface.js";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import {
|
|
5
|
+
detectAdapter,
|
|
6
|
+
handleActions,
|
|
7
|
+
handleCall,
|
|
8
|
+
handleHarness,
|
|
9
|
+
handleLast,
|
|
10
|
+
handleLaunch,
|
|
11
|
+
handleReload,
|
|
12
|
+
handleRun,
|
|
13
|
+
handleStop,
|
|
14
|
+
parseArgs,
|
|
15
|
+
targetPath
|
|
16
|
+
} from "@farmslot/recipe-cli/harness";
|
|
17
|
+
import { stopProjectCollector } from "../library/actions/shared/analytics/collector.mjs";
|
|
1
18
|
import { adapterRegistry } from "./adapters/registry.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
19
|
+
import { applyDeviceTargeting } from "./commands/device-target.js";
|
|
20
|
+
import { metaMaskEngine } from "./engine.js";
|
|
21
|
+
import { walletFixturePath } from "./paths.js";
|
|
4
22
|
import { handleDoctor } from "./commands/doctor.js";
|
|
5
23
|
import { handleProvision } from "./commands/provision.js";
|
|
6
24
|
import { handleRuntimeHealth } from "./commands/runtime-health.js";
|
|
@@ -8,15 +26,10 @@ import { handleRuntimeLaunch } from "./commands/runtime-launch.js";
|
|
|
8
26
|
import { handleRuntimeDecision } from "./commands/runtime-decision.js";
|
|
9
27
|
import { handleResolveExtension } from "./commands/resolve-extension.js";
|
|
10
28
|
import { handleEnsureReady } from "./commands/ensure-ready.js";
|
|
11
|
-
import { handleRun } from "./commands/run.js";
|
|
12
29
|
import { handleSelfTest } from "./commands/self-test.js";
|
|
13
|
-
import { handleCall } from "./commands/call.js";
|
|
14
|
-
import { handleStop } from "./commands/stop.js";
|
|
15
30
|
import { handleCompletionCandidates, invalidateCompletionCache } from "./commands/completion-candidates.js";
|
|
16
|
-
import { handleLaunch } from "./commands/launch/index.js";
|
|
17
31
|
import { handleLogs } from "./commands/logs.js";
|
|
18
32
|
import { handleDebug } from "./commands/debug.js";
|
|
19
|
-
import { handleReload } from "./commands/reload.js";
|
|
20
33
|
import { handleFixtures } from "./commands/fixtures.js";
|
|
21
34
|
import { handleRecipeQuality } from "./commands/recipe-quality.js";
|
|
22
35
|
import { handleStatus } from "./commands/status.js";
|
|
@@ -25,21 +38,46 @@ import { handleChecklist } from "./commands/checklist.js";
|
|
|
25
38
|
import { handleExecutionTemplate } from "./commands/execution-template.js";
|
|
26
39
|
import { handlePrepare } from "./commands/prepare.js";
|
|
27
40
|
import { handleTaskInit } from "./commands/task-init.js";
|
|
28
|
-
import { handleLast } from "./commands/last.js";
|
|
29
41
|
import { handleReview } from "./commands/review.js";
|
|
30
42
|
import { handleDomain } from "./commands/domain.js";
|
|
31
43
|
import { handleConfig } from "./commands/config.js";
|
|
32
44
|
import { handlePrBody } from "./commands/pr-body.js";
|
|
33
|
-
import {
|
|
45
|
+
import { overlayCommandOptions } from "./commands/overlay.js";
|
|
46
|
+
const stopOptions = {
|
|
47
|
+
companions: async (target) => {
|
|
48
|
+
const collector = await stopProjectCollector(target);
|
|
49
|
+
return collector.stopped && collector.pid !== null ? [{ label: "analytics collector", pid: collector.pid }] : [];
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const targetDevice = (command, adapter, options) => applyDeviceTargeting(command, adapter, options, { gate: true, rerun: "" });
|
|
53
|
+
const runOptions = {
|
|
54
|
+
engine: metaMaskEngine,
|
|
55
|
+
targetDevice,
|
|
56
|
+
plan: {
|
|
57
|
+
// The wallet fixture `fixtures set` seeds.
|
|
58
|
+
steps: (target) => [{
|
|
59
|
+
step: "fixture.file",
|
|
60
|
+
confidence: "static",
|
|
61
|
+
status: "ok",
|
|
62
|
+
detail: fs.existsSync(walletFixturePath(target)) ? `present: ${walletFixturePath(target)}` : `absent: ${walletFixturePath(target)} (fixtures set to seed)`
|
|
63
|
+
}],
|
|
64
|
+
launchDetail: "would launch/attach the app + heal transport (Metro/Chrome/CDP) before executing"
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const callOptions = {
|
|
68
|
+
engine: metaMaskEngine,
|
|
69
|
+
targetDevice,
|
|
70
|
+
// A wallet action makes the most useful first example.
|
|
71
|
+
exampleAction: (names) => names.find((name) => /wallet|unlock/u.test(name))
|
|
72
|
+
};
|
|
34
73
|
const COMMANDS = {
|
|
35
|
-
actions: handleActions,
|
|
74
|
+
actions: (parsed) => handleActions(parsed, { catalog: metaMaskEngine }),
|
|
36
75
|
doctor: handleDoctor,
|
|
37
76
|
"runtime-health": handleRuntimeHealth,
|
|
38
77
|
"runtime-decision": handleRuntimeDecision,
|
|
39
78
|
"runtime-launch": handleRuntimeLaunch,
|
|
40
79
|
"resolve-extension": handleResolveExtension,
|
|
41
80
|
"ensure-ready": handleEnsureReady,
|
|
42
|
-
run: handleRun,
|
|
43
81
|
"self-test": handleSelfTest
|
|
44
82
|
};
|
|
45
83
|
const OVERLAY_COMMANDS = ["install", "verify", "cleanup"];
|
|
@@ -98,35 +136,35 @@ async function main(argv) {
|
|
|
98
136
|
return command ? 0 : 2;
|
|
99
137
|
}
|
|
100
138
|
if (command === "status" || command === "health" || command === "home") {
|
|
101
|
-
return handleStatus(parseArgs(argv.slice(1)
|
|
139
|
+
return handleStatus(parseArgs(argv.slice(1)));
|
|
102
140
|
}
|
|
103
|
-
if (command === "
|
|
141
|
+
if (command === "run") return handleRun(argv.slice(1), runOptions);
|
|
142
|
+
if (command === "call") return handleCall(argv.slice(1), callOptions);
|
|
104
143
|
if (command === "completion-candidates") return handleCompletionCandidates(argv.slice(1));
|
|
105
|
-
if (command === "provision") return handleProvision(parseArgs(argv.slice(1)
|
|
144
|
+
if (command === "provision") return handleProvision(parseArgs(argv.slice(1)));
|
|
106
145
|
if (OVERLAY_COMMANDS.includes(command)) {
|
|
107
146
|
if (command === "verify" && process.env.MM_HARNESS_SKIP_OVERLAY_ENSURE !== "1") {
|
|
108
147
|
try {
|
|
109
|
-
const { options } = parseArgs(argv.slice(1)
|
|
148
|
+
const { options } = parseArgs(argv.slice(1));
|
|
110
149
|
const target = targetPath(options);
|
|
111
150
|
const adapterRaw = (typeof options["adapter"] === "string" ? options["adapter"] : void 0) ?? (typeof options["platform"] === "string" ? options["platform"] : void 0) ?? detectAdapter(target);
|
|
112
|
-
await import("./adapters/surface.js");
|
|
113
151
|
if (adapterRaw && adapterRegistry.has(adapterRaw)) {
|
|
114
152
|
await handleHarness(["install", "--platform", adapterRaw, "--target", target, "--quiet"]);
|
|
115
153
|
}
|
|
116
154
|
} catch {
|
|
117
155
|
}
|
|
118
156
|
}
|
|
119
|
-
const code = await handleHarness(argv);
|
|
157
|
+
const code = await handleHarness(argv, overlayCommandOptions);
|
|
120
158
|
if (code === 0 && command === "install") {
|
|
121
159
|
try {
|
|
122
|
-
invalidateCompletionCache(targetPath(parseArgs(argv.slice(1)
|
|
160
|
+
invalidateCompletionCache(targetPath(parseArgs(argv.slice(1)).options));
|
|
123
161
|
} catch {
|
|
124
162
|
}
|
|
125
163
|
}
|
|
126
164
|
return code;
|
|
127
165
|
}
|
|
128
166
|
if (command === "launch") return handleLaunch(argv.slice(1));
|
|
129
|
-
if (command === "stop") return handleStop(argv.slice(1));
|
|
167
|
+
if (command === "stop") return handleStop(argv.slice(1), stopOptions);
|
|
130
168
|
if (command === "logs") return handleLogs(argv.slice(1));
|
|
131
169
|
if (command === "debug") return handleDebug(argv.slice(1));
|
|
132
170
|
if (command === "reload") return handleReload(argv.slice(1));
|
|
@@ -137,14 +175,14 @@ async function main(argv) {
|
|
|
137
175
|
if (command === "execution-template") return handleExecutionTemplate(argv.slice(1));
|
|
138
176
|
if (command === "task") return handleTaskInit(argv.slice(1));
|
|
139
177
|
if (command === "prepare") return handlePrepare(argv.slice(1));
|
|
140
|
-
if (command === "last") return handleLast(parseArgs(argv.slice(1)
|
|
178
|
+
if (command === "last") return handleLast(parseArgs(argv.slice(1)));
|
|
141
179
|
if (command === "review") return handleReview(argv.slice(1));
|
|
142
180
|
if (command === "domain") return handleDomain(argv.slice(1));
|
|
143
181
|
if (command === "config") return handleConfig(argv.slice(1));
|
|
144
182
|
if (command === "pr-body") return handlePrBody(argv.slice(1));
|
|
145
183
|
const handler = COMMANDS[command];
|
|
146
184
|
if (!handler) throw new Error(`Unknown command: ${command}`);
|
|
147
|
-
return handler(parseArgs(argv.slice(1), command));
|
|
185
|
+
return handler(parseArgs(argv.slice(1), command === "runtime-decision" ? { recordIsFlag: true } : {}));
|
|
148
186
|
}
|
|
149
187
|
if (!globalThis.__MM_HARNESS_WRAPPER__) {
|
|
150
188
|
try {
|
package/dist/command-contract.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { closest } from "@farmslot/recipe-cli/harness";
|
|
1
2
|
const bool = () => ({ kind: "boolean" });
|
|
2
3
|
const value = (choices) => ({ kind: "value", ...choices ? { choices } : {} });
|
|
3
4
|
const optionalValue = (choices) => ({ kind: "optional-value", ...choices ? { choices } : {} });
|
|
@@ -698,34 +699,8 @@ function actionFor(received, suggestion, example) {
|
|
|
698
699
|
function exampleFor(command, examples) {
|
|
699
700
|
return command ? examples[command] ?? `mm-harness ${command} --help` : "mm-harness --help";
|
|
700
701
|
}
|
|
701
|
-
function closest(input, candidates) {
|
|
702
|
-
if (candidates.length === 0) return void 0;
|
|
703
|
-
const ranked = candidates.map((candidate) => ({ candidate, distance: levenshtein(input, candidate) })).sort((left, right) => left.distance - right.distance || left.candidate.localeCompare(right.candidate));
|
|
704
|
-
const best = ranked[0];
|
|
705
|
-
if (!best) return void 0;
|
|
706
|
-
const threshold = Math.max(2, Math.floor(Math.max(input.length, best.candidate.length) / 3));
|
|
707
|
-
return best.distance <= threshold ? best.candidate : void 0;
|
|
708
|
-
}
|
|
709
|
-
function levenshtein(left, right) {
|
|
710
|
-
let twoBack;
|
|
711
|
-
let prior = Array.from({ length: right.length + 1 }, (_, index) => index);
|
|
712
|
-
for (let leftIndex = 1; leftIndex <= left.length; leftIndex += 1) {
|
|
713
|
-
const current = [leftIndex];
|
|
714
|
-
for (let rightIndex = 1; rightIndex <= right.length; rightIndex += 1) {
|
|
715
|
-
const substitution = prior[rightIndex - 1] + (left[leftIndex - 1] === right[rightIndex - 1] ? 0 : 1);
|
|
716
|
-
current[rightIndex] = Math.min((current[rightIndex - 1] ?? 0) + 1, (prior[rightIndex] ?? 0) + 1, substitution);
|
|
717
|
-
if (twoBack && leftIndex > 1 && rightIndex > 1 && left[leftIndex - 1] === right[rightIndex - 2] && left[leftIndex - 2] === right[rightIndex - 1]) {
|
|
718
|
-
current[rightIndex] = Math.min(current[rightIndex] ?? 0, (twoBack[rightIndex - 2] ?? 0) + 1);
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
twoBack = prior;
|
|
722
|
-
prior = current;
|
|
723
|
-
}
|
|
724
|
-
return prior[right.length] ?? right.length;
|
|
725
|
-
}
|
|
726
702
|
export {
|
|
727
703
|
PUBLIC_COMMAND_CONTRACTS,
|
|
728
|
-
closest,
|
|
729
704
|
publicCommandNames,
|
|
730
705
|
publicCommandTokens,
|
|
731
706
|
validatePublicInvocation
|
package/dist/commands/check.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
+
import { detectAdapter, EXIT, usageOut, optionFlag, optionString, parseArgs, shellQuote } from "@farmslot/recipe-cli/harness";
|
|
1
2
|
import { spawnSync } from "node:child_process";
|
|
2
3
|
import fs from "node:fs";
|
|
3
4
|
import path from "node:path";
|
|
4
|
-
import
|
|
5
|
-
import { EXIT, usageOut } from "./shared.js";
|
|
6
|
-
import { optionFlag, optionString, parseArgs, shellQuote } from "./parse-args.js";
|
|
5
|
+
import "../adapters/surface.js";
|
|
7
6
|
const USAGE = "mm-harness check diff [--fix] [--target <repo>] [--adapter mobile|extension|core] [--base <ref>] [--profile fast|full] [--artifacts-dir <dir>] [--json]";
|
|
8
7
|
const JS_TS_EXT_RE = /\.(?:c|m)?jsx?$|\.tsx?$/u;
|
|
9
8
|
const FORMAT_EXT_RE = /\.(?:c|m)?jsx?$|\.tsx?$|\.json$|\.md$|\.css$|\.scss$|\.ya?ml$/u;
|
|
10
9
|
const TEST_FILE_RE = /(?:^|[./_-])(?:test|spec)\.(?:c|m)?jsx?$|(?:^|[./_-])(?:test|spec)\.tsx?$/u;
|
|
11
10
|
const ESLINT_SUPPRESSION_RE = /^\s*eslint-disable(?:-line|-next-line)?\b/u;
|
|
11
|
+
const EXTENSION_LOCALE_RE = /^app\/_locales\//u;
|
|
12
12
|
async function handleCheck(argv) {
|
|
13
|
-
const { positional, options } = parseArgs(argv
|
|
13
|
+
const { positional, options } = parseArgs(argv);
|
|
14
14
|
const action = positional[0];
|
|
15
15
|
const json = optionFlag(options, "json");
|
|
16
16
|
const fix = optionFlag(options, "fix");
|
|
@@ -53,10 +53,12 @@ async function handleCheck(argv) {
|
|
|
53
53
|
const mergeBase = resolveMergeBase(target, baseRef);
|
|
54
54
|
const changedFiles = listChangedFiles(target, mergeBase, artifactsDir);
|
|
55
55
|
const existingChangedFiles = changedFiles.filter((file) => fs.existsSync(path.join(target, file)));
|
|
56
|
+
const untracked = untrackedFiles(target);
|
|
56
57
|
const suppressionCheck = checkNewEslintSuppressions({
|
|
57
58
|
target,
|
|
58
59
|
artifactsDir,
|
|
59
60
|
mergeBase,
|
|
61
|
+
untracked,
|
|
60
62
|
files: existingChangedFiles.filter((file) => JS_TS_EXT_RE.test(file))
|
|
61
63
|
});
|
|
62
64
|
const policyFailed = suppressionCheck.status === "fail";
|
|
@@ -98,6 +100,9 @@ async function handleCheck(argv) {
|
|
|
98
100
|
files: existingChangedFiles.filter((file) => TEST_FILE_RE.test(file))
|
|
99
101
|
})
|
|
100
102
|
);
|
|
103
|
+
if (adapter === "extension") {
|
|
104
|
+
checks.push(...runExtensionDiffChecks({ target, artifactsDir, packageJson, files: changedFiles }));
|
|
105
|
+
}
|
|
101
106
|
if (profile === "full") {
|
|
102
107
|
checks.push(runTypecheck({ target, artifactsDir, packageJson }));
|
|
103
108
|
} else {
|
|
@@ -188,10 +193,10 @@ function listChangedFiles(target, mergeBase, artifactsDir) {
|
|
|
188
193
|
}
|
|
189
194
|
};
|
|
190
195
|
if (mergeBase) {
|
|
191
|
-
addLines(runCommand("git", ["diff", "--name-only", "--diff-filter=
|
|
196
|
+
addLines(runCommand("git", ["diff", "--name-only", "--no-renames", "--diff-filter=ACMRD", `${mergeBase}...HEAD`], target).stdout);
|
|
192
197
|
}
|
|
193
|
-
addLines(runCommand("git", ["diff", "--name-only", "--diff-filter=
|
|
194
|
-
addLines(runCommand("git", ["diff", "--cached", "--name-only", "--diff-filter=
|
|
198
|
+
addLines(runCommand("git", ["diff", "--name-only", "--no-renames", "--diff-filter=ACMRD", "HEAD"], target).stdout);
|
|
199
|
+
addLines(runCommand("git", ["diff", "--cached", "--name-only", "--no-renames", "--diff-filter=ACMRD"], target).stdout);
|
|
195
200
|
addLines(runCommand("git", ["ls-files", "--others", "--exclude-standard"], target).stdout);
|
|
196
201
|
return [...files].filter((file) => !isUnderArtifactsDir(target, artifactsDir, file)).sort();
|
|
197
202
|
}
|
|
@@ -210,9 +215,7 @@ function checkNewEslintSuppressions(input) {
|
|
|
210
215
|
if (input.files.length === 0) {
|
|
211
216
|
return { id, label, status: "skip", reason: "no changed JS/TS files" };
|
|
212
217
|
}
|
|
213
|
-
const untracked =
|
|
214
|
-
runCommand("git", ["ls-files", "--others", "--exclude-standard"], input.target).stdout.split("\n").map((file) => normalizeRelativePath(file.trim())).filter(Boolean)
|
|
215
|
-
);
|
|
218
|
+
const { untracked } = input;
|
|
216
219
|
const findings = [];
|
|
217
220
|
const trackedFiles = input.files.filter((file) => !untracked.has(normalizeRelativePath(file)));
|
|
218
221
|
if (trackedFiles.length > 0) {
|
|
@@ -241,6 +244,26 @@ function checkNewEslintSuppressions(input) {
|
|
|
241
244
|
reason: `${findings.length} newly added eslint-disable directive(s)`
|
|
242
245
|
} : { id, label, status: "pass", logPath };
|
|
243
246
|
}
|
|
247
|
+
function untrackedFiles(target) {
|
|
248
|
+
return new Set(
|
|
249
|
+
runCommand("git", ["ls-files", "--others", "--exclude-standard"], target).stdout.split("\n").map((file) => normalizeRelativePath(file.trim())).filter(Boolean)
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
function runExtensionDiffChecks(input) {
|
|
253
|
+
const scripts = input.packageJson?.scripts && typeof input.packageJson.scripts === "object" ? input.packageJson.scripts : {};
|
|
254
|
+
const results = [];
|
|
255
|
+
if (typeof scripts["verify-locales"] === "string") {
|
|
256
|
+
results.push(
|
|
257
|
+
input.files.some((file) => EXTENSION_LOCALE_RE.test(normalizeRelativePath(file))) ? runCheckCommand("verify-locales", "Locale strings", input.target, input.artifactsDir, "yarn", ["verify-locales", "--quiet"]) : { id: "verify-locales", label: "Locale strings", status: "skip", reason: "no app/_locales changes" }
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
if (typeof scripts["circular-deps:check"] === "string") {
|
|
261
|
+
results.push(
|
|
262
|
+
input.files.some((file) => JS_TS_EXT_RE.test(file)) ? runCheckCommand("circular-deps", "Circular dependencies", input.target, input.artifactsDir, "yarn", ["circular-deps:check"]) : { id: "circular-deps", label: "Circular dependencies", status: "skip", reason: "no JS/TS changes" }
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
return results;
|
|
266
|
+
}
|
|
244
267
|
function findAddedSuppressions(diff) {
|
|
245
268
|
const findings = [];
|
|
246
269
|
let file = "";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { EXIT } from "@farmslot/recipe-cli/harness";
|
|
1
2
|
import { spawnSync } from "node:child_process";
|
|
2
3
|
import fs from "node:fs";
|
|
3
4
|
import { createRequire } from "node:module";
|
|
4
5
|
import path from "node:path";
|
|
5
6
|
import { HANDOFF_INPUT } from "@farmslot/agent-runtime";
|
|
6
7
|
import { enumerateChecklistCheckboxes, isTerminalWorkerSignalStatus } from "@farmslot/protocol";
|
|
7
|
-
import { EXIT } from "./shared.js";
|
|
8
8
|
const require2 = createRequire(import.meta.url);
|
|
9
9
|
const MARK_SCRIPT = require2.resolve(
|
|
10
10
|
"@farmslot/agent-runtime/scripts/mark-checklist-step.cjs"
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EXIT, listRunnableRecipes, parseArgs, optionFlag, optionString, optionStrings, resolveAdapter, resolveLibrarySources, targetPath } from "@farmslot/recipe-cli/harness";
|
|
1
2
|
import { resolveActionManifest } from "../manifest.js";
|
|
2
3
|
import {
|
|
3
4
|
invalidateCompletionCache,
|
|
@@ -5,19 +6,10 @@ import {
|
|
|
5
6
|
writeCompletionCandidates
|
|
6
7
|
} from "../completions-cache.js";
|
|
7
8
|
import { importRecipeProtocol } from "../paths.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
parseArgs,
|
|
11
|
-
optionFlag,
|
|
12
|
-
optionString,
|
|
13
|
-
optionStrings,
|
|
14
|
-
resolveAdapter,
|
|
15
|
-
targetPath
|
|
16
|
-
} from "./parse-args.js";
|
|
17
|
-
import { listRunnableRecipes, resolveMetaMaskLibrarySources } from "./run-engine.js";
|
|
9
|
+
import { metaMaskEngine } from "../engine.js";
|
|
18
10
|
async function handleCompletionCandidates(argv) {
|
|
19
11
|
const kind = argv[0];
|
|
20
|
-
const { options } = parseArgs(argv.slice(1)
|
|
12
|
+
const { options } = parseArgs(argv.slice(1));
|
|
21
13
|
const json = optionFlag(options, "json");
|
|
22
14
|
if (kind !== "actions" && kind !== "recipes") {
|
|
23
15
|
console.error("completion-candidates requires <actions|recipes>.");
|
|
@@ -28,7 +20,7 @@ async function handleCompletionCandidates(argv) {
|
|
|
28
20
|
let candidates;
|
|
29
21
|
if (kind === "actions") {
|
|
30
22
|
adapter = resolveAdapter(options).adapter;
|
|
31
|
-
const sources = await
|
|
23
|
+
const sources = await resolveLibrarySources(metaMaskEngine, optionStrings(options, "library"));
|
|
32
24
|
const { manifest } = await resolveActionManifest(adapter, optionString(options, "actionManifest"), sources);
|
|
33
25
|
const { getRecipeActionManifestActionNames } = await importRecipeProtocol();
|
|
34
26
|
candidates = getRecipeActionManifestActionNames(manifest);
|
|
@@ -38,8 +30,8 @@ async function handleCompletionCandidates(argv) {
|
|
|
38
30
|
const cacheKey = `recipes:${adapter}`;
|
|
39
31
|
candidates = readFreshCandidates(target, cacheKey);
|
|
40
32
|
if (!candidates) {
|
|
41
|
-
const sources = await
|
|
42
|
-
candidates = sources ? (await listRunnableRecipes(adapter, sources)).map((recipe) => recipe.name) : [];
|
|
33
|
+
const sources = await resolveLibrarySources(metaMaskEngine, optionStrings(options, "library")).catch(() => void 0);
|
|
34
|
+
candidates = sources ? (await listRunnableRecipes(metaMaskEngine, adapter, sources)).map((recipe) => recipe.name) : [];
|
|
43
35
|
writeCompletionCandidates(target, cacheKey, candidates);
|
|
44
36
|
}
|
|
45
37
|
}
|
package/dist/commands/config.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { optionFlag, parseArgs, usageError } from "@farmslot/recipe-cli/harness";
|
|
1
2
|
import path from "node:path";
|
|
2
3
|
import {
|
|
3
4
|
configPath,
|
|
@@ -6,7 +7,6 @@ import {
|
|
|
6
7
|
REVIEW_ADAPTERS,
|
|
7
8
|
writeConfig
|
|
8
9
|
} from "../review/knowledge.js";
|
|
9
|
-
import { optionFlag, parseArgs, usageError } from "./parse-args.js";
|
|
10
10
|
const USAGE = "Usage: mm-harness config <list|path|get <key>|set <key> <value>|unset <key>> [--json]\n keys: libraries.<name>, references.<mobile|extension|core|terminal>, advisor.<enabled|provider|model|stages>";
|
|
11
11
|
function parseKey(raw) {
|
|
12
12
|
if (!raw) throw usageError(USAGE);
|
|
@@ -36,7 +36,7 @@ function setValue(config, key, value) {
|
|
|
36
36
|
else config[key.section] = section;
|
|
37
37
|
}
|
|
38
38
|
async function handleConfig(argv) {
|
|
39
|
-
const parsed = parseArgs(argv
|
|
39
|
+
const parsed = parseArgs(argv);
|
|
40
40
|
const json = optionFlag(parsed.options, "json");
|
|
41
41
|
const [action, rawKey, rawValue] = parsed.positional;
|
|
42
42
|
const expectedPositionals = { path: 1, list: 1, get: 2, set: 3, unset: 2 }[action ?? "list"];
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { resolveLiveTsx } from "../live-tsx.js";
|
|
4
5
|
const requireFromHarness = createRequire(import.meta.url);
|
|
5
6
|
const CORE_RUNTIME_DEPS = ["immer"];
|
|
6
7
|
function coreDependencyBlock(target) {
|
|
7
8
|
const resolved = path.resolve(target);
|
|
8
9
|
const nodeLinker = readYarnNodeLinker(resolved);
|
|
9
10
|
const installAction = `cd ${shellQuote(resolved)} && yarn install --immutable`;
|
|
11
|
+
if (!resolveLiveTsx(resolved)) {
|
|
12
|
+
return process.env.TSX_BIN ? {
|
|
13
|
+
code: "CORE_TS_RUNNER_MISSING",
|
|
14
|
+
message: `TSX_BIN is ${process.env.TSX_BIN}, which is not an executable on PATH or relative to the checkout.`,
|
|
15
|
+
userAction: "unset TSX_BIN to use the tsx mm-harness ships, or point it at an existing tsx"
|
|
16
|
+
} : {
|
|
17
|
+
code: "CORE_TS_RUNNER_MISSING",
|
|
18
|
+
message: "no tsx runtime found for core actions (mm-harness ships one; this install is missing it).",
|
|
19
|
+
userAction: "reinstall mm-harness (npm install -g @deeeed/metamask-harness), or set TSX_BIN"
|
|
20
|
+
};
|
|
21
|
+
}
|
|
10
22
|
if (nodeLinker === "pnp") {
|
|
11
23
|
if (!fs.existsSync(path.join(resolved, ".pnp.cjs"))) {
|
|
12
24
|
return {
|
|
@@ -24,13 +36,6 @@ function coreDependencyBlock(target) {
|
|
|
24
36
|
userAction: installAction
|
|
25
37
|
};
|
|
26
38
|
}
|
|
27
|
-
if (!fs.existsSync(path.join(resolved, "node_modules/.bin/tsx"))) {
|
|
28
|
-
return {
|
|
29
|
-
code: "CORE_DEPS_INCOMPLETE",
|
|
30
|
-
message: "core dependencies are incomplete (node_modules/.bin/tsx is missing).",
|
|
31
|
-
userAction: installAction
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
39
|
for (const dependency of CORE_RUNTIME_DEPS) {
|
|
35
40
|
if (!canResolveFromTarget(dependency, resolved)) {
|
|
36
41
|
return {
|
package/dist/commands/debug.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { adapterDetectNext, EXIT, flag, parseFlags, resolveFlagsAdapter, spawnScript, targetOf, usageOut } from "@farmslot/recipe-cli/harness";
|
|
1
2
|
import path from "node:path";
|
|
2
3
|
import { runnerDir } from "../paths.js";
|
|
3
4
|
import { getAdapterSurface } from "../adapters/surface.js";
|
|
4
|
-
import { ADAPTER_DETECT_NEXT, EXIT, flag, parseFlags, resolveAdapter, spawnScript, targetOf, usageOut } from "./shared.js";
|
|
5
5
|
const DEBUG_BOOLEANS = /* @__PURE__ */ new Set(["worker", "devMenu", "json", "noOpen"]);
|
|
6
6
|
async function handleDebug(argv) {
|
|
7
7
|
const { options } = parseFlags(argv, DEBUG_BOOLEANS);
|
|
8
8
|
const json = flag(options, "json");
|
|
9
9
|
const target = targetOf(options);
|
|
10
|
-
const adapter =
|
|
11
|
-
if (!adapter) return usageOut(json, "debug", `could not detect the MetaMask repo type for ${target}`,
|
|
10
|
+
const adapter = resolveFlagsAdapter(options, target);
|
|
11
|
+
if (!adapter) return usageOut(json, "debug", `could not detect the MetaMask repo type for ${target}`, adapterDetectNext());
|
|
12
12
|
const surface = getAdapterSurface(adapter);
|
|
13
13
|
if (surface.headless) return usageOut(json, "debug", `${adapter} is headless; there is no debug console.`, surface.hints.relaunch);
|
|
14
14
|
surface.resolveSlotPorts(target);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { optionString, shellQuoteArg, targetPath } from "@farmslot/recipe-cli/harness";
|
|
1
2
|
import { execFileSync } from "node:child_process";
|
|
2
|
-
import { resolveMobileToolPath } from "
|
|
3
|
+
import { resolveMobileToolPath } from "@farmslot/adapter-rn";
|
|
3
4
|
import {
|
|
4
5
|
findAvailableIosSimulatorById,
|
|
5
6
|
listConnectedDevices
|
|
6
|
-
} from "
|
|
7
|
+
} from "@farmslot/adapter-rn";
|
|
7
8
|
import { getAdapterSurface } from "../adapters/surface.js";
|
|
8
9
|
import { persistExplicitDevicePin } from "../runtime-context.js";
|
|
9
|
-
import { optionString, shellQuoteArg, targetPath } from "./parse-args.js";
|
|
10
10
|
const DEVICE_SELECT_HINT = "Pass --device <name|udid|serial> to select one target. Do not shut down other connected devices to force selection.";
|
|
11
11
|
function normalizeDeviceName(value) {
|
|
12
12
|
return value.replace(/_/gu, " ").trim();
|
|
@@ -27,7 +27,7 @@ function resolveAndroidModel(serial) {
|
|
|
27
27
|
}
|
|
28
28
|
function setAndroidDeviceEnv(id, fallbackName) {
|
|
29
29
|
process.env.PLATFORM = "android";
|
|
30
|
-
process.env.
|
|
30
|
+
process.env.RECIPE_RN_EXPLICIT_PLATFORM = "android";
|
|
31
31
|
process.env.ADB_SERIAL = id;
|
|
32
32
|
process.env.ANDROID_SERIAL = id;
|
|
33
33
|
process.env.ANDROID_DEVICE = id;
|
|
@@ -39,7 +39,7 @@ function setAndroidDeviceEnv(id, fallbackName) {
|
|
|
39
39
|
}
|
|
40
40
|
function setIosDeviceEnv(id, fallbackName) {
|
|
41
41
|
process.env.PLATFORM = "ios";
|
|
42
|
-
process.env.
|
|
42
|
+
process.env.RECIPE_RN_EXPLICIT_PLATFORM = "ios";
|
|
43
43
|
process.env.IOS_SIMULATOR = fallbackName?.trim() || id;
|
|
44
44
|
process.env.SIM_UDID = id;
|
|
45
45
|
process.env.ADB_SERIAL = "";
|
package/dist/commands/doctor.js
CHANGED
|
@@ -2,28 +2,16 @@ import { execFileSync } from "node:child_process";
|
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { featureFlagReport } from "../feature-flags.js";
|
|
5
|
-
import { color } from "
|
|
5
|
+
import { color, acquireCheckoutLock, detectAdapter, resolveRuntimeContextPath, ensureOverlay, newHealState, recipeRunning, adapterDetectNext, checkoutBusyOut, EXIT, usageOut, actionManifestPathOption, applyRuntimeDirOption, optionFlag, optionString, shellQuote, targetPath } from "@farmslot/recipe-cli/harness";
|
|
6
6
|
import { collectCheckoutView, renderCheckoutView } from "../checkout-view.js";
|
|
7
7
|
import { createDoctorReport, fixtureSummary, requiredDoctorCheckSummary } from "../doctor.js";
|
|
8
|
-
import { detectAdapter, resolveRuntimeContextPath } from "../harness.js";
|
|
9
8
|
import { assertAdapter, runnerDir } from "../paths.js";
|
|
10
9
|
import { getAdapterSurface } from "../adapters/surface.js";
|
|
11
10
|
import { loadActionManifest, validateManifest } from "../manifest.js";
|
|
12
|
-
import { ensureOverlay, newHealState, recipeRunning } from "../heal-bounds.js";
|
|
13
11
|
import { applyDeviceTargeting } from "./device-target.js";
|
|
14
12
|
import { farmslotReadyIndicator } from "./farmslot-ready.js";
|
|
15
13
|
import { updateStatus } from "./update.js";
|
|
16
14
|
import { ensureRuntimeContext } from "../runtime-context.js";
|
|
17
|
-
import { acquireCheckoutLock } from "../checkout-lock.js";
|
|
18
|
-
import { ADAPTER_DETECT_NEXT, checkoutBusyOut, EXIT, usageOut } from "./shared.js";
|
|
19
|
-
import {
|
|
20
|
-
actionManifestPathOption,
|
|
21
|
-
applyRuntimeDirOption,
|
|
22
|
-
optionFlag,
|
|
23
|
-
optionString,
|
|
24
|
-
shellQuote,
|
|
25
|
-
targetPath
|
|
26
|
-
} from "./parse-args.js";
|
|
27
15
|
function applyDoctorRuntimePorts(options) {
|
|
28
16
|
const cdpPort = optionString(options, "cdpPort");
|
|
29
17
|
if (cdpPort) {
|
|
@@ -48,7 +36,7 @@ async function handleDoctor({ options }) {
|
|
|
48
36
|
const explicitAdapter = optionString(options, "adapter") ?? (platformOption === "ios" || platformOption === "android" ? "mobile" : platformOption);
|
|
49
37
|
const adapter = explicitAdapter ?? detectAdapter(target);
|
|
50
38
|
if (!adapter) {
|
|
51
|
-
return usageOut(json, "doctor", `could not detect the MetaMask repo type for ${target}`,
|
|
39
|
+
return usageOut(json, "doctor", `could not detect the MetaMask repo type for ${target}`, adapterDetectNext());
|
|
52
40
|
}
|
|
53
41
|
assertAdapter(adapter);
|
|
54
42
|
const { readiness } = getAdapterSurface(adapter);
|
package/dist/commands/domain.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { optionFlag, optionString, parseArgs, targetPath, usageError } from "@farmslot/recipe-cli/harness";
|
|
1
2
|
import {
|
|
2
3
|
changedFiles,
|
|
3
4
|
classifyDomain,
|
|
@@ -5,10 +6,9 @@ import {
|
|
|
5
6
|
discoverLibraries,
|
|
6
7
|
readConfig
|
|
7
8
|
} from "../review/knowledge.js";
|
|
8
|
-
import { optionFlag, optionString, parseArgs, targetPath, usageError } from "./parse-args.js";
|
|
9
9
|
import { adapterFromOptions } from "./review.js";
|
|
10
10
|
async function handleDomain(argv) {
|
|
11
|
-
const parsed = parseArgs(argv
|
|
11
|
+
const parsed = parseArgs(argv);
|
|
12
12
|
const target = targetPath(parsed.options);
|
|
13
13
|
const json = optionFlag(parsed.options, "json");
|
|
14
14
|
const declared = optionString(parsed.options, "domain") ?? process.env.MM_HARNESS_DOMAIN;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
+
import { adapterOption, optionFlag, optionString, parsePort, targetPath } from "@farmslot/recipe-cli/harness";
|
|
1
2
|
import { ensureExtensionReady } from "../adapters/extension/ensure-ready.js";
|
|
2
|
-
import {
|
|
3
|
-
adapterOption,
|
|
4
|
-
optionFlag,
|
|
5
|
-
optionString,
|
|
6
|
-
parsePort,
|
|
7
|
-
targetPath
|
|
8
|
-
} from "./parse-args.js";
|
|
9
3
|
async function handleEnsureReady({ options }) {
|
|
10
4
|
const adapter = adapterOption(options);
|
|
11
5
|
if (adapter !== "extension") throw new Error("ensure-ready currently applies to the extension adapter.");
|
|
@@ -4,9 +4,8 @@ import path from "node:path";
|
|
|
4
4
|
import { runnerDir, walletFixturePath } from "../paths.js";
|
|
5
5
|
import { getAdapterSurface } from "../adapters/surface.js";
|
|
6
6
|
import { fixtureFileSummary, fixtureSummary } from "../doctor.js";
|
|
7
|
-
import { acquireCheckoutLock } from "
|
|
7
|
+
import { acquireCheckoutLock, adapterDetectNext, checkoutBusyOut, EXIT, flag, parseFlags, resolveFlagsAdapter, scriptOverride, spawnScript, spawnScriptStreaming, str, targetOf, usageOut } from "@farmslot/recipe-cli/harness";
|
|
8
8
|
import { applyDeviceTargeting } from "./device-target.js";
|
|
9
|
-
import { ADAPTER_DETECT_NEXT, checkoutBusyOut, EXIT, flag, parseFlags, resolveAdapter, scriptOverride, spawnScript, spawnScriptStreaming, str, targetOf, usageOut } from "./shared.js";
|
|
10
9
|
import { FeatureFlagSpecError, fixtureFeatureFlags, parseRemoteFlagSpec } from "../feature-flags.js";
|
|
11
10
|
const FIXTURES_BOOLEANS = /* @__PURE__ */ new Set(["dev", "force", "json"]);
|
|
12
11
|
const FIXTURE_STREAM_TIMEOUT_MS = 12e4;
|
|
@@ -39,9 +38,9 @@ function fixturesStatus(options) {
|
|
|
39
38
|
);
|
|
40
39
|
}
|
|
41
40
|
const target = targetOf(options);
|
|
42
|
-
const adapter =
|
|
41
|
+
const adapter = resolveFlagsAdapter(options, target);
|
|
43
42
|
if (!adapter) {
|
|
44
|
-
return usageOut(json, "fixtures", `could not detect the MetaMask repo type for ${target}`,
|
|
43
|
+
return usageOut(json, "fixtures", `could not detect the MetaMask repo type for ${target}`, adapterDetectNext());
|
|
45
44
|
}
|
|
46
45
|
const canonical = walletFixturePath(target);
|
|
47
46
|
const summary = fixtureSummary(target, adapter);
|
|
@@ -115,9 +114,9 @@ async function handleFixturesLocked(argv) {
|
|
|
115
114
|
);
|
|
116
115
|
}
|
|
117
116
|
const target = targetOf(options);
|
|
118
|
-
const adapter =
|
|
117
|
+
const adapter = resolveFlagsAdapter(options, target);
|
|
119
118
|
if (!adapter) {
|
|
120
|
-
return usageOut(json, "fixtures", `could not detect the MetaMask repo type for ${target}`,
|
|
119
|
+
return usageOut(json, "fixtures", `could not detect the MetaMask repo type for ${target}`, adapterDetectNext());
|
|
121
120
|
}
|
|
122
121
|
const surface = getAdapterSurface(adapter);
|
|
123
122
|
surface.resolveSlotPorts(target);
|
package/dist/commands/help.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { color } from "
|
|
4
|
-
import { detectAdapter } from "../harness.js";
|
|
5
|
-
import { optionString, parseArgs, targetPath } from "./parse-args.js";
|
|
3
|
+
import { color, detectAdapter, optionString, parseArgs, targetPath } from "@farmslot/recipe-cli/harness";
|
|
6
4
|
import { handleHelpReview } from "./review.js";
|
|
5
|
+
import "../adapters/surface.js";
|
|
7
6
|
const UNSCOPED_NEXT = "cd into a MetaMask checkout or pass --adapter <mobile|extension|core|terminal>";
|
|
8
7
|
function validHelpLine(value) {
|
|
9
8
|
return typeof value === "string" || Boolean(value && typeof value.text === "string" && Array.isArray(value.adapters) && value.adapters.length > 0 && value.adapters.every((adapter) => ["mobile", "extension", "core", "terminal"].includes(adapter)));
|
|
@@ -70,7 +69,7 @@ function renderRecipeHelp(topic, harnessVersion, adapter) {
|
|
|
70
69
|
`;
|
|
71
70
|
}
|
|
72
71
|
function handleHelp(argv, context) {
|
|
73
|
-
const parsed = parseArgs(argv
|
|
72
|
+
const parsed = parseArgs(argv);
|
|
74
73
|
if (parsed.positional[0] === "review") return handleHelpReview(argv, context.harnessVersion);
|
|
75
74
|
const target = targetPath(parsed.options);
|
|
76
75
|
const adapter = optionString(parsed.options, "adapter") ?? detectAdapter(target) ?? "unscoped";
|