refactor: expose metro and remote config node apis#372
Merged
Conversation
|
11ebc42 to
f07b7a2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Expose reusable Node APIs for remote Metro and remote-config without making server code shell out to the CLI.
This stays as stable subpath exports from
agent-devicerather than splitting packages yet:agent-device/metroagent-device/remote-configagent-device/contractsCleanup in this PR keeps the public surface intentionally small and the ownership boundaries explicit:
agent-device/metroexposes explicit public types and a narrowedprepareRemoteMetro()result instead of the full internal Metro prepare payloadagent-device/remote-configonly exposes path resolution and resolved-profile loadingagent-device/contractsexposes an explicit daemon contract surface without leakingCliFlags/CommandFlagsCliFlagsnormalizeBaseUrl()now avoids regex-based trailing-slash trimming to satisfy CodeQL's ReDoS warningPublic API added by this PR:
agent-device/metroprepareRemoteMetro(options: PrepareRemoteMetroOptions): Promise<PrepareRemoteMetroResult>ensureMetroTunnel(options: EnsureMetroTunnelOptions): Promise<EnsureMetroTunnelResult>stopMetroTunnel(options: StopMetroTunnelOptions): Promise<void>buildIosRuntimeHints(baseUrl: string): MetroRuntimeHintsbuildAndroidRuntimeHints(baseUrl: string): MetroRuntimeHintsPrepareRemoteMetroOptions,PrepareRemoteMetroResult,EnsureMetroTunnelOptions,EnsureMetroTunnelResult,StopMetroTunnelOptions,MetroRuntimeHints,MetroBridgeResultagent-device/remote-configresolveRemoteConfigPath(options: RemoteConfigProfileOptions): stringresolveRemoteConfigProfile(options: RemoteConfigProfileOptions): ResolvedRemoteConfigProfileRemoteConfigProfile,RemoteConfigProfileOptions,ResolvedRemoteConfigProfileagent-device/contractsSessionRuntimeHints,DaemonInstallSource,DaemonLockPolicy,DaemonRequestMeta,DaemonRequest,DaemonArtifact,DaemonResponseData,DaemonError,DaemonResponseTouched files in final branch diff: 15.
Validation
pnpm formatpnpm check:toolingpnpm vitest run src/utils/__tests__/cli-option-schema.test.ts src/__tests__/remote-config-public.test.ts src/__tests__/cli-client-commands.test.ts src/__tests__/close-remote-metro.test.tspnpm vitest run src/__tests__/metro-public.test.ts src/__tests__/remote-config-public.test.ts src/__tests__/client-metro-companion.test.ts src/__tests__/client-metro-companion-worker.test.ts src/__tests__/client-metro-auto-companion.test.ts src/__tests__/close-remote-metro.test.ts src/__tests__/cli-client-commands.test.tspnpm vitest run src/utils/__tests__/url.test.tsnode --test test/integration/installed-package-metro.test.tsKnown gap:
pnpm check:unitstill has unrelated baseline failures in existing tests undersrc/core/__tests__/dispatch-back.test.ts,src/core/__tests__/dispatch-push.test.ts,src/core/__tests__/dispatch-trigger-app-event.test.ts, andsrc/platforms/android/__tests__/devices.test.ts