@freecodecamp/universe-cli 0.4.0 → 0.5.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 +71 -55
- package/dist/index.cjs +450 -35
- package/dist/index.js +458 -37
- package/package.json +2 -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,29 +17,34 @@ 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
|
-
```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
|
|
48
|
-
```
|
|
25
|
+
```sh
|
|
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
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
</details>
|
|
49
48
|
|
|
50
49
|
Verify:
|
|
51
50
|
|
|
@@ -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)
|
|
@@ -86,8 +94,10 @@ The CLI resolves a GitHub identity in this order — first match wins:
|
|
|
86
94
|
5. Device-flow stored token at `~/.config/universe-cli/token`
|
|
87
95
|
|
|
88
96
|
The proxy validates whatever it receives via GitHub `GET /user`, then
|
|
89
|
-
authorizes against the
|
|
90
|
-
`
|
|
97
|
+
authorizes against the registry server-side (Valkey-backed; the
|
|
98
|
+
`sites_yaml` backend was retired in artemis `f115198`). Run
|
|
99
|
+
`universe whoami` to see which slot resolved; inspect the sites you
|
|
100
|
+
can deploy to with `universe sites ls --mine`.
|
|
91
101
|
|
|
92
102
|
## Configuration (`platform.yaml`)
|
|
93
103
|
|
|
@@ -97,37 +107,57 @@ Every site has a `platform.yaml` at its repo root. Minimal valid file:
|
|
|
97
107
|
site: my-site
|
|
98
108
|
```
|
|
99
109
|
|
|
100
|
-
Full reference (every field, defaults, validation rules
|
|
101
|
-
|
|
110
|
+
Full schema reference (every field, defaults, validation rules):
|
|
111
|
+
[`docs/platform-yaml.md`](docs/platform-yaml.md).
|
|
102
112
|
|
|
103
113
|
No credential fields. The proxy holds the R2 admin key; the CLI never
|
|
104
114
|
reads or writes one.
|
|
105
115
|
|
|
106
116
|
## Common flows
|
|
107
117
|
|
|
118
|
+
Staff onboarding + deploy lifecycle:
|
|
119
|
+
|
|
108
120
|
```sh
|
|
109
121
|
# 1. Authenticate (laptop, first time)
|
|
110
122
|
universe login
|
|
111
123
|
|
|
112
|
-
# 2.
|
|
113
|
-
universe static deploy
|
|
114
|
-
|
|
115
|
-
# 3. Inspect identity + authorized sites
|
|
124
|
+
# 2. Identity + how many sites you can deploy to
|
|
116
125
|
universe whoami
|
|
117
126
|
|
|
118
|
-
#
|
|
127
|
+
# 3. List your authorized sites (intersects registry with your GH teams)
|
|
128
|
+
universe sites ls --mine
|
|
129
|
+
|
|
130
|
+
# 4. From your site repo: deploy to preview (reads ./platform.yaml)
|
|
131
|
+
universe static deploy
|
|
132
|
+
|
|
133
|
+
# 5. Inspect recent deploys for the current site
|
|
119
134
|
universe static ls
|
|
120
135
|
|
|
121
|
-
#
|
|
136
|
+
# 6. Promote preview to production
|
|
122
137
|
universe static promote
|
|
123
138
|
|
|
124
|
-
#
|
|
139
|
+
# 7. Roll production back to a past deploy
|
|
125
140
|
universe static rollback --to 20260427-141522-abc1234
|
|
126
141
|
```
|
|
127
142
|
|
|
143
|
+
Registry admin (staff team only — gated server-side by artemis's
|
|
144
|
+
`REGISTRY_AUTHZ_TEAM`, default `staff`):
|
|
145
|
+
|
|
146
|
+
```sh
|
|
147
|
+
# Register a new site (defaults --team to staff)
|
|
148
|
+
universe sites register hello-universe --team bots,staff
|
|
149
|
+
|
|
150
|
+
# Add or replace the teams list on an existing site
|
|
151
|
+
universe sites update hello-universe --team bots,staff,curriculum
|
|
152
|
+
|
|
153
|
+
# Delete a site from the registry (R2 bytes age out via cleanup cron)
|
|
154
|
+
universe sites rm hello-universe
|
|
155
|
+
```
|
|
156
|
+
|
|
128
157
|
CI (GitHub Actions) — set `permissions: id-token: write` and rely on
|
|
129
158
|
slot 2 (GHA OIDC) of the identity chain, or pass `$GITHUB_TOKEN`
|
|
130
|
-
explicitly.
|
|
159
|
+
explicitly. Full operator walkthrough:
|
|
160
|
+
[`docs/STAFF-GUIDE.md`](docs/STAFF-GUIDE.md).
|
|
131
161
|
|
|
132
162
|
## Environment overrides
|
|
133
163
|
|
|
@@ -142,17 +172,3 @@ The shipped binary embeds the `freeCodeCamp` GitHub OAuth App client id
|
|
|
142
172
|
out of the box for staff. Fork operators and self-hosted mirror tenants
|
|
143
173
|
set `UNIVERSE_GH_CLIENT_ID` to their own OAuth App's id — env value
|
|
144
174
|
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).
|