aboutsummaryrefslogtreecommitdiff
path: root/justfile
blob: df3d9d5786eaa7e26571bb240cb8711eb691836f (plain)
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
# fluxrec task automation

build:
    go build -o fluxrec .

test:
    go test ./...

fmt:
    go fmt ./...

vet:
    go vet ./...

clean:
    rm -f fluxrec

# Quick smoke: train-free, needs a model.json (from `fluxrec train`, future)
score TITLE MODEL="model.json":
    echo "{{TITLE}}" | go run . score --model {{MODEL}}

# ── auth (same pattern as the mflux justfile) ──

# Print the two export lines to paste in your shell (just can't set them for you)
auth:
    @echo 'export MFLUX_URL="https://your-miniflux-host"    # base URL, no trailing slash'
    @echo 'read -s MFLUX_TOKEN && export MFLUX_TOKEN        # Settings -> API Keys; input hidden'

# Guard for recipes that hit the live API (token never echoed)
check-auth:
    @test -n "${MINIFLUX_URL:-${MFLUX_URL:-}}" -a -n "${MINIFLUX_TOKEN:-${MFLUX_TOKEN:-}}" || { echo "not authed; run: just auth"; exit 1; }
    @echo "auth ok (URL=${MINIFLUX_URL:-${MFLUX_URL:-}})"

# Capture dev fixtures from the live API; run once, then offline dev
dump-fixtures DIR="testdata": check-auth
    go run . export --dump-raw {{DIR}}

# Retroactive-starring aid: model-ranked read+unstarred candidates to star by hand
retrostar LIMIT="50":
    go run . retrostar --limit {{LIMIT}}

# Pruning audit: per-feed volume + star stats
feeds DAYS="180" MIN_PER_DAY="0.05" MIN_SEEN="0": check-auth
    go run . feeds --days 180 --min-per-day 0.05 --min-seen 0

# ── retrain loop ──
# Eyeball report.json (precision@15 >= 0.10) before `just ship SERVER` —
# retrain never deploys.

# Export new labels, train, print the report path
retrain: check-auth
    go run . export
    go run . train labels.jsonl
    @echo "report: report.json — check precision@15 >= 0.10 before shipping"

# ── deploy lane (local PC → server) ──
# SERVER is an ssh config alias; the agent does auth. No hostnames in this
# file. Run `ship` only after eyeballing report.json — retrain never deploys.
# The server state dir is bind-mounted at /data (created once on the VPS;
# see README "Deployment"); fluxrec runs under the compose stack at
# ~/services on the server.

# Ship a freshly trained model.json to the server state dir
deploy SERVER:
    scp model.json {{SERVER}}:~/fluxrec-data/

# Bounce the serve container so it picks up the new model
restart SERVER:
    ssh {{SERVER}} 'cd ~/services && docker-compose restart fluxrec'

# deploy + restart in one verb
ship SERVER: (deploy SERVER) (restart SERVER)
    @echo "model shipped; serve restarted — watch /api/status next run"

# Full model refresh: retrain + ship in one verb (no report gate — eyeball
# report.json first if unsure, or use `retrain` + `ship` separately)
refresh SERVER: retrain (ship SERVER)
    @echo "refreshed: retrained locally + model shipped to {{SERVER}}"

# Trigger an out-of-schedule poll (serialized + cooldown-gated server-side)
poll-now URL:
    curl -sS -X POST {{URL}}/api/poll