Skip to content

Add npackd local service layer (roadmap Phase 2, first slice) - #8

Merged
imattau merged 1 commit into
masterfrom
phase2-npackd-service-layer
Sep 21, 2026
Merged

imattau merged 1 commit into
masterfrom
phase2-npackd-service-layer

Conversation

@imattau

@imattau imattau commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds npack daemon [--socket <path>], running npackd: a JSON-RPC-over-Unix-socket service (newline-delimited JSON, defaulting to $XDG_RUNTIME_DIR/npackd.sock) exposing Search, GetPackage, ListInstalled, Install, Remove, Update, and CheckUpdates, so a GUI store or other tool can talk to npack without understanding Nostr, Blossom, or .npk internals.
  • GetPackage/Search/CheckUpdates reuse the existing resolve_release/search_matching_releases (newly extracted from search_releases, which now just prints its results) logic directly rather than reimplementing it; Install/Remove/Update call the existing install_remote_command/remove_package_at functions and report structured results back over the socket.
  • Design choice: Unix socket over D-Bus for this first slice — no new system/session-bus dependency, so it behaves the same in minimal and containerized environments. A D-Bus adapter in front of the same handlers remains possible if a later desktop-store phase needs it.
  • Scope choice: no transaction/progress-event streaming yet — connections are handled one at a time (the recursive dependency-install future is not Send, ruling out tokio::spawn), and a client gets the final result once an Install/Update completes. GetTransaction/CancelTransaction are left for a later slice.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features (no warnings)
  • cargo test (46 passing, including a new end-to-end daemon test over a real Unix socket)
  • Manual smoke test over a real socket with nc -U: ListInstalled/Remove against a real installed package, GetPackage against npack's own real production Nostr/Blossom release, and an unknown-method error path — all verified working

Follow-up (tracked in the roadmap)

  • Streamed progress/transaction events and CancelTransaction for long-running installs.
  • Concurrent connection handling (currently one at a time).

🤖 Generated with Claude Code

Adds `npack daemon`, a JSON-RPC-over-Unix-socket service exposing
Search, GetPackage, ListInstalled, Install, Remove, Update, and
CheckUpdates so a GUI store or other tool can talk to npack without
understanding Nostr, Blossom, or .npk internals. Chose a Unix socket
over D-Bus for this first slice to avoid a new system/session-bus
dependency; a D-Bus adapter in front of the same handlers remains
possible later.

Connections are handled one at a time rather than spawned onto the
runtime, since the recursive dependency-install future is not Send.
Transaction/progress-event streaming and GetTransaction/
CancelTransaction are deferred to a later slice.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@imattau
imattau merged commit 64e294b into master Sep 21, 2026
3 checks passed
@imattau
imattau deleted the phase2-npackd-service-layer branch September 21, 2026 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant