chadtmiller.com/knotless

Git hosted in your atproto account, on any stock PDS, fast enough for agents.

git clone knotless://chadtmiller.com/knotless

needs the knotless git helper. set it up

main
128 lines · 5.0 KB Raw History
cargo := "rustup run stable cargo"
ignore := "(tests/|harness/|examples/|rustlib/)"

# Install the reference PDS harness, the web pages' packages and coverage tools.
setup:
    cd harness && npm install --no-audit --no-fund
    cd web && npm install --no-audit --no-fund
    rustup component add llvm-tools-preview --toolchain stable
    command -v cargo-llvm-cov >/dev/null || cargo install cargo-llvm-cov

test:
    {{cargo}} test --workspace

# Tests while working: only those `args` pick, as cargo test takes them,
# against the harness `just pds` left running if there is one. For a change
# to the web pages, `just t -p knotless-serve --test web`.
t *args:
    KNOTLESS_TEST_NET={{justfile_directory()}}/target/test-net.json {{cargo}} test {{args}}

# The source files changed since tests last passed with `t-changed`, and
# the tests that cover them.
changed:
    @node harness/changed.mjs

# Runs the tests `changed` names, and marks them passed.
t-changed:
    @node harness/changed.mjs --run

# A reference PDS left running for tests to share, so each test binary
# need not start its own. Stop it with ctrl-c.
pds:
    mkdir -p target
    tail -f /dev/null | node harness/pds.mjs --accounts seed > target/test-net.json

# The same, against the spaces alpha.
test-spaces:
    KNOTLESS_DEV_ENV={{spaces}} {{cargo}} test --workspace

# The spaces alpha build of the reference PDS, for private repositories.
spaces := env_var_or_default("KNOTLESS_DEV_ENV", "../atproto-space-ref/packages/dev-env")

# Fails under 100% of lines or functions, over runs against the stock
# reference PDS and the spaces alpha together.
cov:
    node harness/cov.mjs '{{spaces}}' '{{ignore}}'

# Coverage over the stock run alone, failing on nothing: quicker than
# `cov`, but what only the spaces alpha reaches shows as missing.
cov-fast:
    KNOTLESS_DEV_ENV= {{cargo}} llvm-cov --workspace --ignore-filename-regex '{{ignore}}' --show-missing-lines

cov-html:
    {{cargo}} llvm-cov --workspace --ignore-filename-regex '{{ignore}}' --html --open

lint:
    {{cargo}} fmt --all --check
    {{cargo}} clippy --workspace --all-targets -- -D warnings
    cd web && npm run check

# Latency of agent operations at a given round-trip time, in milliseconds.
bench rtt="50":
    {{cargo}} build --release
    {{cargo}} run --release --example bench -- --rtt {{rtt}}

# What a social card costs to draw, stage by stage, and the PNGs, written
# to target/cards to look at.
bench-cards:
    {{cargo}} run --release -p knotless-serve --example cards -- --out target/cards

serve *args:
    {{cargo}} run --release -p knotless-serve -- {{args}}

# Builds the image on a host and restarts it there (deploy/README.md).
deploy *args:
    deploy/deploy.sh {{args}}

# The web pages, built into web/build: a SvelteKit app that draws what
# knotless-serve answers under /_data. Its types come from `cargo test`.
web:
    cd web && npm run build

# The pages, from web/build, for `just serve --web http://127.0.0.1:2591`
# to hand them to, reading from that server.
pages: web
    HOST=127.0.0.1 PORT=2591 KNOTLESS_SERVE=http://127.0.0.1:2590 HOST_HEADER=x-forwarded-host PROTOCOL_HEADER=x-forwarded-proto node web/build

# The pages, redrawn as their source changes, reading from a
# `just serve` on its default port.
web-dev:
    cd web && npm run dev

# Screenshots of the pages whose HTML changed since their baselines were
# taken, taken again as the baselines in harness/shots/baseline. The pages
# are drawn from what harness/shots/fixtures.json recorded, so no PDS is
# needed. Arguments go to Playwright: a page name to take only it, or
# --project=desktop-light.
shots *args: web
    cd harness && npx playwright test -c shots/playwright.config.mjs --update-snapshots=all {{args}}

# Every screenshot, failing on any pixel that differs from the baselines.
shots-check *args: web
    cd harness && SHOTS_ALL=1 npx playwright test -c shots/playwright.config.mjs {{args}}

# Every screenshot of the whole stack, the pages behind knotless-serve over
# a seeded PDS, failing on any pixel that differs from the baselines.
shots-live *args: web
    {{cargo}} build --bins
    cd harness && SHOTS_LIVE=1 SHOTS_ALL=1 npx playwright test -c shots/playwright.config.mjs {{args}}

# Records again what knotless-serve answers for each page, from the world
# `shots-up` keeps up or a new one, into harness/shots/fixtures.json: after
# a change to what the server answers, or to the world.
shots-record: web
    {{cargo}} build --bins
    node harness/shots/fixtures.mjs

# The screenshots' PDS, seeded once and left running, so `shots` need only
# start the server. Stop it with ctrl-c.
shots-up:
    {{cargo}} build --bins
    tail -f /dev/null | node harness/shots/world.mjs

# Agents doing a day's git work through the MCP server, one fresh session
# per step: `harness/scenarios/tracks`, or only the tracks named. Reports
# what tripped them up under target/scenarios/. Each run costs model usage.
scenarios *tracks:
    {{cargo}} build -q --workspace --bins
    node harness/scenarios.mjs {{tracks}}