@openhoo/hoopilot 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -16
- package/dist/cli.js +533 -47
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +21 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +21 -33
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -7,19 +7,79 @@ OpenAI-compatible local proxy for GitHub Copilot accounts. It runs on Bun and ex
|
|
|
7
7
|
|
|
8
8
|
This project uses GitHub Copilot's service endpoints and is not an official GitHub product. The upstream API can change without notice. Use it only with accounts and usage patterns you are allowed to use.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
### npm (recommended when the registry is reachable)
|
|
11
13
|
|
|
12
14
|
```sh
|
|
13
15
|
npx @openhoo/hoopilot
|
|
14
16
|
```
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
Or install it globally:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm install -g @openhoo/hoopilot
|
|
22
|
+
# or
|
|
23
|
+
bun add -g @openhoo/hoopilot
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Standalone binary (no npm, no runtime required)
|
|
27
|
+
|
|
28
|
+
When the npm registry is unreachable but GitHub is, install a prebuilt,
|
|
29
|
+
self-contained binary straight from the latest GitHub release. No Node.js or Bun
|
|
30
|
+
is needed to run it.
|
|
31
|
+
|
|
32
|
+
Linux / macOS:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
curl -fsSL https://raw.githubusercontent.com/openhoo/hoopilot/main/scripts/install.sh | sh
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Windows (PowerShell):
|
|
39
|
+
|
|
40
|
+
```powershell
|
|
41
|
+
irm https://raw.githubusercontent.com/openhoo/hoopilot/main/scripts/install.ps1 | iex
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The installer detects your OS, CPU architecture (x64/arm64), and libc (glibc or
|
|
45
|
+
musl), downloads the matching binary, verifies its SHA-256 checksum, and installs
|
|
46
|
+
it to `~/.local/bin` (Linux/macOS) or `%LOCALAPPDATA%\Programs\hoopilot`
|
|
47
|
+
(Windows). Override the location with `HOOPILOT_INSTALL_DIR`, or pin a version:
|
|
17
48
|
|
|
18
49
|
```sh
|
|
19
|
-
|
|
50
|
+
curl -fsSL .../install.sh | sh -s -- --version 0.2.5 --dir ~/bin
|
|
20
51
|
```
|
|
21
52
|
|
|
22
|
-
|
|
53
|
+
```powershell
|
|
54
|
+
& ([scriptblock]::Create((irm .../install.ps1))) -Version 0.2.5
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Prebuilt binaries are available for Linux (x64/arm64, glibc and musl), macOS
|
|
58
|
+
(Intel/Apple Silicon), and Windows (x64/arm64).
|
|
59
|
+
|
|
60
|
+
## Update
|
|
61
|
+
|
|
62
|
+
Standalone binaries update themselves in place from the latest GitHub release
|
|
63
|
+
(checksum-verified):
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
hoopilot update
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
npm installs report when a newer version is available and print the right command
|
|
70
|
+
(`npm install -g @openhoo/hoopilot@latest`). Either way, Hoopilot checks GitHub at
|
|
71
|
+
most once a day in the background and prints a one-line notice to stderr when an
|
|
72
|
+
update exists. Disable the check with `--no-update-check`, or by setting
|
|
73
|
+
`HOOPILOT_NO_UPDATE_CHECK` / `NO_UPDATE_NOTIFIER`; it is also skipped in CI and
|
|
74
|
+
when output is not a terminal.
|
|
75
|
+
|
|
76
|
+
## Run
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
npx @openhoo/hoopilot
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
By default Hoopilot listens on `127.0.0.1:4141`, uses `COPILOT_API_TOKEN` when provided, otherwise reads a GitHub CLI OAuth token from `COPILOT_GITHUB_TOKEN` or `gh auth token`, and uses that token with Copilot.
|
|
23
83
|
|
|
24
84
|
For a local API key:
|
|
25
85
|
|
|
@@ -61,15 +121,11 @@ or:
|
|
|
61
121
|
COPILOT_GITHUB_TOKEN=$(gh auth token) npx @openhoo/hoopilot
|
|
62
122
|
```
|
|
63
123
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
```sh
|
|
67
|
-
COPILOT_GITHUB_TOKEN=github_pat_... HOOPILOT_API_KEY=local-key npx @openhoo/hoopilot
|
|
68
|
-
```
|
|
124
|
+
Personal access tokens are not supported by GitHub Copilot's token exchange or chat endpoints. Hoopilot rejects classic and fine-grained PAT prefixes. Use `gh auth token` for the GitHub CLI OAuth path, or pass a short-lived Copilot bearer token with `COPILOT_API_TOKEN`.
|
|
69
125
|
|
|
70
126
|
Supported credential environment variables:
|
|
71
127
|
|
|
72
|
-
- `COPILOT_GITHUB_TOKEN
|
|
128
|
+
- `COPILOT_GITHUB_TOKEN` or `GITHUB_COPILOT_GITHUB_TOKEN`: GitHub CLI OAuth token for an account with Copilot access. Personal access tokens are rejected.
|
|
73
129
|
- `COPILOT_API_TOKEN`, `GITHUB_COPILOT_API_TOKEN`, or `GITHUB_COPILOT_TOKEN`: short-lived Copilot API bearer token.
|
|
74
130
|
- `COPILOT_API_BASE_URL`: upstream Copilot API base URL override.
|
|
75
131
|
- `COPILOT_TOKEN_EXCHANGE_URL`: GitHub token exchange endpoint override.
|
|
@@ -78,12 +134,10 @@ Auth modes:
|
|
|
78
134
|
|
|
79
135
|
```sh
|
|
80
136
|
npx @openhoo/hoopilot --auth-mode auto
|
|
81
|
-
npx @openhoo/hoopilot --auth-mode github-token
|
|
82
|
-
npx @openhoo/hoopilot --auth-mode direct-github-token
|
|
83
137
|
npx @openhoo/hoopilot --auth-mode copilot-token
|
|
84
138
|
```
|
|
85
139
|
|
|
86
|
-
`auto`
|
|
140
|
+
`auto` uses a direct Copilot token when one is configured, otherwise it uses GitHub's Copilot token exchange endpoint and falls back to the GitHub CLI OAuth token when the exchange endpoint is unavailable.
|
|
87
141
|
|
|
88
142
|
## CLI
|
|
89
143
|
|
|
@@ -97,8 +151,8 @@ Options:
|
|
|
97
151
|
-p, --port <port> Port to listen on. Default: 4141
|
|
98
152
|
--host <host> Host to listen on. Default: 127.0.0.1
|
|
99
153
|
--api-key <key> Require clients to send Authorization: Bearer <key>
|
|
100
|
-
--auth-mode <mode> auto,
|
|
101
|
-
--github-token <token> GitHub OAuth token for a Copilot account
|
|
154
|
+
--auth-mode <mode> auto, copilot-token
|
|
155
|
+
--github-token <token> GitHub CLI OAuth token for a Copilot account. PATs are rejected.
|
|
102
156
|
--github-token-command <cmd> Command used to read a GitHub token. Default: gh auth token
|
|
103
157
|
--copilot-token <token> Short-lived Copilot API bearer token
|
|
104
158
|
--copilot-api-base-url <url> Copilot API base URL override
|
|
@@ -135,7 +189,7 @@ bun run biome:fix
|
|
|
135
189
|
|
|
136
190
|
## Release
|
|
137
191
|
|
|
138
|
-
Commits merged to `main` are evaluated by hooversion after CI passes. When a release is produced, the release workflow creates the release commit, tag, and GitHub release automatically,
|
|
192
|
+
Commits merged to `main` are evaluated by hooversion after CI passes. When a release is produced, the release workflow creates the release commit, tag, and GitHub release automatically, publishes the package through npm trusted publishing, then cross-compiles standalone binaries for every supported platform (`scripts/build-binaries.sh`) and attaches them — plus a `SHA256SUMS` manifest — to the GitHub release. Build all binaries locally with `bun run build:binaries`.
|
|
139
193
|
|
|
140
194
|
Configure npm trusted publishing for `@openhoo/hoopilot` on npmjs.com before relying on automatic publication. The workflow uses GitHub Actions OIDC with `npm publish --access public --provenance`.
|
|
141
195
|
|