From 489386ab775bc06927fa85a1bbcc6075f54982d5 Mon Sep 17 00:00:00 2001 From: mdheller <21163552+mdheller@users.noreply.github.com> Date: Thu, 23 Apr 2026 20:54:52 -0400 Subject: [PATCH 1/3] workstation-v0: add Lampstand user-service subcommands --- .../workstation-v0/bin/sourceos-search.sh | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/profiles/linux-dev/workstation-v0/bin/sourceos-search.sh b/profiles/linux-dev/workstation-v0/bin/sourceos-search.sh index a5e67f9..dfb1239 100644 --- a/profiles/linux-dev/workstation-v0/bin/sourceos-search.sh +++ b/profiles/linux-dev/workstation-v0/bin/sourceos-search.sh @@ -8,6 +8,7 @@ warn(){ printf "WARN: %s\n" "$*" >&2; } have(){ command -v "$1" >/dev/null 2>&1; } cache_dir(){ echo "${XDG_CACHE_HOME:-$HOME/.cache}/sourceos"; } +service_name(){ echo "sourceos-lampstand.service"; } open_file(){ local p=$1 @@ -26,6 +27,31 @@ run_lampstand(){ return 127 } +run_user_service(){ + local action=$1 + local svc + svc="$(service_name)" + + case "$action" in + status) + systemctl --user status "$svc" --no-pager + ;; + start|stop|restart) + systemctl --user "$action" "$svc" + ;; + enable) + systemctl --user enable "$svc" + ;; + logs) + journalctl --user -u "$svc" --no-pager -n 200 + ;; + *) + err "unknown service action: $action (use status|start|stop|restart|enable|logs)" + return 2 + ;; + esac +} + usage(){ cat <<'EOF' Usage: @@ -33,6 +59,7 @@ Usage: sourceos-search.sh health [--open|--write ] sourceos-search.sh stats [--open|--write ] sourceos-search.sh index [--root ]... + sourceos-search.sh service status|start|stop|restart|enable|logs [--open|--write ] EOF } @@ -59,12 +86,20 @@ SEARCH_WRITE_PATH="" QUERY_PARTS=() LAMPSTAND_ROOTS=() MODE="query" +SERVICE_ACTION="" case "${1:-}" in health|stats|index) MODE="$1" shift ;; + service) + MODE="service" + shift + SERVICE_ACTION="${1:-}" + [[ -n "$SERVICE_ACTION" ]] || { err "service requires an action"; usage; exit 2; } + shift || true + ;; esac while [[ $# -gt 0 ]]; do @@ -100,6 +135,14 @@ case "$MODE" in run_lampstand "${args[@]}" exit $? ;; + service) + set +e + out="$(run_user_service "$SERVICE_ACTION" 2>&1)" + rc=$? + set -e + write_or_print "$out" "lampstand-service-$SERVICE_ACTION.txt" + exit "$rc" + ;; esac if [[ ${#QUERY_PARTS[@]} -eq 0 && "$SEARCH_PROMPT" == "1" ]]; then From aefe4db2d845e7d13a7505902d3bd7be223b981e Mon Sep 17 00:00:00 2001 From: mdheller <21163552+mdheller@users.noreply.github.com> Date: Thu, 23 Apr 2026 21:03:20 -0400 Subject: [PATCH 2/3] workstation-v0: expose Lampstand user-service actions in palette --- profiles/linux-dev/workstation-v0/bin/sourceos | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/profiles/linux-dev/workstation-v0/bin/sourceos b/profiles/linux-dev/workstation-v0/bin/sourceos index ee8586d..d7625a3 100644 --- a/profiles/linux-dev/workstation-v0/bin/sourceos +++ b/profiles/linux-dev/workstation-v0/bin/sourceos @@ -49,7 +49,7 @@ Usage: sourceos fix fish [apply|dry-run|revert] [--json] [--open|--write ] sourceos doctor [--json|--open|--write ] sourceos status [--json|--open|--write ] - sourceos search [health|stats|index] [options] + sourceos search [health|stats|index|service] [options] sourceos search [--limit N] [--snippet] [--prompt] [--open|--write ] [query...] sourceos profile apply sourceos profile path @@ -477,6 +477,9 @@ Search files (Lampstand) sourceos search --prompt --snippet --open Lampstand health (open report) sourceos search health --open Lampstand stats (open report) sourceos search stats --open Lampstand index home sourceos search index --root "$HOME" +Lampstand service status sourceos search service status --open +Lampstand service restart sourceos search service restart +Lampstand service logs sourceos search service logs --open Apply profile sourceos profile apply Open sesh sesh Open tmux tmux From 01227a783f1bbbfbd5195db16bcb70f3946b5457 Mon Sep 17 00:00:00 2001 From: mdheller <21163552+mdheller@users.noreply.github.com> Date: Thu, 23 Apr 2026 21:05:18 -0400 Subject: [PATCH 3/3] ci(workstation): add Lampstand user-service smoke tests --- .github/workflows/workstation-lampstand.yml | 38 +++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/.github/workflows/workstation-lampstand.yml b/.github/workflows/workstation-lampstand.yml index b0aebee..fb1e4ae 100644 --- a/.github/workflows/workstation-lampstand.yml +++ b/.github/workflows/workstation-lampstand.yml @@ -105,3 +105,41 @@ jobs: grep -F '"documents": 1' "$stats_out" >/dev/null PATH="$stub_bin:$PATH" bash "$helper" index --root "$tmp_dir" >/dev/null + + - name: Smoke: sourceos-search user service commands with stub systemctl + run: | + set -euo pipefail + helper='profiles/linux-dev/workstation-v0/bin/sourceos-search.sh' + stub_bin=$(mktemp -d) + cat > "$stub_bin/systemctl" <<'EOF' + #!/usr/bin/env bash + set -euo pipefail + test "${1:-}" = --user + shift + case "${1:-}" in + status) + printf 'sourceos-lampstand.service active\n' + ;; + start|stop|restart|enable) + printf 'systemctl --user %s %s\n' "$1" "${2:-}" + ;; + *) + printf 'unexpected systemctl args: %s\n' "$*" >&2 + exit 2 + ;; + esac + EOF + cat > "$stub_bin/journalctl" <<'EOF' + #!/usr/bin/env bash + set -euo pipefail + printf 'lampstand log line\n' + EOF + chmod +x "$stub_bin/systemctl" "$stub_bin/journalctl" + + tmp_dir=$(mktemp -d) + PATH="$stub_bin:$PATH" bash "$helper" service status --write "$tmp_dir/status.txt" + grep -F 'sourceos-lampstand.service active' "$tmp_dir/status.txt" >/dev/null + PATH="$stub_bin:$PATH" bash "$helper" service restart >/dev/null + PATH="$stub_bin:$PATH" bash "$helper" service enable >/dev/null + PATH="$stub_bin:$PATH" bash "$helper" service logs --write "$tmp_dir/logs.txt" + grep -F 'lampstand log line' "$tmp_dir/logs.txt" >/dev/null