29 Commits
Author SHA1 Message Date
DanConwayDev 0eb8693d10 feat: add Optimize Repository button to project dropdown
Single self-contained recovery action: consolidates all git pack files
into one pack of every reachable object (from all branches, tags,
remotes, stash, and HEAD), removes the old packs and redundant loose
objects, and reports the size reduction in a toast. Shows a spinner
while running.

All logic (UI, gc algorithm, run state) lives in one new file; the only
other change is its render line in ProjectTitleMenu, so the feature can
be removed by deleting the file and that line.

Safety guarantees: the repository is left completely untouched if any
object fails to read during the reachability walk (an already-damaged
repo can never lose history), and also if the new undeltified pack
would not actually shrink the repo (isomorphic-git's packObjects does
no delta compression, so repacking a server-deltified clone could
otherwise grow it permanently).
2026-06-12 15:28:37 +01:00
DanConwayDev 5b8cb25675 Revert "Checkout branch with "force" so it updates the tree"
This reverts commit d13bc84232.

proceed with caution on this as i dont know what you were fixing
with this change
2025-11-28 11:34:19 -06:00
DanConwayDev 89de28cb0c fix: recovered for detached HEAD
git_commit tool was showing a false positive when in reality no
commits were changed. there are also other issues in the UI whilst
in this state. eg. current branch doesn't show, cannot push or pull,
or 'push to nostr' or github or other remote.

warning this must be done in combination with reverting
d13bc84232 or the user will lose all
uncomitted changes
2025-11-28 11:34:19 -06:00
DanConwayDev 4d88823c2d Improve toast message for new branch push 2025-11-13 16:41:48 -06:00
DanConwayDev 43f4e0d15d Auto-switch to newly crated branch 2025-11-13 16:22:50 -06:00
DanConwayDev 21e522cba7 Fix git fetch handle deteled refs 2025-11-13 16:11:39 -06:00
DanConwayDev 77a1a17c06 Fix git fetch toast missfire
toast trigger was comparing state with the previous fetch rather than the
local state we gather just before the fetch
2025-11-13 07:34:45 +00:00
DanConwayDev 075d6aba2d Fix git fetch default branch identification
calling remote via getRemoteInfo is not needed and results in null
for nostr remotes.

default branch is used here to trigger git fetch toast notifications

improved test coverage to test whether toast mis-fire when there is
no update
2025-11-12 13:42:18 -06:00
DanConwayDev a1f571b2d8 Fix git push publish state to repo relays
instead of hardcoded default
2025-11-12 13:40:06 -06:00
DanConwayDev d4eca86ec6 Fix retain prior state during git push to nostr remote
otherwise git push to a feature branch removes all other branches
including main and sets HEAD to feature branch.
2025-11-12 13:39:31 -06:00
DanConwayDev 44a208aed5 Fix don't unwrap symrefs in nostr remote
this was causing `refs/remotes/origin/HEAD` to be a commit id rather
than a symbolic reference like in the nostr state event
2025-11-12 13:38:51 -06:00
DanConwayDev ccc3613c83 Fix git status when branch not published
instead using status 'X commits ahead' it says 'Branch not published' and disables pull disabled.
2025-11-12 13:38:20 -06:00
DanConwayDev d11a52992e Fix grasp server sync during automatic fetch
Ensure grasp servers stay synchronized with Nostr state events during
the periodic fetch (every 60 seconds). This prevents a critical UX issue
where the Nostr remote appears up-to-date but grasp servers have stale
refs, making the repository uncloneable.

This can occur when a state event is successfully published to Nostr
relays but an error prevents the corresponding git refs from being
pushed to grasp servers. By validating and syncing during fetch, we
ensure at least one grasp server has the correct refs that match the
Nostr state, maintaining repository accessibility.
2025-11-10 09:11:05 -06:00
DanConwayDev 056f2a0b5f Add automatic Git fetch with change detection and toast notifications
- Implement useGitFetch hook with 60-second polling
- Add toast notifications for remote changes detection
- Update GitDialog to show fetch status and manual refresh
- Add comprehensive tests for useGitFetch
- Update AGENTS.md documentation
- abstract simple time ago data function
2025-11-10 09:11:05 -06:00
DanConwayDev 50897e1164 fix: fetch Nostr remote refs into remote tracking refs instead of local refs
Previously, git fetch for Nostr remotes was directly updating local refs
(refs/heads/*), which incorrectly merged remote changes into the working
tree. Now properly fetches into remote tracking refs (refs/remotes/origin/*)
following standard Git behavior, allowing users to inspect and merge changes
manually.

When no Nostr state event is found, now only fetches from the first priority
clone URL instead of trying all URLs. This prevents potential sync issues
where different servers might have divergent histories, which would create
non-fast-forward conflicts that would revert on the next fetch from the
primary server.
2025-11-10 09:11:05 -06:00
DanConwayDev db001beeb5 Refactor to use parsed repo and state events
move abstract logic in git method extractRepositoryState to a
pure function parseRepositoryState with typed interface for
future reusability.

pass around parsed event instead of NostrEvent.
2025-11-10 09:11:05 -06:00
DanConwayDev 301b0d526b Refactor to abstract repo announcement parsing 2025-11-10 09:11:05 -06:00
DanConwayDev 465bef91e8 fix npm run electron by generating package.json
The electron package.json needs to exist for this command to succeed.
If `prepare-electron-publish.js` has never been run then it hasn't been generated yet. Solution, run that everytime.
2025-11-03 11:35:20 +00:00
DanConwayDev 20186ac94c git fetch recursively fetches state from grasp relays 2025-10-30 20:40:35 +00:00
DanConwayDev 2f0b277481 Refactor repository announcement workflow with improved UX
- Extract announcement logic to dedicated lib/announceRepository.ts utility
- Prepopulate dialog fields from projectId and ngitServers config
- Add real-time validation for repository ID (kebab-case format)
- Move Git operations (state event, remote config) from dialog to GitDialog
- Replace modal success screen with toast notifications for better UX
- Add collapsible advanced settings section for optional fields
- Prevent nostr:// URLs in clone URL field (HTTPS only)
- Close dialog immediately after publishing announcement
- Improve error handling with detailed validation messages
- Fix relay routing: announcements publish to global relay + announcement relays, state events only to announcement relays
- Fix prepopulation preserving user-added URLs and relays with isPrepopulated flag
- Make prepopulated clone URLs and relays editable with onChange handlers
- Add edit mode to modify existing repository announcements via editNaddr prop
- Load existing repository data from Nostr when editing
- Add 'Edit Nostr Git Repo Settings' button in GitDialog for user-owned nostr:// remotes
- Check repository ownership by parsing nostr:// URL and comparing with user pubkey
2025-10-30 20:40:34 +00:00
DanConwayDev 430806fbf9 Fix repo announcement event structure 2025-10-30 15:11:47 +00:00
DanConwayDev 18456f2293 Fix dont make repo announcement whilst sending nostr patch 2025-10-30 15:10:07 +00:00
DanConwayDev bd61f93174 Only wait 5s for provisioning if announcement was published 2025-10-30 11:52:49 +00:00
DanConwayDev 677103a1f1 Send announcement to GRASP servers that don't have it to ensure repo provisioning 2025-10-30 11:52:30 +00:00
DanConwayDev cc65cae4b2 Use GRASP servers found in Nostr repository announcement 2025-10-30 11:51:24 +00:00
DanConwayDev 60f42c4d40 Fix git push handling of --force for nostr remotes 2025-10-30 09:00:44 +00:00
DanConwayDev 8f93a1b55a Fix git push to pass along --force command 2025-10-30 08:36:19 +00:00
DanConwayDev 926d1cbeba Fix git push for nostr - push to all ngit servers
not just the first
2025-10-30 07:53:32 +00:00
DanConwayDev 930ae56f40 Fix no signer error on git push to nostr remote
both from the terminal or chat interface
2025-10-30 07:24:05 +00:00