~/bend-docscommunity

cli/v.bend relies on unsafe/foreign

raw source on the hub · import 0xc13c365900e26112e0e544022d18fe0b/cli/v.bend as V

8 imports
import Base
import ../lib/effs/io.bend as X
import ../lib/vstr.bend as S
import ../lib/mac_types.bend as T
import ./project.bend as P
import ./vazure.bend as Azure
import ./vsources.bend as Src
import bend-net-json@0.3.0.0/json.bend as Json

Types

type Listen source · line 49 · raw

Data

---- listening sockets, from lsof -F pcn (one field per line: p<pid>, c<command>, n<address:port>) ----

type Stack source · line 176 · raw

Data

Repository evidence is captured beside the machine facts. A source line is "key folder".

Definitions

def tailscale source · line 13 · raw

String

def pid_if source · line 17 · raw

@hit:Bool -> @l:String -> String

---- snapshot: the Mac as it is, into bend/machine.bend ----

def pid_in source · line 24 · raw

@ls:List<&2, String> -> String

def pids source · line 31 · raw

@labels:List<&2, String> -> @+uid:String -> IO(List<&2, String>)

def port_if source · line 41 · raw

@keep:Bool -> @p:String -> List<&2, String>

def field source · line 52 · raw

@+l:String -> String

def emit_if source · line 55 · raw

@name:Bool -> @+l:String -> @+pid:String -> @+cmd:String -> List<&2, Listen>

def emit source · line 62 · raw

@+l:String -> @+pid:String -> @+cmd:String -> List<&2, Listen>

def listens source · line 65 · raw

@ls:List<&2, String> -> @+pid:String -> @+cmd:String -> List<&2, Listen>

def port_of_addr source · line 72 · raw

@+addr:String -> String

def host_of source · line 75 · raw

@+addr:String -> String

def loopback source · line 78 · raw

@+addr:String -> Bool

def foreign_ports source · line 82 · raw

@xs:List<&2, Listen> -> @+owned:List<&2, String> -> List<&2, String>

Ports held by anything but Tailscale's own listener and V's processes (declared or V-installed).

def owned_ports source · line 92 · raw

@xs:List<&2, Listen> -> @+owned:List<&2, String> -> List<&2, String>

Ports that V's own processes listen on.

def exposed source · line 102 · raw

@xs:List<&2, Listen> -> List<&2, String>

"process port" for listeners beyond 127.0.0.1 / [::1]: reachable from other machines.

def url_port source · line 113 · raw

@w:String -> String

Tailscale Serve status as JSON (bend-net-json): {"Web": {"<host>:<port>": {"Handlers": {"/": {"Proxy": "http://127.0.0.1:<local>[/path]"}}}}}

def json_or_null source · line 116 · raw

@m:Maybe<&2, 0x16458a2db4f36577294543ec2a6d420c/json.Val> -> 0x16458a2db4f36577294543ec2a6d420c/json.Val

def at source · line 123 · raw

@v:0x16458a2db4f36577294543ec2a6d420c/json.Val -> @k:String -> 0x16458a2db4f36577294543ec2a6d420c/json.Val

def str_of source · line 126 · raw

@v:0x16458a2db4f36577294543ec2a6d420c/json.Val -> String

def obj_keys source · line 133 · raw

@v:0x16458a2db4f36577294543ec2a6d420c/json.Val -> List<&2, String>

def web_of source · line 141 · raw

@s:String -> 0x16458a2db4f36577294543ec2a6d420c/json.Val

The Serve "Web" object of tailscale serve status --json.

def proxy source · line 144 · raw

@+web:0x16458a2db4f36577294543ec2a6d420c/json.Val -> @k:String -> String

def web_serves source · line 148 · raw

@+web:0x16458a2db4f36577294543ec2a6d420c/json.Val -> @ks:List<&2, String> -> @+declared:List<&2, String> -> List<&2, String>

Served ports whose proxy target is not one of declared local ports.

def serving source · line 156 · raw

@+web:0x16458a2db4f36577294543ec2a6d420c/json.Val -> @ks:List<&2, String> -> @+port:String -> @+target:String -> Bool

Whether port is already served by exactly target.

def agent_if source · line 165 · raw

@+label:String -> List<&2, String>

launchctl list: third column is the label; macOS's own are left out.

def agent_labels source · line 168 · raw

@ls:List<&2, String> -> List<&2, String>

def prefix source · line 179 · raw

@+key:String -> @xs:List<&2, String> -> List<&2, String>

def package_deps source · line 186 · raw

@+v:0x16458a2db4f36577294543ec2a6d420c/json.Val -> List<&2, String>

def choose_package source · line 189 · raw

@empty:Bool -> @local:String -> @root:0x16458a2db4f36577294543ec2a6d420c/json.Val -> 0x16458a2db4f36577294543ec2a6d420c/json.Val

def package_or_root source · line 196 · raw

@+local:String -> @root:0x16458a2db4f36577294543ec2a6d420c/json.Val -> 0x16458a2db4f36577294543ec2a6d420c/json.Val

def module_name source · line 199 · raw

@line:String -> String

def go_deps source · line 206 · raw

@ls:List<&2, String> -> List<&2, String>

def source_ext source · line 213 · raw

@path:String -> String

def source_extensions source · line 220 · raw

@paths:List<&2, String> -> List<&2, String>

def stack_source source · line 227 · raw

@+line:String -> @root_json:0x16458a2db4f36577294543ec2a6d420c/json.Val -> @+go:List<&2, String> -> IO(Stack)

def join_stack source · line 238 · raw

@a:Stack -> @b:Stack -> Stack

def stack_sources source · line 245 · raw

@lines:List<&2, String> -> @+root_json:0x16458a2db4f36577294543ec2a6d420c/json.Val -> @+go:List<&2, String> -> IO(Stack)

def repository_stack source · line 255 · raw

@sources:List<&2, String> -> IO(Stack)

def stack_text source · line 261 · raw

@stack:Stack -> String

def machine_text source · line 268 · raw

@ports:List<&2, String> -> @serves:List<&2, String> -> @agents:List<&2, String> -> @installed:List<&2, String> -> @exposed:List<&2, String> -> @stack:Stack -> String

def snapshot source · line 278 · raw

@+f:0xc13c365900e26112e0e544022d18fe0b/cli/project.Facts -> IO(Unit)

def fail_or source · line 296 · raw

@ok:Bool -> @out:String -> @then:IO(Unit) -> IO(Unit)

---- check, plan, diagram ----

def prove source · line 304 · raw

IO(Unit)

Prove the laws against the current snapshot. Anything unproven stops V.

def check_with source · line 310 · raw

@+f:0xc13c365900e26112e0e544022d18fe0b/cli/project.Facts -> IO(Unit)

The machine is snapshotted only for a project that configures it (a nix-darwin target).

def check source · line 317 · raw

IO(Unit)

def snapshot_only source · line 322 · raw

IO(Unit)

def diagram source · line 329 · raw

@+out:String -> IO(Unit)

def serve_apply source · line 338 · raw

@current:Bool -> @+port:String -> @+local:String -> IO(Unit)

---- deploy ---- One "serve <port> <local>" plan line: make sure Tailscale serves it.

def serve_do source · line 348 · raw

@is_serve:Bool -> @current:Bool -> @+port:String -> @+local:String -> IO(Unit)

def serve_step source · line 355 · raw

@+w:List<&2, String> -> @+web:0x16458a2db4f36577294543ec2a6d420c/json.Val -> IO(Unit)

def serve_steps source · line 358 · raw

@ls:List<&2, String> -> @+web:0x16458a2db4f36577294543ec2a6d420c/json.Val -> IO(Unit)

def applied_text source · line 367 · raw

@vlib:String -> @url:String -> @stores:String -> String

def current_parts source · line 370 · raw

@vlib:String -> @+c:String -> String

def push_script source · line 376 · raw

@+r:String -> @+vis:String -> String

---- pushing the project's repository to GitHub ---- The probe answers "current" (GitHub already has HEAD), "pushed <commit>", or "failed <reason>". It refuses a repository whose real visibility differs from the declared one.

def push_current source · line 385 · raw

@current:Bool -> @+r:String -> @+repo:String -> IO(Unit)

def github_push source · line 392 · raw

@+repo:String -> @+vis:String -> IO(Unit)

def publish_script source · line 399 · raw

@+n:String -> @+v:String -> @+e:String -> String

---- publishing a package to the Bend hub ---- The probe answers "current" (published, same files), "changed <file>", "published", or "failed <reason>".

def publish_other source · line 408 · raw

@published:Bool -> @+r:String -> @+id:String -> IO(Unit)

def publish_current source · line 415 · raw

@current:Bool -> @+r:String -> @+id:String -> IO(Unit)

def publish_result source · line 422 · raw

@+r:String -> @+id:String -> IO(Unit)

def publish source · line 425 · raw

@+p:String -> IO(Unit)

def publish_all source · line 430 · raw

@ps:List<&2, String> -> IO(Unit)

def nix_darwin source · line 440 · raw

@+f:0xc13c365900e26112e0e544022d18fe0b/cli/project.Facts -> IO(Unit)

---- deploy: prove, then run each target the project declares ----

def tailscale_serve source · line 451 · raw

IO(Unit)

def record source · line 458 · raw

@has:Bool -> @+vlib:String -> IO(Unit)

A project with a deployment (current.bend) records what is now running, for the breaks law.

def deploy source · line 468 · raw

IO(Unit)