UNPKG

@mesh-tech/mesh-cli

Version:

CLI for Mesh platform development utilities

99 lines (98 loc) 3.48 kB
import { Command } from 'commander'; import { type ResolvedAwsCreds } from '../utils/aws-auth.js'; import { type ComposeExternalRef } from './local/mocks.js'; interface DevEnvVar { value: string; tunnel?: string; } interface DevService { src: string; port: number; command: string[]; env?: Record<string, DevEnvVar>; kind?: 'dagster'; } interface DevTunnel { host: string; port: number; } interface DevSecret { secretName: string; envMapping: Record<string, string>; } export interface DevOutput { platform?: { tenant: string; name?: string; env: string; }; app?: string; stack?: string; services: Record<string, DevService>; tunnels: Record<string, DevTunnel>; secrets?: Record<string, DevSecret>; } export declare function registerServiceProbes(devOutput: DevOutput, tenant: string, probeFiles: string[]): void; export interface SessionState { appRoot: string; stack: string; devOutput: DevOutput; startedAt: string; runner?: 'tmux' | 'docker'; composeExternals?: ComposeExternalRef[]; externalProbeFiles?: string[]; workflowFingerprint?: string; } export declare function workflowChanged(prior: string | undefined, current: string): boolean; export declare function isPortFree(port: number): Promise<boolean>; export declare function rewriteOwnServicePort(service: DevService, oldPort: number, newPort: number): void; export declare function mergePinnedPorts(fresh: DevOutput, pinned: DevOutput): DevOutput; export declare function buildChildAwsEnv(awsEnv: Record<string, string>, method: ResolvedAwsCreds['method'] | 'ambient', profile: string | undefined, opts?: { context: string; roleArn: string; sessionScratchDir: string; meshBin: string; }): Record<string, string>; export declare function isLinkedDependencyDir(serviceDir: string, appRoot: string): boolean; export declare function monorepoRelativeSrc(src: string): string | null; export declare function tunnelClientAddress(tunnel: { host: string; port: number; }): string; export interface TunnelHealth { name: string; address: string; reachable: boolean; } export declare function formatTunnelHealth(health: TunnelHealth[]): string[]; export declare function firstUnroutableTunnel(tunnels: Record<string, { host: string; port: number; }>): Promise<string | null>; export type Transport = "ssm" | "tailscale" | "vpn-direct"; export interface TunnelPlan { transport: Transport; tailscale?: { tenant: string; env: string; region: string; loginServer: string; socksPort: number; preAuthKey?: string; }; explicit?: boolean; } export declare function resolveTransport(flag: string | undefined, ctx: { vpnConnected: boolean; hasSsmPlugin: boolean; tailscaleAvailable: boolean; }): Transport; export type ReachabilityDecision = { transport: Transport; reason: "not-vpn-direct" | "reachable" | "fallback-ssm" | "unreachable-no-plugin"; }; export declare function reachabilityFallbackTransport(transport: Transport, temporalReachable: boolean, hasSsmPlugin: boolean): ReachabilityDecision; export declare function preferredSsmLocalPort(remotePort: number): number; export declare function reserveSsmLocalPortCandidate(remotePort: number, reservedPorts: Set<number>, startAt?: number): number; export declare function registerDevCommand(program: Command): void; export {};