You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(cli): chain mat setup into repo config, add native Windows support
mat setup now configures the GitHub repository too (via a devenv shell
invocation so terraform/gh resolve on PATH), instead of silently stopping
short of it. Declining Nix falls back to a direct Terraform install rather
than skipping repo config entirely.
Adds bin/mat.ps1 for native Windows: offers WSL2 setup for full parity, or a
winget-based Terraform-only fallback if declined.
Also fixes stale ./setup-project.sh references in README/CONTRIBUTING/docs
left over from when bin/mat replaced it.
4. Run `./setup-project.sh` — activates the Git hooks (validates commit messages locally before you push) and creates `.env` from `.env.example`. See [docs/team-process/how-to/activate-git-hooks](docs/team-process/how-to/activate-git-hooks.md) for what the hooks do.
40
+
4. Run `./bin/mat setup` (native Windows without WSL2: `.\bin\mat.ps1`) — activates the Git hooks (validates commit messages locally before you push), creates `.env` from `.env.example`, and sets up the reproducible dev shell (Nix/direnv/devenv). See [docs/team-process/how-to/activate-git-hooks](docs/team-process/how-to/activate-git-hooks.md) for what the hooks do.
41
41
5. Follow the full setup guide: [docs/product-code/tutorials/getting-started](docs/product-code/tutorials/getting-started.md)
On native Windows (no WSL2), run `.\bin\mat.ps1` instead.
46
+
45
47
Full setup guide (prerequisites, dependency install, dev server): [docs/product-code/tutorials/getting-started](docs/product-code/tutorials/getting-started.md).
warn "Nix is not installed. It's required for the reproducible dev shell (direnv + devenv)."
44
44
if! confirm "Install Nix now via the Determinate Systems installer?";then
45
-
warn "Skipping Nix. Git hooks and .env will still be set up below, but the dev shell (mat/terraform/etc.) won't be available until you install Nix and re-run 'mat setup'."
45
+
warn "Skipping Nix — falling back to a direct Terraform install instead."
46
46
return 1
47
47
fi
48
48
49
49
info "Installing Nix (this will prompt for your password)..."
warn "terraform and/or gh are missing. Run 'mat setup' first, then re-run this from inside the dev shell."
218
+
# gh is optional — terraform/setup.sh falls back to an interactive token
219
+
# prompt when it's missing or not logged in.
220
+
if!command -v terraform >/dev/null 2>&1;then
221
+
warn "terraform is missing. Run 'mat setup' first."
153
222
exit 1
154
223
fi
155
224
@@ -183,7 +252,7 @@ cmd_setup() {
183
252
local os
184
253
os="$(detect_os)"
185
254
if [ "$os"="unsupported" ];then
186
-
warn "Unrecognized OS. Nix/devenv support macOS and Linux (including WSL2) — on native Windows, install WSL2 first and run 'mat setup' from inside it."
255
+
warn "Unrecognized OS. On native Windows, use bin/mat.ps1 instead (it offers WSL2, or a no-Nix Terraform-only fallback)."
187
256
fi
188
257
189
258
info "Git hooks and .env (no Nix required for these)"
@@ -197,7 +266,24 @@ cmd_setup() {
197
266
ensure_devenv ||true
198
267
ifcommand -v direnv >/dev/null 2>&1;then
199
268
direnv allow "$REPO_ROOT"
200
-
ok "Ran 'direnv allow' — cd out and back into this directory to enter the dev shell."
269
+
ok "Ran 'direnv allow'."
270
+
fi
271
+
272
+
echo
273
+
info "Configuring the GitHub repository (inside the devenv shell)"
274
+
ifcommand -v devenv >/dev/null 2>&1;then
275
+
# terraform/gh only exist on PATH inside the devenv shell (declared in
276
+
# devenv.nix's packages) — a bare 'terraform' call here would fail even
277
+
# though nix/direnv/devenv are all now installed.
278
+
devenv shell -- ./bin/mat repo
279
+
else
280
+
warn "devenv isn't available — skipping repo config. Re-run 'mat setup' once it is, or run 'mat repo' yourself from inside the dev shell."
281
+
fi
282
+
else
283
+
echo
284
+
info "Falling back to a direct Terraform install (no reproducible dev shell)"
285
+
if ensure_terraform_direct;then
286
+
cmd_repo
201
287
fi
202
288
fi
203
289
@@ -211,13 +297,18 @@ usage() {
211
297
Usage: mat <command>
212
298
213
299
Commands:
214
-
setup Full local onboarding: Nix, direnv, devenv, Git hooks, .env
300
+
setup Full local onboarding: Nix, direnv, devenv, Git hooks, .env,
301
+
then configures the GitHub repository via terraform (or a
302
+
direct Terraform install if you skip Nix)
215
303
repo Configure the GitHub repository via terraform (branch
0 commit comments