| … | … | @@ -27,6 +27,14 @@ export const usage = `pgh repo — browse repos served by the daemon |
| 27 | 27 | pgh repo writers <name> List writers |
| 28 | 28 | pgh repo grant-writer <name> --peer <url> [--role owner|writer] |
| 29 | 29 | Admin: grant a peer push authority |
| 30 | pgh repo visibility <name> Show whether THIS peer serves the repo |
| 31 | pgh repo visibility <name> public Serve it (writes the export-ok marker) |
| 32 | pgh repo visibility <name> private Stop serving it here. Admin. |
| 33 | BEST-EFFORT, not a retraction: bundles |
| 34 | already published stay in the overlay |
| 35 | and peers holding the discoveryKey keep |
| 36 | it. The marker is LOCAL — run on each |
| 37 | peer. |
| 30 | 38 | pgh repo retire <name> Tombstone a repo: stop listing/serving/ |
| 31 | 39 | re-creating it fleet-wide. Bytes are |
| 32 | 40 | NOT removed — remove ~/git-repos/ |
| … | … | @@ -96,6 +104,25 @@ export async function run (client, args) { |
| 96 | 104 | // must replicate to every peer BEFORE anyone removes bytes. See |
| 97 | 105 | // pear-git-v3/lib/services/retired-repos.js, which never deletes anything and |
| 98 | 106 | // is explicit that removing bytes is a manual per-peer operator action. |
| 107 | // visibility — read or set whether THIS peer serves a repo. |
| 108 | // |
| 109 | // Deliberately not `--public/--private` flags: the two directions are not |
| 110 | // symmetric. public→private stops future serving but cannot retract bundles |
| 111 | // already in the overlay, nor un-tell peers a discoveryKey. The daemon |
| 112 | // returns a warning saying so; print it rather than swallowing it, or an |
| 113 | // operator will believe a repo was made secret when it was only unlisted. |
| 114 | if (sub === 'visibility') { |
| 115 | const name = args[1] |
| 116 | const value = args[2] |
| 117 | if (!name) throw new Error('usage: pgh repo visibility <name> [public|private]') |
| 118 | if (value && value !== 'public' && value !== 'private') { |
| 119 | throw new Error("usage: pgh repo visibility <name> [public|private] — got '" + value + "'") |
| 120 | } |
| 121 | // No value → query. The marker is LOCAL, so this answers for THIS peer |
| 122 | // only; run it on each peer to see the whole picture. |
| 123 | return client.call('repo-visibility', value ? { name, visibility: value } : { name }) |
| 124 | } |
| 125 | |
| 99 | 126 | if (sub === 'retire') { |
| 100 | 127 | const name = args[1] |
| 101 | 128 | if (!name) throw new Error('usage: pgh repo retire <name>') |