mirror of
https://github.com/mattpocock/skills.git
synced 2026-09-13 02:48:06 +07:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb7db0eeb6 | ||
|
|
c0fd1e973e |
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"mattpocock-skills": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
wizard: remove the time estimate. The template drops `TOTAL_MINUTES` and the time-remaining display, `stage` takes a name only, and progress is counted in stages.
|
||||||
@@ -25,7 +25,7 @@ None to generate one. The wizard it writes runs on bash, and uses `gh` when a st
|
|||||||
|
|
||||||
## Stages
|
## Stages
|
||||||
|
|
||||||
A **stage** is one focused task on one screen. The script clears the terminal between stages, so a stage that overflows the screen loses the part that scrolled away. You author stages in dependency order and set `TOTAL_STAGES` and `TOTAL_MINUTES`, which drive the time-remaining display — make the estimate honest, because the person running it will hold you to it.
|
A **stage** is one focused task on one screen. The script clears the terminal between stages, so a stage that overflows the screen loses the part that scrolled away. You author stages in dependency order and set `TOTAL_STAGES`, which drives the progress display.
|
||||||
|
|
||||||
Scoping happens before a line is written. The [skill](https://www.aihero.dev/ai-coding-dictionary/skill) reads the repo instead of asking cold: `.env*`, `docker-compose*`, framework config, and every `secrets.*` / `vars.*` reference in `.github/workflows/` — each of those is a value the wizard has to produce. It then shows you the ordered stage list to confirm, and only after that maps each stage to the exact path a human follows ("Dashboard → Developers → API keys → Reveal test key → copy"). Where it doesn't know the current UI, it asks you or checks the docs rather than inventing clicks.
|
Scoping happens before a line is written. The [skill](https://www.aihero.dev/ai-coding-dictionary/skill) reads the repo instead of asking cold: `.env*`, `docker-compose*`, framework config, and every `secrets.*` / `vars.*` reference in `.github/workflows/` — each of those is a value the wizard has to produce. It then shows you the ordered stage list to confirm, and only after that maps each stage to the exact path a human follows ("Dashboard → Developers → API keys → Reveal test key → copy"). Where it doesn't know the current UI, it asks you or checks the docs rather than inventing clicks.
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ description: Generate an interactive bash wizard that walks a human through step
|
|||||||
|
|
||||||
# Wizard
|
# Wizard
|
||||||
|
|
||||||
A **wizard** is a bash script that walks a human, step by step, through a manual procedure that's tedious to do by hand and tedious to re-explain to an AI every time. It opens each URL, says exactly what to click and copy, captures the values, writes them where they belong (`.env`, GitHub secrets), confirms at every stage, and shows how much is left. It might configure third-party services, run a one-off migration, or move the project from one state to another.
|
A **wizard** is a bash script that walks a human, step by step, through a manual procedure that's tedious to do by hand and tedious to re-explain to an AI every time. It opens each URL, says exactly what to click and copy, captures the values, writes them where they belong (`.env`, GitHub secrets), confirms at every stage, and shows how many stages are left. It might configure third-party services, run a one-off migration, or move the project from one state to another.
|
||||||
|
|
||||||
The delightful UX is already solved by [template.sh](template.sh) — progress with time-remaining, confirmation gates, cross-platform URL opening (including WSL), hidden secret entry, idempotent `.env` upserts, `gh secret`/`gh variable` writes, and a closing summary. **Your job is only to scope the procedure and author its stages.** The library above the `STAGES` marker is identical in every wizard; that consistency is the point — never hand-edit it.
|
The delightful UX is already solved by [template.sh](template.sh) — stage-by-stage progress, confirmation gates, cross-platform URL opening (including WSL), hidden secret entry, idempotent `.env` upserts, `gh secret`/`gh variable` writes, and a closing summary. **Your job is only to scope the procedure and author its stages.** The library above the `STAGES` marker is identical in every wizard; that consistency is the point — never hand-edit it.
|
||||||
|
|
||||||
A wizard is ephemeral by default — built for one run, saved to a scratch or `scripts/` path, deleted when the job's done. Commit it only when the user wants a repeatable setup path that should live in the repo.
|
A wizard is ephemeral by default — built for one run, saved to a scratch or `scripts/` path, deleted when the job's done. Commit it only when the user wants a repeatable setup path that should live in the repo.
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ For each stage, write the precise path a human follows: which URL to open, what
|
|||||||
|
|
||||||
### 3. Author the wizard
|
### 3. Author the wizard
|
||||||
|
|
||||||
Copy `template.sh` to the target path. Replace the example stage with one `stage` per step, in dependency order. Use the library helpers — `stage`, `say`/`step`, `open_url`, `ask`/`ask_secret`, `write_env`, `set_secret`/`set_var`, `pause`/`confirm` — and set `TOTAL_STAGES` and `TOTAL_MINUTES` to honest estimates (this drives the time-remaining display).
|
Copy `template.sh` to the target path. Replace the example stage with one `stage` per step, in dependency order. Use the library helpers — `stage`, `say`/`step`, `open_url`, `ask`/`ask_secret`, `write_env`, `set_secret`/`set_var`, `pause`/`confirm` — and set `TOTAL_STAGES` to the number of stages you wrote.
|
||||||
|
|
||||||
Hold the bar the template sets: open the URL before asking for its value, use `ask_secret` for anything secret, `write_env` every persisted value, `set_secret` only the values CI actually needs, and `confirm` before any irreversible action. Each `stage` clears the screen so only the current step is visible — keep a stage to one focused task so nothing the human needs scrolls away. Don't touch the library above the marker.
|
Hold the bar the template sets: open the URL before asking for its value, use `ask_secret` for anything secret, `write_env` every persisted value, `set_secret` only the values CI actually needs, and `confirm` before any irreversible action. Each `stage` clears the screen so only the current step is visible — keep a stage to one focused task so nothing the human needs scrolls away. Don't touch the library above the marker.
|
||||||
|
|
||||||
|
|||||||
@@ -19,12 +19,10 @@ else
|
|||||||
BOLD=""; DIM=""; RESET=""; BLUE=""; GREEN=""; YELLOW=""; RED=""
|
BOLD=""; DIM=""; RESET=""; BLUE=""; GREEN=""; YELLOW=""; RED=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Author sets these two at the top of the stages section.
|
# Author sets this at the top of the stages section.
|
||||||
TOTAL_STAGES=0
|
TOTAL_STAGES=0
|
||||||
TOTAL_MINUTES=0
|
|
||||||
|
|
||||||
_STAGE_INDEX=0
|
_STAGE_INDEX=0
|
||||||
_MINUTES_ELAPSED=0
|
|
||||||
ENV_FILE="${ENV_FILE:-.env}"
|
ENV_FILE="${ENV_FILE:-.env}"
|
||||||
WRITTEN_ENV=() # KEYs written to ENV_FILE this run
|
WRITTEN_ENV=() # KEYs written to ENV_FILE this run
|
||||||
WRITTEN_SECRET=() # secret NAMEs set this run
|
WRITTEN_SECRET=() # secret NAMEs set this run
|
||||||
@@ -37,28 +35,24 @@ _clear() {
|
|||||||
if command -v tput >/dev/null 2>&1; then tput clear; else printf '\033[2J\033[3J\033[H'; fi
|
if command -v tput >/dev/null 2>&1; then tput clear; else printf '\033[2J\033[3J\033[H'; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# banner "Title" — opening frame: what this wizard does and how long it takes.
|
# banner "Title" — opening frame: what this wizard does.
|
||||||
banner() {
|
banner() {
|
||||||
_clear
|
_clear
|
||||||
printf '\n%s%s %s%s\n' "$BOLD" "$BLUE" "$1" "$RESET"
|
printf '\n%s%s %s%s\n' "$BOLD" "$BLUE" "$1" "$RESET"
|
||||||
printf '%s %s stages · about %s minutes%s\n\n' \
|
printf '%s %s stages%s\n\n' "$DIM" "$TOTAL_STAGES" "$RESET"
|
||||||
"$DIM" "$TOTAL_STAGES" "$TOTAL_MINUTES" "$RESET"
|
|
||||||
printf '%s You drive the browser; this wizard tells you exactly what to do and\n' "$DIM"
|
printf '%s You drive the browser; this wizard tells you exactly what to do and\n' "$DIM"
|
||||||
printf ' captures the values you copy back. Stop any time with Ctrl-C and re-run\n'
|
printf ' captures the values you copy back. Stop any time with Ctrl-C and re-run\n'
|
||||||
printf ' later — it remembers values already saved.%s\n' "$RESET"
|
printf ' later — it remembers values already saved.%s\n' "$RESET"
|
||||||
pause "Ready to start?"
|
pause "Ready to start?"
|
||||||
}
|
}
|
||||||
|
|
||||||
# stage "Name" <minutes> — clear the screen, then announce a stage and show
|
# stage "Name" — clear the screen, then announce a stage and show progress.
|
||||||
# progress + time remaining. Clearing keeps only the current step on screen.
|
# Clearing keeps only the current step on screen.
|
||||||
stage() {
|
stage() {
|
||||||
_clear
|
_clear
|
||||||
_STAGE_INDEX=$((_STAGE_INDEX + 1))
|
_STAGE_INDEX=$((_STAGE_INDEX + 1))
|
||||||
local remaining=$((TOTAL_MINUTES - _MINUTES_ELAPSED))
|
printf '\n%s%s▸ Stage %s/%s · %s%s\n' \
|
||||||
(( remaining < 0 )) && remaining=0
|
"$BOLD" "$BLUE" "$_STAGE_INDEX" "$TOTAL_STAGES" "$1" "$RESET"
|
||||||
_MINUTES_ELAPSED=$((_MINUTES_ELAPSED + ${2:-0}))
|
|
||||||
printf '\n%s%s▸ Stage %s/%s · %s%s %s(~%s min left)%s\n' \
|
|
||||||
"$BOLD" "$BLUE" "$_STAGE_INDEX" "$TOTAL_STAGES" "$1" "$RESET" "$DIM" "$remaining" "$RESET"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# say "..." — a plain instruction line.
|
# say "..." — a plain instruction line.
|
||||||
@@ -187,16 +181,15 @@ finish() {
|
|||||||
|
|
||||||
# ──────────────────────────────────────────────────────────────────────────
|
# ──────────────────────────────────────────────────────────────────────────
|
||||||
# STAGES — author this section. One stage() per step the human takes.
|
# STAGES — author this section. One stage() per step the human takes.
|
||||||
# Replace the example below. Set the two totals to match the stages you write.
|
# Replace the example below. Set TOTAL_STAGES to match the stages you write.
|
||||||
# ──────────────────────────────────────────────────────────────────────────
|
# ──────────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
TOTAL_STAGES=1
|
TOTAL_STAGES=1
|
||||||
TOTAL_MINUTES=5
|
|
||||||
|
|
||||||
banner "Stripe setup"
|
banner "Stripe setup"
|
||||||
|
|
||||||
# ── Example stage: replace with your real steps ───────────────────────────
|
# ── Example stage: replace with your real steps ───────────────────────────
|
||||||
stage "Stripe — API keys" 5
|
stage "Stripe — API keys"
|
||||||
say "We'll grab your Stripe test keys and store them for local dev + CI."
|
say "We'll grab your Stripe test keys and store them for local dev + CI."
|
||||||
open_url "https://dashboard.stripe.com/test/apikeys"
|
open_url "https://dashboard.stripe.com/test/apikeys"
|
||||||
step "On the API keys page, copy the Publishable key (starts pk_test_)."
|
step "On the API keys page, copy the Publishable key (starts pk_test_)."
|
||||||
|
|||||||
Reference in New Issue
Block a user