OverviewFilesCommitsIssuesDocsReleasesPeers

pgh commits / b3d1175

pgh 0.1.120 — repo resync command (+ optional auto-admission)
`pgh repo resync <name>` calls the repo-resync RPC (forceResync: clean re-join into a fresh per-tracker corestore). With `--admit-from <owner-url>` it then auto-requests admission of its new local key from the tracker owner (repo-request-writer), who auto-approves if this peer already has write authority. One command = heal + participate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
b3d11752a659dcac60729b264fcd0055b6109566
by plankatron <fleeky@gmail.com> · 2026-07-20T01:15:46.000Z

Changed files (2) +32 -2

lib/commands/repo.js +31 -1
……@@ -27,7 +27,11 @@ export const usage = `pgh repo — browse repos served by the daemon
2727 pgh repo grant-writer <name> --peer <url> [--role owner|writer]
2828 Admin: grant a peer push authority
2929 pgh repo local-key <name> Print this daemon's tracker local key
30 pgh repo revoke <name> <userId> Revoke a writer`
30 pgh repo revoke <name> <userId> Revoke a writer
31 pgh repo resync <name> [--admit-from <owner-url>]
32 Heal a stuck tracker: clean re-join in
33 a fresh corestore (+ auto-admit if the
34 owner url is given)`
3135
3236export async function run (client, args) {
3337 const sub = args[0]
……@@ -182,6 +186,32 @@ export async function run (client, args) {
182186 return client.call('repo-add-writer', { name, userId, writerKey: peerKey.localKey, role })
183187 }
184188
189 // Clean RE-JOIN of a stuck/frozen per-repo tracker into a FRESH corestore
190 // (repo-resync RPC → forceResync). Recovers a standalone peer whose tracker
191 // can't reconcile a group manifest migration (crash-loops or silently freezes)
192 // — a fresh namespace does NOT heal it (same primaryKey-derived local writer),
193 // only a fresh corestore does. The re-join is READ-ONLY until admitted; with
194 // --admit-from <owner-url> the peer auto-requests admission of its new local
195 // key from the tracker owner, who auto-approves iff this peer already holds
196 // write authority (repo-request-writer). One command = heal + participate.
197 if (sub === 'resync') {
198 const name = args[1]
199 if (!name) throw new Error('usage: pgh repo resync <name> [--admit-from <owner-url>]')
200 const res = await client.call('repo-resync', { repo: name })
201 if (res && res.error) return res
202 const ai = args.indexOf('--admit-from')
203 const owner = ai !== -1 ? args[ai + 1] : null
204 if (!owner || !res || !res.localKey) return res
205 const pc = await PghPeerClient.connect({ url: owner })
206 let admission
207 try {
208 admission = await pc.call('repo-request-writer', { name, writerKey: res.localKey })
209 } finally {
210 await pc.close()
211 }
212 return { ...res, admission }
213 }
214
185215 if (sub === 'revoke') {
186216 const name = args[1]
187217 const userId = args[2]
package.json +1 -1
……@@ -1,6 +1,6 @@
11{
22 "name": "pgh",
3 "version": "0.1.119",
3 "version": "0.1.120",
44 "description": "pgh — P2P content-addressed package manager and app launcher",
55 "type": "module",
66 "main": "index.js",