appctl.rs

crates/veilvoice-cli/src/appctl.rs

veilvoice-cli · 296 lines · read the source here · or on GitHub

veilvoice appctl learns what normally runs, so it can notice what does not.

Every subcommand prints the scope note. Not once at setup, not behind a flag: every time, because the one thing a reader must not come away believing is that this stopped something. It did not and it cannot, and a warning shown once is a warning forgotten by the second week.

In plain words

Run learn for a while and VeilVoice writes down which programs you normally use. Run check afterwards and it tells you about anything running that was not on that list.

It does not block anything. It is a way of noticing.

WHAT THIS FILE CONTAINS

296 lines defining 10 functions (6 public), 0 types and 0 constants. Everything below is read out of the source, so it cannot disagree with the code.

What happens when it runs. These are the ways in: public, and nothing else in this file calls them, so they are what an outside caller reaches first.

  • learn line 91 · Record what is running as ordinary.
    reaches baseline_path, load, running, save, scope
  • check line 144 · Compare what is running against the baseline.
    reaches baseline_path, load, running, save, scope
  • allow line 219 · Allow a program, for a while or for good.
    reaches baseline_path, load, save, scope
  • revoke line 252 · Withdraw a grant.
    reaches baseline_path, load, save, scope
  • log line 264 · Show the decision log.
    reaches baseline_path, load, scope

WHAT CALLS WHAT

baseline_path line 23 load line 44 save line 54 scope line 77 running line 86 learn line 91 check line 144 allow line 219 revoke line 252 log line 264 entry: a way in: public, and nothing in this file calls it api: public, and also used inside this file helper: private to this file dashed: a call that goes back up, or across a wrapped rank The functions this file defines, and the calls between them. An edge means the callee's name appears, called, inside the caller's body. This is a syntactic reading, not a type-resolved one.

The functions this file defines, and the calls between them. An edge means the callee's name appears, called, inside the caller's body. This is a syntactic reading, not a type-resolved one.

The same graph as Mermaid source
%%{init: {"theme":"base","themeVariables":{"background":"#1a1b26","primaryColor":"#1f2335","primaryTextColor":"#c0caf5","primaryBorderColor":"#7aa2f7","secondaryColor":"#16161e","tertiaryColor":"#16161e","lineColor":"#737aa2","textColor":"#c0caf5","mainBkg":"#1f2335","nodeBorder":"#7aa2f7","clusterBkg":"#16161e","clusterBorder":"#2f3549","fontFamily":"ui-monospace, SFMono-Regular, Consolas, monospace","fontSize":"14px"}}}%%
flowchart TD
    n_baseline_path["baseline_path<br/>line 23"]
    n_load["load<br/>line 44"]
    n_save["save<br/>line 54"]
    n_scope["scope<br/>line 77"]
    n_running["running<br/>line 86"]
    n_learn(["learn<br/>line 91"])
    n_check(["check<br/>line 144"])
    n_allow(["allow<br/>line 219"])
    n_revoke(["revoke<br/>line 252"])
    n_log(["log<br/>line 264"])
    n_allow --> n_baseline_path
    n_allow --> n_load
    n_allow --> n_save
    n_allow --> n_scope
    n_check --> n_baseline_path
    n_check --> n_load
    n_check --> n_running
    n_check --> n_save
    n_check --> n_scope
    n_learn --> n_baseline_path
    n_learn --> n_load
    n_learn --> n_running
    n_learn --> n_save
    n_learn --> n_scope
    n_log --> n_baseline_path
    n_log --> n_load
    n_log --> n_scope
    n_revoke --> n_baseline_path
    n_revoke --> n_load
    n_revoke --> n_save
    n_revoke --> n_scope
    click n_baseline_path href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/appctl.rs#L23" "open the source"
    click n_load href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/appctl.rs#L44" "open the source"
    click n_save href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/appctl.rs#L54" "open the source"
    click n_scope href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/appctl.rs#L77" "open the source"
    click n_running href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/appctl.rs#L86" "open the source"
    click n_learn href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/appctl.rs#L91" "open the source"
    click n_check href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/appctl.rs#L144" "open the source"
    click n_allow href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/appctl.rs#L219" "open the source"
    click n_revoke href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/appctl.rs#L252" "open the source"
    click n_log href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/appctl.rs#L264" "open the source"
    classDef entry fill:#1f2335,stroke:#7aa2f7,color:#c0caf5
    class n_learn,n_check,n_allow,n_revoke,n_log entry
    classDef api fill:#1f2335,stroke:#7dcfff,color:#c0caf5
    class n_baseline_path api
    classDef helper fill:#1f2335,stroke:#bb9af7,color:#c0caf5
    class n_load,n_save,n_scope,n_running helper
    subgraph chart_key ["Key"]
        direction LR
        key_entry["entry: a way in: public, and nothing in this file calls it"]
        key_api["api: public, and also used inside this file"]
        key_helper["helper: private to this file"]
    end
    class key_entry entry
    class key_api api
    class key_helper helper

This site loads no third-party script, so it cannot run Mermaid; the diagram above is the same nodes and edges drawn by the generator instead. GitHub renders the source below directly.

ITEMS

ItemLineDocumentation
baseline_path pub fn23Where the baseline is kept.
load fn44The baseline at path, or an empty one if there is no file yet.
save fn54Write baseline to path, creating the directory if it is not there, and readable by this account alone.
scope fn77The note that goes with every answer.
running fn86What is running now, through the shared listing.
learn pub fn91Record what is running as ordinary.
check pub fn144Compare what is running against the baseline.
allow pub fn219Allow a program, for a while or for good.
revoke pub fn252Withdraw a grant.
log pub fn264Show the decision log.