/**
* pgh pull — `git pull` with pear-remote auto-detect.
*
* pgh pull # auto-detect pear remote, pull current branch
* pgh pull --rebase # flags pass through
* pgh pull origin main # explicit remote, no auto-detect
*
* Pure local — does not connect to the v3 daemon.
*/
import { detectPearRemote, runGit } from './_git-helpers.js'
export const usage = `pgh pull — 'git pull' with pear-remote auto-detect
pgh pull Auto-detect pear remote, pull branch
pgh pull --rebase Flags pass through to git
pgh pull origin main Explicit remote (no auto-detect)
Pure local — does not connect to the daemon.`
export async function run (client, args) {
const userSuppliedRemote = args.length > 0 && !args[0].startsWith('-')
let finalArgs
if (userSuppliedRemote) {
finalArgs = ['pull', ...args]
} else {
const remote = detectPearRemote()
finalArgs = ['pull', remote, ...args]
}
await runGit(finalArgs)
return null
}