Add npackd local service layer (roadmap Phase 2, first slice) - #8
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
npack daemon [--socket <path>], running npackd: a JSON-RPC-over-Unix-socket service (newline-delimited JSON, defaulting to$XDG_RUNTIME_DIR/npackd.sock) exposingSearch,GetPackage,ListInstalled,Install,Remove,Update, andCheckUpdates, so a GUI store or other tool can talk to npack without understanding Nostr, Blossom, or.npkinternals.GetPackage/Search/CheckUpdatesreuse the existingresolve_release/search_matching_releases(newly extracted fromsearch_releases, which now just prints its results) logic directly rather than reimplementing it;Install/Remove/Updatecall the existinginstall_remote_command/remove_package_atfunctions and report structured results back over the socket.Send, ruling outtokio::spawn), and a client gets the final result once anInstall/Updatecompletes.GetTransaction/CancelTransactionare left for a later slice.Test plan
cargo fmt --all -- --checkcargo clippy --all-targets --all-features(no warnings)cargo test(46 passing, including a new end-to-end daemon test over a real Unix socket)nc -U:ListInstalled/Removeagainst a real installed package,GetPackageagainst npack's own real production Nostr/Blossom release, and an unknown-method error path — all verified workingFollow-up (tracked in the roadmap)
CancelTransactionfor long-running installs.🤖 Generated with Claude Code