Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI

on:
pull_request:
push:
branches: [main]

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 22
- name: Install qrencode
run: sudo apt-get update -q && sudo apt-get install -yq qrencode
- name: shellcheck
run: shellcheck -S warning bin/varlatch-menu tests/run.sh tests/fake-varlatch
- name: Tests
run: tests/run.sh
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Changelog

## 0.4.0 (2026-10-07)

- **First run.** Without the `varlatch` CLI, the panel and the menu offer
to install it: a terminal asks for your server's address to install the
CLI version it runs, checks the download like an update, installs it as
`~/.local/bin/varlatch`, and offers the first sign-in. With no server known
yet, the panel asks for its address; **add server** signs in to another.
- **Sign in from another device** (CLI 0.14.0 or newer), for when the
browser here has no passkey: the panel shows an address, a code, and a QR
code of the address. Start it with **other device** on a waiting sign-in,
**Log in from another device** in the menu, or the buttons on a failed
sign-in's and the expiry notifications.
- **Session length:** the `sessionHours` setting (1 to 24; 0 keeps the
server's default of 12 hours) applies to every sign-in the widget starts.
- **Fresher release check:** opening the panel checks again when the last
check is over an hour old, and a cache older than the installed CLI is
checked again; never more than once an hour.
- **Fix:** a sign-in whose process died before it could clean up (killed,
or from before a reboot) no longer stays on the panel with a cancel that
did nothing.
- The renew rows in the menu have a glyph.
- Offline tests (`tests/run.sh`) and CI: shellcheck, the manifest, and the
helper's menu, sign-in, device sign-in, release check, and install paths.

## 0.3.0 (2026-10-07)

- Install with `omarchy plugin add`; the widget adds its own submenu to the
Omarchy menu and keeps it in step with your sessions.
- The repository is public; release checks and downloads are anonymous.

## 0.2.0 (2026-09-28)

- The panel shows the CLI version and, with `checkUpdates` on, newer
releases, with release notes and a checked update of the release CLI.
- The CLI version is read again when the panel opens.

## 0.1.0 (2026-09-25)

- First release: sessions, expiry, and sign-in, renewal, and sign-out in the
Omarchy bar, read offline from `varlatch status --json`.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,18 @@ Requires `jq`, `python3`, and the Varlatch CLI 0.8.0 or newer, which the
panel can install (see [First run](#first-run)). With a CLI before 0.10.0,
the widget works out the *expiring* state itself.

## Development

`tests/run.sh` tests the manifest and `bin/varlatch-menu` offline, each test
in a throwaway `HOME` with stand-ins for the CLI (`tests/fake-varlatch`),
`curl`, `notify-send`, and the omarchy commands. It needs `jq`, `python3`,
and Node.js 22 or newer, and checks the QR code when `qrencode` is
installed. CI runs it with `shellcheck` on every pull request. The QML is
checked by hand on a live bar: `omarchy restart shell` after editing it,
and `omarchy-shell varlatch debugState` for the widget's state.

See [`CHANGELOG.md`](CHANGELOG.md) for what changed in each release.

## License

Copyright © 2026 Robotsson. Licensed under the Apache License 2.0; see
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"schemaVersion": 1,
"id": "varlatch",
"name": "Varlatch",
"version": "0.3.0",
"version": "0.4.0",
"author": "Varlatch",
"license": "Apache-2.0",
"description": "Varlatch sessions in the Omarchy bar: which servers you hold credentials for, when they expire, and quick sign-in and sign-out, all read offline from `varlatch status --json`.",
Expand Down
56 changes: 56 additions & 0 deletions tests/fake-varlatch
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env bash
# A stand-in for the varlatch CLI, for tests/run.sh. Every call is recorded
# in $HOME/calls.log. `status` prints $HOME/status.json (no sessions when it
# is missing), and the FAKE_* variables choose how sign-ins end.
echo "cli $*" >> "$HOME/calls.log"
case "${1:-}" in
--version) echo "varlatch ${FAKE_VERSION:-0.15.0} (migration 26)"; exit 0 ;;
--help) echo "Usage: varlatch <command>"; exit 0 ;;
status) cat "$HOME/status.json" 2>/dev/null || echo '{"version":1,"servers":[],"repo":null}'; exit 0 ;;
logout) echo "Logged out."; exit 0 ;;
login) ;;
*) exit 64 ;;
esac

mode="browser"
for arg in "$@"; do
case "$arg" in --start) mode="start" ;; --wait) mode="wait" ;; esac
done

case "$mode" in
start)
if [ -n "${FAKE_START_FAIL:-}" ]; then
echo "varlatch login: the server refused to start a sign-in (NOT_FOUND)" >&2
exit 1
fi
echo '{"verificationUri":"https://vl.example.com/device","userCode":"BCDF-GHJK","expiresAt":"2099-01-01T00:10:00.000Z"}'
;;
wait)
# FAKE_WAIT: approve | pending-once | deny | expire | hang
n=$(cat "$HOME/wait-count" 2>/dev/null || echo 0)
n=$((n + 1)); echo "$n" > "$HOME/wait-count"
case "${FAKE_WAIT:-approve}" in
approve) ;;
pending-once)
if [ "$n" -eq 1 ]; then
sleep 1
echo '{"state":"pending"}'
echo "varlatch login: not approved yet." >&2
exit 75
fi ;;
deny) echo '{"state":"denied"}'; echo "varlatch login: the sign-in was denied." >&2; exit 77 ;;
expire) echo '{"state":"expired"}'; echo "varlatch login: the sign-in expired." >&2; exit 77 ;;
hang) sleep 60; exit 75 ;;
esac
echo '{"state":"signed-in","credentialId":"crd_test","expiresAt":"2099-01-01T12:00:00Z"}'
;;
browser)
echo "Open this address to sign in: https://vl.example.com/enroll?state=test"
sleep "${FAKE_LOGIN_SLEEP:-0}"
if [ "${FAKE_LOGIN_RC:-0}" -ne 0 ]; then
echo "varlatch login: browser sign-in failed: no passkey" >&2
exit "$FAKE_LOGIN_RC"
fi
echo "Issued CLI credential (expires 2099-01-01T12:00:00Z)."
;;
esac
Loading
Loading