~/bend-docscommunity

cli/v.bend relies on unsafe/foreign

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

7 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 bend-net-json@0.3.0.0/json.bend as Json

Types

type Listen source · line 48 · raw

Data

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

type Stack source · line 175 · raw

Data

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

Definitions

def tailscale source · line 12 · raw

String

def pid_if source · line 16 · raw

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

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

def pid_in source · line 23 · raw

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

def pids source · line 30 · raw

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

def port_if source · line 40 · raw

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

def field source · line 51 · raw

@+l:String -> String

def emit_if source · line 54 · raw

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

def emit source · line 61 · raw

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

def listens source · line 64 · raw

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

def port_of_addr source · line 71 · raw

@+addr:String -> String

def host_of source · line 74 · raw

@+addr:String -> String

def loopback source · line 77 · raw

@+addr:String -> Bool

def foreign_ports source · line 81 · 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 91 · raw

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

Ports that V's own processes listen on.

def exposed source · line 101 · 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 112 · 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 115 · raw

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

def at source · line 122 · raw

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

def str_of source · line 125 · raw

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

def obj_keys source · line 132 · raw

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

def web_of source · line 140 · raw

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

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

def proxy source · line 143 · raw

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

def web_serves source · line 147 · 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 155 · 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 164 · raw

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

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

def agent_labels source · line 167 · raw

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

def prefix source · line 178 · raw

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

def package_deps source · line 185 · raw

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

def choose_package source · line 188 · raw

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

def package_or_root source · line 195 · raw

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

def module_name source · line 198 · raw

@line:String -> String

def go_deps source · line 205 · raw

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

def source_ext source · line 212 · raw

@path:String -> String

def source_extensions source · line 219 · raw

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

def stack_source source · line 226 · raw

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

def join_stack source · line 237 · raw

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

def stack_sources source · line 244 · raw

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

def repository_stack source · line 254 · raw

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

def stack_text source · line 260 · raw

@stack:Stack -> String

def machine_text source · line 267 · 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 277 · raw

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

def fail_or source · line 295 · raw

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

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

def prove source · line 303 · raw

IO(Unit)

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

def check_with source · line 309 · raw

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

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

def check source · line 315 · raw

IO(Unit)

def snapshot_only source · line 320 · raw

IO(Unit)

def diagram source · line 326 · raw

@+out:String -> IO(Unit)

def serve_apply source · line 335 · 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 345 · raw

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

def serve_step source · line 352 · raw

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

def serve_steps source · line 355 · raw

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

def applied_text source · line 364 · raw

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

def current_parts source · line 367 · raw

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

def push_script source · line 373 · 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 382 · raw

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

def github_push source · line 389 · raw

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

def publish_script source · line 396 · 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 405 · raw

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

def publish_current source · line 412 · raw

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

def publish_result source · line 419 · raw

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

def publish source · line 422 · raw

@+p:String -> IO(Unit)

def publish_all source · line 427 · raw

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

def nix_darwin source · line 437 · raw

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

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

def tailscale_serve source · line 448 · raw

IO(Unit)

def record source · line 455 · 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 465 · raw

IO(Unit)