OverviewFilesCommitsIssuesDocsReleasesPeers

pgh commits / 40351f6

0.1.126: `pgh repo create <name> [--branch <b>]`
CLI half of pear-git-v3 0.1.182's create-repo RPC. Dispatch is enumerated (cli.js maps `repo` to commands/repo.js, which matches subcommands with `if (sub === ...)`), so the verb needs a case here to exist. Matched BEFORE the bare-name fallthrough at the bottom of run() -- that final `return client.call('repo-info', { name: sub })` treats any unrecognised subcommand as a repo name to show, so an unplaced `create` case would silently become "show me the repo called create" instead of erroring. Branch flag follows the file's existing idiom (args.indexOf, as in invite/grant-writer) and defaults to main. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
40351f6d0e97a7791519b5d9af5274a4cf027707
by plankatron <fleeky@gmail.com> · 2026-07-30T00:12:37.000Z

Changed files (2) +13 -1

lib/commands/repo.js +12 -0
……@@ -10,6 +10,7 @@ export const usage = `pgh repo — browse repos served by the daemon
1010 pgh repo info <name>
1111 pgh repo branches <name>
1212 pgh repo tags <name>
13 pgh repo create <name> [--branch <b>] Host a new bare repo (default: main)
1314 pgh repo scan Rescan the repos dir
1415
1516 Per-repo P2P pairing (issue #35):
……@@ -65,6 +66,17 @@ export async function run (client, args) {
6566 return client.call('repo-tags', { name })
6667 }
6768
69 // Host a new bare repo in one call: init --bare + symbolic-ref HEAD + scan +
70 // serve, all daemon-side. Must be matched BEFORE the bare-name fallthrough at
71 // the bottom, or `create` would be read as a repo name to show.
72 if (sub === 'create') {
73 const name = args[1]
74 if (!name) throw new Error('usage: pgh repo create <name> [--branch <branch>]')
75 const bi = args.indexOf('--branch')
76 const branch = (bi !== -1 && args[bi + 1]) || 'main'
77 return client.call('create-repo', { name, branch })
78 }
79
6880 if (sub === 'scan') {
6981 return client.call('scan-repos', {})
7082 }
package.json +1 -1
……@@ -1,6 +1,6 @@
11{
22 "name": "pgh",
3 "version": "0.1.125",
3 "version": "0.1.126",
44 "description": "pgh — P2P content-addressed package manager and app launcher",
55 "type": "module",
66 "main": "index.js",