| … | … | @@ -29,7 +29,8 @@ export const usage = `pgh names / claim / release — NameRegistry (sidecar-owne |
| 29 | 29 | pgh names resolve <name> |
| 30 | 30 | pgh names update <name> [--registry-key <hex>] [--server-key <hex>] [--description "..."] |
| 31 | 31 | Re-point a name you own (rotate registry/server key) |
| 32 | | pgh names reanchor <name> | --all Repair a claim anchored to a device key (org #142) |
| 32 | pgh names reanchor <name> | --all [--force] |
| 33 | Repair a claim anchored to a device key (org #142) |
| 33 | 34 | pgh names info |
| 34 | 35 | pgh names subscribe <registryKeyHex> Replicate another publisher's NameRegistry (read-only) |
| 35 | 36 | pgh names subscriptions List own + subscribed name registries` |
| … | … | @@ -166,19 +167,23 @@ export async function run (_client, args) { |
| 166 | 167 | |
| 167 | 168 | if (sub === 'reanchor') { |
| 168 | 169 | const all = hasFlag(args, '--all') |
| 170 | // Re-emit even where this peer already shows the claim re-anchored: a peer |
| 171 | // that applied the op without an OP_REANCHOR_NAME branch consumed it, and |
| 172 | // upgrading does not re-run history. The op is idempotent per-peer. |
| 173 | const force = hasFlag(args, '--force') |
| 169 | 174 | const name = args[1] && args[1][0] !== '-' ? args[1] : null |
| 170 | 175 | if (!name && !all) { |
| 171 | | throw new Error('usage: pgh names reanchor <name> | pgh names reanchor --all') |
| 176 | throw new Error('usage: pgh names reanchor <name> | pgh names reanchor --all [--force]') |
| 172 | 177 | } |
| 173 | 178 | return withClient(async (c) => { |
| 174 | 179 | const targets = name ? [name] : (await c.call('list-names', { own: true })).map(e => e.name) |
| 175 | 180 | const out = [] |
| 176 | 181 | for (const n of targets) { |
| 177 | 182 | try { |
| 178 | | const res = await c.call('reanchor-name', { name: n }) |
| 183 | const res = await c.call('reanchor-name', { name: n, force }) |
| 179 | 184 | out.push({ |
| 180 | 185 | name: n, |
| 181 | | status: res.alreadyAnchored ? 'already anchored' : 're-anchored', |
| 186 | status: res.alreadyAnchored ? 'already anchored' : (res.forced ? 're-emitted (for peers behind)' : 're-anchored'), |
| 182 | 187 | identityRoot: res.entry.publisher.identityRoot |
| 183 | 188 | }) |
| 184 | 189 | } catch (err) { |