Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
97 lines (76 loc) · 3.96 KB
/
Copy pathjustfile
File metadata and controls
97 lines (76 loc) · 3.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
default:
@just --list
# auto-enable private integrations when symlinks are in place
# The `private` feature enables the private workflow integrations defined in `hub-private`.
# Without it, only the public integrations defined in `hub` are shown.
# The `media` feature compiles the home laptop's media investigation module, which only
# exists where `just setup-private home-laptop` linked it.
_features := if path_exists("ui/tui/src/investigations/media.rs") == "true" { "--features private,hub-tui/media" } else if path_exists("clients/src/private") == "true" { "--features private" } else { "" }
# hub-daemon has `private` but not `media`, and cargo refuses another package's feature when
# building one package with -p, so the daemon gets only the part of _features it has.
_daemon_features := if path_exists("clients/src/private") == "true" { "--features private" } else { "" }
# Every recipe that runs hub from source uses the `dev` profile, so development
# never writes the database the installed hub reads. Override per invocation
# with `HUB_PROFILE=default just tui`. The installed binaries get `default` by
# not having this set — a login shell does not export it and launchd never
# inherits one. See docs/decisions/024-hub-state-is-per-profile.md
export HUB_PROFILE := env_var_or_default("HUB_PROFILE", "dev")
check:
taplo fmt
taplo check
cargo fmt
cargo clippy --fix --allow-dirty --allow-staged {{_features}} -- -D warnings
@just lint
build:
cargo build {{_features}}
install:
# FIXME: cargo install --path ui/cli {{_features}}
cargo install --path ui/tui {{_features}}
cli:
cargo run -p hub-cli
tui:
cargo run -p hub-tui {{_features}}
# refresh the cache with nobody present, every 15 minutes. `just daemon --once` runs one
# pass and exits; `just daemon --interval 20s` changes the period
daemon *ARGS:
cargo run -p hub-daemon {{_daemon_features}} -- {{ARGS}}
# a proxy address nothing listens on, so every request sent through it is refused
_unreachable_proxy := "http://127.0.0.1:9"
# 1Password's domains, which go around that proxy so `op read` still resolves credentials
_credential_hosts := ".1password.com,.1password.ca,.1password.eu,.1passwordservices.com,.1passwordusercontent.com"
# e.g. `just sources-unreachable daemon --once` or `just sources-unreachable tui`
# run another recipe with every source hub asks unreachable and 1Password still reachable
sources-unreachable +ARGS:
HTTPS_PROXY={{_unreachable_proxy}} HTTP_PROXY={{_unreachable_proxy}} \
https_proxy={{_unreachable_proxy}} http_proxy={{_unreachable_proxy}} \
NO_PROXY={{_credential_hosts}} no_proxy={{_credential_hosts}} \
{{just_executable()}} --justfile {{justfile()}} {{ARGS}}
db:
@echo "opening ~/.hub/$HUB_PROFILE/hub.db"
uvx visidata ~/.hub/"$HUB_PROFILE"/hub.db
_require-nextest:
@cargo nextest --version > /dev/null 2>&1 || (echo "error: cargo-nextest not installed — run: cargo install cargo-nextest --locked" && exit 1)
test: _require-nextest
cargo nextest run {{_features}}
test-update: _require-nextest
INSTA_UPDATE=always cargo nextest run {{_features}}
_require-mutants:
@cargo mutants --version > /dev/null 2>&1 || (echo "error: cargo-mutants not installed — run: cargo install cargo-mutants --locked" && exit 1)
mutants: _require-mutants
cargo mutants {{_features}}
# clippy with warnings as errors, in every private-module configuration this checkout can build
lint:
@cargo run -q -p scripts -- lint-configurations
fmt:
cargo fmt
taplo fmt
clean:
cargo clean
# install the cargo tools the checks and hooks run, then the git hooks (run once per clone)
setup:
cargo install cargo-nextest cargo-audit cargo-deny --locked
prek install
# wire hub-private into this repo (run once per device after cloning hub-private)
# DEVICE must match a file in hub-private/devices/<device>.toml
setup-private DEVICE HUB_PRIVATE_PATH="../hub-private":
cargo run -q -p scripts -- setup-private {{DEVICE}} {{HUB_PRIVATE_PATH}}