upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/lib/client.rs
AgeCommit message (Collapse)Author
2026-03-20fix(client): panic cloning bare npub nostr:// URL with no relay hintsDanConwayDev
When cloning a nostr:// URL containing only an npub and identifier (no relay hints), and nothing is cached yet, the relay set was empty because fallback relays were intentionally skipped when a coordinate was present. This caused an unwrap() on a None from reduce() over an empty iterator. Fall back to fallback relays when the coordinate-derived relay set is still empty after processing all hints, and replace unwrap() with map_or() as a defensive guard.
2026-03-05feat(cover-note): add kind-1624 cover notes for PRs, patches, and issuesDanConwayDev
Implements experimental kind-1624 cover note events: - KIND_COVER_NOTE constant and process_cover_note() in git_events.rs; replaceable semantics (latest created_at, hex-id tiebreak), author or maintainer only - kind-1624 events fetched alongside labels in the fetch pipeline; cover_notes count added to FetchReport display - ngit pr/issue view: cover note displayed in place of description with a clear 'Cover Note:' header; maintainer-authored notes identify the author; original description shown only with --comments; cover_note object included in --json output - ngit pr set-cover-note / ngit issue set-cover-note: publish a kind-1624 event; nostr: mentions in --body converted to q/p tags via tags_from_content (same rules as issue --body) - Fix pre-existing clippy::too_many_lines on repo/mod.rs show_info
2026-03-05feat(labels): fetch and apply NIP-32 kind-1985 label eventsDanConwayDev
- Add KIND_LABEL (kind 1985) constant to git_events.rs - Add get_labels() merging inline t-tags with external kind-1985 events, gating each on author-or-maintainer permission - Extend get_fetch_filters() to request kind-1985 events for all known issue and proposal IDs - Track label event counts in FetchReport (field + Display + consolidation) - Update issue_list.rs and list.rs to fetch label events from cache and pass them through get_labels() instead of reading t-tags inline
2026-03-04feat: fetch and display NIP-22 comment counts on issues and proposalsDanConwayDev
Download kind-1111 NIP-22 comments from relays and show a comment count in the detail view of `ngit list <id>` and `ngit issue list <id>`. - git_events: add KIND_COMMENT constant (kind 1111) - client: import KIND_COMMENT; add `comments` field to FetchReport; route kind-1111 events into report.comments in process_fetched_events; consolidate comments across relay reports; display "N comment(s)" in FetchReport; add a #E-tagged kind-1111 filter in get_fetch_filters covering all known issue and proposal root IDs - issue_list: add get_comment_counts() to query the local cache for kind-1111 events by #E tag and count per issue; extend the filtered tuple with comment_count; show a CMTS column in the table, a "Comments: N" line in the detail view, and a "comments" field in JSON - list: add KIND_COMMENT import; add resolve_event_id() helper and get_comment_count_for_proposal() to look up the count for a single proposal from the local cache; pass comment_count into show_proposal_details(); display "Comments: N" in plain text and "comments" in JSON; align detail-view labels
2026-03-04feat: add ngit issue list commandDanConwayDev
Non-interactive listing of NIP-34 issues (kind 1621) with status resolution, hashtag display, and detail view. - get_issues_from_cache: fetch GitIssue events from local cache by repo coordinate, mirroring get_proposals_and_revisions_from_cache - ngit issue list: table output of ID, status, title and hashtags at end of each row; status resolved via existing get_status() logic - --status: comma-separated filter (open,draft,closed,applied; default: open) - --hashtag: comma-separated label filter (case-insensitive, OR match) - --json: machine-readable output including hashtags and description - --offline: skip network fetch, use local cache only - <id>: optional positional argument (hex event-id or nevent) to show full details of a specific issue including body content
2026-03-04feat: fetch and report NIP-34 issues and their statusesDanConwayDev
Download kind-1621 issues from relays into the local cache alongside patches and PRs. Issue IDs are tracked separately from proposal IDs throughout the fetch pipeline so they never appear in proposal lists. - get_fetch_filters: include Kind::GitIssue in the #a-tag filter and add a dedicated issue_ids parameter to fetch status events (1630-1633) tagged with known issue IDs - FetchRequest: add issue_ids field populated from the local cache - fetch_all_from_relay: track fresh_issue_roots independently of fresh_proposal_roots; loop continues until both are drained - process_fetched_events: route GitIssue events into fresh_issue_roots and report.issues; route status events to issue_statuses or statuses based on whether the root ID is a known issue or proposal - FetchReport: add issues and issue_statuses fields, consolidated across relays, and displayed as "N issue(s), M issue status(es)" in the report
2026-02-27fix: include KIND_PULL_REQUEST IDs in proposal_ids for fetch filtersDanConwayDev
kind-5 deletion events that only #e-tag a PR Kind event (kind 1618) were never fetched because proposal_ids was built from Kind::GitPatch events only. The deleted PR event remained in the local cache and continued to appear as a remote ref (refs/heads/pr/<branch>).
2026-02-27fix: update fallback signer relaysDanConwayDev
Replace nsec.app with bucket.coracle.social and nos.lol.
2026-02-26feat: track and display kind-5 deletion count in FetchReportDanConwayDev
Add a deletions counter to FetchReport, incremented in process_fetched_events for each kind-5 event received and accumulated across relays in consolidate_fetch_reports. The count is included in the fetch summary display (e.g. "1 deletion", "2 deletions").
2026-02-26feat: request kind-5 deletions for state/announcement events by #eDanConwayDev
Add a non_proposal_event_ids parameter to get_fetch_filters and a corresponding field on FetchRequest. On each fetch, the event IDs of cached repo announcements and the state event are collected and used to build a dedicated kind-5 filter keyed on #e tags, as specified by NIP-09. The existing #a-tagged filter already covers addressable-event deletions; this new filter catches deletions from clients that follow NIP-09 strictly and do not embed a repo coordinate in their deletion event.
2026-02-26fix: show detailed relay view when --verbose flag is set in send_eventsDanConwayDev
The use_concise flag in send_events was computed with || instead of &&, causing !is_test to short-circuit to true in production and making --verbose have no effect on published event display.
2026-02-26feat: publish state event to stale grasp relays before sync pushDanConwayDev
FetchReport now captures the full state event seen on each relay during the nostr fetch (state_per_relay: HashMap<RelayUrl, Option<Event>>). ngit sync uses this to identify grasp server relays with a missing or outdated state event and publishes the current state event to them before attempting git pushes, preventing rejections. An existing login is loaded silently (no prompt, no profile fetch) to provide a signer for NIP-42 auth if requested.
2026-02-26fix: rollback local state event cache on total push failureDanConwayDev
When all git servers reject or skip a push, delete the newly-published state event from the local nostr cache and restore the previous state event (if any), so that a subsequent retry starts from a clean baseline rather than a state that no server ever accepted.
2026-02-26fix: report per-relay publish results in send_events summaryDanConwayDev
Change send_events() return type from Result<()> to Result<Vec<(String, bool)>> so callers can inspect which relays accepted events. Update the finish message to show "Published to X/N relays (failed: ...)" instead of the unconditional "Published ... to nostr relays".
2026-02-25fix IPv6 connection failures with Happy Eyeballs (RFC 8305)DanConwayDev
Implement a custom WebSocketTransport that races IPv6 and IPv4 connections with a 250ms head start for IPv6, matching browser behavior. This prevents broken IPv6 from blocking all relay connections indefinitely. This is a temporary fix until the upstream async-wsocket PR is merged: https://github.com/shadowylab/async-wsocket/pull/42
2026-02-20improve `ngit repo` output formattingDanConwayDev
- suppress fetch summary (no updates / updates: X) - write blank line to stderr after relay errors for clear separation - show identifier below title only when it differs from name - show earliest unique commit (root_commit) in metadata - restructure infrastructure into grasp servers / additional git servers / additional relays sections - display grasp servers by domain only (strip scheme, npub, repo path) - strip wss:// prefix from relay display - show maintainer names from metadata cache; fall back to short npub - append (you) next to the current user's name wherever it appears - show [name] attribution and the maintainer model note only when there is more than one maintainer
2026-02-20replace nos.lol with relay.ditto.pub as default relayDanConwayDev
nos.lol always prompts for nip42 auth even for reading, making it unsuitable as a default relay.
2026-02-18report event kinds in publish progress messagesDanConwayDev
instead of generic 'Publishing to nostr relays...' messages, describe what is being published e.g. 'Publishing 3 patches to nostr relays...' or 'Publishing 1 announcement and 1 state event to nostr relays...'
2026-02-17add second default signer relay for resilienceDanConwayDev
Add wss://relay.ditto.pub as a second default signer relay alongside wss://relay.nsec.app for improved reliability during nostrconnect login.
2026-02-16test: fix all tests that use publishDanConwayDev
that expect whitespace then something
2026-02-16fix: report wording consistancy in publishingDanConwayDev
always report publishing and finish with published
2026-02-16fix: report wording `fetching` ~> `checking`DanConwayDev
to be consistent with the summary version
2026-02-16fix: report wording `maintainers ~> announcementsDanConwayDev
'maintainers' is missleading as the announcement authors may not be in the maitnainer set
2026-02-13feat: add spinner for publish in non-verbose modeDanConwayDev
Apply the same hidden-to-visible MultiProgress pattern used for fetch to send_events. In concise mode (non-verbose, non-test, non-silent), a spinner is shown immediately and the detail progress bars are revealed after a delay, using the deferred bar finish mechanism.
2026-02-13fix: tweak fetch msgDanConwayDev
as its not fetching from git servers just yet
2026-02-13fix: pre-add heading bar so it renders in expanded viewDanConwayDev
The heading bar was being inserted into the MultiProgress after the draw target switch, but by then all relay bars were already finished so indicatif did not re-render the layout. Pre-add the heading bar at creation time (position 0, before relay bars) and only call finish_with_message on it after the draw target switches to stderr.
2026-02-13fix: show heading in expanded view by finishing after draw target switchDanConwayDev
The 'fetching updates...' heading was finished with finish_with_message while the draw target was still hidden, so indicatif never rendered it. Move the draw target switch before the heading insertion so the heading renders immediately when added.
2026-02-13fix: defer bar finish until reveal to show all barsDanConwayDev
indicatif does not re-render bars that called finish_with_message while the draw target was hidden. Instead of trying to force a redraw, defer the finish_with_message call until after the draw target switches to stderr. A BarRevealState coordinates between relay tasks and the timer: bars that complete before the 5s reveal store their finish state in a mutex-protected list, which the timer flushes after switching the draw target. Bars completing after reveal finish immediately as before.
2026-02-13fix: use force_draw to redraw bars after revealDanConwayDev
tick() is a no-op when enable_steady_tick() is active. Use force_draw() on a bar to trigger a full MultiState redraw including bars that finished while the draw target was hidden.
2026-02-13fix: only show heading when expand delay firesDanConwayDev
Use a ProgressBar inside the detail multi for the heading instead of eprintln so it gets cleared with progress_reporter.clear() and never appears when fetch completes before the delay.
2026-02-13refactor: hidden-to-visible MultiProgress patternDanConwayDev
Replace the broken SpinnerState approach (which checked should_expand at task spawn time when all tasks spawn simultaneously) with a two-MultiProgress pattern: a visible spinner shown immediately, and a hidden detail multi that every relay task always adds bars to. A background timer reveals the detail bars after 5s, printing a heading before switching the draw target.
2026-02-13feat: add spinner for git fetch in non-verbose modeDanConwayDev
Shows a progress spinner when fetching from git remotes in non-verbose mode. Suppresses git fetch output and listing messages when not in verbose mode. Uses NGITTEST environment variable for test timeouts.
2026-02-11feat: use fallback relays for bootstrapping onlyDanConwayDev
- Add --relay flag to 'ngit account create' allowing users to specify relay URLs (repeatable). Defaults to relay-default-set when not provided. - Remove fallback relays from fetch when repo context exists (repo coordinate provided). Only use them for bootstrapping (profile discovery with no repo context). - Remove fallback relays from publish when repo or user relays exist. Only use them when neither is available (e.g. new account signup). - Update --customize help text to reflect new relay-default-set behavior.
2026-02-10remove more_fallback_relays (dead code)DanConwayDev
The more_fallback_relays field is never consumed anywhere in the codebase. Removing it from the Client struct, Params struct, trait definition, and all related initialization code.
2026-02-10remove relay.nostr.band from default relaysDanConwayDev
The relay.nostr.band relay is now offline and should be removed from the default relay set.
2026-02-10feat: update ngit account login for non-interactive modeDanConwayDev
Update login flow to support non-interactive mode with --nsec flag. Refactor login logic to handle both interactive and non-interactive cases. Add better error handling and validation.
2025-11-18chore: fix clippy warningDanConwayDev
use more idomatic function
2025-11-14fix: fetch report showing cached profile event as newDanConwayDev
it was only checking local cache, where profile events are stored only stored in global
2025-11-13fix: cli output dim coloringDanConwayDev
so that relay/git servers appear dim when fetch action is complete
2025-11-13test: reduce relay timeouts for testsDanConwayDev
some test failed and some test jus took too long
2025-11-10feat: adaptive relay timeout 45s or 7s based on successDanConwayDev
also auto-retry connection after 2s with x1.5 increment until timeout
2025-10-20fix: reading NIP-22 style Status events during fetchDanConwayDev
also fix the report so that we show nip10 style statuses too
2025-09-03fix: nostr:// nip05 without localDanConwayDev
the patch I sent to rust-nostr library got merged
2025-08-19fix: nip05 without local partDanConwayDev
allow users to use just a nip05 domain in nostr:// urls rather than requiring _@ prefix.
2025-08-18fix: only use state and ann from maintainersDanConwayDev
at some point we introduced a bug were we were taking the state and git servers from non authorised maintainers.
2025-08-07Merge branch 'add-prs-to-ngit-send'DanConwayDev
2025-08-07feat(send): PR fallback to user / custom graspDanConwayDev
if use is maintainer, push PR to all repo git servers. if user has a fork, push to all git servers it lists, and repo grasp servers. if user hasn't got a fork but has a user grasp list and pushing push to repo grasp servers fails, create a personal-fork automatically at each user grasp server and push there. fallback to prompting user for either grasp servers or git server with write permission. if user provides grasp servers, suggesting adding to user preference list.
2025-08-04refactor: use rust-nostr `verify_subscriptions`DanConwayDev
instead of `match_events` after receiving events
2025-07-31fix: nip05 breaking changes in rust-nostrDanConwayDev
as its now 'bring your own transport'
2025-07-31chore: bump rust-nostr v0.43DanConwayDev
with trival breaking changes. nip05 changes will be done seperately.
2025-07-23refactor: Rename fallback relays and grasp serversDanConwayDev
Rename `params.fallback_relays` and `client.fallback_relays` to `relay_default_set`. Rename `params.fallback_grasp_servers` to `grasp_default_set`. This includes updating associated getters and usages across the codebase.
2025-07-23refactor: add fallback grasp servers to clientDanConwayDev
so that they can be used as part of push and send
2025-07-22feat(pr): generate pr event > oversized patchDanConwayDev
but only for new proposals
2025-07-18feat(pr): fetch pr and pr updates from clone urlsDanConwayDev
we try and get them from clone urls of repo and fallback to those specified by contributor
2025-07-18feat(pr): list PR and PR updatesDanConwayDev
remote will list the refs under `pr/*` namespace. `ngit list` will display in the list of open / draft proposals. it won't yet fetch the related oids to enable fetching or checking out the branch.
2025-07-18feat: fetch PR and PRUpdate eventsDanConwayDev
as the first stage of adding support
2025-07-18feat(status): read nip22 style status eventsDanConwayDev
in anticipation of moving to the nip22 style
2025-07-16chore: bump nightly rustfmtDanConwayDev
to latest available and apply fmt fixes
2025-07-16chore: nix flake updateDanConwayDev
required running: `cargo fix --allow-dirty --allow-staged` `cargo clippy --fix --allow-dirty -- -D warnings` to fix problems and then manually fixing some too
2025-07-15feat(client): skip relays that just timeoutDanConwayDev
Prevent repeated attempts to connect to relays that have previously failed due to connection timeouts within the current session, improving overall performance and reliability. Added a `relays_not_to_retry` map to the `Client` struct to store relays to skip and their reasons. Implemented methods `skip_relay_for_session` and `is_relay_skipped_for_session` to manage this map. Relays are added to the skip list upon connection timeouts. Subsequent attempts to use these skipped relays during the same session will immediately fail with the recorded reason, avoiding unnecessary network calls. Progress bars are updated to reflect skipped relays and their reasons.
2025-05-31feat(push): prevent push if no ann eventDanConwayDev
To ensure additional maintainers publish an annoucement event, require it for them to push
2025-05-23fix: use blossoms from all maintainersDanConwayDev
applying this change to blossom: 25e58e52624210f5852a9183495821526add5928
2025-05-21fix: preserve relay and git server orderDanConwayDev
rewrite of 25e58e52624210f5852a9183495821526add5928 which took relays & git servers from all maintainer some test failed due to incorrect ordering. its better to start with the ones the trusted maintainer selected.
2025-05-21feat: add support for default relay overridesDanConwayDev
via git config so they can be overwritten locally and globally
2025-05-21refactor: move client defaults into paramsDanConwayDev
in prep for optionally getting some of this config from git config overrides
2025-05-21fix: use relays & git servers from all maintainerDanConwayDev
but other details from trusted maintainer. This maximises the likelihood that all git servers and relays have the correct state.
2025-05-05chore: nix flake updateDanConwayDev
update nix dependancies to latest version using default update options run `cargo clippy --fix` and `cargo fmt` to fix new clippy errors
2025-04-03feat(send): add description to event signing processDanConwayDev
resolving nostr:note1qu8le4a8qz9hhxy6q85txejcq0kln0r3s9vdtwrhtqwvauc6nxuqn3fj0z so it doesnt appear frozen when there are lots of events being signed by a remote signer
2025-04-02fix: publish error prefix regressionDanConwayDev
introduced by rust-nostr v0.40 from v0.37
2025-04-01chore: bump rust-nostr v0.37 ~> v0.40DanConwayDev
and fix all of the breaking changes
2024-12-16chore: bump nix flake rust nightly `fmt` overlayDanConwayDev
update the rust nightly `fmt` overlay which needs to be pinned to a specific version (this case by date) update formatting in main files via `cargo fmt`
2024-12-03refactor: limit fetch to 1 trusted coordinateDanConwayDev
previously fetch supported fetching multiple trusted coordinates at once. The additional complexity trade off isn't worth it. It will still fetch events related to the coordinates of maintainers that the trusted maintainer lists. A scenario where there might be multiple trusted coordinates is where a large repo is split into multiple nostr repos to manage pull requests and issues in seperate sub-units. I might therefore have different remotes that target different identifiers. There also might be different set of maintainers groups that are have different views on the latest state of the same codebase and they haven't split off into using different identifiers. Its simplier ngit to fetch these different nostr repos independantly when requested. git-remote-nostr will do this automatically as it works through remotes but for ngit cmds a further change is required so `get_repo_coordinates` and `try_and_get_repo_coordinates` prompts to select the desired one.
2024-12-02fix: repo_ref 'not found' err suggest `ngit init'DanConwayDev
if the nostr remote was created by the maintainer before `ngit init` was ran. the error is more likely to occur when a user clones a repo using the nostr remote whist the relay in the hint is down and the fallback relays dont have the announcement. or if the user is offline when they clone.
2024-12-02fix(repo_ref): clarify no repo event err msgDanConwayDev
as there might be a repo event but we couldn't find it
2024-11-29feat(init): set remote `origin`DanConwayDev
check whether remote `origin` is nostr url and if not attempt to set it.
2024-11-28refactor: remove fufilled commentDanConwayDev
as the feature is implmeneted
2024-11-27feat: only print awaiting signer with nip46DanConwayDev
using the backend feature I requested for rust-nostr
2024-11-27chore: bump rust-nosrt v0.37.0DanConwayDev
use RelayUrl in repo_ref which I had resisted as it mutates relay urls when printed to append a slash
2024-11-26refactor: err msgs 'cannot' > 'failed to'DanConwayDev
in nearly all cases 'cannot' was used when an action was tried and failed. 'failed to' is strictly better because: * just because the action didn't work that time doesnt mean it cannot work * it is better at drawing the users attention to a problem
2024-11-21feat(login): overhaul login experienceDanConwayDev
* simplify login menu, making it more accessable to newcomers and easier to select remote signer options * enable `ngit login` to work from anywhere (not just a git repo) * assume fresh login details saved to global git config but fallback to local repository * maintain local repository login via `ngit login --local` * maintain login via CLI arguments eg `ngit send --nsec nsec123` * nudge users to remember nsec when pasting in ncryptsec for a better UX, whilst maintaining the option to be prompted for password everytime * create placeholder menu items for help menu and create account
2024-11-12fix: send event error messageDanConwayDev
rust-nostr v35/v36 changed the `pool.send_event_to` error message to use 'event/s not published' instead of the error message from the relay. `relay.send_event` supplies the useful error message.
2024-11-12test: prevent signer commentaryDanConwayDev
identification of signer has been removed from rust-nostr. until it is added back in we must always prompt the user about signing as if its a local signer the message will be removed before the user sees it. unfortunately this is picked up by the tests so we must only prompt the user when not running tests.
2024-11-11chore: bump rust-nostr v0.36DanConwayDev
bump all rust-nostr packages to latest issued version. there have been some breaking changes to nip46 and this applies these changes.
2024-10-31fix(init): remove broken blasterDanConwayDev
muntiny wallet has shut down and removed its blaster relay
2024-10-28chore: bump rust-nostr to patch near v0.36.0DanConwayDev
bump all rust-nostr packages refactoring code based on breaking changes upgrading to patched version to address signer issue: nostr:nevent1qvzqqqqqqypzq6xcz9jerqgqkldy8lpg7lglcyj4g3nwzy2cs6u70wejdaj7csnjqy88wumn8ghj7mn0wvhxcmmv9uqzpsw5ph8le2n2kh6uchftawt74hddazk9tp7wjmz967y2l0uva5rc7hsstq
2024-10-28refactor: replace sqlite with lmdbDanConwayDev
as sqlite is depricated in rust-nostr
2024-09-25chore: bump rust-nostr v0.35DanConwayDev
bump all rust-nostr packages
2024-09-24feat(login): login via nip46 QR codeDanConwayDev
or nostrconnect url string which is a much better UX flow for nip46
2024-09-11refactor: fix fmt and clippy issuesDanConwayDev
which potentially were only identified when a dependancy was updated
2024-09-04refactor(remote): split into modulesDanConwayDev
to make it easier to read
2024-09-04refactor: fix imports, etc based on restructureDanConwayDev
move some functions out of ngit and into lib/mod and lib/git_events remove MockConnect from binaries so it is only used in the library. this was done: * mainly because automocks were not being imported from lib into each binary * but also because the these functions were being tested with MockConnect
2024-09-04refactor: organise into lib and bin structureDanConwayDev
the make the code more readable this commit just moves the files, the next commit should fix the imports