Skip to content

feat(create-slack-app): read API keys from shell env before prompting#62

Draft
mwbrooks wants to merge 1 commit into
mainfrom
mwbrooks-create-slack-app-env-key-passthrough
Draft

feat(create-slack-app): read API keys from shell env before prompting#62
mwbrooks wants to merge 1 commit into
mainfrom
mwbrooks-create-slack-app-env-key-passthrough

Conversation

@mwbrooks

Copy link
Copy Markdown
Member

Summary

This pull request lets the create-slack-app skill pick up the AI provider API key from the developer's shell environment instead of always prompting for it in chat.

  • Step 4c now probes for the required env var (ANTHROPIC_API_KEY, OPENAI_API_KEY) with a non-echoing check before invoking AskUserQuestion.
  • When the variable is set, the value is passed through to slack env set by reference ("$ANTHROPIC_API_KEY"), so Bash expands it at run time and the literal key never lands in the chat transcript.
  • When the variable is missing, the existing AskUserQuestion prompt still runs — with a one-line note telling the developer they can export the variable ahead of time to skip the prompt in future sessions.
  • Tightens the "do not echo" guard to also forbid echo $VAR, printenv, and slack env list, all of which would print the stored value.

Motivated by demo recordings and screen-shared sessions where the existing flow would render an API key in plaintext in the visible transcript.

Testing

  • With ANTHROPIC_API_KEY exported in the shell, run create-slack-app against an agent template (e.g. bolt-python-starter-agent with the claude-agent-sdk subdir) and confirm:
    • The skill reports the key was picked up from the environment.
    • No AskUserQuestion prompt fires for the key.
    • The value never appears in the chat transcript.
    • The app launches and the agent template runs.
  • With the env var unset, run the same flow and confirm:
    • The AskUserQuestion prompt still fires.
    • The note about exporting the variable in future sessions is shown.
    • slack env set succeeds with the pasted value.

Step 4c now probes for the required provider key in the developer's
shell environment first and only falls back to AskUserQuestion when
it's missing. When the env var is present, the value is passed through
to slack env set by reference ("$VAR"), so the literal key never lands
in the chat transcript.

Tightens the "do not echo" guard to also forbid printenv, echo $VAR,
and slack env list — all of which would leak the value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant