fix(coding-agent): tighten git source parsing and local path normalization (fixes #1426)

This commit is contained in:
Mario Zechner 2026-02-12 21:28:06 +01:00
parent 31f765ff1b
commit 0adce69b3b
8 changed files with 152 additions and 242 deletions

View file

@ -59,32 +59,30 @@ npm:pkg
```
git:github.com/user/repo@v1
git:git@github.com:user/repo@v1
https://github.com/user/repo@v1
git@github.com:user/repo@v1
ssh://git@github.com/user/repo@v1
```
- Without `git:` prefix, only protocol URLs are accepted (`https://`, `http://`, `ssh://`, `git://`).
- With `git:` prefix, shorthand formats are accepted, including `github.com/user/repo` and `git@github.com:user/repo`.
- HTTPS and SSH URLs are both supported.
- SSH URLs use your configured SSH keys automatically (respects `~/.ssh/config`).
- For non-interactive runs (for example CI), you can set `GIT_TERMINAL_PROMPT=0` to disable credential prompts and set `GIT_SSH_COMMAND` (for example `ssh -o BatchMode=yes -o ConnectTimeout=5`) to fail fast.
- Raw `https://` URLs work without the `git:` prefix.
- Refs pin the package and skip `pi update`.
- Cloned to `~/.pi/agent/git/<host>/<path>` (global) or `.pi/git/<host>/<path>` (project).
- Runs `npm install` after clone or pull if `package.json` exists.
**SSH examples:**
```bash
# Standard git@host:path format
pi install git@github.com:user/repo
# With git: prefix
# git@host:path shorthand (requires git: prefix)
pi install git:git@github.com:user/repo
# ssh:// protocol format
pi install ssh://git@github.com/user/repo
# With version ref
pi install git@github.com:user/repo@v1.0.0
pi install git:git@github.com:user/repo@v1.0.0
```
### Local Paths