Skip to content

Commit 6d43b5a

Browse files
feat(install): detect agent vs human, tailor bootstrap prompt
Non-interactive stdin (curl | sh from an agent) gets structured agent bootstrap instructions with numbered next steps. Interactive terminal (human) gets a concise human-friendly prompt.
1 parent 92566cf commit 6d43b5a

1 file changed

Lines changed: 36 additions & 18 deletions

File tree

install.sh

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ case ":${PATH}:" in
363363
esac
364364

365365
# ---------------------------------------------------------------------------
366-
# Bootstrap prompt
366+
# Bootstrap prompt — detect agent vs human
367367
# ---------------------------------------------------------------------------
368368
printf "\n"
369369
printf "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n"
@@ -381,22 +381,40 @@ printf "Claude: ~/.claude/plugins/workit\n"
381381
printf "Codex: ~/.agents/skills/workit\n"
382382
printf "Skills: loaded (Gmail, Calendar, Drive, Sheets, Docs, Slides, Chat, ...)\n"
383383
printf "Relay: https://auth.automagik.dev (no GCP setup needed)\n"
384-
printf "\n"
385-
printf "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n"
386-
printf "AGENT BOOTSTRAP PROMPT\n"
387-
printf "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n"
388-
printf "\n"
389-
printf "You now have access to Google Workspace via the \`wk\` CLI (workit v%s).\n" "$VERSION"
390-
printf "No GCP setup needed — auth runs through https://auth.automagik.dev.\n"
391-
printf "\n"
392-
printf "Quick start:\n"
393-
printf " wk auth status → check if accounts are already connected\n"
394-
printf " wk auth manage → add an account (opens browser or prints URL for headless)\n"
395-
printf " wk auth add EMAIL --headless --no-input → for fully unattended agent flow\n"
396-
printf "\n"
397-
printf "Available services: Gmail, Calendar, Drive, Sheets, Docs, Slides,\n"
398-
printf " Chat, Classroom, Tasks, Contacts, Keep, Forms, AppScript\n"
399-
printf "\n"
400-
printf "Ask the user what they want to do, then load the relevant skill file.\n"
401384
printf "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n"
385+
386+
# Agent detection: non-interactive stdin (curl | sh) = likely an agent
387+
if [ ! -t 0 ]; then
388+
# -----------------------------------------------------------------------
389+
# Agent bootstrap prompt — structured for LLM consumption
390+
# -----------------------------------------------------------------------
391+
printf "\n"
392+
printf "AGENT BOOTSTRAP INSTRUCTIONS\n"
393+
printf "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n"
394+
printf "\n"
395+
printf "You now have access to Google Workspace via the \`wk\` CLI (workit v%s).\n" "$VERSION"
396+
printf "No GCP setup needed — auth runs through https://auth.automagik.dev.\n"
397+
printf "\n"
398+
printf "Next steps:\n"
399+
printf " 1. wk auth status → check existing accounts\n"
400+
printf " 2. wk auth add EMAIL --headless --no-input → auth (prints URL for user)\n"
401+
printf " 3. wk gmail search 'newer_than:1d' --json → first query\n"
402+
printf "\n"
403+
printf "Available services: Gmail, Calendar, Drive, Sheets, Docs, Slides,\n"
404+
printf " Chat, Classroom, Tasks, Contacts, Keep, Forms, AppScript\n"
405+
printf "\n"
406+
printf "Load the relevant skill file for the user's request, then execute.\n"
407+
printf "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n"
408+
else
409+
# -----------------------------------------------------------------------
410+
# Human prompt — concise next steps
411+
# -----------------------------------------------------------------------
412+
printf "\n"
413+
printf "Next steps:\n"
414+
printf " ${BOLD}wk auth manage${NC} → connect your Google account\n"
415+
printf " ${BOLD}wk --help${NC} → see all commands\n"
416+
printf " ${BOLD}wk gmail search '...'${NC} → try your first query\n"
417+
printf "\n"
418+
printf "Docs: https://github.com/automagik-dev/workit\n"
419+
fi
402420
printf "\n"

0 commit comments

Comments
 (0)