@freecodecamp/universe-cli 0.4.0 → 0.5.1
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 +69 -67
- package/dist/index.cjs +468 -48
- package/dist/index.js +476 -50
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Static site deployment for the freeCodeCamp Universe platform.
|
|
4
4
|
|
|
5
|
-
> v0.4 routes every deploy through the **artemis** proxy at
|
|
6
|
-
> `uploads.freecode.camp`. Staff hold only a `platform.yaml` and a
|
|
7
|
-
> GitHub identity — the proxy holds the R2 credentials. See
|
|
8
|
-
> [Universe ADR-016](https://github.com/freeCodeCamp-Universe/Universe/blob/main/decisions/016-deploy-proxy.md)
|
|
9
|
-
> for the full design.
|
|
10
|
-
|
|
11
5
|
## Install
|
|
12
6
|
|
|
13
7
|
### npm
|
|
@@ -23,30 +17,35 @@ universe <command>
|
|
|
23
17
|
|
|
24
18
|
### Binary
|
|
25
19
|
|
|
26
|
-
|
|
20
|
+
<details>
|
|
21
|
+
<summary>
|
|
22
|
+
Download the latest binary from [Releases](../../releases):
|
|
23
|
+
</summary>
|
|
27
24
|
|
|
28
25
|
```sh
|
|
29
|
-
# macOS (Apple Silicon)
|
|
30
|
-
gh release download --repo freeCodeCamp-Universe/universe-cli --pattern "universe-darwin-arm64"
|
|
31
|
-
chmod +x universe-darwin-arm64
|
|
32
|
-
sudo mv universe-darwin-arm64 /usr/local/bin/universe
|
|
33
|
-
|
|
34
|
-
# macOS (Intel)
|
|
35
|
-
gh release download --repo freeCodeCamp-Universe/universe-cli --pattern "universe-darwin-amd64"
|
|
36
|
-
chmod +x universe-darwin-amd64
|
|
37
|
-
sudo mv universe-darwin-amd64 /usr/local/bin/universe
|
|
38
|
-
|
|
39
|
-
# Linux x64
|
|
40
|
-
gh release download --repo freeCodeCamp-Universe/universe-cli --pattern "universe-linux-amd64"
|
|
41
|
-
chmod +x universe-linux-amd64
|
|
42
|
-
sudo mv universe-linux-amd64 /usr/local/bin/universe
|
|
43
|
-
|
|
44
|
-
# Linux ARM64
|
|
45
|
-
gh release download --repo freeCodeCamp-Universe/universe-cli --pattern "universe-linux-arm64"
|
|
46
|
-
chmod +x universe-linux-arm64
|
|
47
|
-
sudo mv universe-linux-arm64 /usr/local/bin/universe
|
|
26
|
+
# macOS (Apple Silicon)
|
|
27
|
+
gh release download --repo freeCodeCamp-Universe/universe-cli --pattern "universe-darwin-arm64"
|
|
28
|
+
chmod +x universe-darwin-arm64
|
|
29
|
+
sudo mv universe-darwin-arm64 /usr/local/bin/universe
|
|
30
|
+
|
|
31
|
+
# macOS (Intel)
|
|
32
|
+
gh release download --repo freeCodeCamp-Universe/universe-cli --pattern "universe-darwin-amd64"
|
|
33
|
+
chmod +x universe-darwin-amd64
|
|
34
|
+
sudo mv universe-darwin-amd64 /usr/local/bin/universe
|
|
35
|
+
|
|
36
|
+
# Linux x64
|
|
37
|
+
gh release download --repo freeCodeCamp-Universe/universe-cli --pattern "universe-linux-amd64"
|
|
38
|
+
chmod +x universe-linux-amd64
|
|
39
|
+
sudo mv universe-linux-amd64 /usr/local/bin/universe
|
|
40
|
+
|
|
41
|
+
# Linux ARM64
|
|
42
|
+
gh release download --repo freeCodeCamp-Universe/universe-cli --pattern "universe-linux-arm64"
|
|
43
|
+
chmod +x universe-linux-arm64
|
|
44
|
+
sudo mv universe-linux-arm64 /usr/local/bin/universe
|
|
48
45
|
```
|
|
49
46
|
|
|
47
|
+
</details>
|
|
48
|
+
|
|
50
49
|
Verify:
|
|
51
50
|
|
|
52
51
|
```sh
|
|
@@ -60,7 +59,7 @@ Top-level (cross-cutting):
|
|
|
60
59
|
```sh
|
|
61
60
|
universe login # GitHub OAuth device flow → ~/.config/universe-cli/token
|
|
62
61
|
universe logout # delete stored token
|
|
63
|
-
universe whoami # echo current login + authorized
|
|
62
|
+
universe whoami # echo current login + authorized-sites count
|
|
64
63
|
universe --version # CLI version
|
|
65
64
|
```
|
|
66
65
|
|
|
@@ -73,6 +72,15 @@ universe static rollback --to <deployId>
|
|
|
73
72
|
universe static ls [--site <site>]
|
|
74
73
|
```
|
|
75
74
|
|
|
75
|
+
Static-app registry (namespaced under `sites`, staff-gated writes):
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
universe sites ls [--mine] # list registered sites; `--mine` filters to your authorized set
|
|
79
|
+
universe sites register <slug> [--team=<name>...] # create new entry (staff; defaults --team to staff)
|
|
80
|
+
universe sites update <slug> --team=<name>... # replace teams list (staff)
|
|
81
|
+
universe sites rm <slug> # delete entry (staff; R2 deploy bytes untouched)
|
|
82
|
+
```
|
|
83
|
+
|
|
76
84
|
All commands support `--json` for CI integration.
|
|
77
85
|
|
|
78
86
|
## Identity (priority chain)
|
|
@@ -80,14 +88,12 @@ All commands support `--json` for CI integration.
|
|
|
80
88
|
The CLI resolves a GitHub identity in this order — first match wins:
|
|
81
89
|
|
|
82
90
|
1. `$GITHUB_TOKEN` / `$GH_TOKEN` env (CI explicit)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
91
|
+
1. `gh auth token` shell-out (laptop with `gh` installed)
|
|
92
|
+
1. Device-flow stored token at `~/.config/universe-cli/token`
|
|
93
|
+
|
|
94
|
+
GHA OIDC and Woodpecker OIDC slots were dropped in v0.4: artemis validates bearers via GitHub `GET /user`, which only accepts user-scoped tokens. CI runners must export `$GITHUB_TOKEN` explicitly. The slots will return once artemis grows an OIDC verifier.
|
|
87
95
|
|
|
88
|
-
The proxy validates whatever it receives via GitHub `GET /user`, then
|
|
89
|
-
authorizes against the `sites.yaml` map server-side. Run
|
|
90
|
-
`universe whoami` to see which slot resolved.
|
|
96
|
+
The proxy validates whatever it receives via GitHub `GET /user`, then authorizes against the registry server-side (Valkey-backed; the `sites_yaml` backend was retired in artemis `f115198`). Run `universe whoami` to see which slot resolved; inspect the sites you can deploy to with `universe sites ls --mine`.
|
|
91
97
|
|
|
92
98
|
## Configuration (`platform.yaml`)
|
|
93
99
|
|
|
@@ -97,37 +103,51 @@ Every site has a `platform.yaml` at its repo root. Minimal valid file:
|
|
|
97
103
|
site: my-site
|
|
98
104
|
```
|
|
99
105
|
|
|
100
|
-
Full reference (every field, defaults, validation rules
|
|
101
|
-
migration): [`docs/platform-yaml.md`](docs/platform-yaml.md).
|
|
106
|
+
Full schema reference (every field, defaults, validation rules): [`docs/platform-yaml.md`](docs/platform-yaml.md).
|
|
102
107
|
|
|
103
|
-
No credential fields. The proxy holds the R2 admin key; the CLI never
|
|
104
|
-
reads or writes one.
|
|
108
|
+
No credential fields. The proxy holds the R2 admin key; the CLI never reads or writes one.
|
|
105
109
|
|
|
106
110
|
## Common flows
|
|
107
111
|
|
|
112
|
+
Staff onboarding + deploy lifecycle:
|
|
113
|
+
|
|
108
114
|
```sh
|
|
109
115
|
# 1. Authenticate (laptop, first time)
|
|
110
116
|
universe login
|
|
111
117
|
|
|
112
|
-
# 2.
|
|
113
|
-
universe static deploy
|
|
114
|
-
|
|
115
|
-
# 3. Inspect identity + authorized sites
|
|
118
|
+
# 2. Identity + how many sites you can deploy to
|
|
116
119
|
universe whoami
|
|
117
120
|
|
|
118
|
-
#
|
|
121
|
+
# 3. List your authorized sites (intersects registry with your GH teams)
|
|
122
|
+
universe sites ls --mine
|
|
123
|
+
|
|
124
|
+
# 4. From your site repo: deploy to preview (reads ./platform.yaml)
|
|
125
|
+
universe static deploy
|
|
126
|
+
|
|
127
|
+
# 5. Inspect recent deploys for the current site
|
|
119
128
|
universe static ls
|
|
120
129
|
|
|
121
|
-
#
|
|
130
|
+
# 6. Promote preview to production
|
|
122
131
|
universe static promote
|
|
123
132
|
|
|
124
|
-
#
|
|
133
|
+
# 7. Roll production back to a past deploy
|
|
125
134
|
universe static rollback --to 20260427-141522-abc1234
|
|
126
135
|
```
|
|
127
136
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
137
|
+
Registry admin (staff team only — gated server-side by artemis's `REGISTRY_AUTHZ_TEAM`, default `staff`):
|
|
138
|
+
|
|
139
|
+
```sh
|
|
140
|
+
# Register a new site (defaults --team to staff)
|
|
141
|
+
universe sites register hello-universe --team bots,staff
|
|
142
|
+
|
|
143
|
+
# Add or replace the teams list on an existing site
|
|
144
|
+
universe sites update hello-universe --team bots,staff,curriculum
|
|
145
|
+
|
|
146
|
+
# Delete a site from the registry (R2 bytes age out via cleanup cron)
|
|
147
|
+
universe sites rm hello-universe
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
CI (GitHub Actions) — pass `$GITHUB_TOKEN` explicitly (slot 1). The OIDC slot will return once artemis grows an OIDC verifier. Full operator walkthrough: [`docs/STAFF-GUIDE.md`](docs/STAFF-GUIDE.md).
|
|
131
151
|
|
|
132
152
|
## Environment overrides
|
|
133
153
|
|
|
@@ -137,22 +157,4 @@ explicitly.
|
|
|
137
157
|
| `UNIVERSE_GH_CLIENT_ID` | _baked-in freeCodeCamp OAuth id_ | Override GitHub OAuth App id (fork tenants, `login` only) |
|
|
138
158
|
| `GITHUB_TOKEN` / `GH_TOKEN` | — | Slot 1 of identity chain |
|
|
139
159
|
|
|
140
|
-
The shipped binary embeds the `freeCodeCamp` GitHub OAuth App client id
|
|
141
|
-
(public; device flow uses no `client_secret`), so `universe login` works
|
|
142
|
-
out of the box for staff. Fork operators and self-hosted mirror tenants
|
|
143
|
-
set `UNIVERSE_GH_CLIENT_ID` to their own OAuth App's id — env value
|
|
144
|
-
wins when set.
|
|
145
|
-
|
|
146
|
-
## Development
|
|
147
|
-
|
|
148
|
-
```sh
|
|
149
|
-
pnpm install
|
|
150
|
-
pnpm test # vitest
|
|
151
|
-
pnpm typecheck # tsc --noEmit
|
|
152
|
-
pnpm lint # oxlint
|
|
153
|
-
pnpm build # tsup → dist/
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
## Releasing
|
|
157
|
-
|
|
158
|
-
See [docs/RELEASING.md](docs/RELEASING.md).
|
|
160
|
+
The shipped binary embeds the `freeCodeCamp` GitHub OAuth App client id (public; device flow uses no `client_secret`), so `universe login` works out of the box for staff. Fork operators and self-hosted mirror tenants set `UNIVERSE_GH_CLIENT_ID` to their own OAuth App's id — env value wins when set.
|