← back to Cli Printing Press
fix(templates): guard readme.md.tmpl against empty Auth.EnvVars
2370b45b4d2a18d1ca722109df2669763bfa02c0 · 2026-03-24 23:56:48 -0700 · Matt Van Horn
APIs with no auth (Fly.io, Telegram) crashed on index .Auth.EnvVars 0.
Add conditional guards around all EnvVars index operations.
Gauntlet re-verified: 10/10 pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Files touched
M internal/generator/templates/readme.md.tmpl
Diff
commit 2370b45b4d2a18d1ca722109df2669763bfa02c0
Author: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Date: Tue Mar 24 23:56:48 2026 -0700
fix(templates): guard readme.md.tmpl against empty Auth.EnvVars
APIs with no auth (Fly.io, Telegram) crashed on index .Auth.EnvVars 0.
Add conditional guards around all EnvVars index operations.
Gauntlet re-verified: 10/10 pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---
internal/generator/templates/readme.md.tmpl | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/internal/generator/templates/readme.md.tmpl b/internal/generator/templates/readme.md.tmpl
index 33df4181..5df1c7c1 100644
--- a/internal/generator/templates/readme.md.tmpl
+++ b/internal/generator/templates/readme.md.tmpl
@@ -23,10 +23,12 @@ Download from [Releases](https://github.com/{{.Owner}}/{{.Name}}-cli/releases).
## Quick Start
```bash
+{{- if .Auth.EnvVars}}
# 1. Set your API credentials
export {{index .Auth.EnvVars 0}}="your-key-here"
+{{- end}}
-# 2. Verify everything works
+# {{if .Auth.EnvVars}}2{{else}}1{{end}}. Verify everything works
{{.Name}}-cli doctor
# 3. Start using it
@@ -107,7 +109,9 @@ Environment variables:
**Authentication errors (exit code 4)**
- Run `{{.Name}}-cli doctor` to check credentials
+{{- if .Auth.EnvVars}}
- Verify the environment variable is set: `echo ${{index .Auth.EnvVars 0}}`
+{{- end}}
**Not found errors (exit code 3)**
- Check the resource ID is correct
← 780c6b51 feat(templates): add --select flag, error hints, README rewr
·
back to Cli Printing Press
·
test: add coverage for research, dogfood, comparative, textf 02d022fe →